decord/source/modules/chat_input/native/ChatInputAppCommandManager.tsx

308 lines
13 KiB
TypeScript
Raw Normal View History

// Module ID: 12409
// Function ID: 12410
2026-07-29 08:29:29 +00:00
// Name: areResolvedGamesEqual
// Dependencies: [32, 19, 7779, 7780, 1916, 5108, 1371, 5000, 4560, 576, 11996, 12, 7309, 504, 5111, 11997, 11995, 9421, 1894, 12410, 2]
2026-07-20 16:05:17 +00:00
// Module 12409 (areResolvedGamesEqual)
import ThemesDefault from "Themes" /* 576 */;
2026-08-24 06:08:38 +00:00
import closure_4 from "_slicedToArray" /* 32 */;
import importAllResult from "noop" /* 19 */;
import closure_6 from "handleInit" /* 7779 */;
import closure_7 from "handleInit" /* 7780 */;
import closure_8 from "createGamesFromMessage" /* 1916 */;
import closure_9 from "set" /* 5108 */;
import closure_10 from "mergeGuildAvatar" /* 1371 */;
import regExp from "regExp" /* 5000 */;
import createCacheKey from "createCacheKey" /* 4560 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-24 07:16:23 +00:00
function areResolvedGamesEqual(size, size2) {
if (size === size2) {
return true;
} else {
if (null != size) {
if (null != size2) {
if (size.size === size2.size) {
2026-07-29 08:29:29 +00:00
const keys = size.keys();
for (const item10011 of keys) {
if (arg1.has(item10011)) {
continue;
} else {
let tmp5 = obj;
obj.return();
let flag = false;
return false;
2026-07-24 07:16:23 +00:00
}
}
return true;
}
}
}
return false;
}
}
2026-07-29 08:29:29 +00:00
let c5 = importAllResult;
2026-08-06 08:05:19 +00:00
({ extractGameMentionIds: unpackModuleId, GAME_MENTION_RAW_RE_GLOBAL: closure_12, GAME_MENTION_SENTINEL: map1 } = regExp);
2026-09-02 09:53:35 +00:00
let obj = { commandOption: null, commandErrorOption: null, gameMention: null, timestampMention: null, autocomplete: null };
2026-08-24 06:08:38 +00:00
obj = { backgroundColor: ThemesDefault.colors.KEYWORD_HIGHLIGHT_BACKGROUND, color: ThemesDefault.colors.TEXT_DEFAULT, borderRadius: ThemesDefault.radii.xs, fontSize: 14 };
2026-07-29 08:29:29 +00:00
obj[0] = obj;
2026-08-24 06:08:38 +00:00
createCacheKey = { backgroundColor: ThemesDefault.colors.KEYWORD_HIGHLIGHT_BACKGROUND, color: ThemesDefault.colors.TEXT_FEEDBACK_CRITICAL, borderRadius: ThemesDefault.radii.xs, fontSize: 14 };
2026-07-29 08:29:29 +00:00
obj[1] = createCacheKey;
2026-08-24 06:08:38 +00:00
obj[2] = { backgroundColor: ThemesDefault.colors.MENTION_BACKGROUND, color: ThemesDefault.colors.MENTION_FOREGROUND, borderRadius: ThemesDefault.radii.xs, fontSize: 14, fontWeight: "bold" };
let obj2 = { backgroundColor: ThemesDefault.colors.MENTION_BACKGROUND, color: ThemesDefault.colors.MENTION_FOREGROUND, borderRadius: ThemesDefault.radii.xs, fontSize: 14, fontWeight: "bold" };
2026-09-02 09:53:35 +00:00
obj[3] = { backgroundColor: ThemesDefault.colors.MENTION_BACKGROUND, color: ThemesDefault.colors.MENTION_FOREGROUND, borderRadius: ThemesDefault.radii.xs, fontSize: 14, fontWeight: "bold" };
let obj3 = { backgroundColor: ThemesDefault.colors.MENTION_BACKGROUND, color: ThemesDefault.colors.MENTION_FOREGROUND, borderRadius: ThemesDefault.radii.xs, fontSize: 14, fontWeight: "bold" };
obj[4] = { color: ThemesDefault.colors.TEXT_BRAND, fontWeight: "bold" };
2026-08-06 08:05:19 +00:00
let closure_14 = createCacheKey.createStyles(obj);
2026-07-29 08:29:29 +00:00
const forwardRefResult = importAllResult.forwardRef((chatInputRef, ref) => {
2026-07-20 16:05:17 +00:00
chatInputRef = chatInputRef.chatInputRef;
2026-08-06 08:05:19 +00:00
let first = chatInputRef;
2026-07-20 16:05:17 +00:00
const chatInputStateRef = chatInputRef.chatInputStateRef;
2026-08-24 06:08:38 +00:00
closure_1 = chatInputStateRef;
2026-07-20 16:05:17 +00:00
const channel = chatInputRef.channel;
const commandsDisabled = chatInputRef.commandsDisabled;
2026-07-29 08:29:29 +00:00
let callback;
let applicationCommandOptionValueParser;
let stateFromStores;
let stateFromStores1;
ref = undefined;
2026-08-24 06:08:38 +00:00
closure_9 = undefined;
2026-07-29 08:29:29 +00:00
let commands;
2026-08-24 06:08:38 +00:00
closure_11 = undefined;
2026-07-29 08:29:29 +00:00
callback = undefined;
first = undefined;
let stateFromStores2;
let callback1;
2026-08-06 08:05:19 +00:00
let tmp = stateFromStores2();
2026-07-24 07:16:23 +00:00
callback = tmp;
2026-08-06 08:05:19 +00:00
applicationCommandOptionValueParser = first(commandsDisabled[15]).useApplicationCommandOptionValueParser({ channel });
let obj = first(commandsDisabled[15]);
2026-07-29 08:29:29 +00:00
const items = [stateFromStores1];
2026-08-06 08:05:19 +00:00
stateFromStores = first(commandsDisabled[13]).useStateFromStores(items, () => stateFromStores1.getActiveCommand(channel.id));
let obj2 = first(commandsDisabled[13]);
2026-07-29 08:29:29 +00:00
const items1 = [stateFromStores];
2026-08-06 08:05:19 +00:00
stateFromStores1 = first(commandsDisabled[13]).useStateFromStores(items1, () => stateFromStores.getLastResponseNonce(channel.id));
const obj3 = first(commandsDisabled[13]);
let text = first(commandsDisabled[16]).getTextBeforeFirstOption(chatInputStateRef.current.text).text;
2026-07-23 10:11:24 +00:00
let substr = text.slice(1);
2026-07-29 08:29:29 +00:00
ref = applicationCommandOptionValueParser.useRef(substr.trimEnd());
2026-07-24 07:16:23 +00:00
const tmp6 = callback(applicationCommandOptionValueParser.useState(ref.current), 2);
2026-08-24 06:08:38 +00:00
closure_9 = tmp6[1];
2026-08-06 08:05:19 +00:00
const obj4 = first(commandsDisabled[16]);
commands = channel(commandsDisabled[17]).useCachedResults({ type: "channel", channel }, first(commandsDisabled[18]).ApplicationCommandType.CHAT, tmp6[0]).commands;
closure_11 = applicationCommandOptionValueParser.useRef(undefined);
2026-07-29 08:29:29 +00:00
first = undefined;
2026-08-06 08:05:19 +00:00
closure_1 = undefined;
2026-07-29 08:29:29 +00:00
const tmp7 = callback(applicationCommandOptionValueParser.useState([]), 2);
first = tmp7[0];
2026-08-06 08:05:19 +00:00
closure_1 = tmp7[1];
2026-07-29 08:29:29 +00:00
callback = applicationCommandOptionValueParser.useCallback((arg0) => {
2026-08-24 06:08:38 +00:00
closure_0 = ref(arg0);
2026-07-29 08:29:29 +00:00
lib((arg0) => {
let tmp = closure_0;
if (obj.isEqual(arg0, closure_0)) {
tmp = arg0;
}
return tmp;
});
}, []);
const items2 = [first];
2026-08-05 07:35:12 +00:00
const memo = applicationCommandOptionValueParser.useMemo(() => first.filter((closure_0) => null == gameById.getGameById(closure_0)), items2);
2026-08-06 08:05:19 +00:00
const obj6 = channel(commandsDisabled[17]);
const games = first(commandsDisabled[12]).useGames(memo);
const obj7 = first(commandsDisabled[12]);
2026-08-24 06:08:38 +00:00
const items3 = [ref, commands, closure_9];
2026-08-06 08:05:19 +00:00
const items4 = [first];
stateFromStores2 = first(commandsDisabled[13]).useStateFromStores(items3, () => {
2026-07-29 08:29:29 +00:00
if (0 === first.length) {
return null;
} else {
2026-08-06 08:05:19 +00:00
const currentUser = commands.getCurrentUser();
2026-07-29 08:29:29 +00:00
if (currentUser != null) {
const nsfwAllowed = currentUser.nsfwAllowed;
}
const _Map = Map;
const map = new Map();
2026-08-06 08:05:19 +00:00
for (const item10017 of tmp) {
let tmp8 = item10017;
let tmp9 = ref;
let game = ref.getGame(item10017);
let tmp11 = game;
if (null == game) {
let tmp19 = gameById;
let tmp20 = item10017;
let gameById = gameById.getGameById(tmp8);
if (null != gameById) {
let tmp23 = item10017;
let tmp24 = gameById;
let result = map.set(tmp8, tmp22);
}
} else {
let tmp12 = first;
let tmp13 = commandsDisabled;
let obj2 = first(commandsDisabled[14]);
let tmp14 = game;
if (!obj2.isGameProfileObscured(tmp11, nsfwAllowed)) {
let tmp15 = item10017;
let obj = { id: null, name: null, icon: null };
obj[0] = tmp8;
let tmp16 = game;
({ name: obj3[1], media } = tmp11);
let icon;
if (media != null) {
icon = media.icon;
2026-07-29 08:29:29 +00:00
}
2026-08-06 08:05:19 +00:00
if (icon == null) {
icon = null;
2026-07-29 08:29:29 +00:00
}
2026-08-06 08:05:19 +00:00
obj[2] = icon;
let result1 = map.set(tmp8, obj);
2026-07-24 07:16:23 +00:00
}
}
2026-07-29 08:29:29 +00:00
continue;
}
2026-08-06 08:05:19 +00:00
let tmp26 = null;
2026-07-29 08:29:29 +00:00
if (map.size > 0) {
2026-08-06 08:05:19 +00:00
tmp26 = map;
2026-07-29 08:29:29 +00:00
}
2026-08-06 08:05:19 +00:00
return tmp26;
2026-07-29 08:29:29 +00:00
}
2026-08-06 08:05:19 +00:00
}, items4, callback1);
2026-07-29 08:29:29 +00:00
const items5 = [stateFromStores, channel, chatInputRef, chatInputStateRef, commandsDisabled, stateFromStores1, applicationCommandOptionValueParser, commands, tmp, callback];
callback1 = applicationCommandOptionValueParser.useCallback(() => {
2026-08-06 08:05:19 +00:00
const current = lib.current;
2026-07-20 16:05:17 +00:00
let text = current.text;
2026-07-24 07:16:23 +00:00
({ editId, focused, selectionStart, selectionEnd } = current);
2026-07-29 08:29:29 +00:00
callback(text);
2026-08-06 08:05:19 +00:00
let obj = { activeCommand: stateFromStores, channel, commandsDisabled, editId, focused, lastCommandAutocompleteResponseNonce: stateFromStores1, queryCommands: commands, selectionStart, selectionEnd, text };
if (null == ref.current) {
2026-07-29 08:29:29 +00:00
obj = { props: null, ref: null, optionValueParser: null, styles: null };
obj[0] = obj;
obj[1] = closure_0;
obj[2] = applicationCommandOptionValueParser;
2026-08-24 06:08:38 +00:00
closure_0 = closure_4;
2026-09-02 09:53:35 +00:00
obj = { commandOption: null, commandErrorOption: null, gameMention: null, timestampMention: null, autocomplete: null };
2026-07-29 08:29:29 +00:00
obj[0] = function commandOption() {
2026-08-24 06:08:38 +00:00
return lib(closure_1_3[10]).convertToNativeStyle(lib.commandOption);
2026-07-29 08:29:29 +00:00
};
obj[1] = function commandErrorOption() {
2026-08-24 06:08:38 +00:00
return lib(closure_1_3[10]).convertToNativeStyle(lib.commandErrorOption);
2026-07-29 08:29:29 +00:00
};
obj[2] = function gameMention() {
2026-08-24 06:08:38 +00:00
return lib(closure_1_3[10]).convertToNativeStyle(lib.gameMention);
2026-07-29 08:29:29 +00:00
};
2026-09-02 09:53:35 +00:00
obj[3] = function timestampMention() {
return lib(closure_1_3[10]).convertToNativeStyle(lib.timestampMention);
};
obj[4] = function autocomplete(color) {
2026-07-29 08:29:29 +00:00
if (null == color) {
let autocomplete = lib.autocomplete;
} else {
autocomplete = {};
const merged = Object.assign(lib.autocomplete);
autocomplete.color = color;
}
2026-08-24 06:08:38 +00:00
return lib(closure_1_3[10]).convertToNativeStyle(autocomplete);
2026-07-29 08:29:29 +00:00
};
obj[3] = obj;
2026-08-06 08:05:19 +00:00
const tmp12 = new lib(commandsDisabled[19])(obj);
2026-07-29 08:29:29 +00:00
tmp2.current = tmp12;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const current2 = tmp2.current;
2026-08-24 06:08:38 +00:00
obj1 = { newState: null };
2026-07-29 08:29:29 +00:00
obj1[0] = obj;
const result = current2.updateApplicationCommandManagerState(obj1);
2026-07-20 16:05:17 +00:00
}
2026-08-06 08:05:19 +00:00
text = first(commandsDisabled[16]).getTextBeforeFirstOption(text).text;
2026-07-20 16:05:17 +00:00
const substr = text.slice(1);
const trimEndResult = substr.trimEnd();
if (ref.current !== trimEndResult) {
2026-07-29 08:29:29 +00:00
gameById(trimEndResult);
tmp15.current = trimEndResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}, items5);
const items6 = [callback1];
2026-07-23 10:11:24 +00:00
const effect = applicationCommandOptionValueParser.useEffect(() => {
2026-07-29 08:29:29 +00:00
callback1();
}, items6);
const items7 = [tmp];
2026-07-24 07:16:23 +00:00
const effect1 = applicationCommandOptionValueParser.useEffect(() => {
2026-08-06 08:05:19 +00:00
const current = ref.current;
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-08-24 06:08:38 +00:00
closure_0 = closure_4;
2026-09-02 09:53:35 +00:00
const obj = { commandOption: null, commandErrorOption: null, gameMention: null, timestampMention: null, autocomplete: null };
2026-07-29 08:29:29 +00:00
obj[0] = function commandOption() {
2026-08-24 06:08:38 +00:00
return lib(closure_1_3[10]).convertToNativeStyle(lib.commandOption);
2026-07-29 08:29:29 +00:00
};
obj[1] = function commandErrorOption() {
2026-08-24 06:08:38 +00:00
return lib(closure_1_3[10]).convertToNativeStyle(lib.commandErrorOption);
2026-07-29 08:29:29 +00:00
};
obj[2] = function gameMention() {
2026-08-24 06:08:38 +00:00
return lib(closure_1_3[10]).convertToNativeStyle(lib.gameMention);
2026-07-29 08:29:29 +00:00
};
2026-09-02 09:53:35 +00:00
obj[3] = function timestampMention() {
return lib(closure_1_3[10]).convertToNativeStyle(lib.timestampMention);
};
obj[4] = function autocomplete(color) {
2026-07-29 08:29:29 +00:00
if (null == color) {
let autocomplete = lib.autocomplete;
} else {
autocomplete = {};
const merged = Object.assign(lib.autocomplete);
autocomplete.color = color;
}
2026-08-24 06:08:38 +00:00
return lib(closure_1_3[10]).convertToNativeStyle(autocomplete);
2026-07-29 08:29:29 +00:00
};
current.updateStyles(obj);
2026-07-28 08:39:19 +00:00
}
2026-07-29 08:29:29 +00:00
}, items7);
const items8 = [stateFromStores2, first, chatInputRef, chatInputStateRef, callback1];
2026-07-28 08:39:19 +00:00
const effect2 = applicationCommandOptionValueParser.useEffect(() => {
2026-08-06 08:05:19 +00:00
const current = ref.current;
2026-07-29 08:29:29 +00:00
if (null != stateFromStores2) {
if (0 !== first.length) {
2026-07-24 07:16:23 +00:00
if (null != current) {
2026-08-06 08:05:19 +00:00
const mapped = ref(lib.current.text).map((arg0) => store.get(arg0));
2026-07-24 07:16:23 +00:00
const found = mapped.filter((arg0) => null != arg0);
if (0 !== found.length) {
2026-08-06 08:05:19 +00:00
const replaced = str.replace(callback, (arg0, arg1) => {
2026-07-24 07:16:23 +00:00
let combined = arg0;
2026-07-29 08:29:29 +00:00
const value = store.get(arg1);
2026-07-24 07:16:23 +00:00
if (null != value) {
const _HermesInternal = HermesInternal;
2026-08-24 06:08:38 +00:00
combined = "" + closure_1_13 + value.name;
2026-07-24 07:16:23 +00:00
}
return combined;
});
2026-07-29 08:29:29 +00:00
for (const item10011 of found) {
let addGameMentionResult = current.addGameMention(item10011);
continue;
2026-07-24 07:16:23 +00:00
}
2026-08-06 08:05:19 +00:00
const current2 = first.current;
2026-07-24 07:16:23 +00:00
current2.setText(replaced);
2026-08-06 08:05:19 +00:00
lib.current.textPrev = str;
lib.current.text = replaced;
2026-07-29 08:29:29 +00:00
callback1();
2026-07-24 07:16:23 +00:00
}
2026-08-06 08:05:19 +00:00
const arr = ref(lib.current.text);
2026-07-24 07:16:23 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
}, items8);
const imperativeHandle = applicationCommandOptionValueParser.useImperativeHandle(ref, () => ({
2026-07-20 16:05:17 +00:00
getApplicationCommandManager() {
2026-07-29 08:29:29 +00:00
return ref.current;
2026-07-20 16:05:17 +00:00
},
updateState() {
2026-07-29 08:29:29 +00:00
return callback();
2026-07-20 16:05:17 +00:00
}
}));
return null;
});
forwardRefResult.displayName = "ChatInputAppCommandManager";
2026-09-02 09:53:35 +00:00
let obj4 = { color: ThemesDefault.colors.TEXT_BRAND, fontWeight: "bold" };
2026-07-20 16:05:17 +00:00
const memoResult = importAllResult.memo(forwardRefResult);
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("modules/chat_input/native/ChatInputAppCommandManager.tsx");
2026-07-20 16:05:17 +00:00
export default memoResult;