decord/source/modules/search/tokens/SearchTokensUtils.tsx

43 lines
1.4 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 11564
// Function ID: 11565
2026-07-20 16:05:17 +00:00
// Name: ANSWER_IN_REGEX
2026-08-24 06:08:38 +00:00
// Dependencies: [4366, 2]
2026-07-20 16:05:17 +00:00
// Exports: makeRegexForOptionsWithNegation, validateForMapWithNegation
2026-08-24 06:08:38 +00:00
// Module 11564 (ANSWER_IN_REGEX)
import set from "set" /* 2 */;
const result = set.fileFinishedImporting("modules/search/tokens/SearchTokensUtils.tsx");
2026-07-20 16:05:17 +00:00
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);
2026-07-29 08:29:29 +00:00
const mapped = sorted.map((arg0) => callback(table[0]).escape(arg0));
2026-07-20 16:05:17 +00:00
const regExp = new RegExp("(?:\\s*(-?(?:" + mapped.join("|") + ")))", "i");
return regExp;
};
2026-07-29 08:29:29 +00:00
export const validateForMapWithNegation = function validateForMapWithNegation(author_type, hasMap, token) {
const match = token.getMatch(1);
2026-07-20 16:05:17 +00:00
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;
}
2026-07-29 08:29:29 +00:00
token.setData(author_type, combined);
2026-07-20 16:05:17 +00:00
flag = true;
}
return flag;
};