/* Metro module 8832; source: modules/activity_status/useUserVoiceActivity.tsx; dependencies: [1379, 3784, 4297, 482, 566, 2] */ import ChannelStore2 from '../../stores/ChannelStore.tsx'; /* Metro dependency 1379 */ import PermissionStore from '../../stores/PermissionStore.tsx'; /* Metro dependency 3784 */ import VoiceStateStore from '../../stores/VoiceStateStore.tsx'; /* Metro dependency 4297 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../external/discord_common/js/shared/Constants.tsx'; /* Metro dependency 482 */ function _fun68988(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#68988, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9017:6, offset: 0x01c63e86, size: 297 bytes, params: 8, frame: 22 let env0_0 = require; const getUserVoiceState2 = getUserVoiceState; const getVisibleUserVoiceActivity2 = getVisibleUserVoiceActivity; let Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const channelStore = ChannelStore2; object = {ChannelStore: channelStore, PermissionStore: PermissionStore, VoiceStateStore: VoiceStateStore}; Object = global.Object; const env0_7 = Object.freeze({voiceState: undefined, voiceChannel: undefined}); (FileImportTrackerModule).fileFinishedImporting('modules/activity_status/useUserVoiceActivity.tsx'); exports.default = function(a0) { var userId = a0.userId; var env0_0 = userId; var guildId = a0.guildId; var env0_1 = guildId; return require(dependencyMap[4]).useStateFromStoresObject([channelStore, PermissionStore, VoiceStateStore], _fun68994, [guildId, userId]); }; exports.getUserVoiceState = getUserVoiceState2; exports.canViewUserVoiceChannel = canViewUserVoiceChannel; exports.getVisibleUserVoiceActivity = getVisibleUserVoiceActivity2; function getUserVoiceState({userId, guildId}) { // fn#68989, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9017:203, offset: 0x01c63faf, size: 89 bytes, params: 2, frame: 15 const value = a1; const r1 = value !== undefined ? value : env0_6; return guildId == null ? userId != null ? r1.VoiceStateStore.getDiscoverableVoiceStateForUser(userId) : undefined : userId != null ? r1.VoiceStateStore.getDiscoverableVoiceState(guildId, userId) : userId != null ? r1.VoiceStateStore.getDiscoverableVoiceStateForUser(userId) : undefined; } function getUserVoiceChannel({voiceState}) { // fn#68990, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9017:398, offset: 0x01c64008, size: 70 bytes, params: 2, frame: 14 var ChannelStore; const value = a1; if (voiceState?.channelId != null) { ChannelStore = (value !== undefined ? value : env0_6).ChannelStore; return ChannelStore.getChannel(voiceState.channelId); } } function canViewVoiceChannel({voiceState, voiceChannel}) { // fn#68991, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9017:531, offset: 0x01c6404e, size: 98 bytes, params: 2, frame: 15 var r1; var r0; let value = a1; const r2 = value !== undefined ? value : env0_6; value = voiceState != null; if (value) { r1 = voiceChannel?.isPrivate(); r1 = !r1 ? r2.PermissionStore.can(Permissions.VIEW_CHANNEL, voiceChannel) : r1; r0 = r1; } else { r0 = value; } return r0; } function getVisibleUserVoiceActivity({userId, guildId}) { // fn#68992, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9017:746, offset: 0x01c640b0, size: 117 bytes, params: 2, frame: 17 const value = a1; const r6 = value !== undefined ? value : env0_6; const userVoiceState = getUserVoiceState({userId: userId, guildId: guildId}, r6); const userVoiceChannel = getUserVoiceChannel({voiceState: userVoiceState}, r6); return canViewVoiceChannel({voiceState: userVoiceState, voiceChannel: userVoiceChannel}, r6) ? {voiceState: userVoiceState, voiceChannel: userVoiceChannel} : env0_7; } function useUserVoiceActivity({userId, guildId}) { // fn#68993, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9017:1081, offset: 0x01c64125, size: 110 bytes, params: 2, frame: 18 return (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([channelStore, PermissionStore, VoiceStateStore], function() { return getVisibleUserVoiceActivity({userId: userId, guildId: guildId}, {ChannelStore: channelStore, PermissionStore: PermissionStore, VoiceStateStore: VoiceStateStore}); }, [guildId, userId]); function _fun68994() { // fn#68994, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9017:1182, offset: 0x01c64193, size: 67 bytes, params: 1, frame: 14 return getVisibleUserVoiceActivity({userId: userId, guildId: guildId}, {ChannelStore: channelStore, PermissionStore: PermissionStore, VoiceStateStore: VoiceStateStore}); } } function canViewUserVoiceChannel({userId, guildId}) { // fn#68995, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:9017:1362, offset: 0x01c641d6, size: 93 bytes, params: 2, frame: 16 const value = a1; const r3 = value !== undefined ? value : env0_6; const userVoiceState = getUserVoiceState({userId: userId, guildId: guildId}, r3); const canViewVoiceChannelBinding = canViewVoiceChannel; object = {voiceState: userVoiceState}; object.voiceChannel = getUserVoiceChannel({voiceState: userVoiceState}, r3); return canViewVoiceChannelBinding(object, r3); } } global.__d(_fun68988, 8832, [1379, 3784, 4297, 482, 566, 2]) /* metro module 8832, dependencies: [1379, 3784, 4297, 482, 566, 2] */;