6 lines
393 KiB
JavaScript
6 lines
393 KiB
JavaScript
/**
|
||
* AgoraWebSDK_N-v4.22.1-0-g1c8e27e9 Copyright AgoraInc.
|
||
*/
|
||
|
||
!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 p(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((n=>{n.endsWith("Id")?p(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((t=>{p(e,e.get(t),r)}))})))}function h(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&&p(e,r,i)}))})),i}const f=c;function E(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const n=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach((r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const n="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);const i=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];let e={};"number"==typeof n.ideal?(e[i("min",r)]=n.ideal,t.optional.push(e),e={},e[i("max",r)]=n.ideal,t.optional.push(e)):(e[i("",r)]=n.ideal,t.optional.push(e))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((e=>{void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then((r=>{let s=(r=r.filter((e=>"videoinput"===e.kind))).find((e=>t.some((t=>e.label.toLowerCase().includes(t)))));return!s&&r.length&&t.includes("back")&&(s=r[r.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=n(e.video),f("chrome: "+JSON.stringify(e)),i(e)}))}e.video=n(e.video)}return f("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(e=>{r.webkitGetUserMedia(e,t,(e=>{n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return i(t,(t=>e(t).then((e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach((e=>{e.stop()})),new DOMException("","NotFoundError");return e}),(e=>Promise.reject(o(e))))))}}}function m(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function _(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",(r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.track.id)):{track:r.track};const i=new Event("track");i.track=r.track,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)})),t.stream.getTracks().forEach((r=>{let n;n=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find((e=>e.track&&e.track.id===r.id)):{track:r};const i=new Event("track");i.track=r,i.receiver=n,i.transceiver={receiver:n},i.streams=[t.stream],this.dispatchEvent(i)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else o(e,"track",(e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e)))}function T(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){let i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach((e=>{this._senders.push(t(this,e))}))};const n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],n.apply(this,[e]),e.getTracks().forEach((e=>{const t=this._senders.find((t=>t.track===e));t&&this._senders.splice(this._senders.indexOf(t),1)}))}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function g(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,n]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const i=function(e){const t={};return e.result().forEach((e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((t=>{r[t]=e.stat(t)})),t[r.id]=r})),t},o=function(e){return new Map(Object.keys(e).map((t=>[t,e[t]])))};if(arguments.length>=2){const n=function(e){r(o(i(e)))};return t.apply(this,[n,e])}return new Promise(((e,r)=>{t.apply(this,[function(t){e(o(i(t)))},r])})).then(r,n)}}function S(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach((e=>e._pc=this)),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then((t=>h(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=>h(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 s=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((t=>{const n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}(this,arguments[0]),s.apply(this,arguments)):s.apply(this,arguments)};const a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=a.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach((r=>{this._streams[r].getTracks().find((t=>e.track===t))&&(t=this._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function y(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],n={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=n[t]}))}function A(e,t){o(e,"negotiationneeded",(e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var O=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:E,shimMediaStream:m,shimOnTrack:_,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 b(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 N(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 w(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 D(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 P(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function k(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:k,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:b,shimPeerConnection:C,shimRTCDataChannel:P,shimReceiverGetStats:w,shimRemoveStream:D,shimSenderGetStats:N});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 Y(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var z=Object.freeze({__proto__:null,shimAudioContext:Y,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 q={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}(q);var Q=q.exports,Z=J(Q),$=t({__proto__:null,default:Z},[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=Z.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=Z.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=Z.splitSections(e.sdp);return t.shift(),t.some((e=>{const t=Z.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=Z.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},s=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const e=n(arguments[0]),t=i(e),r=o(arguments[0],e);let s;s=0===t&&0===r?Number.POSITIVE_INFINITY:0===t||0===r?Math.max(t,r):Math.min(t,r);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>s}),this._sctp=a}return s.apply(this,arguments)}}function ne(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},o(e,"datachannel",(e=>(t(e.channel,e.target),e)))}function ie(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}function oe(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter((e=>"a=extmap-allow-mixed"!==e.trim())).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function se(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function ae(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){let e=arguments[0]||{};if("object"!=typeof e||e.type&&e.sdp)return r.apply(this,arguments);if(e={type:e.type,sdp:e.sdp},!e.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":e.type="offer";break;default:e.type="answer"}if(e.sdp||"offer"!==e.type&&"answer"!==e.type)return r.apply(this,[e]);return("offer"===e.type?this.createOffer:this.createAnswer).apply(this).then((e=>r.apply(this,[e])))})}var ce=Object.freeze({__proto__:null,removeExtmapAllowMixed:oe,shimAddIceCandidateNullOrEmpty:se,shimConnectionState:ie,shimMaxMessageSize:re,shimParameterlessSetLocalDescription:ae,shimRTCIceCandidate:ee,shimRTCIceCandidateRelayProtocol:te,shimSendThrowTypeError:ne});!function({window:e}={},t={shimChrome:!0,shimFirefox:!0,shimSafari:!0}){const r=c,n=function(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=i(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=i(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=i(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}(e),o={browserDetails:n,commonShim:ce,extractVersion:i,disableLog:s,disableWarnings:a,sdp:$};switch(n.browser){case"chrome":if(!O||!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=O,se(e,n),ae(e),E(e,n),m(e),y(e,n),_(e),R(e,n),T(e),g(e),S(e),A(e,n),ee(e),te(e),ie(e),re(e,n),ne(e),oe(e,n);break;case"firefox":if(!x||!C||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=x,se(e,n),ae(e),I(e,n),C(e,n),b(e),D(e),N(e),w(e),P(e),k(e),L(e),M(e),U(e),ee(e),ie(e),re(e,n),ne(e);break;case"safari":if(!z||!t.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=z,se(e,n),ae(e),W(e),K(e),B(e),V(e),F(e),H(e),j(e),Y(e),ee(e),te(e),re(e,n),ne(e),oe(e,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var de={exports:{}};!function(e,t){!function(r,n){var i="function",o="undefined",s="object",a="string",c="major",d="model",u="name",l="type",p="vendor",h="version",f="architecture",E="console",m="mobile",_="tablet",T="smarttv",g="wearable",S="embedded",v="Amazon",R="Apple",y="ASUS",A="BlackBerry",O="Browser",I="Chrome",b="Firefox",C="Google",N="Huawei",w="LG",D="Microsoft",P="Motorola",k="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)},Y=function(e,t){for(var r,o,a,c,d,u,l=0;l<t.length&&!d;){var p=t[l],h=t[l+1];for(r=o=0;r<p.length&&!d&&p[r];)if(d=p[r++].exec(e))for(a=0;a<h.length;a++)u=d[++o],typeof(c=h[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}},z=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],[h,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[h,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,h],[/opios[\/ ]+([\w\.]+)/i],[h,[u,k+" Mini"]],[/\bopr\/([\w\.]+)/i],[h,[u,k]],[/(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,h],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[h,[u,"UC"+O]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i],[h,[u,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[h,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[h,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[h,[u,"IE"]],[/yabrowser\/([\w\.]+)/i],[h,[u,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+O],h],[/\bfocus\/([\w\.]+)/i],[h,[u,b+" Focus"]],[/\bopt\/([\w\.]+)/i],[h,[u,k+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[h,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[h,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[h,[u,k+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[h,[u,"MIUI "+O]],[/fxios\/([-\w\.]+)/i],[h,[u,b]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+O]],[/(oculus|samsung|sailfish|huawei)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+O],h],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],h],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/ ]?([\w\.]+)/i],[u,h],[/(metasr)[\/ ]?([\w\.]+)/i,/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,F],h],[/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/ ]([-\w\.]+)/i],[u,h],[/\bgsa\/([\w\.]+) .*safari\//i],[h,[u,"GSA"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[h,[u,I+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,I+" WebView"],h],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[h,[u,"Android "+O]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,h],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[h,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[h,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[h,z,{"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,h],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],h],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[h,[u,b+" 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,h],[/(cobalt)\/([\w\.]+)/i],[u,[h,/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,[p,L],[l,_]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[d,[p,L],[l,m]],[/\((ip(?:hone|od)[\w ]*);/i],[d,[p,R],[l,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[d,[p,R],[l,_]],[/(macintosh);/i],[d,[p,R]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[d,[p,M],[l,m]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[d,[p,N],[l,_]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[d,[p,N],[l,m]],[/\b(poco[\w ]+)(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[d,/_/g," "],[p,x],[l,m]],[/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[d,/_/g," "],[p,x],[l,_]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[d,[p,"OPPO"],[l,m]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[d,[p,"Vivo"],[l,m]],[/\b(rmx[12]\d{3})(?: bui|;|\))/i],[d,[p,"Realme"],[l,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[d,[p,P],[l,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[d,[p,P],[l,_]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[d,[p,w],[l,_]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[d,[p,w],[l,m]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[d,[p,"Lenovo"],[l,_]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[d,/_/g," "],[p,"Nokia"],[l,m]],[/(pixel c)\b/i],[d,[p,C],[l,_]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[d,[p,C],[l,m]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[d,[p,U],[l,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[d,"Xperia Tablet"],[p,U],[l,_]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[d,[p,"OnePlus"],[l,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[d,[p,v],[l,_]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[d,/(.+)/g,"Fire Phone $1"],[p,v],[l,m]],[/(playbook);[-\w\),; ]+(rim)/i],[d,p,[l,_]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[d,[p,A],[l,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[d,[p,y],[l,_]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[d,[p,y],[l,m]],[/(nexus 9)/i],[d,[p,"HTC"],[l,_]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[d,/_/g," "],[l,m]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[d,[p,"Acer"],[l,_]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[d,[p,"Meizu"],[l,m]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[p,d,[l,m]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,d,[l,_]],[/(surface duo)/i],[d,[p,D],[l,_]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[d,[p,"Fairphone"],[l,m]],[/(u304aa)/i],[d,[p,"AT&T"],[l,m]],[/\bsie-(\w*)/i],[d,[p,"Siemens"],[l,m]],[/\b(rct\w+) b/i],[d,[p,"RCA"],[l,_]],[/\b(venue[\d ]{2,7}) b/i],[d,[p,"Dell"],[l,_]],[/\b(q(?:mv|ta)\w+) b/i],[d,[p,"Verizon"],[l,_]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[d,[p,"Barnes & Noble"],[l,_]],[/\b(tm\d{3}\w+) b/i],[d,[p,"NuVision"],[l,_]],[/\b(k88) b/i],[d,[p,"ZTE"],[l,_]],[/\b(nx\d{3}j) b/i],[d,[p,"ZTE"],[l,m]],[/\b(gen\d{3}) b.+49h/i],[d,[p,"Swiss"],[l,m]],[/\b(zur\d{3}) b/i],[d,[p,"Swiss"],[l,_]],[/\b((zeki)?tb.*\b) b/i],[d,[p,"Zeki"],[l,_]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],d,[l,_]],[/\b(ns-?\w{0,9}) b/i],[d,[p,"Insignia"],[l,_]],[/\b((nxa|next)-?\w{0,9}) b/i],[d,[p,"NextBook"],[l,_]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],d,[l,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],d,[l,m]],[/\b(ph-1) /i],[d,[p,"Essential"],[l,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[d,[p,"Envizen"],[l,_]],[/\b(trio[-\w\. ]+) b/i],[d,[p,"MachSpeed"],[l,_]],[/\btu_(1491) b/i],[d,[p,"Rotor"],[l,_]],[/(shield[\w ]+) b/i],[d,[p,"Nvidia"],[l,_]],[/(sprint) (\w+)/i],[p,d,[l,m]],[/(kin\.[onetw]{3})/i],[[d,/\./g," "],[p,D],[l,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[d,[p,V],[l,_]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[d,[p,V],[l,m]],[/smart-tv.+(samsung)/i],[p,[l,T]],[/hbbtv.+maple;(\d+)/i],[[d,/^/,"SmartTV"],[p,L],[l,T]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,w],[l,T]],[/(apple) ?tv/i],[p,[d,R+" TV"],[l,T]],[/crkey/i],[[d,I+"cast"],[p,C],[l,T]],[/droid.+aft(\w)( bui|\))/i],[d,[p,v],[l,T]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[d,[p,M],[l,T]],[/(bravia[\w ]+)( bui|\))/i],[d,[p,U],[l,T]],[/(mitv-\w{5}) bui/i],[d,[p,x],[l,T]],[/Hbbtv.*(technisat) (.*);/i],[p,d,[l,T]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,K],[d,K],[l,T]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[l,T]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,d,[l,E]],[/droid.+; (shield) bui/i],[d,[p,"Nvidia"],[l,E]],[/(playstation [345portablevi]+)/i],[d,[p,U],[l,E]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[d,[p,D],[l,E]],[/((pebble))app/i],[p,d,[l,g]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[d,[p,R],[l,g]],[/droid.+; (glass) \d/i],[d,[p,C],[l,g]],[/droid.+; (wt63?0{2,3})\)/i],[d,[p,V],[l,g]],[/(quest( 2| pro)?)/i],[d,[p,F],[l,g]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[l,S]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+? mobile safari/i],[d,[l,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[d,[l,_]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[l,_]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[l,m]],[/(android[-\w\. ]{0,9});.+buil/i],[d,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[h,[u,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[h,[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,h],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[h,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,h],[/(windows) nt 6\.2; (arm)/i,/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i,/(windows)[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i],[u,[h,z,X]],[/(win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,"Windows"],[h,z,X]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/cfnetwork\/.+darwin/i],[[h,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,j],[h,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[h,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,h],[/\(bb(10);/i],[h,[u,A]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[h,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[h,[u,b+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[h,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[h,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[h,[u,I+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,B],h],[/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,h],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],h],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux)/i,/(unix) ?([\w\.]*)/i],[u,h]]},q=function(e,t){if(typeof e===s&&(t=e,e=n),!(this instanceof q))return new q(e,t).getResult();var E=typeof r!==o&&r.navigator?r.navigator:n,T=e||(E&&E.userAgent?E.userAgent:""),g=E&&E.userAgentData?E.userAgentData:n,S=t?function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r}(J,t):J;return this.getBrowser=function(){var e={};return e[u]=n,e[h]=n,Y.call(e,T,S.browser),e[c]=function(e){return typeof e===a?e.replace(/[^\d\.]/g,"").split(".")[0]:n}(e[h]),E&&E.brave&&typeof E.brave.isBrave==i&&(e[u]="Brave"),e},this.getCPU=function(){var e={};return e[f]=n,Y.call(e,T,S.cpu),e},this.getDevice=function(){var e={};return e[p]=n,e[d]=n,e[l]=n,Y.call(e,T,S.device),!e[l]&&g&&g.mobile&&(e[l]=m),"Macintosh"==e[d]&&E&&typeof E.standalone!==o&&E.maxTouchPoints&&E.maxTouchPoints>2&&(e[d]="iPad",e[l]=_),e},this.getEngine=function(){var e={};return e[u]=n,e[h]=n,Y.call(e,T,S.engine),e},this.getOS=function(){var e={};return e[u]=n,e[h]=n,Y.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===a&&e.length>350?K(e,350):e,this},this.setUA(T),this};q.VERSION="0.7.34",q.BROWSER=G([u,h,c]),q.CPU=G([f]),q.DEVICE=G([d,p,l,E,m,T,_,g,S]),q.ENGINE=q.OS=G([u,h]),e.exports&&(t=e.exports=q),t.UAParser=q;var Q=typeof r!==o&&(r.jQuery||r.Zepto);if(Q&&!Q.ua){var Z=new q;Q.ua=Z.getResult(),Q.ua.get=function(){return Z.getUA()},Q.ua.set=function(e){Z.setUA(e);var t=Z.getResult();for(var r in t)Q.ua[r]=t[r]}}}("object"==typeof window?window:X)}(de,de.exports);var ue=J(de.exports);function le(e,t){return function(){return e.apply(t,arguments)}}const{toString:pe}=Object.prototype,{getPrototypeOf:he}=Object,fe=(Ee=Object.create(null),e=>{const t=pe.call(e);return Ee[t]||(Ee[t]=t.slice(8,-1).toLowerCase())});var Ee;const me=e=>(e=e.toLowerCase(),t=>fe(t)===e),_e=e=>t=>typeof t===e,{isArray:Te}=Array,ge=_e("undefined");const Se=me("ArrayBuffer");const ve=_e("string"),Re=_e("function"),ye=_e("number"),Ae=e=>null!==e&&"object"==typeof e,Oe=e=>{if("object"!==fe(e))return!1;const t=he(e);return!(null!==t&&t!==Object.prototype&&null!==Object.getPrototypeOf(t)||Symbol.toStringTag in e||Symbol.iterator in e)},Ie=me("Date"),be=me("File"),Ce=me("Blob"),Ne=me("FileList"),we=me("URLSearchParams"),[De,Pe,ke,Le]=["ReadableStream","Request","Response","Headers"].map(me);function Me(e,t,{allOwnKeys:r=!1}={}){if(null==e)return;let n,i;if("object"!=typeof e&&(e=[e]),Te(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 Ue(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 xe="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Ve=e=>!ge(e)&&e!==xe;const Fe=(Be="undefined"!=typeof Uint8Array&&he(Uint8Array),e=>Be&&e instanceof Be);var Be;const je=me("HTMLFormElement"),Ge=(({hasOwnProperty:e})=>(t,r)=>e.call(t,r))(Object.prototype),We=me("RegExp"),He=(e,t)=>{const r=Object.getOwnPropertyDescriptors(e),n={};Me(r,((r,i)=>{let o;!1!==(o=t(r,i,e))&&(n[i]=o||r)})),Object.defineProperties(e,n)},Ke="abcdefghijklmnopqrstuvwxyz",Ye="0123456789",ze={DIGIT:Ye,ALPHA:Ke,ALPHA_DIGIT:Ke+Ke.toUpperCase()+Ye};const Xe=me("AsyncFunction"),Je=(qe="function"==typeof setImmediate,Qe=Re(xe.postMessage),qe?setImmediate:Qe?(Ze=`axios@${Math.random()}`,$e=[],xe.addEventListener("message",(({source:e,data:t})=>{e===xe&&t===Ze&&$e.length&&$e.shift()()}),!1),e=>{$e.push(e),xe.postMessage(Ze,"*")}):e=>setTimeout(e));var qe,Qe,Ze,$e;const et="undefined"!=typeof queueMicrotask?queueMicrotask.bind(xe):"undefined"!=typeof process&&process.nextTick||Je;var tt={isArray:Te,isArrayBuffer:Se,isBuffer:function(e){return null!==e&&!ge(e)&&null!==e.constructor&&!ge(e.constructor)&&Re(e.constructor.isBuffer)&&e.constructor.isBuffer(e)},isFormData:e=>{let t;return e&&("function"==typeof FormData&&e instanceof FormData||Re(e.append)&&("formdata"===(t=fe(e))||"object"===t&&Re(e.toString)&&"[object FormData]"===e.toString()))},isArrayBufferView:function(e){let t;return t="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&Se(e.buffer),t},isString:ve,isNumber:ye,isBoolean:e=>!0===e||!1===e,isObject:Ae,isPlainObject:Oe,isReadableStream:De,isRequest:Pe,isResponse:ke,isHeaders:Le,isUndefined:ge,isDate:Ie,isFile:be,isBlob:Ce,isRegExp:We,isFunction:Re,isStream:e=>Ae(e)&&Re(e.pipe),isURLSearchParams:we,isTypedArray:Fe,isFileList:Ne,forEach:Me,merge:function e(){const{caseless:t}=Ve(this)&&this||{},r={},n=(n,i)=>{const o=t&&Ue(r,i)||i;Oe(r[o])&&Oe(n)?r[o]=e(r[o],n):Oe(n)?r[o]=e({},n):Te(n)?r[o]=n.slice():r[o]=n};for(let e=0,t=arguments.length;e<t;e++)arguments[e]&&Me(arguments[e],n);return r},extend:(e,t,r,{allOwnKeys:n}={})=>(Me(t,((t,n)=>{r&&Re(t)?e[n]=le(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&&he(e)}while(e&&(!r||r(e,t))&&e!==Object.prototype);return t},kindOf:fe,kindOfTest:me,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(Te(e))return e;let t=e.length;if(!ye(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:je,hasOwnProperty:Ge,hasOwnProp:Ge,reduceDescriptors:He,freezeMethods:e=>{He(e,((t,r)=>{if(Re(e)&&-1!==["arguments","caller","callee"].indexOf(r))return!1;const n=e[r];Re(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 Te(e)?n(e):n(String(e).split(t)),r},toCamelCase:e=>e.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(e,t,r){return t.toUpperCase()+r})),noop:()=>{},toFiniteNumber:(e,t)=>null!=e&&Number.isFinite(e=+e)?e:t,findKey:Ue,global:xe,isContextDefined:Ve,ALPHABET:ze,generateString:(e=16,t=ze.ALPHA_DIGIT)=>{let r="";const{length:n}=t;for(;e--;)r+=t[Math.random()*n|0];return r},isSpecCompliantForm:function(e){return!!(e&&Re(e.append)&&"FormData"===e[Symbol.toStringTag]&&e[Symbol.iterator])},toJSONObject:e=>{const t=new Array(10),r=(e,n)=>{if(Ae(e)){if(t.indexOf(e)>=0)return;if(!("toJSON"in e)){t[n]=e;const i=Te(e)?[]:{};return Me(e,((e,t)=>{const o=r(e,n+1);!ge(o)&&(i[t]=o)})),t[n]=void 0,i}}return e};return r(e,0)},isAsyncFn:Xe,isThenable:e=>e&&(Ae(e)||Re(e))&&Re(e.then)&&Re(e.catch),setImmediate:Je,asap:et};function rt(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,this.status=i.status?i.status:null)}tt.inherits(rt,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:tt.toJSONObject(this.config),code:this.code,status:this.status}}});const nt=rt.prototype,it={};["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=>{it[e]={value:e}})),Object.defineProperties(rt,it),Object.defineProperty(nt,"isAxiosError",{value:!0}),rt.from=(e,t,r,n,i,o)=>{const s=Object.create(nt);return tt.toFlatObject(e,s,(function(e){return e!==Error.prototype}),(e=>"isAxiosError"!==e)),rt.call(s,e.message,t,r,n,i),s.cause=e,s.name=e.name,o&&Object.assign(s,o),s};function ot(e){return tt.isPlainObject(e)||tt.isArray(e)}function st(e){return tt.endsWith(e,"[]")?e.slice(0,-2):e}function at(e,t,r){return e?e.concat(t).map((function(e,t){return e=st(e),!r&&t?"["+e+"]":e})).join(r?".":""):t}const ct=tt.toFlatObject(tt,{},null,(function(e){return/^is[A-Z]/.test(e)}));function dt(e,t,r){if(!tt.isObject(e))throw new TypeError("target must be an object");t=t||new FormData;const n=(r=tt.toFlatObject(r,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!tt.isUndefined(t[e])}))).metaTokens,i=r.visitor||d,o=r.dots,s=r.indexes,a=(r.Blob||"undefined"!=typeof Blob&&Blob)&&tt.isSpecCompliantForm(t);if(!tt.isFunction(i))throw new TypeError("visitor must be a function");function c(e){if(null===e)return"";if(tt.isDate(e))return e.toISOString();if(!a&&tt.isBlob(e))throw new rt("Blob is not supported. Use a Buffer instead.");return tt.isArrayBuffer(e)||tt.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(tt.endsWith(r,"{}"))r=n?r:r.slice(0,-2),e=JSON.stringify(e);else if(tt.isArray(e)&&function(e){return tt.isArray(e)&&!e.some(ot)}(e)||(tt.isFileList(e)||tt.endsWith(r,"[]"))&&(a=tt.toArray(e)))return r=st(r),a.forEach((function(e,n){!tt.isUndefined(e)&&null!==e&&t.append(!0===s?at([r],n,o):null===s?r:r+"[]",c(e))})),!1;return!!ot(e)||(t.append(at(i,r,o),c(e)),!1)}const u=[],l=Object.assign(ct,{defaultVisitor:d,convertValue:c,isVisitable:ot});if(!tt.isObject(e))throw new TypeError("data must be an object");return function e(r,n){if(!tt.isUndefined(r)){if(-1!==u.indexOf(r))throw Error("Circular reference detected in "+n.join("."));u.push(r),tt.forEach(r,(function(r,o){!0===(!(tt.isUndefined(r)||null===r)&&i.call(t,r,tt.isString(o)?o.trim():o,n,l))&&e(r,n?n.concat(o):[o])})),u.pop()}}(e),t}function ut(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function lt(e,t){this._pairs=[],e&&dt(e,this,t)}const pt=lt.prototype;function ht(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function ft(e,t,r){if(!t)return e;const n=r&&r.encode||ht,i=r&&r.serialize;let o;if(o=i?i(t,r):tt.isURLSearchParams(t)?t.toString():new lt(t,r).toString(n),o){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+o}return e}pt.append=function(e,t){this._pairs.push([e,t])},pt.toString=function(e){const t=e?function(t){return e.call(this,t,ut)}:ut;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};var Et=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){tt.forEach(this.handlers,(function(t){null!==t&&e(t)}))}},mt={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},_t={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:lt,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const Tt="undefined"!=typeof window&&"undefined"!=typeof document,gt="object"==typeof navigator&&navigator||void 0,St=Tt&&(!gt||["ReactNative","NativeScript","NS"].indexOf(gt.product)<0),vt="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts,Rt=Tt&&window.location.href||"http://localhost";var yt={...Object.freeze({__proto__:null,hasBrowserEnv:Tt,hasStandardBrowserEnv:St,hasStandardBrowserWebWorkerEnv:vt,navigator:gt,origin:Rt}),..._t};function At(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&&tt.isArray(n)?n.length:o,a)return tt.hasOwnProp(n,o)?n[o]=[n[o],r]:n[o]=r,!s;n[o]&&tt.isObject(n[o])||(n[o]=[]);return t(e,r,n[o],i)&&tt.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(tt.isFormData(e)&&tt.isFunction(e.entries)){const r={};return tt.forEachEntry(e,((e,n)=>{t(function(e){return tt.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,r,0)})),r}return null}const Ot={transitional:mt,adapter:["xhr","http","fetch"],transformRequest:[function(e,t){const r=t.getContentType()||"",n=r.indexOf("application/json")>-1,i=tt.isObject(e);i&&tt.isHTMLForm(e)&&(e=new FormData(e));if(tt.isFormData(e))return n?JSON.stringify(At(e)):e;if(tt.isArrayBuffer(e)||tt.isBuffer(e)||tt.isStream(e)||tt.isFile(e)||tt.isBlob(e)||tt.isReadableStream(e))return e;if(tt.isArrayBufferView(e))return e.buffer;if(tt.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 dt(e,new yt.classes.URLSearchParams,Object.assign({visitor:function(e,t,r,n){return yt.isNode&&tt.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((o=tt.isFileList(e))||r.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return dt(o?{"files[]":e}:e,t&&new t,this.formSerializer)}}return i||n?(t.setContentType("application/json",!1),function(e,t,r){if(tt.isString(e))try{return(t||JSON.parse)(e),tt.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(r||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ot.transitional,r=t&&t.forcedJSONParsing,n="json"===this.responseType;if(tt.isResponse(e)||tt.isReadableStream(e))return e;if(e&&tt.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 rt.from(e,rt.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:yt.classes.FormData,Blob:yt.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};tt.forEach(["delete","get","head","post","put","patch"],(e=>{Ot.headers[e]={}}));var It=Ot;const bt=tt.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Ct=Symbol("internals");function Nt(e){return e&&String(e).trim().toLowerCase()}function wt(e){return!1===e||null==e?e:tt.isArray(e)?e.map(wt):String(e)}function Dt(e,t,r,n,i){return tt.isFunction(n)?n.call(this,t,r):(i&&(t=r),tt.isString(t)?tt.isString(n)?-1!==t.indexOf(n):tt.isRegExp(n)?n.test(t):void 0:void 0)}class Pt{constructor(e){e&&this.set(e)}set(e,t,r){const n=this;function i(e,t,r){const i=Nt(t);if(!i)throw new Error("header name must be a non-empty string");const o=tt.findKey(n,i);(!o||void 0===n[o]||!0===r||void 0===r&&!1!==n[o])&&(n[o||t]=wt(e))}const o=(e,t)=>tt.forEach(e,((e,r)=>i(e,r,t)));if(tt.isPlainObject(e)||e instanceof this.constructor)o(e,t);else if(tt.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]&&bt[r]||("set-cookie"===r?t[r]?t[r].push(n):t[r]=[n]:t[r]=t[r]?t[r]+", "+n:n)})),t})(e),t);else if(tt.isHeaders(e))for(const[t,n]of e.entries())i(n,t,r);else null!=e&&i(t,e,r);return this}get(e,t){if(e=Nt(e)){const r=tt.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(tt.isFunction(t))return t.call(this,e,r);if(tt.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Nt(e)){const r=tt.findKey(this,e);return!(!r||void 0===this[r]||t&&!Dt(0,this[r],r,t))}return!1}delete(e,t){const r=this;let n=!1;function i(e){if(e=Nt(e)){const i=tt.findKey(r,e);!i||t&&!Dt(0,r[i],i,t)||(delete r[i],n=!0)}}return tt.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&&!Dt(0,this[i],i,e,!0)||(delete this[i],n=!0)}return n}normalize(e){const t=this,r={};return tt.forEach(this,((n,i)=>{const o=tt.findKey(r,i);if(o)return t[o]=wt(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]=wt(n),r[s]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return tt.forEach(this,((r,n)=>{null!=r&&!1!==r&&(t[n]=e&&tt.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[Ct]=this[Ct]={accessors:{}}).accessors,r=this.prototype;function n(e){const n=Nt(e);t[n]||(!function(e,t){const r=tt.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 tt.isArray(e)?e.forEach(n):n(e),this}}Pt.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),tt.reduceDescriptors(Pt.prototype,(({value:e},t)=>{let r=t[0].toUpperCase()+t.slice(1);return{get:()=>e,set(e){this[r]=e}}})),tt.freezeMethods(Pt);var kt=Pt;function Lt(e,t){const r=this||It,n=t||r,i=kt.from(n.headers);let o=n.data;return tt.forEach(e,(function(e){o=e.call(r,o,i.normalize(),t?t.status:void 0)})),i.normalize(),o}function Mt(e){return!(!e||!e.__CANCEL__)}function Ut(e,t,r){rt.call(this,null==e?"canceled":e,rt.ERR_CANCELED,t,r),this.name="CanceledError"}function xt(e,t,r){const n=r.config.validateStatus;r.status&&n&&!n(r.status)?t(new rt("Request failed with status code "+r.status,[rt.ERR_BAD_REQUEST,rt.ERR_BAD_RESPONSE][Math.floor(r.status/100)-4],r.config,r.request,r)):e(r)}tt.inherits(Ut,rt,{__CANCEL__:!0});const Vt=(e,t,r=3)=>{let n=0;const i=function(e,t){e=e||10;const r=new Array(e),n=new Array(e);let i,o=0,s=0;return t=void 0!==t?t:1e3,function(a){const c=Date.now(),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 p=d&&c-d;return p?Math.round(1e3*l/p):void 0}}(50,250);return function(e,t){let r,n,i=0,o=1e3/t;const s=(t,o=Date.now())=>{i=o,r=null,n&&(clearTimeout(n),n=null),e.apply(null,t)};return[(...e)=>{const t=Date.now(),a=t-i;a>=o?s(e,t):(r=e,n||(n=setTimeout((()=>{n=null,s(r)}),o-a)))},()=>r&&s(r)]}((r=>{const o=r.loaded,s=r.lengthComputable?r.total:void 0,a=o-n,c=i(a);n=o;e({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:r,lengthComputable:null!=s,[t?"download":"upload"]:!0})}),r)},Ft=(e,t)=>{const r=null!=e;return[n=>t[0]({lengthComputable:r,total:e,loaded:n}),t[1]]},Bt=e=>(...t)=>tt.asap((()=>e(...t)));var jt=yt.hasStandardBrowserEnv?function(){const e=yt.navigator&&/(msie|trident)/i.test(yt.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=tt.isString(e)?n(e):e;return t.protocol===r.protocol&&t.host===r.host}}():function(){return!0},Gt=yt.hasStandardBrowserEnv?{write(e,t,r,n,i,o){const s=[e+"="+encodeURIComponent(t)];tt.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),tt.isString(n)&&s.push("path="+n),tt.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 Wt(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}const Ht=e=>e instanceof kt?{...e}:e;function Kt(e,t){t=t||{};const r={};function n(e,t,r){return tt.isPlainObject(e)&&tt.isPlainObject(t)?tt.merge.call({caseless:r},e,t):tt.isPlainObject(t)?tt.merge({},t):tt.isArray(t)?t.slice():t}function i(e,t,r){return tt.isUndefined(t)?tt.isUndefined(e)?void 0:n(void 0,e,r):n(e,t,r)}function o(e,t){if(!tt.isUndefined(t))return n(void 0,t)}function s(e,t){return tt.isUndefined(t)?tt.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(Ht(e),Ht(t),!0)};return tt.forEach(Object.keys(Object.assign({},e,t)),(function(n){const o=c[n]||i,s=o(e[n],t[n],n);tt.isUndefined(s)&&o!==a||(r[n]=s)})),r}var Yt=e=>{const t=Kt({},e);let r,{data:n,withXSRFToken:i,xsrfHeaderName:o,xsrfCookieName:s,headers:a,auth:c}=t;if(t.headers=a=kt.from(a),t.url=ft(Wt(t.baseURL,t.url),e.params,e.paramsSerializer),c&&a.set("Authorization","Basic "+btoa((c.username||"")+":"+(c.password?unescape(encodeURIComponent(c.password)):""))),tt.isFormData(n))if(yt.hasStandardBrowserEnv||yt.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if(!1!==(r=a.getContentType())){const[e,...t]=r?r.split(";").map((e=>e.trim())).filter(Boolean):[];a.setContentType([e||"multipart/form-data",...t].join("; "))}if(yt.hasStandardBrowserEnv&&(i&&tt.isFunction(i)&&(i=i(t)),i||!1!==i&&jt(t.url))){const e=o&&s&&Gt.read(s);e&&a.set(o,e)}return t};var zt="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,r){const n=Yt(e);let i=n.data;const o=kt.from(n.headers).normalize();let s,a,c,d,u,{responseType:l,onUploadProgress:p,onDownloadProgress:h}=n;function f(){d&&d(),u&&u(),n.cancelToken&&n.cancelToken.unsubscribe(s),n.signal&&n.signal.removeEventListener("abort",s)}let E=new XMLHttpRequest;function m(){if(!E)return;const n=kt.from("getAllResponseHeaders"in E&&E.getAllResponseHeaders());xt((function(e){t(e),f()}),(function(e){r(e),f()}),{data:l&&"text"!==l&&"json"!==l?E.response:E.responseText,status:E.status,statusText:E.statusText,headers:n,config:e,request:E}),E=null}E.open(n.method.toUpperCase(),n.url,!0),E.timeout=n.timeout,"onloadend"in E?E.onloadend=m:E.onreadystatechange=function(){E&&4===E.readyState&&(0!==E.status||E.responseURL&&0===E.responseURL.indexOf("file:"))&&setTimeout(m)},E.onabort=function(){E&&(r(new rt("Request aborted",rt.ECONNABORTED,e,E)),E=null)},E.onerror=function(){r(new rt("Network Error",rt.ERR_NETWORK,e,E)),E=null},E.ontimeout=function(){let t=n.timeout?"timeout of "+n.timeout+"ms exceeded":"timeout exceeded";const i=n.transitional||mt;n.timeoutErrorMessage&&(t=n.timeoutErrorMessage),r(new rt(t,i.clarifyTimeoutError?rt.ETIMEDOUT:rt.ECONNABORTED,e,E)),E=null},void 0===i&&o.setContentType(null),"setRequestHeader"in E&&tt.forEach(o.toJSON(),(function(e,t){E.setRequestHeader(t,e)})),tt.isUndefined(n.withCredentials)||(E.withCredentials=!!n.withCredentials),l&&"json"!==l&&(E.responseType=n.responseType),h&&([c,u]=Vt(h,!0),E.addEventListener("progress",c)),p&&E.upload&&([a,d]=Vt(p),E.upload.addEventListener("progress",a),E.upload.addEventListener("loadend",d)),(n.cancelToken||n.signal)&&(s=t=>{E&&(r(!t||t.type?new Ut(null,e,E):t),E.abort(),E=null)},n.cancelToken&&n.cancelToken.subscribe(s),n.signal&&(n.signal.aborted?s():n.signal.addEventListener("abort",s)));const _=function(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}(n.url);_&&-1===yt.protocols.indexOf(_)?r(new rt("Unsupported protocol "+_+":",rt.ERR_BAD_REQUEST,e)):E.send(i||null)}))};var Xt=(e,t)=>{const{length:r}=e=e?e.filter(Boolean):[];if(t||r){let r,n=new AbortController;const i=function(e){if(!r){r=!0,s();const t=e instanceof Error?e:this.reason;n.abort(t instanceof rt?t:new Ut(t instanceof Error?t.message:t))}};let o=t&&setTimeout((()=>{o=null,i(new rt(`timeout ${t} of ms exceeded`,rt.ETIMEDOUT))}),t);const s=()=>{e&&(o&&clearTimeout(o),o=null,e.forEach((e=>{e.unsubscribe?e.unsubscribe(i):e.removeEventListener("abort",i)})),e=null)};e.forEach((e=>e.addEventListener("abort",i)));const{signal:a}=n;return a.unsubscribe=()=>tt.asap(s),a}};const Jt=function*(e,t){let r=e.byteLength;if(!t||r<t)return void(yield e);let n,i=0;for(;i<r;)n=i+t,yield e.slice(i,n),i=n},qt=async function*(e){if(e[Symbol.asyncIterator])return void(yield*e);const t=e.getReader();try{for(;;){const{done:e,value:r}=await t.read();if(e)break;yield r}}finally{await t.cancel()}},Qt=(e,t,r,n)=>{const i=async function*(e,t){for await(const r of qt(e))yield*Jt(r,t)}(e,t);let o,s=0,a=e=>{o||(o=!0,n&&n(e))};return new ReadableStream({async pull(e){try{const{done:t,value:n}=await i.next();if(t)return a(),void e.close();let o=n.byteLength;if(r){let e=s+=o;r(e)}e.enqueue(new Uint8Array(n))}catch(e){throw a(e),e}},cancel:e=>(a(e),i.return())},{highWaterMark:2})},Zt="function"==typeof fetch&&"function"==typeof Request&&"function"==typeof Response,$t=Zt&&"function"==typeof ReadableStream,er=Zt&&("function"==typeof TextEncoder?(tr=new TextEncoder,e=>tr.encode(e)):async e=>new Uint8Array(await new Response(e).arrayBuffer()));var tr;const rr=(e,...t)=>{try{return!!e(...t)}catch(e){return!1}},nr=$t&&rr((()=>{let e=!1;const t=new Request(yt.origin,{body:new ReadableStream,method:"POST",get duplex(){return e=!0,"half"}}).headers.has("Content-Type");return e&&!t})),ir=$t&&rr((()=>tt.isReadableStream(new Response("").body))),or={stream:ir&&(e=>e.body)};var sr;Zt&&(sr=new Response,["text","arrayBuffer","blob","formData","stream"].forEach((e=>{!or[e]&&(or[e]=tt.isFunction(sr[e])?t=>t[e]():(t,r)=>{throw new rt(`Response type '${e}' is not supported`,rt.ERR_NOT_SUPPORT,r)})})));const ar=async(e,t)=>{const r=tt.toFiniteNumber(e.getContentLength());return null==r?(async e=>{if(null==e)return 0;if(tt.isBlob(e))return e.size;if(tt.isSpecCompliantForm(e)){const t=new Request(yt.origin,{method:"POST",body:e});return(await t.arrayBuffer()).byteLength}return tt.isArrayBufferView(e)||tt.isArrayBuffer(e)?e.byteLength:(tt.isURLSearchParams(e)&&(e+=""),tt.isString(e)?(await er(e)).byteLength:void 0)})(t):r};var cr=Zt&&(async e=>{let{url:t,method:r,data:n,signal:i,cancelToken:o,timeout:s,onDownloadProgress:a,onUploadProgress:c,responseType:d,headers:u,withCredentials:l="same-origin",fetchOptions:p}=Yt(e);d=d?(d+"").toLowerCase():"text";let h,f=Xt([i,o&&o.toAbortSignal()],s);const E=f&&f.unsubscribe&&(()=>{f.unsubscribe()});let m;try{if(c&&nr&&"get"!==r&&"head"!==r&&0!==(m=await ar(u,n))){let e,r=new Request(t,{method:"POST",body:n,duplex:"half"});if(tt.isFormData(n)&&(e=r.headers.get("content-type"))&&u.setContentType(e),r.body){const[e,t]=Ft(m,Vt(Bt(c)));n=Qt(r.body,65536,e,t)}}tt.isString(l)||(l=l?"include":"omit");const i="credentials"in Request.prototype;h=new Request(t,{...p,signal:f,method:r.toUpperCase(),headers:u.normalize().toJSON(),body:n,duplex:"half",credentials:i?l:void 0});let o=await fetch(h);const s=ir&&("stream"===d||"response"===d);if(ir&&(a||s&&E)){const e={};["status","statusText","headers"].forEach((t=>{e[t]=o[t]}));const t=tt.toFiniteNumber(o.headers.get("content-length")),[r,n]=a&&Ft(t,Vt(Bt(a),!0))||[];o=new Response(Qt(o.body,65536,r,(()=>{n&&n(),E&&E()})),e)}d=d||"text";let _=await or[tt.findKey(or,d)||"text"](o,e);return!s&&E&&E(),await new Promise(((t,r)=>{xt(t,r,{data:_,headers:kt.from(o.headers),status:o.status,statusText:o.statusText,config:e,request:h})}))}catch(t){if(E&&E(),t&&"TypeError"===t.name&&/fetch/i.test(t.message))throw Object.assign(new rt("Network Error",rt.ERR_NETWORK,e,h),{cause:t.cause||t});throw rt.from(t,t&&t.code,e,h)}});const dr={http:null,xhr:zt,fetch:cr};tt.forEach(dr,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));const ur=e=>`- ${e}`,lr=e=>tt.isFunction(e)||null===e||!1===e;var pr={getAdapter:e=>{e=tt.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,!lr(r)&&(n=dr[(t=String(r)).toLowerCase()],void 0===n))throw new rt(`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 rt("There is no suitable adapter to dispatch the request "+(t?e.length>1?"since :\n"+e.map(ur).join("\n"):" "+ur(e[0]):"as no adapter specified"),"ERR_NOT_SUPPORT")}return n},adapters:dr};function hr(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Ut(null,e)}function fr(e){hr(e),e.headers=kt.from(e.headers),e.data=Lt.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return pr.getAdapter(e.adapter||It.adapter)(e).then((function(t){return hr(e),t.data=Lt.call(e,e.transformResponse,t),t.headers=kt.from(t.headers),t}),(function(t){return Mt(t)||(hr(e),t&&t.response&&(t.response.data=Lt.call(e,e.transformResponse,t.response),t.response.headers=kt.from(t.response.headers))),Promise.reject(t)}))}const Er="1.7.7",mr={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{mr[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}}));const _r={};mr.transitional=function(e,t,r){function n(e,t){return"[Axios v"+Er+"] Transitional option '"+e+"'"+t+(r?". "+r:"")}return(r,i,o)=>{if(!1===e)throw new rt(n(i," has been removed"+(t?" in "+t:"")),rt.ERR_DEPRECATED);return t&&!_r[i]&&(_r[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 Tr={assertOptions:function(e,t,r){if("object"!=typeof e)throw new rt("options must be an object",rt.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 rt("option "+o+" must be "+r,rt.ERR_BAD_OPTION_VALUE)}else if(!0!==r)throw new rt("Unknown option "+o,rt.ERR_BAD_OPTION)}},validators:mr};const gr=Tr.validators;let Sr=class{constructor(e){this.defaults=e,this.interceptors={request:new Et,response:new Et}}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/,""):"";try{e.stack?r&&!String(e.stack).endsWith(r.replace(/^.+\n.+\n/,""))&&(e.stack+="\n"+r):e.stack=r}catch(e){}}throw e}}_request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Kt(this.defaults,t);const{transitional:r,paramsSerializer:n,headers:i}=t;void 0!==r&&Tr.assertOptions(r,{silentJSONParsing:gr.transitional(gr.boolean),forcedJSONParsing:gr.transitional(gr.boolean),clarifyTimeoutError:gr.transitional(gr.boolean)},!1),null!=n&&(tt.isFunction(n)?t.paramsSerializer={serialize:n}:Tr.assertOptions(n,{encode:gr.function,serialize:gr.function},!0)),t.method=(t.method||this.defaults.method||"get").toLowerCase();let o=i&&tt.merge(i.common,i[t.method]);i&&tt.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete i[e]})),t.headers=kt.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=[fr.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 p=t;for(l=0;l<u;){const e=s[l++],t=s[l++];try{p=e(p)}catch(e){t.call(this,e);break}}try{d=fr.call(this,p)}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 ft(Wt((e=Kt(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}};tt.forEach(["delete","get","head","options"],(function(e){Sr.prototype[e]=function(t,r){return this.request(Kt(r||{},{method:e,url:t,data:(r||{}).data}))}})),tt.forEach(["post","put","patch"],(function(e){function t(t){return function(r,n,i){return this.request(Kt(i||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:r,data:n}))}}Sr.prototype[e]=t(),Sr.prototype[e+"Form"]=t(!0)}));var vr=Sr;class Rr{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 Ut(e,n,i),t(r.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}toAbortSignal(){const e=new AbortController,t=t=>{e.abort(t)};return this.subscribe(t),e.signal.unsubscribe=()=>this.unsubscribe(t),e.signal}static source(){let e;return{token:new Rr((function(t){e=t})),cancel:e}}}var yr=Rr;const Ar={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(Ar).forEach((([e,t])=>{Ar[t]=e}));var Or=Ar;const Ir=function e(t){const r=new vr(t),n=le(vr.prototype.request,r);return tt.extend(n,vr.prototype,r,{allOwnKeys:!0}),tt.extend(n,r,null,{allOwnKeys:!0}),n.create=function(r){return e(Kt(t,r))},n}(It);Ir.Axios=vr,Ir.CanceledError=Ut,Ir.CancelToken=yr,Ir.isCancel=Mt,Ir.VERSION=Er,Ir.toFormData=dt,Ir.AxiosError=rt,Ir.Cancel=Ir.CanceledError,Ir.all=function(e){return Promise.all(e)},Ir.spread=function(e){return function(t){return e.apply(null,t)}},Ir.isAxiosError=function(e){return tt.isObject(e)&&!0===e.isAxiosError},Ir.mergeConfig=Kt,Ir.AxiosHeaders=kt,Ir.formToJSON=e=>At(tt.isHTMLForm(e)?new FormData(e):e),Ir.getAdapter=pr.getAdapter,Ir.HttpStatusCode=Or,Ir.default=Ir;var br=Ir;let Cr=function(e){return e.WIN_10="Windows 10",e.WIN_81="Windows 8.1",e.WIN_8="Windows 8",e.WIN_7="Windows 7",e.WIN_VISTA="Windows Vista",e.WIN_SERVER_2003="Windows Server 2003",e.WIN_XP="Windows XP",e.WIN_2000="Windows 2000",e.ANDROID="Android",e.HARMONY_OS="HarmonyOS",e.OPEN_BSD="Open BSD",e.SUN_OS="Sun OS",e.LINUX="Linux",e.IOS="iOS",e.MAC_OS="Mac OS",e.CHROMIUM_OS="Chromium OS",e.QNX="QNX",e.UNIX="UNIX",e.BEOS="BeOS",e.OS_2="OS/2",e.SEARCH_BOT="Search Bot",e}({}),Nr=function(e){return e.CHROME="Chrome",e.SAFARI="Safari",e.EDGE="Edge",e.FIREFOX="Firefox",e.OPERA="OPR",e.QQ="QQBrowser",e.WECHAT="MicroMessenger",e}({});const wr=new ue;let Dr=wr.getResult(),Pr=null;function kr(e){if(!Pr){e&&wr.setUA(e),Dr=wr.getResult();const t=function(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return Nr.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return Nr.CHROME;case"Safari":case"Mobile Safari":return Nr.SAFARI;case"Edge":return Nr.EDGE;case"Firefox":return Nr.FIREFOX;case"QQ":case"QQBrowser":return Nr.QQ;case"Opera":return Nr.OPERA;case"WeChat":return Nr.WECHAT;default:return e.browser.name||""}}(Dr),r=Lr(Dr),n=function(e){return"Windows"===e.os.name?e.os.version?e.os.name+" "+e.os.version:e.os.name:e.os.name||""}(Dr),i=Dr.os.version,o=Lr(Dr,!1),s=Dr.device.type;if(!(t&&r&&n&&i))return{name:t,version:r,os:n,osVersion:i,browserVersion:o,deviceType:s};Pr={name:t,version:r,os:n,osVersion:i,browserVersion:o,deviceType:s}}return Pr}function Lr(e){let t,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return t="Blink"===e.engine.name?e.engine.version||"":e.browser.version||"",r?t.split(".")[0]:t}function Mr(){return kr().os}function Ur(){const e=kr();return"".concat(e.os," ").concat(e.osVersion)}function xr(){const e=kr();return!!("WebKit"===Dr.engine.name&&e.os===Cr.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==Nr.SAFARI||Gr()&&e.name!==Nr.SAFARI)}function Vr(){return kr().name===Nr.CHROME}function Fr(){return kr().name===Nr.SAFARI}function Br(){return kr().name===Nr.EDGE}function jr(){return kr().name===Nr.FIREFOX}function Gr(){return kr().os===Cr.IOS}function Wr(e){const t=kr();return!(t.name!==Nr.CHROME||!t.osVersion)&&Number(t.version)>=e}function Hr(e){const t=kr();return!(t.name!==Nr.EDGE||!t.osVersion)&&Number(t.version)>=e}function Kr(e){const t=kr();return!(t.name!==Nr.OPERA||!t.osVersion)&&Number(t.version)>=e}function Yr(){const e=kr();if(e.os!==Cr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function zr(){const e=kr();if(e.os!==Cr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 16===Number(t[0])}function Xr(){const e=kr();if(e.os!==Cr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function Jr(){return Fr()&&navigator.maxTouchPoints>0}function qr(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function Qr(){const e=Mr();return function(){const{deviceType:e}=kr();return"mobile"===e||"tablet"===e}()||e===Cr.ANDROID||e===Cr.IOS||e===Cr.HARMONY_OS}function Zr(){const e=kr();return e.name!==Nr.EDGE&&e.name!==Nr.SAFARI&&!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function $r(){return Mr()===Cr.ANDROID}function en(){const e=kr();return $r()&&(e.name===Nr.CHROME||e.name===Nr.WECHAT||/chrome|chromium/i.test(navigator.userAgent))}function tn(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function rn(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 nn(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?rn(Object(r),!0).forEach((function(t){tn(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):rn(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let on=function(e){return 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.CONVERTING_IMAGEDATA_TO_BLOB_FAILED="CONVERTING_IMAGEDATA_TO_BLOB_FAILED",e.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED="CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED",e.INIT_DATACHANNEL_TIMEOUT="INIT_DATACHANNEL_TIMEOUT",e.CREATE_DATACHANNEL_ERROR="CREATE_DATACHANNEL_ERROR",e.DATACHANNEL_CONNECTION_TIMEOUT="DATACHANNEL_CONNECTION_TIMEOUT",e.PROHIBITED_OPERATION="PROHIBITED_OPERATION",e.IMAGE_MODERATION_UPLOAD_FAILED="IMAGE_MODERATION_UPLOAD_FAILED",e.P2P_MESSAGE_FAILED="P2P_MESSAGE_FAILED",e}({});class sn extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;super(t),tn(this,"code",void 0),tn(this,"message",void 0),tn(this,"data",void 0),tn(this,"name","AgoraRTCException"),this.code=e,this.message="AgoraRTCError ".concat(this.code,": ").concat(t),this.data=r}toString(){return this.data?"data: ".concat(JSON.stringify(this.data),"\n").concat(this.stack):"".concat(this.stack)}print(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"error",t=arguments.length>1?arguments[1]:void 0;return"error"===e&&(t||console).error(this.toString()),"warning"===e&&(t||console).warn(this.toString()),this}throw(e){throw this.print("error",e),this}}function an(e,t){if("boolean"!=typeof e)throw new sn(on.INVALID_PARAMS,"Invalid ".concat(t,": The value is of the boolean type."))}function cn(e,t,r){if(!r.includes(e))throw new sn(on.INVALID_PARAMS,"".concat(t," can only be set as ").concat(JSON.stringify(r)))}function dn(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e4;if(e<r||e>n||(!(arguments.length>4&&void 0!==arguments[4])||arguments[4])&&!function(e){return"number"==typeof e&&e%1==0}(e))throw new sn(on.INVALID_PARAMS,"invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"))}function un(e,t){if("number"!=typeof e){if(!(e.min||e.max||e.ideal||e.exact))throw new sn(on.INVALID_PARAMS,"".concat(t," is not a valid ConstrainLong"));void 0!==e.min&&dn(e.min,"".concat(t,".min"),0,1/0),void 0!==e.max&&dn(e.max,"".concat(t,".max"),1,1/0),void 0!==e.exact&&dn(e.exact,"".concat(t,".exact"),1,1/0),void 0!==e.ideal&&dn(e.ideal,"".concat(t,".ideal"),1,1/0)}else dn(e,t,1,1/0)}function ln(e){return null==e}var pn=function(e){return e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE",e}(pn||{}),hn=function(e){return e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT",e}(hn||{});const fn=new class{constructor(){tn(this,"_clientSize",null),tn(this,"getClientWidth",(()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth)),tn(this,"getClientHeight",(()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight)),tn(this,"getStyle",(e=>window.getComputedStyle(e,null))),tn(this,"checkCssVisibleProperty",(e=>{let t=!0;const r=this.getStyle(e),{display:n,visibility:i,opacity:o,filter:s}=r;return("none"===n||["hidden","collapse"].includes(i)||Number(o)<.1)&&(t=!1),!!t&&(s&&s.split(" ").filter((e=>{const t=e.split("(")[0];return["brightness","blur","opacity"].includes(t)})).map((e=>{const[t,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)}})),t)})),tn(this,"checkPropertyUpToAllParentNodes",((e,t)=>{let r=!0,n=!0;const i=e=>t(e);let o=e;for(;o&&n;)i(o)||(r=!1,n=!1),o=o.parentElement,o||(n=!1);return r})),tn(this,"checkActualCssVisibleIncludeInherit",(e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty))),tn(this,"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)}})),tn(this,"checkActualSize",(()=>{const{width:e,height:t,clientMin:r}=this._clientSize;return this.checkSizeIsVisible(e,t,r)})),tn(this,"elementFromPoint",((e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null)),tn(this,"checkCoverForAPoint",((e,t,r)=>{const n=this.elementFromPoint(e,t);return null!==n&&n!==r})),tn(this,"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]})),tn(this,"checkElementCover",(e=>this.getPointPositionList().map((t=>this.checkCoverForAPoint(t.x,t.y,e))).filter((e=>!!e)).length>6)),tn(this,"checkSizeIsVisible",((e,t,r)=>(e>50||r/e<=10)&&(t>50||r/t<=10))),tn(this,"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,p=u-d;return this.checkSizeIsVisible(l,p,s)})),tn(this,"returnHiddenResult",(e=>(this._clientSize=null,{visible:!1,reason:e}))),tn(this,"checkOneElementVisible",(e=>{if(e instanceof HTMLElement){if(this.checkElementIsMountedOnDom(e)){if(this.checkActualCssVisibleIncludeInherit(e)){if(this._clientSize=this.getSizeAboutClient(e),this.checkElementCover(e))return this.returnHiddenResult(pn.COVERED);{const e=this.checkActualSize(),t=this.checkSizeOfPartInClient();return e&&!t?this.returnHiddenResult(pn.POSITION):e?(this._clientSize=null,{visible:!0}):this.returnHiddenResult(pn.SIZE)}}return this.returnHiddenResult(pn.STYLE)}return this.returnHiddenResult(hn.UNMOUNTED)}return this.returnHiddenResult(hn.INVALID_HTML_ELEMENT)})),tn(this,"checkElementIsMountedOnDom",(e=>this.checkPropertyUpToAllParentNodes(e,(e=>"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement))))}};const En=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 mn{constructor(){tn(this,"_events",{}),tn(this,"addListener",this.on)}getListeners(e){return this._events[e]?this._events[e].map((e=>e.listener)):[]}on(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!1})}once(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!0})}off(e,t){if(!this._events[e])return;const r=this._events[e],n=this._indexOfListener(r,t);-1!==n&&r.splice(n,1),0===this._events[e].length&&delete this._events[e]}removeAllListeners(e){e?delete this._events[e]:this._events={}}emit(e){this._events[e]||(this._events[e]=[]);const t=this._events[e].map((e=>e));for(var r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(let r=0;r<t.length;r+=1){const i=t[r];i.once&&this.off(e,i.listener),i.listener.apply(this,n||[])}}safeEmit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];[...this._events[e]||[]].forEach((t=>{t.once&&this.off(e,t.listener);try{t.listener.apply(this,r)}catch(t){console.error("safeEmit event:".concat(e," error ").concat(null==t?void 0:t.toString()))}}))}_indexOfListener(e,t){let r=e.length;for(;r--;)if(e[r].listener===t)return r;return-1}}function _n(){return!!gn()}let Tn=null;function gn(){if(Tn)return Tn;if(window.electron)return Tn=window.electron;if(!window.require)return null;try{return Tn=window.require("electron"),Tn}catch(e){return null}}let Sn=function(e){return e.CREATE_CLIENT="createClient",e.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",e.SET_AREA="setArea",e.PRELOAD="PRELOAD",e.CHECK_VIDEO_TRACK_IS_ACTIVE="checkVideoTrackIsActive",e.CHECK_AUDIO_TRACK_IS_ACTIVE="checkAudioTrackIsActive",e.CREATE_MIC_AUDIO_TRACK="createMicrophoneAudioTrack",e.CREATE_CUSTOM_AUDIO_TRACK="createCustomAudioTrack",e.CREATE_BUFFER_AUDIO_TRACK="createBufferSourceAudioTrack",e.CREATE_CAM_VIDEO_TRACK="createCameraVideoTrack",e.CREATE_CUSTOM_VIDEO_TRACK="createCustomVideoTrack",e.CREATE_MIC_AND_CAM_TRACKS="createMicrophoneAndCameraTracks",e.CREATE_SCREEN_VIDEO_TRACK="createScreenVideoTrack",e.SET_ENCRYPTION_CONFIG="Client.setEncryptionConfig",e.START_PROXY_SERVER="Client.startProxyServer",e.STOP_PROXY_SERVER="Client.stopProxyServer",e.SET_PROXY_SERVER="Client.setProxyServer",e.SET_TURN_SERVER="Client.setTurnServer",e.SET_CLIENT_ROLE="Client.setClientRole",e.SET_LOW_STREAM_PARAMETER="Client.setLowStreamParameter",e.ENABLE_DUAL_STREAM="Client.enableDualStream",e.DISABLE_DUAL_STREAM="Client.disableDualStream",e.JOIN="Client.join",e.LEAVE="Client.leave",e.PUBLISH="Client.publish",e.UNPUBLISH="Client.unpublish",e.SUBSCRIBE="Client.subscribe",e.MASS_SUBSCRIBE="Client.massSubscribe",e.MASS_UNSUBSCRIBE="Client.massUnsubscribe",e.UNSUBSCRIBE="Client.unsubscribe",e.RENEW_TOKEN="Client.renewToken",e.SET_REMOTE_VIDEO_STREAM_TYPE="Client.setRemoteVideoStreamType",e.SET_STREAM_FALLBACK_OPTION="Client.setStreamFallbackOption",e.ENABLE_AUDIO_VOLUME_INDICATOR="Client.enableAudioVolumeIndicator",e.SEND_CUSTOM_REPORT_MESSAGE="Client.sendCustomReportMessage",e.INSPECT_VIDEO_CONTENT="Client.inspectVideoContent",e.STOP_INSPECT_VIDEO_CONTENT="Client.stopInspectVideoContent",e.JOIN_FALLBACK_TO_PROXY="Client._joinFallbackToProxy",e.ON_LIVE_STREAM_WARNING="Client.onLiveStreamWarning",e.ON_LIVE_STREAM_ERROR="Client.onLiveStreamingError",e.START_LIVE_STREAMING="Client.startLiveStreaming",e.SET_LIVE_TRANSCODING="Client.setLiveTranscoding",e.STOP_LIVE_STREAMING="Client.stopLiveStreaming",e.START_CHANNEL_MEDIA_RELAY="Client.startChannelMediaRelay",e.UPDATE_CHANNEL_MEDIA_RELAY="Client.updateChannelMediaRelay",e.STOP_CHANNEL_MEDIA_RELAY="Client.stopChannelMediaRelay",e.REQUEST_CONFIG_DISTRIBUTE="_config-distribute-request",e.SET_CONFIG_DISTRIBUTE="_configDistribute",e.LOCAL_TRACK_SET_MUTED="LocalTrack.setMute",e.LOCAL_AUDIO_TRACK_PLAY="LocalAudioTrack.play",e.LOCAL_AUDIO_TRACK_PLAY_IN_ELEMENT="LocalAudioTrack.playInElement",e.LOCAL_AUDIO_TRACK_STOP="LocalAudioTrack.stop",e.LOCAL_AUDIO_TRACK_SET_VOLUME="LocalAudioTrack.setVolume",e.MIC_AUDIO_TRACK_SET_DEVICE="MicrophoneAudioTrack.setDevice",e.BUFFER_AUDIO_TRACK_START="BufferSourceAudioTrack.startProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_STOP="BufferSourceAudioTrack.stopProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_PAUSE="BufferSourceAudioTrack.pauseProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_RESUME="BufferSourceAudioTrack.resumeProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_SEEK="BufferSourceAudioTrack.seekAudioBuffer",e.LOCAL_VIDEO_TRACK_PLAY="LocalVideoTrack.play",e.LOCAL_VIDEO_TRACK_STOP="LocalVideoTrack.stop",e.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE="LocalVideoTrack.getVideoElementVisibleStatus",e.LOCAL_VIDEO_TRACK_BEAUTY="LocalVideoTrack.setBeautyEffect",e.LOCAL_VIDEO_SEND_SEI_DATA="LocalVideoTrack.sendSeiData",e.CAM_VIDEO_TRACK_SET_DEVICE="CameraVideoTrack.setDevice",e.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG="CameraVideoTrack.setEncoderConfiguration",e.REMOTE_VIDEO_TRACK_PLAY="RemoteVideoTrack.play",e.REMOTE_VIDEO_TRACK_STOP="RemoteVideoTrack.stop",e.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE="RemoteVideoTrack.getVideoElementVisibleStatus",e.REMOTE_AUDIO_TRACK_PLAY="RemoteAudioTrack.play",e.REMOTE_AUDIO_TRACK_STOP="RemoteAudioTrack.stop",e.REMOTE_AUDIO_SET_VOLUME="RemoteAudioTrack.setVolume",e.REMOTE_AUDIO_SET_OUTPUT_DEVICE="RemoteAudioTrack.setOutputDevice",e.GET_MEDIA_STREAM_TRACK="Track.getMediaStreamTrack",e.STREAM_TYPE_CHANGE="streamTypeChange",e.CONNECTION_STATE_CHANGE="connectionStateChange",e.LOAD_CONFIG_FROM_LOCALSTORAGE="loadConfigFromLocalStorage",e.IMAGE_MODERATION_UPLOAD="imageModerationUpload",e}({}),vn=function(e){return e.TRACER="tracer",e}({});!function(e){e[e.AUDIENCE_LEVEL_LOW_LATENCY=1]="AUDIENCE_LEVEL_LOW_LATENCY",e[e.AUDIENCE_LEVEL_ULTRA_LOW_LATENCY=2]="AUDIENCE_LEVEL_ULTRA_LOW_LATENCY",e[e.AUDIENCE_LEVEL_SYNC_LATENCY=3]="AUDIENCE_LEVEL_SYNC_LATENCY"}({}),function(e){e.LEAVE="LEAVE",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.UID_BANNED="UID_BANNED",e.FALLBACK="FALLBACK",e.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.LICENSE_MISSING="LICENSE_MISSING",e.LICENSE_EXPIRED="LICENSE_EXPIRED",e.LICENSE_MINUTES_EXCEEDED="LICENSE_MINUTES_EXCEEDED",e.LICENSE_PERIOD_INVALID="LICENSE_PERIOD_INVALID",e.LICENSE_MULTIPLE_SDK_SERVICE="LICENSE_MULTIPLE_SDK_SERVICE",e.LICENSE_ILLEGAL="LICENSE_ILLEGAL",e.TOKEN_EXPIRE="TOKEN_EXPIRE"}({}),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.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"}({}),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"}({});let Rn=function(e){return e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({}),yn=function(e){return e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e}({});function An(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return 0===e.getListeners(t).length?Promise.reject(new sn(on.UNEXPECTED_ERROR,"can not emit promise")):new Promise(((r,i)=>{e.emit(t,...n,r,i)}))}function On(e,t){if(0===e.getListeners(t).length)return Promise.resolve();for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return An(e,t,...n)}function In(e,t){if(0===e.getListeners(t).length)return null;for(var r=arguments.length,n=new Array(r>2?r-2:0),i=2;i<r;i++)n[i-2]=arguments[i];return function(e,t){let r=null,n=null;for(var i=arguments.length,o=new Array(i>2?i-2:0),s=2;s<i;s++)o[s-2]=arguments[s];if(e.emit(t,...o,(e=>{r=e}),(e=>{n=e})),null!==n)throw n;if(null===r)throw new sn(on.UNEXPECTED_ERROR,"handler is not sync");return r}(e,t,...n)}const bn=new class extends mn{set networkState(e){this.emit(yn.NETWORK_STATE_CHANGE,e,this._networkState),e===Rn.ONLINE?this.emit(yn.ONLINE):e===Rn.OFFLINE&&(this.onlineWaiter=new Promise((e=>{this.once(yn.ONLINE,(()=>{this.onlineWaiter=void 0,e(Rn.ONLINE)}))})),this.emit(yn.OFFLINE)),this._networkState=e}get networkState(){return this._networkState}get isOnline(){return this._networkState===Rn.ONLINE}constructor(){super(),tn(this,"_moduleName","network-indicator"),tn(this,"_networkState",Rn.ONLINE),tn(this,"onlineWaiter",void 0),window.addEventListener("online",(()=>{this.networkState=Rn.ONLINE})),window.addEventListener("offline",(()=>{this.networkState=Rn.OFFLINE}))}};function Cn(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function Nn(e){"undefined"!=typeof Promise?Promise.resolve().then(e):setTimeout(e,0)}function wn(e){return JSON.parse(JSON.stringify(e))}function Dn(e){try{return wn(e)}catch(t){return e}}const Pn={};function kn(e,t){Pn[t]||(Pn[t]=!0,e())}function Ln(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function Mn(e){return new Promise((t=>{window.setTimeout(t,e)}))}function Un(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7,t=arguments.length>1?arguments[1]:void 0;const r=Math.random().toString(16).substr(2,e).toLowerCase();return r.length===e?"".concat(t).concat(r):"".concat(t).concat(r)+Un(e-r.length,"")}const xn=()=>{},Vn=new class{constructor(){tn(this,"fnMap",new Map)}throttleByKey(e,t,r,n){for(var i=arguments.length,o=new Array(i>4?i-4:0),s=4;s<i;s++)o[s-4]=arguments[s];if(this.fnMap.has(t)){const i=this.fnMap.get(t);if(i.threshold!==r){i.fn(...i.args),clearTimeout(i.timer);const s=window.setTimeout((()=>{const e=this.fnMap.get(t);e&&e.fn(...e.args),this.fnMap.delete(t)}),r);this.fnMap.set(t,{fn:e,threshold:r,timer:s,args:o,skipFn:n})}else i.skipFn&&i.skipFn(...i.args),this.fnMap.set(t,nn(nn({},i),{},{fn:e,args:o,skipFn:n}))}else{const i=window.setTimeout((()=>{const e=this.fnMap.get(t);e&&e.fn(...e.args),this.fnMap.delete(t)}),r);this.fnMap.set(t,{fn:e,threshold:r,timer:i,args:o,skipFn:n})}}},Fn=Vn.throttleByKey.bind(Vn);function Bn(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}function jn(e,t){if(!Bn(e)||!Bn(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]=jn(e[n],t[n]);return r}{const r=nn({},e);for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(Object.prototype.hasOwnProperty.call(e,n)?r[n]=jn(e[n],t[n]):r[n]=t[n]);return r}}function Gn(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}let Wn=1,Hn=console;class Kn{static setLogger(e){Hn=e}constructor(e){tn(this,"lockingPromise",Promise.resolve()),tn(this,"locks",0),tn(this,"name",""),tn(this,"lockId",void 0),this.lockId=Wn++,e&&(this.name=e),Hn.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}get isLocked(){return this.locks>0}lock(e){let t;this.locks+=1,Hn.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is locked, current queue ").concat(this.locks,". ").concat("string"==typeof e?e:""));const r=new Promise((r=>{t=()=>{this.locks-=1,Hn.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is not locked, current queue ").concat(this.locks,". ").concat("string"==typeof e?e:"")),r()}})),n=this.lockingPromise.then((()=>t));return this.lockingPromise=this.lockingPromise.then((()=>r)),n}}function Yn(e,t){return function(r,n,i){const o=i.value;if("function"!=typeof o)throw new Error("Cannot use mutex on object property.");return i.value=async function(){const r=this[t];if(!r)throw new Error("mutex property key ".concat(t," doesn't exist on ").concat(e));const i=await r.lock("From ".concat(e,".").concat(n));try{for(var s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];return await o.apply(this,a)}finally{i()}},i}}const zn={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function Xn(e,t,r,n){const i=Object.assign({},zn,n);let o=i.timeout;const s=async()=>{await function(e){return new Promise((t=>{window.setTimeout(t,e)}))}(o),o*=i.timeoutFactor,o=Math.min(i.maxRetryTimeout,o)};let a=!1;const c=new Promise((async(n,o)=>{t=t||(()=>!1),r=r||(()=>!0);for(let c=0;c<i.maxRetryCount;c+=1){if(a)return o(new sn(on.OPERATION_ABORTED));try{const r=await e();if(!t(r,c))return n(r);if(c+1===i.maxRetryCount)return n(r);await s()}catch(e){if(!r(e,c))return o(e);if(c+1===i.maxRetryCount)return o(e);await s()}}}));return c.cancel=()=>a=!0,c}let Jn=0,qn=0;function Qn(e,t,r,n){return new Promise(((i,o)=>{t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),Jn+=Ln(t.data)):r&&(t.data.size?Jn+=t.data.size:t.data instanceof FormData?Jn+=function(e){let t=0;return(/DingTalk/i.test(navigator.userAgent)||/AliApp/i.test(navigator.userAgent))&&e.realFormData&&(e=e.realFormData),e.forEach((e=>{t+="string"==typeof e?Ln(e):e.size})),t+138}(t.data):Jn+=Ln(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,br.request(t).then((e=>{"string"==typeof e.data?qn+=Ln(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?qn+=e.data.byteLength:qn+=Ln(JSON.stringify(e.data)),n&&i({data:e.data,headers:e.headers}),i(e.data)})).catch((e=>{br.isCancel(e)?o(new sn(on.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?o(new sn(on.NETWORK_TIMEOUT,e.message)):e.response?o(new sn(on.NETWORK_RESPONSE_ERROR,e.response.status)):o(new sn(on.NETWORK_ERROR,e.message))}))}))}async function Zn(e,t){const r=new Blob([t.data],{type:"buffer"});return await Qn(e,nn(nn({},t),{},{data:r,headers:{"Content-Type":"application/octet-stream"}}),!0)}const $n=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;const t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-([0-9]+)/);if(t&&t[1]&&t[2]){const e=t[1],r=t[2];return"".concat(e,".").concat(r)}return"4.0.0.999"}("4.22.1"),ei=function(){try{return!0===JSON.parse("true")}catch(e){return!0}}();!function(e){e.Default="default",e.Auto="auto",e.Relay="relay",e.SdRtn="sd-rtn"}({});const ti=function(){const e="us".concat("erna","me"),t="pa".concat("sswo","rd"),r=["t","s","t"];r.splice(1,0,"e");const n=r.join(""),i=[];for(let e=0;e<6;e++)i.push("1");const o=i.join(""),s={};return s[e]=n,s[t]=o,Object.assign(s,{turnServerURL:"",tcpport:3433,udpport:3478,forceturn:!1})}();window.DEFAULT_TURN_CONFIG=ti;const ri=nn(nn({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:[],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,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,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,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,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,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,DATASTREAM_MAX_RETRANSMITS:10,TCP_CANDIDATE_ONLY:!1,EXTERNAL_SIGNAL_REQUEST_TIMEOUT:3e3,SHOW_P2P_LOG:!1,MAX_P2P_TIMEOUT:3e4,P2P_TOKEN_INTERVAL:1e3,SHOW_DATASTREAM2_LOG:!1,RESTRICTION_SET_PLAYBACK_DEVICE:!0,USE_PURE_ENCRYPTION_MASTER_KEY:!1,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:[],USE_NEW_NETWORK_CONFIG:!1,AUTO_RESET_AUDIO_ROUTE:!1,PLUGIN_INFO:[],OVERUSE_DETECTOR_PARAMS:{MIN_FRAME_RATE:1,MAX_FRAME_RATE:30,MAX_THRESHOLD_FRAMERATE:30,BITRATE_MIN_THRESHOLD:100,BITRATE_MAX_THRESHOLD:100,MAX_SCALE:5,BWE_SCALE_UP_THRESHOLD:.6,BWE_SCALE_DOWN_THRESHOLD:.6,PERF_SCALE_UP_THRESHOLD:.7,PERF_SCALE_DOWN_THRESHOLD:.6,MOTION_RESOLUTION_FACTOR:.8,MOTION_BITRATE_FACTOR:.6,DETAIL_FRAMERATE_FACTOR:.8,DETAIL_BITRATE_FACTOR:.6,BALANCE_RESOLUTION_FACTOR:.9,BALANCE_FRAMERATE_FACTOR:.9,BALANCE_BITRATE_FACTOR:.6,OVERUSE_TIMES_THRESHOLD:10,UNDERUSE_TIMES_THRESHOLD:40},ENABLE_AG_ADAPTATION:!0,FORCE_AG_HIGH_FRAMERATE:!1,FORCE_SUPPORT_AG_ADAPTATION:!1,CUSTOM_ADAPTATION_DEFAULT_MODE:"",ENCODER_CONFIG_LIMIT:{},CAMERA_CAPTURE_CONFIG:void 0,HIDE_NO_POSTER:!1,AP_CACHE_NUM:10,AP_UPDATE_INTERVAL:12e4,AP_CACHE_LIFETIME:12e4,MAX_PRELOAD_ASYNC_LENGTH:3,ENABLE_PRELOAD:!0,DISABLE_SCREEN_SHARE_REMB:!1},{ENABLE_PUBLISHED_USER_LIST:!0,MAX_SUBSCRIPTION:50,SUBSCRIBE_AUDIO_FILTER_TOPN:void 0,ENABLE_PUBLISH_AUDIO_FILTER:void 0,ENABLE_USER_LICENSE_CHECK:!0,USE_PUB_RTX:!0,USE_SUB_RTX:!0,DISABLE_FEC:void 0,ENABLE_NTP_REPORT:!1,ENABLE_INSTANT_VIDEO:!1,ENABLE_DATASTREAM_2:!1,ENABLE_USER_AUTO_REBALANCE_CHECK:!0,USE_XR:!0,ENABLE_LOSSBASED_BWE:!0,ENABLE_AUT_CC:!1,ENABLE_CC_FALLBACK:void 0,ENABLE_PREALLOC_PC:!1,SUBSCRIBE_TWCC:!0,PUBLISH_TWCC:!1,ENABLE_SVC:!1,ENABLE_SVC_DEFAULT_CODECS:["H264","VP8","VP9","AV1"],SVC:[],ENABLE_FULL_LINK_AV_SYNC:!1,SVC_MODE:null,PRE_SUB_NUM:2,ENABLE_PRE_SUB:!1,ENABLE_AUT_FEEDBACK:!1}),{},{USE_CANDIDATE_FROM_AP_DETAIL:!1,AP_REQUEST_DETAIL:void 0});function ni(e,t,r){var n;Object.keys(ri).includes(e)&&(!r&&Object.keys(oi).includes(e)||(ri[e]=t,"ENABLE_VIDEO_SEI"===e&&!0===t&&(ri.ENABLE_ENCODED_TRANSFORM=!0),"USE_NEW_NETWORK_CONFIG"===e&&t&&(n=!!t,ri.USE_NEW_NETWORK_CONFIG=n,n&&(ri.WEBCS_DOMAIN=["webrtc2-2.ap.sd-rtn.com"],ri.WEBCS_DOMAIN_BACKUP_LIST=["webrtc2-4.ap.sd-rtn.com"],ri.CDS_AP=["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],ri.ACCOUNT_REGISTER=["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],ri.EVENT_REPORT_DOMAIN="web-2.statscollector.sd-rtn.com",ri.EVENT_REPORT_BACKUP_DOMAIN="statscollector-1.agora.io",ri.GATEWAY_DOMAINS=["edge.sd-rtn.com"])),"ENABLE_PRE_SUB"===e&&t&&(ri.ENABLE_INSTANT_VIDEO=!0,ri.ENABLE_PREALLOC_PC=!0),"ENABLE_SVC"===e&&t&&(ri.ENABLE_AUT_CC=!0)))}function ii(e){return ri[e]}ei||(ri.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],ri.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],ri.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],ri.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],ri.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],ri.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],ri.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",ri.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",ri.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",ri.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",ri.AREAS=["NORTH_AMERICA","OVERSEA"]);const oi={};var si=function(e){return 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_P2P="SET_USE_P2P",e.SET_TRANSPORT_TYPE="SET_TRANSPORT_TYPE",e}(si||{});function ai(e,t,r){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function ci(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 di(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ci(Object(r),!0).forEach((function(t){ai(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ci(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!function(e){e.h264="h264",e.h265="h265",e.vp8="vp8",e.vp9="vp9",e.av1="av1"}({}),function(e){e.opus="opus",e.pcma="pcma",e.pcmu="pcmu",e.g722="g722"}({});const ui=new class extends mn{constructor(){super(...arguments),ai(this,"currentUploadLogID",0)}reportLogUploadError(e){const{errorRange:t}=e;t[t.length-1]&&t[t.length-1]>this.currentUploadLogID&&(this.currentUploadLogID=t[t.length-1],this.emit("REPORT_LOG_UPLOAD",e))}};class li{constructor(e){ai(this,"logger",void 0),ai(this,"prefixLists",[]),this.logger=e}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.debug(...this.prefixLists,...t)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.info(...this.prefixLists,...t)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.warning(...this.prefixLists,...t)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.error(...this.prefixLists,...t)}prefix(e){return this.prefixLists.push(e),this}popPrefix(){return this.prefixLists.pop(),this}}function pi(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}function hi(){const e=new Date,t=/((\d+:){2}\d+)/.exec((new Date).toUTCString());return t?(null==t?void 0:t[0])+":"+e.getUTCMilliseconds():e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}const fi={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},Ei=Date.now(),mi=e=>{for(const t in fi)if(Object.prototype.hasOwnProperty.call(fi,t)&&fi[t]===e)return t;return"DEFAULT"};const _i=new class{constructor(){ai(this,"proxyServerURL",void 0),ai(this,"logLevel",fi.DEBUG),ai(this,"uploadState","collecting"),ai(this,"uploadLogWaitingList",[]),ai(this,"uploadLogUploadingList",[]),ai(this,"uploadErrorCount",0),ai(this,"currentLogID",0),ai(this,"url",void 0),ai(this,"extLog",((e,t)=>{this.appendLogToWaitingList(e,...t)}))}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[fi.DEBUG].concat(t);this.log.apply(this,n)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[fi.INFO].concat(t);this.log.apply(this,n)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[fi.WARNING].concat(t);this.log.apply(this,n)}warn(){this.warning(...arguments)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[fi.ERROR].concat(t);this.log.apply(this,n)}upload(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=[fi.DEBUG].concat(t);this.uploadLog.apply(this,n)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){ni("UPLOAD_LOG",!0)}disableLogUpload(){ni("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new li(this).prefix(e)}log(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Date.now()-Ei<100)return void setTimeout((()=>{this.log(...t)}),Date.now()-Ei);const n=Math.max(0,Math.min(4,t[0]));if(t[0]=pi()+" Agora-SDK [".concat(mi(n),"]:"),this.appendLogToWaitingList(n,...t),n<this.logLevel)return;const i=pi()+" %cAgora-SDK [".concat(mi(n),"]:");let o=[];if(!ii("USE_NEW_LOG"))switch(n){case fi.DEBUG:o=[i,"color: #64B5F6;"].concat(t.slice(1)),console.log.apply(console,o);break;case fi.INFO:o=[i,"color: #1E88E5; font-weight: bold;"].concat(t.slice(1)),console.log.apply(console,o);break;case fi.WARNING:o=[i,"color: #FB8C00; font-weight: bold;"].concat(t.slice(1)),console.warn.apply(console,o);break;case fi.ERROR:o=[i,"color: #B00020; font-weight: bold;"].concat(t.slice(1)),console.error.apply(console,o)}}uploadLog(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Date.now()-Ei<100)return void setTimeout((()=>{this.uploadLog(...t)}),Date.now()-Ei);const n=Math.max(0,Math.min(4,t[0]));t[0]=pi()+" Agora-SDK [".concat(mi(n),"]:"),this.appendLogToWaitingList(n,...t)}appendLogToWaitingList(e){if(!ii("UPLOAD_LOG"))return;for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];Array.isArray(r[0])?r[0][0]=hi()+" Agora-SDK [".concat(mi(e),"]:"):r[0]=hi()+" Agora-SDK [".concat(mi(e),"]:");let i="";r.forEach((e=>{"object"==typeof e&&(e=JSON.stringify(e)),i+="".concat(e," ")})),this.uploadLogWaitingList.push({payload_str:i,log_level:e,log_item_id:this.currentLogID++}),"uploading"===this.uploadState&&0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}startUpload(){this.uploadState="uploading",0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}async uploadLogs(){const e=this.uploadLogUploadingList,t={sdk_version:$n,process_id:ii("PROCESS_ID"),payload:JSON.stringify(e)};return Xn((async()=>{const e=await br.post(this.url||(this.proxyServerURL?"https://".concat(this.proxyServerURL,"/ls/?h=").concat(ii("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(ii("LOG_UPLOAD_SERVER"),"/upload/v1")),t,{responseType:"text"});if("OK"!==e.data){const t=new Error("unexpected upload log response");throw t.response=e,t}}),(()=>(this.uploadLogUploadingList=[],!1)),(t=>{const r={status:-1,message:t.message,errorRange:e.map((e=>e.log_item_id))};return t.response?(r.status=t.response.status,r.data=t.response.data,r.headers=t.response.headers):t.request&&(r.status=t.request.status),ui.reportLogUploadError(r),!0}),{timeout:ii("UPLOAD_LOG_REQUEST_RETRY_INTERVAL"),maxRetryTimeout:ii("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,ii("UPLOAD_LOG_LENGTH_EACH_TIME"))),this.uploadLogs().then((()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout((()=>this.uploadLogInterval()),ii("UPLOAD_LOG_INTERVAL"))})).catch((e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout((()=>this.uploadLogInterval()),ii("UPLOAD_LOG_TWICE_RETRY_INTERVAL_V1")):window.setTimeout((()=>this.uploadLogInterval()),ii("UPLOAD_LOG_RETRY_INTERVAL_V1"))})))}};var Ti;(Ti={}).FREE="free",Ti.UPLOADING="uploading",function(e){e[e.MISC=0]="MISC",e[e.INTERNAL_EVENT=1]="INTERNAL_EVENT",e[e.PUBLIC_EVENT=2]="PUBLIC_EVENT",e[e.WEB_EVENT=3]="WEB_EVENT",e[e.INTERNAL_API=4]="INTERNAL_API",e[e.WEB_API=5]="WEB_API",e[e.PUBLIC_API=6]="PUBLIC_API"}({});const gi={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};let Si=function(e){return e.PUBLISH="publish",e.SUBSCRIBE="subscribe",e.WS_COMPRESSOR_INIT="ws_compressor_init",e.SESSION_INIT="session_init",e.JOIN_CHOOSE_SERVER="join_choose_server",e.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",e}({}),vi=function(e){return 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",e}({});!function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}({});let Ri=function(e){return e[e.SESSION=26]="SESSION",e[e.JOIN_CHOOSE_SERVER=27]="JOIN_CHOOSE_SERVER",e[e.REQ_USER_ACCOUNT=196]="REQ_USER_ACCOUNT",e[e.JOIN_GATEWAY=28]="JOIN_GATEWAY",e[e.PUBLISH=30]="PUBLISH",e[e.SUBSCRIBE=29]="SUBSCRIBE",e[e.WS_COMPRESSOR_INIT=9430]="WS_COMPRESSOR_INIT",e[e.STREAM_SWITCH=32]="STREAM_SWITCH",e[e.AUDIO_SENDING_STOPPED=33]="AUDIO_SENDING_STOPPED",e[e.VIDEO_SENDING_STOPPED=34]="VIDEO_SENDING_STOPPED",e[e.REQUEST_PROXY_APPCENTER=35]="REQUEST_PROXY_APPCENTER",e[e.REQUEST_PROXY_WORKER_MANAGER=36]="REQUEST_PROXY_WORKER_MANAGER",e[e.API_INVOKE=41]="API_INVOKE",e[e.FIRST_VIDEO_RECEIVED=348]="FIRST_VIDEO_RECEIVED",e[e.FIRST_AUDIO_RECEIVED=349]="FIRST_AUDIO_RECEIVED",e[e.FIRST_VIDEO_DECODE=350]="FIRST_VIDEO_DECODE",e[e.FIRST_AUDIO_DECODE=351]="FIRST_AUDIO_DECODE",e[e.ON_ADD_AUDIO_STREAM=352]="ON_ADD_AUDIO_STREAM",e[e.ON_ADD_VIDEO_STREAM=353]="ON_ADD_VIDEO_STREAM",e[e.ON_UPDATE_STREAM=356]="ON_UPDATE_STREAM",e[e.ON_REMOVE_STREAM=355]="ON_REMOVE_STREAM",e[e.JOIN_CHANNEL_TIMEOUT=407]="JOIN_CHANNEL_TIMEOUT",e[e.PEER_PUBLISH_STATUS=408]="PEER_PUBLISH_STATUS",e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT",e[e.JOIN_WEB_PROXY_AP=700]="JOIN_WEB_PROXY_AP",e[e.WEBSOCKET_QUIT=671]="WEBSOCKET_QUIT",e[e.USER_ANALYTICS=1e4]="USER_ANALYTICS",e[e.AUTOPLAY_FAILED=9178]="AUTOPLAY_FAILED",e}({});function yi(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(t,r,n){const i=n.value;if("function"==typeof i){const o=e.className||t.__className__||("AgoraRTCClient"===t.constructor.name?"Client":t.constructor.name);n.value=function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];let a=n;if(e.argsMap)try{a=e.argsMap(this,...n)}catch(e){_i.warning(e),a=[]}try{JSON.stringify(a)}catch(e){_i.warning("arguments for method ".concat(o,".").concat(String(r)," not serializable for apiInvoke.")),a=[]}const c=(e.report||Ai).reportApiInvoke(this._sessionId||null,{name:"".concat(o,".").concat(String(r)),options:a,tag:vn.TRACER,reportResult:e.reportResult},e.throttleTime);try{const t=i.apply(this,n);return t instanceof Promise?t.then((t=>(c.onSuccess(e.reportResult&&t),t))).catch((e=>{throw c.onError(e),e})):(c.onSuccess(e.reportResult&&t),t)}catch(e){throw c.onError(e),e}}}return n}}const Ai=new class{constructor(){ai(this,"baseInfoMap",new Map),ai(this,"proxyServer",void 0),ai(this,"eventUploadTimer",void 0),ai(this,"setSessionIdTimer",void 0),ai(this,"url",void 0),ai(this,"sids",new Set),ai(this,"backupUrl",void 0),ai(this,"_appId",void 0),ai(this,"keyEventUploadPendingItems",[]),ai(this,"normalEventUploadPendingItems",[]),ai(this,"apiInvokeUploadPendingItems",[]),ai(this,"apiInvokeCount",0),ai(this,"ltsList",[]),ai(this,"lastSendNormalEventTime",Date.now()),ai(this,"customReportCounterTimer",void 0),ai(this,"customReportCount",0),ai(this,"extApiInvoke",(async e=>{for(const t of e){const e=di(di({},t),{},{sid:null,invokeId:++this.apiInvokeCount,tag:vn.TRACER});this.sendApiInvoke(e)}})),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),ii("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),ii("EVENT_REPORT_SEND_INTERVAL"))}getBaseInfoBySessionId(e){return this.baseInfoMap.get(e)}adjustSessionStartTime(e){if(!this.baseInfoMap.has(e)&&!this.baseInfoMap.get(e))return void _i.error("adjust session ".concat(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,_i.debug("rewrite session ".concat(e," startTime: ").concat(r," , ").concat(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=!!ii("SHOW_REPORT_INVOKER_LOG");s&&_i.info("".concat(t.name," start"),t.options);let a=!1;Mn(t.timeout).then((()=>{a||(this.sendApiInvoke(di(di({},o()),{},{error:on.API_INVOKE_TIMEOUT,success:!1})),_i.debug("".concat(t.name," timeout")))}));const c=new sn(on.UNEXPECTED_ERROR,"".concat(t.name,": this api invoke is end"));return{onSuccess:e=>{const n=()=>{if(a)throw c;return a=!0,this.sendApiInvoke(di(di({},o()),{},{success:!0},t.reportResult&&{result:e})),s&&_i.info("".concat(t.name," onSuccess")),e};return r?Fn(n,t.name+"Success",r,(()=>a=!0)):n()},onError:e=>{const n=()=>{if(a)throw e;a=!0,this.sendApiInvoke(di(di({},o()),{},{success:!1,error:e})),s&&_i.info("".concat(t.name," onFailure"),e.toString())};return r?Fn(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:ii("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:ei?"global":"oversea",areas:ii("AREAS")&&ii("AREAS").join(",")},t.extend),{stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientRole:u}=t,l=Date.now(),p=di(di({},n),{},{eventType:Si.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,buildFormat:t.buildFormat,build:"v4.22.1-0-g1c8e27e9(9/19/2024, 2:23:30 PM)",lts:l,elapse:l-r,extend:JSON.stringify(i),mode:t.mode,process:ii("PROCESS_ID"),appType:ii("APP_TYPE"),success:!0,version:$n,stringUid:o,channelProfile:s,channelMode:a,isABTestSuccess:c,lsid:d,clientType:window.navigator.userAgent.includes("AgoraWebView")?42:20,clientRole:u,serviceId:ii("PROCESS_ID"),extensionID:ii("PLUGIN_INFO").join(",")||""});this.send({type:vi.SESSION,data:p},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=di(di({},n),{},{eventType:Si.JOIN_CHOOSE_SERVER,lts:i,eventElapse:t.elapse||i-t.lts,chooseServerAddr:t.csAddr,errorCode:t.ec,elapse:i-r.startTime,success:t.succ,chooseServerAddrList:JSON.stringify(t.serverList),uid:t.uid?parseInt(t.uid):null,cid:t.cid?parseInt(t.cid):null,chooseServerIp:t.csIp||"",opid:t.opid,unilbsServerIds:t.unilbsServerIds,extend:t.extend||void 0,isHttp3:t.isHttp3,corssRegionTagReq:t.corssRegionTagReq||void 0,corssRegionTagRes:t.corssRegionTagRes||void 0});this.send({type:vi.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=di(di({},n),{},{eventType:Si.REQ_USER_ACCOUNT,lts:i,success:t.success,serverAddress:t.serverAddr,stringUid:t.stringUid,uid:t.uid,errorCode:t.errorCode,elapse:t.elapse||i-r.startTime,eventElapse:i-t.lts,extend:JSON.stringify(t.extend)});this.send({type:vi.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}=t,a=i-(o&&s?s:r.startTime),c=di(di({},n),{},{eventType:Si.JOIN_GATEWAY,lts:i,gatewayAddr:t.addr,success:t.succ,errorCode:t.ec,errorMsg:t.errorMsg||"",elapse:a,eventElapse:i-t.lts,firstSuccess:o,signalChannel:t.signalChannel,preload:t.preload?1:0});t.succ&&(r.lastJoinSuccessTime=i),this.send({type:vi.JOIN_GATEWAY,data:c},!0)}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=Date.now(),i=di(di({},r.info),{},{lts:n,timeout:t,elapse:n-r.startTime});this.send({type:vi.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=di(di({},n),{},{eventType:Si.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:vi.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=di(di({},i),{},{eventType:Si.SUBSCRIBE,lts:o,eventElapse:t.eventElapse,elapse:o-n.startTime,success:t.succ,errorCode:t.ec,video:t.video,audio:t.audio,subscribeRequestid:t.subscribeRequestid,p2pid:t.p2pid,preSsrc:t.preSsrc?1:0},r&&{extend:JSON.stringify({isMassSubscribe:!0})});"string"==typeof t.peerid?s.peerSuid=t.peerid:s.peer=t.peerid,this.send({type:vi.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=di(di({},i),{},{eventType:Si.WS_COMPRESSOR_INIT,lts:o,eventElapse:e.eventElapse,elapse:o-n.startTime,status:e.status?1:2});this.send({type:vi.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=di(di(di({},o),n),{},{elapse:s-i.startTime,eventType:t,lts:s,firstDecodeFrame:Math.max((n.firstFrame||s)-i.startTime,0),apEnd:Math.max(n.apEnd-i.startTime,0),apStart:Math.max(n.apStart-i.startTime,0),joinGwEnd:Math.max(n.joinGwEnd-i.startTime,0),joinGwStart:Math.max(n.joinGwStart-i.startTime,0),pcEnd:Math.max(n.pcEnd-i.startTime,0),pcStart:Math.max(n.pcStart-i.startTime,0),subscriberEnd:Math.max(n.subscriberEnd-i.startTime,0),subscriberStart:Math.max(n.subscriberStart-i.startTime,0),videoAddNotify:Math.max(n.videoAddNotify-i.startTime,0)});this.send({type:r,data:a},!0)}firstRemoteFrame(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,s=Date.now(),a=di(di(di({},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=di(di(di({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),elapse:i-r.startTime,eventType:Si.PC_STATS,lts:i,preallocation:t.preallocation?1:0});this.send({type:vi.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=di(di(di({},n),t),{},{vid:void 0===n.vid?0:Number(n.vid),eventType:Si.UPDATE_REMOTE_RTPCAPABILITIES,lts:i});this.send({type:vi.UPDATE_REMOTE_RTPCAPABILITIES,data:o},!0)}}onGatewayStream(e,t,r,n){const i=this.baseInfoMap.get(e);if(!i)return;const o=i.info,s=Date.now(),a=di(di(di({},o),n),{},{eventType:t,lts:s});this.send({type:r,data:a},!0)}streamSwitch(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=di(di({},n),{},{eventType:Si.STREAM_SWITCH,lts:i,isDual:t.isdual,elapse:i-r.startTime,success:t.succ});this.send({type:vi.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=di(di({},n),{},{eventType:Si.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:vi.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=di(di({},n),{},{eventType:Si.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:vi.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?_i.debug("reportProxyServerurl: ".concat(e)):_i.debug("disable reportProxyServerurl: ".concat(e))}peerPublishStatus(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now(),o=di(di({},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:vi.PEER_PUBLISH_STATUS,data:o},!0)}workerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const n=r.info,i=Date.now();(function(e,t,r){const n=e[t];if(!n||"string"!=typeof n)return[e];e[t]="";const i=Ln(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]=nn(nn({},e),{},{[t]:n.substring(o,c)}),o=c,a=n.charCodeAt(c)<=127?1:3);return o!==n.length-1&&(s[s.length]=nn(nn({},e),{},{[t]:n.substring(o)})),s})(di(di(di({},n),t),{},{elapse:i-r.startTime,lts:i,productType:"WebRTC"}),"payload",1300).forEach((e=>this.send({type:vi.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=di(di(di({},n),t),{},{elapse:i-r.startTime,lts:i});this.send({type:vi.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=di(di(di({},n),t),{},{elapse:i-r.startTime,lts:i,extend:t.extend||void 0});this.send({type:vi.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=di(di(di({},n),t),{},{elapse:i-r.startTime,lts:i});this.send({type:vi.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>ii("CUSTOM_REPORT_LIMIT"))throw new sn(on.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval((()=>{this.customReportCount=0}),5e3));const r=Date.now(),n=t.map((t=>({type:vi.USER_ANALYTICS,data:di(di({sid:e},t),{},{lts:r})})));try{ii("NEW_REPORT_SERVER")?await this.postDataToStatsCollector2(n):await this.postDataToStatsCollector(n)}catch(e){throw _i.error("send custom report message failed",e.toString()),new sn(on.CUSTOM_REPORT_SEND_FAILED,e.message)}}sendApiInvoke(e){const t=ii("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 sn){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:vi.API_INVOKE,data:a},!1),!0}addSid(e){this.sids.add(e)}removeSid(e){this.sids.delete(e)}appendSessionId(){const e=this.apiInvokeUploadPendingItems;if(0===e.length)return;const t=Array.from(this.sids).find((e=>null!==e));t&&e.forEach((e=>{e&&(e.sid=t,this.sendApiInvoke(Object.assign({},e)))})),e.length=0}send(e,t){if(t)return this.keyEventUploadPendingItems.push(e),void this.sendItems(this.keyEventUploadPendingItems,!0);this.normalEventUploadPendingItems.push(e),this.normalEventUploadPendingItems.length>ii("NORMAL_EVENT_QUEUE_CAPACITY")&&this.normalEventUploadPendingItems.splice(0,1),this.normalEventUploadPendingItems.length>=10&&this.sendItems(this.normalEventUploadPendingItems,!1)}doSend(){this.keyEventUploadPendingItems.length>0&&this.sendItems(this.keyEventUploadPendingItems,!0),this.normalEventUploadPendingItems.length>0&&Date.now()-this.lastSendNormalEventTime>=5e3&&this.sendItems(this.normalEventUploadPendingItems,!1)}sendItems(e,t){const r=[],n=[];for(;e.length;){const t=e.shift();r.length<20?r.push(t):n.push(t)}e.push(...n);for(const e of[...r])-1!==this.ltsList.indexOf(e.data.lts)?(e.data.lts=this.ltsList[this.ltsList.length-1]+1,this.ltsList.push(e.data.lts)):(this.ltsList.push(e.data.lts),this.ltsList.sort(((e,t)=>e-t)));return t||(this.lastSendNormalEventTime=Date.now()),ii("ENABLE_EVENT_REPORT")?(r.length&&(ii("NEW_REPORT_SERVER")?this.postDataToStatsCollector2(r):this.postDataToStatsCollector(r)).catch((e=>r=>{ii("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>ii("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-ii("NORMAL_EVENT_QUEUE_CAPACITY")),_i.warning("report: drop normal events"))))})(r)),e):e}async postDataToStatsCollector2(e){bn.networkState===Rn.OFFLINE&&await Promise.race([bn.onlineWaiter,Mn(2*zn.maxRetryTimeout)]);const t=e=>{let t=new Uint8Array;return e.forEach((e=>{const r=function(e){return(new TextEncoder).encode(e)}(JSON.stringify(e.data)),n=new ArrayBuffer(5),i=(e=>{let t=0;return Object.entries(vi).forEach((r=>{let[n,i]=r;i===e.type&&(t=Ri[n])})),t})(e),o=new DataView(n);o.setUint16(0,r.byteLength,!0),o.setUint8(2,255&i),o.setUint8(3,i>>>8&255),o.setUint8(4,i>>>16&255),t=En(t,new Uint8Array(n)),t=En(t,r)})),t},r="event";let n=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(ii("NEW_REPORT_SERVER_DOMAINS")[0],"&p=443&d=").concat(r):"https://".concat(ii("NEW_REPORT_SERVER_DOMAINS")[0],"/").concat(r);for(let i=0;i<2;i+=1){1===i&&(n=this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(ii("NEW_REPORT_SERVER_DOMAINS")[1],"&p=443&d=").concat(r):"https://".concat(ii("NEW_REPORT_SERVER_DOMAINS")[1],"/").concat(r));try{await Qn(n,{timeout:1e4,data:t(e),headers:di(di({biz:"webrtc",sendts:Math.round(Date.now()/1e3),debug:"false"},this._appId&&{appid:this._appId}),{},{"Content-Type":"application/octet-stream"})},!0)}catch(e){if(1===i)throw e;continue}return}}async postDataToStatsCollector(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const r={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])};bn.networkState===Rn.OFFLINE&&await Promise.race([bn.onlineWaiter,Mn(2*zn.maxRetryTimeout)]);const n=t?"/events/proto-raws":"/events/messages";let i=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(ii("EVENT_REPORT_DOMAIN"),"&p=").concat(ii("STATS_COLLECTOR_PORT"),"&d=").concat(n):"https://".concat(ii("EVENT_REPORT_DOMAIN"),":").concat(ii("STATS_COLLECTOR_PORT")).concat(n));for(let e=0;e<2;e+=1){1===e&&(i=this.backupUrl||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(ii("EVENT_REPORT_BACKUP_DOMAIN"),"&p=").concat(ii("STATS_COLLECTOR_PORT"),"&d=").concat(n):"https://".concat(ii("EVENT_REPORT_BACKUP_DOMAIN"),":").concat(ii("STATS_COLLECTOR_PORT")).concat(n)));try{t?await Zn(i,{timeout:1e4,data:r}):await Qn(i,{timeout:1e4,data:r})}catch(t){if(1===e)throw t;continue}return}}createBaseInfo(e,t){const r=Object.assign({},gi);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:vn.TRACER}).onSuccess()}};ui.on("REPORT_LOG_UPLOAD",(e=>{e.networkState=bn.networkState,Ai.reportApiInvoke(null,{name:"logUploadError",options:e,tag:vn.TRACER}).onSuccess("logUploadError")}));const Oi={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1,supportDataChannel:!1,supportPCSetConfiguration:!1,supportWebRTCEncodedTransform:!1,supportWebRTCInsertableStream:!1,supportRequestVideoFrameCallback:!1,supportWebCrypto:!1};function Ii(){const e=kr();Oi.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),Oi.getStreamFromExtension=e.name===Nr.CHROME&&Number(e.version)>34,Oi.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}(),Oi.supportMinBitrate=e.name===Nr.CHROME||e.name===Nr.EDGE,Oi.supportSetRtpSenderParameters=function(){const e=kr();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!Zr()||(!(!Fr()&&!xr())||e.name===Nr.FIREFOX&&Number(e.version)>=64)}(),e.name===Nr.SAFARI&&(Number(e.version)>=14?Oi.supportDualStream=!0:Oi.supportDualStream=!1),Oi.webAudioMediaStreamDest=function(){const e=kr();if(e.name===Nr.SAFARI&&Number(e.version)<12)return!1;return!0}(),Oi.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),Oi.supportWebGL="undefined"!=typeof WebGLRenderingContext,Oi.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,Zr()||(Oi.webAudioWithAEC=!0),Oi.supportShareAudio=function(){const e=kr();if((e.os===Cr.WIN_10||e.os===Cr.WIN_81||e.os===Cr.WIN_7||e.os===Cr.LINUX||e.os===Cr.MAC_OS||e.os===Cr.CHROMIUM_OS)&&e.name===Nr.CHROME&&Number(e.version)>=74)return!0;return!1}(),Oi.supportDataChannel=function(){if(Wr(76)||function(e){const t=kr();return!(t.name!==Nr.FIREFOX||!t.osVersion)&&Number(t.version)>=e}(68)||function(e){const t=kr();return!(t.name!==Nr.SAFARI||!t.osVersion)&&Number(t.version)>=e}(14))return!0;return!1}(),Oi.supportPCSetConfiguration=function(){const e=window.RTCPeerConnection;return!jr()&&!!e&&e.prototype.setConfiguration instanceof Function}(),Oi.supportWebRTCEncodedTransform=function(){const e=kr();return"Chrome"===e.name&&Number(e.version)>=86||"Safari"===e.name&&Number(e.version)>=15}(),Oi.supportWebRTCInsertableStream=function(){const e=kr();return(e.name===Nr.CHROME||e.name===Nr.EDGE)&&Number(e.version)>=94&&"MediaStreamTrackGenerator"in window&&"MediaStreamTrackProcessor"in window}(),Oi.supportRequestVideoFrameCallback=function(){if("requestVideoFrameCallback"in HTMLVideoElement.prototype)return!0;return!1}(),Oi.supportWebCrypto="undefined"!=typeof window&&void 0!==window.crypto&&void 0!==window.crypto.subtle,Nn((()=>{Oi.supportDualStreamEncoding=function(){const e=kr();if(ii("DISABLE_WEBAUDIO"))return!0;return"Safari"===e.name&&Number(e.version)>=14||!!("Chrome"===e.name&&/Windows/i.test(e.os||"")&&Number(e.version)>=100&&ii("CHROME_DUAL_STREAM_USE_ENCODING"))}(),_i.info("browser compatibility",JSON.stringify(Oi),JSON.stringify(e))}))}function bi(){return Oi}function Ci(){return"setSinkId"in HTMLAudioElement.prototype&&(!ii("RESTRICTION_SET_PLAYBACK_DEVICE")||(Vr()||Br())&&!Qr())}let Ni=function(e){return e.IOS_15_16_INTERRUPTION_START="ios15_16-interruption-start",e.IOS_15_16_INTERRUPTION_END="ios15_16-interruption-end",e.IOS_INTERRUPTION_START="ios-interruption-start",e.IOS_INTERRUPTION_END="ios-interruption-end",e.STATE_CHANGE="state-change",e}({});var wi=function(e){try{return!!e()}catch(e){return!0}},Di=!wi((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Pi=Di,ki=Function.prototype,Li=ki.call,Mi=Pi&&ki.bind.bind(Li,Li),Ui=Pi?Mi:function(e){return function(){return Li.apply(e,arguments)}},xi=Ui({}.isPrototypeOf),Vi=function(e){return e&&e.Math==Math&&e},Fi=Vi("object"==typeof globalThis&&globalThis)||Vi("object"==typeof window&&window)||Vi("object"==typeof self&&self)||Vi("object"==typeof X&&X)||function(){return this}()||X||Function("return this")(),Bi=Di,ji=Function.prototype,Gi=ji.apply,Wi=ji.call,Hi="object"==typeof Reflect&&Reflect.apply||(Bi?Wi.bind(Gi):function(){return Wi.apply(Gi,arguments)}),Ki=Ui,Yi=Ki({}.toString),zi=Ki("".slice),Xi=function(e){return zi(Yi(e),8,-1)},Ji=Xi,qi=Ui,Qi=function(e){if("Function"===Ji(e))return qi(e)},Zi="object"==typeof document&&document.all,$i={all:Zi,IS_HTMLDDA:void 0===Zi&&void 0!==Zi},eo=$i.all,to=$i.IS_HTMLDDA?function(e){return"function"==typeof e||e===eo}:function(e){return"function"==typeof e},ro={},no=!wi((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),io=Di,oo=Function.prototype.call,so=io?oo.bind(oo):function(){return oo.apply(oo,arguments)},ao={},co={}.propertyIsEnumerable,uo=Object.getOwnPropertyDescriptor,lo=uo&&!co.call({1:2},1);ao.f=lo?function(e){var t=uo(this,e);return!!t&&t.enumerable}:co;var po,ho,fo=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},Eo=wi,mo=Xi,_o=Object,To=Ui("".split),go=Eo((function(){return!_o("z").propertyIsEnumerable(0)}))?function(e){return"String"==mo(e)?To(e,""):_o(e)}:_o,So=function(e){return null==e},vo=So,Ro=TypeError,yo=function(e){if(vo(e))throw Ro("Can't call method on "+e);return e},Ao=go,Oo=yo,Io=function(e){return Ao(Oo(e))},bo=to,Co=$i.all,No=$i.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:bo(e)||e===Co}:function(e){return"object"==typeof e?null!==e:bo(e)},wo={},Do=wo,Po=Fi,ko=to,Lo=function(e){return ko(e)?e:void 0},Mo=function(e,t){return arguments.length<2?Lo(Do[e])||Lo(Po[e]):Do[e]&&Do[e][t]||Po[e]&&Po[e][t]},Uo="undefined"!=typeof navigator&&String(navigator.userAgent)||"",xo=Fi,Vo=Uo,Fo=xo.process,Bo=xo.Deno,jo=Fo&&Fo.versions||Bo&&Bo.version,Go=jo&&jo.v8;Go&&(ho=(po=Go.split("."))[0]>0&&po[0]<4?1:+(po[0]+po[1])),!ho&&Vo&&(!(po=Vo.match(/Edge\/(\d+)/))||po[1]>=74)&&(po=Vo.match(/Chrome\/(\d+)/))&&(ho=+po[1]);var Wo=ho,Ho=Wo,Ko=wi,Yo=Fi.String,zo=!!Object.getOwnPropertySymbols&&!Ko((function(){var e=Symbol();return!Yo(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Ho&&Ho<41})),Xo=zo&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Jo=Mo,qo=to,Qo=xi,Zo=Object,$o=Xo?function(e){return"symbol"==typeof e}:function(e){var t=Jo("Symbol");return qo(t)&&Qo(t.prototype,Zo(e))},es=String,ts=function(e){try{return es(e)}catch(e){return"Object"}},rs=to,ns=ts,is=TypeError,os=function(e){if(rs(e))return e;throw is(ns(e)+" is not a function")},ss=os,as=So,cs=function(e,t){var r=e[t];return as(r)?void 0:ss(r)},ds=so,us=to,ls=No,ps=TypeError,hs={exports:{}},fs=Fi,Es=Object.defineProperty,ms=function(e,t){try{Es(fs,e,{value:t,configurable:!0,writable:!0})}catch(r){fs[e]=t}return t},_s="__core-js_shared__",Ts=Fi[_s]||ms(_s,{}),gs=Ts;(hs.exports=function(e,t){return gs[e]||(gs[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 Ss=hs.exports,vs=yo,Rs=Object,ys=function(e){return Rs(vs(e))},As=ys,Os=Ui({}.hasOwnProperty),Is=Object.hasOwn||function(e,t){return Os(As(e),t)},bs=Ui,Cs=0,Ns=Math.random(),ws=bs(1..toString),Ds=function(e){return"Symbol("+(void 0===e?"":e)+")_"+ws(++Cs+Ns,36)},Ps=Ss,ks=Is,Ls=Ds,Ms=zo,Us=Xo,xs=Fi.Symbol,Vs=Ps("wks"),Fs=Us?xs.for||xs:xs&&xs.withoutSetter||Ls,Bs=function(e){return ks(Vs,e)||(Vs[e]=Ms&&ks(xs,e)?xs[e]:Fs("Symbol."+e)),Vs[e]},js=so,Gs=No,Ws=$o,Hs=cs,Ks=function(e,t){var r,n;if("string"===t&&us(r=e.toString)&&!ls(n=ds(r,e)))return n;if(us(r=e.valueOf)&&!ls(n=ds(r,e)))return n;if("string"!==t&&us(r=e.toString)&&!ls(n=ds(r,e)))return n;throw ps("Can't convert object to primitive value")},Ys=TypeError,zs=Bs("toPrimitive"),Xs=function(e,t){if(!Gs(e)||Ws(e))return e;var r,n=Hs(e,zs);if(n){if(void 0===t&&(t="default"),r=js(n,e,t),!Gs(r)||Ws(r))return r;throw Ys("Can't convert object to primitive value")}return void 0===t&&(t="number"),Ks(e,t)},Js=$o,qs=function(e){var t=Xs(e,"string");return Js(t)?t:t+""},Qs=No,Zs=Fi.document,$s=Qs(Zs)&&Qs(Zs.createElement),ea=function(e){return $s?Zs.createElement(e):{}},ta=ea,ra=!no&&!wi((function(){return 7!=Object.defineProperty(ta("div"),"a",{get:function(){return 7}}).a})),na=no,ia=so,oa=ao,sa=fo,aa=Io,ca=qs,da=Is,ua=ra,la=Object.getOwnPropertyDescriptor;ro.f=na?la:function(e,t){if(e=aa(e),t=ca(t),ua)try{return la(e,t)}catch(e){}if(da(e,t))return sa(!ia(oa.f,e,t),e[t])};var pa=wi,ha=to,fa=/#|\.prototype\./,Ea=function(e,t){var r=_a[ma(e)];return r==ga||r!=Ta&&(ha(t)?pa(t):!!t)},ma=Ea.normalize=function(e){return String(e).replace(fa,".").toLowerCase()},_a=Ea.data={},Ta=Ea.NATIVE="N",ga=Ea.POLYFILL="P",Sa=Ea,va=os,Ra=Di,ya=Qi(Qi.bind),Aa=function(e,t){return va(e),void 0===t?e:Ra?ya(e,t):function(){return e.apply(t,arguments)}},Oa={},Ia=no&&wi((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),ba=No,Ca=String,Na=TypeError,wa=function(e){if(ba(e))return e;throw Na(Ca(e)+" is not an object")},Da=no,Pa=ra,ka=Ia,La=wa,Ma=qs,Ua=TypeError,xa=Object.defineProperty,Va=Object.getOwnPropertyDescriptor,Fa="enumerable",Ba="configurable",ja="writable";Oa.f=Da?ka?function(e,t,r){if(La(e),t=Ma(t),La(r),"function"==typeof e&&"prototype"===t&&"value"in r&&ja in r&&!r[ja]){var n=Va(e,t);n&&n[ja]&&(e[t]=r.value,r={configurable:Ba in r?r[Ba]:n[Ba],enumerable:Fa in r?r[Fa]:n[Fa],writable:!1})}return xa(e,t,r)}:xa:function(e,t,r){if(La(e),t=Ma(t),La(r),Pa)try{return xa(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Ua("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Ga=Oa,Wa=fo,Ha=no?function(e,t,r){return Ga.f(e,t,Wa(1,r))}:function(e,t,r){return e[t]=r,e},Ka=Fi,Ya=Hi,za=Qi,Xa=to,Ja=ro.f,qa=Sa,Qa=wo,Za=Aa,$a=Ha,ec=Is,tc=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 Ya(e,this,arguments)};return t.prototype=e.prototype,t},rc=function(e,t){var r,n,i,o,s,a,c,d,u,l=e.target,p=e.global,h=e.stat,f=e.proto,E=p?Ka:h?Ka[l]:(Ka[l]||{}).prototype,m=p?Qa:Qa[l]||$a(Qa,l,{})[l],_=m.prototype;for(o in t)n=!(r=qa(p?o:l+(h?".":"#")+o,e.forced))&&E&&ec(E,o),a=m[o],n&&(c=e.dontCallGetSet?(u=Ja(E,o))&&u.value:E[o]),s=n&&c?c:t[o],n&&typeof a==typeof s||(d=e.bind&&n?Za(s,Ka):e.wrap&&n?tc(s):f&&Xa(s)?za(s):s,(e.sham||s&&s.sham||a&&a.sham)&&$a(d,"sham",!0),$a(m,o,d),f&&(ec(Qa,i=l+"Prototype")||$a(Qa,i,{}),$a(Qa[i],o,s),e.real&&_&&(r||!_[o])&&$a(_,o,s)))},nc=Math.ceil,ic=Math.floor,oc=Math.trunc||function(e){var t=+e;return(t>0?ic:nc)(t)},sc=function(e){var t=+e;return t!=t||0===t?0:oc(t)},ac=sc,cc=Math.max,dc=Math.min,uc=function(e,t){var r=ac(e);return r<0?cc(r+t,0):dc(r,t)},lc=sc,pc=Math.min,hc=function(e){return e>0?pc(lc(e),9007199254740991):0},fc=function(e){return hc(e.length)},Ec=Io,mc=uc,_c=fc,Tc=function(e){return function(t,r,n){var i,o=Ec(t),s=_c(o),a=mc(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}},gc={includes:Tc(!0),indexOf:Tc(!1)},Sc=gc.includes;rc({target:"Array",proto:!0,forced:wi((function(){return!Array(1).includes()}))},{includes:function(e){return Sc(this,e,arguments.length>1?arguments[1]:void 0)}});var vc=wo,Rc=function(e){return vc[e+"Prototype"]},yc=Rc("Array").includes,Ac=No,Oc=Xi,Ic=Bs("match"),bc=function(e){var t;return Ac(e)&&(void 0!==(t=e[Ic])?!!t:"RegExp"==Oc(e))},Cc=TypeError,Nc={};Nc[Bs("toStringTag")]="z";var wc="[object z]"===String(Nc),Dc=wc,Pc=to,kc=Xi,Lc=Bs("toStringTag"),Mc=Object,Uc="Arguments"==kc(function(){return arguments}()),xc=Dc?kc: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=Mc(e),Lc))?r:Uc?kc(t):"Object"==(n=kc(t))&&Pc(t.callee)?"Arguments":n},Vc=xc,Fc=String,Bc=function(e){if("Symbol"===Vc(e))throw TypeError("Cannot convert a Symbol value to a string");return Fc(e)},jc=Bs("match"),Gc=rc,Wc=function(e){if(bc(e))throw Cc("The method doesn't accept regular expressions");return e},Hc=yo,Kc=Bc,Yc=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[jc]=!1,"/./"[e](t)}catch(e){}}return!1},zc=Ui("".indexOf);Gc({target:"String",proto:!0,forced:!Yc("includes")},{includes:function(e){return!!~zc(Kc(Hc(this)),Kc(Wc(e)),arguments.length>1?arguments[1]:void 0)}});var Xc=Rc("String").includes,Jc=xi,qc=yc,Qc=Xc,Zc=Array.prototype,$c=String.prototype,ed=J((function(e){var t=e.includes;return e===Zc||Jc(Zc,e)&&t===Zc.includes?qc:"string"==typeof e||e===$c||Jc($c,e)&&t===$c.includes?Qc:t}));function td(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function rd(e,t,r,n,i){return{width:e,height:t,frameRate:r,bitrateMin:n,bitrateMax:i}}function nd(e,t,r,n,i){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:n,bitrateMax:i}}function id(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}const od={"90p":rd(160,90),"90p_1":rd(160,90),"120p":rd(160,120,15,30,65),"120p_1":rd(160,120,15,30,65),"120p_3":rd(120,120,15,30,50),"120p_4":rd(212,120),"180p":rd(320,180,15,30,140),"180p_1":rd(320,180,15,30,140),"180p_3":rd(180,180,15,30,100),"180p_4":rd(240,180,15,30,120),"240p":rd(320,240,15,40,200),"240p_1":rd(320,240,15,40,200),"240p_3":rd(240,240,15,40,140),"240p_4":rd(424,240,15,40,220),"360p":rd(640,360,15,80,400),"360p_1":rd(640,360,15,80,400),"360p_3":rd(360,360,15,80,260),"360p_4":rd(640,360,30,80,600),"360p_6":rd(360,360,30,80,400),"360p_7":rd(480,360,15,80,320),"360p_8":rd(480,360,30,80,490),"360p_9":rd(640,360,15,80,800),"360p_10":rd(640,360,24,80,800),"360p_11":rd(640,360,24,80,1e3),"480p":rd(640,480,15,100,500),"480p_1":rd(640,480,15,100,500),"480p_2":rd(640,480,30,100,1e3),"480p_3":rd(480,480,15,100,400),"480p_4":rd(640,480,30,100,750),"480p_6":rd(480,480,30,100,600),"480p_8":rd(848,480,15,100,610),"480p_9":rd(848,480,30,100,930),"480p_10":rd(640,480,10,100,400),"720p":rd(1280,720,15,120,1130),"720p_auto":rd(1280,720,30,900,3e3),"720p_1":rd(1280,720,15,120,1130),"720p_2":rd(1280,720,30,120,2e3),"720p_3":rd(1280,720,30,120,1710),"720p_5":rd(960,720,15,120,910),"720p_6":rd(960,720,30,120,1380),"1080p":rd(1920,1080,15,120,2080),"1080p_1":rd(1920,1080,15,120,2080),"1080p_2":rd(1920,1080,30,120,3e3),"1080p_3":rd(1920,1080,30,120,3150),"1080p_5":rd(1920,1080,60,120,4780),"1440p":rd(2560,1440,30,120,4850),"1440p_1":rd(2560,1440,30,120,4850),"1440p_2":rd(2560,1440,60,120,7350),"4k":rd(3840,2160,30,120,8910),"4k_1":rd(3840,2160,30,120,8910),"4k_3":rd(3840,2160,60,120,13500)},sd={"480p":nd(640,480,5),"480p_1":nd(640,480,5),"480p_2":nd(640,480,30),"480p_3":nd(640,480,15),"720p":nd(1280,720,5),"720p_auto":rd(1280,720,30,900,3e3),"720p_1":nd(1280,720,5),"720p_2":nd(1280,720,30),"720p_3":nd(1280,720,15),"1080p":nd(1920,1080,5),"1080p_1":nd(1920,1080,5),"1080p_2":nd(1920,1080,30),"1080p_3":nd(1920,1080,15)},ad={"1SL1TL":id(1,1),"3SL3TL":id(3,3),"2SL3TL":id(2,3)};function cd(e){return e||(e="480p_1"),"string"==typeof e?Object.assign({},od[e]):e}function dd(e){return"string"==typeof e?Object.assign({},sd[e]):e}function ud(e){return"string"==typeof e?Object.assign({},ad[e]):e}const ld={speech_low_quality:td(16e3,!1),speech_standard:td(32e3,!1,18),music_standard:td(48e3,!1),standard_stereo:td(48e3,!0,56),high_quality:td(48e3,!1,128),high_quality_stereo:td(48e3,!0,192)};function pd(e){return"string"==typeof e?Object.assign({},ld[e]):e}const hd=[];function fd(e){ed(hd).call(hd,e)||hd.push(e)}function Ed(e){const t=hd.indexOf(e);-1!==t&&hd.splice(t,1)}function md(e){return un(e.width,"config.width"),un(e.height,"config.height"),void 0!==e.frameRate&&un(e.frameRate,"config.frameRate"),void 0!==e.bitrateMax&&dn(e.bitrateMax,"config.bitrateMax"),void 0!==e.bitrateMin&&dn(e.bitrateMin,"config.bitrateMin"),!0}function _d(e){return void 0!==e.sampleRate&&dn(e.sampleRate,"config.sampleRate",0,96e3,!0),void 0!==e.sampleSize&&dn(e.sampleRate,"config.sampleSize",0,128,!0),void 0!==e.stereo&&an(e.stereo,"config.stereo"),void 0!==e.bitrate&&dn(e.bitrate,"config.bitrate",0,1e4,!1),!0}function Td(e){return cn(e,"mediaSource",["screen","window","application"]),!0}let gd=function(e){return e.NEED_RENEGOTIATE="@need_renegotiate",e.NEED_REPLACE_TRACK="@need_replace_track",e.NEED_REPLACE_MIXING_TRACK="@need_replace_mixing_track",e.NEED_CLOSE="@need_close",e.NEED_ENABLE_TRACK="@need_enable_track",e.NEED_DISABLE_TRACK="@need_disable_track",e.NEED_SESSION_ID="@need_sid",e.SET_OPTIMIZATION_MODE="@set_optimization_mode",e.GET_STATS="@get_stats",e.GET_RTC_STATS="@get_rtc_stats",e.GET_LOW_VIDEO_TRACK="@get_low_video_track",e.NEED_RESET_REMOTE_SDP="@need_reset_remote_sdp",e.NEED_UPDATE_VIDEO_ENCODER="@need_update_video_encoder",e.NEED_UPDATE_VIDEO_SEND_PARAMETERS="@need_update_video_send_parameters",e.NEED_MUTE_TRACK="@need_mute_track",e.NEED_UNMUTE_TRACK="@need_unmute_track",e}({}),Sd=function(e){return e.SCREEN_TRACK="screen_track",e.CUSTOM_TRACK="custome_track",e.LOW_STREAM="low_stream",e.SCREEN_LOW_TRACK="screen_low_track",e}({});let vd=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e}({}),Rd=function(e){return e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.HIGH_STREAM_LAYER1=4]="HIGH_STREAM_LAYER1",e[e.HIGH_STREAM_LAYER2=5]="HIGH_STREAM_LAYER2",e[e.HIGH_STREAM_LAYER3=6]="HIGH_STREAM_LAYER3",e[e.HIGH_STREAM_LAYER4=7]="HIGH_STREAM_LAYER4",e[e.HIGH_STREAM_LAYER5=8]="HIGH_STREAM_LAYER5",e[e.HIGH_STREAM_LAYER6=9]="HIGH_STREAM_LAYER6",e}({}),yd=function(e){return e[e.DISABLE=0]="DISABLE",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e[e.HIGH_STREAM_LAYER1=3]="HIGH_STREAM_LAYER1",e[e.HIGH_STREAM_LAYER2=4]="HIGH_STREAM_LAYER2",e[e.HIGH_STREAM_LAYER3=5]="HIGH_STREAM_LAYER3",e[e.HIGH_STREAM_LAYER4=6]="HIGH_STREAM_LAYER4",e[e.HIGH_STREAM_LAYER5=7]="HIGH_STREAM_LAYER5",e[e.HIGH_STREAM_LAYER6=8]="HIGH_STREAM_LAYER6",e}({}),Ad=function(e){return e.TRANSCEIVER_UPDATED="transceiver-updated",e.SEI_TO_SEND="sei-to-send",e.SEI_RECEIVED="sei-received",e.TRACK_UPDATED="track-updated",e}({}),Od=function(e){return e.SOURCE_STATE_CHANGE="source-state-change",e.TRACK_ENDED="track-ended",e.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.CLOSED="closed",e}({}),Id=function(e){return e.FIRST_FRAME_DECODED="first-frame-decoded",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.VIDEO_STATE_CHANGED="video-state-changed",e}({}),bd=function(e){return e.AUDIO="audio",e.VIDEO="video",e.DATA="data",e}({}),Cd=function(e){return e.AUDIO_SOURCE_STATE_CHANGE="audio_source_state_change",e.RECEIVE_TRACK_BUFFER="receive_track_buffer",e.ON_AUDIO_BUFFER="on_audio_buffer",e.UPDATE_SOURCE="update_source",e}({}),Nd=function(e){return e.UPDATE_TRACK_SOURCE="update-track-source",e}({});const wd={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,sendJitterMs:0,sendRttMs:0,currentPacketLossRate:0},Dd={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},Pd={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveLevel:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receivePacketsDiscarded:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1},kd={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receiveResolutionHeight:0,receiveResolutionWidth:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1};let Ld=function(e){return e.ON_TRACK="on_track",e.ON_NODE="on_node",e}({}),Md=function(e){return e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints",e}({}),Ud=function(e){return e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND",e}({}),xd=function(e){return e.STATE_CHANGE="state_change",e.RECORDING_DEVICE_CHANGED="recordingDeviceChanged",e.PLAYOUT_DEVICE_CHANGED="playoutDeviceChanged",e.CAMERA_DEVICE_CHANGED="cameraDeviceChanged",e}({});let Vd=function(e){return e.NONE="none",e.INIT="init",e.CANPLAY="canplay",e.PLAYING="playing",e.PAUSED="paused",e.SUSPEND="suspend",e.STALLED="stalled",e.WAITING="waiting",e.ERROR="error",e.DESTROYED="destroyed",e.ABORT="abort",e.ENDED="ended",e.EMPTIED="emptied",e.LOADEDDATA="loadeddata",e}({}),Fd=function(e){return e[e.VideoStateStopped=0]="VideoStateStopped",e[e.VideoStateStarting=1]="VideoStateStarting",e[e.VideoStateDecoding=2]="VideoStateDecoding",e[e.VideoStateFrozen=3]="VideoStateFrozen",e}({});let Bd=function(e){return e.OPEN="open",e.MESSAGE="message",e.CLOSE="close",e.CLOSING="closing",e.ERROR="error",e}({});var jd={exports:{}},Gd=rc,Wd=no,Hd=Oa.f;Gd({target:"Object",stat:!0,forced:Object.defineProperty!==Hd,sham:!Wd},{defineProperty:Hd});var Kd=wo.Object,Yd=jd.exports=function(e,t,r){return Kd.defineProperty(e,t,r)};Kd.defineProperty.sham&&(Yd.sham=!0);var zd=J(jd.exports),Xd=Xi,Jd=Array.isArray||function(e){return"Array"==Xd(e)},qd=TypeError,Qd=qs,Zd=Oa,$d=fo,eu=function(e,t,r){var n=Qd(t);n in e?Zd.f(e,n,$d(0,r)):e[n]=r},tu=to,ru=Ts,nu=Ui(Function.toString);tu(ru.inspectSource)||(ru.inspectSource=function(e){return nu(e)});var iu=ru.inspectSource,ou=Ui,su=wi,au=to,cu=xc,du=iu,uu=function(){},lu=[],pu=Mo("Reflect","construct"),hu=/^\s*(?:class|function)\b/,fu=ou(hu.exec),Eu=!hu.exec(uu),mu=function(e){if(!au(e))return!1;try{return pu(uu,lu,e),!0}catch(e){return!1}},_u=function(e){if(!au(e))return!1;switch(cu(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return Eu||!!fu(hu,du(e))}catch(e){return!0}};_u.sham=!0;var Tu=!pu||su((function(){var e;return mu(mu.call)||!mu(Object)||!mu((function(){e=!0}))||e}))?_u:mu,gu=Jd,Su=Tu,vu=No,Ru=Bs("species"),yu=Array,Au=function(e){var t;return gu(e)&&(t=e.constructor,(Su(t)&&(t===yu||gu(t.prototype))||vu(t)&&null===(t=t[Ru]))&&(t=void 0)),void 0===t?yu:t},Ou=function(e,t){return new(Au(e))(0===t?0:t)},Iu=wi,bu=Wo,Cu=Bs("species"),Nu=function(e){return bu>=51||!Iu((function(){var t=[];return(t.constructor={})[Cu]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},wu=rc,Du=wi,Pu=Jd,ku=No,Lu=ys,Mu=fc,Uu=function(e){if(e>9007199254740991)throw qd("Maximum allowed index exceeded");return e},xu=eu,Vu=Ou,Fu=Nu,Bu=Wo,ju=Bs("isConcatSpreadable"),Gu=Bu>=51||!Du((function(){var e=[];return e[ju]=!1,e.concat()[0]!==e})),Wu=function(e){if(!ku(e))return!1;var t=e[ju];return void 0!==t?!!t:Pu(e)};wu({target:"Array",proto:!0,arity:1,forced:!Gu||!Fu("concat")},{concat:function(e){var t,r,n,i,o,s=Lu(this),a=Vu(s,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(Wu(o=-1===t?s:arguments[t]))for(i=Mu(o),Uu(c+i),r=0;r<i;r++,c++)r in o&&xu(a,c,o[r]);else Uu(c+1),xu(a,c++,o);return a.length=c,a}});var Hu={},Ku={},Yu=Is,zu=Io,Xu=gc.indexOf,Ju=Ku,qu=Ui([].push),Qu=function(e,t){var r,n=zu(e),i=0,o=[];for(r in n)!Yu(Ju,r)&&Yu(n,r)&&qu(o,r);for(;t.length>i;)Yu(n,r=t[i++])&&(~Xu(o,r)||qu(o,r));return o},Zu=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],$u=Qu,el=Zu,tl=Object.keys||function(e){return $u(e,el)},rl=no,nl=Ia,il=Oa,ol=wa,sl=Io,al=tl;Hu.f=rl&&!nl?Object.defineProperties:function(e,t){ol(e);for(var r,n=sl(t),i=al(t),o=i.length,s=0;o>s;)il.f(e,r=i[s++],n[r]);return e};var cl,dl=Mo("document","documentElement"),ul=Ds,ll=Ss("keys"),pl=function(e){return ll[e]||(ll[e]=ul(e))},hl=wa,fl=Hu,El=Zu,ml=Ku,_l=dl,Tl=ea,gl="prototype",Sl="script",vl=pl("IE_PROTO"),Rl=function(){},yl=function(e){return"<"+Sl+">"+e+"</"+Sl+">"},Al=function(e){e.write(yl("")),e.close();var t=e.parentWindow.Object;return e=null,t},Ol=function(){try{cl=new ActiveXObject("htmlfile")}catch(e){}var e,t,r;Ol="undefined"!=typeof document?document.domain&&cl?Al(cl):(t=Tl("iframe"),r="java"+Sl+":",t.style.display="none",_l.appendChild(t),t.src=String(r),(e=t.contentWindow.document).open(),e.write(yl("document.F=Object")),e.close(),e.F):Al(cl);for(var n=El.length;n--;)delete Ol[gl][El[n]];return Ol()};ml[vl]=!0;var Il=Object.create||function(e,t){var r;return null!==e?(Rl[gl]=hl(e),r=new Rl,Rl[gl]=null,r[vl]=e):r=Ol(),void 0===t?r:fl.f(r,t)},bl={},Cl=Qu,Nl=Zu.concat("length","prototype");bl.f=Object.getOwnPropertyNames||function(e){return Cl(e,Nl)};var wl={},Dl=uc,Pl=fc,kl=eu,Ll=Array,Ml=Math.max,Ul=function(e,t,r){for(var n=Pl(e),i=Dl(t,n),o=Dl(void 0===r?n:r,n),s=Ll(Ml(o-i,0)),a=0;i<o;i++,a++)kl(s,a,e[i]);return s.length=a,s},xl=Xi,Vl=Io,Fl=bl.f,Bl=Ul,jl="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];wl.f=function(e){return jl&&"Window"==xl(e)?function(e){try{return Fl(e)}catch(e){return Bl(jl)}}(e):Fl(Vl(e))};var Gl={};Gl.f=Object.getOwnPropertySymbols;var Wl=Ha,Hl=function(e,t,r,n){return n&&n.enumerable?e[t]=r:Wl(e,t,r),e},Kl=Oa,Yl=function(e,t,r){return Kl.f(e,t,r)},zl={},Xl=Bs;zl.f=Xl;var Jl,ql,Ql,Zl=wo,$l=Is,ep=zl,tp=Oa.f,rp=function(e){var t=Zl.Symbol||(Zl.Symbol={});$l(t,e)||tp(t,e,{value:ep.f(e)})},np=so,ip=Mo,op=Bs,sp=Hl,ap=function(){var e=ip("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=op("toPrimitive");t&&!t[n]&&sp(t,n,(function(e){return np(r,this)}),{arity:1})},cp=xc,dp=wc?{}.toString:function(){return"[object "+cp(this)+"]"},up=wc,lp=Oa.f,pp=Ha,hp=Is,fp=dp,Ep=Bs("toStringTag"),mp=function(e,t,r,n){if(e){var i=r?e:e.prototype;hp(i,Ep)||lp(i,Ep,{configurable:!0,value:t}),n&&!up&&pp(i,"toString",fp)}},_p=to,Tp=Fi.WeakMap,gp=_p(Tp)&&/native code/.test(String(Tp)),Sp=Fi,vp=No,Rp=Ha,yp=Is,Ap=Ts,Op=pl,Ip=Ku,bp="Object already initialized",Cp=Sp.TypeError,Np=Sp.WeakMap;if(gp||Ap.state){var wp=Ap.state||(Ap.state=new Np);wp.get=wp.get,wp.has=wp.has,wp.set=wp.set,Jl=function(e,t){if(wp.has(e))throw Cp(bp);return t.facade=e,wp.set(e,t),t},ql=function(e){return wp.get(e)||{}},Ql=function(e){return wp.has(e)}}else{var Dp=Op("state");Ip[Dp]=!0,Jl=function(e,t){if(yp(e,Dp))throw Cp(bp);return t.facade=e,Rp(e,Dp,t),t},ql=function(e){return yp(e,Dp)?e[Dp]:{}},Ql=function(e){return yp(e,Dp)}}var Pp={set:Jl,get:ql,has:Ql,enforce:function(e){return Ql(e)?ql(e):Jl(e,{})},getterFor:function(e){return function(t){var r;if(!vp(t)||(r=ql(t)).type!==e)throw Cp("Incompatible receiver, "+e+" required");return r}}},kp=Aa,Lp=go,Mp=ys,Up=fc,xp=Ou,Vp=Ui([].push),Fp=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 p,h,f=Mp(c),E=Lp(f),m=kp(d,u),_=Up(E),T=0,g=l||xp,S=t?g(c,_):r||s?g(c,0):void 0;_>T;T++)if((a||T in E)&&(h=m(p=E[T],T,f),e))if(t)S[T]=h;else if(h)switch(e){case 3:return!0;case 5:return p;case 6:return T;case 2:Vp(S,p)}else switch(e){case 4:return!1;case 7:Vp(S,p)}return o?-1:n||i?i:S}},Bp={forEach:Fp(0),map:Fp(1),filter:Fp(2),some:Fp(3),every:Fp(4),find:Fp(5),findIndex:Fp(6),filterReject:Fp(7)},jp=rc,Gp=Fi,Wp=so,Hp=Ui,Kp=no,Yp=zo,zp=wi,Xp=Is,Jp=xi,qp=wa,Qp=Io,Zp=qs,$p=Bc,eh=fo,th=Il,rh=tl,nh=bl,ih=wl,oh=Gl,sh=ro,ah=Oa,ch=Hu,dh=ao,uh=Hl,lh=Yl,ph=Ss,hh=Ku,fh=Ds,Eh=Bs,mh=zl,_h=rp,Th=ap,gh=mp,Sh=Pp,vh=Bp.forEach,Rh=pl("hidden"),yh="Symbol",Ah="prototype",Oh=Sh.set,Ih=Sh.getterFor(yh),bh=Object[Ah],Ch=Gp.Symbol,Nh=Ch&&Ch[Ah],wh=Gp.TypeError,Dh=Gp.QObject,Ph=sh.f,kh=ah.f,Lh=ih.f,Mh=dh.f,Uh=Hp([].push),xh=ph("symbols"),Vh=ph("op-symbols"),Fh=ph("wks"),Bh=!Dh||!Dh[Ah]||!Dh[Ah].findChild,jh=Kp&&zp((function(){return 7!=th(kh({},"a",{get:function(){return kh(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Ph(bh,t);n&&delete bh[t],kh(e,t,r),n&&e!==bh&&kh(bh,t,n)}:kh,Gh=function(e,t){var r=xh[e]=th(Nh);return Oh(r,{type:yh,tag:e,description:t}),Kp||(r.description=t),r},Wh=function(e,t,r){e===bh&&Wh(Vh,t,r),qp(e);var n=Zp(t);return qp(r),Xp(xh,n)?(r.enumerable?(Xp(e,Rh)&&e[Rh][n]&&(e[Rh][n]=!1),r=th(r,{enumerable:eh(0,!1)})):(Xp(e,Rh)||kh(e,Rh,eh(1,{})),e[Rh][n]=!0),jh(e,n,r)):kh(e,n,r)},Hh=function(e,t){qp(e);var r=Qp(t),n=rh(r).concat(Xh(r));return vh(n,(function(t){Kp&&!Wp(Kh,r,t)||Wh(e,t,r[t])})),e},Kh=function(e){var t=Zp(e),r=Wp(Mh,this,t);return!(this===bh&&Xp(xh,t)&&!Xp(Vh,t))&&(!(r||!Xp(this,t)||!Xp(xh,t)||Xp(this,Rh)&&this[Rh][t])||r)},Yh=function(e,t){var r=Qp(e),n=Zp(t);if(r!==bh||!Xp(xh,n)||Xp(Vh,n)){var i=Ph(r,n);return!i||!Xp(xh,n)||Xp(r,Rh)&&r[Rh][n]||(i.enumerable=!0),i}},zh=function(e){var t=Lh(Qp(e)),r=[];return vh(t,(function(e){Xp(xh,e)||Xp(hh,e)||Uh(r,e)})),r},Xh=function(e){var t=e===bh,r=Lh(t?Vh:Qp(e)),n=[];return vh(r,(function(e){!Xp(xh,e)||t&&!Xp(bh,e)||Uh(n,xh[e])})),n};Yp||(Ch=function(){if(Jp(Nh,this))throw wh("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?$p(arguments[0]):void 0,t=fh(e),r=function(e){this===bh&&Wp(r,Vh,e),Xp(this,Rh)&&Xp(this[Rh],t)&&(this[Rh][t]=!1),jh(this,t,eh(1,e))};return Kp&&Bh&&jh(bh,t,{configurable:!0,set:r}),Gh(t,e)},uh(Nh=Ch[Ah],"toString",(function(){return Ih(this).tag})),uh(Ch,"withoutSetter",(function(e){return Gh(fh(e),e)})),dh.f=Kh,ah.f=Wh,ch.f=Hh,sh.f=Yh,nh.f=ih.f=zh,oh.f=Xh,mh.f=function(e){return Gh(Eh(e),e)},Kp&&lh(Nh,"description",{configurable:!0,get:function(){return Ih(this).description}})),jp({global:!0,constructor:!0,wrap:!0,forced:!Yp,sham:!Yp},{Symbol:Ch}),vh(rh(Fh),(function(e){_h(e)})),jp({target:yh,stat:!0,forced:!Yp},{useSetter:function(){Bh=!0},useSimple:function(){Bh=!1}}),jp({target:"Object",stat:!0,forced:!Yp,sham:!Kp},{create:function(e,t){return void 0===t?th(e):Hh(th(e),t)},defineProperty:Wh,defineProperties:Hh,getOwnPropertyDescriptor:Yh}),jp({target:"Object",stat:!0,forced:!Yp},{getOwnPropertyNames:zh}),Th(),gh(Ch,yh),hh[Rh]=!0;var Jh=zo&&!!Symbol.for&&!!Symbol.keyFor,qh=rc,Qh=Mo,Zh=Is,$h=Bc,ef=Ss,tf=Jh,rf=ef("string-to-symbol-registry"),nf=ef("symbol-to-string-registry");qh({target:"Symbol",stat:!0,forced:!tf},{for:function(e){var t=$h(e);if(Zh(rf,t))return rf[t];var r=Qh("Symbol")(t);return rf[t]=r,nf[r]=t,r}});var of=rc,sf=Is,af=$o,cf=ts,df=Jh,uf=Ss("symbol-to-string-registry");of({target:"Symbol",stat:!0,forced:!df},{keyFor:function(e){if(!af(e))throw TypeError(cf(e)+" is not a symbol");if(sf(uf,e))return uf[e]}});var lf=Ui([].slice),pf=Jd,hf=to,ff=Xi,Ef=Bc,mf=Ui([].push),_f=rc,Tf=Mo,gf=Hi,Sf=so,vf=Ui,Rf=wi,yf=to,Af=$o,Of=lf,If=function(e){if(hf(e))return e;if(pf(e)){for(var t=e.length,r=[],n=0;n<t;n++){var i=e[n];"string"==typeof i?mf(r,i):"number"!=typeof i&&"Number"!=ff(i)&&"String"!=ff(i)||mf(r,Ef(i))}var o=r.length,s=!0;return function(e,t){if(s)return s=!1,t;if(pf(this))return t;for(var n=0;n<o;n++)if(r[n]===e)return t}}},bf=zo,Cf=String,Nf=Tf("JSON","stringify"),wf=vf(/./.exec),Df=vf("".charAt),Pf=vf("".charCodeAt),kf=vf("".replace),Lf=vf(1..toString),Mf=/[\uD800-\uDFFF]/g,Uf=/^[\uD800-\uDBFF]$/,xf=/^[\uDC00-\uDFFF]$/,Vf=!bf||Rf((function(){var e=Tf("Symbol")();return"[null]"!=Nf([e])||"{}"!=Nf({a:e})||"{}"!=Nf(Object(e))})),Ff=Rf((function(){return'"\\udf06\\ud834"'!==Nf("\udf06\ud834")||'"\\udead"'!==Nf("\udead")})),Bf=function(e,t){var r=Of(arguments),n=If(t);if(yf(n)||void 0!==e&&!Af(e))return r[1]=function(e,t){if(yf(n)&&(t=Sf(n,this,Cf(e),t)),!Af(t))return t},gf(Nf,null,r)},jf=function(e,t,r){var n=Df(r,t-1),i=Df(r,t+1);return wf(Uf,e)&&!wf(xf,i)||wf(xf,e)&&!wf(Uf,n)?"\\u"+Lf(Pf(e,0),16):e};Nf&&_f({target:"JSON",stat:!0,arity:3,forced:Vf||Ff},{stringify:function(e,t,r){var n=Of(arguments),i=gf(Vf?Bf:Nf,null,n);return Ff&&"string"==typeof i?kf(i,Mf,jf):i}});var Gf=Gl,Wf=ys;rc({target:"Object",stat:!0,forced:!zo||wi((function(){Gf.f(1)}))},{getOwnPropertySymbols:function(e){var t=Gf.f;return t?t(Wf(e)):[]}}),rp("asyncIterator"),rp("hasInstance"),rp("isConcatSpreadable"),rp("iterator"),rp("match"),rp("matchAll"),rp("replace"),rp("search"),rp("species"),rp("split");var Hf=ap;rp("toPrimitive"),Hf();var Kf=Mo,Yf=mp;rp("toStringTag"),Yf(Kf("Symbol"),"Symbol"),rp("unscopables"),mp(Fi.JSON,"JSON",!0);var zf,Xf,Jf,qf=wo.Symbol,Qf={},Zf=no,$f=Is,eE=Function.prototype,tE=Zf&&Object.getOwnPropertyDescriptor,rE=$f(eE,"name"),nE={EXISTS:rE,PROPER:rE&&"something"===function(){}.name,CONFIGURABLE:rE&&(!Zf||Zf&&tE(eE,"name").configurable)},iE=!wi((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),oE=Is,sE=to,aE=ys,cE=iE,dE=pl("IE_PROTO"),uE=Object,lE=uE.prototype,pE=cE?uE.getPrototypeOf:function(e){var t=aE(e);if(oE(t,dE))return t[dE];var r=t.constructor;return sE(r)&&t instanceof r?r.prototype:t instanceof uE?lE:null},hE=wi,fE=to,EE=No,mE=Il,_E=pE,TE=Hl,gE=Bs("iterator"),SE=!1;[].keys&&("next"in(Jf=[].keys())?(Xf=_E(_E(Jf)))!==Object.prototype&&(zf=Xf):SE=!0);var vE=!EE(zf)||hE((function(){var e={};return zf[gE].call(e)!==e}));fE((zf=vE?{}:mE(zf))[gE])||TE(zf,gE,(function(){return this}));var RE={IteratorPrototype:zf,BUGGY_SAFARI_ITERATORS:SE},yE=RE.IteratorPrototype,AE=Il,OE=fo,IE=mp,bE=Qf,CE=function(){return this},NE=function(e,t,r,n){var i=t+" Iterator";return e.prototype=AE(yE,{next:OE(+!n,r)}),IE(e,i,!1,!0),bE[i]=CE,e},wE=Ui,DE=os,PE=to,kE=String,LE=TypeError,ME=function(e,t,r){try{return wE(DE(Object.getOwnPropertyDescriptor(e,t)[r]))}catch(e){}},UE=wa,xE=function(e){if("object"==typeof e||PE(e))return e;throw LE("Can't set "+kE(e)+" as a prototype")},VE=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=ME(Object.prototype,"__proto__","set"))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return UE(r),xE(n),t?e(r,n):r.__proto__=n,r}}():void 0),FE=rc,BE=so,jE=nE,GE=NE,WE=pE,HE=mp,KE=Hl,YE=Qf,zE=RE,XE=jE.PROPER,JE=zE.BUGGY_SAFARI_ITERATORS,qE=Bs("iterator"),QE="keys",ZE="values",$E="entries",em=function(){return this},tm=function(e,t,r,n,i,o,s){GE(r,t,n);var a,c,d,u=function(e){if(e===i&&E)return E;if(!JE&&e in h)return h[e];switch(e){case QE:case ZE:case $E:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",p=!1,h=e.prototype,f=h[qE]||h["@@iterator"]||i&&h[i],E=!JE&&f||u(i),m="Array"==t&&h.entries||f;if(m&&(a=WE(m.call(new e)))!==Object.prototype&&a.next&&(HE(a,l,!0,!0),YE[l]=em),XE&&i==ZE&&f&&f.name!==ZE&&(p=!0,E=function(){return BE(f,this)}),i)if(c={values:u(ZE),keys:o?E:u(QE),entries:u($E)},s)for(d in c)(JE||p||!(d in h))&&KE(h,d,c[d]);else FE({target:t,proto:!0,forced:JE||p},c);return s&&h[qE]!==E&&KE(h,qE,E,{name:i}),YE[t]=E,c},rm=function(e,t){return{value:e,done:t}},nm=Io,im=Qf,om=Pp;Oa.f;var sm=tm,am=rm,cm="Array Iterator",dm=om.set,um=om.getterFor(cm);sm(Array,"Array",(function(e,t){dm(this,{type:cm,target:nm(e),index:0,kind:t})}),(function(){var e=um(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,am(void 0,!0)):am("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values"),im.Arguments=im.Array;var lm={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},pm=Fi,hm=xc,fm=Ha,Em=Qf,mm=Bs("toStringTag");for(var _m in lm){var Tm=pm[_m],gm=Tm&&Tm.prototype;gm&&hm(gm)!==mm&&fm(gm,mm,_m),Em[_m]=Em.Array}var Sm=qf,vm=Bs,Rm=Oa.f,ym=vm("metadata"),Am=Function.prototype;void 0===Am[ym]&&Rm(Am,ym,{value:null}),rp("dispose"),rp("metadata");var Om=Sm;rp("asyncDispose");var Im=Ui,bm=Mo("Symbol"),Cm=bm.keyFor,Nm=Im(bm.prototype.valueOf),wm=bm.isRegisteredSymbol||function(e){try{return void 0!==Cm(Nm(e))}catch(e){return!1}};rc({target:"Symbol",stat:!0},{isRegisteredSymbol:wm});for(var Dm=Ss,Pm=Mo,km=Ui,Lm=$o,Mm=Bs,Um=Pm("Symbol"),xm=Um.isWellKnownSymbol,Vm=Pm("Object","getOwnPropertyNames"),Fm=km(Um.prototype.valueOf),Bm=Dm("wks"),jm=0,Gm=Vm(Um),Wm=Gm.length;jm<Wm;jm++)try{var Hm=Gm[jm];Lm(Um[Hm])&&Mm(Hm)}catch(e){}var Km=function(e){if(xm&&xm(e))return!0;try{for(var t=Fm(e),r=0,n=Vm(Bm),i=n.length;r<i;r++)if(Bm[n[r]]==t)return!0}catch(e){}return!1};rc({target:"Symbol",stat:!0,forced:!0},{isWellKnownSymbol:Km}),rp("matcher"),rp("observable"),rc({target:"Symbol",stat:!0,name:"isRegisteredSymbol"},{isRegistered:wm}),rc({target:"Symbol",stat:!0,name:"isWellKnownSymbol",forced:!0},{isWellKnown:Km}),rp("metadataKey"),rp("patternMatch"),rp("replaceAll");var Ym=J(Om),zm=Ui,Xm=sc,Jm=Bc,qm=yo,Qm=zm("".charAt),Zm=zm("".charCodeAt),$m=zm("".slice),e_=function(e){return function(t,r){var n,i,o=Jm(qm(t)),s=Xm(r),a=o.length;return s<0||s>=a?e?"":void 0:(n=Zm(o,s))<55296||n>56319||s+1===a||(i=Zm(o,s+1))<56320||i>57343?e?Qm(o,s):n:e?$m(o,s,s+2):i-56320+(n-55296<<10)+65536}},t_={codeAt:e_(!1),charAt:e_(!0)},r_=t_.charAt,n_=Bc,i_=Pp,o_=tm,s_=rm,a_="String Iterator",c_=i_.set,d_=i_.getterFor(a_);o_(String,"String",(function(e){c_(this,{type:a_,string:n_(e),index:0})}),(function(){var e,t=d_(this),r=t.string,n=t.index;return n>=r.length?s_(void 0,!0):(e=r_(r,n),t.index+=e.length,s_(e,!1))}));var u_=J(zl.f("iterator"));function l_(e){return l_="function"==typeof Ym&&"symbol"==typeof u_?function(e){return typeof e}:function(e){return e&&"function"==typeof Ym&&e.constructor===Ym&&e!==Ym.prototype?"symbol":typeof e},l_(e)}var p_=J(zl.f("toPrimitive"));function h_(e){var t=function(e,t){if("object"!==l_(e)||null===e)return e;var r=e[p_];if(void 0!==r){var n=r.call(e,t||"default");if("object"!==l_(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"===l_(t)?t:String(t)}function f_(e,t,r){return(t=h_(t))in e?zd(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var E_=wi,m_=function(e,t){var r=[][e];return!!r&&E_((function(){r.call(null,t||function(){return 1},1)}))},__=Bp.forEach,T_=m_("forEach")?[].forEach:function(e){return __(this,e,arguments.length>1?arguments[1]:void 0)};rc({target:"Array",proto:!0,forced:[].forEach!=T_},{forEach:T_});var g_=Rc("Array").forEach,S_=xc,v_=Is,R_=xi,y_=g_,A_=Array.prototype,O_={DOMTokenList:!0,NodeList:!0},I_=J((function(e){var t=e.forEach;return e===A_||R_(A_,e)&&t===A_.forEach||v_(O_,S_(e))?y_:t})),b_=ys,C_=tl;rc({target:"Object",stat:!0,forced:wi((function(){C_(1)}))},{keys:function(e){return C_(b_(e))}});var N_=J(wo.Object.keys),w_=os,D_=ys,P_=go,k_=fc,L_=TypeError,M_=function(e){return function(t,r,n,i){w_(r);var o=D_(t),s=P_(o),a=k_(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 L_("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}},U_={left:M_(!1),right:M_(!0)},x_="undefined"!=typeof process&&"process"==Xi(process),V_=U_.left;rc({target:"Array",proto:!0,forced:!x_&&Wo>79&&Wo<83||!m_("reduce")},{reduce:function(e){var t=arguments.length;return V_(this,e,t,t>1?arguments[1]:void 0)}});var F_=Rc("Array").reduce,B_=xi,j_=F_,G_=Array.prototype,W_=function(e){var t=e.reduce;return e===G_||B_(G_,e)&&t===G_.reduce?j_:t},H_=J(W_),K_=rc,Y_=Jd,z_=Ui([].reverse),X_=[1,2];K_({target:"Array",proto:!0,forced:String(X_)===String(X_.reverse())},{reverse:function(){return Y_(this)&&(this.length=this.length),z_(this)}});var J_=Rc("Array").reverse,q_=xi,Q_=J_,Z_=Array.prototype,$_=J((function(e){var t=e.reverse;return e===Z_||q_(Z_,e)&&t===Z_.reverse?Q_:t})),eT=rc,tT=Jd,rT=Tu,nT=No,iT=uc,oT=fc,sT=Io,aT=eu,cT=Bs,dT=lf,uT=Nu("slice"),lT=cT("species"),pT=Array,hT=Math.max;eT({target:"Array",proto:!0,forced:!uT},{slice:function(e,t){var r,n,i,o=sT(this),s=oT(o),a=iT(e,s),c=iT(void 0===t?s:t,s);if(tT(o)&&(r=o.constructor,(rT(r)&&(r===pT||tT(r.prototype))||nT(r)&&null===(r=r[lT]))&&(r=void 0),r===pT||void 0===r))return dT(o,a,c);for(n=new(void 0===r?pT:r)(hT(c-a,0)),i=0;a<c;a++,i++)a in o&&aT(n,i,o[a]);return n.length=i,n}});var fT=Rc("Array").slice,ET=xi,mT=fT,_T=Array.prototype,TT=J((function(e){var t=e.slice;return e===_T||ET(_T,e)&&t===_T.slice?mT:t}));function gT(e,t,r,n,i){var o,s,a,c={};return I_(o=N_(n)).call(o,(function(e){c[e]=n[e]})),c.enumerable=!!c.enumerable,c.configurable=!!c.configurable,("value"in c||c.initializer)&&(c.writable=!0),c=H_(s=$_(a=TT(r).call(r)).call(a)).call(s,(function(r,n){return n(e,t,r)||r}),c),i&&void 0!==c.initializer&&(c.value=c.initializer?c.initializer.call(i):void 0,c.initializer=void 0),void 0===c.initializer&&(zd(e,t,c),c=null),c}var ST=Mo,vT=bl,RT=Gl,yT=wa,AT=Ui([].concat),OT=ST("Reflect","ownKeys")||function(e){var t=vT.f(yT(e)),r=RT.f;return r?AT(t,r(e)):t},IT=Is,bT=OT,CT=ro,NT=Oa,wT=No,DT=Ha,PT=Error,kT=Ui("".replace),LT=String(PT("zxcasd").stack),MT=/\n\s*at [^:]*:[^\n]*/,UT=MT.test(LT),xT=fo,VT=!wi((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",xT(1,7)),7!==e.stack)})),FT=Ha,BT=function(e,t){if(UT&&"string"==typeof e&&!PT.prepareStackTrace)for(;t--;)e=kT(e,MT,"");return e},jT=VT,GT=Error.captureStackTrace,WT=Qf,HT=Bs("iterator"),KT=Array.prototype,YT=function(e){return void 0!==e&&(WT.Array===e||KT[HT]===e)},zT=xc,XT=cs,JT=So,qT=Qf,QT=Bs("iterator"),ZT=function(e){if(!JT(e))return XT(e,QT)||XT(e,"@@iterator")||qT[zT(e)]},$T=so,eg=os,tg=wa,rg=ts,ng=ZT,ig=TypeError,og=function(e,t){var r=arguments.length<2?ng(e):t;if(eg(r))return tg($T(r,e));throw ig(rg(e)+" is not iterable")},sg=so,ag=wa,cg=cs,dg=function(e,t,r){var n,i;ag(e);try{if(!(n=cg(e,"return"))){if("throw"===t)throw r;return r}n=sg(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return ag(n),r},ug=Aa,lg=so,pg=wa,hg=ts,fg=YT,Eg=fc,mg=xi,_g=og,Tg=ZT,gg=dg,Sg=TypeError,vg=function(e,t){this.stopped=e,this.result=t},Rg=vg.prototype,yg=function(e,t,r){var n,i,o,s,a,c,d,u=r&&r.that,l=!(!r||!r.AS_ENTRIES),p=!(!r||!r.IS_RECORD),h=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),E=ug(t,u),m=function(e){return n&&gg(n,"normal",e),new vg(!0,e)},_=function(e){return l?(pg(e),f?E(e[0],e[1],m):E(e[0],e[1])):f?E(e,m):E(e)};if(p)n=e.iterator;else if(h)n=e;else{if(!(i=Tg(e)))throw Sg(hg(e)+" is not iterable");if(fg(i)){for(o=0,s=Eg(e);s>o;o++)if((a=_(e[o]))&&mg(Rg,a))return a;return new vg(!1)}n=_g(e,i)}for(c=p?e.next:n.next;!(d=lg(c,n)).done;){try{a=_(d.value)}catch(e){gg(n,"throw",e)}if("object"==typeof a&&a&&mg(Rg,a))return a}return new vg(!1)},Ag=Bc,Og=rc,Ig=xi,bg=pE,Cg=VE,Ng=function(e,t,r){for(var n=bT(t),i=NT.f,o=CT.f,s=0;s<n.length;s++){var a=n[s];IT(e,a)||r&&IT(r,a)||i(e,a,o(t,a))}},wg=Il,Dg=Ha,Pg=fo,kg=function(e,t){wT(t)&&"cause"in t&&DT(e,"cause",t.cause)},Lg=function(e,t,r,n){jT&&(GT?GT(e,t):FT(e,"stack",BT(r,n)))},Mg=yg,Ug=function(e,t){return void 0===e?arguments.length<2?"":t:Ag(e)},xg=Bs("toStringTag"),Vg=Error,Fg=[].push,Bg=function(e,t){var r,n=Ig(jg,this);Cg?r=Cg(Vg(),n?bg(this):jg):(r=n?this:wg(jg),Dg(r,xg,"Error")),void 0!==t&&Dg(r,"message",Ug(t)),Lg(r,Bg,r.stack,1),arguments.length>2&&kg(r,arguments[2]);var i=[];return Mg(e,Fg,{that:i}),Dg(r,"errors",i),r};Cg?Cg(Bg,Vg):Ng(Bg,Vg,{name:!0});var jg=Bg.prototype=wg(Vg.prototype,{constructor:Pg(1,Bg),message:Pg(1,""),name:Pg(1,"AggregateError")});Og({global:!0,constructor:!0,arity:2},{AggregateError:Bg});var Gg,Wg,Hg,Kg,Yg=Mo,zg=Yl,Xg=no,Jg=Bs("species"),qg=xi,Qg=TypeError,Zg=function(e,t){if(qg(t,e))return e;throw Qg("Incorrect invocation")},$g=Tu,eS=ts,tS=TypeError,rS=wa,nS=function(e){if($g(e))return e;throw tS(eS(e)+" is not a constructor")},iS=So,oS=Bs("species"),sS=function(e,t){var r,n=rS(e).constructor;return void 0===n||iS(r=rS(n)[oS])?t:nS(r)},aS=TypeError,cS=function(e,t){if(e<t)throw aS("Not enough arguments");return e},dS=/(?:ipad|iphone|ipod).*applewebkit/i.test(Uo),uS=Fi,lS=Hi,pS=Aa,hS=to,fS=Is,ES=wi,mS=dl,_S=lf,TS=ea,gS=cS,SS=dS,vS=x_,RS=uS.setImmediate,yS=uS.clearImmediate,AS=uS.process,OS=uS.Dispatch,IS=uS.Function,bS=uS.MessageChannel,CS=uS.String,NS=0,wS={},DS="onreadystatechange";ES((function(){Gg=uS.location}));var PS=function(e){if(fS(wS,e)){var t=wS[e];delete wS[e],t()}},kS=function(e){return function(){PS(e)}},LS=function(e){PS(e.data)},MS=function(e){uS.postMessage(CS(e),Gg.protocol+"//"+Gg.host)};RS&&yS||(RS=function(e){gS(arguments.length,1);var t=hS(e)?e:IS(e),r=_S(arguments,1);return wS[++NS]=function(){lS(t,void 0,r)},Wg(NS),NS},yS=function(e){delete wS[e]},vS?Wg=function(e){AS.nextTick(kS(e))}:OS&&OS.now?Wg=function(e){OS.now(kS(e))}:bS&&!SS?(Kg=(Hg=new bS).port2,Hg.port1.onmessage=LS,Wg=pS(Kg.postMessage,Kg)):uS.addEventListener&&hS(uS.postMessage)&&!uS.importScripts&&Gg&&"file:"!==Gg.protocol&&!ES(MS)?(Wg=MS,uS.addEventListener("message",LS,!1)):Wg=DS in TS("script")?function(e){mS.appendChild(TS("script"))[DS]=function(){mS.removeChild(this),PS(e)}}:function(e){setTimeout(kS(e),0)});var US={set:RS,clear:yS},xS=function(){this.head=null,this.tail=null};xS.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 VS,FS,BS,jS,GS,WS=xS,HS=/ipad|iphone|ipod/i.test(Uo)&&"undefined"!=typeof Pebble,KS=/web0s(?!.*chrome)/i.test(Uo),YS=Fi,zS=Aa,XS=ro.f,JS=US.set,qS=WS,QS=dS,ZS=HS,$S=KS,ev=x_,tv=YS.MutationObserver||YS.WebKitMutationObserver,rv=YS.document,nv=YS.process,iv=YS.Promise,ov=XS(YS,"queueMicrotask"),sv=ov&&ov.value;if(!sv){var av=new qS,cv=function(){var e,t;for(ev&&(e=nv.domain)&&e.exit();t=av.get();)try{t()}catch(e){throw av.head&&VS(),e}e&&e.enter()};QS||ev||$S||!tv||!rv?!ZS&&iv&&iv.resolve?((jS=iv.resolve(void 0)).constructor=iv,GS=zS(jS.then,jS),VS=function(){GS(cv)}):ev?VS=function(){nv.nextTick(cv)}:(JS=zS(JS,YS),VS=function(){JS(cv)}):(FS=!0,BS=rv.createTextNode(""),new tv(cv).observe(BS,{characterData:!0}),VS=function(){BS.data=FS=!FS}),sv=function(e){av.head||VS(),av.add(e)}}var dv=sv,uv=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},lv=Fi.Promise,pv="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,hv=!pv&&!x_&&"object"==typeof window&&"object"==typeof document,fv=Fi,Ev=lv,mv=to,_v=Sa,Tv=iu,gv=Bs,Sv=hv,vv=pv,Rv=Wo,yv=Ev&&Ev.prototype,Av=gv("species"),Ov=!1,Iv=mv(fv.PromiseRejectionEvent),bv=_v("Promise",(function(){var e=Tv(Ev),t=e!==String(Ev);if(!t&&66===Rv)return!0;if(!yv.catch||!yv.finally)return!0;if(!Rv||Rv<51||!/native code/.test(e)){var r=new Ev((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Av]=n,!(Ov=r.then((function(){}))instanceof n))return!0}return!t&&(Sv||vv)&&!Iv})),Cv={CONSTRUCTOR:bv,REJECTION_EVENT:Iv,SUBCLASSING:Ov},Nv={},wv=os,Dv=TypeError,Pv=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw Dv("Bad Promise constructor");t=e,r=n})),this.resolve=wv(t),this.reject=wv(r)};Nv.f=function(e){return new Pv(e)};var kv,Lv,Mv=rc,Uv=x_,xv=Fi,Vv=so,Fv=Hl,Bv=mp,jv=function(e){var t=Yg(e);Xg&&t&&!t[Jg]&&zg(t,Jg,{configurable:!0,get:function(){return this}})},Gv=os,Wv=to,Hv=No,Kv=Zg,Yv=sS,zv=US.set,Xv=dv,Jv=function(e,t){try{1==arguments.length?console.error(e):console.error(e,t)}catch(e){}},qv=uv,Qv=WS,Zv=Pp,$v=lv,eR=Cv,tR=Nv,rR="Promise",nR=eR.CONSTRUCTOR,iR=eR.REJECTION_EVENT,oR=Zv.getterFor(rR),sR=Zv.set,aR=$v&&$v.prototype,cR=$v,dR=aR,uR=xv.TypeError,lR=xv.document,pR=xv.process,hR=tR.f,fR=hR,ER=!!(lR&&lR.createEvent&&xv.dispatchEvent),mR="unhandledrejection",_R=function(e){var t;return!(!Hv(e)||!Wv(t=e.then))&&t},TR=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&&yR(t),t.rejection=1),!0===a?r=o:(u&&u.enter(),r=a(o),u&&(u.exit(),i=!0)),r===e.promise?d(uR("Promise-chain cycle")):(n=_R(r))?Vv(n,r,c,d):c(r)):d(o)}catch(e){u&&!i&&u.exit(),d(e)}},gR=function(e,t){e.notified||(e.notified=!0,Xv((function(){for(var r,n=e.reactions;r=n.get();)TR(r,e);e.notified=!1,t&&!e.rejection&&vR(e)})))},SR=function(e,t,r){var n,i;ER?((n=lR.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),xv.dispatchEvent(n)):n={promise:t,reason:r},!iR&&(i=xv["on"+e])?i(n):e===mR&&Jv("Unhandled promise rejection",r)},vR=function(e){Vv(zv,xv,(function(){var t,r=e.facade,n=e.value;if(RR(e)&&(t=qv((function(){Uv?pR.emit("unhandledRejection",n,r):SR(mR,r,n)})),e.rejection=Uv||RR(e)?2:1,t.error))throw t.value}))},RR=function(e){return 1!==e.rejection&&!e.parent},yR=function(e){Vv(zv,xv,(function(){var t=e.facade;Uv?pR.emit("rejectionHandled",t):SR("rejectionhandled",t,e.value)}))},AR=function(e,t,r){return function(n){e(t,n,r)}},OR=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,gR(e,!0))},IR=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw uR("Promise can't be resolved itself");var n=_R(t);n?Xv((function(){var r={done:!1};try{Vv(n,t,AR(IR,r,e),AR(OR,r,e))}catch(t){OR(r,t,e)}})):(e.value=t,e.state=1,gR(e,!1))}catch(t){OR({done:!1},t,e)}}};nR&&(dR=(cR=function(e){Kv(this,dR),Gv(e),Vv(kv,this);var t=oR(this);try{e(AR(IR,t),AR(OR,t))}catch(e){OR(t,e)}}).prototype,(kv=function(e){sR(this,{type:rR,done:!1,notified:!1,parent:!1,reactions:new Qv,rejection:!1,state:0,value:void 0})}).prototype=Fv(dR,"then",(function(e,t){var r=oR(this),n=hR(Yv(this,cR));return r.parent=!0,n.ok=!Wv(e)||e,n.fail=Wv(t)&&t,n.domain=Uv?pR.domain:void 0,0==r.state?r.reactions.add(n):Xv((function(){TR(n,r)})),n.promise})),Lv=function(){var e=new kv,t=oR(e);this.promise=e,this.resolve=AR(IR,t),this.reject=AR(OR,t)},tR.f=hR=function(e){return e===cR||undefined===e?new Lv(e):fR(e)}),Mv({global:!0,constructor:!0,wrap:!0,forced:nR},{Promise:cR}),Bv(cR,rR,!1,!0),jv(rR);var bR=Bs("iterator"),CR=!1;try{var NR=0,wR={next:function(){return{done:!!NR++}},return:function(){CR=!0}};wR[bR]=function(){return this},Array.from(wR,(function(){throw 2}))}catch(e){}var DR=lv,PR=function(e,t){if(!t&&!CR)return!1;var r=!1;try{var n={};n[bR]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},kR=Cv.CONSTRUCTOR||!PR((function(e){DR.all(e).then(void 0,(function(){}))})),LR=so,MR=os,UR=Nv,xR=uv,VR=yg;rc({target:"Promise",stat:!0,forced:kR},{all:function(e){var t=this,r=UR.f(t),n=r.resolve,i=r.reject,o=xR((function(){var r=MR(t.resolve),o=[],s=0,a=1;VR(e,(function(e){var c=s++,d=!1;a++,LR(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 FR=rc,BR=Cv.CONSTRUCTOR;lv&&lv.prototype,FR({target:"Promise",proto:!0,forced:BR,real:!0},{catch:function(e){return this.then(void 0,e)}});var jR=so,GR=os,WR=Nv,HR=uv,KR=yg;rc({target:"Promise",stat:!0,forced:kR},{race:function(e){var t=this,r=WR.f(t),n=r.reject,i=HR((function(){var i=GR(t.resolve);KR(e,(function(e){jR(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var YR=so,zR=Nv;rc({target:"Promise",stat:!0,forced:Cv.CONSTRUCTOR},{reject:function(e){var t=zR.f(this);return YR(t.reject,void 0,e),t.promise}});var XR=wa,JR=No,qR=Nv,QR=function(e,t){if(XR(e),JR(t)&&t.constructor===e)return t;var r=qR.f(e);return(0,r.resolve)(t),r.promise},ZR=rc,$R=lv,ey=Cv.CONSTRUCTOR,ty=QR,ry=Mo("Promise"),ny=!ey;ZR({target:"Promise",stat:!0,forced:true},{resolve:function(e){return ty(ny&&this===ry?$R:this,e)}});var iy=so,oy=os,sy=Nv,ay=uv,cy=yg;rc({target:"Promise",stat:!0,forced:kR},{allSettled:function(e){var t=this,r=sy.f(t),n=r.resolve,i=r.reject,o=ay((function(){var r=oy(t.resolve),i=[],o=0,s=1;cy(e,(function(e){var a=o++,c=!1;s++,iy(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 dy=so,uy=os,ly=Mo,py=Nv,hy=uv,fy=yg,Ey="No one promise resolved";rc({target:"Promise",stat:!0,forced:kR},{any:function(e){var t=this,r=ly("AggregateError"),n=py.f(t),i=n.resolve,o=n.reject,s=hy((function(){var n=uy(t.resolve),s=[],a=0,c=1,d=!1;fy(e,(function(e){var u=a++,l=!1;c++,dy(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,Ey)))}))})),--c||o(new r(s,Ey))}));return s.error&&o(s.value),n.promise}});var my=rc,_y=lv,Ty=wi,gy=Mo,Sy=to,vy=sS,Ry=QR,yy=_y&&_y.prototype;my({target:"Promise",proto:!0,real:!0,forced:!!_y&&Ty((function(){yy.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=vy(this,gy("Promise")),r=Sy(e);return this.then(r?function(r){return Ry(t,e()).then((function(){return r}))}:e,r?function(r){return Ry(t,e()).then((function(){throw r}))}:e)}});var Ay=J(wo.Promise);class Oy extends mn{set _mediaStreamTrack(e){e!==this.mediaStreamTrack&&(this.safeEmit(Ad.TRACK_UPDATED,e),this.mediaStreamTrack=e)}get _mediaStreamTrack(){return this.mediaStreamTrack}constructor(e,t){super(),f_(this,"trackMediaType",void 0),f_(this,"_ID",void 0),f_(this,"_rtpTransceiver",void 0),f_(this,"_lowRtpTransceiver",void 0),f_(this,"_hints",[]),f_(this,"_isClosed",!1),f_(this,"_originMediaStreamTrack",void 0),f_(this,"mediaStreamTrack",void 0),f_(this,"_external",{}),this._ID=t||Un(8,"track-"),this._originMediaStreamTrack=e,this.mediaStreamTrack=e,fd(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){return e||kn((()=>{var e;Ai.reportApiInvoke(null,{name:Sn.GET_MEDIA_STREAM_TRACK,options:[],tag:vn.TRACER}).onSuccess((null===(e=this._mediaStreamTrack)||void 0===e?void 0:e.label)||"")}),this.mediaStreamTrack.id||this.getTrackId()),this._mediaStreamTrack}getRTCRtpTransceiver(e){return e===vd.LOW_STREAM?this._lowRtpTransceiver:this._rtpTransceiver}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,this._lowRtpTransceiver=void 0,this._rtpTransceiver=void 0,Ed(this),this.emit(Od.CLOSED),this.removeAllListeners(Ad.SEI_RECEIVED)}_updateRtpTransceiver(e,t){if(t===vd.LOW_STREAM){if(this._lowRtpTransceiver===e)return;this._lowRtpTransceiver=e}else{if(this._rtpTransceiver===e)return;this._rtpTransceiver=e}this.emit(Ad.TRANSCEIVER_UPDATED,e,t)}}class Iy extends Oy{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),f_(this,"_enabled",!0),f_(this,"_muted",!1),f_(this,"_isExternalTrack",!1),f_(this,"_isClosed",!1),f_(this,"_enabledMutex",void 0),f_(this,"processor",void 0),f_(this,"_processorContext",void 0),f_(this,"_handleTrackEnded",(()=>{this.onTrackEnded()})),this._enabledMutex=new Kn("".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,_i.debug("[".concat(this.getTrackId(),"] close")),this.emit(gd.NEED_CLOSE),super.close())}async _updateOriginMediaStreamTrack(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this._isExternalTrack=r,e!==this._originMediaStreamTrack&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),t&&this._originMediaStreamTrack.stop()),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,this._muted&&(this._originMediaStreamTrack.enabled=!1),this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await On(this,gd.NEED_REPLACE_TRACK,this),this.processor&&this._processorContext&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this._processorContext}))}_getDefaultPlayerConfig(){return{}}onTrackEnded(){_i.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Od.TRACK_ENDED)}stateCheck(e,t){if(_i.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),an(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new sn(on.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print("error",_i);if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new sn(on.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print("error",_i)}getProcessorStats(){return this._processorContext&&this._processorContext.gatherStats()||[]}getProcessorUsage(){return this._processorContext?this._processorContext.gatherUsage():Ay.resolve([])}}function by(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 Cy=window.AudioContext||window.webkitAudioContext;let Ny=null;const wy=new class extends mn{constructor(){super(...arguments),f_(this,"prevState",void 0),f_(this,"curState",void 0),f_(this,"currentTime",void 0),f_(this,"currentTimeStuckAt",void 0),f_(this,"interruptDetectorTrack",void 0),f_(this,"onLocalAudioTrackMute",(()=>{_i.info("ios15-interruption-start"),this.emit(Ni.IOS_15_16_INTERRUPTION_START)})),f_(this,"onLocalAudioTrackUnmute",(async()=>{_i.info("ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?_i.info("ios15-interruption-end-canceled"):(Ny&&await Ny.suspend(),this.emit(Ni.IOS_15_16_INTERRUPTION_END))}))}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){_i.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){_i.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 Dy(){if(!Cy)return void _i.error("your browser is not support web audio");_i.info("create audio context");const e=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?by(Object(r),!0).forEach((function(t){f_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):by(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},ii("WEBAUDIO_INIT_OPTIONS"));_i.debug("audio context init option:",JSON.stringify(e)),Ny=new Cy(e),wy.curState=Ny.state,Ny.onstatechange=()=>{wy.prevState=wy.curState,wy.curState=Ny?Ny.state:void 0;const{prevState:e,curState:t}=wy,r="running"===t,n="interrupted"===t,i="running"===e,o="suspended"===e,s="interrupted"===e,a=kr().osVersion;(Gr()||Jr())&&i&&n&&(_i.info("ios".concat(a,"-interruption-start")),wy.emit(Ni.IOS_INTERRUPTION_START)),(Gr()||Jr())&&(o||s)&&r&&(_i.info("ios".concat(a,"-interruption-end")),wy.emit(Ni.IOS_INTERRUPTION_END)),e!==t&&wy.emit(Ni.STATE_CHANGE,t,e)},setInterval((()=>{var e;const t=null===(e=Ny)||void 0===e?void 0:e.currentTime;if(wy.currentTime!==t)wy.currentTimeStuckAt&&(_i.debug("AudioContext current time resume at ".concat(t)),wy.currentTimeStuckAt=void 0),wy.currentTime=t;else{if(t!==wy.currentTimeStuckAt){Ai.reportApiInvoke(null,{name:"WEB_AUDIO_CURRENT_TIME_STUCK",options:{currentTime:t},tag:vn.TRACER}).onSuccess(),_i.warning("AudioContext current time stuck at ".concat(t))}wy.currentTimeStuckAt=t}}),5e3),async function(e){const t=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","touchend","keydown","keyup"];let r,n=!1,i=!1,o=!1;function s(t){"running"===e.state?a(!1):Gr()||Jr()?"suspended"===e.state&&(a(!0),t&&e.resume().then(d,d)):"closed"!==e.state&&(a(!0),t&&e.resume().then(d,d))}function a(e){if(n!==e){n=e;for(let r=0,n=t;r<n.length;r+=1){const t=n[r];e?window.addEventListener(t,u,{capture:!0,passive:!0}):window.removeEventListener(t,u,{capture:!0,passive:!0})}}}function c(){s(!0)}function d(){s(!1)}function u(){s(!0)}function l(e){if(!o)if(r.paused)if(e){let e;p(!1),o=!0;try{e=r.play(),e?e.then(h,h):(r.addEventListener("playing",h),r.addEventListener("abort",h),r.addEventListener("error",h))}catch(e){h()}}else p(!0);else p(!1)}function p(e){if(i!==e){i=e;for(let r=0,n=t;r<n.length;r++){const t=n[r];e?window.addEventListener(t,f,{capture:!0,passive:!0}):window.removeEventListener(t,f,{capture:!0,passive:!0})}}}function h(){r.removeEventListener("playing",h),r.removeEventListener("abort",h),r.removeEventListener("error",h),o=!1,l(!1)}function f(){l(!0)}if(Gr()){const t=e.createMediaStreamDestination(),n=document.createElement("div");n.innerHTML="<audio x-webkit-airplay='deny'></audio>",r=n.children.item(0),r.controls=!1,r.disableRemotePlayback=!0,r.preload="auto",r.srcObject=t.stream,l(!0)}wy.on(Ni.STATE_CHANGE,c),s(!1)}(Ny)}function Py(){if(!Ny){if(Dy(),!Ny)throw new sn(on.NOT_SUPPORTED,"can not create audio context");return Ny}return Ny}function ky(){return!!Ny}function Ly(e){if(function(){if(null!==Uy)return Uy;const e=Py(),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(),Uy=i,i}())return;const t=e.connect,r=e.disconnect;e.connect=(r,n,i)=>{var o;return e._inputNodes||(e._inputNodes=[]),ed(o=e._inputNodes).call(o,r)||(r instanceof AudioNode?(e._inputNodes.push(r),t.call(e,r,n,i)):t.call(e,r,n)),e},e.disconnect=(n,i,o)=>{r.call(e),n?Cn(e._inputNodes,n):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}function My(e){const t=Py();return new Ay(((r,n)=>{t.decodeAudioData(e,(e=>{r(e)}),(e=>{n(new sn(on.DECODE_AUDIO_FILE_FAILED,e.toString()))}))}))}let Uy=null;let xy=null;function Vy(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 Fy=J(W_);class By{constructor(){f_(this,"context",void 0),f_(this,"analyserNode",void 0),f_(this,"sourceNode",void 0),this.context=Py(),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||Gr()||Jr()||"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=Fy(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){_i.warning("rebuild analyser node failed.")}}destroy(){this.updateSource(void 0)}}class jy extends mn{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(),f_(this,"outputNode",void 0),f_(this,"outputTrack",void 0),f_(this,"isPlayed",!1),f_(this,"sourceNode",void 0),f_(this,"context",void 0),f_(this,"audioBufferNode",void 0),f_(this,"destNode",void 0),f_(this,"audioOutputLevel",0),f_(this,"volumeLevelAnalyser",void 0),f_(this,"_processedNode",void 0),f_(this,"playNode",void 0),f_(this,"isDestroyed",!1),f_(this,"onNoAudioInput",void 0),f_(this,"isNoAudioInput",!1),f_(this,"_noAudioInputCount",0),this.context=Py(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),Ly(this.outputNode),this.volumeLevelAnalyser=new By}startGetAudioBuffer(e){this.audioBufferNode||(this.audioBufferNode=this.context.createScriptProcessor(e),this.outputNode.connect(this.audioBufferNode),this.audioBufferNode.connect(this.context.destination),this.audioBufferNode.onaudioprocess=e=>{this.emit(Cd.ON_AUDIO_BUFFER,Vy(e))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!bi().webAudioMediaStreamDest)throw new sn(on.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&&Nn((()=>{wy.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;Gr()||Jr()?"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 Mn(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 jy{get isFreeze(){return!1}constructor(e,t,r){var n;if(super(),f_(this,"sourceNode",void 0),f_(this,"track",void 0),f_(this,"clonedTrack",void 0),f_(this,"audioElement",void 0),f_(this,"isCurrentTrackCloned",!1),f_(this,"isRemoteTrack",!1),f_(this,"originVolumeLevelAnalyser",void 0),f_(this,"rebuildWebAudio",(async()=>{if(_i.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 _i.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then((()=>_i.info("resume success"))),_i.debug("rebuild web audio because of ios 12 bugs"),this.disconnect();const e=this.track;this.track=this.track.clone(),this.isCurrentTrackCloned?e.stop():this.isCurrentTrackCloned=!0;const t=new MediaStream([this.track]);this.sourceNode=this.context.createMediaStreamSource(t),Ly(this.sourceNode),this.volumeLevelAnalyser.rebuildAnalyser();const r=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(r,this.context.currentTime),Ly(this.outputNode),this.emit(Cd.UPDATE_SOURCE),this.connect(),this.audioElement.srcObject=t,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()})),"audio"!==e.kind)throw new sn(on.UNEXPECTED_ERROR);this.track=e;const i=new MediaStream([this.track]);if(this.isRemoteTrack=!!t,this.sourceNode=this.context.createMediaStreamSource(i),Ly(this.sourceNode),r){const e=r.clone();e.enabled=!0,this.clonedTrack=e,_i.debug("create an unmuted track ".concat(e.id," from the original track ").concat(r.id," to get the volume"));const t=this.context.createMediaStreamSource(new MediaStream([e]));Ly(t),this.originVolumeLevelAnalyser=new By,this.originVolumeLevelAnalyser.updateSource(t)}this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=i;const o=kr();t&&o.os===Cr.IOS&&Number(null===(n=o.osVersion)||void 0===n?void 0:n.split(".")[0])<15&&(wy.on(Ni.STATE_CHANGE,(()=>{"suspended"===this.context.state?document.body.addEventListener("click",this.rebuildWebAudio,!0):"running"===this.context.state&&this.rebuildWebAudio()})),this.checkHasAudioInput().then((e=>{e||document.body.addEventListener("click",this.rebuildWebAudio,!0)})))}updateTrack(e){this.sourceNode.disconnect(),this.track=e,this.isCurrentTrackCloned=!1;const t=new MediaStream([e]);this.sourceNode=this.context.createMediaStreamSource(t),Ly(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(Cd.UPDATE_SOURCE),this.audioElement.srcObject=t}destroy(){var e;this.audioElement.srcObject=null,this.audioElement.remove(),wy.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),_i.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]));Ly(r),this.originVolumeLevelAnalyser&&this.originVolumeLevelAnalyser.updateSource(r)}getOriginVolumeLevel(){return this.originVolumeLevelAnalyser?this.originVolumeLevelAnalyser.getVolumeLevel():this.getAccurateVolumeLevel()}}async function Wy(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 Hy(e,t){const r=await Ky(e.mediaSource),{sourceId:n,audio:i}=await function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return new Promise(((r,n)=>{const i=document.createElement("div");i.innerText="share screen",i.setAttribute("style","text-align: center; height: 25px; line-height: 25px; border-radius: 4px 4px 0 0; background: #D4D2D4; border-bottom: solid 1px #B9B8B9;");const o=document.createElement("div");o.setAttribute("style","width: 100%; height: 500px; padding: 15px 25px ; box-sizing: border-box;");const s=document.createElement("div");s.innerText="Agora Web Screensharing wants to share the contents of your screen with webdemo.agorabeckon.com. Choose what you'd like to share.",s.setAttribute("style","height: 12%;");const a=document.createElement("div");a.setAttribute("style","width: 100%; height: 80%; background: #FFF; border: solid 1px #CBCBCB; display: flex; flex-wrap: wrap; justify-content: space-around; overflow-y: scroll; padding: 0 15px; box-sizing: border-box;");const c=document.createElement("div");c.setAttribute("style","display: flex; justify-content: space-between; padding: 16px 0;");const d=document.createElement("button");d.innerHTML="cancel",d.setAttribute("style","width: 85px;"),d.onclick=()=>{document.body.removeChild(p);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 p=document.createElement("div");p.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%);"),p.appendChild(i),p.appendChild(o),document.body.appendChild(p),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(p),r({sourceId:e.id,audio:u})},a.appendChild(t)}}))}))}(r,t);return await Wy(n,e,i)}async function Ky(e){let t=["window","screen"];"application"!==e&&"window"!==e||(t=["window"]),"screen"===e&&(t=["screen"]);const r=gn();if(!r)throw console.error("failed to fetch electron, please mount it to window"),new sn(on.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 Ay(((e,n)=>{r.desktopCapturer.getSources({types:t},((t,r)=>{t?n(t):e(r)}))})));try{return await n}catch(e){throw new sn(on.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 zy=new Kn("safari");async function Xy(e,t){let r=0,n=null;for(;r<2;)try{n=await Jy(e,t,r>0);break}catch(e){if(e instanceof sn)throw _i.error("[".concat(t,"] ").concat(e.toString())),e;const n=qy(e.name||e.code||e,e.message);if(n.code===on.MEDIA_OPTION_INVALID){_i.debug("[".concat(t,"] detect media option invalid, retry")),r+=1,await Mn(500);continue}throw _i.error("[".concat(t,"] ").concat(n.toString())),n}if(!n)throw new sn(on.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return n}async function Jy(t,r,n){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new sn(on.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=bi(),o=new MediaStream;if(t.audioSource&&o.addTrack(t.audioSource),t.videoSource&&o.addTrack(t.videoSource),!t.audio&&!t.video&&!t.screen)return _i.debug("Using Video Source/ Audio Source"),o;if(t.screen)if(_n())if(t.screen.sourceId){Qy(o,await Wy(t.screen.sourceId,t.screen,t.screenAudio))}else{Qy(o,await Hy(t.screen,t.screenAudio))}else if(Vr()&&t.screen.extensionId&&t.screen.mandatory){if(!i.getStreamFromExtension)throw new sn(on.NOT_SUPPORTED,"This browser does not support screen sharing");_i.debug("[".concat(r,'] Screen access on chrome stable, looking for extension"'));const e=await(a=t.screen.extensionId,c=r,new Ay(((e,t)=>{try{chrome.runtime.sendMessage(a,{getStream:!0},(r=>{if(!r||!r.streamId)return _i.error("[".concat(c,"] No response from Chrome Plugin. Plugin not installed properly"),r),void t(new sn(on.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)}))}catch(e){_i.error("[".concat(c,"] AgoraRTC screensharing plugin is not accessible(").concat(a,")"),e.toString()),t(new sn(on.CHROME_PLUGIN_NOT_INSTALL))}})));t.screen.mandatory.chromeMediaSourceId=e;Qy(o,await navigator.mediaDevices.getUserMedia({video:{mandatory:t.screen.mandatory}}))}else if(i.getDisplayMedia){var s;t.screen.mediaSource&&Td(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,_i.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){f_(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));Qy(o,d)}else{if(!jr())throw _i.error("[".concat(r,"] This browser does not support screenSharing")),new sn(on.NOT_SUPPORTED,"This browser does not support screen sharing");{t.screen.mediaSource&&Td(t.screen.mediaSource);const e={video:{mediaSource:t.screen.mediaSource,width:t.screen.width,height:t.screen.height,frameRate:t.screen.frameRate}};_i.debug("[".concat(r,"] getUserMedia: ").concat(JSON.stringify(e)));Qy(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=ii("MEDIA_DEVICE_CONSTRAINTS");if(u)try{"string"==typeof u&&(u=JSON.parse(u)),d=jn(d,u)}catch(e){}_i.debug("[".concat(r,"] GetUserMedia"),JSON.stringify(d)),kr();let l,p=null;(Fr()||Gr()||xr())&&(p=await zy.lock());try{l=await navigator.mediaDevices.getUserMedia(d)}catch(e){throw p&&p(),e}return d.audio&&(e.HAS_GUM_AUDIO=!0),d.video&&(e.HAS_GUM_VIDEO=!0),Qy(o,l),p&&p(),o}function qy(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new sn(on.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new sn(on.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new sn(on.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new sn(on.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new sn(on.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new sn(on.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return _i.error("getUserMedia unexpected error",e),new sn(on.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function Qy(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 Zy extends mn{get state(){return this._state}set state(e){e!==this._state&&(this.emit(xd.STATE_CHANGE,e),this._state=e)}constructor(){super(),f_(this,"_state",Ud.IDLE),f_(this,"isAccessMicrophonePermission",!1),f_(this,"isAccessCameraPermission",!1),f_(this,"lastAccessMicrophonePermission",!1),f_(this,"lastAccessCameraPermission",!1),f_(this,"checkdeviceMatched",!1),f_(this,"deviceInfoMap",new Map),this.init().then((()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval((()=>{(ii("ENUMERATE_DEVICES_INTERVAL")||($r()||Mr()===Cr.HARMONY_OS)&&Zr())&&this.updateDevicesInfo()}),ii("ENUMERATE_DEVICES_INTERVAL_TIME"))})).catch((e=>_i.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 sn(on.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(zy.isLocked){_i.debug("[device manager] wait GUM lock");(await zy.lock())(),_i.debug("[device manager] GUM unlock")}if(e.HAS_GUM_AUDIO&&(s=!1,this.isAccessMicrophonePermission=!0),e.HAS_GUM_VIDEO&&(a=!1,this.isAccessCameraPermission=!0),_i.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=qy(e.name||e.code||e,e.message);if(t.code===on.PERMISSION_DENIED)throw t;_i.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=qy(e.name||e.code||e,e.message);if(t.code===on.PERMISSION_DENIED)throw t;_i.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(a){try{d=await navigator.mediaDevices.getUserMedia({video:r})}catch(e){const t=qy(e.name||e.code||e,e.message);if(t.code===on.PERMISSION_DENIED)throw t;_i.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}_i.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 sn(on.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 sn(on.DEVICE_NOT_FOUND,"deviceId: ".concat(e));return t}async init(){this.state=Ud.INITING;try{await this.updateDevicesInfo(),this.state=Ud.INITEND}catch(e){if(_i.warning("Device Detection functionality cannot start properly.",e.toString()),this.state=Ud.IDLE,!("boolean"==typeof isSecureContext?isSecureContext:"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname)){new sn(on.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.").throw()}throw e}}async updateDevicesInfo(){const e=await this.enumerateDevices(!0,!0,!0),t=Date.now(),r=[];if(e[0]&&e[0].label&&!1===this.checkdeviceMatched){this.checkdeviceMatched=!0;const t=e.find((e=>"audioinput"===e.kind&&"default"===e.deviceId)),r=e.find((e=>"audiooutput"===e.kind&&"default"===e.deviceId));t&&r?r.groupId===t.groupId?_i.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is the same group")):_i.warning("[device-check] default input ".concat(t.label," and output ").concat(r.label," is not the same group")):_i.debug("[device-check] default input or output not found")}const n=this.checkMediaDeviceInfoIsOk(e);if(e.forEach((e=>{if(!e.deviceId)return;const n=this.deviceInfoMap.get("".concat(e.kind,"_").concat(e.deviceId));if("ACTIVE"!==(n?n.state:"INACTIVE")){const n={initAt:t,updateAt:t,device:e,state:"ACTIVE"};this.deviceInfoMap.set("".concat(e.kind,"_").concat(e.deviceId),n),r.push(n)}n&&(n.updateAt=t)})),this.deviceInfoMap.forEach(((e,n)=>{"ACTIVE"===e.state&&e.updateAt!==t&&(e.state="INACTIVE",r.push(e))})),this.state!==Ud.INITEND)return n.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),void(n.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0));r.forEach((e=>{switch(e.device.kind){case"audioinput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(xd.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(xd.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(xd.PLAYOUT_DEVICE_CHANGED,e)}})),n.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),n.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0)}checkMediaDeviceInfoIsOk(e){const t=e.filter((e=>"audioinput"===e.kind)),r=e.filter((e=>"videoinput"===e.kind)),n={audio:!1,video:!1};for(const e of t)if(e.label&&e.deviceId){n.audio=!0;break}for(const e of r)if(e.label&&e.deviceId){n.video=!0;break}return n}}const $y=new Zy;let eA=!1;const tA=new class extends mn{constructor(){super(...arguments),f_(this,"onAutoplayFailed",void 0),f_(this,"onAudioAutoplayFailed",void 0)}};function rA(){if(kr(),!eA){const e=t=>{t.preventDefault(),eA=!1,en()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};eA=!0,en()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),_i.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),tA.onAutoplayFailed?tA.onAutoplayFailed():tA.onAudioAutoplayFailed?_i.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 ."):_i.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 ."),tA.emit("autoplay-failed")}}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){f_(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}function oA(e,t,r,n){if(!e)return;const i=Ai.getBaseInfoBySessionId(e);if(!i)return;const o=i.info,s=Date.now(),a=iA(iA({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-i.startTime,cbRegistered:tA.onAutoplayFailed||tA.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:n,extend:void 0});Ai.send({type:vi.AUTOPLAY_FAILED,data:a},!0)}const sA=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","error"],aA=new class{constructor(){f_(this,"onAutoplayFailed",void 0),f_(this,"elementMap",new Map),f_(this,"elementStateMap",new Map),f_(this,"elementsNeedToResume",[]),f_(this,"sinkIdMap",new Map),f_(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(_i.debug("resume after interrupted, ele: ".concat(i," audio: ").concat(s," ").concat(e)),"live"===s){if(e)return n.pause(),void n.play();if("running"===wy.curState)return Yr()?(n.pause(),void n.play()):void(i&&"paused"===i&&n.play())}}))})),f_(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{Array.from(this.elementMap.entries()).forEach((e=>{let[t,r]=e;const n=r.srcObject.getAudioTracks()[0];n&&"live"===n.readyState&&(_i.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())}))})),this.autoResumeAudioElement(),wy.on(Ni.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),wy.on(Ni.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),wy.on(Ni.STATE_CHANGE,(()=>{Gr()&&"suspended"===wy.prevState&&"running"===wy.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 sn(on.PERMISSION_DENIED,"can not set sink id: "+e.toString())}}play(e,t,r,n){if(this.elementMap.has(t))return;const i=document.createElement("audio");i.autoplay=!0,i.srcObject=new MediaStream([e]),this.bindAudioElementEvents(t,i),this.elementMap.set(t,i),this.elementStateMap.set(t,Vd.INIT),this.setVolume(t,r);const o=this.sinkIdMap.get(t);if(o)try{i.setSinkId(o).catch((e=>{_i.warning("[".concat(t,"] set sink id failed"),e.toString())}))}catch(e){_i.warning("[".concat(t,"] set sink id failed"),e.toString())}const s=i.play();s&&s.then&&s.catch((e=>{n&&oA(n,"audio",e.message,t),_i.warning("audio element play warning",e.toString()),this.elementMap.has(t)&&"NotAllowedError"===e.name&&(_i.warning("detected audio element autoplay failed"),this.elementsNeedToResume.push(i),Nn((()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),rA()})))}))}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){sA.forEach((r=>{t.addEventListener(r,(r=>{const n=this.elementStateMap.get(e),i="pause"===r.type?"paused":r.type;if(_i.debug("[".concat(e,"] audio-element-status change ").concat(n," => ").concat(i)),"error"===r.type){const r=null==t?void 0:t.error;r&&_i.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=>{_i.debug("Auto resume audio element success")})).catch((e=>{_i.warning("Auto resume audio element failed!",e)}))})),this.elementsNeedToResume=[]};new Promise((e=>{document.body?e():window.addEventListener("load",(()=>e()))})).then((()=>{en()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0))}))}};function cA(){return function(e,t,r){const n=r.value;return"function"==typeof n&&(r.value=function(){this._isClosed&&new sn(on.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning",_i);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 Ay?new Ay(((e,t)=>{i.then(e).catch(t)})):i}),r}}var dA=Rc("Array").values,uA=xc,lA=Is,pA=xi,hA=dA,fA=Array.prototype,EA={DOMTokenList:!0,NodeList:!0},mA=J((function(e){var t=e.values;return e===fA||pA(fA,e)&&t===fA.values||lA(EA,uA(e))?hA:t}));function _A(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 TA(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_A(Object(r),!0).forEach((function(t){f_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_A(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class gA extends mn{constructor(e){super(),f_(this,"name","VideoProcessorDestination"),f_(this,"ID","0"),f_(this,"_source",void 0),f_(this,"videoContext",void 0),f_(this,"inputTrack",void 0),this.videoContext=e}get kind(){return"video"}get enabled(){return!0}pipe(){throw new sn(on.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}unpipe(){throw new sn(on.NOT_SUPPORTED,"VideoProcessor cannot unpipe to any other Processor")}enable(){}disable(){}updateInput(e){if(e.context!==this.videoContext)throw new Error("ProcessorContext passed to VideoTrack.processorDestination doesn't match it's belonging VideoTrack's context.\nProbably you are making pipeline like this:\nvideoTrack1.pipe(processor).pipe(videoTrack2.processorDestination).");e.track&&e.track!==this.inputTrack&&(this.videoContext.chained=!0,this.inputTrack=e.track,this.emit(Ld.ON_TRACK,e.track))}reset(){this.inputTrack=void 0,this.videoContext.chained=!1,this.emit(Ld.ON_TRACK,void 0)}}class SA extends mn{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t){super(),f_(this,"constraintsMap",new Map),f_(this,"statsRegistry",[]),f_(this,"usageRegistry",[]),f_(this,"trackId",void 0),f_(this,"direction",void 0),f_(this,"_chained",!1),this.trackId=e,this.direction=t}async getConstraints(){return await An(this,Md.REQUEST_CONSTRAINTS)}async requestApplyConstraints(e,t){var r;return _i.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),On(this,Md.REQUEST_UPDATE_CONSTRAINTS,Array.from(mA(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return _i.info("processor ".concat(e.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(e),On(this,Md.REQUEST_UPDATE_CONSTRAINTS,Array.from(mA(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const{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){_i.error(new sn(on.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 Ay&&(r=await r),e.push(TA(TA({},r),{},{direction:this.direction}))}catch(e){_i.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class vA extends mn{constructor(e){super(),f_(this,"name","AudioProcessorDestination"),f_(this,"ID","0"),f_(this,"inputTrack",void 0),f_(this,"inputNode",void 0),f_(this,"audioProcessorContext",void 0),f_(this,"_source",void 0),this.audioProcessorContext=e}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new sn(on.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new sn(on.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(Ld.ON_TRACK,void 0),this.emit(Ld.ON_NODE,void 0)}updateInput(e){if(e.context!==this.audioProcessorContext)throw new Error("ProcessorContext passed to AudioTrack.processorDestination doesn't match it's belonging AudioTrack's context.\n Probably you are making pipeline like this: audioTrack1.pipe(processor).pipe(audioTrack2.processorDestination).");e.track&&this.inputTrack!==e.track&&(this.audioProcessorContext.chained=!0,this.inputTrack=e.track,this.emit(Ld.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.audioProcessorContext.chained=!0,this.inputNode=e.node,this.emit(Ld.ON_NODE,this.inputNode))}}class RA extends mn{set chained(e){this._chained=e}get chained(){return this._chained}constructor(e,t,r){super(),f_(this,"constraintsMap",new Map),f_(this,"statsRegistry",[]),f_(this,"audioContext",void 0),f_(this,"trackId",void 0),f_(this,"direction",void 0),f_(this,"usageRegistry",[]),f_(this,"_chained",!1),this.audioContext=e,this.trackId=t,this.direction=r}async getConstraints(){return An(this,Md.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(e,t){var r;return _i.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),On(this,Md.REQUEST_UPDATE_CONSTRAINTS,Array.from(mA(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return this.constraintsMap.delete(e),On(this,Md.REQUEST_UPDATE_CONSTRAINTS,Array.from(mA(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t))||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){const r=this.statsRegistry.findIndex((r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t));-1!==r&&this.statsRegistry.splice(r,1)}gatherStats(){const e=[];for(const{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){_i.error(new sn(on.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 Ay&&(r=await r),e.push(TA(TA({},r),{},{direction:this.direction}))}catch(e){_i.error("gather extension usage error",e)}return e}getDirection(){return this.direction}}class yA extends mn{get isPlayed(){return!0}get isFreeze(){return!1}constructor(){super(),f_(this,"context",void 0),f_(this,"processSourceNode",void 0),f_(this,"outputTrack",void 0),f_(this,"processedNode",void 0),f_(this,"clonedTrack",void 0),f_(this,"outputNode",void 0),this.outputNode=new AA}setVolume(){}createOutputTrack(){throw new sn(on.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 AA{disconnect(){}connect(){}}function OA(e){return new Ay(((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=Gr()?"canplay":"playing";i.addEventListener(o,(()=>{const e=i.videoWidth,r=i.videoHeight;!e&&jr()||(n=!0,i.srcObject=null,i.remove(),t([e,r]))})),i.srcObject=new MediaStream([e]),i.play().catch(xn),setTimeout((()=>{n||(i.srcObject=null,i.remove(),t([i.videoWidth,i.videoHeight]))}),4e3)}))}function IA(e){const t={};e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId});const r=cd(e.encoderConfig);return null!=r.width&&(t.width=r.width),null!=r.height&&(t.height=r.height),!qr()&&r.frameRate&&(t.frameRate=r.frameRate),Br()&&"object"==typeof t.frameRate&&(t.frameRate.max=60),jr()&&(t.frameRate={ideal:30,max:30}),t}function bA(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&Vr()&&(t.extensionId=e.extensionId);const{displaySurface:r,selfBrowserSurface:n,surfaceSwitching:i,systemAudio:o}=e;(Wr(107)||Hr(107)||Kr(93))&&(r&&(cn(r,"displaySurface",["browser","window","monitor"]),t.displaySurface=r),n?(cn(n,"selfBrowserSurface",["exclude","include"]),t.selfBrowserSurface=n):t.selfBrowserSurface="include",i&&(cn(i,"surfaceSwitching",["exclude","include"]),t.surfaceSwitching=i)),(Wr(105)||Hr(105)||Kr(91))&&o&&(cn(o,"systemAudio",["exclude","include"]),t.systemAudio=o),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const s=e.encoderConfig?dd(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 CA(e){const t={};if(qr()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,Vr()&&e.ANS&&(t.googHighpassFilter=e.ANS))),e.encoderConfig){const r=pd(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),$r()&&(t.sampleRate=void 0),t}function NA(e,t,r,n,i){const o=ii("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}}function wA(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 DA=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,p,h,f,E=1732584193,m=-271733879,_=-1732584194,T=271733878;for(u=0;u<d.length;u+=16)l=E,p=m,h=_,f=T,E=o(E,m,_,T,d[u+0],7,-680876936),T=o(T,E,m,_,d[u+1],12,-389564586),_=o(_,T,E,m,d[u+2],17,606105819),m=o(m,_,T,E,d[u+3],22,-1044525330),E=o(E,m,_,T,d[u+4],7,-176418897),T=o(T,E,m,_,d[u+5],12,1200080426),_=o(_,T,E,m,d[u+6],17,-1473231341),m=o(m,_,T,E,d[u+7],22,-45705983),E=o(E,m,_,T,d[u+8],7,1770035416),T=o(T,E,m,_,d[u+9],12,-1958414417),_=o(_,T,E,m,d[u+10],17,-42063),m=o(m,_,T,E,d[u+11],22,-1990404162),E=o(E,m,_,T,d[u+12],7,1804603682),T=o(T,E,m,_,d[u+13],12,-40341101),_=o(_,T,E,m,d[u+14],17,-1502002290),m=o(m,_,T,E,d[u+15],22,1236535329),E=s(E,m,_,T,d[u+1],5,-165796510),T=s(T,E,m,_,d[u+6],9,-1069501632),_=s(_,T,E,m,d[u+11],14,643717713),m=s(m,_,T,E,d[u+0],20,-373897302),E=s(E,m,_,T,d[u+5],5,-701558691),T=s(T,E,m,_,d[u+10],9,38016083),_=s(_,T,E,m,d[u+15],14,-660478335),m=s(m,_,T,E,d[u+4],20,-405537848),E=s(E,m,_,T,d[u+9],5,568446438),T=s(T,E,m,_,d[u+14],9,-1019803690),_=s(_,T,E,m,d[u+3],14,-187363961),m=s(m,_,T,E,d[u+8],20,1163531501),E=s(E,m,_,T,d[u+13],5,-1444681467),T=s(T,E,m,_,d[u+2],9,-51403784),_=s(_,T,E,m,d[u+7],14,1735328473),m=s(m,_,T,E,d[u+12],20,-1926607734),E=a(E,m,_,T,d[u+5],4,-378558),T=a(T,E,m,_,d[u+8],11,-2022574463),_=a(_,T,E,m,d[u+11],16,1839030562),m=a(m,_,T,E,d[u+14],23,-35309556),E=a(E,m,_,T,d[u+1],4,-1530992060),T=a(T,E,m,_,d[u+4],11,1272893353),_=a(_,T,E,m,d[u+7],16,-155497632),m=a(m,_,T,E,d[u+10],23,-1094730640),E=a(E,m,_,T,d[u+13],4,681279174),T=a(T,E,m,_,d[u+0],11,-358537222),_=a(_,T,E,m,d[u+3],16,-722521979),m=a(m,_,T,E,d[u+6],23,76029189),E=a(E,m,_,T,d[u+9],4,-640364487),T=a(T,E,m,_,d[u+12],11,-421815835),_=a(_,T,E,m,d[u+15],16,530742520),m=a(m,_,T,E,d[u+2],23,-995338651),E=c(E,m,_,T,d[u+0],6,-198630844),T=c(T,E,m,_,d[u+7],10,1126891415),_=c(_,T,E,m,d[u+14],15,-1416354905),m=c(m,_,T,E,d[u+5],21,-57434055),E=c(E,m,_,T,d[u+12],6,1700485571),T=c(T,E,m,_,d[u+3],10,-1894986606),_=c(_,T,E,m,d[u+10],15,-1051523),m=c(m,_,T,E,d[u+1],21,-2054922799),E=c(E,m,_,T,d[u+8],6,1873313359),T=c(T,E,m,_,d[u+15],10,-30611744),_=c(_,T,E,m,d[u+6],15,-1560198380),m=c(m,_,T,E,d[u+13],21,1309151649),E=c(E,m,_,T,d[u+4],6,-145523070),T=c(T,E,m,_,d[u+11],10,-1120210379),_=c(_,T,E,m,d[u+2],15,718787259),m=c(m,_,T,E,d[u+9],21,-343485551),E=n(E,l),m=n(m,p),_=n(_,h),T=n(T,f);return r(E)+r(m)+r(_)+r(T)}(""+t+r)).slice(0,16),i=n.slice(0,12),o=await window.crypto.subtle.importKey("raw",n,"AES-GCM",!0,["encrypt"]);return new Uint8Array(await window.crypto.subtle.encrypt({name:"AES-GCM",iv:i},o,e))},PA=e=>{const t=document.createElement("canvas");return t.width=2,t.height=2,new Ay(((r,n)=>{t.toBlob((async e=>{if(t.remove(),e){const n=await kA(e);r({buffer:n,width:t.width,height:t.height})}else n(new sn(on.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,1)}))},kA=async e=>{const t=await e.arrayBuffer();return new Uint8Array(t)};function LA(e,t){if("VideoFrame"in window&&"TransformStream"in window&&bi().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}}var MA,UA,xA,VA,FA,BA,jA,GA,WA,HA,KA,YA,zA,XA,JA,qA,QA,ZA,$A,eO,tO,rO,nO,iO,oO,sO,aO,cO,dO,uO,lO,pO,hO,fO,EO,mO,_O,TO,gO,SO;function vO(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 RO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?vO(Object(r),!0).forEach((function(t){f_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):vO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let yO=(MA=yi({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),UA=yi({argsMap:(e,t)=>[e.getTrackId(),t]}),xA=cA(),VA=Yn("LocalAudioTrack","_enabledMutex"),FA=yi({argsMap:(e,t)=>[e.getTrackId(),t]}),BA=cA(),jA=Yn("LocalAudioTrack","_enabledMutex"),GA=yi({argsMap:(e,t)=>[e.getTrackId(),t]}),WA=cA(),HA=cA(),KA=cA(),YA=yi({argsMap:e=>[e.getTrackId()]}),zA=cA(),XA=yi({argsMap:e=>[e.getTrackId()]}),JA=cA(),qA=yi({argsMap:e=>[e.getTrackId()]}),QA=yi({argsMap:(e,t)=>[e.getTrackId(),t.name]}),ZA=yi({argsMap:e=>[e.getTrackId()]}),$A=class extends Iy{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?aA.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"LocalAudioTrack"}constructor(e,t,r,n){super(e,r),f_(this,"trackMediaType",bd.AUDIO),f_(this,"_encoderConfig",void 0),f_(this,"_trackSource",void 0),f_(this,"_enabled",!0),f_(this,"_volume",100),f_(this,"_useAudioElement",!0),f_(this,"_bypassWebAudio",!1),f_(this,"processor",void 0),f_(this,"_processorContext",void 0),f_(this,"_processorDestination",void 0),f_(this,"_getOriginVolumeLevel",void 0),this._encoderConfig=t,this._getOriginVolumeLevel=!!n,this._trackSource=new yA,ii("DISABLE_WEBAUDIO")&&(this._bypassWebAudio=!0),ii("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1);Fr()&&!ky()?setTimeout((()=>this.initWebAudio())):this.initWebAudio()}setVolume(e){dn(e,"volume",0,1e3),this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&aA.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return void _i.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio."));const e=this._source.createOutputTrack();this._mediaStreamTrack!==e&&(this._mediaStreamTrack=e,On(this,gd.NEED_REPLACE_TRACK,this).then((()=>{_i.debug("[".concat(this.getTrackId(),"] replace web audio track success"))})).catch((e=>{_i.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||!Ci())throw new sn(on.NOT_SUPPORTED,"your browser does not support setting the audio output device");await aA.setSinkID(this.getTrackId(),e)}async setEnabled(e,t,r){return this._setEnabled(e,t,r)}async _setEnabled(e,t,r){if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(_i.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){this._originMediaStreamTrack.enabled=!0;try{r||(this._enabled=!0),await On(this,gd.NEED_ENABLE_TRACK,this),_i.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(e," success"))}catch(e){throw r||(this._enabled=!1),_i.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}}else{this._originMediaStreamTrack.enabled=!1,r||(this._enabled=!1);try{await On(this,gd.NEED_DISABLE_TRACK,this)}catch(e){throw r||(this._enabled=!0),_i.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}}}async setMuted(e){e!==this._muted&&(this.stateCheck("muted",e),this._muted=e,this._originMediaStreamTrack.enabled=!e,_i.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await On(this,gd.NEED_MUTE_TRACK,this):await On(this,gd.NEED_UNMUTE_TRACK,this))}getStats(){kn((()=>{_i.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")}),"localAudioTrackGetStatsWarning");const e=In(this,gd.GET_STATS);return e||RO({},wd)}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(Cd.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Cd.ON_AUDIO_BUFFER),this._source.on(Cd.ON_AUDIO_BUFFER,(t=>e(t)))}play(){_i.debug("[".concat(this.getTrackId(),"] start audio playback")),this._useAudioElement?(_i.debug("[".concat(this.getTrackId(),"] start audio playback in element")),aA.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play()}stop(){_i.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._useAudioElement?aA.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];_i.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&aA.updateTrack(this.getTrackId(),this._mediaStreamTrack)}async _updateOriginMediaStreamTrack(e,t){this._originMediaStreamTrack!==e&&(this._originMediaStreamTrack&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),t&&this._originMediaStreamTrack.stop()),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,this._muted&&(this._originMediaStreamTrack.enabled=!1),this.processor&&this._processorContext&&this.processor.updateInput({track:e,context:this._processorContext}),this._mediaStreamTrack!==this._source.outputTrack?(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await On(this,gd.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack),this._getOriginVolumeLevel&&this._source.updateOriginTrack(e))}renewMediaStreamTrack(e){return Ay.resolve(void 0)}pipe(e){if(this._bypassWebAudio)throw new sn(on.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new sn(on.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(e){e.on(Ld.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(!1),this._source.processedNode=this._source.createMediaStreamSourceNode(e),await On(this,gd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await On(this,gd.NEED_REPLACE_TRACK,this))})),e.on(Ld.ON_NODE,(e=>{this._source.processedNode=e}))}unbindProcessorDestinationEvents(e){e.removeAllListeners(Ld.ON_TRACK),e.removeAllListeners(Ld.ON_NODE)}bindProcessorContextEvents(e){e.on(Md.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}unbindProcessorContextEvents(e){e.removeAllListeners(Md.REQUEST_CONSTRAINTS)}initWebAudio(){return this._trackSource instanceof yA&&(this._trackSource=new Gy(this._mediaStreamTrack,!1,this._getOriginVolumeLevel?this._mediaStreamTrack:void 0)),this._trackSource}initProcessor(){const e=new RA(this._source.context,this.getTrackId(),"local"),t=new vA(e);return this._processorContext=e,this._processorDestination=t,this.bindProcessorContextEvents(e),this.bindProcessorDestinationEvents(t),this._source.on(Cd.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:e})})),this._useAudioElement&&(this._useAudioElement=!1,this.isPlaying&&(aA.stop(this.getTrackId()),this._source.play()),On(this,gd.NEED_REPLACE_MIXING_TRACK,this).then((()=>{_i.debug("[".concat(this.getTrackId(),"] replace from origin track to web audio track success"))})).catch((e=>{_i.warning("[".concat(this.getTrackId(),"] replace from origin track to web audio track failed"),e)}))),{processorContext:e,processorDestination:t}}},gT($A.prototype,"setVolume",[MA],Object.getOwnPropertyDescriptor($A.prototype,"setVolume"),$A.prototype),gT($A.prototype,"setPlaybackDevice",[UA,xA],Object.getOwnPropertyDescriptor($A.prototype,"setPlaybackDevice"),$A.prototype),gT($A.prototype,"setEnabled",[VA,FA,BA],Object.getOwnPropertyDescriptor($A.prototype,"setEnabled"),$A.prototype),gT($A.prototype,"setMuted",[jA,GA,WA],Object.getOwnPropertyDescriptor($A.prototype,"setMuted"),$A.prototype),gT($A.prototype,"getStats",[HA],Object.getOwnPropertyDescriptor($A.prototype,"getStats"),$A.prototype),gT($A.prototype,"setAudioFrameCallback",[KA],Object.getOwnPropertyDescriptor($A.prototype,"setAudioFrameCallback"),$A.prototype),gT($A.prototype,"play",[YA,zA],Object.getOwnPropertyDescriptor($A.prototype,"play"),$A.prototype),gT($A.prototype,"stop",[XA,JA],Object.getOwnPropertyDescriptor($A.prototype,"stop"),$A.prototype),gT($A.prototype,"close",[qA],Object.getOwnPropertyDescriptor($A.prototype,"close"),$A.prototype),gT($A.prototype,"pipe",[QA],Object.getOwnPropertyDescriptor($A.prototype,"pipe"),$A.prototype),gT($A.prototype,"unpipe",[ZA],Object.getOwnPropertyDescriptor($A.prototype,"unpipe"),$A.prototype),$A),AO=(eO=yi({argsMap:(e,t)=>[e.getTrackId(),t]}),tO=cA(),rO=Yn("MicrophoneAudioTrack","_enabledMutex"),nO=yi({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),iO=cA(),oO=yi({argsMap:e=>[e.getTrackId()]}),sO=class extends yO{get __className__(){return"MicrophoneAudioTrack"}constructor(e,t,r,n){super(e,t.encoderConfig?pd(t.encoderConfig):{},n,ii("GET_VOLUME_OF_MUTED_AUDIO_TRACK")),f_(this,"_config",void 0),f_(this,"_deviceName","default"),f_(this,"_constraints",void 0),f_(this,"_originalConstraints",void 0),f_(this,"_enabled",!0),this._config=t,this._constraints=r,this._originalConstraints=r,this._deviceName=e.label,"boolean"==typeof t.bypassWebAudio&&(this._bypassWebAudio=t.bypassWebAudio),(Yr()||zr())&&wy.bindInterruptDetectorTrack(this)}async setDevice(e){if(_i.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),this._enabled)try{const t=await $y.getDeviceById(e),r={};r.audio=RO({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let n=null;try{n=await Xy(r,this.getTrackId())}catch(e){throw _i.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await Xy({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 _i.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await $y.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(e){throw _i.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}_i.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success"))}async setEnabled(e,t,r){if(t)return _i.debug("[".concat(this.getTrackId(),"] setEnabled false (do not close microphone)")),await super._setEnabled(e);if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(_i.info("[".concat(this.getTrackId(),"] start setEnabled"),e),ii("AUTO_RESET_AUDIO_ROUTE")&&(Gr()||Jr())){const t=navigator.audioSession;t&&(e||(t.type="playback"),t.type="auto")}if(!e){var n;this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),null===(n=this._source.clonedTrack)||void 0===n||n.stop(),r||(this._enabled=!1);try{await On(this,gd.NEED_DISABLE_TRACK,this)}catch(e){throw _i.error("[".concat(this.getTrackId(),"] setEnabled false failed"),e.toString()),e}return}const i=RO({},this._constraints),o=$y.searchDeviceIdByName(this._deviceName);o&&!i.deviceId&&(i.deviceId=o);try{r||(this._enabled=!0);const e=await Xy({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!1),await On(this,gd.NEED_ENABLE_TRACK,this)}catch(e){throw r||(this._enabled=!1),_i.error("[".concat(this.getTrackId(),"] setEnabled true failed"),e.toString()),e}_i.info("[".concat(this.getTrackId(),"] setEnabled success"))}close(){super.close(),(Yr()||zr())&&wy.unbindInterruptDetectorTrack(this)}onTrackEnded(){if((Gr()||Jr())&&this._enabled&&!this._isClosed&&wy.duringInterruption){const e=async()=>{wy.off(Ni.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(_i.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};wy.on(Ni.IOS_INTERRUPTION_END,e)}else _i.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Od.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=$y.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._enabled){this._originMediaStreamTrack.stop();const e=await Xy({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!0)}}bindProcessorContextEvents(e){super.bindProcessorContextEvents(e),e.on(Md.REQUEST_UPDATE_CONSTRAINTS,(async(e,t,r)=>{try{const r=Object.assign({},this._originalConstraints,...e);await this.renewMediaStreamTrack(r),t()}catch(e){r(e)}}))}unbindProcessorContextEvents(e){super.unbindProcessorContextEvents(e),e.removeAllListeners(Md.REQUEST_UPDATE_CONSTRAINTS)}},gT(sO.prototype,"setDevice",[eO,tO],Object.getOwnPropertyDescriptor(sO.prototype,"setDevice"),sO.prototype),gT(sO.prototype,"setEnabled",[rO,nO,iO],Object.getOwnPropertyDescriptor(sO.prototype,"setEnabled"),sO.prototype),gT(sO.prototype,"close",[oO],Object.getOwnPropertyDescriptor(sO.prototype,"close"),sO.prototype),sO),OO=(aO=yi({argsMap:(e,t)=>[e.getTrackId(),t,e.duration]}),cO=cA(),dO=yi({argsMap:e=>[e.getTrackId()]}),uO=cA(),lO=yi({argsMap:e=>[e.getTrackId()]}),pO=cA(),hO=yi({argsMap:e=>[e.getTrackId()]}),fO=cA(),EO=yi({argsMap:e=>[e.getTrackId()]}),mO=cA(),_O=yi({argsMap:e=>[e.getTrackId()]}),TO=yi({argsMap:e=>[e.getTrackId()]}),gO=cA(),gT((SO=class extends yO{get __className__(){return"BufferSourceAudioTrack"}constructor(e,t,r,n){super(t.createOutputTrack(),r,n),f_(this,"source",void 0),f_(this,"_bufferSource",void 0),this._useAudioElement=!1,this.source=e,this._bufferSource=t,this._bufferSource.on(Cd.AUDIO_SOURCE_STATE_CHANGE,(e=>{this.safeEmit(Od.SOURCE_STATE_CHANGE,e)}));try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(e){}}get currentState(){return this._bufferSource.currentState}get duration(){return this._bufferSource.duration}get playbackSpeed(){return this._bufferSource.playbackSpeed}getCurrentTime(){return this._bufferSource.currentTime}startProcessAudioBuffer(e){e&&this._bufferSource.updateOptions(e),this._bufferSource.startProcessAudioBuffer()}pauseProcessAudioBuffer(){this._bufferSource.pauseProcessAudioBuffer()}seekAudioBuffer(e){this._bufferSource.seekAudioBuffer(e)}resumeProcessAudioBuffer(){this._bufferSource.resumeProcessAudioBuffer()}stopProcessAudioBuffer(){this._bufferSource.stopProcessAudioBuffer()}close(){this.source=null,this._bufferSource.destroy(),super.close()}setAudioBufferPlaybackSpeed(e){dn(e,"speed",0),this._bufferSource.setAudioBufferPlaybackSpeed(e)}}).prototype,"startProcessAudioBuffer",[aO,cO],Object.getOwnPropertyDescriptor(SO.prototype,"startProcessAudioBuffer"),SO.prototype),gT(SO.prototype,"pauseProcessAudioBuffer",[dO,uO],Object.getOwnPropertyDescriptor(SO.prototype,"pauseProcessAudioBuffer"),SO.prototype),gT(SO.prototype,"seekAudioBuffer",[lO,pO],Object.getOwnPropertyDescriptor(SO.prototype,"seekAudioBuffer"),SO.prototype),gT(SO.prototype,"resumeProcessAudioBuffer",[hO,fO],Object.getOwnPropertyDescriptor(SO.prototype,"resumeProcessAudioBuffer"),SO.prototype),gT(SO.prototype,"stopProcessAudioBuffer",[EO,mO],Object.getOwnPropertyDescriptor(SO.prototype,"stopProcessAudioBuffer"),SO.prototype),gT(SO.prototype,"close",[_O],Object.getOwnPropertyDescriptor(SO.prototype,"close"),SO.prototype),gT(SO.prototype,"setAudioBufferPlaybackSpeed",[TO,gO],Object.getOwnPropertyDescriptor(SO.prototype,"setAudioBufferPlaybackSpeed"),SO.prototype),SO);class IO extends yO{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=Py().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,Un(8,"track-mix-")),f_(this,"trackList",void 0),f_(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)?(_i.debug("add ".concat(e.getTrackId()," to mixing track")),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()):_i.debug("track ".concat(e.getTrackId()," is already added"))}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){_i.debug("remove ".concat(e.getTrackId()," from mixing track"));try{e._source.outputNode.disconnect(this.destNode)}catch(e){}Cn(this.trackList,e),this.updateEncoderConfig()}}updateEncoderConfig(){const e={};this.trackList.forEach((t=>{t._encoderConfig&&((t._encoderConfig.bitrate||0)>(e.bitrate||0)&&(e.bitrate=t._encoderConfig.bitrate),(t._encoderConfig.sampleRate||0)>(e.sampleRate||0)&&(e.sampleRate=t._encoderConfig.sampleRate),(t._encoderConfig.sampleSize||0)>(e.sampleSize||0)&&(e.sampleSize=t._encoderConfig.sampleSize),t._encoderConfig.stereo&&(e.stereo=!0))})),this._encoderConfig=e}_updateRtpTransceiver(e){this._rtpTransceiver!==e&&(this._rtpTransceiver=e,this.trackList.forEach((t=>{t instanceof IO?t.emit(Ad.TRANSCEIVER_UPDATED,e):t._updateRtpTransceiver(e)})))}}class bO extends jy{set currentState(e){e!==this._currentState&&(this._currentState=e,this.safeEmit(Cd.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(),f_(this,"audioBuffer",void 0),f_(this,"sourceNode",void 0),f_(this,"startPlayTime",0),f_(this,"startPlayOffset",0),f_(this,"pausePlayTime",0),f_(this,"options",void 0),f_(this,"currentLoopCount",0),f_(this,"currentPlaybackSpeed",100),f_(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):_i.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 CO=new Map;function NO(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function wO(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?NO(Object(r),!0).forEach((function(t){f_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):NO(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class DO{get rendFrameRate(){if(this.renderStats&&this.renderStats.curTs!==this.renderStats.lastTs){const e=this.renderStats.curTs-this.renderStats.lastTs,t=(this.renderStats.renderNum-this.renderStats.lastRenderNum)/e;return this.renderStats.lastRenderNum=this.renderStats.renderNum,this.renderStats.lastTs=this.renderStats.curTs,t}return 0}get videoElementStatus(){return this._videoElementStatus}set videoElementStatus(e){e!==this._videoElementStatus&&(_i.debug("[".concat(this.trackId,"] video-element-status change ").concat(this._videoElementStatus," => ").concat(e)),this._videoElementStatus=e)}get videoState(){return this._videoState}set videoState(e){var t;e!==this._videoState&&(this._videoState=e,null===(t=this.onVideoStateChanged)||void 0===t||t.call(this,this.videoState))}constructor(e){f_(this,"trackId",void 0),f_(this,"config",void 0),f_(this,"onFirstVideoFrameDecoded",void 0),f_(this,"onVideoStateChanged",void 0),f_(this,"freezeTimeCounterList",[]),f_(this,"renderFreezeAccTime",0),f_(this,"isKeepLastFrame",!1),f_(this,"timeUpdatedCount",0),f_(this,"freezeTime",0),f_(this,"playbackTime",0),f_(this,"lastTimeUpdatedTime",0),f_(this,"autoplayFailed",!1),f_(this,"videoTrack",void 0),f_(this,"videoElement",void 0),f_(this,"cacheVideoElement",void 0),f_(this,"renderStats",void 0),f_(this,"_videoState",Fd.VideoStateStopped),f_(this,"videoElementCheckInterval",void 0),f_(this,"videoElementFreezeTimeout",void 0),f_(this,"_videoElementStatus",Vd.NONE),f_(this,"isGettingVideoDimensions",!1),f_(this,"startGetVideoDimensions",(()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement.videoWidth*this.videoElement.videoHeight>4)return _i.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()})),f_(this,"autoResumeAfterInterruption",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===wy.curState&&(_i.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Ur())),Xr()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),f_(this,"handleVideoEvents",(e=>{switch(e.type){case"play":case"playing":this.startGetVideoDimensions(),this.videoElementStatus=Vd.PLAYING;break;case"loadeddata":if(this.videoState=Fd.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=Vd.CANPLAY;break;case"stalled":this.videoElementStatus=Vd.STALLED;break;case"suspend":this.videoElementStatus=Vd.SUSPEND;break;case"pause":this.videoElementStatus=Vd.PAUSED,Gr()||Jr()||Fr()&&this.autoplayFailed||!this.videoTrack||"live"!==this.videoTrack.readyState||(_i.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),this.videoElement.play());break;case"waiting":this.videoElementStatus=Vd.WAITING;break;case"abort":this.videoElementStatus=Vd.ABORT;break;case"ended":this.videoElementStatus=Vd.ENDED;break;case"emptied":this.videoElementStatus=Vd.EMPTIED;break;case"error":{const e=this.videoElement.error,t=e?"".concat(e.message," (").concat(e.code,")"):"";e&&(this.videoElementStatus=Vd.ERROR),_i.error("[".concat(this.trackId,"] media error: ").concat(t," "));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,VI.lastVisibleTime<VI.lastHiddenTime||r<VI.lastHiddenTime||r<VI.lastVisibleTime)return;for(t>ii("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}}})),f_(this,"autoResumeAfterInterruptionOnIOS15_16",(()=>{this.videoTrack&&"live"===this.videoTrack.readyState&&(_i.debug("[track-".concat(this.trackId,"] video element paused, auto resume for ").concat(Ur())),Xr()?(this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):(this.videoElement.pause(),this.videoElement.play()))})),this.trackId=e.trackId,this.config=e,e.element instanceof HTMLVideoElement?this.videoElement=e.element:this.videoElement=document.createElement("video"),wy.on(Ni.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),wy.on(Ni.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&&oA(e,"video",t.message,this.trackId),"NotAllowedError"===t.name?(_i.warning("detected video element autoplay failed",t),this.autoplayFailed=!0,this.handleAutoPlayFailed()):_i.warning("[".concat(this.trackId,"] play warning: "),t)}));const r=kr();if(("Safari"===r.name&&15===Number(r.version)||Yr())&&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 _i.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 Ay(((n,i)=>{r.toBlob((async e=>{if(r.remove(),e){const t=await kA(e);n({buffer:t,width:r.width,height:r.height})}else i(new sn(on.CONVERTING_VIDEO_FRAME_TO_BLOB_FAILED))}),e,t<0?.1:t>1?1:t)}))):await PA(e)}destroy(){this.renderStats=void 0,wy.off(Ni.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),wy.off(Ni.IOS_15_16_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15_16),this.videoElement.srcObject=null,this.resetVideoElement(),this.freezeTimeCounterList=[],this.videoState=Fd.VideoStateStopped}initVideoElement(){if(this.videoElementStatus=Vd.INIT,!this.videoElementCheckInterval&&(PO.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=Vd.DESTROYED)}),1e3),ii("ENABLE_VIDEO_FRAME_CALLBACK"))){var e,t;let r;const n=()=>{"visible"===document.visibilityState&&(document.removeEventListener("visibilitychange",n),this.videoElementFreezeTimeout=window.setTimeout(i,ii("VIDEO_FREEZE_DURATION")))},i=()=>{this.videoElementFreezeTimeout=void 0,this.videoState===Fd.VideoStateDecoding&&("visible"===document.visibilityState?this.videoState=Fd.VideoStateFrozen:document.addEventListener("visibilitychange",n))},o=(e,t)=>{if(this.videoElementStatus===Vd.PLAYING){if(this.renderStats?(this.renderStats.renderNum++,this.renderStats.curTs=t.mediaTime):this.renderStats={lastTs:t.mediaTime,curTs:t.mediaTime,lastRenderNum:0,renderNum:0},r){const e=t.presentationTime-r.presentationTime;this.videoState===Fd.VideoStateStarting&&(this.videoState=Fd.VideoStateDecoding),this.videoState===Fd.VideoStateDecoding&&this.onVideoStateChanged&&(this.videoElementFreezeTimeout&&window.clearTimeout(this.videoElementFreezeTimeout),this.videoElementFreezeTimeout=window.setTimeout(i,ii("VIDEO_FREEZE_DURATION"))),e<ii("VIDEO_FREEZE_DURATION")&&this.videoState===Fd.VideoStateFrozen&&(this.videoState=Fd.VideoStateDecoding),e>ii("VIDEO_FREEZE_DURATION")&&VI.lastVisibleTime>=VI.lastHiddenTime&&r.timestamp>VI.lastVisibleTime&&r.timestamp>VI.lastHiddenTime&&(this.renderFreezeAccTime+=e)}r=wO(wO({},t),{},{timestamp:e})}var n,s;ii("ENABLE_VIDEO_FRAME_CALLBACK")&&(null===(n=(s=this.videoElement).requestVideoFrameCallback)||void 0===n||n.call(s,o))};null===(e=(t=this.videoElement).requestVideoFrameCallback)||void 0===e||e.call(t,o)}this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),$r()&&!ii("HIDE_NO_POSTER")&&(this.videoElement.poster="noposter");const r=kr();if("Safari"===r.name&&15===Number(r.version)||Yr()||!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,jr()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,jr()&&this.videoElement.load();const n=this.videoElement.play();void 0!==n&&n.catch((e=>{_i.debug("[".concat(this.trackId,"] playback interrupted"),e.toString())}))}resetVideoElement(){PO.forEach((e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)})),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0),this.videoElementStatus=Vd.NONE}handleAutoPlayFailed(){const e=t=>{t.preventDefault(),this.videoElement.play().then((()=>{_i.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed."))})).catch((e=>{_i.error(e)})),this.autoplayFailed=!1,en()?document.body.removeEventListener("click",e,!0):(document.body.removeEventListener("touchstart",e,!0),document.body.removeEventListener("mousedown",e,!0))};en()?document.body.addEventListener("click",e,!0):(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)),rA()}}const PO=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate","error"];class kO extends DO{constructor(e){super(e),f_(this,"container",void 0),f_(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 PA(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",ii("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}}var LO,MO,UO,xO,VO,FO,BO,jO,GO,WO,HO,KO,YO,zO,XO,JO,qO,QO,ZO,$O,eI,tI,rI,nI,iI,oI,sI,aI,cI,dI,uI,lI,pI,hI;function fI(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 EI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?fI(Object(r),!0).forEach((function(t){f_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):fI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let mI=(LO=yi({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),MO=cA(),UO=yi({argsMap:e=>[e.getTrackId()]}),xO=Yn("LocalVideoTrack","_enabledMutex"),VO=yi({argsMap:(e,t)=>[e.getTrackId(),t]}),FO=cA(),BO=Yn("LocalVideoTrack","_enabledMutex"),jO=yi({argsMap:(e,t)=>[e.getTrackId(),t]}),GO=cA(),WO=yi({argsMap:(e,t)=>[e.getTrackId(),t]}),HO=cA(),KO=cA(),YO=yi({argsMap:(e,t,r)=>[e.getTrackId(),t,r]}),zO=cA(),XO=cA(),JO=cA(),qO=cA(),QO=cA(),ZO=cA(),$O=cA(),eI=yi({argsMap:(e,t)=>[e.getTrackId(),t.name]}),tI=yi({argsMap:e=>[e.getTrackId()]}),rI=yi({argsMap:e=>[e.getTrackId()]}),nI=yi({argsMap:(e,t,r)=>[e.getTrackId(),t.label,r]}),iI=class e extends Iy{get videoHeight(){if(Fr()){const{height:e}=this._mediaStreamTrack.getSettings();return this._videoHeight=e,this._videoHeight}return this._videoHeight}get videoWidth(){if(Fr()){const{width:e}=this._mediaStreamTrack.getSettings();return this._videoWidth=e,this._videoWidth}return this._videoWidth}get isPlaying(){return!(!this._player||this._player.videoElementStatus!==Vd.PLAYING)}get processorDestination(){return this._processorDestination}get processorContext(){return this._processorContext}set processorContext(e){this._processorContext=e}get __className__(){return"LocalVideoTrack"}constructor(e,t,r,n,i,o){if(super(e,i),f_(this,"trackMediaType",bd.VIDEO),f_(this,"_player",void 0),f_(this,"isUseScaleResolutionDownBy",!1),f_(this,"_videoVisibleTimer",null),f_(this,"_previousVideoVisibleStatus",void 0),f_(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),f_(this,"_encoderConfig",void 0),f_(this,"_scalabilityMode",{numSpatialLayers:1,numTemporalLayers:1}),f_(this,"_optimizationMode",void 0),f_(this,"_videoHeight",void 0),f_(this,"_videoWidth",void 0),f_(this,"_forceBitrateLimit",void 0),f_(this,"_enabled",!0),f_(this,"_processorDestination",void 0),f_(this,"_processorContext",void 0),Fr()){const{width:t,height:r}=e.getSettings();this._videoWidth=t,this._videoHeight=r}else this.updateMediaStreamTrackResolution();if(this._encoderConfig=t,this._scalabilityMode=r,this._optimizationMode=n,this._hints=o||[],-1===this._hints.indexOf(Sd.SCREEN_TRACK))this.updateBitrateFromProfile();else if(function(e,t,r){const n=kr();return!(n.name!==e||!n.osVersion)&&(r?Number(n.version)>=t&&Number(n.version)<=r:Number(n.version)===t)}(Nr.CHROME,115)&&-1!==Mr().indexOf("Windows")){const t=LA(e);t&&(_i.info("local screen video track begin to inject frame"),this._mediaStreamTrack=t)}t&&-1!==this._hints.indexOf(Sd.CUSTOM_TRACK)&&this.setEncoderConfiguration(t),this._processorContext=new SA(this.getTrackId(),"local"),this._processorDestination=new gA(this.processorContext),this.bindProcessorDestinationEvents()}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e){const t=document.getElementById(e);t?e=t:(_i.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}_i.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=EI(EI(EI({},this._getDefaultPlayerConfig()),t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new DO(r):this._player=new kO(r),this._player.updateVideoTrack(this._mediaStreamTrack)),this._player.play(),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(Od.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),ii("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,_i.debug("[".concat(this.getTrackId(),"] stop video playback")))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(_i.info("[".concat(this.getTrackId(),"] start setEnabled"),e),!e){this._originMediaStreamTrack.enabled=!1;try{await On(this,gd.NEED_DISABLE_TRACK,this)}catch(e){throw _i.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}return t||(this._enabled=!1),void _i.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}this._originMediaStreamTrack.enabled=!0;try{await On(this,gd.NEED_ENABLE_TRACK,this)}catch(e){throw _i.error("[".concat(this.getTrackId(),"] setEnabled to true error"),e.toString()),e}_i.info("[".concat(this.getTrackId(),"] setEnabled to true success")),t||(this._enabled=!0)}async setMuted(e){e!==this._muted&&(this.stateCheck("muted",e),this._muted=e,this._originMediaStreamTrack.enabled=!e,_i.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),e?await On(this,gd.NEED_MUTE_TRACK,this):await On(this,gd.NEED_UNMUTE_TRACK,this))}async setEncoderConfiguration(e,t){if(!this._enabled)throw new sn(on.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");if(e=cd(e),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin),e.width||e.height||e.frameRate){const t=IA({encoderConfig:e});(Fr()||Gr()||Jr())&&(t.deviceId=void 0),_i.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(e),JSON.stringify(t));try{await this._originMediaStreamTrack.applyConstraints(t),this.updateMediaStreamTrackResolution()}catch(e){const t=new sn(on.UNEXPECTED_ERROR,e.toString());throw _i.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}}this._encoderConfig=e,-1===this._hints.indexOf(Sd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await On(this,gd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(_i)}}getStats(){kn((()=>{_i.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")}),"localVideoTrackGetStatsWarning");const e=In(this,gd.GET_STATS);return e||EI({},Dd)}async setBeautyEffect(e){_i.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 PA(e)}async setBitrateLimit(e){if(_i.debug("[".concat(this.getTrackId(),"] set bitrate limit, ").concat(JSON.stringify(e))),e){this._forceBitrateLimit=e,this._encoderConfig&&(this._encoderConfig.bitrateMax?this._encoderConfig.bitrateMax=this._encoderConfig.bitrateMax<e.max_bitrate?this._encoderConfig.bitrateMax:e.max_bitrate:this._encoderConfig.bitrateMax=e.max_bitrate,this._encoderConfig.bitrateMin,this._encoderConfig.bitrateMin=e.min_bitrate);try{await On(this,gd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(_i)}}}async setOptimizationMode(e){if("motion"!==e&&"detail"!==e&&"balanced"!==e)return void _i.error(on.INVALID_PARAMS,"optimization mode must be motion, detail or balanced");const t=this._optimizationMode;try{this._optimizationMode=e,await On(this,gd.NEED_UPDATE_VIDEO_SEND_PARAMETERS,this)}catch(e){throw this._optimizationMode=t,_i.error("[".concat(this.getTrackId(),"] set optimization mode failed"),e.toString()),e}_i.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(e,")"))}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return _i.error(on.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),void(this._scalabilityMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabilityMode=e,_i.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")"))}updateMediaStreamTrackResolution(){OA(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(xn)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}async setSenderConfiguration(e){if(!this._enabled)throw new sn(on.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");_i.debug("[".concat(this.getTrackId(),"] setSenderConfiguration applyConstraints"),JSON.stringify(e)),e=cd(e),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin),this._encoderConfig=e,-1===this._hints.indexOf(Sd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await On(this,gd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(_i)}}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}=NA(e,t,r,i,n);this._encoderConfig.bitrateMin=s,this._encoderConfig.bitrateMax=o,_i.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=fn.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Ai.reportApiInvoke(null,{tag:vn.TRACER,name:Sn.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 sn(on.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}async renewMediaStreamTrack(e){}pipe(e){if(this.processor===e)return e;if(e._source)throw new sn(on.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(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._encoderConfig;t&&(n=EI(EI({},n),cd(t))),n=Dn(n);const i=Un(8,"track-video-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,n,Dn(this._scalabilityMode),this._optimizationMode,i,Dn(this._hints));return t&&n&&o.setEncoderConfiguration(n),_i.debug("clone video track from ".concat(this.getTrackId()," to ").concat(i,", clone ").concat(r)),o}async replaceTrack(e,t){if(!(e instanceof MediaStreamTrack))throw new sn(on.INVALID_PARAMS,"track should be an instance of MediaStreamTrack");if("video"!==e.kind)throw new sn(on.INVALID_PARAMS,"track should be a video MediaStreamTrack");await this._updateOriginMediaStreamTrack(e,t,!0),this.updateMediaStreamTrackResolution()}sendSeiData(e){if(kn((()=>{Ai.reportApiInvoke(null,{name:Sn.LOCAL_VIDEO_SEND_SEI_DATA,options:[],tag:vn.TRACER}).onSuccess("")}),this._mediaStreamTrack.id||this.getTrackId()),!ii("ENABLE_VIDEO_SEI")||!ii("ENABLE_ENCODED_TRANSFORM"))return void _i.warning('To send/receive SEI, please call AgoraRTC.setParameter("ENABLE_VIDEO_SEI", true) before instantiate IAgoraRtcClient');if(e instanceof Uint8Array==!1)return new sn(on.INVALID_PARAMS,"Invalid argument type, ILocalVideoTrack.sendSeiData() only accept Uint8Array argument.").throw();const t=this.getRTCRtpTransceiver();if(!t)return void _i.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):_i.warning("SEI is not supported by ".concat(n))}bindProcessorDestinationEvents(){this.processorDestination.on(Ld.ON_TRACK,(async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await On(this,gd.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await On(this,gd.NEED_REPLACE_TRACK,this))}))}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(Ld.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(Md.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(Md.REQUEST_CONSTRAINTS)}},gT(iI.prototype,"play",[LO,MO],Object.getOwnPropertyDescriptor(iI.prototype,"play"),iI.prototype),gT(iI.prototype,"stop",[UO],Object.getOwnPropertyDescriptor(iI.prototype,"stop"),iI.prototype),gT(iI.prototype,"setEnabled",[xO,VO,FO],Object.getOwnPropertyDescriptor(iI.prototype,"setEnabled"),iI.prototype),gT(iI.prototype,"setMuted",[BO,jO,GO],Object.getOwnPropertyDescriptor(iI.prototype,"setMuted"),iI.prototype),gT(iI.prototype,"setEncoderConfiguration",[WO,HO],Object.getOwnPropertyDescriptor(iI.prototype,"setEncoderConfiguration"),iI.prototype),gT(iI.prototype,"getStats",[KO],Object.getOwnPropertyDescriptor(iI.prototype,"getStats"),iI.prototype),gT(iI.prototype,"setBeautyEffect",[YO,zO],Object.getOwnPropertyDescriptor(iI.prototype,"setBeautyEffect"),iI.prototype),gT(iI.prototype,"getCurrentFrameData",[XO],Object.getOwnPropertyDescriptor(iI.prototype,"getCurrentFrameData"),iI.prototype),gT(iI.prototype,"getCurrentFrameImage",[JO],Object.getOwnPropertyDescriptor(iI.prototype,"getCurrentFrameImage"),iI.prototype),gT(iI.prototype,"setBitrateLimit",[qO],Object.getOwnPropertyDescriptor(iI.prototype,"setBitrateLimit"),iI.prototype),gT(iI.prototype,"setOptimizationMode",[QO],Object.getOwnPropertyDescriptor(iI.prototype,"setOptimizationMode"),iI.prototype),gT(iI.prototype,"setScalabiltyMode",[ZO],Object.getOwnPropertyDescriptor(iI.prototype,"setScalabiltyMode"),iI.prototype),gT(iI.prototype,"updateMediaStreamTrackResolution",[$O],Object.getOwnPropertyDescriptor(iI.prototype,"updateMediaStreamTrackResolution"),iI.prototype),gT(iI.prototype,"pipe",[eI],Object.getOwnPropertyDescriptor(iI.prototype,"pipe"),iI.prototype),gT(iI.prototype,"unpipe",[tI],Object.getOwnPropertyDescriptor(iI.prototype,"unpipe"),iI.prototype),gT(iI.prototype,"close",[rI],Object.getOwnPropertyDescriptor(iI.prototype,"close"),iI.prototype),gT(iI.prototype,"replaceTrack",[nI],Object.getOwnPropertyDescriptor(iI.prototype,"replaceTrack"),iI.prototype),iI),_I=(oI=yi({argsMap:(e,t)=>[e.getTrackId(),t]}),sI=cA(),aI=Yn("CameraVideoTrack","_enabledMutex"),cI=yi({argsMap:(e,t)=>[e.getTrackId(),t]}),dI=cA(),uI=yi({argsMap:(e,t)=>[e.getTrackId(),t]}),lI=cA(),pI=yi({argsMap:e=>[e.getTrackId()]}),hI=class e extends mI{get __className__(){return"CameraVideoTrack"}constructor(e,t,r,n,i,o){super(e,cd(t.encoderConfig),n,i,o),f_(this,"_config",void 0),f_(this,"_originalConstraints",void 0),f_(this,"_constraints",void 0),f_(this,"_enabled",!0),f_(this,"_deviceName","default"),f_(this,"tryResumeVideoForIOS15_16WeChat",(async()=>{!Yr()&&!zr()||function(){const e=kr();if(e.os!==Cr.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}()||kr().name!==Nr.WECHAT||!this._enabled||this._isClosed||(_i.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS 15 device on WeChat.")),await this.renewMediaStreamTrack())})),this._config=t,this._originalConstraints=r,this._constraints=r,this._deviceName=e.label,this._encoderConfig=cd(this._config.encoderConfig),wy.on(Ni.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),wy.on(Ni.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(_i.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),this._enabled)try{const t=await $y.getDeviceById(e),r={};r.video=EI({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let n=null;try{n=await Xy(r,this.getTrackId())}catch(e){throw _i.error("[".concat(this.getTrackId(),"] setDevice failed"),e.toString()),n=await Xy({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 _i.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}else try{const t=await $y.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(e){throw _i.error("[".concat(this.getTrackId(),"] setDevice error"),e.toString()),e}_i.info("[".concat(this.getTrackId(),"] setDevice success"))}async _setDeviceByFacingModel(e){_i.info("[".concat(this.getTrackId(),"] set facingMode ").concat(e));const t={video:EI(EI({},this._constraints),{},{deviceId:void 0,facingMode:{exact:e}})};if(this._enabled){this._originMediaStreamTrack.stop();let e=null;try{e=await Xy(t,this.getTrackId())}catch(t){throw _i.error("[".concat(this.getTrackId(),"] setDeviceByFacingModel failed"),t.toString()),e=await Xy({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=EI({},t.video),_i.info("[".concat(this.getTrackId(),"] setDeviceByFacingModel success"))}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(_i.info("[".concat(this.getTrackId(),"] start setEnabled"),e),e){try{if(this.isExternalTrack)this._originMediaStreamTrack.enabled=!0;else{const e=await Xy({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1)}await On(this,gd.NEED_ENABLE_TRACK,this)}catch(e){throw _i.error("[".concat(this.getTrackId(),"] setEnabled true error"),e.toString()),e}this.updateMediaStreamTrackResolution(),_i.info("[".concat(this.getTrackId(),"] setEnabled to true success")),t||(this._enabled=!0)}else{this.isExternalTrack?this._originMediaStreamTrack.enabled=!1:(this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop()),t||(this._enabled=!1);try{await On(this,gd.NEED_DISABLE_TRACK,this)}catch(e){throw _i.error("[".concat(this.getTrackId(),"] setEnabled to false error"),e.toString()),e}_i.info("[".concat(this.getTrackId(),"] setEnabled to false success"))}}async setEncoderConfiguration(e,t){if(!this._enabled)throw new sn(on.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");e=cd(e),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate||e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate||e.bitrateMin);const r=wn(this._config);r.encoderConfig=e;const n=IA(r);(Fr()||Gr()||Jr())&&(n.deviceId=void 0),_i.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(e),JSON.stringify(n));try{await this._originMediaStreamTrack.applyConstraints(n),this.updateMediaStreamTrackResolution()}catch(e){const t=new sn(on.UNEXPECTED_ERROR,e.toString());throw _i.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),t}this._config=r,this._constraints=n,this._originalConstraints=n,this._encoderConfig=e,-1===this._hints.indexOf(Sd.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await On(this,gd.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw(_i)}}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((Gr()||Jr())&&this._enabled&&!this._isClosed&&wy.duringInterruption){const e=async()=>{wy.off(Ni.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(_i.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),await this.setEnabled(!1),await this.setEnabled(!0))};wy.on(Ni.IOS_INTERRUPTION_END,e)}else _i.debug("[".concat(this.getTrackId(),"] track ended")),this.safeEmit(Od.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=$y.searchDeviceIdByName(this._deviceName);if(r&&!t.deviceId&&(t.deviceId={exact:r}),this._enabled){const e=await Xy({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}}close(){super.close(),wy.off(Ni.IOS_15_16_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat),wy.off(Ni.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15_16WeChat)}clone(t){let r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this._encoderConfig;t&&(n=EI(EI({},n),cd(t))),n=Dn(n);const i=Un(8,"track-cam-cloned-"),o=new e(r?this._mediaStreamTrack.clone():this._mediaStreamTrack,Dn(EI(EI({},this._config),{},{encoderConfig:n})),Dn(this._constraints),Dn(this._scalabilityMode),this._optimizationMode,i);return t&&n&&o.setEncoderConfiguration(n),_i.debug("clone track from ".concat(this.getTrackId()," to ").concat(i,", clone ").concat(r)),o}bindProcessorContextEvents(){this.processorContext.on(Md.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(Md.REQUEST_CONSTRAINTS,(async e=>{e(this._originMediaStreamTrack.getSettings())}))}},gT(hI.prototype,"setDevice",[oI,sI],Object.getOwnPropertyDescriptor(hI.prototype,"setDevice"),hI.prototype),gT(hI.prototype,"setEnabled",[aI,cI,dI],Object.getOwnPropertyDescriptor(hI.prototype,"setEnabled"),hI.prototype),gT(hI.prototype,"setEncoderConfiguration",[uI,lI],Object.getOwnPropertyDescriptor(hI.prototype,"setEncoderConfiguration"),hI.prototype),gT(hI.prototype,"close",[pI],Object.getOwnPropertyDescriptor(hI.prototype,"close"),hI.prototype),hI);function TI(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 gI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?TI(Object(r),!0).forEach((function(t){f_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):TI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function SI(e,t,r,n){r.optimizationMode&&(n&&n.width&&n.height?(r.encoderConfig=gI(gI({},n),{},{bitrateMin:n.bitrateMin,bitrateMax:n.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?_i.debug("[".concat(e,"] set content hint to"),r.optimizationMode):_i.debug("[".concat(e,"] set content hint failed")))):_i.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")))}var vI,RI,yI,AI,OI,II,bI,CI,NI,wI,DI,PI;function kI(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 LI(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?kI(Object(r),!0).forEach((function(t){f_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):kI(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class MI extends Oy{getUserId(){return this._userId}constructor(e,t,r,n){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(n.clientId,"_").concat(Un(5,""))),f_(this,"_userId",void 0),f_(this,"_uintId",void 0),f_(this,"_isDestroyed",!1),f_(this,"store",void 0),f_(this,"processor",void 0),f_(this,"processorContext",void 0),this._userId=t,this._uintId=r,this.store=n}_updateOriginMediaStreamTrack(e){this._originMediaStreamTrack=e,this._mediaStreamTrack=e,this._updatePlayerSource(),this.processor&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this.processorContext})}_destroy(){this._isDestroyed=!0,_i.info("[".concat(this.getTrackId(),"] is destroyed")),this.stop(),super.close()}getProcessorStats(){return this.processorContext.gatherStats()}getProcessorUsage(){return this.processorContext.gatherUsage()}}let UI=(vI=yi({argsMap:(e,t,r)=>[e.getTrackId(),"string"==typeof t?t:t instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement",r]}),RI=yi({argsMap:e=>[e.getTrackId()]}),yI=yi({argsMap:(e,t)=>[e.getTrackId(),t.name]}),AI=yi({argsMap:e=>[e.getTrackId()]}),OI=class extends MI{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==Vd.PLAYING)}get __className__(){return"RemoteVideoTrack"}constructor(e,t,r,n){super(e,t,r,n),f_(this,"_videoVisibleTimer",null),f_(this,"_previousVideoVisibleStatus",void 0),f_(this,"_clearPreviousVideoVisibleStatus",(()=>this._previousVideoVisibleStatus=void 0)),f_(this,"trackMediaType",bd.VIDEO),f_(this,"_videoWidth",void 0),f_(this,"_videoHeight",void 0),f_(this,"_player",void 0),f_(this,"processorDestination",void 0),f_(this,"processorContext",void 0),this.updateMediaStreamTrackResolution(),this.processorContext=new SA(this.getTrackId(),"remote"),this.processorDestination=new gA(this.processorContext),this.bindProcessorDestinationEvents()}getStats(){kn((()=>{_i.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")}),"remoteVideoTrackGetStatsWarning");return In(this,gd.GET_STATS)||LI({},kd)}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if("string"==typeof e){const t=document.getElementById(e);t?e=t:(_i.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),e=document.body)}_i.debug("[".concat(this.getTrackId(),"] start video playback in ").concat(e instanceof HTMLVideoElement?"HTMLVideoElement":"HTMLElement"),JSON.stringify(t));const r=LI(LI({fit:"cover"},t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(r):(e instanceof HTMLVideoElement?this._player=new DO(r):this._player=new kO(r),this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,Date.now()),this.safeEmit(Id.FIRST_FRAME_DECODED)},this._player.onVideoStateChanged=e=>{this.safeEmit(Id.VIDEO_STATE_CHANGED,e)}),this._player.play(this.store.sessionId||void 0),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval((()=>{try{const e=this.getVideoElementVisibleStatus();this.safeEmit(Id.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}}),ii("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,_i.debug("[".concat(this.getTrackId(),"] stop video playback")))}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){OA(this._originMediaStreamTrack).then((e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t})).catch(xn)}_updatePlayerSource(){_i.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=fn.checkOneElementVisible(i),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=Ai.reportApiInvoke(null,{tag:vn.TRACER,name:Sn.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 sn(on.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}pipe(e){if(this.processor===e)return e;if(e._source)throw new sn(on.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(Ld.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(Ld.ON_TRACK)}_destroy(){super._destroy(),this.unbindProcessorDestinationEvents()}_onSei(e){this.emit(Ad.SEI_RECEIVED,e)}},gT(OI.prototype,"play",[vI],Object.getOwnPropertyDescriptor(OI.prototype,"play"),OI.prototype),gT(OI.prototype,"stop",[RI],Object.getOwnPropertyDescriptor(OI.prototype,"stop"),OI.prototype),gT(OI.prototype,"pipe",[yI],Object.getOwnPropertyDescriptor(OI.prototype,"pipe"),OI.prototype),gT(OI.prototype,"unpipe",[AI],Object.getOwnPropertyDescriptor(OI.prototype,"unpipe"),OI.prototype),OI),xI=(II=yi({argsMap:(e,t)=>[e.getTrackId(),t],throttleTime:300}),bI=yi({argsMap:(e,t)=>[e.getTrackId(),t]}),CI=yi({argsMap:e=>[e.getTrackId()]}),NI=yi({argsMap:e=>[e.getTrackId()]}),wI=yi({argsMap:(e,t)=>[e.getTrackId(),t.name]}),DI=yi({argsMap:e=>[e.getTrackId()]}),PI=class extends MI{get isPlaying(){return this._useAudioElement?aA.isPlaying(this.getTrackId()):this._source.isPlayed}get __className__(){return"RemoteAudioTrack"}constructor(e,t,r,n){super(e,t,r,n),f_(this,"trackMediaType",bd.AUDIO),f_(this,"_source",void 0),f_(this,"_useAudioElement",!0),f_(this,"_volume",100),f_(this,"processorContext",void 0),f_(this,"processorDestination",void 0),f_(this,"_played",!1),f_(this,"_bypassWebAudio",!1),ii("DISABLE_WEBAUDIO")?(this._source=new yA,this._bypassWebAudio=!0,this._useAudioElement=!0):(this._source=new Gy(e,!0),ii("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1)),this._source.once(Cd.RECEIVE_TRACK_BUFFER,(()=>{this.safeEmit(Id.FIRST_FRAME_DECODED)})),this.processorContext=new RA(this._source.context,this.getTrackId(),"remote"),this.processorDestination=new vA(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(Cd.UPDATE_SOURCE,(()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:this.processorContext})}))}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(Cd.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Cd.ON_AUDIO_BUFFER),this._source.on(Cd.ON_AUDIO_BUFFER,(t=>e(t)))}setVolume(e){this._volume=e,this._useAudioElement?aA.setVolume(this.getTrackId(),e):this._source.setVolume(e/100)}async setPlaybackDevice(e){if(!this._useAudioElement||!Ci())throw new sn(on.NOT_SUPPORTED,"your browser does not support setting the audio output device");await aA.setSinkID(this.getTrackId(),e)}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getStats(){kn((()=>{_i.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")}),"remoteAudioTrackGetStatsWarning");return In(this,gd.GET_STATS)||LI({},Pd)}play(){_i.debug("[".concat(this.getTrackId(),"] start audio playback")),this._played=!0,this._useAudioElement?(_i.debug("[".concat(this.getTrackId(),"] use audio element to play")),aA.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):this._source.play()}stop(){_i.debug("[".concat(this.getTrackId(),"] stop audio playback")),this._played=!1,this._useAudioElement?aA.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];_i.debug("[".concat(this.getTrackId(),"] update player source track")),e&&this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&aA.updateTrack(this.getTrackId(),this._mediaStreamTrack)}pipe(e){if(this._bypassWebAudio)throw new sn(on.NOT_SUPPORTED,"can not pipe extension when WebAudio disabled");if(this.processor===e)return e;if(e._source)throw new sn(on.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 sn(on.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(Ld.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(Ld.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(Ld.ON_TRACK),this.processorDestination.removeAllListeners(Ld.ON_NODE)}},gT(PI.prototype,"setVolume",[II],Object.getOwnPropertyDescriptor(PI.prototype,"setVolume"),PI.prototype),gT(PI.prototype,"setPlaybackDevice",[bI],Object.getOwnPropertyDescriptor(PI.prototype,"setPlaybackDevice"),PI.prototype),gT(PI.prototype,"play",[CI],Object.getOwnPropertyDescriptor(PI.prototype,"play"),PI.prototype),gT(PI.prototype,"stop",[NI],Object.getOwnPropertyDescriptor(PI.prototype,"stop"),PI.prototype),gT(PI.prototype,"pipe",[wI],Object.getOwnPropertyDescriptor(PI.prototype,"pipe"),PI.prototype),gT(PI.prototype,"unpipe",[DI],Object.getOwnPropertyDescriptor(PI.prototype,"unpipe"),PI.prototype),PI);const VI=new class extends mn{get visibility(){return document.visibilityState}get lastHiddenTime(){return this._lastHiddenTime}get lastVisibleTime(){return this._lastVisibleTime}constructor(){super(),f_(this,"_lastHiddenTime",0),f_(this,"_lastVisibleTime",0),document.addEventListener("visibilitychange",(()=>{"hidden"===document.visibilityState?this._lastHiddenTime=performance.now():this._lastVisibleTime=performance.now(),_i.debug("document visibility went ".concat(document.visibilityState)),this.emit("VISIBILITY_CHANGE",document.visibilityState)}))}};class FI extends mn{constructor(e,t){super(),f_(this,"trackMediaType",bd.DATA),f_(this,"_version",1),f_(this,"_type",3),f_(this,"_config",void 0),f_(this,"_originDataChannel",void 0),f_(this,"_dataStreamPacketHeader",new ArrayBuffer(4)),f_(this,"_dataStreamPacketHandler",{serialize:e=>e,deserialize:e=>e}),f_(this,"_datachannelEventMap",new Map),this._config=e,t&&(this._originDataChannel=t,this._bandDataChannelEvents(t)),this._initPacketHeader()}useDataStream(e){this._dataStreamPacketHandler=e}get id(){return this._config.id}get ordered(){return this._config.ordered}get maxRetransmits(){return ii("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 Ay(((e,t)=>{if(this._originDataChannel){"open"===this._originDataChannel.readyState&&e();const r=setTimeout((()=>{var e;t(new sn(on.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 sn(on.DATACHANNEL_CONNECTION_TIMEOUT)}}else t(new sn(on.DATACHANNEL_CONNECTION_TIMEOUT,"cannot find dataChannel"))}))}_updateOriginDataChannel(e){this._originDataChannel=e,this._bandDataChannelEvents(e)}_initPacketHeader(){const e=new DataView(this._dataStreamPacketHeader);e.setUint16(0,this._version),e.setUint8(2,this._type),e.setUint8(3,this._config.id)}_bandDataChannelEvents(e){this._unbindDataChannelEvents(e),[Bd.OPEN,Bd.CLOSE,Bd.ERROR].forEach((t=>{const r=()=>{this.emit(t)};this._datachannelEventMap.set(t,r),e.addEventListener(t,r)}))}_unbindDataChannelEvents(e){Array.from(this._datachannelEventMap.entries()).forEach((t=>{let[r,n]=t;e.removeEventListener(r,n)})),this._datachannelEventMap.clear()}}var BI=wi,jI=Bs("iterator"),GI=!BI((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[jI]||"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})),WI=Hl,HI=Ul,KI=Math.floor,YI=function(e,t){var r=e.length,n=KI(r/2);return r<8?zI(e,t):XI(e,YI(HI(e,0,n),t),YI(HI(e,n),t),t)},zI=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},XI=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},JI=rc,qI=Fi,QI=so,ZI=Ui,$I=no,eb=GI,tb=Hl,rb=Yl,nb=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:WI(e,n,t[n],r);return e},ib=mp,ob=NE,sb=Pp,ab=Zg,cb=to,db=Is,ub=Aa,lb=xc,pb=wa,hb=No,fb=Bc,Eb=Il,mb=fo,_b=og,Tb=ZT,gb=cS,Sb=YI,vb=Bs("iterator"),Rb="URLSearchParams",yb=Rb+"Iterator",Ab=sb.set,Ob=sb.getterFor(Rb),Ib=sb.getterFor(yb),bb=Object.getOwnPropertyDescriptor,Cb=function(e){if(!$I)return qI[e];var t=bb(qI,e);return t&&t.value},Nb=Cb("fetch"),wb=Cb("Request"),Db=Cb("Headers"),Pb=wb&&wb.prototype,kb=Db&&Db.prototype,Lb=qI.RegExp,Mb=qI.TypeError,Ub=qI.decodeURIComponent,xb=qI.encodeURIComponent,Vb=ZI("".charAt),Fb=ZI([].join),Bb=ZI([].push),jb=ZI("".replace),Gb=ZI([].shift),Wb=ZI([].splice),Hb=ZI("".split),Kb=ZI("".slice),Yb=/\+/g,zb=Array(4),Xb=function(e){return zb[e-1]||(zb[e-1]=Lb("((?:%[\\da-f]{2}){"+e+"})","gi"))},Jb=function(e){try{return Ub(e)}catch(t){return e}},qb=function(e){var t=jb(e,Yb," "),r=4;try{return Ub(t)}catch(e){for(;r;)t=jb(t,Xb(r--),Jb);return t}},Qb=/[!'()~]|%20/g,Zb={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},$b=function(e){return Zb[e]},eC=function(e){return jb(xb(e),Qb,$b)},tC=ob((function(e,t){Ab(this,{type:yb,iterator:_b(Ob(e).entries),kind:t})}),"Iterator",(function(){var e=Ib(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),rC=function(e){this.entries=[],this.url=null,void 0!==e&&(hb(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===Vb(e,0)?Kb(e,1):e:fb(e)))};rC.prototype={type:Rb,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,s,a,c=Tb(e);if(c)for(r=(t=_b(e,c)).next;!(n=QI(r,t)).done;){if(o=(i=_b(pb(n.value))).next,(s=QI(o,i)).done||(a=QI(o,i)).done||!QI(o,i).done)throw Mb("Expected sequence with length 2");Bb(this.entries,{key:fb(s.value),value:fb(a.value)})}else for(var d in e)db(e,d)&&Bb(this.entries,{key:d,value:fb(e[d])})},parseQuery:function(e){if(e)for(var t,r,n=Hb(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=Hb(t,"="),Bb(this.entries,{key:qb(Gb(r)),value:qb(Fb(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],Bb(r,eC(e.key)+"="+eC(e.value));return Fb(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var nC=function(){ab(this,iC);var e=Ab(this,new rC(arguments.length>0?arguments[0]:void 0));$I||(this.size=e.entries.length)},iC=nC.prototype;if(nb(iC,{append:function(e,t){var r=Ob(this);gb(arguments.length,2),Bb(r.entries,{key:fb(e),value:fb(t)}),$I||this.length++,r.updateURL()},delete:function(e){for(var t=Ob(this),r=gb(arguments.length,1),n=t.entries,i=fb(e),o=r<2?void 0:arguments[1],s=void 0===o?o:fb(o),a=0;a<n.length;){var c=n[a];if(c.key!==i||void 0!==s&&c.value!==s)a++;else if(Wb(n,a,1),void 0!==s)break}$I||(this.size=n.length),t.updateURL()},get:function(e){var t=Ob(this).entries;gb(arguments.length,1);for(var r=fb(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){var t=Ob(this).entries;gb(arguments.length,1);for(var r=fb(e),n=[],i=0;i<t.length;i++)t[i].key===r&&Bb(n,t[i].value);return n},has:function(e){for(var t=Ob(this).entries,r=gb(arguments.length,1),n=fb(e),i=r<2?void 0:arguments[1],o=void 0===i?i:fb(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=Ob(this);gb(arguments.length,1);for(var n,i=r.entries,o=!1,s=fb(e),a=fb(t),c=0;c<i.length;c++)(n=i[c]).key===s&&(o?Wb(i,c--,1):(o=!0,n.value=a));o||Bb(i,{key:s,value:a}),$I||(this.size=i.length),r.updateURL()},sort:function(){var e=Ob(this);Sb(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=Ob(this).entries,n=ub(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 tC(this,"keys")},values:function(){return new tC(this,"values")},entries:function(){return new tC(this,"entries")}},{enumerable:!0}),tb(iC,vb,iC.entries,{name:"entries"}),tb(iC,"toString",(function(){return Ob(this).serialize()}),{enumerable:!0}),$I&&rb(iC,"size",{get:function(){return Ob(this).entries.length},configurable:!0,enumerable:!0}),ib(nC,Rb),JI({global:!0,constructor:!0,forced:!eb},{URLSearchParams:nC}),!eb&&cb(Db)){var oC=ZI(kb.has),sC=ZI(kb.set),aC=function(e){if(hb(e)){var t,r=e.body;if(lb(r)===Rb)return t=e.headers?new Db(e.headers):new Db,oC(t,"content-type")||sC(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),Eb(e,{body:mb(0,fb(r)),headers:mb(0,t)})}return e};if(cb(Nb)&&JI({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return Nb(e,arguments.length>1?aC(arguments[1]):{})}}),cb(wb)){var cC=function(e){return ab(this,Pb),new wb(e,arguments.length>1?aC(arguments[1]):{})};Pb.constructor=cC,cC.prototype=Pb,JI({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:cC})}}var dC,uC={URLSearchParams:nC,getState:Ob},lC=no,pC=Ui,hC=so,fC=wi,EC=tl,mC=Gl,_C=ao,TC=ys,gC=go,SC=Object.assign,vC=Object.defineProperty,RC=pC([].concat),yC=!SC||fC((function(){if(lC&&1!==SC({b:1},SC(vC({},"a",{enumerable:!0,get:function(){vC(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!=SC({},e)[r]||EC(SC({},t)).join("")!=n}))?function(e,t){for(var r=TC(e),n=arguments.length,i=1,o=mC.f,s=_C.f;n>i;)for(var a,c=gC(arguments[i++]),d=o?RC(EC(c),o(c)):EC(c),u=d.length,l=0;u>l;)a=d[l++],lC&&!hC(s,c,a)||(r[a]=c[a]);return r}:SC,AC=wa,OC=dg,IC=Aa,bC=so,CC=ys,NC=function(e,t,r,n){try{return n?t(AC(r)[0],r[1]):t(r)}catch(t){OC(e,"throw",t)}},wC=YT,DC=Tu,PC=fc,kC=eu,LC=og,MC=ZT,UC=Array,xC=Ui,VC=2147483647,FC=/[^\0-\u007E]/,BC=/[.\u3002\uFF0E\uFF61]/g,jC="Overflow: input needs wider integers to process",GC=RangeError,WC=xC(BC.exec),HC=Math.floor,KC=String.fromCharCode,YC=xC("".charCodeAt),zC=xC([].join),XC=xC([].push),JC=xC("".replace),qC=xC("".split),QC=xC("".toLowerCase),ZC=function(e){return e+22+75*(e<26)},$C=function(e,t,r){var n=0;for(e=r?HC(e/700):e>>1,e+=HC(e/t);e>455;)e=HC(e/35),n+=36;return HC(n+36*e/(e+38))},eN=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=YC(e,r++);if(i>=55296&&i<=56319&&r<n){var o=YC(e,r++);56320==(64512&o)?XC(t,((1023&i)<<10)+(1023&o)+65536):(XC(t,i),r--)}else XC(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&&XC(t,KC(n));var c=t.length,d=c;for(c&&XC(t,"-");d<i;){var u=VC;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<u&&(u=n);var l=d+1;if(u-o>HC((VC-s)/l))throw GC(jC);for(s+=(u-o)*l,o=u,r=0;r<e.length;r++){if((n=e[r])<o&&++s>VC)throw GC(jC);if(n==o){for(var p=s,h=36;;){var f=h<=a?1:h>=a+26?26:h-a;if(p<f)break;var E=p-f,m=36-f;XC(t,KC(ZC(f+E%m))),p=HC(E/m),h+=36}XC(t,KC(ZC(p))),a=$C(s,l,d==c),s=0,d++}}s++,o++}return zC(t,"")},tN=rc,rN=no,nN=GI,iN=Fi,oN=Aa,sN=Ui,aN=Hl,cN=Yl,dN=Zg,uN=Is,lN=yC,pN=function(e){var t=CC(e),r=DC(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=IC(i,n>2?arguments[2]:void 0));var s,a,c,d,u,l,p=MC(t),h=0;if(!p||this===UC&&wC(p))for(s=PC(t),a=r?new this(s):UC(s);s>h;h++)l=o?i(t[h],h):t[h],kC(a,h,l);else for(u=(d=LC(t,p)).next,a=r?new this:[];!(c=bC(u,d)).done;h++)l=o?NC(d,i,[c.value,h],!0):c.value,kC(a,h,l);return a.length=h,a},hN=Ul,fN=t_.codeAt,EN=function(e){var t,r,n=[],i=qC(JC(QC(e),BC,"."),".");for(t=0;t<i.length;t++)r=i[t],XC(n,WC(FC,r)?"xn--"+eN(r):r);return zC(n,".")},mN=Bc,_N=mp,TN=cS,gN=uC,SN=Pp,vN=SN.set,RN=SN.getterFor("URL"),yN=gN.URLSearchParams,AN=gN.getState,ON=iN.URL,IN=iN.TypeError,bN=iN.parseInt,CN=Math.floor,NN=Math.pow,wN=sN("".charAt),DN=sN(/./.exec),PN=sN([].join),kN=sN(1..toString),LN=sN([].pop),MN=sN([].push),UN=sN("".replace),xN=sN([].shift),VN=sN("".split),FN=sN("".slice),BN=sN("".toLowerCase),jN=sN([].unshift),GN="Invalid scheme",WN="Invalid host",HN="Invalid port",KN=/[a-z]/i,YN=/[\d+-.a-z]/i,zN=/\d/,XN=/^0x/i,JN=/^[0-7]+$/,qN=/^\d+$/,QN=/^[\da-f]+$/i,ZN=/[\0\t\n\r #%/:<>?@[\\\]^|]/,$N=/[\0\t\n\r #/:<>?@[\\\]^|]/,ew=/^[\u0000-\u0020]+/,tw=/(^|[^\u0000-\u0020])[\u0000-\u0020]+$/,rw=/[\t\n\r]/g,nw=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)jN(t,e%256),e=CN(e/256);return PN(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+=kN(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},iw={},ow=lN({},iw,{" ":1,'"':1,"<":1,">":1,"`":1}),sw=lN({},ow,{"#":1,"?":1,"{":1,"}":1}),aw=lN({},sw,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),cw=function(e,t){var r=fN(e,0);return r>32&&r<127&&!uN(t,e)?e:encodeURIComponent(e)},dw={ftp:21,file:null,http:80,https:443,ws:80,wss:443},uw=function(e,t){var r;return 2==e.length&&DN(KN,wN(e,0))&&(":"==(r=wN(e,1))||!t&&"|"==r)},lw=function(e){var t;return e.length>1&&uw(FN(e,0,2))&&(2==e.length||"/"===(t=wN(e,2))||"\\"===t||"?"===t||"#"===t)},pw=function(e){return"."===e||"%2e"===BN(e)},hw={},fw={},Ew={},mw={},_w={},Tw={},gw={},Sw={},vw={},Rw={},yw={},Aw={},Ow={},Iw={},bw={},Cw={},Nw={},ww={},Dw={},Pw={},kw={},Lw=function(e,t,r){var n,i,o,s=mN(e);if(t){if(i=this.parse(s))throw IN(i);this.searchParams=null}else{if(void 0!==r&&(n=new Lw(r,!0)),i=this.parse(s,null,n))throw IN(i);(o=AN(new yN)).bindURL(this),this.searchParams=o}};Lw.prototype={type:"URL",parse:function(e,t,r){var n,i,o,s,a,c=this,d=t||hw,u=0,l="",p=!1,h=!1,f=!1;for(e=mN(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=UN(e,ew,""),e=UN(e,tw,"$1")),e=UN(e,rw,""),n=pN(e);u<=n.length;){switch(i=n[u],d){case hw:if(!i||!DN(KN,i)){if(t)return GN;d=Ew;continue}l+=BN(i),d=fw;break;case fw:if(i&&(DN(YN,i)||"+"==i||"-"==i||"."==i))l+=BN(i);else{if(":"!=i){if(t)return GN;l="",d=Ew,u=0;continue}if(t&&(c.isSpecial()!=uN(dw,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&dw[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?d=Iw:c.isSpecial()&&r&&r.scheme==c.scheme?d=mw:c.isSpecial()?d=Sw:"/"==n[u+1]?(d=_w,u++):(c.cannotBeABaseURL=!0,MN(c.path,""),d=Dw)}break;case Ew:if(!r||r.cannotBeABaseURL&&"#"!=i)return GN;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=hN(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,d=kw;break}d="file"==r.scheme?Iw:Tw;continue;case mw:if("/"!=i||"/"!=n[u+1]){d=Tw;continue}d=vw,u++;break;case _w:if("/"==i){d=Rw;break}d=ww;continue;case Tw:if(c.scheme=r.scheme,i==dC)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=hN(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())d=gw;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=hN(r.path),c.query="",d=Pw;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=hN(r.path),c.path.length--,d=ww;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=hN(r.path),c.query=r.query,c.fragment="",d=kw}break;case gw:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,d=ww;continue}d=Rw}else d=vw;break;case Sw:if(d=vw,"/"!=i||"/"!=wN(l,u+1))continue;u++;break;case vw:if("/"!=i&&"\\"!=i){d=Rw;continue}break;case Rw:if("@"==i){p&&(l="%40"+l),p=!0,o=pN(l);for(var E=0;E<o.length;E++){var m=o[E];if(":"!=m||f){var _=cw(m,aw);f?c.password+=_:c.username+=_}else f=!0}l=""}else if(i==dC||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(p&&""==l)return"Invalid authority";u-=pN(l).length+1,l="",d=yw}else l+=i;break;case yw:case Aw:if(t&&"file"==c.scheme){d=Cw;continue}if(":"!=i||h){if(i==dC||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return WN;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(l))return s;if(l="",d=Nw,t)return;continue}"["==i?h=!0:"]"==i&&(h=!1),l+=i}else{if(""==l)return WN;if(s=c.parseHost(l))return s;if(l="",d=Ow,t==Aw)return}break;case Ow:if(!DN(zN,i)){if(i==dC||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var T=bN(l,10);if(T>65535)return HN;c.port=c.isSpecial()&&T===dw[c.scheme]?null:T,l=""}if(t)return;d=Nw;continue}return HN}l+=i;break;case Iw:if(c.scheme="file","/"==i||"\\"==i)d=bw;else{if(!r||"file"!=r.scheme){d=ww;continue}if(i==dC)c.host=r.host,c.path=hN(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=hN(r.path),c.query="",d=Pw;else{if("#"!=i){lw(PN(hN(n,u),""))||(c.host=r.host,c.path=hN(r.path),c.shortenPath()),d=ww;continue}c.host=r.host,c.path=hN(r.path),c.query=r.query,c.fragment="",d=kw}}break;case bw:if("/"==i||"\\"==i){d=Cw;break}r&&"file"==r.scheme&&!lw(PN(hN(n,u),""))&&(uw(r.path[0],!0)?MN(c.path,r.path[0]):c.host=r.host),d=ww;continue;case Cw:if(i==dC||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&uw(l))d=ww;else if(""==l){if(c.host="",t)return;d=Nw}else{if(s=c.parseHost(l))return s;if("localhost"==c.host&&(c.host=""),t)return;l="",d=Nw}continue}l+=i;break;case Nw:if(c.isSpecial()){if(d=ww,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=dC&&(d=ww,"/"!=i))continue}else c.fragment="",d=kw;else c.query="",d=Pw;break;case ww:if(i==dC||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(a=BN(a=l))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||MN(c.path,"")):pw(l)?"/"==i||"\\"==i&&c.isSpecial()||MN(c.path,""):("file"==c.scheme&&!c.path.length&&uw(l)&&(c.host&&(c.host=""),l=wN(l,0)+":"),MN(c.path,l)),l="","file"==c.scheme&&(i==dC||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)xN(c.path);"?"==i?(c.query="",d=Pw):"#"==i&&(c.fragment="",d=kw)}else l+=cw(i,sw);break;case Dw:"?"==i?(c.query="",d=Pw):"#"==i?(c.fragment="",d=kw):i!=dC&&(c.path[0]+=cw(i,iw));break;case Pw:t||"#"!=i?i!=dC&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":cw(i,iw)):(c.fragment="",d=kw);break;case kw:i!=dC&&(c.fragment+=cw(i,ow))}u++}},parseHost:function(e){var t,r,n;if("["==wN(e,0)){if("]"!=wN(e,e.length-1))return WN;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,p=function(){return wN(e,l)};if(":"==p()){if(":"!=wN(e,1))return;l+=2,u=++d}for(;p();){if(8==d)return;if(":"!=p()){for(t=r=0;r<4&&DN(QN,p());)t=16*t+bN(p(),16),l++,r++;if("."==p()){if(0==r)return;if(l-=r,d>6)return;for(n=0;p();){if(i=null,n>0){if(!("."==p()&&n<4))return;l++}if(!DN(zN,p()))return;for(;DN(zN,p());){if(o=bN(p(),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(":"==p()){if(l++,!p())return}else if(p())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}(FN(e,1,-1)),!t)return WN;this.host=t}else if(this.isSpecial()){if(e=EN(e),DN(ZN,e))return WN;if(t=function(e){var t,r,n,i,o,s,a,c=VN(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"==wN(i,0)&&(o=DN(XN,i)?16:8,i=FN(i,8==o?1:2)),""===i)s=0;else{if(!DN(10==o?qN:8==o?JN:QN,i))return e;s=bN(i,o)}MN(r,s)}for(n=0;n<t;n++)if(s=r[n],n==t-1){if(s>=NN(256,5-t))return null}else if(s>255)return null;for(a=LN(r),n=0;n<r.length;n++)a+=r[n]*NN(256,3-n);return a}(e),null===t)return WN;this.host=t}else{if(DN($N,e))return WN;for(t="",r=pN(e),n=0;n<r.length;n++)t+=cw(r[n],iw);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return uN(dw,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&uw(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+=nw(i),null!==o&&(d+=":"+o)):"file"==t&&(d+="//"),d+=e.cannotBeABaseURL?s[0]:s.length?"/"+PN(s,"/"):"",null!==a&&(d+="?"+a),null!==c&&(d+="#"+c),d},setHref:function(e){var t=this.parse(e);if(t)throw IN(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new Mw(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+nw(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(mN(e)+":",hw)},getUsername:function(){return this.username},setUsername:function(e){var t=pN(mN(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=cw(t[r],aw)}},getPassword:function(){return this.password},setPassword:function(e){var t=pN(mN(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=cw(t[r],aw)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?nw(e):nw(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,yw)},getHostname:function(){var e=this.host;return null===e?"":nw(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,Aw)},getPort:function(){var e=this.port;return null===e?"":mN(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=mN(e))?this.port=null:this.parse(e,Ow))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+PN(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,Nw))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=mN(e))?this.query=null:("?"==wN(e,0)&&(e=FN(e,1)),this.query="",this.parse(e,Pw)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=mN(e))?("#"==wN(e,0)&&(e=FN(e,1)),this.fragment="",this.parse(e,kw)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var Mw=function(e){var t=dN(this,Uw),r=TN(arguments.length,1)>1?arguments[1]:void 0,n=vN(t,new Lw(e,!1,r));rN||(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())},Uw=Mw.prototype,xw=function(e,t){return{get:function(){return RN(this)[e]()},set:t&&function(e){return RN(this)[t](e)},configurable:!0,enumerable:!0}};if(rN&&(cN(Uw,"href",xw("serialize","setHref")),cN(Uw,"origin",xw("getOrigin")),cN(Uw,"protocol",xw("getProtocol","setProtocol")),cN(Uw,"username",xw("getUsername","setUsername")),cN(Uw,"password",xw("getPassword","setPassword")),cN(Uw,"host",xw("getHost","setHost")),cN(Uw,"hostname",xw("getHostname","setHostname")),cN(Uw,"port",xw("getPort","setPort")),cN(Uw,"pathname",xw("getPathname","setPathname")),cN(Uw,"search",xw("getSearch","setSearch")),cN(Uw,"searchParams",xw("getSearchParams")),cN(Uw,"hash",xw("getHash","setHash"))),aN(Uw,"toJSON",(function(){return RN(this).serialize()}),{enumerable:!0}),aN(Uw,"toString",(function(){return RN(this).serialize()}),{enumerable:!0}),ON){var Vw=ON.createObjectURL,Fw=ON.revokeObjectURL;Vw&&aN(Mw,"createObjectURL",oN(Vw,ON)),Fw&&aN(Mw,"revokeObjectURL",oN(Fw,ON))}_N(Mw,"URL"),tN({global:!0,constructor:!0,forced:!nN,sham:!rN},{URL:Mw});var Bw=rc,jw=wi,Gw=cS,Ww=Bc,Hw=GI,Kw=Mo("URL");Bw({target:"URL",stat:!0,forced:!(Hw&&jw((function(){Kw.canParse()})))},{canParse:function(e){var t=Gw(arguments.length,1),r=Ww(e),n=t<2||void 0===arguments[1]?void 0:Ww(arguments[1]);try{return!!new Kw(r,n)}catch(e){return!1}}});var Yw=J(wo.URL);function zw(){const e=new Blob([atob("ZnVuY3Rpb24gZShlLHQsbil7bGV0IHI9bmV3IFVpbnQ4QXJyYXkoZSx0LG4pLGE9W10sbz0wO2Zvcig7YS5sZW5ndGg8bjspbyszPG4mJjA9PT1yW29dJiYwPT09cltvKzFdJiYzPT09cltvKzJdJiYoMD09PXJbbyszXXx8MT09PXJbbyszXXx8Mj09PXJbbyszXXx8Mz09PXJbbyszXSk/KGEucHVzaChyW29dLHJbbysxXSxyW28rM10pLG8rPTQpOihhLnB1c2gocltvXSksbysrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkoYSl9ZnVuY3Rpb24gdChlLHQpe2NvbnN0IG49ZnVuY3Rpb24oZSl7Y29uc3QgdD1lLmxlbmd0aDtsZXQgbj1bXSxyPTA7Zm9yKDtyPHQ7KXIrMjx0JiYwPT09ZVtyXSYmMD09PWVbcisxXSYmKDA9PT1lW3IrMl18fDE9PT1lW3IrMl18fDI9PT1lW3IrMl18fDM9PT1lW3IrMl0pPyhuLnB1c2goZVtyXSxlW3IrMV0sMyxlW3IrMl0pLHIrPTMpOihuLnB1c2goZVtyXSkscisrKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkobil9KHQpLHI9bi5sZW5ndGgsYT1NYXRoLmZsb29yKHIvMjU1KSxvPXIlMjU1LHM9bmV3IFVpbnQ4QXJyYXkoNithKzErcitlLmJ5dGVMZW5ndGgpO3NbMF09MCxzWzFdPTAsc1syXT0wLHNbM109MSxzWzRdPTYsc1s1XT0xMDE7bGV0IGk9MDtmb3IoO2k8YTspc1s2K2ldPTI1NSxpKys7cmV0dXJuIHNbNitpXT1vLGkrKyxzLnNldChuLDYraSkscy5zZXQobmV3IFVpbnQ4QXJyYXkoZSksNitpK3IpLHMuYnVmZmVyfW5hdmlnYXRvci51c2VyQWdlbnQuaW5kZXhPZigiU2FmYXJpIik+LTEmJi0xPT09bmF2aWdhdG9yLnVzZXJBZ2VudC5pbmRleE9mKCJDaHJvbWUiKSYmKHNlbGYub25ydGN0cmFuc2Zvcm09bj0+e2NvbnN0IHI9bi50cmFuc2Zvcm1lcjtsZXQgYT1bXTtyLm9wdGlvbnMucG9ydC5vbm1lc3NhZ2U9ZT0+e2UuZGF0YS5zZWkmJmEucHVzaChlLmRhdGEuc2VpKX0sc2VsZi5wb3N0TWVzc2FnZSgic3RhcnRlZCIpO2NvbnN0IG89ci5yZWFkYWJsZS5nZXRSZWFkZXIoKSxzPXIud3JpdGFibGUuZ2V0V3JpdGVyKCk7InJ4Ij09PXIub3B0aW9ucy5uYW1lP2Z1bmN0aW9uIHQobil7by5yZWFkKCkudGhlbigocj0+e2lmKCFyLmRvbmUpe2lmKHIudmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3QgdD1mdW5jdGlvbih0KXtjb25zdCBuPW5ldyBEYXRhVmlldyh0LmRhdGEpO2xldCByPTA7Zm9yKDtyKzQ8dC5kYXRhLmJ5dGVMZW5ndGg7KXtpZigwPT09bi5nZXRVaW50OChyKzApJiYwPT09bi5nZXRVaW50OChyKzEpJiYwPT09bi5nZXRVaW50OChyKzIpJiYxPT09bi5nZXRVaW50OChyKzMpJiY2PT09bi5nZXRVaW50OChyKzQpKXtsZXQgYT1yKzYsbz0wLHM9MDtmb3IoOzI1NT09PShzPW4uZ2V0VWludDgoYSsrKSk7KW8rPTI1NTtvKz1zO2NvbnN0IGk9ZSh0LmRhdGEsYSxvKTtyZXR1cm4gbmV3IFVpbnQ4QXJyYXkoaSl9cisrfXJldHVybiBudWxsfShyLnZhbHVlKTt0JiZuLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7c2VpOnR9KX1zLndyaXRlKHIudmFsdWUpLG4ub3B0aW9ucy5wb3J0LnBvc3RNZXNzYWdlKHt0cmFuc2Zvcm1lZDohMH0pLHQobil9fSkpfShyKToidHgiPT09ci5vcHRpb25zLm5hbWUmJmZ1bmN0aW9uIGUobil7by5yZWFkKCkudGhlbigocj0+e2lmKCFyLmRvbmUpe2lmKHIudmFsdWUgaW5zdGFuY2VvZiBSVENFbmNvZGVkVmlkZW9GcmFtZSl7Y29uc3QgZT1hLnNoaWZ0KCk7ZSYmKHIudmFsdWUuZGF0YT10KHIudmFsdWUuZGF0YSxlKSl9cy53cml0ZShyLnZhbHVlKSxuLm9wdGlvbnMucG9ydC5wb3N0TWVzc2FnZSh7dHJhbnNmb3JtZWQ6ITB9KSxlKG4pfX0pKX0ocil9LHNlbGYucG9zdE1lc3NhZ2UoInJlZ2lzdGVyZWQiKSk7Cg==")],{type:"text/javascript"});return setTimeout((()=>Yw.revokeObjectURL(e)),0),new Worker(Yw.createObjectURL(e))}const Xw=new Map;const Jw=new Map;function qw(e,t,r){let n=new Uint8Array(e,t,r),i=[],o=0;for(;i.length<r;)o+3<r&&0===n[o]&&0===n[o+1]&&3===n[o+2]&&(0===n[o+3]||1===n[o+3]||2===n[o+3]||3===n[o+3])?(i.push(n[o],n[o+1],n[o+3]),o+=4):(i.push(n[o]),o++);return new Uint8Array(i)}function Qw(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 Zw=new Map;const $w=new Map;Ii(),e.AUDIO_CONTEXT_EVENT=Ni,e.AUDIO_ENCODER_CONFIG_SETTINGS=ld,e.AUDIO_TRACK_EVENT=Nd,e.AudioProcessorContext=RA,e.AudioProcessorDestination=vA,e.AudioSourceEvents=Cd,e.BufferSourceAudioTrack=OO,e.CameraVideoTrack=_I,e.DEFAULT_LOCAL_AUDIO_TRACK_STATS=wd,e.DEFAULT_LOCAL_VIDEO_TRACK_STATS=Dd,e.DEFAULT_NETWORK_QUALITY_STATS={uplinkNetworkQuality:0,downlinkNetworkQuality:0},e.DEFAULT_REMOTE_AUDIO_TRACK_STATS=Pd,e.DEFAULT_REMOTE_VIDEO_TRACK_STATS=kd,e.DataChannel=FI,e.DataChannelEvents=Bd,e.DeviceManager=Zy,e.DeviceManagerEvent=xd,e.DeviceManagerState=Ud,e.LocalAudioTrack=yO,e.LocalDataChannel=class extends FI{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=Iy,e.LocalTrackEvents=Od,e.LocalVideoTrack=mI,e.MediaElementNumStatus={uninit:100,none:110,init:120,loadeddata:130,canplay:200,playing:210,paused:220,suspend:300,stalled:310,waiting:320,error:330,destroyed:340,abort:350,ended:360,emptied:370},e.MediaElementStatus=Vd,e.MicrophoneAudioTrack=AO,e.MixingAudioTrack=IO,e.PROCESSOR_CONTEXT_EVENTS=Md,e.PROCESSOR_DESTINATION_EVENTS=Ld,e.RemoteAudioTrack=xI,e.RemoteDataChannel=class extends FI{constructor(e){super(e),f_(this,"_messageListener",void 0),this._messageListener=e=>{if(e.data.byteLength<this._dataStreamPacketHeader.byteLength)throw Error("invalid byteLength: the byte length must exceed "+this._dataStreamPacketHeader.byteLength);const t=e.data.slice(0,this._dataStreamPacketHeader.byteLength),r=new DataView(t).getUint8(3);if(r!==this.id)return void(ii("SHOW_DATASTREAM2_LOG")&&_i.debug("invalid datachannel id: ".concat(r," !== ").concat(this.id)));let n=e.data.slice(this._dataStreamPacketHeader.byteLength);n=this._dataStreamPacketHandler.deserialize(n),this.emit(Bd.MESSAGE,n)}}_updateOriginDataChannel(e){super._updateOriginDataChannel(e),this._bandRemoteDataChannelEvents()}_close(){this._originDataChannel&&(this._originDataChannel.removeEventListener("message",this._messageListener),super._close())}_bandRemoteDataChannelEvents(){this._originDataChannel&&this._originDataChannel.addEventListener("message",this._messageListener)}},e.RemoteStreamFallbackType=yd,e.RemoteStreamType=Rd,e.RemoteTrack=MI,e.RemoteTrackEvents=Id,e.RemoteVideoTrack=UI,e.SAFARI_GLOBAL_GUM_LOCK=zy,e.SUPPORT_720P_AUTO_CONFIG_LIST=[{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}],e.SUPPORT_SCREEN_ENCODER_CONFIG_LIST=sd,e.SUPPORT_SVC_CONFIG_LIST=ad,e.SUPPORT_VIDEO_ENCODER_CONFIG_LIST=od,e.StreamType=vd,e.Track=Oy,e.TrackEvents=Ad,e.TrackHint=Sd,e.TrackInternalEvent=gd,e.TrackMediaType=bd,e.VideoProcessorContext=SA,e.VideoProcessorDestination=gA,e.VideoState=Fd,e.__TRACK_LIST__=hd,e.addTrack=fd,e.audioContextState=wy,e.audioElementPlayCenter=aA,e.audioTimerLoop=function(e,t){let r=!1;const n=1/t;if(ii("DISABLE_WEBAUDIO")){const t=window.setInterval((()=>{r?window.clearInterval(t):e(performance.now()/1e3)}),1e3*n)}else{const t=Py();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=tA,e.blob2Uint8Array=kA,e.checkMediaStreamTrackResolution=OA,e.checkTrackState=cA,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=Ai.reportApiInvoke(null,{tag:vn.TRACER,name:Sn.CREATE_BUFFER_AUDIO_TRACK,options:[o]});if(ii("DISABLE_WEBAUDIO"))throw new sn(on.NOT_SUPPORTED,"can not create BufferSourceAudioTrack when WebAudio disabled");const a=Un(8,"track-buf-");_i.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=CO.get(e);if(t)return _i.debug("use cached audio resource: ",e),t;try{r=(await Xn((()=>br.get(e,{responseType:"arraybuffer"})),void 0,void 0,{maxRetryCount:3})).data}catch(e){throw new sn(on.FETCH_AUDIO_FILE_FAILED,e.toString())}}else{const t=new Ay(((t,r)=>{const n=new FileReader;n.onload=e=>{e.target?t(e.target.result):r(new sn(on.READ_LOCAL_AUDIO_FILE_ERROR))},n.onerror=()=>{r(new sn(on.READ_LOCAL_AUDIO_FILE_ERROR))},n.readAsArrayBuffer(e)}));r=await t}const n=await My(r);return"string"==typeof e&&t&&CO.set(e,n),n}(i,r)}catch(e){return s.onError(e),e.throw(_i)}const d=new bO(i),u=new OO(c,d,n?pd(n):{},a);return _i.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=ii("CAMERA_CAPTURE_CONFIG"),r=Ai.reportApiInvoke(null,{tag:vn.TRACER,name:Sn.CREATE_CAM_VIDEO_TRACK,options:[gI({},e),t]});t&&(e.encoderConfig=t);const n=IA(e),i=Un(8,"track-cam-");let o=null;_i.info("start create camera video track with config",JSON.stringify(e),"trackId",i);try{o=(await Xy({video:n},i)).getVideoTracks()[0]||null}catch(e){throw r.onError(e),e}if(!o){const e=new sn(on.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw(_i)}e.optimizationMode&&SI(i,o,e,cd(e.encoderConfig));const s=new _I(o,e,n,e.scalabiltyMode?ud(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,i);return r.onSuccess(s.getTrackId()),_i.info("create camera video success, trackId:",i),s},e.createCustomAudioTrack=function(e){const t=Ai.reportApiInvoke(null,{tag:vn.TRACER,name:Sn.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),r=new yO(e.mediaStreamTrack,e.encoderConfig?pd(e.encoderConfig):{},Un(8,"track-cus-"),!1);return _i.info("create custom audio track success with config",e,"trackId",r.getTrackId()),t.onSuccess(r.getTrackId()),r},e.createCustomVideoTrack=function(e){const t=Ai.reportApiInvoke(null,{tag:vn.TRACER,name:Sn.CREATE_CUSTOM_VIDEO_TRACK,options:[e]}),r=new mI(e.mediaStreamTrack,{width:e.width,height:e.height,frameRate:e.frameRate,bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin},e.scalabiltyMode?ud(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,Un(8,"track-cus-"),[Sd.CUSTOM_TRACK]);return t.onSuccess(r.getTrackId()),_i.info("create custom video track success with config",e,"trackId",r.getTrackId()),r},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=ii("CAMERA_CAPTURE_CONFIG"),n=Ai.reportApiInvoke(null,{tag:vn.TRACER,name:Sn.CREATE_MIC_AND_CAM_TRACKS,options:[e,t,r]});r&&(t.encoderConfig=r);const i=IA(t),o=CA(e),s=Un(8,"track-mic-"),a=Un(8,"track-cam-");let c=null,d=null;_i.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 Xy({audio:o,video:i},"".concat(s,"-").concat(a));c=e.getAudioTracks()[0],d=e.getVideoTracks()[0]}catch(e){throw n.onError(e),e}if(!c||!d){const e=new sn(on.UNEXPECTED_ERROR,"can not find tracks in media stream");return n.onError(e),e.throw(_i)}t.optimizationMode&&SI(a,d,t,cd(t.encoderConfig));const u=new AO(c,e,o,s),l=new _I(d,t,i,t.scalabiltyMode?ud(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,a);return n.onSuccess([u.getTrackId(),l.getTrackId()]),_i.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=Ai.reportApiInvoke(null,{tag:vn.TRACER,name:Sn.CREATE_MIC_AUDIO_TRACK,options:[e]}),r=CA(e),n=Un(8,"track-mic-");let i=null;_i.info("start create microphone audio track with config",JSON.stringify(e),"trackId",n);try{i=(await Xy({audio:r},n)).getAudioTracks()[0]||null}catch(e){throw t.onError(e),e}if(!i){const e=new sn(on.UNEXPECTED_ERROR,"can not find track in media stream");return t.onError(e),e.throw(_i)}const o=new AO(i,e,r,n);return t.onSuccess(o.getTrackId()),_i.info("create microphone audio track success, trackId:",n),o},e.createMixingAudioTrack=function(e){const t=new IO;return e.forEach((e=>t.addAudioTrack(e))),t},e.createScreenVideoTrack=async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"disable";const r=Ai.reportApiInvoke(null,{tag:vn.TRACER,name:Sn.CREATE_SCREEN_VIDEO_TRACK,options:[gI({},e),t]});e.encoderConfig?"string"==typeof e.encoderConfig||e.encoderConfig.width&&e.encoderConfig.height||(e.encoderConfig.width={max:1920},e.encoderConfig.height={max:1080}):e.encoderConfig="1080p_2";const n=bA(e),i=Un(8,"track-scr-v-");let o=null,s=null;const a=bi();if(!a.supportShareAudio&&"enable"===t){const e=new sn(on.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio");return r.onError(e),e.throw(_i)}_i.info("start create screen video track with config",e,"withAudio",t,"trackId",i);try{const e=await Xy({screen:n,screenAudio:"auto"===t?a.supportShareAudio:"enable"===t},i);o=e.getVideoTracks()[0]||null,s=e.getAudioTracks()[0]||null}catch(e){throw r.onError(e),e}if(!o){const e=new sn(on.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw(_i)}if(!s&&"enable"===t){o&&o.stop();const e=new sn(on.SHARE_AUDIO_NOT_ALLOWED);return r.onError(e),e.throw(_i)}if(e.optimizationMode||(e.optimizationMode="detail"),e.optimizationMode){SI(i,o,e,e.encoderConfig&&dd(e.encoderConfig)||void 0),e.encoderConfig&&"string"!=typeof e.encoderConfig&&(e.encoderConfig.bitrateMin=e.encoderConfig.bitrateMax)}const c=new mI(o,e.encoderConfig?dd(e.encoderConfig):{},e.scalabiltyMode?ud(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,i,[Sd.SCREEN_TRACK]);if(!s)return r.onSuccess(c.getTrackId()),_i.info("create screen video track success","video:",c.getTrackId()),c;const d=new yO(s,void 0,Un(8,"track-scr-a-"),!1);return r.onSuccess([c.getTrackId(),d.getTrackId()]),_i.info("create screen video track success","video:",c.getTrackId(),"audio:",d.getTrackId()),[c,d]},e.decodeAudioData=My,e.detectSupportAudioElementSetSinkId=Ci,e.deviceManager=$y,e.emptyImage2TypedArray=PA,e.frameData2CryptoBuffer=async(e,t,r)=>await DA(e.buffer,t,r),e.getAudioContext=Py,e.getAudioEncoderConfiguration=pd,e.getBitrateConstrainRange=NA,e.getBitrateFromResAndFps=wA,e.getCompatibility=bi,e.getConstraintsFromCameraConfig=IA,e.getConstraintsFromMicrophoneConfig=CA,e.getConstraintsFromScreenConfig=bA,e.getElectronScreenSources=Ky,e.getElectronScreenStream=Wy,e.getElectronScreenStreamByUserSelect=Hy,e.getLocalStream=Xy,e.getOriginSenderConfig=e=>{const t=e._encoderConfig;if(!t)return;const{frameRate:r,width:n,height:i}=e.getMediaStreamTrackSettings();let{frameRate:o=r,width:s=n,height:a=i}=t;if(!o||!s||!a)return;s=Gn(s),a=Gn(a),o=Gn(o);const{max:c,min:d}=wA(s,a,o),{bitrateMax:u,bitrateMin:l}=t||{};u||_i.debug("calculate bitrate: [w: ".concat(s,", h: ").concat(a,", fps: ").concat(o,"] => [brMax: ").concat(u,", brMin: ").concat(l,"]"));const{maxFramerate:p}=ii("ENCODER_CONFIG_LIMIT");return p&&"number"==typeof p&&(o=Math.min(o,p)),{frameRate:o,bitrateMax:u||c,bitrateMin:l||d,scaleResolutionDownBy:1,scale:0}},e.getScalabilityConfiguration=ud,e.getScreenEncoderConfiguration=dd,e.getSilenceAudioTrack=function(){if(xy)return xy;const e=Py();if(!e.createMediaStreamDestination)throw new sn(on.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),xy=n.stream.getAudioTracks()[0],xy},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=LA,e.getVideoEncoderConfiguration=cd,e.handleGetUserMediaError=qy,e.hasAudioContext=ky,e.interceptLocalAudioFrame=async function(e){if(!bi().supportWebRTCEncodedTransform)return void _i.warning("browser not support audio encoded transform");if(Xw.has(e))return;if(!e.track)return;const t={track:e.track};if(Vr()){if(!e.createEncodedStreams)return void _i.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void _i.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&&(_i.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(Fr()){if("undefined"==typeof RTCRtpScriptTransform)return void _i.warning("browser not support RTCRtpScriptTransform");const n=zw(),i=new MessageChannel;await new Ay((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 Ay((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&&(_i.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=Xw.get(e);if(t){Xw.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){_i.warning(e&&e.message)}}}Xw.set(e,t),e.track.addEventListener("ended",r)},e.interceptLocalVideoFrame=async function(e,t){if(!bi().supportWebRTCEncodedTransform)return void _i.warning("browser not support video encoded transform");if(Zw.has(e))return;if(!e.track)return;const r={track:e.track};if(Vr()){if(!e.createEncodedStreams)return void _i.warning("browser not support createEncodedStreams() API");let i=null;try{i=e.createEncodedStreams()}catch(e){return void _i.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&&(_i.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=Qw(t.data,s)),i.enqueue(t)}});i.readable.pipeThrough(s).pipeTo(i.writable)}else{if(!Fr())return;{if("undefined"==typeof RTCRtpScriptTransform)return void _i.warning("browser not support RTCRtpScriptTransform");const i=zw(),o=new MessageChannel;await new Ay((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 Ay((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&&(_i.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=Zw.get(e);if(t){Zw.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){_i.warning(e&&e.message)}}}Zw.set(e,r),e.track.addEventListener("ended",n)},e.interceptRemoteAudioFrame=async function(e){if(!bi().supportWebRTCEncodedTransform)return void _i.warning("browser not support audio encoded transform");if(Jw.has(e))return;const t={track:e.track};if(Vr()){if(!e.createEncodedStreams)return void _i.warning("browser not support createEncodedStreams() API");let n=null;try{n=e.createEncodedStreams()}catch(e){return void _i.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&&(_i.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(Fr()){if("undefined"==typeof RTCRtpScriptTransform)return void _i.warning("browser not support RTCRtpScriptTransform");const n=zw(),i=new MessageChannel;await new Ay((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 Ay((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&&(_i.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=Jw.get(e);if(t){Jw.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){_i.warning(e&&e.message)}}}(e)}Jw.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(!bi().supportWebRTCEncodedTransform)return void _i.warning("browser not support video encoded transform");if(!e.track)return;if($w.has(e)){const r=$w.get(e);return void(r&&(r.onSei=t.onSei))}const r={track:e.track,onSei:t.onSei};if(Vr()){if(!e.createEncodedStreams)return void _i.warning("browser not support createEncodedStreams() API");let t=null;try{t=e.createEncodedStreams()}catch(e){return void _i.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&&(_i.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=function(e){const t=new DataView(e.data);let r=0;for(;r+4<e.data.byteLength;){if(0===t.getUint8(r+0)&&0===t.getUint8(r+1)&&0===t.getUint8(r+2)&&1===t.getUint8(r+3)&&6===t.getUint8(r+4)){let n=r+6,i=0,o=0;for(;255===(o=t.getUint8(n++));)i+=255;i+=o;const s=qw(e.data,n,i);return new Uint8Array(s)}r++}return null}(t);o&&r.onSei&&r.onSei(o),i.enqueue(t)}});t.readable.pipeThrough(i).pipeTo(t.writable)}else if(Fr()){if("undefined"==typeof RTCRtpScriptTransform)return void _i.warning("browser not support RTCRtpScriptTransform");const t=zw(),i=new MessageChannel;await new Ay((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 Ay((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?(_i.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=$w.get(e);if(t){$w.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){_i.warning(e&&e.message)}}}(e)}$w.set(e,r),e.track.addEventListener("ended",n)},e.isAudioEncoderConfiguration=_d,e.isAudioEncoderConfigurationOrPreset=function(e){return"string"==typeof e?cn(e,"profile",Object.keys(ld)):_d(e),!0},e.isBeautyEffectOptions=function(e){return void 0!==e.smoothnessLevel&&dn(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&dn(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&dn(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&cn(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2]),!0},e.isElectron=_n,e.isLowStreamParameter=function(e){if(!e)throw new sn(on.INVALID_PARAMS);return ln(e.width)||un(e.width,"streamParameter.width"),ln(e.height)||un(e.height,"streamParameter.height"),ln(e.framerate)||un(e.framerate,"streamParameter.framerate"),ln(e.bitrate)||dn(e.bitrate,"streamParameter.bitrate"),!0},e.isPlanB=function(){return!Oi.supportUnifiedPlan||ii("CHROME_FORCE_PLAN_B")&&Zr()},e.isScreenSourceType=Td,e.isVideoEncoderConfiguration=md,e.isVideoEncoderConfigurationOrPreset=function(e){return"string"==typeof e?cn(e,"profile",Object.keys(od)):md(e),!0},e.polyfillAudioNode=Ly,e.removeTrack=Ed,e.requestAutoplayGesture=rA,e.silenceScriptProcessHandler=Vy,e.updateAgoraRTCCompatibility=Ii,e.visibilityWatcher=VI}));
|