424 lines
14 KiB
TypeScript
424 lines
14 KiB
TypeScript
/* Metro module 14152; source: modules/user_settings/UserSettingSearchManager.tsx; dependencies: [6, 7, 6590, 14153, 2] */
|
|
function _fun107088(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#107088, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:6, offset: 0x022f2dbe, size: 160 bytes, params: 8, frame: 19
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_107091 = 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 Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_3 = importDefault(6) /* metro dependency 6 */;
|
|
const env0_4 = importDefault(7) /* metro dependency 7 */;
|
|
let value = _fun107092();
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/user_settings/UserSettingSearchManager.tsx');
|
|
exports.default = value;
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_107089(a0, a1) { // fn#107089, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:120, offset: 0x022f2e5e, 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 _fun107090;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_107091(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_107091(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_107091(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun107090;
|
|
}
|
|
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 _fun107092() { // fn#107092, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:1036, offset: 0x022f2fd2, size: 113 bytes, params: 1, frame: 15
|
|
return env0_4(SettingSearchManager, [{key: 'search', value: function(a0) {
|
|
var env0_0 = this;
|
|
var env0_1 = a0;
|
|
var Promise = global.Promise;
|
|
var value = Object.create(Promise.prototype, {constructor: {value: Promise}});
|
|
var value2 = new Promise(_fun107098);
|
|
return value2 instanceof Object ? value2 : value;
|
|
}}, {key: 'getMatchingSettings', value: function(a0) {
|
|
var env0_0 = a0;
|
|
var value = this.cache.get(a0);
|
|
if (value != null) {
|
|
return value;
|
|
}
|
|
var items = [];
|
|
var env0_1 = items;
|
|
this.terms.forEach(_fun107100);
|
|
this.cache.set(a0, items);
|
|
return items;
|
|
}}, {key: 'getScoredSearchResults', value: function(a0) {
|
|
var value = a0.trim();
|
|
value = value.toLocaleLowerCase();
|
|
var env0_0 = value;
|
|
if (value.length === 0) {
|
|
return [];
|
|
}
|
|
var value2 = this.cacheScored.get(value);
|
|
if (value2 != null) {
|
|
return value2;
|
|
}
|
|
var items = [];
|
|
var env0_1 = items;
|
|
this.preprocessed.forEach(_fun107102);
|
|
this.cacheScored.set(value, items);
|
|
return items;
|
|
}}]);
|
|
}
|
|
|
|
function SettingSearchManager(a0) { // fn#107093, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:1057, offset: 0x022f3043, size: 135 bytes, params: 2, frame: 16
|
|
var environment;
|
|
const value = environment.__proto__;
|
|
env1_3(this, SettingSearchManager);
|
|
this.terms = a0;
|
|
let Map = global.Map;
|
|
this.cache = new Map();
|
|
Map = global.Map;
|
|
this.cacheScored = new Map();
|
|
this.preprocessed = [];
|
|
a0.forEach(_fun107094);
|
|
}
|
|
|
|
function value_107097(a0) { // fn#107097, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:1498, offset: 0x022f3222, size: 53 bytes, params: 2, frame: 11
|
|
const env0_1 = a0;
|
|
const Promise = global.Promise;
|
|
const value = Object.create(Promise.prototype, {constructor: {value: Promise}});
|
|
const promise = new Promise(_fun107098);
|
|
return promise instanceof Object ? promise : value;
|
|
}
|
|
|
|
function value_107099(a0) { // fn#107099, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:1603, offset: 0x022f327b, size: 86 bytes, params: 2, frame: 16
|
|
const env0_0 = a0;
|
|
const value = this.cache.get(a0);
|
|
if (value != null) {
|
|
return value;
|
|
}
|
|
const items2 = [];
|
|
this.terms.forEach(_fun107100);
|
|
this.cache.set(a0, items2);
|
|
return items2;
|
|
}
|
|
|
|
function value_107101(a0) { // fn#107101, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:1908, offset: 0x022f3386, size: 123 bytes, params: 2, frame: 16
|
|
let value = a0.trim();
|
|
value = value.toLocaleLowerCase();
|
|
if (value.length === 0) {
|
|
return [];
|
|
}
|
|
const value2 = this.cacheScored.get(value);
|
|
if (value2 != null) {
|
|
return value2;
|
|
}
|
|
const items2 = [];
|
|
this.preprocessed.forEach(_fun107102);
|
|
this.cacheScored.set(value, items2);
|
|
return items2;
|
|
}
|
|
|
|
function _fun107094(a0) { // fn#107094, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:1208, offset: 0x022f30ca, size: 183 bytes, params: 2, frame: 17
|
|
var r2;
|
|
var r3;
|
|
var r5;
|
|
var item3;
|
|
var value3;
|
|
const iterator = a0[Symbol.iterator]();
|
|
const iterator2 = iterator.next;
|
|
let item2 = Reflect.apply(iterator2, iterator, []);
|
|
let item = item2.value;
|
|
item2 = item2.done ? undefined : iterator;
|
|
const value = undefined;
|
|
const value2 = item2 === value;
|
|
const r4 = value2 ? value : item;
|
|
if (value2) {
|
|
r2 = item2;
|
|
r3 = value;
|
|
r5 = value2;
|
|
} else {
|
|
item3 = Reflect.apply(iterator2, item2, []);
|
|
item = item3.value;
|
|
item3 = item3.done ? undefined : item2;
|
|
value3 = item3 === value;
|
|
if (value3) {
|
|
r2 = item3;
|
|
r3 = value;
|
|
r5 = value3;
|
|
} else {
|
|
r2 = item3;
|
|
r3 = item;
|
|
r5 = value3;
|
|
}
|
|
}
|
|
if (!r5) {
|
|
r2.return();
|
|
}
|
|
const items2 = [];
|
|
const env0_0 = items2;
|
|
const Set = global.Set;
|
|
const set = new Set();
|
|
r3.forEach(_fun107095);
|
|
env0_0.preprocessed.push([r4, {normalizedSearchTerms: items2, normalizedTokens: []}]);
|
|
return value;
|
|
}
|
|
|
|
function _fun107098(a0) { // fn#107098, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:1530, offset: 0x022f3257, size: 36 bytes, params: 2, frame: 11
|
|
a0(env0_0.getMatchingSettings(env0_1));
|
|
}
|
|
|
|
function _fun107100(a0) { // fn#107100, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:1695, offset: 0x022f32d1, size: 181 bytes, params: 2, frame: 20
|
|
var r1;
|
|
var r2;
|
|
var r4;
|
|
var item3;
|
|
var value3;
|
|
var value8;
|
|
var defaultImport;
|
|
var binding;
|
|
var toLowerCase;
|
|
var value9;
|
|
var value10;
|
|
var push;
|
|
const iterator = a0[Symbol.iterator]();
|
|
const iterator2 = iterator.next;
|
|
let item2 = Reflect.apply(iterator2, iterator, []);
|
|
let item = item2.value;
|
|
item2 = item2.done ? undefined : iterator;
|
|
const value = undefined;
|
|
const value2 = item2 === value;
|
|
const r3 = value2 ? value : item;
|
|
if (value2) {
|
|
r1 = item2;
|
|
r2 = value;
|
|
r4 = value2;
|
|
} else {
|
|
item3 = Reflect.apply(iterator2, item2, []);
|
|
item = item3.value;
|
|
item3 = item3.done ? undefined : item2;
|
|
value3 = item3 === value;
|
|
if (value3) {
|
|
r1 = item3;
|
|
r2 = value;
|
|
r4 = value3;
|
|
} else {
|
|
r1 = item3;
|
|
r2 = item;
|
|
r4 = value3;
|
|
}
|
|
}
|
|
if (!r4) {
|
|
r1.return();
|
|
}
|
|
const value5 = _createForOfIteratorHelperLoose_107089(r2);
|
|
const value6 = value5();
|
|
let done = value6.done;
|
|
if (!done) {
|
|
r4 = value6;
|
|
loopExit6: while (true) {
|
|
value8 = r4.value;
|
|
defaultImport = importDefault(6590) /* metro dependency 6590 */;
|
|
binding = env0_0;
|
|
toLowerCase = binding.toLowerCase;
|
|
value9 = Reflect.apply(toLowerCase, binding, []);
|
|
toLowerCase = value8.toLowerCase;
|
|
if (defaultImport(value9, Reflect.apply(toLowerCase, value8, []))) {
|
|
binding = env0_1;
|
|
push = binding.push;
|
|
Reflect.apply(push, binding, [r3]);
|
|
break loopExit6;
|
|
}
|
|
value10 = value5();
|
|
done = value10.done;
|
|
if (done) {
|
|
break loopExit6;
|
|
}
|
|
r4 = value10;
|
|
continue;
|
|
}
|
|
}
|
|
return value;
|
|
}
|
|
|
|
function _fun107102(a0) { // fn#107102, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:2073, offset: 0x022f3401, size: 242 bytes, params: 2, frame: 21
|
|
var r1;
|
|
var r2;
|
|
var r52;
|
|
var item3;
|
|
var value3;
|
|
var normalizedTokens;
|
|
var normalizedSearchTerms;
|
|
var binding;
|
|
var error;
|
|
const iterator = a0[Symbol.iterator]();
|
|
const iterator2 = iterator.next;
|
|
const value = undefined;
|
|
let item2 = Reflect.apply(iterator2, iterator, []);
|
|
let item = item2.value;
|
|
item2 = item2.done ? undefined : iterator;
|
|
const value2 = item2 === value;
|
|
const r5 = value2 ? value : item;
|
|
if (value2) {
|
|
r1 = item2;
|
|
r2 = value2;
|
|
r52 = value;
|
|
} else {
|
|
item3 = Reflect.apply(iterator2, item2, []);
|
|
item = item3.value;
|
|
item3 = item3.done ? undefined : item2;
|
|
value3 = item3 === value;
|
|
if (value3) {
|
|
r1 = item3;
|
|
r2 = value3;
|
|
r52 = value;
|
|
} else {
|
|
r1 = item3;
|
|
r2 = value3;
|
|
r52 = item;
|
|
}
|
|
}
|
|
try {
|
|
normalizedTokens = r52.normalizedTokens;
|
|
normalizedSearchTerms = r52.normalizedSearchTerms;
|
|
} catch (error) {
|
|
if (!r2) {
|
|
try {
|
|
r1.return();
|
|
} catch {
|
|
}
|
|
}
|
|
throw error;
|
|
}
|
|
if (!r2) {
|
|
r1.return();
|
|
}
|
|
let env0_0 = 0;
|
|
if (normalizedSearchTerms.some(_fun107103)) {
|
|
env0_0 = 1;
|
|
} else if (normalizedTokens.some(_fun107104)) {
|
|
env0_0 = 0.95;
|
|
} else {
|
|
normalizedSearchTerms.forEach(_fun107105);
|
|
}
|
|
if (env0_0 > 0) {
|
|
binding = env0_1;
|
|
binding.push({setting: r5, score: env0_0});
|
|
}
|
|
return value;
|
|
}
|
|
|
|
function _fun107095(a0) { // fn#107095, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:1253, offset: 0x022f3181, size: 96 bytes, params: 2, frame: 12
|
|
const binding = env0_0;
|
|
binding.push(a0.toLocaleLowerCase());
|
|
if (a0.includes(' ')) {
|
|
a0.split(RegExp('\\s+', '')).forEach(_fun107096);
|
|
}
|
|
}
|
|
|
|
function _fun107104(a0) { // fn#107104, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:2165, offset: 0x022f34f3, size: 23 bytes, params: 2, frame: 11
|
|
return a0.startsWith(env1_0);
|
|
}
|
|
|
|
function _fun107105(a0) { // fn#107105, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:2203, offset: 0x022f350a, size: 101 bytes, params: 2, frame: 15
|
|
let value = environment.__proto__.__proto__.__proto__;
|
|
value = require(14153) /* metro dependency 14153: StringMatchUtils */;
|
|
value = value.calculateJaroWinklerSimilarity(env1_0, a0);
|
|
const r5 = value >= 0.8 ? value : 0;
|
|
const Math = global.Math;
|
|
env0_0 = Math.max(env0_0, r5);
|
|
}
|
|
|
|
function _fun107096(a0) { // fn#107096, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14349:1330, offset: 0x022f31e1, size: 65 bytes, params: 2, frame: 12
|
|
const value = a0.toLocaleLowerCase();
|
|
let binding = env1_2;
|
|
if (!binding.has(value)) {
|
|
binding = env1_1;
|
|
binding.push(value);
|
|
binding = env1_2;
|
|
binding.add(value);
|
|
}
|
|
}
|
|
|