This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

@@ -0,0 +1,206 @@
// 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 = <AppLauncherAttachmentOption key={option.name} style={styles.option} option={option} onSelectAttachment={(event) => {
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 = <AppLauncherBooleanOption key={option.name} style={styles.option} option={option} initialValue={r143 == null ? void 0 : r143[0]} onPress={(event) => {
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 = <AppLauncherMentionableOption option={option} initialValue={r125 == null ? void 0 : r125[0]} onMentionablePress={({ mentionable }) => {
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 = <AppLauncherRoleOption key={option.name} style={styles.option} option={option} initialValue={r107 == null ? void 0 : r107[0]} onRolePress={({ role }) => {
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 = <AppLauncherUserOption key={option.name} style={styles.option} option={option} initialValue={r88 == null ? void 0 : r88[0]} onUserPress={({ user }) => {
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 = <AppLauncherChannelOption key={option.name} style={styles.option} option={option} initialValue={r70 == null ? void 0 : r70[0]} onChannelPress={({ channel }) => {
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 = <AppLauncherChoicesOption key={option.name} style={styles.option} option={option} initialValue={r212 == null ? void 0 : r212[0]} onSelect={(event) => {
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 = <AppLauncherAutocompleteOption key={option.name} style={styles.option} channel={channel} option={option} activeCommand={command} optionValues={optionValues} initialValue={r193 == null ? void 0 : r193[0]} autoFocus={autoFocusType === AppLauncherOptionAutoFocusType.OPTIONAL_OPTION_ADDED} onSelect={(event) => {
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 = <AppLauncherTextInputOption key={option.name} style={styles.option} option={option} guildId={channel.guild_id} initialValue={r174 == null ? void 0 : r174[0]} onEndEditing={() => 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 ? <View style={styles.dismissableOptionWrapper}>
<View style={styles.optionViewContainer}>{r80}</View>
<PressableOpacity style={styles.dismissButton} onPress={() => onDismiss(option)}>
<CircleXIcon size="md" />
</PressableOpacity>
</View> : r80;
};
@@ -0,0 +1,48 @@
// Metro module 11343 (f11344).
import { View } from "react-native";
import { DEFAULT_CONTENT_PADDING } from "../AppLauncherNativeConstants";
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../_bundle/Module712";
import { BottomSheet } from "../../../../design/components/Sheet/native/BottomSheet.native";
import { BottomSheetTitleHeader } from "../../../../design/components/Sheet/native/BottomSheetTitleHeader.native";
import { ActionSheetCloseButton } from "../../../../design/components/Sheet/native/ActionSheetCloseButton.native";
import ActionSheetActionCreators from "../../../action_sheet/native/ActionSheetActionCreators";
import { Spacer } from "../../../../design/void/native";
const useStyles = createStyles({
actionSheetBackground: {
backgroundColor: Module712.colors.MOBILE_KEYBOARD_PANEL_BACKGROUND
},
titleContainer: {
backgroundColor: "transparent"
},
titleWrapper: {
alignItems: "center"
},
subtitleWrapper: {
paddingHorizontal: 12,
textAlign: "center"
},
contentContainer: {
paddingHorizontal: DEFAULT_CONTENT_PADDING,
paddingTop: DEFAULT_CONTENT_PADDING,
flex: 1
}
});
export function AppLauncherCommandOptionActionSheet(props) {
const { option, children, contentContainerStyles, scrollable = true, startExpanded = true, ...props2 } = props;
let c18763_0 = props2;
const styles = useStyles();
return <BottomSheet key={option.name} {...props2} backgroundStyles={styles.actionSheetBackground} scrollable={scrollable} startExpanded={startExpanded} header={<BottomSheetTitleHeader titleContainerStyle={styles.titleContainer} titleWrapperStyle={styles.titleWrapper} subtitleStyle={styles.subtitleWrapper} leading={<View style={{
alignSelf: "flex-start"
}}>
<ActionSheetCloseButton onPress={() => {
ActionSheetActionCreators.hideActionSheet();
const onDismiss = c18763_0.onDismiss;
if (onDismiss != null) {
onDismiss.call(c18763_0);
}
}} />
</View>} title={option.displayName} subtitle={option.displayDescription} trailing={<Spacer size={24} />} />}>
<View style={[styles.contentContainer, contentContainerStyles]}>{children}</View>
</BottomSheet>;
}
@@ -0,0 +1,65 @@
// Metro module 11352 (f11353).
import { useEffect, useRef } from "react";
import { View } from "react-native";
import { DraftType } from "../../../../../stores/DraftStore";
import UploadAttachmentStore from "../../../../../stores/UploadAttachmentStore";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import AttachmentPreview from "../../../../media/native/AttachmentPreview";
import { FileIcon } from "../../../../../design/components/Icon/native/redesign/generated/FileIcon";
import { ApplicationCommandOptionType } from "../../../../../flow/Server";
import { useFileTypesFormattedString } from "../../../../interactions/FileTypeFiltering";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import UploadAttachmentActionCreators from "../../../../../actions/UploadAttachmentActionCreators";
import AppLauncherSelectOptionFormRow from "../../base_components/AppLauncherSelectOptionFormRow";
import { intl, t } from "../../../../../intl/index.native";
import { UploadPlatform } from "../../../../../lib/uploader/Upload";
import { ImageFileIcon } from "../../../../../design/components/Icon/native/redesign/generated/ImageFileIcon";
let useStyles;
const AttachmentPreviewAppLauncher = function AttachmentPreviewAppLauncher(props) {
const { uri, isImage, isVideo } = props;
const styles = useStyles();
const selectedImage = styles.selectedImage;
return <AttachmentPreview uri={uri} isImage={isImage} isVideo={isVideo} width={selectedImage.width} height={selectedImage.height} style={styles.selectedImage} defaultPreview={<FileIcon size="sm" />} />;
};
useStyles = createStyles({
imageIconWrapper: {
justifyContent: "center",
alignItems: "center",
backgroundColor: Module712.colors.BACKGROUND_MOD_SUBTLE,
width: 32,
height: 32,
borderRadius: Module712.radii.lg
},
selectedImage: {
width: 32,
height: 32,
borderRadius: Module712.radii.sm
}
});
export default function AppLauncherAttachmentOption(props) {
let ref;
const { option, channel, style, autoFocus, hasError, onPress, onSelectAttachment } = props;
ref = void 0;
const styles = useStyles();
const fileTypesFormattedString = useFileTypesFormattedString(option.type === ApplicationCommandOptionType.ATTACHMENT ? option.fileTypes : void 0);
const stateFromStores = useStateFromStores([UploadAttachmentStore], () => UploadAttachmentStore.getUpload(channel.id, option.name, DraftType.ApplicationLauncherCommand));
useEffect(() => () => UploadAttachmentActionCreators.remove(channel.id, option.name, DraftType.ApplicationLauncherCommand), [channel.id, option.name]);
ref = useRef(onSelectAttachment);
useEffect(() => {
ref.current = onSelectAttachment;
});
useEffect(() => {
if (stateFromStores?.filename != null) {
const current = ref.current;
if (current != null) {
current.call(ref, stateFromStores.filename);
}
}
}, [stateFromStores?.filename]);
return <AppLauncherSelectOptionFormRow style={style} hasError={hasError} option={option} selected={stateFromStores != null} selectedItemName={stateFromStores != null ? stateFromStores.filename : void 0} unselectedSubLabel={fileTypesFormattedString != null ? intl.format(t.NRRxmz, {
types: fileTypesFormattedString
}) : void 0} leading={stateFromStores != null && stateFromStores.item.platform === UploadPlatform.REACT_NATIVE ? <AttachmentPreviewAppLauncher uri={stateFromStores.item.uri} isImage={stateFromStores.isImage} isVideo={stateFromStores.isVideo} /> : <View style={styles.imageIconWrapper}>
<ImageFileIcon size="sm" color="interactive-text-default" />
</View>} onPress={onPress} autoFocus={autoFocus} />;
};
@@ -0,0 +1,175 @@
// Metro module 11348 (f11349).
import { useMemo, useState, useRef, useEffect, useCallback } from "react";
import { View } from "react-native";
import ApplicationCommandAutocompleteStore from "../../../../application_commands/ApplicationCommandAutocompleteStore";
import GuildStore from "../../../../../stores/GuildStore";
import { AutoCompleteResultTypes } from "../../../../../Constants";
import { AUTOCOMPLETE_OPTION_DEBOUNCE_TIME } from "../../../../application_commands/ApplicationCommandConstants";
import Module12 from "../../../../../_bundle/Module12";
import executeCommand from "../../../../application_commands/executeCommand";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { useStateFromStoresObject } from "../../../../../_bundle/defaultAreStatesEqual";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { AppLauncherCommandOptionActionSheet } from "../AppLauncherCommandOptionActionSheet";
import { AppLauncherListSearchBar, AppLauncherListEmptyState, AppLauncherList } from "../../base_components/AppLauncherList";
import { intl, t } from "../../../../../intl/index.native";
import Module38 from "../../../../../_bundle/Module38";
import { TableRow } from "../../../../../design/components/TableRow/native/TableRow.native";
import { match } from "../../../../../_bundle/Module4389";
import { Text } from "../../../../../design/components/Text/native/Text";
import { EmptyState } from "../../../../../design/void/native";
import Module11345 from "../../../../../_bundle/Module11345";
let c7706_11, useStyles, AutocompleteFailedEmptyState;
const Item = function Item({ item, index, choices, onChoiceSelect }) {
let styles, memo;
styles = void 0;
memo = void 0;
const ListItem2 = function ListItem(props) {
return <TableRow label={props.label} onPress={props.onPress} start={index === 0} end={index === choices.length - 1} />;
};
Module38(item.type === AutoCompleteResultTypes.CHOICE || item.type === AutoCompleteResultTypes.CHOICE_LOADING || item.type === AutoCompleteResultTypes.LABEL, "Invalid autocomplete result type");
styles = useStyles();
memo = useMemo(() => 100 * Math.random() + 50, []);
return match(item).with({
type: AutoCompleteResultTypes.CHOICE
}, (a0) => {
return <ListItem2 label={<Text lineClamp={1} variant="text-md/normal" color="mobile-text-heading-primary">{a0.choice.displayName}</Text>} onPress={() => {
if (onChoiceSelect != null) {
onChoiceSelect(a0.choice);
}
ActionSheetActionCreators.hideActionSheet();
}} />;
}).with({
type: AutoCompleteResultTypes.LABEL
}, (a0) => {
return <ListItem2 label={<Text lineClamp={1} variant="text-md/normal" color="mobile-text-heading-primary">
"
{a0.label}
"
</Text>} onPress={() => {
if (onChoiceSelect != null) {
onChoiceSelect({
name: a0.label,
value: a0.label,
displayName: a0.label
});
}
ActionSheetActionCreators.hideActionSheet();
}} />;
}).with({
type: AutoCompleteResultTypes.CHOICE_LOADING
}, () => <ListItem2 label={<View style={styles.commandChoiceLoadingContainer}>
<View style={[styles.commandChoiceLoadingItem, {
width: memo
}]} />
</View>} />).exhaustive();
};
AutocompleteFailedEmptyState = function AutocompleteFailedEmptyState() {
return <EmptyState style={useStyles().emptyState} lightSource={Module11345} darkSource={Module11345} title={intl.string(t.rTAbPn)} />;
};
c7706_11 = Module12.debounce(executeCommand, AUTOCOMPLETE_OPTION_DEBOUNCE_TIME, {
leading: true,
trailing: true
});
useStyles = createStyles({
commandChoiceLoadingContainer: {
flex: 1,
justifyContent: "center"
},
commandChoiceLoadingItem: {
backgroundColor: Module712.colors.BACKGROUND_MOD_MUTED,
height: 16,
borderRadius: Module712.radii.lg,
alignSelf: "flex-start"
},
emptyState: {
backgroundColor: "transparent"
}
});
export default function AppLauncherAutocompleteActionSheet(props) {
let autocompleteResults, lastErrored, memo2;
const { option, initChoice, onChoiceSelect: onChoiceSelect2, onDismissAutocompleteSheet, channel, activeCommand, optionValues } = props;
autocompleteResults = void 0;
lastErrored = void 0;
memo2 = void 0;
let r6 = initChoice?.name;
if (r6 == null) {
r6 = "";
}
const [state, onChange] = useState(r6);
const ref = useRef(null);
const stateFromStoresObject = useStateFromStoresObject([ApplicationCommandAutocompleteStore], () => ({
autocompleteResults: ApplicationCommandAutocompleteStore.getAutocompleteChoices(channel.id, option.name, state),
lastErrored: ApplicationCommandAutocompleteStore.getLastErrored(channel.id)
}), [channel.id, option.name, state]);
autocompleteResults = stateFromStoresObject.autocompleteResults;
let lastErrored2 = stateFromStoresObject.lastErrored;
lastErrored = lastErrored2;
memo2 = useMemo(() => {
const r2 = [];
if (state !== "") {
r2.push({
type: AutoCompleteResultTypes.LABEL,
label: state
});
}
if (autocompleteResults == null && !lastErrored) {
r2.push.apply(r2, [...new Array(4).fill({
type: AutoCompleteResultTypes.CHOICE_LOADING
})]);
} else if (autocompleteResults != null) {
r2.push.apply(r2, [...autocompleteResults.map((autocompleteResult) => ({
type: AutoCompleteResultTypes.CHOICE,
choice: autocompleteResult
}))]);
}
return r2;
}, [state, autocompleteResults, lastErrored]);
let r44 = memo2.length === 0 && !lastErrored;
useEffect(() => {
c7706_11({
command: activeCommand,
optionValues,
context: {
channel,
guild: GuildStore.getGuild(channel.guild_id),
autocomplete: {
name: option.name,
query: state
}
}
});
const current = ref.current;
if (current != null) {
current.scrollToOffset({
offset: 0,
animated: false
});
}
}, [channel, option.name, activeCommand, optionValues, state]);
const callback = useCallback((a0) => <Item item={a0.item} index={a0.index} onChoiceSelect={onChoiceSelect2} choices={memo2} />, [onChoiceSelect2, memo2]);
const callback2 = useCallback(() => {
if (state !== "") {
if (onChoiceSelect2 != null) {
onChoiceSelect2({
name: state,
value: state,
displayName: state
});
}
ActionSheetActionCreators.hideActionSheet();
}
}, [onChoiceSelect2, state]);
const r78 = [<AppLauncherListSearchBar placeholder={intl.string(t.Wuie9L)} onChange={onChange} autoFocus returnKeyType="done" onSubmitEditing={callback2} />, , , ,];
if (r44) {
r44 = <AppLauncherListEmptyState />;
}
r78[1] = r44;
r78[2] = <AppLauncherList ref={ref} keyExtractor={(item, index) => `${item.type === AutoCompleteResultTypes.CHOICE ? item.choice.name : "placeholder"}_${index}`} data={memo2} renderItem={callback} scrollEnabled />;
if (lastErrored) {
lastErrored2 = <AutocompleteFailedEmptyState />;
}
r78[3] = lastErrored2;
return <AppLauncherCommandOptionActionSheet option={option} onDismiss={onDismissAutocompleteSheet}>{r78}</AppLauncherCommandOptionActionSheet>;
};
@@ -0,0 +1,79 @@
// Metro module 11347 (f11348).
import { useState } from "react";
import { Fonts } from "../../../../../Constants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { dismissGlobalKeyboard } from "../../../../../utils/native/KeyboardManagerUtils";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { useAnimationDelayedAutoFocus } from "../../hooks/useAnimationDelayedAutoFocus";
import { PressableOpacity } from "../../../../../design/void/Pressables/native/Pressables";
import { Text } from "../../../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
width: "100%",
backgroundColor: Module712.colors.INPUT_BACKGROUND_DEFAULT,
borderRadius: Module712.radii.lg,
padding: 12,
borderWidth: 2,
borderColor: "transparent",
flexDirection: "row",
alignItems: "center"
},
hasError: {
borderColor: Module712.colors.BORDER_FEEDBACK_CRITICAL,
padding: 12
},
inputText: {
fontSize: 16,
alignSelf: "center",
fontFamily: Fonts.PRIMARY_MEDIUM,
color: Module712.colors.TEXT_DEFAULT
}
});
export default function AppLauncherAutocompleteOption(props) {
let state, setState;
const { style, option, onSelect, onOpenAutocompleteSheet, onDismissAutocompleteSheet, channel, activeCommand, optionValues, initialValue, autoFocus } = props;
let hasError = props.hasError;
state = void 0;
setState = void 0;
const onPress = function onPress() {
if (onOpenAutocompleteSheet != null) {
onOpenAutocompleteSheet();
}
dismissGlobalKeyboard();
ActionSheetActionCreators.openLazy(import("./AppLauncherAutocompleteActionSheet"), "AppLauncherAutocompleteActionSheet", {
option,
initChoice: state,
onChoiceSelect: (a0) => {
setState(a0);
onSelect(a0);
},
channel,
activeCommand,
onDismissAutocompleteSheet,
optionValues: optionValues.current
});
};
[state, setState] = useState(() => {
if (initialValue != null && initialValue.type === "text" && initialValue.text !== "") {
return {
displayName: initialValue.text,
name: initialValue.text,
value: initialValue.text
};
}
});
const styles = useStyles();
useAnimationDelayedAutoFocus(autoFocus, onPress);
const style2 = [styles.container, , ,];
if (hasError) {
hasError = styles.hasError;
}
style2[1] = hasError;
style2[2] = style;
return <PressableOpacity onPress={onPress} style={style2}>
<Text variant="text-md/normal" style={styles.inputText}>
{state != null ? state.displayName : " "}
</Text>
</PressableOpacity>;
};
@@ -0,0 +1,26 @@
// Metro module 11354 (f11355).
import { useState } from "react";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { FormCheckboxRow } from "../../../../../design/void/Form/native/index";
const useStyles = createStyles({
container: {
flexDirection: "row",
width: "100%",
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.lg,
alignItems: "center"
}
});
export default function AppLauncherBooleanOption(props) {
let state, setState;
const { style, option, initialValue, onPress: onPress2, hasError } = props;
state = void 0;
setState = void 0;
const styles = useStyles();
[state, setState] = useState(() => initialValue != null && initialValue.type === "text" && initialValue.text === "true");
return <FormCheckboxRow start end style={[styles.container, style]} hasError={hasError} label={option.displayName} selected={state} onPress={() => {
setState(!state);
onPress2(!state);
}} />;
};
@@ -0,0 +1,81 @@
// Metro module 11365 (f11366).
import { useState, useRef, useEffect } from "react";
import GuildStore from "../../../../../stores/GuildStore";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { TextIcon } from "../../../../../design/components/Icon/native/redesign/generated/TextIcon";
import { getChannelIconComponentWithGuild } from "../../../../../utils/native/ChannelUtils";
import AppLauncherOptionIcon from "../../base_components/AppLauncherOptionIcon";
import AutocompleteUtils from "../../../../../utils/AutocompleteUtils";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { AppLauncherCommandOptionActionSheet } from "../AppLauncherCommandOptionActionSheet";
import { AppLauncherListSearchBar, AppLauncherListEmptyState, AppLauncherList } from "../../base_components/AppLauncherList";
import useChannelName from "../../../../channel/useChannelName";
import { TableRow } from "../../../../../design/components/TableRow/native/TableRow.native";
import { Text } from "../../../../../design/components/Text/native/Text";
let c7722_8, useStyles, ChannelListItem;
const ChannelIcon = function ChannelIcon(props) {
const { channel: channel2, size = "sm", wrapperSize = 32 } = props;
const styles = useStyles();
let TextIcon2 = TextIcon;
if (channel2 != null) {
let r23 = getChannelIconComponentWithGuild(channel2, GuildStore.getGuild(channel2.getGuildId()));
if (r23 == null) {
r23 = TextIcon;
}
TextIcon2 = r23;
}
return <AppLauncherOptionIcon icon={<TextIcon2 size={size} color="interactive-text-default" />} wrapperStyle={styles.channelIconWrapper} wrapperSize={wrapperSize} />;
};
ChannelListItem = function ChannelListItem(props) {
const { channel: channel2, index, totalCount } = props;
return <TableRow key={channel2.id} onPress={props.onPress} label={<Text lineClamp={1} variant="text-md/semibold" color="mobile-text-heading-primary">
{useChannelName(channel2)}
</Text>} icon={<ChannelIcon channel={channel2} />} start={index === 0} end={index === totalCount - 1} />;
};
c7722_8 = "AppLauncherChannelListActionSheet";
useStyles = createStyles({
channelIconWrapper: {
backgroundColor: Module712.colors.BACKGROUND_MOD_SUBTLE
}
});
export default function AppLauncherChannelListActionSheet(props) {
const { onChannelPress, onActionSheetDismiss, channel, option } = props;
const [state, setState] = useState("");
const ref = useRef(null);
const [state2, setState2] = useState([]);
const length = state2.length;
useEffect(() => {
setState2(AutocompleteUtils.queryApplicationCommandChannelResults({
query: state,
channel,
channelTypes: option.channelTypes,
limit: null,
allowSnowflake: true
}).channels);
}, [state, channel, option]);
return <AppLauncherCommandOptionActionSheet onDismiss={onActionSheetDismiss} option={option}>
<AppLauncherListSearchBar onChange={function onChange(event) {
setState(event.toLowerCase());
const current = ref.current;
if (current != null) {
current.scrollToOffset({
offset: 0,
animated: false
});
}
}} />
{length === 0 ? <AppLauncherListEmptyState /> : <AppLauncherList ref={ref} data={state2} renderItem={function renderItem(info) {
const item = info.item;
return <ChannelListItem channel={item} index={info.index} totalCount={state2.length} onPress={() => {
onChannelPress({
channel: item
});
ActionSheetActionCreators.hideActionSheet(c7722_8);
onActionSheetDismiss();
}} />;
}} />}
</AppLauncherCommandOptionActionSheet>;
};
export const APP_LAUNCHER_CHANNEL_LIST_ACTION_SHEET_KEY = "AppLauncherChannelListActionSheet";
export { ChannelIcon };
@@ -0,0 +1,42 @@
// Metro module 11364 (f11365).
import { useState, useEffect } from "react";
import ChannelStore from "../../../../../stores/ChannelStore";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import useChannelName from "../../../../channel/useChannelName";
import AppLauncherSelectOptionFormRow from "../../base_components/AppLauncherSelectOptionFormRow";
import { ChannelIcon, APP_LAUNCHER_CHANNEL_LIST_ACTION_SHEET_KEY } from "./AppLauncherChannelListActionSheet";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
export default function AppLauncherChannelOption(props) {
let state, setState, stateFromStores;
const { style, option, initialValue, onChannelPress: onChannelPress2, onActionSheetDismiss, channel, autoFocus, hasError, onPress: onPress2 } = props;
state = void 0;
setState = void 0;
stateFromStores = void 0;
[state, setState] = useState(() => initialValue != null ? initialValue.type === "channelMention" ? initialValue.channelId : null : null);
stateFromStores = useStateFromStores([ChannelStore], () => ChannelStore.getChannel(state), [state]);
useEffect(() => {
if (state != null && stateFromStores == null) {
setState(null);
onChannelPress2({
channel: null
});
}
}, [onChannelPress2, state, stateFromStores]);
const channelName = useChannelName(stateFromStores);
return <AppLauncherSelectOptionFormRow style={style} option={option} hasError={hasError} selected={stateFromStores != null} selectedItemName={stateFromStores != null ? channelName : void 0} leading={<ChannelIcon channel={stateFromStores} />} onPress={function onPress() {
if (onPress2 != null) {
onPress2();
}
ActionSheetActionCreators.openLazy(import("./AppLauncherChannelListActionSheet"), APP_LAUNCHER_CHANNEL_LIST_ACTION_SHEET_KEY, {
option,
channel,
onChannelPress: ({ channel: channel2 }) => {
setState(channel2?.id);
onChannelPress2({
channel: channel2
});
},
onActionSheetDismiss
});
}} autoFocus={autoFocus} />;
};
@@ -0,0 +1,101 @@
// Metro module 11342 (f11343).
import { useState, useCallback } from "react";
import { View } from "react-native";
import { DEFAULT_CONTENT_PADDING } from "../../AppLauncherNativeConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { BottomSheetFlashList, FlashList } from "../../../../../_bundle/noop_6676";
import useSafeAreaInsets_native from "../../../../safe_area/useSafeAreaInsets.native";
import { isIOS } from "../../../../../utils/PlatformUtils";
import AutocompleteUtils from "../../../../../utils/AutocompleteUtils";
import { FormRadioRow, FormDivider } from "../../../../../design/void/Form/native/index";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import useIsWindowLarge from "../../../../screen/native/useIsWindowLarge";
import { AppLauncherCommandOptionActionSheet } from "../AppLauncherCommandOptionActionSheet";
import { AppLauncherListSearchBar, AppLauncherListEmptyState } from "../../base_components/AppLauncherList";
let useStyles;
const FlashListWrapper = function FlashListWrapper(props) {
const { scrollable, ...props2 } = props;
return scrollable ? <BottomSheetFlashList preserveScrollMomentum {...props2} /> : <FlashList scrollEnabled={false} {...props2} />;
};
useStyles = createStyles({
listItemContainer: {
overflow: "hidden"
},
listItem: {
backgroundColor: Module712.colors.CARD_BACKGROUND_DEFAULT
},
firstItem: {
borderTopLeftRadius: Module712.radii.xl,
borderTopRightRadius: Module712.radii.xl
},
lastItem: {
borderBottomLeftRadius: Module712.radii.xl,
borderBottomRightRadius: Module712.radii.xl
},
divider: {
backgroundColor: Module712.colors.BORDER_SUBTLE,
marginLeft: 16
}
});
export default function AppLauncherChoicesActionSheet(props) {
let state, setState, state2, setState2;
const { option, initChoiceIndex, onChoiceSelect, onDismiss } = props;
state = void 0;
setState = void 0;
state2 = void 0;
setState2 = void 0;
const styles = useStyles();
const bottom = useSafeAreaInsets_native().bottom;
const paddingBottom = isIOS() ? bottom : bottom + DEFAULT_CONTENT_PADDING;
[state, setState] = useState(() => {
let choices = option.choices;
if (choices == null) {
choices = [];
}
return choices.map((a0, index) => ({
choice: a0,
originalIndex: index
}));
});
[state2, setState2] = useState(initChoiceIndex);
const callback = useCallback((a0) => {
let choices = option.choices;
if (choices == null) {
choices = [];
}
setState(AutocompleteUtils.queryChoice({
query: a0,
choices,
limit: null
}));
}, [option.choices]);
const callback2 = useCallback(({ item, index }) => {
let r11 = state != null && index === state.length - 1;
const originalIndex = item.originalIndex;
const style = [styles.listItemContainer, index === 0 && styles.firstItem, ,];
if (r11) {
r11 = styles.lastItem;
}
const selected = state2 === originalIndex;
style[2] = r11;
return <View style={style}>
<FormRadioRow style={[styles.listItem]} label={item.choice.displayName} align="right" selected={selected} onPress={() => {
setState2(item.originalIndex);
onChoiceSelect(item.choice, item.originalIndex);
ActionSheetActionCreators.hideActionSheet();
}} />
</View>;
}, [onChoiceSelect, state2, styles, state]);
const callback3 = useCallback(() => <FormDivider style={styles.divider} />, [styles.divider]);
const isWindowLarge = useIsWindowLarge();
const startExpanded = option.choices != null && option.choices?.length >= (isWindowLarge ? 10 : 5);
return <AppLauncherCommandOptionActionSheet option={option} startExpanded={startExpanded} onDismiss={onDismiss} scrollable={startExpanded}>
{startExpanded && <AppLauncherListSearchBar onChange={callback} />}
{state.length === 0 ? <AppLauncherListEmptyState /> : <FlashListWrapper scrollable={startExpanded} contentContainerStyle={{
paddingBottom
}} scrollIndicatorInsets={{
bottom: paddingBottom
}} keyExtractor={(item) => `${item.choice.name}_${item.originalIndex}`} data={state} renderItem={callback2} ItemSeparatorComponent={callback3} accessibilityRole="radiogroup" />}
</AppLauncherCommandOptionActionSheet>;
};
@@ -0,0 +1,54 @@
// Metro module 11341 (f11342).
import { useState, useCallback } from "react";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { dismissGlobalKeyboard } from "../../../../../utils/native/KeyboardManagerUtils";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { useAnimationDelayedAutoFocus } from "../../hooks/useAnimationDelayedAutoFocus";
import { FormRow, FormArrow } from "../../../../../design/void/Form/native/index";
import { Text } from "../../../../../design/components/Text/native/Text";
const useStyles = createStyles({
container: {
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH,
borderRadius: Module712.radii.lg,
alignItems: "center",
padding: 12
}
});
export default function AppLauncherChoicesOption(props) {
let state, setState;
const { style, option, initialValue, onSelect, onOpenChoicesSheet, onDismissChoicesSheet, autoFocus, hasError } = props;
state = void 0;
setState = void 0;
const styles = useStyles();
[state, setState] = useState(() => {
if (initialValue != null && initialValue.type === "text") {
const choices = option.choices;
const choice = choices == null ? void 0 : choices.find((choice) => choice.displayName === initialValue.text);
if (choice != null) {
return {
choice,
index: option.choices.indexOf(choice)
};
}
}
});
const callback = useCallback(() => {
onOpenChoicesSheet();
dismissGlobalKeyboard();
ActionSheetActionCreators.openLazy(import("./AppLauncherChoicesActionSheet"), "AppLauncherChoicesActionSheet", {
option,
initChoiceIndex: state?.index,
onChoiceSelect: (a0, a1) => {
setState({
choice: a0,
index: a1
});
onSelect(a0);
},
onDismiss: onDismissChoicesSheet
});
}, [onDismissChoicesSheet, onOpenChoicesSheet, onSelect, option, state?.index]);
useAnimationDelayedAutoFocus(autoFocus, callback);
return <FormRow start end style={[styles.container, style]} hasError={hasError} label={<Text variant={state == null ? "text-md/medium" : "text-sm/medium"} color={state == null ? "text-default" : "interactive-text-default"} lineClamp={1}>{option.displayName}</Text>} subLabel={state != null ? <Text variant="text-md/medium" color="text-default" lineClamp={1}>{state.choice.displayName}</Text> : null} trailing={<FormArrow />} onPress={callback} />;
};
@@ -0,0 +1,99 @@
// Metro module 11357 (f11358).
import { useState, useRef, useEffect } from "react";
import { RelationshipTypes } from "../../../../../Constants";
import { getApplicationCommandOptionQueryOptions } from "../../../../application_commands/ApplicationCommandUtils";
import AutocompleteUtils from "../../../../../utils/AutocompleteUtils";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { AppLauncherCommandOptionActionSheet } from "../AppLauncherCommandOptionActionSheet";
import { AppLauncherListSearchBar, AppLauncherListEmptyState, AppLauncherList } from "../../base_components/AppLauncherList";
import UserRow from "../../../../main_tabs_v2/native/shared_components/user_list/UserRow";
import { Text } from "../../../../../design/components/Text/native/Text";
import { getUserTag } from "../../../../../utils/UserUtils";
import { RoleRow, RoleIcon } from "../role/AppLauncherRoleListActionSheet";
import AutocompleteUtils2 from "../../../../../utils/native/AutocompleteUtils";
import AppLauncherOptionIcon from "../../base_components/AppLauncherOptionIcon";
import { UserCircleIcon } from "../../../../../design/components/Icon/native/redesign/generated/UserCircleIcon";
import { TableRow } from "../../../../../design/components/TableRow/native/TableRow.native";
let c7714_8 = "AppLauncherMentionableListActionSheet";
let c7714_9 = {
USER: "user",
ROLE: "role",
GLOBAL: "global"
};
export default function AppLauncherMentionableListActionSheet(props) {
const { onMentionablePress, onActionSheetDismiss, channel, option } = props;
const [state, setState] = useState("");
const ref = useRef(null);
const [state2, setState2] = useState([]);
const guild_id = channel.guild_id;
const length = state2.length;
useEffect(() => {
const applicationCommandOptionQueryOptions = getApplicationCommandOptionQueryOptions(option);
const r27 = AutocompleteUtils.queryMentionResults({
query: state,
channel,
canMentionEveryone: applicationCommandOptionQueryOptions.canMentionEveryone,
canMentionHere: applicationCommandOptionQueryOptions.canMentionHere,
canMentionUsers: applicationCommandOptionQueryOptions.canMentionUsers,
canMentionRoles: applicationCommandOptionQueryOptions.canMentionRoles,
includeAllGuildUsers: applicationCommandOptionQueryOptions.canMentionAnyGuildUser,
includeNonMentionableRoles: applicationCommandOptionQueryOptions.canMentionNonMentionableRoles,
request: true,
limit: 10,
allowSnowflake: true
});
setState2([...r27.users.map((user) => ({
type: c7714_9.USER,
result: user
})), ...r27.roles.map((role) => ({
type: c7714_9.ROLE,
result: role
})), ...r27.globals.map((global) => ({
type: c7714_9.GLOBAL,
result: global
}))]);
}, [state, option, channel]);
return <AppLauncherCommandOptionActionSheet option={option} onDismiss={onActionSheetDismiss}>
<AppLauncherListSearchBar onChange={function onChange(event) {
setState(event.toLowerCase());
const current = ref.current;
if (current != null) {
current.scrollToOffset({
offset: 0,
animated: false
});
}
}} />
{length === 0 ? <AppLauncherListEmptyState /> : <AppLauncherList ref={ref} data={state2} renderItem={function renderItem({ item, index }) {
const props = {
onPress: () => {
onMentionablePress({
mentionable: item
});
ActionSheetActionCreators.hideActionSheet(c7714_8);
onActionSheetDismiss();
},
start: index === 0,
end: index === state2.length - 1
};
const type = item.type;
if (c7714_9.USER === type) {
const result3 = item.result;
const user = result3.user;
return <UserRow key={user.id} type={RelationshipTypes.NONE} user={user} nickname={result3.nick} guildId={guild_id} subLabel={<Text color="text-subtle" variant="text-xs/normal">
{getUserTag(user)}
</Text>} {...props} />;
}
if (c7714_9.ROLE === type) {
const result2 = item.result;
return <RoleRow key={result2.id} guildRole={result2} guildId={guild_id} {...props} />;
}
if (c7714_9.GLOBAL === type) {
const result = item.result;
return <TableRow key={result.text} label={<Text lineClamp={1} variant="text-md/semibold" color="mobile-text-heading-primary">{result.text}</Text>} icon={result.text === AutocompleteUtils2.MENTION_EVERYONE().text ? <RoleIcon /> : <AppLauncherOptionIcon icon={<UserCircleIcon size="sm" color="interactive-text-default" />} />} {...props} />;
}
}} />}
</AppLauncherCommandOptionActionSheet>;
};
export const APP_LAUNCHER_MENTIONABLE_LIST_ACTION_SHEET_KEY = "AppLauncherMentionableListActionSheet";
export { c7714_9 as MentionableItemTypes };
@@ -0,0 +1,122 @@
// Metro module 11355 (f11356).
import { useState, useEffect, useMemo } from "react";
import AccessibilityStore from "../../../../a11y/AccessibilityStore";
import GuildRoleStore from "../../../../../stores/GuildRoleStore";
import UserStore from "../../../../../stores/UserStore";
import { StatusTypes } from "../../../../../_bundle/Module505";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import AppLauncherOptionIcon from "../../base_components/AppLauncherOptionIcon";
import { UserCircleIcon } from "../../../../../design/components/Icon/native/redesign/generated/UserCircleIcon";
import { MentionableItemTypes, APP_LAUNCHER_MENTIONABLE_LIST_ACTION_SHEET_KEY } from "./AppLauncherMentionableListActionSheet";
import { Avatar, AvatarSizes } from "../../../../../design/void/native";
import { RoleIcon } from "../role/AppLauncherRoleListActionSheet";
import UsernameText from "../../base_components/UsernameText";
import AppLauncherSelectOptionFormRow from "../../base_components/AppLauncherSelectOptionFormRow";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
let useStyles;
const MentionableIcon = function MentionableIcon(props) {
const { mentionable, guildId } = props;
const styles = useStyles();
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
const r28 = <AppLauncherOptionIcon icon={<UserCircleIcon size="sm" color="interactive-text-default" />} wrapperStyle={styles.iconWrapper} />;
if (mentionable == null) {
return r28;
}
const type = mentionable.type;
if (MentionableItemTypes.USER === type) {
return <Avatar user={mentionable.result.user} guildId={guildId} animate={!stateFromStores} size={AvatarSizes.REFRESH_MEDIUM_32} />;
}
if (MentionableItemTypes.ROLE === type) {
return <RoleIcon role={mentionable.result} />;
}
MentionableItemTypes.GLOBAL;
return r28;
};
useStyles = createStyles({
iconWrapper: {
backgroundColor: Module712.colors.BACKGROUND_MOD_SUBTLE
}
});
export default function AppLauncherMentionableOption(props) {
let state, setState;
const { style, option, initialValue, onMentionablePress: onMentionablePress2, onActionSheetDismiss, channel, autoFocus, hasError, onPress: onPress2 } = props;
state = void 0;
setState = void 0;
const guild_id = channel.guild_id;
[state, setState] = useState(() => {
if (initialValue != null) {
if (initialValue.type === "roleMention") {
const role = GuildRoleStore.getRole(guild_id, initialValue.roleId);
if (role != null) {
return {
type: MentionableItemTypes.ROLE,
result: role
};
}
} else if (initialValue.type === "userMention") {
const user = UserStore.getUser(initialValue.userId);
if (user != null) {
return {
type: MentionableItemTypes.USER,
result: {
user,
score: 0,
status: StatusTypes.UNKNOWN,
nick: ""
}
};
}
} else if (initialValue.type === "textMention") {
return {
type: MentionableItemTypes.GLOBAL,
result: {
text: initialValue.text,
test: initialValue.text,
description: ""
}
};
}
}
return null;
});
useEffect(() => {
if (initialValue != null && state == null) {
onMentionablePress2({
mentionable: null
});
}
}, [onMentionablePress2, option.name, initialValue, state]);
const memo = useMemo(() => {
if (state == null) {
return null;
}
const type = state.type;
if (MentionableItemTypes.USER === type) {
return <UsernameText guildId={guild_id} user={state.result.user} />;
}
if (MentionableItemTypes.ROLE === type) {
return state.result.name;
}
if (MentionableItemTypes.GLOBAL === type) {
return state.result.text;
}
}, [state, guild_id]);
return <AppLauncherSelectOptionFormRow style={style} option={option} hasError={hasError} selected={state != null} selectedItemName={state != null ? memo : void 0} leading={<MentionableIcon mentionable={state} guildId={guild_id} />} onPress={function onPress() {
if (onPress2 != null) {
onPress2();
}
ActionSheetActionCreators.openLazy(import("./AppLauncherMentionableListActionSheet"), APP_LAUNCHER_MENTIONABLE_LIST_ACTION_SHEET_KEY, {
option,
channel,
onMentionablePress: ({ mentionable }) => {
setState(mentionable);
onMentionablePress2({
mentionable
});
},
onActionSheetDismiss
});
}} autoFocus={autoFocus} />;
};
@@ -0,0 +1,75 @@
// Metro module 11358 (f11359).
import { useEffect, useState, useRef, useMemo } from "react";
import GuildRoleMemberCountStore from "../../../../guild_settings/GuildRoleMemberCountStore";
import { isEveryoneRole } from "../../../../../records/GuildRoleRecord";
import GuildRoleStore from "../../../../../stores/GuildRoleStore";
import { DEFAULT_ROLE_COLOR_HEX } from "../../../../../Constants";
import AppLauncherOptionIcon from "../../base_components/AppLauncherOptionIcon";
import { ShieldUserIcon } from "../../../../../design/components/Icon/native/redesign/generated/ShieldUserIcon";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import { fetchMemberCounts } from "../../../../guild_settings/GuildRoleMemberActionCreators";
import { TableRow } from "../../../../../design/components/TableRow/native/TableRow.native";
import { Text } from "../../../../../design/components/Text/native/Text";
import { GroupIcon } from "../../../../../design/components/Icon/native/redesign/generated/GroupIcon";
import fuzzysearch from "../../../../../_bundle/fuzzysearch";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { AppLauncherCommandOptionActionSheet } from "../AppLauncherCommandOptionActionSheet";
import { AppLauncherListSearchBar, AppLauncherListEmptyState, AppLauncherList } from "../../base_components/AppLauncherList";
let c7715_12, RoleRow;
const RoleIcon = function RoleIcon(props) {
const role = props.role;
return <AppLauncherOptionIcon icon={<ShieldUserIcon size="sm" color={role != null ? "white" : "interactive-text-default"} />} wrapperStyle={role != null ? {
backgroundColor: role.colorString != null ? role.colorString : DEFAULT_ROLE_COLOR_HEX
} : {}} />;
};
RoleRow = function RoleRow(props) {
const { guildRole, guildId, ...props2 } = props;
const stateFromStores2 = useStateFromStores([GuildRoleMemberCountStore], () => {
const roleMemberCount = GuildRoleMemberCountStore.getRoleMemberCount(guildId);
return roleMemberCount == null ? void 0 : roleMemberCount[guildRole.id];
});
const isEveryoneRole2 = isEveryoneRole(guildRole);
useEffect(() => {
fetchMemberCounts(guildId);
}, [guildId]);
return <TableRow key={guildRole.id} label={<Text lineClamp={1} variant="text-md/semibold" color="mobile-text-heading-primary">{guildRole.name}</Text>} icon={<RoleIcon role={guildRole} />} trailing={isEveryoneRole2 ? null : stateFromStores2 == null ? null : <Text variant="text-sm/normal" color="text-muted">
<GroupIcon size="xxs" color="text-muted" />
{" "}
{stateFromStores2}
</Text>} {...props2} />;
};
c7715_12 = "AppLauncherRoleListActionSheet";
export default function AppLauncherRoleListActionSheet(props) {
let memo;
const { onRolePress, onActionSheetDismiss, channel, option } = props;
memo = void 0;
const guild_id = channel.guild_id;
const [state, setState] = useState("");
const ref = useRef(null);
const stateFromStores = useStateFromStores([GuildRoleStore], () => GuildRoleStore.getSortedRoles(guild_id));
memo = useMemo(() => stateFromStores.filter((stateFromStore) => state === stateFromStore.id || fuzzysearch(state.trim(), stateFromStore.name.toLowerCase())), [stateFromStores, state]);
return <AppLauncherCommandOptionActionSheet option={option} onDismiss={onActionSheetDismiss}>
<AppLauncherListSearchBar onChange={function onChange(event) {
setState(event.toLowerCase());
const current = ref.current;
if (current != null) {
current.scrollToOffset({
offset: 0,
animated: false
});
}
}} />
{memo.length === 0 ? <AppLauncherListEmptyState /> : <AppLauncherList ref={ref} data={memo} renderItem={function renderItem({ item, index }) {
return <RoleRow guildId={guild_id} guildRole={item} onPress={() => {
onRolePress({
role: item
});
ActionSheetActionCreators.hideActionSheet(c7715_12);
onActionSheetDismiss();
}} start={index === 0} end={index === memo.length - 1} />;
}} />}
</AppLauncherCommandOptionActionSheet>;
};
export const APP_LAUNCHER_ROLE_LIST_ACTION_SHEET_KEY = "AppLauncherRoleListActionSheet";
export { RoleIcon };
export { RoleRow };
@@ -0,0 +1,44 @@
// Metro module 11360 (f11361).
import { useState, useEffect } from "react";
import GuildRoleStore from "../../../../../stores/GuildRoleStore";
import { useStateFromStores } from "../../../../../_bundle/defaultAreStatesEqual";
import AppLauncherSelectOptionFormRow from "../../base_components/AppLauncherSelectOptionFormRow";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { APP_LAUNCHER_ROLE_LIST_ACTION_SHEET_KEY, RoleIcon } from "./AppLauncherRoleListActionSheet";
export default function AppLauncherRoleOption(props) {
let state, setState, stateFromStores;
const { style, option, initialValue, onRolePress: onRolePress2, onActionSheetDismiss, channel, autoFocus, hasError, onPress: onPress2 } = props;
state = void 0;
setState = void 0;
stateFromStores = void 0;
const guild_id = channel.guild_id;
[state, setState] = useState(() => initialValue != null ? initialValue.type === "roleMention" ? initialValue.roleId : null : null);
stateFromStores = useStateFromStores([GuildRoleStore], () => {
if (state != null) {
return guild_id != null ? GuildRoleStore.getRole(guild_id, state) : void 0;
}
});
useEffect(() => {
if (state != null && stateFromStores == null) {
onRolePress2({
role: null
});
}
}, [onRolePress2, option.name, stateFromStores, state]);
return <AppLauncherSelectOptionFormRow style={style} option={option} hasError={hasError} selected={stateFromStores != null} selectedItemName={stateFromStores != null ? stateFromStores.name : void 0} onPress={function onPress() {
if (onPress2 != null) {
onPress2();
}
ActionSheetActionCreators.openLazy(import("./AppLauncherRoleListActionSheet"), APP_LAUNCHER_ROLE_LIST_ACTION_SHEET_KEY, {
option,
channel,
onRolePress: ({ role }) => {
setState(role.id);
onRolePress2({
role
});
},
onActionSheetDismiss
});
}} leading={<RoleIcon role={stateFromStores} />} autoFocus={autoFocus} />;
};
@@ -0,0 +1,157 @@
// Metro module 11349 (f11350).
import { useState, useRef, useCallback, useEffect } from "react";
import { View } from "react-native";
import { EmojiIntention } from "../../../../emojis/EmojiConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { useAppLauncherContext } from "../../AppLauncherContext";
import { ApplicationCommandOptionType } from "../../../../../flow/Server";
import { maybeFetchTopEmojisByGuild } from "../../../../emojis/top_emojis/TopEmojisUtils";
import { useAnimationDelayedAutoFocus } from "../../hooks/useAnimationDelayedAutoFocus";
import { AppLauncherEntrypoint } from "../../../AppLauncherTypes";
import { TextInput } from "../../../../../design/void/native";
import BottomSheetTextInput from "../../../../action_sheet/native/components/BottomSheetTextInput";
import { isAndroid } from "../../../../../utils/PlatformUtils";
import ChatInputExpressionButton from "../../../../chat_input/native/accessories/ChatInputExpressionButton";
import { dismissGlobalKeyboard } from "../../../../../utils/native/KeyboardManagerUtils";
import { openEmojiPickerActionSheet } from "../../../../emoji_picker/native/openEmojiPickerActionSheet";
const useStyles = createStyles({
container: {
width: "100%",
backgroundColor: Module712.colors.INPUT_BACKGROUND_DEFAULT,
borderRadius: Module712.radii.lg,
padding: 14,
borderWidth: 2,
borderColor: "transparent",
flexDirection: "row",
alignItems: "center"
},
hasError: {
borderColor: Module712.colors.BORDER_FEEDBACK_CRITICAL
},
stringOptionInput: {
maxHeight: 100,
flex: 1,
padding: 0,
paddingTop: 0
},
expressionButton: {
marginVertical: -8,
marginRight: -8
}
});
export default function AppLauncherTextInputOption(props) {
let state, setState, ref, ref2, c18768_7, callback, callback2, callback3;
const { option, onChangeText, onFocus, onEndEditing, guildId, style, autoFocus, initialValue } = props;
let hasError = props.hasError;
const onPressIn = props.onPressIn;
state = void 0;
setState = void 0;
ref = void 0;
ref2 = void 0;
c18768_7 = void 0;
callback = void 0;
callback2 = void 0;
callback3 = void 0;
const styles = useStyles();
[state, setState] = useState(() => initialValue != null ? initialValue.type === "text" ? initialValue.text : "" : "");
const entrypoint = useAppLauncherContext().entrypoint;
ref = useRef({
start: 0,
end: 0
});
ref2 = useRef(null);
let r45 = option.type === ApplicationCommandOptionType.STRING;
c18768_7 = r45;
callback = useCallback((a0) => {
setState(a0);
onChangeText(a0);
}, [onChangeText]);
callback2 = useCallback((a0) => {
let length;
const r7 = state.substring(0, ref.current.start);
let end = ref.current.end;
if (end == null) {
end = ref.current.start;
}
const r10 = state.substring(end);
ref.current.start;
if (a0.id == null && a0.surrogates != null) {
callback(r7 + a0.surrogates + r10);
length = (r7 + a0.surrogates).length;
} else {
const r11 = a0.uniqueName != null && a0.uniqueName !== "" ? a0.uniqueName : a0.name;
callback(r7 + `:${r11}: ` + r10);
length = (r7 + `:${r11}: `).length;
}
ref.current = {
start: length,
end: length
};
const current = ref2.current;
if (current != null) {
current.focus();
}
}, [callback, state]);
callback3 = useCallback(() => {
const current = ref2.current;
if (current != null) {
current.focus();
}
}, []);
useEffect(() => {
if (c18768_7) {
maybeFetchTopEmojisByGuild(guildId);
}
}, [guildId, r45]);
useAnimationDelayedAutoFocus(autoFocus, () => {
const current = ref2.current;
if (current != null) {
current.focus();
}
});
const Component = entrypoint === AppLauncherEntrypoint.VOICE ? TextInput : BottomSheetTextInput;
const style2 = [styles.container, , ,];
if (hasError) {
hasError = styles.hasError;
}
style2[1] = hasError;
style2[2] = style;
const r81 = {
ref: ref2,
autoFocus: false,
value: state,
style: styles.stringOptionInput,
maxLength: option.type === ApplicationCommandOptionType.STRING ? option.maxLength : void 0,
autoComplete: "off",
onChangeText: callback,
onSelectionChange: (a0) => {
ref.current = a0.nativeEvent.selection;
},
onFocus,
onEndEditing,
textAlignVertical: "center",
returnKeyType: "done",
multiline: true,
keyboardType: null,
onPressIn: null
};
r81.keyboardType = option.type !== ApplicationCommandOptionType.INTEGER ? option.type === ApplicationCommandOptionType.NUMBER ? isAndroid() ? "numeric" : "numbers-and-punctuation" : "default" : isAndroid() ? "numeric" : "numbers-and-punctuation";
r81.onPressIn = onPressIn;
const r106 = [<Component {...r81} />, ,];
if (r45) {
r45 = <ChatInputExpressionButton style={styles.expressionButton} onPress={() => {
dismissGlobalKeyboard();
openEmojiPickerActionSheet({
pickerIntention: EmojiIntention.CHAT,
autoFocus: false,
startExpanded: false,
onPressEmoji: callback2,
guildId,
onClose: callback3
});
}} />;
}
r106[1] = r45;
return <View style={style2}>{r106}</View>;
};
@@ -0,0 +1,57 @@
// Metro module 11362 (f11363).
import { useCallback } from "react";
import { DEFAULT_CONTENT_PADDING } from "../../AppLauncherNativeConstants";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { isSnowflake } from "../../../../application_commands/ApplicationCommandUtils";
import { EmptyState } from "../../../../../design/void/native";
import Module11345 from "../../../../../_bundle/Module11345";
import { intl, t } from "../../../../../intl/index.native";
import { AppLauncherCommandOptionActionSheet } from "../AppLauncherCommandOptionActionSheet";
import PrivateChannelUserList from "../../../../main_tabs_v2/native/shared_components/user_list/PrivateChannelUserList";
import GuildChannelUserList from "../../../../main_tabs_v2/native/shared_components/user_list/GuildChannelUserList";
import { AppLauncherList } from "../../base_components/AppLauncherList";
import { TableRow } from "../../../../../design/components/TableRow/native/TableRow.native";
let c7719_5, useStyles;
const EmptyStateWithSnowflakeQuery = function EmptyStateWithSnowflakeQuery(props) {
const { query, onPressRow: onPressRow2 } = props;
return <AppLauncherList contentContainerStyle={useStyles().emptyState} data={[query]} renderItem={(info) => <TableRow label={info.item} start end onPress={onPressRow2} />} keyboardShouldPersistTaps="always" keyboardDismissMode="on-drag" />;
};
c7719_5 = "AppLauncherUserListActionSheet";
useStyles = createStyles({
emptyState: {
paddingHorizontal: DEFAULT_CONTENT_PADDING,
paddingTop: DEFAULT_CONTENT_PADDING,
flex: 1
}
});
export default function AppLauncherUserListActionSheet(props) {
let callback2;
const { onUserPress, onActionSheetDismiss, channel, option } = props;
callback2 = void 0;
const { guild_id, id } = channel;
const callback = useCallback(() => {
ActionSheetActionCreators.hideActionSheet(c7719_5);
onActionSheetDismiss();
}, [onActionSheetDismiss]);
callback2 = useCallback((a0) => {
onUserPress({
user: a0.user
});
callback();
}, [callback, onUserPress]);
const callback3 = useCallback((a0) => {
const user = a0;
return isSnowflake(a0) ? <EmptyStateWithSnowflakeQuery query={a0} onPressRow={() => callback2({
user
})} /> : <EmptyState style={{
paddingTop: 80
}} lightSource={Module11345} darkSource={Module11345} title={intl.string(t.vYocDz)} body={intl.string(t.V6nAfF)} />;
}, [callback2]);
return <AppLauncherCommandOptionActionSheet onDismiss={onActionSheetDismiss} option={option} contentContainerStyles={{
paddingHorizontal: 0
}}>
{channel.isPrivate() ? <PrivateChannelUserList channelId={id} disableStickySections hideTitle headerShown={false} inActionSheet onUserPress={callback2} opensUserProfileOnUserPress={false} /> : <GuildChannelUserList channelId={id} guildId={guild_id} searchable searchableEmptyState={callback3} headerShown={false} opensUserProfileOnUserPress={false} onUserPress={callback2} inActionSheet disableThemedGradient />}
</AppLauncherCommandOptionActionSheet>;
};
export const APP_LAUNCHER_USER_LIST_ACTION_SHEET_KEY = "AppLauncherUserListActionSheet";
@@ -0,0 +1,55 @@
// Metro module 11361 (f11362).
import { useState } from "react";
import AccessibilityStore from "../../../../a11y/AccessibilityStore";
import { createStyles } from "../../../../../design/components/Styles/native/createStyles";
import Module712 from "../../../../../_bundle/Module712";
import { useStateFromStores } from "../../../../../_bundle/Module589";
import AppLauncherSelectOptionFormRow from "../../base_components/AppLauncherSelectOptionFormRow";
import { dismissGlobalKeyboard } from "../../../../../utils/native/KeyboardManagerUtils";
import ActionSheetActionCreators from "../../../../action_sheet/native/ActionSheetActionCreators";
import { APP_LAUNCHER_USER_LIST_ACTION_SHEET_KEY } from "./AppLauncherUserListActionSheet";
import { Avatar, AvatarSizes } from "../../../../../design/void/native";
import AppLauncherOptionIcon from "../../base_components/AppLauncherOptionIcon";
import { UserCircleIcon } from "../../../../../design/components/Icon/native/redesign/generated/UserCircleIcon";
import UsernameText from "../../base_components/UsernameText";
import { Text } from "../../../../../design/components/Text/native/Text";
const useStyles = createStyles({
iconWrapper: {
backgroundColor: Module712.colors.BACKGROUND_MOD_SUBTLE
}
});
export default function AppLauncherUserOption(props) {
let setState, setState2;
const { style, option, initialValue, onUserPress: onUserPress2, onActionSheetDismiss, channel, autoFocus, hasError, onPress: onPress2 } = props;
setState = void 0;
setState2 = void 0;
const styles = useStyles();
const guild_id = channel.guild_id;
const stateFromStores = useStateFromStores([AccessibilityStore], () => AccessibilityStore.useReducedMotion);
let state;
[state, setState] = useState(() => initialValue != null ? initialValue.type === "userMention" ? initialValue.userId : null : null);
let user;
[user, setState2] = useState(null);
return <AppLauncherSelectOptionFormRow style={style} option={option} hasError={hasError} selected={user != null || state != null} onPress={function onPress() {
if (onPress2 != null) {
onPress2();
}
dismissGlobalKeyboard();
ActionSheetActionCreators.openLazy(import("./AppLauncherUserListActionSheet"), APP_LAUNCHER_USER_LIST_ACTION_SHEET_KEY, {
option,
channel,
onUserPress: ({ user }) => {
if (typeof user === "string") {
setState(user);
} else {
setState(user.id);
setState2(user);
}
onUserPress2({
user
});
},
onActionSheetDismiss
});
}} leading={user != null ? <Avatar user={user} guildId={guild_id} animate={!stateFromStores} size={AvatarSizes.REFRESH_MEDIUM_32} /> : <AppLauncherOptionIcon icon={<UserCircleIcon size="sm" color="interactive-text-default" />} wrapperStyle={styles.iconWrapper} />} selectedItemName={user != null ? <UsernameText guildId={guild_id} user={user} /> : state != null ? <Text variant="text-md/medium" color="text-default">{state}</Text> : null} autoFocus={autoFocus} />;
};