@agora-js/media 4.20.1-1 → 4.20.2

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,6 +1,6 @@
1
1
  /**
2
- * AgoraWebSDK_N-v4.20.1-1-0-g8123837f-dirty Copyright AgoraInc.
2
+ * AgoraWebSDK_N-v4.20.2-0-g8ae7fdad 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 a(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 s(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 d(e,t){n&&console.warn(e+" is deprecated, please use "+t+" instead.")}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e){return u(e)?Object.keys(e).reduce((function(t,r){const n=u(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 _=c;function f(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 a=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||a)){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 a=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!a&&r.length&&t.includes("back")&&(a=r[r.length-1]),a&&(e.video.deviceId=o.exact?{exact:a.deviceId}:{ideal:a.deviceId}),e.video=n(e.video),_("chrome: "+JSON.stringify(e)),i(e)}))}e.video=n(e.video)}return _("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 E(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function m(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 v(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 v(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 a=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]),a.apply(this,arguments)):a.apply(this,arguments)};const s=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=s.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:R,shimAddTrackRemoveTrackWithNative:v,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:f,shimMediaStream:E,shimOnTrack:m,shimPeerConnection:y,shimSenderReceiverGetStats:S});function I(e,t){const r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){d("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 O(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 k(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){d("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 P(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 L(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:P,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:L,shimGetUserMedia:I,shimOnTrack:O,shimPeerConnection:C,shimRTCDataChannel:D,shimReceiverGetStats:N,shimRemoveStream:k,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,a=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 s=function(e,t,r){const n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){const n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){const n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=s}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 H(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")?(d("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 W(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 z(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Y=Object.freeze({__proto__:null,shimAudioContext:z,shimCallbacksAPI:B,shimConstraints:G,shimCreateOfferLegacy:K,shimGetUserMedia:j,shimLocalStreamsAPI:V,shimRTCIceServerUrls:H,shimRemoteStreamsAPI:F,shimTrackEventTransceiver:W}),X="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function J(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z={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&&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],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){const n=t.parseRtpMap(a),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"),a=t.matchPrefix(e,"a=ssrc:").map((e=>t.parseSsrcMedia(e))).filter((e=>"cname"===e.attribute)),s=a.length>0&&a[0].ssrc;let c;const d=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));d.length>0&&d[0].length>1&&d[0][0]===s&&(c=d[0][1]),n.codecs.forEach((e=>{if("RTX"===e.name.toUpperCase()&&e.parameters.apt){let t={ssrc:s,codecPayloadType:parseInt(e.parameters.apt,10)};s&&c&&(t.rtx={ssrc:c}),r.push(t),i&&(t=JSON.parse(JSON.stringify(t)),t.fec={ssrc:s,mechanism:o?"red+ulpfec":"red"},r.push(t))}})),0===r.length&&s&&r.push({ssrc:s});let u=t.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substring(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substring(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=u}))),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 a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){const e=a[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}(Z);var q=Z.exports,Q=J(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},a=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 a;a=0===t&&0===r?Number.POSITIVE_INFINITY:0===t||0===r?Math.max(t,r):Math.min(t,r);const s={};Object.defineProperty(s,"maxMessageSize",{get:()=>a}),this._sctp=s}return a.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 ae(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 se(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,de,ue=Object.freeze({__proto__:null,removeExtmapAllowMixed:oe,shimAddIceCandidateNullOrEmpty:ae,shimConnectionState:ie,shimMaxMessageSize:re,shimParameterlessSetLocalDescription:se,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:ue,extractVersion:i,disableLog:a,disableWarnings:s,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,ae(e,n),se(e),f(e,n),E(e),y(e,n),m(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,ae(e,n),se(e),I(e,n),C(e,n),O(e),k(e),w(e),N(e),D(e),P(e),L(e),M(e),U(e),ee(e),ie(e),re(e,n),ne(e);break;case"safari":if(!Y||!t.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=Y,ae(e,n),se(e),H(e),K(e),B(e),V(e),F(e),W(e),j(e),z(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}),function(e){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"}(ce||(ce={})),function(e){e.CHROME="Chrome",e.SAFARI="Safari",e.EDGE="Edge",e.FIREFOX="Firefox",e.OPERA="OPR",e.QQ="QQBrowser",e.WECHAT="MicroMessenger"}(de||(de={}));var le={exports:{}};!function(e,t){!function(r,n){var i="function",o="undefined",a="object",s="string",c="major",d="model",u="name",l="type",h="vendor",p="version",_="architecture",f="console",E="mobile",m="tablet",T="smarttv",g="wearable",S="embedded",v="Amazon",R="Apple",y="ASUS",A="BlackBerry",b="Browser",I="Chrome",O="Firefox",C="Google",w="Huawei",N="LG",k="Microsoft",D="Motorola",P="Opera",L="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},H=function(e,t){return typeof e===s&&-1!==W(t).indexOf(W(e))},W=function(e){return e.toLowerCase()},K=function(e,t){if(typeof e===s)return e=e.replace(/^\s\s*/,""),typeof t===o?e:e.substring(0,350)},z=function(e,t){for(var r,o,s,c,d,u,l=0;l<t.length&&!d;){var h=t[l],p=t[l+1];for(r=o=0;r<h.length&&!d&&h[r];)if(d=h[r++].exec(e))for(s=0;s<p.length;s++)u=d[++o],typeof(c=p[s])===a&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):n:this[c[0]]=u?c[1].call(this,u,c[2]):n:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):n):this[c]=u||n;l+=2}},Y=function(e,t){for(var r in t)if(typeof t[r]===a&&t[r].length>0){for(var i=0;i<t[r].length;i++)if(H(t[r][i],e))return"?"===r?n:r}else if(H(t[r],e))return"?"===r?n:r;return e},X={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"},J={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,p],[/opios[\/ ]+([\w\.]+)/i],[p,[u,P+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[u,P]],[/(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],[u,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[u,"UC"+b]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+b],p],[/\bfocus\/([\w\.]+)/i],[p,[u,O+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[u,P+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[u,P+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI "+b]],[/fxios\/([-\w\.]+)/i],[p,[u,O]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+b]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+b],p],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,F],p],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[u,I+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,I+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[u,"Android "+b]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[p,Y,{"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],[u,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[u,O+" 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],[u,p],[/(cobalt)\/([\w\.]+)/i],[u,[p,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[_,"amd64"]],[/(ia32(?=;))/i],[[_,W]],[/((?:i[346]|x)86)[;\)]/i],[[_,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[_,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[_,"armhf"]],[/windows (ce|mobile); ppc;/i],[[_,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[_,/ower/,"",W]],[/(sun4\w)[;\)]/i],[[_,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[_,W]]],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],[d,[h,L],[l,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[h,L],[l,E]],[/\((ip(?:hone|od)[\w ]*);/i],[d,[h,R],[l,E]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[h,R],[l,m]],[/(macintosh);/i],[d,[h,R]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[h,M],[l,E]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[h,w],[l,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[h,w],[l,E]],[/\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],[[d,/_/g," "],[h,x],[l,E]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[h,x],[l,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[h,"OPPO"],[l,E]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[h,"Vivo"],[l,E]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[d,[h,"Realme"],[l,E]],[/\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],[d,[h,D],[l,E]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[h,D],[l,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[h,N],[l,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[h,N],[l,E]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[h,"Lenovo"],[l,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[h,"Nokia"],[l,E]],[/(pixel c)\b/i],[d,[h,C],[l,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[h,C],[l,E]],[/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],[d,[h,U],[l,E]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[h,U],[l,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[h,"OnePlus"],[l,E]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[h,v],[l,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[h,v],[l,E]],[/(playbook);[-\w\),; ]+(rim)/i],[d,h,[l,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[h,A],[l,E]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[h,y],[l,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[h,y],[l,E]],[/(nexus 9)/i],[d,[h,"HTC"],[l,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[d,/_/g," "],[l,E]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[h,"Acer"],[l,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[h,"Meizu"],[l,E]],[/(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,d,[l,E]],[/(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,d,[l,m]],[/(surface duo)/i],[d,[h,k],[l,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[h,"Fairphone"],[l,E]],[/(u304aa)/i],[d,[h,"AT&T"],[l,E]],[/\bsie-(\w*)/i],[d,[h,"Siemens"],[l,E]],[/\b(rct\w+) b/i],[d,[h,"RCA"],[l,m]],[/\b(venue[\d ]{2,7}) b/i],[d,[h,"Dell"],[l,m]],[/\b(q(?:mv|ta)\w+) b/i],[d,[h,"Verizon"],[l,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[d,[h,"Barnes & Noble"],[l,m]],[/\b(tm\d{3}\w+) b/i],[d,[h,"NuVision"],[l,m]],[/\b(k88) b/i],[d,[h,"ZTE"],[l,m]],[/\b(nx\d{3}j) b/i],[d,[h,"ZTE"],[l,E]],[/\b(gen\d{3}) b.+49h/i],[d,[h,"Swiss"],[l,E]],[/\b(zur\d{3}) b/i],[d,[h,"Swiss"],[l,m]],[/\b((zeki)?tb.*\b) b/i],[d,[h,"Zeki"],[l,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],d,[l,m]],[/\b(ns-?\w{0,9}) b/i],[d,[h,"Insignia"],[l,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[d,[h,"NextBook"],[l,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],d,[l,E]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],d,[l,E]],[/\b(ph-1) /i],[d,[h,"Essential"],[l,E]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[d,[h,"Envizen"],[l,m]],[/\b(trio[-\w\. ]+) b/i],[d,[h,"MachSpeed"],[l,m]],[/\btu_(1491) b/i],[d,[h,"Rotor"],[l,m]],[/(shield[\w ]+) b/i],[d,[h,"Nvidia"],[l,m]],[/(sprint) (\w+)/i],[h,d,[l,E]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[h,k],[l,E]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[h,V],[l,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[h,V],[l,E]],[/smart-tv.+(samsung)/i],[h,[l,T]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[h,L],[l,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,N],[l,T]],[/(apple) ?tv/i],[h,[d,R+" TV"],[l,T]],[/crkey/i],[[d,I+"cast"],[h,C],[l,T]],[/droid.+aft(\w)( bui|\))/i],[d,[h,v],[l,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[h,M],[l,T]],[/(bravia[\w ]+)( bui|\))/i],[d,[h,U],[l,T]],[/(mitv-\w{5}) bui/i],[d,[h,x],[l,T]],[/Hbbtv.*(technisat) (.*);/i],[h,d,[l,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,K],[d,K],[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,d,[l,f]],[/droid.+; (shield) bui/i],[d,[h,"Nvidia"],[l,f]],[/(playstation [345portablevi]+)/i],[d,[h,U],[l,f]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[h,k],[l,f]],[/((pebble))app/i],[h,d,[l,g]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[h,R],[l,g]],[/droid.+; (glass) \d/i],[d,[h,C],[l,g]],[/droid.+; (wt63?0{2,3})\)/i],[d,[h,V],[l,g]],[/(quest( 2| pro)?)/i],[d,[h,F],[l,g]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[l,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[d,[l,E]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[l,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,E]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[u,"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],[u,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[p,Y,X]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[p,Y,X]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,j],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,p],[/\(bb(10);/i],[p,[u,A]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[u,O+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[u,I+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,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],[u,p],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,p]]},Z=function(e,t){if(typeof e===a&&(t=e,e=n),!(this instanceof Z))return new Z(e,t).getResult();var f=typeof r!==o&&r.navigator?r.navigator:n,T=e||(f&&f.userAgent?f.userAgent:""),g=f&&f.userAgentData?f.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}(J,t):J;return this.getBrowser=function(){var e={};return e[u]=n,e[p]=n,z.call(e,T,S.browser),e[c]=function(e){return typeof e===s?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e[p]),f&&f.brave&&typeof f.brave.isBrave==i&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[_]=n,z.call(e,T,S.cpu),e},this.getDevice=function(){var e={};return e[h]=n,e[d]=n,e[l]=n,z.call(e,T,S.device),!e[l]&&g&&g.mobile&&(e[l]=E),"Macintosh"==e[d]&&f&&typeof f.standalone!==o&&f.maxTouchPoints&&f.maxTouchPoints>2&&(e[d]="iPad",e[l]=m),e},this.getEngine=function(){var e={};return e[u]=n,e[p]=n,z.call(e,T,S.engine),e},this.getOS=function(){var e={};return e[u]=n,e[p]=n,z.call(e,T,S.os),!e[u]&&g&&"Unknown"!=g.platform&&(e[u]=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===s&&e.length>350?K(e,350):e,this},this.setUA(T),this};Z.VERSION="0.7.34",Z.BROWSER=G([u,p,c]),Z.CPU=G([_]),Z.DEVICE=G([d,h,l,f,E,T,m,g,S]),Z.ENGINE=Z.OS=G([u,p]),e.exports&&(t=e.exports=Z),t.UAParser=Z;var q=typeof r!==o&&(r.jQuery||r.Zepto);if(q&&!q.ua){var Q=new Z;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:X)}(le,le.exports);const he=new(J(le.exports));let pe=he.getResult(),_e=null;function fe(e){if(!_e){e&&he.setUA(e),pe=he.getResult();const t=function(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return de.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return de.CHROME;case"Safari":case"Mobile Safari":return de.SAFARI;case"Edge":return de.EDGE;case"Firefox":return de.FIREFOX;case"QQBrowser":return de.QQ;case"Opera":return de.OPERA;case"WeChat":return de.WECHAT;default:return e.browser.name||""}}(pe),r=Ee(pe),n=function(e){if("Windows"===e.os.name)return e.os.version?e.os.name+" "+e.os.version:e.os.name;return e.os.name||""}(pe),i=pe.os.version,o=Ee(pe,!1);if(!(t&&r&&n&&i))return{name:t,version:r,os:n,osVersion:i,browserVersion:o};_e={name:t,version:r,os:n,osVersion:i,browserVersion:o}}return _e}function Ee(e,t=!0){let r;return r="Blink"===e.engine.name?e.engine.version||"":e.browser.version||"",t?r.split(".")[0]:r}function me(){return fe().os}function Te(){const e=fe();return`${e.os} ${e.osVersion}`}function ge(){const e=fe();return!!("WebKit"===pe.engine.name&&e.os===ce.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==de.SAFARI||ye()&&e.name!==de.SAFARI)}function Se(){return fe().name===de.CHROME}function ve(){return fe().name===de.SAFARI}function Re(){return fe().name===de.FIREFOX}function ye(){return fe().os===ce.IOS}function Ae(e){const t=fe();return!(t.name!==de.CHROME||!t.osVersion)&&Number(t.version)>=e}function be(e){const t=fe();return!(t.name!==de.EDGE||!t.osVersion)&&Number(t.version)>=e}function Ie(e){const t=fe();return!(t.name!==de.SAFARI||!t.osVersion)&&Number(t.version)>=e}function Oe(e){const t=fe();return!(t.name!==de.OPERA||!t.osVersion)&&Number(t.version)>=e}function Ce(){const e=fe();if(e.os!==ce.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function we(){const e=fe();if(e.os!==ce.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function Ne(){const e=fe();if(e.os!==ce.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function ke(){return ve()&&navigator.maxTouchPoints>0}function De(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function Pe(){const e=fe();if(e.name===de.EDGE||e.name===de.SAFARI)return!1;return!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function Le(){return me()===ce.ANDROID}function Me(){const e=fe();return Le()&&(e.name===de.CHROME||e.name===de.WECHAT||/chrome|chromium/i.test(navigator.userAgent))}var Ue,xe,Ve;!function(e){e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",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.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.INIT_WEBSOCKET_TIMEOUT="INIT_WEBSOCKET_TIMEOUT",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"}(Ue||(Ue={}));class Fe extends Error{code;message;data;name="AgoraRTCException";constructor(e,t="",r){super(t),this.code=e,this.message=`AgoraRTCError ${this.code}: ${t}`,this.data=r}toString(){return this.data?`data: ${JSON.stringify(this.data)}\n${this.stack}`:`${this.stack}`}print(e="error",t){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 Be(e,t){if("boolean"!=typeof e)throw new Fe(Ue.INVALID_PARAMS,`Invalid ${t}: The value is of the boolean type.`)}function je(e,t,r){if(r.includes(e))return;throw new Fe(Ue.INVALID_PARAMS,`${t} can only be set as ${JSON.stringify(r)}`)}function Ge(e,t,r=1,n=1e4,i=!0){if(e<r||e>n||i&&!function(e){return"number"==typeof e&&e%1==0}(e)){throw new Fe(Ue.INVALID_PARAMS,`invalid ${t}: the value range is [${r}, ${n}]. integer only`)}}function He(e,t){if("number"!=typeof e){if(!(e.min||e.max||e.ideal||e.exact)){throw new Fe(Ue.INVALID_PARAMS,`${t} is not a valid ConstrainLong`)}void 0!==e.min&&Ge(e.min,`${t}.min`,0,1/0),void 0!==e.max&&Ge(e.max,`${t}.max`,1,1/0),void 0!==e.exact&&Ge(e.exact,`${t}.exact`,1,1/0),void 0!==e.ideal&&Ge(e.ideal,`${t}.ideal`,1,1/0)}else Ge(e,t,1,1/0)}function We(e){return null==e}!function(e){e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE"}(xe||(xe={})),function(e){e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT"}(Ve||(Ve={}));const Ke=new class{_clientSize=null;getClientWidth=()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth;getClientHeight=()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight;getStyle=e=>window.getComputedStyle(e,null);checkCssVisibleProperty=e=>{let t=!0;const r=this.getStyle(e),{display:n,visibility:i,opacity:o,filter:a}=r;if(("none"===n||["hidden","collapse"].includes(i)||Number(o)<.1)&&(t=!1),!t)return!1;if(a){a.split(" ").filter((e=>{const t=e.split("(")[0];return["brightness","blur","opacity"].includes(t)})).map((e=>{const[t,r]=e.split(/\(|\)/);return[t,Number(r.match(/^[0-9\.]+/))]})).forEach((e=>{const[r,n]=e;switch(r){case"brightness":(n<.1||n>3)&&(t=!1);break;case"blur":n>3&&(t=!1);break;case"opacity":n<.1&&(t=!1)}}))}return t};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};checkActualCssVisibleIncludeInherit=e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty);getSizeAboutClient=e=>{const{width:t,height:r,left:n,right:i,top:o,bottom:a}=e.getBoundingClientRect(),s=this.getClientWidth(),c=this.getClientHeight();return{width:t,height:r,left:n,right:i,top:o,bottom:a,clientWidth:s,clientHeight:c,clientMin:Math.min(s,c)}};checkActualSize=()=>{const{width:e,height:t,clientMin:r}=this._clientSize;return this.checkSizeIsVisible(e,t,r)};elementFromPoint=(e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null;checkCoverForAPoint=(e,t,r)=>{const n=this.elementFromPoint(e,t);return null!==n&&n!==r};getPointPositionList=()=>{const{width:e,height:t,left:r,top:n}=this._clientSize,i=e/6,o=t/6,a=[],s=10**6;for(let e=0;e<5;e++)for(let t=0;t<5;t++){const c=(r*s+(0===e?.1:4===e?(i*e*s-1e5)/s:i*e)*s)/s,d=(n*s+(0===t?.1:4===t?(o*t*s-1e5)/s:o*t)*s)/s;a.push({x:c,y:d})}return[...a]};checkElementCover=e=>this.getPointPositionList().map((t=>this.checkCoverForAPoint(t.x,t.y,e))).filter((e=>!!e)).length>6;checkSizeIsVisible=(e,t,r)=>(e>50||r/e<=10)&&(t>50||r/t<=10);checkSizeOfPartInClient=()=>{const{left:e,right:t,top:r,bottom:n,clientHeight:i,clientWidth:o,clientMin:a}=this._clientSize;let s,c,d,u;if(e<0)s=0;else{if(!(e<o))return!1;s=e}if(t<0)return!1;if(c=t<o?t:o,r<0)d=0;else{if(!(r<i))return!1;d=r}if(n<0)return!1;u=n<i?n:i;const l=c-s,h=u-d;return this.checkSizeIsVisible(l,h,a)};returnHiddenResult=e=>(this._clientSize=null,{visible:!1,reason:e});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(xe.COVERED);{const e=this.checkActualSize(),t=this.checkSizeOfPartInClient();return e&&!t?this.returnHiddenResult(xe.POSITION):e?(this._clientSize=null,{visible:!0}):this.returnHiddenResult(xe.SIZE)}}return this.returnHiddenResult(xe.STYLE)}return this.returnHiddenResult(Ve.UNMOUNTED)}return this.returnHiddenResult(Ve.INVALID_HTML_ELEMENT)};checkElementIsMountedOnDom=e=>this.checkPropertyUpToAllParentNodes(e,(e=>"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement))};const ze=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 Ye{_events={};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})}addListener=this.on;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,...t){this._events[e]||(this._events[e]=[]);const r=this._events[e].map((e=>e));for(let n=0;n<r.length;n+=1){const i=r[n];i.once&&this.off(e,i.listener),i.listener.apply(this,t||[])}}safeEmit(e,...t){[...this._events[e]||[]].forEach((r=>{r.once&&this.off(e,r.listener);try{r.listener.apply(this,t)}catch(t){console.error(`safeEmit event:${e} error ${t?.toString()}`)}}))}_indexOfListener(e,t){let r=e.length;for(;r--;)if(e[r].listener===t)return r;return-1}}function Xe(){return!!Ze()}let Je=null;function Ze(){if(Je)return Je;if(window.electron)return Je=window.electron;if(!window.require)return null;try{return Je=window.require("electron"),Je}catch(e){return null}}var qe,Qe,$e,et,tt,rt,nt,it;function ot(e,t,...r){return 0===e.getListeners(t).length?Promise.reject(new Fe(Ue.UNEXPECTED_ERROR,"can not emit promise")):new Promise(((n,i)=>{e.emit(t,...r,n,i)}))}function at(e,t,...r){return 0===e.getListeners(t).length?Promise.resolve():ot(e,t,...r)}function st(e,t,...r){return 0===e.getListeners(t).length?null:function(e,t,...r){let n=null,i=null;if(e.emit(t,...r,(e=>{n=e}),(e=>{i=e})),null!==i)throw i;if(null===n)throw new Fe(Ue.UNEXPECTED_ERROR,"handler is not sync");return n}(e,t,...r)}!function(e){e.CREATE_CLIENT="createClient",e.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",e.SET_AREA="setArea",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.DATACHANNEL_FAILBACK="Client._datachannelFailback",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"}(qe||(qe={})),function(e){e.TRACER="tracer"}(Qe||(Qe={})),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"}($e||($e={})),function(e){e.LEAVE="LEAVE",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.UID_BANNED="UID_BANNED",e.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.FALLBACK="FALLBACK",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"}(et||(et={})),function(e){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.INJECT_STREAM_STATUS="stream-inject-status",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.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"}(tt||(tt={})),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"}(rt||(rt={})),function(e){e.ONLINE="ONLINE",e.OFFLINE="OFFLINE"}(nt||(nt={})),function(e){e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE"}(it||(it={}));const ct=new class extends Ye{_moduleName="network-indicator";_networkState=nt.ONLINE;onlineWaiter;set networkState(e){this.emit(it.NETWORK_STATE_CHANGE,e,this._networkState),e===nt.ONLINE?this.emit(it.ONLINE):e===nt.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(it.ONLINE,(()=>{this.onlineWaiter=void 0,e(nt.ONLINE)}))})),this.emit(it.OFFLINE)),this._networkState=e}get networkState(){return this._networkState}get isOnline(){return this._networkState===nt.ONLINE}constructor(){super(),window.addEventListener("online",(()=>{this.networkState=nt.ONLINE})),window.addEventListener("offline",(()=>{this.networkState=nt.OFFLINE}))}};function dt(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function ut(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function lt(e){return JSON.parse(JSON.stringify(e))}function ht(e){try{return lt(e)}catch(t){return e}}const pt={};function _t(e,t){pt[t]||(pt[t]=!0,e())}function ft(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function Et(e){return new Promise((t=>{window.setTimeout(t,e)}))}function mt(e=7,t){const r=Math.random().toString(16).substr(2,e).toLowerCase();return r.length===e?`${t}${r}`:`${t}${r}`+mt(e-r.length,"")}const Tt=()=>{};const gt=new class{fnMap=new Map;throttleByKey(e,t,r,n,...i){if(this.fnMap.has(t)){const o=this.fnMap.get(t);if(o.threshold!==r){o.fn(...o.args),clearTimeout(o.timer);const a=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:a,args:i,skipFn:n})}else o.skipFn&&o.skipFn(...o.args),this.fnMap.set(t,{...o,fn:e,args:i,skipFn:n})}else{const o=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:o,args:i,skipFn:n})}}},St=gt.throttleByKey.bind(gt);function vt(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function Rt(e,t){if(!vt(e)||!vt(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]=Rt(e[n],t[n]);return r}{const r={...e};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?r[n]=Rt(e[n],t[n]):r[n]=t[n]);return r}}function yt(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}let At=1,bt=console;class It{static setLogger(e){bt=e}lockingPromise=Promise.resolve();locks=0;name="";lockId;constructor(e){this.lockId=At++,e&&(this.name=e),bt.debug(`[lock-${this.name}-${this.lockId}] is created.`)}get isLocked(){return this.locks>0}lock(e){let t;this.locks+=1,bt.debug(`[lock-${this.name}-${this.lockId}] is locked, current queue ${this.locks}. ${"string"==typeof e?e:""}`);const r=new Promise((r=>{t=()=>{this.locks-=1,bt.debug(`[lock-${this.name}-${this.lockId}] is not locked, current queue ${this.locks}. ${"string"==typeof e?e:""}`),r()}})),n=this.lockingPromise.then((()=>t));return this.lockingPromise=this.lockingPromise.then((()=>r)),n}}function Ot(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(...r){const i=this[t];if(!i)throw new Error(`mutex property key ${t} doesn't exist on ${e}`);const a=await i.lock(`From ${e}.${n}`);try{return await o.apply(this,r)}finally{a()}},i}}const Ct={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function wt(e,t,r,n){const i=Object.assign({},Ct,n);let o=i.timeout;const a=async()=>{var e;await(e=o,new Promise((t=>{window.setTimeout(t,e)}))),o*=i.timeoutFactor,o=Math.min(i.maxRetryTimeout,o)};let s=!1;const c=new Promise((async(n,o)=>{t=t||(()=>!1),r=r||(()=>!0);for(let c=0;c<i.maxRetryCount;c+=1){if(s)return o(new Fe(Ue.OPERATION_ABORTED));try{const r=await e();if(!t(r,c))return n(r);if(c+1===i.maxRetryCount)return n(r);await a()}catch(e){if(!r(e,c))return o(e);if(c+1===i.maxRetryCount)return o(e);await a()}}}));return c.cancel=()=>s=!0,c}var Nt,kt={exports:{}},Dt=function(e,t){return function(){for(var r=new Array(arguments.length),n=0;n<r.length;n++)r[n]=arguments[n];return e.apply(t,r)}},Pt=Dt,Lt=Object.prototype.toString,Mt=(Nt=Object.create(null),function(e){var t=Lt.call(e);return Nt[t]||(Nt[t]=t.slice(8,-1).toLowerCase())});function Ut(e){return e=e.toLowerCase(),function(t){return Mt(t)===e}}function xt(e){return Array.isArray(e)}function Vt(e){return void 0===e}var Ft=Ut("ArrayBuffer");function Bt(e){return null!==e&&"object"==typeof e}function jt(e){if("object"!==Mt(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}var Gt=Ut("Date"),Ht=Ut("File"),Wt=Ut("Blob"),Kt=Ut("FileList");function zt(e){return"[object Function]"===Lt.call(e)}var Yt=Ut("URLSearchParams");function Xt(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),xt(e))for(var r=0,n=e.length;r<n;r++)t.call(null,e[r],r,e);else for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.call(null,e[i],i,e)}var Jt,Zt=(Jt="undefined"!=typeof Uint8Array&&Object.getPrototypeOf(Uint8Array),function(e){return Jt&&e instanceof Jt}),qt={isArray:xt,isArrayBuffer:Ft,isBuffer:function(e){return null!==e&&!Vt(e)&&null!==e.constructor&&!Vt(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){var t="[object FormData]";return e&&("function"==typeof FormData&&e instanceof FormData||Lt.call(e)===t||zt(e.toString)&&e.toString()===t)},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Ft(e.buffer)},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:Bt,isPlainObject:jt,isUndefined:Vt,isDate:Gt,isFile:Ht,isBlob:Wt,isFunction:zt,isStream:function(e){return Bt(e)&&zt(e.pipe)},isURLSearchParams:Yt,isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:Xt,merge:function e(){var t={};function r(r,n){jt(t[n])&&jt(r)?t[n]=e(t[n],r):jt(r)?t[n]=e({},r):xt(r)?t[n]=r.slice():t[n]=r}for(var n=0,i=arguments.length;n<i;n++)Xt(arguments[n],r);return t},extend:function(e,t,r){return Xt(t,(function(t,n){e[n]=r&&"function"==typeof t?Pt(t,r):t})),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e},inherits:function(e,t,r,n){e.prototype=Object.create(t.prototype,n),e.prototype.constructor=e,r&&Object.assign(e.prototype,r)},toFlatObject:function(e,t,r){var n,i,o,a={};t=t||{};do{for(i=(n=Object.getOwnPropertyNames(e)).length;i-- >0;)a[o=n[i]]||(t[o]=e[o],a[o]=!0);e=Object.getPrototypeOf(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Mt,kindOfTest:Ut,endsWith:function(e,t,r){e=String(e),(void 0===r||r>e.length)&&(r=e.length),r-=t.length;var n=e.indexOf(t,r);return-1!==n&&n===r},toArray:function(e){if(!e)return null;var t=e.length;if(Vt(t))return null;for(var r=new Array(t);t-- >0;)r[t]=e[t];return r},isTypedArray:Zt,isFileList:Kt},Qt=qt;function $t(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var er=function(e,t,r){if(!t)return e;var n;if(r)n=r(t);else if(Qt.isURLSearchParams(t))n=t.toString();else{var i=[];Qt.forEach(t,(function(e,t){null!=e&&(Qt.isArray(e)?t+="[]":e=[e],Qt.forEach(e,(function(e){Qt.isDate(e)?e=e.toISOString():Qt.isObject(e)&&(e=JSON.stringify(e)),i.push($t(t)+"="+$t(e))})))})),n=i.join("&")}if(n){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+n}return e},tr=qt;function rr(){this.handlers=[]}rr.prototype.use=function(e,t,r){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!r&&r.synchronous,runWhen:r?r.runWhen:null}),this.handlers.length-1},rr.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},rr.prototype.forEach=function(e){tr.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var nr,ir,or=rr,ar=qt;function sr(){if(ir)return nr;ir=1;var e=qt;function t(e,t,r,n,i){Error.call(this),this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}e.inherits(t,Error,{toJSON:function(){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:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var r=t.prototype,n={};return["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach((function(e){n[e]={value:e}})),Object.defineProperties(t,n),Object.defineProperty(r,"isAxiosError",{value:!0}),t.from=function(n,i,o,a,s,c){var d=Object.create(r);return e.toFlatObject(n,d,(function(e){return e!==Error.prototype})),t.call(d,n.message,i,o,a,s),d.name=n.name,c&&Object.assign(d,c),d},nr=t}var cr,dr,ur,lr,hr,pr,_r={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1};function fr(){if(dr)return cr;dr=1;var e=qt;return cr=function(t,r){r=r||new FormData;var n=[];function i(t){return null===t?"":e.isDate(t)?t.toISOString():e.isArrayBuffer(t)||e.isTypedArray(t)?"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}return function t(o,a){if(e.isPlainObject(o)||e.isArray(o)){if(-1!==n.indexOf(o))throw Error("Circular reference detected in "+a);n.push(o),e.forEach(o,(function(n,o){if(!e.isUndefined(n)){var s,c=a?a+"."+o:o;if(n&&!a&&"object"==typeof n)if(e.endsWith(o,"{}"))n=JSON.stringify(n);else if(e.endsWith(o,"[]")&&(s=e.toArray(n)))return void s.forEach((function(t){!e.isUndefined(t)&&r.append(c,i(t))}));t(n,c)}})),n.pop()}else r.append(a,i(o))}(t),r},cr}function Er(){if(lr)return ur;lr=1;var e=sr();return ur=function(t,r,n){var i=n.config.validateStatus;n.status&&i&&!i(n.status)?r(new e("Request failed with status code "+n.status,[e.ERR_BAD_REQUEST,e.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n)):t(n)}}function mr(){if(pr)return hr;pr=1;var e=qt;return hr=e.isStandardBrowserEnv()?{write:function(t,r,n,i,o,a){var s=[];s.push(t+"="+encodeURIComponent(r)),e.isNumber(n)&&s.push("expires="+new Date(n).toGMTString()),e.isString(i)&&s.push("path="+i),e.isString(o)&&s.push("domain="+o),!0===a&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},hr}var Tr,gr,Sr,vr,Rr,yr,Ar,br,Ir,Or,Cr,wr,Nr=function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)},kr=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e},Dr=function(e,t){return e&&!Nr(t)?kr(e,t):t};function Pr(){if(gr)return Tr;gr=1;var e=qt,t=["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"];return Tr=function(r){var n,i,o,a={};return r?(e.forEach(r.split("\n"),(function(r){if(o=r.indexOf(":"),n=e.trim(r.substr(0,o)).toLowerCase(),i=e.trim(r.substr(o+1)),n){if(a[n]&&t.indexOf(n)>=0)return;a[n]="set-cookie"===n?(a[n]?a[n]:[]).concat([i]):a[n]?a[n]+", "+i:i}})),a):a},Tr}function Lr(){if(vr)return Sr;vr=1;var e=qt;return Sr=e.isStandardBrowserEnv()?function(){var t,r=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function i(e){var t=e;return r&&(n.setAttribute("href",t),t=n.href),n.setAttribute("href",t),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return t=i(window.location.href),function(r){var n=e.isString(r)?i(r):r;return n.protocol===t.protocol&&n.host===t.host}}():function(){return!0},Sr}function Mr(){if(yr)return Rr;yr=1;var e=sr();function t(t){e.call(this,null==t?"canceled":t,e.ERR_CANCELED),this.name="CanceledError"}return qt.inherits(t,e,{__CANCEL__:!0}),Rr=t}function Ur(){return br||(br=1,Ar=function(e){var t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}),Ar}function xr(){if(Or)return Ir;Or=1;var e=qt,t=Er(),r=mr(),n=er,i=Dr,o=Pr(),a=Lr(),s=_r,c=sr(),d=Mr(),u=Ur();return Ir=function(l){return new Promise((function(h,p){var _,f=l.data,E=l.headers,m=l.responseType;function T(){l.cancelToken&&l.cancelToken.unsubscribe(_),l.signal&&l.signal.removeEventListener("abort",_)}e.isFormData(f)&&e.isStandardBrowserEnv()&&delete E["Content-Type"];var g=new XMLHttpRequest;if(l.auth){var S=l.auth.username||"",v=l.auth.password?unescape(encodeURIComponent(l.auth.password)):"";E.Authorization="Basic "+btoa(S+":"+v)}var R=i(l.baseURL,l.url);function y(){if(g){var e="getAllResponseHeaders"in g?o(g.getAllResponseHeaders()):null,r={data:m&&"text"!==m&&"json"!==m?g.response:g.responseText,status:g.status,statusText:g.statusText,headers:e,config:l,request:g};t((function(e){h(e),T()}),(function(e){p(e),T()}),r),g=null}}if(g.open(l.method.toUpperCase(),n(R,l.params,l.paramsSerializer),!0),g.timeout=l.timeout,"onloadend"in g?g.onloadend=y:g.onreadystatechange=function(){g&&4===g.readyState&&(0!==g.status||g.responseURL&&0===g.responseURL.indexOf("file:"))&&setTimeout(y)},g.onabort=function(){g&&(p(new c("Request aborted",c.ECONNABORTED,l,g)),g=null)},g.onerror=function(){p(new c("Network Error",c.ERR_NETWORK,l,g,g)),g=null},g.ontimeout=function(){var e=l.timeout?"timeout of "+l.timeout+"ms exceeded":"timeout exceeded",t=l.transitional||s;l.timeoutErrorMessage&&(e=l.timeoutErrorMessage),p(new c(e,t.clarifyTimeoutError?c.ETIMEDOUT:c.ECONNABORTED,l,g)),g=null},e.isStandardBrowserEnv()){var A=(l.withCredentials||a(R))&&l.xsrfCookieName?r.read(l.xsrfCookieName):void 0;A&&(E[l.xsrfHeaderName]=A)}"setRequestHeader"in g&&e.forEach(E,(function(e,t){void 0===f&&"content-type"===t.toLowerCase()?delete E[t]:g.setRequestHeader(t,e)})),e.isUndefined(l.withCredentials)||(g.withCredentials=!!l.withCredentials),m&&"json"!==m&&(g.responseType=l.responseType),"function"==typeof l.onDownloadProgress&&g.addEventListener("progress",l.onDownloadProgress),"function"==typeof l.onUploadProgress&&g.upload&&g.upload.addEventListener("progress",l.onUploadProgress),(l.cancelToken||l.signal)&&(_=function(e){g&&(p(!e||e&&e.type?new d:e),g.abort(),g=null)},l.cancelToken&&l.cancelToken.subscribe(_),l.signal&&(l.signal.aborted?_():l.signal.addEventListener("abort",_))),f||(f=null);var b=u(R);b&&-1===["http","https","file"].indexOf(b)?p(new c("Unsupported protocol "+b+":",c.ERR_BAD_REQUEST,l)):g.send(f)}))},Ir}var Vr=qt,Fr=function(e,t){ar.forEach(e,(function(r,n){n!==t&&n.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[n])}))},Br=sr(),jr=_r,Gr=fr(),Hr={"Content-Type":"application/x-www-form-urlencoded"};function Wr(e,t){!Vr.isUndefined(e)&&Vr.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var Kr,zr={transitional:jr,adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(Kr=xr()),Kr),transformRequest:[function(e,t){if(Fr(t,"Accept"),Fr(t,"Content-Type"),Vr.isFormData(e)||Vr.isArrayBuffer(e)||Vr.isBuffer(e)||Vr.isStream(e)||Vr.isFile(e)||Vr.isBlob(e))return e;if(Vr.isArrayBufferView(e))return e.buffer;if(Vr.isURLSearchParams(e))return Wr(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString();var r,n=Vr.isObject(e),i=t&&t["Content-Type"];if((r=Vr.isFileList(e))||n&&"multipart/form-data"===i){var o=this.env&&this.env.FormData;return Gr(r?{"files[]":e}:e,o&&new o)}return n||"application/json"===i?(Wr(t,"application/json"),function(e,t,r){if(Vr.isString(e))try{return(t||JSON.parse)(e),Vr.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){var t=this.transitional||zr.transitional,r=t&&t.silentJSONParsing,n=t&&t.forcedJSONParsing,i=!r&&"json"===this.responseType;if(i||n&&Vr.isString(e)&&e.length)try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw Br.from(e,Br.ERR_BAD_RESPONSE,this,null,this.response);throw e}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:wr?Cr:(wr=1,Cr=null)},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Vr.forEach(["delete","get","head"],(function(e){zr.headers[e]={}})),Vr.forEach(["post","put","patch"],(function(e){zr.headers[e]=Vr.merge(Hr)}));var Yr,Xr,Jr=zr,Zr=qt,qr=Jr;function Qr(){return Xr?Yr:(Xr=1,Yr=function(e){return!(!e||!e.__CANCEL__)})}var $r=qt,en=function(e,t,r){var n=this||qr;return Zr.forEach(r,(function(r){e=r.call(n,e,t)})),e},tn=Qr(),rn=Jr,nn=Mr();function on(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new nn}var an,sn,cn=qt,dn=function(e,t){t=t||{};var r={};function n(e,t){return cn.isPlainObject(e)&&cn.isPlainObject(t)?cn.merge(e,t):cn.isPlainObject(t)?cn.merge({},t):cn.isArray(t)?t.slice():t}function i(r){return cn.isUndefined(t[r])?cn.isUndefined(e[r])?void 0:n(void 0,e[r]):n(e[r],t[r])}function o(e){if(!cn.isUndefined(t[e]))return n(void 0,t[e])}function a(r){return cn.isUndefined(t[r])?cn.isUndefined(e[r])?void 0:n(void 0,e[r]):n(void 0,t[r])}function s(r){return r in t?n(e[r],t[r]):r in e?n(void 0,e[r]):void 0}var c={url:o,method:o,data:o,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:s};return cn.forEach(Object.keys(e).concat(Object.keys(t)),(function(e){var t=c[e]||i,n=t(e);cn.isUndefined(n)&&t!==s||(r[e]=n)})),r};function un(){return sn?an:(sn=1,an={version:"0.27.2"})}var ln=un().version,hn=sr(),pn={};["object","boolean","number","function","string","symbol"].forEach((function(e,t){pn[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));var _n={};pn.transitional=function(e,t,r){function n(e,t){return"[Axios v"+ln+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return function(r,i,o){if(!1===e)throw new hn(n(i," has been removed"+(t?" in "+t:"")),hn.ERR_DEPRECATED);return t&&!_n[i]&&(_n[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)}};var fn,En,mn,Tn,gn,Sn,vn={assertOptions:function(e,t,r){if("object"!=typeof e)throw new hn("options must be an object",hn.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(e),i=n.length;i-- >0;){var o=n[i],a=t[o];if(a){var s=e[o],c=void 0===s||a(s,o,e);if(!0!==c)throw new hn("option "+o+" must be "+c,hn.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new hn("Unknown option "+o,hn.ERR_BAD_OPTION)}},validators:pn},Rn=qt,yn=er,An=or,bn=function(e){return on(e),e.headers=e.headers||{},e.data=en.call(e,e.data,e.headers,e.transformRequest),e.headers=$r.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),$r.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||rn.adapter)(e).then((function(t){return on(e),t.data=en.call(e,t.data,t.headers,e.transformResponse),t}),(function(t){return tn(t)||(on(e),t&&t.response&&(t.response.data=en.call(e,t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},In=dn,On=Dr,Cn=vn,wn=Cn.validators;function Nn(e){this.defaults=e,this.interceptors={request:new An,response:new An}}Nn.prototype.request=function(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},(t=In(this.defaults,t)).method?t.method=t.method.toLowerCase():this.defaults.method?t.method=this.defaults.method.toLowerCase():t.method="get";var r=t.transitional;void 0!==r&&Cn.assertOptions(r,{silentJSONParsing:wn.transitional(wn.boolean),forcedJSONParsing:wn.transitional(wn.boolean),clarifyTimeoutError:wn.transitional(wn.boolean)},!1);var n=[],i=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(i=i&&e.synchronous,n.unshift(e.fulfilled,e.rejected))}));var o,a=[];if(this.interceptors.response.forEach((function(e){a.push(e.fulfilled,e.rejected)})),!i){var s=[bn,void 0];for(Array.prototype.unshift.apply(s,n),s=s.concat(a),o=Promise.resolve(t);s.length;)o=o.then(s.shift(),s.shift());return o}for(var c=t;n.length;){var d=n.shift(),u=n.shift();try{c=d(c)}catch(e){u(e);break}}try{o=bn(c)}catch(e){return Promise.reject(e)}for(;a.length;)o=o.then(a.shift(),a.shift());return o},Nn.prototype.getUri=function(e){e=In(this.defaults,e);var t=On(e.baseURL,e.url);return yn(t,e.params,e.paramsSerializer)},Rn.forEach(["delete","get","head","options"],(function(e){Nn.prototype[e]=function(t,r){return this.request(In(r||{},{method:e,url:t,data:(r||{}).data}))}})),Rn.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(In(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Nn.prototype[e]=t(),Nn.prototype[e+"Form"]=t(!0)}));var kn=qt,Dn=Dt,Pn=Nn,Ln=dn;var Mn=function e(t){var r=new Pn(t),n=Dn(Pn.prototype.request,r);return kn.extend(n,Pn.prototype,r),kn.extend(n,r),n.create=function(r){return e(Ln(t,r))},n}(Jr);Mn.Axios=Pn,Mn.CanceledError=Mr(),Mn.CancelToken=function(){if(En)return fn;En=1;var e=Mr();function t(t){if("function"!=typeof t)throw new TypeError("executor must be a function.");var r;this.promise=new Promise((function(e){r=e}));var n=this;this.promise.then((function(e){if(n._listeners){var t,r=n._listeners.length;for(t=0;t<r;t++)n._listeners[t](e);n._listeners=null}})),this.promise.then=function(e){var t,r=new Promise((function(e){n.subscribe(e),t=e})).then(e);return r.cancel=function(){n.unsubscribe(t)},r},t((function(t){n.reason||(n.reason=new e(t),r(n.reason))}))}return t.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},t.prototype.subscribe=function(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]},t.prototype.unsubscribe=function(e){if(this._listeners){var t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}},t.source=function(){var e;return{token:new t((function(t){e=t})),cancel:e}},fn=t}(),Mn.isCancel=Qr(),Mn.VERSION=un().version,Mn.toFormData=fr(),Mn.AxiosError=sr(),Mn.Cancel=Mn.CanceledError,Mn.all=function(e){return Promise.all(e)},Mn.spread=Tn?mn:(Tn=1,mn=function(e){return function(t){return e.apply(null,t)}}),Mn.isAxiosError=function(){if(Sn)return gn;Sn=1;var e=qt;return gn=function(t){return e.isObject(t)&&!0===t.isAxiosError}}(),kt.exports=Mn,kt.exports.default=Mn;var Un=J(kt.exports);let xn=0,Vn=0;function Fn(e,t,r,n){return new Promise(((i,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),xn+=ft(t.data)):r&&(t.data.size?xn+=t.data.size:t.data instanceof FormData?xn+=function(e){let t=0;return/DingTalk/i.test(navigator.userAgent)&&e.realFormData&&(e=e.realFormData),e.forEach((e=>{t+="string"==typeof e?ft(e):e.size})),t+138}(t.data):xn+=ft(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,Un.request(t).then((e=>{"string"==typeof e.data?Vn+=ft(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?Vn+=e.data.byteLength:Vn+=ft(JSON.stringify(e.data)),n&&i({data:e.data,headers:e.headers}),i(e.data)})).catch((e=>{Un.isCancel(e)?o(new Fe(Ue.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?o(new Fe(Ue.NETWORK_TIMEOUT,e.message)):e.response?o(new Fe(Ue.NETWORK_RESPONSE_ERROR,e.response.status)):o(new Fe(Ue.NETWORK_ERROR,e.message))}))}))}async function Bn(e,t){const r=new Blob([t.data],{type:"buffer"});return await Fn(e,{...t,data:r,headers:{"Content-Type":"application/octet-stream"}},!0)}const jn=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;const t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-alpha\.([0-9]+)/);if(t&&t[1]&&t[2]){return`${t[1]}.${t[2]}`}const r=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-([0-9]+)/);if(r&&r[1]&&r[2]){return`${r[1]}.${r[2]}`}return"4.0.0.999"}("4.20.1-1"),Gn=function(){try{return!0===JSON.parse("true")}catch(e){return!0}}();var Hn;!function(e){e.Default="default",e.Auto="auto",e.Relay="relay",e.SdRtn="sd-rtn"}(Hn||(Hn={}));const Wn={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},Kn={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"],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",ENABLE_EVENT_REPORT:!0,GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",HTTP_CONNECT_TIMEOUT:5e3,SIGNAL_REQUEST_TIMEOUT:1e4,REPORT_STATS:!0,UPLOAD_LOG:!1,NOT_REPORT_EVENT:[],SUBSCRIBE_TWCC:!0,PUBLISH_TWCC:!1,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,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",TURN_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,PRELOAD_MEDIA_COUNT:0,USE_PUB_RTX:!0,USE_SUB_RTX:!0,USE_XR:!0,ENABLE_LOSSBASED_BWE:!0,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,ENABLE_PUBLISHED_USER_LIST:!0,MAX_SUBSCRIPTION:50,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_PORT:"",SHOW_VIDEO_INSPECT_WORKER_MESSAGE:!1,STATS_COLLECTOR_PORT:443,FORCE_TURN_TCP:!1,SUBSCRIBE_AUDIO_FILTER_TOPN:void 0,ENABLE_PUBLISH_AUDIO_FILTER:void 0,DISABLE_FEC:void 0,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,ICE_RESTART_INTERVAL:1e4,NEW_ICE_RESTART:!1,ENABLE_USER_LICENSE_CHECK:!0,SIGNAL_CHANNEL:0,TRANSMITTER_INITIAL_RTT:30,TRANSMITTER_INITIAL_RTO:30,TRANSMITTER_MAX_BATCH_ACK_COUNT:2,TRANSMITTER_MAX_RTO:500,DATACHANNEL_COMPRESS:!1,FINGERPRINT:null,DC_JOIN_WITH_FAILBACK:5e3,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,AP_AREA:!0,SVC:[],ENABLE_ENCODED_TRANSFORM:!1,ENABLE_VIDEO_SEI:!1,IMAGE_MODERATION_WORKER_HOST:"edge.agora.io",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,ENABLE_DATASTREAM_2:!1,DATASTREAM_MAX_RETRANSMITS:10,ENABLE_USER_AUTO_REBALANCE_CHECK:!0,ENABLE_INSTANT_VIDEO:!1,ENABLE_NTP_REPORT:!1,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,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:[],PLUGIN_INFO:[],OVERUSE_DETECTOR_PARAMS:Wn,ENABLE_AG_ADAPTATION:!0,AG_DEGRADATION_PREFERENCE:1};function zn(e,t,r){Object.keys(Kn).includes(e)&&(!r&&Object.keys(Xn).includes(e)||(Kn[e]=t,"ENABLE_VIDEO_SEI"===e&&!0===t&&(Kn.ENABLE_ENCODED_TRANSFORM=!0)))}function Yn(e){return Kn[e]}const Xn={};var Jn,Zn,qn;!function(e){e.SET_SESSION_ID="SET_SESSION_ID",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.AVOID_JOIN_START="AVOID_JOIN_START",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_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_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.SET_USE_DATACHANNEL="SET_USE_DATACHANNEL",e.SET_USE_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE"}(Jn||(Jn={})),function(e){e.h264="h264",e.h265="h265",e.vp8="vp8",e.vp9="vp9",e.av1="av1"}(Zn||(Zn={})),function(e){e.opus="opus",e.pcma="pcma",e.pcmu="pcmu",e.g722="g722"}(qn||(qn={}));const Qn=new class extends Ye{reportLogUploadError(e){this.emit("REPORT_LOG_UPLOAD",e)}};class $n{logger;prefixLists=[];constructor(e){this.logger=e}debug(...e){this.logger.debug(...this.prefixLists,...e)}info(...e){this.logger.info(...this.prefixLists,...e)}warning(...e){this.logger.warning(...this.prefixLists,...e)}error(...e){this.logger.error(...this.prefixLists,...e)}prefix(e){return this.prefixLists.push(e),this}popPrefix(){return this.prefixLists.pop(),this}}function ei(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}function ti(){const e=new Date,t=/((\d+:){2}\d+)/.exec((new Date).toUTCString());return t?t?.[0]+":"+e.getUTCMilliseconds():e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}const ri={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},ni=Date.now(),ii=e=>{for(const t in ri)if(Object.prototype.hasOwnProperty.call(ri,t)&&ri[t]===e)return t;return"DEFAULT"};const oi=new class{proxyServerURL;logLevel=ri.DEBUG;uploadState="collecting";uploadLogWaitingList=[];uploadLogUploadingList=[];uploadErrorCount=0;currentLogID=0;url;constructor(){}debug(...e){const t=[ri.DEBUG].concat(e);this.log.apply(this,t)}info(...e){const t=[ri.INFO].concat(e);this.log.apply(this,t)}warning(...e){const t=[ri.WARNING].concat(e);this.log.apply(this,t)}warn(...e){this.warning(...e)}error(...e){const t=[ri.ERROR].concat(e);this.log.apply(this,t)}upload(...e){const t=[ri.DEBUG].concat(e);this.uploadLog.apply(this,t)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){zn("UPLOAD_LOG",!0)}disableLogUpload(){zn("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new $n(this).prefix(e)}log(...e){if(Date.now()-ni<100)return void setTimeout((()=>{this.log(...e)}),Date.now()-ni);const t=Math.max(0,Math.min(4,e[0]));if(e[0]=ei()+` Agora-SDK [${ii(t)}]:`,this.appendLogToWaitingList(t,...e),t<this.logLevel)return;const r=ei()+` %cAgora-SDK [${ii(t)}]:`;let n=[];if(!Yn("USE_NEW_LOG"))switch(t){case ri.DEBUG:n=[r,"color: #64B5F6;"].concat(e.slice(1)),console.log.apply(console,n);break;case ri.INFO:n=[r,"color: #1E88E5; font-weight: bold;"].concat(e.slice(1)),console.log.apply(console,n);break;case ri.WARNING:n=[r,"color: #FB8C00; font-weight: bold;"].concat(e.slice(1)),console.warn.apply(console,n);break;case ri.ERROR:n=[r,"color: #B00020; font-weight: bold;"].concat(e.slice(1)),console.error.apply(console,n)}}uploadLog(...e){if(Date.now()-ni<100)return void setTimeout((()=>{this.uploadLog(...e)}),Date.now()-ni);const t=Math.max(0,Math.min(4,e[0]));e[0]=ei()+` Agora-SDK [${ii(t)}]:`,this.appendLogToWaitingList(t,...e)}appendLogToWaitingList(e,...t){if(!Yn("UPLOAD_LOG"))return;Array.isArray(t[0])?t[0][0]=ti()+` Agora-SDK [${ii(e)}]:`:t[0]=ti()+` Agora-SDK [${ii(e)}]:`;let r="";t.forEach((e=>{"object"==typeof e&&(e=JSON.stringify(e)),r+=`${e} `})),this.uploadLogWaitingList.push({payload_str:r,log_level:e,log_item_id:this.currentLogID++}),"uploading"===this.uploadState&&0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}startUpload(){this.uploadState="uploading",0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}async uploadLogs(){const e=this.uploadLogUploadingList,t={sdk_version:jn,process_id:Yn("PROCESS_ID"),payload:JSON.stringify(e)};return wt((async()=>{const e=await Un.post(this.url||(this.proxyServerURL?`https://${this.proxyServerURL}/ls/?h=${Yn("LOG_UPLOAD_SERVER")}&p=443&d=upload/v1`:`https://${Yn("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)),(e=>(e.response?Qn.reportLogUploadError({status:e.response.status,data:e.response.data,headers:e.response.headers,message:e.message}):e.request?Qn.reportLogUploadError({status:e.request.status,message:e.message}):Qn.reportLogUploadError({status:-1,message:e.message}),!0)),{timeout:Yn("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:Yn("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,Yn("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),Yn("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),Yn("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),Yn("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}extLog=(e,t)=>{this.appendLogToWaitingList(e,...t)}};var ai;!function(e){e.FREE="free",e.UPLOADING="uploading"}(ai||(ai={}));const si={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};var ci,di,ui,li;!function(e){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.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.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"}(ci||(ci={})),function(e){e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",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.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"}(di||(di={})),function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}(ui||(ui={})),function(e){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"}(li||(li={}));class hi{static __CLIENT_LIST__=[];baseInfoMap=new Map;proxyServer;eventUploadTimer;setSessionIdTimer;url;backupUrl;_appId;keyEventUploadPendingItems=[];normalEventUploadPendingItems=[];apiInvokeUploadPendingItems=[];apiInvokeCount=0;ltsList=[];lastSendNormalEventTime=Date.now();customReportCounterTimer;customReportCount=0;constructor(){this.eventUploadTimer=window.setInterval(this.doSend.bind(this),Yn("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),Yn("EVENT_REPORT_SEND_INTERVAL"))}getBaseInfoBySessionId(e){return this.baseInfoMap.get(e)}adjustSessionStartTime(e){if(!this.baseInfoMap.has(e)&&!this.baseInfoMap.get(e))return void oi.error(`adjust session ${e} start time, sid is not exist or info is undefined`);const t=this.baseInfoMap.get(e),r=Date.now(),n=t.startTime;t.startTime=r,oi.debug(`rewrite session ${e} startTime: ${r} , ${r-n}ms`),this.baseInfoMap.set(e,t)}setAppId(e){this._appId=e}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=()=>({tag:t.tag,invokeId:i,sid:e,name:t.name,apiInvokeTime:n,options:t.options,states:t.states||null}),a=!!Yn("SHOW_REPORT_INVOKER_LOG");a&&oi.info(`${t.name} start`,t.options);let s=!1;Et(t.timeout).then((()=>{s||(this.sendApiInvoke({...o(),error:Ue.API_INVOKE_TIMEOUT,success:!1}),oi.debug(`${t.name} timeout`))}));const c=new Fe(Ue.UNEXPECTED_ERROR,`${t.name}: this api invoke is end`);return{onSuccess:e=>{const n=()=>{if(s)throw c;return s=!0,this.sendApiInvoke({...o(),success:!0,...t.reportResult&&{result:e}}),a&&oi.info(`${t.name} onSuccess`),e};return r?St(n,t.name+"Success",r,(()=>s=!0)):n()},onError:e=>{const n=()=>{if(s)throw e;s=!0,this.sendApiInvoke({...o(),success:!1,error:e}),a&&oi.info(`${t.name} onFailure`,e.toString())};return r?St(n,t.name+"Error",r,(()=>s=!0)):n()}}}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),n=this.createBaseInfo(e,r);n.cname=t.cname;const i=Object.assign({},{willUploadConsoleLog:Yn("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:Gn?"global":"oversea",areas:Yn("AREAS")&&Yn("AREAS").join(",")},t.extend),{stringUid:o,channelProfile:a,channelMode:s,isABTestSuccess:c,lsid:d,clientRole:u}=t,l=Date.now(),h={...n,eventType:ci.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,build:"v4.20.1-1-0-g8123837f-dirty(3/5/2024, 3:03:53 PM)",lts:l,elapse:l-r,extend:JSON.stringify(i),mode:t.mode,process:Yn("PROCESS_ID"),appType:Yn("APP_TYPE"),success:!0,version:jn,stringUid:o,channelProfile:a,channelMode:s,isABTestSuccess:c,lsid:d,clientType:20,clientRole:u,serviceId:Yn("PROCESS_ID"),extensionID:Yn("PLUGIN_INFO").join(",")||""};this.send({type:di.SESSION,data:h},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o={...n,eventType:ci.JOIN_CHOOSE_SERVER,lts:i,eventElapse: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};this.send({type:di.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={...n,eventType:ci.REQ_USER_ACCOUNT,lts:i,success:t.success,serverAddress:t.serverAddr,stringUid:t.stringUid,uid:t.uid,errorCode:t.errorCode,elapse:i-r.startTime,eventElapse:i-t.lts,extend:JSON.stringify(t.extend)};this.send({type:di.REQ_USER_ACCOUNT,data:o},!0)}joinGateway(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info;t.vid&&(n.vid=t.vid),n.uid=t.uid,n.cid=t.cid;const i=Date.now(),{firstSuccess:o,avoidJoinStartTime:a,isProxy:s,addr:c}=t,d=i-(o&&a?a:r.startTime),u={...n,eventType:ci.JOIN_GATEWAY,lts:i,gatewayAddr:t.addr,success:t.succ,errorCode:t.ec,elapse:d,eventElapse:i-t.lts,firstSuccess:o,signalChannel:t.signalChannel},l=u.success?1:0;if(t.succ&&(r.lastJoinSuccessTime=i),o)this.send({type:di.JOIN_GATEWAY,data:u},!0);else{let e;if(c)if(s){const t=c.match(/h=(\d{1,3}-){3}\d{1,3}/g),r=c.match(/p=[0-9]{1,6}/g);e={isSuccess:l,gatewayIp:t&&t.length?t[0].split("=")[1].replace(/-/g,"."):"",port:r&&r.length?r[0].split("=")[1]:"",isProxy:s?1:0}}else{const t=c.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),r=c.match(/(:|p=)[0-9]{1,6}/g);e={isSuccess:l,gatewayIp:t&&t.length?t[0].split("//")[1].replace(/-/g,"."):"",port:r&&r.length?r[0].split(/:|p=/g)[1]:"",isProxy:s?1:0}}else e={isSuccess:l,gatewayIp:"",port:"",isProxy:s?1:0};delete u.success,delete u.eventType,delete u.firstSuccess,u.vid=Number(u.vid);const t=Object.assign({},u,e,{eventType:ci.REJOIN_GATEWAY});this.send({type:di.RE_JOIN_GATEWAY,data:t},!0)}}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=Date.now(),i={...r.info,lts:n,timeout:t,elapse:n-r.startTime};this.send({type:di.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={...n,eventType:ci.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:di.PUBLISH,data:o},!0)}subscribe(e,t,r){const n=this.baseInfoMap.get(e);if(!n)return;const i=n.info,o=Date.now(),a={...i,eventType:ci.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,...r&&{extend:JSON.stringify({isMassSubscribe:!0})}};"string"==typeof t.peerid?a.peerSuid=t.peerid:a.peer=t.peerid,this.send({type:di.SUBSCRIBE,data:a},!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(),a={...i,eventType:ci.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-n.startTime,status:e.status?1:2};this.send({type:di.WS_COMPRESSOR_INIT,data:a},!0)}firstRemoteVideoDecode(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,a=Date.now(),s={...o,...n,elapse:a-i.startTime,eventType:t,lts:a,firstDecodeFrame:Math.max(a-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:s},!0)}firstRemoteFrame(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,a=Date.now(),s={...o,...n,elapse:a-i.startTime,eventType:t,lts:a};this.send({type:r,data:s},!0)}pcStats(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o={...n,...t,vid:void 0===n.vid?0:Number(n.vid),elapse:i-r.startTime,eventType:ci.PC_STATS,lts:i};this.send({type:di.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={...n,...t,vid:void 0===n.vid?0:Number(n.vid),eventType:ci.UPDATE_REMOTE_RTPCAPABILITIES,lts:i};this.send({type:di.UPDATE_REMOTE_RTPCAPABILITIES,data:o},!0)}}onGatewayStream(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o={...i.info,...n,eventType:t,lts:Date.now()};this.send({type:r,data:o},!0)}streamSwitch(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o={...n,eventType:ci.STREAM_SWITCH,lts:i,isDual:t.isdual,elapse:i-r.startTime,success:t.succ};this.send({type:di.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={...n,eventType:ci.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:di.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={...n,eventType:ci.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:di.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?oi.debug(`reportProxyServerurl: ${e}`):oi.debug(`disable reportProxyServerurl: ${e}`)}peerPublishStatus(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o={...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:di.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(),o=function(e,t,r){const n=e[t];if(!n||"string"!=typeof n)return[e];e[t]="";const i=ft(JSON.stringify(e));let o=0;const a=[];let s=0;for(let c=0;c<n.length;c++)s+=n.charCodeAt(c)<=127?1:3,s<=r-i||(a[a.length]={...e,[t]:n.substring(o,c)},o=c,s=n.charCodeAt(c)<=127?1:3);return o!==n.length-1&&(a[a.length]={...e,[t]:n.substring(o)}),a}({...n,...t,elapse:i-r.startTime,lts:i,productType:"WebRTC"},"payload",1300);o.forEach((e=>this.send({type:di.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={...n,...t,elapse:i-r.startTime,lts:i};this.send({type:di.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={...n,...t,elapse:i-r.startTime,lts:i,extend:t.extend||void 0};this.send({type:di.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={...n,...t,elapse:i-r.startTime,lts:i};this.send({type:di.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>Yn("CUSTOM_REPORT_LIMIT"))throw new Fe(Ue.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval((()=>{this.customReportCount=0}),5e3));const r=Date.now(),n=t.map((t=>({type:di.USER_ANALYTICS,data:{sid:e,...t,lts:r}})));try{Yn("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(n):await this.postDataToStatsCollector(n)}catch(e){throw oi.error("send custom report message failed",e.toString()),new Fe(Ue.CUSTOM_REPORT_SEND_FAILED,e.message)}}sendApiInvoke(e){const t=Yn("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{cname:n,uid:i,cid:o}=r.info;let a;if(e.lts=e.lts||Date.now(),e.error)if(e.error instanceof Fe){const{code:t,message:r}=e.error;a=t||(r||e.error.toString())}else a=e.error.toString();const s={invokeId:e.invokeId,sid:e.sid,cname:n,cid:o,uid:i,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:di.API_INVOKE,data:s},!1),!0}appendSessionId(){hi.__CLIENT_LIST__.forEach((e=>{if(e._sessionId){const t=this.apiInvokeUploadPendingItems.length;for(let r=0;r<t;r++){const t=this.apiInvokeUploadPendingItems.shift();t&&(t.sid=e._sessionId,this.sendApiInvoke(Object.assign({},t)))}}}))}send(e,t){if(t)return this.keyEventUploadPendingItems.push(e),void this.sendItems(this.keyEventUploadPendingItems,!0);this.normalEventUploadPendingItems.push(e),this.normalEventUploadPendingItems.length>Yn("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)));t||(this.lastSendNormalEventTime=Date.now());return Yn("ENABLE_EVENT_REPORT")?(r.length&&(Yn("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{Yn("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>Yn("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-Yn("NORMAL_EVENT_QUEUE_CAPACITY")),oi.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){ct.networkState===nt.OFFLINE&&await Promise.race([ct.onlineWaiter,Et(2*Ct.maxRetryTimeout)]);const t=e=>{let t=new Uint8Array;return e.forEach((e=>{const r=(n=JSON.stringify(e.data),(new TextEncoder).encode(n));var n;const i=new ArrayBuffer(5),o=(e=>{let t=0;return Object.entries(di).forEach((([r,n])=>{n===e.type&&(t=EventNameToID[r])})),t})(e),a=new DataView(i);a.setUint16(0,r.byteLength,!0),a.setUint8(2,255&o),a.setUint8(3,o>>>8&255),a.setUint8(4,o>>>16&255),t=ze(t,new Uint8Array(i)),t=ze(t,r)})),t},r="event";let n=this.proxyServer?`https://${this.proxyServer}/rs/?h=${Yn("NEW_REPORT_SERVER_DOMAINS")[0]}&p=443&d=${r}`:`https://${Yn("NEW_REPORT_SERVER_DOMAINS")[0]}/${r}`;for(let i=0;i<2;i+=1){1===i&&(n=this.proxyServer?`https://${this.proxyServer}/rs/?h=${Yn("NEW_REPORT_SERVER_DOMAINS")[1]}&p=443&d=${r}`:`https://${Yn("NEW_REPORT_SERVER_DOMAINS")[1]}/${r}`);try{await Fn(n,{timeout:1e4,data:t(e),headers:{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,t=!1){const r={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:e.map((e=>JSON.stringify(e))),vid:(e=>{const t=e&&e.data.sid&&this.baseInfoMap.get(e.data.sid);return t&&t.info.vid&&+t.info.vid||0})(e[0])};ct.networkState===nt.OFFLINE&&await Promise.race([ct.onlineWaiter,Et(2*Ct.maxRetryTimeout)]);const n=t?"/events/proto-raws":"/events/messages";let i=this.url||(this.proxyServer?`https://${this.proxyServer}/rs/?h=${Yn("EVENT_REPORT_DOMAIN")}&p=${Yn("STATS_COLLECTOR_PORT")}&d=${n}`:`https://${Yn("EVENT_REPORT_DOMAIN")}:${Yn("STATS_COLLECTOR_PORT")}${n}`);for(let e=0;e<2;e+=1){1===e&&(i=this.backupUrl||(this.proxyServer?`https://${this.proxyServer}/rs/?h=${Yn("EVENT_REPORT_BACKUP_DOMAIN")}&p=${Yn("STATS_COLLECTOR_PORT")}&d=${n}`:`https://${Yn("EVENT_REPORT_BACKUP_DOMAIN")}:${Yn("STATS_COLLECTOR_PORT")}${n}`));try{t?await Bn(i,{timeout:1e4,data:r}):await Fn(i,{timeout:1e4,data:r})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},si);return r.sid=e,this.baseInfoMap.set(e,{info:r,startTime:t}),r}reportResourceTiming(e,t){const r=performance.getEntriesByName(e),n=r[r.length-1];n&&this.reportApiInvoke(t,{name:"Client.resourceTiming",options:n,tag:Qe.TRACER}).onSuccess()}extApiInvoke=async e=>{for(const t of e){const e={...t,sid:null,invokeId:++this.apiInvokeCount,tag:Qe.TRACER};this.sendApiInvoke(e)}}}function pi(e={}){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(...t){let n=t;if(e.argsMap)try{n=e.argsMap(this,...t)}catch(e){oi.warning(e),n=[]}try{JSON.stringify(n)}catch(e){oi.warning(`arguments for method ${o}.${String(r)} not serializable for apiInvoke.`),n=[]}const a=(e.report||_i).reportApiInvoke(this._sessionId||null,{name:`${o}.${String(r)}`,options:n,tag:Qe.TRACER,reportResult:e.reportResult},e.throttleTime);try{const r=i.apply(this,t);return r instanceof Promise?r.then((t=>(a.onSuccess(e.reportResult&&t),t))).catch((e=>{throw a.onError(e),e})):(a.onSuccess(e.reportResult&&r),r)}catch(e){throw a.onError(e),e}}}return n}}const _i=new hi;Qn.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=ct.networkState,_i.reportApiInvoke(null,{name:"logUploadError",options:e,tag:Qe.TRACER})}));const fi={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};function Ei(){const e=fe();fi.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),fi.getStreamFromExtension=e.name===de.CHROME&&Number(e.version)>34,fi.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}(),fi.supportMinBitrate=e.name===de.CHROME||e.name===de.EDGE,fi.supportSetRtpSenderParameters=function(){const e=fe();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!Pe()||(!(!ve()&&!ge())||e.name===de.FIREFOX&&Number(e.version)>=64)}(),e.name===de.SAFARI&&(Number(e.version)>=14?fi.supportDualStream=!0:fi.supportDualStream=!1),fi.webAudioMediaStreamDest=function(){const e=fe();if(e.name===de.SAFARI&&Number(e.version)<12)return!1;return!0}(),fi.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),fi.supportWebGL="undefined"!=typeof WebGLRenderingContext,fi.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,Pe()||(fi.webAudioWithAEC=!0),fi.supportShareAudio=function(){const e=fe();if((e.os===ce.WIN_10||e.os===ce.WIN_81||e.os===ce.WIN_7||e.os===ce.LINUX||e.os===ce.MAC_OS||e.os===ce.CHROMIUM_OS)&&e.name===de.CHROME&&Number(e.version)>=74)return!0;return!1}(),fi.supportDataChannel=function(){if(Ae(76)||function(e){const t=fe();return!(t.name!==de.FIREFOX||!t.osVersion)&&Number(t.version)>=e}(68)||Ie(14))return!0;return!1}(),fi.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!Re()&&!!e&&e.prototype.setConfiguration instanceof Function}(),fi.supportWebRTCEncodedTransform=function(){const e=fe();return"Chrome"===e.name&&Number(e.version)>=86||"Safari"===e.name&&Number(e.version)>=15}(),fi.supportWebRTCInsertableStream=function(){const e=fe();return(e.name===de.CHROME||e.name===de.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),ut((()=>{fi.supportDualStreamEncoding=function(){const e=fe();if(Yn("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&Yn("CHROME_DUAL_STREAM_USE_ENCODING"))}(),oi.info("browser compatibility",JSON.stringify(fi),JSON.stringify(e))}))}function mi(){return fi}var Ti;e.AUDIO_CONTEXT_EVENT=void 0,(Ti=e.AUDIO_CONTEXT_EVENT||(e.AUDIO_CONTEXT_EVENT={})).IOS_15_16_INTERRUPTION_START="ios15_16-interruption-start",Ti.IOS_15_16_INTERRUPTION_END="ios15_16-interruption-end",Ti.IOS_INTERRUPTION_START="ios-interruption-start",Ti.IOS_INTERRUPTION_END="ios-interruption-end",Ti.STATE_CHANGE="state-change";var gi=function(e){try{return!!e()}catch(e){return!0}},Si=!gi((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),vi=Si,Ri=Function.prototype,yi=Ri.call,Ai=vi&&Ri.bind.bind(yi,yi),bi=vi?Ai:function(e){return function(){return yi.apply(e,arguments)}},Ii=bi({}.isPrototypeOf),Oi=function(e){return e&&e.Math==Math&&e},Ci=Oi("object"==typeof globalThis&&globalThis)||Oi("object"==typeof window&&window)||Oi("object"==typeof self&&self)||Oi("object"==typeof X&&X)||function(){return this}()||X||Function("return this")(),wi=Si,Ni=Function.prototype,ki=Ni.apply,Di=Ni.call,Pi="object"==typeof Reflect&&Reflect.apply||(wi?Di.bind(ki):function(){return Di.apply(ki,arguments)}),Li=bi,Mi=Li({}.toString),Ui=Li("".slice),xi=function(e){return Ui(Mi(e),8,-1)},Vi=xi,Fi=bi,Bi=function(e){if("Function"===Vi(e))return Fi(e)},ji="object"==typeof document&&document.all,Gi={all:ji,IS_HTMLDDA:void 0===ji&&void 0!==ji},Hi=Gi.all,Wi=Gi.IS_HTMLDDA?function(e){return"function"==typeof e||e===Hi}:function(e){return"function"==typeof e},Ki={},zi=!gi((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Yi=Si,Xi=Function.prototype.call,Ji=Yi?Xi.bind(Xi):function(){return Xi.apply(Xi,arguments)},Zi={},qi={}.propertyIsEnumerable,Qi=Object.getOwnPropertyDescriptor,$i=Qi&&!qi.call({1:2},1);Zi.f=$i?function(e){var t=Qi(this,e);return!!t&&t.enumerable}:qi;var eo,to,ro=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},no=gi,io=xi,oo=Object,ao=bi("".split),so=no((function(){return!oo("z").propertyIsEnumerable(0)}))?function(e){return"String"==io(e)?ao(e,""):oo(e)}:oo,co=function(e){return null==e},uo=co,lo=TypeError,ho=function(e){if(uo(e))throw lo("Can't call method on "+e);return e},po=so,_o=ho,fo=function(e){return po(_o(e))},Eo=Wi,mo=Gi.all,To=Gi.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:Eo(e)||e===mo}:function(e){return"object"==typeof e?null!==e:Eo(e)},go={},So=go,vo=Ci,Ro=Wi,yo=function(e){return Ro(e)?e:void 0},Ao=function(e,t){return arguments.length<2?yo(So[e])||yo(vo[e]):So[e]&&So[e][t]||vo[e]&&vo[e][t]},bo="undefined"!=typeof navigator&&String(navigator.userAgent)||"",Io=Ci,Oo=bo,Co=Io.process,wo=Io.Deno,No=Co&&Co.versions||wo&&wo.version,ko=No&&No.v8;ko&&(to=(eo=ko.split("."))[0]>0&&eo[0]<4?1:+(eo[0]+eo[1])),!to&&Oo&&(!(eo=Oo.match(/Edge\/(\d+)/))||eo[1]>=74)&&(eo=Oo.match(/Chrome\/(\d+)/))&&(to=+eo[1]);var Do=to,Po=Do,Lo=gi,Mo=Ci.String,Uo=!!Object.getOwnPropertySymbols&&!Lo((function(){var e=Symbol();return!Mo(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Po&&Po<41})),xo=Uo&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Vo=Ao,Fo=Wi,Bo=Ii,jo=Object,Go=xo?function(e){return"symbol"==typeof e}:function(e){var t=Vo("Symbol");return Fo(t)&&Bo(t.prototype,jo(e))},Ho=String,Wo=function(e){try{return Ho(e)}catch(e){return"Object"}},Ko=Wi,zo=Wo,Yo=TypeError,Xo=function(e){if(Ko(e))return e;throw Yo(zo(e)+" is not a function")},Jo=Xo,Zo=co,qo=function(e,t){var r=e[t];return Zo(r)?void 0:Jo(r)},Qo=Ji,$o=Wi,ea=To,ta=TypeError,ra={exports:{}},na=Ci,ia=Object.defineProperty,oa=function(e,t){try{ia(na,e,{value:t,configurable:!0,writable:!0})}catch(r){na[e]=t}return t},aa="__core-js_shared__",sa=Ci[aa]||oa(aa,{}),ca=sa;(ra.exports=function(e,t){return ca[e]||(ca[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.31.1",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var da=ra.exports,ua=ho,la=Object,ha=function(e){return la(ua(e))},pa=ha,_a=bi({}.hasOwnProperty),fa=Object.hasOwn||function(e,t){return _a(pa(e),t)},Ea=bi,ma=0,Ta=Math.random(),ga=Ea(1..toString),Sa=function(e){return"Symbol("+(void 0===e?"":e)+")_"+ga(++ma+Ta,36)},va=da,Ra=fa,ya=Sa,Aa=Uo,ba=xo,Ia=Ci.Symbol,Oa=va("wks"),Ca=ba?Ia.for||Ia:Ia&&Ia.withoutSetter||ya,wa=function(e){return Ra(Oa,e)||(Oa[e]=Aa&&Ra(Ia,e)?Ia[e]:Ca("Symbol."+e)),Oa[e]},Na=Ji,ka=To,Da=Go,Pa=qo,La=function(e,t){var r,n;if("string"===t&&$o(r=e.toString)&&!ea(n=Qo(r,e)))return n;if($o(r=e.valueOf)&&!ea(n=Qo(r,e)))return n;if("string"!==t&&$o(r=e.toString)&&!ea(n=Qo(r,e)))return n;throw ta("Can't convert object to primitive value")},Ma=TypeError,Ua=wa("toPrimitive"),xa=function(e,t){if(!ka(e)||Da(e))return e;var r,n=Pa(e,Ua);if(n){if(void 0===t&&(t="default"),r=Na(n,e,t),!ka(r)||Da(r))return r;throw Ma("Can't convert object to primitive value")}return void 0===t&&(t="number"),La(e,t)},Va=Go,Fa=function(e){var t=xa(e,"string");return Va(t)?t:t+""},Ba=To,ja=Ci.document,Ga=Ba(ja)&&Ba(ja.createElement),Ha=function(e){return Ga?ja.createElement(e):{}},Wa=Ha,Ka=!zi&&!gi((function(){return 7!=Object.defineProperty(Wa("div"),"a",{get:function(){return 7}}).a})),za=zi,Ya=Ji,Xa=Zi,Ja=ro,Za=fo,qa=Fa,Qa=fa,$a=Ka,es=Object.getOwnPropertyDescriptor;Ki.f=za?es:function(e,t){if(e=Za(e),t=qa(t),$a)try{return es(e,t)}catch(e){}if(Qa(e,t))return Ja(!Ya(Xa.f,e,t),e[t])};var ts=gi,rs=Wi,ns=/#|\.prototype\./,is=function(e,t){var r=as[os(e)];return r==cs||r!=ss&&(rs(t)?ts(t):!!t)},os=is.normalize=function(e){return String(e).replace(ns,".").toLowerCase()},as=is.data={},ss=is.NATIVE="N",cs=is.POLYFILL="P",ds=is,us=Xo,ls=Si,hs=Bi(Bi.bind),ps=function(e,t){return us(e),void 0===t?e:ls?hs(e,t):function(){return e.apply(t,arguments)}},_s={},fs=zi&&gi((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Es=To,ms=String,Ts=TypeError,gs=function(e){if(Es(e))return e;throw Ts(ms(e)+" is not an object")},Ss=zi,vs=Ka,Rs=fs,ys=gs,As=Fa,bs=TypeError,Is=Object.defineProperty,Os=Object.getOwnPropertyDescriptor,Cs="enumerable",ws="configurable",Ns="writable";_s.f=Ss?Rs?function(e,t,r){if(ys(e),t=As(t),ys(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Ns in r&&!r[Ns]){var n=Os(e,t);n&&n[Ns]&&(e[t]=r.value,r={configurable:ws in r?r[ws]:n[ws],enumerable:Cs in r?r[Cs]:n[Cs],writable:!1})}return Is(e,t,r)}:Is:function(e,t,r){if(ys(e),t=As(t),ys(r),vs)try{return Is(e,t,r)}catch(e){}if("get"in r||"set"in r)throw bs("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var ks=_s,Ds=ro,Ps=zi?function(e,t,r){return ks.f(e,t,Ds(1,r))}:function(e,t,r){return e[t]=r,e},Ls=Ci,Ms=Pi,Us=Bi,xs=Wi,Vs=Ki.f,Fs=ds,Bs=go,js=ps,Gs=Ps,Hs=fa,Ws=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 Ms(e,this,arguments)};return t.prototype=e.prototype,t},Ks=function(e,t){var r,n,i,o,a,s,c,d,u,l=e.target,h=e.global,p=e.stat,_=e.proto,f=h?Ls:p?Ls[l]:(Ls[l]||{}).prototype,E=h?Bs:Bs[l]||Gs(Bs,l,{})[l],m=E.prototype;for(o in t)n=!(r=Fs(h?o:l+(p?".":"#")+o,e.forced))&&f&&Hs(f,o),s=E[o],n&&(c=e.dontCallGetSet?(u=Vs(f,o))&&u.value:f[o]),a=n&&c?c:t[o],n&&typeof s==typeof a||(d=e.bind&&n?js(a,Ls):e.wrap&&n?Ws(a):_&&xs(a)?Us(a):a,(e.sham||a&&a.sham||s&&s.sham)&&Gs(d,"sham",!0),Gs(E,o,d),_&&(Hs(Bs,i=l+"Prototype")||Gs(Bs,i,{}),Gs(Bs[i],o,a),e.real&&m&&(r||!m[o])&&Gs(m,o,a)))},zs=Math.ceil,Ys=Math.floor,Xs=Math.trunc||function(e){var t=+e;return(t>0?Ys:zs)(t)},Js=function(e){var t=+e;return t!=t||0===t?0:Xs(t)},Zs=Js,qs=Math.max,Qs=Math.min,$s=function(e,t){var r=Zs(e);return r<0?qs(r+t,0):Qs(r,t)},ec=Js,tc=Math.min,rc=function(e){return e>0?tc(ec(e),9007199254740991):0},nc=function(e){return rc(e.length)},ic=fo,oc=$s,ac=nc,sc=function(e){return function(t,r,n){var i,o=ic(t),a=ac(o),s=oc(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},cc={includes:sc(!0),indexOf:sc(!1)},dc=cc.includes;Ks({target:"Array",proto:!0,forced:gi((function(){return!Array(1).includes()}))},{includes:function(e){return dc(this,e,arguments.length>1?arguments[1]:void 0)}});var uc=go,lc=function(e){return uc[e+"Prototype"]},hc=lc("Array").includes,pc=To,_c=xi,fc=wa("match"),Ec=function(e){var t;return pc(e)&&(void 0!==(t=e[fc])?!!t:"RegExp"==_c(e))},mc=TypeError,Tc={};Tc[wa("toStringTag")]="z";var gc="[object z]"===String(Tc),Sc=gc,vc=Wi,Rc=xi,yc=wa("toStringTag"),Ac=Object,bc="Arguments"==Rc(function(){return arguments}()),Ic=Sc?Rc: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=Ac(e),yc))?r:bc?Rc(t):"Object"==(n=Rc(t))&&vc(t.callee)?"Arguments":n},Oc=Ic,Cc=String,wc=function(e){if("Symbol"===Oc(e))throw TypeError("Cannot convert a Symbol value to a string");return Cc(e)},Nc=wa("match"),kc=Ks,Dc=function(e){if(Ec(e))throw mc("The method doesn't accept regular expressions");return e},Pc=ho,Lc=wc,Mc=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Nc]=!1,"/./"[e](t)}catch(e){}}return!1},Uc=bi("".indexOf);kc({target:"String",proto:!0,forced:!Mc("includes")},{includes:function(e){return!!~Uc(Lc(Pc(this)),Lc(Dc(e)),arguments.length>1?arguments[1]:void 0)}});var xc=lc("String").includes,Vc=Ii,Fc=hc,Bc=xc,jc=Array.prototype,Gc=String.prototype,Hc=J((function(e){var t=e.includes;return e===jc||Vc(jc,e)&&t===jc.includes?Fc:"string"==typeof e||e===Gc||Vc(Gc,e)&&t===Gc.includes?Bc:t}));function Wc(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function Kc(e,t,r,n,i){return{width:e,height:t,frameRate:r,bitrateMin:n,bitrateMax:i}}function zc(e,t,r,n,i){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:n,bitrateMax:i}}function Yc(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const Xc={"90p":Kc(160,90),"90p_1":Kc(160,90),"120p":Kc(160,120,15,30,65),"120p_1":Kc(160,120,15,30,65),"120p_3":Kc(120,120,15,30,50),"120p_4":Kc(212,120),"180p":Kc(320,180,15,30,140),"180p_1":Kc(320,180,15,30,140),"180p_3":Kc(180,180,15,30,100),"180p_4":Kc(240,180,15,30,120),"240p":Kc(320,240,15,40,200),"240p_1":Kc(320,240,15,40,200),"240p_3":Kc(240,240,15,40,140),"240p_4":Kc(424,240,15,40,220),"360p":Kc(640,360,15,80,400),"360p_1":Kc(640,360,15,80,400),"360p_3":Kc(360,360,15,80,260),"360p_4":Kc(640,360,30,80,600),"360p_6":Kc(360,360,30,80,400),"360p_7":Kc(480,360,15,80,320),"360p_8":Kc(480,360,30,80,490),"360p_9":Kc(640,360,15,80,800),"360p_10":Kc(640,360,24,80,800),"360p_11":Kc(640,360,24,80,1e3),"480p":Kc(640,480,15,100,500),"480p_1":Kc(640,480,15,100,500),"480p_2":Kc(640,480,30,100,1e3),"480p_3":Kc(480,480,15,100,400),"480p_4":Kc(640,480,30,100,750),"480p_6":Kc(480,480,30,100,600),"480p_8":Kc(848,480,15,100,610),"480p_9":Kc(848,480,30,100,930),"480p_10":Kc(640,480,10,100,400),"720p":Kc(1280,720,15,120,1130),"720p_auto":Kc(1280,720,30,900,3e3),"720p_1":Kc(1280,720,15,120,1130),"720p_2":Kc(1280,720,30,120,2e3),"720p_3":Kc(1280,720,30,120,1710),"720p_5":Kc(960,720,15,120,910),"720p_6":Kc(960,720,30,120,1380),"1080p":Kc(1920,1080,15,120,2080),"1080p_1":Kc(1920,1080,15,120,2080),"1080p_2":Kc(1920,1080,30,120,3e3),"1080p_3":Kc(1920,1080,30,120,3150),"1080p_5":Kc(1920,1080,60,120,4780),"1440p":Kc(2560,1440,30,120,4850),"1440p_1":Kc(2560,1440,30,120,4850),"1440p_2":Kc(2560,1440,60,120,7350),"4k":Kc(3840,2160,30,120,8910),"4k_1":Kc(3840,2160,30,120,8910),"4k_3":Kc(3840,2160,60,120,13500)},Jc=[{scaleResolutionDownBy:2,width:1280,height:720,frameRate:30,bitrateMin:300,bitrateMax:900},{scaleResolutionDownBy:1.333333,width:1280,height:720,frameRate:30,bitrateMin:600,bitrateMax:2e3},{scaleResolutionDownBy:1,width:1280,height:720,frameRate:30,bitrateMin:900,bitrateMax:3e3}],Zc={"480p":zc(640,480,5),"480p_1":zc(640,480,5),"480p_2":zc(640,480,30),"480p_3":zc(640,480,15),"720p":zc(1280,720,5),"720p_auto":Kc(1280,720,30,900,3e3),"720p_1":zc(1280,720,5),"720p_2":zc(1280,720,30),"720p_3":zc(1280,720,15),"1080p":zc(1920,1080,5),"1080p_1":zc(1920,1080,5),"1080p_2":zc(1920,1080,30),"1080p_3":zc(1920,1080,15)},qc={"1SL1TL":Yc(1,1),"3SL3TL":Yc(3,3),"2SL3TL":Yc(2,3)};function Qc(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},Xc[e]):e}function $c(e){return"string"==typeof e?Object.assign({},Zc[e]):e}function ed(e){return"string"==typeof e?Object.assign({},qc[e]):e}const td={speech_low_quality:Wc(16e3,!1),speech_standard:Wc(32e3,!1,18),music_standard:Wc(48e3,!1),standard_stereo:Wc(48e3,!0,56),high_quality:Wc(48e3,!1,128),high_quality_stereo:Wc(48e3,!0,192)};function rd(e){return"string"==typeof e?Object.assign({},td[e]):e}const nd=[];function id(e){Hc(nd).call(nd,e)||nd.push(e)}function od(e){const t=nd.indexOf(e);-1!==t&&nd.splice(t,1)}function ad(e){return He(e.width,"config.width"),He(e.height,"config.height"),void 0!==e.frameRate&&He(e.frameRate,"config.frameRate"),void 0!==e.bitrateMax&&Ge(e.bitrateMax,"config.bitrateMax"),void 0!==e.bitrateMin&&Ge(e.bitrateMin,"config.bitrateMin"),!0}function sd(e){return void 0!==e.sampleRate&&Ge(e.sampleRate,"config.sampleRate",0,96e3,!0),void 0!==e.sampleSize&&Ge(e.sampleRate,"config.sampleSize",0,128,!0),void 0!==e.stereo&&Be(e.stereo,"config.stereo"),void 0!==e.bitrate&&Ge(e.bitrate,"config.bitrate",0,1e4,!1),!0}function cd(e){return je(e,"mediaSource",["screen","window","application"]),!0}var dd,ud,ld,hd,pd,_d,fd,Ed,md;e.TrackInternalEvent=void 0,(dd=e.TrackInternalEvent||(e.TrackInternalEvent={})).NEED_RENEGOTIATE="@need_renegotiate",dd.NEED_REPLACE_TRACK="@need_replace_track",dd.NEED_REPLACE_MIXING_TRACK="@need_replace_mixing_track",dd.NEED_CLOSE="@need_close",dd.NEED_ENABLE_TRACK="@need_enable_track",dd.NEED_DISABLE_TRACK="@need_disable_track",dd.NEED_SESSION_ID="@need_sid",dd.SET_OPTIMIZATION_MODE="@set_optimization_mode",dd.GET_STATS="@get_stats",dd.GET_RTC_STATS="@get_rtc_stats",dd.GET_LOW_VIDEO_TRACK="@get_low_video_track",dd.NEED_RESET_REMOTE_SDP="@need_reset_remote_sdp",dd.NEED_UPDATE_VIDEO_ENCODER="@need_update_video_encoder",dd.NEED_UPDATE_VIDEO_SEND_PARAMETERS="@need_update_video_send_parameters",dd.NEED_MUTE_TRACK="@need_mute_track",dd.NEED_UNMUTE_TRACK="@need_unmute_track",e.TrackHint=void 0,(ud=e.TrackHint||(e.TrackHint={})).SCREEN_TRACK="screen_track",ud.CUSTOM_TRACK="custome_track",ud.LOW_STREAM="low_stream",e.StreamType=void 0,(ld=e.StreamType||(e.StreamType={}))[ld.HIGH_STREAM=0]="HIGH_STREAM",ld[ld.LOW_STREAM=1]="LOW_STREAM",e.RemoteStreamType=void 0,(hd=e.RemoteStreamType||(e.RemoteStreamType={}))[hd.HIGH_STREAM=0]="HIGH_STREAM",hd[hd.LOW_STREAM=1]="LOW_STREAM",e.RemoteStreamFallbackType=void 0,(pd=e.RemoteStreamFallbackType||(e.RemoteStreamFallbackType={}))[pd.DISABLE=0]="DISABLE",pd[pd.LOW_STREAM=1]="LOW_STREAM",pd[pd.AUDIO_ONLY=2]="AUDIO_ONLY",e.TrackEvents=void 0,(_d=e.TrackEvents||(e.TrackEvents={})).TRANSCEIVER_UPDATED="transceiver-updated",_d.SEI_TO_SEND="sei-to-send",_d.SEI_RECEIVED="sei-received",_d.TRACK_UPDATED="track-updated",e.LocalTrackEvents=void 0,(fd=e.LocalTrackEvents||(e.LocalTrackEvents={})).SOURCE_STATE_CHANGE="source-state-change",fd.TRACK_ENDED="track-ended",fd.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload",fd.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",fd.CLOSED="closed",e.RemoteTrackEvents=void 0,(Ed=e.RemoteTrackEvents||(e.RemoteTrackEvents={})).FIRST_FRAME_DECODED="first-frame-decoded",Ed.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",Ed.VIDEO_STATE_CHANGED="video-state-changed",e.AudioSourceEvents=void 0,(md=e.AudioSourceEvents||(e.AudioSourceEvents={})).AUDIO_SOURCE_STATE_CHANGE="audio_source_state_change",md.RECEIVE_TRACK_BUFFER="receive_track_buffer",md.ON_AUDIO_BUFFER="on_audio_buffer",md.UPDATE_SOURCE="update_source",e.AUDIO_TRACK_EVENT=void 0,(e.AUDIO_TRACK_EVENT||(e.AUDIO_TRACK_EVENT={})).UPDATE_TRACK_SOURCE="update-track-source";const Td={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},gd={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},Sd={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveLevel:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1},vd={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};var Rd,yd,Ad,bd,Id,Od;e.PROCESSOR_DESTINATION_EVENTS=void 0,(Rd=e.PROCESSOR_DESTINATION_EVENTS||(e.PROCESSOR_DESTINATION_EVENTS={})).ON_TRACK="on_track",Rd.ON_NODE="on_node",e.PROCESSOR_CONTEXT_EVENTS=void 0,(yd=e.PROCESSOR_CONTEXT_EVENTS||(e.PROCESSOR_CONTEXT_EVENTS={})).REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",yd.REQUEST_CONSTRAINTS="request_constraints",e.DeviceManagerState=void 0,(Ad=e.DeviceManagerState||(e.DeviceManagerState={})).IDLE="IDLE",Ad.INITING="INITING",Ad.INITEND="INITEND",e.DeviceManagerEvent=void 0,(bd=e.DeviceManagerEvent||(e.DeviceManagerEvent={})).STATE_CHANGE="state_change",bd.RECORDING_DEVICE_CHANGED="recordingDeviceChanged",bd.PLAYOUT_DEVICE_CHANGED="playoutDeviceChanged",bd.CAMERA_DEVICE_CHANGED="cameraDeviceChanged",e.MediaElementStatus=void 0,(Id=e.MediaElementStatus||(e.MediaElementStatus={})).NONE="none",Id.INIT="init",Id.CANPLAY="canplay",Id.PLAYING="playing",Id.PAUSED="paused",Id.SUSPEND="suspend",Id.STALLED="stalled",Id.WAITING="waiting",Id.ERROR="error",Id.DESTROYED="destroyed",Id.ABORT="abort",Id.ENDED="ended",Id.EMPTIED="emptied",Id.LOADEDDATA="loadeddata",e.VideoState=void 0,(Od=e.VideoState||(e.VideoState={}))[Od.VideoStateStopped=0]="VideoStateStopped",Od[Od.VideoStateStarting=1]="VideoStateStarting",Od[Od.VideoStateDecoding=2]="VideoStateDecoding",Od[Od.VideoStateFrozen=3]="VideoStateFrozen";var Cd;e.DataChannelEvents=void 0,(Cd=e.DataChannelEvents||(e.DataChannelEvents={})).OPEN="open",Cd.MESSAGE="message",Cd.CLOSE="close",Cd.CLOSING="closing",Cd.ERROR="error";var wd={exports:{}},Nd=Ks,kd=zi,Dd=_s.f;Nd({target:"Object",stat:!0,forced:Object.defineProperty!==Dd,sham:!kd},{defineProperty:Dd});var Pd=go.Object,Ld=wd.exports=function(e,t,r){return Pd.defineProperty(e,t,r)};Pd.defineProperty.sham&&(Ld.sham=!0);var Md=J(wd.exports),Ud=xi,xd=Array.isArray||function(e){return"Array"==Ud(e)},Vd=TypeError,Fd=Fa,Bd=_s,jd=ro,Gd=function(e,t,r){var n=Fd(t);n in e?Bd.f(e,n,jd(0,r)):e[n]=r},Hd=Wi,Wd=sa,Kd=bi(Function.toString);Hd(Wd.inspectSource)||(Wd.inspectSource=function(e){return Kd(e)});var zd=Wd.inspectSource,Yd=bi,Xd=gi,Jd=Wi,Zd=Ic,qd=zd,Qd=function(){},$d=[],eu=Ao("Reflect","construct"),tu=/^\s*(?:class|function)\b/,ru=Yd(tu.exec),nu=!tu.exec(Qd),iu=function(e){if(!Jd(e))return!1;try{return eu(Qd,$d,e),!0}catch(e){return!1}},ou=function(e){if(!Jd(e))return!1;switch(Zd(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return nu||!!ru(tu,qd(e))}catch(e){return!0}};ou.sham=!0;var au=!eu||Xd((function(){var e;return iu(iu.call)||!iu(Object)||!iu((function(){e=!0}))||e}))?ou:iu,su=xd,cu=au,du=To,uu=wa("species"),lu=Array,hu=function(e){var t;return su(e)&&(t=e.constructor,(cu(t)&&(t===lu||su(t.prototype))||du(t)&&null===(t=t[uu]))&&(t=void 0)),void 0===t?lu:t},pu=function(e,t){return new(hu(e))(0===t?0:t)},_u=gi,fu=Do,Eu=wa("species"),mu=Ks,Tu=gi,gu=xd,Su=To,vu=ha,Ru=nc,yu=function(e){if(e>9007199254740991)throw Vd("Maximum allowed index exceeded");return e},Au=Gd,bu=pu,Iu=function(e){return fu>=51||!_u((function(){var t=[];return(t.constructor={})[Eu]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Ou=Do,Cu=wa("isConcatSpreadable"),wu=Ou>=51||!Tu((function(){var e=[];return e[Cu]=!1,e.concat()[0]!==e})),Nu=function(e){if(!Su(e))return!1;var t=e[Cu];return void 0!==t?!!t:gu(e)};mu({target:"Array",proto:!0,arity:1,forced:!wu||!Iu("concat")},{concat:function(e){var t,r,n,i,o,a=vu(this),s=bu(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(Nu(o=-1===t?a:arguments[t]))for(i=Ru(o),yu(c+i),r=0;r<i;r++,c++)r in o&&Au(s,c,o[r]);else yu(c+1),Au(s,c++,o);return s.length=c,s}});var ku={},Du={},Pu=fa,Lu=fo,Mu=cc.indexOf,Uu=Du,xu=bi([].push),Vu=function(e,t){var r,n=Lu(e),i=0,o=[];for(r in n)!Pu(Uu,r)&&Pu(n,r)&&xu(o,r);for(;t.length>i;)Pu(n,r=t[i++])&&(~Mu(o,r)||xu(o,r));return o},Fu=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Bu=Vu,ju=Fu,Gu=Object.keys||function(e){return Bu(e,ju)},Hu=zi,Wu=fs,Ku=_s,zu=gs,Yu=fo,Xu=Gu;ku.f=Hu&&!Wu?Object.defineProperties:function(e,t){zu(e);for(var r,n=Yu(t),i=Xu(t),o=i.length,a=0;o>a;)Ku.f(e,r=i[a++],n[r]);return e};var Ju,Zu=Ao("document","documentElement"),qu=Sa,Qu=da("keys"),$u=function(e){return Qu[e]||(Qu[e]=qu(e))},el=gs,tl=ku,rl=Fu,nl=Du,il=Zu,ol=Ha,al="prototype",sl="script",cl=$u("IE_PROTO"),dl=function(){},ul=function(e){return"<"+sl+">"+e+"</"+sl+">"},ll=function(e){e.write(ul("")),e.close();var t=e.parentWindow.Object;return e=null,t},hl=function(){try{Ju=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;hl="undefined"!=typeof document?document.domain&&Ju?ll(Ju):(t=ol("iframe"),r="java"+sl+":",t.style.display="none",il.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(ul("document.F=Object")),e.close(),e.F):ll(Ju);for(var n=rl.length;n--;)delete hl[al][rl[n]];return hl()};nl[cl]=!0;var pl=Object.create||function(e,t){var r;return null!==e?(dl[al]=el(e),r=new dl,dl[al]=null,r[cl]=e):r=hl(),void 0===t?r:tl.f(r,t)},_l={},fl=Vu,El=Fu.concat("length","prototype");_l.f=Object.getOwnPropertyNames||function(e){return fl(e,El)};var ml={},Tl=$s,gl=nc,Sl=Gd,vl=Array,Rl=Math.max,yl=function(e,t,r){for(var n=gl(e),i=Tl(t,n),o=Tl(void 0===r?n:r,n),a=vl(Rl(o-i,0)),s=0;i<o;i++,s++)Sl(a,s,e[i]);return a.length=s,a},Al=xi,bl=fo,Il=_l.f,Ol=yl,Cl="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];ml.f=function(e){return Cl&&"Window"==Al(e)?function(e){try{return Il(e)}catch(e){return Ol(Cl)}}(e):Il(bl(e))};var wl={};wl.f=Object.getOwnPropertySymbols;var Nl=Ps,kl=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Nl(e,t,r),e},Dl=_s,Pl=function(e,t,r){return Dl.f(e,t,r)},Ll={},Ml=wa;Ll.f=Ml;var Ul,xl,Vl,Fl=go,Bl=fa,jl=Ll,Gl=_s.f,Hl=function(e){var t=Fl.Symbol||(Fl.Symbol={});Bl(t,e)||Gl(t,e,{value:jl.f(e)})},Wl=Ji,Kl=Ao,zl=wa,Yl=kl,Xl=function(){var e=Kl("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=zl("toPrimitive");t&&!t[n]&&Yl(t,n,(function(e){return Wl(r,this)}),{arity:1})},Jl=Ic,Zl=gc?{}.toString:function(){return"[object "+Jl(this)+"]"},ql=gc,Ql=_s.f,$l=Ps,eh=fa,th=Zl,rh=wa("toStringTag"),nh=function(e,t,r,n){if(e){var i=r?e:e.prototype;eh(i,rh)||Ql(i,rh,{configurable:!0,value:t}),n&&!ql&&$l(i,"toString",th)}},ih=Wi,oh=Ci.WeakMap,ah=ih(oh)&&/native code/.test(String(oh)),sh=Ci,ch=To,dh=Ps,uh=fa,lh=sa,hh=$u,ph=Du,_h="Object already initialized",fh=sh.TypeError,Eh=sh.WeakMap;if(ah||lh.state){var mh=lh.state||(lh.state=new Eh);mh.get=mh.get,mh.has=mh.has,mh.set=mh.set,Ul=function(e,t){if(mh.has(e))throw fh(_h);return t.facade=e,mh.set(e,t),t},xl=function(e){return mh.get(e)||{}},Vl=function(e){return mh.has(e)}}else{var Th=hh("state");ph[Th]=!0,Ul=function(e,t){if(uh(e,Th))throw fh(_h);return t.facade=e,dh(e,Th,t),t},xl=function(e){return uh(e,Th)?e[Th]:{}},Vl=function(e){return uh(e,Th)}}var gh={set:Ul,get:xl,has:Vl,enforce:function(e){return Vl(e)?xl(e):Ul(e,{})},getterFor:function(e){return function(t){var r;if(!ch(t)||(r=xl(t)).type!==e)throw fh("Incompatible receiver, "+e+" required");return r}}},Sh=ps,vh=so,Rh=ha,yh=nc,Ah=pu,bh=bi([].push),Ih=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,d,u,l){for(var h,p,_=Rh(c),f=vh(_),E=Sh(d,u),m=yh(f),T=0,g=l||Ah,S=t?g(c,m):r||a?g(c,0):void 0;m>T;T++)if((s||T in f)&&(p=E(h=f[T],T,_),e))if(t)S[T]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return T;case 2:bh(S,h)}else switch(e){case 4:return!1;case 7:bh(S,h)}return o?-1:n||i?i:S}},Oh={forEach:Ih(0),map:Ih(1),filter:Ih(2),some:Ih(3),every:Ih(4),find:Ih(5),findIndex:Ih(6),filterReject:Ih(7)},Ch=Ks,wh=Ci,Nh=Ji,kh=bi,Dh=zi,Ph=Uo,Lh=gi,Mh=fa,Uh=Ii,xh=gs,Vh=fo,Fh=Fa,Bh=wc,jh=ro,Gh=pl,Hh=Gu,Wh=_l,Kh=ml,zh=wl,Yh=Ki,Xh=_s,Jh=ku,Zh=Zi,qh=kl,Qh=Pl,$h=da,ep=Du,tp=Sa,rp=wa,np=Ll,ip=Hl,op=Xl,ap=nh,sp=gh,cp=Oh.forEach,dp=$u("hidden"),up="Symbol",lp="prototype",hp=sp.set,pp=sp.getterFor(up),_p=Object[lp],fp=wh.Symbol,Ep=fp&&fp[lp],mp=wh.TypeError,Tp=wh.QObject,gp=Yh.f,Sp=Xh.f,vp=Kh.f,Rp=Zh.f,yp=kh([].push),Ap=$h("symbols"),bp=$h("op-symbols"),Ip=$h("wks"),Op=!Tp||!Tp[lp]||!Tp[lp].findChild,Cp=Dh&&Lh((function(){return 7!=Gh(Sp({},"a",{get:function(){return Sp(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=gp(_p,t);n&&delete _p[t],Sp(e,t,r),n&&e!==_p&&Sp(_p,t,n)}:Sp,wp=function(e,t){var r=Ap[e]=Gh(Ep);return hp(r,{type:up,tag:e,description:t}),Dh||(r.description=t),r},Np=function(e,t,r){e===_p&&Np(bp,t,r),xh(e);var n=Fh(t);return xh(r),Mh(Ap,n)?(r.enumerable?(Mh(e,dp)&&e[dp][n]&&(e[dp][n]=!1),r=Gh(r,{enumerable:jh(0,!1)})):(Mh(e,dp)||Sp(e,dp,jh(1,{})),e[dp][n]=!0),Cp(e,n,r)):Sp(e,n,r)},kp=function(e,t){xh(e);var r=Vh(t),n=Hh(r).concat(Mp(r));return cp(n,(function(t){Dh&&!Nh(Dp,r,t)||Np(e,t,r[t])})),e},Dp=function(e){var t=Fh(e),r=Nh(Rp,this,t);return!(this===_p&&Mh(Ap,t)&&!Mh(bp,t))&&(!(r||!Mh(this,t)||!Mh(Ap,t)||Mh(this,dp)&&this[dp][t])||r)},Pp=function(e,t){var r=Vh(e),n=Fh(t);if(r!==_p||!Mh(Ap,n)||Mh(bp,n)){var i=gp(r,n);return!i||!Mh(Ap,n)||Mh(r,dp)&&r[dp][n]||(i.enumerable=!0),i}},Lp=function(e){var t=vp(Vh(e)),r=[];return cp(t,(function(e){Mh(Ap,e)||Mh(ep,e)||yp(r,e)})),r},Mp=function(e){var t=e===_p,r=vp(t?bp:Vh(e)),n=[];return cp(r,(function(e){!Mh(Ap,e)||t&&!Mh(_p,e)||yp(n,Ap[e])})),n};Ph||(fp=function(){if(Uh(Ep,this))throw mp("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Bh(arguments[0]):void 0,t=tp(e),r=function(e){this===_p&&Nh(r,bp,e),Mh(this,dp)&&Mh(this[dp],t)&&(this[dp][t]=!1),Cp(this,t,jh(1,e))};return Dh&&Op&&Cp(_p,t,{configurable:!0,set:r}),wp(t,e)},qh(Ep=fp[lp],"toString",(function(){return pp(this).tag})),qh(fp,"withoutSetter",(function(e){return wp(tp(e),e)})),Zh.f=Dp,Xh.f=Np,Jh.f=kp,Yh.f=Pp,Wh.f=Kh.f=Lp,zh.f=Mp,np.f=function(e){return wp(rp(e),e)},Dh&&Qh(Ep,"description",{configurable:!0,get:function(){return pp(this).description}})),Ch({global:!0,constructor:!0,wrap:!0,forced:!Ph,sham:!Ph},{Symbol:fp}),cp(Hh(Ip),(function(e){ip(e)})),Ch({target:up,stat:!0,forced:!Ph},{useSetter:function(){Op=!0},useSimple:function(){Op=!1}}),Ch({target:"Object",stat:!0,forced:!Ph,sham:!Dh},{create:function(e,t){return void 0===t?Gh(e):kp(Gh(e),t)},defineProperty:Np,defineProperties:kp,getOwnPropertyDescriptor:Pp}),Ch({target:"Object",stat:!0,forced:!Ph},{getOwnPropertyNames:Lp}),op(),ap(fp,up),ep[dp]=!0;var Up=Uo&&!!Symbol.for&&!!Symbol.keyFor,xp=Ks,Vp=Ao,Fp=fa,Bp=wc,jp=da,Gp=Up,Hp=jp("string-to-symbol-registry"),Wp=jp("symbol-to-string-registry");xp({target:"Symbol",stat:!0,forced:!Gp},{for:function(e){var t=Bp(e);if(Fp(Hp,t))return Hp[t];var r=Vp("Symbol")(t);return Hp[t]=r,Wp[r]=t,r}});var Kp=Ks,zp=fa,Yp=Go,Xp=Wo,Jp=Up,Zp=da("symbol-to-string-registry");Kp({target:"Symbol",stat:!0,forced:!Jp},{keyFor:function(e){if(!Yp(e))throw TypeError(Xp(e)+" is not a symbol");if(zp(Zp,e))return Zp[e]}});var qp=bi([].slice),Qp=xd,$p=Wi,e_=xi,t_=wc,r_=bi([].push),n_=Ks,i_=Ao,o_=Pi,a_=Ji,s_=bi,c_=gi,d_=Wi,u_=Go,l_=qp,h_=function(e){if($p(e))return e;if(Qp(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?r_(r,i):"number"!=typeof i&&"Number"!=e_(i)&&"String"!=e_(i)||r_(r,t_(i))}var o=r.length,a=!0;return function(e,t){if(a)return a=!1,t;if(Qp(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}},p_=Uo,__=String,f_=i_("JSON","stringify"),E_=s_(/./.exec),m_=s_("".charAt),T_=s_("".charCodeAt),g_=s_("".replace),S_=s_(1..toString),v_=/[\uD800-\uDFFF]/g,R_=/^[\uD800-\uDBFF]$/,y_=/^[\uDC00-\uDFFF]$/,A_=!p_||c_((function(){var e=i_("Symbol")();return"[null]"!=f_([e])||"{}"!=f_({a:e})||"{}"!=f_(Object(e))})),b_=c_((function(){return'"\\udf06\\ud834"'!==f_("\udf06\ud834")||'"\\udead"'!==f_("\udead")})),I_=function(e,t){var r=l_(arguments),n=h_(t);if(d_(n)||void 0!==e&&!u_(e))return r[1]=function(e,t){if(d_(n)&&(t=a_(n,this,__(e),t)),!u_(t))return t},o_(f_,null,r)},O_=function(e,t,r){var n=m_(r,t-1),i=m_(r,t+1);return E_(R_,e)&&!E_(y_,i)||E_(y_,e)&&!E_(R_,n)?"\\u"+S_(T_(e,0),16):e};f_&&n_({target:"JSON",stat:!0,arity:3,forced:A_||b_},{stringify:function(e,t,r){var n=l_(arguments),i=o_(A_?I_:f_,null,n);return b_&&"string"==typeof i?g_(i,v_,O_):i}});var C_=wl,w_=ha;Ks({target:"Object",stat:!0,forced:!Uo||gi((function(){C_.f(1)}))},{getOwnPropertySymbols:function(e){var t=C_.f;return t?t(w_(e)):[]}}),Hl("asyncIterator"),Hl("hasInstance"),Hl("isConcatSpreadable"),Hl("iterator"),Hl("match"),Hl("matchAll"),Hl("replace"),Hl("search"),Hl("species"),Hl("split");var N_=Xl;Hl("toPrimitive"),N_();var k_=Ao,D_=nh;Hl("toStringTag"),D_(k_("Symbol"),"Symbol"),Hl("unscopables"),nh(Ci.JSON,"JSON",!0);var P_,L_,M_,U_=go.Symbol,x_={},V_=zi,F_=fa,B_=Function.prototype,j_=V_&&Object.getOwnPropertyDescriptor,G_=F_(B_,"name"),H_={EXISTS:G_,PROPER:G_&&"something"===function(){}.name,CONFIGURABLE:G_&&(!V_||V_&&j_(B_,"name").configurable)},W_=!gi((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),K_=fa,z_=Wi,Y_=ha,X_=W_,J_=$u("IE_PROTO"),Z_=Object,q_=Z_.prototype,Q_=X_?Z_.getPrototypeOf:function(e){var t=Y_(e);if(K_(t,J_))return t[J_];var r=t.constructor;return z_(r)&&t instanceof r?r.prototype:t instanceof Z_?q_:null},$_=gi,ef=Wi,tf=To,rf=pl,nf=Q_,of=kl,af=wa("iterator"),sf=!1;[].keys&&("next"in(M_=[].keys())?(L_=nf(nf(M_)))!==Object.prototype&&(P_=L_):sf=!0);var cf=!tf(P_)||$_((function(){var e={};return P_[af].call(e)!==e}));ef((P_=cf?{}:rf(P_))[af])||of(P_,af,(function(){return this}));var df={IteratorPrototype:P_,BUGGY_SAFARI_ITERATORS:sf},uf=df.IteratorPrototype,lf=pl,hf=ro,pf=nh,_f=x_,ff=function(){return this},Ef=function(e,t,r,n){var i=t+" Iterator";return e.prototype=lf(uf,{next:hf(+!n,r)}),pf(e,i,!1,!0),_f[i]=ff,e},mf=bi,Tf=Xo,gf=Wi,Sf=String,vf=TypeError,Rf=function(e,t,r){try{return mf(Tf(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},yf=gs,Af=function(e){if("object"==typeof e||gf(e))return e;throw vf("Can't set "+Sf(e)+" as a prototype")},bf=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Rf(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return yf(r),Af(n),t?e(r,n):r.__proto__=n,r}}():void 0),If=Ks,Of=Ji,Cf=H_,wf=Ef,Nf=Q_,kf=nh,Df=kl,Pf=x_,Lf=df,Mf=Cf.PROPER,Uf=Lf.BUGGY_SAFARI_ITERATORS,xf=wa("iterator"),Vf="keys",Ff="values",Bf="entries",jf=function(){return this},Gf=function(e,t,r,n,i,o,a){wf(r,t,n);var s,c,d,u=function(e){if(e===i&&f)return f;if(!Uf&&e in p)return p[e];switch(e){case Vf:case Ff:case Bf:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,_=p[xf]||p["@@iterator"]||i&&p[i],f=!Uf&&_||u(i),E="Array"==t&&p.entries||_;if(E&&(s=Nf(E.call(new e)))!==Object.prototype&&s.next&&(kf(s,l,!0,!0),Pf[l]=jf),Mf&&i==Ff&&_&&_.name!==Ff&&(h=!0,f=function(){return Of(_,this)}),i)if(c={values:u(Ff),keys:o?f:u(Vf),entries:u(Bf)},a)for(d in c)(Uf||h||!(d in p))&&Df(p,d,c[d]);else If({target:t,proto:!0,forced:Uf||h},c);return a&&p[xf]!==f&&Df(p,xf,f,{name:i}),Pf[t]=f,c},Hf=function(e,t){return{value:e,done:t}},Wf=fo,Kf=x_,zf=gh;_s.f;var Yf=Gf,Xf=Hf,Jf="Array Iterator",Zf=zf.set,qf=zf.getterFor(Jf);Yf(Array,"Array",(function(e,t){Zf(this,{type:Jf,target:Wf(e),index:0,kind:t})}),(function(){var e=qf(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,Xf(void 0,!0)):Xf("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),Kf.Arguments=Kf.Array;var Qf={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},$f=Ci,eE=Ic,tE=Ps,rE=x_,nE=wa("toStringTag");for(var iE in Qf){var oE=$f[iE],aE=oE&&oE.prototype;aE&&eE(aE)!==nE&&tE(aE,nE,iE),rE[iE]=rE.Array}var sE=U_,cE=wa,dE=_s.f,uE=cE("metadata"),lE=Function.prototype;void 0===lE[uE]&&dE(lE,uE,{value:null}),Hl("dispose"),Hl("metadata");var hE=sE;Hl("asyncDispose");var pE=bi,_E=Ao("Symbol"),fE=_E.keyFor,EE=pE(_E.prototype.valueOf),mE=_E.isRegisteredSymbol||function(e){try{return void 0!==fE(EE(e))}catch(e){return!1}};Ks({target:"Symbol",stat:!0},{isRegisteredSymbol:mE});for(var TE=da,gE=Ao,SE=bi,vE=Go,RE=wa,yE=gE("Symbol"),AE=yE.isWellKnownSymbol,bE=gE("Object","getOwnPropertyNames"),IE=SE(yE.prototype.valueOf),OE=TE("wks"),CE=0,wE=bE(yE),NE=wE.length;CE<NE;CE++)try{var kE=wE[CE];vE(yE[kE])&&RE(kE)}catch(e){}var DE=function(e){if(AE&&AE(e))return!0;try{for(var t=IE(e),r=0,n=bE(OE),i=n.length;r<i;r++)if(OE[n[r]]==t)return!0}catch(e){}return!1};Ks({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:DE}),Hl("matcher"),Hl("observable"),Ks({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:mE}),Ks({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:DE}),Hl("metadataKey"),Hl("patternMatch"),Hl("replaceAll");var PE=J(hE),LE=bi,ME=Js,UE=wc,xE=ho,VE=LE("".charAt),FE=LE("".charCodeAt),BE=LE("".slice),jE=function(e){return function(t,r){var n,i,o=UE(xE(t)),a=ME(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=FE(o,a))<55296||n>56319||a+1===s||(i=FE(o,a+1))<56320||i>57343?e?VE(o,a):n:e?BE(o,a,a+2):i-56320+(n-55296<<10)+65536}},GE={codeAt:jE(!1),charAt:jE(!0)},HE=GE.charAt,WE=wc,KE=gh,zE=Gf,YE=Hf,XE="String Iterator",JE=KE.set,ZE=KE.getterFor(XE);zE(String,"String",(function(e){JE(this,{type:XE,string:WE(e),index:0})}),(function(){var e,t=ZE(this),r=t.string,n=t.index;return n>=r.length?YE(void 0,!0):(e=HE(r,n),t.index+=e.length,YE(e,!1))}));var qE=J(Ll.f("iterator"));function QE(e){return QE="function"==typeof PE&&"symbol"==typeof qE?function(e){return typeof e}:function(e){return e&&"function"==typeof PE&&e.constructor===PE&&e!==PE.prototype?"symbol":typeof e},QE(e)}var $E=J(Ll.f("toPrimitive"));function em(e){var t=function(e,t){if("object"!==QE(e)||null===e)return e;var r=e[$E];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==QE(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===QE(t)?t:String(t)}function tm(e,t,r){return(t=em(t))in e?Md(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var rm=Ao,nm=_l,im=wl,om=gs,am=bi([].concat),sm=rm("Reflect","ownKeys")||function(e){var t=nm.f(om(e)),r=im.f;return r?am(t,r(e)):t},cm=fa,dm=sm,um=Ki,lm=_s,hm=To,pm=Ps,_m=Error,fm=bi("".replace),Em=String(_m("zxcasd").stack),mm=/\n\s*at [^:]*:[^\n]*/,Tm=mm.test(Em),gm=ro,Sm=!gi((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",gm(1,7)),7!==e.stack)})),vm=Ps,Rm=function(e,t){if(Tm&&"string"==typeof e&&!_m.prepareStackTrace)for(;t--;)e=fm(e,mm,"");return e},ym=Sm,Am=Error.captureStackTrace,bm=x_,Im=wa("iterator"),Om=Array.prototype,Cm=function(e){return void 0!==e&&(bm.Array===e||Om[Im]===e)},wm=Ic,Nm=qo,km=co,Dm=x_,Pm=wa("iterator"),Lm=function(e){if(!km(e))return Nm(e,Pm)||Nm(e,"@@iterator")||Dm[wm(e)]},Mm=Ji,Um=Xo,xm=gs,Vm=Wo,Fm=Lm,Bm=TypeError,jm=function(e,t){var r=arguments.length<2?Fm(e):t;if(Um(r))return xm(Mm(r,e));throw Bm(Vm(e)+" is not iterable")},Gm=Ji,Hm=gs,Wm=qo,Km=function(e,t,r){var n,i;Hm(e);try{if(!(n=Wm(e,"return"))){if("throw"===t)throw r;return r}n=Gm(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return Hm(n),r},zm=ps,Ym=Ji,Xm=gs,Jm=Wo,Zm=Cm,qm=nc,Qm=Ii,$m=jm,eT=Lm,tT=Km,rT=TypeError,nT=function(e,t){this.stopped=e,this.result=t},iT=nT.prototype,oT=function(e,t,r){var n,i,o,a,s,c,d,u=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),_=!(!r||!r.INTERRUPTED),f=zm(t,u),E=function(e){return n&&tT(n,"normal",e),new nT(!0,e)},m=function(e){return l?(Xm(e),_?f(e[0],e[1],E):f(e[0],e[1])):_?f(e,E):f(e)};if(h)n=e.iterator;else if(p)n=e;else{if(!(i=eT(e)))throw rT(Jm(e)+" is not iterable");if(Zm(i)){for(o=0,a=qm(e);a>o;o++)if((s=m(e[o]))&&Qm(iT,s))return s;return new nT(!1)}n=$m(e,i)}for(c=h?e.next:n.next;!(d=Ym(c,n)).done;){try{s=m(d.value)}catch(e){tT(n,"throw",e)}if("object"==typeof s&&s&&Qm(iT,s))return s}return new nT(!1)},aT=wc,sT=Ks,cT=Ii,dT=Q_,uT=bf,lT=function(e,t,r){for(var n=dm(t),i=lm.f,o=um.f,a=0;a<n.length;a++){var s=n[a];cm(e,s)||r&&cm(r,s)||i(e,s,o(t,s))}},hT=pl,pT=Ps,_T=ro,fT=function(e,t){hm(t)&&"cause"in t&&pm(e,"cause",t.cause)},ET=function(e,t,r,n){ym&&(Am?Am(e,t):vm(e,"stack",Rm(r,n)))},mT=oT,TT=function(e,t){return void 0===e?arguments.length<2?"":t:aT(e)},gT=wa("toStringTag"),ST=Error,vT=[].push,RT=function(e,t){var r,n=cT(yT,this);uT?r=uT(ST(),n?dT(this):yT):(r=n?this:hT(yT),pT(r,gT,"Error")),void 0!==t&&pT(r,"message",TT(t)),ET(r,RT,r.stack,1),arguments.length>2&&fT(r,arguments[2]);var i=[];return mT(e,vT,{that:i}),pT(r,"errors",i),r};uT?uT(RT,ST):lT(RT,ST,{name:!0});var yT=RT.prototype=hT(ST.prototype,{constructor:_T(1,RT),message:_T(1,""),name:_T(1,"AggregateError")});sT({global:!0,constructor:!0,arity:2},{AggregateError:RT});var AT,bT,IT,OT,CT="undefined"!=typeof process&&"process"==xi(process),wT=Ao,NT=Pl,kT=zi,DT=wa("species"),PT=Ii,LT=TypeError,MT=function(e,t){if(PT(t,e))return e;throw LT("Incorrect invocation")},UT=au,xT=Wo,VT=TypeError,FT=gs,BT=function(e){if(UT(e))return e;throw VT(xT(e)+" is not a constructor")},jT=co,GT=wa("species"),HT=function(e,t){var r,n=FT(e).constructor;return void 0===n||jT(r=FT(n)[GT])?t:BT(r)},WT=TypeError,KT=function(e,t){if(e<t)throw WT("Not enough arguments");return e},zT=/(?:ipad|iphone|ipod).*applewebkit/i.test(bo),YT=Ci,XT=Pi,JT=ps,ZT=Wi,qT=fa,QT=gi,$T=Zu,eg=qp,tg=Ha,rg=KT,ng=zT,ig=CT,og=YT.setImmediate,ag=YT.clearImmediate,sg=YT.process,cg=YT.Dispatch,dg=YT.Function,ug=YT.MessageChannel,lg=YT.String,hg=0,pg={},_g="onreadystatechange";QT((function(){AT=YT.location}));var fg=function(e){if(qT(pg,e)){var t=pg[e];delete pg[e],t()}},Eg=function(e){return function(){fg(e)}},mg=function(e){fg(e.data)},Tg=function(e){YT.postMessage(lg(e),AT.protocol+"//"+AT.host)};og&&ag||(og=function(e){rg(arguments.length,1);var t=ZT(e)?e:dg(e),r=eg(arguments,1);return pg[++hg]=function(){XT(t,void 0,r)},bT(hg),hg},ag=function(e){delete pg[e]},ig?bT=function(e){sg.nextTick(Eg(e))}:cg&&cg.now?bT=function(e){cg.now(Eg(e))}:ug&&!ng?(OT=(IT=new ug).port2,IT.port1.onmessage=mg,bT=JT(OT.postMessage,OT)):YT.addEventListener&&ZT(YT.postMessage)&&!YT.importScripts&&AT&&"file:"!==AT.protocol&&!QT(Tg)?(bT=Tg,YT.addEventListener("message",mg,!1)):bT=_g in tg("script")?function(e){$T.appendChild(tg("script"))[_g]=function(){$T.removeChild(this),fg(e)}}:function(e){setTimeout(Eg(e),0)});var gg={set:og,clear:ag},Sg=function(){this.head=null,this.tail=null};Sg.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 vg,Rg,yg,Ag,bg,Ig=Sg,Og=/ipad|iphone|ipod/i.test(bo)&&"undefined"!=typeof Pebble,Cg=/web0s(?!.*chrome)/i.test(bo),wg=Ci,Ng=ps,kg=Ki.f,Dg=gg.set,Pg=Ig,Lg=zT,Mg=Og,Ug=Cg,xg=CT,Vg=wg.MutationObserver||wg.WebKitMutationObserver,Fg=wg.document,Bg=wg.process,jg=wg.Promise,Gg=kg(wg,"queueMicrotask"),Hg=Gg&&Gg.value;if(!Hg){var Wg=new Pg,Kg=function(){var e,t;for(xg&&(e=Bg.domain)&&e.exit();t=Wg.get();)try{t()}catch(e){throw Wg.head&&vg(),e}e&&e.enter()};Lg||xg||Ug||!Vg||!Fg?!Mg&&jg&&jg.resolve?((Ag=jg.resolve(void 0)).constructor=jg,bg=Ng(Ag.then,Ag),vg=function(){bg(Kg)}):xg?vg=function(){Bg.nextTick(Kg)}:(Dg=Ng(Dg,wg),vg=function(){Dg(Kg)}):(Rg=!0,yg=Fg.createTextNode(""),new Vg(Kg).observe(yg,{characterData:!0}),vg=function(){yg.data=Rg=!Rg}),Hg=function(e){Wg.head||vg(),Wg.add(e)}}var zg=Hg,Yg=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Xg=Ci.Promise,Jg="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Zg=!Jg&&!CT&&"object"==typeof window&&"object"==typeof document,qg=Ci,Qg=Xg,$g=Wi,eS=ds,tS=zd,rS=wa,nS=Zg,iS=Jg,oS=Do,aS=Qg&&Qg.prototype,sS=rS("species"),cS=!1,dS=$g(qg.PromiseRejectionEvent),uS=eS("Promise",(function(){var e=tS(Qg),t=e!==String(Qg);if(!t&&66===oS)return!0;if(!aS.catch||!aS.finally)return!0;if(!oS||oS<51||!/native code/.test(e)){var r=new Qg((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[sS]=n,!(cS=r.then((function(){}))instanceof n))return!0}return!t&&(nS||iS)&&!dS})),lS={CONSTRUCTOR:uS,REJECTION_EVENT:dS,SUBCLASSING:cS},hS={},pS=Xo,_S=TypeError,fS=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw _S("Bad Promise constructor");t=e,r=n})),this.resolve=pS(t),this.reject=pS(r)};hS.f=function(e){return new fS(e)};var ES,mS,TS=Ks,gS=CT,SS=Ci,vS=Ji,RS=kl,yS=nh,AS=function(e){var t=wT(e);kT&&t&&!t[DT]&&NT(t,DT,{configurable:!0,get:function(){return this}})},bS=Xo,IS=Wi,OS=To,CS=MT,wS=HT,NS=gg.set,kS=zg,DS=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}},PS=Yg,LS=Ig,MS=gh,US=Xg,xS=lS,VS=hS,FS="Promise",BS=xS.CONSTRUCTOR,jS=xS.REJECTION_EVENT,GS=MS.getterFor(FS),HS=MS.set,WS=US&&US.prototype,KS=US,zS=WS,YS=SS.TypeError,XS=SS.document,JS=SS.process,ZS=VS.f,qS=ZS,QS=!!(XS&&XS.createEvent&&SS.dispatchEvent),$S="unhandledrejection",ev=function(e){var t;return!(!OS(e)||!IS(t=e.then))&&t},tv=function(e,t){var r,n,i,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,d=e.reject,u=e.domain;try{s?(a||(2===t.rejection&&av(t),t.rejection=1),!0===s?r=o:(u&&u.enter(),r=s(o),u&&(u.exit(),i=!0)),r===e.promise?d(YS("Promise-chain cycle")):(n=ev(r))?vS(n,r,c,d):c(r)):d(o)}catch(e){u&&!i&&u.exit(),d(e)}},rv=function(e,t){e.notified||(e.notified=!0,kS((function(){for(var r,n=e.reactions;r=n.get();)tv(r,e);e.notified=!1,t&&!e.rejection&&iv(e)})))},nv=function(e,t,r){var n,i;QS?((n=XS.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),SS.dispatchEvent(n)):n={promise:t,reason:r},!jS&&(i=SS["on"+e])?i(n):e===$S&&DS("Unhandled promise rejection",r)},iv=function(e){vS(NS,SS,(function(){var t,r=e.facade,n=e.value;if(ov(e)&&(t=PS((function(){gS?JS.emit("unhandledRejection",n,r):nv($S,r,n)})),e.rejection=gS||ov(e)?2:1,t.error))throw t.value}))},ov=function(e){return 1!==e.rejection&&!e.parent},av=function(e){vS(NS,SS,(function(){var t=e.facade;gS?JS.emit("rejectionHandled",t):nv("rejectionhandled",t,e.value)}))},sv=function(e,t,r){return function(n){e(t,n,r)}},cv=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,rv(e,!0))},dv=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw YS("Promise can't be resolved itself");var n=ev(t);n?kS((function(){var r={done:!1};try{vS(n,t,sv(dv,r,e),sv(cv,r,e))}catch(t){cv(r,t,e)}})):(e.value=t,e.state=1,rv(e,!1))}catch(t){cv({done:!1},t,e)}}};BS&&(zS=(KS=function(e){CS(this,zS),bS(e),vS(ES,this);var t=GS(this);try{e(sv(dv,t),sv(cv,t))}catch(e){cv(t,e)}}).prototype,(ES=function(e){HS(this,{type:FS,done:!1,notified:!1,parent:!1,reactions:new LS,rejection:!1,state:0,value:void 0})}).prototype=RS(zS,"then",(function(e,t){var r=GS(this),n=ZS(wS(this,KS));return r.parent=!0,n.ok=!IS(e)||e,n.fail=IS(t)&&t,n.domain=gS?JS.domain:void 0,0==r.state?r.reactions.add(n):kS((function(){tv(n,r)})),n.promise})),mS=function(){var e=new ES,t=GS(e);this.promise=e,this.resolve=sv(dv,t),this.reject=sv(cv,t)},VS.f=ZS=function(e){return e===KS||undefined===e?new mS(e):qS(e)}),TS({global:!0,constructor:!0,wrap:!0,forced:BS},{Promise:KS}),yS(KS,FS,!1,!0),AS(FS);var uv=wa("iterator"),lv=!1;try{var hv=0,pv={next:function(){return{done:!!hv++}},return:function(){lv=!0}};pv[uv]=function(){return this},Array.from(pv,(function(){throw 2}))}catch(e){}var _v=Xg,fv=function(e,t){if(!t&&!lv)return!1;var r=!1;try{var n={};n[uv]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},Ev=lS.CONSTRUCTOR||!fv((function(e){_v.all(e).then(void 0,(function(){}))})),mv=Ji,Tv=Xo,gv=hS,Sv=Yg,vv=oT;Ks({target:"Promise",stat:!0,forced:Ev},{all:function(e){var t=this,r=gv.f(t),n=r.resolve,i=r.reject,o=Sv((function(){var r=Tv(t.resolve),o=[],a=0,s=1;vv(e,(function(e){var c=a++,d=!1;s++,mv(r,t,e).then((function(e){d||(d=!0,o[c]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var Rv=Ks,yv=lS.CONSTRUCTOR;Xg&&Xg.prototype,Rv({target:"Promise",proto:!0,forced:yv,real:!0},{catch:function(e){return this.then(void 0,e)}});var Av=Ji,bv=Xo,Iv=hS,Ov=Yg,Cv=oT;Ks({target:"Promise",stat:!0,forced:Ev},{race:function(e){var t=this,r=Iv.f(t),n=r.reject,i=Ov((function(){var i=bv(t.resolve);Cv(e,(function(e){Av(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var wv=Ji,Nv=hS;Ks({target:"Promise",stat:!0,forced:lS.CONSTRUCTOR},{reject:function(e){var t=Nv.f(this);return wv(t.reject,void 0,e),t.promise}});var kv=gs,Dv=To,Pv=hS,Lv=function(e,t){if(kv(e),Dv(t)&&t.constructor===e)return t;var r=Pv.f(e);return(0,r.resolve)(t),r.promise},Mv=Ks,Uv=Xg,xv=lS.CONSTRUCTOR,Vv=Lv,Fv=Ao("Promise"),Bv=!xv;Mv({target:"Promise",stat:!0,forced:true},{resolve:function(e){return Vv(Bv&&this===Fv?Uv:this,e)}});var jv=Ji,Gv=Xo,Hv=hS,Wv=Yg,Kv=oT;Ks({target:"Promise",stat:!0,forced:Ev},{allSettled:function(e){var t=this,r=Hv.f(t),n=r.resolve,i=r.reject,o=Wv((function(){var r=Gv(t.resolve),i=[],o=0,a=1;Kv(e,(function(e){var s=o++,c=!1;a++,jv(r,t,e).then((function(e){c||(c=!0,i[s]={status:"fulfilled",value:e},--a||n(i))}),(function(e){c||(c=!0,i[s]={status:"rejected",reason:e},--a||n(i))}))})),--a||n(i)}));return o.error&&i(o.value),r.promise}});var zv=Ji,Yv=Xo,Xv=Ao,Jv=hS,Zv=Yg,qv=oT,Qv="No one promise resolved";Ks({target:"Promise",stat:!0,forced:Ev},{any:function(e){var t=this,r=Xv("AggregateError"),n=Jv.f(t),i=n.resolve,o=n.reject,a=Zv((function(){var n=Yv(t.resolve),a=[],s=0,c=1,d=!1;qv(e,(function(e){var u=s++,l=!1;c++,zv(n,t,e).then((function(e){l||d||(d=!0,i(e))}),(function(e){l||d||(l=!0,a[u]=e,--c||o(new r(a,Qv)))}))})),--c||o(new r(a,Qv))}));return a.error&&o(a.value),n.promise}});var $v=Ks,eR=Xg,tR=gi,rR=Ao,nR=Wi,iR=HT,oR=Lv,aR=eR&&eR.prototype;$v({target:"Promise",proto:!0,real:!0,forced:!!eR&&tR((function(){aR.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=iR(this,rR("Promise")),r=nR(e);return this.then(r?function(r){return oR(t,e()).then((function(){return r}))}:e,r?function(r){return oR(t,e()).then((function(){throw r}))}:e)}});var sR=J(go.Promise);function cR(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function dR(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}class uR extends Ye{set _mediaStreamTrack(t){t!==this.mediaStreamTrack&&(this.safeEmit(e.TrackEvents.TRACK_UPDATED,t),this.mediaStreamTrack=t)}get _mediaStreamTrack(){return this.mediaStreamTrack}constructor(e,t){super(),this._ID=void 0,this._rtpTransceiver=void 0,this._lowRtpTransceiver=void 0,this._hints=[],this._isClosed=!1,this._originMediaStreamTrack=void 0,this.mediaStreamTrack=void 0,this._external={},this._ID=t||mt(8,"track-"),this._originMediaStreamTrack=e,this.mediaStreamTrack=e,id(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||_t((()=>{var e;_i.reportApiInvoke(null,{name:qe.GET_MEDIA_STREAM_TRACK,options:[],tag:Qe.TRACER}).onSuccess((null===(e=this._mediaStreamTrack)||void 0===e?void 0:e.label)||"")}),this.mediaStreamTrack.id||this.getTrackId()),this._mediaStreamTrack}getRTCRtpTransceiver(t){return t===e.StreamType.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,od(this),this.emit(e.LocalTrackEvents.CLOSED),this.removeAllListeners(e.TrackEvents.SEI_RECEIVED)}_updateRtpTransceiver(t,r){if(r===e.StreamType.LOW_STREAM){if(this._lowRtpTransceiver===t)return;this._lowRtpTransceiver=t}else{if(this._rtpTransceiver===t)return;this._rtpTransceiver=t}this.emit(e.TrackEvents.TRANSCEIVER_UPDATED,t,r)}}class lR extends uR{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),this._enabled=!0,this._muted=!1,this._isExternalTrack=!1,this._isClosed=!1,this._enabledMutex=void 0,this.processor=void 0,this._handleTrackEnded=()=>{this.onTrackEnded()},this._enabledMutex=new It("".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,oi.debug("[".concat(this.getTrackId(),"] close")),this.emit(e.TrackInternalEvent.NEED_CLOSE),super.close())}async _updateOriginMediaStreamTrack(t,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._isExternalTrack=n,t!==this._originMediaStreamTrack&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),r&&this._originMediaStreamTrack.stop()),t.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=t,this._muted&&(this._originMediaStreamTrack.enabled=!1),this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await at(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){oi.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(e.LocalTrackEvents.TRACK_ENDED)}stateCheck(e,t){if(oi.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),Be(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new Fe(Ue.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print("error",oi);if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new Fe(Ue.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print("error",oi)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():sR.resolve([])}}function hR(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 pR=window.AudioContext||window.webkitAudioContext;let _R=null;const fR=new class extends Ye{constructor(){super(...arguments),this.prevState=void 0,this.curState=void 0,this.currentTime=void 0,this.currentTimeStuckAt=void 0,this.interruptDetectorTrack=void 0,this.onLocalAudioTrackMute=()=>{oi.info("ios15-interruption-start"),this.emit(e.AUDIO_CONTEXT_EVENT.IOS_15_16_INTERRUPTION_START)},this.onLocalAudioTrackUnmute=async()=>{oi.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?oi.info("ios15-interruption-end-canceled"):(_R&&await _R.suspend(),this.emit(e.AUDIO_CONTEXT_EVENT.IOS_15_16_INTERRUPTION_END))}}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){oi.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){oi.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 ER(){if(!pR)return void oi.error("your browser is not support web audio");oi.info("create audio context");const t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hR(Object(r),!0).forEach((function(t){tm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},Yn("WEBAUDIO_INIT_OPTIONS"));oi.debug("audio context init option:",JSON.stringify(t)),_R=new pR(t),fR.curState=_R.state,_R.onstatechange=()=>{fR.prevState=fR.curState,fR.curState=_R?_R.state:void 0;const{prevState:t,curState:r}=fR,n="running"===r,i="interrupted"===r,o="running"===t,a="suspended"===t,s="interrupted"===t,c=fe().osVersion;(ye()||ke())&&o&&i&&(oi.info("ios".concat(c,"-interruption-start")),fR.emit(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_START)),(ye()||ke())&&(a||s)&&n&&(oi.info("ios".concat(c,"-interruption-end")),fR.emit(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END)),t!==r&&fR.emit(e.AUDIO_CONTEXT_EVENT.STATE_CHANGE,r,t)},setInterval((()=>{var e;const t=null===(e=_R)||void 0===e?void 0:e.currentTime;if(fR.currentTime!==t)fR.currentTimeStuckAt&&(oi.debug("AudioContext current time resume at ".concat(t)),fR.currentTimeStuckAt=void 0),fR.currentTime=t;else{if(t!==fR.currentTimeStuckAt){_i.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:Qe.TRACER}).onSuccess(),oi.warning("AudioContext current time stuck at ".concat(t))}fR.currentTimeStuckAt=t}}),5e3),async function(t){const r=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","touchend","keydown","keyup"];let n,i=!1,o=!1,a=!1;function s(e){"running"===t.state?c(!1):ye()||ke()?"suspended"===t.state&&(c(!0),e&&t.resume().then(u,u)):"closed"!==t.state&&(c(!0),e&&t.resume().then(u,u))}function c(e){if(i!==e){i=e;for(let t=0,n=r;t<n.length;t+=1){const r=n[t];e?window.addEventListener(r,l,{capture:!0,passive:!0}):window.removeEventListener(r,l,{capture:!0,passive:!0})}}}function d(){s(!0)}function u(){s(!1)}function l(){s(!0)}function h(e){if(!a)if(n.paused)if(e){let e;p(!1),a=!0;try{e=n.play(),e?e.then(_,_):(n.addEventListener("playing",_),n.addEventListener("abort",_),n.addEventListener("error",_))}catch(e){_()}}else p(!0);else p(!1)}function p(e){if(o!==e){o=e;for(let t=0,n=r;t<n.length;t++){const r=n[t];e?window.addEventListener(r,f,{capture:!0,passive:!0}):window.removeEventListener(r,f,{capture:!0,passive:!0})}}}function _(){n.removeEventListener("playing",_),n.removeEventListener("abort",_),n.removeEventListener("error",_),a=!1,h(!1)}function f(){h(!0)}if(ye()){const e=t.createMediaStreamDestination(),r=document.createElement("div");r.innerHTML="<audio x-webkit-airplay='deny'></audio>",n=r.children.item(0),n.controls=!1,n.disableRemotePlayback=!0,n.preload="auto",n.srcObject=e.stream,h(!0)}fR.on(e.AUDIO_CONTEXT_EVENT.STATE_CHANGE,d),s(!1)}(_R)}function mR(){if(!_R){if(ER(),!_R)throw new Fe(Ue.NOT_SUPPORTED,"can not create audio context");return _R}return _R}function TR(){return!!_R}function gR(e){if(function(){if(null!==vR)return vR;const e=mR(),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(),vR=i,i}())return;const t=e.connect,r=e.disconnect;e.connect=(r,n,i)=>{var o;return e._inputNodes||(e._inputNodes=[]),Hc(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?dt(e._inputNodes,n):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function SR(e){const t=mR();return new sR(((r,n)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{n(new Fe(Ue.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let vR=null;let RR=null;function yR(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 AR=Xo,bR=ha,IR=so,OR=nc,CR=TypeError,wR=function(e){return function(t,r,n,i){AR(r);var o=bR(t),a=IR(o),s=OR(o),c=e?s-1:0,d=e?-1:1;if(n<2)for(;;){if(c in a){i=a[c],c+=d;break}if(c+=d,e?c<0:s<=c)throw CR("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=d)c in a&&(i=r(i,a[c],c,o));return i}},NR={left:wR(!1),right:wR(!0)},kR=gi,DR=NR.left,PR=function(e,t){var r=[][e];return!!r&&kR((function(){r.call(null,t||function(){return 1},1)}))};Ks({target:"Array",proto:!0,forced:!CT&&Do>79&&Do<83||!PR("reduce")},{reduce:function(e){var t=arguments.length;return DR(this,e,t,t>1?arguments[1]:void 0)}});var LR=lc("Array").reduce,MR=Ii,UR=LR,xR=Array.prototype,VR=J((function(e){var t=e.reduce;return e===xR||MR(xR,e)&&t===xR.reduce?UR:t}));class FR{constructor(){this.context=void 0,this.analyserNode=void 0,this.sourceNode=void 0,this.context=mR(),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||ye()||ke()||"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=VR(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){oi.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class BR extends Ye{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(),this.outputNode=void 0,this.outputTrack=void 0,this.isPlayed=!1,this.context=void 0,this.audioBufferNode=void 0,this.destNode=void 0,this.audioOutputLevel=0,this.volumeLevelAnalyser=void 0,this._processedNode=void 0,this.playNode=void 0,this.isDestroyed=!1,this.onNoAudioInput=void 0,this.isNoAudioInput=!1,this._noAudioInputCount=0,this.context=mR(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),gR(this.outputNode),this.volumeLevelAnalyser=new FR}startGetAudioBuffer(t){this.audioBufferNode||(this.audioBufferNode=this.context.createScriptProcessor(t),this.outputNode.connect(this.audioBufferNode),this.audioBufferNode.connect(this.context.destination),this.audioBufferNode.onaudioprocess=t=>{this.emit(e.AudioSourceEvents.ON_AUDIO_BUFFER,yR(t))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!mi().webAudioMediaStreamDest)throw new Fe(Ue.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&&ut((()=>{fR.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;ye()||ke()?"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 Et(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 jR extends BR{get isFreeze(){return!1}constructor(t,r,n){var i;if(super(),this.sourceNode=void 0,this.track=void 0,this.clonedTrack=void 0,this.audioElement=void 0,this.isCurrentTrackCloned=!1,this.isRemoteTrack=!1,this.originVolumeLevelAnalyser=void 0,this.rebuildWebAudio=async()=>{if(oi.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 oi.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>oi.info("resume success"))),oi.debug("rebuild web audio because of ios 12 bugs"),this.disconnect();const t=this.track;this.track=this.track.clone(),this.isCurrentTrackCloned?t.stop():this.isCurrentTrackCloned=!0;const r=new MediaStream([this.track]);this.sourceNode=this.context.createMediaStreamSource(r),gR(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const n=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(n,this.context.currentTime),gR(this.outputNode),this.emit(e.AudioSourceEvents.UPDATE_SOURCE),this.connect(),this.audioElement.srcObject=r,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()},"audio"!==t.kind)throw new Fe(Ue.UNEXPECTED_ERROR);this.track=t;const o=new MediaStream([this.track]);if(this.isRemoteTrack=!!r,this.sourceNode=this.context.createMediaStreamSource(o),gR(this.sourceNode),n){const e=n.clone();e.enabled=!0,this.clonedTrack=e,oi.debug("create an unmuted track ".concat(e.id," from the original track ").concat(n.id," to get the volume"));const t=this.context.createMediaStreamSource(new MediaStream([e]));gR(t),this.originVolumeLevelAnalyser=new FR,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=o;const a=fe();r&&a.os===ce.IOS&&Number(null===(i=a.osVersion)||void 0===i?void 0:i.split(".")[0])<15&&(fR.on(e.AUDIO_CONTEXT_EVENT.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(t){this.sourceNode.disconnect(),this.track=t,this.isCurrentTrackCloned=!1;const r=new MediaStream([t]);this.sourceNode=this.context.createMediaStreamSource(r),gR(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(e.AudioSourceEvents.UPDATE_SOURCE),this.audioElement.srcObject=r}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),fR.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),oi.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]));gR(r),this.originVolumeLevelAnalyser&&this.originVolumeLevelAnalyser.updateSource(r)}getOriginVolumeLevel(){return this.originVolumeLevelAnalyser?this.originVolumeLevelAnalyser.getVolumeLevel():this.getAccurateVolumeLevel()}}async function GR(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 HR(e,t){const r=await WR(e.mediaSource),{sourceId:n,audio:i}=await function(e,t=!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 a=document.createElement("div");a.innerText="Agora Web Screensharing wants to share the contents of your screen with webdemo.agorabeckon.com. Choose what you'd like to share.",a.setAttribute("style","height: 12%;");const s=document.createElement("div");s.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 d=document.createElement("button");d.innerHTML="cancel",d.setAttribute("style","width: 85px;"),d.onclick=()=>{document.body.removeChild(h);const e=new Error("NotAllowedError");e.name="NotAllowedError",n(e)};let u=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=u,e.onchange=()=>{u=e.checked},l.appendChild(e),l.appendChild(t)}c.appendChild(l),c.appendChild(d),o.appendChild(a),o.appendChild(s),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{const{width:e}=n.getSize();e>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:u})},s.appendChild(t)}}))}))}(r,t);return await GR(n,e,i)}async function WR(e){let t=["window","screen"];"application"!==e&&"window"!==e||(t=["window"]),"screen"===e&&(t=["screen"]);const r=Ze();if(!r)throw console.error("failed to fetch electron, please mount it to window"),new Fe(Ue.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 sR(((e,n)=>{r.desktopCapturer.getSources({types:t},((t,r)=>{t?n(t):e(r)}))})));try{return await n}catch(e){throw new Fe(Ue.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,e.toString())}}function KR(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 zR=new It("safari");async function YR(e,t){let r=0,n=null;for(;r<2;)try{n=await XR(e,t,r>0);break}catch(e){if(e instanceof Fe)throw oi.error("[".concat(t,"] ").concat(e.toString())),e;const n=JR(e.name||e.code||e,e.message);if(n.code===Ue.MEDIA_OPTION_INVALID){oi.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await Et(500);continue}throw oi.error("[".concat(t,"] ").concat(n.toString())),n}if(!n)throw new Fe(Ue.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return n}async function XR(t,r,n){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Fe(Ue.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=mi(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return oi.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(Xe())if(t.screen.sourceId){ZR(o,await GR(t.screen.sourceId,t.screen,t.screenAudio))}else{ZR(o,await HR(t.screen,t.screenAudio))}else if(Se()&&t.screen.extensionId&&t.screen.mandatory){if(!i.getStreamFromExtension)throw new Fe(Ue.NOT_SUPPORTED,"This browser does not support screen sharing");oi.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(s=t.screen.extensionId,c=r,new sR(((e,t)=>{try{chrome.runtime.sendMessage(s,{getStream:!0},(r=>{if(!r||!r.streamId)return oi.error("[".concat(c,"] No response from Chrome Plugin. Plugin not installed properly"),r),void t(new Fe(Ue.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)}))}catch(e){oi.error("[".concat(c,"] AgoraRTC screensharing plugin is not accessible(").concat(s,")"),e.toString()),t(new Fe(Ue.CHROME_PLUGIN_NOT_INSTALL))}})));t.screen.mandatory.chromeMediaSourceId=e;ZR(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(i.getDisplayMedia){var a;t.screen.mediaSource&&cd(t.screen.mediaSource);const e={width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate,displaySurface:null!==(a=t.screen.displaySurface)&&void 0!==a?a:"screen"===t.screen.mediaSource?"monitor":t.screen.mediaSource},{selfBrowserSurface:n,surfaceSwitching:i,systemAudio:s}=t.screen,c={selfBrowserSurface:n,surfaceSwitching:i,systemAudio:s};!n&&delete c.selfBrowserSurface,!i&&delete c.surfaceSwitching,!s&&delete c.systemAudio,oi.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:e,audio:!!t.screenAudio,controls:c}));const d=await navigator.mediaDevices.getDisplayMedia(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?KR(Object(r),!0).forEach((function(t){tm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({video:e,audio:!!t.screenAudio},c));ZR(o,d)}else{if(!Re())throw oi.error("[".concat(r,"] This browser does not support screenSharing")),new Fe(Ue.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&cd(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};oi.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));ZR(o,await navigator.mediaDevices.getUserMedia(e))}}var s,c;if(!t.video&&!t.audio)return o;let d={video:t.video,audio:t.audio},u=Yn("MEDIA_DEVICE_CONSTRAINTS");if(u)try{"string"==typeof u&&(u=JSON.parse(u)),d=Rt(d,u)}catch(e){}oi.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(d)),fe();let l,h=null;(ve()||ye()||ge())&&(h=await zR.lock());try{l=await navigator.mediaDevices.getUserMedia(d)}catch(e){throw h&&h(),e}return d.audio&&(e.HAS_GUM_AUDIO=!0),d.video&&(e.HAS_GUM_VIDEO=!0),ZR(o,l),h&&h(),o}function JR(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new Fe(Ue.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new Fe(Ue.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new Fe(Ue.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new Fe(Ue.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new Fe(Ue.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new Fe(Ue.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return oi.error("getUserMedia unexpected error",e),new Fe(Ue.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function ZR(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 qR extends Ye{get state(){return this._state}set state(t){t!==this._state&&(this.emit(e.DeviceManagerEvent.STATE_CHANGE,t),this._state=t)}constructor(){super(),this._state=e.DeviceManagerState.IDLE,this.isAccessMicrophonePermission=!1,this.isAccessCameraPermission=!1,this.lastAccessMicrophonePermission=!1,this.lastAccessCameraPermission=!1,this.checkdeviceMatched=!1,this.deviceInfoMap=new Map,this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(Yn("ENUMERATE_DEVICES_INTERVAL")||(Le()||me()===ce.HARMONY_OS)&&Pe())&&this.updateDevicesInfo()}),Yn("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>oi.error(e.toString())))}async enumerateDevices(t,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){return new Fe(Ue.NOT_SUPPORTED,"enumerateDevices() not supported.").throw()}const i=await navigator.mediaDevices.enumerateDevices(),o=this.checkMediaDeviceInfoIsOk(i);let a=!this.isAccessMicrophonePermission&&t,s=!this.isAccessCameraPermission&&r;o.audio&&(a=!1),o.video&&(s=!1);let c=null,d=null,u=null;if(!n&&(a||s)){if(zR.isLocked){oi.debug("[device manager] wait GUM lock");(await zR.lock())(),oi.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(a=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(s=!1,this.isAccessCameraPermission=!0),oi.debug("[device manager] check media device permissions",t,r,a,s),a&&s){try{u=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(e){const t=JR(e.name||e.code||e,e.message);if(t.code===Ue.PERMISSION_DENIED)throw t;oi.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0,this.isAccessMicrophonePermission=!0}else if(a){try{c=await navigator.mediaDevices.getUserMedia({audio:t})}catch(e){const t=JR(e.name||e.code||e,e.message);if(t.code===Ue.PERMISSION_DENIED)throw t;oi.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(s){try{d=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=JR(e.name||e.code||e,e.message);if(t.code===Ue.PERMISSION_DENIED)throw t;oi.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}oi.debug("[device manager] mic permission",t,"cam permission",r)}try{const e=await navigator.mediaDevices.enumerateDevices();return c&&c.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),c=null,d=null,u=null,e}catch(e){c&&c.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),c=null,d=null,u=null;return new Fe(Ue.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 Fe(Ue.DEVICE_NOT_FOUND,"deviceId: ".concat(e));return t}async init(){this.state=e.DeviceManagerState.INITING;try{await this.updateDevicesInfo(),this.state=e.DeviceManagerState.INITEND}catch(t){if(oi.warning("Device Detection functionality cannot start properly.",t.toString()),this.state=e.DeviceManagerState.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname)){new Fe(Ue.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.").throw()}throw t}}async updateDevicesInfo(){const t=await this.enumerateDevices(!0,!0,!0),r=Date.now(),n=[];if(t[0]&&t[0].label&&!1===this.checkdeviceMatched){this.checkdeviceMatched=!0;const e=t.find((e=>"audioinput"===e.kind&&"default"===e.deviceId)),r=t.find((e=>"audiooutput"===e.kind&&"default"===e.deviceId));e&&r?r.groupId===e.groupId?oi.debug("[device-check] default input ".concat(e.label," and output ").concat(r.label," is the same group")):oi.warning("[device-check] default input ".concat(e.label," and output ").concat(r.label," is not the same group")):oi.debug("[device-check] default input or output not found")}const i=this.checkMediaDeviceInfoIsOk(t);if(t.forEach((e=>{if(!e.deviceId)return;const t=this.deviceInfoMap.get("".concat(e.kind,"_").concat(e.deviceId));if("ACTIVE"!==(t?t.state:"INACTIVE")){const t={initAt:r,updateAt:r,device:e,state:"ACTIVE"};this.deviceInfoMap.set("".concat(e.kind,"_").concat(e.deviceId),t),n.push(t)}t&&(t.updateAt=r)})),this.deviceInfoMap.forEach(((e,t)=>{"ACTIVE"===e.state&&e.updateAt!==r&&(e.state="INACTIVE",n.push(e))})),this.state!==e.DeviceManagerState.INITEND)return i.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),void(i.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0));n.forEach((t=>{switch(t.device.kind){case"audioinput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(e.DeviceManagerEvent.RECORDING_DEVICE_CHANGED,t);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(e.DeviceManagerEvent.CAMERA_DEVICE_CHANGED,t);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(e.DeviceManagerEvent.PLAYOUT_DEVICE_CHANGED,t)}})),i.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),i.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 QR=new qR;let $R=!1;const ey=new class extends Ye{constructor(){super(...arguments),this.onAutoplayFailed=void 0,this.onAudioAutoplayFailed=void 0}};function ty(){if(fe(),!$R){const e=t=>{t.preventDefault(),$R=!1,Me()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};$R=!0,Me()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),oi.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),ey.onAutoplayFailed?ey.onAutoplayFailed():ey.onAudioAutoplayFailed?oi.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 ."):oi.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 ."),ey.emit("autoplay-failed")}}function ry(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 ny(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ry(Object(r),!0).forEach((function(t){tm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ry(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function iy(e,t,r,n){if(!e)return;const i=_i.getBaseInfoBySessionId(e);if(!i)return;const o=i.info,a=Date.now(),s=ny(ny({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:a,elapse:a-i.startTime,cbRegistered:ey.onAutoplayFailed||ey.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:n,extend:void 0});_i.send({type:di.AUTOPLAY_FAILED,data:s},!0)}const oy=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],ay=new class{constructor(){this.onAutoplayFailed=void 0,this.elementMap=new Map,this.elementStateMap=new Map,this.elementsNeedToResume=[],this.sinkIdMap=new Map,this.autoResumeAfterInterruption=e=>{Array.from(this.elementMap.entries()).forEach((t=>{let[r,n]=t;const i=this.elementStateMap.get(r),o=n.srcObject.getAudioTracks()[0],a=o&&o.readyState;if(oi.debug("resume after interrupted, ele: ".concat(i," audio: ").concat(a," ").concat(e)),"live"===a){if(e)return n.pause(),void n.play();if("running"===fR.curState)return Ce()?(n.pause(),void n.play()):void(i&&"paused"===i&&n.play())}}))},this.autoResumeAfterInterruptionOnIOS15_16=()=>{Array.from(this.elementMap.entries()).forEach((e=>{let[t,r]=e;const n=r.srcObject.getAudioTracks()[0];n&&"live"===n.readyState&&(oi.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))},this.autoResumeAudioElement(),fR.on(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),fR.on(e.AUDIO_CONTEXT_EVENT.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),fR.on(e.AUDIO_CONTEXT_EVENT.STATE_CHANGE,(()=>{ye()&&"suspended"===fR.prevState&&"running"===fR.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 Fe(Ue.PERMISSION_DENIED,"can not set sink id: "+e.toString())}}play(t,r,n,i){if(this.elementMap.has(r))return;const o=document.createElement("audio");o.autoplay=!0,o.srcObject=new MediaStream([t]),this.bindAudioElementEvents(r,o),this.elementMap.set(r,o),this.elementStateMap.set(r,e.MediaElementStatus.INIT),this.setVolume(r,n);const a=this.sinkIdMap.get(r);if(a)try{o.setSinkId(a).catch((e=>{oi.warning("[".concat(r,"] set sink id failed"),e.toString())}))}catch(e){oi.warning("[".concat(r,"] set sink id failed"),e.toString())}const s=o.play();s&&s.then&&s.catch((e=>{i&&iy(i,"audio",e.message,r),oi.warning("audio element play warning",e.toString()),this.elementMap.has(r)&&"NotAllowedError"===e.name&&(oi.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(o),ut((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),ty()})))}))}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)}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)}bindAudioElementEvents(e,t){oy.forEach((r=>{t.addEventListener(r,(r=>{const n=this.elementStateMap.get(e),i="pause"===r.type?"paused":r.type;if(oi.debug("[".concat(e,"] audio-element-status change ").concat(n," => ").concat(i)),"error"===r.type){const r=null==t?void 0:t.error;r&&oi.error("[".concat(e,"] media error, code: ").concat(r.code,", message: ").concat(r.message))}this.elementStateMap.set(e,i)}))}))}getPlayerState(e){return this.elementStateMap.get(e)||"uninit"}autoResumeAudioElement(){const e=()=>{this.elementsNeedToResume.forEach((e=>{e.play().then((e=>{oi.debug("Auto resume audio element success")})).catch((e=>{oi.warning("Auto resume audio element failed!",e)}))})),this.elementsNeedToResume=[]};new Promise((e=>{document.body?e():window.addEventListener("load",(()=>e()))})).then((()=>{Me()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0))}))}};function sy(){return function(e,t,r){const n=r.value;return"function"==typeof n&&(r.value=function(){this._isClosed&&new Fe(Ue.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning",oi);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 sR?new sR(((e,t)=>{i.then(e).catch(t)})):i}),r}}var cy=lc("Array").values,dy=Ic,uy=fa,ly=Ii,hy=cy,py=Array.prototype,_y={DOMTokenList:!0,NodeList:!0},fy=J((function(e){var t=e.values;return e===py||ly(py,e)&&t===py.values||uy(_y,dy(e))?hy:t}));function Ey(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 my(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ey(Object(r),!0).forEach((function(t){tm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ey(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class Ty extends Ye{constructor(e){super(),this.name="VideoProcessorDestination",this.ID="0",this._source=void 0,this.videoContext=void 0,this.inputTrack=void 0,this.videoContext=e}get kind(){return"video"}get enabled(){return!0}pipe(){throw new Fe(Ue.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}unpipe(){throw new Fe(Ue.NOT_SUPPORTED,"VideoProcessor cannot unpipe to any other Processor")}enable(){}disable(){}updateInput(t){if(t.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).");t.track&&t.track!==this.inputTrack&&(this.videoContext.chained=!0,this.inputTrack=t.track,this.emit(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK,t.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK,void 0)}}class gy extends Ye{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),this.constraintsMap=new Map,this.statsRegistry=[],this.usageRegistry=[],this.trackId=void 0,this.direction=void 0,this._chained=!1,this.trackId=e,this.direction=t}async getConstraints(){return await ot(this,e.PROCESSOR_CONTEXT_EVENTS.REQUEST_CONSTRAINTS)}async requestApplyConstraints(t,r){var n;return oi.info("processor ".concat(r.name," requestApplyConstraints for ").concat(this.trackId)),t&&this.constraintsMap.set(r,t),at(this,e.PROCESSOR_CONTEXT_EVENTS.REQUEST_UPDATE_CONSTRAINTS,Array.from(fy(n=this.constraintsMap).call(n)))}async requestRevertConstraints(t){var r;if(this.constraintsMap.has(t))return oi.info("processor ".concat(t.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(t),at(this,e.PROCESSOR_CONTEXT_EVENTS.REQUEST_UPDATE_CONSTRAINTS,Array.from(fy(r=this.constraintsMap).call(r)))}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{processorID:t,processorName:r,type:n,cb:i}of this.statsRegistry)try{const o=i();e.push({processorID:t,processorName:r,type:n,stats:o})}catch(e){oi.error(new Fe(Ue.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{cb:t}of this.usageRegistry)try{let r=t();r instanceof sR&&(r=await r),e.push(my(my({},r),{},{direction:this.direction}))}catch(e){oi.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class Sy extends Ye{constructor(e){super(),this.name="AudioProcessorDestination",this.ID="0",this.inputTrack=void 0,this.inputNode=void 0,this.audioProcessorContext=void 0,this._source=void 0,this.audioProcessorContext=e}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new Fe(Ue.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new Fe(Ue.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(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK,void 0),this.emit(e.PROCESSOR_DESTINATION_EVENTS.ON_NODE,void 0)}updateInput(t){if(t.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).");t.track&&this.inputTrack!==t.track&&(this.audioProcessorContext.chained=!0,this.inputTrack=t.track,this.emit(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK,this.inputTrack)),t.node&&this.inputNode!==t.node&&(this.audioProcessorContext.chained=!0,this.inputNode=t.node,this.emit(e.PROCESSOR_DESTINATION_EVENTS.ON_NODE,this.inputNode))}}class vy extends Ye{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),this.constraintsMap=new Map,this.statsRegistry=[],this.audioContext=void 0,this.trackId=void 0,this.direction=void 0,this.usageRegistry=[],this._chained=!1,this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return ot(this,e.PROCESSOR_CONTEXT_EVENTS.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(t,r){var n;return oi.info("processor ".concat(r.name," requestApplyConstraints for ").concat(this.trackId)),t&&this.constraintsMap.set(r,t),at(this,e.PROCESSOR_CONTEXT_EVENTS.REQUEST_UPDATE_CONSTRAINTS,Array.from(fy(n=this.constraintsMap).call(n)))}async requestRevertConstraints(t){var r;if(this.constraintsMap.has(t))return this.constraintsMap.delete(t),at(this,e.PROCESSOR_CONTEXT_EVENTS.REQUEST_UPDATE_CONSTRAINTS,Array.from(fy(r=this.constraintsMap).call(r)))}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{processorID:t,processorName:r,type:n,cb:i}of this.statsRegistry)try{const o=i();e.push({processorID:t,processorName:r,type:n,stats:o})}catch(e){oi.error(new Fe(Ue.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{cb:t}of this.usageRegistry)try{let r=t();r instanceof sR&&(r=await r),e.push(my(my({},r),{},{direction:this.direction}))}catch(e){oi.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class Ry extends Ye{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),this.context=void 0,this.processSourceNode=void 0,this.outputTrack=void 0,this.processedNode=void 0,this.clonedTrack=void 0,this.outputNode=void 0,this.outputNode=new yy}setVolume(){}createOutputTrack(){throw new Fe(Ue.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 yy{disconnect(){}connect(){}}function Ay(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 by(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ay(Object(r),!0).forEach((function(t){tm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ay(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class Iy extends lR{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?ay.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,n){super(e,r),this.trackMediaType="audio",this._encoderConfig=void 0,this._trackSource=void 0,this._enabled=!0,this._volume=100,this._useAudioElement=!0,this._bypassWebAudio=!1,this.processor=void 0,this._processorContext=void 0,this._processorDestination=void 0,this._getOriginVolumeLevel=void 0,this._encoderConfig=t,this._getOriginVolumeLevel=!!n,this._trackSource=new Ry,Yn("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),Yn("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);ve()&&!TR()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(t){Ge(t,"volume",0,1e3),this._volume=t,this._source.setVolume(t/100),this._useAudioElement&&ay.setVolume(this.getTrackId(),t);try{if(this._bypassWebAudio)return void oi.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const t=this._source.createOutputTrack();this._mediaStreamTrack!==t&&(this._mediaStreamTrack=t,at(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this).then((()=>{oi.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{oi.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||!Se()&&Yn("RESTRICTION_SET_PLAYBACK_DEVICE"))throw new Fe(Ue.NOT_SUPPORTED,"your browser does not support setting the audio output device");await ay.setSinkID(this.getTrackId(),e)}async setEnabled(e,t,r){return this._setEnabled(e,t,r)}async _setEnabled(t,r,n){if(!n){if(t===this._enabled)return;this.stateCheck("enabled",t)}if(oi.info("[".concat(this.getTrackId(),"] start setEnabled"),t),t){this._originMediaStreamTrack.enabled=!0;try{n||(this._enabled=!0),await at(this,e.TrackInternalEvent.NEED_ENABLE_TRACK,this),oi.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(t," success"))}catch(e){throw n||(this._enabled=!1),oi.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,n||(this._enabled=!1);try{await at(this,e.TrackInternalEvent.NEED_DISABLE_TRACK,this)}catch(e){throw n||(this._enabled=!0),oi.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}}}async setMuted(t){t!==this._muted&&(this.stateCheck("muted",t),this._muted=t,this._originMediaStreamTrack.enabled=!t,oi.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(t)),t?await at(this,e.TrackInternalEvent.NEED_MUTE_TRACK,this):await at(this,e.TrackInternalEvent.NEED_UNMUTE_TRACK,this))}getStats(){_t((()=>{oi.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const t=st(this,e.TrackInternalEvent.GET_STATS);return t||by({},Td)}setAudioFrameCallback(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!t)return this._source.removeAllListeners(e.AudioSourceEvents.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(r),this._source.removeAllListeners(e.AudioSourceEvents.ON_AUDIO_BUFFER),this._source.on(e.AudioSourceEvents.ON_AUDIO_BUFFER,(e=>t(e)))}play(){oi.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(oi.debug("[".concat(this.getTrackId(),"] start audio playback in element")),ay.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){oi.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?ay.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._source.destroy()}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];oi.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&ay.updateTrack(this.getTrackId(),this._mediaStreamTrack)}async _updateOriginMediaStreamTrack(t,r){this._originMediaStreamTrack!==t&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),r&&this._originMediaStreamTrack.stop()),t.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=t,this._muted&&(this._originMediaStreamTrack.enabled=!1),this.processor&&this._processorContext&&this.processor.updateInput({track:t,context:this._processorContext}),this._mediaStreamTrack!==this._source.outputTrack?(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await at(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(t))}renewMediaStreamTrack(e){return sR.resolve(void 0)}pipe(e){if(this._bypassWebAudio)throw new Fe(Ue.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new Fe(Ue.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),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,t.reset()}bindProcessorDestinationEvents(t){t.on(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK,(async t=>{t?t!==this._mediaStreamTrack&&(this._mediaStreamTrack=t,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(t),await at(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await at(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this))})),t.on(e.PROCESSOR_DESTINATION_EVENTS.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(t){t.removeAllListeners(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK),t.removeAllListeners(e.PROCESSOR_DESTINATION_EVENTS.ON_NODE)}bindProcessorContextEvents(t){t.on(e.PROCESSOR_CONTEXT_EVENTS.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(t){t.removeAllListeners(e.PROCESSOR_CONTEXT_EVENTS.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof Ry&&(this._trackSource=new jR(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const t=new vy(this._source.context,this.getTrackId(),"local"),r=new Sy(t);return this._processorContext=t,this._processorDestination=r,this.bindProcessorContextEvents(t),this.bindProcessorDestinationEvents(r),this._source.on(e.AudioSourceEvents.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:t})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(ay.stop(this.getTrackId()),this._source.play()),at(this,e.TrackInternalEvent.NEED_REPLACE_MIXING_TRACK,this).then((()=>{oi.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{oi.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:t,processorDestination:r}}}cR([pi({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),dR("design:type",Function),dR("design:paramtypes",[Number]),dR("design:returntype",void 0)],Iy.prototype,"setVolume",null),cR([pi({argsMap:(e,t)=>[e.getTrackId(),t]}),sy(),dR("design:type",Function),dR("design:paramtypes",[String]),dR("design:returntype",sR)],Iy.prototype,"setPlaybackDevice",null),cR([Ot("LocalAudioTrack","_enabledMutex"),pi({argsMap:(e,t)=>[e.getTrackId(),t]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Boolean,Object,Boolean]),dR("design:returntype",sR)],Iy.prototype,"setEnabled",null),cR([Ot("LocalAudioTrack","_enabledMutex"),pi({argsMap:(e,t)=>[e.getTrackId(),t]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Boolean]),dR("design:returntype",sR)],Iy.prototype,"setMuted",null),cR([sy(),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",Object)],Iy.prototype,"getStats",null),cR([sy(),dR("design:type",Function),dR("design:paramtypes",[Object,Number]),dR("design:returntype",void 0)],Iy.prototype,"setAudioFrameCallback",null),cR([pi({argsMap:e=>[e.getTrackId()]}),sy(),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],Iy.prototype,"play",null),cR([pi({argsMap:e=>[e.getTrackId()]}),sy(),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],Iy.prototype,"stop",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],Iy.prototype,"close",null),cR([pi({argsMap:(e,t)=>[e.getTrackId(),t.name]}),dR("design:type",Function),dR("design:paramtypes",[Object]),dR("design:returntype",Object)],Iy.prototype,"pipe",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],Iy.prototype,"unpipe",null);class Oy extends Iy{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,n){super(e,t.encoderConfig?rd(t.encoderConfig):{},n,Yn("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),this._config=void 0,this._deviceName="default",this._constraints=void 0,this._originalConstraints=void 0,this._enabled=!0,this._config=t,this._constraints=r,this._originalConstraints=r,this._deviceName=e.label,"boolean"==typeof t.bypassWebAudio&&(this._bypassWebAudio=t.bypassWebAudio),(Ce()||we())&&fR.bindInterruptDetectorTrack(this)}async setDevice(e){if(oi.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await QR.getDeviceById(e),r={};r.audio=by({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let n=null;try{n=await YR(r,this.getTrackId())}catch(e){throw oi.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await YR({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 oi.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await QR.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw oi.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}oi.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(t,r,n){if(r)return oi.debug("[".concat(this.getTrackId(),"] setEnabled false (do not close microphone)")),await super._setEnabled(t);if(!n){if(t===this._enabled)return;this.stateCheck("enabled",t)}if(oi.info("[".concat(this.getTrackId(),"] start setEnabled"),t),!t){var i;this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),null===(i=this._source.clonedTrack)||void 0===i||i.stop(),n||(this._enabled=!1);try{await at(this,e.TrackInternalEvent.NEED_DISABLE_TRACK,this)}catch(e){throw oi.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const o=by({},this._constraints),a=QR.searchDeviceIdByName(this._deviceName);a&&!o.deviceId&&(o.deviceId=a);try{n||(this._enabled=!0);const t=await YR({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(t.getAudioTracks()[0],!1),await at(this,e.TrackInternalEvent.NEED_ENABLE_TRACK,this)}catch(e){throw n||(this._enabled=!1),oi.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}oi.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(Ce()||we())&&fR.unbindInterruptDetectorTrack(this)}onTrackEnded(){if((ye()||ke())&&this._enabled&&!this._isClosed&&fR.duringInterruption){const t=async()=>{fR.off(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,t),this._enabled&&!this._isClosed&&(oi.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};fR.on(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,t)}else oi.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(e.LocalTrackEvents.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=QR.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await YR({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(t){super.bindProcessorContextEvents(t),t.on(e.PROCESSOR_CONTEXT_EVENTS.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(t){super.unbindProcessorContextEvents(t),t.removeAllListeners(e.PROCESSOR_CONTEXT_EVENTS.REQUEST_UPDATE_CONSTRAINTS)}}cR([pi({argsMap:(e,t)=>[e.getTrackId(),t]}),sy(),dR("design:type",Function),dR("design:paramtypes",[String]),dR("design:returntype",sR)],Oy.prototype,"setDevice",null),cR([Ot("MicrophoneAudioTrack","_enabledMutex"),pi({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Boolean,Boolean,Boolean]),dR("design:returntype",sR)],Oy.prototype,"setEnabled",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],Oy.prototype,"close",null);class Cy extends Iy{get __className__(){return"BufferSourceAudioTrack"}constructor(t,r,n,i){super(r.createOutputTrack(),n,i),this.source=void 0,this._bufferSource=void 0,this._useAudioElement=!1,this.source=t,this._bufferSource=r,this._bufferSource.on(e.AudioSourceEvents.AUDIO_SOURCE_STATE_CHANGE,(t=>{this.safeEmit(e.LocalTrackEvents.SOURCE_STATE_CHANGE,t)}));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){Ge(e,"speed",0),this._bufferSource.setAudioBufferPlaybackSpeed(e)}}cR([pi({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Object]),dR("design:returntype",void 0)],Cy.prototype,"startProcessAudioBuffer",null),cR([pi({argsMap:e=>[e.getTrackId()]}),sy(),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],Cy.prototype,"pauseProcessAudioBuffer",null),cR([pi({argsMap:e=>[e.getTrackId()]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Number]),dR("design:returntype",void 0)],Cy.prototype,"seekAudioBuffer",null),cR([pi({argsMap:e=>[e.getTrackId()]}),sy(),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],Cy.prototype,"resumeProcessAudioBuffer",null),cR([pi({argsMap:e=>[e.getTrackId()]}),sy(),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],Cy.prototype,"stopProcessAudioBuffer",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],Cy.prototype,"close",null),cR([pi({argsMap:e=>[e.getTrackId()]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Number]),dR("design:returntype",void 0)],Cy.prototype,"setAudioBufferPlaybackSpeed",null);class wy extends Iy{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=mR().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,mt(8,"track-mix-")),this.trackList=void 0,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)?(oi.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):oi.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){oi.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}dt(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(t){this._rtpTransceiver!==t&&(this._rtpTransceiver=t,this.trackList.forEach((r=>{r instanceof wy?r.emit(e.TrackEvents.TRANSCEIVER_UPDATED,t):r._updateRtpTransceiver(t)})))}}function Ny(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=Qc(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!De()&&r.frameRate&&(t.frameRate=r.frameRate),fe().name===de.EDGE&&"object"==typeof t.frameRate&&(t.frameRate.max=60),Re()&&(t.frameRate={ideal:30,max:30}),t}function ky(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&Se()&&(t.extensionId=e.extensionId);const{displaySurface:r,selfBrowserSurface:n,surfaceSwitching:i,systemAudio:o}=e;(Ae(107)||be(107)||Oe(93))&&(r&&(je(r,"displaySurface",["browser","window","monitor"]),t.displaySurface=r),n?(je(n,"selfBrowserSurface",["exclude","include"]),t.selfBrowserSurface=n):t.selfBrowserSurface="include",i&&(je(i,"surfaceSwitching",["exclude","include"]),t.surfaceSwitching=i)),(Ae(105)||be(105)||Oe(91))&&o&&(je(o,"systemAudio",["exclude","include"]),t.systemAudio=o),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const a=e.encoderConfig?$c(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:a?a.width:void 0,maxHeight:a?a.height:void 0},a&&(a.frameRate&&("number"==typeof a.frameRate?(t.mandatory.maxFrameRate=a.frameRate,t.mandatory.minFrameRate=a.frameRate):(t.mandatory.maxFrameRate=a.frameRate.max||a.frameRate.ideal||a.frameRate.exact||void 0,t.mandatory.minFrameRate=a.frameRate.min||a.frameRate.ideal||a.frameRate.exact||void 0),t.frameRate=a.frameRate),a.width&&(t.width=a.width),a.height&&(t.height=a.height)),t}function Dy(e){const t={};if(De()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,Se()&&e.ANS&&(t.googHighpassFilter=e.ANS))),e.encoderConfig){const r=rd(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),Le()&&(t.sampleRate=void 0),t}class Py extends BR{set currentState(t){t!==this._currentState&&(this._currentState=t,this.safeEmit(e.AudioSourceEvents.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(),this.audioBuffer=void 0,this.sourceNode=void 0,this.startPlayTime=0,this.startPlayOffset=0,this.pausePlayTime=0,this.options=void 0,this.currentLoopCount=0,this.currentPlaybackSpeed=100,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):oi.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 Ly=new Map;const My=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new sR(((r,n)=>{t.toBlob((async e=>{if(t.remove(),e){const n=await Uy(e);r({buffer:n,width:t.width,height:t.height})}else n(new Fe(Ue.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},Uy=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function xy(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 Vy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xy(Object(r),!0).forEach((function(t){tm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xy(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class Fy{get videoElementStatus(){return this._videoElementStatus}set videoElementStatus(e){e!==this._videoElementStatus&&(oi.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&&(oi.debug("[".concat(this.trackId,"] video-status change ").concat(this._videoState," => ").concat(e)),this._videoState=e,null===(t=this.onVideoStateChanged)||void 0===t||t.call(this,this.videoState))}constructor(t){this.trackId=void 0,this.config=void 0,this.onFirstVideoFrameDecoded=void 0,this.onVideoStateChanged=void 0,this.freezeTimeCounterList=[],this.renderFreezeAccTime=0,this.isKeepLastFrame=!1,this.timeUpdatedCount=0,this.freezeTime=0,this.playbackTime=0,this.lastTimeUpdatedTime=0,this.autoplayFailed=!1,this.videoTrack=void 0,this.videoElement=void 0,this.cacheVideoElement=void 0,this._videoState=e.VideoState.VideoStateStopped,this.videoElementCheckInterval=void 0,this.videoElementFreezeTimeout=void 0,this._videoElementStatus=e.MediaElementStatus.NONE,this.isGettingVideoDimensions=!1,this.startGetVideoDimensions=()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return oi.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()},this.autoResumeAfterInterruption=()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===fR.curState&&(oi.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Te())),Ne()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))},this.handleVideoEvents=t=>{switch(t.type){case"play":case"playing":this.startGetVideoDimensions(),this.videoElementStatus=e.MediaElementStatus.PLAYING;break;case"loadeddata":if(this.videoState=e.VideoState.VideoStateStarting,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=e.MediaElementStatus.CANPLAY;break;case"stalled":this.videoElementStatus=e.MediaElementStatus.STALLED;break;case"suspend":this.videoElementStatus=e.MediaElementStatus.SUSPEND;break;case"pause":this.videoElementStatus=e.MediaElementStatus.PAUSED,ye()||ke()||ve()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(oi.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=e.MediaElementStatus.WAITING;break;case"abort":this.videoElementStatus=e.MediaElementStatus.ABORT;break;case"ended":this.videoElementStatus=e.MediaElementStatus.ENDED;break;case"emptied":this.videoElementStatus=e.MediaElementStatus.EMPTIED;break;case"error":{this.videoElementStatus=e.MediaElementStatus.ERROR;const t=this.videoElement.error;t&&oi.error("[".concat(this.trackId,"] media error, code: ").concat(t.code,", message: ").concat(t.message));break}case"timeupdate":{const e=performance.now();if(this.timeUpdatedCount+=1,this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime,r=this.lastTimeUpdatedTime;if(this.lastTimeUpdatedTime=e,fA.lastVisibleTime<fA.lastHiddenTime||r<fA.lastHiddenTime||r<fA.lastVisibleTime)return;for(t>Yn("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}}},this.autoResumeAfterInterruptionOnIOS15_16=()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(oi.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Te())),Ne()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))},this.trackId=t.trackId,this.config=t,t.element instanceof HTMLVideoElement?this.videoElement=t.element:this.videoElement=document.createElement("video"),fR.on(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),fR.on(e.AUDIO_CONTEXT_EVENT.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&&iy(e,"video",t.message,this.trackId),"NotAllowedError"===t.name?(oi.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):oi.warning("[".concat(this.trackId,"] play warning: "),t)}));const r=fe();if(("Safari"===r.name&&15===Number(r.version)||Ce())&&t&&t.then){const e=()=>{this.config.mirror&&(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 oi.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 sR(((n,i)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await Uy(e);n({buffer:t,width:r.width,height:r.height})}else i(new Fe(Ue.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,t<0?.1:t>1?1:t)}))):await My(e)}destroy(){fR.off(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),fR.off(e.AUDIO_CONTEXT_EVENT.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=e.VideoState.VideoStateStopped}initVideoElement(){if(this.videoElementStatus=e.MediaElementStatus.INIT,!this.videoElementCheckInterval&&(By.forEach((e=>{this.videoElement.addEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((()=>{(function(e){return e!==document.body&&document.body.contains(e)})(this.videoElement)||(this.videoElementStatus=e.MediaElementStatus.DESTROYED)}),1e3),Yn("ENABLE_VIDEO_FRAME_CALLBACK"))){var t,r;let n;const i=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",i),this.videoElementFreezeTimeout=window.setTimeout(o,Yn("VIDEO_FREEZE_DURATION")))},o=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===e.VideoState.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=e.VideoState.VideoStateFrozen:document.addEventListener("visibilitychange",i))},a=(t,r)=>{if(this.videoElementStatus===e.MediaElementStatus.PLAYING){if(n){const t=r.presentationTime-n.presentationTime;this.videoState===e.VideoState.VideoStateStarting&&(this.videoState=e.VideoState.VideoStateDecoding),this.videoState===e.VideoState.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(o,Yn("VIDEO_FREEZE_DURATION"))),t<Yn("VIDEO_FREEZE_DURATION")&&this.videoState===e.VideoState.VideoStateFrozen&&(this.videoState=e.VideoState.VideoStateDecoding),t>Yn("VIDEO_FREEZE_DURATION")&&fA.lastVisibleTime>=fA.lastHiddenTime&&n.timestamp>fA.lastVisibleTime&&n.timestamp>fA.lastHiddenTime&&(this.renderFreezeAccTime+=t)}n=Vy(Vy({},r),{},{timestamp:t})}var i,s;Yn("ENABLE_VIDEO_FRAME_CALLBACK")&&(null===(i=(s=this.videoElement).requestVideoFrameCallback)||void 0===i||i.call(s,a))};null===(t=(r=this.videoElement).requestVideoFrameCallback)||void 0===t||t.call(r,a)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),Le()&&(this.videoElement.poster="noposter");const n=fe();if("Safari"===n.name&&15===Number(n.version)||Ce()||!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,Re()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,Re()&&this.videoElement.load();const i=this.videoElement.play();void 0!==i&&i.catch((e=>{oi.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){By.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.videoElementStatus=e.MediaElementStatus.NONE}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{oi.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{oi.error(e)})),this.autoplayFailed=!1,Me()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};Me()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),ty()}}const By=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class jy extends Fy{constructor(e){super(e),this.container=void 0,this.slot=void 0,this.slot=e.element,this.updateConfig(e)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;t!==this.slot&&(this.destroy(),this.slot=t),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 My(e)}destroy(){if(super.destroy(),this.videoElement.remove(),this.videoElement=document.createElement("video"),this.container){try{this.container.remove(),this.slot.removeChild(this.container)}catch(e){}this.container=void 0}}createElements(){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",Yn("KEEP_LAST_FRAME")&&this.isKeepLastFrame&&this.videoElement.paused&&this.resetVideoElement(),this.mountedVideoElement()):this.unmountedVideoElement(),this.slot.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}}function Gy(e){return new sR(((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=ye()?"canplay":"playing";i.addEventListener(o,(()=>{const e=i.videoWidth,r=i.videoHeight;!e&&Re()||(n=!0,i.srcObject=null,i.remove(),t([e,r]))})),i.srcObject=new MediaStream([e]),i.play().catch(Tt),setTimeout((()=>{n||(i.srcObject=null,i.remove(),t([i.videoWidth,i.videoHeight]))}),4e3)}))}function Hy(e,t,r,n,i){const o=Yn("BITRATE_ADAPTER_TYPE");if("DEFAULT_BITRATE"===o)return{min:n,max:i};if(void 0===i){var a;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!==(a=n)&&void 0!==a?a:s}else{var s;n=null!==(s=n)&&void 0!==s?s:Math.floor(i/10)}return{min:n,max:i}}function Wy(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 Ky=e=>{const t=e._encoderConfig;if(!t)return;const{frameRate:r,width:n,height:i}=e.getMediaStreamTrackSettings();let{frameRate:o=r,width:a=n,height:s=i}=t;if(!o||!a||!s)return;a=yt(a),s=yt(s),o=yt(o);const{max:c,min:d}=Wy(a,s,o),{bitrateMax:u,bitrateMin:l}=t||{};return u||oi.debug("calculate bitrate: [w: ".concat(a,", h: ").concat(s,", fps: ").concat(o,"] => [brMax: ").concat(u,", brMin: ").concat(l,"]")),{frameRate:o,bitrateMax:u||c,bitrateMin:l||d,scaleResolutionDownBy:1,scale:0}},zy=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,a){return n(function(e,t){return e<<t|e>>>32-t}(n(n(t,e),n(i,a)),o),r)}function o(e,t,r,n,o,a,s){return i(t&r|~t&n,e,t,o,a,s)}function a(e,t,r,n,o,a,s){return i(t&n|r&~n,e,t,o,a,s)}function s(e,t,r,n,o,a,s){return i(t^r^n,e,t,o,a,s)}function c(e,t,r,n,o,a,s){return i(r^(t|~n),e,t,o,a,s)}const d=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 u,l,h,p,_,f=1732584193,E=-271733879,m=-1732584194,T=271733878;for(u=0;u<d.length;u+=16)l=f,h=E,p=m,_=T,f=o(f,E,m,T,d[u+0],7,-680876936),T=o(T,f,E,m,d[u+1],12,-389564586),m=o(m,T,f,E,d[u+2],17,606105819),E=o(E,m,T,f,d[u+3],22,-1044525330),f=o(f,E,m,T,d[u+4],7,-176418897),T=o(T,f,E,m,d[u+5],12,1200080426),m=o(m,T,f,E,d[u+6],17,-1473231341),E=o(E,m,T,f,d[u+7],22,-45705983),f=o(f,E,m,T,d[u+8],7,1770035416),T=o(T,f,E,m,d[u+9],12,-1958414417),m=o(m,T,f,E,d[u+10],17,-42063),E=o(E,m,T,f,d[u+11],22,-1990404162),f=o(f,E,m,T,d[u+12],7,1804603682),T=o(T,f,E,m,d[u+13],12,-40341101),m=o(m,T,f,E,d[u+14],17,-1502002290),E=o(E,m,T,f,d[u+15],22,1236535329),f=a(f,E,m,T,d[u+1],5,-165796510),T=a(T,f,E,m,d[u+6],9,-1069501632),m=a(m,T,f,E,d[u+11],14,643717713),E=a(E,m,T,f,d[u+0],20,-373897302),f=a(f,E,m,T,d[u+5],5,-701558691),T=a(T,f,E,m,d[u+10],9,38016083),m=a(m,T,f,E,d[u+15],14,-660478335),E=a(E,m,T,f,d[u+4],20,-405537848),f=a(f,E,m,T,d[u+9],5,568446438),T=a(T,f,E,m,d[u+14],9,-1019803690),m=a(m,T,f,E,d[u+3],14,-187363961),E=a(E,m,T,f,d[u+8],20,1163531501),f=a(f,E,m,T,d[u+13],5,-1444681467),T=a(T,f,E,m,d[u+2],9,-51403784),m=a(m,T,f,E,d[u+7],14,1735328473),E=a(E,m,T,f,d[u+12],20,-1926607734),f=s(f,E,m,T,d[u+5],4,-378558),T=s(T,f,E,m,d[u+8],11,-2022574463),m=s(m,T,f,E,d[u+11],16,1839030562),E=s(E,m,T,f,d[u+14],23,-35309556),f=s(f,E,m,T,d[u+1],4,-1530992060),T=s(T,f,E,m,d[u+4],11,1272893353),m=s(m,T,f,E,d[u+7],16,-155497632),E=s(E,m,T,f,d[u+10],23,-1094730640),f=s(f,E,m,T,d[u+13],4,681279174),T=s(T,f,E,m,d[u+0],11,-358537222),m=s(m,T,f,E,d[u+3],16,-722521979),E=s(E,m,T,f,d[u+6],23,76029189),f=s(f,E,m,T,d[u+9],4,-640364487),T=s(T,f,E,m,d[u+12],11,-421815835),m=s(m,T,f,E,d[u+15],16,530742520),E=s(E,m,T,f,d[u+2],23,-995338651),f=c(f,E,m,T,d[u+0],6,-198630844),T=c(T,f,E,m,d[u+7],10,1126891415),m=c(m,T,f,E,d[u+14],15,-1416354905),E=c(E,m,T,f,d[u+5],21,-57434055),f=c(f,E,m,T,d[u+12],6,1700485571),T=c(T,f,E,m,d[u+3],10,-1894986606),m=c(m,T,f,E,d[u+10],15,-1051523),E=c(E,m,T,f,d[u+1],21,-2054922799),f=c(f,E,m,T,d[u+8],6,1873313359),T=c(T,f,E,m,d[u+15],10,-30611744),m=c(m,T,f,E,d[u+6],15,-1560198380),E=c(E,m,T,f,d[u+13],21,1309151649),f=c(f,E,m,T,d[u+4],6,-145523070),T=c(T,f,E,m,d[u+11],10,-1120210379),m=c(m,T,f,E,d[u+2],15,718787259),E=c(E,m,T,f,d[u+9],21,-343485551),f=n(f,l),E=n(E,h),m=n(m,p),T=n(T,_);return r(f)+r(E)+r(m)+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))};function Yy(e,t){if("VideoFrame"in window&&"TransformStream"in window&&mi().supportWebRTCInsertableStream){const r=new MediaStreamTrackProcessor(e),n=new MediaStreamTrackGenerator({kind:"video"});let i,o,a=Date.now();const s=()=>{c&&(clearInterval(c),c=void 0),i&&(i.close(),i=void 0),e.stop(),o=void 0,n.removeEventListener("ended",s)};let c=window.setInterval((()=>{if(o&&i&&Date.now()-a>(null!=t?t:1e3))try{"live"===n.readyState?o.enqueue(i.clone()):s()}catch(e){s()}}),null!=t?t:1e3);const d=new TransformStream({transform:(e,t)=>{"live"===n.readyState?(o=t,a=Date.now(),void 0===i?(i=e,t.enqueue(e.clone())):(t.enqueue(i),i=e)):e.close()}});return n.addEventListener("ended",s),r.readable.pipeThrough(d).pipeTo(n.writable),n}}function Xy(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 Jy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Xy(Object(r),!0).forEach((function(t){tm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Xy(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var Zy,qy,Qy;!function(e){e[e.DISABLED=0]="DISABLED",e[e.MAINTAIN_FRAMERATE=1]="MAINTAIN_FRAMERATE",e[e.MAINTAIN_RESOLUTION=2]="MAINTAIN_RESOLUTION",e[e.BALANCED=3]="BALANCED"}(Zy||(Zy={})),function(e){e.BANDWIDTH="bandwidth",e.CPU="cpu",e.NONE="none",e.OTHER="other"}(qy||(qy={})),function(e){e[e.DOWN=0]="DOWN",e[e.UP=1]="UP"}(Qy||(Qy={}));const $y=new Map;function eA(e,t,r,n){let{scale:i}=e;if(0===i&&n===Qy.UP||i>=t.length-1&&n===Qy.DOWN)return e;let o=Jy(Jy({},e),{},{scale:n===Qy.DOWN?++i:--i});switch(r){case Zy.MAINTAIN_FRAMERATE:o=Jy(Jy({},o),t[i].motion);break;case Zy.MAINTAIN_RESOLUTION:o=Jy(Jy({},o),t[i].detail);break;case Zy.BALANCED:o=Jy(Jy({},o),t[i].balanced)}return o}function tA(e){const t=Jy({},e),{bitrateMax:r,frameRate:n,scaleResolutionDownBy:i,bitrateMin:o}=t,{MIN_FRAME_RATE:a,MAX_THRESHOLD_FRAMERATE:s,MAX_SCALE:c,BITRATE_MIN_THRESHOLD:d,BITRATE_MAX_THRESHOLD:u,BWE_SCALE_UP_THRESHOLD:l,BWE_SCALE_DOWN_THRESHOLD:h,PERF_SCALE_DOWN_THRESHOLD:p,PERF_SCALE_UP_THRESHOLD:_,BALANCE_BITRATE_FACTOR:f,BALANCE_FRAMERATE_FACTOR:E,BALANCE_RESOLUTION_FACTOR:m,MOTION_RESOLUTION_FACTOR:T,MOTION_BITRATE_FACTOR:g,DETAIL_FRAMERATE_FACTOR:S,DETAIL_BITRATE_FACTOR:v}=Wn,R=Math.min(t.frameRate,s),y=[{scale:0,threshold:{bwe_down:Math.round(Math.pow(h,1)*r),bwe_up:r,fps_down:Math.round(Math.pow(p,1)*R),fps_up:n},balanced:{scaleResolutionDownBy:1,frameRate:n,bitrateMax:r,bitrateMin:o},motion:{scaleResolutionDownBy:1,frameRate:n,bitrateMax:r,bitrateMin:o},detail:{scaleResolutionDownBy:1,frameRate:n,bitrateMax:r,bitrateMin:o}}];for(let e=1;e<=c;e++){const t={bwe_up:Math.round(Math.pow(l,e)*r),bwe_down:Math.round(Math.pow(h,e+1)*r),fps_up:Math.round(Math.pow(_,e)*R),fps_down:Math.round(Math.pow(p,e+1)*R)},s={scaleResolutionDownBy:i/Math.pow(m,e),frameRate:Math.max(Math.round(Math.pow(E,e)*n),a),bitrateMax:Math.max(Math.round(Math.pow(f,e)*r),u),bitrateMin:Math.max(Math.round(Math.pow(f,e)*o),d)},c={scaleResolutionDownBy:i/Math.pow(T,e),frameRate:n,bitrateMax:Math.max(Math.round(Math.pow(g,e)*r),u),bitrateMin:Math.max(Math.round(Math.pow(g,e)*o),d)},A={scaleResolutionDownBy:1,frameRate:Math.max(Math.round(Math.pow(S,e)*n),a),bitrateMax:Math.max(Math.round(Math.pow(v,e)*r),u),bitrateMin:Math.max(Math.round(Math.pow(v,e)*o),d)};y.push({scale:e,threshold:t,balanced:s,motion:c,detail:A})}return y}function rA(e,t,r,n,i){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:Zy.BALANCED;const a=$y.get(e.getTrackId())||{overUse:0,underUse:0,adaptationList:tA(i)},{adaptationList:s}=a;$y.set(e.getTrackId(),a);const{OVERUSE_TIMES_THRESHOLD:c,UNDERUSE_TIMES_THRESHOLD:d}=Wn,{scale:u}=n;let l;return"number"==typeof t&&t>0&&function(e,t,r,n){if(t>=r.length)return!1;let{threshold:{fps_down:i}}=r[t];return n===Zy.MAINTAIN_FRAMERATE&&(i=r[0].threshold.fps_down),e<i}(t,u,s,o)&&(a.overUse++,e._qualityLimitationReason=qy.CPU,a.overUse>c)||"number"==typeof r&&r>0&&function(e,t,r){if(t>=r.length)return!1;const{threshold:{bwe_down:n}}=r[t];return e<n}(r,u,s)&&(a.overUse++,e._qualityLimitationReason=qy.BANDWIDTH,a.overUse>c)?(a.overUse=0,a.underUse=0,l=eA(n,s,o,Qy.DOWN),l):("number"==typeof t&&t>0&&"number"==typeof r&&r>0&&function(e,t,r,n){if(0===t)return;let{threshold:{fps_up:i}}=r[t];return n===Zy.MAINTAIN_FRAMERATE&&(i=r[1].threshold.fps_up),e>i}(t,u,s,o)&&function(e,t,r){if(0===t)return;const{threshold:{bwe_up:n}}=r[t];return e>n}(r,u,s)&&(a.underUse++,a.underUse>d&&(a.overUse=0,a.underUse=0,l=eA(n,s,o,Qy.UP),0===l.scale&&(e._qualityLimitationReason=qy.NONE))),l)}function nA(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 iA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nA(Object(r),!0).forEach((function(t){tm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class oA extends lR{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==e.MediaElementStatus.PLAYING)}get processorContext(){return this._processorContext}set processorContext(e){this._processorContext=e}get __className__(){return"LocalVideoTrack"}constructor(t,r,n,i,o,a){if(super(t,o),this.trackMediaType="video",this._player=void 0,this.isUseScaleResolutionDownBy=!1,this._videoVisibleTimer=null,this._statsTimer=null,this._previousVideoVisibleStatus=void 0,this._clearPreviousVideoVisibleStatus=()=>this._previousVideoVisibleStatus=void 0,this._encoderConfig=void 0,this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1},this._optimizationMode=void 0,this._qualityLimitationReason=void 0,this._originalSenderConfig=void 0,this._adaptationConfig=void 0,this._adaptationTimer=null,this._videoHeight=void 0,this._videoWidth=void 0,this._forceBitrateLimit=void 0,this._enabled=!0,this.processorDestination=void 0,this._processorContext=void 0,ve()){const{width:e,height:r}=t.getSettings();this._videoWidth=e,this._videoHeight=r}else this.updateMediaStreamTrackResolution();if(this._encoderConfig=r,this._scalabilityMode=n,this._optimizationMode=i,this._hints=a||[],-1===this._hints.indexOf(e.TrackHint.SCREEN_TRACK))this.updateBitrateFromProfile();else if(function(e,t,r){const n=fe();return!(n.name!==e||!n.osVersion)&&(r?Number(n.version)>=t&&Number(n.version)<=r:Number(n.version)===t)}(de.CHROME,115)&&-1!==me().indexOf("Windows")){const e=Yy(t);e&&(oi.info("local screen video track begin to inject frame"),this._mediaStreamTrack=e)}r&&-1!==this._hints.indexOf(e.TrackHint.CUSTOM_TRACK)&&this.setEncoderConfiguration(r),this._processorContext=new gy(this.getTrackId(),"local"),this.processorDestination=new Ty(this.processorContext),this.bindProcessorDestinationEvents()}play(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t){const e=document.getElementById(t);e?t=e:(oi.warning("[".concat(this.getTrackId(),'] can not find "#').concat(t,'" element, use document.body')),t=document.body)}oi.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(r));const n=iA(iA(iA({},this._getDefaultPlayerConfig()),r),{},{trackId:this.getTrackId(),element:t});this._player?this._player.updateConfig(n):(t instanceof HTMLVideoElement?this._player=new Fy(n):this._player=new jy(n),this._player.updateVideoTrack(this._mediaStreamTrack)),this._player.play(),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const t=this.getVideoElementVisibleStatus();this.safeEmit(e.LocalTrackEvents.VIDEO_ELEMENT_VISIBLE_STATUS,t)}catch(e){}}),Yn("CHECK_VIDEO_VISIBLE_INTERVAL"))}stop(){this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._statsTimer&&(this.isUseScaleResolutionDownBy=!1,window.clearInterval(this._statsTimer),this._statsTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(),this._player=void 0,oi.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(t,r){if(!r){if(t===this._enabled)return;this.stateCheck("enabled",t)}if(oi.info("[".concat(this.getTrackId(),"] start setEnabled"),t),!t){this._originMediaStreamTrack.enabled=!1;try{await at(this,e.TrackInternalEvent.NEED_DISABLE_TRACK,this)}catch(e){throw oi.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return r||(this._enabled=!1),void oi.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await at(this,e.TrackInternalEvent.NEED_ENABLE_TRACK,this)}catch(e){throw oi.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}oi.info("[".concat(this.getTrackId(),"] setEnabled to true success")),r||(this._enabled=!0)}async setMuted(t){t!==this._muted&&(this.stateCheck("muted",t),this._muted=t,this._originMediaStreamTrack.enabled=!t,oi.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(t)),t?await at(this,e.TrackInternalEvent.NEED_MUTE_TRACK,this):await at(this,e.TrackInternalEvent.NEED_UNMUTE_TRACK,this))}async setEncoderConfiguration(t,r){if(!this._enabled)throw new Fe(Ue.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");if("720p_auto"===t?this.startMonitorStats():this._statsTimer&&(window.clearInterval(this._statsTimer),this._statsTimer=null),t=Qc(t),this._forceBitrateLimit&&(t.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:t.bitrateMax,t.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:t.bitrateMin),t.width||t.height||t.frameRate){const e=Ny({encoderConfig:t});(ve()||ye()||ke())&&(e.deviceId=void 0),oi.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(t),JSON.stringify(e));try{await this._originMediaStreamTrack.applyConstraints(e),this.updateMediaStreamTrackResolution()}catch(e){const t=new Fe(Ue.UNEXPECTED_ERROR,e.toString());throw oi.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=t,-1===this._hints.indexOf(e.TrackHint.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await at(this,e.TrackInternalEvent.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(oi)}}getStats(){(!(arguments.length>0&&void 0!==arguments[0])||arguments[0])&&_t((()=>{oi.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const t=st(this,e.TrackInternalEvent.GET_STATS);return t||iA({},gd)}async setBeautyEffect(e){oi.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 My(e)}async setBitrateLimit(t){if(oi.debug("[".concat(this.getTrackId(),"] set bitrate limit, ").concat(JSON.stringify(t))),t){this._forceBitrateLimit=t,this._encoderConfig&&(this._encoderConfig.bitrateMax?this._encoderConfig.bitrateMax=this._encoderConfig.bitrateMax<t.max_bitrate?this._encoderConfig.bitrateMax:t.max_bitrate:this._encoderConfig.bitrateMax=t.max_bitrate,this._encoderConfig.bitrateMin,this._encoderConfig.bitrateMin=t.min_bitrate);try{await at(this,e.TrackInternalEvent.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(oi)}}}async setOptimizationMode(t){if("motion"!==t&&"detail"!==t&&"balanced"!==t)return void oi.error(Ue.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const r=this._optimizationMode;try{this._optimizationMode=t,this.startVideoStreamAdapter(),await at(this,e.TrackInternalEvent.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){throw this._optimizationMode=r,oi.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}oi.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(t,")"))}async applyAdaptation(t){if(this._enabled){this._forceBitrateLimit&&(t.bitrateMax=this._forceBitrateLimit.max_bitrate||t.bitrateMax,t.bitrateMin=this._forceBitrateLimit.min_bitrate||t.bitrateMin),this._adaptationConfig=iA(iA({},this._adaptationConfig),t),oi.debug("[".concat(this.getTrackId(),"] applyAdaptation: ").concat(JSON.stringify(this._adaptationConfig),"\n "));try{await at(this,e.TrackInternalEvent.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){return e.throw(oi)}}else oi.error("[".concat(this.getTrackId(),"] can not applyAdaptation when track is disabled"))}startVideoStreamAdapter(){if(this._adaptationTimer&&(window.clearInterval(this._adaptationTimer),this._adaptationTimer=null),this._adaptationConfig=void 0,this._originalSenderConfig=void 0,this._qualityLimitationReason=void 0,!Yn("ENABLE_AG_ADAPTATION"))return;if(!(this instanceof aA))return;if(!(function(e){const t=fe();if(t.os!==ce.IOS||!t.osVersion)return!1;const r=t.osVersion.split(".");return Number(r[0])>=e}(14)&&function(e,t,r){const n=fe();if(n.os!==ce.IOS||!n.osVersion)return!1;const i=n.osVersion.split(".");return r?t&&Number(i[0])===e&&Number(i[1])<t||Number(i[0])<e:t?Number(i[0])===e&&Number(i[1])<=t||Number(i[0])<e:Number(i[0])<=e}(17,4,!0)||Ie(14)&&function(e,t,r){const n=fe();if(n.name!==de.SAFARI||!n.osVersion||!n.browserVersion)return!1;const i=n.browserVersion.split(".");return r?t&&Number(i[0])===e&&Number(i[1])<t||Number(i[0])<e:t?Number(i[0])===e&&Number(i[1])<=t||Number(i[0])<e:Number(i[0])<=e}(17,4,!0)))return;let t=Zy.BALANCED;switch(Yn("AG_DEGRADATION_PREFERENCE")&&(t=Yn("AG_DEGRADATION_PREFERENCE")),this._optimizationMode){case"motion":t=Zy.MAINTAIN_FRAMERATE;break;case"detail":t=Zy.MAINTAIN_RESOLUTION}oi.debug("[".concat(this.getTrackId(),"] start videoStream adaptation, degradation: ").concat(this._optimizationMode||Yn("AG_DEGRADATION_PREFERENCE")||"balanced"));let r=-1;this._adaptationTimer=window.setInterval((()=>{if(!Yn("ENABLE_AG_ADAPTATION"))return this._adaptationTimer&&(window.clearInterval(this._adaptationTimer),this._adaptationTimer=null),void(this._originalSenderConfig&&this.applyAdaptation(this._originalSenderConfig).then((()=>{this._originalSenderConfig=void 0,this._adaptationConfig=void 0,this._qualityLimitationReason=void 0})));const n=this.getStats(!1),i=st(this,e.TrackInternalEvent.GET_RTC_STATS);if(n.sendPackets>0&&i){if(-1===r)return void(r=Date.now());if(Date.now()-r<1e3)return;if(!this._adaptationConfig||!this._originalSenderConfig)return void this.updateAdapterConfig();const e=n.sendFrameRate,o=i.OutgoingAvailableBandwidth,a=rA(this,e,o,this._adaptationConfig,this._originalSenderConfig,t);a&&this._adaptationConfig.scale!==a.scale&&(oi.debug("[".concat(this.getTrackId(),"] applyAdaptation: ").concat(this._qualityLimitationReason,"\n sendFps ").concat(e,", bwe ").concat(o,", switch from ").concat(this._adaptationConfig.scale," to ").concat(a.scale," ")),this.applyAdaptation(a))}}),Yn("CHECK_LOCAL_STATS_INTERVAL"))}updateAdapterConfig(){const e=Ky(this);e&&!function(e,t){try{return"object"==typeof e&&"object"==typeof t&&JSON.stringify(e)===JSON.stringify(t)}catch(e){return!1}}(this._originalSenderConfig,e)&&(this._originalSenderConfig=e,this._adaptationConfig&&(this.applyAdaptation(this._originalSenderConfig),this._qualityLimitationReason=void 0),this._adaptationConfig=iA({},this._originalSenderConfig),function(e,t){const r={overUse:0,underUse:0,adaptationList:tA(t)};$y.set(e.getTrackId(),r)}(this,this._originalSenderConfig),oi.debug("[".concat(this.getTrackId(),"] update original sender config, ").concat(JSON.stringify(this._originalSenderConfig))))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return oi.error(Ue.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,oi.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){Gy(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(Tt)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}async setSenderConfiguration(t){if(!this._enabled)throw new Fe(Ue.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");oi.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(t)),t=Qc(t),this._forceBitrateLimit&&(t.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:t.bitrateMax,t.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:t.bitrateMin),this._encoderConfig=t,-1===this._hints.indexOf(e.TrackHint.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await at(this,e.TrackInternalEvent.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(oi)}}updateBitrateFromProfile(){if(!this._encoderConfig)return;const{width:e,height:t,frameRate:r}=this.getMediaStreamTrackSettings();if(!e||!t||!r)return;null==this._encoderConfig.frameRate&&(this._encoderConfig.frameRate=r);const{bitrateMax:n,bitrateMin:i}=this._encoderConfig;if(null==i||null==n){const{max:o,min:a}=Hy(e,t,r,i,n);this._encoderConfig.bitrateMin=a,this._encoderConfig.bitrateMax=o,oi.debug("[".concat(this.getTrackId(),"] update bitrate from profile, [w: ").concat(e,", h: ").concat(t,", fps: ").concat(r,"] => [brMax: ").concat(o,", brMin: ").concat(a,"]"))}}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},{element:i,slot:o}=n;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=Ke.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=_i.reportApiInvoke(null,{tag:Qe.TRACER,name:qe.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 Fe(Ue.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}async renewMediaStreamTrack(e){}pipe(e){if(this.processor===e)return e;if(e._source)throw new Fe(Ue.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),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,e.reset()}close(){this._adaptationConfig=void 0,this._originalSenderConfig=void 0,super.close(),this._adaptationTimer&&(window.clearInterval(this._adaptationTimer),this._adaptationTimer=null),this._adaptationConfig=void 0,this._originalSenderConfig=void 0,this._qualityLimitationReason=void 0,this.unbindProcessorDestinationEvents(),this.unbindProcessorContextEvents(),this.unpipe(),this.processorDestination._source&&this.processorDestination._source.unpipe()}clone(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this._encoderConfig;e&&(r=iA(iA({},r),Qc(e))),r=ht(r);const n=mt(8,"track-video-cloned-"),i=new oA(t?this._mediaStreamTrack.clone():this._mediaStreamTrack,r,ht(this._scalabilityMode),this._optimizationMode,n,ht(this._hints));return e&&r&&i.setEncoderConfiguration(r),oi.debug("clone video track from ".concat(this.getTrackId()," to ").concat(n,", clone ").concat(t)),i}async replaceTrack(e,t){if(!(e instanceof MediaStreamTrack))throw new Fe(Ue.INVALID_PARAMS,"track should be an instance of MediaStreamTrack");if("video"!==e.kind)throw new Fe(Ue.INVALID_PARAMS,"track should be a video MediaStreamTrack");await this._updateOriginMediaStreamTrack(e,t,!0),this.updateMediaStreamTrackResolution()}startMonitorStats(){if(!ve()&&!ye())return;this._statsTimer&&window.clearInterval(this._statsTimer);let t=2,r=Jc[t];let n=-1;let i=Date.now();const o=e=>{e>2||e<0||(i=Date.now(),r=Jc[e],this.setSenderConfiguration(r))};this.isUseScaleResolutionDownBy=!0,this._statsTimer=window.setInterval((()=>{const a=this.getStats(),s=st(this,e.TrackInternalEvent.GET_RTC_STATS);if(a.sendPackets>0&&s){-1===n&&(n=Date.now());const e=Date.now();if(e-n<1e3||e-i<Yn("PROFILE_SWITCH_INTERVAL"))return;const c=a.sendFrameRate,d=.6*r.frameRate,u=.9*r.frameRate;"number"==typeof c&&c>0&&c<d?t>0&&(t--,o(t),oi.debug("[".concat(this.getTrackId(),"] step down for fps ").concat(c,", switchProfile to ").concat(t))):s.OutgoingAvailableBandwidth<r.bitrateMin?t>0&&(t--,o(t),oi.debug("[".concat(this.getTrackId(),"] step down for OutgoingAvailableBandwidth ").concat(s.OutgoingAvailableBandwidth,", bitrateMin ").concat(r.bitrateMin,", switchProfile to ").concat(t))):"number"==typeof c&&c>u&&t<Jc.length-1&&s.OutgoingAvailableBandwidth>1.2*Jc[t+1].bitrateMin&&(t++,o(t),oi.debug("[".concat(this.getTrackId(),"] step up for fps ").concat(c,", OutgoingAvailableBandwidth ").concat(s.OutgoingAvailableBandwidth,", switchProfile to ").concat(t)))}}),Yn("CHECK_LOCAL_STATS_INTERVAL"))}sendSeiData(e){if(_t((()=>{_i.reportApiInvoke(null,{name:qe.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:Qe.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!Yn("ENABLE_VIDEO_SEI")||!Yn("ENABLE_ENCODED_TRANSFORM"))return void oi.warning('To send/receive SEI, please call AgoraRTC.setParameter("ENABLE_VIDEO_SEI", true) before instantiate IAgoraRtcClient');if(e instanceof Uint8Array==!1)return new Fe(Ue.INVALID_PARAMS,"Invalid argument type, ILocalVideoTrack.sendSeiData() only accept Uint8Array argument.").throw();const t=this.getRTCRtpTransceiver();if(!t)return void oi.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?this.safeEmit("sei-to-send",e):oi.warning("SEI is not supported by ".concat(n))}bindProcessorDestinationEvents(){this.processorDestination.on(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK,(async t=>{t?t!==this._mediaStreamTrack&&(this._mediaStreamTrack=t,this._updatePlayerSource(),await at(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await at(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(e.PROCESSOR_CONTEXT_EVENTS.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(e.PROCESSOR_CONTEXT_EVENTS.REQUEST_CONSTRAINTS)}}cR([pi({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Object,Object]),dR("design:returntype",void 0)],oA.prototype,"play",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],oA.prototype,"stop",null),cR([Ot("LocalVideoTrack","_enabledMutex"),pi({argsMap:(e,t)=>[e.getTrackId(),t]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Boolean,Boolean]),dR("design:returntype",sR)],oA.prototype,"setEnabled",null),cR([Ot("LocalVideoTrack","_enabledMutex"),pi({argsMap:(e,t)=>[e.getTrackId(),t]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Boolean]),dR("design:returntype",sR)],oA.prototype,"setMuted",null),cR([pi({argsMap:(e,t)=>[e.getTrackId(),t]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Object,Boolean]),dR("design:returntype",sR)],oA.prototype,"setEncoderConfiguration",null),cR([sy(),dR("design:type",Function),dR("design:paramtypes",[Boolean]),dR("design:returntype",Object)],oA.prototype,"getStats",null),cR([pi({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Boolean,Object]),dR("design:returntype",sR)],oA.prototype,"setBeautyEffect",null),cR([sy(),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",ImageData)],oA.prototype,"getCurrentFrameData",null),cR([sy(),dR("design:type",Function),dR("design:paramtypes",[String,Number]),dR("design:returntype",sR)],oA.prototype,"getCurrentFrameImage",null),cR([sy(),dR("design:type",Function),dR("design:paramtypes",[Object]),dR("design:returntype",sR)],oA.prototype,"setBitrateLimit",null),cR([sy(),dR("design:type",Function),dR("design:paramtypes",[String]),dR("design:returntype",sR)],oA.prototype,"setOptimizationMode",null),cR([pi(),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],oA.prototype,"startVideoStreamAdapter",null),cR([sy(),dR("design:type",Function),dR("design:paramtypes",[Object]),dR("design:returntype",void 0)],oA.prototype,"setScalabiltyMode",null),cR([sy(),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],oA.prototype,"updateMediaStreamTrackResolution",null),cR([pi({argsMap:(e,t)=>[e.getTrackId(),t.name]}),dR("design:type",Function),dR("design:paramtypes",[Object]),dR("design:returntype",Object)],oA.prototype,"pipe",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],oA.prototype,"unpipe",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],oA.prototype,"close",null),cR([pi({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),dR("design:type",Function),dR("design:paramtypes",[MediaStreamTrack,Boolean]),dR("design:returntype",sR)],oA.prototype,"replaceTrack",null),cR([pi(),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],oA.prototype,"startMonitorStats",null);class aA extends oA{get __className__(){return"CameraVideoTrack"}constructor(t,r,n,i,o,a){super(t,Qc(r.encoderConfig),i,o,a),this._config=void 0,this._originalConstraints=void 0,this._constraints=void 0,this._enabled=!0,this._deviceName="default",this.tryResumeVideoForIOS15_16WeChat=async()=>{!Ce()&&!we()||function(){const e=fe();if(e.os!==ce.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()||fe().name!==de.WECHAT||!this._enabled||this._isClosed||(oi.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS 15 device on WeChat.")),await this.renewMediaStreamTrack())},this._config=r,this._originalConstraints=n,this._constraints=n,this._deviceName=t.label,this._encoderConfig=Qc(this._config.encoderConfig),fR.on(e.AUDIO_CONTEXT_EVENT.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),fR.on(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),this.bindProcessorContextEvents(),this.startVideoStreamAdapter()}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(oi.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await QR.getDeviceById(e),r={};r.video=iA({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let n=null;try{n=await YR(r,this.getTrackId())}catch(e){throw oi.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await YR({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 oi.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await QR.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw oi.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}oi.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){oi.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:iA(iA({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await YR(t,this.getTrackId())}catch(t){throw oi.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await YR({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=iA({},t.video),oi.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(t,r){if(!r){if(t===this._enabled)return;this.stateCheck("enabled",t)}if(oi.info("[".concat(this.getTrackId(),"] start setEnabled"),t),t){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await YR({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await at(this,e.TrackInternalEvent.NEED_ENABLE_TRACK,this)}catch(e){throw oi.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),oi.info("[".concat(this.getTrackId(),"] setEnabled to true success")),r||(this._enabled=!0)}else{this.isExternalTrack?this._originMediaStreamTrack.enabled=!1:(this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop()),r||(this._enabled=!1);try{await at(this,e.TrackInternalEvent.NEED_DISABLE_TRACK,this)}catch(e){throw oi.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}oi.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}}async setEncoderConfiguration(t,r){if(!this._enabled)throw new Fe(Ue.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");"720p_auto"===t?this.startMonitorStats():this._statsTimer&&(window.clearInterval(this._statsTimer),this._statsTimer=null),t=Qc(t),this._forceBitrateLimit&&(t.bitrateMax=this._forceBitrateLimit.max_bitrate||t.bitrateMax,t.bitrateMin=this._forceBitrateLimit.min_bitrate||t.bitrateMin);const n=lt(this._config);n.encoderConfig=t;const i=Ny(n);(ve()||ye()||ke())&&(i.deviceId=void 0),oi.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(t),JSON.stringify(i));try{await this._originMediaStreamTrack.applyConstraints(i),this.updateMediaStreamTrackResolution()}catch(e){const t=new Fe(Ue.UNEXPECTED_ERROR,e.toString());throw oi.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}this._config=n,this._constraints=i,this._originalConstraints=i,this._encoderConfig=t,this.updateAdapterConfig(),-1===this._hints.indexOf(e.TrackHint.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await at(this,e.TrackInternalEvent.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(oi)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((ye()||ke())&&this._enabled&&!this._isClosed&&fR.duringInterruption){const t=async()=>{fR.off(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,t),this._enabled&&!this._isClosed&&(oi.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};fR.on(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,t)}else oi.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(e.LocalTrackEvents.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=QR.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await YR({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),fR.off(e.AUDIO_CONTEXT_EVENT.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),fR.off(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this._encoderConfig;e&&(r=iA(iA({},r),Qc(e))),r=ht(r);const n=mt(8,"track-cam-cloned-"),i=new aA(t?this._mediaStreamTrack.clone():this._mediaStreamTrack,ht(iA(iA({},this._config),{},{encoderConfig:r})),ht(this._constraints),ht(this._scalabilityMode),this._optimizationMode,n);return e&&r&&i.setEncoderConfiguration(r),oi.debug("clone track from ".concat(this.getTrackId()," to ").concat(n,", clone ").concat(t)),i}bindProcessorContextEvents(){this.processorContext.on(e.PROCESSOR_CONTEXT_EVENTS.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(e.PROCESSOR_CONTEXT_EVENTS.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}}function sA(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 cA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?sA(Object(r),!0).forEach((function(t){tm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):sA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function dA(e,t,r,n){r.optimizationMode&&(n&&n.width&&n.height?(r.encoderConfig=cA(cA({},n),{},{bitrateMin:n.bitrateMin,bitrateMax:n.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?oi.debug("[".concat(e,"] set content hint to"),r.optimizationMode):oi.debug("[".concat(e,"] set content hint failed")))):oi.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}function uA(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 lA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?uA(Object(r),!0).forEach((function(t){tm(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):uA(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}cR([pi({argsMap:(e,t)=>[e.getTrackId(),t]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Object]),dR("design:returntype",sR)],aA.prototype,"setDevice",null),cR([Ot("CameraVideoTrack","_enabledMutex"),pi({argsMap:(e,t)=>[e.getTrackId(),t]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Boolean,Boolean]),dR("design:returntype",sR)],aA.prototype,"setEnabled",null),cR([pi({argsMap:(e,t)=>[e.getTrackId(),t]}),sy(),dR("design:type",Function),dR("design:paramtypes",[Object,Boolean]),dR("design:returntype",sR)],aA.prototype,"setEncoderConfiguration",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],aA.prototype,"close",null);class hA extends uR{getUserId(){return this._userId}constructor(e,t,r,n){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(n.clientId,"_").concat(mt(5,""))),this._userId=void 0,this._uintId=void 0,this._isDestroyed=!1,this.store=void 0,this.processor=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,oi.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}class pA extends hA{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==e.MediaElementStatus.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,n){super(e,t,r,n),this._videoVisibleTimer=null,this._previousVideoVisibleStatus=void 0,this._clearPreviousVideoVisibleStatus=()=>this._previousVideoVisibleStatus=void 0,this.trackMediaType="video",this._videoWidth=void 0,this._videoHeight=void 0,this._player=void 0,this.processorDestination=void 0,this.processorContext=void 0,this.updateMediaStreamTrackResolution(),this.processorContext=new gy(this.getTrackId(),"remote"),this.processorDestination=new Ty(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){_t((()=>{oi.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return st(this,e.TrackInternalEvent.GET_STATS)||lA({},vd)}play(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t){const e=document.getElementById(t);e?t=e:(oi.warning("[".concat(this.getTrackId(),'] can not find "#').concat(t,'" element, use document.body')),t=document.body)}oi.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(r));const n=lA(lA({fit:"cover"},r),{},{trackId:this.getTrackId(),element:t});this._player?this._player.updateConfig(n):(t instanceof HTMLVideoElement?this._player=new Fy(n):this._player=new jy(n),this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(e.RemoteTrackEvents.FIRST_FRAME_DECODED)},this._player.onVideoStateChanged=t=>{this.safeEmit(e.RemoteTrackEvents.VIDEO_STATE_CHANGED,t)}),this._player.play(this.store.sessionId||void 0),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const t=this.getVideoElementVisibleStatus();this.safeEmit(e.RemoteTrackEvents.VIDEO_ELEMENT_VISIBLE_STATUS,t)}catch(e){}}),Yn("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,oi.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){Gy(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(Tt)}_updatePlayerSource(){oi.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},{element:i,slot:o}=n;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=Ke.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=_i.reportApiInvoke(null,{tag:Qe.TRACER,name:qe.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 Fe(Ue.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}pipe(e){if(this.processor===e)return e;if(e._source)throw new Fe(Ue.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),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,e.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(e.PROCESSOR_DESTINATION_EVENTS.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(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK)}_destroy(){super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(t){this.emit(e.TrackEvents.SEI_RECEIVED,t)}}cR([pi({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),dR("design:type",Function),dR("design:paramtypes",[Object,Object]),dR("design:returntype",void 0)],pA.prototype,"play",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],pA.prototype,"stop",null),cR([pi({argsMap:(e,t)=>[e.getTrackId(),t.name]}),dR("design:type",Function),dR("design:paramtypes",[Object]),dR("design:returntype",Object)],pA.prototype,"pipe",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],pA.prototype,"unpipe",null);class _A extends hA{get isPlaying(){return this._useAudioElement?ay.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(t,r,n,i){super(t,r,n,i),this.trackMediaType="audio",this._source=void 0,this._useAudioElement=!0,this._volume=100,this.processorContext=void 0,this.processorDestination=void 0,this._played=!1,this._bypassWebAudio=!1,Yn("DISABLE_WEBAUDIO")?(this._source=new Ry,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new jR(t,!0),Yn("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once(e.AudioSourceEvents.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(e.RemoteTrackEvents.FIRST_FRAME_DECODED)})),this.processorContext=new vy(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new Sy(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(e.AudioSourceEvents.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:this.processorContext})}))}setAudioFrameCallback(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!t)return this._source.removeAllListeners(e.AudioSourceEvents.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(r),this._source.removeAllListeners(e.AudioSourceEvents.ON_AUDIO_BUFFER),this._source.on(e.AudioSourceEvents.ON_AUDIO_BUFFER,(e=>t(e)))}setVolume(e){this._volume=e,this._useAudioElement?ay.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!Se()&&Yn("RESTRICTION_SET_PLAYBACK_DEVICE"))throw new Fe(Ue.NOT_SUPPORTED,"your browser does not support setting the audio output device");await ay.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getStats(){_t((()=>{oi.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return st(this,e.TrackInternalEvent.GET_STATS)||lA({},Sd)}play(){oi.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement?(oi.debug("[".concat(this.getTrackId(),"] use audio element to play")),ay.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):this._source.play()}stop(){oi.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?ay.stop(this.getTrackId()):this._source.stop()}_destroy(){super._destroy(),this._played=!1,this.unbindProcessorDestinationEvents(),this._source.destroy()}_isFreeze(){return this._source.isFreeze}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];oi.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&ay.updateTrack(this.getTrackId(),this._mediaStreamTrack)}pipe(e){if(this._bypassWebAudio)throw new Fe(Ue.NOT_SUPPORTED,"can not pipe extension when WebAudio disabled");if(this.processor===e)return e;if(e._source)throw new Fe(Ue.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),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 Fe(Ue.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,t.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(e.PROCESSOR_DESTINATION_EVENTS.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(e.PROCESSOR_DESTINATION_EVENTS.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(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK),this.processorDestination.removeAllListeners(e.PROCESSOR_DESTINATION_EVENTS.ON_NODE)}}cR([pi({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),dR("design:type",Function),dR("design:paramtypes",[Number]),dR("design:returntype",void 0)],_A.prototype,"setVolume",null),cR([pi({argsMap:(e,t)=>[e.getTrackId(),t]}),dR("design:type",Function),dR("design:paramtypes",[String]),dR("design:returntype",sR)],_A.prototype,"setPlaybackDevice",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],_A.prototype,"play",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],_A.prototype,"stop",null),cR([pi({argsMap:(e,t)=>[e.getTrackId(),t.name]}),dR("design:type",Function),dR("design:paramtypes",[Object]),dR("design:returntype",Object)],_A.prototype,"pipe",null),cR([pi({argsMap:e=>[e.getTrackId()]}),dR("design:type",Function),dR("design:paramtypes",[]),dR("design:returntype",void 0)],_A.prototype,"unpipe",null);const fA=new class extends Ye{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),this._lastHiddenTime=0,this._lastVisibleTime=0,document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),oi.debug("document visibility went ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}};
6
- /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function EA(e){let t=e.length;for(;--t>=0;)e[t]=0}const mA=256,TA=286,gA=30,SA=15,vA=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),RA=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),yA=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),AA=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),bA=new Array(576);EA(bA);const IA=new Array(60);EA(IA);const OA=new Array(512);EA(OA);const CA=new Array(256);EA(CA);const wA=new Array(29);EA(wA);const NA=new Array(gA);function kA(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}let DA,PA,LA;function MA(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}EA(NA);const UA=e=>e<256?OA[e]:OA[256+(e>>>7)],xA=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},VA=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,xA(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)},FA=(e,t,r)=>{VA(e,r[2*t],r[2*t+1])},BA=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},jA=(e,t,r)=>{const n=new Array(16);let i,o,a=0;for(i=1;i<=SA;i++)a=a+r[i-1]<<1,n[i]=a;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=BA(n[t]++,t))}},GA=e=>{let t;for(t=0;t<TA;t++)e.dyn_ltree[2*t]=0;for(t=0;t<gA;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},HA=e=>{e.bi_valid>8?xA(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},WA=(e,t,r,n)=>{const i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]},KA=(e,t,r)=>{const n=e.heap[r];let i=r<<1;for(;i<=e.heap_len&&(i<e.heap_len&&WA(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!WA(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n},zA=(e,t,r)=>{let n,i,o,a,s=0;if(0!==e.sym_next)do{n=255&e.pending_buf[e.sym_buf+s++],n+=(255&e.pending_buf[e.sym_buf+s++])<<8,i=e.pending_buf[e.sym_buf+s++],0===n?FA(e,i,t):(o=CA[i],FA(e,o+mA+1,t),a=vA[o],0!==a&&(i-=wA[o],VA(e,i,a)),n--,o=UA(n),FA(e,o,r),a=RA[o],0!==a&&(n-=NA[o],VA(e,n,a)))}while(s<e.sym_next);FA(e,256,t)},YA=(e,t)=>{const r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let a,s,c,d=-1;for(e.heap_len=0,e.heap_max=573,a=0;a<o;a++)0!==r[2*a]?(e.heap[++e.heap_len]=d=a,e.depth[a]=0):r[2*a+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=d<2?++d:0,r[2*c]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=n[2*c+1]);for(t.max_code=d,a=e.heap_len>>1;a>=1;a--)KA(e,r,a);c=o;do{a=e.heap[1],e.heap[1]=e.heap[e.heap_len--],KA(e,r,1),s=e.heap[1],e.heap[--e.heap_max]=a,e.heap[--e.heap_max]=s,r[2*c]=r[2*a]+r[2*s],e.depth[c]=(e.depth[a]>=e.depth[s]?e.depth[a]:e.depth[s])+1,r[2*a+1]=r[2*s+1]=c,e.heap[1]=c++,KA(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,a=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length;let d,u,l,h,p,_,f=0;for(h=0;h<=SA;h++)e.bl_count[h]=0;for(r[2*e.heap[e.heap_max]+1]=0,d=e.heap_max+1;d<573;d++)u=e.heap[d],h=r[2*r[2*u+1]+1]+1,h>c&&(h=c,f++),r[2*u+1]=h,u>n||(e.bl_count[h]++,p=0,u>=s&&(p=a[u-s]),_=r[2*u],e.opt_len+=_*(h+p),o&&(e.static_len+=_*(i[2*u+1]+p)));if(0!==f){do{for(h=c-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[c]--,f-=2}while(f>0);for(h=c;0!==h;h--)for(u=e.bl_count[h];0!==u;)l=e.heap[--d],l>n||(r[2*l+1]!==h&&(e.opt_len+=(h-r[2*l+1])*r[2*l],r[2*l+1]=h),u--)}})(e,t),jA(r,d,e.bl_count)},XA=(e,t,r)=>{let n,i,o=-1,a=t[1],s=0,c=7,d=4;for(0===a&&(c=138,d=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<d?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,d=3):i===a?(c=6,d=3):(c=7,d=4))},JA=(e,t,r)=>{let n,i,o=-1,a=t[1],s=0,c=7,d=4;for(0===a&&(c=138,d=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<d)do{FA(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(FA(e,i,e.bl_tree),s--),FA(e,16,e.bl_tree),VA(e,s-3,2)):s<=10?(FA(e,17,e.bl_tree),VA(e,s-3,3)):(FA(e,18,e.bl_tree),VA(e,s-11,7));s=0,o=i,0===a?(c=138,d=3):i===a?(c=6,d=3):(c=7,d=4)}};let ZA=!1;const qA=(e,t,r,n)=>{VA(e,0+(n?1:0),3),HA(e),xA(e,r),xA(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var QA=(e,t,r,n)=>{let i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<mA;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),YA(e,e.l_desc),YA(e,e.d_desc),a=(e=>{let t;for(XA(e,e.dyn_ltree,e.l_desc.max_code),XA(e,e.dyn_dtree,e.d_desc.max_code),YA(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*AA[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?qA(e,t,r,n):4===e.strategy||o===i?(VA(e,2+(n?1:0),3),zA(e,bA,IA)):(VA(e,4+(n?1:0),3),((e,t,r,n)=>{let i;for(VA(e,t-257,5),VA(e,r-1,5),VA(e,n-4,4),i=0;i<n;i++)VA(e,e.bl_tree[2*AA[i]+1],3);JA(e,e.dyn_ltree,t-1),JA(e,e.dyn_dtree,r-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),zA(e,e.dyn_ltree,e.dyn_dtree)),GA(e),n&&HA(e)},$A={_tr_init:e=>{ZA||((()=>{let e,t,r,n,i;const o=new Array(16);for(r=0,n=0;n<28;n++)for(wA[n]=r,e=0;e<1<<vA[n];e++)CA[r++]=n;for(CA[r-1]=n,i=0,n=0;n<16;n++)for(NA[n]=i,e=0;e<1<<RA[n];e++)OA[i++]=n;for(i>>=7;n<gA;n++)for(NA[n]=i<<7,e=0;e<1<<RA[n]-7;e++)OA[256+i++]=n;for(t=0;t<=SA;t++)o[t]=0;for(e=0;e<=143;)bA[2*e+1]=8,e++,o[8]++;for(;e<=255;)bA[2*e+1]=9,e++,o[9]++;for(;e<=279;)bA[2*e+1]=7,e++,o[7]++;for(;e<=287;)bA[2*e+1]=8,e++,o[8]++;for(jA(bA,287,o),e=0;e<gA;e++)IA[2*e+1]=5,IA[2*e]=BA(e,5);DA=new kA(bA,vA,257,TA,SA),PA=new kA(IA,RA,0,gA,SA),LA=new kA(new Array(0),yA,0,19,7)})(),ZA=!0),e.l_desc=new MA(e.dyn_ltree,DA),e.d_desc=new MA(e.dyn_dtree,PA),e.bl_desc=new MA(e.bl_tree,LA),e.bi_buf=0,e.bi_valid=0,GA(e)},_tr_stored_block:qA,_tr_flush_block:QA,_tr_tally:(e,t,r)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(CA[r]+mA+1)]++,e.dyn_dtree[2*UA(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{VA(e,2,3),FA(e,256,bA),(e=>{16===e.bi_valid?(xA(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var eb=(e,t,r,n)=>{let i=65535&e|0,o=e>>>16&65535|0,a=0;for(;0!==r;){a=r>2e3?2e3:r,r-=a;do{i=i+t[n++]|0,o=o+i|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};const tb=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var rb=(e,t,r,n)=>{const i=tb,o=n+r;e^=-1;for(let r=n;r<o;r++)e=e>>>8^i[255&(e^t[r])];return-1^e},nb={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},ib={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:ob,_tr_stored_block:ab,_tr_flush_block:sb,_tr_tally:cb,_tr_align:db}=$A,{Z_NO_FLUSH:ub,Z_PARTIAL_FLUSH:lb,Z_FULL_FLUSH:hb,Z_FINISH:pb,Z_BLOCK:_b,Z_OK:fb,Z_STREAM_END:Eb,Z_STREAM_ERROR:mb,Z_DATA_ERROR:Tb,Z_BUF_ERROR:gb,Z_DEFAULT_COMPRESSION:Sb,Z_FILTERED:vb,Z_HUFFMAN_ONLY:Rb,Z_RLE:yb,Z_FIXED:Ab,Z_DEFAULT_STRATEGY:bb,Z_UNKNOWN:Ib,Z_DEFLATED:Ob}=ib,Cb=286,wb=30,Nb=19,kb=2*Cb+1,Db=15,Pb=258,Lb=262,Mb=42,Ub=113,xb=666,Vb=(e,t)=>(e.msg=nb[t],t),Fb=e=>2*e-(e>4?9:0),Bb=e=>{let t=e.length;for(;--t>=0;)e[t]=0},jb=e=>{let t,r,n,i=e.w_size;t=e.hash_size,n=t;do{r=e.head[--n],e.head[n]=r>=i?r-i:0}while(--t);t=i,n=t;do{r=e.prev[--n],e.prev[n]=r>=i?r-i:0}while(--t)};let Gb=(e,t,r)=>(t<<e.hash_shift^r)&e.hash_mask;const Hb=e=>{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},Wb=(e,t)=>{sb(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Hb(e.strm)},Kb=(e,t)=>{e.pending_buf[e.pending++]=t},zb=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},Yb=(e,t,r,n)=>{let i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),r),1===e.state.wrap?e.adler=eb(e.adler,t,i,r):2===e.state.wrap&&(e.adler=rb(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)},Xb=(e,t)=>{let r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match;const c=e.strstart>e.w_size-Lb?e.strstart-(e.w_size-Lb):0,d=e.window,u=e.w_mask,l=e.prev,h=e.strstart+Pb;let p=d[o+a-1],_=d[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(r=t,d[r+a]===_&&d[r+a-1]===p&&d[r]===d[o]&&d[++r]===d[o+1]){o+=2,r++;do{}while(d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&o<h);if(n=Pb-(h-o),o=h-Pb,n>a){if(e.match_start=t,a=n,n>=s)break;p=d[o+a-1],_=d[o+a]}}}while((t=l[t&u])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead},Jb=e=>{const t=e.w_size;let r,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Lb)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),jb(e),n+=t),0===e.strm.avail_in)break;if(r=Yb(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=r,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=Gb(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=Gb(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Lb&&0!==e.strm.avail_in)},Zb=(e,t)=>{let r,n,i,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,a=0,s=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,n=e.strstart-e.block_start,r>n+e.strm.avail_in&&(r=n+e.strm.avail_in),r>i&&(r=i),r<o&&(0===r&&t!==pb||t===ub||r!==n+e.strm.avail_in))break;a=t===pb&&r===n+e.strm.avail_in?1:0,ab(e,0,0,a),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,Hb(e.strm),n&&(n>r&&(n=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+n),e.strm.next_out),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n,e.block_start+=n,r-=n),r&&(Yb(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===a);return s-=e.strm.avail_in,s&&(s>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=s&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-s,e.strm.next_in),e.strstart),e.strstart+=s,e.insert+=s>e.w_size-e.insert?e.w_size-e.insert:s),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),a?4:t!==ub&&t!==pb&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(Yb(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,o=i>e.w_size?e.w_size:i,n=e.strstart-e.block_start,(n>=o||(n||t===pb)&&t!==ub&&0===e.strm.avail_in&&n<=i)&&(r=n>i?i:n,a=t===pb&&0===e.strm.avail_in&&r===n?1:0,ab(e,e.block_start,r,a),e.block_start+=r,Hb(e.strm)),a?3:1)},qb=(e,t)=>{let r,n;for(;;){if(e.lookahead<Lb){if(Jb(e),e.lookahead<Lb&&t===ub)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=Gb(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-Lb&&(e.match_length=Xb(e,r)),e.match_length>=3)if(n=cb(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=Gb(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=Gb(e,e.ins_h,e.window[e.strstart+1]);else n=cb(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Wb(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===pb?(Wb(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Wb(e,!1),0===e.strm.avail_out)?1:2},Qb=(e,t)=>{let r,n,i;for(;;){if(e.lookahead<Lb){if(Jb(e),e.lookahead<Lb&&t===ub)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=Gb(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-Lb&&(e.match_length=Xb(e,r),e.match_length<=5&&(e.strategy===vb||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=cb(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=Gb(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(Wb(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=cb(e,0,e.window[e.strstart-1]),n&&Wb(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=cb(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===pb?(Wb(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Wb(e,!1),0===e.strm.avail_out)?1:2};function $b(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}const eI=[new $b(0,0,0,0,Zb),new $b(4,4,8,4,qb),new $b(4,5,16,8,qb),new $b(4,6,32,32,qb),new $b(4,4,16,16,Qb),new $b(8,16,32,32,Qb),new $b(8,16,128,128,Qb),new $b(8,32,128,256,Qb),new $b(32,128,258,1024,Qb),new $b(32,258,258,4096,Qb)];function tI(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ob,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(2*kb),this.dyn_dtree=new Uint16Array(2*(2*wb+1)),this.bl_tree=new Uint16Array(2*(2*Nb+1)),Bb(this.dyn_ltree),Bb(this.dyn_dtree),Bb(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Db+1),this.heap=new Uint16Array(2*Cb+1),Bb(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Cb+1),Bb(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const rI=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Mb&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Ub&&t.status!==xb?1:0},nI=e=>{if(rI(e))return Vb(e,mb);e.total_in=e.total_out=0,e.data_type=Ib;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?Mb:Ub,e.adler=2===t.wrap?0:1,t.last_flush=-2,ob(t),fb},iI=e=>{const t=nI(e);var r;return t===fb&&((r=e.state).window_size=2*r.w_size,Bb(r.head),r.max_lazy_match=eI[r.level].max_lazy,r.good_match=eI[r.level].good_length,r.nice_match=eI[r.level].nice_length,r.max_chain_length=eI[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},oI=(e,t,r,n,i,o)=>{if(!e)return mb;let a=1;if(t===Sb&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||r!==Ob||n<8||n>15||t<0||t>9||o<0||o>Ab||8===n&&1!==a)return Vb(e,mb);8===n&&(n=9);const s=new tI;return e.state=s,s.strm=e,s.status=Mb,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Uint8Array(2*s.w_size),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=3*(s.lit_bufsize-1),s.level=t,s.strategy=o,s.method=r,iI(e)};var aI=(e,t)=>{if(rI(e)||t>_b||t<0)return e?Vb(e,mb):mb;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||r.status===xb&&t!==pb)return Vb(e,0===e.avail_out?gb:mb);const n=r.last_flush;if(r.last_flush=t,0!==r.pending){if(Hb(e),0===e.avail_out)return r.last_flush=-1,fb}else if(0===e.avail_in&&Fb(t)<=Fb(n)&&t!==pb)return Vb(e,gb);if(r.status===xb&&0!==e.avail_in)return Vb(e,gb);if(r.status===Mb&&0===r.wrap&&(r.status=Ub),r.status===Mb){let t=Ob+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=Rb||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=n<<6,0!==r.strstart&&(t|=32),t+=31-t%31,zb(r,t),0!==r.strstart&&(zb(r,e.adler>>>16),zb(r,65535&e.adler)),e.adler=1,r.status=Ub,Hb(e),0!==r.pending)return r.last_flush=-1,fb}if(57===r.status)if(e.adler=0,Kb(r,31),Kb(r,139),Kb(r,8),r.gzhead)Kb(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),Kb(r,255&r.gzhead.time),Kb(r,r.gzhead.time>>8&255),Kb(r,r.gzhead.time>>16&255),Kb(r,r.gzhead.time>>24&255),Kb(r,9===r.level?2:r.strategy>=Rb||r.level<2?4:0),Kb(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(Kb(r,255&r.gzhead.extra.length),Kb(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=rb(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(Kb(r,0),Kb(r,0),Kb(r,0),Kb(r,0),Kb(r,0),Kb(r,9===r.level?2:r.strategy>=Rb||r.level<2?4:0),Kb(r,3),r.status=Ub,Hb(e),0!==r.pending)return r.last_flush=-1,fb;if(69===r.status){if(r.gzhead.extra){let t=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let i=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=rb(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=i,Hb(e),0!==r.pending)return r.last_flush=-1,fb;t=0,n-=i}let i=new Uint8Array(r.gzhead.extra);r.pending_buf.set(i.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>t&&(e.adler=rb(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=rb(e.adler,r.pending_buf,r.pending-n,n)),Hb(e),0!==r.pending)return r.last_flush=-1,fb;n=0}t=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,Kb(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=rb(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=rb(e.adler,r.pending_buf,r.pending-n,n)),Hb(e),0!==r.pending)return r.last_flush=-1,fb;n=0}t=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,Kb(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=rb(e.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(Hb(e),0!==r.pending))return r.last_flush=-1,fb;Kb(r,255&e.adler),Kb(r,e.adler>>8&255),e.adler=0}if(r.status=Ub,Hb(e),0!==r.pending)return r.last_flush=-1,fb}if(0!==e.avail_in||0!==r.lookahead||t!==ub&&r.status!==xb){let n=0===r.level?Zb(r,t):r.strategy===Rb?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(Jb(e),0===e.lookahead)){if(t===ub)return 1;break}if(e.match_length=0,r=cb(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Wb(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===pb?(Wb(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Wb(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===yb?((e,t)=>{let r,n,i,o;const a=e.window;for(;;){if(e.lookahead<=Pb){if(Jb(e),e.lookahead<=Pb&&t===ub)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,n=a[i],n===a[++i]&&n===a[++i]&&n===a[++i])){o=e.strstart+Pb;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=Pb-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=cb(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=cb(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Wb(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===pb?(Wb(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(Wb(e,!1),0===e.strm.avail_out)?1:2})(r,t):eI[r.level].func(r,t);if(3!==n&&4!==n||(r.status=xb),1===n||3===n)return 0===e.avail_out&&(r.last_flush=-1),fb;if(2===n&&(t===lb?db(r):t!==_b&&(ab(r,0,0,!1),t===hb&&(Bb(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),Hb(e),0===e.avail_out))return r.last_flush=-1,fb}return t!==pb?fb:r.wrap<=0?Eb:(2===r.wrap?(Kb(r,255&e.adler),Kb(r,e.adler>>8&255),Kb(r,e.adler>>16&255),Kb(r,e.adler>>24&255),Kb(r,255&e.total_in),Kb(r,e.total_in>>8&255),Kb(r,e.total_in>>16&255),Kb(r,e.total_in>>24&255)):(zb(r,e.adler>>>16),zb(r,65535&e.adler)),Hb(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?fb:Eb)},sI=(e,t)=>{let r=t.length;if(rI(e))return mb;const n=e.state,i=n.wrap;if(2===i||1===i&&n.status!==Mb||n.lookahead)return mb;if(1===i&&(e.adler=eb(e.adler,t,r,0)),n.wrap=0,r>=n.w_size){0===i&&(Bb(n.head),n.strstart=0,n.block_start=0,n.insert=0);let e=new Uint8Array(n.w_size);e.set(t.subarray(r-n.w_size,r),0),t=e,r=n.w_size}const o=e.avail_in,a=e.next_in,s=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,Jb(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{n.ins_h=Gb(n,n.ins_h,n.window[e+3-1]),n.prev[e&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=e,e++}while(--t);n.strstart=e,n.lookahead=2,Jb(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=a,e.input=s,e.avail_in=o,n.wrap=i,fb},cI={deflateInit:(e,t)=>oI(e,t,Ob,15,8,bb),deflateInit2:oI,deflateReset:iI,deflateResetKeep:nI,deflateSetHeader:(e,t)=>rI(e)||2!==e.state.wrap?mb:(e.state.gzhead=t,fb),deflate:aI,deflateEnd:e=>{if(rI(e))return mb;const t=e.state.status;return e.state=null,t===Ub?Vb(e,Tb):fb},deflateSetDictionary:sI,deflateInfo:"pako deflate (from Nodeca project)"};const dI=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var uI={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)dI(r,t)&&(e[t]=r[t])}}return e},flattenChunks:e=>{let t=0;for(let r=0,n=e.length;r<n;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,n=0,i=e.length;t<i;t++){let i=e[t];r.set(i,n),n+=i.length}return r}};let lI=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){lI=!1}const hI=new Uint8Array(256);for(let e=0;e<256;e++)hI[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;hI[254]=hI[254]=1;var pI={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(s),o=0,i=0;o<s;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<a&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},buf2string:(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let t=e[n++];if(t<128){o[i++]=t;continue}let a=hI[t];if(a>4)o[i++]=65533,n+=a-1;else{for(t&=2===a?31:3===a?15:7;a>1&&n<r;)t=t<<6|63&e[n++],a--;a>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&lI)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r})(o,i)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+hI[e[r]]>t?r:t}};var _I=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const fI=Object.prototype.toString,{Z_NO_FLUSH:EI,Z_SYNC_FLUSH:mI,Z_FULL_FLUSH:TI,Z_FINISH:gI,Z_OK:SI,Z_STREAM_END:vI,Z_DEFAULT_COMPRESSION:RI,Z_DEFAULT_STRATEGY:yI,Z_DEFLATED:AI}=ib;function bI(e){this.options=uI.assign({level:RI,method:AI,chunkSize:16384,windowBits:15,memLevel:8,strategy:yI},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _I,this.strm.avail_out=0;let r=cI.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==SI)throw new Error(nb[r]);if(t.header&&cI.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?pI.string2buf(t.dictionary):"[object ArrayBuffer]"===fI.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=cI.deflateSetDictionary(this.strm,e),r!==SI)throw new Error(nb[r]);this._dict_set=!0}}function II(e,t){const r=new bI(t);if(r.push(e,!0),r.err)throw r.msg||nb[r.err];return r.result}bI.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?gI:EI,"string"==typeof e?r.input=pI.string2buf(e):"[object ArrayBuffer]"===fI.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===mI||o===TI)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=cI.deflate(r,o),i===vI)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=cI.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===SI;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},bI.prototype.onData=function(e){this.chunks.push(e)},bI.prototype.onEnd=function(e){e===SI&&(this.result=uI.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var OI={Deflate:bI,deflate:II,deflateRaw:function(e,t){return(t=t||{}).raw=!0,II(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,II(e,t)},constants:ib};const CI=16209;var wI=function(e,t){let r,n,i,o,a,s,c,d,u,l,h,p,_,f,E,m,T,g,S,v,R,y,A,b;const I=e.state;r=e.next_in,A=e.input,n=r+(e.avail_in-5),i=e.next_out,b=e.output,o=i-(t-e.avail_out),a=i+(e.avail_out-257),s=I.dmax,c=I.wsize,d=I.whave,u=I.wnext,l=I.window,h=I.hold,p=I.bits,_=I.lencode,f=I.distcode,E=(1<<I.lenbits)-1,m=(1<<I.distbits)-1;e:do{p<15&&(h+=A[r++]<<p,p+=8,h+=A[r++]<<p,p+=8),T=_[h&E];t:for(;;){if(g=T>>>24,h>>>=g,p-=g,g=T>>>16&255,0===g)b[i++]=65535&T;else{if(!(16&g)){if(0==(64&g)){T=_[(65535&T)+(h&(1<<g)-1)];continue t}if(32&g){I.mode=16191;break e}e.msg="invalid literal/length code",I.mode=CI;break e}S=65535&T,g&=15,g&&(p<g&&(h+=A[r++]<<p,p+=8),S+=h&(1<<g)-1,h>>>=g,p-=g),p<15&&(h+=A[r++]<<p,p+=8,h+=A[r++]<<p,p+=8),T=f[h&m];r:for(;;){if(g=T>>>24,h>>>=g,p-=g,g=T>>>16&255,!(16&g)){if(0==(64&g)){T=f[(65535&T)+(h&(1<<g)-1)];continue r}e.msg="invalid distance code",I.mode=CI;break e}if(v=65535&T,g&=15,p<g&&(h+=A[r++]<<p,p+=8,p<g&&(h+=A[r++]<<p,p+=8)),v+=h&(1<<g)-1,v>s){e.msg="invalid distance too far back",I.mode=CI;break e}if(h>>>=g,p-=g,g=i-o,v>g){if(g=v-g,g>d&&I.sane){e.msg="invalid distance too far back",I.mode=CI;break e}if(R=0,y=l,0===u){if(R+=c-g,g<S){S-=g;do{b[i++]=l[R++]}while(--g);R=i-v,y=b}}else if(u<g){if(R+=c+u-g,g-=u,g<S){S-=g;do{b[i++]=l[R++]}while(--g);if(R=0,u<S){g=u,S-=g;do{b[i++]=l[R++]}while(--g);R=i-v,y=b}}}else if(R+=u-g,g<S){S-=g;do{b[i++]=l[R++]}while(--g);R=i-v,y=b}for(;S>2;)b[i++]=y[R++],b[i++]=y[R++],b[i++]=y[R++],S-=3;S&&(b[i++]=y[R++],S>1&&(b[i++]=y[R++]))}else{R=i-v;do{b[i++]=b[R++],b[i++]=b[R++],b[i++]=b[R++],S-=3}while(S>2);S&&(b[i++]=b[R++],S>1&&(b[i++]=b[R++]))}break}}break}}while(r<n&&i<a);S=p>>3,r-=S,p-=S<<3,h&=(1<<p)-1,e.next_in=r,e.next_out=i,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=i<a?a-i+257:257-(i-a),I.hold=h,I.bits=p};const NI=15,kI=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),DI=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),PI=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),LI=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var MI=(e,t,r,n,i,o,a,s)=>{const c=s.bits;let d,u,l,h,p,_,f=0,E=0,m=0,T=0,g=0,S=0,v=0,R=0,y=0,A=0,b=null;const I=new Uint16Array(16),O=new Uint16Array(16);let C,w,N,k=null;for(f=0;f<=NI;f++)I[f]=0;for(E=0;E<n;E++)I[t[r+E]]++;for(g=c,T=NI;T>=1&&0===I[T];T--);if(g>T&&(g=T),0===T)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(m=1;m<T&&0===I[m];m++);for(g<m&&(g=m),R=1,f=1;f<=NI;f++)if(R<<=1,R-=I[f],R<0)return-1;if(R>0&&(0===e||1!==T))return-1;for(O[1]=0,f=1;f<NI;f++)O[f+1]=O[f]+I[f];for(E=0;E<n;E++)0!==t[r+E]&&(a[O[t[r+E]]++]=E);if(0===e?(b=k=a,_=20):1===e?(b=kI,k=DI,_=257):(b=PI,k=LI,_=0),A=0,E=0,f=m,p=o,S=g,v=0,l=-1,y=1<<g,h=y-1,1===e&&y>852||2===e&&y>592)return 1;for(;;){C=f-v,a[E]+1<_?(w=0,N=a[E]):a[E]>=_?(w=k[a[E]-_],N=b[a[E]-_]):(w=96,N=0),d=1<<f-v,u=1<<S,m=u;do{u-=d,i[p+(A>>v)+u]=C<<24|w<<16|N|0}while(0!==u);for(d=1<<f-1;A&d;)d>>=1;if(0!==d?(A&=d-1,A+=d):A=0,E++,0==--I[f]){if(f===T)break;f=t[r+a[E]]}if(f>g&&(A&h)!==l){for(0===v&&(v=g),p+=m,S=f-v,R=1<<S;S+v<T&&(R-=I[S+v],!(R<=0));)S++,R<<=1;if(y+=1<<S,1===e&&y>852||2===e&&y>592)return 1;l=A&h,i[l]=g<<24|S<<16|p-o|0}}return 0!==A&&(i[p+A]=f-v<<24|64<<16|0),s.bits=g,0};const{Z_FINISH:UI,Z_BLOCK:xI,Z_TREES:VI,Z_OK:FI,Z_STREAM_END:BI,Z_NEED_DICT:jI,Z_STREAM_ERROR:GI,Z_DATA_ERROR:HI,Z_MEM_ERROR:WI,Z_BUF_ERROR:KI,Z_DEFLATED:zI}=ib,YI=16180,XI=16190,JI=16191,ZI=16192,qI=16194,QI=16199,$I=16200,eO=16206,tO=16209,rO=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function nO(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const iO=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<YI||t.mode>16211?1:0},oO=e=>{if(iO(e))return GI;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=YI,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,FI},aO=e=>{if(iO(e))return GI;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,oO(e)},sO=(e,t)=>{let r;if(iO(e))return GI;const n=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?GI:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,aO(e))},cO=(e,t)=>{if(!e)return GI;const r=new nO;e.state=r,r.strm=e,r.window=null,r.mode=YI;const n=sO(e,t);return n!==FI&&(e.state=null),n};let dO,uO,lO=!0;const hO=e=>{if(lO){dO=new Int32Array(512),uO=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(MI(1,e.lens,0,288,dO,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;MI(2,e.lens,0,32,uO,0,e.work,{bits:5}),lO=!1}e.lencode=dO,e.lenbits=9,e.distcode=uO,e.distbits=5},pO=(e,t,r,n)=>{let i;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(t.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(t.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(t.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var _O=(e,t)=>{let r,n,i,o,a,s,c,d,u,l,h,p,_,f,E,m,T,g,S,v,R,y,A=0;const b=new Uint8Array(4);let I,O;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(iO(e)||!e.output||!e.input&&0!==e.avail_in)return GI;r=e.state,r.mode===JI&&(r.mode=ZI),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,d=r.hold,u=r.bits,l=s,h=c,y=FI;e:for(;;)switch(r.mode){case YI:if(0===r.wrap){r.mode=ZI;break}for(;u<16;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}if(2&r.wrap&&35615===d){0===r.wbits&&(r.wbits=15),r.check=0,b[0]=255&d,b[1]=d>>>8&255,r.check=rb(r.check,b,2,0),d=0,u=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&d)<<8)+(d>>8))%31){e.msg="incorrect header check",r.mode=tO;break}if((15&d)!==zI){e.msg="unknown compression method",r.mode=tO;break}if(d>>>=4,u-=4,R=8+(15&d),0===r.wbits&&(r.wbits=R),R>15||R>r.wbits){e.msg="invalid window size",r.mode=tO;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&d?16189:JI,d=0,u=0;break;case 16181:for(;u<16;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}if(r.flags=d,(255&r.flags)!==zI){e.msg="unknown compression method",r.mode=tO;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=tO;break}r.head&&(r.head.text=d>>8&1),512&r.flags&&4&r.wrap&&(b[0]=255&d,b[1]=d>>>8&255,r.check=rb(r.check,b,2,0)),d=0,u=0,r.mode=16182;case 16182:for(;u<32;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}r.head&&(r.head.time=d),512&r.flags&&4&r.wrap&&(b[0]=255&d,b[1]=d>>>8&255,b[2]=d>>>16&255,b[3]=d>>>24&255,r.check=rb(r.check,b,4,0)),d=0,u=0,r.mode=16183;case 16183:for(;u<16;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}r.head&&(r.head.xflags=255&d,r.head.os=d>>8),512&r.flags&&4&r.wrap&&(b[0]=255&d,b[1]=d>>>8&255,r.check=rb(r.check,b,2,0)),d=0,u=0,r.mode=16184;case 16184:if(1024&r.flags){for(;u<16;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}r.length=d,r.head&&(r.head.extra_len=d),512&r.flags&&4&r.wrap&&(b[0]=255&d,b[1]=d>>>8&255,r.check=rb(r.check,b,2,0)),d=0,u=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(p=r.length,p>s&&(p=s),p&&(r.head&&(R=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+p),R)),512&r.flags&&4&r.wrap&&(r.check=rb(r.check,n,p,o)),s-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===s)break e;p=0;do{R=n[o+p++],r.head&&R&&r.length<65536&&(r.head.name+=String.fromCharCode(R))}while(R&&p<s);if(512&r.flags&&4&r.wrap&&(r.check=rb(r.check,n,p,o)),s-=p,o+=p,R)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===s)break e;p=0;do{R=n[o+p++],r.head&&R&&r.length<65536&&(r.head.comment+=String.fromCharCode(R))}while(R&&p<s);if(512&r.flags&&4&r.wrap&&(r.check=rb(r.check,n,p,o)),s-=p,o+=p,R)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;u<16;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}if(4&r.wrap&&d!==(65535&r.check)){e.msg="header crc mismatch",r.mode=tO;break}d=0,u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=JI;break;case 16189:for(;u<32;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}e.adler=r.check=rO(d),d=0,u=0,r.mode=XI;case XI:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=d,r.bits=u,jI;e.adler=r.check=1,r.mode=JI;case JI:if(t===xI||t===VI)break e;case ZI:if(r.last){d>>>=7&u,u-=7&u,r.mode=eO;break}for(;u<3;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}switch(r.last=1&d,d>>>=1,u-=1,3&d){case 0:r.mode=16193;break;case 1:if(hO(r),r.mode=QI,t===VI){d>>>=2,u-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=tO}d>>>=2,u-=2;break;case 16193:for(d>>>=7&u,u-=7&u;u<32;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}if((65535&d)!=(d>>>16^65535)){e.msg="invalid stored block lengths",r.mode=tO;break}if(r.length=65535&d,d=0,u=0,r.mode=qI,t===VI)break e;case qI:r.mode=16195;case 16195:if(p=r.length,p){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;i.set(n.subarray(o,o+p),a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=JI;break;case 16196:for(;u<14;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}if(r.nlen=257+(31&d),d>>>=5,u-=5,r.ndist=1+(31&d),d>>>=5,u-=5,r.ncode=4+(15&d),d>>>=4,u-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=tO;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;u<3;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}r.lens[C[r.have++]]=7&d,d>>>=3,u-=3}for(;r.have<19;)r.lens[C[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,I={bits:r.lenbits},y=MI(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,y){e.msg="invalid code lengths set",r.mode=tO;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;A=r.lencode[d&(1<<r.lenbits)-1],E=A>>>24,m=A>>>16&255,T=65535&A,!(E<=u);){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}if(T<16)d>>>=E,u-=E,r.lens[r.have++]=T;else{if(16===T){for(O=E+2;u<O;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}if(d>>>=E,u-=E,0===r.have){e.msg="invalid bit length repeat",r.mode=tO;break}R=r.lens[r.have-1],p=3+(3&d),d>>>=2,u-=2}else if(17===T){for(O=E+3;u<O;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}d>>>=E,u-=E,R=0,p=3+(7&d),d>>>=3,u-=3}else{for(O=E+7;u<O;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}d>>>=E,u-=E,R=0,p=11+(127&d),d>>>=7,u-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=tO;break}for(;p--;)r.lens[r.have++]=R}}if(r.mode===tO)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=tO;break}if(r.lenbits=9,I={bits:r.lenbits},y=MI(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,y){e.msg="invalid literal/lengths set",r.mode=tO;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},y=MI(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,y){e.msg="invalid distances set",r.mode=tO;break}if(r.mode=QI,t===VI)break e;case QI:r.mode=$I;case $I:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=d,r.bits=u,wI(e,h),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,d=r.hold,u=r.bits,r.mode===JI&&(r.back=-1);break}for(r.back=0;A=r.lencode[d&(1<<r.lenbits)-1],E=A>>>24,m=A>>>16&255,T=65535&A,!(E<=u);){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}if(m&&0==(240&m)){for(g=E,S=m,v=T;A=r.lencode[v+((d&(1<<g+S)-1)>>g)],E=A>>>24,m=A>>>16&255,T=65535&A,!(g+E<=u);){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}d>>>=g,u-=g,r.back+=g}if(d>>>=E,u-=E,r.back+=E,r.length=T,0===m){r.mode=16205;break}if(32&m){r.back=-1,r.mode=JI;break}if(64&m){e.msg="invalid literal/length code",r.mode=tO;break}r.extra=15&m,r.mode=16201;case 16201:if(r.extra){for(O=r.extra;u<O;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}r.length+=d&(1<<r.extra)-1,d>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;A=r.distcode[d&(1<<r.distbits)-1],E=A>>>24,m=A>>>16&255,T=65535&A,!(E<=u);){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}if(0==(240&m)){for(g=E,S=m,v=T;A=r.distcode[v+((d&(1<<g+S)-1)>>g)],E=A>>>24,m=A>>>16&255,T=65535&A,!(g+E<=u);){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}d>>>=g,u-=g,r.back+=g}if(d>>>=E,u-=E,r.back+=E,64&m){e.msg="invalid distance code",r.mode=tO;break}r.offset=T,r.extra=15&m,r.mode=16203;case 16203:if(r.extra){for(O=r.extra;u<O;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}r.offset+=d&(1<<r.extra)-1,d>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=tO;break}r.mode=16204;case 16204:if(0===c)break e;if(p=h-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=tO;break}p>r.wnext?(p-=r.wnext,_=r.wsize-p):_=r.wnext-p,p>r.length&&(p=r.length),f=r.window}else f=i,_=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{i[a++]=f[_++]}while(--p);0===r.length&&(r.mode=$I);break;case 16205:if(0===c)break e;i[a++]=r.length,c--,r.mode=$I;break;case eO:if(r.wrap){for(;u<32;){if(0===s)break e;s--,d|=n[o++]<<u,u+=8}if(h-=c,e.total_out+=h,r.total+=h,4&r.wrap&&h&&(e.adler=r.check=r.flags?rb(r.check,i,h,a-h):eb(r.check,i,h,a-h)),h=c,4&r.wrap&&(r.flags?d:rO(d))!==r.check){e.msg="incorrect data check",r.mode=tO;break}d=0,u=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;u<32;){if(0===s)break e;s--,d+=n[o++]<<u,u+=8}if(4&r.wrap&&d!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=tO;break}d=0,u=0}r.mode=16208;case 16208:y=BI;break e;case tO:y=HI;break e;case 16210:return WI;default:return GI}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=d,r.bits=u,(r.wsize||h!==e.avail_out&&r.mode<tO&&(r.mode<eO||t!==UI))&&pO(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,4&r.wrap&&h&&(e.adler=r.check=r.flags?rb(r.check,i,h,e.next_out-h):eb(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===JI?128:0)+(r.mode===QI||r.mode===qI?256:0),(0===l&&0===h||t===UI)&&y===FI&&(y=KI),y},fO={inflateReset:aO,inflateReset2:sO,inflateResetKeep:oO,inflateInit:e=>cO(e,15),inflateInit2:cO,inflate:_O,inflateEnd:e=>{if(iO(e))return GI;let t=e.state;return t.window&&(t.window=null),e.state=null,FI},inflateGetHeader:(e,t)=>{if(iO(e))return GI;const r=e.state;return 0==(2&r.wrap)?GI:(r.head=t,t.done=!1,FI)},inflateSetDictionary:(e,t)=>{const r=t.length;let n,i,o;return iO(e)?GI:(n=e.state,0!==n.wrap&&n.mode!==XI?GI:n.mode===XI&&(i=1,i=eb(i,t,r,0),i!==n.check)?HI:(o=pO(e,t,r,r),o?(n.mode=16210,WI):(n.havedict=1,FI)))},inflateInfo:"pako inflate (from Nodeca project)"};var EO=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const mO=Object.prototype.toString,{Z_NO_FLUSH:TO,Z_FINISH:gO,Z_OK:SO,Z_STREAM_END:vO,Z_NEED_DICT:RO,Z_STREAM_ERROR:yO,Z_DATA_ERROR:AO,Z_MEM_ERROR:bO}=ib;function IO(e){this.options=uI.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _I,this.strm.avail_out=0;let r=fO.inflateInit2(this.strm,t.windowBits);if(r!==SO)throw new Error(nb[r]);if(this.header=new EO,fO.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=pI.string2buf(t.dictionary):"[object ArrayBuffer]"===mO.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=fO.inflateSetDictionary(this.strm,t.dictionary),r!==SO)))throw new Error(nb[r])}function OO(e,t){const r=new IO(t);if(r.push(e),r.err)throw r.msg||nb[r.err];return r.result}IO.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,a,s;if(this.ended)return!1;for(a=t===~~t?t:!0===t?gO:TO,"[object ArrayBuffer]"===mO.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=fO.inflate(r,a),o===RO&&i&&(o=fO.inflateSetDictionary(r,i),o===SO?o=fO.inflate(r,a):o===AO&&(o=RO));r.avail_in>0&&o===vO&&r.state.wrap>0&&0!==e[r.next_in];)fO.inflateReset(r),o=fO.inflate(r,a);switch(o){case yO:case AO:case RO:case bO:return this.onEnd(o),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(0===r.avail_out||o===vO))if("string"===this.options.to){let e=pI.utf8border(r.output,r.next_out),t=r.next_out-e,i=pI.buf2string(r.output,e);r.next_out=t,r.avail_out=n-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==SO||0!==s){if(o===vO)return o=fO.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},IO.prototype.onData=function(e){this.chunks.push(e)},IO.prototype.onEnd=function(e){e===SO&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=uI.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var CO={Inflate:IO,inflate:OO,inflateRaw:function(e,t){return(t=t||{}).raw=!0,OO(e,t)},ungzip:OO,constants:ib};const{Deflate:wO,deflate:NO,deflateRaw:kO,gzip:DO}=OI,{Inflate:PO,inflate:LO,inflateRaw:MO,ungzip:UO}=CO;var xO,VO=NO,FO=LO;!function(e){e[e.ONE_BYTE=0]="ONE_BYTE",e[e.TWO_BYTE=1]="TWO_BYTE"}(xO||(xO={}));class BO{constructor(){this._sequence=0,this._startTime=Date.now(),this.isUseOneByte=!0}get startTime(){const e=Date.now()-this._startTime;return e<Math.pow(2,16)?e:(this._startTime+=Math.pow(2,16),this.startTime)}get sequence(){return this._sequence<Math.pow(2,32)?this._sequence++:(this._sequence-=Math.pow(2,32),this.sequence)}serialize(e){const t={commonPacketHeader:{length:0,reserved:0,extension:0,sequence:this.sequence},commonStreamHeader:this.startTime,extension:void 0,payload:e};if(e.byteLength>128){const r=new Uint8Array(4);r.set([1,0,0,0]);const n={id:0,length:4,data:r.buffer},i={profile:this.isUseOneByte?0:1,length:this.isUseOneByte?5:6,datas:[n]};t.commonPacketHeader.extension=1,t.extension=i,t.payload=this.compress(e),t.commonPacketHeader.length=8+(t.extension.length+2)+t.payload.byteLength}else t.commonPacketHeader.length=8+t.payload.byteLength;Yn("SHOW_DATASTREAM2_LOG")&&oi.debug("send data header: ".concat(JSON.stringify(t.commonPacketHeader)));const r=new ArrayBuffer(t.commonPacketHeader.length),n=new Uint8Array(r),i=new DataView(r);let o=0;if(i.setUint16(o,t.commonPacketHeader.extension<<15|t.commonPacketHeader.reserved<<14|t.commonPacketHeader.length,!0),o+=2,i.setUint32(o,t.commonPacketHeader.sequence,!0),o+=4,i.setUint16(o,t.commonStreamHeader,!0),o+=2,t.extension){const e=this.serializeExtension(t.extension);n.set(new Uint8Array(e),o),o+=e.byteLength}if(n.set(new Uint8Array(t.payload),o),o+=t.payload.byteLength,o!==t.commonPacketHeader.length)throw Error("serialize error!");return r}deserialize(e){if(e.byteLength<4)return new ArrayBuffer(0);const t=new DataView(e);let r=0;const n=t.getUint16(r,!0);r+=2;const i={length:16383&n,reserved:(16384&n)>>14,extension:(32768&n)>>15,sequence:t.getUint16(r+2,!0)<<16|t.getUint16(r,!0)};let o,a;if(r+=4,Yn("SHOW_DATASTREAM2_LOG")&&oi.debug("receive data header: ".concat(JSON.stringify(i))),t.getUint16(r,!0),r+=2,i.extension){a=this.deserializeExtension(e.slice(r)),r+=2+a.length,o=e.slice(r);let t=!1;if(a.datas.length>0){const e=a.datas.find((e=>0===e.id));if(e){t=1==(1&new DataView(e.data).getUint32(0,!0))}}o=t?this.decompress(o):o}else o=e.slice(8);return o}serializeExtension(e){const{profile:t,length:r,datas:n}=e,i=new ArrayBuffer(r+2),o=new Uint8Array(i),a=new DataView(i);let s=0;if(a.setUint8(s++,t),a.setUint8(s++,r),n.forEach((e=>{t?(a.setUint8(s++,e.id),a.setUint8(s++,e.length),o.set(new Uint8Array(e.data),s),s+=e.data.byteLength):(a.setUint8(s++,e.id|e.length<<4),o.set(new Uint8Array(e.data),s),s+=e.data.byteLength)})),s!==r+2)throw Error("serialize extension error, is ".concat(s,"!==").concat(r+2));return i}deserializeExtension(e){const t=new DataView(e);let r=0;const n=t.getUint8(r);r++;const i=t.getUint8(r);r++;const o=n===xO.TWO_BYTE,a=[],s=new DataView(e,2);let c=0;for(;c<i;){let e=0,t=0,r=new ArrayBuffer(0);o?(e=s.getUint8(c),c++,t=s.getUint8(c),c++):(e=15&s.getUint8(c),t=s.getUint8(c)>>4,c++),t>0&&(r=s.buffer.slice(c+2,c+2+t),c+=r.byteLength),a.push({id:e,length:t,data:r})}if(c!==i)throw Error("parse error");return{profile:n,length:i,datas:a}}decompress(e){return FO(new Uint8Array(e))}compress(e){return VO(new Uint8Array(e))}}class jO extends Ye{constructor(e,t){super(),this._version=1,this._type=3,this._config=void 0,this._originDataChannel=void 0,this._dataStreamPacketHeader=new ArrayBuffer(4),this._dataStreamPacketHandler=void 0,this._datachannelEventMap=new Map,this._config=e,t&&(this._originDataChannel=t,this._bandDataChannelEvents(t)),this._initPacketHeader(),this._dataStreamPacketHandler=new BO}get id(){return this._config.id}get ordered(){return this._config.ordered}get maxRetransmits(){return Yn("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 sR(((e,t)=>{if(this._originDataChannel){"open"===this._originDataChannel.readyState&&e();const r=setTimeout((()=>{var e;t(new Fe(Ue.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 Fe(Ue.DATACHANNEL_CONNECTION_TIMEOUT)}}else t(new Fe(Ue.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(t){this._unbindDataChannelEvents(t),[e.DataChannelEvents.OPEN,e.DataChannelEvents.CLOSE,e.DataChannelEvents.ERROR].forEach((e=>{const r=()=>{this.emit(e)};this._datachannelEventMap.set(e,r),t.addEventListener(e,r)}))}_unbindDataChannelEvents(e){Array.from(this._datachannelEventMap.entries()).forEach((t=>{let[r,n]=t;e.removeEventListener(r,n)})),this._datachannelEventMap.clear()}}var GO=gi,HO=wa("iterator"),WO=!GO((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2"),n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),r.delete("a",2),!e.toJSON||!r.has("a",1)||r.has("a",2)||!t.size&&true||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[HO]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host})),KO=kl,zO=yl,YO=Math.floor,XO=function(e,t){var r=e.length,n=YO(r/2);return r<8?JO(e,t):ZO(e,XO(zO(e,0,n),t),XO(zO(e,n),t),t)},JO=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},ZO=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},qO=Ks,QO=Ci,$O=Ji,eC=bi,tC=zi,rC=WO,nC=kl,iC=Pl,oC=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:KO(e,n,t[n],r);return e},aC=nh,sC=Ef,cC=gh,dC=MT,uC=Wi,lC=fa,hC=ps,pC=Ic,_C=gs,fC=To,EC=wc,mC=pl,TC=ro,gC=jm,SC=Lm,vC=KT,RC=XO,yC=wa("iterator"),AC="URLSearchParams",bC=AC+"Iterator",IC=cC.set,OC=cC.getterFor(AC),CC=cC.getterFor(bC),wC=Object.getOwnPropertyDescriptor,NC=function(e){if(!tC)return QO[e];var t=wC(QO,e);return t&&t.value},kC=NC("fetch"),DC=NC("Request"),PC=NC("Headers"),LC=DC&&DC.prototype,MC=PC&&PC.prototype,UC=QO.RegExp,xC=QO.TypeError,VC=QO.decodeURIComponent,FC=QO.encodeURIComponent,BC=eC("".charAt),jC=eC([].join),GC=eC([].push),HC=eC("".replace),WC=eC([].shift),KC=eC([].splice),zC=eC("".split),YC=eC("".slice),XC=/\+/g,JC=Array(4),ZC=function(e){return JC[e-1]||(JC[e-1]=UC("((?:%[\\da-f]{2}){"+e+"})","gi"))},qC=function(e){try{return VC(e)}catch(t){return e}},QC=function(e){var t=HC(e,XC," "),r=4;try{return VC(t)}catch(e){for(;r;)t=HC(t,ZC(r--),qC);return t}},$C=/[!'()~]|%20/g,ew={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},tw=function(e){return ew[e]},rw=function(e){return HC(FC(e),$C,tw)},nw=sC((function(e,t){IC(this,{type:bC,iterator:gC(OC(e).entries),kind:t})}),"Iterator",(function(){var e=CC(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),iw=function(e){this.entries=[],this.url=null,void 0!==e&&(fC(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===BC(e,0)?YC(e,1):e:EC(e)))};iw.prototype={type:AC,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=SC(e);if(c)for(r=(t=gC(e,c)).next;!(n=$O(r,t)).done;){if(o=(i=gC(_C(n.value))).next,(a=$O(o,i)).done||(s=$O(o,i)).done||!$O(o,i).done)throw xC("Expected sequence with length 2");GC(this.entries,{key:EC(a.value),value:EC(s.value)})}else for(var d in e)lC(e,d)&&GC(this.entries,{key:d,value:EC(e[d])})},parseQuery:function(e){if(e)for(var t,r,n=zC(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=zC(t,"="),GC(this.entries,{key:QC(WC(r)),value:QC(jC(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],GC(r,rw(e.key)+"="+rw(e.value));return jC(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var ow=function(){dC(this,aw);var e=IC(this,new iw(arguments.length>0?arguments[0]:void 0));tC||(this.size=e.entries.length)},aw=ow.prototype;if(oC(aw,{append:function(e,t){var r=OC(this);vC(arguments.length,2),GC(r.entries,{key:EC(e),value:EC(t)}),tC||this.length++,r.updateURL()},delete:function(e){for(var t=OC(this),r=vC(arguments.length,1),n=t.entries,i=EC(e),o=r<2?void 0:arguments[1],a=void 0===o?o:EC(o),s=0;s<n.length;){var c=n[s];if(c.key!==i||void 0!==a&&c.value!==a)s++;else if(KC(n,s,1),void 0!==a)break}tC||(this.size=n.length),t.updateURL()},get:function(e){var t=OC(this).entries;vC(arguments.length,1);for(var r=EC(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=OC(this).entries;vC(arguments.length,1);for(var r=EC(e),n=[],i=0;i<t.length;i++)t[i].key===r&&GC(n,t[i].value);return n},has:function(e){for(var t=OC(this).entries,r=vC(arguments.length,1),n=EC(e),i=r<2?void 0:arguments[1],o=void 0===i?i:EC(i),a=0;a<t.length;){var s=t[a++];if(s.key===n&&(void 0===o||s.value===o))return!0}return!1},set:function(e,t){var r=OC(this);vC(arguments.length,1);for(var n,i=r.entries,o=!1,a=EC(e),s=EC(t),c=0;c<i.length;c++)(n=i[c]).key===a&&(o?KC(i,c--,1):(o=!0,n.value=s));o||GC(i,{key:a,value:s}),tC||(this.size=i.length),r.updateURL()},sort:function(){var e=OC(this);RC(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=OC(this).entries,n=hC(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 nw(this,"keys")},values:function(){return new nw(this,"values")},entries:function(){return new nw(this,"entries")}},{enumerable:!0}),nC(aw,yC,aw.entries,{name:"entries"}),nC(aw,"toString",(function(){return OC(this).serialize()}),{enumerable:!0}),tC&&iC(aw,"size",{get:function(){return OC(this).entries.length},configurable:!0,enumerable:!0}),aC(ow,AC),qO({global:!0,constructor:!0,forced:!rC},{URLSearchParams:ow}),!rC&&uC(PC)){var sw=eC(MC.has),cw=eC(MC.set),dw=function(e){if(fC(e)){var t,r=e.body;if(pC(r)===AC)return t=e.headers?new PC(e.headers):new PC,sw(t,"content-type")||cw(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),mC(e,{body:TC(0,EC(r)),headers:TC(0,t)})}return e};if(uC(kC)&&qO({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return kC(e,arguments.length>1?dw(arguments[1]):{})}}),uC(DC)){var uw=function(e){return dC(this,LC),new DC(e,arguments.length>1?dw(arguments[1]):{})};LC.constructor=uw,uw.prototype=LC,qO({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:uw})}}var lw,hw={URLSearchParams:ow,getState:OC},pw=zi,_w=bi,fw=Ji,Ew=gi,mw=Gu,Tw=wl,gw=Zi,Sw=ha,vw=so,Rw=Object.assign,yw=Object.defineProperty,Aw=_w([].concat),bw=!Rw||Ew((function(){if(pw&&1!==Rw({b:1},Rw(yw({},"a",{enumerable:!0,get:function(){yw(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=Rw({},e)[r]||mw(Rw({},t)).join("")!=n}))?function(e,t){for(var r=Sw(e),n=arguments.length,i=1,o=Tw.f,a=gw.f;n>i;)for(var s,c=vw(arguments[i++]),d=o?Aw(mw(c),o(c)):mw(c),u=d.length,l=0;u>l;)s=d[l++],pw&&!fw(a,c,s)||(r[s]=c[s]);return r}:Rw,Iw=gs,Ow=Km,Cw=ps,ww=Ji,Nw=ha,kw=function(e,t,r,n){try{return n?t(Iw(r)[0],r[1]):t(r)}catch(t){Ow(e,"throw",t)}},Dw=Cm,Pw=au,Lw=nc,Mw=Gd,Uw=jm,xw=Lm,Vw=Array,Fw=bi,Bw=2147483647,jw=/[^\0-\u007E]/,Gw=/[.\u3002\uFF0E\uFF61]/g,Hw="Overflow: input needs wider integers to process",Ww=RangeError,Kw=Fw(Gw.exec),zw=Math.floor,Yw=String.fromCharCode,Xw=Fw("".charCodeAt),Jw=Fw([].join),Zw=Fw([].push),qw=Fw("".replace),Qw=Fw("".split),$w=Fw("".toLowerCase),eN=function(e){return e+22+75*(e<26)},tN=function(e,t,r){var n=0;for(e=r?zw(e/700):e>>1,e+=zw(e/t);e>455;)e=zw(e/35),n+=36;return zw(n+36*e/(e+38))},rN=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=Xw(e,r++);if(i>=55296&&i<=56319&&r<n){var o=Xw(e,r++);56320==(64512&o)?Zw(t,((1023&i)<<10)+(1023&o)+65536):(Zw(t,i),r--)}else Zw(t,i)}return t}(e);var r,n,i=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&Zw(t,Yw(n));var c=t.length,d=c;for(c&&Zw(t,"-");d<i;){var u=Bw;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<u&&(u=n);var l=d+1;if(u-o>zw((Bw-a)/l))throw Ww(Hw);for(a+=(u-o)*l,o=u,r=0;r<e.length;r++){if((n=e[r])<o&&++a>Bw)throw Ww(Hw);if(n==o){for(var h=a,p=36;;){var _=p<=s?1:p>=s+26?26:p-s;if(h<_)break;var f=h-_,E=36-_;Zw(t,Yw(eN(_+f%E))),h=zw(f/E),p+=36}Zw(t,Yw(eN(h))),s=tN(a,l,d==c),a=0,d++}}a++,o++}return Jw(t,"")},nN=Ks,iN=zi,oN=WO,aN=Ci,sN=ps,cN=bi,dN=kl,uN=Pl,lN=MT,hN=fa,pN=bw,_N=function(e){var t=Nw(e),r=Pw(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=Cw(i,n>2?arguments[2]:void 0));var a,s,c,d,u,l,h=xw(t),p=0;if(!h||this===Vw&&Dw(h))for(a=Lw(t),s=r?new this(a):Vw(a);a>p;p++)l=o?i(t[p],p):t[p],Mw(s,p,l);else for(u=(d=Uw(t,h)).next,s=r?new this:[];!(c=ww(u,d)).done;p++)l=o?kw(d,i,[c.value,p],!0):c.value,Mw(s,p,l);return s.length=p,s},fN=yl,EN=GE.codeAt,mN=function(e){var t,r,n=[],i=Qw(qw($w(e),Gw,"."),".");for(t=0;t<i.length;t++)r=i[t],Zw(n,Kw(jw,r)?"xn--"+rN(r):r);return Jw(n,".")},TN=wc,gN=nh,SN=KT,vN=hw,RN=gh,yN=RN.set,AN=RN.getterFor("URL"),bN=vN.URLSearchParams,IN=vN.getState,ON=aN.URL,CN=aN.TypeError,wN=aN.parseInt,NN=Math.floor,kN=Math.pow,DN=cN("".charAt),PN=cN(/./.exec),LN=cN([].join),MN=cN(1..toString),UN=cN([].pop),xN=cN([].push),VN=cN("".replace),FN=cN([].shift),BN=cN("".split),jN=cN("".slice),GN=cN("".toLowerCase),HN=cN([].unshift),WN="Invalid scheme",KN="Invalid host",zN="Invalid port",YN=/[a-z]/i,XN=/[\d+-.a-z]/i,JN=/\d/,ZN=/^0x/i,qN=/^[0-7]+$/,QN=/^\d+$/,$N=/^[\da-f]+$/i,ek=/[\0\t\n\r #%/:<>?@[\\\]^|]/,tk=/[\0\t\n\r #/:<>?@[\\\]^|]/,rk=/^[\u0000-\u0020]+/,nk=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,ik=/[\t\n\r]/g,ok=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)HN(t,e%256),e=NN(e/256);return LN(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&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=MN(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},ak={},sk=pN({},ak,{" ":1,'"':1,"<":1,">":1,"`":1}),ck=pN({},sk,{"#":1,"?":1,"{":1,"}":1}),dk=pN({},ck,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),uk=function(e,t){var r=EN(e,0);return r>32&&r<127&&!hN(t,e)?e:encodeURIComponent(e)},lk={ftp:21,file:null,http:80,https:443,ws:80,wss:443},hk=function(e,t){var r;return 2==e.length&&PN(YN,DN(e,0))&&(":"==(r=DN(e,1))||!t&&"|"==r)},pk=function(e){var t;return e.length>1&&hk(jN(e,0,2))&&(2==e.length||"/"===(t=DN(e,2))||"\\"===t||"?"===t||"#"===t)},_k=function(e){return"."===e||"%2e"===GN(e)},fk={},Ek={},mk={},Tk={},gk={},Sk={},vk={},Rk={},yk={},Ak={},bk={},Ik={},Ok={},Ck={},wk={},Nk={},kk={},Dk={},Pk={},Lk={},Mk={},Uk=function(e,t,r){var n,i,o,a=TN(e);if(t){if(i=this.parse(a))throw CN(i);this.searchParams=null}else{if(void 0!==r&&(n=new Uk(r,!0)),i=this.parse(a,null,n))throw CN(i);(o=IN(new bN)).bindURL(this),this.searchParams=o}};Uk.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,d=t||fk,u=0,l="",h=!1,p=!1,_=!1;for(e=TN(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=VN(e,rk,""),e=VN(e,nk,"$1")),e=VN(e,ik,""),n=_N(e);u<=n.length;){switch(i=n[u],d){case fk:if(!i||!PN(YN,i)){if(t)return WN;d=mk;continue}l+=GN(i),d=Ek;break;case Ek:if(i&&(PN(XN,i)||"+"==i||"-"==i||"."==i))l+=GN(i);else{if(":"!=i){if(t)return WN;l="",d=mk,u=0;continue}if(t&&(c.isSpecial()!=hN(lk,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&lk[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?d=Ck:c.isSpecial()&&r&&r.scheme==c.scheme?d=Tk:c.isSpecial()?d=Rk:"/"==n[u+1]?(d=gk,u++):(c.cannotBeABaseURL=!0,xN(c.path,""),d=Pk)}break;case mk:if(!r||r.cannotBeABaseURL&&"#"!=i)return WN;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=fN(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,d=Mk;break}d="file"==r.scheme?Ck:Sk;continue;case Tk:if("/"!=i||"/"!=n[u+1]){d=Sk;continue}d=yk,u++;break;case gk:if("/"==i){d=Ak;break}d=Dk;continue;case Sk:if(c.scheme=r.scheme,i==lw)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=fN(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())d=vk;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=fN(r.path),c.query="",d=Lk;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=fN(r.path),c.path.length--,d=Dk;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=fN(r.path),c.query=r.query,c.fragment="",d=Mk}break;case vk:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,d=Dk;continue}d=Ak}else d=yk;break;case Rk:if(d=yk,"/"!=i||"/"!=DN(l,u+1))continue;u++;break;case yk:if("/"!=i&&"\\"!=i){d=Ak;continue}break;case Ak:if("@"==i){h&&(l="%40"+l),h=!0,o=_N(l);for(var f=0;f<o.length;f++){var E=o[f];if(":"!=E||_){var m=uk(E,dk);_?c.password+=m:c.username+=m}else _=!0}l=""}else if(i==lw||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";u-=_N(l).length+1,l="",d=bk}else l+=i;break;case bk:case Ik:if(t&&"file"==c.scheme){d=Nk;continue}if(":"!=i||p){if(i==lw||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return KN;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",d=kk,t)return;continue}"["==i?p=!0:"]"==i&&(p=!1),l+=i}else{if(""==l)return KN;if(a=c.parseHost(l))return a;if(l="",d=Ok,t==Ik)return}break;case Ok:if(!PN(JN,i)){if(i==lw||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var T=wN(l,10);if(T>65535)return zN;c.port=c.isSpecial()&&T===lk[c.scheme]?null:T,l=""}if(t)return;d=kk;continue}return zN}l+=i;break;case Ck:if(c.scheme="file","/"==i||"\\"==i)d=wk;else{if(!r||"file"!=r.scheme){d=Dk;continue}if(i==lw)c.host=r.host,c.path=fN(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=fN(r.path),c.query="",d=Lk;else{if("#"!=i){pk(LN(fN(n,u),""))||(c.host=r.host,c.path=fN(r.path),c.shortenPath()),d=Dk;continue}c.host=r.host,c.path=fN(r.path),c.query=r.query,c.fragment="",d=Mk}}break;case wk:if("/"==i||"\\"==i){d=Nk;break}r&&"file"==r.scheme&&!pk(LN(fN(n,u),""))&&(hk(r.path[0],!0)?xN(c.path,r.path[0]):c.host=r.host),d=Dk;continue;case Nk:if(i==lw||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&hk(l))d=Dk;else if(""==l){if(c.host="",t)return;d=kk}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",d=kk}continue}l+=i;break;case kk:if(c.isSpecial()){if(d=Dk,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=lw&&(d=Dk,"/"!=i))continue}else c.fragment="",d=Mk;else c.query="",d=Lk;break;case Dk:if(i==lw||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=GN(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||xN(c.path,"")):_k(l)?"/"==i||"\\"==i&&c.isSpecial()||xN(c.path,""):("file"==c.scheme&&!c.path.length&&hk(l)&&(c.host&&(c.host=""),l=DN(l,0)+":"),xN(c.path,l)),l="","file"==c.scheme&&(i==lw||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)FN(c.path);"?"==i?(c.query="",d=Lk):"#"==i&&(c.fragment="",d=Mk)}else l+=uk(i,ck);break;case Pk:"?"==i?(c.query="",d=Lk):"#"==i?(c.fragment="",d=Mk):i!=lw&&(c.path[0]+=uk(i,ak));break;case Lk:t||"#"!=i?i!=lw&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":uk(i,ak)):(c.fragment="",d=Mk);break;case Mk:i!=lw&&(c.fragment+=uk(i,sk))}u++}},parseHost:function(e){var t,r,n;if("["==DN(e,0)){if("]"!=DN(e,e.length-1))return KN;if(t=function(e){var t,r,n,i,o,a,s,c=[0,0,0,0,0,0,0,0],d=0,u=null,l=0,h=function(){return DN(e,l)};if(":"==h()){if(":"!=DN(e,1))return;l+=2,u=++d}for(;h();){if(8==d)return;if(":"!=h()){for(t=r=0;r<4&&PN($N,h());)t=16*t+wN(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,d>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!PN(JN,h()))return;for(;PN(JN,h());){if(o=wN(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[d]=256*c[d]+i,2!=++n&&4!=n||d++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[d++]=t}else{if(null!==u)return;l++,u=++d}}if(null!==u)for(a=d-u,d=7;0!=d&&a>0;)s=c[d],c[d--]=c[u+a-1],c[u+--a]=s;else if(8!=d)return;return c}(jN(e,1,-1)),!t)return KN;this.host=t}else if(this.isSpecial()){if(e=mN(e),PN(ek,e))return KN;if(t=function(e){var t,r,n,i,o,a,s,c=BN(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==DN(i,0)&&(o=PN(ZN,i)?16:8,i=jN(i,8==o?1:2)),""===i)a=0;else{if(!PN(10==o?QN:8==o?qN:$N,i))return e;a=wN(i,o)}xN(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=kN(256,5-t))return null}else if(a>255)return null;for(s=UN(r),n=0;n<r.length;n++)s+=r[n]*kN(256,3-n);return s}(e),null===t)return KN;this.host=t}else{if(PN(tk,e))return KN;for(t="",r=_N(e),n=0;n<r.length;n++)t+=uk(r[n],ak);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return hN(lk,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&hk(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,a=e.path,s=e.query,c=e.fragment,d=t+":";return null!==i?(d+="//",e.includesCredentials()&&(d+=r+(n?":"+n:"")+"@"),d+=ok(i),null!==o&&(d+=":"+o)):"file"==t&&(d+="//"),d+=e.cannotBeABaseURL?a[0]:a.length?"/"+LN(a,"/"):"",null!==s&&(d+="?"+s),null!==c&&(d+="#"+c),d},setHref:function(e){var t=this.parse(e);if(t)throw CN(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new xk(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+ok(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(TN(e)+":",fk)},getUsername:function(){return this.username},setUsername:function(e){var t=_N(TN(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=uk(t[r],dk)}},getPassword:function(){return this.password},setPassword:function(e){var t=_N(TN(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=uk(t[r],dk)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?ok(e):ok(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,bk)},getHostname:function(){var e=this.host;return null===e?"":ok(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Ik)},getPort:function(){var e=this.port;return null===e?"":TN(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=TN(e))?this.port=null:this.parse(e,Ok))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+LN(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,kk))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=TN(e))?this.query=null:("?"==DN(e,0)&&(e=jN(e,1)),this.query="",this.parse(e,Lk)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=TN(e))?("#"==DN(e,0)&&(e=jN(e,1)),this.fragment="",this.parse(e,Mk)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var xk=function(e){var t=lN(this,Vk),r=SN(arguments.length,1)>1?arguments[1]:void 0,n=yN(t,new Uk(e,!1,r));iN||(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())},Vk=xk.prototype,Fk=function(e,t){return{get:function(){return AN(this)[e]()},set:t&&function(e){return AN(this)[t](e)},configurable:!0,enumerable:!0}};if(iN&&(uN(Vk,"href",Fk("serialize","setHref")),uN(Vk,"origin",Fk("getOrigin")),uN(Vk,"protocol",Fk("getProtocol","setProtocol")),uN(Vk,"username",Fk("getUsername","setUsername")),uN(Vk,"password",Fk("getPassword","setPassword")),uN(Vk,"host",Fk("getHost","setHost")),uN(Vk,"hostname",Fk("getHostname","setHostname")),uN(Vk,"port",Fk("getPort","setPort")),uN(Vk,"pathname",Fk("getPathname","setPathname")),uN(Vk,"search",Fk("getSearch","setSearch")),uN(Vk,"searchParams",Fk("getSearchParams")),uN(Vk,"hash",Fk("getHash","setHash"))),dN(Vk,"toJSON",(function(){return AN(this).serialize()}),{enumerable:!0}),dN(Vk,"toString",(function(){return AN(this).serialize()}),{enumerable:!0}),ON){var Bk=ON.createObjectURL,jk=ON.revokeObjectURL;Bk&&dN(xk,"createObjectURL",sN(Bk,ON)),jk&&dN(xk,"revokeObjectURL",sN(jk,ON))}gN(xk,"URL"),nN({global:!0,constructor:!0,forced:!oN,sham:!iN},{URL:xk});var Gk=Ks,Hk=gi,Wk=KT,Kk=wc,zk=WO,Yk=Ao("URL");Gk({target:"URL",stat:!0,forced:!(zk&&Hk((function(){Yk.canParse()})))},{canParse:function(e){var t=Wk(arguments.length,1),r=Kk(e),n=t<2||void 0===arguments[1]?void 0:Kk(arguments[1]);try{return!!new Yk(r,n)}catch(e){return!1}}});var Xk=J(go.URL);function Jk(){const e=new Blob([atob("ZnVuY3Rpb24gZShlKXtjb25zdCB0PW5ldyBEYXRhVmlldyhlLmRhdGEpO2lmKDA9PT10LmdldFVpbnQ4KDApJiYwPT09dC5nZXRVaW50OCgxKSYmMD09PXQuZ2V0VWludDgoMikmJjE9PT10LmdldFVpbnQ4KDMpJiY2PT09dC5nZXRVaW50OCg0KSl7bGV0IG49NixyPTAsbz0wO2Zvcig7MjU1PT09KG89dC5nZXRVaW50OChuKyspKTspcis9MjU1O3IrPW87Y29uc3QgYT1mdW5jdGlvbihlLHQsbil7bGV0IHI9bmV3IFVpbnQ4QXJyYXkoZSx0LG4pLG89W10sYT0wO2Zvcig7YTxuOylhKzM8biYmMD09PXJbYV0mJjA9PT1yW2ErMV0mJjM9PT1yW2ErMl0mJigwPT09clthKzNdfHwxPT09clthKzNdfHwyPT09clthKzNdfHwzPT09clthKzNdKT8oby5wdXNoKHJbYV0sclthKzFdLHJbYSszXSksYSs9NCk6KG8ucHVzaChyW2FdKSxhKyspO3JldHVybiBuZXcgVWludDhBcnJheShvKX0oZS5kYXRhLG4scik7cmV0dXJuIG5ldyBVaW50OEFycmF5KGEpfXJldHVybiBudWxsfWZ1bmN0aW9uIHQoZSx0KXtjb25zdCBuPWZ1bmN0aW9uKGUpe2NvbnN0IHQ9ZS5sZW5ndGg7bGV0IG49W10scj0wO2Zvcig7cjx0OylyKzI8dCYmMD09PWVbcl0mJjA9PT1lW3IrMV0mJigwPT09ZVtyKzJdfHwxPT09ZVtyKzJdfHwyPT09ZVtyKzJdfHwzPT09ZVtyKzJdKT8obi5wdXNoKGVbcl0sZVtyKzFdLDMsZVtyKzJdKSxyKz0zKToobi5wdXNoKGVbcl0pLHIrKyk7cmV0dXJuIG5ldyBVaW50OEFycmF5KG4pfSh0KSxyPW4ubGVuZ3RoLG89TWF0aC5mbG9vcihyLzI1NSksYT1yJTI1NSxzPW5ldyBVaW50OEFycmF5KDYrbysxK3IrZS5ieXRlTGVuZ3RoKTtzWzBdPTAsc1sxXT0wLHNbMl09MCxzWzNdPTEsc1s0XT02LHNbNV09MTAxO2xldCBpPTA7Zm9yKDtpPG87KXNbNitpXT0yNTUsaSsrO3JldHVybiBzWzYraV09YSxpKysscy5zZXQobiw2K2kpLHMuc2V0KG5ldyBVaW50OEFycmF5KGUpLDYraStyKSxzLmJ1ZmZlcn1uYXZpZ2F0b3IudXNlckFnZW50LmluZGV4T2YoIlNhZmFyaSIpPi0xJiYtMT09PW5hdmlnYXRvci51c2VyQWdlbnQuaW5kZXhPZigiQ2hyb21lIikmJihzZWxmLm9ucnRjdHJhbnNmb3JtPW49Pntjb25zdCByPW4udHJhbnNmb3JtZXI7bGV0IG89W107ci5vcHRpb25zLnBvcnQub25tZXNzYWdlPWU9PntlLmRhdGEuc2VpJiZvLnB1c2goZS5kYXRhLnNlaSl9LHNlbGYucG9zdE1lc3NhZ2UoInN0YXJ0ZWQiKTtjb25zdCBhPXIucmVhZGFibGUuZ2V0UmVhZGVyKCkscz1yLndyaXRhYmxlLmdldFdyaXRlcigpOyJyeCI9PT1yLm9wdGlvbnMubmFtZT9mdW5jdGlvbiB0KG4pe2EucmVhZCgpLnRoZW4oKHI9PntpZighci5kb25lKXtpZihyLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IHQ9ZShyLnZhbHVlKTt0JiZuLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7c2VpOnR9KX1zLndyaXRlKHIudmFsdWUpLG4ub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQobil9fSkpfShyKToidHgiPT09ci5vcHRpb25zLm5hbWUmJmZ1bmN0aW9uIGUobil7YS5yZWFkKCkudGhlbigocj0+e2lmKCFyLmRvbmUpe2lmKHIudmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3QgZT1vLnNoaWZ0KCk7ZSYmKHIudmFsdWUuZGF0YT10KHIudmFsdWUuZGF0YSxlKSl9cy53cml0ZShyLnZhbHVlKSxuLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSxlKG4pfX0pKX0ocil9LHNlbGYucG9zdE1lc3NhZ2UoInJlZ2lzdGVyZWQiKSk7Cg==")],{type:"text/javascript"});return setTimeout((()=>Xk.revokeObjectURL(e)),0),new Worker(Xk.createObjectURL(e))}const Zk=new Map;const qk=new Map;function Qk(e){const t=new DataView(e.data);if(0===t.getUint8(0)&&0===t.getUint8(1)&&0===t.getUint8(2)&&1===t.getUint8(3)&&6===t.getUint8(4)){let r=6,n=0,i=0;for(;255===(i=t.getUint8(r++));)n+=255;n+=i;const o=function(e,t,r){let n=new Uint8Array(e,t,r),i=[],o=0;for(;o<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)}(e.data,r,n);return new Uint8Array(o)}return null}function $k(e,t){const r=function(e){const t=e.length;let r=[],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)}(t),n=r.length,i=Math.floor(n/255),o=n%255,a=new Uint8Array(6+i+1+n+e.byteLength);a[0]=0,a[1]=0,a[2]=0,a[3]=1,a[4]=6,a[5]=101;let s=0;for(;s<i;)a[6+s]=255,s++;return a[6+s]=o,s++,a.set(r,6+s),a.set(new Uint8Array(e),6+s+n),a.buffer}const eD=new Map;const tD=new Map;Ei(),e.AUDIO_ENCODER_CONFIG_SETTINGS=td,e.AudioProcessorContext=vy,e.AudioProcessorDestination=Sy,e.BufferSourceAudioTrack=Cy,e.CameraVideoTrack=aA,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=Td,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=gd,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=Sd,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=vd,e.DataChannel=jO,e.DeviceManager=qR,e.LocalAudioTrack=Iy,e.LocalDataChannel=class extends jO{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=lR,e.LocalVideoTrack=oA,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.MicrophoneAudioTrack=Oy,e.MixingAudioTrack=wy,e.RemoteAudioTrack=_A,e.RemoteDataChannel=class extends jO{constructor(t){super(t),this._messageListener=void 0,this._messageListener=t=>{if(t.data.byteLength<this._dataStreamPacketHeader.byteLength)throw Error("invalid byteLength: the byte length must exceed "+this._dataStreamPacketHeader.byteLength);const r=t.data.slice(0,this._dataStreamPacketHeader.byteLength),n=new DataView(r).getUint8(3);if(n!==this.id)return void(Yn("SHOW_DATASTREAM2_LOG")&&oi.debug("invalid datachannel id: ".concat(n," !== ").concat(this.id)));let i=t.data.slice(this._dataStreamPacketHeader.byteLength);i=this._dataStreamPacketHandler.deserialize(i),this.emit(e.DataChannelEvents.MESSAGE,i)}}_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.RemoteTrack=hA,e.RemoteVideoTrack=pA,e.SAFARI_GLOBAL_GUM_LOCK=zR,e.SUPPORT_720P_AUTO_CONFIG_LIST=Jc,e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=Zc,e.SUPPORT_SVC_CONFIG_LIST=qc,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=Xc,e.Track=uR,e.VideoProcessorContext=gy,e.VideoProcessorDestination=Ty,e.__TRACK_LIST__=nd,e.addTrack=id,e.audioContextState=fR,e.audioElementPlayCenter=ay,e.audioTimerLoop=function(e,t){let r=!1;const n=1/t;if(Yn("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*n)}else{const t=mR();let i=t.createGain();i.gain.value=0,i.connect(t.destination);const o=()=>{if(r)return void(i=null);const a=t.createOscillator();a.onended=o,a.connect(i),a.start(0),a.stop(t.currentTime+n),e(t.currentTime)};o()}return()=>{r=!0}},e.autoPlayGestureEventEmitter=ey,e.blob2Uint8Array=Uy,e.checkMediaStreamTrackResolution=Gy,e.checkTrackState=sy,e.createBufferSourceAudioTrack=async function(e){var t;const{cacheOnlineFile:r,encoderConfig:n}=e;let{source:i}=e;const o={source:i instanceof AudioBuffer?"AudioBuffer":i instanceof File?null!==(t=File.name)&&void 0!==t?t:"File":i,cacheOnlineFile:r,encoderConfig:n},a=_i.reportApiInvoke(null,{tag:Qe.TRACER,name:qe.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(Yn("DISABLE_WEBAUDIO"))throw new Fe(Ue.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");const s=mt(8,"track-buf-");oi.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=Ly.get(e);if(t)return oi.debug("use cached audio resource: ",e),t;try{r=(await wt((()=>Un.get(e,{responseType:"arraybuffer"})),void 0,void 0,{maxRetryCount:3})).data}catch(e){throw new Fe(Ue.FETCH_AUDIO_FILE_FAILED,e.toString())}}else{const t=new sR(((t,r)=>{const n=new FileReader;n.onload=e=>{e.target?t(e.target.result):r(new Fe(Ue.READ_LOCAL_AUDIO_FILE_ERROR))},n.onerror=()=>{r(new Fe(Ue.READ_LOCAL_AUDIO_FILE_ERROR))},n.readAsArrayBuffer(e)}));r=await t}const n=await SR(r);return"string"==typeof e&&t&&Ly.set(e,n),n}(i,r)}catch(e){return a.onError(e),e.throw(oi)}const d=new Py(i),u=new Cy(c,d,n?rd(n):{},s);return oi.info("create buffer source audio track success, trackId:",s),a.onSuccess(u.getTrackId()),u},e.createCameraVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=_i.reportApiInvoke(null,{tag:Qe.TRACER,name:qe.CREATE_CAM_VIDEO_TRACK,options:[cA({},e)]}),r=Ny(e),n=mt(8,"track-cam-");let i=null;const o="720p_auto"===e.encoderConfig;oi.info("start create camera video track with config",JSON.stringify(e),"trackId",n);try{i=(await YR({video:r},n)).getVideoTracks()[0]||null}catch(e){throw t.onError(e),e}if(!i){const e=new Fe(Ue.UNEXPECTED_ERROR,"can not find track in media stream");return t.onError(e),e.throw(oi)}e.optimizationMode&&dA(n,i,e,Qc(e.encoderConfig));const a=new aA(i,e,r,e.scalabiltyMode?ed(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,n);return o&&a.startMonitorStats(),t.onSuccess(a.getTrackId()),oi.info("create camera video success, trackId:",n),a},e.createCustomAudioTrack=function(e){const t=_i.reportApiInvoke(null,{tag:Qe.TRACER,name:qe.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),r=new Iy(e.mediaStreamTrack,e.encoderConfig?rd(e.encoderConfig):{},mt(8,"track-cus-"),!1);return oi.info("create custom audio track success with config",e,"trackId",r.getTrackId()),t.onSuccess(r.getTrackId()),r},e.createCustomVideoTrack=function(t){const r=_i.reportApiInvoke(null,{tag:Qe.TRACER,name:qe.CREATE_CUSTOM_VIDEO_TRACK,options:[t]}),n=new oA(t.mediaStreamTrack,{width:t.width,height:t.height,frameRate:t.frameRate,bitrateMax:t.bitrateMax,bitrateMin:t.bitrateMin},t.scalabiltyMode?ed(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,mt(8,"track-cus-"),[e.TrackHint.CUSTOM_TRACK]);return r.onSuccess(n.getTrackId()),oi.info("create custom video track success with config",t,"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=_i.reportApiInvoke(null,{tag:Qe.TRACER,name:qe.CREATE_MIC_AND_CAM_TRACKS,options:[e,t]}),n="720p_auto"===t.encoderConfig,i=Ny(t),o=Dy(e),a=mt(8,"track-mic-"),s=mt(8,"track-cam-");let c=null,d=null;oi.info("start create camera video track(".concat(s,") and microphone audio track(").concat(a,") with config, audio: ").concat(JSON.stringify(e),", video: ").concat(JSON.stringify(t)));try{const e=await YR({audio:o,video:i},"".concat(a,"-").concat(s));c=e.getAudioTracks()[0],d=e.getVideoTracks()[0]}catch(e){throw r.onError(e),e}if(!c||!d){const e=new Fe(Ue.UNEXPECTED_ERROR,"can not find tracks in media stream");return r.onError(e),e.throw(oi)}t.optimizationMode&&dA(s,d,t,Qc(t.encoderConfig));const u=new Oy(c,e,o,a),l=new aA(d,t,i,t.scalabiltyMode?ed(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,s);return n&&l.startMonitorStats(),r.onSuccess([u.getTrackId(),l.getTrackId()]),oi.info("create camera video track(".concat(s,") and microphone audio track(").concat(a,") success")),[u,l]},e.createMicrophoneAudioTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=_i.reportApiInvoke(null,{tag:Qe.TRACER,name:qe.CREATE_MIC_AUDIO_TRACK,options:[e]}),r=Dy(e),n=mt(8,"track-mic-");let i=null;oi.info("start create microphone audio track with config",JSON.stringify(e),"trackId",n);try{i=(await YR({audio:r},n)).getAudioTracks()[0]||null}catch(e){throw t.onError(e),e}if(!i){const e=new Fe(Ue.UNEXPECTED_ERROR,"can not find track in media stream");return t.onError(e),e.throw(oi)}const o=new Oy(i,e,r,n);return t.onSuccess(o.getTrackId()),oi.info("create microphone audio track success, trackId:",n),o},e.createMixingAudioTrack=function(e){const t=new wy;return e.forEach((e=>t.addAudioTrack(e))),t},e.createScreenVideoTrack=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"disable";const n=_i.reportApiInvoke(null,{tag:Qe.TRACER,name:qe.CREATE_SCREEN_VIDEO_TRACK,options:[cA({},t),r]}),i="720p_auto"===t.encoderConfig;t.encoderConfig?"string"==typeof t.encoderConfig||t.encoderConfig.width&&t.encoderConfig.height||(t.encoderConfig.width={max:1920},t.encoderConfig.height={max:1080}):t.encoderConfig="1080p_2";const o=ky(t),a=mt(8,"track-scr-v-");let s=null,c=null;const d=mi();if(!d.supportShareAudio&&"enable"===r){const e=new Fe(Ue.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio");return n.onError(e),e.throw(oi)}oi.info("start create screen video track with config",t,"withAudio",r,"trackId",a);try{const e=await YR({screen:o,screenAudio:"auto"===r?d.supportShareAudio:"enable"===r},a);s=e.getVideoTracks()[0]||null,c=e.getAudioTracks()[0]||null}catch(e){throw n.onError(e),e}if(!s){const e=new Fe(Ue.UNEXPECTED_ERROR,"can not find track in media stream");return n.onError(e),e.throw(oi)}if(!c&&"enable"===r){s&&s.stop();const e=new Fe(Ue.SHARE_AUDIO_NOT_ALLOWED);return n.onError(e),e.throw(oi)}if(t.optimizationMode||(t.optimizationMode="detail"),t.optimizationMode){dA(a,s,t,t.encoderConfig&&$c(t.encoderConfig)||void 0),t.encoderConfig&&"string"!=typeof t.encoderConfig&&(t.encoderConfig.bitrateMin=t.encoderConfig.bitrateMax)}const u=new oA(s,t.encoderConfig?$c(t.encoderConfig):{},t.scalabiltyMode?ed(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,a,[e.TrackHint.SCREEN_TRACK]);if(i&&u.startMonitorStats(),!c)return n.onSuccess(u.getTrackId()),oi.info("create screen video track success","video:",u.getTrackId()),u;const l=new Iy(c,void 0,mt(8,"track-scr-a-"),!1);return n.onSuccess([u.getTrackId(),l.getTrackId()]),oi.info("create screen video track success","video:",u.getTrackId(),"audio:",l.getTrackId()),[u,l]},e.decodeAudioData=SR,e.deviceManager=QR,e.emptyImage2TypedArray=My,e.frameData2CryptoBuffer=async(e,t,r)=>await zy(e.buffer,t,r),e.getAudioContext=mR,e.getAudioEncoderConfiguration=rd,e.getBitrateConstrainRange=Hy,e.getBitrateFromResAndFps=Wy,e.getCompatibility=mi,e.getConstraintsFromCameraConfig=Ny,e.getConstraintsFromMicrophoneConfig=Dy,e.getConstraintsFromScreenConfig=ky,e.getElectronScreenSources=WR,e.getElectronScreenStream=GR,e.getElectronScreenStreamByUserSelect=HR,e.getLocalStream=YR,e.getOriginSenderConfig=Ky,e.getScalabilityConfiguration=ed,e.getScreenEncoderConfiguration=$c,e.getSilenceAudioTrack=function(){if(RR)return RR;const e=mR();if(!e.createMediaStreamDestination)throw new Fe(Ue.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),RR=n.stream.getAudioTracks()[0],RR},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=Yy,e.getVideoEncoderConfiguration=Qc,e.handleGetUserMediaError=JR,e.hasAudioContext=TR,e.interceptLocalAudioFrame=async function(e){if(!mi().supportWebRTCEncodedTransform)return void oi.warning("browser not support audio encoded transform");if(Zk.has(e))return;if(!e.track)return;const t={track:e.track};if(Se()){if(!e.createEncodedStreams)return void oi.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void oi.error("create audio-encoded-streams error",e&&e.message)}const i=new TransformStream({transform(n,i){t.controller||(t.controller=i),e.track&&e.track.id!==t.track.id&&(oi.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r)),i.enqueue(n)}});n.readable.pipeThrough(i).pipeTo(n.writable)}else if(ve()){if("undefined"==typeof RTCRtpScriptTransform)return void oi.warning("browser not support RTCRtpScriptTransform");const n=Jk(),i=new MessageChannel;await new sR((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(n,{name:"tx",port:i.port2},[i.port2]);e.transform=o,await new sR((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),i.port1.onmessage=n=>{var i;n.data.transformed&&e.track&&(null===(i=e.track)||void 0===i?void 0:i.id)!==t.track.id&&(oi.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r))},t.worker=n}function r(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",r)}const t=Zk.get(e);if(t){Zk.delete(e);try{var n,i;null===(n=t.controller)||void 0===n||n.terminate(),null===(i=t.worker)||void 0===i||i.terminate()}catch(e){oi.warning(e&&e.message)}}}Zk.set(e,t),e.track.addEventListener("ended",r)},e.interceptLocalVideoFrame=async function(e,t){if(!mi().supportWebRTCEncodedTransform)return void oi.warning("browser not support video encoded transform");if(eD.has(e))return;if(!e.track)return;const r={track:e.track};if(Se()){if(!e.createEncodedStreams)return void oi.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void oi.error("create video-encoded-streams error",e&&e.message)}let o=[];t.on("sei-to-send",(e=>{o.push(e)}));const a=new TransformStream({transform(t,i){r.controller||(r.controller=i),e.track&&e.track.id!==r.track.id&&(oi.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=o.shift();a&&(t.data=$k(t.data,a)),i.enqueue(t)}});i.readable.pipeThrough(a).pipeTo(i.writable)}else{if(!ve())return;{if("undefined"==typeof RTCRtpScriptTransform)return void oi.warning("browser not support RTCRtpScriptTransform");const i=Jk(),o=new MessageChannel;await new sR((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const a=new RTCRtpScriptTransform(i,{name:"tx",port:o.port2},[o.port2]);e.transform=a,await new sR((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&&(oi.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=eD.get(e);if(t){eD.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){oi.warning(e&&e.message)}}}eD.set(e,r),e.track.addEventListener("ended",n)},e.interceptRemoteAudioFrame=async function(e){if(!mi().supportWebRTCEncodedTransform)return void oi.warning("browser not support audio encoded transform");if(qk.has(e))return;const t={track:e.track};if(Se()){if(!e.createEncodedStreams)return void oi.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void oi.error("create audio-encoded-streams error",e&&e.message)}const i=new TransformStream({transform(n,i){t.controller||(t.controller=i),e.track&&e.track.id!==t.track.id&&(oi.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r)),i.enqueue(n)}});n.readable.pipeThrough(i).pipeTo(n.writable)}else if(ve()){if("undefined"==typeof RTCRtpScriptTransform)return void oi.warning("browser not support RTCRtpScriptTransform");const n=Jk(),i=new MessageChannel;await new sR((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(n,{name:"rx",port:i.port2},[i.port2]);e.transform=o,await new sR((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),i.port1.onmessage=n=>{var i;n.data.transformed&&e.track&&(null===(i=e.track)||void 0===i?void 0:i.id)!==t.track.id&&(oi.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r))},t.worker=n}function r(){e.track.removeEventListener("ended",r),function(e){const t=qk.get(e);if(t){qk.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){oi.warning(e&&e.message)}}}(e)}qk.set(e,t),e.track.addEventListener("ended",r)},e.interceptRemoteVideoFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!mi().supportWebRTCEncodedTransform)return void oi.warning("browser not support video encoded transform");if(!e.track)return;if(tD.has(e)){const r=tD.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(Se()){if(!e.createEncodedStreams)return void oi.warning("browser not support createEncodedStreams() API");let t=null;try{t=e.createEncodedStreams()}catch(e){return void oi.error("create video-encoded-streams error",e&&e.message)}const i=new TransformStream({transform(t,i){r.controller||(r.controller=i),e.track&&e.track.id!==r.track.id&&(oi.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 o=Qk(t);o&&r.onSei&&r.onSei(o),i.enqueue(t)}});t.readable.pipeThrough(i).pipeTo(t.writable)}else if(ve()){if("undefined"==typeof RTCRtpScriptTransform)return void oi.warning("browser not support RTCRtpScriptTransform");const t=Jk(),i=new MessageChannel;await new sR((e=>t.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(t,{name:"rx",port:i.port2},[i.port2]);e.transform=o,await new sR((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?(oi.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)):t.data.sei&&r.onSei&&r.onSei(t.data.sei)},r.worker=t}function n(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",n)}!function(e){const t=tD.get(e);if(t){tD.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){oi.warning(e&&e.message)}}}(e)}tD.set(e,r),e.track.addEventListener("ended",n)},e.isAudioEncoderConfiguration=sd,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?je(e,"profile",Object.keys(td)):sd(e),!0},e.isBeautyEffectOptions=function(e){return void 0!==e.smoothnessLevel&&Ge(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&Ge(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&Ge(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&je(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),!0},e.isElectron=Xe,e.isLowStreamParameter=function(e){if(!e)throw new Fe(Ue.INVALID_PARAMS);return We(e.width)||He(e.width,"streamParameter.width"),We(e.height)||He(e.height,"streamParameter.height"),We(e.framerate)||He(e.framerate,"streamParameter.framerate"),We(e.bitrate)||Ge(e.bitrate,"streamParameter.bitrate"),!0},e.isScreenSourceType=cd,e.isVideoEncoderConfiguration=ad,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?je(e,"profile",Object.keys(Xc)):ad(e),!0},e.polyfillAudioNode=gR,e.removeTrack=od,e.requestAutoplayGesture=ty,e.silenceScriptProcessHandler=yR,e.updateAgoraRTCCompatibility=Ei,e.visibilityWatcher=fA}));
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 d(e,t){n&&console.warn(e+" is deprecated, please use "+t+" instead.")}function u(e){return"[object Object]"===Object.prototype.toString.call(e)}function l(e){return u(e)?Object.keys(e).reduce((function(t,r){const n=u(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,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 E(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function m(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 g(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 T(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 v(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 y(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return v(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 R(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 b(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 A=Object.freeze({__proto__:null,fixNegotiationNeeded:b,shimAddTrackRemoveTrack:y,shimAddTrackRemoveTrackWithNative:v,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:g,shimGetStats:T,shimGetUserMedia:_,shimMediaStream:E,shimOnTrack:m,shimPeerConnection:R,shimSenderReceiverGetStats:S});function I(e,t){const r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){d("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 O(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 k(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){d("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 P(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 L(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:P,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:L,shimGetUserMedia:I,shimOnTrack:O,shimPeerConnection:C,shimRTCDataChannel:D,shimReceiverGetStats:N,shimRemoveStream:k,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")?(d("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 z(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Y=Object.freeze({__proto__:null,shimAudioContext:z,shimCallbacksAPI:B,shimConstraints:G,shimCreateOfferLegacy:K,shimGetUserMedia:j,shimLocalStreamsAPI:V,shimRTCIceServerUrls:W,shimRemoteStreamsAPI:F,shimTrackEventTransceiver:H}),X="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function J(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Z={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&&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 d=t.matchPrefix(e,"a=ssrc-group:FID").map((e=>e.substring(17).split(" ").map((e=>parseInt(e,10)))));d.length>0&&d[0].length>1&&d[0][0]===a&&(c=d[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 u=t.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substring(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substring(5),10)*.95-16e3:void 0,r.forEach((e=>{e.maxBitrate=u}))),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}(Z);var q=Z.exports,$=J(q),Q=t({__proto__:null,default:$},[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=$.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=$.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=$.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=$.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=$.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,de,ue=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:ue,extractVersion:i,disableLog:s,disableWarnings:a,sdp:Q};switch(n.browser){case"chrome":if(!A||!R||!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=A,se(e,n),ae(e),_(e,n),E(e),R(e,n),m(e),y(e,n),g(e),T(e),S(e),b(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),I(e,n),C(e,n),O(e),k(e),w(e),N(e),D(e),P(e),L(e),M(e),U(e),ee(e),ie(e),re(e,n),ne(e);break;case"safari":if(!Y||!t.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=Y,se(e,n),ae(e),W(e),K(e),B(e),V(e),F(e),H(e),j(e),z(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}),function(e){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"}(ce||(ce={})),function(e){e.CHROME="Chrome",e.SAFARI="Safari",e.EDGE="Edge",e.FIREFOX="Firefox",e.OPERA="OPR",e.QQ="QQBrowser",e.WECHAT="MicroMessenger"}(de||(de={}));var le={exports:{}};!function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",c="major",d="model",u="name",l="type",h="vendor",p="version",f="architecture",_="console",E="mobile",m="tablet",g="smarttv",T="wearable",S="embedded",v="Amazon",y="Apple",R="ASUS",b="BlackBerry",A="Browser",I="Chrome",O="Firefox",C="Google",w="Huawei",N="LG",k="Microsoft",D="Motorola",P="Opera",L="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)},z=function(e,t){for(var r,o,a,c,d,u,l=0;l<t.length&&!d;){var h=t[l],p=t[l+1];for(r=o=0;r<h.length&&!d&&h[r];)if(d=h[r++].exec(e))for(a=0;a<p.length;a++)u=d[++o],typeof(c=p[a])===s&&c.length>0?2===c.length?typeof c[1]==i?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3===c.length?typeof c[1]!==i||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):n:this[c[0]]=u?c[1].call(this,u,c[2]):n:4===c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):n):this[c]=u||n;l+=2}},Y=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},X={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"},J={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[p,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[p,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,p],[/opios[\/ ]+([\w\.]+)/i],[p,[u,P+" Mini"]],[/\bopr\/([\w\.]+)/i],[p,[u,P]],[/(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],[u,p],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[p,[u,"UC"+A]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[p,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[p,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[p,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[p,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[p,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+A],p],[/\bfocus\/([\w\.]+)/i],[p,[u,O+" Focus"]],[/\bopt\/([\w\.]+)/i],[p,[u,P+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[p,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[p,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[p,[u,P+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[p,[u,"MIUI "+A]],[/fxios\/([-\w\.]+)/i],[p,[u,O]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+A]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+A],p],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],p],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,p],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,F],p],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,p],[/\bgsa\/([\w\.]+) .*safari\//i],[p,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[p,[u,I+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,I+" WebView"],p],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[p,[u,"Android "+A]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,p],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[p,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[p,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[p,Y,{"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],[u,p],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],p],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[p,[u,O+" 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],[u,p],[/(cobalt)\/([\w\.]+)/i],[u,[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],[d,[h,L],[l,m]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[h,L],[l,E]],[/\((ip(?:hone|od)[\w ]*);/i],[d,[h,y],[l,E]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[h,y],[l,m]],[/(macintosh);/i],[d,[h,y]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[h,M],[l,E]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[h,w],[l,m]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[h,w],[l,E]],[/\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],[[d,/_/g," "],[h,x],[l,E]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[h,x],[l,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[h,"OPPO"],[l,E]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[h,"Vivo"],[l,E]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[d,[h,"Realme"],[l,E]],[/\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],[d,[h,D],[l,E]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[h,D],[l,m]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[h,N],[l,m]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[h,N],[l,E]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[h,"Lenovo"],[l,m]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[h,"Nokia"],[l,E]],[/(pixel c)\b/i],[d,[h,C],[l,m]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[h,C],[l,E]],[/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],[d,[h,U],[l,E]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[h,U],[l,m]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[h,"OnePlus"],[l,E]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[h,v],[l,m]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[h,v],[l,E]],[/(playbook);[-\w\),; ]+(rim)/i],[d,h,[l,m]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[h,b],[l,E]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[h,R],[l,m]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[h,R],[l,E]],[/(nexus 9)/i],[d,[h,"HTC"],[l,m]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[h,[d,/_/g," "],[l,E]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[h,"Acer"],[l,m]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[h,"Meizu"],[l,E]],[/(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,d,[l,E]],[/(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,d,[l,m]],[/(surface duo)/i],[d,[h,k],[l,m]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[h,"Fairphone"],[l,E]],[/(u304aa)/i],[d,[h,"AT&T"],[l,E]],[/\bsie-(\w*)/i],[d,[h,"Siemens"],[l,E]],[/\b(rct\w+) b/i],[d,[h,"RCA"],[l,m]],[/\b(venue[\d ]{2,7}) b/i],[d,[h,"Dell"],[l,m]],[/\b(q(?:mv|ta)\w+) b/i],[d,[h,"Verizon"],[l,m]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[d,[h,"Barnes & Noble"],[l,m]],[/\b(tm\d{3}\w+) b/i],[d,[h,"NuVision"],[l,m]],[/\b(k88) b/i],[d,[h,"ZTE"],[l,m]],[/\b(nx\d{3}j) b/i],[d,[h,"ZTE"],[l,E]],[/\b(gen\d{3}) b.+49h/i],[d,[h,"Swiss"],[l,E]],[/\b(zur\d{3}) b/i],[d,[h,"Swiss"],[l,m]],[/\b((zeki)?tb.*\b) b/i],[d,[h,"Zeki"],[l,m]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[h,"Dragon Touch"],d,[l,m]],[/\b(ns-?\w{0,9}) b/i],[d,[h,"Insignia"],[l,m]],[/\b((nxa|next)-?\w{0,9}) b/i],[d,[h,"NextBook"],[l,m]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[h,"Voice"],d,[l,E]],[/\b(lvtel\-)?(v1[12]) b/i],[[h,"LvTel"],d,[l,E]],[/\b(ph-1) /i],[d,[h,"Essential"],[l,E]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[d,[h,"Envizen"],[l,m]],[/\b(trio[-\w\. ]+) b/i],[d,[h,"MachSpeed"],[l,m]],[/\btu_(1491) b/i],[d,[h,"Rotor"],[l,m]],[/(shield[\w ]+) b/i],[d,[h,"Nvidia"],[l,m]],[/(sprint) (\w+)/i],[h,d,[l,E]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[h,k],[l,E]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[h,V],[l,m]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[h,V],[l,E]],[/smart-tv.+(samsung)/i],[h,[l,g]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[h,L],[l,g]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[h,N],[l,g]],[/(apple) ?tv/i],[h,[d,y+" TV"],[l,g]],[/crkey/i],[[d,I+"cast"],[h,C],[l,g]],[/droid.+aft(\w)( bui|\))/i],[d,[h,v],[l,g]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[h,M],[l,g]],[/(bravia[\w ]+)( bui|\))/i],[d,[h,U],[l,g]],[/(mitv-\w{5}) bui/i],[d,[h,x],[l,g]],[/Hbbtv.*(technisat) (.*);/i],[h,d,[l,g]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[h,K],[d,K],[l,g]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,g]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[h,d,[l,_]],[/droid.+; (shield) bui/i],[d,[h,"Nvidia"],[l,_]],[/(playstation [345portablevi]+)/i],[d,[h,U],[l,_]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[h,k],[l,_]],[/((pebble))app/i],[h,d,[l,T]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[h,y],[l,T]],[/droid.+; (glass) \d/i],[d,[h,C],[l,T]],[/droid.+; (wt63?0{2,3})\)/i],[d,[h,V],[l,T]],[/(quest( 2| pro)?)/i],[d,[h,F],[l,T]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[h,[l,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[d,[l,E]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[l,m]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,m]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,E]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[h,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[p,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[p,[u,"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],[u,p],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[p,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,p],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[p,Y,X]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[p,Y,X]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[p,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,j],[p,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[p,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,p],[/\(bb(10);/i],[p,[u,b]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[p,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[p,[u,O+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[p,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[p,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[p,[u,I+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,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],[u,p],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],p],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,p]]},Z=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof Z))return new Z(e,t).getResult();var _=typeof r!==o&&r.navigator?r.navigator:n,g=e||(_&&_.userAgent?_.userAgent:""),T=_&&_.userAgentData?_.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}(J,t):J;return this.getBrowser=function(){var e={};return e[u]=n,e[p]=n,z.call(e,g,S.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e[p]),_&&_.brave&&typeof _.brave.isBrave==i&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[f]=n,z.call(e,g,S.cpu),e},this.getDevice=function(){var e={};return e[h]=n,e[d]=n,e[l]=n,z.call(e,g,S.device),!e[l]&&T&&T.mobile&&(e[l]=E),"Macintosh"==e[d]&&_&&typeof _.standalone!==o&&_.maxTouchPoints&&_.maxTouchPoints>2&&(e[d]="iPad",e[l]=m),e},this.getEngine=function(){var e={};return e[u]=n,e[p]=n,z.call(e,g,S.engine),e},this.getOS=function(){var e={};return e[u]=n,e[p]=n,z.call(e,g,S.os),!e[u]&&T&&"Unknown"!=T.platform&&(e[u]=T.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 g},this.setUA=function(e){return g=typeof e===a&&e.length>350?K(e,350):e,this},this.setUA(g),this};Z.VERSION="0.7.34",Z.BROWSER=G([u,p,c]),Z.CPU=G([f]),Z.DEVICE=G([d,h,l,_,E,g,m,T,S]),Z.ENGINE=Z.OS=G([u,p]),e.exports&&(t=e.exports=Z),t.UAParser=Z;var q=typeof r!==o&&(r.jQuery||r.Zepto);if(q&&!q.ua){var $=new Z;q.ua=$.getResult(),q.ua.get=function(){return $.getUA()},q.ua.set=function(e){$.setUA(e);var t=$.getResult();for(var r in t)q.ua[r]=t[r]}}}("object"==typeof window?window:X)}(le,le.exports);const he=new(J(le.exports));let pe=he.getResult(),fe=null;function _e(e){if(!fe){e&&he.setUA(e),pe=he.getResult();const t=function(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return de.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return de.CHROME;case"Safari":case"Mobile Safari":return de.SAFARI;case"Edge":return de.EDGE;case"Firefox":return de.FIREFOX;case"QQBrowser":return de.QQ;case"Opera":return de.OPERA;case"WeChat":return de.WECHAT;default:return e.browser.name||""}}(pe),r=function(e){let t;t="Blink"===e.engine.name?e.engine.version||"":e.browser.version||"";return t.split(".")[0]}(pe),n=function(e){if("Windows"===e.os.name)return e.os.version?e.os.name+" "+e.os.version:e.os.name;return e.os.name||""}(pe),i=pe.os.version;if(!(t&&r&&n&&i))return{name:t,version:r,os:n,osVersion:i};fe={name:t,version:r,os:n,osVersion:i}}return fe}function Ee(){return _e().os}function me(){const e=_e();return`${e.os} ${e.osVersion}`}function ge(){const e=_e();return!!("WebKit"===pe.engine.name&&e.os===ce.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==de.SAFARI||ye()&&e.name!==de.SAFARI)}function Te(){return _e().name===de.CHROME}function Se(){return _e().name===de.SAFARI}function ve(){return _e().name===de.FIREFOX}function ye(){return _e().os===ce.IOS}function Re(e){const t=_e();return!(t.name!==de.CHROME||!t.osVersion)&&Number(t.version)>=e}function be(e){const t=_e();return!(t.name!==de.EDGE||!t.osVersion)&&Number(t.version)>=e}function Ae(e){const t=_e();return!(t.name!==de.OPERA||!t.osVersion)&&Number(t.version)>=e}function Ie(){const e=_e();if(e.os!==ce.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function Oe(){const e=_e();if(e.os!==ce.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function Ce(){const e=_e();if(e.os!==ce.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function we(){return Se()&&navigator.maxTouchPoints>0}function Ne(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function ke(){const e=_e();if(e.name===de.EDGE||e.name===de.SAFARI)return!1;return!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function De(){return Ee()===ce.ANDROID}function Pe(){const e=_e();return De()&&(e.name===de.CHROME||e.name===de.WECHAT||/chrome|chromium/i.test(navigator.userAgent))}var Le,Me,Ue;!function(e){e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",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.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.INIT_WEBSOCKET_TIMEOUT="INIT_WEBSOCKET_TIMEOUT",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"}(Le||(Le={}));class xe extends Error{code;message;data;name="AgoraRTCException";constructor(e,t="",r){super(t),this.code=e,this.message=`AgoraRTCError ${this.code}: ${t}`,this.data=r}toString(){return this.data?`data: ${JSON.stringify(this.data)}\n${this.stack}`:`${this.stack}`}print(e="error",t){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 Ve(e,t){if("boolean"!=typeof e)throw new xe(Le.INVALID_PARAMS,`Invalid ${t}: The value is of the boolean type.`)}function Fe(e,t,r){if(r.includes(e))return;throw new xe(Le.INVALID_PARAMS,`${t} can only be set as ${JSON.stringify(r)}`)}function Be(e,t,r=1,n=1e4,i=!0){if(e<r||e>n||i&&!function(e){return"number"==typeof e&&e%1==0}(e)){throw new xe(Le.INVALID_PARAMS,`invalid ${t}: the value range is [${r}, ${n}]. integer only`)}}function je(e,t){if("number"!=typeof e){if(!(e.min||e.max||e.ideal||e.exact)){throw new xe(Le.INVALID_PARAMS,`${t} is not a valid ConstrainLong`)}void 0!==e.min&&Be(e.min,`${t}.min`,0,1/0),void 0!==e.max&&Be(e.max,`${t}.max`,1,1/0),void 0!==e.exact&&Be(e.exact,`${t}.exact`,1,1/0),void 0!==e.ideal&&Be(e.ideal,`${t}.ideal`,1,1/0)}else Be(e,t,1,1/0)}function Ge(e){return null==e}!function(e){e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE"}(Me||(Me={})),function(e){e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT"}(Ue||(Ue={}));const We=new class{_clientSize=null;getClientWidth=()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth;getClientHeight=()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight;getStyle=e=>window.getComputedStyle(e,null);checkCssVisibleProperty=e=>{let t=!0;const r=this.getStyle(e),{display:n,visibility:i,opacity:o,filter:s}=r;if(("none"===n||["hidden","collapse"].includes(i)||Number(o)<.1)&&(t=!1),!t)return!1;if(s){s.split(" ").filter((e=>{const t=e.split("(")[0];return["brightness","blur","opacity"].includes(t)})).map((e=>{const[t,r]=e.split(/\(|\)/);return[t,Number(r.match(/^[0-9\.]+/))]})).forEach((e=>{const[r,n]=e;switch(r){case"brightness":(n<.1||n>3)&&(t=!1);break;case"blur":n>3&&(t=!1);break;case"opacity":n<.1&&(t=!1)}}))}return t};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};checkActualCssVisibleIncludeInherit=e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty);getSizeAboutClient=e=>{const{width:t,height:r,left:n,right:i,top:o,bottom:s}=e.getBoundingClientRect(),a=this.getClientWidth(),c=this.getClientHeight();return{width:t,height:r,left:n,right:i,top:o,bottom:s,clientWidth:a,clientHeight:c,clientMin:Math.min(a,c)}};checkActualSize=()=>{const{width:e,height:t,clientMin:r}=this._clientSize;return this.checkSizeIsVisible(e,t,r)};elementFromPoint=(e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null;checkCoverForAPoint=(e,t,r)=>{const n=this.elementFromPoint(e,t);return null!==n&&n!==r};getPointPositionList=()=>{const{width:e,height:t,left:r,top:n}=this._clientSize,i=e/6,o=t/6,s=[],a=10**6;for(let e=0;e<5;e++)for(let t=0;t<5;t++){const c=(r*a+(0===e?.1:4===e?(i*e*a-1e5)/a:i*e)*a)/a,d=(n*a+(0===t?.1:4===t?(o*t*a-1e5)/a:o*t)*a)/a;s.push({x:c,y:d})}return[...s]};checkElementCover=e=>this.getPointPositionList().map((t=>this.checkCoverForAPoint(t.x,t.y,e))).filter((e=>!!e)).length>6;checkSizeIsVisible=(e,t,r)=>(e>50||r/e<=10)&&(t>50||r/t<=10);checkSizeOfPartInClient=()=>{const{left:e,right:t,top:r,bottom:n,clientHeight:i,clientWidth:o,clientMin:s}=this._clientSize;let a,c,d,u;if(e<0)a=0;else{if(!(e<o))return!1;a=e}if(t<0)return!1;if(c=t<o?t:o,r<0)d=0;else{if(!(r<i))return!1;d=r}if(n<0)return!1;u=n<i?n:i;const l=c-a,h=u-d;return this.checkSizeIsVisible(l,h,s)};returnHiddenResult=e=>(this._clientSize=null,{visible:!1,reason:e});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(Me.COVERED);{const e=this.checkActualSize(),t=this.checkSizeOfPartInClient();return e&&!t?this.returnHiddenResult(Me.POSITION):e?(this._clientSize=null,{visible:!0}):this.returnHiddenResult(Me.SIZE)}}return this.returnHiddenResult(Me.STYLE)}return this.returnHiddenResult(Ue.UNMOUNTED)}return this.returnHiddenResult(Ue.INVALID_HTML_ELEMENT)};checkElementIsMountedOnDom=e=>this.checkPropertyUpToAllParentNodes(e,(e=>"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement))};const He=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 Ke{_events={};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})}addListener=this.on;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,...t){this._events[e]||(this._events[e]=[]);const r=this._events[e].map((e=>e));for(let n=0;n<r.length;n+=1){const i=r[n];i.once&&this.off(e,i.listener),i.listener.apply(this,t||[])}}safeEmit(e,...t){[...this._events[e]||[]].forEach((r=>{r.once&&this.off(e,r.listener);try{r.listener.apply(this,t)}catch(t){console.error(`safeEmit event:${e} error ${t?.toString()}`)}}))}_indexOfListener(e,t){let r=e.length;for(;r--;)if(e[r].listener===t)return r;return-1}}function ze(){return!!Xe()}let Ye=null;function Xe(){if(Ye)return Ye;if(window.electron)return Ye=window.electron;if(!window.require)return null;try{return Ye=window.require("electron"),Ye}catch(e){return null}}var Je,Ze,qe,$e,Qe,et,tt,rt;function nt(e,t,...r){return 0===e.getListeners(t).length?Promise.reject(new xe(Le.UNEXPECTED_ERROR,"can not emit promise")):new Promise(((n,i)=>{e.emit(t,...r,n,i)}))}function it(e,t,...r){return 0===e.getListeners(t).length?Promise.resolve():nt(e,t,...r)}function ot(e,t,...r){return 0===e.getListeners(t).length?null:function(e,t,...r){let n=null,i=null;if(e.emit(t,...r,(e=>{n=e}),(e=>{i=e})),null!==i)throw i;if(null===n)throw new xe(Le.UNEXPECTED_ERROR,"handler is not sync");return n}(e,t,...r)}!function(e){e.CREATE_CLIENT="createClient",e.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",e.SET_AREA="setArea",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.DATACHANNEL_FAILBACK="Client._datachannelFailback",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"}(Je||(Je={})),function(e){e.TRACER="tracer"}(Ze||(Ze={})),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"}(qe||(qe={})),function(e){e.LEAVE="LEAVE",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.UID_BANNED="UID_BANNED",e.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.FALLBACK="FALLBACK",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||($e={})),function(e){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.INJECT_STREAM_STATUS="stream-inject-status",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.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"}(Qe||(Qe={})),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"}(et||(et={})),function(e){e.ONLINE="ONLINE",e.OFFLINE="OFFLINE"}(tt||(tt={})),function(e){e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE"}(rt||(rt={}));const st=new class extends Ke{_moduleName="network-indicator";_networkState=tt.ONLINE;onlineWaiter;set networkState(e){this.emit(rt.NETWORK_STATE_CHANGE,e,this._networkState),e===tt.ONLINE?this.emit(rt.ONLINE):e===tt.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(rt.ONLINE,(()=>{this.onlineWaiter=void 0,e(tt.ONLINE)}))})),this.emit(rt.OFFLINE)),this._networkState=e}get networkState(){return this._networkState}get isOnline(){return this._networkState===tt.ONLINE}constructor(){super(),window.addEventListener("online",(()=>{this.networkState=tt.ONLINE})),window.addEventListener("offline",(()=>{this.networkState=tt.OFFLINE}))}};function at(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function ct(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function dt(e){return JSON.parse(JSON.stringify(e))}function ut(e){try{return dt(e)}catch(t){return e}}const lt={};function ht(e,t){lt[t]||(lt[t]=!0,e())}function pt(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function ft(e){return new Promise((t=>{window.setTimeout(t,e)}))}function _t(e=7,t){const r=Math.random().toString(16).substr(2,e).toLowerCase();return r.length===e?`${t}${r}`:`${t}${r}`+_t(e-r.length,"")}const Et=()=>{};const mt=new class{fnMap=new Map;throttleByKey(e,t,r,n,...i){if(this.fnMap.has(t)){const o=this.fnMap.get(t);if(o.threshold!==r){o.fn(...o.args),clearTimeout(o.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:i,skipFn:n})}else o.skipFn&&o.skipFn(...o.args),this.fnMap.set(t,{...o,fn:e,args:i,skipFn:n})}else{const o=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:o,args:i,skipFn:n})}}},gt=mt.throttleByKey.bind(mt);function Tt(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function St(e,t){if(!Tt(e)||!Tt(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]=St(e[n],t[n]);return r}{const r={...e};for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?r[n]=St(e[n],t[n]):r[n]=t[n]);return r}}let vt=1,yt=console;class Rt{static setLogger(e){yt=e}lockingPromise=Promise.resolve();locks=0;name="";lockId;constructor(e){this.lockId=vt++,e&&(this.name=e),yt.debug(`[lock-${this.name}-${this.lockId}] is created.`)}get isLocked(){return this.locks>0}lock(e){let t;this.locks+=1,yt.debug(`[lock-${this.name}-${this.lockId}] is locked, current queue ${this.locks}. ${"string"==typeof e?e:""}`);const r=new Promise((r=>{t=()=>{this.locks-=1,yt.debug(`[lock-${this.name}-${this.lockId}] is not locked, current queue ${this.locks}. ${"string"==typeof e?e:""}`),r()}})),n=this.lockingPromise.then((()=>t));return this.lockingPromise=this.lockingPromise.then((()=>r)),n}}function bt(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(...r){const i=this[t];if(!i)throw new Error(`mutex property key ${t} doesn't exist on ${e}`);const s=await i.lock(`From ${e}.${n}`);try{return await o.apply(this,r)}finally{s()}},i}}const At={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function It(e,t,r,n){const i=Object.assign({},At,n);let o=i.timeout;const s=async()=>{var e;await(e=o,new Promise((t=>{window.setTimeout(t,e)}))),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 xe(Le.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}function Ot(e,t){return function(){return e.apply(t,arguments)}}const{toString:Ct}=Object.prototype,{getPrototypeOf:wt}=Object,Nt=(kt=Object.create(null),e=>{const t=Ct.call(e);return kt[t]||(kt[t]=t.slice(8,-1).toLowerCase())});var kt;const Dt=e=>(e=e.toLowerCase(),t=>Nt(t)===e),Pt=e=>t=>typeof t===e,{isArray:Lt}=Array,Mt=Pt("undefined");const Ut=Dt("ArrayBuffer");const xt=Pt("string"),Vt=Pt("function"),Ft=Pt("number"),Bt=e=>null!==e&&"object"==typeof e,jt=e=>{if("object"!==Nt(e))return!1;const t=wt(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Gt=Dt("Date"),Wt=Dt("File"),Ht=Dt("Blob"),Kt=Dt("FileList"),zt=Dt("URLSearchParams");function Yt(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),Lt(e))for(n=0,i=e.length;n<i;n++)t.call(null,e[n],n,e);else{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 Xt(e,t){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 Jt="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Zt=e=>!Mt(e)&&e!==Jt;const qt=($t="undefined"!=typeof Uint8Array&&wt(Uint8Array),e=>$t&&e instanceof $t);var $t;const Qt=Dt("HTMLFormElement"),er=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),tr=Dt("RegExp"),rr=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Yt(r,((r,i)=>{let o;!1!==(o=t(r,i,e))&&(n[i]=o||r)})),Object.defineProperties(e,n)},nr="abcdefghijklmnopqrstuvwxyz",ir="0123456789",or={DIGIT:ir,ALPHA:nr,ALPHA_DIGIT:nr+nr.toUpperCase()+ir};const sr=Dt("AsyncFunction");var ar={isArray:Lt,isArrayBuffer:Ut,isBuffer:function(e){return null!==e&&!Mt(e)&&null!==e.constructor&&!Mt(e.constructor)&&Vt(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Vt(e.append)&&("formdata"===(t=Nt(e))||"object"===t&&Vt(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Ut(e.buffer),t},isString:xt,isNumber:Ft,isBoolean:e=>!0===e||!1===e,isObject:Bt,isPlainObject:jt,isUndefined:Mt,isDate:Gt,isFile:Wt,isBlob:Ht,isRegExp:tr,isFunction:Vt,isStream:e=>Bt(e)&&Vt(e.pipe),isURLSearchParams:zt,isTypedArray:qt,isFileList:Kt,forEach:Yt,merge:function e(){const{caseless:t}=Zt(this)&&this||{},r={},n=(n,i)=>{const o=t&&Xt(r,i)||i;jt(r[o])&&jt(n)?r[o]=e(r[o],n):jt(n)?r[o]=e({},n):Lt(n)?r[o]=n.slice():r[o]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Yt(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(Yt(t,((t,n)=>{r&&Vt(t)?e[n]=Ot(t,r):e[n]=t}),{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),e.prototype.constructor=e,Object.defineProperty(e,"super",{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&&wt(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:Nt,kindOfTest:Dt,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(Lt(e))return e;let t=e.length;if(!Ft(t))return null;const r=new Array(t);for(;t-- >0;)r[t]=e[t];return r},forEachEntry:(e,t)=>{const r=(e&&e[Symbol.iterator]).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:Qt,hasOwnProperty:er,hasOwnProp:er,reduceDescriptors:rr,freezeMethods:e=>{rr(e,((t,r)=>{if(Vt(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Vt(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 Lt(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)=>(e=+e,Number.isFinite(e)?e:t),findKey:Xt,global:Jt,isContextDefined:Zt,ALPHABET:or,generateString:(e=16,t=or.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&Vt(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Bt(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=Lt(e)?[]:{};return Yt(e,((e,t)=>{const o=r(e,n+1);!Mt(o)&&(i[t]=o)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:sr,isThenable:e=>e&&(Bt(e)||Vt(e))&&Vt(e.then)&&Vt(e.catch)};function cr(e,t,r,n,i){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=e,this.name="AxiosError",t&&(this.code=t),r&&(this.config=r),n&&(this.request=n),i&&(this.response=i)}ar.inherits(cr,Error,{toJSON:function(){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:ar.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const dr=cr.prototype,ur={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((e=>{ur[e]={value:e}})),Object.defineProperties(cr,ur),Object.defineProperty(dr,"isAxiosError",{value:!0}),cr.from=(e,t,r,n,i,o)=>{const s=Object.create(dr);return ar.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),cr.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};function lr(e){return ar.isPlainObject(e)||ar.isArray(e)}function hr(e){return ar.endsWith(e,"[]")?e.slice(0,-2):e}function pr(e,t,r){return e?e.concat(t).map((function(e,t){return e=hr(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const fr=ar.toFlatObject(ar,{},null,(function(e){return/^is[A-Z]/.test(e)}));function _r(e,t,r){if(!ar.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=ar.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!ar.isUndefined(t[e])}))).metaTokens,i=r.visitor||d,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&ar.isSpecCompliantForm(t);if(!ar.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(ar.isDate(e))return e.toISOString();if(!a&&ar.isBlob(e))throw new cr("Blob is not supported. Use a Buffer instead.");return ar.isArrayBuffer(e)||ar.isTypedArray(e)?a&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,r,i){let a=e;if(e&&!i&&"object"==typeof e)if(ar.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(ar.isArray(e)&&function(e){return ar.isArray(e)&&!e.some(lr)}(e)||(ar.isFileList(e)||ar.endsWith(r,"[]"))&&(a=ar.toArray(e)))return r=hr(r),a.forEach((function(e,n){!ar.isUndefined(e)&&null!==e&&t.append(!0===s?pr([r],n,o):null===s?r:r+"[]",c(e))})),!1;return!!lr(e)||(t.append(pr(i,r,o),c(e)),!1)}const u=[],l=Object.assign(fr,{defaultVisitor:d,convertValue:c,isVisitable:lr});if(!ar.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!ar.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),ar.forEach(r,(function(r,o){!0===(!(ar.isUndefined(r)||null===r)&&i.call(t,r,ar.isString(o)?o.trim():o,n,l))&&e(r,n?n.concat(o):[o])})),u.pop()}}(e),t}function Er(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function mr(e,t){this._pairs=[],e&&_r(e,this,t)}const gr=mr.prototype;function Tr(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Sr(e,t,r){if(!t)return e;const n=r&&r.encode||Tr,i=r&&r.serialize;let o;if(o=i?i(t,r):ar.isURLSearchParams(t)?t.toString():new mr(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}gr.append=function(e,t){this._pairs.push([e,t])},gr.toString=function(e){const t=e?function(t){return e.call(this,t,Er)}:Er;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var vr=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){ar.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},yr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Rr={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:mr,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const br="undefined"!=typeof window&&"undefined"!=typeof document,Ar=(Ir="undefined"!=typeof navigator&&navigator.product,br&&["ReactNative","NativeScript","NS"].indexOf(Ir)<0);var Ir;const Or="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var Cr={...Object.freeze({__proto__:null,hasBrowserEnv:br,hasStandardBrowserEnv:Ar,hasStandardBrowserWebWorkerEnv:Or}),...Rr};function wr(e){function t(e,r,n,i){let o=e[i++];if("__proto__"===o)return!0;const s=Number.isFinite(+o),a=i>=e.length;if(o=!o&&ar.isArray(n)?n.length:o,a)return ar.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!s;n[o]&&ar.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],i)&&ar.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(ar.isFormData(e)&&ar.isFunction(e.entries)){const r={};return ar.forEachEntry(e,((e,n)=>{t(function(e){return ar.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const Nr={transitional:yr,adapter:["xhr","http"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=ar.isObject(e);i&&ar.isHTMLForm(e)&&(e=new FormData(e));if(ar.isFormData(e))return n?JSON.stringify(wr(e)):e;if(ar.isArrayBuffer(e)||ar.isBuffer(e)||ar.isStream(e)||ar.isFile(e)||ar.isBlob(e))return e;if(ar.isArrayBufferView(e))return e.buffer;if(ar.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let o;if(i){if(r.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return _r(e,new Cr.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return Cr.isNode&&ar.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=ar.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return _r(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(ar.isString(e))try{return(t||JSON.parse)(e),ar.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Nr.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&ar.isString(e)&&(r&&!this.responseType||n)){const r=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(r){if("SyntaxError"===e.name)throw cr.from(e,cr.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Cr.classes.FormData,Blob:Cr.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};ar.forEach(["delete","get","head","post","put","patch"],(e=>{Nr.headers[e]={}}));var kr=Nr;const Dr=ar.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 Pr=Symbol("internals");function Lr(e){return e&&String(e).trim().toLowerCase()}function Mr(e){return!1===e||null==e?e:ar.isArray(e)?e.map(Mr):String(e)}function Ur(e,t,r,n,i){return ar.isFunction(n)?n.call(this,t,r):(i&&(t=r),ar.isString(t)?ar.isString(n)?-1!==t.indexOf(n):ar.isRegExp(n)?n.test(t):void 0:void 0)}class xr{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=Lr(t);if(!i)throw new Error("header name must be a non-empty string");const o=ar.findKey(n,i);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=Mr(e))}const o=(e,t)=>ar.forEach(e,((e,r)=>i(e,r,t)));return ar.isPlainObject(e)||e instanceof this.constructor?o(e,t):ar.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(),!r||t[r]&&Dr[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t):null!=e&&i(t,e,r),this}get(e,t){if(e=Lr(e)){const r=ar.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(ar.isFunction(t))return t.call(this,e,r);if(ar.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Lr(e)){const r=ar.findKey(this,e);return!(!r||void 0===this[r]||t&&!Ur(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=Lr(e)){const i=ar.findKey(r,e);!i||t&&!Ur(0,r[i],i,t)||(delete r[i],n=!0)}}return ar.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&&!Ur(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return ar.forEach(this,((n,i)=>{const o=ar.findKey(r,i);if(o)return t[o]=Mr(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]=Mr(n),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return ar.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&ar.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")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const r=new this(e);return t.forEach((e=>r.set(e))),r}static accessor(e){const t=(this[Pr]=this[Pr]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Lr(e);t[n]||(!function(e,t){const r=ar.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+r,{value:function(e,r,i){return this[n].call(this,t,e,r,i)},configurable:!0})}))}(r,e),t[n]=!0)}return ar.isArray(e)?e.forEach(n):n(e),this}}xr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),ar.reduceDescriptors(xr.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),ar.freezeMethods(xr);var Vr=xr;function Fr(e,t){const r=this||kr,n=t||r,i=Vr.from(n.headers);let o=n.data;return ar.forEach(e,(function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function Br(e){return!(!e||!e.__CANCEL__)}function jr(e,t,r){cr.call(this,null==e?"canceled":e,cr.ERR_CANCELED,t,r),this.name="CanceledError"}ar.inherits(jr,cr,{__CANCEL__:!0});var Gr=Cr.hasStandardBrowserEnv?{write(e,t,r,n,i,o){const s=[e+"="+encodeURIComponent(t)];ar.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),ar.isString(n)&&s.push("path="+n),ar.isString(i)&&s.push("domain="+i),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove(e){this.write(e,"",Date.now()-864e5)}}:{write(){},read:()=>null,remove(){}};function Wr(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/?\/$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}var Hr=Cr.hasStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let r;function n(r){let n=r;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return r=n(window.location.href),function(e){const t=ar.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0};function Kr(e,t){let r=0;const n=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(),d=n[s];i||(i=c),r[o]=a,n[o]=c;let u=s,l=0;for(;u!==o;)l+=r[u++],u%=e;if(o=(o+1)%e,o===s&&(s=(s+1)%e),c-i<t)return;const h=d&&c-d;return h?Math.round(1e3*l/h):void 0}}(50,250);return i=>{const o=i.loaded,s=i.lengthComputable?i.total:void 0,a=o-r,c=n(a);r=o;const d={loaded:o,total:s,progress:s?o/s:void 0,bytes:a,rate:c||void 0,estimated:c&&s&&o<=s?(s-o)/c:void 0,event:i};d[t?"download":"upload"]=!0,e(d)}}var zr="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){let n=e.data;const i=Vr.from(e.headers).normalize();let o,s,{responseType:a,withXSRFToken:c}=e;function d(){e.cancelToken&&e.cancelToken.unsubscribe(o),e.signal&&e.signal.removeEventListener("abort",o)}if(ar.isFormData(n))if(Cr.hasStandardBrowserEnv||Cr.hasStandardBrowserWebWorkerEnv)i.setContentType(!1);else if(!1!==(s=i.getContentType())){const[e,...t]=s?s.split(";").map((e=>e.trim())).filter(Boolean):[];i.setContentType([e||"multipart/form-data",...t].join("; "))}let u=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",r=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";i.set("Authorization","Basic "+btoa(t+":"+r))}const l=Wr(e.baseURL,e.url);function h(){if(!u)return;const n=Vr.from("getAllResponseHeaders"in u&&u.getAllResponseHeaders());!function(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new cr("Request failed with status code "+r.status,[cr.ERR_BAD_REQUEST,cr.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}((function(e){t(e),d()}),(function(e){r(e),d()}),{data:a&&"text"!==a&&"json"!==a?u.response:u.responseText,status:u.status,statusText:u.statusText,headers:n,config:e,request:u}),u=null}if(u.open(e.method.toUpperCase(),Sr(l,e.params,e.paramsSerializer),!0),u.timeout=e.timeout,"onloadend"in u?u.onloadend=h:u.onreadystatechange=function(){u&&4===u.readyState&&(0!==u.status||u.responseURL&&0===u.responseURL.indexOf("file:"))&&setTimeout(h)},u.onabort=function(){u&&(r(new cr("Request aborted",cr.ECONNABORTED,e,u)),u=null)},u.onerror=function(){r(new cr("Network Error",cr.ERR_NETWORK,e,u)),u=null},u.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||yr;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),r(new cr(t,n.clarifyTimeoutError?cr.ETIMEDOUT:cr.ECONNABORTED,e,u)),u=null},Cr.hasStandardBrowserEnv&&(c&&ar.isFunction(c)&&(c=c(e)),c||!1!==c&&Hr(l))){const t=e.xsrfHeaderName&&e.xsrfCookieName&&Gr.read(e.xsrfCookieName);t&&i.set(e.xsrfHeaderName,t)}void 0===n&&i.setContentType(null),"setRequestHeader"in u&&ar.forEach(i.toJSON(),(function(e,t){u.setRequestHeader(t,e)})),ar.isUndefined(e.withCredentials)||(u.withCredentials=!!e.withCredentials),a&&"json"!==a&&(u.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&u.addEventListener("progress",Kr(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&u.upload&&u.upload.addEventListener("progress",Kr(e.onUploadProgress)),(e.cancelToken||e.signal)&&(o=t=>{u&&(r(!t||t.type?new jr(null,e,u):t),u.abort(),u=null)},e.cancelToken&&e.cancelToken.subscribe(o),e.signal&&(e.signal.aborted?o():e.signal.addEventListener("abort",o)));const p=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(l);p&&-1===Cr.protocols.indexOf(p)?r(new cr("Unsupported protocol "+p+":",cr.ERR_BAD_REQUEST,e)):u.send(n||null)}))};const Yr={http:null,xhr:zr};ar.forEach(Yr,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const Xr=e=>`- ${e}`,Jr=e=>ar.isFunction(e)||null===e||!1===e;var Zr={getAdapter:e=>{e=ar.isArray(e)?e:[e];const{length:t}=e;let r,n;const i={};for(let o=0;o<t;o++){let t;if(r=e[o],n=r,!Jr(r)&&(n=Yr[(t=String(r)).toLowerCase()],void 0===n))throw new cr(`Unknown adapter '${t}'`);if(n)break;i[t||"#"+o]=n}if(!n){const e=Object.entries(i).map((([e,t])=>`adapter ${e} `+(!1===t?"is not supported by the environment":"is not available in the build")));throw new cr("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(Xr).join("\n"):" "+Xr(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n},adapters:Yr};function qr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new jr(null,e)}function $r(e){qr(e),e.headers=Vr.from(e.headers),e.data=Fr.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Zr.getAdapter(e.adapter||kr.adapter)(e).then((function(t){return qr(e),t.data=Fr.call(e,e.transformResponse,t),t.headers=Vr.from(t.headers),t}),(function(t){return Br(t)||(qr(e),t&&t.response&&(t.response.data=Fr.call(e,e.transformResponse,t.response),t.response.headers=Vr.from(t.response.headers))),Promise.reject(t)}))}const Qr=e=>e instanceof Vr?e.toJSON():e;function en(e,t){t=t||{};const r={};function n(e,t,r){return ar.isPlainObject(e)&&ar.isPlainObject(t)?ar.merge.call({caseless:r},e,t):ar.isPlainObject(t)?ar.merge({},t):ar.isArray(t)?t.slice():t}function i(e,t,r){return ar.isUndefined(t)?ar.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function o(e,t){if(!ar.isUndefined(t))return n(void 0,t)}function s(e,t){return ar.isUndefined(t)?ar.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function a(r,i,o){return o in t?n(r,i):o in e?n(void 0,r):void 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,responseEncoding:s,validateStatus:a,headers:(e,t)=>i(Qr(e),Qr(t),!0)};return ar.forEach(Object.keys(Object.assign({},e,t)),(function(n){const o=c[n]||i,s=o(e[n],t[n],n);ar.isUndefined(s)&&o!==a||(r[n]=s)})),r}const tn="1.6.7",rn={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{rn[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const nn={};rn.transitional=function(e,t,r){function n(e,t){return"[Axios v"+tn+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new cr(n(i," has been removed"+(t?" in "+t:"")),cr.ERR_DEPRECATED);return t&&!nn[i]&&(nn[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)}};var on={assertOptions:function(e,t,r){if("object"!=typeof e)throw new cr("options must be an object",cr.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let i=n.length;for(;i-- >0;){const o=n[i],s=t[o];if(s){const t=e[o],r=void 0===t||s(t,o,e);if(!0!==r)throw new cr("option "+o+" must be "+r,cr.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new cr("Unknown option "+o,cr.ERR_BAD_OPTION)}},validators:rn};const sn=on.validators;let an=class{constructor(e){this.defaults=e,this.interceptors={request:new vr,response:new vr}}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=t.stack?t.stack.replace(/^.+\n/,""):"";e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=en(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&on.assertOptions(r,{silentJSONParsing:sn.transitional(sn.boolean),forcedJSONParsing:sn.transitional(sn.boolean),clarifyTimeoutError:sn.transitional(sn.boolean)},!1),null!=n&&(ar.isFunction(n)?t.paramsSerializer={serialize:n}:on.assertOptions(n,{encode:sn.function,serialize:sn.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&ar.merge(i.common,i[t.method]);i&&ar.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=Vr.concat(o,i);const s=[];let a=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(a=a&&e.synchronous,s.unshift(e.fulfilled,e.rejected))}));const c=[];let d;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let u,l=0;if(!a){const e=[$r.bind(this),void 0];for(e.unshift.apply(e,s),e.push.apply(e,c),u=e.length,d=Promise.resolve(t);l<u;)d=d.then(e[l++],e[l++]);return d}u=s.length;let h=t;for(l=0;l<u;){const e=s[l++],t=s[l++];try{h=e(h)}catch(e){t.call(this,e);break}}try{d=$r.call(this,h)}catch(e){return Promise.reject(e)}for(l=0,u=c.length;l<u;)d=d.then(c[l++],c[l++]);return d}getUri(e){return Sr(Wr((e=en(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};ar.forEach(["delete","get","head","options"],(function(e){an.prototype[e]=function(t,r){return this.request(en(r||{},{method:e,url:t,data:(r||{}).data}))}})),ar.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(en(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}an.prototype[e]=t(),an.prototype[e+"Form"]=t(!0)}));var cn=an;class dn{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 jr(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)}static source(){let e;return{token:new dn((function(t){e=t})),cancel:e}}}var un=dn;const ln={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};Object.entries(ln).forEach((([e,t])=>{ln[t]=e}));var hn=ln;const pn=function e(t){const r=new cn(t),n=Ot(cn.prototype.request,r);return ar.extend(n,cn.prototype,r,{allOwnKeys:!0}),ar.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(en(t,r))},n}(kr);pn.Axios=cn,pn.CanceledError=jr,pn.CancelToken=un,pn.isCancel=Br,pn.VERSION=tn,pn.toFormData=_r,pn.AxiosError=cr,pn.Cancel=pn.CanceledError,pn.all=function(e){return Promise.all(e)},pn.spread=function(e){return function(t){return e.apply(null,t)}},pn.isAxiosError=function(e){return ar.isObject(e)&&!0===e.isAxiosError},pn.mergeConfig=en,pn.AxiosHeaders=Vr,pn.formToJSON=e=>wr(ar.isHTMLForm(e)?new FormData(e):e),pn.getAdapter=Zr.getAdapter,pn.HttpStatusCode=hn,pn.default=pn;var fn=pn;let _n=0,En=0;function mn(e,t,r,n){return new Promise(((i,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),_n+=pt(t.data)):r&&(t.data.size?_n+=t.data.size:t.data instanceof FormData?_n+=function(e){let t=0;return/DingTalk/i.test(navigator.userAgent)&&e.realFormData&&(e=e.realFormData),e.forEach((e=>{t+="string"==typeof e?pt(e):e.size})),t+138}(t.data):_n+=pt(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,fn.request(t).then((e=>{"string"==typeof e.data?En+=pt(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?En+=e.data.byteLength:En+=pt(JSON.stringify(e.data)),n&&i({data:e.data,headers:e.headers}),i(e.data)})).catch((e=>{fn.isCancel(e)?o(new xe(Le.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?o(new xe(Le.NETWORK_TIMEOUT,e.message)):e.response?o(new xe(Le.NETWORK_RESPONSE_ERROR,e.response.status)):o(new xe(Le.NETWORK_ERROR,e.message))}))}))}async function gn(e,t){const r=new Blob([t.data],{type:"buffer"});return await mn(e,{...t,data:r,headers:{"Content-Type":"application/octet-stream"}},!0)}const Tn=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;const t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-alpha\.([0-9]+)/);if(t&&t[1]&&t[2]){return`${t[1]}.${t[2]}`}const r=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-special\.([0-9]+)/);if(r&&r[1]&&r[2]){const e=r[1],t=r[2];return`${e}.${100*(Number(t)+1)}`}return"4.0.0.999"}("4.20.2"),Sn=function(){try{return!0===JSON.parse("true")}catch(e){return!0}}();var vn;!function(e){e.Default="default",e.Auto="auto",e.Relay="relay",e.SdRtn="sd-rtn"}(vn||(vn={}));const yn={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"],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",ENABLE_EVENT_REPORT:!0,GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",HTTP_CONNECT_TIMEOUT:5e3,SIGNAL_REQUEST_TIMEOUT:1e4,REPORT_STATS:!0,UPLOAD_LOG:!1,NOT_REPORT_EVENT:[],SUBSCRIBE_TWCC:!1,PUBLISH_TWCC:!1,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,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",TURN_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,PRELOAD_MEDIA_COUNT:0,USE_PUB_RTX:!1,USE_SUB_RTX:!1,CHECK_VIDEO_VISIBLE_INTERVAL:3e4,CHECK_LOCAL_STATS_INTERVAL:100,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,ENABLE_PUBLISHED_USER_LIST:!0,MAX_SUBSCRIPTION:50,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_PORT:"",SHOW_VIDEO_INSPECT_WORKER_MESSAGE:!1,STATS_COLLECTOR_PORT:443,FORCE_TURN_TCP:!1,SUBSCRIBE_AUDIO_FILTER_TOPN:void 0,ENABLE_PUBLISH_AUDIO_FILTER:void 0,DISABLE_FEC:void 0,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,ICE_RESTART_INTERVAL:1e4,NEW_ICE_RESTART:!1,ENABLE_USER_LICENSE_CHECK:!0,SIGNAL_CHANNEL:0,TRANSMITTER_INITIAL_RTT:30,TRANSMITTER_INITIAL_RTO:30,TRANSMITTER_MAX_BATCH_ACK_COUNT:2,TRANSMITTER_MAX_RTO:500,DATACHANNEL_COMPRESS:!1,FINGERPRINT:null,DC_JOIN_WITH_FAILBACK:5e3,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,AP_AREA:!0,SVC:[],ENABLE_ENCODED_TRANSFORM:!1,ENABLE_VIDEO_SEI:!1,IMAGE_MODERATION_WORKER_HOST:"edge.agora.io",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,ENABLE_DATASTREAM_2:!1,DATASTREAM_MAX_RETRANSMITS:10,ENABLE_USER_AUTO_REBALANCE_CHECK:!0,ENABLE_INSTANT_VIDEO:!1,ENABLE_NTP_REPORT:!1,USE_XR:!1,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,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:[],PLUGIN_INFO:[]};function Rn(e,t,r){Object.keys(yn).includes(e)&&(!r&&Object.keys(An).includes(e)||(yn[e]=t,"ENABLE_VIDEO_SEI"===e&&!0===t&&(yn.ENABLE_ENCODED_TRANSFORM=!0)))}function bn(e){return yn[e]}const An={};var In,On,Cn;!function(e){e.SET_SESSION_ID="SET_SESSION_ID",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.AVOID_JOIN_START="AVOID_JOIN_START",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_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_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.SET_USE_DATACHANNEL="SET_USE_DATACHANNEL",e.SET_USE_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE"}(In||(In={})),function(e){e.h264="h264",e.h265="h265",e.vp8="vp8",e.vp9="vp9",e.av1="av1"}(On||(On={})),function(e){e.opus="opus",e.pcma="pcma",e.pcmu="pcmu",e.g722="g722"}(Cn||(Cn={}));const wn=new class extends Ke{reportLogUploadError(e){this.emit("REPORT_LOG_UPLOAD",e)}};class Nn{logger;prefixLists=[];constructor(e){this.logger=e}debug(...e){this.logger.debug(...this.prefixLists,...e)}info(...e){this.logger.info(...this.prefixLists,...e)}warning(...e){this.logger.warning(...this.prefixLists,...e)}error(...e){this.logger.error(...this.prefixLists,...e)}prefix(e){return this.prefixLists.push(e),this}popPrefix(){return this.prefixLists.pop(),this}}function kn(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}function Dn(){const e=new Date,t=/((\d+:){2}\d+)/.exec((new Date).toUTCString());return t?t?.[0]+":"+e.getUTCMilliseconds():e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}const Pn={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},Ln=Date.now(),Mn=e=>{for(const t in Pn)if(Object.prototype.hasOwnProperty.call(Pn,t)&&Pn[t]===e)return t;return"DEFAULT"};const Un=new class{proxyServerURL;logLevel=Pn.DEBUG;uploadState="collecting";uploadLogWaitingList=[];uploadLogUploadingList=[];uploadErrorCount=0;currentLogID=0;url;constructor(){}debug(...e){const t=[Pn.DEBUG].concat(e);this.log.apply(this,t)}info(...e){const t=[Pn.INFO].concat(e);this.log.apply(this,t)}warning(...e){const t=[Pn.WARNING].concat(e);this.log.apply(this,t)}warn(...e){this.warning(...e)}error(...e){const t=[Pn.ERROR].concat(e);this.log.apply(this,t)}upload(...e){const t=[Pn.DEBUG].concat(e);this.uploadLog.apply(this,t)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){Rn("UPLOAD_LOG",!0)}disableLogUpload(){Rn("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new Nn(this).prefix(e)}log(...e){if(Date.now()-Ln<100)return void setTimeout((()=>{this.log(...e)}),Date.now()-Ln);const t=Math.max(0,Math.min(4,e[0]));if(e[0]=kn()+` Agora-SDK [${Mn(t)}]:`,this.appendLogToWaitingList(t,...e),t<this.logLevel)return;const r=kn()+` %cAgora-SDK [${Mn(t)}]:`;let n=[];if(!bn("USE_NEW_LOG"))switch(t){case Pn.DEBUG:n=[r,"color: #64B5F6;"].concat(e.slice(1)),console.log.apply(console,n);break;case Pn.INFO:n=[r,"color: #1E88E5; font-weight: bold;"].concat(e.slice(1)),console.log.apply(console,n);break;case Pn.WARNING:n=[r,"color: #FB8C00; font-weight: bold;"].concat(e.slice(1)),console.warn.apply(console,n);break;case Pn.ERROR:n=[r,"color: #B00020; font-weight: bold;"].concat(e.slice(1)),console.error.apply(console,n)}}uploadLog(...e){if(Date.now()-Ln<100)return void setTimeout((()=>{this.uploadLog(...e)}),Date.now()-Ln);const t=Math.max(0,Math.min(4,e[0]));e[0]=kn()+` Agora-SDK [${Mn(t)}]:`,this.appendLogToWaitingList(t,...e)}appendLogToWaitingList(e,...t){if(!bn("UPLOAD_LOG"))return;Array.isArray(t[0])?t[0][0]=Dn()+` Agora-SDK [${Mn(e)}]:`:t[0]=Dn()+` Agora-SDK [${Mn(e)}]:`;let r="";t.forEach((e=>{"object"==typeof e&&(e=JSON.stringify(e)),r+=`${e} `})),this.uploadLogWaitingList.push({payload_str:r,log_level:e,log_item_id:this.currentLogID++}),"uploading"===this.uploadState&&0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}startUpload(){this.uploadState="uploading",0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}async uploadLogs(){const e=this.uploadLogUploadingList,t={sdk_version:Tn,process_id:bn("PROCESS_ID"),payload:JSON.stringify(e)};return It((async()=>{const e=await fn.post(this.url||(this.proxyServerURL?`https://${this.proxyServerURL}/ls/?h=${bn("LOG_UPLOAD_SERVER")}&p=443&d=upload/v1`:`https://${bn("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)),(e=>(e.response?wn.reportLogUploadError({status:e.response.status,data:e.response.data,headers:e.response.headers,message:e.message}):e.request?wn.reportLogUploadError({status:e.request.status,message:e.message}):wn.reportLogUploadError({status:-1,message:e.message}),!0)),{timeout:bn("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:bn("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,bn("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),bn("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),bn("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),bn("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}extLog=(e,t)=>{this.appendLogToWaitingList(e,...t)}};var xn;!function(e){e.FREE="free",e.UPLOADING="uploading"}(xn||(xn={}));const Vn={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};var Fn,Bn,jn,Gn;!function(e){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.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.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"}(Fn||(Fn={})),function(e){e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",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.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"}(Bn||(Bn={})),function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}(jn||(jn={})),function(e){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"}(Gn||(Gn={}));class Wn{static __CLIENT_LIST__=[];baseInfoMap=new Map;proxyServer;eventUploadTimer;setSessionIdTimer;url;backupUrl;_appId;keyEventUploadPendingItems=[];normalEventUploadPendingItems=[];apiInvokeUploadPendingItems=[];apiInvokeCount=0;ltsList=[];lastSendNormalEventTime=Date.now();customReportCounterTimer;customReportCount=0;constructor(){this.eventUploadTimer=window.setInterval(this.doSend.bind(this),bn("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),bn("EVENT_REPORT_SEND_INTERVAL"))}getBaseInfoBySessionId(e){return this.baseInfoMap.get(e)}adjustSessionStartTime(e){if(!this.baseInfoMap.has(e)&&!this.baseInfoMap.get(e))return void Un.error(`adjust session ${e} start time, sid is not exist or info is undefined`);const t=this.baseInfoMap.get(e),r=Date.now(),n=t.startTime;t.startTime=r,Un.debug(`rewrite session ${e} startTime: ${r} , ${r-n}ms`),this.baseInfoMap.set(e,t)}setAppId(e){this._appId=e}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=()=>({tag:t.tag,invokeId:i,sid:e,name:t.name,apiInvokeTime:n,options:t.options,states:t.states||null}),s=!!bn("SHOW_REPORT_INVOKER_LOG");s&&Un.info(`${t.name} start`,t.options);let a=!1;ft(t.timeout).then((()=>{a||(this.sendApiInvoke({...o(),error:Le.API_INVOKE_TIMEOUT,success:!1}),Un.debug(`${t.name} timeout`))}));const c=new xe(Le.UNEXPECTED_ERROR,`${t.name}: this api invoke is end`);return{onSuccess:e=>{const n=()=>{if(a)throw c;return a=!0,this.sendApiInvoke({...o(),success:!0,...t.reportResult&&{result:e}}),s&&Un.info(`${t.name} onSuccess`),e};return r?gt(n,t.name+"Success",r,(()=>a=!0)):n()},onError:e=>{const n=()=>{if(a)throw e;a=!0,this.sendApiInvoke({...o(),success:!1,error:e}),s&&Un.info(`${t.name} onFailure`,e.toString())};return r?gt(n,t.name+"Error",r,(()=>a=!0)):n()}}}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),n=this.createBaseInfo(e,r);n.cname=t.cname;const i=Object.assign({},{willUploadConsoleLog:bn("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:Sn?"global":"oversea",areas:bn("AREAS")&&bn("AREAS").join(",")},t.extend),{stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientRole:u}=t,l=Date.now(),h={...n,eventType:Fn.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,build:"v4.20.2-0-g8ae7fdad(3/20/2024, 4:48:28 PM)",lts:l,elapse:l-r,extend:JSON.stringify(i),mode:t.mode,process:bn("PROCESS_ID"),appType:bn("APP_TYPE"),success:!0,version:Tn,stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientType:20,clientRole:u,serviceId:bn("PROCESS_ID"),extensionID:bn("PLUGIN_INFO").join(",")||""};this.send({type:Bn.SESSION,data:h},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o={...n,eventType:Fn.JOIN_CHOOSE_SERVER,lts:i,eventElapse: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};this.send({type:Bn.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={...n,eventType:Fn.REQ_USER_ACCOUNT,lts:i,success:t.success,serverAddress:t.serverAddr,stringUid:t.stringUid,uid:t.uid,errorCode:t.errorCode,elapse:i-r.startTime,eventElapse:i-t.lts,extend:JSON.stringify(t.extend)};this.send({type:Bn.REQ_USER_ACCOUNT,data:o},!0)}joinGateway(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info;t.vid&&(n.vid=t.vid),n.uid=t.uid,n.cid=t.cid;const i=Date.now(),{firstSuccess:o,avoidJoinStartTime:s,isProxy:a,addr:c}=t,d=i-(o&&s?s:r.startTime),u={...n,eventType:Fn.JOIN_GATEWAY,lts:i,gatewayAddr:t.addr,success:t.succ,errorCode:t.ec,elapse:d,eventElapse:i-t.lts,firstSuccess:o,signalChannel:t.signalChannel},l=u.success?1:0;if(t.succ&&(r.lastJoinSuccessTime=i),o)this.send({type:Bn.JOIN_GATEWAY,data:u},!0);else{let e;if(c)if(a){const t=c.match(/h=(\d{1,3}-){3}\d{1,3}/g),r=c.match(/p=[0-9]{1,6}/g);e={isSuccess:l,gatewayIp:t&&t.length?t[0].split("=")[1].replace(/-/g,"."):"",port:r&&r.length?r[0].split("=")[1]:"",isProxy:a?1:0}}else{const t=c.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),r=c.match(/(:|p=)[0-9]{1,6}/g);e={isSuccess:l,gatewayIp:t&&t.length?t[0].split("//")[1].replace(/-/g,"."):"",port:r&&r.length?r[0].split(/:|p=/g)[1]:"",isProxy:a?1:0}}else e={isSuccess:l,gatewayIp:"",port:"",isProxy:a?1:0};delete u.success,delete u.eventType,delete u.firstSuccess,u.vid=Number(u.vid);const t=Object.assign({},u,e,{eventType:Fn.REJOIN_GATEWAY});this.send({type:Bn.RE_JOIN_GATEWAY,data:t},!0)}}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=Date.now(),i={...r.info,lts:n,timeout:t,elapse:n-r.startTime};this.send({type:Bn.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={...n,eventType:Fn.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:Bn.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={...i,eventType:Fn.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,...r&&{extend:JSON.stringify({isMassSubscribe:!0})}};"string"==typeof t.peerid?s.peerSuid=t.peerid:s.peer=t.peerid,this.send({type:Bn.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={...i,eventType:Fn.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-n.startTime,status:e.status?1:2};this.send({type:Bn.WS_COMPRESSOR_INIT,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={...o,...n,elapse:s-i.startTime,eventType:t,lts:s,firstDecodeFrame:Math.max(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={...o,...n,elapse:s-i.startTime,eventType:t,lts:s};this.send({type:r,data:a},!0)}pcStats(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o={...n,...t,vid:void 0===n.vid?0:Number(n.vid),elapse:i-r.startTime,eventType:Fn.PC_STATS,lts:i};this.send({type:Bn.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={...n,...t,vid:void 0===n.vid?0:Number(n.vid),eventType:Fn.UPDATE_REMOTE_RTPCAPABILITIES,lts:i};this.send({type:Bn.UPDATE_REMOTE_RTPCAPABILITIES,data:o},!0)}}onGatewayStream(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o={...i.info,...n,eventType:t,lts:Date.now()};this.send({type:r,data:o},!0)}streamSwitch(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o={...n,eventType:Fn.STREAM_SWITCH,lts:i,isDual:t.isdual,elapse:i-r.startTime,success:t.succ};this.send({type:Bn.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={...n,eventType:Fn.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:Bn.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={...n,eventType:Fn.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:Bn.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?Un.debug(`reportProxyServerurl: ${e}`):Un.debug(`disable reportProxyServerurl: ${e}`)}peerPublishStatus(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o={...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:Bn.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(),o=function(e,t,r){const n=e[t];if(!n||"string"!=typeof n)return[e];e[t]="";const i=pt(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]={...e,[t]:n.substring(o,c)},o=c,a=n.charCodeAt(c)<=127?1:3);return o!==n.length-1&&(s[s.length]={...e,[t]:n.substring(o)}),s}({...n,...t,elapse:i-r.startTime,lts:i,productType:"WebRTC"},"payload",1300);o.forEach((e=>this.send({type:Bn.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={...n,...t,elapse:i-r.startTime,lts:i};this.send({type:Bn.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={...n,...t,elapse:i-r.startTime,lts:i,extend:t.extend||void 0};this.send({type:Bn.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={...n,...t,elapse:i-r.startTime,lts:i};this.send({type:Bn.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>bn("CUSTOM_REPORT_LIMIT"))throw new xe(Le.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval((()=>{this.customReportCount=0}),5e3));const r=Date.now(),n=t.map((t=>({type:Bn.USER_ANALYTICS,data:{sid:e,...t,lts:r}})));try{bn("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(n):await this.postDataToStatsCollector(n)}catch(e){throw Un.error("send custom report message failed",e.toString()),new xe(Le.CUSTOM_REPORT_SEND_FAILED,e.message)}}sendApiInvoke(e){const t=bn("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{cname:n,uid:i,cid:o}=r.info;let s;if(e.lts=e.lts||Date.now(),e.error)if(e.error instanceof xe){const{code:t,message:r}=e.error;s=t||(r||e.error.toString())}else s=e.error.toString();const a={invokeId:e.invokeId,sid:e.sid,cname:n,cid:o,uid:i,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?s:void 0,errorMsg:e.error?JSON.stringify(e.error):void 0};return this.send({type:Bn.API_INVOKE,data:a},!1),!0}appendSessionId(){Wn.__CLIENT_LIST__.forEach((e=>{if(e._sessionId){const t=this.apiInvokeUploadPendingItems.length;for(let r=0;r<t;r++){const t=this.apiInvokeUploadPendingItems.shift();t&&(t.sid=e._sessionId,this.sendApiInvoke(Object.assign({},t)))}}}))}send(e,t){if(t)return this.keyEventUploadPendingItems.push(e),void this.sendItems(this.keyEventUploadPendingItems,!0);this.normalEventUploadPendingItems.push(e),this.normalEventUploadPendingItems.length>bn("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)));t||(this.lastSendNormalEventTime=Date.now());return bn("ENABLE_EVENT_REPORT")?(r.length&&(bn("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{bn("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>bn("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-bn("NORMAL_EVENT_QUEUE_CAPACITY")),Un.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){st.networkState===tt.OFFLINE&&await Promise.race([st.onlineWaiter,ft(2*At.maxRetryTimeout)]);const t=e=>{let t=new Uint8Array;return e.forEach((e=>{const r=(n=JSON.stringify(e.data),(new TextEncoder).encode(n));var n;const i=new ArrayBuffer(5),o=(e=>{let t=0;return Object.entries(Bn).forEach((([r,n])=>{n===e.type&&(t=EventNameToID[r])})),t})(e),s=new DataView(i);s.setUint16(0,r.byteLength,!0),s.setUint8(2,255&o),s.setUint8(3,o>>>8&255),s.setUint8(4,o>>>16&255),t=He(t,new Uint8Array(i)),t=He(t,r)})),t},r="event";let n=this.proxyServer?`https://${this.proxyServer}/rs/?h=${bn("NEW_REPORT_SERVER_DOMAINS")[0]}&p=443&d=${r}`:`https://${bn("NEW_REPORT_SERVER_DOMAINS")[0]}/${r}`;for(let i=0;i<2;i+=1){1===i&&(n=this.proxyServer?`https://${this.proxyServer}/rs/?h=${bn("NEW_REPORT_SERVER_DOMAINS")[1]}&p=443&d=${r}`:`https://${bn("NEW_REPORT_SERVER_DOMAINS")[1]}/${r}`);try{await mn(n,{timeout:1e4,data:t(e),headers:{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,t=!1){const r={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:e.map((e=>JSON.stringify(e))),vid:(e=>{const t=e&&e.data.sid&&this.baseInfoMap.get(e.data.sid);return t&&t.info.vid&&+t.info.vid||0})(e[0])};st.networkState===tt.OFFLINE&&await Promise.race([st.onlineWaiter,ft(2*At.maxRetryTimeout)]);const n=t?"/events/proto-raws":"/events/messages";let i=this.url||(this.proxyServer?`https://${this.proxyServer}/rs/?h=${bn("EVENT_REPORT_DOMAIN")}&p=${bn("STATS_COLLECTOR_PORT")}&d=${n}`:`https://${bn("EVENT_REPORT_DOMAIN")}:${bn("STATS_COLLECTOR_PORT")}${n}`);for(let e=0;e<2;e+=1){1===e&&(i=this.backupUrl||(this.proxyServer?`https://${this.proxyServer}/rs/?h=${bn("EVENT_REPORT_BACKUP_DOMAIN")}&p=${bn("STATS_COLLECTOR_PORT")}&d=${n}`:`https://${bn("EVENT_REPORT_BACKUP_DOMAIN")}:${bn("STATS_COLLECTOR_PORT")}${n}`));try{t?await gn(i,{timeout:1e4,data:r}):await mn(i,{timeout:1e4,data:r})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},Vn);return r.sid=e,this.baseInfoMap.set(e,{info:r,startTime:t}),r}reportResourceTiming(e,t){const r=performance.getEntriesByName(e),n=r[r.length-1];n&&this.reportApiInvoke(t,{name:"Client.resourceTiming",options:n,tag:Ze.TRACER}).onSuccess()}extApiInvoke=async e=>{for(const t of e){const e={...t,sid:null,invokeId:++this.apiInvokeCount,tag:Ze.TRACER};this.sendApiInvoke(e)}}}function Hn(e={}){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(...t){let n=t;if(e.argsMap)try{n=e.argsMap(this,...t)}catch(e){Un.warning(e),n=[]}try{JSON.stringify(n)}catch(e){Un.warning(`arguments for method ${o}.${String(r)} not serializable for apiInvoke.`),n=[]}const s=(e.report||Kn).reportApiInvoke(this._sessionId||null,{name:`${o}.${String(r)}`,options:n,tag:Ze.TRACER,reportResult:e.reportResult},e.throttleTime);try{const r=i.apply(this,t);return r instanceof Promise?r.then((t=>(s.onSuccess(e.reportResult&&t),t))).catch((e=>{throw s.onError(e),e})):(s.onSuccess(e.reportResult&&r),r)}catch(e){throw s.onError(e),e}}}return n}}const Kn=new Wn;wn.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=st.networkState,Kn.reportApiInvoke(null,{name:"logUploadError",options:e,tag:Ze.TRACER})}));const zn={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};function Yn(){const e=_e();zn.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),zn.getStreamFromExtension=e.name===de.CHROME&&Number(e.version)>34,zn.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}(),zn.supportMinBitrate=e.name===de.CHROME||e.name===de.EDGE,zn.supportSetRtpSenderParameters=function(){const e=_e();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!ke()||(!(!Se()&&!ge())||e.name===de.FIREFOX&&Number(e.version)>=64)}(),e.name===de.SAFARI&&(Number(e.version)>=14?zn.supportDualStream=!0:zn.supportDualStream=!1),zn.webAudioMediaStreamDest=function(){const e=_e();if(e.name===de.SAFARI&&Number(e.version)<12)return!1;return!0}(),zn.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),zn.supportWebGL="undefined"!=typeof WebGLRenderingContext,zn.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,ke()||(zn.webAudioWithAEC=!0),zn.supportShareAudio=function(){const e=_e();if((e.os===ce.WIN_10||e.os===ce.WIN_81||e.os===ce.WIN_7||e.os===ce.LINUX||e.os===ce.MAC_OS||e.os===ce.CHROMIUM_OS)&&e.name===de.CHROME&&Number(e.version)>=74)return!0;return!1}(),zn.supportDataChannel=function(){if(Re(76)||function(e){const t=_e();return!(t.name!==de.FIREFOX||!t.osVersion)&&Number(t.version)>=e}(68)||function(e){const t=_e();return!(t.name!==de.SAFARI||!t.osVersion)&&Number(t.version)>=e}(14))return!0;return!1}(),zn.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!ve()&&!!e&&e.prototype.setConfiguration instanceof Function}(),zn.supportWebRTCEncodedTransform=function(){const e=_e();return"Chrome"===e.name&&Number(e.version)>=86||"Safari"===e.name&&Number(e.version)>=15}(),zn.supportWebRTCInsertableStream=function(){const e=_e();return(e.name===de.CHROME||e.name===de.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),ct((()=>{zn.supportDualStreamEncoding=function(){const e=_e();if(bn("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&bn("CHROME_DUAL_STREAM_USE_ENCODING"))}(),Un.info("browser compatibility",JSON.stringify(zn),JSON.stringify(e))}))}function Xn(){return zn}var Jn;e.AUDIO_CONTEXT_EVENT=void 0,(Jn=e.AUDIO_CONTEXT_EVENT||(e.AUDIO_CONTEXT_EVENT={})).IOS_15_16_INTERRUPTION_START="ios15_16-interruption-start",Jn.IOS_15_16_INTERRUPTION_END="ios15_16-interruption-end",Jn.IOS_INTERRUPTION_START="ios-interruption-start",Jn.IOS_INTERRUPTION_END="ios-interruption-end",Jn.STATE_CHANGE="state-change";var Zn=function(e){try{return!!e()}catch(e){return!0}},qn=!Zn((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),$n=qn,Qn=Function.prototype,ei=Qn.call,ti=$n&&Qn.bind.bind(ei,ei),ri=$n?ti:function(e){return function(){return ei.apply(e,arguments)}},ni=ri({}.isPrototypeOf),ii=function(e){return e&&e.Math==Math&&e},oi=ii("object"==typeof globalThis&&globalThis)||ii("object"==typeof window&&window)||ii("object"==typeof self&&self)||ii("object"==typeof X&&X)||function(){return this}()||X||Function("return this")(),si=qn,ai=Function.prototype,ci=ai.apply,di=ai.call,ui="object"==typeof Reflect&&Reflect.apply||(si?di.bind(ci):function(){return di.apply(ci,arguments)}),li=ri,hi=li({}.toString),pi=li("".slice),fi=function(e){return pi(hi(e),8,-1)},_i=fi,Ei=ri,mi=function(e){if("Function"===_i(e))return Ei(e)},gi="object"==typeof document&&document.all,Ti={all:gi,IS_HTMLDDA:void 0===gi&&void 0!==gi},Si=Ti.all,vi=Ti.IS_HTMLDDA?function(e){return"function"==typeof e||e===Si}:function(e){return"function"==typeof e},yi={},Ri=!Zn((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),bi=qn,Ai=Function.prototype.call,Ii=bi?Ai.bind(Ai):function(){return Ai.apply(Ai,arguments)},Oi={},Ci={}.propertyIsEnumerable,wi=Object.getOwnPropertyDescriptor,Ni=wi&&!Ci.call({1:2},1);Oi.f=Ni?function(e){var t=wi(this,e);return!!t&&t.enumerable}:Ci;var ki,Di,Pi=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Li=Zn,Mi=fi,Ui=Object,xi=ri("".split),Vi=Li((function(){return!Ui("z").propertyIsEnumerable(0)}))?function(e){return"String"==Mi(e)?xi(e,""):Ui(e)}:Ui,Fi=function(e){return null==e},Bi=Fi,ji=TypeError,Gi=function(e){if(Bi(e))throw ji("Can't call method on "+e);return e},Wi=Vi,Hi=Gi,Ki=function(e){return Wi(Hi(e))},zi=vi,Yi=Ti.all,Xi=Ti.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:zi(e)||e===Yi}:function(e){return"object"==typeof e?null!==e:zi(e)},Ji={},Zi=Ji,qi=oi,$i=vi,Qi=function(e){return $i(e)?e:void 0},eo=function(e,t){return arguments.length<2?Qi(Zi[e])||Qi(qi[e]):Zi[e]&&Zi[e][t]||qi[e]&&qi[e][t]},to="undefined"!=typeof navigator&&String(navigator.userAgent)||"",ro=oi,no=to,io=ro.process,oo=ro.Deno,so=io&&io.versions||oo&&oo.version,ao=so&&so.v8;ao&&(Di=(ki=ao.split("."))[0]>0&&ki[0]<4?1:+(ki[0]+ki[1])),!Di&&no&&(!(ki=no.match(/Edge\/(\d+)/))||ki[1]>=74)&&(ki=no.match(/Chrome\/(\d+)/))&&(Di=+ki[1]);var co=Di,uo=co,lo=Zn,ho=oi.String,po=!!Object.getOwnPropertySymbols&&!lo((function(){var e=Symbol();return!ho(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&uo&&uo<41})),fo=po&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,_o=eo,Eo=vi,mo=ni,go=Object,To=fo?function(e){return"symbol"==typeof e}:function(e){var t=_o("Symbol");return Eo(t)&&mo(t.prototype,go(e))},So=String,vo=function(e){try{return So(e)}catch(e){return"Object"}},yo=vi,Ro=vo,bo=TypeError,Ao=function(e){if(yo(e))return e;throw bo(Ro(e)+" is not a function")},Io=Ao,Oo=Fi,Co=function(e,t){var r=e[t];return Oo(r)?void 0:Io(r)},wo=Ii,No=vi,ko=Xi,Do=TypeError,Po={exports:{}},Lo=oi,Mo=Object.defineProperty,Uo=function(e,t){try{Mo(Lo,e,{value:t,configurable:!0,writable:!0})}catch(r){Lo[e]=t}return t},xo="__core-js_shared__",Vo=oi[xo]||Uo(xo,{}),Fo=Vo;(Po.exports=function(e,t){return Fo[e]||(Fo[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.31.1",mode:"pure",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.31.1/LICENSE",source:"https://github.com/zloirock/core-js"});var Bo=Po.exports,jo=Gi,Go=Object,Wo=function(e){return Go(jo(e))},Ho=Wo,Ko=ri({}.hasOwnProperty),zo=Object.hasOwn||function(e,t){return Ko(Ho(e),t)},Yo=ri,Xo=0,Jo=Math.random(),Zo=Yo(1..toString),qo=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Zo(++Xo+Jo,36)},$o=Bo,Qo=zo,es=qo,ts=po,rs=fo,ns=oi.Symbol,is=$o("wks"),os=rs?ns.for||ns:ns&&ns.withoutSetter||es,ss=function(e){return Qo(is,e)||(is[e]=ts&&Qo(ns,e)?ns[e]:os("Symbol."+e)),is[e]},as=Ii,cs=Xi,ds=To,us=Co,ls=function(e,t){var r,n;if("string"===t&&No(r=e.toString)&&!ko(n=wo(r,e)))return n;if(No(r=e.valueOf)&&!ko(n=wo(r,e)))return n;if("string"!==t&&No(r=e.toString)&&!ko(n=wo(r,e)))return n;throw Do("Can't convert object to primitive value")},hs=TypeError,ps=ss("toPrimitive"),fs=function(e,t){if(!cs(e)||ds(e))return e;var r,n=us(e,ps);if(n){if(void 0===t&&(t="default"),r=as(n,e,t),!cs(r)||ds(r))return r;throw hs("Can't convert object to primitive value")}return void 0===t&&(t="number"),ls(e,t)},_s=To,Es=function(e){var t=fs(e,"string");return _s(t)?t:t+""},ms=Xi,gs=oi.document,Ts=ms(gs)&&ms(gs.createElement),Ss=function(e){return Ts?gs.createElement(e):{}},vs=Ss,ys=!Ri&&!Zn((function(){return 7!=Object.defineProperty(vs("div"),"a",{get:function(){return 7}}).a})),Rs=Ri,bs=Ii,As=Oi,Is=Pi,Os=Ki,Cs=Es,ws=zo,Ns=ys,ks=Object.getOwnPropertyDescriptor;yi.f=Rs?ks:function(e,t){if(e=Os(e),t=Cs(t),Ns)try{return ks(e,t)}catch(e){}if(ws(e,t))return Is(!bs(As.f,e,t),e[t])};var Ds=Zn,Ps=vi,Ls=/#|\.prototype\./,Ms=function(e,t){var r=xs[Us(e)];return r==Fs||r!=Vs&&(Ps(t)?Ds(t):!!t)},Us=Ms.normalize=function(e){return String(e).replace(Ls,".").toLowerCase()},xs=Ms.data={},Vs=Ms.NATIVE="N",Fs=Ms.POLYFILL="P",Bs=Ms,js=Ao,Gs=qn,Ws=mi(mi.bind),Hs=function(e,t){return js(e),void 0===t?e:Gs?Ws(e,t):function(){return e.apply(t,arguments)}},Ks={},zs=Ri&&Zn((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ys=Xi,Xs=String,Js=TypeError,Zs=function(e){if(Ys(e))return e;throw Js(Xs(e)+" is not an object")},qs=Ri,$s=ys,Qs=zs,ea=Zs,ta=Es,ra=TypeError,na=Object.defineProperty,ia=Object.getOwnPropertyDescriptor,oa="enumerable",sa="configurable",aa="writable";Ks.f=qs?Qs?function(e,t,r){if(ea(e),t=ta(t),ea(r),"function"==typeof e&&"prototype"===t&&"value"in r&&aa in r&&!r[aa]){var n=ia(e,t);n&&n[aa]&&(e[t]=r.value,r={configurable:sa in r?r[sa]:n[sa],enumerable:oa in r?r[oa]:n[oa],writable:!1})}return na(e,t,r)}:na:function(e,t,r){if(ea(e),t=ta(t),ea(r),$s)try{return na(e,t,r)}catch(e){}if("get"in r||"set"in r)throw ra("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var ca=Ks,da=Pi,ua=Ri?function(e,t,r){return ca.f(e,t,da(1,r))}:function(e,t,r){return e[t]=r,e},la=oi,ha=ui,pa=mi,fa=vi,_a=yi.f,Ea=Bs,ma=Ji,ga=Hs,Ta=ua,Sa=zo,va=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 ha(e,this,arguments)};return t.prototype=e.prototype,t},ya=function(e,t){var r,n,i,o,s,a,c,d,u,l=e.target,h=e.global,p=e.stat,f=e.proto,_=h?la:p?la[l]:(la[l]||{}).prototype,E=h?ma:ma[l]||Ta(ma,l,{})[l],m=E.prototype;for(o in t)n=!(r=Ea(h?o:l+(p?".":"#")+o,e.forced))&&_&&Sa(_,o),a=E[o],n&&(c=e.dontCallGetSet?(u=_a(_,o))&&u.value:_[o]),s=n&&c?c:t[o],n&&typeof a==typeof s||(d=e.bind&&n?ga(s,la):e.wrap&&n?va(s):f&&fa(s)?pa(s):s,(e.sham||s&&s.sham||a&&a.sham)&&Ta(d,"sham",!0),Ta(E,o,d),f&&(Sa(ma,i=l+"Prototype")||Ta(ma,i,{}),Ta(ma[i],o,s),e.real&&m&&(r||!m[o])&&Ta(m,o,s)))},Ra=Math.ceil,ba=Math.floor,Aa=Math.trunc||function(e){var t=+e;return(t>0?ba:Ra)(t)},Ia=function(e){var t=+e;return t!=t||0===t?0:Aa(t)},Oa=Ia,Ca=Math.max,wa=Math.min,Na=function(e,t){var r=Oa(e);return r<0?Ca(r+t,0):wa(r,t)},ka=Ia,Da=Math.min,Pa=function(e){return e>0?Da(ka(e),9007199254740991):0},La=function(e){return Pa(e.length)},Ma=Ki,Ua=Na,xa=La,Va=function(e){return function(t,r,n){var i,o=Ma(t),s=xa(o),a=Ua(n,s);if(e&&r!=r){for(;s>a;)if((i=o[a++])!=i)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},Fa={includes:Va(!0),indexOf:Va(!1)},Ba=Fa.includes;ya({target:"Array",proto:!0,forced:Zn((function(){return!Array(1).includes()}))},{includes:function(e){return Ba(this,e,arguments.length>1?arguments[1]:void 0)}});var ja=Ji,Ga=function(e){return ja[e+"Prototype"]},Wa=Ga("Array").includes,Ha=Xi,Ka=fi,za=ss("match"),Ya=function(e){var t;return Ha(e)&&(void 0!==(t=e[za])?!!t:"RegExp"==Ka(e))},Xa=TypeError,Ja={};Ja[ss("toStringTag")]="z";var Za="[object z]"===String(Ja),qa=Za,$a=vi,Qa=fi,ec=ss("toStringTag"),tc=Object,rc="Arguments"==Qa(function(){return arguments}()),nc=qa?Qa: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=tc(e),ec))?r:rc?Qa(t):"Object"==(n=Qa(t))&&$a(t.callee)?"Arguments":n},ic=nc,oc=String,sc=function(e){if("Symbol"===ic(e))throw TypeError("Cannot convert a Symbol value to a string");return oc(e)},ac=ss("match"),cc=ya,dc=function(e){if(Ya(e))throw Xa("The method doesn't accept regular expressions");return e},uc=Gi,lc=sc,hc=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[ac]=!1,"/./"[e](t)}catch(e){}}return!1},pc=ri("".indexOf);cc({target:"String",proto:!0,forced:!hc("includes")},{includes:function(e){return!!~pc(lc(uc(this)),lc(dc(e)),arguments.length>1?arguments[1]:void 0)}});var fc=Ga("String").includes,_c=ni,Ec=Wa,mc=fc,gc=Array.prototype,Tc=String.prototype,Sc=J((function(e){var t=e.includes;return e===gc||_c(gc,e)&&t===gc.includes?Ec:"string"==typeof e||e===Tc||_c(Tc,e)&&t===Tc.includes?mc:t}));function vc(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function yc(e,t,r,n,i){return{width:e,height:t,frameRate:r,bitrateMin:n,bitrateMax:i}}function Rc(e,t,r,n,i){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:n,bitrateMax:i}}function bc(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const Ac={"90p":yc(160,90),"90p_1":yc(160,90),"120p":yc(160,120,15,30,65),"120p_1":yc(160,120,15,30,65),"120p_3":yc(120,120,15,30,50),"120p_4":yc(212,120),"180p":yc(320,180,15,30,140),"180p_1":yc(320,180,15,30,140),"180p_3":yc(180,180,15,30,100),"180p_4":yc(240,180,15,30,120),"240p":yc(320,240,15,40,200),"240p_1":yc(320,240,15,40,200),"240p_3":yc(240,240,15,40,140),"240p_4":yc(424,240,15,40,220),"360p":yc(640,360,15,80,400),"360p_1":yc(640,360,15,80,400),"360p_3":yc(360,360,15,80,260),"360p_4":yc(640,360,30,80,600),"360p_6":yc(360,360,30,80,400),"360p_7":yc(480,360,15,80,320),"360p_8":yc(480,360,30,80,490),"360p_9":yc(640,360,15,80,800),"360p_10":yc(640,360,24,80,800),"360p_11":yc(640,360,24,80,1e3),"480p":yc(640,480,15,100,500),"480p_1":yc(640,480,15,100,500),"480p_2":yc(640,480,30,100,1e3),"480p_3":yc(480,480,15,100,400),"480p_4":yc(640,480,30,100,750),"480p_6":yc(480,480,30,100,600),"480p_8":yc(848,480,15,100,610),"480p_9":yc(848,480,30,100,930),"480p_10":yc(640,480,10,100,400),"720p":yc(1280,720,15,120,1130),"720p_auto":yc(1280,720,30,900,3e3),"720p_1":yc(1280,720,15,120,1130),"720p_2":yc(1280,720,30,120,2e3),"720p_3":yc(1280,720,30,120,1710),"720p_5":yc(960,720,15,120,910),"720p_6":yc(960,720,30,120,1380),"1080p":yc(1920,1080,15,120,2080),"1080p_1":yc(1920,1080,15,120,2080),"1080p_2":yc(1920,1080,30,120,3e3),"1080p_3":yc(1920,1080,30,120,3150),"1080p_5":yc(1920,1080,60,120,4780),"1440p":yc(2560,1440,30,120,4850),"1440p_1":yc(2560,1440,30,120,4850),"1440p_2":yc(2560,1440,60,120,7350),"4k":yc(3840,2160,30,120,8910),"4k_1":yc(3840,2160,30,120,8910),"4k_3":yc(3840,2160,60,120,13500)},Ic=[{scaleResolutionDownBy:2,width:1280,height:720,frameRate:30,bitrateMin:300,bitrateMax:900},{scaleResolutionDownBy:1.333333,width:1280,height:720,frameRate:30,bitrateMin:600,bitrateMax:2e3},{scaleResolutionDownBy:1,width:1280,height:720,frameRate:30,bitrateMin:900,bitrateMax:3e3}],Oc={"480p":Rc(640,480,5),"480p_1":Rc(640,480,5),"480p_2":Rc(640,480,30),"480p_3":Rc(640,480,15),"720p":Rc(1280,720,5),"720p_auto":yc(1280,720,30,900,3e3),"720p_1":Rc(1280,720,5),"720p_2":Rc(1280,720,30),"720p_3":Rc(1280,720,15),"1080p":Rc(1920,1080,5),"1080p_1":Rc(1920,1080,5),"1080p_2":Rc(1920,1080,30),"1080p_3":Rc(1920,1080,15)},Cc={"1SL1TL":bc(1,1),"3SL3TL":bc(3,3),"2SL3TL":bc(2,3)};function wc(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},Ac[e]):e}function Nc(e){return"string"==typeof e?Object.assign({},Oc[e]):e}function kc(e){return"string"==typeof e?Object.assign({},Cc[e]):e}const Dc={speech_low_quality:vc(16e3,!1),speech_standard:vc(32e3,!1,18),music_standard:vc(48e3,!1),standard_stereo:vc(48e3,!0,56),high_quality:vc(48e3,!1,128),high_quality_stereo:vc(48e3,!0,192)};function Pc(e){return"string"==typeof e?Object.assign({},Dc[e]):e}const Lc=[];function Mc(e){Sc(Lc).call(Lc,e)||Lc.push(e)}function Uc(e){const t=Lc.indexOf(e);-1!==t&&Lc.splice(t,1)}function xc(e){return je(e.width,"config.width"),je(e.height,"config.height"),void 0!==e.frameRate&&je(e.frameRate,"config.frameRate"),void 0!==e.bitrateMax&&Be(e.bitrateMax,"config.bitrateMax"),void 0!==e.bitrateMin&&Be(e.bitrateMin,"config.bitrateMin"),!0}function Vc(e){return void 0!==e.sampleRate&&Be(e.sampleRate,"config.sampleRate",0,96e3,!0),void 0!==e.sampleSize&&Be(e.sampleRate,"config.sampleSize",0,128,!0),void 0!==e.stereo&&Ve(e.stereo,"config.stereo"),void 0!==e.bitrate&&Be(e.bitrate,"config.bitrate",0,1e4,!1),!0}function Fc(e){return Fe(e,"mediaSource",["screen","window","application"]),!0}var Bc,jc,Gc,Wc,Hc,Kc,zc,Yc,Xc;e.TrackInternalEvent=void 0,(Bc=e.TrackInternalEvent||(e.TrackInternalEvent={})).NEED_RENEGOTIATE="@need_renegotiate",Bc.NEED_REPLACE_TRACK="@need_replace_track",Bc.NEED_REPLACE_MIXING_TRACK="@need_replace_mixing_track",Bc.NEED_CLOSE="@need_close",Bc.NEED_ENABLE_TRACK="@need_enable_track",Bc.NEED_DISABLE_TRACK="@need_disable_track",Bc.NEED_SESSION_ID="@need_sid",Bc.SET_OPTIMIZATION_MODE="@set_optimization_mode",Bc.GET_STATS="@get_stats",Bc.GET_RTC_STATS="@get_rtc_stats",Bc.GET_LOW_VIDEO_TRACK="@get_low_video_track",Bc.NEED_RESET_REMOTE_SDP="@need_reset_remote_sdp",Bc.NEED_UPDATE_VIDEO_ENCODER="@need_update_video_encoder",Bc.NEED_MUTE_TRACK="@need_mute_track",Bc.NEED_UNMUTE_TRACK="@need_unmute_track",e.TrackHint=void 0,(jc=e.TrackHint||(e.TrackHint={})).SCREEN_TRACK="screen_track",jc.CUSTOM_TRACK="custome_track",jc.LOW_STREAM="low_stream",e.StreamType=void 0,(Gc=e.StreamType||(e.StreamType={}))[Gc.HIGH_STREAM=0]="HIGH_STREAM",Gc[Gc.LOW_STREAM=1]="LOW_STREAM",e.RemoteStreamType=void 0,(Wc=e.RemoteStreamType||(e.RemoteStreamType={}))[Wc.HIGH_STREAM=0]="HIGH_STREAM",Wc[Wc.LOW_STREAM=1]="LOW_STREAM",e.RemoteStreamFallbackType=void 0,(Hc=e.RemoteStreamFallbackType||(e.RemoteStreamFallbackType={}))[Hc.DISABLE=0]="DISABLE",Hc[Hc.LOW_STREAM=1]="LOW_STREAM",Hc[Hc.AUDIO_ONLY=2]="AUDIO_ONLY",e.TrackEvents=void 0,(Kc=e.TrackEvents||(e.TrackEvents={})).TRANSCEIVER_UPDATED="transceiver-updated",Kc.SEI_TO_SEND="sei-to-send",Kc.SEI_RECEIVED="sei-received",e.LocalTrackEvents=void 0,(zc=e.LocalTrackEvents||(e.LocalTrackEvents={})).SOURCE_STATE_CHANGE="source-state-change",zc.TRACK_ENDED="track-ended",zc.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload",zc.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",zc.CLOSED="closed",e.RemoteTrackEvents=void 0,(Yc=e.RemoteTrackEvents||(e.RemoteTrackEvents={})).FIRST_FRAME_DECODED="first-frame-decoded",Yc.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",Yc.VIDEO_STATE_CHANGED="video-state-changed",e.AudioSourceEvents=void 0,(Xc=e.AudioSourceEvents||(e.AudioSourceEvents={})).AUDIO_SOURCE_STATE_CHANGE="audio_source_state_change",Xc.RECEIVE_TRACK_BUFFER="receive_track_buffer",Xc.ON_AUDIO_BUFFER="on_audio_buffer",Xc.UPDATE_SOURCE="update_source",e.AUDIO_TRACK_EVENT=void 0,(e.AUDIO_TRACK_EVENT||(e.AUDIO_TRACK_EVENT={})).UPDATE_TRACK_SOURCE="update-track-source";const Jc={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},Zc={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},qc={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveLevel:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1},$c={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};var Qc,ed,td,rd,nd,id;e.PROCESSOR_DESTINATION_EVENTS=void 0,(Qc=e.PROCESSOR_DESTINATION_EVENTS||(e.PROCESSOR_DESTINATION_EVENTS={})).ON_TRACK="on_track",Qc.ON_NODE="on_node",e.PROCESSOR_CONTEXT_EVENTS=void 0,(ed=e.PROCESSOR_CONTEXT_EVENTS||(e.PROCESSOR_CONTEXT_EVENTS={})).REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",ed.REQUEST_CONSTRAINTS="request_constraints",e.DeviceManagerState=void 0,(td=e.DeviceManagerState||(e.DeviceManagerState={})).IDLE="IDLE",td.INITING="INITING",td.INITEND="INITEND",e.DeviceManagerEvent=void 0,(rd=e.DeviceManagerEvent||(e.DeviceManagerEvent={})).STATE_CHANGE="state_change",rd.RECORDING_DEVICE_CHANGED="recordingDeviceChanged",rd.PLAYOUT_DEVICE_CHANGED="playoutDeviceChanged",rd.CAMERA_DEVICE_CHANGED="cameraDeviceChanged",e.MediaElementStatus=void 0,(nd=e.MediaElementStatus||(e.MediaElementStatus={})).NONE="none",nd.INIT="init",nd.CANPLAY="canplay",nd.PLAYING="playing",nd.PAUSED="paused",nd.SUSPEND="suspend",nd.STALLED="stalled",nd.WAITING="waiting",nd.ERROR="error",nd.DESTROYED="destroyed",nd.ABORT="abort",nd.ENDED="ended",nd.EMPTIED="emptied",nd.LOADEDDATA="loadeddata",e.VideoState=void 0,(id=e.VideoState||(e.VideoState={}))[id.VideoStateStopped=0]="VideoStateStopped",id[id.VideoStateStarting=1]="VideoStateStarting",id[id.VideoStateDecoding=2]="VideoStateDecoding",id[id.VideoStateFrozen=3]="VideoStateFrozen";var od;e.DataChannelEvents=void 0,(od=e.DataChannelEvents||(e.DataChannelEvents={})).OPEN="open",od.MESSAGE="message",od.CLOSE="close",od.CLOSING="closing",od.ERROR="error";var sd={exports:{}},ad=ya,cd=Ri,dd=Ks.f;ad({target:"Object",stat:!0,forced:Object.defineProperty!==dd,sham:!cd},{defineProperty:dd});var ud=Ji.Object,ld=sd.exports=function(e,t,r){return ud.defineProperty(e,t,r)};ud.defineProperty.sham&&(ld.sham=!0);var hd=J(sd.exports),pd=fi,fd=Array.isArray||function(e){return"Array"==pd(e)},_d=TypeError,Ed=Es,md=Ks,gd=Pi,Td=function(e,t,r){var n=Ed(t);n in e?md.f(e,n,gd(0,r)):e[n]=r},Sd=vi,vd=Vo,yd=ri(Function.toString);Sd(vd.inspectSource)||(vd.inspectSource=function(e){return yd(e)});var Rd=vd.inspectSource,bd=ri,Ad=Zn,Id=vi,Od=nc,Cd=Rd,wd=function(){},Nd=[],kd=eo("Reflect","construct"),Dd=/^\s*(?:class|function)\b/,Pd=bd(Dd.exec),Ld=!Dd.exec(wd),Md=function(e){if(!Id(e))return!1;try{return kd(wd,Nd,e),!0}catch(e){return!1}},Ud=function(e){if(!Id(e))return!1;switch(Od(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Ld||!!Pd(Dd,Cd(e))}catch(e){return!0}};Ud.sham=!0;var xd=!kd||Ad((function(){var e;return Md(Md.call)||!Md(Object)||!Md((function(){e=!0}))||e}))?Ud:Md,Vd=fd,Fd=xd,Bd=Xi,jd=ss("species"),Gd=Array,Wd=function(e){var t;return Vd(e)&&(t=e.constructor,(Fd(t)&&(t===Gd||Vd(t.prototype))||Bd(t)&&null===(t=t[jd]))&&(t=void 0)),void 0===t?Gd:t},Hd=function(e,t){return new(Wd(e))(0===t?0:t)},Kd=Zn,zd=co,Yd=ss("species"),Xd=ya,Jd=Zn,Zd=fd,qd=Xi,$d=Wo,Qd=La,eu=function(e){if(e>9007199254740991)throw _d("Maximum allowed index exceeded");return e},tu=Td,ru=Hd,nu=function(e){return zd>=51||!Kd((function(){var t=[];return(t.constructor={})[Yd]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},iu=co,ou=ss("isConcatSpreadable"),su=iu>=51||!Jd((function(){var e=[];return e[ou]=!1,e.concat()[0]!==e})),au=function(e){if(!qd(e))return!1;var t=e[ou];return void 0!==t?!!t:Zd(e)};Xd({target:"Array",proto:!0,arity:1,forced:!su||!nu("concat")},{concat:function(e){var t,r,n,i,o,s=$d(this),a=ru(s,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(au(o=-1===t?s:arguments[t]))for(i=Qd(o),eu(c+i),r=0;r<i;r++,c++)r in o&&tu(a,c,o[r]);else eu(c+1),tu(a,c++,o);return a.length=c,a}});var cu={},du={},uu=zo,lu=Ki,hu=Fa.indexOf,pu=du,fu=ri([].push),_u=function(e,t){var r,n=lu(e),i=0,o=[];for(r in n)!uu(pu,r)&&uu(n,r)&&fu(o,r);for(;t.length>i;)uu(n,r=t[i++])&&(~hu(o,r)||fu(o,r));return o},Eu=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],mu=_u,gu=Eu,Tu=Object.keys||function(e){return mu(e,gu)},Su=Ri,vu=zs,yu=Ks,Ru=Zs,bu=Ki,Au=Tu;cu.f=Su&&!vu?Object.defineProperties:function(e,t){Ru(e);for(var r,n=bu(t),i=Au(t),o=i.length,s=0;o>s;)yu.f(e,r=i[s++],n[r]);return e};var Iu,Ou=eo("document","documentElement"),Cu=qo,wu=Bo("keys"),Nu=function(e){return wu[e]||(wu[e]=Cu(e))},ku=Zs,Du=cu,Pu=Eu,Lu=du,Mu=Ou,Uu=Ss,xu="prototype",Vu="script",Fu=Nu("IE_PROTO"),Bu=function(){},ju=function(e){return"<"+Vu+">"+e+"</"+Vu+">"},Gu=function(e){e.write(ju("")),e.close();var t=e.parentWindow.Object;return e=null,t},Wu=function(){try{Iu=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Wu="undefined"!=typeof document?document.domain&&Iu?Gu(Iu):(t=Uu("iframe"),r="java"+Vu+":",t.style.display="none",Mu.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(ju("document.F=Object")),e.close(),e.F):Gu(Iu);for(var n=Pu.length;n--;)delete Wu[xu][Pu[n]];return Wu()};Lu[Fu]=!0;var Hu=Object.create||function(e,t){var r;return null!==e?(Bu[xu]=ku(e),r=new Bu,Bu[xu]=null,r[Fu]=e):r=Wu(),void 0===t?r:Du.f(r,t)},Ku={},zu=_u,Yu=Eu.concat("length","prototype");Ku.f=Object.getOwnPropertyNames||function(e){return zu(e,Yu)};var Xu={},Ju=Na,Zu=La,qu=Td,$u=Array,Qu=Math.max,el=function(e,t,r){for(var n=Zu(e),i=Ju(t,n),o=Ju(void 0===r?n:r,n),s=$u(Qu(o-i,0)),a=0;i<o;i++,a++)qu(s,a,e[i]);return s.length=a,s},tl=fi,rl=Ki,nl=Ku.f,il=el,ol="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Xu.f=function(e){return ol&&"Window"==tl(e)?function(e){try{return nl(e)}catch(e){return il(ol)}}(e):nl(rl(e))};var sl={};sl.f=Object.getOwnPropertySymbols;var al=ua,cl=function(e,t,r,n){return n&&n.enumerable?e[t]=r:al(e,t,r),e},dl=Ks,ul=function(e,t,r){return dl.f(e,t,r)},ll={},hl=ss;ll.f=hl;var pl,fl,_l,El=Ji,ml=zo,gl=ll,Tl=Ks.f,Sl=function(e){var t=El.Symbol||(El.Symbol={});ml(t,e)||Tl(t,e,{value:gl.f(e)})},vl=Ii,yl=eo,Rl=ss,bl=cl,Al=function(){var e=yl("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=Rl("toPrimitive");t&&!t[n]&&bl(t,n,(function(e){return vl(r,this)}),{arity:1})},Il=nc,Ol=Za?{}.toString:function(){return"[object "+Il(this)+"]"},Cl=Za,wl=Ks.f,Nl=ua,kl=zo,Dl=Ol,Pl=ss("toStringTag"),Ll=function(e,t,r,n){if(e){var i=r?e:e.prototype;kl(i,Pl)||wl(i,Pl,{configurable:!0,value:t}),n&&!Cl&&Nl(i,"toString",Dl)}},Ml=vi,Ul=oi.WeakMap,xl=Ml(Ul)&&/native code/.test(String(Ul)),Vl=oi,Fl=Xi,Bl=ua,jl=zo,Gl=Vo,Wl=Nu,Hl=du,Kl="Object already initialized",zl=Vl.TypeError,Yl=Vl.WeakMap;if(xl||Gl.state){var Xl=Gl.state||(Gl.state=new Yl);Xl.get=Xl.get,Xl.has=Xl.has,Xl.set=Xl.set,pl=function(e,t){if(Xl.has(e))throw zl(Kl);return t.facade=e,Xl.set(e,t),t},fl=function(e){return Xl.get(e)||{}},_l=function(e){return Xl.has(e)}}else{var Jl=Wl("state");Hl[Jl]=!0,pl=function(e,t){if(jl(e,Jl))throw zl(Kl);return t.facade=e,Bl(e,Jl,t),t},fl=function(e){return jl(e,Jl)?e[Jl]:{}},_l=function(e){return jl(e,Jl)}}var Zl={set:pl,get:fl,has:_l,enforce:function(e){return _l(e)?fl(e):pl(e,{})},getterFor:function(e){return function(t){var r;if(!Fl(t)||(r=fl(t)).type!==e)throw zl("Incompatible receiver, "+e+" required");return r}}},ql=Hs,$l=Vi,Ql=Wo,eh=La,th=Hd,rh=ri([].push),nh=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,d,u,l){for(var h,p,f=Ql(c),_=$l(f),E=ql(d,u),m=eh(_),g=0,T=l||th,S=t?T(c,m):r||s?T(c,0):void 0;m>g;g++)if((a||g in _)&&(p=E(h=_[g],g,f),e))if(t)S[g]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return g;case 2:rh(S,h)}else switch(e){case 4:return!1;case 7:rh(S,h)}return o?-1:n||i?i:S}},ih={forEach:nh(0),map:nh(1),filter:nh(2),some:nh(3),every:nh(4),find:nh(5),findIndex:nh(6),filterReject:nh(7)},oh=ya,sh=oi,ah=Ii,ch=ri,dh=Ri,uh=po,lh=Zn,hh=zo,ph=ni,fh=Zs,_h=Ki,Eh=Es,mh=sc,gh=Pi,Th=Hu,Sh=Tu,vh=Ku,yh=Xu,Rh=sl,bh=yi,Ah=Ks,Ih=cu,Oh=Oi,Ch=cl,wh=ul,Nh=Bo,kh=du,Dh=qo,Ph=ss,Lh=ll,Mh=Sl,Uh=Al,xh=Ll,Vh=Zl,Fh=ih.forEach,Bh=Nu("hidden"),jh="Symbol",Gh="prototype",Wh=Vh.set,Hh=Vh.getterFor(jh),Kh=Object[Gh],zh=sh.Symbol,Yh=zh&&zh[Gh],Xh=sh.TypeError,Jh=sh.QObject,Zh=bh.f,qh=Ah.f,$h=yh.f,Qh=Oh.f,ep=ch([].push),tp=Nh("symbols"),rp=Nh("op-symbols"),np=Nh("wks"),ip=!Jh||!Jh[Gh]||!Jh[Gh].findChild,op=dh&&lh((function(){return 7!=Th(qh({},"a",{get:function(){return qh(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Zh(Kh,t);n&&delete Kh[t],qh(e,t,r),n&&e!==Kh&&qh(Kh,t,n)}:qh,sp=function(e,t){var r=tp[e]=Th(Yh);return Wh(r,{type:jh,tag:e,description:t}),dh||(r.description=t),r},ap=function(e,t,r){e===Kh&&ap(rp,t,r),fh(e);var n=Eh(t);return fh(r),hh(tp,n)?(r.enumerable?(hh(e,Bh)&&e[Bh][n]&&(e[Bh][n]=!1),r=Th(r,{enumerable:gh(0,!1)})):(hh(e,Bh)||qh(e,Bh,gh(1,{})),e[Bh][n]=!0),op(e,n,r)):qh(e,n,r)},cp=function(e,t){fh(e);var r=_h(t),n=Sh(r).concat(hp(r));return Fh(n,(function(t){dh&&!ah(dp,r,t)||ap(e,t,r[t])})),e},dp=function(e){var t=Eh(e),r=ah(Qh,this,t);return!(this===Kh&&hh(tp,t)&&!hh(rp,t))&&(!(r||!hh(this,t)||!hh(tp,t)||hh(this,Bh)&&this[Bh][t])||r)},up=function(e,t){var r=_h(e),n=Eh(t);if(r!==Kh||!hh(tp,n)||hh(rp,n)){var i=Zh(r,n);return!i||!hh(tp,n)||hh(r,Bh)&&r[Bh][n]||(i.enumerable=!0),i}},lp=function(e){var t=$h(_h(e)),r=[];return Fh(t,(function(e){hh(tp,e)||hh(kh,e)||ep(r,e)})),r},hp=function(e){var t=e===Kh,r=$h(t?rp:_h(e)),n=[];return Fh(r,(function(e){!hh(tp,e)||t&&!hh(Kh,e)||ep(n,tp[e])})),n};uh||(zh=function(){if(ph(Yh,this))throw Xh("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?mh(arguments[0]):void 0,t=Dh(e),r=function(e){this===Kh&&ah(r,rp,e),hh(this,Bh)&&hh(this[Bh],t)&&(this[Bh][t]=!1),op(this,t,gh(1,e))};return dh&&ip&&op(Kh,t,{configurable:!0,set:r}),sp(t,e)},Ch(Yh=zh[Gh],"toString",(function(){return Hh(this).tag})),Ch(zh,"withoutSetter",(function(e){return sp(Dh(e),e)})),Oh.f=dp,Ah.f=ap,Ih.f=cp,bh.f=up,vh.f=yh.f=lp,Rh.f=hp,Lh.f=function(e){return sp(Ph(e),e)},dh&&wh(Yh,"description",{configurable:!0,get:function(){return Hh(this).description}})),oh({global:!0,constructor:!0,wrap:!0,forced:!uh,sham:!uh},{Symbol:zh}),Fh(Sh(np),(function(e){Mh(e)})),oh({target:jh,stat:!0,forced:!uh},{useSetter:function(){ip=!0},useSimple:function(){ip=!1}}),oh({target:"Object",stat:!0,forced:!uh,sham:!dh},{create:function(e,t){return void 0===t?Th(e):cp(Th(e),t)},defineProperty:ap,defineProperties:cp,getOwnPropertyDescriptor:up}),oh({target:"Object",stat:!0,forced:!uh},{getOwnPropertyNames:lp}),Uh(),xh(zh,jh),kh[Bh]=!0;var pp=po&&!!Symbol.for&&!!Symbol.keyFor,fp=ya,_p=eo,Ep=zo,mp=sc,gp=Bo,Tp=pp,Sp=gp("string-to-symbol-registry"),vp=gp("symbol-to-string-registry");fp({target:"Symbol",stat:!0,forced:!Tp},{for:function(e){var t=mp(e);if(Ep(Sp,t))return Sp[t];var r=_p("Symbol")(t);return Sp[t]=r,vp[r]=t,r}});var yp=ya,Rp=zo,bp=To,Ap=vo,Ip=pp,Op=Bo("symbol-to-string-registry");yp({target:"Symbol",stat:!0,forced:!Ip},{keyFor:function(e){if(!bp(e))throw TypeError(Ap(e)+" is not a symbol");if(Rp(Op,e))return Op[e]}});var Cp=ri([].slice),wp=fd,Np=vi,kp=fi,Dp=sc,Pp=ri([].push),Lp=ya,Mp=eo,Up=ui,xp=Ii,Vp=ri,Fp=Zn,Bp=vi,jp=To,Gp=Cp,Wp=function(e){if(Np(e))return e;if(wp(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?Pp(r,i):"number"!=typeof i&&"Number"!=kp(i)&&"String"!=kp(i)||Pp(r,Dp(i))}var o=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(wp(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}},Hp=po,Kp=String,zp=Mp("JSON","stringify"),Yp=Vp(/./.exec),Xp=Vp("".charAt),Jp=Vp("".charCodeAt),Zp=Vp("".replace),qp=Vp(1..toString),$p=/[\uD800-\uDFFF]/g,Qp=/^[\uD800-\uDBFF]$/,ef=/^[\uDC00-\uDFFF]$/,tf=!Hp||Fp((function(){var e=Mp("Symbol")();return"[null]"!=zp([e])||"{}"!=zp({a:e})||"{}"!=zp(Object(e))})),rf=Fp((function(){return'"\\udf06\\ud834"'!==zp("\udf06\ud834")||'"\\udead"'!==zp("\udead")})),nf=function(e,t){var r=Gp(arguments),n=Wp(t);if(Bp(n)||void 0!==e&&!jp(e))return r[1]=function(e,t){if(Bp(n)&&(t=xp(n,this,Kp(e),t)),!jp(t))return t},Up(zp,null,r)},of=function(e,t,r){var n=Xp(r,t-1),i=Xp(r,t+1);return Yp(Qp,e)&&!Yp(ef,i)||Yp(ef,e)&&!Yp(Qp,n)?"\\u"+qp(Jp(e,0),16):e};zp&&Lp({target:"JSON",stat:!0,arity:3,forced:tf||rf},{stringify:function(e,t,r){var n=Gp(arguments),i=Up(tf?nf:zp,null,n);return rf&&"string"==typeof i?Zp(i,$p,of):i}});var sf=sl,af=Wo;ya({target:"Object",stat:!0,forced:!po||Zn((function(){sf.f(1)}))},{getOwnPropertySymbols:function(e){var t=sf.f;return t?t(af(e)):[]}}),Sl("asyncIterator"),Sl("hasInstance"),Sl("isConcatSpreadable"),Sl("iterator"),Sl("match"),Sl("matchAll"),Sl("replace"),Sl("search"),Sl("species"),Sl("split");var cf=Al;Sl("toPrimitive"),cf();var df=eo,uf=Ll;Sl("toStringTag"),uf(df("Symbol"),"Symbol"),Sl("unscopables"),Ll(oi.JSON,"JSON",!0);var lf,hf,pf,ff=Ji.Symbol,_f={},Ef=Ri,mf=zo,gf=Function.prototype,Tf=Ef&&Object.getOwnPropertyDescriptor,Sf=mf(gf,"name"),vf={EXISTS:Sf,PROPER:Sf&&"something"===function(){}.name,CONFIGURABLE:Sf&&(!Ef||Ef&&Tf(gf,"name").configurable)},yf=!Zn((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Rf=zo,bf=vi,Af=Wo,If=yf,Of=Nu("IE_PROTO"),Cf=Object,wf=Cf.prototype,Nf=If?Cf.getPrototypeOf:function(e){var t=Af(e);if(Rf(t,Of))return t[Of];var r=t.constructor;return bf(r)&&t instanceof r?r.prototype:t instanceof Cf?wf:null},kf=Zn,Df=vi,Pf=Xi,Lf=Hu,Mf=Nf,Uf=cl,xf=ss("iterator"),Vf=!1;[].keys&&("next"in(pf=[].keys())?(hf=Mf(Mf(pf)))!==Object.prototype&&(lf=hf):Vf=!0);var Ff=!Pf(lf)||kf((function(){var e={};return lf[xf].call(e)!==e}));Df((lf=Ff?{}:Lf(lf))[xf])||Uf(lf,xf,(function(){return this}));var Bf={IteratorPrototype:lf,BUGGY_SAFARI_ITERATORS:Vf},jf=Bf.IteratorPrototype,Gf=Hu,Wf=Pi,Hf=Ll,Kf=_f,zf=function(){return this},Yf=function(e,t,r,n){var i=t+" Iterator";return e.prototype=Gf(jf,{next:Wf(+!n,r)}),Hf(e,i,!1,!0),Kf[i]=zf,e},Xf=ri,Jf=Ao,Zf=vi,qf=String,$f=TypeError,Qf=function(e,t,r){try{return Xf(Jf(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},e_=Zs,t_=function(e){if("object"==typeof e||Zf(e))return e;throw $f("Can't set "+qf(e)+" as a prototype")},r_=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Qf(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return e_(r),t_(n),t?e(r,n):r.__proto__=n,r}}():void 0),n_=ya,i_=Ii,o_=vf,s_=Yf,a_=Nf,c_=Ll,d_=cl,u_=_f,l_=Bf,h_=o_.PROPER,p_=l_.BUGGY_SAFARI_ITERATORS,f_=ss("iterator"),__="keys",E_="values",m_="entries",g_=function(){return this},T_=function(e,t,r,n,i,o,s){s_(r,t,n);var a,c,d,u=function(e){if(e===i&&_)return _;if(!p_&&e in p)return p[e];switch(e){case __:case E_:case m_:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[f_]||p["@@iterator"]||i&&p[i],_=!p_&&f||u(i),E="Array"==t&&p.entries||f;if(E&&(a=a_(E.call(new e)))!==Object.prototype&&a.next&&(c_(a,l,!0,!0),u_[l]=g_),h_&&i==E_&&f&&f.name!==E_&&(h=!0,_=function(){return i_(f,this)}),i)if(c={values:u(E_),keys:o?_:u(__),entries:u(m_)},s)for(d in c)(p_||h||!(d in p))&&d_(p,d,c[d]);else n_({target:t,proto:!0,forced:p_||h},c);return s&&p[f_]!==_&&d_(p,f_,_,{name:i}),u_[t]=_,c},S_=function(e,t){return{value:e,done:t}},v_=Ki,y_=_f,R_=Zl;Ks.f;var b_=T_,A_=S_,I_="Array Iterator",O_=R_.set,C_=R_.getterFor(I_);b_(Array,"Array",(function(e,t){O_(this,{type:I_,target:v_(e),index:0,kind:t})}),(function(){var e=C_(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,A_(void 0,!0)):A_("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),y_.Arguments=y_.Array;var w_={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},N_=oi,k_=nc,D_=ua,P_=_f,L_=ss("toStringTag");for(var M_ in w_){var U_=N_[M_],x_=U_&&U_.prototype;x_&&k_(x_)!==L_&&D_(x_,L_,M_),P_[M_]=P_.Array}var V_=ff,F_=ss,B_=Ks.f,j_=F_("metadata"),G_=Function.prototype;void 0===G_[j_]&&B_(G_,j_,{value:null}),Sl("dispose"),Sl("metadata");var W_=V_;Sl("asyncDispose");var H_=ri,K_=eo("Symbol"),z_=K_.keyFor,Y_=H_(K_.prototype.valueOf),X_=K_.isRegisteredSymbol||function(e){try{return void 0!==z_(Y_(e))}catch(e){return!1}};ya({target:"Symbol",stat:!0},{isRegisteredSymbol:X_});for(var J_=Bo,Z_=eo,q_=ri,$_=To,Q_=ss,eE=Z_("Symbol"),tE=eE.isWellKnownSymbol,rE=Z_("Object","getOwnPropertyNames"),nE=q_(eE.prototype.valueOf),iE=J_("wks"),oE=0,sE=rE(eE),aE=sE.length;oE<aE;oE++)try{var cE=sE[oE];$_(eE[cE])&&Q_(cE)}catch(e){}var dE=function(e){if(tE&&tE(e))return!0;try{for(var t=nE(e),r=0,n=rE(iE),i=n.length;r<i;r++)if(iE[n[r]]==t)return!0}catch(e){}return!1};ya({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:dE}),Sl("matcher"),Sl("observable"),ya({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:X_}),ya({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:dE}),Sl("metadataKey"),Sl("patternMatch"),Sl("replaceAll");var uE=J(W_),lE=ri,hE=Ia,pE=sc,fE=Gi,_E=lE("".charAt),EE=lE("".charCodeAt),mE=lE("".slice),gE=function(e){return function(t,r){var n,i,o=pE(fE(t)),s=hE(r),a=o.length;return s<0||s>=a?e?"":void 0:(n=EE(o,s))<55296||n>56319||s+1===a||(i=EE(o,s+1))<56320||i>57343?e?_E(o,s):n:e?mE(o,s,s+2):i-56320+(n-55296<<10)+65536}},TE={codeAt:gE(!1),charAt:gE(!0)},SE=TE.charAt,vE=sc,yE=Zl,RE=T_,bE=S_,AE="String Iterator",IE=yE.set,OE=yE.getterFor(AE);RE(String,"String",(function(e){IE(this,{type:AE,string:vE(e),index:0})}),(function(){var e,t=OE(this),r=t.string,n=t.index;return n>=r.length?bE(void 0,!0):(e=SE(r,n),t.index+=e.length,bE(e,!1))}));var CE=J(ll.f("iterator"));function wE(e){return wE="function"==typeof uE&&"symbol"==typeof CE?function(e){return typeof e}:function(e){return e&&"function"==typeof uE&&e.constructor===uE&&e!==uE.prototype?"symbol":typeof e},wE(e)}var NE=J(ll.f("toPrimitive"));function kE(e){var t=function(e,t){if("object"!==wE(e)||null===e)return e;var r=e[NE];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==wE(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===wE(t)?t:String(t)}function DE(e,t,r){return(t=kE(t))in e?hd(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var PE=eo,LE=Ku,ME=sl,UE=Zs,xE=ri([].concat),VE=PE("Reflect","ownKeys")||function(e){var t=LE.f(UE(e)),r=ME.f;return r?xE(t,r(e)):t},FE=zo,BE=VE,jE=yi,GE=Ks,WE=Xi,HE=ua,KE=Error,zE=ri("".replace),YE=String(KE("zxcasd").stack),XE=/\n\s*at [^:]*:[^\n]*/,JE=XE.test(YE),ZE=Pi,qE=!Zn((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",ZE(1,7)),7!==e.stack)})),$E=ua,QE=function(e,t){if(JE&&"string"==typeof e&&!KE.prepareStackTrace)for(;t--;)e=zE(e,XE,"");return e},em=qE,tm=Error.captureStackTrace,rm=_f,nm=ss("iterator"),im=Array.prototype,om=function(e){return void 0!==e&&(rm.Array===e||im[nm]===e)},sm=nc,am=Co,cm=Fi,dm=_f,um=ss("iterator"),lm=function(e){if(!cm(e))return am(e,um)||am(e,"@@iterator")||dm[sm(e)]},hm=Ii,pm=Ao,fm=Zs,_m=vo,Em=lm,mm=TypeError,gm=function(e,t){var r=arguments.length<2?Em(e):t;if(pm(r))return fm(hm(r,e));throw mm(_m(e)+" is not iterable")},Tm=Ii,Sm=Zs,vm=Co,ym=function(e,t,r){var n,i;Sm(e);try{if(!(n=vm(e,"return"))){if("throw"===t)throw r;return r}n=Tm(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return Sm(n),r},Rm=Hs,bm=Ii,Am=Zs,Im=vo,Om=om,Cm=La,wm=ni,Nm=gm,km=lm,Dm=ym,Pm=TypeError,Lm=function(e,t){this.stopped=e,this.result=t},Mm=Lm.prototype,Um=function(e,t,r){var n,i,o,s,a,c,d,u=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),_=Rm(t,u),E=function(e){return n&&Dm(n,"normal",e),new Lm(!0,e)},m=function(e){return l?(Am(e),f?_(e[0],e[1],E):_(e[0],e[1])):f?_(e,E):_(e)};if(h)n=e.iterator;else if(p)n=e;else{if(!(i=km(e)))throw Pm(Im(e)+" is not iterable");if(Om(i)){for(o=0,s=Cm(e);s>o;o++)if((a=m(e[o]))&&wm(Mm,a))return a;return new Lm(!1)}n=Nm(e,i)}for(c=h?e.next:n.next;!(d=bm(c,n)).done;){try{a=m(d.value)}catch(e){Dm(n,"throw",e)}if("object"==typeof a&&a&&wm(Mm,a))return a}return new Lm(!1)},xm=sc,Vm=ya,Fm=ni,Bm=Nf,jm=r_,Gm=function(e,t,r){for(var n=BE(t),i=GE.f,o=jE.f,s=0;s<n.length;s++){var a=n[s];FE(e,a)||r&&FE(r,a)||i(e,a,o(t,a))}},Wm=Hu,Hm=ua,Km=Pi,zm=function(e,t){WE(t)&&"cause"in t&&HE(e,"cause",t.cause)},Ym=function(e,t,r,n){em&&(tm?tm(e,t):$E(e,"stack",QE(r,n)))},Xm=Um,Jm=function(e,t){return void 0===e?arguments.length<2?"":t:xm(e)},Zm=ss("toStringTag"),qm=Error,$m=[].push,Qm=function(e,t){var r,n=Fm(eg,this);jm?r=jm(qm(),n?Bm(this):eg):(r=n?this:Wm(eg),Hm(r,Zm,"Error")),void 0!==t&&Hm(r,"message",Jm(t)),Ym(r,Qm,r.stack,1),arguments.length>2&&zm(r,arguments[2]);var i=[];return Xm(e,$m,{that:i}),Hm(r,"errors",i),r};jm?jm(Qm,qm):Gm(Qm,qm,{name:!0});var eg=Qm.prototype=Wm(qm.prototype,{constructor:Km(1,Qm),message:Km(1,""),name:Km(1,"AggregateError")});Vm({global:!0,constructor:!0,arity:2},{AggregateError:Qm});var tg,rg,ng,ig,og="undefined"!=typeof process&&"process"==fi(process),sg=eo,ag=ul,cg=Ri,dg=ss("species"),ug=ni,lg=TypeError,hg=function(e,t){if(ug(t,e))return e;throw lg("Incorrect invocation")},pg=xd,fg=vo,_g=TypeError,Eg=Zs,mg=function(e){if(pg(e))return e;throw _g(fg(e)+" is not a constructor")},gg=Fi,Tg=ss("species"),Sg=function(e,t){var r,n=Eg(e).constructor;return void 0===n||gg(r=Eg(n)[Tg])?t:mg(r)},vg=TypeError,yg=function(e,t){if(e<t)throw vg("Not enough arguments");return e},Rg=/(?:ipad|iphone|ipod).*applewebkit/i.test(to),bg=oi,Ag=ui,Ig=Hs,Og=vi,Cg=zo,wg=Zn,Ng=Ou,kg=Cp,Dg=Ss,Pg=yg,Lg=Rg,Mg=og,Ug=bg.setImmediate,xg=bg.clearImmediate,Vg=bg.process,Fg=bg.Dispatch,Bg=bg.Function,jg=bg.MessageChannel,Gg=bg.String,Wg=0,Hg={},Kg="onreadystatechange";wg((function(){tg=bg.location}));var zg=function(e){if(Cg(Hg,e)){var t=Hg[e];delete Hg[e],t()}},Yg=function(e){return function(){zg(e)}},Xg=function(e){zg(e.data)},Jg=function(e){bg.postMessage(Gg(e),tg.protocol+"//"+tg.host)};Ug&&xg||(Ug=function(e){Pg(arguments.length,1);var t=Og(e)?e:Bg(e),r=kg(arguments,1);return Hg[++Wg]=function(){Ag(t,void 0,r)},rg(Wg),Wg},xg=function(e){delete Hg[e]},Mg?rg=function(e){Vg.nextTick(Yg(e))}:Fg&&Fg.now?rg=function(e){Fg.now(Yg(e))}:jg&&!Lg?(ig=(ng=new jg).port2,ng.port1.onmessage=Xg,rg=Ig(ig.postMessage,ig)):bg.addEventListener&&Og(bg.postMessage)&&!bg.importScripts&&tg&&"file:"!==tg.protocol&&!wg(Jg)?(rg=Jg,bg.addEventListener("message",Xg,!1)):rg=Kg in Dg("script")?function(e){Ng.appendChild(Dg("script"))[Kg]=function(){Ng.removeChild(this),zg(e)}}:function(e){setTimeout(Yg(e),0)});var Zg={set:Ug,clear:xg},qg=function(){this.head=null,this.tail=null};qg.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 $g,Qg,eT,tT,rT,nT=qg,iT=/ipad|iphone|ipod/i.test(to)&&"undefined"!=typeof Pebble,oT=/web0s(?!.*chrome)/i.test(to),sT=oi,aT=Hs,cT=yi.f,dT=Zg.set,uT=nT,lT=Rg,hT=iT,pT=oT,fT=og,_T=sT.MutationObserver||sT.WebKitMutationObserver,ET=sT.document,mT=sT.process,gT=sT.Promise,TT=cT(sT,"queueMicrotask"),ST=TT&&TT.value;if(!ST){var vT=new uT,yT=function(){var e,t;for(fT&&(e=mT.domain)&&e.exit();t=vT.get();)try{t()}catch(e){throw vT.head&&$g(),e}e&&e.enter()};lT||fT||pT||!_T||!ET?!hT&&gT&&gT.resolve?((tT=gT.resolve(void 0)).constructor=gT,rT=aT(tT.then,tT),$g=function(){rT(yT)}):fT?$g=function(){mT.nextTick(yT)}:(dT=aT(dT,sT),$g=function(){dT(yT)}):(Qg=!0,eT=ET.createTextNode(""),new _T(yT).observe(eT,{characterData:!0}),$g=function(){eT.data=Qg=!Qg}),ST=function(e){vT.head||$g(),vT.add(e)}}var RT=ST,bT=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},AT=oi.Promise,IT="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,OT=!IT&&!og&&"object"==typeof window&&"object"==typeof document,CT=oi,wT=AT,NT=vi,kT=Bs,DT=Rd,PT=ss,LT=OT,MT=IT,UT=co,xT=wT&&wT.prototype,VT=PT("species"),FT=!1,BT=NT(CT.PromiseRejectionEvent),jT=kT("Promise",(function(){var e=DT(wT),t=e!==String(wT);if(!t&&66===UT)return!0;if(!xT.catch||!xT.finally)return!0;if(!UT||UT<51||!/native code/.test(e)){var r=new wT((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[VT]=n,!(FT=r.then((function(){}))instanceof n))return!0}return!t&&(LT||MT)&&!BT})),GT={CONSTRUCTOR:jT,REJECTION_EVENT:BT,SUBCLASSING:FT},WT={},HT=Ao,KT=TypeError,zT=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw KT("Bad Promise constructor");t=e,r=n})),this.resolve=HT(t),this.reject=HT(r)};WT.f=function(e){return new zT(e)};var YT,XT,JT=ya,ZT=og,qT=oi,$T=Ii,QT=cl,eS=Ll,tS=function(e){var t=sg(e);cg&&t&&!t[dg]&&ag(t,dg,{configurable:!0,get:function(){return this}})},rS=Ao,nS=vi,iS=Xi,oS=hg,sS=Sg,aS=Zg.set,cS=RT,dS=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}},uS=bT,lS=nT,hS=Zl,pS=AT,fS=GT,_S=WT,ES="Promise",mS=fS.CONSTRUCTOR,gS=fS.REJECTION_EVENT,TS=hS.getterFor(ES),SS=hS.set,vS=pS&&pS.prototype,yS=pS,RS=vS,bS=qT.TypeError,AS=qT.document,IS=qT.process,OS=_S.f,CS=OS,wS=!!(AS&&AS.createEvent&&qT.dispatchEvent),NS="unhandledrejection",kS=function(e){var t;return!(!iS(e)||!nS(t=e.then))&&t},DS=function(e,t){var r,n,i,o=t.value,s=1==t.state,a=s?e.ok:e.fail,c=e.resolve,d=e.reject,u=e.domain;try{a?(s||(2===t.rejection&&xS(t),t.rejection=1),!0===a?r=o:(u&&u.enter(),r=a(o),u&&(u.exit(),i=!0)),r===e.promise?d(bS("Promise-chain cycle")):(n=kS(r))?$T(n,r,c,d):c(r)):d(o)}catch(e){u&&!i&&u.exit(),d(e)}},PS=function(e,t){e.notified||(e.notified=!0,cS((function(){for(var r,n=e.reactions;r=n.get();)DS(r,e);e.notified=!1,t&&!e.rejection&&MS(e)})))},LS=function(e,t,r){var n,i;wS?((n=AS.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),qT.dispatchEvent(n)):n={promise:t,reason:r},!gS&&(i=qT["on"+e])?i(n):e===NS&&dS("Unhandled promise rejection",r)},MS=function(e){$T(aS,qT,(function(){var t,r=e.facade,n=e.value;if(US(e)&&(t=uS((function(){ZT?IS.emit("unhandledRejection",n,r):LS(NS,r,n)})),e.rejection=ZT||US(e)?2:1,t.error))throw t.value}))},US=function(e){return 1!==e.rejection&&!e.parent},xS=function(e){$T(aS,qT,(function(){var t=e.facade;ZT?IS.emit("rejectionHandled",t):LS("rejectionhandled",t,e.value)}))},VS=function(e,t,r){return function(n){e(t,n,r)}},FS=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,PS(e,!0))},BS=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw bS("Promise can't be resolved itself");var n=kS(t);n?cS((function(){var r={done:!1};try{$T(n,t,VS(BS,r,e),VS(FS,r,e))}catch(t){FS(r,t,e)}})):(e.value=t,e.state=1,PS(e,!1))}catch(t){FS({done:!1},t,e)}}};mS&&(RS=(yS=function(e){oS(this,RS),rS(e),$T(YT,this);var t=TS(this);try{e(VS(BS,t),VS(FS,t))}catch(e){FS(t,e)}}).prototype,(YT=function(e){SS(this,{type:ES,done:!1,notified:!1,parent:!1,reactions:new lS,rejection:!1,state:0,value:void 0})}).prototype=QT(RS,"then",(function(e,t){var r=TS(this),n=OS(sS(this,yS));return r.parent=!0,n.ok=!nS(e)||e,n.fail=nS(t)&&t,n.domain=ZT?IS.domain:void 0,0==r.state?r.reactions.add(n):cS((function(){DS(n,r)})),n.promise})),XT=function(){var e=new YT,t=TS(e);this.promise=e,this.resolve=VS(BS,t),this.reject=VS(FS,t)},_S.f=OS=function(e){return e===yS||undefined===e?new XT(e):CS(e)}),JT({global:!0,constructor:!0,wrap:!0,forced:mS},{Promise:yS}),eS(yS,ES,!1,!0),tS(ES);var jS=ss("iterator"),GS=!1;try{var WS=0,HS={next:function(){return{done:!!WS++}},return:function(){GS=!0}};HS[jS]=function(){return this},Array.from(HS,(function(){throw 2}))}catch(e){}var KS=AT,zS=function(e,t){if(!t&&!GS)return!1;var r=!1;try{var n={};n[jS]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},YS=GT.CONSTRUCTOR||!zS((function(e){KS.all(e).then(void 0,(function(){}))})),XS=Ii,JS=Ao,ZS=WT,qS=bT,$S=Um;ya({target:"Promise",stat:!0,forced:YS},{all:function(e){var t=this,r=ZS.f(t),n=r.resolve,i=r.reject,o=qS((function(){var r=JS(t.resolve),o=[],s=0,a=1;$S(e,(function(e){var c=s++,d=!1;a++,XS(r,t,e).then((function(e){d||(d=!0,o[c]=e,--a||n(o))}),i)})),--a||n(o)}));return o.error&&i(o.value),r.promise}});var QS=ya,ev=GT.CONSTRUCTOR;AT&&AT.prototype,QS({target:"Promise",proto:!0,forced:ev,real:!0},{catch:function(e){return this.then(void 0,e)}});var tv=Ii,rv=Ao,nv=WT,iv=bT,ov=Um;ya({target:"Promise",stat:!0,forced:YS},{race:function(e){var t=this,r=nv.f(t),n=r.reject,i=iv((function(){var i=rv(t.resolve);ov(e,(function(e){tv(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var sv=Ii,av=WT;ya({target:"Promise",stat:!0,forced:GT.CONSTRUCTOR},{reject:function(e){var t=av.f(this);return sv(t.reject,void 0,e),t.promise}});var cv=Zs,dv=Xi,uv=WT,lv=function(e,t){if(cv(e),dv(t)&&t.constructor===e)return t;var r=uv.f(e);return(0,r.resolve)(t),r.promise},hv=ya,pv=AT,fv=GT.CONSTRUCTOR,_v=lv,Ev=eo("Promise"),mv=!fv;hv({target:"Promise",stat:!0,forced:true},{resolve:function(e){return _v(mv&&this===Ev?pv:this,e)}});var gv=Ii,Tv=Ao,Sv=WT,vv=bT,yv=Um;ya({target:"Promise",stat:!0,forced:YS},{allSettled:function(e){var t=this,r=Sv.f(t),n=r.resolve,i=r.reject,o=vv((function(){var r=Tv(t.resolve),i=[],o=0,s=1;yv(e,(function(e){var a=o++,c=!1;s++,gv(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 Rv=Ii,bv=Ao,Av=eo,Iv=WT,Ov=bT,Cv=Um,wv="No one promise resolved";ya({target:"Promise",stat:!0,forced:YS},{any:function(e){var t=this,r=Av("AggregateError"),n=Iv.f(t),i=n.resolve,o=n.reject,s=Ov((function(){var n=bv(t.resolve),s=[],a=0,c=1,d=!1;Cv(e,(function(e){var u=a++,l=!1;c++,Rv(n,t,e).then((function(e){l||d||(d=!0,i(e))}),(function(e){l||d||(l=!0,s[u]=e,--c||o(new r(s,wv)))}))})),--c||o(new r(s,wv))}));return s.error&&o(s.value),n.promise}});var Nv=ya,kv=AT,Dv=Zn,Pv=eo,Lv=vi,Mv=Sg,Uv=lv,xv=kv&&kv.prototype;Nv({target:"Promise",proto:!0,real:!0,forced:!!kv&&Dv((function(){xv.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=Mv(this,Pv("Promise")),r=Lv(e);return this.then(r?function(r){return Uv(t,e()).then((function(){return r}))}:e,r?function(r){return Uv(t,e()).then((function(){throw r}))}:e)}});var Vv=J(Ji.Promise);function Fv(e,t,r,n){var i,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,r,s):i(t,r))||s);return o>3&&s&&Object.defineProperty(t,r,s),s}function Bv(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}class jv extends Ke{constructor(e,t){super(),this._ID=void 0,this._rtpTransceiver=void 0,this._lowRtpTransceiver=void 0,this._hints=[],this._isClosed=!1,this._originMediaStreamTrack=void 0,this._mediaStreamTrack=void 0,this._external={},this._ID=t||_t(8,"track-"),this._originMediaStreamTrack=e,this._mediaStreamTrack=e,Mc(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){if(!e){const e=Kn.reportApiInvoke(null,{name:Je.GET_MEDIA_STREAM_TRACK,options:[],tag:Ze.TRACER});this._mediaStreamTrack&&"string"==typeof this._mediaStreamTrack.label?e.onSuccess(this._mediaStreamTrack.label):e.onSuccess("")}return this._mediaStreamTrack}getRTCRtpTransceiver(t){return t===e.StreamType.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,Uc(this),this.emit(e.LocalTrackEvents.CLOSED),this.removeAllListeners(e.TrackEvents.SEI_RECEIVED)}_updateRtpTransceiver(t,r){if(r===e.StreamType.LOW_STREAM){if(this._lowRtpTransceiver===t)return;this._lowRtpTransceiver=t}else{if(this._rtpTransceiver===t)return;this._rtpTransceiver=t}this.emit(e.TrackEvents.TRANSCEIVER_UPDATED,t,r)}}class Gv extends jv{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),this._enabled=!0,this._muted=!1,this._isExternalTrack=!1,this._isClosed=!1,this._enabledMutex=void 0,this.processor=void 0,this._handleTrackEnded=()=>{this.onTrackEnded()},this._enabledMutex=new Rt("".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,Un.debug("[".concat(this.getTrackId(),"] close")),this.emit(e.TrackInternalEvent.NEED_CLOSE),super.close())}async _updateOriginMediaStreamTrack(t,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._isExternalTrack=n,t!==this._originMediaStreamTrack&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),r&&this._originMediaStreamTrack.stop()),t.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=t,this._muted&&(this._originMediaStreamTrack.enabled=!1),this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await it(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){Un.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(e.LocalTrackEvents.TRACK_ENDED)}stateCheck(e,t){if(Un.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),Ve(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new xe(Le.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print("error",Un);if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new xe(Le.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print("error",Un)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():Vv.resolve([])}}function Wv(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 Hv=window.AudioContext||window.webkitAudioContext;let Kv=null;const zv=new class extends Ke{constructor(){super(...arguments),this.prevState=void 0,this.curState=void 0,this.currentTime=void 0,this.currentTimeStuckAt=void 0,this.interruptDetectorTrack=void 0,this.onLocalAudioTrackMute=()=>{Un.info("ios15-interruption-start"),this.emit(e.AUDIO_CONTEXT_EVENT.IOS_15_16_INTERRUPTION_START)},this.onLocalAudioTrackUnmute=async()=>{Un.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?Un.info("ios15-interruption-end-canceled"):(Kv&&await Kv.suspend(),this.emit(e.AUDIO_CONTEXT_EVENT.IOS_15_16_INTERRUPTION_END))}}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){Un.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){Un.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 Yv(){if(!Hv)return void Un.error("your browser is not support web audio");Un.info("create audio context");const t=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Wv(Object(r),!0).forEach((function(t){DE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Wv(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},bn("WEBAUDIO_INIT_OPTIONS"));Un.debug("audio context init option:",JSON.stringify(t)),Kv=new Hv(t),zv.curState=Kv.state,Kv.onstatechange=()=>{zv.prevState=zv.curState,zv.curState=Kv?Kv.state:void 0;const{prevState:t,curState:r}=zv,n="running"===r,i="interrupted"===r,o="running"===t,s="suspended"===t,a="interrupted"===t,c=_e().osVersion;(ye()||we())&&o&&i&&(Un.info("ios".concat(c,"-interruption-start")),zv.emit(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_START)),(ye()||we())&&(s||a)&&n&&(Un.info("ios".concat(c,"-interruption-end")),zv.emit(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END)),t!==r&&zv.emit(e.AUDIO_CONTEXT_EVENT.STATE_CHANGE,r,t)},setInterval((()=>{var e;const t=null===(e=Kv)||void 0===e?void 0:e.currentTime;if(zv.currentTime!==t)zv.currentTimeStuckAt&&(Un.debug("AudioContext current time resume at ".concat(t)),zv.currentTimeStuckAt=void 0),zv.currentTime=t;else{if(t!==zv.currentTimeStuckAt){Kn.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:Ze.TRACER}).onSuccess(),Un.warning("AudioContext current time stuck at ".concat(t))}zv.currentTimeStuckAt=t}}),5e3),async function(t){const r=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","touchend","keydown","keyup"];let n,i=!1,o=!1,s=!1;function a(e){"running"===t.state?c(!1):ye()||we()?"suspended"===t.state&&(c(!0),e&&t.resume().then(u,u)):"closed"!==t.state&&(c(!0),e&&t.resume().then(u,u))}function c(e){if(i!==e){i=e;for(let t=0,n=r;t<n.length;t+=1){const r=n[t];e?window.addEventListener(r,l,{capture:!0,passive:!0}):window.removeEventListener(r,l,{capture:!0,passive:!0})}}}function d(){a(!0)}function u(){a(!1)}function l(){a(!0)}function h(e){if(!s)if(n.paused)if(e){let e;p(!1),s=!0;try{e=n.play(),e?e.then(f,f):(n.addEventListener("playing",f),n.addEventListener("abort",f),n.addEventListener("error",f))}catch(e){f()}}else p(!0);else p(!1)}function p(e){if(o!==e){o=e;for(let t=0,n=r;t<n.length;t++){const r=n[t];e?window.addEventListener(r,_,{capture:!0,passive:!0}):window.removeEventListener(r,_,{capture:!0,passive:!0})}}}function f(){n.removeEventListener("playing",f),n.removeEventListener("abort",f),n.removeEventListener("error",f),s=!1,h(!1)}function _(){h(!0)}if(ye()){const e=t.createMediaStreamDestination(),r=document.createElement("div");r.innerHTML="<audio x-webkit-airplay='deny'></audio>",n=r.children.item(0),n.controls=!1,n.disableRemotePlayback=!0,n.preload="auto",n.srcObject=e.stream,h(!0)}zv.on(e.AUDIO_CONTEXT_EVENT.STATE_CHANGE,d),a(!1)}(Kv)}function Xv(){if(!Kv){if(Yv(),!Kv)throw new xe(Le.NOT_SUPPORTED,"can not create audio context");return Kv}return Kv}function Jv(){return!!Kv}function Zv(e){if(function(){if(null!==$v)return $v;const e=Xv(),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(),$v=i,i}())return;const t=e.connect,r=e.disconnect;e.connect=(r,n,i)=>{var o;return e._inputNodes||(e._inputNodes=[]),Sc(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?at(e._inputNodes,n):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function qv(e){const t=Xv();return new Vv(((r,n)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{n(new xe(Le.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let $v=null;let Qv=null;function ey(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 ty=Ao,ry=Wo,ny=Vi,iy=La,oy=TypeError,sy=function(e){return function(t,r,n,i){ty(r);var o=ry(t),s=ny(o),a=iy(o),c=e?a-1:0,d=e?-1:1;if(n<2)for(;;){if(c in s){i=s[c],c+=d;break}if(c+=d,e?c<0:a<=c)throw oy("Reduce of empty array with no initial value")}for(;e?c>=0:a>c;c+=d)c in s&&(i=r(i,s[c],c,o));return i}},ay={left:sy(!1),right:sy(!0)},cy=Zn,dy=ay.left,uy=function(e,t){var r=[][e];return!!r&&cy((function(){r.call(null,t||function(){return 1},1)}))};ya({target:"Array",proto:!0,forced:!og&&co>79&&co<83||!uy("reduce")},{reduce:function(e){var t=arguments.length;return dy(this,e,t,t>1?arguments[1]:void 0)}});var ly=Ga("Array").reduce,hy=ni,py=ly,fy=Array.prototype,_y=J((function(e){var t=e.reduce;return e===fy||hy(fy,e)&&t===fy.reduce?py:t}));class Ey{constructor(){this.context=void 0,this.analyserNode=void 0,this.sourceNode=void 0,this.context=Xv(),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||ye()||we()||"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=_y(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){Un.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class my extends Ke{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(),this.outputNode=void 0,this.outputTrack=void 0,this.isPlayed=!1,this.context=void 0,this.audioBufferNode=void 0,this.destNode=void 0,this.audioOutputLevel=0,this.volumeLevelAnalyser=void 0,this._processedNode=void 0,this.playNode=void 0,this.isDestroyed=!1,this.onNoAudioInput=void 0,this.isNoAudioInput=!1,this._noAudioInputCount=0,this.context=Xv(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),Zv(this.outputNode),this.volumeLevelAnalyser=new Ey}startGetAudioBuffer(t){this.audioBufferNode||(this.audioBufferNode=this.context.createScriptProcessor(t),this.outputNode.connect(this.audioBufferNode),this.audioBufferNode.connect(this.context.destination),this.audioBufferNode.onaudioprocess=t=>{this.emit(e.AudioSourceEvents.ON_AUDIO_BUFFER,ey(t))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!Xn().webAudioMediaStreamDest)throw new xe(Le.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&&ct((()=>{zv.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;ye()||we()?"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 ft(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 gy extends my{get isFreeze(){return!1}constructor(t,r,n){var i;if(super(),this.sourceNode=void 0,this.track=void 0,this.clonedTrack=void 0,this.audioElement=void 0,this.isCurrentTrackCloned=!1,this.isRemoteTrack=!1,this.originVolumeLevelAnalyser=void 0,this.rebuildWebAudio=async()=>{if(Un.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 Un.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>Un.info("resume success"))),Un.debug("rebuild web audio because of ios 12 bugs"),this.disconnect();const t=this.track;this.track=this.track.clone(),this.isCurrentTrackCloned?t.stop():this.isCurrentTrackCloned=!0;const r=new MediaStream([this.track]);this.sourceNode=this.context.createMediaStreamSource(r),Zv(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const n=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(n,this.context.currentTime),Zv(this.outputNode),this.emit(e.AudioSourceEvents.UPDATE_SOURCE),this.connect(),this.audioElement.srcObject=r,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()},"audio"!==t.kind)throw new xe(Le.UNEXPECTED_ERROR);this.track=t;const o=new MediaStream([this.track]);if(this.isRemoteTrack=!!r,this.sourceNode=this.context.createMediaStreamSource(o),Zv(this.sourceNode),n){const e=n.clone();e.enabled=!0,this.clonedTrack=e,Un.debug("create an unmuted track ".concat(e.id," from the original track ").concat(n.id," to get the volume"));const t=this.context.createMediaStreamSource(new MediaStream([e]));Zv(t),this.originVolumeLevelAnalyser=new Ey,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=o;const s=_e();r&&s.os===ce.IOS&&Number(null===(i=s.osVersion)||void 0===i?void 0:i.split(".")[0])<15&&(zv.on(e.AUDIO_CONTEXT_EVENT.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(t){this.sourceNode.disconnect(),this.track=t,this.isCurrentTrackCloned=!1;const r=new MediaStream([t]);this.sourceNode=this.context.createMediaStreamSource(r),Zv(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(e.AudioSourceEvents.UPDATE_SOURCE),this.audioElement.srcObject=r}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),zv.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),Un.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]));Zv(r),this.originVolumeLevelAnalyser&&this.originVolumeLevelAnalyser.updateSource(r)}getOriginVolumeLevel(){return this.originVolumeLevelAnalyser?this.originVolumeLevelAnalyser.getVolumeLevel():this.getAccurateVolumeLevel()}}async function Ty(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 Sy(e,t){const r=await vy(e.mediaSource),{sourceId:n,audio:i}=await function(e,t=!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 d=document.createElement("button");d.innerHTML="cancel",d.setAttribute("style","width: 85px;"),d.onclick=()=>{document.body.removeChild(h);const e=new Error("NotAllowedError");e.name="NotAllowedError",n(e)};let u=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=u,e.onchange=()=>{u=e.checked},l.appendChild(e),l.appendChild(t)}c.appendChild(l),c.appendChild(d),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{const{width:e}=n.getSize();e>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:u})},a.appendChild(t)}}))}))}(r,t);return await Ty(n,e,i)}async function vy(e){let t=["window","screen"];"application"!==e&&"window"!==e||(t=["window"]),"screen"===e&&(t=["screen"]);const r=Xe();if(!r)throw console.error("failed to fetch electron, please mount it to window"),new xe(Le.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 Vv(((e,n)=>{r.desktopCapturer.getSources({types:t},((t,r)=>{t?n(t):e(r)}))})));try{return await n}catch(e){throw new xe(Le.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,e.toString())}}function yy(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 Ry=new Rt("safari");async function by(e,t){let r=0,n=null;for(;r<2;)try{n=await Ay(e,t,r>0);break}catch(e){if(e instanceof xe)throw Un.error("[".concat(t,"] ").concat(e.toString())),e;const n=Iy(e.name||e.code||e,e.message);if(n.code===Le.MEDIA_OPTION_INVALID){Un.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await ft(500);continue}throw Un.error("[".concat(t,"] ").concat(n.toString())),n}if(!n)throw new xe(Le.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return n}async function Ay(t,r,n){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new xe(Le.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=Xn(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return Un.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(ze())if(t.screen.sourceId){Oy(o,await Ty(t.screen.sourceId,t.screen,t.screenAudio))}else{Oy(o,await Sy(t.screen,t.screenAudio))}else if(Te()&&t.screen.extensionId&&t.screen.mandatory){if(!i.getStreamFromExtension)throw new xe(Le.NOT_SUPPORTED,"This browser does not support screen sharing");Un.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(a=t.screen.extensionId,c=r,new Vv(((e,t)=>{try{chrome.runtime.sendMessage(a,{getStream:!0},(r=>{if(!r||!r.streamId)return Un.error("[".concat(c,"] No response from Chrome Plugin. Plugin not installed properly"),r),void t(new xe(Le.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)}))}catch(e){Un.error("[".concat(c,"] AgoraRTC screensharing plugin is not accessible(").concat(a,")"),e.toString()),t(new xe(Le.CHROME_PLUGIN_NOT_INSTALL))}})));t.screen.mandatory.chromeMediaSourceId=e;Oy(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(i.getDisplayMedia){var s;t.screen.mediaSource&&Fc(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},{selfBrowserSurface:n,surfaceSwitching:i,systemAudio:a}=t.screen,c={selfBrowserSurface:n,surfaceSwitching:i,systemAudio:a};!n&&delete c.selfBrowserSurface,!i&&delete c.surfaceSwitching,!a&&delete c.systemAudio,Un.debug("[".concat(r,"] getDisplayMedia:"),JSON.stringify({video:e,audio:!!t.screenAudio,controls:c}));const d=await navigator.mediaDevices.getDisplayMedia(function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?yy(Object(r),!0).forEach((function(t){DE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):yy(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({video:e,audio:!!t.screenAudio},c));Oy(o,d)}else{if(!ve())throw Un.error("[".concat(r,"] This browser does not support screenSharing")),new xe(Le.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&Fc(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};Un.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));Oy(o,await navigator.mediaDevices.getUserMedia(e))}}var a,c;if(!t.video&&!t.audio)return o;let d={video:t.video,audio:t.audio},u=bn("MEDIA_DEVICE_CONSTRAINTS");if(u)try{"string"==typeof u&&(u=JSON.parse(u)),d=St(d,u)}catch(e){}Un.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(d)),_e();let l,h=null;(Se()||ye()||ge())&&(h=await Ry.lock());try{l=await navigator.mediaDevices.getUserMedia(d)}catch(e){throw h&&h(),e}return d.audio&&(e.HAS_GUM_AUDIO=!0),d.video&&(e.HAS_GUM_VIDEO=!0),Oy(o,l),h&&h(),o}function Iy(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new xe(Le.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new xe(Le.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new xe(Le.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new xe(Le.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new xe(Le.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new xe(Le.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return Un.error("getUserMedia unexpected error",e),new xe(Le.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function Oy(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 Cy extends Ke{get state(){return this._state}set state(t){t!==this._state&&(this.emit(e.DeviceManagerEvent.STATE_CHANGE,t),this._state=t)}constructor(){super(),this._state=e.DeviceManagerState.IDLE,this.isAccessMicrophonePermission=!1,this.isAccessCameraPermission=!1,this.lastAccessMicrophonePermission=!1,this.lastAccessCameraPermission=!1,this.checkdeviceMatched=!1,this.deviceInfoMap=new Map,this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(bn("ENUMERATE_DEVICES_INTERVAL")||(De()||Ee()===ce.HARMONY_OS)&&ke())&&this.updateDevicesInfo()}),bn("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>Un.error(e.toString())))}async enumerateDevices(t,r){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){return new xe(Le.NOT_SUPPORTED,"enumerateDevices() not supported.").throw()}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,d=null,u=null;if(!n&&(s||a)){if(Ry.isLocked){Un.debug("[device manager] wait GUM lock");(await Ry.lock())(),Un.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(s=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(a=!1,this.isAccessCameraPermission=!0),Un.debug("[device manager] check media device permissions",t,r,s,a),s&&a){try{u=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(e){const t=Iy(e.name||e.code||e,e.message);if(t.code===Le.PERMISSION_DENIED)throw t;Un.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=Iy(e.name||e.code||e,e.message);if(t.code===Le.PERMISSION_DENIED)throw t;Un.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(a){try{d=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=Iy(e.name||e.code||e,e.message);if(t.code===Le.PERMISSION_DENIED)throw t;Un.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}Un.debug("[device manager] mic permission",t,"cam permission",r)}try{const e=await navigator.mediaDevices.enumerateDevices();return c&&c.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),c=null,d=null,u=null,e}catch(e){c&&c.getTracks().forEach((e=>e.stop())),d&&d.getTracks().forEach((e=>e.stop())),u&&u.getTracks().forEach((e=>e.stop())),c=null,d=null,u=null;return new xe(Le.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 xe(Le.DEVICE_NOT_FOUND,"deviceId: ".concat(e));return t}async init(){this.state=e.DeviceManagerState.INITING;try{await this.updateDevicesInfo(),this.state=e.DeviceManagerState.INITEND}catch(t){if(Un.warning("Device Detection functionality cannot start properly.",t.toString()),this.state=e.DeviceManagerState.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname)){new xe(Le.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.").throw()}throw t}}async updateDevicesInfo(){const t=await this.enumerateDevices(!0,!0,!0),r=Date.now(),n=[];if(t[0]&&t[0].label&&!1===this.checkdeviceMatched){this.checkdeviceMatched=!0;const e=t.find((e=>"audioinput"===e.kind&&"default"===e.deviceId)),r=t.find((e=>"audiooutput"===e.kind&&"default"===e.deviceId));e&&r?r.groupId===e.groupId?Un.debug("[device-check] default input ".concat(e.label," and output ").concat(r.label," is the same group")):Un.warning("[device-check] default input ".concat(e.label," and output ").concat(r.label," is not the same group")):Un.debug("[device-check] default input or output not found")}const i=this.checkMediaDeviceInfoIsOk(t);if(t.forEach((e=>{if(!e.deviceId)return;const t=this.deviceInfoMap.get("".concat(e.kind,"_").concat(e.deviceId));if("ACTIVE"!==(t?t.state:"INACTIVE")){const t={initAt:r,updateAt:r,device:e,state:"ACTIVE"};this.deviceInfoMap.set("".concat(e.kind,"_").concat(e.deviceId),t),n.push(t)}t&&(t.updateAt=r)})),this.deviceInfoMap.forEach(((e,t)=>{"ACTIVE"===e.state&&e.updateAt!==r&&(e.state="INACTIVE",n.push(e))})),this.state!==e.DeviceManagerState.INITEND)return i.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),void(i.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0));n.forEach((t=>{switch(t.device.kind){case"audioinput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(e.DeviceManagerEvent.RECORDING_DEVICE_CHANGED,t);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(e.DeviceManagerEvent.CAMERA_DEVICE_CHANGED,t);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(e.DeviceManagerEvent.PLAYOUT_DEVICE_CHANGED,t)}})),i.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),i.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 wy=new Cy;let Ny=!1;const ky=new class extends Ke{constructor(){super(...arguments),this.onAutoplayFailed=void 0,this.onAudioAutoplayFailed=void 0}};function Dy(){if(_e(),!Ny){const e=t=>{t.preventDefault(),Ny=!1,Pe()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};Ny=!0,Pe()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),Un.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),ky.onAutoplayFailed?ky.onAutoplayFailed():ky.onAudioAutoplayFailed?Un.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 ."):Un.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 ."),ky.emit("autoplay-failed")}}function Py(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 Ly(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Py(Object(r),!0).forEach((function(t){DE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Py(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function My(e,t,r,n){if(!e)return;const i=Kn.getBaseInfoBySessionId(e);if(!i)return;const o=i.info,s=Date.now(),a=Ly(Ly({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-i.startTime,cbRegistered:ky.onAutoplayFailed||ky.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:n,extend:void 0});Kn.send({type:Bn.AUTOPLAY_FAILED,data:a},!0)}const Uy=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],xy=new class{constructor(){this.onAutoplayFailed=void 0,this.elementMap=new Map,this.elementStateMap=new Map,this.elementsNeedToResume=[],this.sinkIdMap=new Map,this.autoResumeAfterInterruption=e=>{Array.from(this.elementMap.entries()).forEach((t=>{let[r,n]=t;const i=this.elementStateMap.get(r),o=n.srcObject.getAudioTracks()[0],s=o&&o.readyState;if(Un.debug("resume after interrupted, ele: ".concat(i," audio: ").concat(s," ").concat(e)),"live"===s){if(e)return n.pause(),void n.play();if("running"===zv.curState)return Ie()?(n.pause(),void n.play()):void(i&&"paused"===i&&n.play())}}))},this.autoResumeAfterInterruptionOnIOS15_16=()=>{Array.from(this.elementMap.entries()).forEach((e=>{let[t,r]=e;const n=r.srcObject.getAudioTracks()[0];n&&"live"===n.readyState&&(Un.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))},this.autoResumeAudioElement(),zv.on(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),zv.on(e.AUDIO_CONTEXT_EVENT.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),zv.on(e.AUDIO_CONTEXT_EVENT.STATE_CHANGE,(()=>{ye()&&"suspended"===zv.prevState&&"running"===zv.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 xe(Le.PERMISSION_DENIED,"can not set sink id: "+e.toString())}}play(t,r,n,i){if(this.elementMap.has(r))return;const o=document.createElement("audio");o.autoplay=!0,o.srcObject=new MediaStream([t]),this.bindAudioElementEvents(r,o),this.elementMap.set(r,o),this.elementStateMap.set(r,e.MediaElementStatus.INIT),this.setVolume(r,n);const s=this.sinkIdMap.get(r);if(s)try{o.setSinkId(s).catch((e=>{Un.warning("[".concat(r,"] set sink id failed"),e.toString())}))}catch(e){Un.warning("[".concat(r,"] set sink id failed"),e.toString())}const a=o.play();a&&a.then&&a.catch((e=>{i&&My(i,"audio",e.message,r),Un.warning("audio element play warning",e.toString()),this.elementMap.has(r)&&"NotAllowedError"===e.name&&(Un.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(o),ct((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),Dy()})))}))}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)}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)}bindAudioElementEvents(e,t){Uy.forEach((r=>{t.addEventListener(r,(r=>{const n=this.elementStateMap.get(e),i="pause"===r.type?"paused":r.type;if(Un.debug("[".concat(e,"] audio-element-status change ").concat(n," => ").concat(i)),"error"===r.type){const r=null==t?void 0:t.error;r&&Un.error("[".concat(e,"] media error, code: ").concat(r.code,", message: ").concat(r.message))}this.elementStateMap.set(e,i)}))}))}getPlayerState(e){return this.elementStateMap.get(e)||"uninit"}autoResumeAudioElement(){const e=()=>{this.elementsNeedToResume.forEach((e=>{e.play().then((e=>{Un.debug("Auto resume audio element success")})).catch((e=>{Un.warning("Auto resume audio element failed!",e)}))})),this.elementsNeedToResume=[]};new Promise((e=>{document.body?e():window.addEventListener("load",(()=>e()))})).then((()=>{Pe()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0))}))}};function Vy(){return function(e,t,r){const n=r.value;return"function"==typeof n&&(r.value=function(){this._isClosed&&new xe(Le.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning",Un);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 Vv?new Vv(((e,t)=>{i.then(e).catch(t)})):i}),r}}var Fy=Ga("Array").values,By=nc,jy=zo,Gy=ni,Wy=Fy,Hy=Array.prototype,Ky={DOMTokenList:!0,NodeList:!0},zy=J((function(e){var t=e.values;return e===Hy||Gy(Hy,e)&&t===Hy.values||jy(Ky,By(e))?Wy:t}));function Yy(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 Xy(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Yy(Object(r),!0).forEach((function(t){DE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Yy(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class Jy extends Ke{constructor(e){super(),this.name="VideoProcessorDestination",this.ID="0",this._source=void 0,this.videoContext=void 0,this.inputTrack=void 0,this.videoContext=e}get kind(){return"video"}get enabled(){return!0}pipe(){throw new xe(Le.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}unpipe(){throw new xe(Le.NOT_SUPPORTED,"VideoProcessor cannot unpipe to any other Processor")}enable(){}disable(){}updateInput(t){if(t.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).");t.track&&t.track!==this.inputTrack&&(this.videoContext.chained=!0,this.inputTrack=t.track,this.emit(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK,t.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK,void 0)}}class Zy extends Ke{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),this.constraintsMap=new Map,this.statsRegistry=[],this.usageRegistry=[],this.trackId=void 0,this.direction=void 0,this._chained=!1,this.trackId=e,this.direction=t}async getConstraints(){return await nt(this,e.PROCESSOR_CONTEXT_EVENTS.REQUEST_CONSTRAINTS)}async requestApplyConstraints(t,r){var n;return Un.info("processor ".concat(r.name," requestApplyConstraints for ").concat(this.trackId)),t&&this.constraintsMap.set(r,t),it(this,e.PROCESSOR_CONTEXT_EVENTS.REQUEST_UPDATE_CONSTRAINTS,Array.from(zy(n=this.constraintsMap).call(n)))}async requestRevertConstraints(t){var r;if(this.constraintsMap.has(t))return Un.info("processor ".concat(t.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(t),it(this,e.PROCESSOR_CONTEXT_EVENTS.REQUEST_UPDATE_CONSTRAINTS,Array.from(zy(r=this.constraintsMap).call(r)))}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{processorID:t,processorName:r,type:n,cb:i}of this.statsRegistry)try{const o=i();e.push({processorID:t,processorName:r,type:n,stats:o})}catch(e){Un.error(new xe(Le.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{cb:t}of this.usageRegistry)try{let r=t();r instanceof Vv&&(r=await r),e.push(Xy(Xy({},r),{},{direction:this.direction}))}catch(e){Un.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class qy extends Ke{constructor(e){super(),this.name="AudioProcessorDestination",this.ID="0",this.inputTrack=void 0,this.inputNode=void 0,this.audioProcessorContext=void 0,this._source=void 0,this.audioProcessorContext=e}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new xe(Le.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new xe(Le.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(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK,void 0),this.emit(e.PROCESSOR_DESTINATION_EVENTS.ON_NODE,void 0)}updateInput(t){if(t.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).");t.track&&this.inputTrack!==t.track&&(this.audioProcessorContext.chained=!0,this.inputTrack=t.track,this.emit(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK,this.inputTrack)),t.node&&this.inputNode!==t.node&&(this.audioProcessorContext.chained=!0,this.inputNode=t.node,this.emit(e.PROCESSOR_DESTINATION_EVENTS.ON_NODE,this.inputNode))}}class $y extends Ke{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),this.constraintsMap=new Map,this.statsRegistry=[],this.audioContext=void 0,this.trackId=void 0,this.direction=void 0,this.usageRegistry=[],this._chained=!1,this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return nt(this,e.PROCESSOR_CONTEXT_EVENTS.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(t,r){var n;return Un.info("processor ".concat(r.name," requestApplyConstraints for ").concat(this.trackId)),t&&this.constraintsMap.set(r,t),it(this,e.PROCESSOR_CONTEXT_EVENTS.REQUEST_UPDATE_CONSTRAINTS,Array.from(zy(n=this.constraintsMap).call(n)))}async requestRevertConstraints(t){var r;if(this.constraintsMap.has(t))return this.constraintsMap.delete(t),it(this,e.PROCESSOR_CONTEXT_EVENTS.REQUEST_UPDATE_CONSTRAINTS,Array.from(zy(r=this.constraintsMap).call(r)))}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{processorID:t,processorName:r,type:n,cb:i}of this.statsRegistry)try{const o=i();e.push({processorID:t,processorName:r,type:n,stats:o})}catch(e){Un.error(new xe(Le.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{cb:t}of this.usageRegistry)try{let r=t();r instanceof Vv&&(r=await r),e.push(Xy(Xy({},r),{},{direction:this.direction}))}catch(e){Un.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class Qy extends Ke{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),this.context=void 0,this.processSourceNode=void 0,this.outputTrack=void 0,this.processedNode=void 0,this.clonedTrack=void 0,this.outputNode=void 0,this.outputNode=new eR}setVolume(){}createOutputTrack(){throw new xe(Le.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 eR{disconnect(){}connect(){}}function tR(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 rR(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?tR(Object(r),!0).forEach((function(t){DE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):tR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class nR extends Gv{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?xy.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,n){super(e,r),this.trackMediaType="audio",this._encoderConfig=void 0,this._trackSource=void 0,this._enabled=!0,this._volume=100,this._useAudioElement=!0,this._bypassWebAudio=!1,this.processor=void 0,this._processorContext=void 0,this._processorDestination=void 0,this._getOriginVolumeLevel=void 0,this._encoderConfig=t,this._getOriginVolumeLevel=!!n,this._trackSource=new Qy,bn("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),bn("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);Se()&&!Jv()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(t){Be(t,"volume",0,1e3),this._volume=t,this._source.setVolume(t/100),this._useAudioElement&&xy.setVolume(this.getTrackId(),t);try{if(this._bypassWebAudio)return void Un.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const t=this._source.createOutputTrack();this._mediaStreamTrack!==t&&(this._mediaStreamTrack=t,it(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this).then((()=>{Un.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{Un.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||!Te()&&bn("RESTRICTION_SET_PLAYBACK_DEVICE"))throw new xe(Le.NOT_SUPPORTED,"your browser does not support setting the audio output device");await xy.setSinkID(this.getTrackId(),e)}async setEnabled(e,t,r){return this._setEnabled(e,t,r)}async _setEnabled(t,r,n){if(!n){if(t===this._enabled)return;this.stateCheck("enabled",t)}if(Un.info("[".concat(this.getTrackId(),"] start setEnabled"),t),t){this._originMediaStreamTrack.enabled=!0;try{n||(this._enabled=!0),await it(this,e.TrackInternalEvent.NEED_ENABLE_TRACK,this),Un.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(t," success"))}catch(e){throw n||(this._enabled=!1),Un.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,n||(this._enabled=!1);try{await it(this,e.TrackInternalEvent.NEED_DISABLE_TRACK,this)}catch(e){throw n||(this._enabled=!0),Un.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}}}async setMuted(t){t!==this._muted&&(this.stateCheck("muted",t),this._muted=t,this._originMediaStreamTrack.enabled=!t,Un.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(t)),t?await it(this,e.TrackInternalEvent.NEED_MUTE_TRACK,this):await it(this,e.TrackInternalEvent.NEED_UNMUTE_TRACK,this))}getStats(){ht((()=>{Un.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const t=ot(this,e.TrackInternalEvent.GET_STATS);return t||rR({},Jc)}setAudioFrameCallback(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!t)return this._source.removeAllListeners(e.AudioSourceEvents.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(r),this._source.removeAllListeners(e.AudioSourceEvents.ON_AUDIO_BUFFER),this._source.on(e.AudioSourceEvents.ON_AUDIO_BUFFER,(e=>t(e)))}play(){Un.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(Un.debug("[".concat(this.getTrackId(),"] start audio playback in element")),xy.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){Un.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?xy.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._source.destroy()}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];Un.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&xy.updateTrack(this.getTrackId(),this._mediaStreamTrack)}async _updateOriginMediaStreamTrack(t,r){this._originMediaStreamTrack!==t&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),r&&this._originMediaStreamTrack.stop()),t.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=t,this._muted&&(this._originMediaStreamTrack.enabled=!1),this.processor&&this._processorContext&&this.processor.updateInput({track:t,context:this._processorContext}),this._mediaStreamTrack!==this._source.outputTrack?(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await it(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(t))}renewMediaStreamTrack(e){return Vv.resolve(void 0)}pipe(e){if(this._bypassWebAudio)throw new xe(Le.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new xe(Le.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),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,t.reset()}bindProcessorDestinationEvents(t){t.on(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK,(async t=>{t?t!==this._mediaStreamTrack&&(this._mediaStreamTrack=t,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(t),await it(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await it(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this))})),t.on(e.PROCESSOR_DESTINATION_EVENTS.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(t){t.removeAllListeners(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK),t.removeAllListeners(e.PROCESSOR_DESTINATION_EVENTS.ON_NODE)}bindProcessorContextEvents(t){t.on(e.PROCESSOR_CONTEXT_EVENTS.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(t){t.removeAllListeners(e.PROCESSOR_CONTEXT_EVENTS.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof Qy&&(this._trackSource=new gy(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const t=new $y(this._source.context,this.getTrackId(),"local"),r=new qy(t);return this._processorContext=t,this._processorDestination=r,this.bindProcessorContextEvents(t),this.bindProcessorDestinationEvents(r),this._source.on(e.AudioSourceEvents.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:t})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(xy.stop(this.getTrackId()),this._source.play()),it(this,e.TrackInternalEvent.NEED_REPLACE_MIXING_TRACK,this).then((()=>{Un.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{Un.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:t,processorDestination:r}}}Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),Bv("design:type",Function),Bv("design:paramtypes",[Number]),Bv("design:returntype",void 0)],nR.prototype,"setVolume",null),Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[String]),Bv("design:returntype",Vv)],nR.prototype,"setPlaybackDevice",null),Fv([bt("LocalAudioTrack","_enabledMutex"),Hn({argsMap:(e,t)=>[e.getTrackId(),t]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Boolean,Object,Boolean]),Bv("design:returntype",Vv)],nR.prototype,"setEnabled",null),Fv([bt("LocalAudioTrack","_enabledMutex"),Hn({argsMap:(e,t)=>[e.getTrackId(),t]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Boolean]),Bv("design:returntype",Vv)],nR.prototype,"setMuted",null),Fv([Vy(),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",Object)],nR.prototype,"getStats",null),Fv([Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Object,Number]),Bv("design:returntype",void 0)],nR.prototype,"setAudioFrameCallback",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],nR.prototype,"play",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],nR.prototype,"stop",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],nR.prototype,"close",null),Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),Bv("design:type",Function),Bv("design:paramtypes",[Object]),Bv("design:returntype",Object)],nR.prototype,"pipe",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],nR.prototype,"unpipe",null);class iR extends nR{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,n){super(e,t.encoderConfig?Pc(t.encoderConfig):{},n,bn("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),this._config=void 0,this._deviceName="default",this._constraints=void 0,this._originalConstraints=void 0,this._enabled=!0,this._config=t,this._constraints=r,this._originalConstraints=r,this._deviceName=e.label,"boolean"==typeof t.bypassWebAudio&&(this._bypassWebAudio=t.bypassWebAudio),(Ie()||Oe())&&zv.bindInterruptDetectorTrack(this)}async setDevice(e){if(Un.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await wy.getDeviceById(e),r={};r.audio=rR({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let n=null;try{n=await by(r,this.getTrackId())}catch(e){throw Un.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await by({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 Un.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await wy.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw Un.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Un.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(t,r,n){if(r)return Un.debug("[".concat(this.getTrackId(),"] setEnabled false (do not close microphone)")),await super._setEnabled(t);if(!n){if(t===this._enabled)return;this.stateCheck("enabled",t)}if(Un.info("[".concat(this.getTrackId(),"] start setEnabled"),t),!t){var i;this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),null===(i=this._source.clonedTrack)||void 0===i||i.stop(),n||(this._enabled=!1);try{await it(this,e.TrackInternalEvent.NEED_DISABLE_TRACK,this)}catch(e){throw Un.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const o=rR({},this._constraints),s=wy.searchDeviceIdByName(this._deviceName);s&&!o.deviceId&&(o.deviceId=s);try{n||(this._enabled=!0);const t=await by({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(t.getAudioTracks()[0],!1),await it(this,e.TrackInternalEvent.NEED_ENABLE_TRACK,this)}catch(e){throw n||(this._enabled=!1),Un.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}Un.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(Ie()||Oe())&&zv.unbindInterruptDetectorTrack(this)}onTrackEnded(){if((ye()||we())&&this._enabled&&!this._isClosed&&zv.duringInterruption){const t=async()=>{zv.off(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,t),this._enabled&&!this._isClosed&&(Un.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};zv.on(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,t)}else Un.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(e.LocalTrackEvents.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=wy.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await by({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(t){super.bindProcessorContextEvents(t),t.on(e.PROCESSOR_CONTEXT_EVENTS.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(t){super.unbindProcessorContextEvents(t),t.removeAllListeners(e.PROCESSOR_CONTEXT_EVENTS.REQUEST_UPDATE_CONSTRAINTS)}}Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[String]),Bv("design:returntype",Vv)],iR.prototype,"setDevice",null),Fv([bt("MicrophoneAudioTrack","_enabledMutex"),Hn({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Boolean,Boolean,Boolean]),Bv("design:returntype",Vv)],iR.prototype,"setEnabled",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],iR.prototype,"close",null);class oR extends nR{get __className__(){return"BufferSourceAudioTrack"}constructor(t,r,n,i){super(r.createOutputTrack(),n,i),this.source=void 0,this._bufferSource=void 0,this._useAudioElement=!1,this.source=t,this._bufferSource=r,this._bufferSource.on(e.AudioSourceEvents.AUDIO_SOURCE_STATE_CHANGE,(t=>{this.safeEmit(e.LocalTrackEvents.SOURCE_STATE_CHANGE,t)}));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){Be(e,"speed",0),this._bufferSource.setAudioBufferPlaybackSpeed(e)}}Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Object]),Bv("design:returntype",void 0)],oR.prototype,"startProcessAudioBuffer",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],oR.prototype,"pauseProcessAudioBuffer",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Number]),Bv("design:returntype",void 0)],oR.prototype,"seekAudioBuffer",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],oR.prototype,"resumeProcessAudioBuffer",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],oR.prototype,"stopProcessAudioBuffer",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],oR.prototype,"close",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Number]),Bv("design:returntype",void 0)],oR.prototype,"setAudioBufferPlaybackSpeed",null);class sR extends nR{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=Xv().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,_t(8,"track-mix-")),this.trackList=void 0,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)?(Un.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):Un.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){Un.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}at(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(t){this._rtpTransceiver!==t&&(this._rtpTransceiver=t,this.trackList.forEach((r=>{r instanceof sR?r.emit(e.TrackEvents.TRANSCEIVER_UPDATED,t):r._updateRtpTransceiver(t)})))}}function aR(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=wc(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!Ne()&&r.frameRate&&(t.frameRate=r.frameRate),_e().name===de.EDGE&&"object"==typeof t.frameRate&&(t.frameRate.max=60),ve()&&(t.frameRate={ideal:30,max:30}),t}function cR(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&Te()&&(t.extensionId=e.extensionId);const{displaySurface:r,selfBrowserSurface:n,surfaceSwitching:i,systemAudio:o}=e;(Re(107)||be(107)||Ae(93))&&(r&&(Fe(r,"displaySurface",["browser","window","monitor"]),t.displaySurface=r),n?(Fe(n,"selfBrowserSurface",["exclude","include"]),t.selfBrowserSurface=n):t.selfBrowserSurface="include",i&&(Fe(i,"surfaceSwitching",["exclude","include"]),t.surfaceSwitching=i)),(Re(105)||be(105)||Ae(91))&&o&&(Fe(o,"systemAudio",["exclude","include"]),t.systemAudio=o),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const s=e.encoderConfig?Nc(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:s?s.width:void 0,maxHeight:s?s.height:void 0},s&&(s.frameRate&&("number"==typeof s.frameRate?(t.mandatory.maxFrameRate=s.frameRate,t.mandatory.minFrameRate=s.frameRate):(t.mandatory.maxFrameRate=s.frameRate.max||s.frameRate.ideal||s.frameRate.exact||void 0,t.mandatory.minFrameRate=s.frameRate.min||s.frameRate.ideal||s.frameRate.exact||void 0),t.frameRate=s.frameRate),s.width&&(t.width=s.width),s.height&&(t.height=s.height)),t}function dR(e){const t={};if(Ne()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,Te()&&e.ANS&&(t.googHighpassFilter=e.ANS))),e.encoderConfig){const r=Pc(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),De()&&(t.sampleRate=void 0),t}class uR extends my{set currentState(t){t!==this._currentState&&(this._currentState=t,this.safeEmit(e.AudioSourceEvents.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(),this.audioBuffer=void 0,this.sourceNode=void 0,this.startPlayTime=0,this.startPlayOffset=0,this.pausePlayTime=0,this.options=void 0,this.currentLoopCount=0,this.currentPlaybackSpeed=100,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):Un.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 lR=new Map;const hR=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new Vv(((r,n)=>{t.toBlob((async e=>{if(t.remove(),e){const n=await pR(e);r({buffer:n,width:t.width,height:t.height})}else n(new xe(Le.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},pR=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function fR(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 _R(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fR(Object(r),!0).forEach((function(t){DE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class ER{get videoElementStatus(){return this._videoElementStatus}set videoElementStatus(e){e!==this._videoElementStatus&&(Un.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&&(Un.debug("[".concat(this.trackId,"] video-status change ").concat(this._videoState," => ").concat(e)),this._videoState=e,null===(t=this.onVideoStateChanged)||void 0===t||t.call(this,this.videoState))}constructor(t){this.trackId=void 0,this.config=void 0,this.onFirstVideoFrameDecoded=void 0,this.onVideoStateChanged=void 0,this.freezeTimeCounterList=[],this.renderFreezeAccTime=0,this.isKeepLastFrame=!1,this.timeUpdatedCount=0,this.freezeTime=0,this.playbackTime=0,this.lastTimeUpdatedTime=0,this.autoplayFailed=!1,this.videoTrack=void 0,this.videoElement=void 0,this.cacheVideoElement=void 0,this._videoState=e.VideoState.VideoStateStopped,this.videoElementCheckInterval=void 0,this.videoElementFreezeTimeout=void 0,this._videoElementStatus=e.MediaElementStatus.NONE,this.isGettingVideoDimensions=!1,this.startGetVideoDimensions=()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return Un.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()},this.autoResumeAfterInterruption=()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===zv.curState&&(Un.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(me())),Ce()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))},this.handleVideoEvents=t=>{switch(t.type){case"play":case"playing":this.startGetVideoDimensions(),this.videoElementStatus=e.MediaElementStatus.PLAYING;break;case"loadeddata":if(this.videoState=e.VideoState.VideoStateStarting,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=e.MediaElementStatus.CANPLAY;break;case"stalled":this.videoElementStatus=e.MediaElementStatus.STALLED;break;case"suspend":this.videoElementStatus=e.MediaElementStatus.SUSPEND;break;case"pause":this.videoElementStatus=e.MediaElementStatus.PAUSED,ye()||we()||Se()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(Un.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=e.MediaElementStatus.WAITING;break;case"abort":this.videoElementStatus=e.MediaElementStatus.ABORT;break;case"ended":this.videoElementStatus=e.MediaElementStatus.ENDED;break;case"emptied":this.videoElementStatus=e.MediaElementStatus.EMPTIED;break;case"error":{this.videoElementStatus=e.MediaElementStatus.ERROR;const t=this.videoElement.error;t&&Un.error("[".concat(this.trackId,"] media error, code: ").concat(t.code,", message: ").concat(t.message));break}case"timeupdate":{const e=performance.now();if(this.timeUpdatedCount+=1,this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime,r=this.lastTimeUpdatedTime;if(this.lastTimeUpdatedTime=e,MR.lastVisibleTime<MR.lastHiddenTime||r<MR.lastHiddenTime||r<MR.lastVisibleTime)return;for(t>bn("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}}},this.autoResumeAfterInterruptionOnIOS15_16=()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(Un.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(me())),Ce()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))},this.trackId=t.trackId,this.config=t,t.element instanceof HTMLVideoElement?this.videoElement=t.element:this.videoElement=document.createElement("video"),zv.on(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),zv.on(e.AUDIO_CONTEXT_EVENT.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&&My(e,"video",t.message,this.trackId),"NotAllowedError"===t.name?(Un.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):Un.warning("[".concat(this.trackId,"] play warning: "),t)}));const r=_e();if(("Safari"===r.name&&15===Number(r.version)||Ie())&&t&&t.then){const e=()=>{this.config.mirror&&(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 Un.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 Vv(((n,i)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await pR(e);n({buffer:t,width:r.width,height:r.height})}else i(new xe(Le.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,t<0?.1:t>1?1:t)}))):await hR(e)}destroy(){zv.off(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),zv.off(e.AUDIO_CONTEXT_EVENT.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=e.VideoState.VideoStateStopped}initVideoElement(){if(this.videoElementStatus=e.MediaElementStatus.INIT,!this.videoElementCheckInterval&&(mR.forEach((e=>{this.videoElement.addEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval=window.setInterval((()=>{(function(e){return e!==document.body&&document.body.contains(e)})(this.videoElement)||(this.videoElementStatus=e.MediaElementStatus.DESTROYED)}),1e3),bn("ENABLE_VIDEO_FRAME_CALLBACK"))){var t,r;let n;const i=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",i),this.videoElementFreezeTimeout=window.setTimeout(o,bn("VIDEO_FREEZE_DURATION")))},o=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===e.VideoState.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=e.VideoState.VideoStateFrozen:document.addEventListener("visibilitychange",i))},s=(t,r)=>{if(this.videoElementStatus===e.MediaElementStatus.PLAYING){if(n){const t=r.presentationTime-n.presentationTime;this.videoState===e.VideoState.VideoStateStarting&&(this.videoState=e.VideoState.VideoStateDecoding),this.videoState===e.VideoState.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(o,bn("VIDEO_FREEZE_DURATION"))),t<bn("VIDEO_FREEZE_DURATION")&&this.videoState===e.VideoState.VideoStateFrozen&&(this.videoState=e.VideoState.VideoStateDecoding),t>bn("VIDEO_FREEZE_DURATION")&&MR.lastVisibleTime>=MR.lastHiddenTime&&n.timestamp>MR.lastVisibleTime&&n.timestamp>MR.lastHiddenTime&&(this.renderFreezeAccTime+=t)}n=_R(_R({},r),{},{timestamp:t})}var i,a;bn("ENABLE_VIDEO_FRAME_CALLBACK")&&(null===(i=(a=this.videoElement).requestVideoFrameCallback)||void 0===i||i.call(a,s))};null===(t=(r=this.videoElement).requestVideoFrameCallback)||void 0===t||t.call(r,s)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),De()&&(this.videoElement.poster="noposter");const n=_e();if("Safari"===n.name&&15===Number(n.version)||Ie()||!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,ve()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,ve()&&this.videoElement.load();const i=this.videoElement.play();void 0!==i&&i.catch((e=>{Un.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){mR.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.videoElementStatus=e.MediaElementStatus.NONE}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{Un.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{Un.error(e)})),this.autoplayFailed=!1,Pe()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};Pe()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),Dy()}}const mR=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class gR extends ER{constructor(e){super(e),this.container=void 0,this.slot=void 0,this.slot=e.element,this.updateConfig(e)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;t!==this.slot&&(this.destroy(),this.slot=t),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 hR(e)}destroy(){if(super.destroy(),this.videoElement.remove(),this.videoElement=document.createElement("video"),this.container){try{this.container.remove(),this.slot.removeChild(this.container)}catch(e){}this.container=void 0}}createElements(){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",bn("KEEP_LAST_FRAME")&&this.isKeepLastFrame&&this.videoElement.paused&&this.resetVideoElement(),this.mountedVideoElement()):this.unmountedVideoElement(),this.slot.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}}function TR(e){return new Vv(((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=ye()?"canplay":"playing";i.addEventListener(o,(()=>{const e=i.videoWidth,r=i.videoHeight;!e&&ve()||(n=!0,i.srcObject=null,i.remove(),t([e,r]))})),i.srcObject=new MediaStream([e]),i.play().catch(Et),setTimeout((()=>{n||(i.srcObject=null,i.remove(),t([i.videoWidth,i.videoHeight]))}),4e3)}))}function SR(e,t,r,n,i){const o=bn("BITRATE_ADAPTER_TYPE");if("DEFAULT_BITRATE"===o)return{min:n,max:i};if(void 0===i){var s;const a=Math.floor(200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75));i="STANDARD_BITRATE"===o?4*a:2*a,n=null!==(s=n)&&void 0!==s?s:a}else{var a;n=null!==(a=n)&&void 0!==a?a:Math.floor(i/10)}return{min:n,max:i}}const vR=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 d=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 u,l,h,p,f,_=1732584193,E=-271733879,m=-1732584194,g=271733878;for(u=0;u<d.length;u+=16)l=_,h=E,p=m,f=g,_=o(_,E,m,g,d[u+0],7,-680876936),g=o(g,_,E,m,d[u+1],12,-389564586),m=o(m,g,_,E,d[u+2],17,606105819),E=o(E,m,g,_,d[u+3],22,-1044525330),_=o(_,E,m,g,d[u+4],7,-176418897),g=o(g,_,E,m,d[u+5],12,1200080426),m=o(m,g,_,E,d[u+6],17,-1473231341),E=o(E,m,g,_,d[u+7],22,-45705983),_=o(_,E,m,g,d[u+8],7,1770035416),g=o(g,_,E,m,d[u+9],12,-1958414417),m=o(m,g,_,E,d[u+10],17,-42063),E=o(E,m,g,_,d[u+11],22,-1990404162),_=o(_,E,m,g,d[u+12],7,1804603682),g=o(g,_,E,m,d[u+13],12,-40341101),m=o(m,g,_,E,d[u+14],17,-1502002290),E=o(E,m,g,_,d[u+15],22,1236535329),_=s(_,E,m,g,d[u+1],5,-165796510),g=s(g,_,E,m,d[u+6],9,-1069501632),m=s(m,g,_,E,d[u+11],14,643717713),E=s(E,m,g,_,d[u+0],20,-373897302),_=s(_,E,m,g,d[u+5],5,-701558691),g=s(g,_,E,m,d[u+10],9,38016083),m=s(m,g,_,E,d[u+15],14,-660478335),E=s(E,m,g,_,d[u+4],20,-405537848),_=s(_,E,m,g,d[u+9],5,568446438),g=s(g,_,E,m,d[u+14],9,-1019803690),m=s(m,g,_,E,d[u+3],14,-187363961),E=s(E,m,g,_,d[u+8],20,1163531501),_=s(_,E,m,g,d[u+13],5,-1444681467),g=s(g,_,E,m,d[u+2],9,-51403784),m=s(m,g,_,E,d[u+7],14,1735328473),E=s(E,m,g,_,d[u+12],20,-1926607734),_=a(_,E,m,g,d[u+5],4,-378558),g=a(g,_,E,m,d[u+8],11,-2022574463),m=a(m,g,_,E,d[u+11],16,1839030562),E=a(E,m,g,_,d[u+14],23,-35309556),_=a(_,E,m,g,d[u+1],4,-1530992060),g=a(g,_,E,m,d[u+4],11,1272893353),m=a(m,g,_,E,d[u+7],16,-155497632),E=a(E,m,g,_,d[u+10],23,-1094730640),_=a(_,E,m,g,d[u+13],4,681279174),g=a(g,_,E,m,d[u+0],11,-358537222),m=a(m,g,_,E,d[u+3],16,-722521979),E=a(E,m,g,_,d[u+6],23,76029189),_=a(_,E,m,g,d[u+9],4,-640364487),g=a(g,_,E,m,d[u+12],11,-421815835),m=a(m,g,_,E,d[u+15],16,530742520),E=a(E,m,g,_,d[u+2],23,-995338651),_=c(_,E,m,g,d[u+0],6,-198630844),g=c(g,_,E,m,d[u+7],10,1126891415),m=c(m,g,_,E,d[u+14],15,-1416354905),E=c(E,m,g,_,d[u+5],21,-57434055),_=c(_,E,m,g,d[u+12],6,1700485571),g=c(g,_,E,m,d[u+3],10,-1894986606),m=c(m,g,_,E,d[u+10],15,-1051523),E=c(E,m,g,_,d[u+1],21,-2054922799),_=c(_,E,m,g,d[u+8],6,1873313359),g=c(g,_,E,m,d[u+15],10,-30611744),m=c(m,g,_,E,d[u+6],15,-1560198380),E=c(E,m,g,_,d[u+13],21,1309151649),_=c(_,E,m,g,d[u+4],6,-145523070),g=c(g,_,E,m,d[u+11],10,-1120210379),m=c(m,g,_,E,d[u+2],15,718787259),E=c(E,m,g,_,d[u+9],21,-343485551),_=n(_,l),E=n(E,h),m=n(m,p),g=n(g,f);return r(_)+r(E)+r(m)+r(g)}(""+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))};function yR(e,t){if("VideoFrame"in window&&"TransformStream"in window&&Xn().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 d=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(d).pipeTo(n.writable),n}}function RR(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 bR(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?RR(Object(r),!0).forEach((function(t){DE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):RR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class AR extends Gv{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==e.MediaElementStatus.PLAYING)}get processorContext(){return this._processorContext}set processorContext(e){this._processorContext=e}get __className__(){return"LocalVideoTrack"}constructor(t,r,n,i,o,s){if(super(t,o),this.trackMediaType="video",this._player=void 0,this.isUseScaleResolutionDownBy=!1,this._videoVisibleTimer=null,this._statsTimer=null,this._previousVideoVisibleStatus=void 0,this._clearPreviousVideoVisibleStatus=()=>this._previousVideoVisibleStatus=void 0,this._encoderConfig=void 0,this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1},this._optimizationMode=void 0,this._videoHeight=void 0,this._videoWidth=void 0,this._forceBitrateLimit=void 0,this._enabled=!0,this.processorDestination=void 0,this._processorContext=void 0,Se()){const{width:e,height:r}=t.getSettings();this._videoWidth=e,this._videoHeight=r}else this.updateMediaStreamTrackResolution();if(this._encoderConfig=r,this._scalabilityMode=n,this._optimizationMode=i,this._hints=s||[],-1===this._hints.indexOf(e.TrackHint.SCREEN_TRACK))this.updateBitrateFromProfile();else if(function(e,t,r){const n=_e();return!(n.name!==e||!n.osVersion)&&(r?Number(n.version)>=t&&Number(n.version)<=r:Number(n.version)===t)}(de.CHROME,115)&&-1!==Ee().indexOf("Windows")){const e=yR(t);e&&(Un.info("local screen video track begin to inject frame"),this._mediaStreamTrack=e)}r&&-1!==this._hints.indexOf(e.TrackHint.CUSTOM_TRACK)&&this.setEncoderConfiguration(r),this._processorContext=new Zy(this.getTrackId(),"local"),this.processorDestination=new Jy(this.processorContext),this.bindProcessorDestinationEvents()}play(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t){const e=document.getElementById(t);e?t=e:(Un.warning("[".concat(this.getTrackId(),'] can not find "#').concat(t,'" element, use document.body')),t=document.body)}Un.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(r));const n=bR(bR(bR({},this._getDefaultPlayerConfig()),r),{},{trackId:this.getTrackId(),element:t});this._player?this._player.updateConfig(n):(t instanceof HTMLVideoElement?this._player=new ER(n):this._player=new gR(n),this._player.updateVideoTrack(this._mediaStreamTrack)),this._player.play(),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const t=this.getVideoElementVisibleStatus();this.safeEmit(e.LocalTrackEvents.VIDEO_ELEMENT_VISIBLE_STATUS,t)}catch(e){}}),bn("CHECK_VIDEO_VISIBLE_INTERVAL"))}stop(){this._player&&(this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._statsTimer&&(this.isUseScaleResolutionDownBy=!1,window.clearInterval(this._statsTimer),this._statsTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(),this._player=void 0,Un.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(t,r){if(!r){if(t===this._enabled)return;this.stateCheck("enabled",t)}if(Un.info("[".concat(this.getTrackId(),"] start setEnabled"),t),!t){this._originMediaStreamTrack.enabled=!1;try{await it(this,e.TrackInternalEvent.NEED_DISABLE_TRACK,this)}catch(e){throw Un.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return r||(this._enabled=!1),void Un.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await it(this,e.TrackInternalEvent.NEED_ENABLE_TRACK,this)}catch(e){throw Un.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}Un.info("[".concat(this.getTrackId(),"] setEnabled to true success")),r||(this._enabled=!0)}async setMuted(t){t!==this._muted&&(this.stateCheck("muted",t),this._muted=t,this._originMediaStreamTrack.enabled=!t,Un.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(t)),t?await it(this,e.TrackInternalEvent.NEED_MUTE_TRACK,this):await it(this,e.TrackInternalEvent.NEED_UNMUTE_TRACK,this))}async setEncoderConfiguration(t,r){if(!this._enabled)throw new xe(Le.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");if("720p_auto"===t?this.startMonitorStats():this._statsTimer&&(window.clearInterval(this._statsTimer),this._statsTimer=null),t=wc(t),this._forceBitrateLimit&&(t.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:t.bitrateMax,t.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:t.bitrateMin),t.width||t.height||t.frameRate){const e=aR({encoderConfig:t});(Se()||ye()||we())&&(e.deviceId=void 0),Un.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(t),JSON.stringify(e));try{await this._originMediaStreamTrack.applyConstraints(e),this.updateMediaStreamTrackResolution()}catch(e){const t=new xe(Le.UNEXPECTED_ERROR,e.toString());throw Un.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=t,-1===this._hints.indexOf(e.TrackHint.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await it(this,e.TrackInternalEvent.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Un)}}getStats(){ht((()=>{Un.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const t=ot(this,e.TrackInternalEvent.GET_STATS);return t||bR({},Zc)}async setBeautyEffect(e){Un.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 hR(e)}async setBitrateLimit(t){if(Un.debug("[".concat(this.getTrackId(),"] set bitrate limit, ").concat(JSON.stringify(t))),t){this._forceBitrateLimit=t,this._encoderConfig&&(this._encoderConfig.bitrateMax?this._encoderConfig.bitrateMax=this._encoderConfig.bitrateMax<t.max_bitrate?this._encoderConfig.bitrateMax:t.max_bitrate:this._encoderConfig.bitrateMax=t.max_bitrate,this._encoderConfig.bitrateMin,this._encoderConfig.bitrateMin=t.min_bitrate);try{await it(this,e.TrackInternalEvent.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Un)}}}async setOptimizationMode(t){if("motion"!==t&&"detail"!==t&&"balanced"!==t)return void Un.error(Le.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const r=this._optimizationMode;try{this._optimizationMode=t,await it(this,e.TrackInternalEvent.SET_OPTIMIZATION_MODE,this)}catch(e){throw this._optimizationMode=r,Un.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}Un.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(t,")"))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return Un.error(Le.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,Un.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){TR(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(Et)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}async setSenderConfiguration(t){if(!this._enabled)throw new xe(Le.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");Un.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(t)),t=wc(t),this._forceBitrateLimit&&(t.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:t.bitrateMax,t.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:t.bitrateMin),this._encoderConfig=t,-1===this._hints.indexOf(e.TrackHint.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await it(this,e.TrackInternalEvent.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Un)}}updateBitrateFromProfile(){if(!this._encoderConfig)return;const{width:e,height:t,frameRate:r}=this.getMediaStreamTrackSettings();if(!e||!t||!r)return;const{bitrateMax:n,bitrateMin:i}=this._encoderConfig;if(null==i||null==n){const{max:o,min:s}=SR(e,t,r,i,n);this._encoderConfig.bitrateMin=s,this._encoderConfig.bitrateMax=o,Un.debug("[".concat(this.getTrackId(),"] update bitrate from profile, [w: ").concat(e,", h: ").concat(t,", fps: ").concat(r,"] => [brMax: ").concat(o,", brMin: ").concat(s,"]"))}}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},{element:i,slot:o}=n;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=We.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Kn.reportApiInvoke(null,{tag:Ze.TRACER,name:Je.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 xe(Le.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}async renewMediaStreamTrack(e){}pipe(e){if(this.processor===e)return e;if(e._source)throw new xe(Le.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),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,e.reset()}close(){super.close(),this.unbindProcessorDestinationEvents(),this.unbindProcessorContextEvents(),this.unpipe(),this.processorDestination._source&&this.processorDestination._source.unpipe()}clone(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this._encoderConfig;e&&(r=bR(bR({},r),wc(e))),r=ut(r);const n=_t(8,"track-video-cloned-"),i=new AR(t?this._mediaStreamTrack.clone():this._mediaStreamTrack,r,ut(this._scalabilityMode),this._optimizationMode,n,ut(this._hints));return e&&r&&i.setEncoderConfiguration(r),Un.debug("clone video track from ".concat(this.getTrackId()," to ").concat(n,", clone ").concat(t)),i}async replaceTrack(e,t){if(!(e instanceof MediaStreamTrack))throw new xe(Le.INVALID_PARAMS,"track should be an instance of MediaStreamTrack");if("video"!==e.kind)throw new xe(Le.INVALID_PARAMS,"track should be a video MediaStreamTrack");await this._updateOriginMediaStreamTrack(e,t,!0),this.updateMediaStreamTrackResolution()}startMonitorStats(){if(!Se()&&!ye())return;this._statsTimer&&window.clearInterval(this._statsTimer);let t=2,r=Ic[t];let n=-1;let i=Date.now();const o=e=>{e>2||e<0||(i=Date.now(),r=Ic[e],this.setSenderConfiguration(r))};this.isUseScaleResolutionDownBy=!0,this._statsTimer=window.setInterval((()=>{const s=this.getStats(),a=ot(this,e.TrackInternalEvent.GET_RTC_STATS);if(s.sendPackets>0&&a){-1===n&&(n=Date.now());const e=Date.now();if(e-n<1e3||e-i<bn("PROFILE_SWITCH_INTERVAL"))return;const c=s.sendFrameRate,d=.6*r.frameRate,u=.9*r.frameRate;"number"==typeof c&&c>0&&c<d?t>0&&(t--,o(t),Un.debug("[".concat(this.getTrackId(),"] step down for fps ").concat(c,", switchProfile to ").concat(t))):a.OutgoingAvailableBandwidth<r.bitrateMin?t>0&&(t--,o(t),Un.debug("[".concat(this.getTrackId(),"] step down for OutgoingAvailableBandwidth ").concat(a.OutgoingAvailableBandwidth,", bitrateMin ").concat(r.bitrateMin,", switchProfile to ").concat(t))):"number"==typeof c&&c>u&&t<Ic.length-1&&a.OutgoingAvailableBandwidth>1.2*Ic[t+1].bitrateMin&&(t++,o(t),Un.debug("[".concat(this.getTrackId(),"] step up for fps ").concat(c,", OutgoingAvailableBandwidth ").concat(a.OutgoingAvailableBandwidth,", switchProfile to ").concat(t)))}}),bn("CHECK_LOCAL_STATS_INTERVAL"))}sendSeiData(e){if(ht((()=>{Kn.reportApiInvoke(null,{name:Je.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:Ze.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!bn("ENABLE_VIDEO_SEI")||!bn("ENABLE_ENCODED_TRANSFORM"))return void Un.warning('To send/receive SEI, please call AgoraRTC.setParameter("ENABLE_VIDEO_SEI", true) before instantiate IAgoraRtcClient');if(e instanceof Uint8Array==!1)return new xe(Le.INVALID_PARAMS,"Invalid argument type, ILocalVideoTrack.sendSeiData() only accept Uint8Array argument.").throw();const t=this.getRTCRtpTransceiver();if(!t)return void Un.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?this.safeEmit("sei-to-send",e):Un.warning("SEI is not supported by ".concat(n))}bindProcessorDestinationEvents(){this.processorDestination.on(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK,(async t=>{t?t!==this._mediaStreamTrack&&(this._mediaStreamTrack=t,this._updatePlayerSource(),await it(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await it(this,e.TrackInternalEvent.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(e.PROCESSOR_CONTEXT_EVENTS.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(e.PROCESSOR_CONTEXT_EVENTS.REQUEST_CONSTRAINTS)}}Fv([Hn({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Object,Object]),Bv("design:returntype",void 0)],AR.prototype,"play",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],AR.prototype,"stop",null),Fv([bt("LocalVideoTrack","_enabledMutex"),Hn({argsMap:(e,t)=>[e.getTrackId(),t]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Boolean,Boolean]),Bv("design:returntype",Vv)],AR.prototype,"setEnabled",null),Fv([bt("LocalVideoTrack","_enabledMutex"),Hn({argsMap:(e,t)=>[e.getTrackId(),t]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Boolean]),Bv("design:returntype",Vv)],AR.prototype,"setMuted",null),Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Object,Boolean]),Bv("design:returntype",Vv)],AR.prototype,"setEncoderConfiguration",null),Fv([Vy(),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",Object)],AR.prototype,"getStats",null),Fv([Hn({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Boolean,Object]),Bv("design:returntype",Vv)],AR.prototype,"setBeautyEffect",null),Fv([Vy(),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",ImageData)],AR.prototype,"getCurrentFrameData",null),Fv([Vy(),Bv("design:type",Function),Bv("design:paramtypes",[String,Number]),Bv("design:returntype",Vv)],AR.prototype,"getCurrentFrameImage",null),Fv([Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Object]),Bv("design:returntype",Vv)],AR.prototype,"setBitrateLimit",null),Fv([Vy(),Bv("design:type",Function),Bv("design:paramtypes",[String]),Bv("design:returntype",Vv)],AR.prototype,"setOptimizationMode",null),Fv([Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Object]),Bv("design:returntype",void 0)],AR.prototype,"setScalabiltyMode",null),Fv([Vy(),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],AR.prototype,"updateMediaStreamTrackResolution",null),Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),Bv("design:type",Function),Bv("design:paramtypes",[Object]),Bv("design:returntype",Object)],AR.prototype,"pipe",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],AR.prototype,"unpipe",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],AR.prototype,"close",null),Fv([Hn({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),Bv("design:type",Function),Bv("design:paramtypes",[MediaStreamTrack,Boolean]),Bv("design:returntype",Vv)],AR.prototype,"replaceTrack",null),Fv([Hn(),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],AR.prototype,"startMonitorStats",null);class IR extends AR{get __className__(){return"CameraVideoTrack"}constructor(t,r,n,i,o,s){super(t,wc(r.encoderConfig),i,o,s),this._config=void 0,this._originalConstraints=void 0,this._constraints=void 0,this._enabled=!0,this._deviceName="default",this.tryResumeVideoForIOS15_16WeChat=async()=>{!Ie()&&!Oe()||function(){const e=_e();if(e.os!==ce.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()||_e().name!==de.WECHAT||!this._enabled||this._isClosed||(Un.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS 15 device on WeChat.")),await this.renewMediaStreamTrack())},this._config=r,this._originalConstraints=n,this._constraints=n,this._deviceName=t.label,this._encoderConfig=wc(this._config.encoderConfig),zv.on(e.AUDIO_CONTEXT_EVENT.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),zv.on(e.AUDIO_CONTEXT_EVENT.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(Un.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await wy.getDeviceById(e),r={};r.video=bR({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let n=null;try{n=await by(r,this.getTrackId())}catch(e){throw Un.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await by({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 Un.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await wy.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw Un.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}Un.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){Un.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:bR(bR({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await by(t,this.getTrackId())}catch(t){throw Un.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await by({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=bR({},t.video),Un.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(t,r){if(!r){if(t===this._enabled)return;this.stateCheck("enabled",t)}if(Un.info("[".concat(this.getTrackId(),"] start setEnabled"),t),t){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await by({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await it(this,e.TrackInternalEvent.NEED_ENABLE_TRACK,this)}catch(e){throw Un.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),Un.info("[".concat(this.getTrackId(),"] setEnabled to true success")),r||(this._enabled=!0)}else{this.isExternalTrack?this._originMediaStreamTrack.enabled=!1:(this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop()),r||(this._enabled=!1);try{await it(this,e.TrackInternalEvent.NEED_DISABLE_TRACK,this)}catch(e){throw Un.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}Un.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}}async setEncoderConfiguration(t,r){if(!this._enabled)throw new xe(Le.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");"720p_auto"===t?this.startMonitorStats():this._statsTimer&&(window.clearInterval(this._statsTimer),this._statsTimer=null),t=wc(t),this._forceBitrateLimit&&(t.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:t.bitrateMax,t.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:t.bitrateMin);const n=dt(this._config);n.encoderConfig=t;const i=aR(n);(Se()||ye()||we())&&(i.deviceId=void 0),Un.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(t),JSON.stringify(i));try{await this._originMediaStreamTrack.applyConstraints(i),this.updateMediaStreamTrackResolution()}catch(e){const t=new xe(Le.UNEXPECTED_ERROR,e.toString());throw Un.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}this._config=n,this._constraints=i,this._originalConstraints=i,this._encoderConfig=t,-1===this._hints.indexOf(e.TrackHint.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await it(this,e.TrackInternalEvent.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(Un)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((ye()||we())&&this._enabled&&!this._isClosed&&zv.duringInterruption){const t=async()=>{zv.off(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,t),this._enabled&&!this._isClosed&&(Un.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};zv.on(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,t)}else Un.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(e.LocalTrackEvents.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=wy.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await by({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),zv.off(e.AUDIO_CONTEXT_EVENT.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),zv.off(e.AUDIO_CONTEXT_EVENT.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=this._encoderConfig;e&&(r=bR(bR({},r),wc(e))),r=ut(r);const n=_t(8,"track-cam-cloned-"),i=new IR(t?this._mediaStreamTrack.clone():this._mediaStreamTrack,ut(bR(bR({},this._config),{},{encoderConfig:r})),ut(this._constraints),ut(this._scalabilityMode),this._optimizationMode,n);return e&&r&&i.setEncoderConfiguration(r),Un.debug("clone track from ".concat(this.getTrackId()," to ").concat(n,", clone ").concat(t)),i}bindProcessorContextEvents(){this.processorContext.on(e.PROCESSOR_CONTEXT_EVENTS.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(e.PROCESSOR_CONTEXT_EVENTS.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}}function OR(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 CR(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?OR(Object(r),!0).forEach((function(t){DE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):OR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function wR(e,t,r,n){r.optimizationMode&&(n&&n.width&&n.height?(r.encoderConfig=CR(CR({},n),{},{bitrateMin:n.bitrateMin,bitrateMax:n.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?Un.debug("[".concat(e,"] set content hint to"),r.optimizationMode):Un.debug("[".concat(e,"] set content hint failed")))):Un.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}function NR(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 kR(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?NR(Object(r),!0).forEach((function(t){DE(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NR(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Object]),Bv("design:returntype",Vv)],IR.prototype,"setDevice",null),Fv([bt("CameraVideoTrack","_enabledMutex"),Hn({argsMap:(e,t)=>[e.getTrackId(),t]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Boolean,Boolean]),Bv("design:returntype",Vv)],IR.prototype,"setEnabled",null),Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t]}),Vy(),Bv("design:type",Function),Bv("design:paramtypes",[Object,Boolean]),Bv("design:returntype",Vv)],IR.prototype,"setEncoderConfiguration",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],IR.prototype,"close",null);class DR extends jv{getUserId(){return this._userId}constructor(e,t,r,n){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(n.clientId,"_").concat(_t(5,""))),this._userId=void 0,this._uintId=void 0,this._isDestroyed=!1,this.store=void 0,this.processor=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,Un.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}class PR extends DR{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==e.MediaElementStatus.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,n){super(e,t,r,n),this._videoVisibleTimer=null,this._previousVideoVisibleStatus=void 0,this._clearPreviousVideoVisibleStatus=()=>this._previousVideoVisibleStatus=void 0,this.trackMediaType="video",this._videoWidth=void 0,this._videoHeight=void 0,this._player=void 0,this.processorDestination=void 0,this.processorContext=void 0,this.updateMediaStreamTrackResolution(),this.processorContext=new Zy(this.getTrackId(),"remote"),this.processorDestination=new Jy(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){ht((()=>{Un.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return ot(this,e.TrackInternalEvent.GET_STATS)||kR({},$c)}play(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof t){const e=document.getElementById(t);e?t=e:(Un.warning("[".concat(this.getTrackId(),'] can not find "#').concat(t,'" element, use document.body')),t=document.body)}Un.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(r));const n=kR(kR({fit:"cover"},r),{},{trackId:this.getTrackId(),element:t});this._player?this._player.updateConfig(n):(t instanceof HTMLVideoElement?this._player=new ER(n):this._player=new gR(n),this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(e.RemoteTrackEvents.FIRST_FRAME_DECODED)},this._player.onVideoStateChanged=t=>{this.safeEmit(e.RemoteTrackEvents.VIDEO_STATE_CHANGED,t)}),this._player.play(this.store.sessionId||void 0),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const t=this.getVideoElementVisibleStatus();this.safeEmit(e.RemoteTrackEvents.VIDEO_ELEMENT_VISIBLE_STATUS,t)}catch(e){}}),bn("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,Un.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){TR(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(Et)}_updatePlayerSource(){Un.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},{element:i,slot:o}=n;if(this.isPlaying&&i instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=We.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Kn.reportApiInvoke(null,{tag:Ze.TRACER,name:Je.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 xe(Le.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}pipe(e){if(this.processor===e)return e;if(e._source)throw new xe(Le.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),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,e.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(e.PROCESSOR_DESTINATION_EVENTS.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(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK)}_destroy(){super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(t){this.emit(e.TrackEvents.SEI_RECEIVED,t)}}Fv([Hn({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),Bv("design:type",Function),Bv("design:paramtypes",[Object,Object]),Bv("design:returntype",void 0)],PR.prototype,"play",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],PR.prototype,"stop",null),Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),Bv("design:type",Function),Bv("design:paramtypes",[Object]),Bv("design:returntype",Object)],PR.prototype,"pipe",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],PR.prototype,"unpipe",null);class LR extends DR{get isPlaying(){return this._useAudioElement?xy.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(t,r,n,i){super(t,r,n,i),this.trackMediaType="audio",this._source=void 0,this._useAudioElement=!0,this._volume=100,this.processorContext=void 0,this.processorDestination=void 0,this._played=!1,this._bypassWebAudio=!1,bn("DISABLE_WEBAUDIO")?(this._source=new Qy,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new gy(t,!0),bn("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once(e.AudioSourceEvents.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(e.RemoteTrackEvents.FIRST_FRAME_DECODED)})),this.processorContext=new $y(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new qy(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(e.AudioSourceEvents.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:this.processorContext})}))}setAudioFrameCallback(t){let r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!t)return this._source.removeAllListeners(e.AudioSourceEvents.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(r),this._source.removeAllListeners(e.AudioSourceEvents.ON_AUDIO_BUFFER),this._source.on(e.AudioSourceEvents.ON_AUDIO_BUFFER,(e=>t(e)))}setVolume(e){this._volume=e,this._useAudioElement?xy.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!Te()&&bn("RESTRICTION_SET_PLAYBACK_DEVICE"))throw new xe(Le.NOT_SUPPORTED,"your browser does not support setting the audio output device");await xy.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getStats(){ht((()=>{Un.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return ot(this,e.TrackInternalEvent.GET_STATS)||kR({},qc)}play(){Un.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement?(Un.debug("[".concat(this.getTrackId(),"] use audio element to play")),xy.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):this._source.play()}stop(){Un.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?xy.stop(this.getTrackId()):this._source.stop()}_destroy(){super._destroy(),this._played=!1,this.unbindProcessorDestinationEvents(),this._source.destroy()}_isFreeze(){return this._source.isFreeze}_updatePlayerSource(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];Un.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&xy.updateTrack(this.getTrackId(),this._mediaStreamTrack)}pipe(e){if(this._bypassWebAudio)throw new xe(Le.NOT_SUPPORTED,"can not pipe extension when WebAudio disabled");if(this.processor===e)return e;if(e._source)throw new xe(Le.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),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 xe(Le.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,t.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(e.PROCESSOR_DESTINATION_EVENTS.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(e.PROCESSOR_DESTINATION_EVENTS.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(e.PROCESSOR_DESTINATION_EVENTS.ON_TRACK),this.processorDestination.removeAllListeners(e.PROCESSOR_DESTINATION_EVENTS.ON_NODE)}}Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),Bv("design:type",Function),Bv("design:paramtypes",[Number]),Bv("design:returntype",void 0)],LR.prototype,"setVolume",null),Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t]}),Bv("design:type",Function),Bv("design:paramtypes",[String]),Bv("design:returntype",Vv)],LR.prototype,"setPlaybackDevice",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],LR.prototype,"play",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],LR.prototype,"stop",null),Fv([Hn({argsMap:(e,t)=>[e.getTrackId(),t.name]}),Bv("design:type",Function),Bv("design:paramtypes",[Object]),Bv("design:returntype",Object)],LR.prototype,"pipe",null),Fv([Hn({argsMap:e=>[e.getTrackId()]}),Bv("design:type",Function),Bv("design:paramtypes",[]),Bv("design:returntype",void 0)],LR.prototype,"unpipe",null);const MR=new class extends Ke{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),this._lastHiddenTime=0,this._lastVisibleTime=0,document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),Un.debug("document visibility went ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}};
6
+ /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function UR(e){let t=e.length;for(;--t>=0;)e[t]=0}const xR=256,VR=286,FR=30,BR=15,jR=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),GR=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),WR=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),HR=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),KR=new Array(576);UR(KR);const zR=new Array(60);UR(zR);const YR=new Array(512);UR(YR);const XR=new Array(256);UR(XR);const JR=new Array(29);UR(JR);const ZR=new Array(FR);function qR(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}let $R,QR,eb;function tb(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}UR(ZR);const rb=e=>e<256?YR[e]:YR[256+(e>>>7)],nb=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},ib=(e,t,r)=>{e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,nb(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)},ob=(e,t,r)=>{ib(e,r[2*t],r[2*t+1])},sb=(e,t)=>{let r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1},ab=(e,t,r)=>{const n=new Array(16);let i,o,s=0;for(i=1;i<=BR;i++)s=s+r[i-1]<<1,n[i]=s;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=sb(n[t]++,t))}},cb=e=>{let t;for(t=0;t<VR;t++)e.dyn_ltree[2*t]=0;for(t=0;t<FR;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},db=e=>{e.bi_valid>8?nb(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},ub=(e,t,r,n)=>{const i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]},lb=(e,t,r)=>{const n=e.heap[r];let i=r<<1;for(;i<=e.heap_len&&(i<e.heap_len&&ub(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!ub(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n},hb=(e,t,r)=>{let n,i,o,s,a=0;if(0!==e.sym_next)do{n=255&e.pending_buf[e.sym_buf+a++],n+=(255&e.pending_buf[e.sym_buf+a++])<<8,i=e.pending_buf[e.sym_buf+a++],0===n?ob(e,i,t):(o=XR[i],ob(e,o+xR+1,t),s=jR[o],0!==s&&(i-=JR[o],ib(e,i,s)),n--,o=rb(n),ob(e,o,r),s=GR[o],0!==s&&(n-=ZR[o],ib(e,n,s)))}while(a<e.sym_next);ob(e,256,t)},pb=(e,t)=>{const r=t.dyn_tree,n=t.stat_desc.static_tree,i=t.stat_desc.has_stree,o=t.stat_desc.elems;let s,a,c,d=-1;for(e.heap_len=0,e.heap_max=573,s=0;s<o;s++)0!==r[2*s]?(e.heap[++e.heap_len]=d=s,e.depth[s]=0):r[2*s+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=d<2?++d:0,r[2*c]=1,e.depth[c]=0,e.opt_len--,i&&(e.static_len-=n[2*c+1]);for(t.max_code=d,s=e.heap_len>>1;s>=1;s--)lb(e,r,s);c=o;do{s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],lb(e,r,1),a=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=a,r[2*c]=r[2*s]+r[2*a],e.depth[c]=(e.depth[s]>=e.depth[a]?e.depth[s]:e.depth[a])+1,r[2*s+1]=r[2*a+1]=c,e.heap[1]=c++,lb(e,r,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,o=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,c=t.stat_desc.max_length;let d,u,l,h,p,f,_=0;for(h=0;h<=BR;h++)e.bl_count[h]=0;for(r[2*e.heap[e.heap_max]+1]=0,d=e.heap_max+1;d<573;d++)u=e.heap[d],h=r[2*r[2*u+1]+1]+1,h>c&&(h=c,_++),r[2*u+1]=h,u>n||(e.bl_count[h]++,p=0,u>=a&&(p=s[u-a]),f=r[2*u],e.opt_len+=f*(h+p),o&&(e.static_len+=f*(i[2*u+1]+p)));if(0!==_){do{for(h=c-1;0===e.bl_count[h];)h--;e.bl_count[h]--,e.bl_count[h+1]+=2,e.bl_count[c]--,_-=2}while(_>0);for(h=c;0!==h;h--)for(u=e.bl_count[h];0!==u;)l=e.heap[--d],l>n||(r[2*l+1]!==h&&(e.opt_len+=(h-r[2*l+1])*r[2*l],r[2*l+1]=h),u--)}})(e,t),ab(r,d,e.bl_count)},fb=(e,t,r)=>{let n,i,o=-1,s=t[1],a=0,c=7,d=4;for(0===s&&(c=138,d=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=s,s=t[2*(n+1)+1],++a<c&&i===s||(a<d?e.bl_tree[2*i]+=a:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,o=i,0===s?(c=138,d=3):i===s?(c=6,d=3):(c=7,d=4))},_b=(e,t,r)=>{let n,i,o=-1,s=t[1],a=0,c=7,d=4;for(0===s&&(c=138,d=3),n=0;n<=r;n++)if(i=s,s=t[2*(n+1)+1],!(++a<c&&i===s)){if(a<d)do{ob(e,i,e.bl_tree)}while(0!=--a);else 0!==i?(i!==o&&(ob(e,i,e.bl_tree),a--),ob(e,16,e.bl_tree),ib(e,a-3,2)):a<=10?(ob(e,17,e.bl_tree),ib(e,a-3,3)):(ob(e,18,e.bl_tree),ib(e,a-11,7));a=0,o=i,0===s?(c=138,d=3):i===s?(c=6,d=3):(c=7,d=4)}};let Eb=!1;const mb=(e,t,r,n)=>{ib(e,0+(n?1:0),3),db(e),nb(e,r),nb(e,~r),r&&e.pending_buf.set(e.window.subarray(t,t+r),e.pending),e.pending+=r};var gb=(e,t,r,n)=>{let i,o,s=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<xR;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),pb(e,e.l_desc),pb(e,e.d_desc),s=(e=>{let t;for(fb(e,e.dyn_ltree,e.l_desc.max_code),fb(e,e.dyn_dtree,e.d_desc.max_code),pb(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*HR[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),i=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?mb(e,t,r,n):4===e.strategy||o===i?(ib(e,2+(n?1:0),3),hb(e,KR,zR)):(ib(e,4+(n?1:0),3),((e,t,r,n)=>{let i;for(ib(e,t-257,5),ib(e,r-1,5),ib(e,n-4,4),i=0;i<n;i++)ib(e,e.bl_tree[2*HR[i]+1],3);_b(e,e.dyn_ltree,t-1),_b(e,e.dyn_dtree,r-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),hb(e,e.dyn_ltree,e.dyn_dtree)),cb(e),n&&db(e)},Tb={_tr_init:e=>{Eb||((()=>{let e,t,r,n,i;const o=new Array(16);for(r=0,n=0;n<28;n++)for(JR[n]=r,e=0;e<1<<jR[n];e++)XR[r++]=n;for(XR[r-1]=n,i=0,n=0;n<16;n++)for(ZR[n]=i,e=0;e<1<<GR[n];e++)YR[i++]=n;for(i>>=7;n<FR;n++)for(ZR[n]=i<<7,e=0;e<1<<GR[n]-7;e++)YR[256+i++]=n;for(t=0;t<=BR;t++)o[t]=0;for(e=0;e<=143;)KR[2*e+1]=8,e++,o[8]++;for(;e<=255;)KR[2*e+1]=9,e++,o[9]++;for(;e<=279;)KR[2*e+1]=7,e++,o[7]++;for(;e<=287;)KR[2*e+1]=8,e++,o[8]++;for(ab(KR,287,o),e=0;e<FR;e++)zR[2*e+1]=5,zR[2*e]=sb(e,5);$R=new qR(KR,jR,257,VR,BR),QR=new qR(zR,GR,0,FR,BR),eb=new qR(new Array(0),WR,0,19,7)})(),Eb=!0),e.l_desc=new tb(e.dyn_ltree,$R),e.d_desc=new tb(e.dyn_dtree,QR),e.bl_desc=new tb(e.bl_tree,eb),e.bi_buf=0,e.bi_valid=0,cb(e)},_tr_stored_block:mb,_tr_flush_block:gb,_tr_tally:(e,t,r)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=r,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(XR[r]+xR+1)]++,e.dyn_dtree[2*rb(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{ib(e,2,3),ob(e,256,KR),(e=>{16===e.bi_valid?(nb(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var Sb=(e,t,r,n)=>{let i=65535&e|0,o=e>>>16&65535|0,s=0;for(;0!==r;){s=r>2e3?2e3:r,r-=s;do{i=i+t[n++]|0,o=o+i|0}while(--s);i%=65521,o%=65521}return i|o<<16|0};const vb=new Uint32Array((()=>{let e,t=[];for(var r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t})());var yb=(e,t,r,n)=>{const i=vb,o=n+r;e^=-1;for(let r=n;r<o;r++)e=e>>>8^i[255&(e^t[r])];return-1^e},Rb={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},bb={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:Ab,_tr_stored_block:Ib,_tr_flush_block:Ob,_tr_tally:Cb,_tr_align:wb}=Tb,{Z_NO_FLUSH:Nb,Z_PARTIAL_FLUSH:kb,Z_FULL_FLUSH:Db,Z_FINISH:Pb,Z_BLOCK:Lb,Z_OK:Mb,Z_STREAM_END:Ub,Z_STREAM_ERROR:xb,Z_DATA_ERROR:Vb,Z_BUF_ERROR:Fb,Z_DEFAULT_COMPRESSION:Bb,Z_FILTERED:jb,Z_HUFFMAN_ONLY:Gb,Z_RLE:Wb,Z_FIXED:Hb,Z_DEFAULT_STRATEGY:Kb,Z_UNKNOWN:zb,Z_DEFLATED:Yb}=bb,Xb=286,Jb=30,Zb=19,qb=2*Xb+1,$b=15,Qb=258,eA=262,tA=42,rA=113,nA=666,iA=(e,t)=>(e.msg=Rb[t],t),oA=e=>2*e-(e>4?9:0),sA=e=>{let t=e.length;for(;--t>=0;)e[t]=0},aA=e=>{let t,r,n,i=e.w_size;t=e.hash_size,n=t;do{r=e.head[--n],e.head[n]=r>=i?r-i:0}while(--t);t=i,n=t;do{r=e.prev[--n],e.prev[n]=r>=i?r-i:0}while(--t)};let cA=(e,t,r)=>(t<<e.hash_shift^r)&e.hash_mask;const dA=e=>{const t=e.state;let r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+r),e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))},uA=(e,t)=>{Ob(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,dA(e.strm)},lA=(e,t)=>{e.pending_buf[e.pending++]=t},hA=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},pA=(e,t,r,n)=>{let i=e.avail_in;return i>n&&(i=n),0===i?0:(e.avail_in-=i,t.set(e.input.subarray(e.next_in,e.next_in+i),r),1===e.state.wrap?e.adler=Sb(e.adler,t,i,r):2===e.state.wrap&&(e.adler=yb(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)},fA=(e,t)=>{let r,n,i=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match;const c=e.strstart>e.w_size-eA?e.strstart-(e.w_size-eA):0,d=e.window,u=e.w_mask,l=e.prev,h=e.strstart+Qb;let p=d[o+s-1],f=d[o+s];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(r=t,d[r+s]===f&&d[r+s-1]===p&&d[r]===d[o]&&d[++r]===d[o+1]){o+=2,r++;do{}while(d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&d[++o]===d[++r]&&o<h);if(n=Qb-(h-o),o=h-Qb,n>s){if(e.match_start=t,s=n,n>=a)break;p=d[o+s-1],f=d[o+s]}}}while((t=l[t&u])>c&&0!=--i);return s<=e.lookahead?s:e.lookahead},_A=e=>{const t=e.w_size;let r,n,i;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-eA)&&(e.window.set(e.window.subarray(t,t+t-n),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),aA(e),n+=t),0===e.strm.avail_in)break;if(r=pA(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=r,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=cA(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=cA(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<eA&&0!==e.strm.avail_in)},EA=(e,t)=>{let r,n,i,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,s=0,a=e.strm.avail_in;do{if(r=65535,i=e.bi_valid+42>>3,e.strm.avail_out<i)break;if(i=e.strm.avail_out-i,n=e.strstart-e.block_start,r>n+e.strm.avail_in&&(r=n+e.strm.avail_in),r>i&&(r=i),r<o&&(0===r&&t!==Pb||t===Nb||r!==n+e.strm.avail_in))break;s=t===Pb&&r===n+e.strm.avail_in?1:0,Ib(e,0,0,s),e.pending_buf[e.pending-4]=r,e.pending_buf[e.pending-3]=r>>8,e.pending_buf[e.pending-2]=~r,e.pending_buf[e.pending-1]=~r>>8,dA(e.strm),n&&(n>r&&(n=r),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+n),e.strm.next_out),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n,e.block_start+=n,r-=n),r&&(pA(e.strm,e.strm.output,e.strm.next_out,r),e.strm.next_out+=r,e.strm.avail_out-=r,e.strm.total_out+=r)}while(0===s);return a-=e.strm.avail_in,a&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?4:t!==Nb&&t!==Pb&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(i=e.window_size-e.strstart,e.strm.avail_in>i&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,i+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),i>e.strm.avail_in&&(i=e.strm.avail_in),i&&(pA(e.strm,e.window,e.strstart,i),e.strstart+=i,e.insert+=i>e.w_size-e.insert?e.w_size-e.insert:i),e.high_water<e.strstart&&(e.high_water=e.strstart),i=e.bi_valid+42>>3,i=e.pending_buf_size-i>65535?65535:e.pending_buf_size-i,o=i>e.w_size?e.w_size:i,n=e.strstart-e.block_start,(n>=o||(n||t===Pb)&&t!==Nb&&0===e.strm.avail_in&&n<=i)&&(r=n>i?i:n,s=t===Pb&&0===e.strm.avail_in&&r===n?1:0,Ib(e,e.block_start,r,s),e.block_start+=r,dA(e.strm)),s?3:1)},mA=(e,t)=>{let r,n;for(;;){if(e.lookahead<eA){if(_A(e),e.lookahead<eA&&t===Nb)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=cA(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-eA&&(e.match_length=fA(e,r)),e.match_length>=3)if(n=Cb(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=cA(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=cA(e,e.ins_h,e.window[e.strstart+1]);else n=Cb(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(uA(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Pb?(uA(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(uA(e,!1),0===e.strm.avail_out)?1:2},gA=(e,t)=>{let r,n,i;for(;;){if(e.lookahead<eA){if(_A(e),e.lookahead<eA&&t===Nb)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=cA(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-eA&&(e.match_length=fA(e,r),e.match_length<=5&&(e.strategy===jb||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-3,n=Cb(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=i&&(e.ins_h=cA(e,e.ins_h,e.window[e.strstart+3-1]),r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(uA(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(n=Cb(e,0,e.window[e.strstart-1]),n&&uA(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=Cb(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Pb?(uA(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(uA(e,!1),0===e.strm.avail_out)?1:2};function TA(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}const SA=[new TA(0,0,0,0,EA),new TA(4,4,8,4,mA),new TA(4,5,16,8,mA),new TA(4,6,32,32,mA),new TA(4,4,16,16,gA),new TA(8,16,32,32,gA),new TA(8,16,128,128,gA),new TA(8,32,128,256,gA),new TA(32,128,258,1024,gA),new TA(32,258,258,4096,gA)];function vA(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Yb,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(2*qb),this.dyn_dtree=new Uint16Array(2*(2*Jb+1)),this.bl_tree=new Uint16Array(2*(2*Zb+1)),sA(this.dyn_ltree),sA(this.dyn_dtree),sA(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array($b+1),this.heap=new Uint16Array(2*Xb+1),sA(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Xb+1),sA(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}const yA=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==tA&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==rA&&t.status!==nA?1:0},RA=e=>{if(yA(e))return iA(e,xb);e.total_in=e.total_out=0,e.data_type=zb;const t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?tA:rA,e.adler=2===t.wrap?0:1,t.last_flush=-2,Ab(t),Mb},bA=e=>{const t=RA(e);var r;return t===Mb&&((r=e.state).window_size=2*r.w_size,sA(r.head),r.max_lazy_match=SA[r.level].max_lazy,r.good_match=SA[r.level].good_length,r.nice_match=SA[r.level].nice_length,r.max_chain_length=SA[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=2,r.match_available=0,r.ins_h=0),t},AA=(e,t,r,n,i,o)=>{if(!e)return xb;let s=1;if(t===Bb&&(t=6),n<0?(s=0,n=-n):n>15&&(s=2,n-=16),i<1||i>9||r!==Yb||n<8||n>15||t<0||t>9||o<0||o>Hb||8===n&&1!==s)return iA(e,xb);8===n&&(n=9);const a=new vA;return e.state=a,a.strm=e,a.status=tA,a.wrap=s,a.gzhead=null,a.w_bits=n,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=i+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<i+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=t,a.strategy=o,a.method=r,bA(e)};var IA=(e,t)=>{if(yA(e)||t>Lb||t<0)return e?iA(e,xb):xb;const r=e.state;if(!e.output||0!==e.avail_in&&!e.input||r.status===nA&&t!==Pb)return iA(e,0===e.avail_out?Fb:xb);const n=r.last_flush;if(r.last_flush=t,0!==r.pending){if(dA(e),0===e.avail_out)return r.last_flush=-1,Mb}else if(0===e.avail_in&&oA(t)<=oA(n)&&t!==Pb)return iA(e,Fb);if(r.status===nA&&0!==e.avail_in)return iA(e,Fb);if(r.status===tA&&0===r.wrap&&(r.status=rA),r.status===tA){let t=Yb+(r.w_bits-8<<4)<<8,n=-1;if(n=r.strategy>=Gb||r.level<2?0:r.level<6?1:6===r.level?2:3,t|=n<<6,0!==r.strstart&&(t|=32),t+=31-t%31,hA(r,t),0!==r.strstart&&(hA(r,e.adler>>>16),hA(r,65535&e.adler)),e.adler=1,r.status=rA,dA(e),0!==r.pending)return r.last_flush=-1,Mb}if(57===r.status)if(e.adler=0,lA(r,31),lA(r,139),lA(r,8),r.gzhead)lA(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),lA(r,255&r.gzhead.time),lA(r,r.gzhead.time>>8&255),lA(r,r.gzhead.time>>16&255),lA(r,r.gzhead.time>>24&255),lA(r,9===r.level?2:r.strategy>=Gb||r.level<2?4:0),lA(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(lA(r,255&r.gzhead.extra.length),lA(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=yb(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69;else if(lA(r,0),lA(r,0),lA(r,0),lA(r,0),lA(r,0),lA(r,9===r.level?2:r.strategy>=Gb||r.level<2?4:0),lA(r,3),r.status=rA,dA(e),0!==r.pending)return r.last_flush=-1,Mb;if(69===r.status){if(r.gzhead.extra){let t=r.pending,n=(65535&r.gzhead.extra.length)-r.gzindex;for(;r.pending+n>r.pending_buf_size;){let i=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+i),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>t&&(e.adler=yb(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex+=i,dA(e),0!==r.pending)return r.last_flush=-1,Mb;t=0,n-=i}let i=new Uint8Array(r.gzhead.extra);r.pending_buf.set(i.subarray(r.gzindex,r.gzindex+n),r.pending),r.pending+=n,r.gzhead.hcrc&&r.pending>t&&(e.adler=yb(e.adler,r.pending_buf,r.pending-t,t)),r.gzindex=0}r.status=73}if(73===r.status){if(r.gzhead.name){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=yb(e.adler,r.pending_buf,r.pending-n,n)),dA(e),0!==r.pending)return r.last_flush=-1,Mb;n=0}t=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,lA(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=yb(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=91}if(91===r.status){if(r.gzhead.comment){let t,n=r.pending;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(e.adler=yb(e.adler,r.pending_buf,r.pending-n,n)),dA(e),0!==r.pending)return r.last_flush=-1,Mb;n=0}t=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,lA(r,t)}while(0!==t);r.gzhead.hcrc&&r.pending>n&&(e.adler=yb(e.adler,r.pending_buf,r.pending-n,n))}r.status=103}if(103===r.status){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(dA(e),0!==r.pending))return r.last_flush=-1,Mb;lA(r,255&e.adler),lA(r,e.adler>>8&255),e.adler=0}if(r.status=rA,dA(e),0!==r.pending)return r.last_flush=-1,Mb}if(0!==e.avail_in||0!==r.lookahead||t!==Nb&&r.status!==nA){let n=0===r.level?EA(r,t):r.strategy===Gb?((e,t)=>{let r;for(;;){if(0===e.lookahead&&(_A(e),0===e.lookahead)){if(t===Nb)return 1;break}if(e.match_length=0,r=Cb(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(uA(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Pb?(uA(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(uA(e,!1),0===e.strm.avail_out)?1:2})(r,t):r.strategy===Wb?((e,t)=>{let r,n,i,o;const s=e.window;for(;;){if(e.lookahead<=Qb){if(_A(e),e.lookahead<=Qb&&t===Nb)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=e.strstart-1,n=s[i],n===s[++i]&&n===s[++i]&&n===s[++i])){o=e.strstart+Qb;do{}while(n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&n===s[++i]&&i<o);e.match_length=Qb-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=Cb(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=Cb(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(uA(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===Pb?(uA(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(uA(e,!1),0===e.strm.avail_out)?1:2})(r,t):SA[r.level].func(r,t);if(3!==n&&4!==n||(r.status=nA),1===n||3===n)return 0===e.avail_out&&(r.last_flush=-1),Mb;if(2===n&&(t===kb?wb(r):t!==Lb&&(Ib(r,0,0,!1),t===Db&&(sA(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),dA(e),0===e.avail_out))return r.last_flush=-1,Mb}return t!==Pb?Mb:r.wrap<=0?Ub:(2===r.wrap?(lA(r,255&e.adler),lA(r,e.adler>>8&255),lA(r,e.adler>>16&255),lA(r,e.adler>>24&255),lA(r,255&e.total_in),lA(r,e.total_in>>8&255),lA(r,e.total_in>>16&255),lA(r,e.total_in>>24&255)):(hA(r,e.adler>>>16),hA(r,65535&e.adler)),dA(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?Mb:Ub)},OA=(e,t)=>{let r=t.length;if(yA(e))return xb;const n=e.state,i=n.wrap;if(2===i||1===i&&n.status!==tA||n.lookahead)return xb;if(1===i&&(e.adler=Sb(e.adler,t,r,0)),n.wrap=0,r>=n.w_size){0===i&&(sA(n.head),n.strstart=0,n.block_start=0,n.insert=0);let e=new Uint8Array(n.w_size);e.set(t.subarray(r-n.w_size,r),0),t=e,r=n.w_size}const o=e.avail_in,s=e.next_in,a=e.input;for(e.avail_in=r,e.next_in=0,e.input=t,_A(n);n.lookahead>=3;){let e=n.strstart,t=n.lookahead-2;do{n.ins_h=cA(n,n.ins_h,n.window[e+3-1]),n.prev[e&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=e,e++}while(--t);n.strstart=e,n.lookahead=2,_A(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=2,n.match_available=0,e.next_in=s,e.input=a,e.avail_in=o,n.wrap=i,Mb},CA={deflateInit:(e,t)=>AA(e,t,Yb,15,8,Kb),deflateInit2:AA,deflateReset:bA,deflateResetKeep:RA,deflateSetHeader:(e,t)=>yA(e)||2!==e.state.wrap?xb:(e.state.gzhead=t,Mb),deflate:IA,deflateEnd:e=>{if(yA(e))return xb;const t=e.state.status;return e.state=null,t===rA?iA(e,Vb):Mb},deflateSetDictionary:OA,deflateInfo:"pako deflate (from Nodeca project)"};const wA=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var NA={assign:function(e){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const r=t.shift();if(r){if("object"!=typeof r)throw new TypeError(r+"must be non-object");for(const t in r)wA(r,t)&&(e[t]=r[t])}}return e},flattenChunks:e=>{let t=0;for(let r=0,n=e.length;r<n;r++)t+=e[r].length;const r=new Uint8Array(t);for(let t=0,n=0,i=e.length;t<i;t++){let i=e[t];r.set(i,n),n+=i.length}return r}};let kA=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){kA=!1}const DA=new Uint8Array(256);for(let e=0;e<256;e++)DA[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;DA[254]=DA[254]=1;var PA={string2buf:e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,r,n,i,o,s=e.length,a=0;for(i=0;i<s;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<s&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),a+=r<128?1:r<2048?2:r<65536?3:4;for(t=new Uint8Array(a),o=0,i=0;o<a;i++)r=e.charCodeAt(i),55296==(64512&r)&&i+1<s&&(n=e.charCodeAt(i+1),56320==(64512&n)&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},buf2string:(e,t)=>{const r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let n,i;const o=new Array(2*r);for(i=0,n=0;n<r;){let t=e[n++];if(t<128){o[i++]=t;continue}let s=DA[t];if(s>4)o[i++]=65533,n+=s-1;else{for(t&=2===s?31:3===s?15:7;s>1&&n<r;)t=t<<6|63&e[n++],s--;s>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&kA)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let r="";for(let n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r})(o,i)},utf8border:(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let r=t-1;for(;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+DA[e[r]]>t?r:t}};var LA=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};const MA=Object.prototype.toString,{Z_NO_FLUSH:UA,Z_SYNC_FLUSH:xA,Z_FULL_FLUSH:VA,Z_FINISH:FA,Z_OK:BA,Z_STREAM_END:jA,Z_DEFAULT_COMPRESSION:GA,Z_DEFAULT_STRATEGY:WA,Z_DEFLATED:HA}=bb;function KA(e){this.options=NA.assign({level:GA,method:HA,chunkSize:16384,windowBits:15,memLevel:8,strategy:WA},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new LA,this.strm.avail_out=0;let r=CA.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(r!==BA)throw new Error(Rb[r]);if(t.header&&CA.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?PA.string2buf(t.dictionary):"[object ArrayBuffer]"===MA.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,r=CA.deflateSetDictionary(this.strm,e),r!==BA)throw new Error(Rb[r]);this._dict_set=!0}}function zA(e,t){const r=new KA(t);if(r.push(e,!0),r.err)throw r.msg||Rb[r.err];return r.result}KA.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize;let i,o;if(this.ended)return!1;for(o=t===~~t?t:!0===t?FA:UA,"string"==typeof e?r.input=PA.string2buf(e):"[object ArrayBuffer]"===MA.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(o===xA||o===VA)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if(i=CA.deflate(r,o),i===jA)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=CA.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===BA;if(0!==r.avail_out){if(o>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},KA.prototype.onData=function(e){this.chunks.push(e)},KA.prototype.onEnd=function(e){e===BA&&(this.result=NA.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var YA={Deflate:KA,deflate:zA,deflateRaw:function(e,t){return(t=t||{}).raw=!0,zA(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,zA(e,t)},constants:bb};const XA=16209;var JA=function(e,t){let r,n,i,o,s,a,c,d,u,l,h,p,f,_,E,m,g,T,S,v,y,R,b,A;const I=e.state;r=e.next_in,b=e.input,n=r+(e.avail_in-5),i=e.next_out,A=e.output,o=i-(t-e.avail_out),s=i+(e.avail_out-257),a=I.dmax,c=I.wsize,d=I.whave,u=I.wnext,l=I.window,h=I.hold,p=I.bits,f=I.lencode,_=I.distcode,E=(1<<I.lenbits)-1,m=(1<<I.distbits)-1;e:do{p<15&&(h+=b[r++]<<p,p+=8,h+=b[r++]<<p,p+=8),g=f[h&E];t:for(;;){if(T=g>>>24,h>>>=T,p-=T,T=g>>>16&255,0===T)A[i++]=65535&g;else{if(!(16&T)){if(0==(64&T)){g=f[(65535&g)+(h&(1<<T)-1)];continue t}if(32&T){I.mode=16191;break e}e.msg="invalid literal/length code",I.mode=XA;break e}S=65535&g,T&=15,T&&(p<T&&(h+=b[r++]<<p,p+=8),S+=h&(1<<T)-1,h>>>=T,p-=T),p<15&&(h+=b[r++]<<p,p+=8,h+=b[r++]<<p,p+=8),g=_[h&m];r:for(;;){if(T=g>>>24,h>>>=T,p-=T,T=g>>>16&255,!(16&T)){if(0==(64&T)){g=_[(65535&g)+(h&(1<<T)-1)];continue r}e.msg="invalid distance code",I.mode=XA;break e}if(v=65535&g,T&=15,p<T&&(h+=b[r++]<<p,p+=8,p<T&&(h+=b[r++]<<p,p+=8)),v+=h&(1<<T)-1,v>a){e.msg="invalid distance too far back",I.mode=XA;break e}if(h>>>=T,p-=T,T=i-o,v>T){if(T=v-T,T>d&&I.sane){e.msg="invalid distance too far back",I.mode=XA;break e}if(y=0,R=l,0===u){if(y+=c-T,T<S){S-=T;do{A[i++]=l[y++]}while(--T);y=i-v,R=A}}else if(u<T){if(y+=c+u-T,T-=u,T<S){S-=T;do{A[i++]=l[y++]}while(--T);if(y=0,u<S){T=u,S-=T;do{A[i++]=l[y++]}while(--T);y=i-v,R=A}}}else if(y+=u-T,T<S){S-=T;do{A[i++]=l[y++]}while(--T);y=i-v,R=A}for(;S>2;)A[i++]=R[y++],A[i++]=R[y++],A[i++]=R[y++],S-=3;S&&(A[i++]=R[y++],S>1&&(A[i++]=R[y++]))}else{y=i-v;do{A[i++]=A[y++],A[i++]=A[y++],A[i++]=A[y++],S-=3}while(S>2);S&&(A[i++]=A[y++],S>1&&(A[i++]=A[y++]))}break}}break}}while(r<n&&i<s);S=p>>3,r-=S,p-=S<<3,h&=(1<<p)-1,e.next_in=r,e.next_out=i,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=i<s?s-i+257:257-(i-s),I.hold=h,I.bits=p};const ZA=15,qA=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),$A=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),QA=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),eI=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var tI=(e,t,r,n,i,o,s,a)=>{const c=a.bits;let d,u,l,h,p,f,_=0,E=0,m=0,g=0,T=0,S=0,v=0,y=0,R=0,b=0,A=null;const I=new Uint16Array(16),O=new Uint16Array(16);let C,w,N,k=null;for(_=0;_<=ZA;_++)I[_]=0;for(E=0;E<n;E++)I[t[r+E]]++;for(T=c,g=ZA;g>=1&&0===I[g];g--);if(T>g&&(T=g),0===g)return i[o++]=20971520,i[o++]=20971520,a.bits=1,0;for(m=1;m<g&&0===I[m];m++);for(T<m&&(T=m),y=1,_=1;_<=ZA;_++)if(y<<=1,y-=I[_],y<0)return-1;if(y>0&&(0===e||1!==g))return-1;for(O[1]=0,_=1;_<ZA;_++)O[_+1]=O[_]+I[_];for(E=0;E<n;E++)0!==t[r+E]&&(s[O[t[r+E]]++]=E);if(0===e?(A=k=s,f=20):1===e?(A=qA,k=$A,f=257):(A=QA,k=eI,f=0),b=0,E=0,_=m,p=o,S=T,v=0,l=-1,R=1<<T,h=R-1,1===e&&R>852||2===e&&R>592)return 1;for(;;){C=_-v,s[E]+1<f?(w=0,N=s[E]):s[E]>=f?(w=k[s[E]-f],N=A[s[E]-f]):(w=96,N=0),d=1<<_-v,u=1<<S,m=u;do{u-=d,i[p+(b>>v)+u]=C<<24|w<<16|N|0}while(0!==u);for(d=1<<_-1;b&d;)d>>=1;if(0!==d?(b&=d-1,b+=d):b=0,E++,0==--I[_]){if(_===g)break;_=t[r+s[E]]}if(_>T&&(b&h)!==l){for(0===v&&(v=T),p+=m,S=_-v,y=1<<S;S+v<g&&(y-=I[S+v],!(y<=0));)S++,y<<=1;if(R+=1<<S,1===e&&R>852||2===e&&R>592)return 1;l=b&h,i[l]=T<<24|S<<16|p-o|0}}return 0!==b&&(i[p+b]=_-v<<24|64<<16|0),a.bits=T,0};const{Z_FINISH:rI,Z_BLOCK:nI,Z_TREES:iI,Z_OK:oI,Z_STREAM_END:sI,Z_NEED_DICT:aI,Z_STREAM_ERROR:cI,Z_DATA_ERROR:dI,Z_MEM_ERROR:uI,Z_BUF_ERROR:lI,Z_DEFLATED:hI}=bb,pI=16180,fI=16190,_I=16191,EI=16192,mI=16194,gI=16199,TI=16200,SI=16206,vI=16209,yI=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function RI(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}const bI=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.mode<pI||t.mode>16211?1:0},AI=e=>{if(bI(e))return cI;const t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=pI,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,oI},II=e=>{if(bI(e))return cI;const t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,AI(e)},OI=(e,t)=>{let r;if(bI(e))return cI;const n=e.state;return t<0?(r=0,t=-t):(r=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?cI:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,II(e))},CI=(e,t)=>{if(!e)return cI;const r=new RI;e.state=r,r.strm=e,r.window=null,r.mode=pI;const n=OI(e,t);return n!==oI&&(e.state=null),n};let wI,NI,kI=!0;const DI=e=>{if(kI){wI=new Int32Array(512),NI=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(tI(1,e.lens,0,288,wI,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;tI(2,e.lens,0,32,NI,0,e.work,{bits:5}),kI=!1}e.lencode=wI,e.lenbits=9,e.distcode=NI,e.distbits=5},PI=(e,t,r,n)=>{let i;const o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),n>=o.wsize?(o.window.set(t.subarray(r-o.wsize,r),0),o.wnext=0,o.whave=o.wsize):(i=o.wsize-o.wnext,i>n&&(i=n),o.window.set(t.subarray(r-n,r-n+i),o.wnext),(n-=i)?(o.window.set(t.subarray(r-n,r),0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0};var LI=(e,t)=>{let r,n,i,o,s,a,c,d,u,l,h,p,f,_,E,m,g,T,S,v,y,R,b=0;const A=new Uint8Array(4);let I,O;const C=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(bI(e)||!e.output||!e.input&&0!==e.avail_in)return cI;r=e.state,r.mode===_I&&(r.mode=EI),s=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,d=r.hold,u=r.bits,l=a,h=c,R=oI;e:for(;;)switch(r.mode){case pI:if(0===r.wrap){r.mode=EI;break}for(;u<16;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(2&r.wrap&&35615===d){0===r.wbits&&(r.wbits=15),r.check=0,A[0]=255&d,A[1]=d>>>8&255,r.check=yb(r.check,A,2,0),d=0,u=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&d)<<8)+(d>>8))%31){e.msg="incorrect header check",r.mode=vI;break}if((15&d)!==hI){e.msg="unknown compression method",r.mode=vI;break}if(d>>>=4,u-=4,y=8+(15&d),0===r.wbits&&(r.wbits=y),y>15||y>r.wbits){e.msg="invalid window size",r.mode=vI;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&d?16189:_I,d=0,u=0;break;case 16181:for(;u<16;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(r.flags=d,(255&r.flags)!==hI){e.msg="unknown compression method",r.mode=vI;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=vI;break}r.head&&(r.head.text=d>>8&1),512&r.flags&&4&r.wrap&&(A[0]=255&d,A[1]=d>>>8&255,r.check=yb(r.check,A,2,0)),d=0,u=0,r.mode=16182;case 16182:for(;u<32;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}r.head&&(r.head.time=d),512&r.flags&&4&r.wrap&&(A[0]=255&d,A[1]=d>>>8&255,A[2]=d>>>16&255,A[3]=d>>>24&255,r.check=yb(r.check,A,4,0)),d=0,u=0,r.mode=16183;case 16183:for(;u<16;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}r.head&&(r.head.xflags=255&d,r.head.os=d>>8),512&r.flags&&4&r.wrap&&(A[0]=255&d,A[1]=d>>>8&255,r.check=yb(r.check,A,2,0)),d=0,u=0,r.mode=16184;case 16184:if(1024&r.flags){for(;u<16;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}r.length=d,r.head&&(r.head.extra_len=d),512&r.flags&&4&r.wrap&&(A[0]=255&d,A[1]=d>>>8&255,r.check=yb(r.check,A,2,0)),d=0,u=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&(p=r.length,p>a&&(p=a),p&&(r.head&&(y=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(o,o+p),y)),512&r.flags&&4&r.wrap&&(r.check=yb(r.check,n,p,o)),a-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===a)break e;p=0;do{y=n[o+p++],r.head&&y&&r.length<65536&&(r.head.name+=String.fromCharCode(y))}while(y&&p<a);if(512&r.flags&&4&r.wrap&&(r.check=yb(r.check,n,p,o)),a-=p,o+=p,y)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===a)break e;p=0;do{y=n[o+p++],r.head&&y&&r.length<65536&&(r.head.comment+=String.fromCharCode(y))}while(y&&p<a);if(512&r.flags&&4&r.wrap&&(r.check=yb(r.check,n,p,o)),a-=p,o+=p,y)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;u<16;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(4&r.wrap&&d!==(65535&r.check)){e.msg="header crc mismatch",r.mode=vI;break}d=0,u=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=_I;break;case 16189:for(;u<32;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}e.adler=r.check=yI(d),d=0,u=0,r.mode=fI;case fI:if(0===r.havedict)return e.next_out=s,e.avail_out=c,e.next_in=o,e.avail_in=a,r.hold=d,r.bits=u,aI;e.adler=r.check=1,r.mode=_I;case _I:if(t===nI||t===iI)break e;case EI:if(r.last){d>>>=7&u,u-=7&u,r.mode=SI;break}for(;u<3;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}switch(r.last=1&d,d>>>=1,u-=1,3&d){case 0:r.mode=16193;break;case 1:if(DI(r),r.mode=gI,t===iI){d>>>=2,u-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=vI}d>>>=2,u-=2;break;case 16193:for(d>>>=7&u,u-=7&u;u<32;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if((65535&d)!=(d>>>16^65535)){e.msg="invalid stored block lengths",r.mode=vI;break}if(r.length=65535&d,d=0,u=0,r.mode=mI,t===iI)break e;case mI:r.mode=16195;case 16195:if(p=r.length,p){if(p>a&&(p=a),p>c&&(p=c),0===p)break e;i.set(n.subarray(o,o+p),s),a-=p,o+=p,c-=p,s+=p,r.length-=p;break}r.mode=_I;break;case 16196:for(;u<14;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(r.nlen=257+(31&d),d>>>=5,u-=5,r.ndist=1+(31&d),d>>>=5,u-=5,r.ncode=4+(15&d),d>>>=4,u-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=vI;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;u<3;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}r.lens[C[r.have++]]=7&d,d>>>=3,u-=3}for(;r.have<19;)r.lens[C[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,I={bits:r.lenbits},R=tI(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,R){e.msg="invalid code lengths set",r.mode=vI;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;b=r.lencode[d&(1<<r.lenbits)-1],E=b>>>24,m=b>>>16&255,g=65535&b,!(E<=u);){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(g<16)d>>>=E,u-=E,r.lens[r.have++]=g;else{if(16===g){for(O=E+2;u<O;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(d>>>=E,u-=E,0===r.have){e.msg="invalid bit length repeat",r.mode=vI;break}y=r.lens[r.have-1],p=3+(3&d),d>>>=2,u-=2}else if(17===g){for(O=E+3;u<O;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}d>>>=E,u-=E,y=0,p=3+(7&d),d>>>=3,u-=3}else{for(O=E+7;u<O;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}d>>>=E,u-=E,y=0,p=11+(127&d),d>>>=7,u-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=vI;break}for(;p--;)r.lens[r.have++]=y}}if(r.mode===vI)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=vI;break}if(r.lenbits=9,I={bits:r.lenbits},R=tI(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,R){e.msg="invalid literal/lengths set",r.mode=vI;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},R=tI(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,R){e.msg="invalid distances set",r.mode=vI;break}if(r.mode=gI,t===iI)break e;case gI:r.mode=TI;case TI:if(a>=6&&c>=258){e.next_out=s,e.avail_out=c,e.next_in=o,e.avail_in=a,r.hold=d,r.bits=u,JA(e,h),s=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,a=e.avail_in,d=r.hold,u=r.bits,r.mode===_I&&(r.back=-1);break}for(r.back=0;b=r.lencode[d&(1<<r.lenbits)-1],E=b>>>24,m=b>>>16&255,g=65535&b,!(E<=u);){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(m&&0==(240&m)){for(T=E,S=m,v=g;b=r.lencode[v+((d&(1<<T+S)-1)>>T)],E=b>>>24,m=b>>>16&255,g=65535&b,!(T+E<=u);){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}d>>>=T,u-=T,r.back+=T}if(d>>>=E,u-=E,r.back+=E,r.length=g,0===m){r.mode=16205;break}if(32&m){r.back=-1,r.mode=_I;break}if(64&m){e.msg="invalid literal/length code",r.mode=vI;break}r.extra=15&m,r.mode=16201;case 16201:if(r.extra){for(O=r.extra;u<O;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}r.length+=d&(1<<r.extra)-1,d>>>=r.extra,u-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;b=r.distcode[d&(1<<r.distbits)-1],E=b>>>24,m=b>>>16&255,g=65535&b,!(E<=u);){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(0==(240&m)){for(T=E,S=m,v=g;b=r.distcode[v+((d&(1<<T+S)-1)>>T)],E=b>>>24,m=b>>>16&255,g=65535&b,!(T+E<=u);){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}d>>>=T,u-=T,r.back+=T}if(d>>>=E,u-=E,r.back+=E,64&m){e.msg="invalid distance code",r.mode=vI;break}r.offset=g,r.extra=15&m,r.mode=16203;case 16203:if(r.extra){for(O=r.extra;u<O;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}r.offset+=d&(1<<r.extra)-1,d>>>=r.extra,u-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=vI;break}r.mode=16204;case 16204:if(0===c)break e;if(p=h-c,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=vI;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),_=r.window}else _=i,f=s-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{i[s++]=_[f++]}while(--p);0===r.length&&(r.mode=TI);break;case 16205:if(0===c)break e;i[s++]=r.length,c--,r.mode=TI;break;case SI:if(r.wrap){for(;u<32;){if(0===a)break e;a--,d|=n[o++]<<u,u+=8}if(h-=c,e.total_out+=h,r.total+=h,4&r.wrap&&h&&(e.adler=r.check=r.flags?yb(r.check,i,h,s-h):Sb(r.check,i,h,s-h)),h=c,4&r.wrap&&(r.flags?d:yI(d))!==r.check){e.msg="incorrect data check",r.mode=vI;break}d=0,u=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;u<32;){if(0===a)break e;a--,d+=n[o++]<<u,u+=8}if(4&r.wrap&&d!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=vI;break}d=0,u=0}r.mode=16208;case 16208:R=sI;break e;case vI:R=dI;break e;case 16210:return uI;default:return cI}return e.next_out=s,e.avail_out=c,e.next_in=o,e.avail_in=a,r.hold=d,r.bits=u,(r.wsize||h!==e.avail_out&&r.mode<vI&&(r.mode<SI||t!==rI))&&PI(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,4&r.wrap&&h&&(e.adler=r.check=r.flags?yb(r.check,i,h,e.next_out-h):Sb(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===_I?128:0)+(r.mode===gI||r.mode===mI?256:0),(0===l&&0===h||t===rI)&&R===oI&&(R=lI),R},MI={inflateReset:II,inflateReset2:OI,inflateResetKeep:AI,inflateInit:e=>CI(e,15),inflateInit2:CI,inflate:LI,inflateEnd:e=>{if(bI(e))return cI;let t=e.state;return t.window&&(t.window=null),e.state=null,oI},inflateGetHeader:(e,t)=>{if(bI(e))return cI;const r=e.state;return 0==(2&r.wrap)?cI:(r.head=t,t.done=!1,oI)},inflateSetDictionary:(e,t)=>{const r=t.length;let n,i,o;return bI(e)?cI:(n=e.state,0!==n.wrap&&n.mode!==fI?cI:n.mode===fI&&(i=1,i=Sb(i,t,r,0),i!==n.check)?dI:(o=PI(e,t,r,r),o?(n.mode=16210,uI):(n.havedict=1,oI)))},inflateInfo:"pako inflate (from Nodeca project)"};var UI=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};const xI=Object.prototype.toString,{Z_NO_FLUSH:VI,Z_FINISH:FI,Z_OK:BI,Z_STREAM_END:jI,Z_NEED_DICT:GI,Z_STREAM_ERROR:WI,Z_DATA_ERROR:HI,Z_MEM_ERROR:KI}=bb;function zI(e){this.options=NA.assign({chunkSize:65536,windowBits:15,to:""},e||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new LA,this.strm.avail_out=0;let r=MI.inflateInit2(this.strm,t.windowBits);if(r!==BI)throw new Error(Rb[r]);if(this.header=new UI,MI.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=PA.string2buf(t.dictionary):"[object ArrayBuffer]"===xI.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=MI.inflateSetDictionary(this.strm,t.dictionary),r!==BI)))throw new Error(Rb[r])}function YI(e,t){const r=new zI(t);if(r.push(e),r.err)throw r.msg||Rb[r.err];return r.result}zI.prototype.push=function(e,t){const r=this.strm,n=this.options.chunkSize,i=this.options.dictionary;let o,s,a;if(this.ended)return!1;for(s=t===~~t?t:!0===t?FI:VI,"[object ArrayBuffer]"===xI.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;){for(0===r.avail_out&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),o=MI.inflate(r,s),o===GI&&i&&(o=MI.inflateSetDictionary(r,i),o===BI?o=MI.inflate(r,s):o===HI&&(o=GI));r.avail_in>0&&o===jI&&r.state.wrap>0&&0!==e[r.next_in];)MI.inflateReset(r),o=MI.inflate(r,s);switch(o){case WI:case HI:case GI:case KI:return this.onEnd(o),this.ended=!0,!1}if(a=r.avail_out,r.next_out&&(0===r.avail_out||o===jI))if("string"===this.options.to){let e=PA.utf8border(r.output,r.next_out),t=r.next_out-e,i=PA.buf2string(r.output,e);r.next_out=t,r.avail_out=n-t,t&&r.output.set(r.output.subarray(e,e+t),0),this.onData(i)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(o!==BI||0!==a){if(o===jI)return o=MI.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,!0;if(0===r.avail_in)break}}return!0},zI.prototype.onData=function(e){this.chunks.push(e)},zI.prototype.onEnd=function(e){e===BI&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=NA.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var XI={Inflate:zI,inflate:YI,inflateRaw:function(e,t){return(t=t||{}).raw=!0,YI(e,t)},ungzip:YI,constants:bb};const{Deflate:JI,deflate:ZI,deflateRaw:qI,gzip:$I}=YA,{Inflate:QI,inflate:eO,inflateRaw:tO,ungzip:rO}=XI;var nO,iO=ZI,oO=eO;!function(e){e[e.ONE_BYTE=0]="ONE_BYTE",e[e.TWO_BYTE=1]="TWO_BYTE"}(nO||(nO={}));class sO{constructor(){this._sequence=0,this._startTime=Date.now(),this.isUseOneByte=!0}get startTime(){const e=Date.now()-this._startTime;return e<Math.pow(2,16)?e:(this._startTime+=Math.pow(2,16),this.startTime)}get sequence(){return this._sequence<Math.pow(2,32)?this._sequence++:(this._sequence-=Math.pow(2,32),this.sequence)}serialize(e){const t={commonPacketHeader:{length:0,reserved:0,extension:0,sequence:this.sequence},commonStreamHeader:this.startTime,extension:void 0,payload:e};if(e.byteLength>128){const r=new Uint8Array(4);r.set([1,0,0,0]);const n={id:0,length:4,data:r.buffer},i={profile:this.isUseOneByte?0:1,length:this.isUseOneByte?5:6,datas:[n]};t.commonPacketHeader.extension=1,t.extension=i,t.payload=this.compress(e),t.commonPacketHeader.length=8+(t.extension.length+2)+t.payload.byteLength}else t.commonPacketHeader.length=8+t.payload.byteLength;bn("SHOW_DATASTREAM2_LOG")&&Un.debug("send data header: ".concat(JSON.stringify(t.commonPacketHeader)));const r=new ArrayBuffer(t.commonPacketHeader.length),n=new Uint8Array(r),i=new DataView(r);let o=0;if(i.setUint16(o,t.commonPacketHeader.extension<<15|t.commonPacketHeader.reserved<<14|t.commonPacketHeader.length,!0),o+=2,i.setUint32(o,t.commonPacketHeader.sequence,!0),o+=4,i.setUint16(o,t.commonStreamHeader,!0),o+=2,t.extension){const e=this.serializeExtension(t.extension);n.set(new Uint8Array(e),o),o+=e.byteLength}if(n.set(new Uint8Array(t.payload),o),o+=t.payload.byteLength,o!==t.commonPacketHeader.length)throw Error("serialize error!");return r}deserialize(e){if(e.byteLength<4)return new ArrayBuffer(0);const t=new DataView(e);let r=0;const n=t.getUint16(r,!0);r+=2;const i={length:16383&n,reserved:(16384&n)>>14,extension:(32768&n)>>15,sequence:t.getUint16(r+2,!0)<<16|t.getUint16(r,!0)};let o,s;if(r+=4,bn("SHOW_DATASTREAM2_LOG")&&Un.debug("receive data header: ".concat(JSON.stringify(i))),t.getUint16(r,!0),r+=2,i.extension){s=this.deserializeExtension(e.slice(r)),r+=2+s.length,o=e.slice(r);let t=!1;if(s.datas.length>0){const e=s.datas.find((e=>0===e.id));if(e){t=1==(1&new DataView(e.data).getUint32(0,!0))}}o=t?this.decompress(o):o}else o=e.slice(8);return o}serializeExtension(e){const{profile:t,length:r,datas:n}=e,i=new ArrayBuffer(r+2),o=new Uint8Array(i),s=new DataView(i);let a=0;if(s.setUint8(a++,t),s.setUint8(a++,r),n.forEach((e=>{t?(s.setUint8(a++,e.id),s.setUint8(a++,e.length),o.set(new Uint8Array(e.data),a),a+=e.data.byteLength):(s.setUint8(a++,e.id|e.length<<4),o.set(new Uint8Array(e.data),a),a+=e.data.byteLength)})),a!==r+2)throw Error("serialize extension error, is ".concat(a,"!==").concat(r+2));return i}deserializeExtension(e){const t=new DataView(e);let r=0;const n=t.getUint8(r);r++;const i=t.getUint8(r);r++;const o=n===nO.TWO_BYTE,s=[],a=new DataView(e,2);let c=0;for(;c<i;){let e=0,t=0,r=new ArrayBuffer(0);o?(e=a.getUint8(c),c++,t=a.getUint8(c),c++):(e=15&a.getUint8(c),t=a.getUint8(c)>>4,c++),t>0&&(r=a.buffer.slice(c+2,c+2+t),c+=r.byteLength),s.push({id:e,length:t,data:r})}if(c!==i)throw Error("parse error");return{profile:n,length:i,datas:s}}decompress(e){return oO(new Uint8Array(e))}compress(e){return iO(new Uint8Array(e))}}class aO extends Ke{constructor(e,t){super(),this._version=1,this._type=3,this._config=void 0,this._originDataChannel=void 0,this._dataStreamPacketHeader=new ArrayBuffer(4),this._dataStreamPacketHandler=void 0,this._datachannelEventMap=new Map,this._config=e,t&&(this._originDataChannel=t,this._bandDataChannelEvents(t)),this._initPacketHeader(),this._dataStreamPacketHandler=new sO}get id(){return this._config.id}get ordered(){return this._config.ordered}get maxRetransmits(){return bn("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 Vv(((e,t)=>{if(this._originDataChannel){"open"===this._originDataChannel.readyState&&e();const r=setTimeout((()=>{var e;t(new xe(Le.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 xe(Le.DATACHANNEL_CONNECTION_TIMEOUT)}}else t(new xe(Le.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(t){this._unbindDataChannelEvents(t),[e.DataChannelEvents.OPEN,e.DataChannelEvents.CLOSE,e.DataChannelEvents.ERROR].forEach((e=>{const r=()=>{this.emit(e)};this._datachannelEventMap.set(e,r),t.addEventListener(e,r)}))}_unbindDataChannelEvents(e){Array.from(this._datachannelEventMap.entries()).forEach((t=>{let[r,n]=t;e.removeEventListener(r,n)})),this._datachannelEventMap.clear()}}var cO=Zn,dO=ss("iterator"),uO=!cO((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r=new URLSearchParams("a=1&a=2"),n="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),n+=r+e})),r.delete("a",2),!e.toJSON||!r.has("a",1)||r.has("a",2)||!t.size&&true||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[dO]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==n||"x"!==new URL("http://x",void 0).host})),lO=cl,hO=el,pO=Math.floor,fO=function(e,t){var r=e.length,n=pO(r/2);return r<8?_O(e,t):EO(e,fO(hO(e,0,n),t),fO(hO(e,n),t),t)},_O=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},EO=function(e,t,r,n){for(var i=t.length,o=r.length,s=0,a=0;s<i||a<o;)e[s+a]=s<i&&a<o?n(t[s],r[a])<=0?t[s++]:r[a++]:s<i?t[s++]:r[a++];return e},mO=ya,gO=oi,TO=Ii,SO=ri,vO=Ri,yO=uO,RO=cl,bO=ul,AO=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:lO(e,n,t[n],r);return e},IO=Ll,OO=Yf,CO=Zl,wO=hg,NO=vi,kO=zo,DO=Hs,PO=nc,LO=Zs,MO=Xi,UO=sc,xO=Hu,VO=Pi,FO=gm,BO=lm,jO=yg,GO=fO,WO=ss("iterator"),HO="URLSearchParams",KO=HO+"Iterator",zO=CO.set,YO=CO.getterFor(HO),XO=CO.getterFor(KO),JO=Object.getOwnPropertyDescriptor,ZO=function(e){if(!vO)return gO[e];var t=JO(gO,e);return t&&t.value},qO=ZO("fetch"),$O=ZO("Request"),QO=ZO("Headers"),eC=$O&&$O.prototype,tC=QO&&QO.prototype,rC=gO.RegExp,nC=gO.TypeError,iC=gO.decodeURIComponent,oC=gO.encodeURIComponent,sC=SO("".charAt),aC=SO([].join),cC=SO([].push),dC=SO("".replace),uC=SO([].shift),lC=SO([].splice),hC=SO("".split),pC=SO("".slice),fC=/\+/g,_C=Array(4),EC=function(e){return _C[e-1]||(_C[e-1]=rC("((?:%[\\da-f]{2}){"+e+"})","gi"))},mC=function(e){try{return iC(e)}catch(t){return e}},gC=function(e){var t=dC(e,fC," "),r=4;try{return iC(t)}catch(e){for(;r;)t=dC(t,EC(r--),mC);return t}},TC=/[!'()~]|%20/g,SC={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},vC=function(e){return SC[e]},yC=function(e){return dC(oC(e),TC,vC)},RC=OO((function(e,t){zO(this,{type:KO,iterator:FO(YO(e).entries),kind:t})}),"Iterator",(function(){var e=XO(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),bC=function(e){this.entries=[],this.url=null,void 0!==e&&(MO(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===sC(e,0)?pC(e,1):e:UO(e)))};bC.prototype={type:HO,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,s,a,c=BO(e);if(c)for(r=(t=FO(e,c)).next;!(n=TO(r,t)).done;){if(o=(i=FO(LO(n.value))).next,(s=TO(o,i)).done||(a=TO(o,i)).done||!TO(o,i).done)throw nC("Expected sequence with length 2");cC(this.entries,{key:UO(s.value),value:UO(a.value)})}else for(var d in e)kO(e,d)&&cC(this.entries,{key:d,value:UO(e[d])})},parseQuery:function(e){if(e)for(var t,r,n=hC(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=hC(t,"="),cC(this.entries,{key:gC(uC(r)),value:gC(aC(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],cC(r,yC(e.key)+"="+yC(e.value));return aC(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var AC=function(){wO(this,IC);var e=zO(this,new bC(arguments.length>0?arguments[0]:void 0));vO||(this.size=e.entries.length)},IC=AC.prototype;if(AO(IC,{append:function(e,t){var r=YO(this);jO(arguments.length,2),cC(r.entries,{key:UO(e),value:UO(t)}),vO||this.length++,r.updateURL()},delete:function(e){for(var t=YO(this),r=jO(arguments.length,1),n=t.entries,i=UO(e),o=r<2?void 0:arguments[1],s=void 0===o?o:UO(o),a=0;a<n.length;){var c=n[a];if(c.key!==i||void 0!==s&&c.value!==s)a++;else if(lC(n,a,1),void 0!==s)break}vO||(this.size=n.length),t.updateURL()},get:function(e){var t=YO(this).entries;jO(arguments.length,1);for(var r=UO(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=YO(this).entries;jO(arguments.length,1);for(var r=UO(e),n=[],i=0;i<t.length;i++)t[i].key===r&&cC(n,t[i].value);return n},has:function(e){for(var t=YO(this).entries,r=jO(arguments.length,1),n=UO(e),i=r<2?void 0:arguments[1],o=void 0===i?i:UO(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=YO(this);jO(arguments.length,1);for(var n,i=r.entries,o=!1,s=UO(e),a=UO(t),c=0;c<i.length;c++)(n=i[c]).key===s&&(o?lC(i,c--,1):(o=!0,n.value=a));o||cC(i,{key:s,value:a}),vO||(this.size=i.length),r.updateURL()},sort:function(){var e=YO(this);GO(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=YO(this).entries,n=DO(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 RC(this,"keys")},values:function(){return new RC(this,"values")},entries:function(){return new RC(this,"entries")}},{enumerable:!0}),RO(IC,WO,IC.entries,{name:"entries"}),RO(IC,"toString",(function(){return YO(this).serialize()}),{enumerable:!0}),vO&&bO(IC,"size",{get:function(){return YO(this).entries.length},configurable:!0,enumerable:!0}),IO(AC,HO),mO({global:!0,constructor:!0,forced:!yO},{URLSearchParams:AC}),!yO&&NO(QO)){var OC=SO(tC.has),CC=SO(tC.set),wC=function(e){if(MO(e)){var t,r=e.body;if(PO(r)===HO)return t=e.headers?new QO(e.headers):new QO,OC(t,"content-type")||CC(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),xO(e,{body:VO(0,UO(r)),headers:VO(0,t)})}return e};if(NO(qO)&&mO({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return qO(e,arguments.length>1?wC(arguments[1]):{})}}),NO($O)){var NC=function(e){return wO(this,eC),new $O(e,arguments.length>1?wC(arguments[1]):{})};eC.constructor=NC,NC.prototype=eC,mO({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:NC})}}var kC,DC={URLSearchParams:AC,getState:YO},PC=Ri,LC=ri,MC=Ii,UC=Zn,xC=Tu,VC=sl,FC=Oi,BC=Wo,jC=Vi,GC=Object.assign,WC=Object.defineProperty,HC=LC([].concat),KC=!GC||UC((function(){if(PC&&1!==GC({b:1},GC(WC({},"a",{enumerable:!0,get:function(){WC(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=GC({},e)[r]||xC(GC({},t)).join("")!=n}))?function(e,t){for(var r=BC(e),n=arguments.length,i=1,o=VC.f,s=FC.f;n>i;)for(var a,c=jC(arguments[i++]),d=o?HC(xC(c),o(c)):xC(c),u=d.length,l=0;u>l;)a=d[l++],PC&&!MC(s,c,a)||(r[a]=c[a]);return r}:GC,zC=Zs,YC=ym,XC=Hs,JC=Ii,ZC=Wo,qC=function(e,t,r,n){try{return n?t(zC(r)[0],r[1]):t(r)}catch(t){YC(e,"throw",t)}},$C=om,QC=xd,ew=La,tw=Td,rw=gm,nw=lm,iw=Array,ow=ri,sw=2147483647,aw=/[^\0-\u007E]/,cw=/[.\u3002\uFF0E\uFF61]/g,dw="Overflow: input needs wider integers to process",uw=RangeError,lw=ow(cw.exec),hw=Math.floor,pw=String.fromCharCode,fw=ow("".charCodeAt),_w=ow([].join),Ew=ow([].push),mw=ow("".replace),gw=ow("".split),Tw=ow("".toLowerCase),Sw=function(e){return e+22+75*(e<26)},vw=function(e,t,r){var n=0;for(e=r?hw(e/700):e>>1,e+=hw(e/t);e>455;)e=hw(e/35),n+=36;return hw(n+36*e/(e+38))},yw=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=fw(e,r++);if(i>=55296&&i<=56319&&r<n){var o=fw(e,r++);56320==(64512&o)?Ew(t,((1023&i)<<10)+(1023&o)+65536):(Ew(t,i),r--)}else Ew(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&&Ew(t,pw(n));var c=t.length,d=c;for(c&&Ew(t,"-");d<i;){var u=sw;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<u&&(u=n);var l=d+1;if(u-o>hw((sw-s)/l))throw uw(dw);for(s+=(u-o)*l,o=u,r=0;r<e.length;r++){if((n=e[r])<o&&++s>sw)throw uw(dw);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 _=h-f,E=36-f;Ew(t,pw(Sw(f+_%E))),h=hw(_/E),p+=36}Ew(t,pw(Sw(h))),a=vw(s,l,d==c),s=0,d++}}s++,o++}return _w(t,"")},Rw=ya,bw=Ri,Aw=uO,Iw=oi,Ow=Hs,Cw=ri,ww=cl,Nw=ul,kw=hg,Dw=zo,Pw=KC,Lw=function(e){var t=ZC(e),r=QC(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=XC(i,n>2?arguments[2]:void 0));var s,a,c,d,u,l,h=nw(t),p=0;if(!h||this===iw&&$C(h))for(s=ew(t),a=r?new this(s):iw(s);s>p;p++)l=o?i(t[p],p):t[p],tw(a,p,l);else for(u=(d=rw(t,h)).next,a=r?new this:[];!(c=JC(u,d)).done;p++)l=o?qC(d,i,[c.value,p],!0):c.value,tw(a,p,l);return a.length=p,a},Mw=el,Uw=TE.codeAt,xw=function(e){var t,r,n=[],i=gw(mw(Tw(e),cw,"."),".");for(t=0;t<i.length;t++)r=i[t],Ew(n,lw(aw,r)?"xn--"+yw(r):r);return _w(n,".")},Vw=sc,Fw=Ll,Bw=yg,jw=DC,Gw=Zl,Ww=Gw.set,Hw=Gw.getterFor("URL"),Kw=jw.URLSearchParams,zw=jw.getState,Yw=Iw.URL,Xw=Iw.TypeError,Jw=Iw.parseInt,Zw=Math.floor,qw=Math.pow,$w=Cw("".charAt),Qw=Cw(/./.exec),eN=Cw([].join),tN=Cw(1..toString),rN=Cw([].pop),nN=Cw([].push),iN=Cw("".replace),oN=Cw([].shift),sN=Cw("".split),aN=Cw("".slice),cN=Cw("".toLowerCase),dN=Cw([].unshift),uN="Invalid scheme",lN="Invalid host",hN="Invalid port",pN=/[a-z]/i,fN=/[\d+-.a-z]/i,_N=/\d/,EN=/^0x/i,mN=/^[0-7]+$/,gN=/^\d+$/,TN=/^[\da-f]+$/i,SN=/[\0\t\n\r #%/:<>?@[\\\]^|]/,vN=/[\0\t\n\r #/:<>?@[\\\]^|]/,yN=/^[\u0000-\u0020]+/,RN=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,bN=/[\t\n\r]/g,AN=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)dN(t,e%256),e=Zw(e/256);return eN(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&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=tN(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},IN={},ON=Pw({},IN,{" ":1,'"':1,"<":1,">":1,"`":1}),CN=Pw({},ON,{"#":1,"?":1,"{":1,"}":1}),wN=Pw({},CN,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),NN=function(e,t){var r=Uw(e,0);return r>32&&r<127&&!Dw(t,e)?e:encodeURIComponent(e)},kN={ftp:21,file:null,http:80,https:443,ws:80,wss:443},DN=function(e,t){var r;return 2==e.length&&Qw(pN,$w(e,0))&&(":"==(r=$w(e,1))||!t&&"|"==r)},PN=function(e){var t;return e.length>1&&DN(aN(e,0,2))&&(2==e.length||"/"===(t=$w(e,2))||"\\"===t||"?"===t||"#"===t)},LN=function(e){return"."===e||"%2e"===cN(e)},MN={},UN={},xN={},VN={},FN={},BN={},jN={},GN={},WN={},HN={},KN={},zN={},YN={},XN={},JN={},ZN={},qN={},$N={},QN={},ek={},tk={},rk=function(e,t,r){var n,i,o,s=Vw(e);if(t){if(i=this.parse(s))throw Xw(i);this.searchParams=null}else{if(void 0!==r&&(n=new rk(r,!0)),i=this.parse(s,null,n))throw Xw(i);(o=zw(new Kw)).bindURL(this),this.searchParams=o}};rk.prototype={type:"URL",parse:function(e,t,r){var n,i,o,s,a,c=this,d=t||MN,u=0,l="",h=!1,p=!1,f=!1;for(e=Vw(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=iN(e,yN,""),e=iN(e,RN,"$1")),e=iN(e,bN,""),n=Lw(e);u<=n.length;){switch(i=n[u],d){case MN:if(!i||!Qw(pN,i)){if(t)return uN;d=xN;continue}l+=cN(i),d=UN;break;case UN:if(i&&(Qw(fN,i)||"+"==i||"-"==i||"."==i))l+=cN(i);else{if(":"!=i){if(t)return uN;l="",d=xN,u=0;continue}if(t&&(c.isSpecial()!=Dw(kN,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&kN[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?d=XN:c.isSpecial()&&r&&r.scheme==c.scheme?d=VN:c.isSpecial()?d=GN:"/"==n[u+1]?(d=FN,u++):(c.cannotBeABaseURL=!0,nN(c.path,""),d=QN)}break;case xN:if(!r||r.cannotBeABaseURL&&"#"!=i)return uN;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=Mw(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,d=tk;break}d="file"==r.scheme?XN:BN;continue;case VN:if("/"!=i||"/"!=n[u+1]){d=BN;continue}d=WN,u++;break;case FN:if("/"==i){d=HN;break}d=$N;continue;case BN:if(c.scheme=r.scheme,i==kC)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=Mw(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())d=jN;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=Mw(r.path),c.query="",d=ek;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=Mw(r.path),c.path.length--,d=$N;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=Mw(r.path),c.query=r.query,c.fragment="",d=tk}break;case jN:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,d=$N;continue}d=HN}else d=WN;break;case GN:if(d=WN,"/"!=i||"/"!=$w(l,u+1))continue;u++;break;case WN:if("/"!=i&&"\\"!=i){d=HN;continue}break;case HN:if("@"==i){h&&(l="%40"+l),h=!0,o=Lw(l);for(var _=0;_<o.length;_++){var E=o[_];if(":"!=E||f){var m=NN(E,wN);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(i==kC||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";u-=Lw(l).length+1,l="",d=KN}else l+=i;break;case KN:case zN:if(t&&"file"==c.scheme){d=ZN;continue}if(":"!=i||p){if(i==kC||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return lN;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(l))return s;if(l="",d=qN,t)return;continue}"["==i?p=!0:"]"==i&&(p=!1),l+=i}else{if(""==l)return lN;if(s=c.parseHost(l))return s;if(l="",d=YN,t==zN)return}break;case YN:if(!Qw(_N,i)){if(i==kC||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var g=Jw(l,10);if(g>65535)return hN;c.port=c.isSpecial()&&g===kN[c.scheme]?null:g,l=""}if(t)return;d=qN;continue}return hN}l+=i;break;case XN:if(c.scheme="file","/"==i||"\\"==i)d=JN;else{if(!r||"file"!=r.scheme){d=$N;continue}if(i==kC)c.host=r.host,c.path=Mw(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=Mw(r.path),c.query="",d=ek;else{if("#"!=i){PN(eN(Mw(n,u),""))||(c.host=r.host,c.path=Mw(r.path),c.shortenPath()),d=$N;continue}c.host=r.host,c.path=Mw(r.path),c.query=r.query,c.fragment="",d=tk}}break;case JN:if("/"==i||"\\"==i){d=ZN;break}r&&"file"==r.scheme&&!PN(eN(Mw(n,u),""))&&(DN(r.path[0],!0)?nN(c.path,r.path[0]):c.host=r.host),d=$N;continue;case ZN:if(i==kC||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&DN(l))d=$N;else if(""==l){if(c.host="",t)return;d=qN}else{if(s=c.parseHost(l))return s;if("localhost"==c.host&&(c.host=""),t)return;l="",d=qN}continue}l+=i;break;case qN:if(c.isSpecial()){if(d=$N,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=kC&&(d=$N,"/"!=i))continue}else c.fragment="",d=tk;else c.query="",d=ek;break;case $N:if(i==kC||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(a=cN(a=l))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||nN(c.path,"")):LN(l)?"/"==i||"\\"==i&&c.isSpecial()||nN(c.path,""):("file"==c.scheme&&!c.path.length&&DN(l)&&(c.host&&(c.host=""),l=$w(l,0)+":"),nN(c.path,l)),l="","file"==c.scheme&&(i==kC||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)oN(c.path);"?"==i?(c.query="",d=ek):"#"==i&&(c.fragment="",d=tk)}else l+=NN(i,CN);break;case QN:"?"==i?(c.query="",d=ek):"#"==i?(c.fragment="",d=tk):i!=kC&&(c.path[0]+=NN(i,IN));break;case ek:t||"#"!=i?i!=kC&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":NN(i,IN)):(c.fragment="",d=tk);break;case tk:i!=kC&&(c.fragment+=NN(i,ON))}u++}},parseHost:function(e){var t,r,n;if("["==$w(e,0)){if("]"!=$w(e,e.length-1))return lN;if(t=function(e){var t,r,n,i,o,s,a,c=[0,0,0,0,0,0,0,0],d=0,u=null,l=0,h=function(){return $w(e,l)};if(":"==h()){if(":"!=$w(e,1))return;l+=2,u=++d}for(;h();){if(8==d)return;if(":"!=h()){for(t=r=0;r<4&&Qw(TN,h());)t=16*t+Jw(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,d>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!Qw(_N,h()))return;for(;Qw(_N,h());){if(o=Jw(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[d]=256*c[d]+i,2!=++n&&4!=n||d++}if(4!=n)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[d++]=t}else{if(null!==u)return;l++,u=++d}}if(null!==u)for(s=d-u,d=7;0!=d&&s>0;)a=c[d],c[d--]=c[u+s-1],c[u+--s]=a;else if(8!=d)return;return c}(aN(e,1,-1)),!t)return lN;this.host=t}else if(this.isSpecial()){if(e=xw(e),Qw(SN,e))return lN;if(t=function(e){var t,r,n,i,o,s,a,c=sN(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==$w(i,0)&&(o=Qw(EN,i)?16:8,i=aN(i,8==o?1:2)),""===i)s=0;else{if(!Qw(10==o?gN:8==o?mN:TN,i))return e;s=Jw(i,o)}nN(r,s)}for(n=0;n<t;n++)if(s=r[n],n==t-1){if(s>=qw(256,5-t))return null}else if(s>255)return null;for(a=rN(r),n=0;n<r.length;n++)a+=r[n]*qw(256,3-n);return a}(e),null===t)return lN;this.host=t}else{if(Qw(vN,e))return lN;for(t="",r=Lw(e),n=0;n<r.length;n++)t+=NN(r[n],IN);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return Dw(kN,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&DN(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,d=t+":";return null!==i?(d+="//",e.includesCredentials()&&(d+=r+(n?":"+n:"")+"@"),d+=AN(i),null!==o&&(d+=":"+o)):"file"==t&&(d+="//"),d+=e.cannotBeABaseURL?s[0]:s.length?"/"+eN(s,"/"):"",null!==a&&(d+="?"+a),null!==c&&(d+="#"+c),d},setHref:function(e){var t=this.parse(e);if(t)throw Xw(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new nk(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+AN(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Vw(e)+":",MN)},getUsername:function(){return this.username},setUsername:function(e){var t=Lw(Vw(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=NN(t[r],wN)}},getPassword:function(){return this.password},setPassword:function(e){var t=Lw(Vw(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=NN(t[r],wN)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?AN(e):AN(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,KN)},getHostname:function(){var e=this.host;return null===e?"":AN(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,zN)},getPort:function(){var e=this.port;return null===e?"":Vw(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=Vw(e))?this.port=null:this.parse(e,YN))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+eN(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,qN))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=Vw(e))?this.query=null:("?"==$w(e,0)&&(e=aN(e,1)),this.query="",this.parse(e,ek)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=Vw(e))?("#"==$w(e,0)&&(e=aN(e,1)),this.fragment="",this.parse(e,tk)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var nk=function(e){var t=kw(this,ik),r=Bw(arguments.length,1)>1?arguments[1]:void 0,n=Ww(t,new rk(e,!1,r));bw||(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())},ik=nk.prototype,ok=function(e,t){return{get:function(){return Hw(this)[e]()},set:t&&function(e){return Hw(this)[t](e)},configurable:!0,enumerable:!0}};if(bw&&(Nw(ik,"href",ok("serialize","setHref")),Nw(ik,"origin",ok("getOrigin")),Nw(ik,"protocol",ok("getProtocol","setProtocol")),Nw(ik,"username",ok("getUsername","setUsername")),Nw(ik,"password",ok("getPassword","setPassword")),Nw(ik,"host",ok("getHost","setHost")),Nw(ik,"hostname",ok("getHostname","setHostname")),Nw(ik,"port",ok("getPort","setPort")),Nw(ik,"pathname",ok("getPathname","setPathname")),Nw(ik,"search",ok("getSearch","setSearch")),Nw(ik,"searchParams",ok("getSearchParams")),Nw(ik,"hash",ok("getHash","setHash"))),ww(ik,"toJSON",(function(){return Hw(this).serialize()}),{enumerable:!0}),ww(ik,"toString",(function(){return Hw(this).serialize()}),{enumerable:!0}),Yw){var sk=Yw.createObjectURL,ak=Yw.revokeObjectURL;sk&&ww(nk,"createObjectURL",Ow(sk,Yw)),ak&&ww(nk,"revokeObjectURL",Ow(ak,Yw))}Fw(nk,"URL"),Rw({global:!0,constructor:!0,forced:!Aw,sham:!bw},{URL:nk});var ck=ya,dk=Zn,uk=yg,lk=sc,hk=uO,pk=eo("URL");ck({target:"URL",stat:!0,forced:!(hk&&dk((function(){pk.canParse()})))},{canParse:function(e){var t=uk(arguments.length,1),r=lk(e),n=t<2||void 0===arguments[1]?void 0:lk(arguments[1]);try{return!!new pk(r,n)}catch(e){return!1}}});var fk=J(Ji.URL);function _k(){const e=new Blob([atob("ZnVuY3Rpb24gZShlKXtjb25zdCB0PW5ldyBEYXRhVmlldyhlLmRhdGEpO2lmKDA9PT10LmdldFVpbnQ4KDApJiYwPT09dC5nZXRVaW50OCgxKSYmMD09PXQuZ2V0VWludDgoMikmJjE9PT10LmdldFVpbnQ4KDMpJiY2PT09dC5nZXRVaW50OCg0KSl7bGV0IG49NixyPTAsbz0wO2Zvcig7MjU1PT09KG89dC5nZXRVaW50OChuKyspKTspcis9MjU1O3IrPW87Y29uc3QgYT1mdW5jdGlvbihlLHQsbil7bGV0IHI9bmV3IFVpbnQ4QXJyYXkoZSx0LG4pLG89W10sYT0wO2Zvcig7YTxuOylhKzM8biYmMD09PXJbYV0mJjA9PT1yW2ErMV0mJjM9PT1yW2ErMl0mJigwPT09clthKzNdfHwxPT09clthKzNdfHwyPT09clthKzNdfHwzPT09clthKzNdKT8oby5wdXNoKHJbYV0sclthKzFdLHJbYSszXSksYSs9NCk6KG8ucHVzaChyW2FdKSxhKyspO3JldHVybiBuZXcgVWludDhBcnJheShvKX0oZS5kYXRhLG4scik7cmV0dXJuIG5ldyBVaW50OEFycmF5KGEpfXJldHVybiBudWxsfWZ1bmN0aW9uIHQoZSx0KXtjb25zdCBuPWZ1bmN0aW9uKGUpe2NvbnN0IHQ9ZS5sZW5ndGg7bGV0IG49W10scj0wO2Zvcig7cjx0OylyKzI8dCYmMD09PWVbcl0mJjA9PT1lW3IrMV0mJigwPT09ZVtyKzJdfHwxPT09ZVtyKzJdfHwyPT09ZVtyKzJdfHwzPT09ZVtyKzJdKT8obi5wdXNoKGVbcl0sZVtyKzFdLDMsZVtyKzJdKSxyKz0zKToobi5wdXNoKGVbcl0pLHIrKyk7cmV0dXJuIG5ldyBVaW50OEFycmF5KG4pfSh0KSxyPW4ubGVuZ3RoLG89TWF0aC5mbG9vcihyLzI1NSksYT1yJTI1NSxzPW5ldyBVaW50OEFycmF5KDYrbysxK3IrZS5ieXRlTGVuZ3RoKTtzWzBdPTAsc1sxXT0wLHNbMl09MCxzWzNdPTEsc1s0XT02LHNbNV09MTAxO2xldCBpPTA7Zm9yKDtpPG87KXNbNitpXT0yNTUsaSsrO3JldHVybiBzWzYraV09YSxpKysscy5zZXQobiw2K2kpLHMuc2V0KG5ldyBVaW50OEFycmF5KGUpLDYraStyKSxzLmJ1ZmZlcn1uYXZpZ2F0b3IudXNlckFnZW50LmluZGV4T2YoIlNhZmFyaSIpPi0xJiYtMT09PW5hdmlnYXRvci51c2VyQWdlbnQuaW5kZXhPZigiQ2hyb21lIikmJihzZWxmLm9ucnRjdHJhbnNmb3JtPW49Pntjb25zdCByPW4udHJhbnNmb3JtZXI7bGV0IG89W107ci5vcHRpb25zLnBvcnQub25tZXNzYWdlPWU9PntlLmRhdGEuc2VpJiZvLnB1c2goZS5kYXRhLnNlaSl9LHNlbGYucG9zdE1lc3NhZ2UoInN0YXJ0ZWQiKTtjb25zdCBhPXIucmVhZGFibGUuZ2V0UmVhZGVyKCkscz1yLndyaXRhYmxlLmdldFdyaXRlcigpOyJyeCI9PT1yLm9wdGlvbnMubmFtZT9mdW5jdGlvbiB0KG4pe2EucmVhZCgpLnRoZW4oKHI9PntpZighci5kb25lKXtpZihyLnZhbHVlIGluc3RhbmNlb2YgUlRDRW5jb2RlZFZpZGVvRnJhbWUpe2NvbnN0IHQ9ZShyLnZhbHVlKTt0JiZuLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7c2VpOnR9KX1zLndyaXRlKHIudmFsdWUpLG4ub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQobil9fSkpfShyKToidHgiPT09ci5vcHRpb25zLm5hbWUmJmZ1bmN0aW9uIGUobil7YS5yZWFkKCkudGhlbigocj0+e2lmKCFyLmRvbmUpe2lmKHIudmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3QgZT1vLnNoaWZ0KCk7ZSYmKHIudmFsdWUuZGF0YT10KHIudmFsdWUuZGF0YSxlKSl9cy53cml0ZShyLnZhbHVlKSxuLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSxlKG4pfX0pKX0ocil9LHNlbGYucG9zdE1lc3NhZ2UoInJlZ2lzdGVyZWQiKSk7Cg==")],{type:"text/javascript"});return setTimeout((()=>fk.revokeObjectURL(e)),0),new Worker(fk.createObjectURL(e))}const Ek=new Map;const mk=new Map;function gk(e){const t=new DataView(e.data);if(0===t.getUint8(0)&&0===t.getUint8(1)&&0===t.getUint8(2)&&1===t.getUint8(3)&&6===t.getUint8(4)){let r=6,n=0,i=0;for(;255===(i=t.getUint8(r++));)n+=255;n+=i;const o=function(e,t,r){let n=new Uint8Array(e,t,r),i=[],o=0;for(;o<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)}(e.data,r,n);return new Uint8Array(o)}return null}function Tk(e,t){const r=function(e){const t=e.length;let r=[],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)}(t),n=r.length,i=Math.floor(n/255),o=n%255,s=new Uint8Array(6+i+1+n+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),s.set(new Uint8Array(e),6+a+n),s.buffer}const Sk=new Map;const vk=new Map;Yn(),e.AUDIO_ENCODER_CONFIG_SETTINGS=Dc,e.AudioProcessorContext=$y,e.AudioProcessorDestination=qy,e.BufferSourceAudioTrack=oR,e.CameraVideoTrack=IR,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=Jc,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=Zc,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=qc,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=$c,e.DataChannel=aO,e.DeviceManager=Cy,e.LocalAudioTrack=nR,e.LocalDataChannel=class extends aO{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=Gv,e.LocalVideoTrack=AR,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.MicrophoneAudioTrack=iR,e.MixingAudioTrack=sR,e.RemoteAudioTrack=LR,e.RemoteDataChannel=class extends aO{constructor(t){super(t),this._messageListener=void 0,this._messageListener=t=>{if(t.data.byteLength<this._dataStreamPacketHeader.byteLength)throw Error("invalid byteLength: the byte length must exceed "+this._dataStreamPacketHeader.byteLength);const r=t.data.slice(0,this._dataStreamPacketHeader.byteLength),n=new DataView(r).getUint8(3);if(n!==this.id)return void(bn("SHOW_DATASTREAM2_LOG")&&Un.debug("invalid datachannel id: ".concat(n," !== ").concat(this.id)));let i=t.data.slice(this._dataStreamPacketHeader.byteLength);i=this._dataStreamPacketHandler.deserialize(i),this.emit(e.DataChannelEvents.MESSAGE,i)}}_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.RemoteTrack=DR,e.RemoteVideoTrack=PR,e.SAFARI_GLOBAL_GUM_LOCK=Ry,e.SUPPORT_720P_AUTO_CONFIG_LIST=Ic,e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=Oc,e.SUPPORT_SVC_CONFIG_LIST=Cc,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=Ac,e.Track=jv,e.VideoProcessorContext=Zy,e.VideoProcessorDestination=Jy,e.__TRACK_LIST__=Lc,e.addTrack=Mc,e.audioContextState=zv,e.audioElementPlayCenter=xy,e.audioTimerLoop=function(e,t){let r=!1;const n=1/t;if(bn("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*n)}else{const t=Xv();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=ky,e.blob2Uint8Array=pR,e.checkMediaStreamTrackResolution=TR,e.checkTrackState=Vy,e.createBufferSourceAudioTrack=async function(e){var t;const{cacheOnlineFile:r,encoderConfig:n}=e;let{source:i}=e;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=Kn.reportApiInvoke(null,{tag:Ze.TRACER,name:Je.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(bn("DISABLE_WEBAUDIO"))throw new xe(Le.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");const a=_t(8,"track-buf-");Un.info("start create buffer source audio track with config",JSON.stringify(o),"trackId",a);const c=i;if(!(i instanceof AudioBuffer))try{i=await async function(e,t){let r=null;if("string"==typeof e){const t=lR.get(e);if(t)return Un.debug("use cached audio resource: ",e),t;try{r=(await It((()=>fn.get(e,{responseType:"arraybuffer"})),void 0,void 0,{maxRetryCount:3})).data}catch(e){throw new xe(Le.FETCH_AUDIO_FILE_FAILED,e.toString())}}else{const t=new Vv(((t,r)=>{const n=new FileReader;n.onload=e=>{e.target?t(e.target.result):r(new xe(Le.READ_LOCAL_AUDIO_FILE_ERROR))},n.onerror=()=>{r(new xe(Le.READ_LOCAL_AUDIO_FILE_ERROR))},n.readAsArrayBuffer(e)}));r=await t}const n=await qv(r);return"string"==typeof e&&t&&lR.set(e,n),n}(i,r)}catch(e){return s.onError(e),e.throw(Un)}const d=new uR(i),u=new oR(c,d,n?Pc(n):{},a);return Un.info("create buffer source audio track success, trackId:",a),s.onSuccess(u.getTrackId()),u},e.createCameraVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Kn.reportApiInvoke(null,{tag:Ze.TRACER,name:Je.CREATE_CAM_VIDEO_TRACK,options:[CR({},e)]}),r=aR(e),n=_t(8,"track-cam-");let i=null;const o="720p_auto"===e.encoderConfig;Un.info("start create camera video track with config",JSON.stringify(e),"trackId",n);try{i=(await by({video:r},n)).getVideoTracks()[0]||null}catch(e){throw t.onError(e),e}if(!i){const e=new xe(Le.UNEXPECTED_ERROR,"can not find track in media stream");return t.onError(e),e.throw(Un)}e.optimizationMode&&wR(n,i,e,wc(e.encoderConfig));const s=new IR(i,e,r,e.scalabiltyMode?kc(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,n);return o&&s.startMonitorStats(),t.onSuccess(s.getTrackId()),Un.info("create camera video success, trackId:",n),s},e.createCustomAudioTrack=function(e){const t=Kn.reportApiInvoke(null,{tag:Ze.TRACER,name:Je.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),r=new nR(e.mediaStreamTrack,e.encoderConfig?Pc(e.encoderConfig):{},_t(8,"track-cus-"),!1);return Un.info("create custom audio track success with config",e,"trackId",r.getTrackId()),t.onSuccess(r.getTrackId()),r},e.createCustomVideoTrack=function(t){const r=Kn.reportApiInvoke(null,{tag:Ze.TRACER,name:Je.CREATE_CUSTOM_VIDEO_TRACK,options:[t]}),n=new AR(t.mediaStreamTrack,{width:t.width,height:t.height,frameRate:t.frameRate,bitrateMax:t.bitrateMax,bitrateMin:t.bitrateMin},t.scalabiltyMode?kc(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,_t(8,"track-cus-"),[e.TrackHint.CUSTOM_TRACK]);return r.onSuccess(n.getTrackId()),Un.info("create custom video track success with config",t,"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=Kn.reportApiInvoke(null,{tag:Ze.TRACER,name:Je.CREATE_MIC_AND_CAM_TRACKS,options:[e,t]}),n="720p_auto"===t.encoderConfig,i=aR(t),o=dR(e),s=_t(8,"track-mic-"),a=_t(8,"track-cam-");let c=null,d=null;Un.info("start create camera video track(".concat(a,") and microphone audio track(").concat(s,") with config, audio: ").concat(JSON.stringify(e),", video: ").concat(JSON.stringify(t)));try{const e=await by({audio:o,video:i},"".concat(s,"-").concat(a));c=e.getAudioTracks()[0],d=e.getVideoTracks()[0]}catch(e){throw r.onError(e),e}if(!c||!d){const e=new xe(Le.UNEXPECTED_ERROR,"can not find tracks in media stream");return r.onError(e),e.throw(Un)}t.optimizationMode&&wR(a,d,t,wc(t.encoderConfig));const u=new iR(c,e,o,s),l=new IR(d,t,i,t.scalabiltyMode?kc(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,a);return n&&l.startMonitorStats(),r.onSuccess([u.getTrackId(),l.getTrackId()]),Un.info("create camera video track(".concat(a,") and microphone audio track(").concat(s,") success")),[u,l]},e.createMicrophoneAudioTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=Kn.reportApiInvoke(null,{tag:Ze.TRACER,name:Je.CREATE_MIC_AUDIO_TRACK,options:[e]}),r=dR(e),n=_t(8,"track-mic-");let i=null;Un.info("start create microphone audio track with config",JSON.stringify(e),"trackId",n);try{i=(await by({audio:r},n)).getAudioTracks()[0]||null}catch(e){throw t.onError(e),e}if(!i){const e=new xe(Le.UNEXPECTED_ERROR,"can not find track in media stream");return t.onError(e),e.throw(Un)}const o=new iR(i,e,r,n);return t.onSuccess(o.getTrackId()),Un.info("create microphone audio track success, trackId:",n),o},e.createMixingAudioTrack=function(e){const t=new sR;return e.forEach((e=>t.addAudioTrack(e))),t},e.createScreenVideoTrack=async function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"disable";const n=Kn.reportApiInvoke(null,{tag:Ze.TRACER,name:Je.CREATE_SCREEN_VIDEO_TRACK,options:[CR({},t),r]}),i="720p_auto"===t.encoderConfig;t.encoderConfig?"string"==typeof t.encoderConfig||t.encoderConfig.width&&t.encoderConfig.height||(t.encoderConfig.width={max:1920},t.encoderConfig.height={max:1080}):t.encoderConfig="1080p_2";const o=cR(t),s=_t(8,"track-scr-v-");let a=null,c=null;const d=Xn();if(!d.supportShareAudio&&"enable"===r){const e=new xe(Le.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio");return n.onError(e),e.throw(Un)}Un.info("start create screen video track with config",t,"withAudio",r,"trackId",s);try{const e=await by({screen:o,screenAudio:"auto"===r?d.supportShareAudio:"enable"===r},s);a=e.getVideoTracks()[0]||null,c=e.getAudioTracks()[0]||null}catch(e){throw n.onError(e),e}if(!a){const e=new xe(Le.UNEXPECTED_ERROR,"can not find track in media stream");return n.onError(e),e.throw(Un)}if(!c&&"enable"===r){a&&a.stop();const e=new xe(Le.SHARE_AUDIO_NOT_ALLOWED);return n.onError(e),e.throw(Un)}if(t.optimizationMode||(t.optimizationMode="detail"),t.optimizationMode){wR(s,a,t,t.encoderConfig&&Nc(t.encoderConfig)||void 0),t.encoderConfig&&"string"!=typeof t.encoderConfig&&(t.encoderConfig.bitrateMin=t.encoderConfig.bitrateMax)}const u=new AR(a,t.encoderConfig?Nc(t.encoderConfig):{},t.scalabiltyMode?kc(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,s,[e.TrackHint.SCREEN_TRACK]);if(i&&u.startMonitorStats(),!c)return n.onSuccess(u.getTrackId()),Un.info("create screen video track success","video:",u.getTrackId()),u;const l=new nR(c,void 0,_t(8,"track-scr-a-"),!1);return n.onSuccess([u.getTrackId(),l.getTrackId()]),Un.info("create screen video track success","video:",u.getTrackId(),"audio:",l.getTrackId()),[u,l]},e.decodeAudioData=qv,e.deviceManager=wy,e.emptyImage2TypedArray=hR,e.frameData2CryptoBuffer=async(e,t,r)=>await vR(e.buffer,t,r),e.getAudioContext=Xv,e.getAudioEncoderConfiguration=Pc,e.getBitrateConstrainRange=SR,e.getCompatibility=Xn,e.getConstraintsFromCameraConfig=aR,e.getConstraintsFromMicrophoneConfig=dR,e.getConstraintsFromScreenConfig=cR,e.getElectronScreenSources=vy,e.getElectronScreenStream=Ty,e.getElectronScreenStreamByUserSelect=Sy,e.getLocalStream=by,e.getScalabilityConfiguration=kc,e.getScreenEncoderConfiguration=Nc,e.getSilenceAudioTrack=function(){if(Qv)return Qv;const e=Xv();if(!e.createMediaStreamDestination)throw new xe(Le.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),Qv=n.stream.getAudioTracks()[0],Qv},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=yR,e.getVideoEncoderConfiguration=wc,e.handleGetUserMediaError=Iy,e.hasAudioContext=Jv,e.interceptLocalAudioFrame=async function(e){if(!Xn().supportWebRTCEncodedTransform)return void Un.warning("browser not support audio encoded transform");if(Ek.has(e))return;if(!e.track)return;const t={track:e.track};if(Te()){if(!e.createEncodedStreams)return void Un.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void Un.error("create audio-encoded-streams error",e&&e.message)}const i=new TransformStream({transform(n,i){t.controller||(t.controller=i),e.track&&e.track.id!==t.track.id&&(Un.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r)),i.enqueue(n)}});n.readable.pipeThrough(i).pipeTo(n.writable)}else if(Se()){if("undefined"==typeof RTCRtpScriptTransform)return void Un.warning("browser not support RTCRtpScriptTransform");const n=_k(),i=new MessageChannel;await new Vv((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(n,{name:"tx",port:i.port2},[i.port2]);e.transform=o,await new Vv((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),i.port1.onmessage=n=>{var i;n.data.transformed&&e.track&&(null===(i=e.track)||void 0===i?void 0:i.id)!==t.track.id&&(Un.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r))},t.worker=n}function r(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",r)}const t=Ek.get(e);if(t){Ek.delete(e);try{var n,i;null===(n=t.controller)||void 0===n||n.terminate(),null===(i=t.worker)||void 0===i||i.terminate()}catch(e){Un.warning(e&&e.message)}}}Ek.set(e,t),e.track.addEventListener("ended",r)},e.interceptLocalVideoFrame=async function(e,t){if(!Xn().supportWebRTCEncodedTransform)return void Un.warning("browser not support video encoded transform");if(Sk.has(e))return;if(!e.track)return;const r={track:e.track};if(Te()){if(!e.createEncodedStreams)return void Un.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void Un.error("create video-encoded-streams error",e&&e.message)}let 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&&(Un.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=o.shift();s&&(t.data=Tk(t.data,s)),i.enqueue(t)}});i.readable.pipeThrough(s).pipeTo(i.writable)}else{if(!Se())return;{if("undefined"==typeof RTCRtpScriptTransform)return void Un.warning("browser not support RTCRtpScriptTransform");const i=_k(),o=new MessageChannel;await new Vv((e=>i.onmessage=t=>{"registered"===t.data&&e(void 0)}));const s=new RTCRtpScriptTransform(i,{name:"tx",port:o.port2},[o.port2]);e.transform=s,await new Vv((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&&(Un.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=Sk.get(e);if(t){Sk.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){Un.warning(e&&e.message)}}}Sk.set(e,r),e.track.addEventListener("ended",n)},e.interceptRemoteAudioFrame=async function(e){if(!Xn().supportWebRTCEncodedTransform)return void Un.warning("browser not support audio encoded transform");if(mk.has(e))return;const t={track:e.track};if(Te()){if(!e.createEncodedStreams)return void Un.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void Un.error("create audio-encoded-streams error",e&&e.message)}const i=new TransformStream({transform(n,i){t.controller||(t.controller=i),e.track&&e.track.id!==t.track.id&&(Un.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r)),i.enqueue(n)}});n.readable.pipeThrough(i).pipeTo(n.writable)}else if(Se()){if("undefined"==typeof RTCRtpScriptTransform)return void Un.warning("browser not support RTCRtpScriptTransform");const n=_k(),i=new MessageChannel;await new Vv((e=>n.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(n,{name:"rx",port:i.port2},[i.port2]);e.transform=o,await new Vv((e=>n.onmessage=t=>{"started"===t.data&&e(void 0)})),i.port1.onmessage=n=>{var i;n.data.transformed&&e.track&&(null===(i=e.track)||void 0===i?void 0:i.id)!==t.track.id&&(Un.debug("audio track changed: ".concat(t.track.id," => ").concat(e.track.id)),t.track.removeEventListener("ended",r),t.track=e.track,t.track.addEventListener("ended",r))},t.worker=n}function r(){e.track.removeEventListener("ended",r),function(e){const t=mk.get(e);if(t){mk.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){Un.warning(e&&e.message)}}}(e)}mk.set(e,t),e.track.addEventListener("ended",r)},e.interceptRemoteVideoFrame=async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!Xn().supportWebRTCEncodedTransform)return void Un.warning("browser not support video encoded transform");if(!e.track)return;if(vk.has(e)){const r=vk.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(Te()){if(!e.createEncodedStreams)return void Un.warning("browser not support createEncodedStreams() API");let t=null;try{t=e.createEncodedStreams()}catch(e){return void Un.error("create video-encoded-streams error",e&&e.message)}const i=new TransformStream({transform(t,i){r.controller||(r.controller=i),e.track&&e.track.id!==r.track.id&&(Un.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 o=gk(t);o&&r.onSei&&r.onSei(o),i.enqueue(t)}});t.readable.pipeThrough(i).pipeTo(t.writable)}else if(Se()){if("undefined"==typeof RTCRtpScriptTransform)return void Un.warning("browser not support RTCRtpScriptTransform");const t=_k(),i=new MessageChannel;await new Vv((e=>t.onmessage=t=>{"registered"===t.data&&e(void 0)}));const o=new RTCRtpScriptTransform(t,{name:"rx",port:i.port2},[i.port2]);e.transform=o,await new Vv((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?(Un.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)):t.data.sei&&r.onSei&&r.onSei(t.data.sei)},r.worker=t}function n(){if(e.track){if(this.id!==e.track.id)return;e.track.removeEventListener("ended",n)}!function(e){const t=vk.get(e);if(t){vk.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){Un.warning(e&&e.message)}}}(e)}vk.set(e,r),e.track.addEventListener("ended",n)},e.isAudioEncoderConfiguration=Vc,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?Fe(e,"profile",Object.keys(Dc)):Vc(e),!0},e.isBeautyEffectOptions=function(e){return void 0!==e.smoothnessLevel&&Be(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&Be(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&Be(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&Fe(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),!0},e.isElectron=ze,e.isLowStreamParameter=function(e){if(!e)throw new xe(Le.INVALID_PARAMS);return Ge(e.width)||je(e.width,"streamParameter.width"),Ge(e.height)||je(e.height,"streamParameter.height"),Ge(e.framerate)||je(e.framerate,"streamParameter.framerate"),Ge(e.bitrate)||Be(e.bitrate,"streamParameter.bitrate"),!0},e.isScreenSourceType=Fc,e.isVideoEncoderConfiguration=xc,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?Fe(e,"profile",Object.keys(Ac)):xc(e),!0},e.polyfillAudioNode=Zv,e.removeTrack=Uc,e.requestAutoplayGesture=Dy,e.silenceScriptProcessHandler=ey,e.updateAgoraRTCCompatibility=Yn,e.visibilityWatcher=MR}));