{"version":3,"sources":["node_modules\\react-dom\\lib\\getNodeForCharacterOffset.js"],"names":["getLeafNode","node","firstChild","getSiblingNode","nextSibling","parentNode","getNodeForCharacterOffset","root","offset","nodeStart","nodeEnd","nodeType","textContent","length","module","exports"],"mappings":";;;;;;;;;;AAUA;;;;;;;;;AASA,QAASA,YAAT,CAAqBC,IAArB,CAA2B;AACzB,MAAOA,MAAQA,KAAKC,UAApB,CAAgC;AAC9BD,KAAOA,KAAKC,UAAZ;AACD;AACD,MAAOD,KAAP;AACD;;;;;;;;;AASD,QAASE,eAAT,CAAwBF,IAAxB,CAA8B;AAC5B,MAAOA,IAAP,CAAa;AACX,GAAIA,KAAKG,WAAT,CAAsB;AACpB,MAAOH,MAAKG,WAAZ;AACD;AACDH,KAAOA,KAAKI,UAAZ;AACD;AACF;;;;;;;;;AASD,QAASC,0BAAT,CAAmCC,IAAnC,CAAyCC,MAAzC,CAAiD;AAC/C,GAAIP,MAAOD,YAAYO,IAAZ,CAAX;AACA,GAAIE,WAAY,CAAhB;AACA,GAAIC,SAAU,CAAd;;AAEA,MAAOT,IAAP,CAAa;AACX,GAAIA,KAAKU,QAAL,GAAkB,CAAtB,CAAyB;AACvBD,QAAUD,UAAYR,KAAKW,WAAL,CAAiBC,MAAvC;;AAEA,GAAIJ,WAAaD,MAAb,EAAuBE,SAAWF,MAAtC,CAA8C;AAC5C,MAAO;AACLP,KAAMA,IADD;AAELO,OAAQA,OAASC,SAFZ,CAAP;;AAID;;AAEDA,UAAYC,OAAZ;AACD;;AAEDT,KAAOD,YAAYG,eAAeF,IAAf,CAAZ,CAAP;AACD;AACF;;AAEDa,OAAOC,OAAP,CAAiBT,yBAAjB","file":"getNodeForCharacterOffset.js","sourceRoot":"D:/Work/Office/react-native-on-web/cli/tmpl/project","sourcesContent":["/**\n * Copyright 2013-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n */\n\n'use strict';\n\n/**\n * Given any node return the first leaf node without children.\n *\n * @param {DOMElement|DOMTextNode} node\n * @return {DOMElement|DOMTextNode}\n */\n\nfunction getLeafNode(node) {\n  while (node && node.firstChild) {\n    node = node.firstChild;\n  }\n  return node;\n}\n\n/**\n * Get the next sibling within a container. This will walk up the\n * DOM if a node's siblings have been exhausted.\n *\n * @param {DOMElement|DOMTextNode} node\n * @return {?DOMElement|DOMTextNode}\n */\nfunction getSiblingNode(node) {\n  while (node) {\n    if (node.nextSibling) {\n      return node.nextSibling;\n    }\n    node = node.parentNode;\n  }\n}\n\n/**\n * Get object describing the nodes which contain characters at offset.\n *\n * @param {DOMElement|DOMTextNode} root\n * @param {number} offset\n * @return {?object}\n */\nfunction getNodeForCharacterOffset(root, offset) {\n  var node = getLeafNode(root);\n  var nodeStart = 0;\n  var nodeEnd = 0;\n\n  while (node) {\n    if (node.nodeType === 3) {\n      nodeEnd = nodeStart + node.textContent.length;\n\n      if (nodeStart <= offset && nodeEnd >= offset) {\n        return {\n          node: node,\n          offset: offset - nodeStart\n        };\n      }\n\n      nodeStart = nodeEnd;\n    }\n\n    node = getLeafNode(getSiblingNode(node));\n  }\n}\n\nmodule.exports = getNodeForCharacterOffset;"]}