decord/source/__polyfill/07xxx/module_7434.js
github-actions da5b5e5efe chore: update source for alpha 346.6
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4821.js (118.4 MB)
2026-09-12 13:45:10 +00:00

301 lines
10 KiB
JavaScript

// Module ID: 7434
// Function ID: 7435
// Dependencies: [7435, 7436]
// Module 7434
import _mod7436 from "module_7436" /* 7436 */;
import _extends from "module_7435" /* 7435 */;
function getMatchRanking(rankedValue, arg1, keepDiacritics) {
const text = `${rankedValue}`;
let defaultResult = text;
if (!keepDiacritics.keepDiacritics) {
defaultResult = _module1.default(`${rankedValue}`);
}
const text1 = `${arg1}`;
let defaultResult1 = text1;
if (!keepDiacritics.keepDiacritics) {
defaultResult1 = _module1.default(`${arg1}`);
}
if (defaultResult1.length > defaultResult.length) {
let NO_MATCH = obj2.NO_MATCH;
} else if (defaultResult === defaultResult1) {
NO_MATCH = obj2.CASE_SENSITIVE_EQUAL;
} else {
const str2 = defaultResult.toLowerCase();
const formatted = defaultResult1.toLowerCase();
if (str2 === formatted) {
NO_MATCH = obj2.EQUAL;
} else if (str2.startsWith(formatted)) {
NO_MATCH = obj2.STARTS_WITH;
} else if (str2.includes(` ${arr3}`)) {
NO_MATCH = obj2.WORD_STARTS_WITH;
} else if (str2.includes(formatted)) {
NO_MATCH = obj2.CONTAINS;
} else if (1 === formatted.length) {
NO_MATCH = obj2.NO_MATCH;
} else {
c0 = "";
let parts = str2.split(" ");
let item = parts.forEach((item) => {
const parts = item.split("-");
item = parts.forEach((item) => {
closure_0 = closure_0 + item.substr(0, 1);
});
});
if (c0.includes(formatted)) {
NO_MATCH = obj2.ACRONYM;
} else {
let num4 = 0;
let num5 = 0;
let num6 = -1;
if (0 < str2.length) {
while (str2[num4] !== tmp5) {
let sum = num4 + 1;
num4 = sum;
num5 = 0;
num6 = -1;
}
num6 = num4 + 1;
num5 = 1;
}
if (num6 < 0) {
NO_MATCH = obj2.NO_MATCH;
} else {
let tmp16 = num5;
let num8 = 1;
let tmp17 = num6;
let tmp18 = num5;
let tmp19 = num6;
if (1 < formatted.length) {
while (true) {
let length2 = str2.length;
let tmp11 = tmp17;
let sum2 = tmp16;
let num7 = -1;
if (tmp17 < length2) {
while (str2[tmp11] !== tmp8) {
let sum1 = tmp11 + 1;
tmp11 = sum1;
sum2 = tmp16;
num7 = -1;
}
sum2 = tmp16 + 1;
num7 = tmp11 + 1;
}
if (-1 >= num7) {
break;
} else {
num8 = num8 + 1;
tmp16 = sum2;
tmp17 = num7;
tmp18 = sum2;
tmp19 = num7;
}
}
NO_MATCH = obj2.NO_MATCH;
}
NO_MATCH = obj2.MATCHES + tmp18 / formatted.length * (1 / (tmp19 - num6));
}
}
}
}
return NO_MATCH;
}
if (_extends) {
let _module1 = _mod7436;
if (_module1) {
if (typeof _module1 === "object") {
let tmp4 = _module1;
}
function matchSorter(valueResult, query, arg2) {
closure_0 = query;
let tmp = arg2;
obj = arg2;
if (undefined === arg2) {
obj = {};
tmp = obj;
}
({ keys: obj2, threshold } = tmp);
if (undefined === threshold) {
threshold = obj2.MATCHES;
}
let baseSort = tmp.baseSort;
if (undefined === baseSort) {
baseSort = threshold;
}
let fn = tmp.sorter;
if (undefined === fn) {
fn = (arr) => arr.sort((arg0, arg1) => {
({ rank, keyIndex } = arg0);
({ rank: rank2, keyIndex: keyIndex2 } = arg1);
if (rank === rank2) {
if (keyIndex === keyIndex2) {
const num2 = tmp(arg0, arg1);
}
} else {
let num = 1;
if (rank > rank2) {
num = -1;
}
return num;
}
});
}
return fn(valueResult.reduce(function reduceItemsToRanked(arr, rankedValue, index) {
let str3;
closure_1 = obj;
if (constants) {
const items = [];
let num4 = 0;
if (0 < arr.length) {
while (true) {
let tmp6 = arr[num4];
if (typeof tmp6 === "string") {
let defaultResult = closure_5;
} else {
defaultResult = obj.default({}, closure_5, tmp6);
}
str3 = tmp6;
if (typeof tmp6 === "object") {
str3 = tmp6.key;
}
if (typeof str3 === "function") {
break;
} else {
let str3Result = null;
if (null != rankedValue) {
let _Object = Object;
hasOwnProperty = Object.hasOwnProperty;
let call = hasOwnProperty.call;
if (typeof call === "unknown" ? hasOwnProperty(str3) : call(rankedValue, str3)) {
str3Result = rankedValue[str3];
} else {
str3Result = null;
if (str3.includes(".")) {
let parts = str3.split(".");
let items1 = [rankedValue];
let length2 = parts.length;
let num5 = 0;
let arr5 = items1;
let tmp10 = items1;
if (0 < length2) {
do {
let tmp11 = parts[num5];
let items2 = [];
let length3 = arr5.length;
let num6 = 0;
let tmp14 = items2;
if (0 < length3) {
do {
let tmp15 = arr5[num6];
let combined = items2;
if (null != tmp15) {
let _Object2 = Object;
let call2 = hasOwnProperty2.call;
if (typeof call2 === "unknown" ? hasOwnProperty2(tmp11) : call2(tmp15, tmp11)) {
let tmp19 = tmp15[tmp11];
combined = items2;
if (null != tmp19) {
let arr2 = items2.push(tmp19);
combined = items2;
}
} else {
combined = items2;
if ("*" === tmp11) {
combined = items2.concat(tmp15);
}
}
}
num6 = num6 + 1;
items2 = combined;
tmp14 = combined;
} while (num6 < length3);
}
num5 = num5 + 1;
arr5 = tmp14;
tmp10 = tmp14;
} while (num5 < length2);
}
let _Array = Array;
let applyResult = tmp10;
if (Array.isArray(tmp10[0])) {
let items3 = [];
let concat = items3.concat;
applyResult = concat.apply(items3, tmp10);
}
let length4 = applyResult.length;
for (let num7 = 0; num7 < length4; num7 = num7 + 1) {
obj = { itemValue: applyResult[num7], attributes: defaultResult };
let arr3 = items.push(obj);
}
num4 = num4 + 1;
}
}
}
if (null == str3Result) {
let items4 = [];
} else {
let _Array2 = Array;
items4 = str3Result;
if (!Array.isArray(str3Result)) {
let _String = String;
let items5 = [String(str3Result)];
items4 = items5;
}
}
}
}
str3Result = str3(rankedValue);
}
obj2 = { rankedValue, rank: null, keyIndex: -1, keyThreshold: null };
obj2.rank = obj2.NO_MATCH;
obj2.keyThreshold = tmp2.threshold;
let reduced = items.reduce((acc, item, index) => {
({ rank, rankedValue, keyIndex, keyThreshold } = acc);
({ itemValue, attributes } = item);
const tmp = baseSort(itemValue, closure_0, closure_1);
({ minRanking, maxRanking, threshold } = attributes);
if (tmp >= minRanking) {
minRanking = tmp;
if (tmp > maxRanking) {
minRanking = maxRanking;
}
}
if (minRanking > rank) {
keyIndex = index;
rankedValue = itemValue;
keyThreshold = threshold;
rank = minRanking;
}
return { rankedValue, rank, keyIndex, keyThreshold };
}, obj2);
} else {
reduced = { rankedValue, rank: getMatchRanking(rankedValue, tmp, tmp2), keyIndex: -1, keyThreshold: tmp2.threshold };
}
let keyThreshold = reduced.keyThreshold;
if (undefined === keyThreshold) {
keyThreshold = threshold;
}
if (reduced.rank >= keyThreshold) {
const obj3 = { item: rankedValue, index };
arr.push(obj.default({}, reduced, obj3));
}
return arr;
}, [])).map((item) => item.item);
}
_module1 = tmp4;
let obj2 = { CASE_SENSITIVE_EQUAL: 7, EQUAL: 6, STARTS_WITH: 5, WORD_STARTS_WITH: 4, CONTAINS: 3, ACRONYM: 2, MATCHES: 1, NO_MATCH: 0 };
matchSorter.rankings = obj2;
function defaultBaseSortFn(rankedValue, rankedValue2) {
return String(rankedValue.rankedValue).localeCompare(String(rankedValue2.rankedValue));
}
let closure_5 = { maxRanking: Infinity, minRanking: -Infinity };
exports.defaultBaseSortFn = defaultBaseSortFn;
exports.matchSorter = matchSorter;
exports.rankings = obj2;
}
let obj3 = { default: _module1 };
tmp4 = obj3;
}
let obj = { default: _extends };