/* Metro module 14418; source: modules/guilds_bar/useGuildMediaState.tsx; dependencies: [1378, 1384, 1383, 4492, 1226, 1379, 1867, 3784, 3793, 1934, 4864, 4297, 661, 677, 566, 14419, 9127, 14420, 3774, 8448, 21, 1387, 2] */ function _fun109129(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#109129, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:6, offset: 0x0233ed89, size: 355 bytes, params: 8, frame: 19 const env0_0 = require; const _arrayLikeToArray_109132 = 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 Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const embeddedActivitiesStore = importDefault(1378) /* metro dependency 1378: EmbeddedActivitiesStore */; const stageInstanceStore = importDefault(1384) /* metro dependency 1384: StageInstanceStore */; const env0_5 = (require(1383) /* metro dependency 1383: ChannelRecord */).isVoiceChannel; const applicationStreamingStore = importDefault(4492) /* metro dependency 4492: ApplicationStreamingStore */; const authenticationStore = importDefault(1226) /* metro dependency 1226: AuthenticationStore */; const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */; const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */; const permissionStore = importDefault(3784) /* metro dependency 3784: PermissionStore */; const relationshipStore = importDefault(3793) /* metro dependency 3793: RelationshipStore */; const selectedChannelStore = importDefault(1934) /* metro dependency 1934: SelectedChannelStore */; const userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */; const voiceStateStore = importDefault(4297) /* metro dependency 4297: VoiceStateStore */; const env0_15 = (require(661) /* metro dependency 661: Constants */).BasicPermissions; (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/guilds_bar/useGuildMediaState.tsx'); exports.default = useGuildMediaState; } function _createForOfIteratorHelperLoose_109130(a0, a1) { // fn#109130, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:267, offset: 0x0233eeec, size: 372 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 _fun109131; } value = undefined; if (a0) { if (typeof a0 === 'string') { value = _arrayLikeToArray_109132(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_109132(a0, value); r6 = value; } else { regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', ''); if (regexp.test(r9)) { value = _arrayLikeToArray_109132(a0, value); r6 = value; } else { r6 = value; } } r5 = r6; } } else { r5 = value; } if (r5) { if (r5) { } return _fun109131; } 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 canConnectToChannel(a0, a1) { // fn#109133, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:1177, offset: 0x0233f060, size: 117 bytes, params: 3, frame: 17 const value = a2; const r3 = value !== undefined ? value : PermissionStore; return a0 != null && a0.type !== (require(677) /* metro dependency 677: ChannelTypes */).ChannelTypes.GUILD_STAGE_VOICE && a1 !== a0.id && r3.canBasicChannel(BasicPermissions.VIEW_CHANNEL, a0); } function useGuildMediaState(a0) { // fn#109134, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:1416, offset: 0x0233f0d5, size: 528 bytes, params: 2, frame: 30 const env0_0 = a0; const value2 = undefined; const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([UserGuildSettingsStore], _fun109135); const value4 = (require(14419) /* metro dependency 14419: DontBadgeMutedVcsExperiment */).useIsDontBadgeMutedVcsEnabled('useGuildMediaState'); const value5 = (require(9127) /* metro dependency 9127: useGuildScheduledEvents */).useGuildActiveEvent(a0); const value6 = (require(566) /* metro dependency 566: flux */).useStateFromStoresArray([EmbeddedActivitiesStore, RelationshipStore], _fun109136); const embeddedActivityLocationUtilsModule = require(3774) /* metro dependency 3774: embeddedActivityLocationUtils */; const getEmbeddedActivityLocationChannelId = embeddedActivityLocationUtilsModule.getEmbeddedActivityLocationChannelId; const property = value6[0]; const value8 = (require(8448) /* metro dependency 8448: ActivitiesInTextUtils */).useIsActivitiesInTextEnabled(Reflect.apply(getEmbeddedActivityLocationChannelId, embeddedActivityLocationUtilsModule, [property == null ? value2 : property.location])); const {guildHasVoice, guildHasVideo, selectedVoiceChannelHasVideo} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([SelectedChannelStore, VoiceStateStore, GuildStore, PermissionStore, ChannelStore, UserGuildSettingsStore], _fun109138, [a0, value3, value4]); return (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([SelectedChannelStore, ChannelStore, EmbeddedActivitiesStore, StageInstanceStore, ApplicationStreamingStore, PermissionStore, UserGuildSettingsStore], _fun109139, [a0, value3, selectedVoiceChannelHasVideo, AuthenticationStore.getId(), value8, value6, value5, guildHasVoice, guildHasVideo, value4]); } function _fun109135() { // fn#109135, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:1489, offset: 0x0233f2e5, size: 27 bytes, params: 1, frame: 11 return UserGuildSettingsStore.isMuted(env0_0); } function _fun109136() { // fn#109136, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:1650, offset: 0x0233f300, size: 46 bytes, params: 1, frame: 11 var environment; const value = environment.__proto__; return EmbeddedActivitiesStore.getEmbeddedActivitiesForGuild(env0_0).filter(function(a0) { var r5; var moduleValue = require(dependencyMap[17]); var userIds = a0.userIds; var items = []; arraySpread(items, userIds, 0, r5); return !moduleValue.hasBlockedOrIgnoredUserIds(items, RelationshipStore.getBlockedOrIgnoredIDs()); }); } function _fun109138() { // fn#109138, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:1964, offset: 0x0233f37c, size: 451 bytes, params: 1, frame: 32 var afkChannelId; var r15; var r18; var r3; var r6; var channelId; var r14; var r1; var properties; var properties2; var properties3; var propertyName; var propertyName2; var canConnectToChannelBinding; var getBasicChannel; var value9; var value10; var isGuildOrCategoryOrChannelMuted; var value11; var value12; var done; var value13; var property; var value14; var value15; var value16; var hasVideo; let value = environment.__proto__; const voiceChannelId = SelectedChannelStore.getVoiceChannelId(); const guild = GuildStore.getGuild(env0_0); const value5 = undefined; reducibleJoin2: while (true) { if (guild == null) { afkChannelId = value5; break reducibleJoin2; } afkChannelId = guild.afkChannelId; break reducibleJoin2; } const getUsersWithVideo = VoiceStateStore.getUsersWithVideo; const binding = env0_0; const value6 = Reflect.apply(getUsersWithVideo, VoiceStateStore, [binding]); const blockedUserUtilsModule = require(14420) /* metro dependency 14420: BlockedUserUtils */; const filterBlockedUsersFromVoiceStates = blockedUserUtilsModule.filterBlockedUsersFromVoiceStates; const getVoiceStates = VoiceStateStore.getVoiceStates; const value7 = Reflect.apply(filterBlockedUsersFromVoiceStates, blockedUserUtilsModule, [Reflect.apply(getVoiceStates, VoiceStateStore, [binding])]); const object2 = {}; const value8 = false; reducibleJoin10: while (true) { if (env0_1) { r3 = value8; break reducibleJoin10; } properties = Object.keys(value7); properties2 = 0; properties3 = properties.length; if (properties === value5) { r3 = value8; break reducibleJoin10; } r15 = properties2; reducibleLoop4: while (true) { propertyName = properties[r15]; propertyName2 = r15 + 1; if (propertyName === value5) { r3 = value8; break reducibleJoin10; } channelId = value7[propertyName].channelId; if (channelId == null) { r15 = propertyName2; continue reducibleLoop4; } canConnectToChannelBinding = canConnectToChannel; getBasicChannel = ChannelStore.getBasicChannel; value9 = Reflect.apply(getBasicChannel, ChannelStore, [channelId]); r18 = afkChannelId ?? value5; if (canConnectToChannelBinding(value9, r18, PermissionStore)) { value10 = true; if (env0_2) { isGuildOrCategoryOrChannelMuted = UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted; if (Reflect.apply(isGuildOrCategoryOrChannelMuted, UserGuildSettingsStore, [env0_0, channelId])) { r15 = propertyName2; continue reducibleLoop4; } r3 = value10; break reducibleJoin10; } r3 = value10; break reducibleJoin10; } r15 = propertyName2; continue reducibleLoop4; } } object2.guildHasVoice = r3; reducibleJoin20: while (true) { if (env0_1) { r3 = value8; break reducibleJoin20; } value11 = _createForOfIteratorHelperLoose_109130(value6); value12 = value11(); done = value12.done; if (done) { r3 = value8; break reducibleJoin20; } r6 = value12; reducibleLoop12: while (true) { value13 = r6.value; property = value7[value13]; reducibleJoin14: while (true) { if (property == null) { channelId = value5; break reducibleJoin14; } channelId = property.channelId; break reducibleJoin14; } if (channelId != null) { canConnectToChannelBinding = canConnectToChannel; getBasicChannel = ChannelStore.getBasicChannel; value14 = Reflect.apply(getBasicChannel, ChannelStore, [channelId]); r14 = afkChannelId ?? value5; reducibleJoin19: while (true) { if (canConnectToChannelBinding(value14, r14, PermissionStore)) { value15 = true; if (env0_2) { isGuildOrCategoryOrChannelMuted = UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted; if (Reflect.apply(isGuildOrCategoryOrChannelMuted, UserGuildSettingsStore, [env0_0, channelId])) { break reducibleJoin19; } r3 = value15; break reducibleJoin20; } r3 = value15; break reducibleJoin20; } break reducibleJoin19; } } value16 = value11(); done = value16.done; if (done) { r3 = value8; break reducibleJoin20; } r6 = value16; continue reducibleLoop12; } } object2.guildHasVideo = r3; const value17 = voiceChannelId != null; reducibleJoin22: while (true) { if (value17) { hasVideo = VoiceStateStore.hasVideo; value = Reflect.apply(hasVideo, VoiceStateStore, [voiceChannelId]); r1 = value; break reducibleJoin22; } r1 = value17; break reducibleJoin22; } object2.selectedVoiceChannelHasVideo = r1; return object2; } function _fun109139() { // fn#109139, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:2854, offset: 0x0233f53f, size: 610 bytes, params: 1, frame: 30 var environment; var guild_id; var r6; var r2; var r4; var r9; var r7; var r3; var channel_id; var r10; var r5; var guildHasVoice2; var value9; var isGuildStageVoice; var isGuildStageVoice2; var value10; var getActiveStreamForUser; var binding; var value12; var value15; var value16; var done; var value17; var value18; var moduleValue2; var getEmbeddedActivityLocationChannelId; var location; var value19; var isVoiceChannelBinding; var type; var isVoiceChannel2; var value20; var value21; var guildHasVoiceBinding; var guildHasVideoBinding; var value23; var value24; let value = environment.__proto__; const voiceChannelId = SelectedChannelStore.getVoiceChannelId(); let getChannel = ChannelStore.getChannel; const value3 = Reflect.apply(getChannel, ChannelStore, [voiceChannelId]); const value4 = undefined; reducibleJoin2: while (true) { if (value3 == null) { guild_id = value4; break reducibleJoin2; } guild_id = value3.guild_id; break reducibleJoin2; } const value6 = guild_id === env0_0; if (!value6) { reducibleJoin5: while (true) { if (env0_1) { return {'audio': false, 'video': false, 'screenshare': false, 'liveStage': false, 'activeEvent': false, 'activity': false, 'isCurrentUserConnected': false}; } break reducibleJoin5; } } const defaultImport = importDefault(21) /* metro dependency 21: SnowflakeUtils */; const keys = defaultImport.keys; const getStageInstancesByGuild = StageInstanceStore.getStageInstancesByGuild; const value8 = Reflect.apply(keys, defaultImport, [Reflect.apply(getStageInstancesByGuild, StageInstanceStore, [env0_0])]).some(_fun109140); reducibleJoin9: while (true) { if (value6) { getChannel = ChannelStore.getChannel; value9 = Reflect.apply(getChannel, ChannelStore, [voiceChannelId]); reducibleJoin8: while (true) { if (value9 == null) { r6 = value4; break reducibleJoin8; } isGuildStageVoice = value9.isGuildStageVoice; isGuildStageVoice2 = Reflect.apply(isGuildStageVoice, value9, []); r6 = isGuildStageVoice2; break reducibleJoin8; } value10 = r6 != null; r2 = value10; r4 = r6; break reducibleJoin9; } r2 = value6; r4 = value4; break reducibleJoin9; } r2 = r2 && r4; reducibleJoin12: while (true) { if (value6) { getActiveStreamForUser = ApplicationStreamingStore.getActiveStreamForUser; binding = env0_9; value12 = Reflect.apply(getActiveStreamForUser, ApplicationStreamingStore, [binding, env0_0]) != null; r9 = value12; break reducibleJoin12; } r9 = !!value6; break reducibleJoin12; } const blockedUserUtilsModule = require(14420) /* metro dependency 14420: BlockedUserUtils */; const filterOutStreamsByBlockedOwner = blockedUserUtilsModule.filterOutStreamsByBlockedOwner; const getAllApplicationStreams = ApplicationStreamingStore.getAllApplicationStreams; const value14 = Reflect.apply(filterOutStreamsByBlockedOwner, blockedUserUtilsModule, [Reflect.apply(getAllApplicationStreams, ApplicationStreamingStore, [])]).some(_fun109141); if (env0_5) { r3 = env0_4.length > 0; } else { value15 = _createForOfIteratorHelperLoose_109130(env0_4); value16 = value15(); done = value16.done; value17 = false; if (done) { r3 = value17; } else { r7 = value16; reducibleLoop14: while (true) { value18 = r7.value; getChannel = ChannelStore.getChannel; moduleValue2 = require(3774) /* metro dependency 3774: embeddedActivityLocationUtils */; getEmbeddedActivityLocationChannelId = moduleValue2.getEmbeddedActivityLocationChannelId; location = value18.location; value19 = Reflect.apply(getChannel, ChannelStore, [Reflect.apply(getEmbeddedActivityLocationChannelId, moduleValue2, [location])]); if (value19 != null) { isVoiceChannelBinding = isVoiceChannel; type = value19.type; isVoiceChannel2 = isVoiceChannelBinding(type); value20 = true; reducibleJoin16: while (true) { if (isVoiceChannel2) { r3 = value20; break reducibleLoop14; } break reducibleJoin16; } } value21 = value15(); done = value21.done; if (done) { r3 = value17; break reducibleLoop14; } r7 = value21; continue reducibleLoop14; } } } const getEmbeddedActivitiesForGuild = EmbeddedActivitiesStore.getEmbeddedActivitiesForGuild; value = Reflect.apply(getEmbeddedActivitiesForGuild, EmbeddedActivitiesStore, [env0_0]).length > 0; if (value6) { reducibleJoin22: while (true) { if (env0_3 == null) { channel_id = value4; break reducibleJoin22; } channel_id = env0_3.channel_id; break reducibleJoin22; } value23 = channel_id === voiceChannelId; reducibleJoin24: while (true) { if (value6) { r10 = selectedVoiceChannelHasVideo; break reducibleJoin24; } r10 = value6; break reducibleJoin24; } value24 = true; r3 = value; r4 = value23; r5 = r2; r6 = r9; r7 = r10; guildHasVoice2 = value24; } else { guildHasVoiceBinding = guildHasVoice; value = env0_3 != null; guildHasVideoBinding = guildHasVideo; r4 = value; r5 = value8; r6 = value14; r7 = guildHasVideoBinding; guildHasVoice2 = guildHasVoiceBinding; } return {audio: guildHasVoice2, video: r7, screenshare: r6, liveStage: r5, activeEvent: r4, activity: r3, isCurrentUserConnected: value6 || r2}; } function _fun109140(a0) { // fn#109140, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:3142, offset: 0x0233f7a1, size: 75 bytes, params: 2, frame: 16 const value = environment.__proto__.__proto__; const channel = ChannelStore.getChannel(a0); return channel != null && PermissionStore.can((require(1387) /* metro dependency 1387: StageChannelPermissions */).JOIN_VOCAL_CHANNEL_PERMISSIONS, channel); } function _fun109141(a0) { // fn#109141, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14615:3432, offset: 0x0233f7ec, size: 65 bytes, params: 2, frame: 15 const guildId = a0.guildId; const value = environment.__proto__; return !(guildId !== env1_0 || env1_2 && UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(env1_0, a0.channelId)); }