decord/beta/source/modules/search/tokens/SearchTokensUtils.tsx
github-actions 19e52f659f chore: update source for beta 347.11
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4973.js (118.4 MB)
2026-09-26 17:57:22 +00:00

43 lines
1.4 KiB
TypeScript

// Module ID: 12627
// Function ID: 12628
// Name: SearchTokensUtils
// Dependencies: [4775, 2]
// Exports: makeRegexForOptionsWithNegation, validateForMapWithNegation
// Module 12627 (SearchTokensUtils)
import RegexUtilsDefault from "RegexUtils" /* 4775 */;
import size from "module_2" /* 2 */;
const result = size.fileFinishedImporting("modules/search/tokens/SearchTokensUtils.tsx");
export const ANSWER_IN_REGEX = /(?:\s*#?((?:"(\\\\|\\"|[^\\"])*")|(?:[^\s]+)))/i;
export const GENERIC_REGEX = /(?:\s*([^\s]+))/;
export const makeRegexForOptionsWithNegation = function makeRegexForOptionsWithNegation(items) {
items = [...items];
const sorted = items.sort((arg0, arg1) => arg1.length - arg0.length);
const mapped = sorted.map((item) => RegexUtilsDefault.escape(item));
const regExp = new RegExp("(?:\\s*(-?(?:" + mapped.join("|") + ")))", "i");
return regExp;
};
export const validateForMapWithNegation = function validateForMapWithNegation(author_type, hasMap, token) {
const match = token.getMatch(1);
const startsWithResult = match.startsWith("-");
let substr = match;
if (startsWithResult) {
substr = match.slice(1);
}
let flag = null != tmp3;
if (flag) {
flag = "" !== tmp3;
}
if (flag) {
let combined = tmp3;
if (startsWithResult) {
const _HermesInternal = HermesInternal;
combined = "-" + tmp3;
}
token.setData(author_type, combined);
flag = true;
}
return flag;
};