Files
2026-07-28 01:06:53 +03:00

356 lines
19 KiB
TypeScript

/* Metro module 15228; source: modules/application_commands/native/ContextMenuCommandRootScreen.tsx; dependencies: [57, 31, 27, 1867, 5066, 33, 4501, 697, 566, 8060, 7869, 8050, 5463, 7705, 8518, 1244, 4573, 15229, 6984, 8671, 2] */
import Module00057 from '../../../by-id/module-00057.js'; /* Metro dependency 57 */
import GuildStore from '../../../stores/GuildStore.tsx'; /* Metro dependency 1867 */
import UseSafeAreaInsetsKeyboardAwareNative from '../../safe_area/useSafeAreaInsetsKeyboardAware.native.tsx'; /* Metro dependency 5463 */
import UseScaledRowHeight from '../../main_tabs_v2/native/shared_components/user_list/useScaledRowHeight.tsx'; /* Metro dependency 7705 */
import ExecuteCommand from '../executeCommand.tsx'; /* Metro dependency 8050 */
import FastestListAndroid from '../../fastest_list/FastestList.android.tsx'; /* Metro dependency 8671 */
import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactNativeModule from '../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
import * as ReactModule from '../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as TextModule from '../../../design/components/Text/native/Text.tsx'; /* Metro dependency 4573 */
import * as ApplicationCommandConstantsModule from '../ApplicationCommandConstants.tsx'; /* Metro dependency 5066 */
import * as ApplicationCommandQueryApiModule from '../ApplicationCommandQueryApi.tsx'; /* Metro dependency 8060 */
import * as UseScaledTextLineHeightAndroidModule from '../../screen/native/useScaledTextLineHeight.android.tsx'; /* Metro dependency 8518 */
function _fun116484(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#116484, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:6, offset: 0x0248b271, size: 384 bytes, params: 8, frame: 22
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = ApplicationCommandConstantsModule;
const env0_8 = value.CONTEXT_MENU_COMMANDS_QUERY_LIMIT;
const env0_9 = value.BuiltInSectionId;
value = require(33) /* metro dependency 33 */;
const env0_10 = value.jsx;
const env0_11 = value.jsxs;
value = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = value.createStyles;
object = {};
let PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object.container = {flex: 1, marginHorizontal: PX_16};
const object3 = {};
PX_16 = (importDefault(697) /* metro dependency 697: native */).space.PX_16;
object3.paddingTop = PX_16;
const PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object3.paddingBottom = PX_8;
const BACKGROUND_BASE_LOWER = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_BASE_LOWER;
object3.backgroundColor = BACKGROUND_BASE_LOWER;
object.sectionHeader = object3;
const env0_12 = Reflect.apply(createStyles, value, [object]);
(FileImportTrackerModule).fileFinishedImporting('modules/application_commands/native/ContextMenuCommandRootScreen.tsx');
exports.default = ContextMenuCommandRootScreen;
function ContextMenuCommandRootScreen(a0) { // fn#116485, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:568, offset: 0x0248b3f1, size: 1323 bytes, params: 2, frame: 32
var object7;
var object;
var object4;
var SearchField;
var object5;
var intl;
const navigation = a0.navigation;
const {channel, commandType, commandTargetId, onPressAppCommand, onClose} = a0.route.params;
const onClose2 = onClose;
const value = undefined;
const guild = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], function() {
return GuildStore.getGuild(channel.guild_id);
});
const guild2 = guild;
let binding = guild2;
const env0_6 = binding.useRef(false);
const value4 = onClose2(binding.useState(''), 2);
const value5 = 0;
const property = value4[value5];
const property2 = value4[1];
const value6 = property !== '';
binding.useEffect(function() {
return navigation.addListener('beforeRemove', _fun116488);
}, [navigation, onClose]);
const useDiscovery = ApplicationCommandQueryApiModule.useDiscovery;
object7 = {context: {channel: channel, type: 'channel'}};
object7.filters = {text: value6 ? property : value, commandTypes: [commandType]};
const object6 = {};
object6.limit = CONTEXT_MENU_COMMANDS_QUERY_LIMIT;
object6.includeFrecency = !value6;
const COMMAND_OR_APPLICATION = value6 ? (require(7869) /* metro dependency 7869: ApplicationCommandQueryTypes */).ScoreMethod.COMMAND_OR_APPLICATION : value;
object6.scoreMethod = COMMAND_OR_APPLICATION;
object7.options = object6;
object7.allowFetch = true;
const {commands, commandsByActiveSection, sectionDescriptors, loading} = Reflect.apply(useDiscovery,
ApplicationCommandQueryApiModule, [object7]);
binding = guild2;
const useMemo = binding.useMemo;
const sections = Reflect.apply(useMemo, binding, [function() {
sectionDescriptors.forEach(_fun116490);
return {sections: {}};
}, [sectionDescriptors]]).sections;
const value8 = binding.useCallback(_fun116491, [channel, commandTargetId, guild, navigation, onPressAppCommand]);
const value9 = binding.useCallback(_fun116492, [commandsByActiveSection, navigation, value8]);
const value10 = binding.useMemo(_fun116494, [loading, commands.length, commandsByActiveSection]);
const frecencyItems = value10.frecencyItems;
const value11 = binding.useMemo(_fun116499, [loading, commands, value6, frecencyItems, value10.appItems]);
const insets = (UseSafeAreaInsetsKeyboardAwareNative)({includeKeyboardHeight: true}).insets;
const value12 = (UseScaledRowHeight)();
const value13 = binding.useMemo(_fun116501, [value11]);
const styles = useStyles();
const value14 = (UseScaledTextLineHeightAndroidModule).useScaledTextLineHeight('text-sm/semibold');
const value15 = binding.useCallback(_fun116503, [loading, commands.length, value6, frecencyItems.length,
styles.sectionHeader]);
const value16 = binding.useCallback(_fun116504, [value11, value8, value9, sections]);
const value17 = binding.useMemo(_fun116507, [loading, commands.length, value6, value14,
styles.sectionHeader.paddingTop, styles.sectionHeader.paddingBottom]);
let r6 = value6 || !loading && commands.length > value5;
if (r6) {
object = {};
object4 = {};
object4.marginBottom = value6 ? (importDefault(697) /* metro dependency 697: native */).space.PX_16 : value5;
object.style = object4;
SearchField = (require(6984) /* metro dependency 6984: SearchFieldNative */).SearchField;
object5 = {size: 'md', onChange: property2};
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
object5.placeholder = intl.string((require(1244) /* metro dependency 1244: indexNative */).t.m1UwbP);
r6 = (
<View {...object}>
<SearchField {...object5} />
</View>
);
}
return (
<View style={styles.container}>
{r6}
{((Component) => <Component sections={value13} estimatedListSize="windowSize" itemSize={value12} insetEnd={insets.bottom} renderItem={value16} renderSectionHeader={value15} sectionHeaderSize={value17} />)(FastestListAndroid)}
</View>
);
function _fun116487() { // fn#116487, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:855, offset: 0x0248b93c, size: 34 bytes, params: 1, frame: 13
return navigation.addListener('beforeRemove', _fun116488);
function _fun116488() { // fn#116488, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:889, offset: 0x0248b95e, size: 42 bytes, params: 1, frame: 11
if (!(env1_6.current || onClose == null)) {
onClose();
}
}
}
function _fun116489() { // fn#116489, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:1242, offset: 0x0248b988, size: 41 bytes, params: 1, frame: 12
sectionDescriptors.forEach(_fun116490);
return {sections: {}};
function _fun116490(a0) { // fn#116490, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:1274, offset: 0x0115ee18, size: 23 bytes, params: 2, frame: 3
env0_0[a0.id] = a0;
}
}
function _fun116491(a0) { // fn#116491, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:1337, offset: 0x0248b9b1, size: 147 bytes, params: 2, frame: 15
if (onPressAppCommand != null) {
onPressAppCommand();
}
env0_6.current = true;
(ExecuteCommand)({command: a0, optionValues: {},
context: {channel: channel, guild: guild}, commandTargetId: commandTargetId});
(navigation.getParent() ?? navigation).goBack();
}
function _fun116492(a0) { // fn#116492, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:1528, offset: 0x0248ba44, size: 103 bytes, params: 2, frame: 16
const env0_0 = a0;
const value2 = commandsByActiveSection.find(_fun116493);
const value3 = undefined;
const r5 = (value2 == null ? value3 : value2.data) ?? [];
const navigationBinding = navigation;
navigationBinding.navigate('app', {section: a0, commands: r5, onPressCommand: env0_13});
return value3;
function _fun116493({section}) { // fn#116493, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:1568, offset: 0x0204d7c8, size: 32 bytes, params: 2, frame: 2
return section.id === env0_0.id;
}
}
function _fun116494() { // fn#116494, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:1696, offset: 0x0248baab, size: 167 bytes, params: 1, frame: 16
var r2;
var object;
var value;
if (loading) {
object = {frecencyItems: [], appItems: []};
} else {
if (commands.length === 0) {
return {frecencyItems: [], appItems: []};
}
var value2 = commandsByActiveSection.find(function(a0) {
return a0.section.id === BuiltInSectionId.FRECENCY;
});
value = commandsByActiveSection.filter(function(a0) {
return a0.section.id !== BuiltInSectionId.FRECENCY;
});
object = {};
r2 = value2 == null ? undefined : value2.data.map(function(a0) {
return {type: 'command', command: a0};
});
r2 = r2 ?? [];
object.frecencyItems = r2;
object.appItems = value.map(function({section}) {
return {type: 'app', section: section};
});
}
return object;
}
function _fun116499() { // fn#116499, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:2077, offset: 0x0248bbc2, size: 186 bytes, params: 1, frame: 13
var object;
if (loading) {
object = {type: 'placeholder'};
object = [[object]];
} else {
var length = commands.length;
if (length === 0) {
object = {type: 'no_commands'};
object = [[object]];
return object;
}
if (result) {
return [commands.map(function(a0) {
return {type: 'command', command: a0};
})];
}
object = [];
length = frecencyItems.length;
if (length > 0) {
object.push(frecencyItems);
}
length = appItems.length;
if (length > 0) {
object.push(appItems);
}
}
return object;
}
function _fun116501() { // fn#116501, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:2368, offset: 0x0248bc7c, size: 28 bytes, params: 1, frame: 11
return env0_17.map(function(a0) {
return a0.length;
});
}
function _fun116503(a0) { // fn#116503, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:2481, offset: 0x0248bc98, size: 269 bytes, params: 2, frame: 17
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
if (loading) {
return null;
}
if (commands.length === 0) {
return null;
}
if (result) {
return null;
}
const r4 = a0 !== 0 ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.PHjkRE) : frecencyItems.length > 0 ? intl.string((require(1244) /* metro dependency 1244: indexNative */).t.V0w2ap) : intl.string((require(1244) /* metro dependency 1244: indexNative */).t.PHjkRE);
const Text = (TextModule).Text;
return (
<Text
variant={env0_19}
color="text-default"
style={styles.sectionHeader}
>
{r4}
</Text>
);
}
function _fun116504(a0, a1) { // fn#116504, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:2773, offset: 0x0248bda5, size: 405 bytes, params: 3, frame: 22
var environment;
var ContextMenuCommandAppItem;
var object;
var section;
var value4;
var ContextMenuCommandItem;
var command;
var sectionsBinding;
const property = env0_17[a0][a1];
const value2 = a1 === 0;
const value3 = a1 === env0_17[a0].length - 1;
const type = property.type;
if (type === 'placeholder') {
value = environment.__proto__;
const ContextMenuCommandLoadingItem = (require(15229) /* metro dependency 15229: ContextMenuCommandItem */).ContextMenuCommandLoadingItem;
return (
<ContextMenuCommandLoadingItem
start={value2}
end={value3}
key="placeholder"
/>
);
}
if (type === 'no_commands') {
value = environment.__proto__;
const ContextMenuCommandEmptyItem = (require(15229) /* metro dependency 15229: ContextMenuCommandItem */).ContextMenuCommandEmptyItem;
return (
<ContextMenuCommandEmptyItem
start={value2}
end={value3}
key="no_commands"
/>
);
}
if (type === 'command') {
value4 = environment.__proto__;
ContextMenuCommandItem = importDefault(15229) /* metro dependency 15229: ContextMenuCommandItem */;
object = {};
command = property.command;
object.item = command;
object.onPress = onPress_116505;
sectionsBinding = sections;
command = property.command;
object.section = sectionsBinding[command.applicationId];
object.start = value2;
object.end = value3;
command = property.command;
return <ContextMenuCommandItem {...object} key={command.id} />;
}
if (type === 'app') {
value = environment.__proto__;
ContextMenuCommandAppItem = (require(15229) /* metro dependency 15229: ContextMenuCommandItem */).ContextMenuCommandAppItem;
object = {};
section = property.section;
object.section = section;
object.onPress = onPress_116506;
object.start = value2;
object.end = value3;
section = property.section;
return <ContextMenuCommandAppItem {...object} key={section.id} />;
}
function onPress_116505() { // fn#116505, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:3086, offset: 0x0248bf3a, size: 29 bytes, params: 1, frame: 11
return env1_13(env0_0.command);
}
function onPress_116506() { // fn#116506, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:3248, offset: 0x0248bf57, size: 29 bytes, params: 1, frame: 11
return env1_14(env0_0.section);
}
}
function _fun116507() { // fn#116507, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15425:3321, offset: 0x0248bf74, size: 84 bytes, params: 1, frame: 4
var r0;
var binding;
var sectionHeader;
var value3;
const loadingBinding = loading;
const value2 = 0;
if (loadingBinding) {
r0 = value2;
} else if (value2 === commands.length) {
r0 = value2;
} else if (result) {
r0 = value2;
} else {
binding = env0_20;
sectionHeader = styles.sectionHeader;
value3 = binding + sectionHeader.paddingTop;
sectionHeader = styles.sectionHeader;
r0 = value3 + sectionHeader.paddingBottom;
}
return r0;
}
}
}
global.__d(_fun116484, 15228, [57, 31, 27, 1867, 5066, 33, 4501, 697, 566, 8060, 7869, 8050, 5463, 7705, 8518, 1244,
4573, 15229, 6984, 8671,
2]) /* metro module 15228, dependencies: [57, 31, 27, 1867, 5066, 33, 4501, 697, 566, 8060, 7869, 8050, 5463, 7705, 8518, 1244, 4573, 15229, 6984, 8671, 2] */;