@cloudflare/realtimekit 1.2.1-staging.8 → 1.2.2-staging.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.rn.js CHANGED
@@ -2,7 +2,7 @@
2
2
  `),t.sdp=t.sdp.replace(/a=rtpmap:116 red\/90000\r\n/g,""),t.sdp=t.sdp.replace(/a=rtpmap:117 ulpfec\/90000\r\n/g,""),t.sdp=t.sdp.replace(/a=rtpmap:98 rtx\/90000\r\n/g,""),t.sdp=t.sdp.replace(/a=fmtp:98 apt=116\r\n/g,"")),this.pc1.setLocalDescription(t),this.pc2.setRemoteDescription(t),this.pc2.createAnswer().then(this.gotAnswer.bind(this),this.reportFatal.bind(this))}gotAnswer(t){this.constrainVideoBitrateKbps&&(t.sdp=t.sdp.replace(/a=mid:video\r\n/g,`a=mid:video\r
3
3
  b=AS:${this.constrainVideoBitrateKbps}\r
4
4
  `)),this.pc2.setLocalDescription(t),this.pc1.setRemoteDescription(t)}establishConnection(){this.pc1.createOffer().then(this.gotOffer.bind(this),this.reportFatal.bind(this))}reportFatal(t){console.error("Error:",t)}async getRoundTripTime(){const[t,e]=await Promise.all([this.pc1.getStats(),this.pc2.getStats()]);let r,i;if(t.forEach(a=>{a.type==="candidate-pair"&&a.nominated===!0&&a.bytesSent>0&&(r=a)}),e.forEach(a=>{a.type==="candidate-pair"&&a.nominated===!0&&a.bytesReceived>0&&(i=a)}),r&&i)try{if(r.currentRoundTripTime&&i.currentRoundTripTime)return{rtt:r.currentRoundTripTime,backendRTT:i.currentRoundTripTime};const a=(i.lastPacketReceivedTimestamp-r.lastPacketSentTimestamp)/1e3;return{rtt:a,backendRTT:a}}catch(a){return}}close(){this.pc1.close(),this.pc2.close()}}class lm extends ot{constructor(e){super();u(this,"call");u(this,"timeOut");this.call=new mr(e)}start(e=1e4){this.call.establishConnection(),this.timeOut=setTimeout(this.testFailed.bind(this),e)}testComplete(e){clearTimeout(this.timeOut),this.call.close(),this.emit("done",e)}testFailed(e){this.call.close(),this.emit("failed",e)}}const yv=8,Sv=1/1e3;class Ev extends lm{constructor(e){super(e);u(this,"senderChannel");u(this,"recieveChannel");u(this,"startTime");u(this,"lastBitrateMeasureTime");u(this,"sentPayloadBytes",0);u(this,"recievedPayloadBytes",0);u(this,"lastReceivedPayloadBytes",0);u(this,"stopSending",!1);u(this,"testProgress",0);u(this,"samplePacket","");u(this,"finalBitrateSum",0);u(this,"bitRateSampels",0);u(this,"maxNumberOfPacketsToSend",0);u(this,"bytesToKeepBuffered",0);u(this,"testDurationSeconds",5);this.call.setIceCandidateFilter(mr.isNotHostCandidate),this.senderChannel=this.call.pc1.createDataChannel(null);for(let r=0;r<1024*256;r+=1)this.samplePacket+="h";this.maxNumberOfPacketsToSend=1,this.bytesToKeepBuffered=1024*this.maxNumberOfPacketsToSend,this.testDurationSeconds=4,this.senderChannel.addEventListener("open",this.sendingStep.bind(this)),this.call.pc2.addEventListener("datachannel",this.onRecieverChannel.bind(this))}sendingStep(){const e=new Date;this.startTime||(this.startTime=e,this.lastBitrateMeasureTime=e);for(let i=0;i!==this.maxNumberOfPacketsToSend&&!(this.senderChannel.bufferedAmount>=this.bytesToKeepBuffered);i+=1){this.sentPayloadBytes+=this.samplePacket.length;try{this.senderChannel.send(this.samplePacket)}catch(a){}}const r=e.getTime()-this.startTime.getTime();r>=1e3*this.testDurationSeconds?(this.stopSending=!0,this.testProgress=100):(this.testProgress=r/(10*this.testDurationSeconds),setTimeout(this.sendingStep.bind(this),1))}onMessageRecieved(e){this.recievedPayloadBytes+=e.data.length;const r=new Date,i=r.getTime()-this.lastBitrateMeasureTime.getTime();if(i>=1e3){const o=(this.recievedPayloadBytes-this.lastReceivedPayloadBytes)*yv/(i/1e3);this.finalBitrateSum+=o,this.bitRateSampels+=1,this.lastReceivedPayloadBytes=this.recievedPayloadBytes,this.lastBitrateMeasureTime=r}if(this.stopSending&&this.sentPayloadBytes===this.recievedPayloadBytes){const a=this.finalBitrateSum/this.bitRateSampels;this.testComplete({throughput:Math.round(a*Sv)})}}testComplete(e){this.call.getRoundTripTime().then(({rtt:r,backendRTT:i})=>super.testComplete({RTT:r,backendRTT:i,throughput:e.throughput}))}onRecieverChannel(e){this.recieveChannel=e.channel,this.recieveChannel.addEventListener("message",this.onMessageRecieved.bind(this))}}class nh extends lm{constructor(e,r=mr.noFilter){super(e);u(this,"ch1");u(this,"ch2");this.call.setIceCandidateFilter(r);const i=this.call.pc1.createDataChannel(null);this.ch1=i,i.addEventListener("open",()=>{i.send("hello")}),i.addEventListener("message",this.onCh1Recieve.bind(this)),this.call.pc2.addEventListener("datachannel",this.dataChannelHandler.bind(this))}onCh1Recieve(e){e.data!=="world"?this.hangup("Invalid data transmitted."):this.testComplete({connectivity:!0})}onCh2Recieve(e){if(e.data!=="hello")this.hangup("Invalid data transmitted.");else try{this.ch2.send("world")}catch(r){}}dataChannelHandler(e){const r=e.channel;this.ch2=r,r.addEventListener("message",this.onCh2Recieve.bind(this))}hangup(e){this.testFailed(e)}}class Pv extends nh{constructor(t){super(t,mr.isHost)}}class _v extends nh{constructor(t){super(t,mr.isRelay)}}class Cv extends nh{constructor(t){super(t,mr.isReflexive)}}class wv{constructor(){u(this,"ipInformation",null)}async getIPDetails({peerId:t,apiHostnames:e,logger:r}){var i,a,o;if(!this.ipInformation){try{const c=`https://${e.location}`,l=await(await fetch(c)).json();if(((i=l.loc)==null?void 0:i.length)>5)return this.ipInformation=l,(a=this.ipInformation)!=null&&a.ip&&(this.ipInformation.ip=Qr(this.ipInformation.ip)),l;throw Error("Insufficient data")}catch(c){r.error("callstats::ipDetails:: failed to fetch ip using location service",{error:c})}try{const c=await fetch(`https://${e.locationLegacy}/?token=3c493932b0624c&peerId=${t}`,{method:"POST"});this.ipInformation=await c.json(),(o=this.ipInformation)!=null&&o.ip&&(this.ipInformation.ip=Qr(this.ipInformation.ip))}catch(c){r.error("callstats::ipDetails:: failed to fetch ip using legacy location service",{error:c})}}return this.ipInformation}resetCache(){this.ipInformation=null}}const ah=new wv,Jh=[{urls:"turn:turn.dyte.in:443?transport=tcp",username:"dyte",credential:"dytein",credentialType:"password"},{urls:"turn:turn.dyte.in:3478?transport=udp",username:"dyte",credential:"dytein",credentialType:"password"}];function Kh(s){const[t,e]=s.split(",");return{coords:{latitude:Number(t),longitude:Number(e)}}}class um{constructor(){u(this,"transport");u(this,"candidatePair");u(this,"outboundVideoRtp",new Map);u(this,"inboundVideoRtp",new Map);u(this,"outboundAudioRtp",new Map);u(this,"inboundAudioRtp",new Map);u(this,"remoteInboundRtp",new Map);u(this,"producerStreamMap",new Map);u(this,"consumerStreamMap",new Map);u(this,"staleProducerStreamMap",!1);u(this,"staleConsumerStreamMap",!1)}}class hm extends ot{constructor(){super();u(this,"observer");u(this,"outboundProducerMap",new Map);u(this,"inboundConsumerMap",new Map);u(this,"consumerPeerIdMap",new Map);u(this,"pausedConsumerMap",new Map);u(this,"pausedProducerMap",new Map);u(this,"overallProducingTransportsStatsMap",{});u(this,"overallConsumingTransportsStatsMap",{});u(this,"overallConsumersStatsMap",{});u(this,"overallProducersStatsMap",{});u(this,"videoProducerToStatsMap",new Map);u(this,"audioProducerToStatsMap",new Map);u(this,"videoConsumerToStatsMap",new Map);u(this,"audioConsumerToStatsMap",new Map);u(this,"consumerIdsWithFreezedVideo",new Set);u(this,"consumerIdsWithFreezedAudio",new Set);u(this,"producerIdsWithFreezedVideo",new Set);u(this,"producerIdsWithFreezedAudio",new Set);u(this,"freezedProducingTransportIds",new Set);u(this,"freezedConsumingTransportIds",new Set);u(this,"screenShareProducers",new Set);u(this,"screenShareConsumers",new Set);u(this,"ipDetails");u(this,"callStatsInstance");this.observer=new ot}async registerProducer(e){await this.generateProducerStreamMap(e),e.on("close",this.deregisterProducer.bind(this,e)),e.on("pause",this.pauseProducer.bind(this,e.id)),e.on("resume",this.resumeProducer.bind(this,e.id)),e.appData.screenShare===!0&&this.screenShareProducers.add(e.id)}pauseProducer(e){this.pausedProducerMap.set(e,{lastReportCalculated:!1})}resumeProducer(e){this.pausedProducerMap.delete(e)}processInboundConsumerVideoStats(e,r,i){var o,c;const a=((c=(o=this==null?void 0:this.callStatsInstance)==null?void 0:o.consumerSharedMediaStatesMap)==null?void 0:c.get(e))||{};r.totalVideoPacketsReceived===i.packetsReceived?(this.consumerIdsWithFreezedVideo.add(e),this.callStatsInstance&&a.video&&(this.callStatsInstance.logger.debug("callstats::measurements::consumerVideoFreezed",{consumerId:e}),this.callStatsInstance.eventHandler.emit("consumer_video_status","pause",e))):(r.totalVideoPacketsReceived=i.packetsReceived,this.consumerIdsWithFreezedVideo.has(e)&&(this.consumerIdsWithFreezedVideo.delete(e),this.callStatsInstance&&a.video&&(this.callStatsInstance.logger.debug("callstats::measurements::consumerVideoDefreezed",{consumerId:e}),this.callStatsInstance.eventHandler.emit("consumer_video_status","resume",e))))}processInboundConsumerAudioStats(e,r,i){var o,c;const a=((c=(o=this==null?void 0:this.callStatsInstance)==null?void 0:o.consumerSharedMediaStatesMap)==null?void 0:c.get(e))||{};r.totalAudioPacketsReceived===i.packetsReceived?(this.consumerIdsWithFreezedAudio.add(e),this.callStatsInstance&&a.audio&&(this.callStatsInstance.logger.debug("callStats::measurements::consumerAudioFreezed",{consumerId:e}),this.callStatsInstance.eventHandler.emit("consumer_audio_status","pause",e))):(r.totalAudioPacketsReceived=i.packetsReceived,this.consumerIdsWithFreezedAudio.has(e)&&(this.consumerIdsWithFreezedAudio.delete(e),this.callStatsInstance&&a.audio&&(this.callStatsInstance.logger.debug("callStats::measurements::consumerAudioDefreezed",{consumerId:e}),this.callStatsInstance.eventHandler.emit("consumer_audio_status","resume",e))))}processOutboundProducerVideoStats(e,r,i){var o;const a=((o=this==null?void 0:this.callStatsInstance)==null?void 0:o.currentUserMediaStates)||{};r.totalVideoPacketsSent===i.packetsSent?(this.producerIdsWithFreezedVideo.add(e),this.callStatsInstance&&a.video&&(this.callStatsInstance.logger.debug("callStats::measurements::producerVideoFreezed",{producerId:e}),this.callStatsInstance.eventHandler.emit("producer_video_status","pause",e))):(r.totalVideoPacketsSent=i.packetsSent,this.producerIdsWithFreezedVideo.has(e)&&(this.producerIdsWithFreezedVideo.delete(e),this.callStatsInstance&&a.video&&(this.callStatsInstance.logger.debug("callStats::measurements::producerVideoDefreezed",{producerId:e}),this.callStatsInstance.eventHandler.emit("producer_video_status","resume",e))))}processOutboundProducerAudioStats(e,r,i){var o;const a=((o=this==null?void 0:this.callStatsInstance)==null?void 0:o.currentUserMediaStates)||{};r.totalAudioPacketsSent===i.packetsSent?(this.producerIdsWithFreezedAudio.add(e),this.callStatsInstance&&a.audio&&(this.callStatsInstance.logger.debug("callStats::measurements::producerAudioFreezed",{producerId:e}),this.callStatsInstance.eventHandler.emit("producer_audio_status","pause",e))):(r.totalAudioPacketsSent=i.packetsSent,this.producerIdsWithFreezedAudio.has(e)&&(this.producerIdsWithFreezedAudio.delete(e),this.callStatsInstance&&a.audio&&(this.callStatsInstance.logger.debug("callStats::measurements::producerAudioDefreezed",{producerId:e}),this.callStatsInstance.eventHandler.emit("producer_audio_status","resume",e))))}processProducingTransportStats(e,r,i){var h;const a=((h=this==null?void 0:this.callStatsInstance)==null?void 0:h.currentUserMediaStates)||{},{audio:o,video:c,screen:d}=a,l=o||c||d;r.totalPacketsSent===i.packetsSent?(this.freezedProducingTransportIds.add(e),this.callStatsInstance&&l&&(this.callStatsInstance.logger.debug("callStats::measurements::producingTransportFreezed",{transportId:e}),this.callStatsInstance.eventHandler.emit("producing_transport_status","pause",e))):(r.totalPacketsSent=i.packetsSent,this.freezedProducingTransportIds.has(e)&&(this.freezedProducingTransportIds.delete(e),this.callStatsInstance&&l&&(this.callStatsInstance.logger.debug("callStats::measurements::producingTransportDefreezed",{transportId:e}),this.callStatsInstance.eventHandler.emit("producing_transport_status","resume",e))))}processConsumingTransportStats(e,r,i){var c,d;const o=!!Array.from(((d=(c=this==null?void 0:this.callStatsInstance)==null?void 0:c.consumerSharedMediaStatesMap)==null?void 0:d.values())||[]).reduce((l,h)=>l||h.audio||h.video||h.screen,!1);r.totalPacketsReceived===i.packetsSent?(this.freezedConsumingTransportIds.add(e),this.callStatsInstance&&o&&(this.callStatsInstance.logger.debug("callStats::measurements::consumingTransportFreezed",{transportId:e}),this.callStatsInstance.eventHandler.emit("consuming_transport_status","pause",e))):(r.totalPacketsReceived=i.packetsSent,this.freezedConsumingTransportIds.has(e)&&(this.freezedConsumingTransportIds.delete(e),this.callStatsInstance&&o&&(this.callStatsInstance.logger.debug("callStats::measurements::consumingTransportDefreezed",{transportId:e}),this.callStatsInstance.eventHandler.emit("consuming_transport_status","resume",e))))}async registerConsumer(e){await this.generateConsumerStreamMap(e),this.consumerPeerIdMap.set(e.id,{producerId:e.producerId,peerId:e.appData.peerId,appData:e.appData}),e.on("close",this.deregisterConsumer.bind(this,e)),e.on("pause",this.pauseConsumer.bind(this,e.id)),e.on("resume",this.resumeConsumer.bind(this,e.id)),e.appData.screenShare===!0&&this.screenShareConsumers.add(e.id)}pauseConsumer(e){this.pausedConsumerMap.set(e,{lastReportCalculated:!1})}resumeConsumer(e){this.pausedConsumerMap.delete(e)}async generateProducerStreamMap(e,r=!1){const i=await e.getStats(),a=r?this.getProducerStatsFromReport(this.parseRTCReport(i,["outbound-rtp","remote-inbound-rtp"],!1,e.id))[0]:void 0;for(const o of i.values())switch(o.type){case"outbound-rtp":{this.outboundProducerMap.set(o.id,e.id);break}}return a}async generateConsumerStreamMap(e,r=!1){const i=await e.getStats(),a=r?this.getConsumerStatsFromReport(this.parseRTCReport(i,["inbound-rtp"],!1,e.id))[0]:void 0;for(const o of i.values())switch(o.type){case"inbound-rtp":{this.inboundConsumerMap.set(o.id,e.id);break}}return a}deregisterProducer(e){this.outboundProducerMap.forEach((r,i)=>{r===e.id&&this.outboundProducerMap.delete(i)}),this.pausedProducerMap.delete(e.id),this.screenShareProducers.delete(e.id)}deregisterConsumer(e){this.inboundConsumerMap.forEach((r,i)=>{r===e.id&&this.inboundConsumerMap.delete(i)}),this.consumerPeerIdMap.delete(e.id),this.pausedConsumerMap.delete(e.id),this.screenShareConsumers.delete(e.id)}getIceCandidateStats(e){var r;return{id:e.id,type:e.candidateType||e.type,address:e.address,port:e.port,url:e.url,protocol:(r=e.relayProtocol)!=null?r:e.protocol,networkType:e.networkType,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort}}getWorkingSimulcastVideoStats(e){return e.find(i=>{const a=i.framesEncoded>0,o=i.packetsSent>0,c=i.frameWidth&&i.frameHeight;return a&&o&&!!c})||e[e.length-1]}parseRTCReport(e,r=[],i=!1,a=void 0,o=void 0){var P,C,_,N,U,D,$,G,ee,Xe,as,si,os;const c=e,d=new um,l=r.length?new Set(r):void 0,h=[],p=[],f=[],T=new Map,E=new Map;for(const I of c.values()){if(l){if(l.size===0)break;if(l.has(I.type))i&&l.delete(I.type);else continue}switch(I.type){case"local-candidate":{h.push(this.getIceCandidateStats(I));break}case"remote-candidate":{p.push(this.getIceCandidateStats(I));break}case"candidate-pair":{const{nominated:y}=I,{selected:w}=I,V=I,pe={nominated:y!=null?y:w,currentRoundTripTime:V.currentRoundTripTime,totalRoundTripTime:V.totalRoundTripTime,bytesReceived:V.bytesReceived,bytesSent:V.bytesSent,availableOutgoingBitrate:V.availableOutgoingBitrate,availableIncomingBitrate:V.availableIncomingBitrate,lastPacketReceivedTimestamp:V.lastPacketReceivedTimestamp,lastPacketSentTimestamp:V.lastPacketSentTimestamp,localCandidateId:V.localCandidateId,remoteCandidateId:V.remoteCandidateId,bytesDiscardedOnSend:V.bytesDiscardedOnSend,packetsSent:V.packetsSent,packetsReceived:V.packetsReceived,packetsDiscardedOnSend:V.packetsDiscardedOnSend};f.push(pe),(I.nominated===!0||I.selected===!0)&&(d.candidatePair=pe);break}case"transport":{const y=I;o&&(o.producing&&(this.overallProducingTransportsStatsMap[o.id]||(this.overallProducingTransportsStatsMap[o.id]={totalPacketsSent:0})),o.consuming&&(this.overallConsumingTransportsStatsMap[o.id]||(this.overallConsumingTransportsStatsMap[o.id]={totalPacketsReceived:0})));const w={bytesReceived:y.bytesReceived,bytesSent:y.bytesSent,packetsSent:y.packetsSent,packetsReceived:y.packetsReceived,dtlsCipher:y.dtlsCipher,dtlsState:y.dtlsState,iceRole:y.iceRole};if(d.transport=w,o){if(o.producing){const V=this.overallProducingTransportsStatsMap[o.id];this.processProducingTransportStats(o.id,V,w)}if(o.consuming){const V=this.overallConsumingTransportsStatsMap[o.id];this.processConsumingTransportStats(o.id,V,w)}}break}case"remote-inbound-rtp":{const y=I,w={jitter:y.jitter,fractionLost:y.fractionLost,roundTripTime:y.roundTripTime,roundTripTimeMeasurements:y.roundTripTimeMeasurements,totalRoundTripTime:y.totalRoundTripTime,packetsLost:y.packetsLost};d.remoteInboundRtp.set(y.localId,w);break}case"outbound-rtp":{if(!this.outboundProducerMap.has(I.id))break;const y=I,w=a||this.outboundProducerMap.get(I.id),V=this.pausedProducerMap.get(w);if(V){if(V.lastReportCalculated===!0)break;this.pausedProducerMap.set(w,{lastReportCalculated:!0})}this.overallProducersStatsMap[w]||(this.overallProducersStatsMap[w]={totalVideoPacketsSent:0,totalAudioPacketsSent:0});const pe=this.overallProducersStatsMap[w];if(["video","audio"].includes(y.mediaType)||["video","audio"].includes(y.kind)){if(!this.outboundProducerMap.has(I.id)){d.staleProducerStreamMap=!0;break}const Ne=this.callStatsInstance.producers.get(w);if(((P=Ne==null?void 0:Ne.track)==null?void 0:P.readyState)==="ended")break;d.producerStreamMap.has(w)||d.producerStreamMap.set(w,{outboundVideoRtpId:[],outboundAudioRtpId:[]});const O={bytesSent:y.bytesSent,packetsSent:y.packetsSent,nackCount:y.nackCount,ssrc:y.ssrc,mid:y.mid,active:y.active,codecId:y.codecId,headerBytesSent:y.headerBytesSent||0,totalPacketSendDelay:y.totalPacketSendDelay||0};if(y.mediaType==="video"||y.kind==="video"){const k=y,Ve={frameHeight:k.frameHeight,frameWidth:k.frameWidth,framesEncoded:k.framesEncoded,framesDropped:k.framesDropped,framesPerSecond:k.framesPerSecond,framesSent:k.framesSent,keyFramesEncoded:k.keyFramesEncoded,firCount:k.firCount,encoderImplementation:k.encoderImplementation,hugeFramesSent:k.hugeFramesSent,pliCount:k.pliCount,qpSum:k.qpSum,qualityLimitationDurations:k.qualityLimitationDurations,qualityLimitationReason:k.qualityLimitationReason,qualityLimitationResolutionChanges:k.qualityLimitationResolutionChanges,totalEncodeTime:k.targetBitrate,totalPacketSendDelay:k.totalPacketSendDelay,retransmittedBytesSent:k.retransmittedBytesSent,retransmittedPacketsSent:k.retransmittedPacketsSent,scalabilityMode:k.scalabilityMode,powerEfficientEncoder:k.powerEfficientEncoder,...O};d.outboundVideoRtp.set(I.id,Ve),d.producerStreamMap.get(w).outboundVideoRtpId.push(I.id),this.processOutboundProducerVideoStats(w,pe,Ve)}else if(y.mediaType==="audio"||y.kind==="audio"){const k=y,Ve={retransmittedBytesSent:k.retransmittedBytesSent,retransmittedPacketsSent:k.retransmittedPacketsSent,...O};d.outboundAudioRtp.set(I.id,Ve),d.producerStreamMap.get(w).outboundAudioRtpId.push(I.id),this.processOutboundProducerAudioStats(w,pe,Ve)}}else this.callStatsInstance.logger.error(`Callstats: Unknown Outbound-rtp. mediatype: ${y.mediaType} kind: ${y.kind}`);break}case"inbound-rtp":{if(!this.inboundConsumerMap.has(I.id))break;const y=I,w=a||this.inboundConsumerMap.get(I.id),V=this.pausedConsumerMap.get(w);if(V){if(V.lastReportCalculated===!0)break;this.pausedConsumerMap.set(w,{lastReportCalculated:!0})}if(y.ssrc===1234)break;this.overallConsumersStatsMap[w]||(this.overallConsumersStatsMap[w]={totalVideoPacketsReceived:0,totalAudioPacketsReceived:0});const pe=this.overallConsumersStatsMap[w];if(["video","audio"].includes(y.mediaType)||["video","audio"].includes(y.kind)){if(!this.inboundConsumerMap.has(I.id)){d.staleConsumerStreamMap=!0;break}d.consumerStreamMap.has(w)||d.consumerStreamMap.set(w,{inboundVideoRtpId:[],inboundAudioRtpId:[]});const Ne={bytesReceived:y.bytesReceived,packetsReceived:y.packetsReceived,packetsLost:y.packetsLost>=0?y.packetsLost:0,jitter:y.jitter,nackCount:y.nackCount,jitterBufferDelay:y.jitterBufferDelay,jitterBufferEmittedCount:y.jitterBufferEmittedCount,lastPacketReceivedTimestamp:y.lastPacketReceivedTimestamp,ssrc:y.ssrc,mid:y.mid,codecId:y.codecId,headerBytesReceived:y.headerBytesReceived||0,packetsDiscarded:y.packetsDiscarded||0,jitterBufferMinimumDelay:y.jitterBufferMinimumDelay||0,jitterBufferTargetDelay:y.jitterBufferTargetDelay||0};if(y.mediaType==="video"||y.kind==="video"){const O=y,k={frameHeight:O.frameHeight,frameWidth:O.frameWidth,framesDecoded:O.framesDecoded,framesDropped:O.framesDropped,framesPerSecond:O.framesPerSecond,framesReceived:O.framesReceived,keyFramesDecoded:O.keyFramesDecoded,firCount:O.firCount,decoderImplementation:O.decoderImplementation,pliCount:O.pliCount,totalProcessingDelay:O.totalProcessingDelay,qpSum:O.qpSum||0,totalAssemblyTime:O.totalAssemblyTime||0,totalDecodeTime:O.totalDecodeTime||0,totalFreezesDuration:O.totalFreezesDuration||0,totalInterFrameDelay:O.totalInterFrameDelay||0,totalPausesDuration:O.totalPausesDuration||0,totalSquaredInterFrameDelay:O.totalSquaredInterFrameDelay||0,freezeCount:O.freezeCount||0,pauseCount:O.pauseCount||0,powerEfficientDecoder:O.powerEfficientDecoder,...Ne};k.score=dm({frameWidth:k.frameWidth||0,framesDecoded:(k.framesDecoded||0)-(((C=this.videoConsumerToStatsMap.get(w))==null?void 0:C.framesDecoded)||0),framesPerSecond:k.framesPerSecond||0,packetsLost:(k.packetsLost||0)-(((_=this.videoConsumerToStatsMap.get(w))==null?void 0:_.packetsLost)||0),packetsReceived:(k.packetsReceived||0)-(((N=this.videoConsumerToStatsMap.get(w))==null?void 0:N.packetsReceived)||0),jitter:k.jitter||0,isScreenShare:this.screenShareConsumers.has(w)}),E.set(w,{score:+(k.score*10).toFixed(),frameWidth:k.frameWidth||0,frameHeight:k.frameHeight||0,framesPerSecond:k.framesPerSecond||0,packetsLostPercentage:fd({packetsLost:(k.packetsLost||0)-(((U=this.videoConsumerToStatsMap.get(w))==null?void 0:U.packetsLost)||0),packetsReceived:(k.packetsReceived||0)-(((D=this.videoConsumerToStatsMap.get(w))==null?void 0:D.packetsReceived)||0)}),jitter:k.jitter||0,isScreenShare:this.screenShareConsumers.has(w),bitrate:((k.bytesReceived||0)-((($=this.videoConsumerToStatsMap.get(w))==null?void 0:$.bytesReceived)||0))*8/7}),this.videoConsumerToStatsMap.set(w,k),d.inboundVideoRtp.set(I.id,k),d.consumerStreamMap.get(w).inboundVideoRtpId.push(I.id),this.processInboundConsumerVideoStats(w,pe,k)}else if(y.mediaType==="audio"||y.kind==="audio"){const O=y,k={audioLevel:O.audioLevel,concealedSamples:O.concealedSamples,concealmentEvents:O.concealmentEvents,totalAudioEnergy:O.totalAudioEnergy,totalSamplesDuration:O.totalSamplesDuration,totalSamplesReceived:O.totalSamplesReceived,fecPacketsDiscarded:O.fecPacketsDiscarded||0,fecPacketsReceived:O.fecPacketsReceived||0,insertedSamplesForDeceleration:O.insertedSamplesForDeceleration||0,removedSamplesForAcceleration:O.removedSamplesForAcceleration||0,silentConcealedSamples:O.silentConcealedSamples||0,playoutId:O.playoutId,...Ne};k.score=cm({concealmentEvents:(k.concealmentEvents||0)-(((G=this.audioConsumerToStatsMap.get(w))==null?void 0:G.concealmentEvents)||0),packetsLost:(k.packetsLost||0)-(((ee=this.audioConsumerToStatsMap.get(w))==null?void 0:ee.packetsLost)||0),packetsReceived:(k.packetsReceived||0)-(((Xe=this.audioConsumerToStatsMap.get(w))==null?void 0:Xe.packetsReceived)||0),jitter:k.jitter||0}),E.set(w,{score:+(k.score*10).toFixed(),packetsLostPercentage:fd({packetsLost:(k.packetsLost||0)-(((as=this.audioConsumerToStatsMap.get(w))==null?void 0:as.packetsLost)||0),packetsReceived:(k.packetsReceived||0)-(((si=this.audioConsumerToStatsMap.get(w))==null?void 0:si.packetsReceived)||0)}),jitter:k.jitter||0,isScreenShare:this.screenShareConsumers.has(w),bitrate:((k.bytesReceived||0)-(((os=this.audioConsumerToStatsMap.get(w))==null?void 0:os.bytesReceived)||0))*8/7}),this.audioConsumerToStatsMap.set(w,k),d.inboundAudioRtp.set(I.id,k),d.consumerStreamMap.get(w).inboundAudioRtpId.push(I.id),this.processInboundConsumerAudioStats(w,pe,k)}}else this.callStatsInstance.logger.error(`Callstats: Unknown Inbound-rtp. mediatype: ${y.mediaType} kind: ${y.kind}`);break}}}if(d.producerStreamMap.forEach((I,y)=>{var w,V,pe,Ne,O,k,Ve,Pr,Fs,Ba,Ha,qa,ja,Ga,Wa,Ja,Ka,za,Ya,Qa,Xa,Za,eo;if(I.outboundVideoRtpId.length>0){const oe=[];I.outboundVideoRtpId.forEach(Jl=>{oe.push(d.outboundVideoRtp.get(Jl))});const Z=this.getWorkingSimulcastVideoStats(oe);Z.score=am({frameWidth:Z.frameWidth||0,framesPerSecond:Z.framesPerSecond||0,jitter:((w=Z.remoteData)==null?void 0:w.jitter)||0,isScreenShare:this.screenShareProducers.has(y),packetsSent:(Z.packetsSent||0)-(((V=this.videoProducerToStatsMap.get(y))==null?void 0:V.packetsSent)||0),packetsLost:(((pe=Z.remoteData)==null?void 0:pe.packetsLost)||0)-(((O=(Ne=this.videoProducerToStatsMap.get(y))==null?void 0:Ne.remoteData)==null?void 0:O.packetsLost)||0),framesEncoded:(Z.framesEncoded||0)-(((k=this.videoProducerToStatsMap.get(y))==null?void 0:k.framesEncoded)||0)}),T.set(y,{score:+(Z.score*10).toFixed(),frameWidth:Z.frameWidth||0,frameHeight:Z.frameHeight||0,framesPerSecond:Z.framesPerSecond||0,jitter:((Ve=Z.remoteData)==null?void 0:Ve.jitter)||0,isScreenShare:this.screenShareProducers.has(y),packetsLostPercentage:md({packetsSent:(Z.packetsSent||0)-(((Pr=this.videoProducerToStatsMap.get(y))==null?void 0:Pr.packetsSent)||0),packetsLost:(((Fs=Z.remoteData)==null?void 0:Fs.packetsLost)||0)-(((Ha=(Ba=this.videoProducerToStatsMap.get(y))==null?void 0:Ba.remoteData)==null?void 0:Ha.packetsLost)||0)}),bitrate:((Z.bytesSent||0)-(((qa=this.videoProducerToStatsMap.get(y))==null?void 0:qa.bytesSent)||0))*8/7,cpuLimitations:Z.qualityLimitationReason==="cpu",bandwidthLimitations:Z.qualityLimitationReason==="bandwidth"}),this.videoProducerToStatsMap.set(y,Z)}else if(I.outboundAudioRtpId.length>0){const oe=d.outboundAudioRtp.get(I.outboundAudioRtpId[0]);oe.score=nm({packetsSent:(oe.packetsSent||0)-(((ja=this.audioProducerToStatsMap.get(y))==null?void 0:ja.packetsSent)||0),packetsLost:(((Ga=oe.remoteData)==null?void 0:Ga.packetsLost)||0)-(((Ja=(Wa=this.audioProducerToStatsMap.get(y))==null?void 0:Wa.remoteData)==null?void 0:Ja.packetsLost)||0),jitter:((Ka=oe.remoteData)==null?void 0:Ka.jitter)||0}),T.set(y,{score:+(oe.score*10).toFixed(),bitrate:((oe.bytesSent||0)-(((za=this.audioProducerToStatsMap.get(y))==null?void 0:za.bytesSent)||0))*8/7,packetsLostPercentage:md({packetsSent:(oe.packetsSent||0)-(((Ya=this.audioProducerToStatsMap.get(y))==null?void 0:Ya.packetsSent)||0),packetsLost:(((Qa=oe.remoteData)==null?void 0:Qa.packetsLost)||0)-(((Za=(Xa=this.audioProducerToStatsMap.get(y))==null?void 0:Xa.remoteData)==null?void 0:Za.packetsLost)||0)}),jitter:((eo=oe.remoteData)==null?void 0:eo.jitter)||0,isScreenShare:this.screenShareProducers.has(y)}),this.audioProducerToStatsMap.set(y,oe)}}),f.forEach(I=>{const y=h.find(V=>V.id===I.localCandidateId?(I.localCandidateId=V.id,V):null),w=p.find(V=>V.id===I.remoteCandidateId?(I.remoteCandidateId=V.id,V):null);y&&(I.localCandidateType=y.type,I.localCandidateAddress=Qr(y.address),I.localCandidatePort=y.port,I.localCandidateProtocol=y.protocol,I.localCandidateUrl=y.url,I.localCandidateNetworkType=y.networkType,I.localCandidateRelatedAddress=Qr(y.relatedAddress),I.localCandidateRelatedPort=y.relatedPort),w&&(I.remoteCandidateType=w.type,I.remoteCandidateAddress=Qr(w.address),I.remoteCandidatePort=w.port,I.remoteCandidateProtocol=w.protocol,I.remoteCandidateUrl=w.url)}),d.candidatePair&&(d.transport?(d.transport.totalRoundTripTime=d.candidatePair.totalRoundTripTime,d.transport.availableOutgoingBitrate=d.candidatePair.availableOutgoingBitrate,d.transport.availableIncomingBitrate=d.candidatePair.availableIncomingBitrate,d.transport.roundTripTime=d.candidatePair.currentRoundTripTime):d.transport={bytesReceived:d.candidatePair.bytesReceived,bytesSent:d.candidatePair.bytesSent,totalRoundTripTime:d.candidatePair.totalRoundTripTime,availableOutgoingBitrate:d.candidatePair.availableOutgoingBitrate,availableIncomingBitrate:d.candidatePair.availableIncomingBitrate,roundTripTime:d.candidatePair.currentRoundTripTime}),d.transport&&(d.transport.candidatePairs=f),d.transport&&!d.transport.roundTripTime){let I=0,y=0;d.remoteInboundRtp.forEach((w,V)=>{w.roundTripTime&&w.roundTripTime>I&&(I=w.roundTripTime,y=w.totalRoundTripTime)}),d.transport.roundTripTime=I,d.transport.totalRoundTripTime=y}if(E.size>0)try{this.observer.emit("consumer_score",E)}catch(I){}if(T.size>0)try{this.observer.emit("producer_score",T)}catch(I){}return d}async getProducersReport(e){const r=e.map(i=>this.generateProducerStreamMap(i,!0));return r.length>0?Promise.all(r):void 0}async getConsumersReport(e){const r=e.map(i=>this.generateConsumerStreamMap(i,!0));return r.length>0?Promise.all(r):void 0}async getTransportReport(e){return e.getStats()}async getProcessedStats(e,r,i){const a=await this.getTransportReport(e),o={producing:i,consuming:r,id:e.id},c=a,d=this.parseRTCReport(c,["transport","candidate-pair","inbound-rtp","outbound-rtp","remote-inbound-rtp","local-candidate","remote-candidate"],!1,void 0,o);if(!d)return;const l={stats:d.transport,transportId:e.id,consuming:r,producing:i},h=d.staleProducerStreamMap?void 0:this.getProducerStatsFromReport(d),p=d.staleConsumerStreamMap?void 0:this.getConsumerStatsFromReport(d);return{transportReport:l,producerReport:h,consumerReport:p}}getProducerStatsFromReport(e){const r=[];try{e.producerStreamMap.forEach((i,a)=>{var o,c;r.push({producerId:a,videoStats:i.outboundVideoRtpId.map(d=>e.outboundVideoRtp.get(d)),audioStats:i.outboundAudioRtpId.map(d=>e.outboundAudioRtp.get(d)),appData:((c=(o=this.callStatsInstance.producers)==null?void 0:o.get(a))==null?void 0:c.appData)||null})})}catch(i){this.callStatsInstance.logger.error("callStats::measurements::getProducerStatsFromReport",{error:{reason:i.reason,message:i.message}})}return r}getConsumerStatsFromReport(e){const r=[];try{e.consumerStreamMap.forEach((i,a)=>{const{peerId:o,producerId:c,appData:d}=this.consumerPeerIdMap.get(a);r.push({consumerId:a,peerId:o,producerId:c,appData:d,videoStats:i.inboundVideoRtpId.map(l=>e.inboundVideoRtp.get(l)),audioStats:i.inboundAudioRtpId.map(l=>e.inboundAudioRtp.get(l))})})}catch(i){console.error("getConsumersReport: ",i,e)}return r}async getUserLocation(){return new Promise((e,r)=>{try{navigator.geolocation?navigator.geolocation.getCurrentPosition(i=>{e(i)}):r()}catch(i){r(i)}})}async getConnectivity(e){try{const r={iceServers:e||Jh},i=new Promise((h,p)=>{try{const f=new Pv(r);f.addListener("done",h),f.addListener("failed",()=>{h({connectivity:!1})}),f.start(2e3)}catch(f){p(f)}}),a=new Promise((h,p)=>{try{const f=new _v(r);f.addListener("done",h),f.addListener("failed",()=>{h({connectivity:!1})}),f.start(2e3)}catch(f){p(f)}}),o=new Promise((h,p)=>{try{const f=new Cv(r);f.addListener("done",h),f.addListener("failed",()=>{h({connectivity:!1})}),f.start(2e3)}catch(f){p(f)}}),[c,d,l]=await Promise.all([i,a,o]);return{host:c==null?void 0:c.connectivity,relay:d==null?void 0:d.connectivity,reflexive:l==null?void 0:l.connectivity}}catch(r){return{host:!1,relay:!1,reflexive:!1}}}async getThroughput(e){try{const i=await new Promise((a,o)=>{try{const c={iceServers:e||Jh},d=new Ev(c);d.addListener("done",a),d.addListener("failed",o),d.start(1e4)}catch(c){o(c)}});return{throughput:i.throughput,fractionalLoss:0,RTT:i.RTT,jitter:0,backendRTT:i.backendRTT}}catch(r){return}}async getIPDetails(){var e,r;try{return this.ipDetails||(this.ipDetails=await ah.getIPDetails({peerId:(e=this.callStatsInstance)==null?void 0:e.peerId,apiHostnames:(r=this.callStatsInstance)==null?void 0:r.apiHostnames,logger:this.callStatsInstance.logger})),this.ipDetails}catch(i){return}}async getNetworkQuality(e){const[r,i]=await Promise.all([this.getConnectivity(e),this.getThroughput(e)]);return{connectivity:r,throughput:i==null?void 0:i.throughput,fractionalLoss:i==null?void 0:i.fractionalLoss,RTT:i==null?void 0:i.RTT,jitter:i==null?void 0:i.jitter,backendRTT:i==null?void 0:i.backendRTT}}async getNetworkInfo(e,r=!1){var c,d;if(r){const l=await this.getIPDetails();return{ipDetails:l,effectiveNetworkType:(c=navigator.connection)==null?void 0:c.effectiveType,location:l!=null&&l.loc?Kh(l==null?void 0:l.loc):void 0}}const[i,a,o]=await Promise.all([this.getConnectivity(e),this.getThroughput(e),this.getIPDetails()]);return{ipDetails:o,effectiveNetworkType:(d=navigator.connection)==null?void 0:d.effectiveType,location:o!=null&&o.loc?Kh(o==null?void 0:o.loc):void 0,turnConnectivity:i?i.host||i.relay||i.reflexive:!1,connectivity:i,throughput:a==null?void 0:a.throughput,fractionalLoss:a==null?void 0:a.fractionalLoss,RTT:a==null?void 0:a.RTT,jitter:a==null?void 0:a.jitter,backendRTT:a==null?void 0:a.backendRTT}}}class Rv extends hm{}class pm extends hm{constructor(){super(...arguments);u(this,"producerMap",new Map);u(this,"consumerMap",new Map)}async registerProducer(e){this.producerMap.set(e.id,e),await this.generateProducerStreamMap(e),e.on("close",this.deregisterProducer.bind(this,e)),e.on("pause",this.pauseProducer.bind(this,e.id)),e.on("resume",this.resumeProducer.bind(this,e.id)),e.appData.screenShare===!0&&this.screenShareProducers.add(e.id)}async registerConsumer(e){this.consumerMap.set(e.id,e),await this.generateConsumerStreamMap(e),this.consumerPeerIdMap.set(e.id,{producerId:e.producerId,peerId:e.appData.peerId,appData:e.appData}),e.on("close",this.deregisterConsumer.bind(this,e)),e.on("pause",this.pauseConsumer.bind(this,e.id)),e.on("resume",this.resumeConsumer.bind(this,e.id)),e.appData.screenShare===!0&&this.screenShareConsumers.add(e.id)}async generateConsumerStreamMap(e,r=!1){const i=await e.getStats(),a=this.parseRTCReport(i,["inbound-rtp"],!1,e.id),o=[...a.consumerStreamMap.values()][0],c=r?this.getConsumerStatsFromParsedConsumerStats(a,o,e.id):void 0;for(const d of i.values())switch(d.type){case"inbound-rtp":{this.inboundConsumerMap.set(d.id,e.id);break}}return c}deregisterProducer(e){this.producerMap.delete(e.id),this.outboundProducerMap.forEach((r,i)=>{r===e.id&&this.outboundProducerMap.delete(i)}),this.pausedProducerMap.delete(e.id),this.screenShareProducers.delete(e.id)}deregisterConsumer(e){this.consumerMap.delete(e.id),this.inboundConsumerMap.forEach((r,i)=>{r===e.id&&this.inboundConsumerMap.delete(i)}),this.consumerPeerIdMap.delete(e.id),this.pausedConsumerMap.delete(e.id),this.screenShareConsumers.delete(e.id)}getIceCandidateStats(e){var r;return{id:e.id,type:e.candidateType||e.type,address:e.address,port:e.port,url:e.url,protocol:(r=e.relayProtocol)!=null?r:e.protocol,networkType:e.networkType,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort}}parseRTCReport(e,r=[],i=!1,a=void 0,o=void 0){var P,C,_,N,U,D,$,G,ee,Xe,as,si,os;const c=e,d=new um,l=r.length?new Set(r):void 0,h=[],p=[],f=[],T=new Map,E=new Map;for(const I of c.values()){if(l){if(l.size===0)break;if(l.has(I.type))i&&l.delete(I.type);else continue}switch(I.type){case"local-candidate":{h.push(this.getIceCandidateStats(I));break}case"remote-candidate":{p.push(this.getIceCandidateStats(I));break}case"candidate-pair":{const{nominated:y}=I,{selected:w}=I,V=I,pe={nominated:y!=null?y:w,currentRoundTripTime:V.currentRoundTripTime,totalRoundTripTime:V.totalRoundTripTime,bytesReceived:V.bytesReceived,bytesSent:V.bytesSent,availableOutgoingBitrate:V.availableOutgoingBitrate,availableIncomingBitrate:V.availableIncomingBitrate,lastPacketReceivedTimestamp:V.lastPacketReceivedTimestamp,lastPacketSentTimestamp:V.lastPacketSentTimestamp,localCandidateId:V.localCandidateId,remoteCandidateId:V.remoteCandidateId,bytesDiscardedOnSend:V.bytesDiscardedOnSend,packetsSent:V.packetsSent,packetsReceived:V.packetsReceived,packetsDiscardedOnSend:V.packetsDiscardedOnSend};f.push(pe),(I.nominated===!0||I.selected===!0)&&(d.candidatePair=pe);break}case"transport":{const y=I;o&&(o.producing&&(this.overallProducingTransportsStatsMap[o.id]||(this.overallProducingTransportsStatsMap[o.id]={totalPacketsSent:0})),o.consuming&&(this.overallConsumingTransportsStatsMap[o.id]||(this.overallConsumingTransportsStatsMap[o.id]={totalPacketsReceived:0})));const w={bytesReceived:y.bytesReceived,bytesSent:y.bytesSent,packetsSent:y.packetsSent,packetsReceived:y.packetsReceived,dtlsCipher:y.dtlsCipher,dtlsState:y.dtlsState,iceRole:y.iceRole};if(d.transport=w,o){if(o.producing){const V=this.overallProducingTransportsStatsMap[o.id];this.processProducingTransportStats(o.id,V,w)}if(o.consuming){const V=this.overallConsumingTransportsStatsMap[o.id];this.processConsumingTransportStats(o.id,V,w)}}break}case"remote-inbound-rtp":{const y=I,w={jitter:y.jitter,fractionLost:y.fractionLost,roundTripTime:y.roundTripTime,roundTripTimeMeasurements:y.roundTripTimeMeasurements,totalRoundTripTime:y.totalRoundTripTime,packetsLost:y.packetsLost};d.remoteInboundRtp.set(y.localId,w);break}case"outbound-rtp":{if(!this.outboundProducerMap.has(I.id))break;const y=I,w=a||this.outboundProducerMap.get(I.id),V=this.pausedProducerMap.get(w);if(V){if(V.lastReportCalculated===!0)break;this.pausedProducerMap.set(w,{lastReportCalculated:!0})}this.overallProducersStatsMap[w]||(this.overallProducersStatsMap[w]={totalVideoPacketsSent:0,totalAudioPacketsSent:0});const pe=this.overallProducersStatsMap[w];if(["video","audio"].includes(y.mediaType)||["video","audio"].includes(y.kind)){if(!this.outboundProducerMap.has(I.id)){d.staleProducerStreamMap=!0;break}const Ne=this.callStatsInstance.producers.get(w);if(((P=Ne==null?void 0:Ne.track)==null?void 0:P.readyState)==="ended")break;d.producerStreamMap.has(w)||d.producerStreamMap.set(w,{outboundVideoRtpId:[],outboundAudioRtpId:[]});const O={bytesSent:y.bytesSent,packetsSent:y.packetsSent,nackCount:y.nackCount,ssrc:y.ssrc,mid:y.mid,active:y.active,codecId:y.codecId,headerBytesSent:y.headerBytesSent||0,totalPacketSendDelay:y.totalPacketSendDelay||0};if(y.mediaType==="video"||y.kind==="video"){const k=y,Ve={frameHeight:k.frameHeight,frameWidth:k.frameWidth,framesEncoded:k.framesEncoded,framesDropped:k.framesDropped?k.framesDropped:k.droppedFrames,framesPerSecond:k.framesPerSecond?k.framesPerSecond:k.framerateMean,framesSent:k.framesSent,keyFramesEncoded:k.keyFramesEncoded,firCount:k.firCount,encoderImplementation:k.encoderImplementation,hugeFramesSent:k.hugeFramesSent,pliCount:k.pliCount,qpSum:k.qpSum,qualityLimitationReason:k.qualityLimitationReason,qualityLimitationDurations:k.qualityLimitationDurations,qualityLimitationResolutionChanges:k.qualityLimitationResolutionChanges,totalEncodeTime:k.totalEncodeTime,totalPacketSendDelay:k.totalEncodeTime,retransmittedBytesSent:k.retransmittedBytesSent,retransmittedPacketsSent:k.retransmittedPacketsSent,scalabilityMode:k.scalabilityMode,powerEfficientEncoder:k.powerEfficientEncoder,...O};d.outboundVideoRtp.set(I.id,Ve),d.producerStreamMap.get(w).outboundVideoRtpId.push(I.id),this.processOutboundProducerVideoStats(w,pe,Ve)}else if(y.mediaType==="audio"||y.kind==="audio"){const k=y,Ve={retransmittedBytesSent:k.retransmittedBytesSent,retransmittedPacketsSent:k.retransmittedPacketsSent,...O};d.outboundAudioRtp.set(I.id,Ve),d.producerStreamMap.get(w).outboundAudioRtpId.push(I.id),this.processOutboundProducerAudioStats(w,pe,Ve)}}else this.callStatsInstance.logger.error(`Callstats: Unknown Outbound-rtp. mediatype: ${y.mediaType} kind: ${y.kind}`);break}case"inbound-rtp":{if(!this.inboundConsumerMap.has(I.id))break;const y=I,w=a||this.inboundConsumerMap.get(I.id),V=this.pausedConsumerMap.get(w);if(V){if(V.lastReportCalculated===!0)break;this.pausedConsumerMap.set(w,{lastReportCalculated:!0})}if(y.ssrc===1234)break;this.overallConsumersStatsMap[w]||(this.overallConsumersStatsMap[w]={totalVideoPacketsReceived:0,totalAudioPacketsReceived:0});const pe=this.overallConsumersStatsMap[w];if(["video","audio"].includes(y.mediaType)||["video","audio"].includes(y.kind)){if(!this.inboundConsumerMap.has(I.id)){d.staleConsumerStreamMap=!0;break}d.consumerStreamMap.has(w)||d.consumerStreamMap.set(w,{inboundVideoRtpId:[],inboundAudioRtpId:[]});const Ne={bytesReceived:y.bytesReceived,packetsReceived:y.packetsReceived,packetsLost:y.packetsLost>=0?y.packetsLost:0,jitter:y.jitter,nackCount:y.nackCount,jitterBufferDelay:y.jitterBufferDelay,jitterBufferEmittedCount:y.jitterBufferEmittedCount,lastPacketReceivedTimestamp:y.lastPacketReceivedTimestamp,ssrc:y.ssrc,mid:y.mid,codecId:y.codecId,headerBytesReceived:y.headerBytesReceived||0,packetsDiscarded:y.packetsDiscarded||0,jitterBufferMinimumDelay:y.jitterBufferMinimumDelay||0,jitterBufferTargetDelay:y.jitterBufferTargetDelay||0};if(y.mediaType==="video"||y.kind==="video"){const O=y,k={frameHeight:O.frameHeight,frameWidth:O.frameWidth,framesDecoded:O.framesDecoded,framesDropped:O.framesDropped?O.framesDropped:O.droppedFrames,framesPerSecond:O.framesPerSecond?O.framesPerSecond:O.framerateMean,framesReceived:O.framesReceived,keyFramesDecoded:O.keyFramesDecoded,firCount:O.firCount,decoderImplementation:O.decoderImplementation,pliCount:O.pliCount,totalProcessingDelay:O.totalProcessingDelay,qpSum:O.qpSum||0,totalAssemblyTime:O.totalAssemblyTime||0,totalDecodeTime:O.totalDecodeTime||0,totalFreezesDuration:O.totalFreezesDuration||0,totalInterFrameDelay:O.totalInterFrameDelay||0,totalPausesDuration:O.totalPausesDuration||0,totalSquaredInterFrameDelay:O.totalSquaredInterFrameDelay||0,freezeCount:O.freezeCount||0,pauseCount:O.pauseCount||0,powerEfficientDecoder:O.powerEfficientDecoder,...Ne};k.score=dm({frameWidth:k.frameWidth||0,framesDecoded:(k.framesDecoded||0)-(((C=this.videoConsumerToStatsMap.get(w))==null?void 0:C.framesDecoded)||0),framesPerSecond:k.framesPerSecond||0,packetsLost:(k.packetsLost||0)-(((_=this.videoConsumerToStatsMap.get(w))==null?void 0:_.packetsLost)||0),packetsReceived:(k.packetsReceived||0)-(((N=this.videoConsumerToStatsMap.get(w))==null?void 0:N.packetsReceived)||0),jitter:k.jitter||0,isScreenShare:this.screenShareConsumers.has(w)}),E.set(w,{score:+(k.score*10).toFixed(),frameWidth:k.frameWidth||0,frameHeight:k.frameHeight||0,framesPerSecond:k.framesPerSecond||0,packetsLostPercentage:fd({packetsLost:(k.packetsLost||0)-(((U=this.videoConsumerToStatsMap.get(w))==null?void 0:U.packetsLost)||0),packetsReceived:(k.packetsReceived||0)-(((D=this.videoConsumerToStatsMap.get(w))==null?void 0:D.packetsReceived)||0)}),jitter:k.jitter||0,isScreenShare:this.screenShareConsumers.has(w),bitrate:((k.bytesReceived||0)-((($=this.videoConsumerToStatsMap.get(w))==null?void 0:$.bytesReceived)||0))*8/7}),this.videoConsumerToStatsMap.set(w,k),d.inboundVideoRtp.set(I.id,k),d.consumerStreamMap.get(w).inboundVideoRtpId.push(I.id),this.processInboundConsumerVideoStats(w,pe,k)}else if(y.mediaType==="audio"||y.kind==="audio"){const O=y,k={audioLevel:O.audioLevel,concealedSamples:O.concealedSamples,concealmentEvents:O.concealmentEvents,totalAudioEnergy:O.totalAudioEnergy,totalSamplesDuration:O.totalSamplesDuration,totalSamplesReceived:O.totalSamplesReceived,fecPacketsDiscarded:O.fecPacketsDiscarded||0,fecPacketsReceived:O.fecPacketsReceived||0,insertedSamplesForDeceleration:O.insertedSamplesForDeceleration||0,removedSamplesForAcceleration:O.removedSamplesForAcceleration||0,silentConcealedSamples:O.silentConcealedSamples||0,playoutId:O.playoutId,...Ne};k.score=cm({concealmentEvents:(k.concealmentEvents||0)-(((G=this.audioConsumerToStatsMap.get(w))==null?void 0:G.concealmentEvents)||0),packetsLost:(k.packetsLost||0)-(((ee=this.audioConsumerToStatsMap.get(w))==null?void 0:ee.packetsLost)||0),packetsReceived:(k.packetsReceived||0)-(((Xe=this.audioConsumerToStatsMap.get(w))==null?void 0:Xe.packetsReceived)||0),jitter:k.jitter||0}),E.set(w,{score:+(k.score*10).toFixed(),packetsLostPercentage:fd({packetsLost:(k.packetsLost||0)-(((as=this.audioConsumerToStatsMap.get(w))==null?void 0:as.packetsLost)||0),packetsReceived:(k.packetsReceived||0)-(((si=this.audioConsumerToStatsMap.get(w))==null?void 0:si.packetsReceived)||0)}),jitter:k.jitter||0,isScreenShare:this.screenShareConsumers.has(w),bitrate:((k.bytesReceived||0)-(((os=this.audioConsumerToStatsMap.get(w))==null?void 0:os.bytesReceived)||0))*8/7}),this.audioConsumerToStatsMap.set(w,k),d.inboundAudioRtp.set(I.id,k),d.consumerStreamMap.get(w).inboundAudioRtpId.push(I.id),this.processInboundConsumerAudioStats(w,pe,k)}}else this.callStatsInstance.logger.error(`Callstats: Unknown Inbound-rtp. mediatype: ${y.mediaType} kind: ${y.kind}`);break}}}if(d.producerStreamMap.forEach((I,y)=>{var w,V,pe,Ne,O,k,Ve,Pr,Fs,Ba,Ha,qa,ja,Ga,Wa,Ja,Ka,za,Ya,Qa,Xa,Za,eo;if(I.outboundVideoRtpId.length>0){const oe=[];I.outboundVideoRtpId.forEach(Jl=>{oe.push(d.outboundVideoRtp.get(Jl))});const Z=this.getWorkingSimulcastVideoStats(oe);Z.score=am({frameWidth:Z.frameWidth||0,framesPerSecond:Z.framesPerSecond||0,jitter:((w=Z.remoteData)==null?void 0:w.jitter)||0,isScreenShare:this.screenShareProducers.has(y),packetsSent:(Z.packetsSent||0)-(((V=this.videoProducerToStatsMap.get(y))==null?void 0:V.packetsSent)||0),packetsLost:(((pe=Z.remoteData)==null?void 0:pe.packetsLost)||0)-(((O=(Ne=this.videoProducerToStatsMap.get(y))==null?void 0:Ne.remoteData)==null?void 0:O.packetsLost)||0),framesEncoded:(Z.framesEncoded||0)-(((k=this.videoProducerToStatsMap.get(y))==null?void 0:k.framesEncoded)||0)}),T.set(y,{score:+(Z.score*10).toFixed(),frameWidth:Z.frameWidth||0,frameHeight:Z.frameHeight||0,framesPerSecond:Z.framesPerSecond||0,jitter:((Ve=Z.remoteData)==null?void 0:Ve.jitter)||0,isScreenShare:this.screenShareProducers.has(y),packetsLostPercentage:md({packetsSent:(Z.packetsSent||0)-(((Pr=this.videoProducerToStatsMap.get(y))==null?void 0:Pr.packetsSent)||0),packetsLost:(((Fs=Z.remoteData)==null?void 0:Fs.packetsLost)||0)-(((Ha=(Ba=this.videoProducerToStatsMap.get(y))==null?void 0:Ba.remoteData)==null?void 0:Ha.packetsLost)||0)}),bitrate:((Z.bytesSent||0)-(((qa=this.videoProducerToStatsMap.get(y))==null?void 0:qa.bytesSent)||0))*8/7,cpuLimitations:Z.qualityLimitationReason==="cpu",bandwidthLimitations:Z.qualityLimitationReason==="bandwidth"}),this.videoProducerToStatsMap.set(y,Z)}else if(I.outboundAudioRtpId.length>0){const oe=d.outboundAudioRtp.get(I.outboundAudioRtpId[0]);oe.score=nm({packetsSent:(oe.packetsSent||0)-(((ja=this.audioProducerToStatsMap.get(y))==null?void 0:ja.packetsSent)||0),packetsLost:(((Ga=oe.remoteData)==null?void 0:Ga.packetsLost)||0)-(((Ja=(Wa=this.audioProducerToStatsMap.get(y))==null?void 0:Wa.remoteData)==null?void 0:Ja.packetsLost)||0),jitter:((Ka=oe.remoteData)==null?void 0:Ka.jitter)||0}),T.set(y,{score:+(oe.score*10).toFixed(),bitrate:((oe.bytesSent||0)-(((za=this.audioProducerToStatsMap.get(y))==null?void 0:za.bytesSent)||0))*8/7,packetsLostPercentage:md({packetsSent:(oe.packetsSent||0)-(((Ya=this.audioProducerToStatsMap.get(y))==null?void 0:Ya.packetsSent)||0),packetsLost:(((Qa=oe.remoteData)==null?void 0:Qa.packetsLost)||0)-(((Za=(Xa=this.audioProducerToStatsMap.get(y))==null?void 0:Xa.remoteData)==null?void 0:Za.packetsLost)||0)}),jitter:((eo=oe.remoteData)==null?void 0:eo.jitter)||0,isScreenShare:this.screenShareProducers.has(y)}),this.audioProducerToStatsMap.set(y,oe)}}),f.forEach(I=>{const y=h.find(V=>V.id===I.localCandidateId?(I.localCandidateId=V.id,V):null),w=p.find(V=>V.id===I.remoteCandidateId?(I.remoteCandidateId=V.id,V):null);y&&(I.localCandidateType=y.type,I.localCandidateAddress=Qr(y.address),I.localCandidatePort=y.port,I.localCandidateProtocol=y.protocol,I.localCandidateUrl=y.url,I.localCandidateNetworkType=y.networkType,I.localCandidateRelatedAddress=Qr(y.relatedAddress),I.localCandidateRelatedPort=y.relatedPort),w&&(I.remoteCandidateType=w.type,I.remoteCandidateAddress=Qr(w.address),I.remoteCandidatePort=w.port,I.remoteCandidateProtocol=w.protocol,I.remoteCandidateUrl=w.url)}),d.candidatePair&&(d.transport?(d.transport.bytesReceived=d.candidatePair.bytesReceived,d.transport.bytesSent=d.candidatePair.bytesSent,d.transport.totalRoundTripTime=d.candidatePair.totalRoundTripTime,d.transport.availableOutgoingBitrate=d.candidatePair.availableOutgoingBitrate,d.transport.availableIncomingBitrate=d.candidatePair.availableIncomingBitrate,d.transport.roundTripTime=d.candidatePair.currentRoundTripTime):d.transport={bytesReceived:d.candidatePair.bytesReceived,bytesSent:d.candidatePair.bytesSent,totalRoundTripTime:d.candidatePair.totalRoundTripTime,availableOutgoingBitrate:d.candidatePair.availableOutgoingBitrate,availableIncomingBitrate:d.candidatePair.availableIncomingBitrate,roundTripTime:d.candidatePair.currentRoundTripTime}),d.transport&&(d.transport.candidatePairs=f),d.transport&&!d.transport.roundTripTime){let I=0,y=0;d.remoteInboundRtp.forEach((w,V)=>{w.roundTripTime&&w.roundTripTime>I&&(I=w.roundTripTime,y=w.totalRoundTripTime)}),d.transport.roundTripTime=I,d.transport.totalRoundTripTime=y}if(E.size>0)try{this.observer.emit("consumer_score",E)}catch(I){}if(T.size>0)try{this.observer.emit("producer_score",T)}catch(I){}return d}getProducerStatsFromReport(e){const r=[];try{e.producerStreamMap.forEach((i,a)=>{const o=this.producerMap.get(a),c=o.track.getSettings(),d=i.outboundVideoRtpId.map(h=>{const p=e.outboundVideoRtp.get(h);return p.frameHeight||(p.frameHeight=c.height,p.frameWidth=c.width,p.framesPerSecond=c.frameRate),p}),l={producerId:a,appData:o.appData,videoStats:d,audioStats:i.outboundAudioRtpId.map(h=>e.outboundAudioRtp.get(h))};r.push(l)})}catch(i){console.error("getProducersReport: ",i,e)}return r}getConsumerStatsFromParsedConsumerStats(e,r,i){let a;try{const{peerId:o,producerId:c,appData:d}=this.consumerPeerIdMap.get(i),l=r==null?void 0:r.inboundVideoRtpId.map(h=>{const f=this.consumerMap.get(i).track.getSettings(),T=e.inboundVideoRtp.get(h);return T.frameHeight||(T.frameHeight=f.height,T.frameWidth=f.width,T.framesPerSecond=f.frameRate),T});a={consumerId:i,peerId:o,producerId:c,appData:d,videoStats:l,audioStats:r==null?void 0:r.inboundAudioRtpId.map(h=>e.inboundAudioRtp.get(h))}}catch(o){console.error("getConsumerStatsFromParsedConsumerStats: ",o,e)}return a}getConsumerStatsFromReport(e){const r=[];try{e.consumerStreamMap.forEach((i,a)=>{r.push(this.getConsumerStatsFromParsedConsumerStats(e,i,a))})}catch(i){console.error("getConsumerStatsFromReport: ",i,e)}return r}}class bv extends pm{}function Td(s,t,e,r){if(s!=null&&s.logger&&s.logger.error("Callstats::handleError",{error:r}),typeof e=="function"&&r instanceof t)e.call(null,r,s);else throw r}function zh(s,t,e){const r=s.value;return s.value=function(...i){try{const a=r.apply(this,i);return a&&a instanceof Promise?a.catch(o=>{Td(this,t,e,o)}):a}catch(a){Td(this,t,e,a)}return null},s}const z=(s,t)=>(e,r,i)=>{const a=i.value;return i.value=function(...o){try{const c=a.apply(this,o);return c&&c instanceof Promise?c.catch(d=>{Td(this,s,t,d)}):c}catch(c){Td(this,s,t,c)}return null},i},kv=(s,t)=>(e,r,i)=>{if(i)return zh(i,s,t);for(const a of Reflect.ownKeys(e.prototype).filter(o=>o!=="constructor")){const o=Object.getOwnPropertyDescriptor(e.prototype,a);o.value instanceof Function&&Object.defineProperty(e.prototype,a,zh(o,s,t))}};var J=globalThis&&globalThis.__decorate||function(s,t,e,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,e):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(s,t,e,r);else for(var c=s.length-1;c>=0;c--)(o=s[c])&&(a=(i<3?o(a):i>3?o(t,e,a):o(t,e))||a);return i>3&&a&&Object.defineProperty(t,e,a),a};const K=console;let j=class extends ot{constructor(e="https://api.testingv3.dyte.in",r="Blink",i=mo.PROD,a,o,c,d){super();u(this,"observer");u(this,"eventHandler");u(this,"measurements");u(this,"producingTransport");u(this,"consumingTransport");u(this,"producers",new Map);u(this,"consumers",new Map);u(this,"iceServers");u(this,"connectionInfoPromise");u(this,"pingStatsTimeout");u(this,"logger");u(this,"env");u(this,"apiHostnames");u(this,"peerId");u(this,"consumerSharedMediaStatesMap",new Map);u(this,"currentUserMediaStates",{});switch(this.env=i,this.apiHostnames=d,this.logger=o,this.peerId=c,this.eventHandler=new hv({logger:o,peerId:c,apiHostnames:d}),this.logger.debug("callStats::engineName: ",{engineName:r}),r){case"Blink":this.measurements=new Rv;break;case"Gecko":this.measurements=new pm;break;case"WebKit":this.measurements=new bv;break;default:throw Error(`Unknown engineName! ${r}`)}this.measurements.callStatsInstance=this,this.registerProducer=this.registerProducer.bind(this),this.registerConsumer=this.registerConsumer.bind(this),this.observer=new ot,this.measurements.observer.on("consumer_score",l=>{o.debug(`callStats::consumer_score ${[...l.entries()]}`),this.eventHandler.emit("consumer_score",l)}),this.measurements.observer.on("producer_score",l=>{o.debug(`callStats::producer_score ${[...l.entries()]}`),this.eventHandler.emit("producer_score",l)})}registerIceServers(e){this.iceServers=e}registerConsumer(e){var r;this.consumerSharedMediaStatesMap.has(e.id)||this.consumerSharedMediaStatesMap.set(e.id,{}),this.consumers.set(e.id,e),this.measurements.registerConsumer(e),this.logger.debug("callStats::registerConsumer",{consumerId:e.id,consumerkind:e.kind,isScreenShare:!!((r=e.appData)!=null&&r.screenShare)}),e.on("close",this.deRegisterConsumer.bind(this,e))}registerProducer(e){var r;this.producers.set(e.id,e),this.measurements.registerProducer(e),this.logger.debug("callStats::registerProducer",{producerId:e.id,producerKind:e.kind,isScreenShare:!!((r=e.appData)!=null&&r.screenShare)}),e.on("close",this.deRegisterProducer.bind(this,e))}sendConsumerSharedMediaStateEvent(e,r){this.consumerSharedMediaStatesMap.has(e)||this.consumerSharedMediaStatesMap.set(e,{});const i=this.consumerSharedMediaStatesMap.get(e);this.consumerSharedMediaStatesMap.set(e,Object.assign(i,r))}registerProducingTransport(e){var i;this.producingTransport=e,e.on("close",this.disconnectProducingTransport.bind(this,e)),e.on("disconnect",this.disconnectProducingTransport.bind(this,e)),Array.from(((i=e._producers)==null?void 0:i.values())||[]).forEach(a=>{this.registerProducer(a)}),e.on("newproducer",this.registerProducer)}registerConsumingTransport(e){var i;this.consumingTransport=e,e.on("close",this.disconnectConsumingTransport.bind(this,e)),e.on("disconnect",this.disconnectConsumingTransport.bind(this,e)),Array.from(((i=e._consumers)==null?void 0:i.values())||[]).forEach(a=>{this.registerConsumer(a)}),e.on("newconsumer",this.registerConsumer)}deRegisterConsumer(e){this.consumers.delete(e.id)}deRegisterProducer(e){var r;this.producers.delete(e.id),this.logger.debug("callStats::deRegisterProducer",{producerId:e.id,producerKind:e.kind,isScreenShare:!!((r=e.appData)!=null&&r.screenShare)})}disconnectConsumingTransport(){this.consumingTransport=void 0}disconnectProducingTransport(){this.producingTransport=void 0}callEvent(e){this.eventHandler.callEvent(e)}sendPreCallTestBeginEvent(e=!1,r){this.connectionInfoPromise=this.measurements.getNetworkInfo(this.iceServers,e),this.eventHandler.callEvent({event:M.PRECALL_TEST_BEGIN,timestamp:r}),this.connectionInfoPromise&&this.connectionInfoPromise.then(i=>{this.eventHandler.callEvent({event:M.PRECALL_TEST_COMPLETE,metaData:{connectionInfo:i},timestamp:r})})}sendScreenShareToggleEvent(e,r=null,i){this.currentUserMediaStates.screen=e,this.eventHandler.callEvent({event:e?M.SCREENSHARE_STARTED:M.SCREENSHARE_STOPPED,metaData:{ssrc:r},timestamp:i})}sendScreenShareRequestedEvent(e){this.eventHandler.callEvent({event:M.SCREENSHARE_START_REQUESTED,timestamp:e})}sendActiveSpeakerEvent(e,r){this.eventHandler.callEvent({event:M.DOMINANT_SPEAKER,metaData:{peerId:e},timestamp:r})}devices(e,r,i){this.eventHandler.callEvent({event:e===jt.AUDIO&&M.AUDIO_DEVICES_UPDATES||e===jt.VIDEO&&M.VIDEO_DEVICES_UPDATES||e===jt.SPEAKER&&M.SPEAKER_DEVICES_UPDATES,metaData:{deviceList:r},timestamp:i})}selectedDevice(e,r,i){this.eventHandler.callEvent({event:e===jt.AUDIO&&M.SELECTED_MICROHPONE_UPDATE||e===jt.VIDEO&&M.SELECTED_CAMERA_UPDATE||e===jt.SPEAKER&&M.SELECTED_SPEAKER_UPDATE,metaData:{device:r},timestamp:i})}mediaPermission(e,r,i){this.eventHandler.callEvent({event:M.MEDIA_PERMISSION,metaData:{deviceType:e,permission:r},timestamp:i})}mediaPlaybackFailed(e,r){this.eventHandler.callEvent({event:e===jt.AUDIO&&M.AUDIO_PLAY_FAILED||e===jt.VIDEO&&M.VIDEO_PLAY_FAILED,metaData:{deviceType:e},timestamp:r})}mediaTrackMuted(e,r){this.eventHandler.callEvent({event:e===jt.AUDIO&&M.AUDIO_TRACK_MUTED||e===jt.VIDEO&&M.VIDEO_TRACK_MUTED,metaData:{deviceType:e},timestamp:r})}tabChanged(e,r){this.eventHandler.callEvent({event:M.TAB_CHANGE,metaData:{isMeetingsTabActive:e},timestamp:r})}browserBackgrounded(e){this.eventHandler.callEvent({event:M.BROWSER_BACKGROUNDED,timestamp:e})}browserForegrounded(e){this.eventHandler.callEvent({event:M.BROWSER_FOREGROUNDED,timestamp:e})}legacySwitch(e,r){this.eventHandler.callEvent({event:M.LEGACY_SWITCH,metadata:{on:e},timestamp:r})}async getPreCallTestResults(){return this.connectionInfoPromise}sendCallJoinBeginEvent(e,r){e={...e,meetingEnv:this.env},e.deviceInfo={...e.deviceInfo,userAgent:navigator.userAgent,cpus:navigator.hardwareConcurrency,memory:navigator.deviceMemory},this.eventHandler.callEvent({event:M.CALL_JOIN_BEGIN,metaData:{peerMetaData:e},timestamp:r})}sendNetworkQualityTestBeginEvent(e,r){this.eventHandler.callEvent({event:M.NET_QUALITY_TEST_BEGIN,timestamp:r}),new Promise(async(a,o)=>{const c=[];try{for(const d of e)try{if(d.iceServers&&d.iceServers.length>0){const l=await this.measurements.getNetworkQuality(d.iceServers);c.push({...d,networkResults:l})}}catch(l){console.warn("Error handling ",l)}a({regionData:c})}catch(d){console.warn("Error in callstats, ",d),o(d)}}).then(a=>{this.eventHandler.callEvent({event:M.NET_QUALITY_TEST_END,timestamp:r,metaData:a})})}sendWebSocketConnectedEvent(e){this.eventHandler.callEvent({event:M.WEBSOCKET_CONNECTED,timestamp:e})}sendTransportConnectedEvent(e){this.eventHandler.callEvent({event:M.TRANSPORT_CONNECTED,timestamp:e})}sendAudioToggleEvent(e,r){this.currentUserMediaStates.audio=e;let i;e?i=M.AUDIO_ON:i=M.AUDIO_OFF,this.eventHandler.callEvent({event:i,timestamp:r})}sendVideoToggleEvent(e,r){this.currentUserMediaStates.video=e;let i;e?i=M.VIDEO_ON:i=M.VIDEO_OFF,this.eventHandler.callEvent({event:i,timestamp:r})}sendParticipantRoleToggleEvent(e,r){this.eventHandler.callEvent({event:M.PARTICIPANT_ROLE,timestamp:r,metaData:e})}startPingStats(e=7e3){this.sendPingStatsEvent(!1,new Date),this.pingStatsTimeout=setInterval(this.sendPingStatsEvent.bind(this),e)}stopPingStats(){clearInterval(this.pingStatsTimeout)}async sendPingStatsEvent(e=!0,r){let i,a;if(this.producingTransport&&(i=await this.measurements.getProcessedStats(this.producingTransport,!1,!0),!i||!(i!=null&&i.producerReport))){this.logger.debug("callStats::sendPingStatsEvent::staleProducingTransport",{disclaimer:"Stale producer? Regenerating Stream Maps!"});const c=await this.measurements.getProducersReport([...this.producers.values()]);i&&c?i.producerReport=c:(i=await this.measurements.getProcessedStats(this.producingTransport,!1,!0),(!i||!(i!=null&&i.producerReport))&&this.logger.debug("callStats::sendPingStatsEvent::noProducingTransportReport",{disclaimer:"Stream maps invalid despite regenerating!"}))}if(this.consumingTransport&&(a=await this.measurements.getProcessedStats(this.consumingTransport,!0,!1),!a||!a.consumerReport)){this.logger.debug("callStats::sendPingStatsEvent::staleConsumingTransport",{disclaimer:"Stale consumer? Regenerating Stream Maps!"});const c=await this.measurements.getConsumersReport([...this.consumers.values()]);a&&c?a.consumerReport=c:(a=await this.measurements.getProcessedStats(this.consumingTransport,!0,!1),(!a||!a.consumerReport)&&this.logger.debug("callStats::sendPingStatsEvent::noConsumingTransportReport",{disclaimer:"Stream maps invalid despite regenerating!"}))}const o={producingTransportStats:i?i==null?void 0:i.transportReport:void 0,consumingTransportStats:a?a==null?void 0:a.transportReport:void 0,producerStats:[].concat((i==null?void 0:i.producerReport)||[]).concat((a==null?void 0:a.producerReport)||[]),consumerStats:[].concat((a==null?void 0:a.consumerReport)||[]).concat((i==null?void 0:i.consumerReport)||[])};if(e&&o.producerStats.length===0&&o.consumerStats.length===0){await this.eventHandler.flush();return}this.eventHandler.callEvent({event:M.PING_STAT,metaData:o,timestamp:r})}sendIVSPlayerRebufferEvent(e){this.eventHandler.callEvent({event:M.IVS_PLAYER_REBUFFERING,timestamp:e})}sendIVSPlayerAudioBlockEvent(e){this.eventHandler.callEvent({event:M.IVS_PLAYER_AUDIO_BLOCKED,timestamp:e})}sendIVSPlayerPlaybackBlockedEvent(e){this.eventHandler.callEvent({event:M.IVS_PLAYER_PLAYBACK_BLOCKED,timestamp:e})}sendIVSPlayerNetworkUnavailableEvent(e){this.eventHandler.callEvent({event:M.IVS_PLAYER_NETWORK_UNAVAILABLE,timestamp:e})}sendIVSPlayerInitializedEvent(e){this.eventHandler.callEvent({event:M.IVS_PLAYER_INITIALIZED,timestamp:e})}sendIVSPlayerWorkerErrorEvent(e){this.eventHandler.callEvent({event:M.IVS_PLAYER_WORKER_ERROR,timestamp:e})}sendIVSPlayerErrorEvent(e,r){this.eventHandler.callEvent({event:M.IVS_PLAYER_ERROR,timestamp:r,metaData:e})}sendIVSPlayerRecoverableErrorEvent(e,r){this.eventHandler.callEvent({event:M.IVS_PLAYER_RECOVERABLE_ERROR,timestamp:r,metaData:e})}sendIVSPlayerAnalyticsEvent(e,r){this.eventHandler.callEvent({event:M.IVS_PLAYER_ANALYTICS_EVENT,timestamp:r,metaData:e})}sendIVSPlayerPlaybackRateChangedEvent(e,r){this.eventHandler.callEvent({event:M.IVS_PLAYER_PLAYBACK_RATE_CHANGED,timestamp:r,metaData:{updatedPlaybackRate:e}})}sendIVSPlayerQualityChanged(e,r){this.eventHandler.callEvent({event:M.IVS_PLAYER_QUALITY_CHANGED,timestamp:r,metaData:e})}sendPlayerLiveLatency(e,r){this.eventHandler.callEvent({event:M.LIVESTREAM_LATENCY,timestamp:r,metaData:{latency:e}})}sendDisconnectEvent(e){this.eventHandler.callEvent({event:M.DISCONNECT,timestamp:e})}sendReconnectEvent(e){this.eventHandler.callEvent({event:M.RECONNECT_ATTEMPT,timestamp:e})}expectedVideoResolution(e,r,i){this.eventHandler.callEvent({event:M.EXPECTED_VIDEO_RESOLUTION,timestamp:i,metaData:{frameWidth:e,frameHeight:r}})}expectedScreenshareResolution(e,r,i){this.eventHandler.callEvent({event:M.EXPECTED_SCREENSHARE_RESOLUTION,timestamp:i,metaData:{frameWidth:e,frameHeight:r}})}};J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"registerIceServers",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"registerConsumer",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"registerProducer",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendConsumerSharedMediaStateEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"registerProducingTransport",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"registerConsumingTransport",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"deRegisterConsumer",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"deRegisterProducer",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"disconnectConsumingTransport",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"disconnectProducingTransport",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendPreCallTestBeginEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendScreenShareToggleEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendScreenShareRequestedEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendActiveSpeakerEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"devices",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"selectedDevice",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"mediaPermission",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"mediaPlaybackFailed",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"mediaTrackMuted",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"tabChanged",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"browserBackgrounded",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"browserForegrounded",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"legacySwitch",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"getPreCallTestResults",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendCallJoinBeginEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendNetworkQualityTestBeginEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendWebSocketConnectedEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendTransportConnectedEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendAudioToggleEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendVideoToggleEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendParticipantRoleToggleEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"startPingStats",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"stopPingStats",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendPingStatsEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendIVSPlayerRebufferEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendIVSPlayerAudioBlockEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendIVSPlayerPlaybackBlockedEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendIVSPlayerNetworkUnavailableEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendIVSPlayerInitializedEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendIVSPlayerWorkerErrorEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendIVSPlayerErrorEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendIVSPlayerRecoverableErrorEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendIVSPlayerAnalyticsEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendIVSPlayerPlaybackRateChangedEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendIVSPlayerQualityChanged",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendPlayerLiveLatency",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendDisconnectEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"sendReconnectEvent",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"expectedVideoResolution",null);J([z(TypeError,(s,t)=>K.error(t,s))],j.prototype,"expectedScreenshareResolution",null);j=J([kv(TypeError,(s,t)=>K.error(t,s))],j);const Iv=j;class gm extends ot{constructor(){super(...arguments);u(this,"stats");u(this,"peerId");u(this,"backend");u(this,"iceServers");u(this,"initialized",!1);u(this,"stalled",!1);u(this,"ipInformation");u(this,"logger")}async initialize({peerId:e,engineName:r,env:i=mo.PROD,iceServers:a,apiBase:o="https://api.cluster.dyte.in",flags:c,logger:d=console,apiHostnames:l,skipConnectivityChecks:h=!1}){var p,f,T;try{this.peerId=e,this.logger=d,this.ipInformation=await ah.getIPDetails({peerId:e,apiHostnames:l,logger:d}),this.backend=new Iv(o,r,i,c,d,e,l),this.iceServers=a,(p=this.backend)==null||p.registerIceServers(this.iceServers),this.initialized=!0,(T=(f=this.backend)==null?void 0:f.eventHandler)==null||T.emit("initialized",this.ipInformation),this.emit("initialized",this.ipInformation),this.startPreCallTest(h)}catch(E){this.logger.error("callStats::CallStatsIntegration: ",{error:E}),this.stallCallStats()}}configureSendTransport(e){this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.registerProducingTransport(e)})}configureRecvTransport(e){this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.registerConsumingTransport(e)})}async candidateRegionalNetworkQualityTest(e){const r=new Date;this.onSafeInitialization(()=>{var i;try{(i=this.backend)==null||i.sendNetworkQualityTestBeginEvent(e,r)}catch(a){this.logger.error("callStats::sendNetworkQualityTestBeginEvent",{error:{reason:a.reason}})}})}async roomJoined(e){const r=new Date;this.onSafeInitialization(()=>{var i,a;(i=this.backend)==null||i.sendCallJoinBeginEvent(e,r),this.backend,(a=this.backend)==null||a.startPingStats()})}audioOff(){const e=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.sendAudioToggleEvent(!1,e)})}audioOn(){const e=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.sendAudioToggleEvent(!0,e)})}videoOff(){const e=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.sendVideoToggleEvent(!1,e)})}videoOn(){const e=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.sendVideoToggleEvent(!0,e)})}callEnded(){const e=new Date;this.onSafeInitialization(()=>{var r,i;(r=this.backend)==null||r.stopPingStats(),(i=this.backend)==null||i.sendDisconnectEvent(e)})}screenShareStart(e){const r=new Date;this.onSafeInitialization(()=>{var i;(i=this.backend)==null||i.sendScreenShareToggleEvent(!0,e,r)})}consumerSharedMediaState(e,r){this.onSafeInitialization(()=>{var i;(i=this.backend)==null||i.sendConsumerSharedMediaStateEvent(e,r)})}screenShareStop(e){const r=new Date;this.onSafeInitialization(()=>{var i;(i=this.backend)==null||i.sendScreenShareToggleEvent(!1,e,r)})}screenShareRequested(){const e=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.sendScreenShareRequestedEvent(e)})}activeSpeaker(e){if(e!==this.peerId)return;const r=new Date;this.onSafeInitialization(()=>{var i;(i=this.backend)==null||i.sendActiveSpeakerEvent(e,r)})}devices(e,r){const i=new Date;this.onSafeInitialization(()=>{var a;(a=this.backend)==null||a.devices(e,r,i)})}selectedDevice(e,r){const i=new Date;this.onSafeInitialization(()=>{var a;(a=this.backend)==null||a.selectedDevice(e,r,i)})}mediaPermission(e,r){const i=new Date;this.onSafeInitialization(()=>{var a;(a=this.backend)==null||a.mediaPermission(e,r,i)})}mediaPlaybackFailed(e){const r=new Date;this.onSafeInitialization(()=>{var i;(i=this.backend)==null||i.mediaPlaybackFailed(e,r)})}mediaTrackMuted(e){const r=new Date;this.onSafeInitialization(()=>{var i;(i=this.backend)==null||i.mediaTrackMuted(e,r)})}tabChanged(e=!1){const r=new Date;this.onSafeInitialization(()=>{var i;(i=this.backend)==null||i.tabChanged(e,r)})}browserBackgrounded(){const e=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.browserBackgrounded(e)})}browserForegrounded(){const e=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.browserForegrounded(e)})}legacySwitch(e){const r=new Date;this.onSafeInitialization(()=>{var i;(i=this.backend)==null||i.legacySwitch(e,r)})}async startPreCallTest(e=!1){const r=new Date;this.onSafeInitialization(()=>{var i;(i=this.backend)==null||i.sendPreCallTestBeginEvent(e,r)})}onPreCallTestResults(e){return this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.eventHandler.once("precall_end",e)}),e}onReceivingConsumerAudioStatus(e){this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.eventHandler.on("consumer_audio_status",e)})}onReceivingConsumerVideoStatus(e){this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.eventHandler.on("consumer_video_status",e)})}onReceivingProducerAudioStatus(e){this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.eventHandler.on("producer_audio_status",e)})}onReceivingProducerVideoStatus(e){this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.eventHandler.on("producer_video_status",e)})}onReceivingProducingTransportStatus(e){this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.eventHandler.on("producing_transport_status",e)})}onReceivingConsumingTransportStatus(e){this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.eventHandler.on("consuming_transport_status",e)})}onProducerScore(e){this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.eventHandler.on("producer_score",e)})}onConsumerScore(e){this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.eventHandler.on("consumer_score",e)})}onSafeInitialization(e){if(this.initialized)e(this.ipInformation,!1);else if(!this.stalled){const r=i=>{e(i,!0)};return this.once("initialized",r),r}return()=>{}}removeInitializationListener(e){this.removeListener("initialized",e)}stallCallStats(){this.stalled=!0,this.removeAllListeners("initialized")}ivsPlayerEvent(e,r){const i=new Date;this.onSafeInitialization(()=>{var a,o,c,d,l,h,p,f,T,E,P;switch(e){case"PlayerRebuffering":(a=this.backend)==null||a.sendIVSPlayerRebufferEvent(i);break;case"PlayerAudioBlocked":(o=this.backend)==null||o.sendIVSPlayerAudioBlockEvent(i);break;case"PlayerPlaybackBlocked":(c=this.backend)==null||c.sendIVSPlayerPlaybackBlockedEvent(i);break;case"PlayerNetworkUnavailable":(d=this.backend)==null||d.sendIVSPlayerNetworkUnavailableEvent(i);break;case"PlayerInitialized":(l=this.backend)==null||l.sendIVSPlayerInitializedEvent(i);break;case"PlayerWorkerError":(h=this.backend)==null||h.sendIVSPlayerWorkerErrorEvent(i);break;case"PlayerError":(p=this.backend)==null||p.sendIVSPlayerErrorEvent(r,i);break;case"PlayerRecoverableError":(f=this.backend)==null||f.sendIVSPlayerRecoverableErrorEvent(r,i);break;case"PlayerAnalyticsEvent":(T=this.backend)==null||T.sendIVSPlayerAnalyticsEvent(r,i);break;case"PlayerPlaybackRateChanged":(E=this.backend)==null||E.sendIVSPlayerPlaybackRateChangedEvent(r,i);break;case"PlayerQualityChanged":(P=this.backend)==null||P.sendIVSPlayerQualityChanged(r,i);break}})}livestreamLatency(e){const r=new Date;this.onSafeInitialization(()=>{var i;(i=this.backend)==null||i.sendPlayerLiveLatency(e,r)})}expectedVideoResolution(e,r){const i=new Date;this.onSafeInitialization(()=>{var a;(a=this.backend)==null||a.expectedVideoResolution(e,r,i)})}expectedScreenshareResolution(e,r){const i=new Date;this.onSafeInitialization(()=>{var a;(a=this.backend)==null||a.expectedScreenshareResolution(e,r,i)})}}const Av=new gm;Av.setMaxListeners(30);function Mv(){this.__data__=[],this.size=0}function Dc(s,t){return s===t||s!==s&&t!==t}function bl(s,t){for(var e=s.length;e--;)if(Dc(s[e][0],t))return e;return-1}var Dv=Array.prototype,Ov=Dv.splice;function Nv(s){var t=this.__data__,e=bl(t,s);if(e<0)return!1;var r=t.length-1;return e==r?t.pop():Ov.call(t,e,1),--this.size,!0}function Vv(s){var t=this.__data__,e=bl(t,s);return e<0?void 0:t[e][1]}function Lv(s){return bl(this.__data__,s)>-1}function xv(s,t){var e=this.__data__,r=bl(e,s);return r<0?(++this.size,e.push([s,t])):e[r][1]=t,this}function vr(s){var t=-1,e=s==null?0:s.length;for(this.clear();++t<e;){var r=s[t];this.set(r[0],r[1])}}vr.prototype.clear=Mv;vr.prototype.delete=Nv;vr.prototype.get=Vv;vr.prototype.has=Lv;vr.prototype.set=xv;function Uv(){this.__data__=new vr,this.size=0}function $v(s){var t=this.__data__,e=t.delete(s);return this.size=t.size,e}function Fv(s){return this.__data__.get(s)}function Bv(s){return this.__data__.has(s)}var Hv=typeof global=="object"&&global&&global.Object===Object&&global;const mm=Hv;var qv=typeof self=="object"&&self&&self.Object===Object&&self,jv=mm||qv||Function("return this")();const ws=jv;var Gv=ws.Symbol;const Us=Gv;var fm=Object.prototype,Wv=fm.hasOwnProperty,Jv=fm.toString,to=Us?Us.toStringTag:void 0;function Kv(s){var t=Wv.call(s,to),e=s[to];try{s[to]=void 0;var r=!0}catch(a){}var i=Jv.call(s);return r&&(t?s[to]=e:delete s[to]),i}var zv=Object.prototype,Yv=zv.toString;function Qv(s){return Yv.call(s)}var Xv="[object Null]",Zv="[object Undefined]",Yh=Us?Us.toStringTag:void 0;function cn(s){return s==null?s===void 0?Zv:Xv:Yh&&Yh in Object(s)?Kv(s):Qv(s)}function rs(s){var t=typeof s;return s!=null&&(t=="object"||t=="function")}var ey="[object AsyncFunction]",ty="[object Function]",sy="[object GeneratorFunction]",ry="[object Proxy]";function oh(s){if(!rs(s))return!1;var t=cn(s);return t==ty||t==sy||t==ey||t==ry}var iy=ws["__core-js_shared__"];const zl=iy;var Qh=function(){var s=/[^.]+$/.exec(zl&&zl.keys&&zl.keys.IE_PROTO||"");return s?"Symbol(src)_1."+s:""}();function ny(s){return!!Qh&&Qh in s}var ay=Function.prototype,oy=ay.toString;function dn(s){if(s!=null){try{return oy.call(s)}catch(t){}try{return s+""}catch(t){}}return""}var cy=/[\\^$.*+?()[\]{}|]/g,dy=/^\[object .+?Constructor\]$/,ly=Function.prototype,uy=Object.prototype,hy=ly.toString,py=uy.hasOwnProperty,gy=RegExp("^"+hy.call(py).replace(cy,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function my(s){if(!rs(s)||ny(s))return!1;var t=oh(s)?gy:dy;return t.test(dn(s))}function fy(s,t){return s==null?void 0:s[t]}function ln(s,t){var e=fy(s,t);return my(e)?e:void 0}var Ty=ln(ws,"Map");const _o=Ty;var vy=ln(Object,"create");const Co=vy;function yy(){this.__data__=Co?Co(null):{},this.size=0}function Sy(s){var t=this.has(s)&&delete this.__data__[s];return this.size-=t?1:0,t}var Ey="__lodash_hash_undefined__",Py=Object.prototype,_y=Py.hasOwnProperty;function Cy(s){var t=this.__data__;if(Co){var e=t[s];return e===Ey?void 0:e}return _y.call(t,s)?t[s]:void 0}var wy=Object.prototype,Ry=wy.hasOwnProperty;function by(s){var t=this.__data__;return Co?t[s]!==void 0:Ry.call(t,s)}var ky="__lodash_hash_undefined__";function Iy(s,t){var e=this.__data__;return this.size+=this.has(s)?0:1,e[s]=Co&&t===void 0?ky:t,this}function nn(s){var t=-1,e=s==null?0:s.length;for(this.clear();++t<e;){var r=s[t];this.set(r[0],r[1])}}nn.prototype.clear=yy;nn.prototype.delete=Sy;nn.prototype.get=Cy;nn.prototype.has=by;nn.prototype.set=Iy;function Ay(){this.size=0,this.__data__={hash:new nn,map:new(_o||vr),string:new nn}}function My(s){var t=typeof s;return t=="string"||t=="number"||t=="symbol"||t=="boolean"?s!=="__proto__":s===null}function kl(s,t){var e=s.__data__;return My(t)?e[typeof t=="string"?"string":"hash"]:e.map}function Dy(s){var t=kl(this,s).delete(s);return this.size-=t?1:0,t}function Oy(s){return kl(this,s).get(s)}function Ny(s){return kl(this,s).has(s)}function Vy(s,t){var e=kl(this,s),r=e.size;return e.set(s,t),this.size+=e.size==r?0:1,this}function yr(s){var t=-1,e=s==null?0:s.length;for(this.clear();++t<e;){var r=s[t];this.set(r[0],r[1])}}yr.prototype.clear=Ay;yr.prototype.delete=Dy;yr.prototype.get=Oy;yr.prototype.has=Ny;yr.prototype.set=Vy;var Ly=200;function xy(s,t){var e=this.__data__;if(e instanceof vr){var r=e.__data__;if(!_o||r.length<Ly-1)return r.push([s,t]),this.size=++e.size,this;e=this.__data__=new yr(r)}return e.set(s,t),this.size=e.size,this}function Cs(s){var t=this.__data__=new vr(s);this.size=t.size}Cs.prototype.clear=Uv;Cs.prototype.delete=$v;Cs.prototype.get=Fv;Cs.prototype.has=Bv;Cs.prototype.set=xy;function Uy(s,t){for(var e=-1,r=s==null?0:s.length;++e<r&&t(s[e],e,s)!==!1;);return s}var $y=function(){try{var s=ln(Object,"defineProperty");return s({},"",{}),s}catch(t){}}();const vd=$y;function ch(s,t,e){t=="__proto__"&&vd?vd(s,t,{configurable:!0,enumerable:!0,value:e,writable:!0}):s[t]=e}var Fy=Object.prototype,By=Fy.hasOwnProperty;function Tm(s,t,e){var r=s[t];(!(By.call(s,t)&&Dc(r,e))||e===void 0&&!(t in s))&&ch(s,t,e)}function Oc(s,t,e,r){var i=!e;e||(e={});for(var a=-1,o=t.length;++a<o;){var c=t[a],d=r?r(e[c],s[c],c,e,s):void 0;d===void 0&&(d=s[c]),i?ch(e,c,d):Tm(e,c,d)}return e}function Hy(s,t){for(var e=-1,r=Array(s);++e<s;)r[e]=t(e);return r}function $s(s){return s!=null&&typeof s=="object"}var qy="[object Arguments]";function Xh(s){return $s(s)&&cn(s)==qy}var vm=Object.prototype,jy=vm.hasOwnProperty,Gy=vm.propertyIsEnumerable,Wy=Xh(function(){return arguments}())?Xh:function(s){return $s(s)&&jy.call(s,"callee")&&!Gy.call(s,"callee")};const wo=Wy;var Jy=Array.isArray;const Ut=Jy;function Ky(){return!1}var ym=typeof exports=="object"&&exports&&!exports.nodeType&&exports,Zh=ym&&typeof module=="object"&&module&&!module.nodeType&&module,zy=Zh&&Zh.exports===ym,ep=zy?ws.Buffer:void 0,Yy=ep?ep.isBuffer:void 0,Qy=Yy||Ky;const Ma=Qy;var Xy=9007199254740991,Zy=/^(?:0|[1-9]\d*)$/;function dh(s,t){var e=typeof s;return t=t==null?Xy:t,!!t&&(e=="number"||e!="symbol"&&Zy.test(s))&&s>-1&&s%1==0&&s<t}var eS=9007199254740991;function lh(s){return typeof s=="number"&&s>-1&&s%1==0&&s<=eS}var tS="[object Arguments]",sS="[object Array]",rS="[object Boolean]",iS="[object Date]",nS="[object Error]",aS="[object Function]",oS="[object Map]",cS="[object Number]",dS="[object Object]",lS="[object RegExp]",uS="[object Set]",hS="[object String]",pS="[object WeakMap]",gS="[object ArrayBuffer]",mS="[object DataView]",fS="[object Float32Array]",TS="[object Float64Array]",vS="[object Int8Array]",yS="[object Int16Array]",SS="[object Int32Array]",ES="[object Uint8Array]",PS="[object Uint8ClampedArray]",_S="[object Uint16Array]",CS="[object Uint32Array]",fe={};fe[fS]=fe[TS]=fe[vS]=fe[yS]=fe[SS]=fe[ES]=fe[PS]=fe[_S]=fe[CS]=!0;fe[tS]=fe[sS]=fe[gS]=fe[rS]=fe[mS]=fe[iS]=fe[nS]=fe[aS]=fe[oS]=fe[cS]=fe[dS]=fe[lS]=fe[uS]=fe[hS]=fe[pS]=!1;function wS(s){return $s(s)&&lh(s.length)&&!!fe[cn(s)]}function uh(s){return function(t){return s(t)}}var Sm=typeof exports=="object"&&exports&&!exports.nodeType&&exports,fo=Sm&&typeof module=="object"&&module&&!module.nodeType&&module,RS=fo&&fo.exports===Sm,Yl=RS&&mm.process,bS=function(){try{var s=fo&&fo.require&&fo.require("util").types;return s||Yl&&Yl.binding&&Yl.binding("util")}catch(t){}}();const Da=bS;var tp=Da&&Da.isTypedArray,kS=tp?uh(tp):wS;const Il=kS;var IS=Object.prototype,AS=IS.hasOwnProperty;function Em(s,t){var e=Ut(s),r=!e&&wo(s),i=!e&&!r&&Ma(s),a=!e&&!r&&!i&&Il(s),o=e||r||i||a,c=o?Hy(s.length,String):[],d=c.length;for(var l in s)(t||AS.call(s,l))&&!(o&&(l=="length"||i&&(l=="offset"||l=="parent")||a&&(l=="buffer"||l=="byteLength"||l=="byteOffset")||dh(l,d)))&&c.push(l);return c}var MS=Object.prototype;function Al(s){var t=s&&s.constructor,e=typeof t=="function"&&t.prototype||MS;return s===e}function Pm(s,t){return function(e){return s(t(e))}}var DS=Pm(Object.keys,Object);const OS=DS;var NS=Object.prototype,VS=NS.hasOwnProperty;function _m(s){if(!Al(s))return OS(s);var t=[];for(var e in Object(s))VS.call(s,e)&&e!="constructor"&&t.push(e);return t}function Nc(s){return s!=null&&lh(s.length)&&!oh(s)}function Ml(s){return Nc(s)?Em(s):_m(s)}function LS(s,t){return s&&Oc(t,Ml(t),s)}function xS(s){var t=[];if(s!=null)for(var e in Object(s))t.push(e);return t}var US=Object.prototype,$S=US.hasOwnProperty;function FS(s){if(!rs(s))return xS(s);var t=Al(s),e=[];for(var r in s)r=="constructor"&&(t||!$S.call(s,r))||e.push(r);return e}function Vc(s){return Nc(s)?Em(s,!0):FS(s)}function BS(s,t){return s&&Oc(t,Vc(t),s)}var Cm=typeof exports=="object"&&exports&&!exports.nodeType&&exports,sp=Cm&&typeof module=="object"&&module&&!module.nodeType&&module,HS=sp&&sp.exports===Cm,rp=HS?ws.Buffer:void 0,ip=rp?rp.allocUnsafe:void 0;function wm(s,t){if(t)return s.slice();var e=s.length,r=ip?ip(e):new s.constructor(e);return s.copy(r),r}function Rm(s,t){var e=-1,r=s.length;for(t||(t=Array(r));++e<r;)t[e]=s[e];return t}function qS(s,t){for(var e=-1,r=s==null?0:s.length,i=0,a=[];++e<r;){var o=s[e];t(o,e,s)&&(a[i++]=o)}return a}function bm(){return[]}var jS=Object.prototype,GS=jS.propertyIsEnumerable,np=Object.getOwnPropertySymbols,WS=np?function(s){return s==null?[]:(s=Object(s),qS(np(s),function(t){return GS.call(s,t)}))}:bm;const hh=WS;function JS(s,t){return Oc(s,hh(s),t)}function km(s,t){for(var e=-1,r=t.length,i=s.length;++e<r;)s[i+e]=t[e];return s}var KS=Pm(Object.getPrototypeOf,Object);const ph=KS;var zS=Object.getOwnPropertySymbols,YS=zS?function(s){for(var t=[];s;)km(t,hh(s)),s=ph(s);return t}:bm;const Im=YS;function QS(s,t){return Oc(s,Im(s),t)}function Am(s,t,e){var r=t(s);return Ut(s)?r:km(r,e(s))}function lu(s){return Am(s,Ml,hh)}function XS(s){return Am(s,Vc,Im)}var ZS=ln(ws,"DataView");const uu=ZS;var eE=ln(ws,"Promise");const hu=eE;var tE=ln(ws,"Set");const kn=tE;var sE=ln(ws,"WeakMap");const pu=sE;var ap="[object Map]",rE="[object Object]",op="[object Promise]",cp="[object Set]",dp="[object WeakMap]",lp="[object DataView]",iE=dn(uu),nE=dn(_o),aE=dn(hu),oE=dn(kn),cE=dn(pu),ri=cn;(uu&&ri(new uu(new ArrayBuffer(1)))!=lp||_o&&ri(new _o)!=ap||hu&&ri(hu.resolve())!=op||kn&&ri(new kn)!=cp||pu&&ri(new pu)!=dp)&&(ri=function(s){var t=cn(s),e=t==rE?s.constructor:void 0,r=e?dn(e):"";if(r)switch(r){case iE:return lp;case nE:return ap;case aE:return op;case oE:return cp;case cE:return dp}return t});const Oa=ri;var dE=Object.prototype,lE=dE.hasOwnProperty;function uE(s){var t=s.length,e=new s.constructor(t);return t&&typeof s[0]=="string"&&lE.call(s,"index")&&(e.index=s.index,e.input=s.input),e}var hE=ws.Uint8Array;const yd=hE;function gh(s){var t=new s.constructor(s.byteLength);return new yd(t).set(new yd(s)),t}function pE(s,t){var e=t?gh(s.buffer):s.buffer;return new s.constructor(e,s.byteOffset,s.byteLength)}var gE=/\w*$/;function mE(s){var t=new s.constructor(s.source,gE.exec(s));return t.lastIndex=s.lastIndex,t}var up=Us?Us.prototype:void 0,hp=up?up.valueOf:void 0;function fE(s){return hp?Object(hp.call(s)):{}}function Mm(s,t){var e=t?gh(s.buffer):s.buffer;return new s.constructor(e,s.byteOffset,s.length)}var TE="[object Boolean]",vE="[object Date]",yE="[object Map]",SE="[object Number]",EE="[object RegExp]",PE="[object Set]",_E="[object String]",CE="[object Symbol]",wE="[object ArrayBuffer]",RE="[object DataView]",bE="[object Float32Array]",kE="[object Float64Array]",IE="[object Int8Array]",AE="[object Int16Array]",ME="[object Int32Array]",DE="[object Uint8Array]",OE="[object Uint8ClampedArray]",NE="[object Uint16Array]",VE="[object Uint32Array]";function LE(s,t,e){var r=s.constructor;switch(t){case wE:return gh(s);case TE:case vE:return new r(+s);case RE:return pE(s,e);case bE:case kE:case IE:case AE:case ME:case DE:case OE:case NE:case VE:return Mm(s,e);case yE:return new r;case SE:case _E:return new r(s);case EE:return mE(s);case PE:return new r;case CE:return fE(s)}}var pp=Object.create,xE=function(){function s(){}return function(t){if(!rs(t))return{};if(pp)return pp(t);s.prototype=t;var e=new s;return s.prototype=void 0,e}}();const UE=xE;function Dm(s){return typeof s.constructor=="function"&&!Al(s)?UE(ph(s)):{}}var $E="[object Map]";function FE(s){return $s(s)&&Oa(s)==$E}var gp=Da&&Da.isMap,BE=gp?uh(gp):FE;const HE=BE;var qE="[object Set]";function jE(s){return $s(s)&&Oa(s)==qE}var mp=Da&&Da.isSet,GE=mp?uh(mp):jE;const WE=GE;var JE=1,KE=2,zE=4,Om="[object Arguments]",YE="[object Array]",QE="[object Boolean]",XE="[object Date]",ZE="[object Error]",Nm="[object Function]",eP="[object GeneratorFunction]",tP="[object Map]",sP="[object Number]",Vm="[object Object]",rP="[object RegExp]",iP="[object Set]",nP="[object String]",aP="[object Symbol]",oP="[object WeakMap]",cP="[object ArrayBuffer]",dP="[object DataView]",lP="[object Float32Array]",uP="[object Float64Array]",hP="[object Int8Array]",pP="[object Int16Array]",gP="[object Int32Array]",mP="[object Uint8Array]",fP="[object Uint8ClampedArray]",TP="[object Uint16Array]",vP="[object Uint32Array]",he={};he[Om]=he[YE]=he[cP]=he[dP]=he[QE]=he[XE]=he[lP]=he[uP]=he[hP]=he[pP]=he[gP]=he[tP]=he[sP]=he[Vm]=he[rP]=he[iP]=he[nP]=he[aP]=he[mP]=he[fP]=he[TP]=he[vP]=!0;he[ZE]=he[Nm]=he[oP]=!1;function td(s,t,e,r,i,a){var o,c=t&JE,d=t&KE,l=t&zE;if(e&&(o=i?e(s,r,i,a):e(s)),o!==void 0)return o;if(!rs(s))return s;var h=Ut(s);if(h){if(o=uE(s),!c)return Rm(s,o)}else{var p=Oa(s),f=p==Nm||p==eP;if(Ma(s))return wm(s,c);if(p==Vm||p==Om||f&&!i){if(o=d||f?{}:Dm(s),!c)return d?QS(s,BS(o,s)):JS(s,LS(o,s))}else{if(!he[p])return i?s:{};o=LE(s,p,c)}}a||(a=new Cs);var T=a.get(s);if(T)return T;a.set(s,o),WE(s)?s.forEach(function(C){o.add(td(C,t,e,C,s,a))}):HE(s)&&s.forEach(function(C,_){o.set(_,td(C,t,e,_,s,a))});var E=l?d?XS:lu:d?Vc:Ml,P=h?void 0:E(s);return Uy(P||s,function(C,_){P&&(_=C,C=s[_]),Tm(o,_,td(C,t,e,_,s,a))}),o}var yP=1,SP=4;function mh(s){return td(s,yP|SP)}var EP="[object Symbol]";function Dl(s){return typeof s=="symbol"||$s(s)&&cn(s)==EP}var PP=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,_P=/^\w*$/;function fh(s,t){if(Ut(s))return!1;var e=typeof s;return e=="number"||e=="symbol"||e=="boolean"||s==null||Dl(s)?!0:_P.test(s)||!PP.test(s)||t!=null&&s in Object(t)}var CP="Expected a function";function Th(s,t){if(typeof s!="function"||t!=null&&typeof t!="function")throw new TypeError(CP);var e=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=e.cache;if(a.has(i))return a.get(i);var o=s.apply(this,r);return e.cache=a.set(i,o)||a,o};return e.cache=new(Th.Cache||yr),e}Th.Cache=yr;var wP=500;function RP(s){var t=Th(s,function(r){return e.size===wP&&e.clear(),r}),e=t.cache;return t}var bP=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,kP=/\\(\\)?/g,IP=RP(function(s){var t=[];return s.charCodeAt(0)===46&&t.push(""),s.replace(bP,function(e,r,i,a){t.push(i?a.replace(kP,"$1"):r||e)}),t});const AP=IP;function MP(s,t){for(var e=-1,r=s==null?0:s.length,i=Array(r);++e<r;)i[e]=t(s[e],e,s);return i}var DP=1/0,fp=Us?Us.prototype:void 0,Tp=fp?fp.toString:void 0;function Lm(s){if(typeof s=="string")return s;if(Ut(s))return MP(s,Lm)+"";if(Dl(s))return Tp?Tp.call(s):"";var t=s+"";return t=="0"&&1/s==-DP?"-0":t}function OP(s){return s==null?"":Lm(s)}function xm(s,t){return Ut(s)?s:fh(s,t)?[s]:AP(OP(s))}var NP=1/0;function Ol(s){if(typeof s=="string"||Dl(s))return s;var t=s+"";return t=="0"&&1/s==-NP?"-0":t}function Um(s,t){t=xm(t,s);for(var e=0,r=t.length;s!=null&&e<r;)s=s[Ol(t[e++])];return e&&e==r?s:void 0}function VP(s,t,e){var r=s==null?void 0:Um(s,t);return r===void 0?e:r}function LP(s,t,e){t=xm(t,s);for(var r=-1,i=t.length,a=!1;++r<i;){var o=Ol(t[r]);if(!(a=s!=null&&e(s,o)))break;s=s[o]}return a||++r!=i?a:(i=s==null?0:s.length,!!i&&lh(i)&&dh(o,i)&&(Ut(s)||wo(s)))}var xP=Object.defineProperty,UP=(s,t)=>{for(var e in t)xP(s,e,{get:t[e],enumerable:!0})},$P={};UP($P,{permissions:()=>FP,theme:()=>BP});var bt=(s=>(s.GroupCall="GROUP_CALL",s.Webinar="WEBINAR",s.AudioRoom="AUDIO_ROOM",s.Livestream="LIVESTREAM",s.Chat="CHAT",s))(bt||{}),B=(s=>(s.Allowed="ALLOWED",s.NotAllowed="NOT_ALLOWED",s.CanRequest="CAN_REQUEST",s))(B||{}),FP={view_type:"GROUP_CALL",accept_waiting_requests:!1,accept_present_requests:!1,request_produce:!1,can_allow_participant_audio:!1,can_allow_participant_screensharing:!1,can_allow_participant_video:!1,can_spotlight:!1,request_kick_participant:!1,kick_participant:!1,pin_participant:!1,can_edit_display_name:!1,can_record:!1,can_livestream:!1,can_present:!0,waiting_room_type:"SKIP_ON_ACCEPT",recorder_type:"NONE",plugins:{can_close:!0,can_start:!0},polls:{can_create:!0,can_vote:!0,can_view:!0},produce:{video:{allow:!0,quality:"vga",frame_rate:24},audio:!0,screenshare:{allow:!0,quality:"hd",frame_rate:5}},chat:{public:{can_send:!0,text:!0,files:!0},private:{can_send:!1,can_receive:!1,text:!1,files:!1}},connected_meetings:{can_alter_connected_meetings:!1,can_switch_connected_meetings:!1,can_switch_to_parent_meeting:!1},reactions:!1,hidden_participant:!1,is_recorder:!1,show_participant_list:!0,can_change_participant_role:!1,can_change_theme:!1,max_screenshare_count:1},BP={setup_screen:{is_enabled:!0},alone_here:{is_enabled:!0},waiting_room:{is_enabled:!1,enable_preview:!0},control_bar:{is_enabled:!0,elements:{plugins:!0,screenshare:!0,invite:!0,participants:!0,chat:!0,reactions:!1,polls:!0,fullscreen:!0,layout:!0}},header:{is_enabled:!0,elements:{timer:!0,title:!0,participant_count:!0,change_layout:!0}},pip_mode:!0,auto_tune:!0,grid:{multi:{maxVideoCount:6,videoFit:"cover"},single:{maxVideoCount:6,videoFit:"cover"},defaultView:"multi"},controls:{pip_toggle:!1}},$m="hXgU8Wc8pwuGNq9ms5q9Hh",mg;typeof process!="undefined"&&(mg=process==null?void 0:process.env)!=null&&mg.FLAGSMITH_ENVIRONMENT_KEY&&($m=process.env.FLAGSMITH_ENVIRONMENT_KEY);function HP(s=[]){const t={};return s.forEach(e=>{t[e.feature.name]={enabled:e.enabled,value:e.feature_state_value}}),t}var Fm=class{constructor(s=$m){u(this,"flags",{});u(this,"environmentKey",null);this.environmentKey=s}async identifyAndFetchFlagsWithRetry({primaryEndpoint:s,secondaryEndpoint:t,forceEvaluate:e,timeout:r,uniqueIdentifier:i,traitsObj:a,logger:o}){const c=JSON.parse(JSON.stringify(a)),d=Object.entries(c).map(h=>({trait_key:h[0],trait_value:h[1]})),l=[s,t,t];for(const h of l)try{const p=new AbortController,f=setTimeout(()=>p.abort(),r),T="_"+(Math.random()+1).toString(36).substring(2),E=await fetch(`https://${h}/api/v1/identities/`,{method:"POST",headers:{"Content-Type":"application/json","X-Environment-Key":this.environmentKey},body:JSON.stringify({identifier:i+(e?T:""),traits:d}),signal:p.signal});if(clearTimeout(f),!E.ok)throw new Error(`Request failed with status ${E.status}`);const P=await E.json();return HP(P.flags||[])}catch(p){o.error("Flagsmith identify failed!!",{error:p,url:h})}return{}}async identify(s,t={},e=!1,r=5e3,i="edge.api.flagsmith.com",a=console){return this.flags=await this.identifyAndFetchFlagsWithRetry({traitsObj:t,uniqueIdentifier:s,forceEvaluate:e,timeout:r,primaryEndpoint:i,secondaryEndpoint:"edge.api.flagsmith.com",logger:a}),this.flags}getValue(s){return this.flags&&this.flags[s]&&this.flags[s].value}hasFeature(s){return this.flags&&this.flags[s]&&this.flags[s].enabled}getAllFlags(){return this.flags}},qP=new Fm;function jP(s){return new Fm(s)}var Bm=[-2,-1,0,1,2],GP=[0,1,2,3,4];function WP(s){s=s.trim();let t="0",e="0",r="0";return s.length==4?(t="0x"+s[1]+s[1],e="0x"+s[2]+s[2],r="0x"+s[3]+s[3]):s.length>6&&(t="0x"+s[1]+s[2],e="0x"+s[3]+s[4],r="0x"+s[5]+s[6]),[+t,+e,+r]}var JP=(s,t,e)=>{let r,i,a;if(t==0)r=i=a=e;else{const o=(l,h,p)=>(p<0&&(p+=1),p>1&&(p-=1),p<.16666666666666666?l+(h-l)*6*p:p<.5?h:p<.6666666666666666?l+(h-l)*(.6666666666666666-p)*6:l),c=e<.5?e*(1+t):e+t-e*t,d=2*e-c;r=o(d,c,s+1/3),i=o(d,c,s),a=o(d,c,s-1/3)}return[Math.round(r*255),Math.round(i*255),Math.round(a*255)]},KP=(s,t,e)=>{s/=255,t/=255,e/=255;const r=Math.max(s,t,e),i=Math.min(s,t,e);let a,o;const c=(r+i)/2;if(r==i)a=o=0;else{const d=r-i;switch(o=c>.5?d/(2-r-i):d/(r+i),r){case s:a=(t-e)/d+(t<e?6:0);break;case t:a=(e-s)/d+2;break;case e:a=(s-t)/d+4;break}a/=6}return[a,o,c]},zP=(s,t,e)=>{const r=i=>i.toString(16).padStart(2,"0");return`#${r(s)}${r(t)}${r(e)}`},Hm=(s,t=Bm,e=.4)=>{const r=[],[i,a,o]=WP(s),[c,d,l]=KP(i,a,o),h=Math.round(l*100);h>70?e=.8:h>60?e=.9:h<10?e=.075:h<42&&(e=.3);const p=t.findIndex(C=>C===0);if(p===-1)throw new Error("Invalid reducer provided, it must contain atleast one zero");const f=5-p,T=p+1,E=(100-h)/f,P=h/T;for(const C of t){let _;C<0?_=h+C*P*e:C>0?_=h+C*E*e:_=h;const[N,U,D]=JP(c,d,_/100);r.push(zP(N,U,D))}return r},vp={dark:{background:{1e3:"#252525",900:"#2F2F2F",800:"#323232",700:"#3E3E3E",600:"#4A4A4A"},text:"#F5F5F5","video-bg":"#1C1C1C"},light:{background:{1e3:"#FFFFFF",900:"#F5F5F5",800:"#EBEBEB",700:"#E0E0E0",600:"#D6D6D6"},text:"#111111","text-on-brand":"#ffffff","video-bg":"#DADADA"}},YP=s=>{const[t,e,r,i,a]=Hm(s,Bm);return{300:t,400:e,500:r,600:i,700:a}},QP=s=>{if(s==="#FFFFFF")return vp.light.background;if(s==="#000000")return vp.dark.background;const[t,e,r,i,a]=Hm(s,GP);return{1e3:t,900:e,800:r,700:i,600:a}},XP={border_radius:"rounded",border_width:"thin",spacing_base:4,theme:"dark",colors:{brand:YP("#2160FD"),background:QP("#141414"),danger:"#FF2D2D",text:"#EEEEEE",text_on_brand:"#EEEEEE",success:"#62A504",video_bg:"#191919",warning:"#FFCD07"}};function qm(){return mh(XP)}var ZP={permissions:{can_accept_production_requests:!1,can_edit_display_name:!0,accept_waiting_requests:!1,disable_participant_audio:!1,disable_participant_screensharing:!1,disable_participant_video:!1,can_spotlight:!1,kick_participant:!1,pin_participant:!1,can_record:!1,can_livestream:!1,waiting_room_type:"SKIP",plugins:{can_close:!0,can_start:!0,can_edit_config:!1,config:{}},polls:{can_create:!0,can_vote:!0,can_view:!0},media:{video:{can_produce:"ALLOWED",can_consume:"ALLOWED"},audio:{can_produce:"ALLOWED"},screenshare:{can_produce:"ALLOWED",can_consume:"ALLOWED"}},chat:{public:{can_send:!0,text:!0,files:!0},private:{can_send:!1,can_receive:!1,text:!1,files:!1},channel:{can_create:"ALL",can_delete:"ALL",can_update:"ALL",can_read_all:!1},message:{can_delete:"ALL",can_edit:"ALL",delete_cutoff_time_seconds:0,edit_cutoff_time_seconds:0}},hidden_participant:!1,is_recorder:!1,recorder_type:"NONE",show_participant_list:!0,transcription_enabled:!1,can_change_participant_permissions:!1,connected_meetings:{can_alter_connected_meetings:!1,can_switch_connected_meetings:!1,can_switch_to_parent_meeting:!1},stage_enabled:!1,stage_access:void 0,accept_stage_requests:!1},ui:{oldTheme:{setup_screen:{is_enabled:!1},alone_here:{is_enabled:!1},waiting_room:{is_enabled:!1,enable_preview:!0},control_bar:{is_enabled:!0,elements:{plugins:!0,screenshare:!0,invite:!1,participants:!0,chat:!0,reactions:!1,polls:!0,fullscreen:!0,layout:!0}},header:{is_enabled:!0,elements:{timer:!0,title:!0,participant_count:!0,change_layout:!0}},pip_mode:!0,auto_tune:!0,colors:{primary:"#2160FD",secondary:"#1A1A1A",text:"#EEEEEE",background:"#1A1A1A",textPrimary:"#EEEEEE",videoBackground:"#1A1A1A"},dimensions:{mode:"fillParent"},grid:{multi:{maxVideoCount:6,videoFit:"cover"},single:{maxVideoCount:6,videoFit:"cover"},defaultView:"MULTI"},controls:{pip_toggle:!1},plugins:[]},design_tokens:qm(),config_diff:{}},config:{view_type:"GROUP_CALL",media:{audio:{enable_stereo:!1,enable_high_bitrate:!1},video:{quality:"vga",frame_rate:24},screenshare:{quality:"hd",frame_rate:5}},max_video_streams:{mobile:6,desktop:6},max_screenshare_count:1,track_recording:{subscriptions:[]}},version:"hybrid"};function e_(){return mh(ZP)}var t_={permissions:{can_accept_production_requests:!1,can_edit_display_name:!0,accept_waiting_requests:!1,disable_participant_audio:!1,disable_participant_screensharing:!1,disable_participant_video:!1,can_spotlight:!1,kick_participant:!1,pin_participant:!1,can_record:!1,can_livestream:!1,waiting_room_type:"SKIP",plugins:{can_close:!0,can_start:!0,can_edit_config:!1,config:{}},polls:{can_create:!0,can_vote:!0,can_view:!0},media:{video:{can_produce:"ALLOWED"},audio:{can_produce:"ALLOWED"},screenshare:{can_produce:"ALLOWED"}},chat:{public:{can_send:!0,text:!0,files:!0},private:{can_send:!1,can_receive:!1,text:!1,files:!1}},hidden_participant:!1,is_recorder:!1,recorder_type:"NONE",show_participant_list:!0,transcription_enabled:!1,can_change_participant_permissions:!1,connected_meetings:{can_alter_connected_meetings:!1,can_switch_connected_meetings:!1,can_switch_to_parent_meeting:!1},stage_enabled:!1,stage_access:void 0,accept_stage_requests:!1},ui:{design_tokens:qm(),config_diff:{}},config:{view_type:"GROUP_CALL",media:{audio:{enable_stereo:!1,enable_high_bitrate:!1},video:{quality:"vga",frame_rate:24},screenshare:{quality:"hd",frame_rate:5}},max_video_streams:{mobile:6,desktop:6},max_screenshare_count:1,track_recording:{subscriptions:[]}},version:"2.0.0"};function vh(){return mh(t_)}var ko;class jm{constructor(){g(this,ko,void 0)}get telemetry(){var t;return(t=n(this,ko))==null?void 0:t.getValue("telemetry")}init(t){m(this,ko,t)}info(t,e,r){var i;(i=this.telemetry)==null||i.addLogInCurrentSpan("info",t,e,r)}error(t,e,r){var i;(i=this.telemetry)==null||i.addLogInCurrentSpan("error",t,e,r)}debug(t,e,r){var i;(i=this.telemetry)==null||i.addLogInCurrentSpan("debug",t,e,r)}log(t,e,r){var i;(i=this.telemetry)==null||i.addLogInCurrentSpan("log",t,e,r)}warn(t,e,r){var i;(i=this.telemetry)==null||i.addLogInCurrentSpan("warn",t,e,r)}}ko=new WeakMap;var js,Gs;class s_ extends ot.EventEmitter{constructor(e){super();g(this,js,void 0);g(this,Gs,void 0);u(this,"asyncPromiseTimeout");u(this,"logger");this.logger=e,m(this,js,new Map),m(this,Gs,new Map),this.asyncPromiseTimeout=8e3}async emitAsync(e,...r){n(this,js).set(e,[]);const i=n(this,Gs).get(e).map(()=>new Promise(a=>{n(this,js).get(e).push(a)}));super.emit(e,...r),await Promise.race([Promise.all(i),new Promise((a,o)=>setTimeout(()=>o(new Error(`emitAsync failed to resolve for event ${e}.`)),this.asyncPromiseTimeout))]),n(this,js).delete(e)}onAsync(e,r){const i=n(this,js),a=async(...o)=>{var d;try{await r(...o)}catch(l){this.logger.error("[onAsync]",{error:l})}const c=(d=i.get(e))==null?void 0:d.shift();c==null||c()};return n(this,Gs).get(e)||n(this,Gs).set(e,[]),n(this,Gs).get(e).push(a),super.on(e,a)}reset(){m(this,js,new Map),m(this,Gs,new Map),super.removeAllListeners()}}js=new WeakMap,Gs=new WeakMap;var r_=/\s/;function i_(s){for(var t=s.length;t--&&r_.test(s.charAt(t)););return t}var n_=/^\s+/;function a_(s){return s&&s.slice(0,i_(s)+1).replace(n_,"")}var yp=0/0,o_=/^[-+]0x[0-9a-f]+$/i,c_=/^0b[01]+$/i,d_=/^0o[0-7]+$/i,l_=parseInt;function Sp(s){if(typeof s=="number")return s;if(Dl(s))return yp;if(rs(s)){var t=typeof s.valueOf=="function"?s.valueOf():s;s=rs(t)?t+"":t}if(typeof s!="string")return s===0?s:+s;s=a_(s);var e=c_.test(s);return e||d_.test(s)?l_(s.slice(2),e?2:8):o_.test(s)?yp:+s}function yh(s){return s}function u_(s,t,e){switch(e.length){case 0:return s.call(t);case 1:return s.call(t,e[0]);case 2:return s.call(t,e[0],e[1]);case 3:return s.call(t,e[0],e[1],e[2])}return s.apply(t,e)}function h_(){}var p_=800,g_=16,m_=Date.now;function f_(s){var t=0,e=0;return function(){var r=m_(),i=g_-(r-e);if(e=r,i>0){if(++t>=p_)return arguments[0]}else t=0;return s.apply(void 0,arguments)}}function T_(s){return function(){return s}}var v_=vd?function(s,t){return vd(s,"toString",{configurable:!0,enumerable:!1,value:T_(t),writable:!0})}:yh;const y_=v_;var S_=f_(y_);const E_=S_;function P_(s,t,e,r){for(var i=s.length,a=e+(r?1:-1);r?a--:++a<i;)if(t(s[a],a,s))return a;return-1}function __(s){return s!==s}function C_(s,t,e){for(var r=e-1,i=s.length;++r<i;)if(s[r]===t)return r;return-1}function w_(s,t,e){return t===t?C_(s,t,e):P_(s,__,e)}function R_(s,t){var e=s==null?0:s.length;return!!e&&w_(s,t,0)>-1}var Ep=Math.max;function b_(s,t,e){return t=Ep(t===void 0?s.length-1:t,0),function(){for(var r=arguments,i=-1,a=Ep(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var c=Array(t+1);++i<t;)c[i]=r[i];return c[t]=e(o),u_(s,this,c)}}function k_(s,t){return E_(b_(s,t,yh),s+"")}function I_(s,t,e){if(!rs(e))return!1;var r=typeof t;return(r=="number"?Nc(e)&&dh(t,e.length):r=="string"&&t in e)?Dc(e[t],s):!1}function A_(s){return k_(function(t,e){var r=-1,i=e.length,a=i>1?e[i-1]:void 0,o=i>2?e[2]:void 0;for(a=s.length>3&&typeof a=="function"?(i--,a):void 0,o&&I_(e[0],e[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var c=e[r];c&&s(t,c,r,a)}return t})}var M_="[object Object]",D_=Function.prototype,O_=Object.prototype,Gm=D_.toString,N_=O_.hasOwnProperty,V_=Gm.call(Object);function L_(s){if(!$s(s)||cn(s)!=M_)return!1;var t=ph(s);if(t===null)return!0;var e=N_.call(t,"constructor")&&t.constructor;return typeof e=="function"&&e instanceof e&&Gm.call(e)==V_}var x_="__lodash_hash_undefined__";function U_(s){return this.__data__.set(s,x_),this}function $_(s){return this.__data__.has(s)}function Ro(s){var t=-1,e=s==null?0:s.length;for(this.__data__=new yr;++t<e;)this.add(s[t])}Ro.prototype.add=Ro.prototype.push=U_;Ro.prototype.has=$_;function F_(s,t){for(var e=-1,r=s==null?0:s.length;++e<r;)if(t(s[e],e,s))return!0;return!1}function Wm(s,t){return s.has(t)}var B_=1,H_=2;function Jm(s,t,e,r,i,a){var o=e&B_,c=s.length,d=t.length;if(c!=d&&!(o&&d>c))return!1;var l=a.get(s),h=a.get(t);if(l&&h)return l==t&&h==s;var p=-1,f=!0,T=e&H_?new Ro:void 0;for(a.set(s,t),a.set(t,s);++p<c;){var E=s[p],P=t[p];if(r)var C=o?r(P,E,p,t,s,a):r(E,P,p,s,t,a);if(C!==void 0){if(C)continue;f=!1;break}if(T){if(!F_(t,function(_,N){if(!Wm(T,N)&&(E===_||i(E,_,e,r,a)))return T.push(N)})){f=!1;break}}else if(!(E===P||i(E,P,e,r,a))){f=!1;break}}return a.delete(s),a.delete(t),f}function q_(s){var t=-1,e=Array(s.size);return s.forEach(function(r,i){e[++t]=[i,r]}),e}function Sh(s){var t=-1,e=Array(s.size);return s.forEach(function(r){e[++t]=r}),e}var j_=1,G_=2,W_="[object Boolean]",J_="[object Date]",K_="[object Error]",z_="[object Map]",Y_="[object Number]",Q_="[object RegExp]",X_="[object Set]",Z_="[object String]",eC="[object Symbol]",tC="[object ArrayBuffer]",sC="[object DataView]",Pp=Us?Us.prototype:void 0,Ql=Pp?Pp.valueOf:void 0;function rC(s,t,e,r,i,a,o){switch(e){case sC:if(s.byteLength!=t.byteLength||s.byteOffset!=t.byteOffset)return!1;s=s.buffer,t=t.buffer;case tC:return!(s.byteLength!=t.byteLength||!a(new yd(s),new yd(t)));case W_:case J_:case Y_:return Dc(+s,+t);case K_:return s.name==t.name&&s.message==t.message;case Q_:case Z_:return s==t+"";case z_:var c=q_;case X_:var d=r&j_;if(c||(c=Sh),s.size!=t.size&&!d)return!1;var l=o.get(s);if(l)return l==t;r|=G_,o.set(s,t);var h=Jm(c(s),c(t),r,i,a,o);return o.delete(s),h;case eC:if(Ql)return Ql.call(s)==Ql.call(t)}return!1}var iC=1,nC=Object.prototype,aC=nC.hasOwnProperty;function oC(s,t,e,r,i,a){var o=e&iC,c=lu(s),d=c.length,l=lu(t),h=l.length;if(d!=h&&!o)return!1;for(var p=d;p--;){var f=c[p];if(!(o?f in t:aC.call(t,f)))return!1}var T=a.get(s),E=a.get(t);if(T&&E)return T==t&&E==s;var P=!0;a.set(s,t),a.set(t,s);for(var C=o;++p<d;){f=c[p];var _=s[f],N=t[f];if(r)var U=o?r(N,_,f,t,s,a):r(_,N,f,s,t,a);if(!(U===void 0?_===N||i(_,N,e,r,a):U)){P=!1;break}C||(C=f=="constructor")}if(P&&!C){var D=s.constructor,$=t.constructor;D!=$&&"constructor"in s&&"constructor"in t&&!(typeof D=="function"&&D instanceof D&&typeof $=="function"&&$ instanceof $)&&(P=!1)}return a.delete(s),a.delete(t),P}var cC=1,_p="[object Arguments]",Cp="[object Array]",qc="[object Object]",dC=Object.prototype,wp=dC.hasOwnProperty;function lC(s,t,e,r,i,a){var o=Ut(s),c=Ut(t),d=o?Cp:Oa(s),l=c?Cp:Oa(t);d=d==_p?qc:d,l=l==_p?qc:l;var h=d==qc,p=l==qc,f=d==l;if(f&&Ma(s)){if(!Ma(t))return!1;o=!0,h=!1}if(f&&!h)return a||(a=new Cs),o||Il(s)?Jm(s,t,e,r,i,a):rC(s,t,d,e,r,i,a);if(!(e&cC)){var T=h&&wp.call(s,"__wrapped__"),E=p&&wp.call(t,"__wrapped__");if(T||E){var P=T?s.value():s,C=E?t.value():t;return a||(a=new Cs),i(P,C,e,r,a)}}return f?(a||(a=new Cs),oC(s,t,e,r,i,a)):!1}function Nl(s,t,e,r,i){return s===t?!0:s==null||t==null||!$s(s)&&!$s(t)?s!==s&&t!==t:lC(s,t,e,r,Nl,i)}var uC=1,hC=2;function pC(s,t,e,r){var i=e.length,a=i,o=!r;if(s==null)return!a;for(s=Object(s);i--;){var c=e[i];if(o&&c[2]?c[1]!==s[c[0]]:!(c[0]in s))return!1}for(;++i<a;){c=e[i];var d=c[0],l=s[d],h=c[1];if(o&&c[2]){if(l===void 0&&!(d in s))return!1}else{var p=new Cs;if(r)var f=r(l,h,d,s,t,p);if(!(f===void 0?Nl(h,l,uC|hC,r,p):f))return!1}}return!0}function Km(s){return s===s&&!rs(s)}function gC(s){for(var t=Ml(s),e=t.length;e--;){var r=t[e],i=s[r];t[e]=[r,i,Km(i)]}return t}function zm(s,t){return function(e){return e==null?!1:e[s]===t&&(t!==void 0||s in Object(e))}}function mC(s){var t=gC(s);return t.length==1&&t[0][2]?zm(t[0][0],t[0][1]):function(e){return e===s||pC(e,s,t)}}function fC(s,t){return s!=null&&t in Object(s)}function TC(s,t){return s!=null&&LP(s,t,fC)}var vC=1,yC=2;function SC(s,t){return fh(s)&&Km(t)?zm(Ol(s),t):function(e){var r=VP(e,s);return r===void 0&&r===t?TC(e,s):Nl(t,r,vC|yC)}}function EC(s){return function(t){return t==null?void 0:t[s]}}function PC(s){return function(t){return Um(t,s)}}function _C(s){return fh(s)?EC(Ol(s)):PC(s)}function CC(s){return typeof s=="function"?s:s==null?yh:typeof s=="object"?Ut(s)?SC(s[0],s[1]):mC(s):_C(s)}function wC(s){return function(t,e,r){for(var i=-1,a=Object(t),o=r(t),c=o.length;c--;){var d=o[s?c:++i];if(e(a[d],d,a)===!1)break}return t}}var RC=wC();const bC=RC;var kC=function(){return ws.Date.now()};const Xl=kC;var IC="Expected a function",AC=Math.max,MC=Math.min;function Eh(s,t,e){var r,i,a,o,c,d,l=0,h=!1,p=!1,f=!0;if(typeof s!="function")throw new TypeError(IC);t=Sp(t)||0,rs(e)&&(h=!!e.leading,p="maxWait"in e,a=p?AC(Sp(e.maxWait)||0,t):a,f="trailing"in e?!!e.trailing:f);function T(G){var ee=r,Xe=i;return r=i=void 0,l=G,o=s.apply(Xe,ee),o}function E(G){return l=G,c=setTimeout(_,t),h?T(G):o}function P(G){var ee=G-d,Xe=G-l,as=t-ee;return p?MC(as,a-Xe):as}function C(G){var ee=G-d,Xe=G-l;return d===void 0||ee>=t||ee<0||p&&Xe>=a}function _(){var G=Xl();if(C(G))return N(G);c=setTimeout(_,P(G))}function N(G){return c=void 0,f&&r?T(G):(r=i=void 0,o)}function U(){c!==void 0&&clearTimeout(c),l=0,r=d=i=c=void 0}function D(){return c===void 0?o:N(Xl())}function $(){var G=Xl(),ee=C(G);if(r=arguments,i=this,d=G,ee){if(c===void 0)return E(d);if(p)return clearTimeout(c),c=setTimeout(_,t),T(d)}return c===void 0&&(c=setTimeout(_,t)),o}return $.cancel=U,$.flush=D,$}function gu(s,t,e){(e!==void 0&&!Dc(s[t],e)||e===void 0&&!(t in s))&&ch(s,t,e)}function DC(s){return $s(s)&&Nc(s)}function mu(s,t){if(!(t==="constructor"&&typeof s[t]=="function")&&t!="__proto__")return s[t]}function OC(s){return Oc(s,Vc(s))}function NC(s,t,e,r,i,a,o){var c=mu(s,e),d=mu(t,e),l=o.get(d);if(l){gu(s,e,l);return}var h=a?a(c,d,e+"",s,t,o):void 0,p=h===void 0;if(p){var f=Ut(d),T=!f&&Ma(d),E=!f&&!T&&Il(d);h=d,f||T||E?Ut(c)?h=c:DC(c)?h=Rm(c):T?(p=!1,h=wm(d,!0)):E?(p=!1,h=Mm(d,!0)):h=[]:L_(d)||wo(d)?(h=c,wo(c)?h=OC(c):(!rs(c)||oh(c))&&(h=Dm(d))):p=!1}p&&(o.set(d,h),i(h,d,r,a,o),o.delete(d)),gu(s,e,h)}function Ym(s,t,e,r,i){s!==t&&bC(t,function(a,o){if(i||(i=new Cs),rs(a))NC(s,t,o,e,Ym,r,i);else{var c=r?r(mu(s,o),a,o+"",s,t,i):void 0;c===void 0&&(c=a),gu(s,o,c)}},Vc)}function VC(s,t,e){for(var r=-1,i=s==null?0:s.length;++r<i;)if(e(t,s[r]))return!0;return!1}var LC="[object Map]",xC="[object Set]",UC=Object.prototype,$C=UC.hasOwnProperty;function FC(s){if(s==null)return!0;if(Nc(s)&&(Ut(s)||typeof s=="string"||typeof s.splice=="function"||Ma(s)||Il(s)||wo(s)))return!s.length;var t=Oa(s);if(t==LC||t==xC)return!s.size;if(Al(s))return!_m(s).length;for(var e in s)if($C.call(s,e))return!1;return!0}function BC(s,t){return Nl(s,t)}var HC=A_(function(s,t,e){Ym(s,t,e)});const Cr=HC;var qC=1/0,jC=kn&&1/Sh(new kn([,-0]))[1]==qC?function(s){return new kn(s)}:h_;const GC=jC;var WC=200;function Qm(s,t,e){var r=-1,i=R_,a=s.length,o=!0,c=[],d=c;if(e)o=!1,i=VC;else if(a>=WC){var l=t?null:GC(s);if(l)return Sh(l);o=!1,i=Wm,d=new Ro}else d=t?[]:c;e:for(;++r<a;){var h=s[r],p=t?t(h):h;if(h=e||h!==0?h:0,o&&p===p){for(var f=d.length;f--;)if(d[f]===p)continue e;t&&d.push(p),c.push(h)}else i(d,p,e)||(d!==c&&d.push(p),c.push(h))}return c}function JC(s){return s&&s.length?Qm(s):[]}function KC(s,t){return s&&s.length?Qm(s,CC(t)):[]}var fu=(s=>(s.PARTICIPANT="PARTICIPANT",s.PEER="PEER",s.CLIENT="CLIENT",s))(fu||{});const Q={PROPAGATE_KICK_ALL:"propagate_kick_across_rooms",REFRESH_ID_ON_DISCONNECTION:"refresh_id_on_disconnection",SKIP_OTEL_TRACES:"skip_otel_traces",USE_USERIDS_IN_CHAT:"use_userids_in_chat",ENABLE_CF_SIMULCAST:"enable_cf_simulcast",CF_TRANSPORT_FORCE_RELAY_ON_ICE_FAILED:"cf_transport_force_relay_on_ice_failed",LOG_LEVEL:"log_level",V1_PLUGINS:"v1_plugins",LIVESTREAM:"feat_livestream",FEAT_PAGINATED_CHAT:"feat_paginated_chat",VAL_MIN_FRAMERATE:"val_min_framerate",SCREEENSHARE_ERR_HACK:"screenshare_err_hack",SCREEENSHARE_CONSTRAINTS_RETRY:"screenshare_constraints_retry",VIDEO_CONSTRAINTS:"video_constraints",SCREENSHARE_CONSTRAINTS:"screenshare_constraints",FEAT_CHAT_SDK:"feat_chat_sdk",FEAT_CHAT_SDK_SEARCH:"chat_search",OBS_QUALITY:"obs_quality",ALLOW_SAFARI_MEDIA_MIDDLEWARES:"allow_safari_media_middlewares",EXP_RESHARE:"exp_reshare",SKIP_SETTING_IN_USE_DEVICE:"skip_setting_in_use_device",PRECALL_BANDWIDTH_TEST:"precall_bandwidth_test",DEBUG_SOCKET_JOIN:"debug_socket_join",FORCE_RELAY:"force_relay",FORCE_VIDEO_CODEC:"force_video_codec",TRACK_HINT:"track_hint",OVERRIDE_SIMULCAST_DYNAMIC:"override_simulcast_dynamic",PRECREATE_PRODUCERS:"precreate_producers",DISABLE_OPUS_DTX_CF:"disable_opus_dtx_cf",ENABLE_AUDIO_ACTIVITY_DEBUG_LOGS:"enable_audio_activity_debug_logs",DISABLE_LAYER_SWITCH:"disable_layer_switch"};function sd(s){const t={};return typeof(s==null?void 0:s.code)=="number"&&(t.code=s.code),typeof(s==null?void 0:s.code)=="string"&&(t.code=s.code.substring(0,100)),typeof(s==null?void 0:s.name)=="string"&&(t.name=s.name.substring(0,500)),typeof(s==null?void 0:s.message)=="string"&&(t.message=s.message.substring(0,500)),typeof(s==null?void 0:s.reason)=="string"&&(t.reason=s.reason.substring(0,500)),typeof(s==null?void 0:s.stack)=="string"&&(t.stack=s.stack.substring(0,500)),t}const zC={audio:!0,video:!0,screenshareAudio:!0,screenshareVideo:!0},so={baseURL:"http://localhost:5000",createdAt:"2021-08-05T10:49:56.602Z",description:"Develop plugins locally",id:"09259e3b-7be8-46f6-9801-106bf1866e1c",name:"Localhost Dev",organizationId:"4ad15a19-80e2-4105-bf43-48039fd2963e",picture:"https://dyte-uploads.s3.ap-south-1.amazonaws.com/dyte.png",private:!1,published:!0,staggered:!1,tags:["#localhost","#dev"],type:"self_hosted",updatedAt:"2021-08-05T10:50:07.681Z"},YC={pip:!0,poll:!0,chat:!0,stage:!0,theme:!0,plugin:!0,tracing:!0,internals:!0,recording:!0,livestream:!0,participant:!0,connectedMeetings:!0,devTools:{logs:!1}};function Na(s,t){const e=s.getValue("overrides");return e&&e[t]?e[t]:!1}function QC({baseURI:s}){return s.includes("preprod.dyte")||s.includes("preprod.realtime")?mo.PREPROD:s.includes("devel.dyte")||s.includes("devel.realtime")?mo.DEVEL:mo.PROD}function tn({servicePrefix:s,baseURI:t}){return`${s}.${t}`}function Xm(s){const t=s.getValue("baseURI");return{location:tn({servicePrefix:"location",baseURI:t}),locationLegacy:tn({servicePrefix:"location-legacy",baseURI:t}),daCollector:tn({servicePrefix:"da-collector",baseURI:t.replace("realtime.cloudflare.com","dyte.io")})}}const XC='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m16.242 2.932 4.826 4.826a2.75 2.75 0 0 1-.715 4.404l-4.87 2.435a.75.75 0 0 0-.374.426l-1.44 4.166a1.25 1.25 0 0 1-2.065.476L8.5 16.561 4.06 21H3v-1.06l4.44-4.44-3.105-3.104a1.25 1.25 0 0 1 .476-2.066l4.166-1.44a.75.75 0 0 0 .426-.373l2.435-4.87a2.75 2.75 0 0 1 4.405-.715Zm3.766 5.886-4.826-4.826a1.25 1.25 0 0 0-2.002.325l-2.435 4.871a2.25 2.25 0 0 1-1.278 1.12l-3.789 1.31 6.705 6.704 1.308-3.789a2.25 2.25 0 0 1 1.12-1.277l4.872-2.436a1.25 1.25 0 0 0 .325-2.002Z" fill="currentColor"/></svg>',ZC='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M4 12.02c0 1.06.2 2.1.6 3.08l.6 1.42c.22.55.64 1.01 1.17 1.29.27.14.56.21.86.21h2.55c.77 0 1.49-.41 1.87-1.08.5-.87 1.02-1.7 1.72-2.43l1.32-1.39c.44-.46.97-.84 1.49-1.23l.59-.45a.6.6 0 0 0 .23-.47c0-.75-.54-1.57-1.22-1.79a3.34 3.34 0 0 0-2.78.29V4.5a1.5 1.5 0 0 0-2.05-1.4 1.5 1.5 0 0 0-2.9 0A1.5 1.5 0 0 0 6 4.5v.09A1.5 1.5 0 0 0 4 6v6.02ZM8 4.5v4a.5.5 0 0 0 1 0v-5a.5.5 0 0 1 1 0v5a.5.5 0 0 0 1 0v-4a.5.5 0 0 1 1 0v6a.5.5 0 0 0 .85.37h.01c.22-.22.44-.44.72-.58.7-.35 2.22-.57 2.4.5l-.53.4c-.52.4-1.04.78-1.48 1.24l-1.33 1.38c-.75.79-1.31 1.7-1.85 2.63-.21.36-.6.58-1.01.58H7.23a.87.87 0 0 1-.4-.1 1.55 1.55 0 0 1-.71-.78l-.59-1.42a7.09 7.09 0 0 1-.53-2.7V6a.5.5 0 0 1 1 0v3.5a.5.5 0 0 0 1 0v-5a.5.5 0 0 1 1 0Z" fill="currentColor"></path></svg>',jc=s=>{if(!s)return;if(!s.startsWith("<svg"))return new Promise(a=>{a(s)});const e=new Blob([s],{type:"image/svg+xml"}),r=new Image,i=window.URL.createObjectURL(e);return new Promise((a,o)=>{r.onload=()=>{a(r),window.URL.revokeObjectURL(i)},r.onerror=()=>{o(),window.URL.revokeObjectURL(i)},r.src=i})},hi={logs:"https://api-silos.dyte.io/otel/logs",mock:{url:"https://mock.dyte.io",domain:"mock.dyte.io",app:"https://app.dyte.io/v2/meeting",stagingApp:"https://app.devel.dyte.io/v2/meeting"},apiBase:{prod:"https://api.dyte.io",staging:"https://api.devel.dyte.io",prodAlternate:"https://api.cluster.dyte.in"},baseURI:{prod:"dyte.io",staging:"devel.dyte.io"}};function ew(s){var r,i,a;const t=typeof navigator!="undefined"&&!navigator.isReactNative&&typeof window!="undefined"&&((r=window.location.host)==null?void 0:r.includes(hi.baseURI.staging)),e=!!((a=(i=s==null?void 0:s.getValue("modules"))==null?void 0:i.devTools)!=null&&a.logs);return t||e}function tw(s,t){var e;if(s!=null&&s.getValue("flagsmith").hasFeature(Q.LOG_LEVEL)){let r=((e=s.getValue("flagsmith").getValue(Q.LOG_LEVEL))==null?void 0:e.toString())||"all";if(r=r.toLowerCase().trim(),r==="off")return!1;if(r!=="all"){const i=["debug","log","info","warn","error"],a=i.indexOf(t),o=i.indexOf(r);if(a<o)return!1}}return!0}function Zm(s,t,e={}){return Object.getOwnPropertyNames(s).forEach(r=>{var a;if([null,void 0,NaN].includes(s[r])||t&&(((a=t.match(/\./g))==null?void 0:a.length)||0)>=10)return;const i=t?`${t}.${r}`:r;typeof s[r]=="object"?Zm(s[r],i,e):["number","string","boolean"].includes(typeof s[r])&&(e[i]=s[r])}),e}function Rp(s,t,e={},r=""){const i={};try{const a=JSON.stringify(e),o=JSON.parse(a),c=Zm(o,r),d=JSON.stringify(c);return JSON.parse(d)}catch(a){const o=sd(a);i[`${r}.error.message`]=o.message||"",i[`${r}.error.stack`]=o.stack||"",i[`${r}.error.reason`]=o.reason||"",i[`${r}.error.source`]="safelyFlattenObjForOpenTelemetry"}return i}const Bh=class{constructor(){u(this,"logsCache",[]);u(this,"logsProcessorTimer");u(this,"tracingEnabled",!0);u(this,"initialized",!1);u(this,"logsProcessingInterval",7e3);u(this,"logExclusionList",["message","websocket/message","roomMessage","websocket/room-message","websocket/room-legacy-mode","chatMessage","websocket/new-chat-message","websocket/no-active-speaker","websocket/selected-peers","websocket/active-speaker","ping","websocket/new-consumer","websocket/producer-score","websocket/consumer-score","websocket/plugin-event","websocket/plugin-data","websocket/plugin-internal-data"]);u(this,"meetingMetadata",{})}get logsEndpoint(){const t=hr.getContext(this.meetingMetadata.peerId);return`https://${tn({servicePrefix:"api-silos",baseURI:t.getValue("baseURI")})}/otel/logs`}resetPeerId(t){this.meetingMetadata.peerId=t}init(t,e,r){this.tracingEnabled=!0,this.initialized=!1,this.logsCache=[];const i=t.getValue("peerId");this.meetingMetadata=e,this.tracingEnabled=r,this.meetingMetadata.peerId=i,this.meetingMetadata.sdkVersion=t.getValue("sdkVersion");const{RNDeviceInfoImpl:a}=navigator;this.meetingMetadata.deviceInfo=navigator.isReactNative?a==null?void 0:a.getDeviceInfo():Te.getDeviceInfo(),this.meetingMetadata.visitedUrl=!navigator.isReactNative&&typeof window!="undefined"&&window.location.href,this.logsProcessorTimer=setInterval(this.processCachedLogs.bind(this),this.logsProcessingInterval),r&&(this.initialized=!0)}static trace(t,e=void 0){return(r,i,a)=>{const o=a.value;return a.value=function(...d){var f;const l=this==null?void 0:this.telemetry;if(!l||!l.initialized||navigator.isReactNative||!l.tracingEnabled||(f=hr.getContext(l.meetingMetadata.peerId))!=null&&f.getValue("flagsmith").hasFeature(Q.SKIP_OTEL_TRACES))return o.apply(this,d);l.addLogInCurrentSpan("info",t,e);const h=performance.now(),p=o.apply(this,d);return Promise.resolve(p).then(()=>{const T=performance.now();T-h>10&&l.addLogInCurrentSpan("info",`${t}_timing`,{execTime:T-h,country:Bh.location.country})}).catch(()=>{const T=performance.now();l.addLogInCurrentSpan("info",`${t}_timing`,{execTime:T-h})}),p},a}}injectContext(t){var i;const e=gr.v4().replace(/-/g,"").substring(0,16),r=(i=this.meetingMetadata.peerId)==null?void 0:i.replace(/-/g,"");t.TRACEPARENT=`00-${r}-${e}-01`}addLogInCurrentSpan(t,e,r={},i=!1){r!=null&&r.error&&Object.assign(r,{error:sd(r.error)});const a=hr.getContext(this.meetingMetadata.peerId);if(ew(a)&&(FC(r)?console[t]("InternalLogs:: ",t,e):console[t]("InternalLogs:: ",t,e,r)),!!tw(a,t))try{const c=Rp(a,e,r,"metadata"),d=new Date,l={message:e,level:t,...c,loggedAt:d.toISOString(),loggedAtTzOffset:d.getTimezoneOffset()};i?this.sendOtelLogsToNewRelic([l]):this.logsCache.push(l)}catch(c){this.addLogInCurrentSpan("error","opentelemetry::addLogInCurrentSpan_failed",{error:sd(c)})}}sendOtelLogsToNewRelic(t){const e=hr.getContext(this.meetingMetadata.peerId);fetch(this.logsEndpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({meetingMetadata:Rp(e,"sendOtelLogsToNewRelic",this.meetingMetadata,"meetingMetadata"),serviceName:e.getValue("sdkName"),logs:t})}).catch(r=>{this.addLogInCurrentSpan("error","opentelemetry::sendOtelLogToNewRelic_failed",{error:sd(r)}),this.logsCache.push(...t)})}processCachedLogs(){const t=this.logsCache.splice(0,25);t!=null&&t.length&&this.sendOtelLogsToNewRelic(t)}destruct(){clearInterval(this.logsProcessorTimer),this.processCachedLogs()}};let S=Bh;u(S,"location",{country:void 0});function sw(s){const t={...s},e=new Map,r=(l,h)=>(e.has(l)||e.set(l,new Set),e.get(l).add(h),()=>{var p;return(p=e.get(l))==null?void 0:p.delete(h)}),i=(l,h)=>{var p;(p=e.get(l))==null||p.delete(h)},a=l=>{var h;(h=e.get(l))==null||h.forEach(p=>{try{p(t[l])}catch(f){}})};return{subscribe:r,unsubscribe:i,notify:a,setValue:(l,h,p=!0)=>{t[l]=h,p&&a(l)},getValue:l=>t[l],getAllValues:()=>t}}class rw{constructor(){u(this,"contexts",new Map);u(this,"mostRecentPeerId",null)}createContext(t,e){if(this.contexts.has(t))return this.contexts.get(t);const r=new S,i=new jm;this.contexts.set(t,sw(e)),this.contexts.get(t).setValue("peerSessionStore",new s_(i));const a=new gm;return a.setMaxListeners(50),this.contexts.get(t).setValue("logger",i),this.contexts.get(t).setValue("telemetry",r),this.contexts.get(t).setValue("callstats",a),this.contexts.get(t).setValue("flagsmith",jP()),this.mostRecentPeerId=t,this.contexts.get(t)}remapContext(t,e){const r=e.getValue("peerId");r!==t&&(e.setValue("peerId",t),this.mostRecentPeerId=t,this.contexts.set(t,e),this.contexts.delete(r))}getContext(t){return this.contexts.get(t)}getMostRecentPeerId(){return this.mostRecentPeerId}}const hr=new rw,iw={"00":"Client","01":"Controller","02":"RoomNodeClient","03":"HiveNodeClient","04":"SocketService","05":"Chat","06":"Plugin","07":"Polls","08":"Meta","09":"Preset",10:"Recording",11:"Self",12:"Participant",13:"Spotlight",14:"Remote Request",15:"Webinar",16:"LocalMediaHandler",17:"End-End Encryption",18:"AI",19:"Livestream",20:"Stage"},rd={"0000":"Internal exception.","0001":"Failed to initialize.","0002":"Failed to join room.","0003":"Failed to leave room.","0004":"Invalid auth token","0010":"Browser not supported","0011":"HTTP Network Error","0012":"Websocket Network Error","0013":"Rate Limited","0100":"Internal exception","0101":"Permission denied","0102":"Prerequisite module missing","0200":"Internal exception.","0300":"Internal exception","0400":"Internal exception","0404":"Missing prerequisites to establish a websocket connection","0500":"Internal exception","0501":"Permission denied.","0502":"Invalid message body.","0503":"Text Message is too large","0504":"Message not found by the given id","0505":"Action not permitted without joining room","0506":"Message search is disabled","0510":"Invalid channel name.","0600":"Internal exception","0601":"Permission denied.","0602":"Auth token not set for plugin","0603":"Iframe was not provided","0700":"Internal exception","0705":"Action not permitted without joining room","0800":"Internal exception","0801":"Permission denied","0900":"Internal exception","0904":"Could not load preset",1e3:"Internal exception",1001:"Permission denied",1004:"Could not find specified recording",1005:"Action not permitted in given recording state",1100:"Internal exception",1101:"Permission denied",1102:"Unsupported",1103:"Name cannot be empty",1104:"No device selected while calling meeting.self.setDevice",1105:"Action not permitted without joining room",1106:"Can't set currently used device",1200:"Internal exception",1201:"Permission denied",1202:"Invalid page number was requested",1203:"Invalid participant count per page was requested",1204:"No participants exists with the given UserIds",1205:"Action not permitted without joining room",1206:"Manual Subscription Mode was not ACTIVATED",1207:"Invalid view mode",1208:"Manual Subscription not enabled for organization",1209:"Broadcast message type must be a non-empty string",1300:"Internal exception",1400:"Internal exception",1402:"No existing remote requests",1403:"No peer exists with given id",1500:"Internal exception",1600:"Internal exception",1601:"Failed to get audio track",1602:"Failed to get video track",1603:"Incorrect device",1604:"Failed to change device",1605:"Failed to get audio & video track",1606:"No audio input devices are available",1607:"No video input devices are available",1608:"No audio output devices (speakers) are available",1609:"Failed to fetch list of media devices",1610:"No media track exists",1611:"Failed to unmute track",1612:"Failed to get screenshare tracks",1701:"Crypto error",1800:"Internal exception",1801:"Can't fetch transcript file",1900:"Internal exception",1901:"Permission denied.",1902:"Livestream that has not yet started, can't be stopped",2e3:"Internal exception",2001:"Permission denied",2002:"Unsupported",2003:"Stage is disabled",2004:"Method not implemented",2005:"Action not permitted without joining room",2006:"Action not permitted in current stage status",9900:"Internal exception"};Object.keys(rd).forEach(s=>{rd[s]=`{${iw[s.slice(0,2)]}} ${rd[s]}`});class R extends Error{constructor(e,r,i=void 0,a=!1){super(e);u(this,"code");this.code=r,this.name="ClientError",this.message=`[ERR${this.code}]: ${rd[this.code]}
5
- ${this.message}`;try{let o=a&&!!i;r&&r.endsWith("00")&&i&&(o=!0),o&&i.error("ClientError",{error:{message:this.message,name:this.name,code:r}});const c=hr.getContext(hr.getMostRecentPeerId());if(c){const d=c.getValue("onError");try{d(this)}catch(l){}}typeof window!="undefined"&&window.dispatchEvent(new CustomEvent("ClientError",{detail:this}))}catch(o){}}}function Gc(s,t,e,r){if(r instanceof R)throw r;if(r instanceof t){const i=new R(r.message,e);throw i.stack=r.stack,i}else throw r}function bp(s,t,e){if(!s.value){const i=s.get,a=s.set;return i&&(s.get=function(){try{return i.apply(this)}catch(o){Gc(this,t,e,o)}}),a&&(s.set=function(o){try{return a.apply(this,[o])}catch(c){Gc(this,t,e,c)}}),s}const r=s.value;return s.value=function(...i){try{const a=r.apply(this,i);return a&&a instanceof Promise?a.catch(o=>{Gc(this,t,e,o)}):a}catch(a){Gc(this,t,e,a)}},s}function nw(s,t){return(e,r,i)=>{if(i)return bp(i,s,t);for(const a of Reflect.ownKeys(e.prototype).filter(o=>o!=="constructor")){const o=Object.getOwnPropertyDescriptor(e.prototype,a);(o.value instanceof Function||o.get instanceof Function||o.set instanceof Function)&&Object.defineProperty(e.prototype,a,bp(o,s,t))}}}const ct=s=>nw(Error,s);function aw(s){let t=0,e,r;if(!s)return t;for(e=0;e<s.length;e+=1)r=s.charCodeAt(e),t=(t<<5)-t+r,t|=0;return Math.abs(t)%100+1}function ow(){Te.isElectron()&&window.electronGetDisplayMediaSource&&(navigator.mediaDevices.getDisplayMedia=async()=>{const s=await window.electronGetDisplayMediaSource({types:["window","screen"]});let t=[];if(s&&(Array.isArray(s)?t=s:t=[s]),!(t!=null&&t.length))throw new Error("Couldn't find any media source for screen share.");let e=t.find(a=>{var o;return(o=a.id)==null?void 0:o.includes("screen")});e=e!=null?e:t[0];const r={audio:!1,video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e.id}}};return await navigator.mediaDevices.getUserMedia(r)})}var b=(s=>(s.NEW_PRODUCER="NEW_PRODUCER",s.ROOM_NODE_CONNECTION_ERROR="ROOM_NODE_CONNECTION_ERROR",s.SOCKET_SERVICE_ROOM_JOINED="SOCKET_SERVICE_ROOM_JOINED",s.SOCKET_SERVICE_RECONNECTED="SOCKET_SERVICE_RECONNECTED",s.SOCKET_SERVICE_DISCONNECTED="SOCKET_SERVICE_DISCONNECTED",s.SOCKET_SERVICE_FAILED="SOCKET_SERVICE_FAILED",s.SOCKET_STATE_UPDATE="SOCKET_STATE_UPDATE",s.ROOM_NODE_RECONNECTED="ROOM_NODE_RECONNECTED",s.ROOM_NODE_DISCONNECTED="ROOM_NODE_DISCONNECTED",s.ROOM_NODE_FAILED="ROOM_NODE_FAILED",s.TRANSPORT_STATE_UPDATE="TRANSPORT_STATE_UPDATE",s.PRODUCER_SCORE_UPDATE="PRODUCER_SCORE_UPDATE",s.CONSUMER_SCORE_UPDATE="CONSUMER_SCORE_UPDATE",s.PRODUCER_STATUS_UPDATE="PRODUCER_STATUS_UPDATE",s.CONSUMER_STATUS_UPDATE="CONSUMER_STATUS_UPDATE",s.LOW_CONSUMER_SCORE="LOW_CONSUMER_SCORE",s.MEDIA_PERMISSION_ERROR="MEDIA_PERMISSION_ERROR",s.MEDIA_PERMISSION_UPDATE="MEDIA_PERMISSION_UPDATE",s.MESSAGE="websocket/message",s.ROOM_MESSAGE="websocket/room-message",s.PEER_JOINED_INTERNAL="peer/joined-internal",s.PEER_CLOSED="websocket/peer-closed",s.CONSUMER_CLOSED="websocket/consumer-closed",s.CONSUMER_PAUSED="websocket/consumer-paused",s.CONSUMER_RESUMED="websocket/consumer-resumed",s.PRODUCER_CLOSED="websocket/producer-closed",s.NEW_CONSUMER="websocket/new-consumer",s.PRODUCER_SCORE="websocket/producer-score",s.CONSUMER_SCORE="websocket/consumer-score",s.PRODUCER_TOGGLE="cf/producer-toggle",s.UPDATE_ACTIVE="media/update-active",s.RESET_PRODUCER_STATE="cf/reset-producer-state",s.ROOM_STATE="sockethub/room-state",s.GET_STAGE_REQUESTS="GET_STAGE_REQUESTS",s.UPDATE_STAGE_REQUESTS="UPDATE_STAGE_REQUESTS",s.KICK_PEER="KICK_PEER",s.UPDATE_PEER_STAGE_STATUS="UPDATE_PEER_STAGE_STATUS",s.JOIN_MEDIA_ROOM="JOIN_MEDIA_ROOM",s.LEAVE_MEDIA_ROOM="LEAVE_MEDIA_ROOM",s.PIP_HANGUP="PIP_HANGUP",s.E2EE_ACTIVE_PRODUCER="E2EE_ACTIVE_PRODUCER",s.E2EE_INACTIVE_PRODUCER="E2EE_INACTIVE_PRODUCER",s.E2EE_ACTIVE_CONSUMER="E2EE_ACTIVE_CONSUMER",s.E2EE_INACTIVE_CONSUMER="E2EE_INACTIVE_CONSUMER",s.SOCKET_PEERS="SOCKET_PEERS",s.UPDATE_PERMISSIONS="UPDATE_PERMISSIONS",s.MAX_SPATIAL_LAYER_CHANGE="MAX_SPATIAL_LAYER_CHANGE",s.MUTE_SELF="MUTE_SELF",s.MUTE_SELF_VIDEO="MUTE_SELF_VIDEO",s))(b||{});class La extends ot.EventEmitter{constructor(e){super();u(this,"logger");this.logger=e,super.setMaxListeners(25)}emit(e,...r){return super.emit("*",e,...r),super.emit(e,...r)}on(e,r){var i;try{const a=this.listenerCount(e);a>25&&a%25===0&&((i=this.logger)==null||i.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch(a){}return super.on(e,r)}addListener(e,r){var i;try{const a=this.listenerCount(e);a>25&&a%25===0&&((i=this.logger)==null||i.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch(a){}return super.addListener(e,r)}off(e,r){return super.off(e,r)}once(e,r){return super.once(e,r)}prependListener(e,r){return super.prependListener(e,r)}prependOnceListener(e,r){return super.prependOnceListener(e,r)}removeListener(e,r){return super.removeListener(e,r)}removeAllListeners(e){return super.removeAllListeners(e)}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}}class Ft extends ot.EventEmitter{constructor(e){super();u(this,"logger");this.logger=e,super.setMaxListeners(25)}emit(e,...r){return super.emit("*",e,...r),super.emit(e,...r)}on(e,r){var i;try{const a=this.listenerCount(e);a>25&&a%25===0&&((i=this.logger)==null||i.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch(a){}return super.on(e,r)}addListener(e,r){var i;try{const a=this.listenerCount(e);a>25&&a%25===0&&((i=this.logger)==null||i.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch(a){}return super.addListener(e,r)}off(e,r){return super.off(e,r)}once(e,r){return super.once(e,r)}prependListener(e,r){return super.prependListener(e,r)}prependOnceListener(e,r){return super.prependOnceListener(e,r)}removeListener(e,r){return super.removeListener(e,r)}removeAllListeners(e){return super.removeAllListeners(e)}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}}function cw(s,t=2){return s.replace(/[^\u00BF-\u1FFF\u2C00-\uD7FF\w\s]/g,"").trim().split(/\s+/).slice(0,t).map(i=>i.charAt(0)).join("").toUpperCase()}const kp=1080,Ip=1920,dw=(s,t,e,r,i,a)=>{let o=.5,c=.5;const d=i,l=a,h=Math.min(e/d,r/l);let p=d*h,f=l*h,T,E,P,C,_=1;return p<e&&(_=e/p),Math.abs(_-1)<1e-14&&f<r&&(_=r/f),p*=_,f*=_,P=d/(p/e),C=l/(f/r),T=(d-P)*o,E=(l-C)*c,T<0&&(T=0),E<0&&(E=0),P>d&&(P=d),C>l&&(C=l),[T,E,P,C,s,t,e,r]};var Gt,pi,Ze,Wt,Ce,ls,Ws,ut,Ie,Dn,On,Js,Nn;const Hh=class extends Ft{constructor(e,r,i,a){const o=e.getValue("logger");super(o);g(this,Gt,void 0);g(this,pi,void 0);g(this,Ze,void 0);g(this,Wt,void 0);g(this,Ce,{height:kp,width:Ip});g(this,ls,{brand:"#2160FD",background:"#141414",text:"#000000",videoBackground:"#191919",textOnBrand:"#EEEEEE"});g(this,Ws,void 0);g(this,ut,{});g(this,Ie,void 0);g(this,Dn,void 0);g(this,On,void 0);g(this,Js,void 0);g(this,Nn,!1);u(this,"cleanupEventListeners",()=>{n(this,pi).unsubscribe("stageStatus",this.handlePipMediaControls),n(this,Ie).removeListener("videoUpdate",this.onSelfVideoUpdateListener),n(this,Ie).removeListener("audioUpdate",this.onSelfAudioUpdateListener),n(this,Ie).removeListener("roomLeft",()=>this.disable())});u(this,"enablePipMediaControls",()=>{this.mountAudioEvents(),this.mountVideoEvents()});u(this,"onSelfVideoUpdateListener",({videoEnabled:e})=>{this.updateMediaSession("CAMERA",e)});u(this,"onSelfAudioUpdateListener",({audioEnabled:e})=>{this.updateMediaSession("MIC",e)});u(this,"handlePipMediaControls",e=>{e==="ON_STAGE"?this.enablePipMediaControls():this.unmountEvents()});u(this,"eventCallback",e=>{e==="CAMERA"&&(n(this,Ie).videoEnabled?n(this,Ie).disableVideo():n(this,Ie).enableVideo(),this.emit("cameraToggled")),e==="MIC"&&(n(this,Ie).audioEnabled?n(this,Ie).disableAudio():n(this,Ie).enableAudio(),this.emit("micToggled")),e==="END"&&(n(this,pi).getValue("peerSessionStore").emit(b.PIP_HANGUP),this.cleanupEventListeners(),this.emit("hangup"),this.cleanup())});u(this,"unmountEvents",()=>{navigator.mediaSession===void 0||navigator.mediaSession.setCameraActive===void 0||(navigator.mediaSession.setActionHandler("togglemicrophone",void 0),navigator.mediaSession.setActionHandler("togglecamera",void 0))});u(this,"animate",()=>{if(!this.isActive&&n(this,Js)==="active"){this.disable(!0);return}n(this,ut)!==void 0&&this.paintCanvas(),n(this,Ws)!==void 0&&m(this,Ws,requestAnimationFrame(()=>this.animate()))});u(this,"disable",(e=!1)=>{m(this,Js,"idle"),this.cleanupEventListeners(),cancelAnimationFrame(n(this,Ws)),e!==!0&&document.body.removeChild(n(this,Ze)),m(this,Ws,void 0),document.pictureInPictureElement&&document.exitPictureInPicture()});m(this,pi,e),m(this,Js,"idle"),m(this,Ie,r),m(this,ls,{brand:r.config.designTokens.colors.brand[500],background:r.config.designTokens.colors.background[1e3],text:r.config.designTokens.colors.text,videoBackground:r.config.designTokens.colors.videoBg,textOnBrand:r.config.designTokens.colors.textOnBrand}),i&&this.setupIcon("pin",i),a&&this.setupIcon("handRaise",a)}static async _init(e,r){let i,a;try{i=await jc(XC),a=await jc(ZC)}catch(o){}return new Hh(e,r,i,a)}async setupIcon(e,r){switch(e){case"handRaise":m(this,On,r);break;case"pin":m(this,Dn,r);break}}async overrideIcon(e,r){switch(e){case"handRaise":m(this,On,await jc(r));break;case"pin":m(this,Dn,await jc(r));break}}constructImage(e){const r=new Image,i=new Blob([e],{type:"image/svg+xml"}),a=window.URL.createObjectURL(i);return new Promise(o=>{r.onload=()=>{o(r),window.URL.revokeObjectURL(a)},r.src=a})}createVideoContainer(){m(this,Ze,document.createElement("div")),n(this,Ze).style.width="0.1px",n(this,Ze).style.height="0.1px",n(this,Ze).style.overflow="hidden",n(this,Ze).style.position="absolute",n(this,Ze).style.bottom="0",n(this,Ze).style.right="0",n(this,Ze).style.opacity="0",n(this,Ze).appendChild(n(this,Wt))}setupEventListeners(){n(this,pi).subscribe("stageStatus",this.handlePipMediaControls),n(this,Ie).addListener("videoUpdate",this.onSelfVideoUpdateListener),n(this,Ie).addListener("audioUpdate",this.onSelfAudioUpdateListener),n(this,Ie).addListener("roomLeft",()=>this.disable())}createCanvas(){const e=document.createElement("canvas");e.height=n(this,Ce).height,e.width=n(this,Ce).width,m(this,Gt,e)}setupMediaSessionEvents(){navigator.mediaSession===void 0||navigator.mediaSession.setCameraActive===void 0||(navigator.mediaSession.setActionHandler("hangup",()=>{this.eventCallback("END")}),this.mountAudioEvents(),this.mountVideoEvents())}mountAudioEvents(){navigator.mediaSession===void 0||navigator.mediaSession.setMicrophoneActive===void 0||n(this,Ie).permissions.canProduceAudio&&navigator.mediaSession.setActionHandler("togglemicrophone",()=>{this.eventCallback("MIC")})}mountVideoEvents(){navigator.mediaSession===void 0||navigator.mediaSession.setCameraActive===void 0||n(this,Ie).permissions.canProduceVideo&&navigator.mediaSession.setActionHandler("togglecamera",()=>{this.eventCallback("CAMERA")})}getSources(){const r=Object.values(n(this,ut)).reduce((i,a)=>(i[a.pinned?"pinned":"regular"].push(a),i),{pinned:[],regular:[]});return[...r.pinned,...r.regular]}drawEmptyTile(e,r,i,a){if(n(this,Gt)===void 0)return;const o=n(this,Gt).getContext("2d"),c=n(this,Gt).width,d=0,l=0,h=r-d*2,p=i-d*2,f=Math.floor(c/h),T=Math.floor(e/f),P=e%f*(h+d)+d,C=T*(p+d)+d,{displayText:_,image:N}=a!=null?a:{};o.fillStyle=_||N?n(this,ls).videoBackground:n(this,ls).background,o.strokeStyle=n(this,ls).brand,o.beginPath(),o.moveTo(P+l,C),o.arcTo(P+h,C,P+h,C+l,l),o.arcTo(P+h,C+p,P+h-l,C+p,l),o.arcTo(P,C+p,P,C+p-l,l),o.arcTo(P,C,P+l,C,l),o.closePath(),o.fill(),o.stroke();const U=h/6,D=h/2+P,$=p/2+C;o.save(),(_||N)&&(o.beginPath(),o.arc(D,$,U,0,Math.PI*2),o.fillStyle=n(this,ls).brand,o.fill(),N?(o.clip(),o.drawImage(N,D-U,$-U,U*2,U*2),o.restore()):_&&(o.fillStyle=n(this,ls).textOnBrand,o.font=`${U/2}px sans-serif`,o.textAlign="center",o.textBaseline="middle",o.fillText(_,D,$)),this.drawIcons(a,P,C,Math.max(h,p)))}drawIcons(e,r,i,a){const o=Math.min(Math.max(a*.15,100),200),c=o*.2,d=o*.2;let l=r+c;const h=i+c,p=f=>{const T=n(this,Gt).getContext("2d");T.save(),T.fillStyle=n(this,ls).background,T.beginPath(),T.moveTo(l+d,h),T.arcTo(l+o,h,l+o,h+d,d),T.arcTo(l+o,h+o,l+o-d,h+o,d),T.arcTo(l,h+o,l,h+o-d,d),T.arcTo(l,h,l+d,h,d),T.closePath(),T.fill(),typeof f=="string"?(T.font=`${o/1.5}px sans-serif`,T.fillStyle=n(this,ls).text,T.textAlign="center",T.textBaseline="top",T.fillText(f,o/2+l,h+c)):T.drawImage(f,l+c,h+c,o-c*2,o-c*2),l+=o+c,T.restore()};e.pinned&&p(n(this,Dn)),e.handRaised&&p(n(this,On))}drawTile(e,r,i){var l,h;if(n(this,Gt)===void 0)return;const a=n(this,Gt).getContext("2d"),o=this.getSources();let c=0,d=0;for(;c<n(this,Ce).height-5;){let p=0;for(;p<n(this,Ce).width-5&&d<i;){if((l=o[d])!=null&&l.enabled){const f=o[d].element,[T,E,P,C,_,N,U,D]=dw(p,c,e,r,f.videoWidth,f.videoHeight);((h=f==null?void 0:f.classList)==null?void 0:h.contains("mirror"))?(a.save(),a.scale(-1,1),a.drawImage(f,T,E,P,C,-1*_,N,-1*U,D),a.restore()):a.drawImage(f,T,E,P,C,_,N,U,D),this.drawIcons(o[d],_,N,Math.max(U,D))}else this.drawEmptyTile(d,e,r,o[d]);d+=1,p+=e}c+=r}}calcGridElemSize(e){switch(e){case 0:case 1:return[n(this,Ce).width,n(this,Ce).height];case 2:return[Math.floor(n(this,Ce).width/2),n(this,Ce).height];case 3:case 4:return[Math.floor(n(this,Ce).width/2),Math.floor(n(this,Ce).height/2)];case 5:case 6:return[Math.floor(n(this,Ce).width/3),Math.floor(n(this,Ce).height/2)];case 7:case 8:case 9:return[Math.floor(n(this,Ce).width/3),Math.floor(n(this,Ce).height/3)];default:return[Math.floor(n(this,Ce).width/3),Math.floor(n(this,Ce).height/2)]}}paintCanvas(){let e=this.getSources().length;e!==1&&(e=e%2>0?e+1:e);const[r,i]=this.calcGridElemSize(e);this.drawTile(r,i,e)}isSupported(){var e;return!!window.chrome&&document.pictureInPictureEnabled&&((e=n(this,Ie).config)==null?void 0:e.viewType)!=="LIVESTREAM"}get isActive(){return document.pictureInPictureElement!==null}cleanup(){if(m(this,Nn,!1),this.isSupported()&&document.exitPictureInPicture!==void 0&&document.pictureInPictureElement!==null&&document.exitPictureInPicture(),n(this,Ze))try{document.body.removeChild(n(this,Ze))}catch(e){}this.removeAllSources(),m(this,Gt,void 0),m(this,Wt,void 0),m(this,Ws,void 0)}init({height:e,width:r}={}){if(!this.isSupported())throw this.logger.error("Pip.unsupported"),new Error("Picture-in-picture is not available in this environment");if(n(this,Nn))return;m(this,Nn,!0),this.createCanvas(),this.setupMediaSessionEvents();const i=document.createElement("video");m(this,Ce,{height:e!=null?e:kp,width:r!=null?r:Ip}),i.height=n(this,Ce).height,i.width=n(this,Ce).width,i.autoplay=!0,i.muted=!0,i.srcObject=n(this,Gt).captureStream(24),m(this,Wt,i),n(this,Wt).onloadedmetadata=()=>{try{this.emit("pipStarted"),n(this,Wt).onleavepictureinpicture=()=>{this.emit("pipEnded")}}catch(a){this.emit("pipEnded")}},this.createVideoContainer(),this.paintCanvas()}updateMediaSession(e,r){navigator.mediaSession!==void 0&&(e==="CAMERA"&&navigator.mediaSession.setCameraActive!==void 0&&navigator.mediaSession.setCameraActive(r),e==="MIC"&&navigator.mediaSession.setMicrophoneActive!==void 0&&navigator.mediaSession.setMicrophoneActive(r))}enableSource(e){n(this,ut)[e]!==void 0&&(n(this,ut)[e].enabled=!0)}disableSource(e){n(this,ut)[e]!==void 0&&(n(this,ut)[e].enabled=!1)}async generateAvatar(e,r){if(!r)return;const i=new Image;try{const a=await(await fetch(r)).blob(),o=window.URL.createObjectURL(a);i.onload=()=>{this.updateSource(e,{image:i}),window.URL.revokeObjectURL(o)},i.src=o}catch(a){this.logger.error("Pip::GenerateAvatar",{error:a})}}addSource(e,r,i,a=!1,o=void 0,c=void 0,d=!1){this.logger.debug("Pip::AddSource",{pip:{id:e,handRaised:d}}),n(this,ut)[e]={id:e,element:r,enabled:i,pinned:a,displayText:o?cw(o):void 0,imageUrl:c,handRaised:d},c&&this.generateAvatar(e,c)}updateSource(e,r){this.logger.info("Pip::UpdateSource",{pip:{id:e,handRaised:r.handRaised}});const i=n(this,ut)[e];i&&(n(this,ut)[e]={...i,...r})}removeSource(e){delete n(this,ut)[e]}removePinnedSource(){Object.values(n(this,ut)).forEach(r=>{r.pinned&&this.removeSource(r.id)})}removeAllSources(){m(this,ut,{})}enable(){m(this,Js,"activating"),this.setupEventListeners(),this.updateMediaSession("CAMERA",n(this,Ie).videoEnabled),this.updateMediaSession("MIC",n(this,Ie).audioEnabled),document.body.appendChild(n(this,Ze)),m(this,Ws,requestAnimationFrame(()=>this.animate())),n(this,Wt).onloadedmetadata=()=>{n(this,Wt).requestPictureInPicture().then(()=>{m(this,Js,"active")})},n(this,Wt).readyState===4&&n(this,Wt).requestPictureInPicture().then(()=>{m(this,Js,"active")})}};let Tu=Hh;Gt=new WeakMap,pi=new WeakMap,Ze=new WeakMap,Wt=new WeakMap,Ce=new WeakMap,ls=new WeakMap,Ws=new WeakMap,ut=new WeakMap,Ie=new WeakMap,Dn=new WeakMap,On=new WeakMap,Js=new WeakMap,Nn=new WeakMap;var fr;(function(s){s[s.PUBLISHER=0]="PUBLISHER",s[s.SUBSCRIBER=1]="SUBSCRIBER"})(fr||(fr={}));var xs;(function(s){s[s.AUDIO=0]="AUDIO",s[s.VIDEO=1]="VIDEO"})(xs||(xs={}));class lw extends v.MessageType{constructor(){super("media.Codec",[{no:1,name:"channels",kind:"scalar",opt:!0,T:5},{no:2,name:"clock_rate",kind:"scalar",T:5},{no:3,name:"mime_type",kind:"scalar",T:9},{no:4,name:"sdp_fmtp_line",kind:"scalar",opt:!0,T:9},{no:5,name:"payload_type",kind:"scalar",opt:!0,T:13}])}}const ef=new lw;class uw extends v.MessageType{constructor(){super("media.HeaderExtension",[{no:1,name:"direction",kind:"scalar",opt:!0,T:9},{no:2,name:"uri",kind:"scalar",T:9}])}}const hw=new uw;class pw extends v.MessageType{constructor(){super("media.Fingerprint",[{no:1,name:"algorithm",kind:"scalar",T:9},{no:2,name:"value",kind:"scalar",T:9}])}}new pw;class gw extends v.MessageType{constructor(){super("media.SessionDescription",[{no:1,name:"target",kind:"enum",T:()=>["media.Target",fr]},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"sdp",kind:"scalar",T:9}])}}const Rs=new gw;class mw extends v.MessageType{constructor(){super("media.ProducerPayload",[{no:1,name:"kind",kind:"scalar",T:9},{no:2,name:"paused",kind:"scalar",T:8},{no:3,name:"screen_share",kind:"scalar",T:8},{no:4,name:"msid",kind:"scalar",T:9},{no:5,name:"app_data",kind:"scalar",opt:!0,T:9},{no:6,name:"mime_type",kind:"scalar",opt:!0,T:9}])}}const fw=new mw;class Tw extends v.MessageType{constructor(){super("media.CreateTransportRequest",[{no:1,name:"consuming",kind:"scalar",T:8},{no:2,name:"force_tcp",kind:"scalar",opt:!0,T:8},{no:3,name:"description",kind:"message",T:()=>Rs},{no:4,name:"private_ice",kind:"scalar",opt:!0,T:8},{no:5,name:"producers",kind:"message",repeat:1,T:()=>fw}])}}const vw=new Tw;class yw extends v.MessageType{constructor(){super("media.AudioActivityRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"energy",kind:"scalar",T:5},{no:3,name:"silent",kind:"scalar",T:8}])}}const Sw=new yw;class Ew extends v.MessageType{constructor(){super("media.CreateTransportResponse",[{no:1,name:"transport_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>Rs},{no:3,name:"transcription_enabled",kind:"scalar",opt:!0,T:8},{no:4,name:"producer_ids",kind:"scalar",repeat:2,T:9}])}}const tf=new Ew;class Pw extends v.MessageType{constructor(){super("media.RenegotiateRequest",[{no:1,name:"transport_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>Rs}])}}const _w=new Pw;class Cw extends v.MessageType{constructor(){super("media.RenegotiateResponse",[{no:1,name:"transport_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>Rs}])}}new Cw;class ww extends v.MessageType{constructor(){super("media.NestedScore",[{no:1,name:"encoding_idx",kind:"scalar",T:5},{no:2,name:"rid",kind:"scalar",T:9},{no:3,name:"score",kind:"scalar",T:5},{no:4,name:"ssrc",kind:"scalar",T:3,L:0}])}}const Rw=new ww;class bw extends v.MessageType{constructor(){super("media.ProducerTrack",[{no:1,name:"track_id",kind:"scalar",T:9},{no:2,name:"producer_id",kind:"scalar",T:9},{no:3,name:"stream_id",kind:"scalar",T:9}])}}const kw=new bw;class Iw extends v.MessageType{constructor(){super("media.ProducerEntry",[{no:1,name:"producing_transport_id",kind:"scalar",T:9},{no:2,name:"producer_id",kind:"scalar",T:9}])}}new Iw;class Aw extends v.MessageType{constructor(){super("media.ConsumerEntry",[{no:1,name:"consuming_transport_id",kind:"scalar",T:9},{no:2,name:"consumer_id",kind:"scalar",T:9}])}}new Aw;class Mw extends v.MessageType{constructor(){super("media.ProducerState",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"kind",kind:"enum",T:()=>["media.ProducerKind",xs]},{no:3,name:"pause",kind:"scalar",T:8},{no:4,name:"screen_share",kind:"scalar",T:8},{no:5,name:"app_data",kind:"scalar",opt:!0,T:9},{no:6,name:"producing_transport_id",kind:"scalar",opt:!0,T:9},{no:7,name:"mime_type",kind:"scalar",opt:!0,T:9},{no:8,name:"codec",kind:"message",T:()=>ef}])}}const Lc=new Mw;class Dw extends v.MessageType{constructor(){super("media.ConsumerState",[{no:1,name:"consumer_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>Lc},{no:3,name:"producer_track",kind:"message",T:()=>kw},{no:4,name:"error_code",kind:"scalar",opt:!0,T:9}])}}const Ow=new Dw;class Nw extends v.MessageType{constructor(){super("media.ProducerIdToConsumerMap",[{no:1,name:"map",kind:"map",K:9,V:{kind:"message",T:()=>Ow}}])}}const sf=new Nw;class Vw extends v.MessageType{constructor(){super("media.PeerRtpCapabilitites",[{no:1,name:"sender",kind:"message",T:()=>Mp},{no:2,name:"receiver",kind:"message",T:()=>Mp}])}}const rf=new Vw;class Lw extends v.MessageType{constructor(){super("media.RtpCapability",[{no:1,name:"codecs",kind:"message",repeat:1,T:()=>ef},{no:2,name:"header_extensions",kind:"message",repeat:1,T:()=>hw}])}}const Ap=new Lw;class xw extends v.MessageType{constructor(){super("media.RtpCapabilitites",[{no:1,name:"audio",kind:"message",T:()=>Ap},{no:2,name:"video",kind:"message",T:()=>Ap}])}}const Mp=new xw;class Uw extends v.MessageType{constructor(){super("media.PreferredCodec",[{no:1,name:"audio",kind:"scalar",opt:!0,T:9},{no:2,name:"video",kind:"scalar",opt:!0,T:9}])}}const $w=new Uw;class Fw extends v.MessageType{constructor(){super("media.Simulcast",[{no:1,name:"preferred_rid",kind:"scalar",opt:!0,T:9},{no:2,name:"priority_ordering",kind:"scalar",opt:!0,T:9},{no:3,name:"rid_not_available",kind:"scalar",opt:!0,T:9}])}}const nf=new Fw;class Bw extends v.MessageType{constructor(){super("media.edge.GeoLocation",[{no:1,name:"latitude",kind:"scalar",T:2},{no:2,name:"longitude",kind:"scalar",T:2},{no:3,name:"region",kind:"scalar",opt:!0,T:9}])}}const Hw=new Bw;class qw extends v.MessageType{constructor(){super("media.edge.PeerJoinRequest",[{no:1,name:"display_name",kind:"scalar",opt:!0,T:9},{no:2,name:"prejoined",kind:"scalar",T:8},{no:3,name:"room_uuid",kind:"scalar",T:9},{no:4,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:5,name:"preset",kind:"scalar",opt:!0,T:12},{no:6,name:"user_id",kind:"scalar",opt:!0,T:9},{no:7,name:"organization_id",kind:"scalar",opt:!0,T:9},{no:8,name:"location",kind:"message",T:()=>Hw},{no:9,name:"capabilities",kind:"message",T:()=>rf}])}}const jw=new qw;class Gw extends v.MessageType{constructor(){super("media.edge.PeerJoinCompleteRequest",[])}}const Ww=new Gw;class Jw extends v.MessageType{constructor(){super("media.edge.PeerLeaveRequest",[{no:1,name:"close_room",kind:"scalar",T:8}])}}const Kw=new Jw;class zw extends v.MessageType{constructor(){super("media.edge.ConsumeMultipleProducerRequest",[{no:1,name:"producer_ids",kind:"scalar",repeat:2,T:9},{no:2,name:"paused",kind:"scalar",opt:!0,T:8}])}}new zw;class Yw extends v.MessageType{constructor(){super("media.edge.ConsumePeerRequest",[{no:1,name:"producing_peer_id",kind:"scalar",T:9},{no:2,name:"paused",kind:"scalar",opt:!0,T:8},{no:3,name:"producer_id",kind:"scalar",opt:!0,T:9},{no:4,name:"preferred_codec",kind:"message",T:()=>$w},{no:5,name:"producing_transport_id",kind:"scalar",opt:!0,T:9},{no:6,name:"simulcast",kind:"message",T:()=>nf}])}}const Qw=new Yw;class Xw extends v.MessageType{constructor(){super("media.edge.ConsumePeersRequest",[{no:1,name:"requests",kind:"message",repeat:1,T:()=>Qw},{no:2,name:"consuming_transport_id",kind:"scalar",opt:!0,T:9}])}}const Zw=new Xw;class eR extends v.MessageType{constructor(){super("media.edge.UpdateConsumerSimulcastConfigRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"simulcast",kind:"message",T:()=>nf},{no:3,name:"producing_transport_id",kind:"scalar",T:9},{no:4,name:"mid",kind:"scalar",T:9}])}}const tR=new eR;class sR extends v.MessageType{constructor(){super("media.edge.UpdateConsumersSimulcastConfigRequest",[{no:1,name:"requests",kind:"message",repeat:1,T:()=>tR},{no:2,name:"consuming_transport_id",kind:"scalar",opt:!0,T:9}])}}const rR=new sR;class iR extends v.MessageType{constructor(){super("media.edge.ProducerCreateRequest",[{no:1,name:"kind",kind:"scalar",T:9},{no:2,name:"paused",kind:"scalar",T:8},{no:3,name:"screen_share",kind:"scalar",T:8},{no:4,name:"description",kind:"message",T:()=>Rs},{no:5,name:"msid",kind:"scalar",T:9},{no:6,name:"app_data",kind:"scalar",opt:!0,T:9},{no:7,name:"mime_type",kind:"scalar",opt:!0,T:9},{no:8,name:"producing_transport_id",kind:"scalar",opt:!0,T:9}])}}const nR=new iR;class aR extends v.MessageType{constructor(){super("media.edge.SelectedPeersRequest",[])}}new aR;class oR extends v.MessageType{constructor(){super("media.edge.GlobalPeerPinningRequest",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}const cR=new oR;class dR extends v.MessageType{constructor(){super("media.edge.ProducerToggleRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"pause",kind:"scalar",T:8}])}}const Wc=new dR;class lR extends v.MessageType{constructor(){super("media.edge.ConsumerToggleRequest",[{no:1,name:"consumer_id",kind:"scalar",T:9},{no:2,name:"pause",kind:"scalar",T:8}])}}new lR;class uR extends v.MessageType{constructor(){super("media.edge.ProducerCloseRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>Rs},{no:3,name:"producing_transport_id",kind:"scalar",opt:!0,T:9}])}}const hR=new uR;class pR extends v.MessageType{constructor(){super("media.edge.ConsumerCloseRequest",[{no:1,name:"consumer_ids",kind:"scalar",repeat:2,T:9},{no:2,name:"description",kind:"message",T:()=>Rs},{no:3,name:"consuming_transport_id",kind:"scalar",opt:!0,T:9}])}}const gR=new pR;class mR extends v.MessageType{constructor(){super("media.edge.KickPeerRequest",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}new mR;class fR extends v.MessageType{constructor(){super("media.edge.KickAllPeersRequest",[{no:1,name:"propagate_kick_across_rooms",kind:"scalar",T:8}])}}const af=new fR;class TR extends v.MessageType{constructor(){super("media.edge.PeerDisplayNameEditRequest",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",T:9}])}}const vR=new TR;class yR extends v.MessageType{constructor(){super("media.edge.HostMediaControlForPeerRequest",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"audio",kind:"scalar",T:8},{no:3,name:"video",kind:"scalar",T:8},{no:4,name:"scree_share",kind:"scalar",T:8}])}}const SR=new yR;class ER extends v.MessageType{constructor(){super("media.edge.HostMediaControlForAllPeerRequest",[{no:1,name:"audio",kind:"scalar",T:8},{no:2,name:"video",kind:"scalar",T:8},{no:3,name:"screen_share",kind:"scalar",T:8}])}}const PR=new ER;class _R extends v.MessageType{constructor(){super("media.edge.GetRoomStateResponse",[{no:1,name:"display_title",kind:"scalar",T:9},{no:2,name:"locked_mode",kind:"scalar",T:8},{no:3,name:"room_uuid",kind:"scalar",T:9},{no:4,name:"room_name",kind:"scalar",T:9},{no:5,name:"current_peer_id",kind:"scalar",T:9},{no:6,name:"is_recording",kind:"scalar",opt:!0,T:8},{no:7,name:"recorder_participant_id",kind:"scalar",opt:!0,T:9},{no:8,name:"pinned_peer_ids",kind:"scalar",repeat:2,T:9}])}}const CR=new _R;class wR extends v.MessageType{constructor(){super("media.edge.ErrorResponse",[{no:1,name:"error_message",kind:"scalar",T:9},{no:2,name:"event_id",kind:"scalar",T:5}])}}const RR=new wR;class bR extends v.MessageType{constructor(){super("media.edge.EmptyResponse",[])}}new bR;class kR extends v.MessageType{constructor(){super("media.edge.RoomParticipants",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"producer_states",kind:"message",repeat:1,T:()=>Lc},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"user_id",kind:"scalar",opt:!0,T:9},{no:5,name:"capabilities",kind:"message",T:()=>rf}])}}const of=new kR;class IR extends v.MessageType{constructor(){super("media.edge.SelectedPeersResponse",[{no:1,name:"audio_peers",kind:"scalar",repeat:2,T:9},{no:2,name:"compulsory_peers",kind:"scalar",repeat:2,T:9}])}}const vu=new IR;class AR extends v.MessageType{constructor(){super("media.edge.SelectedPeersDiffEntry",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"priority",kind:"scalar",T:5}])}}const MR=new AR;class DR extends v.MessageType{constructor(){super("media.edge.SelectedPeersDiffResponse",[{no:1,name:"entries",kind:"message",repeat:1,T:()=>MR}])}}const Dp=new DR;class OR extends v.MessageType{constructor(){super("media.edge.PeerJoinResponse",[])}}new OR;class NR extends v.MessageType{constructor(){super("media.edge.PeerJoinCompleteResponse",[{no:1,name:"room_state",kind:"message",T:()=>CR},{no:2,name:"participants",kind:"message",repeat:1,T:()=>of},{no:3,name:"selected_peers",kind:"message",T:()=>vu},{no:4,name:"max_preferred_streams",kind:"scalar",T:5}])}}const yu=new NR;class VR extends v.MessageType{constructor(){super("media.edge.PeerLeaveResponse",[{no:1,name:"closed",kind:"scalar",T:8}])}}const LR=new VR;class xR extends v.MessageType{constructor(){super("media.edge.ConsumeMultipleProducerResponse",[{no:1,name:"status",kind:"scalar",T:8},{no:2,name:"consumer_ids_map",kind:"message",T:()=>sf}])}}new xR;class UR extends v.MessageType{constructor(){super("media.edge.ConsumePeerResponse",[{no:1,name:"status",kind:"scalar",T:8},{no:2,name:"consumer_ids_map",kind:"message",T:()=>sf},{no:3,name:"description",kind:"message",T:()=>Rs}])}}const $R=new UR;class FR extends v.MessageType{constructor(){super("media.edge.ProducerCreateResponse",[{no:1,name:"status",kind:"scalar",T:8},{no:2,name:"producer_id",kind:"scalar",T:9},{no:4,name:"description",kind:"message",T:()=>Rs}])}}const BR=new FR;class HR extends v.MessageType{constructor(){super("media.edge.ProducerScoreResponse",[{no:1,name:"responseid",kind:"scalar",T:9},{no:2,name:"score",kind:"message",T:()=>Rw}])}}new HR;class qR extends v.MessageType{constructor(){super("media.edge.ActiveSpeakerResponse",[{no:1,name:"responsepeer_id",kind:"scalar",T:9},{no:2,name:"volume",kind:"scalar",T:5}])}}new qR;class jR extends v.MessageType{constructor(){super("media.edge.NoActiveSpeakerResponse",[])}}new jR;class GR extends v.MessageType{constructor(){super("media.edge.ProducerToggleResponse",[])}}new GR;class WR extends v.MessageType{constructor(){super("media.edge.ConsumerToggleResponse",[])}}new WR;class JR extends v.MessageType{constructor(){super("media.edge.ProducerClosingResponse",[{no:1,name:"description",kind:"message",T:()=>Rs}])}}const KR=new JR;class zR extends v.MessageType{constructor(){super("media.edge.ConsumerClosingResponse",[{no:1,name:"description",kind:"message",T:()=>Rs}])}}const YR=new zR;class QR extends v.MessageType{constructor(){super("media.edge.GlobalPeerPinningResponse",[])}}new QR;class XR extends v.MessageType{constructor(){super("media.edge.KickPeerResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}new XR;class ZR extends v.MessageType{constructor(){super("media.edge.KickAllPeersResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}new ZR;class eb extends v.MessageType{constructor(){super("media.edge.HostMediaControlForPeerResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}const tb=new eb;class sb extends v.MessageType{constructor(){super("media.edge.HostMediaControlForAllPeerResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}const rb=new sb;class ib extends v.MessageType{constructor(){super("media.edge.PeerDisplayNameEditResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}const nb=new ib;class ab extends v.MessageType{constructor(){super("media.edge.PeerJoinBroadcastResponse",[{no:1,name:"participant",kind:"message",T:()=>of}])}}const Op=new ab;class ob extends v.MessageType{constructor(){super("media.edge.TrackSubscriptionKind",[{no:1,name:"audio",kind:"scalar",T:8},{no:2,name:"video",kind:"scalar",T:8}])}}const Np=new ob;class cb extends v.MessageType{constructor(){super("media.edge.TrackSubscription",[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"webcam",kind:"message",T:()=>Np},{no:3,name:"screenshare",kind:"message",T:()=>Np}])}}const db=new cb;class lb extends v.MessageType{constructor(){super("media.edge.PeerProducingTransportCreateBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"transport_details",kind:"message",T:()=>tf},{no:3,name:"track_subscriptions",kind:"message",repeat:1,T:()=>db}])}}new lb;class ub extends v.MessageType{constructor(){super("media.edge.PeerProducerCreateBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>Lc}])}}const hb=new ub;class pb extends v.MessageType{constructor(){super("media.edge.PeerProducerToggleBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>Lc},{no:3,name:"initiator_participant_id",kind:"scalar",opt:!0,T:9}])}}const Vp=new pb;class gb extends v.MessageType{constructor(){super("media.edge.PeerProducerCloseBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>Lc}])}}const mb=new gb;class fb extends v.MessageType{constructor(){super("media.edge.PeerLeaveBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}const Su=new fb;class Tb extends v.MessageType{constructor(){super("media.edge.GlobalPeerPinningBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}const Lp=new Tb;class vb extends v.MessageType{constructor(){super("media.edge.GlobalPeerUnPinningBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}new vb;class yb extends v.MessageType{constructor(){super("media.edge.RecordingStartedBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}new yb;class Sb extends v.MessageType{constructor(){super("media.edge.RecordingStoppedBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}new Sb;class Eb extends v.MessageType{constructor(){super("media.edge.PeerDisplayNameEditBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",T:9}])}}new Eb;class Pb extends v.MessageType{constructor(){super("media.edge.PeerPingRequestBroadcastResponse",[{no:1,name:"password",kind:"scalar",T:9}])}}new Pb;class _b extends v.MessageType{constructor(){super("media.edge.MediaRoomTerminationBroadcastResponse",[{no:1,name:"reason",kind:"scalar",T:9}])}}new _b;class Cb extends v.MessageType{constructor(){super("socket.ai.MeetingTranscript",[{no:1,name:"meeting_id",kind:"scalar",T:9},{no:2,name:"transcript",kind:"scalar",T:9},{no:3,name:"is_partial",kind:"scalar",T:8}])}}const Zl=new Cb;class wb extends v.MessageType{constructor(){super("socket.api.BaseSocketHubMessage",[{no:1,name:"event",kind:"scalar",T:5},{no:2,name:"id",kind:"scalar",T:9},{no:3,name:"peer_id",kind:"scalar",T:9},{no:4,name:"room_id",kind:"scalar",T:9},{no:5,name:"user_id",kind:"scalar",T:9},{no:6,name:"payload",kind:"scalar",T:12},{no:7,name:"error",kind:"scalar",opt:!0,T:8},{no:8,name:"sid",kind:"scalar",opt:!0,T:9}])}}new wb;class Rb extends v.MessageType{constructor(){super("socket.api.ErrorMessage",[{no:1,name:"code",kind:"scalar",opt:!0,T:5},{no:2,name:"message",kind:"scalar",T:9}])}}const bb=new Rb;var sn;(function(s){s[s.BROWSER=0]="BROWSER",s[s.TRACK=1]="TRACK",s[s.COMPOSITE=2]="COMPOSITE"})(sn||(sn={}));var lr;(function(s){s[s.UNSPECIFIED=0]="UNSPECIFIED",s[s.ON_STAGE=1]="ON_STAGE",s[s.APPROVED_STAGE=2]="APPROVED_STAGE",s[s.REQUESTED_STAGE=3]="REQUESTED_STAGE",s[s.OFF_STAGE=4]="OFF_STAGE"})(lr||(lr={}));var Eu;(function(s){s[s.NONE=0]="NONE",s[s.RECORDER=1]="RECORDER",s[s.LIVESTREAMER=2]="LIVESTREAMER"})(Eu||(Eu={}));var Pu;(function(s){s[s.PEERS=0]="PEERS",s[s.ROOMS=1]="ROOMS"})(Pu||(Pu={}));var Sd;(function(s){s[s.HIVE=0]="HIVE",s[s.CHAT=1]="CHAT",s[s.PING=2]="PING"})(Sd||(Sd={}));class kb extends v.MessageType{constructor(){super("socket.room.PeerFlags",[{no:1,name:"preset_name",kind:"scalar",T:9},{no:2,name:"recorder_type",kind:"scalar",T:9},{no:3,name:"hidden_participant",kind:"scalar",T:8}])}}const Ib=new kb;class Ab extends v.MessageType{constructor(){super("socket.room.Peer",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"stage_type",kind:"enum",opt:!0,T:()=>["socket.room.StageType",lr,"STAGE_TYPE_"]},{no:5,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:6,name:"preset_id",kind:"scalar",opt:!0,T:9},{no:7,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:8,name:"waitlisted",kind:"scalar",T:8},{no:9,name:"flags",kind:"message",T:()=>Ib}])}}const Vl=new Ab;class Mb extends v.MessageType{constructor(){super("socket.room.PeerInfoResponse",[{no:1,name:"peer",kind:"message",T:()=>Vl}])}}const fn=new Mb;class Db extends v.MessageType{constructor(){super("socket.room.PeerStatusUpdate",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"stage_type",kind:"enum",opt:!0,T:()=>["socket.room.StageType",lr,"STAGE_TYPE_"]}])}}const xp=new Db;class Ob extends v.MessageType{constructor(){super("socket.room.RoomPeersInfoRequest",[{no:1,name:"seach_query",kind:"scalar",T:9},{no:2,name:"limit",kind:"scalar",T:5},{no:3,name:"offset",kind:"scalar",T:5}])}}const Nb=new Ob;class Vb extends v.MessageType{constructor(){super("socket.room.RoomPeersInfoResponse",[{no:1,name:"peers",kind:"message",repeat:1,T:()=>Vl}])}}const eu=new Vb;class Lb extends v.MessageType{constructor(){super("socket.room.RoomPeerCountResponse",[{no:1,name:"count",kind:"scalar",T:4,L:2}])}}const Up=new Lb;class xb extends v.MessageType{constructor(){super("socket.room.Room",[{no:1,name:"room_id",kind:"scalar",T:9},{no:2,name:"title",kind:"scalar",T:9},{no:4,name:"created_at",kind:"scalar",T:4,L:2},{no:5,name:"active_recordings",kind:"message",repeat:1,T:()=>$b},{no:6,name:"room_uuid",kind:"scalar",opt:!0,T:9}])}}const cf=new xb;class Ub extends v.MessageType{constructor(){super("socket.room.ActiveRecording",[{no:1,name:"recording_id",kind:"scalar",T:9},{no:2,name:"recording_type",kind:"enum",T:()=>["common.RecordingType",sn]},{no:3,name:"recording_status",kind:"scalar",T:9}])}}const $b=new Ub;class Fb extends v.MessageType{constructor(){super("socket.room.RoomInfoResponse",[{no:1,name:"room",kind:"message",T:()=>cf}])}}const $p=new Fb;class Bb extends v.MessageType{constructor(){super("socket.room.GetPeerInfoRequest",[{no:1,name:"peer_id",kind:"scalar",T:9}])}}const df=new Bb;class Hb extends v.MessageType{constructor(){super("socket.room.UpdatePeerInfoRequest",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",opt:!0,T:9}])}}new Hb;class qb extends v.MessageType{constructor(){super("socket.room.JoinRoomRequest",[{no:1,name:"peer",kind:"message",T:()=>Vl},{no:3,name:"room_uuid",kind:"scalar",T:9},{no:4,name:"organization_id",kind:"scalar",opt:!0,T:9},{no:5,name:"use_hive",kind:"scalar",opt:!0,T:8},{no:6,name:"preset",kind:"scalar",opt:!0,T:12},{no:7,name:"capabilities",kind:"enum",repeat:1,T:()=>["socket.room.Capabilities",Sd,"CAPABILITIES_"]},{no:8,name:"timestamp",kind:"scalar",opt:!0,T:4,L:2}])}}const jb=new qb;class Gb extends v.MessageType{constructor(){super("socket.room.LeaveRoomRequest",[{no:1,name:"peer",kind:"message",T:()=>Vl},{no:2,name:"timestamp",kind:"scalar",opt:!0,T:4,L:2}])}}const Wb=new Gb;class Jb extends v.MessageType{constructor(){super("socket.room.UpdateRoomInfoRequest",[{no:1,name:"room",kind:"message",T:()=>cf}])}}new Jb;class Kb extends v.MessageType{constructor(){super("socket.room.GetConnectedRoomsDumpRequest",[])}}new Kb;class zb extends v.MessageType{constructor(){super("socket.room.ServiceError",[{no:1,name:"message",kind:"scalar",opt:!0,T:9},{no:2,name:"code",kind:"scalar",opt:!0,T:9}])}}const Ph=new zb;class Yb extends v.MessageType{constructor(){super("socket.room.ConnectedMeetingPeer",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"display_name",kind:"scalar",opt:!0,T:9},{no:3,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:4,name:"preset_id",kind:"scalar",opt:!0,T:9},{no:5,name:"display_picture_url",kind:"scalar",opt:!0,T:9}])}}const Qb=new Yb;class Xb extends v.MessageType{constructor(){super("socket.room.ConnectedMeetingDump",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"title",kind:"scalar",opt:!0,T:9},{no:3,name:"participants",kind:"message",repeat:1,T:()=>Qb}])}}const Fp=new Xb;class Zb extends v.MessageType{constructor(){super("socket.room.GetConnectedRoomsDumpResponse",[{no:1,name:"parent_meeting",kind:"message",T:()=>Fp},{no:2,name:"meetings",kind:"message",repeat:1,T:()=>Fp}])}}const ek=new Zb;class tk extends v.MessageType{constructor(){super("socket.room.CreateRoomRequestPayload",[{no:1,name:"title",kind:"scalar",opt:!0,T:9}])}}const sk=new tk;class rk extends v.MessageType{constructor(){super("socket.room.CreateConnectedRoomsRequest",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>sk}])}}const ik=new rk;class nk extends v.MessageType{constructor(){super("socket.room.CreateRoomResponsePayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"title",kind:"scalar",opt:!0,T:9},{no:3,name:"error",kind:"message",T:()=>Ph}])}}const ak=new nk;class ok extends v.MessageType{constructor(){super("socket.room.CreateConnectedRoomsResponse",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>ak}])}}const Bp=new ok;class ck extends v.MessageType{constructor(){super("socket.room.UpdateRoomRequestPayload",[{no:1,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"title",kind:"scalar",opt:!0,T:9}])}}const dk=new ck;class lk extends v.MessageType{constructor(){super("socket.room.UpdateConnectedRoomsRequest",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>dk}])}}new lk;class uk extends v.MessageType{constructor(){super("socket.room.DisableRoomPayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9}])}}const hk=new uk;class pk extends v.MessageType{constructor(){super("socket.room.DisableConnectedRoomsRequest",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>hk}])}}const gk=new pk;class mk extends v.MessageType{constructor(){super("socket.room.DisableConnectedRoomsResponse",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>vk}])}}const fk=new mk;class Tk extends v.MessageType{constructor(){super("socket.room.DisableConnectedRoomPayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"status",kind:"scalar",opt:!0,T:9},{no:3,name:"title",kind:"scalar",opt:!0,T:9},{no:4,name:"error",kind:"message",T:()=>Ph}])}}const vk=new Tk;class yk extends v.MessageType{constructor(){super("socket.room.MovePeerPayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"preset_id",kind:"scalar",opt:!0,T:9}])}}const Sk=new yk;class Ek extends v.MessageType{constructor(){super("socket.room.MovePeersBetweenRoomsRequest",[{no:1,name:"source_meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"destination_meeting_id",kind:"scalar",opt:!0,T:9},{no:3,name:"participants",kind:"message",repeat:1,T:()=>Sk}])}}const Pk=new Ek;class _k extends v.MessageType{constructor(){super("socket.room.MovedPeer",[{no:1,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:3,name:"error",kind:"message",T:()=>Ph}])}}const lf=new _k;class Ck extends v.MessageType{constructor(){super("socket.room.MovePeersBetweenRoomsResponse",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>lf}])}}new Ck;class wk extends v.MessageType{constructor(){super("socket.room.TransferPeer",[{no:1,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"auth_token",kind:"scalar",opt:!0,T:9}])}}const Rk=new wk;class bk extends v.MessageType{constructor(){super("socket.room.GetAllAddedParticipantsResponse",[{no:1,name:"participants",kind:"message",repeat:1,T:()=>Ak}])}}const kk=new bk;class Ik extends v.MessageType{constructor(){super("socket.room.AddedParticipant",[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",opt:!0,T:9},{no:3,name:"picture",kind:"scalar",opt:!0,T:9},{no:4,name:"custom_participant_id",kind:"scalar",T:9}])}}const Ak=new Ik;class Mk extends v.MessageType{constructor(){super("socket.room.RemoveParticipantsRequest",[{no:1,name:"peer_ids",kind:"scalar",repeat:2,T:9}])}}const uf=new Mk;class Dk extends v.MessageType{constructor(){super("socket.room.BroadcastMessage",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"timestamp",kind:"scalar",T:4,L:2},{no:4,name:"ids",kind:"scalar",repeat:2,T:9},{no:5,name:"broadcast_type",kind:"enum",opt:!0,T:()=>["socket.room.BroadcastType",Pu,"BROADCAST_TYPE_"]}])}}const ro=new Dk;class Ok extends v.MessageType{constructor(){super("socket.room.AcceptWaitingRoomRequests",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const Nk=new Ok;class Vk extends v.MessageType{constructor(){super("socket.room.DenyWaitingRoomRequests",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const Lk=new Vk;class xk extends v.MessageType{constructor(){super("socket.room.WaitingRoomRequest",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"picture",kind:"scalar",opt:!0,T:9},{no:5,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:6,name:"preset_name",kind:"scalar",opt:!0,T:9}])}}const Uk=new xk;class $k extends v.MessageType{constructor(){super("socket.room.GetWaitingRoomRequests",[{no:1,name:"requests",kind:"message",repeat:1,T:()=>Uk}])}}const Hp=new $k;class Fk extends v.MessageType{constructor(){super("socket.room.GetRoomStageStateResponse",[{no:1,name:"on_stage_peers",kind:"scalar",repeat:2,T:9},{no:2,name:"approved_stage_peers",kind:"scalar",repeat:2,T:9},{no:3,name:"requested_stage_peers",kind:"scalar",repeat:2,T:9}])}}const qp=new Fk;var _u;(function(s){s[s.NONE=0]="NONE",s[s.SKIP=1]="SKIP",s[s.ON_PRIVILEGED_USER_ENTRY=2]="ON_PRIVILEGED_USER_ENTRY",s[s.SKIP_ON_ACCEPT=3]="SKIP_ON_ACCEPT"})(_u||(_u={}));var zr;(function(s){s[s.NONE=0]="NONE",s[s.ALLOWED=1]="ALLOWED",s[s.NOT_ALLOWED=2]="NOT_ALLOWED",s[s.CAN_REQUEST=3]="CAN_REQUEST"})(zr||(zr={}));class Bk extends v.MessageType{constructor(){super("socket.preset.PollsPermissionUpdate",[{no:1,name:"can_create",kind:"scalar",opt:!0,T:8},{no:2,name:"can_vote",kind:"scalar",opt:!0,T:8},{no:3,name:"can_view",kind:"scalar",opt:!0,T:8}])}}const Hk=new Bk;class qk extends v.MessageType{constructor(){super("socket.preset.PluginsPermissionsUpdate",[{no:1,name:"can_close",kind:"scalar",opt:!0,T:8},{no:2,name:"can_start",kind:"scalar",opt:!0,T:8}])}}const jk=new qk;class Gk extends v.MessageType{constructor(){super("socket.preset.PublicChatPermission",[{no:1,name:"can_send",kind:"scalar",opt:!0,T:8},{no:2,name:"text",kind:"scalar",opt:!0,T:8},{no:3,name:"files",kind:"scalar",opt:!0,T:8}])}}const Wk=new Gk;class Jk extends v.MessageType{constructor(){super("socket.preset.PrivateChatPermission",[{no:1,name:"can_send",kind:"scalar",opt:!0,T:8},{no:2,name:"can_receive",kind:"scalar",opt:!0,T:8},{no:3,name:"text",kind:"scalar",opt:!0,T:8},{no:4,name:"files",kind:"scalar",opt:!0,T:8}])}}const Kk=new Jk;class zk extends v.MessageType{constructor(){super("socket.preset.ChatPermissionUpdate",[{no:1,name:"public",kind:"message",T:()=>Wk},{no:2,name:"private",kind:"message",T:()=>Kk}])}}const Yk=new zk;class Qk extends v.MessageType{constructor(){super("socket.preset.ConnectedMeetingPermissionUpdate",[{no:1,name:"can_alter_connected_meetings",kind:"scalar",opt:!0,T:8},{no:2,name:"can_switch_to_parent_meeting",kind:"scalar",opt:!0,T:8},{no:3,name:"can_switch_connected_meetings",kind:"scalar",opt:!0,T:8}])}}const Xk=new Qk;class Zk extends v.MessageType{constructor(){super("socket.preset.StreamPermission",[{no:1,name:"can_produce",kind:"enum",opt:!0,T:()=>["socket.preset.StreamPermissionType",zr,"STREAM_PERMISSION_TYPE_"]},{no:2,name:"can_consume",kind:"enum",opt:!0,T:()=>["socket.preset.StreamPermissionType",zr,"STREAM_PERMISSION_TYPE_"]}])}}const tu=new Zk;class eI extends v.MessageType{constructor(){super("socket.preset.MediaPermissionUpdate",[{no:1,name:"video",kind:"message",T:()=>tu},{no:2,name:"audio",kind:"message",T:()=>tu},{no:3,name:"screenshare",kind:"message",T:()=>tu}])}}const tI=new eI;class sI extends v.MessageType{constructor(){super("socket.preset.PresetUpdates",[{no:1,name:"polls",kind:"message",T:()=>Hk},{no:2,name:"plugins",kind:"message",T:()=>jk},{no:3,name:"chat",kind:"message",T:()=>Yk},{no:4,name:"accept_waiting_requests",kind:"scalar",opt:!0,T:8},{no:5,name:"can_accept_production_requests",kind:"scalar",opt:!0,T:8},{no:6,name:"can_edit_display_name",kind:"scalar",opt:!0,T:8},{no:7,name:"can_record",kind:"scalar",opt:!0,T:8},{no:8,name:"can_livestream",kind:"scalar",opt:!0,T:8},{no:9,name:"can_spotlight",kind:"scalar",opt:!0,T:8},{no:10,name:"disable_participant_audio",kind:"scalar",opt:!0,T:8},{no:11,name:"disable_participant_screensharing",kind:"scalar",opt:!0,T:8},{no:12,name:"disable_participant_video",kind:"scalar",opt:!0,T:8},{no:13,name:"kick_participant",kind:"scalar",opt:!0,T:8},{no:14,name:"pin_participant",kind:"scalar",opt:!0,T:8},{no:15,name:"transcription_enabled",kind:"scalar",opt:!0,T:8},{no:16,name:"waiting_room_type",kind:"enum",opt:!0,T:()=>["socket.preset.WaitingRoomType",_u,"WAITING_ROOM_TYPE_"]},{no:17,name:"is_recorder",kind:"scalar",opt:!0,T:8},{no:18,name:"recorder_type",kind:"enum",opt:!0,T:()=>["socket.room.RecorderType",Eu,"RECORDER_TYPE_"]},{no:19,name:"hidden_participant",kind:"scalar",opt:!0,T:8},{no:20,name:"show_participant_list",kind:"scalar",opt:!0,T:8},{no:21,name:"can_change_participant_permissions",kind:"scalar",opt:!0,T:8},{no:22,name:"connected_meetings",kind:"message",T:()=>Xk},{no:23,name:"media",kind:"message",T:()=>tI}])}}const _h=new sI;class rI extends v.MessageType{constructor(){super("socket.preset.ReadPeersPresetRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const iI=new rI;class nI extends v.MessageType{constructor(){super("socket.preset.PeerPreset",[{no:1,name:"user_id",kind:"scalar",T:9},{no:2,name:"peer_id",kind:"scalar",T:9},{no:3,name:"preset",kind:"scalar",T:12}])}}const aI=new nI;class oI extends v.MessageType{constructor(){super("socket.preset.ReadPeersPresetResponse",[{no:1,name:"peer_presets",kind:"message",repeat:1,T:()=>aI}])}}const cI=new oI;class dI extends v.MessageType{constructor(){super("socket.preset.UpdatePeerPreset",[{no:1,name:"user_ids",kind:"scalar",T:9},{no:2,name:"patch",kind:"message",T:()=>_h}])}}const hf=new dI;class lI extends v.MessageType{constructor(){super("socket.preset.UpdatePeersPresetRequest",[{no:1,name:"update_peers_presets",kind:"message",repeat:1,T:()=>hf}])}}const uI=new lI;class hI extends v.MessageType{constructor(){super("socket.preset.UpdatePeersPresetResponse",[{no:1,name:"update_peers_presets",kind:"message",repeat:1,T:()=>hf}])}}const jp=new hI;class pI extends v.MessageType{constructor(){super("socket.preset.PeerUserIDMap",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9}])}}const gI=new pI;class mI extends v.MessageType{constructor(){super("socket.preset.BulkUpdatePeerPresetRequest",[{no:1,name:"peers",kind:"message",repeat:1,T:()=>gI},{no:2,name:"patch",kind:"message",T:()=>_h}])}}new mI;class fI extends v.MessageType{constructor(){super("socket.preset.BulkUpdatePeerPresetResponse",[{no:2,name:"patch",kind:"message",T:()=>_h}])}}new fI;class TI extends v.MessageType{constructor(){super("socket.chat.ChatMessage",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"peer_id",kind:"scalar",T:9},{no:3,name:"user_id",kind:"scalar",T:9},{no:4,name:"display_name",kind:"scalar",T:9},{no:5,name:"pinned",kind:"scalar",T:8},{no:6,name:"is_edited",kind:"scalar",T:8},{no:7,name:"payload_type",kind:"scalar",T:5},{no:8,name:"payload",kind:"scalar",T:9},{no:10,name:"target_user_ids",kind:"scalar",repeat:2,T:9},{no:11,name:"created_at",kind:"scalar",T:4,L:2},{no:12,name:"created_at_ms",kind:"scalar",opt:!0,T:4,L:2},{no:13,name:"channel_id",kind:"scalar",opt:!0,T:9},{no:14,name:"channel_index",kind:"scalar",opt:!0,T:9}])}}const un=new TI;class vI extends v.MessageType{constructor(){super("socket.chat.GetPaginatedChatMessageRoomRequest",[{no:1,name:"time_stamp",kind:"scalar",T:4,L:2},{no:2,name:"size",kind:"scalar",T:5},{no:3,name:"from",kind:"scalar",T:5},{no:4,name:"reversed",kind:"scalar",T:8},{no:5,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const yI=new vI;class SI extends v.MessageType{constructor(){super("socket.chat.GetPaginatedChatMessageRoomResponse",[{no:1,name:"messages",kind:"message",repeat:1,T:()=>un},{no:2,name:"next",kind:"scalar",T:8}])}}const EI=new SI;class PI extends v.MessageType{constructor(){super("socket.chat.GetChatMessagesResponse",[{no:1,name:"messages",kind:"message",repeat:1,T:()=>un}])}}const pf=new PI;class _I extends v.MessageType{constructor(){super("socket.chat.SendChatMessageToRoomRequest",[{no:1,name:"payload_type",kind:"scalar",T:5},{no:2,name:"payload",kind:"scalar",T:9}])}}const CI=new _I;class wI extends v.MessageType{constructor(){super("socket.chat.SendChatMessageToRoomResponse",[{no:1,name:"message",kind:"message",T:()=>un}])}}const su=new wI;class RI extends v.MessageType{constructor(){super("socket.chat.SendChatMessageToPeersRequest",[{no:1,name:"peer_ids",kind:"scalar",repeat:2,T:9},{no:2,name:"payload_type",kind:"scalar",T:5},{no:3,name:"payload",kind:"scalar",T:9}])}}const bI=new RI;class kI extends v.MessageType{constructor(){super("socket.chat.SendChatMessageToPeersResponse",[{no:1,name:"message",kind:"message",T:()=>un}])}}const ru=new kI;class II extends v.MessageType{constructor(){super("socket.chat.SendChatMessageToChannelRequest",[{no:1,name:"channel_id",kind:"scalar",T:9},{no:2,name:"payload_type",kind:"scalar",T:5},{no:3,name:"payload",kind:"scalar",T:9}])}}const AI=new II;class MI extends v.MessageType{constructor(){super("socket.chat.SendChatMessageToChannelResponse",[{no:1,name:"message",kind:"message",T:()=>un}])}}new MI;class DI extends v.MessageType{constructor(){super("socket.chat.EditChatMessageRequest",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"payload_type",kind:"scalar",opt:!0,T:5},{no:3,name:"payload",kind:"scalar",opt:!0,T:9},{no:4,name:"pinned",kind:"scalar",opt:!0,T:8},{no:5,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const OI=new DI;class NI extends v.MessageType{constructor(){super("socket.chat.PinChatMessageRequest",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"pinned",kind:"scalar",T:8},{no:3,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const VI=new NI;class LI extends v.MessageType{constructor(){super("socket.chat.PinChatMessageResponse",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"pinned",kind:"scalar",T:8},{no:3,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const Jc=new LI;class xI extends v.MessageType{constructor(){super("socket.chat.EditChatMessageResponse",[{no:1,name:"message",kind:"message",T:()=>un}])}}const Kc=new xI;class UI extends v.MessageType{constructor(){super("socket.chat.DeleteChatMessageRequest",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const $I=new UI;class FI extends v.MessageType{constructor(){super("socket.chat.DeleteChatMessageResponse",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const zc=new FI;class BI extends v.MessageType{constructor(){super("socket.chat.SearchChatMessagesRequest",[{no:1,name:"time_stamp",kind:"scalar",T:4,L:2},{no:2,name:"size",kind:"scalar",T:5},{no:3,name:"from",kind:"scalar",T:5},{no:4,name:"reversed",kind:"scalar",T:8},{no:5,name:"channel_id",kind:"scalar",opt:!0,T:9},{no:6,name:"search_term",kind:"scalar",T:9}])}}const HI=new BI;class qI extends v.MessageType{constructor(){super("socket.chat.MarkChannelIndexAsReadRequest",[{no:1,name:"channel_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"channel_index",kind:"scalar",T:9}])}}const jI=new qI;class GI extends v.MessageType{constructor(){super("socket.chat.MarkChannelIndexAsReadResponse",[{no:1,name:"channel_index",kind:"scalar",T:9}])}}const WI=new GI;class JI extends v.MessageType{constructor(){super("socket.chat.CreateChatChannelRequest",[{no:1,name:"display_name",kind:"scalar",T:9},{no:2,name:"target_user_ids",kind:"scalar",repeat:2,T:9},{no:3,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:4,name:"visibility",kind:"scalar",T:9},{no:5,name:"is_direct_message",kind:"scalar",T:8}])}}const KI=new JI;class zI extends v.MessageType{constructor(){super("socket.chat.UpdateChatChannelRequest",[{no:1,name:"chat_channel_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",opt:!0,T:9},{no:3,name:"target_user_ids",kind:"scalar",repeat:2,T:9},{no:4,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:5,name:"visibility",kind:"scalar",opt:!0,T:9},{no:6,name:"is_direct_message",kind:"scalar",opt:!0,T:8}])}}const YI=new zI;class QI extends v.MessageType{constructor(){super("socket.chat.CreateChatChannelResponse",[{no:1,name:"chat_channel_id",kind:"scalar",T:9}])}}new QI;class XI extends v.MessageType{constructor(){super("socket.chat.GetChatChannelRequest",[{no:1,name:"chat_channel_id",kind:"scalar",T:9}])}}const ZI=new XI;class eA extends v.MessageType{constructor(){super("socket.chat.LatestMessageAndUnreadCount",[{no:1,name:"message",kind:"message",T:()=>un},{no:2,name:"unread_count",kind:"scalar",T:4,L:2}])}}const tA=new eA;class sA extends v.MessageType{constructor(){super("socket.chat.ChatChannel",[{no:1,name:"chat_channel_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",T:9},{no:3,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:4,name:"visibility",kind:"scalar",T:9},{no:5,name:"is_direct_message",kind:"scalar",T:8},{no:6,name:"latest_message_and_unread_count",kind:"message",T:()=>tA},{no:7,name:"target_user_ids",kind:"scalar",repeat:2,T:9}])}}const rA=new sA;class iA extends v.MessageType{constructor(){super("socket.chat.GetChatChannelResponse",[{no:1,name:"chat_channels",kind:"message",repeat:1,T:()=>rA}])}}const Bs=new iA;class nA extends v.MessageType{constructor(){super("socket.chat.ChannelMember",[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",opt:!0,T:9},{no:3,name:"picture",kind:"scalar",opt:!0,T:9},{no:4,name:"custom_participant_id",kind:"scalar",T:9}])}}const aA=new nA;class oA extends v.MessageType{constructor(){super("socket.chat.GetChatChannelMembersResponse",[{no:1,name:"channel_members",kind:"message",repeat:1,T:()=>aA}])}}const cA=new oA;class dA extends v.MessageType{constructor(){super("socket.plugin.AddPluginRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"staggered",kind:"scalar",T:8}])}}const lA=new dA;class uA extends v.MessageType{constructor(){super("socket.plugin.RemovePluginRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"staggered",kind:"scalar",T:8}])}}const hA=new uA;class pA extends v.MessageType{constructor(){super("socket.plugin.EnablePluginForRoomRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9}])}}const gA=new pA;class mA extends v.MessageType{constructor(){super("socket.plugin.DisablePluginForRoomRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9}])}}const fA=new mA;class TA extends v.MessageType{constructor(){super("socket.plugin.EnablePluginForPeersRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"peer_ids",kind:"scalar",repeat:2,T:9}])}}const vA=new TA;class yA extends v.MessageType{constructor(){super("socket.plugin.DisablePluginForPeersRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"peer_ids",kind:"scalar",repeat:2,T:9}])}}const SA=new yA;class EA extends v.MessageType{constructor(){super("socket.plugin.PluginEventToRoomRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"plugin_data",kind:"scalar",T:12}])}}const PA=new EA;class _A extends v.MessageType{constructor(){super("socket.plugin.PluginEventToPeersRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"peer_ids",kind:"scalar",repeat:2,T:9},{no:3,name:"plugin_data",kind:"scalar",T:12}])}}const CA=new _A;class wA extends v.MessageType{constructor(){super("socket.plugin.StoreKeys",[{no:1,name:"store_key",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",opt:!0,T:12}])}}const Ch=new wA;class RA extends v.MessageType{constructor(){super("socket.plugin.PluginStoreInsertKeysRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"insert_keys",kind:"message",repeat:1,T:()=>Ch}])}}const Gp=new RA;class bA extends v.MessageType{constructor(){super("socket.plugin.PluginStoreGetKeysRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"get_keys",kind:"message",repeat:1,T:()=>Ch}])}}const kA=new bA;class IA extends v.MessageType{constructor(){super("socket.plugin.PluginStoreDeleteKeysRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"delete_keys",kind:"message",repeat:1,T:()=>Ch}])}}const AA=new IA;class MA extends v.MessageType{constructor(){super("socket.plugin.PluginStoreDeleteRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9}])}}const DA=new MA;class OA extends v.MessageType{constructor(){super("socket.plugin.EnablePluginResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"enabled_by",kind:"scalar",T:9}])}}const Cu=new OA;class NA extends v.MessageType{constructor(){super("socket.plugin.EnablePluginsResponse",[{no:1,name:"plugins",kind:"message",repeat:1,T:()=>Cu}])}}const VA=new NA;class LA extends v.MessageType{constructor(){super("socket.plugin.DisablePluginResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"disabled_by",kind:"scalar",T:9}])}}const Wp=new LA;class xA extends v.MessageType{constructor(){super("socket.plugin.PluginStoreItem",[{no:1,name:"timestamp",kind:"scalar",T:9},{no:2,name:"peer_id",kind:"scalar",T:9},{no:3,name:"store_key",kind:"scalar",T:9},{no:4,name:"payload",kind:"scalar",T:12}])}}const UA=new xA;class $A extends v.MessageType{constructor(){super("socket.plugin.PluginStoreResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"store_items",kind:"message",repeat:1,T:()=>UA}])}}const Jp=new $A;class FA extends v.MessageType{constructor(){super("socket.plugin.PluginEventResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"plugin_data",kind:"scalar",T:12}])}}const Kp=new FA;class BA extends v.MessageType{constructor(){super("socket.livestreaming.LiveStreamingEvent",[{no:1,name:"livestream_id",kind:"scalar",T:9},{no:2,name:"err_message",kind:"scalar",T:9},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"meeting_id",kind:"scalar",T:9},{no:5,name:"playback_url",kind:"scalar",T:9},{no:6,name:"org_id",kind:"scalar",T:9},{no:7,name:"room_name",kind:"scalar",T:9},{no:8,name:"room_uuid",kind:"scalar",T:9},{no:9,name:"status",kind:"scalar",T:9},{no:10,name:"manual_ingest",kind:"scalar",opt:!0,T:8}])}}const zp=new BA;class HA extends v.MessageType{constructor(){super("socket.livestreaming.GetStagePeersResponse",[{no:1,name:"stage_peers",kind:"scalar",repeat:2,T:9}])}}const Yp=new HA;class qA extends v.MessageType{constructor(){super("socket.livestreaming.StageRequest",[{no:1,name:"display_name",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"peer_id",kind:"scalar",T:9}])}}const jA=new qA;class GA extends v.MessageType{constructor(){super("socket.livestreaming.GetStageRequestsResponse",[{no:1,name:"stage_requests",kind:"message",repeat:1,T:()=>jA}])}}const iu=new GA;class WA extends v.MessageType{constructor(){super("socket.livestreaming.GrantStageAccessRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const JA=new WA;class KA extends v.MessageType{constructor(){super("socket.livestreaming.DenyStageAccessRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const zA=new KA;class YA extends v.MessageType{constructor(){super("socket.livestreaming.LeaveStageRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const Qp=new YA;class QA extends v.MessageType{constructor(){super("socket.polls.Poll",[{no:1,name:"poll_id",kind:"scalar",T:9},{no:2,name:"created_by",kind:"scalar",T:9},{no:3,name:"created_by_user_id",kind:"scalar",T:9},{no:4,name:"question",kind:"scalar",T:9},{no:5,name:"options",kind:"message",repeat:1,T:()=>ZA},{no:6,name:"hide_votes",kind:"scalar",T:8},{no:7,name:"anonymous",kind:"scalar",T:8},{no:8,name:"votes",kind:"scalar",repeat:2,T:9}])}}const gf=new QA;class XA extends v.MessageType{constructor(){super("socket.polls.PollOption",[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"count",kind:"scalar",opt:!0,T:4,L:2},{no:3,name:"votes",kind:"message",repeat:1,T:()=>tM}])}}const ZA=new XA;class eM extends v.MessageType{constructor(){super("socket.polls.PollVote",[{no:1,name:"user_id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9}])}}const tM=new eM;class sM extends v.MessageType{constructor(){super("socket.polls.NewPollRequest",[{no:1,name:"question",kind:"scalar",T:9},{no:2,name:"options",kind:"scalar",repeat:2,T:9},{no:3,name:"anonymous",kind:"scalar",T:8},{no:4,name:"hide_votes",kind:"scalar",T:8},{no:5,name:"created_by",kind:"scalar",opt:!0,T:9},{no:6,name:"created_by_user_id",kind:"scalar",opt:!0,T:9}])}}const rM=new sM;class iM extends v.MessageType{constructor(){super("socket.polls.VotePollRequest",[{no:1,name:"poll_id",kind:"scalar",T:9},{no:2,name:"index",kind:"scalar",T:4,L:2}])}}const nM=new iM;class aM extends v.MessageType{constructor(){super("socket.polls.UpdatePollResponse",[{no:1,name:"poll",kind:"message",T:()=>gf}])}}const nu=new aM;class oM extends v.MessageType{constructor(){super("socket.polls.GetPollsResponse",[{no:1,name:"polls",kind:"message",repeat:1,T:()=>gf}])}}const cM=new oM;class dM extends v.MessageType{constructor(){super("socket.recording.RecordingEvent",[{no:1,name:"recording_id",kind:"scalar",T:9},{no:2,name:"err_message",kind:"scalar",T:9},{no:3,name:"recording_type",kind:"enum",T:()=>["common.RecordingType",sn]}])}}const Xp=new dM;class lM extends v.MessageType{constructor(){super("google.protobuf.Timestamp",[{no:1,name:"seconds",kind:"scalar",T:3,L:0},{no:2,name:"nanos",kind:"scalar",T:5}])}now(){const t=this.create(),e=Date.now();return t.seconds=v.PbLong.from(Math.floor(e/1e3)).toBigInt(),t.nanos=e%1e3*1e6,t}toDate(t){return new Date(v.PbLong.from(t.seconds).toNumber()*1e3+Math.ceil(t.nanos/1e6))}fromDate(t){const e=this.create(),r=t.getTime();return e.seconds=v.PbLong.from(Math.floor(r/1e3)).toBigInt(),e.nanos=r%1e3*1e6,e}internalJsonWrite(t,e){let r=v.PbLong.from(t.seconds).toNumber()*1e3;if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");if(t.nanos<0)throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");let i="Z";if(t.nanos>0){let a=(t.nanos+1e9).toString().substring(1);a.substring(3)==="000000"?i="."+a.substring(0,3)+"Z":a.substring(6)==="000"?i="."+a.substring(0,6)+"Z":i="."+a+"Z"}return new Date(r).toISOString().replace(".000Z",i)}internalJsonRead(t,e,r){if(typeof t!="string")throw new Error("Unable to parse Timestamp from JSON "+v.typeofJsonValue(t)+".");let i=t.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!i)throw new Error("Unable to parse Timestamp from JSON. Invalid format.");let a=Date.parse(i[1]+"-"+i[2]+"-"+i[3]+"T"+i[4]+":"+i[5]+":"+i[6]+(i[8]?i[8]:"Z"));if(Number.isNaN(a))throw new Error("Unable to parse Timestamp from JSON. Invalid value.");if(a<Date.parse("0001-01-01T00:00:00Z")||a>Date.parse("9999-12-31T23:59:59Z"))throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");return r||(r=this.create()),r.seconds=v.PbLong.from(a/1e3).toBigInt(),r.nanos=0,i[7]&&(r.nanos=parseInt("1"+i[7]+"0".repeat(9-i[7].length))-1e9),r}}new lM;class uM extends v.MessageType{constructor(){super("common.BaseHubMessage",[{no:1,name:"event",kind:"scalar",T:5},{no:2,name:"id",kind:"scalar",T:9},{no:3,name:"peer_id",kind:"scalar",T:9},{no:4,name:"room_id",kind:"scalar",T:9},{no:5,name:"user_id",kind:"scalar",T:9},{no:6,name:"payload",kind:"scalar",T:12},{no:7,name:"error",kind:"scalar",opt:!0,T:8},{no:8,name:"sid",kind:"scalar",opt:!0,T:9},{no:9,name:"room_object_id",kind:"scalar",opt:!0,T:9},{no:10,name:"preset",kind:"scalar",opt:!0,T:9},{no:11,name:"use_start_session",kind:"scalar",opt:!0,T:8}])}}const wu=new uM;class hM extends v.MessageType{constructor(){super("common.BulkedHubMessage",[{no:1,name:"messages",kind:"message",repeat:1,T:()=>wu}])}}new hM;class pM extends v.MessageType{constructor(){super("common.CFWorkersResponse",[{no:1,name:"responses",kind:"message",repeat:1,T:()=>wu},{no:2,name:"broadcast_responses",kind:"message",repeat:1,T:()=>wu}])}}new pM;const gM=0,mM=1,fM=2,TM=3,vM=4,yM=5,SM={getPeerInfo:0,updatePeerInfo:1,getRoomPeersInfo:2,joinRoom:3,leaveRoom:4,getRoomInfo:5,updateRoomInfo:6,closeRoom:7,startedLivestream:8,stoppedLivestream:9,erroredLivestream:10,getStagePeers:11,getStageRequests:12,requestStageAccess:13,cancelStageRequest:14,grantStageAccess:15,denyStageAccess:16,roomPeerCount:17,joinStage:18,leaveStage:19,getConnectedRoomsDump:20,createConnectedRooms:21,deleteConnectedRooms:22,movePeers:23,transferPeer:24,movedPeer:25,connectedRoomsUpdated:26,connectedRoomsDeleted:27,getAllAddedParticipants:28,broadcastMessage:29,kick:30,kickAll:31,transcript:32,getWaitingRoomRequests:33,acceptWaitingRoomRequests:34,waitingRoomRequestAccepted:35,denyWaitingRoomRequests:36,waitingRoomRequestDenied:37,peerStageStatusUpdate:38,broadcastToEntity:39,recordingStarted:40,recordingStopped:41,recordingPaused:42,getRoomStageState:43,livestreamingInvoked:44},EM={getMessages:0,sendMessageToRoom:1,sendMessageToPeers:2,editMessage:3,deleteMessage:4,getPaginatedMessages:5,sendMessageToChannel:6,searchChannelMessages:7,getAllChatChannels:8,markChannelIndexAsRead:9,pinMessage:10},PM={getPlugins:0,addPlugin:1,enablePluginForRoom:2,disablePluginForPeers:3,enablePluginForPeers:4,disablePluginForRoom:5,removePlugin:6,customPluginEventToRoom:7,customPluginEventToPeers:8,storeInsertKeys:9,storeGetKeys:10,storeDeleteKeys:11,storeDelete:12},_M={createPoll:0,getPolls:1,votePoll:2,updatePoll:3},mf={unknown:0,createWebRTCTransport:1,produce:2,consume:3,toggleProducer:4,toggleConsumer:5,closeProducer:6,closeConsumer:7,updateConsumersSimulcastConfig:8,joinRoom:16,leaveRoom:17,selectedPeer:18,globalPinPeer:19,selfJoinComplete:20,peerJoinedBroadcast:25,peerLeaveBroadcast:26,peerProducerCreateBroadcast:27,peerProducerToggleBroadcast:28,peerProducerCloseBroadcast:29,globalPeerPinBroadcast:30,recordingStartedBroadcast:31,recordingStoppedBroadcast:32,peerDisplayNameEditBroadcast:33,mediaRoomTerminationBroadcastResponse:36,selectedPeerDiff:40,renegotiateSessionDescription:50,errorResponse:60,kickPeer:90,kickAll:91,changeDisplayName:92,hostControlPeer:93,hostControlAllPeers:94,audioActivity:100},CM={createChatChannel:0,getChatChannel:1,deprecatedGetAllChatChannels:2,getChannelMembers:3,updateChatChannel:4},wM={getUserPresets:0,updateUserPreset:1};function xa(s,t){return Object.keys(t).reduce((e,r)=>(e[r]=(s<<16)+t[r],e),{})}function ff(s,t){return Object.keys(s).reduce((e,r)=>(e[r]=t|s[r],e),{})}const x=xa(gM,SM),_e=xa(mM,EM),q=xa(fM,PM),qs=xa(TM,_M),di=xa(vM,CM),kr=ff(mf,16777216),Es=ff(mf,50331648),id=xa(yM,wM);var RM=Object.defineProperty,bM=Object.getOwnPropertyDescriptor,wh=(s,t,e,r)=>{for(var i=r>1?void 0:r?bM(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&RM(t,e,i),i},Ir,Vn,fg;const Ru=(fg=class{constructor(s,t){g(this,Ir,void 0);g(this,Vn,void 0);m(this,Ir,t),m(this,Vn,s)}get telemetry(){return n(this,Vn).getValue("telemetry")}get logger(){return n(this,Vn).getValue("logger")}async createChannel(s,t,e,r="public",i=!1){const a={displayName:s,targetUserIds:t,displayPictureUrl:e,visibility:r,isDirectMessage:i};i&&(a.visibility="private");const o=await n(this,Ir).sendMessagePromise(di.createChatChannel,KI.toBinary(a)),c=Bs.fromBinary(o.payload).chatChannels;return Ru.formatChannel(c[0])}async updateChannel(s,t){const e=await n(this,Ir).sendMessagePromise(di.updateChatChannel,YI.toBinary({chatChannelId:s,targetUserIds:t.memberIds,displayName:t.displayName,displayPictureUrl:t.displayPictureUrl,visibility:t.visibility})),r=Bs.fromBinary(e.payload).chatChannels;return Ru.formatChannel(r[0])}static formatChannel(s){var r;const{latestMessageAndUnreadCount:t}=s,e={...s,id:s.chatChannelId,memberIds:s.targetUserIds,unreadCount:(r=t==null?void 0:t.unreadCount)!=null?r:0};return t!=null&&t.message&&(e.latestMessage=Ps.formatSocketPeerMessage(t.message)),delete e.chatChannelId,delete e.targetUserIds,delete e.latestMessageAndUnreadCount,e}async getChannelMembers(s){try{const t=await n(this,Ir).sendMessagePromise(di.getChannelMembers,ZI.toBinary({chatChannelId:s}));return cA.fromBinary(t.payload).channelMembers.map(({id:e,...r})=>({...r,userId:e}))}catch(t){return[]}}on(s,t){let e,r;switch(s){case di.createChatChannel:{e=Bs.fromBinary.bind(Bs),r=Bs.create();break}case di.updateChatChannel:{e=Bs.fromBinary.bind(Bs),r=Bs.create();break}}if(!e){this.logger.warn(`ChatChannelSocketHandler::Event ${s} is not recognized`);return}n(this,Ir).on(s,({payload:i})=>{let a=r;try{a=e(i)}catch(o){this.logger.error("ChatChannelSocketHandler::on::binary_decode_error",{error:o})}return t(a)})}},Ir=new WeakMap,Vn=new WeakMap,fg);let an=Ru;wh([S.trace("ChatChannelHandler.createChannel")],an.prototype,"createChannel",1);wh([S.trace("ChatChannelHandler.updateChannel")],an.prototype,"updateChannel",1);wh([S.trace("ChatChannelHandler.getChannelMembers")],an.prototype,"getChannelMembers",1);var kM=Object.defineProperty,IM=Object.getOwnPropertyDescriptor,bs=(s,t,e,r)=>{for(var i=r>1?void 0:r?IM(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&kM(t,e,i),i},vt=(s=>(s[s.TEXT=0]="TEXT",s[s.IMAGE=1]="IMAGE",s[s.FILE=2]="FILE",s[s.CUSTOM=3]="CUSTOM",s))(vt||{}),et,Ln;class is{constructor(t,e){g(this,et,void 0);g(this,Ln,void 0);m(this,et,e),m(this,Ln,t)}get telemetry(){return n(this,Ln).getValue("telemetry")}get logger(){return n(this,Ln).getValue("logger")}getChatMessages(){return n(this,et).sendMessagePromise(_e.getMessages)}async getChatMessagesPaginated(t,e,r,i=0,a=""){const o={timeStamp:t,size:e,from:i,reversed:r,channelId:a},c=await n(this,et).sendMessagePromise(_e.getPaginatedMessages,yI.toBinary(o));return c.payload?EI.fromBinary(c.payload):{messages:[],next:!1}}sendMessageToRoom(t,e){const r={payloadType:e,payload:t};n(this,et).sendMessage(_e.sendMessageToRoom,CI.toBinary(r))}sendMessageToPeers(t,e,r){const i={payloadType:e,peerIds:r,payload:t};n(this,et).sendMessage(_e.sendMessageToPeers,bI.toBinary(i))}sendMessageToChannel(t,e,r){const i={payloadType:e,channelId:r,payload:t};n(this,et).sendMessage(_e.sendMessageToChannel,AI.toBinary(i))}sendMessage(t,e,r,i){if(i&&this.sendMessageToChannel(t,e,i),r&&r.length>0){this.sendMessageToPeers(t,e,r);return}this.sendMessageToRoom(t,e)}async editMessage(t,e,r,i,a){const o={chatId:t,payloadType:r,payload:e};i&&(o.channelId=i),a!==void 0&&(o.pinned=a);const c=await n(this,et).sendMessagePromise(_e.editMessage,OI.toBinary(o));return Kc.fromBinary(c.payload).message}async deleteMessage(t,e){const r={chatId:t};e&&(r.channelId=e);const i=await n(this,et).sendMessagePromise(_e.deleteMessage,$I.toBinary(r)),a=zc.fromBinary(i.payload);return{id:a.chatId,...a.channelId?{channelId:a.channelId}:{}}}async searchMessages(t,e){var i,a,o;const r={searchTerm:t,timeStamp:(i=e.timestamp)!=null?i:Date.now(),size:(a=e.size)!=null?a:75,from:0,reversed:(o=e.reversed)!=null?o:!0};e.channelId&&(r.channelId=e.channelId);try{const c=await n(this,et).sendMessagePromise(_e.searchChannelMessages,HI.toBinary(r));return pf.fromBinary(c.payload).messages}catch(c){return[]}}async getAllChannels(){try{const t=await n(this,et).sendMessagePromise(_e.getAllChatChannels);return Bs.fromBinary(t.payload).chatChannels.map(an.formatChannel)}catch(t){return[]}}async markLastReadMessage(t,e){const r=await n(this,et).sendMessagePromise(_e.markChannelIndexAsRead,jI.toBinary({channelId:t,userId:e.userId,channelIndex:e.channelIndex}));return WI.fromBinary(r.payload).channelIndex}async setPinState(t,e){const r={chatId:t.id,pinned:e,channelId:t.channelId},i=await n(this,et).sendMessagePromise(_e.pinMessage,VI.toBinary(r));return Jc.fromBinary(i.payload)}on(t,e){let r,i;switch(t){case _e.sendMessageToRoom:{r=su.fromBinary.bind(su),i=su.create();break}case _e.sendMessageToPeers:{r=ru.fromBinary.bind(ru),i=ru.create();break}case _e.editMessage:{r=Kc.fromBinary.bind(Kc),i=Kc.create();break}case _e.pinMessage:{r=Jc.fromBinary.bind(Jc),i=Jc.create();break}case _e.deleteMessage:{r=zc.fromBinary.bind(zc),i=zc.create();break}}if(!r){this.logger.warn(`ChatSocketHandler::Event ${t} is not recognized`);return}n(this,et).on(t,({payload:a})=>{let o=i;try{o=r(a)}catch(c){this.logger.error("chatSocketHandler::on::binary_decode_error",{error:c})}return e(o)})}}et=new WeakMap,Ln=new WeakMap;bs([S.trace("SocketService.getChatMessages")],is.prototype,"getChatMessages",1);bs([S.trace("SocketService.getChatMessagesPaginated")],is.prototype,"getChatMessagesPaginated",1);bs([S.trace("SocketService.sendMessageToRoom")],is.prototype,"sendMessageToRoom",1);bs([S.trace("SocketService.sendMessageToPeers")],is.prototype,"sendMessageToPeers",1);bs([S.trace("SocketService.sendMessageToChannel")],is.prototype,"sendMessageToChannel",1);bs([S.trace("SocketService.sendMessage")],is.prototype,"sendMessage",1);bs([S.trace("SocketService.editMessage")],is.prototype,"editMessage",1);bs([S.trace("SocketService.deleteMessage")],is.prototype,"deleteMessage",1);bs([S.trace("SocketService.searchMessages")],is.prototype,"searchMessages",1);bs([S.trace("SocketService.getAllChannels")],is.prototype,"getAllChannels",1);bs([S.trace("SocketService.markLastReadMessage")],is.prototype,"markLastReadMessage",1);function AM(s){return s.replace(/([-_]\w)/g,t=>t[1].toUpperCase())}function _s(s){if(!s||typeof s!="object")return s;if(Array.isArray(s))return s.map(e=>_s(e));const t={};return Object.keys(s).forEach(e=>{const r=gr.validate(e)?e:AM(e);t[r]=_s(s[e])}),t}function MM(s){return s.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`)}function Tf(s){if(!s||typeof s!="object")return s;if(Array.isArray(s))return s.map(e=>Tf(e));const t={};return Object.keys(s).forEach(e=>{const r=gr.validate(e)?e:MM(e);t[r]=s[e]}),t}function Ed(s,t={}){return s==null?{}:(Object.getOwnPropertyNames(s).forEach(e=>{if(typeof s[e]!="function"){if(typeof s[e]=="object"){Ed(s[e],t[e]={});return}t[e]=s[e]}}),t)}class Zp{constructor(t){u(this,"defaults");this.defaults={baseURL:t.baseURL,headers:{common:{}},timeout:t.timeout,retry:t.retry,retryDelay:t.retryDelay}}buildURL(t,e){const{baseURL:r}=this.defaults,i=t.startsWith("http")?t:`${r}${t.startsWith("/")?t:`/${t}`}`;if(e){const a=new URLSearchParams;return Object.entries(e).forEach(([o,c])=>{a.append(o,c)}),`${i}${i.includes("?")?"&":"?"}${a.toString()}`}return i}async request(t){var p;const e=((p=t.method)==null?void 0:p.toUpperCase())||"GET",r=this.buildURL(t.url||"",t.params),i={...this.defaults.headers.common,...t.headers};e!=="GET"&&e!=="HEAD"&&t.data&&!i["Content-Type"]&&(i["Content-Type"]="application/json");const o=i["Content-Type"]==="application/json"?JSON.stringify(t.data):t.data,c={method:e,headers:i,body:e!=="GET"&&e!=="HEAD"&&t.data?o:void 0},d=t.timeout||this.defaults.timeout,l=t.retry!==void 0?t.retry:this.defaults.retry,h=t.retryDelay||this.defaults.retryDelay;try{const f=new AbortController,T=setTimeout(()=>f.abort(),d);c.signal=f.signal;const E=await fetch(r,c);clearTimeout(T);let P=null;const C=E.headers.get("content-type");C&&C.includes("application/json")?P=await E.json():P=await E.text();const _={};E.headers.forEach((U,D)=>{_[D]=U});const N={data:P,status:E.status,statusText:E.statusText,headers:_,config:t};if(!E.ok)throw N;return N}catch(f){if(f instanceof Error&&l>0)return await new Promise(T=>setTimeout(T,h)),this.defaults.baseURL===hi.apiBase.prod?this.defaults.baseURL=hi.apiBase.prodAlternate:this.defaults.baseURL===hi.apiBase.prodAlternate&&(this.defaults.baseURL=hi.apiBase.prod),this.request({...t,retry:l-1});throw f}}async get(t,e={}){return this.request({...e,method:"GET",url:t})}async post(t,e,r={}){return this.request({...r,method:"POST",url:t,data:e})}async put(t,e,r={}){return this.request({...r,method:"PUT",url:t,data:e})}}const DM=3,OM=30,NM=8e3;class VM{constructor(t,e){u(this,"ipInfo");u(this,"fetchClient");u(this,"requests");u(this,"roomName");u(this,"roomUUID");u(this,"authToken");u(this,"organizationId");u(this,"iceServers");u(this,"pluginInformation");u(this,"userDetails");u(this,"roomDetails");u(this,"context");this.context=t;const{timeout:r=NM,retry:i=DM,retryDelay:a=OM,baseURL:o=hi.apiBase.prod,authToken:c,cachedUserDetails:d}=e||{};this.iceServers=d==null?void 0:d.iceServers,this.pluginInformation=d==null?void 0:d.pluginInformation,this.userDetails=d==null?void 0:d.userDetails,this.roomDetails=d==null?void 0:d.roomDetails,this.requests=new Zp({baseURL:o,timeout:r,retry:i,retryDelay:a,responseType:"json"}),this.fetchClient=new Zp({baseURL:"",timeout:r,retry:i,retryDelay:a,responseType:"json"}),this.setAuthToken(c,{bearer:!0});const l=this.requests.request.bind(this.requests);this.requests.request=async h=>{var f,T,E,P,C;const p=t.getValue("telemetry");try{p.injectContext(this.requests.defaults.headers.common);const _=await l(h);return h.url!==p.logsEndpoint&&this.logger.debug("xhr::fetch",{networkCall:{status:_.status,statusText:_.statusText,baseURL:h.baseURL||this.requests.defaults.baseURL,url:h.url,method:h.method}}),_}catch(_){throw _?(((f=_.config)==null?void 0:f.url)!==p.logsEndpoint&&this.logger.error("xhr::fetch",{error:_,networkCall:{status:_.status,statusText:_.statusText,baseURL:((T=_.config)==null?void 0:T.baseURL)||this.requests.defaults.baseURL,url:(E=_.config)==null?void 0:E.url,retries:(P=_.config)==null?void 0:P.retry,method:(C=_.config)==null?void 0:C.method,isOnline:navigator.onLine?"online":"offline"}}),new R(_.message||"Network request failed","0011")):new R("Unknown network error occurred","0011")}}}get peerId(){return this.context.getValue("peerId")}get logger(){return this.context.getValue("logger")}setAuthToken(t,e){const{bearer:r}=e||{};this.authToken=t,this.requests.defaults.headers.common.Authorization=r?`Bearer ${t}`:t}setHeader(t,e){this.requests.defaults.headers.common[t]=e}setRoomName(t){this.roomName=t}setRoomUUID(t){this.roomUUID=t}setOrganizationId(t){this.organizationId=t}}var LM=Object.defineProperty,xM=Object.getOwnPropertyDescriptor,ns=(s,t,e,r)=>{for(var i=r>1?void 0:r?xM(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&LM(t,e,i),i};class Bt extends VM{constructor(e,r){super(e,r);u(this,"telemetry");this.telemetry=e.getValue("telemetry"),this.setHeader("x-realtimekit-version",e.getValue("sdkVersion"))}async getIPDetails(){var r;const{peerId:e}=this;try{const i=await ah.getIPDetails({peerId:e,apiHostnames:Xm(this.context),logger:jm});if(this.logger.log("ipInfo",{ipInfo:i}),((r=i==null?void 0:i.loc)==null?void 0:r.length)>5)return i;throw Error("Insufficient data")}catch(i){this.logger.warn("APIClient.getIPDetails Failed to get ip details",{error:{name:i.name,message:i.message}});return}}async getICEServers(){if(this.iceServers)return this.iceServers;const{success:e,iceServers:r}=(await this.requests.get("/iceservers")).data;if(e)return(r==null?void 0:r.length)>0&&(this.iceServers=r),r}async getPlugins(){var a,o,c,d,l,h,p;if(this.pluginInformation)return this.pluginInformation;const{plugins:e}=(await this.requests.get("/v2/plugins/user")).data.data,r=((o=(a=this.context.getValue("flagsmith").getValue(Q.V1_PLUGINS))==null?void 0:a.toString())==null?void 0:o.split(","))||[],i=e.reduce((f,T)=>(f[r.includes(T.id)?"v1":"v2"].push({...T,name:T.name.replace("v2","")}),f),{v1:[],v2:[]});return(l=(d=(c=this.context.getValue("modules"))==null?void 0:c.devTools)==null?void 0:d.plugins)!=null&&l.length&&((p=(h=this.context.getValue("modules"))==null?void 0:h.devTools)==null||p.plugins.forEach(f=>{var E,P,C;const T={...so,tags:[...so.tags],baseUrl:`http://localhost:${f.port}`,name:f.name,picture:(E=f.picture)!=null?E:so.picture,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),id:f.id,organizationId:this.organizationId,description:(P=f.description)!=null?P:so.description,staggered:(C=f.staggered)!=null?C:so.staggered};i.v2.push(T)})),i.v2}async getPluginDetails(e){const{plugin:r}=(await this.requests.get(`/v2/plugins/view/${e}`)).data.data;return r}async getPluginConfig(e){return(await this.fetchClient.get(`${e}/dyte-config.json`)).data}async authorizePlugin(e){const r={peerId:this.peerId},{token:i}=(await this.requests.post(`/v2/plugins/authorize/${e}`,r)).data.data;return i}async getPresignedUrls(e,r){const i=Na(this.context,"chat_upload_expiry"),a={roomUUID:this.roomUUID,filename:e,expiry:typeof i=="number"?i:void 0};this.context.getValue("flagsmith").hasFeature(Q.FEAT_CHAT_SDK)&&(a.viewType=r);const{getLocation:o,putLocation:c}=(await this.requests.post("/v1/meetings/genPreSignedUploadUrl",a)).data.data;return{getLocation:o,putLocation:c}}async uploadFile(e,r){if(navigator.isReactNative&&"uri"in e)try{await fetch(r,{method:"PUT",headers:{"Content-Type":"application/octet-stream"},body:{uri:e.uri,name:e.name}})}catch(i){this.logger.error(`sendFileMessage::${i}`)}else await this.fetchClient.put(r,e,{headers:{"Content-Type":e.type}})}async startLivestreaming({manualIngestion:e}){const r=_s(await this.requests.post(`/v2/meetings/${this.context.getValue("meetingId")}/livestreams`,{manual_ingest:!!e})).data.data;return{playbackUrl:r.playbackUrl,status:r.status,manualIngest:r.manualIngest,ingestionCredentials:r.streamKey?{ingestionServer:r.ingestServer,streamKey:r.streamKey}:null}}async stopLivestreaming(){return this.requests.post(`/v2/meetings/${this.context.getValue("meetingId")}/active-livestream/stop`)}async getActiveLivestream(){const e=_s((await this.requests.get(`/v2/meetings/${this.context.getValue("meetingId")}/active-livestream`)).data.data);return{playbackUrl:e.playbackUrl,status:e.status,manualIngest:e.manualIngest,ingestionCredentials:e.streamKey?{ingestionServer:e.ingestServer,streamKey:e.streamKey}:null}}async getUserDetails(){if(this.userDetails)return this.userDetails;const e=(await this.requests.get("v2/internals/participant-details")).data.data;return _s(e)}async startRecording(e,r){return(await this.requests.post("/v2/recordings",{...Tf(e),meeting_id:this.context.getValue("meetingId"),allow_multiple_recordings:!!r})).data.data.id}async updateRecording(e,r){return this.requests.put(`v2/recordings/${e}`,{action:r})}async getActiveRecording(){const{status:e,id:r}=(await this.requests.get(`v2/recordings/active-recording/${this.context.getValue("meetingId")}`)).data.data;return{status:e,id:r}}async getActiveTranscript(){const{transcript_download_url:e}=(await this.requests.get(`v2/meetings/${this.context.getValue("meetingId")}/active-transcript`)).data.data;try{return{transcript:(await this.fetchClient.get(e)).data}}catch(r){throw new R("Cant fetch transcript s3 url","1801")}}async getRoomNodeData(){const e=await this.getIPDetails();if(this.ipInfo=e,this.roomDetails)return this.roomDetails;const{title:r}=_s((await this.requests.post("v2/internals/rooms",{ip_information:e})).data.data);return{meetingTitle:r}}}ns([S.trace("APIClient.getIPDetails")],Bt.prototype,"getIPDetails",1);ns([S.trace("APIClient.getICEServers")],Bt.prototype,"getICEServers",1);ns([S.trace("APIClient.getPlugins")],Bt.prototype,"getPlugins",1);ns([S.trace("APIClient.startLivestreaming")],Bt.prototype,"startLivestreaming",1);ns([S.trace("APIClient.stopLivestreaming")],Bt.prototype,"stopLivestreaming",1);ns([S.trace("APIClient.getActiveLivestream")],Bt.prototype,"getActiveLivestream",1);ns([S.trace("APIClient.getUserDetails")],Bt.prototype,"getUserDetails",1);ns([S.trace("APIClient.startRecording")],Bt.prototype,"startRecording",1);ns([S.trace("APIClient.stopRecording")],Bt.prototype,"updateRecording",1);ns([S.trace("APIClient.getActiveRecording")],Bt.prototype,"getActiveRecording",1);ns([S.trace("APIClient.getActiveTranscript")],Bt.prototype,"getActiveTranscript",1);ns([S.trace("APIClient.getRoomNodeData")],Bt.prototype,"getRoomNodeData",1);let bu;function UM(s,t){return bu=new Bt(s,t),bu}function at(){return bu}function $M(s,t){return`<blockquote>${t.replace(/<blockquote>[.\s\S]*<\/blockquote>\n\n/m,"")}</blockquote>
5
+ ${this.message}`;try{let o=a&&!!i;r&&r.endsWith("00")&&i&&(o=!0),o&&i.error("ClientError",{error:{message:this.message,name:this.name,code:r}});const c=hr.getContext(hr.getMostRecentPeerId());if(c){const d=c.getValue("onError");try{d(this)}catch(l){}}typeof window!="undefined"&&window.dispatchEvent(new CustomEvent("ClientError",{detail:this}))}catch(o){}}}function Gc(s,t,e,r){if(r instanceof R)throw r;if(r instanceof t){const i=new R(r.message,e);throw i.stack=r.stack,i}else throw r}function bp(s,t,e){if(!s.value){const i=s.get,a=s.set;return i&&(s.get=function(){try{return i.apply(this)}catch(o){Gc(this,t,e,o)}}),a&&(s.set=function(o){try{return a.apply(this,[o])}catch(c){Gc(this,t,e,c)}}),s}const r=s.value;return s.value=function(...i){try{const a=r.apply(this,i);return a&&a instanceof Promise?a.catch(o=>{Gc(this,t,e,o)}):a}catch(a){Gc(this,t,e,a)}},s}function nw(s,t){return(e,r,i)=>{if(i)return bp(i,s,t);for(const a of Reflect.ownKeys(e.prototype).filter(o=>o!=="constructor")){const o=Object.getOwnPropertyDescriptor(e.prototype,a);(o.value instanceof Function||o.get instanceof Function||o.set instanceof Function)&&Object.defineProperty(e.prototype,a,bp(o,s,t))}}}const ct=s=>nw(Error,s);function aw(s){let t=0,e,r;if(!s)return t;for(e=0;e<s.length;e+=1)r=s.charCodeAt(e),t=(t<<5)-t+r,t|=0;return Math.abs(t)%100+1}function ow(){Te.isElectron()&&window.electronGetDisplayMediaSource&&(navigator.mediaDevices.getDisplayMedia=async()=>{const s=await window.electronGetDisplayMediaSource({types:["window","screen"]});let t=[];if(s&&(Array.isArray(s)?t=s:t=[s]),!(t!=null&&t.length))throw new Error("Couldn't find any media source for screen share.");let e=t.find(a=>{var o;return(o=a.id)==null?void 0:o.includes("screen")});e=e!=null?e:t[0];const r={audio:!1,video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e.id}}};return await navigator.mediaDevices.getUserMedia(r)})}var b=(s=>(s.NEW_PRODUCER="NEW_PRODUCER",s.ROOM_NODE_CONNECTION_ERROR="ROOM_NODE_CONNECTION_ERROR",s.SOCKET_SERVICE_ROOM_JOINED="SOCKET_SERVICE_ROOM_JOINED",s.SOCKET_SERVICE_RECONNECTED="SOCKET_SERVICE_RECONNECTED",s.SOCKET_SERVICE_DISCONNECTED="SOCKET_SERVICE_DISCONNECTED",s.SOCKET_SERVICE_FAILED="SOCKET_SERVICE_FAILED",s.SOCKET_STATE_UPDATE="SOCKET_STATE_UPDATE",s.ROOM_NODE_RECONNECTED="ROOM_NODE_RECONNECTED",s.ROOM_NODE_DISCONNECTED="ROOM_NODE_DISCONNECTED",s.ROOM_NODE_FAILED="ROOM_NODE_FAILED",s.TRANSPORT_STATE_UPDATE="TRANSPORT_STATE_UPDATE",s.PRODUCER_SCORE_UPDATE="PRODUCER_SCORE_UPDATE",s.CONSUMER_SCORE_UPDATE="CONSUMER_SCORE_UPDATE",s.PRODUCER_STATUS_UPDATE="PRODUCER_STATUS_UPDATE",s.CONSUMER_STATUS_UPDATE="CONSUMER_STATUS_UPDATE",s.LOW_CONSUMER_SCORE="LOW_CONSUMER_SCORE",s.MEDIA_PERMISSION_ERROR="MEDIA_PERMISSION_ERROR",s.MEDIA_PERMISSION_UPDATE="MEDIA_PERMISSION_UPDATE",s.MESSAGE="websocket/message",s.ROOM_MESSAGE="websocket/room-message",s.PEER_JOINED_INTERNAL="peer/joined-internal",s.PEER_CLOSED="websocket/peer-closed",s.CONSUMER_CLOSED="websocket/consumer-closed",s.CONSUMER_PAUSED="websocket/consumer-paused",s.CONSUMER_RESUMED="websocket/consumer-resumed",s.PRODUCER_CLOSED="websocket/producer-closed",s.NEW_CONSUMER="websocket/new-consumer",s.PRODUCER_SCORE="websocket/producer-score",s.CONSUMER_SCORE="websocket/consumer-score",s.PRODUCER_TOGGLE="cf/producer-toggle",s.UPDATE_ACTIVE="media/update-active",s.RESET_PRODUCER_STATE="cf/reset-producer-state",s.ROOM_STATE="sockethub/room-state",s.GET_STAGE_REQUESTS="GET_STAGE_REQUESTS",s.UPDATE_STAGE_REQUESTS="UPDATE_STAGE_REQUESTS",s.KICK_PEER="KICK_PEER",s.UPDATE_PEER_STAGE_STATUS="UPDATE_PEER_STAGE_STATUS",s.JOIN_MEDIA_ROOM="JOIN_MEDIA_ROOM",s.LEAVE_MEDIA_ROOM="LEAVE_MEDIA_ROOM",s.PIP_HANGUP="PIP_HANGUP",s.E2EE_ACTIVE_PRODUCER="E2EE_ACTIVE_PRODUCER",s.E2EE_INACTIVE_PRODUCER="E2EE_INACTIVE_PRODUCER",s.E2EE_ACTIVE_CONSUMER="E2EE_ACTIVE_CONSUMER",s.E2EE_INACTIVE_CONSUMER="E2EE_INACTIVE_CONSUMER",s.SOCKET_PEERS="SOCKET_PEERS",s.UPDATE_PERMISSIONS="UPDATE_PERMISSIONS",s.MAX_SPATIAL_LAYER_CHANGE="MAX_SPATIAL_LAYER_CHANGE",s.MUTE_SELF="MUTE_SELF",s.MUTE_SELF_VIDEO="MUTE_SELF_VIDEO",s))(b||{});class La extends ot.EventEmitter{constructor(e){super();u(this,"logger");this.logger=e,super.setMaxListeners(25)}emit(e,...r){return super.emit("*",e,...r),super.emit(e,...r)}on(e,r){var i;try{const a=this.listenerCount(e);a>25&&a%25===0&&((i=this.logger)==null||i.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch(a){}return super.on(e,r)}addListener(e,r){var i;try{const a=this.listenerCount(e);a>25&&a%25===0&&((i=this.logger)==null||i.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch(a){}return super.addListener(e,r)}off(e,r){return super.off(e,r)}once(e,r){return super.once(e,r)}prependListener(e,r){return super.prependListener(e,r)}prependOnceListener(e,r){return super.prependOnceListener(e,r)}removeListener(e,r){return super.removeListener(e,r)}removeAllListeners(e){return super.removeAllListeners(e)}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}}class Ft extends ot.EventEmitter{constructor(e){super();u(this,"logger");this.logger=e,super.setMaxListeners(25)}emit(e,...r){return super.emit("*",e,...r),super.emit(e,...r)}on(e,r){var i;try{const a=this.listenerCount(e);a>25&&a%25===0&&((i=this.logger)==null||i.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch(a){}return super.on(e,r)}addListener(e,r){var i;try{const a=this.listenerCount(e);a>25&&a%25===0&&((i=this.logger)==null||i.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch(a){}return super.addListener(e,r)}off(e,r){return super.off(e,r)}once(e,r){return super.once(e,r)}prependListener(e,r){return super.prependListener(e,r)}prependOnceListener(e,r){return super.prependOnceListener(e,r)}removeListener(e,r){return super.removeListener(e,r)}removeAllListeners(e){return super.removeAllListeners(e)}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}}function cw(s,t=2){return s.replace(/[^\u00BF-\u1FFF\u2C00-\uD7FF\w\s]/g,"").trim().split(/\s+/).slice(0,t).map(i=>i.charAt(0)).join("").toUpperCase()}const kp=1080,Ip=1920,dw=(s,t,e,r,i,a)=>{let o=.5,c=.5;const d=i,l=a,h=Math.min(e/d,r/l);let p=d*h,f=l*h,T,E,P,C,_=1;return p<e&&(_=e/p),Math.abs(_-1)<1e-14&&f<r&&(_=r/f),p*=_,f*=_,P=d/(p/e),C=l/(f/r),T=(d-P)*o,E=(l-C)*c,T<0&&(T=0),E<0&&(E=0),P>d&&(P=d),C>l&&(C=l),[T,E,P,C,s,t,e,r]};var Gt,pi,Ze,Wt,Ce,ls,Ws,ut,Ie,Dn,On,Js,Nn;const Hh=class extends Ft{constructor(e,r,i,a){const o=e.getValue("logger");super(o);g(this,Gt,void 0);g(this,pi,void 0);g(this,Ze,void 0);g(this,Wt,void 0);g(this,Ce,{height:kp,width:Ip});g(this,ls,{brand:"#2160FD",background:"#141414",text:"#000000",videoBackground:"#191919",textOnBrand:"#EEEEEE"});g(this,Ws,void 0);g(this,ut,{});g(this,Ie,void 0);g(this,Dn,void 0);g(this,On,void 0);g(this,Js,void 0);g(this,Nn,!1);u(this,"cleanupEventListeners",()=>{n(this,pi).unsubscribe("stageStatus",this.handlePipMediaControls),n(this,Ie).removeListener("videoUpdate",this.onSelfVideoUpdateListener),n(this,Ie).removeListener("audioUpdate",this.onSelfAudioUpdateListener),n(this,Ie).removeListener("roomLeft",()=>this.disable())});u(this,"enablePipMediaControls",()=>{this.mountAudioEvents(),this.mountVideoEvents()});u(this,"onSelfVideoUpdateListener",({videoEnabled:e})=>{this.updateMediaSession("CAMERA",e)});u(this,"onSelfAudioUpdateListener",({audioEnabled:e})=>{this.updateMediaSession("MIC",e)});u(this,"handlePipMediaControls",e=>{e==="ON_STAGE"?this.enablePipMediaControls():this.unmountEvents()});u(this,"eventCallback",e=>{e==="CAMERA"&&(n(this,Ie).videoEnabled?n(this,Ie).disableVideo():n(this,Ie).enableVideo(),this.emit("cameraToggled")),e==="MIC"&&(n(this,Ie).audioEnabled?n(this,Ie).disableAudio():n(this,Ie).enableAudio(),this.emit("micToggled")),e==="END"&&(n(this,pi).getValue("peerSessionStore").emit(b.PIP_HANGUP),this.cleanupEventListeners(),this.emit("hangup"),this.cleanup())});u(this,"unmountEvents",()=>{navigator.mediaSession===void 0||navigator.mediaSession.setCameraActive===void 0||(navigator.mediaSession.setActionHandler("togglemicrophone",void 0),navigator.mediaSession.setActionHandler("togglecamera",void 0))});u(this,"animate",()=>{if(!this.isActive&&n(this,Js)==="active"){this.disable(!0);return}n(this,ut)!==void 0&&this.paintCanvas(),n(this,Ws)!==void 0&&m(this,Ws,requestAnimationFrame(()=>this.animate()))});u(this,"disable",(e=!1)=>{m(this,Js,"idle"),this.cleanupEventListeners(),cancelAnimationFrame(n(this,Ws)),e!==!0&&document.body.removeChild(n(this,Ze)),m(this,Ws,void 0),document.pictureInPictureElement&&document.exitPictureInPicture()});m(this,pi,e),m(this,Js,"idle"),m(this,Ie,r),m(this,ls,{brand:r.config.designTokens.colors.brand[500],background:r.config.designTokens.colors.background[1e3],text:r.config.designTokens.colors.text,videoBackground:r.config.designTokens.colors.videoBg,textOnBrand:r.config.designTokens.colors.textOnBrand}),i&&this.setupIcon("pin",i),a&&this.setupIcon("handRaise",a)}static async _init(e,r){let i,a;try{i=await jc(XC),a=await jc(ZC)}catch(o){}return new Hh(e,r,i,a)}async setupIcon(e,r){switch(e){case"handRaise":m(this,On,r);break;case"pin":m(this,Dn,r);break}}async overrideIcon(e,r){switch(e){case"handRaise":m(this,On,await jc(r));break;case"pin":m(this,Dn,await jc(r));break}}constructImage(e){const r=new Image,i=new Blob([e],{type:"image/svg+xml"}),a=window.URL.createObjectURL(i);return new Promise(o=>{r.onload=()=>{o(r),window.URL.revokeObjectURL(a)},r.src=a})}createVideoContainer(){m(this,Ze,document.createElement("div")),n(this,Ze).style.width="0.1px",n(this,Ze).style.height="0.1px",n(this,Ze).style.overflow="hidden",n(this,Ze).style.position="absolute",n(this,Ze).style.bottom="0",n(this,Ze).style.right="0",n(this,Ze).style.opacity="0",n(this,Ze).appendChild(n(this,Wt))}setupEventListeners(){n(this,pi).subscribe("stageStatus",this.handlePipMediaControls),n(this,Ie).addListener("videoUpdate",this.onSelfVideoUpdateListener),n(this,Ie).addListener("audioUpdate",this.onSelfAudioUpdateListener),n(this,Ie).addListener("roomLeft",()=>this.disable())}createCanvas(){const e=document.createElement("canvas");e.height=n(this,Ce).height,e.width=n(this,Ce).width,m(this,Gt,e)}setupMediaSessionEvents(){navigator.mediaSession===void 0||navigator.mediaSession.setCameraActive===void 0||(navigator.mediaSession.setActionHandler("hangup",()=>{this.eventCallback("END")}),this.mountAudioEvents(),this.mountVideoEvents())}mountAudioEvents(){navigator.mediaSession===void 0||navigator.mediaSession.setMicrophoneActive===void 0||n(this,Ie).permissions.canProduceAudio&&navigator.mediaSession.setActionHandler("togglemicrophone",()=>{this.eventCallback("MIC")})}mountVideoEvents(){navigator.mediaSession===void 0||navigator.mediaSession.setCameraActive===void 0||n(this,Ie).permissions.canProduceVideo&&navigator.mediaSession.setActionHandler("togglecamera",()=>{this.eventCallback("CAMERA")})}getSources(){const r=Object.values(n(this,ut)).reduce((i,a)=>(i[a.pinned?"pinned":"regular"].push(a),i),{pinned:[],regular:[]});return[...r.pinned,...r.regular]}drawEmptyTile(e,r,i,a){if(n(this,Gt)===void 0)return;const o=n(this,Gt).getContext("2d"),c=n(this,Gt).width,d=0,l=0,h=r-d*2,p=i-d*2,f=Math.floor(c/h),T=Math.floor(e/f),P=e%f*(h+d)+d,C=T*(p+d)+d,{displayText:_,image:N}=a!=null?a:{};o.fillStyle=_||N?n(this,ls).videoBackground:n(this,ls).background,o.strokeStyle=n(this,ls).brand,o.beginPath(),o.moveTo(P+l,C),o.arcTo(P+h,C,P+h,C+l,l),o.arcTo(P+h,C+p,P+h-l,C+p,l),o.arcTo(P,C+p,P,C+p-l,l),o.arcTo(P,C,P+l,C,l),o.closePath(),o.fill(),o.stroke();const U=h/6,D=h/2+P,$=p/2+C;o.save(),(_||N)&&(o.beginPath(),o.arc(D,$,U,0,Math.PI*2),o.fillStyle=n(this,ls).brand,o.fill(),N?(o.clip(),o.drawImage(N,D-U,$-U,U*2,U*2),o.restore()):_&&(o.fillStyle=n(this,ls).textOnBrand,o.font=`${U/2}px sans-serif`,o.textAlign="center",o.textBaseline="middle",o.fillText(_,D,$)),this.drawIcons(a,P,C,Math.max(h,p)))}drawIcons(e,r,i,a){const o=Math.min(Math.max(a*.15,100),200),c=o*.2,d=o*.2;let l=r+c;const h=i+c,p=f=>{const T=n(this,Gt).getContext("2d");T.save(),T.fillStyle=n(this,ls).background,T.beginPath(),T.moveTo(l+d,h),T.arcTo(l+o,h,l+o,h+d,d),T.arcTo(l+o,h+o,l+o-d,h+o,d),T.arcTo(l,h+o,l,h+o-d,d),T.arcTo(l,h,l+d,h,d),T.closePath(),T.fill(),typeof f=="string"?(T.font=`${o/1.5}px sans-serif`,T.fillStyle=n(this,ls).text,T.textAlign="center",T.textBaseline="top",T.fillText(f,o/2+l,h+c)):T.drawImage(f,l+c,h+c,o-c*2,o-c*2),l+=o+c,T.restore()};e.pinned&&p(n(this,Dn)),e.handRaised&&p(n(this,On)),e.reaction&&p(e.reaction)}drawTile(e,r,i){var l,h;if(n(this,Gt)===void 0)return;const a=n(this,Gt).getContext("2d"),o=this.getSources();let c=0,d=0;for(;c<n(this,Ce).height-5;){let p=0;for(;p<n(this,Ce).width-5&&d<i;){if((l=o[d])!=null&&l.enabled){const f=o[d].element,[T,E,P,C,_,N,U,D]=dw(p,c,e,r,f.videoWidth,f.videoHeight);((h=f==null?void 0:f.classList)==null?void 0:h.contains("mirror"))?(a.save(),a.scale(-1,1),a.drawImage(f,T,E,P,C,-1*_,N,-1*U,D),a.restore()):a.drawImage(f,T,E,P,C,_,N,U,D),this.drawIcons(o[d],_,N,Math.max(U,D))}else this.drawEmptyTile(d,e,r,o[d]);d+=1,p+=e}c+=r}}calcGridElemSize(e){switch(e){case 0:case 1:return[n(this,Ce).width,n(this,Ce).height];case 2:return[Math.floor(n(this,Ce).width/2),n(this,Ce).height];case 3:case 4:return[Math.floor(n(this,Ce).width/2),Math.floor(n(this,Ce).height/2)];case 5:case 6:return[Math.floor(n(this,Ce).width/3),Math.floor(n(this,Ce).height/2)];case 7:case 8:case 9:return[Math.floor(n(this,Ce).width/3),Math.floor(n(this,Ce).height/3)];default:return[Math.floor(n(this,Ce).width/3),Math.floor(n(this,Ce).height/2)]}}paintCanvas(){let e=this.getSources().length;e!==1&&(e=e%2>0?e+1:e);const[r,i]=this.calcGridElemSize(e);this.drawTile(r,i,e)}isSupported(){var e;return!!window.chrome&&document.pictureInPictureEnabled&&((e=n(this,Ie).config)==null?void 0:e.viewType)!=="LIVESTREAM"}get isActive(){return document.pictureInPictureElement!==null}cleanup(){if(m(this,Nn,!1),this.isSupported()&&document.exitPictureInPicture!==void 0&&document.pictureInPictureElement!==null&&document.exitPictureInPicture(),n(this,Ze))try{document.body.removeChild(n(this,Ze))}catch(e){}this.removeAllSources(),m(this,Gt,void 0),m(this,Wt,void 0),m(this,Ws,void 0)}init({height:e,width:r}={}){if(!this.isSupported())throw this.logger.error("Pip.unsupported"),new Error("Picture-in-picture is not available in this environment");if(n(this,Nn))return;m(this,Nn,!0),this.createCanvas(),this.setupMediaSessionEvents();const i=document.createElement("video");m(this,Ce,{height:e!=null?e:kp,width:r!=null?r:Ip}),i.height=n(this,Ce).height,i.width=n(this,Ce).width,i.autoplay=!0,i.muted=!0,i.srcObject=n(this,Gt).captureStream(24),m(this,Wt,i),n(this,Wt).onloadedmetadata=()=>{try{this.emit("pipStarted"),n(this,Wt).onleavepictureinpicture=()=>{this.emit("pipEnded")}}catch(a){this.emit("pipEnded")}},this.createVideoContainer(),this.paintCanvas()}updateMediaSession(e,r){navigator.mediaSession!==void 0&&(e==="CAMERA"&&navigator.mediaSession.setCameraActive!==void 0&&navigator.mediaSession.setCameraActive(r),e==="MIC"&&navigator.mediaSession.setMicrophoneActive!==void 0&&navigator.mediaSession.setMicrophoneActive(r))}enableSource(e){n(this,ut)[e]!==void 0&&(n(this,ut)[e].enabled=!0)}disableSource(e){n(this,ut)[e]!==void 0&&(n(this,ut)[e].enabled=!1)}async generateAvatar(e,r){if(!r)return;const i=new Image;try{const a=await(await fetch(r)).blob(),o=window.URL.createObjectURL(a);i.onload=()=>{this.updateSource(e,{image:i}),window.URL.revokeObjectURL(o)},i.src=o}catch(a){this.logger.error("Pip::GenerateAvatar",{error:a})}}addSource(e,r,i,a=!1,o=void 0,c=void 0,d=!1){this.logger.debug("Pip::AddSource",{pip:{id:e,handRaised:d}}),n(this,ut)[e]={id:e,element:r,enabled:i,pinned:a,displayText:o?cw(o):void 0,imageUrl:c,handRaised:d},c&&this.generateAvatar(e,c)}updateSource(e,r){this.logger.info("Pip::UpdateSource",{pip:{id:e,handRaised:r.handRaised,reaction:r.reaction}});const i=n(this,ut)[e];i&&(n(this,ut)[e]={...i,...r})}removeSource(e){delete n(this,ut)[e]}removePinnedSource(){Object.values(n(this,ut)).forEach(r=>{r.pinned&&this.removeSource(r.id)})}removeAllSources(){m(this,ut,{})}enable(){m(this,Js,"activating"),this.setupEventListeners(),this.updateMediaSession("CAMERA",n(this,Ie).videoEnabled),this.updateMediaSession("MIC",n(this,Ie).audioEnabled),document.body.appendChild(n(this,Ze)),m(this,Ws,requestAnimationFrame(()=>this.animate())),n(this,Wt).onloadedmetadata=()=>{n(this,Wt).requestPictureInPicture().then(()=>{m(this,Js,"active")})},n(this,Wt).readyState===4&&n(this,Wt).requestPictureInPicture().then(()=>{m(this,Js,"active")})}};let Tu=Hh;Gt=new WeakMap,pi=new WeakMap,Ze=new WeakMap,Wt=new WeakMap,Ce=new WeakMap,ls=new WeakMap,Ws=new WeakMap,ut=new WeakMap,Ie=new WeakMap,Dn=new WeakMap,On=new WeakMap,Js=new WeakMap,Nn=new WeakMap;var fr;(function(s){s[s.PUBLISHER=0]="PUBLISHER",s[s.SUBSCRIBER=1]="SUBSCRIBER"})(fr||(fr={}));var xs;(function(s){s[s.AUDIO=0]="AUDIO",s[s.VIDEO=1]="VIDEO"})(xs||(xs={}));class lw extends v.MessageType{constructor(){super("media.Codec",[{no:1,name:"channels",kind:"scalar",opt:!0,T:5},{no:2,name:"clock_rate",kind:"scalar",T:5},{no:3,name:"mime_type",kind:"scalar",T:9},{no:4,name:"sdp_fmtp_line",kind:"scalar",opt:!0,T:9},{no:5,name:"payload_type",kind:"scalar",opt:!0,T:13}])}}const ef=new lw;class uw extends v.MessageType{constructor(){super("media.HeaderExtension",[{no:1,name:"direction",kind:"scalar",opt:!0,T:9},{no:2,name:"uri",kind:"scalar",T:9}])}}const hw=new uw;class pw extends v.MessageType{constructor(){super("media.Fingerprint",[{no:1,name:"algorithm",kind:"scalar",T:9},{no:2,name:"value",kind:"scalar",T:9}])}}new pw;class gw extends v.MessageType{constructor(){super("media.SessionDescription",[{no:1,name:"target",kind:"enum",T:()=>["media.Target",fr]},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"sdp",kind:"scalar",T:9}])}}const Rs=new gw;class mw extends v.MessageType{constructor(){super("media.ProducerPayload",[{no:1,name:"kind",kind:"scalar",T:9},{no:2,name:"paused",kind:"scalar",T:8},{no:3,name:"screen_share",kind:"scalar",T:8},{no:4,name:"msid",kind:"scalar",T:9},{no:5,name:"app_data",kind:"scalar",opt:!0,T:9},{no:6,name:"mime_type",kind:"scalar",opt:!0,T:9}])}}const fw=new mw;class Tw extends v.MessageType{constructor(){super("media.CreateTransportRequest",[{no:1,name:"consuming",kind:"scalar",T:8},{no:2,name:"force_tcp",kind:"scalar",opt:!0,T:8},{no:3,name:"description",kind:"message",T:()=>Rs},{no:4,name:"private_ice",kind:"scalar",opt:!0,T:8},{no:5,name:"producers",kind:"message",repeat:1,T:()=>fw}])}}const vw=new Tw;class yw extends v.MessageType{constructor(){super("media.AudioActivityRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"energy",kind:"scalar",T:5},{no:3,name:"silent",kind:"scalar",T:8}])}}const Sw=new yw;class Ew extends v.MessageType{constructor(){super("media.CreateTransportResponse",[{no:1,name:"transport_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>Rs},{no:3,name:"transcription_enabled",kind:"scalar",opt:!0,T:8},{no:4,name:"producer_ids",kind:"scalar",repeat:2,T:9}])}}const tf=new Ew;class Pw extends v.MessageType{constructor(){super("media.RenegotiateRequest",[{no:1,name:"transport_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>Rs}])}}const _w=new Pw;class Cw extends v.MessageType{constructor(){super("media.RenegotiateResponse",[{no:1,name:"transport_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>Rs}])}}new Cw;class ww extends v.MessageType{constructor(){super("media.NestedScore",[{no:1,name:"encoding_idx",kind:"scalar",T:5},{no:2,name:"rid",kind:"scalar",T:9},{no:3,name:"score",kind:"scalar",T:5},{no:4,name:"ssrc",kind:"scalar",T:3,L:0}])}}const Rw=new ww;class bw extends v.MessageType{constructor(){super("media.ProducerTrack",[{no:1,name:"track_id",kind:"scalar",T:9},{no:2,name:"producer_id",kind:"scalar",T:9},{no:3,name:"stream_id",kind:"scalar",T:9}])}}const kw=new bw;class Iw extends v.MessageType{constructor(){super("media.ProducerEntry",[{no:1,name:"producing_transport_id",kind:"scalar",T:9},{no:2,name:"producer_id",kind:"scalar",T:9}])}}new Iw;class Aw extends v.MessageType{constructor(){super("media.ConsumerEntry",[{no:1,name:"consuming_transport_id",kind:"scalar",T:9},{no:2,name:"consumer_id",kind:"scalar",T:9}])}}new Aw;class Mw extends v.MessageType{constructor(){super("media.ProducerState",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"kind",kind:"enum",T:()=>["media.ProducerKind",xs]},{no:3,name:"pause",kind:"scalar",T:8},{no:4,name:"screen_share",kind:"scalar",T:8},{no:5,name:"app_data",kind:"scalar",opt:!0,T:9},{no:6,name:"producing_transport_id",kind:"scalar",opt:!0,T:9},{no:7,name:"mime_type",kind:"scalar",opt:!0,T:9},{no:8,name:"codec",kind:"message",T:()=>ef}])}}const Lc=new Mw;class Dw extends v.MessageType{constructor(){super("media.ConsumerState",[{no:1,name:"consumer_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>Lc},{no:3,name:"producer_track",kind:"message",T:()=>kw},{no:4,name:"error_code",kind:"scalar",opt:!0,T:9}])}}const Ow=new Dw;class Nw extends v.MessageType{constructor(){super("media.ProducerIdToConsumerMap",[{no:1,name:"map",kind:"map",K:9,V:{kind:"message",T:()=>Ow}}])}}const sf=new Nw;class Vw extends v.MessageType{constructor(){super("media.PeerRtpCapabilitites",[{no:1,name:"sender",kind:"message",T:()=>Mp},{no:2,name:"receiver",kind:"message",T:()=>Mp}])}}const rf=new Vw;class Lw extends v.MessageType{constructor(){super("media.RtpCapability",[{no:1,name:"codecs",kind:"message",repeat:1,T:()=>ef},{no:2,name:"header_extensions",kind:"message",repeat:1,T:()=>hw}])}}const Ap=new Lw;class xw extends v.MessageType{constructor(){super("media.RtpCapabilitites",[{no:1,name:"audio",kind:"message",T:()=>Ap},{no:2,name:"video",kind:"message",T:()=>Ap}])}}const Mp=new xw;class Uw extends v.MessageType{constructor(){super("media.PreferredCodec",[{no:1,name:"audio",kind:"scalar",opt:!0,T:9},{no:2,name:"video",kind:"scalar",opt:!0,T:9}])}}const $w=new Uw;class Fw extends v.MessageType{constructor(){super("media.Simulcast",[{no:1,name:"preferred_rid",kind:"scalar",opt:!0,T:9},{no:2,name:"priority_ordering",kind:"scalar",opt:!0,T:9},{no:3,name:"rid_not_available",kind:"scalar",opt:!0,T:9}])}}const nf=new Fw;class Bw extends v.MessageType{constructor(){super("media.edge.GeoLocation",[{no:1,name:"latitude",kind:"scalar",T:2},{no:2,name:"longitude",kind:"scalar",T:2},{no:3,name:"region",kind:"scalar",opt:!0,T:9}])}}const Hw=new Bw;class qw extends v.MessageType{constructor(){super("media.edge.PeerJoinRequest",[{no:1,name:"display_name",kind:"scalar",opt:!0,T:9},{no:2,name:"prejoined",kind:"scalar",T:8},{no:3,name:"room_uuid",kind:"scalar",T:9},{no:4,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:5,name:"preset",kind:"scalar",opt:!0,T:12},{no:6,name:"user_id",kind:"scalar",opt:!0,T:9},{no:7,name:"organization_id",kind:"scalar",opt:!0,T:9},{no:8,name:"location",kind:"message",T:()=>Hw},{no:9,name:"capabilities",kind:"message",T:()=>rf}])}}const jw=new qw;class Gw extends v.MessageType{constructor(){super("media.edge.PeerJoinCompleteRequest",[])}}const Ww=new Gw;class Jw extends v.MessageType{constructor(){super("media.edge.PeerLeaveRequest",[{no:1,name:"close_room",kind:"scalar",T:8}])}}const Kw=new Jw;class zw extends v.MessageType{constructor(){super("media.edge.ConsumeMultipleProducerRequest",[{no:1,name:"producer_ids",kind:"scalar",repeat:2,T:9},{no:2,name:"paused",kind:"scalar",opt:!0,T:8}])}}new zw;class Yw extends v.MessageType{constructor(){super("media.edge.ConsumePeerRequest",[{no:1,name:"producing_peer_id",kind:"scalar",T:9},{no:2,name:"paused",kind:"scalar",opt:!0,T:8},{no:3,name:"producer_id",kind:"scalar",opt:!0,T:9},{no:4,name:"preferred_codec",kind:"message",T:()=>$w},{no:5,name:"producing_transport_id",kind:"scalar",opt:!0,T:9},{no:6,name:"simulcast",kind:"message",T:()=>nf}])}}const Qw=new Yw;class Xw extends v.MessageType{constructor(){super("media.edge.ConsumePeersRequest",[{no:1,name:"requests",kind:"message",repeat:1,T:()=>Qw},{no:2,name:"consuming_transport_id",kind:"scalar",opt:!0,T:9}])}}const Zw=new Xw;class eR extends v.MessageType{constructor(){super("media.edge.UpdateConsumerSimulcastConfigRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"simulcast",kind:"message",T:()=>nf},{no:3,name:"producing_transport_id",kind:"scalar",T:9},{no:4,name:"mid",kind:"scalar",T:9}])}}const tR=new eR;class sR extends v.MessageType{constructor(){super("media.edge.UpdateConsumersSimulcastConfigRequest",[{no:1,name:"requests",kind:"message",repeat:1,T:()=>tR},{no:2,name:"consuming_transport_id",kind:"scalar",opt:!0,T:9}])}}const rR=new sR;class iR extends v.MessageType{constructor(){super("media.edge.ProducerCreateRequest",[{no:1,name:"kind",kind:"scalar",T:9},{no:2,name:"paused",kind:"scalar",T:8},{no:3,name:"screen_share",kind:"scalar",T:8},{no:4,name:"description",kind:"message",T:()=>Rs},{no:5,name:"msid",kind:"scalar",T:9},{no:6,name:"app_data",kind:"scalar",opt:!0,T:9},{no:7,name:"mime_type",kind:"scalar",opt:!0,T:9},{no:8,name:"producing_transport_id",kind:"scalar",opt:!0,T:9}])}}const nR=new iR;class aR extends v.MessageType{constructor(){super("media.edge.SelectedPeersRequest",[])}}new aR;class oR extends v.MessageType{constructor(){super("media.edge.GlobalPeerPinningRequest",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}const cR=new oR;class dR extends v.MessageType{constructor(){super("media.edge.ProducerToggleRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"pause",kind:"scalar",T:8}])}}const Wc=new dR;class lR extends v.MessageType{constructor(){super("media.edge.ConsumerToggleRequest",[{no:1,name:"consumer_id",kind:"scalar",T:9},{no:2,name:"pause",kind:"scalar",T:8}])}}new lR;class uR extends v.MessageType{constructor(){super("media.edge.ProducerCloseRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>Rs},{no:3,name:"producing_transport_id",kind:"scalar",opt:!0,T:9}])}}const hR=new uR;class pR extends v.MessageType{constructor(){super("media.edge.ConsumerCloseRequest",[{no:1,name:"consumer_ids",kind:"scalar",repeat:2,T:9},{no:2,name:"description",kind:"message",T:()=>Rs},{no:3,name:"consuming_transport_id",kind:"scalar",opt:!0,T:9}])}}const gR=new pR;class mR extends v.MessageType{constructor(){super("media.edge.KickPeerRequest",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}new mR;class fR extends v.MessageType{constructor(){super("media.edge.KickAllPeersRequest",[{no:1,name:"propagate_kick_across_rooms",kind:"scalar",T:8}])}}const af=new fR;class TR extends v.MessageType{constructor(){super("media.edge.PeerDisplayNameEditRequest",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",T:9}])}}const vR=new TR;class yR extends v.MessageType{constructor(){super("media.edge.HostMediaControlForPeerRequest",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"audio",kind:"scalar",T:8},{no:3,name:"video",kind:"scalar",T:8},{no:4,name:"scree_share",kind:"scalar",T:8}])}}const SR=new yR;class ER extends v.MessageType{constructor(){super("media.edge.HostMediaControlForAllPeerRequest",[{no:1,name:"audio",kind:"scalar",T:8},{no:2,name:"video",kind:"scalar",T:8},{no:3,name:"screen_share",kind:"scalar",T:8}])}}const PR=new ER;class _R extends v.MessageType{constructor(){super("media.edge.GetRoomStateResponse",[{no:1,name:"display_title",kind:"scalar",T:9},{no:2,name:"locked_mode",kind:"scalar",T:8},{no:3,name:"room_uuid",kind:"scalar",T:9},{no:4,name:"room_name",kind:"scalar",T:9},{no:5,name:"current_peer_id",kind:"scalar",T:9},{no:6,name:"is_recording",kind:"scalar",opt:!0,T:8},{no:7,name:"recorder_participant_id",kind:"scalar",opt:!0,T:9},{no:8,name:"pinned_peer_ids",kind:"scalar",repeat:2,T:9}])}}const CR=new _R;class wR extends v.MessageType{constructor(){super("media.edge.ErrorResponse",[{no:1,name:"error_message",kind:"scalar",T:9},{no:2,name:"event_id",kind:"scalar",T:5}])}}const RR=new wR;class bR extends v.MessageType{constructor(){super("media.edge.EmptyResponse",[])}}new bR;class kR extends v.MessageType{constructor(){super("media.edge.RoomParticipants",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"producer_states",kind:"message",repeat:1,T:()=>Lc},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"user_id",kind:"scalar",opt:!0,T:9},{no:5,name:"capabilities",kind:"message",T:()=>rf}])}}const of=new kR;class IR extends v.MessageType{constructor(){super("media.edge.SelectedPeersResponse",[{no:1,name:"audio_peers",kind:"scalar",repeat:2,T:9},{no:2,name:"compulsory_peers",kind:"scalar",repeat:2,T:9}])}}const vu=new IR;class AR extends v.MessageType{constructor(){super("media.edge.SelectedPeersDiffEntry",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"priority",kind:"scalar",T:5}])}}const MR=new AR;class DR extends v.MessageType{constructor(){super("media.edge.SelectedPeersDiffResponse",[{no:1,name:"entries",kind:"message",repeat:1,T:()=>MR}])}}const Dp=new DR;class OR extends v.MessageType{constructor(){super("media.edge.PeerJoinResponse",[])}}new OR;class NR extends v.MessageType{constructor(){super("media.edge.PeerJoinCompleteResponse",[{no:1,name:"room_state",kind:"message",T:()=>CR},{no:2,name:"participants",kind:"message",repeat:1,T:()=>of},{no:3,name:"selected_peers",kind:"message",T:()=>vu},{no:4,name:"max_preferred_streams",kind:"scalar",T:5}])}}const yu=new NR;class VR extends v.MessageType{constructor(){super("media.edge.PeerLeaveResponse",[{no:1,name:"closed",kind:"scalar",T:8}])}}const LR=new VR;class xR extends v.MessageType{constructor(){super("media.edge.ConsumeMultipleProducerResponse",[{no:1,name:"status",kind:"scalar",T:8},{no:2,name:"consumer_ids_map",kind:"message",T:()=>sf}])}}new xR;class UR extends v.MessageType{constructor(){super("media.edge.ConsumePeerResponse",[{no:1,name:"status",kind:"scalar",T:8},{no:2,name:"consumer_ids_map",kind:"message",T:()=>sf},{no:3,name:"description",kind:"message",T:()=>Rs}])}}const $R=new UR;class FR extends v.MessageType{constructor(){super("media.edge.ProducerCreateResponse",[{no:1,name:"status",kind:"scalar",T:8},{no:2,name:"producer_id",kind:"scalar",T:9},{no:4,name:"description",kind:"message",T:()=>Rs}])}}const BR=new FR;class HR extends v.MessageType{constructor(){super("media.edge.ProducerScoreResponse",[{no:1,name:"responseid",kind:"scalar",T:9},{no:2,name:"score",kind:"message",T:()=>Rw}])}}new HR;class qR extends v.MessageType{constructor(){super("media.edge.ActiveSpeakerResponse",[{no:1,name:"responsepeer_id",kind:"scalar",T:9},{no:2,name:"volume",kind:"scalar",T:5}])}}new qR;class jR extends v.MessageType{constructor(){super("media.edge.NoActiveSpeakerResponse",[])}}new jR;class GR extends v.MessageType{constructor(){super("media.edge.ProducerToggleResponse",[])}}new GR;class WR extends v.MessageType{constructor(){super("media.edge.ConsumerToggleResponse",[])}}new WR;class JR extends v.MessageType{constructor(){super("media.edge.ProducerClosingResponse",[{no:1,name:"description",kind:"message",T:()=>Rs}])}}const KR=new JR;class zR extends v.MessageType{constructor(){super("media.edge.ConsumerClosingResponse",[{no:1,name:"description",kind:"message",T:()=>Rs}])}}const YR=new zR;class QR extends v.MessageType{constructor(){super("media.edge.GlobalPeerPinningResponse",[])}}new QR;class XR extends v.MessageType{constructor(){super("media.edge.KickPeerResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}new XR;class ZR extends v.MessageType{constructor(){super("media.edge.KickAllPeersResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}new ZR;class eb extends v.MessageType{constructor(){super("media.edge.HostMediaControlForPeerResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}const tb=new eb;class sb extends v.MessageType{constructor(){super("media.edge.HostMediaControlForAllPeerResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}const rb=new sb;class ib extends v.MessageType{constructor(){super("media.edge.PeerDisplayNameEditResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}const nb=new ib;class ab extends v.MessageType{constructor(){super("media.edge.PeerJoinBroadcastResponse",[{no:1,name:"participant",kind:"message",T:()=>of}])}}const Op=new ab;class ob extends v.MessageType{constructor(){super("media.edge.TrackSubscriptionKind",[{no:1,name:"audio",kind:"scalar",T:8},{no:2,name:"video",kind:"scalar",T:8}])}}const Np=new ob;class cb extends v.MessageType{constructor(){super("media.edge.TrackSubscription",[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"webcam",kind:"message",T:()=>Np},{no:3,name:"screenshare",kind:"message",T:()=>Np}])}}const db=new cb;class lb extends v.MessageType{constructor(){super("media.edge.PeerProducingTransportCreateBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"transport_details",kind:"message",T:()=>tf},{no:3,name:"track_subscriptions",kind:"message",repeat:1,T:()=>db}])}}new lb;class ub extends v.MessageType{constructor(){super("media.edge.PeerProducerCreateBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>Lc}])}}const hb=new ub;class pb extends v.MessageType{constructor(){super("media.edge.PeerProducerToggleBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>Lc},{no:3,name:"initiator_participant_id",kind:"scalar",opt:!0,T:9}])}}const Vp=new pb;class gb extends v.MessageType{constructor(){super("media.edge.PeerProducerCloseBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>Lc}])}}const mb=new gb;class fb extends v.MessageType{constructor(){super("media.edge.PeerLeaveBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}const Su=new fb;class Tb extends v.MessageType{constructor(){super("media.edge.GlobalPeerPinningBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}const Lp=new Tb;class vb extends v.MessageType{constructor(){super("media.edge.GlobalPeerUnPinningBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}new vb;class yb extends v.MessageType{constructor(){super("media.edge.RecordingStartedBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}new yb;class Sb extends v.MessageType{constructor(){super("media.edge.RecordingStoppedBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}new Sb;class Eb extends v.MessageType{constructor(){super("media.edge.PeerDisplayNameEditBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",T:9}])}}new Eb;class Pb extends v.MessageType{constructor(){super("media.edge.PeerPingRequestBroadcastResponse",[{no:1,name:"password",kind:"scalar",T:9}])}}new Pb;class _b extends v.MessageType{constructor(){super("media.edge.MediaRoomTerminationBroadcastResponse",[{no:1,name:"reason",kind:"scalar",T:9}])}}new _b;class Cb extends v.MessageType{constructor(){super("socket.ai.MeetingTranscript",[{no:1,name:"meeting_id",kind:"scalar",T:9},{no:2,name:"transcript",kind:"scalar",T:9},{no:3,name:"is_partial",kind:"scalar",T:8}])}}const Zl=new Cb;class wb extends v.MessageType{constructor(){super("socket.api.BaseSocketHubMessage",[{no:1,name:"event",kind:"scalar",T:5},{no:2,name:"id",kind:"scalar",T:9},{no:3,name:"peer_id",kind:"scalar",T:9},{no:4,name:"room_id",kind:"scalar",T:9},{no:5,name:"user_id",kind:"scalar",T:9},{no:6,name:"payload",kind:"scalar",T:12},{no:7,name:"error",kind:"scalar",opt:!0,T:8},{no:8,name:"sid",kind:"scalar",opt:!0,T:9}])}}new wb;class Rb extends v.MessageType{constructor(){super("socket.api.ErrorMessage",[{no:1,name:"code",kind:"scalar",opt:!0,T:5},{no:2,name:"message",kind:"scalar",T:9}])}}const bb=new Rb;var sn;(function(s){s[s.BROWSER=0]="BROWSER",s[s.TRACK=1]="TRACK",s[s.COMPOSITE=2]="COMPOSITE"})(sn||(sn={}));var lr;(function(s){s[s.UNSPECIFIED=0]="UNSPECIFIED",s[s.ON_STAGE=1]="ON_STAGE",s[s.APPROVED_STAGE=2]="APPROVED_STAGE",s[s.REQUESTED_STAGE=3]="REQUESTED_STAGE",s[s.OFF_STAGE=4]="OFF_STAGE"})(lr||(lr={}));var Eu;(function(s){s[s.NONE=0]="NONE",s[s.RECORDER=1]="RECORDER",s[s.LIVESTREAMER=2]="LIVESTREAMER"})(Eu||(Eu={}));var Pu;(function(s){s[s.PEERS=0]="PEERS",s[s.ROOMS=1]="ROOMS"})(Pu||(Pu={}));var Sd;(function(s){s[s.HIVE=0]="HIVE",s[s.CHAT=1]="CHAT",s[s.PING=2]="PING"})(Sd||(Sd={}));class kb extends v.MessageType{constructor(){super("socket.room.PeerFlags",[{no:1,name:"preset_name",kind:"scalar",T:9},{no:2,name:"recorder_type",kind:"scalar",T:9},{no:3,name:"hidden_participant",kind:"scalar",T:8}])}}const Ib=new kb;class Ab extends v.MessageType{constructor(){super("socket.room.Peer",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"stage_type",kind:"enum",opt:!0,T:()=>["socket.room.StageType",lr,"STAGE_TYPE_"]},{no:5,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:6,name:"preset_id",kind:"scalar",opt:!0,T:9},{no:7,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:8,name:"waitlisted",kind:"scalar",T:8},{no:9,name:"flags",kind:"message",T:()=>Ib}])}}const Vl=new Ab;class Mb extends v.MessageType{constructor(){super("socket.room.PeerInfoResponse",[{no:1,name:"peer",kind:"message",T:()=>Vl}])}}const fn=new Mb;class Db extends v.MessageType{constructor(){super("socket.room.PeerStatusUpdate",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"stage_type",kind:"enum",opt:!0,T:()=>["socket.room.StageType",lr,"STAGE_TYPE_"]}])}}const xp=new Db;class Ob extends v.MessageType{constructor(){super("socket.room.RoomPeersInfoRequest",[{no:1,name:"seach_query",kind:"scalar",T:9},{no:2,name:"limit",kind:"scalar",T:5},{no:3,name:"offset",kind:"scalar",T:5}])}}const Nb=new Ob;class Vb extends v.MessageType{constructor(){super("socket.room.RoomPeersInfoResponse",[{no:1,name:"peers",kind:"message",repeat:1,T:()=>Vl}])}}const eu=new Vb;class Lb extends v.MessageType{constructor(){super("socket.room.RoomPeerCountResponse",[{no:1,name:"count",kind:"scalar",T:4,L:2}])}}const Up=new Lb;class xb extends v.MessageType{constructor(){super("socket.room.Room",[{no:1,name:"room_id",kind:"scalar",T:9},{no:2,name:"title",kind:"scalar",T:9},{no:4,name:"created_at",kind:"scalar",T:4,L:2},{no:5,name:"active_recordings",kind:"message",repeat:1,T:()=>$b},{no:6,name:"room_uuid",kind:"scalar",opt:!0,T:9}])}}const cf=new xb;class Ub extends v.MessageType{constructor(){super("socket.room.ActiveRecording",[{no:1,name:"recording_id",kind:"scalar",T:9},{no:2,name:"recording_type",kind:"enum",T:()=>["common.RecordingType",sn]},{no:3,name:"recording_status",kind:"scalar",T:9}])}}const $b=new Ub;class Fb extends v.MessageType{constructor(){super("socket.room.RoomInfoResponse",[{no:1,name:"room",kind:"message",T:()=>cf}])}}const $p=new Fb;class Bb extends v.MessageType{constructor(){super("socket.room.GetPeerInfoRequest",[{no:1,name:"peer_id",kind:"scalar",T:9}])}}const df=new Bb;class Hb extends v.MessageType{constructor(){super("socket.room.UpdatePeerInfoRequest",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",opt:!0,T:9}])}}new Hb;class qb extends v.MessageType{constructor(){super("socket.room.JoinRoomRequest",[{no:1,name:"peer",kind:"message",T:()=>Vl},{no:3,name:"room_uuid",kind:"scalar",T:9},{no:4,name:"organization_id",kind:"scalar",opt:!0,T:9},{no:5,name:"use_hive",kind:"scalar",opt:!0,T:8},{no:6,name:"preset",kind:"scalar",opt:!0,T:12},{no:7,name:"capabilities",kind:"enum",repeat:1,T:()=>["socket.room.Capabilities",Sd,"CAPABILITIES_"]},{no:8,name:"timestamp",kind:"scalar",opt:!0,T:4,L:2}])}}const jb=new qb;class Gb extends v.MessageType{constructor(){super("socket.room.LeaveRoomRequest",[{no:1,name:"peer",kind:"message",T:()=>Vl},{no:2,name:"timestamp",kind:"scalar",opt:!0,T:4,L:2}])}}const Wb=new Gb;class Jb extends v.MessageType{constructor(){super("socket.room.UpdateRoomInfoRequest",[{no:1,name:"room",kind:"message",T:()=>cf}])}}new Jb;class Kb extends v.MessageType{constructor(){super("socket.room.GetConnectedRoomsDumpRequest",[])}}new Kb;class zb extends v.MessageType{constructor(){super("socket.room.ServiceError",[{no:1,name:"message",kind:"scalar",opt:!0,T:9},{no:2,name:"code",kind:"scalar",opt:!0,T:9}])}}const Ph=new zb;class Yb extends v.MessageType{constructor(){super("socket.room.ConnectedMeetingPeer",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"display_name",kind:"scalar",opt:!0,T:9},{no:3,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:4,name:"preset_id",kind:"scalar",opt:!0,T:9},{no:5,name:"display_picture_url",kind:"scalar",opt:!0,T:9}])}}const Qb=new Yb;class Xb extends v.MessageType{constructor(){super("socket.room.ConnectedMeetingDump",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"title",kind:"scalar",opt:!0,T:9},{no:3,name:"participants",kind:"message",repeat:1,T:()=>Qb}])}}const Fp=new Xb;class Zb extends v.MessageType{constructor(){super("socket.room.GetConnectedRoomsDumpResponse",[{no:1,name:"parent_meeting",kind:"message",T:()=>Fp},{no:2,name:"meetings",kind:"message",repeat:1,T:()=>Fp}])}}const ek=new Zb;class tk extends v.MessageType{constructor(){super("socket.room.CreateRoomRequestPayload",[{no:1,name:"title",kind:"scalar",opt:!0,T:9}])}}const sk=new tk;class rk extends v.MessageType{constructor(){super("socket.room.CreateConnectedRoomsRequest",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>sk}])}}const ik=new rk;class nk extends v.MessageType{constructor(){super("socket.room.CreateRoomResponsePayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"title",kind:"scalar",opt:!0,T:9},{no:3,name:"error",kind:"message",T:()=>Ph}])}}const ak=new nk;class ok extends v.MessageType{constructor(){super("socket.room.CreateConnectedRoomsResponse",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>ak}])}}const Bp=new ok;class ck extends v.MessageType{constructor(){super("socket.room.UpdateRoomRequestPayload",[{no:1,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"title",kind:"scalar",opt:!0,T:9}])}}const dk=new ck;class lk extends v.MessageType{constructor(){super("socket.room.UpdateConnectedRoomsRequest",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>dk}])}}new lk;class uk extends v.MessageType{constructor(){super("socket.room.DisableRoomPayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9}])}}const hk=new uk;class pk extends v.MessageType{constructor(){super("socket.room.DisableConnectedRoomsRequest",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>hk}])}}const gk=new pk;class mk extends v.MessageType{constructor(){super("socket.room.DisableConnectedRoomsResponse",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>vk}])}}const fk=new mk;class Tk extends v.MessageType{constructor(){super("socket.room.DisableConnectedRoomPayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"status",kind:"scalar",opt:!0,T:9},{no:3,name:"title",kind:"scalar",opt:!0,T:9},{no:4,name:"error",kind:"message",T:()=>Ph}])}}const vk=new Tk;class yk extends v.MessageType{constructor(){super("socket.room.MovePeerPayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"preset_id",kind:"scalar",opt:!0,T:9}])}}const Sk=new yk;class Ek extends v.MessageType{constructor(){super("socket.room.MovePeersBetweenRoomsRequest",[{no:1,name:"source_meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"destination_meeting_id",kind:"scalar",opt:!0,T:9},{no:3,name:"participants",kind:"message",repeat:1,T:()=>Sk}])}}const Pk=new Ek;class _k extends v.MessageType{constructor(){super("socket.room.MovedPeer",[{no:1,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:3,name:"error",kind:"message",T:()=>Ph}])}}const lf=new _k;class Ck extends v.MessageType{constructor(){super("socket.room.MovePeersBetweenRoomsResponse",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>lf}])}}new Ck;class wk extends v.MessageType{constructor(){super("socket.room.TransferPeer",[{no:1,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"auth_token",kind:"scalar",opt:!0,T:9}])}}const Rk=new wk;class bk extends v.MessageType{constructor(){super("socket.room.GetAllAddedParticipantsResponse",[{no:1,name:"participants",kind:"message",repeat:1,T:()=>Ak}])}}const kk=new bk;class Ik extends v.MessageType{constructor(){super("socket.room.AddedParticipant",[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",opt:!0,T:9},{no:3,name:"picture",kind:"scalar",opt:!0,T:9},{no:4,name:"custom_participant_id",kind:"scalar",T:9}])}}const Ak=new Ik;class Mk extends v.MessageType{constructor(){super("socket.room.RemoveParticipantsRequest",[{no:1,name:"peer_ids",kind:"scalar",repeat:2,T:9}])}}const uf=new Mk;class Dk extends v.MessageType{constructor(){super("socket.room.BroadcastMessage",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"timestamp",kind:"scalar",T:4,L:2},{no:4,name:"ids",kind:"scalar",repeat:2,T:9},{no:5,name:"broadcast_type",kind:"enum",opt:!0,T:()=>["socket.room.BroadcastType",Pu,"BROADCAST_TYPE_"]}])}}const ro=new Dk;class Ok extends v.MessageType{constructor(){super("socket.room.AcceptWaitingRoomRequests",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const Nk=new Ok;class Vk extends v.MessageType{constructor(){super("socket.room.DenyWaitingRoomRequests",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const Lk=new Vk;class xk extends v.MessageType{constructor(){super("socket.room.WaitingRoomRequest",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"picture",kind:"scalar",opt:!0,T:9},{no:5,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:6,name:"preset_name",kind:"scalar",opt:!0,T:9}])}}const Uk=new xk;class $k extends v.MessageType{constructor(){super("socket.room.GetWaitingRoomRequests",[{no:1,name:"requests",kind:"message",repeat:1,T:()=>Uk}])}}const Hp=new $k;class Fk extends v.MessageType{constructor(){super("socket.room.GetRoomStageStateResponse",[{no:1,name:"on_stage_peers",kind:"scalar",repeat:2,T:9},{no:2,name:"approved_stage_peers",kind:"scalar",repeat:2,T:9},{no:3,name:"requested_stage_peers",kind:"scalar",repeat:2,T:9}])}}const qp=new Fk;var _u;(function(s){s[s.NONE=0]="NONE",s[s.SKIP=1]="SKIP",s[s.ON_PRIVILEGED_USER_ENTRY=2]="ON_PRIVILEGED_USER_ENTRY",s[s.SKIP_ON_ACCEPT=3]="SKIP_ON_ACCEPT"})(_u||(_u={}));var zr;(function(s){s[s.NONE=0]="NONE",s[s.ALLOWED=1]="ALLOWED",s[s.NOT_ALLOWED=2]="NOT_ALLOWED",s[s.CAN_REQUEST=3]="CAN_REQUEST"})(zr||(zr={}));class Bk extends v.MessageType{constructor(){super("socket.preset.PollsPermissionUpdate",[{no:1,name:"can_create",kind:"scalar",opt:!0,T:8},{no:2,name:"can_vote",kind:"scalar",opt:!0,T:8},{no:3,name:"can_view",kind:"scalar",opt:!0,T:8}])}}const Hk=new Bk;class qk extends v.MessageType{constructor(){super("socket.preset.PluginsPermissionsUpdate",[{no:1,name:"can_close",kind:"scalar",opt:!0,T:8},{no:2,name:"can_start",kind:"scalar",opt:!0,T:8}])}}const jk=new qk;class Gk extends v.MessageType{constructor(){super("socket.preset.PublicChatPermission",[{no:1,name:"can_send",kind:"scalar",opt:!0,T:8},{no:2,name:"text",kind:"scalar",opt:!0,T:8},{no:3,name:"files",kind:"scalar",opt:!0,T:8}])}}const Wk=new Gk;class Jk extends v.MessageType{constructor(){super("socket.preset.PrivateChatPermission",[{no:1,name:"can_send",kind:"scalar",opt:!0,T:8},{no:2,name:"can_receive",kind:"scalar",opt:!0,T:8},{no:3,name:"text",kind:"scalar",opt:!0,T:8},{no:4,name:"files",kind:"scalar",opt:!0,T:8}])}}const Kk=new Jk;class zk extends v.MessageType{constructor(){super("socket.preset.ChatPermissionUpdate",[{no:1,name:"public",kind:"message",T:()=>Wk},{no:2,name:"private",kind:"message",T:()=>Kk}])}}const Yk=new zk;class Qk extends v.MessageType{constructor(){super("socket.preset.ConnectedMeetingPermissionUpdate",[{no:1,name:"can_alter_connected_meetings",kind:"scalar",opt:!0,T:8},{no:2,name:"can_switch_to_parent_meeting",kind:"scalar",opt:!0,T:8},{no:3,name:"can_switch_connected_meetings",kind:"scalar",opt:!0,T:8}])}}const Xk=new Qk;class Zk extends v.MessageType{constructor(){super("socket.preset.StreamPermission",[{no:1,name:"can_produce",kind:"enum",opt:!0,T:()=>["socket.preset.StreamPermissionType",zr,"STREAM_PERMISSION_TYPE_"]},{no:2,name:"can_consume",kind:"enum",opt:!0,T:()=>["socket.preset.StreamPermissionType",zr,"STREAM_PERMISSION_TYPE_"]}])}}const tu=new Zk;class eI extends v.MessageType{constructor(){super("socket.preset.MediaPermissionUpdate",[{no:1,name:"video",kind:"message",T:()=>tu},{no:2,name:"audio",kind:"message",T:()=>tu},{no:3,name:"screenshare",kind:"message",T:()=>tu}])}}const tI=new eI;class sI extends v.MessageType{constructor(){super("socket.preset.PresetUpdates",[{no:1,name:"polls",kind:"message",T:()=>Hk},{no:2,name:"plugins",kind:"message",T:()=>jk},{no:3,name:"chat",kind:"message",T:()=>Yk},{no:4,name:"accept_waiting_requests",kind:"scalar",opt:!0,T:8},{no:5,name:"can_accept_production_requests",kind:"scalar",opt:!0,T:8},{no:6,name:"can_edit_display_name",kind:"scalar",opt:!0,T:8},{no:7,name:"can_record",kind:"scalar",opt:!0,T:8},{no:8,name:"can_livestream",kind:"scalar",opt:!0,T:8},{no:9,name:"can_spotlight",kind:"scalar",opt:!0,T:8},{no:10,name:"disable_participant_audio",kind:"scalar",opt:!0,T:8},{no:11,name:"disable_participant_screensharing",kind:"scalar",opt:!0,T:8},{no:12,name:"disable_participant_video",kind:"scalar",opt:!0,T:8},{no:13,name:"kick_participant",kind:"scalar",opt:!0,T:8},{no:14,name:"pin_participant",kind:"scalar",opt:!0,T:8},{no:15,name:"transcription_enabled",kind:"scalar",opt:!0,T:8},{no:16,name:"waiting_room_type",kind:"enum",opt:!0,T:()=>["socket.preset.WaitingRoomType",_u,"WAITING_ROOM_TYPE_"]},{no:17,name:"is_recorder",kind:"scalar",opt:!0,T:8},{no:18,name:"recorder_type",kind:"enum",opt:!0,T:()=>["socket.room.RecorderType",Eu,"RECORDER_TYPE_"]},{no:19,name:"hidden_participant",kind:"scalar",opt:!0,T:8},{no:20,name:"show_participant_list",kind:"scalar",opt:!0,T:8},{no:21,name:"can_change_participant_permissions",kind:"scalar",opt:!0,T:8},{no:22,name:"connected_meetings",kind:"message",T:()=>Xk},{no:23,name:"media",kind:"message",T:()=>tI}])}}const _h=new sI;class rI extends v.MessageType{constructor(){super("socket.preset.ReadPeersPresetRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const iI=new rI;class nI extends v.MessageType{constructor(){super("socket.preset.PeerPreset",[{no:1,name:"user_id",kind:"scalar",T:9},{no:2,name:"peer_id",kind:"scalar",T:9},{no:3,name:"preset",kind:"scalar",T:12}])}}const aI=new nI;class oI extends v.MessageType{constructor(){super("socket.preset.ReadPeersPresetResponse",[{no:1,name:"peer_presets",kind:"message",repeat:1,T:()=>aI}])}}const cI=new oI;class dI extends v.MessageType{constructor(){super("socket.preset.UpdatePeerPreset",[{no:1,name:"user_ids",kind:"scalar",T:9},{no:2,name:"patch",kind:"message",T:()=>_h}])}}const hf=new dI;class lI extends v.MessageType{constructor(){super("socket.preset.UpdatePeersPresetRequest",[{no:1,name:"update_peers_presets",kind:"message",repeat:1,T:()=>hf}])}}const uI=new lI;class hI extends v.MessageType{constructor(){super("socket.preset.UpdatePeersPresetResponse",[{no:1,name:"update_peers_presets",kind:"message",repeat:1,T:()=>hf}])}}const jp=new hI;class pI extends v.MessageType{constructor(){super("socket.preset.PeerUserIDMap",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9}])}}const gI=new pI;class mI extends v.MessageType{constructor(){super("socket.preset.BulkUpdatePeerPresetRequest",[{no:1,name:"peers",kind:"message",repeat:1,T:()=>gI},{no:2,name:"patch",kind:"message",T:()=>_h}])}}new mI;class fI extends v.MessageType{constructor(){super("socket.preset.BulkUpdatePeerPresetResponse",[{no:2,name:"patch",kind:"message",T:()=>_h}])}}new fI;class TI extends v.MessageType{constructor(){super("socket.chat.ChatMessage",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"peer_id",kind:"scalar",T:9},{no:3,name:"user_id",kind:"scalar",T:9},{no:4,name:"display_name",kind:"scalar",T:9},{no:5,name:"pinned",kind:"scalar",T:8},{no:6,name:"is_edited",kind:"scalar",T:8},{no:7,name:"payload_type",kind:"scalar",T:5},{no:8,name:"payload",kind:"scalar",T:9},{no:10,name:"target_user_ids",kind:"scalar",repeat:2,T:9},{no:11,name:"created_at",kind:"scalar",T:4,L:2},{no:12,name:"created_at_ms",kind:"scalar",opt:!0,T:4,L:2},{no:13,name:"channel_id",kind:"scalar",opt:!0,T:9},{no:14,name:"channel_index",kind:"scalar",opt:!0,T:9}])}}const un=new TI;class vI extends v.MessageType{constructor(){super("socket.chat.GetPaginatedChatMessageRoomRequest",[{no:1,name:"time_stamp",kind:"scalar",T:4,L:2},{no:2,name:"size",kind:"scalar",T:5},{no:3,name:"from",kind:"scalar",T:5},{no:4,name:"reversed",kind:"scalar",T:8},{no:5,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const yI=new vI;class SI extends v.MessageType{constructor(){super("socket.chat.GetPaginatedChatMessageRoomResponse",[{no:1,name:"messages",kind:"message",repeat:1,T:()=>un},{no:2,name:"next",kind:"scalar",T:8}])}}const EI=new SI;class PI extends v.MessageType{constructor(){super("socket.chat.GetChatMessagesResponse",[{no:1,name:"messages",kind:"message",repeat:1,T:()=>un}])}}const pf=new PI;class _I extends v.MessageType{constructor(){super("socket.chat.SendChatMessageToRoomRequest",[{no:1,name:"payload_type",kind:"scalar",T:5},{no:2,name:"payload",kind:"scalar",T:9}])}}const CI=new _I;class wI extends v.MessageType{constructor(){super("socket.chat.SendChatMessageToRoomResponse",[{no:1,name:"message",kind:"message",T:()=>un}])}}const su=new wI;class RI extends v.MessageType{constructor(){super("socket.chat.SendChatMessageToPeersRequest",[{no:1,name:"peer_ids",kind:"scalar",repeat:2,T:9},{no:2,name:"payload_type",kind:"scalar",T:5},{no:3,name:"payload",kind:"scalar",T:9}])}}const bI=new RI;class kI extends v.MessageType{constructor(){super("socket.chat.SendChatMessageToPeersResponse",[{no:1,name:"message",kind:"message",T:()=>un}])}}const ru=new kI;class II extends v.MessageType{constructor(){super("socket.chat.SendChatMessageToChannelRequest",[{no:1,name:"channel_id",kind:"scalar",T:9},{no:2,name:"payload_type",kind:"scalar",T:5},{no:3,name:"payload",kind:"scalar",T:9}])}}const AI=new II;class MI extends v.MessageType{constructor(){super("socket.chat.SendChatMessageToChannelResponse",[{no:1,name:"message",kind:"message",T:()=>un}])}}new MI;class DI extends v.MessageType{constructor(){super("socket.chat.EditChatMessageRequest",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"payload_type",kind:"scalar",opt:!0,T:5},{no:3,name:"payload",kind:"scalar",opt:!0,T:9},{no:4,name:"pinned",kind:"scalar",opt:!0,T:8},{no:5,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const OI=new DI;class NI extends v.MessageType{constructor(){super("socket.chat.PinChatMessageRequest",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"pinned",kind:"scalar",T:8},{no:3,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const VI=new NI;class LI extends v.MessageType{constructor(){super("socket.chat.PinChatMessageResponse",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"pinned",kind:"scalar",T:8},{no:3,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const Jc=new LI;class xI extends v.MessageType{constructor(){super("socket.chat.EditChatMessageResponse",[{no:1,name:"message",kind:"message",T:()=>un}])}}const Kc=new xI;class UI extends v.MessageType{constructor(){super("socket.chat.DeleteChatMessageRequest",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const $I=new UI;class FI extends v.MessageType{constructor(){super("socket.chat.DeleteChatMessageResponse",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const zc=new FI;class BI extends v.MessageType{constructor(){super("socket.chat.SearchChatMessagesRequest",[{no:1,name:"time_stamp",kind:"scalar",T:4,L:2},{no:2,name:"size",kind:"scalar",T:5},{no:3,name:"from",kind:"scalar",T:5},{no:4,name:"reversed",kind:"scalar",T:8},{no:5,name:"channel_id",kind:"scalar",opt:!0,T:9},{no:6,name:"search_term",kind:"scalar",T:9}])}}const HI=new BI;class qI extends v.MessageType{constructor(){super("socket.chat.MarkChannelIndexAsReadRequest",[{no:1,name:"channel_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"channel_index",kind:"scalar",T:9}])}}const jI=new qI;class GI extends v.MessageType{constructor(){super("socket.chat.MarkChannelIndexAsReadResponse",[{no:1,name:"channel_index",kind:"scalar",T:9}])}}const WI=new GI;class JI extends v.MessageType{constructor(){super("socket.chat.CreateChatChannelRequest",[{no:1,name:"display_name",kind:"scalar",T:9},{no:2,name:"target_user_ids",kind:"scalar",repeat:2,T:9},{no:3,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:4,name:"visibility",kind:"scalar",T:9},{no:5,name:"is_direct_message",kind:"scalar",T:8}])}}const KI=new JI;class zI extends v.MessageType{constructor(){super("socket.chat.UpdateChatChannelRequest",[{no:1,name:"chat_channel_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",opt:!0,T:9},{no:3,name:"target_user_ids",kind:"scalar",repeat:2,T:9},{no:4,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:5,name:"visibility",kind:"scalar",opt:!0,T:9},{no:6,name:"is_direct_message",kind:"scalar",opt:!0,T:8}])}}const YI=new zI;class QI extends v.MessageType{constructor(){super("socket.chat.CreateChatChannelResponse",[{no:1,name:"chat_channel_id",kind:"scalar",T:9}])}}new QI;class XI extends v.MessageType{constructor(){super("socket.chat.GetChatChannelRequest",[{no:1,name:"chat_channel_id",kind:"scalar",T:9}])}}const ZI=new XI;class eA extends v.MessageType{constructor(){super("socket.chat.LatestMessageAndUnreadCount",[{no:1,name:"message",kind:"message",T:()=>un},{no:2,name:"unread_count",kind:"scalar",T:4,L:2}])}}const tA=new eA;class sA extends v.MessageType{constructor(){super("socket.chat.ChatChannel",[{no:1,name:"chat_channel_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",T:9},{no:3,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:4,name:"visibility",kind:"scalar",T:9},{no:5,name:"is_direct_message",kind:"scalar",T:8},{no:6,name:"latest_message_and_unread_count",kind:"message",T:()=>tA},{no:7,name:"target_user_ids",kind:"scalar",repeat:2,T:9}])}}const rA=new sA;class iA extends v.MessageType{constructor(){super("socket.chat.GetChatChannelResponse",[{no:1,name:"chat_channels",kind:"message",repeat:1,T:()=>rA}])}}const Bs=new iA;class nA extends v.MessageType{constructor(){super("socket.chat.ChannelMember",[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",opt:!0,T:9},{no:3,name:"picture",kind:"scalar",opt:!0,T:9},{no:4,name:"custom_participant_id",kind:"scalar",T:9}])}}const aA=new nA;class oA extends v.MessageType{constructor(){super("socket.chat.GetChatChannelMembersResponse",[{no:1,name:"channel_members",kind:"message",repeat:1,T:()=>aA}])}}const cA=new oA;class dA extends v.MessageType{constructor(){super("socket.plugin.AddPluginRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"staggered",kind:"scalar",T:8}])}}const lA=new dA;class uA extends v.MessageType{constructor(){super("socket.plugin.RemovePluginRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"staggered",kind:"scalar",T:8}])}}const hA=new uA;class pA extends v.MessageType{constructor(){super("socket.plugin.EnablePluginForRoomRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9}])}}const gA=new pA;class mA extends v.MessageType{constructor(){super("socket.plugin.DisablePluginForRoomRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9}])}}const fA=new mA;class TA extends v.MessageType{constructor(){super("socket.plugin.EnablePluginForPeersRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"peer_ids",kind:"scalar",repeat:2,T:9}])}}const vA=new TA;class yA extends v.MessageType{constructor(){super("socket.plugin.DisablePluginForPeersRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"peer_ids",kind:"scalar",repeat:2,T:9}])}}const SA=new yA;class EA extends v.MessageType{constructor(){super("socket.plugin.PluginEventToRoomRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"plugin_data",kind:"scalar",T:12}])}}const PA=new EA;class _A extends v.MessageType{constructor(){super("socket.plugin.PluginEventToPeersRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"peer_ids",kind:"scalar",repeat:2,T:9},{no:3,name:"plugin_data",kind:"scalar",T:12}])}}const CA=new _A;class wA extends v.MessageType{constructor(){super("socket.plugin.StoreKeys",[{no:1,name:"store_key",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",opt:!0,T:12}])}}const Ch=new wA;class RA extends v.MessageType{constructor(){super("socket.plugin.PluginStoreInsertKeysRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"insert_keys",kind:"message",repeat:1,T:()=>Ch}])}}const Gp=new RA;class bA extends v.MessageType{constructor(){super("socket.plugin.PluginStoreGetKeysRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"get_keys",kind:"message",repeat:1,T:()=>Ch}])}}const kA=new bA;class IA extends v.MessageType{constructor(){super("socket.plugin.PluginStoreDeleteKeysRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"delete_keys",kind:"message",repeat:1,T:()=>Ch}])}}const AA=new IA;class MA extends v.MessageType{constructor(){super("socket.plugin.PluginStoreDeleteRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9}])}}const DA=new MA;class OA extends v.MessageType{constructor(){super("socket.plugin.EnablePluginResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"enabled_by",kind:"scalar",T:9}])}}const Cu=new OA;class NA extends v.MessageType{constructor(){super("socket.plugin.EnablePluginsResponse",[{no:1,name:"plugins",kind:"message",repeat:1,T:()=>Cu}])}}const VA=new NA;class LA extends v.MessageType{constructor(){super("socket.plugin.DisablePluginResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"disabled_by",kind:"scalar",T:9}])}}const Wp=new LA;class xA extends v.MessageType{constructor(){super("socket.plugin.PluginStoreItem",[{no:1,name:"timestamp",kind:"scalar",T:9},{no:2,name:"peer_id",kind:"scalar",T:9},{no:3,name:"store_key",kind:"scalar",T:9},{no:4,name:"payload",kind:"scalar",T:12}])}}const UA=new xA;class $A extends v.MessageType{constructor(){super("socket.plugin.PluginStoreResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"store_items",kind:"message",repeat:1,T:()=>UA}])}}const Jp=new $A;class FA extends v.MessageType{constructor(){super("socket.plugin.PluginEventResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"plugin_data",kind:"scalar",T:12}])}}const Kp=new FA;class BA extends v.MessageType{constructor(){super("socket.livestreaming.LiveStreamingEvent",[{no:1,name:"livestream_id",kind:"scalar",T:9},{no:2,name:"err_message",kind:"scalar",T:9},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"meeting_id",kind:"scalar",T:9},{no:5,name:"playback_url",kind:"scalar",T:9},{no:6,name:"org_id",kind:"scalar",T:9},{no:7,name:"room_name",kind:"scalar",T:9},{no:8,name:"room_uuid",kind:"scalar",T:9},{no:9,name:"status",kind:"scalar",T:9},{no:10,name:"manual_ingest",kind:"scalar",opt:!0,T:8}])}}const zp=new BA;class HA extends v.MessageType{constructor(){super("socket.livestreaming.GetStagePeersResponse",[{no:1,name:"stage_peers",kind:"scalar",repeat:2,T:9}])}}const Yp=new HA;class qA extends v.MessageType{constructor(){super("socket.livestreaming.StageRequest",[{no:1,name:"display_name",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"peer_id",kind:"scalar",T:9}])}}const jA=new qA;class GA extends v.MessageType{constructor(){super("socket.livestreaming.GetStageRequestsResponse",[{no:1,name:"stage_requests",kind:"message",repeat:1,T:()=>jA}])}}const iu=new GA;class WA extends v.MessageType{constructor(){super("socket.livestreaming.GrantStageAccessRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const JA=new WA;class KA extends v.MessageType{constructor(){super("socket.livestreaming.DenyStageAccessRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const zA=new KA;class YA extends v.MessageType{constructor(){super("socket.livestreaming.LeaveStageRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const Qp=new YA;class QA extends v.MessageType{constructor(){super("socket.polls.Poll",[{no:1,name:"poll_id",kind:"scalar",T:9},{no:2,name:"created_by",kind:"scalar",T:9},{no:3,name:"created_by_user_id",kind:"scalar",T:9},{no:4,name:"question",kind:"scalar",T:9},{no:5,name:"options",kind:"message",repeat:1,T:()=>ZA},{no:6,name:"hide_votes",kind:"scalar",T:8},{no:7,name:"anonymous",kind:"scalar",T:8},{no:8,name:"votes",kind:"scalar",repeat:2,T:9}])}}const gf=new QA;class XA extends v.MessageType{constructor(){super("socket.polls.PollOption",[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"count",kind:"scalar",opt:!0,T:4,L:2},{no:3,name:"votes",kind:"message",repeat:1,T:()=>tM}])}}const ZA=new XA;class eM extends v.MessageType{constructor(){super("socket.polls.PollVote",[{no:1,name:"user_id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9}])}}const tM=new eM;class sM extends v.MessageType{constructor(){super("socket.polls.NewPollRequest",[{no:1,name:"question",kind:"scalar",T:9},{no:2,name:"options",kind:"scalar",repeat:2,T:9},{no:3,name:"anonymous",kind:"scalar",T:8},{no:4,name:"hide_votes",kind:"scalar",T:8},{no:5,name:"created_by",kind:"scalar",opt:!0,T:9},{no:6,name:"created_by_user_id",kind:"scalar",opt:!0,T:9}])}}const rM=new sM;class iM extends v.MessageType{constructor(){super("socket.polls.VotePollRequest",[{no:1,name:"poll_id",kind:"scalar",T:9},{no:2,name:"index",kind:"scalar",T:4,L:2}])}}const nM=new iM;class aM extends v.MessageType{constructor(){super("socket.polls.UpdatePollResponse",[{no:1,name:"poll",kind:"message",T:()=>gf}])}}const nu=new aM;class oM extends v.MessageType{constructor(){super("socket.polls.GetPollsResponse",[{no:1,name:"polls",kind:"message",repeat:1,T:()=>gf}])}}const cM=new oM;class dM extends v.MessageType{constructor(){super("socket.recording.RecordingEvent",[{no:1,name:"recording_id",kind:"scalar",T:9},{no:2,name:"err_message",kind:"scalar",T:9},{no:3,name:"recording_type",kind:"enum",T:()=>["common.RecordingType",sn]}])}}const Xp=new dM;class lM extends v.MessageType{constructor(){super("google.protobuf.Timestamp",[{no:1,name:"seconds",kind:"scalar",T:3,L:0},{no:2,name:"nanos",kind:"scalar",T:5}])}now(){const t=this.create(),e=Date.now();return t.seconds=v.PbLong.from(Math.floor(e/1e3)).toBigInt(),t.nanos=e%1e3*1e6,t}toDate(t){return new Date(v.PbLong.from(t.seconds).toNumber()*1e3+Math.ceil(t.nanos/1e6))}fromDate(t){const e=this.create(),r=t.getTime();return e.seconds=v.PbLong.from(Math.floor(r/1e3)).toBigInt(),e.nanos=r%1e3*1e6,e}internalJsonWrite(t,e){let r=v.PbLong.from(t.seconds).toNumber()*1e3;if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");if(t.nanos<0)throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");let i="Z";if(t.nanos>0){let a=(t.nanos+1e9).toString().substring(1);a.substring(3)==="000000"?i="."+a.substring(0,3)+"Z":a.substring(6)==="000"?i="."+a.substring(0,6)+"Z":i="."+a+"Z"}return new Date(r).toISOString().replace(".000Z",i)}internalJsonRead(t,e,r){if(typeof t!="string")throw new Error("Unable to parse Timestamp from JSON "+v.typeofJsonValue(t)+".");let i=t.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!i)throw new Error("Unable to parse Timestamp from JSON. Invalid format.");let a=Date.parse(i[1]+"-"+i[2]+"-"+i[3]+"T"+i[4]+":"+i[5]+":"+i[6]+(i[8]?i[8]:"Z"));if(Number.isNaN(a))throw new Error("Unable to parse Timestamp from JSON. Invalid value.");if(a<Date.parse("0001-01-01T00:00:00Z")||a>Date.parse("9999-12-31T23:59:59Z"))throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");return r||(r=this.create()),r.seconds=v.PbLong.from(a/1e3).toBigInt(),r.nanos=0,i[7]&&(r.nanos=parseInt("1"+i[7]+"0".repeat(9-i[7].length))-1e9),r}}new lM;class uM extends v.MessageType{constructor(){super("common.BaseHubMessage",[{no:1,name:"event",kind:"scalar",T:5},{no:2,name:"id",kind:"scalar",T:9},{no:3,name:"peer_id",kind:"scalar",T:9},{no:4,name:"room_id",kind:"scalar",T:9},{no:5,name:"user_id",kind:"scalar",T:9},{no:6,name:"payload",kind:"scalar",T:12},{no:7,name:"error",kind:"scalar",opt:!0,T:8},{no:8,name:"sid",kind:"scalar",opt:!0,T:9},{no:9,name:"room_object_id",kind:"scalar",opt:!0,T:9},{no:10,name:"preset",kind:"scalar",opt:!0,T:9},{no:11,name:"use_start_session",kind:"scalar",opt:!0,T:8}])}}const wu=new uM;class hM extends v.MessageType{constructor(){super("common.BulkedHubMessage",[{no:1,name:"messages",kind:"message",repeat:1,T:()=>wu}])}}new hM;class pM extends v.MessageType{constructor(){super("common.CFWorkersResponse",[{no:1,name:"responses",kind:"message",repeat:1,T:()=>wu},{no:2,name:"broadcast_responses",kind:"message",repeat:1,T:()=>wu}])}}new pM;const gM=0,mM=1,fM=2,TM=3,vM=4,yM=5,SM={getPeerInfo:0,updatePeerInfo:1,getRoomPeersInfo:2,joinRoom:3,leaveRoom:4,getRoomInfo:5,updateRoomInfo:6,closeRoom:7,startedLivestream:8,stoppedLivestream:9,erroredLivestream:10,getStagePeers:11,getStageRequests:12,requestStageAccess:13,cancelStageRequest:14,grantStageAccess:15,denyStageAccess:16,roomPeerCount:17,joinStage:18,leaveStage:19,getConnectedRoomsDump:20,createConnectedRooms:21,deleteConnectedRooms:22,movePeers:23,transferPeer:24,movedPeer:25,connectedRoomsUpdated:26,connectedRoomsDeleted:27,getAllAddedParticipants:28,broadcastMessage:29,kick:30,kickAll:31,transcript:32,getWaitingRoomRequests:33,acceptWaitingRoomRequests:34,waitingRoomRequestAccepted:35,denyWaitingRoomRequests:36,waitingRoomRequestDenied:37,peerStageStatusUpdate:38,broadcastToEntity:39,recordingStarted:40,recordingStopped:41,recordingPaused:42,getRoomStageState:43,livestreamingInvoked:44},EM={getMessages:0,sendMessageToRoom:1,sendMessageToPeers:2,editMessage:3,deleteMessage:4,getPaginatedMessages:5,sendMessageToChannel:6,searchChannelMessages:7,getAllChatChannels:8,markChannelIndexAsRead:9,pinMessage:10},PM={getPlugins:0,addPlugin:1,enablePluginForRoom:2,disablePluginForPeers:3,enablePluginForPeers:4,disablePluginForRoom:5,removePlugin:6,customPluginEventToRoom:7,customPluginEventToPeers:8,storeInsertKeys:9,storeGetKeys:10,storeDeleteKeys:11,storeDelete:12},_M={createPoll:0,getPolls:1,votePoll:2,updatePoll:3},mf={unknown:0,createWebRTCTransport:1,produce:2,consume:3,toggleProducer:4,toggleConsumer:5,closeProducer:6,closeConsumer:7,updateConsumersSimulcastConfig:8,joinRoom:16,leaveRoom:17,selectedPeer:18,globalPinPeer:19,selfJoinComplete:20,peerJoinedBroadcast:25,peerLeaveBroadcast:26,peerProducerCreateBroadcast:27,peerProducerToggleBroadcast:28,peerProducerCloseBroadcast:29,globalPeerPinBroadcast:30,recordingStartedBroadcast:31,recordingStoppedBroadcast:32,peerDisplayNameEditBroadcast:33,mediaRoomTerminationBroadcastResponse:36,selectedPeerDiff:40,renegotiateSessionDescription:50,errorResponse:60,kickPeer:90,kickAll:91,changeDisplayName:92,hostControlPeer:93,hostControlAllPeers:94,audioActivity:100},CM={createChatChannel:0,getChatChannel:1,deprecatedGetAllChatChannels:2,getChannelMembers:3,updateChatChannel:4},wM={getUserPresets:0,updateUserPreset:1};function xa(s,t){return Object.keys(t).reduce((e,r)=>(e[r]=(s<<16)+t[r],e),{})}function ff(s,t){return Object.keys(s).reduce((e,r)=>(e[r]=t|s[r],e),{})}const x=xa(gM,SM),_e=xa(mM,EM),q=xa(fM,PM),qs=xa(TM,_M),di=xa(vM,CM),kr=ff(mf,16777216),Es=ff(mf,50331648),id=xa(yM,wM);var RM=Object.defineProperty,bM=Object.getOwnPropertyDescriptor,wh=(s,t,e,r)=>{for(var i=r>1?void 0:r?bM(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&RM(t,e,i),i},Ir,Vn,fg;const Ru=(fg=class{constructor(s,t){g(this,Ir,void 0);g(this,Vn,void 0);m(this,Ir,t),m(this,Vn,s)}get telemetry(){return n(this,Vn).getValue("telemetry")}get logger(){return n(this,Vn).getValue("logger")}async createChannel(s,t,e,r="public",i=!1){const a={displayName:s,targetUserIds:t,displayPictureUrl:e,visibility:r,isDirectMessage:i};i&&(a.visibility="private");const o=await n(this,Ir).sendMessagePromise(di.createChatChannel,KI.toBinary(a)),c=Bs.fromBinary(o.payload).chatChannels;return Ru.formatChannel(c[0])}async updateChannel(s,t){const e=await n(this,Ir).sendMessagePromise(di.updateChatChannel,YI.toBinary({chatChannelId:s,targetUserIds:t.memberIds,displayName:t.displayName,displayPictureUrl:t.displayPictureUrl,visibility:t.visibility})),r=Bs.fromBinary(e.payload).chatChannels;return Ru.formatChannel(r[0])}static formatChannel(s){var r;const{latestMessageAndUnreadCount:t}=s,e={...s,id:s.chatChannelId,memberIds:s.targetUserIds,unreadCount:(r=t==null?void 0:t.unreadCount)!=null?r:0};return t!=null&&t.message&&(e.latestMessage=Ps.formatSocketPeerMessage(t.message)),delete e.chatChannelId,delete e.targetUserIds,delete e.latestMessageAndUnreadCount,e}async getChannelMembers(s){try{const t=await n(this,Ir).sendMessagePromise(di.getChannelMembers,ZI.toBinary({chatChannelId:s}));return cA.fromBinary(t.payload).channelMembers.map(({id:e,...r})=>({...r,userId:e}))}catch(t){return[]}}on(s,t){let e,r;switch(s){case di.createChatChannel:{e=Bs.fromBinary.bind(Bs),r=Bs.create();break}case di.updateChatChannel:{e=Bs.fromBinary.bind(Bs),r=Bs.create();break}}if(!e){this.logger.warn(`ChatChannelSocketHandler::Event ${s} is not recognized`);return}n(this,Ir).on(s,({payload:i})=>{let a=r;try{a=e(i)}catch(o){this.logger.error("ChatChannelSocketHandler::on::binary_decode_error",{error:o})}return t(a)})}},Ir=new WeakMap,Vn=new WeakMap,fg);let an=Ru;wh([S.trace("ChatChannelHandler.createChannel")],an.prototype,"createChannel",1);wh([S.trace("ChatChannelHandler.updateChannel")],an.prototype,"updateChannel",1);wh([S.trace("ChatChannelHandler.getChannelMembers")],an.prototype,"getChannelMembers",1);var kM=Object.defineProperty,IM=Object.getOwnPropertyDescriptor,bs=(s,t,e,r)=>{for(var i=r>1?void 0:r?IM(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&kM(t,e,i),i},vt=(s=>(s[s.TEXT=0]="TEXT",s[s.IMAGE=1]="IMAGE",s[s.FILE=2]="FILE",s[s.CUSTOM=3]="CUSTOM",s))(vt||{}),et,Ln;class is{constructor(t,e){g(this,et,void 0);g(this,Ln,void 0);m(this,et,e),m(this,Ln,t)}get telemetry(){return n(this,Ln).getValue("telemetry")}get logger(){return n(this,Ln).getValue("logger")}getChatMessages(){return n(this,et).sendMessagePromise(_e.getMessages)}async getChatMessagesPaginated(t,e,r,i=0,a=""){const o={timeStamp:t,size:e,from:i,reversed:r,channelId:a},c=await n(this,et).sendMessagePromise(_e.getPaginatedMessages,yI.toBinary(o));return c.payload?EI.fromBinary(c.payload):{messages:[],next:!1}}sendMessageToRoom(t,e){const r={payloadType:e,payload:t};n(this,et).sendMessage(_e.sendMessageToRoom,CI.toBinary(r))}sendMessageToPeers(t,e,r){const i={payloadType:e,peerIds:r,payload:t};n(this,et).sendMessage(_e.sendMessageToPeers,bI.toBinary(i))}sendMessageToChannel(t,e,r){const i={payloadType:e,channelId:r,payload:t};n(this,et).sendMessage(_e.sendMessageToChannel,AI.toBinary(i))}sendMessage(t,e,r,i){if(i&&this.sendMessageToChannel(t,e,i),r&&r.length>0){this.sendMessageToPeers(t,e,r);return}this.sendMessageToRoom(t,e)}async editMessage(t,e,r,i,a){const o={chatId:t,payloadType:r,payload:e};i&&(o.channelId=i),a!==void 0&&(o.pinned=a);const c=await n(this,et).sendMessagePromise(_e.editMessage,OI.toBinary(o));return Kc.fromBinary(c.payload).message}async deleteMessage(t,e){const r={chatId:t};e&&(r.channelId=e);const i=await n(this,et).sendMessagePromise(_e.deleteMessage,$I.toBinary(r)),a=zc.fromBinary(i.payload);return{id:a.chatId,...a.channelId?{channelId:a.channelId}:{}}}async searchMessages(t,e){var i,a,o;const r={searchTerm:t,timeStamp:(i=e.timestamp)!=null?i:Date.now(),size:(a=e.size)!=null?a:75,from:0,reversed:(o=e.reversed)!=null?o:!0};e.channelId&&(r.channelId=e.channelId);try{const c=await n(this,et).sendMessagePromise(_e.searchChannelMessages,HI.toBinary(r));return pf.fromBinary(c.payload).messages}catch(c){return[]}}async getAllChannels(){try{const t=await n(this,et).sendMessagePromise(_e.getAllChatChannels);return Bs.fromBinary(t.payload).chatChannels.map(an.formatChannel)}catch(t){return[]}}async markLastReadMessage(t,e){const r=await n(this,et).sendMessagePromise(_e.markChannelIndexAsRead,jI.toBinary({channelId:t,userId:e.userId,channelIndex:e.channelIndex}));return WI.fromBinary(r.payload).channelIndex}async setPinState(t,e){const r={chatId:t.id,pinned:e,channelId:t.channelId},i=await n(this,et).sendMessagePromise(_e.pinMessage,VI.toBinary(r));return Jc.fromBinary(i.payload)}on(t,e){let r,i;switch(t){case _e.sendMessageToRoom:{r=su.fromBinary.bind(su),i=su.create();break}case _e.sendMessageToPeers:{r=ru.fromBinary.bind(ru),i=ru.create();break}case _e.editMessage:{r=Kc.fromBinary.bind(Kc),i=Kc.create();break}case _e.pinMessage:{r=Jc.fromBinary.bind(Jc),i=Jc.create();break}case _e.deleteMessage:{r=zc.fromBinary.bind(zc),i=zc.create();break}}if(!r){this.logger.warn(`ChatSocketHandler::Event ${t} is not recognized`);return}n(this,et).on(t,({payload:a})=>{let o=i;try{o=r(a)}catch(c){this.logger.error("chatSocketHandler::on::binary_decode_error",{error:c})}return e(o)})}}et=new WeakMap,Ln=new WeakMap;bs([S.trace("SocketService.getChatMessages")],is.prototype,"getChatMessages",1);bs([S.trace("SocketService.getChatMessagesPaginated")],is.prototype,"getChatMessagesPaginated",1);bs([S.trace("SocketService.sendMessageToRoom")],is.prototype,"sendMessageToRoom",1);bs([S.trace("SocketService.sendMessageToPeers")],is.prototype,"sendMessageToPeers",1);bs([S.trace("SocketService.sendMessageToChannel")],is.prototype,"sendMessageToChannel",1);bs([S.trace("SocketService.sendMessage")],is.prototype,"sendMessage",1);bs([S.trace("SocketService.editMessage")],is.prototype,"editMessage",1);bs([S.trace("SocketService.deleteMessage")],is.prototype,"deleteMessage",1);bs([S.trace("SocketService.searchMessages")],is.prototype,"searchMessages",1);bs([S.trace("SocketService.getAllChannels")],is.prototype,"getAllChannels",1);bs([S.trace("SocketService.markLastReadMessage")],is.prototype,"markLastReadMessage",1);function AM(s){return s.replace(/([-_]\w)/g,t=>t[1].toUpperCase())}function _s(s){if(!s||typeof s!="object")return s;if(Array.isArray(s))return s.map(e=>_s(e));const t={};return Object.keys(s).forEach(e=>{const r=gr.validate(e)?e:AM(e);t[r]=_s(s[e])}),t}function MM(s){return s.replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`)}function Tf(s){if(!s||typeof s!="object")return s;if(Array.isArray(s))return s.map(e=>Tf(e));const t={};return Object.keys(s).forEach(e=>{const r=gr.validate(e)?e:MM(e);t[r]=s[e]}),t}function Ed(s,t={}){return s==null?{}:(Object.getOwnPropertyNames(s).forEach(e=>{if(typeof s[e]!="function"){if(typeof s[e]=="object"){Ed(s[e],t[e]={});return}t[e]=s[e]}}),t)}class Zp{constructor(t){u(this,"defaults");this.defaults={baseURL:t.baseURL,headers:{common:{}},timeout:t.timeout,retry:t.retry,retryDelay:t.retryDelay}}buildURL(t,e){const{baseURL:r}=this.defaults,i=t.startsWith("http")?t:`${r}${t.startsWith("/")?t:`/${t}`}`;if(e){const a=new URLSearchParams;return Object.entries(e).forEach(([o,c])=>{a.append(o,c)}),`${i}${i.includes("?")?"&":"?"}${a.toString()}`}return i}async request(t){var p;const e=((p=t.method)==null?void 0:p.toUpperCase())||"GET",r=this.buildURL(t.url||"",t.params),i={...this.defaults.headers.common,...t.headers};e!=="GET"&&e!=="HEAD"&&t.data&&!i["Content-Type"]&&(i["Content-Type"]="application/json");const o=i["Content-Type"]==="application/json"?JSON.stringify(t.data):t.data,c={method:e,headers:i,body:e!=="GET"&&e!=="HEAD"&&t.data?o:void 0},d=t.timeout||this.defaults.timeout,l=t.retry!==void 0?t.retry:this.defaults.retry,h=t.retryDelay||this.defaults.retryDelay;try{const f=new AbortController,T=setTimeout(()=>f.abort(),d);c.signal=f.signal;const E=await fetch(r,c);clearTimeout(T);let P=null;const C=E.headers.get("content-type");C&&C.includes("application/json")?P=await E.json():P=await E.text();const _={};E.headers.forEach((U,D)=>{_[D]=U});const N={data:P,status:E.status,statusText:E.statusText,headers:_,config:t};if(!E.ok)throw N;return N}catch(f){if(f instanceof Error&&l>0)return await new Promise(T=>setTimeout(T,h)),this.defaults.baseURL===hi.apiBase.prod?this.defaults.baseURL=hi.apiBase.prodAlternate:this.defaults.baseURL===hi.apiBase.prodAlternate&&(this.defaults.baseURL=hi.apiBase.prod),this.request({...t,retry:l-1});throw f}}async get(t,e={}){return this.request({...e,method:"GET",url:t})}async post(t,e,r={}){return this.request({...r,method:"POST",url:t,data:e})}async put(t,e,r={}){return this.request({...r,method:"PUT",url:t,data:e})}}const DM=3,OM=30,NM=8e3;class VM{constructor(t,e){u(this,"ipInfo");u(this,"fetchClient");u(this,"requests");u(this,"roomName");u(this,"roomUUID");u(this,"authToken");u(this,"organizationId");u(this,"iceServers");u(this,"pluginInformation");u(this,"userDetails");u(this,"roomDetails");u(this,"context");this.context=t;const{timeout:r=NM,retry:i=DM,retryDelay:a=OM,baseURL:o=hi.apiBase.prod,authToken:c,cachedUserDetails:d}=e||{};this.iceServers=d==null?void 0:d.iceServers,this.pluginInformation=d==null?void 0:d.pluginInformation,this.userDetails=d==null?void 0:d.userDetails,this.roomDetails=d==null?void 0:d.roomDetails,this.requests=new Zp({baseURL:o,timeout:r,retry:i,retryDelay:a,responseType:"json"}),this.fetchClient=new Zp({baseURL:"",timeout:r,retry:i,retryDelay:a,responseType:"json"}),this.setAuthToken(c,{bearer:!0});const l=this.requests.request.bind(this.requests);this.requests.request=async h=>{var f,T,E,P,C;const p=t.getValue("telemetry");try{p.injectContext(this.requests.defaults.headers.common);const _=await l(h);return h.url!==p.logsEndpoint&&this.logger.debug("xhr::fetch",{networkCall:{status:_.status,statusText:_.statusText,baseURL:h.baseURL||this.requests.defaults.baseURL,url:h.url,method:h.method}}),_}catch(_){throw _?(((f=_.config)==null?void 0:f.url)!==p.logsEndpoint&&this.logger.error("xhr::fetch",{error:_,networkCall:{status:_.status,statusText:_.statusText,baseURL:((T=_.config)==null?void 0:T.baseURL)||this.requests.defaults.baseURL,url:(E=_.config)==null?void 0:E.url,retries:(P=_.config)==null?void 0:P.retry,method:(C=_.config)==null?void 0:C.method,isOnline:navigator.onLine?"online":"offline"}}),new R(_.message||"Network request failed","0011")):new R("Unknown network error occurred","0011")}}}get peerId(){return this.context.getValue("peerId")}get logger(){return this.context.getValue("logger")}setAuthToken(t,e){const{bearer:r}=e||{};this.authToken=t,this.requests.defaults.headers.common.Authorization=r?`Bearer ${t}`:t}setHeader(t,e){this.requests.defaults.headers.common[t]=e}setRoomName(t){this.roomName=t}setRoomUUID(t){this.roomUUID=t}setOrganizationId(t){this.organizationId=t}}var LM=Object.defineProperty,xM=Object.getOwnPropertyDescriptor,ns=(s,t,e,r)=>{for(var i=r>1?void 0:r?xM(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&LM(t,e,i),i};class Bt extends VM{constructor(e,r){super(e,r);u(this,"telemetry");this.telemetry=e.getValue("telemetry"),this.setHeader("x-realtimekit-version",e.getValue("sdkVersion"))}async getIPDetails(){var r;const{peerId:e}=this;try{const i=await ah.getIPDetails({peerId:e,apiHostnames:Xm(this.context),logger:jm});if(this.logger.log("ipInfo",{ipInfo:i}),((r=i==null?void 0:i.loc)==null?void 0:r.length)>5)return i;throw Error("Insufficient data")}catch(i){this.logger.warn("APIClient.getIPDetails Failed to get ip details",{error:{name:i.name,message:i.message}});return}}async getICEServers(){if(this.iceServers)return this.iceServers;const{success:e,iceServers:r}=(await this.requests.get("/iceservers")).data;if(e)return(r==null?void 0:r.length)>0&&(this.iceServers=r),r}async getPlugins(){var a,o,c,d,l,h,p;if(this.pluginInformation)return this.pluginInformation;const{plugins:e}=(await this.requests.get("/v2/plugins/user")).data.data,r=((o=(a=this.context.getValue("flagsmith").getValue(Q.V1_PLUGINS))==null?void 0:a.toString())==null?void 0:o.split(","))||[],i=e.reduce((f,T)=>(f[r.includes(T.id)?"v1":"v2"].push({...T,name:T.name.replace("v2","")}),f),{v1:[],v2:[]});return(l=(d=(c=this.context.getValue("modules"))==null?void 0:c.devTools)==null?void 0:d.plugins)!=null&&l.length&&((p=(h=this.context.getValue("modules"))==null?void 0:h.devTools)==null||p.plugins.forEach(f=>{var E,P,C;const T={...so,tags:[...so.tags],baseUrl:`http://localhost:${f.port}`,name:f.name,picture:(E=f.picture)!=null?E:so.picture,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString(),id:f.id,organizationId:this.organizationId,description:(P=f.description)!=null?P:so.description,staggered:(C=f.staggered)!=null?C:so.staggered};i.v2.push(T)})),i.v2}async getPluginDetails(e){const{plugin:r}=(await this.requests.get(`/v2/plugins/view/${e}`)).data.data;return r}async getPluginConfig(e){return(await this.fetchClient.get(`${e}/dyte-config.json`)).data}async authorizePlugin(e){const r={peerId:this.peerId},{token:i}=(await this.requests.post(`/v2/plugins/authorize/${e}`,r)).data.data;return i}async getPresignedUrls(e,r){const i=Na(this.context,"chat_upload_expiry"),a={roomUUID:this.roomUUID,filename:e,expiry:typeof i=="number"?i:void 0};this.context.getValue("flagsmith").hasFeature(Q.FEAT_CHAT_SDK)&&(a.viewType=r);const{getLocation:o,putLocation:c}=(await this.requests.post("/v1/meetings/genPreSignedUploadUrl",a)).data.data;return{getLocation:o,putLocation:c}}async uploadFile(e,r){if(navigator.isReactNative&&"uri"in e)try{await fetch(r,{method:"PUT",headers:{"Content-Type":"application/octet-stream"},body:{uri:e.uri,name:e.name}})}catch(i){this.logger.error(`sendFileMessage::${i}`)}else await this.fetchClient.put(r,e,{headers:{"Content-Type":e.type}})}async startLivestreaming({manualIngestion:e}){const r=_s(await this.requests.post(`/v2/meetings/${this.context.getValue("meetingId")}/livestreams`,{manual_ingest:!!e})).data.data;return{playbackUrl:r.playbackUrl,status:r.status,manualIngest:r.manualIngest,ingestionCredentials:r.streamKey?{ingestionServer:r.ingestServer,streamKey:r.streamKey}:null}}async stopLivestreaming(){return this.requests.post(`/v2/meetings/${this.context.getValue("meetingId")}/active-livestream/stop`)}async getActiveLivestream(){const e=_s((await this.requests.get(`/v2/meetings/${this.context.getValue("meetingId")}/active-livestream`)).data.data);return{playbackUrl:e.playbackUrl,status:e.status,manualIngest:e.manualIngest,ingestionCredentials:e.streamKey?{ingestionServer:e.ingestServer,streamKey:e.streamKey}:null}}async getUserDetails(){if(this.userDetails)return this.userDetails;const e=(await this.requests.get("v2/internals/participant-details")).data.data;return _s(e)}async startRecording(e,r){return(await this.requests.post("/v2/recordings",{...Tf(e),meeting_id:this.context.getValue("meetingId"),allow_multiple_recordings:!!r})).data.data.id}async updateRecording(e,r){return this.requests.put(`v2/recordings/${e}`,{action:r})}async getActiveRecording(){const{status:e,id:r}=(await this.requests.get(`v2/recordings/active-recording/${this.context.getValue("meetingId")}`)).data.data;return{status:e,id:r}}async getActiveTranscript(){const{transcript_download_url:e}=(await this.requests.get(`v2/meetings/${this.context.getValue("meetingId")}/active-transcript`)).data.data;try{return{transcript:(await this.fetchClient.get(e)).data}}catch(r){throw new R("Cant fetch transcript s3 url","1801")}}async getRoomNodeData(){const e=await this.getIPDetails();if(this.ipInfo=e,this.roomDetails)return this.roomDetails;const{title:r}=_s((await this.requests.post("v2/internals/rooms",{ip_information:e})).data.data);return{meetingTitle:r}}}ns([S.trace("APIClient.getIPDetails")],Bt.prototype,"getIPDetails",1);ns([S.trace("APIClient.getICEServers")],Bt.prototype,"getICEServers",1);ns([S.trace("APIClient.getPlugins")],Bt.prototype,"getPlugins",1);ns([S.trace("APIClient.startLivestreaming")],Bt.prototype,"startLivestreaming",1);ns([S.trace("APIClient.stopLivestreaming")],Bt.prototype,"stopLivestreaming",1);ns([S.trace("APIClient.getActiveLivestream")],Bt.prototype,"getActiveLivestream",1);ns([S.trace("APIClient.getUserDetails")],Bt.prototype,"getUserDetails",1);ns([S.trace("APIClient.startRecording")],Bt.prototype,"startRecording",1);ns([S.trace("APIClient.stopRecording")],Bt.prototype,"updateRecording",1);ns([S.trace("APIClient.getActiveRecording")],Bt.prototype,"getActiveRecording",1);ns([S.trace("APIClient.getActiveTranscript")],Bt.prototype,"getActiveTranscript",1);ns([S.trace("APIClient.getRoomNodeData")],Bt.prototype,"getRoomNodeData",1);let bu;function UM(s,t){return bu=new Bt(s,t),bu}function at(){return bu}function $M(s,t){return`<blockquote>${t.replace(/<blockquote>[.\s\S]*<\/blockquote>\n\n/m,"")}</blockquote>
6
6
 
7
7
  ${s}`}const Ua={maxInvocations:5,period:1};function kt(s,t){return function(e,r,i){const a=i.value;let o=0,c=Date.now();return i.value=function(...d){const l=Date.now(),h=t?this[t]:s;if(l-c>h.period*1e3&&(c=l,o=0),o>=h.maxInvocations)throw new R(`Method rate limit ${h.maxInvocations} invocations/${h.period}sec exceeded`,"0013");return o+=1,a.apply(this,d)},i}}var FM=Object.defineProperty,BM=Object.getOwnPropertyDescriptor,dt=(s,t,e,r)=>{for(var i=r>1?void 0:r?BM(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&FM(t,e,i),i};const HM=["text","image","file","custom","poll"],nd={maxInvocations:180,period:60};var Y,gi,Le,mi,fi,Md,vf,Io,ku,Tg;let We=(Tg=class extends Ft{constructor(t,e,r,i,a){const o=t.getValue("logger");super(o);g(this,Md);g(this,Io);u(this,"messages");u(this,"channels",[]);g(this,Y,void 0);g(this,gi,void 0);g(this,Le,void 0);g(this,mi,void 0);g(this,fi,void 0);u(this,"maxTextLimit",2e3);m(this,fi,t),m(this,Le,e),m(this,mi,r),m(this,Y,i),m(this,gi,a),this.messages=[]}get telemetry(){return n(this,fi).getValue("telemetry")}setMaxTextLimit(t){this.maxTextLimit=t}async sendMessageInternal(t,e,r,i={}){switch(t.type){case"text":{const a=i.replyTo&&i.replyTo.type==="text"?$M(t.message,i.replyTo.message):t.message;await this.sendTextMessageInternal(a,e,r);break}case"image":await this.sendImageMessageInternal(t.image,e,r);break;case"file":await this.sendFileMessageInternal(t.file,e,r);break;default:this.logger.error("sendMessage::message_type_not_supported",{chat:{messageType:t.type}});break}}async sendTextMessageInternal(t,e,r){var a,o,c,d,l,h;if(t.length>this.maxTextLimit)throw new R("Max character limit breached","0503");if(e&&e.length>0){if(!((a=n(this,Y).permissions)!=null&&a.chatPrivate.canSend)||!((o=n(this,Y).permissions)!=null&&o.chatPrivate.text))throw this.logger.error("sendTextMessage::private_chat_permission_denied"),new R("Could not send message to private chat.","0501")}else if(!((d=(c=n(this,Y).permissions)==null?void 0:c.chatPublic)!=null&&d.canSend)||!((h=(l=n(this,Y).permissions)==null?void 0:l.chatPublic)!=null&&h.text))throw this.logger.error("sendTextMessage::public_chat_permission_denied"),new R("Could not send message to public chat.","0501");if(!t)throw this.logger.error("sendTextMessage::message_can_not_be_empty"),new R("Message can not be empty.","0502");if(r){n(this,Le).sendMessageToChannel(t,vt.TEXT,r);return}let i=[];e&&e.length>0&&(e.push(n(this,Y).id),i=n(this,gi).joined.toArray().filter(p=>e.includes(p.id)).map(p=>p.userId),i.push(n(this,Y).userId)),n(this,Le).sendMessage(t,vt.TEXT,e)}async sendImageMessageInternal(t,e,r){var a,o,c,d,l,h;if(e&&e.length>0){if(!((a=n(this,Y).permissions)!=null&&a.chatPrivate.canSend)||!((o=n(this,Y).permissions)!=null&&o.chatPrivate.files)){this.logger.error("sendImageMessage::private_chat_permission_denied");return}}else if(!((d=(c=n(this,Y).permissions)==null?void 0:c.chatPublic)!=null&&d.canSend)||!((h=(l=n(this,Y).permissions)==null?void 0:l.chatPublic)!=null&&h.files)){this.logger.error("sendImageMessage::permission_denied");return}if(!t){this.logger.error("sendImageMessage::required_argument_image_can_not_be_empty");return}if(!["image/gif","image/jpeg","image/png"].includes(t.type)){this.logger.error("sendImageMessage::image_type_not_supported",{chat:{imageType:t.type}});return}try{const p=at(),{getLocation:f,putLocation:T}=await p.getPresignedUrls(t.name,n(this,Y).config.viewType);if(await p.uploadFile(t,T),r){n(this,Le).sendMessageToChannel(f,vt.IMAGE,r);return}let E=[];e&&e.length>0&&(e.push(n(this,Y).id),E=n(this,gi).joined.toArray().filter(P=>e.includes(P.id)).map(P=>P.userId),E.push(n(this,Y).userId)),n(this,Le).sendMessage(f,vt.IMAGE,e)}catch(p){throw new R("Error sending image message.","0500",this.logger)}}async sendFileMessageInternal(t,e,r){var i,a,o,c,d,l;if(e&&e.length>0){if(!((i=n(this,Y).permissions)!=null&&i.chatPrivate.canSend)||!((a=n(this,Y).permissions)!=null&&a.chatPrivate.files)){this.logger.error("sendFileMessage::private_chat_permission_denied");return}}else if(!((c=(o=n(this,Y).permissions)==null?void 0:o.chatPublic)!=null&&c.canSend)||!((l=(d=n(this,Y).permissions)==null?void 0:d.chatPublic)!=null&&l.files)){this.logger.error("sendFileMessage::permission_denied");return}if(!t){this.logger.error("sendFileMessage::required_argument_file_can_not_be_empty");return}try{const h=at(),{getLocation:p,putLocation:f}=await h.getPresignedUrls(t.name,n(this,Y).config.viewType);if(await h.uploadFile(t,f),r){n(this,Le).sendMessageToChannel(JSON.stringify({link:p,name:t.name,size:"size"in t?t.size:0}),vt.FILE,r);return}let T=[];e&&e.length>0&&(e.push(n(this,Y).id),T=n(this,gi).joined.toArray().filter(P=>e.includes(P.id)).map(P=>P.userId),T.push(n(this,Y).userId));const E=JSON.stringify({link:p,name:t.name,size:"size"in t?t.size:0});n(this,Le).sendMessage(E,vt.FILE,e)}catch(h){throw new R("Error sending file message.","0500",this.logger)}}get rateLimits(){return nd}updateRateLimits(t,e){nd.maxInvocations=t,nd.period=e}async sendTextMessage(t,e){return this.sendTextMessageInternal(t,e)}async sendCustomMessage(t,e){var a,o,c,d,l,h,p,f,T,E,P,C,_,N,U;if(e&&e.length>0){if(!((a=n(this,Y).permissions)!=null&&a.chatPrivate.canSend)||!((o=n(this,Y).permissions)!=null&&o.chatPrivate.files)||!((c=n(this,Y).permissions)!=null&&c.chatPrivate.text)){this.logger.error("sendCustomMessage::private_chat_permission_denied");return}}else if(!((l=(d=n(this,Y).permissions)==null?void 0:d.chatPublic)!=null&&l.canSend)||!((p=(h=n(this,Y).permissions)==null?void 0:h.chatPublic)!=null&&p.files)||!((T=(f=n(this,Y).permissions)==null?void 0:f.chatPublic)!=null&&T.text)){this.logger.error("sendCustomMessage::permission_denied");return}const r=async D=>{try{if(typeof D=="string")return{link:D};const $=at(),{getLocation:G,putLocation:ee}=await $.getPresignedUrls(D.name,n(this,Y).config.viewType);return await $.uploadFile(D,ee),{link:G,type:D.type,name:D.name,size:D.size}}catch($){throw new R("Error sending image message.","0500",this.logger)}},i={...t,files:await Promise.all((P=(E=t.files)!=null?E:[])==null?void 0:P.map(async D=>r(D))),images:await Promise.all((_=(C=t.images)!=null?C:[])==null?void 0:_.map(async D=>r(D))),videos:await Promise.all((U=(N=t.videos)!=null?N:[])==null?void 0:U.map(async D=>r(D)))};n(this,Le).sendMessage(JSON.stringify(i),vt.CUSTOM,e)}async sendImageMessage(t,e){return this.sendImageMessageInternal(t,e)}async sendFileMessage(t,e){return this.sendFileMessageInternal(t,e)}async sendMessage(t,e){return this.sendMessageInternal(t,e)}async editTextMessage(t,e,r){var i,a,o,c,d,l;if(((a=(i=n(this,Y).permissions)==null?void 0:i.chatMessage)==null?void 0:a.canEdit)==="NONE")throw new R("Not permitted to edit messages","0501");if(!((c=(o=n(this,Y).permissions)==null?void 0:o.chatPublic)!=null&&c.canSend)||!((l=(d=n(this,Y).permissions)==null?void 0:d.chatPublic)!=null&&l.text)){this.logger.error("editTextMessage::permission_denied");return}if(!e){this.logger.error("editTextMessage::message_can_not_be_empty");return}n(this,Le).editMessage(t,e,vt.TEXT,r)}async editImageMessage(t,e,r){var a,o,c,d;if(!((o=(a=n(this,Y).permissions)==null?void 0:a.chatPublic)!=null&&o.canSend)||!((d=(c=n(this,Y).permissions)==null?void 0:c.chatPublic)!=null&&d.files)){this.logger.error("editImageMessage::permission_denied");return}if(!e){this.logger.error("editImageMessage::required_argument_image_can_not_be_empty");return}if(!["image/gif","image/jpeg","image/png"].includes(e.type)){this.logger.error("sendImageMessage::image_type_not_supported",{chat:{imageType:e.type}});return}try{const l=at(),{getLocation:h,putLocation:p}=await l.getPresignedUrls(e.name,n(this,Y).config.viewType);await l.uploadFile(e,p),n(this,Le).editMessage(t,h,vt.IMAGE,r)}catch(l){throw new R("Error editing image message.","0500",this.logger)}}async editFileMessage(t,e,r){var i,a,o,c;if(!((a=(i=n(this,Y).permissions)==null?void 0:i.chatPublic)!=null&&a.canSend)||!((c=(o=n(this,Y).permissions)==null?void 0:o.chatPublic)!=null&&c.files)){this.logger.error("sendFileMessage::permission_denied");return}if(!e){this.logger.error("sendFileMessage::required_argument_file_can_not_be_empty");return}try{const d=at(),{getLocation:l,putLocation:h}=await d.getPresignedUrls(e.name,n(this,Y).config.viewType);await d.uploadFile(e,h),n(this,Le).editMessage(t,JSON.stringify({link:l,name:e.name,size:"size"in e?e.size:0}),vt.FILE,r)}catch(d){throw new R("Error editing file message.","0500",this.logger)}}async editMessage(t,e,r){switch(e.type){case"text":{this.editTextMessage(t,e.message,r);break}case"image":{this.editImageMessage(t,e.image,r);break}case"file":{this.editFileMessage(t,e.file,r);break}default:{this.logger.error("editMessage::message_type_not_supported",{chat:{messageType:e.type}});break}}}async deleteMessage(t,e){var r,i;if(((i=(r=n(this,Y).permissions)==null?void 0:r.chatMessage)==null?void 0:i.canDelete)==="NONE")throw new R("Not permitted to delete messages","0501");n(this,Le).deleteMessage(t,e)}getMessagesByUser(t){return this.messages.filter(e=>e.userId===t)}getMessagesByType(t){return this.messages.filter(e=>e.type===t)}async pin(t){if(!n(this,Io,ku))throw new R("Can`t pin message without joining room","0505");if(!n(this,Y).permissions.pinParticipant)throw new R("You do not have permission to pin messages.","0501");const e=this.messages.find(r=>r.id===t);if(e){n(this,Le).setPinState(e,!0);return}throw new R(`No message found with id: ${t}`,"0504")}async unpin(t){if(!n(this,Io,ku))throw new R("Can`t unpin message without joining room","0505");if(!n(this,Y).permissions.pinParticipant)throw new R("You do not have permission to unpin messages.","0501");const e=this.messages.find(r=>r.id===t);if(e){n(this,Le).setPinState(e,!1);return}throw new R(`No message found with id: ${t}`,"0504")}async getMessages(t,e,r,i=0,a=void 0){const o=await n(this,Le).getChatMessagesPaginated(t,e,r,i,a);return{messages:o.messages.map(c=>Ps.formatSocketPeerMessage(c)),next:o.next}}async createChannel(t,e,r={}){var c;const i=(c=n(this,Y).permissions)==null?void 0:c.chatChannel;if(i){if(i.canCreate==="NONE")throw new R("Not permitted to create channels","0501");if(r.visibility==="public"&&!(i.canCreate==="PUBLIC"||i.canCreate==="ALL"))throw new R("Not permitted to create public channels","0501");if(r.visibility==="private"&&!(i.canCreate==="PRIVATE"||i.canCreate==="ALL"))throw new R("Not permitted to create private channels","0501")}if(!t||t.trim().length===0)throw new R("channel name cannot be empty.","0510");const a=[...new Set([...e,n(this,Y).userId])];return await n(this,mi).createChannel(t.trim(),a,r.displayPictureUrl,r.visibility,r.isDirectMessage)}updateChannel(t,e){var o,c,d,l,h;const r=this.channels.find(p=>p.id===t),i=(o=n(this,Y).permissions)==null?void 0:o.chatChannel;if(i){if(i.canUpdate==="NONE")throw new R("Not permitted to update channels","0501");if(r.visibility==="public"&&!(i.canUpdate==="PUBLIC"||i.canUpdate==="ALL"))throw new R("Not permitted to update public channels","0501");if(r.visibility==="private"&&!(i.canUpdate==="PRIVATE"||i.canUpdate==="ALL"))throw new R("Not permitted to update private channels","0501")}const a={memberIds:(c=e.memberIds)!=null?c:r.memberIds,displayName:(d=e.displayName)!=null?d:r.displayName,displayPictureUrl:(l=e.displayPictureUrl)!=null?l:r.displayPictureUrl,visibility:(h=e.visibility)!=null?h:r.visibility};return n(this,mi).updateChannel(t,a)}async sendMessageToChannel(t,e,r={}){return this.sendMessageInternal(t,null,e,r)}async getChannelMembers(t){return n(this,mi).getChannelMembers(t)}async searchMessages(t,e={}){if(!n(this,fi).getValue("flagsmith").hasFeature(Q.FEAT_CHAT_SDK_SEARCH))throw new R("searchMessages is temporarily disabled!","0506");return(await n(this,Le).searchMessages(t,e)).map(Ps.formatSocketPeerMessage)}async markLastReadMessage(t,e){await n(this,Le).markLastReadMessage(t,e);const r=this.channels.find(i=>i.id===t);if(r){const i={...r,unreadCount:0};this.channels=this.channels.map(a=>a.id===t?i:a),this.emit("channelMessageUpdate",i)}}get pinned(){return this.messages.filter(t=>t.pinned)}},Y=new WeakMap,gi=new WeakMap,Le=new WeakMap,mi=new WeakMap,fi=new WeakMap,Md=new WeakSet,vf=function(){return n(this,fi).getValue("connectionHandler")},Io=new WeakSet,ku=function(){return n(this,Md,vf).socketJoined===!0},Tg);dt([S.trace("Chat.sendTextMessage"),kt(nd)],We.prototype,"sendTextMessage",1);dt([S.trace("Chat.sendImageMessage"),kt({maxInvocations:20,period:60})],We.prototype,"sendImageMessage",1);dt([S.trace("Chat.sendFileMessage"),kt({maxInvocations:20,period:60})],We.prototype,"sendFileMessage",1);dt([S.trace("Chat.sendMessage"),kt({maxInvocations:180,period:60})],We.prototype,"sendMessage",1);dt([S.trace("Chat.editTextMessage")],We.prototype,"editTextMessage",1);dt([S.trace("Chat.editImageMessage")],We.prototype,"editImageMessage",1);dt([S.trace("Chat.editFileMessage")],We.prototype,"editFileMessage",1);dt([S.trace("Chat.editMessage")],We.prototype,"editMessage",1);dt([S.trace("Chat.deleteMessage")],We.prototype,"deleteMessage",1);dt([S.trace("Chat.createChannel")],We.prototype,"createChannel",1);dt([S.trace("Chat.updateChannel")],We.prototype,"updateChannel",1);dt([S.trace("Chat.sendMessageToChannel")],We.prototype,"sendMessageToChannel",1);dt([S.trace("Chat.getChannelMembers")],We.prototype,"getChannelMembers",1);dt([S.trace("Chat.searchMessages")],We.prototype,"searchMessages",1);dt([S.trace("Chat.markLastReadMessage")],We.prototype,"markLastReadMessage",1);We=dt([ct("0500")],We);var qM=Object.defineProperty,jM=Object.getOwnPropertyDescriptor,GM=(s,t,e,r)=>{for(var i=r>1?void 0:r?jM(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&qM(t,e,i),i},Ar,vg;const ii=(vg=class{constructor(s,t,e,r,i){u(this,"chat");u(this,"chatSocketHandler");u(this,"chatChannelSocketHandler");u(this,"self");g(this,Ar,void 0);m(this,Ar,s),this.chatSocketHandler=t,this.chatChannelSocketHandler=e,this.chat=new We(s,t,e,r,i),this.self=r,this.setupEvents()}get telemetry(){return n(this,Ar).getValue("telemetry")}get logger(){return n(this,Ar).getValue("logger")}static async init(s,t,e,r,i){return new ii(s,t,e,r,i)}static formatMessage(s){return{...s,time:new Date(s.time),type:HM[s.type]}}static formatSocketPeerMessage(s){const t=s.createdAt*1e3,e={displayName:s.displayName,id:s.chatId,time:t,timeMs:s.createdAtMs,type:s.payloadType,isEdited:s.isEdited,userId:s.userId,targetUserIds:s.targetUserIds,channelId:s.channelId,channelIndex:s.channelIndex,message:"",link:"",name:"",html:"",images:[],videos:[],files:[],size:0,pinned:s.pinned};switch(e.type){case vt.TEXT:{e.message=s.payload;break}case vt.IMAGE:{e.link=s.payload;break}case vt.FILE:{const{link:r,name:i,size:a}=JSON.parse(s.payload);e.link=r,e.name=i,e.size=a;break}case vt.CUSTOM:{const{html:r,images:i,message:a,videos:o,files:c}=JSON.parse(s.payload);e.message=a,e.html=r,e.images=i,e.videos=o,e.files=c;break}}return ii.formatMessage(e)}async getChatMessages(){if(this.self.config.viewType==="LIVESTREAM"||this.self.config.viewType==="CHAT"||n(this,Ar).getValue("flagsmith").hasFeature(Q.FEAT_PAGINATED_CHAT))return;const s=await this.chatSocketHandler.getChatMessages();if(!(s!=null&&s.payload))return;const t=pf.fromBinary(s.payload).messages;this.chat.messages=t.map(e=>ii.formatSocketPeerMessage(e))}setupEvents(){n(this,Ar).getValue("peerSessionStore").on(b.SOCKET_SERVICE_ROOM_JOINED,async()=>{this.getChatMessages()}),this.chatSocketHandler.on(_e.sendMessageToRoom,s=>{const t=ii.formatSocketPeerMessage(s.message);if(!t.channelId)this.chat.messages=[...this.chat.messages,t];else{const e=this.chat.channels.find(r=>r.id===t.channelId);e&&(e.latestMessage=t,e.unreadCount+=1,this.chat.emit("channelMessageUpdate",e))}this.chat.emit("chatUpdate",{action:"add",message:t,messages:this.chat.messages})}),this.chatSocketHandler.on(_e.sendMessageToPeers,s=>{const t=ii.formatSocketPeerMessage(s.message);this.chat.messages=[...this.chat.messages,t],this.chat.emit("chatUpdate",{action:"add",message:t,messages:this.chat.messages})}),this.chatSocketHandler.on(_e.editMessage,s=>{const t=ii.formatSocketPeerMessage(s.message);if(t.channelId){this.chat.emit("chatUpdate",{action:"edit",message:t,messages:this.chat.messages});return}const e=this.chat.messages.findIndex(r=>r.id===t.id);e!==-1&&(this.chat.messages[e]=t,this.chat.emit("chatUpdate",{action:"edit",message:t,messages:this.chat.messages}))}),this.chatSocketHandler.on(_e.deleteMessage,s=>{if(s.channelId){this.chat.emit("chatUpdate",{action:"delete",message:{id:s.chatId,channelId:s.channelId},messages:this.chat.messages});return}const t=this.chat.messages.findIndex(r=>r.id===s.chatId);if(t===-1)return;const[e]=this.chat.messages.splice(t,1);this.chat.emit("chatUpdate",{action:"delete",message:e,messages:this.chat.messages})}),this.chatChannelSocketHandler.on(di.createChatChannel,s=>{const[t]=s.chatChannels,e=an.formatChannel(t);this.chat.channels.push(e),this.chat.emit("channelCreate",e)}),this.chatSocketHandler.on(_e.pinMessage,s=>{const t=this.chat.messages.findIndex(r=>r.id===s.chatId);if(t===-1)return;const e=this.chat.messages[t];e.pinned=s.pinned,this.chat.messages[t]=e,this.chat.emit("chatUpdate",{action:"edit",message:e,messages:this.chat.messages})}),this.chatChannelSocketHandler.on(di.updateChatChannel,s=>{const[t]=s.chatChannels,e=an.formatChannel(t);this.chat.channels=this.chat.channels.map(r=>r.id===e.id?e:r),this.chat.emit("channelUpdate",e)})}},Ar=new WeakMap,vg);let Ps=ii;GM([S.trace("ChatController.setupEvents")],Ps.prototype,"setupEvents",1);var WM=Object.defineProperty,JM=Object.getOwnPropertyDescriptor,KM=(s,t,e,r)=>{for(var i=r>1?void 0:r?JM(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&WM(t,e,i),i},Dd,yf,Od,Sf,xn,Un,Ao,yg;let Iu=(yg=class extends Ft{constructor(t,e,r){const i=t.getValue("logger");super(i);g(this,Dd);g(this,Od);u(this,"items");g(this,xn,void 0);g(this,Un,void 0);g(this,Ao,void 0);m(this,Ao,t),m(this,xn,e),m(this,Un,r),this.items=[]}async create(t,e,r=!1,i=!1){if(!n(this,Od,Sf))throw new R("Can't create polls without joining room","0705");if(!n(this,xn).permissions.polls.canCreate){this.logger.error("Polls::create::permission_denied");return}if(!t||!e){this.logger.error("Polls::question_and_options_can_not_be_empty",{polls:{hasQuestion:!!t,optionsLength:e==null?void 0:e.length}});return}if(e.length<2){this.logger.error("Polls::there_must_be_at_least_two_options",{polls:{hasQuestion:!!t,optionsLength:e.length}});return}await n(this,Un).createPoll(t,e,r,i)}async vote(t,e){if(!n(this,xn).permissions.polls.canVote){this.logger.error("Polls::vote::permission_denied");return}await n(this,Un).votePoll(t,e)}},Dd=new WeakSet,yf=function(){return n(this,Ao).getValue("connectionHandler")},Od=new WeakSet,Sf=function(){var t;return((t=n(this,Dd,yf))==null?void 0:t.socketJoined)===!0},xn=new WeakMap,Un=new WeakMap,Ao=new WeakMap,yg);Iu=KM([ct("0700")],Iu);var zM=Object.defineProperty,YM=Object.getOwnPropertyDescriptor,QM=(s,t,e,r)=>{for(var i=r>1?void 0:r?YM(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&zM(t,e,i),i},Mr,$n,Ti,Sg;const Tn=(Sg=class{constructor(s,t,e){u(this,"polls");g(this,Mr,void 0);g(this,$n,void 0);g(this,Ti,void 0);this.polls=new Iu(s,t,e),m(this,$n,t),m(this,Mr,s),m(this,Ti,e),this.setupEvents()}get telemetry(){return n(this,Mr).getValue("telemetry")}get logger(){return n(this,Mr).getValue("logger")}static async init(s,t,e){return new Tn(s,t,e)}canViewPolls(){return n(this,$n).permissions.polls.canView}setupEvents(){const s={[qs.createPoll]:r=>{r.poll&&this.updatePoll(Tn.formatSocketServicePoll(r.poll))},[qs.updatePoll]:r=>{r.poll&&this.updatePoll(Tn.formatSocketServicePoll(r.poll))},[qs.votePoll]:r=>{r.poll&&this.updatePoll(Tn.formatSocketServicePoll(r.poll))}},t=()=>{n(this,Mr).getValue("peerSessionStore").on(b.SOCKET_SERVICE_ROOM_JOINED,()=>{this.getPolls()}),Object.keys(s).map(Number).forEach(r=>{n(this,Ti).on(r,s[r])})},e=()=>{n(this,Mr).getValue("peerSessionStore").on(b.SOCKET_SERVICE_ROOM_JOINED,()=>{this.getPolls()}),Object.keys(s).map(Number).forEach(r=>{n(this,Ti).removeListeners(r)})};n(this,$n).permissions.on("permissionsUpdate",async r=>{var i;r!=null&&r.polls&&((i=r==null?void 0:r.polls)!=null&&i.canView?(await this.getPolls(),t()):(this.polls.items=[],e()))}),this.canViewPolls()&&t()}updatePoll(s){if(!this.canViewPolls())return;const t=this.polls.items.findIndex(e=>e.id===s.id);if(t>-1){const e=JSON.stringify(this.polls.items[t]);this.polls.items[t]=s,e!==JSON.stringify(s)&&this.polls.emit("pollsUpdate",{polls:this.polls.items,newPoll:!1});return}this.polls.items=[...this.polls.items,s],this.polls.emit("pollsUpdate",{polls:this.polls.items,newPoll:!0})}async getPolls(){const s=await n(this,Ti).getPolls();if(!(s!=null&&s.payload))return;const{polls:t}=cM.fromBinary(s.payload);this.polls.items=t.map(e=>Tn.formatSocketServicePoll(e))}static formatSocketServicePoll(s){const t=s.options.map(e=>({count:e.count,text:e.text,votes:e.votes.map(r=>({id:r.userId,name:r.name}))}));return{anonymous:s.anonymous,createdBy:s.createdBy,createdByUserId:s.createdByUserId,hideVotes:s.hideVotes,id:s.pollId,options:t,question:s.question,voted:s.votes}}},Mr=new WeakMap,$n=new WeakMap,Ti=new WeakMap,Sg);let Ef=Tn;QM([S.trace("PollController.setupEvents")],Ef.prototype,"setupEvents",1);var XM=Object.defineProperty,ZM=Object.getOwnPropertyDescriptor,e0=(s,t,e,r)=>{for(var i=r>1?void 0:r?ZM(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&XM(t,e,i),i},Pf=(s=>(s[s.User=0]="User",s[s.Meeting=1]="Meeting",s))(Pf||{}),Fn,Mo,Mu,vi,Do,Eg;let Au=(Eg=class extends Ft{constructor(t,e,r,i,a){const o=t.getValue("logger");super(o);g(this,Mo);u(this,"selfActiveTab");u(this,"broadcastTabChanges");g(this,Fn,void 0);g(this,vi,void 0);g(this,Do,void 0);u(this,"viewType");u(this,"meetingStartedTimestamp");u(this,"meetingTitle");u(this,"sessionId");m(this,Fn,t),m(this,vi,e),this.viewType=r,m(this,Do,i),this.meetingTitle=a,this.broadcastTabChanges=e.permissions.canSpotlight}get socketState(){return n(this,Mo,Mu).socketState}get mediaState(){return n(this,Mo,Mu).mediaState}get meetingId(){return n(this,Fn).getValue("meetingId")}setBroadcastTabChanges(t){if(!n(this,vi).permissions.canSpotlight)throw this.logger.error("Spotlight::setSpotlighted::permission_denied"),new R("User does not have permission to toggle spotlight","0801");this.broadcastTabChanges=t,this.emit("broadcastTabChangesUpdate",this.broadcastTabChanges),this.broadcastTabChanges&&this.assertActiveTabToRoom()}setSelfActiveTab(t,e){var r;this.logger.info("Spotlight::setActiveTab",{spotlight:{currentTab:{id:t.id,type:t.type}}}),this.selfActiveTab=t,e===0&&this.emit("selfTabUpdate",t),(r=n(this,vi).permissions)!=null&&r.canSpotlight&&this.broadcastTabChanges&&e===0&&this.assertActiveTabToRoom()}assertActiveTabToRoom(){n(this,Do).broadcastMessage("spotlight",{userId:n(this,vi).userId,currentTab:this.selfActiveTab})}},Fn=new WeakMap,Mo=new WeakSet,Mu=function(){return n(this,Fn).getValue("connectionHandler")},vi=new WeakMap,Do=new WeakMap,Eg);Au=e0([ct("0800")],Au);function t0(s){let t="",e=[""];const r=[e];let i=0,a=0,o=!0,c;for(c of s)c==='"'?(o&&c===t&&(e[i]+=c),o=!o):c===","&&o?c=e[++i]="":c===`
8
8
  `&&o?(t==="\r"&&(e[i]=e[i].slice(0,-1)),e=r[++a]=[c=""],i=0):e[i]+=c,t=c;return r}var s0=Object.defineProperty,r0=Object.getOwnPropertyDescriptor,_f=(s,t,e,r)=>{for(var i=r>1?void 0:r?r0(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&s0(t,e,i),i},Oo,Pg;let Xr=(Pg=class extends Ft{constructor(t){const e=t.getValue("logger");super(e);u(this,"transcripts");g(this,Oo,void 0);m(this,Oo,t),this.transcripts=[]}get telemetry(){return n(this,Oo).getValue("telemetry")}static async init(t,e){const r=new Xr(t),i=t.getValue("logger");try{e&&r.getActiveTranscript()}catch(a){i.error("Error fetching active transcriptions ",a)}return r}static parseTranscript(t,e=!1){if(!t)return;const[[r,i,a,o,c,d]]=t0(t);return{id:gr.v4(),name:c,peerId:i,userId:a,customParticipantId:o,transcript:d,isPartialTranscript:e,date:new Date(parseInt(r,10)*1e3)}}static parseTranscripts(t){return t?t.split(`
@@ -12,4 +12,4 @@ ${s}`}const Ua={maxInvocations:5,period:1};function kt(s,t){return function(e,r,
12
12
  maxEnergy: ${n(this,Gr)}`),i===-1/0||e<1e-6?{energy:0,isVoice:!1}:((!n(this,nr)||i<n(this,nr))&&m(this,nr,i),(!n(this,Gr)||i>n(this,Gr))&&m(this,Gr,i),{energy:(i-n(this,nr))/(n(this,Gr)-n(this,nr))*10||0,isVoice:r})},yc=new WeakSet,Ku=function(t){return t<5},ll=new WeakSet,cT=function(t=n(this,qi)){var r;if(!n(this,Ts)||!t){n(this,ar).getValue("flagsmith").hasFeature(Q.ENABLE_AUDIO_ACTIVITY_DEBUG_LOGS)&&this.logger.debug(`AudioActivityReporter: No producerId or energy to report: ${n(this,Ts)}`);return}const e={producerId:n(this,Ts),energy:Math.round(t),silent:L(r=Eo,yc,Ku).call(r,t)};m(this,ka,e.silent),this.reportRequest(e)},ul=new WeakSet,dT=function(t){const e=Math.log10(t);return Math.round(e)},g(ho,yc),g(ho,ul);const GD=(s=!1)=>{if("MediaStreamTrackGenerator"in window&&"AudioData"in window)try{const e=new window.MediaStreamTrackGenerator({kind:"audio"}),r=e.writable.getWriter(),i=48e3,a=128,o=1;let c=0,d=null;const l=async()=>{try{const f=new Float32Array(a*o),T=new window.AudioData({format:"f32",sampleRate:i,numberOfFrames:a,numberOfChannels:o,timestamp:c,data:f});c+=a/i*1e6,await r.ready,await r.write(T)}catch(f){d&&clearInterval(d),r.releaseLock(),e.writable.abort()}};d=window.setInterval(l,100);const p=new MediaStream([e]).getAudioTracks()[0];return p.addEventListener("ended",()=>{d&&clearInterval(d),r.releaseLock(),e.writable.abort()}),Object.assign(p,{fakeTracks:"fakeTracks:fakeAudioTrack"}),p.enabled=s,p}catch(e){}const t=window.AudioContext||window.webkitAudioContext;if(t)try{const e=new t;if(!e||e.state!=="running"||!e.destination)return;const r=e.createOscillator();r.frequency.value=0,r.type="sine";const i=e.createGain();i.gain.value=0,r.connect(i);const a=e.createMediaStreamDestination();i.connect(a),r.start();const o=a.stream.getAudioTracks()[0];return o?(Object.assign(o,{fakeTracks:"fakeTracks:fakeAudioTrack"}),o.enabled=s,o):void 0}catch(e){return}},WD=(s=!1)=>{var a,o;const t=new MediaStream().getVideoTracks()[0],e=document.createElement("canvas");e.height=(a=t==null?void 0:t.getSettings().height)!=null?a:720,e.width=(o=t==null?void 0:t.getSettings().width)!=null?o:1280;const r=e.getContext("2d");r.fillStyle="black",r.fillRect(0,0,e.width,e.height),setInterval(()=>{r.fillStyle="black",r.fillRect(0,0,e.width,e.height)},1e3);const i=e.captureStream().getVideoTracks()[0];return Object.assign(i,{fakeTracks:"fakeTracks:fakeVideoTrack"}),i.enabled=s,i};var JD=Object.defineProperty,KD=Object.getOwnPropertyDescriptor,ae=(s,t,e,r)=>{for(var i=r>1?void 0:r?KD(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&JD(t,e,i),i};const At=["video/VP9","video/VP8"];var Sc,Ec,nt,H,Ia,mt,ji,Gi,Wi,Pc,ts,cr,_c,Ji,Ki,ft,Ct,Wr,yn,hl,uT,pl,hT,gl,pT,Cc,zu,ml,du,gT,fl,mT,Tl,fT,vl,TT,Ye,lt,zi,po,yl,vT,Sl,yT,El,ST;const lT=(du=class{constructor(s,t){g(this,Wr);g(this,hl);g(this,pl);g(this,gl);g(this,Cc);g(this,fl);g(this,Tl);g(this,vl);g(this,Ye);g(this,zi);g(this,yl);g(this,Sl);g(this,El);u(this,"context");u(this,"authToken");u(this,"e2ee");g(this,Sc,void 0);g(this,Ec,void 0);g(this,nt,void 0);g(this,H,void 0);g(this,Ia,void 0);g(this,mt,void 0);g(this,ji,void 0);g(this,Gi,void 0);g(this,Wi,void 0);g(this,Pc,void 0);g(this,ts,null);g(this,cr,void 0);g(this,_c,void 0);g(this,Ji,void 0);g(this,Ki,void 0);g(this,ft,void 0);g(this,Ct,void 0);var r,i;this.context=s;const{socket:e}=t;this.mediaJoined=!1,m(this,Ji,new Map([["video/VP9",new Set],["video/VP8",new Set]])),m(this,Ki,new Map([["video/VP9",new Set],["video/VP8",new Set]])),m(this,nt,e),m(this,ji,!1),m(this,H,new BD(s,e)),m(this,mt,n(this,H).events),m(this,cr,new Set),m(this,ft,new Map),m(this,Gi,!1),m(this,Wi,new Fu(s.getValue("logger"))),m(this,Ct,new ho(this.context,n(this,H).socketHandler.audioActivity.bind(n(this,H).socketHandler))),this.e2ee=(i=(r=s.getValue("modules").e2ee)==null?void 0:r.enabled)!=null?i:!1,this.handleSocketEvents(),this.handleCallstatsEvents(),m(this,Pc,Eh(async()=>{if(!n(this,Wr,yn).mediaJoinAttempted)return;const{roomJoined:a}=await this.joinRoom(n(this,Ec),n(this,Sc),!0,!0);a&&(this.context.getValue("peerSessionStore").emit(b.RESET_PRODUCER_STATE),this.context.getValue("peerSessionStore").emit(b.ROOM_NODE_RECONNECTED))},5e3,{leading:!0,maxWait:1e3}))}get peerId(){return this.context.getValue("peerId")}get telemetry(){return this.context.getValue("telemetry")}get logger(){return this.context.getValue("logger")}get mediaJoined(){return n(this,Wr,yn).mediaJoined}set mediaJoined(s){n(this,Wr,yn).mediaJoined=s}reset(){n(this,H).closeAllProducers(),n(this,H).closeAllConsumers(),n(this,ft).clear(),n(this,cr).clear(),m(this,ts,null),n(this,Wi).stop(),n(this,H).stopAllTransports(),n(this,H).reset(),m(this,Wi,new Fu)}async joinRoom(s,t,e=!1,r=!1,i={}){n(this,Wr,yn).mediaJoinAttempted=!0,m(this,ji,!0),e&&this.reset();try{return await n(this,Wi).push(()=>L(this,hl,uT).call(this,s,t,r,i),"joinRoom")}catch(a){return this.logger.error("Error in room joining process",{error:a}),this.context.getValue("peerSessionStore").emit(b.ROOM_NODE_FAILED),{roomJoined:!1}}}async initializeConnection(s,t,e=!1,r={}){return n(this,ts)?n(this,ts):(m(this,ts,(async()=>{try{await L(this,Cc,zu).call(this,s,t,e,r)}catch(i){throw m(this,ts,null),i}})()),n(this,ts))}getConsumers(){return n(this,H).consumers}getProducers(){return n(this,H).producers}async leaveRoom(){n(this,H).stopAllTransports(),m(this,Gi,!1),n(this,Wr,yn).mediaJoinAttempted=!1;const s={closeRoom:!1};n(this,nt).sendMessagePromise(n(this,mt).leaveRoom,Kw.toBinary(s)).then(e=>{var r;(r=LR.fromBinary(e.payload))!=null&&r.closed&&this.logger.warn("Weird state on peer closed and should not happen")}).catch(e=>{this.logger.error("error on sending leave room request",{error:e})}),this.context.getValue("callstats").callEnded(),this.context.getValue("telemetry").destruct()}async activatePeers(s){return this.createConsumers(s)}async createConsumers(s){return s.length===0?Promise.resolve():n(this,H).createConsumers(s)}async closeConsumers(s){if(!s.length)return;const t=s.reduce((e,r)=>{const i=n(this,H).producerIdToConsumerIdMap.get(r.producerId);return i?(e.push(i),e):(this.logger.warn(`consumer not found in close consumers: ${r.producerId}`),e)},[]);await n(this,H).closeConsumers(t)}async _shareWebcam(s,t){var p,f;const e=t==="video/VP9"?de.WEBCAM:de.WEBCAM_BACKUP,r=L(this,Ye,lt).call(this,e);if(r){const T=await r;if(n(this,H).producers.has(T)){const E=n(this,H).producers.get(T);if(!E.closed)return await E.replaceTrack({track:s}),await this.resumeWebcam(e),s;await this.disableWebcam(t)}return this._shareWebcam(s,t)}const i=[t].concat(At.filter(T=>T!==t)),a=L(this,El,ST).call(this,s,i),o=Na(this.context,"disableSimulcast"),c=(f=(p=this.context)==null?void 0:p.getValue("overrides"))==null?void 0:f.simulcastConfig;!(o||c&&c.disable)&&this.context.getValue("flagsmith").hasFeature(Q.ENABLE_CF_SIMULCAST)?(this.logger.info("Simulcast enabled for SFU: CF"),a.encodings=O0(this.context,s)):this.logger.info("Simulcast disabled for webcam producer, SFU: CF"),this.context.getValue("flagsmith").hasFeature(Q.TRACK_HINT)&&(a.track.contentHint=this.context.getValue("flagsmith").getValue(Q.TRACK_HINT));const l=()=>{this.logger.info("Disabling video due to the producer closure"),n(this,ft).delete(e)},h=n(this,H).createProducer(a,l);return L(this,zi,po).call(this,e,h.then(T=>T.id)),h.then(T=>T.track)}async shareWebcam(s){var r;if(s===void 0)return null;const t=(r=this.context.getValue("flagsmith").getValue(Q.FORCE_VIDEO_CODEC))==null?void 0:r.toString();if(t)return this.logger.debug(`Calling _shareWebcam with forced video codec: ${t}`),this._shareWebcam(s,t);const e=At.filter(i=>{var a,o;return((o=(a=n(this,Ia).sender)==null?void 0:a.video)==null?void 0:o.codecs.findIndex(c=>c.mimeType===i))>=0&&n(this,Ki).get(i).size>0});return e.length===0&&e.push(At[0]),await Promise.all(e.map(i=>(this.logger.debug(`Calling _shareWebcam with video codec: ${i}`),this._shareWebcam(s,i)))),s}async shareScreen(s){const{video:t,audio:e}=s;if(t===void 0)return;const r={track:t,codecOptions:[{name:"VP8"}],appData:{screenShare:!0,e2ee:this.e2ee,supportsRemoteControl:Te.isElectron()},stopTracks:!1},i=()=>{this.logger.info("Disabling screenShare due to the producer closure"),n(this,ft).delete(de.SCREENSHARE_VIDEO),n(this,ft).delete(de.SCREENSHARE_AUDIO)},a=n(this,H).createProducer(r,i);L(this,zi,po).call(this,de.SCREENSHARE_VIDEO,a.then(c=>c.id));let o;if(e){const c={track:e,codecOptions:[{name:"opus"}],appData:{screenShare:!0,e2ee:this.e2ee,supportsRemoteControl:Te.isElectron()},stopTracks:!1,zeroRtpOnPause:!1},d=()=>{};o=n(this,H).createProducer(c,d),L(this,zi,po).call(this,de.SCREENSHARE_AUDIO,o.then(l=>l.id))}await Promise.all([a,o||Promise.resolve()]),this.context.getValue("callstats").screenShareStart()}async shareMic(s){try{if(s===void 0)throw new Rt("track undefined");const t=L(this,Ye,lt).call(this,de.MIC);if(t){const a=await t;if(n(this,H).producers.has(a)){const o=n(this,H).producers.get(a);if(!o.closed){await o.replaceTrack({track:s}),await this.resumeMic(),n(this,Ct)&&(n(this,Ct).audioTrack=s,n(this,Ct).producerId=a,n(this,Ct).start());return}await n(this,H).closeProducer(a,{stopTrack:!1})}await this.shareMic(s);return}const e=L(this,Sl,yT).call(this,s),r=()=>{n(this,ft).delete(de.MIC)},i=n(this,H).createProducer(e,r);L(this,zi,po).call(this,de.MIC,i.then(a=>a.id)),await i.then(a=>{n(this,Ct)&&(n(this,Ct).audioTrack=a.track,n(this,Ct).producerId=a.id,n(this,Ct).start())})}catch(t){throw new R(t)}}async pauseMic(){var r;const s=await L(this,Ye,lt).call(this,de.MIC),t=n(this,H).producers.get(s);if(!t){this.logger.error("pauseMic::could_not_find_mic_producer");return}if(t.paused){this.logger.info("pauseMic::mic_producer_already_paused");return}t.pause(),(r=n(this,Ct))==null||r.stop();const e={producerId:t.id,pause:!0};n(this,nt).sendMessage(n(this,mt).toggleProducer,Wc.toBinary(e))}async pauseWebcam(){const s=await L(this,Ye,lt).call(this,de.WEBCAM),t=await L(this,Ye,lt).call(this,de.WEBCAM_BACKUP),e=n(this,H).producers.get(s),r=n(this,H).producers.get(t);if(!e&&!r){this.logger.error("pauseWebcam::could_not_find_webcam_producer");return}const i=a=>{const o={producerId:a.id,pause:!0};n(this,nt).sendMessage(n(this,mt).toggleProducer,Wc.toBinary(o))};e&&(e.pause(),i(e)),r&&(r.pause(),i(r))}async resumeMic(){const s=await L(this,Ye,lt).call(this,de.MIC),t=n(this,H).producers.get(s);if(!t){this.logger.error("resumeMic::could_not_find_mic_producer");return}if(!t.pause){this.logger.info("resumeMic::mic_producer_already_resumed");return}t.resume(),t.appData.e2ee&&this.context.getValue("peerSessionStore").emit(b.E2EE_ACTIVE_PRODUCER,t);const e={producerId:t.id,pause:!1};n(this,nt).sendMessage(n(this,mt).toggleProducer,Wc.toBinary(e))}async resumeWebcam(s=de.WEBCAM){const t=await L(this,Ye,lt).call(this,s),e=n(this,H).producers.get(t);if(!e){this.logger.error("resumeWebcam::could_not_find_webcam_producer");return}if(!e.paused){this.logger.info("resumeWebcam::webcam_producer_already_resumed");return}e.resume(),e.appData.e2ee&&this.context.getValue("peerSessionStore").emit(b.E2EE_ACTIVE_PRODUCER,e);const r={producerId:e.id,pause:!1};n(this,nt).sendMessage(n(this,mt).toggleProducer,Wc.toBinary(r))}async disableWebcam(s){const t=s==="video/VP9"?de.WEBCAM:de.WEBCAM_BACKUP,e=await L(this,Ye,lt).call(this,t);L(this,yl,vT).call(this,t),e&&await n(this,H).closeProducer(e)}async disableMic(){var t;const s=await L(this,Ye,lt).call(this,de.MIC);s&&await n(this,H).closeProducer(s),(t=n(this,Ct))==null||t.stop(),n(this,ft).delete(de.MIC)}async disableScreenShare(){this.logger.info("screen_sharing_stopped"),this.context.getValue("callstats").screenShareStop();const s=await L(this,Ye,lt).call(this,de.SCREENSHARE_VIDEO),t=await L(this,Ye,lt).call(this,de.SCREENSHARE_AUDIO);s&&await n(this,H).closeProducer(s),t&&await n(this,H).closeProducer(t),n(this,cr).clear(),n(this,ft).delete(de.SCREENSHARE_VIDEO),n(this,ft).delete(de.SCREENSHARE_AUDIO)}async muteSelf(){this.pauseMic()}async resetVideoProducers(s,t){if(s){const e=await L(this,Ye,lt).call(this,de.WEBCAM),r=await L(this,Ye,lt).call(this,de.WEBCAM_BACKUP);await n(this,H).closeProducer(e,{stopTrack:!1}),await n(this,H).closeProducer(r,{stopTrack:!1}),this.shareWebcam(s)}if(t){const e=await L(this,Ye,lt).call(this,de.SCREENSHARE_VIDEO);await n(this,H).closeProducer(e,{stopTrack:!1}),this.shareScreen({video:t})}}async changeDisplayName(s,t){const e={displayName:s,participantId:t!=null?t:this.peerId};if(!await n(this,H).socketHandler.changeDisplayName(e))throw new Error("failed to change display name!")}kick(s){const t={peerIds:[s]};n(this,H).socketHandler.kickPeer(t)}kickAll(){n(this,H).socketHandler.kickAll()}async muteAll(s){if(!await n(this,H).socketHandler.hostControlForAll("audio"))throw new Error("failed to mute all participant")}async muteAllVideo(){if(!await n(this,H).socketHandler.hostControlForAll("video"))throw new Error("failed to mute all video participant")}async disableAudio(s){if(!await n(this,H).socketHandler.hostControlForPeer(s,"audio"))throw new Error("failed to mute given participant")}async disableVideo(s){if(!await n(this,H).socketHandler.hostControlForPeer(s,"video"))throw new Error("failed to mute video of given participant")}async pinPeer(s){const t={participantId:s!=null?s:""};try{await n(this,nt).sendMessagePromise(n(this,mt).globalPinPeer,cR.toBinary(t))}catch(e){this.logger.error("Error in pinning peer:",{error:e})}}validateScreenShare(s){return this.peerId===s.peerId&&n(this,H).producers.get(s.producerId)&&n(this,cr).add(s.consumerPeerId),n(this,cr).size}async switchConsumersToLayer(s,t){const e=s.map(r=>this.getConsumers().get(r));n(this,H).switchConsumersToLayer(e,t)}async handleSocketEvents(){n(this,nt).on(n(this,mt).peerProducerCreateBroadcast,({payload:s})=>{var t,e;if(this.mediaJoined)try{const{participantId:r,producerState:i}=hb.fromBinary(s);if(r===this.peerId)return;if(i!=null&&i.mimeType||(i.mimeType=i.kind===xs.AUDIO?"audio/opus":"video/VP8"),i.kind===xs.VIDEO&&!i.screenShare&&((e=(t=n(this,Ia).receiver)==null?void 0:t.video)==null?void 0:e.codecs.findIndex(a=>a.mimeType===At[0]))>=0&&n(this,Ji).get(At[0]).has(r)&&i.mimeType!==At[0]){this.logger.warn(`Ignoring producer: ${i.producerId}`);return}this.logger.info(`producer created broadcast: ${r}, producer state: ${i}`),this.context.getValue("peerSessionStore").emit(b.NEW_PRODUCER,{peerId:r,producer:{...i,kind:i.kind===xs.AUDIO?"audio":"video",producingPeerId:r}})}catch(r){this.logger.error("error in peer-producer-create-broadcast",{error:r})}}),n(this,nt).on(n(this,mt).peerProducerToggleBroadcast,({payload:s})=>{if(this.mediaJoined)try{const{participantId:t,initiatorParticipantId:e,producerState:{kind:r,pause:i,producerId:a,screenShare:o}}=Vp.fromBinary(s);if(o)return;const c=r===xs.AUDIO?"audio":"video";if(this.logger.info(`producer toggle broadcast: ${t}, producerId: ${a}, kind:${c}, paused:${i} payload: ${JSON.stringify(Vp.fromBinary(s))}`),t===this.peerId&&e!==this.peerId&&i&&this.context.getValue("peerSessionStore").emit(c==="audio"?b.MUTE_SELF:b.MUTE_SELF_VIDEO),t===this.peerId)return;this.context.getValue("peerSessionStore").emit(b.PRODUCER_TOGGLE,{peerId:t,producerId:a,paused:i,kind:c}),Array.from(this.getConsumers().values()).filter(l=>l.producerId===a).forEach(l=>{l.kind==="video"&&i||l.paused!==i&&(this.logger.debug(`consumer state mismatched for ${l.id}. updating consumer pause state ${l.paused} to ${i}`),i?(l.pause(),this.context.getValue("peerSessionStore").emit(b.CONSUMER_PAUSED,{id:l.id})):(l.resume(),this.context.getValue("peerSessionStore").emit(b.CONSUMER_RESUMED,{id:l.id})))})}catch(t){this.logger.error("error in producer toggle broadcast handler",{error:t})}}),n(this,nt).on(n(this,mt).peerLeaveBroadcast,({payload:s})=>{if(this.mediaJoined)try{const{participantId:t}=Su.fromBinary(s);if(t===this.peerId)return;this.logger.info(`peer left broadcast:${t}`),n(this,cr).delete(t),n(this,H).consumers.forEach(e=>{e.peerId===t&&e.close()}),this.context.getValue("peerSessionStore").emit(b.PEER_CLOSED,{id:t})}catch(t){this.logger.error("error in peer left broadcast",{error:t})}}),n(this,nt).on(n(this,mt).peerProducerCloseBroadcast,({payload:s})=>{if(this.mediaJoined)try{const{participantId:t,producerState:{producerId:e}}=mb.fromBinary(s);if(t===this.peerId)return;this.logger.info(`producer closed broadcast:${t}`),this.context.getValue("peerSessionStore").emit(b.PRODUCER_CLOSED,{peerId:t,producerId:e});const r=n(this,H).producerIdToConsumerIdMap.get(e);if(!r){this.logger.warn(`no consumer found for producer:${e}`);return}this.logger.info(`closing consumer ${r}, producer id: ${e}`),n(this,H).closeConsumer(r).then(()=>{this.logger.info(`closed consumer: ${r}`),n(this,H).producerIdToConsumerIdMap.delete(e),this.context.getValue("peerSessionStore").emit(b.CONSUMER_CLOSED,{id:r})}).catch(i=>{this.logger.error("error closing consumer",{error:i})})}catch(t){this.logger.error("error on producer close broadcast",{error:t})}}),n(this,nt).on(n(this,mt).mediaRoomTerminationBroadcastResponse,()=>{!this.mediaJoined&&!n(this,ji)&&!n(this,Gi)||(this.logger.warn("media hub termination broadcast received, rejoining room"),this.context.getValue("peerSessionStore").emit(b.ROOM_NODE_DISCONNECTED),n(this,Pc).call(this))})}handleCallstatsEvents(){this.context.getValue("callstats").onConsumerScore(s=>{s.forEach((t,e)=>{const r=n(this,H).consumers.get(e);r&&this.context.getValue("peerSessionStore").emit(b.CONSUMER_SCORE_UPDATE,{id:e,kind:r.kind,peerId:r.peerId,score:t.score,scoreStats:t})})}),this.context.getValue("callstats").onProducerScore(s=>{s.forEach((t,e)=>{const r=Array.from(n(this,H).producers.values()).find(i=>i.id===e);r&&this.context.getValue("peerSessionStore").emit(b.PRODUCER_SCORE_UPDATE,{id:e,kind:r.kind,appData:r.appData,score:t.score,scoreStats:t})})})}handlePeerCapabilities(s,t){var e,r,i,a;for(let o=0;o<=At.length;o+=1){const c=At[o];if(((r=(e=t==null?void 0:t.receiver)==null?void 0:e.video)==null?void 0:r.codecs.findIndex(d=>d.mimeType===c))>=0||o===At.length-1){n(this,Ki).get(c).add(s);break}}for(let o=0;o<=At.length;o+=1){const c=At[o];if(((a=(i=t==null?void 0:t.sender)==null?void 0:i.video)==null?void 0:a.codecs.findIndex(d=>d.mimeType===c))>=0||o===At.length-1){n(this,Ji).get(c).add(s);break}}}handlePeerLeaving(s){this.context.getValue("flagsmith").hasFeature(Q.FORCE_VIDEO_CODEC)||(n(this,Ji).forEach(t=>t.delete(s)),n(this,Ki).forEach((t,e)=>{t.delete(s),!(t.size!==0||e===At[0])&&this.disableWebcam(e)}))}},Sc=new WeakMap,Ec=new WeakMap,nt=new WeakMap,H=new WeakMap,Ia=new WeakMap,mt=new WeakMap,ji=new WeakMap,Gi=new WeakMap,Wi=new WeakMap,Pc=new WeakMap,ts=new WeakMap,cr=new WeakMap,_c=new WeakMap,Ji=new WeakMap,Ki=new WeakMap,ft=new WeakMap,Ct=new WeakMap,Wr=new WeakSet,yn=function(){return this.context.getValue("connectionHandler")},hl=new WeakSet,uT=async function(s,t,e,r){m(this,Ec,s);try{return n(this,ts)?await n(this,ts):await L(this,Cc,zu).call(this,s,t,e,r),L(this,gl,pT).call(this,t),{roomJoined:await L(this,pl,hT).call(this)}}catch(i){return this.logger.error("Failed to complete room join",{error:i}),{roomJoined:!1}}finally{m(this,ts,null)}},pl=new WeakSet,hT=async function(){try{this.mediaJoined=!0;const{roomState:s}=await n(this,H).socketHandler.notifySelfJoinComplete();return m(this,Sc,s.roomUuid),m(this,Gi,!0),m(this,ji,!1),!0}catch(s){return this.logger.error("Error completing room join",{error:s}),this.mediaJoined=!1,!1}},gl=new WeakSet,pT=function(s){navigator.product!=="ReactNative"&&setTimeout(()=>{try{const e={userId:this.context.getValue("userId"),peerId:this.peerId,roomUUID:s,roomViewType:"groupCall",deviceInfo:{...Te.getDeviceInfo(),userAgent:navigator.userAgent,memory:navigator.deviceMemory,cpus:navigator.hardwareConcurrency},sdkName:this.context.getValue("sdkName"),sdkVersion:this.context.getValue("sdkVersion"),metaData:{},permissions:{}};this.context.getValue("callstats").roomJoined(e)}catch(t){this.logger.error("Error reporting room joined analytics",{error:t})}},0)},Cc=new WeakSet,zu=async function(s,t,e,r){var i,a;try{(a=n(this,_c))!=null||m(this,_c,L(i=lT,ml,gT).call(i));const o=L(this,fl,mT).call(this);await L(this,Tl,fT).call(this,s,t,e,o),await n(this,H).setupTransports({send:!0,recv:!0}),await L(this,vl,TT).call(this,r)}catch(o){throw this.logger.error("Failed to initialize connection",{error:o}),o}},ml=new WeakSet,gT=function(){const{ipInfo:s}=at();if(!(s!=null&&s.loc))return;const[t,e]=s.loc.split(",").map(parseFloat);return{latitude:t,longitude:e}},fl=new WeakSet,mT=function(){var e;const s=(e=this.context.getValue("flagsmith").getValue(Q.FORCE_VIDEO_CODEC))==null?void 0:e.toString(),t=ID(s);return m(this,Ia,t),t},Tl=new WeakSet,fT=async function(s,t,e,r){await qf(async(i,a)=>{if(!n(this,nt).isConnected){a(new Error("Socket is not connected"));return}i>0&&this.logger.warn("Retry: send joinRoom message",{debuggingHint:`Retry attempt ${i}`});try{await n(this,H).socketHandler.joinRoom(t,s,r,e,n(this,_c))}catch(o){throw this.logger.error("Failed to send joinRoom message after retries",{error:o}),o}},{delayTime:1e3,strategy:"exponential",maxRetryCount:1/0})},vl=new WeakSet,TT=async function(s){if(!(!this.context.getValue("flagsmith").hasFeature(Q.PRECREATE_PRODUCERS)||!s))try{const e=[];if(s.canProduceVideo===B.Allowed&&e.push(this.shareWebcam(WD(!1))),s.canProduceAudio===B.Allowed){const r=GD(!1);r&&e.push(this.shareMic(r))}e.length>0&&await Promise.all(e)}catch(e){this.logger.warn("Failed to precreate producers",{error:e})}},Ye=new WeakSet,lt=function(s){return n(this,ft).get(s)},zi=new WeakSet,po=function(s,t){return n(this,ft).set(s,t)},yl=new WeakSet,vT=function(s){return n(this,ft).delete(s)},Sl=new WeakSet,yT=function(s){return{track:s,encodings:[{priority:"high"}],codecOptions:[{name:"opus"}],appData:{e2ee:this.e2ee},stopTracks:!1,zeroRtpOnPause:!1}},El=new WeakSet,ST=function(s,t){return{track:s,codecOptions:t?t.map(e=>({name:e.split("/")[1]})):[{name:"VP8"}],appData:{screenShare:!1,e2ee:this.e2ee},stopTracks:!1}},g(du,ml),du);let re=lT;ae([S.trace("MediaNodeClient.reset",{country:S.location.country})],re.prototype,"reset",1);ae([S.trace("MediaNodeClient.joinRoom")],re.prototype,"joinRoom",1);ae([S.trace("MediaNodeClient.leaveRoom")],re.prototype,"leaveRoom",1);ae([S.trace("MediaNodeClient.activatePeers")],re.prototype,"activatePeers",1);ae([S.trace("MediaNodeClient.createConsumers")],re.prototype,"createConsumers",1);ae([S.trace("MediaNodeClient.closeConsumers")],re.prototype,"closeConsumers",1);ae([S.trace("MediaNodeClient._shareWebcam")],re.prototype,"_shareWebcam",1);ae([S.trace("MediaNodeClient.shareWebcam")],re.prototype,"shareWebcam",1);ae([S.trace("MediaNodeClient.shareScreen")],re.prototype,"shareScreen",1);ae([S.trace("MediaNodeClient.shareMic")],re.prototype,"shareMic",1);ae([S.trace("MediaNodeClient.pauseMic")],re.prototype,"pauseMic",1);ae([S.trace("MediaNodeClient.pauseWebcam")],re.prototype,"pauseWebcam",1);ae([S.trace("MediaNodeClient.resumeMic")],re.prototype,"resumeMic",1);ae([S.trace("MediaNodeClient.resumeWebcam")],re.prototype,"resumeWebcam",1);ae([S.trace("MediaNodeClient.disableWebcam")],re.prototype,"disableWebcam",1);ae([S.trace("MediaNodeClient.disableMic")],re.prototype,"disableMic",1);ae([S.trace("MediaNodeClient.disableScreenShare")],re.prototype,"disableScreenShare",1);ae([S.trace("MediaNodeClient.muteSelf")],re.prototype,"muteSelf",1);ae([S.trace("MediaNodeClient.resetVideoProducers")],re.prototype,"resetVideoProducers",1);ae([S.trace("MediaNodeClient.changeDisplayName")],re.prototype,"changeDisplayName",1);ae([S.trace("MediaNodeClient.kickPeer")],re.prototype,"kick",1);ae([S.trace("MediaNodeClient.kickAllPeers")],re.prototype,"kickAll",1);ae([S.trace("MediaNodeClient.muteAll")],re.prototype,"muteAll",1);ae([S.trace("MediaNodeClient.muteAllVideo")],re.prototype,"muteAllVideo",1);ae([S.trace("MediaNodeClient.disableAudio")],re.prototype,"disableAudio",1);ae([S.trace("MediaNodeClient.disableVideo")],re.prototype,"disableVideo",1);ae([S.trace("MediaNodeClient.pinPeer")],re.prototype,"pinPeer",1);ae([S.trace("MediaNodeClient.validateScreenShare")],re.prototype,"validateScreenShare",1);function ET(s,t){const e=s.getValue("roomNodeClient");if(e){if(e)return e;throw new Error("Room node client already set up.")}const r=new re(s,t);return s.setValue("roomNodeClient",r),r}function PT(s){const t=s.getValue("roomNodeClient");try{t==null||t.leaveRoom()}catch(e){s.getValue("logger").error("roomNodeClient::cleanupRoomNodeClient")}s.setValue("roomNodeClient",void 0)}var zD=Object.defineProperty,YD=Object.getOwnPropertyDescriptor,gn=(s,t,e,r)=>{for(var i=r>1?void 0:r?YD(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&zD(t,e,i),i},Yi,vs,X,Tt,Dt,Dg;const _T=(Dg=class{constructor(s,t,e,r){g(this,Tt);u(this,"self");u(this,"authToken");g(this,Yi,void 0);u(this,"viewType");g(this,vs,void 0);g(this,X,void 0);const{socket:i}=e,a=s.getValue("authToken");this.self=t,m(this,X,s),this.viewType=r,this.authToken=a,m(this,Yi,i),m(this,vs,e),t.config.viewType!==bt.Chat&&this.setupEvents()}get peerId(){return n(this,X).getValue("peerId")}get telemetry(){return n(this,X).getValue("telemetry")}get logger(){return n(this,X).getValue("logger")}get mediaJoined(){return n(this,X).getValue("connectionHandler").mediaJoined}static async init(s,t,e,r,i){const a=at(),o=s.getValue("peerId"),c=!!s.getValue("cachedUserDetails"),d=await Je.__init__(s,e,r,i,i.name,c);s.setValue("self",d);const l=s.getValue("logger");if(navigator.product!=="ReactNative"){const h=!s.getValue("flagsmith").hasFeature(Q.PRECALL_BANDWIDTH_TEST);setTimeout(async()=>{const p=await d.getAllDevices();l.info("populated_full_device_list",{devices:JSON.stringify(p)}),s.getValue("callstats").devices("AUDIO",p==null?void 0:p.filter(f=>f.kind==="audioinput")),s.getValue("callstats").devices("VIDEO",p==null?void 0:p.filter(f=>f.kind==="videoinput")),s.getValue("callstats").devices("SPEAKER",p==null?void 0:p.filter(f=>f.kind==="audiooutput")),l.info("Callstats:: initializing");try{await s.getValue("callstats").initialize({peerId:o,engineName:Te.getDeviceInfo().engineName,env:s.getValue("env"),iceServers:await a.getICEServers(),apiBase:s.getValue("apiBase"),flags:s.getValue("flagsmith").getAllFlags(),logger:l,apiHostnames:Xm(s),skipConnectivityChecks:h}),l.info("Callstats:: initialized")}catch(f){l.error("Callstats:: initialization failed",{error:f})}},0)}else l.info("Callstats:: Skipped initialization due to navigator product being ReactNative.");return new _T(s,d,t,i.viewType)}async shareMediaTracks(){var c;const{audioTrack:s,videoTrack:t,permissions:e,audioEnabled:r,videoEnabled:i,screenShareEnabled:a,screenShareTracks:o}=this.self;if(e.canProduceAudio===B.Allowed&&r)try{await n(this,Tt,Dt).shareMic(s),this.self.audioEnabled||n(this,Tt,Dt).pauseMic()}catch(d){this.self.disableAudio()}if(e.canProduceVideo===B.Allowed&&i)try{const d=await n(this,Tt,Dt).shareWebcam(t);d&&d.id!==t.id&&n(this,X).getValue("flagsmith").hasFeature(Q.EXP_RESHARE)&&await n(this,Tt,Dt).shareWebcam(d),this.self.videoEnabled||n(this,Tt,Dt).pauseWebcam()}catch(d){this.self.disableVideo()}if(e.canProduceScreenshare===B.Allowed&&a)try{await((c=n(this,Tt,Dt))==null?void 0:c.shareScreen({video:o.video,audio:o.audio}))}catch(d){this.self.disableScreenShare()}}async kickHandler(s){let t="kicked";(s==null?void 0:s.kickType)==="kickAll"&&(t="ended"),this.leaveRoom(t)}waitlistedHandler(){this.logger.info("SelController.waitlisted"),this.self.waitlistStatus="waiting",this.self.roomState="waitlisted",this.self.emit("waitlisted")}waitlistAcceptHandler(){if(this.logger.info("SelController.waitlistAccepted"),this.self.waitlistStatus==="accepted"){this.logger.warn("SelfController.WAITLIST_ACCEPTED.UserAlreadyAccepted");return}this.self.waitlistStatus="accepted",this.joinRoom()}waitlistRejectedHandler(){if(this.logger.info("SelfController.waitlistRejected"),this.self.waitlistStatus==="rejected"){this.logger.warn("SelfController.WAITLIST_REJECTED.UserAlreadyRejected");return}this.self.waitlistStatus="rejected",this.leaveRoom("rejected")}async resetSelf(s){n(this,X).getValue("callstats").callEnded(),n(this,Tt,Dt).reset(),s&&await this.joinRoom(s)}setupEvents(){n(this,X).getValue("peerSessionStore").on(b.RESET_PRODUCER_STATE,async()=>{this.mediaJoined&&this.shareMediaTracks()}),n(this,X).getValue("peerSessionStore").on(b.ROOM_NODE_RECONNECTED,()=>{this.self.roomState="joined",this.self.emit("roomJoined",{reconnected:!0})}),n(this,X).getValue("peerSessionStore").on(b.ROOM_NODE_DISCONNECTED,()=>{this.self.roomState!=="disconnected"&&(this.self.roomState="disconnected",this.self.emit("roomLeft",{state:"disconnected"}))}),n(this,X).getValue("peerSessionStore").on(b.ROOM_NODE_FAILED,()=>{this.self.roomState="failed",this.self.emit("roomLeft",{state:"failed"})}),n(this,X).getValue("peerSessionStore").on(b.SOCKET_SERVICE_RECONNECTED,({wasJoinAttempted:s})=>{s===!1&&(this.self.roomState="init"),this.resetSelf(s)}),n(this,X).getValue("peerSessionStore").on(b.SOCKET_SERVICE_DISCONNECTED,({joinAttempted:s})=>{if(this.self.roomState==="disconnected")return;let{peerId:t}=this;s&&n(this,X).getValue("flagsmith").hasFeature(Q.REFRESH_ID_ON_DISCONNECTION)&&(t=gr.v4()),n(this,Yi).updateURL(t),n(this,X).getValue("telemetry").resetPeerId(t),at().setHeader("tracing-id",t),hr.remapContext(t,n(this,X)),this.self.roomState="disconnected",this.self.emit("roomLeft",{state:"disconnected"})}),n(this,X).getValue("peerSessionStore").on(b.SOCKET_SERVICE_FAILED,()=>{this.self.roomState="failed",this.self.emit("roomLeft",{state:"failed"})}),n(this,vs).on(x.waitingRoomRequestAccepted,()=>{this.waitlistAcceptHandler()}),n(this,vs).on(id.updateUserPreset,s=>{s.updatePeersPresets.forEach(t=>{t.userIds===this.self.userId&&n(this,X).getValue("peerSessionStore").emit(b.UPDATE_PERMISSIONS,t.patch)})}),n(this,vs).on(x.waitingRoomRequestDenied,()=>{this.waitlistRejectedHandler()}),n(this,vs).on(x.kick,()=>{this.kickHandler({kickType:"kick"})}),n(this,vs).on(x.kickAll,()=>{this.kickHandler({kickType:"kickAll"})}),n(this,X).getValue("peerSessionStore").onAsync(b.JOIN_MEDIA_ROOM,this.joinMediaRoom.bind(this)),n(this,X).getValue("peerSessionStore").on(b.PRODUCER_SCORE_UPDATE,({score:s,kind:t,appData:e,scoreStats:r})=>{var a;const i=(a=e==null?void 0:e.screenShare)!=null?a:!1;this.self.emit("mediaScoreUpdate",{kind:t,isScreenshare:i,score:s,participantId:this.self.id,scoreStats:r})}),n(this,X).getValue("peerSessionStore").on(b.MUTE_SELF,async()=>{this.self.audioEnabled&&(await this.self.disableAudio(),n(this,X).getValue("callstats").audioOff())}),n(this,X).getValue("peerSessionStore").on(b.MUTE_SELF_VIDEO,async()=>{this.self.videoEnabled&&(await this.self.disableVideo(),n(this,X).getValue("callstats").videoOff())}),n(this,X).getValue("peerSessionStore").onAsync(b.LEAVE_MEDIA_ROOM,this.leaveMediaRoom.bind(this)),n(this,X).getValue("peerSessionStore").on(b.PIP_HANGUP,this.leaveRoom.bind(this))}async joinRoom(s=!1){try{const{peer:t}=await n(this,vs).joinRoom(this.self);n(this,vs).socket.flush();const e=Rh(t.stageType);if(n(this,X).setValue("stageStatus",e,!1),t.waitlisted){this.waitlistedHandler();return}await this.joinMediaRoom(s),n(this,X).notify("stageStatus")}catch(t){throw this.logger.error("Error in joinRoom",{error:t}),t}}async leaveRoom(s="left"){var t,e;if(this.logger.info(`Leaving room with state: ${s}`),(t=n(this,X).getValue("roomSocketHandler"))==null||t.cleanup(),s==="rejected"){this.self.roomState=s,this.self.emit("roomLeft",{state:s});return}this.self.setIsPinned(!1),n(this,X).setValue("stageStatus","OFF_STAGE",!1),await this.leaveMediaRoom(s),n(this,X).notify("stageStatus");try{(e=n(this,Yi))==null||e.disconnect()}catch(r){this.logger.error("SelfController::leaveRoom::socketDisconnect")}PT(n(this,X)),this.self.roomState=s,this.self.emit("roomLeft",{state:s}),this.logger.info(`roomLeft event emitted with state: ${s}`)}async joinMediaRoom(s=!1){var a,o;const{peerId:t,viewType:e,meetingId:r,stageStatus:i}=n(this,X).getAllValues();try{if(e===bt.Livestream){if(i!=="ON_STAGE"){this.self.roomState="joined",this.self.emit("roomJoined",{reconnected:s});return}ET(n(this,X),{socket:n(this,Yi),peerId:t})}const{canProduceAudio:c,canProduceVideo:d,canProduceScreenshare:l}=this.self.permissions,{roomJoined:h}=(o=await((a=n(this,Tt,Dt))==null?void 0:a.joinRoom(this.self.name,r,s,s,{canProduceAudio:c,canProduceVideo:d,canProduceScreenshare:l})))!=null?o:{};if(!h)return;i==="ON_STAGE"&&await this.shareMediaTracks(),this.self.roomState="joined",this.self.emit("roomJoined",{reconnected:s})}catch(c){throw this.logger.error("Error:SelfController.mediaRoomJoin",{error:c}),new R("Error: could not join media room","0002")}}async leaveMediaRoom(s){const t=n(this,X).getValue("viewType");s!=="connected-meeting"&&await this.cleanupSelf(),!(s==="stageLeft"&&t===bt.Webinar)&&n(this,Tt,Dt)&&(n(this,Tt,Dt).mediaJoined&&s!=="disconnected"&&await n(this,Tt,Dt).leaveRoom(),!(s==="stageLeft"&&t===bt.Livestream)&&(n(this,Tt,Dt).mediaJoined=!1))}async cleanupSelf(){await this.self.disableAudio(),await this.self.disableVideo(),await this.self.disableScreenShare(),this.self.cleanUpTracks(),this.self.destructMediaHandler(),navigator.isReactNative||this.self.removeDocumentEventListeners()}},Yi=new WeakMap,vs=new WeakMap,X=new WeakMap,Tt=new WeakSet,Dt=function(){return n(this,X).getValue("roomNodeClient")},Dg);let ti=_T;gn([S.trace("SelfController.resetSelf")],ti.prototype,"resetSelf",1);gn([S.trace("SelfController.setupEvents")],ti.prototype,"setupEvents",1);gn([S.trace("SelfController.joinRoom")],ti.prototype,"joinRoom",1);gn([S.trace("SelfController.leaveRoom")],ti.prototype,"leaveRoom",1);gn([S.trace("SelfController.joinMediaRoom")],ti.prototype,"joinMediaRoom",1);gn([S.trace("SelfController.leaveMediaRoom")],ti.prototype,"leaveMediaRoom",1);gn([S.trace("SelfController.init")],ti,"init",1);var wc;class QD{constructor(t){g(this,wc,void 0);m(this,wc,t)}on(t,e){let r;t===x.roomPeerCount?r=Up.fromBinary.bind(Up):r=zp.fromBinary.bind(zp),n(this,wc).on(t,({payload:i})=>{if(t===x.roomPeerCount&&!i)return;const a=r(i);e(a)})}}wc=new WeakMap;var Rc,bc;class XD{constructor(t,e){g(this,Rc,void 0);g(this,bc,void 0);m(this,Rc,e),m(this,bc,t)}get logger(){return n(this,bc).getValue("logger")}on(t,e){let r,i;switch(t){case x.transcript:{r=Zl.fromBinary.bind(Zl),i=Zl.create();break}default:{this.logger.debug("AISocketHandler switch case hit default, event not accounted for.");break}}n(this,Rc).on(t,({payload:a})=>{let o=i;try{o=r(a)}catch(c){this.logger.error("aiSocketHandler::on::binary_decode_error",{error:c})}return e(o)})}}Rc=new WeakMap,bc=new WeakMap;var ZD=Object.defineProperty,eO=Object.getOwnPropertyDescriptor,Uh=(s,t,e,r)=>{for(var i=r>1?void 0:r?eO(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&ZD(t,e,i),i},dr,Aa;class Bl{constructor(t,e){g(this,dr,void 0);g(this,Aa,void 0);m(this,dr,e),m(this,Aa,t)}get logger(){return n(this,Aa).getValue("logger")}get telemetry(){return n(this,Aa).getValue("telemetry")}getPolls(){return n(this,dr).sendMessagePromise(qs.getPolls)}createPoll(t,e,r=!1,i=!1){const a={anonymous:r,hideVotes:i,question:t,options:e};return n(this,dr).sendMessage(qs.createPoll,rM.toBinary(a))}votePoll(t,e){const r={index:e,pollId:t};return n(this,dr).sendMessage(qs.votePoll,nM.toBinary(r))}on(t,e){let r,i;switch(t){case qs.updatePoll:case qs.createPoll:case qs.votePoll:{r=nu.fromBinary.bind(nu),i=nu.create();break}}n(this,dr).on(t,({payload:a})=>{let o=i;try{o=r(a)}catch(c){this.logger.error("pollSocketHandler::on::binary_decode_error",{error:c})}return e(o)})}removeListeners(t){n(this,dr).removeListeners(t)}}dr=new WeakMap,Aa=new WeakMap;Uh([S.trace("PollSocketHandler.getPolls")],Bl.prototype,"getPolls",1);Uh([S.trace("PollSocketHandler.createPoll")],Bl.prototype,"createPoll",1);Uh([S.trace("PollSocketHandler.votePoll")],Bl.prototype,"votePoll",1);var tO=Object.defineProperty,sO=Object.getOwnPropertyDescriptor,rO=(s,t,e,r)=>{for(var i=r>1?void 0:r?sO(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&tO(t,e,i),i},xt;class CT{constructor(t,e){u(this,"socket");g(this,xt,void 0);m(this,xt,t),this.socket=e,this.handleSocketEvents(),n(this,xt).setValue("roomSocketHandler",this)}get telemetry(){return n(this,xt).getValue("telemetry")}get logger(){return n(this,xt).getValue("logger")}cleanup(){var t;try{(t=this.socket)==null||t.disconnect()}catch(e){this.logger.error("roomSocketHandler::cleanup")}}async joinRoom(t){var i;this.socket.joinAttempted=!0;const e={capabilities:[],peer:{displayName:(i=t.name)!=null?i:"Participant",customParticipantId:t.customParticipantId,peerId:t.id,userId:t.userId,displayPictureUrl:t.picture,waitlisted:!1},roomUuid:""},r=this.socket.sendMessagePromise(x.joinRoom,jb.toBinary(e));try{const{peer:a}=fn.fromBinary((await r).payload);n(this,xt).getValue("connectionHandler").socketJoined=!0,n(this,xt).getValue("peerSessionStore").emit(b.SOCKET_SERVICE_ROOM_JOINED,{peer:a});const o=this.getRoomState(),c=this.getRoomPeersNonPaginated(),[{room:d},{peers:l}]=await Promise.all([o,c]);return n(this,xt).getValue("peerSessionStore").emit(b.ROOM_STATE,d),n(this,xt).getValue("peerSessionStore").emit(b.SOCKET_PEERS,l),{peer:a}}catch(a){throw this.logger.error("RoomSocketHandler.joinRoom.failed",{error:a}),new R("Error: RoomSocketHandler.joinRoom failed.","0002",this.logger,a)}}async getAllAddedParticipants(){try{return kk.fromBinary((await this.socket.sendMessagePromise(x.getAllAddedParticipants)).payload).participants.map(({id:e,...r})=>({...r,userId:e}))}catch(t){return[]}}async getRoomPeers(t,e,r){let i;try{const a={seachQuery:t,limit:e,offset:r},o=await this.socket.sendMessagePromise(x.getRoomPeersInfo,Nb.toBinary(a));i=eu.fromBinary(o.payload)}catch(a){this.logger.error("getRoomPeers::binary_decode_error",{error:a})}return i}async getRoomPeersNonPaginated(){let t;try{const e=await this.socket.sendMessagePromise(x.getRoomPeersInfo);t=eu.fromBinary(e.payload)}catch(e){this.logger.error("getRoomJoinedPeers::binary_decode_error",{error:e})}return t}async getStagePeers(){let t;try{const e=await this.socket.sendMessagePromise(x.getRoomPeersInfo);t=eu.fromBinary(e.payload)}catch(e){this.logger.error("getRoomJoinedPeers::binary_decode_error",{error:e})}return t}async getPeerInfo(t){let e;try{const r=await this.socket.sendMessagePromise(x.getPeerInfo,df.toBinary({peerId:t}));e=fn.fromBinary(r.payload)}catch(r){this.logger.error("getPeerInfo::binary_decode_error",{error:r})}return e}async getRoomState(){let t=$p.create();try{const e=await this.socket.sendMessagePromise(x.getRoomInfo);t=$p.fromBinary(e.payload)}catch(e){this.logger.error("getRoomState::binary_decode_error",{error:e})}return t}async getRoomStageState(){let t=qp.create();try{const e=await this.socket.sendMessagePromise(x.getRoomStageState);t=qp.fromBinary(e.payload)}catch(e){this.logger.error("getRoomStageState::binary_decode_error",{error:e})}return t}async broadcastMessage(t,e){const r={type:t,payload:new TextEncoder().encode(JSON.stringify(e)),timestamp:Date.now(),ids:[]};return this.socket.sendMessagePromise(x.broadcastMessage,ro.toBinary(r))}async broadcastToMeetings(t,e,r){const i={type:t,payload:new TextEncoder().encode(JSON.stringify(r)),timestamp:Date.now(),ids:e,broadcastType:1};return this.socket.sendMessagePromise(x.broadcastToEntity,ro.toBinary(i))}async broadcastToPeers(t,e,r){const i={type:t,payload:new TextEncoder().encode(JSON.stringify(r)),timestamp:Date.now(),ids:e,broadcastType:0};return this.socket.sendMessage(x.broadcastToEntity,ro.toBinary(i))}async leaveRoom(){this.socket.joinAttempted=!1,this.socket.sendMessagePromise(x.leaveRoom,Wb.toBinary({}))}async kick(t){const e={peerIds:[t]};this.socket.sendMessage(x.kick,uf.toBinary(e))}async kickAll(t=!1){const e={propagateKickAcrossRooms:t};this.socket.sendMessage(x.kickAll,af.toBinary(e))}getWaitingRoomRequests(){this.socket.sendMessage(x.getWaitingRoomRequests)}acceptWaitingRoomRequest(t){const e={userIds:t};this.socket.sendMessage(x.acceptWaitingRoomRequests,Nk.toBinary(e))}rejectWaitingRoomRequest(t){const e={userIds:t};this.socket.sendMessage(x.denyWaitingRoomRequests,Lk.toBinary(e))}async updatePermissions(t,e){const r={updatePeersPresets:[]};return t.forEach(i=>{r.updatePeersPresets.push({userIds:i,patch:e})}),this.socket.sendMessagePromise(id.updateUserPreset,uI.toBinary(r))}handleSocketEvents(){this.socket.on(x.broadcastMessage,({payload:t})=>{try{const e=ro.fromBinary(t);n(this,xt).getValue("peerSessionStore").emit(b.ROOM_MESSAGE,{payload:JSON.parse(new TextDecoder().decode(e.payload)),type:e.type,timestamp:e.timestamp})}catch(e){this.logger.error("failed to decode broadcast message:",e)}}),this.socket.on(x.broadcastToEntity,({payload:t})=>{try{const e=ro.fromBinary(t);n(this,xt).getValue("peerSessionStore").emit(b.MESSAGE,{payload:JSON.parse(new TextDecoder().decode(e.payload)),type:e.type,timestamp:e.timestamp})}catch(e){this.logger.error("failed to decode peer broadcast message:",e)}})}on(t,e){let r,i;switch(t){case x.joinRoom:case x.leaveRoom:case x.kick:case x.kickAll:{r=fn.fromBinary.bind(fn),i=fn.create();break}case x.getWaitingRoomRequests:{r=(a,o)=>a?Hp.fromBinary(a,o):{requests:[]},i=Hp.create();break}case x.recordingPaused:case x.recordingStarted:case x.recordingStopped:{r=Xp.fromBinary.bind(Xp);break}case id.updateUserPreset:{r=jp.fromBinary.bind(jp);break}case Es.peerJoinedBroadcast:case kr.peerJoinedBroadcast:{r=Op.fromBinary.bind(Op);break}case Es.selfJoinComplete:case kr.selfJoinComplete:{r=yu.fromBinary.bind(yu);break}case Es.globalPeerPinBroadcast:case kr.globalPeerPinBroadcast:{r=Lp.fromBinary.bind(Lp);break}case Es.selectedPeer:case kr.selectedPeer:{r=vu.fromBinary.bind(vu);break}case Es.selectedPeerDiff:case kr.selectedPeerDiff:{r=Dp.fromBinary.bind(Dp);break}case Es.leaveRoom:case kr.leaveRoom:{r=Su.fromBinary.bind(Su);break}}this.socket.on(t,({payload:a})=>{let o=i;if(!r)return e(void 0);try{o=r(a)}catch(c){this.logger.error("roomSocketHandler::on::binary_decode_error",{error:c})}return e(o)})}async getUserPermissions(t){const e={userIds:[t]};try{const r=await this.socket.sendMessagePromise(id.getUserPresets,iI.toBinary(e)),i=cI.fromBinary(r.payload).peerPresets[0],a=new TextDecoder().decode(i.preset),o=JSON.parse(a).permissions;return{chat:o.chat,polls:o.polls,plugins:o.plugins}}catch(r){throw this.logger.error("Error in getting user preset",{error:r}),r}}}xt=new WeakMap;rO([S.trace("RoomSocketHandler.joinRoom")],CT.prototype,"joinRoom",1);var wt;class iO{constructor(t){g(this,wt,void 0);m(this,wt,t)}async getStageRequests(){const{payload:t}=await n(this,wt).sendMessagePromise(x.getStageRequests);return t?iu.fromBinary(t):{stageRequests:[]}}requestAccess(){n(this,wt).sendMessage(x.requestStageAccess)}cancelRequestAccess(){n(this,wt).sendMessage(x.cancelStageRequest)}async grantAccess(t){const e={userIds:t};n(this,wt).sendMessage(x.grantStageAccess,JA.toBinary(e))}async denyAccess(t){const e={userIds:t};n(this,wt).sendMessage(x.denyStageAccess,zA.toBinary(e))}joinStage(){return n(this,wt).sendMessagePromise(x.joinStage,void 0,void 0,x.peerStageStatusUpdate)}leaveStage(t){const e={userIds:[t]};return n(this,wt).sendMessagePromise(x.leaveStage,Qp.toBinary(e),void 0,x.peerStageStatusUpdate)}kick(t){const e={userIds:t};return n(this,wt).sendMessagePromise(x.leaveStage,Qp.toBinary(e))}on(t,e){let r;switch(t){case x.grantStageAccess:case x.denyStageAccess:{r=void 0;break}case x.getStagePeers:{r=Yp.fromBinary.bind(Yp);break}case x.getStageRequests:case x.requestStageAccess:case x.cancelStageRequest:{r=iu.fromBinary.bind(iu);break}case x.peerStageStatusUpdate:{r=xp.fromBinary.bind(xp);break}}n(this,wt).on(t,({payload:i,id:a})=>{if(!i||!r)return e(void 0,a);const o=r(i);return e(o,a)})}async getPeerInfo(t){const e=await n(this,wt).sendMessagePromise(x.getPeerInfo,df.toBinary({peerId:t}));return fn.fromBinary(e.payload)}}wt=new WeakMap;var Be,kc;class nO{constructor(t,e){g(this,Be,void 0);g(this,kc,void 0);m(this,Be,e),m(this,kc,t)}get logger(){return n(this,kc).getValue("logger")}addPlugin(t,e){n(this,Be).sendMessage(q.addPlugin,lA.toBinary({pluginId:t,staggered:e}))}removePlugin(t){n(this,Be).sendMessage(q.removePlugin,hA.toBinary({pluginId:t,staggered:!1}))}async getActivePlugins(){const{payload:t}=await n(this,Be).sendMessagePromise(q.getPlugins);return t?VA.fromBinary(t):{plugins:[]}}customPluginEventToRoom(t,e,r){const i={pluginId:t,pluginData:new TextEncoder().encode(JSON.stringify(e))};n(this,Be).sendMessage(q.customPluginEventToRoom,PA.toBinary(i),r)}customPluginEventToPeers(t,e,r,i){const a={pluginId:t,peerIds:e,pluginData:new TextEncoder().encode(JSON.stringify(r))};n(this,Be).sendMessage(q.customPluginEventToPeers,CA.toBinary(a),i)}enablePluginForRoom(t,e){n(this,Be).sendMessage(q.enablePluginForRoom,gA.toBinary({pluginId:t}),e)}enablePluginForPeers(t,e,r){n(this,Be).sendMessage(q.enablePluginForPeers,vA.toBinary({pluginId:t,peerIds:e}),r)}disablePluginForRoom(t,e){n(this,Be).sendMessage(q.disablePluginForRoom,fA.toBinary({pluginId:t}),e)}disablePluginForPeers(t,e,r){n(this,Be).sendMessage(q.disablePluginForPeers,SA.toBinary({pluginId:t,peerIds:e}),r)}storeInsertKeys(t,e,r,i){const a={pluginId:t,storeName:e,insertKeys:r.map(o=>({storeKey:o.key,payload:new TextEncoder().encode(JSON.stringify(o.payload))}))};n(this,Be).sendMessage(q.storeInsertKeys,Gp.toBinary(a),i)}storeGetKeys(t,e,r,i){const a={pluginId:t,storeName:e,getKeys:r.map(o=>({storeKey:o.key}))};n(this,Be).sendMessage(q.storeGetKeys,kA.toBinary(a),i)}storeDeleteKeys(t,e,r,i){const a={pluginId:t,storeName:e,deleteKeys:r.map(o=>({storeKey:o.key}))};n(this,Be).sendMessage(q.storeDeleteKeys,AA.toBinary(a),i)}storeDelete(t,e,r){n(this,Be).sendMessage(q.storeDelete,DA.toBinary({pluginId:t,storeName:e}),r)}getPluginDataOld(t,e){this.logger.info("getPluginDataOld",{plugin:{id:t,storeName:e}})}storePluginDataOld(t,e,r){const i={pluginId:t,storeName:e,insertKeys:[{storeKey:r.key,payload:new TextEncoder().encode(JSON.stringify(r))}]};n(this,Be).sendMessage(q.storeInsertKeys,Gp.toBinary(i))}on(t,e){let r;switch(t){case q.addPlugin:case q.enablePluginForPeers:case q.enablePluginForRoom:{r=Cu.fromBinary.bind(Cu);break}case q.removePlugin:case q.disablePluginForPeers:case q.disablePluginForRoom:{r=Wp.fromBinary.bind(Wp);break}case q.customPluginEventToPeers:case q.customPluginEventToRoom:{r=Kp.fromBinary.bind(Kp);break}case q.storeInsertKeys:case q.storeGetKeys:case q.storeDeleteKeys:case q.storeDelete:{r=Jp.fromBinary.bind(Jp);break}}n(this,Be).on(t,({payload:i,id:a})=>{const o=r(i);return e(o,a)})}}Be=new WeakMap,kc=new WeakMap;var aO=Object.defineProperty,oO=(s,t,e)=>t in s?aO(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e,cO=(s,t,e)=>(oO(s,typeof t!="symbol"?t+"":t,e),e),$h=(s,t,e)=>{if(!t.has(s))throw TypeError("Cannot "+e)},A=(s,t,e)=>($h(s,t,"read from private field"),e?e.call(s):t.get(s)),ge=(s,t,e)=>{if(t.has(s))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(s):t.set(s,e)},se=(s,t,e,r)=>($h(s,t,"write to private field"),r?r.call(s,e):t.set(s,e),e),Se=(s,t,e)=>($h(s,t,"access private method"),e),Rd={},dO={get exports(){return Rd},set exports(s){Rd=s}},An=typeof Reflect=="object"?Reflect:null,dg=An&&typeof An.apply=="function"?An.apply:function(s,t,e){return Function.prototype.apply.call(s,t,e)},ud;An&&typeof An.ownKeys=="function"?ud=An.ownKeys:Object.getOwnPropertySymbols?ud=function(s){return Object.getOwnPropertyNames(s).concat(Object.getOwnPropertySymbols(s))}:ud=function(s){return Object.getOwnPropertyNames(s)};function lO(s){console&&console.warn&&console.warn(s)}var wT=Number.isNaN||function(s){return s!==s};function ne(){ne.init.call(this)}dO.exports=ne;Rd.once=gO;ne.EventEmitter=ne;ne.prototype._events=void 0;ne.prototype._eventsCount=0;ne.prototype._maxListeners=void 0;var lg=10;function Hl(s){if(typeof s!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof s)}Object.defineProperty(ne,"defaultMaxListeners",{enumerable:!0,get:function(){return lg},set:function(s){if(typeof s!="number"||s<0||wT(s))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+s+".");lg=s}});ne.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ne.prototype.setMaxListeners=function(s){if(typeof s!="number"||s<0||wT(s))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+s+".");return this._maxListeners=s,this};function RT(s){return s._maxListeners===void 0?ne.defaultMaxListeners:s._maxListeners}ne.prototype.getMaxListeners=function(){return RT(this)};ne.prototype.emit=function(s){for(var t=[],e=1;e<arguments.length;e++)t.push(arguments[e]);var r=s==="error",i=this._events;if(i!==void 0)r=r&&i.error===void 0;else if(!r)return!1;if(r){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var o=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw o.context=a,o}var c=i[s];if(c===void 0)return!1;if(typeof c=="function")dg(c,this,t);else for(var d=c.length,l=MT(c,d),e=0;e<d;++e)dg(l[e],this,t);return!0};function bT(s,t,e,r){var i,a,o;if(Hl(e),a=s._events,a===void 0?(a=s._events=Object.create(null),s._eventsCount=0):(a.newListener!==void 0&&(s.emit("newListener",t,e.listener?e.listener:e),a=s._events),o=a[t]),o===void 0)o=a[t]=e,++s._eventsCount;else if(typeof o=="function"?o=a[t]=r?[e,o]:[o,e]:r?o.unshift(e):o.push(e),i=RT(s),i>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=s,c.type=t,c.count=o.length,lO(c)}return s}ne.prototype.addListener=function(s,t){return bT(this,s,t,!1)};ne.prototype.on=ne.prototype.addListener;ne.prototype.prependListener=function(s,t){return bT(this,s,t,!0)};function uO(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function kT(s,t,e){var r={fired:!1,wrapFn:void 0,target:s,type:t,listener:e},i=uO.bind(r);return i.listener=e,r.wrapFn=i,i}ne.prototype.once=function(s,t){return Hl(t),this.on(s,kT(this,s,t)),this};ne.prototype.prependOnceListener=function(s,t){return Hl(t),this.prependListener(s,kT(this,s,t)),this};ne.prototype.removeListener=function(s,t){var e,r,i,a,o;if(Hl(t),r=this._events,r===void 0)return this;if(e=r[s],e===void 0)return this;if(e===t||e.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[s],r.removeListener&&this.emit("removeListener",s,e.listener||t));else if(typeof e!="function"){for(i=-1,a=e.length-1;a>=0;a--)if(e[a]===t||e[a].listener===t){o=e[a].listener,i=a;break}if(i<0)return this;i===0?e.shift():hO(e,i),e.length===1&&(r[s]=e[0]),r.removeListener!==void 0&&this.emit("removeListener",s,o||t)}return this};ne.prototype.off=ne.prototype.removeListener;ne.prototype.removeAllListeners=function(s){var t,e,r;if(e=this._events,e===void 0)return this;if(e.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):e[s]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete e[s]),this;if(arguments.length===0){var i=Object.keys(e),a;for(r=0;r<i.length;++r)a=i[r],a!=="removeListener"&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=e[s],typeof t=="function")this.removeListener(s,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(s,t[r]);return this};function IT(s,t,e){var r=s._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i=="function"?e?[i.listener||i]:[i]:e?pO(i):MT(i,i.length)}ne.prototype.listeners=function(s){return IT(this,s,!0)};ne.prototype.rawListeners=function(s){return IT(this,s,!1)};ne.listenerCount=function(s,t){return typeof s.listenerCount=="function"?s.listenerCount(t):AT.call(s,t)};ne.prototype.listenerCount=AT;function AT(s){var t=this._events;if(t!==void 0){var e=t[s];if(typeof e=="function")return 1;if(e!==void 0)return e.length}return 0}ne.prototype.eventNames=function(){return this._eventsCount>0?ud(this._events):[]};function MT(s,t){for(var e=new Array(t),r=0;r<t;++r)e[r]=s[r];return e}function hO(s,t){for(;t+1<s.length;t++)s[t]=s[t+1];s.pop()}function pO(s){for(var t=new Array(s.length),e=0;e<t.length;++e)t[e]=s[e].listener||s[e];return t}function gO(s,t){return new Promise(function(e,r){function i(o){s.removeListener(t,a),r(o)}function a(){typeof s.removeListener=="function"&&s.removeListener("error",i),e([].slice.call(arguments))}DT(s,t,a,{once:!0}),t!=="error"&&mO(s,i,{once:!0})})}function mO(s,t,e){typeof s.on=="function"&&DT(s,"error",t,e)}function DT(s,t,e,r){if(typeof s.on=="function")r.once?s.once(t,e):s.on(t,e);else if(typeof s.addEventListener=="function")s.addEventListener(t,function i(a){r.once&&s.removeEventListener(t,i),e(a)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof s)}class fO extends v.MessageType{constructor(){super("message.v1.SocketMessage",[{no:1,name:"event",kind:"scalar",T:13},{no:2,name:"id",kind:"scalar",opt:!0,T:9},{no:3,name:"payload",kind:"scalar",opt:!0,T:12},{no:4,name:"metadata",kind:"scalar",opt:!0,T:12}])}}const ug=new fO;class OT{static encode(t){return ug.toBinary(t)}static decode(t){return ug.fromBinary(new Uint8Array(t))}}function TO(s,t){return Math.floor(Math.random()*(t-s+1)+s)}var Rr;class vO{constructor(t={}){cO(this,"opts"),ge(this,Rr,void 0),this.opts={initialTimeout:t.initialTimeout||1e3,maxTimeout:t.maxTimeout||1e4,factor:t.factor||2},se(this,Rr,0)}async wait(){se(this,Rr,A(this,Rr)+1);const t=TO(0,Math.min(this.opts.maxTimeout,this.opts.initialTimeout*2**A(this,Rr)));await new Promise(e=>{setTimeout(e,t)})}getAttempts(){return A(this,Rr)}reset(){se(this,Rr,0)}}Rr=new WeakMap;const _r={debug:0,info:1,warn:2,error:3};var oi,ci;class yO{constructor(t){ge(this,oi,void 0),ge(this,ci,void 0),se(this,oi,console),se(this,ci,t)}debug(...t){_r[A(this,ci)]>_r.debug||A(this,oi).debug("[Sockrates]:",...t)}info(...t){_r[A(this,ci)]>_r.info||A(this,oi).info("[Sockrates]:",...t)}warn(...t){_r[A(this,ci)]>_r.warn||A(this,oi).warn("[Sockrates]:",...t)}error(...t){_r[A(this,ci)]>_r.error||A(this,oi).error("[Sockrates]:",...t)}}oi=new WeakMap,ci=new WeakMap;var NT=(s=>(s[s.CONNECTING=0]="CONNECTING",s[s.OPEN=1]="OPEN",s[s.CLOSING=2]="CLOSING",s[s.CLOSED=3]="CLOSED",s))(NT||{});const SO="2",EO="3";var be,Sn,ye,Oe,br,Ge,ur,Yr,Ss,En,Hs,Yu,VT,go,hd,Qu,LT,Xu,hg,bd,Zu,eh,xT,To,pd,vo,kd,Id,th,Mn,yo,So,Ad;class PO{constructor(t,e){var f,T,E,P,C,_,N,U,D,$;ge(this,Yu),ge(this,go),ge(this,Qu),ge(this,Xu),ge(this,bd),ge(this,eh),ge(this,To),ge(this,vo),ge(this,Id),ge(this,Mn),ge(this,So),ge(this,be,void 0),ge(this,Sn,void 0),ge(this,ye,void 0),ge(this,Oe,void 0),ge(this,br,void 0),ge(this,Ge,void 0),ge(this,ur,void 0),ge(this,Yr,void 0),ge(this,Ss,void 0),ge(this,En,void 0),ge(this,Hs,void 0);var r,i,a,o,c,d,l,h,p;se(this,Sn,t),se(this,br,[]),se(this,Ge,new Rd),se(this,ur,!0),se(this,Ss,!1),se(this,ye,e!=null?e:{}),(f=(r=A(this,ye)).autoReconnect)!=null||(r.autoReconnect=!0),(T=(i=A(this,ye)).retryConnectionInterval)!=null||(i.retryConnectionInterval=1e3),(E=(a=A(this,ye)).pingTimeout)!=null||(a.pingTimeout=3e4),(P=(o=A(this,ye)).connectionTimeout)!=null||(o.connectionTimeout=5e3),(C=(c=A(this,ye)).debug)!=null||(c.debug=!0),(_=(d=A(this,ye)).maxReconnectionAttempts)!=null||(d.maxReconnectionAttempts=10),(N=(l=A(this,ye)).disconnectOnPingTimeout)!=null||(l.disconnectOnPingTimeout=!0),(U=(h=A(this,ye)).queueOnDisconnect)!=null||(h.queueOnDisconnect=!1),(D=(p=A(this,ye)).flushOnReconnect)!=null||(p.flushOnReconnect=!1),se(this,Yr,{code:void 0,reason:void 0}),se(this,Oe,($=A(this,ye).logger)!=null?$:new yO(A(this,ye).debug?"debug":"info")),se(this,Hs,new vO)}get readyState(){var t;return(t=A(this,be))==null?void 0:t.readyState}get url(){return A(this,Sn)}updateURL(t){se(this,Sn,t),Se(this,eh,xT).call(this)}get config(){return A(this,ye)}get sendQueue(){return A(this,br)}flush(){if(!A(this,ye).queueOnDisconnect)return!1;const t=[];return A(this,br).forEach(e=>{this.send(e.event,e.id,e.payload,e.metadata)||t.push(e)}),se(this,br,t),A(this,br)}async connect(t=!1){if(!t&&[0,1].includes(this.readyState)){A(this,Oe).debug("Websocket was already connecting or connected.");return}if(A(this,ur)!==!1)return new Promise((e,r)=>{Se(this,Mn,yo).call(this),Se(this,So,Ad).call(this);try{se(this,be,new WebSocket(Se(this,Yu,VT).call(this,A(this,Sn)))),A(this,be).binaryType="arraybuffer",A(this,Oe).debug("Connecting");const i=setTimeout(()=>{A(this,Oe).debug("Connection timeout. Closing socket"),se(this,ur,!0),Se(this,So,Ad).call(this),A(this,be).close(3001,"Connection Timeout"),A(this,ye).autoReconnect&&!A(this,Ss)&&(A(this,Ge).emit("reconnecting"),Se(this,To,pd).call(this)),r(new Error("Connection timed out!"))},A(this,ye).connectionTimeout);A(this,be).onopen=()=>{A(this,Oe).debug(`Ready State: ${NT[A(this,be).readyState]}`),i&&clearTimeout(i),Se(this,Id,th).call(this),se(this,Yr,{code:void 0,reason:void 0}),A(this,Ge).emit("connected"),A(this,ye).flushOnReconnect&&this.flush(),e()},A(this,be).onclose=a=>{try{i&&clearTimeout(i);const{code:o,reason:c}=a;r(c),A(this,Oe).debug("Socket closed. Close event:",{event:a}),A(this,Oe).debug(`Connection closed code: ${o}`),A(this,Oe).debug(`Connection closed reason: ${c}`),A(this,Ss)||Se(this,bd,Zu).call(this,o,c)}catch(o){Se(this,go,hd).call(this,o)}},A(this,be).onerror=a=>{Se(this,go,hd).call(this,a)},A(this,be).onmessage=a=>Se(this,Qu,LT).call(this,a)}catch(i){Se(this,go,hd).call(this,i,r)}})}send(t,e,r,i){const a={event:t,id:e,payload:r,metadata:i};if(A(this,ye).queueOnDisconnect&&(!A(this,be)||A(this,be).readyState!==1))return A(this,Oe).debug("Queuing message since socket is not connected!",a),A(this,br).push(a),!1;const o=OT.encode(a);return Se(this,vo,kd).call(this,o)}emit(t,e,r,i){return this.send(t,e,r,i)}sendRaw(t){return Se(this,vo,kd).call(this,t)}receive(t,e){return A(this,Ge).on(t.toString(),e)}on(t,e){if(typeof t=="string"&&(t==="connected"||t==="disconnected"||t==="errored"||t==="reconnected"||t==="reconnecting"||t==="reconnectAttempt"||t==="reconnectFailure"||t==="failed")){A(this,Ge).on(t,e);return}this.receive(t,e)}removeAllListeners(){A(this,Ge).removeAllListeners()}removeReceiver(t,e){this.removeListener(t,e)}removeListener(t,e){A(this,Ge).removeListener(t.toString(),e)}removeReceivers(t){this.removeListeners(t)}removeListeners(t){A(this,Ge).listeners(t.toString()).map(e=>this.removeListener(t,e))}disconnect(){se(this,ur,!1),Se(this,Mn,yo).call(this),this.removeAllListeners(),se(this,Yr,{code:1e3,reason:"Sockrates disconnect method called"}),A(this,be).close(1e3,"Sockrates disconnect method called.")}}be=new WeakMap,Sn=new WeakMap,ye=new WeakMap,Oe=new WeakMap,br=new WeakMap,Ge=new WeakMap,ur=new WeakMap,Yr=new WeakMap,Ss=new WeakMap,En=new WeakMap,Hs=new WeakMap,Yu=new WeakSet,VT=function(s){if(s.startsWith("ws://")||s.startsWith("wss://"))return s;if(s.startsWith("https://"))return`wss://${s.substring(8)}`;if(s.startsWith("http://"))return`ws://${s.substring(7)}`;throw new Error("Invalid URL. URL must start with http(s):// or ws(s)://.")},go=new WeakSet,hd=function(s,t){A(this,Oe).error("Error:",{error:s}),A(this,Ge).emit("errored",{error:s}),t==null||t(s)},Qu=new WeakSet,LT=function(s){if(Se(this,Id,th).call(this),s.data===SO){A(this,Oe).debug("Received ping from server"),Se(this,vo,kd).call(this,EO);return}const t=OT.decode(s.data),{id:e,payload:r}=t;A(this,Oe).debug("Received message",{event:t.event,messageID:e}),A(this,Ge).emit(t.event.toString(),{id:e,payload:r})},Xu=new WeakSet,hg=function(){return A(this,be).readyState===1},bd=new WeakSet,Zu=function(s,t){se(this,Yr,{reason:t,code:s}),A(this,Ge).emit("disconnected",{code:s,reason:t})},eh=new WeakSet,xT=function(){const{reason:s,code:t}=A(this,Yr);t&&t!==1e3&&A(this,ur)&&A(this,ye).autoReconnect&&!A(this,Ss)&&(A(this,Oe).debug(`Triggering reconnection due to ${s}.`),A(this,Ge).emit("reconnecting"),Se(this,To,pd).call(this))},To=new WeakSet,pd=async function(s=!0){if(s&&A(this,Ss)){A(this,Oe).debug("Reconnect called when already in a reconnect loop. Ignoring.");return}if(A(this,Ss)||A(this,Hs).reset(),A(this,ye).maxReconnectionAttempts!==null&&A(this,Hs).getAttempts()>=A(this,ye).maxReconnectionAttempts){A(this,Ge).emit("failed"),se(this,Ss,!1);return}se(this,Ss,!0),Se(this,So,Ad).call(this),Se(this,Mn,yo).call(this);try{if(await A(this,Hs).wait(),A(this,ur)===!1)return;if(A(this,Oe).debug(`Reconnection attempt ${A(this,Hs).getAttempts()}`),A(this,Ge).emit("reconnectAttempt",{attempt:A(this,Hs).getAttempts()}),await this.connect(),!Se(this,Xu,hg).call(this))throw Error("Reconnect Failed");se(this,Ss,!1),se(this,Yr,{code:void 0,reason:void 0}),A(this,Ge).emit("reconnected")}catch(t){A(this,Oe).debug("Failed to reconnect."),A(this,Ge).emit("reconnectFailure",{attempt:A(this,Hs).getAttempts()}),Se(this,To,pd).call(this,!1)}},vo=new WeakSet,kd=function(s){try{return A(this,be).send(s),!0}catch(t){return A(this,Oe).error(t.message),!1}},Id=new WeakSet,th=function(){this.config.disconnectOnPingTimeout&&(A(this,Oe).debug("Resetting ping timeout"),Se(this,Mn,yo).call(this),se(this,En,setTimeout(()=>{var s;A(this,Oe).debug("Disconnecting the socket due to ping timeout"),se(this,ur,!0);const t=3002,e="Ping timeout";(s=A(this,be))==null||s.close(t,e),Se(this,bd,Zu).call(this,t,e)},A(this,ye).pingTimeout)))},Mn=new WeakSet,yo=function(){A(this,En)&&(clearTimeout(A(this,En)),se(this,En,void 0))},So=new WeakSet,Ad=function(){A(this,be)&&(A(this,be).onopen=void 0,A(this,be).onerror=void 0,A(this,be).onmessage=void 0,A(this,be).onclose=void 0)};var _O=Object.defineProperty,CO=Object.getOwnPropertyDescriptor,ql=(s,t,e,r)=>{for(var i=r>1?void 0:r?CO(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&_O(t,e,i),i};const pg=65535,wO=3e3;var Jr,Ee,Pe,ke,ss,Qe,Ic,sh,Ac,rh,Og;const UT=(Og=class{constructor(s,{peerId:t,meetingId:e,authToken:r,capabilities:i}){g(this,Pe);g(this,Ic);g(this,Ac);g(this,Jr,void 0);g(this,Ee,void 0);u(this,"roomName");u(this,"authToken");u(this,"capabilities");g(this,ss,void 0);g(this,Qe,void 0);var a;if(!t||!e||!r)throw new R("peerId, meetingId, or authToken can not be empty","0404");m(this,ss,void 0),m(this,Qe,s),this.capabilities=i,this.roomName=e,this.authToken=r,m(this,Jr,L(this,Ic,sh).call(this,t)),m(this,Ee,new PO(n(this,Jr),{autoReconnect:!0,disconnectOnPingTimeout:(a=i.includes("PING"))!=null?a:!1,queueOnDisconnect:!0,flushOnReconnect:!1,logger:this.logger})),this.handleSocketConnectionEvents()}get joinAttempted(){return n(this,Pe,ke).socketJoinAttempted}set joinAttempted(s){n(this,Pe,ke).socketJoinAttempted=s}get telemetry(){return n(this,Qe).getValue("telemetry")}get logger(){return n(this,Qe).getValue("logger")}get peerId(){return n(this,Qe).getValue("peerId")}updateURL(s){s!==this.peerId&&(m(this,Jr,L(this,Ic,sh).call(this,s)),this.logger.debug("SocketService:: Connection URL updated.")),n(this,Ee).updateURL(n(this,Jr))}static getSocketEdgeDomain(s){return tn({servicePrefix:"socket-edge",baseURI:s})}get url(){return n(this,Jr)}async connect(){n(this,Pe,ke).socketJoinAttempted=!0,await n(this,Ee).connect(),n(this,Pe,ke).socketJoinAttempted=!0,n(this,Pe,ke).socketState={state:"connected",reconnected:!1,reconnectionAttempt:void 0}}disconnect(){n(this,Pe,ke).socketJoinAttempted=!1,n(this,Ee).disconnect(),n(this,Pe,ke).socketJoinAttempted=!0,n(this,Pe,ke).socketState={state:"disconnected",reconnected:!1,reconnectionAttempt:void 0}}get isConnected(){try{return n(this,Ee).readyState===1}catch(s){return!1}}sendMessage(s,t,e){const r={};return n(this,Qe).getValue("telemetry").injectContext(r),n(this,Ee).send(s,e!=null?e:L(this,Ac,rh).call(this),t,new TextEncoder().encode(JSON.stringify(r)))}sendMessagePromise(s,t,e,r){const i=parseInt({}.SOCKET_SERVICE_MESSAGE_REQUEST_TIMEOUT,10)||2e4;return this.sendMessagePromiseWithTimeout({event:s,timeout:i,protobuf:t,messageId:e,resp:r})}sendMessagePromiseWithTimeout({event:s,timeout:t,protobuf:e,messageId:r,resp:i}){const a=i!=null?i:s;return new Promise((o,c)=>{const d=(E,P)=>{n(this,Ee).removeListener(a,E),n(this,Ee).removeListener(pg,P),n(this,Ee).removeListener(kr.errorResponse,P),n(this,Ee).removeListener(Es.errorResponse,P)},l=r!=null?r:L(this,Ac,rh).call(this),h={};n(this,Qe).getValue("telemetry").injectContext(h);const f=({id:E,payload:P})=>{if(l===E){let C;try{const _=RR.fromBinary(P);C=new Error(_.errorMessage)}catch(_){C=new Error("failed to parse error message",{cause:_});try{const N=bb.fromBinary(P);C=new Error(N.message)}catch(N){C=new Error("failed to parse error message",{cause:N})}}c(C),d(T,f)}},T=({id:E,payload:P})=>{l===E&&(o({id:E,payload:P}),d(T,f))};n(this,Ee).on(a,T),n(this,Ee).on(pg,f),n(this,Ee).on(kr.errorResponse,f),n(this,Ee).on(Es.errorResponse,f),setTimeout(()=>{d(T,f),c(new Error(`request timeout for callback eventId:${s}`))},t),n(this,Ee).send(s,l,e,new TextEncoder().encode(JSON.stringify(h)))})}on(s,t){n(this,Ee).on(s,t)}onStateEvent(s,t){n(this,Ee).on(s,t)}removeListener(s,t){n(this,Ee).removeListener(s,t)}removeListeners(s){n(this,Ee).removeListeners(s)}flush(){return n(this,Ee).flush()}handleSocketConnectionEvents(){this.onStateEvent("connected",async()=>{this.logger.info("SocketService::Connected to socket-edge"),n(this,ss)&&(clearTimeout(n(this,ss)),m(this,ss,void 0)),n(this,Pe,ke).updateSocketConnectionState("connected")}),this.onStateEvent("disconnected",({code:s,reason:t})=>{var i;this.logger.info("SocketService::Disconnected from socket-edge",{error:{code:s,reason:t},country:S.location.country});const{recv:e,send:r}=(i=n(this,Pe,ke).mediaState)!=null?i:{};e!=null&&e.state&&(e==null?void 0:e.state)!==In.CONNECTED||r!=null&&r.state&&(r==null?void 0:r.state)!==In.CONNECTED?n(this,Qe).getValue("peerSessionStore").emit(b.SOCKET_SERVICE_DISCONNECTED,{joinAttempted:n(this,Pe,ke).joinAttempted}):m(this,ss,setTimeout(()=>{n(this,Qe).getValue("peerSessionStore").emit(b.SOCKET_SERVICE_DISCONNECTED,{joinAttempted:n(this,Pe,ke).joinAttempted}),m(this,ss,void 0)},wO)),n(this,Pe,ke).updateSocketConnectionState("disconnected")}),this.onStateEvent("reconnecting",async()=>{this.logger.info("SocketService::Reconnecting to socket-edge",{country:S.location.country}),n(this,Pe,ke).updateSocketConnectionState("reconnecting")}),this.onStateEvent("reconnectAttempt",async({attempt:s})=>{this.logger.info("SocketService::Attempting to reconnect to socket-edge",{socket:{retryAttempt:s}}),n(this,Pe,ke).updateSocketConnectionState("reconnectAttempt",s)}),this.onStateEvent("reconnectFailure",({attempt:s})=>{this.logger.info("SocketService::Reconnect attempt to socket-edge failed",{socket:{retryAttempt:s}}),n(this,Pe,ke).updateSocketConnectionState("reconnectFailure",s)}),this.onStateEvent("reconnected",async()=>{this.logger.info("SocketService::Reconnected to socket-edge",{connectionState:{joinAttempted:n(this,Pe,ke).mediaJoinAttempted}}),n(this,ss)&&(clearTimeout(n(this,ss)),m(this,ss,void 0)),n(this,Qe).getValue("peerSessionStore").emit(b.SOCKET_SERVICE_RECONNECTED,{wasJoinAttempted:n(this,Pe,ke).mediaJoinAttempted}),n(this,Pe,ke).updateSocketConnectionState("reconnected")}),this.onStateEvent("failed",async()=>{this.logger.info("SocketService::Failed to connect to socket-edge",{country:S.location.country}),n(this,Qe).getValue("peerSessionStore").emit(b.SOCKET_SERVICE_FAILED),n(this,Pe,ke).updateSocketConnectionState("failed")})}},Jr=new WeakMap,Ee=new WeakMap,Pe=new WeakSet,ke=function(){return n(this,Qe).getValue("connectionHandler")},ss=new WeakMap,Qe=new WeakMap,Ic=new WeakSet,sh=function(s){let t=UT.getSocketEdgeDomain(n(this,Qe).getValue("baseURI"));typeof Na(n(this,Qe),"socket_server_base")=="string"&&(t=Na(n(this,Qe),"socket_server_base"));const e=`wss://${t}`,r=new URL(`${e}/ws`),i=this.peerId,a={roomID:this.roomName,peerID:s,authToken:this.authToken,useMediaV2:!0,...i!==s&&{oldPeerID:i},ping:this.capabilities.includes("PING"),capabilities:this.capabilities.map(o=>Sd[o]).join(" "),joinWithDetails:!0,useCfWorker:!0,useStartSession:!0};return Object.entries(a).forEach(([o,c])=>{r.searchParams.append(o,c.toString())}),r.href},Ac=new WeakSet,rh=function(){return`${this.peerId}-${(Math.random()+1).toString(36).substring(7)}`},Og);let Bc=UT;ql([S.trace("SocketService.connect")],Bc.prototype,"connect",1);ql([S.trace("SocketService.disconnect")],Bc.prototype,"disconnect",1);ql([S.trace("SocketService.sendMessagePromise")],Bc.prototype,"sendMessagePromise",1);ql([S.trace("SocketService.sendMessagePromiseWithTimeout")],Bc.prototype,"sendMessagePromiseWithTimeout",1);class RO{constructor(t){u(this,"socketService");this.socketService=t}handleConnectedRoomsDumpRaw({payload:t}){var a;const e=ek.fromBinary(t),r=e.meetings.map(o=>{var c;return{id:o.id,title:o.title,participants:(c=o.participants)!=null?c:[]}});return{parentMeeting:{id:e.parentMeeting.id,title:e.parentMeeting.title,participants:(a=e.parentMeeting.participants)!=null?a:[]},meetings:r}}handleTransferPeerRaw({payload:t}){const e=Rk.fromBinary(t);return{authToken:e.authToken,meetingId:e.meetingId}}handleMovedPeerRaw({payload:t}){const e=lf.fromBinary(t);return{meetingId:e.meetingId,customParticipantId:e.customParticipantId}}handleConnectedRoomsUpdatedRaw({payload:t}){return Bp.fromBinary(t).payloads.map(r=>({id:r.id,title:r.title}))}handleConnectedRoomsDeletedRaw({payload:t}){return fk.fromBinary(t).payloads}async getConnectedRoomsDump(){const t=await this.socketService.sendMessagePromise(x.getConnectedRoomsDump);return this.handleConnectedRoomsDumpRaw(t)}async createConnectedRooms(t){const{payload:e}=await this.socketService.sendMessagePromise(x.createConnectedRooms,ik.toBinary({payloads:t}));return Bp.fromBinary(e).payloads.map(i=>({id:i.id,title:i.title}))}async updateConnectedRooms(t){}async disableConnectedRooms(t){const e=t.map(i=>({id:i})),r=await this.socketService.sendMessagePromise(x.deleteConnectedRooms,gk.toBinary({payloads:e}));return this.handleConnectedRoomsDeletedRaw(r)}async movePeersBetweenRooms(t){try{const e=await this.socketService.sendMessagePromise(x.movePeers,Pk.toBinary({sourceMeetingId:t.sourceMeetingId,destinationMeetingId:t.destinationMeetingId,participants:t.participants}));return new TextDecoder().decode(e.payload).includes("error")?{success:!1,error:"failed to move participants"}:{success:!0}}catch(e){return{success:!1,error:e}}}}var bO=Object.defineProperty,kO=Object.getOwnPropertyDescriptor,IO=(s,t,e,r)=>{for(var i=r>1?void 0:r?kO(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&bO(t,e,i),i},ys;class $T extends Ft{constructor(e){const r=e.getValue("logger");super(r);u(this,"meetings",[]);u(this,"parentMeeting",null);g(this,ys,void 0);m(this,ys,e)}get supportsConnectedMeetings(){return n(this,ys).getValue("self").id!==""}get isActive(){return this.meetings.length!==0}validateConnectedMeetingsAction(){if(!this.supportsConnectedMeetings)throw new Error(`You are not allowed to perform this action.
13
13
  Please connect with our support team to enable connected meetings.`)}async getConnectedMeetings(){return this.validateConnectedMeetingsAction(),await n(this,ys).getValue("connectedMeetingsSocketHandler").getConnectedRoomsDump()}async createMeetings(e){return this.validateConnectedMeetingsAction(),(await n(this,ys).getValue("connectedMeetingsSocketHandler").createConnectedRooms(e)).map(i=>({id:i.id,title:i.title}))}async updateMeetings(e){this.validateConnectedMeetingsAction(),await n(this,ys).getValue("connectedMeetingsSocketHandler").updateConnectedRooms(e.map(r=>({meetingId:r.id,title:r.title})))}async deleteMeetings(e){this.validateConnectedMeetingsAction();const r=this.meetings.map(a=>e.includes(a.id)&&a.participants.length!==0?this.moveParticipants(a.id,this.parentMeeting.id,a.participants.map(o=>o.id)):Promise.resolve());return await Promise.all(r),await n(this,ys).getValue("connectedMeetingsSocketHandler").disableConnectedRooms(e)}async moveParticipants(e,r,i){this.validateConnectedMeetingsAction();const a=await n(this,ys).getValue("connectedMeetingsSocketHandler").movePeersBetweenRooms({sourceMeetingId:e,destinationMeetingId:r,participants:i.map(o=>({id:o}))});return a.success&&this.moveSuccessHandler(e,r,i),a}async moveParticipantsWithCustomPreset(e,r,i){this.validateConnectedMeetingsAction();const a=await n(this,ys).getValue("connectedMeetingsSocketHandler").movePeersBetweenRooms({sourceMeetingId:e,destinationMeetingId:r,participants:i});return a.success&&this.moveSuccessHandler(e,r,i.map(o=>o.id)),a}moveSuccessHandler(e,r,i){const a=new Map;[...this.parentMeeting.participants,...this.meetings.flatMap(o=>o.participants)].forEach(o=>a.set(o.id,o)),r===this.parentMeeting.id&&(this.parentMeeting.participants=this.parentMeeting.participants.concat(i.map(o=>a.get(o)))),e===this.parentMeeting.id&&(this.parentMeeting.participants=this.parentMeeting.participants.filter(o=>!i.includes(o.id))),this.meetings=this.meetings.map(o=>{if(r===o.id){const c=o.participants.concat(i.map(d=>a.get(d)));return{...o,participants:c}}if(e===o.id){const c=o.participants.filter(d=>!i.includes(d.id));return{...o,participants:c}}return o})}}ys=new WeakMap;IO([kt({maxInvocations:60,period:60})],$T.prototype,"getConnectedMeetings",1);var AO=Object.defineProperty,MO=Object.getOwnPropertyDescriptor,Fh=(s,t,e,r)=>{for(var i=r>1?void 0:r?MO(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&AO(t,e,i),i},ue,Ng;const FT=(Ng=class{constructor(s){u(this,"connectedMeetings");g(this,ue,void 0);m(this,ue,s),this.connectedMeetings=new $T(s)}get telemetry(){return n(this,ue).getValue("telemetry")}get logger(){return n(this,ue).getValue("logger")}static init(s){const t=new FT(s);return t.connectedMeetings.supportsConnectedMeetings&&(t.setupEvents(),s.getValue("self").once("roomJoined",()=>t.getConnectedMeetings())),t}getConnectedMeetings(){this.connectedMeetings.getConnectedMeetings()}setupEvents(){n(this,ue).getValue("connectedMeetingsSocketHandler").socketService.on(x.getConnectedRoomsDump,this.handleConnectedRoomsDump.bind(this)),n(this,ue).getValue("connectedMeetingsSocketHandler").socketService.on(x.transferPeer,this.handleTransferPeer.bind(this)),n(this,ue).getValue("connectedMeetingsSocketHandler").socketService.on(x.movedPeer,this.handleMovedPeer.bind(this)),n(this,ue).getValue("connectedMeetingsSocketHandler").socketService.on(x.connectedRoomsUpdated,this.handleConnectedRoomsUpdated.bind(this)),n(this,ue).getValue("connectedMeetingsSocketHandler").socketService.on(x.connectedRoomsDeleted,this.handleConnectedRoomsDeleted.bind(this))}handleTransferPeer(s){const t=n(this,ue).getValue("connectedMeetingsSocketHandler").handleTransferPeerRaw(s);return this.switchMeeting(t)}async switchMeeting({authToken:s,meetingId:t}){var i,a,o,c;if(!this.connectedMeetings.supportsConnectedMeetings)throw new Error(`You are not allowed to perform this action.
14
14
  Please connect with our support team to enable connected meetings.`);this.logger.info("ConnectedMeetingsController::switchMeeting:: asking ui-kit to show switching breakout UI"),this.connectedMeetings.emit("changingMeeting",t);const e={video:n(this,ue).getValue("self").videoEnabled,audio:n(this,ue).getValue("self").audioEnabled};try{n(this,ue).getValue("self").cleanupEvents(),await n(this,ue).getValue("meeting").leave("connected-meeting")}catch(d){this.logger.error(`ConnectedMeetingsController:: switchMeeting:: issues in leaving previous meeting. Meeting Id: ${(a=(i=n(this,ue).getValue("meeting"))==null?void 0:i.meta)==null?void 0:a.meetingId}`,{error:d})}this.logger.info(`ConnectedMeetingsController::switchMeeting:: initializing new meeting. Meeting Id: ${t}`);const r=await HT.init({...n(this,ue).getValue("options"),cachedUserDetails:null,defaults:{...n(this,ue).getValue("options").defaults,...e,mediaHandler:n(this,ue).getValue("self")},authToken:s});this.logger.info(`ConnectedMeetingsController::switchMeeting:: initialized new meeting. Meeting Id: ${(o=r==null?void 0:r.meta)==null?void 0:o.meetingId}`);try{const{hidden:d}=n(this,ue).getValue("self");r.self.setName(n(this,ue).getValue("self").name),await r.join(),d&&r.self.hide()}catch(d){this.logger.error("ConnectedMeetingsController.joinRoom",{error:d})}return this.logger.info(`ConnectedMeetingsController::switchMeeting:: asking ui-kit to show in-meeting ui of newly joined meeting id: ${(c=r==null?void 0:r.meta)==null?void 0:c.meetingId}`),this.connectedMeetings.emit("meetingChanged",r),r}handleConnectedRoomsDump(s){const t=n(this,ue).getValue("connectedMeetingsSocketHandler").handleConnectedRoomsDumpRaw(s);this.connectedMeetings.meetings=t.meetings.map(e=>({id:e.id,title:e.title,participants:e.participants||[]})),this.connectedMeetings.parentMeeting={id:t.parentMeeting.id,title:t.parentMeeting.title,participants:t.parentMeeting.participants},this.emitStateUpdate()}handleMovedPeer(s){return n(this,ue).getValue("connectedMeetingsSocketHandler").handleMovedPeerRaw(s)}handleConnectedRoomsUpdated(s){const t=n(this,ue).getValue("connectedMeetingsSocketHandler").handleConnectedRoomsUpdatedRaw(s),e=new Map;this.connectedMeetings.meetings.forEach(r=>{e.set(r.id,r)}),t.forEach(r=>{e.has(r.id)?e.get(r.id).title=r.title:e.set(r.id,{...r,participants:[]})}),this.connectedMeetings.meetings=Array.from(e.values()),this.emitStateUpdate()}handleConnectedRoomsDeleted(s){const e=n(this,ue).getValue("connectedMeetingsSocketHandler").handleConnectedRoomsDeletedRaw(s).map(r=>r.id);this.connectedMeetings.meetings=this.connectedMeetings.meetings.filter(r=>!e.includes(r.id)),this.emitStateUpdate()}emitStateUpdate(){this.connectedMeetings.emit("stateUpdate",{meetings:this.connectedMeetings.meetings,parentMeeting:this.connectedMeetings.parentMeeting})}},ue=new WeakMap,Ng);let jl=FT;Fh([S.trace("ConnectedMeetingsController.getConnectedMeetings")],jl.prototype,"getConnectedMeetings",1);Fh([S.trace("ConnectedMeetingsController.setupEvents")],jl.prototype,"setupEvents",1);Fh([S.trace("ConnectedMeetingsController.switchMeeting")],jl.prototype,"switchMeeting",1);var DO=Object.defineProperty,OO=Object.getOwnPropertyDescriptor,Gl=(s,t,e,r)=>{for(var i=r>1?void 0:r?OO(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&DO(t,e,i),i};const Pn=class{constructor(s,t,e){u(this,"apiBase");u(this,"selfController");u(this,"pollController");u(this,"chatController");u(this,"metaController");u(this,"storesManager");u(this,"stageController");u(this,"pluginController");u(this,"internalsController");u(this,"recordingController");u(this,"livestreamController");u(this,"participantController");u(this,"connectedMeetingsController");u(this,"telemetry");u(this,"logger");this.apiBase=s,this.storesManager=t.storesManager,this.metaController=t.metaController,this.selfController=t.selfController,this.chatController=t.chatController,this.pollController=t.pollController,this.stageController=t.stageController,this.pluginController=t.pluginController,this.recordingController=t.recordingController,this.internalsController=t.internalsController,this.participantController=t.participantController,this.livestreamController=t.livestreamController,this.connectedMeetingsController=t.connectedMeetingsController,this.telemetry=e.getValue("telemetry"),this.logger=e.getValue("logger")}static async init(s){var D,$;const{peerId:t,apiBase:e,authToken:r,meetingId:i,organizationId:a,cachedUserDetails:o,logger:c}=s.getAllValues();if(PT(s),Te.isSupported()===!1)throw new R("Browser not supported","0010",c,!0);const d=UM(s,{authToken:r,baseURL:e,cachedUserDetails:o});d.setRoomName(i),d.setRoomUUID(i),d.setOrganizationId(a),d.setHeader("tracing-id",t),s.setValue("apiClient",d);const l=new S0(s);s.setValue("connectionHandler",l);const h=Pn.createSocketService(s),p=h.connect(),f=d.getUserDetails(),T=d.getPlugins();let E,P="";try{await Pn.setupFlagsmith(s)}catch(G){c.error("Failed to setup flagsmith",{error:G})}try{await p}catch(G){c.error("[Controller]: Failed to connect to socket server:",{error:G})}try{({meetingTitle:P}=await d.getRoomNodeData()),E=await f,c.info("CF SFU is being used."),s.setValue("presetName",E.preset.name)}catch(G){c.error("Failed to get room metadata",{error:G})}const C=Nu.init(E.preset,!s.getValue("modules").theme),_=Uu.init(s,C.viewType,E.preset.permissions),N=Pn.setupControllers(h,s,E,T,P,C,_);d0(C)&&((D=Pn.createRoomNodeClient(s,h).initializeConnection(E.participant.name,i,!1,_))==null||D.catch(ee=>{c.error("[Controller]: Failed to queue partial media room promise:",{error:ee})})),S.location.country=($=d.ipInfo)==null?void 0:$.country;const{controllers:U}=await N;return ow(),new Pn(e,U,s)}static async setupFlagsmith(s){var l;const{peerId:t,baseURI:e,overrides:r,meetingId:i,organizationId:a,logger:o}=s.getAllValues(),c=aw(i),d={entity:fu.PEER,clientId:a,isAnonUser:!a,sdkVersion:s.getValue("sdkVersion"),presetName:s.getValue("presetName"),meetingHash:c,roomName:i,...Te.getDeviceInfo(),isReactNative:navigator.isReactNative};try{const h=(l=r==null?void 0:r.whitelabelled_flags_endpoint)==null||l?tn({servicePrefix:"flags",baseURI:e}):"edge.api.flagsmith.com";await s.getValue("flagsmith").identify(`${fu.PEER}_${t}`,JSON.parse(JSON.stringify(d)),!1,5e3,h,o),o.info("flagsmith::allFlags",{flags:JSON.stringify(s.getValue("flagsmith").getAllFlags())},!0)}catch(h){o.error("Failed to fetch flagsmith flags")}}static async setupControllers(s,t,e,r,i,a,o){var k,Ve,Pr;const c=t.getValue("modules"),{participant:d}=e,l=t.getValue("defaults"),h=t.getValue("logger"),{viewType:p,mediaConstraints:{audio:f}}=a;t.setValue("viewType",p),t.setValue("defaults",{mediaConfiguration:{audio:{enableHighBitrate:(k=f.enableHighBitrate)!=null?k:!1,enableStereo:(Ve=f.enableStereo)!=null?Ve:!1}},...l}),t.setValue("maxPreferredStreams",Te.isMobile()?a.maxVideoStreams.mobile:a.maxVideoStreams.desktop);let T,E,P,C,_,N,U,D,$;const G=new XD(t,s),ee=new RO(s);t.setValue("connectedMeetingsSocketHandler",ee);const Xe=new Bl(t,s),as=new is(t,s),si=new iO(s),os=new CT(t,s),I=new nO(t,s),y=new QD(s),w=new an(t,s),V=await ti.init(t,os,d,o,a);t.setValue("selfController",V);const pe=await wf.init(t,V.self,os,G,i);if(c.participant&&(D=new Er(t,V.self,os)),(Pr=c.e2ee)!=null&&Pr.enabled&&c.e2ee.manager.init(h,t.getValue("peerSessionStore")),c.chat&&(E=await Ps.init(t,as,w,V.self,D.participants)),c.internals&&(_=await kh.init(t)),c.livestream&&a.viewType===bt.Livestream&&t.getValue("flagsmith").hasFeature(Q.LIVESTREAM)&&(U=new Nf(t,V.self,y)),a.viewType!==bt.Chat){if(c.poll&&(T=await Ef.init(t,V.self,Xe)),c.recording&&(N=new If(t,V.self,os)),c.stage&&(P=new Rf(t,si,os,V.self,D.participants)),c.plugin){if(!D)throw new R("The plugin module cannot be initialized without the `participant` module","0102");const Fs=await r;C=await xc.init(t,Fs,I,as,E==null?void 0:E.chat,V.self,D.participants,i)}if(c.connectedMeetings&&($=await jl.init(t)),c.pip){const Fs=await Tu._init(t,V.self);t.setValue("pip",Fs)}}const O={storesManager:new uD(t,I),pollController:T,selfController:V,metaController:pe,chatController:E,stageController:P,pluginController:C,recordingController:N,internalsController:_,livestreamController:U,participantController:D,connectedMeetingsController:$};return{theme:a,permissions:o,controllers:O}}static createRoomNodeClient(s,t){const{peerId:e}=s.getAllValues();return ET(s,{socket:t,peerId:e})}static createSocketService(s){const{peerId:t,meetingId:e,authToken:r}=s.getAllValues(),i=["PING"];return new Bc(s,{peerId:t,meetingId:e,authToken:r,capabilities:i})}};let Hc=Pn;Gl([S.trace("Controller.init")],Hc,"init",1);Gl([S.trace("setupFlagsmith")],Hc,"setupFlagsmith",1);Gl([S.trace("Controller.createRoomNodeClient")],Hc,"createRoomNodeClient",1);Gl([S.trace("Controller.createSocketService")],Hc,"createSocketService",1);class NO{constructor(){u(this,"battery");u(this,"logger");u(this,"init",async t=>{this.logger=t;try{"getBattery"in navigator&&(this.battery=await navigator.getBattery(),this.battery.addEventListener("chargingchange",this.updateChargeInfo),this.battery.addEventListener("levelchange",this.updateLevelInfo),this.updateLevelInfo(),this.updateChargeInfo())}catch(e){t.error("Error getting battery",e)}});u(this,"updateChargeInfo",()=>{var t;this.logger.log(`Battery charging? ${(t=this.battery)!=null&&t.charging?"Yes":"No"}`)});u(this,"updateLevelInfo",()=>{if(!this.battery){this.logger.log("Battery level: Not known");return}this.logger.log(`Battery level: ${this.battery.level*100}%`)});u(this,"cleanup",()=>{var t,e;"getBattery"in navigator&&((t=this.battery)==null||t.removeEventListener("chargingchange",this.updateChargeInfo),(e=this.battery)==null||e.removeEventListener("levelchange",this.updateLevelInfo))})}}const gg=new NO;function VO(s,t){s.startsWith("eyJ")||console.error("Invalid auth token provided. Ensure you are passing a %cparticipant `authToken`%c — not an Org API Key or an incorrectly formatted token.\nYou get the participant token from the Add Participant API: https://docs.realtime.cloudflare.com/api#/operations/add_participant","font-weight: bold","font-weight: normal");try{const{meetingId:e,orgId:r,participantId:i}=JSON.parse(atob(s.split(".")[1]));if(!e)throw Error(`Received V1 auth token ${s}`);let a=hi.baseURI.prod;t&&(a=t);const o=`https://${tn({servicePrefix:"api",baseURI:a})}`;return{meetingId:e,orgId:r,participantId:i,baseURI:a,apiBase:o}}catch(e){throw new R("Invalid auth token","0004")}}var Kr,Qi,Xi,Mc,Pl,BT;class LO{constructor(){g(this,Pl);g(this,Kr,new Audio);g(this,Qi,new MediaStream);g(this,Xi,new Map);g(this,Mc,void 0);n(this,Kr).srcObject=n(this,Qi),n(this,Kr).autoplay=!0}async playTracks(t){return t.forEach(e=>{n(this,Xi).has(e.id)||(n(this,Qi).addTrack(e),n(this,Xi).set(e.id,e))}),this.play()}setSpeakerDevice(t){typeof HTMLAudioElement.prototype.setSinkId=="function"&&n(this,Kr).setSinkId(t)}removeTrack(t){const e=n(this,Xi).get(t);e&&(n(this,Qi).removeTrack(e),n(this,Xi).delete(t))}async play(){return n(this,Kr).srcObject=n(this,Qi),n(this,Kr).play().catch(t=>{L(this,Pl,BT).call(this,t)})}onError(t){m(this,Mc,t)}}Kr=new WeakMap,Qi=new WeakMap,Xi=new WeakMap,Mc=new WeakMap,Pl=new WeakSet,BT=function(t){var e;(e=n(this,Mc))==null||e.call(this,t)};var Zi;class xO extends LO{constructor(){super();g(this,Zi,void 0);m(this,Zi,new Map)}addParticipantTrack(e,r){n(this,Zi).set(e,r.id),this.playTracks([r])}removeParticipantTrack(e){const r=n(this,Zi).get(e);r&&this.removeTrack(r),n(this,Zi).delete(e)}}Zi=new WeakMap;var UO=Object.defineProperty,$O=Object.getOwnPropertyDescriptor,Wl=(s,t,e,r)=>{for(var i=r>1?void 0:r?$O(t,e):t,a=s.length-1,o;a>=0;a--)(o=s[a])&&(i=(r?o(t,e,i):o(i))||i);return r&&i&&UO(t,e,i),i},He,en,Vg;let Zr=(Vg=class{constructor(t,e){g(this,He,void 0);g(this,en,void 0);m(this,en,t),m(this,He,e)}get peerId(){return n(this,en).getValue("peerId")}static initMedia(t={},e=!1,r=void 0){var d;const i=(d=r==null?void 0:r.peerId)!=null?d:gr.v4(),a=hr.createContext(i,{peerId:i}),o=a.getValue("logger");o.init(a);const c=new Hf(o);return c.init(t,e,a),a.setValue("defaults",{mediaHandler:c}),c}static async init(t){var T,E,P,C,_,N,U;Te.init();const{mediaHandler:e}=(T=t.defaults)!=null?T:{},r=(e==null?void 0:e.peerId)||((P=(E=t==null?void 0:t.cachedUserDetails)==null?void 0:E.peerId)!=null?P:gr.v4()),{authToken:i,baseURI:a}=t,{meetingId:o,...c}=VO(i,a);window.__zone_symbol__DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION=!0;const d=Zr.setupContext(r,t,o,c),l=d.getValue("telemetry"),h=d.getValue("logger");zT(h),gg.init(h),l.init(d,{roomName:o,userId:c.participantId,organizationId:c.orgId,peerId:r},(_=(C=t.modules)==null?void 0:C.tracing)!=null?_:!0),h.init(d),h.info("Client::init::options",{clientInitOptions:{...t,authToken:`${(N=t.authToken)==null?void 0:N.slice(0,10)}...
15
- ${(U=t.authToken)==null?void 0:U.slice(-10)}`}});const p=await Hc.init(d),f=new Zr(d,p);return d.setValue("meeting",f),f}static setupContext(t,e,r,i){var d,l;const a=hr.createContext(t,e),o={...YC,...e==null?void 0:e.modules},c=e.defaults||{audio:!0,video:!0};return a.setValue("options",e),a.setValue("peerId",t),a.setValue("modules",o),a.setValue("sdkName","web-core"),a.setValue("meetingId",r),a.setValue("apiBase",i.apiBase),a.setValue("baseURI",i.baseURI),a.setValue("userId",i.participantId),a.setValue("organizationId",i.orgId),a.setValue("authToken",e.authToken),a.setValue("overrides",(d=e.overrides)!=null?d:{}),a.setValue("env",QC({baseURI:i.baseURI})),a.setValue("defaults",c),a.setValue("onError",e.onError||(()=>{})),a.setValue("cachedUserDetails",_s(e.cachedUserDetails)),a.setValue("sdkVersion","1.2.1-staging.8"),(l=e.modules)!=null&&l.experimentalAudioPlayback&&a.setValue("audioPlayback",new xO),a}async join(){const{selfController:t}=n(this,He);return t.self.roomJoined?null:t.joinRoom()}async leave(t){gg.cleanup(),n(this,en).getValue("peerSessionStore").reset();const{selfController:e}=n(this,He);return e.leaveRoom(t)}get participants(){var t;return(t=n(this,He).participantController)==null?void 0:t.participants}get self(){var t;return(t=n(this,He).selfController)==null?void 0:t.self}get meta(){var t;return(t=n(this,He).metaController)==null?void 0:t.meta}get ai(){var t;return(t=n(this,He).metaController)==null?void 0:t.ai}get plugins(){var t;return(t=n(this,He).pluginController)==null?void 0:t.plugins}get chat(){var t;return(t=n(this,He).chatController)==null?void 0:t.chat}get polls(){var t;return(t=n(this,He).pollController)==null?void 0:t.polls}get connectedMeetings(){var t;return(t=n(this,He).connectedMeetingsController)==null?void 0:t.connectedMeetings}get recording(){var t;return(t=n(this,He).recordingController)==null?void 0:t.recording}get livestream(){var t;return(t=n(this,He).livestreamController)==null?void 0:t.livestream}get stage(){var t;return(t=n(this,He).stageController)==null?void 0:t.stage}get stores(){return n(this,He).storesManager}get audio(){return n(this,en).getValue("audioPlayback")}get __internals__(){var t;return(t=n(this,He).internalsController)==null?void 0:t.internals}async joinRoom(){return this.join()}async leaveRoom(t){return this.leave(t)}},He=new WeakMap,en=new WeakMap,Vg);Wl([ct("0002"),Sr.executeWithLock({methodName:"meeting.join",lockName:"Client.join",timeout:3e3})],Zr.prototype,"join",1);Wl([ct("0003")],Zr.prototype,"leave",1);Wl([ct("0001"),Sr.executeWithLock({methodName:"Client.init",lockName:"Client.init",timeout:3e3})],Zr,"init",1);Zr=Wl([ct("0000")],Zr);const HT=Zr;module.exports=HT;
15
+ ${(U=t.authToken)==null?void 0:U.slice(-10)}`}});const p=await Hc.init(d),f=new Zr(d,p);return d.setValue("meeting",f),f}static setupContext(t,e,r,i){var d,l;const a=hr.createContext(t,e),o={...YC,...e==null?void 0:e.modules},c=e.defaults||{audio:!0,video:!0};return a.setValue("options",e),a.setValue("peerId",t),a.setValue("modules",o),a.setValue("sdkName","web-core"),a.setValue("meetingId",r),a.setValue("apiBase",i.apiBase),a.setValue("baseURI",i.baseURI),a.setValue("userId",i.participantId),a.setValue("organizationId",i.orgId),a.setValue("authToken",e.authToken),a.setValue("overrides",(d=e.overrides)!=null?d:{}),a.setValue("env",QC({baseURI:i.baseURI})),a.setValue("defaults",c),a.setValue("onError",e.onError||(()=>{})),a.setValue("cachedUserDetails",_s(e.cachedUserDetails)),a.setValue("sdkVersion","1.2.2-staging.1"),(l=e.modules)!=null&&l.experimentalAudioPlayback&&a.setValue("audioPlayback",new xO),a}async join(){const{selfController:t}=n(this,He);return t.self.roomJoined?null:t.joinRoom()}async leave(t){gg.cleanup(),n(this,en).getValue("peerSessionStore").reset();const{selfController:e}=n(this,He);return e.leaveRoom(t)}get participants(){var t;return(t=n(this,He).participantController)==null?void 0:t.participants}get self(){var t;return(t=n(this,He).selfController)==null?void 0:t.self}get meta(){var t;return(t=n(this,He).metaController)==null?void 0:t.meta}get ai(){var t;return(t=n(this,He).metaController)==null?void 0:t.ai}get plugins(){var t;return(t=n(this,He).pluginController)==null?void 0:t.plugins}get chat(){var t;return(t=n(this,He).chatController)==null?void 0:t.chat}get polls(){var t;return(t=n(this,He).pollController)==null?void 0:t.polls}get connectedMeetings(){var t;return(t=n(this,He).connectedMeetingsController)==null?void 0:t.connectedMeetings}get recording(){var t;return(t=n(this,He).recordingController)==null?void 0:t.recording}get livestream(){var t;return(t=n(this,He).livestreamController)==null?void 0:t.livestream}get stage(){var t;return(t=n(this,He).stageController)==null?void 0:t.stage}get stores(){return n(this,He).storesManager}get audio(){return n(this,en).getValue("audioPlayback")}get __internals__(){var t;return(t=n(this,He).internalsController)==null?void 0:t.internals}async joinRoom(){return this.join()}async leaveRoom(t){return this.leave(t)}},He=new WeakMap,en=new WeakMap,Vg);Wl([ct("0002"),Sr.executeWithLock({methodName:"meeting.join",lockName:"Client.join",timeout:3e3})],Zr.prototype,"join",1);Wl([ct("0003")],Zr.prototype,"leave",1);Wl([ct("0001"),Sr.executeWithLock({methodName:"Client.init",lockName:"Client.init",timeout:3e3})],Zr,"init",1);Zr=Wl([ct("0000")],Zr);const HT=Zr;module.exports=HT;