/* Metro module 6862; source: modules/game_invite_channels/GameInvitesChannelUtils.tsx; dependencies: [29, 31, 1379, 1867, 4396, 566, 6863, 6896, 5198, 6772, 6902, 2] */ import ObjectWithoutProperties from '../../by-id/module-00029-ObjectWithoutProperties.js'; /* Metro dependency 29 */ import ChannelStore from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import GuildStore from '../../stores/GuildStore.tsx'; /* Metro dependency 1867 */ import PresenceStore from '../../stores/PresenceStore.tsx'; /* Metro dependency 4396 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */ import * as FluxModule from '../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */ import * as UseGameModule from '../games/hooks/useGame.tsx'; /* Metro dependency 5198 */ import * as ApplicationActionCreatorsModule from '../applications/ApplicationActionCreators.tsx'; /* Metro dependency 6772 */ import * as ForumTagHooksModule from '../forums/ForumTagHooks.tsx'; /* Metro dependency 6863 */ import * as ForumPostDataLoaderModule from '../forums/ForumPostDataLoader.tsx'; /* Metro dependency 6896 */ import * as SubscribeGuildMembersModule from '../../lib/guild/subscribeGuildMembers.tsx'; /* Metro dependency 6902 */ function _fun54149(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#54149, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:6, offset: 0x0135dde3, size: 367 bytes, params: 8, frame: 22 let env0_0 = require; const _arrayLikeToArray_54152 = function(a0, a1) { var r0; var r1; var r2; var value3; var length; var value5; var value = undefined; var value2 = value == null; reducibleJoin2: while (true) { if (value2) { r0 = value2; break reducibleJoin2; } value3 = value > a0.length; r0 = value3; break reducibleJoin2; } reducibleJoin4: while (true) { if (r0) { length = a0.length; r1 = length; break reducibleJoin4; } r1 = value; break reducibleJoin4; } value = (0, global.Array)(r1); var value4 = 0; if (value4 < r1) { r2 = value4; reducibleLoop5: while (true) { value[r2] = a0[r2]; value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1; if (value5 < r1) { r2 = value5; continue reducibleLoop5; } break reducibleLoop5; } } return value; }; const closure = function(a0) { var env0_0 = a0; return require(dependencyMap[5]).useStateFromStores([ChannelStore], _fun54154); }; const useGameInvitesChannelGame2 = useGameInvitesChannelGame; const getOfficialApplicationId2 = getOfficialApplicationId; const env0_2 = ['data']; const env0_3 = ['data']; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); ({})['1509696536903417891'] = '1432419613165228174'; const env0_10 = {}; (FileImportTrackerModule).fileFinishedImporting('modules/game_invite_channels/GameInvitesChannelUtils.tsx'); exports.GAME_INVITES_CHANNEL_NO_MIC_TAG_NAME = 'No Mic'; exports.useIsGameInvitesPost = closure; exports.useIsGameInvitePostVoiceEnabled = useIsGameInvitePostVoiceEnabled; exports.useFirstMessage = useFirstMessage; exports.useGameInvitesChannelGame = useGameInvitesChannelGame2; exports.getOfficialApplicationId = getOfficialApplicationId2; exports.useGameInvitesChannelOfficialApplication = function(a0) { var value3 = require(dependencyMap[9]).useApplication(getOfficialApplicationId(useGameInvitesChannelGame(a0).game)); var env0_0 = value3; return useMemo(_fun54163, [value3]); }; exports.useSubscribeToGameInvitePostAuthors = useSubscribeToGameInvitePostAuthors; exports.useGameInvitesChannelUserActivity = function(a0, a1) { var env0_0 = a1; var game = useGameInvitesChannelGame(a0).game; var env0_1 = game; return require(dependencyMap[5]).useStateFromStores([PresenceStore], _fun54168, [a1, game]); }; function _createForOfIteratorHelperLoose_54150(a0, a1) { // fn#54150, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:185, offset: 0x0135df52, size: 370 bytes, params: 3, frame: 20 var r6; var r9; var r5; var value3; var regexp; const env0_0 = a0; const Symbol = global.Symbol; let value = typeof Symbol !== 'undefined'; let r1 = value && a0[global.Symbol.iterator]; r1 = !r1 ? a0['@@iterator'] : r1; if (r1) { value = r1.call(a0); return value.next.bind(value); } const Array = global.Array; if (Array.isArray(a0)) { if (r1) { } return _fun54151; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_54152(a0, value); r5 = value; } else { value3 = ({}).toString.call(a0).slice(8, -1); r6 = value3 === 'Object' && a0.constructor; r9 = r6 ? a0.constructor.name : value3; if (r9 === 'Map') { r6 = global.Array.from(a0); } else if (r9 === 'Set') { r6 = global.Array.from(a0); } else if (r9 === 'Arguments') { value = _arrayLikeToArray_54152(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_54152(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun54151; } const TypeError = global.TypeError; throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); function _fun54151() { // fn#54151, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:756, offset: 0x00c39d73, size: 69 bytes, params: 1, frame: 5 return env0_1 >= env0_0.length ? {done: true} : {done: false, value: env0_0[typeof env0_1 === 'bigint' ? env0_1 : +env0_1]}; } } function useIsGameInvitesPost(a0) { // fn#54153, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:1163, offset: 0x0135e0c4, size: 64 bytes, params: 2, frame: 14 const env0_0 = a0; return (FluxModule).useStateFromStores([ChannelStore], _fun54154); function _fun54154() { // fn#54154, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:1236, offset: 0x0135e104, size: 120 bytes, params: 1, frame: 14 var r4; var r3; var r1; var r0; var isForumPost2; var value6; var channelStoreBinding; var value; const value2 = env0_0 != null; if (value2) { isForumPost2 = env0_0.isForumPost(); r4 = isForumPost2 ? env0_0.parent_id == null : !isForumPost2; if (r4) { r1 = !r4; } else { value6 = environment.__proto__; channelStoreBinding = ChannelStore; value = channelStoreBinding.getChannel(env0_0.parent_id); if (value == null) { r3 = undefined; } else { value = value.isGameInvitesChannel(); r3 = value; } value = r3 != null; r1 = value && r3; } r0 = r1; } else { r0 = value2; } return r0; } } function useGameInvitesChannelGame(a0) { // fn#54155, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:1393, offset: 0x0135e17c, size: 157 bytes, params: 2, frame: 19 const env0_0 = a0; const value2 = (FluxModule).useStateFromStores([GuildStore], _fun54156, [a0]); const value3 = null; const r6 = value3 != a0 ? env0_9[a0] : value3; const useGame = UseGameModule.useGame; return useMemo(_fun54157, [Reflect.apply(useGame, UseGameModule, [value3 == r6 ? value2 : r6])]); function _fun54156() { // fn#54156, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:1470, offset: 0x0135e219, size: 87 bytes, params: 1, frame: 14 var r2; var r0; var value3; var guild; const value2 = null; if (value2 == env0_0) { r0 = value2; } else { value3 = environment.__proto__; guild = GuildStore.getGuild(env0_0); r2 = value2 == guild || value2 == guild.gameApplicationIds ? undefined : guild.gameApplicationIds[0]; r0 = value2 != r2 ? r2 : value2; } return r0; } function _fun54157() { // fn#54157, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:1657, offset: 0x0135e270, size: 51 bytes, params: 1, frame: 14 const object = {}; object.game = env0_1.data; const binding = env1_4; copyDataProperties(object, binding(env0_1, env1_2), binding); return object; } } function getOfficialApplicationId(a0) { // fn#54158, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:1693, offset: 0x0135e2a3, size: 65 bytes, params: 2, frame: 12 return a0 == null ? a0?.getOfficialApplicationId() : env0_10[a0.id] ?? a0?.getOfficialApplicationId(); } function useIsGameInvitePostVoiceEnabled(a0) { // fn#54159, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:2026, offset: 0x0135e2e4, size: 80 bytes, params: 2, frame: 13 const value2 = (ForumTagHooksModule).useAppliedTags(a0); const value = useIsGameInvitesPost(a0); return value ? !value2.some(function(a0) { return a0.name === 'No Mic'; }) : !!value; } function useFirstMessage(a0, a1) { // fn#54161, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:2181, offset: 0x0135e348, size: 58 bytes, params: 3, frame: 13 return (ForumPostDataLoaderModule).useFirstForumPostMessage(a0, {enabled: a1, allowArchived: true}); } function useGameInvitesChannelOfficialApplication(a0) { // fn#54162, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:2437, offset: 0x0135e382, size: 94 bytes, params: 2, frame: 16 return useMemo(_fun54163, [(ApplicationActionCreatorsModule).useApplication(getOfficialApplicationId(useGameInvitesChannelGame(a0).game))]); function _fun54163() { // fn#54163, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:2595, offset: 0x0135e3e0, size: 46 bytes, params: 1, frame: 14 const object = {}; const binding = env0_0; object.application = binding.data; copyDataProperties(object, env1_4(binding, env1_3), binding); return object; } } function useSubscribeToGameInvitePostAuthors(a0, a1) { // fn#54164, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:2678, offset: 0x0135e40e, size: 169 bytes, params: 3, frame: 23 const env0_0 = a0; const env0_1 = a1; const isGameInvitesChannel = a0.isGameInvitesChannel(); const useStateFromStoresArray = FluxModule.useStateFromStoresArray; let items2 = [ChannelStore]; items2 = [Reflect.apply(useStateFromStoresArray, FluxModule, [items2, _fun54165, [isGameInvitesChannel, a1]])]; items2[1] = a0.guild_id; items2[2] = isGameInvitesChannel; (SubscribeGuildMembersModule).useSubscribeGuildMembers(useMemo(_fun54166, items2), 'GameInvitesChannelPostAuthors'); function _fun54165() { // fn#54165, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:2799, offset: 0x0135e4b7, size: 171 bytes, params: 1, frame: 18 var r2; var ownerId; var r1; var set; var items2; var value4; var _createForOfIteratorHelperLoose_54150Binding; var value5; var value6; var done; var value7; var channel; var value9; var value10; var value11; var value; if (env0_2) { set = new global.Set(); items2 = []; value4 = environment.__proto__; _createForOfIteratorHelperLoose_54150Binding = _createForOfIteratorHelperLoose_54150; value = undefined; value5 = _createForOfIteratorHelperLoose_54150Binding(require); value6 = value5(); done = value6.done; if (!done) { r2 = value6; while (true) { value7 = r2.value; channel = ChannelStore.getChannel(value7); ownerId = channel == null ? value : channel.ownerId; value9 = ownerId == null; if (value9) { r1 = value9; continue; } value10 = set.has(ownerId); r1 = value10; if (r1) { continue; } set.add(ownerId); items2.push(ownerId); value11 = value5(); done = value11.done; if (done) { break; } r2 = value11; continue; } } return items2; } return []; } function _fun54166() { // fn#54166, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:3021, offset: 0x0135e562, size: 39 bytes, params: 1, frame: 4 return env0_2 ? {[env0_0.guild_id]: env0_3} : {}; } } function useGameInvitesChannelUserActivity(a0, a1) { // fn#54167, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:3174, offset: 0x0135e589, size: 99 bytes, params: 3, frame: 18 const env0_0 = a1; return (FluxModule).useStateFromStores([PresenceStore], _fun54168, [a1, useGameInvitesChannelGame(a0).game]); function _fun54168() { // fn#54168, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:3302, offset: 0x0135e5ec, size: 103 bytes, params: 1, frame: 18 const value2 = null; if (value2 == require) { return value2; } if (value2 == game) { return value2; } return value2 == getOfficialApplicationId(game) ? value2 : value2 != PresenceStore.findActivity(require, _fun54169, value2, true) ? PresenceStore.findActivity(require, _fun54169, value2, true) : value2; function _fun54169({application_id}) { // fn#54169, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:7040:3426, offset: 0x0108da35, size: 22 bytes, params: 2, frame: 2 return application_id === env0_0; } } } } global.__d(_fun54149, 6862, [29, 31, 1379, 1867, 4396, 566, 6863, 6896, 5198, 6772, 6902, 2]) /* metro module 6862, dependencies: [29, 31, 1379, 1867, 4396, 566, 6863, 6896, 5198, 6772, 6902, 2] */;