Files
2026-07-28 01:06:53 +03:00

275 lines
11 KiB
TypeScript

/* Metro module 15102; source: lib/search/EnglishAnalyzer.tsx; dependencies: [22, 15103, 15105, 2] */
import Module00022 from '../../by-id/module-00022.js'; /* Metro dependency 22 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as SnowballStemmerModule from './snowballStemmer.tsx'; /* Metro dependency 15103 */
function _fun114263(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#114263, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15299:6, offset: 0x02419f24, size: 264 bytes, params: 8, frame: 22
const env0_0 = require;
const _arrayLikeToArray_114266 = function(a0, a1) {
var r0;
var r1;
var r2;
var value3;
var length;
var value5;
var value = undefined;
var value2 = value == null;
reducibleJoin2: while (true) {
if (value2) {
r0 = value2;
break reducibleJoin2;
}
value3 = value > a0.length;
r0 = value3;
break reducibleJoin2;
}
reducibleJoin4: while (true) {
if (r0) {
length = a0.length;
r1 = length;
break reducibleJoin4;
}
r1 = value;
break reducibleJoin4;
}
value = (0, global.Array)(r1);
var value4 = 0;
if (value4 < r1) {
r2 = value4;
reducibleLoop5: while (true) {
value[r2] = a0[r2];
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
if (value5 < r1) {
r2 = value5;
continue reducibleLoop5;
}
break reducibleLoop5;
}
}
return value;
};
const stripPossessive = function(a0) {
return a0.replace(RegExp("('|\\u2019|\\uFF07)(s|S)$", ''), '');
};
const lowercase_114268 = function(a0) {
return a0.toLowerCase();
};
const isBlank = function(a0) {
return a0.length === 0;
};
const analyze_1142712 = analyze_114271;
const shouldHighlight2 = shouldHighlight;
const highlightAST2 = highlightAST;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const Set = global.Set;
const set = new Set(['a', 'an', 'and', 'are', 'as', 'at', 'be', 'but', 'by', 'for', 'if', 'in', 'into', 'is', 'it',
'no', 'not', 'of', 'on', 'or', 'such', 'that', 'the', 'their', 'then', 'there', 'these', 'they', 'this', 'to',
'was', 'will', 'with']);
(FileImportTrackerModule).fileFinishedImporting('lib/search/EnglishAnalyzer.tsx');
exports.analyze = analyze_1142712;
exports.shouldHighlight = shouldHighlight2;
exports.highlightAST = highlightAST2;
exports.createASTHighlighter = createASTHighlighter;
function _createForOfIteratorHelperLoose_114264(a0, a1) { // fn#114264, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15299:46, offset: 0x0241a02c, size: 372 bytes, params: 3, frame: 20
var r6;
var r9;
var r5;
var value3;
var regexp;
const env0_0 = a0;
const Symbol = global.Symbol;
let value = typeof Symbol !== 'undefined';
let r1 = value && a0[global.Symbol.iterator];
r1 = !r1 ? a0['@@iterator'] : r1;
if (r1) {
value = r1.call(a0);
return value.next.bind(value);
}
const Array = global.Array;
if (Array.isArray(a0)) {
if (r1) {
}
return _fun114265;
}
value = undefined;
if (a0) {
if (typeof a0 === 'string') {
value = _arrayLikeToArray_114266(a0, value);
r5 = value;
} else {
value3 = ({}).toString.call(a0).slice(8, -1);
r6 = value3 === 'Object' && a0.constructor;
r9 = r6 ? a0.constructor.name : value3;
if (r9 === 'Map') {
r6 = global.Array.from(a0);
} else if (r9 === 'Set') {
r6 = global.Array.from(a0);
} else if (r9 === 'Arguments') {
value = _arrayLikeToArray_114266(a0, value);
r6 = value;
} else {
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
if (regexp.test(r9)) {
value = _arrayLikeToArray_114266(a0, value);
r6 = value;
} else {
r6 = value;
}
}
r5 = r6;
}
} else {
r5 = value;
}
if (r5) {
if (r5) {
}
return _fun114265;
}
const TypeError = global.TypeError;
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
function _fun114265() { // fn#114265, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15299:617, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5
return env0_1 >= env0_0.length ? {done: true} : {done: false,
value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]};
}
}
function isStopWord(a0) { // fn#114269, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15299:1339, offset: 0x0102724a, size: 22 bytes, params: 2, frame: 11
return env0_3.has(a0);
}
function analyze_114271(a0) { // fn#114271, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15299:1418, offset: 0x0241a1d2, size: 157 bytes, params: 2, frame: 15
const value2 = (Module00022)(a0.split(RegExp('\\W+', '')));
const value3 = value2.map(stripPossessive);
const value4 = value3.reject(isBlank);
const value5 = value4.map(lowercase_114268);
const value6 = value5.reject(isStopWord);
return value6.map((SnowballStemmerModule).snowballStem).value();
}
function shouldHighlight(a0, a1) { // fn#114272, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15299:1575, offset: 0x0241a26f, size: 192 bytes, params: 3, frame: 16
var value4;
var done;
var value5;
var includes;
var value6;
let value = a2;
let r1 = value !== undefined ? value : false;
const isBlankBinding = isBlank;
const value2 = lowercase_114268(stripPossessive(a0));
if (isBlankBinding(value2)) {
return false;
}
if (isStopWord(value2)) {
return false;
}
const value3 = (SnowballStemmerModule).snowballStem(value2);
if (r1) {
value = _createForOfIteratorHelperLoose_114264(a1.values());
value4 = value();
done = value4.done;
if (done) {
return false;
}
r1 = value4;
loopExit7: while (true) {
value5 = r1.value;
includes = value3.includes;
if (Reflect.apply(includes, value3, [value5])) {
break loopExit7;
}
value6 = value();
done = value6.done;
if (done) {
return false;
}
r1 = value6;
continue;
}
return true;
}
return a1.has(value3);
}
function highlightAST(a0, a1, a2) { // fn#114273, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15299:1863, offset: 0x0241a32f, size: 336 bytes, params: 4, frame: 17
var items2;
const env0_0 = a1;
const env0_1 = a2;
const Array = global.Array;
if (Array.isArray(a0)) {
a0.forEach(function(a0) {
highlightAST(a0, require, importDefault);
return a0;
});
} else if (a0.type === 'list') {
a0.items.forEach(_fun114275);
} else if (typeof a0.content !== 'string') {
if (a0.content != null) {
highlightAST(a0.content, a1, a2);
}
} else if (a0.type !== 'codeBlock') {
items2 = [];
var env0_3 = '';
a0.content.split(RegExp('(\\W+)', 'g')).forEach(_fun114276);
if (items2.length > 0) {
if (env0_3.length > 0) {
items2.push({type: 'text', content: env0_3});
}
if (a0.type === 'text') {
a0.content = items2;
} else {
items2 = [{type: 'text', content: items2}];
a0.content = items2;
}
}
} else if (a0.content != null) {
highlightAST(a0.content, a1, a2);
}
return a0;
function _fun114275(a0) { // fn#114275, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15299:1989, offset: 0x0241a47f, size: 32 bytes, params: 2, frame: 15
highlightAST(a0, require, importDefault);
return a0;
}
function _fun114276(a0) { // fn#114276, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15299:2121, offset: 0x0241a49f, size: 128 bytes, params: 2, frame: 17
const shouldHighlight2 = shouldHighlight(a0, require, importDefault);
let binding = env0_3;
if (shouldHighlight2) {
if (binding.length > 0) {
binding = env0_2;
binding.push({type: 'text', content: env0_3});
}
binding = env0_2;
binding.push({type: 'highlight', content: a0});
} else {
env0_3 = binding + a0;
}
}
}
function createASTHighlighter(a0) { // fn#114277, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15299:2597, offset: 0x0241a51f, size: 155 bytes, params: 2, frame: 17
var value3;
const value = a1;
const env0_0 = value !== undefined ? value : false;
const length = a0.length;
const SEARCH_PARTIAL_NAME_MATCH_MIN_QUERY_LENGTH = (require(15105) /* metro dependency 15105: Search */).SEARCH_PARTIAL_NAME_MATCH_MIN_QUERY_LENGTH;
if (length >= SEARCH_PARTIAL_NAME_MATCH_MIN_QUERY_LENGTH) {
value3 = a0.length <= (require(15105) /* metro dependency 15105: Search */).SEARCH_PARTIAL_NAME_MATCH_MAX_QUERY_LENGTH;
}
const Set = global.Set;
const set = new Set(analyze_114271(a0));
return _fun114278;
function _fun114278(a0) { // fn#114278, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15299:2795, offset: 0x0241a5ba, size: 39 bytes, params: 2, frame: 16
highlightAST(a0, env0_2, env0_1 && env0_0);
return a0;
}
}
}
global.__d(_fun114263, 15102, [22, 15103, 15105, 2]) /* metro module 15102, dependencies: [22, 15103, 15105, 2] */;