(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[532],{7936:(e,t,a)=>{"use strict";a.r(t),a.d(t,{ActiveCallHeader:()=>J,CallFallbackConfirm:()=>K,GroupCall:()=>Q});varn=a(3794),i=a(4050),o=a(5116),r=a(3716),s=a(1226),l=a(1638),c=a(2607),d=a(4446),u=a(782),p=a(2267),m=a(1394),v=a(1689),g=a(6204),f=a(1171);(0,o.Q6)("apiUpdate",((e,t,a)=>{const{activeGroupCallId:i}=e.groupCalls;switch(a["@type"]){case"updateGroupCallLeavePresentation":t.toggleGroupCallPresentation({value:!1});break;case"updateGroupCallStreams":if(!a.userId||!i)break;if(!(0,c.GU)(e,i,a.userId))break;return(0,d.B6)(e,i,a.userId,(0,u.CE)(a,["@type","userId"]));case"updateGroupCallConnectionState":if(!i)break;if("disconnected"===a.connectionState){t.leaveGroupCall({isFromLibrary:!0});break}return(0,d.AH)(e,i,{connectionState:a.connectionState,isSpeakerDisabled:a.isSpeakerDisabled});case"updateGroupCallParticipants":{const{groupCallId:e,participants:t}=a;i===e&&(0,n.handleUpdateGroupCallParticipants)(t);break}case"updateGroupCallConnection":{if(a.data.stream){t.showNotification({message:"Big live streams are not yet supported"}),t.leaveGroupCall();break}(0,n.handleUpdateGroupCallConnection)(a.data,a.presentation);consti=(0,c.mU)(e);null!=i&&i.participants&&Object.keys(i.participants).length>0&&(0,n.handleUpdateGroupCallParticipants)(Object.values(i.participants));break}}})),(0,o.Q6)("leaveGroupCall",((e,t,a)=>{const{isFromLibrary:i,shouldDiscard:r,shouldRemove:l,rejoin:u}=a||{},p=(0,c.mU)(e);p&&((0,o.R3)((0,d.Ic)(e,{connectionState:"disconnected"},p.participantsCount-1)),(async()=>{await(0,s.t9)("leaveGroupCall",{call:p});leta=!1;varc;r&&((e=(0,o.Rd)()).groupCalls.fallbackChatId===p.chatId&&(a=!0,null===(c=e.groupCalls.fallbackUserIdsToRemove)||void0===c||c.forEach((a=>{t.deleteChatMember({chatId:e.groupCalls.fallbackChatId,userId:a})}))),await(0,s.t9)("discardGroupCall",{call:p}));e=(0,o.Rd)(),l&&(e=(0,d.dc)(e,p.id)),(0,v.Mt)(),(0,o.R3)({...e,groupCalls:{...e.groupCalls,isGroupCallPanelHidden:!0,activeGroupCallId:void0,...a&&{fallbackChatId:void0,fallbackUserIdsToRemove:void0}}}),i||(0,n.leaveGroupCall)(),u&&t.joinGroupCall(u)})())})),(0,o.Q6)("toggleGroupCallVideo",(e=>{constt=(0,c.mU)(e),a=(0,l.dy)(e,e.currentUserId);a&&t&&(async()=>{await(0,n.toggleStream)("video"),await(0,s.t9)("editGroupCallParticipant",{call:t,videoStopped:!(0,n.isStreamEnabled)("video"),participant:a})})()})),(0,o.Q6)("requestToSpeak",((e,t,a)=>{const{value:n}=a||{value:!0},i=(0,c.mU)(e),o=(0,l.dy)(e,e.currentUserId);o&&i&&(0,s.t9)("editGroupCallParticipant",{call:i,raiseHand:n,participant:o})})),(0,o.Q6)("setGroupCallParticipantVolume",((e,t,a)=>{const{participantId:i,volume:o}=a,d=(0,c.mU)(e),u=(0,l.dy)(e,i);u&&d&&((0,n.setVolume)(i,Math.floor(o/r.Ro)/100),(0,s.t9)("editGroupCallParticipant",{call:d,volume:Number(o),participant:u}))})),(0,o.Q6)("toggleGroupCallMute",((e,t,a)=>{const{participantId:i,value:o}=a||{},r=(0,c.mU)(e),d=(0,l.dy)(e,i||e.currentUserId);d&&r&&(async()=>{conste=void0===o?(0,n.isStreamEnabled)("audio",d.id):o;i?(0,n.setVolume)(i,e?0:1):await(0,n.toggleStream)("audio"),await(0,s.t9)("editGroupCallParticipant",{call:r,muted:e,participant:d})})()})),(0,o.Q6)("toggleGroupCallPresentation",((e,t,a)=>{consti=(0,c.mU)(e),o=(0,l.dy)(e,e.currentUserId);o&&i&&(async()=>{if(void0!==(null==a?void0:a.value)?null==a?void0:a.value:!(0,n.isStreamEnabled)("presentation")){conste=await(0,n.startSharingScreen)();if(!e)return;await(0,s.t9)("joinGroupCallPresentation",{call:i,params:e})}elseawait(0,n.toggleStream)("presentation",!1),await(0,s.t9)("leaveGroupCallPresentation",{call:i});await(0,s.t9)("editGroupCallParticipant",{call:i,presentationPaused:!(0,n.isStreamEnabled)("presentation"),participant:o})})()})),(0,o.Q6)("connectToActiveGroupCall",((e,t)=>{consta=(0,c.mU)(e);if(!a)return;if("discarded"===a.connectionState)returnvoidt.showNotification({message:"This voice chat is not active"});consti=(0,v.FF)(),r=(0,v.NH)();if(!i||!r)return;const{currentUserId:d}=e;d&&(async()=>{conste=await(0,n.joinGroupCall)(d,r,i,t.apiUpdate);if(await(0,s.t9