"use strict";(self.webpackChunklernplattform_admin_frontend=self.webpackChunklernplattform_admin_frontend||[]).push([[1694],{ezoW:function(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.SimulcastLayers=void 0,function(e){e[e.Low=0]="Low",e[e.LowAndMedium=1]="LowAndMedium",e[e.LowAndHigh=2]="LowAndHigh",e[e.Medium=3]="Medium",e[e.MediumAndHigh=4]="MediumAndHigh",e[e.High=5]="High"}(i=t.SimulcastLayers||(t.SimulcastLayers={})),t.default=i},PPZC:function(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.AudioLogEvent=void 0,function(e){e[e.DeviceChanged=0]="DeviceChanged",e[e.MutedLocal=1]="MutedLocal",e[e.UnmutedLocal=2]="UnmutedLocal",e[e.Connected=3]="Connected",e[e.ConnectFailed=4]="ConnectFailed",e[e.RedmicStartLoss=5]="RedmicStartLoss",e[e.RedmicEndLoss=6]="RedmicEndLoss"}(i=t.AudioLogEvent||(t.AudioLogEvent={})),t.default=i},YbMW:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("6SO8"),s=i("bjg3"),r=i("x8On"),a=i("Tsvd"),c=i("m/NO"),d=i("fi20"),l=i("BkFD"),h=i("XCDq"),u=i("Aplu"),g=i("PPZC"),f=i("10yS");class v{constructor(e,t,i=v.INTERVAL_MS){this.audioVideoController=e,this.logger=t,this.interval=i,this.intervalScheduler=null,this.metricsAddTime=(e,t,i)=>{},this.metricsLogEvent=(e,t)=>{}}toAttribute(e){return this.toSuffix(e).substring(1)}toSuffix(e){return e.toLowerCase()===e?`_${e}`:e.toUpperCase()===e?`_${e.toLowerCase()}`:e.replace(/([A-Z][a-z]+)/g,(function(e){return`_${e}`})).replace(/([A-Z][A-Z]+)/g,(function(e){return`_${e}`})).toLowerCase()}logLatency(e,t,i){const n=this.toSuffix(e);this.logEventTime("meeting"+n,t,i)}logStateTimeout(e,t){const i=this.toSuffix(e);this.logEvent("meeting_session_state_timeout",Object.assign(Object.assign({},t),{state:`state${i}`}))}logAudioEvent(e,t){const i="audio"+this.toSuffix(g.default[e]);this.logEvent(i,t)}logVideoEvent(e,t){const i="video"+this.toSuffix(f.default[e]);this.logEvent(i,t)}logEventTime(e,t,i={}){const n=Object.assign(Object.assign({},i),{call_id:this.audioVideoController.configuration.meetingId,client_type:v.CLIENT_TYPE,metric_type:"latency"});this.logger.debug((()=>`[StatsCollector] ${e}: ${JSON.stringify(n)}`)),this.metricsAddTime(e,t,n)}logMeetingSessionStatus(e){const t=`${e.statusCode()}`;this.logEvent(t);const i={status:t,status_code:`${e.statusCode()}`};this.logEvent("meeting_session_status",i),e.isTerminal()&&this.logEvent("meeting_session_stopped",i),e.isAudioConnectionFailure()&&this.logEvent("meeting_session_audio_failed",i),e.isFailure()&&this.logEvent("meeting_session_failed",i)}logLifecycleEvent(e,t){const i={lifecycle_event:`lifecycle${this.toSuffix(c.default[e])}`,lifecycle_event_code:`${e}`,lifecycle_event_condition:`condition${this.toSuffix(d.default[t])}`,lifecycle_event_condition_code:`${t}`};this.logEvent("meeting_session_lifecycle",i)}logEvent(e,t={}){const i=Object.assign(Object.assign({},t),{call_id:this.audioVideoController.configuration.meetingId,client_type:v.CLIENT_TYPE});this.logger.debug((()=>`[StatsCollector] ${e}: ${JSON.stringify(i)}`)),this.metricsLogEvent(e,i)}start(e,t){return!this.intervalScheduler&&(this.logger.info("Starting StatsCollector"),this.signalingClient=e,this.videoStreamIndex=t,this.clientMetricReport=new o.default(this.logger,this.videoStreamIndex,this.audioVideoController.configuration.credentials.attendeeId),this.intervalScheduler=new l.default(this.interval),this.intervalScheduler.start((()=>n(this,void 0,void 0,(function*(){yield this.getStatsWrapper()})))),!0)}stop(){this.logger.info("Stopping StatsCollector"),this.intervalScheduler&&this.intervalScheduler.stop(),this.intervalScheduler=null}updateMetricValues(e,t){const i=t?this.clientMetricReport.streamMetricReports[Number(e.ssrc)]:this.clientMetricReport.globalMetricReport;let n;n=t?this.clientMetricReport.getMetricMap(i.mediaType,i.direction):this.clientMetricReport.getMetricMap();for(const t in e)t in n&&("number"==typeof e[t]?(i.previousMetrics[t]=i.currentMetrics[t],i.currentMetrics[t]=e[t]):"string"==typeof e[t]?i.currentStringMetrics[t]=e[t]:this.logger.error(`Unknown metric value type ${typeof e[t]} for metric ${t}`))}processRawMetricReports(e){this.clientMetricReport.currentSsrcs={};const t=Date.now();for(const t of e){const e=this.isStreamRawMetricReport(t.type);if(e){const e=this.clientMetricReport.streamMetricReports[Number(t.ssrc)];if(e)e.streamId=this.videoStreamIndex.streamIdForSSRC(Number(t.ssrc));else{const e=new a.default;e.mediaType=this.getMediaType(t),e.direction=this.getDirectionType(t),this.videoStreamIndex.allStreams().empty()||(e.streamId=this.videoStreamIndex.streamIdForSSRC(Number(t.ssrc))),this.clientMetricReport.streamMetricReports[Number(t.ssrc)]=e}this.clientMetricReport.currentSsrcs[Number(t.ssrc)]=1}this.updateMetricValues(t,e)}this.clientMetricReport.removeDestroyedSsrcs(),this.clientMetricReport.previousTimestampMs=this.clientMetricReport.currentTimestampMs,this.clientMetricReport.currentTimestampMs=t,this.clientMetricReport.print()}addStreamMetricDimensionFrames(e,t){const i=this.clientMetricReport.getStreamDimensionMap();for(const n in t.currentStringMetrics)if(n in i){const o=h.SdkStreamDimension.create();o.type=i[n];const s=h.SdkDimensionValue.create();s.stringValue=t.currentStringMetrics[n],o.value=s,e.dimensions.push(o)}}addMetricFrame(e,t,i,n){const o=i.type,s=i.transform,r=i.source,a=t.streamMetricFrames.length,c=t.streamMetricFrames[a-1];if(o){const i=h.SdkMetric.create();i.type=o,i.value=s(r||e,n),n?c.metrics.push(i):t.globalMetrics.push(i)}}addGlobalMetricsToProtobuf(e){const t=this.clientMetricReport.getMetricMap();for(const i in this.clientMetricReport.globalMetricReport.currentMetrics)this.addMetricFrame(i,e,t[i])}addStreamMetricsToProtobuf(e){for(const t in this.clientMetricReport.streamMetricReports){const i=this.clientMetricReport.streamMetricReports[t],n=h.SdkStreamMetricFrame.create();n.streamId=i.streamId,n.metrics=[],this.addStreamMetricDimensionFrames(n,i),e.streamMetricFrames.push(n);const o=this.clientMetricReport.getMetricMap(i.mediaType,i.direction);for(const n in i.currentMetrics)this.addMetricFrame(n,e,o[n],Number(t));for(const n in i.currentStringMetrics)this.addMetricFrame(n,e,o[n],Number(t))}}makeClientMetricProtobuf(){const e=h.SdkClientMetricFrame.create();return e.globalMetrics=[],e.streamMetricFrames=[],this.addGlobalMetricsToProtobuf(e),this.addStreamMetricsToProtobuf(e),e}sendClientMetricProtobuf(e){this.signalingClient.sendClientMetrics(e)}isStreamRawMetricReport(e){return["inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp"].includes(e)}getMediaType(e){return"audio"===e.kind?r.default.AUDIO:r.default.VIDEO}getDirectionType(e){const{type:t}=e;return"inbound-rtp"===t||"remote-outbound-rtp"===t?s.default.DOWNSTREAM:s.default.UPSTREAM}isValidStandardRawMetric(e){return"inbound-rtp"===e.type||"outbound-rtp"===e.type||"remote-inbound-rtp"===e.type||"remote-outbound-rtp"===e.type||"candidate-pair"===e.type&&"succeeded"===e.state}isValidSsrc(e){let t=!0;return this.isStreamRawMetricReport(e.type)&&this.getDirectionType(e)===s.default.DOWNSTREAM&&this.getMediaType(e)===r.default.VIDEO&&(t=this.videoStreamIndex.streamIdForSSRC(Number(e.ssrc))>0),t}isValidRawMetricReport(e){return this.isValidStandardRawMetric(e)&&this.isValidSsrc(e)}filterRawMetricReports(e){const t=[];for(const i of e)this.isValidRawMetricReport(i)&&t.push(i);return t}handleRawMetricReports(e){const t=this.filterRawMetricReports(e);this.logger.debug((()=>`Filtered raw metrics : ${JSON.stringify(t)}`)),this.processRawMetricReports(t);const i=this.makeClientMetricProtobuf();this.sendClientMetricProtobuf(i),this.audioVideoController.forEachObserver((e=>{u.Maybe.of(e.metricsDidReceive).map((t=>t.bind(e)(this.clientMetricReport.clone())))}))}getStatsWrapper(){return n(this,void 0,void 0,(function*(){if(!this.audioVideoController.rtcPeerConnection)return;const e=[];try{const t=yield this.audioVideoController.rtcPeerConnection.getStats();this.clientMetricReport.rtcStatsReport=t,t.forEach((t=>{e.push(t)})),this.handleRawMetricReports(e)}catch(e){this.logger.error(e.message)}}))}}t.default=v,v.INTERVAL_MS=1e3,v.CLIENT_TYPE="amazon-chime-sdk-js"},"10yS":function(e,t){var i;Object.defineProperty(t,"__esModule",{value:!0}),t.VideoLogEvent=void 0,function(e){e[e.InputAttached=0]="InputAttached",e[e.SendingFailed=1]="SendingFailed",e[e.SendingSuccess=2]="SendingSuccess"}(i=t.VideoLogEvent||(t.VideoLogEvent={})),t.default=i},nDuE:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("10yS"),s=i("j+uH");class r extends s.default{constructor(e){super(e.logger),this.context=e,this.taskName="AttachMediaInputTask"}run(){return n(this,void 0,void 0,(function*(){const e=this.context.transceiverController;e.setPeer(this.context.peer),e.setupLocalTransceivers();const t=this.context.activeAudioInput;if(t){const i=t.getAudioTracks();this.context.logger.info("attaching audio track to peer connection"),yield e.setAudioInput(i.length?i[0]:null)}else yield e.setAudioInput(null),this.context.logger.info("no audio track");const i=this.context.activeVideoInput;if(i){const t=i.getVideoTracks(),n=t.length?t[0]:null;if(this.context.logger.info("attaching video track to peer connection"),yield e.setVideoInput(n),this.context.enableSimulcast&&this.context.videoUplinkBandwidthPolicy){const t=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();e.setEncodingParameters(t)}n&&this.context.statsCollector.logVideoEvent(o.default.InputAttached,this.context.videoDeviceInformation)}else yield e.setVideoInput(null),this.context.logger.info("no video track");this.context.videoSubscriptions=e.updateVideoTransceivers(this.context.videoStreamIndex,this.context.videosToReceive)}))}}t.default=r},"j+uH":function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("ZnGd"),s=i("IGBW");t.default=class{constructor(e){this.logger=e,this.taskName="BaseTask",this.parentTask=null,this.status=s.default.IDLE,this.run=this.baseRun.bind(this,this.run),this.cancel=this.baseCancel.bind(this,this.cancel)}once(...e){return new o.default(this.logger,this,e)}cancel(){}name(){return this.parentTask?`${this.parentTask.name()}/${this.taskName}`:this.taskName}setParent(e){this.parentTask=e}getStatus(){return this.status}logAndThrow(e){throw this.logger.info(e),new Error(e)}baseRun(e){return n(this,void 0,void 0,(function*(){try{const t=Date.now();switch(this.logger.info(`running task ${this.name()}`),this.status){case s.default.RUNNING:this.logAndThrow(`${this.name()} is already running`);case s.default.CANCELED:this.logAndThrow(`${this.name()} was canceled before running`);case s.default.FINISHED:this.logAndThrow(`${this.name()} was already finished`)}this.status=s.default.RUNNING,yield e.call(this),this.logger.info(`${this.name()} took ${Math.round(Date.now()-t)} ms`)}catch(e){throw e}finally{this.status!==s.default.CANCELED&&(this.status=s.default.FINISHED)}}))}baseCancel(e){this.status!==s.default.CANCELED&&this.status!==s.default.FINISHED?(this.logger.info(`canceling task ${this.name()}`),this.status=s.default.CANCELED,e.call(this)):this.logger.info(`Not canceling ${this.name()}: state is ${this.status}`)}}},"7EAL":function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("j+uH");class s extends o.default{constructor(e){super(e.logger),this.context=e,this.taskName="CleanRestartedSessionTask"}run(){return n(this,void 0,void 0,(function*(){this.context.resetConnectionSpecificState()}))}}t.default=s},wjYw:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("HbHZ"),s=i("j+uH");class r extends s.default{constructor(e){super(e.logger),this.context=e,this.taskName="CleanStoppedSessionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return n(this,void 0,void 0,(function*(){try{this.context.signalingClient.ready()&&(this.context.signalingClient.closeConnection(),yield this.receiveWebSocketClosedEvent())}catch(e){throw e}finally{for(const e of this.context.removableObservers)e.removeObserver();this.context.resetConnectionSpecificState(),this.context.statsCollector.stop(),this.context.statsCollector=null,this.context.connectionMonitor.stop(),this.context.connectionMonitor=null,this.context.videoUplinkBandwidthPolicy.setTransceiverController&&this.context.videoUplinkBandwidthPolicy.setTransceiverController(void 0),this.context.videoDownlinkBandwidthPolicy.bindToTileController&&this.context.videoDownlinkBandwidthPolicy.bindToTileController(void 0);const e=this.context.videoTileController.getLocalVideoTile();e&&e.bindVideoStream("",!0,null,null,null,null),this.context.videoTileController.removeAllVideoTiles()}}))}receiveWebSocketClosedEvent(){return new Promise(((e,t)=>{const i=new class{constructor(e){this.signalingClient=e}cancel(){this.signalingClient.removeObserver(this),t(new Error("CleanStoppedSessionTask got canceled while waiting for the WebSocket closed event"))}handleSignalingClientEvent(t){t.type===o.default.WebSocketClosed&&(this.signalingClient.removeObserver(this),e())}}(this.context.signalingClient);this.taskCanceler=i,this.context.signalingClient.registerObserver(i)}))}}t.default=r},"7UVU":function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("j+uH");class s extends o.default{constructor(e){super(e.logger),this.context=e,this.taskName="CreatePeerConnectionTask",this.removeTrackAddedEventListener=null,this.removeTrackRemovedEventListeners={},this.trackEvents=["ended","mute","unmute","isolationchange","overconstrained"],this.removeVideoTrackEventListeners={},this.trackAddedHandler=e=>{const t=e.track;if(this.context.logger.info(`received track event: kind=${t.kind} id=${t.id} label=${t.label}`),e.transceiver&&"inactive"===e.transceiver.currentDirection)return;if(0===e.streams.length)return void this.context.logger.warn("Track event but no stream");const i=e.streams[0];"audio"===t.kind?this.context.audioMixController.bindAudioStream(i):"video"!==t.kind||this.trackIsVideoInput(t)||this.addRemoteVideoTrack(t,i)}}removeObserver(){this.removeTrackAddedEventListener&&this.removeTrackAddedEventListener();for(const e in this.removeTrackRemovedEventListeners)this.removeTrackRemovedEventListeners[e]()}addPeerConnectionEventLogger(){const e=this.context.peer;e.addEventListener("connectionstatechange",(()=>{this.context.logger.info(`peer connection state changed: ${e.connectionState}`)})),e.addEventListener("negotiationneeded",(()=>{this.context.logger.info("peer connection negotiation is needed")})),e.addEventListener("icegatheringstatechange",(()=>{this.context.logger.info(`peer connection ice gathering state changed: ${e.iceGatheringState}`)})),e.addEventListener("icecandidate",(e=>{this.context.logger.info(`peer connection ice candidate: ${e.candidate?e.candidate.candidate:"(null)"}`)})),e.addEventListener("iceconnectionstatechange",(()=>{this.context.logger.info(`peer connection ice connection state changed: ${e.iceConnectionState}`)}))}run(){return n(this,void 0,void 0,(function*(){this.context.removableObservers.push(this);const e=this.context.turnCredentials&&this.context.turnCredentials.uris.length>0?{iceServers:[{urls:this.context.turnCredentials.uris,username:this.context.turnCredentials.username,credential:this.context.turnCredentials.password,credentialType:"password"}],iceTransportPolicy:"relay"}:{};e.bundlePolicy=this.context.browserBehavior.requiresBundlePolicy(),e.sdpSemantics="unified-plan",this.context.peer?this.context.logger.info("reusing peer connection"):(this.context.logger.info("creating new peer connection"),this.context.peer=new RTCPeerConnection(e),this.addPeerConnectionEventLogger()),this.removeTrackAddedEventListener=()=>{this.context.peer&&this.context.peer.removeEventListener("track",this.trackAddedHandler),this.removeTrackAddedEventListener=null},this.context.peer.addEventListener("track",this.trackAddedHandler)}))}trackIsVideoInput(e){return!!this.context.transceiverController.useTransceivers()&&(this.logger.debug((()=>"getting video track type")),this.context.transceiverController.trackIsVideoInput(e))}addRemoteVideoTrack(e,t){var i;const n=t.id,o=this.context.videoStreamIndex.attendeeIdForTrack(n);let s,r;if(this.context.videoTileController.getVideoTileForAttendeeId?(r=this.context.videoTileController.getVideoTileForAttendeeId(o),s=!!(null===(i=null==r?void 0:r.state())||void 0===i?void 0:i.boundVideoStream)):s=this.context.videoTileController.haveVideoTileForAttendeeId(o),s)return void this.context.logger.info(`Not adding remote track. Already have tile for attendeeId:  ${o}`);r||(r=this.context.videoTileController.addVideoTile(),this.logger.info(`Created video tile ${r.id()}`));let a,c,d=this.context.videoStreamIndex.streamIdForTrack(n);void 0===d&&(this.logger.warn(`stream not found for tile=${r.id()} track=${n}`),d=null);for(let i=0;i<this.trackEvents.length;i++){const n=this.trackEvents[i],o=t.getVideoTracks();if(o&&o.length){const t=o[0],i=()=>{this.context.logger.info(`received the ${n} event for tile=${r.id()} id=${e.id} streamId=${d}`),"ended"===n&&this.removeRemoteVideoTrack(e,r.state())};t.addEventListener(n,i),this.removeVideoTrackEventListeners[e.id]||(this.removeVideoTrackEventListeners[e.id]=[]),this.removeVideoTrackEventListeners[e.id].push((()=>{t.removeEventListener(n,i)}))}}if(e.getSettings){const t=e.getSettings();a=t.width,c=t.height}else{const t=e.getCapabilities();a=t.width,c=t.height}const l=this.context.videoStreamIndex.externalUserIdForTrack(n);r.bindVideoStream(o,!1,t,a,c,d,l),this.logger.info(`video track added, use tile=${r.id()} track=${n} streamId=${d}`);const h="removetrack",u=t,g=()=>this.removeRemoteVideoTrack(e,r.state());this.removeTrackRemovedEventListeners[e.id]=()=>{u.removeEventListener(h,g),delete this.removeTrackRemovedEventListeners[e.id]},u.addEventListener(h,g)}removeRemoteVideoTrack(e,t){if(this.removeTrackRemovedEventListeners.hasOwnProperty(e.id)){this.removeTrackRemovedEventListeners[e.id]();for(const t of this.removeVideoTrackEventListeners[e.id])t();delete this.removeVideoTrackEventListeners[e.id]}this.logger.info(`video track ended, removing tile=${t.tileId} id=${e.id} stream=${t.streamId}`),t.streamId?this.context.videosPaused.remove(t.streamId):this.logger.warn(`no stream found for tile=${t.tileId}`),this.context.videoTileController.removeVideoTile(t.tileId)}}t.default=s,s.REMOVE_HANDLER_INTERVAL_MS=1e4},lFzH:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("papz"),s=i("wXa7"),r=i("j+uH");class a extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="CreateSDPTask"}cancel(){if(this.cancelPromise){const e=new Error(`canceling ${this.name()}`);this.cancelPromise(e),delete this.cancelPromise}}sessionUsesAudio(){var e,t;return!!(null===(t=null===(e=this.context.meetingSessionConfiguration)||void 0===e?void 0:e.urls)||void 0===t?void 0:t.audioHostURL)}sessionUsesVideo(){let e;e=this.context.transceiverController.useTransceivers()?this.context.transceiverController.hasVideoInput():this.context.videoTileController.hasStartedLocalVideoTile();const t=!!this.context.videosToReceive&&!this.context.videosToReceive.empty(),i=e||t;return this.context.logger.info(`uses video: ${i} (enabled: true, sending: ${e}, receiving: ${t})`),i}run(){return n(this,void 0,void 0,(function*(){const e={offerToReceiveAudio:this.sessionUsesAudio(),offerToReceiveVideo:this.sessionUsesVideo()};this.logger.info(`peer connection offerOptions: ${JSON.stringify(e)}`),yield new Promise(((t,i)=>n(this,void 0,void 0,(function*(){this.cancelPromise=e=>{i(e)};try{if(this.context.sdpOfferInit=yield this.context.peer.createOffer(e),this.context.logger.info("peer connection created offer"),this.context.previousSdpOffer&&new s.default(this.context.sdpOfferInit.sdp).videoSendSectionHasDifferentSSRC(this.context.previousSdpOffer)){const e=new Error(`canceling ${this.name()} due to the meeting status code: ${o.default.IncompatibleSDP}`);return this.context.previousSdpOffer=null,void i(e)}t()}catch(e){i(e)}finally{delete this.cancelPromise}}))))}))}}t.default=a},tMH2:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("papz"),s=i("wXa7"),r=i("j+uH");class a extends r.default{constructor(e,t=a.CHROME_VPN_TIMEOUT_MS){super(e.logger),this.context=e,this.chromeVpnTimeoutMs=t,this.taskName="FinishGatheringICECandidatesTask"}removeEventListener(){this.context.peer&&(this.context.peer.removeEventListener("icecandidate",this.context.iceCandidateHandler),this.context.turnCredentials||this.context.peer.removeEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler))}cancel(){let e;if(this.context.browserBehavior.requiresIceCandidateGatheringTimeoutWorkaround()&&this.chromeVpnTimeoutMs<this.context.meetingSessionConfiguration.connectionTimeoutMs){Date.now()-this.startTimestampMs>this.chromeVpnTimeoutMs&&(e=new Error(`canceling ${this.name()} due to the meeting status code: ${o.default.ICEGatheringTimeoutWorkaround}`))}this.cancelPromise&&(e=e||new Error(`canceling ${this.name()}`),this.cancelPromise(e),delete this.cancelPromise)}run(){return n(this,void 0,void 0,(function*(){if(this.context.peer||this.logAndThrow("session does not have peer connection; bypass ice gathering"),this.context.browserBehavior.requiresCheckForSdpConnectionAttributes()){if(new s.default(this.context.peer.localDescription.sdp).hasCandidatesForAllMLines())return void this.context.logger.info(`ice gathering already complete; bypass gathering, current local description ${this.context.peer.localDescription.sdp}`)}else this.context.logger.info(`iOS device does not require checking for connection attributes in SDP, current local description ${this.context.peer.localDescription.sdp}`);if(!this.context.browserBehavior.hasFirefoxWebRTC()&&"complete"!==this.context.peer.iceGatheringState||!new s.default(this.context.peer.localDescription.sdp).hasCandidates())try{yield new Promise(((e,t)=>{this.cancelPromise=e=>{this.removeEventListener(),t(e)},this.context.turnCredentials||(this.context.iceGatheringStateEventHandler=()=>{if("complete"===this.context.peer.iceGatheringState)return this.removeEventListener(),e(),void delete this.cancelPromise},this.context.peer.addEventListener("icegatheringstatechange",this.context.iceGatheringStateEventHandler)),this.context.iceCandidateHandler=i=>{if(this.context.logger.info(`ice candidate: ${i.candidate?i.candidate.candidate:"(null)"} state: ${this.context.peer.iceGatheringState}`),i.candidate&&(s.default.isRTPCandidate(i.candidate.candidate)&&this.context.iceCandidates.push(i.candidate),this.context.turnCredentials&&this.context.iceCandidates.length>=1))return this.context.logger.info("gathered at least one relay candidate"),this.removeEventListener(),e(),void delete this.cancelPromise;"complete"===this.context.peer.iceGatheringState&&(this.context.logger.info("done gathering ice candidates"),this.removeEventListener(),new s.default(this.context.peer.localDescription.sdp).hasCandidates()&&0!==this.context.iceCandidates.length?(e(),delete this.cancelPromise):(t(new Error("no ice candidates were gathered")),delete this.cancelPromise))},this.context.peer.addEventListener("icecandidate",this.context.iceCandidateHandler),this.startTimestampMs=Date.now()}))}catch(e){throw e}finally{this.startTimestampMs&&(this.context.iceGatheringDurationMs=Math.round(Date.now()-this.startTimestampMs))}else this.context.logger.info("ice gathering state is complete and candidates are in SDP; bypass gathering")}))}}t.default=a,a.CHROME_VPN_TIMEOUT_MS=5e3},Wdtm:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("aZba"),s=i("papz"),r=i("42jQ"),a=i("/AJg"),c=i("HbHZ"),d=i("OV1w"),l=i("XCDq"),h=i("j+uH");class u extends h.default{constructor(e){super(e.logger),this.context=e,this.taskName="JoinAndReceiveIndexTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return n(this,void 0,void 0,(function*(){const e=yield new Promise(((e,t)=>{const i=this.context;i.turnCredentials=null;const n=new class{constructor(e){this.signalingClient=e}cancel(){this.signalingClient.removeObserver(this),t(new Error("JoinAndReceiveIndexTask got canceled while waiting for SdkIndexFrame"))}handleSignalingClientEvent(t){if(t.type===c.default.WebSocketClosed){let e=`The signaling connection was closed with code ${t.closeCode} and reason: ${t.closeReason}`;i.logger.warn(e);let n=s.default.SignalingBadRequest;return 4410===t.closeCode?(e="The meeting already ended.",i.logger.warn(e),n=s.default.MeetingEnded):t.closeCode>=4500&&t.closeCode<4600&&(n=s.default.SignalingInternalServerError),void i.audioVideoController.handleMeetingSessionStatus(new o.default(n),new Error(e))}if(t.type!==c.default.ReceivedSignalFrame)return;if(t.message.type===l.SdkSignalFrame.Type.JOIN_ACK){const e=t.message.joinack;if(e&&e.videoSubscriptionLimit&&(i.videoSubscriptionLimit=e.videoSubscriptionLimit),i.serverSupportsCompression=null==e?void 0:e.wantsCompressedSdp,void 0!==(null==e?void 0:e.defaultServerSideNetworkAdaption)&&e.defaultServerSideNetworkAdaption!==a.default.Default&&void 0!==i.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption){const t=e.defaultServerSideNetworkAdaption;i.logger.info(`Overriding server side network adaption value to ${t}`),i.videoDownlinkBandwidthPolicy.setServerSideNetworkAdaption(a.convertServerSideNetworkAdaptionEnumFromSignaled(t))}return void(e&&e.turnCredentials?(i.turnCredentials=new r.default,i.turnCredentials.username=e.turnCredentials.username,i.turnCredentials.password=e.turnCredentials.password,i.turnCredentials.ttl=e.turnCredentials.ttl,i.turnCredentials.uris=e.turnCredentials.uris.map((e=>i.meetingSessionConfiguration.urls.urlRewriter(e))).filter((e=>!!e))):i.logger.error("missing TURN credentials in JoinAckFrame"))}if(t.message.type!==l.SdkSignalFrame.Type.INDEX)return;this.signalingClient.removeObserver(this);const n=t.message.index;e(n)}}(this.context.signalingClient);this.context.signalingClient.registerObserver(n),this.taskCanceler=n,this.context.previousSdpAnswerAsString="",this.context.previousSdpOffer=null,this.context.serverSupportsCompression=!1;const h=new d.default(this.context.meetingSessionConfiguration.applicationMetadata);void 0!==this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&void 0!==this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions&&(h.serverSideNetworkAdaption=this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption(),h.supportedServerSideNetworkAdaptions=this.context.videoDownlinkBandwidthPolicy.supportedServerSideNetworkAdaptions()),h.disablePeriodicKeyframeRequestOnContentSender=this.context.meetingSessionConfiguration.disablePeriodicKeyframeRequestOnContentSender,this.context.signalingClient.join(h)}));this.context.logger.info(`received first index ${JSON.stringify(e)}`),this.context.indexFrame=e}))}}t.default=u},"2vi8":function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("HbHZ"),s=i("XCDq"),r=i("j+uH");class a extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="LeaveAndReceiveLeaveAckTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return n(this,void 0,void 0,(function*(){this.context.signalingClient.ready()&&(this.context.signalingClient.leave(),this.context.logger.info("sent leave"),yield this.receiveLeaveAck())}))}receiveLeaveAck(){return new Promise(((e,t)=>{const i=new class{constructor(e,t){this.signalingClient=e,this.logger=t}cancel(){this.signalingClient.removeObserver(this),t(new Error("LeaveAndReceiveLeaveAckTask got canceled while waiting for IndexFrame"))}handleSignalingClientEvent(t){if(t.isConnectionTerminated())return this.signalingClient.removeObserver(this),this.logger.info("LeaveAndReceiveLeaveAckTask connection terminated"),void e();t.type===o.default.ReceivedSignalFrame&&t.message.type===s.SdkSignalFrame.Type.LEAVE_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("got leave ack"),e())}}(this.context.signalingClient,this.context.logger);this.taskCanceler=i,this.context.signalingClient.registerObserver(i)}))}}t.default=a},"3taG":function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("HbHZ"),s=i("XCDq"),r=i("j+uH");class a extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="ListenForVolumeIndicatorsTask",this.realtimeMuteAndUnmuteHandler=e=>{this.context.signalingClient.mute(e)}}run(){return n(this,void 0,void 0,(function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToMuteAndUnmuteLocalAudio(this.realtimeMuteAndUnmuteHandler)}))}removeObserver(){this.context.realtimeController.realtimeUnsubscribeToMuteAndUnmuteLocalAudio(this.realtimeMuteAndUnmuteHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(e){if(e.type===o.default.ReceivedSignalFrame)if(e.message.type===s.SdkSignalFrame.Type.AUDIO_STREAM_ID_INFO){const t=e.message.audioStreamIdInfo;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioStreamIdInfo(t)}else if(e.message.type===s.SdkSignalFrame.Type.AUDIO_METADATA){const t=e.message.audioMetadata;this.context.volumeIndicatorAdapter.sendRealtimeUpdatesForAudioMetadata(t)}}}t.default=a},Hi4k:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("bjg3"),s=i("x8On"),r=i("7JpI"),a=i("Zful"),c=i("1GR6"),d=i("I/xa"),l=i("aZba"),h=i("papz"),u=i("HbHZ"),g=i("XCDq"),f=i("PPZC"),v=i("Aplu"),p=i("j+uH");class m extends p.default{constructor(e,t,i){super(e.logger),this.context=e,this.initialConnectionHealthData=i,this.taskName="MonitorTask",this.prevSignalStrength=1,this.currentVideoDownlinkBandwidthEstimationKbps=1e4,this.currentAvailableStreamAvgBitrates=null,this.hasSignalingError=!1,this.presenceHandlerCalled=!1,this.isResubscribeCheckPaused=!1,this.pendingMetricsReport=void 0,this.isMeetingConnected=!1,this.checkAndSendWeakSignalEvent=e=>{const t=e<1,i=this.prevSignalStrength<1,n=t?i?null:f.default.RedmicStartLoss:i?f.default.RedmicEndLoss:null;n&&this.context.statsCollector.logAudioEvent(n),this.prevSignalStrength=e},this.realtimeFatalErrorCallback=e=>{this.logger.error(`realtime error: ${e}: ${e.stack}`),this.context.audioVideoController.handleMeetingSessionStatus(new l.default(h.default.RealtimeApiFailed),e)},this.realtimeAttendeeIdPresenceHandler=(e,t)=>{var i;const n=this.context.meetingSessionConfiguration.credentials.attendeeId;this.logger.info(`attendeePresenceReceived: ${n}`),n===e&&t&&!this.presenceHandlerCalled&&(this.presenceHandlerCalled=!0,this.context.attendeePresenceDurationMs=Date.now()-this.context.startAudioVideoTimestamp,null===(i=this.context.eventController)||void 0===i||i.publishEvent("attendeePresenceReceived",{attendeePresenceDurationMs:this.context.attendeePresenceDurationMs}))},this.generateBaseAudioVideoEventAttributes=()=>{const{signalingOpenDurationMs:e,startTimeMs:t,iceGatheringDurationMs:i,attendeePresenceDurationMs:n,meetingStartDurationMs:o}=this.context;return{meetingDurationMs:null===t?0:Math.round(Date.now()-t),signalingOpenDurationMs:e,iceGatheringDurationMs:i,attendeePresenceDurationMs:n,meetingStartDurationMs:o}},this.generateAudioVideoEventAttributesForReceivingAudioDropped=()=>{const e=this.generateBaseAudioVideoEventAttributes();return Object.assign(Object.assign({},e),{maxVideoTileCount:this.context.maxVideoTileCount,poorConnectionCount:this.context.poorConnectionCount})},this.reconnectionHealthPolicy=new a.default(e.logger,Object.assign({},t),this.initialConnectionHealthData.clone()),this.unusableAudioWarningHealthPolicy=new d.default(Object.assign({},t),this.initialConnectionHealthData.clone()),this.sendingAudioFailureHealthPolicy=new c.default(e.logger,Object.assign({},t),this.initialConnectionHealthData.clone())}removeObserver(){this.context.audioVideoController.removeObserver(this),this.context.realtimeController.realtimeUnsubscribeToFatalError(this.realtimeFatalErrorCallback),this.context.realtimeController.realtimeUnsubscribeToLocalSignalStrengthChange(this.checkAndSendWeakSignalEvent),this.context.realtimeController.realtimeUnsubscribeToAttendeeIdPresence(this.realtimeAttendeeIdPresenceHandler),this.context.signalingClient.removeObserver(this)}run(){return n(this,void 0,void 0,(function*(){this.context.removableObservers.push(this),this.context.audioVideoController.addObserver(this),this.context.realtimeController.realtimeSubscribeToFatalError(this.realtimeFatalErrorCallback),this.context.realtimeController.realtimeSubscribeToLocalSignalStrengthChange(this.checkAndSendWeakSignalEvent),this.context.realtimeController.realtimeSubscribeToAttendeeIdPresence(this.realtimeAttendeeIdPresenceHandler),this.context.connectionMonitor.start(),this.context.statsCollector.start(this.context.signalingClient,this.context.videoStreamIndex),this.context.signalingClient.registerObserver(this)}))}pauseResubscribeCheck(){this.isResubscribeCheckPaused=!0}resumeResubscribeCheck(){this.isResubscribeCheckPaused&&(this.isResubscribeCheckPaused=!1,this.pendingMetricsReport&&(this.context.logger.info("Resuming resubscribe check with pending metrics report"),this.checkResubscribe(this.pendingMetricsReport)&&this.context.audioVideoController.update({needsRenegotiation:!1})))}videoTileDidUpdate(e){this.context.maxVideoTileCount=Math.max(this.context.maxVideoTileCount,this.context.videoTileController.getAllVideoTiles().length)}checkResubscribe(e){if(this.isResubscribeCheckPaused)return this.context.logger.info("Resubscribe check is paused, setting incoming client metric report as pending"),void(this.pendingMetricsReport=e);this.pendingMetricsReport=void 0;const t=e.getObservableMetrics();if(!t)return!1;const i=t.availableOutgoingBitrate,n=t.nackCountReceivedPerSecond;let o=!1;this.context.videoDownlinkBandwidthPolicy.updateMetrics(e);const s=this.context.videoDownlinkBandwidthPolicy.wantsResubscribe();if(o=o||s,s){const e=this.context.videoDownlinkBandwidthPolicy.chooseSubscriptions();this.context.videosToReceive=e.truncate(this.context.videoSubscriptionLimit),e.size()>this.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.logger.info(`trigger resubscribe for down=${s}; videosToReceive=[${this.context.videosToReceive.array()}]`)}if(this.context.videoTileController.hasStartedLocalVideoTile()){this.context.videoUplinkBandwidthPolicy.updateConnectionMetric({uplinkKbps:i/1e3,nackCountPerSecond:n});const e=this.context.videoUplinkBandwidthPolicy.wantsResubscribe();o=o||e,e&&(this.logger.info(`trigger resubscribe for up=${e}; videosToReceive=[${this.context.videosToReceive.array()}]`),this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters(),this.context.videoUplinkBandwidthPolicy.chooseMediaTrackConstraints())}return o}metricsDidReceive(e){const t=e;if(!t)return;if(this.checkResubscribe(e)&&this.context.audioVideoController.update({needsRenegotiation:!1}),!this.currentAvailableStreamAvgBitrates)return;const i=t.streamMetricReports;if(!i)return;const n=e.getObservableMetrics();this.currentVideoDownlinkBandwidthEstimationKbps=n.availableIncomingBitrate;const a=new Map,c=new Map;for(const e in i)i[e].mediaType===s.default.VIDEO&&i[e].direction===o.default.DOWNSTREAM&&a.set(i[e].streamId,i[e]);let d=!1;for(const e of this.currentAvailableStreamAvgBitrates.bitrates)if(a.has(e.sourceStreamId)){const t=a.get(e.sourceStreamId),i=this.context.videoStreamIndex.attendeeIdForStreamId(e.sourceStreamId);if(!i)continue;const n=new r.default,o=t.previousMetrics.bytesReceived,s=t.currentMetrics.bytesReceived;if(!o||!s)continue;const l=8*(s-o)/1e3;n.expectedAverageBitrateKbps=e.avgBitrateBps/1e3,n.receivedAverageBitrateKbps=l,n.attendeeId=i,l<e.avgBitrateBps/1e3*m.DEFAULT_DOWNLINK_CALLRATE_UNDERSHOOT_FACTOR&&(d=!0),c.set(i,n)}d&&this.logger.info(`One or more video streams are not receiving expected amounts of data ${JSON.stringify(Array.from(c.values()))}`)}connectionHealthDidChange(e){0===e.consecutiveMissedPongs&&this.context.reconnectController&&this.context.reconnectController.setLastActiveTimestampMs(Date.now()),this.applyHealthPolicy(this.reconnectionHealthPolicy,e,(()=>{this.context.audioVideoController.handleMeetingSessionStatus(new l.default(h.default.ConnectionHealthReconnect),null)})),this.applyHealthPolicy(this.unusableAudioWarningHealthPolicy,e,(()=>{var e;this.context.poorConnectionCount+=1;const t=this.generateAudioVideoEventAttributesForReceivingAudioDropped();null===(e=this.context.eventController)||void 0===e||e.publishEvent("receivingAudioDropped",t),this.context.videoTileController.haveVideoTilesWithStreams()?this.context.audioVideoController.forEachObserver((e=>{v.Maybe.of(e.connectionDidSuggestStopVideo).map((t=>t.bind(e)()))})):this.context.audioVideoController.forEachObserver((e=>{v.Maybe.of(e.connectionDidBecomePoor).map((t=>t.bind(e)()))}))}),(()=>{this.context.audioVideoController.forEachObserver((e=>{v.Maybe.of(e.connectionDidBecomeGood).map((t=>t.bind(e)()))}))})),this.isMeetingConnected&&this.applyHealthPolicy(this.sendingAudioFailureHealthPolicy,e,(()=>{var e;const t=this.generateBaseAudioVideoEventAttributes();null===(e=this.context.eventController)||void 0===e||e.publishEvent("sendingAudioFailed",t)}),(()=>{var e;const t=this.generateBaseAudioVideoEventAttributes();null===(e=this.context.eventController)||void 0===e||e.publishEvent("sendingAudioRecovered",t)}))}audioVideoDidStart(){this.isMeetingConnected=!0}audioVideoDidStartConnecting(e){this.isMeetingConnected=!1}audioVideoDidStop(e){this.isMeetingConnected=!1}applyHealthPolicy(e,t,i,n){e.update(t);const o=e.healthIfChanged();null!==o&&(this.logger.info(`${e.name} value is now ${o}`),o<=e.minimumHealth()?v.Maybe.of(i).map((e=>e.bind(this)())):v.Maybe.of(n).map((e=>e.bind(this)())))}handleBitrateFrame(e){let t=0;this.currentAvailableStreamAvgBitrates=e,this.logger.debug((()=>`simulcast: bitrates from server ${JSON.stringify(e)}`));for(const i of e.bitrates)this.context.videosToReceive.contain(i.sourceStreamId)&&(t+=i.avgBitrateBps);t/=1e3,this.currentVideoDownlinkBandwidthEstimationKbps*m.DEFAULT_DOWNLINK_CALLRATE_OVERSHOOT_FACTOR<t&&this.logger.info(`Downlink bandwidth pressure is high: estimated bandwidth ${this.currentVideoDownlinkBandwidthEstimationKbps}Kbps, required bandwidth ${t}Kbps`)}handleSignalingClientEvent(e){var t;if(e.type===u.default.WebSocketClosed&&(4410===e.closeCode||e.closeCode>=4500&&e.closeCode<4600)||e.type===u.default.WebSocketError||e.type===u.default.WebSocketFailed){if(!this.hasSignalingError){const e=this.generateAudioVideoEventAttributesForReceivingAudioDropped();null===(t=this.context.eventController)||void 0===t||t.publishEvent("signalingDropped",e),this.hasSignalingError=!0}}else e.type===u.default.WebSocketOpen&&(this.hasSignalingError=!1);if(e.type===u.default.ReceivedSignalFrame){if(e.message.bitrates){const t=e.message.bitrates;this.context.videoStreamIndex.integrateBitratesFrame(t),this.context.videoDownlinkBandwidthPolicy.updateIndex(this.context.videoStreamIndex),this.handleBitrateFrame(e.message.bitrates)}const t=l.default.fromSignalFrame(e.message);e.message.type!==g.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&t.statusCode()!==h.default.OK&&this.context.audioVideoController.handleMeetingSessionStatus(t,null)}}}t.default=m,m.DEFAULT_DOWNLINK_CALLRATE_OVERSHOOT_FACTOR=2,m.DEFAULT_DOWNLINK_CALLRATE_UNDERSHOOT_FACTOR=.2},mZDK:function(e,t){Object.defineProperty(t,"__esModule",{value:!0});t.default=class{cancel(){}name(){return"NoOpTask"}run(){return Promise.resolve()}setParent(e){}}},ZnGd:function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});const n=i("mlaT"),o=i("F7zz");t.default=class{constructor(e,t,i){this.logger=e,this.task=t,this.dependencies=i,this.canceled=!1}name(){return`${this.task.name()} (once)`}cancel(){if(!this.canceled){if(this.dependencies)for(const e of this.dependencies)e.cancel();this.logger.info(`Canceling ${this.name()}`),o.default.nextTick((()=>this.task.cancel())),this.canceled=!0,this.cancelPromise&&o.default.nextTick((()=>this.cancelPromise(new Error(`canceling ${this.name()}`))))}}logDependencies(){if(this.logger.getLogLevel()>n.default.INFO)return;if(!this.dependencies)return;const e=this.dependencies.filter((e=>e)).map((e=>e.name())).join(", ");this.logger.info(`${this.task.name()} waiting for dependencies: ${e}`)}run(){if(this.promise)return this.promise;const e=this.dependencies?Promise.all(this.dependencies.map((e=>null==e?void 0:e.run()))):Promise.resolve();return this.logDependencies(),this.ongoing=e.then((()=>this.task.run())),this.promise=new Promise(((e,t)=>{this.cancelPromise=t,this.ongoing.then(e).catch(t)}))}setParent(e){this.task.setParent(e)}}},uB5g:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("Sz6V"),s=i("HbHZ"),r=i("j+uH");class a extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="OpenSignalingConnectionTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return n(this,void 0,void 0,(function*(){const e=this.context.meetingSessionConfiguration;this.context.signalingClient.openConnection(new o.default(e.urls.signalingURL,e.credentials.joinToken));const t=Date.now();try{yield new Promise(((e,t)=>{const i=new class{constructor(e){this.signalingClient=e}cancel(){this.signalingClient.removeObserver(this),t(new Error("OpenSignalingConnectionTask got canceled while waiting to open signaling connection"))}handleSignalingClientEvent(i){switch(i.type){case s.default.WebSocketOpen:this.signalingClient.removeObserver(this),e();break;case s.default.WebSocketFailed:this.signalingClient.removeObserver(this),t(new Error("WebSocket connection failed"))}}}(this.context.signalingClient);this.context.signalingClient.registerObserver(i),this.taskCanceler=i}))}catch(e){throw e}finally{this.context.signalingOpenDurationMs=Math.round(Date.now()-t),this.logger.info(`Opening signaling connection took ${this.context.signalingOpenDurationMs} ms`)}}))}}t.default=a},"W+eo":function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("j+uH");class s extends o.default{constructor(e,t,i){super(e),this.taskName=t,this.tasksToRunParallel=i;for(const e of i)e.setParent(this)}cancel(){for(const e of this.tasksToRunParallel)this.logger.info(`canceling parallel group task ${this.name()} subtask ${e.name()}`),e.cancel()}run(){return n(this,void 0,void 0,(function*(){const e=[];for(const t of this.tasksToRunParallel)this.logger.info(`parallel group task ${this.name()} running subtask ${t.name()}`),e.push(t.run());const t=[];for(let i=0;i<e.length;i++){try{yield e[i]}catch(e){t.push(`task ${this.tasksToRunParallel[i].name()} failed: ${e.message}`)}this.logger.info(`parallel group task ${this.name()} completed subtask ${this.tasksToRunParallel[i].name()}`)}if(t.length>0){const e=t.join(", ");this.logAndThrow(`parallel group task ${this.name()} failed for tasks: ${e}`)}this.logger.info(`parallel group task ${this.name()} completed`)}))}}t.default=s},hspq:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("tA0R"),s=i("HbHZ"),r=i("XCDq"),a=i("j+uH");class c extends a.default{constructor(e,t,i){super(e.logger),this.context=e,this.credentials=t,this.completionCallback=i,this.taskName="PromoteToPrimaryMeetingTask",this.taskCanceler=null}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return n(this,void 0,void 0,(function*(){this.context.signalingClient.ready()?(this.context.signalingClient.promoteToPrimaryMeeting(this.credentials),this.context.logger.info("Sent request to join primary meeting"),yield this.receivePrimaryMeetingJoinAck()):this.completionCallback(new o.MeetingSessionStatus(o.MeetingSessionStatusCode.SignalingRequestFailed))}))}receivePrimaryMeetingJoinAck(){return new Promise(((e,t)=>{const i=new class{constructor(e,t,i){this.signalingClient=e,this.completionCallback=t,this.logger=i}cancel(){this.signalingClient.removeObserver(this),this.completionCallback(new o.MeetingSessionStatus(o.MeetingSessionStatusCode.SignalingRequestFailed)),e()}handleSignalingClientEvent(t){t.isConnectionTerminated()&&(this.signalingClient.removeObserver(this),this.logger.info("PromoteToPrimaryMeetingTask connection terminated"),this.completionCallback(new o.MeetingSessionStatus(o.MeetingSessionStatusCode.SignalingRequestFailed)),e()),t.type===s.default.ReceivedSignalFrame&&t.message.type===r.SdkSignalFrame.Type.PRIMARY_MEETING_JOIN_ACK&&(this.signalingClient.removeObserver(this),this.logger.info("Got a primary meeting join ACK"),this.completionCallback(o.MeetingSessionStatus.fromSignalFrame(t.message)),e())}}(this.context.signalingClient,this.completionCallback,this.context.logger);this.taskCanceler=i,this.context.signalingClient.registerObserver(i)}))}}t.default=c},rkwE:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("j+uH");class s extends o.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveAudioInputTask"}run(){var e,t;return n(this,void 0,void 0,(function*(){if(!(null===(t=null===(e=this.context.meetingSessionConfiguration)||void 0===e?void 0:e.urls)||void 0===t?void 0:t.audioHostURL))return void this.context.logger.info("No audio connection: not acquiring audio input");if(this.context.activeAudioInput)return void this.context.logger.info("an active audio input exists");let i;try{i=yield this.context.mediaStreamBroker.acquireAudioInputStream()}catch(e){this.context.logger.warn("could not acquire audio input from current device")}i?this.context.activeAudioInput=i:this.context.logger.warn("an audio input is not available")}))}}t.default=s},uQRK:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("papz"),s=i("42jQ"),r=i("ppUg"),a=i("ac3q"),c=i("j+uH");class d extends c.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveTURNCredentialsTask",this.url=e.meetingSessionConfiguration.urls.turnControlURL,this.meetingId=e.meetingSessionConfiguration.meetingId,this.joinToken=e.meetingSessionConfiguration.credentials.joinToken}cancel(){if(this.cancelPromise){const e=new Error(`canceling ${this.name()}`);this.cancelPromise(e),delete this.cancelPromise}}run(){return n(this,void 0,void 0,(function*(){if(this.context.turnCredentials)return void this.context.logger.info("TURN credentials available, skipping credentials fetch");if(this.context.logger.error("missing TURN credentials - falling back to fetch"),!this.url)return void this.context.logger.info("TURN control url not supplied, skipping credentials fetch");const e={method:"POST",mode:"cors",cache:"no-cache",credentials:"omit",headers:{"Content-Type":"application/json","X-Chime-Auth-Token":"_aws_wt_session="+new r.default(this.joinToken).base()},redirect:"follow",referrer:"no-referrer",body:JSON.stringify({meetingId:this.meetingId})};this.context.logger.info(`requesting TURN credentials from ${this.url}`);const t=yield new Promise(((t,i)=>n(this,void 0,void 0,(function*(){this.cancelPromise=e=>{i(e)};try{const n=yield fetch(a.default.urlWithVersion(this.url),e);if(this.context.logger.info("received TURN credentials"),n.status&&403===n.status)return void i(new Error(`canceling ${this.name()} due to the meeting status code: ${o.default.TURNCredentialsForbidden}`));if(n.status&&404===n.status)return void i(new Error(`canceling ${this.name()} due to the meeting status code: ${o.default.MeetingEnded}`));t(yield n.json())}catch(e){i(e)}finally{delete this.cancelPromise}}))));this.context.turnCredentials=new s.default,this.context.turnCredentials.password=t.password,this.context.turnCredentials.ttl=t.ttl,this.context.turnCredentials.uris=t.uris.map((e=>this.context.meetingSessionConfiguration.urls.urlRewriter(e))).filter((e=>!!e)),this.context.turnCredentials.username=t.username}))}}t.default=d},fxRI:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("ppUg"),s=i("XCDq"),r=i("j+uH");class a extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveVideoInputTask"}run(){return n(this,void 0,void 0,(function*(){const e=this.context.videoDuplexMode===s.SdkStreamServiceType.RX||this.context.videoDuplexMode===s.SdkStreamServiceType.DUPLEX;if(this.context.videoTileController.hasStartedLocalVideoTile()?this.context.videoDuplexMode=e?s.SdkStreamServiceType.DUPLEX:s.SdkStreamServiceType.TX:this.context.videoDuplexMode=e?s.SdkStreamServiceType.RX:0,this.context.videoCaptureAndEncodeParameter=this.context.videoUplinkBandwidthPolicy.chooseCaptureAndEncodeParameters(),!this.context.videoTileController.hasStartedLocalVideoTile())return this.context.logger.info("has not started local video tile"),void(this.context.activeVideoInput&&(this.context.activeVideoInput=void 0,this.context.videoStreamIndex.integrateUplinkPolicyDecision([])));const t=this.context.videoTileController.getLocalVideoTile();let i;try{i=yield this.context.mediaStreamBroker.acquireVideoInputStream()}catch(e){this.context.logger.warn("could not acquire video input from current device"),this.context.videoTileController.stopLocalVideoTile()}if(this.context.enableSimulcast){const e=this.context.videoUplinkBandwidthPolicy.chooseEncodingParameters();this.context.videoStreamIndex.integrateUplinkPolicyDecision(Array.from(e.values()))}if(this.context.activeVideoInput=i,i){const e=i.getVideoTracks();if(!e||0===e.length)return;const n=this.context.meetingSessionConfiguration.credentials.attendeeId,s=new o.default(n).hasModality(o.default.MODALITY_CONTENT),r=e[0].getSettings();if(this.context.enableSimulcast&&!s){const t=this.context.videoUplinkBandwidthPolicy.chooseMediaTrackConstraints();this.context.logger.info(`simulcast: choose constraint ${JSON.stringify(t)}`);try{yield e[0].applyConstraints(t)}catch(e){this.context.logger.info("simulcast: pass video without more constraint")}}const a=this.context.audioVideoController.configuration.credentials.externalUserId;t.bindVideoStream(n,!0,i,r.width,r.height,null,a);for(let t=0;t<e.length;t++){const i=e[t];this.logger.info(`using video device label=${i.label} id=${i.id}`),this.context.videoDeviceInformation.current_camera_name=i.label,this.context.videoDeviceInformation.current_camera_id=i.id}}}))}}t.default=a},rw3l:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("ZS2b"),s=i("ppUg"),r=i("CAce"),a=i("HbHZ"),c=i("XCDq"),d=i("Aplu"),l=i("j+uH");class h extends l.default{constructor(e){super(e.logger),this.context=e,this.taskName="ReceiveVideoStreamIndexTask",this.isIngestionPaused=!1,this.pendingIndex=null}removeObserver(){this.context.signalingClient.removeObserver(this)}run(){return n(this,void 0,void 0,(function*(){this.handleIndexFrame(this.context.indexFrame),this.context.signalingClient.registerObserver(this),this.context.removableObservers.push(this)}))}handleSignalingClientEvent(e){if(e.type!==a.default.ReceivedSignalFrame||e.message.type!==c.SdkSignalFrame.Type.INDEX)return;const t=e.message.index;this.context.logger.info(`received new index ${JSON.stringify(t)}`),this.handleIndexFrame(t)}pauseIngestion(){this.isIngestionPaused=!0}resumeIngestion(){this.isIngestionPaused&&(this.isIngestionPaused=!1,this.pendingIndex&&(this.context.logger.info("Resuming index ingestion with pending index"),this.handleIndexFrame(this.pendingIndex)))}handleIndexFrame(e){if(!e)return;if(this.isIngestionPaused)return this.context.logger.info("Index ingestion is paused, setting most recent index as pending"),void(this.pendingIndex=e);this.pendingIndex=null;const t=this.context.audioVideoController.configuration.credentials.attendeeId;e.sources=e.sources.filter((e=>{const i=new s.default(e.attendeeId);return!(i.base()===t&&i.hasModality(s.default.MODALITY_CONTENT))}));const{videoStreamIndex:i,videoDownlinkBandwidthPolicy:n,videoUplinkBandwidthPolicy:o}=this.context,r=i.allVideoSendingSourcesExcludingSelf(t);i.integrateIndexFrame(e),n.updateIndex(i),o.updateIndex(i),this.resubscribe(n,o),this.updateVideoAvailability(e),this.handleIndexVideosPausedAtSource(),e.supportedReceiveCodecIntersection.length>0&&this.handleSupportedVideoReceiveCodecIntersection(e);const a=i.allVideoSendingSourcesExcludingSelf(t);this.areVideoSourcesEqual(r,a)||this.context.audioVideoController.forEachObserver((e=>{d.Maybe.of(e.remoteVideoSourcesDidChange).map((t=>t.bind(e)(a)))}))}areVideoSourcesEqual(e,t){if(e.length!==t.length)return!1;const i=(e,t)=>e.attendee.attendeeId.localeCompare(t.attendee.attendeeId),n=[...e].sort(i),o=[...t].sort(i);for(let e=0;e<n.length;e++)if(n[e].attendee.attendeeId!==o[e].attendee.attendeeId)return!1;return!0}resubscribe(e,t){const i=e.wantsResubscribe(),n=(this.context.videoDuplexMode===c.SdkStreamServiceType.TX||this.context.videoDuplexMode===c.SdkStreamServiceType.DUPLEX)&&t.wantsResubscribe(),o=i||n;if(this.logger.info(`should resubscribe: ${o} (downlink: ${i} uplink: ${n})`),!o)return;const s=e.chooseSubscriptions();this.context.videosToReceive=s.truncate(this.context.videoSubscriptionLimit),s.size()>this.context.videosToReceive.size()&&this.logger.warn(`Video receive limit exceeded. Limiting the videos to ${this.context.videosToReceive.size()}. Please consider using AllHighestVideoBandwidthPolicy or VideoPriorityBasedPolicy along with chooseRemoteVideoSources api to select the video sources to be displayed.`),this.context.videoCaptureAndEncodeParameter=t.chooseCaptureAndEncodeParameters(),this.logger.info(`trigger resubscribe for up=${n} down=${i}; videosToReceive=[${this.context.videosToReceive.array()}] captureParams=${JSON.stringify(this.context.videoCaptureAndEncodeParameter)}`),this.context.audioVideoController.update({needsRenegotiation:!1})}updateVideoAvailability(e){if(!this.context.videosToReceive)return void this.logger.error("videosToReceive must be set in the meeting context.");const t=new o.default;t.remoteVideoAvailable=!this.context.videosToReceive.empty(),t.canStartLocalVideo=!e.atCapacity,this.context.lastKnownVideoAvailability&&this.context.lastKnownVideoAvailability.equal(t)||(this.context.lastKnownVideoAvailability=t.clone(),this.context.audioVideoController.forEachObserver((e=>{d.Maybe.of(e.videoAvailabilityDidChange).map((i=>i.bind(e)(t.clone())))})))}handleSupportedVideoReceiveCodecIntersection(e){if(void 0===this.context.videoSendCodecPreferences)return;const t=[];let i=!1;for(const n of this.context.videoSendCodecPreferences){let o=!1;for(const i of e.supportedReceiveCodecIntersection)if(n.equals(r.default.fromSignaled(i))){o=!0,t.push(n);break}void 0!==this.context.currentVideoSendCodec&&!o&&n.equals(this.context.currentVideoSendCodec)&&(i=!0)}t.length>0?this.context.meetingSupportedVideoSendCodecPreferences=t:(this.logger.warn("Interesection of meeting receive codec support and send codec preferences has no overlap, falling back to just values provided in `setVideoCodecSendPreferences`"),this.context.meetingSupportedVideoSendCodecPreferences=void 0),i&&this.context.audioVideoController.update({needsRenegotiation:!0})}handleIndexVideosPausedAtSource(){const e=this.context.videoStreamIndex.streamsPausedAtSource();for(const t of this.context.videoTileController.getAllVideoTiles()){const i=t.state();e.contain(i.streamId)?t.markPoorConnection()&&this.logger.info(`marks the tile ${i.tileId} as having a poor connection`):t.unmarkPoorConnection()&&this.logger.info(`unmarks the tile ${i.tileId} as having a poor connection`)}}}t.default=h},"e/M0":function(e,t,i){Object.defineProperty(t,"__esModule",{value:!0});const n=i("j+uH");class o extends n.default{constructor(e,t,i="RunnableTask"){super(e),this.fn=t,this.taskName=i}run(){return this.fn().then((()=>{}))}}t.default=o},D7wJ:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("3i7i"),s=i("HbHZ"),r=i("XCDq"),a=i("j+uH");class c extends a.default{constructor(e){super(e.logger),this.context=e,this.taskName="SendAndReceiveDataMessagesTask",this.sendDataMessageHandler=(e,t,i)=>{if(this.context.signalingClient.ready()){let n;n=t instanceof Uint8Array?t:"string"==typeof t?(new TextEncoder).encode(t):(new TextEncoder).encode(JSON.stringify(t)),this.validateDataMessage(e,n,i);const o=r.SdkDataMessagePayload.create();o.topic=e,o.lifetimeMs=i,o.data=n;const s=r.SdkDataMessageFrame.create();s.messages=[o],this.context.signalingClient.sendDataMessage(s)}else this.context.logger.error("Signaling client is not ready")}}run(){return n(this,void 0,void 0,(function*(){this.context.removableObservers.push(this),this.context.signalingClient.registerObserver(this),this.context.realtimeController.realtimeSubscribeToSendDataMessage(this.sendDataMessageHandler)}))}removeObserver(){this.context.realtimeController.realtimeUnsubscribeFromSendDataMessage(this.sendDataMessageHandler),this.context.signalingClient.removeObserver(this)}handleSignalingClientEvent(e){if(e.type===s.default.ReceivedSignalFrame&&e.message.type===r.SdkSignalFrame.Type.DATA_MESSAGE)for(const t of e.message.dataMessage.messages){const e=new o.default(t.ingestTimeNs/1e6,t.topic,t.data,t.senderAttendeeId,t.senderExternalUserId,0===t.ingestTimeNs);this.context.realtimeController.realtimeReceiveDataMessage(e)}}validateDataMessage(e,t,i){if(!c.TOPIC_REGEX.test(e))throw new Error("Invalid topic");if(t.length>c.DATA_SIZE)throw new Error("Data size has to be less than 2048 bytes");if(i&&i<0)throw new Error("The life time of the message has to be non negative")}}t.default=c,c.TOPIC_REGEX=new RegExp(/^[a-zA-Z0-9_-]{1,36}$/),c.DATA_SIZE=2048},"K+bq":function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("j+uH"),s=i("IGBW");class r extends o.default{constructor(e,t,i){super(e),this.taskName=t,this.tasksToRunSerially=i,this.currentTask=null;for(const e of i)e.setParent(this)}cancel(){this.currentTask&&(this.logger.info(`canceling serial group task ${this.name()} subtask ${this.currentTask.name()}`),this.currentTask.cancel())}run(){return n(this,void 0,void 0,(function*(){for(const e of this.tasksToRunSerially){this.getStatus()===s.default.CANCELED&&this.logAndThrow(`serial group task ${this.name()} was canceled`);try{this.logger.info(`serial group task ${this.name()} running subtask ${e.name()}`),this.currentTask=e,yield e.run(),this.logger.info(`serial group task ${this.name()} completed subtask ${e.name()}`)}catch(e){this.logAndThrow(`serial group task ${this.name()} was canceled due to subtask ${this.currentTask.name()} error: ${e.message}`)}finally{this.currentTask=null}}this.logger.info(`serial group task ${this.name()} completed`)}))}}t.default=r},XzFx:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("U9CR"),s=i("wXa7"),r=i("j+uH");class a extends r.default{constructor(e){super(e.logger),this.context=e,this.taskName="SetLocalDescriptionTask"}cancel(){if(this.cancelPromise){const e=new Error(`canceling ${this.name()}`);this.cancelPromise(e),delete this.cancelPromise}}run(){return n(this,void 0,void 0,(function*(){const e=this.context.peer;let t=this.context.sdpOfferInit.sdp;this.context.browserBehavior.supportsVideoLayersAllocationRtpHeaderExtension()&&(t=new s.default(t).withVideoLayersAllocationRtpHeaderExtension(this.context.previousSdpOffer).sdp),(new o.default).requiresDisablingH264Encoding()&&(t=new s.default(t).removeH264SupportFromSendSection().sdp),void 0!==this.context.videoSendCodecPreferences&&this.context.videoSendCodecPreferences.length>0&&(t=new s.default(t).withVideoSendCodecPreferences(void 0!==this.context.meetingSupportedVideoSendCodecPreferences?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp),this.context.audioProfile&&(t=new s.default(t).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(t=new s.default(t).withStereoAudio().sdp)),this.logger.debug((()=>`local description is >>>${t}<<<`));const i={type:"offer",sdp:t,toJSON:null};yield new Promise(((t,o)=>n(this,void 0,void 0,(function*(){this.cancelPromise=e=>{o(e)};try{yield e.setLocalDescription(i),t()}catch(e){o(e)}finally{delete this.cancelPromise}})))),this.context.logger.info("set local description")}))}}t.default=a},fZkv:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("wXa7"),s=i("j+uH");class r extends s.default{constructor(e){super(e.logger),this.context=e,this.taskName="SetRemoteDescriptionTask"}cancel(){this.cancelICEPromise&&this.cancelICEPromise()}run(){return n(this,void 0,void 0,(function*(){this.context.peer||this.logAndThrow("session does not have peer connection; bypass set remote description");let e=this.context.sdpAnswer;e=new o.default(e).withoutServerReflexiveCandidates().sdp,this.context.audioProfile&&(e=new o.default(e).withAudioMaxAverageBitrate(this.context.audioProfile.audioBitrateBps).sdp,this.context.audioProfile.isStereo()&&(e=new o.default(e).withStereoAudio().sdp)),void 0!==this.context.videoSendCodecPreferences&&this.context.videoSendCodecPreferences.length>0&&(e=new o.default(e).withVideoSendCodecPreferences(void 0!==this.context.meetingSupportedVideoSendCodecPreferences?this.context.meetingSupportedVideoSendCodecPreferences:this.context.videoSendCodecPreferences).sdp,this.context.currentVideoSendCodec=new o.default(e).highestPriorityVideoSendCodec()),this.logger.info(`processed remote description is >>>${e}<<<`);const t={type:"answer",sdp:e,toJSON:null};try{yield this.createICEConnectionCompletedPromise(t)}catch(e){throw e}}))}createICEConnectionCompletedPromise(e){return new Promise(((t,i)=>n(this,void 0,void 0,(function*(){const n=()=>{"connected"!==this.context.peer.iceConnectionState&&"completed"!==this.context.peer.iceConnectionState||(this.context.peer.removeEventListener("iceconnectionstatechange",n),t())};this.cancelICEPromise=()=>{this.context.peer&&this.context.peer.removeEventListener("iceconnectionstatechange",n),i(new Error(`${this.name()} got canceled while waiting for the ICE connection state`))},this.context.peer.addEventListener("iceconnectionstatechange",n);try{yield this.context.peer.setRemoteDescription(e),this.logger.info("set remote description, waiting for ICE connection"),n()}catch(e){i(e)}}))))}}t.default=r},ZISg:function(e,t,i){var n=this&&this.__awaiter||function(e,t,i,n){return new(i||(i=Promise))((function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,a)}c((n=n.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const o=i("aZba"),s=i("papz"),r=i("wXa7"),a=i("aTUL"),c=i("/AJg"),d=i("HbHZ"),l=i("VhCr"),h=i("bQ+R"),u=i("XCDq"),g=i("j+uH");class f extends g.default{constructor(e){super(e.logger),this.context=e,this.taskName="SubscribeAndReceiveSubscribeAckTask",this.taskCanceler=null,this.textCompressor=new a.default(e.logger)}cancel(){this.taskCanceler&&(this.taskCanceler.cancel(),this.taskCanceler=null)}run(){return n(this,void 0,void 0,(function*(){let e="";if(this.context.peer&&this.context.peer.localDescription&&(e=new r.default(this.context.peer.localDescription.sdp).withUnifiedPlanFormat().sdp),!this.context.enableSimulcast){let e=0,t=0;this.context.videoCaptureAndEncodeParameter&&(e=this.context.videoCaptureAndEncodeParameter.captureFrameRate(),t=this.context.videoCaptureAndEncodeParameter.encodeBitrates()[0]);const i={rid:"hi",maxBitrate:1e3*t,maxFramerate:e,active:!0};this.context.videoStreamIndex.integrateUplinkPolicyDecision([i])}this.context.videoStreamIndex.subscribeFrameSent();const t=this.fixUpSubscriptionOrder(e,this.context.videoSubscriptions),i=this.context.videoDuplexMode===u.SdkStreamServiceType.TX||this.context.videoDuplexMode===u.SdkStreamServiceType.DUPLEX;let n;const o=e;if(this.context.serverSupportsCompression){const t=this.context.previousSdpOffer?this.context.previousSdpOffer.sdp:"";n=this.textCompressor.compress(o,t),this.context.logger.info(`Compressed the SDP message from ${o.length} to ${n.length} bytes.`),e=""}this.context.previousSdpOffer=new r.default(o);const s=new l.default(this.context.meetingSessionConfiguration.credentials.attendeeId,e,this.context.meetingSessionConfiguration.urls.audioHostURL,this.context.realtimeController.realtimeIsLocalAudioMuted(),!1,t,i,this.context.videoStreamIndex.localStreamDescriptions(),!0,n);void 0!==this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption&&this.context.videoDownlinkBandwidthPolicy.getServerSideNetworkAdaption()!==c.default.None&&void 0!==this.context.videoDownlinkBandwidthPolicy.getVideoPreferences&&(s.videoSubscriptionConfiguration=this.convertVideoPreferencesToVideoSubscriptionConfiguration(t,this.context.videoDownlinkBandwidthPolicy.getVideoPreferences())),this.context.logger.info(`sending subscribe: ${JSON.stringify(s)}`),this.context.signalingClient.subscribe(s);const a=yield this.receiveSubscribeAck();this.context.logger.info(`got subscribe ack: ${JSON.stringify(a)}`);let d="";a.compressedSdpAnswer&&a.compressedSdpAnswer.length?(d=this.textCompressor.decompress(a.compressedSdpAnswer,this.context.previousSdpAnswerAsString),0===d.length&&(this.context.sdpAnswer="",this.context.previousSdpAnswerAsString="",this.logAndThrow("Error occurred while trying to decompress the SDP answer.")),this.context.logger.info(`Decompressed the SDP message from ${a.compressedSdpAnswer.length} to ${d.length} bytes.`),this.context.sdpAnswer=d):this.context.sdpAnswer=a.sdpAnswer,this.context.previousSdpAnswerAsString=this.context.sdpAnswer,this.context.videoStreamIndex.integrateSubscribeAckFrame(a)}))}fixUpSubscriptionOrder(e,t){if(void 0===this.context.transceiverController.getMidForStreamId)return t;const i=new Map;for(const e of t){const t=this.context.transceiverController.getMidForStreamId(e);void 0!==t?i.set(t,e):0!==e&&this.logger.warn(`Could not find MID for stream ID: ${e}`)}const n=new r.default(e).mediaSections(),o=[];for(const e of n)if("video"===e.mediaType)if("recvonly"===e.direction){const t=i.get(e.mid);if(void 0===t){this.logger.warn(`Could not find stream ID for MID: ${e.mid}`);continue}o.push(t)}else o.push(0);return this.logger.info(`Fixed up ${JSON.stringify(t)} to ${JSON.stringify(o)} (may be same))}`),o}convertVideoPreferencesToVideoSubscriptionConfiguration(e,t){if(void 0===this.context.transceiverController.getMidForStreamId||void 0===t)return[];const i=new Array,n=new Map,o=new Map;for(const t of e){const e=this.context.transceiverController.getMidForStreamId(t);if(void 0===e){0!==t&&this.context.logger.warn(`Could not find MID for stream ID: ${t}`);continue}const i=this.context.videoStreamIndex.attendeeIdForStreamId(t);n.set(i,e),o.set(i,this.context.videoStreamIndex.groupIdForStreamId(t))}for(const e of t){const t=new h.default,s=n.get(e.attendeeId);void 0!==s?(t.mid=s,t.attendeeId=e.attendeeId,t.groupId=o.get(e.attendeeId),t.priority=Number.MAX_SAFE_INTEGER-e.priority,t.targetBitrateKbps=e.targetSizeToBitrateKbps(e.targetSize),i.push(t)):this.context.logger.warn(`Could not find MID for attendee ID: ${e.attendeeId}`)}return i}receiveSubscribeAck(){return new Promise(((e,t)=>{const i=this.context;const n=new class{constructor(e){this.signalingClient=e}cancel(){this.signalingClient.removeObserver(this),t(new Error("SubscribeAndReceiveSubscribeAckTask got canceled while waiting for SdkSubscribeAckFrame"))}handleSignalingClientEvent(t){if(t.isConnectionTerminated()){const e=`SubscribeAndReceiveSubscribeAckTask connection was terminated with code ${t.closeCode} and reason: ${t.closeReason}`;i.logger.warn(e);let n=s.default.TaskFailed;return t.closeCode>=4500&&t.closeCode<4600&&(n=s.default.SignalingInternalServerError),void i.audioVideoController.handleMeetingSessionStatus(new o.default(n),new Error(e))}if(t.type!==d.default.ReceivedSignalFrame||t.message.type!==u.SdkSignalFrame.Type.SUBSCRIBE_ACK)return;this.signalingClient.removeObserver(this);const n=t.message.suback;e(n)}}(this.context.signalingClient);this.context.signalingClient.registerObserver(n),this.taskCanceler=n}))}}t.default=f}}]);