// Metro module 11340 (f11341). import { View } from "react-native"; import { AppLauncherOptionAutoFocusType } from "../AppLauncherNativeConstants"; import { createStyles } from "../../../../design/components/Styles/native/createStyles"; import Module712 from "../../../../_bundle/Module712"; import { ApplicationCommandOptionType } from "../../../../flow/Server"; import AppLauncherChoicesOption from "./choices/AppLauncherChoicesOption"; import AppLauncherAutocompleteOption from "./autocomplete/AppLauncherAutocompleteOption"; import AppLauncherTextInputOption from "./text_input/AppLauncherTextInputOption"; import AppLauncherAttachmentOption from "./attachment/AppLauncherAttachmentOption"; import AppLauncherBooleanOption from "./boolean/AppLauncherBooleanOption"; import AppLauncherMentionableOption from "./mentionable/AppLauncherMentionableOption"; import { MentionableItemTypes } from "./mentionable/AppLauncherMentionableListActionSheet"; import AutocompleteUtils from "../../../../utils/native/AutocompleteUtils"; import AppLauncherRoleOption from "./role/AppLauncherRoleOption"; import AppLauncherUserOption from "./user/AppLauncherUserOption"; import AppLauncherChannelOption from "./channel/AppLauncherChannelOption"; import { PressableOpacity } from "../../../../design/void/Pressables/native/Pressables"; import { CircleXIcon } from "../../../../design/components/Icon/native/redesign/generated/CircleXIcon"; const useStyles = createStyles({ dismissableOptionWrapper: { flexDirection: "row", alignItems: "center" }, optionViewContainer: { flex: 1 }, dismissButton: { marginLeft: 8, marginRight: -4, padding: 4, borderRadius: Module712.radii.round }, option: { flex: 1 } }); export default function AppLauncherCommandOption(props) { let r80, r185, styles; let option, onStartEditing, onEndEditing2, onOptionValueChange, onPress2, onDismiss; L39: { option = props.option; onStartEditing = props.onStartEditing; onEndEditing2 = props.onEndEditing; onOptionValueChange = props.onOptionValueChange; onPress2 = props.onPress; const onPressAttachmentOption = props.onPressAttachmentOption; onDismiss = props.onDismiss; const { onFocus, channel, autoFocusType, command, optionValues, hasError } = props; styles = useStyles(); const type = option.type; if (ApplicationCommandOptionType.STRING !== type && ApplicationCommandOptionType.INTEGER !== type && ApplicationCommandOptionType.NUMBER !== type) { if (ApplicationCommandOptionType.ATTACHMENT === type) { r80 = { onEndEditing2(option); onOptionValueChange(option, event != null ? [{ type: "text", text: event }] : []); }} channel={channel} autoFocus={autoFocusType === AppLauncherOptionAutoFocusType.OPTIONAL_OPTION_ADDED} hasError={hasError} onPress={onPressAttachmentOption} />; break L39; } if (ApplicationCommandOptionType.BOOLEAN === type) { const r143 = optionValues.current[option.name]; r80 = { onPress2(); onEndEditing2(option); onOptionValueChange(option, [{ type: "text", text: event.toString() }]); }} hasError={hasError} />; break L39; } if (ApplicationCommandOptionType.MENTIONABLE === type) { const r125 = optionValues.current[option.name]; r80 = { if (mentionable != null) { const type = mentionable.type; if (MentionableItemTypes.USER === type) { onOptionValueChange(option, [{ type: "userMention", userId: mentionable.result.user.id }]); } else if (MentionableItemTypes.ROLE === type) { onOptionValueChange(option, [{ type: "roleMention", roleId: mentionable.result.id }]); } else if (MentionableItemTypes.GLOBAL === type) { const result = mentionable.result; if (result.text === AutocompleteUtils.MENTION_EVERYONE().text) { onOptionValueChange(option, [{ type: "textMention", text: "@everyone" }]); } else { onOptionValueChange(option, [{ type: "text", text: result.text }]); } } } else { onOptionValueChange(option, []); } }} onActionSheetDismiss={() => onEndEditing2(option)} channel={channel} autoFocus={autoFocusType === AppLauncherOptionAutoFocusType.OPTIONAL_OPTION_ADDED} hasError={hasError} onPress={onPress2} />; break L39; } if (ApplicationCommandOptionType.ROLE === type) { const r107 = optionValues.current[option.name]; r80 = { onOptionValueChange(option, role == null ? [] : [{ type: "roleMention", roleId: role.id }]); }} onActionSheetDismiss={() => { onEndEditing2(option); }} channel={channel} autoFocus={autoFocusType === AppLauncherOptionAutoFocusType.OPTIONAL_OPTION_ADDED} hasError={hasError} onPress={onPress2} />; break L39; } if (ApplicationCommandOptionType.USER === type) { const r88 = optionValues.current[option.name]; r80 = { let r8; if (user == null) { r8 = []; } else { let userId = user; if (typeof userId !== "string") { userId = user.id; } r8 = [{ type: "userMention", userId }]; } onOptionValueChange(option, r8); }} onActionSheetDismiss={() => onEndEditing2(option)} channel={channel} autoFocus={autoFocusType === AppLauncherOptionAutoFocusType.OPTIONAL_OPTION_ADDED} hasError={hasError} onPress={onPress2} />; break L39; } if (ApplicationCommandOptionType.CHANNEL === type) { const r70 = optionValues.current[option.name]; r80 = { onOptionValueChange(option, channel != null ? [{ type: "channelMention", channelId: channel.id }] : []); }} onActionSheetDismiss={() => { onEndEditing2(option); }} channel={channel} autoFocus={autoFocusType === AppLauncherOptionAutoFocusType.OPTIONAL_OPTION_ADDED} hasError={hasError} onPress={onPress2} />; break L39; } return null; } if (option.choices != null) { const r212 = optionValues.current[option.name]; r185 = { onEndEditing2(option); let text = event?.displayName; if (text == null) { text = ""; } onOptionValueChange(option, [{ type: "text", text }]); }} onOpenChoicesSheet={() => { onPress2(); onStartEditing(option); }} onDismissChoicesSheet={() => onEndEditing2(option)} autoFocus={autoFocusType === AppLauncherOptionAutoFocusType.OPTIONAL_OPTION_ADDED} hasError={hasError} />; } else if (option.autocomplete) { const r193 = optionValues.current[option.name]; r185 = { onEndEditing2(option); let text = event?.displayName; if (text == null) { text = ""; } onOptionValueChange(option, [{ type: "text", text }]); }} onOpenAutocompleteSheet={() => { onPress2(); onStartEditing(option); }} onDismissAutocompleteSheet={() => onEndEditing2(option)} hasError={hasError} />; } else { const r174 = optionValues.current[option.name]; r185 = onEndEditing2(option)} onChangeText={(a0) => { onStartEditing(option); onOptionValueChange(option, [{ type: "text", text: a0 }]); }} onFocus={onFocus} autoFocus={[AppLauncherOptionAutoFocusType.FIRST_REQUIRED_OPTION, AppLauncherOptionAutoFocusType.OPTIONAL_OPTION_ADDED].includes(autoFocusType)} hasError={hasError} onPressIn={onPress2} />; } r80 = r185; } return onDismiss != null ? {r80} onDismiss(option)}> : r80; };