PromoCursed/node_modules/.cache/babel-loader/3a002e422e02a25cfd6c391dbdd69686aced8e5f4e3d07abfd6d8cf2cf3fc0cd.json
2024-08-20 23:25:37 +04:00

1 line
10 KiB
JSON

{"ast":null,"code":"/**\n * Cut input selection into 2 part and return text before selection start\n */\nexport function getBeforeSelectionText(input) {\n var selectionStart = input.selectionStart;\n return input.value.slice(0, selectionStart);\n}\n/**\n * Find the last match prefix index\n */\nexport function getLastMeasureIndex(text, prefix) {\n return prefix.reduce(function (lastMatch, prefixStr) {\n var lastIndex = text.lastIndexOf(prefixStr);\n if (lastIndex > lastMatch.location) {\n return {\n location: lastIndex,\n prefix: prefixStr\n };\n }\n return lastMatch;\n }, {\n location: -1,\n prefix: ''\n });\n}\nfunction lower(char) {\n return (char || '').toLowerCase();\n}\nfunction reduceText(text, targetText, split) {\n var firstChar = text[0];\n if (!firstChar || firstChar === split) {\n return text;\n }\n\n // Reuse rest text as it can\n var restText = text;\n var targetTextLen = targetText.length;\n for (var i = 0; i < targetTextLen; i += 1) {\n if (lower(restText[i]) !== lower(targetText[i])) {\n restText = restText.slice(i);\n break;\n } else if (i === targetTextLen - 1) {\n restText = restText.slice(targetTextLen);\n }\n }\n return restText;\n}\n\n/**\n * Paint targetText into current text:\n * text: little@litest\n * targetText: light\n * => little @light test\n */\nexport function replaceWithMeasure(text, measureConfig) {\n var measureLocation = measureConfig.measureLocation,\n prefix = measureConfig.prefix,\n targetText = measureConfig.targetText,\n selectionStart = measureConfig.selectionStart,\n split = measureConfig.split;\n\n // Before text will append one space if have other text\n var beforeMeasureText = text.slice(0, measureLocation);\n if (beforeMeasureText[beforeMeasureText.length - split.length] === split) {\n beforeMeasureText = beforeMeasureText.slice(0, beforeMeasureText.length - split.length);\n }\n if (beforeMeasureText) {\n beforeMeasureText = \"\".concat(beforeMeasureText).concat(split);\n }\n\n // Cut duplicate string with current targetText\n var restText = reduceText(text.slice(selectionStart), targetText.slice(selectionStart - measureLocation - prefix.length), split);\n if (restText.slice(0, split.length) === split) {\n restText = restText.slice(split.length);\n }\n var connectedStartText = \"\".concat(beforeMeasureText).concat(prefix).concat(targetText).concat(split);\n return {\n text: \"\".concat(connectedStartText).concat(restText),\n selectionLocation: connectedStartText.length\n };\n}\nexport function setInputSelection(input, location) {\n input.setSelectionRange(location, location);\n\n /**\n * Reset caret into view.\n * Since this function always called by user control, it's safe to focus element.\n */\n input.blur();\n input.focus();\n}\nexport function validateSearch(text, split) {\n return !split || text.indexOf(split) === -1;\n}\nexport function filterOption(input, _ref) {\n var _ref$value = _ref.value,\n value = _ref$value === void 0 ? '' : _ref$value;\n var lowerCase = input.toLowerCase();\n return value.toLowerCase().indexOf(lowerCase) !== -1;\n}","map":{"version":3,"names":["getBeforeSelectionText","input","selectionStart","value","slice","getLastMeasureIndex","text","prefix","reduce","lastMatch","prefixStr","lastIndex","lastIndexOf","location","lower","char","toLowerCase","reduceText","targetText","split","firstChar","restText","targetTextLen","length","i","replaceWithMeasure","measureConfig","measureLocation","beforeMeasureText","concat","connectedStartText","selectionLocation","setInputSelection","setSelectionRange","blur","focus","validateSearch","indexOf","filterOption","_ref","_ref$value","lowerCase"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-mentions/es/util.js"],"sourcesContent":["/**\n * Cut input selection into 2 part and return text before selection start\n */\nexport function getBeforeSelectionText(input) {\n var selectionStart = input.selectionStart;\n return input.value.slice(0, selectionStart);\n}\n/**\n * Find the last match prefix index\n */\nexport function getLastMeasureIndex(text, prefix) {\n return prefix.reduce(function (lastMatch, prefixStr) {\n var lastIndex = text.lastIndexOf(prefixStr);\n if (lastIndex > lastMatch.location) {\n return {\n location: lastIndex,\n prefix: prefixStr\n };\n }\n return lastMatch;\n }, {\n location: -1,\n prefix: ''\n });\n}\nfunction lower(char) {\n return (char || '').toLowerCase();\n}\nfunction reduceText(text, targetText, split) {\n var firstChar = text[0];\n if (!firstChar || firstChar === split) {\n return text;\n }\n\n // Reuse rest text as it can\n var restText = text;\n var targetTextLen = targetText.length;\n for (var i = 0; i < targetTextLen; i += 1) {\n if (lower(restText[i]) !== lower(targetText[i])) {\n restText = restText.slice(i);\n break;\n } else if (i === targetTextLen - 1) {\n restText = restText.slice(targetTextLen);\n }\n }\n return restText;\n}\n\n/**\n * Paint targetText into current text:\n * text: little@litest\n * targetText: light\n * => little @light test\n */\nexport function replaceWithMeasure(text, measureConfig) {\n var measureLocation = measureConfig.measureLocation,\n prefix = measureConfig.prefix,\n targetText = measureConfig.targetText,\n selectionStart = measureConfig.selectionStart,\n split = measureConfig.split;\n\n // Before text will append one space if have other text\n var beforeMeasureText = text.slice(0, measureLocation);\n if (beforeMeasureText[beforeMeasureText.length - split.length] === split) {\n beforeMeasureText = beforeMeasureText.slice(0, beforeMeasureText.length - split.length);\n }\n if (beforeMeasureText) {\n beforeMeasureText = \"\".concat(beforeMeasureText).concat(split);\n }\n\n // Cut duplicate string with current targetText\n var restText = reduceText(text.slice(selectionStart), targetText.slice(selectionStart - measureLocation - prefix.length), split);\n if (restText.slice(0, split.length) === split) {\n restText = restText.slice(split.length);\n }\n var connectedStartText = \"\".concat(beforeMeasureText).concat(prefix).concat(targetText).concat(split);\n return {\n text: \"\".concat(connectedStartText).concat(restText),\n selectionLocation: connectedStartText.length\n };\n}\nexport function setInputSelection(input, location) {\n input.setSelectionRange(location, location);\n\n /**\n * Reset caret into view.\n * Since this function always called by user control, it's safe to focus element.\n */\n input.blur();\n input.focus();\n}\nexport function validateSearch(text, split) {\n return !split || text.indexOf(split) === -1;\n}\nexport function filterOption(input, _ref) {\n var _ref$value = _ref.value,\n value = _ref$value === void 0 ? '' : _ref$value;\n var lowerCase = input.toLowerCase();\n return value.toLowerCase().indexOf(lowerCase) !== -1;\n}"],"mappings":"AAAA;AACA;AACA;AACA,OAAO,SAASA,sBAAsBA,CAACC,KAAK,EAAE;EAC5C,IAAIC,cAAc,GAAGD,KAAK,CAACC,cAAc;EACzC,OAAOD,KAAK,CAACE,KAAK,CAACC,KAAK,CAAC,CAAC,EA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