decord/source/modules/autocompleter/native/Autocomplete.tsx

242 lines
11 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 11955
// Function ID: 11956
2026-07-20 16:05:17 +00:00
// Name: AutocompleteLabel
2026-08-25 06:04:03 +00:00
// Dependencies: [19, 17, 1910, 4034, 1922, 676, 10067, 21, 4380, 712, 8118, 589, 4224, 1297, 9278, 5480, 5490, 1236, 8383, 4866, 4574, 4376, 5374, 11956, 10107, 4949, 10008, 12, 4413, 1903, 8097, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 11955 (AutocompleteLabel)
2026-08-24 06:08:38 +00:00
import ThemesDefault from "Themes" /* 712 */;
import Button from "Button" /* 1297 */;
import isNullOrEmpty from "isNullOrEmpty" /* 1903 */;
2026-08-25 06:04:03 +00:00
import Text from "Text" /* 4376 */;
import getGameMediaRefURLDefault from "getGameMediaRefURL" /* 4413 */;
import computeChannelName from "computeChannelName" /* 4574 */;
import getChannelIcon from "getChannelIcon" /* 4866 */;
import PressableBase from "PressableBase" /* 4949 */;
import preloadDefault from "preload" /* 5374 */;
import TableRowInner from "TableRowInner" /* 5480 */;
import TableRowTrailingText from "TableRowTrailingText" /* 5490 */;
import Form from "Form" /* 8118 */;
import registerAssetDefault from "registerAsset" /* 8383 */;
import StickerDefault from "Sticker" /* 10008 */;
import useStickerPackCategories from "useStickerPackCategories" /* 10107 */;
import ChannelAutocompleteEmojiUpsellDefault from "ChannelAutocompleteEmojiUpsell" /* 11956 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "noop" /* 19 */;
import { View } from "get ActivityIndicator" /* 17 */;
import closure_5 from "createGuildRecordFromRust" /* 1910 */;
2026-08-25 06:04:03 +00:00
import closure_6 from "markAllUserIdListsStale" /* 4034 */;
2026-08-24 06:08:38 +00:00
import closure_7 from "mergeGuildAvatar" /* 1922 */;
import ME from "ME" /* 676 */;
import jsxProd from "jsxProd" /* 21 */;
2026-08-25 06:04:03 +00:00
import createCacheKey from "createCacheKey" /* 4380 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function AutocompleteLabel(text) {
2026-08-24 06:08:38 +00:00
const tmp = callback3();
return callback(Form.FormRow.Label, { style: callback3().leading, text: text.text });
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
({ ChannelTypes: closure_8, Fonts } = ME);
2026-07-29 08:29:29 +00:00
({ jsx: c9, jsxs: c10 } = jsxProd);
createCacheKey = { row: null, leading: null, trailing: null, username: null, emoji: null, emojiImage: null, emojiText: null, stickerContainer: null, commandChoiceLoadingContainer: null, commandChoiceLoadingItem: null, autocompleteIcon: null, gameIcon: null, labelRow: null };
2026-08-24 06:08:38 +00:00
createCacheKey = { height: require("AUTOCOMPLETE_ROW_HEIGHT").AUTOCOMPLETE_ROW_HEIGHT, paddingVertical: 0, backgroundColor: ThemesDefault.colors.BACKGROUND_SURFACE_HIGH };
2026-07-29 08:29:29 +00:00
createCacheKey[0] = createCacheKey;
2026-08-24 06:08:38 +00:00
createCacheKey[1] = { fontSize: 16, color: ThemesDefault.colors.INTERACTIVE_TEXT_ACTIVE, fontFamily: Fonts.PRIMARY_SEMIBOLD };
let obj1 = { fontSize: 16, color: ThemesDefault.colors.INTERACTIVE_TEXT_ACTIVE, fontFamily: Fonts.PRIMARY_SEMIBOLD };
createCacheKey[2] = { fontSize: 14, color: ThemesDefault.colors.TEXT_MUTED };
const obj2 = { fontSize: 14, color: ThemesDefault.colors.TEXT_MUTED };
createCacheKey[3] = { color: ThemesDefault.unsafe_rawColors.PRIMARY_400 };
2026-07-29 08:29:29 +00:00
createCacheKey[4] = { width: 32, height: 32 };
createCacheKey[5] = { resizeMode: "contain" };
2026-08-24 06:08:38 +00:00
let obj3 = { color: ThemesDefault.unsafe_rawColors.PRIMARY_400 };
createCacheKey[6] = { lineHeight: 32, fontSize: 27, textAlign: "center", color: ThemesDefault.colors.TEXT_DEFAULT };
const obj4 = { lineHeight: 32, fontSize: 27, textAlign: "center", color: ThemesDefault.colors.TEXT_DEFAULT };
createCacheKey[7] = { width: 56, height: 56, marginHorizontal: 4, justifyContent: "center", alignItems: "center", backgroundColor: ThemesDefault.colors.BACKGROUND_MOD_NORMAL, borderRadius: ThemesDefault.radii.sm };
2026-07-29 08:29:29 +00:00
createCacheKey[8] = { flex: 1, justifyContent: "center" };
2026-08-24 06:08:38 +00:00
const obj5 = { width: 56, height: 56, marginHorizontal: 4, justifyContent: "center", alignItems: "center", backgroundColor: ThemesDefault.colors.BACKGROUND_MOD_NORMAL, borderRadius: ThemesDefault.radii.sm };
createCacheKey[9] = { backgroundColor: ThemesDefault.colors.BACKGROUND_MOD_MUTED, height: 16, borderRadius: ThemesDefault.radii.lg, alignSelf: "flex-start" };
2026-07-29 08:29:29 +00:00
createCacheKey[10] = { opacity: 0.6 };
2026-08-24 06:08:38 +00:00
const obj6 = { backgroundColor: ThemesDefault.colors.BACKGROUND_MOD_MUTED, height: 16, borderRadius: ThemesDefault.radii.lg, alignSelf: "flex-start" };
createCacheKey[11] = { width: 32, height: 32, borderRadius: ThemesDefault.radii.sm };
const obj7 = { width: 32, height: 32, borderRadius: ThemesDefault.radii.sm };
createCacheKey[12] = { flexDirection: "row", alignItems: "center", gap: ThemesDefault.space.PX_8 };
let closure_11 = createCacheKey.createStyles(createCacheKey);
const obj8 = { flexDirection: "row", alignItems: "center", gap: ThemesDefault.space.PX_8 };
2026-07-24 07:16:23 +00:00
const obj9 = {
2026-07-20 16:05:17 +00:00
User(user) {
user = user.user;
({ nick, guildId } = user);
({ status, onPress } = user);
2026-08-24 06:08:38 +00:00
const tmp = callback3();
2026-07-29 08:29:29 +00:00
let obj = user(589);
2026-08-24 06:08:38 +00:00
const items = [closure_6];
2026-07-29 08:29:29 +00:00
const stateFromStores = obj.useStateFromStores(items, () => {
2026-07-20 16:05:17 +00:00
let nickname = null;
if (null == guildId) {
2026-08-24 06:08:38 +00:00
nickname = closure_1_6.getNickname(user.id);
2026-07-20 16:05:17 +00:00
}
return nickname;
});
2026-07-29 08:29:29 +00:00
obj = { DEPRECATED_style: tmp.row, onPress, accessibilityRole: "menuitem", label: null, leading: null, trailing: null };
if (nick == null) {
nick = stateFromStores;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (nick == null) {
2026-08-25 06:04:03 +00:00
nick = guildId(4224).getName(user);
const obj3 = guildId(4224);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[3] = closure_9(AutocompleteLabel, { text: nick });
2026-08-24 06:08:38 +00:00
obj = { status, user, size: tmp2(1297).AvatarSizes.SMALL, guildId, autoStatusCutout: true };
2026-07-29 08:29:29 +00:00
obj[4] = closure_9(user(1297).Avatar, obj);
2026-07-20 16:05:17 +00:00
const items1 = [, ];
({ trailing: arr2[0], username: arr2[1] } = tmp);
2026-08-25 06:04:03 +00:00
obj[5] = closure_9(guildId(9278), { user, usernameStyle: items1, discriminatorStyle: tmp.trailing });
return closure_9(user(8118).FormRow, obj);
2026-07-20 16:05:17 +00:00
},
Global(arg0) {
2026-07-24 07:16:23 +00:00
({ text, badge } = arg0);
({ description, onPress } = arg0);
2026-07-29 08:29:29 +00:00
let obj = { onPress, accessibilityRole: "menuitem", label: null, trailing: null };
2026-07-24 07:16:23 +00:00
if (null != badge) {
2026-07-29 08:29:29 +00:00
obj = { style: null, children: null };
obj[0] = tmp.labelRow;
obj = { text: null };
obj[0] = text;
const items = [tmp2(AutocompleteLabel, obj), badge];
obj[1] = items;
let tmp2Result = callback2(View, obj);
2026-07-24 07:16:23 +00:00
} else {
2026-08-24 06:08:38 +00:00
obj1 = { text: null };
2026-07-29 08:29:29 +00:00
obj1[0] = text;
tmp2Result = tmp2(AutocompleteLabel, obj1);
2026-07-24 07:16:23 +00:00
}
2026-07-29 08:29:29 +00:00
obj[2] = tmp2Result;
2026-08-24 06:08:38 +00:00
obj[3] = closure_9(TableRowTrailingText.TableRowTrailingText, { text: description });
return closure_9(TableRowInner.TableRow, obj);
2026-07-20 16:05:17 +00:00
},
Role(colorString) {
colorString = colorString.colorString;
({ onPress, showDescription, name } = colorString);
2026-07-29 08:29:29 +00:00
let obj = { onPress, accessibilityRole: "menuitem", label: null, trailing: null };
2026-08-24 06:08:38 +00:00
const items = [callback3().leading, ];
2026-07-29 08:29:29 +00:00
let tmp5;
2026-07-20 16:05:17 +00:00
if (null != colorString) {
2026-07-29 08:29:29 +00:00
obj = { color: null };
obj[0] = colorString;
tmp5 = obj;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { style: items, text: "@" + name };
items[1] = tmp5;
2026-08-24 06:08:38 +00:00
obj[2] = closure_9(Form.FormRow.Label, obj);
2026-07-20 16:05:17 +00:00
let str = "";
if (showDescription) {
2026-07-29 08:29:29 +00:00
const intl = tmp3(1236).intl;
str = intl.string(tmp3(1236).t.HrUmDH);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
obj[3] = closure_9(TableRowTrailingText.TableRowTrailingText, { text: str });
return closure_9(TableRowInner.TableRow, obj);
2026-07-20 16:05:17 +00:00
},
Channel(onPress) {
({ channel, category } = onPress);
2026-08-24 06:08:38 +00:00
const tmp = callback3();
2026-07-29 08:29:29 +00:00
if (channel.type === constants.GUILD_CATEGORY) {
2026-08-24 06:08:38 +00:00
let channelIconWithGuild = registerAssetDefault;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
let obj = getChannelIcon;
2026-07-20 16:05:17 +00:00
channelIconWithGuild = obj.getChannelIconWithGuild(channel, tmp2);
}
obj = { source: channelIconWithGuild, style: tmp.autocompleteIcon };
2026-08-24 06:08:38 +00:00
const tmp9 = callback(Button.Icon, obj);
const channelName = computeChannelName.computeChannelName(channel, closure_7, closure_6);
obj = { onPress: onPress.onPress, accessibilityRole: "menuitem", leading: tmp9, label: callback(AutocompleteLabel, { text: channelName }), trailing: null };
obj1 = { style: tmp.trailing, variant: "text-sm/medium", color: "text-muted", children: null };
2026-07-20 16:05:17 +00:00
let name = null != category;
if (name) {
name = category.name;
}
2026-07-29 08:29:29 +00:00
obj1[3] = name;
2026-08-24 06:08:38 +00:00
obj[4] = callback(Text.Text, obj1);
return callback(Form.FormRow, obj);
2026-07-20 16:05:17 +00:00
},
Emoji(url) {
url = url.url;
({ name, surrogates, onPress } = url);
2026-08-24 06:08:38 +00:00
const tmp = callback3();
2026-07-20 16:05:17 +00:00
if ("" !== url) {
2026-07-29 08:29:29 +00:00
let obj = { style: null, source: null };
2026-07-20 16:05:17 +00:00
const items = [, ];
({ emoji: arr2[0], emojiImage: arr2[1] } = tmp);
2026-07-29 08:29:29 +00:00
obj[0] = items;
obj = { uri: null };
obj[0] = url;
obj[1] = obj;
2026-08-24 06:08:38 +00:00
let tmp5 = callback(preloadDefault, obj);
2026-07-29 08:29:29 +00:00
let tmp2 = callback;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp2 = callback;
obj = { style: null, allowFontScaling: false, children: null };
2026-07-20 16:05:17 +00:00
const items1 = [, ];
({ emoji: arr[0], emojiText: arr[1] } = tmp);
2026-07-29 08:29:29 +00:00
obj[0] = items1;
obj[2] = surrogates;
2026-08-24 06:08:38 +00:00
tmp5 = callback(Button.LegacyText, obj);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
obj1 = { onPress, accessibilityRole: "menuitem", leading: tmp5, label: tmp2(AutocompleteLabel, { text: ":" + name + ":" }) };
return tmp2(Form.FormRow, obj1);
2026-07-20 16:05:17 +00:00
},
EmojiPremiumUpsell(arg0) {
({ results, onPress } = arg0);
2026-08-24 06:08:38 +00:00
return callback(Form.FormRow, { onPress, accessibilityRole: "menuitem", label: callback(ChannelAutocompleteEmojiUpsellDefault, { results }) });
2026-07-20 16:05:17 +00:00
},
Choice(arg0) {
({ choice, onPress } = arg0);
2026-07-29 08:29:29 +00:00
let obj = { onPress, accessibilityRole: "menuitem", label: null };
2026-07-20 16:05:17 +00:00
obj = { text: choice.displayName };
2026-07-29 08:29:29 +00:00
obj[2] = callback(AutocompleteLabel, obj);
2026-08-24 06:08:38 +00:00
return callback(Form.FormRow, obj);
2026-07-20 16:05:17 +00:00
},
ChoiceLoading() {
2026-08-24 06:08:38 +00:00
const tmp = callback3();
2026-07-29 08:29:29 +00:00
const memo = React.useMemo(() => callback(table[27]).random(100, 300), []);
let obj = { DEPRECATED_style: tmp.row, leading: null };
2026-08-24 06:08:38 +00:00
obj = { style: tmp.commandChoiceLoadingContainer, children: callback(View, { style: items }) };
items = [tmp.commandChoiceLoadingItem, { width: memo }];
2026-07-29 08:29:29 +00:00
obj[1] = callback(View, obj);
2026-08-24 06:08:38 +00:00
return callback(Form.FormRow, obj);
2026-07-20 16:05:17 +00:00
},
Sticker(arg0) {
({ sticker, onPress, onLongPress, isInteracting } = arg0);
2026-08-24 06:08:38 +00:00
let obj = useStickerPackCategories;
2026-07-20 16:05:17 +00:00
const shouldAnimateSticker = obj.useShouldAnimateSticker(isInteracting);
2026-08-24 06:08:38 +00:00
obj = { accessibilityRole: "menuitem", style: callback3().stickerContainer, onPress, onLongPress, pointerEvents: "box-only", children: callback(StickerDefault, { sticker, size: 40, animated: shouldAnimateSticker }) };
return callback(PressableBase.PressableOpacity, obj);
2026-07-20 16:05:17 +00:00
},
Label(text) {
2026-08-24 06:08:38 +00:00
return callback(Form.FormRow, { label: callback(AutocompleteLabel, { text: text.label }) });
2026-07-24 07:16:23 +00:00
},
Game(game) {
game = game.game;
2026-08-24 06:08:38 +00:00
const tmp = callback3();
const tmp4 = getGameMediaRefURLDefault(game.id, game.icon, { size: 32 });
let obj = isNullOrEmpty;
2026-07-29 08:29:29 +00:00
if (obj.isNullOrEmpty(tmp4)) {
obj = { size: "sm", style: null };
obj[1] = tmp.gameIcon;
2026-08-25 06:04:03 +00:00
let tmp6Result = tmp6(tmp5(8097).UnknownGameIcon, obj);
2026-07-29 08:29:29 +00:00
let tmp8 = tmp6;
2026-07-24 07:16:23 +00:00
} else {
2026-07-29 08:29:29 +00:00
obj = { style: null, source: null };
obj[0] = tmp.gameIcon;
2026-08-24 06:08:38 +00:00
obj1 = { uri: null };
2026-07-29 08:29:29 +00:00
obj1[0] = tmp4;
obj[1] = obj1;
2026-08-24 06:08:38 +00:00
tmp6Result = tmp6(preloadDefault, obj);
2026-07-29 08:29:29 +00:00
tmp8 = tmp6;
2026-07-24 07:16:23 +00:00
}
2026-08-24 06:08:38 +00:00
return tmp8(Form.FormRow, { onPress: game.onPress, accessibilityRole: "menuitem", leading: tmp6Result, label: tmp8(AutocompleteLabel, obj3) });
2026-07-20 16:05:17 +00:00
}
};
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/autocompleter/native/Autocomplete.tsx");
2026-07-20 16:05:17 +00:00
2026-07-24 07:16:23 +00:00
export default obj9;
2026-07-20 16:05:17 +00:00
export const AUTOCOMPLETE_STICKER_NODE_SIZE = 56;
export const AUTOCOMPLETE_STICKER_NODE_MARGIN = 4;