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

307 lines
12 KiB
TypeScript
Raw Normal View History

2026-08-13 07:00:46 +00:00
// Module ID: 11852
// Function ID: 11853
2026-07-29 08:29:29 +00:00
// Name: areResolvedGamesEqual
2026-08-13 07:00:46 +00:00
// Dependencies: [32, 19, 7283, 7284, 4366, 4873, 1922, 4779, 4342, 712, 11434, 12, 5967, 589, 4876, 11435, 11433, 9587, 1954, 11853, 2]
2026-07-20 16:05:17 +00:00
2026-08-13 07:00:46 +00:00
// Module 11852 (areResolvedGamesEqual)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-08-06 08:05:19 +00:00
import importAllResult from "addGameMention";
2026-07-29 08:29:29 +00:00
import handleInit from "handleInit";
import closure_7 from "handleInit";
2026-08-04 08:36:32 +00:00
import handleLoadMessages from "handleLoadMessages";
2026-07-29 08:29:29 +00:00
import set from "set";
import mergeGuildAvatar from "mergeGuildAvatar";
2026-07-24 07:16:23 +00:00
import regExp from "regExp";
2026-07-29 08:29:29 +00:00
import createCacheKey from "createCacheKey";
2026-07-23 10:11:24 +00:00
2026-07-24 07:16:23 +00:00
let closure_12;
2026-07-29 08:29:29 +00:00
let map1;
2026-08-06 08:05:19 +00:00
let unpackModuleId;
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-07-29 08:29:29 +00:00
let obj = { commandOption: null, commandErrorOption: null, gameMention: null, autocomplete: null };
obj = { backgroundColor: require("Themes").colors.KEYWORD_HIGHLIGHT_BACKGROUND, color: require("Themes").colors.TEXT_DEFAULT, borderRadius: require("Themes").radii.xs, fontSize: 14 };
obj[0] = obj;
createCacheKey = { backgroundColor: require("Themes").colors.KEYWORD_HIGHLIGHT_BACKGROUND, color: require("Themes").colors.TEXT_FEEDBACK_CRITICAL, borderRadius: require("Themes").radii.xs, fontSize: 14 };
obj[1] = createCacheKey;
obj[2] = { backgroundColor: require("Themes").colors.MENTION_BACKGROUND, color: require("Themes").colors.MENTION_FOREGROUND, borderRadius: require("Themes").radii.xs, fontSize: 14, fontWeight: "bold" };
let obj2 = { backgroundColor: require("Themes").colors.MENTION_BACKGROUND, color: require("Themes").colors.MENTION_FOREGROUND, borderRadius: require("Themes").radii.xs, fontSize: 14, fontWeight: "bold" };
obj[3] = { color: require("Themes").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-06 08:05:19 +00:00
let 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;
let set;
let commands;
2026-08-06 08:05:19 +00:00
let closure_11;
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-07-29 08:29:29 +00:00
set = 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-06 08:05:19 +00:00
let 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]);
const items3 = [ref, commands, set];
const items4 = [first];
stateFromStores2 = first(commandsDisabled[13]).useStateFromStores(items3, () => {
2026-07-29 08:29:29 +00:00
let media;
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-07-24 07:16:23 +00:00
let editId;
let focused;
let selectionEnd;
let selectionStart;
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;
closure_0 = c4;
obj = { commandOption: null, commandErrorOption: null, gameMention: null, autocomplete: null };
obj[0] = function commandOption() {
2026-08-06 08:05:19 +00:00
return lib(outer1_3[10]).convertToNativeStyle(lib.commandOption);
2026-07-29 08:29:29 +00:00
};
obj[1] = function commandErrorOption() {
2026-08-06 08:05:19 +00:00
return lib(outer1_3[10]).convertToNativeStyle(lib.commandErrorOption);
2026-07-29 08:29:29 +00:00
};
obj[2] = function gameMention() {
2026-08-06 08:05:19 +00:00
return lib(outer1_3[10]).convertToNativeStyle(lib.gameMention);
2026-07-29 08:29:29 +00:00
};
obj[3] = function autocomplete(color) {
if (null == color) {
let autocomplete = lib.autocomplete;
} else {
autocomplete = {};
const merged = Object.assign(lib.autocomplete);
autocomplete.color = color;
}
2026-08-06 08:05:19 +00:00
return lib(outer1_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;
const obj1 = { newState: null };
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) {
let closure_0 = c4;
const obj = { commandOption: null, commandErrorOption: null, gameMention: null, autocomplete: null };
obj[0] = function commandOption() {
2026-08-06 08:05:19 +00:00
return lib(outer1_3[10]).convertToNativeStyle(lib.commandOption);
2026-07-29 08:29:29 +00:00
};
obj[1] = function commandErrorOption() {
2026-08-06 08:05:19 +00:00
return lib(outer1_3[10]).convertToNativeStyle(lib.commandErrorOption);
2026-07-29 08:29:29 +00:00
};
obj[2] = function gameMention() {
2026-08-06 08:05:19 +00:00
return lib(outer1_3[10]).convertToNativeStyle(lib.gameMention);
2026-07-29 08:29:29 +00:00
};
obj[3] = function autocomplete(color) {
if (null == color) {
let autocomplete = lib.autocomplete;
} else {
autocomplete = {};
const merged = Object.assign(lib.autocomplete);
autocomplete.color = color;
}
2026-08-06 08:05:19 +00:00
return lib(outer1_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-06 08:05:19 +00:00
combined = "" + outer1_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-07-29 08:29:29 +00:00
let obj3 = { color: require("Themes").colors.TEXT_BRAND, fontWeight: "bold" };
2026-07-20 16:05:17 +00:00
const memoResult = importAllResult.memo(forwardRefResult);
2026-07-29 08:29:29 +00:00
let result = require("handleInit").fileFinishedImporting("modules/chat_input/native/ChatInputAppCommandManager.tsx");
2026-07-20 16:05:17 +00:00
export default memoResult;