/* Metro module 11664; source: modules/app_launcher/hooks/useAppsInThisServer.tsx; dependencies: [31, 7861, 1878, 5066, 566, 8060, 1909, 7871, 11663, 22, 8040, 2] */ function _fun89428(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#89428, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:6, offset: 0x0200d1dd, size: 185 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 env0_5 = (require(7861) /* metro dependency 7861: ApplicationCommandIndexStore */).useGuildIndexState; const userStore = importDefault(1878) /* metro dependency 1878: UserStore */; const env0_7 = (require(5066) /* metro dependency 5066: ApplicationCommandConstants */).DISCOVERY_COMMANDS_QUERY_LIMIT; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/app_launcher/hooks/useAppsInThisServer.tsx'); exports.default = useAppsInThisServer; } function useAppsInThisServer({context}) { // fn#89429, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:281, offset: 0x0200d296, size: 478 bytes, params: 2, frame: 25 var object2; let value = undefined; const env0_4 = value; const channel = context.type !== 'channel' ? value : context.channel; const value3 = useGuildIndexState(channel == null ? value : channel.guild_id, true); const value4 = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserStore], _fun89430); const applicationCommandQueryApiModule = importAll(8060) /* metro dependency 8060: ApplicationCommandQueryApi */; const useDiscovery = applicationCommandQueryApiModule.useDiscovery; object2 = {context: context}; const {CHAT, PRIMARY_ENTRY_POINT} = (require(1909) /* metro dependency 1909: Server */).ApplicationCommandType; object2.filters = {commandTypes: [CHAT, PRIMARY_ENTRY_POINT]}; object2.options = {'placeholderCount': 0, 'limit': null, 'includeFrecency': true, limit: DISCOVERY_COMMANDS_QUERY_LIMIT}; object2.allowFetch = true; const {commandsByActiveSection, loading} = Reflect.apply(useDiscovery, applicationCommandQueryApiModule, [object2]); let binding = env0_4; let useMemo = binding.useMemo; const value6 = Reflect.apply(useMemo, binding, [_fun89431, [commandsByActiveSection]]); useMemo = binding.useMemo; const result = value3.result; const value7 = Reflect.apply(useMemo, binding, [_fun89433, [result == null ? value : result.sections, value6]]); value = require(11663) /* metro dependency 11663: ApplicationFrecencyHooks */; value = value.useSortApplicationsViaFrecency(value7); binding = value; useMemo = binding.useMemo; return {appsInThisServer: Reflect.apply(useMemo, binding, [_fun89436, [value4, value]]), isLoading: value3.fetchState.fetching || loading}; } function _fun89430() { // fn#89430, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:435, offset: 0x0200d474, size: 35 bytes, params: 1, frame: 10 const value = environment.__proto__; return UserStore.getCurrentUser()?.nsfwAllowed; } function _fun89431() { // fn#89431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:777, offset: 0x0200d497, size: 58 bytes, params: 1, frame: 13 const commandsByActiveSectionBinding = commandsByActiveSection; const reduce = commandsByActiveSectionBinding.reduce; const Set = global.Set; return Reflect.apply(reduce, commandsByActiveSectionBinding, [function(a0, a1) { if (a1.data.length > 0) { a0.add(a1.section.id); } return a0; }, new Set()]); } function _fun89433() { // fn#89433, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:872, offset: 0x0200d4fe, size: 92 bytes, params: 1, frame: 15 const Object = global.Object; let value = Object.values(env0_0.result?.sections ?? ({})); value = value.map(function(a0) { return a0.descriptor; }); return value.filter(_fun89435); } function _fun89436() { // fn#89436, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:1172, offset: 0x0200d5ae, size: 98 bytes, params: 1, frame: 14 var environment; let value = environment.__proto__; const compact = (importDefault(22) /* metro dependency 22 */).compact; const binding = env0_4; value = Reflect.apply(compact, value, [binding.map(function(a0) { return a0.application; })]); value = value.filter(_fun89438); return value.map(function(a0) { return {application: a0}; }); } function _fun89435(a0) { // fn#89435, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:994, offset: 0x0200d565, size: 73 bytes, params: 2, frame: 13 var r0; var binding; const id = a0.id; let value = environment.__proto__.__proto__; const BUILT_IN_SECTIONS = (require(7871) /* metro dependency 7871: ApplicationCommandBuiltIns */).BUILT_IN_SECTIONS; if (value) { r0 = !(id in BUILT_IN_SECTIONS); } else { value = environment.__proto__; binding = env1_3; value = binding.has(a0.id); r0 = value; } return r0; } function _fun89438(a0) { // fn#89438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:11850:1231, offset: 0x0200d610, size: 59 bytes, params: 2, frame: 12 var r0; let value = environment.__proto__; value = env1_1 === false; if (value) { value = environment.__proto__.__proto__; value = importDefault(8040) /* metro dependency 8040: isApplicationAgeRestricted */; value = value(a0.id); r0 = value; } else { r0 = value; } return !r0; }