309 lines
11 KiB
TypeScript
309 lines
11 KiB
TypeScript
/* Metro module 14153; source: modules/search/StringMatchUtils.tsx; dependencies: [2] */
|
|
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
|
|
function _fun107106(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#107106, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14350:6, offset: 0x022f356f, size: 131 bytes, params: 8, frame: 16
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const _prefix = function(a0, a1) {
|
|
var property;
|
|
var value = 0;
|
|
var r3 = value;
|
|
loopExit1: while (true) {
|
|
property = a0[r3];
|
|
if (property !== a1[r3]) {
|
|
return r3;
|
|
}
|
|
value = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
|
|
if (value < 4) {
|
|
r3 = value;
|
|
continue;
|
|
}
|
|
break loopExit1;
|
|
}
|
|
return typeof value === 'bigint' ? value + 1n : +value + 1;
|
|
};
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/search/StringMatchUtils.tsx');
|
|
exports.calculateJaroWinklerSimilarity = calculateJaroWinklerSimilarity;
|
|
function calculateJaroWinklerDistance(a0, a1) { // fn#107107, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14350:129, offset: 0x022f35f2, size: 138 bytes, params: 3, frame: 17
|
|
var r0;
|
|
var value3;
|
|
var length;
|
|
var value4;
|
|
var value6;
|
|
var value;
|
|
const value2 = _matching(a0, a1);
|
|
if (value2 > 0) {
|
|
value3 = _transpositions(a0, a1);
|
|
length = a0.length;
|
|
value4 = value2 / length;
|
|
length = a1.length;
|
|
value6 = (value4 + value2 / length + (value2 - value3) / value2) / 3;
|
|
if (value6 < 0.7) {
|
|
r0 = value6;
|
|
} else {
|
|
value = _prefix(a0, a1);
|
|
value = 0.1 * value;
|
|
value = value6 + value * (1 - value6);
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
function calculateJaroWinklerSimilarity(a0, a1, a2) { // fn#107111, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14350:1093, offset: 0x022f398e, size: 84 bytes, params: 4, frame: 15
|
|
var calculateJaroWinklerDistanceBinding;
|
|
let value = a2;
|
|
let r0 = value ?? ({});
|
|
const caseSensitive = r0.caseSensitive;
|
|
if (caseSensitive === undefined) {
|
|
calculateJaroWinklerDistanceBinding = calculateJaroWinklerDistance;
|
|
value = a0.toLowerCase();
|
|
value = calculateJaroWinklerDistanceBinding(value, a1.toLowerCase());
|
|
r0 = value;
|
|
} else if (caseSensitive) {
|
|
r0 = calculateJaroWinklerDistance(a0, a1);
|
|
} else {
|
|
calculateJaroWinklerDistanceBinding = calculateJaroWinklerDistance;
|
|
value = a0.toLowerCase();
|
|
value = calculateJaroWinklerDistanceBinding(value, a1.toLowerCase());
|
|
r0 = value;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
function _matching(a0, a1) { // fn#107108, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14350:291, offset: 0x022f367c, size: 236 bytes, params: 3, frame: 25
|
|
var r2;
|
|
var r3;
|
|
var r12;
|
|
var r11;
|
|
var r0;
|
|
var value3;
|
|
var min;
|
|
var property;
|
|
var value4;
|
|
var value5;
|
|
var value6;
|
|
let Math = global.Math;
|
|
const floor = Math.floor;
|
|
const Math2 = global.Math;
|
|
let max = Math2.max;
|
|
let length = a0.length;
|
|
let value = Reflect.apply(max, Math2, [length, a1.length]);
|
|
value = Reflect.apply(floor, Math, [value / 2]);
|
|
value -= 1;
|
|
const items2 = [];
|
|
length = a0.length;
|
|
const value2 = 0;
|
|
if (value2 < length) {
|
|
r2 = value2;
|
|
r3 = value2;
|
|
reducibleLoop1: while (true) {
|
|
Math = global.Math;
|
|
max = Math.max;
|
|
value3 = Reflect.apply(max, Math, [value2, r2 - value]);
|
|
Math = global.Math;
|
|
min = Math.min;
|
|
length = a1.length;
|
|
if (value3 <= Reflect.apply(min, Math, [length, r2 + value])) {
|
|
r12 = value3;
|
|
reducibleLoop2: while (true) {
|
|
property = a0[r2];
|
|
if (property === a1[r12]) {
|
|
reducibleJoin5: while (true) {
|
|
if (items2[r12]) {
|
|
break reducibleJoin5;
|
|
}
|
|
items2[r12] = true;
|
|
value4 = typeof r3 === 'bigint' ? r3 + 1n : +r3 + 1;
|
|
r11 = value4;
|
|
break reducibleLoop2;
|
|
}
|
|
}
|
|
value5 = typeof r12 === 'bigint' ? r12 + 1n : +r12 + 1;
|
|
Math = global.Math;
|
|
min = Math.min;
|
|
length = a1.length;
|
|
if (value5 <= Reflect.apply(min, Math, [length, r2 + value])) {
|
|
r12 = value5;
|
|
continue reducibleLoop2;
|
|
}
|
|
r11 = r3;
|
|
break reducibleLoop2;
|
|
}
|
|
} else {
|
|
r11 = r3;
|
|
}
|
|
value6 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
length = a0.length;
|
|
if (value6 < length) {
|
|
r2 = value6;
|
|
r3 = r11;
|
|
continue reducibleLoop1;
|
|
}
|
|
r0 = r11;
|
|
break reducibleLoop1;
|
|
}
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
function _transpositions(a0, a1) { // fn#107109, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14350:504, offset: 0x022f3768, size: 507 bytes, params: 3, frame: 24
|
|
var r4;
|
|
var r11;
|
|
var r5;
|
|
var r7;
|
|
var r0;
|
|
var value3;
|
|
var min;
|
|
var property;
|
|
var a;
|
|
var value4;
|
|
var value5;
|
|
var value6;
|
|
var b;
|
|
var value7;
|
|
var value8;
|
|
let Math = global.Math;
|
|
const floor = Math.floor;
|
|
const Math2 = global.Math;
|
|
let max = Math2.max;
|
|
let length = a0.length;
|
|
let value = Reflect.apply(max, Math2, [length, a1.length]);
|
|
value = Reflect.apply(floor, Math, [value / 2]);
|
|
value -= 1;
|
|
const object = {'a': '', 'b': ''};
|
|
const items3 = [];
|
|
length = a0.length;
|
|
const value2 = 0;
|
|
if (value2 < length) {
|
|
r4 = value2;
|
|
reducibleLoop1: while (true) {
|
|
Math = global.Math;
|
|
max = Math.max;
|
|
value3 = Reflect.apply(max, Math, [value2, r4 - value]);
|
|
Math = global.Math;
|
|
min = Math.min;
|
|
length = a1.length;
|
|
if (value3 <= Reflect.apply(min, Math, [length, r4 + value])) {
|
|
r11 = value3;
|
|
reducibleLoop2: while (true) {
|
|
property = a0[r4];
|
|
if (property === a1[r11]) {
|
|
reducibleJoin5: while (true) {
|
|
if (items3[r11]) {
|
|
break reducibleJoin5;
|
|
}
|
|
a = object.a;
|
|
object.a = a + a0[r4];
|
|
items3[r11] = true;
|
|
break reducibleLoop2;
|
|
}
|
|
}
|
|
value4 = typeof r11 === 'bigint' ? r11 + 1n : +r11 + 1;
|
|
Math = global.Math;
|
|
min = Math.min;
|
|
length = a1.length;
|
|
if (value4 <= Reflect.apply(min, Math, [length, r4 + value])) {
|
|
r11 = value4;
|
|
continue reducibleLoop2;
|
|
}
|
|
break reducibleLoop2;
|
|
}
|
|
}
|
|
value5 = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
|
|
length = a0.length;
|
|
if (value5 < length) {
|
|
r4 = value5;
|
|
continue reducibleLoop1;
|
|
}
|
|
break reducibleLoop1;
|
|
}
|
|
}
|
|
const items2 = [];
|
|
length = a1.length;
|
|
if (value2 < length) {
|
|
r4 = value2;
|
|
reducibleLoop8: while (true) {
|
|
Math = global.Math;
|
|
max = Math.max;
|
|
value6 = Reflect.apply(max, Math, [value2, r4 - value]);
|
|
Math = global.Math;
|
|
min = Math.min;
|
|
length = a0.length;
|
|
if (value6 <= Reflect.apply(min, Math, [length, r4 + value])) {
|
|
r11 = value6;
|
|
reducibleLoop9: while (true) {
|
|
property = a1[r4];
|
|
if (property === a0[r11]) {
|
|
reducibleJoin12: while (true) {
|
|
if (items2[r11]) {
|
|
break reducibleJoin12;
|
|
}
|
|
b = object.b;
|
|
object.b = b + a1[r4];
|
|
items2[r11] = true;
|
|
break reducibleLoop9;
|
|
}
|
|
}
|
|
value7 = typeof r11 === 'bigint' ? r11 + 1n : +r11 + 1;
|
|
Math = global.Math;
|
|
min = Math.min;
|
|
length = a0.length;
|
|
if (value7 <= Reflect.apply(min, Math, [length, r4 + value])) {
|
|
r11 = value7;
|
|
continue reducibleLoop9;
|
|
}
|
|
break reducibleLoop9;
|
|
}
|
|
}
|
|
value8 = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
|
|
length = a1.length;
|
|
if (value8 < length) {
|
|
r4 = value8;
|
|
continue reducibleLoop8;
|
|
}
|
|
break reducibleLoop8;
|
|
}
|
|
}
|
|
length = object.a.length;
|
|
if (value2 < length) {
|
|
r4 = value2;
|
|
r5 = value2;
|
|
reducibleLoop15: while (true) {
|
|
a = object.a;
|
|
property = a[r4];
|
|
b = object.b;
|
|
reducibleJoin17: while (true) {
|
|
if (property === b[r4]) {
|
|
r7 = r5;
|
|
break reducibleJoin17;
|
|
}
|
|
value = typeof r5 === 'bigint' ? r5 + 1n : +r5 + 1;
|
|
r7 = value;
|
|
break reducibleJoin17;
|
|
}
|
|
value = typeof r4 === 'bigint' ? r4 + 1n : +r4 + 1;
|
|
a = object.a;
|
|
length = a.length;
|
|
if (value < length) {
|
|
r4 = value;
|
|
r5 = r7;
|
|
continue reducibleLoop15;
|
|
}
|
|
r0 = r7;
|
|
break reducibleLoop15;
|
|
}
|
|
} else {
|
|
r0 = value2;
|
|
}
|
|
Math = global.Math;
|
|
return Math.floor(r0 / 2);
|
|
}
|
|
|
|
global.__d(_fun107106, 14153, [2]) /* metro module 14153, dependencies: [2] */;
|