@agora-js/media 4.24.8-1 → 4.24.9

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * AgoraWebSDK_N-v4.24.8-1-0-g7d24368d9 Copyright AgoraInc.
2
+ * AgoraWebSDK_N-v4.24.9-0-g2319458dd Copyright AgoraInc.
3
3
  */
4
4
 
5
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).AgoraRTCMedia={})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}let r=!0,n=!0;function i(e,t,r){const n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function o(e,t,r){if(!e.RTCPeerConnection)return;const n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};const o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);const n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function s(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(r=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function a(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(n=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function c(){if("object"==typeof window){if(r)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function u(e,t){n&&console.warn(e+" is deprecated, please use "+t+" instead.")}function d(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e){return d(e)?Object.keys(e).reduce((function(t,r){const n=d(e[r]),i=n?l(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[r]:i})}),{}):e}function h(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((n=>{n.endsWith("Id")?h(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((t=>{h(e,e.get(t),r)}))})))}function p(e,t,r){const n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===n&&r.trackId===t.id&&h(e,r,i)}))})),i}const f=c;function E(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const n=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];let e={};"number"==typeof n.ideal?(e[i("min",r)]=n.ideal,t.optional.push(e),e={},e[i("max",r)]=n.ideal,t.optional.push(e)):(e[i("",r)]=n.ideal,t.optional.push(e))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then((r=>{let s=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!s&&r.length&&t.includes("back")&&(s=r[r.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=n(e.video),f("chrome: "+JSON.stringify(e)),i(e)}))}e.video=n(e.video)}return f("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return i(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function m(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function _(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const i=new Event("track");i.track=r.track,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else o(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function T(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){let i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function g(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach((e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const n=function(e){r(o(i(e)))};return t.apply(this,[n,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(i(t)))},r])})).then(r,n)}}function S(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>p(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),o(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>p(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,n;return this.getSenders().forEach((r=>{r.track===e&&(t?n=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?n=!0:r=t),t.track===e))),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function R(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();r.apply(this,arguments);const n=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(n)};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),i.apply(this,arguments)}}function v(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return R(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[r.id];if(i)i.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const n=new e.MediaStream([t]);this._streams[r.id]=n,this._reverseStreams[n.id]=r,this.addStream(n)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=n[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function y(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}))}function A(e,t){o(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var b=Object.freeze({__proto__:null,fixNegotiationNeeded:A,shimAddTrackRemoveTrack:v,shimAddTrackRemoveTrackWithNative:R,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((t=>{const n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))},shimGetSendersWithDtmf:T,shimGetStats:g,shimGetUserMedia:E,shimMediaStream:m,shimOnTrack:_,shimPeerConnection:y,shimSenderReceiverGetStats:S});function O(e,t){const r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){u("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},n&&n.prototype.getSettings){const t=n.prototype.getSettings;n.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(n&&n.prototype.applyConstraints){const t=n.prototype.applyConstraints;n.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function I(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function C(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return n.apply(this,[e||null]).then((e=>{if(t.version<53&&!i)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,n)=>{e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(i,o)}}function w(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function N(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),o(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function P(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){u("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function D(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function L(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const r=e.length>0;r&&e.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const n=t.apply(this,arguments);if(r){const{sender:t}=n,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(r).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return n})}function k(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function M(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function U(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var x=Object.freeze({__proto__:null,shimAddTransceiver:L,shimCreateAnswer:U,shimCreateOffer:M,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})},shimGetParameters:k,shimGetUserMedia:O,shimOnTrack:I,shimPeerConnection:C,shimRTCDataChannel:D,shimReceiverGetStats:N,shimRemoveStream:P,shimSenderGetStats:w});function V(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((r=>t.call(this,r,e))),e.getVideoTracks().forEach((r=>t.call(this,r,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach((e=>{r.includes(e.track)&&this.removeTrack(e)}))})}}function F(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}))}),t.apply(e,arguments)}}}function B(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};let a=function(e,t,r){const n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=a,a=function(e,t,r){const n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=a,a=function(e,t,r){const n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=a}function j(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(G(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function G(e){return e&&void 0!==e.video?Object.assign({},e,{video:l(e.video)}):e}function W(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let n=e.iceServers[r];!n.hasOwnProperty("urls")&&n.hasOwnProperty("url")?(u("RTCIceServer.url","RTCIceServer.urls"),n=JSON.parse(JSON.stringify(n)),n.urls=n.url,delete n.url,t.push(n)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function H(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function K(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Y(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var X=Object.freeze({__proto__:null,shimAudioContext:Y,shimCallbacksAPI:B,shimConstraints:G,shimCreateOfferLegacy:K,shimGetUserMedia:j,shimLocalStreamsAPI:V,shimRTCIceServerUrls:W,shimRemoteStreamsAPI:F,shimTrackEventTransceiver:H}),Z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function z(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var J={exports:{}};!function(e){const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){const r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((e=>0===e.indexOf(r)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const r={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":r.relatedAddress=t[e+1];break;case"rport":r.relatedPort=parseInt(t[e+1],10);break;case"tcptype":r.tcpType=t[e+1];break;case"ufrag":r.ufrag=t[e+1],r.usernameFragment=t[e+1];break;default:void 0===r[t[e]]&&(r[t[e]]=t[e+1])}return r},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&void 0!==e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let r;const n=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<n.length;e++)r=n[e].trim().split("="),t[r[0].trim()]=r[1];return t},t.writeFmtp=function(e){let t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const n=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),r={ssrc:parseInt(e.substring(7,t),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substring(t+1,n),r.value=e.substring(n+1)):r.attribute=e.substring(t+1),r},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){const n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substring(12),password:i.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" ");r.profile=n[2];for(let i=3;i<n.length;i++){const o=n[i],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){const n=t.parseRtpMap(s),i=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(n.parameters=i.length?t.parseFmtp(i[0]):{},n.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(n.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach((e=>{r.headerExtensions.push(t.parseExtmap(e))}));const i=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return r.codecs.forEach((e=>{i.forEach((t=>{e.rtcpFeedback.find((e=>e.type===t.type&&e.parameter===t.parameter))||e.rtcpFeedback.push(t)}))})),r},t.writeRtpDescription=function(e,r){let n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",n+=r.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((e=>{n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));let i=0;return r.codecs.forEach((e=>{e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((e=>{n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){const r=[],n=t.parseRtpParameters(e),i=-1!==n.fecMechanisms.indexOf("RED"),o=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),a=s.length>0&&s[0].ssrc;let c;const u=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[0][1]),n.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),r.push(t),i&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&a&&r.push({ssrc:a});let d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){const r={},n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);const i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;const o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let r;const n=t.matchPrefix(e,"a=msid:");if(1===n.length)return r=n[0].substring(7).split(" "),{stream:r[0],track:r[1]};const i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return i.length>0?(r=i[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},t.parseSctpDescription=function(e){const r=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");let i;n.length>0&&(i=parseInt(n[0].substring(19),10)),isNaN(i)&&(i=65536);const o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:r.fmt,maxMessageSize:i};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:i}}},t.writeSctpDescription=function(e,t){let r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,r,n){let i;const o=void 0!==r?r:2;i=e||t.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){const n=t.splitLines(e);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[e].substring(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const r=t.splitLines(e)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){const r=t.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const r=t.splitLines(e);for(let e=0;e<r.length;e++)if(r[e].length<2||"="!==r[e].charAt(1))return!1;return!0},e.exports=t}(J);var Q=J.exports,q=z(Q),$=t({__proto__:null,default:q},[Q]);function ee(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),n=q.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,o(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function te(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||o(e,"icecandidate",(e=>{if(e.candidate){const t=q.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function re(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=function(e){if(!e||!e.sdp)return!1;const t=q.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=q.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r},i=function(e){let r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){let n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);const i=q.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},s=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const e=n(arguments[0]),t=i(e),r=o(arguments[0],e);let s;s=0===t&&0===r?Number.POSITIVE_INFINITY:0===t||0===r?Math.max(t,r):Math.min(t,r);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>s}),this._sctp=a}return s.apply(this,arguments)}}function ne(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},o(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function ie(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}function oe(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function se(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ae(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return r.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}if(e.sdp||"offer"!==e.type&&"answer"!==e.type)return r.apply(this,[e]);return("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then((e=>r.apply(this,[e])))})}var ce=Object.freeze({__proto__:null,removeExtmapAllowMixed:oe,shimAddIceCandidateNullOrEmpty:se,shimConnectionState:ie,shimMaxMessageSize:re,shimParameterlessSetLocalDescription:ae,shimRTCIceCandidate:ee,shimRTCIceCandidateRelayProtocol:te,shimSendThrowTypeError:ne});!function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=c,n=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=i(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=i(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=i(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),o={browserDetails:n,commonShim:ce,extractVersion:i,disableLog:s,disableWarnings:a,sdp:$};switch(n.browser){case"chrome":if(!b||!y||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=b,se(e,n),ae(e),E(e,n),m(e),y(e,n),_(e),v(e,n),T(e),g(e),S(e),A(e,n),ee(e),te(e),ie(e),re(e,n),ne(e),oe(e,n);break;case"firefox":if(!x||!C||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=x,se(e,n),ae(e),O(e,n),C(e,n),I(e),P(e),w(e),N(e),D(e),L(e),k(e),M(e),U(e),ee(e),ie(e),re(e,n),ne(e);break;case"safari":if(!X||!t.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=X,se(e,n),ae(e),W(e),K(e),B(e),V(e),F(e),H(e),j(e),Y(e),ee(e),te(e),re(e,n),ne(e),oe(e,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var ue={exports:{}};!function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",c="major",u="model",d="name",l="type",h="vendor",p="version",f="architecture",E="console",m="mobile",_="tablet",T="smarttv",g="wearable",S="embedded",R="Amazon",v="Apple",y="ASUS",A="BlackBerry",b="Browser",O="Chrome",I="Firefox",C="Google",w="Huawei",N="LG",P="Microsoft",D="Motorola",L="Opera",k="Samsung",M="Sharp",U="Sony",x="Xiaomi",V="Zebra",F="Facebook",B="Chromium OS",j="Mac OS",G=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},W=function(e,t){return typeof e===a&&-1!==H(t).indexOf(H(e))},H=function(e){return e.toLowerCase()},K=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,350)},Y=function(e,t){for(var r,o,a,c,u,d,l=0;l<t.length&&!u;){var h=t[l],p=t[l+1];for(r=o=0;r<h.length&&!u&&h[r];)if(u=h[r++].exec(e))for(a=0;a<p.length;a++)d=u[++o],typeof(c=p[a])===s&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,d):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=d?d.replace(c[1],c[2]):n:this[c[0]]=d?c[1].call(this,d,c[2]):n:4===c.length&&(this[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):n):this[c]=d||n;l+=2}},X=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(W(t[r][i],e))return"?"===r?n:r}else if(W(t[r],e))return"?"===r?n:r;return e},Z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},z={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[d,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[d,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[d,p],[/opios[\/ ]+([\w\.]+)/i],[p,[d,L+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[d,L]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[d,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[d,"UC"+b]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[d,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[d,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[d,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[d,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[d,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[d,/(.+)/,"$1 Secure "+b],p],[/\bfocus\/([\w\.]+)/i],[p,[d,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[d,L+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[d,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[d,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[d,L+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[d,"MIUI "+b]],[/fxios\/([-\w\.]+)/i],[p,[d,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[d,"360 "+b]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[d,/(.+)/,"$1 "+b],p],[/(comodo_dragon)\/([\w\.]+)/i],[[d,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[d,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[d],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[d,F],p],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[d,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[d,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[d,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[d,O+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[d,"Android "+b]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[d,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[d,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,d],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[d,[p,X,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[d,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[d,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[d,I+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[d,p],[/(cobalt)\/([\w\.]+)/i],[d,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,H]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",H]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,H]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[h,k],[l,_]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[h,k],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[h,v],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[h,v],[l,_]],[/(macintosh);/i],[u,[h,v]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[h,M],[l,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[h,w],[l,_]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[h,w],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[h,x],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[h,x],[l,_]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[h,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[h,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[h,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[h,D],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[h,D],[l,_]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[h,N],[l,_]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[h,N],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[h,"Lenovo"],[l,_]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[h,"Nokia"],[l,m]],[/(pixel c)\b/i],[u,[h,C],[l,_]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[h,C],[l,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[h,U],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[h,U],[l,_]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[h,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[h,R],[l,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[h,R],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[u,h,[l,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[h,A],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[h,y],[l,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[h,y],[l,m]],[/(nexus 9)/i],[u,[h,"HTC"],[l,_]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[u,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[h,"Acer"],[l,_]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[h,"Meizu"],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,u,[l,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[h,u,[l,_]],[/(surface duo)/i],[u,[h,P],[l,_]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[h,"Fairphone"],[l,m]],[/(u304aa)/i],[u,[h,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[u,[h,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[u,[h,"RCA"],[l,_]],[/\b(venue[\d ]{2,7}) b/i],[u,[h,"Dell"],[l,_]],[/\b(q(?:mv|ta)\w+) b/i],[u,[h,"Verizon"],[l,_]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[h,"Barnes & Noble"],[l,_]],[/\b(tm\d{3}\w+) b/i],[u,[h,"NuVision"],[l,_]],[/\b(k88) b/i],[u,[h,"ZTE"],[l,_]],[/\b(nx\d{3}j) b/i],[u,[h,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[u,[h,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[u,[h,"Swiss"],[l,_]],[/\b((zeki)?tb.*\b) b/i],[u,[h,"Zeki"],[l,_]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],u,[l,_]],[/\b(ns-?\w{0,9}) b/i],[u,[h,"Insignia"],[l,_]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[h,"NextBook"],[l,_]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],u,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],u,[l,m]],[/\b(ph-1) /i],[u,[h,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[h,"Envizen"],[l,_]],[/\b(trio[-\w\. ]+) b/i],[u,[h,"MachSpeed"],[l,_]],[/\btu_(1491) b/i],[u,[h,"Rotor"],[l,_]],[/(shield[\w ]+) b/i],[u,[h,"Nvidia"],[l,_]],[/(sprint) (\w+)/i],[h,u,[l,m]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[h,P],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[h,V],[l,_]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[h,V],[l,m]],[/smart-tv.+(samsung)/i],[h,[l,T]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[h,k],[l,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,N],[l,T]],[/(apple) ?tv/i],[h,[u,v+" TV"],[l,T]],[/crkey/i],[[u,O+"cast"],[h,C],[l,T]],[/droid.+aft(\w)( bui|\))/i],[u,[h,R],[l,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[h,M],[l,T]],[/(bravia[\w ]+)( bui|\))/i],[u,[h,U],[l,T]],[/(mitv-\w{5}) bui/i],[u,[h,x],[l,T]],[/Hbbtv.*(technisat) (.*);/i],[h,u,[l,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,K],[u,K],[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,u,[l,E]],[/droid.+; (shield) bui/i],[u,[h,"Nvidia"],[l,E]],[/(playstation [345portablevi]+)/i],[u,[h,U],[l,E]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[h,P],[l,E]],[/((pebble))app/i],[h,u,[l,g]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[h,v],[l,g]],[/droid.+; (glass) \d/i],[u,[h,C],[l,g]],[/droid.+; (wt63?0{2,3})\)/i],[u,[h,V],[l,g]],[/(quest( 2| pro)?)/i],[u,[h,F],[l,g]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[l,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[l,_]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,_]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[d,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[d,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[d,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,d]],os:[[/microsoft (windows) (vista|xp)/i],[d,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[d,[p,X,Z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[d,"Windows"],[p,X,Z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[d,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[d,j],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,d],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[d,p],[/\(bb(10);/i],[p,[d,A]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[d,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[d,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[d,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[d,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[d,O+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[d,B],p],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[d,p],[/(sunos) ?([\w\.\d]*)/i],[[d,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[d,p]]},J=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof J))return new J(e,t).getResult();var E=typeof r!==o&&r.navigator?r.navigator:n,T=e||(E&&E.userAgent?E.userAgent:""),g=E&&E.userAgentData?E.userAgentData:n,S=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(z,t):z;return this.getBrowser=function(){var e={};return e[d]=n,e[p]=n,Y.call(e,T,S.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e[p]),E&&E.brave&&typeof E.brave.isBrave==i&&(e[d]="Brave"),e},this.getCPU=function(){var e={};return e[f]=n,Y.call(e,T,S.cpu),e},this.getDevice=function(){var e={};return e[h]=n,e[u]=n,e[l]=n,Y.call(e,T,S.device),!e[l]&&g&&g.mobile&&(e[l]=m),"Macintosh"==e[u]&&E&&typeof E.standalone!==o&&E.maxTouchPoints&&E.maxTouchPoints>2&&(e[u]="iPad",e[l]=_),e},this.getEngine=function(){var e={};return e[d]=n,e[p]=n,Y.call(e,T,S.engine),e},this.getOS=function(){var e={};return e[d]=n,e[p]=n,Y.call(e,T,S.os),!e[d]&&g&&"Unknown"!=g.platform&&(e[d]=g.platform.replace(/chrome os/i,B).replace(/macos/i,j)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return T},this.setUA=function(e){return T=typeof e===a&&e.length>350?K(e,350):e,this},this.setUA(T),this};J.VERSION="0.7.34",J.BROWSER=G([d,p,c]),J.CPU=G([f]),J.DEVICE=G([u,h,l,E,m,T,_,g,S]),J.ENGINE=J.OS=G([d,p]),e.exports&&(t=e.exports=J),t.UAParser=J;var Q=typeof r!==o&&(r.jQuery||r.Zepto);if(Q&&!Q.ua){var q=new J;Q.ua=q.getResult(),Q.ua.get=function(){return q.getUA()},Q.ua.set=function(e){q.setUA(e);var t=q.getResult();for(var r in t)Q.ua[r]=t[r]}}}("object"==typeof window?window:Z)}(ue,ue.exports);var de=z(ue.exports);function le(e,t){return function(){return e.apply(t,arguments)}}const{toString:he}=Object.prototype,{getPrototypeOf:pe}=Object,{iterator:fe,toStringTag:Ee}=Symbol,me=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),_e=(e,t)=>{let r=e;const n=[];for(;null!=r&&r!==Object.prototype;){if(-1!==n.indexOf(r))return!1;if(n.push(r),me(r,t))return!0;r=pe(r)}return!1},Te=(e=>t=>{const r=he.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ge=e=>(e=e.toLowerCase(),t=>Te(t)===e),Se=e=>t=>typeof t===e,{isArray:Re}=Array,ve=Se("undefined");function ye(e){return null!==e&&!ve(e)&&null!==e.constructor&&!ve(e.constructor)&&Oe(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Ae=ge("ArrayBuffer");const be=Se("string"),Oe=Se("function"),Ie=Se("number"),Ce=e=>null!==e&&"object"==typeof e,we=e=>{if(!Ce(e))return!1;const t=pe(e);return!(null!==t&&t!==Object.prototype&&null!==pe(t)||_e(e,Ee)||_e(e,fe))},Ne=ge("Date"),Pe=ge("File"),De=ge("Blob"),Le=ge("FileList"),ke=ge("Set");const Me="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},Ue=void 0!==Me.FormData?Me.FormData:void 0,xe=ge("URLSearchParams"),[Ve,Fe,Be,je]=["ReadableStream","Request","Response","Headers"].map(ge);function Ge(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),Re(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(ye(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let s;for(n=0;n<o;n++)s=i[n],t.call(null,e[s],s,e)}}function We(e,t){if(ye(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const He="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ke=e=>!ve(e)&&e!==He;const Ye=(Xe="undefined"!=typeof Uint8Array&&pe(Uint8Array),e=>Xe&&e instanceof Xe);var Xe;const Ze=ge("HTMLFormElement"),{propertyIsEnumerable:ze}=Object.prototype,Je=ge("RegExp"),Qe=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Ge(r,((r,i)=>{let o;!1!==(o=t(r,i,e))&&(n[i]=o||r)})),Object.defineProperties(e,n)};const qe=ge("AsyncFunction"),$e=(et="function"==typeof setImmediate,tt=Oe(He.postMessage),et?setImmediate:tt?(rt=`axios@${Math.random()}`,nt=[],He.addEventListener("message",(({source:e,data:t})=>{e===He&&t===rt&&nt.length&&nt.shift()()}),!1),e=>{nt.push(e),He.postMessage(rt,"*")}):e=>setTimeout(e));var et,tt,rt,nt;const it="undefined"!=typeof queueMicrotask?queueMicrotask.bind(He):"undefined"!=typeof process&&process.nextTick||$e,ot=e=>null!=e&&Oe(e[fe]);var st={isArray:Re,isArrayBuffer:Ae,isBuffer:ye,isFormData:e=>{if(!e)return!1;if(Ue&&e instanceof Ue)return!0;const t=pe(e);if(!t||t===Object.prototype)return!1;if(!Oe(e.append))return!1;const r=Te(e);return"formdata"===r||"object"===r&&Oe(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Ae(e.buffer),t},isString:be,isNumber:Ie,isBoolean:e=>!0===e||!1===e,isObject:Ce,isPlainObject:we,isEmptyObject:e=>{if(!Ce(e)||ye(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Ve,isRequest:Fe,isResponse:Be,isHeaders:je,isUndefined:ve,isDate:Ne,isFile:Pe,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:De,isRegExp:Je,isFunction:Oe,isStream:e=>Ce(e)&&Oe(e.pipe),isURLSearchParams:xe,isTypedArray:Ye,isFileList:Le,forEach:Ge,merge:function e(...t){const{caseless:r,skipUndefined:n}=Ke(this)&&this||{},i={},o=(t,o)=>{if("__proto__"===o||"constructor"===o||"prototype"===o)return;const s=r&&"string"==typeof o&&We(i,o)||o,a=me(i,s)?i[s]:void 0;we(a)&&we(t)?i[s]=e(a,t):we(t)?i[s]=e({},t):Re(t)?i[s]=t.slice():n&&ve(t)||(i[s]=t)};for(let e=0,r=t.length;e<r;e++){const r=t[e];if(!r||ye(r))continue;if(Ge(r,o),"object"!=typeof r||Re(r))continue;const n=Object.getOwnPropertySymbols(r);for(let e=0;e<n.length;e++){const t=n[e];ze.call(r,t)&&o(r[t],t)}}return i},extend:(e,t,r,{allOwnKeys:n}={})=>(Ge(t,((t,n)=>{r&&Oe(t)?Object.defineProperty(e,n,{__proto__:null,value:le(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,n,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,o,s;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],n&&!n(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==r&&pe(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Te,kindOfTest:ge,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(Re(e))return e;let t=e.length;if(!Ie(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[fe]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Ze,hasOwnProperty:me,hasOwnProp:me,hasOwnInPrototypeChain:_e,getSafeProp:(e,t)=>null!=e&&_e(e,t)?e[t]:void 0,reduceDescriptors:Qe,freezeMethods:e=>{Qe(e,((t,r)=>{if(Oe(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];Oe(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return Re(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:We,global:He,isContextDefined:Ke,isSpecCompliantForm:function(e){return!!(e&&Oe(e.append)&&"FormData"===e[Ee]&&e[fe])},toJSONObject:e=>{const t=new WeakSet,r=e=>{if(Ce(e)){if(t.has(e))return;if(ye(e))return e;if(!("toJSON"in e)){let n;if(t.add(e),ke(e)){n=[];for(const t of e){const e=r(t);!ve(e)&&n.push(e)}}else n=Re(e)?[]:{},Ge(e,((e,t)=>{const i=r(e);!ve(i)&&(n[t]=i)}));return t.delete(e),n}}return e};return r(e)},isAsyncFn:qe,isThenable:e=>e&&(Ce(e)||Oe(e))&&Oe(e.then)&&Oe(e.catch),setImmediate:$e,asap:it,isIterable:ot,isSafeIterable:e=>null!=e&&_e(e,fe)&&ot(e)};const at=st.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const ct=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),ut=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function dt(e,t){return st.isArray(e)?e.map((e=>dt(e,t))):function(e){let t=0,r=e.length;for(;t<r;){const r=e.charCodeAt(t);if(9!==r&&32!==r)break;t+=1}for(;r>t;){const t=e.charCodeAt(r-1);if(9!==t&&32!==t)break;r-=1}return 0===t&&r===e.length?e:e.slice(t,r)}(String(e).replace(t,""))}const lt=e=>dt(e,ct),ht=e=>dt(e,ut);function pt(e){const t=Object.create(null);return st.forEach(e.toJSON(),((e,r)=>{t[r]=ht(e)})),t}const ft=Symbol("internals");function Et(e){return e&&String(e).trim().toLowerCase()}function mt(e){return!1===e||null==e?e:st.isArray(e)?e.map(mt):lt(String(e))}const _t=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function Tt(e){let t=0,r=e.length;for(;t<r;){const r=e.charCodeAt(t);if(9!==r&&32!==r)break;t+=1}for(;r>t;){const t=e.charCodeAt(r-1);if(9!==t&&32!==t)break;r-=1}return 0===t&&r===e.length?e:e.slice(t,r)}function gt(e,t,r,n,i){return st.isFunction(n)?n.call(this,t,r):(i&&(t=r),st.isString(t)?st.isString(n)?-1!==t.indexOf(n):st.isRegExp(n)?n.test(t):void 0:void 0)}class St{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=Et(t);if(!i)return;const o=st.findKey(n,i);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=mt(e))}const o=(e,t)=>st.forEach(e,((e,r)=>i(e,r,t)));if(st.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(st.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim();const o=st.hasOwnProp(t,r);!r||o&&st.hasOwnProp(at,r)||("set-cookie"===r?o?t[r].push(n):t[r]=[n]:t[r]=o?t[r]+", "+n:n)})),t})(e),t);else if(st.isObject(e)&&st.isSafeIterable(e)){let r,n,i=Object.create(null);for(const t of e){if(!st.isArray(t))throw new TypeError("Object iterator must return a key-value pair");n=t[0],st.hasOwnProp(i,n)?(r=i[n],i[n]=st.isArray(r)?[...r,t[1]]:[r,t[1]]):i[n]=t[1]}o(i,t)}else null!=e&&i(t,e,r);return this}get(e,t){if(e=Et(e)){const r=st.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(st.isFunction(t))return t.call(this,e,r);if(st.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Et(e)){const r=st.findKey(this,e);return!(!r||void 0===this[r]||t&&!gt(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=Et(e)){const i=st.findKey(r,e);!i||t&&!gt(0,r[i],i,t)||(delete r[i],n=!0)}}return st.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!gt(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return st.forEach(this,((n,i)=>{const o=st.findKey(r,i);if(o)return t[o]=mt(n),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();s!==i&&delete t[i],t[s]=mt(n),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return st.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&st.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){const e=this.get("set-cookie");return st.isArray(e)?e:null==e||!1===e?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return function(e){const t=Object.create(null),r=String(e);let n=0,i=!1,o=!1;function s(e){const i=Tt(r.slice(n,e)),o=i.indexOf("=");if(o<1)return;const s=Tt(i.slice(0,o));if(!_t.test(s))return;const a=s.toLowerCase();if("__proto__"===a||"constructor"===a||"prototype"===a)return;const c=Tt(i.slice(o+1));t[a]=function(e){const t=e.length-1;if(t<1||34!==e.charCodeAt(0)||34!==e.charCodeAt(t))return e;let r="";for(let n=1;n<t;n++){const i=e.charCodeAt(n);if(34===i)return e;if(92===i&&(n+=1,n>=t))return e;r+=e[n]}return r}(c)}for(let e=0;e<r.length;e++){const t=r.charCodeAt(e);i?o?o=!1:92===t?o=!0:34===t&&(i=!1):34===t?i=!0:44!==t&&59!==t||(s(e),n=e+1)}return s(r.length),t}(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[ft]=this[ft]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Et(e);t[n]||(!function(e,t){const r=st.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return st.isArray(e)?e.forEach(n):n(e),this}}St.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),st.reduceDescriptors(St.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),st.freezeMethods(St);var Rt=St;const vt="[REDACTED ****]";function yt(e,t){const r=new Set(t.map((e=>String(e).toLowerCase()))),n=[],i=e=>{if(null===e||"object"!=typeof e)return e;if(st.isBuffer(e))return e;if(-1!==n.indexOf(e))return;let t;if(e instanceof Rt&&(e=e.toJSON()),n.push(e),st.isArray(e))t=[],e.forEach(((e,r)=>{const n=i(e);st.isUndefined(n)||(t[r]=n)}));else{if(!st.isPlainObject(e)&&function(e){if(st.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(st.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return n.pop(),e;t=Object.create(null);for(const[n,o]of Object.entries(e)){const e=r.has(n.toLowerCase())?vt:i(o);st.isUndefined(e)||(t[n]=e)}}return n.pop(),t};return i(e)}function At(e){try{return String(e)}catch(e){return""}}class bt extends Error{static from(e,t,r,n,i,o){let s=e.message;!s&&st.isArray(e.errors)&&e.errors.length&&(s=function(e){return e.errors.map((e=>{try{return e&&e.message?At(e.message):At(e)}catch(e){return""}})).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const a=new bt(s,t||e.code,r,n,i);return Object.defineProperty(a,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),o&&Object.assign(a,o),a}constructor(e,t,r,n,i){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status)}toJSON(){const e=this.config,t=e&&st.hasOwnProp(e,"redact")?e.redact:void 0,r=st.isArray(t)&&t.length>0?yt(e,t):st.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}}bt.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",bt.ERR_BAD_OPTION="ERR_BAD_OPTION",bt.ECONNABORTED="ECONNABORTED",bt.ETIMEDOUT="ETIMEDOUT",bt.ECONNREFUSED="ECONNREFUSED",bt.ERR_NETWORK="ERR_NETWORK",bt.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",bt.ERR_DEPRECATED="ERR_DEPRECATED",bt.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",bt.ERR_BAD_REQUEST="ERR_BAD_REQUEST",bt.ERR_CANCELED="ERR_CANCELED",bt.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",bt.ERR_INVALID_URL="ERR_INVALID_URL",bt.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";var Ot=bt;const It=100;function Ct(e){return st.isPlainObject(e)||st.isArray(e)}function wt(e){return st.endsWith(e,"[]")?e.slice(0,-2):e}function Nt(e,t,r){return e?e.concat(t).map((function(e,t){return e=wt(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const Pt=st.toFlatObject(st,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Dt(e,t,r){if(!st.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=st.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!st.isUndefined(t[e])}))).metaTokens,i=r.visitor||p,o=r.dots,s=r.indexes,a=r.Blob||"undefined"!=typeof Blob&&Blob,c=void 0===r.maxDepth?It:r.maxDepth,u=a&&st.isSpecCompliantForm(t),d=[];if(!st.isFunction(i))throw new TypeError("visitor must be a function");function l(e){if(null===e)return"";if(st.isDate(e))return e.toISOString();if(st.isBoolean(e))return e.toString();if(!u&&st.isBlob(e))throw new Ot("Blob is not supported. Use a Buffer instead.");if(st.isArrayBuffer(e)||st.isTypedArray(e)){if(u&&"function"==typeof a)return new a([e]);throw new Ot("Blob is not supported. Use a Buffer instead.",Ot.ERR_NOT_SUPPORT)}return e}function h(e){if(e>c)throw new Ot("Object is too deeply nested ("+e+" levels). Max depth: "+c,Ot.ERR_FORM_DATA_DEPTH_EXCEEDED)}function p(e,r,i){let a=e;if(st.isReactNative(t)&&st.isReactNativeBlob(e))return t.append(Nt(i,r,o),l(e)),!1;if(e&&!i&&"object"==typeof e)if(st.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=function(e,t){if(c===1/0)return JSON.stringify(e);const r=[];return JSON.stringify(e,(function(e,n){if(!st.isObject(n))return n;for(;r.length&&r[r.length-1]!==this;)r.pop();return r.push(n),h(t+r.length-1),n}))}(e,1);else if(st.isArray(e)&&function(e){return st.isArray(e)&&!e.some(Ct)}(e)||(st.isFileList(e)||st.endsWith(r,"[]"))&&(a=st.toArray(e)))return r=wt(r),a.forEach((function(e,n){!st.isUndefined(e)&&null!==e&&t.append(!0===s?Nt([r],n,o):null===s?r:r+"[]",l(e))})),!1;return!!Ct(e)||(t.append(Nt(i,r,o),l(e)),!1)}const f=Object.assign(Pt,{defaultVisitor:p,convertValue:l,isVisitable:Ct});if(!st.isObject(e))throw new TypeError("data must be an object");return function e(r,n,o=0){if(!st.isUndefined(r)){if(h(o),-1!==d.indexOf(r))throw new Error("Circular reference detected in "+n.join("."));d.push(r),st.forEach(r,(function(r,s){!0===(!(st.isUndefined(r)||null===r)&&i.call(t,r,st.isString(s)?s.trim():s,n,f))&&e(r,n?n.concat(s):[s],o+1)})),d.pop()}}(e),t}function Lt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,(function(e){return t[e]}))}function kt(e,t){this._pairs=[],e&&Dt(e,this,t)}const Mt=kt.prototype;function Ut(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function xt(e,t,r){if(!t)return e;e=e||"";const n=st.isFunction(r)?{serialize:r}:r,i=st.getSafeProp(n,"encode")||Ut,o=st.getSafeProp(n,"serialize");let s;if(s=o?o(t,n):st.isURLSearchParams(t)?t.toString():new kt(t,n).toString(i),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}Mt.append=function(e,t){this._pairs.push([e,t])},Mt.toString=function(e){const t=e?t=>e.call(this,t,Lt):Lt;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Vt=class{constructor(){this.handlers=[]}use(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){st.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},Ft={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Bt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:kt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const jt="undefined"!=typeof window&&"undefined"!=typeof document,Gt="object"==typeof navigator&&navigator||void 0,Wt=jt&&(!Gt||["ReactNative","NativeScript","NS"].indexOf(Gt.product)<0),Ht="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Kt=jt&&window.location.href||"http://localhost";var Yt={...Object.freeze({__proto__:null,hasBrowserEnv:jt,hasStandardBrowserEnv:Wt,hasStandardBrowserWebWorkerEnv:Ht,navigator:Gt,origin:Kt}),...Bt};const Xt=It;function Zt(e){if(e>Xt)throw new Ot("FormData field is too deeply nested ("+e+" levels). Max depth: "+Xt,Ot.ERR_FORM_DATA_DEPTH_EXCEEDED)}function zt(e){function t(e,r,n,i){Zt(i);let o=e[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=e.length;if(o=!o&&st.isArray(n)?n.length:o,a)return st.hasOwnProp(n,o)?n[o]=st.isArray(n[o])?n[o].concat(r):[n[o],r]:n[o]=r,!s;st.hasOwnProp(n,o)&&st.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],i)&&st.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}(n[o])),!s}if(st.isFormData(e)&&st.isFunction(e.entries)){const r={};return st.forEachEntry(e,((e,n)=>{t(function(e){const t=[],r=/[^.[\]]+|\[([^.[\]]*)]/g;let n;for(;null!==(n=r.exec(e));)Zt(t.length),t.push("[]"===n[0]?"":n[1]||n[0]);return t}(e),n,r,0)})),r}return null}const Jt=(e,t)=>null!=e&&st.hasOwnProp(e,t)?e[t]:void 0;const Qt={transitional:Ft,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=st.isObject(e);i&&st.isHTMLForm(e)&&(e=new FormData(e));if(st.isFormData(e))return n?JSON.stringify(zt(e)):e;if(st.isArrayBuffer(e)||st.isBuffer(e)||st.isStream(e)||st.isFile(e)||st.isBlob(e)||st.isReadableStream(e))return e;if(st.isArrayBufferView(e))return e.buffer;if(st.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){const t=Jt(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Dt(e,new Yt.classes.URLSearchParams,{visitor:function(e,t,r,n){return Yt.isNode&&st.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((o=st.isFileList(e))||r.indexOf("multipart/form-data")>-1){const r=Jt(this,"env"),n=r&&r.FormData;return Dt(o?{"files[]":e}:e,n&&new n,t)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(st.isString(e))try{return(t||JSON.parse)(e),st.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=Jt(this,"transitional")||Qt.transitional,r=t&&t.forcedJSONParsing,n=Jt(this,"responseType"),i="json"===n;if(st.isResponse(e)||st.isReadableStream(e))return e;if(e&&st.isString(e)&&(r&&!n||i)){const r=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,Jt(this,"parseReviver"))}catch(e){if(r){if("SyntaxError"===e.name)throw Ot.from(e,Ot.ERR_BAD_RESPONSE,this,null,Jt(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Yt.classes.FormData,Blob:Yt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};st.forEach(["delete","get","head","post","put","patch","query"],(e=>{Qt.headers[e]={}}));var qt=Qt;function $t(e,t){const r=this||qt,n=t||r,i=Rt.from(n.headers);let o=n.data;return st.forEach(e,(function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function er(e){return!(!e||!e.__CANCEL__)}var tr=class extends Ot{constructor(e,t,r){super(null==e?"canceled":e,Ot.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function rr(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Ot("Request failed with status code "+r.status,r.status>=400&&r.status<500?Ot.ERR_BAD_REQUEST:Ot.ERR_BAD_RESPONSE,r.config,r.request,r)):e(r)}const nr=(e,t,r=3)=>{let n=0;const i=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=n[s];i||(i=c),r[o]=a,n[o]=c;let d=s,l=0;for(;d!==o;)l+=r[d++],d%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-i<t)return;const h=u&&c-u;return h?Math.round(1e3*l/h):void 0}}(50,250);return function(e,t){let r,n,i=0,o=1e3/t;const s=(t,o=Date.now())=>{i=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=o?s(e,t):(r=e,n||(n=setTimeout((()=>{n=null,s(r)}),o-a)))},()=>r&&s(r)]}((r=>{if(!r||"number"!=typeof r.loaded)return;const o=r.loaded,s=r.lengthComputable?r.total:void 0,a=Math.max(0,null!=s?Math.min(o,s):o),c=Math.max(0,a-n),u=i(c);n=Math.max(n,a);e({loaded:a,total:s,progress:s?a/s:void 0,bytes:c,rate:u||void 0,estimated:u&&s?(s-a)/u:void 0,event:r,lengthComputable:null!=s,[t?"download":"upload"]:!0})}),r)},ir=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},or=(e,t=st.asap)=>(...r)=>t((()=>e(...r)));var sr=Yt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,Yt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(Yt.origin),Yt.navigator&&/(msie|trident)/i.test(Yt.navigator.userAgent)):()=>!0,ar=Yt.hasStandardBrowserEnv?{write(e,t,r,n,i,o,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];st.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),st.isString(n)&&a.push(`path=${n}`),st.isString(i)&&a.push(`domain=${i}`),!0===o&&a.push("secure"),st.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const n=t[r].replace(/^\s+/,""),i=n.indexOf("=");if(-1!==i&&n.slice(0,i)===e)try{return decodeURIComponent(n.slice(i+1))}catch(e){return n.slice(i+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};const cr=/^https?:(?!\/\/)/i,ur=/[\t\n\r]/g;function dr(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${vt}@`),r=t.indexOf("#"),n=(-1===r?t:t.slice(0,r)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${vt}`);return-1===r?n:`${n}#${i=t.slice(r+1),i?i.replace(/(^|&)([^=&]*=)?[^&]+/g,((e,t,r="")=>`${t}${r}${vt}`)):i}`;var i}function lr(e,t){if("string"==typeof e){const r=function(e){return function(e){let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t)}(e).replace(ur,"")}(e);if(cr.test(r))throw new Ot(`Invalid URL ${JSON.stringify(dr(r))}: missing "//" after protocol`,Ot.ERR_INVALID_URL,t)}}function hr(e,t,r,n){lr(t,n);let i=!function(e){return"string"==typeof e&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(i||!1===r)?(lr(e,n),function(e,t){if(!t)return e;let r=e.length;for(;r>0&&47===e.charCodeAt(r-1);)r--;return e.slice(0,r)+"/"+t.replace(/^\/+/,"")}(e,t)):t}const pr=e=>e instanceof Rt?{...e}:e,fr=e=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(e).concat(Object.getOwnPropertySymbols(e).filter((t=>Object.getOwnPropertyDescriptor(e,t).enumerable))):Object.keys(e);function Er(e,t){e=e||{},t=t||{};const r=Object.create(null);function n(e,t,r,n){return st.isPlainObject(e)&&st.isPlainObject(t)?st.merge.call({caseless:n},e,t):st.isPlainObject(t)?st.merge({},t):st.isArray(t)?t.slice():t}function i(e,t,r,i){return st.isUndefined(t)?st.isUndefined(e)?void 0:n(void 0,e,0,i):n(e,t,0,i)}function o(e,t){if(!st.isUndefined(t))return n(void 0,t)}function s(e,t){return st.isUndefined(t)?st.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,o){return st.hasOwnProp(t,o)?n(r,i):st.hasOwnProp(e,o)?n(void 0,r):void 0}Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,allowedSocketPaths:s,responseEncoding:s,validateStatus:a,headers:(e,t,r)=>i(pr(e),pr(t),0,!0)};return st.forEach(fr({...e,...t}),(function(n){if("__proto__"===n||"constructor"===n||"prototype"===n)return;const o=st.hasOwnProp(c,n)?c[n]:i,s=o(st.hasOwnProp(e,n)?e[n]:void 0,st.hasOwnProp(t,n)?t[n]:void 0,n);st.isUndefined(s)&&o!==a||(r[n]=s)})),st.hasOwnProp(t,"validateStatus")&&st.isUndefined(t.validateStatus)&&!1===function(r){const n=st.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!st.isUndefined(n)){if(!st.isPlainObject(n))return;if(st.hasOwnProp(n,r))return n[r]}const i=st.hasOwnProp(e,"transitional")?e.transitional:void 0;if(st.isPlainObject(i)&&st.hasOwnProp(i,r))return i[r]}("validateStatusUndefinedResolves")&&(st.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const mr=["content-type","content-length"];const _r=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,((e,t)=>String.fromCharCode(parseInt(t,16))));function Tr(e){const t=Er({},e),r=e=>st.hasOwnProp(t,e)?t[e]:void 0,n=r("data");let i=r("withXSRFToken");const o=r("xsrfHeaderName"),s=r("xsrfCookieName");let a=r("headers");const c=r("auth"),u=r("baseURL"),d=r("allowAbsoluteUrls"),l=r("url");if(t.headers=a=Rt.from(a),t.url=xt(hr(u,l,d,t),r("params"),r("paramsSerializer")),c){const t=st.getSafeProp(c,"username")||"",r=st.getSafeProp(c,"password")||"";try{a.set("Authorization","Basic "+btoa(t+":"+(r?_r(r):"")))}catch(t){throw Ot.from(t,Ot.ERR_BAD_OPTION_VALUE,e)}}if(st.isFormData(n)&&(Yt.hasStandardBrowserEnv||Yt.hasStandardBrowserWebWorkerEnv||st.isReactNative(n)?a.setContentType(void 0):st.isFunction(n.getHeaders)&&function(e,t,r){"content-only"===r?Object.entries(t||{}).forEach((([t,r])=>{mr.includes(t.toLowerCase())&&e.set(t,r)})):e.set(t)}(a,n.getHeaders(),r("formDataHeaderPolicy"))),Yt.hasStandardBrowserEnv){st.isFunction(i)&&(i=i(t));if(!0===i||null==i&&sr(t.url)){const e=o&&s&&ar.read(s);e&&a.set(o,e)}}return t}var gr="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const n=Tr(e);let i=n.data;const o=Rt.from(n.headers).normalize();let s,a,c,u,d,{responseType:l,onUploadProgress:h,onDownloadProgress:p}=n;function f(){u&&u(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(s),n.signal&&n.signal.removeEventListener("abort",s)}let E=new XMLHttpRequest;function m(){if(!E)return;const n=Rt.from("getAllResponseHeaders"in E&&E.getAllResponseHeaders());rr((function(e){t(e),f()}),(function(e){r(e),f()}),{data:l&&"text"!==l&&"json"!==l?E.response:E.responseText,status:E.status,statusText:E.statusText,headers:n,config:e,request:E}),E=null}E.open(n.method.toUpperCase(),n.url,!0),E.timeout=n.timeout,"onloadend"in E?E.onloadend=m:E.onreadystatechange=function(){E&&4===E.readyState&&(0!==E.status||E.responseURL&&E.responseURL.startsWith("file:"))&&setTimeout(m)},E.onabort=function(){E&&(r(new Ot("Request aborted",Ot.ECONNABORTED,e,E)),f(),E=null)},E.onerror=function(t){const n=t&&t.message?t.message:"Network Error",i=new Ot(n,Ot.ERR_NETWORK,e,E);i.event=t||null,r(i),f(),E=null},E.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||Ft;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new Ot(t,i.clarifyTimeoutError?Ot.ETIMEDOUT:Ot.ECONNABORTED,e,E)),f(),E=null},void 0===i&&o.setContentType(null),"setRequestHeader"in E&&st.forEach(pt(o),(function(e,t){E.setRequestHeader(t,e)})),st.isUndefined(n.withCredentials)||(E.withCredentials=!!n.withCredentials),l&&"json"!==l&&(E.responseType=n.responseType),p&&([c,d]=nr(p,!0),E.addEventListener("progress",c)),h&&E.upload&&([a,u]=nr(h),E.upload.addEventListener("progress",a),E.upload.addEventListener("loadend",u)),(n.cancelToken||n.signal)&&(s=t=>{E&&(r(!t||t.type?new tr(null,e,E):t),E.abort(),f(),E=null)},n.cancelToken&&n.cancelToken.subscribe(s),n.signal&&(n.signal.aborted?s():n.signal.addEventListener("abort",s)));const _=function(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}(n.url);if(_&&!Yt.protocols.includes(_))return r(new Ot("Unsupported protocol "+_+":",Ot.ERR_BAD_REQUEST,e)),void f();E.send(i||null)}))};var Sr=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const i=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Ot?t:new tr(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,i(new Ot(`timeout of ${t}ms exceeded`,Ot.ETIMEDOUT))}),t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)})),e=null)};e.forEach((e=>{n||(e.aborted?i.call(e):e.addEventListener("abort",i,{once:!0}))}));const{signal:a}=r;return a.unsubscribe=()=>st.asap(s),a};const Rr=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,i=0;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},vr=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},yr=(e,t,r,n)=>{const i=async function*(e,t){for await(const r of vr(e))yield*Rr(r,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await i.next();if(t)return a(),void e.close();let o=n.byteLength;if(r){let e=s+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},Ar=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,br=(e,t,r)=>t+2<r&&Ar(e.charCodeAt(t+1))&&Ar(e.charCodeAt(t+2)),Or=e=>e<=57?e-48:(223&e)-55,Ir=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,Cr=e=>{const t=e.length;let r=0,n=0,i=!1;for(let s=0;s<t;s++){let a=e.charCodeAt(s);37===a&&br(e,s,t)&&(a=16*Or(e.charCodeAt(s+1))+Or(e.charCodeAt(s+2)),s+=2),9!==(o=a)&&10!==o&&12!==o&&13!==o&&32!==o&&(61!==a?!Ir(a)||n>0?i=!0:r++:n++)}var o;return i||n>2||n>0&&(r+n)%4!=0||r%4==1?(e=>{const t=e.length;let r=0;return t>0&&61===e.charCodeAt(t-1)&&(r++,t>1&&61===e.charCodeAt(t-2)&&r++),Math.floor(3*(t-r)/4)})(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(r)},wr=(e,t)=>{if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const r=e.indexOf(",");if(r<0)return 0;const n=e.slice(5,r),i=e.slice(r+1);if(/;base64/i.test(n))return t(i);let o=0;for(let e=0,t=i.length;e<t;e++){const r=i.charCodeAt(e);if(37===r&&br(i,e,t))o+=1,e+=2;else if(r<128)o+=1;else if(r<2048)o+=2;else if(r>=55296&&r<=56319&&e+1<t){const t=i.charCodeAt(e+1);t>=56320&&t<=57343?(o+=4,e++):o+=3}else o+=3}return o};const Nr="1.19.0",{isFunction:Pr}=st,Dr=e=>{if(!st.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},Lr=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},kr=e=>{const t=void 0!==st.global&&null!==st.global?st.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=st.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:i,Request:o,Response:s}=e,a=i?Pr(i):"function"==typeof fetch,c=Pr(o),u=Pr(s);if(!a)return!1;const d=a&&Pr(r),l=a&&("function"==typeof n?(h=new n,e=>h.encode(e)):async e=>new Uint8Array(await new o(e).arrayBuffer()));var h;const p=c&&d&&Lr((()=>{let e=!1;const t=new o(Yt.origin,{body:new r,method:"POST",get duplex(){return e=!0,"half"}}),n=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!n})),f=u&&d&&Lr((()=>st.isReadableStream(new s("").body))),E={stream:f&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!E[e]&&(E[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new Ot(`Response type '${e}' is not supported`,Ot.ERR_NOT_SUPPORT,r)})}));const m=async e=>{if(null==e)return 0;if(st.isBlob(e))return e.size;if(st.isSpecCompliantForm(e)){const t=new o(Yt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return st.isArrayBufferView(e)||st.isArrayBuffer(e)?e.byteLength:(st.isURLSearchParams(e)&&(e+=""),st.isString(e)?(await l(e)).byteLength:void 0)};return async e=>{let{url:t,method:r,data:a,signal:u,cancelToken:l,timeout:h,onDownloadProgress:_,onUploadProgress:T,responseType:g,headers:S,withCredentials:R="same-origin",fetchOptions:v,maxContentLength:y,maxBodyLength:A}=Tr(e);const b=st.isNumber(y)&&y>-1,O=st.isNumber(A)&&A>-1;let I=i||fetch;g=g?(g+"").toLowerCase():"text";let C=Sr([u,l&&l.toAbortSignal()],h),w=null;const N=C&&C.unsubscribe&&(()=>{C.unsubscribe()});let P,D=null;const L=()=>new Ot("Request body larger than maxBodyLength limit",Ot.ERR_BAD_REQUEST,e,w);try{let i;const u=(M="auth",st.hasOwnProp(e,M)?e[M]:void 0);if(u){const e=st.getSafeProp(u,"username")||"";i={username:e,password:st.getSafeProp(u,"password")||""}}if((e=>{const t=e.indexOf("://");let r=e;return-1!==t&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")})(t)){const e=new URL(t,Yt.origin);if(!i&&(e.username||e.password)){const t=Dr(e.username);i={username:t,password:Dr(e.password)}}(e.username||e.password)&&(e.username="",e.password="",t=e.href)}if(i&&(S.delete("authorization"),S.set("Authorization","Basic "+btoa((k=(i.username||"")+":"+(i.password||""),encodeURIComponent(k).replace(/%([0-9A-F]{2})/gi,((e,t)=>String.fromCharCode(parseInt(t,16)))))))),b&&"string"==typeof t&&t.startsWith("data:")){const r=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return wr(-1===t?e:e.slice(0,t),Cr)}(t);if(r>y)throw new Ot("maxContentLength size of "+y+" exceeded",Ot.ERR_BAD_RESPONSE,e,w)}if(O&&"get"!==r&&"head"!==r){const e=await m(a);if("number"==typeof e&&isFinite(e)&&(P=e,e>A))throw L()}const l=O&&(st.isReadableStream(a)||st.isStream(a)),h=(e,t,r)=>yr(e,65536,(e=>{if(O&&e>A)throw D=L();t&&t(e)}),r);if(p&&"get"!==r&&"head"!==r&&(T||l)){if(P=null==P?await(async(e,t)=>{const r=st.toFiniteNumber(e.getContentLength());return null==r?m(t):r})(S,a):P,0!==P||l){let e,r=new o(t,{method:"POST",body:a,duplex:"half"});if(st.isFormData(a)&&(e=r.headers.get("content-type"))&&S.setContentType(e),r.body){const[e,t]=T&&ir(P,nr(or(T)))||[];a=h(r.body,e,t)}}}else if(l&&!c&&d&&"get"!==r&&"head"!==r)a=h(a);else if(l&&c&&!p&&"get"!==r&&"head"!==r)throw new Ot("Stream request bodies are not supported by the current fetch implementation",Ot.ERR_NOT_SUPPORT,e,w);st.isString(R)||(R=R?"include":"omit");const U=c&&"credentials"in o.prototype;if(st.isFormData(a)){const e=S.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&S.delete("content-type")}S.set("User-Agent","axios/"+Nr,!1);const x={...v,signal:C,method:r.toUpperCase(),headers:pt(S.normalize()),body:a,duplex:"half",credentials:U?R:void 0};w=c&&new o(t,x);let V=await(c?I(w,v):I(t,x));const F=Rt.from(V.headers);if(b){const t=st.toFiniteNumber(F.getContentLength());if(null!=t&&t>y)throw new Ot("maxContentLength size of "+y+" exceeded",Ot.ERR_BAD_RESPONSE,e,w)}const B=f&&("stream"===g||"response"===g);if(f&&V.body&&(_||b||B&&N)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=V[e]}));const r=st.toFiniteNumber(F.getContentLength()),[n,i]=_&&ir(r,nr(or(_),!0))||[];let o=0;const a=t=>{if(b&&(o=t,o>y))throw new Ot("maxContentLength size of "+y+" exceeded",Ot.ERR_BAD_RESPONSE,e,w);n&&n(t)};V=new s(yr(V.body,65536,a,(()=>{i&&i(),N&&N()})),t)}g=g||"text";let j=await E[st.findKey(E,g)||"text"](V,e);if(b&&!f&&!B){let t;if(null!=j&&("number"==typeof j.byteLength?t=j.byteLength:"number"==typeof j.size?t=j.size:"string"==typeof j&&(t="function"==typeof n?(new n).encode(j).byteLength:j.length)),"number"==typeof t&&t>y)throw new Ot("maxContentLength size of "+y+" exceeded",Ot.ERR_BAD_RESPONSE,e,w)}return!B&&N&&N(),await new Promise(((t,r)=>{rr(t,r,{data:j,headers:Rt.from(V.headers),status:V.status,statusText:V.statusText,config:e,request:w})}))}catch(t){if(N&&N(),C&&C.aborted&&C.reason instanceof Ot){const r=C.reason;throw r.config=e,w&&(r.request=w),t!==r&&Object.defineProperty(r,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),r}if(D)throw w&&!D.request&&(D.request=w),D;if(t instanceof Ot)throw w&&!t.request&&(t.request=w),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const r=new Ot("Network Error",Ot.ERR_NETWORK,e,w,t&&t.response);throw Object.defineProperty(r,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),r}throw Ot.from(t,t&&t.code,e,w,t&&t.response)}var k,M}},Mr=new Map,Ur=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:i}=t,o=[n,i,r];let s,a,c=o.length,u=Mr;for(;c--;)s=o[c],a=u.get(s),void 0===a&&u.set(s,a=c?new Map:kr(t)),u=a;return a};Ur();const xr={http:null,xhr:gr,fetch:{get:Ur}};st.forEach(xr,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}}));const Vr=e=>`- ${e}`,Fr=e=>st.isFunction(e)||null===e||!1===e;var Br={getAdapter:function(e,t){e=st.isArray(e)?e:[e];const{length:r}=e;let n,i;const o={};for(let s=0;s<r;s++){let r;if(n=e[s],i=n,!Fr(n)&&(i=xr[(r=String(n)).toLowerCase()],void 0===i))throw new Ot(`Unknown adapter '${r}'`);if(i&&(st.isFunction(i)||(i=i.get(t))))break;o[r||"#"+s]=i}if(!i){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));let t=r?e.length>1?"since :\n"+e.map(Vr).join("\n"):" "+Vr(e[0]):"as no adapter specified";throw new Ot("There is no suitable adapter to dispatch the request "+t,Ot.ERR_NOT_SUPPORT)}return i},adapters:xr};function jr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new tr(null,e)}function Gr(e){jr(e),e.headers=Rt.from(e.headers),e.data=$t.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Br.getAdapter(e.adapter||qt.adapter,e)(e).then((function(t){jr(e),e.response=t;try{t.data=$t.call(e,e.transformResponse,t)}finally{delete e.response}return t.headers=Rt.from(t.headers),t}),(function(t){if(!er(t)&&(jr(e),t&&t.response)){e.response=t.response;try{t.response.data=$t.call(e,e.transformResponse,t.response)}finally{delete e.response}t.response.headers=Rt.from(t.response.headers)}return Promise.reject(t)}))}const Wr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Wr[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const Hr={};Wr.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Nr+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new Ot(n(i," has been removed"+(t?" in "+t:"")),Ot.ERR_DEPRECATED);return t&&!Hr[i]&&(Hr[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,o)}},Wr.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var Kr={assertOptions:function(e,t,r){if("object"!=typeof e||null===e)throw new Ot("options must be an object",Ot.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],s=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new Ot("option "+o+" must be "+r,Ot.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new Ot("Unknown option "+o,Ot.ERR_BAD_OPTION)}},validators:Wr};const Yr=Kr.validators;let Xr=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Vt,response:new Vt}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error){let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=(()=>{if(!t.stack)return"";const e=t.stack.indexOf("\n");return-1===e?"":t.stack.slice(e+1)})();try{if(e.stack){if(r){const t=r.indexOf("\n"),n=-1===t?-1:r.indexOf("\n",t+1),i=-1===n?"":r.slice(n+1);String(e.stack).endsWith(i)||(e.stack+="\n"+r)}}else e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Er(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&Kr.assertOptions(r,{silentJSONParsing:Yr.transitional(Yr.boolean),forcedJSONParsing:Yr.transitional(Yr.boolean),clarifyTimeoutError:Yr.transitional(Yr.boolean),legacyInterceptorReqResOrdering:Yr.transitional(Yr.boolean),advertiseZstdAcceptEncoding:Yr.transitional(Yr.boolean),validateStatusUndefinedResolves:Yr.transitional(Yr.boolean)},!1),null!=n&&(st.isFunction(n)?t.paramsSerializer={serialize:n}:Kr.assertOptions(n,{encode:Yr.function,serialize:Yr.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),Kr.assertOptions(t,{baseUrl:Yr.spelling("baseURL"),withXsrfToken:Yr.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&st.merge(i.common,i[t.method]);i&&st.forEach(["delete","get","head","post","put","patch","query","common"],(e=>{delete i[e]})),t.headers=Rt.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach((function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const r=t.transitional||Ft;r&&r.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let d,l=0;if(!a){const e=[Gr.bind(this),void 0];for(e.unshift(...s),e.push(...c),d=e.length,u=Promise.resolve(t);l<d;)u=u.then(e[l++],e[l++]);return u}d=s.length;let h=t;for(;l<d;){const e=s[l++],t=s[l++];try{h=e?e(h):h}catch(e){if(!t){u=Promise.reject(e);break}try{const r=t.call(this,e);st.isThenable(r)&&(u=Promise.resolve(r).then((()=>Gr.call(this,h))))}catch(e){u=Promise.reject(e)}break}}if(!u)try{u=Gr.call(this,h)}catch(e){u=Promise.reject(e)}for(l=0,d=c.length;l<d;)u=u.then(c[l++],c[l++]);return u}getUri(e){return xt(hr((e=Er(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}};st.forEach(["delete","get","head","options"],(function(e){Xr.prototype[e]=function(t,r){return this.request(Er(r||{},{method:e,url:t,data:r&&st.hasOwnProp(r,"data")?r.data:void 0}))}})),st.forEach(["post","put","patch","query"],(function(e){function t(t){return function(r,n,i){return this.request(Er(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Xr.prototype[e]=t(),"query"!==e&&(Xr.prototype[e+"Form"]=t(!0))}));var Zr=Xr;class zr{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new tr(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new zr((function(t){e=t})),cancel:e}}}var Jr=zr;const Qr={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Qr).forEach((([e,t])=>{Qr[t]=e}));var qr=Qr;const $r=function e(t){const r=new Zr(t),n=le(Zr.prototype.request,r);return st.extend(n,Zr.prototype,r,{allOwnKeys:!0}),st.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Er(t,r))},n}(qt);$r.Axios=Zr,$r.CanceledError=tr,$r.CancelToken=Jr,$r.isCancel=er,$r.VERSION=Nr,$r.toFormData=Dt,$r.AxiosError=Ot,$r.Cancel=$r.CanceledError,$r.all=function(e){return Promise.all(e)},$r.spread=function(e){return function(t){return e.apply(null,t)}},$r.isAxiosError=function(e){return st.isObject(e)&&!0===e.isAxiosError},$r.mergeConfig=Er,$r.AxiosHeaders=Rt,$r.formToJSON=e=>zt(st.isHTMLForm(e)?new FormData(e):e),$r.getAdapter=Br.getAdapter,$r.HttpStatusCode=qr,$r.default=$r;var en=$r;let tn=function(e){return e.WIN_10="Windows 10",e.WIN_81="Windows 8.1",e.WIN_8="Windows 8",e.WIN_7="Windows 7",e.WIN_VISTA="Windows Vista",e.WIN_SERVER_2003="Windows Server 2003",e.WIN_XP="Windows XP",e.WIN_2000="Windows 2000",e.ANDROID="Android",e.HARMONY_OS="HarmonyOS",e.OPEN_BSD="Open BSD",e.SUN_OS="Sun OS",e.LINUX="Linux",e.IOS="iOS",e.MAC_OS="Mac OS",e.CHROMIUM_OS="Chromium OS",e.QNX="QNX",e.UNIX="UNIX",e.BEOS="BeOS",e.OS_2="OS/2",e.SEARCH_BOT="Search Bot",e}({}),rn=function(e){return e.CHROME="Chrome",e.SAFARI="Safari",e.EDGE="Edge",e.FIREFOX="Firefox",e.OPERA="OPR",e.QQ="QQBrowser",e.WECHAT="MicroMessenger",e}({});const nn=new de;let on=nn.getResult(),sn=null;function an(e){if(!sn){e&&nn.setUA(e),on=nn.getResult();const t=function(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return rn.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return rn.CHROME;case"Safari":case"Mobile Safari":return rn.SAFARI;case"Edge":return rn.EDGE;case"Firefox":return rn.FIREFOX;case"QQ":case"QQBrowser":return rn.QQ;case"Opera":return rn.OPERA;case"WeChat":return rn.WECHAT;default:return e.browser.name||""}}(on),r=cn(on),n=function(e){return"Windows"===e.os.name?e.os.version?e.os.name+" "+e.os.version:e.os.name:e.os.name||""}(on),i=on.os.version,o=cn(on,!1),s=on.device.type;if(!(t&&r&&n&&i))return{name:t,version:r,os:n,osVersion:i,browserVersion:o,deviceType:s};sn={name:t,version:r,os:n,osVersion:i,browserVersion:o,deviceType:s}}return sn}function cn(e){let t,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t="Blink"===e.engine.name?e.engine.version||"":e.browser.version||"",r?t.split(".")[0]:t}function un(){return an().os}function dn(){const e=an();return"".concat(e.os," ").concat(e.osVersion)}function ln(){const e=an();return!!("WebKit"===on.engine.name&&e.os===tn.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==rn.SAFARI||mn()&&e.name!==rn.SAFARI)}function hn(){return an().name===rn.CHROME}function pn(){return an().name===rn.SAFARI}function fn(){return an().name===rn.EDGE}function En(){return an().name===rn.FIREFOX}function mn(){return an().os===tn.IOS}function _n(e){const t=an();return!(t.name!==rn.CHROME||!t.osVersion)&&Number(t.version)>=e}function Tn(e,t,r){const n=an();return!(n.name!==e||!n.osVersion)&&(r?Number(n.version)>=t&&Number(n.version)<=r:Number(n.version)===t)}function gn(e){const t=an();return!(t.name!==rn.EDGE||!t.osVersion)&&Number(t.version)>=e}function Sn(e){const t=an();return!(t.name!==rn.FIREFOX||!t.osVersion)&&Number(t.version)>=e}function Rn(e){const t=an();return!(t.name!==rn.OPERA||!t.osVersion)&&Number(t.version)>=e}function vn(){const e=an();if(e.os!==tn.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function yn(){const e=an();if(e.os!==tn.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function An(){const e=an();if(e.os!==tn.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function bn(){return pn()&&navigator.maxTouchPoints>0}function On(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function In(){const e=un();return function(){const e=an().deviceType;return"mobile"===e||"tablet"===e}()||e===tn.ANDROID||e===tn.IOS||e===tn.HARMONY_OS}function Cn(){const e=an();return e.name!==rn.EDGE&&e.name!==rn.SAFARI&&!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function wn(){return un()===tn.ANDROID}function Nn(){const e=an();return wn()&&(e.name===rn.CHROME||e.name===rn.WECHAT||/chrome|chromium/i.test(navigator.userAgent))}function Pn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Dn(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Ln(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function kn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ln(Object(r),!0).forEach((function(t){Dn(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ln(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Mn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Pn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Pn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let Un=function(e){return e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",e.PB_ERROR="PB_ERROR",e.TIMEOUT="TIMEOUT",e.INVALID_PARAMS="INVALID_PARAMS",e.NOT_READABLE="NOT_READABLE",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INVALID_OPERATION="INVALID_OPERATION",e.OPERATION_ABORTED="OPERATION_ABORTED",e.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",e.EXCHANGE_SDP_FAILED="EXCHANGE_SDP_FAILED",e.ADD_CANDIDATE_FAILED="ADD_CANDIDATE_FAILED",e.DATACHANNEL_FAILED="DATACHANNEL_FAILED",e.NETWORK_ERROR="NETWORK_ERROR",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",e.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",e.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",e.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",e.ELECTRON_IS_NULL="ELECTRON_IS_NULL",e.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",e.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",e.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",e.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",e.PERMISSION_DENIED="PERMISSION_DENIED",e.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",e.TRACK_IS_DISABLED="TRACK_IS_DISABLED",e.GET_VIDEO_ELEMENT_VISIBLE_ERROR="GET_VIDEO_ELEMENT_VISIBLE_ERROR",e.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",e.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",e.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",e.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",e.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",e.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",e.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",e.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",e.UID_CONFLICT="UID_CONFLICT",e.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",e.UPDATE_TICKET_FAILED="UPDATE_TICKET_FAILED",e.TOKEN_EXPIRE="TOKEN_EXPIRE",e.INVALID_LOCAL_TRACK="INVALID_LOCAL_TRACK",e.INVALID_TRACK="INVALID_TRACK",e.SENDER_NOT_FOUND="SENDER_NOT_FOUND",e.CREATE_OFFER_FAILED="CREATE_OFFER_FAILED",e.SET_ANSWER_FAILED="SET_ANSWER_FAILED",e.ICE_FAILED="ICE_FAILED",e.PC_CLOSED="PC_CLOSED",e.SENDER_REPLACE_FAILED="SENDER_REPLACE_FAILED",e.GET_LOCAL_CAPABILITIES_FAILED="GET_LOCAL_CAPABILITIES_FAILED",e.GET_LOCAL_CONNECTION_PARAMS_FAILED="GET_LOCAL_CONNECTION_PARAMS_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",e.NO_ICE_CANDIDATE="NO_ICE_CANDIDATE",e.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",e.EXIST_DISABLED_VIDEO_TRACK="EXIST_DISABLED_VIDEO_TRACK",e.INVALID_REMOTE_USER="INVALID_REMOTE_USER",e.REMOTE_USER_IS_NOT_PUBLISHED="REMOTE_USER_IS_NOT_PUBLISHED",e.CUSTOM_REPORT_SEND_FAILED="CUSTOM_REPORT_SEND_FAILED",e.CUSTOM_REPORT_FREQUENCY_TOO_HIGH="CUSTOM_REPORT_FREQUENCY_TOO_HIGH",e.FETCH_AUDIO_FILE_FAILED="FETCH_AUDIO_FILE_FAILED",e.READ_LOCAL_AUDIO_FILE_ERROR="READ_LOCAL_AUDIO_FILE_ERROR",e.DECODE_AUDIO_FILE_FAILED="DECODE_AUDIO_FILE_FAILED",e.WS_ABORT="WS_ABORT",e.WS_DISCONNECT="WS_DISCONNECT",e.WS_ERR="WS_ERR",e.EXTERNAL_SIGNAL_ABORT="EXTERNAL_SIGNAL_ABORT",e.LIVE_STREAMING_TASK_CONFLICT="LIVE_STREAMING_TASK_CONFLICT",e.LIVE_STREAMING_INVALID_ARGUMENT="LIVE_STREAMING_INVALID_ARGUMENT",e.LIVE_STREAMING_INTERNAL_SERVER_ERROR="LIVE_STREAMING_INTERNAL_SERVER_ERROR",e.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED="LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",e.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED="LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",e.LIVE_STREAMING_CDN_ERROR="LIVE_STREAMING_CDN_ERROR",e.LIVE_STREAMING_INVALID_RAW_STREAM="LIVE_STREAMING_INVALID_RAW_STREAM",e.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT="LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",e.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE="LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",e.LIVE_STREAMING_WARN_FREQUENT_REQUEST="LIVE_STREAMING_WARN_FREQUENT_REQUEST",e.WEBGL_INTERNAL_ERROR="WEBGL_INTERNAL_ERROR",e.BEAUTY_PROCESSOR_INTERNAL_ERROR="BEAUTY_PROCESSOR_INTERNAL_ERROR",e.CROSS_CHANNEL_WAIT_STATUS_ERROR="CROSS_CHANNEL_WAIT_STATUS_ERROR",e.CROSS_CHANNEL_FAILED_JOIN_SRC="CROSS_CHANNEL_FAILED_JOIN_SEC",e.CROSS_CHANNEL_FAILED_JOIN_DEST="CROSS_CHANNEL_FAILED_JOIN_DEST",e.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST="CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",e.CROSS_CHANNEL_SERVER_ERROR_RESPONSE="CROSS_CHANNEL_SERVER_ERROR_RESPONSE",e.METADATA_OUT_OF_RANGE="METADATA_OUT_OF_RANGE",e.LOCAL_AEC_ERROR="LOCAL_AEC_ERROR",e.INVALID_PLUGIN="INVALID_PLUGIN",e.DISCONNECT_P2P="DISCONNECT_P2P",e.CONVERTING_IMAGEDATA_TO_BLOB_FAILED="CONVERTING_IMAGEDATA_TO_BLOB_FAILED",e.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED="CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED",e.INIT_DATACHANNEL_TIMEOUT="INIT_DATACHANNEL_TIMEOUT",e.CREATE_DATACHANNEL_ERROR="CREATE_DATACHANNEL_ERROR",e.DATACHANNEL_CONNECTION_TIMEOUT="DATACHANNEL_CONNECTION_TIMEOUT",e.PROHIBITED_OPERATION="PROHIBITED_OPERATION",e.IMAGE_MODERATION_UPLOAD_FAILED="IMAGE_MODERATION_UPLOAD_FAILED",e.P2P_MESSAGE_FAILED="P2P_MESSAGE_FAILED",e}({});class xn extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;super(t),Dn(this,"code",void 0),Dn(this,"message",void 0),Dn(this,"data",void 0),Dn(this,"name","AgoraRTCException"),this.code=e,this.message="AgoraRTCError ".concat(this.code,": ").concat(t),this.data=r}toString(){return this.data?"".concat(this.message,"\ndata: ").concat(JSON.stringify(this.data)):this.message}print(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"error",t=arguments.length>1?arguments[1]:void 0;return"error"===e&&(t||console).error(this.toString()),"warning"===e&&(t||console).warn(this.toString()),this}throw(e){throw this.print("error",e),this}}function Vn(e,t){if("boolean"!=typeof e)throw new xn(Un.INVALID_PARAMS,"Invalid ".concat(t,": The value is of the boolean type."))}function Fn(e,t,r){if(!r.includes(e))throw new xn(Un.INVALID_PARAMS,"".concat(t," can only be set as ").concat(JSON.stringify(r)))}function Bn(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e4;if(e<r||e>n||(!(arguments.length>4&&void 0!==arguments[4])||arguments[4])&&!function(e){return"number"==typeof e&&e%1==0}(e))throw new xn(Un.INVALID_PARAMS,"invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"))}function jn(e,t){if("number"!=typeof e){if(!(e.min||e.max||e.ideal||e.exact))throw new xn(Un.INVALID_PARAMS,"".concat(t," is not a valid ConstrainLong"));void 0!==e.min&&Bn(e.min,"".concat(t,".min"),0,1/0),void 0!==e.max&&Bn(e.max,"".concat(t,".max"),1,1/0),void 0!==e.exact&&Bn(e.exact,"".concat(t,".exact"),1,1/0),void 0!==e.ideal&&Bn(e.ideal,"".concat(t,".ideal"),1,1/0)}else Bn(e,t,1,1/0)}function Gn(e){return null==e}var Wn=function(e){return e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE",e}(Wn||{}),Hn=function(e){return e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT",e}(Hn||{});const Kn=new class{constructor(){Dn(this,"_clientSize",null),Dn(this,"getClientWidth",(()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth)),Dn(this,"getClientHeight",(()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight)),Dn(this,"getStyle",(e=>window.getComputedStyle(e,null))),Dn(this,"checkCssVisibleProperty",(e=>{let t=!0;const r=this.getStyle(e),n=r.display,i=r.visibility,o=r.opacity,s=r.filter;return("none"===n||["hidden","collapse"].includes(i)||Number(o)<.1)&&(t=!1),!!t&&(s&&s.split(" ").filter((e=>{const t=e.split("(")[0];return["brightness","blur","opacity"].includes(t)})).map((e=>{const t=Mn(e.split(/\(|\)/),2),r=t[0],n=t[1];return[r,Number(n.match(/^[0-9\.]+/))]})).forEach((e=>{const r=Mn(e,2),n=r[0],i=r[1];switch(n){case"brightness":(i<.1||i>3)&&(t=!1);break;case"blur":i>3&&(t=!1);break;case"opacity":i<.1&&(t=!1)}})),t)})),Dn(this,"checkPropertyUpToAllParentNodes",((e,t)=>{let r=!0,n=!0;const i=e=>t(e);let o=e;for(;o&&n;)i(o)||(r=!1,n=!1),o=o.parentElement,o||(n=!1);return r})),Dn(this,"checkActualCssVisibleIncludeInherit",(e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty))),Dn(this,"getSizeAboutClient",(e=>{const t=e.getBoundingClientRect(),r=t.width,n=t.height,i=t.left,o=t.right,s=t.top,a=t.bottom,c=this.getClientWidth(),u=this.getClientHeight();return{width:r,height:n,left:i,right:o,top:s,bottom:a,clientWidth:c,clientHeight:u,clientMin:Math.min(c,u)}})),Dn(this,"checkActualSize",(()=>{const e=this._clientSize,t=e.width,r=e.height,n=e.clientMin;return this.checkSizeIsVisible(t,r,n)})),Dn(this,"elementFromPoint",((e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null)),Dn(this,"checkCoverForAPoint",((e,t,r)=>{const n=this.elementFromPoint(e,t);return null!==n&&n!==r})),Dn(this,"getPointPositionList",(()=>{const e=this._clientSize,t=e.width,r=e.height,n=e.left,i=e.top,o=t/6,s=r/6,a=[],c=10**6;for(let e=0;e<5;e++)for(let t=0;t<5;t++){const r=(n*c+(0===e?.1:4===e?(o*e*c-1e5)/c:o*e)*c)/c,u=(i*c+(0===t?.1:4===t?(s*t*c-1e5)/c:s*t)*c)/c;a.push({x:r,y:u})}return[...a]})),Dn(this,"checkElementCover",(e=>this.getPointPositionList().map((t=>this.checkCoverForAPoint(t.x,t.y,e))).filter((e=>!!e)).length>6)),Dn(this,"checkSizeIsVisible",((e,t,r)=>(e>50||r/e<=10)&&(t>50||r/t<=10))),Dn(this,"checkSizeOfPartInClient",(()=>{const e=this._clientSize,t=e.left,r=e.right,n=e.top,i=e.bottom,o=e.clientHeight,s=e.clientWidth,a=e.clientMin;let c,u,d,l;if(t<0)c=0;else{if(!(t<s))return!1;c=t}if(r<0)return!1;if(u=r<s?r:s,n<0)d=0;else{if(!(n<o))return!1;d=n}if(i<0)return!1;l=i<o?i:o;const h=u-c,p=l-d;return this.checkSizeIsVisible(h,p,a)})),Dn(this,"returnHiddenResult",(e=>(this._clientSize=null,{visible:!1,reason:e}))),Dn(this,"checkOneElementVisible",(e=>{if(e instanceof HTMLElement){if(this.checkElementIsMountedOnDom(e)){if(this.checkActualCssVisibleIncludeInherit(e)){if(this._clientSize=this.getSizeAboutClient(e),this.checkElementCover(e))return this.returnHiddenResult(Wn.COVERED);{const e=this.checkActualSize(),t=this.checkSizeOfPartInClient();return e&&!t?this.returnHiddenResult(Wn.POSITION):e?(this._clientSize=null,{visible:!0}):this.returnHiddenResult(Wn.SIZE)}}return this.returnHiddenResult(Wn.STYLE)}return this.returnHiddenResult(Hn.UNMOUNTED)}return this.returnHiddenResult(Hn.INVALID_HTML_ELEMENT)})),Dn(this,"checkElementIsMountedOnDom",(e=>this.checkPropertyUpToAllParentNodes(e,(e=>"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement))))}};const Yn=function(e,t){const r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r};class Xn{constructor(){Dn(this,"_events",{}),Dn(this,"addListener",this.on)}getListeners(e){return this._events[e]?this._events[e].map((e=>e.listener)):[]}on(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!1})}once(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!0})}off(e,t){if(!this._events[e])return;const r=this._events[e],n=this._indexOfListener(r,t);-1!==n&&r.splice(n,1),0===this._events[e].length&&delete this._events[e]}removeAllListeners(e){e?delete this._events[e]:this._events={}}emit(e){this._events[e]||(this._events[e]=[]);const t=this._events[e].map((e=>e));for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(let r=0;r<t.length;r+=1){const i=t[r];i.once&&this.off(e,i.listener),i.listener.apply(this,n||[])}}safeEmit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];[...this._events[e]||[]].forEach((t=>{t.once&&this.off(e,t.listener);try{t.listener.apply(this,r)}catch(t){console.error("safeEmit event:".concat(e," error ").concat(null==t?void 0:t.toString()))}}))}_indexOfListener(e,t){let r=e.length;for(;r--;)if(e[r].listener===t)return r;return-1}}function Zn(){return!!Jn()}let zn=null;function Jn(){if(zn)return zn;if(window.electron)return zn=window.electron;if(!window.require)return null;try{return zn=window.require("electron"),zn}catch(e){return null}}let Qn=function(e){return e.CREATE_CLIENT="createClient",e.CREATE_CLIENT_PRECONNECT="createClientPreconnect",e.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",e.SET_AREA="setArea",e.PRELOAD="PRELOAD",e.CHECK_VIDEO_TRACK_IS_ACTIVE="checkVideoTrackIsActive",e.CHECK_AUDIO_TRACK_IS_ACTIVE="checkAudioTrackIsActive",e.CREATE_MIC_AUDIO_TRACK="createMicrophoneAudioTrack",e.CREATE_CUSTOM_AUDIO_TRACK="createCustomAudioTrack",e.CREATE_BUFFER_AUDIO_TRACK="createBufferSourceAudioTrack",e.CREATE_CAM_VIDEO_TRACK="createCameraVideoTrack",e.CREATE_CUSTOM_VIDEO_TRACK="createCustomVideoTrack",e.CREATE_MIC_AND_CAM_TRACKS="createMicrophoneAndCameraTracks",e.CREATE_SCREEN_VIDEO_TRACK="createScreenVideoTrack",e.SET_ENCRYPTION_CONFIG="Client.setEncryptionConfig",e.START_PROXY_SERVER="Client.startProxyServer",e.STOP_PROXY_SERVER="Client.stopProxyServer",e.SET_PROXY_SERVER="Client.setProxyServer",e.SET_TURN_SERVER="Client.setTurnServer",e.SET_CLIENT_ROLE="Client.setClientRole",e.SET_LOW_STREAM_PARAMETER="Client.setLowStreamParameter",e.ENABLE_DUAL_STREAM="Client.enableDualStream",e.DISABLE_DUAL_STREAM="Client.disableDualStream",e.JOIN="Client.join",e.LEAVE="Client.leave",e.PUBLISH="Client.publish",e.UNPUBLISH="Client.unpublish",e.SUBSCRIBE="Client.subscribe",e.MASS_SUBSCRIBE="Client.massSubscribe",e.MASS_UNSUBSCRIBE="Client.massUnsubscribe",e.UNSUBSCRIBE="Client.unsubscribe",e.RENEW_TOKEN="Client.renewToken",e.SET_REMOTE_VIDEO_STREAM_TYPE="Client.setRemoteVideoStreamType",e.SET_STREAM_FALLBACK_OPTION="Client.setStreamFallbackOption",e.ENABLE_AUDIO_VOLUME_INDICATOR="Client.enableAudioVolumeIndicator",e.SEND_CUSTOM_REPORT_MESSAGE="Client.sendCustomReportMessage",e.INSPECT_VIDEO_CONTENT="Client.inspectVideoContent",e.STOP_INSPECT_VIDEO_CONTENT="Client.stopInspectVideoContent",e.JOIN_FALLBACK_TO_PROXY="Client._joinFallbackToProxy",e.ON_LIVE_STREAM_WARNING="Client.onLiveStreamWarning",e.ON_LIVE_STREAM_ERROR="Client.onLiveStreamingError",e.START_LIVE_STREAMING="Client.startLiveStreaming",e.SET_LIVE_TRANSCODING="Client.setLiveTranscoding",e.STOP_LIVE_STREAMING="Client.stopLiveStreaming",e.START_CHANNEL_MEDIA_RELAY="Client.startChannelMediaRelay",e.UPDATE_CHANNEL_MEDIA_RELAY="Client.updateChannelMediaRelay",e.STOP_CHANNEL_MEDIA_RELAY="Client.stopChannelMediaRelay",e.REQUEST_CONFIG_DISTRIBUTE="_config-distribute-request",e.SET_CONFIG_DISTRIBUTE="_configDistribute",e.LOCAL_TRACK_SET_MUTED="LocalTrack.setMute",e.LOCAL_AUDIO_TRACK_PLAY="LocalAudioTrack.play",e.LOCAL_AUDIO_TRACK_PLAY_IN_ELEMENT="LocalAudioTrack.playInElement",e.LOCAL_AUDIO_TRACK_STOP="LocalAudioTrack.stop",e.LOCAL_AUDIO_TRACK_SET_VOLUME="LocalAudioTrack.setVolume",e.MIC_AUDIO_TRACK_SET_DEVICE="MicrophoneAudioTrack.setDevice",e.BUFFER_AUDIO_TRACK_START="BufferSourceAudioTrack.startProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_STOP="BufferSourceAudioTrack.stopProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_PAUSE="BufferSourceAudioTrack.pauseProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_RESUME="BufferSourceAudioTrack.resumeProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_SEEK="BufferSourceAudioTrack.seekAudioBuffer",e.LOCAL_VIDEO_TRACK_PLAY="LocalVideoTrack.play",e.LOCAL_VIDEO_TRACK_STOP="LocalVideoTrack.stop",e.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE="LocalVideoTrack.getVideoElementVisibleStatus",e.LOCAL_VIDEO_TRACK_BEAUTY="LocalVideoTrack.setBeautyEffect",e.LOCAL_VIDEO_SEND_SEI_DATA="LocalVideoTrack.sendSeiData",e.CAM_VIDEO_TRACK_SET_DEVICE="CameraVideoTrack.setDevice",e.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG="CameraVideoTrack.setEncoderConfiguration",e.REMOTE_VIDEO_TRACK_PLAY="RemoteVideoTrack.play",e.REMOTE_VIDEO_TRACK_STOP="RemoteVideoTrack.stop",e.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE="RemoteVideoTrack.getVideoElementVisibleStatus",e.REMOTE_AUDIO_TRACK_PLAY="RemoteAudioTrack.play",e.REMOTE_AUDIO_TRACK_STOP="RemoteAudioTrack.stop",e.REMOTE_AUDIO_SET_VOLUME="RemoteAudioTrack.setVolume",e.REMOTE_AUDIO_SET_OUTPUT_DEVICE="RemoteAudioTrack.setOutputDevice",e.GET_MEDIA_STREAM_TRACK="Track.getMediaStreamTrack",e.STREAM_TYPE_CHANGE="streamTypeChange",e.CONNECTION_STATE_CHANGE="connectionStateChange",e.LOAD_CONFIG_FROM_LOCALSTORAGE="loadConfigFromLocalStorage",e.IMAGE_MODERATION_UPLOAD="imageModerationUpload",e.REPUB_AFTER_PC_CONNECTED="repubAfterPCConnected",e.PRELOAD_MEDIA_FAILED="preloadMediaFailed",e.MISMATCH_DTLS_PARAMETERS="mismatchDtlsParameters",e.MISMATCH_ICE_PARAMETERS="mismatchIceParameters",e.VOS_FALLBACK_CN="vosFallbackCN",e.DATACHANNEL_FAILBACK="datachannelFailback",e}({}),qn=function(e){return e.TRACER="tracer",e}({});!function(e){e[e.AUDIENCE_LEVEL_LOW_LATENCY=1]="AUDIENCE_LEVEL_LOW_LATENCY",e[e.AUDIENCE_LEVEL_ULTRA_LOW_LATENCY=2]="AUDIENCE_LEVEL_ULTRA_LOW_LATENCY",e[e.AUDIENCE_LEVEL_SYNC_LATENCY=3]="AUDIENCE_LEVEL_SYNC_LATENCY"}({}),function(e){e.LEAVE="LEAVE",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.UID_BANNED="UID_BANNED",e.FALLBACK="FALLBACK",e.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.LICENSE_MISSING="LICENSE_MISSING",e.LICENSE_EXPIRED="LICENSE_EXPIRED",e.LICENSE_MINUTES_EXCEEDED="LICENSE_MINUTES_EXCEEDED",e.LICENSE_PERIOD_INVALID="LICENSE_PERIOD_INVALID",e.LICENSE_MULTIPLE_SDK_SERVICE="LICENSE_MULTIPLE_SDK_SERVICE",e.LICENSE_ILLEGAL="LICENSE_ILLEGAL",e.TOKEN_EXPIRE="TOKEN_EXPIRE",e.FALLBACK_TO_HLS="FALLBACK_TO_HLS",e.UID_CONFLICT="UID_CONFLICT"}({}),function(e){e[e.AUTO_SIMULCAST_STREAM=-1]="AUTO_SIMULCAST_STREAM",e[e.DISABLE_SIMULCAST_STREM=0]="DISABLE_SIMULCAST_STREM",e[e.ENABLE_SIMULCAST_STREAM=1]="ENABLE_SIMULCAST_STREAM"}({}),function(e){e.PEERCONNECTION_STATE_CHANGE="peerconnection-state-change",e.AUDIO_METADATA="audio-metadata",e.AUDIO_PTS="audio-pts",e.CONNECTION_STATE_CHANGE="connection-state-change",e.MEDIA_RECONNECT_START="media-reconnect-start",e.MEDIA_RECONNECT_END="media-reconnect-end",e.IS_USING_CLOUD_PROXY="is-using-cloud-proxy",e.USER_JOINED="user-joined",e.USER_LEAVED="user-left",e.USER_PUBLISHED="user-published",e.USER_UNPUBLISHED="user-unpublished",e.USER_INFO_UPDATED="user-info-updated",e.CLIENT_BANNED="client-banned",e.CHANNEL_MEDIA_RELAY_STATE="channel-media-relay-state",e.CHANNEL_MEDIA_RELAY_EVENT="channel-media-relay-event",e.VOLUME_INDICATOR="volume-indicator",e.CRYPT_ERROR="crypt-error",e.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="token-privilege-will-expire",e.ON_TOKEN_PRIVILEGE_DID_EXPIRE="token-privilege-did-expire",e.NETWORK_QUALITY="network-quality",e.STREAM_TYPE_CHANGED="stream-type-changed",e.STREAM_FALLBACK="stream-fallback",e.RECEIVE_METADATA="receive-metadata",e.STREAM_MESSAGE="stream-message",e.LIVE_STREAMING_ERROR="live-streaming-error",e.LIVE_STREAMING_WARNING="live-streaming-warning",e.EXCEPTION="exception",e.ERROR="error",e.P2P_LOST="p2p_lost",e.JOIN_FALLBACK_TO_PROXY="join-fallback-to-proxy",e.CHANNEL_FALLBACK_TO_WEBSOCKET="channel-fallback-to-websocket",e.MEDIA_CONNECTION_TYPE_CHANGE="media-connection-type-change",e.PUBLISHED_USER_LIST="published-user-list",e.USER_LIST="user-list",e.CONTENT_INSPECT_CONNECTION_STATE_CHANGE="content-inspect-connection-state-change",e.CONTENT_INSPECT_ERROR="content-inspect-error",e.CONTENT_INSPECT_RESULT="content-inspect-result",e.IMAGE_MODERATION_CONNECTION_STATE_CHANGE="image-moderation-connection-state-change",e.FALLBACK_TO_HLS="fallback-to-hls",e.FIRST_VIDEO_BUFFER_READY="first-video-buffer-ready",e.FIRST_VIDEO_PRE_RENDER="first-video-pre-render",e.AV1_DECODABLE_RESULT="av1-decodable-result"}({}),function(e){e.CONFIG="config",e.VOSERROR="vos_error",e.AP_ERROR="ap_error"}({}),function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.MULTI_IP="MULTI_IP",e.TIMEOUT="TIMEOUT",e.OFFLINE="OFFLINE",e.LEAVE="LEAVE",e.P2P_FAILED="P2P_FAILED",e.FALLBACK="FALLBACK",e.REGIONAL_DISTRIBUTION="REGIONAL_DISTRIBUTION"}({});let $n=function(e){return e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({}),ei=function(e){return e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({});function ti(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return 0===e.getListeners(t).length?Promise.reject(new xn(Un.UNEXPECTED_ERROR,"can not emit promise")):new Promise(((r,i)=>{e.emit(t,...n,r,i)}))}function ri(e,t){if(0===e.getListeners(t).length)return Promise.resolve();for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return ti(e,t,...n)}function ni(e,t){if(0===e.getListeners(t).length)return null;for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return function(e,t){let r=null,n=null;for(var i=arguments.length,o=new Array(i>2?i-2:0),s=2;s<i;s++)o[s-2]=arguments[s];if(e.emit(t,...o,(e=>{r=e}),(e=>{n=e})),null!==n)throw n;if(null===r)throw new xn(Un.UNEXPECTED_ERROR,"handler is not sync");return r}(e,t,...n)}const ii=new class extends Xn{set networkState(e){this.emit(ei.NETWORK_STATE_CHANGE,e,this._networkState),e===$n.ONLINE?this.emit(ei.ONLINE):e===$n.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(ei.ONLINE,(()=>{this.onlineWaiter=void 0,e($n.ONLINE)}))})),this.emit(ei.OFFLINE)),this._networkState=e}get networkState(){return this._networkState}get isOnline(){return this._networkState===$n.ONLINE}constructor(){super(),Dn(this,"_moduleName","network-indicator"),Dn(this,"_networkState",$n.ONLINE),Dn(this,"onlineWaiter",void 0),window.addEventListener("online",(()=>{this.networkState=$n.ONLINE})),window.addEventListener("offline",(()=>{this.networkState=$n.OFFLINE}))}},oi=[];for(let e=0;e<256;++e)oi.push((e+256).toString(16).slice(1));const si="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);let ai;const ci=new Uint8Array(16);function ui(){return si?si():function(e,t,r){var n,i,o,s;const a=null!==(n=null!==(i=(e=e||{}).random)&&void 0!==i?i:null===(o=(s=e).rng)||void 0===o?void 0:o.call(s))&&void 0!==n?n:function(){if(!ai){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");ai=crypto.getRandomValues.bind(crypto)}return ai(ci)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError("UUID byte range ".concat(r,":").concat(r+15," is out of buffer bounds"));for(let e=0;e<16;++e)t[r+e]=a[e];return t}return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(oi[e[t+0]]+oi[e[t+1]]+oi[e[t+2]]+oi[e[t+3]]+"-"+oi[e[t+4]]+oi[e[t+5]]+"-"+oi[e[t+6]]+oi[e[t+7]]+"-"+oi[e[t+8]]+oi[e[t+9]]+"-"+oi[e[t+10]]+oi[e[t+11]]+oi[e[t+12]]+oi[e[t+13]]+oi[e[t+14]]+oi[e[t+15]]).toLowerCase()}(a)}(e,t,undefined);var e,t}function di(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function li(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function hi(e){return JSON.parse(JSON.stringify(e))}function pi(e){try{return hi(e)}catch(t){return e}}const fi={};function Ei(e,t){fi[t]||(fi[t]=!0,e())}function mi(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function _i(e){return new Promise((t=>{window.setTimeout(t,e)}))}function Ti(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7,t=arguments.length>1?arguments[1]:void 0;const r=Math.random().toString(16).substr(2,e).toLowerCase();return r.length===e?"".concat(t).concat(r):"".concat(t).concat(r)+Ti(e-r.length,"")}const gi=()=>{},Si=new class{constructor(){Dn(this,"fnMap",new Map)}throttleByKey(e,t,r,n){for(var i=arguments.length,o=new Array(i>4?i-4:0),s=4;s<i;s++)o[s-4]=arguments[s];if(this.fnMap.has(t)){const i=this.fnMap.get(t);if(i.threshold!==r){i.fn(...i.args),clearTimeout(i.timer);const s=window.setTimeout((()=>{const e=this.fnMap.get(t);e&&e.fn(...e.args),this.fnMap.delete(t)}),r);this.fnMap.set(t,{fn:e,threshold:r,timer:s,args:o,skipFn:n})}else i.skipFn&&i.skipFn(...i.args),this.fnMap.set(t,kn(kn({},i),{},{fn:e,args:o,skipFn:n}))}else{const i=window.setTimeout((()=>{const e=this.fnMap.get(t);e&&e.fn(...e.args),this.fnMap.delete(t)}),r);this.fnMap.set(t,{fn:e,threshold:r,timer:i,args:o,skipFn:n})}}},Ri=Si.throttleByKey.bind(Si);function vi(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function yi(e,t){if(!vi(e)||!vi(t))return t;if(Array.isArray(e)&&!Array.isArray(t)||!Array.isArray(e)&&Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e)){const r=[...e];for(let n=0;n<t.length;n++)r[n]=yi(e[n],t[n]);return r}{const r=kn({},e);for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?r[n]=yi(e[n],t[n]):r[n]=t[n]);return r}}function Ai(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}function bi(e){return e.reduce(((e,t)=>e+t),0)}let Oi=1,Ii=console;class Ci{static setLogger(e){Ii=e}constructor(e,t){Dn(this,"id",void 0),Dn(this,"lockingPromise",Promise.resolve()),Dn(this,"locks",0),Dn(this,"name",""),Dn(this,"lockId",void 0),this.lockId=Oi++,e&&(this.name=e),t&&(this.id=t),this.logger("created")}logger(e,t){const r=(this.id?"[".concat(this.id,"]"):"")+"[lock-".concat(this.name,"-").concat(this.lockId,"]"),n="created"===e?"is ".concat(e,"."):"is ".concat(e,", current queue ").concat(this.locks,". ").concat(null!=t?t:"");Ii.debug("".concat(r," ").concat(n))}setId(e){this.id=e}get isLocked(){return this.locks>0}lock(e){let t;this.locks+=1,this.logger("locked",e);const r=new Promise((r=>{t=()=>{this.locks-=1,this.logger("unlocked",e),r()}})),n=this.lockingPromise.then((()=>t));return this.lockingPromise=this.lockingPromise.then((()=>r)),n}}function wi(e,t){return function(r,n,i){const o=i.value;if("function"!=typeof o)throw new Error("Cannot use mutex on object property.");return i.value=async function(){const r=this[t];if(!r)throw new Error("mutex property key ".concat(t," doesn't exist on ").concat(e));const i=await r.lock("From ".concat(e,".").concat(n));try{for(var s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];return await o.apply(this,a)}finally{i()}},i}}const Ni={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function Pi(e,t,r,n){const i=Object.assign({},Ni,n);let o=i.timeout;const s=async()=>{await function(e){return new Promise((t=>{window.setTimeout(t,e)}))}(o),o*=i.timeoutFactor,o=Math.min(i.maxRetryTimeout,o)};let a=!1;const c=new Promise((async(n,o)=>{t=t||(()=>!1),r=r||(()=>!0);for(let c=0;c<i.maxRetryCount;c+=1){if(a)return o(new xn(Un.OPERATION_ABORTED));try{const r=await e();if(!t(r,c))return n(r);if(c+1===i.maxRetryCount)return n(r);await s()}catch(e){if(!r(e,c))return o(e);if(c+1===i.maxRetryCount)return o(e);await s()}}}));return c.cancel=()=>a=!0,c}let Di=0,Li=0;function ki(e,t,r,n){return new Promise(((i,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),Di+=mi(t.data)):r&&(t.data.size?Di+=t.data.size:t.data instanceof FormData?Di+=function(e){let t=0;return(/DingTalk/i.test(navigator.userAgent)||/AliApp/i.test(navigator.userAgent))&&e.realFormData&&(e=e.realFormData),e.forEach((e=>{t+="string"==typeof e?mi(e):e.size})),t+138}(t.data):Di+=mi(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,en.request(t).then((e=>{"string"==typeof e.data?Li+=mi(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?Li+=e.data.byteLength:Li+=mi(JSON.stringify(e.data)),n&&i({data:e.data,headers:e.headers}),i(e.data)})).catch((e=>{en.isCancel(e)?o(new xn(Un.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?o(new xn(Un.NETWORK_TIMEOUT,e.message)):e.response?o(new xn(Un.NETWORK_RESPONSE_ERROR,e.response.status)):o(new xn(Un.NETWORK_ERROR,e.message))}))}))}async function Mi(e,t){const r=new Blob([t.data],{type:"buffer"});return await ki(e,kn(kn({},t),{},{data:r,headers:{"Content-Type":"application/octet-stream"}}),!0)}!function(e){e.BANDWIDTH="bandwidth",e.CPU="cpu",e.NONE="none",e.OTHER="other"}({}),function(e){e.L1T1="L1T1",e.L1T2="L1T2",e.L1T3="L1T3",e.L1T3_KEY="L1T3_KEY",e.L2T1_KEY="L2T1_KEY",e.L2T2_KEY="L2T2_KEY",e.L2T3_KEY="L2T3_KEY",e.L3T1_KEY="L3T1_KEY",e.L3T2_KEY="L3T2_KEY",e.L3T3_KEY="L3T3_KEY"}({}),function(e){e[e.new=0]="new",e[e.connecting=1]="connecting",e[e.connected=2]="connected",e[e.disconnected=3]="disconnected",e[e.failed=4]="failed",e[e.closed=5]="closed"}({}),function(e){e.CERTIFICATE="certificate",e.CODEC="codec",e.CANDIDATE_PAIR="candidate-pair",e.LOCAL_CANDIDATE="local-candidate",e.REMOTE_CANDIDATE="remote-candidate",e.INBOUND="inbound-rtp",e.TRACK="track",e.OUTBOUND="outbound-rtp",e.PC="peer-connection",e.REMOTE_INBOUND="remote-inbound-rtp",e.REMOTE_OUTBOUND="remote-outbound-rtp",e.TRANSPORT="transport",e.CSRC="csrc",e.DATA_CHANNEL="data-channel",e.STREAM="stream",e.SENDER="sender",e.RECEIVER="receiver"}({});var Ui=function(e){return e[e.kNone=1]="kNone",e[e.kMillisecondsFromSeconds=1e3]="kMillisecondsFromSeconds",e[e.kBytesToBits=8]="kBytesToBits",e}(Ui||{});const xi="websdk_ng_install_id";function Vi(){try{if(Hi("INSTALL_ID"))return Hi("INSTALL_ID");let e=window.localStorage.getItem(xi);return e||(e=function(){let e,t=!1;try{e=ui().replaceAll("-","")}catch(e){t=!0}return!t&&e&&32===e.length||(e=Ti(32,"")),e.toUpperCase()}(),window.localStorage.setItem(xi,e)),Wi("INSTALL_ID",e),e}catch(e){return}}const Fi=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;const t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-([0-9]+)/);if(t&&t[1]&&t[2]){const e=t[1],r=t[2];return"".concat(e,".").concat(r)}return"4.0.0.999"}("4.24.8-1"),Bi=function(){try{return!0===JSON.parse("true")}catch(e){return!0}}();!function(e){e.Default="default",e.Auto="auto",e.Relay="relay",e.SdRtn="sd-rtn"}({});const ji=function(){const e="us".concat("erna","me"),t="pa".concat("sswo","rd"),r=["t","s","t"];r.splice(1,0,"e");const n=r.join(""),i=[];for(let e=0;e<6;e++)i.push("1");const o=i.join(""),s={};return s[e]=n,s[t]=o,Object.assign(s,{turnServerURL:"",tcpport:3433,udpport:3478,forceturn:!1})}();window.DEFAULT_TURN_CONFIG=ji;const Gi=kn(kn(kn(kn({},{ENABLE_EVENT_REPORT:!0,UPLOAD_LOG:!1,ENABLE_AG_ADAPTATION:!0,FORCE_AG_HIGH_FRAMERATE:!1,FORCE_SUPPORT_AG_ADAPTATION:!1,ENCODER_CONFIG_LIMIT:{},CAMERA_CAPTURE_CONFIG:void 0,ENABLE_PRELOAD:!0,ENABLE_CREATE_CLIENT_PRECONNECT:!0,CREATE_CLIENT_PRECONNECT_MODE:"report",CREATE_CLIENT_PRECONNECT_KEEPALIVE:!1,CREATE_CLIENT_PRECONNECT_INTERVAL_MS:55e3,NEW_ICE_RESTART:!0,ICE_RESTART_INTERVAL:1e4,RESTART_SEQUENCE:["udp_tcp_relay","relay"],FIRST_TCP_CANDIDATE:!1,MAX_CONFIG_RETRY:10,ENABLE_CONFIG_RESTORE:!1,CONFIG_RESTORE_ERROR_API:["createClient","Client.join"],CONFIG_ERROR_MONITOR:["INVALID_OPERATION","UNEXPECTED_ERROR"],BLOCKED_CONFIG_MAX_TIME:864e5,FIRST_TCP_CANDIDATE_INTERVAL:1e3,TURN_DOMAIN:"edge.agora.io",TURN_DOMAINS:["edge.agora.io"],USE_TURN_IP:!0,NEW_TURN_MODE:4,NEW_FORCE_TURN:!1,USE_NEW_RENDER_FREEZE_TIME:!0,FLS_FALLBACK_TIMEOUT:3e4,RTE_DETAIL_REPORT_INTERVAL:6e4,ENCODE_EXCEPTION_TIMES:5,ENABLE_ENCODE_EXCEPTION:!0,ENABLE_DECODE_RECOVERY:!1,DECODE_RECOVERY_MAX_ATTEMPTS:5,DECODE_RECOVERY_BASE_INTERVAL:1e4,ENCODE_EXCEPTION_VALIDATE_CODEC:["h264"],VIDEO_ENCODER_CONFIG_LIST:[{width:240,height:180},{width:320,height:240},{width:400,height:300},{width:480,height:360},{width:560,height:420},{width:640,height:480}],DELETE_NEQ_AFTER_USER_LEAVE:!0,UPDATE_RTP_CAP_IN_HOST:!1,IOS_BG_TAG:!0,IOS_AUTO_RESTART_BG_TAG:!0,IGNORE_UID_CHECK:!1,ENABLE_UP_SPS_PPS:!1,ENABLE_DOWN_SPS_PPS:!0,NO_EDGES_RETRY:!0,BUFFER_READY_FRAMES:3,FLS_SYNC_AV_PLAY_LIMIT:0,FLS_BUFFER_WAIT_TIME:1500,VOS_CONFIGURE:void 0,ENABLE_QUALITY_FALLBACK:!1,QUALITY_FALLBACK_REHEARSAL:!0,ENABLE_FLS_AV1_FIRST:!1,ENABLE_AP_MULTI_IP:!0,FLS_ENABLE_AV1_DETECT:!0,FLS_ENABLE_AV1_DECODE_DETECT:!0,ENABLE_SDP_ENDPOINT_LOG:!1,REMOTE_VIDEO_FREEZE_TIME_VERSION:2,ENABLE_ICE_EARLY_JOIN:!0}),{},{PROCESS_ID:"",ENCRYPT_AES:!0,AREAS:["CHINA","GLOBAL"],WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],SDP_ENDPOINT_DOMAIN:["sdp-ap-web-1.rtnsvc.com","sdp-ap-web-1.rtesvc.com"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-web-2.ap.sd-rtn.com","cds-ap-web-3.agora.io","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-web-2.ap.sd-rtn.com","sua-ap-web-3.agora.io","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-ap-web-1.agora.io","uap-web-2.ap.sd-rtn.com","uap-ap-web-3.agora.io","uap-web-4.ap.sd-rtn.com"],LOG_UPLOAD_SERVER:"logservice.agora.io",EVENT_REPORT_DOMAIN:"statscollector-1.agora.io",EVENT_REPORT_BACKUP_DOMAIN:"web-2.statscollector.sd-rtn.com",GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",HTTP_CONNECT_TIMEOUT:5e3,SIGNAL_REQUEST_TIMEOUT:1e4,REPORT_STATS:!0,NOT_REPORT_EVENT:[],PING_PONG_TIME_OUT:10,WEBSOCKET_TIMEOUT_MIN:1e4,EVENT_REPORT_SEND_INTERVAL:3e3,CONFIG_DISTRIBUTE_INTERVAL:3e5,ENABLE_CONFIG_DISTRIBUTE:!0,CANDIDATE_TIMEOUT:5e3,SHOW_REPORT_INVOKER_LOG:!1,SHOW_REPORT_USER_INVOKER_LOG:!0,JOIN_EXTEND:"",PUB_EXTEND:"",SUB_EXTEND:"",FORCE_TURN:!1,TURN_ENABLE_TCP:!0,TURN_ENABLE_UDP:!0,MAX_UPLOAD_CACHE:50,UPLOAD_CACHE_INTERVAL:2e3,AJAX_REQUEST_CONCURRENT:3,REPORT_APP_SCENARIO:void 0,GATEWAY_DOMAINS:["edge.agora.io","edge.sd-rtn.com"],CONNECT_GATEWAY_WITHOUT_DOMAIN:!1,WORKER_DOMAIN:"edge.agora.io",EVENT_REPORT_RETRY:!0,CHROME_FORCE_PLAN_B:!1,AUDIO_SOURCE_VOLUME_UPDATE_INTERVAL:400,AUDIO_SOURCE_AVG_VOLUME_DURATION:3e3,AUDIO_VOLUME_INDICATION_INTERVAL:2e3,VOLUME_VOICE_WEIGHT:10,GET_VOLUME_OF_MUTED_AUDIO_TRACK:!1,STATS_UPDATE_INTERVAL:250,NORMAL_EVENT_QUEUE_CAPACITY:100,CUSTOM_REPORT:!0,CUSTOM_REPORT_LIMIT:20,PROXY_SERVER_TYPE2:"webnginx-proxy.agora.io",PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com","webrtc-cloud-proxy.agora.io"],CUSTOM_PUB_ANSWER_MODIFIER:null,CUSTOM_SUB_ANSWER_MODIFIER:null,CUSTOM_PUB_OFFER_MODIFIER:null,CUSTOM_SUB_OFFER_MODIFIER:null,DSCP_TYPE:"high",REMOVE_NEW_CODECS:!0,FRAGEMENT_LENGTH:3,WEBSOCKET_COMPRESS:!1,SIMULCAST:!1,CHECK_VIDEO_VISIBLE_INTERVAL:3e4,CHECK_LOCAL_STATS_INTERVAL:250,PROFILE_SWITCH_INTERVAL:2e3,UNSUPPORTED_VIDEO_CODEC:[],ENUMERATE_DEVICES_INTERVAL:!1,ENUMERATE_DEVICES_INTERVAL_TIME:1e4,USE_NEW_TOKEN:!1,CLOSE_AFB_FOR_LOCAL_AP:!0,JOIN_MAX_CONCURRENCY:6,JOIN_WITH_FALLBACK_SIGNAL_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY_FORCE:!1,JOIN_GATEWAY_TRY_443PORT_DURATION:2e3,JOIN_GATEWAY_USE_443PORT_ONLY:!1,JOIN_GATEWAY_USE_DUAL_DOMAIN:!0,JOIN_GATEWAY_FALLBACK_PORT:443,USE_TURN_SERVER_OF_GATEWAY:!1,H264_PROFILE_LEVEL_ID:"",USE_NEW_LOG:!1,LOG_VERSION:3,MEDIA_DEVICE_CONSTRAINTS:null,ENCRYPT_PROXY_USERNAME_AND_PSW:!0,SDP_LOGGING:!1,CSP_DETECTED_HOSTNAME_LIST:["agora.io","sd-rtn.com"],REMOTE_AUDIO_TRACK_USES_WEB_AUDIO:!1,LOCAL_AUDIO_TRACK_USES_WEB_AUDIO:!1,BITRATE_ADAPTER_TYPE:"STANDARD_BITRATE",AI_DENOISER_PARAMETERS:{excludedLinks:[]},ADJUST_3A_FROM_PLUGINS:!0,RAISE_H264_BASELINE_PRIORITY:!0,FILTER_SEND_H264_BASELINE:!1,FIRST_H264_PROFILE_LEVEL_ID:"42001f",FIRST_PACKETIZATION_MODE:"",X_GOOGLE_START_BITRATE:void 0,NEW_REPORT_SERVER:!1,NEW_REPORT_SERVER_DOMAINS:["data-reporting.agora.io","data-reporting.agora.io"],VIDEO_INSPECT_WORKER_MESSAGE_LENGTH_LIMIT:3e5,VIDEO_INSPECT_INTERVAL_MINIMUM:1e3,VIDEO_INSPECT_QUALITY_RATIO:.9,VIDEO_INSPECT_WORKER_MANAGER_HOST:"edge.agora.io",VIDEO_INSPECT_WORKER_MANAGER_PORT:"",VIDEO_INSPECT_WORKER_MANAGER_WSS:"",VIDEO_INSPECT_WORKER_PORT:"",SHOW_VIDEO_INSPECT_WORKER_MESSAGE:!1,STATS_COLLECTOR_PORT:443,FORCE_TURN_TCP:!1,WEBAUDIO_INIT_OPTIONS:void 0,FILTER_VIDEO_FEC:!0,FILTER_AUDIO_FEC:!1,CHROME_DUAL_STREAM_USE_ENCODING:!0,DISABLE_DUAL_STREAM_USE_ENCODING:!1,EXTENSION_USAGE_UPLOAD_INTERVAL:1e4,ICE_RESTART:!0,FINGERPRINT:null,ENABLE_VIDEO_FRAME_CALLBACK:!0,VIDEO_FREEZE_DURATION:500,SPATIALIZER_PARAMETERS:{},UPLOAD_LOG_INTERVAL:3e3,UPLOAD_LOG_REQUEST_RETRY_INTERVAL:2e3,UPLOAD_LOG_REQUEST_MAX_RETRY_INTERVAL:2e4,UPLOAD_LOG_TRY_INTERVAL_WHILE_OFF:5e3,UPLOAD_LOG_RETRY_INTERVAL_V1:1e4,UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1:200,UPLOAD_LOG_LENGTH_EACH_TIME:10,APP_TYPE:0,DISABLE_WEBAUDIO:!1,CHANNEL_MEDIA_RELAY_SERVERS:void 0,KEEP_LAST_FRAME:!0,FORWARD_P2P_CREATION:!0,SYNC_GROUP:!0,BLOCK_LOCAL_CLIENT:!1,ENABLE_AUDIO_TOPN:!1,ENABLE_AUDIO_METADATA:!1,ENABLE_AUDIO_PTS:!1,TOPN_SMOOTH_LEVEL:void 0,TOPN_NEW_SPEAKER_DELAY:void 0,TOPN_SWITCH_HOLD_MS:void 0,TOPN_AUDIO_GAIN:void 0,TOPN_SILENCE_THRESHOLD:250,AP_AREA:!0,ENABLE_ENCODED_TRANSFORM:!1,ENABLE_VIDEO_SEI:!1,IMAGE_MODERATION_WORKER_HOST:"edge.agora.io",IMAGE_MODERATION_WORKER_WSS:"",IMAGE_MODERATION_WORKER_MESSAGE_LENGTH_LIMIT:3e5,IMAGE_MODERATION_INTERVAL_MINIMUM:1e3,SHOW_IMAGE_MODERATION_WORKER_MESSAGE:!1,IMAGE_MODERATION_QUALITY_RATIO:.9,IMAGE_MODERATION_UPLOAD_REPORT_INTERVAL:5e3,SHOW_GLOBAL_CLIENT_LIST:!1,DATASTREAM_MAX_RETRANSMITS:10,TCP_CANDIDATE_ONLY:!1,EXTERNAL_SIGNAL_REQUEST_TIMEOUT:3e3,SHOW_P2P_LOG:!1,MAX_P2P_TIMEOUT:3e4,P2P_TOKEN_INTERVAL:1e3,SHOW_DATASTREAM2_LOG:!1,RESTRICTION_SET_PLAYBACK_DEVICE:!0,USE_PURE_ENCRYPTION_MASTER_KEY:!1,ENABLE_AUDIO_RED:!1,OPUS_PTIME:void 0,AUDIO_DUPLICATE_NUM:void 0,ENABLE_ABSSENDTIME_AS_SENTTS:!0,ACCOUNT_REGISTER_RETRY_TIMEOUT:1,ACCOUNT_REGISTER_RETRY_RATIO:2,ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX:6e4,ACCOUNT_REGISTER_RETRY_COUNT_MAX:1e5,AUDIO_CONTEXT:null,WEBCS_BACKUP_CONNECT_TIMEOUT:6e3,PLAYER_STATE_DEFER:2e3,SIGNAL_REQUEST_WATCH_INTERVAL:1e3,FILEPATH_LENMAX:255,DUALSTREAM_OPERATION_CHECK:!0,MEDIA_ELEMENT_EXISTS_DEPTH:3,SHIM_CANDIDATE:!1,LEAVE_MSG_TIMEOUT:2e3,STATS_FILTER:{transportId:!0,googTrackId:!0},FILTER_VIDEO_CODEC:[],SIGNAL_CHANNEL:0,TRANSMITTER_INITIAL_RTT:30,TRANSMITTER_INITIAL_RTO:30,TRANSMITTER_MAX_BATCH_ACK_COUNT:2,TRANSMITTER_MAX_RTO:500,DATACHANNEL_COMPRESS:!1,DC_JOIN_WITH_FAILBACK:4e3,DC_CONNECTION_TIMEOUT:2e3,DC_PINGPONG_INTERVAL:2e3,DC_DEBUG_LOG:!1,UNSUPPORTED_VIDEO_UPLINK_CODEC:[],UNSUPPORTED_VIDEO_DOWNLINK_CODEC:[],USE_NEW_NETWORK_CONFIG:!1,AUTO_RESET_AUDIO_ROUTE:!1,PLUGIN_INFO:[],OVERUSE_DETECTOR_PARAMS:{MIN_FRAME_RATE:1,MAX_FRAME_RATE:30,MAX_THRESHOLD_FRAMERATE:30,BITRATE_MIN_THRESHOLD:100,BITRATE_MAX_THRESHOLD:100,MAX_SCALE:5,BWE_SCALE_UP_THRESHOLD:.6,BWE_SCALE_DOWN_THRESHOLD:.6,PERF_SCALE_UP_THRESHOLD:.7,PERF_SCALE_DOWN_THRESHOLD:.6,MOTION_RESOLUTION_FACTOR:.8,MOTION_BITRATE_FACTOR:.6,DETAIL_FRAMERATE_FACTOR:.8,DETAIL_BITRATE_FACTOR:.6,BALANCE_RESOLUTION_FACTOR:.9,BALANCE_FRAMERATE_FACTOR:.9,BALANCE_BITRATE_FACTOR:.6,OVERUSE_TIMES_THRESHOLD:10,UNDERUSE_TIMES_THRESHOLD:40},CUSTOM_ADAPTATION_DEFAULT_MODE:"",HIDE_NO_POSTER:!1,AP_CACHE_NUM:10,AP_UPDATE_INTERVAL:12e4,AP_CACHE_LIFETIME:12e4,MAX_PRELOAD_ASYNC_LENGTH:3,DISABLE_SCREEN_SHARE_REMB:!1},{ENABLE_PUBLISHED_USER_LIST:!0,ENABLE_USER_LIST:!1,MAX_SUBSCRIPTION:50,SUBSCRIBE_AUDIO_FILTER_TOPN:void 0,ENABLE_PUBLISH_AUDIO_FILTER:void 0,ENABLE_USER_LICENSE_CHECK:!0,DISABLE_FEC:void 0,ENABLE_NTP_REPORT:!0,ENABLE_INSTANT_VIDEO:!1,ENABLE_USER_AUTO_REBALANCE_CHECK:!0,ENABLE_LOSSBASED_BWE:!0,ENABLE_AUT_CC:!0,FORCE_ENABLE_AUT_CC:!1,ENABLE_CC_FALLBACK:void 0,SUBSCRIBE_TWCC:!0,PUBLISH_TWCC:!1,ENABLE_SVC_DEFAULT_CODECS:["H264","VP8","VP9","AV1"],SVC:[],ENABLE_FULL_LINK_AV_SYNC:!1,SVC_MODE:null,ENABLE_AUT_FEEDBACK:!0,SVC_EXTENDED:["VP9"],ENABLE_AP_COMPRESS:!0}),{},{USE_CANDIDATE_FROM_AP_DETAIL:!1,AP_REQUEST_DETAIL:void 0,AP_REQUEST_DETAIL_EXTEND:void 0,ENABLE_ROLE_SELECT_EDGE:!1,CLIENT_ROLE_OPTIONS:void 0,REMOTE_VIDEO_STREAM_TYPE:void 0,COMPATIBLE_SDP_EXTENSION:["gdpr_forbidden"],LIMIT_BITRATE:void 0,EXPERIMENTS:{},USE_PUB_RTX:!0,USE_SUB_RTX:!0,ENABLE_DATASTREAM_2:!1,USE_XR:!0,ENABLE_PREALLOC_PC:!1,FLEXIBLE_PC:!1,ENABLE_PRE_SUB:!1,ENABLE_JOIN_V4:!1,ENABLE_SVC:!1,ENABLE_FORCE_HLS:!1,MAX_WEBAUDIO_VOLUME:300,ENABLE_VOS_FALLBACK:!1,ENABLE_FALLBACK_TO_HLS:!1,ENABLE_PRE_RENDER:!1,FORCE_DISABLE_AUTO_SUB:!1,ENABLE_PRE_SUB_WITH_PRE_PC:!0,PRE_USE_LOCAL_CODECS:!0},{INSTALL_ID:""}),{},{K_MIN_RENDER_DELAY:66,USE_STANDARD_BITRATE_DEFAULT:!1,VIDEO_NEW_BITRATE_RATIO:void 0,VIDEO_STANDARD_BITRATE_VERSION:2,BASELINE_MORE_H264_BITRATE_RATIO:1.1,IGNORE_RTC_DEVICE_CHECK:!1,FLS_AUTOPLAY_EMITS:!1,ENABLE_DUAL_STREAM_FLAG:!1,FORBID_MODIFY_LOCAL_OFFER_SDP:!1,RESERVE_MID_1_MLINE:!1,PRE_SUB_NUM:1,DC_IN_ESM:!0,PRE_PLAYOUT_DELAY_HINT:void 0});function Wi(e,t,r){var n;Object.keys(Gi).includes(e)&&(!r&&Object.keys(Ki).includes(e)||(Gi[e]=t,"ENABLE_VIDEO_SEI"!==e&&"ENABLE_AUDIO_TOPN"!==e&&"ENABLE_AUDIO_METADATA"!==e&&"ENABLE_AUDIO_PTS"!==e||!0!==t||(Gi.ENABLE_ENCODED_TRANSFORM=!0),"USE_NEW_NETWORK_CONFIG"===e&&t&&(n=!!t,Gi.USE_NEW_NETWORK_CONFIG=n,n&&(Gi.WEBCS_DOMAIN=["webrtc2-2.ap.sd-rtn.com"],Gi.WEBCS_DOMAIN_BACKUP_LIST=["webrtc2-4.ap.sd-rtn.com"],Gi.CDS_AP=["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],Gi.ACCOUNT_REGISTER=["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],Gi.EVENT_REPORT_DOMAIN="web-2.statscollector.sd-rtn.com",Gi.EVENT_REPORT_BACKUP_DOMAIN="statscollector-1.agora.io",Gi.GATEWAY_DOMAINS=["edge.sd-rtn.com"])),"ENABLE_PRE_SUB"===e&&t&&(Gi.ENABLE_INSTANT_VIDEO=!0,Gi.ENABLE_PREALLOC_PC=!0),"ENABLE_SVC"===e&&t&&(Gi.ENABLE_AUT_CC=!0),"NEW_FORCE_TURN"===e&&t&&(Gi.NEW_TURN_MODE||(Gi.NEW_TURN_MODE=4))))}function Hi(e){if("TURN_DOMAINS"===e){const e=Gi.TURN_DOMAINS;return e.includes(Hi("TURN_DOMAIN"))?e:[Hi("TURN_DOMAIN")].concat(e)}return Gi[e]}Bi||(Gi.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],Gi.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],Gi.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],Gi.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],Gi.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],Gi.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],Gi.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",Gi.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",Gi.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",Gi.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",Gi.AREAS=["NORTH_AMERICA","OVERSEA"]),function(e){e[e.REALTIME=1]="REALTIME"}({});const Ki={};var Yi=function(e){return e.SET_SESSION_ID="SET_SESSION_ID",e.SET_RTE_URL="SET_RTE_URL",e.SET_RTE_SID="SET_RTE_SID",e.SET_P2P_ID="SET_P2P_id",e.SET_DC_ID="SET_DC_id",e.SET_UID="SET_UID",e.SET_INT_UID="SET_INT_UID",e.SET_PUB_ID="SET_PUB_ID",e.SET_CLOUD_PROXY_SERVER_MODE="SET_CLOUD_PROXY_SERVER_MODE",e.KEY_METRIC_CLIENT_CREATED="KEY_METRIC_CLIENT_CREATED",e.KEY_METRIC_JOIN_START="KEY_METRIC_JOIN_START",e.KEY_METRIC_PRELOAD_START="KEY_METRIC_PRELOAD_START",e.KEY_METRIC_PRELOAD_END="KEY_METRIC_PRELOAD_END",e.KEY_METRIC_JOIN_END="KEY_METRIC_JOIN_END",e.KEY_METRIC_REQUEST_AP_START="KEY_METRIC_REQUEST_AP_START",e.KEY_METRIC_REQUEST_AP_END="KEY_METRIC_REQUEST_AP_END",e.KEY_METRIC_REQUEST_SUA_END="KEY_METRIC_REQUEST_SUA_END",e.KEY_METRIC_BEFORE_CONNECT="KEY_METRIC_BEFORE_CONNECT",e.KEY_METRIC_PEER_RECEIVER="KEY_METRIC_PEER_RECEIVER",e.KEY_METRIC_SIGNAL_CONNECTED="KEY_METRIC_SIGNAL_CONNECTED",e.KEY_METRIC_JOIN_REQ="KEY_METRIC_JOIN_REQ",e.KEY_METRIC_JOIN_REP="KEY_METRIC_JOIN_REP",e.KEY_METRIC_JOIN_GATEWAY_START="KEY_METRIC_JOIN_GATEWAY_START",e.KEY_METRIC_JOIN_GATEWAY_END="KEY_METRIC_JOIN_GATEWAY_END",e.KEY_METRIC_PEER_CONNECTION_START="KEY_METRIC_PEER_CONNECTION_START",e.KEY_METRIC_PEER_CONNECTION_END="KEY_METRIC_PEER_CONNECTION_END",e.KEY_METRIC_FIRST_VIDEO_FRAME_DECODED="KEY_METRIC_FIRST_VIDEO_FRAME_DECODED",e.KEY_METRIC_DESCRIPTION_START="KEY_METRIC_DESCRIPTION_START",e.KEY_METRIC_ICE_CONNECTION_END="KEY_METRIC_ICE_CONNECTION_END",e.KEY_METRIC_SIGNAL_CHANNEL_OPEN="KEY_METRIC_SIGNAL_CHANNEL_OPEN",e.KEY_METRIC_PUBLISH="KEY_METRIC_PUBLISH",e.KEY_METRIC_SUBSCRIBE="KEY_METRIC_SUBSCRIBE",e.RECORD_JOIN_CHANNEL_SERVICE="RECORD_JOIN_CHANNEL_SERVICE",e.RESET_JOIN_CHANNEL_SERVICE_RECORDS="RESET_JOIN_CHANNEL_SERVICE_RECORDS",e.RESET_KEY_METRICS="RESET_KEY_METRICS",e.RESET_FIRST_VIDEO_FRAME_DECODED="RESET_FIRST_VIDEO_FRAME_DECODED",e.SET_USE_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE",e}(Yi||{});function Xi(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Zi(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function zi(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Ji(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zi(Object(r),!0).forEach((function(t){Zi(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zi(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Qi(e,t){return Qi=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},Qi(e,t)}function qi(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Xi(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Xi(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $i(){$i=function(e,t){return new r(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function r(e,n,i){var o=RegExp(e,n);return t.set(o,i||t.get(e)),Qi(o,r.prototype)}function n(e,r){var n=t.get(r);return Object.keys(n).reduce((function(t,r){var i=n[r];if("number"==typeof i)t[r]=e[i];else{for(var o=0;void 0===e[i[o]]&&o+1<i.length;)o++;t[r]=e[i[o]]}return t}),Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&Qi(e,t)}(r,RegExp),r.prototype.exec=function(t){var r=e.exec.call(this,t);if(r){r.groups=n(r,this);var i=r.indices;i&&(i.groups=n(i,this))}return r},r.prototype[Symbol.replace]=function(r,i){if("string"==typeof i){var o=t.get(this);return e[Symbol.replace].call(this,r,i.replace(/\$<([^>]+)(>|$)/g,(function(e,t,r){if(""===r)return e;var n=o[t];return Array.isArray(n)?"$"+n.join("$"):"number"==typeof n?"$"+n:""})))}if("function"==typeof i){var s=this;return e[Symbol.replace].call(this,r,(function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(n(e,s)),i.apply(this,e)}))}return e[Symbol.replace].call(this,r,i)},$i.apply(this,arguments)}!function(e){e.h264="h264",e.h265="h265",e.vp8="vp8",e.vp9="vp9",e.av1="av1"}({}),function(e){e.opus="opus",e.pcma="pcma",e.pcmu="pcmu",e.g722="g722"}({}),(()=>{var e={8:(e,t,r)=>{r.r(t),r.d(t,{Parser:()=>v,Printer:()=>I,parse:()=>P,print:()=>D});const n="\n",i="".concat("\r").concat(n),o=" ";let s;function a(e){return e>="0"&&e<="9"}function c(e){return e>="!"&&e<="~"}function u(e){return c(e)||e>="€"&&e<="ÿ"}function d(e){return"!"===e||e>="#"&&e<="'"||e>="*"&&e<="+"||e>="-"&&e<="."||e>="0"&&e<="9"||e>="A"&&e<="Z"||e>="^"&&e<="~"}function l(e){return e>="1"&&e<="9"}function h(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function p(e){return"d"===e||"h"===e||"m"===e||"s"===e}function f(e){return e>""&&e<"\t"||e>"\v"&&e<"\f"||e>""&&e<"ÿ"}function E(e){return h(e)||a(e)||"+"===e||"/"===e}function m(e){return a(e)||h(e)||"+"===e||"/"===e||"-"===e||"_"===e}function _(e){return h(e)||a(e)||"+"===e||"/"===e}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){S(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e.VERSION="v",e.ORIGIN="o",e.SESSION_NAME="s",e.INFORMATION="i",e.URI="u",e.EMAIL="e",e.PHONE="p",e.CONNECTION="c",e.BANDWIDTH="b",e.TIME="t",e.REPEAT="r",e.ZONE_ADJUSTMENTS="z",e.KEY="k",e.ATTRIBUTE="a",e.MEDIA="m"}(s||(s={}));class R{consumeText(e,t){let r=t;for(;r<e.length;){const t=e[r];if("\0"===t||"\r"===t||t===n)break;r+=1}if(r-t==0)throw new Error("Invalid text, at ".concat(e));return r}consumeUnicastAddress(e,t,r){return this.consumeTill(e,t,o)}consumeOneOrMore(e,t,r){let n=t;for(;r(e[n]);)n++;if(n-t==0)throw new Error("Invalid rule at ".concat(t,"."));return n}consumeSpace(e,t){if(e[t]===o)return t+1;throw new Error("Invalid space at ".concat(t,"."))}consumeIP4Address(e,t){let r=t;for(let t=0;t<4;t++)if(r=this.consumeDecimalUChar(e,r),3!==t){if("."!==e[r])throw new Error("Invalid IP4 address.");r++}return r}consumeDecimalUChar(e,t){let r=t;for(let t=0;t<3&&a(e[r]);t++,r++);if(r-t==0)throw new Error("Invalid decimal uchar.");const n=parseInt(e.slice(t,r));if(n>=0&&n<=255)return r;throw new Error("Invalid decimal uchar")}consumeIP6Address(e,t){let r=this.consumeHexpart(e,t);return":"===e[r]?(r+=1,r=this.consumeIP4Address(e,r),r):r}consumeHexpart(e,t){let r=t;if(":"===e[r]&&":"===e[r+1]){r+=2;try{r=this.consumeHexseq(e,r)}catch(e){}return r}if(r=this.consumeHexseq(e,r),":"===e[r]&&":"===e[r+1]){r+=2;try{r=this.consumeHexseq(e,r)}catch(e){}return r}return r}consumeHexseq(e,t){let r=t;for(;r=this.consumeHex4(e,r),":"===e[r]&&":"!==e[r+1];)r+=1;return r}consumeHex4(e,t){let r=0;for(;r<4;r++)if(!((n=e[t+r])>="0"&&n<="9"||n>="a"&&n<="f"||n>="A"&&n<="F")){if(0===r)throw new Error("Invalid hex 4");break}var n;return t+r}consumeFQDN(e,t){let r=t;for(;a(e[r])||h(e[r])||"-"===e[r]||"."===e[r];)r+=1;if(r-t<4)throw new Error("Invalid FQDN");return r}consumeExtnAddr(e,t){return this.consumeOneOrMore(e,t,u)}consumeMulticastAddress(e,t,r){switch(r){case"IP4":case"ip4":return this.consumeIP4MulticastAddress(e,t);case"IP6":case"ip6":return this.consumeIP6MulticastAddress(e,t);default:try{return this.consumeFQDN(e,t)}catch(r){return this.consumeExtnAddr(e,t)}}}consumeIP6MulticastAddress(e,t){const r=this.consumeHexpart(e,t);return"/"===e[r]?this.consumeInteger(e,r+1):r}consumeIP4MulticastAddress(e,t){let r=t+3;const n=e.slice(t,r),i=parseInt(n);if(i<224||i>239)throw new Error("Invalid IP4 multicast address, IPv4 multicast addresses may be in the range 224.0.0.0 to 239.255.255.255.");for(let t=0;t<3;t++){if("."!==e[r])throw new Error("Invalid IP4 multicast address.");r+=1,r=this.consumeDecimalUChar(e,r)}return"/"===e[r]&&(r+=1),r=this.consumeTTL(e,r),"/"===e[r]&&(r=this.consumeInteger(e,r)),r}consumeInteger(e,t){if(!l(e[t]))throw new Error("Invalid integer.");for(t+=1;a(e[t]);)t+=1;return t}consumeTTL(e,t){if("0"===e[t])return t+1;if(!l(e[t]))throw new Error("Invalid TTL.");t+=1;for(let r=0;r<2&&a(e[t]);r++)t+=1;return t}consumeToken(e,t){return this.consumeOneOrMore(e,t,d)}consumeTime(e,t){let r=t;if("0"===e[r])return r+1;for(l(e[r])&&(r+=1);a(e[r]);)r++;if(r-t<10)throw new Error("Invalid time");return r}consumeAddress(e,t){return this.consumeTill(e,t,o)}consumeTypedTime(e,t){let r=t;return r=this.consumeOneOrMore(e,r,a),p(e[r])?r+1:r}consumeRepeatInterval(e,t){if(!l(e[t]))throw new Error("Invalid repeat interval");for(t+=1;a(e[t]);)t+=1;return p(e[t])&&(t+=1),t}consumePort(e,t){return this.consumeOneOrMore(e,t,a)}consume(e,t,r){for(let n=0;n<r.length;n++){if(t+n>=e.length)throw new Error("consume exceeding value length");if(e[t+n]!==r[n])throw new Error("consume ".concat(r," failed at ").concat(n))}return t+r.length}consumeTill(e,t,r){let n=t;for(;n<e.length&&("string"!=typeof r||e[n]!==r)&&("function"!=typeof r||!r(e[n]));)n++;return n}}class v extends R{constructor(){super(),S(this,"records",[]),S(this,"currentLine",0)}parse(e){const t=this.probeEOL(e);this.records=e.split(t).filter((e=>!!e.trim())).map(this.parseLine),this.currentLine=0;const r=this.parseVersion(),n=this.parseOrigin(),i=this.parseSessionName(),o=this.parseInformation(),s=this.parseUri(),a=this.parseEmail(),c=this.parsePhone(),u=this.parseConnection(),d=this.parseBandWidth(),l=this.parseTimeFields(),h=this.parseKey(),p=this.parseSessionAttribute(),f=this.parseMediaDescription();if(this.currentLine!==this.records.length)throw new Error("parsing failed, non exhaustive sdp lines.");return{version:r,origin:n,sessionName:i,information:o,uri:s,emails:a,phones:c,connection:u,bandwidths:d,timeFields:l,key:h,attributes:p,mediaDescriptions:f}}getCurrentRecord(){const e=this.records[this.currentLine];if(!e)throw new Error("Record doesn't exit.");return e}probeEOL(e){for(let t=0;t<e.length;t++)if(e[t]===n)return"\r"===e[t-1]?i:n;throw new Error("Invalid newline character.")}parseLine(e,t){if(e.length<2)throw new Error("Invalid sdp line, sdp line should be of form <type>=<value>.");const r=e[0];if("="!==e[1])throw new Error('Invalid sdp line, <type> should be a single character followed by an "=" sign.');return{type:r,value:e.slice(2),line:t,cur:0}}parseSessionAttribute(){const e=new A;for(;this.currentLine<this.records.length;){const t=this.getCurrentRecord();if(t.type!==s.ATTRIBUTE)break;const r={attField:this.extractOneOrMore(t,(e=>d(e)&&":"!==e)),_cur:0};":"===t.value[t.cur]&&(t.cur+=1,r.attValue=this.extractOneOrMore(t,f)),e.parse(r),this.currentLine++}return e.digest()}parseMediaAttributes(e){const t=new b(e);for(;this.currentLine<this.records.length;){const e=this.getCurrentRecord();if(e.type!==s.ATTRIBUTE)break;const r={attField:this.extractOneOrMore(e,(e=>d(e)&&":"!==e)),_cur:0};":"===e.value[e.cur]&&(e.cur+=1,r.attValue=this.extractOneOrMore(e,f)),t.parse(r),this.currentLine++}return t.digest()}parseKey(){const e=this.getCurrentRecord();if(e.type===s.KEY){if("prompt"===e.value||"clear:"===e.value||"base64:"===e.value||"uri:"===e.value)return e.value;throw this.currentLine++,new Error("Invalid key.")}}parseZone(){const e=this.getCurrentRecord();if(e.type===s.ZONE_ADJUSTMENTS){const t=[];for(;;)try{const r=this.extract(e,this.consumeTime);this.consumeSpaceForRecord(e);let n=!1;"-"===e.value[e.cur]&&(n=!0,e.cur+=1);const i=this.extract(e,this.consumeTypedTime);t.push({time:r,typedTime:i,back:n})}catch(e){break}if(0===t.length)throw new Error("Invalid zone adjustments");return this.currentLine++,t}return[]}parseRepeat(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.REPEAT)break;{const r=this.extract(t,this.consumeRepeatInterval),n=this.parseTypedTime(t);e.push({repeatInterval:r,typedTimes:n}),this.currentLine++}}return e}parseTypedTime(e){const t=[];for(;;)try{this.consumeSpaceForRecord(e),t.push(this.extract(e,this.consumeTypedTime))}catch(e){break}if(0===t.length)throw new Error("Invalid typed time.");return t}parseTime(){const e=this.getCurrentRecord(),t=this.extract(e,this.consumeTime);this.consumeSpaceForRecord(e);const r=this.extract(e,this.consumeTime);return this.currentLine++,{startTime:t,stopTime:r}}parseBandWidth(){const e=[];for(;this.currentLine<this.records.length;){const t=this.getCurrentRecord();if(t.type!==s.BANDWIDTH)break;{const r=this.extractOneOrMore(t,d);if(":"!==t.value[t.cur])throw new Error("Invalid bandwidth field.");t.cur++;const n=this.extractOneOrMore(t,a);e.push({bwtype:r,bandwidth:n}),this.currentLine++}}return e}parseVersion(){const e=this.getCurrentRecord();if(e.type!==s.VERSION)throw new Error("first sdp record must be version");const t=e.value.slice(0,this.consumeOneOrMore(e.value,0,a));if(t.length!==e.value.length)throw new Error('invalid proto version, "v='.concat(e.value,'"'));return this.currentLine++,t}parseOrigin(){const e=this.getCurrentRecord();if(e.type!==s.ORIGIN)throw new Error("second line of sdp must be origin");const t=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,a);this.consumeSpaceForRecord(e);const n=this.extractOneOrMore(e,a);this.consumeSpaceForRecord(e);const i=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const o=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const c=this.extract(e,this.consumeUnicastAddress);return this.currentLine++,{username:t,sessId:r,sessVersion:n,nettype:i,addrtype:o,unicastAddress:c}}parseSessionName(){const e=this.getCurrentRecord();if(e.type===s.SESSION_NAME){const t=this.extract(e,this.consumeText);return this.currentLine++,t}}parseInformation(){const e=this.getCurrentRecord();if(e.type!==s.INFORMATION)return;const t=this.extract(e,this.consumeText);return this.currentLine++,t}parseUri(){const e=this.getCurrentRecord();if(e.type===s.URI)return this.currentLine++,e.value}parseEmail(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.EMAIL)break;e.push(t.value),this.currentLine++}return e}parsePhone(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.PHONE)break;e.push(t.value),this.currentLine++}return e}parseConnection(){const e=this.getCurrentRecord();if(e.type===s.CONNECTION){const t=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const n=this.extract(e,this.consumeAddress);return this.currentLine++,{nettype:t,addrtype:r,address:n}}}parseMedia(){const e=this.getCurrentRecord(),t=this.extract(e,this.consumeToken);this.consumeSpaceForRecord(e);let r=this.extract(e,this.consumePort);"/"===e.value[e.cur]&&(e.cur+=1,r+=this.extract(e,this.consumeInteger)),this.consumeSpaceForRecord(e);const n=[];for(n.push(this.extract(e,this.consumeToken));"/"===e.value[e.cur];)e.cur+=1,n.push(this.extract(e,this.consumeToken));if(0===n.length)throw new Error("Invalid proto");const i=this.parseFmt(e);return this.currentLine++,{mediaType:t,port:r,protos:n,fmts:i}}parseTimeFields(){const e=[];for(;this.getCurrentRecord().type===s.TIME;){const t=this.parseTime(),r=this.parseRepeat(),n=this.parseZone();e.push({time:t,repeats:r,zones:n})}return e}parseMediaDescription(){const e=[];for(;this.currentLine<this.records.length&&this.getCurrentRecord().type===s.MEDIA;){const t=this.parseMedia(),r=this.parseInformation(),n=this.parseConnections(),i=this.parseBandWidth(),o=this.parseKey(),s=this.parseMediaAttributes(t);e.push({media:t,information:r,connections:n,bandwidths:i,key:o,attributes:s})}return e}parseConnections(){const e=[];for(;this.currentLine<this.records.length&&this.getCurrentRecord().type===s.CONNECTION;)e.push(this.parseConnection());return e}parseFmt(e){const t=[];for(;;)try{this.consumeSpaceForRecord(e),t.push(this.extract(e,this.consumeToken))}catch(e){break}if(0===t.length)throw new Error("Invalid fmts");return t}extract(e,t,...r){const n=t.call(this,e.value,e.cur,...r),i=e.value.slice(e.cur,n);return e.cur=n,i}extractOneOrMore(e,t){const r=this.consumeOneOrMore(e.value,e.cur,t),n=e.value.slice(e.cur,r);return e.cur=r,n}consumeSpaceForRecord(e){if(e.value[e.cur]!==o)throw new Error("Invalid space at ".concat(e.cur,"."));e.cur+=1}}class y extends R{constructor(...e){super(...e),S(this,"attributes",void 0),S(this,"digested",!1)}extractOneOrMore(e,t,r){const n=this.consumeOneOrMore(e.attValue,e._cur,t),i=e.attValue.slice(e._cur,n),[o,s]=r||[];if("number"==typeof o&&i.length<o)throw new Error("error in length, should be more or equal than ".concat(o," characters."));if("number"==typeof s&&i.length>s)throw new Error("error in length, should be less or equal than ".concat(s," characters."));return e._cur=n,i}consumeAttributeSpace(e){if(e.attValue[e._cur]!==o)throw new Error("Invalid space at ".concat(e._cur,"."));e._cur+=1}extract(e,t,...r){if(!e.attValue)throw new Error("Nothing to extract from attValue.");const n=t.call(this,e.attValue,e._cur,...r),i=e.attValue.slice(e._cur,n);return e._cur=n,i}atEnd(e){if(!e.attValue)throw new Error;return e._cur>=e.attValue.length}peekChar(e){if(!e.attValue)throw new Error;return e.attValue[e._cur]}peek(e,t){if(!e.attValue)throw new Error;for(let r=0;r<t.length;r++)if(t[r]!==e.attValue[e._cur+r])return!1;return!0}parseIceUfrag(e){if(this.attributes.iceUfrag)throw new Error("Invalid ice-ufrag, should be only a single line if 'a=ice-ufrag'");this.attributes.iceUfrag=this.extractOneOrMore(e,E,[4,256])}parseIcePwd(e){if(this.attributes.icePwd)throw new Error("Invalid ice-pwd, should be only a single line if 'a=ice-pwd'");this.attributes.icePwd=this.extractOneOrMore(e,E,[22,256])}parseIceOptions(e){if(this.attributes.iceOptions)throw new Error("Invalid ice-options, should be only one 'ice-options' line");const t=[];for(;!this.atEnd(e);){t.push(this.extractOneOrMore(e,E));try{this.consumeAttributeSpace(e)}catch(t){if(this.atEnd(e))break;throw t}}this.attributes.iceOptions=t}parseFingerprint(e){const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill);this.attributes.fingerprints.push({hashFunction:t,fingerprint:r})}parseExtmap(e){const t=this.extractOneOrMore(e,a);let r;"/"===this.peekChar(e)&&(this.extract(e,this.consume,"/"),r=this.extract(e,this.consumeToken)),this.consumeAttributeSpace(e);const n=this.extract(e,this.consumeTill,o),i=g(g({entry:parseInt(t,10)},r&&{direction:r}),{},{extensionName:n});this.peekChar(e)===o&&(this.consumeAttributeSpace(e),i.extensionAttributes=this.extract(e,this.consumeTill)),this.attributes.extmaps.push(i)}parseSetup(e){if(this.attributes.setup)throw new Error("must only be one single 'a=setup' line.");const t=this.extract(e,this.consumeTill);if("active"!==t&&"passive"!==t&&"actpass"!==t&&"holdconn"!==t)throw new Error("role must be one of 'active', 'passive', 'actpass', 'holdconn'.");this.attributes.setup=t}}class A extends y{constructor(...e){super(...e),S(this,"attributes",{unrecognized:[],groups:[],extmaps:[],fingerprints:[],identities:[]})}parse(e){if(this.digested)throw new Error("already digested");try{switch(e.attField){case"group":this.parseGroup(e);break;case"ice-lite":this.parseIceLite();break;case"ice-ufrag":this.parseIceUfrag(e);break;case"ice-pwd":this.parseIcePwd(e);break;case"ice-options":this.parseIceOptions(e);break;case"fingerprint":this.parseFingerprint(e);break;case"setup":this.parseSetup(e);break;case"tls-id":this.parseTlsId(e);break;case"identity":this.parseIdentity(e);break;case"extmap":this.parseExtmap(e);break;case"msid-semantic":this.parseMsidSemantic(e);break;default:e.ignored=!0,this.attributes.unrecognized.push(e)}}catch(t){throw console.error("parsing session attribute ".concat(e.attField,' error, "a=').concat(e.attField,":").concat(e.attValue,'"')),t}if(!e.ignored&&e.attValue&&!this.atEnd(e))throw new Error("attribute parsing error")}digest(){return this.digested=!0,this.attributes}parseGroup(e){const t=this.extract(e,this.consumeToken),r=[];for(;!this.atEnd(e)&&this.peekChar(e)===o;)this.consumeAttributeSpace(e),r.push(this.extract(e,this.consumeToken));this.attributes.groups.push({semantic:t,identificationTag:r})}parseIceLite(){if(this.attributes.iceLite)throw new Error("Invalid ice-lite, should be only a single line of 'a=ice-lite'");this.attributes.iceLite=!0}parseTlsId(e){if(this.attributes.tlsId)throw new Error("must be only one tld-id line");this.attributes.tlsId=this.extractOneOrMore(e,m)}parseIdentity(e){const t=this.extractOneOrMore(e,_),r=[];for(;!this.atEnd(e)&&this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.extract(e,this.consume,"=");const n=this.extractOneOrMore(e,(e=>e!==o&&f(e)));r.push({name:t,value:n})}this.attributes.identities.push({assertionValue:t,extensions:r})}parseMsidSemantic(e){this.peekChar(e)===o&&this.consumeAttributeSpace(e);const t={semantic:this.extract(e,this.consumeToken),identifierList:[]};for(;;){try{this.consumeAttributeSpace(e)}catch(e){break}if("*"===this.peekChar(e)){this.extract(e,this.consume,"*"),t.applyForAll=!0;break}{const r=this.extract(e,this.consumeTill,o);t.identifierList.push(r)}}this.attributes.msidSemantic=t}}class b extends y{constructor(e){super(),S(this,"attributes",void 0),-1!==e.protos.indexOf("RTP")||e.protos.indexOf("rtp"),this.attributes={unrecognized:[],candidates:[],extmaps:[],fingerprints:[],imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:[],ssrcGroups:[],rtcpFeedbackWildcards:[],payloads:[]}}parse(e){if(this.digested)throw new Error("already digested");try{switch(e.attField){case"extmap":this.parseExtmap(e);break;case"setup":this.parseSetup(e);break;case"ice-ufrag":this.parseIceUfrag(e);break;case"ice-pwd":this.parseIcePwd(e);break;case"ice-options":this.parseIceOptions(e);break;case"candidate":this.parseCandidate(e);break;case"remote-candidate":this.parseRemoteCandidate(e);break;case"end-of-candidates":this.parseEndOfCandidates();break;case"fingerprint":this.parseFingerprint(e);break;case"rtpmap":this.parseRtpmap(e);break;case"ptime":this.parsePtime(e);break;case"maxptime":this.parseMaxPtime(e);break;case"sendrecv":case"recvonly":case"sendonly":case"inactive":this.parseDirection(e);break;case"ssrc":this.parseSSRC(e);break;case"fmtp":this.parseFmtp(e);break;case"rtcp-fb":this.parseRtcpFb(e);break;case"rtcp-mux":this.parseRTCPMux();break;case"rtcp-mux-only":this.parseRTCPMuxOnly();break;case"rtcp-rsize":this.parseRTCPRsize();break;case"rtcp":this.parseRTCP(e);break;case"mid":this.parseMid(e);break;case"msid":this.parseMsid(e);break;case"imageattr":this.parseImageAttr(e);break;case"rid":this.parseRid(e);break;case"simulcast":this.parseSimulcast(e);break;case"sctp-port":this.parseSctpPort(e);break;case"max-message-size":this.parseMaxMessageSize(e);break;case"ssrc-group":this.parseSSRCGroup(e);break;default:e.ignored=!0,this.attributes.unrecognized.push(e)}}catch(t){throw console.error("parsing media attribute ".concat(e.attField,' error, "a=').concat(e.attField,":").concat(e.attValue,'"')),t}if(!e.ignored&&e.attValue&&!this.atEnd(e))throw new Error("attribute parsing error")}parseCandidate(e){const t=this.extractOneOrMore(e,E,[1,32]);this.consumeAttributeSpace(e);const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const n=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const i=this.extractOneOrMore(e,a,[1,10]);this.consumeAttributeSpace(e);const s=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const u=this.extract(e,this.consumePort);this.consumeAttributeSpace(e),this.extract(e,this.consume,"typ"),this.consumeAttributeSpace(e);const d={foundation:t,componentId:r,transport:n,priority:i,connectionAddress:s,port:u,type:this.extract(e,this.consumeToken),extension:{}};for(this.peek(e," raddr")&&(this.extract(e,this.consume," raddr"),this.consumeAttributeSpace(e),d.relAddr=this.extract(e,this.consumeAddress)),this.peek(e," rport")&&(this.extract(e,this.consume," rport"),this.consumeAttributeSpace(e),d.relPort=this.extract(e,this.consumePort));this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e),d.extension[t]=this.extractOneOrMore(e,c)}this.attributes.candidates.push(d)}parseRemoteCandidate(e){const t=[];for(;;){const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const n=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const i=this.extract(e,this.consumePort);t.push({componentId:r,connectionAddress:n,port:i});try{this.consumeAttributeSpace(e)}catch(e){break}}this.attributes.remoteCandidatesList.push(t)}parseEndOfCandidates(){if(this.attributes.endOfCandidates)throw new Error("must be only one line of end-of-candidates");this.attributes.endOfCandidates=!0}parseRtpmap(e){const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,"/");this.extract(e,this.consume,"/");const n={encodingName:r,clockRate:this.extractOneOrMore(e,a)};this.atEnd(e)||"/"!==this.peekChar(e)||(this.extract(e,this.consume,"/"),n.encodingParameters=parseInt(this.extract(e,this.consumeTill),10));const i=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));i?i.rtpMap=n:this.attributes.payloads.push({payloadType:parseInt(t,10),rtpMap:n,rtcpFeedbacks:[]})}parsePtime(e){if(this.attributes.ptime)throw new Error("must be only one line of ptime");this.attributes.ptime=this.extract(e,this.consumeTill)}parseMaxPtime(e){if(this.attributes.maxPtime)throw new Error("must be only one line of ptime");this.attributes.maxPtime=this.extract(e,this.consumeTill)}parseDirection(e){if(this.attributes.direction)throw new Error("must be only one line of direction info");this.attributes.direction=e.attField}parseSSRC(e){const t=this.extractOneOrMore(e,a);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,":");let n;":"===this.peekChar(e)&&(this.extract(e,this.consume,":"),n=this.extract(e,this.consumeTill));const i=this.attributes.ssrcs.find((e=>e.ssrcId===parseInt(t,10)));i?i.attributes[r]=n:this.attributes.ssrcs.push({ssrcId:parseInt(t,10),attributes:{[r]:n}})}parseFmtp(e){const t=this.extract(e,this.consumeTill,o);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill),n={};r.split(";").forEach((e=>{let[t,r]=e.split("=");t=t.trim();const i="string"==typeof r?r.trim():null;"string"==typeof t&&t.length>0&&(n[t]=i)}));const i=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));i?i.fmtp={parameters:n}:this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[],fmtp:{parameters:n}})}parseFmtParameters(e){const t={},r=this.extract(e,this.consumeTill,"=");e._cur++;const n=this.extract(e,this.consumeTill,";");for(t[r]=n;";"===e.attValue[e._cur];){const r=this.extract(e,this.consumeTill,"=");e._cur++;const n=this.extract(e,this.consumeTill,";");t[r]=n}return t}parseRtcpFb(e){let t="";t="*"===this.peekChar(e)?this.extract(e,this.consume,"*"):this.extract(e,this.consumeTill,o),this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,o);let n;if("trr-int"===r)n={type:r,interval:this.extract(e,this.consumeTill)};else{const t={type:r};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.parameter=this.extract(e,this.consumeToken),this.peekChar(e)===o&&(t.additional=this.extract(e,this.consumeTill))),n=t}if("*"===t)this.attributes.rtcpFeedbackWildcards.push(n);else{const e=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));e?e.rtcpFeedbacks.push(n):this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[n]})}}parseRTCPMux(){if(this.attributes.rtcpMux)throw new Error("must be single line of rtcp-mux");this.attributes.rtcpMux=!0}parseRTCPMuxOnly(){if(this.attributes.rtcpMuxOnly)throw new Error("must be single line of rtcp-only");this.attributes.rtcpMuxOnly=!0}parseRTCPRsize(){if(this.attributes.rtcpRsize)throw new Error("must be single line of rtcp-rsize");this.attributes.rtcpRsize=!0}parseRTCP(e){if(this.attributes.rtcp)throw new Error("must be single line of rtcp");const t={port:this.extract(e,this.consumePort)};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.netType=this.extractOneOrMore(e,d),this.consumeAttributeSpace(e),t.addressType=this.extractOneOrMore(e,d),this.consumeAttributeSpace(e),t.address=this.extract(e,this.consumeAddress)),this.attributes.rtcp=t}parseMsid(e){const t={id:this.extractOneOrMore(e,d,[1,64])};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.appdata=this.extractOneOrMore(e,d,[1,64])),this.attributes.msids.push(t)}parseImageAttr(e){this.attributes.imageattr.push(e.attValue)}parseRid(e){const t=this.extractOneOrMore(e,(e=>h(e)||a(e)||"_"===e||"-"===e));this.consumeAttributeSpace(e);const r={id:t,direction:this.extract(e,this.consumeToken),params:[]};if(this.peekChar(e)===o){if(this.consumeAttributeSpace(e),this.peek(e,"pt=")){this.extract(e,this.consume,"pt=");const t=[];for(;;){const r=this.extract(e,this.consumeToken);t.push(r);try{this.extract(e,this.consume,",")}catch(e){break}}r.payloads=t,this.peekChar(e)===o&&this.extract(e,this.consume,o)}for(;;){const t=this.extract(e,this.consumeToken);switch(t){case"depend":{const n={type:t,rids:this.extract(e,this.consume,"=").split(",")};r.params.push(n);break}default:{const n={type:t};"="===this.peekChar(e)&&(this.extract(e,this.consume,"="),n.val=this.extract(e,this.consumeTill,";")),r.params.push(n)}}try{this.extract(e,this.consume,";")}catch(e){break}}}this.attributes.rids.push(r)}parseSimulcast(e){if(this.attributes.simulcast)throw new Error("must be single line of simulcast");this.attributes.simulcast=e.attValue,this.extract(e,this.consumeTill)}parseSctpPort(e){this.attributes.sctpPort=this.extractOneOrMore(e,a,[1,5])}parseMaxMessageSize(e){this.attributes.maxMessageSize=this.extractOneOrMore(e,a,[1,void 0])}digest(){return this.digested=!0,this.attributes}parseMid(e){this.attributes.mid=this.extract(e,this.consumeToken)}parseSSRCGroup(e){const t=this.extract(e,this.consumeToken),r=[];for(;;)try{this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeInteger);r.push(parseInt(t,10))}catch(e){break}this.attributes.ssrcGroups.push({semantic:t,ssrcIds:r})}}function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class I{constructor(){O(this,"eol",i)}print(e,t){let r="";return t&&(this.eol=t),r+=this.printVersion(e.version),r+=this.printOrigin(e.origin),r+=this.printSessionName(e.sessionName),r+=this.printInformation(e.information),r+=this.printUri(e.uri),r+=this.printEmail(e.emails),r+=this.printPhone(e.phones),r+=this.printConnection(e.connection),r+=this.printBandwidth(e.bandwidths),r+=this.printTimeFields(e.timeFields),r+=this.printKey(e.key),r+=this.printSessionAttributes(e.attributes),r+=this.printMediaDescription(e.mediaDescriptions),r}printVersion(e){return"v=".concat(e).concat(this.eol)}printOrigin(e){return"o=".concat(e.username," ").concat(e.sessId," ").concat(e.sessVersion," ").concat(e.nettype," ").concat(e.addrtype," ").concat(e.unicastAddress).concat(this.eol)}printSessionName(e){return e?"s=".concat(e).concat(this.eol):""}printInformation(e){return e?"i=".concat(e).concat(this.eol):""}printUri(e){return e?"u=".concat(e).concat(this.eol):""}printEmail(e){let t="";for(const r of e)t+="e=".concat(r).concat(this.eol);return t}printPhone(e){let t="";for(const r of e)t+="e=".concat(r).concat(this.eol);return t}printConnection(e){return e?"c=".concat(e.nettype," ").concat(e.addrtype," ").concat(e.address).concat(this.eol):""}printBandwidth(e){let t="";for(const r of e)t+="b=".concat(r.bwtype,":").concat(r.bandwidth).concat(this.eol);return t}printTimeFields(e){let t="";for(const r of e){t+="t=".concat(r.time.startTime," ").concat(r.time.startTime).concat(this.eol);for(const e of r.repeats)t+="r=".concat(e.repeatInterval," ").concat(e.typedTimes.join(" ")).concat(this.eol);r.zoneAdjustments&&(t+="z=",t+="z=".concat(r.zoneAdjustments.map((e=>"".concat(e.time," ").concat(e.back?"-":""," ").concat(e.typedTime))).join(" ")).concat(this.eol),t+=this.eol)}return t}printKey(e){return e?"k=".concat(e).concat(this.eol):""}printAttributes(e){let t="";for(const r of e)t+="a=".concat(r.attField).concat(r.attValue?":".concat(r.attValue):"").concat(this.eol);return t}printMediaDescription(e){let t="";for(const r of e)t+=this.printMedia(r.media),t+=this.printInformation(r.information),t+=this.printConnections(r.connections),t+=this.printBandwidth(r.bandwidths),t+=this.printKey(r.key),t+=this.printMediaAttributes(r);return t}printConnections(e){let t="";for(const r of e)t+=this.printConnection(r);return t}printMedia(e){return"m=".concat(e.mediaType," ").concat(e.port," ").concat(e.protos.join("/")," ").concat(e.fmts.join(" ")).concat(this.eol)}printSessionAttributes(e){return new w(this.eol).print(e)}printMediaAttributes(e){return new N(this.eol).print(e)}}class C{constructor(e){O(this,"eol",void 0),this.eol=e}printIceUfrag(e){return void 0===e?"":"a=ice-ufrag:".concat(e).concat(this.eol)}printIcePwd(e){return void 0===e?"":"a=ice-pwd:".concat(e).concat(this.eol)}printIceOptions(e){return void 0===e?"":"a=ice-options:".concat(e.join(o)).concat(this.eol)}printFingerprints(e){return e.length>0?e.map((e=>"a=fingerprint:".concat(e.hashFunction).concat(o).concat(e.fingerprint))).join(this.eol)+this.eol:""}printExtmap(e){return e.map((e=>"a=extmap:".concat(e.entry).concat(e.direction?"/".concat(e.direction):"").concat(o).concat(e.extensionName).concat(e.extensionAttributes?"".concat(o).concat(e.extensionAttributes):"").concat(this.eol))).join("")}printSetup(e){return void 0===e?"":"a=setup:".concat(e).concat(this.eol)}printUnrecognized(e){return e.map((e=>"a=".concat(e.attField).concat(e.attValue?":".concat(e.attValue):"").concat(this.eol))).join("")}}class w extends C{print(e){let t="";return t+=this.printGroups(e.groups),t+=this.printMsidSemantic(e.msidSemantic),t+=this.printIceLite(e.iceLite),t+=this.printIceUfrag(e.iceUfrag),t+=this.printIcePwd(e.icePwd),t+=this.printIceOptions(e.iceOptions),t+=this.printFingerprints(e.fingerprints),t+=this.printSetup(e.setup),t+=this.printTlsId(e.tlsId),t+=this.printIdentity(e.identities),t+=this.printExtmap(e.extmaps),t+=this.printUnrecognized(e.unrecognized),t}printGroups(e){let t="";return e.length>0&&(t+=e.map((e=>"a=group:".concat(e.semantic).concat(e.identificationTag.map((e=>"".concat(o).concat(e))).join("")).concat(this.eol))).join("")),t}printIceLite(e){return void 0===e?"":"a=ice-lite"+this.eol}printTlsId(e){return e?"a=tls-id:".concat(e).concat(this.eol):""}printIdentity(e){return 0===e.length?"":e.map((e=>"a=identity:".concat(e.assertionValue).concat(e.extensions.map((e=>"".concat(o).concat(e.name).concat(e.value?"=".concat(e.value):"")))))).join(this.eol)+this.eol}printMsidSemantic(e){if(!e)return"";let t="a=msid-semantic:".concat(e.semantic);return e.applyForAll?t+="".concat(o,"*"):e.identifierList.length>0&&(t+=e.identifierList.map((e=>"".concat(o).concat(e)))),t+this.eol}}class N extends C{print(e){const t=e.attributes;let r="";return r+=this.printRTCP(t.rtcp),r+=this.printIceUfrag(t.iceUfrag),r+=this.printIcePwd(t.icePwd),r+=this.printIceOptions(t.iceOptions),r+=this.printCandidates(t.candidates),r+=this.printRemoteCandidatesList(t.remoteCandidatesList),r+=this.printEndOfCandidates(t.endOfCandidates),r+=this.printFingerprints(t.fingerprints),r+=this.printSetup(t.setup),r+=this.printMid(t.mid),r+=this.printExtmap(t.extmaps),r+=this.printRTPRelated(t),r+=this.printPtime(t.ptime),r+=this.printMaxPtime(t.maxPtime),r+=this.printDirection(t.direction),r+=this.printSSRCGroups(t.ssrcGroups),r+=this.printSSRC(t.ssrcs),r+=this.printRTCPMux(t.rtcpMux),r+=this.printRTCPMuxOnly(t.rtcpMuxOnly),r+=this.printRTCPRsize(t.rtcpRsize),r+=this.printMSId(t.msids),r+=this.printImageattr(t.imageattr),r+=this.printRid(t.rids),r+=this.printSimulcast(t.simulcast),r+=this.printSCTPPort(t.sctpPort),r+=this.printMaxMessageSize(t.maxMessageSize),r+=this.printUnrecognized(t.unrecognized),r}printCandidates(e){return e.map((e=>"a=candidate:".concat(e.foundation).concat(o).concat(e.componentId).concat(o).concat(e.transport).concat(o).concat(e.priority).concat(o).concat(e.connectionAddress).concat(o).concat(e.port).concat(o,"typ").concat(o).concat(e.type).concat(e.relAddr?"".concat(o,"raddr").concat(o).concat(e.relAddr):"").concat(e.relPort?"".concat(o,"rport").concat(o).concat(e.relPort):"").concat(Object.keys(e.extension).map((t=>"".concat(o).concat(t).concat(o).concat(e.extension[t]))).join("")).concat(this.eol))).join("")}printRemoteCandidatesList(e){return e.map((e=>"a=remote-candidates:".concat(e.join(o)).concat(this.eol))).join("")}printEndOfCandidates(e){return void 0===e?"":"a=end-of-candidates"+this.eol}printRTPRelated(e){if(!e.payloads)return"";const t=e.payloads;let r="";r+=e.rtcpFeedbackWildcards.map((e=>this.printRTCPFeedback("*",e))).join("");for(const e of t)r+=this.printRtpMap(e.payloadType,e.rtpMap),r+=this.printFmtp(e.payloadType,e.fmtp),r+=e.rtcpFeedbacks.map((t=>this.printRTCPFeedback(e.payloadType,t))).join("");return r}printFmtp(e,t){if(!t)return"";const r=Object.keys(t.parameters);return 1===r.length&&null===t.parameters[r[0]]?"a=fmtp:".concat(e).concat(o).concat(r[0]).concat(this.eol):"a=fmtp:".concat(e).concat(o).concat(Object.keys(t.parameters).map((e=>"".concat(e,"=").concat(t.parameters[e]))).join(";")).concat(this.eol)}printRtpMap(e,t){return t?"a=rtpmap:".concat(e).concat(o).concat(t.encodingName,"/").concat(t.clockRate).concat(t.encodingParameters?"/".concat(t.encodingParameters):"").concat(this.eol):""}printRTCPFeedback(e,t){let r="a=rtcp-fb:".concat(e).concat(o),n=t;return"trr-int"===n.type?r+="ttr-int".concat(o).concat(n.interval):(r+="".concat(n.type),n.parameter&&(r+="".concat(o).concat(n.parameter),n.additional&&(r+="".concat(o).concat(n.additional)))),r+this.eol}printPtime(e){return void 0===e?"":"a=ptime:".concat(e).concat(this.eol)}printMaxPtime(e){return void 0===e?"":"a=maxptime:".concat(e).concat(this.eol)}printDirection(e){return void 0===e?"":"a=".concat(e).concat(this.eol)}printSSRC(e){return e.map((e=>Object.keys(e.attributes).map((t=>"a=ssrc:".concat(e.ssrcId.toString(10)).concat(o).concat(t).concat(e.attributes[t]?":".concat(e.attributes[t]):"").concat(this.eol))).join(""))).join("")}printRTCPMux(e){return void 0===e?"":"a=rtcp-mux".concat(this.eol)}printRTCPMuxOnly(e){return void 0===e?"":"a=rtcp-mux-only".concat(this.eol)}printRTCPRsize(e){return void 0===e?"":"a=rtcp-rsize".concat(this.eol)}printRTCP(e){if(void 0===e)return"";let t="a=rtcp:".concat(e.port);return e.netType&&(t+="".concat(o).concat(e.netType)),e.addressType&&(t+="".concat(o).concat(e.addressType)),e.address&&(t+="".concat(o).concat(e.address)),t+this.eol}printMSId(e){return e.map((e=>"a=msid:".concat(e.id).concat(e.appdata?"".concat(o).concat(e.appdata):"").concat(this.eol))).join("")}printImageattr(e){return e.map((e=>"a=imageattr:".concat(e).concat(this.eol))).join("")}printRid(e){return e.map((e=>{let t="a=rid:".concat(e.id).concat(o).concat(e.direction);return e.payloads&&(t+="".concat(o,"pt=").concat(e.payloads.join(","))),e.params.length>0&&(t+="".concat(o).concat(e.params.map((e=>"depend"===e.type?"depend=".concat(e.rids.join(",")):"".concat(e.type,"=").concat(e.val))).join(";"))),t+this.eol})).join("")}printSimulcast(e){return void 0===e?"":"a=simulcast:".concat(e).concat(this.eol)}printSCTPPort(e){return void 0===e?"":"a=sctp-port:".concat(e).concat(this.eol)}printMaxMessageSize(e){return void 0===e?"":"a=max-message-size:".concat(e).concat(this.eol)}printMid(e){return void 0===e?"":"a=mid:".concat(e).concat(this.eol)}printSSRCGroups(e){return e.map((e=>"a=ssrc-group:".concat(e.semantic).concat(e.ssrcIds.map((e=>"".concat(o).concat(e.toString(10)))).join("")).concat(this.eol))).join("")}}function P(e){return(new v).parse(e)}function D(e,t){return(new I).print(e,t)}}},t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(8)})();const eo=new class extends Xn{constructor(){super(...arguments),Zi(this,"currentUploadLogID",0)}reportLogUploadError(e){const t=e.errorRange;t[t.length-1]&&t[t.length-1]>this.currentUploadLogID&&(this.currentUploadLogID=t[t.length-1],this.emit("REPORT_LOG_UPLOAD",e))}};class to{constructor(e){Zi(this,"logger",void 0),Zi(this,"prefixLists",[]),this.logger=e}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.debug(...this.prefixLists,...t)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.info(...this.prefixLists,...t)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.warning(...this.prefixLists,...t)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.error(...this.prefixLists,...t)}prefix(e){return this.prefixLists.push(e),this}popPrefix(){return this.prefixLists.pop(),this}}function ro(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}function no(){const e=new Date,t=/((\d+:){2}\d+)/.exec((new Date).toUTCString());return t?(null==t?void 0:t[0])+":"+e.getUTCMilliseconds():e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}const io={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},oo=Date.now(),so=e=>{for(const t in io)if(Object.prototype.hasOwnProperty.call(io,t)&&io[t]===e)return t;return"DEFAULT"};const ao=new class{constructor(){Zi(this,"proxyServerURL",void 0),Zi(this,"logLevel",io.DEBUG),Zi(this,"uploadState","collecting"),Zi(this,"uploadStartTimer",void 0),Zi(this,"uploadLogWaitingList",[]),Zi(this,"uploadLogUploadingList",[]),Zi(this,"uploadErrorCount",0),Zi(this,"currentLogID",0),Zi(this,"url",void 0),Zi(this,"extLog",((e,t)=>{this.appendLogToWaitingList(e,...t)}))}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[io.DEBUG].concat(t);this.log.apply(this,n)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[io.INFO].concat(t);this.log.apply(this,n)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[io.WARNING].concat(t);this.log.apply(this,n)}warn(){this.warning(...arguments)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[io.ERROR].concat(t);this.log.apply(this,n)}upload(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[io.DEBUG].concat(t);this.uploadLog.apply(this,n)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){Wi("UPLOAD_LOG",!0)}disableLogUpload(){Wi("UPLOAD_LOG",!1),this.uploadState="collecting",void 0!==this.uploadStartTimer&&(window.clearTimeout(this.uploadStartTimer),this.uploadStartTimer=void 0),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new to(this).prefix(e)}log(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Date.now()-oo<100)return void setTimeout((()=>{this.log(...t)}),Date.now()-oo);const n=Math.max(0,Math.min(4,t[0]));if(t[0]=ro()+" Agora-SDK [".concat(so(n),"]:"),this.appendLogToWaitingList(n,...t),n<this.logLevel)return;const i=ro()+" %cAgora-SDK [".concat(so(n),"]:");let o=[];if(!Hi("USE_NEW_LOG"))switch(n){case io.DEBUG:o=[i,"color: #64B5F6;"].concat(t.slice(1)),console.log.apply(console,o);break;case io.INFO:o=[i,"color: #1E88E5; font-weight: bold;"].concat(t.slice(1)),console.log.apply(console,o);break;case io.WARNING:o=[i,"color: #FB8C00; font-weight: bold;"].concat(t.slice(1)),console.warn.apply(console,o);break;case io.ERROR:o=[i,"color: #B00020; font-weight: bold;"].concat(t.slice(1)),console.error.apply(console,o)}}uploadLog(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Date.now()-oo<100)return void setTimeout((()=>{this.uploadLog(...t)}),Date.now()-oo);const n=Math.max(0,Math.min(4,t[0]));t[0]=ro()+" Agora-SDK [".concat(so(n),"]:"),this.appendLogToWaitingList(n,...t)}appendLogToWaitingList(e){if(!Hi("UPLOAD_LOG"))return;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];Array.isArray(r[0])?r[0][0]=no()+" Agora-SDK [".concat(so(e),"]:"):r[0]=no()+" Agora-SDK [".concat(so(e),"]:");let i="";r.forEach((e=>{"object"==typeof e&&(e=JSON.stringify(e)),i+="".concat(e," ")})),this.uploadLogWaitingList.push({payload_str:i,log_level:e,log_item_id:this.currentLogID++}),"uploading"===this.uploadState&&0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}startUpload(){this.uploadState="uploading",void 0!==this.uploadStartTimer&&(window.clearTimeout(this.uploadStartTimer),this.uploadStartTimer=void 0),0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}scheduleUploadStart(){"uploading"!==this.uploadState&&void 0===this.uploadStartTimer&&(this.uploadStartTimer=window.setTimeout((()=>{this.uploadStartTimer=void 0,Hi("UPLOAD_LOG")&&this.startUpload()}),5e3))}async uploadLogs(){const e=this.uploadLogUploadingList,t={sdk_version:Fi,process_id:Hi("PROCESS_ID"),payload:JSON.stringify(e)};return Pi((async()=>{const e=await en.post(this.url||(this.proxyServerURL?"https://".concat(this.proxyServerURL,"/ls/?h=").concat(Hi("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(Hi("LOG_UPLOAD_SERVER"),"/upload/v1")),t,{responseType:"text"});if("OK"!==e.data){const t=new Error("unexpected upload log response");throw t.response=e,t}}),(()=>(this.uploadLogUploadingList=[],!1)),(t=>{const r={status:-1,message:t.message,errorRange:e.map((e=>e.log_item_id))};return t.response?(r.status=t.response.status,r.data=t.response.data,r.headers=t.response.headers):t.request&&(r.status=t.request.status),eo.reportLogUploadError(r),!0}),{timeout:Hi("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:Hi("UPLOAD_LOG_REQUEST_MAX_RETRY_INTERVAL")})}uploadLogInterval(){0===this.uploadLogUploadingList.length&&0===this.uploadLogWaitingList.length||(0===this.uploadLogUploadingList.length&&(this.uploadLogUploadingList=this.uploadLogWaitingList.splice(0,Hi("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),Hi("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),Hi("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),Hi("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}};var co;(co={}).FREE="free",co.UPLOADING="uploading",function(e){e[e.MISC=0]="MISC",e[e.INTERNAL_EVENT=1]="INTERNAL_EVENT",e[e.PUBLIC_EVENT=2]="PUBLIC_EVENT",e[e.WEB_EVENT=3]="WEB_EVENT",e[e.INTERNAL_API=4]="INTERNAL_API",e[e.WEB_API=5]="WEB_API",e[e.PUBLIC_API=6]="PUBLIC_API"}({});let uo=function(e){return e[e.RECOVER=0]="RECOVER",e[e.WARNING=1]="WARNING",e[e.ERROR=2]="ERROR",e}({}),lo=function(e){return e.CONFIG_DISTRIBUTE="config-distribute-error",e}({});const ho={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};let po=function(e){return e.PUBLISH="publish",e.SUBSCRIBE="subscribe",e.WS_COMPRESSOR_INIT="ws_compressor_init",e.SESSION_INIT="session_init",e.JOIN_CHOOSE_SERVER="join_choose_server",e.RTE_DETAIL="rte_detail_stats",e.REQ_USER_ACCOUNT="req_user_account",e.JOIN_GATEWAY="join_gateway",e.REJOIN_GATEWAY="rejoin_gateway",e.STREAM_SWITCH="stream_switch",e.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",e.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",e.FIRST_VIDEO_RECEIVED="first_video_received",e.FIRST_AUDIO_RECEIVED="first_audio_received",e.FIRST_VIDEO_DECODE="first_video_decode",e.FIRST_AUDIO_DECODE="first_audio_decode",e.XLA_PEER_FIRST_VIDEO_FRAME="xla_peer_first_video_frame",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_UPDATE_STREAM="on_update_stream",e.ON_REMOVE_STREAM="on_remove_stream",e.USER_ANALYTICS="req_user_analytics",e.PC_STATS="pc_stats",e.UPDATE_REMOTE_RTPCAPABILITIES="update_remote_rtpCapabilities",e.AB_TEST="ab_test",e.ALARM_STATUS_NOTIFY="alarm_status_notify",e}({}),fo=function(e){return e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",e.RTE_DETAIL="io.agora.pb.Wrtc.RteDetailStats",e.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",e.JOIN_GATEWAY="io.agora.pb.Wrtc.JoinGateway",e.RE_JOIN_GATEWAY="io.agora.pb.Wrtc.ReJoinGateway",e.PUBLISH="io.agora.pb.Wrtc.Publish",e.SUBSCRIBE="io.agora.pb.Wrtc.Subscribe",e.WS_COMPRESSOR_INIT="io.agora.pb.Wrtc.WsCompressorInit",e.STREAM_SWITCH="io.agora.pb.Wrtc.StreamSwitch",e.AUDIO_SENDING_STOPPED="io.agora.pb.Wrtc.AudioSendingStopped",e.VIDEO_SENDING_STOPPED="io.agora.pb.Wrtc.VideoSendingStopped",e.REQUEST_PROXY_APPCENTER="io.agora.pb.Wrtc.RequestProxyAppCenter",e.REQUEST_PROXY_WORKER_MANAGER="io.agora.pb.Wrtc.RequestProxyWorkerManager",e.API_INVOKE="io.agora.pb.Wrtc.ApiInvoke",e.FIRST_VIDEO_RECEIVED="io.agora.pb.Wrtc.FirstVideoReceived",e.FIRST_AUDIO_RECEIVED="io.agora.pb.Wrtc.FirstAudioReceived",e.FIRST_VIDEO_DECODE="io.agora.pb.Wrtc.FirstVideoDecode",e.FIRST_AUDIO_DECODE="io.agora.pb.Wrtc.FirstAudioDecode",e.XLA_PEER_FIRST_VIDEO_FRAME="io.agora.pb.Wrtc.XLAPeerFirstVideoFrame",e.ON_ADD_AUDIO_STREAM="io.agora.pb.Wrtc.OnAddAudioStream",e.ON_ADD_VIDEO_STREAM="io.agora.pb.Wrtc.OnAddVideoStream",e.ON_UPDATE_STREAM="io.agora.pb.Wrtc.OnUpdateStream",e.ON_REMOVE_STREAM="io.agora.pb.Wrtc.OnRemoveStream",e.JOIN_CHANNEL_TIMEOUT="io.agora.pb.Wrtc.JoinChannelTimeout",e.PEER_PUBLISH_STATUS="io.agora.pb.Wrtc.PeerPublishStatus",e.WORKER_EVENT="io.agora.pb.Wrtc.WorkerEvent",e.AP_WORKER_EVENT="io.agora.pb.Wrtc.APWorkerEvent",e.JOIN_WEB_PROXY_AP="io.agora.pb.Wrtc.JoinWebProxyAP",e.WEBSOCKET_QUIT="io.agora.pb.Wrtc.WebSocketQuit",e.USER_ANALYTICS="io.agora.pb.Wrtc.UserAnalytics",e.AUTOPLAY_FAILED="io.agora.pb.Wrtc.AutoplayFailed",e.PC_STATS="io.agora.pb.Wrtc.PCStats",e.UPDATE_REMOTE_RTPCAPABILITIES="io.agora.pb.Wrtc.UpdateRemoteRTPCapabilities",e.AB_TEST="io.agora.pb.Wrtc.ABTest",e.ALARM_STATUS_NOTIFY="io.agora.pb.Wrtc.AlarmStatusNotify",e}({});!function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}({});let Eo=function(e){return e[e.SESSION=26]="SESSION",e[e.JOIN_CHOOSE_SERVER=27]="JOIN_CHOOSE_SERVER",e[e.REQ_USER_ACCOUNT=196]="REQ_USER_ACCOUNT",e[e.JOIN_GATEWAY=28]="JOIN_GATEWAY",e[e.PUBLISH=30]="PUBLISH",e[e.SUBSCRIBE=29]="SUBSCRIBE",e[e.WS_COMPRESSOR_INIT=9430]="WS_COMPRESSOR_INIT",e[e.STREAM_SWITCH=32]="STREAM_SWITCH",e[e.AUDIO_SENDING_STOPPED=33]="AUDIO_SENDING_STOPPED",e[e.VIDEO_SENDING_STOPPED=34]="VIDEO_SENDING_STOPPED",e[e.REQUEST_PROXY_APPCENTER=35]="REQUEST_PROXY_APPCENTER",e[e.REQUEST_PROXY_WORKER_MANAGER=36]="REQUEST_PROXY_WORKER_MANAGER",e[e.API_INVOKE=41]="API_INVOKE",e[e.FIRST_VIDEO_RECEIVED=348]="FIRST_VIDEO_RECEIVED",e[e.FIRST_AUDIO_RECEIVED=349]="FIRST_AUDIO_RECEIVED",e[e.FIRST_VIDEO_DECODE=350]="FIRST_VIDEO_DECODE",e[e.FIRST_AUDIO_DECODE=351]="FIRST_AUDIO_DECODE",e[e.ON_ADD_AUDIO_STREAM=352]="ON_ADD_AUDIO_STREAM",e[e.ON_ADD_VIDEO_STREAM=353]="ON_ADD_VIDEO_STREAM",e[e.ON_UPDATE_STREAM=356]="ON_UPDATE_STREAM",e[e.ON_REMOVE_STREAM=355]="ON_REMOVE_STREAM",e[e.JOIN_CHANNEL_TIMEOUT=407]="JOIN_CHANNEL_TIMEOUT",e[e.PEER_PUBLISH_STATUS=408]="PEER_PUBLISH_STATUS",e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT",e[e.JOIN_WEB_PROXY_AP=700]="JOIN_WEB_PROXY_AP",e[e.WEBSOCKET_QUIT=671]="WEBSOCKET_QUIT",e[e.USER_ANALYTICS=1e4]="USER_ANALYTICS",e[e.AUTOPLAY_FAILED=9178]="AUTOPLAY_FAILED",e}({});const mo="[config-restore]",_o="websdk_ng_",To=_o+"blocked_config_hashes",go=_o+"api_failure_records",So=_o+"global_parameter",Ro=_o+"config_restore_state";function vo(){try{const e=window.localStorage.getItem(Ro);if(e)return JSON.parse(e)}catch(e){}return{currentConfigHash:"",configVerified:!1}}function yo(){try{const e=window.localStorage.getItem(go);return e?JSON.parse(e):[]}catch(e){return ao.debug("[error] ".concat(mo," error getting API failure records:"),e),[]}}function Ao(){return yo().reduce(((e,t)=>e+t.count),0)}function bo(){try{const e=Ao(),t=Hi("MAX_CONFIG_RETRY");if(e<t)return;const r=vo().currentConfigHash;ao.debug("[warning] ".concat(mo," restoring config due to ").concat(e," API failures")),r&&function(e){try{const t=window.localStorage.getItem(To);let r=[];t&&(r=JSON.parse(t).configHashes);const n=[...new Set([...r,e])];window.localStorage.setItem(To,JSON.stringify({configHashes:n,timestamp:Date.now()})),ao.debug("[warning] ".concat(mo," blocked config hash: ").concat(e))}catch(e){ao.debug("[error] ".concat(mo," error blocking config hash:"),e)}}(r),window.localStorage.removeItem(So);const n=yo().slice(-5);(function(e,t){Co.reportAlarm(e,t)})(null,{status:uo.ERROR,type:lo.CONFIG_DISTRIBUTE,message:"Config cache cleared due to API failures",extend:{failureCount:e,maxRetry:t,blockedConfigHash:r,recentFailures:n.map((e=>({api:e.apiName,error:e.errorCode||e.errorMessage,count:e.count,lastTime:e.lastTimestamp})))}}),function(){try{window.localStorage.removeItem(go)}catch(e){ao.debug("[error] ".concat(mo," error clearing API failure records:"),e)}}()}catch(e){ao.debug("[error] ".concat(mo," error restoring config:"),e)}}function Oo(e,t){try{if(!Hi("ENABLE_CONFIG_RESTORE"))return;if(t&&"AgoraRTCException"===t.name){const e=Hi("CONFIG_ERROR_MONITOR");if(!Array.isArray(e)||!e.includes(t.code))return}const r=window.localStorage.getItem(So);if(!r||r.length<20)return;if(vo().configVerified)return;const n=Hi("CONFIG_RESTORE_ERROR_API");if(!Array.isArray(n)||!n.includes(e))return;let i,o;t&&(t.code&&(i=t.code),o=t.message?t.message:"string"==typeof t?t:t.toString()),function(e,t,r){try{const n=yo(),i="".concat(e,":").concat(t||""),o=n.find((e=>"".concat(e.apiName,":").concat(e.errorCode||"")===i)),s=vo().currentConfigHash;if(o)o.count++,o.lastTimestamp=Date.now(),r&&(o.errorMessage=r),s&&(o.configHash=s);else{const i=Date.now();n.push({apiName:e,errorCode:t,errorMessage:r,count:1,firstTimestamp:i,lastTimestamp:i,configHash:s||void 0})}const a=n.length>20?n.slice(-20):n;window.localStorage.setItem(go,JSON.stringify(a))}catch(e){ao.debug("[error] ".concat(mo," error saving API failure record:"),e)}}(e,i,o);const s=Ao(),a=Hi("MAX_CONFIG_RETRY");ao.debug("".concat(mo," API failure count: ").concat(s,"/").concat(a,", API: ").concat(e,", Error: ").concat(i||o)),s>=a&&bo()}catch(e){}}function Io(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,r,n){const i=n.value;if("function"==typeof i){const o=e.className||t.__className__||("AgoraRTCClient"===t.constructor.name?"Client":t.constructor.name);n.value=function(){for(var t,n,s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];let u=a;if(e.argsMap)try{u=e.argsMap(this,...a)}catch(e){ao.warning(e),u=[]}try{JSON.stringify(u)}catch(e){ao.warning("arguments for method ".concat(o,".").concat(String(r)," not serializable for apiInvoke.")),u=[]}const d=(e.report||Co).reportApiInvoke(this._sessionId||null,{id:this._clientId||(null===(t=this.store)||void 0===t?void 0:t.clientId)||this._ID,clientId:"Client"===o?this._clientId||(null===(n=this.store)||void 0===n?void 0:n.clientId):void 0,name:"".concat(o,".").concat(String(r)),options:u,tag:qn.TRACER,reportResult:e.reportResult},e.throttleTime);try{const t=i.apply(this,a);return t instanceof Promise?t.then((t=>(d.onSuccess(e.reportResult&&t),t))).catch((e=>{throw d.onError(e),e})):(d.onSuccess(e.reportResult&&t),t)}catch(e){throw d.onError(e),e}}}return n}}const Co=new class{constructor(){Zi(this,"baseInfoMap",new Map),Zi(this,"proxyServer",void 0),Zi(this,"eventUploadTimer",void 0),Zi(this,"setSessionIdTimer",void 0),Zi(this,"url",void 0),Zi(this,"sids",new Set),Zi(this,"backupUrl",void 0),Zi(this,"_appId",void 0),Zi(this,"_aid",0),Zi(this,"keyEventUploadPendingItems",[]),Zi(this,"normalEventUploadPendingItems",[]),Zi(this,"apiInvokeUploadPendingItems",[]),Zi(this,"apiInvokeCount",0),Zi(this,"apiInvokeLoggedCount",0),Zi(this,"ltsList",[]),Zi(this,"lastSendNormalEventTime",Date.now()),Zi(this,"customReportCounterTimer",void 0),Zi(this,"customReportCount",0),Zi(this,"extApiInvoke",(async e=>{for(const t of e){const e=Ji(Ji({},t),{},{sid:null,invokeId:++this.apiInvokeCount,processId:Hi("PROCESS_ID"),tag:qn.TRACER});this.sendApiInvoke(e)}})),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),Hi("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),Hi("EVENT_REPORT_SEND_INTERVAL"))}getBaseInfoBySessionId(e){return this.baseInfoMap.get(e)}setAppId(e){this._appId=e,this._aid=parseInt(e.replace(/[a-fA-F0-9]{8}/g,(e=>{let t=qi(e,2);return t[0]+t[1]})),16)||0}reportApiInvoke(e,t,r){t.timeout=t.timeout||6e4,t.reportResult=void 0===t.reportResult||t.reportResult;const n=Date.now();this.apiInvokeCount+=1;const i=this.apiInvokeCount,o=!!Hi("SHOW_REPORT_INVOKER_LOG"),s=!!Hi("SHOW_REPORT_USER_INVOKER_LOG"),a=o||s&&t.id;a&&(this.apiInvokeLoggedCount+=1);const c=this.apiInvokeLoggedCount;function u(e,r){if(a){let n="[apiInvoke-".concat(c,"]");if(t.id&&(n+="[".concat(t.id,"]")),t.name&&(n+="[".concat(t.name,"]"),t.name===Qn.JOIN))return ao.info("".concat(n," ").concat(e));ao.info("".concat(n," ").concat(e),"start"===e?t.options:r||"")}}const d=()=>({tag:t.tag,invokeId:i,sid:e,name:t.name,processId:Hi("PROCESS_ID"),clientId:t.clientId,apiInvokeTime:n,options:t.options,states:t.states||null});u("start");let l=!1;_i(t.timeout).then((()=>{l||(this.sendApiInvoke(Ji(Ji({},d()),{},{error:Un.API_INVOKE_TIMEOUT,success:!1})),u("timeout"),Oo(t.name,new xn(Un.API_INVOKE_TIMEOUT)))}));const h=new xn(Un.UNEXPECTED_ERROR,"".concat(t.name,": this api invoke is end"));return{onSuccess:e=>{const n=()=>{if(l)throw h;return l=!0,this.sendApiInvoke(Ji(Ji({},d()),{},{success:!0},t.reportResult&&{result:e})),u("onSuccess"),e};return r?Ri(n,t.name+"Success",r,(()=>l=!0)):n()},onError:e=>{const n=()=>{if(l)throw e;l=!0,this.sendApiInvoke(Ji(Ji({},d()),{},{success:!1,error:e})),Oo(t.name,e),u("onFailure",e.toString())};return r?Ri(n,t.name+"Error",r,(()=>l=!0)):n()}}}_send(e,t,r){this.send({type:e,data:t},r)}_sendApiInvoke(e){return this.sendApiInvoke(e)}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),n=this.createBaseInfo(e,r);n.cname=t.cname,n.rteUrl=t.rteUrl;const i=Object.assign({},{willUploadConsoleLog:Hi("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:Bi?"global":"oversea",areas:Hi("AREAS")&&Hi("AREAS").join(",")},t.extend),o=t.stringUid,s=t.channelProfile,a=t.channelMode,c=t.isABTestSuccess,u=t.lsid,d=t.clientRole,l=Date.now(),h=Ji(Ji({},n),{},{eventType:po.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,buildFormat:t.buildFormat,build:"v4.24.8-1-0-g7d24368d9(9/9/2026, 11:56:12 AM)",lts:l,elapse:l-r,extend:JSON.stringify(i),mode:t.mode,process:Hi("PROCESS_ID"),appType:Hi("APP_TYPE"),success:!0,version:Fi,stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:u,clientType:window.navigator.userAgent.includes("AgoraWebView")?42:20,clientRole:d,serviceId:Hi("PROCESS_ID"),extensionID:Hi("PLUGIN_INFO").join(",")||"",rteUrl:t.rteUrl,rteSid:t.rteSid,installId:Vi()});this.send({type:fo.SESSION,data:h},!0)}reportRteDetail(e){const t=this.baseInfoMap.get(e);if(!t)return;const r=t.info,n=Date.now(),i=Ji(Ji({},r),{},{eventType:po.RTE_DETAIL,lts:n,success:!0,elapse:n-t.startTime,vid:void 0===r.vid?0:Number(r.vid),ua:navigator.userAgent});this.send({type:fo.RTE_DETAIL,data:i},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info;t.vid&&(n.vid=t.vid);const i=Date.now(),o=Ji(Ji({},n),{},{role:t.role,eventType:po.JOIN_CHOOSE_SERVER,lts:i,eventElapse:t.elapse||i-t.lts,chooseServerAddr:t.csAddr,errorCode:t.ec,elapse:i-r.startTime,success:t.succ,chooseServerAddrList:JSON.stringify(t.serverList),uid:t.uid?parseInt(t.uid):null,cid:t.cid?parseInt(t.cid):null,chooseServerIp:t.csIp||"",opid:t.opid,unilbsServerIds:t.unilbsServerIds,extend:t.extend||void 0,isHttp3:t.isHttp3,corssRegionTagReq:t.corssRegionTagReq||void 0,corssRegionTagRes:t.corssRegionTagRes||void 0,ua:navigator.userAgent,resourceTimingInfo:t.resourceTimingInfo||void 0});this.send({type:fo.JOIN_CHOOSE_SERVER,data:o},!0)}reqUserAccount(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ji(Ji({},n),{},{eventType:po.REQ_USER_ACCOUNT,lts:i,success:t.success,serverAddress:t.serverAddr,stringUid:t.stringUid,uid:t.uid,errorCode:t.errorCode,elapse:t.elapse||i-r.startTime,eventElapse:i-t.lts,extend:JSON.stringify(t.extend)});this.send({type:fo.REQ_USER_ACCOUNT,data:o},!0)}joinGateway(e,t){var r;const n=this.baseInfoMap.get(e);if(!n)return;const i=n.info;t.vid&&(i.vid=t.vid),i.uid=t.uid,i.cid=t.cid;const o=Date.now(),s=null!==(r=t.reportAt)&&void 0!==r?r:o,a=t.firstSuccess,c=t.addr,u=t.isProxy,d=t.iceConnectedAt,l=t.joinResponseAt,h=!0===t.succ&&"2"===t.signalChannel&&void 0!==t.reportAt&&void 0!==t.winner&&void 0!==t.winnerAt&&void 0!==d&&void 0!==l,p=t.winnerAt,f=null!=p?p:o,E=Ji(Ji({},t.winner?{winner:t.winner}:{}),h?{iceConnectedElapse:Math.max(d-n.startTime,0),joinResponseElapse:Math.max(l-n.startTime,0)}:{}),m=void 0===p?o-n.startTime:Math.max(f-n.startTime,0),_=Ji(Ji({},i),{},{eventType:po.JOIN_GATEWAY,lts:o,gatewayAddr:t.addr,success:t.succ,errorCode:t.ec,errorMsg:t.errorMsg||"",elapse:m,eventElapse:o-t.lts,firstSuccess:a,signalChannel:t.signalChannel,preload:t.preload?1:0,installId:Vi(),isABTestSuccess:t.isABTestSuccess?1:0,gatewayIp:null,gatewayPort:null,isProxy:u?1:0},E),T=_.success?1:0;if(t.succ&&(n.lastJoinSuccessTime=s),c)if("1"===_.signalChannel){const e=$i(/(\d+\.\d+\.\d+\.\d+):(\d+)/,{ip:1,port:2}),t=c.match(e);_.gatewayIp=t&&t.groups?t.groups.ip:"",_.gatewayPort=t&&t.groups?t.groups.port:""}else if(u){const e=c.match(/h=(\d{1,3}-){3}\d{1,3}/g),t=c.match(/p=[0-9]{1,6}/g);_.gatewayIp=e&&e.length?e[0].split("=")[1].replace(/-/g,"."):"",_.gatewayPort=t&&t.length?t[0].split("=")[1]:""}else{const e=c.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),t=c.match(/(:|p=)[0-9]{1,6}/g);_.gatewayIp=e&&e.length?e[0].split("//")[1].replace(/-/g,"."):"",_.gatewayPort=t&&t.length?t[0].split(/:|p=/g)[1]:""}if(a||h)this.send({type:fo.JOIN_GATEWAY,data:_},!0);else{const e={isSuccess:T,port:_.gatewayPort};delete _.success,delete _.eventType,delete _.firstSuccess,delete _.gatewayPort,_.vid=Number(_.vid);const t=Object.assign({},_,e,{eventType:po.REJOIN_GATEWAY});this.send({type:fo.RE_JOIN_GATEWAY,data:t},!0)}}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=Date.now(),i=Ji(Ji({},r.info),{},{lts:n,timeout:t,elapse:n-r.startTime});this.send({type:fo.JOIN_CHANNEL_TIMEOUT,data:i},!0)}publish(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ji(Ji({},n),{},{eventType:po.PUBLISH,lts:i,eventElapse:t.eventElapse,elapse:i-r.startTime,success:t.succ,errorCode:t.ec,videoName:t.videoName,audioName:t.audioName,screenName:t.screenName,screenshare:t.screenshare,audio:t.audio,video:t.video,p2pid:t.p2pid,publishRequestid:t.publishRequestid});this.send({type:fo.PUBLISH,data:o},!0)}subscribe(e,t,r){const n=this.baseInfoMap.get(e);if(!n)return;const i=n.info,o=Date.now(),s=Ji(Ji({},i),{},{eventType:po.SUBSCRIBE,lts:o,eventElapse:t.eventElapse,elapse:o-n.startTime,success:t.succ,errorCode:t.ec,video:t.video,audio:t.audio,subscribeRequestid:t.subscribeRequestid,p2pid:t.p2pid,preSsrc:t.preSsrc?1:0},r&&{extend:JSON.stringify({isMassSubscribe:!0})});"string"==typeof t.peerid?s.peerSuid=t.peerid:s.peer=t.peerid,this.send({type:fo.SUBSCRIBE,data:s},!0)}wsCompressorInit(e){const t=[...this.baseInfoMap.keys()],r=t.length?t[0]:"UnableToGetSid",n=this.baseInfoMap.get(r);if(!n)return;const i=n.info,o=Date.now(),s=Ji(Ji({},i),{},{eventType:po.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-n.startTime,status:e.status?1:2});this.send({type:fo.WS_COMPRESSOR_INIT,data:s},!0)}firstXLAPeerFirstVideoFrame(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=t.peerPubStatusMs-(r.lastJoinSuccessTime||i),s=Ji(Ji({},n),{},{elapse:i-r.startTime,eventType:po.XLA_PEER_FIRST_VIDEO_FRAME,lts:i,peer:t.peer,width:t.width,height:t.height,ssrc:t.ssrc,p2pid:t.p2pid,peerPublishDuration:t.peerPublishDuration,joinChannelSuccessElapse:o,peerPubStatusMs:t.peerPubStatusMs-t.joinChannelStart,availablePublish:t.peerPublishDuration>o?1:0,preloadStart:Math.max(t.preloadStart-t.joinChannelStart,0),preloadEnd:Math.max(t.preloadEnd-t.joinChannelStart,0),encrypt:Math.max(t.apStart-t.joinChannelStart,0),ap:Math.max(t.apEnd-t.joinChannelStart,0),sua:Math.max(t.suaEnd-t.joinChannelStart,0),beforeConnect:Math.max(t.beforeConnect-t.joinChannelStart,0),peerRecevier:Math.max(t.peerReceiver-t.joinChannelStart,0),ice:Math.max(t.ice-t.joinChannelStart,0),pc:Math.max(t.pc-t.joinChannelStart,0),signalConnected:Math.max(t.signalConnected-t.joinChannelStart,0),joinReq:Math.max(t.joinReq-t.joinChannelStart,0),joinRes:Math.max(t.joinRes-t.joinChannelStart,0),userJoinNotify:Math.max(t.userJoinNotify-t.joinChannelStart,0),videoSsrcNotify:Math.max(t.videoAddNotify-t.joinChannelStart,0),subscribeDelayMs:Math.max(t.subscribeStart-t.videoAddNotify,0),subscribeStart:Math.max(t.subscribeStart-t.joinChannelStart,0),subscribeEnd:Math.max(t.subscribeEnd-t.joinChannelStart,0),firstReceived:Math.max(t.firstReceived-t.joinChannelStart,0),firstDecoded:Math.max(t.firstDecoded-t.joinChannelStart,0),firstPreRender:Math.max(t.firstPreRender-t.joinChannelStart,0),firstRender:Math.max(t.firstRender-t.joinChannelStart,0),playDelayMs:Math.max(t.playStart-t.subscribeEnd,0),playStart:Math.max(t.playStart-t.joinChannelStart,0),playEnd:Math.max(t.playEnd-t.joinChannelStart,0),isPreSub:t.isPreSub?1:0,isPrePc:t.isPrePc?1:0,isPreInstantVideo:t.isPreInstantVideo?1:0,firstReceivedEncodedFrame:t.firstReceivedEncodedFrame?Math.max(t.firstReceivedEncodedFrame-t.joinChannelStart,0):void 0,frameType:t.frameType||"",rtpTimestamp:t.rtpTimestamp||0,framePayloadType:t.framePayloadType||0,frameDataLength:t.frameDataLength||0,mimeType:t.mimeType||"",sdpEndPoint:t.sdpEndPoint?1:0});this.send({type:fo.XLA_PEER_FIRST_VIDEO_FRAME,data:s},!0)}firstRemoteVideoDecode(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,s=Date.now(),a=Ji(Ji(Ji({},o),n),{},{elapse:s-i.startTime,eventType:t,lts:s,firstDecodeFrame:Math.max((n.firstFrame||s)-i.startTime,0),apEnd:Math.max(n.apEnd-i.startTime,0),apStart:Math.max(n.apStart-i.startTime,0),joinGwEnd:Math.max(n.joinGwEnd-i.startTime,0),joinGwStart:Math.max(n.joinGwStart-i.startTime,0),pcEnd:Math.max(n.pcEnd-i.startTime,0),pcStart:Math.max(n.pcStart-i.startTime,0),subscriberEnd:Math.max(n.subscriberEnd-i.startTime,0),subscriberStart:Math.max(n.subscriberStart-i.startTime,0),videoAddNotify:Math.max(n.videoAddNotify-i.startTime,0)});this.send({type:r,data:a},!0)}firstRemoteFrame(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,s=Date.now(),a=Ji(Ji(Ji({},o),n),{},{elapse:s-i.startTime,eventType:t,lts:s});this.send({type:r,data:a},!0)}abTest(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ji(Ji(Ji({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),elapse:i-r.startTime,eventType:po.AB_TEST,lts:i});this.send({type:fo.AB_TEST,data:o},!0)}pcStats(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ji(Ji(Ji({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),elapse:i-r.startTime,eventType:po.PC_STATS,lts:i,preallocation:t.preallocation?1:0});this.send({type:fo.PC_STATS,data:o},!0)}updateRemoteRTPCapabilities(e,t){if(e){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ji(Ji(Ji({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),eventType:po.UPDATE_REMOTE_RTPCAPABILITIES,lts:i});this.send({type:fo.UPDATE_REMOTE_RTPCAPABILITIES,data:o},!0)}}onGatewayStream(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,s=Date.now(),a=Ji(Ji(Ji({},o),n),{},{eventType:t,lts:s});this.send({type:r,data:a},!0)}streamSwitch(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ji(Ji({},n),{},{eventType:po.STREAM_SWITCH,lts:i,isDual:t.isdual,elapse:i-r.startTime,success:t.succ});this.send({type:fo.STREAM_SWITCH,data:o},!0)}requestProxyAppCenter(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ji(Ji({},n),{},{eventType:po.REQUEST_PROXY_APPCENTER,lts:i,eventElapse:i-t.lts,elapse:i-r.startTime,APAddr:t.APAddr,workerManagerList:t.workerManagerList,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:fo.REQUEST_PROXY_APPCENTER,data:o},!0)}requestProxyWorkerManager(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ji(Ji({},n),{},{eventType:po.REQUEST_PROXY_WORKER_MANAGER,lts:i,eventElapse:i-t.lts,elapse:i-r.startTime,workerManagerAddr:t.workerManagerAddr,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:fo.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?ao.debug("reportProxyServerurl: ".concat(e)):ao.debug("disable reportProxyServerurl: ".concat(e))}peerPublishStatus(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ji(Ji({},n),{},{subscribeElapse:t.subscribeElapse,peer:t.peer,peerPublishDuration:Math.max(t.audioPublishDuration,t.videoPublishDuration),audiotag:t.audioPublishDuration>0?1:-1,videotag:t.videoPublishDuration>0?1:-1,lts:i,elapse:i-r.startTime,joinChannelSuccessElapse:i-(r.lastJoinSuccessTime||i),peerPublishDurationVideo:t.videoPublishDuration,peerPublishDurationAudio:t.audioPublishDuration});this.send({type:fo.PEER_PUBLISH_STATUS,data:o},!0)}workerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now();(function(e,t,r){const n=e[t];if(!n||"string"!=typeof n)return[e];e[t]="";const i=mi(JSON.stringify(e));let o=0;const s=[];let a=0;for(let c=0;c<n.length;c++)a+=n.charCodeAt(c)<=127?1:3,a<=r-i||(s[s.length]=kn(kn({},e),{},{[t]:n.substring(o,c)}),o=c,a=n.charCodeAt(c)<=127?1:3);return o!==n.length-1&&(s[s.length]=kn(kn({},e),{},{[t]:n.substring(o)})),s})(Ji(Ji(Ji({},n),t),{},{elapse:i-r.startTime,lts:i,productType:"WebRTC"}),"payload",1300).forEach((e=>this.send({type:fo.WORKER_EVENT,data:e},!0)))}apworkerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ji(Ji(Ji({},n),t),{},{elapse:i-r.startTime,lts:i});this.send({type:fo.AP_WORKER_EVENT,data:o},!0)}joinWebProxyAP(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ji(Ji(Ji({},n),t),{},{elapse:i-r.startTime,lts:i,extend:t.extend||void 0});this.send({type:fo.JOIN_WEB_PROXY_AP,data:o},!0)}WebSocketQuit(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=Ji(Ji(Ji({},n),t),{},{elapse:i-r.startTime,lts:i});this.send({type:fo.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>Hi("CUSTOM_REPORT_LIMIT"))throw new xn(Un.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval((()=>{this.customReportCount=0}),5e3));const r=Date.now(),n=t.map((t=>({type:fo.USER_ANALYTICS,data:Ji(Ji({sid:e},t),{},{lts:r})})));try{Hi("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(n):await this.postDataToStatsCollector(n)}catch(e){throw ao.error("send custom report message failed",e.toString()),new xn(Un.CUSTOM_REPORT_SEND_FAILED,e.message)}}reportAlarm(e,t){const r=e?this.baseInfoMap.get(e):void 0,n=null==r?void 0:r.info,i=Date.now(),o=Ji(Ji(Ji({},n),t),{},{vid:void 0===(null==n?void 0:n.vid)?0:Number(n.vid),elapse:r?i-r.startTime:0,eventType:po.ALARM_STATUS_NOTIFY,lts:i,installId:Vi(),processId:Hi("PROCESS_ID")});this.send({type:fo.ALARM_STATUS_NOTIFY,data:o},!0)}reportCreateClientPreconnect(e){const t=Date.now(),r=Hi("PROCESS_ID"),n={invokeId:++this.apiInvokeCount,process:r,sid:r.replace(/^process-/,"").replace(/-/g,""),cname:null,cid:null,uid:null,lts:t,success:!0,elapse:0,execElapse:0,apiName:Qn.CREATE_CLIENT_PRECONNECT,options:JSON.stringify({targets:e.targets,mode:e.mode,origin:e.origin})};this.send({type:fo.API_INVOKE,data:n},!0)}sendApiInvoke(e){const t=Hi("NOT_REPORT_EVENT");if(e.tag&&t.includes&&t.includes(e.tag))return!1;if(null===e.sid)return this.apiInvokeUploadPendingItems.push(e),!1;const r=this.baseInfoMap.get(e.sid);if(!r)return this.apiInvokeUploadPendingItems.push(e),!1;const n=r.info,i=n.cname,o=n.uid,s=n.cid;let a;if(e.lts=e.lts||Date.now(),e.error)if(e.error instanceof xn){const t=e.error,r=t.code,n=t.message;a=r||n||e.error.toString()}else a=e.error.toString();const c={invokeId:e.invokeId,process:e.processId||Hi("PROCESS_ID"),clientId:e.clientId,sid:e.sid,cname:i,cid:s,uid:o,lts:e.lts,success:e.success,elapse:e.lts-r.startTime,execElapse:e.lts-e.apiInvokeTime,apiName:e.name,options:e.options?JSON.stringify(e.options):void 0,execStates:e.states?JSON.stringify(e.states):void 0,execResult:e.result?JSON.stringify(e.result):void 0,errorCode:e.error?a:void 0,errorMsg:e.error?JSON.stringify(e.error):void 0};return this.send({type:fo.API_INVOKE,data:c},!1),!0}addSid(e){this.sids.add(e)}removeSid(e){this.sids.delete(e)}appendSessionId(){const e=this.apiInvokeUploadPendingItems;if(0===e.length)return;const t=Array.from(this.sids).find((e=>null!==e));t&&e.forEach((e=>{e&&(e.sid=t,this.sendApiInvoke(Object.assign({},e)))})),e.length=0}send(e,t){if(t)return this.keyEventUploadPendingItems.push(e),void this.sendItems(this.keyEventUploadPendingItems,!0);this.normalEventUploadPendingItems.push(e),this.normalEventUploadPendingItems.length>Hi("NORMAL_EVENT_QUEUE_CAPACITY")&&this.normalEventUploadPendingItems.splice(0,1),this.normalEventUploadPendingItems.length>=10&&this.sendItems(this.normalEventUploadPendingItems,!1)}doSend(){this.keyEventUploadPendingItems.length>0&&this.sendItems(this.keyEventUploadPendingItems,!0),this.normalEventUploadPendingItems.length>0&&Date.now()-this.lastSendNormalEventTime>=5e3&&this.sendItems(this.normalEventUploadPendingItems,!1)}sendItems(e,t){const r=[],n=[];for(;e.length;){const t=e.shift();r.length<20?r.push(t):n.push(t)}e.push(...n);for(const e of[...r])-1!==this.ltsList.indexOf(e.data.lts)?(e.data.lts=this.ltsList[this.ltsList.length-1]+1,this.ltsList.push(e.data.lts)):(this.ltsList.push(e.data.lts),this.ltsList.sort(((e,t)=>e-t)));return t||(this.lastSendNormalEventTime=Date.now()),Hi("ENABLE_EVENT_REPORT")?(r.length&&(Hi("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{Hi("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>Hi("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-Hi("NORMAL_EVENT_QUEUE_CAPACITY")),ao.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){ii.networkState===$n.OFFLINE&&await Promise.race([ii.onlineWaiter,_i(2*Ni.maxRetryTimeout)]);const t=e=>{let t=new Uint8Array;return e.forEach((e=>{const r=function(e){return(new TextEncoder).encode(e)}(JSON.stringify(e.data)),n=new ArrayBuffer(5),i=(e=>{let t=0;return Object.entries(fo).forEach((r=>{let n=qi(r,2),i=n[0];n[1]===e.type&&(t=Eo[i])})),t})(e),o=new DataView(n);o.setUint16(0,r.byteLength,!0),o.setUint8(2,255&i),o.setUint8(3,i>>>8&255),o.setUint8(4,i>>>16&255),t=Yn(t,new Uint8Array(n)),t=Yn(t,r)})),t},r="event";let n=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(Hi("NEW_REPORT_SERVER_DOMAINS")[0],"&p=443&d=").concat(r):"https://".concat(Hi("NEW_REPORT_SERVER_DOMAINS")[0],"/").concat(r);for(let i=0;i<2;i+=1){1===i&&(n=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(Hi("NEW_REPORT_SERVER_DOMAINS")[1],"&p=443&d=").concat(r):"https://".concat(Hi("NEW_REPORT_SERVER_DOMAINS")[1],"/").concat(r));try{await ki(n,{timeout:1e4,data:t(e),headers:Ji(Ji({biz:"webrtc",sendts:Math.round(Date.now()/1e3),debug:"false"},this._appId&&{appid:this._appId}),{},{"Content-Type":"application/octet-stream"})},!0)}catch(e){if(1===i)throw e;continue}return}}async postDataToStatsCollector(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=(e=>{const t=e&&e.data.sid&&this.baseInfoMap.get(e.data.sid);return t&&t.info.vid&&+t.info.vid||0})(e[0]),n=r?void 0:this._aid,i={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:e.map((e=>JSON.stringify(e))),vid:r,aid:n};ii.networkState===$n.OFFLINE&&await Promise.race([ii.onlineWaiter,_i(2*Ni.maxRetryTimeout)]);const o=t?"/events/proto-raws":"/events/messages";let s=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(Hi("EVENT_REPORT_DOMAIN"),"&p=").concat(Hi("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(Hi("EVENT_REPORT_DOMAIN"),":").concat(Hi("STATS_COLLECTOR_PORT")).concat(o));for(let e=0;e<2;e+=1){1===e&&(s=this.backupUrl||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(Hi("EVENT_REPORT_BACKUP_DOMAIN"),"&p=").concat(Hi("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(Hi("EVENT_REPORT_BACKUP_DOMAIN"),":").concat(Hi("STATS_COLLECTOR_PORT")).concat(o)));try{t?await Mi(s,{timeout:1e4,data:i}):await ki(s,{timeout:1e4,data:i})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},ho);return r.sid=e,this.baseInfoMap.set(e,{info:r,startTime:t}),r}reportResourceTiming(e,t,r){const n=performance.getEntriesByName(e),i=n[n.length-1];i&&this.reportApiInvoke(t,{clientId:r,name:"Client.resourceTiming",options:i,tag:qn.TRACER}).onSuccess()}};eo.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=ii.networkState,Co.reportApiInvoke(null,{name:"logUploadError",options:e,tag:qn.TRACER}).onSuccess("logUploadError")}));const wo={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1,supportDataChannel:!1,supportPCSetConfiguration:!1,supportWebRTCEncodedTransform:!1,supportWebRTCInsertableStream:!1,supportRequestVideoFrameCallback:!1,supportWebCrypto:!1,supportSuppressLocalAudioPlayback:!1,supportRestrictOwnAudio:!1};function No(){const e=an();wo.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),wo.getStreamFromExtension=e.name===rn.CHROME&&Number(e.version)>34,wo.supportUnifiedPlan=function(){if(!window.RTCRtpTransceiver)return!1;if(!("currentDirection"in RTCRtpTransceiver.prototype))return!1;const e=new RTCPeerConnection;let t=!1;try{e.addTransceiver("audio"),t=!0}catch(e){}return e.close(),t}(),wo.supportMinBitrate=e.name===rn.CHROME||e.name===rn.EDGE,wo.supportSetRtpSenderParameters=function(){const e=an();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!Cn()||(!(!pn()&&!ln())||e.name===rn.FIREFOX&&Number(e.version)>=64)}(),e.name===rn.SAFARI&&(Number(e.version)>=14?wo.supportDualStream=!0:wo.supportDualStream=!1),wo.webAudioMediaStreamDest=function(){const e=an();if(e.name===rn.SAFARI&&Number(e.version)<12)return!1;return!0}(),wo.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),wo.supportWebGL="undefined"!=typeof WebGLRenderingContext,wo.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,Cn()||(wo.webAudioWithAEC=!0),wo.supportShareAudio=function(){const e=an();if((e.os===tn.WIN_10||e.os===tn.WIN_81||e.os===tn.WIN_7||e.os===tn.LINUX||e.os===tn.MAC_OS||e.os===tn.CHROMIUM_OS)&&e.name===rn.CHROME&&Number(e.version)>=74)return!0;return!1}(),wo.supportDataChannel=function(){if(_n(76)||Sn(68)||function(e){const t=an();return!(t.name!==rn.SAFARI||!t.osVersion)&&Number(t.version)>=e}(14))return!0;return!1}(),wo.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!En()&&!!e&&e.prototype.setConfiguration instanceof Function}(),wo.supportWebRTCEncodedTransform=_n(87)||function(){const e=an();if(e.name!==rn.SAFARI||!e.browserVersion)return!1;const t=e.browserVersion.split(".");return Number(t[0])>15||15===Number(t[0])&&Number(t[1])>=4}()||Sn(117),wo.supportWebRTCInsertableStream=function(){const e=an();return(e.name===rn.CHROME||e.name===rn.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),wo.supportRequestVideoFrameCallback=function(){if("requestVideoFrameCallback"in HTMLVideoElement.prototype)return!0;return!1}(),wo.supportWebCrypto="undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.subtle,wo.supportSuppressLocalAudioPlayback=Mo(),wo.supportRestrictOwnAudio=Uo(),li((()=>{wo.supportDualStreamEncoding=function(){const e=an();if(Hi("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&Hi("CHROME_DUAL_STREAM_USE_ENCODING"))}(),ao.debug("browser ua: ",navigator.userAgent),ao.info("browser info: ",e),ao.info("browser compatibility: ",wo)}))}function Po(){return wo}function Do(){return"setSinkId"in HTMLAudioElement.prototype&&(!Hi("RESTRICTION_SET_PLAYBACK_DEVICE")||(hn()||fn())&&!In())}function Lo(){return!wo.supportUnifiedPlan||Hi("CHROME_FORCE_PLAN_B")&&Cn()}function ko(){return navigator.mediaDevices&&"getSupportedConstraints"in navigator.mediaDevices}function Mo(){if(ko()){const e=navigator.mediaDevices.getSupportedConstraints();return!(!("suppressLocalAudioPlayback"in e)||!e.suppressLocalAudioPlayback)}return _n(141)||gn(141)||Rn(141)}function Uo(){if(ko()){const e=navigator.mediaDevices.getSupportedConstraints();return!(!("restrictOwnAudio"in e)||!e.restrictOwnAudio)}return _n(141)||gn(141)||Rn(125)}let xo=function(e){return e.IOS_15_16_INTERRUPTION_START="ios15_16-interruption-start",e.IOS_15_16_INTERRUPTION_END="ios15_16-interruption-end",e.IOS_INTERRUPTION_START="ios-interruption-start",e.IOS_INTERRUPTION_END="ios-interruption-end",e.STATE_CHANGE="state-change",e}({});var Vo=function(e){try{return!!e()}catch(e){return!0}},Fo=!Vo((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Bo=Fo,jo=Function.prototype,Go=jo.call,Wo=Bo&&jo.bind.bind(Go,Go),Ho=Bo?Wo:function(e){return function(){return Go.apply(e,arguments)}},Ko=Ho({}.isPrototypeOf),Yo=function(e){return e&&e.Math===Math&&e},Xo=Yo("object"==typeof globalThis&&globalThis)||Yo("object"==typeof window&&window)||Yo("object"==typeof self&&self)||Yo("object"==typeof Z&&Z)||Yo("object"==typeof Z&&Z)||function(){return this}()||Function("return this")(),Zo=Fo,zo=Function.prototype,Jo=zo.apply,Qo=zo.call,qo="object"==typeof Reflect&&Reflect.apply||(Zo?Qo.bind(Jo):function(){return Qo.apply(Jo,arguments)}),$o=Ho,es=$o({}.toString),ts=$o("".slice),rs=function(e){return ts(es(e),8,-1)},ns=rs,is=Ho,os=function(e){if("Function"===ns(e))return is(e)},ss="object"==typeof document&&document.all,as=void 0===ss&&void 0!==ss?function(e){return"function"==typeof e||e===ss}:function(e){return"function"==typeof e},cs={},us=!Vo((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),ds=Fo,ls=Function.prototype.call,hs=ds?ls.bind(ls):function(){return ls.apply(ls,arguments)},ps={},fs={}.propertyIsEnumerable,Es=Object.getOwnPropertyDescriptor,ms=Es&&!fs.call({1:2},1);ps.f=ms?function(e){var t=Es(this,e);return!!t&&t.enumerable}:fs;var _s,Ts,gs=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Ss=Vo,Rs=rs,vs=Object,ys=Ho("".split),As=Ss((function(){return!vs("z").propertyIsEnumerable(0)}))?function(e){return"String"===Rs(e)?ys(e,""):vs(e)}:vs,bs=function(e){return null==e},Os=bs,Is=TypeError,Cs=function(e){if(Os(e))throw new Is("Can't call method on "+e);return e},ws=As,Ns=Cs,Ps=function(e){return ws(Ns(e))},Ds=as,Ls=function(e){return"object"==typeof e?null!==e:Ds(e)},ks={},Ms=ks,Us=Xo,xs=as,Vs=function(e){return xs(e)?e:void 0},Fs=function(e,t){return arguments.length<2?Vs(Ms[e])||Vs(Us[e]):Ms[e]&&Ms[e][t]||Us[e]&&Us[e][t]},Bs=Xo.navigator,js=Bs&&Bs.userAgent,Gs=js?String(js):"",Ws=Xo,Hs=Gs,Ks=Ws.process,Ys=Ws.Deno,Xs=Ks&&Ks.versions||Ys&&Ys.version,Zs=Xs&&Xs.v8;Zs&&(Ts=(_s=Zs.split("."))[0]>0&&_s[0]<4?1:+(_s[0]+_s[1])),!Ts&&Hs&&(!(_s=Hs.match(/Edge\/(\d+)/))||_s[1]>=74)&&(_s=Hs.match(/Chrome\/(\d+)/))&&(Ts=+_s[1]);var zs=Ts,Js=zs,Qs=Vo,qs=Xo.String,$s=!!Object.getOwnPropertySymbols&&!Qs((function(){var e=Symbol("symbol detection");return!qs(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Js&&Js<41})),ea=$s&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ta=Fs,ra=as,na=Ko,ia=Object,oa=ea?function(e){return"symbol"==typeof e}:function(e){var t=ta("Symbol");return ra(t)&&na(t.prototype,ia(e))},sa=String,aa=function(e){try{return sa(e)}catch(e){return"Object"}},ca=as,ua=aa,da=TypeError,la=function(e){if(ca(e))return e;throw new da(ua(e)+" is not a function")},ha=la,pa=bs,fa=function(e,t){var r=e[t];return pa(r)?void 0:ha(r)},Ea=hs,ma=as,_a=Ls,Ta=TypeError,ga={exports:{}},Sa=Xo,Ra=Object.defineProperty,va=Xo,ya=function(e,t){try{Ra(Sa,e,{value:t,configurable:!0,writable:!0})}catch(r){Sa[e]=t}return t},Aa="__core-js_shared__",ba=ga.exports=va[Aa]||ya(Aa,{});(ba.versions||(ba.versions=[])).push({version:"3.49.0",mode:"pure",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Oa=ga.exports,Ia=Oa,Ca=function(e,t){return Ia[e]||(Ia[e]=t||{})},wa=Cs,Na=Object,Pa=function(e){return Na(wa(e))},Da=Pa,La=Ho({}.hasOwnProperty),ka=Object.hasOwn||function(e,t){return La(Da(e),t)},Ma=Ho,Ua=0,xa=Math.random(),Va=Ma(1.1.toString),Fa=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Va(++Ua+xa,36)},Ba=Ca,ja=ka,Ga=Fa,Wa=$s,Ha=ea,Ka=Xo.Symbol,Ya=Ba("wks"),Xa=Ha?Ka.for||Ka:Ka&&Ka.withoutSetter||Ga,Za=function(e){return ja(Ya,e)||(Ya[e]=Wa&&ja(Ka,e)?Ka[e]:Xa("Symbol."+e)),Ya[e]},za=hs,Ja=Ls,Qa=oa,qa=fa,$a=function(e,t){var r,n;if("string"===t&&ma(r=e.toString)&&!_a(n=Ea(r,e)))return n;if(ma(r=e.valueOf)&&!_a(n=Ea(r,e)))return n;if("string"!==t&&ma(r=e.toString)&&!_a(n=Ea(r,e)))return n;throw new Ta("Can't convert object to primitive value")},ec=TypeError,tc=Za("toPrimitive"),rc=function(e,t){if(!Ja(e)||Qa(e))return e;var r,n=qa(e,tc);if(n){if(void 0===t&&(t="default"),r=za(n,e,t),!Ja(r)||Qa(r))return r;throw new ec("Can't convert object to primitive value")}return void 0===t&&(t="number"),$a(e,t)},nc=oa,ic=function(e){var t=rc(e,"string");return nc(t)?t:t+""},oc=Ls,sc=Xo.document,ac=oc(sc)&&oc(sc.createElement),cc=function(e){return ac?sc.createElement(e):{}},uc=cc,dc=!us&&!Vo((function(){return 7!==Object.defineProperty(uc("div"),"a",{get:function(){return 7}}).a})),lc=us,hc=hs,pc=ps,fc=gs,Ec=Ps,mc=ic,_c=ka,Tc=dc,gc=Object.getOwnPropertyDescriptor;cs.f=lc?gc:function(e,t){if(e=Ec(e),t=mc(t),Tc)try{return gc(e,t)}catch(e){}if(_c(e,t))return fc(!hc(pc.f,e,t),e[t])};var Sc=Vo,Rc=as,vc=/#|\.prototype\./,yc=function(e,t){var r=bc[Ac(e)];return r===Ic||r!==Oc&&(Rc(t)?Sc(t):!!t)},Ac=yc.normalize=function(e){return String(e).replace(vc,".").toLowerCase()},bc=yc.data={},Oc=yc.NATIVE="N",Ic=yc.POLYFILL="P",Cc=yc,wc=la,Nc=Fo,Pc=os(os.bind),Dc=function(e,t){return wc(e),void 0===t?e:Nc?Pc(e,t):function(){return e.apply(t,arguments)}},Lc={},kc=us&&Vo((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Mc=Ls,Uc=String,xc=TypeError,Vc=function(e){if(Mc(e))return e;throw new xc(Uc(e)+" is not an object")},Fc=us,Bc=dc,jc=kc,Gc=Vc,Wc=ic,Hc=TypeError,Kc=Object.defineProperty,Yc=Object.getOwnPropertyDescriptor,Xc="enumerable",Zc="configurable",zc="writable";Lc.f=Fc?jc?function(e,t,r){if(Gc(e),t=Wc(t),Gc(r),"function"==typeof e&&"prototype"===t&&"value"in r&&zc in r&&!r[zc]){var n=Yc(e,t);n&&n[zc]&&(e[t]=r.value,r={configurable:Zc in r?r[Zc]:n[Zc],enumerable:Xc in r?r[Xc]:n[Xc],writable:!1})}return Kc(e,t,r)}:Kc:function(e,t,r){if(Gc(e),t=Wc(t),Gc(r),Bc)try{return Kc(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new Hc("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Jc=Lc,Qc=gs,qc=us?function(e,t,r){return Jc.f(e,t,Qc(1,r))}:function(e,t,r){return e[t]=r,e},$c=Xo,eu=qo,tu=os,ru=as,nu=cs.f,iu=Cc,ou=ks,su=Dc,au=qc,cu=ka,uu=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return eu(e,this,arguments)};return t.prototype=e.prototype,t},du=function(e,t){var r,n,i,o,s,a,c,u,d,l=e.target,h=e.global,p=e.stat,f=e.proto,E=h?$c:p?$c[l]:$c[l]&&$c[l].prototype,m=h?ou:ou[l]||au(ou,l,{})[l],_=m.prototype;for(o in t)n=!(r=iu(h?o:l+(p?".":"#")+o,e.forced))&&E&&cu(E,o),a=m[o],n&&(c=e.dontCallGetSet?(d=nu(E,o))&&d.value:E[o]),s=n&&c?c:t[o],(r||f||typeof a!=typeof s)&&(u=e.bind&&n?su(s,$c):e.wrap&&n?uu(s):f&&ru(s)?tu(s):s,(e.sham||s&&s.sham||a&&a.sham)&&au(u,"sham",!0),au(m,o,u),f&&(cu(ou,i=l+"Prototype")||au(ou,i,{}),au(ou[i],o,s),e.real&&_&&(r||!_[o])&&au(_,o,s)))},lu=Math.ceil,hu=Math.floor,pu=Math.trunc||function(e){var t=+e;return(t>0?hu:lu)(t)},fu=pu,Eu=function(e){var t=+e;return t!=t||0===t?0:fu(t)},mu=Eu,_u=Math.max,Tu=Math.min,gu=function(e,t){var r=mu(e);return r<0?_u(r+t,0):Tu(r,t)},Su=Eu,Ru=Math.min,vu=function(e){var t=Su(e);return t>0?Ru(t,9007199254740991):0},yu=function(e){return vu(e.length)},Au=Ps,bu=gu,Ou=yu,Iu=function(e){return function(t,r,n){var i=Au(t),o=Ou(i);if(0===o)return!e&&-1;var s,a=bu(n,o);if(e&&r!=r){for(;o>a;)if((s=i[a++])!=s)return!0}else for(;o>a;a++)if((e||a in i)&&i[a]===r)return e||a||0;return!e&&-1}},Cu={includes:Iu(!0),indexOf:Iu(!1)},wu=du,Nu=Cu.includes,Pu=Vo,Du=Pu((function(){return!Array(1).includes()})),Lu=Pu((function(){return[,1].includes(void 0,1)}));wu({target:"Array",proto:!0,forced:Du||Lu},{includes:function(e){return Nu(this,e,arguments.length>1?arguments[1]:void 0)}});var ku=Xo,Mu=ks,Uu=function(e,t){var r=Mu[e+"Prototype"],n=r&&r[t];if(n)return n;var i=ku[e],o=i&&i.prototype;return o&&o[t]},xu=Uu("Array","includes"),Vu=Ls,Fu=rs,Bu=Za("match"),ju=function(e){var t;return Vu(e)&&(void 0!==(t=e[Bu])?!!t:"RegExp"===Fu(e))},Gu=TypeError,Wu={};Wu[Za("toStringTag")]="z";var Hu="[object z]"===String(Wu),Ku=Hu,Yu=as,Xu=rs,Zu=Za("toStringTag"),zu=Object,Ju="Arguments"===Xu(function(){return arguments}()),Qu=Ku?Xu:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=zu(e),Zu))?r:Ju?Xu(t):"Object"===(n=Xu(t))&&Yu(t.callee)?"Arguments":n},qu=Qu,$u=String,ed=function(e){if("Symbol"===qu(e))throw new TypeError("Cannot convert a Symbol value to a string");return $u(e)},td=Za("match"),rd=du,nd=function(e){if(ju(e))throw new Gu("The method doesn't accept regular expressions");return e},id=Cs,od=ed,sd=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[td]=!1,"/./"[e](t)}catch(e){}}return!1},ad=Ho("".indexOf);rd({target:"String",proto:!0,forced:!sd("includes")},{includes:function(e){return!!~ad(od(id(this)),od(nd(e)),arguments.length>1?arguments[1]:void 0)}});var cd=Uu("String","includes"),ud=Ko,dd=xu,ld=cd,hd=Array.prototype,pd=String.prototype,fd=function(e){var t=e.includes;return e===hd||ud(hd,e)&&t===hd.includes?dd:"string"==typeof e||e===pd||ud(pd,e)&&t===pd.includes?ld:t},Ed=z(fd);function md(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function _d(e,t,r,n,i){return{width:e,height:t,frameRate:r,bitrateMin:n,bitrateMax:i}}function Td(e,t,r,n,i){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:n,bitrateMax:i}}function gd(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const Sd={"90p":_d(160,90),"90p_1":_d(160,90),"120p":_d(160,120,15,30,65),"120p_1":_d(160,120,15,30,65),"120p_3":_d(120,120,15,30,50),"120p_4":_d(212,120),"180p":_d(320,180,15,30,140),"180p_1":_d(320,180,15,30,140),"180p_3":_d(180,180,15,30,100),"180p_4":_d(240,180,15,30,120),"240p":_d(320,240,15,40,200),"240p_1":_d(320,240,15,40,200),"240p_3":_d(240,240,15,40,140),"240p_4":_d(424,240,15,40,220),"360p":_d(640,360,15,80,400),"360p_1":_d(640,360,15,80,400),"360p_3":_d(360,360,15,80,260),"360p_4":_d(640,360,30,80,600),"360p_6":_d(360,360,30,80,400),"360p_7":_d(480,360,15,80,320),"360p_8":_d(480,360,30,80,490),"360p_9":_d(640,360,15,80,800),"360p_10":_d(640,360,24,80,800),"360p_11":_d(640,360,24,80,1e3),"480p":_d(640,480,15,100,500),"480p_1":_d(640,480,15,100,500),"480p_2":_d(640,480,30,100,1e3),"480p_3":_d(480,480,15,100,400),"480p_4":_d(640,480,30,100,750),"480p_6":_d(480,480,30,100,600),"480p_8":_d(848,480,15,100,610),"480p_9":_d(848,480,30,100,930),"480p_10":_d(640,480,10,100,400),"720p":_d(1280,720,15,120,1130),"720p_auto":_d(1280,720,30,900,3e3),"720p_1":_d(1280,720,15,120,1130),"720p_2":_d(1280,720,30,120,2e3),"720p_3":_d(1280,720,30,120,1710),"720p_5":_d(960,720,15,120,910),"720p_6":_d(960,720,30,120,1380),"1080p":_d(1920,1080,15,120,2080),"1080p_1":_d(1920,1080,15,120,2080),"1080p_2":_d(1920,1080,30,120,3e3),"1080p_3":_d(1920,1080,30,120,3150),"1080p_5":_d(1920,1080,60,120,4780),"1440p":_d(2560,1440,30,120,4850),"1440p_1":_d(2560,1440,30,120,4850),"1440p_2":_d(2560,1440,60,120,7350),"4k":_d(3840,2160,30,120,8910),"4k_1":_d(3840,2160,30,120,8910),"4k_3":_d(3840,2160,60,120,13500)},Rd={"480p":Td(640,480,5),"480p_1":Td(640,480,5),"480p_2":Td(640,480,30),"480p_3":Td(640,480,15),"720p":Td(1280,720,5),"720p_auto":_d(1280,720,30,900,3e3),"720p_1":Td(1280,720,5),"720p_2":Td(1280,720,30),"720p_3":Td(1280,720,15),"1080p":Td(1920,1080,5),"1080p_1":Td(1920,1080,5),"1080p_2":Td(1920,1080,30),"1080p_3":Td(1920,1080,15)},vd={"1SL1TL":gd(1,1),"3SL3TL":gd(3,3),"2SL3TL":gd(2,3)};function yd(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},Sd[e]):e}function Ad(e){return"string"==typeof e?Object.assign({},Rd[e]):e}function bd(e){return"string"==typeof e?Object.assign({},vd[e]):e}const Od={speech_low_quality:md(16e3,!1),speech_standard:md(32e3,!1,18),music_standard:md(48e3,!1),standard_stereo:md(48e3,!0,56),high_quality:md(48e3,!1,128),high_quality_stereo:md(48e3,!0,192)};function Id(e){return"string"==typeof e?Object.assign({},Od[e]):e}const Cd=[];function wd(e){Ed(Cd).call(Cd,e)||Cd.push(e)}function Nd(e){const t=Cd.indexOf(e);-1!==t&&Cd.splice(t,1)}function Pd(){return Cd.some((e=>function(e){return"__className__"in e&&"MicrophoneAudioTrack"===e.__className__}(e)))}function Dd(e){return jn(e.width,"config.width"),jn(e.height,"config.height"),void 0!==e.frameRate&&jn(e.frameRate,"config.frameRate"),void 0!==e.bitrateMax&&Bn(e.bitrateMax,"config.bitrateMax"),void 0!==e.bitrateMin&&Bn(e.bitrateMin,"config.bitrateMin"),void 0!==e.minDownscaleWidth&&Bn(e.minDownscaleWidth,"config.minDownscaleWidth",1,1/0,!0),void 0!==e.minDownscaleHeight&&Bn(e.minDownscaleHeight,"config.minDownscaleHeight",1,1/0,!0),!0}function Ld(e){return void 0!==e.sampleRate&&Bn(e.sampleRate,"config.sampleRate",0,96e3,!0),void 0!==e.sampleSize&&Bn(e.sampleRate,"config.sampleSize",0,128,!0),void 0!==e.stereo&&Vn(e.stereo,"config.stereo"),void 0!==e.bitrate&&Bn(e.bitrate,"config.bitrate",0,1e4,!1),!0}function kd(e){return Fn(e,"mediaSource",["screen","window","application"]),!0}let Md=function(e){return e.NEED_RENEGOTIATE="@need_renegotiate",e.NEED_REPLACE_TRACK="@need_replace_track",e.NEED_REPLACE_MIXING_TRACK="@need_replace_mixing_track",e.NEED_CLOSE="@need_close",e.NEED_ENABLE_TRACK="@need_enable_track",e.NEED_DISABLE_TRACK="@need_disable_track",e.NEED_SESSION_ID="@need_sid",e.SET_OPTIMIZATION_MODE="@set_optimization_mode",e.GET_STATS="@get_stats",e.GET_RTC_STATS="@get_rtc_stats",e.GET_LOW_VIDEO_TRACK="@get_low_video_track",e.NEED_RESET_REMOTE_SDP="@need_reset_remote_sdp",e.NEED_UPDATE_VIDEO_ENCODER="@need_update_video_encoder",e.NEED_UPDATE_VIDEO_SEND_PARAMETERS="@need_update_video_send_parameters",e.NEED_MUTE_TRACK="@need_mute_track",e.NEED_UNMUTE_TRACK="@need_unmute_track",e}({}),Ud=function(e){return e.SCREEN_TRACK="screen_track",e.CUSTOM_TRACK="custome_track",e.LOW_STREAM="low_stream",e.SCREEN_LOW_TRACK="screen_low_track",e}({});let xd=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),Vd=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.HIGH_STREAM_LAYER1=4]="HIGH_STREAM_LAYER1",e[e.HIGH_STREAM_LAYER2=5]="HIGH_STREAM_LAYER2",e[e.HIGH_STREAM_LAYER3=6]="HIGH_STREAM_LAYER3",e[e.HIGH_STREAM_LAYER4=7]="HIGH_STREAM_LAYER4",e[e.HIGH_STREAM_LAYER5=8]="HIGH_STREAM_LAYER5",e[e.HIGH_STREAM_LAYER6=9]="HIGH_STREAM_LAYER6",e}({}),Fd=function(e){return e[e.DISABLE=0]="DISABLE",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e[e.HIGH_STREAM_LAYER1=3]="HIGH_STREAM_LAYER1",e[e.HIGH_STREAM_LAYER2=4]="HIGH_STREAM_LAYER2",e[e.HIGH_STREAM_LAYER3=5]="HIGH_STREAM_LAYER3",e[e.HIGH_STREAM_LAYER4=6]="HIGH_STREAM_LAYER4",e[e.HIGH_STREAM_LAYER5=7]="HIGH_STREAM_LAYER5",e[e.HIGH_STREAM_LAYER6=8]="HIGH_STREAM_LAYER6",e}({}),Bd=function(e){return e.TRANSCEIVER_UPDATED="transceiver-updated",e.SEI_TO_SEND="sei-to-send",e.SEI_RECEIVED="sei-received",e.TRACK_UPDATED="track-updated",e}({}),jd=function(e){return e.SOURCE_STATE_CHANGE="source-state-change",e.TRACK_ENDED="track-ended",e.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.CLOSED="closed",e}({}),Gd=function(e){return e.FIRST_FRAME_DECODED="first-frame-decoded",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.VIDEO_STATE_CHANGED="video-state-changed",e.PLAY_START="play-start",e.PLAY_END="play-end",e.FIRST_FRAME_RENDER="first-frame-render",e}({}),Wd=function(e){return e.AUDIO="audio",e.VIDEO="video",e.DATA="data",e}({}),Hd=function(e){return e.AUDIO_SOURCE_STATE_CHANGE="audio_source_state_change",e.RECEIVE_TRACK_BUFFER="receive_track_buffer",e.ON_AUDIO_BUFFER="on_audio_buffer",e.UPDATE_SOURCE="update_source",e}({}),Kd=function(e){return e.UPDATE_TRACK_SOURCE="update-track-source",e}({});const Yd={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},Xd={sendBytes:0,sendBitrate:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,sendResolutionHeight:0,sendResolutionWidth:0,captureResolutionHeight:0,captureResolutionWidth:0,targetSendBitrate:0,totalDuration:0,totalFreezeTime:0,currentPacketLossRate:0},Zd={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveLevel:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receivePacketsDiscarded:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1},zd={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receiveResolutionHeight:0,receiveResolutionWidth:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1};let Jd=function(e){return e.ON_TRACK="on_track",e.ON_NODE="on_node",e}({}),Qd=function(e){return e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints",e}({}),qd=function(e){return e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND",e}({}),$d=function(e){return e.STATE_CHANGE="state_change",e.RECORDING_DEVICE_CHANGED="recordingDeviceChanged",e.PLAYOUT_DEVICE_CHANGED="playoutDeviceChanged",e.CAMERA_DEVICE_CHANGED="cameraDeviceChanged",e}({});let el=function(e){return e.NONE="none",e.INIT="init",e.CANPLAY="canplay",e.PLAYING="playing",e.PAUSED="paused",e.SUSPEND="suspend",e.STALLED="stalled",e.WAITING="waiting",e.ERROR="error",e.DESTROYED="destroyed",e.ABORT="abort",e.ENDED="ended",e.EMPTIED="emptied",e.LOADEDDATA="loadeddata",e}({}),tl=function(e){return e[e.VideoStateStopped=0]="VideoStateStopped",e[e.VideoStateStarting=1]="VideoStateStarting",e[e.VideoStateDecoding=2]="VideoStateDecoding",e[e.VideoStateFrozen=3]="VideoStateFrozen",e}({});let rl=function(e){return e.OPEN="open",e.MESSAGE="message",e.CLOSE="close",e.CLOSING="closing",e.ERROR="error",e}({});var nl={exports:{}},il=du,ol=us,sl=Lc.f;il({target:"Object",stat:!0,forced:Object.defineProperty!==sl,sham:!ol},{defineProperty:sl});var al=ks.Object,cl=nl.exports=function(e,t,r){return al.defineProperty(e,t,r)};al.defineProperty.sham&&(cl.sham=!0);var ul=z(nl.exports),dl=rs,ll=Array.isArray||function(e){return"Array"===dl(e)},hl=TypeError,pl=function(e){if(e>9007199254740991)throw new hl("Maximum allowed index exceeded");return e},fl=us,El=Lc,ml=gs,_l=function(e,t,r){fl?El.f(e,t,ml(0,r)):e[t]=r},Tl=us,gl=ll,Sl=TypeError,Rl=Object.getOwnPropertyDescriptor,vl=Tl&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(gl(e)&&!Rl(e,"length").writable)throw new Sl("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},yl=as,Al=Oa,bl=Ho(Function.toString);yl(Al.inspectSource)||(Al.inspectSource=function(e){return bl(e)});var Ol=Al.inspectSource,Il=Ho,Cl=Vo,wl=as,Nl=Qu,Pl=Ol,Dl=function(){},Ll=Fs("Reflect","construct"),kl=/^\s*(?:class|function)\b/,Ml=Il(kl.exec),Ul=!kl.test(Dl),xl=function(e){if(!wl(e))return!1;try{return Ll(Dl,[],e),!0}catch(e){return!1}},Vl=function(e){if(!wl(e))return!1;switch(Nl(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ul||!!Ml(kl,Pl(e))}catch(e){return!0}};Vl.sham=!0;var Fl=!Ll||Cl((function(){var e;return xl(xl.call)||!xl(Object)||!xl((function(){e=!0}))||e}))?Vl:xl,Bl=ll,jl=Fl,Gl=Ls,Wl=Za("species"),Hl=Array,Kl=function(e){var t;return Bl(e)&&(t=e.constructor,(jl(t)&&(t===Hl||Bl(t.prototype))||Gl(t)&&null===(t=t[Wl]))&&(t=void 0)),void 0===t?Hl:t},Yl=function(e,t){return new(Kl(e))(0===t?0:t)},Xl=Vo,Zl=zs,zl=Za("species"),Jl=function(e){return Zl>=51||!Xl((function(){var t=[];return(t.constructor={})[zl]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Ql=du,ql=Vo,$l=ll,eh=Ls,th=Pa,rh=yu,nh=pl,ih=_l,oh=vl,sh=Yl,ah=Jl,ch=zs,uh=Za("isConcatSpreadable"),dh=ch>=51||!ql((function(){var e=[];return e[uh]=!1,e.concat()[0]!==e})),lh=function(e){if(!eh(e))return!1;var t=e[uh];return void 0!==t?!!t:$l(e)};Ql({target:"Array",proto:!0,arity:1,forced:!dh||!ah("concat")},{concat:function(e){var t,r,n,i,o,s=th(this),a=sh(s,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(lh(o=-1===t?s:arguments[t]))for(i=rh(o),nh(c+i),r=0;r<i;r++,c++)r in o&&ih(a,c,o[r]);else nh(c+1),ih(a,c++,o);return oh(a,c),a}});var hh={},ph={},fh=ka,Eh=Ps,mh=Cu.indexOf,_h=ph,Th=Ho([].push),gh=function(e,t){var r,n=Eh(e),i=0,o=[];for(r in n)!fh(_h,r)&&fh(n,r)&&Th(o,r);for(;t.length>i;)fh(n,r=t[i++])&&(~mh(o,r)||Th(o,r));return o},Sh=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Rh=gh,vh=Sh,yh=Object.keys||function(e){return Rh(e,vh)},Ah=us,bh=kc,Oh=Lc,Ih=Vc,Ch=Ps,wh=yh;hh.f=Ah&&!bh?Object.defineProperties:function(e,t){Ih(e);for(var r,n=Ch(t),i=wh(t),o=i.length,s=0;o>s;)Oh.f(e,r=i[s++],n[r]);return e};var Nh,Ph=Fs("document","documentElement"),Dh=Fa,Lh=Ca("keys"),kh=function(e){return Lh[e]||(Lh[e]=Dh(e))},Mh=Vc,Uh=hh,xh=Sh,Vh=ph,Fh=Ph,Bh=cc,jh="prototype",Gh="script",Wh=kh("IE_PROTO"),Hh=function(){},Kh=function(e){return"<"+Gh+">"+e+"</"+Gh+">"},Yh=function(e){e.write(Kh("")),e.close();var t=e.parentWindow.Object;return e=null,t},Xh=function(){try{Nh=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Xh="undefined"!=typeof document?document.domain&&Nh?Yh(Nh):(t=Bh("iframe"),r="java"+Gh+":",t.style.display="none",Fh.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(Kh("document.F=Object")),e.close(),e.F):Yh(Nh);for(var n=xh.length;n--;)delete Xh[jh][xh[n]];return Xh()};Vh[Wh]=!0;var Zh=Object.create||function(e,t){var r;return null!==e?(Hh[jh]=Mh(e),r=new Hh,Hh[jh]=null,r[Wh]=e):r=Xh(),void 0===t?r:Uh.f(r,t)},zh={},Jh=gh,Qh=Sh.concat("length","prototype");zh.f=Object.getOwnPropertyNames||function(e){return Jh(e,Qh)};var qh={},$h=Ho([].slice),ep=rs,tp=Ps,rp=zh.f,np=$h,ip="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];qh.f=function(e){return ip&&"Window"===ep(e)?function(e){try{return rp(e)}catch(e){return np(ip)}}(e):rp(tp(e))};var op={};op.f=Object.getOwnPropertySymbols;var sp=qc,ap=function(e,t,r,n){return n&&n.enumerable?e[t]=r:sp(e,t,r),e},cp=Lc,up=function(e,t,r){return cp.f(e,t,r)},dp={},lp=Za;dp.f=lp;var hp,pp,fp,Ep=ks,mp=ka,_p=dp,Tp=Lc.f,gp=function(e){var t=Ep.Symbol||(Ep.Symbol={});mp(t,e)||Tp(t,e,{value:_p.f(e)})},Sp=hs,Rp=Fs,vp=Za,yp=ap,Ap=function(){var e=Rp("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=vp("toPrimitive");t&&!t[n]&&yp(t,n,(function(e){return Sp(r,this)}),{arity:1})},bp=Qu,Op=Hu?{}.toString:function(){return"[object "+bp(this)+"]"},Ip=Hu,Cp=Lc.f,wp=qc,Np=ka,Pp=Op,Dp=Za("toStringTag"),Lp=function(e,t,r,n){var i=r?e:e&&e.prototype;i&&(Np(i,Dp)||Cp(i,Dp,{configurable:!0,value:t}),n&&!Ip&&wp(i,"toString",Pp))},kp=as,Mp=Xo.WeakMap,Up=kp(Mp)&&/native code/.test(String(Mp)),xp=Xo,Vp=Ls,Fp=qc,Bp=ka,jp=Oa,Gp=kh,Wp=ph,Hp="Object already initialized",Kp=xp.TypeError,Yp=xp.WeakMap;if(Up||jp.state){var Xp=jp.state||(jp.state=new Yp);Xp.get=Xp.get,Xp.has=Xp.has,Xp.set=Xp.set,hp=function(e,t){if(Xp.has(e))throw new Kp(Hp);return t.facade=e,Xp.set(e,t),t},pp=function(e){return Xp.get(e)||{}},fp=function(e){return Xp.has(e)}}else{var Zp=Gp("state");Wp[Zp]=!0,hp=function(e,t){if(Bp(e,Zp))throw new Kp(Hp);return t.facade=e,Fp(e,Zp,t),t},pp=function(e){return Bp(e,Zp)?e[Zp]:{}},fp=function(e){return Bp(e,Zp)}}var zp={set:hp,get:pp,has:fp,enforce:function(e){return fp(e)?pp(e):hp(e,{})},getterFor:function(e){return function(t){var r;if(!Vp(t)||(r=pp(t)).type!==e)throw new Kp("Incompatible receiver, "+e+" required");return r}}},Jp=Dc,Qp=As,qp=Pa,$p=yu,ef=Yl,tf=_l,rf=function(e){var t=1===e,r=2===e,n=3===e,i=4===e,o=6===e,s=7===e,a=5===e||o;return function(c,u,d){for(var l,h,p=qp(c),f=Qp(p),E=$p(f),m=Jp(u,d),_=0,T=0,g=t?ef(c,E):r||s?ef(c,0):void 0;E>_;_++)if((a||_ in f)&&(h=m(l=f[_],_,p),e))if(t)tf(g,_,h);else if(h)switch(e){case 3:return!0;case 5:return l;case 6:return _;case 2:tf(g,T++,l)}else switch(e){case 4:return!1;case 7:tf(g,T++,l)}return o?-1:n||i?i:g}},nf={forEach:rf(0),map:rf(1),filter:rf(2),some:rf(3),every:rf(4),find:rf(5),findIndex:rf(6),filterReject:rf(7)},of=du,sf=Xo,af=hs,cf=Ho,uf=us,df=$s,lf=Vo,hf=ka,pf=Ko,ff=Vc,Ef=Ps,mf=ic,_f=ed,Tf=gs,gf=Zh,Sf=yh,Rf=zh,vf=qh,yf=op,Af=cs,bf=Lc,Of=hh,If=ps,Cf=ap,wf=up,Nf=Ca,Pf=ph,Df=Fa,Lf=Za,kf=dp,Mf=gp,Uf=Ap,xf=Lp,Vf=zp,Ff=nf.forEach,Bf=kh("hidden"),jf="Symbol",Gf="prototype",Wf=Vf.set,Hf=Vf.getterFor(jf),Kf=Object[Gf],Yf=sf.Symbol,Xf=Yf&&Yf[Gf],Zf=sf.RangeError,zf=sf.TypeError,Jf=sf.QObject,Qf=Af.f,qf=bf.f,$f=vf.f,eE=If.f,tE=cf([].push),rE=Nf("symbols"),nE=Nf("op-symbols"),iE=Nf("wks"),oE=!Jf||!Jf[Gf]||!Jf[Gf].findChild,sE=function(e,t,r){var n=Qf(Kf,t);return n&&delete Kf[t],qf(e,t,r),n&&e!==Kf&&qf(Kf,t,n),e},aE=uf&&lf((function(){return 7!==gf(qf({},"a",{get:function(){return qf(this,"a",{value:7}).a}})).a}))?sE:qf,cE=function(e,t){var r=rE[e]=gf(Xf);return Wf(r,{type:jf,tag:e,description:t}),uf||(r.description=t),r},uE=function(e,t,r){e===Kf&&uE(nE,t,r),ff(e);var n=mf(t);return ff(r),hf(rE,n)?(("enumerable"in r?!r.enumerable:!hf(e,n)||hf(e,Bf)&&e[Bf][n])?(hf(e,Bf)||qf(e,Bf,Tf(1,gf(null))),e[Bf][n]=!0):(hf(e,Bf)&&e[Bf][n]&&(e[Bf][n]=!1),r=gf(r,{enumerable:Tf(0,!1)})),aE(e,n,r)):qf(e,n,r)},dE=function(e,t){ff(e);var r=Ef(t),n=Sf(r).concat(fE(r));return Ff(n,(function(t){uf&&!af(lE,r,t)||uE(e,t,r[t])})),e},lE=function(e){var t=mf(e),r=af(eE,this,t);return!(this===Kf&&hf(rE,t)&&!hf(nE,t))&&(!(r||!hf(this,t)||!hf(rE,t)||hf(this,Bf)&&this[Bf][t])||r)},hE=function(e,t){var r=Ef(e),n=mf(t);if(r!==Kf||!hf(rE,n)||hf(nE,n)){var i=Qf(r,n);return!i||!hf(rE,n)||hf(r,Bf)&&r[Bf][n]||(i.enumerable=!0),i}},pE=function(e){var t=$f(Ef(e)),r=[];return Ff(t,(function(e){hf(rE,e)||hf(Pf,e)||tE(r,e)})),r},fE=function(e){var t=e===Kf,r=$f(t?nE:Ef(e)),n=[];return Ff(r,(function(e){!hf(rE,e)||t&&!hf(Kf,e)||tE(n,rE[e])})),n};df||(Yf=function(){if(pf(Xf,this))throw new zf("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?_f(arguments[0]):void 0,t=Df(e),r=function(e){var n=void 0===this?sf:this;n===Kf&&af(r,nE,e),hf(n,Bf)&&hf(n[Bf],t)&&(n[Bf][t]=!1);var i=Tf(1,e);try{aE(n,t,i)}catch(e){if(!(e instanceof Zf))throw e;sE(n,t,i)}};return uf&&oE&&aE(Kf,t,{configurable:!0,set:r}),cE(t,e)},Cf(Xf=Yf[Gf],"toString",(function(){return Hf(this).tag})),Cf(Yf,"withoutSetter",(function(e){return cE(Df(e),e)})),If.f=lE,bf.f=uE,Of.f=dE,Af.f=hE,Rf.f=vf.f=pE,yf.f=fE,kf.f=function(e){return cE(Lf(e),e)},uf&&wf(Xf,"description",{configurable:!0,get:function(){return Hf(this).description}})),of({global:!0,constructor:!0,wrap:!0,forced:!df,sham:!df},{Symbol:Yf}),Ff(Sf(iE),(function(e){Mf(e)})),of({target:jf,stat:!0,forced:!df},{useSetter:function(){oE=!0},useSimple:function(){oE=!1}}),of({target:"Object",stat:!0,forced:!df,sham:!uf},{create:function(e,t){return void 0===t?gf(e):dE(gf(e),t)},defineProperty:uE,defineProperties:dE,getOwnPropertyDescriptor:hE}),of({target:"Object",stat:!0,forced:!df},{getOwnPropertyNames:pE}),Uf(),xf(Yf,jf),Pf[Bf]=!0;var EE=$s&&!!Symbol.for&&!!Symbol.keyFor,mE=du,_E=Fs,TE=ka,gE=ed,SE=Ca,RE=EE,vE=SE("string-to-symbol-registry"),yE=SE("symbol-to-string-registry");mE({target:"Symbol",stat:!0,forced:!RE},{for:function(e){var t=gE(e);if(TE(vE,t))return vE[t];var r=_E("Symbol")(t);return vE[t]=r,yE[r]=t,r}});var AE=du,bE=ka,OE=oa,IE=aa,CE=EE,wE=Ca("symbol-to-string-registry");AE({target:"Symbol",stat:!0,forced:!CE},{keyFor:function(e){if(!OE(e))throw new TypeError(IE(e)+" is not a symbol");if(bE(wE,e))return wE[e]}});var NE=Ls,PE=zp.get,DE=Ho,LE=ka,kE=SyntaxError,ME=parseInt,UE=String.fromCharCode,xE=DE("".charAt),VE=DE("".slice),FE=DE(/./.exec),BE={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},jE=/^[\da-f]{4}$/i,GE=/^[\u0000-\u001F]$/,WE=!Vo((function(){var e="9007199254740993",t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e})),HE=du,KE=Fs,YE=qo,XE=hs,ZE=Ho,zE=Vo,JE=ll,QE=as,qE=function(e){if(!NE(e))return!1;var t=PE(e);return!!t&&"RawJSON"===t.type},$E=oa,em=rs,tm=ed,rm=$h,nm=function(e,t){for(var r=!0,n="";t<e.length;){var i=xE(e,t);if("\\"===i){var o=VE(e,t,t+2);if(LE(BE,o))n+=BE[o],t+=2;else{if("\\u"!==o)throw new kE('Unknown escape sequence: "'+o+'"');var s=VE(e,t+=2,t+4);if(!FE(jE,s))throw new kE("Bad Unicode escape at: "+t);n+=UE(ME(s,16)),t+=4}}else{if('"'===i){r=!1,t++;break}if(FE(GE,i))throw new kE("Bad control character in string literal at: "+t);n+=i,t++}}if(r)throw new kE("Unterminated string at: "+t);return{value:n,end:t}},im=Fa,om=$s,sm=WE,am=String,cm=KE("JSON","stringify"),um=ZE(/./.exec),dm=ZE("".charAt),lm=ZE("".charCodeAt),hm=ZE("".replace),pm=ZE("".slice),fm=ZE([].push),Em=ZE(1.1.toString),mm=/[\uD800-\uDFFF]/g,_m=/^[\uD800-\uDBFF]$/,Tm=/^[\uDC00-\uDFFF]$/,gm=im(),Sm=gm.length,Rm=!om||zE((function(){var e=KE("Symbol")("stringify detection");return"[null]"!==cm([e])||"{}"!==cm({a:e})||"{}"!==cm(Object(e))})),vm=zE((function(){return'"\\udf06\\ud834"'!==cm("\udf06\ud834")||'"\\udead"'!==cm("\udead")})),ym=Rm?function(e,t){var r=rm(arguments),n=bm(t);if(QE(n)||void 0!==e&&!$E(e))return r[1]=function(e,t){if(QE(n)&&(t=XE(n,this,am(e),t)),!$E(t))return t},YE(cm,null,r)}:cm,Am=function(e,t,r){var n=dm(r,t-1),i=dm(r,t+1);return um(_m,e)&&!um(Tm,i)||um(Tm,e)&&!um(_m,n)?"\\u"+Em(lm(e,0),16):e},bm=function(e){if(QE(e))return e;if(JE(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?fm(r,i):"number"!=typeof i&&"Number"!==em(i)&&"String"!==em(i)||fm(r,tm(i))}var o=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(JE(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}};cm&&HE({target:"JSON",stat:!0,arity:3,forced:Rm||vm||!sm},{stringify:function(e,t,r){var n=bm(t),i=[],o=ym(e,(function(e,t){var r=QE(n)?XE(n,this,am(e),t):t;return!sm&&qE(r)?gm+(fm(i,r.rawJSON)-1):r}),r);if("string"!=typeof o)return o;if(vm&&(o=hm(o,mm,Am)),sm)return o;for(var s="",a=o.length,c=0;c<a;c++){var u=dm(o,c);if('"'===u){var d=nm(o,++c).end-1,l=pm(o,c,d);s+=pm(l,0,Sm)===gm?i[pm(l,Sm)]:'"'+l+'"',c=d}else s+=u}return s}});var Om=op,Im=Pa;du({target:"Object",stat:!0,forced:!$s||Vo((function(){Om.f(1)}))},{getOwnPropertySymbols:function(e){var t=Om.f;return t?t(Im(e)):[]}}),gp("asyncDispose"),gp("asyncIterator"),gp("dispose"),gp("hasInstance"),gp("isConcatSpreadable"),gp("iterator"),gp("match"),gp("matchAll"),gp("replace"),gp("search"),gp("species"),gp("split");var Cm=Ap;gp("toPrimitive"),Cm();var wm=Fs,Nm=Lp;gp("toStringTag"),Nm(wm("Symbol"),"Symbol"),gp("unscopables"),Lp(Xo.JSON,"JSON",!0);var Pm,Dm,Lm,km=ks.Symbol,Mm={},Um=us,xm=ka,Vm=Function.prototype,Fm=Um&&Object.getOwnPropertyDescriptor,Bm=xm(Vm,"name"),jm={EXISTS:Bm,PROPER:Bm&&"something"===function(){}.name,CONFIGURABLE:Bm&&(!Um||Um&&Fm(Vm,"name").configurable)},Gm=!Vo((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Wm=ka,Hm=as,Km=Pa,Ym=Gm,Xm=kh("IE_PROTO"),Zm=Object,zm=Zm.prototype,Jm=Ym?Zm.getPrototypeOf:function(e){var t=Km(e);if(Wm(t,Xm))return t[Xm];var r=t.constructor;return Hm(r)&&t instanceof r?r.prototype:t instanceof Zm?zm:null},Qm=Vo,qm=as,$m=Ls,e_=Zh,t_=Jm,r_=ap,n_=Za("iterator"),i_=!1;[].keys&&("next"in(Lm=[].keys())?(Dm=t_(t_(Lm)))!==Object.prototype&&(Pm=Dm):i_=!0);var o_=!$m(Pm)||Qm((function(){var e={};return Pm[n_].call(e)!==e}));qm((Pm=o_?{}:e_(Pm))[n_])||r_(Pm,n_,(function(){return this}));var s_={IteratorPrototype:Pm,BUGGY_SAFARI_ITERATORS:i_},a_=s_.IteratorPrototype,c_=Zh,u_=gs,d_=Lp,l_=Mm,h_=function(){return this},p_=function(e,t,r,n){var i=t+" Iterator";return e.prototype=c_(a_,{next:u_(+!n,r)}),d_(e,i,!1,!0),l_[i]=h_,e},f_=Ho,E_=la,m_=Ls,__=function(e){return m_(e)||null===e},T_=String,g_=TypeError,S_=function(e,t,r){try{return f_(E_(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},R_=Ls,v_=Cs,y_=function(e){if(__(e))return e;throw new g_("Can't set "+T_(e)+" as a prototype")},A_=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=S_(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return v_(r),y_(n),R_(r)?(t?e(r,n):r.__proto__=n,r):r}}():void 0),b_=du,O_=hs,I_=jm,C_=p_,w_=Jm,N_=Lp,P_=ap,D_=Mm,L_=s_,k_=I_.PROPER,M_=L_.BUGGY_SAFARI_ITERATORS,U_=Za("iterator"),x_="keys",V_="values",F_="entries",B_=function(){return this},j_=function(e,t,r,n,i,o,s){C_(r,t,n);var a,c,u,d=function(e){if(e===i&&E)return E;if(!M_&&e&&e in p)return p[e];switch(e){case x_:case V_:case F_:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[U_]||p["@@iterator"]||i&&p[i],E=!M_&&f||d(i),m="Array"===t&&p.entries||f;if(m&&(a=w_(m.call(new e)))!==Object.prototype&&a.next&&(N_(a,l,!0,!0),D_[l]=B_),k_&&i===V_&&f&&f.name!==V_&&(h=!0,E=function(){return O_(f,this)}),i)if(c={values:d(V_),keys:o?E:d(x_),entries:d(F_)},s)for(u in c)(M_||h||!(u in p))&&P_(p,u,c[u]);else b_({target:t,proto:!0,forced:M_||h},c);return s&&p[U_]!==E&&P_(p,U_,E,{name:i}),D_[t]=E,c},G_=function(e,t){return{value:e,done:t}},W_=Ps,H_=Mm,K_=zp;Lc.f;var Y_=j_,X_=G_,Z_="Array Iterator",z_=K_.set,J_=K_.getterFor(Z_);Y_(Array,"Array",(function(e,t){z_(this,{type:Z_,target:W_(e),index:0,kind:t})}),(function(){var e=J_(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,X_(void 0,!0);switch(e.kind){case"keys":return X_(r,!1);case"values":return X_(t[r],!1)}return X_([r,t[r]],!1)}),"values"),H_.Arguments=H_.Array;var Q_={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},q_=Xo,$_=Lp,eT=Mm;for(var tT in Q_)$_(q_[tT],tT),eT[tT]=eT.Array;var rT=km,nT=Za,iT=Lc.f,oT=nT("metadata"),sT=Function.prototype;void 0===sT[oT]&&iT(sT,oT,{value:null}),gp("metadata");var aT=rT,cT=Ho,uT=Fs("Symbol"),dT=uT.keyFor,lT=cT(uT.prototype.valueOf),hT=uT.isRegisteredSymbol||function(e){try{return void 0!==dT(lT(e))}catch(e){return!1}};du({target:"Symbol",stat:!0},{isRegisteredSymbol:hT});for(var pT=Ca,fT=Fs,ET=Ho,mT=oa,_T=Za,TT=fT("Symbol"),gT=TT.isWellKnownSymbol,ST=fT("Object","getOwnPropertyNames"),RT=ET(TT.prototype.valueOf),vT=pT("wks"),yT=0,AT=ST(TT),bT=AT.length;yT<bT;yT++)try{var OT=AT[yT];mT(TT[OT])&&_T(OT)}catch(e){}var IT=function(e){if(gT&&gT(e))return!0;try{for(var t=RT(e),r=0,n=ST(vT),i=n.length;r<i;r++)if(vT[n[r]]==t)return!0}catch(e){}return!1};du({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:IT}),gp("customMatcher"),gp("observable"),du({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:hT}),du({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:IT}),gp("matcher"),gp("metadataKey"),gp("patternMatch"),gp("replaceAll");var CT=z(aT),wT=Ho,NT=Eu,PT=ed,DT=Cs,LT=wT("".charAt),kT=wT("".charCodeAt),MT=wT("".slice),UT=function(e){return function(t,r){var n,i,o=PT(DT(t)),s=NT(r),a=o.length;return s<0||s>=a?e?"":void 0:(n=kT(o,s))<55296||n>56319||s+1===a||(i=kT(o,s+1))<56320||i>57343?e?LT(o,s):n:e?MT(o,s,s+2):i-56320+(n-55296<<10)+65536}},xT={codeAt:UT(!1),charAt:UT(!0)},VT=xT.charAt,FT=ed,BT=zp,jT=j_,GT=G_,WT="String Iterator",HT=BT.set,KT=BT.getterFor(WT);jT(String,"String",(function(e){HT(this,{type:WT,string:FT(e),index:0})}),(function(){var e,t=KT(this),r=t.string,n=t.index;return n>=r.length?GT(void 0,!0):(e=VT(r,n),t.index+=e.length,GT(e,!1))}));var YT=z(dp.f("iterator"));function XT(e){return XT="function"==typeof CT&&"symbol"==typeof YT?function(e){return typeof e}:function(e){return e&&"function"==typeof CT&&e.constructor===CT&&e!==CT.prototype?"symbol":typeof e},XT(e)}var ZT=z(dp.f("toPrimitive"));function zT(e){var t=function(e,t){if("object"!==XT(e)||null===e)return e;var r=e[ZT];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==XT(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===XT(t)?t:String(t)}function JT(e,t,r){return(t=zT(t))in e?ul(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var QT=Vo,qT=function(e,t){var r=[][e];return!!r&&QT((function(){r.call(null,t||function(){return 1},1)}))},$T=nf.forEach,eg=qT("forEach")?[].forEach:function(e){return $T(this,e,arguments.length>1?arguments[1]:void 0)};du({target:"Array",proto:!0,forced:[].forEach!==eg},{forEach:eg});var tg=Uu("Array","forEach"),rg=Qu,ng=ka,ig=Ko,og=tg,sg=Array.prototype,ag={DOMTokenList:!0,NodeList:!0},cg=function(e){var t=e.forEach;return e===sg||ig(sg,e)&&t===sg.forEach||ng(ag,rg(e))?og:t},ug=z(cg),dg=Pa,lg=yh;du({target:"Object",stat:!0,forced:Vo((function(){lg(1)}))},{keys:function(e){return lg(dg(e))}});var hg=z(ks.Object.keys),pg=la,fg=Pa,Eg=As,mg=yu,_g=TypeError,Tg="Reduce of empty array with no initial value",gg=function(e){return function(t,r,n,i){var o=fg(t),s=Eg(o),a=mg(o);if(pg(r),0===a&&n<2)throw new _g(Tg);var c=e?a-1:0,u=e?-1:1;if(n<2)for(;;){if(c in s){i=s[c],c+=u;break}if(c+=u,e?c<0:a<=c)throw new _g(Tg)}for(;e?c>=0:a>c;c+=u)c in s&&(i=r(i,s[c],c,o));return i}},Sg={left:gg(!1),right:gg(!0)},Rg=Xo,vg=Gs,yg=rs,Ag=function(e){return vg.slice(0,e.length)===e},bg=Ag("Bun/")?"BUN":Ag("Cloudflare-Workers")?"CLOUDFLARE":Ag("Deno/")?"DENO":Ag("Node.js/")?"NODE":Rg.Bun&&"string"==typeof Bun.version?"BUN":Rg.Deno&&"object"==typeof Deno.version?"DENO":"process"===yg(Rg.process)?"NODE":Rg.window&&Rg.document?"BROWSER":"REST",Og="NODE"===bg,Ig=Sg.left;du({target:"Array",proto:!0,forced:!Og&&zs>79&&zs<83||!qT("reduce")},{reduce:function(e){var t=arguments.length;return Ig(this,e,t,t>1?arguments[1]:void 0)}});var Cg=Uu("Array","reduce"),wg=Ko,Ng=Cg,Pg=Array.prototype,Dg=function(e){var t=e.reduce;return e===Pg||wg(Pg,e)&&t===Pg.reduce?Ng:t},Lg=Dg,kg=z(Lg),Mg=du,Ug=ll,xg=Ho([].reverse),Vg=[1,2];Mg({target:"Array",proto:!0,forced:String(Vg)===String(Vg.reverse())},{reverse:function(){return Ug(this)&&(this.length=this.length),xg(this)}});var Fg=Uu("Array","reverse"),Bg=Ko,jg=Fg,Gg=Array.prototype,Wg=function(e){var t=e.reverse;return e===Gg||Bg(Gg,e)&&t===Gg.reverse?jg:t},Hg=Wg,Kg=z(Hg),Yg=du,Xg=ll,Zg=Fl,zg=Ls,Jg=gu,Qg=yu,qg=Ps,$g=_l,eS=vl,tS=Za,rS=$h,nS=Jl("slice"),iS=tS("species"),oS=Array,sS=Math.max;Yg({target:"Array",proto:!0,forced:!nS},{slice:function(e,t){var r,n,i,o=qg(this),s=Qg(o),a=Jg(e,s),c=Jg(void 0===t?s:t,s);if(Xg(o)&&(r=o.constructor,(Zg(r)&&(r===oS||Xg(r.prototype))||zg(r)&&null===(r=r[iS]))&&(r=void 0),r===oS||void 0===r))return rS(o,a,c);for(n=new(void 0===r?oS:r)(sS(c-a,0)),i=0;a<c;a++,i++)a in o&&$g(n,i,o[a]);return eS(n,i),n}});var aS=Uu("Array","slice"),cS=Ko,uS=aS,dS=Array.prototype,lS=function(e){var t=e.slice;return e===dS||cS(dS,e)&&t===dS.slice?uS:t},hS=z(lS);function pS(e,t,r,n,i){var o,s,a,c={};return ug(o=hg(n)).call(o,(function(e){c[e]=n[e]})),c.enumerable=!!c.enumerable,c.configurable=!!c.configurable,("value"in c||c.initializer)&&(c.writable=!0),c=kg(s=Kg(a=hS(r).call(r)).call(a)).call(s,(function(r,n){return n(e,t,r)||r}),c),i&&void 0!==c.initializer&&(c.value=c.initializer?c.initializer.call(i):void 0,c.initializer=void 0),void 0===c.initializer&&(ul(e,t,c),c=null),c}var fS=Fs,ES=zh,mS=op,_S=Vc,TS=Ho([].concat),gS=fS("Reflect","ownKeys")||function(e){var t=ES.f(_S(e)),r=mS.f;return r?TS(t,r(e)):t},SS=ka,RS=gS,vS=cs,yS=Lc,AS=Ls,bS=qc,OS=Error,IS=Ho("".replace),CS=String(new OS("zxcasd").stack),wS=/\n\s*at [^:]*:[^\n]*/,NS=wS.test(CS),PS=gs,DS=!Vo((function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",PS(1,7)),7!==e.stack)})),LS=qc,kS=function(e,t){if(NS&&"string"==typeof e&&!OS.prepareStackTrace)for(;t--;)e=IS(e,wS,"");return e},MS=DS,US=Error.captureStackTrace,xS=Mm,VS=Za("iterator"),FS=Array.prototype,BS=function(e){return void 0!==e&&(xS.Array===e||FS[VS]===e)},jS=Qu,GS=fa,WS=bs,HS=Mm,KS=Za("iterator"),YS=function(e){if(!WS(e))return GS(e,KS)||GS(e,"@@iterator")||HS[jS(e)]},XS=hs,ZS=la,zS=Vc,JS=aa,QS=YS,qS=TypeError,$S=function(e,t){var r=arguments.length<2?QS(e):t;if(ZS(r))return zS(XS(r,e));throw new qS(JS(e)+" is not iterable")},eR=hs,tR=Vc,rR=fa,nR=function(e,t,r){var n,i;tR(e);try{if(!(n=rR(e,"return"))){if("throw"===t)throw r;return r}n=eR(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return tR(n),r},iR=Dc,oR=hs,sR=Vc,aR=aa,cR=BS,uR=yu,dR=Ko,lR=$S,hR=YS,pR=nR,fR=TypeError,ER=function(e,t){this.stopped=e,this.result=t},mR=ER.prototype,_R=function(e,t,r){var n,i,o,s,a,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),E=iR(t,d),m=function(e){var t=n;return n=void 0,t&&pR(t,"normal"),new ER(!0,e)},_=function(e){return l?(sR(e),f?E(e[0],e[1],m):E(e[0],e[1])):f?E(e,m):E(e)};if(h)n=e.iterator;else if(p)n=e;else{if(!(i=hR(e)))throw new fR(aR(e)+" is not iterable");if(cR(i)){for(o=0,s=uR(e);s>o;o++)if((a=_(e[o]))&&dR(mR,a))return a;return new ER(!1)}n=lR(e,i)}for(c=h?e.next:n.next;!(u=oR(c,n)).done;){var T=u.value;try{a=_(T)}catch(e){if(!n)throw e;pR(n,"throw",e)}if("object"==typeof a&&a&&dR(mR,a))return a}return new ER(!1)},TR=ed,gR=du,SR=Ko,RR=Jm,vR=A_,yR=function(e,t,r){for(var n=RS(t),i=yS.f,o=vS.f,s=0;s<n.length;s++){var a=n[s];SS(e,a)||r&&SS(r,a)||i(e,a,o(t,a))}},AR=Zh,bR=qc,OR=gs,IR=function(e,t){AS(t)&&"cause"in t&&bS(e,"cause",t.cause)},CR=function(e,t,r,n){MS&&(US?US(e,t):LS(e,"stack",kS(r,n)))},wR=_R,NR=function(e,t){return void 0===e?arguments.length<2?"":t:TR(e)},PR=Za("toStringTag"),DR=Error,LR=[].push,kR=function(e,t){var r,n=SR(MR,this);vR?r=vR(new DR,n?RR(this):MR):(r=n?this:AR(MR),bR(r,PR,"Error")),void 0!==t&&bR(r,"message",NR(t)),CR(r,kR,r.stack,1),arguments.length>2&&IR(r,arguments[2]);var i=[];return wR(e,LR,{that:i}),bR(r,"errors",i),r};vR?vR(kR,DR):yR(kR,DR,{name:!0});var MR=kR.prototype=AR(DR.prototype,{constructor:OR(1,kR),message:OR(1,""),name:OR(1,"AggregateError")});gR({global:!0,constructor:!0,arity:2},{AggregateError:kR});var UR,xR,VR,FR,BR=Fs,jR=up,GR=us,WR=Za("species"),HR=Ko,KR=TypeError,YR=function(e,t){if(HR(t,e))return e;throw new KR("Incorrect invocation")},XR=Fl,ZR=aa,zR=TypeError,JR=Vc,QR=function(e){if(XR(e))return e;throw new zR(ZR(e)+" is not a constructor")},qR=bs,$R=Za("species"),ev=function(e,t){var r,n=JR(e).constructor;return void 0===n||qR(r=JR(n)[$R])?t:QR(r)},tv=TypeError,rv=function(e,t){if(e<t)throw new tv("Not enough arguments");return e},nv=Gs,iv=/ipad|iphone|ipod/i.test(nv)&&/applewebkit/i.test(nv),ov=Xo,sv=qo,av=Dc,cv=as,uv=ka,dv=Vo,lv=Ph,hv=$h,pv=cc,fv=rv,Ev=iv,mv=Og,_v=ov.setImmediate,Tv=ov.clearImmediate,gv=ov.process,Sv=ov.Dispatch,Rv=ov.Function,vv=ov.MessageChannel,yv=ov.String,Av=0,bv={},Ov="onreadystatechange";dv((function(){UR=ov.location}));var Iv=function(e){if(uv(bv,e)){var t=bv[e];delete bv[e],t()}},Cv=function(e){return function(){Iv(e)}},wv=function(e){Iv(e.data)},Nv=function(e){ov.postMessage(yv(e),UR.protocol+"//"+UR.host)};_v&&Tv||(_v=function(e){fv(arguments.length,1);var t=cv(e)?e:Rv(e),r=hv(arguments,1);return bv[++Av]=function(){sv(t,void 0,r)},xR(Av),Av},Tv=function(e){delete bv[e]},mv?xR=function(e){gv.nextTick(Cv(e))}:Sv&&Sv.now?xR=function(e){Sv.now(Cv(e))}:vv&&!Ev?(FR=(VR=new vv).port2,VR.port1.onmessage=wv,xR=av(FR.postMessage,FR)):ov.addEventListener&&cv(ov.postMessage)&&!ov.importScripts&&UR&&"file:"!==UR.protocol&&!dv(Nv)?(xR=Nv,ov.addEventListener("message",wv,!1)):xR=Ov in pv("script")?function(e){lv.appendChild(pv("script"))[Ov]=function(){lv.removeChild(this),Iv(e)}}:function(e){setTimeout(Cv(e),0)});var Pv={set:_v,clear:Tv},Dv=Xo,Lv=us,kv=Object.getOwnPropertyDescriptor,Mv=function(e){if(!Lv)return Dv[e];var t=kv(Dv,e);return t&&t.value},Uv=function(){this.head=null,this.tail=null};Uv.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var xv,Vv,Fv,Bv,jv,Gv=Uv,Wv=/ipad|iphone|ipod/i.test(Gs)&&"undefined"!=typeof Pebble,Hv=/web0s(?!.*chrome)/i.test(Gs),Kv=Xo,Yv=Mv,Xv=Dc,Zv=Pv.set,zv=Gv,Jv=iv,Qv=Wv,qv=Hv,$v=Og,ey=Kv.MutationObserver||Kv.WebKitMutationObserver,ty=Kv.document,ry=Kv.process,ny=Kv.Promise,iy=Yv("queueMicrotask");if(!iy){var oy=new zv,sy=function(){var e,t;for($v&&(e=ry.domain)&&e.exit();t=oy.get();)try{t()}catch(e){throw oy.head&&xv(),e}e&&e.enter()};Jv||$v||qv||!ey||!ty?!Qv&&ny&&ny.resolve?((Bv=ny.resolve(void 0)).constructor=ny,jv=Xv(Bv.then,Bv),xv=function(){jv(sy)}):$v?xv=function(){ry.nextTick(sy)}:(Zv=Xv(Zv,Kv),xv=function(){Zv(sy)}):(Vv=!0,Fv=ty.createTextNode(""),new ey(sy).observe(Fv,{characterData:!0}),xv=function(){Fv.data=Vv=!Vv}),iy=function(e){oy.head||xv(),oy.add(e)}}var ay=iy,cy=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},uy=Xo.Promise,dy=Xo,ly=uy,hy=as,py=Cc,fy=Ol,Ey=Za,my=bg,_y=zs,Ty=ly&&ly.prototype,gy=Ey("species"),Sy=!1,Ry=hy(dy.PromiseRejectionEvent),vy=py("Promise",(function(){var e=fy(ly),t=e!==String(ly);if(!t&&66===_y)return!0;if(!Ty.catch||!Ty.finally)return!0;if(!_y||_y<51||!/native code/.test(e)){var r=new ly((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[gy]=n,!(Sy=r.then((function(){}))instanceof n))return!0}return!(t||"BROWSER"!==my&&"DENO"!==my||Ry)})),yy={CONSTRUCTOR:vy,REJECTION_EVENT:Ry,SUBCLASSING:Sy},Ay={},by=la,Oy=TypeError,Iy=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw new Oy("Bad Promise constructor");t=e,r=n})),this.resolve=by(t),this.reject=by(r)};Ay.f=function(e){return new Iy(e)};var Cy,wy,Ny,Py=du,Dy=Og,Ly=Xo,ky=ks,My=hs,Uy=ap,xy=Lp,Vy=function(e){var t=BR(e);GR&&t&&!t[WR]&&jR(t,WR,{configurable:!0,get:function(){return this}})},Fy=la,By=as,jy=Ls,Gy=YR,Wy=ev,Hy=Pv.set,Ky=ay,Yy=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},Xy=cy,Zy=Gv,zy=zp,Jy=uy,Qy=yy,qy=Ay,$y="Promise",eA=Qy.CONSTRUCTOR,tA=Qy.REJECTION_EVENT,rA=zy.getterFor($y),nA=zy.set,iA=Jy&&Jy.prototype,oA=Jy,sA=iA,aA=Ly.TypeError,cA=Ly.document,uA=Ly.process,dA=qy.f,lA=dA,hA=!!(cA&&cA.createEvent&&Ly.dispatchEvent),pA="unhandledrejection",fA=function(e){var t;return!(!jy(e)||!By(t=e.then))&&t},EA=function(e,t){var r,n,i,o=t.value,s=1===t.state,a=s?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{a?(s||(2===t.rejection&&SA(t),t.rejection=1),!0===a?r=o:(d&&d.enter(),r=a(o),d&&(d.exit(),i=!0)),r===e.promise?u(new aA("Promise-chain cycle")):(n=fA(r))?My(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},mA=function(e,t){e.notified||(e.notified=!0,Ky((function(){for(var r,n=e.reactions;r=n.get();)EA(r,e);e.notified=!1,t&&!e.rejection&&TA(e)})))},_A=function(e,t,r){var n,i;hA?((n=cA.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),Ly.dispatchEvent(n)):n={promise:t,reason:r},!tA&&(i=Ly["on"+e])?i(n):e===pA&&Yy("Unhandled promise rejection",r)},TA=function(e){My(Hy,Ly,(function(){var t,r=e.facade,n=e.value;if(gA(e)&&(t=Xy((function(){Dy?uA.emit("unhandledRejection",n,r):_A(pA,r,n)})),e.rejection=Dy||gA(e)?2:1,t.error))throw t.value}))},gA=function(e){return 1!==e.rejection&&!e.parent},SA=function(e){My(Hy,Ly,(function(){var t=e.facade;Dy?uA.emit("rejectionHandled",t):_A("rejectionhandled",t,e.value)}))},RA=function(e,t,r){return function(n){e(t,n,r)}},vA=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,mA(e,!0))},yA=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new aA("Promise can't be resolved itself");var n=fA(t);n?Ky((function(){var r={done:!1};try{My(n,t,RA(yA,r,e),RA(vA,r,e))}catch(t){vA(r,t,e)}})):(e.value=t,e.state=1,mA(e,!1))}catch(t){vA({done:!1},t,e)}}};eA&&(sA=(oA=function(e){Gy(this,sA),Fy(e),My(Cy,this);var t=rA(this);try{e(RA(yA,t),RA(vA,t))}catch(e){vA(t,e)}}).prototype,(Cy=function(e){nA(this,{type:$y,done:!1,notified:!1,parent:!1,reactions:new Zy,rejection:!1,state:0,value:null})}).prototype=Uy(sA,"then",(function(e,t){var r=rA(this),n=dA(Wy(this,oA));return r.parent=!0,n.ok=!By(e)||e,n.fail=By(t)&&t,n.domain=Dy?uA.domain:void 0,0===r.state?r.reactions.add(n):Ky((function(){EA(n,r)})),n.promise})),wy=function(){var e=new Cy,t=rA(e);this.promise=e,this.resolve=RA(yA,t),this.reject=RA(vA,t)},qy.f=dA=function(e){return e===oA||e===Ny?new wy(e):lA(e)}),Py({global:!0,constructor:!0,wrap:!0,forced:eA},{Promise:oA}),Ny=ky.Promise,xy(oA,$y,!1,!0),Vy($y);var AA=Za("iterator"),bA=!1;try{var OA=0,IA={next:function(){return{done:!!OA++}},return:function(){bA=!0}};IA[AA]=function(){return this},Array.from(IA,(function(){throw 2}))}catch(e){}var CA=function(e,t){try{if(!t&&!bA)return!1}catch(e){return!1}var r=!1;try{var n={};n[AA]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},wA=uy,NA=yy.CONSTRUCTOR||!CA((function(e){wA.all(e).then(void 0,(function(){}))})),PA=hs,DA=la,LA=Ay,kA=cy,MA=_R;du({target:"Promise",stat:!0,forced:NA},{all:function(e){var t=this,r=LA.f(t),n=r.resolve,i=r.reject,o=kA((function(){var r=DA(t.resolve),o=[],s=0,a=1;MA(e,(function(e){var c=s++,u=!1;a++,PA(r,t,e).then((function(e){u||(u=!0,o[c]=e,--a||n(o))}),i)})),--a||n(o)}));return o.error&&i(o.value),r.promise}});var UA=du,xA=yy.CONSTRUCTOR;uy&&uy.prototype,UA({target:"Promise",proto:!0,forced:xA,real:!0},{catch:function(e){return this.then(void 0,e)}});var VA=hs,FA=la,BA=Ay,jA=cy,GA=_R;du({target:"Promise",stat:!0,forced:NA},{race:function(e){var t=this,r=BA.f(t),n=r.reject,i=jA((function(){var i=FA(t.resolve);GA(e,(function(e){VA(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var WA=Ay;du({target:"Promise",stat:!0,forced:yy.CONSTRUCTOR},{reject:function(e){var t=WA.f(this);return(0,t.reject)(e),t.promise}});var HA=Vc,KA=Ls,YA=Ay,XA=function(e,t){if(HA(e),KA(t)&&t.constructor===e)return t;var r=YA.f(e);return(0,r.resolve)(t),r.promise},ZA=du,zA=uy,JA=yy.CONSTRUCTOR,QA=XA,qA=Fs("Promise"),$A=!JA;ZA({target:"Promise",stat:!0,forced:true},{resolve:function(e){return QA($A&&this===qA?zA:this,e)}});var eb=hs,tb=la,rb=Ay,nb=cy,ib=_R;du({target:"Promise",stat:!0,forced:NA},{allSettled:function(e){var t=this,r=rb.f(t),n=r.resolve,i=r.reject,o=nb((function(){var r=tb(t.resolve),i=[],o=0,s=1;ib(e,(function(e){var a=o++,c=!1;s++,eb(r,t,e).then((function(e){c||(c=!0,i[a]={status:"fulfilled",value:e},--s||n(i))}),(function(e){c||(c=!0,i[a]={status:"rejected",reason:e},--s||n(i))}))})),--s||n(i)}));return o.error&&i(o.value),r.promise}});var ob=hs,sb=la,ab=Fs,cb=Ay,ub=cy,db=_R,lb="No one promise resolved";du({target:"Promise",stat:!0,forced:NA},{any:function(e){var t=this,r=ab("AggregateError"),n=cb.f(t),i=n.resolve,o=n.reject,s=ub((function(){var n=sb(t.resolve),s=[],a=0,c=1,u=!1;db(e,(function(e){var d=a++,l=!1;c++,ob(n,t,e).then((function(e){l||u||(u=!0,i(e))}),(function(e){l||u||(l=!0,s[d]=e,--c||o(new r(s,lb)))}))})),--c||o(new r(s,lb))}));return s.error&&o(s.value),n.promise}});var hb=du,pb=qo,fb=$h,Eb=Ay,mb=la,_b=cy,Tb=Xo.Promise,gb=!1;hb({target:"Promise",stat:!0,forced:!Tb||!Tb.try||_b((function(){Tb.try((function(e){gb=8===e}),8)})).error||!gb},{try:function(e){var t=arguments.length>1?fb(arguments,1):[],r=Eb.f(this),n=_b((function(){return pb(mb(e),void 0,t)}));return(n.error?r.reject:r.resolve)(n.value),r.promise}});var Sb=Ay;du({target:"Promise",stat:!0},{withResolvers:function(){var e=Sb.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}});var Rb=du,vb=uy,yb=Vo,Ab=Fs,bb=as,Ob=ev,Ib=XA,Cb=vb&&vb.prototype;Rb({target:"Promise",proto:!0,real:!0,forced:!!vb&&yb((function(){Cb.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=Ob(this,Ab("Promise")),r=bb(e);return this.then(r?function(r){return Ib(t,e()).then((function(){return r}))}:e,r?function(r){return Ib(t,e()).then((function(){throw r}))}:e)}});var wb=z(ks.Promise);class Nb extends Xn{set _mediaStreamTrack(e){e!==this.mediaStreamTrack&&(this.safeEmit(Bd.TRACK_UPDATED,e),this.mediaStreamTrack=e)}get _mediaStreamTrack(){return this.mediaStreamTrack}constructor(e,t){super(),JT(this,"trackMediaType",void 0),JT(this,"_ID",void 0),JT(this,"_rtpTransceiver",void 0),JT(this,"_lowRtpTransceiver",void 0),JT(this,"_hints",[]),JT(this,"_isClosed",!1),JT(this,"_originMediaStreamTrack",void 0),JT(this,"mediaStreamTrack",void 0),JT(this,"_external",{}),this._ID=t||Ti(8,"track-"),this._originMediaStreamTrack=e,this.mediaStreamTrack=e,wd(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||Ei((()=>{var e;Co.reportApiInvoke(null,{name:Qn.GET_MEDIA_STREAM_TRACK,options:[],tag:qn.TRACER}).onSuccess((null===(e=this._mediaStreamTrack)||void 0===e?void 0:e.label)||"")}),this.mediaStreamTrack.id||this.getTrackId()),this._mediaStreamTrack}getRTCRtpTransceiver(e){return e===xd.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,Nd(this),this.emit(jd.CLOSED),this.removeAllListeners(Bd.SEI_RECEIVED)}_updateRtpTransceiver(e,t){if(t===xd.LOW_STREAM){if(this._lowRtpTransceiver===e)return;this._lowRtpTransceiver=e}else{if(this._rtpTransceiver===e)return;this._rtpTransceiver=e}this.emit(Bd.TRANSCEIVER_UPDATED,e,t)}}class Pb extends Nb{get isExternalTrack(){return this._isExternalTrack}get muted(){return this._muted}get enabled(){return this._enabled}get processorContext(){return this._processorContext}constructor(e,t){super(e,t),JT(this,"_enabled",!0),JT(this,"_muted",!1),JT(this,"_isExternalTrack",!1),JT(this,"_isClosed",!1),JT(this,"_enabledMutex",void 0),JT(this,"processor",void 0),JT(this,"_processorContext",void 0),JT(this,"_handleTrackEnded",(()=>{this.onTrackEnded()})),this._enabledMutex=new Ci("".concat(this.getTrackId())),e.addEventListener("ended",this._handleTrackEnded)}getTrackLabel(){var e,t;return null!==(e=null===(t=this._originMediaStreamTrack)||void 0===t?void 0:t.label)&&void 0!==e?e:""}close(){this._isClosed||(this.stop(),this._originMediaStreamTrack.stop(),this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack.stop(),this._mediaStreamTrack=null),this._originMediaStreamTrack=null,this._enabledMutex=null,ao.debug("[".concat(this.getTrackId(),"] close")),this.emit(Md.NEED_CLOSE),super.close())}async _updateOriginMediaStreamTrack(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._isExternalTrack=r,e!==this._originMediaStreamTrack&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),t&&this._originMediaStreamTrack.stop()),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,this._muted&&(this._originMediaStreamTrack.enabled=!1),this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await ri(this,Md.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){ao.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(jd.TRACK_ENDED)}stateCheck(e,t){if(ao.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),Vn(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new xn(Un.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print("error",ao);if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new xn(Un.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print("error",ao)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():wb.resolve([])}}function Db(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const Lb=window.AudioContext||window.webkitAudioContext;let kb,Mb=null;const Ub=new class extends Xn{constructor(){super(...arguments),JT(this,"prevState",void 0),JT(this,"curState",void 0),JT(this,"currentTime",void 0),JT(this,"currentTimeStuckAt",void 0),JT(this,"interruptDetectorTrack",void 0),JT(this,"onLocalAudioTrackMute",(()=>{ao.info("ios15-interruption-start"),this.emit(xo.IOS_15_16_INTERRUPTION_START)})),JT(this,"onLocalAudioTrackUnmute",(async()=>{ao.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?ao.info("ios15-interruption-end-canceled"):(Mb&&await Mb.suspend(),this.emit(xo.IOS_15_16_INTERRUPTION_END))}))}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){ao.debug("webaudio bindInterruptDetectorTrack ".concat(e.getTrackId())),this.interruptDetectorTrack||(this.interruptDetectorTrack=e,this.interruptDetectorTrack._mediaStreamTrack.onmute=this.onLocalAudioTrackMute,this.interruptDetectorTrack._mediaStreamTrack.onunmute=this.onLocalAudioTrackUnmute)}unbindInterruptDetectorTrack(e){ao.debug("webaudio unbindInterruptDetectorTrack ".concat(e.getTrackId())),this.interruptDetectorTrack&&this.interruptDetectorTrack===e&&(this.interruptDetectorTrack._mediaStreamTrack&&(this.interruptDetectorTrack._mediaStreamTrack.onmute=null,this.interruptDetectorTrack._mediaStreamTrack.onunmute=null),this.interruptDetectorTrack=void 0)}};function xb(){if(!Lb)return void ao.error("your browser is not support web audio");ao.info("create audio context");const e=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Db(Object(r),!0).forEach((function(t){JT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Db(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},Hi("WEBAUDIO_INIT_OPTIONS"));ao.debug("audio context init option:",JSON.stringify(e)),Mb=new Lb(e),Ub.curState=Mb.state,Mb.onstatechange=()=>{Ub.prevState=Ub.curState,Ub.curState=Mb?Mb.state:void 0;const e=Ub.prevState,t=Ub.curState,r="running"===t,n="interrupted"===t,i="running"===e,o="suspended"===e,s="interrupted"===e,a=an().osVersion;(mn()||bn())&&i&&n&&(ao.info("ios".concat(a,"-interruption-start")),Ub.emit(xo.IOS_INTERRUPTION_START)),(mn()||bn())&&(o||s)&&r&&(ao.info("ios".concat(a,"-interruption-end")),Ub.emit(xo.IOS_INTERRUPTION_END)),e!==t&&Ub.emit(xo.STATE_CHANGE,t,e)},setInterval((()=>{var e;const t=null===(e=Mb)||void 0===e?void 0:e.currentTime;if(Ub.currentTime!==t)Ub.currentTimeStuckAt&&(ao.debug("AudioContext current time resume at ".concat(t)),Ub.currentTimeStuckAt=void 0),Ub.currentTime=t;else{if(t!==Ub.currentTimeStuckAt){Co.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:qn.TRACER}).onSuccess(),ao.warning("AudioContext current time stuck at ".concat(t))}Ub.currentTimeStuckAt=t}}),5e3),async function(e){const t=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","touchend","keydown","keyup"];let r,n=!1,i=!1,o=!1;function s(t){"running"===e.state?a(!1):mn()||bn()?"suspended"===e.state&&(a(!0),t&&e.resume().then(u,u)):"closed"!==e.state&&(a(!0),t&&e.resume().then(u,u))}function a(e){if(n!==e){n=e;for(let r=0,n=t;r<n.length;r+=1){const t=n[r];e?window.addEventListener(t,d,{capture:!0,passive:!0}):window.removeEventListener(t,d,{capture:!0,passive:!0})}}}function c(){s(!0)}function u(){s(!1)}function d(){s(!0)}function l(){let e;try{e=r.play(),e?e.then(f,f):(r.addEventListener("playing",f),r.addEventListener("abort",f),r.addEventListener("error",f))}catch(e){f()}}function h(e){o||(r.paused?e?(p(!1),o=!0,l()):p(!0):p(!1))}function p(e){if(i!==e){i=e;for(let r=0,n=t;r<n.length;r++){const t=n[r];e?window.addEventListener(t,E,{capture:!0,passive:!0}):window.removeEventListener(t,E,{capture:!0,passive:!0})}}}function f(){r.removeEventListener("playing",f),r.removeEventListener("abort",f),r.removeEventListener("error",f),o=!1,h(!1)}function E(){h(!0)}let m;if(mn()&&Hi("IOS_BG_TAG")){const t=e.createMediaStreamDestination(),n=document.createElement("div");n.innerHTML="<audio x-webkit-airplay='deny'></audio>",r=n.children.item(0),r.controls=!1,r.disableRemotePlayback=!0,r.preload="auto",r.srcObject=t.stream,m=()=>{if(Hi("IOS_AUTO_RESTART_BG_TAG")&&r&&r.srcObject&&!o&&(!r.paused||!0!==i)){r.paused||r.pause();try{o=!0,l()}catch(e){o=!1}return!0}},h(!0)}return Ub.on(xo.STATE_CHANGE,c),s(!1),m}(Mb).then((e=>{kb=e}))}function Vb(){if(kb){if(kb()){Co.reportApiInvoke(null,{name:"BG_AUDIO_TAG_RESTART",options:{},tag:qn.TRACER}).onSuccess(),ao.debug("restart background audio tag success")}}}function Fb(){if(!Mb){if(xb(),!Mb)throw new xn(Un.NOT_SUPPORTED,"can not create audio context");return Mb}return Mb}function Bb(){return!!Mb}function jb(e){if(function(){if(null!==Wb)return Wb;const e=Fb(),t=e.createBufferSource(),r=e.createGain(),n=e.createGain();t.connect(r),t.connect(n),t.disconnect(r);let i=!1;try{t.disconnect(r)}catch(e){i=!0}return t.disconnect(),Wb=i,i}())return;const t=e.connect,r=e.disconnect;e.connect=(r,n,i)=>{var o;return e._inputNodes||(e._inputNodes=[]),Ed(o=e._inputNodes).call(o,r)||(r instanceof AudioNode?(e._inputNodes.push(r),t.call(e,r,n,i)):t.call(e,r,n)),e},e.disconnect=(n,i,o)=>{r.call(e),n?di(e._inputNodes,n):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function Gb(e){const t=Fb();return new wb(((r,n)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{n(new xn(Un.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let Wb=null;let Hb=null;function Kb(e){for(let t=0;t<e.outputBuffer.numberOfChannels;t+=1){const r=e.outputBuffer.getChannelData(t);for(let e=0;e<r.length;e+=1)r[e]=0}return e.inputBuffer}var Yb=z(Lg);class Xb{constructor(){JT(this,"context",void 0),JT(this,"analyserNode",void 0),JT(this,"sourceNode",void 0),this.context=Fb(),this.analyserNode=this.context.createAnalyser(),this.analyserNode.fftSize=2048,this.analyserNode.smoothingTimeConstant=.4}updateSource(e){if(e!==this.sourceNode){if(this.sourceNode)try{this.sourceNode.disconnect(this.analyserNode)}catch(e){}this.sourceNode=e,null==e||e.connect(this.analyserNode)}}getVolumeLevel(){if(!this.sourceNode)return 0;if(!this.context||mn()||bn()||"running"!==this.context.state&&this.context.resume(),!this.analyserNode)return 0;const e=new Float32Array(this.analyserNode.fftSize);if(this.analyserNode.getFloatTimeDomainData)this.analyserNode.getFloatTimeDomainData(e);else{const t=new Uint8Array(this.analyserNode.fftSize);this.analyserNode.getByteTimeDomainData(t);for(let r=0;r<e.length;++r)e[r]=t[r]/128-1}const t=Yb(e).call(e,((e,t)=>e+t*t),0)/e.length;return Math.max(10*Math.log10(t)+100,0)/100}getAnalyserNode(){return this.analyserNode}rebuildAnalyser(){try{var e,t;null===(e=this.sourceNode)||void 0===e||e.disconnect(this.analyserNode),this.analyserNode=this.context.createAnalyser(),this.analyserNode.fftSize=2048,this.analyserNode.smoothingTimeConstant=.4,null===(t=this.sourceNode)||void 0===t||t.connect(this.analyserNode)}catch(e){ao.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class Zb extends Xn{get processSourceNode(){return this.sourceNode}set processedNode(e){var t;if(!this.isDestroyed&&this._processedNode!==e){try{var r;null===(r=this.sourceNode)||void 0===r||r.disconnect(this.outputNode)}catch(e){}null===(t=this._processedNode)||void 0===t||t.disconnect(),this._processedNode=e,this.connect()}}get processedNode(){return this._processedNode}constructor(){super(),JT(this,"outputNode",void 0),JT(this,"outputTrack",void 0),JT(this,"isPlayed",!1),JT(this,"sourceNode",void 0),JT(this,"context",void 0),JT(this,"audioBufferNode",void 0),JT(this,"destNode",void 0),JT(this,"audioOutputLevel",0),JT(this,"volumeLevelAnalyser",void 0),JT(this,"_processedNode",void 0),JT(this,"playNode",void 0),JT(this,"isDestroyed",!1),JT(this,"onNoAudioInput",void 0),JT(this,"isNoAudioInput",!1),JT(this,"_noAudioInputCount",0),this.context=Fb(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),jb(this.outputNode),this.volumeLevelAnalyser=new Xb}startGetAudioBuffer(e){this.audioBufferNode||(this.audioBufferNode=this.context.createScriptProcessor(e),this.outputNode.connect(this.audioBufferNode),this.audioBufferNode.connect(this.context.destination),this.audioBufferNode.onaudioprocess=e=>{this.emit(Hd.ON_AUDIO_BUFFER,Kb(e))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!Po().webAudioMediaStreamDest)throw new xn(Un.NOT_SUPPORTED,"your browser is not support audio processor");return this.destNode&&this.outputTrack||(this.destNode=this.context.createMediaStreamDestination(),this.outputNode.connect(this.destNode),this.outputTrack=this.destNode.stream.getAudioTracks()[0]),this.outputTrack}play(e){"running"!==this.context.state&&li((()=>{Ub.emit("autoplay-failed")})),this.isPlayed=!0,this.playNode=e||this.context.destination,this.outputNode.connect(this.playNode)}stop(){if(this.isPlayed)try{this.outputNode.disconnect(this.playNode)}catch(e){}this.isPlayed=!1}getAccurateVolumeLevel(){return this.volumeLevelAnalyser.getVolumeLevel()}async checkHasAudioInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(e>5)return this.isNoAudioInput=!0,this.onNoAudioInput&&this.onNoAudioInput(),!1;mn()||bn()?"suspended"===this.context.state&&this.context.resume():"running"!==this.context.state&&this.context.resume();const t=this.volumeLevelAnalyser.getAnalyserNode();let r;t.getFloatTimeDomainData?(r=new Float32Array(t.fftSize),t.getFloatTimeDomainData(r)):(r=new Uint8Array(t.fftSize),t.getByteTimeDomainData(r));let n=!1;for(let e=0;e<r.length;e++)0!==r[e]&&(n=!0);return n?(this.isNoAudioInput=!1,!0):(await _i(200),await this.checkHasAudioInput(e?e+1:1)&&n)}getAudioVolume(){return this.outputNode.gain.value}setVolume(e){this.outputNode.gain.setValueAtTime(e,this.context.currentTime)}destroy(){this.disconnect(),this.stop(),this.isDestroyed=!0,this.onNoAudioInput=void 0}disconnect(){var e,t;null===(e=this.processedNode)||void 0===e||e.disconnect(),null===(t=this.sourceNode)||void 0===t||t.disconnect(),this.outputNode&&this.outputNode.disconnect()}connect(){var e;this.processedNode?null===(e=this.processedNode)||void 0===e||e.connect(this.outputNode):this.sourceNode&&this.sourceNode.connect(this.outputNode);this.volumeLevelAnalyser.updateSource(this.outputNode)}}class zb extends Zb{get isFreeze(){return!1}constructor(e,t,r){var n;if(super(),JT(this,"sourceNode",void 0),JT(this,"track",void 0),JT(this,"clonedTrack",void 0),JT(this,"audioElement",void 0),JT(this,"isCurrentTrackCloned",!1),JT(this,"isRemoteTrack",!1),JT(this,"originVolumeLevelAnalyser",void 0),JT(this,"rebuildWebAudio",(async()=>{if(ao.debug("ready to rebuild web audio, state:",this.context.state),this.isNoAudioInput&&await this.checkHasAudioInput(),!this.isNoAudioInput||this.isDestroyed)return document.body.removeEventListener("click",this.rebuildWebAudio,!0),void ao.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>ao.info("resume success"))),ao.debug("rebuild web audio because of ios 12 bugs"),this.disconnect();const e=this.track;this.track=this.track.clone(),this.isCurrentTrackCloned?e.stop():this.isCurrentTrackCloned=!0;const t=new MediaStream([this.track]);this.sourceNode=this.context.createMediaStreamSource(t),jb(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const r=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(r,this.context.currentTime),jb(this.outputNode),this.emit(Hd.UPDATE_SOURCE),this.connect(),this.audioElement.srcObject=t,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()})),"audio"!==e.kind)throw new xn(Un.UNEXPECTED_ERROR);this.track=e;const i=new MediaStream([this.track]);if(this.isRemoteTrack=!!t,this.sourceNode=this.context.createMediaStreamSource(i),jb(this.sourceNode),r){const e=r.clone();e.enabled=!0,this.clonedTrack=e,ao.debug("create an unmuted track ".concat(e.id," from the original track ").concat(r.id," to get the volume"));const t=this.context.createMediaStreamSource(new MediaStream([e]));jb(t),this.originVolumeLevelAnalyser=new Xb,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=i;const o=an();t&&o.os===tn.IOS&&Number(null===(n=o.osVersion)||void 0===n?void 0:n.split(".")[0])<15&&(Ub.on(xo.STATE_CHANGE,(()=>{"suspended"===this.context.state?document.body.addEventListener("click",this.rebuildWebAudio,!0):"running"===this.context.state&&this.rebuildWebAudio()})),this.checkHasAudioInput().then((e=>{e||document.body.addEventListener("click",this.rebuildWebAudio,!0)})))}updateTrack(e){this.sourceNode.disconnect(),this.track=e,this.isCurrentTrackCloned=!1;const t=new MediaStream([e]);this.sourceNode=this.context.createMediaStreamSource(t),jb(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(Hd.UPDATE_SOURCE),this.audioElement.srcObject=t}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),Ub.off("state-change",this.rebuildWebAudio),null===(e=this.originVolumeLevelAnalyser)||void 0===e||e.destroy(),this.clonedTrack=void 0,super.destroy()}createMediaStreamSourceNode(e){return this.context.createMediaStreamSource(new MediaStream([e]))}updateOriginTrack(e){const t=e.clone();t.enabled=!0,this.clonedTrack&&(this.clonedTrack.stop(),this.clonedTrack=t),ao.debug("create an unmuted track ".concat(t.id," from the original track ").concat(e.id," to get the volume"));const r=this.context.createMediaStreamSource(new MediaStream([t]));jb(r),this.originVolumeLevelAnalyser&&this.originVolumeLevelAnalyser.updateSource(r)}getOriginVolumeLevel(){return this.originVolumeLevelAnalyser?this.originVolumeLevelAnalyser.getVolumeLevel():this.getAccurateVolumeLevel()}}async function Jb(e,t,r){const n=(e,t)=>e?"number"!=typeof e?e.max||e.exact||e.ideal||e.min||t:e:t,i={audio:!!r&&{mandatory:{chromeMediaSource:"desktop"}},video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxHeight:n(t.height,1080),maxWidth:n(t.width,1920)}}};return t.frameRate&&"number"!=typeof t.frameRate?(i.video.mandatory.maxFrameRate=t.frameRate.max,i.video.mandatory.minFrameRate=t.frameRate.min):"number"==typeof t.frameRate&&(i.video.mandatory.maxFrameRate=t.frameRate),await navigator.mediaDevices.getUserMedia(i)}async function Qb(e,t){const r=await qb(e.mediaSource),n=await function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(((r,n)=>{const i=document.createElement("div");i.innerText="share screen",i.setAttribute("style","text-align: center; height: 25px; line-height: 25px; border-radius: 4px 4px 0 0; background: #D4D2D4; border-bottom: solid 1px #B9B8B9;");const o=document.createElement("div");o.setAttribute("style","width: 100%; height: 500px; padding: 15px 25px ; box-sizing: border-box;");const s=document.createElement("div");s.innerText="Agora Web Screensharing wants to share the contents of your screen with webdemo.agorabeckon.com. Choose what you'd like to share.",s.setAttribute("style","height: 12%;");const a=document.createElement("div");a.setAttribute("style","width: 100%; height: 80%; background: #FFF; border: solid 1px #CBCBCB; display: flex; flex-wrap: wrap; justify-content: space-around; overflow-y: scroll; padding: 0 15px; box-sizing: border-box;");const c=document.createElement("div");c.setAttribute("style","display: flex; justify-content: space-between; padding: 16px 0;");const u=document.createElement("button");u.innerHTML="cancel",u.setAttribute("style","width: 85px;"),u.onclick=()=>{document.body.removeChild(h);const e=new Error("NotAllowedError");e.name="NotAllowedError",n(e)};let d=t;const l=document.createElement("div");if(t){const e=document.createElement("input");e.setAttribute("type","checkbox");const t=document.createElement("span");e.setAttribute("style","margin-right: 6px;"),t.innerText="Share audio",e.checked=d,e.onchange=()=>{d=e.checked},l.appendChild(e),l.appendChild(t)}c.appendChild(l),c.appendChild(u),o.appendChild(s),o.appendChild(a),o.appendChild(c);const h=document.createElement("div");h.setAttribute("style","position: fixed; z-index: 99999999; top: 50%; left: 50%; width: 620px; height: 525px; background: #ECECEC; border-radius: 4px; -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);"),h.appendChild(i),h.appendChild(o),document.body.appendChild(h),e.map((e=>{if(e.id){const t=document.createElement("div");t.setAttribute("style","width: 30%; height: 160px; padding: 20px 0; text-align: center;box-sizing: content-box;");let n=e.thumbnail;try{n.getSize().width>1920&&(n=n.resize({width:1920}))}catch(e){throw e&&e.message.startsWith("Illegal invocation")&&console.error("Operate thumbnail error, please try to set contextIsolation: false. (https://github.com/electron/electron/issues/34953)"),e}t.innerHTML='<div style="height: 120px; display: table-cell; vertical-align: middle;"><img style="width: 100%; background: #333333; box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.2);" src='+n.toDataURL()+' /></div><span style="\theight: 40px; line-height: 40px; display: inline-block; width: 70%; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">'+e.name.replace(/[\u00A0-\u9999<>\&]/g,(function(e){return"&#"+e.charCodeAt(0)+";"}))+"</span>",t.onclick=()=>{document.body.removeChild(h),r({sourceId:e.id,audio:d})},a.appendChild(t)}}))}))}(r,t),i=n.sourceId,o=n.audio;return await Jb(i,e,o)}async function qb(e){let t=["window","screen"];"application"!==e&&"window"!==e||(t=["window"]),"screen"===e&&(t=["screen"]);const r=Jn();if(!r)throw console.error("failed to fetch electron, please mount it to window"),new xn(Un.ELECTRON_IS_NULL);let n=null;try{var i;n=(null===(i=r.desktopCapturer)||void 0===i?void 0:i.getSources({types:t}))||r.ipcRenderer.invoke("DESKTOP_CAPTURER_GET_SOURCES",{types:t})}catch(e){n=null}n&&n.then||(n=new wb(((e,n)=>{r.desktopCapturer.getSources({types:t},((t,r)=>{t?n(t):e(r)}))})));try{return await n}catch(e){throw new xn(Un.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,e.toString())}}function $b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const eO=new Ci("safari");async function tO(e,t){let r=0,n=null;for(;r<2;)try{n=await rO(e,t,r>0);break}catch(e){if(e instanceof xn)throw ao.error("[".concat(t,"] ").concat(e.toString())),e;const n=nO(e.name||e.code||e,e.message);if(n.code===Un.MEDIA_OPTION_INVALID){ao.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await _i(500);continue}throw ao.error("[".concat(t,"] ").concat(n.toString())),n}if(!n)throw new xn(Un.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return n}async function rO(t,r,n){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new xn(Un.NOT_SUPPORTED,"can not find getUserMedia");n&&(t.video&&(delete t.video.width,delete t.video.height),t.screen&&(delete t.screen.width,delete t.screen.height));const i=Po(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return ao.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(Zn())if(t.screen.sourceId){iO(o,await Jb(t.screen.sourceId,t.screen,!!t.screenAudio))}else{iO(o,await Qb(t.screen,!!t.screenAudio))}else if(hn()&&t.screen.extensionId&&t.screen.mandatory){if(!i.getStreamFromExtension)throw new xn(Un.NOT_SUPPORTED,"This browser does not support screen sharing");ao.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(a=t.screen.extensionId,c=r,new wb(((e,t)=>{try{chrome.runtime.sendMessage(a,{getStream:!0},(r=>{if(!r||!r.streamId)return ao.error("[".concat(c,"] No response from Chrome Plugin. Plugin not installed properly"),r),void t(new xn(Un.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)}))}catch(e){ao.error("[".concat(c,"] AgoraRTC screensharing plugin is not accessible(").concat(a,")"),e.toString()),t(new xn(Un.CHROME_PLUGIN_NOT_INSTALL))}})));t.screen.mandatory.chromeMediaSourceId=e;iO(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(i.getDisplayMedia){var s;t.screen.mediaSource&&kd(t.screen.mediaSource);const e={width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate,displaySurface:null!==(s=t.screen.displaySurface)&&void 0!==s?s:"screen"===t.screen.mediaSource?"monitor":t.screen.mediaSource},n=t.screen,i=n.selfBrowserSurface,a=n.surfaceSwitching,c=n.systemAudio,u=n.preferCurrentTab,d=n.windowAudio,l=n.monitorTypeSurfaces,h={selfBrowserSurface:i,surfaceSwitching:a,systemAudio:c,preferCurrentTab:u,windowAudio:d,monitorTypeSurfaces:l};!i&&delete h.selfBrowserSurface,!a&&delete h.surfaceSwitching,!c&&delete h.systemAudio,!u&&delete h.preferCurrentTab,!d&&delete h.windowAudio,!l&&delete h.monitorTypeSurfaces,ao.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:e,audio:t.screenAudio,controls:h}));const p=await navigator.mediaDevices.getDisplayMedia(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$b(Object(r),!0).forEach((function(t){JT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({video:e,audio:t.screenAudio},h));iO(o,p)}else{if(!En())throw ao.error("[".concat(r,"] This browser does not support screenSharing")),new xn(Un.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&kd(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};ao.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));iO(o,await navigator.mediaDevices.getUserMedia(e))}}var a,c;if(!t.video&&!t.audio)return o;let u={video:t.video,audio:t.audio},d=Hi("MEDIA_DEVICE_CONSTRAINTS");if(d)try{"string"==typeof d&&(d=JSON.parse(d)),u=yi(u,d)}catch(e){}ao.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(u)),an();let l,h=null;(pn()||mn()||ln())&&(h=await eO.lock());try{l=await navigator.mediaDevices.getUserMedia(u)}catch(e){throw h&&h(),e}return u.audio&&(e.HAS_GUM_AUDIO=!0),u.video&&(e.HAS_GUM_VIDEO=!0),iO(o,l),h&&h(),o}function nO(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new xn(Un.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new xn(Un.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new xn(Un.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new xn(Un.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new xn(Un.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new xn(Un.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return ao.error("getUserMedia unexpected error",e),new xn(Un.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function iO(e,t){const r=e.getVideoTracks()[0],n=e.getAudioTracks()[0],i=t.getVideoTracks()[0],o=t.getAudioTracks()[0];o&&(n&&e.removeTrack(n),e.addTrack(o)),i&&(r&&e.removeTrack(r),e.addTrack(i))}e.HAS_GUM_AUDIO=!1,e.HAS_GUM_VIDEO=!1;class oO extends Xn{get state(){return this._state}set state(e){e!==this._state&&(this.emit($d.STATE_CHANGE,e),this._state=e)}constructor(){super(),JT(this,"_state",qd.IDLE),JT(this,"isAccessMicrophonePermission",!1),JT(this,"isAccessCameraPermission",!1),JT(this,"lastAccessMicrophonePermission",!1),JT(this,"lastAccessCameraPermission",!1),JT(this,"checkdeviceMatched",!1),JT(this,"deviceInfoMap",new Map),this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(Hi("ENUMERATE_DEVICES_INTERVAL")||(wn()||un()===tn.HARMONY_OS)&&Cn())&&this.updateDevicesInfo()}),Hi("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>ao.error(e.toString())))}async enumerateDevices(t,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)throw new xn(Un.NOT_SUPPORTED,"enumerateDevices() not supported.");const i=await navigator.mediaDevices.enumerateDevices(),o=this.checkMediaDeviceInfoIsOk(i);let s=!this.isAccessMicrophonePermission&&t,a=!this.isAccessCameraPermission&&r;o.audio&&(s=!1),o.video&&(a=!1);let c=null,u=null,d=null;if(!n&&(s||a)){if(eO.isLocked){ao.debug("[device manager] wait GUM lock");(await eO.lock())(),ao.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(s=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(a=!1,this.isAccessCameraPermission=!0),ao.debug("[device manager] check media device permissions",t,r,s,a),s&&a){try{d=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(e){const t=nO(e.name||e.code||e,e.message);if(t.code===Un.PERMISSION_DENIED)throw t;ao.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0,this.isAccessMicrophonePermission=!0}else if(s){try{c=await navigator.mediaDevices.getUserMedia({audio:t})}catch(e){const t=nO(e.name||e.code||e,e.message);if(t.code===Un.PERMISSION_DENIED)throw t;ao.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(a){try{u=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=nO(e.name||e.code||e,e.message);if(t.code===Un.PERMISSION_DENIED)throw t;ao.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}ao.debug("[device manager] mic permission",t,"cam permission",r)}try{const e=await navigator.mediaDevices.enumerateDevices();return c&&c.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),c=null,u=null,d=null,e}catch(e){c&&c.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),c=null,u=null,d=null;return new xn(Un.ENUMERATE_DEVICES_FAILED,e.toString()).throw()}}async getRecordingDevices(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!0,!1,e)).filter((e=>"audioinput"===e.kind))}async getCamerasDevices(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!1,!0,e)).filter((e=>"videoinput"===e.kind))}async getSpeakers(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!0,!1,e)).filter((e=>"audiooutput"===e.kind))}searchDeviceIdByName(e){let t=null;return this.deviceInfoMap.forEach((r=>{r.device.label===e&&(t=r.device.deviceId)})),t}async getDeviceById(e){const t=(await this.enumerateDevices(!0,!0,!0)).find((t=>t.deviceId===e));if(!t)throw new xn(Un.DEVICE_NOT_FOUND,"deviceId: ".concat(e));return t}async init(){this.state=qd.INITING;try{await this.updateDevicesInfo(),this.state=qd.INITEND}catch(e){if(this.state=qd.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname))throw new xn(Un.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.");throw ao.warning("Device Detection functionality cannot start properly.",e.toString()),e}}async updateDevicesInfo(){const e=await this.enumerateDevices(!0,!0,!0),t=Date.now(),r=[];if(e[0]&&e[0].label&&!1===this.checkdeviceMatched){this.checkdeviceMatched=!0;const t=e.find((e=>"audioinput"===e.kind&&"default"===e.deviceId)),r=e.find((e=>"audiooutput"===e.kind&&"default"===e.deviceId));t&&r?r.groupId===t.groupId?ao.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is the same group")):ao.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is not the same group")):ao.debug("[device-check] default input or output not found")}const n=this.checkMediaDeviceInfoIsOk(e);if(e.forEach((e=>{if(!e.deviceId)return;const n=this.deviceInfoMap.get("".concat(e.kind,"_").concat(e.deviceId));if("ACTIVE"!==(n?n.state:"INACTIVE")){const n={initAt:t,updateAt:t,device:e,state:"ACTIVE"};this.deviceInfoMap.set("".concat(e.kind,"_").concat(e.deviceId),n),r.push(n)}n&&(n.updateAt=t)})),this.deviceInfoMap.forEach(((e,n)=>{"ACTIVE"===e.state&&e.updateAt!==t&&(e.state="INACTIVE",r.push(e))})),this.state!==qd.INITEND)return n.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),void(n.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0));r.forEach((e=>{switch(e.device.kind){case"audioinput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit($d.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit($d.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit($d.PLAYOUT_DEVICE_CHANGED,e)}})),n.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),n.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0)}checkMediaDeviceInfoIsOk(e){const t=e.filter((e=>"audioinput"===e.kind)),r=e.filter((e=>"videoinput"===e.kind)),n={audio:!1,video:!1};for(const e of t)if(e.label&&e.deviceId){n.audio=!0;break}for(const e of r)if(e.label&&e.deviceId){n.video=!0;break}return n}}const sO=new oO;du({target:"Array",stat:!0},{isArray:ll});var aO=z(ks.Array.isArray);var cO=z(YS),uO=Pa,dO=yu,lO=vl,hO=pl;du({target:"Array",proto:!0,arity:1,forced:Vo((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=uO(this),r=dO(t),n=arguments.length;hO(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return lO(t,r),r}});var pO=Uu("Array","push"),fO=Ko,EO=pO,mO=Array.prototype,_O=function(e){var t=e.push;return e===mO||fO(mO,e)&&t===mO.push?EO:t},TO=z(_O);var gO=Vc,SO=nR,RO=Dc,vO=hs,yO=Pa,AO=function(e,t,r,n){try{return n?t(gO(r)[0],r[1]):t(r)}catch(t){SO(e,"throw",t)}},bO=BS,OO=Fl,IO=yu,CO=_l,wO=vl,NO=$S,PO=YS,DO=nR,LO=Array,kO=function(e){var t=OO(this),r=arguments.length,n=r>1?arguments[1]:void 0,i=void 0!==n;i&&(n=RO(n,r>2?arguments[2]:void 0));var o,s,a,c,u,d,l=yO(e),h=PO(l),p=0;if(!h||this===LO&&bO(h))for(o=IO(l),s=t?new this(o):LO(o);o>p;p++)d=i?n(l[p],p):l[p],CO(s,p,d);else for(s=t?new this:[],u=(c=NO(l,h)).next;!(a=vO(u,c)).done;p++){d=i?AO(c,n,[a.value,p],!0):a.value;try{CO(s,p,d)}catch(e){DO(c,"throw",e)}}return wO(s,p),s},MO=kO;du({target:"Array",stat:!0,forced:!CA((function(e){Array.from(e)}))},{from:MO});var UO=z(ks.Array.from);function xO(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function VO(e,t){return function(e){if(aO(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==CT&&cO(e)||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(TO(a).call(a,n.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||function(e,t){var r;if(e){if("string"==typeof e)return xO(e,t);var n=hS(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?UO(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?xO(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let FO=!1;const BO=new class extends Xn{constructor(){super(...arguments),JT(this,"onAutoplayFailed",void 0),JT(this,"onAudioAutoplayFailed",void 0)}};function jO(){if(FO)return Hi("FLS_AUTOPLAY_EMITS")?(BO.onAutoplayFailed&&BO.onAutoplayFailed(),BO.emit("autoplay-failed")):void 0;{const e=t=>{t.preventDefault(),function(){try{const e=Fb();"running"!==e.state&&e.resume().catch((e=>{var t;ao.warning("resume web audio context on autoplay gesture failed",(null==e||null===(t=e.toString)||void 0===t?void 0:t.call(e))||e)}))}catch(t){var e;ao.warning("create web audio context on autoplay gesture failed",(null==t||null===(e=t.toString)||void 0===e?void 0:e.call(t))||t)}}(),FO=!1,Nn()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};FO=!0,Nn()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),ao.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),BO.onAutoplayFailed?BO.onAutoplayFailed():BO.onAudioAutoplayFailed?ao.warning("AgoraRTC.onAudioAutoplayFailed has been deprecated in favor of AgoraRTC.onAutoplayFailed.\n\n Please refer to the Agora document to migrate the newer API, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web ."):ao.warning("We have detected a media autoplay failed event, and found out that you haven't implemented AgoraRTC.onAutoplayFailed callback yet.\n\n It will cause audio/video element not playing automatically on some browsers without user interaction, possibly hurting user experiences.\n\n Please refer to the Agora document to properly handle autoplay failed event, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web ."),BO.emit("autoplay-failed")}}function GO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function WO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?GO(Object(r),!0).forEach((function(t){JT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):GO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function HO(e,t,r,n){if(!e)return;const i=Co.getBaseInfoBySessionId(e);if(!i)return;const o=i.info,s=Date.now(),a=WO(WO({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-i.startTime,cbRegistered:BO.onAutoplayFailed||BO.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:n,extend:void 0});Co.send({type:fo.AUTOPLAY_FAILED,data:a},!0)}const KO=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],YO=new class{constructor(){JT(this,"onAutoplayFailed",void 0),JT(this,"elementMap",new Map),JT(this,"elementStateMap",new Map),JT(this,"elementsNeedToResume",[]),JT(this,"sinkIdMap",new Map),JT(this,"elementIdMap",new WeakMap),JT(this,"autoResumeAfterInterruption",(e=>wb.all(Array.from(this.elementMap.entries()).map((async t=>{let r=VO(t,2),n=r[0],i=r[1];const o=this.elementStateMap.get(n),s=i.srcObject.getAudioTracks()[0],a=s&&s.readyState;if(ao.debug("resume after interrupted, ele: ".concat(o," audio: ").concat(a," ").concat(e)),"live"===a){if(e)return i.pause(),i.play();if("running"===Ub.curState)return vn()?(i.pause(),i.play()):o&&"paused"===o?i.play():void 0}}))))),JT(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{Array.from(this.elementMap.entries()).forEach((e=>{let t=VO(e,2);t[0];let r=t[1];const n=r.srcObject.getAudioTracks()[0];n&&"live"===n.readyState&&(ao.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))})),this.autoResumeAudioElement(),Ub.on(xo.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),Ub.on(xo.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),Ub.on(xo.STATE_CHANGE,(()=>{mn()&&"suspended"===Ub.prevState&&"running"===Ub.curState&&this.autoResumeAfterInterruption()}))}async setSinkID(e,t){const r=this.elementMap.get(e);if(this.sinkIdMap.set(e,t),r)try{await r.setSinkId(t)}catch(e){throw new xn(Un.PERMISSION_DENIED,"can not set sink id: "+e.toString())}}play(e,t,r,n){if(this.elementMap.has(t))return;const i=document.createElement("audio");i.autoplay=!0,i.srcObject=new MediaStream([e]),this.elementIdMap.set(i,{id:t}),this.bindAudioElementEvents(t,i),this.elementMap.set(t,i),this.elementStateMap.set(t,el.INIT),this.setVolume(t,r);const o=this.sinkIdMap.get(t);if(o)try{i.setSinkId(o).catch((e=>{ao.warning("[".concat(t,"] set sink id failed"),e.toString())}))}catch(e){ao.warning("[".concat(t,"] set sink id failed"),e.toString())}const s=i.play();s&&s.then&&s.catch((e=>{n&&HO(n,"audio",e.message,t),ao.warning("audio element play warning",e.toString()),this.elementMap.has(t)&&"NotAllowedError"===e.name&&(ao.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(i),li((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),jO()})))}))}updateTrack(e,t){const r=this.elementMap.get(e);r&&(r.srcObject=new MediaStream([t]))}isPlaying(e){return this.elementMap.has(e)&&"playing"===this.elementStateMap.get(e)}setVolume(e,t){const r=this.elementMap.get(e);r&&(t=Math.max(0,Math.min(100,t)),r.volume=t/100)}getVolume(e){const t=this.elementMap.get(e);return t?t.volume:0}stop(e){const t=this.elementMap.get(e);if(this.sinkIdMap.delete(e),!t)return;const r=this.elementsNeedToResume.indexOf(t);this.elementsNeedToResume.splice(r,1),t.srcObject=null,t.remove(),this.elementMap.delete(e),this.elementStateMap.delete(e)}reuseTrackId(e,t){if(e===t)return;const r=this.elementMap.get(e);if(!r)return;this.elementMap.has(t)&&this.stop(t),this.elementMap.delete(e),this.elementMap.set(t,r);const n=this.elementStateMap.get(e);this.elementStateMap.delete(e),void 0!==n&&this.elementStateMap.set(t,n);const i=this.sinkIdMap.get(e);void 0!==i&&(this.sinkIdMap.delete(e),this.sinkIdMap.set(t,i));const o=this.elementIdMap.get(r);o&&(o.id=t)}bindAudioElementEvents(e,t){KO.forEach((r=>{t.addEventListener(r,(r=>{var n,i;const o=null!==(n=null===(i=this.elementIdMap.get(t))||void 0===i?void 0:i.id)&&void 0!==n?n:e,s=this.elementStateMap.get(o),a="pause"===r.type?"paused":r.type;if(ao.debug("[".concat(o,"] audio-element-status change ").concat(s," => ").concat(a)),"error"===r.type){const e=null==t?void 0:t.error;e&&ao.error("[".concat(o,"] media error, code: ").concat(e.code,", message: ").concat(e.message))}this.elementStateMap.set(o,a)}))}))}getPlayerState(e){return this.elementStateMap.get(e)||"uninit"}autoResumeAudioElement(){const e=()=>{this.elementsNeedToResume.forEach((e=>{e.play().then((e=>{ao.debug("Auto resume audio element success")})).catch((e=>{ao.warning("Auto resume audio element failed!",e)}))})),this.elementsNeedToResume=[]};new Promise((e=>{document.body?e():window.addEventListener("load",(()=>e()))})).then((()=>{Nn()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0))}))}};function XO(){return function(e,t,r){const n=r.value;return"function"==typeof n&&(r.value=function(){this._isClosed&&new xn(Un.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning",ao);for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=n.apply(this,t);return i instanceof wb?new wb(((e,t)=>{i.then(e).catch(t)})):i}),r}}var ZO=Uu("Array","values"),zO=Qu,JO=ka,QO=Ko,qO=ZO,$O=Array.prototype,eI={DOMTokenList:!0,NodeList:!0},tI=function(e){var t=e.values;return e===$O||QO($O,e)&&t===$O.values||JO(eI,zO(e))?qO:t},rI=z(tI);function nI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function iI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nI(Object(r),!0).forEach((function(t){JT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class oI extends Xn{constructor(e){super(),JT(this,"name","VideoProcessorDestination"),JT(this,"ID","0"),JT(this,"_source",void 0),JT(this,"videoContext",void 0),JT(this,"inputTrack",void 0),this.videoContext=e}get kind(){return"video"}get enabled(){return!0}pipe(){throw new xn(Un.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}unpipe(){throw new xn(Un.NOT_SUPPORTED,"VideoProcessor cannot unpipe to any other Processor")}enable(){}disable(){}updateInput(e){if(e.context!==this.videoContext)throw new Error("ProcessorContext passed to VideoTrack.processorDestination doesn't match it's belonging VideoTrack's context.\nProbably you are making pipeline like this:\nvideoTrack1.pipe(processor).pipe(videoTrack2.processorDestination).");e.track&&e.track!==this.inputTrack&&(this.videoContext.chained=!0,this.inputTrack=e.track,this.emit(Jd.ON_TRACK,e.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(Jd.ON_TRACK,void 0)}}class sI extends Xn{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),JT(this,"constraintsMap",new Map),JT(this,"statsRegistry",[]),JT(this,"usageRegistry",[]),JT(this,"trackId",void 0),JT(this,"direction",void 0),JT(this,"_chained",!1),this.trackId=e,this.direction=t}async getConstraints(){return await ti(this,Qd.REQUEST_CONSTRAINTS)}async requestApplyConstraints(e,t){var r;return ao.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),ri(this,Qd.REQUEST_UPDATE_CONSTRAINTS,Array.from(rI(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return ao.info("processor ".concat(e.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(e),ri(this,Qd.REQUEST_UPDATE_CONSTRAINTS,Array.from(rI(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const t of this.statsRegistry){const r=t.processorID,n=t.processorName,i=t.type,o=t.cb;try{const t=o();e.push({processorID:r,processorName:n,type:i,stats:t})}catch(e){ao.error(new xn(Un.UNEXPECTED_ERROR,e.message))}}return e}registerUsage(e,t){this.usageRegistry.find((t=>t.processorID===e.ID&&t.processorName===e.name))||this.usageRegistry.push({processorID:e.ID,processorName:e.name,cb:t})}unregisterUsage(e){const t=this.usageRegistry.findIndex((t=>t.processorID===e.ID&&t.processorName===e.name));-1!==t&&this.usageRegistry.splice(t,1)}async gatherUsage(){const e=[];if(!this.chained)return[];for(const t of this.usageRegistry){const r=t.cb;try{let t=r();t instanceof wb&&(t=await t),e.push(iI(iI({},t),{},{direction:this.direction}))}catch(e){ao.error("gather extension usage error",e)}}return e}getDirection(){return this.direction}}class aI extends Xn{constructor(e){super(),JT(this,"name","AudioProcessorDestination"),JT(this,"ID","0"),JT(this,"inputTrack",void 0),JT(this,"inputNode",void 0),JT(this,"audioProcessorContext",void 0),JT(this,"_source",void 0),this.audioProcessorContext=e}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new xn(Un.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new xn(Un.NOT_SUPPORTED,"AudioProcessor cannot unpipe to any other Processor")}enable(){}disable(){}reset(){this.inputTrack=void 0,this.inputNode=void 0,this.audioProcessorContext.chained=!1,this.emit(Jd.ON_TRACK,void 0),this.emit(Jd.ON_NODE,void 0)}updateInput(e){if(e.context!==this.audioProcessorContext)throw new Error("ProcessorContext passed to AudioTrack.processorDestination doesn't match it's belonging AudioTrack's context.\n Probably you are making pipeline like this: audioTrack1.pipe(processor).pipe(audioTrack2.processorDestination).");e.track&&this.inputTrack!==e.track&&(this.audioProcessorContext.chained=!0,this.inputTrack=e.track,this.emit(Jd.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.audioProcessorContext.chained=!0,this.inputNode=e.node,this.emit(Jd.ON_NODE,this.inputNode))}}class cI extends Xn{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),JT(this,"constraintsMap",new Map),JT(this,"statsRegistry",[]),JT(this,"audioContext",void 0),JT(this,"trackId",void 0),JT(this,"direction",void 0),JT(this,"usageRegistry",[]),JT(this,"_chained",!1),this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return ti(this,Qd.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(e,t){var r;return ao.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),ri(this,Qd.REQUEST_UPDATE_CONSTRAINTS,Array.from(rI(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return this.constraintsMap.delete(e),ri(this,Qd.REQUEST_UPDATE_CONSTRAINTS,Array.from(rI(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const t of this.statsRegistry){const r=t.processorID,n=t.processorName,i=t.type,o=t.cb;try{const t=o();e.push({processorID:r,processorName:n,type:i,stats:t})}catch(e){ao.error(new xn(Un.UNEXPECTED_ERROR,e.message))}}return e}registerUsage(e,t){this.usageRegistry.find((t=>t.processorID===e.ID&&t.processorName===e.name))||this.usageRegistry.push({processorID:e.ID,processorName:e.name,cb:t})}unregisterUsage(e){const t=this.usageRegistry.findIndex((t=>t.processorID===e.ID&&t.processorName===e.name));-1!==t&&this.usageRegistry.splice(t,1)}async gatherUsage(){const e=[];if(!this.chained)return[];for(const t of this.usageRegistry){const r=t.cb;try{let t=r();t instanceof wb&&(t=await t),e.push(iI(iI({},t),{},{direction:this.direction}))}catch(e){ao.error("gather extension usage error",e)}}return e}getDirection(){return this.direction}}class uI extends Xn{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),JT(this,"context",void 0),JT(this,"processSourceNode",void 0),JT(this,"outputTrack",void 0),JT(this,"processedNode",void 0),JT(this,"clonedTrack",void 0),JT(this,"outputNode",void 0),this.outputNode=new dI}setVolume(){}createOutputTrack(){throw new xn(Un.NOT_SUPPORTED,"can not create output MediaStreamTrack when WebAudio disabled")}getOriginVolumeLevel(){return 0}getAccurateVolumeLevel(){return 0}stopGetAudioBuffer(){}startGetAudioBuffer(){}play(){}stop(){}destroy(){}updateTrack(){}updateOriginTrack(){}createMediaStreamSourceNode(){}}class dI{disconnect(){}connect(){}}function lI(e){return new wb(((t,r)=>{let n=!1;const i=document.createElement("video");i.setAttribute("autoplay",""),i.setAttribute("muted",""),i.muted=!0,i.autoplay=!0,i.setAttribute("playsinline",""),i.setAttribute("style","position: fixed; top: 0; left: 0; width: 1px; height: 1px"),document.body.appendChild(i);const o=mn()?"canplay":"playing";i.addEventListener(o,(()=>{const e=i.videoWidth,r=i.videoHeight;!e&&En()||(n=!0,i.srcObject=null,i.remove(),t([e,r]))})),i.srcObject=new MediaStream([e]),i.play().catch(gi),setTimeout((()=>{n||(i.srcObject=null,i.remove(),t([i.videoWidth,i.videoHeight]))}),4e3)}))}function hI(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=yd(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!On()&&r.frameRate&&(t.frameRate=r.frameRate),fn()&&"object"==typeof t.frameRate&&(t.frameRate.max=60),En()&&(t.frameRate={ideal:30,max:30}),t}function pI(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&hn()&&(t.extensionId=e.extensionId);const r=e.displaySurface,n=e.selfBrowserSurface,i=e.surfaceSwitching,o=e.systemAudio,s=e.preferCurrentTab,a=e.windowAudio,c=e.monitorTypeSurfaces;(_n(107)||gn(107)||Rn(93))&&(r&&(Fn(r,"displaySurface",["browser","window","monitor"]),t.displaySurface=r),n?(Fn(n,"selfBrowserSurface",["exclude","include"]),t.selfBrowserSurface=n):t.selfBrowserSurface="include",i&&(Fn(i,"surfaceSwitching",["exclude","include"]),t.surfaceSwitching=i)),(_n(105)||gn(105)||Rn(91))&&o&&(Fn(o,"systemAudio",["exclude","include"]),t.systemAudio=o),(_n(94)||gn(94)||Rn(80))&&s&&(t.preferCurrentTab=!0),(_n(141)||gn(141)||Rn(125))&&a&&(Fn(a,"windowAudio",["exclude","system"]),t.windowAudio=a),(_n(119)||gn(119)||Rn(105))&&c&&(Fn(c,"monitorTypeSurfaces",["exclude","include"]),t.monitorTypeSurfaces=c),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const u=e.encoderConfig?Ad(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:u?u.width:void 0,maxHeight:u?u.height:void 0},u&&(u.frameRate&&("number"==typeof u.frameRate?(t.mandatory.maxFrameRate=u.frameRate,t.mandatory.minFrameRate=u.frameRate):(t.mandatory.maxFrameRate=u.frameRate.max||u.frameRate.ideal||u.frameRate.exact||void 0,t.mandatory.minFrameRate=u.frameRate.min||u.frameRate.ideal||u.frameRate.exact||void 0),t.frameRate=u.frameRate),u.width&&(t.width=u.width),u.height&&(t.height=u.height)),t}function fI(e){const t={};return On()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,hn()&&e.ANS&&(t.googHighpassFilter=e.ANS))),t}function EI(e){const t=fI(e);return Mo()&&e.suppressLocalAudioPlayback&&(t.suppressLocalAudioPlayback=e.suppressLocalAudioPlayback),Uo()&&e.restrictOwnAudio&&(t.restrictOwnAudio=!0),t}function mI(e){const t=fI(e);if(e.encoderConfig){const r=Id(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),wn()&&(t.sampleRate=void 0),t}var _I=aa,TI=TypeError,gI=$h,SI=Math.floor,RI=function(e,t){var r=e.length;if(r<8)for(var n,i,o=1;o<r;){for(i=o,n=e[o];i&&t(e[i-1],n)>0;)e[i]=e[--i];i!==o++&&(e[i]=n)}else for(var s=SI(r/2),a=RI(gI(e,0,s),t),c=RI(gI(e,s),t),u=a.length,d=c.length,l=0,h=0;l<u||h<d;)e[l+h]=l<u&&h<d?t(a[l],c[h])<=0?a[l++]:c[h++]:l<u?a[l++]:c[h++];return e},vI=RI,yI=Gs.match(/firefox\/(\d+)/i),AI=!!yI&&+yI[1],bI=/MSIE|Trident/.test(Gs),OI=Gs.match(/AppleWebKit\/(\d+)\./),II=!!OI&&+OI[1],CI=du,wI=Ho,NI=la,PI=Pa,DI=yu,LI=function(e,t){if(!delete e[t])throw new TI("Cannot delete property "+_I(t)+" of "+_I(e))},kI=ed,MI=Vo,UI=vI,xI=qT,VI=AI,FI=bI,BI=zs,jI=II,GI=[],WI=wI(GI.sort),HI=wI(GI.push),KI=MI((function(){GI.sort(void 0)})),YI=MI((function(){GI.sort(null)})),XI=xI("sort"),ZI=!MI((function(){if(BI)return BI<70;if(!(VI&&VI>3)){if(FI)return!0;if(jI)return jI<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)GI.push({k:t+n,v:r})}for(GI.sort((function(e,t){return t.v-e.v})),n=0;n<GI.length;n++)t=GI[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));CI({target:"Array",proto:!0,forced:KI||!YI||!XI||!ZI},{sort:function(e){void 0!==e&&NI(e);var t=PI(this);if(ZI)return void 0===e?WI(t):WI(t,e);var r,n,i=[],o=DI(t);for(n=0;n<o;n++)n in t&&HI(i,t[n]);for(UI(i,function(e){return function(t,r){if(void 0===r)return-1;if(void 0===t)return 1;if(void 0!==e)return+e(t,r)||0;var n=kI(t),i=kI(r);return n===i?0:n>i?1:-1}}(e)),r=DI(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)LI(t,n++);return t}});var zI=Uu("Array","sort"),JI=Ko,QI=zI,qI=Array.prototype,$I=function(e){var t=e.sort;return e===qI||JI(qI,e)&&t===qI.sort?QI:t},eC=z($I);function tC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function rC(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tC(Object(r),!0).forEach((function(t){JT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tC(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function nC(e,t,r){const n=4*Math.floor(2e5*Math.pow(r/15,.6)*Math.pow(e*t/230400,.75)),i=e*t,o=new Map([[19200,.9],[230400,.85],[518400,.75],[921600,.7],[2073600,.6],[3686400,.5]]),s=new Map([[230400,.95],[518400,.9],[921600,.85],[2073600,.8]]);let a=rI(o).call(o).next().value,c=1;if(o.has(i))a=o.get(i);else{var u;const e=eC(u=Array.from(o.entries())).call(u,((e,t)=>VO(e,1)[0]-VO(t,1)[0])),t=e.find((e=>VO(e,1)[0]>i));if(t){const r=e.indexOf(t);if(r>0){const n=e[r-1],o=(i-n[0])/(t[0]-n[0]);a=n[1]+o*(t[1]-n[1])}else a=t[1]}else a=e[e.length-1][1]}if(s.has(i))c=s.get(i);else{var d;const e=eC(d=Array.from(s.entries())).call(d,((e,t)=>VO(e,1)[0]-VO(t,1)[0])),t=e.find((e=>VO(e,1)[0]>i));if(t){const r=e.indexOf(t);if(r>0){const n=e[r-1],o=(i-n[0])/(t[0]-n[0]);c=n[1]+o*(t[1]-n[1])}else c=t[1]}else c=e[e.length-1][1]}const l=Hi("VIDEO_NEW_BITRATE_RATIO");l&&l>0&&(a=l/100);const h=Math.floor(n*a),p=Math.floor(65e4*Math.pow(e*t/230400,.5)*Math.pow(r/15,.69));let f=h;const E=Hi("VIDEO_STANDARD_BITRATE_VERSION");return E&&E>0&&(1===E?f=n:2===E?f=h:3===E&&(f=p)),[Math.floor(f/1e3),c]}function iC(e,t,r){if(!Array.isArray(Hi("VIDEO_ENCODER_CONFIG_LIST")))return!1;if(0===Hi("VIDEO_ENCODER_CONFIG_LIST").length)return!1;const n=Math.min(e,t);if(n>=480)return!1;return rC(rC({},Hi("VIDEO_ENCODER_CONFIG_LIST").find((e=>e.height>n))),{},{frameRate:r})}function oC(e,t,r,n,i){const o=Hi("BITRATE_ADAPTER_TYPE");if("DEFAULT_BITRATE"===o)return{min:n,max:i};if(void 0===i){const s=Math.floor(200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75));i="STANDARD_BITRATE"===o?4*s:2*s,n=null!=n?n:s}else n=null!=n?n:Math.floor(i/10);return{min:n,max:i}}function sC(e,t,r){const n=200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75);return{min:Math.floor(n),max:Math.floor(4*n)}}const aC=async(e,t,r)=>{const n=function(e){const t=[];for(let r=0;r<e.length;r+=2)t.push(parseInt(e.slice(r,r+2),16));return Uint8Array.from(t)}(function(e){const t="0123456789abcdef";function r(e){let r,n="";for(r=0;r<=3;r++)n+=t.charAt(e>>8*r+4&15)+t.charAt(e>>8*r&15);return n}function n(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function i(e,t,r,i,o,s){return n(function(e,t){return e<<t|e>>>32-t}(n(n(t,e),n(i,s)),o),r)}function o(e,t,r,n,o,s,a){return i(t&r|~t&n,e,t,o,s,a)}function s(e,t,r,n,o,s,a){return i(t&n|r&~n,e,t,o,s,a)}function a(e,t,r,n,o,s,a){return i(t^r^n,e,t,o,s,a)}function c(e,t,r,n,o,s,a){return i(r^(t|~n),e,t,o,s,a)}const u=function(e){let t;const r=1+(e.length+8>>6),n=new Array(16*r);for(t=0;t<16*r;t++)n[t]=0;for(t=0;t<e.length;t++)n[t>>2]|=e.charCodeAt(t)<<t%4*8;return n[t>>2]|=128<<t%4*8,n[16*r-2]=8*e.length,n}(e);let d,l,h,p,f,E=1732584193,m=-271733879,_=-1732584194,T=271733878;for(d=0;d<u.length;d+=16)l=E,h=m,p=_,f=T,E=o(E,m,_,T,u[d+0],7,-680876936),T=o(T,E,m,_,u[d+1],12,-389564586),_=o(_,T,E,m,u[d+2],17,606105819),m=o(m,_,T,E,u[d+3],22,-1044525330),E=o(E,m,_,T,u[d+4],7,-176418897),T=o(T,E,m,_,u[d+5],12,1200080426),_=o(_,T,E,m,u[d+6],17,-1473231341),m=o(m,_,T,E,u[d+7],22,-45705983),E=o(E,m,_,T,u[d+8],7,1770035416),T=o(T,E,m,_,u[d+9],12,-1958414417),_=o(_,T,E,m,u[d+10],17,-42063),m=o(m,_,T,E,u[d+11],22,-1990404162),E=o(E,m,_,T,u[d+12],7,1804603682),T=o(T,E,m,_,u[d+13],12,-40341101),_=o(_,T,E,m,u[d+14],17,-1502002290),m=o(m,_,T,E,u[d+15],22,1236535329),E=s(E,m,_,T,u[d+1],5,-165796510),T=s(T,E,m,_,u[d+6],9,-1069501632),_=s(_,T,E,m,u[d+11],14,643717713),m=s(m,_,T,E,u[d+0],20,-373897302),E=s(E,m,_,T,u[d+5],5,-701558691),T=s(T,E,m,_,u[d+10],9,38016083),_=s(_,T,E,m,u[d+15],14,-660478335),m=s(m,_,T,E,u[d+4],20,-405537848),E=s(E,m,_,T,u[d+9],5,568446438),T=s(T,E,m,_,u[d+14],9,-1019803690),_=s(_,T,E,m,u[d+3],14,-187363961),m=s(m,_,T,E,u[d+8],20,1163531501),E=s(E,m,_,T,u[d+13],5,-1444681467),T=s(T,E,m,_,u[d+2],9,-51403784),_=s(_,T,E,m,u[d+7],14,1735328473),m=s(m,_,T,E,u[d+12],20,-1926607734),E=a(E,m,_,T,u[d+5],4,-378558),T=a(T,E,m,_,u[d+8],11,-2022574463),_=a(_,T,E,m,u[d+11],16,1839030562),m=a(m,_,T,E,u[d+14],23,-35309556),E=a(E,m,_,T,u[d+1],4,-1530992060),T=a(T,E,m,_,u[d+4],11,1272893353),_=a(_,T,E,m,u[d+7],16,-155497632),m=a(m,_,T,E,u[d+10],23,-1094730640),E=a(E,m,_,T,u[d+13],4,681279174),T=a(T,E,m,_,u[d+0],11,-358537222),_=a(_,T,E,m,u[d+3],16,-722521979),m=a(m,_,T,E,u[d+6],23,76029189),E=a(E,m,_,T,u[d+9],4,-640364487),T=a(T,E,m,_,u[d+12],11,-421815835),_=a(_,T,E,m,u[d+15],16,530742520),m=a(m,_,T,E,u[d+2],23,-995338651),E=c(E,m,_,T,u[d+0],6,-198630844),T=c(T,E,m,_,u[d+7],10,1126891415),_=c(_,T,E,m,u[d+14],15,-1416354905),m=c(m,_,T,E,u[d+5],21,-57434055),E=c(E,m,_,T,u[d+12],6,1700485571),T=c(T,E,m,_,u[d+3],10,-1894986606),_=c(_,T,E,m,u[d+10],15,-1051523),m=c(m,_,T,E,u[d+1],21,-2054922799),E=c(E,m,_,T,u[d+8],6,1873313359),T=c(T,E,m,_,u[d+15],10,-30611744),_=c(_,T,E,m,u[d+6],15,-1560198380),m=c(m,_,T,E,u[d+13],21,1309151649),E=c(E,m,_,T,u[d+4],6,-145523070),T=c(T,E,m,_,u[d+11],10,-1120210379),_=c(_,T,E,m,u[d+2],15,718787259),m=c(m,_,T,E,u[d+9],21,-343485551),E=n(E,l),m=n(m,h),_=n(_,p),T=n(T,f);return r(E)+r(m)+r(_)+r(T)}(""+t+r)).slice(0,16),i=n.slice(0,12),o=await window.crypto.subtle.importKey("raw",n,"AES-GCM",!0,["encrypt"]);return new Uint8Array(await window.crypto.subtle.encrypt({name:"AES-GCM",iv:i},o,e))},cC=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new wb(((r,n)=>{t.toBlob((async e=>{if(t.remove(),e){const n=await uC(e);r({buffer:n,width:t.width,height:t.height})}else n(new xn(Un.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},uC=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function dC(e,t){if("VideoFrame"in window&&"TransformStream"in window&&Po().supportWebRTCInsertableStream){const r=new MediaStreamTrackProcessor(e),n=new MediaStreamTrackGenerator({kind:"video"});let i,o,s=Date.now();const a=()=>{c&&(clearInterval(c),c=void 0),i&&(i.close(),i=void 0),e.stop(),o=void 0,n.removeEventListener("ended",a)};let c=window.setInterval((()=>{if(o&&i&&Date.now()-s>(null!=t?t:1e3))try{"live"===n.readyState?o.enqueue(i.clone()):a()}catch(e){a()}}),null!=t?t:1e3);const u=new TransformStream({transform:(e,t)=>{"live"===n.readyState?(o=t,s=Date.now(),void 0===i?(i=e,t.enqueue(e.clone())):(t.enqueue(i),i=e)):e.close()}});return n.addEventListener("ended",a),r.readable.pipeThrough(u).pipeTo(n.writable),n}}var lC,hC,pC,fC,EC,mC,_C,TC,gC,SC,RC,vC,yC,AC,bC,OC,IC,CC,wC,NC,PC,DC,LC,kC,MC,UC,xC,VC,FC,BC,jC,GC,WC,HC,KC,YC,XC,ZC,zC,JC;function QC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function qC(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?QC(Object(r),!0).forEach((function(t){JT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):QC(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let $C=(lC=Io({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),hC=Io({argsMap:(e,t)=>[e.getTrackId(),t]}),pC=XO(),fC=wi("LocalAudioTrack","_enabledMutex"),EC=Io({argsMap:(e,t)=>[e.getTrackId(),t]}),mC=XO(),_C=wi("LocalAudioTrack","_enabledMutex"),TC=Io({argsMap:(e,t)=>[e.getTrackId(),t]}),gC=XO(),SC=XO(),RC=XO(),vC=Io({argsMap:e=>[e.getTrackId()]}),yC=XO(),AC=Io({argsMap:e=>[e.getTrackId()]}),bC=XO(),OC=Io({argsMap:e=>[e.getTrackId()]}),IC=Io({argsMap:(e,t)=>[e.getTrackId(),t.name]}),CC=Io({argsMap:e=>[e.getTrackId()]}),wC=class extends Pb{get _source(){return this.initWebAudio()}set _source(e){this._trackSource=e}get processorContext(){return this._processorContext||(this._processorContext=this.initProcessor().processorContext),this._processorContext}get processorDestination(){return this._processorDestination||(this._processorDestination=this.initProcessor().processorDestination),this._processorDestination}get isPlaying(){return this._useAudioElement?YO.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,n){super(e,r),JT(this,"trackMediaType",Wd.AUDIO),JT(this,"_encoderConfig",void 0),JT(this,"_trackSource",void 0),JT(this,"metadata",[]),JT(this,"_enabled",!0),JT(this,"_volume",100),JT(this,"_useAudioElement",!0),JT(this,"_bypassWebAudio",!1),JT(this,"processor",void 0),JT(this,"_processorContext",void 0),JT(this,"_processorDestination",void 0),JT(this,"_getOriginVolumeLevel",void 0),JT(this,"_usePipeMode",!1),JT(this,"_useExtensionMode",!1),JT(this,"_extensionManager",void 0),this._encoderConfig=t,this._getOriginVolumeLevel=!!n,this._trackSource=new uI,Hi("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),Hi("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);pn()&&!Bb()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(e){Bn(e,"volume",0,1e3),this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&YO.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void ao.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const e=this._source.createOutputTrack();this._mediaStreamTrack!==e&&(this._mediaStreamTrack=e,ri(this,Md.NEED_REPLACE_TRACK,this).then((()=>{ao.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{ao.warning("[".concat(this.getTrackId(),"] replace web audio track failed"),e)})))}catch(e){}}getVolumeLevel(){return this._muted&&this.enabled&&this._getOriginVolumeLevel?this._source.getOriginVolumeLevel():this._source.getAccurateVolumeLevel()}async setPlaybackDevice(e){if(!this._useAudioElement||!Do())throw new xn(Un.NOT_SUPPORTED,"your browser does not support setting the audio output device");await YO.setSinkID(this.getTrackId(),e)}async setEnabled(e,t,r){return this._setEnabled(e,t,r)}async _setEnabled(e,t,r){if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(ao.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){this._originMediaStreamTrack.enabled=!0;try{r||(this._enabled=!0),await ri(this,Md.NEED_ENABLE_TRACK,this),ao.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(e," success"))}catch(e){throw r||(this._enabled=!1),ao.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,r||(this._enabled=!1);try{await ri(this,Md.NEED_DISABLE_TRACK,this)}catch(e){throw r||(this._enabled=!0),ao.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}}}async setMuted(e){e!==this._muted&&(this.stateCheck("muted",e),this._muted=e,this._originMediaStreamTrack.enabled=!e,ao.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await ri(this,Md.NEED_MUTE_TRACK,this):await ri(this,Md.NEED_UNMUTE_TRACK,this))}getStats(){Ei((()=>{ao.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const e=ni(this,Md.GET_STATS);return e||qC({},Yd)}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(Hd.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Hd.ON_AUDIO_BUFFER),this._source.on(Hd.ON_AUDIO_BUFFER,(t=>e(t)))}play(){ao.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(ao.debug("[".concat(this.getTrackId(),"] start audio playback in element")),YO.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){ao.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?YO.stop(this.getTrackId()):this._source.stop()}close(){super.close(),this._processorDestination&&this.unbindProcessorDestinationEvents(this._processorDestination),this._processorContext&&this.unbindProcessorContextEvents(this._processorContext),this.unpipe(),this._processorDestination&&this._processorDestination._source&&this._processorDestination._source.unpipe(),this._extensionManager&&(this._extensionManager.destroy(),this._extensionManager=void 0,this._useExtensionMode=!1),this._source.destroy()}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];ao.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&YO.updateTrack(this.getTrackId(),this._mediaStreamTrack)}async _updateOriginMediaStreamTrack(e,t){this._originMediaStreamTrack!==e&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),t&&this._originMediaStreamTrack.stop()),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,this._muted&&(this._originMediaStreamTrack.enabled=!1),this.processor&&this._processorContext&&this.processor.updateInput({track:e,context:this._processorContext}),this._mediaStreamTrack!==this._source.outputTrack?(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await ri(this,Md.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(e))}renewMediaStreamTrack(e){return wb.resolve(void 0)}_ensureExtensionManager(e){return this._extensionManager||(this._extensionManager=e.createAudioExtensionManager(this),this._extensionManager.onOutputTrackChanged=e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,ri(this,Md.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,ri(this,Md.NEED_REPLACE_TRACK,this))}),this._extensionManager}useExtension(e,t){if(this._usePipeMode)throw new xn(Un.INVALID_OPERATION,"Cannot use useExtension() when pipe() mode is active. Call unpipe() first.");return this._ensureExtensionManager(e),this._useExtensionMode=!0,this._extensionManager.useExtension(e,t)}removeExtension(e){if(!this._extensionManager)return!1;const t=this._extensionManager.removeExtension(e);return t&&ao.info("[".concat(this.getTrackId(),"] removeExtension: ").concat(e.name)),this._extensionManager.hasExtensions||(this._useExtensionMode=!1),t}addReferenceTrack(e){if(!this._extensionManager)throw new xn(Un.INVALID_OPERATION,"Call useExtension() before addReferenceTrack().");this._extensionManager.addReferenceTrack(e),ao.info("[".concat(this.getTrackId(),"] addReferenceTrack"))}removeReferenceTrack(e){return!!this._extensionManager&&this._extensionManager.removeReferenceTrack(e)}pipe(e){if(this._useExtensionMode)throw new xn(Un.INVALID_OPERATION,"Cannot use pipe() when useExtension() mode is active. Call removeExtension() for all extensions first.");if(this._bypassWebAudio)throw new xn(Un.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new xn(Un.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this._usePipeMode=!0,this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,node:this._source.processSourceNode,context:this.processorContext}),e}unpipe(){var e;if(!this.processor)return;const t=this.processor;null===(e=this._source.processSourceNode)||void 0===e||e.disconnect(),this.processor._source=!1,this.processor=void 0,this._usePipeMode=!1,t.reset()}bindProcessorDestinationEvents(e){e.on(Jd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e),await ri(this,Md.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await ri(this,Md.NEED_REPLACE_TRACK,this))})),e.on(Jd.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(e){e.removeAllListeners(Jd.ON_TRACK),e.removeAllListeners(Jd.ON_NODE)}bindProcessorContextEvents(e){e.on(Qd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(e){e.removeAllListeners(Qd.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof uI&&(this._trackSource=new zb(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const e=new cI(this._source.context,this.getTrackId(),"local"),t=new aI(e);return this._processorContext=e,this._processorDestination=t,this.bindProcessorContextEvents(e),this.bindProcessorDestinationEvents(t),this._source.on(Hd.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:e})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(YO.stop(this.getTrackId()),this._source.play()),ri(this,Md.NEED_REPLACE_MIXING_TRACK,this).then((()=>{ao.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{ao.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:e,processorDestination:t}}},pS(wC.prototype,"setVolume",[lC],Object.getOwnPropertyDescriptor(wC.prototype,"setVolume"),wC.prototype),pS(wC.prototype,"setPlaybackDevice",[hC,pC],Object.getOwnPropertyDescriptor(wC.prototype,"setPlaybackDevice"),wC.prototype),pS(wC.prototype,"setEnabled",[fC,EC,mC],Object.getOwnPropertyDescriptor(wC.prototype,"setEnabled"),wC.prototype),pS(wC.prototype,"setMuted",[_C,TC,gC],Object.getOwnPropertyDescriptor(wC.prototype,"setMuted"),wC.prototype),pS(wC.prototype,"getStats",[SC],Object.getOwnPropertyDescriptor(wC.prototype,"getStats"),wC.prototype),pS(wC.prototype,"setAudioFrameCallback",[RC],Object.getOwnPropertyDescriptor(wC.prototype,"setAudioFrameCallback"),wC.prototype),pS(wC.prototype,"play",[vC,yC],Object.getOwnPropertyDescriptor(wC.prototype,"play"),wC.prototype),pS(wC.prototype,"stop",[AC,bC],Object.getOwnPropertyDescriptor(wC.prototype,"stop"),wC.prototype),pS(wC.prototype,"close",[OC],Object.getOwnPropertyDescriptor(wC.prototype,"close"),wC.prototype),pS(wC.prototype,"pipe",[IC],Object.getOwnPropertyDescriptor(wC.prototype,"pipe"),wC.prototype),pS(wC.prototype,"unpipe",[CC],Object.getOwnPropertyDescriptor(wC.prototype,"unpipe"),wC.prototype),wC),ew=(NC=Io({argsMap:(e,t)=>[e.getTrackId(),t]}),PC=XO(),DC=wi("MicrophoneAudioTrack","_enabledMutex"),LC=Io({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),kC=XO(),MC=Io({argsMap:e=>[e.getTrackId()]}),UC=class extends $C{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,n){super(e,t.encoderConfig?Id(t.encoderConfig):{},n,Hi("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),JT(this,"_config",void 0),JT(this,"_deviceName","default"),JT(this,"_constraints",void 0),JT(this,"_originalConstraints",void 0),JT(this,"_enabled",!0),this._config=t,this._constraints=r,this._originalConstraints=r,this._deviceName=e.label,"boolean"==typeof t.bypassWebAudio&&(this._bypassWebAudio=t.bypassWebAudio),(vn()||yn())&&Ub.bindInterruptDetectorTrack(this)}async setDevice(e){if(ao.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await sO.getDeviceById(e),r={};r.audio=qC({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let n=null;try{n=await tO(r,this.getTrackId())}catch(e){throw ao.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await tO({audio:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(n.getAudioTracks()[0],!1),e}await this._updateOriginMediaStreamTrack(n.getAudioTracks()[0],!1),this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw ao.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await sO.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw ao.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}ao.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(e,t,r){if(t)return ao.debug("[".concat(this.getTrackId(),"] setEnabled false (do not close microphone)")),await super._setEnabled(e);if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(ao.info("[".concat(this.getTrackId(),"] start setEnabled"),e),Hi("AUTO_RESET_AUDIO_ROUTE")&&(mn()||bn())){const t=navigator.audioSession;t&&(e||(t.type="playback"),t.type="auto")}if(!e){var n;this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),null===(n=this._source.clonedTrack)||void 0===n||n.stop(),r||(this._enabled=!1);try{await ri(this,Md.NEED_DISABLE_TRACK,this)}catch(e){throw ao.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const i=qC({},this._constraints),o=sO.searchDeviceIdByName(this._deviceName);o&&!i.deviceId&&(i.deviceId=o);try{r||(this._enabled=!0);const e=await tO({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!1),await ri(this,Md.NEED_ENABLE_TRACK,this)}catch(e){throw r||(this._enabled=!1),ao.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}ao.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(vn()||yn())&&Ub.unbindInterruptDetectorTrack(this),Pd()||Vb()}onTrackEnded(){if((mn()||bn())&&this._enabled&&!this._isClosed&&Ub.duringInterruption){const e=async()=>{Ub.off(xo.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(ao.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};Ub.on(xo.IOS_INTERRUPTION_END,e)}else ao.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(jd.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=sO.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await tO({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(e){super.bindProcessorContextEvents(e),e.on(Qd.REQUEST_UPDATE_CONSTRAINTS,(async(e,t,r)=>{try{const r=Object.assign({},this._originalConstraints,...e);await this.renewMediaStreamTrack(r),t()}catch(e){r(e)}}))}unbindProcessorContextEvents(e){super.unbindProcessorContextEvents(e),e.removeAllListeners(Qd.REQUEST_UPDATE_CONSTRAINTS)}},pS(UC.prototype,"setDevice",[NC,PC],Object.getOwnPropertyDescriptor(UC.prototype,"setDevice"),UC.prototype),pS(UC.prototype,"setEnabled",[DC,LC,kC],Object.getOwnPropertyDescriptor(UC.prototype,"setEnabled"),UC.prototype),pS(UC.prototype,"close",[MC],Object.getOwnPropertyDescriptor(UC.prototype,"close"),UC.prototype),UC),tw=(xC=Io({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),VC=XO(),FC=Io({argsMap:e=>[e.getTrackId()]}),BC=XO(),jC=Io({argsMap:e=>[e.getTrackId()]}),GC=XO(),WC=Io({argsMap:e=>[e.getTrackId()]}),HC=XO(),KC=Io({argsMap:e=>[e.getTrackId()]}),YC=XO(),XC=Io({argsMap:e=>[e.getTrackId()]}),ZC=Io({argsMap:e=>[e.getTrackId()]}),zC=XO(),pS((JC=class extends $C{get __className__(){return"BufferSourceAudioTrack"}constructor(e,t,r,n){super(t.createOutputTrack(),r,n),JT(this,"source",void 0),JT(this,"_bufferSource",void 0),this._useAudioElement=!1,this.source=e,this._bufferSource=t,this._bufferSource.on(Hd.AUDIO_SOURCE_STATE_CHANGE,(e=>{this.safeEmit(jd.SOURCE_STATE_CHANGE,e)}));try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(e){}}get currentState(){return this._bufferSource.currentState}get duration(){return this._bufferSource.duration}get playbackSpeed(){return this._bufferSource.playbackSpeed}getCurrentTime(){return this._bufferSource.currentTime}startProcessAudioBuffer(e){e&&this._bufferSource.updateOptions(e),this._bufferSource.startProcessAudioBuffer()}pauseProcessAudioBuffer(){this._bufferSource.pauseProcessAudioBuffer()}seekAudioBuffer(e){this._bufferSource.seekAudioBuffer(e)}resumeProcessAudioBuffer(){this._bufferSource.resumeProcessAudioBuffer()}stopProcessAudioBuffer(){this._bufferSource.stopProcessAudioBuffer()}close(){this.source=null,this._bufferSource.destroy(),super.close()}setAudioBufferPlaybackSpeed(e){Bn(e,"speed",0),this._bufferSource.setAudioBufferPlaybackSpeed(e)}}).prototype,"startProcessAudioBuffer",[xC,VC],Object.getOwnPropertyDescriptor(JC.prototype,"startProcessAudioBuffer"),JC.prototype),pS(JC.prototype,"pauseProcessAudioBuffer",[FC,BC],Object.getOwnPropertyDescriptor(JC.prototype,"pauseProcessAudioBuffer"),JC.prototype),pS(JC.prototype,"seekAudioBuffer",[jC,GC],Object.getOwnPropertyDescriptor(JC.prototype,"seekAudioBuffer"),JC.prototype),pS(JC.prototype,"resumeProcessAudioBuffer",[WC,HC],Object.getOwnPropertyDescriptor(JC.prototype,"resumeProcessAudioBuffer"),JC.prototype),pS(JC.prototype,"stopProcessAudioBuffer",[KC,YC],Object.getOwnPropertyDescriptor(JC.prototype,"stopProcessAudioBuffer"),JC.prototype),pS(JC.prototype,"close",[XC],Object.getOwnPropertyDescriptor(JC.prototype,"close"),JC.prototype),pS(JC.prototype,"setAudioBufferPlaybackSpeed",[ZC,zC],Object.getOwnPropertyDescriptor(JC.prototype,"setAudioBufferPlaybackSpeed"),JC.prototype),JC);class rw extends $C{get __className__(){return"MixingAudioTrack"}get isActive(){for(const e of this.trackList)if(e._enabled&&!e._isClosed&&!e.muted)return!0;return!1}constructor(){const e=Fb().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,Ti(8,"track-mix-")),JT(this,"trackList",void 0),JT(this,"destNode",void 0),this._useAudioElement=!1;try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(e){}this.destNode=e,this.trackList=[]}hasAudioTrack(e){return-1!==this.trackList.indexOf(e)}addAudioTrack(e){-1===this.trackList.indexOf(e)?(ao.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):ao.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){ao.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}di(this.trackList,e),this.updateEncoderConfig()}}updateEncoderConfig(){const e={};this.trackList.forEach((t=>{t._encoderConfig&&((t._encoderConfig.bitrate||0)>(e.bitrate||0)&&(e.bitrate=t._encoderConfig.bitrate),(t._encoderConfig.sampleRate||0)>(e.sampleRate||0)&&(e.sampleRate=t._encoderConfig.sampleRate),(t._encoderConfig.sampleSize||0)>(e.sampleSize||0)&&(e.sampleSize=t._encoderConfig.sampleSize),t._encoderConfig.stereo&&(e.stereo=!0))})),this._encoderConfig=e}_updateRtpTransceiver(e){this._rtpTransceiver!==e&&(this._rtpTransceiver=e,this.trackList.forEach((t=>{t instanceof rw?t.emit(Bd.TRANSCEIVER_UPDATED,e):t._updateRtpTransceiver(e)})))}}class nw extends Zb{set currentState(e){e!==this._currentState&&(this._currentState=e,this.safeEmit(Hd.AUDIO_SOURCE_STATE_CHANGE,this._currentState))}get currentState(){return this._currentState}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),JT(this,"audioBuffer",void 0),JT(this,"sourceNode",void 0),JT(this,"startPlayTime",0),JT(this,"startPlayOffset",0),JT(this,"pausePlayTime",0),JT(this,"options",void 0),JT(this,"currentLoopCount",0),JT(this,"currentPlaybackSpeed",100),JT(this,"_currentState","stopped"),this.audioBuffer=e,this.options=t,this.startPlayOffset=this.options.startPlayTime||0}createWebAudioDiagram(){return this.context.createGain()}get duration(){return this.audioBuffer?this.audioBuffer.duration:0}get playbackSpeed(){return this.currentPlaybackSpeed}get currentTime(){return this.audioBuffer?"stopped"===this.currentState?0:"paused"===this.currentState?this.pausePlayTime:((this.context.currentTime-this.startPlayTime)*(this.playbackSpeed/100)+this.startPlayOffset)%this.audioBuffer.duration:0}updateOptions(e){"stopped"===this.currentState?(this.options=e,this.startPlayOffset=this.options.startPlayTime||0):ao.warning("can not set audio source options")}startProcessAudioBuffer(){this.sourceNode&&this.stopProcessAudioBuffer(),this.sourceNode=this.createSourceNode(),this.startSourceNode(),this.currentState="playing"}pauseProcessAudioBuffer(){this.sourceNode&&"playing"===this.currentState&&(this.pausePlayTime=this.currentTime,this.sourceNode.onended=null,this.sourceNode.stop(),this.sourceNode.buffer=null,this.sourceNode=this.createSourceNode(),this.currentState="paused")}seekAudioBuffer(e){this.sourceNode&&(this.sourceNode.onended=null,"playing"===this.currentState&&this.sourceNode.stop(),this.sourceNode=this.createSourceNode(),"playing"===this.currentState?(this.startPlayOffset=e,this.startSourceNode()):"paused"===this.currentState&&(this.pausePlayTime=e))}resumeProcessAudioBuffer(){"paused"===this.currentState&&this.sourceNode&&(this.startPlayOffset=this.pausePlayTime,this.pausePlayTime=0,this.startSourceNode(),this.currentState="playing")}stopProcessAudioBuffer(){if(this.sourceNode){this.sourceNode.onended=null;try{this.sourceNode.stop()}catch(e){}this.reset()}}destroy(){this.audioBuffer=null,super.destroy()}setAudioBufferPlaybackSpeed(e){this.sourceNode&&("playing"===this.currentState&&(this.startPlayOffset=this.currentTime,this.startPlayTime=this.context.currentTime),this.sourceNode.playbackRate.value=e/100),this.currentPlaybackSpeed=e}startSourceNode(){this.sourceNode&&this.sourceNode.buffer&&(this.sourceNode.start(0,this.startPlayOffset),this.startPlayTime=this.context.currentTime,this.sourceNode.onended=this.handleSourceNodeEnded.bind(this))}createSourceNode(){const e=this.context.createBufferSource();return e.buffer=this.audioBuffer,e.loop=!!this.options.loop,e.connect(this.outputNode),e.playbackRate.value=this.currentPlaybackSpeed/100,e}handleSourceNodeEnded(){if(this.currentLoopCount+=1,this.options.cycle&&this.options.cycle>this.currentLoopCount)return this.startPlayOffset=0,this.sourceNode=void 0,void this.startProcessAudioBuffer();this.reset()}reset(){this.startPlayOffset=this.options.startPlayTime||0,this.currentState="stopped",this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=void 0),this.currentLoopCount=0}}const iw=new Map;function ow(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function sw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ow(Object(r),!0).forEach((function(t){JT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ow(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function aw(e,t){if(0===e.length||0===t.length)return 1/0;const r=bi(e),n=bi(t);return Math.floor(n/r)}class cw{get rendFrameRate(){const e=Math.max(1,aw(this._render_interframe_delays_sizes,this._render_interframe_delays));return Math.floor(1e3/e)}get videoElementStatus(){return this._isInPage?this._videoElementStatus:el.DESTROYED}set videoElementStatus(e){e!==this._videoElementStatus&&(ao.debug("[".concat(this.trackId,"] video-element-status change ").concat(this._videoElementStatus," => ").concat(e)),this._videoElementStatus=e)}get videoState(){return this._videoState}set videoState(e){var t;e!==this._videoState&&(this._videoState=e,null===(t=this.onVideoStateChanged)||void 0===t||t.call(this,this.videoState))}constructor(e){JT(this,"trackId",void 0),JT(this,"config",void 0),JT(this,"onFirstVideoFrameDecoded",void 0),JT(this,"onFirstVideoFrameRender",void 0),JT(this,"onVideoBufferReady",void 0),JT(this,"onVideoStateChanged",void 0),JT(this,"freezeTimeCounterList",[]),JT(this,"renderFreezeAccTime",0),JT(this,"renderFreezeAccTime2",0),JT(this,"totalFreezeTime",0),JT(this,"isKeepLastFrame",!1),JT(this,"isDestroyed",!1),JT(this,"timeUpdatedCount",0),JT(this,"freezeTime",0),JT(this,"playbackTime",0),JT(this,"lastTimeUpdatedTime",0),JT(this,"autoplayFailed",!1),JT(this,"videoTrack",void 0),JT(this,"videoElement",void 0),JT(this,"cacheVideoElement",void 0),JT(this,"cancelRVFId",void 0),JT(this,"internal",!1),JT(this,"_render_interframe_delays",[]),JT(this,"_render_interframe_delays_sizes",[]),JT(this,"_videoState",tl.VideoStateStopped),JT(this,"videoElementCheckInterval",void 0),JT(this,"videoElementFreezeTimeout",void 0),JT(this,"_videoElementStatus",el.NONE),JT(this,"_isInPage",!0),JT(this,"isGettingVideoDimensions",!1),JT(this,"startGetVideoDimensions",(()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return ao.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()})),JT(this,"autoResumeAfterInterruption",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===Ub.curState&&(ao.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(dn())),An()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),JT(this,"handleVideoEvents",(e=>{switch(e.type){case"play":case"playing":"play"===e.type&&ao.debug("[".concat(this.trackId,"] video element status: play")),this.startGetVideoDimensions(),this.videoElementStatus=el.PLAYING;break;case"loadeddata":if(this.videoState=tl.VideoStateStarting,this.onFirstVideoFrameRender&&this.onFirstVideoFrameRender(),this.onFirstVideoFrameDecoded&&this.onFirstVideoFrameDecoded(),this.cacheVideoElement){try{this.cacheVideoElement.srcObject=null,this.cacheVideoElement.remove()}catch(e){}this.cacheVideoElement=void 0}break;case"canplay":this.videoElementStatus=el.CANPLAY;break;case"stalled":this.videoElementStatus=el.STALLED;break;case"suspend":this.videoElementStatus=el.SUSPEND;break;case"pause":this.videoElementStatus=el.PAUSED,mn()||bn()||pn()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(ao.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=el.WAITING;break;case"abort":this.videoElementStatus=el.ABORT;break;case"ended":this.videoElementStatus=el.ENDED;break;case"emptied":this.videoElementStatus=el.EMPTIED;break;case"error":{const e=this.videoElement.error;e&&(this.videoElementStatus=el.ERROR,ao.error("[".concat(this.trackId,"] media error: ").concat(e.message," (").concat(e.code,")")));break}case"timeupdate":{const e=performance.now();if(this.timeUpdatedCount+=1,this.onVideoBufferReady&&this.timeUpdatedCount>Hi("BUFFER_READY_FRAMES")&&this.onVideoBufferReady(),this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime,r=this.lastTimeUpdatedTime;if(this.lastTimeUpdatedTime=e,SN.lastVisibleTime<SN.lastHiddenTime||r<SN.lastHiddenTime||r<SN.lastVisibleTime)return;if(this.isSkipCalcRenderFreezeTime())return;for(t>Hi("VIDEO_FREEZE_DURATION")&&(this.freezeTime+=t),this.playbackTime+=t;this.playbackTime>=6e3;){this.playbackTime-=6e3;const e=Math.min(6e3,this.freezeTime);this.freezeTimeCounterList.push(e),this.freezeTime=Math.max(0,this.freezeTime-6e3)}break}}})),JT(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(ao.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(dn())),An()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),this.trackId=e.trackId,this.config=e,e.element instanceof HTMLVideoElement?this.videoElement=e.element:this.videoElement=document.createElement("video"),Ub.on(xo.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),Ub.on(xo.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16)}getVideoElement(){return this.videoElement}getContainerElement(){var e;return null!==(e=this.videoElement.parentElement)&&void 0!==e?e:void 0}updateConfig(e){this.config=e,this.trackId=e.trackId,e.element!==this.videoElement&&(this.destroy(),this.videoElement=e.element),this.videoTrack&&this.initVideoElement()}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.initVideoElement())}play(e){const t=this.videoElement.play();t&&t.catch&&t.catch((t=>{e&&HO(e,"video",t.message,this.trackId),"NotAllowedError"===t.name?(ao.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):ao.warning("[".concat(this.trackId,"] play warning: "),t)}));const r=an();if(("Safari"===r.name&&15===Number(r.version)||vn())&&t&&t.then){const e=()=>{this.config.mirror&&!this.config.noStyle&&(this.videoElement.style.transform="rotateY(180deg)")};t.then(e).catch(e)}}getCurrentFrame(){const e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;const t=e.getContext("2d");if(!t)return ao.error("create canvas context failed!"),new ImageData(2,2);t.drawImage(this.videoElement,0,0,e.width,e.height);const r=t.getImageData(0,0,e.width,e.height);return e.remove(),r}async getCurrentFrameToUint8Array(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const r=document.createElement("canvas");r.width=this.videoElement.videoWidth,r.height=this.videoElement.videoHeight;const n=r.getContext("2d");return n?(n.drawImage(this.videoElement,0,0,r.width,r.height),new wb(((n,i)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await uC(e);n({buffer:t,width:r.width,height:r.height})}else i(new xn(Un.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,t<0?.1:t>1?1:t)}))):await cC(e)}destroy(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.isDestroyed=!0,Ub.off(xo.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),Ub.off(xo.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),e?this.videoElement.pause():this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=tl.VideoStateStopped}initVideoElement(){if(this._videoElementStatus!==el.NONE&&this._videoElementStatus!==el.DESTROYED||(this.videoElementStatus=el.INIT),!this.videoElementCheckInterval&&(uw.forEach((e=>{this.videoElement.addEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((()=>{this._isInPage=function(e){return e!==document.body&&document.body.contains(e)}(this.videoElement)}),1e3),Hi("ENABLE_VIDEO_FRAME_CALLBACK"))){var e,t;let r;const n=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",n),this.videoElementFreezeTimeout=window.setTimeout(i,Hi("VIDEO_FREEZE_DURATION")))},i=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===tl.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=tl.VideoStateFrozen:document.addEventListener("visibilitychange",n))},o=(e,t)=>{if(this.videoElementStatus===el.PLAYING){if(r){const e=t.presentationTime-r.presentationTime,n=t.presentedFrames-r.presentedFrames;this._render_interframe_delays_sizes.push(n),this._render_interframe_delays.push(e);const o=bi(this._render_interframe_delays_sizes),s=o-this._render_interframe_delays_sizes[0];if(o>30&&s>5&&(this._render_interframe_delays_sizes.shift(),this._render_interframe_delays.shift()),this.videoState===tl.VideoStateStarting&&(this.videoState=tl.VideoStateDecoding),this.videoState===tl.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(i,Hi("VIDEO_FREEZE_DURATION"))),e<Hi("VIDEO_FREEZE_DURATION")&&this.videoState===tl.VideoStateFrozen&&(this.videoState=tl.VideoStateDecoding),e>Hi("VIDEO_FREEZE_DURATION")&&SN.lastVisibleTime>=SN.lastHiddenTime&&r.timestamp>SN.lastVisibleTime&&r.timestamp>SN.lastHiddenTime){const t=Math.min(66,aw(this._render_interframe_delays_sizes,this._render_interframe_delays)),r=Math.max(0,e-(n-1)*t),i=r>t?r:0;this.renderFreezeAccTime2+=i,this.totalFreezeTime+=i,this.renderFreezeAccTime+=e}}r=sw(sw({},t),{},{timestamp:e})}else this.isSkipCalcRenderFreezeTime()&&(r=sw(sw({},t),{},{timestamp:e}));var n,s;Hi("ENABLE_VIDEO_FRAME_CALLBACK")&&(this.cancelRVFId=null===(n=(s=this.videoElement).requestVideoFrameCallback)||void 0===n?void 0:n.call(s,o))};this.cancelRVFId=null===(e=(t=this.videoElement).requestVideoFrameCallback)||void 0===e?void 0:e.call(t,o)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),wn()&&!Hi("HIDE_NO_POSTER")&&(this.videoElement.poster="noposter");const r=an();if(this.config.noStyle||("Safari"===r.name&&15===Number(r.version)||vn()||!this.config.mirror||(this.videoElement.style.transform="rotateY(180deg)"),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover"),this.videoElement.setAttribute("muted",""),this.videoElement.muted=!0,this.videoElement.srcObject&&this.videoElement.srcObject instanceof MediaStream){this.videoElement.srcObject.getVideoTracks()[0]!==this.videoTrack&&(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,En()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,En()&&this.videoElement.load();const n=this.videoElement.play();void 0!==n&&n.catch((e=>{ao.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){var e,t;(uw.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.cancelRVFId&&this.videoElement)&&(null===(e=(t=this.videoElement).cancelVideoFrameCallback)||void 0===e||e.call(t,this.cancelRVFId),this.cancelRVFId=void 0);this.videoElementStatus=el.NONE}isSkipCalcRenderFreezeTime(){return this.videoElementStatus===el.DESTROYED||this.internal}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{ao.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{ao.error(e)})),this.autoplayFailed=!1,Nn()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};Nn()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),jO()}}const uw=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class dw extends cw{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super(e),JT(this,"container",void 0),JT(this,"slot",void 0),this.slot=e.element,this.internal=t,this.updateConfig(e)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;var r;!this.internal||this.slot?(t!==this.slot&&(this.destroy(),this.slot=t),this.createElements()):(this.slot=t,t&&this.container?(this.internal=!1,this.container.id="agora-video-player-".concat(this.trackId),this.videoElement.id="video_".concat(this.trackId),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover",null===(r=this.slot)||void 0===r||r.appendChild(this.container)):this.createElements())}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}play(e){var t;null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)&&super.play(e)}getCurrentFrame(){var e;return null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)?super.getCurrentFrame():new ImageData(2,2)}async getCurrentFrameToUint8Array(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)?await super.getCurrentFrameToUint8Array(e,r):await cC(e)}destroy(){if(super.destroy(),this.videoElement.remove(),this.videoElement=document.createElement("video"),this.container){try{var e;this.container.remove(),null===(e=this.slot)||void 0===e||e.removeChild(this.container)}catch(e){}this.container=void 0}}createElements(){var e;this.container||(this.container=document.createElement("div")),this.container.id="agora-video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.videoTrack?(this.container.style.backgroundColor="black",Hi("KEEP_LAST_FRAME")&&this.isKeepLastFrame&&this.videoElement.paused&&this.resetVideoElement(),this.mountedVideoElement()):this.unmountedVideoElement(),null===(e=this.slot)||void 0===e||e.appendChild(this.container)}mountedVideoElement(){var e;!this.container||null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)||this.container.appendChild(this.videoElement),super.initVideoElement(),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="agora_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.style.left="0",this.videoElement.style.top="0"}unmountedVideoElement(){var e;if(null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)){super.resetVideoElement();try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=document.createElement("video")}}resetVideoElement(){var e;null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)&&(super.resetVideoElement(),this.cacheVideoElement=this.videoElement,this.videoElement=document.createElement("video"))}getContainerElement(){return this.container}}var lw,hw,pw,fw,Ew,mw,_w,Tw,gw,Sw,Rw,vw,yw,Aw,bw,Ow,Iw,Cw,ww,Nw,Pw,Dw,Lw,kw,Mw,Uw,xw,Vw,Fw,Bw,jw,Gw,Ww,Hw,Kw,Yw,Xw,Zw;function zw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Jw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zw(Object(r),!0).forEach((function(t){JT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zw(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let Qw=(lw=Io({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),hw=XO(),pw=Io({argsMap:e=>[e.getTrackId()]}),fw=wi("LocalVideoTrack","_enabledMutex"),Ew=Io({argsMap:(e,t)=>[e.getTrackId(),t]}),mw=XO(),_w=wi("LocalVideoTrack","_enabledMutex"),Tw=Io({argsMap:(e,t)=>[e.getTrackId(),t]}),gw=XO(),Sw=Io({argsMap:(e,t)=>[e.getTrackId(),t,e._saveEncodeBitrateRatio]}),Rw=XO(),vw=Io({argsMap:(e,t)=>[e.getTrackId(),t]}),yw=XO(),Aw=XO(),bw=Io({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),Ow=XO(),Iw=XO(),Cw=XO(),ww=Io({argsMap:e=>[e.getTrackId()]}),Nw=XO(),Pw=XO(),Dw=XO(),Lw=XO(),kw=XO(),Mw=Io({argsMap:(e,t)=>[e.getTrackId(),t.name]}),Uw=Io({argsMap:e=>[e.getTrackId()]}),xw=Io({argsMap:e=>[e.getTrackId()]}),Vw=Io({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),Fw=class e extends Pb{get videoHeight(){if(pn()){const e=this._mediaStreamTrack.getSettings().height;return this._videoHeight=e,this._videoHeight}return this._videoHeight}get videoWidth(){if(pn()){const e=this._mediaStreamTrack.getSettings().width;return this._videoWidth=e,this._videoWidth}return this._videoWidth}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==el.PLAYING)}get processorDestination(){return this._processorDestination}get processorContext(){return this._processorContext}set processorContext(e){this._processorContext=e}get __className__(){return"LocalVideoTrack"}constructor(e,t,r,n,i,o){if(super(e,i),JT(this,"trackMediaType",Wd.VIDEO),JT(this,"_player",void 0),JT(this,"isUseScaleResolutionDownBy",!1),JT(this,"_videoVisibleTimer",null),JT(this,"_previousVideoVisibleStatus",void 0),JT(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),JT(this,"_encoderConfig",void 0),JT(this,"_scalabilityMode",{numSpatialLayers:1,numTemporalLayers:1}),JT(this,"_optimizationMode",void 0),JT(this,"_saveEncodeBitrateRatio",1),JT(this,"_videoHeight",void 0),JT(this,"_videoWidth",void 0),JT(this,"_forceBitrateLimit",void 0),JT(this,"_enabled",!0),JT(this,"_processorDestination",void 0),JT(this,"_processorContext",void 0),JT(this,"_usePipeMode",!1),JT(this,"_useExtensionMode",!1),JT(this,"_extensionManager",void 0),pn()){const t=e.getSettings(),r=t.width,n=t.height;this._videoWidth=r,this._videoHeight=n}else this.updateMediaStreamTrackResolution();if(this._scalabilityMode=r,this._optimizationMode=n,this._hints=o||[],t&&-1!==this._hints.indexOf(Ud.CUSTOM_TRACK)?this._encoderConfig=hi(t):this._encoderConfig=t,-1===this._hints.indexOf(Ud.SCREEN_TRACK))this.updateBitrateFromProfile();else if(Tn(rn.CHROME,115)&&-1!==un().indexOf("Windows")){const t=dC(e);t&&(ao.info("local screen video track begin to inject frame"),this._mediaStreamTrack=t)}t&&-1!==this._hints.indexOf(Ud.CUSTOM_TRACK)&&this.setEncoderConfiguration(t),this._processorContext=new sI(this.getTrackId(),"local"),this._processorDestination=new oI(this.processorContext),this.bindProcessorDestinationEvents()}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e){const t=document.getElementById(e);t?e=t:(ao.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}ao.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=Jw(Jw(Jw({},this._getDefaultPlayerConfig()),t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new cw(r):this._player=new dw(r),this._player.updateVideoTrack(this._mediaStreamTrack)),this._player.play(),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(jd.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),Hi("CHECK_VIDEO_VISIBLE_INTERVAL"))}stop(){this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(),this._player=void 0,ao.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(ao.info("[".concat(this.getTrackId(),"] start setEnabled"),e),!e){this._originMediaStreamTrack.enabled=!1;try{await ri(this,Md.NEED_DISABLE_TRACK,this)}catch(e){throw ao.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return t||(this._enabled=!1),void ao.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await ri(this,Md.NEED_ENABLE_TRACK,this)}catch(e){throw ao.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}ao.info("[".concat(this.getTrackId(),"] setEnabled to true success")),t||(this._enabled=!0)}async setMuted(e){e!==this._muted&&(this.stateCheck("muted",e),this._muted=e,this._originMediaStreamTrack.enabled=!e,ao.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await ri(this,Md.NEED_MUTE_TRACK,this):await ri(this,Md.NEED_UNMUTE_TRACK,this))}async setSaveEncodeBitrateRatio(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._saveEncodeBitrateRatio;if(1!==this._saveEncodeBitrateRatio&&this._encoderConfig&&this._encoderConfig.bitrateMax&&this._encoderConfig.bitrateMin){this._encoderConfig.bitrateMin=Math.floor(this._encoderConfig.bitrateMin*e),this._encoderConfig.bitrateMax=Math.floor(this._encoderConfig.bitrateMax*e),ao.debug("[".concat(this.getTrackId(),"] set save encode bitrate ratio, ").concat(e)),this._saveEncodeBitrateRatio=1;try{await ri(this,Md.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(ao)}}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new xn(Un.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");if(e=yd(e),Hi("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin),e.width||e.height||e.frameRate){const t=hI({encoderConfig:e});(pn()||mn()||bn())&&(t.deviceId=void 0),ao.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(e),JSON.stringify(t));try{await this._originMediaStreamTrack.applyConstraints(t),this.updateMediaStreamTrackResolution()}catch(e){const t=new xn(Un.UNEXPECTED_ERROR,e.toString());throw ao.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=e,-1===this._hints.indexOf(Ud.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await ri(this,Md.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(ao)}}getStats(){Ei((()=>{ao.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const e=ni(this,Md.GET_STATS);return e||Jw({},Xd)}async setBeautyEffect(e){ao.error("LocalVideoTrack.setBeautyEffect was deprecated, please migrate to agora-extension-beauty-effect")}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}async getCurrentFrameImage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._player?this._player.getCurrentFrameToUint8Array(e,t):await cC(e)}async findClosestProfile(){const e=this.getMediaStreamTrackSettings(),t=e.width,r=e.height,n=e.frameRate,i=this._encoderConfig||{},o=i.width,s=i.height,a=i.frameRate,c=Ai(this._videoWidth||t||o||0),u=Ai(this._videoHeight||r||s||0),d=iC(c,u,Ai(n||a||15));if(d)return ao.debug("[".concat(this.getTrackId(),"] find closest profile, ").concat(c,"x").concat(u," => ").concat(JSON.stringify(d))),this.setEncoderConfiguration(d)}async setBitrateLimit(e){ao.debug("[".concat(this.getTrackId(),"] set bitrate limit, ").concat(JSON.stringify(e))),e&&(this._forceBitrateLimit=e,this._encoderConfig&&(this._encoderConfig.bitrateMax?this._encoderConfig.bitrateMax=this._encoderConfig.bitrateMax<e.max_bitrate?this._encoderConfig.bitrateMax:e.max_bitrate:this._encoderConfig.bitrateMax=e.max_bitrate,this._encoderConfig.bitrateMin,this._encoderConfig.bitrateMin=e.min_bitrate))}async setOptimizationMode(e){if("motion"!==e&&"detail"!==e&&"balanced"!==e)return void ao.error(Un.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const t=this._optimizationMode;try{this._optimizationMode=e,await ri(this,Md.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){throw this._optimizationMode=t,ao.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}ao.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(e,")"))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return ao.error(Un.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,ao.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){lI(this._originMediaStreamTrack).then((e=>{let t=VO(e,2),r=t[0],n=t[1];this._videoHeight=n,this._videoWidth=r})).catch(gi)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}async setSenderConfiguration(e){if(!this._enabled)throw new xn(Un.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");ao.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(e)),e=yd(e),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin),this._encoderConfig=e,-1===this._hints.indexOf(Ud.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await ri(this,Md.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(ao)}}updateBitrateFromProfile(){if(!this._encoderConfig)return;const e=this.getMediaStreamTrackSettings(),t=e.width,r=e.height,n=e.frameRate;if(!t||!r||!n)return;const i=this._encoderConfig,o=i.bitrateMax,s=i.bitrateMin;if(null==s||null==o){const e=oC(t,r,n,s,o),i=e.max,a=e.min;if(this._encoderConfig.bitrateMin=a,this._encoderConfig.bitrateMax=i,Hi("VIDEO_STANDARD_BITRATE_VERSION")&&null==s&&null==o){const e=VO(nC(t,r,n),2),i=e[0],o=e[1];this._encoderConfig.bitrateMax=i,this._encoderConfig.bitrateMin=a?Math.min(a,i):i,this._saveEncodeBitrateRatio=o,ao.debug("[".concat(this.getTrackId(),"] update new bitrate from profile, [w: ").concat(t,", h: ").concat(r,", fps: ").concat(n,"] => [brMax: ").concat(this._encoderConfig.bitrateMax,", brMin: ").concat(this._encoderConfig.bitrateMin,", save_bitrate_ratio: ").concat(this._saveEncodeBitrateRatio,"]"))}else ao.debug("[".concat(this.getTrackId(),"] update bitrate from profile, [w: ").concat(t,", h: ").concat(r,", fps: ").concat(n,"] => [brMax: ").concat(i,", brMin: ").concat(a,"]")),this._saveEncodeBitrateRatio=1}}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),n={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},i=n.element,o=n.slot;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=Kn.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Co.reportApiInvoke(null,{tag:qn.TRACER,name:Qn.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE,options:[this.getTrackId()]});t.visible?e.onSuccess("Video is visible"):e.onSuccess("Invisible because of ".concat(t.reason))}return t}return}catch(e){throw new xn(Un.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}async renewMediaStreamTrack(e){}_ensureVideoExtensionManager(e){return this._extensionManager||(this._extensionManager=e.createVideoExtensionManager(this),this._extensionManager.onOutputTrackChanged=e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),ri(this,Md.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),ri(this,Md.NEED_REPLACE_TRACK,this))},this._extensionManager.onEmpty=()=>{this._useExtensionMode=!1,this._extensionManager=void 0}),this._extensionManager}useExtension(e,t){if(this._usePipeMode)throw new xn(Un.INVALID_OPERATION,"Cannot use useExtension() when pipe() mode is active. Call unpipe() first.");return this._ensureVideoExtensionManager(e),this._useExtensionMode=!0,this._extensionManager.useExtension(e,t)}removeExtension(e){if(!this._extensionManager)return!1;const t=this._extensionManager.removeExtension(e);return t&&ao.info("[".concat(this.getTrackId(),"] removeExtension: ").concat(e.name)),this._extensionManager.hasExtensions||(this._useExtensionMode=!1),t}pipe(e){if(this._useExtensionMode)throw new xn(Un.INVALID_OPERATION,"Cannot use pipe() when useExtension() mode is active. Call removeExtension() for all extensions first.");if(this.processor===e)return e;if(e._source)throw new xn(Un.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this._usePipeMode=!0,this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,context:this.processorContext}),e}unpipe(){if(!this.processor)return;const e=this.processor;this.processor._source=void 0,this.processor=void 0,this._usePipeMode=!1,e.reset()}close(){super.close(),this.unbindProcessorDestinationEvents(),this.unbindProcessorContextEvents(),this.unpipe(),this.processorDestination._source&&this.processorDestination._source.unpipe(),this._extensionManager&&(this._extensionManager.destroy(),this._extensionManager=void 0,this._useExtensionMode=!1)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._encoderConfig;t&&(n=Jw(Jw({},n),yd(t))),n=pi(n);const i=Ti(8,"track-video-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,n,pi(this._scalabilityMode),this._optimizationMode,i,pi(this._hints));return t&&n&&o.setEncoderConfiguration(n),ao.debug("clone video track from ".concat(this.getTrackId()," to ").concat(i,", clone ").concat(r)),o}async replaceTrack(e,t){if(!(e instanceof MediaStreamTrack))throw new xn(Un.INVALID_PARAMS,"track should be an instance of MediaStreamTrack");if("video"!==e.kind)throw new xn(Un.INVALID_PARAMS,"track should be a video MediaStreamTrack");await this._updateOriginMediaStreamTrack(e,t,!0),this.updateMediaStreamTrackResolution()}sendSeiData(e){if(Ei((()=>{Co.reportApiInvoke(null,{name:Qn.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:qn.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!Hi("ENABLE_VIDEO_SEI")||!Hi("ENABLE_ENCODED_TRANSFORM"))return void ao.warning('To send/receive SEI, please call AgoraRTC.setParameter("ENABLE_VIDEO_SEI", true) before instantiate IAgoraRtcClient');if(e instanceof Uint8Array==!1)return new xn(Un.INVALID_PARAMS,"Invalid argument type, ILocalVideoTrack.sendSeiData() only accept Uint8Array argument.").throw();const t=this.getRTCRtpTransceiver();if(!t)return void ao.warning("Video track is not published, SEI can not be send");const r=t.sender.getParameters();if(0===r.codecs.length)return;const n=r.codecs[0].mimeType.toLocaleLowerCase();"video/h264"===n||"video/h265"===n?this.safeEmit("sei-to-send",e):ao.warning("SEI is not supported by ".concat(n))}bindProcessorDestinationEvents(){this.processorDestination.on(Jd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await ri(this,Md.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await ri(this,Md.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(Jd.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(Qd.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(Qd.REQUEST_CONSTRAINTS)}},pS(Fw.prototype,"play",[lw,hw],Object.getOwnPropertyDescriptor(Fw.prototype,"play"),Fw.prototype),pS(Fw.prototype,"stop",[pw],Object.getOwnPropertyDescriptor(Fw.prototype,"stop"),Fw.prototype),pS(Fw.prototype,"setEnabled",[fw,Ew,mw],Object.getOwnPropertyDescriptor(Fw.prototype,"setEnabled"),Fw.prototype),pS(Fw.prototype,"setMuted",[_w,Tw,gw],Object.getOwnPropertyDescriptor(Fw.prototype,"setMuted"),Fw.prototype),pS(Fw.prototype,"setSaveEncodeBitrateRatio",[Sw,Rw],Object.getOwnPropertyDescriptor(Fw.prototype,"setSaveEncodeBitrateRatio"),Fw.prototype),pS(Fw.prototype,"setEncoderConfiguration",[vw,yw],Object.getOwnPropertyDescriptor(Fw.prototype,"setEncoderConfiguration"),Fw.prototype),pS(Fw.prototype,"getStats",[Aw],Object.getOwnPropertyDescriptor(Fw.prototype,"getStats"),Fw.prototype),pS(Fw.prototype,"setBeautyEffect",[bw,Ow],Object.getOwnPropertyDescriptor(Fw.prototype,"setBeautyEffect"),Fw.prototype),pS(Fw.prototype,"getCurrentFrameData",[Iw],Object.getOwnPropertyDescriptor(Fw.prototype,"getCurrentFrameData"),Fw.prototype),pS(Fw.prototype,"getCurrentFrameImage",[Cw],Object.getOwnPropertyDescriptor(Fw.prototype,"getCurrentFrameImage"),Fw.prototype),pS(Fw.prototype,"findClosestProfile",[ww,Nw],Object.getOwnPropertyDescriptor(Fw.prototype,"findClosestProfile"),Fw.prototype),pS(Fw.prototype,"setBitrateLimit",[Pw],Object.getOwnPropertyDescriptor(Fw.prototype,"setBitrateLimit"),Fw.prototype),pS(Fw.prototype,"setOptimizationMode",[Dw],Object.getOwnPropertyDescriptor(Fw.prototype,"setOptimizationMode"),Fw.prototype),pS(Fw.prototype,"setScalabiltyMode",[Lw],Object.getOwnPropertyDescriptor(Fw.prototype,"setScalabiltyMode"),Fw.prototype),pS(Fw.prototype,"updateMediaStreamTrackResolution",[kw],Object.getOwnPropertyDescriptor(Fw.prototype,"updateMediaStreamTrackResolution"),Fw.prototype),pS(Fw.prototype,"pipe",[Mw],Object.getOwnPropertyDescriptor(Fw.prototype,"pipe"),Fw.prototype),pS(Fw.prototype,"unpipe",[Uw],Object.getOwnPropertyDescriptor(Fw.prototype,"unpipe"),Fw.prototype),pS(Fw.prototype,"close",[xw],Object.getOwnPropertyDescriptor(Fw.prototype,"close"),Fw.prototype),pS(Fw.prototype,"replaceTrack",[Vw],Object.getOwnPropertyDescriptor(Fw.prototype,"replaceTrack"),Fw.prototype),Fw),qw=(Bw=Io({argsMap:(e,t)=>[e.getTrackId(),t]}),jw=XO(),Gw=wi("CameraVideoTrack","_enabledMutex"),Ww=Io({argsMap:(e,t)=>[e.getTrackId(),t]}),Hw=XO(),Kw=Io({argsMap:(e,t)=>[e.getTrackId(),t]}),Yw=XO(),Xw=Io({argsMap:e=>[e.getTrackId()]}),Zw=class e extends Qw{get __className__(){return"CameraVideoTrack"}constructor(e,t,r,n,i,o){super(e,yd(t.encoderConfig),n,i,o),JT(this,"_config",void 0),JT(this,"_originalConstraints",void 0),JT(this,"_constraints",void 0),JT(this,"_enabled",!0),JT(this,"_deviceName","default"),JT(this,"tryResumeVideoForIOS15_16WeChat",(async()=>{!vn()&&!yn()||function(){const e=an();if(e.os!==tn.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()||an().name!==rn.WECHAT||!this._enabled||this._isClosed||(ao.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS 15 device on WeChat.")),await this.renewMediaStreamTrack())})),this._config=t,this._originalConstraints=r,this._constraints=r,this._deviceName=e.label,this._encoderConfig=yd(this._config.encoderConfig),Ub.on(xo.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),Ub.on(xo.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),this.bindProcessorContextEvents()}async setDevice(e){return"string"==typeof e?this._setDeviceById(e):e.deviceId?this._setDeviceById(e.deviceId):e.facingMode?this._setDeviceByFacingModel(e.facingMode):void 0}async _setDeviceById(e){if(ao.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await sO.getDeviceById(e),r={};r.video=Jw({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let n=null;try{n=await tO(r,this.getTrackId())}catch(e){throw ao.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await tO({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(n.getVideoTracks()[0],!1),e}await this._updateOriginMediaStreamTrack(n.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution(),this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw ao.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await sO.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw ao.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}ao.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){ao.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:Jw(Jw({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await tO(t,this.getTrackId())}catch(t){throw ao.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await tO({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1),t}await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution()}this._deviceName="",this._config.facingMode=e,this._config.cameraId=void 0,this._constraints=Jw({},t.video),ao.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(ao.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await tO({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await ri(this,Md.NEED_ENABLE_TRACK,this)}catch(e){throw ao.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),ao.info("[".concat(this.getTrackId(),"] setEnabled to true success")),t||(this._enabled=!0)}else{this.isExternalTrack?this._originMediaStreamTrack.enabled=!1:(this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop()),t||(this._enabled=!1);try{await ri(this,Md.NEED_DISABLE_TRACK,this)}catch(e){throw ao.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}ao.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new xn(Un.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");e=yd(e),Hi("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate||e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate||e.bitrateMin);const r=hi(this._config);r.encoderConfig=e;const n=hI(r);(pn()||mn()||bn())&&(n.deviceId=void 0),ao.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(e),JSON.stringify(n));try{await this._originMediaStreamTrack.applyConstraints(n),this.updateMediaStreamTrackResolution()}catch(e){const t=new xn(Un.UNEXPECTED_ERROR,e.toString());throw ao.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}this._config=r,this._constraints=n,this._originalConstraints=n,this._encoderConfig=e,-1===this._hints.indexOf(Ud.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await ri(this,Md.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(ao)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((mn()||bn())&&this._enabled&&!this._isClosed&&Ub.duringInterruption){const e=async()=>{Ub.off(xo.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(ao.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};Ub.on(xo.IOS_INTERRUPTION_END,e)}else ao.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(jd.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=sO.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await tO({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),Ub.off(xo.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),Ub.off(xo.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._encoderConfig;t&&(n=Jw(Jw({},n),yd(t))),n=pi(n);const i=Ti(8,"track-cam-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,pi(Jw(Jw({},this._config),{},{encoderConfig:n})),pi(this._constraints),pi(this._scalabilityMode),this._optimizationMode,i);return t&&n&&o.setEncoderConfiguration(n),ao.debug("clone track from ".concat(this.getTrackId()," to ").concat(i,", clone ").concat(r)),o}bindProcessorContextEvents(){this.processorContext.on(Qd.REQUEST_UPDATE_CONSTRAINTS,(async(e,t,r)=>{try{const r=Object.assign({},this._originalConstraints,...e);await this.renewMediaStreamTrack(r),t()}catch(e){r(e)}})),this.processorContext.on(Qd.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}},pS(Zw.prototype,"setDevice",[Bw,jw],Object.getOwnPropertyDescriptor(Zw.prototype,"setDevice"),Zw.prototype),pS(Zw.prototype,"setEnabled",[Gw,Ww,Hw],Object.getOwnPropertyDescriptor(Zw.prototype,"setEnabled"),Zw.prototype),pS(Zw.prototype,"setEncoderConfiguration",[Kw,Yw],Object.getOwnPropertyDescriptor(Zw.prototype,"setEncoderConfiguration"),Zw.prototype),pS(Zw.prototype,"close",[Xw],Object.getOwnPropertyDescriptor(Zw.prototype,"close"),Zw.prototype),Zw);function $w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function eN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$w(Object(r),!0).forEach((function(t){JT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$w(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function tN(e,t,r,n){r.optimizationMode&&(n&&n.width&&n.height?(r.encoderConfig=eN(eN({},n),{},{bitrateMin:n.bitrateMin,bitrateMax:n.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?ao.debug("[".concat(e,"] set content hint to"),r.optimizationMode):ao.debug("[".concat(e,"] set content hint failed")))):ao.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}var rN,nN,iN,oN,sN,aN,cN,uN,dN,lN,hN,pN,fN;function EN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function mN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?EN(Object(r),!0).forEach((function(t){JT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class _N extends Nb{getUserId(){return this._userId}constructor(e,t,r,n){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(n.clientId,"_").concat(Ti(5,""))),JT(this,"_userId",void 0),JT(this,"_uintId",void 0),JT(this,"_isDestroyed",!1),JT(this,"store",void 0),JT(this,"processor",void 0),JT(this,"processorContext",void 0),this._userId=t,this._uintId=r,this.store=n}_updateOriginMediaStreamTrack(e){this._originMediaStreamTrack=e,this._mediaStreamTrack=e,this._updatePlayerSource(),this.processor&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this.processorContext})}_destroy(){this._isDestroyed=!0,ao.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}let TN=(rN=Io({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),nN=Io({argsMap:e=>[e.getTrackId()]}),iN=Io({argsMap:(e,t)=>[e.getTrackId(),t.name]}),oN=Io({argsMap:e=>[e.getTrackId()]}),sN=class extends _N{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==el.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,n,i){super(e,t,r,n),JT(this,"_videoVisibleTimer",null),JT(this,"_previousVideoVisibleStatus",void 0),JT(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),JT(this,"trackMediaType",Wd.VIDEO),JT(this,"_videoWidth",void 0),JT(this,"_videoHeight",void 0),JT(this,"_player",void 0),JT(this,"_prePlayer",void 0),JT(this,"processorDestination",void 0),JT(this,"processorContext",void 0),JT(this,"_usePipeMode",!1),JT(this,"_useExtensionMode",!1),JT(this,"_extensionManager",void 0),this._prePlayer=i,this.updateMediaStreamTrackResolution(),this.processorContext=new sI(this.getTrackId(),"remote"),this.processorDestination=new oI(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){Ei((()=>{ao.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return ni(this,Md.GET_STATS)||mN({},zd)}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.safeEmit(Gd.PLAY_START),"string"==typeof e){const t=document.getElementById(e);t?e=t:(ao.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}ao.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=mN(mN({fit:"cover"},t),{},{trackId:this.getTrackId(),element:e});if(this._player)this._player.updateConfig(r);else{let t=!1,n=!1;const i=this._prePlayer&&!this._prePlayer.isDestroyed&&e===this._prePlayer.config.element;this._prePlayer&&!i&&(this._prePlayer.destroy(),n=!0),i?(this._player=this._prePlayer,t=this._player.videoState>0,this._player.updateConfig(r)):this._player=e instanceof HTMLVideoElement?new cw(r):new dw(r),this._prePlayer=void 0,this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(Gd.FIRST_FRAME_DECODED),n&&this.safeEmit(Gd.FIRST_FRAME_RENDER)},this._player.onVideoStateChanged=e=>{this.safeEmit(Gd.VIDEO_STATE_CHANGED,e)},t&&(this._player.onFirstVideoFrameDecoded(),this._player.onVideoStateChanged(this._player.videoState))}this._player.play(this.store.sessionId||void 0),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(Gd.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),Hi("CHECK_VIDEO_VISIBLE_INTERVAL")),this.safeEmit(Gd.PLAY_END)}stop(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(e),this._player=void 0,ao.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){lI(this._originMediaStreamTrack).then((e=>{let t=VO(e,2),r=t[0],n=t[1];this._videoHeight=n,this._videoWidth=r})).catch(gi)}_updatePlayerSource(){ao.debug("[".concat(this.getTrackId(),"] update player source track")),this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),n={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},i=n.element,o=n.slot;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=Kn.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Co.reportApiInvoke(null,{tag:qn.TRACER,name:Qn.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE,options:[this.getTrackId()]});t.visible?e.onSuccess("Video is visible"):e.onSuccess("Invisible because of ".concat(t.reason))}return t}return}catch(e){throw new xn(Un.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}_ensureVideoExtensionManager(e){return this._extensionManager||(this._extensionManager=e.createVideoExtensionManager(this),this._extensionManager.onOutputTrackChanged=e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource()):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())},this._extensionManager.onEmpty=()=>{this._useExtensionMode=!1,this._extensionManager=void 0}),this._extensionManager}useExtension(e,t){if(this._usePipeMode)throw new xn(Un.INVALID_OPERATION,"Cannot use useExtension() when pipe() mode is active. Call unpipe() first.");return this._ensureVideoExtensionManager(e),this._useExtensionMode=!0,this._extensionManager.useExtension(e,t)}removeExtension(e){if(!this._extensionManager)return!1;const t=this._extensionManager.removeExtension(e);return t&&ao.info("[".concat(this.getTrackId(),"] removeExtension: ").concat(e.name)),this._extensionManager.hasExtensions||(this._useExtensionMode=!1),t}pipe(e){if(this._useExtensionMode)throw new xn(Un.INVALID_OPERATION,"Cannot use pipe() when useExtension() mode is active. Call removeExtension() for all extensions first.");if(this.processor===e)return e;if(e._source)throw new xn(Un.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this._usePipeMode=!0,this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,context:this.processorContext}),e}unpipe(){if(!this.processor)return;const e=this.processor;this.processor._source=void 0,this.processor=void 0,this._usePipeMode=!1,e.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(Jd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource()):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(Jd.ON_TRACK)}_destroy(){this._prePlayer&&(this._prePlayer.destroy(),this._prePlayer=void 0),this._extensionManager&&(this._extensionManager.destroy(),this._extensionManager=void 0,this._useExtensionMode=!1),super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(e,t){this.emit(Bd.SEI_RECEIVED,e,t)}},pS(sN.prototype,"play",[rN],Object.getOwnPropertyDescriptor(sN.prototype,"play"),sN.prototype),pS(sN.prototype,"stop",[nN],Object.getOwnPropertyDescriptor(sN.prototype,"stop"),sN.prototype),pS(sN.prototype,"pipe",[iN],Object.getOwnPropertyDescriptor(sN.prototype,"pipe"),sN.prototype),pS(sN.prototype,"unpipe",[oN],Object.getOwnPropertyDescriptor(sN.prototype,"unpipe"),sN.prototype),sN),gN=(aN=Io({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),cN=Io({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),uN=Io({argsMap:(e,t)=>[e.getTrackId(),t]}),dN=Io({argsMap:e=>[e.getTrackId()]}),lN=Io({argsMap:e=>[e.getTrackId()]}),hN=Io({argsMap:(e,t)=>[e.getTrackId(),t.name]}),pN=Io({argsMap:e=>[e.getTrackId()]}),fN=class extends _N{get isPlaying(){return this._useAudioElement?YO.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(e,t,r,n){super(e,t,r,n),JT(this,"trackMediaType",Wd.AUDIO),JT(this,"_source",void 0),JT(this,"_useAudioElement",!0),JT(this,"_volume",100),JT(this,"processorContext",void 0),JT(this,"processorDestination",void 0),JT(this,"_usePipeMode",!1),JT(this,"_useExtensionMode",!1),JT(this,"_extensionManager",void 0),JT(this,"_played",!1),JT(this,"_bypassWebAudio",!1),Hi("DISABLE_WEBAUDIO")?(this._source=new uI,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new zb(e,!0),Hi("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once(Hd.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(Gd.FIRST_FRAME_DECODED)})),this.processorContext=new cI(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new aI(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(Hd.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:this.processorContext})}))}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(Hd.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Hd.ON_AUDIO_BUFFER),this._source.on(Hd.ON_AUDIO_BUFFER,(t=>e(t)))}setVolume(e){this._volume=e,this._useAudioElement?YO.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}setAmplifiedVolume(e){this._useAudioElement&&this._played&&(YO.stop(this.getTrackId()),this._source.play()),this._useAudioElement=!1,e=Math.min(e,Hi("MAX_WEBAUDIO_VOLUME")),this._volume=e,this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!Do())throw new xn(Un.NOT_SUPPORTED,"your browser does not support setting the audio output device");await YO.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getVolume(){return this._useAudioElement?YO.getVolume(this.getTrackId()):this._source instanceof zb?this._source.getAudioVolume():0}getStats(){Ei((()=>{ao.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return ni(this,Md.GET_STATS)||mN({},Zd)}play(){if(ao.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement)ao.debug("[".concat(this.getTrackId(),"] use audio element to play")),YO.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0);else{var e;ao.debug("[".concat(this.getTrackId(),"] use audio context to play"));const t=null===(e=this._source.context)||void 0===e?void 0:e.state;t&&"running"!==t&&HO(this.store.sessionId||null,"audio","AudioContext state is ".concat(t),this.getTrackId()),this._source.play()}}stop(){ao.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?YO.stop(this.getTrackId()):this._source.stop()}_reusePreAudioElement(e,t){this._played=t,this._useAudioElement?(YO.reuseTrackId(e,this.getTrackId()),this._updatePlayerSource()):(YO.stop(e),this._updatePlayerSource(),t&&this._source.play()),this.setVolume(this._volume)}_destroy(){super._destroy(),this._played=!1,this._extensionManager&&(this._extensionManager.destroy(),this._extensionManager=void 0,this._useExtensionMode=!1),this.unbindProcessorDestinationEvents(),this._source.destroy()}_isFreeze(){return this._source.isFreeze}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];ao.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&YO.updateTrack(this.getTrackId(),this._mediaStreamTrack)}_ensureAudioExtensionManager(e){return this._extensionManager||(this._extensionManager=e.createAudioExtensionManager(this),this._extensionManager.onOutputTrackChanged=e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())}),this._extensionManager}useExtension(e){if(this._usePipeMode)throw new xn(Un.INVALID_OPERATION,"Cannot use useExtension() when pipe() mode is active. Call unpipe() first.");return this._ensureAudioExtensionManager(e),this._useExtensionMode=!0,this._extensionManager.useExtension(e)}removeExtension(e){if(!this._extensionManager)return!1;const t=this._extensionManager.removeExtension(e);return t&&ao.info("[".concat(this.getTrackId(),"] removeExtension: ").concat(e.name)),this._extensionManager.hasExtensions||(this._useExtensionMode=!1),t}addReferenceTrack(e){if(!this._extensionManager)throw new xn(Un.INVALID_OPERATION,"Call useExtension() before addReferenceTrack().");this._extensionManager.addReferenceTrack(e),ao.info("[".concat(this.getTrackId(),"] addReferenceTrack"))}removeReferenceTrack(e){return!!this._extensionManager&&this._extensionManager.removeReferenceTrack(e)}pipe(e){if(this._useExtensionMode)throw new xn(Un.INVALID_OPERATION,"Cannot use pipe() when useExtension() mode is active.");if(this._bypassWebAudio)throw new xn(Un.NOT_SUPPORTED,"can not pipe extension when WebAudio disabled");if(this.processor===e)return e;if(e._source)throw new xn(Un.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this._usePipeMode=!0,this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,node:this._source.processSourceNode,context:this.processorContext}),e}unpipe(){var e;if(this._bypassWebAudio)throw new xn(Un.NOT_SUPPORTED,"can not unpipe extension when WebAudio disabled");if(!this.processor)return;const t=this.processor;null===(e=this._source.processSourceNode)||void 0===e||e.disconnect(),this.processor._source=!1,this.processor=void 0,this._usePipeMode=!1,t.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(Jd.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())})),this.processorDestination.on(Jd.ON_NODE,(e=>{this._source.processedNode=e;const t=!e;this._useAudioElement!==t&&(this._played?(this.stop(),this._useAudioElement=t,this.play()):this._useAudioElement=t)}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(Jd.ON_TRACK),this.processorDestination.removeAllListeners(Jd.ON_NODE)}},pS(fN.prototype,"setVolume",[aN],Object.getOwnPropertyDescriptor(fN.prototype,"setVolume"),fN.prototype),pS(fN.prototype,"setAmplifiedVolume",[cN],Object.getOwnPropertyDescriptor(fN.prototype,"setAmplifiedVolume"),fN.prototype),pS(fN.prototype,"setPlaybackDevice",[uN],Object.getOwnPropertyDescriptor(fN.prototype,"setPlaybackDevice"),fN.prototype),pS(fN.prototype,"play",[dN],Object.getOwnPropertyDescriptor(fN.prototype,"play"),fN.prototype),pS(fN.prototype,"stop",[lN],Object.getOwnPropertyDescriptor(fN.prototype,"stop"),fN.prototype),pS(fN.prototype,"pipe",[hN],Object.getOwnPropertyDescriptor(fN.prototype,"pipe"),fN.prototype),pS(fN.prototype,"unpipe",[pN],Object.getOwnPropertyDescriptor(fN.prototype,"unpipe"),fN.prototype),fN);const SN=new class extends Xn{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),JT(this,"_lastHiddenTime",0),JT(this,"_lastVisibleTime",0),JT(this,"needUploadStats",[]),JT(this,"isCollectingStats",!1),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),this.isCollectingStats&&this.needUploadStats.push("visible"===document.visibilityState?1:0),ao.debug("current web page is ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}startCollectStats(){this.isCollectingStats=!0,this.needUploadStats.push("visible"===this.visibility?1:0)}stopCollectStats(){this.isCollectingStats=!1,this.needUploadStats.length=0}};class RN extends Xn{constructor(e,t){super(),JT(this,"trackMediaType",Wd.DATA),JT(this,"_version",1),JT(this,"_type",3),JT(this,"_config",void 0),JT(this,"_originDataChannel",void 0),JT(this,"_dataStreamPacketHeader",new ArrayBuffer(4)),JT(this,"_dataStreamPacketHandler",{serialize:e=>e,deserialize:e=>e}),JT(this,"_datachannelEventMap",new Map),this._config=e,t&&(this._originDataChannel=t,this._bandDataChannelEvents(t)),this._initPacketHeader()}useDataStream(e){this._dataStreamPacketHandler=e}get id(){return this._config.id}get ordered(){return this._config.ordered}get maxRetransmits(){return Hi("DATASTREAM_MAX_RETRANSMITS")}get metadata(){return this._config.metadata}get readyState(){var e,t;return null!==(e=null===(t=this._originDataChannel)||void 0===t?void 0:t.readyState)&&void 0!==e?e:"connecting"}get _originDataChannelId(){var e,t;return null!==(e=null===(t=this._originDataChannel)||void 0===t?void 0:t.id)&&void 0!==e?e:null}getChannelId(){return this.id}getConfig(){return this._config}_close(){this._originDataChannel&&(this._unbindDataChannelEvents(this._originDataChannel),this._originDataChannel=void 0)}async _waitTillOpen(){return new wb(((e,t)=>{if(this._originDataChannel){"open"===this._originDataChannel.readyState&&e();const r=setTimeout((()=>{var e;t(new xn(Un.DATACHANNEL_CONNECTION_TIMEOUT,"Cannot create datachannel, id: ".concat(null===(e=this._originDataChannel)||void 0===e?void 0:e.id)))}),1e4);this._originDataChannel.onopen=()=>{clearTimeout(r),this._originDataChannel&&this._bandDataChannelEvents(this._originDataChannel),e()},this._originDataChannel.onerror=()=>{throw clearTimeout(r),new xn(Un.DATACHANNEL_CONNECTION_TIMEOUT)}}else t(new xn(Un.DATACHANNEL_CONNECTION_TIMEOUT,"cannot find dataChannel"))}))}_updateOriginDataChannel(e){this._originDataChannel=e,this._bandDataChannelEvents(e)}_initPacketHeader(){const e=new DataView(this._dataStreamPacketHeader);e.setUint16(0,this._version),e.setUint8(2,this._type),e.setUint8(3,this._config.id)}_bandDataChannelEvents(e){this._unbindDataChannelEvents(e),[rl.OPEN,rl.CLOSE,rl.ERROR].forEach((t=>{const r=()=>{this.emit(t)};this._datachannelEventMap.set(t,r),e.addEventListener(t,r)}))}_unbindDataChannelEvents(e){Array.from(this._datachannelEventMap.entries()).forEach((t=>{let r=VO(t,2),n=r[0],i=r[1];e.removeEventListener(n,i)})),this._datachannelEventMap.clear()}}var vN=du,yN=Ho,AN=gu,bN=RangeError,ON=String.fromCharCode,IN=String.fromCodePoint,CN=yN([].join);vN({target:"String",stat:!0,arity:1,forced:!!IN&&1!==IN.length},{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,i=0;n>i;){if(AN(t=+arguments[i],1114111)!==t)throw new bN(t+" is not a valid code point");r[i++]=t<65536?ON(t):ON(55296+((t-=65536)>>10),t%1024+56320)}return CN(r,"")}});var wN=Vo,NN=Za("iterator"),PN=!wN((function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2&b=3"),n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),r.delete("a",2),r.delete("b",void 0),!e.toJSON||!r.has("a",1)||r.has("a",2)||!r.has("a",void 0)||r.has("b")||!t.size&&true||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[NN]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==n||"x"!==new URL("https://x",void 0).host})),DN=ap,LN=du,kN=Xo,MN=Mv,UN=Fs,xN=hs,VN=Ho,FN=us,BN=PN,jN=ap,GN=up,WN=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:DN(e,n,t[n],r);return e},HN=Lp,KN=p_,YN=zp,XN=YR,ZN=as,zN=ka,JN=Dc,QN=Qu,qN=Vc,$N=Ls,eP=ed,tP=Zh,rP=gs,nP=$S,iP=YS,oP=G_,sP=rv,aP=vI,cP=Za("iterator"),uP="URLSearchParams",dP=uP+"Iterator",lP=YN.set,hP=YN.getterFor(uP),pP=YN.getterFor(dP),fP=MN("fetch"),EP=MN("Request"),mP=MN("Headers"),_P=EP&&EP.prototype,TP=mP&&mP.prototype,gP=kN.TypeError,SP=kN.encodeURIComponent,RP=String.fromCharCode,vP=UN("String","fromCodePoint"),yP=parseInt,AP=VN("".charAt),bP=VN([].join),OP=VN([].push),IP=VN("".replace),CP=VN([].shift),wP=VN([].splice),NP=VN("".split),PP=VN("".slice),DP=VN(/./.exec),LP=/\+/g,kP=/^[0-9a-f]+$/i,MP=function(e,t){var r=PP(e,t,t+2);return DP(kP,r)?yP(r,16):NaN},UP=function(e){for(var t=0,r=128;r>0&&0!=(e&r);r>>=1)t++;return t},xP=function(e){var t=null,r=e.length;switch(r){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return null===t||t>1114111||t>=55296&&t<=57343||t<(r>3?65536:r>2?2048:r>1?128:0)?null:t},VP=function(e){for(var t=(e=IP(e,LP," ")).length,r="",n=0;n<t;){var i=AP(e,n);if("%"===i){if("%"===AP(e,n+1)||n+3>t){r+="%",n++;continue}var o=MP(e,n+1);if(o!=o){r+=i,n++;continue}n+=2;var s=UP(o);if(0===s)i=RP(o);else{if(1===s||s>4){r+="�",n++;continue}for(var a=[o],c=1;c<s&&!(++n+3>t||"%"!==AP(e,n));){var u=MP(e,n+1);if(u!=u||u>191||u<128)break;if(1===c){if(224===o&&u<160)break;if(237===o&&u>159)break;if(240===o&&u<144)break;if(244===o&&u>143)break}OP(a,u),n+=2,c++}if(a.length!==s){r+="�";continue}var d=xP(a);if(null===d){for(var l=0;l<s;l++)r+="�";n++;continue}i=vP(d)}}r+=i,n++}return r},FP=/[!'()~]|%20/g,BP={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},jP=function(e){return BP[e]},GP=function(e){return IP(SP(e),FP,jP)},WP=KN((function(e,t){lP(this,{type:dP,target:hP(e).entries,index:0,kind:t})}),uP,(function(){var e=pP(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,oP(void 0,!0);var n=t[r];switch(e.kind){case"keys":return oP(n.key,!1);case"values":return oP(n.value,!1)}return oP([n.key,n.value],!1)}),!0),HP=function(e){this.entries=[],this.url=null,void 0!==e&&($N(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===AP(e,0)?PP(e,1):e:eP(e)))};HP.prototype={type:uP,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,s,a,c=this.entries,u=iP(e);if(u)for(r=(t=nP(e,u)).next;!(n=xN(r,t)).done;){if(o=(i=nP(qN(n.value))).next,(s=xN(o,i)).done||(a=xN(o,i)).done||!xN(o,i).done)throw new gP("Expected sequence with length 2");OP(c,{key:eP(s.value),value:eP(a.value)})}else for(var d in e)zN(e,d)&&OP(c,{key:d,value:eP(e[d])})},parseQuery:function(e){if(e)for(var t,r,n=this.entries,i=NP(e,"&"),o=0;o<i.length;)(t=i[o++]).length&&(r=NP(t,"="),OP(n,{key:VP(CP(r)),value:VP(bP(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],OP(r,GP(e.key)+"="+GP(e.value));return bP(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var KP=function(){XN(this,YP);var e=lP(this,new HP(arguments.length>0?arguments[0]:void 0));FN||(this.size=e.entries.length)},YP=KP.prototype;if(WN(YP,{append:function(e,t){var r=hP(this);sP(arguments.length,2),OP(r.entries,{key:eP(e),value:eP(t)}),FN||this.size++,r.updateURL()},delete:function(e){for(var t=hP(this),r=sP(arguments.length,1),n=t.entries,i=eP(e),o=r<2?void 0:arguments[1],s=void 0===o?o:eP(o),a=0;a<n.length;){var c=n[a];c.key!==i||void 0!==s&&c.value!==s?a++:wP(n,a,1)}FN||(this.size=n.length),t.updateURL()},get:function(e){var t=hP(this).entries;sP(arguments.length,1);for(var r=eP(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=hP(this).entries;sP(arguments.length,1);for(var r=eP(e),n=[],i=0;i<t.length;i++)t[i].key===r&&OP(n,t[i].value);return n},has:function(e){for(var t=hP(this).entries,r=sP(arguments.length,1),n=eP(e),i=r<2?void 0:arguments[1],o=void 0===i?i:eP(i),s=0;s<t.length;){var a=t[s++];if(a.key===n&&(void 0===o||a.value===o))return!0}return!1},set:function(e,t){var r=hP(this);sP(arguments.length,2);for(var n,i=r.entries,o=!1,s=eP(e),a=eP(t),c=0;c<i.length;c++)(n=i[c]).key===s&&(o?wP(i,c--,1):(o=!0,n.value=a));o||OP(i,{key:s,value:a}),FN||(this.size=i.length),r.updateURL()},sort:function(){var e=hP(this);aP(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=hP(this).entries,n=JN(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new WP(this,"keys")},values:function(){return new WP(this,"values")},entries:function(){return new WP(this,"entries")}},{enumerable:!0}),jN(YP,cP,YP.entries,{name:"entries"}),jN(YP,"toString",(function(){return hP(this).serialize()}),{enumerable:!0}),FN&&GN(YP,"size",{get:function(){return hP(this).entries.length},configurable:!0,enumerable:!0}),HN(KP,uP),LN({global:!0,constructor:!0,forced:!BN},{URLSearchParams:KP}),!BN&&ZN(mP)){var XP=VN(TP.has),ZP=VN(TP.set),zP=function(e){if($N(e)){var t,r=e.body;if(QN(r)===uP)return t=e.headers?new mP(e.headers):new mP,XP(t,"content-type")||ZP(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),tP(e,{body:rP(0,eP(r)),headers:rP(0,t)})}return e};if(ZN(fP)&&LN({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return fP(e,arguments.length>1?zP(arguments[1]):{})}}),ZN(EP)){var JP=function(e){return XN(this,_P),new EP(e,arguments.length>1?zP(arguments[1]):{})};_P.constructor=JP,JP.prototype=_P,LN({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:JP})}}var QP,qP={URLSearchParams:KP,getState:hP},$P=us,eD=Ho,tD=hs,rD=Vo,nD=yh,iD=op,oD=ps,sD=Pa,aD=As,cD=Object.assign,uD=Object.defineProperty,dD=eD([].concat),lD=!cD||rD((function(){if($P&&1!==cD({b:1},cD(uD({},"a",{enumerable:!0,get:function(){uD(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!==cD({},e)[r]||nD(cD({},t)).join("")!==n}))?function(e,t){for(var r=sD(e),n=arguments.length,i=1,o=iD.f,s=oD.f;n>i;)for(var a,c=aD(arguments[i++]),u=o?dD(nD(c),o(c)):nD(c),d=u.length,l=0;d>l;)a=u[l++],$P&&!tD(s,c,a)||(r[a]=c[a]);return r}:cD,hD=Ho,pD=2147483647,fD=/[^\0-\u007E]/,ED=/[.\u3002\uFF0E\uFF61]/g,mD="Overflow: input needs wider integers to process",_D=RangeError,TD=hD(ED.exec),gD=Math.floor,SD=String.fromCharCode,RD=hD("".charCodeAt),vD=hD([].join),yD=hD([].push),AD=hD("".replace),bD=hD("".split),OD=hD("".toLowerCase),ID=function(e){return e+22+75*(e<26)},CD=function(e,t,r){var n=0;for(e=r?gD(e/700):e>>1,e+=gD(e/t);e>455;)e=gD(e/35),n+=36;return gD(n+36*e/(e+38))},wD=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=RD(e,r++);if(i>=55296&&i<=56319&&r<n){var o=RD(e,r++);56320==(64512&o)?yD(t,((1023&i)<<10)+(1023&o)+65536):(yD(t,i),r--)}else yD(t,i)}return t}(e);var r,n,i=e.length,o=128,s=0,a=72;for(r=0;r<e.length;r++)(n=e[r])<128&&yD(t,SD(n));var c=t.length,u=c;for(c&&yD(t,"-");u<i;){var d=pD;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>gD((pD-s)/l))throw new _D(mD);for(s+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++s>pD)throw new _D(mD);if(n===o){for(var h=s,p=36;;){var f=p<=a?1:p>=a+26?26:p-a;if(h<f)break;var E=h-f,m=36-f;yD(t,SD(ID(f+E%m))),h=gD(E/m),p+=36}yD(t,SD(ID(h))),a=CD(s,l,u===c),s=0,u++}}s++,o++}return vD(t,"")},ND=du,PD=us,DD=PN,LD=Xo,kD=Dc,MD=Ho,UD=ap,xD=up,VD=YR,FD=ka,BD=lD,jD=kO,GD=$h,WD=xT.codeAt,HD=function(e){var t,r,n=[],i=bD(AD(OD(e),ED,"."),".");for(t=0;t<i.length;t++)r=i[t],yD(n,TD(fD,r)?"xn--"+wD(r):r);return vD(n,".")},KD=ed,YD=Lp,XD=rv,ZD=qP,zD=zp,JD=zD.set,QD=zD.getterFor("URL"),qD=ZD.URLSearchParams,$D=ZD.getState,eL=LD.URL,tL=LD.TypeError,rL=LD.encodeURIComponent,nL=LD.parseInt,iL=Math.floor,oL=Math.pow,sL=MD("".charAt),aL=MD(/./.exec),cL=MD([].join),uL=MD(1.1.toString),dL=MD([].pop),lL=MD([].push),hL=MD("".replace),pL=MD([].shift),fL=MD("".split),EL=MD("".slice),mL=MD("".toLowerCase),_L=MD([].unshift),TL="Invalid scheme",gL="Invalid host",SL="Invalid port",RL=/[a-z]/i,vL=/[\d+\-.a-z]/i,yL=/\d/,AL=/^0x/i,bL=/^[0-7]+$/,OL=/^\d+$/,IL=/^[\da-f]+$/i,CL=/[\0\t\n\r #%/:<>?@[\\\]^|]/,wL=/[\0\t\n\r #/:<>?@[\\\]^|]/,NL=/^[\u0000-\u0020]+/,PL=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,DL=/[\t\n\r]/g,LL=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)_L(t,e%256),e=iL(e/256);return cL(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r?n:t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=uL(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},kL={},ML=BD({},kL,{" ":1,'"':1,"#":1,"<":1,">":1}),UL=BD({},ML,{"'":1}),xL=BD({},kL,{" ":1,'"':1,"<":1,">":1,"`":1}),VL=BD({},xL,{"#":1,"?":1,"{":1,"}":1,"^":1}),FL=BD({},VL,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),BL=function(e,t){var r=WD(e,0);return r>=32&&r<127&&!FD(t,e)?e:"'"===e&&FD(t,e)?"%27":rL(e)},jL={ftp:21,file:null,http:80,https:443,ws:80,wss:443},GL=function(e,t){var r;return 2===e.length&&aL(RL,sL(e,0))&&(":"===(r=sL(e,1))||!t&&"|"===r)},WL=function(e){var t;return e.length>1&&GL(EL(e,0,2))&&(2===e.length||"/"===(t=sL(e,2))||"\\"===t||"?"===t||"#"===t)},HL=function(e){return"."===e||"%2e"===mL(e)},KL={},YL={},XL={},ZL={},zL={},JL={},QL={},qL={},$L={},ek={},tk={},rk={},nk={},ik={},ok={},sk={},ak={},ck={},uk={},dk={},lk={},hk=function(e,t,r){var n,i,o,s=KD(e);if(t){if(i=this.parse(s))throw new tL(i);this.searchParams=null}else{if(void 0!==r&&(n=new hk(r,!0)),i=this.parse(s,null,n))throw new tL(i);(o=$D(new qD)).bindURL(this),this.searchParams=o}};hk.prototype={type:"URL",parse:function(e,t,r){var n,i,o,s,a,c=this,u=t||KL,d=0,l="",h=!1,p=!1,f=!1;for(e=KD(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=hL(e,NL,""),e=hL(e,PL,"$1")),e=hL(e,DL,""),n=jD(e);d<=n.length;){switch(i=n[d],u){case KL:if(!i||!aL(RL,i)){if(t)return TL;u=XL;continue}l+=mL(i),u=YL;break;case YL:if(i&&aL(vL,i))l+=mL(i);else{if(":"!==i){if(t)return TL;l="",u=XL,d=0;continue}if(t&&(c.isSpecial()!==FD(jL,l)||"file"===l&&(c.includesCredentials()||null!==c.port)||"file"===c.scheme&&""===c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&jL[c.scheme]===c.port&&(c.port=null));l="","file"===c.scheme?u=ik:c.isSpecial()&&r&&r.scheme===c.scheme?u=ZL:c.isSpecial()?u=qL:"/"===n[d+1]?(u=zL,d++):(c.cannotBeABaseURL=!0,lL(c.path,""),u=uk)}break;case XL:if(!r||r.cannotBeABaseURL&&"#"!==i)return TL;if(r.cannotBeABaseURL&&"#"===i){c.scheme=r.scheme,c.path=GD(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=lk;break}u="file"===r.scheme?ik:JL;continue;case ZL:if("/"!==i||"/"!==n[d+1]){u=JL;continue}u=$L,d++;break;case zL:if("/"===i){u=ek;break}u=ck;continue;case JL:if(c.scheme=r.scheme,i===QP)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=GD(r.path),c.query=r.query;else if("/"===i||"\\"===i&&c.isSpecial())u=QL;else if("?"===i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=GD(r.path),c.query="",u=dk;else{if("#"!==i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=GD(r.path),c.path.length&&c.path.length--,u=ck;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=GD(r.path),c.query=r.query,c.fragment="",u=lk}break;case QL:if(!c.isSpecial()||"/"!==i&&"\\"!==i){if("/"!==i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=ck;continue}u=ek}else u=$L;break;case qL:if(u=$L,"/"!==i||"/"!==n[d+1])continue;d++;break;case $L:if("/"!==i&&"\\"!==i){u=ek;continue}break;case ek:if("@"===i){h&&(l="%40"+l),h=!0,o=jD(l);for(var E=0;E<o.length;E++){var m=o[E];if(":"!==m||f){var _=BL(m,FL);f?c.password+=_:c.username+=_}else f=!0}l=""}else if(i===QP||"/"===i||"?"===i||"#"===i||"\\"===i&&c.isSpecial()){if(h&&""===l)return"Invalid authority";d-=jD(l).length+1,l="",u=tk}else l+=i;break;case tk:case rk:if(t&&"file"===c.scheme){u=sk;continue}if(":"!==i||p){if(i===QP||"/"===i||"?"===i||"#"===i||"\\"===i&&c.isSpecial()){if(c.isSpecial()&&""===l)return gL;if(t&&""===l&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(l))return s;if(l="",u=ak,t)return;continue}"["===i?p=!0:"]"===i&&(p=!1),l+=i}else{if(""===l)return gL;if(t===rk)return;if(s=c.parseHost(l))return s;l="",u=nk}break;case nk:if(!aL(yL,i)){if(i===QP||"/"===i||"?"===i||"#"===i||"\\"===i&&c.isSpecial()||t){if(""!==l){var T=nL(l,10);if(T>65535)return SL;c.port=c.isSpecial()&&T===jL[c.scheme]?null:T,l=""}if(t)return;u=ak;continue}return SL}l+=i;break;case ik:if(c.scheme="file",c.host="","/"===i||"\\"===i)u=ok;else{if(!r||"file"!==r.scheme){u=ck;continue}switch(i){case QP:c.host=r.host,c.path=GD(r.path),c.query=r.query;break;case"?":c.host=r.host,c.path=GD(r.path),c.query="",u=dk;break;case"#":c.host=r.host,c.path=GD(r.path),c.query=r.query,c.fragment="",u=lk;break;default:c.host=r.host,WL(cL(GD(n,d),""))||(c.path=GD(r.path),c.shortenPath()),u=ck;continue}}break;case ok:if("/"===i||"\\"===i){u=sk;break}r&&"file"===r.scheme&&(c.host=r.host,!WL(cL(GD(n,d),""))&&GL(r.path[0],!0)&&lL(c.path,r.path[0])),u=ck;continue;case sk:if(i===QP||"/"===i||"\\"===i||"?"===i||"#"===i){if(!t&&GL(l))u=ck;else if(""===l){if(c.host="",t)return;u=ak}else{if(s=c.parseHost(l))return s;if("localhost"===c.host&&(c.host=""),t)return;l="",u=ak}continue}l+=i;break;case ak:if(c.isSpecial()){if(u=ck,"/"!==i&&"\\"!==i)continue}else if(t||"?"!==i)if(t||"#"!==i){if(i!==QP&&(u=ck,"/"!==i))continue}else c.fragment="",u=lk;else c.query="",u=dk;break;case ck:if(i===QP||"/"===i||"\\"===i&&c.isSpecial()||!t&&("?"===i||"#"===i)){if(".."===(a=mL(a=l))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"===i||"\\"===i&&c.isSpecial()||lL(c.path,"")):HL(l)?"/"===i||"\\"===i&&c.isSpecial()||lL(c.path,""):("file"===c.scheme&&!c.path.length&&GL(l)&&(null!==c.host&&""!==c.host&&(c.host=""),l=sL(l,0)+":"),lL(c.path,l)),l="","file"===c.scheme&&(i===QP||"?"===i||"#"===i))for(;c.path.length>1&&""===c.path[0];)pL(c.path);"?"===i?(c.query="",u=dk):"#"===i&&(c.fragment="",u=lk)}else l+=BL(i,VL);break;case uk:"?"===i?(c.query="",u=dk):"#"===i?(c.fragment="",u=lk):i!==QP&&(c.path[0]+=BL(i,kL));break;case dk:t||"#"!==i?i!==QP&&(c.query+=BL(i,c.isSpecial()?UL:ML)):(c.fragment="",u=lk);break;case lk:i!==QP&&(c.fragment+=BL(i,xL))}d++}},parseHost:function(e){var t,r,n;if("["===sL(e,0)){if("]"!==sL(e,e.length-1))return gL;if(t=function(e){var t,r,n,i,o,s,a,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return sL(e,l)};if(":"===h()){if(":"!==sL(e,1))return;l+=2,d=++u}for(;h();){if(8===u)return;if(":"!==h()){for(t=r=0;r<4&&aL(IL,h());)t=16*t+nL(h(),16),l++,r++;if("."===h()){if(0===r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."===h()&&n<4))return;l++}if(!aL(yL,h()))return;for(;aL(yL,h());){if(o=nL(h(),10),null===i)i=o;else{if(0===i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!==n||u++}if(4!==n)return;break}if(":"===h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(s=u-d,u=7;0!==u&&s>0;)a=c[u],c[u--]=c[d+s-1],c[d+--s]=a;else if(8!==u)return;return c}(EL(e,1,-1)),!t)return gL;this.host=t}else if(this.isSpecial()){if(e=HD(e),aL(CL,e))return gL;if(function(e){var t,r,n=fL(e,".");if(""===n[n.length-1]){if(1===n.length)return!1;n.length--}return t=n[n.length-1],!!aL(OL,t)||!!aL(AL,t)&&(""===(r=EL(t,2))||!!aL(IL,r))}(e)){if(t=function(e){var t,r,n,i,o,s,a,c=fL(e,".");if(c.length&&""===c[c.length-1]&&c.length--,(t=c.length)>4)return null;for(r=[],n=0;n<t;n++){if(""===(i=c[n]))return null;if(o=10,i.length>1&&"0"===sL(i,0)&&(o=aL(AL,i)?16:8,i=EL(i,8===o?1:2)),""===i)s=0;else{if(!aL(10===o?OL:8===o?bL:IL,i))return null;s=nL(i,o)}lL(r,s)}for(n=0;n<t;n++)if(s=r[n],n===t-1){if(s>=oL(256,5-t))return null}else if(s>255)return null;for(a=dL(r),n=0;n<r.length;n++)a+=r[n]*oL(256,3-n);return a}(e),null===t)return gL;this.host=t}else this.host=e}else{if(aL(wL,e))return gL;for(t="",r=jD(e),n=0;n<r.length;n++)t+=BL(r[n],kL);this.host=t}},cannotHaveUsernamePasswordPort:function(){return null===this.host||""===this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return FD(jL,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&GL(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,s=e.path,a=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=LL(i),null!==o&&(u+=":"+o)):"file"===t&&(u+="//"),null===i&&!e.cannotBeABaseURL&&s.length>1&&""===s[0]&&(u+="/."),u+=e.cannotBeABaseURL?s[0]:s.length?"/"+cL(s,"/"):"",null!==a&&(u+="?"+a),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw new tL(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new pk(this.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+LL(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(KD(e)+":",KL)},getUsername:function(){return this.username},setUsername:function(e){var t=jD(KD(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=BL(t[r],FL)}},getPassword:function(){return this.password},setPassword:function(e){var t=jD(KD(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=BL(t[r],FL)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?LL(e):LL(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,tk)},getHostname:function(){var e=this.host;return null===e?"":LL(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,rk)},getPort:function(){var e=this.port;return null===e?"":KD(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=KD(e))?this.port=null:this.parse(e,nk))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+cL(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,ak))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=KD(e))?this.query=null:("?"===sL(e,0)&&(e=EL(e,1)),this.query="",this.parse(e,dk)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=KD(e))?("#"===sL(e,0)&&(e=EL(e,1)),this.fragment="",this.parse(e,lk)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var pk=function(e){var t=VD(this,fk),r=XD(arguments.length,1)>1?arguments[1]:void 0,n=JD(t,new hk(e,!1,r));PD||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},fk=pk.prototype,Ek=function(e,t){return{get:function(){return QD(this)[e]()},set:t&&function(e){return QD(this)[t](e)},configurable:!0,enumerable:!0}};if(PD&&(xD(fk,"href",Ek("serialize","setHref")),xD(fk,"origin",Ek("getOrigin")),xD(fk,"protocol",Ek("getProtocol","setProtocol")),xD(fk,"username",Ek("getUsername","setUsername")),xD(fk,"password",Ek("getPassword","setPassword")),xD(fk,"host",Ek("getHost","setHost")),xD(fk,"hostname",Ek("getHostname","setHostname")),xD(fk,"port",Ek("getPort","setPort")),xD(fk,"pathname",Ek("getPathname","setPathname")),xD(fk,"search",Ek("getSearch","setSearch")),xD(fk,"searchParams",Ek("getSearchParams")),xD(fk,"hash",Ek("getHash","setHash"))),UD(fk,"toJSON",(function(){return QD(this).serialize()}),{enumerable:!0}),UD(fk,"toString",(function(){return QD(this).serialize()}),{enumerable:!0}),eL){var mk=eL.createObjectURL,_k=eL.revokeObjectURL;mk&&UD(pk,"createObjectURL",kD(mk,eL)),_k&&UD(pk,"revokeObjectURL",kD(_k,eL))}YD(pk,"URL"),ND({global:!0,constructor:!0,forced:!DD,sham:!PD},{URL:pk});var Tk=du,gk=Vo,Sk=rv,Rk=ed,vk=PN,yk=Fs("URL"),Ak=vk&&gk((function(){yk.canParse()})),bk=gk((function(){return 1!==yk.canParse.length}));Tk({target:"URL",stat:!0,forced:!Ak||bk},{canParse:function(e){var t=Sk(arguments.length,1),r=Rk(e),n=t<2||void 0===arguments[1]?void 0:Rk(arguments[1]);try{return!!new yk(r,n)}catch(e){return!1}}});var Ok=du,Ik=rv,Ck=ed,wk=PN,Nk=Fs("URL");Ok({target:"URL",stat:!0,forced:!wk},{parse:function(e){var t=Ik(arguments.length,1),r=Ck(e),n=t<2||void 0===arguments[1]?void 0:Ck(arguments[1]);try{return new Nk(r,n)}catch(e){return null}}});var Pk=z(ks.URL);function Dk(){const e=new Blob([atob("ZnVuY3Rpb24gdCh0LGUsbil7cmV0dXJuKGU9ZnVuY3Rpb24odCl7dmFyIGU9ZnVuY3Rpb24odCxlKXtpZigib2JqZWN0IiE9dHlwZW9mIHR8fCF0KXJldHVybiB0O3ZhciBuPXRbU3ltYm9sLnRvUHJpbWl0aXZlXTtpZih2b2lkIDAhPT1uKXt2YXIgcj1uLmNhbGwodCxlfHwiZGVmYXVsdCIpO2lmKCJvYmplY3QiIT10eXBlb2YgcilyZXR1cm4gcjt0aHJvdyBuZXcgVHlwZUVycm9yKCJAQHRvUHJpbWl0aXZlIG11c3QgcmV0dXJuIGEgcHJpbWl0aXZlIHZhbHVlLiIpfXJldHVybigic3RyaW5nIj09PWU/U3RyaW5nOk51bWJlcikodCl9KHQsInN0cmluZyIpO3JldHVybiJzeW1ib2wiPT10eXBlb2YgZT9lOmUrIiJ9KGUpKWluIHQ/T2JqZWN0LmRlZmluZVByb3BlcnR5KHQsZSx7dmFsdWU6bixlbnVtZXJhYmxlOiEwLGNvbmZpZ3VyYWJsZTohMCx3cml0YWJsZTohMH0pOnRbZV09bix0fWZ1bmN0aW9uIGUodCxlKXt2YXIgbj1PYmplY3Qua2V5cyh0KTtpZihPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgcj1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKHQpO2UmJihyPXIuZmlsdGVyKChmdW5jdGlvbihlKXtyZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcih0LGUpLmVudW1lcmFibGV9KSkpLG4ucHVzaC5hcHBseShuLHIpfXJldHVybiBufWNvbnN0IG49InZpZGVvL2gyNjQiLHI9InZpZGVvL2gyNjUiO2Z1bmN0aW9uIGEodCxlLG4pe2NvbnN0IHI9bmV3IFVpbnQ4QXJyYXkodCxlLG4pLGE9W107bGV0IG89MDtmb3IoO2EubGVuZ3RoPG47KW8rMzxuJiYwPT09cltvXSYmMD09PXJbbysxXSYmMz09PXJbbysyXSYmKDA9PT1yW28rM118fDE9PT1yW28rM118fDI9PT1yW28rM118fDM9PT1yW28rM10pPyhhLnB1c2gocltvXSxyW28rMV0scltvKzNdKSxvKz00KTooYS5wdXNoKHJbb10pLG8rKyk7cmV0dXJuIG5ldyBVaW50OEFycmF5KGEpfWZ1bmN0aW9uIG8odCxlKXtzd2l0Y2goZSl7Y2FzZSBuOnJldHVybiBmdW5jdGlvbih0KXtjb25zdCBlPW5ldyBEYXRhVmlldyh0LmRhdGEpO2xldCBuPTA7Zm9yKDtuKzQ8dC5kYXRhLmJ5dGVMZW5ndGg7KXtpZigwPT09ZS5nZXRVaW50OChuKzApJiYwPT09ZS5nZXRVaW50OChuKzEpJiYwPT09ZS5nZXRVaW50OChuKzIpJiYxPT09ZS5nZXRVaW50OChuKzMpJiY2PT09ZS5nZXRVaW50OChuKzQpKXtsZXQgcj1uKzYsbz0wLGk9MDtmb3IoOzI1NT09PShpPWUuZ2V0VWludDgocisrKSk7KW8rPTI1NTtvKz1pO2NvbnN0IHM9YSh0LmRhdGEscixvKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkocyl9bisrfXJldHVybiBudWxsfSh0KTtjYXNlIHI6cmV0dXJuIGZ1bmN0aW9uKHQpe2NvbnN0IGU9bmV3IERhdGFWaWV3KHQuZGF0YSk7bGV0IG49MDtmb3IoO24rNTx0LmRhdGEuYnl0ZUxlbmd0aDspe2lmKDA9PT1lLmdldFVpbnQ4KG4rMCkmJjA9PT1lLmdldFVpbnQ4KG4rMSkmJjA9PT1lLmdldFVpbnQ4KG4rMikmJjE9PT1lLmdldFVpbnQ4KG4rMykmJjc4PT09ZS5nZXRVaW50OChuKzQpJiYxPT09ZS5nZXRVaW50OChuKzUpJiYxMDE9PT1lLmdldFVpbnQ4KG4rNikpe2xldCByPW4rNyxvPTAsaT0wO2Zvcig7MjU1PT09KGk9ZS5nZXRVaW50OChyKyspKTspbys9MjU1O28rPWk7Y29uc3Qgcz1hKHQuZGF0YSxyLG8pO3JldHVybiBuZXcgVWludDhBcnJheShzKX1uKyt9cmV0dXJuIG51bGx9KHQpO2RlZmF1bHQ6cmV0dXJuIG51bGx9fWZ1bmN0aW9uIGkodCl7Y29uc3QgZT10Lmxlbmd0aCxuPVtdO2xldCByPTA7Zm9yKDtyPGU7KXIrMjxlJiYwPT09dFtyXSYmMD09PXRbcisxXSYmKDA9PT10W3IrMl18fDE9PT10W3IrMl18fDI9PT10W3IrMl18fDM9PT10W3IrMl0pPyhuLnB1c2godFtyXSx0W3IrMV0sMyx0W3IrMl0pLHIrPTMpOihuLnB1c2godFtyXSkscisrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkobil9ZnVuY3Rpb24gcyh0LGUsYSl7c3dpdGNoKGEpe2Nhc2UgbjpyZXR1cm4gZnVuY3Rpb24odCxlKXtjb25zdCBuPWkoZSkscj1uLmxlbmd0aCxhPU1hdGguZmxvb3Ioci8yNTUpLG89ciUyNTUscz1uZXcgVWludDhBcnJheSg2K2ErMStyKzErdC5ieXRlTGVuZ3RoKTtzWzBdPTAsc1sxXT0wLHNbMl09MCxzWzNdPTEsc1s0XT02LHNbNV09MTAxO2xldCBmPTA7Zm9yKDtmPGE7KXNbNitmXT0yNTUsZisrO3JldHVybiBzWzYrZl09byxmKysscy5zZXQobiw2K2YpLGYrPXIsc1s2K2ZdPTEyOCxmKysscy5zZXQobmV3IFVpbnQ4QXJyYXkodCksNitmKSxzLmJ1ZmZlcn0odCxlKTtjYXNlIHI6cmV0dXJuIGZ1bmN0aW9uKHQsZSl7Y29uc3Qgbj1pKGUpLHI9bi5sZW5ndGgsYT1NYXRoLmZsb29yKHIvMjU1KSxvPXIlMjU1LHM9bmV3IFVpbnQ4QXJyYXkoNythKzErcisxK3QuYnl0ZUxlbmd0aCk7c1swXT0wLHNbMV09MCxzWzJdPTAsc1szXT0xLHNbNF09Nzgsc1s1XT0xLHNbNl09MTAxO2xldCBmPTA7Zm9yKDtmPGE7KXNbNytmXT0yNTUsZisrO3JldHVybiBzWzcrZl09byxmKysscy5zZXQobiw3K2YpLGYrPXIsc1s3K2ZdPTEyOCxmKysscy5zZXQobmV3IFVpbnQ4QXJyYXkodCksNytmKSxzLmJ1ZmZlcn0odCxlKTtkZWZhdWx0OnJldHVybiBudWxsfX1mdW5jdGlvbiBmKHQpe2lmKHQubGVuZ3RoPDUpcmV0dXJuIiI7bGV0IGU9LTE7Zm9yKGxldCBuPTA7bjx0Lmxlbmd0aC0zO24rKyl7aWYoMD09PXRbbl0mJjA9PT10W24rMV0mJjE9PT10W24rMl0pe2U9bjticmVha31pZihuPHQubGVuZ3RoLTQmJjA9PT10W25dJiYwPT09dFtuKzFdJiYwPT09dFtuKzJdJiYxPT09dFtuKzNdKXtlPW47YnJlYWt9fWlmKC0xPT09ZSlyZXR1cm4iIjtjb25zdCBhPWUrKDA9PT10W2UrMl0/NDozKTtpZihhPj10Lmxlbmd0aClyZXR1cm4iIjtjb25zdCBvPXRbYV07aWYoMTI4Jm8pcmV0dXJuIiI7aWYoKG8+PjEmNjMpPj0zMilyZXR1cm4gcjtpZihhKzE8dC5sZW5ndGgpe2lmKDA9PSgyNDgmdFthKzFdKSlyZXR1cm4gcn1yZXR1cm4oMzEmbyk8PTMxP246IiJ9Y29uc3QgbD03MSx1PTEsYz0yLGc9MSxwPTI7dmFyIGQ9ZnVuY3Rpb24odCl7cmV0dXJuIHRbdC5BVURJT19MRVZFTD0xXT0iQVVESU9fTEVWRUwiLHRbdC5NRVRBREFUQT0yXT0iTUVUQURBVEEiLHRbdC5BVURJT182NF9CSVRfUFRTPTNdPSJBVURJT182NF9CSVRfUFRTIix0fShkfHx7fSk7ZnVuY3Rpb24gaCh0KXtsZXQgZT1hcmd1bWVudHMubGVuZ3RoPjEmJnZvaWQgMCE9PWFyZ3VtZW50c1sxXSYmYXJndW1lbnRzWzFdO2NvbnN0IG49dC5nZXRVaW50OCgwKTtpZihuIT09bClyZXR1cm47Y29uc3Qgcj10LmdldFVpbnQxNigxKSxhPXUrYytyLG89bmV3IFVpbnQ4QXJyYXkodC5ieXRlTGVuZ3RoLWEpO28uc2V0KG5ldyBVaW50OEFycmF5KHQuYnVmZmVyLGEsdC5ieXRlTGVuZ3RoLWEpKTtjb25zdCBpPXttOm4sdGx2TGVuOnIsdGx2OltdLGZyYW1lOm99O2xldCBzPXUrYztmb3IoO3M8YTspe2NvbnN0IG49dC5nZXRVaW50OChzKSxyPXQuZ2V0VWludDE2KHMrZyksYT1nK3A7aWYobj09PWQuQVVESU9fTEVWRUwpe2xldCBvPXQuZ2V0VWludDgocythKTtmb3IobGV0IGU9MTtlPHI7ZSsrKW89bzw8OHx0LmdldFVpbnQ4KHMrYStlKTtpLnRsdi5wdXNoKHt0YWc6bixsZW5ndGg6cix2YWx1ZTplPzEyN15vPj4xOjEyNyZvfSl9ZWxzZSBpZihuPT09ZC5NRVRBREFUQXx8bj09PWQuQVVESU9fNjRfQklUX1BUUyl7Y29uc3QgZT1uZXcgVWludDhBcnJheShyKTtmb3IobGV0IG49MDtuPHI7bisrKWVbbl09dC5nZXRVaW50OChzK2Erbik7aS50bHYucHVzaCh7dGFnOm4sbGVuZ3RoOnIsdmFsdWU6ZX0pfXMrPWErcn1yZXR1cm4gaX1zZWxmLm9ucnRjdHJhbnNmb3JtPW49Pntjb25zdCByPW4udHJhbnNmb3JtZXIsYT1bXSxpPVtdO2xldCB5PW51bGw7ci5vcHRpb25zLnBvcnQub25tZXNzYWdlPXQ9Pnt0LmRhdGEuc2VpJiZhLnB1c2godC5kYXRhLnNlaSksdC5kYXRhLm1ldGFkYXRhJiZpLnB1c2godC5kYXRhLm1ldGFkYXRhKX0sc2VsZi5wb3N0TWVzc2FnZSgic3RhcnRlZCIpO2NvbnN0IFU9ci5yZWFkYWJsZS5nZXRSZWFkZXIoKSx2PXIud3JpdGFibGUuZ2V0V3JpdGVyKCk7InNlaS1yeCI9PT1yLm9wdGlvbnMubmFtZT9mdW5jdGlvbiBuKHIpe1UucmVhZCgpLnRoZW4oKGE9PntpZighYS5kb25lKXtpZihhLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IG49ZihuZXcgVWludDhBcnJheShhLnZhbHVlLmRhdGEpKSxpPW8oYS52YWx1ZSxuKTtpZihpJiZyLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7c2VpOmkscnRwVGltZXN0YW1wOmEudmFsdWUudGltZXN0YW1wfSksIXkpe2NvbnN0IG49YS52YWx1ZS5nZXRNZXRhZGF0YSgpfHx7fTt5PWZ1bmN0aW9uKG4pe2Zvcih2YXIgcj0xO3I8YXJndW1lbnRzLmxlbmd0aDtyKyspe3ZhciBhPW51bGwhPWFyZ3VtZW50c1tyXT9hcmd1bWVudHNbcl06e307ciUyP2UoT2JqZWN0KGEpLCEwKS5mb3JFYWNoKChmdW5jdGlvbihlKXt0KG4sZSxhW2VdKX0pKTpPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycz9PYmplY3QuZGVmaW5lUHJvcGVydGllcyhuLE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKGEpKTplKE9iamVjdChhKSkuZm9yRWFjaCgoZnVuY3Rpb24odCl7T2JqZWN0LmRlZmluZVByb3BlcnR5KG4sdCxPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKGEsdCkpfSkpfXJldHVybiBufSh7dHlwZTphLnZhbHVlLnR5cGUscnRwVGltZXN0YW1wOmEudmFsdWUudGltZXN0YW1wLHBheWxvYWRUeXBlOm4ucGF5bG9hZFR5cGV8fDAsc3NyYzpuLnN5bmNocm9uaXphdGlvblNvdXJjZXx8MCxsZW5ndGg6YS52YWx1ZS5kYXRhLmJ5dGVMZW5ndGh9LCJtaW1lVHlwZSJpbiBuP3ttaW1lVHlwZTpuLm1pbWVUeXBlfTp7fSksci5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe2ZpcnN0RnJhbWVJbmZvOnl9KX19di53cml0ZShhLnZhbHVlKSxyLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSxuKHIpfX0pKX0ocik6InNlaS10eCI9PT1yLm9wdGlvbnMubmFtZT9mdW5jdGlvbiB0KGUpe1UucmVhZCgpLnRoZW4oKG49PntpZighbi5kb25lKXtpZihuLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IHQ9ZihuZXcgVWludDhBcnJheShuLnZhbHVlLmRhdGEpKSxlPWEuc2hpZnQoKTtpZihlKXtjb25zdCByPXMobi52YWx1ZS5kYXRhLGUsdCk7ciYmKG4udmFsdWUuZGF0YT1yKX19di53cml0ZShuLnZhbHVlKSxlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSx0KGUpfX0pKX0ocik6ImF1ZGlvLW1ldGFkYXRhLXJ4Ij09PXIub3B0aW9ucy5uYW1lP2Z1bmN0aW9uIHQoZSl7VS5yZWFkKCkudGhlbigobj0+e2lmKCFuLmRvbmUpe2lmKG4udmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkQXVkaW9GcmFtZSl7Y29uc3QgdD1uZXcgRGF0YVZpZXcobi52YWx1ZS5kYXRhKSxyPXQuZ2V0VWludDgoMCk7bGV0IGE7aWYoMCE9KDEyOCZyKSYmNzEhPT1yKXtjb25zdCBlPWZ1bmN0aW9uKHQpe2lmKHQuYnl0ZUxlbmd0aDw9MClyZXR1cm5bXTtjb25zdCBlPVtdO2xldCBuPTA7Zm9yKDtuPHQuYnl0ZUxlbmd0aDspe2NvbnN0IHI9KDEyOCZ0LmdldFVpbnQ4KG4pKT4+NyxhPTEyNyZ0LmdldFVpbnQ4KG4pO2lmKCEociYmbis0PD10LmJ5dGVMZW5ndGgpKXtuKys7YnJlYWt9e2NvbnN0IHI9dC5nZXRVaW50MzIobiwhMSksbz0oMTY3NzYxOTImcik+PjEwLGk9MTAyMyZyO2UucHVzaCh7cHQ6YSx0c19vZmZzZXQ6byxsZW5ndGg6aSxkYXRhOm5ldyBVaW50OEFycmF5fSksbis9NH19bGV0IHI9dC5ieXRlTGVuZ3RoLW47Zm9yKGNvbnN0IGEgb2YgZSl7aWYoYS5sZW5ndGg+cilyZXR1cm4gY29uc29sZS53YXJuKCJCcm9rZW4gcmVkIHBheWxvYWQiKSxbXTthLmxlbmd0aD4wJiYoYS5kYXRhPW5ldyBVaW50OEFycmF5KHQuYnVmZmVyLHQuYnl0ZU9mZnNldCtuLGEubGVuZ3RoKSxuKz1hLmxlbmd0aCxyLT1hLmxlbmd0aCl9aWYocj4wKXtjb25zdCBhPXtwdDplLmxlbmd0aD4wP2VbZS5sZW5ndGgtMV0ucHQ6MCx0c19vZmZzZXQ6MCxsZW5ndGg6cixkYXRhOm5ldyBVaW50OEFycmF5KHQuYnVmZmVyLHQuYnl0ZU9mZnNldCtuLHIpfTtlLnB1c2goYSl9cmV0dXJuIGV9KHQpO2lmKGUubGVuZ3RoPjApe2NvbnN0IHQ9ZnVuY3Rpb24odCl7bGV0IGU9MDtmb3IobGV0IG49MDtuPHQubGVuZ3RoO24rKyllKz1uPHQubGVuZ3RoLTE/NDoxLGUrPXRbbl0ubGVuZ3RoO2NvbnN0IG49bmV3IFVpbnQ4QXJyYXkoZSk7bGV0IHI9MDtmb3IobGV0IGU9MDtlPHQubGVuZ3RoO2UrKylpZihlPHQubGVuZ3RoLTEpe2NvbnN0IGE9KDIxNDc0ODM2NDh8KDEyNyZ0W2VdLnB0KTw8MjR8KDI2MjE0MyZ0W2VdLnRzX29mZnNldCk8PDEwfDEwMjMmdFtlXS5sZW5ndGgpPj4+MDtuW3IrK109YT4+MjQmMjU1LG5bcisrXT1hPj4xNiYyNTUsbltyKytdPWE+PjgmMjU1LG5bcisrXT0yNTUmYX1lbHNlIG5bcisrXT0xMjcmdFtlXS5wdDtmb3IoY29uc3QgZSBvZiB0KW4uc2V0KGUuZGF0YSxyKSxyKz1lLmxlbmd0aDtyZXR1cm4gbn0oZS5tYXAoKHQ9Pntjb25zdCBlPW5ldyBVaW50OEFycmF5KHQubGVuZ3RoKTtlLnNldCh0LmRhdGEpO2NvbnN0IG49aChuZXcgRGF0YVZpZXcoZS5idWZmZXIpKTtyZXR1cm4gbnVsbCE9biYmbi5mcmFtZSYmKHQuZGF0YT1udWxsPT1uP3ZvaWQgMDpuLmZyYW1lKSxhPW4sdH0pKSk7bi52YWx1ZS5kYXRhPXQuYnVmZmVyfX1lbHNlIGE9aCh0KSxhJiYobi52YWx1ZS5kYXRhPWEuZnJhbWUuYnVmZmVyKTtpZihhKXtsZXQgdD1hLnRsdi5maW5kKCh0PT50LnRhZz09PWQuTUVUQURBVEEpKTtpZih0JiZ0LnZhbHVlIGluc3RhbmNlb2YgVWludDhBcnJheSYmZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe21ldGFkYXRhOnQudmFsdWV9KSx0PWEudGx2LmZpbmQoKHQ9PnQudGFnPT09ZC5BVURJT182NF9CSVRfUFRTKSksdCYmdC52YWx1ZSBpbnN0YW5jZW9mIFVpbnQ4QXJyYXkmJjg9PXQudmFsdWUubGVuZ3RoKXtjb25zdCBuPW5ldyBEYXRhVmlldyh0LnZhbHVlLmJ1ZmZlcikuZ2V0QmlnVWludDY0KDAsITApO3QmJnQudmFsdWUgaW5zdGFuY2VvZiBVaW50OEFycmF5JiZlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7cHRzOm59KX19fXYud3JpdGUobi52YWx1ZSksZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3RyYW5zZm9ybWVkOiEwfSksdChlKX19KSl9KHIpOiJhdWRpby1tZXRhZGF0YS10eCI9PT1yLm9wdGlvbnMubmFtZSYmZnVuY3Rpb24gdChlKXtVLnJlYWQoKS50aGVuKChuPT57aWYoIW4uZG9uZSl7aWYoZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe2dldE1ldGFkYXRhOiEwfSksbi52YWx1ZSBpbnN0YW5jZW9mIFJUQ0VuY29kZWRBdWRpb0ZyYW1lKXtjb25zdCB0PWkuc2hpZnQoKTt0JiYobi52YWx1ZS5kYXRhPWZ1bmN0aW9uKHQsZSxuKXtjb25zdCByPW4uYnl0ZUxlbmd0aCxhPXIrZytwLG89dStjK2EsaT1uZXcgQXJyYXlCdWZmZXIodC5ieXRlTGVuZ3RoK28pLHM9bmV3IERhdGFWaWV3KGkpO3Muc2V0VWludDgoMCxsKSxzLnNldFVpbnQxNigxLGEpLHMuc2V0VWludDgoMyxlKSxzLnNldFVpbnQxNig0LHIpO2ZvcihsZXQgdD0wO3Q8cjt0Kyspcy5zZXRVaW50OCg2K3Qsblt0XSk7Y29uc3QgZj1uZXcgVWludDhBcnJheShzLmJ1ZmZlcik7cmV0dXJuIGYuc2V0KG5ldyBVaW50OEFycmF5KHQpLG8pLGYuYnVmZmVyfShuLnZhbHVlLmRhdGEsZC5BVURJT182NF9CSVRfUFRTLHQpKX12LndyaXRlKG4udmFsdWUpLGUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQoZSl9fSkpfShyKX0sc2VsZi5wb3N0TWVzc2FnZSgicmVnaXN0ZXJlZCIpOwo=")],{type:"text/javascript"});return setTimeout((()=>Pk.revokeObjectURL(e)),0),new Worker(Pk.createObjectURL(e))}const Lk=71,kk=1,Mk=2,Uk=1,xk=2;var Vk=function(e){return e[e.AUDIO_LEVEL=1]="AUDIO_LEVEL",e[e.METADATA=2]="METADATA",e[e.AUDIO_64_BIT_PTS=3]="AUDIO_64_BIT_PTS",e}(Vk||{});function Fk(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=e.getUint8(0);if(r!==Lk)return;const n=e.getUint16(1),i=kk+Mk+n,o=new Uint8Array(e.byteLength-i);o.set(new Uint8Array(e.buffer,i,e.byteLength-i));const s={m:r,tlvLen:n,tlv:[],frame:o};let a=kk+Mk;for(;a<i;){const r=e.getUint8(a),n=e.getUint16(a+Uk),i=Uk+xk;if(r===Vk.AUDIO_LEVEL){let o=e.getUint8(a+i);for(let t=1;t<n;t++)o=o<<8|e.getUint8(a+i+t);s.tlv.push({tag:r,length:n,value:t?127^o>>1:127&o})}else if(r===Vk.METADATA||r===Vk.AUDIO_64_BIT_PTS){const t=new Uint8Array(n);for(let r=0;r<n;r++)t[r]=e.getUint8(a+i+r);s.tlv.push({tag:r,length:n,value:t})}a+=i+n}return s}const Bk=new Map;function jk(e,t){const r=t.chunk,n=t.controller,i=Vk.METADATA;r.data=function(e,t,r){const n=r.byteLength,i=n+Uk+xk,o=kk+Mk+i,s=new ArrayBuffer(e.byteLength+o),a=new DataView(s);a.setUint8(0,Lk),a.setUint16(1,i),a.setUint8(3,t),a.setUint16(4,n);for(let e=0;e<n;e++)a.setUint8(6+e,r[e]);const c=new Uint8Array(a.buffer);return c.set(new Uint8Array(e),o),c.buffer}(r.data,i,e),n.enqueue(r)}var Gk=z(Hg);const Wk=127,Hk=1e-10,Kk=139/13;const Yk=new Map;function Xk(e,t,r){const n="".concat(e,"-").concat(t,"-").concat(r);let i=0;if(Yk.has(n))i=Yk.get(n);else{const o=.5;i=Math.log(function(e,t){const r=e-t;t<r&&(t=r);let n=1;for(let r=e,i=1;r>t;r--,i++)n=n*r/i;return n}(t,e))+e*Math.log(o)+(t-e)*Math.log(1-o)-Math.log(r)+r*e,Yk.set(n,i)}return i<Hk&&(i=Hk),i}function Zk(e,t,r){const n=t.length,i=e.length/n;let o=!1;for(let s=0,a=0;s<n;s++){let n=0;for(let t=a+i;a<t;a++)e[a]>r&&n++;t[s]!==n&&(t[s]=n,o=!0)}return o}window.cache=Yk;let zk=0;class Jk{constructor(e){JT(this,"id",void 0),JT(this,"immediates",[]),JT(this,"lastNonSilence",-1),JT(this,"immediateSpeechActivityScore",Hk),JT(this,"lastLevelChangedTime",Date.now()),JT(this,"levels",[]),JT(this,"longs",[]),JT(this,"longSpeechActivityScore",Hk),JT(this,"mediums",[]),JT(this,"mediumSpeechActivityScore",Hk),JT(this,"minLevel",0),JT(this,"nextMinLevel",0),JT(this,"nextMinLevelWindowLength",0),JT(this,"energyScore",0),this.id=e||"".concat(zk++),this.immediates.length=50,this.mediums.length=10,this.longs.length=1,this.levels.length=this.immediates.length}computeImmediates(){const e=this.immediates,t=this.levels,r=this.minLevel+Kk;let n=!1;for(let i=0;i<e.length;++i){let o=t[i];o<r&&(o=0);const s=Math.floor(o/Kk);e[i]!==s&&(e[i]=s,n=!0)}return n}computeLongs(){return Zk(this.mediums,this.longs,4)}computeMediums(){return Zk(this.immediates,this.mediums,7)}evaluateImmediateSpeechActivityScore(){this.immediateSpeechActivityScore=Xk(this.immediates[0],13,.78)}evaluateLongSpeechActivityScore(e){this.longSpeechActivityScore=Xk(this.longs[0],10,47),this.longSpeechActivityScore>Hk&&(this.lastNonSilence=e)}evaluateMediumSpeechActivityScore(){this.mediumSpeechActivityScore=Xk(this.mediums[0],5,24)}evaluateSpeechActivityScores(e){this.computeImmediates()&&(this.evaluateImmediateSpeechActivityScore(),this.computeMediums()&&(this.evaluateMediumSpeechActivityScore(),this.computeLongs()&&this.evaluateLongSpeechActivityScore(e)))}getLastLevelChangedTime(){return this.lastLevelChangedTime}getLevels(){var e;return"[".concat(Gk(e=[...this.levels]).call(e).join(),"]")}getSpeechActivityScore(e){switch(e){case 0:return this.immediateSpeechActivityScore;case 1:return this.mediumSpeechActivityScore;case 2:return this.longSpeechActivityScore;default:throw new Error("interval "+e)}}levelChanged(e,t){if(this.lastLevelChangedTime<=t){this.lastLevelChangedTime=t;let r=e;return e<0&&(r=0),e>Wk&&(r=Wk),this.levels.unshift(r),this.levels.length>this.immediates.length&&this.levels.pop(),this.updateMinLevel(r),r>=this.minLevel+Kk?r:r/2}return-1}levelTimedOut(){this.levelChanged(0,this.lastLevelChangedTime)}updateMinLevel(e){if(0!==e){if(0===this.minLevel||this.minLevel>e)return this.minLevel=e,this.nextMinLevel=0,void(this.nextMinLevelWindowLength=0);if(0===this.nextMinLevel)return this.nextMinLevel=e,void(this.nextMinLevelWindowLength=1);if(this.nextMinLevel>e&&(this.nextMinLevel=e),this.nextMinLevelWindowLength++,this.nextMinLevelWindowLength>=750){let e=Math.sqrt(this.minLevel*this.nextMinLevel);e<0?e=0:e>Wk&&(e=Wk),this.minLevel=e,this.nextMinLevel=0,this.nextMinLevelWindowLength=0}}}}class Qk{constructor(e){JT(this,"algorithm",void 0),this.algorithm=e}execute(){let e=!this.algorithm;if(!e)try{const t=this.algorithm.runInDecisionMaker(this);t<=0?e=!0:setTimeout(this.execute.bind(this),t)}catch(t){e=!0}e&&this.algorithm&&this.algorithm.decisionMakerExited(this)}}class qk{constructor(e,t,r){JT(this,"isDominant",void 0),JT(this,"energyRanking",void 0),JT(this,"energyScore",void 0),this.isDominant=e,this.energyRanking=t,this.energyScore=r}}class $k extends Xn{constructor(e){super(),JT(this,"dominantId",null),JT(this,"lastDecisionTime",0),JT(this,"lastLevelChangedTime",0),JT(this,"lastLevelIdleTime",0),JT(this,"relativeSpeechActivities",[]),JT(this,"speakers",new Map),JT(this,"enableSilence",!1),JT(this,"timeoutToSilenceInterval",0),JT(this,"decisionMaker",null),JT(this,"loudest",[]),JT(this,"numLoudestToTrack",3),JT(this,"energyExpireTimeMs",250),JT(this,"energyAlphaPct",50),this.timeoutToSilenceInterval=e,this.enableSilence=e>0,this.relativeSpeechActivities.length=3}setLoudestConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;this.numLoudestToTrack=e,null!=t&&(this.energyExpireTimeMs=t),null!=r&&(this.energyAlphaPct=r),this.loudest.length>e&&this.loudest.splice(e)}getDominantSpeaker(){return this.dominantId}isAmongLoudest(e){return this.loudest.some((t=>t.id===e))}levelChanged(e,t){const r=Date.now(),n=this.getOrCreateSpeaker(e);this.lastLevelChangedTime<r&&(this.lastLevelChangedTime=r,this.maybeStartDecisionMaker());const i=n.levelChanged(t,r);return this.updateLoudestList(n,i,r)}runInDecisionMaker(e){if(this.decisionMaker!==e)return-1;if(this.lastDecisionTime>0){if(this.lastDecisionTime-this.lastLevelChangedTime>=15e3)return-1}return this._runInDecisionMaker()}decisionMakerExited(e){this.decisionMaker===e&&(this.decisionMaker=null)}destroy(){this.decisionMaker=null,this.loudest.length=0,this.speakers.clear(),this.removeAllListeners()}addSpeakers(e){e.forEach((e=>{this.speakers.has(e.id)||this.speakers.set(e.id,e)}))}removeSpeakers(e){e.forEach((e=>{this.speakers.delete(e.id)}))}getOrCreateSpeaker(e){let t=this.speakers.get(e);return t||(t=new Jk(e),this.speakers.set(e,t),this.maybeStartDecisionMaker()),t}updateLoudestList(e,t,r){const n=e.id===this.dominantId;if(t<0){let t=0;for(;t<this.loudest.length&&this.loudest[t]!==e;)++t;return new qk(n,t,e.energyScore)}if(e.energyScore=Math.floor((this.energyAlphaPct*t+(100-this.energyAlphaPct)*e.energyScore+50)/100),0===this.numLoudestToTrack)return new qk(n,0,e.energyScore);const i=r-this.energyExpireTimeMs;let o=0;for(;o<this.loudest.length;){const t=this.loudest[o];if(t.getLastLevelChangedTime()<i&&this.loudest.length>=this.numLoudestToTrack)this.loudest.splice(o,1);else if(t.id!==e.id)++o;else if(this.loudest.splice(o,1),this.loudest.length<this.numLoudestToTrack)break}let s=0;for(;s<this.loudest.length;){if(this.loudest[s].energyScore<e.energyScore)break;++s}return s<this.numLoudestToTrack&&(this.loudest.splice(s,0,e),this.loudest.length>this.numLoudestToTrack&&this.loudest.splice(this.numLoudestToTrack,1)),new qk(n,s,e.energyScore)}maybeStartDecisionMaker(){!this.decisionMaker&&this.speakers.size>0&&(this.decisionMaker=new Qk(this),this.decisionMaker.execute())}makeDecision(e){let t=null,r=null;const n=this.speakers.size;let i=null;if(0===n)i=null;else if(1===n){var o;const t=rI(o=this.speakers).call(o).next().value;if(this.enableSilence&&t){i=t.id,t.evaluateSpeechActivityScores(e);e-t.lastNonSilence>this.timeoutToSilenceInterval&&(i=null)}}else{let t=null==this.dominantId?null:this.speakers.get(this.dominantId);if(null==t){const e=this.speakers.entries().next();e.value&&(i=e.value[0],t=e.value[1])}else i=t.id;null!=t&&t.evaluateSpeechActivityScores(e);const r=this.relativeSpeechActivities;let n=2;for(const o of this.speakers.entries()){const s=VO(o,2),a=s[0],c=s[1];if(c===t)continue;c.evaluateSpeechActivityScores(e);for(let e=0;e<r.length;++e){const n=null==t?Hk:t.getSpeechActivityScore(e);r[e]=Math.log(c.getSpeechActivityScore(e)/n)}const u=r[0],d=r[1],l=r[2];u>3&&d>2&&l>0&&d>n&&(n=d,i=a)}if(this.enableSilence&&null!=t&&i===t.id){e-t.lastNonSilence>this.timeoutToSilenceInterval&&(i=null)}}null==i&&!this.enableSilence||i===this.dominantId||(t=this.dominantId,this.dominantId=i,r=this.dominantId),null==r&&!this.enableSilence||r===t||this.emit("ActiveSpeakerChanged",r)}_runInDecisionMaker(){const e=Date.now(),t=300-(e-this.lastLevelIdleTime);let r=0;t<=0?(0!==this.lastLevelIdleTime&&this.timeoutIdleLevels(e),this.lastLevelIdleTime=e):r=t;let n=300-(e-this.lastDecisionTime);return n<=0&&(this.lastDecisionTime=e,this.makeDecision(e),n=300-(Date.now()-e)),n>0&&r>n&&(r=n),r}timeoutIdleLevels(e){const t=[];for(const n of rI(r=this.speakers).call(r)){var r;const i=e-n.getLastLevelChangedTime();36e5<i&&(null==this.dominantId||n.id!==this.dominantId)?t.push(n.id):300<i&&n.levelTimedOut()}t.forEach((e=>this.speakers.delete(e)))}}const eM=new Map;let tM=null,rM=null;const nM=3;let iM=[];function oM(e,t){let r=eM.get(e);if(r||(r=function(e){const t=new Jk;return eM.set(e,t),tM||(tM=new $k(Hi("TOPN_SILENCE_THRESHOLD")||500),tM.on("ActiveSpeakerChanged",(e=>{null!=e&&(rM=e)}))),tM.addSpeakers([t]),t}(e)),eM.size<=nM)return{selected:!0,speaker:r};if(!tM)throw new Error("no active speaker detector");tM.levelChanged(r.id,t),iM=tM.loudest.map((e=>e.id)),rM&&!Ed(iM).call(iM,rM)&&iM.length>=nM&&iM.pop();return{selected:Ed(iM).call(iM,r.id)||r.id===rM,speaker:r}}const sM=1e3,aM=40,cM=new Map,uM=new Map;class dM{get samples(){return this.actives+this.inactives}get activeRate(){return this.actives/this.samples}constructor(e,t){JT(this,"id",void 0),JT(this,"track",void 0),JT(this,"score",0),JT(this,"active",!0),JT(this,"muted",!1),JT(this,"timer",0),JT(this,"actives",0),JT(this,"inactives",0),this.id=e,this.track=t,this.setActive(cM.size<3)}autoCheckActive(){this.autoSetActive(),this.autoAdjustActive(),this.resetTimer(),this.actives=0,this.inactives=0}autoSetActive(){const e=this.active;this.active=this.activeRate>=.8;const t=function(){const e=[],t=[];return Array.from(rI(cM).call(cM)).forEach((r=>{r.active?e.push(r):t.push(r)})),{actives:e,inactives:t}}(),r=t.actives,n=t.inactives;if(r.length>3){let e;r.forEach((t=>{(!e||e.score>t.score)&&(e=t)})),e&&e.setActive(!1)}if(r.length<3&&n.length>0){let t;n.forEach((e=>{(!t||t.score<e.score)&&e.id!==this.id&&(t=e)})),t&&e&&!this.active&&(t.samples>aM&&t.activeRate-this.activeRate>.4?t.setActive(!0):this.active=!0)}this.setMuted(!this.active)}setActive(e){this.active=e,this.resetTimer(),this.setMuted(!e)}autoAdjustActive(){this.active?this.autoSwitchToInactive():this.autoSwitchToActive()}autoSwitchToActive(){const e=function(e){let t;return Array.from(rI(cM).call(cM)).forEach((r=>{!r.active||r.id===e||r.samples<aM||(!t||r.score<t.score)&&(t=r)})),t}(this.id);e&&this.activeRate-e.activeRate>.4&&(e.setActive(!1),this.setActive(!0))}autoSwitchToInactive(){const e=function(e){let t;return Array.from(rI(cM).call(cM)).forEach((r=>{r.active||r.id===e||r.samples<aM||(!t||r.score>t.score)&&(t=r)})),t}(this.id);e&&e.activeRate-this.activeRate>.4&&(e.setActive(!0),this.setActive(!1))}addSample(e){e?this.actives+=1:this.inactives+=1,this.samples>66.66666666666667&&this.autoCheckActive()}setMuted(e){this.track&&(this.track.enabled=!e,this.muted=e)}resetTimer(){this.clearTimer(),this.timer=window.setTimeout((()=>{if(0!==this.samples)return this.samples<50?this.resetTimer():void this.autoCheckActive()}),sM)}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=0)}}let lM;function hM(e,t,r){const n=cM.get(e)||new dM(e,t);return n.score=r,cM.set(e,n),function(e){if(uM.set(e,!0),!lM)return void(lM=Date.now());const t=Date.now();t-lM>1e3&&(uM.get(e)?uM.set(e,!1):(pM(e),uM.delete(e)),lM=t)}(e),n}function pM(e){const t=cM.get(e);t&&(cM.delete(e),t.clearTimer())}const fM=new Map,EM=new Map;function mM(e,t,r,n){const i=new DataView(e.data),o=i.getUint8(0);let s;if(0!=(128&o)&&71!==o){const t=function(e){if(e.byteLength<=0)return[];const t=[];let r=0;for(;r<e.byteLength;){const n=(128&e.getUint8(r))>>7,i=127&e.getUint8(r);if(!(n&&r+4<=e.byteLength)){r++;break}{const n=e.getUint32(r,!1),o=(16776192&n)>>10,s=1023&n;t.push({pt:i,ts_offset:o,length:s,data:new Uint8Array}),r+=4}}let n=e.byteLength-r;for(const i of t){if(i.length>n)return console.warn("Broken red payload"),[];i.length>0&&(i.data=new Uint8Array(e.buffer,e.byteOffset+r,i.length),r+=i.length,n-=i.length)}if(n>0){const i={pt:t.length>0?t[t.length-1].pt:0,ts_offset:0,length:n,data:new Uint8Array(e.buffer,e.byteOffset+r,n)};t.push(i)}return t}(i);if(t.length>0){const r=function(e){let t=0;for(let r=0;r<e.length;r++)t+=r<e.length-1?4:1,t+=e[r].length;const r=new Uint8Array(t);let n=0;for(let t=0;t<e.length;t++)if(t<e.length-1){const i=(2147483648|(127&e[t].pt)<<24|(262143&e[t].ts_offset)<<10|1023&e[t].length)>>>0;r[n++]=i>>24&255,r[n++]=i>>16&255,r[n++]=i>>8&255,r[n++]=255&i}else r[n++]=127&e[t].pt;for(const t of e)r.set(t.data,n),n+=t.length;return r}(t.map((e=>{const t=new Uint8Array(e.length);t.set(e.data);const r=Fk(new DataView(t.buffer));return null!=r&&r.frame&&(e.data=null==r?void 0:r.frame),s=r,e})));e.data=r.buffer}}else s=Fk(i),s&&(e.data=s.frame.buffer);if(t.enqueue(e),!s)return;const a=s.tlv.find((e=>e.tag===Vk.METADATA));a&&r&&a.value instanceof Uint8Array&&r(a.value);const c=s.tlv.find((e=>e.tag===Vk.AUDIO_64_BIT_PTS));if(c&&n&&c.value instanceof Uint8Array&&8==c.value.length){n(new DataView(c.value.buffer).getBigUint64(0,!0))}}const _M="video/h264",TM="video/h265";function gM(e,t,r){const n=new Uint8Array(e,t,r),i=[];let o=0;for(;i.length<r;)o+3<r&&0===n[o]&&0===n[o+1]&&3===n[o+2]&&(0===n[o+3]||1===n[o+3]||2===n[o+3]||3===n[o+3])?(i.push(n[o],n[o+1],n[o+3]),o+=4):(i.push(n[o]),o++);return new Uint8Array(i)}function SM(e,t){switch(t){case _M:return function(e){const t=new DataView(e.data);let r=0;for(;r+4<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&6===t.getUint8(r+4)){let n=r+6,i=0,o=0;for(;255===(o=t.getUint8(n++));)i+=255;i+=o;const s=gM(e.data,n,i);return new Uint8Array(s)}r++}return null}(e);case TM:return function(e){const t=new DataView(e.data);let r=0;for(;r+5<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&78===t.getUint8(r+4)&&1===t.getUint8(r+5)&&101===t.getUint8(r+6)){let n=r+7,i=0,o=0;for(;255===(o=t.getUint8(n++));)i+=255;i+=o;const s=gM(e.data,n,i);return new Uint8Array(s)}r++}return null}(e);default:return null}}function RM(e){const t=e.length,r=[];let n=0;for(;n<t;)n+2<t&&0===e[n]&&0===e[n+1]&&(0===e[n+2]||1===e[n+2]||2===e[n+2]||3===e[n+2])?(r.push(e[n],e[n+1],3,e[n+2]),n+=3):(r.push(e[n]),n++);return new Uint8Array(r)}function vM(e,t,r){switch(r){case _M:return function(e,t){const r=RM(t),n=r.length,i=Math.floor(n/255),o=n%255,s=new Uint8Array(6+i+1+n+1+e.byteLength);s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=6,s[5]=101;let a=0;for(;a<i;)s[6+a]=255,a++;return s[6+a]=o,a++,s.set(r,6+a),a+=n,s[6+a]=128,a++,s.set(new Uint8Array(e),6+a),s.buffer}(e,t);case TM:return function(e,t){const r=RM(t),n=r.length,i=Math.floor(n/255),o=n%255,s=new Uint8Array(7+i+1+n+1+e.byteLength);s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=78,s[5]=1,s[6]=101;let a=0;for(;a<i;)s[7+a]=255,a++;return s[7+a]=o,a++,s.set(r,7+a),a+=n,s[7+a]=128,a++,s.set(new Uint8Array(e),7+a),s.buffer}(e,t);default:return null}}function yM(e){if(e.length<5)return"";let t=-1;for(let r=0;r<e.length-3;r++){if(0===e[r]&&0===e[r+1]&&1===e[r+2]){t=r;break}if(r<e.length-4&&0===e[r]&&0===e[r+1]&&0===e[r+2]&&1===e[r+3]){t=r;break}}if(-1===t)return"";const r=t+(0===e[t+2]?4:3);if(r>=e.length)return"";const n=e[r];if(128&n)return"";if((n>>1&63)>=32)return TM;if(r+1<e.length){if(0==(248&e[r+1]))return TM}return(31&n)<=31?_M:""}const AM=new Map;function bM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const OM=new Map;No(),e.AUDIO_CONTEXT_EVENT=xo,e.AUDIO_ENCODER_CONFIG_SETTINGS=Od,e.AUDIO_TRACK_EVENT=Kd,e.AgoraRTCPlayer=dw,e.AudioProcessorContext=cI,e.AudioProcessorDestination=aI,e.AudioSourceEvents=Hd,e.BufferSourceAudioTrack=tw,e.CameraVideoTrack=qw,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=Yd,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=Xd,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=Zd,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=zd,e.DataChannel=RN,e.DataChannelEvents=rl,e.DeviceManager=oO,e.DeviceManagerEvent=$d,e.DeviceManagerState=qd,e.LocalAudioTrack=$C,e.LocalDataChannel=class extends RN{send(e){if(this._originDataChannel){let t=e;t=this._dataStreamPacketHandler.serialize(e);const r=new Uint8Array(this._dataStreamPacketHeader.byteLength+t.byteLength);r.set(new Uint8Array(this._dataStreamPacketHeader),0),r.set(new Uint8Array(t),this._dataStreamPacketHeader.byteLength),this._originDataChannel.send(r.buffer)}}},e.LocalTrack=Pb,e.LocalTrackEvents=jd,e.LocalVideoTrack=Qw,e.MediaElementNumStatus={uninit:100,none:110,init:120,loadeddata:130,canplay:200,playing:210,paused:220,suspend:300,stalled:310,waiting:320,error:330,destroyed:340,abort:350,ended:360,emptied:370},e.MediaElementStatus=el,e.MicrophoneAudioTrack=ew,e.MixingAudioTrack=rw,e.PROCESSOR_CONTEXT_EVENTS=Qd,e.PROCESSOR_DESTINATION_EVENTS=Jd,e.RemoteAudioTrack=gN,e.RemoteDataChannel=class extends RN{constructor(e){super(e),JT(this,"_messageListener",void 0),this._messageListener=e=>{if(e.data.byteLength<this._dataStreamPacketHeader.byteLength)throw Error("invalid byteLength: the byte length must exceed "+this._dataStreamPacketHeader.byteLength);const t=e.data.slice(0,this._dataStreamPacketHeader.byteLength),r=new DataView(t).getUint8(3);if(r!==this.id)return void(Hi("SHOW_DATASTREAM2_LOG")&&ao.debug("invalid datachannel id: ".concat(r," !== ").concat(this.id)));let n=e.data.slice(this._dataStreamPacketHeader.byteLength);n=this._dataStreamPacketHandler.deserialize(n),this.emit(rl.MESSAGE,n)}}_updateDataChannelConfig(e){this._config=e}_updateOriginDataChannel(e){super._updateOriginDataChannel(e),this._bandRemoteDataChannelEvents()}_close(){this._originDataChannel&&(this._originDataChannel.removeEventListener("message",this._messageListener),super._close())}_bandRemoteDataChannelEvents(){this._originDataChannel&&this._originDataChannel.addEventListener("message",this._messageListener)}},e.RemoteStreamFallbackType=Fd,e.RemoteStreamType=Vd,e.RemoteTrack=_N,e.RemoteTrackEvents=Gd,e.RemoteVideoTrack=TN,e.SAFARI_GLOBAL_GUM_LOCK=eO,e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=Rd,e.SUPPORT_SVC_CONFIG_LIST=vd,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=Sd,e.StreamType=xd,e.Track=Nb,e.TrackEvents=Bd,e.TrackHint=Ud,e.TrackInternalEvent=Md,e.TrackMediaType=Wd,e.VideoPlayer=cw,e.VideoProcessorContext=sI,e.VideoProcessorDestination=oI,e.VideoState=tl,e.__TRACK_LIST__=Cd,e.addTrack=wd,e.audioContextState=Ub,e.audioElementPlayCenter=YO,e.audioTimerLoop=function(e,t){let r=!1;const n=1/t;if(Hi("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*n)}else{const t=Fb();let i=t.createGain();i.gain.value=0,i.connect(t.destination);const o=()=>{if(r)return void(i=null);const s=t.createOscillator();s.onended=o,s.connect(i),s.start(0),s.stop(t.currentTime+n),e(t.currentTime)};o()}return()=>{r=!0}},e.autoPlayGestureEventEmitter=BO,e.blob2Uint8Array=uC,e.checkMediaStreamTrackResolution=lI,e.checkTrackState=XO,e.createBufferSourceAudioTrack=async function(e){var t;const r=e.cacheOnlineFile,n=e.encoderConfig;let i=e.source;const o={source:i instanceof AudioBuffer?"AudioBuffer":i instanceof File?null!==(t=File.name)&&void 0!==t?t:"File":i,cacheOnlineFile:r,encoderConfig:n},s=Ti(8,"track-buf-"),a=Co.reportApiInvoke(null,{id:s,tag:qn.TRACER,name:Qn.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(Hi("DISABLE_WEBAUDIO"))throw new xn(Un.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");ao.info("start create buffer source audio track with config",JSON.stringify(o),"trackId",s);const c=i;if(!(i instanceof AudioBuffer))try{i=await async function(e,t){let r=null;if("string"==typeof e){const t=iw.get(e);if(t)return ao.debug("use cached audio resource: ",e),t;try{r=(await Pi((()=>en.get(e,{responseType:"arraybuffer"})),void 0,void 0,{maxRetryCount:3})).data}catch(e){throw new xn(Un.FETCH_AUDIO_FILE_FAILED,e.toString())}}else{const t=new wb(((t,r)=>{const n=new FileReader;n.onload=e=>{e.target?t(e.target.result):r(new xn(Un.READ_LOCAL_AUDIO_FILE_ERROR))},n.onerror=()=>{r(new xn(Un.READ_LOCAL_AUDIO_FILE_ERROR))},n.readAsArrayBuffer(e)}));r=await t}const n=await Gb(r);return"string"==typeof e&&t&&iw.set(e,n),n}(i,r)}catch(e){return a.onError(e),e.throw(ao)}const u=new nw(i),d=new tw(c,u,n?Id(n):{},s);return ao.info("create buffer source audio track success, trackId:",s),a.onSuccess(d.getTrackId()),d},e.createCameraVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Hi("CAMERA_CAPTURE_CONFIG"),r=Ti(8,"track-cam-"),n=Co.reportApiInvoke(null,{id:r,tag:qn.TRACER,name:Qn.CREATE_CAM_VIDEO_TRACK,options:[eN({},e),t]});t&&(e.encoderConfig=t);const i=hI(e);let o=null;ao.info("start create camera video track with config",JSON.stringify(e),"trackId",r);try{o=(await tO({video:i},r)).getVideoTracks()[0]||null}catch(e){throw n.onError(e),e}if(!o){const e=new xn(Un.UNEXPECTED_ERROR,"can not find track in media stream");return n.onError(e),e.throw(ao)}if(e.optimizationMode&&tN(r,o,e,yd(e.encoderConfig)),Hi("USE_STANDARD_BITRATE_DEFAULT")){const t=yd(e.encoderConfig);e.encoderConfig=t,delete t.bitrateMax,delete t.bitrateMin}const s=new qw(o,e,i,e.scalabiltyMode?bd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,r);return n.onSuccess(s.getTrackId()),ao.info("create camera video success, trackId:",r),s},e.createCustomAudioTrack=function(e){const t=Ti(8,"track-cus-"),r=Co.reportApiInvoke(null,{id:t,tag:qn.TRACER,name:Qn.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),n=new $C(e.mediaStreamTrack,e.encoderConfig?Id(e.encoderConfig):{},t,!1);return ao.info("create custom audio track success with config",e,"trackId",n.getTrackId()),r.onSuccess(n.getTrackId()),n},e.createCustomVideoTrack=function(e){const t=Ti(8,"track-cus-"),r=Co.reportApiInvoke(null,{id:t,tag:qn.TRACER,name:Qn.CREATE_CUSTOM_VIDEO_TRACK,options:[e]});Hi("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin);const n=new Qw(e.mediaStreamTrack,{width:e.width,height:e.height,frameRate:e.frameRate,bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin,minDownscaleWidth:e.minDownscaleWidth,minDownscaleHeight:e.minDownscaleHeight},e.scalabiltyMode?bd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,t,[Ud.CUSTOM_TRACK]);return r.onSuccess(n.getTrackId()),ao.info("create custom video track success with config",e,"trackId",n.getTrackId()),n},e.createMicrophoneAndCameraTracks=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=Hi("CAMERA_CAPTURE_CONFIG"),n=Ti(8,"track-mic-"),i=Ti(8,"track-cam-"),o=Co.reportApiInvoke(null,{id:"".concat(n,"-").concat(i),tag:qn.TRACER,name:Qn.CREATE_MIC_AND_CAM_TRACKS,options:[e,t,r]});r&&(t.encoderConfig=r);const s=hI(t),a=mI(e);let c=null,u=null;ao.info("start create camera video track(".concat(i,") and microphone audio track(").concat(n,") with config, audio: ").concat(JSON.stringify(e),", video: ").concat(JSON.stringify(t)));try{const e=await tO({audio:a,video:s},"".concat(n,"-").concat(i));c=e.getAudioTracks()[0],u=e.getVideoTracks()[0]}catch(e){throw o.onError(e),e}if(!c||!u){const e=new xn(Un.UNEXPECTED_ERROR,"can not find tracks in media stream");return o.onError(e),e.throw(ao)}if(t.optimizationMode&&tN(i,u,t,yd(t.encoderConfig)),Hi("USE_STANDARD_BITRATE_DEFAULT")){const e=yd(t.encoderConfig);t.encoderConfig=e,delete e.bitrateMax,delete e.bitrateMin}const d=new ew(c,e,a,n),l=new qw(u,t,s,t.scalabiltyMode?bd(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,i);return o.onSuccess([d.getTrackId(),l.getTrackId()]),ao.info("create camera video track(".concat(i,") and microphone audio track(").concat(n,") success")),[d,l]},e.createMicrophoneAudioTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Ti(8,"track-mic-"),r=Co.reportApiInvoke(null,{id:t,tag:qn.TRACER,name:Qn.CREATE_MIC_AUDIO_TRACK,options:[e]}),n=mI(e);let i=null;ao.info("start create microphone audio track with config",JSON.stringify(e),"trackId",t);try{i=(await tO({audio:n},t)).getAudioTracks()[0]||null}catch(e){throw r.onError(e),e}if(!i){const e=new xn(Un.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw(ao)}const o=new ew(i,e,n,t);return r.onSuccess(o.getTrackId()),ao.info("create microphone audio track success, trackId:",t),o},e.createMixingAudioTrack=function(e){const t=new rw;return e.forEach((e=>t.addAudioTrack(e))),t},e.createScreenVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"disable";const r="object"==typeof t?EI(t):void 0;r&&(t="auto");const n=Ti(8,"track-scr-v-"),i=Co.reportApiInvoke(null,{id:n,tag:qn.TRACER,name:Qn.CREATE_SCREEN_VIDEO_TRACK,options:[eN({},e),t]});e.encoderConfig?"string"==typeof e.encoderConfig||e.encoderConfig.width&&e.encoderConfig.height||(e.encoderConfig.width={max:1920},e.encoderConfig.height={max:1080}):e.encoderConfig="1080p_2";const o=pI(e);let s=null,a=null;const c=Po();if(!c.supportShareAudio&&"enable"===t){const e=new xn(Un.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio");return i.onError(e),e.throw(ao)}ao.info("start create screen video track with config",e,"withAudio",t,"trackId",n);const u=c.supportShareAudio&&"disable"!==t;try{const e=await tO({screen:o,screenAudio:u?r||!0:void 0},n);s=e.getVideoTracks()[0]||null,a=e.getAudioTracks()[0]||null}catch(e){throw i.onError(e),e}if(!s){const e=new xn(Un.UNEXPECTED_ERROR,"can not find track in media stream");return i.onError(e),e.throw(ao)}if(!a&&"enable"===t){s&&s.stop();const e=new xn(Un.SHARE_AUDIO_NOT_ALLOWED);return i.onError(e),e.throw(ao)}if(e.optimizationMode||(e.optimizationMode="detail"),e.optimizationMode){tN(n,s,e,e.encoderConfig&&Ad(e.encoderConfig)||void 0),e.encoderConfig&&"string"!=typeof e.encoderConfig&&(e.encoderConfig.bitrateMin=e.encoderConfig.bitrateMax)}const d=new Qw(s,e.encoderConfig?Ad(e.encoderConfig):{},e.scalabiltyMode?bd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,n,[Ud.SCREEN_TRACK]);if(!a)return i.onSuccess(d.getTrackId()),ao.info("create screen video track success","video:",d.getTrackId()),d;const l=new $C(a,void 0,Ti(8,"track-scr-a-"),!1);return i.onSuccess([d.getTrackId(),l.getTrackId()]),ao.info("create screen video track success","video:",d.getTrackId(),"audio:",l.getTrackId()),[d,l]},e.decodeAudioData=Gb,e.detectSupportAudioElementSetSinkId=Do,e.detectSupportAutCC=function(){return!!Hi("FORCE_ENABLE_AUT_CC")||!Lo()&&(!!Hi("ENABLE_AUT_CC")||void 0)},e.detectSupportAutCCFeedback=function(){return!!Hi("FORCE_ENABLE_AUT_CC")||!Lo()&&(!!Hi("ENABLE_AUT_FEEDBACK")||void 0)},e.detectSupportInstantVideo=function(e){return Hi("ENABLE_INSTANT_VIDEO")?Hi("ENABLE_INSTANT_VIDEO"):!(null==e||!e.autoSubscribe||Hi("FORCE_DISABLE_AUTO_SUB"))},e.detectSupportPrePc=function(e){return!Lo()&&!Hi("USE_NEW_TOKEN")&&(!!Hi("ENABLE_PREALLOC_PC")||!(null==e||!e.autoSubscribe||Hi("FORCE_DISABLE_AUTO_SUB")))},e.detectSupportPreSub=function(e){return!(En()||function(e){const t=an();return!(t.name!==rn.CHROME||!t.osVersion)&&Number(t.version)<e}(87)||Lo())&&(!!Hi("ENABLE_PRE_SUB")||!(null==e||!e.autoSubscribe||Hi("FORCE_DISABLE_AUTO_SUB")))},e.detectSupportRestrictOwnAudio=Uo,e.detectSupportSDPEndpoint=function(){return Hi("ENABLE_JOIN_V4")},e.detectSupportSuppressLocalAudioPlayback=Mo,e.deviceManager=sO,e.emptyImage2TypedArray=cC,e.frameData2CryptoBuffer=async(e,t,r)=>await aC(e.buffer,t,r),e.getAudioContext=Fb,e.getAudioEncoderConfiguration=Id,e.getBitrateConstrainRange=oC,e.getBitrateFromResAndFps=sC,e.getCompatibility=Po,e.getConstraintsFromAudioConfig=fI,e.getConstraintsFromCameraConfig=hI,e.getConstraintsFromMicrophoneConfig=mI,e.getConstraintsFromScreenAudioConfig=EI,e.getConstraintsFromScreenConfig=pI,e.getElectronScreenSources=qb,e.getElectronScreenStream=Jb,e.getElectronScreenStreamByUserSelect=Qb,e.getLocalStream=tO,e.getNewNearestVideoProfile=iC,e.getNewVideoBitrate=nC,e.getOriginSenderConfig=e=>{const t=e._encoderConfig;if(!t)return;const r=e.getMediaStreamTrackSettings(),n=r.frameRate,i=r.width,o=r.height;let s=t.frameRate,a=void 0===s?n:s,c=t.width,u=void 0===c?i:c,d=t.height,l=void 0===d?o:d;if(!a||!u||!l)return;u=Ai(u),l=Ai(l),a=Ai(a);const h=sC(u,l,a),p=h.max,f=h.min,E=t||{},m=E.bitrateMax,_=E.bitrateMin,T=E.minDownscaleWidth,g=E.minDownscaleHeight;m||ao.debug("calculate bitrate: [w: ".concat(u,", h: ").concat(l,", fps: ").concat(a,"] => [brMax: ").concat(m,", brMin: ").concat(_,"]"));const S=Hi("ENCODER_CONFIG_LIMIT").maxFramerate;return S&&"number"==typeof S&&(a=Math.min(a,S)),{width:u,height:l,frameRate:a,bitrateMax:m||p,bitrateMin:_||f,scaleResolutionDownBy:1,scale:0,minDownscaleWidth:T,minDownscaleHeight:g}},e.getScalabilityConfiguration=bd,e.getScreenEncoderConfiguration=Ad,e.getSilenceAudioTrack=function(){if(Hb)return Hb;const e=Fb();if(!e.createMediaStreamDestination)throw new xn(Un.NOT_SUPPORTED,"can not create silence audio track");const t=e.createBufferSource(),r=e.createBuffer(1,44100,44100);t.loop=!0,t.buffer=r;const n=e.createMediaStreamDestination();return t.connect(n),Hb=n.stream.getAudioTracks()[0],Hb},e.getSilenceSamplesDuration=function(e){const t=e.getChannelData(0);let r=0,n=0;for(let e=0;e<t.length;e+=1)0===t[e]?(r+=1,r>n&&(n=r)):r=0;return n/t.length*e.duration},e.getStaticTrackStream=dC,e.getVideoEncoderConfiguration=yd,e.handleGetUserMediaError=nO,e.hasAudioContext=Bb,e.hasMicrophoneTrack=Pd,e.interceptLocalAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Po().supportWebRTCEncodedTransform)return void ao.warning("browser not support audio encoded transform");if(Bk.has(e))return;if(!e.track)return;const r={track:e.track};if(hn()){if(!e.createEncodedStreams)return void ao.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void ao.error("create audio-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(i,o){r.controller||(r.controller=o),e.track&&e.track.id!==r.track.id&&(ao.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n));const s=t.metadata&&t.metadata();s?jk(s,{sender:e,chunk:i,controller:o}):o.enqueue(i)}});i.readable.pipeThrough(o).pipeTo(i.writable)}else if(pn()){if("undefined"==typeof RTCRtpScriptTransform)return void ao.warning("browser not support RTCRtpScriptTransform");const i=Dk(),o=new MessageChannel;await new wb((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(i,{name:"audio-metadata-tx",port:o.port2},[o.port2]);e.transform=s,await new wb((e=>i.onmessage=t=>{"started"===t.data&&e(void 0)})),o.port1.onmessage=i=>{var s;if(i.data.transformed&&e.track&&(null===(s=e.track)||void 0===s?void 0:s.id)!==r.track.id)ao.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n);else if(i.data.getMetadata){const e=t.metadata&&t.metadata();e&&o.port1.postMessage({metadata:e})}},r.worker=i}function n(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",n)}const t=Bk.get(e);if(t){Bk.delete(e);try{var r,i;null===(r=t.controller)||void 0===r||r.terminate(),null===(i=t.worker)||void 0===i||i.terminate()}catch(e){ao.warning(e&&e.message)}}}Bk.set(e,r),e.track.addEventListener("ended",n)},e.interceptLocalVideoFrame=async function(e,t){if(!Po().supportWebRTCEncodedTransform)return void ao.warning("browser not support video encoded transform");if(AM.has(e))return;if(!e.track)return;const r={track:e.track};if(hn()){if(!e.createEncodedStreams)return void ao.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void ao.error("create video-encoded-streams error",e&&e.message)}const o=[];t.on("sei-to-send",(e=>{o.push(e)}));const s=new TransformStream({transform(t,i){r.controller||(r.controller=i),e.track&&e.track.id!==r.track.id&&(ao.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n));const s=yM(new Uint8Array(t.data)),a=o.shift();if(a){const e=vM(t.data,a,s);e&&(t.data=e)}i.enqueue(t)}});i.readable.pipeThrough(s).pipeTo(i.writable)}else{if(!pn())return;{if("undefined"==typeof RTCRtpScriptTransform)return void ao.warning("browser not support RTCRtpScriptTransform");const i=Dk(),o=new MessageChannel;await new wb((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(i,{name:"sei-tx",port:o.port2},[o.port2]);e.transform=s,await new wb((e=>i.onmessage=t=>{"started"===t.data&&e(void 0)})),t.on("sei-to-send",(e=>{o.port1.postMessage({sei:e})})),o.port1.onmessage=t=>{var i;t.data.transformed&&e.track&&(null===(i=e.track)||void 0===i?void 0:i.id)!==r.track.id&&(ao.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n))},r.worker=i}}function n(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",n)}const t=AM.get(e);if(t){AM.delete(e);try{var r,i;null===(r=t.controller)||void 0===r||r.terminate(),null===(i=t.worker)||void 0===i||i.terminate()}catch(e){ao.warning(e&&e.message)}}}AM.set(e,r),e.track.addEventListener("ended",n)},e.interceptRemoteAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Po().supportWebRTCEncodedTransform)return void ao.warning("browser not support audio encoded transform");if(fM.has(e))return;const r={track:e.track,onMetadata:t.onMetadata,onPts:t.onPts};if(hn()&&!mn()){if(!e.createEncodedStreams)return void ao.warning("browser not support createEncodedStreams() API");Tn(rn.CHROME,87,116)||(t.enableTopn=!1);let i=null;try{i=e.createEncodedStreams()}catch(e){return void ao.error("create audio-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(i,o){r.controller||(r.controller=o),e.track&&e.track.id!==r.track.id&&(ao.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n)),t.enableTopn?function(e,t,r){var n;const i=Fk(new DataView(t.data));if(!i)return r.enqueue(t);const o=e.track.id;EM.set(o,e.track);const s=null===(n=i.tlv.find((e=>e.tag===Vk.AUDIO_LEVEL)))||void 0===n?void 0:n.value;let a=0;"number"==typeof s&&(a=127-s);const c=oM(e,Math.round(Math.pow(10,a/60)-1)),u=c.selected,d=c.speaker,l=hM(o,e.track,d.energyScore);l.addSample(u),l.active&&(t.data=i.frame.buffer,r.enqueue(t))}(e,i,o):t.enableMetadata||t.enablePts?mM(i,o,t.onMetadata,t.onPts):o.enqueue(i)}});i.readable.pipeThrough(o).pipeTo(i.writable)}else{if("undefined"==typeof RTCRtpScriptTransform)return void ao.warning("browser not support RTCRtpScriptTransform");const t=Dk(),i=new MessageChannel;await new wb((e=>t.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(t,{name:"audio-metadata-rx",port:i.port2},[i.port2]);e.transform=o,await new wb((e=>t.onmessage=t=>{"started"===t.data&&e(void 0)})),i.port1.onmessage=t=>{var i;t.data.transformed&&e.track&&(null===(i=e.track)||void 0===i?void 0:i.id)!==r.track.id?(ao.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n)):t.data.metadata&&r.onMetadata?r.onMetadata(t.data.metadata):t.data.pts&&r.onPts&&r.onPts(t.data.pts)},r.worker=t}function n(){e.track.removeEventListener("ended",n),function(e){const t=fM.get(e);if(t){!function(e){const t=eM.get(e);t&&(eM.delete(e),tM&&(tM.removeSpeakers([t]),0===eM.size&&(tM.destroy(),tM=null)))}(e),pM(e.track.id),fM.delete(e);try{var r,n;null===(r=t.controller)||void 0===r||r.terminate(),null===(n=t.worker)||void 0===n||n.terminate()}catch(e){ao.warning(e&&e.message)}}}(e)}fM.set(e,r),e.track.addEventListener("ended",n)},e.interceptRemoteVideoFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Po().supportWebRTCEncodedTransform)return void ao.warning("browser not support video encoded transform");if(!e.track)return;if(OM.has(e)){const r=OM.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(hn()){if(!e.createEncodedStreams)return void ao.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void ao.error("create video-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(i,o){if(r.controller||(r.controller=o),!r.firstFrameInfo){var s;const e=i.getMetadata()||{};r.firstFrameInfo=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?bM(Object(r),!0).forEach((function(t){JT(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):bM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({type:i.type,rtpTimestamp:i.timestamp,payloadType:e.payloadType||0,ssrc:e.synchronizationSource||0,length:i.data.byteLength},"mimeType"in e?{mimeType:e.mimeType}:{}),null===(s=t.onFirstFrame)||void 0===s||s.call(t,r.firstFrameInfo)}e.track&&e.track.id!==r.track.id&&(ao.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n));const a=SM(i,yM(new Uint8Array(i.data)));a&&r.onSei&&r.onSei(a,i.timestamp),o.enqueue(i)}});i.readable.pipeThrough(o).pipeTo(i.writable)}else if(pn()){if("undefined"==typeof RTCRtpScriptTransform)return void ao.warning("browser not support RTCRtpScriptTransform");const i=Dk(),o=new MessageChannel;await new wb((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(i,{name:"sei-rx",port:o.port2},[o.port2]);e.transform=s,await new wb((e=>i.onmessage=t=>{"started"===t.data&&e(void 0)})),o.port1.onmessage=i=>{var o;if(i.data.transformed&&e.track&&(null===(o=e.track)||void 0===o?void 0:o.id)!==r.track.id)ao.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n);else if(i.data.sei&&r.onSei)r.onSei(i.data.sei,i.data.rtpTimestamp);else if(i.data.firstFrameInfo&&t.onFirstFrame){var s;null===(s=t.onFirstFrame)||void 0===s||s.call(t,i.data.firstFrameInfo)}},r.worker=i}function n(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",n)}!function(e){const t=OM.get(e);if(t){OM.delete(e);try{var r,n;null===(r=t.controller)||void 0===r||r.terminate(),null===(n=t.worker)||void 0===n||n.terminate()}catch(e){ao.warning(e&&e.message)}}}(e)}OM.set(e,r),e.track.addEventListener("ended",n)},e.isAudioEncoderConfiguration=Ld,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?Fn(e,"profile",Object.keys(Od)):Ld(e),!0},e.isBeautyEffectOptions=function(e){return void 0!==e.smoothnessLevel&&Bn(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&Bn(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&Bn(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&Fn(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),!0},e.isElectron=Zn,e.isLowStreamParameter=function(e){if(!e)throw new xn(Un.INVALID_PARAMS);return Gn(e.width)||jn(e.width,"streamParameter.width"),Gn(e.height)||jn(e.height,"streamParameter.height"),Gn(e.framerate)||jn(e.framerate,"streamParameter.framerate"),Gn(e.bitrate)||Bn(e.bitrate,"streamParameter.bitrate"),!0},e.isPlanB=Lo,e.isScreenSourceType=kd,e.isVideoEncoderConfiguration=Dd,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?Fn(e,"profile",Object.keys(Sd)):Dd(e),!0},e.polyfillAudioNode=jb,e.removeTrack=Nd,e.requestAutoplayGesture=jO,e.restartBackgroundTag=Vb,e.silenceScriptProcessHandler=Kb,e.updateAgoraRTCCompatibility=No,e.visibilityWatcher=SN}));
5
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).AgoraRTCMedia={})}(this,(function(e){"use strict";function t(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}let r=!0,n=!0;function i(e,t,r){const n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function o(e,t,r){if(!e.RTCPeerConnection)return;const n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);const o=e=>{const t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(n,o),i.apply(this,[e,o])};const o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);const n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(n,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function s(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(r=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function a(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(n=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function c(){if("object"==typeof window){if(r)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function u(e,t){n&&console.warn(e+" is deprecated, please use "+t+" instead.")}function d(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e){return d(e)?Object.keys(e).reduce((function(t,r){const n=d(e[r]),i=n?l(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,{[r]:i})}),{}):e}function h(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((n=>{n.endsWith("Id")?h(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((t=>{h(e,e.get(t),r)}))})))}function p(e,t,r){const n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(null===t)return i;const o=[];return e.forEach((e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((t=>{e.forEach((r=>{r.type===n&&r.trackId===t.id&&h(e,r,i)}))})),i}const f=c;function E(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const n=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];let e={};"number"==typeof n.ideal?(e[i("min",r)]=n.ideal,t.optional.push(e),e={},e[i("max",r)]=n.ideal,t.optional.push(e)):(e[i("",r)]=n.ideal,t.optional.push(e))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then((r=>{let s=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!s&&r.length&&t.includes("back")&&(s=r[r.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=n(e.video),f("chrome: "+JSON.stringify(e)),i(e)}))}e.video=n(e.video)}return f("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return i(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function m(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function _(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const i=new Event("track");i.track=r.track,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else o(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function T(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){let i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function g(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach((e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const n=function(e){r(o(i(e)))};return t.apply(this,[n,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(i(t)))},r])})).then(r,n)}}function S(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>p(t,e.track,!0)))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),o(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>p(t,e.track,!1)))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,n;return this.getSenders().forEach((r=>{r.track===e&&(t?n=!0:t=r)})),this.getReceivers().forEach((t=>(t.track===e&&(r?n=!0:r=t),t.track===e))),n||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function y(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((e=>this._shimmedLocalStreams[e][0]))};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")}));const t=this.getSenders();r.apply(this,arguments);const n=this.getSenders().filter((e=>-1===t.indexOf(e)));this._shimmedLocalStreams[e.id]=[e].concat(n)};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]})),i.apply(this,arguments)}}function R(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return y(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map((e=>this._reverseStreams[e.id]))};const n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((e=>{if(this.getSenders().find((t=>t.track===e)))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}n.apply(this,[t])};const i=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((e=>e===t)))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");if(this.getSenders().find((e=>e.track===t)))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const i=this._streams[r.id];if(i)i.addTrack(t),Promise.resolve().then((()=>{this.dispatchEvent(new Event("negotiationneeded"))}));else{const n=new e.MediaStream([t]);this._streams[r.id]=n,this._reverseStreams[n.id]=r,this.addStream(n)}return this.getSenders().find((e=>e.track===t))},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then((e=>o(this,e)))}};e.RTCPeerConnection.prototype[t]=n[t]}));const s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function v(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}))}function A(e,t){o(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var b=Object.freeze({__proto__:null,fixNegotiationNeeded:A,shimAddTrackRemoveTrack:R,shimAddTrackRemoveTrackWithNative:y,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((t=>{const n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))},shimGetSendersWithDtmf:T,shimGetStats:g,shimGetUserMedia:E,shimMediaStream:m,shimOnTrack:_,shimPeerConnection:v,shimSenderReceiverGetStats:S});function O(e,t){const r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){u("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},n&&n.prototype.getSettings){const t=n.prototype.getSettings;n.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(n&&n.prototype.applyConstraints){const t=n.prototype.applyConstraints;n.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function I(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function C(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,i,o]=arguments;return n.apply(this,[e||null]).then((e=>{if(t.version<53&&!i)try{e.forEach((e=>{e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach(((t,n)=>{e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(i,o)}}function w(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function N(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e}),o(e,"track",(e=>(e.receiver._pc=e.srcElement,e))),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function P(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){u("removeStream","removeTrack"),this.getSenders().forEach((t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)}))})}function D(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function L(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]),e=[...e];const r=e.length>0;r&&e.forEach((e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));const n=t.apply(this,arguments);if(r){const{sender:t}=n,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e,t.sendEncodings=e,this.setParametersPromises.push(t.setParameters(r).then((()=>{delete t.sendEncodings})).catch((()=>{delete t.sendEncodings}))))}return n})}function k(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function M(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}function U(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((()=>t.apply(this,arguments))).finally((()=>{this.setParametersPromises=[]})):t.apply(this,arguments)}}var x=Object.freeze({__proto__:null,shimAddTransceiver:L,shimCreateAnswer:U,shimCreateOffer:M,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,Promise.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})},shimGetParameters:k,shimGetUserMedia:O,shimOnTrack:I,shimPeerConnection:C,shimRTCDataChannel:D,shimReceiverGetStats:N,shimRemoveStream:P,shimSenderGetStats:w});function V(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((r=>t.call(this,r,e))),e.getVideoTracks().forEach((r=>t.call(this,r,e)))},e.RTCPeerConnection.prototype.addTrack=function(e,...r){return r&&r.forEach((e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach((e=>{r.includes(e.track)&&this.removeTrack(e)}))})}}function F(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach((e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)}))})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}))}),t.apply(e,arguments)}}}function B(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),Promise.resolve()):i},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),Promise.resolve()):i};let a=function(e,t,r){const n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=a,a=function(e,t,r){const n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=a,a=function(e,t,r){const n=s.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=a}function j(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(W(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function W(e){return e&&void 0!==e.video?Object.assign({},e,{video:l(e.video)}):e}function G(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let n=e.iceServers[r];!n.hasOwnProperty("urls")&&n.hasOwnProperty("url")?(u("RTCIceServer.url","RTCIceServer.urls"),n=JSON.parse(JSON.stringify(n)),n.urls=n.url,delete n.url,t.push(n)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function H(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function K(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find((e=>"audio"===e.receiver.track.kind));!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find((e=>"video"===e.receiver.track.kind));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Y(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var X=Object.freeze({__proto__:null,shimAudioContext:Y,shimCallbacksAPI:B,shimConstraints:W,shimCreateOfferLegacy:K,shimGetUserMedia:j,shimLocalStreamsAPI:V,shimRTCIceServerUrls:G,shimRemoteStreamsAPI:F,shimTrackEventTransceiver:H}),Z="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function z(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var J={exports:{}};!function(e){const t={generateIdentifier:function(){return Math.random().toString(36).substring(2,12)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((e=>e.trim()))},t.splitSections=function(e){return e.split("\nm=").map(((e,t)=>(t>0?"m="+e:e).trim()+"\r\n"))},t.getDescription=function(e){const r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){const r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((e=>0===e.indexOf(r)))},t.parseCandidate=function(e){let t;t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" ");const r={foundation:t[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]};for(let e=8;e<t.length;e+=2)switch(t[e]){case"raddr":r.relatedAddress=t[e+1];break;case"rport":r.relatedPort=parseInt(t[e+1],10);break;case"tcptype":r.tcpType=t[e+1];break;case"ufrag":r.ufrag=t[e+1],r.usernameFragment=t[e+1];break;default:void 0===r[t[e]]&&(r[t[e]]=t[e+1])}return r},t.writeCandidate=function(e){const t=[];t.push(e.foundation);const r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);const n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&void 0!==e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substring(14).split(" ")},t.parseRtpMap=function(e){let t=e.substring(9).split(" ");const r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){let t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);const r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){const t=e.substring(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1],attributes:t.slice(2).join(" ")}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+"\r\n"},t.parseFmtp=function(e){const t={};let r;const n=e.substring(e.indexOf(" ")+1).split(";");for(let e=0;e<n.length;e++)r=n[e].trim().split("="),t[r[0].trim()]=r[1];return t},t.writeFmtp=function(e){let t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const n=[];Object.keys(e.parameters).forEach((t=>{void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){const t=e.substring(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){let t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((e=>{t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){const t=e.indexOf(" "),r={ssrc:parseInt(e.substring(7,t),10)},n=e.indexOf(":",t);return n>-1?(r.attribute=e.substring(t+1,n),r.value=e.substring(n+1)):r.attribute=e.substring(t+1),r},t.parseSsrcGroup=function(e){const t=e.substring(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((e=>parseInt(e,10)))}},t.getMid=function(e){const r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substring(6)},t.parseFingerprint=function(e){const t=e.substring(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){let r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((e=>{r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){const t=e.substring(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;const t=e.substring(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){const n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substring(12),password:i.substring(10)}:null},t.writeIceParameters=function(e){let t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},t.parseRtpParameters=function(e){const r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" ");r.profile=n[2];for(let i=3;i<n.length;i++){const o=n[i],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){const n=t.parseRtpMap(s),i=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(n.parameters=i.length?t.parseFmtp(i[0]):{},n.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(n),n.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(n.name.toUpperCase())}}}t.matchPrefix(e,"a=extmap:").forEach((e=>{r.headerExtensions.push(t.parseExtmap(e))}));const i=t.matchPrefix(e,"a=rtcp-fb:* ").map(t.parseRtcpFb);return r.codecs.forEach((e=>{i.forEach((t=>{e.rtcpFeedback.find((e=>e.type===t.type&&e.parameter===t.parameter))||e.rtcpFeedback.push(t)}))})),r},t.writeRtpDescription=function(e,r){let n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" "+(r.profile||"UDP/TLS/RTP/SAVPF")+" ",n+=r.codecs.map((e=>void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType)).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((e=>{n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));let i=0;return r.codecs.forEach((e=>{e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((e=>{n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){const r=[],n=t.parseRtpParameters(e),i=-1!==n.fecMechanisms.indexOf("RED"),o=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),a=s.length>0&&s[0].ssrc;let c;const u=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));u.length>0&&u[0].length>1&&u[0][0]===a&&(c=u[0][1]),n.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:a,codecPayloadType:parseInt(e.parameters.apt,10)};a&&c&&(t.rtx={ssrc:c}),r.push(t),i&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:a,mechanism:o?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&a&&r.push({ssrc:a});let d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substring(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substring(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=d}))),r},t.parseRtcpParameters=function(e){const r={},n=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);const i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;const o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.writeRtcpParameters=function(e){let t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},t.parseMsid=function(e){let r;const n=t.matchPrefix(e,"a=msid:");if(1===n.length)return r=n[0].substring(7).split(" "),{stream:r[0],track:r[1]};const i=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"msid"===e.attribute));return i.length>0?(r=i[0].value.split(" "),{stream:r[0],track:r[1]}):void 0},t.parseSctpDescription=function(e){const r=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");let i;n.length>0&&(i=parseInt(n[0].substring(19),10)),isNaN(i)&&(i=65536);const o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substring(12),10),protocol:r.fmt,maxMessageSize:i};const s=t.matchPrefix(e,"a=sctpmap:");if(s.length>0){const e=s[0].substring(10).split(" ");return{port:parseInt(e[0],10),protocol:e[1],maxMessageSize:i}}},t.writeSctpDescription=function(e,t){let r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,22)},t.writeSessionBoilerplate=function(e,r,n){let i;const o=void 0!==r?r:2;i=e||t.generateSessionId();return"v=0\r\no="+(n||"thisisadapterortc")+" "+i+" "+o+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){const n=t.splitLines(e);for(let e=0;e<n.length;e++)switch(n[e]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[e].substring(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substring(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){const r=t.splitLines(e)[0].substring(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){const r=t.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;const r=t.splitLines(e);for(let e=0;e<r.length;e++)if(r[e].length<2||"="!==r[e].charAt(1))return!1;return!0},e.exports=t}(J);var Q=J.exports,q=z(Q),$=t({__proto__:null,default:q},[Q]);function ee(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),n=q.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,o(e,"icecandidate",(t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t)))}function te(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||o(e,"icecandidate",(e=>{if(e.candidate){const t=q.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function re(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=function(e){if(!e||!e.sdp)return!1;const t=q.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=q.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r},i=function(e){let r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){let n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);const i=q.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},s=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const e=n(arguments[0]),t=i(e),r=o(arguments[0],e);let s;s=0===t&&0===r?Number.POSITIVE_INFINITY:0===t||0===r?Math.max(t,r):Math.min(t,r);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>s}),this._sctp=a}return s.apply(this,arguments)}}function ne(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},o(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function ie(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}function oe(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function se(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ae(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return r.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}if(e.sdp||"offer"!==e.type&&"answer"!==e.type)return r.apply(this,[e]);return("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then((e=>r.apply(this,[e])))})}var ce=Object.freeze({__proto__:null,removeExtmapAllowMixed:oe,shimAddIceCandidateNullOrEmpty:se,shimConnectionState:ie,shimMaxMessageSize:re,shimParameterlessSetLocalDescription:ae,shimRTCIceCandidate:ee,shimRTCIceCandidateRelayProtocol:te,shimSendThrowTypeError:ne});!function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=c,n=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=i(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=i(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=i(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),o={browserDetails:n,commonShim:ce,extractVersion:i,disableLog:s,disableWarnings:a,sdp:$};switch(n.browser){case"chrome":if(!b||!v||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=b,se(e,n),ae(e),E(e,n),m(e),v(e,n),_(e),R(e,n),T(e),g(e),S(e),A(e,n),ee(e),te(e),ie(e),re(e,n),ne(e),oe(e,n);break;case"firefox":if(!x||!C||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=x,se(e,n),ae(e),O(e,n),C(e,n),I(e),P(e),w(e),N(e),D(e),L(e),k(e),M(e),U(e),ee(e),ie(e),re(e,n),ne(e);break;case"safari":if(!X||!t.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=X,se(e,n),ae(e),G(e),K(e),B(e),V(e),F(e),H(e),j(e),Y(e),ee(e),te(e),re(e,n),ne(e),oe(e,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var ue={exports:{}};!function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",c="major",u="model",d="name",l="type",h="vendor",p="version",f="architecture",E="console",m="mobile",_="tablet",T="smarttv",g="wearable",S="embedded",y="Amazon",R="Apple",v="ASUS",A="BlackBerry",b="Browser",O="Chrome",I="Firefox",C="Google",w="Huawei",N="LG",P="Microsoft",D="Motorola",L="Opera",k="Samsung",M="Sharp",U="Sony",x="Xiaomi",V="Zebra",F="Facebook",B="Chromium OS",j="Mac OS",W=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},G=function(e,t){return typeof e===a&&-1!==H(t).indexOf(H(e))},H=function(e){return e.toLowerCase()},K=function(e,t){if(typeof e===a)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,350)},Y=function(e,t){for(var r,o,a,c,u,d,l=0;l<t.length&&!u;){var h=t[l],p=t[l+1];for(r=o=0;r<h.length&&!u&&h[r];)if(u=h[r++].exec(e))for(a=0;a<p.length;a++)d=u[++o],typeof(c=p[a])===s&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,d):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=d?d.replace(c[1],c[2]):n:this[c[0]]=d?c[1].call(this,d,c[2]):n:4===c.length&&(this[c[0]]=d?c[3].call(this,d.replace(c[1],c[2])):n):this[c]=d||n;l+=2}},X=function(e,t){for(var r in t)if(typeof t[r]===s&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(G(t[r][i],e))return"?"===r?n:r}else if(G(t[r],e))return"?"===r?n:r;return e},Z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},z={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[d,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[d,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[d,p],[/opios[\/ ]+([\w\.]+)/i],[p,[d,L+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[d,L]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant |iemobile|slim)(?:browser)?[\/ ]?([\w\.]*)/i,/(ba?idubrowser)[\/ ]?([\w\.]+)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(weibo)__([\d\.]+)/i],[d,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[d,"UC"+b]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[d,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[d,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[d,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[d,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[d,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[d,/(.+)/,"$1 Secure "+b],p],[/\bfocus\/([\w\.]+)/i],[p,[d,I+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[d,L+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[d,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[d,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[d,L+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[d,"MIUI "+b]],[/fxios\/([-\w\.]+)/i],[p,[d,I]],[/\bqihu|(qi?ho?o?|360)browser/i],[[d,"360 "+b]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[d,/(.+)/,"$1 "+b],p],[/(comodo_dragon)\/([\w\.]+)/i],[[d,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[d,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[d],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[d,F],p],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[d,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[d,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[d,O+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[d,O+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[d,"Android "+b]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[d,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[d,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,d],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[d,[p,X,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[d,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[d,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[d,I+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[d,p],[/(cobalt)\/([\w\.]+)/i],[d,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[f,"amd64"]],[/(ia32(?=;))/i],[[f,H]],[/((?:i[346]|x)86)[;\)]/i],[[f,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[f,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[f,"armhf"]],[/windows (ce|mobile); ppc;/i],[[f,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[f,/ower/,"",H]],[/(sun4\w)[;\)]/i],[[f,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[f,H]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[u,[h,k],[l,_]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[u,[h,k],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[u,[h,R],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[u,[h,R],[l,_]],[/(macintosh);/i],[u,[h,R]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[u,[h,M],[l,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[u,[h,w],[l,_]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[u,[h,w],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[u,/_/g," "],[h,x],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[u,/_/g," "],[h,x],[l,_]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[u,[h,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[u,[h,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[u,[h,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[u,[h,D],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[u,[h,D],[l,_]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[u,[h,N],[l,_]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[u,[h,N],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[u,[h,"Lenovo"],[l,_]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[u,/_/g," "],[h,"Nokia"],[l,m]],[/(pixel c)\b/i],[u,[h,C],[l,_]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[u,[h,C],[l,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[u,[h,U],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[u,"Xperia Tablet"],[h,U],[l,_]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[u,[h,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[u,[h,y],[l,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[u,/(.+)/g,"Fire Phone $1"],[h,y],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[u,h,[l,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[u,[h,A],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[u,[h,v],[l,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[u,[h,v],[l,m]],[/(nexus 9)/i],[u,[h,"HTC"],[l,_]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[u,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[u,[h,"Acer"],[l,_]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[u,[h,"Meizu"],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[h,u,[l,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[h,u,[l,_]],[/(surface duo)/i],[u,[h,P],[l,_]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[u,[h,"Fairphone"],[l,m]],[/(u304aa)/i],[u,[h,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[u,[h,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[u,[h,"RCA"],[l,_]],[/\b(venue[\d ]{2,7}) b/i],[u,[h,"Dell"],[l,_]],[/\b(q(?:mv|ta)\w+) b/i],[u,[h,"Verizon"],[l,_]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[u,[h,"Barnes & Noble"],[l,_]],[/\b(tm\d{3}\w+) b/i],[u,[h,"NuVision"],[l,_]],[/\b(k88) b/i],[u,[h,"ZTE"],[l,_]],[/\b(nx\d{3}j) b/i],[u,[h,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[u,[h,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[u,[h,"Swiss"],[l,_]],[/\b((zeki)?tb.*\b) b/i],[u,[h,"Zeki"],[l,_]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],u,[l,_]],[/\b(ns-?\w{0,9}) b/i],[u,[h,"Insignia"],[l,_]],[/\b((nxa|next)-?\w{0,9}) b/i],[u,[h,"NextBook"],[l,_]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],u,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],u,[l,m]],[/\b(ph-1) /i],[u,[h,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[u,[h,"Envizen"],[l,_]],[/\b(trio[-\w\. ]+) b/i],[u,[h,"MachSpeed"],[l,_]],[/\btu_(1491) b/i],[u,[h,"Rotor"],[l,_]],[/(shield[\w ]+) b/i],[u,[h,"Nvidia"],[l,_]],[/(sprint) (\w+)/i],[h,u,[l,m]],[/(kin\.[onetw]{3})/i],[[u,/\./g," "],[h,P],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[u,[h,V],[l,_]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[u,[h,V],[l,m]],[/smart-tv.+(samsung)/i],[h,[l,T]],[/hbbtv.+maple;(\d+)/i],[[u,/^/,"SmartTV"],[h,k],[l,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,N],[l,T]],[/(apple) ?tv/i],[h,[u,R+" TV"],[l,T]],[/crkey/i],[[u,O+"cast"],[h,C],[l,T]],[/droid.+aft(\w)( bui|\))/i],[u,[h,y],[l,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[u,[h,M],[l,T]],[/(bravia[\w ]+)( bui|\))/i],[u,[h,U],[l,T]],[/(mitv-\w{5}) bui/i],[u,[h,x],[l,T]],[/Hbbtv.*(technisat) (.*);/i],[h,u,[l,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,K],[u,K],[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,u,[l,E]],[/droid.+; (shield) bui/i],[u,[h,"Nvidia"],[l,E]],[/(playstation [345portablevi]+)/i],[u,[h,U],[l,E]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[u,[h,P],[l,E]],[/((pebble))app/i],[h,u,[l,g]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[u,[h,R],[l,g]],[/droid.+; (glass) \d/i],[u,[h,C],[l,g]],[/droid.+; (wt63?0{2,3})\)/i],[u,[h,V],[l,g]],[/(quest( 2| pro)?)/i],[u,[h,F],[l,g]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[l,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[u,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[u,[l,_]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,_]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[u,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[d,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[d,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i],[d,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,d]],os:[[/microsoft (windows) (vista|xp)/i],[d,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[d,[p,X,Z]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[d,"Windows"],[p,X,Z]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[d,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[d,j],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,d],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[d,p],[/\(bb(10);/i],[p,[d,A]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[d,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[d,I+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[d,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[d,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[d,O+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[d,B],p],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[d,p],[/(sunos) ?([\w\.\d]*)/i],[[d,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[d,p]]},J=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof J))return new J(e,t).getResult();var E=typeof r!==o&&r.navigator?r.navigator:n,T=e||(E&&E.userAgent?E.userAgent:""),g=E&&E.userAgentData?E.userAgentData:n,S=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(z,t):z;return this.getBrowser=function(){var e={};return e[d]=n,e[p]=n,Y.call(e,T,S.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e[p]),E&&E.brave&&typeof E.brave.isBrave==i&&(e[d]="Brave"),e},this.getCPU=function(){var e={};return e[f]=n,Y.call(e,T,S.cpu),e},this.getDevice=function(){var e={};return e[h]=n,e[u]=n,e[l]=n,Y.call(e,T,S.device),!e[l]&&g&&g.mobile&&(e[l]=m),"Macintosh"==e[u]&&E&&typeof E.standalone!==o&&E.maxTouchPoints&&E.maxTouchPoints>2&&(e[u]="iPad",e[l]=_),e},this.getEngine=function(){var e={};return e[d]=n,e[p]=n,Y.call(e,T,S.engine),e},this.getOS=function(){var e={};return e[d]=n,e[p]=n,Y.call(e,T,S.os),!e[d]&&g&&"Unknown"!=g.platform&&(e[d]=g.platform.replace(/chrome os/i,B).replace(/macos/i,j)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return T},this.setUA=function(e){return T=typeof e===a&&e.length>350?K(e,350):e,this},this.setUA(T),this};J.VERSION="0.7.34",J.BROWSER=W([d,p,c]),J.CPU=W([f]),J.DEVICE=W([u,h,l,E,m,T,_,g,S]),J.ENGINE=J.OS=W([d,p]),e.exports&&(t=e.exports=J),t.UAParser=J;var Q=typeof r!==o&&(r.jQuery||r.Zepto);if(Q&&!Q.ua){var q=new J;Q.ua=q.getResult(),Q.ua.get=function(){return q.getUA()},Q.ua.set=function(e){q.setUA(e);var t=q.getResult();for(var r in t)Q.ua[r]=t[r]}}}("object"==typeof window?window:Z)}(ue,ue.exports);var de=z(ue.exports);function le(e,t){return function(){return e.apply(t,arguments)}}const{toString:he}=Object.prototype,{getPrototypeOf:pe}=Object,{iterator:fe,toStringTag:Ee}=Symbol,me=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),_e=e=>"string"==typeof e&&("__proto__"===e||"constructor"===e||"prototype"===e),Te=(e,t,r)=>e===Object.prototype||!r&&null===t,ge=(e,t)=>{let r=e;const n=[];for(;null!=r;){if(-1!==n.indexOf(r))return!1;n.push(r);const i=pe(r);if(Te(r,i,r===e))return!1;if(me(r,t))return!0;r=i}return!1},Se=(e=>t=>{const r=he.call(t);return e[r]||(e[r]=r.slice(8,-1).toLowerCase())})(Object.create(null)),ye=e=>(e=e.toLowerCase(),t=>Se(t)===e),Re=e=>t=>typeof t===e,{isArray:ve}=Array,Ae=Re("undefined");function be(e){return null!==e&&!Ae(e)&&null!==e.constructor&&!Ae(e.constructor)&&Ce(e.constructor.isBuffer)&&e.constructor.isBuffer(e)}const Oe=ye("ArrayBuffer");const Ie=Re("string"),Ce=Re("function"),we=Re("number"),Ne=e=>null!==e&&"object"==typeof e,Pe=e=>{if(!Ne(e))return!1;const t=pe(e);return!(null!==t&&t!==Object.prototype&&null!==pe(t)||ge(e,Ee)||ge(e,fe))},De=ye("Date"),Le=ye("File"),ke=ye("Blob"),Me=ye("FileList"),Ue=ye("Set");const xe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{},Ve=void 0!==xe.FormData?xe.FormData:void 0,Fe=ye("URLSearchParams"),[Be,je,We,Ge]=["ReadableStream","Request","Response","Headers"].map(ye);function He(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),ve(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{if(be(e))return;const i=r?Object.getOwnPropertyNames(e):Object.keys(e),o=i.length;let s;for(n=0;n<o;n++)s=i[n],t.call(null,e[s],s,e)}}function Ke(e,t){if(be(e))return null;t=t.toLowerCase();const r=Object.keys(e);let n,i=r.length;for(;i-- >0;)if(n=r[i],t===n.toLowerCase())return n;return null}const Ye="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Xe=e=>!Ae(e)&&e!==Ye;const Ze=(ze="undefined"!=typeof Uint8Array&&pe(Uint8Array),e=>ze&&e instanceof ze);var ze;const Je=ye("HTMLFormElement"),{propertyIsEnumerable:Qe}=Object.prototype,qe=ye("RegExp"),$e=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};He(r,((r,i)=>{let o;!1!==(o=t(r,i,e))&&(n[i]=o||r)})),Object.defineProperties(e,n)};const et=ye("AsyncFunction"),tt=(rt="function"==typeof setImmediate,nt=Ce(Ye.postMessage),rt?setImmediate:nt?(it=`axios@${Math.random()}`,ot=[],Ye.addEventListener("message",(({source:e,data:t})=>{e===Ye&&t===it&&ot.length&&ot.shift()()}),!1),e=>{ot.push(e),Ye.postMessage(it,"*")}):e=>setTimeout(e));var rt,nt,it,ot;const st="undefined"!=typeof queueMicrotask?queueMicrotask.bind(Ye):"undefined"!=typeof process&&process.nextTick||tt,at=e=>null!=e&&Ce(e[fe]);var ct={isArray:ve,isArrayBuffer:Oe,isBuffer:be,isFormData:e=>{if(!e)return!1;if(Ve&&e instanceof Ve)return!0;const t=pe(e);if(!t||t===Object.prototype)return!1;if(!Ce(e.append))return!1;const r=Se(e);return"formdata"===r||"object"===r&&Ce(e.toString)&&"[object FormData]"===e.toString()},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Oe(e.buffer),t},isString:Ie,isNumber:we,isBoolean:e=>!0===e||!1===e,isObject:Ne,isPlainObject:Pe,isEmptyObject:e=>{if(!Ne(e)||be(e))return!1;try{return 0===Object.keys(e).length&&Object.getPrototypeOf(e)===Object.prototype}catch(e){return!1}},isReadableStream:Be,isRequest:je,isResponse:We,isHeaders:Ge,isUndefined:Ae,isDate:De,isFile:Le,isReactNativeBlob:e=>!(!e||void 0===e.uri),isReactNative:e=>e&&void 0!==e.getParts,isBlob:ke,isRegExp:qe,isFunction:Ce,isStream:e=>Ne(e)&&Ce(e.pipe),isURLSearchParams:Fe,isTypedArray:Ze,isFileList:Me,forEach:He,merge:function e(...t){const{caseless:r,skipUndefined:n}=Xe(this)&&this||{},i={},o=(t,o)=>{if("__proto__"===o||"constructor"===o||"prototype"===o)return;const s=r&&"string"==typeof o&&Ke(i,o)||o,a=me(i,s)?i[s]:void 0;Pe(a)&&Pe(t)?i[s]=e(a,t):Pe(t)?i[s]=e({},t):ve(t)?i[s]=t.slice():n&&Ae(t)||(i[s]=t)};for(let e=0,r=t.length;e<r;e++){const r=t[e];if(!r||be(r))continue;if(He(r,o),"object"!=typeof r||ve(r))continue;const n=Object.getOwnPropertySymbols(r);for(let e=0;e<n.length;e++){const t=n[e];Qe.call(r,t)&&o(r[t],t)}}return i},extend:(e,t,r,{allOwnKeys:n}={})=>(He(t,((t,n)=>{r&&Ce(t)?Object.defineProperty(e,n,{__proto__:null,value:le(t,r),writable:!0,enumerable:!0,configurable:!0}):Object.defineProperty(e,n,{__proto__:null,value:t,writable:!0,enumerable:!0,configurable:!0})}),{allOwnKeys:n}),e),trim:e=>e.trim?e.trim():e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:e=>(65279===e.charCodeAt(0)&&(e=e.slice(1)),e),inherits:(e,t,r,n)=>{e.prototype=Object.create(t.prototype,n),Object.defineProperty(e.prototype,"constructor",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),Object.defineProperty(e,"super",{__proto__:null,value:t.prototype}),r&&Object.assign(e.prototype,r)},toFlatObject:(e,t,r,n)=>{let i,o,s;const a={};if(t=t||{},null==e)return t;do{for(i=Object.getOwnPropertyNames(e),o=i.length;o-- >0;)s=i[o],n&&!n(s,e,t)||a[s]||(t[s]=e[s],a[s]=!0);e=!1!==r&&pe(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Se,kindOfTest:ye,endsWith:(e,t,r)=>{e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;const n=e.indexOf(t,r);return-1!==n&&n===r},toArray:e=>{if(!e)return null;if(ve(e))return e;let t=e.length;if(!we(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[fe]).call(e);let n;for(;(n=r.next())&&!n.done;){const r=n.value;t.call(e,r[0],r[1])}},matchAll:(e,t)=>{let r;const n=[];for(;null!==(r=e.exec(t));)n.push(r);return n},isHTMLForm:Je,hasOwnProperty:me,hasOwnProp:me,hasOwnInPrototypeChain:ge,getSafeProp:(e,t)=>null!=e&&ge(e,t)?e[t]:void 0,toSafeFlatObject:e=>{if(null==e||"object"!=typeof e&&"function"!=typeof e)return e;const t=pe(e);if(null===t&&(e=>{if(!Object.isExtensible(e))return!1;const t=Object.getOwnPropertyNames(e);return Object.getOwnPropertySymbols&&t.push(...Object.getOwnPropertySymbols(e)),t.every((t=>{if(_e(t))return!1;const r=Object.getOwnPropertyDescriptor(e,t);return!!r&&r.configurable&&!0===r.writable}))})(e))return e;const r=Object.create(null),n=Object.create(null),i=[];let o=e;for(;null!=o&&-1===i.indexOf(o);){i.push(o);const s=o===e?t:pe(o);if(Te(o,s,o===e))break;const a=Object.getOwnPropertyNames(o);Object.getOwnPropertySymbols&&a.push(...Object.getOwnPropertySymbols(o));for(const t of a)_e(t)||me(n,t)||(r[t]=e[t],n[t]=!0);o=s}return r},reduceDescriptors:$e,freezeMethods:e=>{$e(e,((t,r)=>{if(Ce(e)&&["arguments","caller","callee"].includes(r))return!1;const n=e[r];Ce(n)&&(t.enumerable=!1,"writable"in t?t.writable=!1:t.set||(t.set=()=>{throw Error("Can not rewrite read-only method '"+r+"'")}))}))},toObjectSet:(e,t)=>{const r={},n=e=>{e.forEach((e=>{r[e]=!0}))};return ve(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Ke,global:Ye,isContextDefined:Xe,isSpecCompliantForm:function(e){return!!(e&&Ce(e.append)&&"FormData"===e[Ee]&&e[fe])},toJSONObject:e=>{const t=new WeakSet,r=e=>{if(Ne(e)){if(t.has(e))return;if(be(e))return e;if(!("toJSON"in e)){let n;if(t.add(e),Ue(e)){n=[];for(const t of e){const e=r(t);!Ae(e)&&n.push(e)}}else n=ve(e)?[]:{},He(e,((e,t)=>{const i=r(e);!Ae(i)&&(n[t]=i)}));return t.delete(e),n}}return e};return r(e)},isAsyncFn:et,isThenable:e=>e&&(Ne(e)||Ce(e))&&Ce(e.then)&&Ce(e.catch),setImmediate:tt,asap:st,isIterable:at,isSafeIterable:e=>null!=e&&ge(e,fe)&&at(e)};const ut=ct.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const dt=new RegExp("[\\u0000-\\u0008\\u000a-\\u001f\\u007f]+","g"),lt=new RegExp("[^\\u0009\\u0020-\\u007e\\u0080-\\u00ff]+","g");function ht(e,t){return ct.isArray(e)?e.map((e=>ht(e,t))):function(e){let t=0,r=e.length;for(;t<r;){const r=e.charCodeAt(t);if(9!==r&&32!==r)break;t+=1}for(;r>t;){const t=e.charCodeAt(r-1);if(9!==t&&32!==t)break;r-=1}return 0===t&&r===e.length?e:e.slice(t,r)}(String(e).replace(t,""))}const pt=e=>ht(e,dt),ft=e=>ht(e,lt);function Et(e){const t=Object.create(null);return ct.forEach(e.toJSON(),((e,r)=>{t[r]=ft(e)})),t}const mt=Symbol("internals");function _t(e){return e&&String(e).trim().toLowerCase()}function Tt(e){return!1===e||null==e?e:ct.isArray(e)?e.map(Tt):pt(String(e))}const gt=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;function St(e){let t=0,r=e.length;for(;t<r;){const r=e.charCodeAt(t);if(9!==r&&32!==r)break;t+=1}for(;r>t;){const t=e.charCodeAt(r-1);if(9!==t&&32!==t)break;r-=1}return 0===t&&r===e.length?e:e.slice(t,r)}function yt(e,t,r,n,i){return ct.isFunction(n)?n.call(this,t,r):(i&&(t=r),ct.isString(t)?ct.isString(n)?-1!==t.indexOf(n):ct.isRegExp(n)?n.test(t):void 0:void 0)}class Rt{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=_t(t);if(!i)return;const o=ct.findKey(n,i);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=Tt(e))}const o=(e,t)=>ct.forEach(e,((e,r)=>i(e,r,t)));if(ct.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(ct.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()))o((e=>{const t={};let r,n,i;return e&&e.split("\n").forEach((function(e){i=e.indexOf(":"),r=e.substring(0,i).trim().toLowerCase(),n=e.substring(i+1).trim();const o=ct.hasOwnProp(t,r);!r||o&&ct.hasOwnProp(ut,r)||("set-cookie"===r?o?t[r].push(n):t[r]=[n]:t[r]=o?t[r]+", "+n:n)})),t})(e),t);else if(ct.isObject(e)&&ct.isSafeIterable(e)){let r,n,i=Object.create(null);for(const t of e){if(!ct.isArray(t))throw new TypeError("Object iterator must return a key-value pair");n=t[0],ct.hasOwnProp(i,n)?(r=i[n],i[n]=ct.isArray(r)?[...r,t[1]]:[r,t[1]]):i[n]=t[1]}o(i,t)}else null!=e&&i(t,e,r);return this}get(e,t){if(e=_t(e)){const r=ct.findKey(this,e);if(r){const e=this[r];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),r=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=r.exec(e);)t[n[1]]=n[2];return t}(e);if(ct.isFunction(t))return t.call(this,e,r);if(ct.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=_t(e)){const r=ct.findKey(this,e);return!(!r||void 0===this[r]||t&&!yt(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=_t(e)){const i=ct.findKey(r,e);!i||t&&!yt(0,r[i],i,t)||(delete r[i],n=!0)}}return ct.isArray(e)?e.forEach(i):i(e),n}clear(e){const t=Object.keys(this);let r=t.length,n=!1;for(;r--;){const i=t[r];e&&!yt(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return ct.forEach(this,((n,i)=>{const o=ct.findKey(r,i);if(o)return t[o]=Tt(n),void delete t[i];const s=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,r)=>t.toUpperCase()+r))}(i):String(i).trim();s!==i&&delete t[i],t[s]=Tt(n),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ct.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&ct.isArray(r)?r.join(", "):r)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}getSetCookie(){const e=this.get("set-cookie");return ct.isArray(e)?e:null==e||!1===e?[]:[e]}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static parseParameters(e){return function(e){const t=Object.create(null),r=String(e);let n=0,i=!1,o=!1;function s(e){const i=St(r.slice(n,e)),o=i.indexOf("=");if(o<1)return;const s=St(i.slice(0,o));if(!gt.test(s))return;const a=s.toLowerCase();if("__proto__"===a||"constructor"===a||"prototype"===a)return;const c=St(i.slice(o+1));t[a]=function(e){const t=e.length-1;if(t<1||34!==e.charCodeAt(0)||34!==e.charCodeAt(t))return e;let r="";for(let n=1;n<t;n++){const i=e.charCodeAt(n);if(34===i)return e;if(92===i&&(n+=1,n>=t))return e;r+=e[n]}return r}(c)}for(let e=0;e<r.length;e++){const t=r.charCodeAt(e);i?o?o=!1:92===t?o=!0:34===t&&(i=!1):34===t?i=!0:44!==t&&59!==t||(s(e),n=e+1)}return s(r.length),t}(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[mt]=this[mt]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=_t(e);t[n]||(!function(e,t){const r=ct.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{__proto__:null,value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return ct.isArray(e)?e.forEach(n):n(e),this}}Rt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ct.reduceDescriptors(Rt.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),ct.freezeMethods(Rt);var vt=Rt;const At="[REDACTED ****]";function bt(e,t){const r=new Set(t.map((e=>String(e).toLowerCase()))),n=[],i=e=>{if(null===e||"object"!=typeof e)return e;if(ct.isBuffer(e))return e;if(-1!==n.indexOf(e))return;let t;if(e instanceof vt&&(e=e.toJSON()),n.push(e),ct.isArray(e))t=[],e.forEach(((e,r)=>{const n=i(e);ct.isUndefined(n)||(t[r]=n)}));else{if(!ct.isPlainObject(e)&&function(e){if(ct.hasOwnProp(e,"toJSON"))return!0;let t=Object.getPrototypeOf(e);for(;t&&t!==Object.prototype;){if(ct.hasOwnProp(t,"toJSON"))return!0;t=Object.getPrototypeOf(t)}return!1}(e))return n.pop(),e;t=Object.create(null);for(const[n,o]of Object.entries(e)){const e=r.has(n.toLowerCase())?At:i(o);ct.isUndefined(e)||(t[n]=e)}}return n.pop(),t};return i(e)}function Ot(e){try{return String(e)}catch(e){return""}}class It extends Error{static from(e,t,r,n,i,o){let s=e.message;!s&&ct.isArray(e.errors)&&e.errors.length&&(s=function(e){return e.errors.map((e=>{try{return e&&e.message?Ot(e.message):Ot(e)}catch(e){return""}})).filter(Boolean).join("; ")||e.name||"AggregateError"}(e));const a=new It(s,t||e.code,r,n,i);return Object.defineProperty(a,"cause",{__proto__:null,value:e,writable:!0,enumerable:!1,configurable:!0}),a.name=e.name,null!=e.status&&null==a.status&&(a.status=e.status),o&&Object.assign(a,o),a}constructor(e,t,r,n,i){super(e),Object.defineProperty(this,"message",{__proto__:null,value:e,enumerable:!0,writable:!0,configurable:!0}),this.name="AxiosError",this.isAxiosError=!0,t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i,this.status=i.status)}toJSON(){const e=this.config,t=e&&ct.hasOwnProp(e,"redact")?e.redact:void 0,r=ct.isArray(t)&&t.length>0?bt(e,t):ct.toJSONObject(e);return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:r,code:this.code,status:this.status}}}It.ERR_BAD_OPTION_VALUE="ERR_BAD_OPTION_VALUE",It.ERR_BAD_OPTION="ERR_BAD_OPTION",It.ECONNABORTED="ECONNABORTED",It.ETIMEDOUT="ETIMEDOUT",It.ECONNREFUSED="ECONNREFUSED",It.ERR_NETWORK="ERR_NETWORK",It.ERR_FR_TOO_MANY_REDIRECTS="ERR_FR_TOO_MANY_REDIRECTS",It.ERR_DEPRECATED="ERR_DEPRECATED",It.ERR_BAD_RESPONSE="ERR_BAD_RESPONSE",It.ERR_BAD_REQUEST="ERR_BAD_REQUEST",It.ERR_CANCELED="ERR_CANCELED",It.ERR_NOT_SUPPORT="ERR_NOT_SUPPORT",It.ERR_INVALID_URL="ERR_INVALID_URL",It.ERR_FORM_DATA_DEPTH_EXCEEDED="ERR_FORM_DATA_DEPTH_EXCEEDED";var Ct=It;const wt=100;function Nt(e){return ct.isPlainObject(e)||ct.isArray(e)}function Pt(e){return ct.endsWith(e,"[]")?e.slice(0,-2):e}function Dt(e,t,r){return e?e.concat(t).map((function(e,t){return e=Pt(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const Lt=ct.toFlatObject(ct,{},null,(function(e){return/^is[A-Z]/.test(e)}));function kt(e,t,r){if(!ct.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(e,t)=>{const n=ct.getSafeProp(r,e);return ct.isUndefined(n)?t:n},i=n("metaTokens",!0),o=n("visitor")||f,s=n("dots",!1),a=n("indexes",!1),c=n("Blob")||"undefined"!=typeof Blob&&Blob,u=n("maxDepth",wt),d=c&&ct.isSpecCompliantForm(t),l=[];if(!ct.isFunction(o))throw new TypeError("visitor must be a function");function h(e){if(null===e)return"";if(ct.isDate(e))return e.toISOString();if(ct.isBoolean(e))return e.toString();if(!d&&ct.isBlob(e))throw new Ct("Blob is not supported. Use a Buffer instead.");if(ct.isArrayBuffer(e)||ct.isTypedArray(e)){if(d&&"function"==typeof c)return new c([e]);throw new Ct("Blob is not supported. Use a Buffer instead.",Ct.ERR_NOT_SUPPORT)}return e}function p(e){if(e>u)throw new Ct("Object is too deeply nested ("+e+" levels). Max depth: "+u,Ct.ERR_FORM_DATA_DEPTH_EXCEEDED)}function f(e,r,n){let o=e;if(ct.isReactNative(t)&&ct.isReactNativeBlob(e))return t.append(Dt(n,r,s),h(e)),!1;if(e&&!n&&"object"==typeof e)if(ct.endsWith(r,"{}"))r=i?r:r.slice(0,-2),e=function(e,t){if(u===1/0)return JSON.stringify(e);const r=[];return JSON.stringify(e,(function(e,n){if(!ct.isObject(n))return n;for(;r.length&&r[r.length-1]!==this;)r.pop();return r.push(n),p(t+r.length-1),n}))}(e,1);else if(ct.isArray(e)&&function(e){return ct.isArray(e)&&!e.some(Nt)}(e)||(ct.isFileList(e)||ct.endsWith(r,"[]"))&&(o=ct.toArray(e)))return r=Pt(r),o.forEach((function(e,n){!ct.isUndefined(e)&&null!==e&&t.append(!0===a?Dt([r],n,s):null===a?r:r+"[]",h(e))})),!1;return!!Nt(e)||(t.append(Dt(n,r,s),h(e)),!1)}const E=Object.assign(Lt,{defaultVisitor:f,convertValue:h,isVisitable:Nt});if(!ct.isObject(e))throw new TypeError("data must be an object");return function e(r,n,i=0){if(!ct.isUndefined(r)){if(p(i),-1!==l.indexOf(r))throw new Error("Circular reference detected in "+n.join("."));l.push(r),ct.forEach(r,(function(r,s){!0===(!(ct.isUndefined(r)||null===r)&&o.call(t,r,ct.isString(s)?s.trim():s,n,E))&&e(r,n?n.concat(s):[s],i+1)})),l.pop()}}(e),t}function Mt(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"};return encodeURIComponent(e).replace(/[!'()~]|%20/g,(function(e){return t[e]}))}function Ut(e,t){this._pairs=[],e&&kt(e,this,t)}const xt=Ut.prototype;function Vt(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+")}function Ft(e,t,r){if(!t)return e;e=e||"";const n=ct.isFunction(r)?{serialize:r}:r,i=ct.getSafeProp(n,"encode")||Vt,o=ct.getSafeProp(n,"serialize");let s;if(s=o?o(t,n):ct.isURLSearchParams(t)?t.toString():new Ut(t,n).toString(i),s){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+s}return e}xt.append=function(e,t){this._pairs.push([e,t])},xt.toString=function(e){const t=e?t=>e.call(this,t,Mt):Mt;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};const Bt=Symbol("internals");function jt(e){return e?e.length:0}function Wt(e){if(e)for(;e.length&&null===e[e.length-1];)e.pop()}function Gt(e,t){const r=e.handlers,n=jt(r);r!==t.handlersRef?(t.handlersRef=r,t.handlerEntries.clear()):n!==t.handlersLength&&(n?t.handlerEntries.forEach((function(e,n){r[e.index]!==e.handler&&t.handlerEntries.delete(n)})):t.handlerEntries.clear()),t.handlersLength=n}var Ht=class{constructor(){this.handlers=[],this[Bt]={handlersRef:this.handlers,handlersLength:this.handlers.length,handlerEntries:new Map,iterationDepth:0,nextId:0}}use(e,t,r){const n={fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null},i=this[Bt];null==this.handlers&&(this.handlers=[]),Gt(this,i);const o=i.nextId++;return this.handlers.push(n),i.handlerEntries.set(o,{handler:n,index:this.handlers.length-1}),i.handlersLength=this.handlers.length,o}eject(e){const t=this[Bt];Gt(this,t);const r=t.handlerEntries.get(e);if(r){if(t.handlerEntries.delete(e),this.handlers[r.index]!==r.handler)return;this.handlers[r.index]=null,t.iterationDepth||(Wt(this.handlers),t.handlersLength=this.handlers.length)}}clear(){this.handlers&&(this.handlers=[],Gt(this,this[Bt]))}forEach(e){const t=this[Bt];Gt(this,t),t.iterationDepth++;try{ct.forEach(this.handlers,(function(t){null!==t&&e(t)}))}finally{--t.iterationDepth||(Gt(this,t),Wt(this.handlers),t.handlersLength=jt(this.handlers))}}},Kt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1,legacyInterceptorReqResOrdering:!0,advertiseZstdAcceptEncoding:!1,validateStatusUndefinedResolves:!0},Yt={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:Ut,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Xt="undefined"!=typeof window&&"undefined"!=typeof document,Zt="object"==typeof navigator&&navigator||void 0,zt=Xt&&(!Zt||["ReactNative","NativeScript","NS"].indexOf(Zt.product)<0),Jt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Qt=Xt&&window.location.href||"http://localhost";var qt={...Object.freeze({__proto__:null,hasBrowserEnv:Xt,hasStandardBrowserEnv:zt,hasStandardBrowserWebWorkerEnv:Jt,navigator:Zt,origin:Qt}),...Yt};const $t=wt;function er(e){if(e>$t)throw new Ct("FormData field is too deeply nested ("+e+" levels). Max depth: "+$t,Ct.ERR_FORM_DATA_DEPTH_EXCEEDED)}function tr(e){function t(e,r,n,i){er(i);let o=e[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=e.length;if(o=!o&&ct.isArray(n)?n.length:o,a)return ct.hasOwnProp(n,o)?n[o]=ct.isArray(n[o])?n[o].concat(r):[n[o],r]:n[o]=r,!s;ct.hasOwnProp(n,o)&&ct.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],i)&&ct.isArray(n[o])&&(n[o]=function(e){const t={},r=Object.keys(e);let n;const i=r.length;let o;for(n=0;n<i;n++)o=r[n],t[o]=e[o];return t}(n[o])),!s}if(ct.isFormData(e)&&ct.isFunction(e.entries)){const r={};return ct.forEachEntry(e,((e,n)=>{t(function(e){const t=[],r=/[^.[\]]+|\[([^.[\]]*)]/g;let n;for(;null!==(n=r.exec(e));)er(t.length),t.push("[]"===n[0]?"":n[1]||n[0]);return t}(e),n,r,0)})),r}return null}var rr=Object.freeze(["get","delete","head","options","post","put","patch","purge","link","unlink","query"]);const nr=(e,t)=>null!=e&&ct.hasOwnProp(e,t)?e[t]:void 0;const ir={transitional:Kt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=ct.isObject(e);i&&ct.isHTMLForm(e)&&(e=new FormData(e));if(ct.isFormData(e))return n?JSON.stringify(tr(e)):e;if(ct.isArrayBuffer(e)||ct.isBuffer(e)||ct.isStream(e)||ct.isFile(e)||ct.isBlob(e)||ct.isReadableStream(e))return e;if(ct.isArrayBufferView(e))return e.buffer;if(ct.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){const t=nr(this,"formSerializer");if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return kt(e,new qt.classes.URLSearchParams,{visitor:function(e,t,r,n){return qt.isNode&&ct.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)},...t})}(e,t).toString();if((o=ct.isFileList(e))||r.indexOf("multipart/form-data")>-1){const r=nr(this,"env"),n=r&&r.FormData;return kt(o?{"files[]":e}:e,n&&new n,t)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(ct.isString(e))try{return(t||JSON.parse)(e),ct.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=nr(this,"transitional")||ir.transitional,r=t&&t.forcedJSONParsing,n=nr(this,"responseType"),i="json"===n;if(ct.isResponse(e)||ct.isReadableStream(e))return e;if(e&&ct.isString(e)&&(r&&!n||i)){const r=!(t&&t.silentJSONParsing)&&i;try{return JSON.parse(e,nr(this,"parseReviver"))}catch(e){if(r){if("SyntaxError"===e.name)throw Ct.from(e,Ct.ERR_BAD_RESPONSE,this,null,nr(this,"response"));throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:qt.classes.FormData,Blob:qt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ct.forEach(rr,(e=>{ir.headers[e]={}}));var or=ir;function sr(e,t){const r=this||or,n=t||r,i=vt.from(n.headers);let o=n.data;return ct.forEach(e,(function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function ar(e){return!(!e||!e.__CANCEL__)}var cr=class extends Ct{constructor(e,t,r){super(null==e?"canceled":e,Ct.ERR_CANCELED,t,r),this.name="CanceledError",this.__CANCEL__=!0}};function ur(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new Ct("Request failed with status code "+r.status,r.status>=400&&r.status<500?Ct.ERR_BAD_REQUEST:Ct.ERR_BAD_RESPONSE,r.config,r.request,r)):e(r)}const dr=/[\t\n\r]/g;function lr(e){if("string"!=typeof e)return e;let t=0;for(;t<e.length&&e.charCodeAt(t)<=32;)t++;return e.slice(t).replace(dr,"")}function hr(e){const t=/^([-+\w]{1,25}):(?:\/\/)?/.exec(e);return t&&t[1]||""}const pr=(e,t,r=3)=>{let n=0;const i=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),u=n[s];i||(i=c),r[o]=a,n[o]=c;let d=s,l=0;for(;d!==o;)l+=r[d++],d%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-i<t)return;const h=u&&c-u;return h?Math.round(1e3*l/h):void 0}}(50,250);return function(e,t){let r,n,i=0,o=1e3/t;const s=(t,o=Date.now())=>{i=o,r=null,n&&(clearTimeout(n),n=null),e(...t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=o?s(e,t):(r=e,n||(n=setTimeout((()=>{n=null,s(r)}),o-a)))},()=>r&&s(r),(...e)=>s(e)]}((r=>{if(!r||!ct.isNumber(r.loaded))return;const o=r.loaded,s=r.lengthComputable?r.total:void 0,a=Math.max(0,null!=s?Math.min(o,s):o),c=Math.max(0,a-n),u=i(c);n=Math.max(n,a);e({loaded:a,total:s,progress:s?a/s:void 0,bytes:c,rate:u||void 0,estimated:u&&s?(s-a)/u:void 0,event:r,lengthComputable:null!=s,[t?"download":"upload"]:!0})}),r)},fr=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Er=(e,t=ct.asap)=>(...r)=>t((()=>e(...r)));var mr=qt.hasStandardBrowserEnv?((e,t)=>r=>(r=new URL(r,qt.origin),e.protocol===r.protocol&&e.host===r.host&&(t||e.port===r.port)))(new URL(qt.origin),qt.navigator&&/(msie|trident)/i.test(qt.navigator.userAgent)):()=>!0,_r=qt.hasStandardBrowserEnv?{write(e,t,r,n,i,o,s){if("undefined"==typeof document)return;const a=[`${e}=${encodeURIComponent(t)}`];ct.isNumber(r)&&a.push(`expires=${new Date(r).toUTCString()}`),ct.isString(n)&&a.push(`path=${n}`),ct.isString(i)&&a.push(`domain=${i}`),!0===o&&a.push("secure"),ct.isString(s)&&a.push(`SameSite=${s}`),document.cookie=a.join("; ")},read(e){if("undefined"==typeof document)return null;const t=document.cookie.split(";");for(let r=0;r<t.length;r++){const n=t[r].replace(/^\s+/,""),i=n.indexOf("=");if(-1!==i&&n.slice(0,i)===e)try{return decodeURIComponent(n.slice(i+1))}catch(e){return n.slice(i+1)}}return null},remove(e){this.write(e,"",Date.now()-864e5,"/")}}:{write(){},read:()=>null,remove(){}};const Tr=/^https?:(?!\/\/)/i;function gr(e){const t=e.replace(/^(https?:\/{0,2})[^/?#]*@/i,`$1${At}@`),r=t.indexOf("#"),n=(-1===r?t:t.slice(0,r)).replace(/([?&][^=&#]*=)[^&#]*/g,`$1${At}`);return-1===r?n:`${n}#${i=t.slice(r+1),i?i.replace(/(^|&)([^=&]*=)?[^&]+/g,((e,t,r="")=>`${t}${r}${At}`)):i}`;var i}function Sr(e,t){if("string"==typeof e){const r=lr(e);if(Tr.test(r))throw new Ct(`Invalid URL ${JSON.stringify(gr(r))}: missing "//" after protocol`,Ct.ERR_INVALID_URL,t)}}function yr(e,t,r,n){Sr(t,n);let i=!function(e){return"string"==typeof e&&/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t);return e&&(i||!1===r)?(Sr(e,n),function(e,t){if(!t)return e;let r=e.length;for(;r>0&&47===e.charCodeAt(r-1);)r--;return e.slice(0,r)+"/"+t.replace(/^\/+/,"")}(e,t)):t}const Rr=e=>e instanceof vt?{...e}:e,vr=e=>Object.getOwnPropertySymbols&&Object.getOwnPropertyDescriptor?Object.keys(e).concat(Object.getOwnPropertySymbols(e).filter((t=>Object.getOwnPropertyDescriptor(e,t).enumerable))):Object.keys(e);function Ar(e,t){e=e||{},t=t||{};const r=Object.create(null);function n(e,t,r,n){return ct.isPlainObject(e)&&ct.isPlainObject(t)?ct.merge.call({caseless:n},e,t):ct.isPlainObject(t)?ct.merge({},t):ct.isArray(t)?t.slice():t}function i(e,t,r,i){return ct.isUndefined(t)?ct.isUndefined(e)?void 0:n(void 0,e,0,i):n(e,t,0,i)}function o(e,t){if(!ct.isUndefined(t))return n(void 0,t)}function s(e,t){return ct.isUndefined(t)?ct.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,o){return ct.hasOwnProp(t,o)?n(r,i):ct.hasOwnProp(e,o)?n(void 0,r):void 0}Object.defineProperty(r,"hasOwnProperty",{__proto__:null,value:Object.prototype.hasOwnProperty,enumerable:!1,writable:!0,configurable:!0});const c={url:o,method:o,data:o,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutErrorMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,allowedSocketPaths:s,responseEncoding:s,validateStatus:a,headers:(e,t,r)=>i(Rr(e),Rr(t),0,!0)};return ct.forEach(vr({...e,...t}),(function(n){if("__proto__"===n||"constructor"===n||"prototype"===n)return;const o=ct.hasOwnProp(c,n)?c[n]:i,s=o(ct.hasOwnProp(e,n)?e[n]:void 0,ct.hasOwnProp(t,n)?t[n]:void 0,n);ct.isUndefined(s)&&o!==a||(r[n]=s)})),ct.hasOwnProp(t,"validateStatus")&&ct.isUndefined(t.validateStatus)&&!1===function(r){const n=ct.hasOwnProp(t,"transitional")?t.transitional:void 0;if(!ct.isUndefined(n)){if(!ct.isPlainObject(n))return;if(ct.hasOwnProp(n,r))return n[r]}const i=ct.hasOwnProp(e,"transitional")?e.transitional:void 0;if(ct.isPlainObject(i)&&ct.hasOwnProp(i,r))return i[r]}("validateStatusUndefinedResolves")&&(ct.hasOwnProp(e,"validateStatus")?r.validateStatus=n(void 0,e.validateStatus):delete r.validateStatus),r}const br=["content-type","content-length"];const Or=e=>encodeURIComponent(e).replace(/%([0-9A-F]{2})/gi,((e,t)=>String.fromCharCode(parseInt(t,16))));function Ir(e){const t=Ar({},e),r=e=>ct.hasOwnProp(t,e)?t[e]:void 0,n=r("data");let i=r("withXSRFToken");const o=r("xsrfHeaderName"),s=r("xsrfCookieName");let a=r("headers");const c=r("auth"),u=r("baseURL"),d=r("allowAbsoluteUrls"),l=r("url");if(t.headers=a=vt.from(a),t.url=Ft(yr(u,l,d,t),r("params"),r("paramsSerializer")),c){const t=ct.getSafeProp(c,"username")||"",r=ct.getSafeProp(c,"password")||"";try{a.set("Authorization","Basic "+btoa(t+":"+(r?Or(r):"")))}catch(t){throw Ct.from(t,Ct.ERR_BAD_OPTION_VALUE,e)}}if(ct.isFormData(n)){const e=ct.getSafeProp(n,"getHeaders");qt.hasStandardBrowserEnv||qt.hasStandardBrowserWebWorkerEnv||ct.isReactNative(n)?a.setContentType(void 0):ct.isFunction(e)&&function(e,t,r){"content-only"===r?Object.entries(t||{}).forEach((([t,r])=>{br.includes(t.toLowerCase())&&e.set(t,r)})):e.set(t)}(a,e.call(n),r("formDataHeaderPolicy"))}if(qt.hasStandardBrowserEnv){ct.isFunction(i)&&(i=i(t));if(!0===i||null==i&&mr(t.url)){const e=o&&s&&_r.read(s);e&&a.set(o,e)}}return t}var Cr="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const n=Ir(e);let i=n.data;const o=vt.from(n.headers).normalize();let s,a,c,u,d,l,{responseType:h,onUploadProgress:p,onDownloadProgress:f}=n;function E(){u&&u(),d&&d(),n.cancelToken&&n.cancelToken.unsubscribe(s),n.signal&&n.signal.removeEventListener("abort",s)}let m=new XMLHttpRequest;function _(i){if(!m)return;if(!(0!==m.status||"file"===(hr(lr(n.url))||hr(qt.origin))||m.responseURL&&m.responseURL.startsWith("file:")))return r(new Ct("Request aborted",Ct.ECONNABORTED,e,m)),E(),void(m=null);try{i?l&&l(i):d&&d()}catch(e){setTimeout((()=>{throw e}))}if(!m)return;const o=vt.from("getAllResponseHeaders"in m&&m.getAllResponseHeaders());ur((function(e){t(e),E()}),(function(e){r(e),E()}),{data:h&&"text"!==h&&"json"!==h?m.response:m.responseText,status:m.status,statusText:m.statusText,headers:o,config:e,request:m}),m=null}m.open(n.method.toUpperCase(),n.url,!0),m.timeout=n.timeout,"onloadend"in m?m.onloadend=_:m.onreadystatechange=function(){m&&4===m.readyState&&(0!==m.status||m.responseURL&&m.responseURL.startsWith("file:"))&&setTimeout(_)},m.onabort=function(){m&&(r(new Ct("Request aborted",Ct.ECONNABORTED,e,m)),E(),m=null)},m.onerror=function(t){const n=t&&t.message?t.message:"Network Error",i=new Ct(n,Ct.ERR_NETWORK,e,m);i.event=t||null,r(i),E(),m=null},m.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||Kt;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new Ct(t,i.clarifyTimeoutError?Ct.ETIMEDOUT:Ct.ECONNABORTED,e,m)),E(),m=null},void 0===i&&o.setContentType(null),"setRequestHeader"in m&&ct.forEach(Et(o),(function(e,t){m.setRequestHeader(t,e)})),ct.isUndefined(n.withCredentials)||(m.withCredentials=!!n.withCredentials),h&&"json"!==h&&(m.responseType=n.responseType),f&&([c,d,l]=pr(f,!0),m.addEventListener("progress",c)),p&&m.upload&&([a,u]=pr(p),m.upload.addEventListener("progress",a),m.upload.addEventListener("loadend",u)),(n.cancelToken||n.signal)&&(s=t=>{m&&(r(!t||t.type?new cr(null,e,m):t),m.abort(),E(),m=null)},n.cancelToken&&n.cancelToken.subscribe(s),n.signal&&(n.signal.aborted?s():n.signal.addEventListener("abort",s)));const T=hr(n.url);if(T&&!qt.protocols.includes(T))return r(new Ct("Unsupported protocol "+T+":",Ct.ERR_BAD_REQUEST,e)),void E();m.send(i||null)}))};var wr=(e,t)=>{if(e=e?e.filter(Boolean):[],!t&&!e.length)return;const r=new AbortController;let n=!1;const i=function(e){if(!n){n=!0,s();const t=e instanceof Error?e:this.reason;r.abort(t instanceof Ct?t:new cr(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,i(new Ct(`timeout of ${t}ms exceeded`,Ct.ETIMEDOUT))}),t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)})),e=null)};e.forEach((e=>{n||(e.aborted?i.call(e):e.addEventListener("abort",i,{once:!0}))}));const{signal:a}=r;return a.unsubscribe=()=>ct.asap(s),a};const Nr=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,i=0;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},Pr=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},Dr=(e,t,r,n)=>{const i=async function*(e,t){for await(const r of Pr(e))yield*Nr(r,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await i.next();if(t)return a(),void e.close();let o=n.byteLength;if(r){let e=s+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},Lr=e=>e>=48&&e<=57||e>=65&&e<=70||e>=97&&e<=102,kr=(e,t,r)=>t+2<r&&Lr(e.charCodeAt(t+1))&&Lr(e.charCodeAt(t+2)),Mr=e=>e<=57?e-48:(223&e)-55,Ur=e=>e>=65&&e<=90||e>=97&&e<=122||e>=48&&e<=57||43===e||47===e||45===e||95===e,xr=e=>{const t=e.length;let r=0,n=0,i=!1;for(let s=0;s<t;s++){let a=e.charCodeAt(s);37===a&&kr(e,s,t)&&(a=16*Mr(e.charCodeAt(s+1))+Mr(e.charCodeAt(s+2)),s+=2),9!==(o=a)&&10!==o&&12!==o&&13!==o&&32!==o&&(61!==a?!Ur(a)||n>0?i=!0:r++:n++)}var o;return i||n>2||n>0&&(r+n)%4!=0||r%4==1?(e=>{const t=e.length;let r=0;return t>0&&61===e.charCodeAt(t-1)&&(r++,t>1&&61===e.charCodeAt(t-2)&&r++),Math.floor(3*(t-r)/4)})(e):(e=>{const t=e%4;return 3*Math.floor(e/4)+(2===t?1:3===t?2:0)})(r)},Vr=(e,t)=>{if(!e||"string"!=typeof e)return 0;if(!e.startsWith("data:"))return 0;const r=e.indexOf(",");if(r<0)return 0;const n=e.slice(5,r),i=e.slice(r+1);if(/;base64/i.test(n))return t(i);let o=0;for(let e=0,t=i.length;e<t;e++){const r=i.charCodeAt(e);if(37===r&&kr(i,e,t))o+=1,e+=2;else if(r<128)o+=1;else if(r<2048)o+=2;else if(r>=55296&&r<=56319&&e+1<t){const t=i.charCodeAt(e+1);t>=56320&&t<=57343?(o+=4,e++):o+=3}else o+=3}return o};const Fr="1.20.0",Br={cache:"default",redirect:"follow",referrer:"about:client",referrerPolicy:"",mode:"cors",integrity:"",keepalive:!1,priority:"auto",window:null},{isFunction:jr}=ct,Wr=e=>{if(!ct.isString(e))return e;try{return decodeURIComponent(e)}catch(t){return e}},Gr=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},Hr=e=>{const t=void 0!==ct.global&&null!==ct.global?ct.global:globalThis,{ReadableStream:r,TextEncoder:n}=t;e=ct.merge.call({skipUndefined:!0},{Request:t.Request,Response:t.Response},e);const{fetch:i,Request:o,Response:s}=e,a=i?jr(i):"function"==typeof fetch,c=jr(o),u=jr(s);if(!a)return!1;const d=a&&jr(r),l=a&&("function"==typeof n?(h=new n,e=>h.encode(e)):async e=>new Uint8Array(await new o(e).arrayBuffer()));var h;const p=c&&d&&Gr((()=>{let e=!1;const t=new o(qt.origin,{body:new r,method:"POST",get duplex(){return e=!0,"half"}}),n=t.headers.has("Content-Type");return null!=t.body&&t.body.cancel(),e&&!n})),f=u&&d&&Gr((()=>ct.isReadableStream(new s("").body))),E={stream:f&&(e=>e.body)};a&&["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!E[e]&&(E[e]=(t,r)=>{let n=t&&t[e];if(n)return n.call(t);throw new Ct(`Response type '${e}' is not supported`,Ct.ERR_NOT_SUPPORT,r)})}));const m=async e=>{if(null==e)return 0;if(ct.isBlob(e))return e.size;if(ct.isSpecCompliantForm(e)){const t=new o(qt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return ct.isArrayBufferView(e)||ct.isArrayBuffer(e)?e.byteLength:(ct.isURLSearchParams(e)&&(e+=""),ct.isString(e)?(await l(e)).byteLength:void 0)};return async e=>{let{url:t,method:r,data:a,signal:u,cancelToken:l,timeout:h,onDownloadProgress:_,onUploadProgress:T,responseType:g,headers:S,withCredentials:y="same-origin",fetchOptions:R,maxContentLength:v,maxBodyLength:A,maxRedirects:b}=Ir(e);const O=ct.isNumber(v)&&v>-1,I=ct.isNumber(A)&&A>-1;let C=i||fetch;g=g?(g+"").toLowerCase():"text";let w=wr([u,l&&l.toAbortSignal()],h),N=null;const P=w&&w.unsubscribe&&(()=>{w.unsubscribe()});let D,L=null;const k=()=>new Ct("Request body larger than maxBodyLength limit",Ct.ERR_BAD_REQUEST,e,N);try{let i;const u=(U="auth",ct.hasOwnProp(e,U)?e[U]:void 0);if(u){const e=ct.getSafeProp(u,"username")||"";i={username:e,password:ct.getSafeProp(u,"password")||""}}if((e=>{const t=e.indexOf("://");let r=e;return-1!==t&&(r=r.slice(t+3)),r.includes("@")||r.includes(":")})(t)){const e=new URL(t,qt.origin);if(!i&&(e.username||e.password)){const t=Wr(e.username);i={username:t,password:Wr(e.password)}}(e.username||e.password)&&(e.username="",e.password="",t=e.href)}if(i&&(S.delete("authorization"),S.set("Authorization","Basic "+btoa((M=(i.username||"")+":"+(i.password||""),encodeURIComponent(M).replace(/%([0-9A-F]{2})/gi,((e,t)=>String.fromCharCode(parseInt(t,16)))))))),O&&"string"==typeof t&&t.startsWith("data:")){const r=function(e){const t="string"==typeof e?e.indexOf("#"):-1;return Vr(-1===t?e:e.slice(0,t),xr)}(t);if(r>v)throw new Ct("maxContentLength size of "+v+" exceeded",Ct.ERR_BAD_RESPONSE,e,N)}if(I&&"get"!==r&&"head"!==r){const e=await m(a);if("number"==typeof e&&isFinite(e)&&(D=e,e>A))throw k()}const l=I&&(ct.isReadableStream(a)||ct.isStream(a)),h=(e,t,r)=>Dr(e,65536,(e=>{if(I&&e>A)throw L=k();t&&t(e)}),r);if(p&&"get"!==r&&"head"!==r&&(T||l)){if(D=null==D?await(async(e,t)=>{const r=ct.toFiniteNumber(e.getContentLength());return null==r?m(t):r})(S,a):D,0!==D||l){let e,r=new o(t,{method:"POST",body:a,duplex:"half"});if(ct.isFormData(a)&&(e=r.headers.get("content-type"))&&S.setContentType(e),r.body){const[e,t]=T&&fr(D,pr(Er(T)))||[];a=h(r.body,e,t)}}}else if(l&&!c&&d&&"get"!==r&&"head"!==r)a=h(a);else if(l&&c&&!p&&"get"!==r&&"head"!==r)throw new Ct("Stream request bodies are not supported by the current fetch implementation",Ct.ERR_NOT_SUPPORT,e,N);ct.isString(y)||(y=y?"include":"omit");const x=c&&"credentials"in o.prototype;if(ct.isFormData(a)){const e=S.getContentType();e&&/^multipart\/form-data/i.test(e)&&!/boundary=/i.test(e)&&S.delete("content-type")}S.set("User-Agent","axios/"+Fr,!1);const V=null==R?R:Object.assign(Object.create(null),R);V&&(delete V.body,delete V.headers,delete V.method,delete V.signal,delete V.duplex,delete V.credentials);const F=Object.assign(Object.create(null),V,{signal:w,method:r.toUpperCase(),headers:Et(S.normalize()),body:a,duplex:"half",credentials:x?y:void 0});c&&(ct.forEach(Br,((e,t)=>{void 0===F[t]&&(F[t]=e)})),void 0===F.signal&&(F.signal=null),void 0===F.body&&(F.body=null)),0===b&&(F.redirect="manual",V&&(V.redirect="manual")),N=c&&new o(t,F);let B=await(c?C(N,V):C(t,F));const j=vt.from(B.headers);if(O){const t=ct.toFiniteNumber(j.getContentLength());if(null!=t&&t>v)throw new Ct("maxContentLength size of "+v+" exceeded",Ct.ERR_BAD_RESPONSE,e,N)}const W=f&&("stream"===g||"response"===g);if(f&&B.body&&(_||O||W&&P)){const t={};["status","statusText","headers"].forEach((e=>{t[e]=B[e]}));const r=ct.toFiniteNumber(j.getContentLength()),[n,i]=_&&fr(r,pr(Er(_),!0))||[];let o=0;const a=t=>{if(O&&(o=t,o>v))throw new Ct("maxContentLength size of "+v+" exceeded",Ct.ERR_BAD_RESPONSE,e,N);n&&n(t)};B=new s(Dr(B.body,65536,a,(()=>{i&&i(),P&&P()})),t)}g=g||"text";let G=await E[ct.findKey(E,g)||"text"](B,e);if(O&&!f&&!W){let t;if(null!=G&&("number"==typeof G.byteLength?t=G.byteLength:"number"==typeof G.size?t=G.size:"string"==typeof G&&(t="function"==typeof n?(new n).encode(G).byteLength:G.length)),"number"==typeof t&&t>v)throw new Ct("maxContentLength size of "+v+" exceeded",Ct.ERR_BAD_RESPONSE,e,N)}return!W&&P&&P(),await new Promise(((t,r)=>{ur(t,r,{data:G,headers:vt.from(B.headers),status:B.status,statusText:B.statusText,config:e,request:N})}))}catch(t){if(P&&P(),w&&w.aborted&&w.reason instanceof Ct){const r=w.reason;throw r.config=e,N&&(r.request=N),t!==r&&Object.defineProperty(r,"cause",{__proto__:null,value:t,writable:!0,enumerable:!1,configurable:!0}),r}if(L)throw N&&!L.request&&(L.request=N),L;if(t instanceof Ct)throw N&&!t.request&&(t.request=N),t;if(t&&"TypeError"===t.name&&/Load failed|fetch/i.test(t.message)){const r=new Ct("Network Error",Ct.ERR_NETWORK,e,N,t&&t.response);throw Object.defineProperty(r,"cause",{__proto__:null,value:t.cause||t,writable:!0,enumerable:!1,configurable:!0}),r}throw Ct.from(t,t&&t.code,e,N,t&&t.response)}var M,U}},Kr=new Map,Yr=e=>{let t=e&&e.env||{};const{fetch:r,Request:n,Response:i}=t,o=[n,i,r];let s,a,c=o.length,u=Kr;for(;c--;)s=o[c],a=u.get(s),void 0===a&&u.set(s,a=c?new Map:Hr(t)),u=a;return a};Yr();const Xr={http:null,xhr:Cr,fetch:{get:Yr}};ct.forEach(Xr,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{__proto__:null,value:t})}catch(e){}Object.defineProperty(e,"adapterName",{__proto__:null,value:t})}}));const Zr=e=>`- ${e}`,zr=e=>ct.isFunction(e)||null===e||!1===e;var Jr={getAdapter:function(e,t){e=ct.isArray(e)?e:[e];const{length:r}=e;let n,i;const o={};for(let s=0;s<r;s++){let r;if(n=e[s],i=n,!zr(n)&&(i=Xr[(r=String(n)).toLowerCase()],void 0===i))throw new Ct(`Unknown adapter '${r}'`);if(i&&(ct.isFunction(i)||(i=i.get(t))))break;o[r||"#"+s]=i}if(!i){const e=Object.entries(o).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));let t=r?e.length>1?"since :\n"+e.map(Zr).join("\n"):" "+Zr(e[0]):"as no adapter specified";throw new Ct("There is no suitable adapter to dispatch the request "+t,Ct.ERR_NOT_SUPPORT)}return i},adapters:Xr};function Qr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new cr(null,e)}function qr(e){const t=ct.toSafeFlatObject(e);Qr(t),t.headers=vt.from(ct.getSafeProp(t,"headers")),t.data=sr.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1);return Jr.getAdapter(t.adapter||or.adapter,t)(t).then((function(e){Qr(t),t.response=e;try{e.data=sr.call(t,t.transformResponse,e)}finally{delete t.response}return e.headers=vt.from(e.headers),e}),(function(e){if(!ar(e)&&(Qr(t),e&&e.response)){t.response=e.response;try{e.response.data=sr.call(t,t.transformResponse,e.response)}finally{delete t.response}e.response.headers=vt.from(e.response.headers)}return Promise.reject(e)}))}const $r={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{$r[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const en={};$r.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Fr+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new Ct(n(i," has been removed"+(t?" in "+t:"")),Ct.ERR_DEPRECATED);return t&&!en[i]&&(en[i]=!0,console.warn(n(i," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(r,i,o)}},$r.spelling=function(e){return(t,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};var tn={assertOptions:function(e,t,r){if("object"!=typeof e||null===e)throw new Ct("options must be an object",Ct.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],s=Object.prototype.hasOwnProperty.call(t,o)?t[o]:void 0;if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new Ct("option "+o+" must be "+r,Ct.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new Ct("Unknown option "+o,Ct.ERR_BAD_OPTION)}},validators:$r};const rn=tn.validators;let nn=class{constructor(e){this.defaults=e||{},this.interceptors={request:new Ht,response:new Ht}}async request(e,t){try{return await this._request(e,t)}catch(e){if(e instanceof Error)try{let t={};Error.captureStackTrace?Error.captureStackTrace(t):t=new Error;const r=t.stack;let n="";if("string"==typeof r){const e=r.indexOf("\n");n=-1===e?"":r.slice(e+1)}if(e.stack){if(n){const t=n.indexOf("\n"),r=-1===t?-1:n.indexOf("\n",t+1),i=-1===r?"":n.slice(r+1);String(e.stack).endsWith(i)||(e.stack+="\n"+n)}}else e.stack=n}catch(e){}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Ar(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&tn.assertOptions(r,{silentJSONParsing:rn.transitional(rn.boolean),forcedJSONParsing:rn.transitional(rn.boolean),clarifyTimeoutError:rn.transitional(rn.boolean),legacyInterceptorReqResOrdering:rn.transitional(rn.boolean),advertiseZstdAcceptEncoding:rn.transitional(rn.boolean),validateStatusUndefinedResolves:rn.transitional(rn.boolean)},!1),null!=n&&(ct.isFunction(n)?t.paramsSerializer={serialize:n}:tn.assertOptions(n,{encode:rn.function,serialize:rn.function},!0)),void 0!==t.allowAbsoluteUrls||(void 0!==this.defaults.allowAbsoluteUrls?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),tn.assertOptions(t,{baseUrl:rn.spelling("baseURL"),withXsrfToken:rn.spelling("withXSRFToken")},!0),t.method=(ct.getSafeProp(t,"method")||ct.getSafeProp(this.defaults,"method")||"get").toLowerCase();let o=i&&ct.merge(i.common,i[t.method]);i&&ct.forEach(rr.concat("common"),(e=>{delete i[e]})),t.headers=vt.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach((function(e){if("function"==typeof e.runWhen&&!1===e.runWhen(t))return;a=a&&e.synchronous;const r=t.transitional||Kt;r&&r.legacyInterceptorReqResOrdering?s.unshift(e.fulfilled,e.rejected):s.push(e.fulfilled,e.rejected)}));const c=[];let u;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let d,l=0;if(!a){const e=[qr.bind(this),void 0];for(e.unshift(...s),e.push(...c),d=e.length,u=Promise.resolve(t);l<d;)u=u.then(e[l++],e[l++]);return u}d=s.length;let h=t;for(;l<d;){const e=s[l++],t=s[l++];try{h=e?e(h):h}catch(e){if(!t){u=Promise.reject(e);break}try{const r=t.call(this,e);ct.isThenable(r)&&(u=Promise.resolve(r).then((()=>qr.call(this,h))))}catch(e){u=Promise.reject(e)}break}}if(!u)try{u=qr.call(this,h)}catch(e){u=Promise.reject(e)}for(l=0,d=c.length;l<d;)u=u.then(c[l++],c[l++]);return u}getUri(e){return Ft(yr((e=Ar(this.defaults,e)).baseURL,e.url,e.allowAbsoluteUrls,e),e.params,e.paramsSerializer)}};ct.forEach(["delete","get","head","options"],(function(e){nn.prototype[e]=function(t,r){return this.request(Ar(r||{},{method:e,url:t,data:r&&ct.hasOwnProp(r,"data")?r.data:void 0}))}})),ct.forEach(["post","put","patch","query"],(function(e){function t(t){return function(r,n,i){return this.request(Ar(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}nn.prototype[e]=t(),"query"!==e&&(nn.prototype[e+"Form"]=t(!0))}));var on=nn;class sn{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const r=this;this.promise.then((e=>{if(!r._listeners)return;let t=r._listeners.length;for(;t-- >0;)r._listeners[t](e);r._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{r.subscribe(e),t=e})).then(e);return n.cancel=function(){r.unsubscribe(t)},n},e((function(e,n,i){r.reason||(r.reason=new cr(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new sn((function(t){e=t})),cancel:e}}}var an=sn;const cn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,ContentTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,UnprocessableContent:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511,WebServerReturnsAnUnknownError:520,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(cn).forEach((([e,t])=>{void 0===cn[t]&&(cn[t]=e)}));var un=cn;const dn=function e(t){const r=new on(t),n=le(on.prototype.request,r);return ct.extend(n,on.prototype,r,{allOwnKeys:!0}),ct.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Ar(t,r))},n}(or);dn.Axios=on,dn.CanceledError=cr,dn.CancelToken=an,dn.isCancel=ar,dn.VERSION=Fr,dn.toFormData=kt,dn.AxiosError=Ct,dn.Cancel=dn.CanceledError,dn.all=function(e){return Promise.all(e)},dn.spread=function(e){return function(t){return e.apply(null,t)}},dn.isAxiosError=function(e){return ct.isObject(e)&&!0===e.isAxiosError},dn.mergeConfig=Ar,dn.AxiosHeaders=vt,dn.formToJSON=e=>tr(ct.isHTMLForm(e)?new FormData(e):e),dn.getAdapter=Jr.getAdapter,dn.HttpStatusCode=un,dn.default=dn;var ln=dn;let hn=function(e){return e.WIN_10="Windows 10",e.WIN_81="Windows 8.1",e.WIN_8="Windows 8",e.WIN_7="Windows 7",e.WIN_VISTA="Windows Vista",e.WIN_SERVER_2003="Windows Server 2003",e.WIN_XP="Windows XP",e.WIN_2000="Windows 2000",e.ANDROID="Android",e.HARMONY_OS="HarmonyOS",e.OPEN_BSD="Open BSD",e.SUN_OS="Sun OS",e.LINUX="Linux",e.IOS="iOS",e.MAC_OS="Mac OS",e.CHROMIUM_OS="Chromium OS",e.QNX="QNX",e.UNIX="UNIX",e.BEOS="BeOS",e.OS_2="OS/2",e.SEARCH_BOT="Search Bot",e}({}),pn=function(e){return e.CHROME="Chrome",e.SAFARI="Safari",e.EDGE="Edge",e.FIREFOX="Firefox",e.OPERA="OPR",e.QQ="QQBrowser",e.WECHAT="MicroMessenger",e}({});const fn=new de;let En=fn.getResult(),mn=null;function _n(e){if(!mn){e&&fn.setUA(e),En=fn.getResult();const t=function(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return pn.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return pn.CHROME;case"Safari":case"Mobile Safari":return pn.SAFARI;case"Edge":return pn.EDGE;case"Firefox":return pn.FIREFOX;case"QQ":case"QQBrowser":return pn.QQ;case"Opera":return pn.OPERA;case"WeChat":return pn.WECHAT;default:return e.browser.name||""}}(En),r=Tn(En),n=function(e){return"Windows"===e.os.name?e.os.version?e.os.name+" "+e.os.version:e.os.name:e.os.name||""}(En),i=En.os.version,o=Tn(En,!1),s=En.device.type;if(!(t&&r&&n&&i))return{name:t,version:r,os:n,osVersion:i,browserVersion:o,deviceType:s};mn={name:t,version:r,os:n,osVersion:i,browserVersion:o,deviceType:s}}return mn}function Tn(e){let t,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t="Blink"===e.engine.name?e.engine.version||"":e.browser.version||"",r?t.split(".")[0]:t}function gn(){return _n().os}function Sn(){const e=_n();return"".concat(e.os," ").concat(e.osVersion)}function yn(){const e=_n();return!!("WebKit"===En.engine.name&&e.os===hn.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==pn.SAFARI||On()&&e.name!==pn.SAFARI)}function Rn(){return _n().name===pn.CHROME}function vn(){return _n().name===pn.SAFARI}function An(){return _n().name===pn.EDGE}function bn(){return _n().name===pn.FIREFOX}function On(){return _n().os===hn.IOS}function In(e){const t=_n();return!(t.name!==pn.CHROME||!t.osVersion)&&Number(t.version)>=e}function Cn(e,t,r){const n=_n();return!(n.name!==e||!n.osVersion)&&(r?Number(n.version)>=t&&Number(n.version)<=r:Number(n.version)===t)}function wn(e){const t=_n();return!(t.name!==pn.EDGE||!t.osVersion)&&Number(t.version)>=e}function Nn(e){const t=_n();return!(t.name!==pn.FIREFOX||!t.osVersion)&&Number(t.version)>=e}function Pn(e){const t=_n();return!(t.name!==pn.OPERA||!t.osVersion)&&Number(t.version)>=e}function Dn(){const e=_n();if(e.os!==hn.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function Ln(){const e=_n();if(e.os!==hn.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function kn(){const e=_n();if(e.os!==hn.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function Mn(){return vn()&&navigator.maxTouchPoints>0}function Un(){return _n().name===pn.WECHAT}function xn(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function Vn(){const e=gn();return function(){const e=_n().deviceType;return"mobile"===e||"tablet"===e}()||e===hn.ANDROID||e===hn.IOS||e===hn.HARMONY_OS}function Fn(){const e=_n();return e.name!==pn.EDGE&&e.name!==pn.SAFARI&&!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function Bn(){return gn()===hn.ANDROID}function jn(){const e=_n();return Bn()&&(e.name===pn.CHROME||e.name===pn.WECHAT||/chrome|chromium/i.test(navigator.userAgent))}function Wn(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Gn(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Hn(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Kn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Hn(Object(r),!0).forEach((function(t){Gn(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Yn(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return Wn(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Wn(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let Xn=function(e){return e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",e.PB_ERROR="PB_ERROR",e.TIMEOUT="TIMEOUT",e.INVALID_PARAMS="INVALID_PARAMS",e.NOT_READABLE="NOT_READABLE",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INVALID_OPERATION="INVALID_OPERATION",e.OPERATION_ABORTED="OPERATION_ABORTED",e.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",e.EXCHANGE_SDP_FAILED="EXCHANGE_SDP_FAILED",e.ADD_CANDIDATE_FAILED="ADD_CANDIDATE_FAILED",e.DATACHANNEL_FAILED="DATACHANNEL_FAILED",e.NETWORK_ERROR="NETWORK_ERROR",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",e.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",e.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",e.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",e.ELECTRON_IS_NULL="ELECTRON_IS_NULL",e.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",e.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",e.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",e.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",e.PERMISSION_DENIED="PERMISSION_DENIED",e.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",e.TRACK_IS_DISABLED="TRACK_IS_DISABLED",e.GET_VIDEO_ELEMENT_VISIBLE_ERROR="GET_VIDEO_ELEMENT_VISIBLE_ERROR",e.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",e.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",e.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",e.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",e.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",e.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",e.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",e.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",e.UID_CONFLICT="UID_CONFLICT",e.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",e.UPDATE_TICKET_FAILED="UPDATE_TICKET_FAILED",e.TOKEN_EXPIRE="TOKEN_EXPIRE",e.INVALID_LOCAL_TRACK="INVALID_LOCAL_TRACK",e.INVALID_TRACK="INVALID_TRACK",e.SENDER_NOT_FOUND="SENDER_NOT_FOUND",e.CREATE_OFFER_FAILED="CREATE_OFFER_FAILED",e.SET_ANSWER_FAILED="SET_ANSWER_FAILED",e.ICE_FAILED="ICE_FAILED",e.PC_CLOSED="PC_CLOSED",e.SENDER_REPLACE_FAILED="SENDER_REPLACE_FAILED",e.GET_LOCAL_CAPABILITIES_FAILED="GET_LOCAL_CAPABILITIES_FAILED",e.GET_LOCAL_CONNECTION_PARAMS_FAILED="GET_LOCAL_CONNECTION_PARAMS_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",e.NO_ICE_CANDIDATE="NO_ICE_CANDIDATE",e.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",e.EXIST_DISABLED_VIDEO_TRACK="EXIST_DISABLED_VIDEO_TRACK",e.INVALID_REMOTE_USER="INVALID_REMOTE_USER",e.REMOTE_USER_IS_NOT_PUBLISHED="REMOTE_USER_IS_NOT_PUBLISHED",e.CUSTOM_REPORT_SEND_FAILED="CUSTOM_REPORT_SEND_FAILED",e.CUSTOM_REPORT_FREQUENCY_TOO_HIGH="CUSTOM_REPORT_FREQUENCY_TOO_HIGH",e.FETCH_AUDIO_FILE_FAILED="FETCH_AUDIO_FILE_FAILED",e.READ_LOCAL_AUDIO_FILE_ERROR="READ_LOCAL_AUDIO_FILE_ERROR",e.DECODE_AUDIO_FILE_FAILED="DECODE_AUDIO_FILE_FAILED",e.WS_ABORT="WS_ABORT",e.WS_DISCONNECT="WS_DISCONNECT",e.WS_ERR="WS_ERR",e.EXTERNAL_SIGNAL_ABORT="EXTERNAL_SIGNAL_ABORT",e.LIVE_STREAMING_TASK_CONFLICT="LIVE_STREAMING_TASK_CONFLICT",e.LIVE_STREAMING_INVALID_ARGUMENT="LIVE_STREAMING_INVALID_ARGUMENT",e.LIVE_STREAMING_INTERNAL_SERVER_ERROR="LIVE_STREAMING_INTERNAL_SERVER_ERROR",e.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED="LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",e.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED="LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",e.LIVE_STREAMING_CDN_ERROR="LIVE_STREAMING_CDN_ERROR",e.LIVE_STREAMING_INVALID_RAW_STREAM="LIVE_STREAMING_INVALID_RAW_STREAM",e.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT="LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",e.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE="LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",e.LIVE_STREAMING_WARN_FREQUENT_REQUEST="LIVE_STREAMING_WARN_FREQUENT_REQUEST",e.WEBGL_INTERNAL_ERROR="WEBGL_INTERNAL_ERROR",e.BEAUTY_PROCESSOR_INTERNAL_ERROR="BEAUTY_PROCESSOR_INTERNAL_ERROR",e.CROSS_CHANNEL_WAIT_STATUS_ERROR="CROSS_CHANNEL_WAIT_STATUS_ERROR",e.CROSS_CHANNEL_FAILED_JOIN_SRC="CROSS_CHANNEL_FAILED_JOIN_SEC",e.CROSS_CHANNEL_FAILED_JOIN_DEST="CROSS_CHANNEL_FAILED_JOIN_DEST",e.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST="CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",e.CROSS_CHANNEL_SERVER_ERROR_RESPONSE="CROSS_CHANNEL_SERVER_ERROR_RESPONSE",e.METADATA_OUT_OF_RANGE="METADATA_OUT_OF_RANGE",e.LOCAL_AEC_ERROR="LOCAL_AEC_ERROR",e.INVALID_PLUGIN="INVALID_PLUGIN",e.DISCONNECT_P2P="DISCONNECT_P2P",e.CONVERTING_IMAGEDATA_TO_BLOB_FAILED="CONVERTING_IMAGEDATA_TO_BLOB_FAILED",e.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED="CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED",e.INIT_DATACHANNEL_TIMEOUT="INIT_DATACHANNEL_TIMEOUT",e.CREATE_DATACHANNEL_ERROR="CREATE_DATACHANNEL_ERROR",e.DATACHANNEL_CONNECTION_TIMEOUT="DATACHANNEL_CONNECTION_TIMEOUT",e.PROHIBITED_OPERATION="PROHIBITED_OPERATION",e.IMAGE_MODERATION_UPLOAD_FAILED="IMAGE_MODERATION_UPLOAD_FAILED",e.P2P_MESSAGE_FAILED="P2P_MESSAGE_FAILED",e}({});class Zn extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;super(t),Gn(this,"code",void 0),Gn(this,"message",void 0),Gn(this,"data",void 0),Gn(this,"name","AgoraRTCException"),this.code=e,this.message="AgoraRTCError ".concat(this.code,": ").concat(t),this.data=r}toString(){return this.data?"".concat(this.message,"\ndata: ").concat(JSON.stringify(this.data)):this.message}print(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"error",t=arguments.length>1?arguments[1]:void 0;return"error"===e&&(t||console).error(this.toString()),"warning"===e&&(t||console).warn(this.toString()),this}throw(e){throw this.print("error",e),this}}function zn(e,t){if("boolean"!=typeof e)throw new Zn(Xn.INVALID_PARAMS,"Invalid ".concat(t,": The value is of the boolean type."))}function Jn(e,t,r){if(!r.includes(e))throw new Zn(Xn.INVALID_PARAMS,"".concat(t," can only be set as ").concat(JSON.stringify(r)))}function Qn(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e4;if(e<r||e>n||(!(arguments.length>4&&void 0!==arguments[4])||arguments[4])&&!function(e){return"number"==typeof e&&e%1==0}(e))throw new Zn(Xn.INVALID_PARAMS,"invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"))}function qn(e,t){if("number"!=typeof e){if(!(e.min||e.max||e.ideal||e.exact))throw new Zn(Xn.INVALID_PARAMS,"".concat(t," is not a valid ConstrainLong"));void 0!==e.min&&Qn(e.min,"".concat(t,".min"),0,1/0),void 0!==e.max&&Qn(e.max,"".concat(t,".max"),1,1/0),void 0!==e.exact&&Qn(e.exact,"".concat(t,".exact"),1,1/0),void 0!==e.ideal&&Qn(e.ideal,"".concat(t,".ideal"),1,1/0)}else Qn(e,t,1,1/0)}function $n(e){return null==e}var ei=function(e){return e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE",e}(ei||{}),ti=function(e){return e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT",e}(ti||{});const ri=new class{constructor(){Gn(this,"_clientSize",null),Gn(this,"getClientWidth",(()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth)),Gn(this,"getClientHeight",(()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight)),Gn(this,"getStyle",(e=>window.getComputedStyle(e,null))),Gn(this,"checkCssVisibleProperty",(e=>{let t=!0;const r=this.getStyle(e),n=r.display,i=r.visibility,o=r.opacity,s=r.filter;return("none"===n||["hidden","collapse"].includes(i)||Number(o)<.1)&&(t=!1),!!t&&(s&&s.split(" ").filter((e=>{const t=e.split("(")[0];return["brightness","blur","opacity"].includes(t)})).map((e=>{const t=Yn(e.split(/\(|\)/),2),r=t[0],n=t[1];return[r,Number(n.match(/^[0-9\.]+/))]})).forEach((e=>{const r=Yn(e,2),n=r[0],i=r[1];switch(n){case"brightness":(i<.1||i>3)&&(t=!1);break;case"blur":i>3&&(t=!1);break;case"opacity":i<.1&&(t=!1)}})),t)})),Gn(this,"checkPropertyUpToAllParentNodes",((e,t)=>{let r=!0,n=!0;const i=e=>t(e);let o=e;for(;o&&n;)i(o)||(r=!1,n=!1),o=o.parentElement,o||(n=!1);return r})),Gn(this,"checkActualCssVisibleIncludeInherit",(e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty))),Gn(this,"getSizeAboutClient",(e=>{const t=e.getBoundingClientRect(),r=t.width,n=t.height,i=t.left,o=t.right,s=t.top,a=t.bottom,c=this.getClientWidth(),u=this.getClientHeight();return{width:r,height:n,left:i,right:o,top:s,bottom:a,clientWidth:c,clientHeight:u,clientMin:Math.min(c,u)}})),Gn(this,"checkActualSize",(()=>{const e=this._clientSize,t=e.width,r=e.height,n=e.clientMin;return this.checkSizeIsVisible(t,r,n)})),Gn(this,"elementFromPoint",((e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null)),Gn(this,"checkCoverForAPoint",((e,t,r)=>{const n=this.elementFromPoint(e,t);return null!==n&&n!==r})),Gn(this,"getPointPositionList",(()=>{const e=this._clientSize,t=e.width,r=e.height,n=e.left,i=e.top,o=t/6,s=r/6,a=[],c=10**6;for(let e=0;e<5;e++)for(let t=0;t<5;t++){const r=(n*c+(0===e?.1:4===e?(o*e*c-1e5)/c:o*e)*c)/c,u=(i*c+(0===t?.1:4===t?(s*t*c-1e5)/c:s*t)*c)/c;a.push({x:r,y:u})}return[...a]})),Gn(this,"checkElementCover",(e=>this.getPointPositionList().map((t=>this.checkCoverForAPoint(t.x,t.y,e))).filter((e=>!!e)).length>6)),Gn(this,"checkSizeIsVisible",((e,t,r)=>(e>50||r/e<=10)&&(t>50||r/t<=10))),Gn(this,"checkSizeOfPartInClient",(()=>{const e=this._clientSize,t=e.left,r=e.right,n=e.top,i=e.bottom,o=e.clientHeight,s=e.clientWidth,a=e.clientMin;let c,u,d,l;if(t<0)c=0;else{if(!(t<s))return!1;c=t}if(r<0)return!1;if(u=r<s?r:s,n<0)d=0;else{if(!(n<o))return!1;d=n}if(i<0)return!1;l=i<o?i:o;const h=u-c,p=l-d;return this.checkSizeIsVisible(h,p,a)})),Gn(this,"returnHiddenResult",(e=>(this._clientSize=null,{visible:!1,reason:e}))),Gn(this,"checkOneElementVisible",(e=>{if(e instanceof HTMLElement){if(this.checkElementIsMountedOnDom(e)){if(this.checkActualCssVisibleIncludeInherit(e)){if(this._clientSize=this.getSizeAboutClient(e),this.checkElementCover(e))return this.returnHiddenResult(ei.COVERED);{const e=this.checkActualSize(),t=this.checkSizeOfPartInClient();return e&&!t?this.returnHiddenResult(ei.POSITION):e?(this._clientSize=null,{visible:!0}):this.returnHiddenResult(ei.SIZE)}}return this.returnHiddenResult(ei.STYLE)}return this.returnHiddenResult(ti.UNMOUNTED)}return this.returnHiddenResult(ti.INVALID_HTML_ELEMENT)})),Gn(this,"checkElementIsMountedOnDom",(e=>this.checkPropertyUpToAllParentNodes(e,(e=>"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement))))}};const ni=function(e,t){const r=new Uint8Array(e.byteLength+t.byteLength);return r.set(new Uint8Array(e),0),r.set(new Uint8Array(t),e.byteLength),r};class ii{constructor(){Gn(this,"_events",{}),Gn(this,"addListener",this.on)}getListeners(e){return this._events[e]?this._events[e].map((e=>e.listener)):[]}on(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!1})}once(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!0})}off(e,t){if(!this._events[e])return;const r=this._events[e],n=this._indexOfListener(r,t);-1!==n&&r.splice(n,1),0===this._events[e].length&&delete this._events[e]}removeAllListeners(e){e?delete this._events[e]:this._events={}}emit(e){this._events[e]||(this._events[e]=[]);const t=this._events[e].map((e=>e));for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(let r=0;r<t.length;r+=1){const i=t[r];i.once&&this.off(e,i.listener),i.listener.apply(this,n||[])}}safeEmit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];[...this._events[e]||[]].forEach((t=>{t.once&&this.off(e,t.listener);try{t.listener.apply(this,r)}catch(t){console.error("safeEmit event:".concat(e," error ").concat(null==t?void 0:t.toString()))}}))}_indexOfListener(e,t){let r=e.length;for(;r--;)if(e[r].listener===t)return r;return-1}}function oi(){return!!ai()}let si=null;function ai(){if(si)return si;if(window.electron)return si=window.electron;if(!window.require)return null;try{return si=window.require("electron"),si}catch(e){return null}}let ci=function(e){return e.CREATE_CLIENT="createClient",e.CREATE_CLIENT_PRECONNECT="createClientPreconnect",e.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",e.SET_AREA="setArea",e.PRELOAD="PRELOAD",e.CHECK_VIDEO_TRACK_IS_ACTIVE="checkVideoTrackIsActive",e.CHECK_AUDIO_TRACK_IS_ACTIVE="checkAudioTrackIsActive",e.CREATE_MIC_AUDIO_TRACK="createMicrophoneAudioTrack",e.CREATE_CUSTOM_AUDIO_TRACK="createCustomAudioTrack",e.CREATE_BUFFER_AUDIO_TRACK="createBufferSourceAudioTrack",e.CREATE_CAM_VIDEO_TRACK="createCameraVideoTrack",e.CREATE_CUSTOM_VIDEO_TRACK="createCustomVideoTrack",e.CREATE_MIC_AND_CAM_TRACKS="createMicrophoneAndCameraTracks",e.CREATE_SCREEN_VIDEO_TRACK="createScreenVideoTrack",e.SET_ENCRYPTION_CONFIG="Client.setEncryptionConfig",e.START_PROXY_SERVER="Client.startProxyServer",e.STOP_PROXY_SERVER="Client.stopProxyServer",e.SET_PROXY_SERVER="Client.setProxyServer",e.SET_TURN_SERVER="Client.setTurnServer",e.SET_CLIENT_ROLE="Client.setClientRole",e.SET_LOW_STREAM_PARAMETER="Client.setLowStreamParameter",e.ENABLE_DUAL_STREAM="Client.enableDualStream",e.DISABLE_DUAL_STREAM="Client.disableDualStream",e.JOIN="Client.join",e.LEAVE="Client.leave",e.PUBLISH="Client.publish",e.UNPUBLISH="Client.unpublish",e.SUBSCRIBE="Client.subscribe",e.MASS_SUBSCRIBE="Client.massSubscribe",e.MASS_UNSUBSCRIBE="Client.massUnsubscribe",e.UNSUBSCRIBE="Client.unsubscribe",e.RENEW_TOKEN="Client.renewToken",e.SET_REMOTE_VIDEO_STREAM_TYPE="Client.setRemoteVideoStreamType",e.SET_STREAM_FALLBACK_OPTION="Client.setStreamFallbackOption",e.ENABLE_AUDIO_VOLUME_INDICATOR="Client.enableAudioVolumeIndicator",e.SEND_CUSTOM_REPORT_MESSAGE="Client.sendCustomReportMessage",e.INSPECT_VIDEO_CONTENT="Client.inspectVideoContent",e.STOP_INSPECT_VIDEO_CONTENT="Client.stopInspectVideoContent",e.JOIN_FALLBACK_TO_PROXY="Client._joinFallbackToProxy",e.ON_LIVE_STREAM_WARNING="Client.onLiveStreamWarning",e.ON_LIVE_STREAM_ERROR="Client.onLiveStreamingError",e.START_LIVE_STREAMING="Client.startLiveStreaming",e.SET_LIVE_TRANSCODING="Client.setLiveTranscoding",e.STOP_LIVE_STREAMING="Client.stopLiveStreaming",e.START_CHANNEL_MEDIA_RELAY="Client.startChannelMediaRelay",e.UPDATE_CHANNEL_MEDIA_RELAY="Client.updateChannelMediaRelay",e.STOP_CHANNEL_MEDIA_RELAY="Client.stopChannelMediaRelay",e.REQUEST_CONFIG_DISTRIBUTE="_config-distribute-request",e.SET_CONFIG_DISTRIBUTE="_configDistribute",e.LOCAL_TRACK_SET_MUTED="LocalTrack.setMute",e.LOCAL_AUDIO_TRACK_PLAY="LocalAudioTrack.play",e.LOCAL_AUDIO_TRACK_PLAY_IN_ELEMENT="LocalAudioTrack.playInElement",e.LOCAL_AUDIO_TRACK_STOP="LocalAudioTrack.stop",e.LOCAL_AUDIO_TRACK_SET_VOLUME="LocalAudioTrack.setVolume",e.MIC_AUDIO_TRACK_SET_DEVICE="MicrophoneAudioTrack.setDevice",e.BUFFER_AUDIO_TRACK_START="BufferSourceAudioTrack.startProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_STOP="BufferSourceAudioTrack.stopProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_PAUSE="BufferSourceAudioTrack.pauseProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_RESUME="BufferSourceAudioTrack.resumeProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_SEEK="BufferSourceAudioTrack.seekAudioBuffer",e.LOCAL_VIDEO_TRACK_PLAY="LocalVideoTrack.play",e.LOCAL_VIDEO_TRACK_STOP="LocalVideoTrack.stop",e.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE="LocalVideoTrack.getVideoElementVisibleStatus",e.LOCAL_VIDEO_TRACK_BEAUTY="LocalVideoTrack.setBeautyEffect",e.LOCAL_VIDEO_SEND_SEI_DATA="LocalVideoTrack.sendSeiData",e.CAM_VIDEO_TRACK_SET_DEVICE="CameraVideoTrack.setDevice",e.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG="CameraVideoTrack.setEncoderConfiguration",e.REMOTE_VIDEO_TRACK_PLAY="RemoteVideoTrack.play",e.REMOTE_VIDEO_TRACK_STOP="RemoteVideoTrack.stop",e.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE="RemoteVideoTrack.getVideoElementVisibleStatus",e.REMOTE_AUDIO_TRACK_PLAY="RemoteAudioTrack.play",e.REMOTE_AUDIO_TRACK_STOP="RemoteAudioTrack.stop",e.REMOTE_AUDIO_SET_VOLUME="RemoteAudioTrack.setVolume",e.REMOTE_AUDIO_SET_OUTPUT_DEVICE="RemoteAudioTrack.setOutputDevice",e.GET_MEDIA_STREAM_TRACK="Track.getMediaStreamTrack",e.STREAM_TYPE_CHANGE="streamTypeChange",e.CONNECTION_STATE_CHANGE="connectionStateChange",e.LOAD_CONFIG_FROM_LOCALSTORAGE="loadConfigFromLocalStorage",e.IMAGE_MODERATION_UPLOAD="imageModerationUpload",e.REPUB_AFTER_PC_CONNECTED="repubAfterPCConnected",e.PRELOAD_MEDIA_FAILED="preloadMediaFailed",e.MISMATCH_DTLS_PARAMETERS="mismatchDtlsParameters",e.MISMATCH_ICE_PARAMETERS="mismatchIceParameters",e.VOS_FALLBACK_CN="vosFallbackCN",e.DATACHANNEL_FAILBACK="datachannelFailback",e}({}),ui=function(e){return e.TRACER="tracer",e}({});!function(e){e[e.AUDIENCE_LEVEL_LOW_LATENCY=1]="AUDIENCE_LEVEL_LOW_LATENCY",e[e.AUDIENCE_LEVEL_ULTRA_LOW_LATENCY=2]="AUDIENCE_LEVEL_ULTRA_LOW_LATENCY",e[e.AUDIENCE_LEVEL_SYNC_LATENCY=3]="AUDIENCE_LEVEL_SYNC_LATENCY"}({}),function(e){e.LEAVE="LEAVE",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.UID_BANNED="UID_BANNED",e.FALLBACK="FALLBACK",e.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.LICENSE_MISSING="LICENSE_MISSING",e.LICENSE_EXPIRED="LICENSE_EXPIRED",e.LICENSE_MINUTES_EXCEEDED="LICENSE_MINUTES_EXCEEDED",e.LICENSE_PERIOD_INVALID="LICENSE_PERIOD_INVALID",e.LICENSE_MULTIPLE_SDK_SERVICE="LICENSE_MULTIPLE_SDK_SERVICE",e.LICENSE_ILLEGAL="LICENSE_ILLEGAL",e.TOKEN_EXPIRE="TOKEN_EXPIRE",e.FALLBACK_TO_HLS="FALLBACK_TO_HLS",e.UID_CONFLICT="UID_CONFLICT"}({}),function(e){e[e.AUTO_SIMULCAST_STREAM=-1]="AUTO_SIMULCAST_STREAM",e[e.DISABLE_SIMULCAST_STREM=0]="DISABLE_SIMULCAST_STREM",e[e.ENABLE_SIMULCAST_STREAM=1]="ENABLE_SIMULCAST_STREAM"}({}),function(e){e.PEERCONNECTION_STATE_CHANGE="peerconnection-state-change",e.AUDIO_METADATA="audio-metadata",e.AUDIO_PTS="audio-pts",e.CONNECTION_STATE_CHANGE="connection-state-change",e.MEDIA_RECONNECT_START="media-reconnect-start",e.MEDIA_RECONNECT_END="media-reconnect-end",e.IS_USING_CLOUD_PROXY="is-using-cloud-proxy",e.USER_JOINED="user-joined",e.USER_LEAVED="user-left",e.USER_PUBLISHED="user-published",e.USER_UNPUBLISHED="user-unpublished",e.USER_INFO_UPDATED="user-info-updated",e.CLIENT_BANNED="client-banned",e.CHANNEL_MEDIA_RELAY_STATE="channel-media-relay-state",e.CHANNEL_MEDIA_RELAY_EVENT="channel-media-relay-event",e.VOLUME_INDICATOR="volume-indicator",e.CRYPT_ERROR="crypt-error",e.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="token-privilege-will-expire",e.ON_TOKEN_PRIVILEGE_DID_EXPIRE="token-privilege-did-expire",e.NETWORK_QUALITY="network-quality",e.STREAM_TYPE_CHANGED="stream-type-changed",e.STREAM_FALLBACK="stream-fallback",e.RECEIVE_METADATA="receive-metadata",e.STREAM_MESSAGE="stream-message",e.LIVE_STREAMING_ERROR="live-streaming-error",e.LIVE_STREAMING_WARNING="live-streaming-warning",e.EXCEPTION="exception",e.ERROR="error",e.P2P_LOST="p2p_lost",e.JOIN_FALLBACK_TO_PROXY="join-fallback-to-proxy",e.CHANNEL_FALLBACK_TO_WEBSOCKET="channel-fallback-to-websocket",e.MEDIA_CONNECTION_TYPE_CHANGE="media-connection-type-change",e.PUBLISHED_USER_LIST="published-user-list",e.USER_LIST="user-list",e.CONTENT_INSPECT_CONNECTION_STATE_CHANGE="content-inspect-connection-state-change",e.CONTENT_INSPECT_ERROR="content-inspect-error",e.CONTENT_INSPECT_RESULT="content-inspect-result",e.IMAGE_MODERATION_CONNECTION_STATE_CHANGE="image-moderation-connection-state-change",e.FALLBACK_TO_HLS="fallback-to-hls",e.FIRST_VIDEO_BUFFER_READY="first-video-buffer-ready",e.FIRST_VIDEO_PRE_RENDER="first-video-pre-render",e.AV1_DECODABLE_RESULT="av1-decodable-result"}({}),function(e){e.CONFIG="config",e.VOSERROR="vos_error",e.AP_ERROR="ap_error"}({}),function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.MULTI_IP="MULTI_IP",e.TIMEOUT="TIMEOUT",e.OFFLINE="OFFLINE",e.LEAVE="LEAVE",e.P2P_FAILED="P2P_FAILED",e.FALLBACK="FALLBACK",e.REGIONAL_DISTRIBUTION="REGIONAL_DISTRIBUTION"}({});let di=function(e){return e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({}),li=function(e){return e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({});function hi(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return 0===e.getListeners(t).length?Promise.reject(new Zn(Xn.UNEXPECTED_ERROR,"can not emit promise")):new Promise(((r,i)=>{e.emit(t,...n,r,i)}))}function pi(e,t){if(0===e.getListeners(t).length)return Promise.resolve();for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return hi(e,t,...n)}function fi(e,t){if(0===e.getListeners(t).length)return null;for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return function(e,t){let r=null,n=null;for(var i=arguments.length,o=new Array(i>2?i-2:0),s=2;s<i;s++)o[s-2]=arguments[s];if(e.emit(t,...o,(e=>{r=e}),(e=>{n=e})),null!==n)throw n;if(null===r)throw new Zn(Xn.UNEXPECTED_ERROR,"handler is not sync");return r}(e,t,...n)}const Ei=new class extends ii{set networkState(e){this.emit(li.NETWORK_STATE_CHANGE,e,this._networkState),e===di.ONLINE?this.emit(li.ONLINE):e===di.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(li.ONLINE,(()=>{this.onlineWaiter=void 0,e(di.ONLINE)}))})),this.emit(li.OFFLINE)),this._networkState=e}get networkState(){return this._networkState}get isOnline(){return this._networkState===di.ONLINE}constructor(){super(),Gn(this,"_moduleName","network-indicator"),Gn(this,"_networkState",di.ONLINE),Gn(this,"onlineWaiter",void 0),window.addEventListener("online",(()=>{this.networkState=di.ONLINE})),window.addEventListener("offline",(()=>{this.networkState=di.OFFLINE}))}},mi=[];for(let e=0;e<256;++e)mi.push((e+256).toString(16).slice(1));const _i="undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);let Ti;const gi=new Uint8Array(16);function Si(){return _i?_i():function(e,t,r){var n,i,o,s;const a=null!==(n=null!==(i=(e=e||{}).random)&&void 0!==i?i:null===(o=(s=e).rng)||void 0===o?void 0:o.call(s))&&void 0!==n?n:function(){if(!Ti){if("undefined"==typeof crypto||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");Ti=crypto.getRandomValues.bind(crypto)}return Ti(gi)}();if(a.length<16)throw new Error("Random bytes length must be >= 16");if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t){if((r=r||0)<0||r+16>t.length)throw new RangeError("UUID byte range ".concat(r,":").concat(r+15," is out of buffer bounds"));for(let e=0;e<16;++e)t[r+e]=a[e];return t}return function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(mi[e[t+0]]+mi[e[t+1]]+mi[e[t+2]]+mi[e[t+3]]+"-"+mi[e[t+4]]+mi[e[t+5]]+"-"+mi[e[t+6]]+mi[e[t+7]]+"-"+mi[e[t+8]]+mi[e[t+9]]+"-"+mi[e[t+10]]+mi[e[t+11]]+mi[e[t+12]]+mi[e[t+13]]+mi[e[t+14]]+mi[e[t+15]]).toLowerCase()}(a)}(e,t,undefined);var e,t}function yi(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function Ri(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function vi(e){return JSON.parse(JSON.stringify(e))}function Ai(e){try{return vi(e)}catch(t){return e}}const bi={};function Oi(e,t){bi[t]||(bi[t]=!0,e())}function Ii(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function Ci(e){return new Promise((t=>{window.setTimeout(t,e)}))}function wi(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7,t=arguments.length>1?arguments[1]:void 0;const r=Math.random().toString(16).substr(2,e).toLowerCase();return r.length===e?"".concat(t).concat(r):"".concat(t).concat(r)+wi(e-r.length,"")}const Ni=()=>{},Pi=new class{constructor(){Gn(this,"fnMap",new Map)}throttleByKey(e,t,r,n){for(var i=arguments.length,o=new Array(i>4?i-4:0),s=4;s<i;s++)o[s-4]=arguments[s];if(this.fnMap.has(t)){const i=this.fnMap.get(t);if(i.threshold!==r){i.fn(...i.args),clearTimeout(i.timer);const s=window.setTimeout((()=>{const e=this.fnMap.get(t);e&&e.fn(...e.args),this.fnMap.delete(t)}),r);this.fnMap.set(t,{fn:e,threshold:r,timer:s,args:o,skipFn:n})}else i.skipFn&&i.skipFn(...i.args),this.fnMap.set(t,Kn(Kn({},i),{},{fn:e,args:o,skipFn:n}))}else{const i=window.setTimeout((()=>{const e=this.fnMap.get(t);e&&e.fn(...e.args),this.fnMap.delete(t)}),r);this.fnMap.set(t,{fn:e,threshold:r,timer:i,args:o,skipFn:n})}}},Di=Pi.throttleByKey.bind(Pi);function Li(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function ki(e,t){if(!Li(e)||!Li(t))return t;if(Array.isArray(e)&&!Array.isArray(t)||!Array.isArray(e)&&Array.isArray(t))return t;if(Array.isArray(t)&&Array.isArray(e)){const r=[...e];for(let n=0;n<t.length;n++)r[n]=ki(e[n],t[n]);return r}{const r=Kn({},e);for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?r[n]=ki(e[n],t[n]):r[n]=t[n]);return r}}function Mi(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}function Ui(e){return e.reduce(((e,t)=>e+t),0)}let xi=1,Vi=console;class Fi{static setLogger(e){Vi=e}constructor(e,t){Gn(this,"id",void 0),Gn(this,"lockingPromise",Promise.resolve()),Gn(this,"locks",0),Gn(this,"name",""),Gn(this,"lockId",void 0),this.lockId=xi++,e&&(this.name=e),t&&(this.id=t),this.logger("created")}logger(e,t){const r=(this.id?"[".concat(this.id,"]"):"")+"[lock-".concat(this.name,"-").concat(this.lockId,"]"),n="created"===e?"is ".concat(e,"."):"is ".concat(e,", current queue ").concat(this.locks,". ").concat(null!=t?t:"");Vi.debug("".concat(r," ").concat(n))}setId(e){this.id=e}get isLocked(){return this.locks>0}lock(e){let t;this.locks+=1,this.logger("locked",e);const r=new Promise((r=>{t=()=>{this.locks-=1,this.logger("unlocked",e),r()}})),n=this.lockingPromise.then((()=>t));return this.lockingPromise=this.lockingPromise.then((()=>r)),n}}function Bi(e,t){return function(r,n,i){const o=i.value;if("function"!=typeof o)throw new Error("Cannot use mutex on object property.");return i.value=async function(){const r=this[t];if(!r)throw new Error("mutex property key ".concat(t," doesn't exist on ").concat(e));const i=await r.lock("From ".concat(e,".").concat(n));try{for(var s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];return await o.apply(this,a)}finally{i()}},i}}const ji={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function Wi(e,t,r,n){const i=Object.assign({},ji,n);let o=i.timeout;const s=async()=>{await function(e){return new Promise((t=>{window.setTimeout(t,e)}))}(o),o*=i.timeoutFactor,o=Math.min(i.maxRetryTimeout,o)};let a=!1;const c=new Promise((async(n,o)=>{t=t||(()=>!1),r=r||(()=>!0);for(let c=0;c<i.maxRetryCount;c+=1){if(a)return o(new Zn(Xn.OPERATION_ABORTED));try{const r=await e();if(!t(r,c))return n(r);if(c+1===i.maxRetryCount)return n(r);await s()}catch(e){if(!r(e,c))return o(e);if(c+1===i.maxRetryCount)return o(e);await s()}}}));return c.cancel=()=>a=!0,c}let Gi=0,Hi=0;function Ki(e,t,r,n){return new Promise(((i,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),Gi+=Ii(t.data)):r&&(t.data.size?Gi+=t.data.size:t.data instanceof FormData?Gi+=function(e){let t=0;return(/DingTalk/i.test(navigator.userAgent)||/AliApp/i.test(navigator.userAgent))&&e.realFormData&&(e=e.realFormData),e.forEach((e=>{t+="string"==typeof e?Ii(e):e.size})),t+138}(t.data):Gi+=Ii(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,ln.request(t).then((e=>{"string"==typeof e.data?Hi+=Ii(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?Hi+=e.data.byteLength:Hi+=Ii(JSON.stringify(e.data)),n&&i({data:e.data,headers:e.headers}),i(e.data)})).catch((e=>{ln.isCancel(e)?o(new Zn(Xn.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?o(new Zn(Xn.NETWORK_TIMEOUT,e.message)):e.response?o(new Zn(Xn.NETWORK_RESPONSE_ERROR,e.response.status)):o(new Zn(Xn.NETWORK_ERROR,e.message))}))}))}async function Yi(e,t){const r=new Blob([t.data],{type:"buffer"});return await Ki(e,Kn(Kn({},t),{},{data:r,headers:{"Content-Type":"application/octet-stream"}}),!0)}!function(e){e.BANDWIDTH="bandwidth",e.CPU="cpu",e.NONE="none",e.OTHER="other"}({}),function(e){e.L1T1="L1T1",e.L1T2="L1T2",e.L1T3="L1T3",e.L1T3_KEY="L1T3_KEY",e.L2T1_KEY="L2T1_KEY",e.L2T2_KEY="L2T2_KEY",e.L2T3_KEY="L2T3_KEY",e.L3T1_KEY="L3T1_KEY",e.L3T2_KEY="L3T2_KEY",e.L3T3_KEY="L3T3_KEY"}({}),function(e){e[e.new=0]="new",e[e.connecting=1]="connecting",e[e.connected=2]="connected",e[e.disconnected=3]="disconnected",e[e.failed=4]="failed",e[e.closed=5]="closed"}({}),function(e){e.CERTIFICATE="certificate",e.CODEC="codec",e.CANDIDATE_PAIR="candidate-pair",e.LOCAL_CANDIDATE="local-candidate",e.REMOTE_CANDIDATE="remote-candidate",e.INBOUND="inbound-rtp",e.TRACK="track",e.OUTBOUND="outbound-rtp",e.PC="peer-connection",e.REMOTE_INBOUND="remote-inbound-rtp",e.REMOTE_OUTBOUND="remote-outbound-rtp",e.TRANSPORT="transport",e.CSRC="csrc",e.DATA_CHANNEL="data-channel",e.STREAM="stream",e.SENDER="sender",e.RECEIVER="receiver"}({});var Xi=function(e){return e[e.kNone=1]="kNone",e[e.kMillisecondsFromSeconds=1e3]="kMillisecondsFromSeconds",e[e.kBytesToBits=8]="kBytesToBits",e}(Xi||{});const Zi="websdk_ng_install_id";function zi(){try{if(to("INSTALL_ID"))return to("INSTALL_ID");let e=window.localStorage.getItem(Zi);return e||(e=function(){let e,t=!1;try{e=Si().replaceAll("-","")}catch(e){t=!0}return!t&&e&&32===e.length||(e=wi(32,"")),e.toUpperCase()}(),window.localStorage.setItem(Zi,e)),eo("INSTALL_ID",e),e}catch(e){return}}const Ji=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;const t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-([0-9]+)/);if(t&&t[1]&&t[2]){const e=t[1],r=t[2];return"".concat(e,".").concat(r)}return"4.0.0.999"}("4.24.9"),Qi=function(){try{return!0===JSON.parse("true")}catch(e){return!0}}();!function(e){e.Default="default",e.Auto="auto",e.Relay="relay",e.SdRtn="sd-rtn"}({});const qi=function(){const e="us".concat("erna","me"),t="pa".concat("sswo","rd"),r=["t","s","t"];r.splice(1,0,"e");const n=r.join(""),i=[];for(let e=0;e<6;e++)i.push("1");const o=i.join(""),s={};return s[e]=n,s[t]=o,Object.assign(s,{turnServerURL:"",tcpport:3433,udpport:3478,forceturn:!1})}();window.DEFAULT_TURN_CONFIG=qi;const $i=Kn(Kn(Kn(Kn({},{ENABLE_EVENT_REPORT:!0,UPLOAD_LOG:!1,ENABLE_AG_ADAPTATION:!0,FORCE_AG_HIGH_FRAMERATE:!1,FORCE_SUPPORT_AG_ADAPTATION:!1,ENCODER_CONFIG_LIMIT:{},CAMERA_CAPTURE_CONFIG:void 0,ENABLE_PRELOAD:!0,ENABLE_CREATE_CLIENT_PRECONNECT:!0,CREATE_CLIENT_PRECONNECT_MODE:"report",CREATE_CLIENT_PRECONNECT_KEEPALIVE:!1,CREATE_CLIENT_PRECONNECT_INTERVAL_MS:55e3,NEW_ICE_RESTART:!0,ICE_RESTART_INTERVAL:1e4,RESTART_SEQUENCE:["udp_tcp_relay","relay"],FIRST_TCP_CANDIDATE:!1,MAX_CONFIG_RETRY:10,ENABLE_CONFIG_RESTORE:!1,CONFIG_RESTORE_ERROR_API:["createClient","Client.join"],CONFIG_ERROR_MONITOR:["INVALID_OPERATION","UNEXPECTED_ERROR"],BLOCKED_CONFIG_MAX_TIME:864e5,FIRST_TCP_CANDIDATE_INTERVAL:1e3,TURN_DOMAIN:"edge.agora.io",TURN_DOMAINS:["edge.agora.io"],USE_TURN_IP:!0,NEW_TURN_MODE:4,NEW_FORCE_TURN:!1,USE_NEW_RENDER_FREEZE_TIME:!0,FLS_FALLBACK_TIMEOUT:3e4,RTE_DETAIL_REPORT_INTERVAL:6e4,ENCODE_EXCEPTION_TIMES:5,ENABLE_ENCODE_EXCEPTION:!0,ENABLE_DECODE_RECOVERY:!1,DECODE_RECOVERY_MAX_ATTEMPTS:5,DECODE_RECOVERY_BASE_INTERVAL:1e4,ENCODE_EXCEPTION_VALIDATE_CODEC:["h264"],VIDEO_ENCODER_CONFIG_LIST:[{width:240,height:180},{width:320,height:240},{width:400,height:300},{width:480,height:360},{width:560,height:420},{width:640,height:480}],DELETE_NEQ_AFTER_USER_LEAVE:!0,UPDATE_RTP_CAP_IN_HOST:!1,IOS_BG_TAG:!0,IOS_AUTO_RESTART_BG_TAG:!0,IGNORE_UID_CHECK:!1,ENABLE_UP_SPS_PPS:!1,ENABLE_DOWN_SPS_PPS:!0,NO_EDGES_RETRY:!0,BUFFER_READY_FRAMES:3,FLS_SYNC_AV_PLAY_LIMIT:0,FLS_BUFFER_WAIT_TIME:1500,VOS_CONFIGURE:void 0,ENABLE_QUALITY_FALLBACK:!1,QUALITY_FALLBACK_REHEARSAL:!0,ENABLE_FLS_AV1_FIRST:!1,ENABLE_AP_MULTI_IP:!0,FLS_ENABLE_AV1_DETECT:!0,FLS_ENABLE_AV1_DECODE_DETECT:!0,ENABLE_SDP_ENDPOINT_LOG:!1,REMOTE_VIDEO_FREEZE_TIME_VERSION:2,ENABLE_ICE_EARLY_JOIN:!0,ENABLE_DUAL_STREAM_RESOLUTION_CORRECTION:!0}),{},{PROCESS_ID:"",ENCRYPT_AES:!0,AREAS:["CHINA","GLOBAL"],WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],SDP_ENDPOINT_DOMAIN:["sdp-ap-web-1.rtnsvc.com","sdp-ap-web-1.rtesvc.com"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-web-2.ap.sd-rtn.com","cds-ap-web-3.agora.io","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-web-2.ap.sd-rtn.com","sua-ap-web-3.agora.io","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-ap-web-1.agora.io","uap-web-2.ap.sd-rtn.com","uap-ap-web-3.agora.io","uap-web-4.ap.sd-rtn.com"],LOG_UPLOAD_SERVER:"logservice.agora.io",EVENT_REPORT_DOMAIN:"statscollector-1.agora.io",EVENT_REPORT_BACKUP_DOMAIN:"web-2.statscollector.sd-rtn.com",GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",HTTP_CONNECT_TIMEOUT:5e3,SIGNAL_REQUEST_TIMEOUT:1e4,REPORT_STATS:!0,NOT_REPORT_EVENT:[],PING_PONG_TIME_OUT:10,WEBSOCKET_TIMEOUT_MIN:1e4,EVENT_REPORT_SEND_INTERVAL:3e3,CONFIG_DISTRIBUTE_INTERVAL:3e5,ENABLE_CONFIG_DISTRIBUTE:!0,CANDIDATE_TIMEOUT:5e3,SHOW_REPORT_INVOKER_LOG:!1,SHOW_REPORT_USER_INVOKER_LOG:!0,JOIN_EXTEND:"",PUB_EXTEND:"",SUB_EXTEND:"",FORCE_TURN:!1,TURN_ENABLE_TCP:!0,TURN_ENABLE_UDP:!0,MAX_UPLOAD_CACHE:50,UPLOAD_CACHE_INTERVAL:2e3,AJAX_REQUEST_CONCURRENT:3,REPORT_APP_SCENARIO:void 0,GATEWAY_DOMAINS:["edge.agora.io","edge.sd-rtn.com"],CONNECT_GATEWAY_WITHOUT_DOMAIN:!1,WORKER_DOMAIN:"edge.agora.io",EVENT_REPORT_RETRY:!0,CHROME_FORCE_PLAN_B:!1,AUDIO_SOURCE_VOLUME_UPDATE_INTERVAL:400,AUDIO_SOURCE_AVG_VOLUME_DURATION:3e3,AUDIO_VOLUME_INDICATION_INTERVAL:2e3,VOLUME_VOICE_WEIGHT:10,GET_VOLUME_OF_MUTED_AUDIO_TRACK:!1,STATS_UPDATE_INTERVAL:250,NORMAL_EVENT_QUEUE_CAPACITY:100,CUSTOM_REPORT:!0,CUSTOM_REPORT_LIMIT:20,PROXY_SERVER_TYPE2:"webnginx-proxy.agora.io",PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com","webrtc-cloud-proxy.agora.io"],CUSTOM_PUB_ANSWER_MODIFIER:null,CUSTOM_SUB_ANSWER_MODIFIER:null,CUSTOM_PUB_OFFER_MODIFIER:null,CUSTOM_SUB_OFFER_MODIFIER:null,DSCP_TYPE:"high",REMOVE_NEW_CODECS:!0,FRAGEMENT_LENGTH:3,WEBSOCKET_COMPRESS:!1,SIMULCAST:!1,CHECK_VIDEO_VISIBLE_INTERVAL:3e4,CHECK_LOCAL_STATS_INTERVAL:250,PROFILE_SWITCH_INTERVAL:2e3,UNSUPPORTED_VIDEO_CODEC:[],ENUMERATE_DEVICES_INTERVAL:!1,ENUMERATE_DEVICES_INTERVAL_TIME:1e4,USE_NEW_TOKEN:!1,CLOSE_AFB_FOR_LOCAL_AP:!0,JOIN_MAX_CONCURRENCY:6,JOIN_WITH_FALLBACK_SIGNAL_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY_FORCE:!1,JOIN_GATEWAY_TRY_443PORT_DURATION:2e3,JOIN_GATEWAY_USE_443PORT_ONLY:!1,JOIN_GATEWAY_USE_DUAL_DOMAIN:!0,JOIN_GATEWAY_FALLBACK_PORT:443,USE_TURN_SERVER_OF_GATEWAY:!1,H264_PROFILE_LEVEL_ID:"",USE_NEW_LOG:!1,LOG_VERSION:3,MEDIA_DEVICE_CONSTRAINTS:null,ENCRYPT_PROXY_USERNAME_AND_PSW:!0,SDP_LOGGING:!1,CSP_DETECTED_HOSTNAME_LIST:["agora.io","sd-rtn.com"],REMOTE_AUDIO_TRACK_USES_WEB_AUDIO:!1,ENABLE_WECHAT_AUTOPLAY_RECOVERY:!1,LOCAL_AUDIO_TRACK_USES_WEB_AUDIO:!1,BITRATE_ADAPTER_TYPE:"STANDARD_BITRATE",AI_DENOISER_PARAMETERS:{excludedLinks:[]},ADJUST_3A_FROM_PLUGINS:!0,RAISE_H264_BASELINE_PRIORITY:!0,FILTER_SEND_H264_BASELINE:!1,FIRST_H264_PROFILE_LEVEL_ID:"42001f",FIRST_PACKETIZATION_MODE:"",X_GOOGLE_START_BITRATE:void 0,NEW_REPORT_SERVER:!1,NEW_REPORT_SERVER_DOMAINS:["data-reporting.agora.io","data-reporting.agora.io"],VIDEO_INSPECT_WORKER_MESSAGE_LENGTH_LIMIT:3e5,VIDEO_INSPECT_INTERVAL_MINIMUM:1e3,VIDEO_INSPECT_QUALITY_RATIO:.9,VIDEO_INSPECT_WORKER_MANAGER_HOST:"edge.agora.io",VIDEO_INSPECT_WORKER_MANAGER_PORT:"",VIDEO_INSPECT_WORKER_MANAGER_WSS:"",VIDEO_INSPECT_WORKER_PORT:"",SHOW_VIDEO_INSPECT_WORKER_MESSAGE:!1,STATS_COLLECTOR_PORT:443,FORCE_TURN_TCP:!1,WEBAUDIO_INIT_OPTIONS:void 0,FILTER_VIDEO_FEC:!0,FILTER_AUDIO_FEC:!1,CHROME_DUAL_STREAM_USE_ENCODING:!0,DISABLE_DUAL_STREAM_USE_ENCODING:!1,EXTENSION_USAGE_UPLOAD_INTERVAL:1e4,ICE_RESTART:!0,FINGERPRINT:null,ENABLE_VIDEO_FRAME_CALLBACK:!0,VIDEO_FREEZE_DURATION:500,SPATIALIZER_PARAMETERS:{},UPLOAD_LOG_INTERVAL:3e3,UPLOAD_LOG_REQUEST_RETRY_INTERVAL:2e3,UPLOAD_LOG_REQUEST_MAX_RETRY_INTERVAL:2e4,UPLOAD_LOG_TRY_INTERVAL_WHILE_OFF:5e3,UPLOAD_LOG_RETRY_INTERVAL_V1:1e4,UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1:200,UPLOAD_LOG_LENGTH_EACH_TIME:10,APP_TYPE:0,DISABLE_WEBAUDIO:!1,CHANNEL_MEDIA_RELAY_SERVERS:void 0,KEEP_LAST_FRAME:!0,FORWARD_P2P_CREATION:!0,SYNC_GROUP:!0,BLOCK_LOCAL_CLIENT:!1,ENABLE_AUDIO_TOPN:!1,ENABLE_AUDIO_METADATA:!1,ENABLE_AUDIO_PTS:!1,TOPN_SMOOTH_LEVEL:void 0,TOPN_NEW_SPEAKER_DELAY:void 0,TOPN_SWITCH_HOLD_MS:void 0,TOPN_AUDIO_GAIN:void 0,TOPN_SILENCE_THRESHOLD:250,AP_AREA:!0,ENABLE_ENCODED_TRANSFORM:!1,ENABLE_VIDEO_SEI:!1,IMAGE_MODERATION_WORKER_HOST:"edge.agora.io",IMAGE_MODERATION_WORKER_WSS:"",IMAGE_MODERATION_WORKER_MESSAGE_LENGTH_LIMIT:3e5,IMAGE_MODERATION_INTERVAL_MINIMUM:1e3,SHOW_IMAGE_MODERATION_WORKER_MESSAGE:!1,IMAGE_MODERATION_QUALITY_RATIO:.9,IMAGE_MODERATION_UPLOAD_REPORT_INTERVAL:5e3,SHOW_GLOBAL_CLIENT_LIST:!1,DATASTREAM_MAX_RETRANSMITS:10,TCP_CANDIDATE_ONLY:!1,EXTERNAL_SIGNAL_REQUEST_TIMEOUT:3e3,SHOW_P2P_LOG:!1,MAX_P2P_TIMEOUT:3e4,P2P_TOKEN_INTERVAL:1e3,SHOW_DATASTREAM2_LOG:!1,RESTRICTION_SET_PLAYBACK_DEVICE:!0,USE_PURE_ENCRYPTION_MASTER_KEY:!1,ENABLE_AUDIO_RED:!1,OPUS_PTIME:void 0,AUDIO_DUPLICATE_NUM:void 0,ENABLE_ABSSENDTIME_AS_SENTTS:!0,ACCOUNT_REGISTER_RETRY_TIMEOUT:1,ACCOUNT_REGISTER_RETRY_RATIO:2,ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX:6e4,ACCOUNT_REGISTER_RETRY_COUNT_MAX:1e5,AUDIO_CONTEXT:null,WEBCS_BACKUP_CONNECT_TIMEOUT:6e3,PLAYER_STATE_DEFER:2e3,SIGNAL_REQUEST_WATCH_INTERVAL:1e3,FILEPATH_LENMAX:255,DUALSTREAM_OPERATION_CHECK:!0,MEDIA_ELEMENT_EXISTS_DEPTH:3,SHIM_CANDIDATE:!1,LEAVE_MSG_TIMEOUT:2e3,STATS_FILTER:{transportId:!0,googTrackId:!0},FILTER_VIDEO_CODEC:[],SIGNAL_CHANNEL:0,TRANSMITTER_INITIAL_RTT:30,TRANSMITTER_INITIAL_RTO:30,TRANSMITTER_MAX_BATCH_ACK_COUNT:2,TRANSMITTER_MAX_RTO:500,DATACHANNEL_COMPRESS:!1,DC_JOIN_WITH_FAILBACK:4e3,DC_CONNECTION_TIMEOUT:2e3,DC_PINGPONG_INTERVAL:2e3,DC_DEBUG_LOG:!1,UNSUPPORTED_VIDEO_UPLINK_CODEC:[],UNSUPPORTED_VIDEO_DOWNLINK_CODEC:[],USE_NEW_NETWORK_CONFIG:!1,AUTO_RESET_AUDIO_ROUTE:!1,PLUGIN_INFO:[],OVERUSE_DETECTOR_PARAMS:{MIN_FRAME_RATE:1,MAX_FRAME_RATE:30,MAX_THRESHOLD_FRAMERATE:30,BITRATE_MIN_THRESHOLD:100,BITRATE_MAX_THRESHOLD:100,MAX_SCALE:5,BWE_SCALE_UP_THRESHOLD:.6,BWE_SCALE_DOWN_THRESHOLD:.6,PERF_SCALE_UP_THRESHOLD:.7,PERF_SCALE_DOWN_THRESHOLD:.6,MOTION_RESOLUTION_FACTOR:.8,MOTION_BITRATE_FACTOR:.6,DETAIL_FRAMERATE_FACTOR:.8,DETAIL_BITRATE_FACTOR:.6,BALANCE_RESOLUTION_FACTOR:.9,BALANCE_FRAMERATE_FACTOR:.9,BALANCE_BITRATE_FACTOR:.6,OVERUSE_TIMES_THRESHOLD:10,UNDERUSE_TIMES_THRESHOLD:40},CUSTOM_ADAPTATION_DEFAULT_MODE:"",HIDE_NO_POSTER:!1,AP_CACHE_NUM:10,AP_UPDATE_INTERVAL:12e4,AP_CACHE_LIFETIME:12e4,MAX_PRELOAD_ASYNC_LENGTH:3,DISABLE_SCREEN_SHARE_REMB:!1},{ENABLE_PUBLISHED_USER_LIST:!0,ENABLE_USER_LIST:!1,MAX_SUBSCRIPTION:50,SUBSCRIBE_AUDIO_FILTER_TOPN:void 0,ENABLE_PUBLISH_AUDIO_FILTER:void 0,ENABLE_USER_LICENSE_CHECK:!0,DISABLE_FEC:void 0,ENABLE_NTP_REPORT:!0,ENABLE_INSTANT_VIDEO:!0,ENABLE_USER_AUTO_REBALANCE_CHECK:!0,ENABLE_LOSSBASED_BWE:!0,ENABLE_AUT_CC:!0,FORCE_ENABLE_AUT_CC:!1,ENABLE_CC_FALLBACK:void 0,SUBSCRIBE_TWCC:!0,PUBLISH_TWCC:!1,ENABLE_SVC_DEFAULT_CODECS:["H264","VP8","VP9","AV1"],SVC:[],ENABLE_FULL_LINK_AV_SYNC:!1,SVC_MODE:null,ENABLE_AUT_FEEDBACK:!0,SVC_EXTENDED:["VP9"],ENABLE_AP_COMPRESS:!0}),{},{USE_CANDIDATE_FROM_AP_DETAIL:!1,AP_REQUEST_DETAIL:void 0,AP_REQUEST_DETAIL_EXTEND:void 0,ENABLE_ROLE_SELECT_EDGE:!1,CLIENT_ROLE_OPTIONS:void 0,REMOTE_VIDEO_STREAM_TYPE:void 0,COMPATIBLE_SDP_EXTENSION:["gdpr_forbidden"],LIMIT_BITRATE:void 0,EXPERIMENTS:{},USE_PUB_RTX:!0,USE_SUB_RTX:!0,ENABLE_DATASTREAM_2:!1,USE_XR:!0,ENABLE_PREALLOC_PC:!0,FLEXIBLE_PC:!1,ENABLE_PRE_SUB:!1,ENABLE_JOIN_V4:!1,ENABLE_SVC:!1,ENABLE_FORCE_HLS:!1,MAX_WEBAUDIO_VOLUME:300,ENABLE_VOS_FALLBACK:!1,ENABLE_FALLBACK_TO_HLS:!1,ENABLE_PRE_RENDER:!1,FORCE_DISABLE_AUTO_SUB:!1,ENABLE_PRE_SUB_WITH_PRE_PC:!0,PRE_USE_LOCAL_CODECS:!0},{INSTALL_ID:""}),{},{K_MIN_RENDER_DELAY:66,USE_STANDARD_BITRATE_DEFAULT:!1,VIDEO_NEW_BITRATE_RATIO:void 0,VIDEO_STANDARD_BITRATE_VERSION:2,BASELINE_MORE_H264_BITRATE_RATIO:1.1,IGNORE_RTC_DEVICE_CHECK:!1,FLS_AUTOPLAY_EMITS:!1,ENABLE_DUAL_STREAM_FLAG:!1,FORBID_MODIFY_LOCAL_OFFER_SDP:!1,RESERVE_MID_1_MLINE:!1,PRE_SUB_NUM:1,DC_IN_ESM:!0,PRE_PLAYOUT_DELAY_HINT:void 0});function eo(e,t,r){var n;Object.keys($i).includes(e)&&(!r&&Object.keys(ro).includes(e)||($i[e]=t,"ENABLE_VIDEO_SEI"!==e&&"ENABLE_AUDIO_TOPN"!==e&&"ENABLE_AUDIO_METADATA"!==e&&"ENABLE_AUDIO_PTS"!==e||!0!==t||($i.ENABLE_ENCODED_TRANSFORM=!0),"USE_NEW_NETWORK_CONFIG"===e&&t&&(n=!!t,$i.USE_NEW_NETWORK_CONFIG=n,n&&($i.WEBCS_DOMAIN=["webrtc2-2.ap.sd-rtn.com"],$i.WEBCS_DOMAIN_BACKUP_LIST=["webrtc2-4.ap.sd-rtn.com"],$i.CDS_AP=["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],$i.ACCOUNT_REGISTER=["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],$i.EVENT_REPORT_DOMAIN="web-2.statscollector.sd-rtn.com",$i.EVENT_REPORT_BACKUP_DOMAIN="statscollector-1.agora.io",$i.GATEWAY_DOMAINS=["edge.sd-rtn.com"])),"ENABLE_PRE_SUB"===e&&t&&($i.ENABLE_INSTANT_VIDEO=!0,$i.ENABLE_PREALLOC_PC=!0),"ENABLE_SVC"===e&&t&&($i.ENABLE_AUT_CC=!0),"NEW_FORCE_TURN"===e&&t&&($i.NEW_TURN_MODE||($i.NEW_TURN_MODE=4))))}function to(e){if("TURN_DOMAINS"===e){const e=$i.TURN_DOMAINS;return e.includes(to("TURN_DOMAIN"))?e:[to("TURN_DOMAIN")].concat(e)}return $i[e]}Qi||($i.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],$i.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],$i.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],$i.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],$i.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],$i.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],$i.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",$i.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",$i.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",$i.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",$i.AREAS=["NORTH_AMERICA","OVERSEA"]),function(e){e[e.REALTIME=1]="REALTIME"}({});const ro={};var no=function(e){return e.SET_SESSION_ID="SET_SESSION_ID",e.SET_RTE_URL="SET_RTE_URL",e.SET_RTE_SID="SET_RTE_SID",e.SET_P2P_ID="SET_P2P_id",e.SET_DC_ID="SET_DC_id",e.SET_UID="SET_UID",e.SET_INT_UID="SET_INT_UID",e.SET_PUB_ID="SET_PUB_ID",e.SET_CLOUD_PROXY_SERVER_MODE="SET_CLOUD_PROXY_SERVER_MODE",e.KEY_METRIC_CLIENT_CREATED="KEY_METRIC_CLIENT_CREATED",e.KEY_METRIC_JOIN_START="KEY_METRIC_JOIN_START",e.KEY_METRIC_PRELOAD_START="KEY_METRIC_PRELOAD_START",e.KEY_METRIC_PRELOAD_END="KEY_METRIC_PRELOAD_END",e.KEY_METRIC_JOIN_END="KEY_METRIC_JOIN_END",e.KEY_METRIC_REQUEST_AP_START="KEY_METRIC_REQUEST_AP_START",e.KEY_METRIC_REQUEST_AP_END="KEY_METRIC_REQUEST_AP_END",e.KEY_METRIC_REQUEST_SUA_END="KEY_METRIC_REQUEST_SUA_END",e.KEY_METRIC_BEFORE_CONNECT="KEY_METRIC_BEFORE_CONNECT",e.KEY_METRIC_PEER_RECEIVER="KEY_METRIC_PEER_RECEIVER",e.KEY_METRIC_SIGNAL_CONNECTED="KEY_METRIC_SIGNAL_CONNECTED",e.KEY_METRIC_JOIN_REQ="KEY_METRIC_JOIN_REQ",e.KEY_METRIC_JOIN_REP="KEY_METRIC_JOIN_REP",e.KEY_METRIC_JOIN_GATEWAY_START="KEY_METRIC_JOIN_GATEWAY_START",e.KEY_METRIC_JOIN_GATEWAY_END="KEY_METRIC_JOIN_GATEWAY_END",e.KEY_METRIC_PEER_CONNECTION_START="KEY_METRIC_PEER_CONNECTION_START",e.KEY_METRIC_PEER_CONNECTION_END="KEY_METRIC_PEER_CONNECTION_END",e.KEY_METRIC_FIRST_VIDEO_FRAME_DECODED="KEY_METRIC_FIRST_VIDEO_FRAME_DECODED",e.KEY_METRIC_DESCRIPTION_START="KEY_METRIC_DESCRIPTION_START",e.KEY_METRIC_ICE_CONNECTION_END="KEY_METRIC_ICE_CONNECTION_END",e.KEY_METRIC_SIGNAL_CHANNEL_OPEN="KEY_METRIC_SIGNAL_CHANNEL_OPEN",e.KEY_METRIC_PUBLISH="KEY_METRIC_PUBLISH",e.KEY_METRIC_SUBSCRIBE="KEY_METRIC_SUBSCRIBE",e.RECORD_JOIN_CHANNEL_SERVICE="RECORD_JOIN_CHANNEL_SERVICE",e.RESET_JOIN_CHANNEL_SERVICE_RECORDS="RESET_JOIN_CHANNEL_SERVICE_RECORDS",e.RESET_KEY_METRICS="RESET_KEY_METRICS",e.RESET_FIRST_VIDEO_FRAME_DECODED="RESET_FIRST_VIDEO_FRAME_DECODED",e.SET_USE_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE",e}(no||{});function io(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function oo(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function so(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function ao(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?so(Object(r),!0).forEach((function(t){oo(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):so(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function co(e,t){return co=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},co(e,t)}function uo(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(a.push(n.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||function(e,t){if(e){if("string"==typeof e)return io(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?io(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function lo(){lo=function(e,t){return new r(e,void 0,t)};var e=RegExp.prototype,t=new WeakMap;function r(e,n,i){var o=RegExp(e,n);return t.set(o,i||t.get(e)),co(o,r.prototype)}function n(e,r){var n=t.get(r);return Object.keys(n).reduce((function(t,r){var i=n[r];if("number"==typeof i)t[r]=e[i];else{for(var o=0;void 0===e[i[o]]&&o+1<i.length;)o++;t[r]=e[i[o]]}return t}),Object.create(null))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&co(e,t)}(r,RegExp),r.prototype.exec=function(t){var r=e.exec.call(this,t);if(r){r.groups=n(r,this);var i=r.indices;i&&(i.groups=n(i,this))}return r},r.prototype[Symbol.replace]=function(r,i){if("string"==typeof i){var o=t.get(this);return e[Symbol.replace].call(this,r,i.replace(/\$<([^>]+)(>|$)/g,(function(e,t,r){if(""===r)return e;var n=o[t];return Array.isArray(n)?"$"+n.join("$"):"number"==typeof n?"$"+n:""})))}if("function"==typeof i){var s=this;return e[Symbol.replace].call(this,r,(function(){var e=arguments;return"object"!=typeof e[e.length-1]&&(e=[].slice.call(e)).push(n(e,s)),i.apply(this,e)}))}return e[Symbol.replace].call(this,r,i)},lo.apply(this,arguments)}!function(e){e.h264="h264",e.h265="h265",e.vp8="vp8",e.vp9="vp9",e.av1="av1"}({}),function(e){e.opus="opus",e.pcma="pcma",e.pcmu="pcmu",e.g722="g722"}({}),(()=>{var e={8:(e,t,r)=>{r.r(t),r.d(t,{Parser:()=>R,Printer:()=>I,parse:()=>P,print:()=>D});const n="\n",i="".concat("\r").concat(n),o=" ";let s;function a(e){return e>="0"&&e<="9"}function c(e){return e>="!"&&e<="~"}function u(e){return c(e)||e>="€"&&e<="ÿ"}function d(e){return"!"===e||e>="#"&&e<="'"||e>="*"&&e<="+"||e>="-"&&e<="."||e>="0"&&e<="9"||e>="A"&&e<="Z"||e>="^"&&e<="~"}function l(e){return e>="1"&&e<="9"}function h(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function p(e){return"d"===e||"h"===e||"m"===e||"s"===e}function f(e){return e>""&&e<"\t"||e>"\v"&&e<"\f"||e>""&&e<"ÿ"}function E(e){return h(e)||a(e)||"+"===e||"/"===e}function m(e){return a(e)||h(e)||"+"===e||"/"===e||"-"===e||"_"===e}function _(e){return h(e)||a(e)||"+"===e||"/"===e}function T(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?T(Object(r),!0).forEach((function(t){S(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e.VERSION="v",e.ORIGIN="o",e.SESSION_NAME="s",e.INFORMATION="i",e.URI="u",e.EMAIL="e",e.PHONE="p",e.CONNECTION="c",e.BANDWIDTH="b",e.TIME="t",e.REPEAT="r",e.ZONE_ADJUSTMENTS="z",e.KEY="k",e.ATTRIBUTE="a",e.MEDIA="m"}(s||(s={}));class y{consumeText(e,t){let r=t;for(;r<e.length;){const t=e[r];if("\0"===t||"\r"===t||t===n)break;r+=1}if(r-t==0)throw new Error("Invalid text, at ".concat(e));return r}consumeUnicastAddress(e,t,r){return this.consumeTill(e,t,o)}consumeOneOrMore(e,t,r){let n=t;for(;r(e[n]);)n++;if(n-t==0)throw new Error("Invalid rule at ".concat(t,"."));return n}consumeSpace(e,t){if(e[t]===o)return t+1;throw new Error("Invalid space at ".concat(t,"."))}consumeIP4Address(e,t){let r=t;for(let t=0;t<4;t++)if(r=this.consumeDecimalUChar(e,r),3!==t){if("."!==e[r])throw new Error("Invalid IP4 address.");r++}return r}consumeDecimalUChar(e,t){let r=t;for(let t=0;t<3&&a(e[r]);t++,r++);if(r-t==0)throw new Error("Invalid decimal uchar.");const n=parseInt(e.slice(t,r));if(n>=0&&n<=255)return r;throw new Error("Invalid decimal uchar")}consumeIP6Address(e,t){let r=this.consumeHexpart(e,t);return":"===e[r]?(r+=1,r=this.consumeIP4Address(e,r),r):r}consumeHexpart(e,t){let r=t;if(":"===e[r]&&":"===e[r+1]){r+=2;try{r=this.consumeHexseq(e,r)}catch(e){}return r}if(r=this.consumeHexseq(e,r),":"===e[r]&&":"===e[r+1]){r+=2;try{r=this.consumeHexseq(e,r)}catch(e){}return r}return r}consumeHexseq(e,t){let r=t;for(;r=this.consumeHex4(e,r),":"===e[r]&&":"!==e[r+1];)r+=1;return r}consumeHex4(e,t){let r=0;for(;r<4;r++)if(!((n=e[t+r])>="0"&&n<="9"||n>="a"&&n<="f"||n>="A"&&n<="F")){if(0===r)throw new Error("Invalid hex 4");break}var n;return t+r}consumeFQDN(e,t){let r=t;for(;a(e[r])||h(e[r])||"-"===e[r]||"."===e[r];)r+=1;if(r-t<4)throw new Error("Invalid FQDN");return r}consumeExtnAddr(e,t){return this.consumeOneOrMore(e,t,u)}consumeMulticastAddress(e,t,r){switch(r){case"IP4":case"ip4":return this.consumeIP4MulticastAddress(e,t);case"IP6":case"ip6":return this.consumeIP6MulticastAddress(e,t);default:try{return this.consumeFQDN(e,t)}catch(r){return this.consumeExtnAddr(e,t)}}}consumeIP6MulticastAddress(e,t){const r=this.consumeHexpart(e,t);return"/"===e[r]?this.consumeInteger(e,r+1):r}consumeIP4MulticastAddress(e,t){let r=t+3;const n=e.slice(t,r),i=parseInt(n);if(i<224||i>239)throw new Error("Invalid IP4 multicast address, IPv4 multicast addresses may be in the range 224.0.0.0 to 239.255.255.255.");for(let t=0;t<3;t++){if("."!==e[r])throw new Error("Invalid IP4 multicast address.");r+=1,r=this.consumeDecimalUChar(e,r)}return"/"===e[r]&&(r+=1),r=this.consumeTTL(e,r),"/"===e[r]&&(r=this.consumeInteger(e,r)),r}consumeInteger(e,t){if(!l(e[t]))throw new Error("Invalid integer.");for(t+=1;a(e[t]);)t+=1;return t}consumeTTL(e,t){if("0"===e[t])return t+1;if(!l(e[t]))throw new Error("Invalid TTL.");t+=1;for(let r=0;r<2&&a(e[t]);r++)t+=1;return t}consumeToken(e,t){return this.consumeOneOrMore(e,t,d)}consumeTime(e,t){let r=t;if("0"===e[r])return r+1;for(l(e[r])&&(r+=1);a(e[r]);)r++;if(r-t<10)throw new Error("Invalid time");return r}consumeAddress(e,t){return this.consumeTill(e,t,o)}consumeTypedTime(e,t){let r=t;return r=this.consumeOneOrMore(e,r,a),p(e[r])?r+1:r}consumeRepeatInterval(e,t){if(!l(e[t]))throw new Error("Invalid repeat interval");for(t+=1;a(e[t]);)t+=1;return p(e[t])&&(t+=1),t}consumePort(e,t){return this.consumeOneOrMore(e,t,a)}consume(e,t,r){for(let n=0;n<r.length;n++){if(t+n>=e.length)throw new Error("consume exceeding value length");if(e[t+n]!==r[n])throw new Error("consume ".concat(r," failed at ").concat(n))}return t+r.length}consumeTill(e,t,r){let n=t;for(;n<e.length&&("string"!=typeof r||e[n]!==r)&&("function"!=typeof r||!r(e[n]));)n++;return n}}class R extends y{constructor(){super(),S(this,"records",[]),S(this,"currentLine",0)}parse(e){const t=this.probeEOL(e);this.records=e.split(t).filter((e=>!!e.trim())).map(this.parseLine),this.currentLine=0;const r=this.parseVersion(),n=this.parseOrigin(),i=this.parseSessionName(),o=this.parseInformation(),s=this.parseUri(),a=this.parseEmail(),c=this.parsePhone(),u=this.parseConnection(),d=this.parseBandWidth(),l=this.parseTimeFields(),h=this.parseKey(),p=this.parseSessionAttribute(),f=this.parseMediaDescription();if(this.currentLine!==this.records.length)throw new Error("parsing failed, non exhaustive sdp lines.");return{version:r,origin:n,sessionName:i,information:o,uri:s,emails:a,phones:c,connection:u,bandwidths:d,timeFields:l,key:h,attributes:p,mediaDescriptions:f}}getCurrentRecord(){const e=this.records[this.currentLine];if(!e)throw new Error("Record doesn't exit.");return e}probeEOL(e){for(let t=0;t<e.length;t++)if(e[t]===n)return"\r"===e[t-1]?i:n;throw new Error("Invalid newline character.")}parseLine(e,t){if(e.length<2)throw new Error("Invalid sdp line, sdp line should be of form <type>=<value>.");const r=e[0];if("="!==e[1])throw new Error('Invalid sdp line, <type> should be a single character followed by an "=" sign.');return{type:r,value:e.slice(2),line:t,cur:0}}parseSessionAttribute(){const e=new A;for(;this.currentLine<this.records.length;){const t=this.getCurrentRecord();if(t.type!==s.ATTRIBUTE)break;const r={attField:this.extractOneOrMore(t,(e=>d(e)&&":"!==e)),_cur:0};":"===t.value[t.cur]&&(t.cur+=1,r.attValue=this.extractOneOrMore(t,f)),e.parse(r),this.currentLine++}return e.digest()}parseMediaAttributes(e){const t=new b(e);for(;this.currentLine<this.records.length;){const e=this.getCurrentRecord();if(e.type!==s.ATTRIBUTE)break;const r={attField:this.extractOneOrMore(e,(e=>d(e)&&":"!==e)),_cur:0};":"===e.value[e.cur]&&(e.cur+=1,r.attValue=this.extractOneOrMore(e,f)),t.parse(r),this.currentLine++}return t.digest()}parseKey(){const e=this.getCurrentRecord();if(e.type===s.KEY){if("prompt"===e.value||"clear:"===e.value||"base64:"===e.value||"uri:"===e.value)return e.value;throw this.currentLine++,new Error("Invalid key.")}}parseZone(){const e=this.getCurrentRecord();if(e.type===s.ZONE_ADJUSTMENTS){const t=[];for(;;)try{const r=this.extract(e,this.consumeTime);this.consumeSpaceForRecord(e);let n=!1;"-"===e.value[e.cur]&&(n=!0,e.cur+=1);const i=this.extract(e,this.consumeTypedTime);t.push({time:r,typedTime:i,back:n})}catch(e){break}if(0===t.length)throw new Error("Invalid zone adjustments");return this.currentLine++,t}return[]}parseRepeat(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.REPEAT)break;{const r=this.extract(t,this.consumeRepeatInterval),n=this.parseTypedTime(t);e.push({repeatInterval:r,typedTimes:n}),this.currentLine++}}return e}parseTypedTime(e){const t=[];for(;;)try{this.consumeSpaceForRecord(e),t.push(this.extract(e,this.consumeTypedTime))}catch(e){break}if(0===t.length)throw new Error("Invalid typed time.");return t}parseTime(){const e=this.getCurrentRecord(),t=this.extract(e,this.consumeTime);this.consumeSpaceForRecord(e);const r=this.extract(e,this.consumeTime);return this.currentLine++,{startTime:t,stopTime:r}}parseBandWidth(){const e=[];for(;this.currentLine<this.records.length;){const t=this.getCurrentRecord();if(t.type!==s.BANDWIDTH)break;{const r=this.extractOneOrMore(t,d);if(":"!==t.value[t.cur])throw new Error("Invalid bandwidth field.");t.cur++;const n=this.extractOneOrMore(t,a);e.push({bwtype:r,bandwidth:n}),this.currentLine++}}return e}parseVersion(){const e=this.getCurrentRecord();if(e.type!==s.VERSION)throw new Error("first sdp record must be version");const t=e.value.slice(0,this.consumeOneOrMore(e.value,0,a));if(t.length!==e.value.length)throw new Error('invalid proto version, "v='.concat(e.value,'"'));return this.currentLine++,t}parseOrigin(){const e=this.getCurrentRecord();if(e.type!==s.ORIGIN)throw new Error("second line of sdp must be origin");const t=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,a);this.consumeSpaceForRecord(e);const n=this.extractOneOrMore(e,a);this.consumeSpaceForRecord(e);const i=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const o=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const c=this.extract(e,this.consumeUnicastAddress);return this.currentLine++,{username:t,sessId:r,sessVersion:n,nettype:i,addrtype:o,unicastAddress:c}}parseSessionName(){const e=this.getCurrentRecord();if(e.type===s.SESSION_NAME){const t=this.extract(e,this.consumeText);return this.currentLine++,t}}parseInformation(){const e=this.getCurrentRecord();if(e.type!==s.INFORMATION)return;const t=this.extract(e,this.consumeText);return this.currentLine++,t}parseUri(){const e=this.getCurrentRecord();if(e.type===s.URI)return this.currentLine++,e.value}parseEmail(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.EMAIL)break;e.push(t.value),this.currentLine++}return e}parsePhone(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.PHONE)break;e.push(t.value),this.currentLine++}return e}parseConnection(){const e=this.getCurrentRecord();if(e.type===s.CONNECTION){const t=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const n=this.extract(e,this.consumeAddress);return this.currentLine++,{nettype:t,addrtype:r,address:n}}}parseMedia(){const e=this.getCurrentRecord(),t=this.extract(e,this.consumeToken);this.consumeSpaceForRecord(e);let r=this.extract(e,this.consumePort);"/"===e.value[e.cur]&&(e.cur+=1,r+=this.extract(e,this.consumeInteger)),this.consumeSpaceForRecord(e);const n=[];for(n.push(this.extract(e,this.consumeToken));"/"===e.value[e.cur];)e.cur+=1,n.push(this.extract(e,this.consumeToken));if(0===n.length)throw new Error("Invalid proto");const i=this.parseFmt(e);return this.currentLine++,{mediaType:t,port:r,protos:n,fmts:i}}parseTimeFields(){const e=[];for(;this.getCurrentRecord().type===s.TIME;){const t=this.parseTime(),r=this.parseRepeat(),n=this.parseZone();e.push({time:t,repeats:r,zones:n})}return e}parseMediaDescription(){const e=[];for(;this.currentLine<this.records.length&&this.getCurrentRecord().type===s.MEDIA;){const t=this.parseMedia(),r=this.parseInformation(),n=this.parseConnections(),i=this.parseBandWidth(),o=this.parseKey(),s=this.parseMediaAttributes(t);e.push({media:t,information:r,connections:n,bandwidths:i,key:o,attributes:s})}return e}parseConnections(){const e=[];for(;this.currentLine<this.records.length&&this.getCurrentRecord().type===s.CONNECTION;)e.push(this.parseConnection());return e}parseFmt(e){const t=[];for(;;)try{this.consumeSpaceForRecord(e),t.push(this.extract(e,this.consumeToken))}catch(e){break}if(0===t.length)throw new Error("Invalid fmts");return t}extract(e,t,...r){const n=t.call(this,e.value,e.cur,...r),i=e.value.slice(e.cur,n);return e.cur=n,i}extractOneOrMore(e,t){const r=this.consumeOneOrMore(e.value,e.cur,t),n=e.value.slice(e.cur,r);return e.cur=r,n}consumeSpaceForRecord(e){if(e.value[e.cur]!==o)throw new Error("Invalid space at ".concat(e.cur,"."));e.cur+=1}}class v extends y{constructor(...e){super(...e),S(this,"attributes",void 0),S(this,"digested",!1)}extractOneOrMore(e,t,r){const n=this.consumeOneOrMore(e.attValue,e._cur,t),i=e.attValue.slice(e._cur,n),[o,s]=r||[];if("number"==typeof o&&i.length<o)throw new Error("error in length, should be more or equal than ".concat(o," characters."));if("number"==typeof s&&i.length>s)throw new Error("error in length, should be less or equal than ".concat(s," characters."));return e._cur=n,i}consumeAttributeSpace(e){if(e.attValue[e._cur]!==o)throw new Error("Invalid space at ".concat(e._cur,"."));e._cur+=1}extract(e,t,...r){if(!e.attValue)throw new Error("Nothing to extract from attValue.");const n=t.call(this,e.attValue,e._cur,...r),i=e.attValue.slice(e._cur,n);return e._cur=n,i}atEnd(e){if(!e.attValue)throw new Error;return e._cur>=e.attValue.length}peekChar(e){if(!e.attValue)throw new Error;return e.attValue[e._cur]}peek(e,t){if(!e.attValue)throw new Error;for(let r=0;r<t.length;r++)if(t[r]!==e.attValue[e._cur+r])return!1;return!0}parseIceUfrag(e){if(this.attributes.iceUfrag)throw new Error("Invalid ice-ufrag, should be only a single line if 'a=ice-ufrag'");this.attributes.iceUfrag=this.extractOneOrMore(e,E,[4,256])}parseIcePwd(e){if(this.attributes.icePwd)throw new Error("Invalid ice-pwd, should be only a single line if 'a=ice-pwd'");this.attributes.icePwd=this.extractOneOrMore(e,E,[22,256])}parseIceOptions(e){if(this.attributes.iceOptions)throw new Error("Invalid ice-options, should be only one 'ice-options' line");const t=[];for(;!this.atEnd(e);){t.push(this.extractOneOrMore(e,E));try{this.consumeAttributeSpace(e)}catch(t){if(this.atEnd(e))break;throw t}}this.attributes.iceOptions=t}parseFingerprint(e){const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill);this.attributes.fingerprints.push({hashFunction:t,fingerprint:r})}parseExtmap(e){const t=this.extractOneOrMore(e,a);let r;"/"===this.peekChar(e)&&(this.extract(e,this.consume,"/"),r=this.extract(e,this.consumeToken)),this.consumeAttributeSpace(e);const n=this.extract(e,this.consumeTill,o),i=g(g({entry:parseInt(t,10)},r&&{direction:r}),{},{extensionName:n});this.peekChar(e)===o&&(this.consumeAttributeSpace(e),i.extensionAttributes=this.extract(e,this.consumeTill)),this.attributes.extmaps.push(i)}parseSetup(e){if(this.attributes.setup)throw new Error("must only be one single 'a=setup' line.");const t=this.extract(e,this.consumeTill);if("active"!==t&&"passive"!==t&&"actpass"!==t&&"holdconn"!==t)throw new Error("role must be one of 'active', 'passive', 'actpass', 'holdconn'.");this.attributes.setup=t}}class A extends v{constructor(...e){super(...e),S(this,"attributes",{unrecognized:[],groups:[],extmaps:[],fingerprints:[],identities:[]})}parse(e){if(this.digested)throw new Error("already digested");try{switch(e.attField){case"group":this.parseGroup(e);break;case"ice-lite":this.parseIceLite();break;case"ice-ufrag":this.parseIceUfrag(e);break;case"ice-pwd":this.parseIcePwd(e);break;case"ice-options":this.parseIceOptions(e);break;case"fingerprint":this.parseFingerprint(e);break;case"setup":this.parseSetup(e);break;case"tls-id":this.parseTlsId(e);break;case"identity":this.parseIdentity(e);break;case"extmap":this.parseExtmap(e);break;case"msid-semantic":this.parseMsidSemantic(e);break;default:e.ignored=!0,this.attributes.unrecognized.push(e)}}catch(t){throw console.error("parsing session attribute ".concat(e.attField,' error, "a=').concat(e.attField,":").concat(e.attValue,'"')),t}if(!e.ignored&&e.attValue&&!this.atEnd(e))throw new Error("attribute parsing error")}digest(){return this.digested=!0,this.attributes}parseGroup(e){const t=this.extract(e,this.consumeToken),r=[];for(;!this.atEnd(e)&&this.peekChar(e)===o;)this.consumeAttributeSpace(e),r.push(this.extract(e,this.consumeToken));this.attributes.groups.push({semantic:t,identificationTag:r})}parseIceLite(){if(this.attributes.iceLite)throw new Error("Invalid ice-lite, should be only a single line of 'a=ice-lite'");this.attributes.iceLite=!0}parseTlsId(e){if(this.attributes.tlsId)throw new Error("must be only one tld-id line");this.attributes.tlsId=this.extractOneOrMore(e,m)}parseIdentity(e){const t=this.extractOneOrMore(e,_),r=[];for(;!this.atEnd(e)&&this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.extract(e,this.consume,"=");const n=this.extractOneOrMore(e,(e=>e!==o&&f(e)));r.push({name:t,value:n})}this.attributes.identities.push({assertionValue:t,extensions:r})}parseMsidSemantic(e){this.peekChar(e)===o&&this.consumeAttributeSpace(e);const t={semantic:this.extract(e,this.consumeToken),identifierList:[]};for(;;){try{this.consumeAttributeSpace(e)}catch(e){break}if("*"===this.peekChar(e)){this.extract(e,this.consume,"*"),t.applyForAll=!0;break}{const r=this.extract(e,this.consumeTill,o);t.identifierList.push(r)}}this.attributes.msidSemantic=t}}class b extends v{constructor(e){super(),S(this,"attributes",void 0),-1!==e.protos.indexOf("RTP")||e.protos.indexOf("rtp"),this.attributes={unrecognized:[],candidates:[],extmaps:[],fingerprints:[],imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:[],ssrcGroups:[],rtcpFeedbackWildcards:[],payloads:[]}}parse(e){if(this.digested)throw new Error("already digested");try{switch(e.attField){case"extmap":this.parseExtmap(e);break;case"setup":this.parseSetup(e);break;case"ice-ufrag":this.parseIceUfrag(e);break;case"ice-pwd":this.parseIcePwd(e);break;case"ice-options":this.parseIceOptions(e);break;case"candidate":this.parseCandidate(e);break;case"remote-candidate":this.parseRemoteCandidate(e);break;case"end-of-candidates":this.parseEndOfCandidates();break;case"fingerprint":this.parseFingerprint(e);break;case"rtpmap":this.parseRtpmap(e);break;case"ptime":this.parsePtime(e);break;case"maxptime":this.parseMaxPtime(e);break;case"sendrecv":case"recvonly":case"sendonly":case"inactive":this.parseDirection(e);break;case"ssrc":this.parseSSRC(e);break;case"fmtp":this.parseFmtp(e);break;case"rtcp-fb":this.parseRtcpFb(e);break;case"rtcp-mux":this.parseRTCPMux();break;case"rtcp-mux-only":this.parseRTCPMuxOnly();break;case"rtcp-rsize":this.parseRTCPRsize();break;case"rtcp":this.parseRTCP(e);break;case"mid":this.parseMid(e);break;case"msid":this.parseMsid(e);break;case"imageattr":this.parseImageAttr(e);break;case"rid":this.parseRid(e);break;case"simulcast":this.parseSimulcast(e);break;case"sctp-port":this.parseSctpPort(e);break;case"max-message-size":this.parseMaxMessageSize(e);break;case"ssrc-group":this.parseSSRCGroup(e);break;default:e.ignored=!0,this.attributes.unrecognized.push(e)}}catch(t){throw console.error("parsing media attribute ".concat(e.attField,' error, "a=').concat(e.attField,":").concat(e.attValue,'"')),t}if(!e.ignored&&e.attValue&&!this.atEnd(e))throw new Error("attribute parsing error")}parseCandidate(e){const t=this.extractOneOrMore(e,E,[1,32]);this.consumeAttributeSpace(e);const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const n=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const i=this.extractOneOrMore(e,a,[1,10]);this.consumeAttributeSpace(e);const s=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const u=this.extract(e,this.consumePort);this.consumeAttributeSpace(e),this.extract(e,this.consume,"typ"),this.consumeAttributeSpace(e);const d={foundation:t,componentId:r,transport:n,priority:i,connectionAddress:s,port:u,type:this.extract(e,this.consumeToken),extension:{}};for(this.peek(e," raddr")&&(this.extract(e,this.consume," raddr"),this.consumeAttributeSpace(e),d.relAddr=this.extract(e,this.consumeAddress)),this.peek(e," rport")&&(this.extract(e,this.consume," rport"),this.consumeAttributeSpace(e),d.relPort=this.extract(e,this.consumePort));this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e),d.extension[t]=this.extractOneOrMore(e,c)}this.attributes.candidates.push(d)}parseRemoteCandidate(e){const t=[];for(;;){const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const n=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const i=this.extract(e,this.consumePort);t.push({componentId:r,connectionAddress:n,port:i});try{this.consumeAttributeSpace(e)}catch(e){break}}this.attributes.remoteCandidatesList.push(t)}parseEndOfCandidates(){if(this.attributes.endOfCandidates)throw new Error("must be only one line of end-of-candidates");this.attributes.endOfCandidates=!0}parseRtpmap(e){const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,"/");this.extract(e,this.consume,"/");const n={encodingName:r,clockRate:this.extractOneOrMore(e,a)};this.atEnd(e)||"/"!==this.peekChar(e)||(this.extract(e,this.consume,"/"),n.encodingParameters=parseInt(this.extract(e,this.consumeTill),10));const i=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));i?i.rtpMap=n:this.attributes.payloads.push({payloadType:parseInt(t,10),rtpMap:n,rtcpFeedbacks:[]})}parsePtime(e){if(this.attributes.ptime)throw new Error("must be only one line of ptime");this.attributes.ptime=this.extract(e,this.consumeTill)}parseMaxPtime(e){if(this.attributes.maxPtime)throw new Error("must be only one line of ptime");this.attributes.maxPtime=this.extract(e,this.consumeTill)}parseDirection(e){if(this.attributes.direction)throw new Error("must be only one line of direction info");this.attributes.direction=e.attField}parseSSRC(e){const t=this.extractOneOrMore(e,a);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,":");let n;":"===this.peekChar(e)&&(this.extract(e,this.consume,":"),n=this.extract(e,this.consumeTill));const i=this.attributes.ssrcs.find((e=>e.ssrcId===parseInt(t,10)));i?i.attributes[r]=n:this.attributes.ssrcs.push({ssrcId:parseInt(t,10),attributes:{[r]:n}})}parseFmtp(e){const t=this.extract(e,this.consumeTill,o);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill),n={};r.split(";").forEach((e=>{let[t,r]=e.split("=");t=t.trim();const i="string"==typeof r?r.trim():null;"string"==typeof t&&t.length>0&&(n[t]=i)}));const i=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));i?i.fmtp={parameters:n}:this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[],fmtp:{parameters:n}})}parseFmtParameters(e){const t={},r=this.extract(e,this.consumeTill,"=");e._cur++;const n=this.extract(e,this.consumeTill,";");for(t[r]=n;";"===e.attValue[e._cur];){const r=this.extract(e,this.consumeTill,"=");e._cur++;const n=this.extract(e,this.consumeTill,";");t[r]=n}return t}parseRtcpFb(e){let t="";t="*"===this.peekChar(e)?this.extract(e,this.consume,"*"):this.extract(e,this.consumeTill,o),this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,o);let n;if("trr-int"===r)n={type:r,interval:this.extract(e,this.consumeTill)};else{const t={type:r};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.parameter=this.extract(e,this.consumeToken),this.peekChar(e)===o&&(t.additional=this.extract(e,this.consumeTill))),n=t}if("*"===t)this.attributes.rtcpFeedbackWildcards.push(n);else{const e=this.attributes.payloads.find((e=>e.payloadType===parseInt(t,10)));e?e.rtcpFeedbacks.push(n):this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[n]})}}parseRTCPMux(){if(this.attributes.rtcpMux)throw new Error("must be single line of rtcp-mux");this.attributes.rtcpMux=!0}parseRTCPMuxOnly(){if(this.attributes.rtcpMuxOnly)throw new Error("must be single line of rtcp-only");this.attributes.rtcpMuxOnly=!0}parseRTCPRsize(){if(this.attributes.rtcpRsize)throw new Error("must be single line of rtcp-rsize");this.attributes.rtcpRsize=!0}parseRTCP(e){if(this.attributes.rtcp)throw new Error("must be single line of rtcp");const t={port:this.extract(e,this.consumePort)};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.netType=this.extractOneOrMore(e,d),this.consumeAttributeSpace(e),t.addressType=this.extractOneOrMore(e,d),this.consumeAttributeSpace(e),t.address=this.extract(e,this.consumeAddress)),this.attributes.rtcp=t}parseMsid(e){const t={id:this.extractOneOrMore(e,d,[1,64])};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.appdata=this.extractOneOrMore(e,d,[1,64])),this.attributes.msids.push(t)}parseImageAttr(e){this.attributes.imageattr.push(e.attValue)}parseRid(e){const t=this.extractOneOrMore(e,(e=>h(e)||a(e)||"_"===e||"-"===e));this.consumeAttributeSpace(e);const r={id:t,direction:this.extract(e,this.consumeToken),params:[]};if(this.peekChar(e)===o){if(this.consumeAttributeSpace(e),this.peek(e,"pt=")){this.extract(e,this.consume,"pt=");const t=[];for(;;){const r=this.extract(e,this.consumeToken);t.push(r);try{this.extract(e,this.consume,",")}catch(e){break}}r.payloads=t,this.peekChar(e)===o&&this.extract(e,this.consume,o)}for(;;){const t=this.extract(e,this.consumeToken);switch(t){case"depend":{const n={type:t,rids:this.extract(e,this.consume,"=").split(",")};r.params.push(n);break}default:{const n={type:t};"="===this.peekChar(e)&&(this.extract(e,this.consume,"="),n.val=this.extract(e,this.consumeTill,";")),r.params.push(n)}}try{this.extract(e,this.consume,";")}catch(e){break}}}this.attributes.rids.push(r)}parseSimulcast(e){if(this.attributes.simulcast)throw new Error("must be single line of simulcast");this.attributes.simulcast=e.attValue,this.extract(e,this.consumeTill)}parseSctpPort(e){this.attributes.sctpPort=this.extractOneOrMore(e,a,[1,5])}parseMaxMessageSize(e){this.attributes.maxMessageSize=this.extractOneOrMore(e,a,[1,void 0])}digest(){return this.digested=!0,this.attributes}parseMid(e){this.attributes.mid=this.extract(e,this.consumeToken)}parseSSRCGroup(e){const t=this.extract(e,this.consumeToken),r=[];for(;;)try{this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeInteger);r.push(parseInt(t,10))}catch(e){break}this.attributes.ssrcGroups.push({semantic:t,ssrcIds:r})}}function O(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class I{constructor(){O(this,"eol",i)}print(e,t){let r="";return t&&(this.eol=t),r+=this.printVersion(e.version),r+=this.printOrigin(e.origin),r+=this.printSessionName(e.sessionName),r+=this.printInformation(e.information),r+=this.printUri(e.uri),r+=this.printEmail(e.emails),r+=this.printPhone(e.phones),r+=this.printConnection(e.connection),r+=this.printBandwidth(e.bandwidths),r+=this.printTimeFields(e.timeFields),r+=this.printKey(e.key),r+=this.printSessionAttributes(e.attributes),r+=this.printMediaDescription(e.mediaDescriptions),r}printVersion(e){return"v=".concat(e).concat(this.eol)}printOrigin(e){return"o=".concat(e.username," ").concat(e.sessId," ").concat(e.sessVersion," ").concat(e.nettype," ").concat(e.addrtype," ").concat(e.unicastAddress).concat(this.eol)}printSessionName(e){return e?"s=".concat(e).concat(this.eol):""}printInformation(e){return e?"i=".concat(e).concat(this.eol):""}printUri(e){return e?"u=".concat(e).concat(this.eol):""}printEmail(e){let t="";for(const r of e)t+="e=".concat(r).concat(this.eol);return t}printPhone(e){let t="";for(const r of e)t+="e=".concat(r).concat(this.eol);return t}printConnection(e){return e?"c=".concat(e.nettype," ").concat(e.addrtype," ").concat(e.address).concat(this.eol):""}printBandwidth(e){let t="";for(const r of e)t+="b=".concat(r.bwtype,":").concat(r.bandwidth).concat(this.eol);return t}printTimeFields(e){let t="";for(const r of e){t+="t=".concat(r.time.startTime," ").concat(r.time.startTime).concat(this.eol);for(const e of r.repeats)t+="r=".concat(e.repeatInterval," ").concat(e.typedTimes.join(" ")).concat(this.eol);r.zoneAdjustments&&(t+="z=",t+="z=".concat(r.zoneAdjustments.map((e=>"".concat(e.time," ").concat(e.back?"-":""," ").concat(e.typedTime))).join(" ")).concat(this.eol),t+=this.eol)}return t}printKey(e){return e?"k=".concat(e).concat(this.eol):""}printAttributes(e){let t="";for(const r of e)t+="a=".concat(r.attField).concat(r.attValue?":".concat(r.attValue):"").concat(this.eol);return t}printMediaDescription(e){let t="";for(const r of e)t+=this.printMedia(r.media),t+=this.printInformation(r.information),t+=this.printConnections(r.connections),t+=this.printBandwidth(r.bandwidths),t+=this.printKey(r.key),t+=this.printMediaAttributes(r);return t}printConnections(e){let t="";for(const r of e)t+=this.printConnection(r);return t}printMedia(e){return"m=".concat(e.mediaType," ").concat(e.port," ").concat(e.protos.join("/")," ").concat(e.fmts.join(" ")).concat(this.eol)}printSessionAttributes(e){return new w(this.eol).print(e)}printMediaAttributes(e){return new N(this.eol).print(e)}}class C{constructor(e){O(this,"eol",void 0),this.eol=e}printIceUfrag(e){return void 0===e?"":"a=ice-ufrag:".concat(e).concat(this.eol)}printIcePwd(e){return void 0===e?"":"a=ice-pwd:".concat(e).concat(this.eol)}printIceOptions(e){return void 0===e?"":"a=ice-options:".concat(e.join(o)).concat(this.eol)}printFingerprints(e){return e.length>0?e.map((e=>"a=fingerprint:".concat(e.hashFunction).concat(o).concat(e.fingerprint))).join(this.eol)+this.eol:""}printExtmap(e){return e.map((e=>"a=extmap:".concat(e.entry).concat(e.direction?"/".concat(e.direction):"").concat(o).concat(e.extensionName).concat(e.extensionAttributes?"".concat(o).concat(e.extensionAttributes):"").concat(this.eol))).join("")}printSetup(e){return void 0===e?"":"a=setup:".concat(e).concat(this.eol)}printUnrecognized(e){return e.map((e=>"a=".concat(e.attField).concat(e.attValue?":".concat(e.attValue):"").concat(this.eol))).join("")}}class w extends C{print(e){let t="";return t+=this.printGroups(e.groups),t+=this.printMsidSemantic(e.msidSemantic),t+=this.printIceLite(e.iceLite),t+=this.printIceUfrag(e.iceUfrag),t+=this.printIcePwd(e.icePwd),t+=this.printIceOptions(e.iceOptions),t+=this.printFingerprints(e.fingerprints),t+=this.printSetup(e.setup),t+=this.printTlsId(e.tlsId),t+=this.printIdentity(e.identities),t+=this.printExtmap(e.extmaps),t+=this.printUnrecognized(e.unrecognized),t}printGroups(e){let t="";return e.length>0&&(t+=e.map((e=>"a=group:".concat(e.semantic).concat(e.identificationTag.map((e=>"".concat(o).concat(e))).join("")).concat(this.eol))).join("")),t}printIceLite(e){return void 0===e?"":"a=ice-lite"+this.eol}printTlsId(e){return e?"a=tls-id:".concat(e).concat(this.eol):""}printIdentity(e){return 0===e.length?"":e.map((e=>"a=identity:".concat(e.assertionValue).concat(e.extensions.map((e=>"".concat(o).concat(e.name).concat(e.value?"=".concat(e.value):"")))))).join(this.eol)+this.eol}printMsidSemantic(e){if(!e)return"";let t="a=msid-semantic:".concat(e.semantic);return e.applyForAll?t+="".concat(o,"*"):e.identifierList.length>0&&(t+=e.identifierList.map((e=>"".concat(o).concat(e)))),t+this.eol}}class N extends C{print(e){const t=e.attributes;let r="";return r+=this.printRTCP(t.rtcp),r+=this.printIceUfrag(t.iceUfrag),r+=this.printIcePwd(t.icePwd),r+=this.printIceOptions(t.iceOptions),r+=this.printCandidates(t.candidates),r+=this.printRemoteCandidatesList(t.remoteCandidatesList),r+=this.printEndOfCandidates(t.endOfCandidates),r+=this.printFingerprints(t.fingerprints),r+=this.printSetup(t.setup),r+=this.printMid(t.mid),r+=this.printExtmap(t.extmaps),r+=this.printRTPRelated(t),r+=this.printPtime(t.ptime),r+=this.printMaxPtime(t.maxPtime),r+=this.printDirection(t.direction),r+=this.printSSRCGroups(t.ssrcGroups),r+=this.printSSRC(t.ssrcs),r+=this.printRTCPMux(t.rtcpMux),r+=this.printRTCPMuxOnly(t.rtcpMuxOnly),r+=this.printRTCPRsize(t.rtcpRsize),r+=this.printMSId(t.msids),r+=this.printImageattr(t.imageattr),r+=this.printRid(t.rids),r+=this.printSimulcast(t.simulcast),r+=this.printSCTPPort(t.sctpPort),r+=this.printMaxMessageSize(t.maxMessageSize),r+=this.printUnrecognized(t.unrecognized),r}printCandidates(e){return e.map((e=>"a=candidate:".concat(e.foundation).concat(o).concat(e.componentId).concat(o).concat(e.transport).concat(o).concat(e.priority).concat(o).concat(e.connectionAddress).concat(o).concat(e.port).concat(o,"typ").concat(o).concat(e.type).concat(e.relAddr?"".concat(o,"raddr").concat(o).concat(e.relAddr):"").concat(e.relPort?"".concat(o,"rport").concat(o).concat(e.relPort):"").concat(Object.keys(e.extension).map((t=>"".concat(o).concat(t).concat(o).concat(e.extension[t]))).join("")).concat(this.eol))).join("")}printRemoteCandidatesList(e){return e.map((e=>"a=remote-candidates:".concat(e.join(o)).concat(this.eol))).join("")}printEndOfCandidates(e){return void 0===e?"":"a=end-of-candidates"+this.eol}printRTPRelated(e){if(!e.payloads)return"";const t=e.payloads;let r="";r+=e.rtcpFeedbackWildcards.map((e=>this.printRTCPFeedback("*",e))).join("");for(const e of t)r+=this.printRtpMap(e.payloadType,e.rtpMap),r+=this.printFmtp(e.payloadType,e.fmtp),r+=e.rtcpFeedbacks.map((t=>this.printRTCPFeedback(e.payloadType,t))).join("");return r}printFmtp(e,t){if(!t)return"";const r=Object.keys(t.parameters);return 1===r.length&&null===t.parameters[r[0]]?"a=fmtp:".concat(e).concat(o).concat(r[0]).concat(this.eol):"a=fmtp:".concat(e).concat(o).concat(Object.keys(t.parameters).map((e=>"".concat(e,"=").concat(t.parameters[e]))).join(";")).concat(this.eol)}printRtpMap(e,t){return t?"a=rtpmap:".concat(e).concat(o).concat(t.encodingName,"/").concat(t.clockRate).concat(t.encodingParameters?"/".concat(t.encodingParameters):"").concat(this.eol):""}printRTCPFeedback(e,t){let r="a=rtcp-fb:".concat(e).concat(o),n=t;return"trr-int"===n.type?r+="ttr-int".concat(o).concat(n.interval):(r+="".concat(n.type),n.parameter&&(r+="".concat(o).concat(n.parameter),n.additional&&(r+="".concat(o).concat(n.additional)))),r+this.eol}printPtime(e){return void 0===e?"":"a=ptime:".concat(e).concat(this.eol)}printMaxPtime(e){return void 0===e?"":"a=maxptime:".concat(e).concat(this.eol)}printDirection(e){return void 0===e?"":"a=".concat(e).concat(this.eol)}printSSRC(e){return e.map((e=>Object.keys(e.attributes).map((t=>"a=ssrc:".concat(e.ssrcId.toString(10)).concat(o).concat(t).concat(e.attributes[t]?":".concat(e.attributes[t]):"").concat(this.eol))).join(""))).join("")}printRTCPMux(e){return void 0===e?"":"a=rtcp-mux".concat(this.eol)}printRTCPMuxOnly(e){return void 0===e?"":"a=rtcp-mux-only".concat(this.eol)}printRTCPRsize(e){return void 0===e?"":"a=rtcp-rsize".concat(this.eol)}printRTCP(e){if(void 0===e)return"";let t="a=rtcp:".concat(e.port);return e.netType&&(t+="".concat(o).concat(e.netType)),e.addressType&&(t+="".concat(o).concat(e.addressType)),e.address&&(t+="".concat(o).concat(e.address)),t+this.eol}printMSId(e){return e.map((e=>"a=msid:".concat(e.id).concat(e.appdata?"".concat(o).concat(e.appdata):"").concat(this.eol))).join("")}printImageattr(e){return e.map((e=>"a=imageattr:".concat(e).concat(this.eol))).join("")}printRid(e){return e.map((e=>{let t="a=rid:".concat(e.id).concat(o).concat(e.direction);return e.payloads&&(t+="".concat(o,"pt=").concat(e.payloads.join(","))),e.params.length>0&&(t+="".concat(o).concat(e.params.map((e=>"depend"===e.type?"depend=".concat(e.rids.join(",")):"".concat(e.type,"=").concat(e.val))).join(";"))),t+this.eol})).join("")}printSimulcast(e){return void 0===e?"":"a=simulcast:".concat(e).concat(this.eol)}printSCTPPort(e){return void 0===e?"":"a=sctp-port:".concat(e).concat(this.eol)}printMaxMessageSize(e){return void 0===e?"":"a=max-message-size:".concat(e).concat(this.eol)}printMid(e){return void 0===e?"":"a=mid:".concat(e).concat(this.eol)}printSSRCGroups(e){return e.map((e=>"a=ssrc-group:".concat(e.semantic).concat(e.ssrcIds.map((e=>"".concat(o).concat(e.toString(10)))).join("")).concat(this.eol))).join("")}}function P(e){return(new R).parse(e)}function D(e,t){return(new I).print(e,t)}}},t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(8)})();const ho=new class extends ii{constructor(){super(...arguments),oo(this,"currentUploadLogID",0)}reportLogUploadError(e){const t=e.errorRange;t[t.length-1]&&t[t.length-1]>this.currentUploadLogID&&(this.currentUploadLogID=t[t.length-1],this.emit("REPORT_LOG_UPLOAD",e))}};class po{constructor(e){oo(this,"logger",void 0),oo(this,"prefixLists",[]),this.logger=e}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.debug(...this.prefixLists,...t)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.info(...this.prefixLists,...t)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.warning(...this.prefixLists,...t)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.error(...this.prefixLists,...t)}prefix(e){return this.prefixLists.push(e),this}popPrefix(){return this.prefixLists.pop(),this}}function fo(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}function Eo(){const e=new Date,t=/((\d+:){2}\d+)/.exec((new Date).toUTCString());return t?(null==t?void 0:t[0])+":"+e.getUTCMilliseconds():e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}const mo={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},_o=Date.now(),To=e=>{for(const t in mo)if(Object.prototype.hasOwnProperty.call(mo,t)&&mo[t]===e)return t;return"DEFAULT"};const go=new class{constructor(){oo(this,"proxyServerURL",void 0),oo(this,"logLevel",mo.DEBUG),oo(this,"uploadState","collecting"),oo(this,"uploadStartTimer",void 0),oo(this,"uploadLogWaitingList",[]),oo(this,"uploadLogUploadingList",[]),oo(this,"uploadErrorCount",0),oo(this,"currentLogID",0),oo(this,"url",void 0),oo(this,"extLog",((e,t)=>{this.appendLogToWaitingList(e,...t)}))}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[mo.DEBUG].concat(t);this.log.apply(this,n)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[mo.INFO].concat(t);this.log.apply(this,n)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[mo.WARNING].concat(t);this.log.apply(this,n)}warn(){this.warning(...arguments)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[mo.ERROR].concat(t);this.log.apply(this,n)}upload(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[mo.DEBUG].concat(t);this.uploadLog.apply(this,n)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){eo("UPLOAD_LOG",!0)}disableLogUpload(){eo("UPLOAD_LOG",!1),this.uploadState="collecting",void 0!==this.uploadStartTimer&&(window.clearTimeout(this.uploadStartTimer),this.uploadStartTimer=void 0),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new po(this).prefix(e)}log(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Date.now()-_o<100)return void setTimeout((()=>{this.log(...t)}),Date.now()-_o);const n=Math.max(0,Math.min(4,t[0]));if(t[0]=fo()+" Agora-SDK [".concat(To(n),"]:"),this.appendLogToWaitingList(n,...t),n<this.logLevel)return;const i=fo()+" %cAgora-SDK [".concat(To(n),"]:");let o=[];if(!to("USE_NEW_LOG"))switch(n){case mo.DEBUG:o=[i,"color: #64B5F6;"].concat(t.slice(1)),console.log.apply(console,o);break;case mo.INFO:o=[i,"color: #1E88E5; font-weight: bold;"].concat(t.slice(1)),console.log.apply(console,o);break;case mo.WARNING:o=[i,"color: #FB8C00; font-weight: bold;"].concat(t.slice(1)),console.warn.apply(console,o);break;case mo.ERROR:o=[i,"color: #B00020; font-weight: bold;"].concat(t.slice(1)),console.error.apply(console,o)}}uploadLog(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Date.now()-_o<100)return void setTimeout((()=>{this.uploadLog(...t)}),Date.now()-_o);const n=Math.max(0,Math.min(4,t[0]));t[0]=fo()+" Agora-SDK [".concat(To(n),"]:"),this.appendLogToWaitingList(n,...t)}appendLogToWaitingList(e){if(!to("UPLOAD_LOG"))return;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];Array.isArray(r[0])?r[0][0]=Eo()+" Agora-SDK [".concat(To(e),"]:"):r[0]=Eo()+" Agora-SDK [".concat(To(e),"]:");let i="";r.forEach((e=>{"object"==typeof e&&(e=JSON.stringify(e)),i+="".concat(e," ")})),this.uploadLogWaitingList.push({payload_str:i,log_level:e,log_item_id:this.currentLogID++}),"uploading"===this.uploadState&&0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}startUpload(){this.uploadState="uploading",void 0!==this.uploadStartTimer&&(window.clearTimeout(this.uploadStartTimer),this.uploadStartTimer=void 0),0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}scheduleUploadStart(){"uploading"!==this.uploadState&&void 0===this.uploadStartTimer&&(this.uploadStartTimer=window.setTimeout((()=>{this.uploadStartTimer=void 0,to("UPLOAD_LOG")&&this.startUpload()}),5e3))}async uploadLogs(){const e=this.uploadLogUploadingList,t={sdk_version:Ji,process_id:to("PROCESS_ID"),payload:JSON.stringify(e)};return Wi((async()=>{const e=await ln.post(this.url||(this.proxyServerURL?"https://".concat(this.proxyServerURL,"/ls/?h=").concat(to("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(to("LOG_UPLOAD_SERVER"),"/upload/v1")),t,{responseType:"text"});if("OK"!==e.data){const t=new Error("unexpected upload log response");throw t.response=e,t}}),(()=>(this.uploadLogUploadingList=[],!1)),(t=>{const r={status:-1,message:t.message,errorRange:e.map((e=>e.log_item_id))};return t.response?(r.status=t.response.status,r.data=t.response.data,r.headers=t.response.headers):t.request&&(r.status=t.request.status),ho.reportLogUploadError(r),!0}),{timeout:to("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:to("UPLOAD_LOG_REQUEST_MAX_RETRY_INTERVAL")})}uploadLogInterval(){0===this.uploadLogUploadingList.length&&0===this.uploadLogWaitingList.length||(0===this.uploadLogUploadingList.length&&(this.uploadLogUploadingList=this.uploadLogWaitingList.splice(0,to("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),to("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),to("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),to("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}};var So;(So={}).FREE="free",So.UPLOADING="uploading",function(e){e[e.MISC=0]="MISC",e[e.INTERNAL_EVENT=1]="INTERNAL_EVENT",e[e.PUBLIC_EVENT=2]="PUBLIC_EVENT",e[e.WEB_EVENT=3]="WEB_EVENT",e[e.INTERNAL_API=4]="INTERNAL_API",e[e.WEB_API=5]="WEB_API",e[e.PUBLIC_API=6]="PUBLIC_API"}({});let yo=function(e){return e[e.RECOVER=0]="RECOVER",e[e.WARNING=1]="WARNING",e[e.ERROR=2]="ERROR",e}({}),Ro=function(e){return e.CONFIG_DISTRIBUTE="config-distribute-error",e}({});const vo={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};let Ao=function(e){return e.PUBLISH="publish",e.SUBSCRIBE="subscribe",e.WS_COMPRESSOR_INIT="ws_compressor_init",e.SESSION_INIT="session_init",e.JOIN_CHOOSE_SERVER="join_choose_server",e.RTE_DETAIL="rte_detail_stats",e.REQ_USER_ACCOUNT="req_user_account",e.JOIN_GATEWAY="join_gateway",e.REJOIN_GATEWAY="rejoin_gateway",e.STREAM_SWITCH="stream_switch",e.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",e.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",e.FIRST_VIDEO_RECEIVED="first_video_received",e.FIRST_AUDIO_RECEIVED="first_audio_received",e.FIRST_VIDEO_DECODE="first_video_decode",e.FIRST_AUDIO_DECODE="first_audio_decode",e.XLA_PEER_FIRST_VIDEO_FRAME="xla_peer_first_video_frame",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_UPDATE_STREAM="on_update_stream",e.ON_REMOVE_STREAM="on_remove_stream",e.USER_ANALYTICS="req_user_analytics",e.PC_STATS="pc_stats",e.UPDATE_REMOTE_RTPCAPABILITIES="update_remote_rtpCapabilities",e.AB_TEST="ab_test",e.ALARM_STATUS_NOTIFY="alarm_status_notify",e}({}),bo=function(e){return e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",e.RTE_DETAIL="io.agora.pb.Wrtc.RteDetailStats",e.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",e.JOIN_GATEWAY="io.agora.pb.Wrtc.JoinGateway",e.RE_JOIN_GATEWAY="io.agora.pb.Wrtc.ReJoinGateway",e.PUBLISH="io.agora.pb.Wrtc.Publish",e.SUBSCRIBE="io.agora.pb.Wrtc.Subscribe",e.WS_COMPRESSOR_INIT="io.agora.pb.Wrtc.WsCompressorInit",e.STREAM_SWITCH="io.agora.pb.Wrtc.StreamSwitch",e.AUDIO_SENDING_STOPPED="io.agora.pb.Wrtc.AudioSendingStopped",e.VIDEO_SENDING_STOPPED="io.agora.pb.Wrtc.VideoSendingStopped",e.REQUEST_PROXY_APPCENTER="io.agora.pb.Wrtc.RequestProxyAppCenter",e.REQUEST_PROXY_WORKER_MANAGER="io.agora.pb.Wrtc.RequestProxyWorkerManager",e.API_INVOKE="io.agora.pb.Wrtc.ApiInvoke",e.FIRST_VIDEO_RECEIVED="io.agora.pb.Wrtc.FirstVideoReceived",e.FIRST_AUDIO_RECEIVED="io.agora.pb.Wrtc.FirstAudioReceived",e.FIRST_VIDEO_DECODE="io.agora.pb.Wrtc.FirstVideoDecode",e.FIRST_AUDIO_DECODE="io.agora.pb.Wrtc.FirstAudioDecode",e.XLA_PEER_FIRST_VIDEO_FRAME="io.agora.pb.Wrtc.XLAPeerFirstVideoFrame",e.ON_ADD_AUDIO_STREAM="io.agora.pb.Wrtc.OnAddAudioStream",e.ON_ADD_VIDEO_STREAM="io.agora.pb.Wrtc.OnAddVideoStream",e.ON_UPDATE_STREAM="io.agora.pb.Wrtc.OnUpdateStream",e.ON_REMOVE_STREAM="io.agora.pb.Wrtc.OnRemoveStream",e.JOIN_CHANNEL_TIMEOUT="io.agora.pb.Wrtc.JoinChannelTimeout",e.PEER_PUBLISH_STATUS="io.agora.pb.Wrtc.PeerPublishStatus",e.WORKER_EVENT="io.agora.pb.Wrtc.WorkerEvent",e.AP_WORKER_EVENT="io.agora.pb.Wrtc.APWorkerEvent",e.JOIN_WEB_PROXY_AP="io.agora.pb.Wrtc.JoinWebProxyAP",e.WEBSOCKET_QUIT="io.agora.pb.Wrtc.WebSocketQuit",e.USER_ANALYTICS="io.agora.pb.Wrtc.UserAnalytics",e.AUTOPLAY_FAILED="io.agora.pb.Wrtc.AutoplayFailed",e.PC_STATS="io.agora.pb.Wrtc.PCStats",e.UPDATE_REMOTE_RTPCAPABILITIES="io.agora.pb.Wrtc.UpdateRemoteRTPCapabilities",e.AB_TEST="io.agora.pb.Wrtc.ABTest",e.ALARM_STATUS_NOTIFY="io.agora.pb.Wrtc.AlarmStatusNotify",e}({});!function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}({});let Oo=function(e){return e[e.SESSION=26]="SESSION",e[e.JOIN_CHOOSE_SERVER=27]="JOIN_CHOOSE_SERVER",e[e.REQ_USER_ACCOUNT=196]="REQ_USER_ACCOUNT",e[e.JOIN_GATEWAY=28]="JOIN_GATEWAY",e[e.PUBLISH=30]="PUBLISH",e[e.SUBSCRIBE=29]="SUBSCRIBE",e[e.WS_COMPRESSOR_INIT=9430]="WS_COMPRESSOR_INIT",e[e.STREAM_SWITCH=32]="STREAM_SWITCH",e[e.AUDIO_SENDING_STOPPED=33]="AUDIO_SENDING_STOPPED",e[e.VIDEO_SENDING_STOPPED=34]="VIDEO_SENDING_STOPPED",e[e.REQUEST_PROXY_APPCENTER=35]="REQUEST_PROXY_APPCENTER",e[e.REQUEST_PROXY_WORKER_MANAGER=36]="REQUEST_PROXY_WORKER_MANAGER",e[e.API_INVOKE=41]="API_INVOKE",e[e.FIRST_VIDEO_RECEIVED=348]="FIRST_VIDEO_RECEIVED",e[e.FIRST_AUDIO_RECEIVED=349]="FIRST_AUDIO_RECEIVED",e[e.FIRST_VIDEO_DECODE=350]="FIRST_VIDEO_DECODE",e[e.FIRST_AUDIO_DECODE=351]="FIRST_AUDIO_DECODE",e[e.ON_ADD_AUDIO_STREAM=352]="ON_ADD_AUDIO_STREAM",e[e.ON_ADD_VIDEO_STREAM=353]="ON_ADD_VIDEO_STREAM",e[e.ON_UPDATE_STREAM=356]="ON_UPDATE_STREAM",e[e.ON_REMOVE_STREAM=355]="ON_REMOVE_STREAM",e[e.JOIN_CHANNEL_TIMEOUT=407]="JOIN_CHANNEL_TIMEOUT",e[e.PEER_PUBLISH_STATUS=408]="PEER_PUBLISH_STATUS",e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT",e[e.JOIN_WEB_PROXY_AP=700]="JOIN_WEB_PROXY_AP",e[e.WEBSOCKET_QUIT=671]="WEBSOCKET_QUIT",e[e.USER_ANALYTICS=1e4]="USER_ANALYTICS",e[e.AUTOPLAY_FAILED=9178]="AUTOPLAY_FAILED",e}({});const Io="[config-restore]",Co="websdk_ng_",wo=Co+"blocked_config_hashes",No=Co+"api_failure_records",Po=Co+"global_parameter",Do=Co+"config_restore_state";function Lo(){try{const e=window.localStorage.getItem(Do);if(e)return JSON.parse(e)}catch(e){}return{currentConfigHash:"",configVerified:!1}}function ko(){try{const e=window.localStorage.getItem(No);return e?JSON.parse(e):[]}catch(e){return go.debug("[error] ".concat(Io," error getting API failure records:"),e),[]}}function Mo(){return ko().reduce(((e,t)=>e+t.count),0)}function Uo(){try{const e=Mo(),t=to("MAX_CONFIG_RETRY");if(e<t)return;const r=Lo().currentConfigHash;go.debug("[warning] ".concat(Io," restoring config due to ").concat(e," API failures")),r&&function(e){try{const t=window.localStorage.getItem(wo);let r=[];t&&(r=JSON.parse(t).configHashes);const n=[...new Set([...r,e])];window.localStorage.setItem(wo,JSON.stringify({configHashes:n,timestamp:Date.now()})),go.debug("[warning] ".concat(Io," blocked config hash: ").concat(e))}catch(e){go.debug("[error] ".concat(Io," error blocking config hash:"),e)}}(r),window.localStorage.removeItem(Po);const n=ko().slice(-5);(function(e,t){Bo.reportAlarm(e,t)})(null,{status:yo.ERROR,type:Ro.CONFIG_DISTRIBUTE,message:"Config cache cleared due to API failures",extend:{failureCount:e,maxRetry:t,blockedConfigHash:r,recentFailures:n.map((e=>({api:e.apiName,error:e.errorCode||e.errorMessage,count:e.count,lastTime:e.lastTimestamp})))}}),function(){try{window.localStorage.removeItem(No)}catch(e){go.debug("[error] ".concat(Io," error clearing API failure records:"),e)}}()}catch(e){go.debug("[error] ".concat(Io," error restoring config:"),e)}}function xo(e,t){try{if(!to("ENABLE_CONFIG_RESTORE"))return;if(t&&"AgoraRTCException"===t.name){const e=to("CONFIG_ERROR_MONITOR");if(!Array.isArray(e)||!e.includes(t.code))return}const r=window.localStorage.getItem(Po);if(!r||r.length<20)return;if(Lo().configVerified)return;const n=to("CONFIG_RESTORE_ERROR_API");if(!Array.isArray(n)||!n.includes(e))return;let i,o;t&&(t.code&&(i=t.code),o=t.message?t.message:"string"==typeof t?t:t.toString()),function(e,t,r){try{const n=ko(),i="".concat(e,":").concat(t||""),o=n.find((e=>"".concat(e.apiName,":").concat(e.errorCode||"")===i)),s=Lo().currentConfigHash;if(o)o.count++,o.lastTimestamp=Date.now(),r&&(o.errorMessage=r),s&&(o.configHash=s);else{const i=Date.now();n.push({apiName:e,errorCode:t,errorMessage:r,count:1,firstTimestamp:i,lastTimestamp:i,configHash:s||void 0})}const a=n.length>20?n.slice(-20):n;window.localStorage.setItem(No,JSON.stringify(a))}catch(e){go.debug("[error] ".concat(Io," error saving API failure record:"),e)}}(e,i,o);const s=Mo(),a=to("MAX_CONFIG_RETRY");go.debug("".concat(Io," API failure count: ").concat(s,"/").concat(a,", API: ").concat(e,", Error: ").concat(i||o)),s>=a&&Uo()}catch(e){}}function Vo(e,t){try{return JSON.stringify(e)}catch(e){return void go.warning("[report] failed to serialize ApiInvoke.".concat(t,": ").concat(e instanceof Error?e.message:String(e)))}}function Fo(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,r,n){const i=n.value;if("function"==typeof i){const o=e.className||t.__className__||("AgoraRTCClient"===t.constructor.name?"Client":t.constructor.name);n.value=function(){for(var t,n,s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];let u=a;if(e.argsMap)try{u=e.argsMap(this,...a)}catch(e){go.warning(e),u=[]}try{JSON.stringify(u)}catch(e){go.warning("arguments for method ".concat(o,".").concat(String(r)," not serializable for apiInvoke.")),u=[]}const d=(e.report||Bo).reportApiInvoke(this._sessionId||null,{id:this._clientId||(null===(t=this.store)||void 0===t?void 0:t.clientId)||this._ID,clientId:"Client"===o?this._clientId||(null===(n=this.store)||void 0===n?void 0:n.clientId):void 0,name:"".concat(o,".").concat(String(r)),options:u,tag:ui.TRACER,reportResult:e.reportResult},e.throttleTime);try{const t=i.apply(this,a);return t instanceof Promise?t.then((t=>(d.onSuccess(e.reportResult&&t),t))).catch((e=>{throw d.onError(e),e})):(d.onSuccess(e.reportResult&&t),t)}catch(e){throw d.onError(e),e}}}return n}}const Bo=new class{constructor(){oo(this,"baseInfoMap",new Map),oo(this,"proxyServer",void 0),oo(this,"eventUploadTimer",void 0),oo(this,"setSessionIdTimer",void 0),oo(this,"url",void 0),oo(this,"sids",new Set),oo(this,"backupUrl",void 0),oo(this,"_appId",void 0),oo(this,"_aid",0),oo(this,"keyEventUploadPendingItems",[]),oo(this,"normalEventUploadPendingItems",[]),oo(this,"apiInvokeUploadPendingItems",[]),oo(this,"apiInvokeCount",0),oo(this,"apiInvokeLoggedCount",0),oo(this,"ltsList",[]),oo(this,"lastSendNormalEventTime",Date.now()),oo(this,"customReportCounterTimer",void 0),oo(this,"customReportCount",0),oo(this,"extApiInvoke",(async e=>{for(const t of e){const e=ao(ao({},t),{},{sid:null,invokeId:++this.apiInvokeCount,processId:to("PROCESS_ID"),tag:ui.TRACER});this.sendApiInvoke(e)}})),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),to("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),to("EVENT_REPORT_SEND_INTERVAL"))}getBaseInfoBySessionId(e){return this.baseInfoMap.get(e)}setAppId(e){this._appId=e,this._aid=parseInt(e.replace(/[a-fA-F0-9]{8}/g,(e=>{let t=uo(e,2);return t[0]+t[1]})),16)||0}reportApiInvoke(e,t,r){t.timeout=t.timeout||6e4,t.reportResult=void 0===t.reportResult||t.reportResult;const n=Date.now();this.apiInvokeCount+=1;const i=this.apiInvokeCount,o=!!to("SHOW_REPORT_INVOKER_LOG"),s=!!to("SHOW_REPORT_USER_INVOKER_LOG"),a=o||s&&t.id;a&&(this.apiInvokeLoggedCount+=1);const c=this.apiInvokeLoggedCount;function u(e,r){if(a){let n="[apiInvoke-".concat(c,"]");if(t.id&&(n+="[".concat(t.id,"]")),t.name&&(n+="[".concat(t.name,"]"),t.name===ci.JOIN))return go.info("".concat(n," ").concat(e));go.info("".concat(n," ").concat(e),"start"===e?t.options:r||"")}}const d=()=>({tag:t.tag,invokeId:i,sid:e,name:t.name,processId:to("PROCESS_ID"),clientId:t.clientId,apiInvokeTime:n,options:t.options,states:t.states||null});u("start");let l=!1;Ci(t.timeout).then((()=>{l||(this.sendApiInvoke(ao(ao({},d()),{},{error:Xn.API_INVOKE_TIMEOUT,success:!1})),u("timeout"),xo(t.name,new Zn(Xn.API_INVOKE_TIMEOUT)))}));const h=new Zn(Xn.UNEXPECTED_ERROR,"".concat(t.name,": this api invoke is end"));return{onSuccess:e=>{const n=()=>{if(l)throw h;return l=!0,this.sendApiInvoke(ao(ao({},d()),{},{success:!0},t.reportResult&&{result:e})),u("onSuccess"),e};return r?Di(n,t.name+"Success",r,(()=>l=!0)):n()},onError:e=>{const n=()=>{if(l)throw e;l=!0,this.sendApiInvoke(ao(ao({},d()),{},{success:!1,error:e})),xo(t.name,e),u("onFailure",e.toString())};return r?Di(n,t.name+"Error",r,(()=>l=!0)):n()}}}_send(e,t,r){this.send({type:e,data:t},r)}_sendApiInvoke(e){return this.sendApiInvoke(e)}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),n=this.createBaseInfo(e,r);n.cname=t.cname,n.rteUrl=t.rteUrl;const i=Object.assign({},{willUploadConsoleLog:to("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:Qi?"global":"oversea",areas:to("AREAS")&&to("AREAS").join(",")},t.extend),o=t.stringUid,s=t.channelProfile,a=t.channelMode,c=t.isABTestSuccess,u=t.lsid,d=t.clientRole,l=Date.now(),h=ao(ao({},n),{},{eventType:Ao.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,buildFormat:t.buildFormat,build:"v4.24.9-0-g2319458dd(10/13/2026, 12:41:26 PM)",lts:l,elapse:l-r,extend:JSON.stringify(i),mode:t.mode,process:to("PROCESS_ID"),appType:to("APP_TYPE"),success:!0,version:Ji,stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:u,clientType:window.navigator.userAgent.includes("AgoraWebView")?42:20,clientRole:d,serviceId:to("PROCESS_ID"),extensionID:to("PLUGIN_INFO").join(",")||"",rteUrl:t.rteUrl,rteSid:t.rteSid,installId:zi()});this.send({type:bo.SESSION,data:h},!0)}reportRteDetail(e){const t=this.baseInfoMap.get(e);if(!t)return;const r=t.info,n=Date.now(),i=ao(ao({},r),{},{eventType:Ao.RTE_DETAIL,lts:n,success:!0,elapse:n-t.startTime,vid:void 0===r.vid?0:Number(r.vid),ua:navigator.userAgent});this.send({type:bo.RTE_DETAIL,data:i},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info;t.vid&&(n.vid=t.vid);const i=Date.now(),o=ao(ao({},n),{},{role:t.role,eventType:Ao.JOIN_CHOOSE_SERVER,lts:i,eventElapse:t.elapse||i-t.lts,chooseServerAddr:t.csAddr,errorCode:t.ec,elapse:i-r.startTime,success:t.succ,chooseServerAddrList:JSON.stringify(t.serverList),uid:t.uid?parseInt(t.uid):null,cid:t.cid?parseInt(t.cid):null,chooseServerIp:t.csIp||"",opid:t.opid,unilbsServerIds:t.unilbsServerIds,extend:t.extend||void 0,isHttp3:t.isHttp3,corssRegionTagReq:t.corssRegionTagReq||void 0,corssRegionTagRes:t.corssRegionTagRes||void 0,ua:navigator.userAgent,resourceTimingInfo:t.resourceTimingInfo||void 0});this.send({type:bo.JOIN_CHOOSE_SERVER,data:o},!0)}reqUserAccount(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=ao(ao({},n),{},{eventType:Ao.REQ_USER_ACCOUNT,lts:i,success:t.success,serverAddress:t.serverAddr,stringUid:t.stringUid,uid:t.uid,errorCode:t.errorCode,elapse:t.elapse||i-r.startTime,eventElapse:i-t.lts,extend:JSON.stringify(t.extend)});this.send({type:bo.REQ_USER_ACCOUNT,data:o},!0)}joinGateway(e,t){var r;const n=this.baseInfoMap.get(e);if(!n)return;const i=n.info;t.vid&&(i.vid=t.vid),i.uid=t.uid,i.cid=t.cid;const o=Date.now(),s=null!==(r=t.reportAt)&&void 0!==r?r:o,a=t.firstSuccess,c=t.addr,u=t.isProxy,d=t.iceConnectedAt,l=t.joinResponseAt,h=!0===t.succ&&"2"===t.signalChannel&&void 0!==t.reportAt&&void 0!==t.winner&&void 0!==t.winnerAt&&void 0!==d&&void 0!==l,p=t.winnerAt,f=null!=p?p:o,E=ao(ao({},t.winner?{winner:t.winner}:{}),h?{iceConnectedElapse:Math.max(d-n.startTime,0),joinResponseElapse:Math.max(l-n.startTime,0)}:{}),m=void 0===p?o-n.startTime:Math.max(f-n.startTime,0),_=ao(ao({},i),{},{eventType:Ao.JOIN_GATEWAY,lts:o,gatewayAddr:t.addr,success:t.succ,errorCode:t.ec,errorMsg:t.errorMsg||"",elapse:m,eventElapse:o-t.lts,firstSuccess:a,signalChannel:t.signalChannel,preload:t.preload?1:0,installId:zi(),isABTestSuccess:t.isABTestSuccess?1:0,gatewayIp:null,gatewayPort:null,isProxy:u?1:0},E),T=_.success?1:0;if(t.succ&&(n.lastJoinSuccessTime=s),c)if("1"===_.signalChannel){const e=lo(/(\d+\.\d+\.\d+\.\d+):(\d+)/,{ip:1,port:2}),t=c.match(e);_.gatewayIp=t&&t.groups?t.groups.ip:"",_.gatewayPort=t&&t.groups?t.groups.port:""}else if(u){const e=c.match(/h=(\d{1,3}-){3}\d{1,3}/g),t=c.match(/p=[0-9]{1,6}/g);_.gatewayIp=e&&e.length?e[0].split("=")[1].replace(/-/g,"."):"",_.gatewayPort=t&&t.length?t[0].split("=")[1]:""}else{const e=c.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),t=c.match(/(:|p=)[0-9]{1,6}/g);_.gatewayIp=e&&e.length?e[0].split("//")[1].replace(/-/g,"."):"",_.gatewayPort=t&&t.length?t[0].split(/:|p=/g)[1]:""}if(a||h)this.send({type:bo.JOIN_GATEWAY,data:_},!0);else{const e={isSuccess:T,port:_.gatewayPort};delete _.success,delete _.eventType,delete _.firstSuccess,delete _.gatewayPort,_.vid=Number(_.vid);const t=Object.assign({},_,e,{eventType:Ao.REJOIN_GATEWAY});this.send({type:bo.RE_JOIN_GATEWAY,data:t},!0)}}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=Date.now(),i=ao(ao({},r.info),{},{lts:n,timeout:t,elapse:n-r.startTime});this.send({type:bo.JOIN_CHANNEL_TIMEOUT,data:i},!0)}publish(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=ao(ao({},n),{},{eventType:Ao.PUBLISH,lts:i,eventElapse:t.eventElapse,elapse:i-r.startTime,success:t.succ,errorCode:t.ec,videoName:t.videoName,audioName:t.audioName,screenName:t.screenName,screenshare:t.screenshare,audio:t.audio,video:t.video,p2pid:t.p2pid,publishRequestid:t.publishRequestid});this.send({type:bo.PUBLISH,data:o},!0)}subscribe(e,t,r){const n=this.baseInfoMap.get(e);if(!n)return;const i=n.info,o=Date.now(),s=ao(ao({},i),{},{eventType:Ao.SUBSCRIBE,lts:o,eventElapse:t.eventElapse,elapse:o-n.startTime,success:t.succ,errorCode:t.ec,video:t.video,audio:t.audio,subscribeRequestid:t.subscribeRequestid,p2pid:t.p2pid,preSsrc:t.preSsrc?1:0},r&&{extend:JSON.stringify({isMassSubscribe:!0})});"string"==typeof t.peerid?s.peerSuid=t.peerid:s.peer=t.peerid,this.send({type:bo.SUBSCRIBE,data:s},!0)}wsCompressorInit(e){const t=[...this.baseInfoMap.keys()],r=t.length?t[0]:"UnableToGetSid",n=this.baseInfoMap.get(r);if(!n)return;const i=n.info,o=Date.now(),s=ao(ao({},i),{},{eventType:Ao.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-n.startTime,status:e.status?1:2});this.send({type:bo.WS_COMPRESSOR_INIT,data:s},!0)}firstXLAPeerFirstVideoFrame(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=t.peerPubStatusMs-(r.lastJoinSuccessTime||i),s=ao(ao({},n),{},{elapse:i-r.startTime,eventType:Ao.XLA_PEER_FIRST_VIDEO_FRAME,lts:i,peer:t.peer,width:t.width,height:t.height,ssrc:t.ssrc,p2pid:t.p2pid,peerPublishDuration:t.peerPublishDuration,joinChannelSuccessElapse:o,peerPubStatusMs:t.peerPubStatusMs-t.joinChannelStart,availablePublish:t.peerPublishDuration>o?1:0,preloadStart:Math.max(t.preloadStart-t.joinChannelStart,0),preloadEnd:Math.max(t.preloadEnd-t.joinChannelStart,0),encrypt:Math.max(t.apStart-t.joinChannelStart,0),ap:Math.max(t.apEnd-t.joinChannelStart,0),sua:Math.max(t.suaEnd-t.joinChannelStart,0),beforeConnect:Math.max(t.beforeConnect-t.joinChannelStart,0),peerRecevier:Math.max(t.peerReceiver-t.joinChannelStart,0),ice:Math.max(t.ice-t.joinChannelStart,0),pc:Math.max(t.pc-t.joinChannelStart,0),signalConnected:Math.max(t.signalConnected-t.joinChannelStart,0),joinReq:Math.max(t.joinReq-t.joinChannelStart,0),joinRes:Math.max(t.joinRes-t.joinChannelStart,0),userJoinNotify:Math.max(t.userJoinNotify-t.joinChannelStart,0),videoSsrcNotify:Math.max(t.videoAddNotify-t.joinChannelStart,0),subscribeDelayMs:Math.max(t.subscribeStart-t.videoAddNotify,0),subscribeStart:Math.max(t.subscribeStart-t.joinChannelStart,0),subscribeEnd:Math.max(t.subscribeEnd-t.joinChannelStart,0),firstReceived:Math.max(t.firstReceived-t.joinChannelStart,0),firstDecoded:Math.max(t.firstDecoded-t.joinChannelStart,0),firstPreRender:Math.max(t.firstPreRender-t.joinChannelStart,0),firstRender:Math.max(t.firstRender-t.joinChannelStart,0),playDelayMs:Math.max(t.playStart-t.subscribeEnd,0),playStart:Math.max(t.playStart-t.joinChannelStart,0),playEnd:Math.max(t.playEnd-t.joinChannelStart,0),isPreSub:t.isPreSub?1:0,isPrePc:t.isPrePc?1:0,isPreInstantVideo:t.isPreInstantVideo?1:0,firstReceivedEncodedFrame:t.firstReceivedEncodedFrame?Math.max(t.firstReceivedEncodedFrame-t.joinChannelStart,0):void 0,frameType:t.frameType||"",rtpTimestamp:t.rtpTimestamp||0,framePayloadType:t.framePayloadType||0,frameDataLength:t.frameDataLength||0,mimeType:t.mimeType||"",sdpEndPoint:t.sdpEndPoint?1:0});this.send({type:bo.XLA_PEER_FIRST_VIDEO_FRAME,data:s},!0)}firstRemoteVideoDecode(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,s=Date.now(),a=ao(ao(ao({},o),n),{},{elapse:s-i.startTime,eventType:t,lts:s,firstDecodeFrame:Math.max((n.firstFrame||s)-i.startTime,0),apEnd:Math.max(n.apEnd-i.startTime,0),apStart:Math.max(n.apStart-i.startTime,0),joinGwEnd:Math.max(n.joinGwEnd-i.startTime,0),joinGwStart:Math.max(n.joinGwStart-i.startTime,0),pcEnd:Math.max(n.pcEnd-i.startTime,0),pcStart:Math.max(n.pcStart-i.startTime,0),subscriberEnd:Math.max(n.subscriberEnd-i.startTime,0),subscriberStart:Math.max(n.subscriberStart-i.startTime,0),videoAddNotify:Math.max(n.videoAddNotify-i.startTime,0)});this.send({type:r,data:a},!0)}firstRemoteFrame(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,s=Date.now(),a=ao(ao(ao({},o),n),{},{elapse:s-i.startTime,eventType:t,lts:s});this.send({type:r,data:a},!0)}abTest(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=ao(ao(ao({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),elapse:i-r.startTime,eventType:Ao.AB_TEST,lts:i});this.send({type:bo.AB_TEST,data:o},!0)}pcStats(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=ao(ao(ao({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),elapse:i-r.startTime,eventType:Ao.PC_STATS,lts:i,preallocation:t.preallocation?1:0});this.send({type:bo.PC_STATS,data:o},!0)}updateRemoteRTPCapabilities(e,t){if(e){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=ao(ao(ao({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),eventType:Ao.UPDATE_REMOTE_RTPCAPABILITIES,lts:i});this.send({type:bo.UPDATE_REMOTE_RTPCAPABILITIES,data:o},!0)}}onGatewayStream(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,s=Date.now(),a=ao(ao(ao({},o),n),{},{eventType:t,lts:s});this.send({type:r,data:a},!0)}streamSwitch(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=ao(ao({},n),{},{eventType:Ao.STREAM_SWITCH,lts:i,isDual:t.isdual,elapse:i-r.startTime,success:t.succ});this.send({type:bo.STREAM_SWITCH,data:o},!0)}requestProxyAppCenter(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=ao(ao({},n),{},{eventType:Ao.REQUEST_PROXY_APPCENTER,lts:i,eventElapse:i-t.lts,elapse:i-r.startTime,APAddr:t.APAddr,workerManagerList:t.workerManagerList,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:bo.REQUEST_PROXY_APPCENTER,data:o},!0)}requestProxyWorkerManager(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=ao(ao({},n),{},{eventType:Ao.REQUEST_PROXY_WORKER_MANAGER,lts:i,eventElapse:i-t.lts,elapse:i-r.startTime,workerManagerAddr:t.workerManagerAddr,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:bo.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?go.debug("reportProxyServerurl: ".concat(e)):go.debug("disable reportProxyServerurl: ".concat(e))}peerPublishStatus(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=ao(ao({},n),{},{subscribeElapse:t.subscribeElapse,peer:t.peer,peerPublishDuration:Math.max(t.audioPublishDuration,t.videoPublishDuration),audiotag:t.audioPublishDuration>0?1:-1,videotag:t.videoPublishDuration>0?1:-1,lts:i,elapse:i-r.startTime,joinChannelSuccessElapse:i-(r.lastJoinSuccessTime||i),peerPublishDurationVideo:t.videoPublishDuration,peerPublishDurationAudio:t.audioPublishDuration});this.send({type:bo.PEER_PUBLISH_STATUS,data:o},!0)}workerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now();(function(e,t,r){const n=e[t];if(!n||"string"!=typeof n)return[e];e[t]="";const i=Ii(JSON.stringify(e));let o=0;const s=[];let a=0;for(let c=0;c<n.length;c++)a+=n.charCodeAt(c)<=127?1:3,a<=r-i||(s[s.length]=Kn(Kn({},e),{},{[t]:n.substring(o,c)}),o=c,a=n.charCodeAt(c)<=127?1:3);return o!==n.length-1&&(s[s.length]=Kn(Kn({},e),{},{[t]:n.substring(o)})),s})(ao(ao(ao({},n),t),{},{elapse:i-r.startTime,lts:i,productType:"WebRTC"}),"payload",1300).forEach((e=>this.send({type:bo.WORKER_EVENT,data:e},!0)))}apworkerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=ao(ao(ao({},n),t),{},{elapse:i-r.startTime,lts:i});this.send({type:bo.AP_WORKER_EVENT,data:o},!0)}joinWebProxyAP(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=ao(ao(ao({},n),t),{},{elapse:i-r.startTime,lts:i,extend:t.extend||void 0});this.send({type:bo.JOIN_WEB_PROXY_AP,data:o},!0)}WebSocketQuit(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=ao(ao(ao({},n),t),{},{elapse:i-r.startTime,lts:i});this.send({type:bo.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>to("CUSTOM_REPORT_LIMIT"))throw new Zn(Xn.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval((()=>{this.customReportCount=0}),5e3));const r=Date.now(),n=t.map((t=>({type:bo.USER_ANALYTICS,data:ao(ao({sid:e},t),{},{lts:r})})));try{to("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(n):await this.postDataToStatsCollector(n)}catch(e){throw go.error("send custom report message failed",e.toString()),new Zn(Xn.CUSTOM_REPORT_SEND_FAILED,e.message)}}reportAlarm(e,t){const r=e?this.baseInfoMap.get(e):void 0,n=null==r?void 0:r.info,i=Date.now(),o=ao(ao(ao({},n),t),{},{vid:void 0===(null==n?void 0:n.vid)?0:Number(n.vid),elapse:r?i-r.startTime:0,eventType:Ao.ALARM_STATUS_NOTIFY,lts:i,installId:zi(),processId:to("PROCESS_ID")});this.send({type:bo.ALARM_STATUS_NOTIFY,data:o},!0)}reportCreateClientPreconnect(e){const t=Date.now(),r=to("PROCESS_ID"),n={invokeId:++this.apiInvokeCount,process:r,sid:r.replace(/^process-/,"").replace(/-/g,""),cname:null,cid:null,uid:null,lts:t,success:!0,elapse:0,execElapse:0,apiName:ci.CREATE_CLIENT_PRECONNECT,options:JSON.stringify({targets:e.targets,mode:e.mode,origin:e.origin})};this.send({type:bo.API_INVOKE,data:n},!0)}sendApiInvoke(e){const t=to("NOT_REPORT_EVENT");if(e.tag&&t.includes&&t.includes(e.tag))return!1;if(null===e.sid)return this.apiInvokeUploadPendingItems.push(e),!1;const r=this.baseInfoMap.get(e.sid);if(!r)return this.apiInvokeUploadPendingItems.push(e),!1;const n=r.info,i=n.cname,o=n.uid,s=n.cid;let a;if(e.lts=e.lts||Date.now(),e.error)if(e.error instanceof Zn){const t=e.error,r=t.code,n=t.message;a=r||n||e.error.toString()}else a=e.error.toString();const c={invokeId:e.invokeId,process:e.processId||to("PROCESS_ID"),clientId:e.clientId,sid:e.sid,cname:i,cid:s,uid:o,lts:e.lts,success:e.success,elapse:e.lts-r.startTime,execElapse:e.lts-e.apiInvokeTime,apiName:e.name,options:e.options?Vo(e.options,"options"):void 0,execStates:e.states?Vo(e.states,"states"):void 0,execResult:e.result?Vo(e.result,"result"):void 0,errorCode:e.error?a:void 0,errorMsg:e.error?Vo(e.error,"error"):void 0};return this.send({type:bo.API_INVOKE,data:c},!1),!0}addSid(e){this.sids.add(e)}removeSid(e){this.sids.delete(e)}appendSessionId(){const e=this.apiInvokeUploadPendingItems;if(0===e.length)return;const t=Array.from(this.sids).find((e=>null!==e));t&&e.forEach((e=>{if(e)try{e.sid=t,this.sendApiInvoke(Object.assign({},e))}catch(e){go.warning("[report] failed to flush pending ApiInvoke: ".concat(e instanceof Error?e.message:String(e)))}})),e.length=0}send(e,t){if(t)return this.keyEventUploadPendingItems.push(e),void this.sendItems(this.keyEventUploadPendingItems,!0);this.normalEventUploadPendingItems.push(e),this.normalEventUploadPendingItems.length>to("NORMAL_EVENT_QUEUE_CAPACITY")&&this.normalEventUploadPendingItems.splice(0,1),this.normalEventUploadPendingItems.length>=10&&this.sendItems(this.normalEventUploadPendingItems,!1)}doSend(){this.keyEventUploadPendingItems.length>0&&this.sendItems(this.keyEventUploadPendingItems,!0),this.normalEventUploadPendingItems.length>0&&Date.now()-this.lastSendNormalEventTime>=5e3&&this.sendItems(this.normalEventUploadPendingItems,!1)}sendItems(e,t){const r=[],n=[];for(;e.length;){const t=e.shift();r.length<20?r.push(t):n.push(t)}e.push(...n);for(const e of[...r])-1!==this.ltsList.indexOf(e.data.lts)?(e.data.lts=this.ltsList[this.ltsList.length-1]+1,this.ltsList.push(e.data.lts)):(this.ltsList.push(e.data.lts),this.ltsList.sort(((e,t)=>e-t)));return t||(this.lastSendNormalEventTime=Date.now()),to("ENABLE_EVENT_REPORT")?(r.length&&(to("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{to("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>to("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-to("NORMAL_EVENT_QUEUE_CAPACITY")),go.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){Ei.networkState===di.OFFLINE&&await Promise.race([Ei.onlineWaiter,Ci(2*ji.maxRetryTimeout)]);const t=e=>{let t=new Uint8Array;return e.forEach((e=>{const r=function(e){return(new TextEncoder).encode(e)}(JSON.stringify(e.data)),n=new ArrayBuffer(5),i=(e=>{let t=0;return Object.entries(bo).forEach((r=>{let n=uo(r,2),i=n[0];n[1]===e.type&&(t=Oo[i])})),t})(e),o=new DataView(n);o.setUint16(0,r.byteLength,!0),o.setUint8(2,255&i),o.setUint8(3,i>>>8&255),o.setUint8(4,i>>>16&255),t=ni(t,new Uint8Array(n)),t=ni(t,r)})),t},r="event";let n=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(to("NEW_REPORT_SERVER_DOMAINS")[0],"&p=443&d=").concat(r):"https://".concat(to("NEW_REPORT_SERVER_DOMAINS")[0],"/").concat(r);for(let i=0;i<2;i+=1){1===i&&(n=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(to("NEW_REPORT_SERVER_DOMAINS")[1],"&p=443&d=").concat(r):"https://".concat(to("NEW_REPORT_SERVER_DOMAINS")[1],"/").concat(r));try{await Ki(n,{timeout:1e4,data:t(e),headers:ao(ao({biz:"webrtc",sendts:Math.round(Date.now()/1e3),debug:"false"},this._appId&&{appid:this._appId}),{},{"Content-Type":"application/octet-stream"})},!0)}catch(e){if(1===i)throw e;continue}return}}async postDataToStatsCollector(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=(e=>{const t=e&&e.data.sid&&this.baseInfoMap.get(e.data.sid);return t&&t.info.vid&&+t.info.vid||0})(e[0]),n=r?void 0:this._aid,i={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:e.map((e=>JSON.stringify(e))),vid:r,aid:n};Ei.networkState===di.OFFLINE&&await Promise.race([Ei.onlineWaiter,Ci(2*ji.maxRetryTimeout)]);const o=t?"/events/proto-raws":"/events/messages";let s=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(to("EVENT_REPORT_DOMAIN"),"&p=").concat(to("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(to("EVENT_REPORT_DOMAIN"),":").concat(to("STATS_COLLECTOR_PORT")).concat(o));for(let e=0;e<2;e+=1){1===e&&(s=this.backupUrl||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(to("EVENT_REPORT_BACKUP_DOMAIN"),"&p=").concat(to("STATS_COLLECTOR_PORT"),"&d=").concat(o):"https://".concat(to("EVENT_REPORT_BACKUP_DOMAIN"),":").concat(to("STATS_COLLECTOR_PORT")).concat(o)));try{t?await Yi(s,{timeout:1e4,data:i}):await Ki(s,{timeout:1e4,data:i})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},vo);return r.sid=e,this.baseInfoMap.set(e,{info:r,startTime:t}),r}reportResourceTiming(e,t,r){const n=performance.getEntriesByName(e),i=n[n.length-1];i&&this.reportApiInvoke(t,{clientId:r,name:"Client.resourceTiming",options:i,tag:ui.TRACER}).onSuccess()}};ho.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=Ei.networkState,Bo.reportApiInvoke(null,{name:"logUploadError",options:e,tag:ui.TRACER}).onSuccess("logUploadError")}));const jo={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1,supportDataChannel:!1,supportPCSetConfiguration:!1,supportWebRTCEncodedTransform:!1,supportWebRTCInsertableStream:!1,supportRequestVideoFrameCallback:!1,supportWebCrypto:!1,supportSuppressLocalAudioPlayback:!1,supportRestrictOwnAudio:!1};function Wo(){const e=_n();jo.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),jo.getStreamFromExtension=e.name===pn.CHROME&&Number(e.version)>34,jo.supportUnifiedPlan=function(){if(!window.RTCRtpTransceiver)return!1;if(!("currentDirection"in RTCRtpTransceiver.prototype))return!1;const e=new RTCPeerConnection;let t=!1;try{e.addTransceiver("audio"),t=!0}catch(e){}return e.close(),t}(),jo.supportMinBitrate=e.name===pn.CHROME||e.name===pn.EDGE,jo.supportSetRtpSenderParameters=function(){const e=_n();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!Fn()||(!(!vn()&&!yn())||e.name===pn.FIREFOX&&Number(e.version)>=64)}(),e.name===pn.SAFARI&&(Number(e.version)>=14?jo.supportDualStream=!0:jo.supportDualStream=!1),jo.webAudioMediaStreamDest=function(){const e=_n();if(e.name===pn.SAFARI&&Number(e.version)<12)return!1;return!0}(),jo.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),jo.supportWebGL="undefined"!=typeof WebGLRenderingContext,jo.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,Fn()||(jo.webAudioWithAEC=!0),jo.supportShareAudio=function(){const e=_n();if((e.os===hn.WIN_10||e.os===hn.WIN_81||e.os===hn.WIN_7||e.os===hn.LINUX||e.os===hn.MAC_OS||e.os===hn.CHROMIUM_OS)&&e.name===pn.CHROME&&Number(e.version)>=74)return!0;return!1}(),jo.supportDataChannel=function(){if(In(76)||Nn(68)||function(e){const t=_n();return!(t.name!==pn.SAFARI||!t.osVersion)&&Number(t.version)>=e}(14))return!0;return!1}(),jo.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!bn()&&!!e&&e.prototype.setConfiguration instanceof Function}(),jo.supportWebRTCEncodedTransform=In(87)||function(){const e=_n();if(e.name!==pn.SAFARI||!e.browserVersion)return!1;const t=e.browserVersion.split(".");return Number(t[0])>15||15===Number(t[0])&&Number(t[1])>=4}()||Nn(117),jo.supportWebRTCInsertableStream=function(){const e=_n();return(e.name===pn.CHROME||e.name===pn.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),jo.supportRequestVideoFrameCallback=function(){if("requestVideoFrameCallback"in HTMLVideoElement.prototype)return!0;return!1}(),jo.supportWebCrypto="undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.subtle,jo.supportSuppressLocalAudioPlayback=Xo(),jo.supportRestrictOwnAudio=Zo(),Ri((()=>{jo.supportDualStreamEncoding=function(){const e=_n();if(to("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&to("CHROME_DUAL_STREAM_USE_ENCODING"))}(),go.debug("browser ua: ",navigator.userAgent),go.info("browser info: ",e),go.info("browser compatibility: ",jo)}))}function Go(){return jo}function Ho(){return"setSinkId"in HTMLAudioElement.prototype&&(!to("RESTRICTION_SET_PLAYBACK_DEVICE")||(Rn()||An())&&!Vn())}function Ko(){return!jo.supportUnifiedPlan||to("CHROME_FORCE_PLAN_B")&&Fn()}function Yo(){return navigator.mediaDevices&&"getSupportedConstraints"in navigator.mediaDevices}function Xo(){if(Yo()){const e=navigator.mediaDevices.getSupportedConstraints();return!(!("suppressLocalAudioPlayback"in e)||!e.suppressLocalAudioPlayback)}return In(141)||wn(141)||Pn(141)}function Zo(){if(Yo()){const e=navigator.mediaDevices.getSupportedConstraints();return!(!("restrictOwnAudio"in e)||!e.restrictOwnAudio)}return In(141)||wn(141)||Pn(125)}let zo=function(e){return e.IOS_15_16_INTERRUPTION_START="ios15_16-interruption-start",e.IOS_15_16_INTERRUPTION_END="ios15_16-interruption-end",e.IOS_INTERRUPTION_START="ios-interruption-start",e.IOS_INTERRUPTION_END="ios-interruption-end",e.STATE_CHANGE="state-change",e}({});var Jo=function(e){try{return!!e()}catch(e){return!0}},Qo=!Jo((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),qo=Qo,$o=Function.prototype,es=$o.call,ts=qo&&$o.bind.bind(es,es),rs=qo?ts:function(e){return function(){return es.apply(e,arguments)}},ns=rs({}.isPrototypeOf),is=function(e){return e&&e.Math===Math&&e},os=is("object"==typeof globalThis&&globalThis)||is("object"==typeof window&&window)||is("object"==typeof self&&self)||is("object"==typeof Z&&Z)||is("object"==typeof Z&&Z)||function(){return this}()||Function("return this")(),ss=Qo,as=Function.prototype,cs=as.apply,us=as.call,ds="object"==typeof Reflect&&Reflect.apply||(ss?us.bind(cs):function(){return us.apply(cs,arguments)}),ls=rs,hs=ls({}.toString),ps=ls("".slice),fs=function(e){return ps(hs(e),8,-1)},Es=fs,ms=rs,_s=function(e){if("Function"===Es(e))return ms(e)},Ts="object"==typeof document&&document.all,gs=void 0===Ts&&void 0!==Ts?function(e){return"function"==typeof e||e===Ts}:function(e){return"function"==typeof e},Ss={},ys=!Jo((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})),Rs=Qo,vs=Function.prototype.call,As=Rs?vs.bind(vs):function(){return vs.apply(vs,arguments)},bs={},Os={}.propertyIsEnumerable,Is=Object.getOwnPropertyDescriptor,Cs=Is&&!Os.call({1:2},1);bs.f=Cs?function(e){var t=Is(this,e);return!!t&&t.enumerable}:Os;var ws,Ns,Ps=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Ds=Jo,Ls=fs,ks=Object,Ms=rs("".split),Us=Ds((function(){return!ks("z").propertyIsEnumerable(0)}))?function(e){return"String"===Ls(e)?Ms(e,""):ks(e)}:ks,xs=function(e){return null==e},Vs=xs,Fs=TypeError,Bs=function(e){if(Vs(e))throw new Fs("Can't call method on "+e);return e},js=Us,Ws=Bs,Gs=function(e){return js(Ws(e))},Hs=gs,Ks=function(e){return"object"==typeof e?null!==e:Hs(e)},Ys={},Xs=Ys,Zs=os,zs=gs,Js=function(e){return zs(e)?e:void 0},Qs=function(e,t){return arguments.length<2?Js(Xs[e])||Js(Zs[e]):Xs[e]&&Xs[e][t]||Zs[e]&&Zs[e][t]},qs=os.navigator,$s=qs&&qs.userAgent,ea=$s?String($s):"",ta=os,ra=ea,na=ta.process,ia=ta.Deno,oa=na&&na.versions||ia&&ia.version,sa=oa&&oa.v8;sa&&(Ns=(ws=sa.split("."))[0]>0&&ws[0]<4?1:+(ws[0]+ws[1])),!Ns&&ra&&(!(ws=ra.match(/Edge\/(\d+)/))||ws[1]>=74)&&(ws=ra.match(/Chrome\/(\d+)/))&&(Ns=+ws[1]);var aa=Ns,ca=aa,ua=Jo,da=os.String,la=!!Object.getOwnPropertySymbols&&!ua((function(){var e=Symbol("symbol detection");return!da(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ca&&ca<41})),ha=la&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,pa=Qs,fa=gs,Ea=ns,ma=Object,_a=ha?function(e){return"symbol"==typeof e}:function(e){var t=pa("Symbol");return fa(t)&&Ea(t.prototype,ma(e))},Ta=String,ga=function(e){try{return Ta(e)}catch(e){return"Object"}},Sa=gs,ya=ga,Ra=TypeError,va=function(e){if(Sa(e))return e;throw new Ra(ya(e)+" is not a function")},Aa=va,ba=xs,Oa=function(e,t){var r=e[t];return ba(r)?void 0:Aa(r)},Ia=As,Ca=gs,wa=Ks,Na=TypeError,Pa={exports:{}},Da=os,La=Object.defineProperty,ka=os,Ma=function(e,t){try{La(Da,e,{value:t,configurable:!0,writable:!0})}catch(r){Da[e]=t}return t},Ua="__core-js_shared__",xa=Pa.exports=ka[Ua]||Ma(Ua,{});(xa.versions||(xa.versions=[])).push({version:"3.49.0",mode:"pure",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"});var Va=Pa.exports,Fa=Va,Ba=function(e,t){return Fa[e]||(Fa[e]=t||{})},ja=Bs,Wa=Object,Ga=function(e){return Wa(ja(e))},Ha=Ga,Ka=rs({}.hasOwnProperty),Ya=Object.hasOwn||function(e,t){return Ka(Ha(e),t)},Xa=rs,Za=0,za=Math.random(),Ja=Xa(1.1.toString),Qa=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Ja(++Za+za,36)},qa=Ba,$a=Ya,ec=Qa,tc=la,rc=ha,nc=os.Symbol,ic=qa("wks"),oc=rc?nc.for||nc:nc&&nc.withoutSetter||ec,sc=function(e){return $a(ic,e)||(ic[e]=tc&&$a(nc,e)?nc[e]:oc("Symbol."+e)),ic[e]},ac=As,cc=Ks,uc=_a,dc=Oa,lc=function(e,t){var r,n;if("string"===t&&Ca(r=e.toString)&&!wa(n=Ia(r,e)))return n;if(Ca(r=e.valueOf)&&!wa(n=Ia(r,e)))return n;if("string"!==t&&Ca(r=e.toString)&&!wa(n=Ia(r,e)))return n;throw new Na("Can't convert object to primitive value")},hc=TypeError,pc=sc("toPrimitive"),fc=function(e,t){if(!cc(e)||uc(e))return e;var r,n=dc(e,pc);if(n){if(void 0===t&&(t="default"),r=ac(n,e,t),!cc(r)||uc(r))return r;throw new hc("Can't convert object to primitive value")}return void 0===t&&(t="number"),lc(e,t)},Ec=_a,mc=function(e){var t=fc(e,"string");return Ec(t)?t:t+""},_c=Ks,Tc=os.document,gc=_c(Tc)&&_c(Tc.createElement),Sc=function(e){return gc?Tc.createElement(e):{}},yc=Sc,Rc=!ys&&!Jo((function(){return 7!==Object.defineProperty(yc("div"),"a",{get:function(){return 7}}).a})),vc=ys,Ac=As,bc=bs,Oc=Ps,Ic=Gs,Cc=mc,wc=Ya,Nc=Rc,Pc=Object.getOwnPropertyDescriptor;Ss.f=vc?Pc:function(e,t){if(e=Ic(e),t=Cc(t),Nc)try{return Pc(e,t)}catch(e){}if(wc(e,t))return Oc(!Ac(bc.f,e,t),e[t])};var Dc=Jo,Lc=gs,kc=/#|\.prototype\./,Mc=function(e,t){var r=xc[Uc(e)];return r===Fc||r!==Vc&&(Lc(t)?Dc(t):!!t)},Uc=Mc.normalize=function(e){return String(e).replace(kc,".").toLowerCase()},xc=Mc.data={},Vc=Mc.NATIVE="N",Fc=Mc.POLYFILL="P",Bc=Mc,jc=va,Wc=Qo,Gc=_s(_s.bind),Hc=function(e,t){return jc(e),void 0===t?e:Wc?Gc(e,t):function(){return e.apply(t,arguments)}},Kc={},Yc=ys&&Jo((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Xc=Ks,Zc=String,zc=TypeError,Jc=function(e){if(Xc(e))return e;throw new zc(Zc(e)+" is not an object")},Qc=ys,qc=Rc,$c=Yc,eu=Jc,tu=mc,ru=TypeError,nu=Object.defineProperty,iu=Object.getOwnPropertyDescriptor,ou="enumerable",su="configurable",au="writable";Kc.f=Qc?$c?function(e,t,r){if(eu(e),t=tu(t),eu(r),"function"==typeof e&&"prototype"===t&&"value"in r&&au in r&&!r[au]){var n=iu(e,t);n&&n[au]&&(e[t]=r.value,r={configurable:su in r?r[su]:n[su],enumerable:ou in r?r[ou]:n[ou],writable:!1})}return nu(e,t,r)}:nu:function(e,t,r){if(eu(e),t=tu(t),eu(r),qc)try{return nu(e,t,r)}catch(e){}if("get"in r||"set"in r)throw new ru("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var cu=Kc,uu=Ps,du=ys?function(e,t,r){return cu.f(e,t,uu(1,r))}:function(e,t,r){return e[t]=r,e},lu=os,hu=ds,pu=_s,fu=gs,Eu=Ss.f,mu=Bc,_u=Ys,Tu=Hc,gu=du,Su=Ya,yu=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return hu(e,this,arguments)};return t.prototype=e.prototype,t},Ru=function(e,t){var r,n,i,o,s,a,c,u,d,l=e.target,h=e.global,p=e.stat,f=e.proto,E=h?lu:p?lu[l]:lu[l]&&lu[l].prototype,m=h?_u:_u[l]||gu(_u,l,{})[l],_=m.prototype;for(o in t)n=!(r=mu(h?o:l+(p?".":"#")+o,e.forced))&&E&&Su(E,o),a=m[o],n&&(c=e.dontCallGetSet?(d=Eu(E,o))&&d.value:E[o]),s=n&&c?c:t[o],(r||f||typeof a!=typeof s)&&(u=e.bind&&n?Tu(s,lu):e.wrap&&n?yu(s):f&&fu(s)?pu(s):s,(e.sham||s&&s.sham||a&&a.sham)&&gu(u,"sham",!0),gu(m,o,u),f&&(Su(_u,i=l+"Prototype")||gu(_u,i,{}),gu(_u[i],o,s),e.real&&_&&(r||!_[o])&&gu(_,o,s)))},vu=Math.ceil,Au=Math.floor,bu=Math.trunc||function(e){var t=+e;return(t>0?Au:vu)(t)},Ou=bu,Iu=function(e){var t=+e;return t!=t||0===t?0:Ou(t)},Cu=Iu,wu=Math.max,Nu=Math.min,Pu=function(e,t){var r=Cu(e);return r<0?wu(r+t,0):Nu(r,t)},Du=Iu,Lu=Math.min,ku=function(e){var t=Du(e);return t>0?Lu(t,9007199254740991):0},Mu=function(e){return ku(e.length)},Uu=Gs,xu=Pu,Vu=Mu,Fu=function(e){return function(t,r,n){var i=Uu(t),o=Vu(i);if(0===o)return!e&&-1;var s,a=xu(n,o);if(e&&r!=r){for(;o>a;)if((s=i[a++])!=s)return!0}else for(;o>a;a++)if((e||a in i)&&i[a]===r)return e||a||0;return!e&&-1}},Bu={includes:Fu(!0),indexOf:Fu(!1)},ju=Ru,Wu=Bu.includes,Gu=Jo,Hu=Gu((function(){return!Array(1).includes()})),Ku=Gu((function(){return[,1].includes(void 0,1)}));ju({target:"Array",proto:!0,forced:Hu||Ku},{includes:function(e){return Wu(this,e,arguments.length>1?arguments[1]:void 0)}});var Yu=os,Xu=Ys,Zu=function(e,t){var r=Xu[e+"Prototype"],n=r&&r[t];if(n)return n;var i=Yu[e],o=i&&i.prototype;return o&&o[t]},zu=Zu("Array","includes"),Ju=Ks,Qu=fs,qu=sc("match"),$u=function(e){var t;return Ju(e)&&(void 0!==(t=e[qu])?!!t:"RegExp"===Qu(e))},ed=TypeError,td={};td[sc("toStringTag")]="z";var rd="[object z]"===String(td),nd=rd,id=gs,od=fs,sd=sc("toStringTag"),ad=Object,cd="Arguments"===od(function(){return arguments}()),ud=nd?od:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=ad(e),sd))?r:cd?od(t):"Object"===(n=od(t))&&id(t.callee)?"Arguments":n},dd=ud,ld=String,hd=function(e){if("Symbol"===dd(e))throw new TypeError("Cannot convert a Symbol value to a string");return ld(e)},pd=sc("match"),fd=Ru,Ed=function(e){if($u(e))throw new ed("The method doesn't accept regular expressions");return e},md=Bs,_d=hd,Td=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[pd]=!1,"/./"[e](t)}catch(e){}}return!1},gd=rs("".indexOf);fd({target:"String",proto:!0,forced:!Td("includes")},{includes:function(e){return!!~gd(_d(md(this)),_d(Ed(e)),arguments.length>1?arguments[1]:void 0)}});var Sd=Zu("String","includes"),yd=ns,Rd=zu,vd=Sd,Ad=Array.prototype,bd=String.prototype,Od=function(e){var t=e.includes;return e===Ad||yd(Ad,e)&&t===Ad.includes?Rd:"string"==typeof e||e===bd||yd(bd,e)&&t===bd.includes?vd:t},Id=z(Od);function Cd(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function wd(e,t,r,n,i){return{width:e,height:t,frameRate:r,bitrateMin:n,bitrateMax:i}}function Nd(e,t,r,n,i){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:n,bitrateMax:i}}function Pd(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const Dd={"90p":wd(160,90),"90p_1":wd(160,90),"120p":wd(160,120,15,30,65),"120p_1":wd(160,120,15,30,65),"120p_3":wd(120,120,15,30,50),"120p_4":wd(212,120),"180p":wd(320,180,15,30,140),"180p_1":wd(320,180,15,30,140),"180p_3":wd(180,180,15,30,100),"180p_4":wd(240,180,15,30,120),"240p":wd(320,240,15,40,200),"240p_1":wd(320,240,15,40,200),"240p_3":wd(240,240,15,40,140),"240p_4":wd(424,240,15,40,220),"360p":wd(640,360,15,80,400),"360p_1":wd(640,360,15,80,400),"360p_3":wd(360,360,15,80,260),"360p_4":wd(640,360,30,80,600),"360p_6":wd(360,360,30,80,400),"360p_7":wd(480,360,15,80,320),"360p_8":wd(480,360,30,80,490),"360p_9":wd(640,360,15,80,800),"360p_10":wd(640,360,24,80,800),"360p_11":wd(640,360,24,80,1e3),"480p":wd(640,480,15,100,500),"480p_1":wd(640,480,15,100,500),"480p_2":wd(640,480,30,100,1e3),"480p_3":wd(480,480,15,100,400),"480p_4":wd(640,480,30,100,750),"480p_6":wd(480,480,30,100,600),"480p_8":wd(848,480,15,100,610),"480p_9":wd(848,480,30,100,930),"480p_10":wd(640,480,10,100,400),"720p":wd(1280,720,15,120,1130),"720p_auto":wd(1280,720,30,900,3e3),"720p_1":wd(1280,720,15,120,1130),"720p_2":wd(1280,720,30,120,2e3),"720p_3":wd(1280,720,30,120,1710),"720p_5":wd(960,720,15,120,910),"720p_6":wd(960,720,30,120,1380),"1080p":wd(1920,1080,15,120,2080),"1080p_1":wd(1920,1080,15,120,2080),"1080p_2":wd(1920,1080,30,120,3e3),"1080p_3":wd(1920,1080,30,120,3150),"1080p_5":wd(1920,1080,60,120,4780),"1440p":wd(2560,1440,30,120,4850),"1440p_1":wd(2560,1440,30,120,4850),"1440p_2":wd(2560,1440,60,120,7350),"4k":wd(3840,2160,30,120,8910),"4k_1":wd(3840,2160,30,120,8910),"4k_3":wd(3840,2160,60,120,13500)},Ld={auto:{},"480p":Nd(640,480,5),"480p_1":Nd(640,480,5),"480p_2":Nd(640,480,30),"480p_3":Nd(640,480,15),"720p":Nd(1280,720,5),"720p_auto":wd(1280,720,30,900,3e3),"720p_1":Nd(1280,720,5),"720p_2":Nd(1280,720,30),"720p_3":Nd(1280,720,15),"1080p":Nd(1920,1080,5),"1080p_1":Nd(1920,1080,5),"1080p_2":Nd(1920,1080,30),"1080p_3":Nd(1920,1080,15),"1440p":Nd(2560,1440,15),"1440p_1":Nd(2560,1440,5),"1440p_2":Nd(2560,1440,30),"1440p_3":Nd(2560,1440,15),"4k":Nd(3840,2160,15),"4k_1":Nd(3840,2160,5),"4k_2":Nd(3840,2160,30),"4k_3":Nd(3840,2160,15)},kd={"1SL1TL":Pd(1,1),"3SL3TL":Pd(3,3),"2SL3TL":Pd(2,3)};function Md(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},Dd[e]):e}function Ud(e){return"string"==typeof e?Object.assign({},Ld[e]):e}function xd(e){return"string"==typeof e?Object.assign({},kd[e]):e}const Vd={speech_low_quality:Cd(16e3,!1),speech_standard:Cd(32e3,!1,18),music_standard:Cd(48e3,!1),standard_stereo:Cd(48e3,!0,56),high_quality:Cd(48e3,!1,128),high_quality_stereo:Cd(48e3,!0,192)};function Fd(e){return"string"==typeof e?Object.assign({},Vd[e]):e}const Bd=[];function jd(e){Id(Bd).call(Bd,e)||Bd.push(e)}function Wd(e){const t=Bd.indexOf(e);-1!==t&&Bd.splice(t,1)}function Gd(){return Bd.some((e=>function(e){return"__className__"in e&&"MicrophoneAudioTrack"===e.__className__}(e)))}function Hd(e){return qn(e.width,"config.width"),qn(e.height,"config.height"),void 0!==e.frameRate&&qn(e.frameRate,"config.frameRate"),void 0!==e.bitrateMax&&Qn(e.bitrateMax,"config.bitrateMax"),void 0!==e.bitrateMin&&Qn(e.bitrateMin,"config.bitrateMin"),void 0!==e.minDownscaleWidth&&Qn(e.minDownscaleWidth,"config.minDownscaleWidth",1,1/0,!0),void 0!==e.minDownscaleHeight&&Qn(e.minDownscaleHeight,"config.minDownscaleHeight",1,1/0,!0),!0}function Kd(e){return void 0!==e.sampleRate&&Qn(e.sampleRate,"config.sampleRate",0,96e3,!0),void 0!==e.sampleSize&&Qn(e.sampleRate,"config.sampleSize",0,128,!0),void 0!==e.stereo&&zn(e.stereo,"config.stereo"),void 0!==e.bitrate&&Qn(e.bitrate,"config.bitrate",0,1e4,!1),!0}function Yd(e){return Jn(e,"mediaSource",["screen","window","application"]),!0}let Xd=function(e){return e.NEED_RENEGOTIATE="@need_renegotiate",e.NEED_REPLACE_TRACK="@need_replace_track",e.NEED_REPLACE_MIXING_TRACK="@need_replace_mixing_track",e.NEED_CLOSE="@need_close",e.NEED_ENABLE_TRACK="@need_enable_track",e.NEED_DISABLE_TRACK="@need_disable_track",e.NEED_SESSION_ID="@need_sid",e.SET_OPTIMIZATION_MODE="@set_optimization_mode",e.GET_STATS="@get_stats",e.GET_RTC_STATS="@get_rtc_stats",e.GET_LOW_VIDEO_TRACK="@get_low_video_track",e.NEED_RESET_REMOTE_SDP="@need_reset_remote_sdp",e.NEED_UPDATE_VIDEO_ENCODER="@need_update_video_encoder",e.NEED_UPDATE_VIDEO_SEND_PARAMETERS="@need_update_video_send_parameters",e.VIDEO_RESOLUTION_UPDATED="@video_resolution_updated",e.NEED_MUTE_TRACK="@need_mute_track",e.NEED_UNMUTE_TRACK="@need_unmute_track",e}({}),Zd=function(e){return e.SCREEN_TRACK="screen_track",e.CUSTOM_TRACK="custome_track",e.LOW_STREAM="low_stream",e.SCREEN_LOW_TRACK="screen_low_track",e}({});let zd=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),Jd=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.HIGH_STREAM_LAYER1=4]="HIGH_STREAM_LAYER1",e[e.HIGH_STREAM_LAYER2=5]="HIGH_STREAM_LAYER2",e[e.HIGH_STREAM_LAYER3=6]="HIGH_STREAM_LAYER3",e[e.HIGH_STREAM_LAYER4=7]="HIGH_STREAM_LAYER4",e[e.HIGH_STREAM_LAYER5=8]="HIGH_STREAM_LAYER5",e[e.HIGH_STREAM_LAYER6=9]="HIGH_STREAM_LAYER6",e}({}),Qd=function(e){return e[e.DISABLE=0]="DISABLE",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e[e.HIGH_STREAM_LAYER1=3]="HIGH_STREAM_LAYER1",e[e.HIGH_STREAM_LAYER2=4]="HIGH_STREAM_LAYER2",e[e.HIGH_STREAM_LAYER3=5]="HIGH_STREAM_LAYER3",e[e.HIGH_STREAM_LAYER4=6]="HIGH_STREAM_LAYER4",e[e.HIGH_STREAM_LAYER5=7]="HIGH_STREAM_LAYER5",e[e.HIGH_STREAM_LAYER6=8]="HIGH_STREAM_LAYER6",e}({}),qd=function(e){return e.TRANSCEIVER_UPDATED="transceiver-updated",e.SEI_TO_SEND="sei-to-send",e.SEI_RECEIVED="sei-received",e.TRACK_UPDATED="track-updated",e}({}),$d=function(e){return e.SOURCE_STATE_CHANGE="source-state-change",e.TRACK_ENDED="track-ended",e.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.CLOSED="closed",e}({}),el=function(e){return e.FIRST_FRAME_DECODED="first-frame-decoded",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.VIDEO_STATE_CHANGED="video-state-changed",e.PLAY_START="play-start",e.PLAY_END="play-end",e.FIRST_FRAME_RENDER="first-frame-render",e}({}),tl=function(e){return e.AUDIO="audio",e.VIDEO="video",e.DATA="data",e}({}),rl=function(e){return e.AUDIO_SOURCE_STATE_CHANGE="audio_source_state_change",e.RECEIVE_TRACK_BUFFER="receive_track_buffer",e.ON_AUDIO_BUFFER="on_audio_buffer",e.UPDATE_SOURCE="update_source",e}({}),nl=function(e){return e.UPDATE_TRACK_SOURCE="update-track-source",e}({});const il={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},ol={sendBytes:0,sendBitrate:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,sendResolutionHeight:0,sendResolutionWidth:0,captureResolutionHeight:0,captureResolutionWidth:0,targetSendBitrate:0,totalDuration:0,totalFreezeTime:0,currentPacketLossRate:0},sl={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveLevel:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receivePacketsDiscarded:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1},al={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receiveResolutionHeight:0,receiveResolutionWidth:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1};let cl=function(e){return e.ON_TRACK="on_track",e.ON_NODE="on_node",e}({}),ul=function(e){return e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints",e}({}),dl=function(e){return e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND",e}({}),ll=function(e){return e.STATE_CHANGE="state_change",e.RECORDING_DEVICE_CHANGED="recordingDeviceChanged",e.PLAYOUT_DEVICE_CHANGED="playoutDeviceChanged",e.CAMERA_DEVICE_CHANGED="cameraDeviceChanged",e}({});let hl=function(e){return e.NONE="none",e.INIT="init",e.CANPLAY="canplay",e.PLAYING="playing",e.PAUSED="paused",e.SUSPEND="suspend",e.STALLED="stalled",e.WAITING="waiting",e.ERROR="error",e.DESTROYED="destroyed",e.ABORT="abort",e.ENDED="ended",e.EMPTIED="emptied",e.LOADEDDATA="loadeddata",e}({}),pl=function(e){return e[e.VideoStateStopped=0]="VideoStateStopped",e[e.VideoStateStarting=1]="VideoStateStarting",e[e.VideoStateDecoding=2]="VideoStateDecoding",e[e.VideoStateFrozen=3]="VideoStateFrozen",e}({});let fl=function(e){return e.OPEN="open",e.MESSAGE="message",e.CLOSE="close",e.CLOSING="closing",e.ERROR="error",e}({});var El={exports:{}},ml=Ru,_l=ys,Tl=Kc.f;ml({target:"Object",stat:!0,forced:Object.defineProperty!==Tl,sham:!_l},{defineProperty:Tl});var gl=Ys.Object,Sl=El.exports=function(e,t,r){return gl.defineProperty(e,t,r)};gl.defineProperty.sham&&(Sl.sham=!0);var yl=z(El.exports),Rl=fs,vl=Array.isArray||function(e){return"Array"===Rl(e)},Al=TypeError,bl=function(e){if(e>9007199254740991)throw new Al("Maximum allowed index exceeded");return e},Ol=ys,Il=Kc,Cl=Ps,wl=function(e,t,r){Ol?Il.f(e,t,Cl(0,r)):e[t]=r},Nl=ys,Pl=vl,Dl=TypeError,Ll=Object.getOwnPropertyDescriptor,kl=Nl&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(e){return e instanceof TypeError}}()?function(e,t){if(Pl(e)&&!Ll(e,"length").writable)throw new Dl("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},Ml=gs,Ul=Va,xl=rs(Function.toString);Ml(Ul.inspectSource)||(Ul.inspectSource=function(e){return xl(e)});var Vl=Ul.inspectSource,Fl=rs,Bl=Jo,jl=gs,Wl=ud,Gl=Vl,Hl=function(){},Kl=Qs("Reflect","construct"),Yl=/^\s*(?:class|function)\b/,Xl=Fl(Yl.exec),Zl=!Yl.test(Hl),zl=function(e){if(!jl(e))return!1;try{return Kl(Hl,[],e),!0}catch(e){return!1}},Jl=function(e){if(!jl(e))return!1;switch(Wl(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Zl||!!Xl(Yl,Gl(e))}catch(e){return!0}};Jl.sham=!0;var Ql=!Kl||Bl((function(){var e;return zl(zl.call)||!zl(Object)||!zl((function(){e=!0}))||e}))?Jl:zl,ql=vl,$l=Ql,eh=Ks,th=sc("species"),rh=Array,nh=function(e){var t;return ql(e)&&(t=e.constructor,($l(t)&&(t===rh||ql(t.prototype))||eh(t)&&null===(t=t[th]))&&(t=void 0)),void 0===t?rh:t},ih=function(e,t){return new(nh(e))(0===t?0:t)},oh=Jo,sh=aa,ah=sc("species"),ch=function(e){return sh>=51||!oh((function(){var t=[];return(t.constructor={})[ah]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},uh=Ru,dh=Jo,lh=vl,hh=Ks,ph=Ga,fh=Mu,Eh=bl,mh=wl,_h=kl,Th=ih,gh=ch,Sh=aa,yh=sc("isConcatSpreadable"),Rh=Sh>=51||!dh((function(){var e=[];return e[yh]=!1,e.concat()[0]!==e})),vh=function(e){if(!hh(e))return!1;var t=e[yh];return void 0!==t?!!t:lh(e)};uh({target:"Array",proto:!0,arity:1,forced:!Rh||!gh("concat")},{concat:function(e){var t,r,n,i,o,s=ph(this),a=Th(s,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(vh(o=-1===t?s:arguments[t]))for(i=fh(o),Eh(c+i),r=0;r<i;r++,c++)r in o&&mh(a,c,o[r]);else Eh(c+1),mh(a,c++,o);return _h(a,c),a}});var Ah={},bh={},Oh=Ya,Ih=Gs,Ch=Bu.indexOf,wh=bh,Nh=rs([].push),Ph=function(e,t){var r,n=Ih(e),i=0,o=[];for(r in n)!Oh(wh,r)&&Oh(n,r)&&Nh(o,r);for(;t.length>i;)Oh(n,r=t[i++])&&(~Ch(o,r)||Nh(o,r));return o},Dh=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Lh=Ph,kh=Dh,Mh=Object.keys||function(e){return Lh(e,kh)},Uh=ys,xh=Yc,Vh=Kc,Fh=Jc,Bh=Gs,jh=Mh;Ah.f=Uh&&!xh?Object.defineProperties:function(e,t){Fh(e);for(var r,n=Bh(t),i=jh(t),o=i.length,s=0;o>s;)Vh.f(e,r=i[s++],n[r]);return e};var Wh,Gh=Qs("document","documentElement"),Hh=Qa,Kh=Ba("keys"),Yh=function(e){return Kh[e]||(Kh[e]=Hh(e))},Xh=Jc,Zh=Ah,zh=Dh,Jh=bh,Qh=Gh,qh=Sc,$h="prototype",ep="script",tp=Yh("IE_PROTO"),rp=function(){},np=function(e){return"<"+ep+">"+e+"</"+ep+">"},ip=function(e){e.write(np("")),e.close();var t=e.parentWindow.Object;return e=null,t},op=function(){try{Wh=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;op="undefined"!=typeof document?document.domain&&Wh?ip(Wh):(t=qh("iframe"),r="java"+ep+":",t.style.display="none",Qh.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(np("document.F=Object")),e.close(),e.F):ip(Wh);for(var n=zh.length;n--;)delete op[$h][zh[n]];return op()};Jh[tp]=!0;var sp=Object.create||function(e,t){var r;return null!==e?(rp[$h]=Xh(e),r=new rp,rp[$h]=null,r[tp]=e):r=op(),void 0===t?r:Zh.f(r,t)},ap={},cp=Ph,up=Dh.concat("length","prototype");ap.f=Object.getOwnPropertyNames||function(e){return cp(e,up)};var dp={},lp=rs([].slice),hp=fs,pp=Gs,fp=ap.f,Ep=lp,mp="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];dp.f=function(e){return mp&&"Window"===hp(e)?function(e){try{return fp(e)}catch(e){return Ep(mp)}}(e):fp(pp(e))};var _p={};_p.f=Object.getOwnPropertySymbols;var Tp=du,gp=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Tp(e,t,r),e},Sp=Kc,yp=function(e,t,r){return Sp.f(e,t,r)},Rp={},vp=sc;Rp.f=vp;var Ap,bp,Op,Ip=Ys,Cp=Ya,wp=Rp,Np=Kc.f,Pp=function(e){var t=Ip.Symbol||(Ip.Symbol={});Cp(t,e)||Np(t,e,{value:wp.f(e)})},Dp=As,Lp=Qs,kp=sc,Mp=gp,Up=function(){var e=Lp("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=kp("toPrimitive");t&&!t[n]&&Mp(t,n,(function(e){return Dp(r,this)}),{arity:1})},xp=ud,Vp=rd?{}.toString:function(){return"[object "+xp(this)+"]"},Fp=rd,Bp=Kc.f,jp=du,Wp=Ya,Gp=Vp,Hp=sc("toStringTag"),Kp=function(e,t,r,n){var i=r?e:e&&e.prototype;i&&(Wp(i,Hp)||Bp(i,Hp,{configurable:!0,value:t}),n&&!Fp&&jp(i,"toString",Gp))},Yp=gs,Xp=os.WeakMap,Zp=Yp(Xp)&&/native code/.test(String(Xp)),zp=os,Jp=Ks,Qp=du,qp=Ya,$p=Va,ef=Yh,tf=bh,rf="Object already initialized",nf=zp.TypeError,of=zp.WeakMap;if(Zp||$p.state){var sf=$p.state||($p.state=new of);sf.get=sf.get,sf.has=sf.has,sf.set=sf.set,Ap=function(e,t){if(sf.has(e))throw new nf(rf);return t.facade=e,sf.set(e,t),t},bp=function(e){return sf.get(e)||{}},Op=function(e){return sf.has(e)}}else{var af=ef("state");tf[af]=!0,Ap=function(e,t){if(qp(e,af))throw new nf(rf);return t.facade=e,Qp(e,af,t),t},bp=function(e){return qp(e,af)?e[af]:{}},Op=function(e){return qp(e,af)}}var cf={set:Ap,get:bp,has:Op,enforce:function(e){return Op(e)?bp(e):Ap(e,{})},getterFor:function(e){return function(t){var r;if(!Jp(t)||(r=bp(t)).type!==e)throw new nf("Incompatible receiver, "+e+" required");return r}}},uf=Hc,df=Us,lf=Ga,hf=Mu,pf=ih,ff=wl,Ef=function(e){var t=1===e,r=2===e,n=3===e,i=4===e,o=6===e,s=7===e,a=5===e||o;return function(c,u,d){for(var l,h,p=lf(c),f=df(p),E=hf(f),m=uf(u,d),_=0,T=0,g=t?pf(c,E):r||s?pf(c,0):void 0;E>_;_++)if((a||_ in f)&&(h=m(l=f[_],_,p),e))if(t)ff(g,_,h);else if(h)switch(e){case 3:return!0;case 5:return l;case 6:return _;case 2:ff(g,T++,l)}else switch(e){case 4:return!1;case 7:ff(g,T++,l)}return o?-1:n||i?i:g}},mf={forEach:Ef(0),map:Ef(1),filter:Ef(2),some:Ef(3),every:Ef(4),find:Ef(5),findIndex:Ef(6),filterReject:Ef(7)},_f=Ru,Tf=os,gf=As,Sf=rs,yf=ys,Rf=la,vf=Jo,Af=Ya,bf=ns,Of=Jc,If=Gs,Cf=mc,wf=hd,Nf=Ps,Pf=sp,Df=Mh,Lf=ap,kf=dp,Mf=_p,Uf=Ss,xf=Kc,Vf=Ah,Ff=bs,Bf=gp,jf=yp,Wf=Ba,Gf=bh,Hf=Qa,Kf=sc,Yf=Rp,Xf=Pp,Zf=Up,zf=Kp,Jf=cf,Qf=mf.forEach,qf=Yh("hidden"),$f="Symbol",eE="prototype",tE=Jf.set,rE=Jf.getterFor($f),nE=Object[eE],iE=Tf.Symbol,oE=iE&&iE[eE],sE=Tf.RangeError,aE=Tf.TypeError,cE=Tf.QObject,uE=Uf.f,dE=xf.f,lE=kf.f,hE=Ff.f,pE=Sf([].push),fE=Wf("symbols"),EE=Wf("op-symbols"),mE=Wf("wks"),_E=!cE||!cE[eE]||!cE[eE].findChild,TE=function(e,t,r){var n=uE(nE,t);return n&&delete nE[t],dE(e,t,r),n&&e!==nE&&dE(nE,t,n),e},gE=yf&&vf((function(){return 7!==Pf(dE({},"a",{get:function(){return dE(this,"a",{value:7}).a}})).a}))?TE:dE,SE=function(e,t){var r=fE[e]=Pf(oE);return tE(r,{type:$f,tag:e,description:t}),yf||(r.description=t),r},yE=function(e,t,r){e===nE&&yE(EE,t,r),Of(e);var n=Cf(t);return Of(r),Af(fE,n)?(("enumerable"in r?!r.enumerable:!Af(e,n)||Af(e,qf)&&e[qf][n])?(Af(e,qf)||dE(e,qf,Nf(1,Pf(null))),e[qf][n]=!0):(Af(e,qf)&&e[qf][n]&&(e[qf][n]=!1),r=Pf(r,{enumerable:Nf(0,!1)})),gE(e,n,r)):dE(e,n,r)},RE=function(e,t){Of(e);var r=If(t),n=Df(r).concat(OE(r));return Qf(n,(function(t){yf&&!gf(vE,r,t)||yE(e,t,r[t])})),e},vE=function(e){var t=Cf(e),r=gf(hE,this,t);return!(this===nE&&Af(fE,t)&&!Af(EE,t))&&(!(r||!Af(this,t)||!Af(fE,t)||Af(this,qf)&&this[qf][t])||r)},AE=function(e,t){var r=If(e),n=Cf(t);if(r!==nE||!Af(fE,n)||Af(EE,n)){var i=uE(r,n);return!i||!Af(fE,n)||Af(r,qf)&&r[qf][n]||(i.enumerable=!0),i}},bE=function(e){var t=lE(If(e)),r=[];return Qf(t,(function(e){Af(fE,e)||Af(Gf,e)||pE(r,e)})),r},OE=function(e){var t=e===nE,r=lE(t?EE:If(e)),n=[];return Qf(r,(function(e){!Af(fE,e)||t&&!Af(nE,e)||pE(n,fE[e])})),n};Rf||(iE=function(){if(bf(oE,this))throw new aE("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?wf(arguments[0]):void 0,t=Hf(e),r=function(e){var n=void 0===this?Tf:this;n===nE&&gf(r,EE,e),Af(n,qf)&&Af(n[qf],t)&&(n[qf][t]=!1);var i=Nf(1,e);try{gE(n,t,i)}catch(e){if(!(e instanceof sE))throw e;TE(n,t,i)}};return yf&&_E&&gE(nE,t,{configurable:!0,set:r}),SE(t,e)},Bf(oE=iE[eE],"toString",(function(){return rE(this).tag})),Bf(iE,"withoutSetter",(function(e){return SE(Hf(e),e)})),Ff.f=vE,xf.f=yE,Vf.f=RE,Uf.f=AE,Lf.f=kf.f=bE,Mf.f=OE,Yf.f=function(e){return SE(Kf(e),e)},yf&&jf(oE,"description",{configurable:!0,get:function(){return rE(this).description}})),_f({global:!0,constructor:!0,wrap:!0,forced:!Rf,sham:!Rf},{Symbol:iE}),Qf(Df(mE),(function(e){Xf(e)})),_f({target:$f,stat:!0,forced:!Rf},{useSetter:function(){_E=!0},useSimple:function(){_E=!1}}),_f({target:"Object",stat:!0,forced:!Rf,sham:!yf},{create:function(e,t){return void 0===t?Pf(e):RE(Pf(e),t)},defineProperty:yE,defineProperties:RE,getOwnPropertyDescriptor:AE}),_f({target:"Object",stat:!0,forced:!Rf},{getOwnPropertyNames:bE}),Zf(),zf(iE,$f),Gf[qf]=!0;var IE=la&&!!Symbol.for&&!!Symbol.keyFor,CE=Ru,wE=Qs,NE=Ya,PE=hd,DE=Ba,LE=IE,kE=DE("string-to-symbol-registry"),ME=DE("symbol-to-string-registry");CE({target:"Symbol",stat:!0,forced:!LE},{for:function(e){var t=PE(e);if(NE(kE,t))return kE[t];var r=wE("Symbol")(t);return kE[t]=r,ME[r]=t,r}});var UE=Ru,xE=Ya,VE=_a,FE=ga,BE=IE,jE=Ba("symbol-to-string-registry");UE({target:"Symbol",stat:!0,forced:!BE},{keyFor:function(e){if(!VE(e))throw new TypeError(FE(e)+" is not a symbol");if(xE(jE,e))return jE[e]}});var WE=Ks,GE=cf.get,HE=rs,KE=Ya,YE=SyntaxError,XE=parseInt,ZE=String.fromCharCode,zE=HE("".charAt),JE=HE("".slice),QE=HE(/./.exec),qE={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"\t"},$E=/^[\da-f]{4}$/i,em=/^[\u0000-\u001F]$/,tm=!Jo((function(){var e="9007199254740993",t=JSON.rawJSON(e);return!JSON.isRawJSON(t)||JSON.stringify(t)!==e})),rm=Ru,nm=Qs,im=ds,om=As,sm=rs,am=Jo,cm=vl,um=gs,dm=function(e){if(!WE(e))return!1;var t=GE(e);return!!t&&"RawJSON"===t.type},lm=_a,hm=fs,pm=hd,fm=lp,Em=function(e,t){for(var r=!0,n="";t<e.length;){var i=zE(e,t);if("\\"===i){var o=JE(e,t,t+2);if(KE(qE,o))n+=qE[o],t+=2;else{if("\\u"!==o)throw new YE('Unknown escape sequence: "'+o+'"');var s=JE(e,t+=2,t+4);if(!QE($E,s))throw new YE("Bad Unicode escape at: "+t);n+=ZE(XE(s,16)),t+=4}}else{if('"'===i){r=!1,t++;break}if(QE(em,i))throw new YE("Bad control character in string literal at: "+t);n+=i,t++}}if(r)throw new YE("Unterminated string at: "+t);return{value:n,end:t}},mm=Qa,_m=la,Tm=tm,gm=String,Sm=nm("JSON","stringify"),ym=sm(/./.exec),Rm=sm("".charAt),vm=sm("".charCodeAt),Am=sm("".replace),bm=sm("".slice),Om=sm([].push),Im=sm(1.1.toString),Cm=/[\uD800-\uDFFF]/g,wm=/^[\uD800-\uDBFF]$/,Nm=/^[\uDC00-\uDFFF]$/,Pm=mm(),Dm=Pm.length,Lm=!_m||am((function(){var e=nm("Symbol")("stringify detection");return"[null]"!==Sm([e])||"{}"!==Sm({a:e})||"{}"!==Sm(Object(e))})),km=am((function(){return'"\\udf06\\ud834"'!==Sm("\udf06\ud834")||'"\\udead"'!==Sm("\udead")})),Mm=Lm?function(e,t){var r=fm(arguments),n=xm(t);if(um(n)||void 0!==e&&!lm(e))return r[1]=function(e,t){if(um(n)&&(t=om(n,this,gm(e),t)),!lm(t))return t},im(Sm,null,r)}:Sm,Um=function(e,t,r){var n=Rm(r,t-1),i=Rm(r,t+1);return ym(wm,e)&&!ym(Nm,i)||ym(Nm,e)&&!ym(wm,n)?"\\u"+Im(vm(e,0),16):e},xm=function(e){if(um(e))return e;if(cm(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?Om(r,i):"number"!=typeof i&&"Number"!==hm(i)&&"String"!==hm(i)||Om(r,pm(i))}var o=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(cm(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}};Sm&&rm({target:"JSON",stat:!0,arity:3,forced:Lm||km||!Tm},{stringify:function(e,t,r){var n=xm(t),i=[],o=Mm(e,(function(e,t){var r=um(n)?om(n,this,gm(e),t):t;return!Tm&&dm(r)?Pm+(Om(i,r.rawJSON)-1):r}),r);if("string"!=typeof o)return o;if(km&&(o=Am(o,Cm,Um)),Tm)return o;for(var s="",a=o.length,c=0;c<a;c++){var u=Rm(o,c);if('"'===u){var d=Em(o,++c).end-1,l=bm(o,c,d);s+=bm(l,0,Dm)===Pm?i[bm(l,Dm)]:'"'+l+'"',c=d}else s+=u}return s}});var Vm=_p,Fm=Ga;Ru({target:"Object",stat:!0,forced:!la||Jo((function(){Vm.f(1)}))},{getOwnPropertySymbols:function(e){var t=Vm.f;return t?t(Fm(e)):[]}}),Pp("asyncDispose"),Pp("asyncIterator"),Pp("dispose"),Pp("hasInstance"),Pp("isConcatSpreadable"),Pp("iterator"),Pp("match"),Pp("matchAll"),Pp("replace"),Pp("search"),Pp("species"),Pp("split");var Bm=Up;Pp("toPrimitive"),Bm();var jm=Qs,Wm=Kp;Pp("toStringTag"),Wm(jm("Symbol"),"Symbol"),Pp("unscopables"),Kp(os.JSON,"JSON",!0);var Gm,Hm,Km,Ym=Ys.Symbol,Xm={},Zm=ys,zm=Ya,Jm=Function.prototype,Qm=Zm&&Object.getOwnPropertyDescriptor,qm=zm(Jm,"name"),$m={EXISTS:qm,PROPER:qm&&"something"===function(){}.name,CONFIGURABLE:qm&&(!Zm||Zm&&Qm(Jm,"name").configurable)},e_=!Jo((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),t_=Ya,r_=gs,n_=Ga,i_=e_,o_=Yh("IE_PROTO"),s_=Object,a_=s_.prototype,c_=i_?s_.getPrototypeOf:function(e){var t=n_(e);if(t_(t,o_))return t[o_];var r=t.constructor;return r_(r)&&t instanceof r?r.prototype:t instanceof s_?a_:null},u_=Jo,d_=gs,l_=Ks,h_=sp,p_=c_,f_=gp,E_=sc("iterator"),m_=!1;[].keys&&("next"in(Km=[].keys())?(Hm=p_(p_(Km)))!==Object.prototype&&(Gm=Hm):m_=!0);var __=!l_(Gm)||u_((function(){var e={};return Gm[E_].call(e)!==e}));d_((Gm=__?{}:h_(Gm))[E_])||f_(Gm,E_,(function(){return this}));var T_={IteratorPrototype:Gm,BUGGY_SAFARI_ITERATORS:m_},g_=T_.IteratorPrototype,S_=sp,y_=Ps,R_=Kp,v_=Xm,A_=function(){return this},b_=function(e,t,r,n){var i=t+" Iterator";return e.prototype=S_(g_,{next:y_(+!n,r)}),R_(e,i,!1,!0),v_[i]=A_,e},O_=rs,I_=va,C_=Ks,w_=function(e){return C_(e)||null===e},N_=String,P_=TypeError,D_=function(e,t,r){try{return O_(I_(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},L_=Ks,k_=Bs,M_=function(e){if(w_(e))return e;throw new P_("Can't set "+N_(e)+" as a prototype")},U_=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=D_(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return k_(r),M_(n),L_(r)?(t?e(r,n):r.__proto__=n,r):r}}():void 0),x_=Ru,V_=As,F_=$m,B_=b_,j_=c_,W_=Kp,G_=gp,H_=Xm,K_=T_,Y_=F_.PROPER,X_=K_.BUGGY_SAFARI_ITERATORS,Z_=sc("iterator"),z_="keys",J_="values",Q_="entries",q_=function(){return this},$_=function(e,t,r,n,i,o,s){B_(r,t,n);var a,c,u,d=function(e){if(e===i&&E)return E;if(!X_&&e&&e in p)return p[e];switch(e){case z_:case J_:case Q_:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[Z_]||p["@@iterator"]||i&&p[i],E=!X_&&f||d(i),m="Array"===t&&p.entries||f;if(m&&(a=j_(m.call(new e)))!==Object.prototype&&a.next&&(W_(a,l,!0,!0),H_[l]=q_),Y_&&i===J_&&f&&f.name!==J_&&(h=!0,E=function(){return V_(f,this)}),i)if(c={values:d(J_),keys:o?E:d(z_),entries:d(Q_)},s)for(u in c)(X_||h||!(u in p))&&G_(p,u,c[u]);else x_({target:t,proto:!0,forced:X_||h},c);return s&&p[Z_]!==E&&G_(p,Z_,E,{name:i}),H_[t]=E,c},eT=function(e,t){return{value:e,done:t}},tT=Gs,rT=Xm,nT=cf;Kc.f;var iT=$_,oT=eT,sT="Array Iterator",aT=nT.set,cT=nT.getterFor(sT);iT(Array,"Array",(function(e,t){aT(this,{type:sT,target:tT(e),index:0,kind:t})}),(function(){var e=cT(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,oT(void 0,!0);switch(e.kind){case"keys":return oT(r,!1);case"values":return oT(t[r],!1)}return oT([r,t[r]],!1)}),"values"),rT.Arguments=rT.Array;var uT={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},dT=os,lT=Kp,hT=Xm;for(var pT in uT)lT(dT[pT],pT),hT[pT]=hT.Array;var fT=Ym,ET=sc,mT=Kc.f,_T=ET("metadata"),TT=Function.prototype;void 0===TT[_T]&&mT(TT,_T,{value:null}),Pp("metadata");var gT=fT,ST=rs,yT=Qs("Symbol"),RT=yT.keyFor,vT=ST(yT.prototype.valueOf),AT=yT.isRegisteredSymbol||function(e){try{return void 0!==RT(vT(e))}catch(e){return!1}};Ru({target:"Symbol",stat:!0},{isRegisteredSymbol:AT});for(var bT=Ba,OT=Qs,IT=rs,CT=_a,wT=sc,NT=OT("Symbol"),PT=NT.isWellKnownSymbol,DT=OT("Object","getOwnPropertyNames"),LT=IT(NT.prototype.valueOf),kT=bT("wks"),MT=0,UT=DT(NT),xT=UT.length;MT<xT;MT++)try{var VT=UT[MT];CT(NT[VT])&&wT(VT)}catch(e){}var FT=function(e){if(PT&&PT(e))return!0;try{for(var t=LT(e),r=0,n=DT(kT),i=n.length;r<i;r++)if(kT[n[r]]==t)return!0}catch(e){}return!1};Ru({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:FT}),Pp("customMatcher"),Pp("observable"),Ru({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:AT}),Ru({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:FT}),Pp("matcher"),Pp("metadataKey"),Pp("patternMatch"),Pp("replaceAll");var BT=z(gT),jT=rs,WT=Iu,GT=hd,HT=Bs,KT=jT("".charAt),YT=jT("".charCodeAt),XT=jT("".slice),ZT=function(e){return function(t,r){var n,i,o=GT(HT(t)),s=WT(r),a=o.length;return s<0||s>=a?e?"":void 0:(n=YT(o,s))<55296||n>56319||s+1===a||(i=YT(o,s+1))<56320||i>57343?e?KT(o,s):n:e?XT(o,s,s+2):i-56320+(n-55296<<10)+65536}},zT={codeAt:ZT(!1),charAt:ZT(!0)},JT=zT.charAt,QT=hd,qT=cf,$T=$_,eg=eT,tg="String Iterator",rg=qT.set,ng=qT.getterFor(tg);$T(String,"String",(function(e){rg(this,{type:tg,string:QT(e),index:0})}),(function(){var e,t=ng(this),r=t.string,n=t.index;return n>=r.length?eg(void 0,!0):(e=JT(r,n),t.index+=e.length,eg(e,!1))}));var ig=z(Rp.f("iterator"));function og(e){return og="function"==typeof BT&&"symbol"==typeof ig?function(e){return typeof e}:function(e){return e&&"function"==typeof BT&&e.constructor===BT&&e!==BT.prototype?"symbol":typeof e},og(e)}var sg=z(Rp.f("toPrimitive"));function ag(e){var t=function(e,t){if("object"!==og(e)||null===e)return e;var r=e[sg];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==og(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===og(t)?t:String(t)}function cg(e,t,r){return(t=ag(t))in e?yl(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var ug=Jo,dg=function(e,t){var r=[][e];return!!r&&ug((function(){r.call(null,t||function(){return 1},1)}))},lg=mf.forEach,hg=dg("forEach")?[].forEach:function(e){return lg(this,e,arguments.length>1?arguments[1]:void 0)};Ru({target:"Array",proto:!0,forced:[].forEach!==hg},{forEach:hg});var pg=Zu("Array","forEach"),fg=ud,Eg=Ya,mg=ns,_g=pg,Tg=Array.prototype,gg={DOMTokenList:!0,NodeList:!0},Sg=function(e){var t=e.forEach;return e===Tg||mg(Tg,e)&&t===Tg.forEach||Eg(gg,fg(e))?_g:t},yg=z(Sg),Rg=Ga,vg=Mh;Ru({target:"Object",stat:!0,forced:Jo((function(){vg(1)}))},{keys:function(e){return vg(Rg(e))}});var Ag=z(Ys.Object.keys),bg=va,Og=Ga,Ig=Us,Cg=Mu,wg=TypeError,Ng="Reduce of empty array with no initial value",Pg=function(e){return function(t,r,n,i){var o=Og(t),s=Ig(o),a=Cg(o);if(bg(r),0===a&&n<2)throw new wg(Ng);var c=e?a-1:0,u=e?-1:1;if(n<2)for(;;){if(c in s){i=s[c],c+=u;break}if(c+=u,e?c<0:a<=c)throw new wg(Ng)}for(;e?c>=0:a>c;c+=u)c in s&&(i=r(i,s[c],c,o));return i}},Dg={left:Pg(!1),right:Pg(!0)},Lg=os,kg=ea,Mg=fs,Ug=function(e){return kg.slice(0,e.length)===e},xg=Ug("Bun/")?"BUN":Ug("Cloudflare-Workers")?"CLOUDFLARE":Ug("Deno/")?"DENO":Ug("Node.js/")?"NODE":Lg.Bun&&"string"==typeof Bun.version?"BUN":Lg.Deno&&"object"==typeof Deno.version?"DENO":"process"===Mg(Lg.process)?"NODE":Lg.window&&Lg.document?"BROWSER":"REST",Vg="NODE"===xg,Fg=Dg.left;Ru({target:"Array",proto:!0,forced:!Vg&&aa>79&&aa<83||!dg("reduce")},{reduce:function(e){var t=arguments.length;return Fg(this,e,t,t>1?arguments[1]:void 0)}});var Bg=Zu("Array","reduce"),jg=ns,Wg=Bg,Gg=Array.prototype,Hg=function(e){var t=e.reduce;return e===Gg||jg(Gg,e)&&t===Gg.reduce?Wg:t},Kg=Hg,Yg=z(Kg),Xg=Ru,Zg=vl,zg=rs([].reverse),Jg=[1,2];Xg({target:"Array",proto:!0,forced:String(Jg)===String(Jg.reverse())},{reverse:function(){return Zg(this)&&(this.length=this.length),zg(this)}});var Qg=Zu("Array","reverse"),qg=ns,$g=Qg,eS=Array.prototype,tS=function(e){var t=e.reverse;return e===eS||qg(eS,e)&&t===eS.reverse?$g:t},rS=tS,nS=z(rS),iS=Ru,oS=vl,sS=Ql,aS=Ks,cS=Pu,uS=Mu,dS=Gs,lS=wl,hS=kl,pS=sc,fS=lp,ES=ch("slice"),mS=pS("species"),_S=Array,TS=Math.max;iS({target:"Array",proto:!0,forced:!ES},{slice:function(e,t){var r,n,i,o=dS(this),s=uS(o),a=cS(e,s),c=cS(void 0===t?s:t,s);if(oS(o)&&(r=o.constructor,(sS(r)&&(r===_S||oS(r.prototype))||aS(r)&&null===(r=r[mS]))&&(r=void 0),r===_S||void 0===r))return fS(o,a,c);for(n=new(void 0===r?_S:r)(TS(c-a,0)),i=0;a<c;a++,i++)a in o&&lS(n,i,o[a]);return hS(n,i),n}});var gS=Zu("Array","slice"),SS=ns,yS=gS,RS=Array.prototype,vS=function(e){var t=e.slice;return e===RS||SS(RS,e)&&t===RS.slice?yS:t},AS=z(vS);function bS(e,t,r,n,i){var o,s,a,c={};return yg(o=Ag(n)).call(o,(function(e){c[e]=n[e]})),c.enumerable=!!c.enumerable,c.configurable=!!c.configurable,("value"in c||c.initializer)&&(c.writable=!0),c=Yg(s=nS(a=AS(r).call(r)).call(a)).call(s,(function(r,n){return n(e,t,r)||r}),c),i&&void 0!==c.initializer&&(c.value=c.initializer?c.initializer.call(i):void 0,c.initializer=void 0),void 0===c.initializer&&(yl(e,t,c),c=null),c}var OS=Qs,IS=ap,CS=_p,wS=Jc,NS=rs([].concat),PS=OS("Reflect","ownKeys")||function(e){var t=IS.f(wS(e)),r=CS.f;return r?NS(t,r(e)):t},DS=Ya,LS=PS,kS=Ss,MS=Kc,US=Ks,xS=du,VS=Error,FS=rs("".replace),BS=String(new VS("zxcasd").stack),jS=/\n\s*at [^:]*:[^\n]*/,WS=jS.test(BS),GS=Ps,HS=!Jo((function(){var e=new Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",GS(1,7)),7!==e.stack)})),KS=du,YS=function(e,t){if(WS&&"string"==typeof e&&!VS.prepareStackTrace)for(;t--;)e=FS(e,jS,"");return e},XS=HS,ZS=Error.captureStackTrace,zS=Xm,JS=sc("iterator"),QS=Array.prototype,qS=function(e){return void 0!==e&&(zS.Array===e||QS[JS]===e)},$S=ud,ey=Oa,ty=xs,ry=Xm,ny=sc("iterator"),iy=function(e){if(!ty(e))return ey(e,ny)||ey(e,"@@iterator")||ry[$S(e)]},oy=As,sy=va,ay=Jc,cy=ga,uy=iy,dy=TypeError,ly=function(e,t){var r=arguments.length<2?uy(e):t;if(sy(r))return ay(oy(r,e));throw new dy(cy(e)+" is not iterable")},hy=As,py=Jc,fy=Oa,Ey=function(e,t,r){var n,i;py(e);try{if(!(n=fy(e,"return"))){if("throw"===t)throw r;return r}n=hy(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return py(n),r},my=Hc,_y=As,Ty=Jc,gy=ga,Sy=qS,yy=Mu,Ry=ns,vy=ly,Ay=iy,by=Ey,Oy=TypeError,Iy=function(e,t){this.stopped=e,this.result=t},Cy=Iy.prototype,wy=function(e,t,r){var n,i,o,s,a,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),E=my(t,d),m=function(e){var t=n;return n=void 0,t&&by(t,"normal"),new Iy(!0,e)},_=function(e){return l?(Ty(e),f?E(e[0],e[1],m):E(e[0],e[1])):f?E(e,m):E(e)};if(h)n=e.iterator;else if(p)n=e;else{if(!(i=Ay(e)))throw new Oy(gy(e)+" is not iterable");if(Sy(i)){for(o=0,s=yy(e);s>o;o++)if((a=_(e[o]))&&Ry(Cy,a))return a;return new Iy(!1)}n=vy(e,i)}for(c=h?e.next:n.next;!(u=_y(c,n)).done;){var T=u.value;try{a=_(T)}catch(e){if(!n)throw e;by(n,"throw",e)}if("object"==typeof a&&a&&Ry(Cy,a))return a}return new Iy(!1)},Ny=hd,Py=Ru,Dy=ns,Ly=c_,ky=U_,My=function(e,t,r){for(var n=LS(t),i=MS.f,o=kS.f,s=0;s<n.length;s++){var a=n[s];DS(e,a)||r&&DS(r,a)||i(e,a,o(t,a))}},Uy=sp,xy=du,Vy=Ps,Fy=function(e,t){US(t)&&"cause"in t&&xS(e,"cause",t.cause)},By=function(e,t,r,n){XS&&(ZS?ZS(e,t):KS(e,"stack",YS(r,n)))},jy=wy,Wy=function(e,t){return void 0===e?arguments.length<2?"":t:Ny(e)},Gy=sc("toStringTag"),Hy=Error,Ky=[].push,Yy=function(e,t){var r,n=Dy(Xy,this);ky?r=ky(new Hy,n?Ly(this):Xy):(r=n?this:Uy(Xy),xy(r,Gy,"Error")),void 0!==t&&xy(r,"message",Wy(t)),By(r,Yy,r.stack,1),arguments.length>2&&Fy(r,arguments[2]);var i=[];return jy(e,Ky,{that:i}),xy(r,"errors",i),r};ky?ky(Yy,Hy):My(Yy,Hy,{name:!0});var Xy=Yy.prototype=Uy(Hy.prototype,{constructor:Vy(1,Yy),message:Vy(1,""),name:Vy(1,"AggregateError")});Py({global:!0,constructor:!0,arity:2},{AggregateError:Yy});var Zy,zy,Jy,Qy,qy=Qs,$y=yp,eR=ys,tR=sc("species"),rR=ns,nR=TypeError,iR=function(e,t){if(rR(t,e))return e;throw new nR("Incorrect invocation")},oR=Ql,sR=ga,aR=TypeError,cR=Jc,uR=function(e){if(oR(e))return e;throw new aR(sR(e)+" is not a constructor")},dR=xs,lR=sc("species"),hR=function(e,t){var r,n=cR(e).constructor;return void 0===n||dR(r=cR(n)[lR])?t:uR(r)},pR=TypeError,fR=function(e,t){if(e<t)throw new pR("Not enough arguments");return e},ER=ea,mR=/ipad|iphone|ipod/i.test(ER)&&/applewebkit/i.test(ER),_R=os,TR=ds,gR=Hc,SR=gs,yR=Ya,RR=Jo,vR=Gh,AR=lp,bR=Sc,OR=fR,IR=mR,CR=Vg,wR=_R.setImmediate,NR=_R.clearImmediate,PR=_R.process,DR=_R.Dispatch,LR=_R.Function,kR=_R.MessageChannel,MR=_R.String,UR=0,xR={},VR="onreadystatechange";RR((function(){Zy=_R.location}));var FR=function(e){if(yR(xR,e)){var t=xR[e];delete xR[e],t()}},BR=function(e){return function(){FR(e)}},jR=function(e){FR(e.data)},WR=function(e){_R.postMessage(MR(e),Zy.protocol+"//"+Zy.host)};wR&&NR||(wR=function(e){OR(arguments.length,1);var t=SR(e)?e:LR(e),r=AR(arguments,1);return xR[++UR]=function(){TR(t,void 0,r)},zy(UR),UR},NR=function(e){delete xR[e]},CR?zy=function(e){PR.nextTick(BR(e))}:DR&&DR.now?zy=function(e){DR.now(BR(e))}:kR&&!IR?(Qy=(Jy=new kR).port2,Jy.port1.onmessage=jR,zy=gR(Qy.postMessage,Qy)):_R.addEventListener&&SR(_R.postMessage)&&!_R.importScripts&&Zy&&"file:"!==Zy.protocol&&!RR(WR)?(zy=WR,_R.addEventListener("message",jR,!1)):zy=VR in bR("script")?function(e){vR.appendChild(bR("script"))[VR]=function(){vR.removeChild(this),FR(e)}}:function(e){setTimeout(BR(e),0)});var GR={set:wR,clear:NR},HR=os,KR=ys,YR=Object.getOwnPropertyDescriptor,XR=function(e){if(!KR)return HR[e];var t=YR(HR,e);return t&&t.value},ZR=function(){this.head=null,this.tail=null};ZR.prototype={add:function(e){var t={item:e,next:null},r=this.tail;r?r.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return null===(this.head=e.next)&&(this.tail=null),e.item}};var zR,JR,QR,qR,$R,ev=ZR,tv=/ipad|iphone|ipod/i.test(ea)&&"undefined"!=typeof Pebble,rv=/web0s(?!.*chrome)/i.test(ea),nv=os,iv=XR,ov=Hc,sv=GR.set,av=ev,cv=mR,uv=tv,dv=rv,lv=Vg,hv=nv.MutationObserver||nv.WebKitMutationObserver,pv=nv.document,fv=nv.process,Ev=nv.Promise,mv=iv("queueMicrotask");if(!mv){var _v=new av,Tv=function(){var e,t;for(lv&&(e=fv.domain)&&e.exit();t=_v.get();)try{t()}catch(e){throw _v.head&&zR(),e}e&&e.enter()};cv||lv||dv||!hv||!pv?!uv&&Ev&&Ev.resolve?((qR=Ev.resolve(void 0)).constructor=Ev,$R=ov(qR.then,qR),zR=function(){$R(Tv)}):lv?zR=function(){fv.nextTick(Tv)}:(sv=ov(sv,nv),zR=function(){sv(Tv)}):(JR=!0,QR=pv.createTextNode(""),new hv(Tv).observe(QR,{characterData:!0}),zR=function(){QR.data=JR=!JR}),mv=function(e){_v.head||zR(),_v.add(e)}}var gv=mv,Sv=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},yv=os.Promise,Rv=os,vv=yv,Av=gs,bv=Bc,Ov=Vl,Iv=sc,Cv=xg,wv=aa,Nv=vv&&vv.prototype,Pv=Iv("species"),Dv=!1,Lv=Av(Rv.PromiseRejectionEvent),kv=bv("Promise",(function(){var e=Ov(vv),t=e!==String(vv);if(!t&&66===wv)return!0;if(!Nv.catch||!Nv.finally)return!0;if(!wv||wv<51||!/native code/.test(e)){var r=new vv((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Pv]=n,!(Dv=r.then((function(){}))instanceof n))return!0}return!(t||"BROWSER"!==Cv&&"DENO"!==Cv||Lv)})),Mv={CONSTRUCTOR:kv,REJECTION_EVENT:Lv,SUBCLASSING:Dv},Uv={},xv=va,Vv=TypeError,Fv=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw new Vv("Bad Promise constructor");t=e,r=n})),this.resolve=xv(t),this.reject=xv(r)};Uv.f=function(e){return new Fv(e)};var Bv,jv,Wv,Gv=Ru,Hv=Vg,Kv=os,Yv=Ys,Xv=As,Zv=gp,zv=Kp,Jv=function(e){var t=qy(e);eR&&t&&!t[tR]&&$y(t,tR,{configurable:!0,get:function(){return this}})},Qv=va,qv=gs,$v=Ks,eA=iR,tA=hR,rA=GR.set,nA=gv,iA=function(e,t){try{1===arguments.length?console.error(e):console.error(e,t)}catch(e){}},oA=Sv,sA=ev,aA=cf,cA=yv,uA=Mv,dA=Uv,lA="Promise",hA=uA.CONSTRUCTOR,pA=uA.REJECTION_EVENT,fA=aA.getterFor(lA),EA=aA.set,mA=cA&&cA.prototype,_A=cA,TA=mA,gA=Kv.TypeError,SA=Kv.document,yA=Kv.process,RA=dA.f,vA=RA,AA=!!(SA&&SA.createEvent&&Kv.dispatchEvent),bA="unhandledrejection",OA=function(e){var t;return!(!$v(e)||!qv(t=e.then))&&t},IA=function(e,t){var r,n,i,o=t.value,s=1===t.state,a=s?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{a?(s||(2===t.rejection&&DA(t),t.rejection=1),!0===a?r=o:(d&&d.enter(),r=a(o),d&&(d.exit(),i=!0)),r===e.promise?u(new gA("Promise-chain cycle")):(n=OA(r))?Xv(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},CA=function(e,t){e.notified||(e.notified=!0,nA((function(){for(var r,n=e.reactions;r=n.get();)IA(r,e);e.notified=!1,t&&!e.rejection&&NA(e)})))},wA=function(e,t,r){var n,i;AA?((n=SA.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),Kv.dispatchEvent(n)):n={promise:t,reason:r},!pA&&(i=Kv["on"+e])?i(n):e===bA&&iA("Unhandled promise rejection",r)},NA=function(e){Xv(rA,Kv,(function(){var t,r=e.facade,n=e.value;if(PA(e)&&(t=oA((function(){Hv?yA.emit("unhandledRejection",n,r):wA(bA,r,n)})),e.rejection=Hv||PA(e)?2:1,t.error))throw t.value}))},PA=function(e){return 1!==e.rejection&&!e.parent},DA=function(e){Xv(rA,Kv,(function(){var t=e.facade;Hv?yA.emit("rejectionHandled",t):wA("rejectionhandled",t,e.value)}))},LA=function(e,t,r){return function(n){e(t,n,r)}},kA=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,CA(e,!0))},MA=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw new gA("Promise can't be resolved itself");var n=OA(t);n?nA((function(){var r={done:!1};try{Xv(n,t,LA(MA,r,e),LA(kA,r,e))}catch(t){kA(r,t,e)}})):(e.value=t,e.state=1,CA(e,!1))}catch(t){kA({done:!1},t,e)}}};hA&&(TA=(_A=function(e){eA(this,TA),Qv(e),Xv(Bv,this);var t=fA(this);try{e(LA(MA,t),LA(kA,t))}catch(e){kA(t,e)}}).prototype,(Bv=function(e){EA(this,{type:lA,done:!1,notified:!1,parent:!1,reactions:new sA,rejection:!1,state:0,value:null})}).prototype=Zv(TA,"then",(function(e,t){var r=fA(this),n=RA(tA(this,_A));return r.parent=!0,n.ok=!qv(e)||e,n.fail=qv(t)&&t,n.domain=Hv?yA.domain:void 0,0===r.state?r.reactions.add(n):nA((function(){IA(n,r)})),n.promise})),jv=function(){var e=new Bv,t=fA(e);this.promise=e,this.resolve=LA(MA,t),this.reject=LA(kA,t)},dA.f=RA=function(e){return e===_A||e===Wv?new jv(e):vA(e)}),Gv({global:!0,constructor:!0,wrap:!0,forced:hA},{Promise:_A}),Wv=Yv.Promise,zv(_A,lA,!1,!0),Jv(lA);var UA=sc("iterator"),xA=!1;try{var VA=0,FA={next:function(){return{done:!!VA++}},return:function(){xA=!0}};FA[UA]=function(){return this},Array.from(FA,(function(){throw 2}))}catch(e){}var BA=function(e,t){try{if(!t&&!xA)return!1}catch(e){return!1}var r=!1;try{var n={};n[UA]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},jA=yv,WA=Mv.CONSTRUCTOR||!BA((function(e){jA.all(e).then(void 0,(function(){}))})),GA=As,HA=va,KA=Uv,YA=Sv,XA=wy;Ru({target:"Promise",stat:!0,forced:WA},{all:function(e){var t=this,r=KA.f(t),n=r.resolve,i=r.reject,o=YA((function(){var r=HA(t.resolve),o=[],s=0,a=1;XA(e,(function(e){var c=s++,u=!1;a++,GA(r,t,e).then((function(e){u||(u=!0,o[c]=e,--a||n(o))}),i)})),--a||n(o)}));return o.error&&i(o.value),r.promise}});var ZA=Ru,zA=Mv.CONSTRUCTOR;yv&&yv.prototype,ZA({target:"Promise",proto:!0,forced:zA,real:!0},{catch:function(e){return this.then(void 0,e)}});var JA=As,QA=va,qA=Uv,$A=Sv,eb=wy;Ru({target:"Promise",stat:!0,forced:WA},{race:function(e){var t=this,r=qA.f(t),n=r.reject,i=$A((function(){var i=QA(t.resolve);eb(e,(function(e){JA(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var tb=Uv;Ru({target:"Promise",stat:!0,forced:Mv.CONSTRUCTOR},{reject:function(e){var t=tb.f(this);return(0,t.reject)(e),t.promise}});var rb=Jc,nb=Ks,ib=Uv,ob=function(e,t){if(rb(e),nb(t)&&t.constructor===e)return t;var r=ib.f(e);return(0,r.resolve)(t),r.promise},sb=Ru,ab=yv,cb=Mv.CONSTRUCTOR,ub=ob,db=Qs("Promise"),lb=!cb;sb({target:"Promise",stat:!0,forced:true},{resolve:function(e){return ub(lb&&this===db?ab:this,e)}});var hb=As,pb=va,fb=Uv,Eb=Sv,mb=wy;Ru({target:"Promise",stat:!0,forced:WA},{allSettled:function(e){var t=this,r=fb.f(t),n=r.resolve,i=r.reject,o=Eb((function(){var r=pb(t.resolve),i=[],o=0,s=1;mb(e,(function(e){var a=o++,c=!1;s++,hb(r,t,e).then((function(e){c||(c=!0,i[a]={status:"fulfilled",value:e},--s||n(i))}),(function(e){c||(c=!0,i[a]={status:"rejected",reason:e},--s||n(i))}))})),--s||n(i)}));return o.error&&i(o.value),r.promise}});var _b=As,Tb=va,gb=Qs,Sb=Uv,yb=Sv,Rb=wy,vb="No one promise resolved";Ru({target:"Promise",stat:!0,forced:WA},{any:function(e){var t=this,r=gb("AggregateError"),n=Sb.f(t),i=n.resolve,o=n.reject,s=yb((function(){var n=Tb(t.resolve),s=[],a=0,c=1,u=!1;Rb(e,(function(e){var d=a++,l=!1;c++,_b(n,t,e).then((function(e){l||u||(u=!0,i(e))}),(function(e){l||u||(l=!0,s[d]=e,--c||o(new r(s,vb)))}))})),--c||o(new r(s,vb))}));return s.error&&o(s.value),n.promise}});var Ab=Ru,bb=ds,Ob=lp,Ib=Uv,Cb=va,wb=Sv,Nb=os.Promise,Pb=!1;Ab({target:"Promise",stat:!0,forced:!Nb||!Nb.try||wb((function(){Nb.try((function(e){Pb=8===e}),8)})).error||!Pb},{try:function(e){var t=arguments.length>1?Ob(arguments,1):[],r=Ib.f(this),n=wb((function(){return bb(Cb(e),void 0,t)}));return(n.error?r.reject:r.resolve)(n.value),r.promise}});var Db=Uv;Ru({target:"Promise",stat:!0},{withResolvers:function(){var e=Db.f(this);return{promise:e.promise,resolve:e.resolve,reject:e.reject}}});var Lb=Ru,kb=yv,Mb=Jo,Ub=Qs,xb=gs,Vb=hR,Fb=ob,Bb=kb&&kb.prototype;Lb({target:"Promise",proto:!0,real:!0,forced:!!kb&&Mb((function(){Bb.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=Vb(this,Ub("Promise")),r=xb(e);return this.then(r?function(r){return Fb(t,e()).then((function(){return r}))}:e,r?function(r){return Fb(t,e()).then((function(){throw r}))}:e)}});var jb=z(Ys.Promise);class Wb extends ii{set _mediaStreamTrack(e){e!==this.mediaStreamTrack&&(this.safeEmit(qd.TRACK_UPDATED,e),this.mediaStreamTrack=e)}get _mediaStreamTrack(){return this.mediaStreamTrack}constructor(e,t){super(),cg(this,"trackMediaType",void 0),cg(this,"_ID",void 0),cg(this,"_rtpTransceiver",void 0),cg(this,"_lowRtpTransceiver",void 0),cg(this,"_hints",[]),cg(this,"_isClosed",!1),cg(this,"_originMediaStreamTrack",void 0),cg(this,"mediaStreamTrack",void 0),cg(this,"_external",{}),this._ID=t||wi(8,"track-"),this._originMediaStreamTrack=e,this.mediaStreamTrack=e,jd(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||Oi((()=>{var e;Bo.reportApiInvoke(null,{name:ci.GET_MEDIA_STREAM_TRACK,options:[],tag:ui.TRACER}).onSuccess((null===(e=this._mediaStreamTrack)||void 0===e?void 0:e.label)||"")}),this.mediaStreamTrack.id||this.getTrackId()),this._mediaStreamTrack}getRTCRtpTransceiver(e){return e===zd.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,Wd(this),this.emit($d.CLOSED),this.removeAllListeners(qd.SEI_RECEIVED)}_updateRtpTransceiver(e,t){if(t===zd.LOW_STREAM){if(this._lowRtpTransceiver===e)return;this._lowRtpTransceiver=e}else{if(this._rtpTransceiver===e)return;this._rtpTransceiver=e}this.emit(qd.TRANSCEIVER_UPDATED,e,t)}}class Gb extends Wb{get isExternalTrack(){return this._isExternalTrack}get muted(){return this._muted}get enabled(){return this._enabled}get processorContext(){return this._processorContext}constructor(e,t){super(e,t),cg(this,"_enabled",!0),cg(this,"_muted",!1),cg(this,"_isExternalTrack",!1),cg(this,"_isClosed",!1),cg(this,"_enabledMutex",void 0),cg(this,"processor",void 0),cg(this,"_processorContext",void 0),cg(this,"_handleTrackEnded",(()=>{this.onTrackEnded()})),this._enabledMutex=new Fi("".concat(this.getTrackId())),e.addEventListener("ended",this._handleTrackEnded)}getTrackLabel(){var e,t;return null!==(e=null===(t=this._originMediaStreamTrack)||void 0===t?void 0:t.label)&&void 0!==e?e:""}close(){this._isClosed||(this.stop(),this._originMediaStreamTrack.stop(),this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack.stop(),this._mediaStreamTrack=null),this._originMediaStreamTrack=null,this._enabledMutex=null,go.debug("[".concat(this.getTrackId(),"] close")),this.emit(Xd.NEED_CLOSE),super.close())}async _updateOriginMediaStreamTrack(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._isExternalTrack=r,e!==this._originMediaStreamTrack&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),t&&this._originMediaStreamTrack.stop()),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,this._muted&&(this._originMediaStreamTrack.enabled=!1),this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await pi(this,Xd.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){go.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit($d.TRACK_ENDED)}stateCheck(e,t){if(go.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),zn(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new Zn(Xn.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print("error",go);if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new Zn(Xn.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print("error",go)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():jb.resolve([])}}function Hb(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const Kb=window.AudioContext||window.webkitAudioContext;let Yb,Xb=null;const Zb=new class extends ii{constructor(){super(...arguments),cg(this,"prevState",void 0),cg(this,"curState",void 0),cg(this,"currentTime",void 0),cg(this,"currentTimeStuckAt",void 0),cg(this,"interruptDetectorTrack",void 0),cg(this,"onLocalAudioTrackMute",(()=>{go.info("ios15-interruption-start"),this.emit(zo.IOS_15_16_INTERRUPTION_START)})),cg(this,"onLocalAudioTrackUnmute",(async()=>{go.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?go.info("ios15-interruption-end-canceled"):(Xb&&await Xb.suspend(),this.emit(zo.IOS_15_16_INTERRUPTION_END))}))}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){go.debug("webaudio bindInterruptDetectorTrack ".concat(e.getTrackId())),this.interruptDetectorTrack||(this.interruptDetectorTrack=e,this.interruptDetectorTrack._mediaStreamTrack.onmute=this.onLocalAudioTrackMute,this.interruptDetectorTrack._mediaStreamTrack.onunmute=this.onLocalAudioTrackUnmute)}unbindInterruptDetectorTrack(e){go.debug("webaudio unbindInterruptDetectorTrack ".concat(e.getTrackId())),this.interruptDetectorTrack&&this.interruptDetectorTrack===e&&(this.interruptDetectorTrack._mediaStreamTrack&&(this.interruptDetectorTrack._mediaStreamTrack.onmute=null,this.interruptDetectorTrack._mediaStreamTrack.onunmute=null),this.interruptDetectorTrack=void 0)}};function zb(){if(!Kb)return void go.error("your browser is not support web audio");go.info("create audio context");const e=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Hb(Object(r),!0).forEach((function(t){cg(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Hb(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},to("WEBAUDIO_INIT_OPTIONS"));go.debug("audio context init option:",JSON.stringify(e)),Xb=new Kb(e),Zb.curState=Xb.state,Xb.onstatechange=()=>{Zb.prevState=Zb.curState,Zb.curState=Xb?Xb.state:void 0;const e=Zb.prevState,t=Zb.curState,r="running"===t,n="interrupted"===t,i="running"===e,o="suspended"===e,s="interrupted"===e,a=_n().osVersion;(On()||Mn())&&i&&n&&(go.info("ios".concat(a,"-interruption-start")),Zb.emit(zo.IOS_INTERRUPTION_START)),(On()||Mn())&&(o||s)&&r&&(go.info("ios".concat(a,"-interruption-end")),Zb.emit(zo.IOS_INTERRUPTION_END)),e!==t&&Zb.emit(zo.STATE_CHANGE,t,e)},setInterval((()=>{var e;const t=null===(e=Xb)||void 0===e?void 0:e.currentTime;if(Zb.currentTime!==t)Zb.currentTimeStuckAt&&(go.debug("AudioContext current time resume at ".concat(t)),Zb.currentTimeStuckAt=void 0),Zb.currentTime=t;else{if(t!==Zb.currentTimeStuckAt){Bo.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:ui.TRACER}).onSuccess(),go.warning("AudioContext current time stuck at ".concat(t))}Zb.currentTimeStuckAt=t}}),5e3),async function(e){const t=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","touchend","keydown","keyup"];let r,n=!1,i=!1,o=!1;function s(t){"running"===e.state?a(!1):On()||Mn()?"suspended"===e.state&&(a(!0),t&&e.resume().then(u,u)):"closed"!==e.state&&(a(!0),t&&e.resume().then(u,u))}function a(e){if(n!==e){n=e;for(let r=0,n=t;r<n.length;r+=1){const t=n[r];e?window.addEventListener(t,d,{capture:!0,passive:!0}):window.removeEventListener(t,d,{capture:!0,passive:!0})}}}function c(){s(!0)}function u(){s(!1)}function d(){s(!0)}function l(){let e;try{e=r.play(),e?e.then(f,f):(r.addEventListener("playing",f),r.addEventListener("abort",f),r.addEventListener("error",f))}catch(e){f()}}function h(e){o||(r.paused?e?(p(!1),o=!0,l()):p(!0):p(!1))}function p(e){if(i!==e){i=e;for(let r=0,n=t;r<n.length;r++){const t=n[r];e?window.addEventListener(t,E,{capture:!0,passive:!0}):window.removeEventListener(t,E,{capture:!0,passive:!0})}}}function f(){r.removeEventListener("playing",f),r.removeEventListener("abort",f),r.removeEventListener("error",f),o=!1,h(!1)}function E(){h(!0)}let m;if(On()&&to("IOS_BG_TAG")){const t=e.createMediaStreamDestination(),n=document.createElement("div");n.innerHTML="<audio x-webkit-airplay='deny'></audio>",r=n.children.item(0),r.controls=!1,r.disableRemotePlayback=!0,r.preload="auto",r.srcObject=t.stream,m=()=>{if(to("IOS_AUTO_RESTART_BG_TAG")&&r&&r.srcObject&&!o&&(!r.paused||!0!==i)){r.paused||r.pause();try{o=!0,l()}catch(e){o=!1}return!0}},h(!0)}return Zb.on(zo.STATE_CHANGE,c),s(!1),m}(Xb).then((e=>{Yb=e}))}function Jb(){if(Yb){if(Yb()){Bo.reportApiInvoke(null,{name:"BG_AUDIO_TAG_RESTART",options:{},tag:ui.TRACER}).onSuccess(),go.debug("restart background audio tag success")}}}function Qb(){if(!Xb){if(zb(),!Xb)throw new Zn(Xn.NOT_SUPPORTED,"can not create audio context");return Xb}return Xb}function qb(){return!!Xb}function $b(e){if(function(){if(null!==tO)return tO;const e=Qb(),t=e.createBufferSource(),r=e.createGain(),n=e.createGain();t.connect(r),t.connect(n),t.disconnect(r);let i=!1;try{t.disconnect(r)}catch(e){i=!0}return t.disconnect(),tO=i,i}())return;const t=e.connect,r=e.disconnect;e.connect=(r,n,i)=>{var o;return e._inputNodes||(e._inputNodes=[]),Id(o=e._inputNodes).call(o,r)||(r instanceof AudioNode?(e._inputNodes.push(r),t.call(e,r,n,i)):t.call(e,r,n)),e},e.disconnect=(n,i,o)=>{r.call(e),n?yi(e._inputNodes,n):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function eO(e){const t=Qb();return new jb(((r,n)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{n(new Zn(Xn.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let tO=null;let rO=null;function nO(e){for(let t=0;t<e.outputBuffer.numberOfChannels;t+=1){const r=e.outputBuffer.getChannelData(t);for(let e=0;e<r.length;e+=1)r[e]=0}return e.inputBuffer}var iO=z(Kg);class oO{constructor(){cg(this,"context",void 0),cg(this,"analyserNode",void 0),cg(this,"sourceNode",void 0),this.context=Qb(),this.analyserNode=this.context.createAnalyser(),this.analyserNode.fftSize=2048,this.analyserNode.smoothingTimeConstant=.4}updateSource(e){if(e!==this.sourceNode){if(this.sourceNode)try{this.sourceNode.disconnect(this.analyserNode)}catch(e){}this.sourceNode=e,null==e||e.connect(this.analyserNode)}}getVolumeLevel(){if(!this.sourceNode)return 0;if(!this.context||On()||Mn()||"running"!==this.context.state&&this.context.resume(),!this.analyserNode)return 0;const e=new Float32Array(this.analyserNode.fftSize);if(this.analyserNode.getFloatTimeDomainData)this.analyserNode.getFloatTimeDomainData(e);else{const t=new Uint8Array(this.analyserNode.fftSize);this.analyserNode.getByteTimeDomainData(t);for(let r=0;r<e.length;++r)e[r]=t[r]/128-1}const t=iO(e).call(e,((e,t)=>e+t*t),0)/e.length;return Math.max(10*Math.log10(t)+100,0)/100}getAnalyserNode(){return this.analyserNode}rebuildAnalyser(){try{var e,t;null===(e=this.sourceNode)||void 0===e||e.disconnect(this.analyserNode),this.analyserNode=this.context.createAnalyser(),this.analyserNode.fftSize=2048,this.analyserNode.smoothingTimeConstant=.4,null===(t=this.sourceNode)||void 0===t||t.connect(this.analyserNode)}catch(e){go.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class sO extends ii{get processSourceNode(){return this.sourceNode}set processedNode(e){var t;if(!this.isDestroyed&&this._processedNode!==e){try{var r;null===(r=this.sourceNode)||void 0===r||r.disconnect(this.outputNode)}catch(e){}null===(t=this._processedNode)||void 0===t||t.disconnect(),this._processedNode=e,this.connect()}}get processedNode(){return this._processedNode}constructor(){super(),cg(this,"outputNode",void 0),cg(this,"outputTrack",void 0),cg(this,"isPlayed",!1),cg(this,"sourceNode",void 0),cg(this,"context",void 0),cg(this,"audioBufferNode",void 0),cg(this,"destNode",void 0),cg(this,"audioOutputLevel",0),cg(this,"volumeLevelAnalyser",void 0),cg(this,"_processedNode",void 0),cg(this,"playNode",void 0),cg(this,"isDestroyed",!1),cg(this,"onNoAudioInput",void 0),cg(this,"isNoAudioInput",!1),cg(this,"_noAudioInputCount",0),this.context=Qb(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),$b(this.outputNode),this.volumeLevelAnalyser=new oO}startGetAudioBuffer(e){this.audioBufferNode||(this.audioBufferNode=this.context.createScriptProcessor(e),this.outputNode.connect(this.audioBufferNode),this.audioBufferNode.connect(this.context.destination),this.audioBufferNode.onaudioprocess=e=>{this.emit(rl.ON_AUDIO_BUFFER,nO(e))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!Go().webAudioMediaStreamDest)throw new Zn(Xn.NOT_SUPPORTED,"your browser is not support audio processor");return this.destNode&&this.outputTrack||(this.destNode=this.context.createMediaStreamDestination(),this.outputNode.connect(this.destNode),this.outputTrack=this.destNode.stream.getAudioTracks()[0]),this.outputTrack}play(e){"running"!==this.context.state&&Ri((()=>{Zb.emit("autoplay-failed")})),this.isPlayed=!0,this.playNode=e||this.context.destination,this.outputNode.connect(this.playNode)}stop(){if(this.isPlayed)try{this.outputNode.disconnect(this.playNode)}catch(e){}this.isPlayed=!1}getAccurateVolumeLevel(){return this.volumeLevelAnalyser.getVolumeLevel()}async checkHasAudioInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(e>5)return this.isNoAudioInput=!0,this.onNoAudioInput&&this.onNoAudioInput(),!1;On()||Mn()?"suspended"===this.context.state&&this.context.resume():"running"!==this.context.state&&this.context.resume();const t=this.volumeLevelAnalyser.getAnalyserNode();let r;t.getFloatTimeDomainData?(r=new Float32Array(t.fftSize),t.getFloatTimeDomainData(r)):(r=new Uint8Array(t.fftSize),t.getByteTimeDomainData(r));let n=!1;for(let e=0;e<r.length;e++)0!==r[e]&&(n=!0);return n?(this.isNoAudioInput=!1,!0):(await Ci(200),await this.checkHasAudioInput(e?e+1:1)&&n)}getAudioVolume(){return this.outputNode.gain.value}setVolume(e){this.outputNode.gain.setValueAtTime(e,this.context.currentTime)}destroy(){this.disconnect(),this.stop(),this.isDestroyed=!0,this.onNoAudioInput=void 0}disconnect(){var e,t;null===(e=this.processedNode)||void 0===e||e.disconnect(),null===(t=this.sourceNode)||void 0===t||t.disconnect(),this.outputNode&&this.outputNode.disconnect()}connect(){var e;this.processedNode?null===(e=this.processedNode)||void 0===e||e.connect(this.outputNode):this.sourceNode&&this.sourceNode.connect(this.outputNode);this.volumeLevelAnalyser.updateSource(this.outputNode)}}class aO extends sO{get isFreeze(){return!1}constructor(e,t,r){var n;if(super(),cg(this,"sourceNode",void 0),cg(this,"track",void 0),cg(this,"clonedTrack",void 0),cg(this,"audioElement",void 0),cg(this,"isCurrentTrackCloned",!1),cg(this,"isRemoteTrack",!1),cg(this,"originVolumeLevelAnalyser",void 0),cg(this,"rebuildWebAudio",(async()=>{if(go.debug("ready to rebuild web audio, state:",this.context.state),this.isNoAudioInput&&await this.checkHasAudioInput(),!this.isNoAudioInput||this.isDestroyed)return document.body.removeEventListener("click",this.rebuildWebAudio,!0),void go.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>go.info("resume success"))),go.debug("rebuild web audio because of ios 12 bugs"),this.disconnect();const e=this.track;this.track=this.track.clone(),this.isCurrentTrackCloned?e.stop():this.isCurrentTrackCloned=!0;const t=new MediaStream([this.track]);this.sourceNode=this.context.createMediaStreamSource(t),$b(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const r=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(r,this.context.currentTime),$b(this.outputNode),this.emit(rl.UPDATE_SOURCE),this.connect(),this.audioElement.srcObject=t,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()})),"audio"!==e.kind)throw new Zn(Xn.UNEXPECTED_ERROR);this.track=e;const i=new MediaStream([this.track]);if(this.isRemoteTrack=!!t,this.sourceNode=this.context.createMediaStreamSource(i),$b(this.sourceNode),r){const e=r.clone();e.enabled=!0,this.clonedTrack=e,go.debug("create an unmuted track ".concat(e.id," from the original track ").concat(r.id," to get the volume"));const t=this.context.createMediaStreamSource(new MediaStream([e]));$b(t),this.originVolumeLevelAnalyser=new oO,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=i;const o=_n();t&&o.os===hn.IOS&&Number(null===(n=o.osVersion)||void 0===n?void 0:n.split(".")[0])<15&&(Zb.on(zo.STATE_CHANGE,(()=>{"suspended"===this.context.state?document.body.addEventListener("click",this.rebuildWebAudio,!0):"running"===this.context.state&&this.rebuildWebAudio()})),this.checkHasAudioInput().then((e=>{e||document.body.addEventListener("click",this.rebuildWebAudio,!0)})))}updateTrack(e){this.sourceNode.disconnect(),this.track=e,this.isCurrentTrackCloned=!1;const t=new MediaStream([e]);this.sourceNode=this.context.createMediaStreamSource(t),$b(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(rl.UPDATE_SOURCE),this.audioElement.srcObject=t}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),Zb.off("state-change",this.rebuildWebAudio),null===(e=this.originVolumeLevelAnalyser)||void 0===e||e.destroy(),this.clonedTrack=void 0,super.destroy()}createMediaStreamSourceNode(e){return this.context.createMediaStreamSource(new MediaStream([e]))}updateOriginTrack(e){const t=e.clone();t.enabled=!0,this.clonedTrack&&(this.clonedTrack.stop(),this.clonedTrack=t),go.debug("create an unmuted track ".concat(t.id," from the original track ").concat(e.id," to get the volume"));const r=this.context.createMediaStreamSource(new MediaStream([t]));$b(r),this.originVolumeLevelAnalyser&&this.originVolumeLevelAnalyser.updateSource(r)}getOriginVolumeLevel(){return this.originVolumeLevelAnalyser?this.originVolumeLevelAnalyser.getVolumeLevel():this.getAccurateVolumeLevel()}}async function cO(e,t,r){const n=(e,t)=>e?"number"!=typeof e?e.max||e.exact||e.ideal||e.min||t:e:t,i={audio:!!r&&{mandatory:{chromeMediaSource:"desktop"}},video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxHeight:n(t.height,1080),maxWidth:n(t.width,1920)}}};return t.frameRate&&"number"!=typeof t.frameRate?(i.video.mandatory.maxFrameRate=t.frameRate.max,i.video.mandatory.minFrameRate=t.frameRate.min):"number"==typeof t.frameRate&&(i.video.mandatory.maxFrameRate=t.frameRate),await navigator.mediaDevices.getUserMedia(i)}async function uO(e,t){const r=await dO(e.mediaSource),n=await function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(((r,n)=>{const i=document.createElement("div");i.innerText="share screen",i.setAttribute("style","text-align: center; height: 25px; line-height: 25px; border-radius: 4px 4px 0 0; background: #D4D2D4; border-bottom: solid 1px #B9B8B9;");const o=document.createElement("div");o.setAttribute("style","width: 100%; height: 500px; padding: 15px 25px ; box-sizing: border-box;");const s=document.createElement("div");s.innerText="Agora Web Screensharing wants to share the contents of your screen with webdemo.agorabeckon.com. Choose what you'd like to share.",s.setAttribute("style","height: 12%;");const a=document.createElement("div");a.setAttribute("style","width: 100%; height: 80%; background: #FFF; border: solid 1px #CBCBCB; display: flex; flex-wrap: wrap; justify-content: space-around; overflow-y: scroll; padding: 0 15px; box-sizing: border-box;");const c=document.createElement("div");c.setAttribute("style","display: flex; justify-content: space-between; padding: 16px 0;");const u=document.createElement("button");u.innerHTML="cancel",u.setAttribute("style","width: 85px;"),u.onclick=()=>{document.body.removeChild(h);const e=new Error("NotAllowedError");e.name="NotAllowedError",n(e)};let d=t;const l=document.createElement("div");if(t){const e=document.createElement("input");e.setAttribute("type","checkbox");const t=document.createElement("span");e.setAttribute("style","margin-right: 6px;"),t.innerText="Share audio",e.checked=d,e.onchange=()=>{d=e.checked},l.appendChild(e),l.appendChild(t)}c.appendChild(l),c.appendChild(u),o.appendChild(s),o.appendChild(a),o.appendChild(c);const h=document.createElement("div");h.setAttribute("style","position: fixed; z-index: 99999999; top: 50%; left: 50%; width: 620px; height: 525px; background: #ECECEC; border-radius: 4px; -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);"),h.appendChild(i),h.appendChild(o),document.body.appendChild(h),e.map((e=>{if(e.id){const t=document.createElement("div");t.setAttribute("style","width: 30%; height: 160px; padding: 20px 0; text-align: center;box-sizing: content-box;");let n=e.thumbnail;try{n.getSize().width>1920&&(n=n.resize({width:1920}))}catch(e){throw e&&e.message.startsWith("Illegal invocation")&&console.error("Operate thumbnail error, please try to set contextIsolation: false. (https://github.com/electron/electron/issues/34953)"),e}t.innerHTML='<div style="height: 120px; display: table-cell; vertical-align: middle;"><img style="width: 100%; background: #333333; box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.2);" src='+n.toDataURL()+' /></div><span style="\theight: 40px; line-height: 40px; display: inline-block; width: 70%; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">'+e.name.replace(/[\u00A0-\u9999<>\&]/g,(function(e){return"&#"+e.charCodeAt(0)+";"}))+"</span>",t.onclick=()=>{document.body.removeChild(h),r({sourceId:e.id,audio:d})},a.appendChild(t)}}))}))}(r,t),i=n.sourceId,o=n.audio;return await cO(i,e,o)}async function dO(e){let t=["window","screen"];"application"!==e&&"window"!==e||(t=["window"]),"screen"===e&&(t=["screen"]);const r=ai();if(!r)throw console.error("failed to fetch electron, please mount it to window"),new Zn(Xn.ELECTRON_IS_NULL);let n=null;try{var i;n=(null===(i=r.desktopCapturer)||void 0===i?void 0:i.getSources({types:t}))||r.ipcRenderer.invoke("DESKTOP_CAPTURER_GET_SOURCES",{types:t})}catch(e){n=null}n&&n.then||(n=new jb(((e,n)=>{r.desktopCapturer.getSources({types:t},((t,r)=>{t?n(t):e(r)}))})));try{return await n}catch(e){throw new Zn(Xn.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,e.toString())}}function lO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const hO=new Fi("safari");async function pO(e,t){let r=0,n=null;for(;r<2;)try{n=await fO(e,t,r>0);break}catch(e){if(e instanceof Zn)throw go.error("[".concat(t,"] ").concat(e.toString())),e;const n=EO(e.name||e.code||e,e.message);if(n.code===Xn.MEDIA_OPTION_INVALID){go.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await Ci(500);continue}throw go.error("[".concat(t,"] ").concat(n.toString())),n}if(!n)throw new Zn(Xn.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return n}async function fO(t,r,n){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Zn(Xn.NOT_SUPPORTED,"can not find getUserMedia");n&&(t.video&&(delete t.video.width,delete t.video.height),t.screen&&(delete t.screen.width,delete t.screen.height));const i=Go(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return go.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(oi())if(t.screen.sourceId){mO(o,await cO(t.screen.sourceId,t.screen,!!t.screenAudio))}else{mO(o,await uO(t.screen,!!t.screenAudio))}else if(Rn()&&t.screen.extensionId&&t.screen.mandatory){if(!i.getStreamFromExtension)throw new Zn(Xn.NOT_SUPPORTED,"This browser does not support screen sharing");go.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(a=t.screen.extensionId,c=r,new jb(((e,t)=>{try{chrome.runtime.sendMessage(a,{getStream:!0},(r=>{if(!r||!r.streamId)return go.error("[".concat(c,"] No response from Chrome Plugin. Plugin not installed properly"),r),void t(new Zn(Xn.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)}))}catch(e){go.error("[".concat(c,"] AgoraRTC screensharing plugin is not accessible(").concat(a,")"),e.toString()),t(new Zn(Xn.CHROME_PLUGIN_NOT_INSTALL))}})));t.screen.mandatory.chromeMediaSourceId=e;mO(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(i.getDisplayMedia){var s;t.screen.mediaSource&&Yd(t.screen.mediaSource);const e={width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate,displaySurface:null!==(s=t.screen.displaySurface)&&void 0!==s?s:"screen"===t.screen.mediaSource?"monitor":t.screen.mediaSource},n=t.screen,i=n.selfBrowserSurface,a=n.surfaceSwitching,c=n.systemAudio,u=n.preferCurrentTab,d=n.windowAudio,l=n.monitorTypeSurfaces,h={selfBrowserSurface:i,surfaceSwitching:a,systemAudio:c,preferCurrentTab:u,windowAudio:d,monitorTypeSurfaces:l};!i&&delete h.selfBrowserSurface,!a&&delete h.surfaceSwitching,!c&&delete h.systemAudio,!u&&delete h.preferCurrentTab,!d&&delete h.windowAudio,!l&&delete h.monitorTypeSurfaces,go.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:e,audio:t.screenAudio,controls:h}));const p=await navigator.mediaDevices.getDisplayMedia(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?lO(Object(r),!0).forEach((function(t){cg(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):lO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({video:e,audio:t.screenAudio},h));mO(o,p)}else{if(!bn())throw go.error("[".concat(r,"] This browser does not support screenSharing")),new Zn(Xn.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&Yd(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};go.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));mO(o,await navigator.mediaDevices.getUserMedia(e))}}var a,c;if(!t.video&&!t.audio)return o;let u={video:t.video,audio:t.audio},d=to("MEDIA_DEVICE_CONSTRAINTS");if(d)try{"string"==typeof d&&(d=JSON.parse(d)),u=ki(u,d)}catch(e){}go.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(u)),_n();let l,h=null;(vn()||On()||yn())&&(h=await hO.lock());try{l=await navigator.mediaDevices.getUserMedia(u)}catch(e){throw h&&h(),e}return u.audio&&(e.HAS_GUM_AUDIO=!0),u.video&&(e.HAS_GUM_VIDEO=!0),mO(o,l),h&&h(),o}function EO(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new Zn(Xn.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new Zn(Xn.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new Zn(Xn.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new Zn(Xn.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new Zn(Xn.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new Zn(Xn.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return go.error("getUserMedia unexpected error",e),new Zn(Xn.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function mO(e,t){const r=e.getVideoTracks()[0],n=e.getAudioTracks()[0],i=t.getVideoTracks()[0],o=t.getAudioTracks()[0];o&&(n&&e.removeTrack(n),e.addTrack(o)),i&&(r&&e.removeTrack(r),e.addTrack(i))}e.HAS_GUM_AUDIO=!1,e.HAS_GUM_VIDEO=!1;class _O extends ii{get state(){return this._state}set state(e){e!==this._state&&(this.emit(ll.STATE_CHANGE,e),this._state=e)}constructor(){super(),cg(this,"_state",dl.IDLE),cg(this,"isAccessMicrophonePermission",!1),cg(this,"isAccessCameraPermission",!1),cg(this,"lastAccessMicrophonePermission",!1),cg(this,"lastAccessCameraPermission",!1),cg(this,"checkdeviceMatched",!1),cg(this,"deviceInfoMap",new Map),this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(to("ENUMERATE_DEVICES_INTERVAL")||(Bn()||gn()===hn.HARMONY_OS)&&Fn())&&this.updateDevicesInfo()}),to("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>go.error(e.toString())))}async enumerateDevices(t,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices)throw new Zn(Xn.NOT_SUPPORTED,"enumerateDevices() not supported.");const i=await navigator.mediaDevices.enumerateDevices(),o=this.checkMediaDeviceInfoIsOk(i);let s=!this.isAccessMicrophonePermission&&t,a=!this.isAccessCameraPermission&&r;o.audio&&(s=!1),o.video&&(a=!1);let c=null,u=null,d=null;if(!n&&(s||a)){if(hO.isLocked){go.debug("[device manager] wait GUM lock");(await hO.lock())(),go.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(s=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(a=!1,this.isAccessCameraPermission=!0),go.debug("[device manager] check media device permissions",t,r,s,a),s&&a){try{d=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(e){const t=EO(e.name||e.code||e,e.message);if(t.code===Xn.PERMISSION_DENIED)throw t;go.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0,this.isAccessMicrophonePermission=!0}else if(s){try{c=await navigator.mediaDevices.getUserMedia({audio:t})}catch(e){const t=EO(e.name||e.code||e,e.message);if(t.code===Xn.PERMISSION_DENIED)throw t;go.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(a){try{u=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=EO(e.name||e.code||e,e.message);if(t.code===Xn.PERMISSION_DENIED)throw t;go.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}go.debug("[device manager] mic permission",t,"cam permission",r)}try{const e=await navigator.mediaDevices.enumerateDevices();return c&&c.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),c=null,u=null,d=null,e}catch(e){c&&c.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),c=null,u=null,d=null;return new Zn(Xn.ENUMERATE_DEVICES_FAILED,e.toString()).throw()}}async getRecordingDevices(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!0,!1,e)).filter((e=>"audioinput"===e.kind))}async getCamerasDevices(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!1,!0,e)).filter((e=>"videoinput"===e.kind))}async getSpeakers(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!0,!1,e)).filter((e=>"audiooutput"===e.kind))}searchDeviceIdByName(e){let t=null;return this.deviceInfoMap.forEach((r=>{r.device.label===e&&(t=r.device.deviceId)})),t}async getDeviceById(e){const t=(await this.enumerateDevices(!0,!0,!0)).find((t=>t.deviceId===e));if(!t)throw new Zn(Xn.DEVICE_NOT_FOUND,"deviceId: ".concat(e));return t}async init(){this.state=dl.INITING;try{await this.updateDevicesInfo(),this.state=dl.INITEND}catch(e){if(this.state=dl.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname))throw new Zn(Xn.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.");throw go.warning("Device Detection functionality cannot start properly.",e.toString()),e}}async updateDevicesInfo(){const e=await this.enumerateDevices(!0,!0,!0),t=Date.now(),r=[];if(e[0]&&e[0].label&&!1===this.checkdeviceMatched){this.checkdeviceMatched=!0;const t=e.find((e=>"audioinput"===e.kind&&"default"===e.deviceId)),r=e.find((e=>"audiooutput"===e.kind&&"default"===e.deviceId));t&&r?r.groupId===t.groupId?go.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is the same group")):go.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is not the same group")):go.debug("[device-check] default input or output not found")}const n=this.checkMediaDeviceInfoIsOk(e);if(e.forEach((e=>{if(!e.deviceId)return;const n=this.deviceInfoMap.get("".concat(e.kind,"_").concat(e.deviceId));if("ACTIVE"!==(n?n.state:"INACTIVE")){const n={initAt:t,updateAt:t,device:e,state:"ACTIVE"};this.deviceInfoMap.set("".concat(e.kind,"_").concat(e.deviceId),n),r.push(n)}n&&(n.updateAt=t)})),this.deviceInfoMap.forEach(((e,n)=>{"ACTIVE"===e.state&&e.updateAt!==t&&(e.state="INACTIVE",r.push(e))})),this.state!==dl.INITEND)return n.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),void(n.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0));r.forEach((e=>{switch(e.device.kind){case"audioinput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(ll.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(ll.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(ll.PLAYOUT_DEVICE_CHANGED,e)}})),n.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),n.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0)}checkMediaDeviceInfoIsOk(e){const t=e.filter((e=>"audioinput"===e.kind)),r=e.filter((e=>"videoinput"===e.kind)),n={audio:!1,video:!1};for(const e of t)if(e.label&&e.deviceId){n.audio=!0;break}for(const e of r)if(e.label&&e.deviceId){n.video=!0;break}return n}}const TO=new _O;Ru({target:"Array",stat:!0},{isArray:vl});var gO=z(Ys.Array.isArray);var SO=z(iy),yO=Ga,RO=Mu,vO=kl,AO=bl;Ru({target:"Array",proto:!0,arity:1,forced:Jo((function(){return 4294967297!==[].push.call({length:4294967296},1)}))||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(e){return e instanceof TypeError}}()},{push:function(e){var t=yO(this),r=RO(t),n=arguments.length;AO(r+n);for(var i=0;i<n;i++)t[r]=arguments[i],r++;return vO(t,r),r}});var bO=Zu("Array","push"),OO=ns,IO=bO,CO=Array.prototype,wO=function(e){var t=e.push;return e===CO||OO(CO,e)&&t===CO.push?IO:t},NO=z(wO);var PO=Jc,DO=Ey,LO=Hc,kO=As,MO=Ga,UO=function(e,t,r,n){try{return n?t(PO(r)[0],r[1]):t(r)}catch(t){DO(e,"throw",t)}},xO=qS,VO=Ql,FO=Mu,BO=wl,jO=kl,WO=ly,GO=iy,HO=Ey,KO=Array,YO=function(e){var t=VO(this),r=arguments.length,n=r>1?arguments[1]:void 0,i=void 0!==n;i&&(n=LO(n,r>2?arguments[2]:void 0));var o,s,a,c,u,d,l=MO(e),h=GO(l),p=0;if(!h||this===KO&&xO(h))for(o=FO(l),s=t?new this(o):KO(o);o>p;p++)d=i?n(l[p],p):l[p],BO(s,p,d);else for(s=t?new this:[],u=(c=WO(l,h)).next;!(a=kO(u,c)).done;p++){d=i?UO(c,n,[a.value,p],!0):a.value;try{BO(s,p,d)}catch(e){HO(c,"throw",e)}}return jO(s,p),s},XO=YO;Ru({target:"Array",stat:!0,forced:!BA((function(e){Array.from(e)}))},{from:XO});var ZO=z(Ys.Array.from);function zO(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function JO(e,t){return function(e){if(gO(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==BT&&SO(e)||e["@@iterator"];if(null!=r){var n,i,o,s,a=[],c=!0,u=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;c=!1}else for(;!(c=(n=o.call(r)).done)&&(NO(a).call(a,n.value),a.length!==t);c=!0);}catch(e){u=!0,i=e}finally{try{if(!c&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw i}}return a}}(e,t)||function(e,t){var r;if(e){if("string"==typeof e)return zO(e,t);var n=AS(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?ZO(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?zO(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}let QO=!1;const qO=new class extends ii{constructor(){super(...arguments),cg(this,"onAutoplayFailed",void 0),cg(this,"onAudioAutoplayFailed",void 0)}};function $O(){if(QO)return to("FLS_AUTOPLAY_EMITS")?(qO.onAutoplayFailed&&qO.onAutoplayFailed(),qO.emit("autoplay-failed")):void 0;{const e=t=>{t.preventDefault(),function(){try{const e=Qb();"running"!==e.state&&e.resume().catch((e=>{var t;go.warning("resume web audio context on autoplay gesture failed",(null==e||null===(t=e.toString)||void 0===t?void 0:t.call(e))||e)}))}catch(t){var e;go.warning("create web audio context on autoplay gesture failed",(null==t||null===(e=t.toString)||void 0===e?void 0:e.call(t))||t)}}(),QO=!1,jn()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};QO=!0,jn()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),go.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),qO.onAutoplayFailed?qO.onAutoplayFailed():qO.onAudioAutoplayFailed?go.warning("AgoraRTC.onAudioAutoplayFailed has been deprecated in favor of AgoraRTC.onAutoplayFailed.\n\n Please refer to the Agora document to migrate the newer API, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web ."):go.warning("We have detected a media autoplay failed event, and found out that you haven't implemented AgoraRTC.onAutoplayFailed callback yet.\n\n It will cause audio/video element not playing automatically on some browsers without user interaction, possibly hurting user experiences.\n\n Please refer to the Agora document to properly handle autoplay failed event, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web ."),qO.emit("autoplay-failed")}}function eI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function tI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?eI(Object(r),!0).forEach((function(t){cg(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):eI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function rI(e,t,r,n){if(!e)return;const i=Bo.getBaseInfoBySessionId(e);if(!i)return;const o=i.info,s=Date.now(),a=tI(tI({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-i.startTime,cbRegistered:qO.onAutoplayFailed||qO.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:n,extend:void 0});Bo.send({type:bo.AUTOPLAY_FAILED,data:a},!0)}const nI=1e3,iI="RemoteTrack.wechatAutoplayRecovery",oI=new WeakSet,sI=new WeakMap;let aI;function cI(){return to("ENABLE_WECHAT_AUTOPLAY_RECOVERY")&&Bn()&&Un()}function uI(e){if(!cI())return;const t=window.WeixinJSBridge;return t?new jb(((r,n)=>{let i=!1;const o=window.setTimeout((()=>{i||(i=!0,n())}),nI),s=()=>!i&&(i=!0,window.clearTimeout(o),!0),a=e=>n(e);try{t.invoke("getNetworkType",{},(()=>{if(s())if(cI())try{jb.resolve(e()).then((()=>r()),a)}catch(e){a(e)}else n()}))}catch(e){s()&&n()}})):void 0}function dI(e,t){if(t)try{const r=Bo.reportApiInvoke(t,{name:iI,options:{},tag:ui.TRACER});e.then((()=>r.onSuccess()),(()=>r.onError(function(e,t){return new Zn(Xn.UNEXPECTED_ERROR,e,t)}("WeChat autoplay recovery failed")))).catch((()=>{}))}catch(e){}}function lI(e,t,r,n){return e.catch((e=>{if("NotAllowedError"!==e.name)throw e;if(!r())throw e;const i=uI((()=>{if(!r())throw e;return t()}));if(!i)throw e;return dI(i,n),i.catch((t=>{throw t instanceof Error?t:e}))}))}const hI=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],pI=new class{constructor(){cg(this,"onAutoplayFailed",void 0),cg(this,"elementMap",new Map),cg(this,"elementStateMap",new Map),cg(this,"elementsNeedToResume",[]),cg(this,"sinkIdMap",new Map),cg(this,"elementIdMap",new WeakMap),cg(this,"autoResumeAfterInterruption",(e=>jb.all(Array.from(this.elementMap.entries()).map((async t=>{let r=JO(t,2),n=r[0],i=r[1];const o=this.elementStateMap.get(n),s=i.srcObject.getAudioTracks()[0],a=s&&s.readyState;if(go.debug("resume after interrupted, ele: ".concat(o," audio: ").concat(a," ").concat(e)),"live"===a){if(e)return i.pause(),i.play();if("running"===Zb.curState)return Dn()?(i.pause(),i.play()):o&&"paused"===o?i.play():void 0}}))))),cg(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{Array.from(this.elementMap.entries()).forEach((e=>{let t=JO(e,2);t[0];let r=t[1];const n=r.srcObject.getAudioTracks()[0];n&&"live"===n.readyState&&(go.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))})),this.autoResumeAudioElement(),Zb.on(zo.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),Zb.on(zo.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),Zb.on(zo.STATE_CHANGE,(()=>{On()&&"suspended"===Zb.prevState&&"running"===Zb.curState&&this.autoResumeAfterInterruption()}))}async setSinkID(e,t){const r=this.elementMap.get(e);if(this.sinkIdMap.set(e,t),r)try{await r.setSinkId(t)}catch(e){throw new Zn(Xn.PERMISSION_DENIED,"can not set sink id: "+e.toString())}}play(e,t,r,n){var i;if(this.elementMap.has(t))return;const o=document.createElement("audio");o.autoplay=!0,o.srcObject=new MediaStream([e]),this.elementIdMap.set(o,{id:t}),this.bindAudioElementEvents(t,o),this.elementMap.set(t,o),this.elementStateMap.set(t,hl.INIT),this.setVolume(t,r);const s=this.sinkIdMap.get(t);if(s)try{o.setSinkId(s).catch((e=>{go.warning("[".concat(t,"] set sink id failed"),e.toString())}))}catch(e){go.warning("[".concat(t,"] set sink id failed"),e.toString())}const a=o.play();if(!a||!a.then)return;const c=null!==(i=function(e,t,r,n,i){var o;if(!cI())return;if((null===(o=aI)||void 0===o?void 0:o.track)!==e)return;const s=aI.recover;return lI(r,(()=>s(t)),n,i)}(e,o,a,(()=>this.elementMap.get(t)===o),n))&&void 0!==i?i:a;c.catch((e=>{n&&rI(n,"audio",e.message,t),go.warning("audio element play warning",e.toString()),this.elementMap.get(t)===o&&"NotAllowedError"===e.name&&(go.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(o),Ri((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),$O()})))}))}updateTrack(e,t){const r=this.elementMap.get(e);r&&(r.srcObject=new MediaStream([t]))}isPlaying(e){return this.elementMap.has(e)&&"playing"===this.elementStateMap.get(e)}setVolume(e,t){const r=this.elementMap.get(e);r&&(t=Math.max(0,Math.min(100,t)),r.volume=t/100)}getVolume(e){const t=this.elementMap.get(e);return t?t.volume:0}stop(e){const t=this.elementMap.get(e);if(this.sinkIdMap.delete(e),!t)return;const r=this.elementsNeedToResume.indexOf(t);-1!==r&&this.elementsNeedToResume.splice(r,1),t.srcObject=null,t.remove(),this.elementMap.delete(e),this.elementStateMap.delete(e)}reuseTrackId(e,t){if(e===t)return;const r=this.elementMap.get(e);if(!r)return;this.elementMap.has(t)&&this.stop(t),this.elementMap.delete(e),this.elementMap.set(t,r);const n=this.elementStateMap.get(e);this.elementStateMap.delete(e),void 0!==n&&this.elementStateMap.set(t,n);const i=this.sinkIdMap.get(e);void 0!==i&&(this.sinkIdMap.delete(e),this.sinkIdMap.set(t,i));const o=this.elementIdMap.get(r);o&&(o.id=t)}bindAudioElementEvents(e,t){hI.forEach((r=>{t.addEventListener(r,(r=>{var n,i;const o=null!==(n=null===(i=this.elementIdMap.get(t))||void 0===i?void 0:i.id)&&void 0!==n?n:e,s=this.elementStateMap.get(o),a="pause"===r.type?"paused":r.type;if(go.debug("[".concat(o,"] audio-element-status change ").concat(s," => ").concat(a)),"error"===r.type){const e=null==t?void 0:t.error;e&&go.error("[".concat(o,"] media error, code: ").concat(e.code,", message: ").concat(e.message))}this.elementStateMap.set(o,a)}))}))}getPlayerState(e){return this.elementStateMap.get(e)||"uninit"}autoResumeAudioElement(){const e=()=>{this.elementsNeedToResume.forEach((e=>{e.play().then((e=>{go.debug("Auto resume audio element success")})).catch((e=>{go.warning("Auto resume audio element failed!",e)}))})),this.elementsNeedToResume=[]};new Promise((e=>{document.body?e():window.addEventListener("load",(()=>e()))})).then((()=>{jn()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0))}))}};function fI(){return function(e,t,r){const n=r.value;return"function"==typeof n&&(r.value=function(){this._isClosed&&new Zn(Xn.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning",go);for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=n.apply(this,t);return i instanceof jb?new jb(((e,t)=>{i.then(e).catch(t)})):i}),r}}var EI=Zu("Array","values"),mI=ud,_I=Ya,TI=ns,gI=EI,SI=Array.prototype,yI={DOMTokenList:!0,NodeList:!0},RI=function(e){var t=e.values;return e===SI||TI(SI,e)&&t===SI.values||_I(yI,mI(e))?gI:t},vI=z(RI);function AI(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function bI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?AI(Object(r),!0).forEach((function(t){cg(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):AI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class OI extends ii{constructor(e){super(),cg(this,"name","VideoProcessorDestination"),cg(this,"ID","0"),cg(this,"_source",void 0),cg(this,"videoContext",void 0),cg(this,"inputTrack",void 0),this.videoContext=e}get kind(){return"video"}get enabled(){return!0}pipe(){throw new Zn(Xn.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}unpipe(){throw new Zn(Xn.NOT_SUPPORTED,"VideoProcessor cannot unpipe to any other Processor")}enable(){}disable(){}updateInput(e){if(e.context!==this.videoContext)throw new Error("ProcessorContext passed to VideoTrack.processorDestination doesn't match it's belonging VideoTrack's context.\nProbably you are making pipeline like this:\nvideoTrack1.pipe(processor).pipe(videoTrack2.processorDestination).");e.track&&e.track!==this.inputTrack&&(this.videoContext.chained=!0,this.inputTrack=e.track,this.emit(cl.ON_TRACK,e.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(cl.ON_TRACK,void 0)}}class II extends ii{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),cg(this,"constraintsMap",new Map),cg(this,"statsRegistry",[]),cg(this,"usageRegistry",[]),cg(this,"trackId",void 0),cg(this,"direction",void 0),cg(this,"_chained",!1),this.trackId=e,this.direction=t}async getConstraints(){return await hi(this,ul.REQUEST_CONSTRAINTS)}async requestApplyConstraints(e,t){var r;return go.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),pi(this,ul.REQUEST_UPDATE_CONSTRAINTS,Array.from(vI(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return go.info("processor ".concat(e.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(e),pi(this,ul.REQUEST_UPDATE_CONSTRAINTS,Array.from(vI(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const t of this.statsRegistry){const r=t.processorID,n=t.processorName,i=t.type,o=t.cb;try{const t=o();e.push({processorID:r,processorName:n,type:i,stats:t})}catch(e){go.error(new Zn(Xn.UNEXPECTED_ERROR,e.message))}}return e}registerUsage(e,t){this.usageRegistry.find((t=>t.processorID===e.ID&&t.processorName===e.name))||this.usageRegistry.push({processorID:e.ID,processorName:e.name,cb:t})}unregisterUsage(e){const t=this.usageRegistry.findIndex((t=>t.processorID===e.ID&&t.processorName===e.name));-1!==t&&this.usageRegistry.splice(t,1)}async gatherUsage(){const e=[];if(!this.chained)return[];for(const t of this.usageRegistry){const r=t.cb;try{let t=r();t instanceof jb&&(t=await t),e.push(bI(bI({},t),{},{direction:this.direction}))}catch(e){go.error("gather extension usage error",e)}}return e}getDirection(){return this.direction}}class CI extends ii{constructor(e){super(),cg(this,"name","AudioProcessorDestination"),cg(this,"ID","0"),cg(this,"inputTrack",void 0),cg(this,"inputNode",void 0),cg(this,"audioProcessorContext",void 0),cg(this,"_source",void 0),this.audioProcessorContext=e}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new Zn(Xn.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new Zn(Xn.NOT_SUPPORTED,"AudioProcessor cannot unpipe to any other Processor")}enable(){}disable(){}reset(){this.inputTrack=void 0,this.inputNode=void 0,this.audioProcessorContext.chained=!1,this.emit(cl.ON_TRACK,void 0),this.emit(cl.ON_NODE,void 0)}updateInput(e){if(e.context!==this.audioProcessorContext)throw new Error("ProcessorContext passed to AudioTrack.processorDestination doesn't match it's belonging AudioTrack's context.\n Probably you are making pipeline like this: audioTrack1.pipe(processor).pipe(audioTrack2.processorDestination).");e.track&&this.inputTrack!==e.track&&(this.audioProcessorContext.chained=!0,this.inputTrack=e.track,this.emit(cl.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.audioProcessorContext.chained=!0,this.inputNode=e.node,this.emit(cl.ON_NODE,this.inputNode))}}class wI extends ii{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),cg(this,"constraintsMap",new Map),cg(this,"statsRegistry",[]),cg(this,"audioContext",void 0),cg(this,"trackId",void 0),cg(this,"direction",void 0),cg(this,"usageRegistry",[]),cg(this,"_chained",!1),this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return hi(this,ul.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(e,t){var r;return go.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),pi(this,ul.REQUEST_UPDATE_CONSTRAINTS,Array.from(vI(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return this.constraintsMap.delete(e),pi(this,ul.REQUEST_UPDATE_CONSTRAINTS,Array.from(vI(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const t of this.statsRegistry){const r=t.processorID,n=t.processorName,i=t.type,o=t.cb;try{const t=o();e.push({processorID:r,processorName:n,type:i,stats:t})}catch(e){go.error(new Zn(Xn.UNEXPECTED_ERROR,e.message))}}return e}registerUsage(e,t){this.usageRegistry.find((t=>t.processorID===e.ID&&t.processorName===e.name))||this.usageRegistry.push({processorID:e.ID,processorName:e.name,cb:t})}unregisterUsage(e){const t=this.usageRegistry.findIndex((t=>t.processorID===e.ID&&t.processorName===e.name));-1!==t&&this.usageRegistry.splice(t,1)}async gatherUsage(){const e=[];if(!this.chained)return[];for(const t of this.usageRegistry){const r=t.cb;try{let t=r();t instanceof jb&&(t=await t),e.push(bI(bI({},t),{},{direction:this.direction}))}catch(e){go.error("gather extension usage error",e)}}return e}getDirection(){return this.direction}}class NI extends ii{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),cg(this,"context",void 0),cg(this,"processSourceNode",void 0),cg(this,"outputTrack",void 0),cg(this,"processedNode",void 0),cg(this,"clonedTrack",void 0),cg(this,"outputNode",void 0),this.outputNode=new PI}setVolume(){}createOutputTrack(){throw new Zn(Xn.NOT_SUPPORTED,"can not create output MediaStreamTrack when WebAudio disabled")}getOriginVolumeLevel(){return 0}getAccurateVolumeLevel(){return 0}stopGetAudioBuffer(){}startGetAudioBuffer(){}play(){}stop(){}destroy(){}updateTrack(){}updateOriginTrack(){}createMediaStreamSourceNode(){}}class PI{disconnect(){}connect(){}}function DI(e){return new jb(((t,r)=>{let n=!1;const i=document.createElement("video");i.setAttribute("autoplay",""),i.setAttribute("muted",""),i.muted=!0,i.autoplay=!0,i.setAttribute("playsinline",""),i.setAttribute("style","position: fixed; top: 0; left: 0; width: 1px; height: 1px"),document.body.appendChild(i);const o=On()?"canplay":"playing";i.addEventListener(o,(()=>{const e=i.videoWidth,r=i.videoHeight;!e&&bn()||(n=!0,i.srcObject=null,i.remove(),t([e,r]))})),i.srcObject=new MediaStream([e]),i.play().catch(Ni),setTimeout((()=>{n||(i.srcObject=null,i.remove(),t([i.videoWidth,i.videoHeight]))}),4e3)}))}function LI(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=Md(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!xn()&&r.frameRate&&(t.frameRate=r.frameRate),An()&&"object"==typeof t.frameRate&&(t.frameRate.max=60),bn()&&(t.frameRate={ideal:30,max:30}),t}function kI(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&Rn()&&(t.extensionId=e.extensionId);const r=e.displaySurface,n=e.selfBrowserSurface,i=e.surfaceSwitching,o=e.systemAudio,s=e.preferCurrentTab,a=e.windowAudio,c=e.monitorTypeSurfaces;(In(107)||wn(107)||Pn(93))&&(r&&(Jn(r,"displaySurface",["browser","window","monitor"]),t.displaySurface=r),n?(Jn(n,"selfBrowserSurface",["exclude","include"]),t.selfBrowserSurface=n):t.selfBrowserSurface="include",i&&(Jn(i,"surfaceSwitching",["exclude","include"]),t.surfaceSwitching=i)),(In(105)||wn(105)||Pn(91))&&o&&(Jn(o,"systemAudio",["exclude","include"]),t.systemAudio=o),(In(94)||wn(94)||Pn(80))&&s&&(t.preferCurrentTab=!0),(In(141)||wn(141)||Pn(125))&&a&&(Jn(a,"windowAudio",["exclude","system"]),t.windowAudio=a),(In(119)||wn(119)||Pn(105))&&c&&(Jn(c,"monitorTypeSurfaces",["exclude","include"]),t.monitorTypeSurfaces=c),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const u=e.encoderConfig?Ud(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:u?u.width:void 0,maxHeight:u?u.height:void 0},u&&(u.frameRate&&("number"==typeof u.frameRate?(t.mandatory.maxFrameRate=u.frameRate,t.mandatory.minFrameRate=u.frameRate):(t.mandatory.maxFrameRate=u.frameRate.max||u.frameRate.ideal||u.frameRate.exact||void 0,t.mandatory.minFrameRate=u.frameRate.min||u.frameRate.ideal||u.frameRate.exact||void 0),t.frameRate=u.frameRate),u.width&&(t.width=u.width),u.height&&(t.height=u.height)),t}function MI(e){const t={};return xn()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,Rn()&&e.ANS&&(t.googHighpassFilter=e.ANS))),t}function UI(e){const t=MI(e);return Xo()&&e.suppressLocalAudioPlayback&&(t.suppressLocalAudioPlayback=e.suppressLocalAudioPlayback),Zo()&&e.restrictOwnAudio&&(t.restrictOwnAudio=!0),t}function xI(e){const t=MI(e);if(e.encoderConfig){const r=Fd(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),Bn()&&(t.sampleRate=void 0),t}var VI=ga,FI=TypeError,BI=lp,jI=Math.floor,WI=function(e,t){var r=e.length;if(r<8)for(var n,i,o=1;o<r;){for(i=o,n=e[o];i&&t(e[i-1],n)>0;)e[i]=e[--i];i!==o++&&(e[i]=n)}else for(var s=jI(r/2),a=WI(BI(e,0,s),t),c=WI(BI(e,s),t),u=a.length,d=c.length,l=0,h=0;l<u||h<d;)e[l+h]=l<u&&h<d?t(a[l],c[h])<=0?a[l++]:c[h++]:l<u?a[l++]:c[h++];return e},GI=WI,HI=ea.match(/firefox\/(\d+)/i),KI=!!HI&&+HI[1],YI=/MSIE|Trident/.test(ea),XI=ea.match(/AppleWebKit\/(\d+)\./),ZI=!!XI&&+XI[1],zI=Ru,JI=rs,QI=va,qI=Ga,$I=Mu,eC=function(e,t){if(!delete e[t])throw new FI("Cannot delete property "+VI(t)+" of "+VI(e))},tC=hd,rC=Jo,nC=GI,iC=dg,oC=KI,sC=YI,aC=aa,cC=ZI,uC=[],dC=JI(uC.sort),lC=JI(uC.push),hC=rC((function(){uC.sort(void 0)})),pC=rC((function(){uC.sort(null)})),fC=iC("sort"),EC=!rC((function(){if(aC)return aC<70;if(!(oC&&oC>3)){if(sC)return!0;if(cC)return cC<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)uC.push({k:t+n,v:r})}for(uC.sort((function(e,t){return t.v-e.v})),n=0;n<uC.length;n++)t=uC[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));zI({target:"Array",proto:!0,forced:hC||!pC||!fC||!EC},{sort:function(e){void 0!==e&&QI(e);var t=qI(this);if(EC)return void 0===e?dC(t):dC(t,e);var r,n,i=[],o=$I(t);for(n=0;n<o;n++)n in t&&lC(i,t[n]);for(nC(i,function(e){return function(t,r){if(void 0===r)return-1;if(void 0===t)return 1;if(void 0!==e)return+e(t,r)||0;var n=tC(t),i=tC(r);return n===i?0:n>i?1:-1}}(e)),r=$I(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)eC(t,n++);return t}});var mC=Zu("Array","sort"),_C=ns,TC=mC,gC=Array.prototype,SC=function(e){var t=e.sort;return e===gC||_C(gC,e)&&t===gC.sort?TC:t},yC=z(SC);function RC(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function vC(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?RC(Object(r),!0).forEach((function(t){cg(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):RC(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function AC(e,t,r){const n=4*Math.floor(2e5*Math.pow(r/15,.6)*Math.pow(e*t/230400,.75)),i=e*t,o=new Map([[19200,.9],[230400,.85],[518400,.75],[921600,.7],[2073600,.6],[3686400,.5]]),s=new Map([[230400,.95],[518400,.9],[921600,.85],[2073600,.8]]);let a=vI(o).call(o).next().value,c=1;if(o.has(i))a=o.get(i);else{var u;const e=yC(u=Array.from(o.entries())).call(u,((e,t)=>JO(e,1)[0]-JO(t,1)[0])),t=e.find((e=>JO(e,1)[0]>i));if(t){const r=e.indexOf(t);if(r>0){const n=e[r-1],o=(i-n[0])/(t[0]-n[0]);a=n[1]+o*(t[1]-n[1])}else a=t[1]}else a=e[e.length-1][1]}if(s.has(i))c=s.get(i);else{var d;const e=yC(d=Array.from(s.entries())).call(d,((e,t)=>JO(e,1)[0]-JO(t,1)[0])),t=e.find((e=>JO(e,1)[0]>i));if(t){const r=e.indexOf(t);if(r>0){const n=e[r-1],o=(i-n[0])/(t[0]-n[0]);c=n[1]+o*(t[1]-n[1])}else c=t[1]}else c=e[e.length-1][1]}const l=to("VIDEO_NEW_BITRATE_RATIO");l&&l>0&&(a=l/100);const h=Math.floor(n*a),p=Math.floor(65e4*Math.pow(e*t/230400,.5)*Math.pow(r/15,.69));let f=h;const E=to("VIDEO_STANDARD_BITRATE_VERSION");return E&&E>0&&(1===E?f=n:2===E?f=h:3===E&&(f=p)),[Math.floor(f/1e3),c]}function bC(e,t,r){if(!Array.isArray(to("VIDEO_ENCODER_CONFIG_LIST")))return!1;if(0===to("VIDEO_ENCODER_CONFIG_LIST").length)return!1;const n=Math.min(e,t);if(n>=480)return!1;return vC(vC({},to("VIDEO_ENCODER_CONFIG_LIST").find((e=>e.height>n))),{},{frameRate:r})}function OC(e,t,r,n,i){const o=to("BITRATE_ADAPTER_TYPE");if("DEFAULT_BITRATE"===o)return{min:n,max:i};if(void 0===i){const s=Math.floor(200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75));i="STANDARD_BITRATE"===o?4*s:2*s,n=null!=n?n:s}else n=null!=n?n:Math.floor(i/10);return{min:n,max:i}}function IC(e,t,r){const n=200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75);return{min:Math.floor(n),max:Math.floor(4*n)}}const CC=async(e,t,r)=>{const n=function(e){const t=[];for(let r=0;r<e.length;r+=2)t.push(parseInt(e.slice(r,r+2),16));return Uint8Array.from(t)}(function(e){const t="0123456789abcdef";function r(e){let r,n="";for(r=0;r<=3;r++)n+=t.charAt(e>>8*r+4&15)+t.charAt(e>>8*r&15);return n}function n(e,t){const r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function i(e,t,r,i,o,s){return n(function(e,t){return e<<t|e>>>32-t}(n(n(t,e),n(i,s)),o),r)}function o(e,t,r,n,o,s,a){return i(t&r|~t&n,e,t,o,s,a)}function s(e,t,r,n,o,s,a){return i(t&n|r&~n,e,t,o,s,a)}function a(e,t,r,n,o,s,a){return i(t^r^n,e,t,o,s,a)}function c(e,t,r,n,o,s,a){return i(r^(t|~n),e,t,o,s,a)}const u=function(e){let t;const r=1+(e.length+8>>6),n=new Array(16*r);for(t=0;t<16*r;t++)n[t]=0;for(t=0;t<e.length;t++)n[t>>2]|=e.charCodeAt(t)<<t%4*8;return n[t>>2]|=128<<t%4*8,n[16*r-2]=8*e.length,n}(e);let d,l,h,p,f,E=1732584193,m=-271733879,_=-1732584194,T=271733878;for(d=0;d<u.length;d+=16)l=E,h=m,p=_,f=T,E=o(E,m,_,T,u[d+0],7,-680876936),T=o(T,E,m,_,u[d+1],12,-389564586),_=o(_,T,E,m,u[d+2],17,606105819),m=o(m,_,T,E,u[d+3],22,-1044525330),E=o(E,m,_,T,u[d+4],7,-176418897),T=o(T,E,m,_,u[d+5],12,1200080426),_=o(_,T,E,m,u[d+6],17,-1473231341),m=o(m,_,T,E,u[d+7],22,-45705983),E=o(E,m,_,T,u[d+8],7,1770035416),T=o(T,E,m,_,u[d+9],12,-1958414417),_=o(_,T,E,m,u[d+10],17,-42063),m=o(m,_,T,E,u[d+11],22,-1990404162),E=o(E,m,_,T,u[d+12],7,1804603682),T=o(T,E,m,_,u[d+13],12,-40341101),_=o(_,T,E,m,u[d+14],17,-1502002290),m=o(m,_,T,E,u[d+15],22,1236535329),E=s(E,m,_,T,u[d+1],5,-165796510),T=s(T,E,m,_,u[d+6],9,-1069501632),_=s(_,T,E,m,u[d+11],14,643717713),m=s(m,_,T,E,u[d+0],20,-373897302),E=s(E,m,_,T,u[d+5],5,-701558691),T=s(T,E,m,_,u[d+10],9,38016083),_=s(_,T,E,m,u[d+15],14,-660478335),m=s(m,_,T,E,u[d+4],20,-405537848),E=s(E,m,_,T,u[d+9],5,568446438),T=s(T,E,m,_,u[d+14],9,-1019803690),_=s(_,T,E,m,u[d+3],14,-187363961),m=s(m,_,T,E,u[d+8],20,1163531501),E=s(E,m,_,T,u[d+13],5,-1444681467),T=s(T,E,m,_,u[d+2],9,-51403784),_=s(_,T,E,m,u[d+7],14,1735328473),m=s(m,_,T,E,u[d+12],20,-1926607734),E=a(E,m,_,T,u[d+5],4,-378558),T=a(T,E,m,_,u[d+8],11,-2022574463),_=a(_,T,E,m,u[d+11],16,1839030562),m=a(m,_,T,E,u[d+14],23,-35309556),E=a(E,m,_,T,u[d+1],4,-1530992060),T=a(T,E,m,_,u[d+4],11,1272893353),_=a(_,T,E,m,u[d+7],16,-155497632),m=a(m,_,T,E,u[d+10],23,-1094730640),E=a(E,m,_,T,u[d+13],4,681279174),T=a(T,E,m,_,u[d+0],11,-358537222),_=a(_,T,E,m,u[d+3],16,-722521979),m=a(m,_,T,E,u[d+6],23,76029189),E=a(E,m,_,T,u[d+9],4,-640364487),T=a(T,E,m,_,u[d+12],11,-421815835),_=a(_,T,E,m,u[d+15],16,530742520),m=a(m,_,T,E,u[d+2],23,-995338651),E=c(E,m,_,T,u[d+0],6,-198630844),T=c(T,E,m,_,u[d+7],10,1126891415),_=c(_,T,E,m,u[d+14],15,-1416354905),m=c(m,_,T,E,u[d+5],21,-57434055),E=c(E,m,_,T,u[d+12],6,1700485571),T=c(T,E,m,_,u[d+3],10,-1894986606),_=c(_,T,E,m,u[d+10],15,-1051523),m=c(m,_,T,E,u[d+1],21,-2054922799),E=c(E,m,_,T,u[d+8],6,1873313359),T=c(T,E,m,_,u[d+15],10,-30611744),_=c(_,T,E,m,u[d+6],15,-1560198380),m=c(m,_,T,E,u[d+13],21,1309151649),E=c(E,m,_,T,u[d+4],6,-145523070),T=c(T,E,m,_,u[d+11],10,-1120210379),_=c(_,T,E,m,u[d+2],15,718787259),m=c(m,_,T,E,u[d+9],21,-343485551),E=n(E,l),m=n(m,h),_=n(_,p),T=n(T,f);return r(E)+r(m)+r(_)+r(T)}(""+t+r)).slice(0,16),i=n.slice(0,12),o=await window.crypto.subtle.importKey("raw",n,"AES-GCM",!0,["encrypt"]);return new Uint8Array(await window.crypto.subtle.encrypt({name:"AES-GCM",iv:i},o,e))},wC=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new jb(((r,n)=>{t.toBlob((async e=>{if(t.remove(),e){const n=await NC(e);r({buffer:n,width:t.width,height:t.height})}else n(new Zn(Xn.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},NC=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function PC(e,t){if("VideoFrame"in window&&"TransformStream"in window&&Go().supportWebRTCInsertableStream){const r=new MediaStreamTrackProcessor(e),n=new MediaStreamTrackGenerator({kind:"video"});let i,o,s=Date.now();const a=()=>{c&&(clearInterval(c),c=void 0),i&&(i.close(),i=void 0),e.stop(),o=void 0,n.removeEventListener("ended",a)};let c=window.setInterval((()=>{if(o&&i&&Date.now()-s>(null!=t?t:1e3))try{"live"===n.readyState?o.enqueue(i.clone()):a()}catch(e){a()}}),null!=t?t:1e3);const u=new TransformStream({transform:(e,t)=>{"live"===n.readyState?(o=t,s=Date.now(),void 0===i?(i=e,t.enqueue(e.clone())):(t.enqueue(i),i=e)):e.close()}});return n.addEventListener("ended",a),r.readable.pipeThrough(u).pipeTo(n.writable),n}}var DC,LC,kC,MC,UC,xC,VC,FC,BC,jC,WC,GC,HC,KC,YC,XC,ZC,zC,JC,QC,qC,$C,ew,tw,rw,nw,iw,ow,sw,aw,cw,uw,dw,lw,hw,pw,fw,Ew,mw,_w;function Tw(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function gw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Tw(Object(r),!0).forEach((function(t){cg(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Tw(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let Sw=(DC=Fo({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),LC=Fo({argsMap:(e,t)=>[e.getTrackId(),t]}),kC=fI(),MC=Bi("LocalAudioTrack","_enabledMutex"),UC=Fo({argsMap:(e,t)=>[e.getTrackId(),t]}),xC=fI(),VC=Bi("LocalAudioTrack","_enabledMutex"),FC=Fo({argsMap:(e,t)=>[e.getTrackId(),t]}),BC=fI(),jC=fI(),WC=fI(),GC=Fo({argsMap:e=>[e.getTrackId()]}),HC=fI(),KC=Fo({argsMap:e=>[e.getTrackId()]}),YC=fI(),XC=Fo({argsMap:e=>[e.getTrackId()]}),ZC=Fo({argsMap:(e,t)=>[e.getTrackId(),t.name]}),zC=Fo({argsMap:e=>[e.getTrackId()]}),JC=class extends Gb{get _source(){return this.initWebAudio()}set _source(e){this._trackSource=e}get processorContext(){return this._processorContext||(this._processorContext=this.initProcessor().processorContext),this._processorContext}get processorDestination(){return this._processorDestination||(this._processorDestination=this.initProcessor().processorDestination),this._processorDestination}get isPlaying(){return this._useAudioElement?pI.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,n){super(e,r),cg(this,"trackMediaType",tl.AUDIO),cg(this,"_encoderConfig",void 0),cg(this,"_trackSource",void 0),cg(this,"metadata",[]),cg(this,"_enabled",!0),cg(this,"_volume",100),cg(this,"_useAudioElement",!0),cg(this,"_bypassWebAudio",!1),cg(this,"processor",void 0),cg(this,"_processorContext",void 0),cg(this,"_processorDestination",void 0),cg(this,"_getOriginVolumeLevel",void 0),cg(this,"_usePipeMode",!1),cg(this,"_useExtensionMode",!1),cg(this,"_extensionManager",void 0),this._encoderConfig=t,this._getOriginVolumeLevel=!!n,this._trackSource=new NI,to("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),to("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);vn()&&!qb()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(e){Qn(e,"volume",0,1e3),this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&pI.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void go.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const e=this._source.createOutputTrack();this._mediaStreamTrack!==e&&(this._mediaStreamTrack=e,pi(this,Xd.NEED_REPLACE_TRACK,this).then((()=>{go.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{go.warning("[".concat(this.getTrackId(),"] replace web audio track failed"),e)})))}catch(e){}}getVolumeLevel(){return this._muted&&this.enabled&&this._getOriginVolumeLevel?this._source.getOriginVolumeLevel():this._source.getAccurateVolumeLevel()}async setPlaybackDevice(e){if(!this._useAudioElement||!Ho())throw new Zn(Xn.NOT_SUPPORTED,"your browser does not support setting the audio output device");await pI.setSinkID(this.getTrackId(),e)}async setEnabled(e,t,r){return this._setEnabled(e,t,r)}async _setEnabled(e,t,r){if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(go.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){this._originMediaStreamTrack.enabled=!0;try{r||(this._enabled=!0),await pi(this,Xd.NEED_ENABLE_TRACK,this),go.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(e," success"))}catch(e){throw r||(this._enabled=!1),go.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,r||(this._enabled=!1);try{await pi(this,Xd.NEED_DISABLE_TRACK,this)}catch(e){throw r||(this._enabled=!0),go.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}}}async setMuted(e){e!==this._muted&&(this.stateCheck("muted",e),this._muted=e,this._originMediaStreamTrack.enabled=!e,go.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await pi(this,Xd.NEED_MUTE_TRACK,this):await pi(this,Xd.NEED_UNMUTE_TRACK,this))}getStats(){Oi((()=>{go.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const e=fi(this,Xd.GET_STATS);return e||gw({},il)}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(rl.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(rl.ON_AUDIO_BUFFER),this._source.on(rl.ON_AUDIO_BUFFER,(t=>e(t)))}play(){go.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(go.debug("[".concat(this.getTrackId(),"] start audio playback in element")),pI.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){go.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?pI.stop(this.getTrackId()):this._source.stop()}close(){super.close(),this._processorDestination&&this.unbindProcessorDestinationEvents(this._processorDestination),this._processorContext&&this.unbindProcessorContextEvents(this._processorContext),this.unpipe(),this._processorDestination&&this._processorDestination._source&&this._processorDestination._source.unpipe(),this._extensionManager&&(this._extensionManager.destroy(),this._extensionManager=void 0,this._useExtensionMode=!1),this._source.destroy()}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];go.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&pI.updateTrack(this.getTrackId(),this._mediaStreamTrack)}async _updateOriginMediaStreamTrack(e,t){this._originMediaStreamTrack!==e&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),t&&this._originMediaStreamTrack.stop()),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,this._muted&&(this._originMediaStreamTrack.enabled=!1),this.processor&&this._processorContext&&this.processor.updateInput({track:e,context:this._processorContext}),this._mediaStreamTrack!==this._source.outputTrack?(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await pi(this,Xd.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(e))}renewMediaStreamTrack(e){return jb.resolve(void 0)}_ensureExtensionManager(e){return this._extensionManager||(this._extensionManager=e.createAudioExtensionManager(this),this._extensionManager.onOutputTrackChanged=e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,pi(this,Xd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,pi(this,Xd.NEED_REPLACE_TRACK,this))}),this._extensionManager}useExtension(e,t){if(this._usePipeMode)throw new Zn(Xn.INVALID_OPERATION,"Cannot use useExtension() when pipe() mode is active. Call unpipe() first.");return this._ensureExtensionManager(e),this._useExtensionMode=!0,this._extensionManager.useExtension(e,t)}removeExtension(e){if(!this._extensionManager)return!1;const t=this._extensionManager.removeExtension(e);return t&&go.info("[".concat(this.getTrackId(),"] removeExtension: ").concat(e.name)),this._extensionManager.hasExtensions||(this._useExtensionMode=!1),t}addReferenceTrack(e){if(!this._extensionManager)throw new Zn(Xn.INVALID_OPERATION,"Call useExtension() before addReferenceTrack().");this._extensionManager.addReferenceTrack(e),go.info("[".concat(this.getTrackId(),"] addReferenceTrack"))}removeReferenceTrack(e){return!!this._extensionManager&&this._extensionManager.removeReferenceTrack(e)}pipe(e){if(this._useExtensionMode)throw new Zn(Xn.INVALID_OPERATION,"Cannot use pipe() when useExtension() mode is active. Call removeExtension() for all extensions first.");if(this._bypassWebAudio)throw new Zn(Xn.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new Zn(Xn.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this._usePipeMode=!0,this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,node:this._source.processSourceNode,context:this.processorContext}),e}unpipe(){var e;if(!this.processor)return;const t=this.processor;null===(e=this._source.processSourceNode)||void 0===e||e.disconnect(),this.processor._source=!1,this.processor=void 0,this._usePipeMode=!1,t.reset()}bindProcessorDestinationEvents(e){e.on(cl.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e),await pi(this,Xd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await pi(this,Xd.NEED_REPLACE_TRACK,this))})),e.on(cl.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(e){e.removeAllListeners(cl.ON_TRACK),e.removeAllListeners(cl.ON_NODE)}bindProcessorContextEvents(e){e.on(ul.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(e){e.removeAllListeners(ul.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof NI&&(this._trackSource=new aO(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const e=new wI(this._source.context,this.getTrackId(),"local"),t=new CI(e);return this._processorContext=e,this._processorDestination=t,this.bindProcessorContextEvents(e),this.bindProcessorDestinationEvents(t),this._source.on(rl.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:e})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(pI.stop(this.getTrackId()),this._source.play()),pi(this,Xd.NEED_REPLACE_MIXING_TRACK,this).then((()=>{go.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{go.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:e,processorDestination:t}}},bS(JC.prototype,"setVolume",[DC],Object.getOwnPropertyDescriptor(JC.prototype,"setVolume"),JC.prototype),bS(JC.prototype,"setPlaybackDevice",[LC,kC],Object.getOwnPropertyDescriptor(JC.prototype,"setPlaybackDevice"),JC.prototype),bS(JC.prototype,"setEnabled",[MC,UC,xC],Object.getOwnPropertyDescriptor(JC.prototype,"setEnabled"),JC.prototype),bS(JC.prototype,"setMuted",[VC,FC,BC],Object.getOwnPropertyDescriptor(JC.prototype,"setMuted"),JC.prototype),bS(JC.prototype,"getStats",[jC],Object.getOwnPropertyDescriptor(JC.prototype,"getStats"),JC.prototype),bS(JC.prototype,"setAudioFrameCallback",[WC],Object.getOwnPropertyDescriptor(JC.prototype,"setAudioFrameCallback"),JC.prototype),bS(JC.prototype,"play",[GC,HC],Object.getOwnPropertyDescriptor(JC.prototype,"play"),JC.prototype),bS(JC.prototype,"stop",[KC,YC],Object.getOwnPropertyDescriptor(JC.prototype,"stop"),JC.prototype),bS(JC.prototype,"close",[XC],Object.getOwnPropertyDescriptor(JC.prototype,"close"),JC.prototype),bS(JC.prototype,"pipe",[ZC],Object.getOwnPropertyDescriptor(JC.prototype,"pipe"),JC.prototype),bS(JC.prototype,"unpipe",[zC],Object.getOwnPropertyDescriptor(JC.prototype,"unpipe"),JC.prototype),JC),yw=(QC=Fo({argsMap:(e,t)=>[e.getTrackId(),t]}),qC=fI(),$C=Bi("MicrophoneAudioTrack","_enabledMutex"),ew=Fo({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),tw=fI(),rw=Fo({argsMap:e=>[e.getTrackId()]}),nw=class extends Sw{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,n){super(e,t.encoderConfig?Fd(t.encoderConfig):{},n,to("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),cg(this,"_config",void 0),cg(this,"_deviceName","default"),cg(this,"_constraints",void 0),cg(this,"_originalConstraints",void 0),cg(this,"_enabled",!0),this._config=t,this._constraints=r,this._originalConstraints=r,this._deviceName=e.label,"boolean"==typeof t.bypassWebAudio&&(this._bypassWebAudio=t.bypassWebAudio),(Dn()||Ln())&&Zb.bindInterruptDetectorTrack(this)}async setDevice(e){if(go.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await TO.getDeviceById(e),r={};r.audio=gw({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let n=null;try{n=await pO(r,this.getTrackId())}catch(e){throw go.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await pO({audio:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(n.getAudioTracks()[0],!1),e}await this._updateOriginMediaStreamTrack(n.getAudioTracks()[0],!1),this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw go.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await TO.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw go.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}go.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(e,t,r){if(t)return go.debug("[".concat(this.getTrackId(),"] setEnabled false (do not close microphone)")),await super._setEnabled(e);if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(go.info("[".concat(this.getTrackId(),"] start setEnabled"),e),to("AUTO_RESET_AUDIO_ROUTE")&&(On()||Mn())){const t=navigator.audioSession;t&&(e||(t.type="playback"),t.type="auto")}if(!e){var n;this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),null===(n=this._source.clonedTrack)||void 0===n||n.stop(),r||(this._enabled=!1);try{await pi(this,Xd.NEED_DISABLE_TRACK,this)}catch(e){throw go.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const i=gw({},this._constraints),o=TO.searchDeviceIdByName(this._deviceName);o&&!i.deviceId&&(i.deviceId=o);try{r||(this._enabled=!0);const e=await pO({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!1),await pi(this,Xd.NEED_ENABLE_TRACK,this)}catch(e){throw r||(this._enabled=!1),go.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}go.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(Dn()||Ln())&&Zb.unbindInterruptDetectorTrack(this),Gd()||Jb()}onTrackEnded(){if((On()||Mn())&&this._enabled&&!this._isClosed&&Zb.duringInterruption){const e=async()=>{Zb.off(zo.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(go.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};Zb.on(zo.IOS_INTERRUPTION_END,e)}else go.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit($d.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=TO.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await pO({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(e){super.bindProcessorContextEvents(e),e.on(ul.REQUEST_UPDATE_CONSTRAINTS,(async(e,t,r)=>{try{const r=Object.assign({},this._originalConstraints,...e);await this.renewMediaStreamTrack(r),t()}catch(e){r(e)}}))}unbindProcessorContextEvents(e){super.unbindProcessorContextEvents(e),e.removeAllListeners(ul.REQUEST_UPDATE_CONSTRAINTS)}},bS(nw.prototype,"setDevice",[QC,qC],Object.getOwnPropertyDescriptor(nw.prototype,"setDevice"),nw.prototype),bS(nw.prototype,"setEnabled",[$C,ew,tw],Object.getOwnPropertyDescriptor(nw.prototype,"setEnabled"),nw.prototype),bS(nw.prototype,"close",[rw],Object.getOwnPropertyDescriptor(nw.prototype,"close"),nw.prototype),nw),Rw=(iw=Fo({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),ow=fI(),sw=Fo({argsMap:e=>[e.getTrackId()]}),aw=fI(),cw=Fo({argsMap:e=>[e.getTrackId()]}),uw=fI(),dw=Fo({argsMap:e=>[e.getTrackId()]}),lw=fI(),hw=Fo({argsMap:e=>[e.getTrackId()]}),pw=fI(),fw=Fo({argsMap:e=>[e.getTrackId()]}),Ew=Fo({argsMap:e=>[e.getTrackId()]}),mw=fI(),bS((_w=class extends Sw{get __className__(){return"BufferSourceAudioTrack"}constructor(e,t,r,n){super(t.createOutputTrack(),r,n),cg(this,"source",void 0),cg(this,"_bufferSource",void 0),this._useAudioElement=!1,this.source=e,this._bufferSource=t,this._bufferSource.on(rl.AUDIO_SOURCE_STATE_CHANGE,(e=>{this.safeEmit($d.SOURCE_STATE_CHANGE,e)}));try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(e){}}get currentState(){return this._bufferSource.currentState}get duration(){return this._bufferSource.duration}get playbackSpeed(){return this._bufferSource.playbackSpeed}getCurrentTime(){return this._bufferSource.currentTime}startProcessAudioBuffer(e){e&&this._bufferSource.updateOptions(e),this._bufferSource.startProcessAudioBuffer()}pauseProcessAudioBuffer(){this._bufferSource.pauseProcessAudioBuffer()}seekAudioBuffer(e){this._bufferSource.seekAudioBuffer(e)}resumeProcessAudioBuffer(){this._bufferSource.resumeProcessAudioBuffer()}stopProcessAudioBuffer(){this._bufferSource.stopProcessAudioBuffer()}close(){this.source=null,this._bufferSource.destroy(),super.close()}setAudioBufferPlaybackSpeed(e){Qn(e,"speed",0),this._bufferSource.setAudioBufferPlaybackSpeed(e)}}).prototype,"startProcessAudioBuffer",[iw,ow],Object.getOwnPropertyDescriptor(_w.prototype,"startProcessAudioBuffer"),_w.prototype),bS(_w.prototype,"pauseProcessAudioBuffer",[sw,aw],Object.getOwnPropertyDescriptor(_w.prototype,"pauseProcessAudioBuffer"),_w.prototype),bS(_w.prototype,"seekAudioBuffer",[cw,uw],Object.getOwnPropertyDescriptor(_w.prototype,"seekAudioBuffer"),_w.prototype),bS(_w.prototype,"resumeProcessAudioBuffer",[dw,lw],Object.getOwnPropertyDescriptor(_w.prototype,"resumeProcessAudioBuffer"),_w.prototype),bS(_w.prototype,"stopProcessAudioBuffer",[hw,pw],Object.getOwnPropertyDescriptor(_w.prototype,"stopProcessAudioBuffer"),_w.prototype),bS(_w.prototype,"close",[fw],Object.getOwnPropertyDescriptor(_w.prototype,"close"),_w.prototype),bS(_w.prototype,"setAudioBufferPlaybackSpeed",[Ew,mw],Object.getOwnPropertyDescriptor(_w.prototype,"setAudioBufferPlaybackSpeed"),_w.prototype),_w);class vw extends Sw{get __className__(){return"MixingAudioTrack"}get isActive(){for(const e of this.trackList)if(e._enabled&&!e._isClosed&&!e.muted)return!0;return!1}constructor(){const e=Qb().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,wi(8,"track-mix-")),cg(this,"trackList",void 0),cg(this,"destNode",void 0),this._useAudioElement=!1;try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(e){}this.destNode=e,this.trackList=[]}hasAudioTrack(e){return-1!==this.trackList.indexOf(e)}addAudioTrack(e){-1===this.trackList.indexOf(e)?(go.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):go.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){go.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}yi(this.trackList,e),this.updateEncoderConfig()}}updateEncoderConfig(){const e={};this.trackList.forEach((t=>{t._encoderConfig&&((t._encoderConfig.bitrate||0)>(e.bitrate||0)&&(e.bitrate=t._encoderConfig.bitrate),(t._encoderConfig.sampleRate||0)>(e.sampleRate||0)&&(e.sampleRate=t._encoderConfig.sampleRate),(t._encoderConfig.sampleSize||0)>(e.sampleSize||0)&&(e.sampleSize=t._encoderConfig.sampleSize),t._encoderConfig.stereo&&(e.stereo=!0))})),this._encoderConfig=e}_updateRtpTransceiver(e){this._rtpTransceiver!==e&&(this._rtpTransceiver=e,this.trackList.forEach((t=>{t instanceof vw?t.emit(qd.TRANSCEIVER_UPDATED,e):t._updateRtpTransceiver(e)})))}}class Aw extends sO{set currentState(e){e!==this._currentState&&(this._currentState=e,this.safeEmit(rl.AUDIO_SOURCE_STATE_CHANGE,this._currentState))}get currentState(){return this._currentState}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),cg(this,"audioBuffer",void 0),cg(this,"sourceNode",void 0),cg(this,"startPlayTime",0),cg(this,"startPlayOffset",0),cg(this,"pausePlayTime",0),cg(this,"options",void 0),cg(this,"currentLoopCount",0),cg(this,"currentPlaybackSpeed",100),cg(this,"_currentState","stopped"),this.audioBuffer=e,this.options=t,this.startPlayOffset=this.options.startPlayTime||0}createWebAudioDiagram(){return this.context.createGain()}get duration(){return this.audioBuffer?this.audioBuffer.duration:0}get playbackSpeed(){return this.currentPlaybackSpeed}get currentTime(){return this.audioBuffer?"stopped"===this.currentState?0:"paused"===this.currentState?this.pausePlayTime:((this.context.currentTime-this.startPlayTime)*(this.playbackSpeed/100)+this.startPlayOffset)%this.audioBuffer.duration:0}updateOptions(e){"stopped"===this.currentState?(this.options=e,this.startPlayOffset=this.options.startPlayTime||0):go.warning("can not set audio source options")}startProcessAudioBuffer(){this.sourceNode&&this.stopProcessAudioBuffer(),this.sourceNode=this.createSourceNode(),this.startSourceNode(),this.currentState="playing"}pauseProcessAudioBuffer(){this.sourceNode&&"playing"===this.currentState&&(this.pausePlayTime=this.currentTime,this.sourceNode.onended=null,this.sourceNode.stop(),this.sourceNode.buffer=null,this.sourceNode=this.createSourceNode(),this.currentState="paused")}seekAudioBuffer(e){this.sourceNode&&(this.sourceNode.onended=null,"playing"===this.currentState&&this.sourceNode.stop(),this.sourceNode=this.createSourceNode(),"playing"===this.currentState?(this.startPlayOffset=e,this.startSourceNode()):"paused"===this.currentState&&(this.pausePlayTime=e))}resumeProcessAudioBuffer(){"paused"===this.currentState&&this.sourceNode&&(this.startPlayOffset=this.pausePlayTime,this.pausePlayTime=0,this.startSourceNode(),this.currentState="playing")}stopProcessAudioBuffer(){if(this.sourceNode){this.sourceNode.onended=null;try{this.sourceNode.stop()}catch(e){}this.reset()}}destroy(){this.audioBuffer=null,super.destroy()}setAudioBufferPlaybackSpeed(e){this.sourceNode&&("playing"===this.currentState&&(this.startPlayOffset=this.currentTime,this.startPlayTime=this.context.currentTime),this.sourceNode.playbackRate.value=e/100),this.currentPlaybackSpeed=e}startSourceNode(){this.sourceNode&&this.sourceNode.buffer&&(this.sourceNode.start(0,this.startPlayOffset),this.startPlayTime=this.context.currentTime,this.sourceNode.onended=this.handleSourceNodeEnded.bind(this))}createSourceNode(){const e=this.context.createBufferSource();return e.buffer=this.audioBuffer,e.loop=!!this.options.loop,e.connect(this.outputNode),e.playbackRate.value=this.currentPlaybackSpeed/100,e}handleSourceNodeEnded(){if(this.currentLoopCount+=1,this.options.cycle&&this.options.cycle>this.currentLoopCount)return this.startPlayOffset=0,this.sourceNode=void 0,void this.startProcessAudioBuffer();this.reset()}reset(){this.startPlayOffset=this.options.startPlayTime||0,this.currentState="stopped",this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=void 0),this.currentLoopCount=0}}const bw=new Map;function Ow(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Iw(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ow(Object(r),!0).forEach((function(t){cg(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ow(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function Cw(e,t){if(0===e.length||0===t.length)return 1/0;const r=Ui(e),n=Ui(t);return Math.floor(n/r)}class ww{get rendFrameRate(){const e=Math.max(1,Cw(this._render_interframe_delays_sizes,this._render_interframe_delays));return Math.floor(1e3/e)}get videoElementStatus(){return this._isInPage?this._videoElementStatus:hl.DESTROYED}set videoElementStatus(e){e!==this._videoElementStatus&&(go.debug("[".concat(this.trackId,"] video-element-status change ").concat(this._videoElementStatus," => ").concat(e)),this._videoElementStatus=e)}get videoState(){return this._videoState}set videoState(e){var t;e!==this._videoState&&(this._videoState=e,null===(t=this.onVideoStateChanged)||void 0===t||t.call(this,this.videoState))}constructor(e){cg(this,"trackId",void 0),cg(this,"config",void 0),cg(this,"onFirstVideoFrameDecoded",void 0),cg(this,"onFirstVideoFrameRender",void 0),cg(this,"onVideoBufferReady",void 0),cg(this,"onVideoStateChanged",void 0),cg(this,"freezeTimeCounterList",[]),cg(this,"renderFreezeAccTime",0),cg(this,"renderFreezeAccTime2",0),cg(this,"totalFreezeTime",0),cg(this,"isKeepLastFrame",!1),cg(this,"isDestroyed",!1),cg(this,"timeUpdatedCount",0),cg(this,"freezeTime",0),cg(this,"playbackTime",0),cg(this,"lastTimeUpdatedTime",0),cg(this,"autoplayFailed",!1),cg(this,"videoTrack",void 0),cg(this,"videoElement",void 0),cg(this,"cacheVideoElement",void 0),cg(this,"cancelRVFId",void 0),cg(this,"internal",!1),cg(this,"_render_interframe_delays",[]),cg(this,"_render_interframe_delays_sizes",[]),cg(this,"_videoState",pl.VideoStateStopped),cg(this,"videoElementCheckInterval",void 0),cg(this,"videoElementFreezeTimeout",void 0),cg(this,"_videoElementStatus",hl.NONE),cg(this,"_isInPage",!0),cg(this,"isGettingVideoDimensions",!1),cg(this,"startGetVideoDimensions",(()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return go.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()})),cg(this,"autoResumeAfterInterruption",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===Zb.curState&&(go.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Sn())),kn()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),cg(this,"handleVideoEvents",(e=>{switch(e.type){case"play":case"playing":"play"===e.type&&go.debug("[".concat(this.trackId,"] video element status: play")),this.startGetVideoDimensions(),this.videoElementStatus=hl.PLAYING;break;case"loadeddata":if(this.videoState=pl.VideoStateStarting,this.onFirstVideoFrameRender&&this.onFirstVideoFrameRender(),this.onFirstVideoFrameDecoded&&this.onFirstVideoFrameDecoded(),this.cacheVideoElement){try{this.cacheVideoElement.srcObject=null,this.cacheVideoElement.remove()}catch(e){}this.cacheVideoElement=void 0}break;case"canplay":this.videoElementStatus=hl.CANPLAY;break;case"stalled":this.videoElementStatus=hl.STALLED;break;case"suspend":this.videoElementStatus=hl.SUSPEND;break;case"pause":this.videoElementStatus=hl.PAUSED,On()||Mn()||vn()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(go.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=hl.WAITING;break;case"abort":this.videoElementStatus=hl.ABORT;break;case"ended":this.videoElementStatus=hl.ENDED;break;case"emptied":this.videoElementStatus=hl.EMPTIED;break;case"error":{const e=this.videoElement.error;e&&(this.videoElementStatus=hl.ERROR,go.error("[".concat(this.trackId,"] media error: ").concat(e.message," (").concat(e.code,")")));break}case"timeupdate":{const e=performance.now();if(this.timeUpdatedCount+=1,this.onVideoBufferReady&&this.timeUpdatedCount>to("BUFFER_READY_FRAMES")&&this.onVideoBufferReady(),this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime,r=this.lastTimeUpdatedTime;if(this.lastTimeUpdatedTime=e,WN.lastVisibleTime<WN.lastHiddenTime||r<WN.lastHiddenTime||r<WN.lastVisibleTime)return;if(this.isSkipCalcRenderFreezeTime())return;for(t>to("VIDEO_FREEZE_DURATION")&&(this.freezeTime+=t),this.playbackTime+=t;this.playbackTime>=6e3;){this.playbackTime-=6e3;const e=Math.min(6e3,this.freezeTime);this.freezeTimeCounterList.push(e),this.freezeTime=Math.max(0,this.freezeTime-6e3)}break}}})),cg(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(go.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Sn())),kn()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),this.trackId=e.trackId,this.config=e,e.element instanceof HTMLVideoElement?this.videoElement=e.element:this.videoElement=document.createElement("video"),Zb.on(zo.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),Zb.on(zo.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16)}getVideoElement(){return this.videoElement}getContainerElement(){var e;return null!==(e=this.videoElement.parentElement)&&void 0!==e?e:void 0}updateConfig(e){this.config=e,this.trackId=e.trackId,e.element!==this.videoElement&&(this.destroy(),this.videoElement=e.element),this.videoTrack&&this.initVideoElement()}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.initVideoElement())}play(e){var t;const r=this.videoElement,n=r.play(),i=null!==(t=function(e,t,r,n){if(!oI.delete(e))return;if(null==r||!r.catch)return;return sI.set(e,r),lI(r,(()=>t.play()),(()=>sI.get(e)===r&&e.getVideoElement()===t),n)}(this,r,n,e))&&void 0!==t?t:n;null!=i&&i.catch&&i.catch((t=>{e&&rI(e,"video",t.message,this.trackId),"NotAllowedError"===t.name?(go.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):go.warning("[".concat(this.trackId,"] play warning: "),t)}));const o=_n();if(("Safari"===o.name&&15===Number(o.version)||Dn())&&i&&i.then){const e=()=>{this.config.mirror&&!this.config.noStyle&&(this.videoElement.style.transform="rotateY(180deg)")};i.then(e).catch(e)}}getCurrentFrame(){const e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;const t=e.getContext("2d");if(!t)return go.error("create canvas context failed!"),new ImageData(2,2);t.drawImage(this.videoElement,0,0,e.width,e.height);const r=t.getImageData(0,0,e.width,e.height);return e.remove(),r}async getCurrentFrameToUint8Array(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const r=document.createElement("canvas");r.width=this.videoElement.videoWidth,r.height=this.videoElement.videoHeight;const n=r.getContext("2d");return n?(n.drawImage(this.videoElement,0,0,r.width,r.height),new jb(((n,i)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await NC(e);n({buffer:t,width:r.width,height:r.height})}else i(new Zn(Xn.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,t<0?.1:t>1?1:t)}))):await wC(e)}destroy(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];var t;t=this,sI.delete(t),this.isDestroyed=!0,Zb.off(zo.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),Zb.off(zo.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),e?this.videoElement.pause():this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=pl.VideoStateStopped}initVideoElement(){if(this._videoElementStatus!==hl.NONE&&this._videoElementStatus!==hl.DESTROYED||(this.videoElementStatus=hl.INIT),!this.videoElementCheckInterval&&(Nw.forEach((e=>{this.videoElement.addEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((()=>{this._isInPage=function(e){return e!==document.body&&document.body.contains(e)}(this.videoElement)}),1e3),to("ENABLE_VIDEO_FRAME_CALLBACK"))){var e,t;let r;const n=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",n),this.videoElementFreezeTimeout=window.setTimeout(i,to("VIDEO_FREEZE_DURATION")))},i=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===pl.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=pl.VideoStateFrozen:document.addEventListener("visibilitychange",n))},o=(e,t)=>{if(this.videoElementStatus===hl.PLAYING){if(r){const e=t.presentationTime-r.presentationTime,n=t.presentedFrames-r.presentedFrames;this._render_interframe_delays_sizes.push(n),this._render_interframe_delays.push(e);const o=Ui(this._render_interframe_delays_sizes),s=o-this._render_interframe_delays_sizes[0];if(o>30&&s>5&&(this._render_interframe_delays_sizes.shift(),this._render_interframe_delays.shift()),this.videoState===pl.VideoStateStarting&&(this.videoState=pl.VideoStateDecoding),this.videoState===pl.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(i,to("VIDEO_FREEZE_DURATION"))),e<to("VIDEO_FREEZE_DURATION")&&this.videoState===pl.VideoStateFrozen&&(this.videoState=pl.VideoStateDecoding),e>to("VIDEO_FREEZE_DURATION")&&WN.lastVisibleTime>=WN.lastHiddenTime&&r.timestamp>WN.lastVisibleTime&&r.timestamp>WN.lastHiddenTime){const t=Math.min(66,Cw(this._render_interframe_delays_sizes,this._render_interframe_delays)),r=Math.max(0,e-(n-1)*t),i=r>t?r:0;this.renderFreezeAccTime2+=i,this.totalFreezeTime+=i,this.renderFreezeAccTime+=e}}r=Iw(Iw({},t),{},{timestamp:e})}else this.isSkipCalcRenderFreezeTime()&&(r=Iw(Iw({},t),{},{timestamp:e}));var n,s;to("ENABLE_VIDEO_FRAME_CALLBACK")&&(this.cancelRVFId=null===(n=(s=this.videoElement).requestVideoFrameCallback)||void 0===n?void 0:n.call(s,o))};this.cancelRVFId=null===(e=(t=this.videoElement).requestVideoFrameCallback)||void 0===e?void 0:e.call(t,o)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),Bn()&&!to("HIDE_NO_POSTER")&&(this.videoElement.poster="noposter");const r=_n();if(this.config.noStyle||("Safari"===r.name&&15===Number(r.version)||Dn()||!this.config.mirror||(this.videoElement.style.transform="rotateY(180deg)"),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover"),this.videoElement.setAttribute("muted",""),this.videoElement.muted=!0,this.videoElement.srcObject&&this.videoElement.srcObject instanceof MediaStream){this.videoElement.srcObject.getVideoTracks()[0]!==this.videoTrack&&(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,bn()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,bn()&&this.videoElement.load();const n=this.videoElement.play();void 0!==n&&n.catch((e=>{go.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){var e,t;(Nw.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.cancelRVFId&&this.videoElement)&&(null===(e=(t=this.videoElement).cancelVideoFrameCallback)||void 0===e||e.call(t,this.cancelRVFId),this.cancelRVFId=void 0);this.videoElementStatus=hl.NONE}isSkipCalcRenderFreezeTime(){return this.videoElementStatus===hl.DESTROYED||this.internal}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{go.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{go.error(e)})),this.autoplayFailed=!1,jn()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};jn()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),$O()}}const Nw=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class Pw extends ww{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];super(e),cg(this,"container",void 0),cg(this,"slot",void 0),this.slot=e.element,this.internal=t,this.updateConfig(e)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;var r;!this.internal||this.slot?(t!==this.slot&&(this.destroy(),this.slot=t),this.createElements()):(this.slot=t,t&&this.container?(this.internal=!1,this.container.id="agora-video-player-".concat(this.trackId),this.videoElement.id="video_".concat(this.trackId),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover",null===(r=this.slot)||void 0===r||r.appendChild(this.container)):this.createElements())}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}play(e){var t;null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)&&super.play(e)}getCurrentFrame(){var e;return null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)?super.getCurrentFrame():new ImageData(2,2)}async getCurrentFrameToUint8Array(e){var t;let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return null!==(t=this.container)&&void 0!==t&&t.contains(this.videoElement)?await super.getCurrentFrameToUint8Array(e,r):await wC(e)}destroy(){if(super.destroy(),this.videoElement.remove(),this.videoElement=document.createElement("video"),this.container){try{var e;this.container.remove(),null===(e=this.slot)||void 0===e||e.removeChild(this.container)}catch(e){}this.container=void 0}}createElements(){var e;this.container||(this.container=document.createElement("div")),this.container.id="agora-video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.videoTrack?(this.container.style.backgroundColor="black",to("KEEP_LAST_FRAME")&&this.isKeepLastFrame&&this.videoElement.paused&&this.resetVideoElement(),this.mountedVideoElement()):this.unmountedVideoElement(),null===(e=this.slot)||void 0===e||e.appendChild(this.container)}mountedVideoElement(){var e;!this.container||null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)||this.container.appendChild(this.videoElement),super.initVideoElement(),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="agora_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.style.left="0",this.videoElement.style.top="0"}unmountedVideoElement(){var e;if(null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)){super.resetVideoElement();try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=document.createElement("video")}}resetVideoElement(){var e;null!==(e=this.container)&&void 0!==e&&e.contains(this.videoElement)&&(super.resetVideoElement(),this.cacheVideoElement=this.videoElement,this.videoElement=document.createElement("video"))}getContainerElement(){return this.container}}var Dw,Lw,kw,Mw,Uw,xw,Vw,Fw,Bw,jw,Ww,Gw,Hw,Kw,Yw,Xw,Zw,zw,Jw,Qw,qw,$w,eN,tN,rN,nN,iN,oN,sN,aN,cN,uN,dN,lN,hN,pN,fN,EN;function mN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _N(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?mN(Object(r),!0).forEach((function(t){cg(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):mN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let TN=(Dw=Fo({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),Lw=fI(),kw=Fo({argsMap:e=>[e.getTrackId()]}),Mw=Bi("LocalVideoTrack","_enabledMutex"),Uw=Fo({argsMap:(e,t)=>[e.getTrackId(),t]}),xw=fI(),Vw=Bi("LocalVideoTrack","_enabledMutex"),Fw=Fo({argsMap:(e,t)=>[e.getTrackId(),t]}),Bw=fI(),jw=Fo({argsMap:(e,t)=>[e.getTrackId(),t,e._saveEncodeBitrateRatio]}),Ww=fI(),Gw=Fo({argsMap:(e,t)=>[e.getTrackId(),t]}),Hw=fI(),Kw=fI(),Yw=Fo({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),Xw=fI(),Zw=fI(),zw=fI(),Jw=Fo({argsMap:e=>[e.getTrackId()]}),Qw=fI(),qw=fI(),$w=fI(),eN=fI(),tN=fI(),rN=Fo({argsMap:(e,t)=>[e.getTrackId(),t.name]}),nN=Fo({argsMap:e=>[e.getTrackId()]}),iN=Fo({argsMap:e=>[e.getTrackId()]}),oN=Fo({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),sN=class e extends Gb{get videoHeight(){if(vn()){const e=this._mediaStreamTrack.getSettings().height;return this._videoHeight=e,this._videoHeight}return this._videoHeight}get videoWidth(){if(vn()){const e=this._mediaStreamTrack.getSettings().width;return this._videoWidth=e,this._videoWidth}return this._videoWidth}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==hl.PLAYING)}get processorDestination(){return this._processorDestination}get processorContext(){return this._processorContext}set processorContext(e){this._processorContext=e}get __className__(){return"LocalVideoTrack"}constructor(e,t,r,n,i,o){if(super(e,i),cg(this,"trackMediaType",tl.VIDEO),cg(this,"_player",void 0),cg(this,"isUseScaleResolutionDownBy",!1),cg(this,"_videoVisibleTimer",null),cg(this,"_previousVideoVisibleStatus",void 0),cg(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),cg(this,"_encoderConfig",void 0),cg(this,"_scalabilityMode",{numSpatialLayers:1,numTemporalLayers:1}),cg(this,"_optimizationMode",void 0),cg(this,"_saveEncodeBitrateRatio",1),cg(this,"_videoHeight",void 0),cg(this,"_videoWidth",void 0),cg(this,"_forceBitrateLimit",void 0),cg(this,"_enabled",!0),cg(this,"_processorDestination",void 0),cg(this,"_processorContext",void 0),cg(this,"_usePipeMode",!1),cg(this,"_useExtensionMode",!1),cg(this,"_extensionManager",void 0),vn()){const t=e.getSettings(),r=t.width,n=t.height;this._videoWidth=r,this._videoHeight=n}else this.updateMediaStreamTrackResolution();if(this._scalabilityMode=r,this._optimizationMode=n,this._hints=o||[],t&&-1!==this._hints.indexOf(Zd.CUSTOM_TRACK)?this._encoderConfig=vi(t):this._encoderConfig=t,-1===this._hints.indexOf(Zd.SCREEN_TRACK))this.updateBitrateFromProfile();else if(Cn(pn.CHROME,115)&&-1!==gn().indexOf("Windows")){const t=PC(e);t&&(go.info("local screen video track begin to inject frame"),this._mediaStreamTrack=t)}t&&-1!==this._hints.indexOf(Zd.CUSTOM_TRACK)&&this.setEncoderConfiguration(t),this._processorContext=new II(this.getTrackId(),"local"),this._processorDestination=new OI(this.processorContext),this.bindProcessorDestinationEvents()}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e){const t=document.getElementById(e);t?e=t:(go.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}go.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=_N(_N(_N({},this._getDefaultPlayerConfig()),t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new ww(r):this._player=new Pw(r),this._player.updateVideoTrack(this._mediaStreamTrack)),this._player.play(),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit($d.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),to("CHECK_VIDEO_VISIBLE_INTERVAL"))}stop(){this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(),this._player=void 0,go.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(go.info("[".concat(this.getTrackId(),"] start setEnabled"),e),!e){this._originMediaStreamTrack.enabled=!1;try{await pi(this,Xd.NEED_DISABLE_TRACK,this)}catch(e){throw go.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return t||(this._enabled=!1),void go.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await pi(this,Xd.NEED_ENABLE_TRACK,this)}catch(e){throw go.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}go.info("[".concat(this.getTrackId(),"] setEnabled to true success")),t||(this._enabled=!0)}async setMuted(e){e!==this._muted&&(this.stateCheck("muted",e),this._muted=e,this._originMediaStreamTrack.enabled=!e,go.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await pi(this,Xd.NEED_MUTE_TRACK,this):await pi(this,Xd.NEED_UNMUTE_TRACK,this))}async setSaveEncodeBitrateRatio(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this._saveEncodeBitrateRatio;if(1!==this._saveEncodeBitrateRatio&&this._encoderConfig&&this._encoderConfig.bitrateMax&&this._encoderConfig.bitrateMin){this._encoderConfig.bitrateMin=Math.floor(this._encoderConfig.bitrateMin*e),this._encoderConfig.bitrateMax=Math.floor(this._encoderConfig.bitrateMax*e),go.debug("[".concat(this.getTrackId(),"] set save encode bitrate ratio, ").concat(e)),this._saveEncodeBitrateRatio=1;try{await pi(this,Xd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(go)}}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new Zn(Xn.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");if(e=Md(e),to("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin),e.width||e.height||e.frameRate){const t=LI({encoderConfig:e});(vn()||On()||Mn())&&(t.deviceId=void 0),go.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(e),JSON.stringify(t));try{await this._originMediaStreamTrack.applyConstraints(t),this.updateMediaStreamTrackResolution()}catch(e){const t=new Zn(Xn.UNEXPECTED_ERROR,e.toString());throw go.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=e,-1===this._hints.indexOf(Zd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await pi(this,Xd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(go)}}getStats(){Oi((()=>{go.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const e=fi(this,Xd.GET_STATS);return e||_N({},ol)}async setBeautyEffect(e){go.error("LocalVideoTrack.setBeautyEffect was deprecated, please migrate to agora-extension-beauty-effect")}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}async getCurrentFrameImage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._player?this._player.getCurrentFrameToUint8Array(e,t):await wC(e)}async findClosestProfile(){const e=this.getMediaStreamTrackSettings(),t=e.width,r=e.height,n=e.frameRate,i=this._encoderConfig||{},o=i.width,s=i.height,a=i.frameRate,c=Mi(this._videoWidth||t||o||0),u=Mi(this._videoHeight||r||s||0),d=bC(c,u,Mi(n||a||15));if(d)return go.debug("[".concat(this.getTrackId(),"] find closest profile, ").concat(c,"x").concat(u," => ").concat(JSON.stringify(d))),this.setEncoderConfiguration(d)}async setBitrateLimit(e){go.debug("[".concat(this.getTrackId(),"] set bitrate limit, ").concat(JSON.stringify(e))),e&&(this._forceBitrateLimit=e,this._encoderConfig&&(this._encoderConfig.bitrateMax?this._encoderConfig.bitrateMax=this._encoderConfig.bitrateMax<e.max_bitrate?this._encoderConfig.bitrateMax:e.max_bitrate:this._encoderConfig.bitrateMax=e.max_bitrate,this._encoderConfig.bitrateMin,this._encoderConfig.bitrateMin=e.min_bitrate))}async setOptimizationMode(e){if("motion"!==e&&"detail"!==e&&"balanced"!==e)return void go.error(Xn.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const t=this._optimizationMode;try{this._optimizationMode=e,await pi(this,Xd.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){throw this._optimizationMode=t,go.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}go.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(e,")"))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return go.error(Xn.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,go.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){const e=this._originMediaStreamTrack;DI(e).then((t=>{let r=JO(t,2),n=r[0],i=r[1];this._videoHeight=i,this._videoWidth=n,e===this._originMediaStreamTrack&&n>0&&i>0&&this.safeEmit(Xd.VIDEO_RESOLUTION_UPDATED,this)})).catch(Ni)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}async setSenderConfiguration(e){if(!this._enabled)throw new Zn(Xn.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");go.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(e)),e=Md(e),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin),this._encoderConfig=e,-1===this._hints.indexOf(Zd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await pi(this,Xd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(go)}}updateBitrateFromProfile(){if(!this._encoderConfig)return;const e=this.getMediaStreamTrackSettings(),t=e.width,r=e.height,n=e.frameRate;if(!t||!r||!n)return;const i=this._encoderConfig,o=i.bitrateMax,s=i.bitrateMin;if(null==s||null==o){const e=OC(t,r,n,s,o),i=e.max,a=e.min;if(this._encoderConfig.bitrateMin=a,this._encoderConfig.bitrateMax=i,to("VIDEO_STANDARD_BITRATE_VERSION")&&null==s&&null==o){const e=JO(AC(t,r,n),2),i=e[0],o=e[1];this._encoderConfig.bitrateMax=i,this._encoderConfig.bitrateMin=a?Math.min(a,i):i,this._saveEncodeBitrateRatio=o,go.debug("[".concat(this.getTrackId(),"] update new bitrate from profile, [w: ").concat(t,", h: ").concat(r,", fps: ").concat(n,"] => [brMax: ").concat(this._encoderConfig.bitrateMax,", brMin: ").concat(this._encoderConfig.bitrateMin,", save_bitrate_ratio: ").concat(this._saveEncodeBitrateRatio,"]"))}else go.debug("[".concat(this.getTrackId(),"] update bitrate from profile, [w: ").concat(t,", h: ").concat(r,", fps: ").concat(n,"] => [brMax: ").concat(i,", brMin: ").concat(a,"]")),this._saveEncodeBitrateRatio=1}}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),n={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},i=n.element,o=n.slot;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=ri.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Bo.reportApiInvoke(null,{tag:ui.TRACER,name:ci.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE,options:[this.getTrackId()]});t.visible?e.onSuccess("Video is visible"):e.onSuccess("Invisible because of ".concat(t.reason))}return t}return}catch(e){throw new Zn(Xn.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}async renewMediaStreamTrack(e){}_ensureVideoExtensionManager(e){return this._extensionManager||(this._extensionManager=e.createVideoExtensionManager(this),this._extensionManager.onOutputTrackChanged=e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),pi(this,Xd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),pi(this,Xd.NEED_REPLACE_TRACK,this))},this._extensionManager.onEmpty=()=>{this._useExtensionMode=!1,this._extensionManager=void 0}),this._extensionManager}useExtension(e,t){if(this._usePipeMode)throw new Zn(Xn.INVALID_OPERATION,"Cannot use useExtension() when pipe() mode is active. Call unpipe() first.");return this._ensureVideoExtensionManager(e),this._useExtensionMode=!0,this._extensionManager.useExtension(e,t)}removeExtension(e){if(!this._extensionManager)return!1;const t=this._extensionManager.removeExtension(e);return t&&go.info("[".concat(this.getTrackId(),"] removeExtension: ").concat(e.name)),this._extensionManager.hasExtensions||(this._useExtensionMode=!1),t}pipe(e){if(this._useExtensionMode)throw new Zn(Xn.INVALID_OPERATION,"Cannot use pipe() when useExtension() mode is active. Call removeExtension() for all extensions first.");if(this.processor===e)return e;if(e._source)throw new Zn(Xn.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this._usePipeMode=!0,this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,context:this.processorContext}),e}unpipe(){if(!this.processor)return;const e=this.processor;this.processor._source=void 0,this.processor=void 0,this._usePipeMode=!1,e.reset()}close(){super.close(),this.unbindProcessorDestinationEvents(),this.unbindProcessorContextEvents(),this.unpipe(),this.processorDestination._source&&this.processorDestination._source.unpipe(),this._extensionManager&&(this._extensionManager.destroy(),this._extensionManager=void 0,this._useExtensionMode=!1)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._encoderConfig;t&&(n=_N(_N({},n),Md(t))),n=Ai(n);const i=wi(8,"track-video-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,n,Ai(this._scalabilityMode),this._optimizationMode,i,Ai(this._hints));return t&&n&&o.setEncoderConfiguration(n),go.debug("clone video track from ".concat(this.getTrackId()," to ").concat(i,", clone ").concat(r)),o}async replaceTrack(e,t){if(!(e instanceof MediaStreamTrack))throw new Zn(Xn.INVALID_PARAMS,"track should be an instance of MediaStreamTrack");if("video"!==e.kind)throw new Zn(Xn.INVALID_PARAMS,"track should be a video MediaStreamTrack");await this._updateOriginMediaStreamTrack(e,t,!0),this.updateMediaStreamTrackResolution()}sendSeiData(e){if(Oi((()=>{Bo.reportApiInvoke(null,{name:ci.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:ui.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!to("ENABLE_VIDEO_SEI")||!to("ENABLE_ENCODED_TRANSFORM"))return void go.warning('To send/receive SEI, please call AgoraRTC.setParameter("ENABLE_VIDEO_SEI", true) before instantiate IAgoraRtcClient');if(e instanceof Uint8Array==!1)return new Zn(Xn.INVALID_PARAMS,"Invalid argument type, ILocalVideoTrack.sendSeiData() only accept Uint8Array argument.").throw();const t=this.getRTCRtpTransceiver();if(!t)return void go.warning("Video track is not published, SEI can not be send");const r=t.sender.getParameters();if(0===r.codecs.length)return;const n=r.codecs[0].mimeType.toLocaleLowerCase();"video/h264"===n||"video/h265"===n?this.safeEmit("sei-to-send",e):go.warning("SEI is not supported by ".concat(n))}bindProcessorDestinationEvents(){this.processorDestination.on(cl.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await pi(this,Xd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await pi(this,Xd.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(cl.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(ul.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(ul.REQUEST_CONSTRAINTS)}},bS(sN.prototype,"play",[Dw,Lw],Object.getOwnPropertyDescriptor(sN.prototype,"play"),sN.prototype),bS(sN.prototype,"stop",[kw],Object.getOwnPropertyDescriptor(sN.prototype,"stop"),sN.prototype),bS(sN.prototype,"setEnabled",[Mw,Uw,xw],Object.getOwnPropertyDescriptor(sN.prototype,"setEnabled"),sN.prototype),bS(sN.prototype,"setMuted",[Vw,Fw,Bw],Object.getOwnPropertyDescriptor(sN.prototype,"setMuted"),sN.prototype),bS(sN.prototype,"setSaveEncodeBitrateRatio",[jw,Ww],Object.getOwnPropertyDescriptor(sN.prototype,"setSaveEncodeBitrateRatio"),sN.prototype),bS(sN.prototype,"setEncoderConfiguration",[Gw,Hw],Object.getOwnPropertyDescriptor(sN.prototype,"setEncoderConfiguration"),sN.prototype),bS(sN.prototype,"getStats",[Kw],Object.getOwnPropertyDescriptor(sN.prototype,"getStats"),sN.prototype),bS(sN.prototype,"setBeautyEffect",[Yw,Xw],Object.getOwnPropertyDescriptor(sN.prototype,"setBeautyEffect"),sN.prototype),bS(sN.prototype,"getCurrentFrameData",[Zw],Object.getOwnPropertyDescriptor(sN.prototype,"getCurrentFrameData"),sN.prototype),bS(sN.prototype,"getCurrentFrameImage",[zw],Object.getOwnPropertyDescriptor(sN.prototype,"getCurrentFrameImage"),sN.prototype),bS(sN.prototype,"findClosestProfile",[Jw,Qw],Object.getOwnPropertyDescriptor(sN.prototype,"findClosestProfile"),sN.prototype),bS(sN.prototype,"setBitrateLimit",[qw],Object.getOwnPropertyDescriptor(sN.prototype,"setBitrateLimit"),sN.prototype),bS(sN.prototype,"setOptimizationMode",[$w],Object.getOwnPropertyDescriptor(sN.prototype,"setOptimizationMode"),sN.prototype),bS(sN.prototype,"setScalabiltyMode",[eN],Object.getOwnPropertyDescriptor(sN.prototype,"setScalabiltyMode"),sN.prototype),bS(sN.prototype,"updateMediaStreamTrackResolution",[tN],Object.getOwnPropertyDescriptor(sN.prototype,"updateMediaStreamTrackResolution"),sN.prototype),bS(sN.prototype,"pipe",[rN],Object.getOwnPropertyDescriptor(sN.prototype,"pipe"),sN.prototype),bS(sN.prototype,"unpipe",[nN],Object.getOwnPropertyDescriptor(sN.prototype,"unpipe"),sN.prototype),bS(sN.prototype,"close",[iN],Object.getOwnPropertyDescriptor(sN.prototype,"close"),sN.prototype),bS(sN.prototype,"replaceTrack",[oN],Object.getOwnPropertyDescriptor(sN.prototype,"replaceTrack"),sN.prototype),sN),gN=(aN=Fo({argsMap:(e,t)=>[e.getTrackId(),t]}),cN=fI(),uN=Bi("CameraVideoTrack","_enabledMutex"),dN=Fo({argsMap:(e,t)=>[e.getTrackId(),t]}),lN=fI(),hN=Fo({argsMap:(e,t)=>[e.getTrackId(),t]}),pN=fI(),fN=Fo({argsMap:e=>[e.getTrackId()]}),EN=class e extends TN{get __className__(){return"CameraVideoTrack"}constructor(e,t,r,n,i,o){super(e,Md(t.encoderConfig),n,i,o),cg(this,"_config",void 0),cg(this,"_originalConstraints",void 0),cg(this,"_constraints",void 0),cg(this,"_enabled",!0),cg(this,"_deviceName","default"),cg(this,"tryResumeVideoForIOS15_16WeChat",(async()=>{(Dn()||Ln())&&!function(){const e=_n();if(e.os!==hn.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()&&Un()&&this._enabled&&!this._isClosed&&(go.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS 15 device on WeChat.")),await this.renewMediaStreamTrack())})),this._config=t,this._originalConstraints=r,this._constraints=r,this._deviceName=e.label,this._encoderConfig=Md(this._config.encoderConfig),Zb.on(zo.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),Zb.on(zo.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),this.bindProcessorContextEvents()}async setDevice(e){return"string"==typeof e?this._setDeviceById(e):e.deviceId?this._setDeviceById(e.deviceId):e.facingMode?this._setDeviceByFacingModel(e.facingMode):void 0}async _setDeviceById(e){if(go.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await TO.getDeviceById(e),r={};r.video=_N({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let n=null;try{n=await pO(r,this.getTrackId())}catch(e){throw go.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await pO({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(n.getVideoTracks()[0],!1),e}await this._updateOriginMediaStreamTrack(n.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution(),this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw go.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await TO.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw go.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}go.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){go.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:_N(_N({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await pO(t,this.getTrackId())}catch(t){throw go.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await pO({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1),t}await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution()}this._deviceName="",this._config.facingMode=e,this._config.cameraId=void 0,this._constraints=_N({},t.video),go.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(go.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await pO({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await pi(this,Xd.NEED_ENABLE_TRACK,this)}catch(e){throw go.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),go.info("[".concat(this.getTrackId(),"] setEnabled to true success")),t||(this._enabled=!0)}else{this.isExternalTrack?this._originMediaStreamTrack.enabled=!1:(this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop()),t||(this._enabled=!1);try{await pi(this,Xd.NEED_DISABLE_TRACK,this)}catch(e){throw go.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}go.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new Zn(Xn.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");e=Md(e),to("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate||e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate||e.bitrateMin);const r=vi(this._config);r.encoderConfig=e;const n=LI(r);(vn()||On()||Mn())&&(n.deviceId=void 0),go.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(e),JSON.stringify(n));try{await this._originMediaStreamTrack.applyConstraints(n),this.updateMediaStreamTrackResolution()}catch(e){const t=new Zn(Xn.UNEXPECTED_ERROR,e.toString());throw go.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}this._config=r,this._constraints=n,this._originalConstraints=n,this._encoderConfig=e,-1===this._hints.indexOf(Zd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await pi(this,Xd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(go)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((On()||Mn())&&this._enabled&&!this._isClosed&&Zb.duringInterruption){const e=async()=>{Zb.off(zo.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(go.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};Zb.on(zo.IOS_INTERRUPTION_END,e)}else go.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit($d.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=TO.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await pO({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),Zb.off(zo.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),Zb.off(zo.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._encoderConfig;t&&(n=_N(_N({},n),Md(t))),n=Ai(n);const i=wi(8,"track-cam-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,Ai(_N(_N({},this._config),{},{encoderConfig:n})),Ai(this._constraints),Ai(this._scalabilityMode),this._optimizationMode,i);return t&&n&&o.setEncoderConfiguration(n),go.debug("clone track from ".concat(this.getTrackId()," to ").concat(i,", clone ").concat(r)),o}bindProcessorContextEvents(){this.processorContext.on(ul.REQUEST_UPDATE_CONSTRAINTS,(async(e,t,r)=>{try{const r=Object.assign({},this._originalConstraints,...e);await this.renewMediaStreamTrack(r),t()}catch(e){r(e)}})),this.processorContext.on(ul.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}},bS(EN.prototype,"setDevice",[aN,cN],Object.getOwnPropertyDescriptor(EN.prototype,"setDevice"),EN.prototype),bS(EN.prototype,"setEnabled",[uN,dN,lN],Object.getOwnPropertyDescriptor(EN.prototype,"setEnabled"),EN.prototype),bS(EN.prototype,"setEncoderConfiguration",[hN,pN],Object.getOwnPropertyDescriptor(EN.prototype,"setEncoderConfiguration"),EN.prototype),bS(EN.prototype,"close",[fN],Object.getOwnPropertyDescriptor(EN.prototype,"close"),EN.prototype),EN);function SN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function yN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?SN(Object(r),!0).forEach((function(t){cg(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const RN=new Set(["auto","1440p","1440p_1","1440p_2","1440p_3","4k","4k_1","4k_2","4k_3"]);function vN(e,t,r,n){r.optimizationMode&&(n&&n.width&&n.height?(r.encoderConfig=yN(yN({},n),{},{bitrateMin:n.bitrateMin,bitrateMax:n.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?go.debug("[".concat(e,"] set content hint to"),r.optimizationMode):go.debug("[".concat(e,"] set content hint failed")))):go.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}var AN,bN,ON,IN,CN,wN,NN,PN,DN,LN,kN,MN,UN;function xN(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function VN(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xN(Object(r),!0).forEach((function(t){cg(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xN(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class FN extends Wb{getUserId(){return this._userId}constructor(e,t,r,n){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(n.clientId,"_").concat(wi(5,""))),cg(this,"_userId",void 0),cg(this,"_uintId",void 0),cg(this,"_isDestroyed",!1),cg(this,"store",void 0),cg(this,"processor",void 0),cg(this,"processorContext",void 0),this._userId=t,this._uintId=r,this.store=n}_updateOriginMediaStreamTrack(e){this._originMediaStreamTrack=e,this._mediaStreamTrack=e,this._updatePlayerSource(),this.processor&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this.processorContext})}_destroy(){this._isDestroyed=!0,go.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}let BN=(AN=Fo({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),bN=Fo({argsMap:e=>[e.getTrackId()]}),ON=Fo({argsMap:(e,t)=>[e.getTrackId(),t.name]}),IN=Fo({argsMap:e=>[e.getTrackId()]}),CN=class extends FN{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==hl.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,n,i){super(e,t,r,n),cg(this,"_videoVisibleTimer",null),cg(this,"_previousVideoVisibleStatus",void 0),cg(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),cg(this,"trackMediaType",tl.VIDEO),cg(this,"_videoWidth",void 0),cg(this,"_videoHeight",void 0),cg(this,"_player",void 0),cg(this,"_prePlayer",void 0),cg(this,"processorDestination",void 0),cg(this,"processorContext",void 0),cg(this,"_usePipeMode",!1),cg(this,"_useExtensionMode",!1),cg(this,"_extensionManager",void 0),this._prePlayer=i,this.updateMediaStreamTrackResolution(),this.processorContext=new II(this.getTrackId(),"remote"),this.processorDestination=new OI(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){Oi((()=>{go.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return fi(this,Xd.GET_STATS)||VN({},al)}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(this.safeEmit(el.PLAY_START),"string"==typeof e){const t=document.getElementById(e);t?e=t:(go.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}go.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=VN(VN({fit:"cover"},t),{},{trackId:this.getTrackId(),element:e});if(this._player)this._player.updateConfig(r);else{let t=!1,n=!1;const i=this._prePlayer&&!this._prePlayer.isDestroyed&&e===this._prePlayer.config.element;this._prePlayer&&!i&&(this._prePlayer.destroy(),n=!0),i?(this._player=this._prePlayer,t=this._player.videoState>0,this._player.updateConfig(r)):this._player=e instanceof HTMLVideoElement?new ww(r):new Pw(r),this._prePlayer=void 0,this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(el.FIRST_FRAME_DECODED),n&&this.safeEmit(el.FIRST_FRAME_RENDER)},this._player.onVideoStateChanged=e=>{this.safeEmit(el.VIDEO_STATE_CHANGED,e)},t&&(this._player.onFirstVideoFrameDecoded(),this._player.onVideoStateChanged(this._player.videoState))}const n=this._player;!function(e,t){if(cI()){sI.delete(e),oI.add(e);try{t()}finally{oI.delete(e)}}else t()}(n,(()=>n.play(this.store.sessionId||void 0))),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(el.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),to("CHECK_VIDEO_VISIBLE_INTERVAL")),this.safeEmit(el.PLAY_END)}stop(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(e),this._player=void 0,go.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){DI(this._originMediaStreamTrack).then((e=>{let t=JO(e,2),r=t[0],n=t[1];this._videoHeight=n,this._videoWidth=r})).catch(Ni)}_updatePlayerSource(){go.debug("[".concat(this.getTrackId(),"] update player source track")),this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),n={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},i=n.element,o=n.slot;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=ri.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Bo.reportApiInvoke(null,{tag:ui.TRACER,name:ci.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE,options:[this.getTrackId()]});t.visible?e.onSuccess("Video is visible"):e.onSuccess("Invisible because of ".concat(t.reason))}return t}return}catch(e){throw new Zn(Xn.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}_ensureVideoExtensionManager(e){return this._extensionManager||(this._extensionManager=e.createVideoExtensionManager(this),this._extensionManager.onOutputTrackChanged=e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource()):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())},this._extensionManager.onEmpty=()=>{this._useExtensionMode=!1,this._extensionManager=void 0}),this._extensionManager}useExtension(e,t){if(this._usePipeMode)throw new Zn(Xn.INVALID_OPERATION,"Cannot use useExtension() when pipe() mode is active. Call unpipe() first.");return this._ensureVideoExtensionManager(e),this._useExtensionMode=!0,this._extensionManager.useExtension(e,t)}removeExtension(e){if(!this._extensionManager)return!1;const t=this._extensionManager.removeExtension(e);return t&&go.info("[".concat(this.getTrackId(),"] removeExtension: ").concat(e.name)),this._extensionManager.hasExtensions||(this._useExtensionMode=!1),t}pipe(e){if(this._useExtensionMode)throw new Zn(Xn.INVALID_OPERATION,"Cannot use pipe() when useExtension() mode is active. Call removeExtension() for all extensions first.");if(this.processor===e)return e;if(e._source)throw new Zn(Xn.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this._usePipeMode=!0,this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,context:this.processorContext}),e}unpipe(){if(!this.processor)return;const e=this.processor;this.processor._source=void 0,this.processor=void 0,this._usePipeMode=!1,e.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(cl.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource()):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(cl.ON_TRACK)}_destroy(){this._prePlayer&&(this._prePlayer.destroy(),this._prePlayer=void 0),this._extensionManager&&(this._extensionManager.destroy(),this._extensionManager=void 0,this._useExtensionMode=!1),super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(e,t){this.emit(qd.SEI_RECEIVED,e,t)}},bS(CN.prototype,"play",[AN],Object.getOwnPropertyDescriptor(CN.prototype,"play"),CN.prototype),bS(CN.prototype,"stop",[bN],Object.getOwnPropertyDescriptor(CN.prototype,"stop"),CN.prototype),bS(CN.prototype,"pipe",[ON],Object.getOwnPropertyDescriptor(CN.prototype,"pipe"),CN.prototype),bS(CN.prototype,"unpipe",[IN],Object.getOwnPropertyDescriptor(CN.prototype,"unpipe"),CN.prototype),CN),jN=(wN=Fo({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),NN=Fo({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),PN=Fo({argsMap:(e,t)=>[e.getTrackId(),t]}),DN=Fo({argsMap:e=>[e.getTrackId()]}),LN=Fo({argsMap:e=>[e.getTrackId()]}),kN=Fo({argsMap:(e,t)=>[e.getTrackId(),t.name]}),MN=Fo({argsMap:e=>[e.getTrackId()]}),UN=class extends FN{get isPlaying(){return this._useAudioElement?pI.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(e,t,r,n){super(e,t,r,n),cg(this,"trackMediaType",tl.AUDIO),cg(this,"_source",void 0),cg(this,"_useAudioElement",!0),cg(this,"_volume",100),cg(this,"processorContext",void 0),cg(this,"processorDestination",void 0),cg(this,"_usePipeMode",!1),cg(this,"_useExtensionMode",!1),cg(this,"_extensionManager",void 0),cg(this,"_played",!1),cg(this,"_bypassWebAudio",!1),to("DISABLE_WEBAUDIO")?(this._source=new NI,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new aO(e,!0),to("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once(rl.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(el.FIRST_FRAME_DECODED)})),this.processorContext=new wI(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new CI(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(rl.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:this.processorContext})}))}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(rl.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(rl.ON_AUDIO_BUFFER),this._source.on(rl.ON_AUDIO_BUFFER,(t=>e(t)))}setVolume(e){this._volume=e,this._useAudioElement?pI.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}setAmplifiedVolume(e){this._useAudioElement&&this._played&&(pI.stop(this.getTrackId()),this._source.play()),this._useAudioElement=!1,e=Math.min(e,to("MAX_WEBAUDIO_VOLUME")),this._volume=e,this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!Ho())throw new Zn(Xn.NOT_SUPPORTED,"your browser does not support setting the audio output device");await pI.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getVolume(){return this._useAudioElement?pI.getVolume(this.getTrackId()):this._source instanceof aO?this._source.getAudioVolume():0}getStats(){Oi((()=>{go.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return fi(this,Xd.GET_STATS)||VN({},sl)}play(){var e;if(go.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement)return go.debug("[".concat(this.getTrackId(),"] use audio element to play")),void function(e,t,r){if(!cI())return r();aI={track:e,recover:t};try{r()}finally{aI=void 0}}(this._mediaStreamTrack,(e=>this._resumeAudioElement(e)),(()=>pI.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)));go.debug("[".concat(this.getTrackId(),"] use audio context to play"));const t=null===(e=this._source.context)||void 0===e?void 0:e.state;t&&"running"!==t&&rI(this.store.sessionId||null,"audio","AudioContext state is ".concat(t),this.getTrackId()),this._source.play(),cI()&&"suspended"===t&&this._retryWebAudioAutoplay()}_canSwitchAudioBackend(){return cI()&&!this._bypassWebAudio&&!this._usePipeMode&&!this._useExtensionMode&&!this.processor}_resumeAudioElement(e){var t;if(this._played&&!this._isDestroyed&&this._useAudioElement){if("running"!==(null===(t=this._source.context)||void 0===t?void 0:t.state)||!this._canSwitchAudioBackend())return e.play();this._source.setVolume(this._volume/100),this._source.play(),pI.stop(this.getTrackId()),this._useAudioElement=!1}}_retryWebAudioAutoplay(){const e=()=>this._played&&!this._isDestroyed&&!this._useAudioElement,t=uI((async()=>{var t;if(!e())return;const r=null===(t=this._source.context)||void 0===t?void 0:t.resume();r&&(dI(r,this.store.sessionId),await r)}));null==t||t.catch((()=>{}))}stop(){go.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?pI.stop(this.getTrackId()):this._source.stop()}_reusePreAudioElement(e,t){this._played=t,this._useAudioElement?(pI.reuseTrackId(e,this.getTrackId()),this._updatePlayerSource()):(pI.stop(e),this._updatePlayerSource(),t&&this._source.play()),this.setVolume(this._volume)}_destroy(){super._destroy(),this._played=!1,this._extensionManager&&(this._extensionManager.destroy(),this._extensionManager=void 0,this._useExtensionMode=!1),this.unbindProcessorDestinationEvents(),this._source.destroy()}_isFreeze(){return this._source.isFreeze}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];go.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&pI.updateTrack(this.getTrackId(),this._mediaStreamTrack)}_ensureAudioExtensionManager(e){return this._extensionManager||(this._extensionManager=e.createAudioExtensionManager(this),this._extensionManager.onOutputTrackChanged=e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())}),this._extensionManager}useExtension(e){if(this._usePipeMode)throw new Zn(Xn.INVALID_OPERATION,"Cannot use useExtension() when pipe() mode is active. Call unpipe() first.");return this._ensureAudioExtensionManager(e),this._useExtensionMode=!0,this._extensionManager.useExtension(e)}removeExtension(e){if(!this._extensionManager)return!1;const t=this._extensionManager.removeExtension(e);return t&&go.info("[".concat(this.getTrackId(),"] removeExtension: ").concat(e.name)),this._extensionManager.hasExtensions||(this._useExtensionMode=!1),t}addReferenceTrack(e){if(!this._extensionManager)throw new Zn(Xn.INVALID_OPERATION,"Call useExtension() before addReferenceTrack().");this._extensionManager.addReferenceTrack(e),go.info("[".concat(this.getTrackId(),"] addReferenceTrack"))}removeReferenceTrack(e){return!!this._extensionManager&&this._extensionManager.removeReferenceTrack(e)}pipe(e){if(this._useExtensionMode)throw new Zn(Xn.INVALID_OPERATION,"Cannot use pipe() when useExtension() mode is active.");if(this._bypassWebAudio)throw new Zn(Xn.NOT_SUPPORTED,"can not pipe extension when WebAudio disabled");if(this.processor===e)return e;if(e._source)throw new Zn(Xn.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this._usePipeMode=!0,this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,node:this._source.processSourceNode,context:this.processorContext}),e}unpipe(){var e;if(this._bypassWebAudio)throw new Zn(Xn.NOT_SUPPORTED,"can not unpipe extension when WebAudio disabled");if(!this.processor)return;const t=this.processor;null===(e=this._source.processSourceNode)||void 0===e||e.disconnect(),this.processor._source=!1,this.processor=void 0,this._usePipeMode=!1,t.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(cl.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource())})),this.processorDestination.on(cl.ON_NODE,(e=>{this._source.processedNode=e;const t=!e;this._useAudioElement!==t&&(this._played?(this.stop(),this._useAudioElement=t,this.play()):this._useAudioElement=t)}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(cl.ON_TRACK),this.processorDestination.removeAllListeners(cl.ON_NODE)}},bS(UN.prototype,"setVolume",[wN],Object.getOwnPropertyDescriptor(UN.prototype,"setVolume"),UN.prototype),bS(UN.prototype,"setAmplifiedVolume",[NN],Object.getOwnPropertyDescriptor(UN.prototype,"setAmplifiedVolume"),UN.prototype),bS(UN.prototype,"setPlaybackDevice",[PN],Object.getOwnPropertyDescriptor(UN.prototype,"setPlaybackDevice"),UN.prototype),bS(UN.prototype,"play",[DN],Object.getOwnPropertyDescriptor(UN.prototype,"play"),UN.prototype),bS(UN.prototype,"stop",[LN],Object.getOwnPropertyDescriptor(UN.prototype,"stop"),UN.prototype),bS(UN.prototype,"pipe",[kN],Object.getOwnPropertyDescriptor(UN.prototype,"pipe"),UN.prototype),bS(UN.prototype,"unpipe",[MN],Object.getOwnPropertyDescriptor(UN.prototype,"unpipe"),UN.prototype),UN);const WN=new class extends ii{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),cg(this,"_lastHiddenTime",0),cg(this,"_lastVisibleTime",0),cg(this,"needUploadStats",[]),cg(this,"isCollectingStats",!1),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),this.isCollectingStats&&this.needUploadStats.push("visible"===document.visibilityState?1:0),go.debug("current web page is ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}startCollectStats(){this.isCollectingStats=!0,this.needUploadStats.push("visible"===this.visibility?1:0)}stopCollectStats(){this.isCollectingStats=!1,this.needUploadStats.length=0}};class GN extends ii{constructor(e,t){super(),cg(this,"trackMediaType",tl.DATA),cg(this,"_version",1),cg(this,"_type",3),cg(this,"_config",void 0),cg(this,"_originDataChannel",void 0),cg(this,"_dataStreamPacketHeader",new ArrayBuffer(4)),cg(this,"_dataStreamPacketHandler",{serialize:e=>e,deserialize:e=>e}),cg(this,"_datachannelEventMap",new Map),this._config=e,t&&(this._originDataChannel=t,this._bandDataChannelEvents(t)),this._initPacketHeader()}useDataStream(e){this._dataStreamPacketHandler=e}get id(){return this._config.id}get ordered(){return this._config.ordered}get maxRetransmits(){return to("DATASTREAM_MAX_RETRANSMITS")}get metadata(){return this._config.metadata}get readyState(){var e,t;return null!==(e=null===(t=this._originDataChannel)||void 0===t?void 0:t.readyState)&&void 0!==e?e:"connecting"}get _originDataChannelId(){var e,t;return null!==(e=null===(t=this._originDataChannel)||void 0===t?void 0:t.id)&&void 0!==e?e:null}getChannelId(){return this.id}getConfig(){return this._config}_close(){this._originDataChannel&&(this._unbindDataChannelEvents(this._originDataChannel),this._originDataChannel=void 0)}async _waitTillOpen(){return new jb(((e,t)=>{if(this._originDataChannel){"open"===this._originDataChannel.readyState&&e();const r=setTimeout((()=>{var e;t(new Zn(Xn.DATACHANNEL_CONNECTION_TIMEOUT,"Cannot create datachannel, id: ".concat(null===(e=this._originDataChannel)||void 0===e?void 0:e.id)))}),1e4);this._originDataChannel.onopen=()=>{clearTimeout(r),this._originDataChannel&&this._bandDataChannelEvents(this._originDataChannel),e()},this._originDataChannel.onerror=()=>{throw clearTimeout(r),new Zn(Xn.DATACHANNEL_CONNECTION_TIMEOUT)}}else t(new Zn(Xn.DATACHANNEL_CONNECTION_TIMEOUT,"cannot find dataChannel"))}))}_updateOriginDataChannel(e){this._originDataChannel=e,this._bandDataChannelEvents(e)}_initPacketHeader(){const e=new DataView(this._dataStreamPacketHeader);e.setUint16(0,this._version),e.setUint8(2,this._type),e.setUint8(3,this._config.id)}_bandDataChannelEvents(e){this._unbindDataChannelEvents(e),[fl.OPEN,fl.CLOSE,fl.ERROR].forEach((t=>{const r=()=>{this.emit(t)};this._datachannelEventMap.set(t,r),e.addEventListener(t,r)}))}_unbindDataChannelEvents(e){Array.from(this._datachannelEventMap.entries()).forEach((t=>{let r=JO(t,2),n=r[0],i=r[1];e.removeEventListener(n,i)})),this._datachannelEventMap.clear()}}var HN=Ru,KN=rs,YN=Pu,XN=RangeError,ZN=String.fromCharCode,zN=String.fromCodePoint,JN=KN([].join);HN({target:"String",stat:!0,arity:1,forced:!!zN&&1!==zN.length},{fromCodePoint:function(e){for(var t,r=[],n=arguments.length,i=0;n>i;){if(YN(t=+arguments[i],1114111)!==t)throw new XN(t+" is not a valid code point");r[i++]=t<65536?ZN(t):ZN(55296+((t-=65536)>>10),t%1024+56320)}return JN(r,"")}});var QN=Jo,qN=sc("iterator"),$N=!QN((function(){var e=new URL("b?a=1&b=2&c=3","https://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2&b=3"),n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),r.delete("a",2),r.delete("b",void 0),!e.toJSON||!r.has("a",1)||r.has("a",2)||!r.has("a",void 0)||r.has("b")||!t.size&&true||!t.sort||"https://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[qN]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==n||"x"!==new URL("https://x",void 0).host})),eP=gp,tP=Ru,rP=os,nP=XR,iP=Qs,oP=As,sP=rs,aP=ys,cP=$N,uP=gp,dP=yp,lP=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:eP(e,n,t[n],r);return e},hP=Kp,pP=b_,fP=cf,EP=iR,mP=gs,_P=Ya,TP=Hc,gP=ud,SP=Jc,yP=Ks,RP=hd,vP=sp,AP=Ps,bP=ly,OP=iy,IP=eT,CP=fR,wP=GI,NP=sc("iterator"),PP="URLSearchParams",DP=PP+"Iterator",LP=fP.set,kP=fP.getterFor(PP),MP=fP.getterFor(DP),UP=nP("fetch"),xP=nP("Request"),VP=nP("Headers"),FP=xP&&xP.prototype,BP=VP&&VP.prototype,jP=rP.TypeError,WP=rP.encodeURIComponent,GP=String.fromCharCode,HP=iP("String","fromCodePoint"),KP=parseInt,YP=sP("".charAt),XP=sP([].join),ZP=sP([].push),zP=sP("".replace),JP=sP([].shift),QP=sP([].splice),qP=sP("".split),$P=sP("".slice),eD=sP(/./.exec),tD=/\+/g,rD=/^[0-9a-f]+$/i,nD=function(e,t){var r=$P(e,t,t+2);return eD(rD,r)?KP(r,16):NaN},iD=function(e){for(var t=0,r=128;r>0&&0!=(e&r);r>>=1)t++;return t},oD=function(e){var t=null,r=e.length;switch(r){case 1:t=e[0];break;case 2:t=(31&e[0])<<6|63&e[1];break;case 3:t=(15&e[0])<<12|(63&e[1])<<6|63&e[2];break;case 4:t=(7&e[0])<<18|(63&e[1])<<12|(63&e[2])<<6|63&e[3]}return null===t||t>1114111||t>=55296&&t<=57343||t<(r>3?65536:r>2?2048:r>1?128:0)?null:t},sD=function(e){for(var t=(e=zP(e,tD," ")).length,r="",n=0;n<t;){var i=YP(e,n);if("%"===i){if("%"===YP(e,n+1)||n+3>t){r+="%",n++;continue}var o=nD(e,n+1);if(o!=o){r+=i,n++;continue}n+=2;var s=iD(o);if(0===s)i=GP(o);else{if(1===s||s>4){r+="�",n++;continue}for(var a=[o],c=1;c<s&&!(++n+3>t||"%"!==YP(e,n));){var u=nD(e,n+1);if(u!=u||u>191||u<128)break;if(1===c){if(224===o&&u<160)break;if(237===o&&u>159)break;if(240===o&&u<144)break;if(244===o&&u>143)break}ZP(a,u),n+=2,c++}if(a.length!==s){r+="�";continue}var d=oD(a);if(null===d){for(var l=0;l<s;l++)r+="�";n++;continue}i=HP(d)}}r+=i,n++}return r},aD=/[!'()~]|%20/g,cD={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},uD=function(e){return cD[e]},dD=function(e){return zP(WP(e),aD,uD)},lD=pP((function(e,t){LP(this,{type:DP,target:kP(e).entries,index:0,kind:t})}),PP,(function(){var e=MP(this),t=e.target,r=e.index++;if(!t||r>=t.length)return e.target=null,IP(void 0,!0);var n=t[r];switch(e.kind){case"keys":return IP(n.key,!1);case"values":return IP(n.value,!1)}return IP([n.key,n.value],!1)}),!0),hD=function(e){this.entries=[],this.url=null,void 0!==e&&(yP(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===YP(e,0)?$P(e,1):e:RP(e)))};hD.prototype={type:PP,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,s,a,c=this.entries,u=OP(e);if(u)for(r=(t=bP(e,u)).next;!(n=oP(r,t)).done;){if(o=(i=bP(SP(n.value))).next,(s=oP(o,i)).done||(a=oP(o,i)).done||!oP(o,i).done)throw new jP("Expected sequence with length 2");ZP(c,{key:RP(s.value),value:RP(a.value)})}else for(var d in e)_P(e,d)&&ZP(c,{key:d,value:RP(e[d])})},parseQuery:function(e){if(e)for(var t,r,n=this.entries,i=qP(e,"&"),o=0;o<i.length;)(t=i[o++]).length&&(r=qP(t,"="),ZP(n,{key:sD(JP(r)),value:sD(XP(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],ZP(r,dD(e.key)+"="+dD(e.value));return XP(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var pD=function(){EP(this,fD);var e=LP(this,new hD(arguments.length>0?arguments[0]:void 0));aP||(this.size=e.entries.length)},fD=pD.prototype;if(lP(fD,{append:function(e,t){var r=kP(this);CP(arguments.length,2),ZP(r.entries,{key:RP(e),value:RP(t)}),aP||this.size++,r.updateURL()},delete:function(e){for(var t=kP(this),r=CP(arguments.length,1),n=t.entries,i=RP(e),o=r<2?void 0:arguments[1],s=void 0===o?o:RP(o),a=0;a<n.length;){var c=n[a];c.key!==i||void 0!==s&&c.value!==s?a++:QP(n,a,1)}aP||(this.size=n.length),t.updateURL()},get:function(e){var t=kP(this).entries;CP(arguments.length,1);for(var r=RP(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=kP(this).entries;CP(arguments.length,1);for(var r=RP(e),n=[],i=0;i<t.length;i++)t[i].key===r&&ZP(n,t[i].value);return n},has:function(e){for(var t=kP(this).entries,r=CP(arguments.length,1),n=RP(e),i=r<2?void 0:arguments[1],o=void 0===i?i:RP(i),s=0;s<t.length;){var a=t[s++];if(a.key===n&&(void 0===o||a.value===o))return!0}return!1},set:function(e,t){var r=kP(this);CP(arguments.length,2);for(var n,i=r.entries,o=!1,s=RP(e),a=RP(t),c=0;c<i.length;c++)(n=i[c]).key===s&&(o?QP(i,c--,1):(o=!0,n.value=a));o||ZP(i,{key:s,value:a}),aP||(this.size=i.length),r.updateURL()},sort:function(){var e=kP(this);wP(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=kP(this).entries,n=TP(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new lD(this,"keys")},values:function(){return new lD(this,"values")},entries:function(){return new lD(this,"entries")}},{enumerable:!0}),uP(fD,NP,fD.entries,{name:"entries"}),uP(fD,"toString",(function(){return kP(this).serialize()}),{enumerable:!0}),aP&&dP(fD,"size",{get:function(){return kP(this).entries.length},configurable:!0,enumerable:!0}),hP(pD,PP),tP({global:!0,constructor:!0,forced:!cP},{URLSearchParams:pD}),!cP&&mP(VP)){var ED=sP(BP.has),mD=sP(BP.set),_D=function(e){if(yP(e)){var t,r=e.body;if(gP(r)===PP)return t=e.headers?new VP(e.headers):new VP,ED(t,"content-type")||mD(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),vP(e,{body:AP(0,RP(r)),headers:AP(0,t)})}return e};if(mP(UP)&&tP({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return UP(e,arguments.length>1?_D(arguments[1]):{})}}),mP(xP)){var TD=function(e){return EP(this,FP),new xP(e,arguments.length>1?_D(arguments[1]):{})};FP.constructor=TD,TD.prototype=FP,tP({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:TD})}}var gD,SD={URLSearchParams:pD,getState:kP},yD=ys,RD=rs,vD=As,AD=Jo,bD=Mh,OD=_p,ID=bs,CD=Ga,wD=Us,ND=Object.assign,PD=Object.defineProperty,DD=RD([].concat),LD=!ND||AD((function(){if(yD&&1!==ND({b:1},ND(PD({},"a",{enumerable:!0,get:function(){PD(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol("assign detection"),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!==ND({},e)[r]||bD(ND({},t)).join("")!==n}))?function(e,t){for(var r=CD(e),n=arguments.length,i=1,o=OD.f,s=ID.f;n>i;)for(var a,c=wD(arguments[i++]),u=o?DD(bD(c),o(c)):bD(c),d=u.length,l=0;d>l;)a=u[l++],yD&&!vD(s,c,a)||(r[a]=c[a]);return r}:ND,kD=rs,MD=2147483647,UD=/[^\0-\u007E]/,xD=/[.\u3002\uFF0E\uFF61]/g,VD="Overflow: input needs wider integers to process",FD=RangeError,BD=kD(xD.exec),jD=Math.floor,WD=String.fromCharCode,GD=kD("".charCodeAt),HD=kD([].join),KD=kD([].push),YD=kD("".replace),XD=kD("".split),ZD=kD("".toLowerCase),zD=function(e){return e+22+75*(e<26)},JD=function(e,t,r){var n=0;for(e=r?jD(e/700):e>>1,e+=jD(e/t);e>455;)e=jD(e/35),n+=36;return jD(n+36*e/(e+38))},QD=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=GD(e,r++);if(i>=55296&&i<=56319&&r<n){var o=GD(e,r++);56320==(64512&o)?KD(t,((1023&i)<<10)+(1023&o)+65536):(KD(t,i),r--)}else KD(t,i)}return t}(e);var r,n,i=e.length,o=128,s=0,a=72;for(r=0;r<e.length;r++)(n=e[r])<128&&KD(t,WD(n));var c=t.length,u=c;for(c&&KD(t,"-");u<i;){var d=MD;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>jD((MD-s)/l))throw new FD(VD);for(s+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++s>MD)throw new FD(VD);if(n===o){for(var h=s,p=36;;){var f=p<=a?1:p>=a+26?26:p-a;if(h<f)break;var E=h-f,m=36-f;KD(t,WD(zD(f+E%m))),h=jD(E/m),p+=36}KD(t,WD(zD(h))),a=JD(s,l,u===c),s=0,u++}}s++,o++}return HD(t,"")},qD=Ru,$D=ys,eL=$N,tL=os,rL=Hc,nL=rs,iL=gp,oL=yp,sL=iR,aL=Ya,cL=LD,uL=YO,dL=lp,lL=zT.codeAt,hL=function(e){var t,r,n=[],i=XD(YD(ZD(e),xD,"."),".");for(t=0;t<i.length;t++)r=i[t],KD(n,BD(UD,r)?"xn--"+QD(r):r);return HD(n,".")},pL=hd,fL=Kp,EL=fR,mL=SD,_L=cf,TL=_L.set,gL=_L.getterFor("URL"),SL=mL.URLSearchParams,yL=mL.getState,RL=tL.URL,vL=tL.TypeError,AL=tL.encodeURIComponent,bL=tL.parseInt,OL=Math.floor,IL=Math.pow,CL=nL("".charAt),wL=nL(/./.exec),NL=nL([].join),PL=nL(1.1.toString),DL=nL([].pop),LL=nL([].push),kL=nL("".replace),ML=nL([].shift),UL=nL("".split),xL=nL("".slice),VL=nL("".toLowerCase),FL=nL([].unshift),BL="Invalid scheme",jL="Invalid host",WL="Invalid port",GL=/[a-z]/i,HL=/[\d+\-.a-z]/i,KL=/\d/,YL=/^0x/i,XL=/^[0-7]+$/,ZL=/^\d+$/,zL=/^[\da-f]+$/i,JL=/[\0\t\n\r #%/:<>?@[\\\]^|]/,QL=/[\0\t\n\r #/:<>?@[\\\]^|]/,qL=/^[\u0000-\u0020]+/,$L=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,ek=/[\t\n\r]/g,tk=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)FL(t,e%256),e=OL(e/256);return NL(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r?n:t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=PL(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},rk={},nk=cL({},rk,{" ":1,'"':1,"#":1,"<":1,">":1}),ik=cL({},nk,{"'":1}),ok=cL({},rk,{" ":1,'"':1,"<":1,">":1,"`":1}),sk=cL({},ok,{"#":1,"?":1,"{":1,"}":1,"^":1}),ak=cL({},sk,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),ck=function(e,t){var r=lL(e,0);return r>=32&&r<127&&!aL(t,e)?e:"'"===e&&aL(t,e)?"%27":AL(e)},uk={ftp:21,file:null,http:80,https:443,ws:80,wss:443},dk=function(e,t){var r;return 2===e.length&&wL(GL,CL(e,0))&&(":"===(r=CL(e,1))||!t&&"|"===r)},lk=function(e){var t;return e.length>1&&dk(xL(e,0,2))&&(2===e.length||"/"===(t=CL(e,2))||"\\"===t||"?"===t||"#"===t)},hk=function(e){return"."===e||"%2e"===VL(e)},pk={},fk={},Ek={},mk={},_k={},Tk={},gk={},Sk={},yk={},Rk={},vk={},Ak={},bk={},Ok={},Ik={},Ck={},wk={},Nk={},Pk={},Dk={},Lk={},kk=function(e,t,r){var n,i,o,s=pL(e);if(t){if(i=this.parse(s))throw new vL(i);this.searchParams=null}else{if(void 0!==r&&(n=new kk(r,!0)),i=this.parse(s,null,n))throw new vL(i);(o=yL(new SL)).bindURL(this),this.searchParams=o}};kk.prototype={type:"URL",parse:function(e,t,r){var n,i,o,s,a,c=this,u=t||pk,d=0,l="",h=!1,p=!1,f=!1;for(e=pL(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=kL(e,qL,""),e=kL(e,$L,"$1")),e=kL(e,ek,""),n=uL(e);d<=n.length;){switch(i=n[d],u){case pk:if(!i||!wL(GL,i)){if(t)return BL;u=Ek;continue}l+=VL(i),u=fk;break;case fk:if(i&&wL(HL,i))l+=VL(i);else{if(":"!==i){if(t)return BL;l="",u=Ek,d=0;continue}if(t&&(c.isSpecial()!==aL(uk,l)||"file"===l&&(c.includesCredentials()||null!==c.port)||"file"===c.scheme&&""===c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&uk[c.scheme]===c.port&&(c.port=null));l="","file"===c.scheme?u=Ok:c.isSpecial()&&r&&r.scheme===c.scheme?u=mk:c.isSpecial()?u=Sk:"/"===n[d+1]?(u=_k,d++):(c.cannotBeABaseURL=!0,LL(c.path,""),u=Pk)}break;case Ek:if(!r||r.cannotBeABaseURL&&"#"!==i)return BL;if(r.cannotBeABaseURL&&"#"===i){c.scheme=r.scheme,c.path=dL(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=Lk;break}u="file"===r.scheme?Ok:Tk;continue;case mk:if("/"!==i||"/"!==n[d+1]){u=Tk;continue}u=yk,d++;break;case _k:if("/"===i){u=Rk;break}u=Nk;continue;case Tk:if(c.scheme=r.scheme,i===gD)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=dL(r.path),c.query=r.query;else if("/"===i||"\\"===i&&c.isSpecial())u=gk;else if("?"===i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=dL(r.path),c.query="",u=Dk;else{if("#"!==i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=dL(r.path),c.path.length&&c.path.length--,u=Nk;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=dL(r.path),c.query=r.query,c.fragment="",u=Lk}break;case gk:if(!c.isSpecial()||"/"!==i&&"\\"!==i){if("/"!==i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=Nk;continue}u=Rk}else u=yk;break;case Sk:if(u=yk,"/"!==i||"/"!==n[d+1])continue;d++;break;case yk:if("/"!==i&&"\\"!==i){u=Rk;continue}break;case Rk:if("@"===i){h&&(l="%40"+l),h=!0,o=uL(l);for(var E=0;E<o.length;E++){var m=o[E];if(":"!==m||f){var _=ck(m,ak);f?c.password+=_:c.username+=_}else f=!0}l=""}else if(i===gD||"/"===i||"?"===i||"#"===i||"\\"===i&&c.isSpecial()){if(h&&""===l)return"Invalid authority";d-=uL(l).length+1,l="",u=vk}else l+=i;break;case vk:case Ak:if(t&&"file"===c.scheme){u=Ck;continue}if(":"!==i||p){if(i===gD||"/"===i||"?"===i||"#"===i||"\\"===i&&c.isSpecial()){if(c.isSpecial()&&""===l)return jL;if(t&&""===l&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(l))return s;if(l="",u=wk,t)return;continue}"["===i?p=!0:"]"===i&&(p=!1),l+=i}else{if(""===l)return jL;if(t===Ak)return;if(s=c.parseHost(l))return s;l="",u=bk}break;case bk:if(!wL(KL,i)){if(i===gD||"/"===i||"?"===i||"#"===i||"\\"===i&&c.isSpecial()||t){if(""!==l){var T=bL(l,10);if(T>65535)return WL;c.port=c.isSpecial()&&T===uk[c.scheme]?null:T,l=""}if(t)return;u=wk;continue}return WL}l+=i;break;case Ok:if(c.scheme="file",c.host="","/"===i||"\\"===i)u=Ik;else{if(!r||"file"!==r.scheme){u=Nk;continue}switch(i){case gD:c.host=r.host,c.path=dL(r.path),c.query=r.query;break;case"?":c.host=r.host,c.path=dL(r.path),c.query="",u=Dk;break;case"#":c.host=r.host,c.path=dL(r.path),c.query=r.query,c.fragment="",u=Lk;break;default:c.host=r.host,lk(NL(dL(n,d),""))||(c.path=dL(r.path),c.shortenPath()),u=Nk;continue}}break;case Ik:if("/"===i||"\\"===i){u=Ck;break}r&&"file"===r.scheme&&(c.host=r.host,!lk(NL(dL(n,d),""))&&dk(r.path[0],!0)&&LL(c.path,r.path[0])),u=Nk;continue;case Ck:if(i===gD||"/"===i||"\\"===i||"?"===i||"#"===i){if(!t&&dk(l))u=Nk;else if(""===l){if(c.host="",t)return;u=wk}else{if(s=c.parseHost(l))return s;if("localhost"===c.host&&(c.host=""),t)return;l="",u=wk}continue}l+=i;break;case wk:if(c.isSpecial()){if(u=Nk,"/"!==i&&"\\"!==i)continue}else if(t||"?"!==i)if(t||"#"!==i){if(i!==gD&&(u=Nk,"/"!==i))continue}else c.fragment="",u=Lk;else c.query="",u=Dk;break;case Nk:if(i===gD||"/"===i||"\\"===i&&c.isSpecial()||!t&&("?"===i||"#"===i)){if(".."===(a=VL(a=l))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"===i||"\\"===i&&c.isSpecial()||LL(c.path,"")):hk(l)?"/"===i||"\\"===i&&c.isSpecial()||LL(c.path,""):("file"===c.scheme&&!c.path.length&&dk(l)&&(null!==c.host&&""!==c.host&&(c.host=""),l=CL(l,0)+":"),LL(c.path,l)),l="","file"===c.scheme&&(i===gD||"?"===i||"#"===i))for(;c.path.length>1&&""===c.path[0];)ML(c.path);"?"===i?(c.query="",u=Dk):"#"===i&&(c.fragment="",u=Lk)}else l+=ck(i,sk);break;case Pk:"?"===i?(c.query="",u=Dk):"#"===i?(c.fragment="",u=Lk):i!==gD&&(c.path[0]+=ck(i,rk));break;case Dk:t||"#"!==i?i!==gD&&(c.query+=ck(i,c.isSpecial()?ik:nk)):(c.fragment="",u=Lk);break;case Lk:i!==gD&&(c.fragment+=ck(i,ok))}d++}},parseHost:function(e){var t,r,n;if("["===CL(e,0)){if("]"!==CL(e,e.length-1))return jL;if(t=function(e){var t,r,n,i,o,s,a,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return CL(e,l)};if(":"===h()){if(":"!==CL(e,1))return;l+=2,d=++u}for(;h();){if(8===u)return;if(":"!==h()){for(t=r=0;r<4&&wL(zL,h());)t=16*t+bL(h(),16),l++,r++;if("."===h()){if(0===r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."===h()&&n<4))return;l++}if(!wL(KL,h()))return;for(;wL(KL,h());){if(o=bL(h(),10),null===i)i=o;else{if(0===i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!==n||u++}if(4!==n)return;break}if(":"===h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(s=u-d,u=7;0!==u&&s>0;)a=c[u],c[u--]=c[d+s-1],c[d+--s]=a;else if(8!==u)return;return c}(xL(e,1,-1)),!t)return jL;this.host=t}else if(this.isSpecial()){if(e=hL(e),wL(JL,e))return jL;if(function(e){var t,r,n=UL(e,".");if(""===n[n.length-1]){if(1===n.length)return!1;n.length--}return t=n[n.length-1],!!wL(ZL,t)||!!wL(YL,t)&&(""===(r=xL(t,2))||!!wL(zL,r))}(e)){if(t=function(e){var t,r,n,i,o,s,a,c=UL(e,".");if(c.length&&""===c[c.length-1]&&c.length--,(t=c.length)>4)return null;for(r=[],n=0;n<t;n++){if(""===(i=c[n]))return null;if(o=10,i.length>1&&"0"===CL(i,0)&&(o=wL(YL,i)?16:8,i=xL(i,8===o?1:2)),""===i)s=0;else{if(!wL(10===o?ZL:8===o?XL:zL,i))return null;s=bL(i,o)}LL(r,s)}for(n=0;n<t;n++)if(s=r[n],n===t-1){if(s>=IL(256,5-t))return null}else if(s>255)return null;for(a=DL(r),n=0;n<r.length;n++)a+=r[n]*IL(256,3-n);return a}(e),null===t)return jL;this.host=t}else this.host=e}else{if(wL(QL,e))return jL;for(t="",r=uL(e),n=0;n<r.length;n++)t+=ck(r[n],rk);this.host=t}},cannotHaveUsernamePasswordPort:function(){return null===this.host||""===this.host||this.cannotBeABaseURL||"file"===this.scheme},includesCredentials:function(){return""!==this.username||""!==this.password},isSpecial:function(){return aL(uk,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"===this.scheme&&1===t&&dk(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,s=e.path,a=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=tk(i),null!==o&&(u+=":"+o)):"file"===t&&(u+="//"),null===i&&!e.cannotBeABaseURL&&s.length>1&&""===s[0]&&(u+="/."),u+=e.cannotBeABaseURL?s[0]:s.length?"/"+NL(s,"/"):"",null!==a&&(u+="?"+a),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw new vL(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"===e)try{return new Mk(this.path[0]).origin}catch(e){return"null"}return"file"!==e&&this.isSpecial()?e+"://"+tk(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(pL(e)+":",pk)},getUsername:function(){return this.username},setUsername:function(e){var t=uL(pL(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=ck(t[r],ak)}},getPassword:function(){return this.password},setPassword:function(e){var t=uL(pL(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=ck(t[r],ak)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?tk(e):tk(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,vk)},getHostname:function(){var e=this.host;return null===e?"":tk(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Ak)},getPort:function(){var e=this.port;return null===e?"":pL(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""===(e=pL(e))?this.port=null:this.parse(e,bk))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+NL(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,wk))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""===(e=pL(e))?this.query=null:("?"===CL(e,0)&&(e=xL(e,1)),this.query="",this.parse(e,Dk)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!==(e=pL(e))?("#"===CL(e,0)&&(e=xL(e,1)),this.fragment="",this.parse(e,Lk)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Mk=function(e){var t=sL(this,Uk),r=EL(arguments.length,1)>1?arguments[1]:void 0,n=TL(t,new kk(e,!1,r));$D||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},Uk=Mk.prototype,xk=function(e,t){return{get:function(){return gL(this)[e]()},set:t&&function(e){return gL(this)[t](e)},configurable:!0,enumerable:!0}};if($D&&(oL(Uk,"href",xk("serialize","setHref")),oL(Uk,"origin",xk("getOrigin")),oL(Uk,"protocol",xk("getProtocol","setProtocol")),oL(Uk,"username",xk("getUsername","setUsername")),oL(Uk,"password",xk("getPassword","setPassword")),oL(Uk,"host",xk("getHost","setHost")),oL(Uk,"hostname",xk("getHostname","setHostname")),oL(Uk,"port",xk("getPort","setPort")),oL(Uk,"pathname",xk("getPathname","setPathname")),oL(Uk,"search",xk("getSearch","setSearch")),oL(Uk,"searchParams",xk("getSearchParams")),oL(Uk,"hash",xk("getHash","setHash"))),iL(Uk,"toJSON",(function(){return gL(this).serialize()}),{enumerable:!0}),iL(Uk,"toString",(function(){return gL(this).serialize()}),{enumerable:!0}),RL){var Vk=RL.createObjectURL,Fk=RL.revokeObjectURL;Vk&&iL(Mk,"createObjectURL",rL(Vk,RL)),Fk&&iL(Mk,"revokeObjectURL",rL(Fk,RL))}fL(Mk,"URL"),qD({global:!0,constructor:!0,forced:!eL,sham:!$D},{URL:Mk});var Bk=Ru,jk=Jo,Wk=fR,Gk=hd,Hk=$N,Kk=Qs("URL"),Yk=Hk&&jk((function(){Kk.canParse()})),Xk=jk((function(){return 1!==Kk.canParse.length}));Bk({target:"URL",stat:!0,forced:!Yk||Xk},{canParse:function(e){var t=Wk(arguments.length,1),r=Gk(e),n=t<2||void 0===arguments[1]?void 0:Gk(arguments[1]);try{return!!new Kk(r,n)}catch(e){return!1}}});var Zk=Ru,zk=fR,Jk=hd,Qk=$N,qk=Qs("URL");Zk({target:"URL",stat:!0,forced:!Qk},{parse:function(e){var t=zk(arguments.length,1),r=Jk(e),n=t<2||void 0===arguments[1]?void 0:Jk(arguments[1]);try{return new qk(r,n)}catch(e){return null}}});var $k=z(Ys.URL);function eM(){const e=new Blob([atob("ZnVuY3Rpb24gdCh0LGUsbil7cmV0dXJuKGU9ZnVuY3Rpb24odCl7dmFyIGU9ZnVuY3Rpb24odCxlKXtpZigib2JqZWN0IiE9dHlwZW9mIHR8fCF0KXJldHVybiB0O3ZhciBuPXRbU3ltYm9sLnRvUHJpbWl0aXZlXTtpZih2b2lkIDAhPT1uKXt2YXIgcj1uLmNhbGwodCxlfHwiZGVmYXVsdCIpO2lmKCJvYmplY3QiIT10eXBlb2YgcilyZXR1cm4gcjt0aHJvdyBuZXcgVHlwZUVycm9yKCJAQHRvUHJpbWl0aXZlIG11c3QgcmV0dXJuIGEgcHJpbWl0aXZlIHZhbHVlLiIpfXJldHVybigic3RyaW5nIj09PWU/U3RyaW5nOk51bWJlcikodCl9KHQsInN0cmluZyIpO3JldHVybiJzeW1ib2wiPT10eXBlb2YgZT9lOmUrIiJ9KGUpKWluIHQ/T2JqZWN0LmRlZmluZVByb3BlcnR5KHQsZSx7dmFsdWU6bixlbnVtZXJhYmxlOiEwLGNvbmZpZ3VyYWJsZTohMCx3cml0YWJsZTohMH0pOnRbZV09bix0fWZ1bmN0aW9uIGUodCxlKXt2YXIgbj1PYmplY3Qua2V5cyh0KTtpZihPYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKXt2YXIgcj1PYmplY3QuZ2V0T3duUHJvcGVydHlTeW1ib2xzKHQpO2UmJihyPXIuZmlsdGVyKChmdW5jdGlvbihlKXtyZXR1cm4gT2JqZWN0LmdldE93blByb3BlcnR5RGVzY3JpcHRvcih0LGUpLmVudW1lcmFibGV9KSkpLG4ucHVzaC5hcHBseShuLHIpfXJldHVybiBufWNvbnN0IG49InZpZGVvL2gyNjQiLHI9InZpZGVvL2gyNjUiO2Z1bmN0aW9uIGEodCxlLG4pe2NvbnN0IHI9bmV3IFVpbnQ4QXJyYXkodCxlLG4pLGE9W107bGV0IG89MDtmb3IoO2EubGVuZ3RoPG47KW8rMzxuJiYwPT09cltvXSYmMD09PXJbbysxXSYmMz09PXJbbysyXSYmKDA9PT1yW28rM118fDE9PT1yW28rM118fDI9PT1yW28rM118fDM9PT1yW28rM10pPyhhLnB1c2gocltvXSxyW28rMV0scltvKzNdKSxvKz00KTooYS5wdXNoKHJbb10pLG8rKyk7cmV0dXJuIG5ldyBVaW50OEFycmF5KGEpfWZ1bmN0aW9uIG8odCxlKXtzd2l0Y2goZSl7Y2FzZSBuOnJldHVybiBmdW5jdGlvbih0KXtjb25zdCBlPW5ldyBEYXRhVmlldyh0LmRhdGEpO2xldCBuPTA7Zm9yKDtuKzQ8dC5kYXRhLmJ5dGVMZW5ndGg7KXtpZigwPT09ZS5nZXRVaW50OChuKzApJiYwPT09ZS5nZXRVaW50OChuKzEpJiYwPT09ZS5nZXRVaW50OChuKzIpJiYxPT09ZS5nZXRVaW50OChuKzMpJiY2PT09ZS5nZXRVaW50OChuKzQpKXtsZXQgcj1uKzYsbz0wLGk9MDtmb3IoOzI1NT09PShpPWUuZ2V0VWludDgocisrKSk7KW8rPTI1NTtvKz1pO2NvbnN0IHM9YSh0LmRhdGEscixvKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkocyl9bisrfXJldHVybiBudWxsfSh0KTtjYXNlIHI6cmV0dXJuIGZ1bmN0aW9uKHQpe2NvbnN0IGU9bmV3IERhdGFWaWV3KHQuZGF0YSk7bGV0IG49MDtmb3IoO24rNTx0LmRhdGEuYnl0ZUxlbmd0aDspe2lmKDA9PT1lLmdldFVpbnQ4KG4rMCkmJjA9PT1lLmdldFVpbnQ4KG4rMSkmJjA9PT1lLmdldFVpbnQ4KG4rMikmJjE9PT1lLmdldFVpbnQ4KG4rMykmJjc4PT09ZS5nZXRVaW50OChuKzQpJiYxPT09ZS5nZXRVaW50OChuKzUpJiYxMDE9PT1lLmdldFVpbnQ4KG4rNikpe2xldCByPW4rNyxvPTAsaT0wO2Zvcig7MjU1PT09KGk9ZS5nZXRVaW50OChyKyspKTspbys9MjU1O28rPWk7Y29uc3Qgcz1hKHQuZGF0YSxyLG8pO3JldHVybiBuZXcgVWludDhBcnJheShzKX1uKyt9cmV0dXJuIG51bGx9KHQpO2RlZmF1bHQ6cmV0dXJuIG51bGx9fWZ1bmN0aW9uIGkodCl7Y29uc3QgZT10Lmxlbmd0aCxuPVtdO2xldCByPTA7Zm9yKDtyPGU7KXIrMjxlJiYwPT09dFtyXSYmMD09PXRbcisxXSYmKDA9PT10W3IrMl18fDE9PT10W3IrMl18fDI9PT10W3IrMl18fDM9PT10W3IrMl0pPyhuLnB1c2godFtyXSx0W3IrMV0sMyx0W3IrMl0pLHIrPTMpOihuLnB1c2godFtyXSkscisrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkobil9ZnVuY3Rpb24gcyh0LGUsYSl7c3dpdGNoKGEpe2Nhc2UgbjpyZXR1cm4gZnVuY3Rpb24odCxlKXtjb25zdCBuPWkoZSkscj1uLmxlbmd0aCxhPU1hdGguZmxvb3Ioci8yNTUpLG89ciUyNTUscz1uZXcgVWludDhBcnJheSg2K2ErMStyKzErdC5ieXRlTGVuZ3RoKTtzWzBdPTAsc1sxXT0wLHNbMl09MCxzWzNdPTEsc1s0XT02LHNbNV09MTAxO2xldCBmPTA7Zm9yKDtmPGE7KXNbNitmXT0yNTUsZisrO3JldHVybiBzWzYrZl09byxmKysscy5zZXQobiw2K2YpLGYrPXIsc1s2K2ZdPTEyOCxmKysscy5zZXQobmV3IFVpbnQ4QXJyYXkodCksNitmKSxzLmJ1ZmZlcn0odCxlKTtjYXNlIHI6cmV0dXJuIGZ1bmN0aW9uKHQsZSl7Y29uc3Qgbj1pKGUpLHI9bi5sZW5ndGgsYT1NYXRoLmZsb29yKHIvMjU1KSxvPXIlMjU1LHM9bmV3IFVpbnQ4QXJyYXkoNythKzErcisxK3QuYnl0ZUxlbmd0aCk7c1swXT0wLHNbMV09MCxzWzJdPTAsc1szXT0xLHNbNF09Nzgsc1s1XT0xLHNbNl09MTAxO2xldCBmPTA7Zm9yKDtmPGE7KXNbNytmXT0yNTUsZisrO3JldHVybiBzWzcrZl09byxmKysscy5zZXQobiw3K2YpLGYrPXIsc1s3K2ZdPTEyOCxmKysscy5zZXQobmV3IFVpbnQ4QXJyYXkodCksNytmKSxzLmJ1ZmZlcn0odCxlKTtkZWZhdWx0OnJldHVybiBudWxsfX1mdW5jdGlvbiBmKHQpe2lmKHQubGVuZ3RoPDUpcmV0dXJuIiI7bGV0IGU9LTE7Zm9yKGxldCBuPTA7bjx0Lmxlbmd0aC0zO24rKyl7aWYoMD09PXRbbl0mJjA9PT10W24rMV0mJjE9PT10W24rMl0pe2U9bjticmVha31pZihuPHQubGVuZ3RoLTQmJjA9PT10W25dJiYwPT09dFtuKzFdJiYwPT09dFtuKzJdJiYxPT09dFtuKzNdKXtlPW47YnJlYWt9fWlmKC0xPT09ZSlyZXR1cm4iIjtjb25zdCBhPWUrKDA9PT10W2UrMl0/NDozKTtpZihhPj10Lmxlbmd0aClyZXR1cm4iIjtjb25zdCBvPXRbYV07aWYoMTI4Jm8pcmV0dXJuIiI7aWYoKG8+PjEmNjMpPj0zMilyZXR1cm4gcjtpZihhKzE8dC5sZW5ndGgpe2lmKDA9PSgyNDgmdFthKzFdKSlyZXR1cm4gcn1yZXR1cm4oMzEmbyk8PTMxP246IiJ9Y29uc3QgbD03MSx1PTEsYz0yLGc9MSxwPTI7dmFyIGQ9ZnVuY3Rpb24odCl7cmV0dXJuIHRbdC5BVURJT19MRVZFTD0xXT0iQVVESU9fTEVWRUwiLHRbdC5NRVRBREFUQT0yXT0iTUVUQURBVEEiLHRbdC5BVURJT182NF9CSVRfUFRTPTNdPSJBVURJT182NF9CSVRfUFRTIix0fShkfHx7fSk7ZnVuY3Rpb24gaCh0KXtsZXQgZT1hcmd1bWVudHMubGVuZ3RoPjEmJnZvaWQgMCE9PWFyZ3VtZW50c1sxXSYmYXJndW1lbnRzWzFdO2NvbnN0IG49dC5nZXRVaW50OCgwKTtpZihuIT09bClyZXR1cm47Y29uc3Qgcj10LmdldFVpbnQxNigxKSxhPXUrYytyLG89bmV3IFVpbnQ4QXJyYXkodC5ieXRlTGVuZ3RoLWEpO28uc2V0KG5ldyBVaW50OEFycmF5KHQuYnVmZmVyLGEsdC5ieXRlTGVuZ3RoLWEpKTtjb25zdCBpPXttOm4sdGx2TGVuOnIsdGx2OltdLGZyYW1lOm99O2xldCBzPXUrYztmb3IoO3M8YTspe2NvbnN0IG49dC5nZXRVaW50OChzKSxyPXQuZ2V0VWludDE2KHMrZyksYT1nK3A7aWYobj09PWQuQVVESU9fTEVWRUwpe2xldCBvPXQuZ2V0VWludDgocythKTtmb3IobGV0IGU9MTtlPHI7ZSsrKW89bzw8OHx0LmdldFVpbnQ4KHMrYStlKTtpLnRsdi5wdXNoKHt0YWc6bixsZW5ndGg6cix2YWx1ZTplPzEyN15vPj4xOjEyNyZvfSl9ZWxzZSBpZihuPT09ZC5NRVRBREFUQXx8bj09PWQuQVVESU9fNjRfQklUX1BUUyl7Y29uc3QgZT1uZXcgVWludDhBcnJheShyKTtmb3IobGV0IG49MDtuPHI7bisrKWVbbl09dC5nZXRVaW50OChzK2Erbik7aS50bHYucHVzaCh7dGFnOm4sbGVuZ3RoOnIsdmFsdWU6ZX0pfXMrPWErcn1yZXR1cm4gaX1zZWxmLm9ucnRjdHJhbnNmb3JtPW49Pntjb25zdCByPW4udHJhbnNmb3JtZXIsYT1bXSxpPVtdO2xldCB5PW51bGw7ci5vcHRpb25zLnBvcnQub25tZXNzYWdlPXQ9Pnt0LmRhdGEuc2VpJiZhLnB1c2godC5kYXRhLnNlaSksdC5kYXRhLm1ldGFkYXRhJiZpLnB1c2godC5kYXRhLm1ldGFkYXRhKX0sc2VsZi5wb3N0TWVzc2FnZSgic3RhcnRlZCIpO2NvbnN0IFU9ci5yZWFkYWJsZS5nZXRSZWFkZXIoKSx2PXIud3JpdGFibGUuZ2V0V3JpdGVyKCk7InNlaS1yeCI9PT1yLm9wdGlvbnMubmFtZT9mdW5jdGlvbiBuKHIpe1UucmVhZCgpLnRoZW4oKGE9PntpZighYS5kb25lKXtpZihhLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IG49ZihuZXcgVWludDhBcnJheShhLnZhbHVlLmRhdGEpKSxpPW8oYS52YWx1ZSxuKTtpZihpJiZyLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7c2VpOmkscnRwVGltZXN0YW1wOmEudmFsdWUudGltZXN0YW1wfSksIXkpe2NvbnN0IG49YS52YWx1ZS5nZXRNZXRhZGF0YSgpfHx7fTt5PWZ1bmN0aW9uKG4pe2Zvcih2YXIgcj0xO3I8YXJndW1lbnRzLmxlbmd0aDtyKyspe3ZhciBhPW51bGwhPWFyZ3VtZW50c1tyXT9hcmd1bWVudHNbcl06e307ciUyP2UoT2JqZWN0KGEpLCEwKS5mb3JFYWNoKChmdW5jdGlvbihlKXt0KG4sZSxhW2VdKX0pKTpPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycz9PYmplY3QuZGVmaW5lUHJvcGVydGllcyhuLE9iamVjdC5nZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3JzKGEpKTplKE9iamVjdChhKSkuZm9yRWFjaCgoZnVuY3Rpb24odCl7T2JqZWN0LmRlZmluZVByb3BlcnR5KG4sdCxPYmplY3QuZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9yKGEsdCkpfSkpfXJldHVybiBufSh7dHlwZTphLnZhbHVlLnR5cGUscnRwVGltZXN0YW1wOmEudmFsdWUudGltZXN0YW1wLHBheWxvYWRUeXBlOm4ucGF5bG9hZFR5cGV8fDAsc3NyYzpuLnN5bmNocm9uaXphdGlvblNvdXJjZXx8MCxsZW5ndGg6YS52YWx1ZS5kYXRhLmJ5dGVMZW5ndGh9LCJtaW1lVHlwZSJpbiBuP3ttaW1lVHlwZTpuLm1pbWVUeXBlfTp7fSksci5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe2ZpcnN0RnJhbWVJbmZvOnl9KX19di53cml0ZShhLnZhbHVlKSxyLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSxuKHIpfX0pKX0ocik6InNlaS10eCI9PT1yLm9wdGlvbnMubmFtZT9mdW5jdGlvbiB0KGUpe1UucmVhZCgpLnRoZW4oKG49PntpZighbi5kb25lKXtpZihuLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IHQ9ZihuZXcgVWludDhBcnJheShuLnZhbHVlLmRhdGEpKSxlPWEuc2hpZnQoKTtpZihlKXtjb25zdCByPXMobi52YWx1ZS5kYXRhLGUsdCk7ciYmKG4udmFsdWUuZGF0YT1yKX19di53cml0ZShuLnZhbHVlKSxlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSx0KGUpfX0pKX0ocik6ImF1ZGlvLW1ldGFkYXRhLXJ4Ij09PXIub3B0aW9ucy5uYW1lP2Z1bmN0aW9uIHQoZSl7VS5yZWFkKCkudGhlbigobj0+e2lmKCFuLmRvbmUpe2lmKG4udmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkQXVkaW9GcmFtZSl7Y29uc3QgdD1uZXcgRGF0YVZpZXcobi52YWx1ZS5kYXRhKSxyPXQuZ2V0VWludDgoMCk7bGV0IGE7aWYoMCE9KDEyOCZyKSYmNzEhPT1yKXtjb25zdCBlPWZ1bmN0aW9uKHQpe2lmKHQuYnl0ZUxlbmd0aDw9MClyZXR1cm5bXTtjb25zdCBlPVtdO2xldCBuPTA7Zm9yKDtuPHQuYnl0ZUxlbmd0aDspe2NvbnN0IHI9KDEyOCZ0LmdldFVpbnQ4KG4pKT4+NyxhPTEyNyZ0LmdldFVpbnQ4KG4pO2lmKCEociYmbis0PD10LmJ5dGVMZW5ndGgpKXtuKys7YnJlYWt9e2NvbnN0IHI9dC5nZXRVaW50MzIobiwhMSksbz0oMTY3NzYxOTImcik+PjEwLGk9MTAyMyZyO2UucHVzaCh7cHQ6YSx0c19vZmZzZXQ6byxsZW5ndGg6aSxkYXRhOm5ldyBVaW50OEFycmF5fSksbis9NH19bGV0IHI9dC5ieXRlTGVuZ3RoLW47Zm9yKGNvbnN0IGEgb2YgZSl7aWYoYS5sZW5ndGg+cilyZXR1cm4gY29uc29sZS53YXJuKCJCcm9rZW4gcmVkIHBheWxvYWQiKSxbXTthLmxlbmd0aD4wJiYoYS5kYXRhPW5ldyBVaW50OEFycmF5KHQuYnVmZmVyLHQuYnl0ZU9mZnNldCtuLGEubGVuZ3RoKSxuKz1hLmxlbmd0aCxyLT1hLmxlbmd0aCl9aWYocj4wKXtjb25zdCBhPXtwdDplLmxlbmd0aD4wP2VbZS5sZW5ndGgtMV0ucHQ6MCx0c19vZmZzZXQ6MCxsZW5ndGg6cixkYXRhOm5ldyBVaW50OEFycmF5KHQuYnVmZmVyLHQuYnl0ZU9mZnNldCtuLHIpfTtlLnB1c2goYSl9cmV0dXJuIGV9KHQpO2lmKGUubGVuZ3RoPjApe2NvbnN0IHQ9ZnVuY3Rpb24odCl7bGV0IGU9MDtmb3IobGV0IG49MDtuPHQubGVuZ3RoO24rKyllKz1uPHQubGVuZ3RoLTE/NDoxLGUrPXRbbl0ubGVuZ3RoO2NvbnN0IG49bmV3IFVpbnQ4QXJyYXkoZSk7bGV0IHI9MDtmb3IobGV0IGU9MDtlPHQubGVuZ3RoO2UrKylpZihlPHQubGVuZ3RoLTEpe2NvbnN0IGE9KDIxNDc0ODM2NDh8KDEyNyZ0W2VdLnB0KTw8MjR8KDI2MjE0MyZ0W2VdLnRzX29mZnNldCk8PDEwfDEwMjMmdFtlXS5sZW5ndGgpPj4+MDtuW3IrK109YT4+MjQmMjU1LG5bcisrXT1hPj4xNiYyNTUsbltyKytdPWE+PjgmMjU1LG5bcisrXT0yNTUmYX1lbHNlIG5bcisrXT0xMjcmdFtlXS5wdDtmb3IoY29uc3QgZSBvZiB0KW4uc2V0KGUuZGF0YSxyKSxyKz1lLmxlbmd0aDtyZXR1cm4gbn0oZS5tYXAoKHQ9Pntjb25zdCBlPW5ldyBVaW50OEFycmF5KHQubGVuZ3RoKTtlLnNldCh0LmRhdGEpO2NvbnN0IG49aChuZXcgRGF0YVZpZXcoZS5idWZmZXIpKTtyZXR1cm4gbnVsbCE9biYmbi5mcmFtZSYmKHQuZGF0YT1udWxsPT1uP3ZvaWQgMDpuLmZyYW1lKSxhPW4sdH0pKSk7bi52YWx1ZS5kYXRhPXQuYnVmZmVyfX1lbHNlIGE9aCh0KSxhJiYobi52YWx1ZS5kYXRhPWEuZnJhbWUuYnVmZmVyKTtpZihhKXtsZXQgdD1hLnRsdi5maW5kKCh0PT50LnRhZz09PWQuTUVUQURBVEEpKTtpZih0JiZ0LnZhbHVlIGluc3RhbmNlb2YgVWludDhBcnJheSYmZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe21ldGFkYXRhOnQudmFsdWV9KSx0PWEudGx2LmZpbmQoKHQ9PnQudGFnPT09ZC5BVURJT182NF9CSVRfUFRTKSksdCYmdC52YWx1ZSBpbnN0YW5jZW9mIFVpbnQ4QXJyYXkmJjg9PXQudmFsdWUubGVuZ3RoKXtjb25zdCBuPW5ldyBEYXRhVmlldyh0LnZhbHVlLmJ1ZmZlcikuZ2V0QmlnVWludDY0KDAsITApO3QmJnQudmFsdWUgaW5zdGFuY2VvZiBVaW50OEFycmF5JiZlLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7cHRzOm59KX19fXYud3JpdGUobi52YWx1ZSksZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe3RyYW5zZm9ybWVkOiEwfSksdChlKX19KSl9KHIpOiJhdWRpby1tZXRhZGF0YS10eCI9PT1yLm9wdGlvbnMubmFtZSYmZnVuY3Rpb24gdChlKXtVLnJlYWQoKS50aGVuKChuPT57aWYoIW4uZG9uZSl7aWYoZS5vcHRpb25zLnBvcnQucG9zdE1lc3NhZ2Uoe2dldE1ldGFkYXRhOiEwfSksbi52YWx1ZSBpbnN0YW5jZW9mIFJUQ0VuY29kZWRBdWRpb0ZyYW1lKXtjb25zdCB0PWkuc2hpZnQoKTt0JiYobi52YWx1ZS5kYXRhPWZ1bmN0aW9uKHQsZSxuKXtjb25zdCByPW4uYnl0ZUxlbmd0aCxhPXIrZytwLG89dStjK2EsaT1uZXcgQXJyYXlCdWZmZXIodC5ieXRlTGVuZ3RoK28pLHM9bmV3IERhdGFWaWV3KGkpO3Muc2V0VWludDgoMCxsKSxzLnNldFVpbnQxNigxLGEpLHMuc2V0VWludDgoMyxlKSxzLnNldFVpbnQxNig0LHIpO2ZvcihsZXQgdD0wO3Q8cjt0Kyspcy5zZXRVaW50OCg2K3Qsblt0XSk7Y29uc3QgZj1uZXcgVWludDhBcnJheShzLmJ1ZmZlcik7cmV0dXJuIGYuc2V0KG5ldyBVaW50OEFycmF5KHQpLG8pLGYuYnVmZmVyfShuLnZhbHVlLmRhdGEsZC5BVURJT182NF9CSVRfUFRTLHQpKX12LndyaXRlKG4udmFsdWUpLGUub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQoZSl9fSkpfShyKX0sc2VsZi5wb3N0TWVzc2FnZSgicmVnaXN0ZXJlZCIpOwo=")],{type:"text/javascript"});return setTimeout((()=>$k.revokeObjectURL(e)),0),new Worker($k.createObjectURL(e))}const tM=71,rM=1,nM=2,iM=1,oM=2;var sM=function(e){return e[e.AUDIO_LEVEL=1]="AUDIO_LEVEL",e[e.METADATA=2]="METADATA",e[e.AUDIO_64_BIT_PTS=3]="AUDIO_64_BIT_PTS",e}(sM||{});function aM(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r=e.getUint8(0);if(r!==tM)return;const n=e.getUint16(1),i=rM+nM+n,o=new Uint8Array(e.byteLength-i);o.set(new Uint8Array(e.buffer,i,e.byteLength-i));const s={m:r,tlvLen:n,tlv:[],frame:o};let a=rM+nM;for(;a<i;){const r=e.getUint8(a),n=e.getUint16(a+iM),i=iM+oM;if(r===sM.AUDIO_LEVEL){let o=e.getUint8(a+i);for(let t=1;t<n;t++)o=o<<8|e.getUint8(a+i+t);s.tlv.push({tag:r,length:n,value:t?127^o>>1:127&o})}else if(r===sM.METADATA||r===sM.AUDIO_64_BIT_PTS){const t=new Uint8Array(n);for(let r=0;r<n;r++)t[r]=e.getUint8(a+i+r);s.tlv.push({tag:r,length:n,value:t})}a+=i+n}return s}const cM=new Map;function uM(e,t){const r=t.chunk,n=t.controller,i=sM.METADATA;r.data=function(e,t,r){const n=r.byteLength,i=n+iM+oM,o=rM+nM+i,s=new ArrayBuffer(e.byteLength+o),a=new DataView(s);a.setUint8(0,tM),a.setUint16(1,i),a.setUint8(3,t),a.setUint16(4,n);for(let e=0;e<n;e++)a.setUint8(6+e,r[e]);const c=new Uint8Array(a.buffer);return c.set(new Uint8Array(e),o),c.buffer}(r.data,i,e),n.enqueue(r)}var dM=z(rS);const lM=127,hM=1e-10,pM=139/13;const fM=new Map;function EM(e,t,r){const n="".concat(e,"-").concat(t,"-").concat(r);let i=0;if(fM.has(n))i=fM.get(n);else{const o=.5;i=Math.log(function(e,t){const r=e-t;t<r&&(t=r);let n=1;for(let r=e,i=1;r>t;r--,i++)n=n*r/i;return n}(t,e))+e*Math.log(o)+(t-e)*Math.log(1-o)-Math.log(r)+r*e,fM.set(n,i)}return i<hM&&(i=hM),i}function mM(e,t,r){const n=t.length,i=e.length/n;let o=!1;for(let s=0,a=0;s<n;s++){let n=0;for(let t=a+i;a<t;a++)e[a]>r&&n++;t[s]!==n&&(t[s]=n,o=!0)}return o}window.cache=fM;let _M=0;class TM{constructor(e){cg(this,"id",void 0),cg(this,"immediates",[]),cg(this,"lastNonSilence",-1),cg(this,"immediateSpeechActivityScore",hM),cg(this,"lastLevelChangedTime",Date.now()),cg(this,"levels",[]),cg(this,"longs",[]),cg(this,"longSpeechActivityScore",hM),cg(this,"mediums",[]),cg(this,"mediumSpeechActivityScore",hM),cg(this,"minLevel",0),cg(this,"nextMinLevel",0),cg(this,"nextMinLevelWindowLength",0),cg(this,"energyScore",0),this.id=e||"".concat(_M++),this.immediates.length=50,this.mediums.length=10,this.longs.length=1,this.levels.length=this.immediates.length}computeImmediates(){const e=this.immediates,t=this.levels,r=this.minLevel+pM;let n=!1;for(let i=0;i<e.length;++i){let o=t[i];o<r&&(o=0);const s=Math.floor(o/pM);e[i]!==s&&(e[i]=s,n=!0)}return n}computeLongs(){return mM(this.mediums,this.longs,4)}computeMediums(){return mM(this.immediates,this.mediums,7)}evaluateImmediateSpeechActivityScore(){this.immediateSpeechActivityScore=EM(this.immediates[0],13,.78)}evaluateLongSpeechActivityScore(e){this.longSpeechActivityScore=EM(this.longs[0],10,47),this.longSpeechActivityScore>hM&&(this.lastNonSilence=e)}evaluateMediumSpeechActivityScore(){this.mediumSpeechActivityScore=EM(this.mediums[0],5,24)}evaluateSpeechActivityScores(e){this.computeImmediates()&&(this.evaluateImmediateSpeechActivityScore(),this.computeMediums()&&(this.evaluateMediumSpeechActivityScore(),this.computeLongs()&&this.evaluateLongSpeechActivityScore(e)))}getLastLevelChangedTime(){return this.lastLevelChangedTime}getLevels(){var e;return"[".concat(dM(e=[...this.levels]).call(e).join(),"]")}getSpeechActivityScore(e){switch(e){case 0:return this.immediateSpeechActivityScore;case 1:return this.mediumSpeechActivityScore;case 2:return this.longSpeechActivityScore;default:throw new Error("interval "+e)}}levelChanged(e,t){if(this.lastLevelChangedTime<=t){this.lastLevelChangedTime=t;let r=e;return e<0&&(r=0),e>lM&&(r=lM),this.levels.unshift(r),this.levels.length>this.immediates.length&&this.levels.pop(),this.updateMinLevel(r),r>=this.minLevel+pM?r:r/2}return-1}levelTimedOut(){this.levelChanged(0,this.lastLevelChangedTime)}updateMinLevel(e){if(0!==e){if(0===this.minLevel||this.minLevel>e)return this.minLevel=e,this.nextMinLevel=0,void(this.nextMinLevelWindowLength=0);if(0===this.nextMinLevel)return this.nextMinLevel=e,void(this.nextMinLevelWindowLength=1);if(this.nextMinLevel>e&&(this.nextMinLevel=e),this.nextMinLevelWindowLength++,this.nextMinLevelWindowLength>=750){let e=Math.sqrt(this.minLevel*this.nextMinLevel);e<0?e=0:e>lM&&(e=lM),this.minLevel=e,this.nextMinLevel=0,this.nextMinLevelWindowLength=0}}}}class gM{constructor(e){cg(this,"algorithm",void 0),this.algorithm=e}execute(){let e=!this.algorithm;if(!e)try{const t=this.algorithm.runInDecisionMaker(this);t<=0?e=!0:setTimeout(this.execute.bind(this),t)}catch(t){e=!0}e&&this.algorithm&&this.algorithm.decisionMakerExited(this)}}class SM{constructor(e,t,r){cg(this,"isDominant",void 0),cg(this,"energyRanking",void 0),cg(this,"energyScore",void 0),this.isDominant=e,this.energyRanking=t,this.energyScore=r}}class yM extends ii{constructor(e){super(),cg(this,"dominantId",null),cg(this,"lastDecisionTime",0),cg(this,"lastLevelChangedTime",0),cg(this,"lastLevelIdleTime",0),cg(this,"relativeSpeechActivities",[]),cg(this,"speakers",new Map),cg(this,"enableSilence",!1),cg(this,"timeoutToSilenceInterval",0),cg(this,"decisionMaker",null),cg(this,"loudest",[]),cg(this,"numLoudestToTrack",3),cg(this,"energyExpireTimeMs",250),cg(this,"energyAlphaPct",50),this.timeoutToSilenceInterval=e,this.enableSilence=e>0,this.relativeSpeechActivities.length=3}setLoudestConfig(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=arguments.length>1?arguments[1]:void 0,r=arguments.length>2?arguments[2]:void 0;this.numLoudestToTrack=e,null!=t&&(this.energyExpireTimeMs=t),null!=r&&(this.energyAlphaPct=r),this.loudest.length>e&&this.loudest.splice(e)}getDominantSpeaker(){return this.dominantId}isAmongLoudest(e){return this.loudest.some((t=>t.id===e))}levelChanged(e,t){const r=Date.now(),n=this.getOrCreateSpeaker(e);this.lastLevelChangedTime<r&&(this.lastLevelChangedTime=r,this.maybeStartDecisionMaker());const i=n.levelChanged(t,r);return this.updateLoudestList(n,i,r)}runInDecisionMaker(e){if(this.decisionMaker!==e)return-1;if(this.lastDecisionTime>0){if(this.lastDecisionTime-this.lastLevelChangedTime>=15e3)return-1}return this._runInDecisionMaker()}decisionMakerExited(e){this.decisionMaker===e&&(this.decisionMaker=null)}destroy(){this.decisionMaker=null,this.loudest.length=0,this.speakers.clear(),this.removeAllListeners()}addSpeakers(e){e.forEach((e=>{this.speakers.has(e.id)||this.speakers.set(e.id,e)}))}removeSpeakers(e){e.forEach((e=>{this.speakers.delete(e.id)}))}getOrCreateSpeaker(e){let t=this.speakers.get(e);return t||(t=new TM(e),this.speakers.set(e,t),this.maybeStartDecisionMaker()),t}updateLoudestList(e,t,r){const n=e.id===this.dominantId;if(t<0){let t=0;for(;t<this.loudest.length&&this.loudest[t]!==e;)++t;return new SM(n,t,e.energyScore)}if(e.energyScore=Math.floor((this.energyAlphaPct*t+(100-this.energyAlphaPct)*e.energyScore+50)/100),0===this.numLoudestToTrack)return new SM(n,0,e.energyScore);const i=r-this.energyExpireTimeMs;let o=0;for(;o<this.loudest.length;){const t=this.loudest[o];if(t.getLastLevelChangedTime()<i&&this.loudest.length>=this.numLoudestToTrack)this.loudest.splice(o,1);else if(t.id!==e.id)++o;else if(this.loudest.splice(o,1),this.loudest.length<this.numLoudestToTrack)break}let s=0;for(;s<this.loudest.length;){if(this.loudest[s].energyScore<e.energyScore)break;++s}return s<this.numLoudestToTrack&&(this.loudest.splice(s,0,e),this.loudest.length>this.numLoudestToTrack&&this.loudest.splice(this.numLoudestToTrack,1)),new SM(n,s,e.energyScore)}maybeStartDecisionMaker(){!this.decisionMaker&&this.speakers.size>0&&(this.decisionMaker=new gM(this),this.decisionMaker.execute())}makeDecision(e){let t=null,r=null;const n=this.speakers.size;let i=null;if(0===n)i=null;else if(1===n){var o;const t=vI(o=this.speakers).call(o).next().value;if(this.enableSilence&&t){i=t.id,t.evaluateSpeechActivityScores(e);e-t.lastNonSilence>this.timeoutToSilenceInterval&&(i=null)}}else{let t=null==this.dominantId?null:this.speakers.get(this.dominantId);if(null==t){const e=this.speakers.entries().next();e.value&&(i=e.value[0],t=e.value[1])}else i=t.id;null!=t&&t.evaluateSpeechActivityScores(e);const r=this.relativeSpeechActivities;let n=2;for(const o of this.speakers.entries()){const s=JO(o,2),a=s[0],c=s[1];if(c===t)continue;c.evaluateSpeechActivityScores(e);for(let e=0;e<r.length;++e){const n=null==t?hM:t.getSpeechActivityScore(e);r[e]=Math.log(c.getSpeechActivityScore(e)/n)}const u=r[0],d=r[1],l=r[2];u>3&&d>2&&l>0&&d>n&&(n=d,i=a)}if(this.enableSilence&&null!=t&&i===t.id){e-t.lastNonSilence>this.timeoutToSilenceInterval&&(i=null)}}null==i&&!this.enableSilence||i===this.dominantId||(t=this.dominantId,this.dominantId=i,r=this.dominantId),null==r&&!this.enableSilence||r===t||this.emit("ActiveSpeakerChanged",r)}_runInDecisionMaker(){const e=Date.now(),t=300-(e-this.lastLevelIdleTime);let r=0;t<=0?(0!==this.lastLevelIdleTime&&this.timeoutIdleLevels(e),this.lastLevelIdleTime=e):r=t;let n=300-(e-this.lastDecisionTime);return n<=0&&(this.lastDecisionTime=e,this.makeDecision(e),n=300-(Date.now()-e)),n>0&&r>n&&(r=n),r}timeoutIdleLevels(e){const t=[];for(const n of vI(r=this.speakers).call(r)){var r;const i=e-n.getLastLevelChangedTime();36e5<i&&(null==this.dominantId||n.id!==this.dominantId)?t.push(n.id):300<i&&n.levelTimedOut()}t.forEach((e=>this.speakers.delete(e)))}}const RM=new Map;let vM=null,AM=null;const bM=3;let OM=[];function IM(e,t){let r=RM.get(e);if(r||(r=function(e){const t=new TM;return RM.set(e,t),vM||(vM=new yM(to("TOPN_SILENCE_THRESHOLD")||500),vM.on("ActiveSpeakerChanged",(e=>{null!=e&&(AM=e)}))),vM.addSpeakers([t]),t}(e)),RM.size<=bM)return{selected:!0,speaker:r};if(!vM)throw new Error("no active speaker detector");vM.levelChanged(r.id,t),OM=vM.loudest.map((e=>e.id)),AM&&!Id(OM).call(OM,AM)&&OM.length>=bM&&OM.pop();return{selected:Id(OM).call(OM,r.id)||r.id===AM,speaker:r}}const CM=1e3,wM=40,NM=new Map,PM=new Map;class DM{get samples(){return this.actives+this.inactives}get activeRate(){return this.actives/this.samples}constructor(e,t){cg(this,"id",void 0),cg(this,"track",void 0),cg(this,"score",0),cg(this,"active",!0),cg(this,"muted",!1),cg(this,"timer",0),cg(this,"actives",0),cg(this,"inactives",0),this.id=e,this.track=t,this.setActive(NM.size<3)}autoCheckActive(){this.autoSetActive(),this.autoAdjustActive(),this.resetTimer(),this.actives=0,this.inactives=0}autoSetActive(){const e=this.active;this.active=this.activeRate>=.8;const t=function(){const e=[],t=[];return Array.from(vI(NM).call(NM)).forEach((r=>{r.active?e.push(r):t.push(r)})),{actives:e,inactives:t}}(),r=t.actives,n=t.inactives;if(r.length>3){let e;r.forEach((t=>{(!e||e.score>t.score)&&(e=t)})),e&&e.setActive(!1)}if(r.length<3&&n.length>0){let t;n.forEach((e=>{(!t||t.score<e.score)&&e.id!==this.id&&(t=e)})),t&&e&&!this.active&&(t.samples>wM&&t.activeRate-this.activeRate>.4?t.setActive(!0):this.active=!0)}this.setMuted(!this.active)}setActive(e){this.active=e,this.resetTimer(),this.setMuted(!e)}autoAdjustActive(){this.active?this.autoSwitchToInactive():this.autoSwitchToActive()}autoSwitchToActive(){const e=function(e){let t;return Array.from(vI(NM).call(NM)).forEach((r=>{!r.active||r.id===e||r.samples<wM||(!t||r.score<t.score)&&(t=r)})),t}(this.id);e&&this.activeRate-e.activeRate>.4&&(e.setActive(!1),this.setActive(!0))}autoSwitchToInactive(){const e=function(e){let t;return Array.from(vI(NM).call(NM)).forEach((r=>{r.active||r.id===e||r.samples<wM||(!t||r.score>t.score)&&(t=r)})),t}(this.id);e&&e.activeRate-this.activeRate>.4&&(e.setActive(!0),this.setActive(!1))}addSample(e){e?this.actives+=1:this.inactives+=1,this.samples>66.66666666666667&&this.autoCheckActive()}setMuted(e){this.track&&(this.track.enabled=!e,this.muted=e)}resetTimer(){this.clearTimer(),this.timer=window.setTimeout((()=>{if(0!==this.samples)return this.samples<50?this.resetTimer():void this.autoCheckActive()}),CM)}clearTimer(){this.timer&&(clearTimeout(this.timer),this.timer=0)}}let LM;function kM(e,t,r){const n=NM.get(e)||new DM(e,t);return n.score=r,NM.set(e,n),function(e){if(PM.set(e,!0),!LM)return void(LM=Date.now());const t=Date.now();t-LM>1e3&&(PM.get(e)?PM.set(e,!1):(MM(e),PM.delete(e)),LM=t)}(e),n}function MM(e){const t=NM.get(e);t&&(NM.delete(e),t.clearTimer())}const UM=new Map,xM=new Map;function VM(e,t,r,n){const i=new DataView(e.data),o=i.getUint8(0);let s;if(0!=(128&o)&&71!==o){const t=function(e){if(e.byteLength<=0)return[];const t=[];let r=0;for(;r<e.byteLength;){const n=(128&e.getUint8(r))>>7,i=127&e.getUint8(r);if(!(n&&r+4<=e.byteLength)){r++;break}{const n=e.getUint32(r,!1),o=(16776192&n)>>10,s=1023&n;t.push({pt:i,ts_offset:o,length:s,data:new Uint8Array}),r+=4}}let n=e.byteLength-r;for(const i of t){if(i.length>n)return console.warn("Broken red payload"),[];i.length>0&&(i.data=new Uint8Array(e.buffer,e.byteOffset+r,i.length),r+=i.length,n-=i.length)}if(n>0){const i={pt:t.length>0?t[t.length-1].pt:0,ts_offset:0,length:n,data:new Uint8Array(e.buffer,e.byteOffset+r,n)};t.push(i)}return t}(i);if(t.length>0){const r=function(e){let t=0;for(let r=0;r<e.length;r++)t+=r<e.length-1?4:1,t+=e[r].length;const r=new Uint8Array(t);let n=0;for(let t=0;t<e.length;t++)if(t<e.length-1){const i=(2147483648|(127&e[t].pt)<<24|(262143&e[t].ts_offset)<<10|1023&e[t].length)>>>0;r[n++]=i>>24&255,r[n++]=i>>16&255,r[n++]=i>>8&255,r[n++]=255&i}else r[n++]=127&e[t].pt;for(const t of e)r.set(t.data,n),n+=t.length;return r}(t.map((e=>{const t=new Uint8Array(e.length);t.set(e.data);const r=aM(new DataView(t.buffer));return null!=r&&r.frame&&(e.data=null==r?void 0:r.frame),s=r,e})));e.data=r.buffer}}else s=aM(i),s&&(e.data=s.frame.buffer);if(t.enqueue(e),!s)return;const a=s.tlv.find((e=>e.tag===sM.METADATA));a&&r&&a.value instanceof Uint8Array&&r(a.value);const c=s.tlv.find((e=>e.tag===sM.AUDIO_64_BIT_PTS));if(c&&n&&c.value instanceof Uint8Array&&8==c.value.length){n(new DataView(c.value.buffer).getBigUint64(0,!0))}}const FM="video/h264",BM="video/h265";function jM(e,t,r){const n=new Uint8Array(e,t,r),i=[];let o=0;for(;i.length<r;)o+3<r&&0===n[o]&&0===n[o+1]&&3===n[o+2]&&(0===n[o+3]||1===n[o+3]||2===n[o+3]||3===n[o+3])?(i.push(n[o],n[o+1],n[o+3]),o+=4):(i.push(n[o]),o++);return new Uint8Array(i)}function WM(e,t){switch(t){case FM:return function(e){const t=new DataView(e.data);let r=0;for(;r+4<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&6===t.getUint8(r+4)){let n=r+6,i=0,o=0;for(;255===(o=t.getUint8(n++));)i+=255;i+=o;const s=jM(e.data,n,i);return new Uint8Array(s)}r++}return null}(e);case BM:return function(e){const t=new DataView(e.data);let r=0;for(;r+5<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&78===t.getUint8(r+4)&&1===t.getUint8(r+5)&&101===t.getUint8(r+6)){let n=r+7,i=0,o=0;for(;255===(o=t.getUint8(n++));)i+=255;i+=o;const s=jM(e.data,n,i);return new Uint8Array(s)}r++}return null}(e);default:return null}}function GM(e){const t=e.length,r=[];let n=0;for(;n<t;)n+2<t&&0===e[n]&&0===e[n+1]&&(0===e[n+2]||1===e[n+2]||2===e[n+2]||3===e[n+2])?(r.push(e[n],e[n+1],3,e[n+2]),n+=3):(r.push(e[n]),n++);return new Uint8Array(r)}function HM(e,t,r){switch(r){case FM:return function(e,t){const r=GM(t),n=r.length,i=Math.floor(n/255),o=n%255,s=new Uint8Array(6+i+1+n+1+e.byteLength);s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=6,s[5]=101;let a=0;for(;a<i;)s[6+a]=255,a++;return s[6+a]=o,a++,s.set(r,6+a),a+=n,s[6+a]=128,a++,s.set(new Uint8Array(e),6+a),s.buffer}(e,t);case BM:return function(e,t){const r=GM(t),n=r.length,i=Math.floor(n/255),o=n%255,s=new Uint8Array(7+i+1+n+1+e.byteLength);s[0]=0,s[1]=0,s[2]=0,s[3]=1,s[4]=78,s[5]=1,s[6]=101;let a=0;for(;a<i;)s[7+a]=255,a++;return s[7+a]=o,a++,s.set(r,7+a),a+=n,s[7+a]=128,a++,s.set(new Uint8Array(e),7+a),s.buffer}(e,t);default:return null}}function KM(e){if(e.length<5)return"";let t=-1;for(let r=0;r<e.length-3;r++){if(0===e[r]&&0===e[r+1]&&1===e[r+2]){t=r;break}if(r<e.length-4&&0===e[r]&&0===e[r+1]&&0===e[r+2]&&1===e[r+3]){t=r;break}}if(-1===t)return"";const r=t+(0===e[t+2]?4:3);if(r>=e.length)return"";const n=e[r];if(128&n)return"";if((n>>1&63)>=32)return BM;if(r+1<e.length){if(0==(248&e[r+1]))return BM}return(31&n)<=31?FM:""}const YM=new Map;function XM(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}const ZM=new Map;Wo(),e.AUDIO_CONTEXT_EVENT=zo,e.AUDIO_ENCODER_CONFIG_SETTINGS=Vd,e.AUDIO_TRACK_EVENT=nl,e.AgoraRTCPlayer=Pw,e.AudioProcessorContext=wI,e.AudioProcessorDestination=CI,e.AudioSourceEvents=rl,e.BufferSourceAudioTrack=Rw,e.CameraVideoTrack=gN,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=il,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=ol,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=sl,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=al,e.DataChannel=GN,e.DataChannelEvents=fl,e.DeviceManager=_O,e.DeviceManagerEvent=ll,e.DeviceManagerState=dl,e.LocalAudioTrack=Sw,e.LocalDataChannel=class extends GN{send(e){if(this._originDataChannel){let t=e;t=this._dataStreamPacketHandler.serialize(e);const r=new Uint8Array(this._dataStreamPacketHeader.byteLength+t.byteLength);r.set(new Uint8Array(this._dataStreamPacketHeader),0),r.set(new Uint8Array(t),this._dataStreamPacketHeader.byteLength),this._originDataChannel.send(r.buffer)}}},e.LocalTrack=Gb,e.LocalTrackEvents=$d,e.LocalVideoTrack=TN,e.MediaElementNumStatus={uninit:100,none:110,init:120,loadeddata:130,canplay:200,playing:210,paused:220,suspend:300,stalled:310,waiting:320,error:330,destroyed:340,abort:350,ended:360,emptied:370},e.MediaElementStatus=hl,e.MicrophoneAudioTrack=yw,e.MixingAudioTrack=vw,e.PROCESSOR_CONTEXT_EVENTS=ul,e.PROCESSOR_DESTINATION_EVENTS=cl,e.RemoteAudioTrack=jN,e.RemoteDataChannel=class extends GN{constructor(e){super(e),cg(this,"_messageListener",void 0),this._messageListener=e=>{if(e.data.byteLength<this._dataStreamPacketHeader.byteLength)throw Error("invalid byteLength: the byte length must exceed "+this._dataStreamPacketHeader.byteLength);const t=e.data.slice(0,this._dataStreamPacketHeader.byteLength),r=new DataView(t).getUint8(3);if(r!==this.id)return void(to("SHOW_DATASTREAM2_LOG")&&go.debug("invalid datachannel id: ".concat(r," !== ").concat(this.id)));let n=e.data.slice(this._dataStreamPacketHeader.byteLength);n=this._dataStreamPacketHandler.deserialize(n),this.emit(fl.MESSAGE,n)}}_updateDataChannelConfig(e){this._config=e}_updateOriginDataChannel(e){super._updateOriginDataChannel(e),this._bandRemoteDataChannelEvents()}_close(){this._originDataChannel&&(this._originDataChannel.removeEventListener("message",this._messageListener),super._close())}_bandRemoteDataChannelEvents(){this._originDataChannel&&this._originDataChannel.addEventListener("message",this._messageListener)}},e.RemoteStreamFallbackType=Qd,e.RemoteStreamType=Jd,e.RemoteTrack=FN,e.RemoteTrackEvents=el,e.RemoteVideoTrack=BN,e.SAFARI_GLOBAL_GUM_LOCK=hO,e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=Ld,e.SUPPORT_SVC_CONFIG_LIST=kd,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=Dd,e.StreamType=zd,e.Track=Wb,e.TrackEvents=qd,e.TrackHint=Zd,e.TrackInternalEvent=Xd,e.TrackMediaType=tl,e.VideoPlayer=ww,e.VideoProcessorContext=II,e.VideoProcessorDestination=OI,e.VideoState=pl,e.__TRACK_LIST__=Bd,e.addTrack=jd,e.audioContextState=Zb,e.audioElementPlayCenter=pI,e.audioTimerLoop=function(e,t){let r=!1;const n=1/t;if(to("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*n)}else{const t=Qb();let i=t.createGain();i.gain.value=0,i.connect(t.destination);const o=()=>{if(r)return void(i=null);const s=t.createOscillator();s.onended=o,s.connect(i),s.start(0),s.stop(t.currentTime+n),e(t.currentTime)};o()}return()=>{r=!0}},e.autoPlayGestureEventEmitter=qO,e.blob2Uint8Array=NC,e.checkMediaStreamTrackResolution=DI,e.checkTrackState=fI,e.createBufferSourceAudioTrack=async function(e){var t;const r=e.cacheOnlineFile,n=e.encoderConfig;let i=e.source;const o={source:i instanceof AudioBuffer?"AudioBuffer":i instanceof File?null!==(t=File.name)&&void 0!==t?t:"File":i,cacheOnlineFile:r,encoderConfig:n},s=wi(8,"track-buf-"),a=Bo.reportApiInvoke(null,{id:s,tag:ui.TRACER,name:ci.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(to("DISABLE_WEBAUDIO"))throw new Zn(Xn.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");go.info("start create buffer source audio track with config",JSON.stringify(o),"trackId",s);const c=i;if(!(i instanceof AudioBuffer))try{i=await async function(e,t){let r=null;if("string"==typeof e){const t=bw.get(e);if(t)return go.debug("use cached audio resource: ",e),t;try{r=(await Wi((()=>ln.get(e,{responseType:"arraybuffer"})),void 0,void 0,{maxRetryCount:3})).data}catch(e){throw new Zn(Xn.FETCH_AUDIO_FILE_FAILED,e.toString())}}else{const t=new jb(((t,r)=>{const n=new FileReader;n.onload=e=>{e.target?t(e.target.result):r(new Zn(Xn.READ_LOCAL_AUDIO_FILE_ERROR))},n.onerror=()=>{r(new Zn(Xn.READ_LOCAL_AUDIO_FILE_ERROR))},n.readAsArrayBuffer(e)}));r=await t}const n=await eO(r);return"string"==typeof e&&t&&bw.set(e,n),n}(i,r)}catch(e){return a.onError(e),e.throw(go)}const u=new Aw(i),d=new Rw(c,u,n?Fd(n):{},s);return go.info("create buffer source audio track success, trackId:",s),a.onSuccess(d.getTrackId()),d},e.createCameraVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=to("CAMERA_CAPTURE_CONFIG"),r=wi(8,"track-cam-"),n=Bo.reportApiInvoke(null,{id:r,tag:ui.TRACER,name:ci.CREATE_CAM_VIDEO_TRACK,options:[yN({},e),t]});t&&(e.encoderConfig=t);const i=LI(e);let o=null;go.info("start create camera video track with config",JSON.stringify(e),"trackId",r);try{o=(await pO({video:i},r)).getVideoTracks()[0]||null}catch(e){throw n.onError(e),e}if(!o){const e=new Zn(Xn.UNEXPECTED_ERROR,"can not find track in media stream");return n.onError(e),e.throw(go)}if(e.optimizationMode&&vN(r,o,e,Md(e.encoderConfig)),to("USE_STANDARD_BITRATE_DEFAULT")){const t=Md(e.encoderConfig);e.encoderConfig=t,delete t.bitrateMax,delete t.bitrateMin}const s=new gN(o,e,i,e.scalabiltyMode?xd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,r);return n.onSuccess(s.getTrackId()),go.info("create camera video success, trackId:",r),s},e.createCustomAudioTrack=function(e){const t=wi(8,"track-cus-"),r=Bo.reportApiInvoke(null,{id:t,tag:ui.TRACER,name:ci.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),n=new Sw(e.mediaStreamTrack,e.encoderConfig?Fd(e.encoderConfig):{},t,!1);return go.info("create custom audio track success with config",e,"trackId",n.getTrackId()),r.onSuccess(n.getTrackId()),n},e.createCustomVideoTrack=function(e){const t=wi(8,"track-cus-"),r=Bo.reportApiInvoke(null,{id:t,tag:ui.TRACER,name:ci.CREATE_CUSTOM_VIDEO_TRACK,options:[e]});to("USE_STANDARD_BITRATE_DEFAULT")&&(delete e.bitrateMax,delete e.bitrateMin);const n=new TN(e.mediaStreamTrack,{width:e.width,height:e.height,frameRate:e.frameRate,bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin,minDownscaleWidth:e.minDownscaleWidth,minDownscaleHeight:e.minDownscaleHeight},e.scalabiltyMode?xd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,t,[Zd.CUSTOM_TRACK]);return r.onSuccess(n.getTrackId()),go.info("create custom video track success with config",e,"trackId",n.getTrackId()),n},e.createMicrophoneAndCameraTracks=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=to("CAMERA_CAPTURE_CONFIG"),n=wi(8,"track-mic-"),i=wi(8,"track-cam-"),o=Bo.reportApiInvoke(null,{id:"".concat(n,"-").concat(i),tag:ui.TRACER,name:ci.CREATE_MIC_AND_CAM_TRACKS,options:[e,t,r]});r&&(t.encoderConfig=r);const s=LI(t),a=xI(e);let c=null,u=null;go.info("start create camera video track(".concat(i,") and microphone audio track(").concat(n,") with config, audio: ").concat(JSON.stringify(e),", video: ").concat(JSON.stringify(t)));try{const e=await pO({audio:a,video:s},"".concat(n,"-").concat(i));c=e.getAudioTracks()[0],u=e.getVideoTracks()[0]}catch(e){throw o.onError(e),e}if(!c||!u){const e=new Zn(Xn.UNEXPECTED_ERROR,"can not find tracks in media stream");return o.onError(e),e.throw(go)}if(t.optimizationMode&&vN(i,u,t,Md(t.encoderConfig)),to("USE_STANDARD_BITRATE_DEFAULT")){const e=Md(t.encoderConfig);t.encoderConfig=e,delete e.bitrateMax,delete e.bitrateMin}const d=new yw(c,e,a,n),l=new gN(u,t,s,t.scalabiltyMode?xd(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,i);return o.onSuccess([d.getTrackId(),l.getTrackId()]),go.info("create camera video track(".concat(i,") and microphone audio track(").concat(n,") success")),[d,l]},e.createMicrophoneAudioTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=wi(8,"track-mic-"),r=Bo.reportApiInvoke(null,{id:t,tag:ui.TRACER,name:ci.CREATE_MIC_AUDIO_TRACK,options:[e]}),n=xI(e);let i=null;go.info("start create microphone audio track with config",JSON.stringify(e),"trackId",t);try{i=(await pO({audio:n},t)).getAudioTracks()[0]||null}catch(e){throw r.onError(e),e}if(!i){const e=new Zn(Xn.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw(go)}const o=new yw(i,e,n,t);return r.onSuccess(o.getTrackId()),go.info("create microphone audio track success, trackId:",t),o},e.createMixingAudioTrack=function(e){const t=new vw;return e.forEach((e=>t.addAudioTrack(e))),t},e.createScreenVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"disable";const r="object"==typeof t?UI(t):void 0;r&&(t="auto");const n=wi(8,"track-scr-v-"),i=Bo.reportApiInvoke(null,{id:n,tag:ui.TRACER,name:ci.CREATE_SCREEN_VIDEO_TRACK,options:[yN({},e),t]});e.encoderConfig?"string"==typeof e.encoderConfig||e.encoderConfig.width&&e.encoderConfig.height||(e.encoderConfig.width={max:1920},e.encoderConfig.height={max:1080}):e.encoderConfig="1080p_2";const o="string"==typeof e.encoderConfig&&RN.has(e.encoderConfig),s=kI(e);let a=null,c=null;const u=Go();if(!u.supportShareAudio&&"enable"===t){const e=new Zn(Xn.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio");return i.onError(e),e.throw(go)}go.info("start create screen video track with config",e,"withAudio",t,"trackId",n);const d=u.supportShareAudio&&"disable"!==t;try{const e=await pO({screen:s,screenAudio:d?r||!0:void 0},n);a=e.getVideoTracks()[0]||null,c=e.getAudioTracks()[0]||null}catch(e){throw i.onError(e),e}if(!a){const e=new Zn(Xn.UNEXPECTED_ERROR,"can not find track in media stream");return i.onError(e),e.throw(go)}if(!c&&"enable"===t){a&&a.stop();const e=new Zn(Xn.SHARE_AUDIO_NOT_ALLOWED);return i.onError(e),e.throw(go)}if("auto"===e.encoderConfig){const t=a.getSettings(),r=t.width,i=t.height,o=t.frameRate;r&&i?e.encoderConfig={width:r,height:i,frameRate:o||15}:(go.warning("[".concat(n,"] can not read captured screen resolution for auto profile, fallback to 1080p_3")),e.encoderConfig=Ud("1080p_3"))}if(e.optimizationMode||(e.optimizationMode="detail"),e.optimizationMode){if(vN(n,a,e,e.encoderConfig&&Ud(e.encoderConfig)||void 0),e.encoderConfig&&"string"!=typeof e.encoderConfig){const t=e.encoderConfig,r=t.bitrateMin,n=t.bitrateMax;e.encoderConfig.bitrateMin="number"==typeof r&&Number.isInteger(r)&&r>0?r:n}}const l=new TN(a,e.encoderConfig?Ud(e.encoderConfig):{},e.scalabiltyMode?xd(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,n,[Zd.SCREEN_TRACK]);if(o&&l.updateBitrateFromProfile(),!c)return i.onSuccess(l.getTrackId()),go.info("create screen video track success","video:",l.getTrackId()),l;const h=new Sw(c,void 0,wi(8,"track-scr-a-"),!1);return i.onSuccess([l.getTrackId(),h.getTrackId()]),go.info("create screen video track success","video:",l.getTrackId(),"audio:",h.getTrackId()),[l,h]},e.decodeAudioData=eO,e.detectSupportAudioElementSetSinkId=Ho,e.detectSupportAutCC=function(){return!!to("FORCE_ENABLE_AUT_CC")||!Ko()&&(!!to("ENABLE_AUT_CC")||void 0)},e.detectSupportAutCCFeedback=function(){return!!to("FORCE_ENABLE_AUT_CC")||!Ko()&&(!!to("ENABLE_AUT_FEEDBACK")||void 0)},e.detectSupportInstantVideo=function(e){return to("ENABLE_INSTANT_VIDEO")?to("ENABLE_INSTANT_VIDEO"):!(null==e||!e.autoSubscribe||to("FORCE_DISABLE_AUTO_SUB"))},e.detectSupportPrePc=function(e){return!Ko()&&!to("USE_NEW_TOKEN")&&(!!to("ENABLE_PREALLOC_PC")||!(null==e||!e.autoSubscribe||to("FORCE_DISABLE_AUTO_SUB")))},e.detectSupportPreSub=function(e){return!(bn()||function(e){const t=_n();return!(t.name!==pn.CHROME||!t.osVersion)&&Number(t.version)<e}(87)||Ko())&&(!!to("ENABLE_PRE_SUB")||!(null==e||!e.autoSubscribe||to("FORCE_DISABLE_AUTO_SUB")))},e.detectSupportRestrictOwnAudio=Zo,e.detectSupportSDPEndpoint=function(){return to("ENABLE_JOIN_V4")},e.detectSupportSuppressLocalAudioPlayback=Xo,e.deviceManager=TO,e.emptyImage2TypedArray=wC,e.frameData2CryptoBuffer=async(e,t,r)=>await CC(e.buffer,t,r),e.getAudioContext=Qb,e.getAudioEncoderConfiguration=Fd,e.getBitrateConstrainRange=OC,e.getBitrateFromResAndFps=IC,e.getCompatibility=Go,e.getConstraintsFromAudioConfig=MI,e.getConstraintsFromCameraConfig=LI,e.getConstraintsFromMicrophoneConfig=xI,e.getConstraintsFromScreenAudioConfig=UI,e.getConstraintsFromScreenConfig=kI,e.getElectronScreenSources=dO,e.getElectronScreenStream=cO,e.getElectronScreenStreamByUserSelect=uO,e.getLocalStream=pO,e.getNewNearestVideoProfile=bC,e.getNewVideoBitrate=AC,e.getOriginSenderConfig=e=>{const t=e._encoderConfig;if(!t)return;const r=e.getMediaStreamTrackSettings(),n=r.frameRate,i=r.width,o=r.height;let s=t.frameRate,a=void 0===s?n:s,c=t.width,u=void 0===c?i:c,d=t.height,l=void 0===d?o:d;if(!a||!u||!l)return;u=Mi(u),l=Mi(l),a=Mi(a);const h=IC(u,l,a),p=h.max,f=h.min,E=t||{},m=E.bitrateMax,_=E.bitrateMin,T=E.minDownscaleWidth,g=E.minDownscaleHeight;m||go.debug("calculate bitrate: [w: ".concat(u,", h: ").concat(l,", fps: ").concat(a,"] => [brMax: ").concat(m,", brMin: ").concat(_,"]"));const S=to("ENCODER_CONFIG_LIMIT").maxFramerate;return S&&"number"==typeof S&&(a=Math.min(a,S)),{width:u,height:l,frameRate:a,bitrateMax:m||p,bitrateMin:_||f,scaleResolutionDownBy:1,scale:0,minDownscaleWidth:T,minDownscaleHeight:g}},e.getScalabilityConfiguration=xd,e.getScreenEncoderConfiguration=Ud,e.getSilenceAudioTrack=function(){if(rO)return rO;const e=Qb();if(!e.createMediaStreamDestination)throw new Zn(Xn.NOT_SUPPORTED,"can not create silence audio track");const t=e.createBufferSource(),r=e.createBuffer(1,44100,44100);t.loop=!0,t.buffer=r;const n=e.createMediaStreamDestination();return t.connect(n),rO=n.stream.getAudioTracks()[0],rO},e.getSilenceSamplesDuration=function(e){const t=e.getChannelData(0);let r=0,n=0;for(let e=0;e<t.length;e+=1)0===t[e]?(r+=1,r>n&&(n=r)):r=0;return n/t.length*e.duration},e.getStaticTrackStream=PC,e.getVideoEncoderConfiguration=Md,e.handleGetUserMediaError=EO,e.hasAudioContext=qb,e.hasMicrophoneTrack=Gd,e.interceptLocalAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Go().supportWebRTCEncodedTransform)return void go.warning("browser not support audio encoded transform");if(cM.has(e))return;if(!e.track)return;const r={track:e.track};if(Rn()){if(!e.createEncodedStreams)return void go.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void go.error("create audio-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(i,o){r.controller||(r.controller=o),e.track&&e.track.id!==r.track.id&&(go.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n));const s=t.metadata&&t.metadata();s?uM(s,{sender:e,chunk:i,controller:o}):o.enqueue(i)}});i.readable.pipeThrough(o).pipeTo(i.writable)}else if(vn()){if("undefined"==typeof RTCRtpScriptTransform)return void go.warning("browser not support RTCRtpScriptTransform");const i=eM(),o=new MessageChannel;await new jb((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(i,{name:"audio-metadata-tx",port:o.port2},[o.port2]);e.transform=s,await new jb((e=>i.onmessage=t=>{"started"===t.data&&e(void 0)})),o.port1.onmessage=i=>{var s;if(i.data.transformed&&e.track&&(null===(s=e.track)||void 0===s?void 0:s.id)!==r.track.id)go.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n);else if(i.data.getMetadata){const e=t.metadata&&t.metadata();e&&o.port1.postMessage({metadata:e})}},r.worker=i}function n(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",n)}const t=cM.get(e);if(t){cM.delete(e);try{var r,i;null===(r=t.controller)||void 0===r||r.terminate(),null===(i=t.worker)||void 0===i||i.terminate()}catch(e){go.warning(e&&e.message)}}}cM.set(e,r),e.track.addEventListener("ended",n)},e.interceptLocalVideoFrame=async function(e,t){if(!Go().supportWebRTCEncodedTransform)return void go.warning("browser not support video encoded transform");if(YM.has(e))return;if(!e.track)return;const r={track:e.track};if(Rn()){if(!e.createEncodedStreams)return void go.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void go.error("create video-encoded-streams error",e&&e.message)}const o=[];t.on("sei-to-send",(e=>{o.push(e)}));const s=new TransformStream({transform(t,i){r.controller||(r.controller=i),e.track&&e.track.id!==r.track.id&&(go.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n));const s=KM(new Uint8Array(t.data)),a=o.shift();if(a){const e=HM(t.data,a,s);e&&(t.data=e)}i.enqueue(t)}});i.readable.pipeThrough(s).pipeTo(i.writable)}else{if(!vn())return;{if("undefined"==typeof RTCRtpScriptTransform)return void go.warning("browser not support RTCRtpScriptTransform");const i=eM(),o=new MessageChannel;await new jb((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(i,{name:"sei-tx",port:o.port2},[o.port2]);e.transform=s,await new jb((e=>i.onmessage=t=>{"started"===t.data&&e(void 0)})),t.on("sei-to-send",(e=>{o.port1.postMessage({sei:e})})),o.port1.onmessage=t=>{var i;t.data.transformed&&e.track&&(null===(i=e.track)||void 0===i?void 0:i.id)!==r.track.id&&(go.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n))},r.worker=i}}function n(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",n)}const t=YM.get(e);if(t){YM.delete(e);try{var r,i;null===(r=t.controller)||void 0===r||r.terminate(),null===(i=t.worker)||void 0===i||i.terminate()}catch(e){go.warning(e&&e.message)}}}YM.set(e,r),e.track.addEventListener("ended",n)},e.interceptRemoteAudioFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Go().supportWebRTCEncodedTransform)return void go.warning("browser not support audio encoded transform");if(UM.has(e))return;const r={track:e.track,onMetadata:t.onMetadata,onPts:t.onPts};if(Rn()&&!On()){if(!e.createEncodedStreams)return void go.warning("browser not support createEncodedStreams() API");Cn(pn.CHROME,87,116)||(t.enableTopn=!1);let i=null;try{i=e.createEncodedStreams()}catch(e){return void go.error("create audio-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(i,o){r.controller||(r.controller=o),e.track&&e.track.id!==r.track.id&&(go.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n)),t.enableTopn?function(e,t,r){var n;const i=aM(new DataView(t.data));if(!i)return r.enqueue(t);const o=e.track.id;xM.set(o,e.track);const s=null===(n=i.tlv.find((e=>e.tag===sM.AUDIO_LEVEL)))||void 0===n?void 0:n.value;let a=0;"number"==typeof s&&(a=127-s);const c=IM(e,Math.round(Math.pow(10,a/60)-1)),u=c.selected,d=c.speaker,l=kM(o,e.track,d.energyScore);l.addSample(u),l.active&&(t.data=i.frame.buffer,r.enqueue(t))}(e,i,o):t.enableMetadata||t.enablePts?VM(i,o,t.onMetadata,t.onPts):o.enqueue(i)}});i.readable.pipeThrough(o).pipeTo(i.writable)}else{if("undefined"==typeof RTCRtpScriptTransform)return void go.warning("browser not support RTCRtpScriptTransform");const t=eM(),i=new MessageChannel;await new jb((e=>t.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(t,{name:"audio-metadata-rx",port:i.port2},[i.port2]);e.transform=o,await new jb((e=>t.onmessage=t=>{"started"===t.data&&e(void 0)})),i.port1.onmessage=t=>{var i;t.data.transformed&&e.track&&(null===(i=e.track)||void 0===i?void 0:i.id)!==r.track.id?(go.debug("audio track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n)):t.data.metadata&&r.onMetadata?r.onMetadata(t.data.metadata):t.data.pts&&r.onPts&&r.onPts(t.data.pts)},r.worker=t}function n(){e.track.removeEventListener("ended",n),function(e){const t=UM.get(e);if(t){!function(e){const t=RM.get(e);t&&(RM.delete(e),vM&&(vM.removeSpeakers([t]),0===RM.size&&(vM.destroy(),vM=null)))}(e),MM(e.track.id),UM.delete(e);try{var r,n;null===(r=t.controller)||void 0===r||r.terminate(),null===(n=t.worker)||void 0===n||n.terminate()}catch(e){go.warning(e&&e.message)}}}(e)}UM.set(e,r),e.track.addEventListener("ended",n)},e.interceptRemoteVideoFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Go().supportWebRTCEncodedTransform)return void go.warning("browser not support video encoded transform");if(!e.track)return;if(ZM.has(e)){const r=ZM.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(Rn()){if(!e.createEncodedStreams)return void go.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void go.error("create video-encoded-streams error",e&&e.message)}const o=new TransformStream({transform(i,o){if(r.controller||(r.controller=o),!r.firstFrameInfo){var s;const e=i.getMetadata()||{};r.firstFrameInfo=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?XM(Object(r),!0).forEach((function(t){cg(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):XM(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({type:i.type,rtpTimestamp:i.timestamp,payloadType:e.payloadType||0,ssrc:e.synchronizationSource||0,length:i.data.byteLength},"mimeType"in e?{mimeType:e.mimeType}:{}),null===(s=t.onFirstFrame)||void 0===s||s.call(t,r.firstFrameInfo)}e.track&&e.track.id!==r.track.id&&(go.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n));const a=WM(i,KM(new Uint8Array(i.data)));a&&r.onSei&&r.onSei(a,i.timestamp),o.enqueue(i)}});i.readable.pipeThrough(o).pipeTo(i.writable)}else if(vn()){if("undefined"==typeof RTCRtpScriptTransform)return void go.warning("browser not support RTCRtpScriptTransform");const i=eM(),o=new MessageChannel;await new jb((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(i,{name:"sei-rx",port:o.port2},[o.port2]);e.transform=s,await new jb((e=>i.onmessage=t=>{"started"===t.data&&e(void 0)})),o.port1.onmessage=i=>{var o;if(i.data.transformed&&e.track&&(null===(o=e.track)||void 0===o?void 0:o.id)!==r.track.id)go.debug("video track changed: ".concat(r.track.id," => ").concat(e.track.id)),r.track.removeEventListener("ended",n),r.track=e.track,r.track.addEventListener("ended",n);else if(i.data.sei&&r.onSei)r.onSei(i.data.sei,i.data.rtpTimestamp);else if(i.data.firstFrameInfo&&t.onFirstFrame){var s;null===(s=t.onFirstFrame)||void 0===s||s.call(t,i.data.firstFrameInfo)}},r.worker=i}function n(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",n)}!function(e){const t=ZM.get(e);if(t){ZM.delete(e);try{var r,n;null===(r=t.controller)||void 0===r||r.terminate(),null===(n=t.worker)||void 0===n||n.terminate()}catch(e){go.warning(e&&e.message)}}}(e)}ZM.set(e,r),e.track.addEventListener("ended",n)},e.isAudioEncoderConfiguration=Kd,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?Jn(e,"profile",Object.keys(Vd)):Kd(e),!0},e.isBeautyEffectOptions=function(e){return void 0!==e.smoothnessLevel&&Qn(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&Qn(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&Qn(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&Jn(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),!0},e.isElectron=oi,e.isLowStreamParameter=function(e){if(!e)throw new Zn(Xn.INVALID_PARAMS);return $n(e.width)||qn(e.width,"streamParameter.width"),$n(e.height)||qn(e.height,"streamParameter.height"),$n(e.framerate)||qn(e.framerate,"streamParameter.framerate"),$n(e.bitrate)||Qn(e.bitrate,"streamParameter.bitrate"),!0},e.isPlanB=Ko,e.isScreenSourceType=Yd,e.isVideoEncoderConfiguration=Hd,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?Jn(e,"profile",Object.keys(Dd)):Hd(e),!0},e.polyfillAudioNode=$b,e.removeTrack=Wd,e.requestAutoplayGesture=$O,e.restartBackgroundTag=Jb,e.silenceScriptProcessHandler=nO,e.updateAgoraRTCCompatibility=Wo,e.visibilityWatcher=WN}));