// Metro module 15750 (f15751). import { useEffect } from "react"; import EmbeddedActivitiesStore, { NO_ACTIVITIES } from "../activities/EmbeddedActivitiesStore"; import FramesStore from "../frames/FramesStore"; import GameConsoleStore from "../game_console/GameConsoleStore"; import VibegrationsChatStore from "../vibegrations/stores/VibegrationsChatStore"; import { SILENT_JOIN_LEAVE_CHANNEL_TYPES } from "../../records/ChannelRecord"; import ApplicationStreamingStore from "../../stores/ApplicationStreamingStore"; import AuthenticationStore from "../../stores/AuthenticationStore"; import ChannelStore from "../../stores/ChannelStore"; import GuildStore from "../../stores/GuildStore"; import MediaEngineStore from "../../stores/MediaEngineStore"; import "../../stores/NotificationSettingsStore"; import RTCConnectionStore from "../../stores/RTCConnectionStore"; import SelectedChannelStore from "../../stores/SelectedChannelStore"; import SpeakingStore from "../../stores/SpeakingStore"; import VoiceStateStore from "../../stores/VoiceStateStore"; import SortedVoiceStateStore from "../../stores/views/SortedVoiceStateStore"; import { RTCConnectionStates, InputModes, ApplicationStreamStates } from "../../Constants"; import { StaticChannelRoute } from "../channel/ChannelConstants"; import { RequestToSpeakStates, getAudienceRequestToSpeakState } from "../stage_channels/useAudienceRequestToSpeakState"; import { encodeStreamKey } from "../go_live/utils/StreamKeyUtils"; import { getEmbeddedActivityLocationChannelId } from "../activities/utils/embeddedActivityLocationUtils"; import * as _GlobalUtils from "../../utils/GlobalUtils"; import { isVibegrationsChannelCandidate } from "../vibegrations/lib/VibegrationsUtils"; function $mk97656($env) { return () => { const r2 = $env; let env28149 = { $parent: $env }; env28149[0] = (0, r2[1])(); const r10 = $env.$parent; const batchedStoreListener = new ((0, r10[0])(r10[1][20]).BatchedStoreListener)(r2[0], () => { const r5 = env28149.$parent; const r9 = (0, r5[1])(); const r7 = (0, r5[2])(env28149[0], r9); if (!(r7 == null || env28149.$parent.$parent[14].isSoundDisabled(r7))) { const r14 = env28149.$parent.$parent; (0, r14[0])(r14[1][21]).playSound(r7, 0.4); } env28149[0] = r9; }); env28149[1] = batchedStoreListener; batchedStoreListener.attach("useSound"); return () => env28149[1].detach(); }; } let Camera, RTCConnect, Speaking, SelfMutedTemporarily, PriorityVAD, UserHasBeenMoved, UserInvitedToSpeak, VoiceChannel, ActivitySounds; let env11254 = {}; const MuteDeafen = function MuteDeafen() { let env22407; const r3 = [MediaEngineStore, SelectedChannelStore]; const r5 = env22407 = { $parent: env11254 }; env22407[0] = r3; env22407[1] = () => ({ inVoiceChannel: SelectedChannelStore.getVoiceChannelId() != null, selfMute: MediaEngineStore.isSelfMute(), selfDeaf: MediaEngineStore.isSelfDeaf(), audioPermissionReady: MediaEngineStore.isNativeAudioPermissionReady(), shouldSkipMuteUnmuteSound: MediaEngineStore.shouldSkipMuteUnmuteSound() }); env22407[2] = (a0, a1) => { let r12; L5: { const { inVoiceChannel, selfMute, selfDeaf, audioPermissionReady, shouldSkipMuteUnmuteSound } = a1; if (inVoiceChannel) { if (a0.selfDeaf !== selfDeaf) { return selfDeaf ? "deafen" : "undeafen"; } if (audioPermissionReady) { if (!inVoiceChannel && !a0.audioPermissionReady) { break L5; } const selfMute2 = a0.selfMute; let r11 = void 0; if (selfMute2 !== selfMute) { if (shouldSkipMuteUnmuteSound) { MediaEngineStore.notifyMuteUnmuteSoundWasSkipped(); r12 = void 0; } else { r12 = selfMute ? "mute" : "unmute"; } r11 = r12; } return r11; } } } }; useEffect($mk97656(r5)); return null; }; Camera = function Camera() { let env22408; const r3 = [MediaEngineStore, SelectedChannelStore]; const r5 = env22408 = { $parent: env11254 }; env22408[0] = r3; env22408[1] = () => ({ videoEnabled: MediaEngineStore.isVideoEnabled(), inVoiceChannel: SelectedChannelStore.getVoiceChannelId() != null }); env22408[2] = ({ videoEnabled: videoEnabled2, inVoiceChannel: inVoiceChannel2 }, { videoEnabled, inVoiceChannel }) => { if (videoEnabled2 !== videoEnabled && inVoiceChannel2 && inVoiceChannel) { return videoEnabled ? "camera_on" : "camera_off"; } }; useEffect($mk97656(r5)); return null; }; RTCConnect = function RTCConnect() { let env22409; const r3 = [ChannelStore, RTCConnectionStore, SelectedChannelStore, GameConsoleStore]; const r7 = env22409 = { $parent: env11254 }; env22409[0] = r3; env22409[1] = () => { const channel = ChannelStore.getChannel(SelectedChannelStore.getVoiceChannelId()); const type = channel?.type; const guildId = channel == null ? void 0 : channel.getGuildId(); const wasEverRtcConnected = RTCConnectionStore.getWasEverRtcConnected(); const state = RTCConnectionStore.getState(); return { channelType: type, guildId, connected: state === RTCConnectionStates.RTC_CONNECTED, connectHasStarted: (wasEverRtcConnected ? !wasEverRtcConnected : state !== RTCConnectionStates.DISCONNECTED) || state === RTCConnectionStates.RTC_CONNECTED, awaitingRemote: GameConsoleStore.getAwaitingRemoteSessionInfo() != null, connectedRemote: GameConsoleStore.getRemoteSessionId() != null }; }; env22409[2] = (a0, { channelType: channelType2, connected, connectHasStarted, awaitingRemote, connectedRemote: connectedRemote2 }) => { const { channelType, connectedRemote, connected: connected2 } = a0; if (!(!a0.connectHasStarted && connectHasStarted) && !(connectedRemote2 && !connectedRemote)) { if (connected2 && !connected) { L15: { if (!awaitingRemote && !connectedRemote2) { if (channelType != null && SILENT_JOIN_LEAVE_CHANNEL_TYPES.has(channelType)) { break L15; } return "disconnect"; } } return void 0; } return void 0; } if (channelType2 != null && SILENT_JOIN_LEAVE_CHANNEL_TYPES.has(channelType2)) { return void 0; } return "user_join"; }; useEffect($mk97656(r7)); return null; }; Speaking = function Speaking() { let env22410; const r3 = [SpeakingStore]; const r4 = env22410 = { $parent: env11254 }; env22410[0] = r3; env22410[1] = () => SpeakingStore.isCurrentUserPTTActive(); env22410[2] = (a0, a1) => { if (a0 !== a1) { const isSelfMute = MediaEngineStore.isSelfMute(); if (MediaEngineStore.getMode() === InputModes.PUSH_TO_TALK && !isSelfMute) { return a1 ? "ptt_start" : "ptt_stop"; } } }; useEffect($mk97656(r4)); return null; }; SelfMutedTemporarily = function SelfMutedTemporarily() { let env22411; const r3 = [MediaEngineStore]; const r4 = env22411 = { $parent: env11254 }; env22411[0] = r3; env22411[1] = () => MediaEngineStore.isSelfMutedTemporarily(); env22411[2] = (a0, a1) => { if (a0 !== a1) { const isSelfMute = MediaEngineStore.isSelfMute(); if (MediaEngineStore.getMode() === InputModes.VOICE_ACTIVITY && !isSelfMute) { return a1 ? "ptt_stop" : "ptt_start"; } } }; useEffect($mk97656(r4)); return null; }; PriorityVAD = function PriorityVAD() { let env22412; const r3 = [SpeakingStore]; const r4 = env22412 = { $parent: env11254 }; env22412[0] = r3; env22412[1] = () => SpeakingStore.isCurrentUserPrioritySpeaker(); env22412[2] = (a0, a1) => { if (a0 !== a1) { const isSelfMute = MediaEngineStore.isSelfMute(); if (MediaEngineStore.getMode() === InputModes.VOICE_ACTIVITY && !isSelfMute) { return a1 ? "ptt_start" : "ptt_stop"; } } }; useEffect($mk97656(r4)); return null; }; UserHasBeenMoved = function UserHasBeenMoved() { let env22413; const r3 = [VoiceStateStore]; const r4 = env22413 = { $parent: env11254 }; env22413[0] = r3; env22413[1] = () => VoiceStateStore.userHasBeenMovedVersion; env22413[2] = (a0, a1) => { if (a0 !== a1) { return "user_moved"; } }; useEffect($mk97656(r4)); return null; }; UserInvitedToSpeak = function UserInvitedToSpeak() { let env22414; const r3 = [SelectedChannelStore, VoiceStateStore]; const r5 = env22414 = { $parent: env11254 }; env22414[0] = r3; env22414[1] = () => { const voiceChannelId = SelectedChannelStore.getVoiceChannelId(); if (voiceChannelId == null) { return RequestToSpeakStates.NONE; } return getAudienceRequestToSpeakState(VoiceStateStore.getVoiceStateForChannel(voiceChannelId)); }; env22414[2] = (a0, a1) => { if (a0 !== a1 && a1 === RequestToSpeakStates.REQUESTED_TO_SPEAK_AND_AWAITING_USER_ACK) { return "reconnect"; } }; useEffect($mk97656(r5)); return null; }; VoiceChannel = function VoiceChannel() { let env22415; const r3 = [SelectedChannelStore, ApplicationStreamingStore, AuthenticationStore, VoiceStateStore, ChannelStore]; const r8 = env22415 = { $parent: env11254 }; env22415[0] = r3; env22415[1] = () => { const voiceChannelId = SelectedChannelStore.getVoiceChannelId(); const id = AuthenticationStore.getId(); const r8 = []; const allActiveStreams = ApplicationStreamingStore.getAllActiveStreams(); const r4 = voiceChannelId != null; let streamingUserIds2 = r8; let voiceChannelUserCount = void 0; let channelType = void 0; if (r4) { const channel = ChannelStore.getChannel(voiceChannelId); const r26 = channel != null; streamingUserIds2 = r8; voiceChannelUserCount = void 0; channelType = void 0; if (r26) { const type = channel.type; voiceChannelUserCount = SortedVoiceStateStore.countVoiceStatesForChannel(channel.id) - (VoiceStateStore.isInChannel(channel.id) ? 1 : 0); streamingUserIds2 = ApplicationStreamingStore.getAllApplicationStreamsForChannel(channel.id).map((item) => item.ownerId); channelType = type; } } let r41 = allActiveStreams.length === 1 ? allActiveStreams[0] : ApplicationStreamingStore.getCurrentUserActiveStream(); if (r41?.state === ApplicationStreamStates.CONNECTING) { r41 = null; } const r46 = r41 != null; let singleActiveStreamViewerCount = 0; let singleActiveStreamKey = null; if (r46) { const r54 = encodeStreamKey(r41); singleActiveStreamViewerCount = ApplicationStreamingStore.getViewerIds(r54).filter((item) => item !== id).length; singleActiveStreamKey = r54; } return { channelType, voiceChannelId, voiceChannelUserCount, streamingUserIds: streamingUserIds2, singleActiveStreamKey, singleActiveStreamViewerCount, currentUserId: id, allActiveStreams }; }; env22415[2] = (a0, a1) => { let r51, r56; let c28151_0, streamingUserIds, currentUserId, c28151_3; L35: { c28151_0 = a0; const { channelType, voiceChannelId, voiceChannelUserCount } = a1; streamingUserIds = a1.streamingUserIds; const { singleActiveStreamKey, singleActiveStreamViewerCount } = a1; currentUserId = a1.currentUserId; c28151_3 = void 0; if (a0.voiceChannelId === voiceChannelId && voiceChannelId != null) { const channel = ChannelStore.getChannel(voiceChannelId); const r2 = channel == null; let r1 = false; if (!r2) { const guildId = channel.getGuildId(); const r23 = guildId == null; r1 = false; if (!r23) { const guild = GuildStore.getGuild(guildId); r1 = guild != null && guild.afkChannelId === channel.id; } } if (!r1) { if (channelType != null && SILENT_JOIN_LEAVE_CHANNEL_TYPES.has(channelType)) { break L35; } const r33 = singleActiveStreamKey != null && a0.singleActiveStreamKey === singleActiveStreamKey; const r37 = streamingUserIds.some((streamingUserId) => !c28151_0.streamingUserIds.includes(streamingUserId)); c28151_3 = a0.allActiveStreams.map((allActiveStream) => allActiveStream.ownerId); const r45 = a0.streamingUserIds.some((streamingUserId) => { const r5 = streamingUserIds.includes(streamingUserId); return r5 ? !r5 : streamingUserId === currentUserId || c28151_3.includes(streamingUserId); }); let r46 = "stream_started"; if (!r37) { let r47 = "stream_ended"; if (!r45) { L32: { if (a0.singleActiveStreamViewerCount <= 25 && r33) { const r50 = singleActiveStreamViewerCount > a0.singleActiveStreamViewerCount; r51 = "stream_user_joined"; if (r50) { break L32; } } L31: { if (a0.voiceChannelUserCount != null && voiceChannelUserCount != null && a0.voiceChannelUserCount <= 25) { const r55 = voiceChannelUserCount > a0.voiceChannelUserCount; r56 = "user_join"; if (r55) { break L31; } } r56 = a0.voiceChannelUserCount != null && voiceChannelUserCount != null && a0.voiceChannelUserCount <= 25 ? voiceChannelUserCount < a0.voiceChannelUserCount ? "user_leave" : a0.singleActiveStreamViewerCount <= 25 ? r33 ? singleActiveStreamViewerCount < a0.singleActiveStreamViewerCount ? "stream_user_left" : void 0 : void 0 : void 0 : a0.singleActiveStreamViewerCount <= 25 ? r33 ? singleActiveStreamViewerCount < a0.singleActiveStreamViewerCount ? "stream_user_left" : void 0 : void 0 : void 0; } r51 = r56; } r47 = r51; } r46 = r47; } return r46; } } } }; useEffect($mk97656(r8)); return null; }; ActivitySounds = function ActivitySounds() { let env22416; const r3 = [SelectedChannelStore, EmbeddedActivitiesStore, FramesStore, AuthenticationStore, ChannelStore, VibegrationsChatStore]; const r9 = env22416 = { $parent: env11254 }; env22416[0] = r3; env22416[1] = () => { const voiceChannelId = SelectedChannelStore.getVoiceChannelId(); const channelId = SelectedChannelStore.getChannelId(); const connectedActivityLocation = EmbeddedActivitiesStore.getConnectedActivityLocation(); const embeddedActivityLocationChannelId = getEmbeddedActivityLocationChannelId(connectedActivityLocation); const id2 = AuthenticationStore.getId(); const channelActivities = _GlobalUtils.isNotNullish(channelId) ? EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(channelId) : NO_ACTIVITIES; const voiceChannelActivities = _GlobalUtils.isNotNullish(voiceChannelId) ? EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(voiceChannelId) : NO_ACTIVITIES; const connectedChannelActivities = _GlobalUtils.isNotNullish(embeddedActivityLocationChannelId) ? EmbeddedActivitiesStore.getEmbeddedActivitiesForChannel(embeddedActivityLocationChannelId) : NO_ACTIVITIES; const userConnectedActivity2 = _GlobalUtils.isNotNullish(connectedActivityLocation) ? EmbeddedActivitiesStore.getSelfEmbeddedActivityForLocation(connectedActivityLocation) : null; const connectedFrame = FramesStore.getConnectedFrame(); const r0 = channelId === StaticChannelRoute.VIBEGRATIONS && connectedFrame?.channelId == null && connectedFrame?.applicationId === VibegrationsChatStore.getBuilderPreviewApplicationId(); return { connectedActivityLocation, voiceChannelId, currentUserId: id2, channelActivities, connectedChannelActivities, userConnectedActivity: userConnectedActivity2, voiceChannelActivities, connectedFrame, inVibegrationsChannel: connectedFrame?.channelId != null && isVibegrationsChannelCandidate(ChannelStore.getChannel(connectedFrame?.channelId), "ActivitySounds") || r0 }; }; env22416[2] = (a0, { connectedActivityLocation, voiceChannelId, currentUserId: currentUserId2, channelActivities, connectedChannelActivities, userConnectedActivity, voiceChannelActivities, connectedFrame, inVibegrationsChannel }) => { let r103, r106, r127; const r16 = voiceChannelActivities.some((voiceChannelActivity) => voiceChannelActivity.applicationId === userConnectedActivity?.applicationId && voiceChannelActivity.launchId === userConnectedActivity.launchId); const isNotNullish = _GlobalUtils.isNotNullish(voiceChannelId); let r29 = void 0; if (isNotNullish) { const r32 = a0.voiceChannelActivities.find((voiceChannelActivity) => voiceChannelActivity.userIds.has(currentUserId2)); const r35 = voiceChannelActivities.find((voiceChannelActivity) => voiceChannelActivity.userIds.has(currentUserId2)); let r43 = a0.voiceChannelActivities.length < voiceChannelActivities.length && _GlobalUtils.isNotNullish(a0.voiceChannelId) ? "activity_launch" : void 0; if (r35 === void 0 && _GlobalUtils.isNotNullish(r32)) { r43 = "activity_end"; } if (r32 === void 0 && _GlobalUtils.isNotNullish(r35) && r35.userIds.size > 1) { r43 = "activity_user_join"; } const r57 = _GlobalUtils.isNotNullish(r35) && _GlobalUtils.isNotNullish(r32); r29 = r43; if (r57) { if (r35.userIds.size > r32.userIds.size) { r43 = "activity_user_join"; } if (r35.userIds.size < r32.userIds.size) { r43 = "activity_user_left"; } r29 = r43; } } let r69 = r29; if (!r16) { if (a0.connectedChannelActivities.length < connectedChannelActivities.length && a0.channelActivities.length < channelActivities.length) { r29 = "activity_launch"; } const userConnectedActivity2 = a0.userConnectedActivity; if (userConnectedActivity == null && _GlobalUtils.isNotNullish(userConnectedActivity2)) { r29 = "activity_end"; } const r85 = _GlobalUtils.isNotNullish(userConnectedActivity) && _GlobalUtils.isNotNullish(userConnectedActivity2); r69 = r29; if (r85) { if (userConnectedActivity.userIds.size > userConnectedActivity2.userIds.size) { r29 = "activity_user_join"; } if (userConnectedActivity.userIds.size < userConnectedActivity2.userIds.size) { r29 = "activity_user_left"; } r69 = r29; } } const r98 = r69 != null || a0.connectedActivityLocation == null && connectedActivityLocation == null; let r100 = r69; if (!r98) { L59: { if (a0.connectedActivityLocation == null) { const r102 = connectedActivityLocation != null; r103 = "activity_launch"; if (r102) { break L59; } } L58: { if (a0.connectedActivityLocation != null) { const r105 = connectedActivityLocation == null; r106 = "activity_end"; if (r105) { break L58; } } const r107 = userConnectedActivity != null && a0.userConnectedActivity != null; let r109 = r69; if (r107) { const r115 = a0.userConnectedActivity.userIds.size < userConnectedActivity.userIds.size; let r116 = "activity_user_join"; if (!r115) { if (a0.userConnectedActivity.userIds.size > userConnectedActivity.userIds.size) { r69 = "activity_user_leave"; } r116 = r69; } r109 = r116; } r106 = r109; } r103 = r106; } r100 = r103; } const r122 = r100 != null || a0.connectedFrame == null && connectedFrame == null; let r125 = r100; if (!r122) { L75: { if (a0.connectedFrame == null && connectedFrame != null) { r127 = "activity_launch"; if (!inVibegrationsChannel) { break L75; } } if (!(a0.connectedFrame == null || connectedFrame != null || a0.inVibegrationsChannel)) { r100 = "activity_end"; } r127 = r100; } r125 = r127; } return r125; }; useEffect($mk97656(r9)); return null; }; export default function SoundPlayer() { return <> ; };