{"version":3,"sources":["node_modules\\react-dom\\lib\\ReactInputSelection.js"],"names":["ReactDOMSelection","require","containsNode","focusNode","getActiveElement","isInDocument","node","document","documentElement","ReactInputSelection","hasSelectionCapabilities","elem","nodeName","toLowerCase","type","contentEditable","getSelectionInformation","focusedElem","selectionRange","getSelection","restoreSelection","priorSelectionInformation","curFocusedElem","priorFocusedElem","priorSelectionRange","setSelection","input","selection","start","selectionStart","end","selectionEnd","range","createRange","parentElement","moveStart","value","length","moveEnd","getOffsets","offsets","undefined","Math","min","createTextRange","collapse","select","setOffsets","module","exports"],"mappings":";;;;;;;;;;AAUA;;AAEA,GAAIA,mBAAoBC,QAAQ,qBAAR,CAAxB;;AAEA,GAAIC,cAAeD,QAAQ,uBAAR,CAAnB;AACA,GAAIE,WAAYF,QAAQ,oBAAR,CAAhB;AACA,GAAIG,kBAAmBH,QAAQ,2BAAR,CAAvB;;AAEA,QAASI,aAAT,CAAsBC,IAAtB,CAA4B;AAC1B,MAAOJ,cAAaK,SAASC,eAAtB,CAAuCF,IAAvC,CAAP;AACD;;;;;;;;AAQD,GAAIG,qBAAsB;AACxBC,yBAA0B,kCAAUC,IAAV,CAAgB;AACxC,GAAIC,UAAWD,MAAQA,KAAKC,QAAb,EAAyBD,KAAKC,QAAL,CAAcC,WAAd,EAAxC;AACA,MAAOD,YAAaA,WAAa,OAAb,EAAwBD,KAAKG,IAAL,GAAc,MAAtC,EAAgDF,WAAa,UAA7D,EAA2ED,KAAKI,eAAL,GAAyB,MAAjH,CAAP;AACD,CAJuB;;AAMxBC,wBAAyB,kCAAY;AACnC,GAAIC,aAAcb,kBAAlB;AACA,MAAO;AACLa,YAAaA,WADR;AAELC,eAAgBT,oBAAoBC,wBAApB,CAA6CO,WAA7C,EAA4DR,oBAAoBU,YAApB,CAAiCF,WAAjC,CAA5D,CAA4G,IAFvH,CAAP;;AAID,CAZuB;;;;;;;AAmBxBG,iBAAkB,0BAAUC,yBAAV,CAAqC;AACrD,GAAIC,gBAAiBlB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AIA,MAAQW,SAAZ,CAAuB;AACrBX,IAAMF,KAAN;AACD;;AAED,GAAI,kBAAoBF,MAAxB,CAA+B;AAC7BA,MAAMG,cAAN,CAAuBD,KAAvB;AACAF,MAAMK,YAAN,CAAqBW,KAAKC,GAAL,CAASb,GAAT,CAAcJ,MAAMU,KAAN,CAAYC,MAA1B,CAArB;AACD,CAHD,IAGO,IAAI9B,SAASoB,SAAT,EAAsBD,MAAMd,QAA5B,EAAwCc,MAAMd,QAAN,CAAeC,WAAf,KAAiC,OAA7E,CAAsF;AAC3F,GAAImB,OAAQN,MAAMkB,eAAN,EAAZ;AACAZ,MAAMa,QAAN,CAAe,IAAf;AACAb,MAAMG,SAAN,CAAgB,WAAhB,CAA6BP,KAA7B;AACAI,MAAMM,OAAN,CAAc,WAAd,CAA2BR,IAAMF,KAAjC;AACAI,MAAMc,MAAN;AACD,CANM,IAMA;AACL9C,kBAAkB+C,UAAlB,CAA6BrB,KAA7B,CAAoCc,OAApC;AACD;AACF,CA1FuB,CAA1B;;;AA6FAQ,OAAOC,OAAP,CAAiBxC,mBAAjB","file":"ReactInputSelection.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\nvar ReactDOMSelection = require('./ReactDOMSelection');\n\nvar containsNode = require('fbjs/lib/containsNode');\nvar focusNode = require('fbjs/lib/focusNode');\nvar getActiveElement = require('fbjs/lib/getActiveElement');\n\nfunction isInDocument(node) {\n  return containsNode(document.documentElement, node);\n}\n\n/**\n * @ReactInputSelection: React input selection module. Based on Selection.js,\n * but modified to be suitable for react and has a couple of bug fixes (doesn't\n * assume buttons have range selections allowed).\n * Input selection module for React.\n */\nvar ReactInputSelection = {\n  hasSelectionCapabilities: function (elem) {\n    var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();\n    return nodeName && (nodeName === 'input' && elem.type === 'text' || nodeName === 'textarea' || elem.contentEditable === 'true');\n  },\n\n  getSelectionInformation: function () {\n    var focusedElem = getActiveElement();\n    return {\n      focusedElem: focusedElem,\n      selectionRange: ReactInputSelection.hasSelectionCapabilities(focusedElem) ? ReactInputSelection.getSelection(focusedElem) : null\n    };\n  },\n\n  /**\n   * @restoreSelection: If any selection information was potentially lost,\n   * restore it. This is useful when performing operations that could remove dom\n   * nodes and place them back in, resulting in focus being lost.\n   */\n  restoreSelection: function (priorSelectionInformation) {\n    var curFocusedElem = getActiveElement();\n    var priorFocusedElem = priorSelectionInformation.focusedElem;\n    var priorSelectionRange = priorSelectionInformation.selectionRange;\n    if (curFocusedElem !== priorFocusedElem && isInDocument(priorFocusedElem)) {\n      if (ReactInputSelection.hasSelectionCapabilities(priorFocusedElem)) {\n        ReactInputSelection.setSelection(priorFocusedElem, priorSelectionRange);\n      }\n      focusNode(priorFocusedElem);\n    }\n  },\n\n  /**\n   * @getSelection: Gets the selection bounds of a focused textarea, input or\n   * contentEditable node.\n   * -@input: Look up selection bounds of this input\n   * -@return {start: selectionStart, end: selectionEnd}\n   */\n  getSelection: function (input) {\n    var selection;\n\n    if ('selectionStart' in input) {\n      // Modern browser with input or textarea.\n      selection = {\n        start: input.selectionStart,\n        end: input.selectionEnd\n      };\n    } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {\n      // IE8 input.\n      var range = document.selection.createRange();\n      // There can only be one selection per document in IE, so it must\n      // be in our element.\n      if (range.parentElement() === input) {\n        selection = {\n          start: -range.moveStart('character', -input.value.length),\n          end: -range.moveEnd('character', -input.value.length)\n        };\n      }\n    } else {\n      // Content editable or old IE textarea.\n      selection = ReactDOMSelection.getOffsets(input);\n    }\n\n    return selection || { start: 0, end: 0 };\n  },\n\n  /**\n   * @setSelection: Sets the selection bounds of a textarea or input and focuses\n   * the input.\n   * -@input     Set selection bounds of this input or textarea\n   * -@offsets   Object of same form that is returned from get*\n   */\n  setSelection: function (input, offsets) {\n    var start = offsets.start;\n    var end = offsets.end;\n    if (end === undefined) {\n      end = start;\n    }\n\n    if ('selectionStart' in input) {\n      input.selectionStart = start;\n      input.selectionEnd = Math.min(end, input.value.length);\n    } else if (document.selection && input.nodeName && input.nodeName.toLowerCase() === 'input') {\n      var range = input.createTextRange();\n      range.collapse(true);\n      range.moveStart('character', start);\n      range.moveEnd('character', end - start);\n      range.select();\n    } else {\n      ReactDOMSelection.setOffsets(input, offsets);\n    }\n  }\n};\n\nmodule.exports = ReactInputSelection;"]}