/* Metro module 11598; source: modules/activities/utils/useActivityShelfItem.tsx; dependencies: [5, 1378, 4237, 661, 8049, 477, 10718, 11599, 11600, 1909, 7504, 10702, 10701, 6777, 3774, 6771, 8045, 8087, 4603, 9472, 8109, 2] */ function _fun88811(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#88811, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:6, offset: 0x01ff307d, size: 285 bytes, params: 8, frame: 23 var object2; const env0_0 = require; const closure = getStaffReleasePhase; const closure2 = useActivityAction; const closure3 = useOnActivityItemSelected; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(5) /* metro dependency 5 */; const embeddedActivitiesStore = importDefault(1378) /* metro dependency 1378: EmbeddedActivitiesStore */; const env0_5 = (require(4237) /* metro dependency 4237: Constants */).STAFF_RELEASE_PHASES; const env0_6 = (require(661) /* metro dependency 661: Constants */).ApplicationFlags; object2 = {START: 0}; object2[0] = 'START'; object2.JOIN = 1; object2[1] = 'JOIN'; object2.LEAVE = 2; object2[2] = 'LEAVE'; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/activities/utils/useActivityShelfItem.tsx'); exports.default = useActivityShelfItem; exports.ActivityAction = object2; exports.getStaffReleasePhase = closure; exports.useActivityAction = closure2; exports.useOnActivityItemSelected = closure3; } function getStaffReleasePhase(a0, a1) { // fn#88812, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:266, offset: 0x01ff319a, size: 243 bytes, params: 3, frame: 16 var r0; var client_platform_config; var defaultImport; var moduleValue3; var release_phase; var value; const value2 = undefined; const applicationFlagUtilsModule = require(7504) /* metro dependency 7504: ApplicationFlagUtils */; let hasApplicationFlag = applicationFlagUtilsModule.hasApplicationFlag; const EMBEDDED_RELEASED = ApplicationFlags.EMBEDDED_RELEASED; if (Reflect.apply(hasApplicationFlag, applicationFlagUtilsModule, [a0, EMBEDDED_RELEASED])) { client_platform_config = a1.client_platform_config; defaultImport = importDefault(8049) /* metro dependency 8049: getPlatform */; moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */; release_phase = client_platform_config[defaultImport(moduleValue3.getOS())].release_phase; if (STAFF_RELEASE_PHASES.includes(release_phase)) { value = release_phase.replace('_', ' '); value = value.replace(RegExp('(^\\w|\\s\\w)', 'g'), function(a0) { return a0.toUpperCase(); }); r0 = value; } else { r0 = value2; } return r0; } const moduleValue2 = applicationFlagUtilsModule; hasApplicationFlag = moduleValue2.hasApplicationFlag; const EMBEDDED_FIRST_PARTY = ApplicationFlags.EMBEDDED_FIRST_PARTY; if (Reflect.apply(hasApplicationFlag, moduleValue2, [a0, EMBEDDED_FIRST_PARTY])) { client_platform_config = a1.client_platform_config; defaultImport = importDefault(8049) /* metro dependency 8049: getPlatform */; moduleValue3 = require(477) /* metro dependency 477: PlatformUtils */; release_phase = client_platform_config[defaultImport(moduleValue3.getOS())].release_phase; if (STAFF_RELEASE_PHASES.includes(release_phase)) { value = release_phase.replace('_', ' '); value = value.replace(RegExp('(^\\w|\\s\\w)', 'g'), function(a0) { return a0.toUpperCase(); }); r0 = value; } else { r0 = value2; } return r0; } return value2; } function useActivityAction({context, applicationId, fetchesApplication}) { // fn#88814, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:574, offset: 0x01ff328d, size: 301 bytes, params: 2, frame: 22 fetchesApplication = fetchesApplication === undefined || fetchesApplication; const START = env0_7.START; const channel = context.type !== 'channel' ? undefined : context.channel; const value4 = (importDefault(10702) /* metro dependency 10702: useCurrentEmbeddedActivity */)(); const value5 = (importDefault(10701) /* metro dependency 10701: useCurrentEmbeddedApplication */)({fetchesApplication: fetchesApplication}); const value6 = (require(6777) /* metro dependency 6777: useGetOrFetchApplications */).useGetOrFetchApplication(applicationId, fetchesApplication); const value8 = (importDefault(11600) /* metro dependency 11600: useEmbeddedAppsForChannel */)(channel).find(_fun88815); if (value6 == null) { return START; } const embeddedActivityLocationUtilsModule = require(3774) /* metro dependency 3774: embeddedActivityLocationUtils */; const getEmbeddedActivityLocationChannelId = embeddedActivityLocationUtilsModule.getEmbeddedActivityLocationChannelId; return channel == null || Reflect.apply(getEmbeddedActivityLocationChannelId, embeddedActivityLocationUtilsModule, [value4?.location]) !== channel.id ? value8 == null ? START : env0_7.JOIN : value5?.id === value6.id ? env0_7.LEAVE : value8 == null ? START : env0_7.JOIN; } function useOnActivityItemSelected({application, botUserIdForAppDM, context, locationObject, embeddedActivitiesManager, onActivityItemSelectedProp, launchingComponentId, commandOrigin, sectionName, source, fetchesApplication, customId, referrerId, onConfirmActivityLaunchChecksAlertOpen}) { // fn#88816, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:1058, offset: 0x01ff33e7, size: 408 bytes, params: 2, frame: 18 fetchesApplication = fetchesApplication === undefined || fetchesApplication; const value5 = useActivityAction({context: context, applicationId: application?.id ?? '', fetchesApplication: fetchesApplication}); const env0_13 = (importDefault(6771) /* metro dependency 6771: useAnalyticsLocations */)().analyticsLocations; const env0_14 = (importDefault(10702) /* metro dependency 10702: useCurrentEmbeddedActivity */)(); const env0_15 = (require(8045) /* metro dependency 8045: canLaunchFrame */).canLaunchFrame(application); if (application == null) { return function() { if (onActivityItemSelectedProp != null) { onActivityItemSelectedProp({applicationId: ''}); } }; } const START = sectionName.START; if (START === value5) { return embeddedActivitiesManager(_fun88819); } const JOIN = sectionName.JOIN; if (JOIN === value5) { return embeddedActivitiesManager(_fun88822); } const LEAVE = sectionName.LEAVE; if (LEAVE === value5) { return _fun88824; } } function useActivityShelfItem({activityItem, context, locationObject, onActivityItemSelected, embeddedActivitiesManager, assetNames = ['embedded_cover'], backgroundResolution, launchingComponentId, commandOrigin, source}) { // fn#88825, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:2720, offset: 0x01ff38bb, size: 619 bytes, params: 2, frame: 32 var object2; backgroundResolution = backgroundResolution === undefined ? 250 : backgroundResolution; const application = activityItem.application; const activity = activityItem.activity; const client_platform_config = activity.client_platform_config; const defaultImport = importDefault(8049) /* metro dependency 8049: getPlatform */; const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */; const getOS = platformUtilsModule.getOS; const property = client_platform_config[defaultImport(Reflect.apply(getOS, platformUtilsModule, []))]; const Date = global.Date; const value4 = Date.now(); const r4 = property.label_until != null && value4 < global.Date.parse(property.label_until) && property.label_from != null && value4 > global.Date.parse(property.label_from); const value10 = (importDefault(10718) /* metro dependency 10718: useEmbeddedActivityBackground */)({applicationId: application.id, size: backgroundResolution, names: assetNames, format: 'webp'}); const r9 = activity.activity_preview_video_asset_id != null ? (importDefault(11599) /* metro dependency 11599: getPreviewVideoAssetUrl */)(application.id, activity.activity_preview_video_asset_id) : null; const value13 = (importDefault(11600) /* metro dependency 11600: useEmbeddedAppsForChannel */)(context.type !== 'channel' ? undefined : context.channel).find(function({embeddedActivity}) { return application.id === embeddedActivity.applicationId; }); const value14 = useActivityAction({context: context, applicationId: application.id}); const value15 = useOnActivityItemSelected({application: activityItem.application, context: context, locationObject: locationObject, embeddedActivitiesManager: embeddedActivitiesManager, onActivityItemSelectedProp: onActivityItemSelected, launchingComponentId: launchingComponentId, commandOrigin: commandOrigin, source: source}); const staffReleasePhase = getStaffReleasePhase(application, activityItem.activity); object2 = {imageBackground: value10, videoUrl: r9, joinableEmbeddedApp: value13, activityAction: value14, onActivityItemSelected: value15}; object2.labelType = r4 ? property.label_type : (require(1909) /* metro dependency 1909: Server */).EmbeddedActivityLabelTypes.NONE; object2.staffReleasePhase = staffReleasePhase; return object2; } function _fun88815({embeddedActivity}) { // fn#88815, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:814, offset: 0x01ff33ba, size: 45 bytes, params: 2, frame: 4 return env0_0 != null && env0_0.id === embeddedActivity.applicationId; } function* _fun88819() { // fn#88819, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:1639, offset: 0x01ff35b0, size: 401 bytes, params: 1, frame: 16 var environment; var id; var r6; var value; var value2; var value3; var type; var channel; var value4; var binding; var binding2; var property; var value5; var openPrivateChannel; var object2; var value6; var value7; var value8; var value9; var value10; var value11; var then; var value12; var value13; var error; var value14; var binding3; var value15; var launchFrame; var value16; var value17; var value18; var value19; exceptionSkip51: while (true) { exceptionLanding51: while (true) { exceptionSkip26: while (true) { exceptionLanding26: while (true) { value = undefined; value2 = false; if (value2) { return value; } value = undefined; value3 = environment.__proto__; if (env1_15) { value14 = environment.__proto__.__proto__; try { binding = env2_1; } catch (error) { break exceptionLanding51; } try { binding3 = env2_2; } catch (error) { break exceptionLanding51; } try { property = binding3[17]; } catch (error) { break exceptionLanding51; } try { value15 = binding(property); } catch (error) { break exceptionLanding51; } try { launchFrame = value15.launchFrame; } catch (error) { break exceptionLanding51; } try { object2 = {}; } catch (error) { break exceptionLanding51; } try { binding = env1_12; } catch (error) { break exceptionLanding51; } try { object2.applicationId = binding; } catch (error) { break exceptionLanding51; } try { value16 = Reflect.apply(launchFrame, value15, [object2]); } catch (error) { break exceptionLanding51; } yield value16; try { value17 = undefined; value18 = false; } catch (error) { break exceptionLanding51; } if (value18) { return value17; } try { } catch (error) { break exceptionLanding51; } try { value19 = EmbeddedActivitiesStore == null; } catch (error) { break exceptionLanding51; } if (!value19) { try { } catch (error) { break exceptionLanding51; } try { object2 = {}; } catch (error) { break exceptionLanding51; } try { binding = env1_12; } catch (error) { break exceptionLanding51; } try { object2.applicationId = binding; } catch (error) { break exceptionLanding51; } try { EmbeddedActivitiesStore(object2); } catch (error) { break exceptionLanding51; } } return value; } type = importDefault.type; if (type !== 'channel') { id = value; } else { channel = importDefault.channel; id = channel.id; } if (require == null) { r6 = id; value9 = environment.__proto__.__proto__; value11 = env2_1(env2_2[19])({targetApplicationId: env1_12, locationObject: dependencyMap, channelId: r6, analyticsLocations: env1_13, componentId: STAFF_RELEASE_PHASES, commandOrigin: ApplicationFlags, sectionName: env1_7, source: getStaffReleasePhase, customId: useActivityAction, referrerId: useOnActivityItemSelected, onConfirmActivityLaunchChecksAlertOpen: env1_11}); yield value11.then(_fun88820); return value; } value4 = environment.__proto__.__proto__; try { binding = env2_1; } catch (error) { break exceptionLanding26; } try { binding2 = env2_2; } catch (error) { break exceptionLanding26; } try { property = binding2[18]; } catch (error) { break exceptionLanding26; } try { value5 = binding(property); } catch (error) { break exceptionLanding26; } try { openPrivateChannel = value5.openPrivateChannel; } catch (error) { break exceptionLanding26; } try { object2 = {}; } catch (error) { break exceptionLanding26; } try { } catch (error) { break exceptionLanding26; } try { object2.recipientIds = require; } catch (error) { break exceptionLanding26; } try { object2.navigateToChannel = true; } catch (error) { break exceptionLanding26; } try { value6 = Reflect.apply(openPrivateChannel, value5, [object2]); } catch (error) { break exceptionLanding26; } yield value6; try { value7 = undefined; value8 = false; } catch (error) { break exceptionLanding26; } if (value8) { return value7; } r6 = value7; value9 = environment.__proto__.__proto__; binding = env2_1; value10 = binding(env2_2[19]); value11 = value10({targetApplicationId: env1_12, locationObject: dependencyMap, channelId: r6, analyticsLocations: env1_13, componentId: STAFF_RELEASE_PHASES, commandOrigin: ApplicationFlags, sectionName: env1_7, source: getStaffReleasePhase, customId: useActivityAction, referrerId: useOnActivityItemSelected, onConfirmActivityLaunchChecksAlertOpen: env1_11}); then = value11.then; yield Reflect.apply(then, value11, [_fun88820]); value12 = undefined; value13 = false; return value13 ? value12 : value; break exceptionSkip26; } return value; break exceptionSkip26; } break exceptionSkip51; } return value; break exceptionSkip51; } } function* _fun88822() { // fn#88822, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:2194, offset: 0x01ff377e, size: 213 bytes, params: 1, frame: 16 var environment; if (true) { value = environment.__proto__.__proto__; var binding = env2_4; if (!binding.isLaunchingActivity()) { binding = env2_1; value = undefined; value = binding(env2_2[20])({applicationId: env1_12, activityChannelId: importDefault.type !== 'channel' ? value : importDefault.channel.id, locationObject: dependencyMap, analyticsLocations: env1_13, componentId: STAFF_RELEASE_PHASES, sectionName: env1_7, source: getStaffReleasePhase, customId: useActivityAction, referrerId: useOnActivityItemSelected}); yield value.then(_fun88823); value = undefined; if (false) { return value; } } } } function _fun88824() { // fn#88824, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:2497, offset: 0x01ff3853, size: 104 bytes, params: 1, frame: 14 if (!EmbeddedActivitiesStore.isLaunchingActivity()) { if (env0_14 != null) { embeddedActivitiesManager.leaveActivity({location: env0_14.location, applicationId: env0_12}); } if (onActivityItemSelectedProp != null) { onActivityItemSelectedProp({applicationId: env0_12}); } } } function _fun88820(a0) { // fn#88820, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11784:2122, offset: 0x01ff3741, size: 50 bytes, params: 2, frame: 14 return a0 && EmbeddedActivitiesStore?.({applicationId: env2_12}); }