Files
discord-decomp/modules/games/autocomplete/GameAutocompleteUtils.tsx
T
2026-11-01 12:12:55 +02:00

27 lines
822 B
TypeScript

// Metro module 6161 (f6162).
import { GAME_WIDGET_BANNED_APPLICATION_IDS } from "../../../_bundle/Module5899";
export const GAME_AUTOCOMPLETE_MAX_QUERY_LENGTH = 100;
export const MIN_TRUSTED_EMPTY_PREFIX_LENGTH = 7;
export function shouldSuppressAutocompleteFetch(a0, a1) {
let r0 = a0.length - 1;
while (1 <= r0) {
const r12 = a1(a0.slice(0, r0));
const r1 = r0;
if (r12 != null) {
return !(r12.length > 0) && r1 >= 7;
}
r0 = r1 - 1;
}
return false;
}
export function normalizeGameAutocompleteQuery(a0) {
if (a0 == null) {
return null;
}
const r14 = a0.trim().toLowerCase().replaceAll("_", " ").slice(0, 100);
return r14.length > 0 ? r14 : null;
}
export function isGameAutocompleteResultAllowedInGameWidgets(a0) {
return !GAME_WIDGET_BANNED_APPLICATION_IDS.has(a0.id);
}