/* Metro module 11592; source: modules/app_launcher/native/AppLauncherNativeUtils.tsx; dependencies: [31, 1379, 1878, 1483, 661, 5066, 4863, 5068, 11593, 5065, 1909, 7166, 1860, 8046, 1423, 8774, 8620, 11598, 6777, 8092, 4081, 2] */ function _fun88751(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#88751, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11778:6, offset: 0x01ff04d6, size: 311 bytes, params: 8, frame: 20 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_4 = importAll(31) /* metro dependency 31 */; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const userStore = importDefault(1878) /* metro dependency 1878: UserStore */; const appLauncherNativeConstantsModule = require(1483) /* metro dependency 1483: AppLauncherNativeConstants */; const env0_7 = appLauncherNativeConstantsModule.APP_LAUNCHER_BUILT_IN_SECTION_ICON; const env0_8 = appLauncherNativeConstantsModule.AppLauncherRouteName; const env0_9 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents; const env0_10 = (require(5066) /* metro dependency 5066: ApplicationCommandConstants */).BuiltInSectionId; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/app_launcher/native/AppLauncherNativeUtils.tsx'); exports.handleApplicationSelected = handleApplicationSelected; exports.handleViewAllSelected = handleViewAllSelected; exports.handleApplicationCommandSelected = handleApplicationCommandSelected; exports.getInitialOptionValues = getInitialOptionValues; exports.getAppLauncherIconSource = getAppLauncherIconSource; exports.useLogAppLauncherEmptyStateView = useLogAppLauncherEmptyStateView; exports.useHandleActivityItemSelected = useHandleActivityItemSelected; } function handleApplicationSelected({location, application, navigation, context, sectionName, installOnDemand, query, searchResultsPosition, navigates, entrypoint}) { // fn#88752, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11778:369, offset: 0x01ff060d, size: 302 bytes, params: 2, frame: 28 const ApplicationCommandTriggerSections = (require(5068) /* metro dependency 5068: ApplicationCommandTypes */).ApplicationCommandTriggerSections; navigates = navigates === undefined || navigates; const appAnalyticsUtilsModule = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; const trackWithMetadata = appAnalyticsUtilsModule.trackWithMetadata; const APPLICATION_COMMAND_SECTION_SELECTED = AnalyticEvents.APPLICATION_COMMAND_SECTION_SELECTED; const id = application.id; const BUILT_IN = BuiltInSectionId.BUILT_IN; Reflect.apply(trackWithMetadata, appAnalyticsUtilsModule, [APPLICATION_COMMAND_SECTION_SELECTED, {location: location, section: id === BUILT_IN ? ApplicationCommandTriggerSections.BUILT_IN : ApplicationCommandTriggerSections.APP, application_id: application.id ?? null, section_name: sectionName, query: query, search_results_position: searchResultsPosition, source: entrypoint}]); if (navigates) { navigation.navigate(AppLauncherRouteName.APPLICATION_VIEW, {application: application, context: context, installOnDemand: installOnDemand, sectionName: sectionName, entrypoint: entrypoint}); } } function handleViewAllSelected({location, navigation, context, sectionName, sectionOverallPosition, applications, sectionItemType, commands, sectionDescriptors, title, promotedApplicationIds}) { // fn#88753, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11778:980, offset: 0x01ff073b, size: 239 bytes, params: 2, frame: 29 const appAnalyticsUtilsModule = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; const trackWithMetadata = appAnalyticsUtilsModule.trackWithMetadata; const APP_LAUNCHER_SECTION_VIEW_MORE = AnalyticEvents.APP_LAUNCHER_SECTION_VIEW_MORE; const object2 = {section_name: sectionName}; const SectionItemType = (require(11593) /* metro dependency 11593: FrecencySection */).SectionItemType; const APPS = SectionItemType.APPS; object2.num = sectionItemType === APPS ? applications.length : commands.length; Reflect.apply(trackWithMetadata, appAnalyticsUtilsModule, [APP_LAUNCHER_SECTION_VIEW_MORE, object2]); const navigate = navigation.navigate; const APP_LIST_VIEW = AppLauncherRouteName.APP_LIST_VIEW; Reflect.apply(navigate, navigation, [APP_LIST_VIEW, {analyticsLocation: location, context: context, sectionName: sectionName, sectionOverallPosition: sectionOverallPosition, applications: applications, sectionItemType: sectionItemType, commands: commands, sectionDescriptors: sectionDescriptors, title: title, promotedApplicationIds: promotedApplicationIds}]); } function handleApplicationCommandSelected({location, context, command, section, sectionDescriptors, query, navigation, installOnDemand, sectionName, searchResultsPosition, entrypoint, onCommandExecuted}) { // fn#88754, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11778:1550, offset: 0x01ff082a, size: 439 bytes, params: 2, frame: 31 var r13; var navigate; const applicationCommandUtilsModule = require(5065) /* metro dependency 5065: ApplicationCommandUtils */; const trackCommandSelected = applicationCommandUtilsModule.trackCommandSelected; const object2 = {command: command, location: location}; object2.triggerSection = applicationCommandUtilsModule.getCommandTriggerSection(section); object2.queryLength = query.length; object2.sectionName = sectionName; object2.query = query; object2.searchResultsPosition = searchResultsPosition; object2.source = entrypoint; Reflect.apply(trackCommandSelected, applicationCommandUtilsModule, [object2]); const type = command.type; const ApplicationCommandType = (require(1909) /* metro dependency 1909: Server */).ApplicationCommandType; const PRIMARY_ENTRY_POINT = ApplicationCommandType.PRIMARY_ENTRY_POINT; if (type === PRIMARY_ENTRY_POINT) { navigation.navigate(AppLauncherRouteName.APPLICATION_VIEW, {application: section.application, context: context, installOnDemand: installOnDemand, sectionName: sectionName, entrypoint: entrypoint}); } else { var id = section.id; var FRECENCY = BuiltInSectionId.FRECENCY; r13 = id !== FRECENCY ? section : sectionDescriptors.find(function({id}) { return id === command.applicationId; }) ?? section; if (context.type !== 'channel') { return undefined; } var moduleValue3 = importAll(7166) /* metro dependency 7166: ApplicationCommandActionCreators */; var setAppLauncherActiveCommand = moduleValue3.setAppLauncherActiveCommand; id = context.channel.id; Reflect.apply(setAppLauncherActiveCommand, moduleValue3, [id, command]); navigate = navigation.navigate; var COMMAND_VIEW = AppLauncherRouteName.COMMAND_VIEW; Reflect.apply(navigate, navigation, [COMMAND_VIEW, {command: command, section: r13, context: context, installOnDemand: installOnDemand, sectionName: sectionName, analyticsLocation: location, onCommandExecuted: onCommandExecuted}]); } } function getInitialOptionValues({option, prefilledValues, guildId, roles}) { // fn#88756, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11778:2449, offset: 0x01ff09fb, size: 1142 bytes, params: 2, frame: 20 var items; var items2; var items3; var object2; var choices; const r1 = prefilledValues?.find(_fun88757); const type = option.type; const ApplicationCommandOptionType = (require(1909) /* metro dependency 1909: Server */).ApplicationCommandOptionType; const BOOLEAN = ApplicationCommandOptionType.BOOLEAN; if (BOOLEAN === type) { if (r1 != null) { object2 = {type: 'text'}; object2.text = global.String(global.Boolean(r1.value)); items3 = [object2]; } else { items3 = [{'type': 'text', 'text': 'false'}]; } return items3; } const STRING = ApplicationCommandOptionType.STRING; if (STRING === type) { if (r1 == null) { return [{'type': 'text', 'text': ''}]; } choices = option.choices; if (choices == null) { object2 = {type: 'text'}; object2.text = global.String(r1.value); return [object2]; } choices = option.choices; if (choices.some(_fun88758)) { choices = option.choices; return [{type: 'text', text: choices.find(_fun88759).displayName}]; } } else { var INTEGER = ApplicationCommandOptionType.INTEGER; if (INTEGER === type) { if (r1 == null) { return [{'type': 'text', 'text': ''}]; } choices = option.choices; if (choices == null) { object2 = {type: 'text'}; object2.text = global.String(r1.value); return [object2]; } choices = option.choices; if (choices.some(_fun88758)) { choices = option.choices; return [{type: 'text', text: choices.find(_fun88759).displayName}]; } return [{'type': 'text', 'text': ''}]; } var NUMBER = ApplicationCommandOptionType.NUMBER; if (NUMBER === type) { if (r1 == null) { return [{'type': 'text', 'text': ''}]; } choices = option.choices; if (choices == null) { object2 = {type: 'text'}; object2.text = global.String(r1.value); return [object2]; } choices = option.choices; if (choices.some(_fun88758)) { choices = option.choices; return [{type: 'text', text: choices.find(_fun88759).displayName}]; } return [{'type': 'text', 'text': ''}]; } var CHANNEL = ApplicationCommandOptionType.CHANNEL; if (CHANNEL === type) { if (r1 == null) { items2 = [{'type': 'text', 'text': ''}]; } else if (ChannelStore.getChannel(global.String(r1.value)) != null) { object2 = {type: 'channelMention'}; object2.channelId = global.String(r1.value); items2 = [object2]; } else { items2 = [{'type': 'text', 'text': ''}]; } return items2; } var USER = ApplicationCommandOptionType.USER; if (USER === type) { if (r1 == null) { items = [{'type': 'text', 'text': ''}]; } else if (UserStore.getUser(global.String(r1.value)) != null) { object2 = {type: 'userMention'}; object2.userId = global.String(r1.value); items = [object2]; } else { items = [{'type': 'text', 'text': ''}]; } return items; } var ROLE = ApplicationCommandOptionType.ROLE; if (ROLE === type) { return r1 == null || typeof r1.value !== 'string' ? [{'type': 'text', 'text': ''}] : r1.value in roles ? [{type: 'roleMention', roleId: r1.value}] : [{'type': 'text', 'text': ''}]; } var MENTIONABLE = ApplicationCommandOptionType.MENTIONABLE; if (MENTIONABLE === type) { if (r1 == null) { return [{'type': 'text', 'text': ''}]; } if (r1.value === guildId) { return [{'type': 'textMention', 'text': '@everyone'}]; } if (typeof r1.value !== 'string') { if (UserStore.getUser(global.String(r1.value)) != null) { object2 = {type: 'userMention'}; object2.userId = global.String(r1.value); return [object2]; } return [{'type': 'text', 'text': ''}]; } if (r1.value in roles) { return [{type: 'roleMention', roleId: r1.value}]; } if (UserStore.getUser(global.String(r1.value)) != null) { object2 = {type: 'userMention'}; object2.userId = global.String(r1.value); return [object2]; } return [{'type': 'text', 'text': ''}]; } } return [{'type': 'text', 'text': ''}]; } function getAppLauncherIconSource(a0) { // fn#88760, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11778:4008, offset: 0x01ff0eba, size: 166 bytes, params: 2, frame: 15 var r0; var isRealApplication2; var defaultImport; if (a0 == null) { r0 = importDefault(1860) /* metro dependency 1860 */; } else { isRealApplication2 = (require(8046) /* metro dependency 8046: AppLauncherUtils */).isRealApplication(a0); defaultImport = importDefault(1423) /* metro dependency 1423: AvatarUtils */; r0 = isRealApplication2 ? defaultImport.getApplicationIconSource({id: a0.id, icon: a0.icon, bot: a0.bot, botIconFirst: false}) : defaultImport.makeSource(APP_LAUNCHER_BUILT_IN_SECTION_ICON); } return r0; } function useLogAppLauncherEmptyStateView(a0, a1) { // fn#88761, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11778:4198, offset: 0x01ff0f60, size: 97 bytes, params: 3, frame: 16 const env0_0 = a0; const appLauncherContextModule = require(8774) /* metro dependency 8774: AppLauncherContext */; const useAppLauncherContext = appLauncherContextModule.useAppLauncherContext; env0_4.useEffect(_fun88762, [a0, a1, Reflect.apply(useAppLauncherContext, appLauncherContextModule, []).entrypoint]); } function useHandleActivityItemSelected({applicationId, context, sectionName, onActivityItemSelected, location, entrypoint, launchingComponentId, fetchesApplication}) { // fn#88763, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11778:4449, offset: 0x01ff1013, size: 392 bytes, params: 2, frame: 26 var object2; fetchesApplication = fetchesApplication === undefined || fetchesApplication; const value4 = (require(8620) /* metro dependency 8620: analytics */).useAnalyticsContext(); const env0_4 = (require(11598) /* metro dependency 11598: useActivityShelfItem */).useActivityAction({context: context, applicationId: applicationId, fetchesApplication: fetchesApplication}); const value5 = (require(6777) /* metro dependency 6777: useGetOrFetchApplications */).useGetOrFetchApplication(applicationId, fetchesApplication); const appLauncherContextModule = require(8774) /* metro dependency 8774: AppLauncherContext */; const useAppLauncherContext = appLauncherContextModule.useAppLauncherContext; const entrypointParams = Reflect.apply(useAppLauncherContext, appLauncherContextModule, []).entrypointParams; const useActivityShelfItemModule = require(11598) /* metro dependency 11598: useActivityShelfItem */; const useOnActivityItemSelected = useActivityShelfItemModule.useOnActivityItemSelected; object2 = {application: value5, context: context}; object2.embeddedActivitiesManager = importDefault(8092) /* metro dependency 8092: EmbeddedActivitiesNativeManager */; object2.locationObject = value4.location; object2.onActivityItemSelectedProp = onActivityItemSelectedProp; object2.launchingComponentId = launchingComponentId; const CommandOrigin = (require(5068) /* metro dependency 5068: ApplicationCommandTypes */).CommandOrigin; const APPLICATION_LAUNCHER = CommandOrigin.APPLICATION_LAUNCHER; object2.commandOrigin = APPLICATION_LAUNCHER; object2.sectionName = sectionName; object2.source = entrypoint; object2.fetchesApplication = fetchesApplication; object2.customId = entrypointParams?.customId; object2.referrerId = entrypointParams?.referrerId; const env0_5 = Reflect.apply(useOnActivityItemSelected, useActivityShelfItemModule, [object2]); return {handleActivityItemSelected: handleActivityItemSelected}; } function _fun88757(a0) { // fn#88757, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11778:2529, offset: 0x01ff0e71, size: 47 bytes, params: 2, frame: 4 return a0.name === option.name && a0.type === option.type; } function _fun88762() { // fn#88762, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11778:4307, offset: 0x01ff0fc1, size: 82 bytes, params: 1, frame: 15 var value2; var moduleValue; if (env0_0 != null) { value2 = environment.__proto__; moduleValue = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; moduleValue.trackWithMetadata(AnalyticEvents.APP_LAUNCHER_EMPTY_STATE_ENCOUNTERED, {type: env0_0, source: entrypoint}); } } function onActivityItemSelectedProp({applicationId}) { // fn#88764, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11778:4986, owner: useHandleActivityItemSelected.onActivityItemSelectedProp, offset: 0x01ff119b, size: 127 bytes, params: 2, frame: 17 if (onActivityItemSelected != null) { onActivityItemSelected({applicationId: applicationId}); } const appAnalyticsUtilsModule = require(4863) /* metro dependency 4863: AppAnalyticsUtils */; const trackWithMetadata = appAnalyticsUtilsModule.trackWithMetadata; const APP_LAUNCHER_ACTIVITY_ITEM_SELECTED = AnalyticEvents.APP_LAUNCHER_ACTIVITY_ITEM_SELECTED; Reflect.apply(trackWithMetadata, appAnalyticsUtilsModule, [APP_LAUNCHER_ACTIVITY_ITEM_SELECTED, {location: location, application_id: applicationId, section_name: sectionName, action: env0_4, source: entrypoint}]); } function handleActivityItemSelected() { // fn#88765, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11778:5401, owner: useHandleActivityItemSelected.handleActivityItemSelected, offset: 0x01ff121a, size: 70 bytes, params: 1, frame: 14 let value = environment.__proto__; value = require(4081) /* metro dependency 4081: HapticUtilsNative */; const triggerHapticFeedback = value.triggerHapticFeedback; const HapticFeedbackTypes = (require(4081) /* metro dependency 4081: HapticUtilsNative */).HapticFeedbackTypes; const IMPACT_MEDIUM = HapticFeedbackTypes.IMPACT_MEDIUM; Reflect.apply(triggerHapticFeedback, value, [IMPACT_MEDIUM]); env0_5(); }