aliyun-rtc-sdk 7.1.2-beta.1 → 7.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import{o as Qr,k as $r,A as Zr}from"./index-BvRi8Pnp.js";import"eventemitter3";const en=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11]));function $e(W,M,P,N){return new(P||(P=Promise))(function(J,L){function R(c){try{v(N.next(c))}catch(u){L(u)}}function x(c){try{v(N.throw(c))}catch(u){L(u)}}function v(c){var u;c.done?J(c.value):(u=c.value,u instanceof P?u:new P(function(S){S(u)})).then(R,x)}v((N=N.apply(W,[])).next())})}typeof SuppressedError=="function"&&SuppressedError;var qe;function Jt(){return $e(this,void 0,void 0,function*(){let W=!1;try{W=yield en()}catch{W=!1}return console.log("isSupportedSIMD",W),W})}(function(W){W[W.ERROR=0]="ERROR",W[W.WARN=1]="WARN",W[W.INFO=2]="INFO",W[W.LOG=3]="LOG",W[W.DEBUG=4]="DEBUG"})(qe||(qe={}));let Ie=class Ge{static error(...M){var P;Ge.logLevel>=qe.ERROR&&((P=console.error)===null||P===void 0||P.call(console,`[${Ge.logTag}] `,...M))}static warn(...M){var P;Ge.logLevel>=qe.WARN&&((P=console.warn)===null||P===void 0||P.call(console,`[${Ge.logTag}] `,...M))}static info(...M){var P;Ge.logLevel>=qe.INFO&&((P=console.info)===null||P===void 0||P.call(console,`[${Ge.logTag}] `,...M))}static log(...M){var P;Ge.logLevel>=qe.LOG&&((P=console.log)===null||P===void 0||P.call(console,`[${Ge.logTag}] `,...M))}static debug(...M){var P;Ge.logLevel>=qe.DEBUG&&((P=console.debug)===null||P===void 0||P.call(console,`[${Ge.logTag}] `,...M))}};Ie.logLevel=qe.WARN,Ie.logTag="aliyun-audio-3a";let tn=class{},Qt=class extends tn{static isSupported(){return function(){if(typeof window=="object"&&window!==null){const M="AudioWorklet"in window,P="WebAssembly"in window;return M&&P}return!1}()}static isSupportedSIMD(){return $e(this,void 0,void 0,function*(){return yield Jt()})}static setLogger(M){Ie.logLevel=M}constructor(M){super(),this.channelCount=1,this.sampleRate=48e3,this.collectDumpOutputData=[],this.collectDumpNearInputData=[],this.collectDumpFarInputData=[],this.collectDumpMetaData=[],this.statUpdateTimer=0,this.statUpdateInterval=5e3,this.options=Object.assign({aecOn:!0,ansOn:!0,agcOn:!0,hdOn:!1,ansMode:1,dumpOn:!1,aiaecOn:!1,wasmCdnPath:"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.6/"},M||{})}initWASM(M,P,N){return $e(this,void 0,void 0,function*(){Ie.log("initWASM",M,P,N);const J=R=>$e(this,void 0,void 0,function*(){try{const x=yield fetch(R,{credentials:"same-origin"});return x.ok||this.onLoadError(new Error(`Failed to fetch WASM: ${x.status}:${x.statusText}, url:${R}`)),x.arrayBuffer()}catch(x){return this.onLoadError(new Error("WASM load error")),Ie.error("Error fetching WASM:",x),new Uint8Array(0)}}),L=R=>$e(this,void 0,void 0,function*(){return fetch(R).then(x=>x.text())});try{const R=yield Jt(),x=this.options.wasmCdnPath+"audio_module_v2.wasm",v=this.options.wasmCdnPath+"audio_module_v2_simd.wasm",u=yield J(R?v:x),S=this.options.wasmCdnPath+"audio_module_v2.js",f=this.options.wasmCdnPath+"audio_module_v2_simd.js",a=R?f:S,d=yield L(a);M.port.postMessage(Object.assign({type:"init",channelCount:P,sampleRate:N,wasmBuffer:u,isSupportSIMD:R,audioModuleScript:d,logLevel:Ie.logLevel},this.options),[u])}catch(R){Ie.error("Error initializing WASM:",R),this.onLoadError(new Error("WASM init error"))}M.port.onmessage=R=>{R.data.type==="init_done"&&this.onLoadSuccess(void 0),R.data.type==="dump_output_data"&&this.onDumpOutputData(R.data.data),R.data.type==="dump_near_data"&&this.onDumpNearInputData(R.data.data),R.data.type==="dump_far_data"&&this.onDumpFarInputData(R.data.data),R.data.type==="dump_meta_data"&&this.onDumpMeatData(R.data.data),R.data.type==="output_log"&&this.onOutputLog(R.data.data),R.data.type==="apm_stat_data"&&this.onStatData(R.data.data)}})}createProcessor(M,P,N,J,L){return $e(this,void 0,void 0,function*(){this.audioContext=M,this.audioContext.resume(),this.channelCount=N,this.sampleRate=J;try{const v=new Blob(['!function(){"use strict";function t(t,e,a,n){return new(a||(a=Promise))((function(s,i){function o(t){try{h(n.next(t))}catch(t){i(t)}}function r(t){try{h(n.throw(t))}catch(t){i(t)}}function h(t){var e;t.done?s(t.value):(e=t.value,e instanceof a?e:new a((function(t){t(e)}))).then(o,r)}h((n=n.apply(t,e||[])).next())}))}var e;"function"==typeof SuppressedError&&SuppressedError,function(t){t[t.ERROR=0]="ERROR",t[t.WARN=1]="WARN",t[t.INFO=2]="INFO",t[t.LOG=3]="LOG",t[t.DEBUG=4]="DEBUG"}(e||(e={}));class a{static error(...t){var n;a.logLevel>=e.ERROR&&(null===(n=console.error)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}static warn(...t){var n;a.logLevel>=e.WARN&&(null===(n=console.warn)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}static info(...t){var n;a.logLevel>=e.INFO&&(null===(n=console.info)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}static log(...t){var n;a.logLevel>=e.LOG&&(null===(n=console.log)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}static debug(...t){var n;a.logLevel>=e.DEBUG&&(null===(n=console.debug)||void 0===n||n.call(console,`[${a.logTag}] `,...t))}}a.logLevel=e.WARN,a.logTag="aliyun-audio-3a";const n=Float32Array.BYTES_PER_ELEMENT,s=Uint16Array.BYTES_PER_ELEMENT;class i{constructor(t,e,a,n,s){this._channelData=[],this._name=t,this._isInitialized=!1,this._module=e,this._length=a,this._ringLength=2*a,this._maxChannelCount=s?Math.min(s,32):n,this._channelCount=n,this._allocateHeap(),this._isInitialized=!0,this._readIndex=0,this._writeIndex=0,this._framesAvailable=0,this._channelDataLocal=[];for(let t=0;t<this._channelCount;++t)this._channelDataLocal[t]=new Float32Array(this._ringLength)}_allocateHeap(){const t=this._length*n,e=this._channelCount*t;this._dataPtr=this._module._malloc(e),this._channelData=[];for(let e=0;e<this._channelCount;++e){const a=this._dataPtr+e*t,n=a+t;this._channelData[e]=this._module.HEAPF32.subarray(a>>s,n>>s)}}adaptChannel(t){t<this._maxChannelCount&&(this._channelCount=t)}get length(){return this._isInitialized?this._length:null}get numberOfChannels(){return this._isInitialized?this._channelCount:null}get maxChannelCount(){return this._isInitialized?this._maxChannelCount:null}getChannelData(t){return void 0!==t&&t>=this._channelCount?null:void 0===t?this._channelData:this._channelData[t]}getHeapAddress(){return this._dataPtr}getPointer(){return this._dataPtr}free(){this._isInitialized=!1,null!==this._dataPtr&&this._module._free(this._dataPtr),this._channelData=[]}get framesAvailable(){return this._framesAvailable}push(t){const e=t[0].length;for(let a=0;a<e;++a){for(let e=0;e<this._channelCount;++e)this._channelDataLocal[e][this._writeIndex]=t[e][a];this._writeIndex=(this._writeIndex+1)%this._ringLength}this._framesAvailable+=e,this._framesAvailable>this._ringLength&&(console.warn(this._name,"Too many frames available, overflow"),this._framesAvailable=this._ringLength,this._writeIndex=0)}pull(t){if(0===this._framesAvailable)return void console.warn(this._name,"No frames available");const e=t[0].length;for(let a=0;a<e;++a){for(let e=0;e<this._channelCount;++e)t[e][a]=this._channelDataLocal[e][this._readIndex];this._readIndex=(this._readIndex+1)%this._ringLength}this._framesAvailable-=e,this._framesAvailable<0&&(this._framesAvailable=0,this._readIndex=0)}}class o{constructor(t){this.inited=!1,this.handle=null,this.channelCount=1,this.isEnable=!0,this.dumpAudioData=!1,this.kernelBufferSize=512,this.node=t,this.onDumpOutputDataFunction=null,this.onDumpNearDataFunction=null,this.onDumpFarDataFunction=null,this.onDumpMetaDataFunction=null,this.wasmInvoker=null,this._nearAudioBuffer={},this._outputAudioBuffer={}}destructor(){this.wasmInvoker=null,this.handle=null}init(n){return t(this,void 0,void 0,(function*(){const{wasmBuffer:t,audioModuleScript:s,channelCount:o=1,sampleRate:r=44100,dumpAudioData:h=!1,logLevel:l=e.DEBUG}=n;a.logLevel=l,a.log("AudioAPM init",JSON.stringify(n)),this.channelCount=o,this.dumpAudioData=h;try{const e=new Function(`let module={};let exports={};${s}; return module`)();this.wasmInvoker=yield e.exports({wasmBinary:t})}catch(t){this.node.port.postMessage({type:"error",message:"audioModule init error"}),a.error(t)}this._nearAudioBuffer=new i("inBuffer",this.wasmInvoker,this.kernelBufferSize,2*this.channelCount,32),this._outputAudioBuffer=new i("outBuffer",this.wasmInvoker,this.kernelBufferSize,this.channelCount,32);const u=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=String.fromCharCode.apply(null,a);this.node&&this.node.port&&this.node.port.postMessage({type:"output_log",message:"output_log",data:n})}),"vii");if(this.wasmInvoker.__apm_log_callback(u),this.handle=this.wasmInvoker.__apm_create(n.aecOn?1:0,n.ansOn?1:0,n.agcOn?1:0,n.hdOn?1:0,r,o,n.dumpOn?1:0,this.kernelBufferSize),n.aiaecOn){const t=102;this.wasmInvoker.__apm_set_param(this.handle,t,7)}if(n.useHardOnly){const t=108;this.wasmInvoker.__apm_set_param(this.handle,t,1)}this.node.port.postMessage({type:"init_done",message:"init done"}),this.inited=!0}))}getStatData(){if(this.wasmInvoker&&this.isEnable){let t=this.wasmInvoker.__apm_get_stat(this.handle),e=this.wasmInvoker.UTF8ToString(t);this.wasmInvoker._free(t),this.node&&this.node.port&&this.node.port.postMessage({type:"apm_stat_data",message:"apm_stat_data",data:e})}}onOutputLog(t){console.log("[WASM_LOG]",t)}destory(){return t(this,void 0,void 0,(function*(){var t;try{null===(t=this.wasmInvoker)||void 0===t||t.__apm_destory(this.handle),this.inited=!1}catch(t){a.error(t)}finally{this.handle=null}}))}enable(){this.isEnable=!0,a.log("APM enable")}disable(){this.isEnable=!1,a.log("APM disable")}getStat(){if(null==this.wasmInvoker||null==this.handle)return"";let t=this.wasmInvoker.__apm_get_stat(this.handle),e=this.wasmInvoker.UTF8ToString(t);return this.wasmInvoker._free(t),e}startDump(){this.onDumpOutputDataFunction=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=new Uint8Array(a);this.node&&this.node.port&&this.node.port.postMessage({type:"dump_output_data",message:"dump_output_data",data:n})}),"vii"),this.onDumpNearDataFunction=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=new Uint8Array(a);this.node&&this.node.port&&this.node.port.postMessage({type:"dump_near_data",message:"dump_near_data",data:n})}),"vii"),this.onDumpFarDataFunction=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=new Uint8Array(a);this.node&&this.node.port&&this.node.port.postMessage({type:"dump_far_data",message:"dump_far_data",data:n})}),"vii"),this.onDumpMetaDataFunction=this.wasmInvoker.addFunction(((t,e)=>{const a=this.wasmInvoker.HEAPU8.subarray(t,t+e),n=new Uint8Array(a);this.node&&this.node.port&&this.node.port.postMessage({type:"dump_meta_data",message:"dump_meta_data",data:n})}),"vii"),this.wasmInvoker.__apm_dump_start(this.handle,this.onDumpOutputDataFunction,this.onDumpNearDataFunction,this.onDumpFarDataFunction,this.onDumpMetaDataFunction)}stopDump(){this.wasmInvoker.__apm_dump_stop(this.handle),this.wasmInvoker&&(this.wasmInvoker.removeFunction(this.onDumpOutputDataFunction),this.wasmInvoker.removeFunction(this.onDumpNearDataFunction),this.wasmInvoker.removeFunction(this.onDumpFarDataFunction),this.wasmInvoker.removeFunction(this.onDumpMetaDataFunction))}process(t,e,a){if(!this.inited||!this.isEnable){for(let e=0;e<this.channelCount;e++){a[e].set(t[e])}return}const n=this.channelCount;let s=0;if(this.handle&&this.isEnable){const i=t[0].length,o=[];for(let a=0;a<n;a++)e[a]&&e[a].length>0&&(s=1),o.push(t[a]||new Float32Array(i).fill(0)),o.push(e[a]||new Float32Array(i).fill(0));if(this._nearAudioBuffer.push(o),this._nearAudioBuffer.framesAvailable>=this.kernelBufferSize){this._nearAudioBuffer.pull(this._nearAudioBuffer.getChannelData()),this.wasmInvoker.__apm_process_new(this.handle,this._nearAudioBuffer.getHeapAddress(),this._outputAudioBuffer.getHeapAddress(),n,s);const t=this._outputAudioBuffer.getChannelData();this._outputAudioBuffer.push(t)}this._outputAudioBuffer.pull(a)}}}class r extends AudioWorkletProcessor{constructor(){super(),this.apm=new o(this),this.port.onmessage=t=>{const e=t.data||{};switch(a.log("onmessage data",e),e.type){case"init":this.apm.init(e);break;case"destroy":this.apm.destory();break;case"enable":this.apm.enable();break;case"disable":this.apm.disable();break;case"start_dump":this.apm.startDump();break;case"stop_dump":this.apm.stopDump();break;case"get_stat_data":this.apm.getStatData();break;default:a.warn("Unknown message type:",e.type)}}}process(t,e){const a=t[0],n=t.length>1?t[1]:[],s=e[0];return this.apm.process(a,n,s),!0}}registerProcessor("aliyun-web-3a-processor",r)}();\n'],{type:"application/javascript"}),c=URL.createObjectURL(v);yield this.audioContext.audioWorklet.addModule(c)}catch(v){Ie.error("Failed to add module to audio worklet:",v)}let R=new AudioWorkletNode(this.audioContext,"aliyun-web-3a-processor",{numberOfInputs:2,outputChannelCount:[N]});this.workletNode=R,P.connect(R),L&&(this.farNode=L,L.connect(R,0,1));const x=this.audioContext.createMediaStreamDestination();R.connect(x),this.targetMediaTrack=x.stream.getAudioTracks()[0],yield this.initWASM(R,N,J),this.statUpdateTimer=window.setInterval(()=>{this.getStatData()},this.statUpdateInterval)})}addFarNode(M){this.workletNode&&(this.farNode&&this.farNode.disconnect(this.workletNode),M&&(this.farNode=M,M.connect(this.workletNode,0,1)))}getStatData(){var M;try{(M=this.workletNode)===null||M===void 0||M.port.postMessage({type:"get_stat_data"})}catch(P){Ie.error("Failed to post message to worklet node:",P)}}destroy(){if(this.statUpdateTimer&&window.clearInterval(this.statUpdateTimer),this.audioContext&&this.workletNode&&this.workletNode.port)try{this.workletNode.port.postMessage({type:"destroy"}),this.workletNode.port.onmessage=null,this.workletNode.disconnect(),Ie.log("postMessage destroy")}catch(M){Ie.error("Failed to post message to worklet node:",M)}}startDump(){var M;try{(M=this.workletNode)===null||M===void 0||M.port.postMessage({type:"start_dump"})}catch(P){Ie.error("Failed to post message to worklet node:",P)}}stopDump(){var M;try{(M=this.workletNode)===null||M===void 0||M.port.postMessage({type:"stop_dump"})}catch(P){Ie.error("Failed to post message to worklet node:",P)}setTimeout(()=>{this.onDumpOutputData(null,!0),this.onDumpNearInputData(null,!0),this.onDumpFarInputData(null,!0),this.onDumpMeatData(null,!0)},3e3)}onDumpOutputData(M,P=!1){if(M&&M.length>0&&this.collectDumpOutputData.push(M),P&&this.collectDumpOutputData.length>0||1024*this.collectDumpOutputData.length>=this.getMaxDumpBytes()){let N=new Blob(this.collectDumpOutputData);this.onDumpData(N,"output_"+this.sampleRate+"hz_"+this.channelCount+"ch.pcm"),this.collectDumpOutputData=[]}}onDumpNearInputData(M,P=!1){if(M&&M.length>0&&this.collectDumpNearInputData.push(M),P&&this.collectDumpNearInputData.length>0||1024*this.collectDumpNearInputData.length>=this.getMaxDumpBytes()){let N=new Blob(this.collectDumpNearInputData);this.onDumpData(N,"near_input_"+this.sampleRate+"hz_"+this.channelCount+"ch.pcm"),this.collectDumpNearInputData=[]}}onDumpFarInputData(M,P=!1){if(M&&M.length>0&&this.collectDumpFarInputData.push(M),P&&this.collectDumpFarInputData.length>0||1024*this.collectDumpFarInputData.length>=this.getMaxDumpBytes()){let N=new Blob(this.collectDumpFarInputData);this.onDumpData(N,"far_input_"+this.sampleRate+"hz_"+this.channelCount+"ch.pcm"),this.collectDumpFarInputData=[]}}onDumpMeatData(M,P=!1){if(M&&M.length>0&&this.collectDumpMetaData.push(M),P&&this.collectDumpMetaData.length>0||1024*this.collectDumpMetaData.length>=this.getMaxDumpBytes()){let N=new Blob(this.collectDumpMetaData);this.onDumpData(N,"meta_"+this.sampleRate+"hz_"+this.channelCount+"ch.pcm"),this.collectDumpMetaData=[]}}getMaxDumpBytes(){return 600*Number(this.sampleRate.toFixed(0))*Number(this.channelCount.toFixed(0))*2}enable(){var M;if(!((M=this.workletNode)===null||M===void 0)&&M.port)try{this.workletNode.port.postMessage({type:"enable"}),Ie.log("postMessage enable")}catch(P){Ie.error("Failed to post message to worklet node:",P)}}disable(){var M;if(!((M=this.workletNode)===null||M===void 0)&&M.port)try{Ie.log("postMessage disable"),this.workletNode.port.postMessage({type:"disable"})}catch(P){Ie.error("Failed to post message to worklet node:",P)}}on(M,P){M==="loaderror"&&(this.onLoadError=P),M==="loadsuccess"&&(this.onLoadSuccess=P),M==="dumpdata"&&(this.onDumpData=P),M==="outputlog"&&(this.onOutputLog=P),M==="statdata"&&(this.onStatData=P)}onLoadError(M){console.log("onLoadError",M)}onLoadSuccess(M){console.log("onLoadSuccess",M)}onDumpData(M,P){console.log("onDumpData",M,P)}onOutputLog(M){console.log("[WASM]",M)}onStatData(M){console.log("onStatData:",M)}};function rn(W,M,P){Object.defineProperty(W,M,{writable:!0,enumerable:!0,configurable:!0,value:P})}function $t(W,M,P,N){rn(W,M,P)}Array(32);class nn{constructor(M){this.timer=null,this.time=10,this.count=10,this.arr=[];var P,N;this.time=(P=M.time)!=null?P:10,this.count=(N=M.count)!=null?N:10,M.host.startsWith("http://")||M.host.startsWith("https://")?this.url=M.host+"/logstores/"+M.logstore+"/track":this.url="https://"+M.project+"."+M.host+"/logstores/"+M.logstore+"/track",this.opt=M,M.installUnloadHook&&typeof M.installUnloadHook=="function"&&M.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(M){const P={__logs__:M};return this.opt.tags&&(P.__tags__=this.opt.tags),this.opt.topic&&(P.__topic__=this.opt.topic),this.opt.source&&(P.__source__=this.opt.source),JSON.stringify(P)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const M=this.assemblePayload(this.arr);this.opt.sendPayload(this.url,M)}}transString(M){let P={};for(let N in M)typeof M[N]=="object"?P[N]=JSON.stringify(M[N]):P[N]=String(M[N]);return P}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const M=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){M.sendImmediateInner()},this.time*1e3)}}send(M){const P=this.transString(M);this.arr.push(P),this.sendInner()}sendImmediate(M){const P=this.transString(M);this.arr.push(P),this.sendImmediateInner()}sendBatchLogs(M){const P=M.map(N=>this.transString(N));this.arr.push(...P),this.sendInner()}sendBatchLogsImmediate(M){const P=M.map(N=>this.transString(N));this.arr.push(...P),this.sendImmediateInner()}overwriteTransString(M){this.transString=M.transString}getOpt(){return this.opt}}var on=(W,M,P)=>new Promise((N,J)=>{var L=v=>{try{x(P.next(v))}catch(c){J(c)}},R=v=>{try{x(P.throw(v))}catch(c){J(c)}},x=v=>v.done?N(v.value):Promise.resolve(v.value).then(L,R);x((P=P.apply(W,M)).next())});function an(W,M){return navigator&&navigator.sendBeacon?navigator.sendBeacon(`${W}?APIVersion=0.6.0`,M):!1}function Zt(W,M){const P=new window.XMLHttpRequest;P.open("POST",`${W}?APIVersion=0.6.0`,!0),P.send(M)}function sn(W,M){try{if(M.length>=32768){Zt(W,M);return}an(W,M)||Zt(W,M)}catch(P){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
2
2
  `+P),console.error("Failed log data:",W))}}function cn(W,M,P){return on(this,null,function*(){try{W=W.slice(0,-6);const{data:N,header:J}=yield P.process(W,M),L=new window.XMLHttpRequest;L.open("POST",W,!0);for(let R in J)L.setRequestHeader(R,J[R]);L.send(N)}catch(N){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
3
- `+N),console.error("Failed log data:",W))}})}class er extends nn{constructor(M){const P=Object.assign({},M,{installUnloadHook:N=>{window.addEventListener("beforeunload",()=>{N()})},sendPayload:(N,J)=>{sn(N,J)}});super(P)}useStsPlugin(M){this.getOpt().sendPayload=(P,N)=>{cn(P,N,M)},this.overwriteTransString(M)}}$t(window,"SLS_Tracker",er);var ye=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function un(W){return W&&W.__esModule&&Object.prototype.hasOwnProperty.call(W,"default")?W.default:W}var tr={exports:{}};function dn(W){throw new Error('Could not dynamically require "'+W+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var st={exports:{}},rr;function Se(){return rr||(rr=1,function(W,M){(function(P,N){W.exports=N()})(ye,function(){var P=P||function(N,J){var L;if(typeof window<"u"&&window.crypto&&(L=window.crypto),typeof self<"u"&&self.crypto&&(L=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(L=globalThis.crypto),!L&&typeof window<"u"&&window.msCrypto&&(L=window.msCrypto),!L&&typeof ye<"u"&&ye.crypto&&(L=ye.crypto),!L&&typeof dn=="function")try{L=require("crypto")}catch{}var R=function(){if(L){if(typeof L.getRandomValues=="function")try{return L.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof L.randomBytes=="function")try{return L.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},x=Object.create||function(){function n(){}return function(s){var t;return n.prototype=s,t=new n,n.prototype=null,t}}(),v={},c=v.lib={},u=c.Base=function(){return{extend:function(n){var s=x(this);return n&&s.mixIn(n),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments)}),s.init.prototype=s,s.$super=this,s},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var s in n)n.hasOwnProperty(s)&&(this[s]=n[s]);n.hasOwnProperty("toString")&&(this.toString=n.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),S=c.WordArray=u.extend({init:function(n,s){n=this.words=n||[],s!=J?this.sigBytes=s:this.sigBytes=n.length*4},toString:function(n){return(n||a).stringify(this)},concat:function(n){var s=this.words,t=n.words,i=this.sigBytes,l=n.sigBytes;if(this.clamp(),i%4)for(var E=0;E<l;E++){var b=t[E>>>2]>>>24-E%4*8&255;s[i+E>>>2]|=b<<24-(i+E)%4*8}else for(var _=0;_<l;_+=4)s[i+_>>>2]=t[_>>>2];return this.sigBytes+=l,this},clamp:function(){var n=this.words,s=this.sigBytes;n[s>>>2]&=4294967295<<32-s%4*8,n.length=N.ceil(s/4)},clone:function(){var n=u.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var s=[],t=0;t<n;t+=4)s.push(R());return new S.init(s,n)}}),f=v.enc={},a=f.Hex={stringify:function(n){for(var s=n.words,t=n.sigBytes,i=[],l=0;l<t;l++){var E=s[l>>>2]>>>24-l%4*8&255;i.push((E>>>4).toString(16)),i.push((E&15).toString(16))}return i.join("")},parse:function(n){for(var s=n.length,t=[],i=0;i<s;i+=2)t[i>>>3]|=parseInt(n.substr(i,2),16)<<24-i%8*4;return new S.init(t,s/2)}},d=f.Latin1={stringify:function(n){for(var s=n.words,t=n.sigBytes,i=[],l=0;l<t;l++){var E=s[l>>>2]>>>24-l%4*8&255;i.push(String.fromCharCode(E))}return i.join("")},parse:function(n){for(var s=n.length,t=[],i=0;i<s;i++)t[i>>>2]|=(n.charCodeAt(i)&255)<<24-i%4*8;return new S.init(t,s)}},p=f.Utf8={stringify:function(n){try{return decodeURIComponent(escape(d.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return d.parse(unescape(encodeURIComponent(n)))}},e=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new S.init,this._nDataBytes=0},_append:function(n){typeof n=="string"&&(n=p.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes},_process:function(n){var s,t=this._data,i=t.words,l=t.sigBytes,E=this.blockSize,b=E*4,_=l/b;n?_=N.ceil(_):_=N.max((_|0)-this._minBufferSize,0);var h=_*E,o=N.min(h*4,l);if(h){for(var g=0;g<h;g+=E)this._doProcessBlock(i,g);s=i.splice(0,h),t.sigBytes-=o}return new S.init(s,o)},clone:function(){var n=u.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});c.Hasher=e.extend({cfg:u.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset()},reset:function(){e.reset.call(this),this._doReset()},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var s=this._doFinalize();return s},blockSize:16,_createHelper:function(n){return function(s,t){return new n.init(t).finalize(s)}},_createHmacHelper:function(n){return function(s,t){return new r.HMAC.init(n,t).finalize(s)}}});var r=v.algo={};return v}(Math);return P})}(st)),st.exports}var ct={exports:{}},nr;function rt(){return nr||(nr=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(N){var J=P,L=J.lib,R=L.Base,x=L.WordArray,v=J.x64={};v.Word=R.extend({init:function(c,u){this.high=c,this.low=u}}),v.WordArray=R.extend({init:function(c,u){c=this.words=c||[],u!=N?this.sigBytes=u:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,u=c.length,S=[],f=0;f<u;f++){var a=c[f];S.push(a.high),S.push(a.low)}return x.create(S,this.sigBytes)},clone:function(){for(var c=R.clone.call(this),u=c.words=this.words.slice(0),S=u.length,f=0;f<S;f++)u[f]=u[f].clone();return c}})}(),P})}(ct)),ct.exports}var ut={exports:{}},ir;function ln(){return ir||(ir=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(){if(typeof ArrayBuffer=="function"){var N=P,J=N.lib,L=J.WordArray,R=L.init,x=L.init=function(v){if(v instanceof ArrayBuffer&&(v=new Uint8Array(v)),(v instanceof Int8Array||typeof Uint8ClampedArray<"u"&&v instanceof Uint8ClampedArray||v instanceof Int16Array||v instanceof Uint16Array||v instanceof Int32Array||v instanceof Uint32Array||v instanceof Float32Array||v instanceof Float64Array)&&(v=new Uint8Array(v.buffer,v.byteOffset,v.byteLength)),v instanceof Uint8Array){for(var c=v.byteLength,u=[],S=0;S<c;S++)u[S>>>2]|=v[S]<<24-S%4*8;R.call(this,u,c)}else R.apply(this,arguments)};x.prototype=L}}(),P.lib.WordArray})}(ut)),ut.exports}var dt={exports:{}},or;function pn(){return or||(or=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.WordArray,R=N.enc;R.Utf16=R.Utf16BE={stringify:function(v){for(var c=v.words,u=v.sigBytes,S=[],f=0;f<u;f+=2){var a=c[f>>>2]>>>16-f%4*8&65535;S.push(String.fromCharCode(a))}return S.join("")},parse:function(v){for(var c=v.length,u=[],S=0;S<c;S++)u[S>>>1]|=v.charCodeAt(S)<<16-S%2*16;return L.create(u,c*2)}},R.Utf16LE={stringify:function(v){for(var c=v.words,u=v.sigBytes,S=[],f=0;f<u;f+=2){var a=x(c[f>>>2]>>>16-f%4*8&65535);S.push(String.fromCharCode(a))}return S.join("")},parse:function(v){for(var c=v.length,u=[],S=0;S<c;S++)u[S>>>1]|=x(v.charCodeAt(S)<<16-S%2*16);return L.create(u,c*2)}};function x(v){return v<<8&4278255360|v>>>8&16711935}}(),P.enc.Utf16})}(dt)),dt.exports}var lt={exports:{}},ar;function Xe(){return ar||(ar=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.WordArray,R=N.enc;R.Base64={stringify:function(v){var c=v.words,u=v.sigBytes,S=this._map;v.clamp();for(var f=[],a=0;a<u;a+=3)for(var d=c[a>>>2]>>>24-a%4*8&255,p=c[a+1>>>2]>>>24-(a+1)%4*8&255,e=c[a+2>>>2]>>>24-(a+2)%4*8&255,r=d<<16|p<<8|e,n=0;n<4&&a+n*.75<u;n++)f.push(S.charAt(r>>>6*(3-n)&63));var s=S.charAt(64);if(s)for(;f.length%4;)f.push(s);return f.join("")},parse:function(v){var c=v.length,u=this._map,S=this._reverseMap;if(!S){S=this._reverseMap=[];for(var f=0;f<u.length;f++)S[u.charCodeAt(f)]=f}var a=u.charAt(64);if(a){var d=v.indexOf(a);d!==-1&&(c=d)}return x(v,c,S)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function x(v,c,u){for(var S=[],f=0,a=0;a<c;a++)if(a%4){var d=u[v.charCodeAt(a-1)]<<a%4*2,p=u[v.charCodeAt(a)]>>>6-a%4*2,e=d|p;S[f>>>2]|=e<<24-f%4*8,f++}return L.create(S,f)}}(),P.enc.Base64})}(lt)),lt.exports}var pt={exports:{}},sr;function fn(){return sr||(sr=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.WordArray,R=N.enc;R.Base64url={stringify:function(v,c){c===void 0&&(c=!0);var u=v.words,S=v.sigBytes,f=c?this._safe_map:this._map;v.clamp();for(var a=[],d=0;d<S;d+=3)for(var p=u[d>>>2]>>>24-d%4*8&255,e=u[d+1>>>2]>>>24-(d+1)%4*8&255,r=u[d+2>>>2]>>>24-(d+2)%4*8&255,n=p<<16|e<<8|r,s=0;s<4&&d+s*.75<S;s++)a.push(f.charAt(n>>>6*(3-s)&63));var t=f.charAt(64);if(t)for(;a.length%4;)a.push(t);return a.join("")},parse:function(v,c){c===void 0&&(c=!0);var u=v.length,S=c?this._safe_map:this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var a=0;a<S.length;a++)f[S.charCodeAt(a)]=a}var d=S.charAt(64);if(d){var p=v.indexOf(d);p!==-1&&(u=p)}return x(v,u,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function x(v,c,u){for(var S=[],f=0,a=0;a<c;a++)if(a%4){var d=u[v.charCodeAt(a-1)]<<a%4*2,p=u[v.charCodeAt(a)]>>>6-a%4*2,e=d|p;S[f>>>2]|=e<<24-f%4*8,f++}return L.create(S,f)}}(),P.enc.Base64url})}(pt)),pt.exports}var ft={exports:{}},cr;function Je(){return cr||(cr=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(N){var J=P,L=J.lib,R=L.WordArray,x=L.Hasher,v=J.algo,c=[];(function(){for(var p=0;p<64;p++)c[p]=N.abs(N.sin(p+1))*4294967296|0})();var u=v.MD5=x.extend({_doReset:function(){this._hash=new R.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,e){for(var r=0;r<16;r++){var n=e+r,s=p[n];p[n]=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360}var t=this._hash.words,i=p[e+0],l=p[e+1],E=p[e+2],b=p[e+3],_=p[e+4],h=p[e+5],o=p[e+6],g=p[e+7],m=p[e+8],T=p[e+9],C=p[e+10],D=p[e+11],y=p[e+12],A=p[e+13],O=p[e+14],j=p[e+15],I=t[0],H=t[1],F=t[2],U=t[3];I=S(I,H,F,U,i,7,c[0]),U=S(U,I,H,F,l,12,c[1]),F=S(F,U,I,H,E,17,c[2]),H=S(H,F,U,I,b,22,c[3]),I=S(I,H,F,U,_,7,c[4]),U=S(U,I,H,F,h,12,c[5]),F=S(F,U,I,H,o,17,c[6]),H=S(H,F,U,I,g,22,c[7]),I=S(I,H,F,U,m,7,c[8]),U=S(U,I,H,F,T,12,c[9]),F=S(F,U,I,H,C,17,c[10]),H=S(H,F,U,I,D,22,c[11]),I=S(I,H,F,U,y,7,c[12]),U=S(U,I,H,F,A,12,c[13]),F=S(F,U,I,H,O,17,c[14]),H=S(H,F,U,I,j,22,c[15]),I=f(I,H,F,U,l,5,c[16]),U=f(U,I,H,F,o,9,c[17]),F=f(F,U,I,H,D,14,c[18]),H=f(H,F,U,I,i,20,c[19]),I=f(I,H,F,U,h,5,c[20]),U=f(U,I,H,F,C,9,c[21]),F=f(F,U,I,H,j,14,c[22]),H=f(H,F,U,I,_,20,c[23]),I=f(I,H,F,U,T,5,c[24]),U=f(U,I,H,F,O,9,c[25]),F=f(F,U,I,H,b,14,c[26]),H=f(H,F,U,I,m,20,c[27]),I=f(I,H,F,U,A,5,c[28]),U=f(U,I,H,F,E,9,c[29]),F=f(F,U,I,H,g,14,c[30]),H=f(H,F,U,I,y,20,c[31]),I=a(I,H,F,U,h,4,c[32]),U=a(U,I,H,F,m,11,c[33]),F=a(F,U,I,H,D,16,c[34]),H=a(H,F,U,I,O,23,c[35]),I=a(I,H,F,U,l,4,c[36]),U=a(U,I,H,F,_,11,c[37]),F=a(F,U,I,H,g,16,c[38]),H=a(H,F,U,I,C,23,c[39]),I=a(I,H,F,U,A,4,c[40]),U=a(U,I,H,F,i,11,c[41]),F=a(F,U,I,H,b,16,c[42]),H=a(H,F,U,I,o,23,c[43]),I=a(I,H,F,U,T,4,c[44]),U=a(U,I,H,F,y,11,c[45]),F=a(F,U,I,H,j,16,c[46]),H=a(H,F,U,I,E,23,c[47]),I=d(I,H,F,U,i,6,c[48]),U=d(U,I,H,F,g,10,c[49]),F=d(F,U,I,H,O,15,c[50]),H=d(H,F,U,I,h,21,c[51]),I=d(I,H,F,U,y,6,c[52]),U=d(U,I,H,F,b,10,c[53]),F=d(F,U,I,H,C,15,c[54]),H=d(H,F,U,I,l,21,c[55]),I=d(I,H,F,U,m,6,c[56]),U=d(U,I,H,F,j,10,c[57]),F=d(F,U,I,H,o,15,c[58]),H=d(H,F,U,I,A,21,c[59]),I=d(I,H,F,U,_,6,c[60]),U=d(U,I,H,F,D,10,c[61]),F=d(F,U,I,H,E,15,c[62]),H=d(H,F,U,I,T,21,c[63]),t[0]=t[0]+I|0,t[1]=t[1]+H|0,t[2]=t[2]+F|0,t[3]=t[3]+U|0},_doFinalize:function(){var p=this._data,e=p.words,r=this._nDataBytes*8,n=p.sigBytes*8;e[n>>>5]|=128<<24-n%32;var s=N.floor(r/4294967296),t=r;e[(n+64>>>9<<4)+15]=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,e[(n+64>>>9<<4)+14]=(t<<8|t>>>24)&16711935|(t<<24|t>>>8)&4278255360,p.sigBytes=(e.length+1)*4,this._process();for(var i=this._hash,l=i.words,E=0;E<4;E++){var b=l[E];l[E]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360}return i},clone:function(){var p=x.clone.call(this);return p._hash=this._hash.clone(),p}});function S(p,e,r,n,s,t,i){var l=p+(e&r|~e&n)+s+i;return(l<<t|l>>>32-t)+e}function f(p,e,r,n,s,t,i){var l=p+(e&n|r&~n)+s+i;return(l<<t|l>>>32-t)+e}function a(p,e,r,n,s,t,i){var l=p+(e^r^n)+s+i;return(l<<t|l>>>32-t)+e}function d(p,e,r,n,s,t,i){var l=p+(r^(e|~n))+s+i;return(l<<t|l>>>32-t)+e}J.MD5=x._createHelper(u),J.HmacMD5=x._createHmacHelper(u)}(Math),P.MD5})}(ft)),ft.exports}var ht={exports:{}},ur;function dr(){return ur||(ur=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.WordArray,R=J.Hasher,x=N.algo,v=[],c=x.SHA1=R.extend({_doReset:function(){this._hash=new L.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,S){for(var f=this._hash.words,a=f[0],d=f[1],p=f[2],e=f[3],r=f[4],n=0;n<80;n++){if(n<16)v[n]=u[S+n]|0;else{var s=v[n-3]^v[n-8]^v[n-14]^v[n-16];v[n]=s<<1|s>>>31}var t=(a<<5|a>>>27)+r+v[n];n<20?t+=(d&p|~d&e)+1518500249:n<40?t+=(d^p^e)+1859775393:n<60?t+=(d&p|d&e|p&e)-1894007588:t+=(d^p^e)-899497514,r=e,e=p,p=d<<30|d>>>2,d=a,a=t}f[0]=f[0]+a|0,f[1]=f[1]+d|0,f[2]=f[2]+p|0,f[3]=f[3]+e|0,f[4]=f[4]+r|0},_doFinalize:function(){var u=this._data,S=u.words,f=this._nDataBytes*8,a=u.sigBytes*8;return S[a>>>5]|=128<<24-a%32,S[(a+64>>>9<<4)+14]=Math.floor(f/4294967296),S[(a+64>>>9<<4)+15]=f,u.sigBytes=S.length*4,this._process(),this._hash},clone:function(){var u=R.clone.call(this);return u._hash=this._hash.clone(),u}});N.SHA1=R._createHelper(c),N.HmacSHA1=R._createHmacHelper(c)}(),P.SHA1})}(ht)),ht.exports}var vt={exports:{}},lr;function mt(){return lr||(lr=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(N){var J=P,L=J.lib,R=L.WordArray,x=L.Hasher,v=J.algo,c=[],u=[];(function(){function a(r){for(var n=N.sqrt(r),s=2;s<=n;s++)if(!(r%s))return!1;return!0}function d(r){return(r-(r|0))*4294967296|0}for(var p=2,e=0;e<64;)a(p)&&(e<8&&(c[e]=d(N.pow(p,1/2))),u[e]=d(N.pow(p,1/3)),e++),p++})();var S=[],f=v.SHA256=x.extend({_doReset:function(){this._hash=new R.init(c.slice(0))},_doProcessBlock:function(a,d){for(var p=this._hash.words,e=p[0],r=p[1],n=p[2],s=p[3],t=p[4],i=p[5],l=p[6],E=p[7],b=0;b<64;b++){if(b<16)S[b]=a[d+b]|0;else{var _=S[b-15],h=(_<<25|_>>>7)^(_<<14|_>>>18)^_>>>3,o=S[b-2],g=(o<<15|o>>>17)^(o<<13|o>>>19)^o>>>10;S[b]=h+S[b-7]+g+S[b-16]}var m=t&i^~t&l,T=e&r^e&n^r&n,C=(e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22),D=(t<<26|t>>>6)^(t<<21|t>>>11)^(t<<7|t>>>25),y=E+D+m+u[b]+S[b],A=C+T;E=l,l=i,i=t,t=s+y|0,s=n,n=r,r=e,e=y+A|0}p[0]=p[0]+e|0,p[1]=p[1]+r|0,p[2]=p[2]+n|0,p[3]=p[3]+s|0,p[4]=p[4]+t|0,p[5]=p[5]+i|0,p[6]=p[6]+l|0,p[7]=p[7]+E|0},_doFinalize:function(){var a=this._data,d=a.words,p=this._nDataBytes*8,e=a.sigBytes*8;return d[e>>>5]|=128<<24-e%32,d[(e+64>>>9<<4)+14]=N.floor(p/4294967296),d[(e+64>>>9<<4)+15]=p,a.sigBytes=d.length*4,this._process(),this._hash},clone:function(){var a=x.clone.call(this);return a._hash=this._hash.clone(),a}});J.SHA256=x._createHelper(f),J.HmacSHA256=x._createHmacHelper(f)}(Math),P.SHA256})}(vt)),vt.exports}var Et={exports:{}},pr;function hn(){return pr||(pr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),mt())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.WordArray,R=N.algo,x=R.SHA256,v=R.SHA224=x.extend({_doReset:function(){this._hash=new L.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=x._doFinalize.call(this);return c.sigBytes-=4,c}});N.SHA224=x._createHelper(v),N.HmacSHA224=x._createHmacHelper(v)}(),P.SHA224})}(Et)),Et.exports}var gt={exports:{}},fr;function hr(){return fr||(fr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),rt())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.Hasher,R=N.x64,x=R.Word,v=R.WordArray,c=N.algo;function u(){return x.create.apply(x,arguments)}var S=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],f=[];(function(){for(var d=0;d<80;d++)f[d]=u()})();var a=c.SHA512=L.extend({_doReset:function(){this._hash=new v.init([new x.init(1779033703,4089235720),new x.init(3144134277,2227873595),new x.init(1013904242,4271175723),new x.init(2773480762,1595750129),new x.init(1359893119,2917565137),new x.init(2600822924,725511199),new x.init(528734635,4215389547),new x.init(1541459225,327033209)])},_doProcessBlock:function(d,p){for(var e=this._hash.words,r=e[0],n=e[1],s=e[2],t=e[3],i=e[4],l=e[5],E=e[6],b=e[7],_=r.high,h=r.low,o=n.high,g=n.low,m=s.high,T=s.low,C=t.high,D=t.low,y=i.high,A=i.low,O=l.high,j=l.low,I=E.high,H=E.low,F=b.high,U=b.low,B=_,k=h,V=o,G=g,q=m,z=T,$=C,re=D,ee=y,ie=A,se=O,ce=j,ue=I,de=H,pe=F,Ee=U,he=0;he<80;he++){var fe,me,ge=f[he];if(he<16)me=ge.high=d[p+he*2]|0,fe=ge.low=d[p+he*2+1]|0;else{var _e=f[he-15],Re=_e.high,Te=_e.low,Ne=(Re>>>1|Te<<31)^(Re>>>8|Te<<24)^Re>>>7,ke=(Te>>>1|Re<<31)^(Te>>>8|Re<<24)^(Te>>>7|Re<<25),Oe=f[he-2],Ce=Oe.high,Ae=Oe.low,Pe=(Ce>>>19|Ae<<13)^(Ce<<3|Ae>>>29)^Ce>>>6,we=(Ae>>>19|Ce<<13)^(Ae<<3|Ce>>>29)^(Ae>>>6|Ce<<26),He=f[he-7],We=He.high,xe=He.low,w=f[he-16],K=w.high,Y=w.low;fe=ke+xe,me=Ne+We+(fe>>>0<ke>>>0?1:0),fe=fe+we,me=me+Pe+(fe>>>0<we>>>0?1:0),fe=fe+Y,me=me+K+(fe>>>0<Y>>>0?1:0),ge.high=me,ge.low=fe}var X=ee&se^~ee&ue,Z=ie&ce^~ie&de,te=B&V^B&q^V&q,Q=k&G^k&z^G&z,oe=(B>>>28|k<<4)^(B<<30|k>>>2)^(B<<25|k>>>7),ne=(k>>>28|B<<4)^(k<<30|B>>>2)^(k<<25|B>>>7),ae=(ee>>>14|ie<<18)^(ee>>>18|ie<<14)^(ee<<23|ie>>>9),le=(ie>>>14|ee<<18)^(ie>>>18|ee<<14)^(ie<<23|ee>>>9),ve=S[he],be=ve.high,je=ve.low,Le=Ee+le,ze=pe+ae+(Le>>>0<Ee>>>0?1:0),Le=Le+Z,ze=ze+X+(Le>>>0<Z>>>0?1:0),Le=Le+je,ze=ze+be+(Le>>>0<je>>>0?1:0),Le=Le+fe,ze=ze+me+(Le>>>0<fe>>>0?1:0),Xt=ne+Q,Jr=oe+te+(Xt>>>0<ne>>>0?1:0);pe=ue,Ee=de,ue=se,de=ce,se=ee,ce=ie,ie=re+Le|0,ee=$+ze+(ie>>>0<re>>>0?1:0)|0,$=q,re=z,q=V,z=G,V=B,G=k,k=Le+Xt|0,B=ze+Jr+(k>>>0<Le>>>0?1:0)|0}h=r.low=h+k,r.high=_+B+(h>>>0<k>>>0?1:0),g=n.low=g+G,n.high=o+V+(g>>>0<G>>>0?1:0),T=s.low=T+z,s.high=m+q+(T>>>0<z>>>0?1:0),D=t.low=D+re,t.high=C+$+(D>>>0<re>>>0?1:0),A=i.low=A+ie,i.high=y+ee+(A>>>0<ie>>>0?1:0),j=l.low=j+ce,l.high=O+se+(j>>>0<ce>>>0?1:0),H=E.low=H+de,E.high=I+ue+(H>>>0<de>>>0?1:0),U=b.low=U+Ee,b.high=F+pe+(U>>>0<Ee>>>0?1:0)},_doFinalize:function(){var d=this._data,p=d.words,e=this._nDataBytes*8,r=d.sigBytes*8;p[r>>>5]|=128<<24-r%32,p[(r+128>>>10<<5)+30]=Math.floor(e/4294967296),p[(r+128>>>10<<5)+31]=e,d.sigBytes=p.length*4,this._process();var n=this._hash.toX32();return n},clone:function(){var d=L.clone.call(this);return d._hash=this._hash.clone(),d},blockSize:1024/32});N.SHA512=L._createHelper(a),N.HmacSHA512=L._createHmacHelper(a)}(),P.SHA512})}(gt)),gt.exports}var yt={exports:{}},vr;function vn(){return vr||(vr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),rt(),hr())})(ye,function(P){return function(){var N=P,J=N.x64,L=J.Word,R=J.WordArray,x=N.algo,v=x.SHA512,c=x.SHA384=v.extend({_doReset:function(){this._hash=new R.init([new L.init(3418070365,3238371032),new L.init(1654270250,914150663),new L.init(2438529370,812702999),new L.init(355462360,4144912697),new L.init(1731405415,4290775857),new L.init(2394180231,1750603025),new L.init(3675008525,1694076839),new L.init(1203062813,3204075428)])},_doFinalize:function(){var u=v._doFinalize.call(this);return u.sigBytes-=16,u}});N.SHA384=v._createHelper(c),N.HmacSHA384=v._createHmacHelper(c)}(),P.SHA384})}(yt)),yt.exports}var xt={exports:{}},mr;function mn(){return mr||(mr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),rt())})(ye,function(P){return function(N){var J=P,L=J.lib,R=L.WordArray,x=L.Hasher,v=J.x64,c=v.Word,u=J.algo,S=[],f=[],a=[];(function(){for(var e=1,r=0,n=0;n<24;n++){S[e+5*r]=(n+1)*(n+2)/2%64;var s=r%5,t=(2*e+3*r)%5;e=s,r=t}for(var e=0;e<5;e++)for(var r=0;r<5;r++)f[e+5*r]=r+(2*e+3*r)%5*5;for(var i=1,l=0;l<24;l++){for(var E=0,b=0,_=0;_<7;_++){if(i&1){var h=(1<<_)-1;h<32?b^=1<<h:E^=1<<h-32}i&128?i=i<<1^113:i<<=1}a[l]=c.create(E,b)}})();var d=[];(function(){for(var e=0;e<25;e++)d[e]=c.create()})();var p=u.SHA3=x.extend({cfg:x.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],r=0;r<25;r++)e[r]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,r){for(var n=this._state,s=this.blockSize/2,t=0;t<s;t++){var i=e[r+2*t],l=e[r+2*t+1];i=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360,l=(l<<8|l>>>24)&16711935|(l<<24|l>>>8)&4278255360;var E=n[t];E.high^=l,E.low^=i}for(var b=0;b<24;b++){for(var _=0;_<5;_++){for(var h=0,o=0,g=0;g<5;g++){var E=n[_+5*g];h^=E.high,o^=E.low}var m=d[_];m.high=h,m.low=o}for(var _=0;_<5;_++)for(var T=d[(_+4)%5],C=d[(_+1)%5],D=C.high,y=C.low,h=T.high^(D<<1|y>>>31),o=T.low^(y<<1|D>>>31),g=0;g<5;g++){var E=n[_+5*g];E.high^=h,E.low^=o}for(var A=1;A<25;A++){var h,o,E=n[A],O=E.high,j=E.low,I=S[A];I<32?(h=O<<I|j>>>32-I,o=j<<I|O>>>32-I):(h=j<<I-32|O>>>64-I,o=O<<I-32|j>>>64-I);var H=d[f[A]];H.high=h,H.low=o}var F=d[0],U=n[0];F.high=U.high,F.low=U.low;for(var _=0;_<5;_++)for(var g=0;g<5;g++){var A=_+5*g,E=n[A],B=d[A],k=d[(_+1)%5+5*g],V=d[(_+2)%5+5*g];E.high=B.high^~k.high&V.high,E.low=B.low^~k.low&V.low}var E=n[0],G=a[b];E.high^=G.high,E.low^=G.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes*8;var n=e.sigBytes*8,s=this.blockSize*32;r[n>>>5]|=1<<24-n%32,r[(N.ceil((n+1)/s)*s>>>5)-1]|=128,e.sigBytes=r.length*4,this._process();for(var t=this._state,i=this.cfg.outputLength/8,l=i/8,E=[],b=0;b<l;b++){var _=t[b],h=_.high,o=_.low;h=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,o=(o<<8|o>>>24)&16711935|(o<<24|o>>>8)&4278255360,E.push(o),E.push(h)}return new R.init(E,i)},clone:function(){for(var e=x.clone.call(this),r=e._state=this._state.slice(0),n=0;n<25;n++)r[n]=r[n].clone();return e}});J.SHA3=x._createHelper(p),J.HmacSHA3=x._createHmacHelper(p)}(Math),P.SHA3})}(xt)),xt.exports}var St={exports:{}},Er;function En(){return Er||(Er=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){/** @preserve
3
+ `+N),console.error("Failed log data:",W))}})}class er extends nn{constructor(M){const P=Object.assign({},M,{installUnloadHook:N=>{window.addEventListener("beforeunload",()=>{N()})},sendPayload:(N,J)=>{sn(N,J)}});super(P)}useStsPlugin(M){this.getOpt().sendPayload=(P,N)=>{cn(P,N,M)},this.overwriteTransString(M)}}$t(window,"SLS_Tracker",er);var ye=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function un(W){return W&&W.__esModule&&Object.prototype.hasOwnProperty.call(W,"default")?W.default:W}var tr={exports:{}};function dn(W){throw new Error('Could not dynamically require "'+W+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var st={exports:{}},rr;function Se(){return rr||(rr=1,function(W,M){(function(P,N){W.exports=N()})(ye,function(){var P=P||function(N,J){var L;if(typeof window<"u"&&window.crypto&&(L=window.crypto),typeof self<"u"&&self.crypto&&(L=self.crypto),typeof globalThis<"u"&&globalThis.crypto&&(L=globalThis.crypto),!L&&typeof window<"u"&&window.msCrypto&&(L=window.msCrypto),!L&&typeof ye<"u"&&ye.crypto&&(L=ye.crypto),!L&&typeof dn=="function")try{L=require("crypto")}catch{}var R=function(){if(L){if(typeof L.getRandomValues=="function")try{return L.getRandomValues(new Uint32Array(1))[0]}catch{}if(typeof L.randomBytes=="function")try{return L.randomBytes(4).readInt32LE()}catch{}}throw new Error("Native crypto module could not be used to get secure random number.")},x=Object.create||function(){function n(){}return function(s){var t;return n.prototype=s,t=new n,n.prototype=null,t}}(),v={},c=v.lib={},u=c.Base=function(){return{extend:function(n){var s=x(this);return n&&s.mixIn(n),(!s.hasOwnProperty("init")||this.init===s.init)&&(s.init=function(){s.$super.init.apply(this,arguments)}),s.init.prototype=s,s.$super=this,s},create:function(){var n=this.extend();return n.init.apply(n,arguments),n},init:function(){},mixIn:function(n){for(var s in n)n.hasOwnProperty(s)&&(this[s]=n[s]);n.hasOwnProperty("toString")&&(this.toString=n.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),S=c.WordArray=u.extend({init:function(n,s){n=this.words=n||[],s!=J?this.sigBytes=s:this.sigBytes=n.length*4},toString:function(n){return(n||a).stringify(this)},concat:function(n){var s=this.words,t=n.words,i=this.sigBytes,l=n.sigBytes;if(this.clamp(),i%4)for(var E=0;E<l;E++){var b=t[E>>>2]>>>24-E%4*8&255;s[i+E>>>2]|=b<<24-(i+E)%4*8}else for(var _=0;_<l;_+=4)s[i+_>>>2]=t[_>>>2];return this.sigBytes+=l,this},clamp:function(){var n=this.words,s=this.sigBytes;n[s>>>2]&=4294967295<<32-s%4*8,n.length=N.ceil(s/4)},clone:function(){var n=u.clone.call(this);return n.words=this.words.slice(0),n},random:function(n){for(var s=[],t=0;t<n;t+=4)s.push(R());return new S.init(s,n)}}),f=v.enc={},a=f.Hex={stringify:function(n){for(var s=n.words,t=n.sigBytes,i=[],l=0;l<t;l++){var E=s[l>>>2]>>>24-l%4*8&255;i.push((E>>>4).toString(16)),i.push((E&15).toString(16))}return i.join("")},parse:function(n){for(var s=n.length,t=[],i=0;i<s;i+=2)t[i>>>3]|=parseInt(n.substr(i,2),16)<<24-i%8*4;return new S.init(t,s/2)}},d=f.Latin1={stringify:function(n){for(var s=n.words,t=n.sigBytes,i=[],l=0;l<t;l++){var E=s[l>>>2]>>>24-l%4*8&255;i.push(String.fromCharCode(E))}return i.join("")},parse:function(n){for(var s=n.length,t=[],i=0;i<s;i++)t[i>>>2]|=(n.charCodeAt(i)&255)<<24-i%4*8;return new S.init(t,s)}},p=f.Utf8={stringify:function(n){try{return decodeURIComponent(escape(d.stringify(n)))}catch{throw new Error("Malformed UTF-8 data")}},parse:function(n){return d.parse(unescape(encodeURIComponent(n)))}},e=c.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new S.init,this._nDataBytes=0},_append:function(n){typeof n=="string"&&(n=p.parse(n)),this._data.concat(n),this._nDataBytes+=n.sigBytes},_process:function(n){var s,t=this._data,i=t.words,l=t.sigBytes,E=this.blockSize,b=E*4,_=l/b;n?_=N.ceil(_):_=N.max((_|0)-this._minBufferSize,0);var h=_*E,o=N.min(h*4,l);if(h){for(var g=0;g<h;g+=E)this._doProcessBlock(i,g);s=i.splice(0,h),t.sigBytes-=o}return new S.init(s,o)},clone:function(){var n=u.clone.call(this);return n._data=this._data.clone(),n},_minBufferSize:0});c.Hasher=e.extend({cfg:u.extend(),init:function(n){this.cfg=this.cfg.extend(n),this.reset()},reset:function(){e.reset.call(this),this._doReset()},update:function(n){return this._append(n),this._process(),this},finalize:function(n){n&&this._append(n);var s=this._doFinalize();return s},blockSize:16,_createHelper:function(n){return function(s,t){return new n.init(t).finalize(s)}},_createHmacHelper:function(n){return function(s,t){return new r.HMAC.init(n,t).finalize(s)}}});var r=v.algo={};return v}(Math);return P})}(st)),st.exports}var ct={exports:{}},nr;function rt(){return nr||(nr=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(N){var J=P,L=J.lib,R=L.Base,x=L.WordArray,v=J.x64={};v.Word=R.extend({init:function(c,u){this.high=c,this.low=u}}),v.WordArray=R.extend({init:function(c,u){c=this.words=c||[],u!=N?this.sigBytes=u:this.sigBytes=c.length*8},toX32:function(){for(var c=this.words,u=c.length,S=[],f=0;f<u;f++){var a=c[f];S.push(a.high),S.push(a.low)}return x.create(S,this.sigBytes)},clone:function(){for(var c=R.clone.call(this),u=c.words=this.words.slice(0),S=u.length,f=0;f<S;f++)u[f]=u[f].clone();return c}})}(),P})}(ct)),ct.exports}var ut={exports:{}},ir;function ln(){return ir||(ir=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(){if(typeof ArrayBuffer=="function"){var N=P,J=N.lib,L=J.WordArray,R=L.init,x=L.init=function(v){if(v instanceof ArrayBuffer&&(v=new Uint8Array(v)),(v instanceof Int8Array||typeof Uint8ClampedArray<"u"&&v instanceof Uint8ClampedArray||v instanceof Int16Array||v instanceof Uint16Array||v instanceof Int32Array||v instanceof Uint32Array||v instanceof Float32Array||v instanceof Float64Array)&&(v=new Uint8Array(v.buffer,v.byteOffset,v.byteLength)),v instanceof Uint8Array){for(var c=v.byteLength,u=[],S=0;S<c;S++)u[S>>>2]|=v[S]<<24-S%4*8;R.call(this,u,c)}else R.apply(this,arguments)};x.prototype=L}}(),P.lib.WordArray})}(ut)),ut.exports}var dt={exports:{}},or;function pn(){return or||(or=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.WordArray,R=N.enc;R.Utf16=R.Utf16BE={stringify:function(v){for(var c=v.words,u=v.sigBytes,S=[],f=0;f<u;f+=2){var a=c[f>>>2]>>>16-f%4*8&65535;S.push(String.fromCharCode(a))}return S.join("")},parse:function(v){for(var c=v.length,u=[],S=0;S<c;S++)u[S>>>1]|=v.charCodeAt(S)<<16-S%2*16;return L.create(u,c*2)}},R.Utf16LE={stringify:function(v){for(var c=v.words,u=v.sigBytes,S=[],f=0;f<u;f+=2){var a=x(c[f>>>2]>>>16-f%4*8&65535);S.push(String.fromCharCode(a))}return S.join("")},parse:function(v){for(var c=v.length,u=[],S=0;S<c;S++)u[S>>>1]|=x(v.charCodeAt(S)<<16-S%2*16);return L.create(u,c*2)}};function x(v){return v<<8&4278255360|v>>>8&16711935}}(),P.enc.Utf16})}(dt)),dt.exports}var lt={exports:{}},ar;function Je(){return ar||(ar=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.WordArray,R=N.enc;R.Base64={stringify:function(v){var c=v.words,u=v.sigBytes,S=this._map;v.clamp();for(var f=[],a=0;a<u;a+=3)for(var d=c[a>>>2]>>>24-a%4*8&255,p=c[a+1>>>2]>>>24-(a+1)%4*8&255,e=c[a+2>>>2]>>>24-(a+2)%4*8&255,r=d<<16|p<<8|e,n=0;n<4&&a+n*.75<u;n++)f.push(S.charAt(r>>>6*(3-n)&63));var s=S.charAt(64);if(s)for(;f.length%4;)f.push(s);return f.join("")},parse:function(v){var c=v.length,u=this._map,S=this._reverseMap;if(!S){S=this._reverseMap=[];for(var f=0;f<u.length;f++)S[u.charCodeAt(f)]=f}var a=u.charAt(64);if(a){var d=v.indexOf(a);d!==-1&&(c=d)}return x(v,c,S)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="};function x(v,c,u){for(var S=[],f=0,a=0;a<c;a++)if(a%4){var d=u[v.charCodeAt(a-1)]<<a%4*2,p=u[v.charCodeAt(a)]>>>6-a%4*2,e=d|p;S[f>>>2]|=e<<24-f%4*8,f++}return L.create(S,f)}}(),P.enc.Base64})}(lt)),lt.exports}var pt={exports:{}},sr;function fn(){return sr||(sr=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.WordArray,R=N.enc;R.Base64url={stringify:function(v,c){c===void 0&&(c=!0);var u=v.words,S=v.sigBytes,f=c?this._safe_map:this._map;v.clamp();for(var a=[],d=0;d<S;d+=3)for(var p=u[d>>>2]>>>24-d%4*8&255,e=u[d+1>>>2]>>>24-(d+1)%4*8&255,r=u[d+2>>>2]>>>24-(d+2)%4*8&255,n=p<<16|e<<8|r,s=0;s<4&&d+s*.75<S;s++)a.push(f.charAt(n>>>6*(3-s)&63));var t=f.charAt(64);if(t)for(;a.length%4;)a.push(t);return a.join("")},parse:function(v,c){c===void 0&&(c=!0);var u=v.length,S=c?this._safe_map:this._map,f=this._reverseMap;if(!f){f=this._reverseMap=[];for(var a=0;a<S.length;a++)f[S.charCodeAt(a)]=a}var d=S.charAt(64);if(d){var p=v.indexOf(d);p!==-1&&(u=p)}return x(v,u,f)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"};function x(v,c,u){for(var S=[],f=0,a=0;a<c;a++)if(a%4){var d=u[v.charCodeAt(a-1)]<<a%4*2,p=u[v.charCodeAt(a)]>>>6-a%4*2,e=d|p;S[f>>>2]|=e<<24-f%4*8,f++}return L.create(S,f)}}(),P.enc.Base64url})}(pt)),pt.exports}var ft={exports:{}},cr;function Qe(){return cr||(cr=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(N){var J=P,L=J.lib,R=L.WordArray,x=L.Hasher,v=J.algo,c=[];(function(){for(var p=0;p<64;p++)c[p]=N.abs(N.sin(p+1))*4294967296|0})();var u=v.MD5=x.extend({_doReset:function(){this._hash=new R.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,e){for(var r=0;r<16;r++){var n=e+r,s=p[n];p[n]=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360}var t=this._hash.words,i=p[e+0],l=p[e+1],E=p[e+2],b=p[e+3],_=p[e+4],h=p[e+5],o=p[e+6],g=p[e+7],m=p[e+8],T=p[e+9],C=p[e+10],D=p[e+11],y=p[e+12],A=p[e+13],w=p[e+14],j=p[e+15],I=t[0],H=t[1],F=t[2],U=t[3];I=S(I,H,F,U,i,7,c[0]),U=S(U,I,H,F,l,12,c[1]),F=S(F,U,I,H,E,17,c[2]),H=S(H,F,U,I,b,22,c[3]),I=S(I,H,F,U,_,7,c[4]),U=S(U,I,H,F,h,12,c[5]),F=S(F,U,I,H,o,17,c[6]),H=S(H,F,U,I,g,22,c[7]),I=S(I,H,F,U,m,7,c[8]),U=S(U,I,H,F,T,12,c[9]),F=S(F,U,I,H,C,17,c[10]),H=S(H,F,U,I,D,22,c[11]),I=S(I,H,F,U,y,7,c[12]),U=S(U,I,H,F,A,12,c[13]),F=S(F,U,I,H,w,17,c[14]),H=S(H,F,U,I,j,22,c[15]),I=f(I,H,F,U,l,5,c[16]),U=f(U,I,H,F,o,9,c[17]),F=f(F,U,I,H,D,14,c[18]),H=f(H,F,U,I,i,20,c[19]),I=f(I,H,F,U,h,5,c[20]),U=f(U,I,H,F,C,9,c[21]),F=f(F,U,I,H,j,14,c[22]),H=f(H,F,U,I,_,20,c[23]),I=f(I,H,F,U,T,5,c[24]),U=f(U,I,H,F,w,9,c[25]),F=f(F,U,I,H,b,14,c[26]),H=f(H,F,U,I,m,20,c[27]),I=f(I,H,F,U,A,5,c[28]),U=f(U,I,H,F,E,9,c[29]),F=f(F,U,I,H,g,14,c[30]),H=f(H,F,U,I,y,20,c[31]),I=a(I,H,F,U,h,4,c[32]),U=a(U,I,H,F,m,11,c[33]),F=a(F,U,I,H,D,16,c[34]),H=a(H,F,U,I,w,23,c[35]),I=a(I,H,F,U,l,4,c[36]),U=a(U,I,H,F,_,11,c[37]),F=a(F,U,I,H,g,16,c[38]),H=a(H,F,U,I,C,23,c[39]),I=a(I,H,F,U,A,4,c[40]),U=a(U,I,H,F,i,11,c[41]),F=a(F,U,I,H,b,16,c[42]),H=a(H,F,U,I,o,23,c[43]),I=a(I,H,F,U,T,4,c[44]),U=a(U,I,H,F,y,11,c[45]),F=a(F,U,I,H,j,16,c[46]),H=a(H,F,U,I,E,23,c[47]),I=d(I,H,F,U,i,6,c[48]),U=d(U,I,H,F,g,10,c[49]),F=d(F,U,I,H,w,15,c[50]),H=d(H,F,U,I,h,21,c[51]),I=d(I,H,F,U,y,6,c[52]),U=d(U,I,H,F,b,10,c[53]),F=d(F,U,I,H,C,15,c[54]),H=d(H,F,U,I,l,21,c[55]),I=d(I,H,F,U,m,6,c[56]),U=d(U,I,H,F,j,10,c[57]),F=d(F,U,I,H,o,15,c[58]),H=d(H,F,U,I,A,21,c[59]),I=d(I,H,F,U,_,6,c[60]),U=d(U,I,H,F,D,10,c[61]),F=d(F,U,I,H,E,15,c[62]),H=d(H,F,U,I,T,21,c[63]),t[0]=t[0]+I|0,t[1]=t[1]+H|0,t[2]=t[2]+F|0,t[3]=t[3]+U|0},_doFinalize:function(){var p=this._data,e=p.words,r=this._nDataBytes*8,n=p.sigBytes*8;e[n>>>5]|=128<<24-n%32;var s=N.floor(r/4294967296),t=r;e[(n+64>>>9<<4)+15]=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,e[(n+64>>>9<<4)+14]=(t<<8|t>>>24)&16711935|(t<<24|t>>>8)&4278255360,p.sigBytes=(e.length+1)*4,this._process();for(var i=this._hash,l=i.words,E=0;E<4;E++){var b=l[E];l[E]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360}return i},clone:function(){var p=x.clone.call(this);return p._hash=this._hash.clone(),p}});function S(p,e,r,n,s,t,i){var l=p+(e&r|~e&n)+s+i;return(l<<t|l>>>32-t)+e}function f(p,e,r,n,s,t,i){var l=p+(e&n|r&~n)+s+i;return(l<<t|l>>>32-t)+e}function a(p,e,r,n,s,t,i){var l=p+(e^r^n)+s+i;return(l<<t|l>>>32-t)+e}function d(p,e,r,n,s,t,i){var l=p+(r^(e|~n))+s+i;return(l<<t|l>>>32-t)+e}J.MD5=x._createHelper(u),J.HmacMD5=x._createHmacHelper(u)}(Math),P.MD5})}(ft)),ft.exports}var ht={exports:{}},ur;function dr(){return ur||(ur=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.WordArray,R=J.Hasher,x=N.algo,v=[],c=x.SHA1=R.extend({_doReset:function(){this._hash=new L.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(u,S){for(var f=this._hash.words,a=f[0],d=f[1],p=f[2],e=f[3],r=f[4],n=0;n<80;n++){if(n<16)v[n]=u[S+n]|0;else{var s=v[n-3]^v[n-8]^v[n-14]^v[n-16];v[n]=s<<1|s>>>31}var t=(a<<5|a>>>27)+r+v[n];n<20?t+=(d&p|~d&e)+1518500249:n<40?t+=(d^p^e)+1859775393:n<60?t+=(d&p|d&e|p&e)-1894007588:t+=(d^p^e)-899497514,r=e,e=p,p=d<<30|d>>>2,d=a,a=t}f[0]=f[0]+a|0,f[1]=f[1]+d|0,f[2]=f[2]+p|0,f[3]=f[3]+e|0,f[4]=f[4]+r|0},_doFinalize:function(){var u=this._data,S=u.words,f=this._nDataBytes*8,a=u.sigBytes*8;return S[a>>>5]|=128<<24-a%32,S[(a+64>>>9<<4)+14]=Math.floor(f/4294967296),S[(a+64>>>9<<4)+15]=f,u.sigBytes=S.length*4,this._process(),this._hash},clone:function(){var u=R.clone.call(this);return u._hash=this._hash.clone(),u}});N.SHA1=R._createHelper(c),N.HmacSHA1=R._createHmacHelper(c)}(),P.SHA1})}(ht)),ht.exports}var vt={exports:{}},lr;function mt(){return lr||(lr=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){return function(N){var J=P,L=J.lib,R=L.WordArray,x=L.Hasher,v=J.algo,c=[],u=[];(function(){function a(r){for(var n=N.sqrt(r),s=2;s<=n;s++)if(!(r%s))return!1;return!0}function d(r){return(r-(r|0))*4294967296|0}for(var p=2,e=0;e<64;)a(p)&&(e<8&&(c[e]=d(N.pow(p,1/2))),u[e]=d(N.pow(p,1/3)),e++),p++})();var S=[],f=v.SHA256=x.extend({_doReset:function(){this._hash=new R.init(c.slice(0))},_doProcessBlock:function(a,d){for(var p=this._hash.words,e=p[0],r=p[1],n=p[2],s=p[3],t=p[4],i=p[5],l=p[6],E=p[7],b=0;b<64;b++){if(b<16)S[b]=a[d+b]|0;else{var _=S[b-15],h=(_<<25|_>>>7)^(_<<14|_>>>18)^_>>>3,o=S[b-2],g=(o<<15|o>>>17)^(o<<13|o>>>19)^o>>>10;S[b]=h+S[b-7]+g+S[b-16]}var m=t&i^~t&l,T=e&r^e&n^r&n,C=(e<<30|e>>>2)^(e<<19|e>>>13)^(e<<10|e>>>22),D=(t<<26|t>>>6)^(t<<21|t>>>11)^(t<<7|t>>>25),y=E+D+m+u[b]+S[b],A=C+T;E=l,l=i,i=t,t=s+y|0,s=n,n=r,r=e,e=y+A|0}p[0]=p[0]+e|0,p[1]=p[1]+r|0,p[2]=p[2]+n|0,p[3]=p[3]+s|0,p[4]=p[4]+t|0,p[5]=p[5]+i|0,p[6]=p[6]+l|0,p[7]=p[7]+E|0},_doFinalize:function(){var a=this._data,d=a.words,p=this._nDataBytes*8,e=a.sigBytes*8;return d[e>>>5]|=128<<24-e%32,d[(e+64>>>9<<4)+14]=N.floor(p/4294967296),d[(e+64>>>9<<4)+15]=p,a.sigBytes=d.length*4,this._process(),this._hash},clone:function(){var a=x.clone.call(this);return a._hash=this._hash.clone(),a}});J.SHA256=x._createHelper(f),J.HmacSHA256=x._createHmacHelper(f)}(Math),P.SHA256})}(vt)),vt.exports}var Et={exports:{}},pr;function hn(){return pr||(pr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),mt())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.WordArray,R=N.algo,x=R.SHA256,v=R.SHA224=x.extend({_doReset:function(){this._hash=new L.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var c=x._doFinalize.call(this);return c.sigBytes-=4,c}});N.SHA224=x._createHelper(v),N.HmacSHA224=x._createHmacHelper(v)}(),P.SHA224})}(Et)),Et.exports}var gt={exports:{}},fr;function hr(){return fr||(fr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),rt())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.Hasher,R=N.x64,x=R.Word,v=R.WordArray,c=N.algo;function u(){return x.create.apply(x,arguments)}var S=[u(1116352408,3609767458),u(1899447441,602891725),u(3049323471,3964484399),u(3921009573,2173295548),u(961987163,4081628472),u(1508970993,3053834265),u(2453635748,2937671579),u(2870763221,3664609560),u(3624381080,2734883394),u(310598401,1164996542),u(607225278,1323610764),u(1426881987,3590304994),u(1925078388,4068182383),u(2162078206,991336113),u(2614888103,633803317),u(3248222580,3479774868),u(3835390401,2666613458),u(4022224774,944711139),u(264347078,2341262773),u(604807628,2007800933),u(770255983,1495990901),u(1249150122,1856431235),u(1555081692,3175218132),u(1996064986,2198950837),u(2554220882,3999719339),u(2821834349,766784016),u(2952996808,2566594879),u(3210313671,3203337956),u(3336571891,1034457026),u(3584528711,2466948901),u(113926993,3758326383),u(338241895,168717936),u(666307205,1188179964),u(773529912,1546045734),u(1294757372,1522805485),u(1396182291,2643833823),u(1695183700,2343527390),u(1986661051,1014477480),u(2177026350,1206759142),u(2456956037,344077627),u(2730485921,1290863460),u(2820302411,3158454273),u(3259730800,3505952657),u(3345764771,106217008),u(3516065817,3606008344),u(3600352804,1432725776),u(4094571909,1467031594),u(275423344,851169720),u(430227734,3100823752),u(506948616,1363258195),u(659060556,3750685593),u(883997877,3785050280),u(958139571,3318307427),u(1322822218,3812723403),u(1537002063,2003034995),u(1747873779,3602036899),u(1955562222,1575990012),u(2024104815,1125592928),u(2227730452,2716904306),u(2361852424,442776044),u(2428436474,593698344),u(2756734187,3733110249),u(3204031479,2999351573),u(3329325298,3815920427),u(3391569614,3928383900),u(3515267271,566280711),u(3940187606,3454069534),u(4118630271,4000239992),u(116418474,1914138554),u(174292421,2731055270),u(289380356,3203993006),u(460393269,320620315),u(685471733,587496836),u(852142971,1086792851),u(1017036298,365543100),u(1126000580,2618297676),u(1288033470,3409855158),u(1501505948,4234509866),u(1607167915,987167468),u(1816402316,1246189591)],f=[];(function(){for(var d=0;d<80;d++)f[d]=u()})();var a=c.SHA512=L.extend({_doReset:function(){this._hash=new v.init([new x.init(1779033703,4089235720),new x.init(3144134277,2227873595),new x.init(1013904242,4271175723),new x.init(2773480762,1595750129),new x.init(1359893119,2917565137),new x.init(2600822924,725511199),new x.init(528734635,4215389547),new x.init(1541459225,327033209)])},_doProcessBlock:function(d,p){for(var e=this._hash.words,r=e[0],n=e[1],s=e[2],t=e[3],i=e[4],l=e[5],E=e[6],b=e[7],_=r.high,h=r.low,o=n.high,g=n.low,m=s.high,T=s.low,C=t.high,D=t.low,y=i.high,A=i.low,w=l.high,j=l.low,I=E.high,H=E.low,F=b.high,U=b.low,B=_,k=h,V=o,G=g,q=m,z=T,$=C,re=D,ee=y,ie=A,se=w,ce=j,ue=I,de=H,pe=F,Ee=U,he=0;he<80;he++){var fe,me,ge=f[he];if(he<16)me=ge.high=d[p+he*2]|0,fe=ge.low=d[p+he*2+1]|0;else{var _e=f[he-15],Re=_e.high,Te=_e.low,Ne=(Re>>>1|Te<<31)^(Re>>>8|Te<<24)^Re>>>7,ke=(Te>>>1|Re<<31)^(Te>>>8|Re<<24)^(Te>>>7|Re<<25),we=f[he-2],Ce=we.high,Ae=we.low,Pe=(Ce>>>19|Ae<<13)^(Ce<<3|Ae>>>29)^Ce>>>6,Oe=(Ae>>>19|Ce<<13)^(Ae<<3|Ce>>>29)^(Ae>>>6|Ce<<26),He=f[he-7],We=He.high,xe=He.low,O=f[he-16],K=O.high,Y=O.low;fe=ke+xe,me=Ne+We+(fe>>>0<ke>>>0?1:0),fe=fe+Oe,me=me+Pe+(fe>>>0<Oe>>>0?1:0),fe=fe+Y,me=me+K+(fe>>>0<Y>>>0?1:0),ge.high=me,ge.low=fe}var X=ee&se^~ee&ue,Z=ie&ce^~ie&de,te=B&V^B&q^V&q,Q=k&G^k&z^G&z,oe=(B>>>28|k<<4)^(B<<30|k>>>2)^(B<<25|k>>>7),ne=(k>>>28|B<<4)^(k<<30|B>>>2)^(k<<25|B>>>7),ae=(ee>>>14|ie<<18)^(ee>>>18|ie<<14)^(ee<<23|ie>>>9),le=(ie>>>14|ee<<18)^(ie>>>18|ee<<14)^(ie<<23|ee>>>9),ve=S[he],be=ve.high,je=ve.low,Le=Ee+le,ze=pe+ae+(Le>>>0<Ee>>>0?1:0),Le=Le+Z,ze=ze+X+(Le>>>0<Z>>>0?1:0),Le=Le+je,ze=ze+be+(Le>>>0<je>>>0?1:0),Le=Le+fe,ze=ze+me+(Le>>>0<fe>>>0?1:0),Xt=ne+Q,Jr=oe+te+(Xt>>>0<ne>>>0?1:0);pe=ue,Ee=de,ue=se,de=ce,se=ee,ce=ie,ie=re+Le|0,ee=$+ze+(ie>>>0<re>>>0?1:0)|0,$=q,re=z,q=V,z=G,V=B,G=k,k=Le+Xt|0,B=ze+Jr+(k>>>0<Le>>>0?1:0)|0}h=r.low=h+k,r.high=_+B+(h>>>0<k>>>0?1:0),g=n.low=g+G,n.high=o+V+(g>>>0<G>>>0?1:0),T=s.low=T+z,s.high=m+q+(T>>>0<z>>>0?1:0),D=t.low=D+re,t.high=C+$+(D>>>0<re>>>0?1:0),A=i.low=A+ie,i.high=y+ee+(A>>>0<ie>>>0?1:0),j=l.low=j+ce,l.high=w+se+(j>>>0<ce>>>0?1:0),H=E.low=H+de,E.high=I+ue+(H>>>0<de>>>0?1:0),U=b.low=U+Ee,b.high=F+pe+(U>>>0<Ee>>>0?1:0)},_doFinalize:function(){var d=this._data,p=d.words,e=this._nDataBytes*8,r=d.sigBytes*8;p[r>>>5]|=128<<24-r%32,p[(r+128>>>10<<5)+30]=Math.floor(e/4294967296),p[(r+128>>>10<<5)+31]=e,d.sigBytes=p.length*4,this._process();var n=this._hash.toX32();return n},clone:function(){var d=L.clone.call(this);return d._hash=this._hash.clone(),d},blockSize:1024/32});N.SHA512=L._createHelper(a),N.HmacSHA512=L._createHmacHelper(a)}(),P.SHA512})}(gt)),gt.exports}var yt={exports:{}},vr;function vn(){return vr||(vr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),rt(),hr())})(ye,function(P){return function(){var N=P,J=N.x64,L=J.Word,R=J.WordArray,x=N.algo,v=x.SHA512,c=x.SHA384=v.extend({_doReset:function(){this._hash=new R.init([new L.init(3418070365,3238371032),new L.init(1654270250,914150663),new L.init(2438529370,812702999),new L.init(355462360,4144912697),new L.init(1731405415,4290775857),new L.init(2394180231,1750603025),new L.init(3675008525,1694076839),new L.init(1203062813,3204075428)])},_doFinalize:function(){var u=v._doFinalize.call(this);return u.sigBytes-=16,u}});N.SHA384=v._createHelper(c),N.HmacSHA384=v._createHmacHelper(c)}(),P.SHA384})}(yt)),yt.exports}var xt={exports:{}},mr;function mn(){return mr||(mr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),rt())})(ye,function(P){return function(N){var J=P,L=J.lib,R=L.WordArray,x=L.Hasher,v=J.x64,c=v.Word,u=J.algo,S=[],f=[],a=[];(function(){for(var e=1,r=0,n=0;n<24;n++){S[e+5*r]=(n+1)*(n+2)/2%64;var s=r%5,t=(2*e+3*r)%5;e=s,r=t}for(var e=0;e<5;e++)for(var r=0;r<5;r++)f[e+5*r]=r+(2*e+3*r)%5*5;for(var i=1,l=0;l<24;l++){for(var E=0,b=0,_=0;_<7;_++){if(i&1){var h=(1<<_)-1;h<32?b^=1<<h:E^=1<<h-32}i&128?i=i<<1^113:i<<=1}a[l]=c.create(E,b)}})();var d=[];(function(){for(var e=0;e<25;e++)d[e]=c.create()})();var p=u.SHA3=x.extend({cfg:x.cfg.extend({outputLength:512}),_doReset:function(){for(var e=this._state=[],r=0;r<25;r++)e[r]=new c.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(e,r){for(var n=this._state,s=this.blockSize/2,t=0;t<s;t++){var i=e[r+2*t],l=e[r+2*t+1];i=(i<<8|i>>>24)&16711935|(i<<24|i>>>8)&4278255360,l=(l<<8|l>>>24)&16711935|(l<<24|l>>>8)&4278255360;var E=n[t];E.high^=l,E.low^=i}for(var b=0;b<24;b++){for(var _=0;_<5;_++){for(var h=0,o=0,g=0;g<5;g++){var E=n[_+5*g];h^=E.high,o^=E.low}var m=d[_];m.high=h,m.low=o}for(var _=0;_<5;_++)for(var T=d[(_+4)%5],C=d[(_+1)%5],D=C.high,y=C.low,h=T.high^(D<<1|y>>>31),o=T.low^(y<<1|D>>>31),g=0;g<5;g++){var E=n[_+5*g];E.high^=h,E.low^=o}for(var A=1;A<25;A++){var h,o,E=n[A],w=E.high,j=E.low,I=S[A];I<32?(h=w<<I|j>>>32-I,o=j<<I|w>>>32-I):(h=j<<I-32|w>>>64-I,o=w<<I-32|j>>>64-I);var H=d[f[A]];H.high=h,H.low=o}var F=d[0],U=n[0];F.high=U.high,F.low=U.low;for(var _=0;_<5;_++)for(var g=0;g<5;g++){var A=_+5*g,E=n[A],B=d[A],k=d[(_+1)%5+5*g],V=d[(_+2)%5+5*g];E.high=B.high^~k.high&V.high,E.low=B.low^~k.low&V.low}var E=n[0],G=a[b];E.high^=G.high,E.low^=G.low}},_doFinalize:function(){var e=this._data,r=e.words;this._nDataBytes*8;var n=e.sigBytes*8,s=this.blockSize*32;r[n>>>5]|=1<<24-n%32,r[(N.ceil((n+1)/s)*s>>>5)-1]|=128,e.sigBytes=r.length*4,this._process();for(var t=this._state,i=this.cfg.outputLength/8,l=i/8,E=[],b=0;b<l;b++){var _=t[b],h=_.high,o=_.low;h=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360,o=(o<<8|o>>>24)&16711935|(o<<24|o>>>8)&4278255360,E.push(o),E.push(h)}return new R.init(E,i)},clone:function(){for(var e=x.clone.call(this),r=e._state=this._state.slice(0),n=0;n<25;n++)r[n]=r[n].clone();return e}});J.SHA3=x._createHelper(p),J.HmacSHA3=x._createHmacHelper(p)}(Math),P.SHA3})}(xt)),xt.exports}var St={exports:{}},Er;function En(){return Er||(Er=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){/** @preserve
4
4
  (c) 2012 by Cédric Mesnil. All rights reserved.
5
5
 
6
6
  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
@@ -9,19 +9,19 @@ import{o as Qr,k as $r,A as Zr}from"./index-BvRi8Pnp.js";import"eventemitter3";c
9
9
  - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
10
10
 
11
11
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
12
- */return function(N){var J=P,L=J.lib,R=L.WordArray,x=L.Hasher,v=J.algo,c=R.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=R.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),S=R.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),f=R.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),a=R.create([0,1518500249,1859775393,2400959708,2840853838]),d=R.create([1352829926,1548603684,1836072691,2053994217,0]),p=v.RIPEMD160=x.extend({_doReset:function(){this._hash=R.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(l,E){for(var b=0;b<16;b++){var _=E+b,h=l[_];l[_]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360}var o=this._hash.words,g=a.words,m=d.words,T=c.words,C=u.words,D=S.words,y=f.words,A,O,j,I,H,F,U,B,k,V;F=A=o[0],U=O=o[1],B=j=o[2],k=I=o[3],V=H=o[4];for(var G,b=0;b<80;b+=1)G=A+l[E+T[b]]|0,b<16?G+=e(O,j,I)+g[0]:b<32?G+=r(O,j,I)+g[1]:b<48?G+=n(O,j,I)+g[2]:b<64?G+=s(O,j,I)+g[3]:G+=t(O,j,I)+g[4],G=G|0,G=i(G,D[b]),G=G+H|0,A=H,H=I,I=i(j,10),j=O,O=G,G=F+l[E+C[b]]|0,b<16?G+=t(U,B,k)+m[0]:b<32?G+=s(U,B,k)+m[1]:b<48?G+=n(U,B,k)+m[2]:b<64?G+=r(U,B,k)+m[3]:G+=e(U,B,k)+m[4],G=G|0,G=i(G,y[b]),G=G+V|0,F=V,V=k,k=i(B,10),B=U,U=G;G=o[1]+j+k|0,o[1]=o[2]+I+V|0,o[2]=o[3]+H+F|0,o[3]=o[4]+A+U|0,o[4]=o[0]+O+B|0,o[0]=G},_doFinalize:function(){var l=this._data,E=l.words,b=this._nDataBytes*8,_=l.sigBytes*8;E[_>>>5]|=128<<24-_%32,E[(_+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,l.sigBytes=(E.length+1)*4,this._process();for(var h=this._hash,o=h.words,g=0;g<5;g++){var m=o[g];o[g]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}return h},clone:function(){var l=x.clone.call(this);return l._hash=this._hash.clone(),l}});function e(l,E,b){return l^E^b}function r(l,E,b){return l&E|~l&b}function n(l,E,b){return(l|~E)^b}function s(l,E,b){return l&b|E&~b}function t(l,E,b){return l^(E|~b)}function i(l,E){return l<<E|l>>>32-E}J.RIPEMD160=x._createHelper(p),J.HmacRIPEMD160=x._createHmacHelper(p)}(),P.RIPEMD160})}(St)),St.exports}var bt={exports:{}},gr;function _t(){return gr||(gr=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){(function(){var N=P,J=N.lib,L=J.Base,R=N.enc,x=R.Utf8,v=N.algo;v.HMAC=L.extend({init:function(c,u){c=this._hasher=new c.init,typeof u=="string"&&(u=x.parse(u));var S=c.blockSize,f=S*4;u.sigBytes>f&&(u=c.finalize(u)),u.clamp();for(var a=this._oKey=u.clone(),d=this._iKey=u.clone(),p=a.words,e=d.words,r=0;r<S;r++)p[r]^=1549556828,e[r]^=909522486;a.sigBytes=d.sigBytes=f,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var u=this._hasher,S=u.finalize(c);u.reset();var f=u.finalize(this._oKey.clone().concat(S));return f}})})()})}(bt)),bt.exports}var Rt={exports:{}},yr;function gn(){return yr||(yr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),mt(),_t())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.Base,R=J.WordArray,x=N.algo,v=x.SHA256,c=x.HMAC,u=x.PBKDF2=L.extend({cfg:L.extend({keySize:128/32,hasher:v,iterations:25e4}),init:function(S){this.cfg=this.cfg.extend(S)},compute:function(S,f){for(var a=this.cfg,d=c.create(a.hasher,S),p=R.create(),e=R.create([1]),r=p.words,n=e.words,s=a.keySize,t=a.iterations;r.length<s;){var i=d.update(f).finalize(e);d.reset();for(var l=i.words,E=l.length,b=i,_=1;_<t;_++){b=d.finalize(b),d.reset();for(var h=b.words,o=0;o<E;o++)l[o]^=h[o]}p.concat(i),n[0]++}return p.sigBytes=s*4,p}});N.PBKDF2=function(S,f,a){return u.create(a).compute(S,f)}}(),P.PBKDF2})}(Rt)),Rt.exports}var Ct={exports:{}},xr;function Ye(){return xr||(xr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),dr(),_t())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.Base,R=J.WordArray,x=N.algo,v=x.MD5,c=x.EvpKDF=L.extend({cfg:L.extend({keySize:128/32,hasher:v,iterations:1}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,S){for(var f,a=this.cfg,d=a.hasher.create(),p=R.create(),e=p.words,r=a.keySize,n=a.iterations;e.length<r;){f&&d.update(f),f=d.update(u).finalize(S),d.reset();for(var s=1;s<n;s++)f=d.finalize(f),d.reset();p.concat(f)}return p.sigBytes=r*4,p}});N.EvpKDF=function(u,S,f){return c.create(f).compute(u,S)}}(),P.EvpKDF})}(Ct)),Ct.exports}var Tt={exports:{}},Sr;function Me(){return Sr||(Sr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Ye())})(ye,function(P){P.lib.Cipher||function(N){var J=P,L=J.lib,R=L.Base,x=L.WordArray,v=L.BufferedBlockAlgorithm,c=J.enc;c.Utf8;var u=c.Base64,S=J.algo,f=S.EvpKDF,a=L.Cipher=v.extend({cfg:R.extend(),createEncryptor:function(h,o){return this.create(this._ENC_XFORM_MODE,h,o)},createDecryptor:function(h,o){return this.create(this._DEC_XFORM_MODE,h,o)},init:function(h,o,g){this.cfg=this.cfg.extend(g),this._xformMode=h,this._key=o,this.reset()},reset:function(){v.reset.call(this),this._doReset()},process:function(h){return this._append(h),this._process()},finalize:function(h){h&&this._append(h);var o=this._doFinalize();return o},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function h(o){return typeof o=="string"?_:l}return function(o){return{encrypt:function(g,m,T){return h(m).encrypt(o,g,m,T)},decrypt:function(g,m,T){return h(m).decrypt(o,g,m,T)}}}}()});L.StreamCipher=a.extend({_doFinalize:function(){var h=this._process(!0);return h},blockSize:1});var d=J.mode={},p=L.BlockCipherMode=R.extend({createEncryptor:function(h,o){return this.Encryptor.create(h,o)},createDecryptor:function(h,o){return this.Decryptor.create(h,o)},init:function(h,o){this._cipher=h,this._iv=o}}),e=d.CBC=function(){var h=p.extend();h.Encryptor=h.extend({processBlock:function(g,m){var T=this._cipher,C=T.blockSize;o.call(this,g,m,C),T.encryptBlock(g,m),this._prevBlock=g.slice(m,m+C)}}),h.Decryptor=h.extend({processBlock:function(g,m){var T=this._cipher,C=T.blockSize,D=g.slice(m,m+C);T.decryptBlock(g,m),o.call(this,g,m,C),this._prevBlock=D}});function o(g,m,T){var C,D=this._iv;D?(C=D,this._iv=N):C=this._prevBlock;for(var y=0;y<T;y++)g[m+y]^=C[y]}return h}(),r=J.pad={},n=r.Pkcs7={pad:function(h,o){for(var g=o*4,m=g-h.sigBytes%g,T=m<<24|m<<16|m<<8|m,C=[],D=0;D<m;D+=4)C.push(T);var y=x.create(C,m);h.concat(y)},unpad:function(h){var o=h.words[h.sigBytes-1>>>2]&255;h.sigBytes-=o}};L.BlockCipher=a.extend({cfg:a.cfg.extend({mode:e,padding:n}),reset:function(){var h;a.reset.call(this);var o=this.cfg,g=o.iv,m=o.mode;this._xformMode==this._ENC_XFORM_MODE?h=m.createEncryptor:(h=m.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==h?this._mode.init(this,g&&g.words):(this._mode=h.call(m,this,g&&g.words),this._mode.__creator=h)},_doProcessBlock:function(h,o){this._mode.processBlock(h,o)},_doFinalize:function(){var h,o=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(o.pad(this._data,this.blockSize),h=this._process(!0)):(h=this._process(!0),o.unpad(h)),h},blockSize:128/32});var s=L.CipherParams=R.extend({init:function(h){this.mixIn(h)},toString:function(h){return(h||this.formatter).stringify(this)}}),t=J.format={},i=t.OpenSSL={stringify:function(h){var o,g=h.ciphertext,m=h.salt;return m?o=x.create([1398893684,1701076831]).concat(m).concat(g):o=g,o.toString(u)},parse:function(h){var o,g=u.parse(h),m=g.words;return m[0]==1398893684&&m[1]==1701076831&&(o=x.create(m.slice(2,4)),m.splice(0,4),g.sigBytes-=16),s.create({ciphertext:g,salt:o})}},l=L.SerializableCipher=R.extend({cfg:R.extend({format:i}),encrypt:function(h,o,g,m){m=this.cfg.extend(m);var T=h.createEncryptor(g,m),C=T.finalize(o),D=T.cfg;return s.create({ciphertext:C,key:g,iv:D.iv,algorithm:h,mode:D.mode,padding:D.padding,blockSize:h.blockSize,formatter:m.format})},decrypt:function(h,o,g,m){m=this.cfg.extend(m),o=this._parse(o,m.format);var T=h.createDecryptor(g,m).finalize(o.ciphertext);return T},_parse:function(h,o){return typeof h=="string"?o.parse(h,this):h}}),E=J.kdf={},b=E.OpenSSL={execute:function(h,o,g,m,T){if(m||(m=x.random(64/8)),T)var C=f.create({keySize:o+g,hasher:T}).compute(h,m);else var C=f.create({keySize:o+g}).compute(h,m);var D=x.create(C.words.slice(o),g*4);return C.sigBytes=o*4,s.create({key:C,iv:D,salt:m})}},_=L.PasswordBasedCipher=l.extend({cfg:l.cfg.extend({kdf:b}),encrypt:function(h,o,g,m){m=this.cfg.extend(m);var T=m.kdf.execute(g,h.keySize,h.ivSize,m.salt,m.hasher);m.iv=T.iv;var C=l.encrypt.call(this,h,o,T.key,m);return C.mixIn(T),C},decrypt:function(h,o,g,m){m=this.cfg.extend(m),o=this._parse(o,m.format);var T=m.kdf.execute(g,h.keySize,h.ivSize,o.salt,m.hasher);m.iv=T.iv;var C=l.decrypt.call(this,h,o,T.key,m);return C}})}()})}(Tt)),Tt.exports}var Dt={exports:{}},br;function yn(){return br||(br=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.mode.CFB=function(){var N=P.lib.BlockCipherMode.extend();N.Encryptor=N.extend({processBlock:function(L,R){var x=this._cipher,v=x.blockSize;J.call(this,L,R,v,x),this._prevBlock=L.slice(R,R+v)}}),N.Decryptor=N.extend({processBlock:function(L,R){var x=this._cipher,v=x.blockSize,c=L.slice(R,R+v);J.call(this,L,R,v,x),this._prevBlock=c}});function J(L,R,x,v){var c,u=this._iv;u?(c=u.slice(0),this._iv=void 0):c=this._prevBlock,v.encryptBlock(c,0);for(var S=0;S<x;S++)L[R+S]^=c[S]}return N}(),P.mode.CFB})}(Dt)),Dt.exports}var At={exports:{}},_r;function xn(){return _r||(_r=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.mode.CTR=function(){var N=P.lib.BlockCipherMode.extend(),J=N.Encryptor=N.extend({processBlock:function(L,R){var x=this._cipher,v=x.blockSize,c=this._iv,u=this._counter;c&&(u=this._counter=c.slice(0),this._iv=void 0);var S=u.slice(0);x.encryptBlock(S,0),u[v-1]=u[v-1]+1|0;for(var f=0;f<v;f++)L[R+f]^=S[f]}});return N.Decryptor=J,N}(),P.mode.CTR})}(At)),At.exports}var wt={exports:{}},Rr;function Sn(){return Rr||(Rr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){/** @preserve
12
+ */return function(N){var J=P,L=J.lib,R=L.WordArray,x=L.Hasher,v=J.algo,c=R.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),u=R.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),S=R.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),f=R.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),a=R.create([0,1518500249,1859775393,2400959708,2840853838]),d=R.create([1352829926,1548603684,1836072691,2053994217,0]),p=v.RIPEMD160=x.extend({_doReset:function(){this._hash=R.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(l,E){for(var b=0;b<16;b++){var _=E+b,h=l[_];l[_]=(h<<8|h>>>24)&16711935|(h<<24|h>>>8)&4278255360}var o=this._hash.words,g=a.words,m=d.words,T=c.words,C=u.words,D=S.words,y=f.words,A,w,j,I,H,F,U,B,k,V;F=A=o[0],U=w=o[1],B=j=o[2],k=I=o[3],V=H=o[4];for(var G,b=0;b<80;b+=1)G=A+l[E+T[b]]|0,b<16?G+=e(w,j,I)+g[0]:b<32?G+=r(w,j,I)+g[1]:b<48?G+=n(w,j,I)+g[2]:b<64?G+=s(w,j,I)+g[3]:G+=t(w,j,I)+g[4],G=G|0,G=i(G,D[b]),G=G+H|0,A=H,H=I,I=i(j,10),j=w,w=G,G=F+l[E+C[b]]|0,b<16?G+=t(U,B,k)+m[0]:b<32?G+=s(U,B,k)+m[1]:b<48?G+=n(U,B,k)+m[2]:b<64?G+=r(U,B,k)+m[3]:G+=e(U,B,k)+m[4],G=G|0,G=i(G,y[b]),G=G+V|0,F=V,V=k,k=i(B,10),B=U,U=G;G=o[1]+j+k|0,o[1]=o[2]+I+V|0,o[2]=o[3]+H+F|0,o[3]=o[4]+A+U|0,o[4]=o[0]+w+B|0,o[0]=G},_doFinalize:function(){var l=this._data,E=l.words,b=this._nDataBytes*8,_=l.sigBytes*8;E[_>>>5]|=128<<24-_%32,E[(_+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,l.sigBytes=(E.length+1)*4,this._process();for(var h=this._hash,o=h.words,g=0;g<5;g++){var m=o[g];o[g]=(m<<8|m>>>24)&16711935|(m<<24|m>>>8)&4278255360}return h},clone:function(){var l=x.clone.call(this);return l._hash=this._hash.clone(),l}});function e(l,E,b){return l^E^b}function r(l,E,b){return l&E|~l&b}function n(l,E,b){return(l|~E)^b}function s(l,E,b){return l&b|E&~b}function t(l,E,b){return l^(E|~b)}function i(l,E){return l<<E|l>>>32-E}J.RIPEMD160=x._createHelper(p),J.HmacRIPEMD160=x._createHmacHelper(p)}(),P.RIPEMD160})}(St)),St.exports}var bt={exports:{}},gr;function _t(){return gr||(gr=1,function(W,M){(function(P,N){W.exports=N(Se())})(ye,function(P){(function(){var N=P,J=N.lib,L=J.Base,R=N.enc,x=R.Utf8,v=N.algo;v.HMAC=L.extend({init:function(c,u){c=this._hasher=new c.init,typeof u=="string"&&(u=x.parse(u));var S=c.blockSize,f=S*4;u.sigBytes>f&&(u=c.finalize(u)),u.clamp();for(var a=this._oKey=u.clone(),d=this._iKey=u.clone(),p=a.words,e=d.words,r=0;r<S;r++)p[r]^=1549556828,e[r]^=909522486;a.sigBytes=d.sigBytes=f,this.reset()},reset:function(){var c=this._hasher;c.reset(),c.update(this._iKey)},update:function(c){return this._hasher.update(c),this},finalize:function(c){var u=this._hasher,S=u.finalize(c);u.reset();var f=u.finalize(this._oKey.clone().concat(S));return f}})})()})}(bt)),bt.exports}var Rt={exports:{}},yr;function gn(){return yr||(yr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),mt(),_t())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.Base,R=J.WordArray,x=N.algo,v=x.SHA256,c=x.HMAC,u=x.PBKDF2=L.extend({cfg:L.extend({keySize:128/32,hasher:v,iterations:25e4}),init:function(S){this.cfg=this.cfg.extend(S)},compute:function(S,f){for(var a=this.cfg,d=c.create(a.hasher,S),p=R.create(),e=R.create([1]),r=p.words,n=e.words,s=a.keySize,t=a.iterations;r.length<s;){var i=d.update(f).finalize(e);d.reset();for(var l=i.words,E=l.length,b=i,_=1;_<t;_++){b=d.finalize(b),d.reset();for(var h=b.words,o=0;o<E;o++)l[o]^=h[o]}p.concat(i),n[0]++}return p.sigBytes=s*4,p}});N.PBKDF2=function(S,f,a){return u.create(a).compute(S,f)}}(),P.PBKDF2})}(Rt)),Rt.exports}var Ct={exports:{}},xr;function Ye(){return xr||(xr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),dr(),_t())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.Base,R=J.WordArray,x=N.algo,v=x.MD5,c=x.EvpKDF=L.extend({cfg:L.extend({keySize:128/32,hasher:v,iterations:1}),init:function(u){this.cfg=this.cfg.extend(u)},compute:function(u,S){for(var f,a=this.cfg,d=a.hasher.create(),p=R.create(),e=p.words,r=a.keySize,n=a.iterations;e.length<r;){f&&d.update(f),f=d.update(u).finalize(S),d.reset();for(var s=1;s<n;s++)f=d.finalize(f),d.reset();p.concat(f)}return p.sigBytes=r*4,p}});N.EvpKDF=function(u,S,f){return c.create(f).compute(u,S)}}(),P.EvpKDF})}(Ct)),Ct.exports}var Tt={exports:{}},Sr;function Me(){return Sr||(Sr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Ye())})(ye,function(P){P.lib.Cipher||function(N){var J=P,L=J.lib,R=L.Base,x=L.WordArray,v=L.BufferedBlockAlgorithm,c=J.enc;c.Utf8;var u=c.Base64,S=J.algo,f=S.EvpKDF,a=L.Cipher=v.extend({cfg:R.extend(),createEncryptor:function(h,o){return this.create(this._ENC_XFORM_MODE,h,o)},createDecryptor:function(h,o){return this.create(this._DEC_XFORM_MODE,h,o)},init:function(h,o,g){this.cfg=this.cfg.extend(g),this._xformMode=h,this._key=o,this.reset()},reset:function(){v.reset.call(this),this._doReset()},process:function(h){return this._append(h),this._process()},finalize:function(h){h&&this._append(h);var o=this._doFinalize();return o},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function h(o){return typeof o=="string"?_:l}return function(o){return{encrypt:function(g,m,T){return h(m).encrypt(o,g,m,T)},decrypt:function(g,m,T){return h(m).decrypt(o,g,m,T)}}}}()});L.StreamCipher=a.extend({_doFinalize:function(){var h=this._process(!0);return h},blockSize:1});var d=J.mode={},p=L.BlockCipherMode=R.extend({createEncryptor:function(h,o){return this.Encryptor.create(h,o)},createDecryptor:function(h,o){return this.Decryptor.create(h,o)},init:function(h,o){this._cipher=h,this._iv=o}}),e=d.CBC=function(){var h=p.extend();h.Encryptor=h.extend({processBlock:function(g,m){var T=this._cipher,C=T.blockSize;o.call(this,g,m,C),T.encryptBlock(g,m),this._prevBlock=g.slice(m,m+C)}}),h.Decryptor=h.extend({processBlock:function(g,m){var T=this._cipher,C=T.blockSize,D=g.slice(m,m+C);T.decryptBlock(g,m),o.call(this,g,m,C),this._prevBlock=D}});function o(g,m,T){var C,D=this._iv;D?(C=D,this._iv=N):C=this._prevBlock;for(var y=0;y<T;y++)g[m+y]^=C[y]}return h}(),r=J.pad={},n=r.Pkcs7={pad:function(h,o){for(var g=o*4,m=g-h.sigBytes%g,T=m<<24|m<<16|m<<8|m,C=[],D=0;D<m;D+=4)C.push(T);var y=x.create(C,m);h.concat(y)},unpad:function(h){var o=h.words[h.sigBytes-1>>>2]&255;h.sigBytes-=o}};L.BlockCipher=a.extend({cfg:a.cfg.extend({mode:e,padding:n}),reset:function(){var h;a.reset.call(this);var o=this.cfg,g=o.iv,m=o.mode;this._xformMode==this._ENC_XFORM_MODE?h=m.createEncryptor:(h=m.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==h?this._mode.init(this,g&&g.words):(this._mode=h.call(m,this,g&&g.words),this._mode.__creator=h)},_doProcessBlock:function(h,o){this._mode.processBlock(h,o)},_doFinalize:function(){var h,o=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(o.pad(this._data,this.blockSize),h=this._process(!0)):(h=this._process(!0),o.unpad(h)),h},blockSize:128/32});var s=L.CipherParams=R.extend({init:function(h){this.mixIn(h)},toString:function(h){return(h||this.formatter).stringify(this)}}),t=J.format={},i=t.OpenSSL={stringify:function(h){var o,g=h.ciphertext,m=h.salt;return m?o=x.create([1398893684,1701076831]).concat(m).concat(g):o=g,o.toString(u)},parse:function(h){var o,g=u.parse(h),m=g.words;return m[0]==1398893684&&m[1]==1701076831&&(o=x.create(m.slice(2,4)),m.splice(0,4),g.sigBytes-=16),s.create({ciphertext:g,salt:o})}},l=L.SerializableCipher=R.extend({cfg:R.extend({format:i}),encrypt:function(h,o,g,m){m=this.cfg.extend(m);var T=h.createEncryptor(g,m),C=T.finalize(o),D=T.cfg;return s.create({ciphertext:C,key:g,iv:D.iv,algorithm:h,mode:D.mode,padding:D.padding,blockSize:h.blockSize,formatter:m.format})},decrypt:function(h,o,g,m){m=this.cfg.extend(m),o=this._parse(o,m.format);var T=h.createDecryptor(g,m).finalize(o.ciphertext);return T},_parse:function(h,o){return typeof h=="string"?o.parse(h,this):h}}),E=J.kdf={},b=E.OpenSSL={execute:function(h,o,g,m,T){if(m||(m=x.random(64/8)),T)var C=f.create({keySize:o+g,hasher:T}).compute(h,m);else var C=f.create({keySize:o+g}).compute(h,m);var D=x.create(C.words.slice(o),g*4);return C.sigBytes=o*4,s.create({key:C,iv:D,salt:m})}},_=L.PasswordBasedCipher=l.extend({cfg:l.cfg.extend({kdf:b}),encrypt:function(h,o,g,m){m=this.cfg.extend(m);var T=m.kdf.execute(g,h.keySize,h.ivSize,m.salt,m.hasher);m.iv=T.iv;var C=l.encrypt.call(this,h,o,T.key,m);return C.mixIn(T),C},decrypt:function(h,o,g,m){m=this.cfg.extend(m),o=this._parse(o,m.format);var T=m.kdf.execute(g,h.keySize,h.ivSize,o.salt,m.hasher);m.iv=T.iv;var C=l.decrypt.call(this,h,o,T.key,m);return C}})}()})}(Tt)),Tt.exports}var Dt={exports:{}},br;function yn(){return br||(br=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.mode.CFB=function(){var N=P.lib.BlockCipherMode.extend();N.Encryptor=N.extend({processBlock:function(L,R){var x=this._cipher,v=x.blockSize;J.call(this,L,R,v,x),this._prevBlock=L.slice(R,R+v)}}),N.Decryptor=N.extend({processBlock:function(L,R){var x=this._cipher,v=x.blockSize,c=L.slice(R,R+v);J.call(this,L,R,v,x),this._prevBlock=c}});function J(L,R,x,v){var c,u=this._iv;u?(c=u.slice(0),this._iv=void 0):c=this._prevBlock,v.encryptBlock(c,0);for(var S=0;S<x;S++)L[R+S]^=c[S]}return N}(),P.mode.CFB})}(Dt)),Dt.exports}var At={exports:{}},_r;function xn(){return _r||(_r=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.mode.CTR=function(){var N=P.lib.BlockCipherMode.extend(),J=N.Encryptor=N.extend({processBlock:function(L,R){var x=this._cipher,v=x.blockSize,c=this._iv,u=this._counter;c&&(u=this._counter=c.slice(0),this._iv=void 0);var S=u.slice(0);x.encryptBlock(S,0),u[v-1]=u[v-1]+1|0;for(var f=0;f<v;f++)L[R+f]^=S[f]}});return N.Decryptor=J,N}(),P.mode.CTR})}(At)),At.exports}var Ot={exports:{}},Rr;function Sn(){return Rr||(Rr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){/** @preserve
13
13
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
14
14
  * derived from CryptoJS.mode.CTR
15
15
  * Jan Hruby jhruby.web@gmail.com
16
- */return P.mode.CTRGladman=function(){var N=P.lib.BlockCipherMode.extend();function J(x){if((x>>24&255)===255){var v=x>>16&255,c=x>>8&255,u=x&255;v===255?(v=0,c===255?(c=0,u===255?u=0:++u):++c):++v,x=0,x+=v<<16,x+=c<<8,x+=u}else x+=1<<24;return x}function L(x){return(x[0]=J(x[0]))===0&&(x[1]=J(x[1])),x}var R=N.Encryptor=N.extend({processBlock:function(x,v){var c=this._cipher,u=c.blockSize,S=this._iv,f=this._counter;S&&(f=this._counter=S.slice(0),this._iv=void 0),L(f);var a=f.slice(0);c.encryptBlock(a,0);for(var d=0;d<u;d++)x[v+d]^=a[d]}});return N.Decryptor=R,N}(),P.mode.CTRGladman})}(wt)),wt.exports}var Ot={exports:{}},Cr;function bn(){return Cr||(Cr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.mode.OFB=function(){var N=P.lib.BlockCipherMode.extend(),J=N.Encryptor=N.extend({processBlock:function(L,R){var x=this._cipher,v=x.blockSize,c=this._iv,u=this._keystream;c&&(u=this._keystream=c.slice(0),this._iv=void 0),x.encryptBlock(u,0);for(var S=0;S<v;S++)L[R+S]^=u[S]}});return N.Decryptor=J,N}(),P.mode.OFB})}(Ot)),Ot.exports}var Pt={exports:{}},Tr;function _n(){return Tr||(Tr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.mode.ECB=function(){var N=P.lib.BlockCipherMode.extend();return N.Encryptor=N.extend({processBlock:function(J,L){this._cipher.encryptBlock(J,L)}}),N.Decryptor=N.extend({processBlock:function(J,L){this._cipher.decryptBlock(J,L)}}),N}(),P.mode.ECB})}(Pt)),Pt.exports}var Mt={exports:{}},Dr;function Rn(){return Dr||(Dr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.pad.AnsiX923={pad:function(N,J){var L=N.sigBytes,R=J*4,x=R-L%R,v=L+x-1;N.clamp(),N.words[v>>>2]|=x<<24-v%4*8,N.sigBytes+=x},unpad:function(N){var J=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=J}},P.pad.Ansix923})}(Mt)),Mt.exports}var kt={exports:{}},Ar;function Cn(){return Ar||(Ar=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.pad.Iso10126={pad:function(N,J){var L=J*4,R=L-N.sigBytes%L;N.concat(P.lib.WordArray.random(R-1)).concat(P.lib.WordArray.create([R<<24],1))},unpad:function(N){var J=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=J}},P.pad.Iso10126})}(kt)),kt.exports}var It={exports:{}},wr;function Tn(){return wr||(wr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.pad.Iso97971={pad:function(N,J){N.concat(P.lib.WordArray.create([2147483648],1)),P.pad.ZeroPadding.pad(N,J)},unpad:function(N){P.pad.ZeroPadding.unpad(N),N.sigBytes--}},P.pad.Iso97971})}(It)),It.exports}var Bt={exports:{}},Or;function Dn(){return Or||(Or=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.pad.ZeroPadding={pad:function(N,J){var L=J*4;N.clamp(),N.sigBytes+=L-(N.sigBytes%L||L)},unpad:function(N){for(var J=N.words,L=N.sigBytes-1,L=N.sigBytes-1;L>=0;L--)if(J[L>>>2]>>>24-L%4*8&255){N.sigBytes=L+1;break}}},P.pad.ZeroPadding})}(Bt)),Bt.exports}var Nt={exports:{}},Pr;function An(){return Pr||(Pr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.pad.NoPadding={pad:function(){},unpad:function(){}},P.pad.NoPadding})}(Nt)),Nt.exports}var Lt={exports:{}},Mr;function wn(){return Mr||(Mr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return function(N){var J=P,L=J.lib,R=L.CipherParams,x=J.enc,v=x.Hex,c=J.format;c.Hex={stringify:function(u){return u.ciphertext.toString(v)},parse:function(u){var S=v.parse(u);return R.create({ciphertext:S})}}}(),P.format.Hex})}(Lt)),Lt.exports}var Ut={exports:{}},kr;function On(){return kr||(kr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Xe(),Je(),Ye(),Me())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.BlockCipher,R=N.algo,x=[],v=[],c=[],u=[],S=[],f=[],a=[],d=[],p=[],e=[];(function(){for(var s=[],t=0;t<256;t++)t<128?s[t]=t<<1:s[t]=t<<1^283;for(var i=0,l=0,t=0;t<256;t++){var E=l^l<<1^l<<2^l<<3^l<<4;E=E>>>8^E&255^99,x[i]=E,v[E]=i;var b=s[i],_=s[b],h=s[_],o=s[E]*257^E*16843008;c[i]=o<<24|o>>>8,u[i]=o<<16|o>>>16,S[i]=o<<8|o>>>24,f[i]=o;var o=h*16843009^_*65537^b*257^i*16843008;a[E]=o<<24|o>>>8,d[E]=o<<16|o>>>16,p[E]=o<<8|o>>>24,e[E]=o,i?(i=b^s[s[s[h^b]]],l^=s[s[l]]):i=l=1}})();var r=[0,1,2,4,8,16,32,64,128,27,54],n=R.AES=L.extend({_doReset:function(){var s;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var t=this._keyPriorReset=this._key,i=t.words,l=t.sigBytes/4,E=this._nRounds=l+6,b=(E+1)*4,_=this._keySchedule=[],h=0;h<b;h++)h<l?_[h]=i[h]:(s=_[h-1],h%l?l>6&&h%l==4&&(s=x[s>>>24]<<24|x[s>>>16&255]<<16|x[s>>>8&255]<<8|x[s&255]):(s=s<<8|s>>>24,s=x[s>>>24]<<24|x[s>>>16&255]<<16|x[s>>>8&255]<<8|x[s&255],s^=r[h/l|0]<<24),_[h]=_[h-l]^s);for(var o=this._invKeySchedule=[],g=0;g<b;g++){var h=b-g;if(g%4)var s=_[h];else var s=_[h-4];g<4||h<=4?o[g]=s:o[g]=a[x[s>>>24]]^d[x[s>>>16&255]]^p[x[s>>>8&255]]^e[x[s&255]]}}},encryptBlock:function(s,t){this._doCryptBlock(s,t,this._keySchedule,c,u,S,f,x)},decryptBlock:function(s,t){var i=s[t+1];s[t+1]=s[t+3],s[t+3]=i,this._doCryptBlock(s,t,this._invKeySchedule,a,d,p,e,v);var i=s[t+1];s[t+1]=s[t+3],s[t+3]=i},_doCryptBlock:function(s,t,i,l,E,b,_,h){for(var o=this._nRounds,g=s[t]^i[0],m=s[t+1]^i[1],T=s[t+2]^i[2],C=s[t+3]^i[3],D=4,y=1;y<o;y++){var A=l[g>>>24]^E[m>>>16&255]^b[T>>>8&255]^_[C&255]^i[D++],O=l[m>>>24]^E[T>>>16&255]^b[C>>>8&255]^_[g&255]^i[D++],j=l[T>>>24]^E[C>>>16&255]^b[g>>>8&255]^_[m&255]^i[D++],I=l[C>>>24]^E[g>>>16&255]^b[m>>>8&255]^_[T&255]^i[D++];g=A,m=O,T=j,C=I}var A=(h[g>>>24]<<24|h[m>>>16&255]<<16|h[T>>>8&255]<<8|h[C&255])^i[D++],O=(h[m>>>24]<<24|h[T>>>16&255]<<16|h[C>>>8&255]<<8|h[g&255])^i[D++],j=(h[T>>>24]<<24|h[C>>>16&255]<<16|h[g>>>8&255]<<8|h[m&255])^i[D++],I=(h[C>>>24]<<24|h[g>>>16&255]<<16|h[m>>>8&255]<<8|h[T&255])^i[D++];s[t]=A,s[t+1]=O,s[t+2]=j,s[t+3]=I},keySize:256/32});N.AES=L._createHelper(n)}(),P.AES})}(Ut)),Ut.exports}var Ft={exports:{}},Ir;function Pn(){return Ir||(Ir=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Xe(),Je(),Ye(),Me())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.WordArray,R=J.BlockCipher,x=N.algo,v=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],S=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],f=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],a=x.DES=R.extend({_doReset:function(){for(var r=this._key,n=r.words,s=[],t=0;t<56;t++){var i=v[t]-1;s[t]=n[i>>>5]>>>31-i%32&1}for(var l=this._subKeys=[],E=0;E<16;E++){for(var b=l[E]=[],_=u[E],t=0;t<24;t++)b[t/6|0]|=s[(c[t]-1+_)%28]<<31-t%6,b[4+(t/6|0)]|=s[28+(c[t+24]-1+_)%28]<<31-t%6;b[0]=b[0]<<1|b[0]>>>31;for(var t=1;t<7;t++)b[t]=b[t]>>>(t-1)*4+3;b[7]=b[7]<<5|b[7]>>>27}for(var h=this._invSubKeys=[],t=0;t<16;t++)h[t]=l[15-t]},encryptBlock:function(r,n){this._doCryptBlock(r,n,this._subKeys)},decryptBlock:function(r,n){this._doCryptBlock(r,n,this._invSubKeys)},_doCryptBlock:function(r,n,s){this._lBlock=r[n],this._rBlock=r[n+1],d.call(this,4,252645135),d.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),d.call(this,1,1431655765);for(var t=0;t<16;t++){for(var i=s[t],l=this._lBlock,E=this._rBlock,b=0,_=0;_<8;_++)b|=S[_][((E^i[_])&f[_])>>>0];this._lBlock=E,this._rBlock=l^b}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,d.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),d.call(this,16,65535),d.call(this,4,252645135),r[n]=this._lBlock,r[n+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function d(r,n){var s=(this._lBlock>>>r^this._rBlock)&n;this._rBlock^=s,this._lBlock^=s<<r}function p(r,n){var s=(this._rBlock>>>r^this._lBlock)&n;this._lBlock^=s,this._rBlock^=s<<r}N.DES=R._createHelper(a);var e=x.TripleDES=R.extend({_doReset:function(){var r=this._key,n=r.words;if(n.length!==2&&n.length!==4&&n.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var s=n.slice(0,2),t=n.length<4?n.slice(0,2):n.slice(2,4),i=n.length<6?n.slice(0,2):n.slice(4,6);this._des1=a.createEncryptor(L.create(s)),this._des2=a.createEncryptor(L.create(t)),this._des3=a.createEncryptor(L.create(i))},encryptBlock:function(r,n){this._des1.encryptBlock(r,n),this._des2.decryptBlock(r,n),this._des3.encryptBlock(r,n)},decryptBlock:function(r,n){this._des3.decryptBlock(r,n),this._des2.encryptBlock(r,n),this._des1.decryptBlock(r,n)},keySize:192/32,ivSize:64/32,blockSize:64/32});N.TripleDES=R._createHelper(e)}(),P.TripleDES})}(Ft)),Ft.exports}var Ht={exports:{}},Br;function Mn(){return Br||(Br=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Xe(),Je(),Ye(),Me())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.StreamCipher,R=N.algo,x=R.RC4=L.extend({_doReset:function(){for(var u=this._key,S=u.words,f=u.sigBytes,a=this._S=[],d=0;d<256;d++)a[d]=d;for(var d=0,p=0;d<256;d++){var e=d%f,r=S[e>>>2]>>>24-e%4*8&255;p=(p+a[d]+r)%256;var n=a[d];a[d]=a[p],a[p]=n}this._i=this._j=0},_doProcessBlock:function(u,S){u[S]^=v.call(this)},keySize:256/32,ivSize:0});function v(){for(var u=this._S,S=this._i,f=this._j,a=0,d=0;d<4;d++){S=(S+1)%256,f=(f+u[S])%256;var p=u[S];u[S]=u[f],u[f]=p,a|=u[(u[S]+u[f])%256]<<24-d*8}return this._i=S,this._j=f,a}N.RC4=L._createHelper(x);var c=R.RC4Drop=x.extend({cfg:x.cfg.extend({drop:192}),_doReset:function(){x._doReset.call(this);for(var u=this.cfg.drop;u>0;u--)v.call(this)}});N.RC4Drop=L._createHelper(c)}(),P.RC4})}(Ht)),Ht.exports}var Vt={exports:{}},Nr;function kn(){return Nr||(Nr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Xe(),Je(),Ye(),Me())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.StreamCipher,R=N.algo,x=[],v=[],c=[],u=R.Rabbit=L.extend({_doReset:function(){for(var f=this._key.words,a=this.cfg.iv,d=0;d<4;d++)f[d]=(f[d]<<8|f[d]>>>24)&16711935|(f[d]<<24|f[d]>>>8)&4278255360;var p=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],e=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var d=0;d<4;d++)S.call(this);for(var d=0;d<8;d++)e[d]^=p[d+4&7];if(a){var r=a.words,n=r[0],s=r[1],t=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,i=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,l=t>>>16|i&4294901760,E=i<<16|t&65535;e[0]^=t,e[1]^=l,e[2]^=i,e[3]^=E,e[4]^=t,e[5]^=l,e[6]^=i,e[7]^=E;for(var d=0;d<4;d++)S.call(this)}},_doProcessBlock:function(f,a){var d=this._X;S.call(this),x[0]=d[0]^d[5]>>>16^d[3]<<16,x[1]=d[2]^d[7]>>>16^d[5]<<16,x[2]=d[4]^d[1]>>>16^d[7]<<16,x[3]=d[6]^d[3]>>>16^d[1]<<16;for(var p=0;p<4;p++)x[p]=(x[p]<<8|x[p]>>>24)&16711935|(x[p]<<24|x[p]>>>8)&4278255360,f[a+p]^=x[p]},blockSize:128/32,ivSize:64/32});function S(){for(var f=this._X,a=this._C,d=0;d<8;d++)v[d]=a[d];a[0]=a[0]+1295307597+this._b|0,a[1]=a[1]+3545052371+(a[0]>>>0<v[0]>>>0?1:0)|0,a[2]=a[2]+886263092+(a[1]>>>0<v[1]>>>0?1:0)|0,a[3]=a[3]+1295307597+(a[2]>>>0<v[2]>>>0?1:0)|0,a[4]=a[4]+3545052371+(a[3]>>>0<v[3]>>>0?1:0)|0,a[5]=a[5]+886263092+(a[4]>>>0<v[4]>>>0?1:0)|0,a[6]=a[6]+1295307597+(a[5]>>>0<v[5]>>>0?1:0)|0,a[7]=a[7]+3545052371+(a[6]>>>0<v[6]>>>0?1:0)|0,this._b=a[7]>>>0<v[7]>>>0?1:0;for(var d=0;d<8;d++){var p=f[d]+a[d],e=p&65535,r=p>>>16,n=((e*e>>>17)+e*r>>>15)+r*r,s=((p&4294901760)*p|0)+((p&65535)*p|0);c[d]=n^s}f[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,f[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,f[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,f[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,f[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,f[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,f[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,f[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}N.Rabbit=L._createHelper(u)}(),P.Rabbit})}(Vt)),Vt.exports}var jt={exports:{}},Lr;function In(){return Lr||(Lr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Xe(),Je(),Ye(),Me())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.StreamCipher,R=N.algo,x=[],v=[],c=[],u=R.RabbitLegacy=L.extend({_doReset:function(){var f=this._key.words,a=this.cfg.iv,d=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],p=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var e=0;e<4;e++)S.call(this);for(var e=0;e<8;e++)p[e]^=d[e+4&7];if(a){var r=a.words,n=r[0],s=r[1],t=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,i=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,l=t>>>16|i&4294901760,E=i<<16|t&65535;p[0]^=t,p[1]^=l,p[2]^=i,p[3]^=E,p[4]^=t,p[5]^=l,p[6]^=i,p[7]^=E;for(var e=0;e<4;e++)S.call(this)}},_doProcessBlock:function(f,a){var d=this._X;S.call(this),x[0]=d[0]^d[5]>>>16^d[3]<<16,x[1]=d[2]^d[7]>>>16^d[5]<<16,x[2]=d[4]^d[1]>>>16^d[7]<<16,x[3]=d[6]^d[3]>>>16^d[1]<<16;for(var p=0;p<4;p++)x[p]=(x[p]<<8|x[p]>>>24)&16711935|(x[p]<<24|x[p]>>>8)&4278255360,f[a+p]^=x[p]},blockSize:128/32,ivSize:64/32});function S(){for(var f=this._X,a=this._C,d=0;d<8;d++)v[d]=a[d];a[0]=a[0]+1295307597+this._b|0,a[1]=a[1]+3545052371+(a[0]>>>0<v[0]>>>0?1:0)|0,a[2]=a[2]+886263092+(a[1]>>>0<v[1]>>>0?1:0)|0,a[3]=a[3]+1295307597+(a[2]>>>0<v[2]>>>0?1:0)|0,a[4]=a[4]+3545052371+(a[3]>>>0<v[3]>>>0?1:0)|0,a[5]=a[5]+886263092+(a[4]>>>0<v[4]>>>0?1:0)|0,a[6]=a[6]+1295307597+(a[5]>>>0<v[5]>>>0?1:0)|0,a[7]=a[7]+3545052371+(a[6]>>>0<v[6]>>>0?1:0)|0,this._b=a[7]>>>0<v[7]>>>0?1:0;for(var d=0;d<8;d++){var p=f[d]+a[d],e=p&65535,r=p>>>16,n=((e*e>>>17)+e*r>>>15)+r*r,s=((p&4294901760)*p|0)+((p&65535)*p|0);c[d]=n^s}f[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,f[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,f[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,f[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,f[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,f[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,f[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,f[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}N.RabbitLegacy=L._createHelper(u)}(),P.RabbitLegacy})}(jt)),jt.exports}var Wt={exports:{}},Ur;function Bn(){return Ur||(Ur=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Xe(),Je(),Ye(),Me())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.BlockCipher,R=N.algo;const x=16,v=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var u={pbox:[],sbox:[]};function S(e,r){let n=r>>24&255,s=r>>16&255,t=r>>8&255,i=r&255,l=e.sbox[0][n]+e.sbox[1][s];return l=l^e.sbox[2][t],l=l+e.sbox[3][i],l}function f(e,r,n){let s=r,t=n,i;for(let l=0;l<x;++l)s=s^e.pbox[l],t=S(e,s)^t,i=s,s=t,t=i;return i=s,s=t,t=i,t=t^e.pbox[x],s=s^e.pbox[x+1],{left:s,right:t}}function a(e,r,n){let s=r,t=n,i;for(let l=x+1;l>1;--l)s=s^e.pbox[l],t=S(e,s)^t,i=s,s=t,t=i;return i=s,s=t,t=i,t=t^e.pbox[1],s=s^e.pbox[0],{left:s,right:t}}function d(e,r,n){for(let E=0;E<4;E++){e.sbox[E]=[];for(let b=0;b<256;b++)e.sbox[E][b]=c[E][b]}let s=0;for(let E=0;E<x+2;E++)e.pbox[E]=v[E]^r[s],s++,s>=n&&(s=0);let t=0,i=0,l=0;for(let E=0;E<x+2;E+=2)l=f(e,t,i),t=l.left,i=l.right,e.pbox[E]=t,e.pbox[E+1]=i;for(let E=0;E<4;E++)for(let b=0;b<256;b+=2)l=f(e,t,i),t=l.left,i=l.right,e.sbox[E][b]=t,e.sbox[E][b+1]=i;return!0}var p=R.Blowfish=L.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,r=e.words,n=e.sigBytes/4;d(u,r,n)}},encryptBlock:function(e,r){var n=f(u,e[r],e[r+1]);e[r]=n.left,e[r+1]=n.right},decryptBlock:function(e,r){var n=a(u,e[r],e[r+1]);e[r]=n.left,e[r+1]=n.right},blockSize:64/32,keySize:128/32,ivSize:64/32});N.Blowfish=L._createHelper(p)}(),P.Blowfish})}(Wt)),Wt.exports}(function(W,M){(function(P,N,J){W.exports=N(Se(),rt(),ln(),pn(),Xe(),fn(),Je(),dr(),mt(),hn(),hr(),vn(),mn(),En(),_t(),gn(),Ye(),Me(),yn(),xn(),Sn(),bn(),_n(),Rn(),Cn(),Tn(),Dn(),An(),wn(),On(),Pn(),Mn(),kn(),In(),Bn())})(ye,function(P){return P})})(tr);var Nn=tr.exports,Ze=un(Nn);function Ln(W){return Ze.MD5(W).toString().toUpperCase()}function Un(W,M,P,N,J,L,R,x){var v;let c="";L.set("x-log-apiversion","0.6.0"),L.set("x-log-signaturemethod","hmac-sha1"),c+=W+`
16
+ */return P.mode.CTRGladman=function(){var N=P.lib.BlockCipherMode.extend();function J(x){if((x>>24&255)===255){var v=x>>16&255,c=x>>8&255,u=x&255;v===255?(v=0,c===255?(c=0,u===255?u=0:++u):++c):++v,x=0,x+=v<<16,x+=c<<8,x+=u}else x+=1<<24;return x}function L(x){return(x[0]=J(x[0]))===0&&(x[1]=J(x[1])),x}var R=N.Encryptor=N.extend({processBlock:function(x,v){var c=this._cipher,u=c.blockSize,S=this._iv,f=this._counter;S&&(f=this._counter=S.slice(0),this._iv=void 0),L(f);var a=f.slice(0);c.encryptBlock(a,0);for(var d=0;d<u;d++)x[v+d]^=a[d]}});return N.Decryptor=R,N}(),P.mode.CTRGladman})}(Ot)),Ot.exports}var wt={exports:{}},Cr;function bn(){return Cr||(Cr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.mode.OFB=function(){var N=P.lib.BlockCipherMode.extend(),J=N.Encryptor=N.extend({processBlock:function(L,R){var x=this._cipher,v=x.blockSize,c=this._iv,u=this._keystream;c&&(u=this._keystream=c.slice(0),this._iv=void 0),x.encryptBlock(u,0);for(var S=0;S<v;S++)L[R+S]^=u[S]}});return N.Decryptor=J,N}(),P.mode.OFB})}(wt)),wt.exports}var Pt={exports:{}},Tr;function _n(){return Tr||(Tr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.mode.ECB=function(){var N=P.lib.BlockCipherMode.extend();return N.Encryptor=N.extend({processBlock:function(J,L){this._cipher.encryptBlock(J,L)}}),N.Decryptor=N.extend({processBlock:function(J,L){this._cipher.decryptBlock(J,L)}}),N}(),P.mode.ECB})}(Pt)),Pt.exports}var Mt={exports:{}},Dr;function Rn(){return Dr||(Dr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.pad.AnsiX923={pad:function(N,J){var L=N.sigBytes,R=J*4,x=R-L%R,v=L+x-1;N.clamp(),N.words[v>>>2]|=x<<24-v%4*8,N.sigBytes+=x},unpad:function(N){var J=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=J}},P.pad.Ansix923})}(Mt)),Mt.exports}var kt={exports:{}},Ar;function Cn(){return Ar||(Ar=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.pad.Iso10126={pad:function(N,J){var L=J*4,R=L-N.sigBytes%L;N.concat(P.lib.WordArray.random(R-1)).concat(P.lib.WordArray.create([R<<24],1))},unpad:function(N){var J=N.words[N.sigBytes-1>>>2]&255;N.sigBytes-=J}},P.pad.Iso10126})}(kt)),kt.exports}var It={exports:{}},Or;function Tn(){return Or||(Or=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.pad.Iso97971={pad:function(N,J){N.concat(P.lib.WordArray.create([2147483648],1)),P.pad.ZeroPadding.pad(N,J)},unpad:function(N){P.pad.ZeroPadding.unpad(N),N.sigBytes--}},P.pad.Iso97971})}(It)),It.exports}var Bt={exports:{}},wr;function Dn(){return wr||(wr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.pad.ZeroPadding={pad:function(N,J){var L=J*4;N.clamp(),N.sigBytes+=L-(N.sigBytes%L||L)},unpad:function(N){for(var J=N.words,L=N.sigBytes-1,L=N.sigBytes-1;L>=0;L--)if(J[L>>>2]>>>24-L%4*8&255){N.sigBytes=L+1;break}}},P.pad.ZeroPadding})}(Bt)),Bt.exports}var Nt={exports:{}},Pr;function An(){return Pr||(Pr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return P.pad.NoPadding={pad:function(){},unpad:function(){}},P.pad.NoPadding})}(Nt)),Nt.exports}var Lt={exports:{}},Mr;function On(){return Mr||(Mr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Me())})(ye,function(P){return function(N){var J=P,L=J.lib,R=L.CipherParams,x=J.enc,v=x.Hex,c=J.format;c.Hex={stringify:function(u){return u.ciphertext.toString(v)},parse:function(u){var S=v.parse(u);return R.create({ciphertext:S})}}}(),P.format.Hex})}(Lt)),Lt.exports}var Ut={exports:{}},kr;function wn(){return kr||(kr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Je(),Qe(),Ye(),Me())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.BlockCipher,R=N.algo,x=[],v=[],c=[],u=[],S=[],f=[],a=[],d=[],p=[],e=[];(function(){for(var s=[],t=0;t<256;t++)t<128?s[t]=t<<1:s[t]=t<<1^283;for(var i=0,l=0,t=0;t<256;t++){var E=l^l<<1^l<<2^l<<3^l<<4;E=E>>>8^E&255^99,x[i]=E,v[E]=i;var b=s[i],_=s[b],h=s[_],o=s[E]*257^E*16843008;c[i]=o<<24|o>>>8,u[i]=o<<16|o>>>16,S[i]=o<<8|o>>>24,f[i]=o;var o=h*16843009^_*65537^b*257^i*16843008;a[E]=o<<24|o>>>8,d[E]=o<<16|o>>>16,p[E]=o<<8|o>>>24,e[E]=o,i?(i=b^s[s[s[h^b]]],l^=s[s[l]]):i=l=1}})();var r=[0,1,2,4,8,16,32,64,128,27,54],n=R.AES=L.extend({_doReset:function(){var s;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var t=this._keyPriorReset=this._key,i=t.words,l=t.sigBytes/4,E=this._nRounds=l+6,b=(E+1)*4,_=this._keySchedule=[],h=0;h<b;h++)h<l?_[h]=i[h]:(s=_[h-1],h%l?l>6&&h%l==4&&(s=x[s>>>24]<<24|x[s>>>16&255]<<16|x[s>>>8&255]<<8|x[s&255]):(s=s<<8|s>>>24,s=x[s>>>24]<<24|x[s>>>16&255]<<16|x[s>>>8&255]<<8|x[s&255],s^=r[h/l|0]<<24),_[h]=_[h-l]^s);for(var o=this._invKeySchedule=[],g=0;g<b;g++){var h=b-g;if(g%4)var s=_[h];else var s=_[h-4];g<4||h<=4?o[g]=s:o[g]=a[x[s>>>24]]^d[x[s>>>16&255]]^p[x[s>>>8&255]]^e[x[s&255]]}}},encryptBlock:function(s,t){this._doCryptBlock(s,t,this._keySchedule,c,u,S,f,x)},decryptBlock:function(s,t){var i=s[t+1];s[t+1]=s[t+3],s[t+3]=i,this._doCryptBlock(s,t,this._invKeySchedule,a,d,p,e,v);var i=s[t+1];s[t+1]=s[t+3],s[t+3]=i},_doCryptBlock:function(s,t,i,l,E,b,_,h){for(var o=this._nRounds,g=s[t]^i[0],m=s[t+1]^i[1],T=s[t+2]^i[2],C=s[t+3]^i[3],D=4,y=1;y<o;y++){var A=l[g>>>24]^E[m>>>16&255]^b[T>>>8&255]^_[C&255]^i[D++],w=l[m>>>24]^E[T>>>16&255]^b[C>>>8&255]^_[g&255]^i[D++],j=l[T>>>24]^E[C>>>16&255]^b[g>>>8&255]^_[m&255]^i[D++],I=l[C>>>24]^E[g>>>16&255]^b[m>>>8&255]^_[T&255]^i[D++];g=A,m=w,T=j,C=I}var A=(h[g>>>24]<<24|h[m>>>16&255]<<16|h[T>>>8&255]<<8|h[C&255])^i[D++],w=(h[m>>>24]<<24|h[T>>>16&255]<<16|h[C>>>8&255]<<8|h[g&255])^i[D++],j=(h[T>>>24]<<24|h[C>>>16&255]<<16|h[g>>>8&255]<<8|h[m&255])^i[D++],I=(h[C>>>24]<<24|h[g>>>16&255]<<16|h[m>>>8&255]<<8|h[T&255])^i[D++];s[t]=A,s[t+1]=w,s[t+2]=j,s[t+3]=I},keySize:256/32});N.AES=L._createHelper(n)}(),P.AES})}(Ut)),Ut.exports}var Ft={exports:{}},Ir;function Pn(){return Ir||(Ir=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Je(),Qe(),Ye(),Me())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.WordArray,R=J.BlockCipher,x=N.algo,v=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],c=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],S=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],f=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],a=x.DES=R.extend({_doReset:function(){for(var r=this._key,n=r.words,s=[],t=0;t<56;t++){var i=v[t]-1;s[t]=n[i>>>5]>>>31-i%32&1}for(var l=this._subKeys=[],E=0;E<16;E++){for(var b=l[E]=[],_=u[E],t=0;t<24;t++)b[t/6|0]|=s[(c[t]-1+_)%28]<<31-t%6,b[4+(t/6|0)]|=s[28+(c[t+24]-1+_)%28]<<31-t%6;b[0]=b[0]<<1|b[0]>>>31;for(var t=1;t<7;t++)b[t]=b[t]>>>(t-1)*4+3;b[7]=b[7]<<5|b[7]>>>27}for(var h=this._invSubKeys=[],t=0;t<16;t++)h[t]=l[15-t]},encryptBlock:function(r,n){this._doCryptBlock(r,n,this._subKeys)},decryptBlock:function(r,n){this._doCryptBlock(r,n,this._invSubKeys)},_doCryptBlock:function(r,n,s){this._lBlock=r[n],this._rBlock=r[n+1],d.call(this,4,252645135),d.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),d.call(this,1,1431655765);for(var t=0;t<16;t++){for(var i=s[t],l=this._lBlock,E=this._rBlock,b=0,_=0;_<8;_++)b|=S[_][((E^i[_])&f[_])>>>0];this._lBlock=E,this._rBlock=l^b}var h=this._lBlock;this._lBlock=this._rBlock,this._rBlock=h,d.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),d.call(this,16,65535),d.call(this,4,252645135),r[n]=this._lBlock,r[n+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function d(r,n){var s=(this._lBlock>>>r^this._rBlock)&n;this._rBlock^=s,this._lBlock^=s<<r}function p(r,n){var s=(this._rBlock>>>r^this._lBlock)&n;this._lBlock^=s,this._rBlock^=s<<r}N.DES=R._createHelper(a);var e=x.TripleDES=R.extend({_doReset:function(){var r=this._key,n=r.words;if(n.length!==2&&n.length!==4&&n.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var s=n.slice(0,2),t=n.length<4?n.slice(0,2):n.slice(2,4),i=n.length<6?n.slice(0,2):n.slice(4,6);this._des1=a.createEncryptor(L.create(s)),this._des2=a.createEncryptor(L.create(t)),this._des3=a.createEncryptor(L.create(i))},encryptBlock:function(r,n){this._des1.encryptBlock(r,n),this._des2.decryptBlock(r,n),this._des3.encryptBlock(r,n)},decryptBlock:function(r,n){this._des3.decryptBlock(r,n),this._des2.encryptBlock(r,n),this._des1.decryptBlock(r,n)},keySize:192/32,ivSize:64/32,blockSize:64/32});N.TripleDES=R._createHelper(e)}(),P.TripleDES})}(Ft)),Ft.exports}var Ht={exports:{}},Br;function Mn(){return Br||(Br=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Je(),Qe(),Ye(),Me())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.StreamCipher,R=N.algo,x=R.RC4=L.extend({_doReset:function(){for(var u=this._key,S=u.words,f=u.sigBytes,a=this._S=[],d=0;d<256;d++)a[d]=d;for(var d=0,p=0;d<256;d++){var e=d%f,r=S[e>>>2]>>>24-e%4*8&255;p=(p+a[d]+r)%256;var n=a[d];a[d]=a[p],a[p]=n}this._i=this._j=0},_doProcessBlock:function(u,S){u[S]^=v.call(this)},keySize:256/32,ivSize:0});function v(){for(var u=this._S,S=this._i,f=this._j,a=0,d=0;d<4;d++){S=(S+1)%256,f=(f+u[S])%256;var p=u[S];u[S]=u[f],u[f]=p,a|=u[(u[S]+u[f])%256]<<24-d*8}return this._i=S,this._j=f,a}N.RC4=L._createHelper(x);var c=R.RC4Drop=x.extend({cfg:x.cfg.extend({drop:192}),_doReset:function(){x._doReset.call(this);for(var u=this.cfg.drop;u>0;u--)v.call(this)}});N.RC4Drop=L._createHelper(c)}(),P.RC4})}(Ht)),Ht.exports}var Vt={exports:{}},Nr;function kn(){return Nr||(Nr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Je(),Qe(),Ye(),Me())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.StreamCipher,R=N.algo,x=[],v=[],c=[],u=R.Rabbit=L.extend({_doReset:function(){for(var f=this._key.words,a=this.cfg.iv,d=0;d<4;d++)f[d]=(f[d]<<8|f[d]>>>24)&16711935|(f[d]<<24|f[d]>>>8)&4278255360;var p=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],e=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var d=0;d<4;d++)S.call(this);for(var d=0;d<8;d++)e[d]^=p[d+4&7];if(a){var r=a.words,n=r[0],s=r[1],t=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,i=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,l=t>>>16|i&4294901760,E=i<<16|t&65535;e[0]^=t,e[1]^=l,e[2]^=i,e[3]^=E,e[4]^=t,e[5]^=l,e[6]^=i,e[7]^=E;for(var d=0;d<4;d++)S.call(this)}},_doProcessBlock:function(f,a){var d=this._X;S.call(this),x[0]=d[0]^d[5]>>>16^d[3]<<16,x[1]=d[2]^d[7]>>>16^d[5]<<16,x[2]=d[4]^d[1]>>>16^d[7]<<16,x[3]=d[6]^d[3]>>>16^d[1]<<16;for(var p=0;p<4;p++)x[p]=(x[p]<<8|x[p]>>>24)&16711935|(x[p]<<24|x[p]>>>8)&4278255360,f[a+p]^=x[p]},blockSize:128/32,ivSize:64/32});function S(){for(var f=this._X,a=this._C,d=0;d<8;d++)v[d]=a[d];a[0]=a[0]+1295307597+this._b|0,a[1]=a[1]+3545052371+(a[0]>>>0<v[0]>>>0?1:0)|0,a[2]=a[2]+886263092+(a[1]>>>0<v[1]>>>0?1:0)|0,a[3]=a[3]+1295307597+(a[2]>>>0<v[2]>>>0?1:0)|0,a[4]=a[4]+3545052371+(a[3]>>>0<v[3]>>>0?1:0)|0,a[5]=a[5]+886263092+(a[4]>>>0<v[4]>>>0?1:0)|0,a[6]=a[6]+1295307597+(a[5]>>>0<v[5]>>>0?1:0)|0,a[7]=a[7]+3545052371+(a[6]>>>0<v[6]>>>0?1:0)|0,this._b=a[7]>>>0<v[7]>>>0?1:0;for(var d=0;d<8;d++){var p=f[d]+a[d],e=p&65535,r=p>>>16,n=((e*e>>>17)+e*r>>>15)+r*r,s=((p&4294901760)*p|0)+((p&65535)*p|0);c[d]=n^s}f[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,f[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,f[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,f[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,f[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,f[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,f[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,f[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}N.Rabbit=L._createHelper(u)}(),P.Rabbit})}(Vt)),Vt.exports}var jt={exports:{}},Lr;function In(){return Lr||(Lr=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Je(),Qe(),Ye(),Me())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.StreamCipher,R=N.algo,x=[],v=[],c=[],u=R.RabbitLegacy=L.extend({_doReset:function(){var f=this._key.words,a=this.cfg.iv,d=this._X=[f[0],f[3]<<16|f[2]>>>16,f[1],f[0]<<16|f[3]>>>16,f[2],f[1]<<16|f[0]>>>16,f[3],f[2]<<16|f[1]>>>16],p=this._C=[f[2]<<16|f[2]>>>16,f[0]&4294901760|f[1]&65535,f[3]<<16|f[3]>>>16,f[1]&4294901760|f[2]&65535,f[0]<<16|f[0]>>>16,f[2]&4294901760|f[3]&65535,f[1]<<16|f[1]>>>16,f[3]&4294901760|f[0]&65535];this._b=0;for(var e=0;e<4;e++)S.call(this);for(var e=0;e<8;e++)p[e]^=d[e+4&7];if(a){var r=a.words,n=r[0],s=r[1],t=(n<<8|n>>>24)&16711935|(n<<24|n>>>8)&4278255360,i=(s<<8|s>>>24)&16711935|(s<<24|s>>>8)&4278255360,l=t>>>16|i&4294901760,E=i<<16|t&65535;p[0]^=t,p[1]^=l,p[2]^=i,p[3]^=E,p[4]^=t,p[5]^=l,p[6]^=i,p[7]^=E;for(var e=0;e<4;e++)S.call(this)}},_doProcessBlock:function(f,a){var d=this._X;S.call(this),x[0]=d[0]^d[5]>>>16^d[3]<<16,x[1]=d[2]^d[7]>>>16^d[5]<<16,x[2]=d[4]^d[1]>>>16^d[7]<<16,x[3]=d[6]^d[3]>>>16^d[1]<<16;for(var p=0;p<4;p++)x[p]=(x[p]<<8|x[p]>>>24)&16711935|(x[p]<<24|x[p]>>>8)&4278255360,f[a+p]^=x[p]},blockSize:128/32,ivSize:64/32});function S(){for(var f=this._X,a=this._C,d=0;d<8;d++)v[d]=a[d];a[0]=a[0]+1295307597+this._b|0,a[1]=a[1]+3545052371+(a[0]>>>0<v[0]>>>0?1:0)|0,a[2]=a[2]+886263092+(a[1]>>>0<v[1]>>>0?1:0)|0,a[3]=a[3]+1295307597+(a[2]>>>0<v[2]>>>0?1:0)|0,a[4]=a[4]+3545052371+(a[3]>>>0<v[3]>>>0?1:0)|0,a[5]=a[5]+886263092+(a[4]>>>0<v[4]>>>0?1:0)|0,a[6]=a[6]+1295307597+(a[5]>>>0<v[5]>>>0?1:0)|0,a[7]=a[7]+3545052371+(a[6]>>>0<v[6]>>>0?1:0)|0,this._b=a[7]>>>0<v[7]>>>0?1:0;for(var d=0;d<8;d++){var p=f[d]+a[d],e=p&65535,r=p>>>16,n=((e*e>>>17)+e*r>>>15)+r*r,s=((p&4294901760)*p|0)+((p&65535)*p|0);c[d]=n^s}f[0]=c[0]+(c[7]<<16|c[7]>>>16)+(c[6]<<16|c[6]>>>16)|0,f[1]=c[1]+(c[0]<<8|c[0]>>>24)+c[7]|0,f[2]=c[2]+(c[1]<<16|c[1]>>>16)+(c[0]<<16|c[0]>>>16)|0,f[3]=c[3]+(c[2]<<8|c[2]>>>24)+c[1]|0,f[4]=c[4]+(c[3]<<16|c[3]>>>16)+(c[2]<<16|c[2]>>>16)|0,f[5]=c[5]+(c[4]<<8|c[4]>>>24)+c[3]|0,f[6]=c[6]+(c[5]<<16|c[5]>>>16)+(c[4]<<16|c[4]>>>16)|0,f[7]=c[7]+(c[6]<<8|c[6]>>>24)+c[5]|0}N.RabbitLegacy=L._createHelper(u)}(),P.RabbitLegacy})}(jt)),jt.exports}var Wt={exports:{}},Ur;function Bn(){return Ur||(Ur=1,function(W,M){(function(P,N,J){W.exports=N(Se(),Je(),Qe(),Ye(),Me())})(ye,function(P){return function(){var N=P,J=N.lib,L=J.BlockCipher,R=N.algo;const x=16,v=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],c=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var u={pbox:[],sbox:[]};function S(e,r){let n=r>>24&255,s=r>>16&255,t=r>>8&255,i=r&255,l=e.sbox[0][n]+e.sbox[1][s];return l=l^e.sbox[2][t],l=l+e.sbox[3][i],l}function f(e,r,n){let s=r,t=n,i;for(let l=0;l<x;++l)s=s^e.pbox[l],t=S(e,s)^t,i=s,s=t,t=i;return i=s,s=t,t=i,t=t^e.pbox[x],s=s^e.pbox[x+1],{left:s,right:t}}function a(e,r,n){let s=r,t=n,i;for(let l=x+1;l>1;--l)s=s^e.pbox[l],t=S(e,s)^t,i=s,s=t,t=i;return i=s,s=t,t=i,t=t^e.pbox[1],s=s^e.pbox[0],{left:s,right:t}}function d(e,r,n){for(let E=0;E<4;E++){e.sbox[E]=[];for(let b=0;b<256;b++)e.sbox[E][b]=c[E][b]}let s=0;for(let E=0;E<x+2;E++)e.pbox[E]=v[E]^r[s],s++,s>=n&&(s=0);let t=0,i=0,l=0;for(let E=0;E<x+2;E+=2)l=f(e,t,i),t=l.left,i=l.right,e.pbox[E]=t,e.pbox[E+1]=i;for(let E=0;E<4;E++)for(let b=0;b<256;b+=2)l=f(e,t,i),t=l.left,i=l.right,e.sbox[E][b]=t,e.sbox[E][b+1]=i;return!0}var p=R.Blowfish=L.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var e=this._keyPriorReset=this._key,r=e.words,n=e.sigBytes/4;d(u,r,n)}},encryptBlock:function(e,r){var n=f(u,e[r],e[r+1]);e[r]=n.left,e[r+1]=n.right},decryptBlock:function(e,r){var n=a(u,e[r],e[r+1]);e[r]=n.left,e[r+1]=n.right},blockSize:64/32,keySize:128/32,ivSize:64/32});N.Blowfish=L._createHelper(p)}(),P.Blowfish})}(Wt)),Wt.exports}(function(W,M){(function(P,N,J){W.exports=N(Se(),rt(),ln(),pn(),Je(),fn(),Qe(),dr(),mt(),hn(),hr(),vn(),mn(),En(),_t(),gn(),Ye(),Me(),yn(),xn(),Sn(),bn(),_n(),Rn(),Cn(),Tn(),Dn(),An(),On(),wn(),Pn(),Mn(),kn(),In(),Bn())})(ye,function(P){return P})})(tr);var Nn=tr.exports,et=un(Nn);function Ln(W){return et.MD5(W).toString().toUpperCase()}function Un(W,M,P,N,J,L,R,x){var v;let c="";L.set("x-log-apiversion","0.6.0"),L.set("x-log-signaturemethod","hmac-sha1"),c+=W+`
17
17
  `+R+`
18
18
  `+((v=L.get("Content-Type"))!=null?v:"")+`
19
19
  `+x+`
20
20
  `;const u=(d,p)=>d[0].localeCompare(p[0]),S=d=>d[0].startsWith("x-log-")||d[0].startsWith("x-acs-");try{const d=[...L.entries()].filter(S).sort(u).map(p=>p[0]+":"+p[1]+`
21
- `).join("");c+=d}catch{}c+=M,J.size>0&&(c+="?");try{c+=[...J.entries()].sort(u).map(d=>d[0]+"="+d[1]).join("&")}catch{}const f=Ze.HmacSHA1(c,N).toString(Ze.enc.Base64),a="LOG "+P+":"+f;return L.set("Authorization",a),L.set("x-log-date",x),a}var Fn=(W,M,P)=>new Promise((N,J)=>{var L=v=>{try{x(P.next(v))}catch(c){J(c)}},R=v=>{try{x(P.throw(v))}catch(c){J(c)}},x=v=>v.done?N(v.value):Promise.resolve(v.value).then(L,R);x((P=P.apply(W,M)).next())});function Hn(W){return Fn(this,null,function*(){const M=new Date;if(W.refreshSTSTokenInterval||(W.refreshSTSTokenInterval=3e5),!W.stsTokenFreshTime||+M-W.stsTokenFreshTime>=W.refreshSTSTokenInterval){W.stsTokenFreshTime=M;try{yield W.refreshSTSToken()}catch(P){typeof console.error=="function"&&console.error(`Some error occured during excuting refreshSTSToken, see:
21
+ `).join("");c+=d}catch{}c+=M,J.size>0&&(c+="?");try{c+=[...J.entries()].sort(u).map(d=>d[0]+"="+d[1]).join("&")}catch{}const f=et.HmacSHA1(c,N).toString(et.enc.Base64),a="LOG "+P+":"+f;return L.set("Authorization",a),L.set("x-log-date",x),a}var Fn=(W,M,P)=>new Promise((N,J)=>{var L=v=>{try{x(P.next(v))}catch(c){J(c)}},R=v=>{try{x(P.throw(v))}catch(c){J(c)}},x=v=>v.done?N(v.value):Promise.resolve(v.value).then(L,R);x((P=P.apply(W,M)).next())});function Hn(W){return Fn(this,null,function*(){const M=new Date;if(W.refreshSTSTokenInterval||(W.refreshSTSTokenInterval=3e5),!W.stsTokenFreshTime||+M-W.stsTokenFreshTime>=W.refreshSTSTokenInterval){W.stsTokenFreshTime=M;try{yield W.refreshSTSToken()}catch(P){typeof console.error=="function"&&console.error(`Some error occured during excuting refreshSTSToken, see:
22
22
  `+P)}}return null})}var Vn=(W,M,P)=>new Promise((N,J)=>{var L=v=>{try{x(P.next(v))}catch(c){J(c)}},R=v=>{try{x(P.throw(v))}catch(c){J(c)}},x=v=>v.done?N(v.value):Promise.resolve(v.value).then(L,R);x((P=P.apply(W,M)).next())});function Fr(W){return{transString:function(M){let P={},N=0,J=!1;for(let L in M){if((L==="time"||L==="__time__")&&typeof M[L]=="number"){N=M[L],J=!0;continue}typeof M[L]=="object"?P[L]=JSON.stringify(M[L]):P[L]=String(M[L])}return P.__time__=J?N:Math.floor(new Date().getTime()/1e3),P},process:function(M,P){return Vn(this,null,function*(){yield Hn(W);let N=M.slice(M.indexOf("/logstores")),J=P.length,L=Ln(P),R=new Date().toUTCString(),x=new Map,v=new Map([["Content-Type","application/json"],["Content-MD5",L],["x-log-bodyrawsize",J.toString()]]);W.securityToken&&v.set("x-acs-security-token",W.securityToken),Un("POST",N,W.accessKeyId,W.accessKeySecret,x,v,L,R);let c=Object.fromEntries(v);return{data:P,header:c}})}}}typeof window<"u"&&$t(window,"stsPlugin",Fr);var Hr={exports:{}};/*! aliyun rts sdk - ver2.12.5 created:2025/6/6 14:17:23 */(function(W,M){(function(P,N){W.exports=N()})(self,()=>(()=>{var P={280:L=>{var R;R=()=>(()=>{var x={692:S=>{var f=S.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(a){return a.encoding?"rtpmap:%d %s/%s/%s":a.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(a){return a.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(a){return a.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(a){return"extmap:%d"+(a.direction?"/%s":"%v")+(a["encrypt-uri"]?" %s":"%v")+" %s"+(a.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(a){return a.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(a){var d="candidate:%s %d %s %d %s %d typ %s";return d+=a.raddr!=null?" raddr %s rport %d":"%v%v",d+=a.tcptype!=null?" tcptype %s":"%v",a.generation!=null&&(d+=" generation %d"),(d+=a["network-id"]!=null?" network-id %d":"%v")+(a["network-cost"]!=null?" network-cost %d":"%v")}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(a){var d="ssrc:%d";return a.attribute!=null&&(d+=" %s",a.value!=null&&(d+=":%s")),d}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(a){return a.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(a){return a.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(a){return"imageattr:%s %s %s"+(a.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(a){return"simulcast:%s %s"+(a.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(a){return"ts-refclk:%s"+(a.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(a){var d="mediaclk:";return d+=a.id!=null?"id=%s %s":"%v%s",d+=a.mediaClockValue!=null?"=%s":"",(d+=a.rateNumerator!=null?" rate=%s":"")+(a.rateDenominator!=null?"/%s":"")}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(f).forEach(function(a){f[a].forEach(function(d){d.reg||(d.reg=/(.*)/),d.format||(d.format="%s")})})},766:(S,f,a)=>{var d=a(962),p=a(627);f.write=p,f.parse=d.parse,f.parseParams=d.parseParams,f.parseFmtpConfig=d.parseFmtpConfig,f.parsePayloads=d.parsePayloads,f.parseRemoteCandidates=d.parseRemoteCandidates,f.parseImageAttributes=d.parseImageAttributes,f.parseSimulcastStreamList=d.parseSimulcastStreamList},962:(S,f,a)=>{var d=function(s){return String(Number(s))===s?Number(s):s},p=function(s,t,i){var l=s.name&&s.names;s.push&&!t[s.push]?t[s.push]=[]:l&&!t[s.name]&&(t[s.name]={});var E=s.push?{}:l?t[s.name]:t;(function(b,_,h,o){if(o&&!h)_[o]=d(b[1]);else for(var g=0;g<h.length;g+=1)b[g+1]!=null&&(_[h[g]]=d(b[g+1]))})(i.match(s.reg),E,s.names,s.name),s.push&&t[s.push].push(E)},e=a(692),r=RegExp.prototype.test.bind(/^([a-z])=(.*)/);f.parse=function(s){var t={},i=[],l=t;return s.split(/(\r\n|\r|\n)/).filter(r).forEach(function(E){var b=E[0],_=E.slice(2);b==="m"&&(i.push({rtp:[],fmtp:[]}),l=i[i.length-1]);for(var h=0;h<(e[b]||[]).length;h+=1){var o=e[b][h];if(o.reg.test(_))return p(o,l,_)}}),t.media=i,t};var n=function(s,t){var i=t.split(/=(.+)/,2);return i.length===2?s[i[0]]=d(i[1]):i.length===1&&t.length>1&&(s[i[0]]=void 0),s};f.parseParams=function(s){return s.split(/;\s?/).reduce(n,{})},f.parseFmtpConfig=f.parseParams,f.parsePayloads=function(s){return s.toString().split(" ").map(Number)},f.parseRemoteCandidates=function(s){for(var t=[],i=s.split(" ").map(d),l=0;l<i.length;l+=3)t.push({component:i[l],ip:i[l+1],port:i[l+2]});return t},f.parseImageAttributes=function(s){return s.split(" ").map(function(t){return t.substring(1,t.length-1).split(",").reduce(n,{})})},f.parseSimulcastStreamList=function(s){return s.split(";").map(function(t){return t.split(",").map(function(i){var l,E=!1;return i[0]!=="~"?l=d(i):(l=d(i.substring(1,i.length)),E=!0),{scid:l,paused:E}})})}},627:(S,f,a)=>{var d=a(692),p=/%[sdv%]/g,e=function(t){var i=1,l=arguments,E=l.length;return t.replace(p,function(b){if(i>=E)return b;var _=l[i];switch(i+=1,b){case"%%":return"%";case"%s":return String(_);case"%d":return Number(_);case"%v":return""}})},r=function(t,i,l){var E=[t+"="+(i.format instanceof Function?i.format(i.push?l:l[i.name]):i.format)];if(i.names)for(var b=0;b<i.names.length;b+=1){var _=i.names[b];i.name?E.push(l[i.name][_]):E.push(l[i.names[b]])}else E.push(l[i.name]);return e.apply(null,E)},n=["v","o","s","i","u","e","p","c","b","t","r","z","a"],s=["i","c","b","a"];S.exports=function(t,i){i=i||{},t.version==null&&(t.version=0),t.name==null&&(t.name=" "),t.media.forEach(function(_){_.payloads==null&&(_.payloads="")});var l=i.outerOrder||n,E=i.innerOrder||s,b=[];return l.forEach(function(_){d[_].forEach(function(h){h.name in t&&t[h.name]!=null?b.push(r(_,h,t)):h.push in t&&t[h.push]!=null&&t[h.push].forEach(function(o){b.push(r(_,h,o))})})}),t.media.forEach(function(_){b.push(r("m",d.m[0],_)),E.forEach(function(h){d[h].forEach(function(o){o.name in _&&_[o.name]!=null?b.push(r(h,o,_)):o.push in _&&_[o.push]!=null&&_[o.push].forEach(function(g){b.push(r(h,o,g))})})})}),b.join(`\r
23
23
  `)+`\r
24
- `}},776:function(S,f,a){var d,p=this&&this.__extends||(d=function(F,U){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(B,k){B.__proto__=k}||function(B,k){for(var V in k)Object.prototype.hasOwnProperty.call(k,V)&&(B[V]=k[V])},d(F,U)},function(F,U){if(typeof U!="function"&&U!==null)throw new TypeError("Class extends value "+String(U)+" is not a constructor or null");function B(){this.constructor=F}d(F,U),F.prototype=U===null?Object.create(U):(B.prototype=U.prototype,new B)}),e=this&&this.__assign||function(){return e=Object.assign||function(F){for(var U,B=1,k=arguments.length;B<k;B++)for(var V in U=arguments[B])Object.prototype.hasOwnProperty.call(U,V)&&(F[V]=U[V]);return F},e.apply(this,arguments)},r=this&&this.__awaiter||function(F,U,B,k){return new(B||(B=Promise))(function(V,G){function q(re){try{$(k.next(re))}catch(ee){G(ee)}}function z(re){try{$(k.throw(re))}catch(ee){G(ee)}}function $(re){var ee;re.done?V(re.value):(ee=re.value,ee instanceof B?ee:new B(function(ie){ie(ee)})).then(q,z)}$((k=k.apply(F,U||[])).next())})},n=this&&this.__generator||function(F,U){var B,k,V,G,q={label:0,sent:function(){if(1&V[0])throw V[1];return V[1]},trys:[],ops:[]};return G={next:z(0),throw:z(1),return:z(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function z($){return function(re){return function(ee){if(B)throw new TypeError("Generator is already executing.");for(;G&&(G=0,ee[0]&&(q=0)),q;)try{if(B=1,k&&(V=2&ee[0]?k.return:ee[0]?k.throw||((V=k.return)&&V.call(k),0):k.next)&&!(V=V.call(k,ee[1])).done)return V;switch(k=0,V&&(ee=[2&ee[0],V.value]),ee[0]){case 0:case 1:V=ee;break;case 4:return q.label++,{value:ee[1],done:!1};case 5:q.label++,k=ee[1],ee=[0];continue;case 7:ee=q.ops.pop(),q.trys.pop();continue;default:if(!((V=(V=q.trys).length>0&&V[V.length-1])||ee[0]!==6&&ee[0]!==2)){q=0;continue}if(ee[0]===3&&(!V||ee[1]>V[0]&&ee[1]<V[3])){q.label=ee[1];break}if(ee[0]===6&&q.label<V[1]){q.label=V[1],V=ee;break}if(V&&q.label<V[2]){q.label=V[2],q.ops.push(ee);break}V[2]&&q.ops.pop(),q.trys.pop();continue}ee=U.call(F,q)}catch(ie){ee=[6,ie],k=0}finally{B=V=0}if(5&ee[0])throw ee[1];return{value:ee[0]?ee[1]:void 0,done:!0}}([$,re])}}},s=this&&this.__spreadArray||function(F,U,B){if(B||arguments.length===2)for(var k,V=0,G=U.length;V<G;V++)!k&&V in U||(k||(k=Array.prototype.slice.call(U,0,V)),k[V]=U[V]);return F.concat(k||Array.prototype.slice.call(U))},t=this&&this.__importDefault||function(F){return F&&F.__esModule?F:{default:F}};Object.defineProperty(f,"__esModule",{value:!0}),f.PeerConnectionCore=f.DEFAULT_HEARTBEAT_INTERVAL=f.EDatachannelStatus=void 0;var i=a(887),l=a(248),E=a(237),b=a(619),_=a(628),h=a(961),o=a(844),g=a(651);Object.defineProperty(f,"EDatachannelStatus",{enumerable:!0,get:function(){return g.EDatachannelStatus}});var m,T=a(854),C=t(a(885)),D=a(132),y=t(a(123)),A=a(125),O="rts video",j="rts audio";f.DEFAULT_HEARTBEAT_INTERVAL=2500,function(F){F.SUB_ADD="subsribe add",F.SUB_DELETE="subscribe delete",F.SUB_ACTIVE="subscribe active",F.SUB_STOP="subscribe stop",F.PUB_ADD="publish add",F.PUB_DELETE="publish delete",F.PUB_REPLACE="publish replace",F.PUB_STOP="publish stop",F.DATACHANNEL_SUB_ADD="sub add datachannel",F.DATACHANNEL_SUB_ACTIVE="sub active datachannel",F.DATACHANNEL_SUB_STOP="sub delete datachannel",F.DATACHANNEL_PUB_ADD="pub add datachannel",F.DATACHANNEL_PUB_STOP="pub delete datachannel"}(m||(m={}));var I=function(F){function U(B){var k=F.call(this)||this;return k.PCCore=B,k}return p(U,F),U.prototype.excuteSignal=function(B,k,V,G){var q=this;switch(B){case m.SUB_ADD:this.PCCore.proceedSubscribeAdd(G.configList,G.reconnecting).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.SUB_DELETE:this.PCCore.proceedSubscribeDeleteTracks(G.configList,G.skipError).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.SUB_ACTIVE:break;case m.SUB_STOP:this.PCCore.proceedSubscribeStop(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.PUB_ADD:this.PCCore.proceedPublishAdd(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.PUB_REPLACE:this.PCCore.proceedPublishReplaceTracks(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.PUB_DELETE:this.PCCore.proceedPublishDeleteTracks(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.PUB_STOP:this.PCCore.proceedPublishStop(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.DATACHANNEL_SUB_ADD:this.PCCore.proceedSubscribeAddDatachannel(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.DATACHANNEL_SUB_STOP:this.PCCore.proceedSubscribeStopDatachannel(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.DATACHANNEL_PUB_ADD:this.PCCore.proceedPublishAddDatachannel(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.DATACHANNEL_PUB_STOP:this.PCCore.proceedPublishStopDatachannel(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")})}},U}(C.default),H=function(F){function U(B){var k=F.call(this)||this;return k.heartbeatTimelineMap=new Map,k.removeTwcc=!1,k.mutex=!1,k.eventQueue=new T.CacheBuffer("signal queue"),k.signalTimer=null,k.rollbackController=new D.PeerConnectionRollbackController(k),k.onInnerSubscribeDelete=function(){},k.receiverCodecPreferences={},k.senderCodecPreferences={},k.removeTrackListener=function(){},k.heartbeatTimerHandle=null,k.heartbeatTokenRing=0,k.streamManager=new _.StreamManager,B.pc?(k.pc=B.pc,k.signal=new b.Signal({pc:B.pc,onDatachannelEvent:B.onDatachannelEvent}),k.heartbeatProcessor=new y.default(k.signal.getDatachannelCore().getWebrtcDatachannel(),k.streamManager),k.initHeartbeatListener(),k.notifyProcessor=new A.NotifyProcessor,k.initNotifyListener(),k.onInnerSubscribeDelete=B.onInnerSubscribeDelete||function(){},k.offerSdpHook=B.offerSdpHook,k.answerSdpHook=B.answerSdpHook,k):(console.error("peerconnetion is required"),k)}return p(U,F),U.prototype.getStreamManager=function(){return this.streamManager},U.prototype.getSignal=function(){return this.signal},U.prototype.setPrevOfferSdp=function(B){this.prevOfferSdp=B},U.prototype.setPrevAnswerSdp=function(B){this.prevAnswerSdp=B},U.prototype.setStreamManager=function(B){this.streamManager=B},U.prototype.getTrackIds=function(B){return B.reduce(function(k,V){return s(s([],k,!0),[V.id],!1)},[])},U.prototype.setRemoveTwcc=function(B){this.removeTwcc=B},U.prototype.setReceiverCodecPreferences=function(B){this.receiverCodecPreferences=e({},B)},U.prototype.setSenderCodecPreferences=function(B){this.senderCodecPreferences=e({},B)},U.prototype.subscribeAdd=function(B,k){var V=this;return new Promise(function(G,q){var z=new I(V);if(V.mutex){var $={type:m.SUB_ADD,excuter:z,res:G,rej:q,data:{configList:B}};V.eventQueue.cache($)}else V.atomSignalExec(m.SUB_ADD,z,G,q,{configList:B,reconnecting:k})})},U.prototype.subscribeDeleteTracks=function(B,k){var V=this;return new Promise(function(G,q){var z=new I(V);if(V.mutex){var $={type:m.SUB_DELETE,excuter:z,res:G,rej:q,data:{configList:B,skipError:k}};V.eventQueue.cache($)}else V.atomSignalExec(m.SUB_DELETE,z,G,q,{configList:B,skipError:k})})},U.prototype.subscribeStop=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.SUB_STOP,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.SUB_STOP,q,V,G,{configList:B})})},U.prototype.publishAdd=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.PUB_ADD,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.PUB_ADD,q,V,G,{configList:B})})},U.prototype.publishReplaceTracks=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.PUB_REPLACE,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.PUB_REPLACE,q,V,G,{configList:B})})},U.prototype.publishDeleteTracks=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.PUB_DELETE,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.PUB_DELETE,q,V,G,{configList:B})})},U.prototype.publishStop=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.PUB_STOP,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.PUB_STOP,q,V,G,{configList:B})})},U.prototype.subscribeAddDatachannel=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.DATACHANNEL_SUB_ADD,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.DATACHANNEL_SUB_ADD,q,V,G,{configList:B})})},U.prototype.subscribeStopDatachannel=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.DATACHANNEL_SUB_STOP,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.DATACHANNEL_SUB_STOP,q,V,G,{configList:B})})},U.prototype.publishAddDatachannel=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.DATACHANNEL_PUB_ADD,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.DATACHANNEL_PUB_ADD,q,V,G,{configList:B})})},U.prototype.publishStopDatachannel=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.DATACHANNEL_PUB_STOP,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.DATACHANNEL_PUB_STOP,q,V,G,{configList:B})})},U.prototype.atomSignalExec=function(B,k,V,G,q){var z=this;this.mutex=!0,k.once("onSignalDone",function(){z.eventQueue.isEmpty()?z.mutex=!1:setTimeout(function(){var $=z.eventQueue.getFirst();z.atomSignalExec($.type,$.excuter,$.res,$.rej,$.data)})}),k.excuteSignal(B,V,G,q)},U.prototype.proceedSubscribeAdd=function(B,k){return r(this,void 0,void 0,function(){var V,G,q,z,$,re,ee,ie,se=this;return n(this,function(ce){switch(ce.label){case 0:if(this.log("SUB LIST: ",B),V=new Date().getTime(),G=new Date().getTime(),q=new Date().getTime(),z=this,$=this.extendUrl(B),re=$.map(function(ue){var de=ue.urlData,pe=ue.vMsid,Ee=ue.aMsid;if(se.streamManager.has(de.url)){var he=se.streamManager.get(de.url),fe=he.videoInfoList.map(function(Re){return Re.msid}),me=he.audioInfoList.map(function(Re){return Re.msid}),ge=(0,i.intersection)(fe,pe),_e=(0,i.intersection)(me,Ee);if(_e.length||ge.length)return{url:de.url,vMsid:ge,aMsid:_e}}}).filter(function(ue){return ue}),this.log("DELETE LIST: ",re),!re?.length)return[3,4];ce.label=1;case 1:return ce.trys.push([1,3,,4]),[4,this.proceedSubscribeDeleteTracks(re,!0,k)];case 2:return ce.sent(),this.onInnerSubscribeDelete&&this.onInnerSubscribeDelete(re),[3,4];case 3:throw ee=ce.sent(),(ie=ee).extraInfo=e(e({},ie.extraInfo),{api:"subscribeAdd",signal_api:"subscribeDeleteTracks",configList:B}),ie;case 4:return V=new Date().getTime(),[2,new Promise(function(ue,de){return r(se,void 0,void 0,function(){function pe(){return r(this,void 0,void 0,function(){var w,K;return n(this,function(Y){switch(Y.label){case 0:z.removeTrackListener(),w=z.buildUrlStreamMap($),Y.label=1;case 1:return Y.trys.push([1,3,,4]),[4,z.subscribeActive(B)];case 2:return Y.sent(),[3,4];case 3:return(K=Y.sent()).extraInfo=e(e({},K.extraInfo),{api:"subscribeAdd",signal_api:"subscribeActive"}),z.rollbackController.rollback({pcTransceiversRollback:!0,streamManagerRollback:!0}),[2,de(K)];case 4:return G=new Date().getTime(),ue({deleteRspTime:V,subAddRspTime:q,activeRspTime:G,streamList:w}),[2]}})})}var Ee,he,fe,me,ge,_e,Re,Te,Ne,ke,Oe,Ce,Ae,Pe,we,He,We,xe=this;return n(this,function(w){switch(w.label){case 0:if(!this.pc)return[2,de(new h.RtsError(o.ErrorCode.CORE_NO_PC_ERROR,"subscribeAdd: no peerconnection",""))];this.pc.addEventListener("track",pe),this.removeTrackListener=function(){var K;(K=xe.pc)===null||K===void 0||K.removeEventListener("track",pe)},this.rollbackController.saveStreamManager(this.streamManager),Ee=[],$.forEach(function(K){var Y=K.urlData,X=K.vMsid,Z=K.aMsid;if(xe.pc){if(xe.streamManager.init(Y.url),Y.subVideo&&!xe.streamManager.isMsidSubPubDone(Y.url,{vMsid:X[0]})){var te=xe.pc.addTransceiver("video",{direction:"recvonly"});Ee.push({type:"video",msid:X[0],trans:te}),xe.streamManager.update(Y.url,{vMsid:X[0],vTransceiver:te}),xe.setCodecPreferences(te,xe.receiverCodecPreferences.video)}if(Y.subAudio&&!xe.streamManager.isMsidSubPubDone(Y.url,{aMsid:Z[0]})){var Q=xe.pc.addTransceiver("audio",{direction:"recvonly"});Ee.push({type:"audio",msid:Z[0],trans:Q}),xe.streamManager.update(Y.url,{aMsid:Z[0],aTransceiver:Q}),xe.setCodecPreferences(Q,xe.receiverCodecPreferences.audio)}}}),this.rollbackController.setFakeSdpMedias(Ee,"sub"),w.label=1;case 1:return w.trys.push([1,3,,4]),[4,this.pc.createOffer()];case 2:return he=w.sent(),[3,4];case 3:return fe=w.sent(),[2,de(new h.RtsError(o.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer Error: ".concat(fe),"",{api:"subscribeAdd",err:fe}))];case 4:if(me=new l.SdpUtil({sdp:he.sdp||""}),this.restorePublishedSsrc(me),me.addNack(),me.updateBundle(),he=new RTCSessionDescription({type:"offer",sdp:me.generate()}),ge=this.findNewSubPubMids(he?.sdp||"",this.prevOfferSdp||""),this.setPrevOfferSdp(he.sdp||""),this.rollbackController.setFakeSdpMids(ge),_e=this.avoidMsidConflict(he.sdp),this.offerSdpHook)try{_e=this.offerSdpHook(_e)}catch(K){console.log("offerSdpHook error: ",K)}w.label=5;case 5:return w.trys.push([5,7,,9]),[4,this.pc.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:_e}))];case 6:return w.sent(),[3,9];case 7:return Re=w.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0,runSimulateSignal:!0})];case 8:return w.sent(),[2,de(new h.RtsError(o.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(Re),"",{api:"subscribeAdd",sdp:he}))];case 9:if(Te=[],Ne=[],$.forEach(function(K){var Y=new l.SdpUtil({sdp:he?.sdp||""}),X=[],Z=K.vMsid.length!==0,te=K.aMsid.length!==0,Q=!1,oe=!1;Y.detail.media.forEach(function(ne){var ae=String(ne.mid);ge.includes(ae)&&(Ne.includes(ae)||(ne.type==="video"&&Z&&!Q?(X.push(String(ne.mid)),Q=!0):ne.type==="audio"&&te&&!oe&&(X.push(String(ne.mid)),oe=!0)))}),Ne=s(s([],Ne,!0),X,!0),Y.keepMedia(X),Te.push(Y.generate())}),this.log("ADD LIST: ",$),this.offerSdpHook)try{Te=Te.map(function(K){return xe.offerSdpHook(K)})}catch(K){console.log("offerSdpHook error: ",K)}w.label=10;case 10:return w.trys.push([10,12,,14]),[4,(We=this.signal)===null||We===void 0?void 0:We.subscribeAdd($,Te,this.streamManager)];case 11:return ke=w.sent(),[3,14];case 12:return Oe=w.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0,runSimulateSignal:!0})];case 13:return w.sent(),Oe.extraInfo=e({api:"subscribeAdd",signal_api:"subscribeAdd"},Oe.extraInfo),[2,de(Oe)];case 14:if(Ce=[],ke.streams.forEach(function(K,Y){xe.log("Sub TraceId[".concat(Y,"]: "),K.traceid);var X=new l.SdpUtil({sdp:K.sdp});Ce=s(s([],Ce,!0),X.detail.media,!0);var Z=$.find(function(te){return te.urlData.url===K.url});Z&&(Z.traceId=K.traceid)}),(Ae=new l.SdpUtil({sdp:this.prevAnswerSdp||""})).addOrUpdateMedia(Ce),this.alignAnswerMidsWithOffer(Ae),Pe=Ae.generate(),this.setPrevAnswerSdp(Pe),we=this.avoidMsidConflict(Pe),this.answerSdpHook)try{we=this.answerSdpHook(we)}catch(K){console.log("answerSdpHook error: ",K)}w.label=15;case 15:return w.trys.push([15,17,,19]),[4,this.pc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:we}))];case 16:return w.sent(),$.forEach(function(K){xe.streamManager.markAlreadySubPub(K.urlData.url,{vMsid:K.vMsid[0],aMsid:K.aMsid[0]})}),[3,19];case 17:return He=w.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0})];case 18:return w.sent(),[2,de(new h.RtsError(o.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(He),"",{api:"subscribeAdd",sdp:Pe}))];case 19:return q=new Date().getTime(),[2]}})})})]}})})},U.prototype.subscribeActive=function(B){var k;return r(this,void 0,void 0,function(){return n(this,function(V){return[2,(k=this.signal)===null||k===void 0?void 0:k.subscribeActive(this.extendUrl(B))]})})},U.prototype.proceedSubscribeDeleteTracks=function(B,k,V){var G,q,z,$;return r(this,void 0,void 0,function(){var re,ee,ie,se,ce,ue,de,pe=this;return n(this,function(Ee){switch(Ee.label){case 0:B.forEach(function(he){he.rawUrl=he.url,he.url=pe.streamManager.getOriginUrl(he.url)}),re=!1,ee=!!k,ie=void 0,Ee.label=1;case 1:return Ee.trys.push([1,3,,4]),[4,(G=this.signal)===null||G===void 0?void 0:G.subscribeDelete(B)];case 2:return Ee.sent(),[3,4];case 3:return se=Ee.sent(),re=(ie=se).errorCode===o.ErrorCode.DATACHANNEL_RESPONSE_ERROR&&((z=(q=ie.extraInfo)===null||q===void 0?void 0:q.parsedData)===null||z===void 0?void 0:z.streams)&&(($=ie.extraInfo.parsedData.streams[0])===null||$===void 0?void 0:$.res_code)===404,[3,4];case 4:if(ie&&!re)throw ie.extraInfo=e({api:"subscribeDeleteTracks"},ie.extraInfo),ie;return ce=ee&&re,ue=[],de=B.map(function(he){var fe=he.url,me=he.vMsid,ge=he.aMsid,_e=he.rawUrl;return r(pe,void 0,void 0,function(){var Re,Te,Ne,ke,Oe,Ce,Ae,Pe;return n(this,function(we){switch(we.label){case 0:fe=(0,i.pruneSubUrl)(fe),this.streamManager.has(fe)&&(me&&(Ne=this.streamManager.getTransceiver(fe,{vMsid:me[0]}))&&(Te=Ne.receiver.track).stop(),ge&&(ke=this.streamManager.getTransceiver(fe,{aMsid:ge[0]}))&&(Re=ke.receiver.track).stop()),we.label=1;case 1:return we.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return we.sent(),[3,4];case 3:throw(Oe=we.sent()).extraInfo=e({api:"subscribeDeleteTracks"},Oe.extraInfo),Oe;case 4:return(Ce=this.streamManager.getStreamByMsid({url:fe,vMsid:me?.[0],aMsid:ge?.[0]}))&&(Re&&((Ae=Ce.mediastream)===null||Ae===void 0||Ae.removeTrack(Re)),Te&&((Pe=Ce.mediastream)===null||Pe===void 0||Pe.removeTrack(Te))),V||this.streamManager.pruneStreamList(fe),this.streamManager.removeMsid(fe,{vMsid:me?.length?this.unifyMsid(me,"video"):void 0,aMsid:ge?.length?this.unifyMsid(ge,"audio"):void 0}),ue.push({url:_e||"",stream:Ce}),[2]}})})}),[4,Promise.all(de)];case 5:if(Ee.sent(),!ce&&ie)throw ie.extraInfo=e({api:"subscribeDeleteTracks"},ie.extraInfo),ie;return[2,ue]}})})},U.prototype.proceedSubscribeStop=function(B){var k;return r(this,void 0,void 0,function(){var V,G,q=this;return n(this,function(z){switch(z.label){case 0:return z.trys.push([0,2,,3]),[4,(k=this.signal)===null||k===void 0?void 0:k.subscribeStop(this.extendUrl(B))];case 1:return z.sent(),[3,3];case 2:throw(V=z.sent()).extraInfo=e({api:"subscribeStop"},V.extraInfo),V;case 3:return B.forEach(function($){$.rawUrl=$.url,$.url=q.streamManager.getOriginUrl($.url)}),G=B.map(function($){var re=$.url;return $.rawUrl,$.targetStreams,r(q,void 0,void 0,function(){var ee;return n(this,function(ie){switch(ie.label){case 0:re=(0,i.pruneSubUrl)(re),this.streamManager.getAllTransceivers(re).forEach(function(se){var ce;(ce=se?.receiver.track)===null||ce===void 0||ce.stop()}),this.streamManager.get(re).streamList.forEach(function(se){return se.release()}),this.streamManager.remove(re),ie.label=1;case 1:return ie.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return ie.sent(),[3,4];case 3:throw(ee=ie.sent()).extraInfo=e({api:"subscribeStop"},ee.extraInfo),ee;case 4:return[2]}})})}),[4,Promise.all(G)];case 4:return z.sent(),[2]}})})},U.prototype.proceedPublishAdd=function(B){var k;return r(this,void 0,void 0,function(){var V,G,q,z,$,re,ee,ie,se,ce,ue,de,pe,Ee,he,fe,me,ge,_e,Re,Te,Ne,ke,Oe,Ce,Ae,Pe,we,He,We=this;return n(this,function(xe){switch(xe.label){case 0:if(B.length>1)throw console.error("Only one stream is supported."),new h.RtsError(o.ErrorCode.CORE_PUBLIST_EXCEED_ERROR,"publishAdd: publishList exceed limit","",{api:"publishAdd"});if(!this.pc)throw new h.RtsError(o.ErrorCode.CORE_NO_PC_ERROR,"publishAdd: no peerconnection","",{api:"publishAdd"});V=B[0],G=V.stream,q=this.unifyMsid(V.aMsid,"audio"),z=this.unifyMsid(V.vMsid,"video"),V.rawUrl=V.url,V.url=this.streamManager.getOriginUrl(V.url),typeof V.updateSourceStream!="boolean"&&(V.updateSourceStream=!0),$=G.videoTrack,re=G.audioTrack,this.rollbackController.saveStreamManager(this.streamManager),ee=[],ie=this.streamManager.getStreamByMsid({url:V.url,vMsid:z,aMsid:q}),this.streamManager.init(V.url,_.EStreamType.Publish),$&&(se=this.pc.addTransceiver(G.videoTrack,{direction:"sendonly"}),this.streamManager.update(V.url,{vMsid:z,vTransceiver:se,stream:G}),ee.push({type:"video",trans:se,msid:z}),this.setCodecPreferences(se,this.senderCodecPreferences.video)),re&&(se=this.pc.addTransceiver(G.audioTrack,{direction:"sendonly"}),this.streamManager.update(V.url,{aMsid:q,aTransceiver:se,stream:G}),ee.push({type:"audio",trans:se,msid:q}),this.setCodecPreferences(se,this.senderCodecPreferences.audio)),this.rollbackController.setFakeSdpMedias(ee,"pub"),xe.label=1;case 1:return xe.trys.push([1,3,,4]),[4,this.pc.createOffer()];case 2:return ce=xe.sent(),[3,4];case 3:throw ue=xe.sent(),new h.RtsError(o.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer Error: ".concat(ue),"",{api:"publishAdd",err:ue});case 4:if(de=new l.SdpUtil({sdp:ce.sdp||""}),pe=this.parseMsidString(z),Ee=this.parseMsidString(q),he=this.findNewSubPubMids(ce.sdp||"",this.prevOfferSdp||""),this.rollbackController.setFakeSdpMids(he),pe.stream&&de.detail.msidSemantic&&(de.detail.msidSemantic.token=pe.stream),fe=de.detail.media.reduce(function(w,K){return K.direction==="inactive"?s(s([],w,!0),[String(K.mid)],!1):w},[]),de.detail.media.forEach(function(w){var K;if(w.direction!=="recvonly"&&w.type!=="application"&&he.includes(String(w.mid))){var Y=w.type==="video"?pe:Ee,X=We.parseMsidString(w.msid);X.stream=Y.stream||X.stream,X.track=Y.track||X.track;var Z=We.stringifyMsid(X);w.msid=Z,(K=w.ssrcs)===null||K===void 0||K.forEach(function(te){switch(te.attribute){case"cname":case"label":te.value=Y.track||te.value;break;case"msid":te.value=Z;break;case"mslabel":te.value=Y.stream||te.value}})}}),this.restorePublishedSsrc(de),this.restorePublishMsid(de),de.addNack(),me=de.generate(),this.setPrevOfferSdp(me),ge=this.avoidMsidConflict(me),this.offerSdpHook)try{ge=this.offerSdpHook(ge)}catch(w){console.log("offerSdoHook error: ",w)}xe.label=5;case 5:return xe.trys.push([5,7,,8]),[4,this.pc.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:ge}))];case 6:return xe.sent(),[3,8];case 7:throw _e=xe.sent(),this.rollbackController.rollback({streamManagerRollback:!0,runSimulateSignal:!0}),new h.RtsError(o.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(_e),"",{api:"publishAdd",sdp:me});case 8:if(de.keepMedia(he),this.updateTrackInfoList({url:V.rawUrl,stream:V.stream,vMsid:z,aMsid:q,sdpMediaList:de.detail.media}),ge=de.generate(),this.offerSdpHook)try{ge=this.offerSdpHook(ge)}catch(w){console.log("offerSdpHook error: ",w)}xe.label=9;case 9:return xe.trys.push([9,11,,12]),[4,(k=this.signal)===null||k===void 0?void 0:k.publishAdd([V.url],[ge],[$?[this.stringifyMsid(pe)]:[]],[re?[this.stringifyMsid(Ee)]:[]])];case 10:return Re=xe.sent(),[3,12];case 11:throw Te=xe.sent(),(Ne=Te).extraInfo=e({api:"publishAdd"},Ne.extraInfo),this.rollbackController.rollback({streamManagerRollback:!0,runSimulateSignal:!0}),Ne;case 12:if(ke=Re.streams[0],V.traceId=ke.traceid,this.log("Pub TraceId: ",V.traceId),(Oe=new l.SdpUtil({sdp:ke.sdp})).detail.media.forEach(function(w){w.type!=="application"&&w.direction==="sendrecv"&&(w.direction="recvonly")}),(Ce=new l.SdpUtil({sdp:this.prevAnswerSdp||""})).detail.media.forEach(function(w){w.type==="application"&&(delete w.candidates,delete w.endOfCandidates)}),Ce.setMediaInactive(fe),Ce.addOrUpdateMedia(Oe.detail.media,{isPublish:!0}),this.alignAnswerMidsWithOffer(Ce),this.removeTwcc&&(Ae=["http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"],Ce.detail.media.forEach(function(w){var K;w.ext=(K=w.ext)===null||K===void 0?void 0:K.filter(function(Y){return!Ae.includes(Y.uri)})})),Pe=Ce.generate(),this.setPrevAnswerSdp(Pe),we=this.avoidMsidConflict(Pe),this.answerSdpHook)try{we=this.answerSdpHook(we)}catch(w){console.log("answerSdpHook error: ",w)}xe.label=13;case 13:return xe.trys.push([13,15,,16]),[4,this.pc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:we}))];case 14:return xe.sent(),this.streamManager.markAlreadySubPub(V.url,{vMsid:z,aMsid:q,isPub:!0}),[3,16];case 15:throw He=xe.sent(),this.rollbackController.rollback({streamManagerRollback:!0}),new h.RtsError(o.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(He),"",{api:"publishAdd",sdp:Pe});case 16:return ie&&V.updateSourceStream&&ie.mergeStream(G),[2,B.map(function(w){return{url:w.rawUrl,trackInfoList:We.streamManager.getAllMediaInfoList(V.url),traceId:w.traceId}})]}})})},U.prototype.proceedPublishDeleteTracks=function(B){var k,V,G,q,z,$,re;return r(this,void 0,void 0,function(){var ee,ie,se,ce,ue,de,pe,Ee,he,fe,me=this;return n(this,function(ge){switch(ge.label){case 0:B.forEach(function(_e){_e.rawUrl=_e.url,_e.url=me.streamManager.getOriginUrl(_e.url)}),ge.label=1;case 1:return ge.trys.push([1,3,,4]),[4,(k=this.signal)===null||k===void 0?void 0:k.publishDelete(B)];case 2:return ge.sent(),[3,4];case 3:throw(ee=ge.sent()).extraInfo=e({api:"publishDeleteTracks"},ee.extraInfo),ee;case 4:if(ie=B[0],se=(0,i.pruneSubUrl)(ie.url),typeof ie.updateSourceStream!="boolean"&&(ie.updateSourceStream=!0),ce=!1,ue=!1,!this.streamManager.has(se))return[3,9];!((V=ie.vMsid)===null||V===void 0)&&V.length&&((de=this.streamManager.getTransceiver(se,{vMsid:ie.vMsid[0]}))!=null&&de.sender&&((G=this.pc)===null||G===void 0||G.removeTrack(de?.sender)),ce=!0),!((q=ie.aMsid)===null||q===void 0)&&q.length&&((pe=this.streamManager.getTransceiver(se,{aMsid:ie.aMsid[0]}))!=null&&pe.sender&&((z=this.pc)===null||z===void 0||z.removeTrack(pe?.sender)),ue=!0),ge.label=5;case 5:return ge.trys.push([5,7,,8]),[4,this.simulateOfferAnswer()];case 6:return ge.sent(),[3,8];case 7:throw(Ee=ge.sent()).extraInfo=e({api:"publishDeleteTracks"},Ee.extraInfo),Ee;case 8:return(he=this.streamManager.getStreamByMsid({url:se,vMsid:($=ie.vMsid)===null||$===void 0?void 0:$[0],aMsid:(re=ie.aMsid)===null||re===void 0?void 0:re[0]}))&&ie.updateSourceStream&&he.deleteTracks({video:ce,audio:ue}),this.streamManager.removeMsid(se,{vMsid:ce?this.unifyMsid(ie.vMsid,"video"):void 0,aMsid:ue?this.unifyMsid(ie.aMsid,"audio"):void 0}),this.streamManager.pruneStreamList(se),fe=this.streamManager.getAllMediaInfoList(ie.url),[2,B.map(function(_e){return{url:_e.rawUrl,trackInfoList:fe}})];case 9:return[2]}})})},U.prototype.proceedPublishReplaceTracks=function(B){var k,V,G,q,z;return r(this,void 0,void 0,function(){var $,re,ee,ie,se,ce,ue,de,pe,Ee,he=this;return n(this,function(fe){switch(fe.label){case 0:if($=B[0],re=$.stream,ee=$.vMsid,ie=$.aMsid,$.rawUrl=$.url,$.url=this.streamManager.getOriginUrl($.url),!this.streamManager.has($.url))throw new h.RtsError(o.ErrorCode.CORE_PUB_REPLACE_URL_NOT_FOUND,"No stream found for this url: ".concat($.url),"",{api:"publishReplaceTracks",configList:B});return typeof $.updateSourceStream!="boolean"&&($.updateSourceStream=!0),se=re.audioTrack,ce=re.videoTrack,ue=this.streamManager.getAllMediaInfoList($.url,!0),se&&(pe=(k=ue.find(function(me){return me.type==="audio"&&(!ie||me.msid===ie)}))===null||k===void 0?void 0:k.transceiver)&&se.id!==((G=(V=pe.sender)===null||V===void 0?void 0:V.track)===null||G===void 0?void 0:G.id)?[4,pe.sender.replaceTrack(se)]:[3,2];case 1:fe.sent(),fe.label=2;case 2:return ce?(de=ue.find(function(me){return me.type==="video"&&(!ee||me.msid===ee)}),(pe=de?.transceiver)&&ce.id!==((z=(q=pe.sender)===null||q===void 0?void 0:q.track)===null||z===void 0?void 0:z.id)?[4,pe.sender.replaceTrack(ce)]:[3,4]):[3,4];case 3:fe.sent(),re.isCustomStream||(de.from=re.hasScreen?"screen":"camera"),fe.label=4;case 4:return(Ee=this.streamManager.getStreamByMsid({url:$.url,vMsid:ee,aMsid:ie}))&&$.updateSourceStream&&Ee.mergeStream(re),[2,B.map(function(me){return{url:me.rawUrl,trackInfoList:he.streamManager.getAllMediaInfoList($.url)}})]}})})},U.prototype.proceedPublishStop=function(B){var k;return r(this,void 0,void 0,function(){var V,G,q=this;return n(this,function(z){switch(z.label){case 0:return z.trys.push([0,2,,3]),[4,(k=this.signal)===null||k===void 0?void 0:k.publishStop(B.map(function($){return q.streamManager.getOriginUrl($.url)}))];case 1:return z.sent(),[3,3];case 2:throw(V=z.sent()).extraInfo=e({api:"publishStop"},V.extraInfo),V;case 3:return G=B.map(function($){var re=$.url;return r(q,void 0,void 0,function(){var ee,ie=this;return n(this,function(se){switch(se.label){case 0:re=(0,i.pruneSubUrl)(re),this.streamManager.getAllTransceivers(re).forEach(function(ce){var ue;ce?.sender&&((ue=ie.pc)===null||ue===void 0||ue.removeTrack(ce?.sender))}),this.streamManager.get(re).streamList.forEach(function(ce){return ce.deleteTracks({video:!0,audio:!0})}),this.streamManager.remove(re),se.label=1;case 1:return se.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return se.sent(),[3,4];case 3:throw(ee=se.sent()).extraInfo=e({api:"publishStop"},ee.extraInfo),ee;case 4:return[2]}})})}),[4,Promise.all(G)];case 4:return z.sent(),[2]}})})},U.prototype.proceedSubscribeAddDatachannel=function(B){return r(this,void 0,void 0,function(){var k=this;return n(this,function(V){return[2,new Promise(function(G,q){return r(k,void 0,void 0,function(){var z,$,re,ee,ie,se=this;return n(this,function(ce){switch(ce.label){case 0:return ce.trys.push([0,2,,3]),[4,(ee=this.signal)===null||ee===void 0?void 0:ee.subscribeAddDatachannel(B)];case 1:return ce.sent(),[3,3];case 2:return(z=ce.sent()).extraInfo=e({api:"subscribeAddDatachannel",signal_api:"subscribeAddDatachannel"},z.extraInfo),[2,q(z)];case 3:$={},ce.label=4;case 4:return ce.trys.push([4,6,,7]),[4,(ie=this.signal)===null||ie===void 0?void 0:ie.subscribeActiveDatachannel(B)];case 5:return $=ce.sent(),[3,7];case 6:return(re=ce.sent()).extraInfo=e({api:"subscribeAddDatachannel",signal_api:"subscribeActiveDatachannel"},re.extraInfo),[2,q(re)];case 7:return B.forEach(function(ue){se.streamManager.addOrUpdateDatachannelItem({type:"sub-data",url:(0,i.pruneSubUrl)(ue.url,!0),msids:[{name:ue.msid,id:ue.datachannelId,type:"data",label:ue.label,datachannel:ue.datachannel}],originUrl:ue.url,streams:[]})}),G($),[2]}})})})]})})},U.prototype.proceedSubscribeStopDatachannel=function(B){return r(this,void 0,void 0,function(){var k=this;return n(this,function(V){return[2,new Promise(function(G,q){return r(k,void 0,void 0,function(){var z,$,re,ee,ie,se,ce,ue=this;return n(this,function(de){switch(de.label){case 0:return de.trys.push([0,2,,3]),[4,(re=this.signal)===null||re===void 0?void 0:re.subscribeStopDatachannel(B)];case 1:return de.sent(),[3,3];case 2:return z=de.sent(),((ce=(se=(ie=(ee=($=z)==null?void 0:$.extraInfo)===null||ee===void 0?void 0:ee.parsedData)===null||ie===void 0?void 0:ie.streams)===null||se===void 0?void 0:se[0])===null||ce===void 0?void 0:ce.res_code)===404?[3,3]:($.extraInfo=e({api:"subscribeStopDatachannel",signal_api:"subscribeStopDatachannel"},$.extraInfo),[2,q(z)]);case 3:return B.forEach(function(pe){ue.streamManager.deleteDatachannelItem({url:(0,i.pruneSubUrl)(pe.url,!0)})}),G(),[2]}})})})]})})},U.prototype.proceedPublishAddDatachannel=function(B){return r(this,void 0,void 0,function(){var k=this;return n(this,function(V){return[2,new Promise(function(G,q){return r(k,void 0,void 0,function(){var z,$,re,ee=this;return n(this,function(ie){switch(ie.label){case 0:z={},ie.label=1;case 1:return ie.trys.push([1,3,,4]),[4,(re=this.signal)===null||re===void 0?void 0:re.publishAddDatachannel(B)];case 2:return z=ie.sent(),[3,4];case 3:return($=ie.sent()).extraInfo=e({api:"publishAddDatachannel",signal_api:"publishAddDatachannel"},$.extraInfo),[2,q($)];case 4:return B.forEach(function(se){ee.streamManager.addOrUpdateDatachannelItem({type:"pub-data",url:(0,i.pruneSubUrl)(se.url,!0),msids:[{name:se.msid,id:se.datachannelId,type:"data",label:se.label,datachannel:se.datachannel}],originUrl:se.url,streams:[]})}),G(z),[2]}})})})]})})},U.prototype.proceedPublishStopDatachannel=function(B){return r(this,void 0,void 0,function(){var k=this;return n(this,function(V){return[2,new Promise(function(G,q){return r(k,void 0,void 0,function(){var z,$,re=this;return n(this,function(ee){switch(ee.label){case 0:return ee.trys.push([0,2,,3]),[4,($=this.signal)===null||$===void 0?void 0:$.publishStopDatachannel(B)];case 1:return ee.sent(),[3,3];case 2:return(z=ee.sent()).extraInfo=e({api:"publishStopDatachannel",signal_api:"publishStopDatachannel"},z.extraInfo),[2,q(z)];case 3:return B.forEach(function(ie){re.streamManager.deleteDatachannelItem({url:(0,i.pruneSubUrl)(ie.url,!0)})}),G(),[2]}})})})]})})},U.prototype.buildUrlStreamMap=function(B){var k=this,V=[];return B.forEach(function(G){var q=G.urlData,z=G.traceId,$=G.url,re=G.vMsid,ee=G.aMsid,ie=q.url,se=new MediaStream;k.streamManager.getAllMediaInfoList(ie,!0).forEach(function(ce){var ue,de;if(ce.type==="video"&&ce.msid===re[0]||ce.type==="audio"&&ce.msid===ee[0]){var pe=(de=(ue=ce.transceiver)===null||ue===void 0?void 0:ue.receiver)===null||de===void 0?void 0:de.track;pe&&se.addTrack(pe)}}),V.push({url:$,stream:se,traceId:z})}),V},U.prototype.extendUrl=function(B){var k=this;return B.map(function(V){var G=V.url,q=V.subAudio,z=V.subVideo,$=V.aMsid,re=V.vMsid,ee=k.streamManager.getOriginUrl(G),ie=new E.UrlData({url:ee,subAudio:q,subVideo:z});return e(e({},V),{urlData:ie,aMsid:ie.subAudio?$||[j]:[],vMsid:ie.subVideo?re||[O]:[]})})},U.prototype.parseSdp=function(B){return new l.SdpUtil({sdp:B})},U.prototype.getTrackInfoList=function(B,k,V){B===void 0&&(B=[]);var G=[];return B.forEach(function(q){var z,$,re,ee;if(q.type!=="application"){var ie,se=Number(q.ssrcs&&((z=q.ssrcs[0])===null||z===void 0?void 0:z.id))||-1,ce=q.rtp.find(function(fe){var me;return["opus","h264"].includes((me=fe.codec)===null||me===void 0?void 0:me.toLowerCase())}),ue=ce?.codec||"",de=ce?.payload||0;k.isCustomStream||q.type==="video"&&(ie=k.hasScreen?"screen":"camera");var pe=q.msid;if(V?.aMsid||V?.vMsid){var Ee=(q.type==="video"?V.vMsid:V.aMsid)||"";Ee?.trim().includes(" ")||(pe=($=q.msid)===null||$===void 0?void 0:$.split(" ")[1])}var he=q.type==="video"?(re=k.videoTrack)===null||re===void 0?void 0:re.id:(ee=k.audioTrack)===null||ee===void 0?void 0:ee.id;G.push({ssrc:se,codec:ue,type:q.type,pt:de,msid:pe,from:ie,trackId:he})}}),G},U.prototype.patchSubscribeStreamManagerRecord=function(B,k){var V=this;this.extendUrl([{url:B,vMsid:k.vMsid,aMsid:k.aMsid}]).forEach(function(G){var q=G.urlData,z=G.vMsid,$=G.aMsid;if(V.pc&&(V.streamManager.remove(q.url),V.streamManager.init(q.url),V.pc.getTransceivers)){var re=V.pc.getTransceivers()||[];if(q.subVideo){var ee=re.find(function(se){return se.receiver.track.kind==="video"});V.streamManager.update(q.url,{vMsid:z[0],vTransceiver:ee,stream:k.stream})}if(q.subAudio){var ie=re.find(function(se){return se.receiver.track.kind==="audio"});V.streamManager.update(q.url,{aMsid:$[0],aTransceiver:ie,stream:k.stream})}V.streamManager.markAlreadySubPub(B,{vMsid:z[0],aMsid:$[0],isPub:!1})}})},U.prototype.patchPublishStreamManagerRecord=function(B,k){if(this.pc){var V=k.stream,G=V.videoTrack,q=V.audioTrack,z=this.unifyMsid(k.aMsid,"audio"),$=this.unifyMsid(k.vMsid,"video");if(this.streamManager.init(B,_.EStreamType.Publish),this.pc.getTransceivers){var re=this.pc.getTransceivers()||[];if(G){var ee=re.find(function(se){var ce,ue;return((ue=(ce=se.sender)===null||ce===void 0?void 0:ce.track)===null||ue===void 0?void 0:ue.id)===G.id});ee&&this.streamManager.update(B,{vMsid:$,vTransceiver:ee,stream:k.stream})}if(q){var ie=re.find(function(se){var ce,ue;return((ue=(ce=se.sender)===null||ce===void 0?void 0:ce.track)===null||ue===void 0?void 0:ue.id)===q.id});ie&&this.streamManager.update(B,{aMsid:z,aTransceiver:ie,stream:k.stream})}this.streamManager.markAlreadySubPub(B,{vMsid:$,aMsid:z,isPub:!0})}}},U.prototype.updateTrackInfoList=function(B){var k=B.url,V=B.stream,G=B.vMsid,q=B.aMsid,z=B.sdpMediaList;k||console.error("[updateTrackInfoList] url is required");var $=this.getTrackInfoList(z,V,{vMsid:G,aMsid:q}),re=$.find(function(ie){return ie.type==="video"}),ee=$.find(function(ie){return ie.type==="audio"});return G&&re&&this.streamManager.updateSdpInfo(k,e({vMsid:G},re)),q&&ee&&this.streamManager.updateSdpInfo(k,e({aMsid:q},ee)),$},U.prototype.unifyMsid=function(B,k){var V=k==="video"?O:j;return B?.[0]||V},U.prototype.startSignalHeartbeatTimer=function(B){var k=this;B&&B<200?console.warn("PEER CORE: heartbeat interval ".concat(B," is too small and will not take effect. At least 200ms")):(this.stopSignalHeartbeatTimer(),this.heartbeatTimerHandle=setInterval(function(){var V=void 0,G=k.streamManager.getSize(),q=k.streamManager.getSubOrPubDoneMediaMapSize();if(k.heartbeatTokenRing%=G,k.heartbeatTokenRing<q){var z=k.heartbeatTokenRing,$=k.streamManager.getPubOrSubDoneMediaUrlByIndex(z);$&&(V=[]).push({url:$})}else if(k.heartbeatTokenRing<G){z=k.heartbeatTokenRing-q;var re=k.streamManager.getDcUrlByIndex(z);re&&(V=[]).push(re)}k.heartbeatTokenRing++,k.heartbeatTokenRing%=G,k.sendOnceHeartbeat(V)},B||f.DEFAULT_HEARTBEAT_INTERVAL))},U.prototype.stopSignalHeartbeatTimer=function(){this.heartbeatTimerHandle!==null&&clearInterval(this.heartbeatTimerHandle),this.heartbeatTimerHandle=null},U.prototype.sendOnceHeartbeat=function(B){var k,V=(k=this.signal)===null||k===void 0?void 0:k.sendHeartbeat(B);V&&(this.hebtLog(">>> Send: heartbeat",V),this.heartbeatTimelineMap.set(V.msg_id,performance.now()))},U.prototype.sendFalseHeartbeat=function(B){var k,V=(k=this.signal)===null||k===void 0?void 0:k.sendFalseHeartbeat(B);V&&(this.hebtLog(">>> Send: false heartbeat",B),this.heartbeatTimelineMap.set(V.msg_id,performance.now()))},U.prototype.dispose=function(){var B,k;this.pc=void 0,this.prevOfferSdp=void 0,this.prevAnswerSdp=void 0,(B=this.signal)===null||B===void 0||B.dispose(),(k=this.streamManager)===null||k===void 0||k.dispose(),this.stopSignalHeartbeatTimer()},U.prototype.initHeartbeatListener=function(){var B,k,V,G,q,z,$,re=this;(B=this.heartbeatProcessor)===null||B===void 0||B.on("pcReconnect",function(ee){re.emit("pcReconnect",ee)}),(k=this.heartbeatProcessor)===null||k===void 0||k.on("streamError",function(ee){re.emit("streamError",ee)}),(V=this.heartbeatProcessor)===null||V===void 0||V.on("streamReconnect",function(ee){re.emit("streamReconnect",ee)}),(G=this.heartbeatProcessor)===null||G===void 0||G.on("traceIdUpdate",function(ee){re.emit("traceIdUpdate",ee)}),(q=this.heartbeatProcessor)===null||q===void 0||q.on("hebtReceived",function(ee){if(ee){var ie=re.heartbeatTimelineMap.get(ee.msg_id)||0;re.heartbeatTimelineMap.delete(ee.msg_id),re.hebtLog("<<< Received: heartbeat","".concat(Math.ceil(performance.now()-ie),"ms"),ee)}re.emit("hebtReceived",ee)}),(z=this.heartbeatProcessor)===null||z===void 0||z.on("datachannelNotEnabled",function(){re.emit("datachannelNotEnabled")}),($=this.signal)===null||$===void 0||$.getDatachannelCore().on("message",function(ee){var ie;(ie=re.heartbeatProcessor)===null||ie===void 0||ie.process(ee)})},U.prototype.initNotifyListener=function(){var B,k,V,G=this;(B=this.notifyProcessor)===null||B===void 0||B.on("pcReconnect",function(q){G.emit("pcReconnect",q)}),(k=this.notifyProcessor)===null||k===void 0||k.on("message",function(q){G.emit("message",q)}),(V=this.signal)===null||V===void 0||V.getDatachannelCore().on("message",function(q){var z;(z=G.notifyProcessor)===null||z===void 0||z.process(q)})},U.prototype.findNewSubPubMids=function(B,k){var V=new l.SdpUtil({sdp:B}),G=new l.SdpUtil({sdp:k}),q=V.detail.media.filter(function($){return $.direction!=="inactive"}).map(function($){return $.mid}),z=G.detail.media.map(function($){return $.mid});return this.findDiff(q,z).map(function($){return String($)})},U.prototype.findDiff=function(B,k){return Array.from(new Set(s([],B,!0).filter(function(V){return!k.includes(V)})))},U.prototype.parseMsidString=function(B){var k={stream:"",track:""};if(!B)return k;var V=B.trim().split(" "),G=V[0],q=V[1];return q?(k.stream=G,k.track=q):k.track=G,k},U.prototype.stringifyMsid=function(B){var k=B.stream,V=B.track;return"".concat(k).concat(k?" ":"").concat(V)},U.prototype.restorePublishedSsrc=function(B){var k=new l.SdpUtil({sdp:this.prevOfferSdp||""}).getPublishSsrcs();B.detail.media.forEach(function(V){var G;V.direction!=="recvonly"&&((G=V.ssrcs)===null||G===void 0||G.forEach(function(q){var z,$=(z=k.find(function(re){return re.mid===String(V.mid)}))===null||z===void 0?void 0:z.ssrc;$&&(q.id=String($))}))})},U.prototype.restorePublishMsid=function(B){var k=this,V=new l.SdpUtil({sdp:this.prevOfferSdp||""}).getPublishMsids();V?.length&&B.detail.media.forEach(function(G){var q,z;if(G.direction!=="recvonly"){var $=(q=V.find(function(ee){return ee.mid===String(G.mid)}))===null||q===void 0?void 0:q.msid;if(!$)return;var re=k.parseMsidString($);G.msid=$||G.msid,(z=G.ssrcs)===null||z===void 0||z.forEach(function(ee){switch(ee.attribute){case"cname":ee.value=re.track||ee.value;break;case"msid":ee.value=$||ee.value}})}})},U.prototype.alignAnswerMidsWithOffer=function(B){var k=new l.SdpUtil({sdp:this.prevOfferSdp||""}).detail.media.map(function(z){return String(z.mid)}),V=B.detail.media.map(function(z){return String(z.mid)}),G=this.findDiff(V,k);B.removeMedia(G);var q=[];k.forEach(function(z){var $=B.detail.media.find(function(re){return String(re.mid)===z});$&&q.push($)}),B.detail.media=q.filter(function(z){return z})},U.prototype.simulateOfferAnswer=function(B){var k,V,G;return r(this,void 0,void 0,function(){var q,z,$,re,ee,ie,se,ce,ue,de,pe,Ee,he;return n(this,function(fe){switch(fe.label){case 0:return fe.trys.push([0,2,,3]),[4,(k=this.pc)===null||k===void 0?void 0:k.createOffer()];case 1:return q=fe.sent(),z=new l.SdpUtil({sdp:q?.sdp||""}),$=z.detail.media.filter(function(me){return me.direction==="inactive"}).map(function(me){return String(me.mid)}),this.restorePublishedSsrc(z),this.restorePublishMsid(z),this.prevOfferSdp=z.generate(),(re=new l.SdpUtil({sdp:this.prevAnswerSdp||""})).setMediaInactive($),B&&(ee=(0,l.generateFakeMediaSdpAnswer)(B))&&(ie=new l.SdpUtil({sdp:ee}),se=s([],ie.detail.media,!0),re.addOrUpdateMedia(se),this.alignAnswerMidsWithOffer(re)),ce=re.generate(),this.setPrevAnswerSdp(ce),[3,3];case 2:throw ue=fe.sent(),new h.RtsError(o.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer error: ".concat(ue),"",{pc:this.pc});case 3:if(de=this.avoidMsidConflict(this.prevOfferSdp),this.offerSdpHook)try{de=this.offerSdpHook(de)}catch(me){console.log("offerSdoHook error: ",me)}fe.label=4;case 4:return fe.trys.push([4,6,,7]),[4,(V=this.pc)===null||V===void 0?void 0:V.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:de}))];case 5:return fe.sent(),[3,7];case 6:throw pe=fe.sent(),new h.RtsError(o.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(pe),"",{sdp:this.prevOfferSdp});case 7:if(fe.trys.push([7,10,,11]),!this.prevAnswerSdp)return[3,9];if(Ee=this.avoidMsidConflict(this.prevAnswerSdp),this.answerSdpHook)try{Ee=this.answerSdpHook(Ee)}catch(me){console.log("answerSdpHook error: ",me)}return[4,(G=this.pc)===null||G===void 0?void 0:G.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:Ee}))];case 8:fe.sent(),fe.label=9;case 9:return[3,11];case 10:throw he=fe.sent(),new h.RtsError(o.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(he),"",{sdp:this.prevAnswerSdp});case 11:return[2]}})})},U.prototype.avoidMsidConflict=function(B){var k=new l.SdpUtil({sdp:B});return k.mungleMsid(),k.generate()},U.prototype.setCodecPreferences=function(B,k){if(k)try{B.setCodecPreferences(k)}catch(V){console.warn("setCodecPreferences error",V)}},U.prototype.log=function(){for(var B=[],k=0;k<arguments.length;k++)B[k]=arguments[k];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,s(["[PC-Core]"],B,!1))},U.prototype.hebtLog=function(){for(var B,k,V=[],G=0;G<arguments.length;G++)V[G]=arguments[G];window.RTS_HEBT_DEBUG&&console.log.apply(console,s(["".concat(this.now()," [datachannel|").concat((B=this.signal)===null||B===void 0?void 0:B.getDatachannelCore().label,"|").concat((k=this.signal)===null||k===void 0?void 0:k.getDatachannelCore().id,"]")],V,!1))},U.prototype.now=function(){var B=new Date;return"".concat(B.getHours(),":").concat(B.getMinutes(),":").concat(B.getSeconds(),".").concat(String(B.getMilliseconds()).padStart(3,"0"))},U}(C.default);f.PeerConnectionCore=H},651:function(S,f,a){var d,p=this&&this.__extends||(d=function(_,h){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,g){o.__proto__=g}||function(o,g){for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(o[m]=g[m])},d(_,h)},function(_,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function o(){this.constructor=_}d(_,h),_.prototype=h===null?Object.create(h):(o.prototype=h.prototype,new o)}),e=this&&this.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(f,"__esModule",{value:!0}),f.DataChannelCore=f.EDatachannelStatus=void 0;var r,n=a(844),s=a(961),t=a(854),i=e(a(885)),l=e(a(973));function E(){}(function(_){_[_.DATACHANNEL_STATUS_CLOSE=0]="DATACHANNEL_STATUS_CLOSE",_[_.DATACHANNEL_STATUS_OPEN=1]="DATACHANNEL_STATUS_OPEN"})(r=f.EDatachannelStatus||(f.EDatachannelStatus={}));var b=function(_){function h(o){var g=_.call(this)||this;return g.pendingPromiseMap=new Map,g.mutexSendData=!1,g.timerSendData=null,g.eventQueue=new t.CacheBuffer("send tasks"),g.datachannelList=[],g.pc=o.pc,g.eventHandler=o.onDatachannelEvent||E,g.datachannelList=o.datachannelList||[],g.createDatachannel(o.label,o.assignId),g}return p(h,_),h.prototype.getWebrtcDatachannel=function(){return this.datachannel},h.prototype.getNextId=function(){var o=0,g=this.datachannelList.reduce(function(m,T){return T.readyState==="open"?m+1:(o||(o=T.id),m)},0);return o||2*(g+1)},h.prototype.createDatachannel=function(o,g){var m=this,T={ordered:!0};g&&this.pc.connectionState==="connected"&&(T.id=this.getNextId()),this.datachannel=this.pc.createDataChannel(o||"GRTN_RTC_DATACHANNEL"+"_".concat(Date.now()),T),this.datachannel.addEventListener("open",function(){setTimeout(function(){m.eventHandler(r.DATACHANNEL_STATUS_OPEN),m.emit("statusChange",r.DATACHANNEL_STATUS_OPEN)},200)}),this.datachannel.addEventListener("close",function(){m.eventHandler(r.DATACHANNEL_STATUS_CLOSE),m.emit("statusChange",r.DATACHANNEL_STATUS_CLOSE)}),this.datachannel.addEventListener("closing",function(){}),this.datachannel.addEventListener("error",function(C){console.log(">> error",C),m.emit("error",C)}),this.datachannel.addEventListener("bufferedamountlow",function(){}),this.datachannel.addEventListener("message",function(C){m.emit("message",C.data)})},Object.defineProperty(h.prototype,"id",{get:function(){return this.datachannel.id},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"label",{get:function(){return this.datachannel.label},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"readyState",{get:function(){return this.datachannel.readyState},enumerable:!1,configurable:!0}),h.prototype.send=function(o){if(this.datachannel.readyState!=="open")throw new Error("Datachannel(label:".concat(this.datachannel.label,",id:").concat(this.datachannel.id,") is closed."));return this.datachannel.send(o)},h.prototype.sendAsync=function(o){if(this.datachannel.readyState==="open")return this.datachannel.send(JSON.stringify(o)),!0;console.log("Async signal message failed. Datachannel(label:".concat(this.datachannel.label,",id:").concat(this.datachannel.id,") is closed."))},h.prototype.sendData=function(o){var g=this;return new Promise(function(m,T){var C=new l.default(g.datachannel);if(g.mutexSendData){var D={sender:C,res:m,rej:T,data:o};g.eventQueue.cache(D)}else g.atomSend(C,m,T,o)})},h.prototype.dispose=function(){var o;this.emit("dispose"),this.mutexSendData=!1,this.timerSendData!==null&&clearTimeout(this.timerSendData),this.timerSendData=null,this.eventQueue=new t.CacheBuffer("send tasks"),(o=this.datachannel)===null||o===void 0||o.close()},h.prototype.atomSend=function(o,g,m,T){var C=this;this.mutexSendData=!0,o.on("onSendDataDone",function(){if(C.timerSendData!==null&&clearTimeout(C.timerSendData),C.timerSendData=null,C.mutexSendData=!1,!C.eventQueue.isEmpty()){var D=C.eventQueue.getFirst();C.atomSend(D.sender,D.res,D.rej,D.data)}}),this.timerSendData=setTimeout(function(){m(new s.RtsError(n.ErrorCode.DATACHANNEL_TIMEOUT_ERROR,"request timeout after ".concat(h.REQUEST_TIMEOUT,"ms"),"",T)),C.timerSendData=null,C.mutexSendData=!1,o.emit("onSendDataDone")},h.REQUEST_TIMEOUT),o.sendingProcess(g,m,T)},h.REQUEST_TIMEOUT=5e3,h}(i.default);f.DataChannelCore=b},973:function(S,f,a){var d,p=this&&this.__extends||(d=function(b,_){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,o){h.__proto__=o}||function(h,o){for(var g in o)Object.prototype.hasOwnProperty.call(o,g)&&(h[g]=o[g])},d(b,_)},function(b,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");function h(){this.constructor=b}d(b,_),b.prototype=_===null?Object.create(_):(h.prototype=_.prototype,new h)}),e=this&&this.__spreadArray||function(b,_,h){if(h||arguments.length===2)for(var o,g=0,m=_.length;g<m;g++)!o&&g in _||(o||(o=Array.prototype.slice.call(_,0,g)),o[g]=_[g]);return b.concat(o||Array.prototype.slice.call(_))},r=this&&this.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(f,"__esModule",{value:!0}),f.EDatachannelSignalResCode=f.EMessageType=void 0;var n,s,t=a(844),i=a(961),l=r(a(885));(function(b){b.HEBT="hebt",b.NOTI="NOTI"})(n=f.EMessageType||(f.EMessageType={})),function(b){b[b.NGX_RTC_PUBLISH_ALREADY=402]="NGX_RTC_PUBLISH_ALREADY",b[b.NGX_RTC_REQUEST_FORBIDDEN=403]="NGX_RTC_REQUEST_FORBIDDEN",b[b.NGX_RTC_STREAM_NO_FOUND=404]="NGX_RTC_STREAM_NO_FOUND",b[b.NGX_RTC_SUBSCRIBE_ALREADY=410]="NGX_RTC_SUBSCRIBE_ALREADY",b[b.NGX_RTC_NORMAL_CLOSED=200]="NGX_RTC_NORMAL_CLOSED",b[b.NGX_RTC_LIMITED=508]="NGX_RTC_LIMITED",b[b.NGX_RTC_INTERNAL_SERVER_ERROR=500]="NGX_RTC_INTERNAL_SERVER_ERROR",b[b.NGX_RTC_BAD_REQUEST=400]="NGX_RTC_BAD_REQUEST",b[b.NGX_RTC_NEED_RETRY=213]="NGX_RTC_NEED_RETRY",b[b.NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND=130]="NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND"}(s=f.EDatachannelSignalResCode||(f.EDatachannelSignalResCode={}));var E=function(b){function _(h){var o=b.call(this)||this;return o.datachannel=h,o}return p(_,b),_.prototype.sendingProcess=function(h,o,g){var m,T=this,C=performance.now();this.datachannel.onmessage=function(D){try{var y=JSON.parse(D.data),A=T.checkResponse(y);if(A.ignore)return;if(T.log("<<< Received:","".concat(Math.ceil(performance.now()-C),"ms"),y),A.pass)h(y);else{if(A.code===s.NGX_RTC_NEED_RETRY)return void setTimeout(function(){T.log(">>> Send:",g),T.datachannel.send(JSON.stringify(g))},200);o(new i.RtsError(t.ErrorCode.DATACHANNEL_RESPONSE_ERROR,"[code]".concat(A.code,"; [msg]").concat(A.msg),A.traceId,{parsedData:y}))}}catch(O){o(new i.RtsError(t.ErrorCode.DATACHANNEL_PARSE_ERROR,"datachannel message parse error","",{data:D.data,err:O}))}T.emit("onSendDataDone")};try{this.log(">>> Sent:","".concat(g.type,"-").concat(!((m=g.streams)===null||m===void 0)&&m.length?g.streams[0].method:"-"),g)}catch{}this.datachannel.send(JSON.stringify(g))},_.prototype.checkResponse=function(h){var o={pass:!0,ignore:!1,code:0,msg:"",traceId:""};if([n.HEBT,n.NOTI].includes(h.type))return o.ignore=!0,o.pass=!1,o;h.recode!==0&&(o.pass=!1,o.code=h.recode,o.msg=h.msg);var g=h.streams;return g&&g.length>0&&g.forEach(function(m){m.res_code!==200&&(o.pass=!1,o.code=m.res_code,o.msg=m.res_msg,o.traceId=m.traceid)}),o},_.prototype.log=function(){for(var h=[],o=0;o<arguments.length;o++)h[o]=arguments[o];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,e(["".concat(this.now()," [datachannel|").concat(this.datachannel.label,"|").concat(this.datachannel.id,"]")],h,!1))},_.prototype.now=function(){var h=new Date;return"".concat(h.getHours(),":").concat(h.getMinutes(),":").concat(h.getSeconds(),".").concat(String(h.getMilliseconds()).padStart(3,"0"))},_}(l.default);f.default=E},844:(S,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.ErrorCode=void 0,function(a){a[a.DATACHANNEL_SIGNAL_ERROR=15e3]="DATACHANNEL_SIGNAL_ERROR",a[a.DATACHANNEL_SET_OFFER_ERROR=15001]="DATACHANNEL_SET_OFFER_ERROR",a[a.DATACHANNEL_SET_ANSWER_ERROR=15002]="DATACHANNEL_SET_ANSWER_ERROR",a[a.DATACHANNEL_CREATE_OFFER_ERROR=15003]="DATACHANNEL_CREATE_OFFER_ERROR",a[a.DATACHANNEL_RESPONSE_ERROR=15004]="DATACHANNEL_RESPONSE_ERROR",a[a.DATACHANNEL_PARSE_ERROR=15005]="DATACHANNEL_PARSE_ERROR",a[a.DATACHANNEL_TIMEOUT_ERROR=15006]="DATACHANNEL_TIMEOUT_ERROR",a[a.CORE_NO_PC_ERROR=15007]="CORE_NO_PC_ERROR",a[a.CORE_PUBLIST_EXCEED_ERROR=15008]="CORE_PUBLIST_EXCEED_ERROR",a[a.CORE_PUB_REPLACE_URL_NOT_FOUND=15009]="CORE_PUB_REPLACE_URL_NOT_FOUND",a[a.CORE_TRANSCEIVERS_NOT_FOUND=15010]="CORE_TRANSCEIVERS_NOT_FOUND"}(f.ErrorCode||(f.ErrorCode={}))},961:(S,f,a)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.RtsError=void 0;var d=a(844);f.RtsError=function(p,e,r,n){this.errorCode=p,this.errorCodeName=d.ErrorCode[p],this.message=e,this.traceId=r,n&&(this.extraInfo=n)}},854:(S,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.CacheBuffer=void 0;var a=function(){function d(p){this.data=[],this.tag=p||"unknown",this.maxBufferLength=90}return d.prototype.setMaxCapacity=function(p){this.maxBufferLength=90,p>=0&&(this.maxBufferLength=p),this.maxBufferLength>200&&(this.maxBufferLength=200)},d.prototype.cache=function(p){this.data.length>this.maxBufferLength&&(this.data.shift(),console.log(this.tag+" CACHE: Reach Max Capacity")),this.data.push(p)},d.prototype.getFirst=function(){return this.data.shift()},d.prototype.isEmpty=function(){return this.data.length<=0},d}();f.CacheBuffer=a},885:(S,f)=>{Object.defineProperty(f,"__esModule",{value:!0});var a=function(){function d(){this._eventMap={}}return d.prototype.listeners=function(p){return this._eventMap[p]||[]},d.prototype.emit=function(p){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var s=this._eventMap[p];return!!Array.isArray(s)&&(s.forEach(function(t){return t.apply(e,r)}),!0)},d.prototype.off=function(p,e){var r=this._eventMap[p];return Array.isArray(r)&&(this._eventMap[p]=r.filter(function(n){return n!==e})),this},d.prototype.removeAllListeners=function(p){return p===void 0?this._eventMap={}:this._eventMap[p]&&(this._eventMap[p]=[]),this},d.prototype.on=function(p,e){return this._eventMap[p]?this._eventMap[p].push(e):this._eventMap[p]=[e],this},d.prototype.once=function(p,e){var r=this,n=function(){for(var s=[],t=0;t<arguments.length;t++)s[t]=arguments[t];r.off(p,n),e.apply(r,s)};return this.on(p,n),this},d}();f.default=a},887:(S,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.intersection=f.pruneSubUrl=f.parseUrlSubParams=void 0,f.parseUrlSubParams=function(a){var d={subVideo:!0,subAudio:!0};return a&&(a.includes("@subvideo=no")&&(d.subVideo=!1),a.includes("@subaudio=no")&&(d.subAudio=!1)),d},f.pruneSubUrl=function(a,d){var p=a||"";return p=p.replace("@subaudio=no","").replace("@subvideo=no",""),d&&(p=p.split("?")[0]),p},f.intersection=function(a,d){return a.filter(function(p){return d.includes(p)})}},390:function(S,f){var a=this&&this.__spreadArray||function(p,e,r){if(r||arguments.length===2)for(var n,s=0,t=e.length;s<t;s++)!n&&s in e||(n||(n=Array.prototype.slice.call(e,0,s)),n[s]=e[s]);return p.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(f,"__esModule",{value:!0}),f.Logger=void 0;var d=function(){function p(e){this.switchName=e.switchName,this.displayName=e.displayName}return p.prototype.log=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];window[this.switchName||Math.random()]&&console.log.apply(console,a(["".concat(this.now()," [").concat(this.displayName,"]")],e,!1))},p.prototype.now=function(){var e=new Date;return"".concat(this.padStart(e.getHours()),":").concat(this.padStart(e.getMinutes()),":").concat(this.padStart(e.getSeconds()),".").concat(this.padStart(e.getMilliseconds(),3))},p.prototype.padStart=function(e,r,n){return r===void 0&&(r=2),n===void 0&&(n="0"),String(e).padStart(r,n)},p}();f.Logger=d},248:function(S,f,a){var d=this&&this.__assign||function(){return d=Object.assign||function(n){for(var s,t=1,i=arguments.length;t<i;t++)for(var l in s=arguments[t])Object.prototype.hasOwnProperty.call(s,l)&&(n[l]=s[l]);return n},d.apply(this,arguments)},p=this&&this.__spreadArray||function(n,s,t){if(t||arguments.length===2)for(var i,l=0,E=s.length;l<E;l++)!i&&l in s||(i||(i=Array.prototype.slice.call(s,0,l)),i[l]=s[l]);return n.concat(i||Array.prototype.slice.call(s))};Object.defineProperty(f,"__esModule",{value:!0}),f.generateFakeMediaSdpAnswer=f.SdpUtil=void 0;var e=a(766),r=function(){function n(s){if(this.rawSdp=s.sdp,!s.sdp)throw new Error("No sdp to parse");this.sdpDetail=this.parse()}return Object.defineProperty(n.prototype,"detail",{get:function(){return this.sdpDetail},enumerable:!1,configurable:!0}),n.prototype.removeMedia=function(s){return this.removeMediaInner(s)},n.prototype.keepMedia=function(s){return this.removeMediaInner(s,{revert:!0})},n.prototype.removeMediaInner=function(s,t){t===void 0&&(t={revert:!1}),s.length&&this.sdpDetail.media&&this.sdpDetail.media.length&&(t.revert?this.sdpDetail.media=this.sdpDetail.media.filter(function(i){return s.includes(String(i.mid)||"")}):this.sdpDetail.media=this.sdpDetail.media.filter(function(i){return!s.includes(String(i.mid)||"")}),this.updateBundle())},n.prototype.addOrUpdateMedia=function(s,t){t===void 0&&(t={}),s=s.map(function(l){return d(d({},l),{setup:"passive"})});var i=[];this.sdpDetail.media=this.sdpDetail.media.map(function(l){var E=s.find(function(h){return h.mid===l.mid});if(E){i.push(l.mid);var b=E,_=l;return t.isPublish&&(b.ssrcs=_.ssrcs,b.ssrcGroups=_.ssrcGroups),E}return l}),this.sdpDetail.media=p(p([],this.sdpDetail.media,!0),s.filter(function(l){return!i.includes(l.mid)}),!0),this.updateBundle()},n.prototype.mungleMsid=function(){this.sdpDetail.media.forEach(function(s){if(s.msid){var t="";s.msid=s.msid.split(" ").map(function(i,l){return l===1?(t=i,i+"_"+s.mid):i}).join(" "),t&&s.ssrcs&&s.ssrcs.forEach(function(i){i.value&&(i.value=i.value.replace(t,t+"_"+s.mid))})}})},n.prototype.addMedia=function(s){var t;s=s.map(function(E){return d(d({},E),{setup:"passive"})}),this.sdpDetail.media=p(p([],this.sdpDetail.media,!0),s,!0);var i=s.reduce(function(E,b){return E+" "+b.mid},""),l=(t=this.sdpDetail.groups)===null||t===void 0?void 0:t.find(function(E){return E.type==="BUNDLE"});l&&(l.mids+="".concat(i))},n.prototype.setMediaInactive=function(s){this.sdpDetail.media.forEach(function(t){s.includes(String(t.mid))&&(t.direction="inactive")}),this.updateBundle()},n.prototype.getPublishSsrcs=function(){var s=[];return this.sdpDetail.media.forEach(function(t){t.direction!=="recvonly"&&t.ssrcs&&s.push({type:t.type,ssrc:t.ssrcs[0].id||"ERR_NOT_FOUND",mid:String(t.mid)})}),s},n.prototype.getPublishMsids=function(){var s=[];return this.sdpDetail.media.forEach(function(t){t.direction!=="recvonly"&&t.msid&&s.push({type:t.type,msid:t.msid,mid:String(t.mid)})}),s},n.prototype.generate=function(){return(0,e.write)(this.sdpDetail)},n.prototype.updateBundle=function(){var s,t=(s=this.sdpDetail.groups)===null||s===void 0?void 0:s.find(function(i){return i.type==="BUNDLE"});t&&(t.mids=this.sdpDetail.media.reduce(function(i,l){return i+l.mid+" "},"").trim())},n.prototype.addNack=function(){this.sdpDetail.media.forEach(function(s){var t,i,l;if(s.type==="audio"){if(!((t=s.rtcpFb)===null||t===void 0)&&t.some(function(b){return b.type==="nack"}))return;var E=(i=s.rtp.find(function(b){return b.codec==="opus"}))===null||i===void 0?void 0:i.payload;E&&((l=s.rtcpFb)===null||l===void 0||l.push({payload:E,type:"nack"}))}})},n.prototype.parse=function(){var s=(0,e.parse)(this.rawSdp);return this.patchMsid(s)},n.prototype.getMids=function(s){return s?.length?s.reduce(function(t,i){return p(p([],t,!0),[String(i.mid)],!1)},[]):[]},n.prototype.patchMsid=function(s){return s.media.forEach(function(t){var i,l;t.type==="application"||t.msid||(t.msid=(l=(i=t.ssrcs)===null||i===void 0?void 0:i.find(function(E){return E.attribute==="msid"}))===null||l===void 0?void 0:l.value)}),s},n}();f.SdpUtil=r,f.generateFakeMediaSdpAnswer=function(n){if(!n.mids.length||!n.medias.length||n.mids.length!==n.medias.length)return"";var s=`v=0
24
+ `}},776:function(S,f,a){var d,p=this&&this.__extends||(d=function(F,U){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(B,k){B.__proto__=k}||function(B,k){for(var V in k)Object.prototype.hasOwnProperty.call(k,V)&&(B[V]=k[V])},d(F,U)},function(F,U){if(typeof U!="function"&&U!==null)throw new TypeError("Class extends value "+String(U)+" is not a constructor or null");function B(){this.constructor=F}d(F,U),F.prototype=U===null?Object.create(U):(B.prototype=U.prototype,new B)}),e=this&&this.__assign||function(){return e=Object.assign||function(F){for(var U,B=1,k=arguments.length;B<k;B++)for(var V in U=arguments[B])Object.prototype.hasOwnProperty.call(U,V)&&(F[V]=U[V]);return F},e.apply(this,arguments)},r=this&&this.__awaiter||function(F,U,B,k){return new(B||(B=Promise))(function(V,G){function q(re){try{$(k.next(re))}catch(ee){G(ee)}}function z(re){try{$(k.throw(re))}catch(ee){G(ee)}}function $(re){var ee;re.done?V(re.value):(ee=re.value,ee instanceof B?ee:new B(function(ie){ie(ee)})).then(q,z)}$((k=k.apply(F,U||[])).next())})},n=this&&this.__generator||function(F,U){var B,k,V,G,q={label:0,sent:function(){if(1&V[0])throw V[1];return V[1]},trys:[],ops:[]};return G={next:z(0),throw:z(1),return:z(2)},typeof Symbol=="function"&&(G[Symbol.iterator]=function(){return this}),G;function z($){return function(re){return function(ee){if(B)throw new TypeError("Generator is already executing.");for(;G&&(G=0,ee[0]&&(q=0)),q;)try{if(B=1,k&&(V=2&ee[0]?k.return:ee[0]?k.throw||((V=k.return)&&V.call(k),0):k.next)&&!(V=V.call(k,ee[1])).done)return V;switch(k=0,V&&(ee=[2&ee[0],V.value]),ee[0]){case 0:case 1:V=ee;break;case 4:return q.label++,{value:ee[1],done:!1};case 5:q.label++,k=ee[1],ee=[0];continue;case 7:ee=q.ops.pop(),q.trys.pop();continue;default:if(!((V=(V=q.trys).length>0&&V[V.length-1])||ee[0]!==6&&ee[0]!==2)){q=0;continue}if(ee[0]===3&&(!V||ee[1]>V[0]&&ee[1]<V[3])){q.label=ee[1];break}if(ee[0]===6&&q.label<V[1]){q.label=V[1],V=ee;break}if(V&&q.label<V[2]){q.label=V[2],q.ops.push(ee);break}V[2]&&q.ops.pop(),q.trys.pop();continue}ee=U.call(F,q)}catch(ie){ee=[6,ie],k=0}finally{B=V=0}if(5&ee[0])throw ee[1];return{value:ee[0]?ee[1]:void 0,done:!0}}([$,re])}}},s=this&&this.__spreadArray||function(F,U,B){if(B||arguments.length===2)for(var k,V=0,G=U.length;V<G;V++)!k&&V in U||(k||(k=Array.prototype.slice.call(U,0,V)),k[V]=U[V]);return F.concat(k||Array.prototype.slice.call(U))},t=this&&this.__importDefault||function(F){return F&&F.__esModule?F:{default:F}};Object.defineProperty(f,"__esModule",{value:!0}),f.PeerConnectionCore=f.DEFAULT_HEARTBEAT_INTERVAL=f.EDatachannelStatus=void 0;var i=a(887),l=a(248),E=a(237),b=a(619),_=a(628),h=a(961),o=a(844),g=a(651);Object.defineProperty(f,"EDatachannelStatus",{enumerable:!0,get:function(){return g.EDatachannelStatus}});var m,T=a(854),C=t(a(885)),D=a(132),y=t(a(123)),A=a(125),w="rts video",j="rts audio";f.DEFAULT_HEARTBEAT_INTERVAL=2500,function(F){F.SUB_ADD="subsribe add",F.SUB_DELETE="subscribe delete",F.SUB_ACTIVE="subscribe active",F.SUB_STOP="subscribe stop",F.PUB_ADD="publish add",F.PUB_DELETE="publish delete",F.PUB_REPLACE="publish replace",F.PUB_STOP="publish stop",F.DATACHANNEL_SUB_ADD="sub add datachannel",F.DATACHANNEL_SUB_ACTIVE="sub active datachannel",F.DATACHANNEL_SUB_STOP="sub delete datachannel",F.DATACHANNEL_PUB_ADD="pub add datachannel",F.DATACHANNEL_PUB_STOP="pub delete datachannel"}(m||(m={}));var I=function(F){function U(B){var k=F.call(this)||this;return k.PCCore=B,k}return p(U,F),U.prototype.excuteSignal=function(B,k,V,G){var q=this;switch(B){case m.SUB_ADD:this.PCCore.proceedSubscribeAdd(G.configList,G.reconnecting).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.SUB_DELETE:this.PCCore.proceedSubscribeDeleteTracks(G.configList,G.skipError).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.SUB_ACTIVE:break;case m.SUB_STOP:this.PCCore.proceedSubscribeStop(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.PUB_ADD:this.PCCore.proceedPublishAdd(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.PUB_REPLACE:this.PCCore.proceedPublishReplaceTracks(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.PUB_DELETE:this.PCCore.proceedPublishDeleteTracks(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.PUB_STOP:this.PCCore.proceedPublishStop(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.DATACHANNEL_SUB_ADD:this.PCCore.proceedSubscribeAddDatachannel(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.DATACHANNEL_SUB_STOP:this.PCCore.proceedSubscribeStopDatachannel(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.DATACHANNEL_PUB_ADD:this.PCCore.proceedPublishAddDatachannel(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")});break;case m.DATACHANNEL_PUB_STOP:this.PCCore.proceedPublishStopDatachannel(G.configList).then(function(z){k(z)}).catch(function(z){V(z)}).finally(function(){q.emit("onSignalDone")})}},U}(C.default),H=function(F){function U(B){var k=F.call(this)||this;return k.heartbeatTimelineMap=new Map,k.removeTwcc=!1,k.mutex=!1,k.eventQueue=new T.CacheBuffer("signal queue"),k.signalTimer=null,k.rollbackController=new D.PeerConnectionRollbackController(k),k.onInnerSubscribeDelete=function(){},k.receiverCodecPreferences={},k.senderCodecPreferences={},k.removeTrackListener=function(){},k.heartbeatTimerHandle=null,k.heartbeatTokenRing=0,k.streamManager=new _.StreamManager,B.pc?(k.pc=B.pc,k.signal=new b.Signal({pc:B.pc,onDatachannelEvent:B.onDatachannelEvent}),k.heartbeatProcessor=new y.default(k.signal.getDatachannelCore().getWebrtcDatachannel(),k.streamManager),k.initHeartbeatListener(),k.notifyProcessor=new A.NotifyProcessor,k.initNotifyListener(),k.onInnerSubscribeDelete=B.onInnerSubscribeDelete||function(){},k.offerSdpHook=B.offerSdpHook,k.answerSdpHook=B.answerSdpHook,k):(console.error("peerconnetion is required"),k)}return p(U,F),U.prototype.getStreamManager=function(){return this.streamManager},U.prototype.getSignal=function(){return this.signal},U.prototype.setPrevOfferSdp=function(B){this.prevOfferSdp=B},U.prototype.setPrevAnswerSdp=function(B){this.prevAnswerSdp=B},U.prototype.setStreamManager=function(B){this.streamManager=B},U.prototype.getTrackIds=function(B){return B.reduce(function(k,V){return s(s([],k,!0),[V.id],!1)},[])},U.prototype.setRemoveTwcc=function(B){this.removeTwcc=B},U.prototype.setReceiverCodecPreferences=function(B){this.receiverCodecPreferences=e({},B)},U.prototype.setSenderCodecPreferences=function(B){this.senderCodecPreferences=e({},B)},U.prototype.subscribeAdd=function(B,k){var V=this;return new Promise(function(G,q){var z=new I(V);if(V.mutex){var $={type:m.SUB_ADD,excuter:z,res:G,rej:q,data:{configList:B}};V.eventQueue.cache($)}else V.atomSignalExec(m.SUB_ADD,z,G,q,{configList:B,reconnecting:k})})},U.prototype.subscribeDeleteTracks=function(B,k){var V=this;return new Promise(function(G,q){var z=new I(V);if(V.mutex){var $={type:m.SUB_DELETE,excuter:z,res:G,rej:q,data:{configList:B,skipError:k}};V.eventQueue.cache($)}else V.atomSignalExec(m.SUB_DELETE,z,G,q,{configList:B,skipError:k})})},U.prototype.subscribeStop=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.SUB_STOP,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.SUB_STOP,q,V,G,{configList:B})})},U.prototype.publishAdd=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.PUB_ADD,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.PUB_ADD,q,V,G,{configList:B})})},U.prototype.publishReplaceTracks=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.PUB_REPLACE,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.PUB_REPLACE,q,V,G,{configList:B})})},U.prototype.publishDeleteTracks=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.PUB_DELETE,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.PUB_DELETE,q,V,G,{configList:B})})},U.prototype.publishStop=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.PUB_STOP,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.PUB_STOP,q,V,G,{configList:B})})},U.prototype.subscribeAddDatachannel=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.DATACHANNEL_SUB_ADD,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.DATACHANNEL_SUB_ADD,q,V,G,{configList:B})})},U.prototype.subscribeStopDatachannel=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.DATACHANNEL_SUB_STOP,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.DATACHANNEL_SUB_STOP,q,V,G,{configList:B})})},U.prototype.publishAddDatachannel=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.DATACHANNEL_PUB_ADD,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.DATACHANNEL_PUB_ADD,q,V,G,{configList:B})})},U.prototype.publishStopDatachannel=function(B){var k=this;return new Promise(function(V,G){var q=new I(k);if(k.mutex){var z={type:m.DATACHANNEL_PUB_STOP,excuter:q,res:V,rej:G,data:{configList:B}};k.eventQueue.cache(z)}else k.atomSignalExec(m.DATACHANNEL_PUB_STOP,q,V,G,{configList:B})})},U.prototype.atomSignalExec=function(B,k,V,G,q){var z=this;this.mutex=!0,k.once("onSignalDone",function(){z.eventQueue.isEmpty()?z.mutex=!1:setTimeout(function(){var $=z.eventQueue.getFirst();z.atomSignalExec($.type,$.excuter,$.res,$.rej,$.data)})}),k.excuteSignal(B,V,G,q)},U.prototype.proceedSubscribeAdd=function(B,k){return r(this,void 0,void 0,function(){var V,G,q,z,$,re,ee,ie,se=this;return n(this,function(ce){switch(ce.label){case 0:if(this.log("SUB LIST: ",B),V=new Date().getTime(),G=new Date().getTime(),q=new Date().getTime(),z=this,$=this.extendUrl(B),re=$.map(function(ue){var de=ue.urlData,pe=ue.vMsid,Ee=ue.aMsid;if(se.streamManager.has(de.url)){var he=se.streamManager.get(de.url),fe=he.videoInfoList.map(function(Re){return Re.msid}),me=he.audioInfoList.map(function(Re){return Re.msid}),ge=(0,i.intersection)(fe,pe),_e=(0,i.intersection)(me,Ee);if(_e.length||ge.length)return{url:de.url,vMsid:ge,aMsid:_e}}}).filter(function(ue){return ue}),this.log("DELETE LIST: ",re),!re?.length)return[3,4];ce.label=1;case 1:return ce.trys.push([1,3,,4]),[4,this.proceedSubscribeDeleteTracks(re,!0,k)];case 2:return ce.sent(),this.onInnerSubscribeDelete&&this.onInnerSubscribeDelete(re),[3,4];case 3:throw ee=ce.sent(),(ie=ee).extraInfo=e(e({},ie.extraInfo),{api:"subscribeAdd",signal_api:"subscribeDeleteTracks",configList:B}),ie;case 4:return V=new Date().getTime(),[2,new Promise(function(ue,de){return r(se,void 0,void 0,function(){function pe(){return r(this,void 0,void 0,function(){var O,K;return n(this,function(Y){switch(Y.label){case 0:z.removeTrackListener(),O=z.buildUrlStreamMap($),Y.label=1;case 1:return Y.trys.push([1,3,,4]),[4,z.subscribeActive(B)];case 2:return Y.sent(),[3,4];case 3:return(K=Y.sent()).extraInfo=e(e({},K.extraInfo),{api:"subscribeAdd",signal_api:"subscribeActive"}),z.rollbackController.rollback({pcTransceiversRollback:!0,streamManagerRollback:!0}),[2,de(K)];case 4:return G=new Date().getTime(),ue({deleteRspTime:V,subAddRspTime:q,activeRspTime:G,streamList:O}),[2]}})})}var Ee,he,fe,me,ge,_e,Re,Te,Ne,ke,we,Ce,Ae,Pe,Oe,He,We,xe=this;return n(this,function(O){switch(O.label){case 0:if(!this.pc)return[2,de(new h.RtsError(o.ErrorCode.CORE_NO_PC_ERROR,"subscribeAdd: no peerconnection",""))];this.pc.addEventListener("track",pe),this.removeTrackListener=function(){var K;(K=xe.pc)===null||K===void 0||K.removeEventListener("track",pe)},this.rollbackController.saveStreamManager(this.streamManager),Ee=[],$.forEach(function(K){var Y=K.urlData,X=K.vMsid,Z=K.aMsid;if(xe.pc){if(xe.streamManager.init(Y.url),Y.subVideo&&!xe.streamManager.isMsidSubPubDone(Y.url,{vMsid:X[0]})){var te=xe.pc.addTransceiver("video",{direction:"recvonly"});Ee.push({type:"video",msid:X[0],trans:te}),xe.streamManager.update(Y.url,{vMsid:X[0],vTransceiver:te}),xe.setCodecPreferences(te,xe.receiverCodecPreferences.video)}if(Y.subAudio&&!xe.streamManager.isMsidSubPubDone(Y.url,{aMsid:Z[0]})){var Q=xe.pc.addTransceiver("audio",{direction:"recvonly"});Ee.push({type:"audio",msid:Z[0],trans:Q}),xe.streamManager.update(Y.url,{aMsid:Z[0],aTransceiver:Q}),xe.setCodecPreferences(Q,xe.receiverCodecPreferences.audio)}}}),this.rollbackController.setFakeSdpMedias(Ee,"sub"),O.label=1;case 1:return O.trys.push([1,3,,4]),[4,this.pc.createOffer()];case 2:return he=O.sent(),[3,4];case 3:return fe=O.sent(),[2,de(new h.RtsError(o.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer Error: ".concat(fe),"",{api:"subscribeAdd",err:fe}))];case 4:if(me=new l.SdpUtil({sdp:he.sdp||""}),this.restorePublishedSsrc(me),me.addNack(),me.updateBundle(),he=new RTCSessionDescription({type:"offer",sdp:me.generate()}),ge=this.findNewSubPubMids(he?.sdp||"",this.prevOfferSdp||""),this.setPrevOfferSdp(he.sdp||""),this.rollbackController.setFakeSdpMids(ge),_e=this.avoidMsidConflict(he.sdp),this.offerSdpHook)try{_e=this.offerSdpHook(_e)}catch(K){console.log("offerSdpHook error: ",K)}O.label=5;case 5:return O.trys.push([5,7,,9]),[4,this.pc.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:_e}))];case 6:return O.sent(),[3,9];case 7:return Re=O.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0,runSimulateSignal:!0})];case 8:return O.sent(),[2,de(new h.RtsError(o.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(Re),"",{api:"subscribeAdd",sdp:he}))];case 9:if(Te=[],Ne=[],$.forEach(function(K){var Y=new l.SdpUtil({sdp:he?.sdp||""}),X=[],Z=K.vMsid.length!==0,te=K.aMsid.length!==0,Q=!1,oe=!1;Y.detail.media.forEach(function(ne){var ae=String(ne.mid);ge.includes(ae)&&(Ne.includes(ae)||(ne.type==="video"&&Z&&!Q?(X.push(String(ne.mid)),Q=!0):ne.type==="audio"&&te&&!oe&&(X.push(String(ne.mid)),oe=!0)))}),Ne=s(s([],Ne,!0),X,!0),Y.keepMedia(X),Te.push(Y.generate())}),this.log("ADD LIST: ",$),this.offerSdpHook)try{Te=Te.map(function(K){return xe.offerSdpHook(K)})}catch(K){console.log("offerSdpHook error: ",K)}O.label=10;case 10:return O.trys.push([10,12,,14]),[4,(We=this.signal)===null||We===void 0?void 0:We.subscribeAdd($,Te,this.streamManager)];case 11:return ke=O.sent(),[3,14];case 12:return we=O.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0,runSimulateSignal:!0})];case 13:return O.sent(),we.extraInfo=e({api:"subscribeAdd",signal_api:"subscribeAdd"},we.extraInfo),[2,de(we)];case 14:if(Ce=[],ke.streams.forEach(function(K,Y){xe.log("Sub TraceId[".concat(Y,"]: "),K.traceid);var X=new l.SdpUtil({sdp:K.sdp});Ce=s(s([],Ce,!0),X.detail.media,!0);var Z=$.find(function(te){return te.urlData.url===K.url});Z&&(Z.traceId=K.traceid)}),(Ae=new l.SdpUtil({sdp:this.prevAnswerSdp||""})).addOrUpdateMedia(Ce),this.alignAnswerMidsWithOffer(Ae),Pe=Ae.generate(),this.setPrevAnswerSdp(Pe),Oe=this.avoidMsidConflict(Pe),this.answerSdpHook)try{Oe=this.answerSdpHook(Oe)}catch(K){console.log("answerSdpHook error: ",K)}O.label=15;case 15:return O.trys.push([15,17,,19]),[4,this.pc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:Oe}))];case 16:return O.sent(),$.forEach(function(K){xe.streamManager.markAlreadySubPub(K.urlData.url,{vMsid:K.vMsid[0],aMsid:K.aMsid[0]})}),[3,19];case 17:return He=O.sent(),[4,this.rollbackController.rollback({trackListnerRollback:!0,pcTransceiversRollback:!0,streamManagerRollback:!0})];case 18:return O.sent(),[2,de(new h.RtsError(o.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(He),"",{api:"subscribeAdd",sdp:Pe}))];case 19:return q=new Date().getTime(),[2]}})})})]}})})},U.prototype.subscribeActive=function(B){var k;return r(this,void 0,void 0,function(){return n(this,function(V){return[2,(k=this.signal)===null||k===void 0?void 0:k.subscribeActive(this.extendUrl(B))]})})},U.prototype.proceedSubscribeDeleteTracks=function(B,k,V){var G,q,z,$;return r(this,void 0,void 0,function(){var re,ee,ie,se,ce,ue,de,pe=this;return n(this,function(Ee){switch(Ee.label){case 0:B.forEach(function(he){he.rawUrl=he.url,he.url=pe.streamManager.getOriginUrl(he.url)}),re=!1,ee=!!k,ie=void 0,Ee.label=1;case 1:return Ee.trys.push([1,3,,4]),[4,(G=this.signal)===null||G===void 0?void 0:G.subscribeDelete(B)];case 2:return Ee.sent(),[3,4];case 3:return se=Ee.sent(),re=(ie=se).errorCode===o.ErrorCode.DATACHANNEL_RESPONSE_ERROR&&((z=(q=ie.extraInfo)===null||q===void 0?void 0:q.parsedData)===null||z===void 0?void 0:z.streams)&&(($=ie.extraInfo.parsedData.streams[0])===null||$===void 0?void 0:$.res_code)===404,[3,4];case 4:if(ie&&!re)throw ie.extraInfo=e({api:"subscribeDeleteTracks"},ie.extraInfo),ie;return ce=ee&&re,ue=[],de=B.map(function(he){var fe=he.url,me=he.vMsid,ge=he.aMsid,_e=he.rawUrl;return r(pe,void 0,void 0,function(){var Re,Te,Ne,ke,we,Ce,Ae,Pe;return n(this,function(Oe){switch(Oe.label){case 0:fe=(0,i.pruneSubUrl)(fe),this.streamManager.has(fe)&&(me&&(Ne=this.streamManager.getTransceiver(fe,{vMsid:me[0]}))&&(Te=Ne.receiver.track).stop(),ge&&(ke=this.streamManager.getTransceiver(fe,{aMsid:ge[0]}))&&(Re=ke.receiver.track).stop()),Oe.label=1;case 1:return Oe.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return Oe.sent(),[3,4];case 3:throw(we=Oe.sent()).extraInfo=e({api:"subscribeDeleteTracks"},we.extraInfo),we;case 4:return(Ce=this.streamManager.getStreamByMsid({url:fe,vMsid:me?.[0],aMsid:ge?.[0]}))&&(Re&&((Ae=Ce.mediastream)===null||Ae===void 0||Ae.removeTrack(Re)),Te&&((Pe=Ce.mediastream)===null||Pe===void 0||Pe.removeTrack(Te))),V||this.streamManager.pruneStreamList(fe),this.streamManager.removeMsid(fe,{vMsid:me?.length?this.unifyMsid(me,"video"):void 0,aMsid:ge?.length?this.unifyMsid(ge,"audio"):void 0}),ue.push({url:_e||"",stream:Ce}),[2]}})})}),[4,Promise.all(de)];case 5:if(Ee.sent(),!ce&&ie)throw ie.extraInfo=e({api:"subscribeDeleteTracks"},ie.extraInfo),ie;return[2,ue]}})})},U.prototype.proceedSubscribeStop=function(B){var k;return r(this,void 0,void 0,function(){var V,G,q=this;return n(this,function(z){switch(z.label){case 0:return z.trys.push([0,2,,3]),[4,(k=this.signal)===null||k===void 0?void 0:k.subscribeStop(this.extendUrl(B))];case 1:return z.sent(),[3,3];case 2:throw(V=z.sent()).extraInfo=e({api:"subscribeStop"},V.extraInfo),V;case 3:return B.forEach(function($){$.rawUrl=$.url,$.url=q.streamManager.getOriginUrl($.url)}),G=B.map(function($){var re=$.url;return $.rawUrl,$.targetStreams,r(q,void 0,void 0,function(){var ee;return n(this,function(ie){switch(ie.label){case 0:re=(0,i.pruneSubUrl)(re),this.streamManager.getAllTransceivers(re).forEach(function(se){var ce;(ce=se?.receiver.track)===null||ce===void 0||ce.stop()}),this.streamManager.get(re).streamList.forEach(function(se){return se.release()}),this.streamManager.remove(re),ie.label=1;case 1:return ie.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return ie.sent(),[3,4];case 3:throw(ee=ie.sent()).extraInfo=e({api:"subscribeStop"},ee.extraInfo),ee;case 4:return[2]}})})}),[4,Promise.all(G)];case 4:return z.sent(),[2]}})})},U.prototype.proceedPublishAdd=function(B){var k;return r(this,void 0,void 0,function(){var V,G,q,z,$,re,ee,ie,se,ce,ue,de,pe,Ee,he,fe,me,ge,_e,Re,Te,Ne,ke,we,Ce,Ae,Pe,Oe,He,We=this;return n(this,function(xe){switch(xe.label){case 0:if(B.length>1)throw console.error("Only one stream is supported."),new h.RtsError(o.ErrorCode.CORE_PUBLIST_EXCEED_ERROR,"publishAdd: publishList exceed limit","",{api:"publishAdd"});if(!this.pc)throw new h.RtsError(o.ErrorCode.CORE_NO_PC_ERROR,"publishAdd: no peerconnection","",{api:"publishAdd"});V=B[0],G=V.stream,q=this.unifyMsid(V.aMsid,"audio"),z=this.unifyMsid(V.vMsid,"video"),V.rawUrl=V.url,V.url=this.streamManager.getOriginUrl(V.url),typeof V.updateSourceStream!="boolean"&&(V.updateSourceStream=!0),$=G.videoTrack,re=G.audioTrack,this.rollbackController.saveStreamManager(this.streamManager),ee=[],ie=this.streamManager.getStreamByMsid({url:V.url,vMsid:z,aMsid:q}),this.streamManager.init(V.url,_.EStreamType.Publish),$&&(se=this.pc.addTransceiver(G.videoTrack,{direction:"sendonly"}),this.streamManager.update(V.url,{vMsid:z,vTransceiver:se,stream:G}),ee.push({type:"video",trans:se,msid:z}),this.setCodecPreferences(se,this.senderCodecPreferences.video)),re&&(se=this.pc.addTransceiver(G.audioTrack,{direction:"sendonly"}),this.streamManager.update(V.url,{aMsid:q,aTransceiver:se,stream:G}),ee.push({type:"audio",trans:se,msid:q}),this.setCodecPreferences(se,this.senderCodecPreferences.audio)),this.rollbackController.setFakeSdpMedias(ee,"pub"),xe.label=1;case 1:return xe.trys.push([1,3,,4]),[4,this.pc.createOffer()];case 2:return ce=xe.sent(),[3,4];case 3:throw ue=xe.sent(),new h.RtsError(o.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer Error: ".concat(ue),"",{api:"publishAdd",err:ue});case 4:if(de=new l.SdpUtil({sdp:ce.sdp||""}),pe=this.parseMsidString(z),Ee=this.parseMsidString(q),he=this.findNewSubPubMids(ce.sdp||"",this.prevOfferSdp||""),this.rollbackController.setFakeSdpMids(he),pe.stream&&de.detail.msidSemantic&&(de.detail.msidSemantic.token=pe.stream),fe=de.detail.media.reduce(function(O,K){return K.direction==="inactive"?s(s([],O,!0),[String(K.mid)],!1):O},[]),de.detail.media.forEach(function(O){var K;if(O.direction!=="recvonly"&&O.type!=="application"&&he.includes(String(O.mid))){var Y=O.type==="video"?pe:Ee,X=We.parseMsidString(O.msid);X.stream=Y.stream||X.stream,X.track=Y.track||X.track;var Z=We.stringifyMsid(X);O.msid=Z,(K=O.ssrcs)===null||K===void 0||K.forEach(function(te){switch(te.attribute){case"cname":case"label":te.value=Y.track||te.value;break;case"msid":te.value=Z;break;case"mslabel":te.value=Y.stream||te.value}})}}),this.restorePublishedSsrc(de),this.restorePublishMsid(de),de.addNack(),me=de.generate(),this.setPrevOfferSdp(me),ge=this.avoidMsidConflict(me),this.offerSdpHook)try{ge=this.offerSdpHook(ge)}catch(O){console.log("offerSdoHook error: ",O)}xe.label=5;case 5:return xe.trys.push([5,7,,8]),[4,this.pc.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:ge}))];case 6:return xe.sent(),[3,8];case 7:throw _e=xe.sent(),this.rollbackController.rollback({streamManagerRollback:!0,runSimulateSignal:!0}),new h.RtsError(o.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(_e),"",{api:"publishAdd",sdp:me});case 8:if(de.keepMedia(he),this.updateTrackInfoList({url:V.rawUrl,stream:V.stream,vMsid:z,aMsid:q,sdpMediaList:de.detail.media}),ge=de.generate(),this.offerSdpHook)try{ge=this.offerSdpHook(ge)}catch(O){console.log("offerSdpHook error: ",O)}xe.label=9;case 9:return xe.trys.push([9,11,,12]),[4,(k=this.signal)===null||k===void 0?void 0:k.publishAdd([V.url],[ge],[$?[this.stringifyMsid(pe)]:[]],[re?[this.stringifyMsid(Ee)]:[]])];case 10:return Re=xe.sent(),[3,12];case 11:throw Te=xe.sent(),(Ne=Te).extraInfo=e({api:"publishAdd"},Ne.extraInfo),this.rollbackController.rollback({streamManagerRollback:!0,runSimulateSignal:!0}),Ne;case 12:if(ke=Re.streams[0],V.traceId=ke.traceid,this.log("Pub TraceId: ",V.traceId),(we=new l.SdpUtil({sdp:ke.sdp})).detail.media.forEach(function(O){O.type!=="application"&&O.direction==="sendrecv"&&(O.direction="recvonly")}),(Ce=new l.SdpUtil({sdp:this.prevAnswerSdp||""})).detail.media.forEach(function(O){O.type==="application"&&(delete O.candidates,delete O.endOfCandidates)}),Ce.setMediaInactive(fe),Ce.addOrUpdateMedia(we.detail.media,{isPublish:!0}),this.alignAnswerMidsWithOffer(Ce),this.removeTwcc&&(Ae=["http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"],Ce.detail.media.forEach(function(O){var K;O.ext=(K=O.ext)===null||K===void 0?void 0:K.filter(function(Y){return!Ae.includes(Y.uri)})})),Pe=Ce.generate(),this.setPrevAnswerSdp(Pe),Oe=this.avoidMsidConflict(Pe),this.answerSdpHook)try{Oe=this.answerSdpHook(Oe)}catch(O){console.log("answerSdpHook error: ",O)}xe.label=13;case 13:return xe.trys.push([13,15,,16]),[4,this.pc.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:Oe}))];case 14:return xe.sent(),this.streamManager.markAlreadySubPub(V.url,{vMsid:z,aMsid:q,isPub:!0}),[3,16];case 15:throw He=xe.sent(),this.rollbackController.rollback({streamManagerRollback:!0}),new h.RtsError(o.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(He),"",{api:"publishAdd",sdp:Pe});case 16:return ie&&V.updateSourceStream&&ie.mergeStream(G),[2,B.map(function(O){return{url:O.rawUrl,trackInfoList:We.streamManager.getAllMediaInfoList(V.url),traceId:O.traceId}})]}})})},U.prototype.proceedPublishDeleteTracks=function(B){var k,V,G,q,z,$,re;return r(this,void 0,void 0,function(){var ee,ie,se,ce,ue,de,pe,Ee,he,fe,me=this;return n(this,function(ge){switch(ge.label){case 0:B.forEach(function(_e){_e.rawUrl=_e.url,_e.url=me.streamManager.getOriginUrl(_e.url)}),ge.label=1;case 1:return ge.trys.push([1,3,,4]),[4,(k=this.signal)===null||k===void 0?void 0:k.publishDelete(B)];case 2:return ge.sent(),[3,4];case 3:throw(ee=ge.sent()).extraInfo=e({api:"publishDeleteTracks"},ee.extraInfo),ee;case 4:if(ie=B[0],se=(0,i.pruneSubUrl)(ie.url),typeof ie.updateSourceStream!="boolean"&&(ie.updateSourceStream=!0),ce=!1,ue=!1,!this.streamManager.has(se))return[3,9];!((V=ie.vMsid)===null||V===void 0)&&V.length&&((de=this.streamManager.getTransceiver(se,{vMsid:ie.vMsid[0]}))!=null&&de.sender&&((G=this.pc)===null||G===void 0||G.removeTrack(de?.sender)),ce=!0),!((q=ie.aMsid)===null||q===void 0)&&q.length&&((pe=this.streamManager.getTransceiver(se,{aMsid:ie.aMsid[0]}))!=null&&pe.sender&&((z=this.pc)===null||z===void 0||z.removeTrack(pe?.sender)),ue=!0),ge.label=5;case 5:return ge.trys.push([5,7,,8]),[4,this.simulateOfferAnswer()];case 6:return ge.sent(),[3,8];case 7:throw(Ee=ge.sent()).extraInfo=e({api:"publishDeleteTracks"},Ee.extraInfo),Ee;case 8:return(he=this.streamManager.getStreamByMsid({url:se,vMsid:($=ie.vMsid)===null||$===void 0?void 0:$[0],aMsid:(re=ie.aMsid)===null||re===void 0?void 0:re[0]}))&&ie.updateSourceStream&&he.deleteTracks({video:ce,audio:ue}),this.streamManager.removeMsid(se,{vMsid:ce?this.unifyMsid(ie.vMsid,"video"):void 0,aMsid:ue?this.unifyMsid(ie.aMsid,"audio"):void 0}),this.streamManager.pruneStreamList(se),fe=this.streamManager.getAllMediaInfoList(ie.url),[2,B.map(function(_e){return{url:_e.rawUrl,trackInfoList:fe}})];case 9:return[2]}})})},U.prototype.proceedPublishReplaceTracks=function(B){var k,V,G,q,z;return r(this,void 0,void 0,function(){var $,re,ee,ie,se,ce,ue,de,pe,Ee,he=this;return n(this,function(fe){switch(fe.label){case 0:if($=B[0],re=$.stream,ee=$.vMsid,ie=$.aMsid,$.rawUrl=$.url,$.url=this.streamManager.getOriginUrl($.url),!this.streamManager.has($.url))throw new h.RtsError(o.ErrorCode.CORE_PUB_REPLACE_URL_NOT_FOUND,"No stream found for this url: ".concat($.url),"",{api:"publishReplaceTracks",configList:B});return typeof $.updateSourceStream!="boolean"&&($.updateSourceStream=!0),se=re.audioTrack,ce=re.videoTrack,ue=this.streamManager.getAllMediaInfoList($.url,!0),se&&(pe=(k=ue.find(function(me){return me.type==="audio"&&(!ie||me.msid===ie)}))===null||k===void 0?void 0:k.transceiver)&&se.id!==((G=(V=pe.sender)===null||V===void 0?void 0:V.track)===null||G===void 0?void 0:G.id)?[4,pe.sender.replaceTrack(se)]:[3,2];case 1:fe.sent(),fe.label=2;case 2:return ce?(de=ue.find(function(me){return me.type==="video"&&(!ee||me.msid===ee)}),(pe=de?.transceiver)&&ce.id!==((z=(q=pe.sender)===null||q===void 0?void 0:q.track)===null||z===void 0?void 0:z.id)?[4,pe.sender.replaceTrack(ce)]:[3,4]):[3,4];case 3:fe.sent(),re.isCustomStream||(de.from=re.hasScreen?"screen":"camera"),fe.label=4;case 4:return(Ee=this.streamManager.getStreamByMsid({url:$.url,vMsid:ee,aMsid:ie}))&&$.updateSourceStream&&Ee.mergeStream(re),[2,B.map(function(me){return{url:me.rawUrl,trackInfoList:he.streamManager.getAllMediaInfoList($.url)}})]}})})},U.prototype.proceedPublishStop=function(B){var k;return r(this,void 0,void 0,function(){var V,G,q=this;return n(this,function(z){switch(z.label){case 0:return z.trys.push([0,2,,3]),[4,(k=this.signal)===null||k===void 0?void 0:k.publishStop(B.map(function($){return q.streamManager.getOriginUrl($.url)}))];case 1:return z.sent(),[3,3];case 2:throw(V=z.sent()).extraInfo=e({api:"publishStop"},V.extraInfo),V;case 3:return G=B.map(function($){var re=$.url;return r(q,void 0,void 0,function(){var ee,ie=this;return n(this,function(se){switch(se.label){case 0:re=(0,i.pruneSubUrl)(re),this.streamManager.getAllTransceivers(re).forEach(function(ce){var ue;ce?.sender&&((ue=ie.pc)===null||ue===void 0||ue.removeTrack(ce?.sender))}),this.streamManager.get(re).streamList.forEach(function(ce){return ce.deleteTracks({video:!0,audio:!0})}),this.streamManager.remove(re),se.label=1;case 1:return se.trys.push([1,3,,4]),[4,this.simulateOfferAnswer()];case 2:return se.sent(),[3,4];case 3:throw(ee=se.sent()).extraInfo=e({api:"publishStop"},ee.extraInfo),ee;case 4:return[2]}})})}),[4,Promise.all(G)];case 4:return z.sent(),[2]}})})},U.prototype.proceedSubscribeAddDatachannel=function(B){return r(this,void 0,void 0,function(){var k=this;return n(this,function(V){return[2,new Promise(function(G,q){return r(k,void 0,void 0,function(){var z,$,re,ee,ie,se=this;return n(this,function(ce){switch(ce.label){case 0:return ce.trys.push([0,2,,3]),[4,(ee=this.signal)===null||ee===void 0?void 0:ee.subscribeAddDatachannel(B)];case 1:return ce.sent(),[3,3];case 2:return(z=ce.sent()).extraInfo=e({api:"subscribeAddDatachannel",signal_api:"subscribeAddDatachannel"},z.extraInfo),[2,q(z)];case 3:$={},ce.label=4;case 4:return ce.trys.push([4,6,,7]),[4,(ie=this.signal)===null||ie===void 0?void 0:ie.subscribeActiveDatachannel(B)];case 5:return $=ce.sent(),[3,7];case 6:return(re=ce.sent()).extraInfo=e({api:"subscribeAddDatachannel",signal_api:"subscribeActiveDatachannel"},re.extraInfo),[2,q(re)];case 7:return B.forEach(function(ue){se.streamManager.addOrUpdateDatachannelItem({type:"sub-data",url:(0,i.pruneSubUrl)(ue.url,!0),msids:[{name:ue.msid,id:ue.datachannelId,type:"data",label:ue.label,datachannel:ue.datachannel}],originUrl:ue.url,streams:[]})}),G($),[2]}})})})]})})},U.prototype.proceedSubscribeStopDatachannel=function(B){return r(this,void 0,void 0,function(){var k=this;return n(this,function(V){return[2,new Promise(function(G,q){return r(k,void 0,void 0,function(){var z,$,re,ee,ie,se,ce,ue=this;return n(this,function(de){switch(de.label){case 0:return de.trys.push([0,2,,3]),[4,(re=this.signal)===null||re===void 0?void 0:re.subscribeStopDatachannel(B)];case 1:return de.sent(),[3,3];case 2:return z=de.sent(),((ce=(se=(ie=(ee=($=z)==null?void 0:$.extraInfo)===null||ee===void 0?void 0:ee.parsedData)===null||ie===void 0?void 0:ie.streams)===null||se===void 0?void 0:se[0])===null||ce===void 0?void 0:ce.res_code)===404?[3,3]:($.extraInfo=e({api:"subscribeStopDatachannel",signal_api:"subscribeStopDatachannel"},$.extraInfo),[2,q(z)]);case 3:return B.forEach(function(pe){ue.streamManager.deleteDatachannelItem({url:(0,i.pruneSubUrl)(pe.url,!0)})}),G(),[2]}})})})]})})},U.prototype.proceedPublishAddDatachannel=function(B){return r(this,void 0,void 0,function(){var k=this;return n(this,function(V){return[2,new Promise(function(G,q){return r(k,void 0,void 0,function(){var z,$,re,ee=this;return n(this,function(ie){switch(ie.label){case 0:z={},ie.label=1;case 1:return ie.trys.push([1,3,,4]),[4,(re=this.signal)===null||re===void 0?void 0:re.publishAddDatachannel(B)];case 2:return z=ie.sent(),[3,4];case 3:return($=ie.sent()).extraInfo=e({api:"publishAddDatachannel",signal_api:"publishAddDatachannel"},$.extraInfo),[2,q($)];case 4:return B.forEach(function(se){ee.streamManager.addOrUpdateDatachannelItem({type:"pub-data",url:(0,i.pruneSubUrl)(se.url,!0),msids:[{name:se.msid,id:se.datachannelId,type:"data",label:se.label,datachannel:se.datachannel}],originUrl:se.url,streams:[]})}),G(z),[2]}})})})]})})},U.prototype.proceedPublishStopDatachannel=function(B){return r(this,void 0,void 0,function(){var k=this;return n(this,function(V){return[2,new Promise(function(G,q){return r(k,void 0,void 0,function(){var z,$,re=this;return n(this,function(ee){switch(ee.label){case 0:return ee.trys.push([0,2,,3]),[4,($=this.signal)===null||$===void 0?void 0:$.publishStopDatachannel(B)];case 1:return ee.sent(),[3,3];case 2:return(z=ee.sent()).extraInfo=e({api:"publishStopDatachannel",signal_api:"publishStopDatachannel"},z.extraInfo),[2,q(z)];case 3:return B.forEach(function(ie){re.streamManager.deleteDatachannelItem({url:(0,i.pruneSubUrl)(ie.url,!0)})}),G(),[2]}})})})]})})},U.prototype.buildUrlStreamMap=function(B){var k=this,V=[];return B.forEach(function(G){var q=G.urlData,z=G.traceId,$=G.url,re=G.vMsid,ee=G.aMsid,ie=q.url,se=new MediaStream;k.streamManager.getAllMediaInfoList(ie,!0).forEach(function(ce){var ue,de;if(ce.type==="video"&&ce.msid===re[0]||ce.type==="audio"&&ce.msid===ee[0]){var pe=(de=(ue=ce.transceiver)===null||ue===void 0?void 0:ue.receiver)===null||de===void 0?void 0:de.track;pe&&se.addTrack(pe)}}),V.push({url:$,stream:se,traceId:z})}),V},U.prototype.extendUrl=function(B){var k=this;return B.map(function(V){var G=V.url,q=V.subAudio,z=V.subVideo,$=V.aMsid,re=V.vMsid,ee=k.streamManager.getOriginUrl(G),ie=new E.UrlData({url:ee,subAudio:q,subVideo:z});return e(e({},V),{urlData:ie,aMsid:ie.subAudio?$||[j]:[],vMsid:ie.subVideo?re||[w]:[]})})},U.prototype.parseSdp=function(B){return new l.SdpUtil({sdp:B})},U.prototype.getTrackInfoList=function(B,k,V){B===void 0&&(B=[]);var G=[];return B.forEach(function(q){var z,$,re,ee;if(q.type!=="application"){var ie,se=Number(q.ssrcs&&((z=q.ssrcs[0])===null||z===void 0?void 0:z.id))||-1,ce=q.rtp.find(function(fe){var me;return["opus","h264"].includes((me=fe.codec)===null||me===void 0?void 0:me.toLowerCase())}),ue=ce?.codec||"",de=ce?.payload||0;k.isCustomStream||q.type==="video"&&(ie=k.hasScreen?"screen":"camera");var pe=q.msid;if(V?.aMsid||V?.vMsid){var Ee=(q.type==="video"?V.vMsid:V.aMsid)||"";Ee?.trim().includes(" ")||(pe=($=q.msid)===null||$===void 0?void 0:$.split(" ")[1])}var he=q.type==="video"?(re=k.videoTrack)===null||re===void 0?void 0:re.id:(ee=k.audioTrack)===null||ee===void 0?void 0:ee.id;G.push({ssrc:se,codec:ue,type:q.type,pt:de,msid:pe,from:ie,trackId:he})}}),G},U.prototype.patchSubscribeStreamManagerRecord=function(B,k){var V=this;this.extendUrl([{url:B,vMsid:k.vMsid,aMsid:k.aMsid}]).forEach(function(G){var q=G.urlData,z=G.vMsid,$=G.aMsid;if(V.pc&&(V.streamManager.remove(q.url),V.streamManager.init(q.url),V.pc.getTransceivers)){var re=V.pc.getTransceivers()||[];if(q.subVideo){var ee=re.find(function(se){return se.receiver.track.kind==="video"});V.streamManager.update(q.url,{vMsid:z[0],vTransceiver:ee,stream:k.stream})}if(q.subAudio){var ie=re.find(function(se){return se.receiver.track.kind==="audio"});V.streamManager.update(q.url,{aMsid:$[0],aTransceiver:ie,stream:k.stream})}V.streamManager.markAlreadySubPub(B,{vMsid:z[0],aMsid:$[0],isPub:!1})}})},U.prototype.patchPublishStreamManagerRecord=function(B,k){if(this.pc){var V=k.stream,G=V.videoTrack,q=V.audioTrack,z=this.unifyMsid(k.aMsid,"audio"),$=this.unifyMsid(k.vMsid,"video");if(this.streamManager.init(B,_.EStreamType.Publish),this.pc.getTransceivers){var re=this.pc.getTransceivers()||[];if(G){var ee=re.find(function(se){var ce,ue;return((ue=(ce=se.sender)===null||ce===void 0?void 0:ce.track)===null||ue===void 0?void 0:ue.id)===G.id});ee&&this.streamManager.update(B,{vMsid:$,vTransceiver:ee,stream:k.stream})}if(q){var ie=re.find(function(se){var ce,ue;return((ue=(ce=se.sender)===null||ce===void 0?void 0:ce.track)===null||ue===void 0?void 0:ue.id)===q.id});ie&&this.streamManager.update(B,{aMsid:z,aTransceiver:ie,stream:k.stream})}this.streamManager.markAlreadySubPub(B,{vMsid:$,aMsid:z,isPub:!0})}}},U.prototype.updateTrackInfoList=function(B){var k=B.url,V=B.stream,G=B.vMsid,q=B.aMsid,z=B.sdpMediaList;k||console.error("[updateTrackInfoList] url is required");var $=this.getTrackInfoList(z,V,{vMsid:G,aMsid:q}),re=$.find(function(ie){return ie.type==="video"}),ee=$.find(function(ie){return ie.type==="audio"});return G&&re&&this.streamManager.updateSdpInfo(k,e({vMsid:G},re)),q&&ee&&this.streamManager.updateSdpInfo(k,e({aMsid:q},ee)),$},U.prototype.unifyMsid=function(B,k){var V=k==="video"?w:j;return B?.[0]||V},U.prototype.startSignalHeartbeatTimer=function(B){var k=this;B&&B<200?console.warn("PEER CORE: heartbeat interval ".concat(B," is too small and will not take effect. At least 200ms")):(this.stopSignalHeartbeatTimer(),this.heartbeatTimerHandle=setInterval(function(){var V=void 0,G=k.streamManager.getSize(),q=k.streamManager.getSubOrPubDoneMediaMapSize();if(k.heartbeatTokenRing%=G,k.heartbeatTokenRing<q){var z=k.heartbeatTokenRing,$=k.streamManager.getPubOrSubDoneMediaUrlByIndex(z);$&&(V=[]).push({url:$})}else if(k.heartbeatTokenRing<G){z=k.heartbeatTokenRing-q;var re=k.streamManager.getDcUrlByIndex(z);re&&(V=[]).push(re)}k.heartbeatTokenRing++,k.heartbeatTokenRing%=G,k.sendOnceHeartbeat(V)},B||f.DEFAULT_HEARTBEAT_INTERVAL))},U.prototype.stopSignalHeartbeatTimer=function(){this.heartbeatTimerHandle!==null&&clearInterval(this.heartbeatTimerHandle),this.heartbeatTimerHandle=null},U.prototype.sendOnceHeartbeat=function(B){var k,V=(k=this.signal)===null||k===void 0?void 0:k.sendHeartbeat(B);V&&(this.hebtLog(">>> Send: heartbeat",V),this.heartbeatTimelineMap.set(V.msg_id,performance.now()))},U.prototype.sendFalseHeartbeat=function(B){var k,V=(k=this.signal)===null||k===void 0?void 0:k.sendFalseHeartbeat(B);V&&(this.hebtLog(">>> Send: false heartbeat",B),this.heartbeatTimelineMap.set(V.msg_id,performance.now()))},U.prototype.dispose=function(){var B,k;this.pc=void 0,this.prevOfferSdp=void 0,this.prevAnswerSdp=void 0,(B=this.signal)===null||B===void 0||B.dispose(),(k=this.streamManager)===null||k===void 0||k.dispose(),this.stopSignalHeartbeatTimer()},U.prototype.initHeartbeatListener=function(){var B,k,V,G,q,z,$,re=this;(B=this.heartbeatProcessor)===null||B===void 0||B.on("pcReconnect",function(ee){re.emit("pcReconnect",ee)}),(k=this.heartbeatProcessor)===null||k===void 0||k.on("streamError",function(ee){re.emit("streamError",ee)}),(V=this.heartbeatProcessor)===null||V===void 0||V.on("streamReconnect",function(ee){re.emit("streamReconnect",ee)}),(G=this.heartbeatProcessor)===null||G===void 0||G.on("traceIdUpdate",function(ee){re.emit("traceIdUpdate",ee)}),(q=this.heartbeatProcessor)===null||q===void 0||q.on("hebtReceived",function(ee){if(ee){var ie=re.heartbeatTimelineMap.get(ee.msg_id)||0;re.heartbeatTimelineMap.delete(ee.msg_id),re.hebtLog("<<< Received: heartbeat","".concat(Math.ceil(performance.now()-ie),"ms"),ee)}re.emit("hebtReceived",ee)}),(z=this.heartbeatProcessor)===null||z===void 0||z.on("datachannelNotEnabled",function(){re.emit("datachannelNotEnabled")}),($=this.signal)===null||$===void 0||$.getDatachannelCore().on("message",function(ee){var ie;(ie=re.heartbeatProcessor)===null||ie===void 0||ie.process(ee)})},U.prototype.initNotifyListener=function(){var B,k,V,G=this;(B=this.notifyProcessor)===null||B===void 0||B.on("pcReconnect",function(q){G.emit("pcReconnect",q)}),(k=this.notifyProcessor)===null||k===void 0||k.on("message",function(q){G.emit("message",q)}),(V=this.signal)===null||V===void 0||V.getDatachannelCore().on("message",function(q){var z;(z=G.notifyProcessor)===null||z===void 0||z.process(q)})},U.prototype.findNewSubPubMids=function(B,k){var V=new l.SdpUtil({sdp:B}),G=new l.SdpUtil({sdp:k}),q=V.detail.media.filter(function($){return $.direction!=="inactive"}).map(function($){return $.mid}),z=G.detail.media.map(function($){return $.mid});return this.findDiff(q,z).map(function($){return String($)})},U.prototype.findDiff=function(B,k){return Array.from(new Set(s([],B,!0).filter(function(V){return!k.includes(V)})))},U.prototype.parseMsidString=function(B){var k={stream:"",track:""};if(!B)return k;var V=B.trim().split(" "),G=V[0],q=V[1];return q?(k.stream=G,k.track=q):k.track=G,k},U.prototype.stringifyMsid=function(B){var k=B.stream,V=B.track;return"".concat(k).concat(k?" ":"").concat(V)},U.prototype.restorePublishedSsrc=function(B){var k=new l.SdpUtil({sdp:this.prevOfferSdp||""}).getPublishSsrcs();B.detail.media.forEach(function(V){var G;V.direction!=="recvonly"&&((G=V.ssrcs)===null||G===void 0||G.forEach(function(q){var z,$=(z=k.find(function(re){return re.mid===String(V.mid)}))===null||z===void 0?void 0:z.ssrc;$&&(q.id=String($))}))})},U.prototype.restorePublishMsid=function(B){var k=this,V=new l.SdpUtil({sdp:this.prevOfferSdp||""}).getPublishMsids();V?.length&&B.detail.media.forEach(function(G){var q,z;if(G.direction!=="recvonly"){var $=(q=V.find(function(ee){return ee.mid===String(G.mid)}))===null||q===void 0?void 0:q.msid;if(!$)return;var re=k.parseMsidString($);G.msid=$||G.msid,(z=G.ssrcs)===null||z===void 0||z.forEach(function(ee){switch(ee.attribute){case"cname":ee.value=re.track||ee.value;break;case"msid":ee.value=$||ee.value}})}})},U.prototype.alignAnswerMidsWithOffer=function(B){var k=new l.SdpUtil({sdp:this.prevOfferSdp||""}).detail.media.map(function(z){return String(z.mid)}),V=B.detail.media.map(function(z){return String(z.mid)}),G=this.findDiff(V,k);B.removeMedia(G);var q=[];k.forEach(function(z){var $=B.detail.media.find(function(re){return String(re.mid)===z});$&&q.push($)}),B.detail.media=q.filter(function(z){return z})},U.prototype.simulateOfferAnswer=function(B){var k,V,G;return r(this,void 0,void 0,function(){var q,z,$,re,ee,ie,se,ce,ue,de,pe,Ee,he;return n(this,function(fe){switch(fe.label){case 0:return fe.trys.push([0,2,,3]),[4,(k=this.pc)===null||k===void 0?void 0:k.createOffer()];case 1:return q=fe.sent(),z=new l.SdpUtil({sdp:q?.sdp||""}),$=z.detail.media.filter(function(me){return me.direction==="inactive"}).map(function(me){return String(me.mid)}),this.restorePublishedSsrc(z),this.restorePublishMsid(z),this.prevOfferSdp=z.generate(),(re=new l.SdpUtil({sdp:this.prevAnswerSdp||""})).setMediaInactive($),B&&(ee=(0,l.generateFakeMediaSdpAnswer)(B))&&(ie=new l.SdpUtil({sdp:ee}),se=s([],ie.detail.media,!0),re.addOrUpdateMedia(se),this.alignAnswerMidsWithOffer(re)),ce=re.generate(),this.setPrevAnswerSdp(ce),[3,3];case 2:throw ue=fe.sent(),new h.RtsError(o.ErrorCode.DATACHANNEL_CREATE_OFFER_ERROR,"CreateOffer error: ".concat(ue),"",{pc:this.pc});case 3:if(de=this.avoidMsidConflict(this.prevOfferSdp),this.offerSdpHook)try{de=this.offerSdpHook(de)}catch(me){console.log("offerSdoHook error: ",me)}fe.label=4;case 4:return fe.trys.push([4,6,,7]),[4,(V=this.pc)===null||V===void 0?void 0:V.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:de}))];case 5:return fe.sent(),[3,7];case 6:throw pe=fe.sent(),new h.RtsError(o.ErrorCode.DATACHANNEL_SET_OFFER_ERROR,"SetLocalDescription error: ".concat(pe),"",{sdp:this.prevOfferSdp});case 7:if(fe.trys.push([7,10,,11]),!this.prevAnswerSdp)return[3,9];if(Ee=this.avoidMsidConflict(this.prevAnswerSdp),this.answerSdpHook)try{Ee=this.answerSdpHook(Ee)}catch(me){console.log("answerSdpHook error: ",me)}return[4,(G=this.pc)===null||G===void 0?void 0:G.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:Ee}))];case 8:fe.sent(),fe.label=9;case 9:return[3,11];case 10:throw he=fe.sent(),new h.RtsError(o.ErrorCode.DATACHANNEL_SET_ANSWER_ERROR,"SetRemoteDescription error: ".concat(he),"",{sdp:this.prevAnswerSdp});case 11:return[2]}})})},U.prototype.avoidMsidConflict=function(B){var k=new l.SdpUtil({sdp:B});return k.mungleMsid(),k.generate()},U.prototype.setCodecPreferences=function(B,k){if(k)try{B.setCodecPreferences(k)}catch(V){console.warn("setCodecPreferences error",V)}},U.prototype.log=function(){for(var B=[],k=0;k<arguments.length;k++)B[k]=arguments[k];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,s(["[PC-Core]"],B,!1))},U.prototype.hebtLog=function(){for(var B,k,V=[],G=0;G<arguments.length;G++)V[G]=arguments[G];window.RTS_HEBT_DEBUG&&console.log.apply(console,s(["".concat(this.now()," [datachannel|").concat((B=this.signal)===null||B===void 0?void 0:B.getDatachannelCore().label,"|").concat((k=this.signal)===null||k===void 0?void 0:k.getDatachannelCore().id,"]")],V,!1))},U.prototype.now=function(){var B=new Date;return"".concat(B.getHours(),":").concat(B.getMinutes(),":").concat(B.getSeconds(),".").concat(String(B.getMilliseconds()).padStart(3,"0"))},U}(C.default);f.PeerConnectionCore=H},651:function(S,f,a){var d,p=this&&this.__extends||(d=function(_,h){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,g){o.__proto__=g}||function(o,g){for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(o[m]=g[m])},d(_,h)},function(_,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function o(){this.constructor=_}d(_,h),_.prototype=h===null?Object.create(h):(o.prototype=h.prototype,new o)}),e=this&&this.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(f,"__esModule",{value:!0}),f.DataChannelCore=f.EDatachannelStatus=void 0;var r,n=a(844),s=a(961),t=a(854),i=e(a(885)),l=e(a(973));function E(){}(function(_){_[_.DATACHANNEL_STATUS_CLOSE=0]="DATACHANNEL_STATUS_CLOSE",_[_.DATACHANNEL_STATUS_OPEN=1]="DATACHANNEL_STATUS_OPEN"})(r=f.EDatachannelStatus||(f.EDatachannelStatus={}));var b=function(_){function h(o){var g=_.call(this)||this;return g.pendingPromiseMap=new Map,g.mutexSendData=!1,g.timerSendData=null,g.eventQueue=new t.CacheBuffer("send tasks"),g.datachannelList=[],g.pc=o.pc,g.eventHandler=o.onDatachannelEvent||E,g.datachannelList=o.datachannelList||[],g.createDatachannel(o.label,o.assignId),g}return p(h,_),h.prototype.getWebrtcDatachannel=function(){return this.datachannel},h.prototype.getNextId=function(){var o=0,g=this.datachannelList.reduce(function(m,T){return T.readyState==="open"?m+1:(o||(o=T.id),m)},0);return o||2*(g+1)},h.prototype.createDatachannel=function(o,g){var m=this,T={ordered:!0};g&&this.pc.connectionState==="connected"&&(T.id=this.getNextId()),this.datachannel=this.pc.createDataChannel(o||"GRTN_RTC_DATACHANNEL"+"_".concat(Date.now()),T),this.datachannel.addEventListener("open",function(){setTimeout(function(){m.eventHandler(r.DATACHANNEL_STATUS_OPEN),m.emit("statusChange",r.DATACHANNEL_STATUS_OPEN)},200)}),this.datachannel.addEventListener("close",function(){m.eventHandler(r.DATACHANNEL_STATUS_CLOSE),m.emit("statusChange",r.DATACHANNEL_STATUS_CLOSE)}),this.datachannel.addEventListener("closing",function(){}),this.datachannel.addEventListener("error",function(C){console.log(">> error",C),m.emit("error",C)}),this.datachannel.addEventListener("bufferedamountlow",function(){}),this.datachannel.addEventListener("message",function(C){m.emit("message",C.data)})},Object.defineProperty(h.prototype,"id",{get:function(){return this.datachannel.id},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"label",{get:function(){return this.datachannel.label},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"readyState",{get:function(){return this.datachannel.readyState},enumerable:!1,configurable:!0}),h.prototype.send=function(o){if(this.datachannel.readyState!=="open")throw new Error("Datachannel(label:".concat(this.datachannel.label,",id:").concat(this.datachannel.id,") is closed."));return this.datachannel.send(o)},h.prototype.sendAsync=function(o){if(this.datachannel.readyState==="open")return this.datachannel.send(JSON.stringify(o)),!0;console.log("Async signal message failed. Datachannel(label:".concat(this.datachannel.label,",id:").concat(this.datachannel.id,") is closed."))},h.prototype.sendData=function(o){var g=this;return new Promise(function(m,T){var C=new l.default(g.datachannel);if(g.mutexSendData){var D={sender:C,res:m,rej:T,data:o};g.eventQueue.cache(D)}else g.atomSend(C,m,T,o)})},h.prototype.dispose=function(){var o;this.emit("dispose"),this.mutexSendData=!1,this.timerSendData!==null&&clearTimeout(this.timerSendData),this.timerSendData=null,this.eventQueue=new t.CacheBuffer("send tasks"),(o=this.datachannel)===null||o===void 0||o.close()},h.prototype.atomSend=function(o,g,m,T){var C=this;this.mutexSendData=!0,o.on("onSendDataDone",function(){if(C.timerSendData!==null&&clearTimeout(C.timerSendData),C.timerSendData=null,C.mutexSendData=!1,!C.eventQueue.isEmpty()){var D=C.eventQueue.getFirst();C.atomSend(D.sender,D.res,D.rej,D.data)}}),this.timerSendData=setTimeout(function(){m(new s.RtsError(n.ErrorCode.DATACHANNEL_TIMEOUT_ERROR,"request timeout after ".concat(h.REQUEST_TIMEOUT,"ms"),"",T)),C.timerSendData=null,C.mutexSendData=!1,o.emit("onSendDataDone")},h.REQUEST_TIMEOUT),o.sendingProcess(g,m,T)},h.REQUEST_TIMEOUT=5e3,h}(i.default);f.DataChannelCore=b},973:function(S,f,a){var d,p=this&&this.__extends||(d=function(b,_){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,o){h.__proto__=o}||function(h,o){for(var g in o)Object.prototype.hasOwnProperty.call(o,g)&&(h[g]=o[g])},d(b,_)},function(b,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");function h(){this.constructor=b}d(b,_),b.prototype=_===null?Object.create(_):(h.prototype=_.prototype,new h)}),e=this&&this.__spreadArray||function(b,_,h){if(h||arguments.length===2)for(var o,g=0,m=_.length;g<m;g++)!o&&g in _||(o||(o=Array.prototype.slice.call(_,0,g)),o[g]=_[g]);return b.concat(o||Array.prototype.slice.call(_))},r=this&&this.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(f,"__esModule",{value:!0}),f.EDatachannelSignalResCode=f.EMessageType=void 0;var n,s,t=a(844),i=a(961),l=r(a(885));(function(b){b.HEBT="hebt",b.NOTI="NOTI"})(n=f.EMessageType||(f.EMessageType={})),function(b){b[b.NGX_RTC_PUBLISH_ALREADY=402]="NGX_RTC_PUBLISH_ALREADY",b[b.NGX_RTC_REQUEST_FORBIDDEN=403]="NGX_RTC_REQUEST_FORBIDDEN",b[b.NGX_RTC_STREAM_NO_FOUND=404]="NGX_RTC_STREAM_NO_FOUND",b[b.NGX_RTC_SUBSCRIBE_ALREADY=410]="NGX_RTC_SUBSCRIBE_ALREADY",b[b.NGX_RTC_NORMAL_CLOSED=200]="NGX_RTC_NORMAL_CLOSED",b[b.NGX_RTC_LIMITED=508]="NGX_RTC_LIMITED",b[b.NGX_RTC_INTERNAL_SERVER_ERROR=500]="NGX_RTC_INTERNAL_SERVER_ERROR",b[b.NGX_RTC_BAD_REQUEST=400]="NGX_RTC_BAD_REQUEST",b[b.NGX_RTC_NEED_RETRY=213]="NGX_RTC_NEED_RETRY",b[b.NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND=130]="NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND"}(s=f.EDatachannelSignalResCode||(f.EDatachannelSignalResCode={}));var E=function(b){function _(h){var o=b.call(this)||this;return o.datachannel=h,o}return p(_,b),_.prototype.sendingProcess=function(h,o,g){var m,T=this,C=performance.now();this.datachannel.onmessage=function(D){try{var y=JSON.parse(D.data),A=T.checkResponse(y);if(A.ignore)return;if(T.log("<<< Received:","".concat(Math.ceil(performance.now()-C),"ms"),y),A.pass)h(y);else{if(A.code===s.NGX_RTC_NEED_RETRY)return void setTimeout(function(){T.log(">>> Send:",g),T.datachannel.send(JSON.stringify(g))},200);o(new i.RtsError(t.ErrorCode.DATACHANNEL_RESPONSE_ERROR,"[code]".concat(A.code,"; [msg]").concat(A.msg),A.traceId,{parsedData:y}))}}catch(w){o(new i.RtsError(t.ErrorCode.DATACHANNEL_PARSE_ERROR,"datachannel message parse error","",{data:D.data,err:w}))}T.emit("onSendDataDone")};try{this.log(">>> Sent:","".concat(g.type,"-").concat(!((m=g.streams)===null||m===void 0)&&m.length?g.streams[0].method:"-"),g)}catch{}this.datachannel.send(JSON.stringify(g))},_.prototype.checkResponse=function(h){var o={pass:!0,ignore:!1,code:0,msg:"",traceId:""};if([n.HEBT,n.NOTI].includes(h.type))return o.ignore=!0,o.pass=!1,o;h.recode!==0&&(o.pass=!1,o.code=h.recode,o.msg=h.msg);var g=h.streams;return g&&g.length>0&&g.forEach(function(m){m.res_code!==200&&(o.pass=!1,o.code=m.res_code,o.msg=m.res_msg,o.traceId=m.traceid)}),o},_.prototype.log=function(){for(var h=[],o=0;o<arguments.length;o++)h[o]=arguments[o];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,e(["".concat(this.now()," [datachannel|").concat(this.datachannel.label,"|").concat(this.datachannel.id,"]")],h,!1))},_.prototype.now=function(){var h=new Date;return"".concat(h.getHours(),":").concat(h.getMinutes(),":").concat(h.getSeconds(),".").concat(String(h.getMilliseconds()).padStart(3,"0"))},_}(l.default);f.default=E},844:(S,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.ErrorCode=void 0,function(a){a[a.DATACHANNEL_SIGNAL_ERROR=15e3]="DATACHANNEL_SIGNAL_ERROR",a[a.DATACHANNEL_SET_OFFER_ERROR=15001]="DATACHANNEL_SET_OFFER_ERROR",a[a.DATACHANNEL_SET_ANSWER_ERROR=15002]="DATACHANNEL_SET_ANSWER_ERROR",a[a.DATACHANNEL_CREATE_OFFER_ERROR=15003]="DATACHANNEL_CREATE_OFFER_ERROR",a[a.DATACHANNEL_RESPONSE_ERROR=15004]="DATACHANNEL_RESPONSE_ERROR",a[a.DATACHANNEL_PARSE_ERROR=15005]="DATACHANNEL_PARSE_ERROR",a[a.DATACHANNEL_TIMEOUT_ERROR=15006]="DATACHANNEL_TIMEOUT_ERROR",a[a.CORE_NO_PC_ERROR=15007]="CORE_NO_PC_ERROR",a[a.CORE_PUBLIST_EXCEED_ERROR=15008]="CORE_PUBLIST_EXCEED_ERROR",a[a.CORE_PUB_REPLACE_URL_NOT_FOUND=15009]="CORE_PUB_REPLACE_URL_NOT_FOUND",a[a.CORE_TRANSCEIVERS_NOT_FOUND=15010]="CORE_TRANSCEIVERS_NOT_FOUND"}(f.ErrorCode||(f.ErrorCode={}))},961:(S,f,a)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.RtsError=void 0;var d=a(844);f.RtsError=function(p,e,r,n){this.errorCode=p,this.errorCodeName=d.ErrorCode[p],this.message=e,this.traceId=r,n&&(this.extraInfo=n)}},854:(S,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.CacheBuffer=void 0;var a=function(){function d(p){this.data=[],this.tag=p||"unknown",this.maxBufferLength=90}return d.prototype.setMaxCapacity=function(p){this.maxBufferLength=90,p>=0&&(this.maxBufferLength=p),this.maxBufferLength>200&&(this.maxBufferLength=200)},d.prototype.cache=function(p){this.data.length>this.maxBufferLength&&(this.data.shift(),console.log(this.tag+" CACHE: Reach Max Capacity")),this.data.push(p)},d.prototype.getFirst=function(){return this.data.shift()},d.prototype.isEmpty=function(){return this.data.length<=0},d}();f.CacheBuffer=a},885:(S,f)=>{Object.defineProperty(f,"__esModule",{value:!0});var a=function(){function d(){this._eventMap={}}return d.prototype.listeners=function(p){return this._eventMap[p]||[]},d.prototype.emit=function(p){for(var e=this,r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var s=this._eventMap[p];return!!Array.isArray(s)&&(s.forEach(function(t){return t.apply(e,r)}),!0)},d.prototype.off=function(p,e){var r=this._eventMap[p];return Array.isArray(r)&&(this._eventMap[p]=r.filter(function(n){return n!==e})),this},d.prototype.removeAllListeners=function(p){return p===void 0?this._eventMap={}:this._eventMap[p]&&(this._eventMap[p]=[]),this},d.prototype.on=function(p,e){return this._eventMap[p]?this._eventMap[p].push(e):this._eventMap[p]=[e],this},d.prototype.once=function(p,e){var r=this,n=function(){for(var s=[],t=0;t<arguments.length;t++)s[t]=arguments[t];r.off(p,n),e.apply(r,s)};return this.on(p,n),this},d}();f.default=a},887:(S,f)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.intersection=f.pruneSubUrl=f.parseUrlSubParams=void 0,f.parseUrlSubParams=function(a){var d={subVideo:!0,subAudio:!0};return a&&(a.includes("@subvideo=no")&&(d.subVideo=!1),a.includes("@subaudio=no")&&(d.subAudio=!1)),d},f.pruneSubUrl=function(a,d){var p=a||"";return p=p.replace("@subaudio=no","").replace("@subvideo=no",""),d&&(p=p.split("?")[0]),p},f.intersection=function(a,d){return a.filter(function(p){return d.includes(p)})}},390:function(S,f){var a=this&&this.__spreadArray||function(p,e,r){if(r||arguments.length===2)for(var n,s=0,t=e.length;s<t;s++)!n&&s in e||(n||(n=Array.prototype.slice.call(e,0,s)),n[s]=e[s]);return p.concat(n||Array.prototype.slice.call(e))};Object.defineProperty(f,"__esModule",{value:!0}),f.Logger=void 0;var d=function(){function p(e){this.switchName=e.switchName,this.displayName=e.displayName}return p.prototype.log=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];window[this.switchName||Math.random()]&&console.log.apply(console,a(["".concat(this.now()," [").concat(this.displayName,"]")],e,!1))},p.prototype.now=function(){var e=new Date;return"".concat(this.padStart(e.getHours()),":").concat(this.padStart(e.getMinutes()),":").concat(this.padStart(e.getSeconds()),".").concat(this.padStart(e.getMilliseconds(),3))},p.prototype.padStart=function(e,r,n){return r===void 0&&(r=2),n===void 0&&(n="0"),String(e).padStart(r,n)},p}();f.Logger=d},248:function(S,f,a){var d=this&&this.__assign||function(){return d=Object.assign||function(n){for(var s,t=1,i=arguments.length;t<i;t++)for(var l in s=arguments[t])Object.prototype.hasOwnProperty.call(s,l)&&(n[l]=s[l]);return n},d.apply(this,arguments)},p=this&&this.__spreadArray||function(n,s,t){if(t||arguments.length===2)for(var i,l=0,E=s.length;l<E;l++)!i&&l in s||(i||(i=Array.prototype.slice.call(s,0,l)),i[l]=s[l]);return n.concat(i||Array.prototype.slice.call(s))};Object.defineProperty(f,"__esModule",{value:!0}),f.generateFakeMediaSdpAnswer=f.SdpUtil=void 0;var e=a(766),r=function(){function n(s){if(this.rawSdp=s.sdp,!s.sdp)throw new Error("No sdp to parse");this.sdpDetail=this.parse()}return Object.defineProperty(n.prototype,"detail",{get:function(){return this.sdpDetail},enumerable:!1,configurable:!0}),n.prototype.removeMedia=function(s){return this.removeMediaInner(s)},n.prototype.keepMedia=function(s){return this.removeMediaInner(s,{revert:!0})},n.prototype.removeMediaInner=function(s,t){t===void 0&&(t={revert:!1}),s.length&&this.sdpDetail.media&&this.sdpDetail.media.length&&(t.revert?this.sdpDetail.media=this.sdpDetail.media.filter(function(i){return s.includes(String(i.mid)||"")}):this.sdpDetail.media=this.sdpDetail.media.filter(function(i){return!s.includes(String(i.mid)||"")}),this.updateBundle())},n.prototype.addOrUpdateMedia=function(s,t){t===void 0&&(t={}),s=s.map(function(l){return d(d({},l),{setup:"passive"})});var i=[];this.sdpDetail.media=this.sdpDetail.media.map(function(l){var E=s.find(function(h){return h.mid===l.mid});if(E){i.push(l.mid);var b=E,_=l;return t.isPublish&&(b.ssrcs=_.ssrcs,b.ssrcGroups=_.ssrcGroups),E}return l}),this.sdpDetail.media=p(p([],this.sdpDetail.media,!0),s.filter(function(l){return!i.includes(l.mid)}),!0),this.updateBundle()},n.prototype.mungleMsid=function(){this.sdpDetail.media.forEach(function(s){if(s.msid){var t="";s.msid=s.msid.split(" ").map(function(i,l){return l===1?(t=i,i+"_"+s.mid):i}).join(" "),t&&s.ssrcs&&s.ssrcs.forEach(function(i){i.value&&(i.value=i.value.replace(t,t+"_"+s.mid))})}})},n.prototype.addMedia=function(s){var t;s=s.map(function(E){return d(d({},E),{setup:"passive"})}),this.sdpDetail.media=p(p([],this.sdpDetail.media,!0),s,!0);var i=s.reduce(function(E,b){return E+" "+b.mid},""),l=(t=this.sdpDetail.groups)===null||t===void 0?void 0:t.find(function(E){return E.type==="BUNDLE"});l&&(l.mids+="".concat(i))},n.prototype.setMediaInactive=function(s){this.sdpDetail.media.forEach(function(t){s.includes(String(t.mid))&&(t.direction="inactive")}),this.updateBundle()},n.prototype.getPublishSsrcs=function(){var s=[];return this.sdpDetail.media.forEach(function(t){t.direction!=="recvonly"&&t.ssrcs&&s.push({type:t.type,ssrc:t.ssrcs[0].id||"ERR_NOT_FOUND",mid:String(t.mid)})}),s},n.prototype.getPublishMsids=function(){var s=[];return this.sdpDetail.media.forEach(function(t){t.direction!=="recvonly"&&t.msid&&s.push({type:t.type,msid:t.msid,mid:String(t.mid)})}),s},n.prototype.generate=function(){return(0,e.write)(this.sdpDetail)},n.prototype.updateBundle=function(){var s,t=(s=this.sdpDetail.groups)===null||s===void 0?void 0:s.find(function(i){return i.type==="BUNDLE"});t&&(t.mids=this.sdpDetail.media.reduce(function(i,l){return i+l.mid+" "},"").trim())},n.prototype.addNack=function(){this.sdpDetail.media.forEach(function(s){var t,i,l;if(s.type==="audio"){if(!((t=s.rtcpFb)===null||t===void 0)&&t.some(function(b){return b.type==="nack"}))return;var E=(i=s.rtp.find(function(b){return b.codec==="opus"}))===null||i===void 0?void 0:i.payload;E&&((l=s.rtcpFb)===null||l===void 0||l.push({payload:E,type:"nack"}))}})},n.prototype.parse=function(){var s=(0,e.parse)(this.rawSdp);return this.patchMsid(s)},n.prototype.getMids=function(s){return s?.length?s.reduce(function(t,i){return p(p([],t,!0),[String(i.mid)],!1)},[]):[]},n.prototype.patchMsid=function(s){return s.media.forEach(function(t){var i,l;t.type==="application"||t.msid||(t.msid=(l=(i=t.ssrcs)===null||i===void 0?void 0:i.find(function(E){return E.attribute==="msid"}))===null||l===void 0?void 0:l.value)}),s},n}();f.SdpUtil=r,f.generateFakeMediaSdpAnswer=function(n){if(!n.mids.length||!n.medias.length||n.mids.length!==n.medias.length)return"";var s=`v=0
25
25
  o=- 1710852399 2 IN IP4 127.0.0.1
26
26
  s=-
27
27
  t=0 0
@@ -74,7 +74,7 @@ a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time`),h=`
74
74
  a=ssrc:`.concat(b,` cname:defaultcname
75
75
  a=ssrc:`).concat(b," msid:").concat(_,`
76
76
  a=ssrc:`).concat(b,` mslabel:rts
77
- a=ssrc:`).concat(b," label:audio"),n.direction==="sub"&&(s+=h),s+=t)}),s}},237:(S,f,a)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.UrlData=void 0;var d=a(887),p=function(){function e(r){var n=(0,d.parseUrlSubParams)(r.url);this.data={url:r.url,subAudio:n.subAudio,subVideo:n.subVideo},typeof r.subAudio=="boolean"&&(this.data.subAudio=r.subAudio),typeof r.subVideo=="boolean"&&(this.data.subVideo=r.subVideo)}return Object.defineProperty(e.prototype,"subVideo",{get:function(){return this.data.subVideo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subAudio",{get:function(){return this.data.subAudio},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return(0,d.pruneSubUrl)(this.data.url)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"originalUrl",{get:function(){return this.data.url},enumerable:!1,configurable:!0}),e}();f.UrlData=p},123:function(S,f,a){var d,p=this&&this.__extends||(d=function(l,E){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,_){b.__proto__=_}||function(b,_){for(var h in _)Object.prototype.hasOwnProperty.call(_,h)&&(b[h]=_[h])},d(l,E)},function(l,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");function b(){this.constructor=l}d(l,E),l.prototype=E===null?Object.create(E):(b.prototype=E.prototype,new b)}),e=this&&this.__spreadArray||function(l,E,b){if(b||arguments.length===2)for(var _,h=0,o=E.length;h<o;h++)!_&&h in E||(_||(_=Array.prototype.slice.call(E,0,h)),_[h]=E[h]);return l.concat(_||Array.prototype.slice.call(E))},r=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(f,"__esModule",{value:!0});var n=r(a(885)),s=a(973),t=[s.EDatachannelSignalResCode.NGX_RTC_STREAM_NO_FOUND,s.EDatachannelSignalResCode.NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND],i=function(l){function E(b,_){var h=l.call(this)||this;return h.datachannel=b,h.streamManager=_,h}return p(E,l),E.prototype.process=function(b){var _=this,h=this.parseFormat(b);if(h){var o=this.checkRecode(h),g=o.valid,m=o.error,T=o.reason;if(!g)return h.recode===3?void this.emit("datachannelNotEnabled"):void(m&&this.emit("pcReconnect",{recode:h.recode,reMsg:T}));this.emit("hebtReceived",h),this.checkStreams(h).forEach(function(C){var D={resCode:C.resCode,resMsg:C.resMsg,url:C.url,msids:C.msids,streams:C.streams,type:C.type,latestUrl:C.latestUrl};C.isReconnectable?_.emit("streamReconnect",D):_.emit("streamError",D)})}},E.prototype.parseFormat=function(b){try{return JSON.parse(b)}catch{console.log("Heartbeat parse failed."," Response Data: ",b)}},E.prototype.checkRecode=function(b){var _={valid:!1,error:!1,reason:""};return b.type!==s.EMessageType.HEBT?(_.reason="not heartbeat signal, ignore",_):b.recode!==0?(_.reason=b.msg,_.error=!0,_):(_.valid=!0,_)},E.prototype.checkStreams=function(b){var _=this,h=[];return b.streams&&b.streams.length&&e(e([],this.streamManager.getAllStreamListWithMsids(),!0),this.streamManager.getAllDatachannelList(),!0).forEach(function(o){var g,m=-1;if(b.streams.find(function(y,A){if(y.url===o.url)return m=A,!0})&&m!==-1){var T=b.streams[m];if(T.method===s.EMessageType.HEBT&&T.res_code===200){T.traceid&&_.emit("traceIdUpdate",{url:T.url,traceId:T.traceid});var C=[];o.msids.forEach(function(y){T.msid.find(function(A){return A.name===y.name})||C.push(y)});var D=(g=o.streams)===null||g===void 0?void 0:g.filter(function(y){return!!C.find(function(A){return A.streamId===y.id})});C.length&&h.push({url:o.url,msids:C,streams:D,isReconnectable:!0,resMsg:"RTS heartbeat msid mismatch",resCode:404,type:o.type,latestUrl:o.latestUrl})}else h.push({url:o.url,msids:o.msids,streams:o.streams,isReconnectable:_.isReconnectableErrorCode(T.res_code),resMsg:T.res_msg,resCode:T.res_code,type:o.type,latestUrl:o.latestUrl})}}),h},E.prototype.isReconnectableErrorCode=function(b){return t.includes(b)},E}(n.default);f.default=i},619:function(S,f,a){var d=this&&this.__assign||function(){return d=Object.assign||function(b){for(var _,h=1,o=arguments.length;h<o;h++)for(var g in _=arguments[h])Object.prototype.hasOwnProperty.call(_,g)&&(b[g]=_[g]);return b},d.apply(this,arguments)},p=this&&this.__awaiter||function(b,_,h,o){return new(h||(h=Promise))(function(g,m){function T(y){try{D(o.next(y))}catch(A){m(A)}}function C(y){try{D(o.throw(y))}catch(A){m(A)}}function D(y){var A;y.done?g(y.value):(A=y.value,A instanceof h?A:new h(function(O){O(A)})).then(T,C)}D((o=o.apply(b,_||[])).next())})},e=this&&this.__generator||function(b,_){var h,o,g,m,T={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return m={next:C(0),throw:C(1),return:C(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function C(D){return function(y){return function(A){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,A[0]&&(T=0)),T;)try{if(h=1,o&&(g=2&A[0]?o.return:A[0]?o.throw||((g=o.return)&&g.call(o),0):o.next)&&!(g=g.call(o,A[1])).done)return g;switch(o=0,g&&(A=[2&A[0],g.value]),A[0]){case 0:case 1:g=A;break;case 4:return T.label++,{value:A[1],done:!1};case 5:T.label++,o=A[1],A=[0];continue;case 7:A=T.ops.pop(),T.trys.pop();continue;default:if(!((g=(g=T.trys).length>0&&g[g.length-1])||A[0]!==6&&A[0]!==2)){T=0;continue}if(A[0]===3&&(!g||A[1]>g[0]&&A[1]<g[3])){T.label=A[1];break}if(A[0]===6&&T.label<g[1]){T.label=g[1],g=A;break}if(g&&T.label<g[2]){T.label=g[2],T.ops.push(A);break}g[2]&&T.ops.pop(),T.trys.pop();continue}A=_.call(b,T)}catch(O){A=[6,O],o=0}finally{h=g=0}if(5&A[0])throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}([D,y])}}},r=this&&this.__spreadArray||function(b,_,h){if(h||arguments.length===2)for(var o,g=0,m=_.length;g<m;g++)!o&&g in _||(o||(o=Array.prototype.slice.call(_,0,g)),o[g]=_[g]);return b.concat(o||Array.prototype.slice.call(_))};Object.defineProperty(f,"__esModule",{value:!0}),f.Signal=void 0;var n,s,t,i=a(651),l=a(887);(function(b){b.Sub="sub",b.Pub="pub",b.Hebt="hebt"})(n||(n={})),function(b){b.Add="add",b.Active="active",b.Stop="stop",b.Delete="delete",b.Hebt="hebt"}(s||(s={})),function(b){b.Audio="audio",b.Video="video",b.Data="data"}(t||(t={}));var E=function(){function b(_){this.latestMsgId=0,this.latestSubAddMsgId=0,this.pc=_.pc,this.datachannel=new i.DataChannelCore({pc:this.pc,onDatachannelEvent:_.onDatachannelEvent})}return b.prototype.getDatachannelCore=function(){return this.datachannel},b.prototype.subscribeAdd=function(_,h,o){var g;return p(this,void 0,void 0,function(){var m;return e(this,function(T){switch(T.label){case 0:return m=d(d({},this.baseParams({type:n.Sub,method:s.Add})),{streams:_.map(function(C,D){var y=C.urlData,A=[];return y.subAudio&&!o.isMsidSubPubDone(y.url,{aMsid:C.aMsid[0]})&&A.push({type:t.Audio,name:C.aMsid[0]}),y.subVideo&&!o.isMsidSubPubDone(y.url,{vMsid:C.vMsid[0]})&&A.push({type:t.Video,name:C.vMsid[0]}),{method:s.Add,url:y.url,msid:A,sdp:h[D],ttl:300}})}),[4,(g=this.datachannel)===null||g===void 0?void 0:g.sendData(m)];case 1:return[2,T.sent()]}})})},b.prototype.subscribeActive=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams({type:n.Sub,method:s.Active})),{streams:_.map(function(m){var T=m.urlData;return{method:s.Active,url:T.url}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return g.sent(),[2]}})})},b.prototype.subscribeDelete=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams()),{streams:_.map(function(m){var T=m.url,C=m.aMsid,D=m.vMsid,y=[];return C?.length&&(y=r(r([],y,!0),C.map(function(A){return{name:A}}),!0)),D?.length&&(y=r(r([],y,!0),D.map(function(A){return{name:A}}),!0)),{method:s.Delete,url:(0,l.pruneSubUrl)(T),msid:y}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.subscribeStop=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams()),{streams:_.map(function(m){var T=m.urlData;return{method:s.Stop,url:T.url}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.subscribeAddDatachannel=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams({type:n.Sub,method:s.Add})),{streams:_.map(function(m){var T=m.url,C=m.msid;return{method:s.Add,url:T,msid:[{type:t.Data,name:C}]}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.subscribeActiveDatachannel=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams({type:n.Sub,method:s.Active})),{streams:_.map(function(m){var T=m.url,C=m.datachannelId,D=m.msid;return{method:s.Active,url:T,msid:[{type:t.Data,name:D,channel:C}]}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.subscribeStopDatachannel=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams()),{streams:_.map(function(m){var T=m.url;return{method:s.Stop,url:T}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.publishAdd=function(_,h,o,g){var m;return p(this,void 0,void 0,function(){var T;return e(this,function(C){return T=d(d({},this.baseParams({type:n.Pub})),{streams:_.map(function(D,y){var A=o[y],O=g[y],j=[];return A.length&&j.push({type:"video",name:A[0].trim()}),O.length&&j.push({type:"audio",name:O[0].trim()}),{method:s.Add,url:D,msid:j,sdp:h[y]}})}),[2,(m=this.datachannel)===null||m===void 0?void 0:m.sendData(T)]})})},b.prototype.publishDelete=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){return o=d(d({},this.baseParams({type:n.Pub})),{streams:_.map(function(m){var T=m.url,C=m.aMsid,D=m.vMsid,y=[];return C?.length&&(y=r(r([],y,!0),C.map(function(A){return{name:A}}),!0)),D?.length&&(y=r(r([],y,!0),D.map(function(A){return{name:A}}),!0)),{method:s.Delete,url:(0,l.pruneSubUrl)(T),msid:y}})}),[2,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)]})})},b.prototype.publishStop=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){return o=d(d({},this.baseParams({type:n.Pub})),{streams:_.map(function(m){return{method:s.Stop,url:m}})}),[2,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)]})})},b.prototype.publishAddDatachannel=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams({type:n.Pub,method:s.Add})),{streams:_.map(function(m){var T=m.url,C=m.datachannelId,D=m.msid;return{method:s.Add,url:T,msid:[{type:t.Data,name:D,channel:C}]}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.publishStopDatachannel=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams({type:n.Pub})),{streams:_.map(function(m){var T=m.url;return{method:s.Stop,url:T}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.sendHeartbeat=function(_){_&&!_.map&&(_=void 0);var h=d(d({},this.baseParams({type:n.Hebt})),{streams:_?.map(function(o){var g=o.url;return{method:s.Hebt,url:g}})});if(_||delete h.streams,this.datachannel.sendAsync(h))return h},b.prototype.sendFalseHeartbeat=function(_){var h=d(d({},this.baseParams({type:n.Hebt})),{streams:_?.map(function(o){return{method:"fake",url:o.url}})});if(_||delete h.streams,this.datachannel.sendAsync(h))return h},b.prototype.dispose=function(){this.datachannel.dispose()},b.prototype.baseParams=function(_){_===void 0&&(_={type:n.Sub});var h=0;return _.type===n.Sub&&_.method===s.Add?(h=++this.latestMsgId,this.latestSubAddMsgId=this.latestMsgId):h=_.type===n.Sub&&_.method===s.Active?this.latestSubAddMsgId:++this.latestMsgId,{msg_id:h,version:2,type:_.type}},b}();f.Signal=E},125:function(S,f,a){var d,p=this&&this.__extends||(d=function(l,E){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,_){b.__proto__=_}||function(b,_){for(var h in _)Object.prototype.hasOwnProperty.call(_,h)&&(b[h]=_[h])},d(l,E)},function(l,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");function b(){this.constructor=l}d(l,E),l.prototype=E===null?Object.create(E):(b.prototype=E.prototype,new b)}),e=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(f,"__esModule",{value:!0}),f.NotifyProcessor=void 0;var r,n=a(973),s=e(a(885)),t=a(390);(function(l){l[l.NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION=1]="NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION",l[l.NGX_RTC_H5_ACCESS_IP_MIGRATION=2]="NGX_RTC_H5_ACCESS_IP_MIGRATION"})(r||(r={}));var i=function(l){function E(){var b=l.call(this)||this;return b.logger=new t.Logger({displayName:"NotifyProcessor",switchName:"RTS_NOTIFY_DEBUG"}),b}return p(E,l),E.prototype.process=function(b){var _,h;this.logger.log("======== processing notify message:",b," ========");var o=this.parseFormat(b);if(this.logger.log("parsedData",o),o)if(this.checkRelated(o)){this.emit("message",{message:o});var g=this.parseIP(o.notify_msg);!((_=g.pull)===null||_===void 0)&&_.length||!((h=g.push)===null||h===void 0)&&h.length?(console.warn("\u9700\u8981\u91CD\u8FDE",g),this.emit("pcReconnect",{ips:g})):this.logger.log("No valid ip found: ",o.notify_msg)}else this.logger.log("NotifyProcessor: Not related message, ignore.")},E.prototype.parseFormat=function(b){try{return JSON.parse(b)}catch{console.warn("Notify parse failed."," Response Data: ",b)}},E.prototype.checkRelated=function(b){return b.type===n.EMessageType.NOTI&&b.notify_type===r.NGX_RTC_H5_ACCESS_IP_MIGRATION},E.prototype.parseIP=function(b){b===void 0&&(b=""),this.logger.log("Paring IP string: ".concat(b));var _=b.split(";"),h=/^(?:\d{1,3}\.){3}\d{1,3}$/,o=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,g=/^(push|pull)_ips:(.*)$/,m={};return _.forEach(function(T){var C=g.exec(T);if(C){var D=C[1],y=C[2].split(",").filter(function(A){return h.test(A)||o.test(A)});m[D]=y}}),this.logger.log("Parsed IP:",m),m},E}(s.default);f.NotifyProcessor=i},132:function(S,f){var a=this&&this.__awaiter||function(r,n,s,t){return new(s||(s=Promise))(function(i,l){function E(h){try{_(t.next(h))}catch(o){l(o)}}function b(h){try{_(t.throw(h))}catch(o){l(o)}}function _(h){var o;h.done?i(h.value):(o=h.value,o instanceof s?o:new s(function(g){g(o)})).then(E,b)}_((t=t.apply(r,n||[])).next())})},d=this&&this.__generator||function(r,n){var s,t,i,l,E={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return l={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function b(_){return function(h){return function(o){if(s)throw new TypeError("Generator is already executing.");for(;l&&(l=0,o[0]&&(E=0)),E;)try{if(s=1,t&&(i=2&o[0]?t.return:o[0]?t.throw||((i=t.return)&&i.call(t),0):t.next)&&!(i=i.call(t,o[1])).done)return i;switch(t=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return E.label++,{value:o[1],done:!1};case 5:E.label++,t=o[1],o=[0];continue;case 7:o=E.ops.pop(),E.trys.pop();continue;default:if(!((i=(i=E.trys).length>0&&i[i.length-1])||o[0]!==6&&o[0]!==2)){E=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){E.label=o[1];break}if(o[0]===6&&E.label<i[1]){E.label=i[1],i=o;break}if(i&&E.label<i[2]){E.label=i[2],E.ops.push(o);break}i[2]&&E.ops.pop(),E.trys.pop();continue}o=n.call(r,E)}catch(g){o=[6,g],t=0}finally{s=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([_,h])}}},p=this&&this.__spreadArray||function(r,n,s){if(s||arguments.length===2)for(var t,i=0,l=n.length;i<l;i++)!t&&i in n||(t||(t=Array.prototype.slice.call(n,0,i)),t[i]=n[i]);return r.concat(t||Array.prototype.slice.call(n))};Object.defineProperty(f,"__esModule",{value:!0}),f.PeerConnectionRollbackController=void 0;var e=function(){function r(n){this.fakeSdpParams={direction:"sub",mids:[],medias:[]},this.pcCore=n}return r.prototype.setFakeSdpMids=function(n){this.fakeSdpParams.mids=n},r.prototype.setFakeSdpMedias=function(n,s){this.fakeSdpParams.medias=n,this.fakeSdpParams.direction=s},r.prototype.saveStreamManager=function(n){this.streamManager=n,this.streamManagerBackup=this.streamManager.doBackup()},r.prototype.rollback=function(n){return a(this,void 0,void 0,function(){var s;return d(this,function(t){switch(t.label){case 0:if(n?.trackListnerRollback&&(this.pcCore.removeTrackListener(),this.log("Sub Track Listener Removed")),n?.streamManagerRollback&&this.streamManagerBackup){this.pcCore.setStreamManager(this.streamManagerBackup);try{this.log("Stream Manager Restored",JSON.parse(JSON.stringify(this.streamManager)))}catch{}}if(n?.pcTransceiversRollback&&(this.fakeSdpParams.medias.forEach(function(i){var l;(l=i.trans)===null||l===void 0||l.receiver.track.stop()}),this.log("Sub Track(s) Stopped",this.fakeSdpParams.medias)),!n?.runSimulateSignal)return[3,4];this.log("SDP Simulating...",this.fakeSdpParams),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.pcCore.simulateOfferAnswer(this.fakeSdpParams)];case 2:return t.sent(),this.log("SDP Simulation Done"),[3,4];case 3:return s=t.sent(),this.log("SDP Simulation Failed",s),[3,4];case 4:return[2]}})})},r.prototype.log=function(){for(var n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,p(["[PC-Core-Rollback]"],n,!1))},r}();f.PeerConnectionRollbackController=e},628:function(S,f,a){var d=this&&this.__assign||function(){return d=Object.assign||function(s){for(var t,i=1,l=arguments.length;i<l;i++)for(var E in t=arguments[i])Object.prototype.hasOwnProperty.call(t,E)&&(s[E]=t[E]);return s},d.apply(this,arguments)},p=this&&this.__spreadArray||function(s,t,i){if(i||arguments.length===2)for(var l,E=0,b=t.length;E<b;E++)!l&&E in t||(l||(l=Array.prototype.slice.call(t,0,E)),l[E]=t[E]);return s.concat(l||Array.prototype.slice.call(t))};Object.defineProperty(f,"__esModule",{value:!0}),f.StreamManager=f.EStreamType=void 0;var e,r=a(887);(function(s){s.Subscribe="sub",s.Publish="pub"})(e=f.EStreamType||(f.EStreamType={}));var n=function(){function s(t){this.streamMap={},this.datachannelMap=new Map}return s.prototype.doBackup=function(){var t,i,l,E=new s;E.streamMap={};var b=function(o){var g=_.streamMap[o];if(g){var m=[],T=[],C=[];(t=g.streamList)===null||t===void 0||t.forEach(function(y){m.push(y)}),(i=g.videoInfoList)===null||i===void 0||i.forEach(function(y){var A={msid:y.msid,ssrc:y.ssrc,transceiver:y.transceiver,subDone:y.subDone,pubDone:y.pubDone,streamId:y.streamId,codec:y.codec,pt:y.pt,from:y.from,type:y.type};T.push(A)}),(l=g.audioInfoList)===null||l===void 0||l.forEach(function(y){y.msid,y.ssrc,y.transceiver,y.subDone,y.pubDone,y.streamId,y.codec,y.pt,y.from,y.type,C.push(y)});var D={type:g.type,streamList:m,videoInfoList:T,audioInfoList:C,originUrl:g.originUrl};E.streamMap[o]=D}},_=this;for(var h in this.streamMap)b(h);return E},s.prototype.init=function(t,i){i===void 0&&(i=e.Subscribe);var l=(0,r.pruneSubUrl)(t);t=(0,r.pruneSubUrl)(t,!0),this.has(t)||(this.streamMap[t]={type:i,videoInfoList:[],audioInfoList:[],streamList:[],originUrl:l})},s.prototype.remove=function(t){delete this.streamMap[(0,r.pruneSubUrl)(t,!0)]},s.prototype.update=function(t,i){var l=this.get(t);if(!l)throw new Error("No url found");if(i.aMsid){var E=l.audioInfoList.find(function(_){return _.msid===i.aMsid})||this.createMediaItem(i.aMsid,"audio");i.aTransceiver&&(E.transceiver=i.aTransceiver),i.stream&&(E.streamId=i.stream.id),this.updateMediaInfoList(E,l.audioInfoList)}if(i.vMsid){var b=l.videoInfoList.find(function(_){return _.msid===i.vMsid})||this.createMediaItem(i.vMsid,"video");i.vTransceiver&&(b.transceiver=i.vTransceiver),i.stream&&(b.streamId=i.stream.id),this.updateMediaInfoList(b,l.videoInfoList)}i.stream&&(l.streamList.some(function(_){return _.id===i.stream.id})||(l.streamList=p(p([],l.streamList,!0),[i.stream],!1)))},s.prototype.pruneStreamList=function(t){var i=this.get(t);i&&(i.streamList=i.streamList.filter(function(l){var E;return((E=l.mediaStream)===null||E===void 0?void 0:E.getTracks().length)>0}))},s.prototype.updateSdpInfo=function(t,i){var l,E=this.get(t);if(!E)throw new Error("No url found");if(i.aMsid?l=E.audioInfoList.find(function(b){return b.msid===i.aMsid}):i.vMsid&&(l=E.videoInfoList.find(function(b){return b.msid===i.vMsid})),!l)throw new Error("No target media found");l.ssrc=i.ssrc,l.codec=i.codec,l.pt=i.pt,l.from=i.from},s.prototype.get=function(t){return this.streamMap[(0,r.pruneSubUrl)(t,!0)]},s.prototype.has=function(t){return!!this.get(t)},s.prototype.getSize=function(){return this.getSubOrPubDoneMediaMapSize()+this.getDcMapSize()},s.prototype.getSubOrPubDoneMediaMapSize=function(){var t=this,i=0;return Object.keys(this.streamMap).forEach(function(l){var E=t.streamMap[l],b=!1;E.audioInfoList.forEach(function(_){b=b||E.type===e.Publish&&_.pubDone||E.type===e.Subscribe&&_.subDone}),E.videoInfoList.forEach(function(_){b=b||E.type===e.Publish&&_.pubDone||E.type===e.Subscribe&&_.subDone}),b&&i++}),i},s.prototype.getDcMapSize=function(){return this.datachannelMap.size},s.prototype.removeMsid=function(t,i){t=(0,r.pruneSubUrl)(t,!0);var l=this.get(t);l&&(i.vMsid&&(l.videoInfoList=l.videoInfoList.filter(function(E){return E.msid!==i.vMsid})),i.aMsid&&(l.audioInfoList=l.audioInfoList.filter(function(E){return E.msid!==i.aMsid})))},s.prototype.getMids=function(t,i){i===void 0&&(i={filterSubDone:!1}),t=(0,r.pruneSubUrl)(t,!0);var l=this.streamMap[t];return l?p(p([],l.audioInfoList.reduce(function(E,b){return b.transceiver&&(!i.filterSubDone||i.filterSubDone&&!b.subDone)?p(p([],E,!0),[String(b.transceiver.mid)],!1):E},[]),!0),l.videoInfoList.reduce(function(E,b){return b.transceiver&&(!i.filterSubDone||i.filterSubDone&&!b.subDone)?p(p([],E,!0),[String(b.transceiver.mid)],!1):E},[]),!0):[]},s.prototype.getAllTransceivers=function(t){if(!t)return[];t=(0,r.pruneSubUrl)(t,!0);var i=this.get(t);return i?p(p([],i.videoInfoList.map(function(l){return l.transceiver}),!0),i.audioInfoList.map(function(l){return l.transceiver}),!0):[]},s.prototype.getTransceiver=function(t,i){if(i===void 0&&(i={}),t){t=(0,r.pruneSubUrl)(t,!0);var l=i.vMsid,E=i.aMsid,b=this.get(t);if(b){var _;if(l)return(_=b.videoInfoList.find(function(h){return h.msid===l}))==null?void 0:_.transceiver;if(E)return(_=b.audioInfoList.find(function(h){return h.msid===E}))==null?void 0:_.transceiver}}},s.prototype.getStreamByMsid=function(t){var i,l,E=this.get(t.url);if(E){if(t.vMsid){var b=(i=E.videoInfoList.find(function(h){return h.msid===t.vMsid}))===null||i===void 0?void 0:i.streamId;return E.streamList.find(function(h){return h.id===b})}if(t.aMsid){var _=(l=E.audioInfoList.find(function(h){return h.msid===t.aMsid}))===null||l===void 0?void 0:l.streamId;return E.streamList.find(function(h){return h.id===_})}return E.streamList[0]}},s.prototype.hasTransceiver=function(t,i){return i===void 0&&(i={}),!!this.getTransceiver(t,i)},s.prototype.removeTransceiver=function(t,i){t=(0,r.pruneSubUrl)(t,!0);var l,E=this.get(t);E&&(i.vMsid&&(l=E.videoInfoList.find(function(b){return b.msid===i.vMsid}))&&(l.transceiver=void 0),i.aMsid&&(l=E.audioInfoList.find(function(b){return b.msid===i.aMsid}))&&(l.transceiver=void 0))},s.prototype.markAlreadySubPub=function(t,i){i===void 0&&(i={}),t=(0,r.pruneSubUrl)(t,!0);var l,E=this.streamMap[t];E&&(i.vMsid&&(l=E.videoInfoList.find(function(b){return b.msid===i.vMsid}))&&(l[i.isPub?"pubDone":"subDone"]=!i.reset),i.aMsid&&(l=E.audioInfoList.find(function(b){return b.msid===i.aMsid}))&&(l[i.isPub?"pubDone":"subDone"]=!i.reset))},s.prototype.isMsidSubPubDone=function(t,i){i===void 0&&(i={}),t=(0,r.pruneSubUrl)(t,!0);var l=this.streamMap[t];if(!l)return!1;if(i.vMsid){var E=l.videoInfoList.find(function(b){return b.msid===i.vMsid});return i.isPub?E?.pubDone:E?.subDone}return i.aMsid?(E=l.audioInfoList.find(function(b){return b.msid===i.aMsid}),i.isPub?E?.pubDone:E?.subDone):void 0},s.prototype.getAllMediaInfoList=function(t,i){var l=this.get(t);return l?p(p([],l.audioInfoList.map(function(E){var b,_,h,o,g=E.type,m=E.msid,T=E.ssrc,C=E.pt,D=E.codec,y=E.from,A=E.transceiver,O={type:g,msid:m,ssrc:T,pt:C,codec:D,from:y,trackId:l.type===e.Subscribe?(_=(b=A?.receiver)===null||b===void 0?void 0:b.track)===null||_===void 0?void 0:_.id:(o=(h=A?.sender)===null||h===void 0?void 0:h.track)===null||o===void 0?void 0:o.id};return i?d(d({},O),{transceiver:A}):O}),!0),l.videoInfoList.map(function(E){var b,_,h,o,g=E.type,m=E.msid,T=E.ssrc,C=E.pt,D=E.codec,y=E.from,A=E.transceiver,O={type:g,msid:m,ssrc:T,pt:C,codec:D,from:y,trackId:l.type===e.Subscribe?(_=(b=A?.receiver)===null||b===void 0?void 0:b.track)===null||_===void 0?void 0:_.id:(o=(h=A?.sender)===null||h===void 0?void 0:h.track)===null||o===void 0?void 0:o.id};return i?d(d({},O),{transceiver:A}):O}),!0):[]},s.prototype.getOriginUrl=function(t){var i=(0,r.pruneSubUrl)(t,!0),l=this.get(i);return l?l.originUrl:t},s.prototype.getAllTrackPairList=function(t){var i,l,E,b,_=[];for(var h in this.streamMap){var o=this.streamMap[h];if(o.type===t)for(var g=Math.max(o.audioInfoList.length,o.videoInfoList.length),m=0;m<g;m++){var T={url:h,originUrl:o.originUrl};m<o.audioInfoList.length&&(T.aTransceiver=t===e.Subscribe?(i=o.audioInfoList[m].transceiver)===null||i===void 0?void 0:i.receiver:(l=o.audioInfoList[m].transceiver)===null||l===void 0?void 0:l.sender,T.aMsid=o.audioInfoList[m].msid),m<o.videoInfoList.length&&(T.vTransceiver=t===e.Subscribe?(E=o.videoInfoList[m].transceiver)===null||E===void 0?void 0:E.receiver:(b=o.videoInfoList[m].transceiver)===null||b===void 0?void 0:b.sender,T.vMsid=o.videoInfoList[m].msid),_.push(T)}}return _},s.prototype.getAllStreamListWithMsids=function(){var t,i=[];for(var l in this.streamMap){for(var E=this.streamMap[l],b=Math.max(E.audioInfoList.length,E.videoInfoList.length,E.streamList.length),_={url:l,msids:[],type:E.type,latestUrl:E.latestUrl||E.originUrl,streams:[]},h=0;h<b;h++){if(h<E.audioInfoList.length&&E.audioInfoList[h].msid){var o=E.audioInfoList[h];o.msid&&(E.type===e.Publish&&o.pubDone||E.type===e.Subscribe&&o.subDone)&&_.msids.push({name:o.msid||"",type:o.type||"audio",streamId:o.streamId})}if(h<E.videoInfoList.length&&E.videoInfoList[h].msid){var g=E.videoInfoList[h];g.msid&&(E.type===e.Publish&&g.pubDone||E.type===e.Subscribe&&g.subDone)&&_.msids.push({name:g.msid||"",type:g.type||"video",streamId:g.streamId})}h<E.streamList.length&&E.streamList[h]&&((t=_.streams)===null||t===void 0||t.push(E.streamList[h]))}_.msids.length&&i.push(_)}return i},s.prototype.getSender=function(t,i,l){var E,b,_=void 0,h=this.getAllMediaInfoList(t,!0);return l?h.forEach(function(o){var g,m,T,C=(m=(g=o.transceiver)===null||g===void 0?void 0:g.sender)===null||m===void 0?void 0:m.track;C?.kind===i&&o.msid===l&&(_=(T=o.transceiver)===null||T===void 0?void 0:T.sender)}):_=(b=(E=h?.find(function(o){var g,m,T;return((T=(m=(g=o.transceiver)===null||g===void 0?void 0:g.sender)===null||m===void 0?void 0:m.track)===null||T===void 0?void 0:T.kind)===i}))===null||E===void 0?void 0:E.transceiver)===null||b===void 0?void 0:b.sender,_},s.prototype.getReceiver=function(t,i,l){var E,b,_=void 0,h=this.getAllMediaInfoList(t,!0);return l?h.forEach(function(o){var g,m,T,C=(m=(g=o.transceiver)===null||g===void 0?void 0:g.receiver)===null||m===void 0?void 0:m.track;C?.kind===i&&o.msid===l&&(_=(T=o.transceiver)===null||T===void 0?void 0:T.receiver)}):_=(b=(E=h?.find(function(o){var g,m,T;return((T=(m=(g=o.transceiver)===null||g===void 0?void 0:g.receiver)===null||m===void 0?void 0:m.track)===null||T===void 0?void 0:T.kind)===i}))===null||E===void 0?void 0:E.transceiver)===null||b===void 0?void 0:b.receiver,_},s.prototype.dispose=function(){this.streamMap={}},s.prototype.updateMediaInfoList=function(t,i){var l=i.findIndex(function(E){return E.msid===t.msid});l!==-1?i.splice(l,1,t):i.push(t)},s.prototype.findMediaItemByMsid=function(t,i){return i.find(function(l){return l.msid===t})},s.prototype.createMediaItem=function(t,i){return{msid:t,ssrc:void 0,transceiver:void 0,subDone:!1,pubDone:!1,type:i,streamId:void 0}},s.prototype.addOrUpdateDatachannelItem=function(t){var i=this.datachannelMap.get(t.url);i?t.msids.forEach(function(l){i.msids.find(function(E){if(E.id===l.id&&E.name===l.name)return!0})?console.log("RTS [STREAM MANAGER]: duplicate msid for datachannel",t):i.msids.push(l)}):this.datachannelMap.set(t.url,t)},s.prototype.deleteDatachannelItem=function(t){this.datachannelMap.delete(t.url)},s.prototype.getAllDatachannelList=function(){var t=[];return this.datachannelMap.forEach(function(i){t.push(d(d({},i),{latestUrl:i.latestUrl||i.originUrl}))}),t},s.prototype.getDatachannelByMsid=function(t){var i;if(t.url){var l=this.datachannelMap.get((0,r.pruneSubUrl)(t.url,!0));if(l)return t.msid?(i=l.msids.find(function(E){return E.name===t.msid}))===null||i===void 0?void 0:i.datachannel:l.msids[0].datachannel}else console.warn("[getDatachannelByMsid] config.url is required.")},s.prototype.getPubOrSubDoneMediaUrlByIndex=function(t){var i=0,l=function(h){var o=E.streamMap[h],g=!1;if(o.audioInfoList.forEach(function(m){g=g||o.type===e.Publish&&m.pubDone||o.type===e.Subscribe&&m.subDone}),o.videoInfoList.forEach(function(m){g=g||o.type===e.Publish&&m.pubDone||o.type===e.Subscribe&&m.subDone}),g){if(i===t)return{value:h};i++}},E=this;for(var b in this.streamMap){var _=l(b);if(typeof _=="object")return _.value}},s.prototype.getDcUrlByIndex=function(t){var i=void 0;return this.datachannelMap.forEach(function(l){t===0&&(i={url:l.originUrl})}),i},s.prototype.updateLatestUrl=function(t){var i=this.get(t);return!!i&&(i.latestUrl=t,!0)},s}();f.StreamManager=n}},v={};function c(S){var f=v[S];if(f!==void 0)return f.exports;var a=v[S]={exports:{}};return x[S].call(a.exports,a,a.exports,c),a.exports}var u={};return(()=>{var S=u;Object.defineProperty(S,"__esModule",{value:!0}),S.DataChannelCore=S.EDatachannelStatus=S.PeerConnectionCore=void 0;var f=c(776);Object.defineProperty(S,"PeerConnectionCore",{enumerable:!0,get:function(){return f.PeerConnectionCore}}),Object.defineProperty(S,"EDatachannelStatus",{enumerable:!0,get:function(){return f.EDatachannelStatus}});var a=c(651);Object.defineProperty(S,"DataChannelCore",{enumerable:!0,get:function(){return a.DataChannelCore}})})(),u})(),L.exports=R()},2505:(L,R,x)=>{L.exports=x(8015)},5592:(L,R,x)=>{var v=x(9516),c=x(7522),u=x(3948),S=x(9106),f=x(9615),a=x(2012),d=x(4202),p=x(7763);L.exports=function(e){return new Promise(function(r,n){var s=e.data,t=e.headers,i=e.responseType;v.isFormData(s)&&delete t["Content-Type"];var l=new XMLHttpRequest;if(e.auth){var E=e.auth.username||"",b=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";t.Authorization="Basic "+btoa(E+":"+b)}var _=f(e.baseURL,e.url);function h(){if(l){var g="getAllResponseHeaders"in l?a(l.getAllResponseHeaders()):null,m={data:i&&i!=="text"&&i!=="json"?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:g,config:e,request:l};c(r,n,m),l=null}}if(l.open(e.method.toUpperCase(),S(_,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=h:l.onreadystatechange=function(){l&&l.readyState===4&&(l.status!==0||l.responseURL&&l.responseURL.indexOf("file:")===0)&&setTimeout(h)},l.onabort=function(){l&&(n(p("Request aborted",e,"ECONNABORTED",l)),l=null)},l.onerror=function(){n(p("Network Error",e,null,l)),l=null},l.ontimeout=function(){var g="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(g=e.timeoutErrorMessage),n(p(g,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",l)),l=null},v.isStandardBrowserEnv()){var o=(e.withCredentials||d(_))&&e.xsrfCookieName?u.read(e.xsrfCookieName):void 0;o&&(t[e.xsrfHeaderName]=o)}"setRequestHeader"in l&&v.forEach(t,function(g,m){s===void 0&&m.toLowerCase()==="content-type"?delete t[m]:l.setRequestHeader(m,g)}),v.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),i&&i!=="json"&&(l.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&l.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(g){l&&(l.abort(),n(g),l=null)}),s||(s=null),l.send(s)})}},8015:(L,R,x)=>{var v=x(9516),c=x(9012),u=x(5155),S=x(5343);function f(d){var p=new u(d),e=c(u.prototype.request,p);return v.extend(e,u.prototype,p),v.extend(e,p),e}var a=f(x(6987));a.Axios=u,a.create=function(d){return f(S(a.defaults,d))},a.Cancel=x(1928),a.CancelToken=x(3191),a.isCancel=x(3864),a.all=function(d){return Promise.all(d)},a.spread=x(7980),a.isAxiosError=x(5019),L.exports=a,L.exports.default=a},1928:L=>{function R(x){this.message=x}R.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},R.prototype.__CANCEL__=!0,L.exports=R},3191:(L,R,x)=>{var v=x(1928);function c(u){if(typeof u!="function")throw new TypeError("executor must be a function.");var S;this.promise=new Promise(function(a){S=a});var f=this;u(function(a){f.reason||(f.reason=new v(a),S(f.reason))})}c.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},c.source=function(){var u;return{token:new c(function(S){u=S}),cancel:u}},L.exports=c},3864:L=>{L.exports=function(R){return!(!R||!R.__CANCEL__)}},5155:(L,R,x)=>{var v=x(9516),c=x(9106),u=x(3471),S=x(4490),f=x(5343),a=x(4841),d=a.validators;function p(e){this.defaults=e,this.interceptors={request:new u,response:new u}}p.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=f(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&a.assertOptions(r,{silentJSONParsing:d.transitional(d.boolean,"1.0.0"),forcedJSONParsing:d.transitional(d.boolean,"1.0.0"),clarifyTimeoutError:d.transitional(d.boolean,"1.0.0")},!1);var n=[],s=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(e)===!1||(s=s&&h.synchronous,n.unshift(h.fulfilled,h.rejected))});var t,i=[];if(this.interceptors.response.forEach(function(h){i.push(h.fulfilled,h.rejected)}),!s){var l=[S,void 0];for(Array.prototype.unshift.apply(l,n),l=l.concat(i),t=Promise.resolve(e);l.length;)t=t.then(l.shift(),l.shift());return t}for(var E=e;n.length;){var b=n.shift(),_=n.shift();try{E=b(E)}catch(h){_(h);break}}try{t=S(E)}catch(h){return Promise.reject(h)}for(;i.length;)t=t.then(i.shift(),i.shift());return t},p.prototype.getUri=function(e){return e=f(this.defaults,e),c(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},v.forEach(["delete","get","head","options"],function(e){p.prototype[e]=function(r,n){return this.request(f(n||{},{method:e,url:r,data:(n||{}).data}))}}),v.forEach(["post","put","patch"],function(e){p.prototype[e]=function(r,n,s){return this.request(f(s||{},{method:e,url:r,data:n}))}}),L.exports=p},3471:(L,R,x)=>{var v=x(9516);function c(){this.handlers=[]}c.prototype.use=function(u,S,f){return this.handlers.push({fulfilled:u,rejected:S,synchronous:!!f&&f.synchronous,runWhen:f?f.runWhen:null}),this.handlers.length-1},c.prototype.eject=function(u){this.handlers[u]&&(this.handlers[u]=null)},c.prototype.forEach=function(u){v.forEach(this.handlers,function(S){S!==null&&u(S)})},L.exports=c},9615:(L,R,x)=>{var v=x(9137),c=x(4680);L.exports=function(u,S){return u&&!v(S)?c(u,S):S}},7763:(L,R,x)=>{var v=x(5449);L.exports=function(c,u,S,f,a){var d=new Error(c);return v(d,u,S,f,a)}},4490:(L,R,x)=>{var v=x(9516),c=x(2881),u=x(3864),S=x(6987);function f(a){a.cancelToken&&a.cancelToken.throwIfRequested()}L.exports=function(a){return f(a),a.headers=a.headers||{},a.data=c.call(a,a.data,a.headers,a.transformRequest),a.headers=v.merge(a.headers.common||{},a.headers[a.method]||{},a.headers),v.forEach(["delete","get","head","post","put","patch","common"],function(d){delete a.headers[d]}),(a.adapter||S.adapter)(a).then(function(d){return f(a),d.data=c.call(a,d.data,d.headers,a.transformResponse),d},function(d){return u(d)||(f(a),d&&d.response&&(d.response.data=c.call(a,d.response.data,d.response.headers,a.transformResponse))),Promise.reject(d)})}},5449:L=>{L.exports=function(R,x,v,c,u){return R.config=x,v&&(R.code=v),R.request=c,R.response=u,R.isAxiosError=!0,R.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},R}},5343:(L,R,x)=>{var v=x(9516);L.exports=function(c,u){u=u||{};var S={},f=["url","method","data"],a=["headers","auth","proxy","params"],d=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],p=["validateStatus"];function e(t,i){return v.isPlainObject(t)&&v.isPlainObject(i)?v.merge(t,i):v.isPlainObject(i)?v.merge({},i):v.isArray(i)?i.slice():i}function r(t){v.isUndefined(u[t])?v.isUndefined(c[t])||(S[t]=e(void 0,c[t])):S[t]=e(c[t],u[t])}v.forEach(f,function(t){v.isUndefined(u[t])||(S[t]=e(void 0,u[t]))}),v.forEach(a,r),v.forEach(d,function(t){v.isUndefined(u[t])?v.isUndefined(c[t])||(S[t]=e(void 0,c[t])):S[t]=e(void 0,u[t])}),v.forEach(p,function(t){t in u?S[t]=e(c[t],u[t]):t in c&&(S[t]=e(void 0,c[t]))});var n=f.concat(a).concat(d).concat(p),s=Object.keys(c).concat(Object.keys(u)).filter(function(t){return n.indexOf(t)===-1});return v.forEach(s,r),S}},7522:(L,R,x)=>{var v=x(7763);L.exports=function(c,u,S){var f=S.config.validateStatus;S.status&&f&&!f(S.status)?u(v("Request failed with status code "+S.status,S.config,null,S.request,S)):c(S)}},2881:(L,R,x)=>{var v=x(9516),c=x(6987);L.exports=function(u,S,f){var a=this||c;return v.forEach(f,function(d){u=d.call(a,u,S)}),u}},6987:(L,R,x)=>{var v=x(9516),c=x(7018),u=x(5449),S={"Content-Type":"application/x-www-form-urlencoded"};function f(p,e){!v.isUndefined(p)&&v.isUndefined(p["Content-Type"])&&(p["Content-Type"]=e)}var a,d={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:((typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(a=x(5592)),a),transformRequest:[function(p,e){return c(e,"Accept"),c(e,"Content-Type"),v.isFormData(p)||v.isArrayBuffer(p)||v.isBuffer(p)||v.isStream(p)||v.isFile(p)||v.isBlob(p)?p:v.isArrayBufferView(p)?p.buffer:v.isURLSearchParams(p)?(f(e,"application/x-www-form-urlencoded;charset=utf-8"),p.toString()):v.isObject(p)||e&&e["Content-Type"]==="application/json"?(f(e,"application/json"),function(r,n,s){if(v.isString(r))try{return(n||JSON.parse)(r),v.trim(r)}catch(t){if(t.name!=="SyntaxError")throw t}return(0,JSON.stringify)(r)}(p)):p}],transformResponse:[function(p){var e=this.transitional,r=e&&e.silentJSONParsing,n=e&&e.forcedJSONParsing,s=!r&&this.responseType==="json";if(s||n&&v.isString(p)&&p.length)try{return JSON.parse(p)}catch(t){if(s)throw t.name==="SyntaxError"?u(t,this,"E_JSON_PARSE"):t}return p}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(p){return p>=200&&p<300}};d.headers={common:{Accept:"application/json, text/plain, */*"}},v.forEach(["delete","get","head"],function(p){d.headers[p]={}}),v.forEach(["post","put","patch"],function(p){d.headers[p]=v.merge(S)}),L.exports=d},9012:L=>{L.exports=function(R,x){return function(){for(var v=new Array(arguments.length),c=0;c<v.length;c++)v[c]=arguments[c];return R.apply(x,v)}}},9106:(L,R,x)=>{var v=x(9516);function c(u){return encodeURIComponent(u).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}L.exports=function(u,S,f){if(!S)return u;var a;if(f)a=f(S);else if(v.isURLSearchParams(S))a=S.toString();else{var d=[];v.forEach(S,function(e,r){e!=null&&(v.isArray(e)?r+="[]":e=[e],v.forEach(e,function(n){v.isDate(n)?n=n.toISOString():v.isObject(n)&&(n=JSON.stringify(n)),d.push(c(r)+"="+c(n))}))}),a=d.join("&")}if(a){var p=u.indexOf("#");p!==-1&&(u=u.slice(0,p)),u+=(u.indexOf("?")===-1?"?":"&")+a}return u}},4680:L=>{L.exports=function(R,x){return x?R.replace(/\/+$/,"")+"/"+x.replace(/^\/+/,""):R}},3948:(L,R,x)=>{var v=x(9516);L.exports=v.isStandardBrowserEnv()?{write:function(c,u,S,f,a,d){var p=[];p.push(c+"="+encodeURIComponent(u)),v.isNumber(S)&&p.push("expires="+new Date(S).toGMTString()),v.isString(f)&&p.push("path="+f),v.isString(a)&&p.push("domain="+a),d===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(c){var u=document.cookie.match(new RegExp("(^|;\\s*)("+c+")=([^;]*)"));return u?decodeURIComponent(u[3]):null},remove:function(c){this.write(c,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},9137:L=>{L.exports=function(R){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(R)}},5019:L=>{L.exports=function(R){return typeof R=="object"&&R.isAxiosError===!0}},4202:(L,R,x)=>{var v=x(9516);L.exports=v.isStandardBrowserEnv()?function(){var c,u=/(msie|trident)/i.test(navigator.userAgent),S=document.createElement("a");function f(a){var d=a;return u&&(S.setAttribute("href",d),d=S.href),S.setAttribute("href",d),{href:S.href,protocol:S.protocol?S.protocol.replace(/:$/,""):"",host:S.host,search:S.search?S.search.replace(/^\?/,""):"",hash:S.hash?S.hash.replace(/^#/,""):"",hostname:S.hostname,port:S.port,pathname:S.pathname.charAt(0)==="/"?S.pathname:"/"+S.pathname}}return c=f(window.location.href),function(a){var d=v.isString(a)?f(a):a;return d.protocol===c.protocol&&d.host===c.host}}():function(){return!0}},7018:(L,R,x)=>{var v=x(9516);L.exports=function(c,u){v.forEach(c,function(S,f){f!==u&&f.toUpperCase()===u.toUpperCase()&&(c[u]=S,delete c[f])})}},2012:(L,R,x)=>{var v=x(9516),c=["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"];L.exports=function(u){var S,f,a,d={};return u&&v.forEach(u.split(`
77
+ a=ssrc:`).concat(b," label:audio"),n.direction==="sub"&&(s+=h),s+=t)}),s}},237:(S,f,a)=>{Object.defineProperty(f,"__esModule",{value:!0}),f.UrlData=void 0;var d=a(887),p=function(){function e(r){var n=(0,d.parseUrlSubParams)(r.url);this.data={url:r.url,subAudio:n.subAudio,subVideo:n.subVideo},typeof r.subAudio=="boolean"&&(this.data.subAudio=r.subAudio),typeof r.subVideo=="boolean"&&(this.data.subVideo=r.subVideo)}return Object.defineProperty(e.prototype,"subVideo",{get:function(){return this.data.subVideo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subAudio",{get:function(){return this.data.subAudio},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"url",{get:function(){return(0,d.pruneSubUrl)(this.data.url)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"originalUrl",{get:function(){return this.data.url},enumerable:!1,configurable:!0}),e}();f.UrlData=p},123:function(S,f,a){var d,p=this&&this.__extends||(d=function(l,E){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,_){b.__proto__=_}||function(b,_){for(var h in _)Object.prototype.hasOwnProperty.call(_,h)&&(b[h]=_[h])},d(l,E)},function(l,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");function b(){this.constructor=l}d(l,E),l.prototype=E===null?Object.create(E):(b.prototype=E.prototype,new b)}),e=this&&this.__spreadArray||function(l,E,b){if(b||arguments.length===2)for(var _,h=0,o=E.length;h<o;h++)!_&&h in E||(_||(_=Array.prototype.slice.call(E,0,h)),_[h]=E[h]);return l.concat(_||Array.prototype.slice.call(E))},r=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(f,"__esModule",{value:!0});var n=r(a(885)),s=a(973),t=[s.EDatachannelSignalResCode.NGX_RTC_STREAM_NO_FOUND,s.EDatachannelSignalResCode.NGX_RTC_DATACHANNEL_HEBT_MSID_NOT_FOUND],i=function(l){function E(b,_){var h=l.call(this)||this;return h.datachannel=b,h.streamManager=_,h}return p(E,l),E.prototype.process=function(b){var _=this,h=this.parseFormat(b);if(h){var o=this.checkRecode(h),g=o.valid,m=o.error,T=o.reason;if(!g)return h.recode===3?void this.emit("datachannelNotEnabled"):void(m&&this.emit("pcReconnect",{recode:h.recode,reMsg:T}));this.emit("hebtReceived",h),this.checkStreams(h).forEach(function(C){var D={resCode:C.resCode,resMsg:C.resMsg,url:C.url,msids:C.msids,streams:C.streams,type:C.type,latestUrl:C.latestUrl};C.isReconnectable?_.emit("streamReconnect",D):_.emit("streamError",D)})}},E.prototype.parseFormat=function(b){try{return JSON.parse(b)}catch{console.log("Heartbeat parse failed."," Response Data: ",b)}},E.prototype.checkRecode=function(b){var _={valid:!1,error:!1,reason:""};return b.type!==s.EMessageType.HEBT?(_.reason="not heartbeat signal, ignore",_):b.recode!==0?(_.reason=b.msg,_.error=!0,_):(_.valid=!0,_)},E.prototype.checkStreams=function(b){var _=this,h=[];return b.streams&&b.streams.length&&e(e([],this.streamManager.getAllStreamListWithMsids(),!0),this.streamManager.getAllDatachannelList(),!0).forEach(function(o){var g,m=-1;if(b.streams.find(function(y,A){if(y.url===o.url)return m=A,!0})&&m!==-1){var T=b.streams[m];if(T.method===s.EMessageType.HEBT&&T.res_code===200){T.traceid&&_.emit("traceIdUpdate",{url:T.url,traceId:T.traceid});var C=[];o.msids.forEach(function(y){T.msid.find(function(A){return A.name===y.name})||C.push(y)});var D=(g=o.streams)===null||g===void 0?void 0:g.filter(function(y){return!!C.find(function(A){return A.streamId===y.id})});C.length&&h.push({url:o.url,msids:C,streams:D,isReconnectable:!0,resMsg:"RTS heartbeat msid mismatch",resCode:404,type:o.type,latestUrl:o.latestUrl})}else h.push({url:o.url,msids:o.msids,streams:o.streams,isReconnectable:_.isReconnectableErrorCode(T.res_code),resMsg:T.res_msg,resCode:T.res_code,type:o.type,latestUrl:o.latestUrl})}}),h},E.prototype.isReconnectableErrorCode=function(b){return t.includes(b)},E}(n.default);f.default=i},619:function(S,f,a){var d=this&&this.__assign||function(){return d=Object.assign||function(b){for(var _,h=1,o=arguments.length;h<o;h++)for(var g in _=arguments[h])Object.prototype.hasOwnProperty.call(_,g)&&(b[g]=_[g]);return b},d.apply(this,arguments)},p=this&&this.__awaiter||function(b,_,h,o){return new(h||(h=Promise))(function(g,m){function T(y){try{D(o.next(y))}catch(A){m(A)}}function C(y){try{D(o.throw(y))}catch(A){m(A)}}function D(y){var A;y.done?g(y.value):(A=y.value,A instanceof h?A:new h(function(w){w(A)})).then(T,C)}D((o=o.apply(b,_||[])).next())})},e=this&&this.__generator||function(b,_){var h,o,g,m,T={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return m={next:C(0),throw:C(1),return:C(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function C(D){return function(y){return function(A){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,A[0]&&(T=0)),T;)try{if(h=1,o&&(g=2&A[0]?o.return:A[0]?o.throw||((g=o.return)&&g.call(o),0):o.next)&&!(g=g.call(o,A[1])).done)return g;switch(o=0,g&&(A=[2&A[0],g.value]),A[0]){case 0:case 1:g=A;break;case 4:return T.label++,{value:A[1],done:!1};case 5:T.label++,o=A[1],A=[0];continue;case 7:A=T.ops.pop(),T.trys.pop();continue;default:if(!((g=(g=T.trys).length>0&&g[g.length-1])||A[0]!==6&&A[0]!==2)){T=0;continue}if(A[0]===3&&(!g||A[1]>g[0]&&A[1]<g[3])){T.label=A[1];break}if(A[0]===6&&T.label<g[1]){T.label=g[1],g=A;break}if(g&&T.label<g[2]){T.label=g[2],T.ops.push(A);break}g[2]&&T.ops.pop(),T.trys.pop();continue}A=_.call(b,T)}catch(w){A=[6,w],o=0}finally{h=g=0}if(5&A[0])throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}([D,y])}}},r=this&&this.__spreadArray||function(b,_,h){if(h||arguments.length===2)for(var o,g=0,m=_.length;g<m;g++)!o&&g in _||(o||(o=Array.prototype.slice.call(_,0,g)),o[g]=_[g]);return b.concat(o||Array.prototype.slice.call(_))};Object.defineProperty(f,"__esModule",{value:!0}),f.Signal=void 0;var n,s,t,i=a(651),l=a(887);(function(b){b.Sub="sub",b.Pub="pub",b.Hebt="hebt"})(n||(n={})),function(b){b.Add="add",b.Active="active",b.Stop="stop",b.Delete="delete",b.Hebt="hebt"}(s||(s={})),function(b){b.Audio="audio",b.Video="video",b.Data="data"}(t||(t={}));var E=function(){function b(_){this.latestMsgId=0,this.latestSubAddMsgId=0,this.pc=_.pc,this.datachannel=new i.DataChannelCore({pc:this.pc,onDatachannelEvent:_.onDatachannelEvent})}return b.prototype.getDatachannelCore=function(){return this.datachannel},b.prototype.subscribeAdd=function(_,h,o){var g;return p(this,void 0,void 0,function(){var m;return e(this,function(T){switch(T.label){case 0:return m=d(d({},this.baseParams({type:n.Sub,method:s.Add})),{streams:_.map(function(C,D){var y=C.urlData,A=[];return y.subAudio&&!o.isMsidSubPubDone(y.url,{aMsid:C.aMsid[0]})&&A.push({type:t.Audio,name:C.aMsid[0]}),y.subVideo&&!o.isMsidSubPubDone(y.url,{vMsid:C.vMsid[0]})&&A.push({type:t.Video,name:C.vMsid[0]}),{method:s.Add,url:y.url,msid:A,sdp:h[D],ttl:300}})}),[4,(g=this.datachannel)===null||g===void 0?void 0:g.sendData(m)];case 1:return[2,T.sent()]}})})},b.prototype.subscribeActive=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams({type:n.Sub,method:s.Active})),{streams:_.map(function(m){var T=m.urlData;return{method:s.Active,url:T.url}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return g.sent(),[2]}})})},b.prototype.subscribeDelete=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams()),{streams:_.map(function(m){var T=m.url,C=m.aMsid,D=m.vMsid,y=[];return C?.length&&(y=r(r([],y,!0),C.map(function(A){return{name:A}}),!0)),D?.length&&(y=r(r([],y,!0),D.map(function(A){return{name:A}}),!0)),{method:s.Delete,url:(0,l.pruneSubUrl)(T),msid:y}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.subscribeStop=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams()),{streams:_.map(function(m){var T=m.urlData;return{method:s.Stop,url:T.url}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.subscribeAddDatachannel=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams({type:n.Sub,method:s.Add})),{streams:_.map(function(m){var T=m.url,C=m.msid;return{method:s.Add,url:T,msid:[{type:t.Data,name:C}]}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.subscribeActiveDatachannel=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams({type:n.Sub,method:s.Active})),{streams:_.map(function(m){var T=m.url,C=m.datachannelId,D=m.msid;return{method:s.Active,url:T,msid:[{type:t.Data,name:D,channel:C}]}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.subscribeStopDatachannel=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams()),{streams:_.map(function(m){var T=m.url;return{method:s.Stop,url:T}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.publishAdd=function(_,h,o,g){var m;return p(this,void 0,void 0,function(){var T;return e(this,function(C){return T=d(d({},this.baseParams({type:n.Pub})),{streams:_.map(function(D,y){var A=o[y],w=g[y],j=[];return A.length&&j.push({type:"video",name:A[0].trim()}),w.length&&j.push({type:"audio",name:w[0].trim()}),{method:s.Add,url:D,msid:j,sdp:h[y]}})}),[2,(m=this.datachannel)===null||m===void 0?void 0:m.sendData(T)]})})},b.prototype.publishDelete=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){return o=d(d({},this.baseParams({type:n.Pub})),{streams:_.map(function(m){var T=m.url,C=m.aMsid,D=m.vMsid,y=[];return C?.length&&(y=r(r([],y,!0),C.map(function(A){return{name:A}}),!0)),D?.length&&(y=r(r([],y,!0),D.map(function(A){return{name:A}}),!0)),{method:s.Delete,url:(0,l.pruneSubUrl)(T),msid:y}})}),[2,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)]})})},b.prototype.publishStop=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){return o=d(d({},this.baseParams({type:n.Pub})),{streams:_.map(function(m){return{method:s.Stop,url:m}})}),[2,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)]})})},b.prototype.publishAddDatachannel=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams({type:n.Pub,method:s.Add})),{streams:_.map(function(m){var T=m.url,C=m.datachannelId,D=m.msid;return{method:s.Add,url:T,msid:[{type:t.Data,name:D,channel:C}]}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.publishStopDatachannel=function(_){var h;return p(this,void 0,void 0,function(){var o;return e(this,function(g){switch(g.label){case 0:return o=d(d({},this.baseParams({type:n.Pub})),{streams:_.map(function(m){var T=m.url;return{method:s.Stop,url:T}})}),[4,(h=this.datachannel)===null||h===void 0?void 0:h.sendData(o)];case 1:return[2,g.sent()]}})})},b.prototype.sendHeartbeat=function(_){_&&!_.map&&(_=void 0);var h=d(d({},this.baseParams({type:n.Hebt})),{streams:_?.map(function(o){var g=o.url;return{method:s.Hebt,url:g}})});if(_||delete h.streams,this.datachannel.sendAsync(h))return h},b.prototype.sendFalseHeartbeat=function(_){var h=d(d({},this.baseParams({type:n.Hebt})),{streams:_?.map(function(o){return{method:"fake",url:o.url}})});if(_||delete h.streams,this.datachannel.sendAsync(h))return h},b.prototype.dispose=function(){this.datachannel.dispose()},b.prototype.baseParams=function(_){_===void 0&&(_={type:n.Sub});var h=0;return _.type===n.Sub&&_.method===s.Add?(h=++this.latestMsgId,this.latestSubAddMsgId=this.latestMsgId):h=_.type===n.Sub&&_.method===s.Active?this.latestSubAddMsgId:++this.latestMsgId,{msg_id:h,version:2,type:_.type}},b}();f.Signal=E},125:function(S,f,a){var d,p=this&&this.__extends||(d=function(l,E){return d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(b,_){b.__proto__=_}||function(b,_){for(var h in _)Object.prototype.hasOwnProperty.call(_,h)&&(b[h]=_[h])},d(l,E)},function(l,E){if(typeof E!="function"&&E!==null)throw new TypeError("Class extends value "+String(E)+" is not a constructor or null");function b(){this.constructor=l}d(l,E),l.prototype=E===null?Object.create(E):(b.prototype=E.prototype,new b)}),e=this&&this.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(f,"__esModule",{value:!0}),f.NotifyProcessor=void 0;var r,n=a(973),s=e(a(885)),t=a(390);(function(l){l[l.NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION=1]="NGX_RTC_H5_DELIVERY_INTERNAL_EXCEPTION",l[l.NGX_RTC_H5_ACCESS_IP_MIGRATION=2]="NGX_RTC_H5_ACCESS_IP_MIGRATION"})(r||(r={}));var i=function(l){function E(){var b=l.call(this)||this;return b.logger=new t.Logger({displayName:"NotifyProcessor",switchName:"RTS_NOTIFY_DEBUG"}),b}return p(E,l),E.prototype.process=function(b){var _,h;this.logger.log("======== processing notify message:",b," ========");var o=this.parseFormat(b);if(this.logger.log("parsedData",o),o)if(this.checkRelated(o)){this.emit("message",{message:o});var g=this.parseIP(o.notify_msg);!((_=g.pull)===null||_===void 0)&&_.length||!((h=g.push)===null||h===void 0)&&h.length?(console.warn("\u9700\u8981\u91CD\u8FDE",g),this.emit("pcReconnect",{ips:g})):this.logger.log("No valid ip found: ",o.notify_msg)}else this.logger.log("NotifyProcessor: Not related message, ignore.")},E.prototype.parseFormat=function(b){try{return JSON.parse(b)}catch{console.warn("Notify parse failed."," Response Data: ",b)}},E.prototype.checkRelated=function(b){return b.type===n.EMessageType.NOTI&&b.notify_type===r.NGX_RTC_H5_ACCESS_IP_MIGRATION},E.prototype.parseIP=function(b){b===void 0&&(b=""),this.logger.log("Paring IP string: ".concat(b));var _=b.split(";"),h=/^(?:\d{1,3}\.){3}\d{1,3}$/,o=/^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$/,g=/^(push|pull)_ips:(.*)$/,m={};return _.forEach(function(T){var C=g.exec(T);if(C){var D=C[1],y=C[2].split(",").filter(function(A){return h.test(A)||o.test(A)});m[D]=y}}),this.logger.log("Parsed IP:",m),m},E}(s.default);f.NotifyProcessor=i},132:function(S,f){var a=this&&this.__awaiter||function(r,n,s,t){return new(s||(s=Promise))(function(i,l){function E(h){try{_(t.next(h))}catch(o){l(o)}}function b(h){try{_(t.throw(h))}catch(o){l(o)}}function _(h){var o;h.done?i(h.value):(o=h.value,o instanceof s?o:new s(function(g){g(o)})).then(E,b)}_((t=t.apply(r,n||[])).next())})},d=this&&this.__generator||function(r,n){var s,t,i,l,E={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return l={next:b(0),throw:b(1),return:b(2)},typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function b(_){return function(h){return function(o){if(s)throw new TypeError("Generator is already executing.");for(;l&&(l=0,o[0]&&(E=0)),E;)try{if(s=1,t&&(i=2&o[0]?t.return:o[0]?t.throw||((i=t.return)&&i.call(t),0):t.next)&&!(i=i.call(t,o[1])).done)return i;switch(t=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return E.label++,{value:o[1],done:!1};case 5:E.label++,t=o[1],o=[0];continue;case 7:o=E.ops.pop(),E.trys.pop();continue;default:if(!((i=(i=E.trys).length>0&&i[i.length-1])||o[0]!==6&&o[0]!==2)){E=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){E.label=o[1];break}if(o[0]===6&&E.label<i[1]){E.label=i[1],i=o;break}if(i&&E.label<i[2]){E.label=i[2],E.ops.push(o);break}i[2]&&E.ops.pop(),E.trys.pop();continue}o=n.call(r,E)}catch(g){o=[6,g],t=0}finally{s=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([_,h])}}},p=this&&this.__spreadArray||function(r,n,s){if(s||arguments.length===2)for(var t,i=0,l=n.length;i<l;i++)!t&&i in n||(t||(t=Array.prototype.slice.call(n,0,i)),t[i]=n[i]);return r.concat(t||Array.prototype.slice.call(n))};Object.defineProperty(f,"__esModule",{value:!0}),f.PeerConnectionRollbackController=void 0;var e=function(){function r(n){this.fakeSdpParams={direction:"sub",mids:[],medias:[]},this.pcCore=n}return r.prototype.setFakeSdpMids=function(n){this.fakeSdpParams.mids=n},r.prototype.setFakeSdpMedias=function(n,s){this.fakeSdpParams.medias=n,this.fakeSdpParams.direction=s},r.prototype.saveStreamManager=function(n){this.streamManager=n,this.streamManagerBackup=this.streamManager.doBackup()},r.prototype.rollback=function(n){return a(this,void 0,void 0,function(){var s;return d(this,function(t){switch(t.label){case 0:if(n?.trackListnerRollback&&(this.pcCore.removeTrackListener(),this.log("Sub Track Listener Removed")),n?.streamManagerRollback&&this.streamManagerBackup){this.pcCore.setStreamManager(this.streamManagerBackup);try{this.log("Stream Manager Restored",JSON.parse(JSON.stringify(this.streamManager)))}catch{}}if(n?.pcTransceiversRollback&&(this.fakeSdpParams.medias.forEach(function(i){var l;(l=i.trans)===null||l===void 0||l.receiver.track.stop()}),this.log("Sub Track(s) Stopped",this.fakeSdpParams.medias)),!n?.runSimulateSignal)return[3,4];this.log("SDP Simulating...",this.fakeSdpParams),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.pcCore.simulateOfferAnswer(this.fakeSdpParams)];case 2:return t.sent(),this.log("SDP Simulation Done"),[3,4];case 3:return s=t.sent(),this.log("SDP Simulation Failed",s),[3,4];case 4:return[2]}})})},r.prototype.log=function(){for(var n=[],s=0;s<arguments.length;s++)n[s]=arguments[s];window.RTS_DATACHANNEL_DEBUG&&console.log.apply(console,p(["[PC-Core-Rollback]"],n,!1))},r}();f.PeerConnectionRollbackController=e},628:function(S,f,a){var d=this&&this.__assign||function(){return d=Object.assign||function(s){for(var t,i=1,l=arguments.length;i<l;i++)for(var E in t=arguments[i])Object.prototype.hasOwnProperty.call(t,E)&&(s[E]=t[E]);return s},d.apply(this,arguments)},p=this&&this.__spreadArray||function(s,t,i){if(i||arguments.length===2)for(var l,E=0,b=t.length;E<b;E++)!l&&E in t||(l||(l=Array.prototype.slice.call(t,0,E)),l[E]=t[E]);return s.concat(l||Array.prototype.slice.call(t))};Object.defineProperty(f,"__esModule",{value:!0}),f.StreamManager=f.EStreamType=void 0;var e,r=a(887);(function(s){s.Subscribe="sub",s.Publish="pub"})(e=f.EStreamType||(f.EStreamType={}));var n=function(){function s(t){this.streamMap={},this.datachannelMap=new Map}return s.prototype.doBackup=function(){var t,i,l,E=new s;E.streamMap={};var b=function(o){var g=_.streamMap[o];if(g){var m=[],T=[],C=[];(t=g.streamList)===null||t===void 0||t.forEach(function(y){m.push(y)}),(i=g.videoInfoList)===null||i===void 0||i.forEach(function(y){var A={msid:y.msid,ssrc:y.ssrc,transceiver:y.transceiver,subDone:y.subDone,pubDone:y.pubDone,streamId:y.streamId,codec:y.codec,pt:y.pt,from:y.from,type:y.type};T.push(A)}),(l=g.audioInfoList)===null||l===void 0||l.forEach(function(y){y.msid,y.ssrc,y.transceiver,y.subDone,y.pubDone,y.streamId,y.codec,y.pt,y.from,y.type,C.push(y)});var D={type:g.type,streamList:m,videoInfoList:T,audioInfoList:C,originUrl:g.originUrl};E.streamMap[o]=D}},_=this;for(var h in this.streamMap)b(h);return E},s.prototype.init=function(t,i){i===void 0&&(i=e.Subscribe);var l=(0,r.pruneSubUrl)(t);t=(0,r.pruneSubUrl)(t,!0),this.has(t)||(this.streamMap[t]={type:i,videoInfoList:[],audioInfoList:[],streamList:[],originUrl:l})},s.prototype.remove=function(t){delete this.streamMap[(0,r.pruneSubUrl)(t,!0)]},s.prototype.update=function(t,i){var l=this.get(t);if(!l)throw new Error("No url found");if(i.aMsid){var E=l.audioInfoList.find(function(_){return _.msid===i.aMsid})||this.createMediaItem(i.aMsid,"audio");i.aTransceiver&&(E.transceiver=i.aTransceiver),i.stream&&(E.streamId=i.stream.id),this.updateMediaInfoList(E,l.audioInfoList)}if(i.vMsid){var b=l.videoInfoList.find(function(_){return _.msid===i.vMsid})||this.createMediaItem(i.vMsid,"video");i.vTransceiver&&(b.transceiver=i.vTransceiver),i.stream&&(b.streamId=i.stream.id),this.updateMediaInfoList(b,l.videoInfoList)}i.stream&&(l.streamList.some(function(_){return _.id===i.stream.id})||(l.streamList=p(p([],l.streamList,!0),[i.stream],!1)))},s.prototype.pruneStreamList=function(t){var i=this.get(t);i&&(i.streamList=i.streamList.filter(function(l){var E;return((E=l.mediaStream)===null||E===void 0?void 0:E.getTracks().length)>0}))},s.prototype.updateSdpInfo=function(t,i){var l,E=this.get(t);if(!E)throw new Error("No url found");if(i.aMsid?l=E.audioInfoList.find(function(b){return b.msid===i.aMsid}):i.vMsid&&(l=E.videoInfoList.find(function(b){return b.msid===i.vMsid})),!l)throw new Error("No target media found");l.ssrc=i.ssrc,l.codec=i.codec,l.pt=i.pt,l.from=i.from},s.prototype.get=function(t){return this.streamMap[(0,r.pruneSubUrl)(t,!0)]},s.prototype.has=function(t){return!!this.get(t)},s.prototype.getSize=function(){return this.getSubOrPubDoneMediaMapSize()+this.getDcMapSize()},s.prototype.getSubOrPubDoneMediaMapSize=function(){var t=this,i=0;return Object.keys(this.streamMap).forEach(function(l){var E=t.streamMap[l],b=!1;E.audioInfoList.forEach(function(_){b=b||E.type===e.Publish&&_.pubDone||E.type===e.Subscribe&&_.subDone}),E.videoInfoList.forEach(function(_){b=b||E.type===e.Publish&&_.pubDone||E.type===e.Subscribe&&_.subDone}),b&&i++}),i},s.prototype.getDcMapSize=function(){return this.datachannelMap.size},s.prototype.removeMsid=function(t,i){t=(0,r.pruneSubUrl)(t,!0);var l=this.get(t);l&&(i.vMsid&&(l.videoInfoList=l.videoInfoList.filter(function(E){return E.msid!==i.vMsid})),i.aMsid&&(l.audioInfoList=l.audioInfoList.filter(function(E){return E.msid!==i.aMsid})))},s.prototype.getMids=function(t,i){i===void 0&&(i={filterSubDone:!1}),t=(0,r.pruneSubUrl)(t,!0);var l=this.streamMap[t];return l?p(p([],l.audioInfoList.reduce(function(E,b){return b.transceiver&&(!i.filterSubDone||i.filterSubDone&&!b.subDone)?p(p([],E,!0),[String(b.transceiver.mid)],!1):E},[]),!0),l.videoInfoList.reduce(function(E,b){return b.transceiver&&(!i.filterSubDone||i.filterSubDone&&!b.subDone)?p(p([],E,!0),[String(b.transceiver.mid)],!1):E},[]),!0):[]},s.prototype.getAllTransceivers=function(t){if(!t)return[];t=(0,r.pruneSubUrl)(t,!0);var i=this.get(t);return i?p(p([],i.videoInfoList.map(function(l){return l.transceiver}),!0),i.audioInfoList.map(function(l){return l.transceiver}),!0):[]},s.prototype.getTransceiver=function(t,i){if(i===void 0&&(i={}),t){t=(0,r.pruneSubUrl)(t,!0);var l=i.vMsid,E=i.aMsid,b=this.get(t);if(b){var _;if(l)return(_=b.videoInfoList.find(function(h){return h.msid===l}))==null?void 0:_.transceiver;if(E)return(_=b.audioInfoList.find(function(h){return h.msid===E}))==null?void 0:_.transceiver}}},s.prototype.getStreamByMsid=function(t){var i,l,E=this.get(t.url);if(E){if(t.vMsid){var b=(i=E.videoInfoList.find(function(h){return h.msid===t.vMsid}))===null||i===void 0?void 0:i.streamId;return E.streamList.find(function(h){return h.id===b})}if(t.aMsid){var _=(l=E.audioInfoList.find(function(h){return h.msid===t.aMsid}))===null||l===void 0?void 0:l.streamId;return E.streamList.find(function(h){return h.id===_})}return E.streamList[0]}},s.prototype.hasTransceiver=function(t,i){return i===void 0&&(i={}),!!this.getTransceiver(t,i)},s.prototype.removeTransceiver=function(t,i){t=(0,r.pruneSubUrl)(t,!0);var l,E=this.get(t);E&&(i.vMsid&&(l=E.videoInfoList.find(function(b){return b.msid===i.vMsid}))&&(l.transceiver=void 0),i.aMsid&&(l=E.audioInfoList.find(function(b){return b.msid===i.aMsid}))&&(l.transceiver=void 0))},s.prototype.markAlreadySubPub=function(t,i){i===void 0&&(i={}),t=(0,r.pruneSubUrl)(t,!0);var l,E=this.streamMap[t];E&&(i.vMsid&&(l=E.videoInfoList.find(function(b){return b.msid===i.vMsid}))&&(l[i.isPub?"pubDone":"subDone"]=!i.reset),i.aMsid&&(l=E.audioInfoList.find(function(b){return b.msid===i.aMsid}))&&(l[i.isPub?"pubDone":"subDone"]=!i.reset))},s.prototype.isMsidSubPubDone=function(t,i){i===void 0&&(i={}),t=(0,r.pruneSubUrl)(t,!0);var l=this.streamMap[t];if(!l)return!1;if(i.vMsid){var E=l.videoInfoList.find(function(b){return b.msid===i.vMsid});return i.isPub?E?.pubDone:E?.subDone}return i.aMsid?(E=l.audioInfoList.find(function(b){return b.msid===i.aMsid}),i.isPub?E?.pubDone:E?.subDone):void 0},s.prototype.getAllMediaInfoList=function(t,i){var l=this.get(t);return l?p(p([],l.audioInfoList.map(function(E){var b,_,h,o,g=E.type,m=E.msid,T=E.ssrc,C=E.pt,D=E.codec,y=E.from,A=E.transceiver,w={type:g,msid:m,ssrc:T,pt:C,codec:D,from:y,trackId:l.type===e.Subscribe?(_=(b=A?.receiver)===null||b===void 0?void 0:b.track)===null||_===void 0?void 0:_.id:(o=(h=A?.sender)===null||h===void 0?void 0:h.track)===null||o===void 0?void 0:o.id};return i?d(d({},w),{transceiver:A}):w}),!0),l.videoInfoList.map(function(E){var b,_,h,o,g=E.type,m=E.msid,T=E.ssrc,C=E.pt,D=E.codec,y=E.from,A=E.transceiver,w={type:g,msid:m,ssrc:T,pt:C,codec:D,from:y,trackId:l.type===e.Subscribe?(_=(b=A?.receiver)===null||b===void 0?void 0:b.track)===null||_===void 0?void 0:_.id:(o=(h=A?.sender)===null||h===void 0?void 0:h.track)===null||o===void 0?void 0:o.id};return i?d(d({},w),{transceiver:A}):w}),!0):[]},s.prototype.getOriginUrl=function(t){var i=(0,r.pruneSubUrl)(t,!0),l=this.get(i);return l?l.originUrl:t},s.prototype.getAllTrackPairList=function(t){var i,l,E,b,_=[];for(var h in this.streamMap){var o=this.streamMap[h];if(o.type===t)for(var g=Math.max(o.audioInfoList.length,o.videoInfoList.length),m=0;m<g;m++){var T={url:h,originUrl:o.originUrl};m<o.audioInfoList.length&&(T.aTransceiver=t===e.Subscribe?(i=o.audioInfoList[m].transceiver)===null||i===void 0?void 0:i.receiver:(l=o.audioInfoList[m].transceiver)===null||l===void 0?void 0:l.sender,T.aMsid=o.audioInfoList[m].msid),m<o.videoInfoList.length&&(T.vTransceiver=t===e.Subscribe?(E=o.videoInfoList[m].transceiver)===null||E===void 0?void 0:E.receiver:(b=o.videoInfoList[m].transceiver)===null||b===void 0?void 0:b.sender,T.vMsid=o.videoInfoList[m].msid),_.push(T)}}return _},s.prototype.getAllStreamListWithMsids=function(){var t,i=[];for(var l in this.streamMap){for(var E=this.streamMap[l],b=Math.max(E.audioInfoList.length,E.videoInfoList.length,E.streamList.length),_={url:l,msids:[],type:E.type,latestUrl:E.latestUrl||E.originUrl,streams:[]},h=0;h<b;h++){if(h<E.audioInfoList.length&&E.audioInfoList[h].msid){var o=E.audioInfoList[h];o.msid&&(E.type===e.Publish&&o.pubDone||E.type===e.Subscribe&&o.subDone)&&_.msids.push({name:o.msid||"",type:o.type||"audio",streamId:o.streamId})}if(h<E.videoInfoList.length&&E.videoInfoList[h].msid){var g=E.videoInfoList[h];g.msid&&(E.type===e.Publish&&g.pubDone||E.type===e.Subscribe&&g.subDone)&&_.msids.push({name:g.msid||"",type:g.type||"video",streamId:g.streamId})}h<E.streamList.length&&E.streamList[h]&&((t=_.streams)===null||t===void 0||t.push(E.streamList[h]))}_.msids.length&&i.push(_)}return i},s.prototype.getSender=function(t,i,l){var E,b,_=void 0,h=this.getAllMediaInfoList(t,!0);return l?h.forEach(function(o){var g,m,T,C=(m=(g=o.transceiver)===null||g===void 0?void 0:g.sender)===null||m===void 0?void 0:m.track;C?.kind===i&&o.msid===l&&(_=(T=o.transceiver)===null||T===void 0?void 0:T.sender)}):_=(b=(E=h?.find(function(o){var g,m,T;return((T=(m=(g=o.transceiver)===null||g===void 0?void 0:g.sender)===null||m===void 0?void 0:m.track)===null||T===void 0?void 0:T.kind)===i}))===null||E===void 0?void 0:E.transceiver)===null||b===void 0?void 0:b.sender,_},s.prototype.getReceiver=function(t,i,l){var E,b,_=void 0,h=this.getAllMediaInfoList(t,!0);return l?h.forEach(function(o){var g,m,T,C=(m=(g=o.transceiver)===null||g===void 0?void 0:g.receiver)===null||m===void 0?void 0:m.track;C?.kind===i&&o.msid===l&&(_=(T=o.transceiver)===null||T===void 0?void 0:T.receiver)}):_=(b=(E=h?.find(function(o){var g,m,T;return((T=(m=(g=o.transceiver)===null||g===void 0?void 0:g.receiver)===null||m===void 0?void 0:m.track)===null||T===void 0?void 0:T.kind)===i}))===null||E===void 0?void 0:E.transceiver)===null||b===void 0?void 0:b.receiver,_},s.prototype.dispose=function(){this.streamMap={}},s.prototype.updateMediaInfoList=function(t,i){var l=i.findIndex(function(E){return E.msid===t.msid});l!==-1?i.splice(l,1,t):i.push(t)},s.prototype.findMediaItemByMsid=function(t,i){return i.find(function(l){return l.msid===t})},s.prototype.createMediaItem=function(t,i){return{msid:t,ssrc:void 0,transceiver:void 0,subDone:!1,pubDone:!1,type:i,streamId:void 0}},s.prototype.addOrUpdateDatachannelItem=function(t){var i=this.datachannelMap.get(t.url);i?t.msids.forEach(function(l){i.msids.find(function(E){if(E.id===l.id&&E.name===l.name)return!0})?console.log("RTS [STREAM MANAGER]: duplicate msid for datachannel",t):i.msids.push(l)}):this.datachannelMap.set(t.url,t)},s.prototype.deleteDatachannelItem=function(t){this.datachannelMap.delete(t.url)},s.prototype.getAllDatachannelList=function(){var t=[];return this.datachannelMap.forEach(function(i){t.push(d(d({},i),{latestUrl:i.latestUrl||i.originUrl}))}),t},s.prototype.getDatachannelByMsid=function(t){var i;if(t.url){var l=this.datachannelMap.get((0,r.pruneSubUrl)(t.url,!0));if(l)return t.msid?(i=l.msids.find(function(E){return E.name===t.msid}))===null||i===void 0?void 0:i.datachannel:l.msids[0].datachannel}else console.warn("[getDatachannelByMsid] config.url is required.")},s.prototype.getPubOrSubDoneMediaUrlByIndex=function(t){var i=0,l=function(h){var o=E.streamMap[h],g=!1;if(o.audioInfoList.forEach(function(m){g=g||o.type===e.Publish&&m.pubDone||o.type===e.Subscribe&&m.subDone}),o.videoInfoList.forEach(function(m){g=g||o.type===e.Publish&&m.pubDone||o.type===e.Subscribe&&m.subDone}),g){if(i===t)return{value:h};i++}},E=this;for(var b in this.streamMap){var _=l(b);if(typeof _=="object")return _.value}},s.prototype.getDcUrlByIndex=function(t){var i=void 0;return this.datachannelMap.forEach(function(l){t===0&&(i={url:l.originUrl})}),i},s.prototype.updateLatestUrl=function(t){var i=this.get(t);return!!i&&(i.latestUrl=t,!0)},s}();f.StreamManager=n}},v={};function c(S){var f=v[S];if(f!==void 0)return f.exports;var a=v[S]={exports:{}};return x[S].call(a.exports,a,a.exports,c),a.exports}var u={};return(()=>{var S=u;Object.defineProperty(S,"__esModule",{value:!0}),S.DataChannelCore=S.EDatachannelStatus=S.PeerConnectionCore=void 0;var f=c(776);Object.defineProperty(S,"PeerConnectionCore",{enumerable:!0,get:function(){return f.PeerConnectionCore}}),Object.defineProperty(S,"EDatachannelStatus",{enumerable:!0,get:function(){return f.EDatachannelStatus}});var a=c(651);Object.defineProperty(S,"DataChannelCore",{enumerable:!0,get:function(){return a.DataChannelCore}})})(),u})(),L.exports=R()},2505:(L,R,x)=>{L.exports=x(8015)},5592:(L,R,x)=>{var v=x(9516),c=x(7522),u=x(3948),S=x(9106),f=x(9615),a=x(2012),d=x(4202),p=x(7763);L.exports=function(e){return new Promise(function(r,n){var s=e.data,t=e.headers,i=e.responseType;v.isFormData(s)&&delete t["Content-Type"];var l=new XMLHttpRequest;if(e.auth){var E=e.auth.username||"",b=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";t.Authorization="Basic "+btoa(E+":"+b)}var _=f(e.baseURL,e.url);function h(){if(l){var g="getAllResponseHeaders"in l?a(l.getAllResponseHeaders()):null,m={data:i&&i!=="text"&&i!=="json"?l.response:l.responseText,status:l.status,statusText:l.statusText,headers:g,config:e,request:l};c(r,n,m),l=null}}if(l.open(e.method.toUpperCase(),S(_,e.params,e.paramsSerializer),!0),l.timeout=e.timeout,"onloadend"in l?l.onloadend=h:l.onreadystatechange=function(){l&&l.readyState===4&&(l.status!==0||l.responseURL&&l.responseURL.indexOf("file:")===0)&&setTimeout(h)},l.onabort=function(){l&&(n(p("Request aborted",e,"ECONNABORTED",l)),l=null)},l.onerror=function(){n(p("Network Error",e,null,l)),l=null},l.ontimeout=function(){var g="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(g=e.timeoutErrorMessage),n(p(g,e,e.transitional&&e.transitional.clarifyTimeoutError?"ETIMEDOUT":"ECONNABORTED",l)),l=null},v.isStandardBrowserEnv()){var o=(e.withCredentials||d(_))&&e.xsrfCookieName?u.read(e.xsrfCookieName):void 0;o&&(t[e.xsrfHeaderName]=o)}"setRequestHeader"in l&&v.forEach(t,function(g,m){s===void 0&&m.toLowerCase()==="content-type"?delete t[m]:l.setRequestHeader(m,g)}),v.isUndefined(e.withCredentials)||(l.withCredentials=!!e.withCredentials),i&&i!=="json"&&(l.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&l.addEventListener("progress",e.onDownloadProgress),typeof e.onUploadProgress=="function"&&l.upload&&l.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then(function(g){l&&(l.abort(),n(g),l=null)}),s||(s=null),l.send(s)})}},8015:(L,R,x)=>{var v=x(9516),c=x(9012),u=x(5155),S=x(5343);function f(d){var p=new u(d),e=c(u.prototype.request,p);return v.extend(e,u.prototype,p),v.extend(e,p),e}var a=f(x(6987));a.Axios=u,a.create=function(d){return f(S(a.defaults,d))},a.Cancel=x(1928),a.CancelToken=x(3191),a.isCancel=x(3864),a.all=function(d){return Promise.all(d)},a.spread=x(7980),a.isAxiosError=x(5019),L.exports=a,L.exports.default=a},1928:L=>{function R(x){this.message=x}R.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},R.prototype.__CANCEL__=!0,L.exports=R},3191:(L,R,x)=>{var v=x(1928);function c(u){if(typeof u!="function")throw new TypeError("executor must be a function.");var S;this.promise=new Promise(function(a){S=a});var f=this;u(function(a){f.reason||(f.reason=new v(a),S(f.reason))})}c.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},c.source=function(){var u;return{token:new c(function(S){u=S}),cancel:u}},L.exports=c},3864:L=>{L.exports=function(R){return!(!R||!R.__CANCEL__)}},5155:(L,R,x)=>{var v=x(9516),c=x(9106),u=x(3471),S=x(4490),f=x(5343),a=x(4841),d=a.validators;function p(e){this.defaults=e,this.interceptors={request:new u,response:new u}}p.prototype.request=function(e){typeof e=="string"?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=f(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var r=e.transitional;r!==void 0&&a.assertOptions(r,{silentJSONParsing:d.transitional(d.boolean,"1.0.0"),forcedJSONParsing:d.transitional(d.boolean,"1.0.0"),clarifyTimeoutError:d.transitional(d.boolean,"1.0.0")},!1);var n=[],s=!0;this.interceptors.request.forEach(function(h){typeof h.runWhen=="function"&&h.runWhen(e)===!1||(s=s&&h.synchronous,n.unshift(h.fulfilled,h.rejected))});var t,i=[];if(this.interceptors.response.forEach(function(h){i.push(h.fulfilled,h.rejected)}),!s){var l=[S,void 0];for(Array.prototype.unshift.apply(l,n),l=l.concat(i),t=Promise.resolve(e);l.length;)t=t.then(l.shift(),l.shift());return t}for(var E=e;n.length;){var b=n.shift(),_=n.shift();try{E=b(E)}catch(h){_(h);break}}try{t=S(E)}catch(h){return Promise.reject(h)}for(;i.length;)t=t.then(i.shift(),i.shift());return t},p.prototype.getUri=function(e){return e=f(this.defaults,e),c(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},v.forEach(["delete","get","head","options"],function(e){p.prototype[e]=function(r,n){return this.request(f(n||{},{method:e,url:r,data:(n||{}).data}))}}),v.forEach(["post","put","patch"],function(e){p.prototype[e]=function(r,n,s){return this.request(f(s||{},{method:e,url:r,data:n}))}}),L.exports=p},3471:(L,R,x)=>{var v=x(9516);function c(){this.handlers=[]}c.prototype.use=function(u,S,f){return this.handlers.push({fulfilled:u,rejected:S,synchronous:!!f&&f.synchronous,runWhen:f?f.runWhen:null}),this.handlers.length-1},c.prototype.eject=function(u){this.handlers[u]&&(this.handlers[u]=null)},c.prototype.forEach=function(u){v.forEach(this.handlers,function(S){S!==null&&u(S)})},L.exports=c},9615:(L,R,x)=>{var v=x(9137),c=x(4680);L.exports=function(u,S){return u&&!v(S)?c(u,S):S}},7763:(L,R,x)=>{var v=x(5449);L.exports=function(c,u,S,f,a){var d=new Error(c);return v(d,u,S,f,a)}},4490:(L,R,x)=>{var v=x(9516),c=x(2881),u=x(3864),S=x(6987);function f(a){a.cancelToken&&a.cancelToken.throwIfRequested()}L.exports=function(a){return f(a),a.headers=a.headers||{},a.data=c.call(a,a.data,a.headers,a.transformRequest),a.headers=v.merge(a.headers.common||{},a.headers[a.method]||{},a.headers),v.forEach(["delete","get","head","post","put","patch","common"],function(d){delete a.headers[d]}),(a.adapter||S.adapter)(a).then(function(d){return f(a),d.data=c.call(a,d.data,d.headers,a.transformResponse),d},function(d){return u(d)||(f(a),d&&d.response&&(d.response.data=c.call(a,d.response.data,d.response.headers,a.transformResponse))),Promise.reject(d)})}},5449:L=>{L.exports=function(R,x,v,c,u){return R.config=x,v&&(R.code=v),R.request=c,R.response=u,R.isAxiosError=!0,R.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},R}},5343:(L,R,x)=>{var v=x(9516);L.exports=function(c,u){u=u||{};var S={},f=["url","method","data"],a=["headers","auth","proxy","params"],d=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],p=["validateStatus"];function e(t,i){return v.isPlainObject(t)&&v.isPlainObject(i)?v.merge(t,i):v.isPlainObject(i)?v.merge({},i):v.isArray(i)?i.slice():i}function r(t){v.isUndefined(u[t])?v.isUndefined(c[t])||(S[t]=e(void 0,c[t])):S[t]=e(c[t],u[t])}v.forEach(f,function(t){v.isUndefined(u[t])||(S[t]=e(void 0,u[t]))}),v.forEach(a,r),v.forEach(d,function(t){v.isUndefined(u[t])?v.isUndefined(c[t])||(S[t]=e(void 0,c[t])):S[t]=e(void 0,u[t])}),v.forEach(p,function(t){t in u?S[t]=e(c[t],u[t]):t in c&&(S[t]=e(void 0,c[t]))});var n=f.concat(a).concat(d).concat(p),s=Object.keys(c).concat(Object.keys(u)).filter(function(t){return n.indexOf(t)===-1});return v.forEach(s,r),S}},7522:(L,R,x)=>{var v=x(7763);L.exports=function(c,u,S){var f=S.config.validateStatus;S.status&&f&&!f(S.status)?u(v("Request failed with status code "+S.status,S.config,null,S.request,S)):c(S)}},2881:(L,R,x)=>{var v=x(9516),c=x(6987);L.exports=function(u,S,f){var a=this||c;return v.forEach(f,function(d){u=d.call(a,u,S)}),u}},6987:(L,R,x)=>{var v=x(9516),c=x(7018),u=x(5449),S={"Content-Type":"application/x-www-form-urlencoded"};function f(p,e){!v.isUndefined(p)&&v.isUndefined(p["Content-Type"])&&(p["Content-Type"]=e)}var a,d={transitional:{silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},adapter:((typeof XMLHttpRequest<"u"||typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]")&&(a=x(5592)),a),transformRequest:[function(p,e){return c(e,"Accept"),c(e,"Content-Type"),v.isFormData(p)||v.isArrayBuffer(p)||v.isBuffer(p)||v.isStream(p)||v.isFile(p)||v.isBlob(p)?p:v.isArrayBufferView(p)?p.buffer:v.isURLSearchParams(p)?(f(e,"application/x-www-form-urlencoded;charset=utf-8"),p.toString()):v.isObject(p)||e&&e["Content-Type"]==="application/json"?(f(e,"application/json"),function(r,n,s){if(v.isString(r))try{return(n||JSON.parse)(r),v.trim(r)}catch(t){if(t.name!=="SyntaxError")throw t}return(0,JSON.stringify)(r)}(p)):p}],transformResponse:[function(p){var e=this.transitional,r=e&&e.silentJSONParsing,n=e&&e.forcedJSONParsing,s=!r&&this.responseType==="json";if(s||n&&v.isString(p)&&p.length)try{return JSON.parse(p)}catch(t){if(s)throw t.name==="SyntaxError"?u(t,this,"E_JSON_PARSE"):t}return p}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(p){return p>=200&&p<300}};d.headers={common:{Accept:"application/json, text/plain, */*"}},v.forEach(["delete","get","head"],function(p){d.headers[p]={}}),v.forEach(["post","put","patch"],function(p){d.headers[p]=v.merge(S)}),L.exports=d},9012:L=>{L.exports=function(R,x){return function(){for(var v=new Array(arguments.length),c=0;c<v.length;c++)v[c]=arguments[c];return R.apply(x,v)}}},9106:(L,R,x)=>{var v=x(9516);function c(u){return encodeURIComponent(u).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}L.exports=function(u,S,f){if(!S)return u;var a;if(f)a=f(S);else if(v.isURLSearchParams(S))a=S.toString();else{var d=[];v.forEach(S,function(e,r){e!=null&&(v.isArray(e)?r+="[]":e=[e],v.forEach(e,function(n){v.isDate(n)?n=n.toISOString():v.isObject(n)&&(n=JSON.stringify(n)),d.push(c(r)+"="+c(n))}))}),a=d.join("&")}if(a){var p=u.indexOf("#");p!==-1&&(u=u.slice(0,p)),u+=(u.indexOf("?")===-1?"?":"&")+a}return u}},4680:L=>{L.exports=function(R,x){return x?R.replace(/\/+$/,"")+"/"+x.replace(/^\/+/,""):R}},3948:(L,R,x)=>{var v=x(9516);L.exports=v.isStandardBrowserEnv()?{write:function(c,u,S,f,a,d){var p=[];p.push(c+"="+encodeURIComponent(u)),v.isNumber(S)&&p.push("expires="+new Date(S).toGMTString()),v.isString(f)&&p.push("path="+f),v.isString(a)&&p.push("domain="+a),d===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(c){var u=document.cookie.match(new RegExp("(^|;\\s*)("+c+")=([^;]*)"));return u?decodeURIComponent(u[3]):null},remove:function(c){this.write(c,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}}},9137:L=>{L.exports=function(R){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(R)}},5019:L=>{L.exports=function(R){return typeof R=="object"&&R.isAxiosError===!0}},4202:(L,R,x)=>{var v=x(9516);L.exports=v.isStandardBrowserEnv()?function(){var c,u=/(msie|trident)/i.test(navigator.userAgent),S=document.createElement("a");function f(a){var d=a;return u&&(S.setAttribute("href",d),d=S.href),S.setAttribute("href",d),{href:S.href,protocol:S.protocol?S.protocol.replace(/:$/,""):"",host:S.host,search:S.search?S.search.replace(/^\?/,""):"",hash:S.hash?S.hash.replace(/^#/,""):"",hostname:S.hostname,port:S.port,pathname:S.pathname.charAt(0)==="/"?S.pathname:"/"+S.pathname}}return c=f(window.location.href),function(a){var d=v.isString(a)?f(a):a;return d.protocol===c.protocol&&d.host===c.host}}():function(){return!0}},7018:(L,R,x)=>{var v=x(9516);L.exports=function(c,u){v.forEach(c,function(S,f){f!==u&&f.toUpperCase()===u.toUpperCase()&&(c[u]=S,delete c[f])})}},2012:(L,R,x)=>{var v=x(9516),c=["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"];L.exports=function(u){var S,f,a,d={};return u&&v.forEach(u.split(`
78
78
  `),function(p){if(a=p.indexOf(":"),S=v.trim(p.substr(0,a)).toLowerCase(),f=v.trim(p.substr(a+1)),S){if(d[S]&&c.indexOf(S)>=0)return;d[S]=S==="set-cookie"?(d[S]?d[S]:[]).concat([f]):d[S]?d[S]+", "+f:f}}),d}},7980:L=>{L.exports=function(R){return function(x){return R.apply(null,x)}}},4841:(L,R,x)=>{var v=x(4198),c={};["object","boolean","number","function","string","symbol"].forEach(function(a,d){c[a]=function(p){return typeof p===a||"a"+(d<1?"n ":" ")+a}});var u={},S=v.version.split(".");function f(a,d){for(var p=d?d.split("."):S,e=a.split("."),r=0;r<3;r++){if(p[r]>e[r])return!0;if(p[r]<e[r])return!1}return!1}c.transitional=function(a,d,p){var e=d&&f(d);function r(n,s){return"[Axios v"+v.version+"] Transitional option '"+n+"'"+s+(p?". "+p:"")}return function(n,s,t){if(a===!1)throw new Error(r(s," has been removed in "+d));return e&&!u[s]&&(u[s]=!0,console.warn(r(s," has been deprecated since v"+d+" and will be removed in the near future"))),!a||a(n,s,t)}},L.exports={isOlderVersion:f,assertOptions:function(a,d,p){if(typeof a!="object")throw new TypeError("options must be an object");for(var e=Object.keys(a),r=e.length;r-- >0;){var n=e[r],s=d[n];if(s){var t=a[n],i=t===void 0||s(t,n,a);if(i!==!0)throw new TypeError("option "+n+" must be "+i)}else if(p!==!0)throw Error("Unknown option "+n)}},validators:c}},9516:(L,R,x)=>{var v=x(9012),c=Object.prototype.toString;function u(e){return c.call(e)==="[object Array]"}function S(e){return e===void 0}function f(e){return e!==null&&typeof e=="object"}function a(e){if(c.call(e)!=="[object Object]")return!1;var r=Object.getPrototypeOf(e);return r===null||r===Object.prototype}function d(e){return c.call(e)==="[object Function]"}function p(e,r){if(e!=null)if(typeof e!="object"&&(e=[e]),u(e))for(var n=0,s=e.length;n<s;n++)r.call(null,e[n],n,e);else for(var t in e)Object.prototype.hasOwnProperty.call(e,t)&&r.call(null,e[t],t,e)}L.exports={isArray:u,isArrayBuffer:function(e){return c.call(e)==="[object ArrayBuffer]"},isBuffer:function(e){return e!==null&&!S(e)&&e.constructor!==null&&!S(e.constructor)&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)},isFormData:function(e){return typeof FormData<"u"&&e instanceof FormData},isArrayBufferView:function(e){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return typeof e=="string"},isNumber:function(e){return typeof e=="number"},isObject:f,isPlainObject:a,isUndefined:S,isDate:function(e){return c.call(e)==="[object Date]"},isFile:function(e){return c.call(e)==="[object File]"},isBlob:function(e){return c.call(e)==="[object Blob]"},isFunction:d,isStream:function(e){return f(e)&&d(e.pipe)},isURLSearchParams:function(e){return typeof URLSearchParams<"u"&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return(typeof navigator>"u"||navigator.product!=="ReactNative"&&navigator.product!=="NativeScript"&&navigator.product!=="NS")&&typeof window<"u"&&typeof document<"u"},forEach:p,merge:function e(){var r={};function n(i,l){a(r[l])&&a(i)?r[l]=e(r[l],i):a(i)?r[l]=e({},i):u(i)?r[l]=i.slice():r[l]=i}for(var s=0,t=arguments.length;s<t;s++)p(arguments[s],n);return r},extend:function(e,r,n){return p(r,function(s,t){e[t]=n&&typeof s=="function"?v(s,n):s}),e},trim:function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},stripBOM:function(e){return e.charCodeAt(0)===65279&&(e=e.slice(1)),e}}},3412:L=>{/*! media-device - ver 1.3.0-beta.0 created:2024/3/20 10:32:34 */L.exports=(()=>{var R={304:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.BrowserDeviceManager=void 0;var S=u(101),f=u(853),a=u(62),d=u(913),p=u(331),e=u(1),r=u(935),n=u(603),s=function(){function t(){this.systemUtil=new S.SystemUtil,this.deviceManager=this.createDeviceManager()}return t.prototype.getCameraList=function(){return this.deviceManager.getCameraList()},t.prototype.getMicList=function(){return this.deviceManager.getMicList()},t.prototype.getSpeakerList=function(){return this.deviceManager.getSpeakerList()},t.prototype.getAudioTrack=function(i){return this.deviceManager.getAudioTrack(i)},t.prototype.getVideoTrack=function(i){return this.deviceManager.getVideoTrack(i)},t.prototype.getScreenTrack=function(i){return this.deviceManager.getScreenTrack(i)},t.prototype.getAudioStream=function(i){return this.deviceManager.getAudioStream(i)},t.prototype.getVideoStream=function(i){return this.deviceManager.getVideoStream(i)},t.prototype.getScreenStream=function(i){return this.deviceManager.getScreenStream(i)},t.prototype.checkSupportScreenShare=function(){return this.deviceManager.checkSupportScreenShare()},t.prototype.createDeviceManager=function(){return this.systemUtil.isWindows?new r.WindowsDeviceManager:this.systemUtil.isAndroid?new f.AndroidDeviceManager:this.systemUtil.isIos?new d.IosDeviceManager:this.systemUtil.isMacOS?new e.MacDeviceManager:this.systemUtil.isLinux?new p.LinuxDeviceManager:new a.BaseDeviceManager},t.isDeviceManagerError=n.DeviceError.isDeviceManagerError,t}();c.BrowserDeviceManager=s},603:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.DeviceError=c.DeviceErrorDescription=c.DeviceErrorCode=void 0;var S=u(610);(function(a){a[a.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",a[a.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",a[a.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",a[a.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",a[a.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",a[a.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",a[a.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",a[a.ERROR_DEIVCE_CONSTRAINEDERROR=10007]="ERROR_DEIVCE_CONSTRAINEDERROR",a[a.ERROR_SCREENSHARE_UNKNOWNERRO=10010]="ERROR_SCREENSHARE_UNKNOWNERRO",a[a.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",a[a.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",a[a.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",a[a.ERROR_SCREENSHARE_INVALIDACCESS=10014]="ERROR_SCREENSHARE_INVALIDACCESS",a[a.ERROR_SCREENSHARE_NOTSUPPORT=10018]="ERROR_SCREENSHARE_NOTSUPPORT",a[a.ERROR_DEVICE_NOTSUPPORT=10019]="ERROR_DEVICE_NOTSUPPORT"})(c.DeviceErrorCode||(c.DeviceErrorCode={})),function(a){a.ERRORMESSAGE_DEVICENOTFOUND="Requested device not found",a.ERRORMESSAGE_DEVICENOTALLOWED="Permission denied",a.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE="Permission denied by system",a.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED="The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.",a.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED="video device not allowed",a.ERRORMESSAGE_AUDIODEVICENOTREADABLE="Could not start audio source",a.ERRORMESSAGE_VIDEODEVICENOTREADABLE="Could not start video source",a.ERRORNAME_DEVICENOTFOUND="NotFoundError",a.ERRORNAME_DEVICENOTALLOWED="NotAllowedError",a.ERRORNAME_DEVICENOTREADABLE="NotReadableError",a.ERRORNAME_DEVICEOVERCONSTRAINED="OverconstrainedError",a.ERRORNAME_INVALID_ACCESS="InvalidAccessError"}(c.DeviceErrorDescription||(c.DeviceErrorDescription={}));var f=function(){function a(d,p){this.linkUtil=new S.LinkUtil,this.code=d,this.reason=p,this.relatedLink=this.linkUtil.getRelatedLink(d)}return a.isDeviceManagerError=function(d){return!!(d&&typeof d=="object"&&"code"in d&&"reason"in d)},a}();c.DeviceError=f},873:(v,c)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.FacingMode=c.DeviceType=c.MobileCameraType=void 0,function(u){u[u.USER=0]="USER",u[u.ENV=1]="ENV"}(c.MobileCameraType||(c.MobileCameraType={})),function(u){u.Camera="videoinput",u.Mic="audioinput",u.Screen="screen",u.Speaker="audiooutput"}(c.DeviceType||(c.DeviceType={})),function(u){u.USER="user",u.ENVIRONMENT="environment"}(c.FacingMode||(c.FacingMode={}))},853:function(v,c,u){var S,f=this&&this.__extends||(S=function(d,p){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(d,p)},function(d,p){function e(){this.constructor=d}S(d,p),d.prototype=p===null?Object.create(p):(e.prototype=p.prototype,new e)});Object.defineProperty(c,"__esModule",{value:!0}),c.AndroidDeviceManager=void 0;var a=function(d){function p(){return d.call(this)||this}return f(p,d),p}(u(583).MobileDeviceManager);c.AndroidDeviceManager=a},62:function(v,c,u){var S=this&&this.__assign||function(){return(S=Object.assign||function(p){for(var e,r=1,n=arguments.length;r<n;r++)for(var s in e=arguments[r])Object.prototype.hasOwnProperty.call(e,s)&&(p[s]=e[s]);return p}).apply(this,arguments)};Object.defineProperty(c,"__esModule",{value:!0}),c.BaseDeviceManager=void 0;var f=u(603),a=u(873),d=function(){function p(){}return p.prototype.checkSupportScreenShare=function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia&&navigator.mediaDevices.getDisplayMedia)},p.prototype.getCameraList=function(){var e=this;return new Promise(function(r,n){e.checkSupport()?e.getDeviceRight(a.DeviceType.Camera).then(function(){e.getDeviceList(a.DeviceType.Camera).then(function(s){r(s)}).catch(function(s){n(e.parseError(a.DeviceType.Camera,s))})}).catch(function(s){n(e.parseError(a.DeviceType.Camera,s))}):n(new f.DeviceError(f.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},p.prototype.getMicList=function(){var e=this;return new Promise(function(r,n){e.checkSupport()?e.getDeviceRight(a.DeviceType.Mic).then(function(){e.getDeviceList(a.DeviceType.Mic).then(function(s){r(s)}).catch(function(s){n(e.parseError(a.DeviceType.Mic,s))})}).catch(function(s){n(e.parseError(a.DeviceType.Mic,s))}):n(new f.DeviceError(f.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},p.prototype.getSpeakerList=function(){var e=this;return new Promise(function(r,n){e.checkSupport()?e.getDeviceRight(a.DeviceType.Speaker).then(function(){e.getDeviceList(a.DeviceType.Speaker).then(function(s){r(s)}).catch(function(s){n(e.parseError(a.DeviceType.Speaker,s))})}).catch(function(s){n(e.parseError(a.DeviceType.Speaker,s))}):n(new f.DeviceError(f.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},p.prototype.getAudioTrack=function(e){return this.getAudioStream(e).then(function(r){return r.getAudioTracks()[0]})},p.prototype.getAudioStream=function(e){var r=this;return new Promise(function(n,s){if(r.checkSupport()){var t=r.createAudioConstraints(e);navigator.mediaDevices.getUserMedia(t).then(function(i){n(i)}).catch(function(i){s(r.parseError(a.DeviceType.Mic,i))})}else s(new f.DeviceError(f.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},p.prototype.getVideoTrack=function(e){return this.getVideoStream(e).then(function(r){return r.getVideoTracks()[0]})},p.prototype.getVideoStream=function(e){var r=this;return new Promise(function(n,s){if(r.checkSupport()){var t=r.createVideoConstraints(e);navigator.mediaDevices.getUserMedia(t).then(function(i){n(i)}).catch(function(i){s(r.parseError(a.DeviceType.Camera,i))})}else s(new f.DeviceError(f.DeviceErrorCode.ERROR_DEVICE_NOTSUPPORT,"not support navigator.mediaDevices"))})},p.prototype.getScreenTrack=function(e){return this.getScreenStream(e).then(function(r){return r.getTracks()})},p.prototype.getScreenStream=function(e){var r=this;return new Promise(function(n,s){r.checkSupportScreenShare()?navigator.mediaDevices.getDisplayMedia(e).then(function(t){n(t)}).catch(function(t){s(r.parseError(a.DeviceType.Screen,t))}):s(new f.DeviceError(f.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"browser not support screenshare"))})},p.prototype.checkSupport=function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.enumerateDevices&&navigator.mediaDevices.getUserMedia)},p.prototype.getDeviceList=function(e){return new Promise(function(r,n){navigator.mediaDevices.enumerateDevices().then(function(s){var t=[];s.forEach(function(i){i.kind===e&&t.push(i)}),r(t)}).catch(function(s){n(s)})})},p.prototype.getDeviceRight=function(e){return new Promise(function(r,n){var s;a.DeviceType.Camera===e?s={video:!0}:a.DeviceType.Mic!==e&&a.DeviceType.Speaker!==e||(s={audio:!0}),navigator.mediaDevices.getUserMedia(s).then(function(t){t.getTracks().forEach(function(i){i.stop()}),r(void 0)}).catch(function(t){r(void 0)})})},p.prototype.parseError=function(e,r){var n=null;return a.DeviceType.Mic===e?n=this.parseAudioError(r):a.DeviceType.Camera===e?n=this.parseVideoError(r):a.DeviceType.Screen===e&&(n=this.parseScreenError(r)),n===null?new f.DeviceError(f.DeviceErrorCode.ERROR_DEVICE_UNKNOWNERROR,""):n},p.prototype.parseAudioError=function(e){return e.message===f.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||e.name===f.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new f.DeviceError(f.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTFOUND,"audio device not found"):e.message===f.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||e.message===f.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new f.DeviceError(f.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED,"audio device not allowed"):e.message===f.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||e.message===f.DeviceErrorDescription.ERRORMESSAGE_AUDIODEVICENOTREADABLE||e.message===f.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new f.DeviceError(f.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE,"audio device not readable"):null},p.prototype.parseVideoError=function(e){return e.message===f.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTFOUND||e.name===f.DeviceErrorDescription.ERRORNAME_DEVICENOTFOUND?new f.DeviceError(f.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTFOUND,"video device not found"):e.message===f.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED||e.message===f.DeviceErrorDescription.ERRORMESSAGE_MOBILEDEVICE_NOTALLOWED||e.message===f.DeviceErrorDescription.ERRORMESSAGE_MACSAFARI_DEVICENOTALLOWED?new f.DeviceError(f.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED,"video device not allowed"):e.message===f.DeviceErrorDescription.ERRORMESSAGE_MACCHROME_DEVICENOTREADABLE||e.message===f.DeviceErrorDescription.ERRORMESSAGE_VIDEODEVICENOTREADABLE||e.name===f.DeviceErrorDescription.ERRORNAME_DEVICENOTREADABLE?new f.DeviceError(f.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE,"video device not readable"):null},p.prototype.parseScreenError=function(e){return e.name===f.DeviceErrorDescription.ERRORNAME_DEVICENOTALLOWED?e.message===f.DeviceErrorDescription.ERRORMESSAGE_DEVICENOTALLOWED?new f.DeviceError(f.DeviceErrorCode.ERROR_SCREENSHARE_NOTALLOWED,e.message):new f.DeviceError(f.DeviceErrorCode.ERROR_SCREENSHARE_NOPERMISSION,e.message):e.name===f.DeviceErrorDescription.ERRORNAME_INVALID_ACCESS?new f.DeviceError(f.DeviceErrorCode.ERROR_SCREENSHARE_INVALIDACCESS,e.message):null},p.prototype.createVideoConstraints=function(e){return e.deviceId||e.width||e.height||e.frameRate?{video:{deviceId:{exact:e.deviceId},width:e.width,height:e.height,frameRate:e.frameRate}}:{video:!0}},p.prototype.createAudioConstraints=function(e){var r={audio:e},n=S({},e);return n.deviceId||delete n.deviceId,Object.keys(n).length===0&&(r={audio:!0}),r},p}();c.BaseDeviceManager=d},913:function(v,c,u){var S,f=this&&this.__extends||(S=function(d,p){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(d,p)},function(d,p){function e(){this.constructor=d}S(d,p),d.prototype=p===null?Object.create(p):(e.prototype=p.prototype,new e)});Object.defineProperty(c,"__esModule",{value:!0}),c.IosDeviceManager=void 0;var a=function(d){function p(){return d.call(this)||this}return f(p,d),p}(u(583).MobileDeviceManager);c.IosDeviceManager=a},331:function(v,c,u){var S,f=this&&this.__extends||(S=function(d,p){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(d,p)},function(d,p){function e(){this.constructor=d}S(d,p),d.prototype=p===null?Object.create(p):(e.prototype=p.prototype,new e)});Object.defineProperty(c,"__esModule",{value:!0}),c.LinuxDeviceManager=void 0;var a=function(d){function p(){return d.call(this)||this}return f(p,d),p}(u(62).BaseDeviceManager);c.LinuxDeviceManager=a},1:function(v,c,u){var S,f=this&&this.__extends||(S=function(d,p){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(d,p)},function(d,p){function e(){this.constructor=d}S(d,p),d.prototype=p===null?Object.create(p):(e.prototype=p.prototype,new e)});Object.defineProperty(c,"__esModule",{value:!0}),c.MacDeviceManager=void 0;var a=function(d){function p(){return d.call(this)||this}return f(p,d),p}(u(62).BaseDeviceManager);c.MacDeviceManager=a},583:function(v,c,u){var S,f=this&&this.__extends||(S=function(p,e){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])})(p,e)},function(p,e){function r(){this.constructor=p}S(p,e),p.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(c,"__esModule",{value:!0}),c.MobileDeviceManager=void 0;var a=u(603),d=function(p){function e(){return p.call(this)||this}return f(e,p),e.prototype.checkSupportScreenShare=function(){return!1},e.prototype.getScreenTrack=function(r){return new Promise(function(n,s){s(new a.DeviceError(a.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"mobile not support screenshare"))})},e.prototype.getScreenStream=function(r){return new Promise(function(n,s){s(new a.DeviceError(a.DeviceErrorCode.ERROR_SCREENSHARE_NOTSUPPORT,"mobile not support screenshare"))})},e.prototype.createVideoConstraints=function(r){return r.deviceId||r.facingMode||r.width||r.height||r.aspectRatio?{video:{deviceId:r.deviceId,facingMode:r.facingMode,width:r.width,height:r.height,aspectRatio:r.aspectRatio}}:{video:!0}},e}(u(62).BaseDeviceManager);c.MobileDeviceManager=d},935:function(v,c,u){var S,f=this&&this.__extends||(S=function(d,p){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])})(d,p)},function(d,p){function e(){this.constructor=d}S(d,p),d.prototype=p===null?Object.create(p):(e.prototype=p.prototype,new e)});Object.defineProperty(c,"__esModule",{value:!0}),c.WindowsDeviceManager=void 0;var a=function(d){function p(){return d.call(this)||this}return f(p,d),p}(u(62).BaseDeviceManager);c.WindowsDeviceManager=a},607:function(v,c,u){var S=this&&this.__createBinding||(Object.create?function(d,p,e,r){r===void 0&&(r=e),Object.defineProperty(d,r,{enumerable:!0,get:function(){return p[e]}})}:function(d,p,e,r){r===void 0&&(r=e),d[r]=p[e]}),f=this&&this.__exportStar||function(d,p){for(var e in d)e==="default"||Object.prototype.hasOwnProperty.call(p,e)||S(p,d,e)};Object.defineProperty(c,"__esModule",{value:!0}),c.BrowserDeviceManager=void 0;var a=u(304);Object.defineProperty(c,"BrowserDeviceManager",{enumerable:!0,get:function(){return a.BrowserDeviceManager}}),f(u(873),c),window&&(window.BrowserDeviceManager=a.BrowserDeviceManager)},610:(v,c,u)=>{Object.defineProperty(c,"__esModule",{value:!0}),c.LinkUtil=void 0;var S,f=u(603),a=u(261),d=u(54);(function(s){s[s.Windows=0]="Windows",s[s.MacOS=1]="MacOS",s[s.Other=2]="Other"})(S||(S={}));var p="ms-settings:",e="x-apple.systempreferences:com.apple.preference.security?",r={SYS_MIC:[p+"privacy-microphone",e+"Privacy_Microphone"],SYS_CAMERA:[p+"privacy-webcam",e+"Privacy_Camera"],SYS_SCREENSHARE:["",e+"Privacy_ScreenCapture"]},n=function(){function s(){a||console.error("SystemUtil is not found"),this.systemType=this.getSystemType()}return s.prototype.getRelatedLink=function(t){var i="",l=this.systemType;switch(t){case f.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTFOUND:case f.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE:i=r.SYS_MIC[l];break;case f.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTFOUND:case f.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE:i=r.SYS_CAMERA[l];break;case f.DeviceErrorCode.ERROR_SCREENSHARE_UNKNOWNERRO:case f.DeviceErrorCode.ERROR_SCREENSHARE_NOPERMISSION:i=r.SYS_SCREENSHARE[l];break;case f.DeviceErrorCode.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED:case f.DeviceErrorCode.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED:d.isChrome?i=this.getChromeResetLink():d.isEdge&&(i=this.getEdgeResetLink());break;default:i=""}return i},s.prototype.getSystemType=function(){return a.isWindows?S.Windows:a.isMacOS?S.MacOS:S.Other},s.prototype.getChromeResetLink=function(){return"chrome://settings/content/siteDetails?site="+encodeURIComponent(window.location.origin)},s.prototype.getEdgeResetLink=function(){return"edge://settings/content/siteDetails?site="+encodeURIComponent(window.location.origin)},s}();c.LinkUtil=n},101:(v,c)=>{var u;Object.defineProperty(c,"__esModule",{value:!0}),c.SystemUtil=void 0,function(f){f[f.Unknown=0]="Unknown",f[f.MacOS=1]="MacOS",f[f.Windows=2]="Windows",f[f.Android=3]="Android",f[f.Iphone=4]="Iphone",f[f.Ipad=5]="Ipad",f[f.Linux=6]="Linux"}(u||(u={}));var S=function(){function f(){this.systemType=u.Unknown,this.getSystemInfo()}return Object.defineProperty(f.prototype,"isIos",{get:function(){return this.systemType===u.Ipad||this.systemType===u.Iphone},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isAndroid",{get:function(){return this.systemType===u.Android},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isMacOS",{get:function(){return this.systemType===u.MacOS},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isWindows",{get:function(){return this.systemType===u.Windows},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"isLinux",{get:function(){return this.systemType===u.Linux},enumerable:!1,configurable:!0}),f.prototype.getSystemInfo=function(){if(navigator&&navigator.userAgent){var a=navigator.userAgent.toLocaleLowerCase();a.indexOf("ipad")>-1?this.systemType=u.Ipad:a.indexOf("iphone")>-1?this.systemType=u.Iphone:a.indexOf("android")>-1?this.systemType=u.Android:a.indexOf("win")>-1?this.systemType=u.Windows:a.indexOf("mac")>-1?this.systemType=u.MacOS:a.indexOf("linux")>-1?this.systemType=u.Linux:a.indexOf("")>-1&&(this.systemType=u.Unknown)}},f}();c.SystemUtil=S},54:v=>{v.exports=window.BrowserUtil},261:v=>{v.exports=window.SystemUtil}},x={};return function v(c){if(x[c])return x[c].exports;var u=x[c]={exports:{}};return R[c].call(u.exports,u,u.exports,v),u.exports}(607)})()},6677:(L,R,x)=>{var v=x(7963);function c(d,p,e,r,n){var s=v.writeRtpDescription(d.kind,p);if(s+=v.writeIceParameters(d.iceGatherer.getLocalParameters()),s+=v.writeDtlsParameters(d.dtlsTransport.getLocalParameters(),e==="offer"?"actpass":n||"active"),s+="a=mid:"+d.mid+`\r
79
79
  `,d.rtpSender&&d.rtpReceiver?s+=`a=sendrecv\r
80
80
  `:d.rtpSender?s+=`a=sendonly\r
@@ -86,7 +86,7 @@ a=ssrc:`).concat(b," label:audio"),n.direction==="sub"&&(s+=h),s+=t)}),s}},237:(
86
86
  `,d.rtpSender&&d.sendEncodingParameters[0].rtx&&(s+="a=ssrc:"+d.sendEncodingParameters[0].rtx.ssrc+" cname:"+v.localCName+`\r
87
87
  `),s}function u(d,p){var e={codecs:[],headerExtensions:[],fecMechanisms:[]},r=function(s,t){s=parseInt(s,10);for(var i=0;i<t.length;i++)if(t[i].payloadType===s||t[i].preferredPayloadType===s)return t[i]},n=function(s,t,i,l){var E=r(s.parameters.apt,i),b=r(t.parameters.apt,l);return E&&b&&E.name.toLowerCase()===b.name.toLowerCase()};return d.codecs.forEach(function(s){for(var t=0;t<p.codecs.length;t++){var i=p.codecs[t];if(s.name.toLowerCase()===i.name.toLowerCase()&&s.clockRate===i.clockRate){if(s.name.toLowerCase()==="rtx"&&s.parameters&&i.parameters.apt&&!n(s,i,d.codecs,p.codecs))continue;(i=JSON.parse(JSON.stringify(i))).numChannels=Math.min(s.numChannels,i.numChannels),e.codecs.push(i),i.rtcpFeedback=i.rtcpFeedback.filter(function(l){for(var E=0;E<s.rtcpFeedback.length;E++)if(s.rtcpFeedback[E].type===l.type&&s.rtcpFeedback[E].parameter===l.parameter)return!0;return!1});break}}}),d.headerExtensions.forEach(function(s){for(var t=0;t<p.headerExtensions.length;t++){var i=p.headerExtensions[t];if(s.uri===i.uri){e.headerExtensions.push(i);break}}}),e}function S(d,p,e){return{offer:{setLocalDescription:["stable","have-local-offer"],setRemoteDescription:["stable","have-remote-offer"]},answer:{setLocalDescription:["have-remote-offer","have-local-pranswer"],setRemoteDescription:["have-local-offer","have-remote-pranswer"]}}[p][d].indexOf(e)!==-1}function f(d,p){var e=d.getRemoteCandidates().find(function(r){return p.foundation===r.foundation&&p.ip===r.ip&&p.port===r.port&&p.priority===r.priority&&p.protocol===r.protocol&&p.type===r.type});return e||d.addRemoteCandidate(p),!e}function a(d,p){var e=new Error(p);return e.name=d,e.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[d],e}L.exports=function(d,p){function e(t,i){i.addTrack(t),i.dispatchEvent(new d.MediaStreamTrackEvent("addtrack",{track:t}))}function r(t,i,l,E){var b=new Event("track");b.track=i,b.receiver=l,b.transceiver={receiver:l},b.streams=E,d.setTimeout(function(){t._dispatchEvent("track",b)})}var n=function(t){var i=this,l=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach(function(b){i[b]=l[b].bind(l)}),this.canTrickleIceCandidates=null,this.needNegotiation=!1,this.localStreams=[],this.remoteStreams=[],this._localDescription=null,this._remoteDescription=null,this.signalingState="stable",this.iceConnectionState="new",this.connectionState="new",this.iceGatheringState="new",t=JSON.parse(JSON.stringify(t||{})),this.usingBundle=t.bundlePolicy==="max-bundle",t.rtcpMuxPolicy==="negotiate")throw a("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(t.rtcpMuxPolicy||(t.rtcpMuxPolicy="require"),t.iceTransportPolicy){case"all":case"relay":break;default:t.iceTransportPolicy="all"}switch(t.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:t.bundlePolicy="balanced"}if(t.iceServers=function(b,_){var h=!1;return(b=JSON.parse(JSON.stringify(b))).filter(function(o){if(o&&(o.urls||o.url)){var g=o.urls||o.url;o.url&&!o.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var m=typeof g=="string";return m&&(g=[g]),g=g.filter(function(T){return T.indexOf("turn:")!==0||T.indexOf("transport=udp")===-1||T.indexOf("turn:[")!==-1||h?T.indexOf("stun:")===0&&_>=14393&&T.indexOf("?transport=udp")===-1:(h=!0,!0)}),delete o.url,o.urls=m?g[0]:g,!!g.length}})}(t.iceServers||[],p),this._iceGatherers=[],t.iceCandidatePoolSize)for(var E=t.iceCandidatePoolSize;E>0;E--)this._iceGatherers.push(new d.RTCIceGatherer({iceServers:t.iceServers,gatherPolicy:t.iceTransportPolicy}));else t.iceCandidatePoolSize=0;this._config=t,this.transceivers=[],this._sdpSessionId=v.generateSessionId(),this._sdpSessionVersion=0,this._dtlsRole=void 0,this._isClosed=!1};Object.defineProperty(n.prototype,"localDescription",{configurable:!0,get:function(){return this._localDescription}}),Object.defineProperty(n.prototype,"remoteDescription",{configurable:!0,get:function(){return this._remoteDescription}}),n.prototype.onicecandidate=null,n.prototype.onaddstream=null,n.prototype.ontrack=null,n.prototype.onremovestream=null,n.prototype.onsignalingstatechange=null,n.prototype.oniceconnectionstatechange=null,n.prototype.onconnectionstatechange=null,n.prototype.onicegatheringstatechange=null,n.prototype.onnegotiationneeded=null,n.prototype.ondatachannel=null,n.prototype._dispatchEvent=function(t,i){this._isClosed||(this.dispatchEvent(i),typeof this["on"+t]=="function"&&this["on"+t](i))},n.prototype._emitGatheringStateChange=function(){var t=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",t)},n.prototype.getConfiguration=function(){return this._config},n.prototype.getLocalStreams=function(){return this.localStreams},n.prototype.getRemoteStreams=function(){return this.remoteStreams},n.prototype._createTransceiver=function(t,i){var l=this.transceivers.length>0,E={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:t,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&l)E.iceTransport=this.transceivers[0].iceTransport,E.dtlsTransport=this.transceivers[0].dtlsTransport;else{var b=this._createIceAndDtlsTransports();E.iceTransport=b.iceTransport,E.dtlsTransport=b.dtlsTransport}return i||this.transceivers.push(E),E},n.prototype.addTrack=function(t,i){if(this._isClosed)throw a("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var l;if(this.transceivers.find(function(b){return b.track===t}))throw a("InvalidAccessError","Track already exists.");for(var E=0;E<this.transceivers.length;E++)this.transceivers[E].track||this.transceivers[E].kind!==t.kind||(l=this.transceivers[E]);return l||(l=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),this.localStreams.indexOf(i)===-1&&this.localStreams.push(i),l.track=t,l.stream=i,l.rtpSender=new d.RTCRtpSender(t,l.dtlsTransport),l.rtpSender},n.prototype.addStream=function(t){var i=this;if(p>=15025)t.getTracks().forEach(function(E){i.addTrack(E,t)});else{var l=t.clone();t.getTracks().forEach(function(E,b){var _=l.getTracks()[b];E.addEventListener("enabled",function(h){_.enabled=h.enabled})}),l.getTracks().forEach(function(E){i.addTrack(E,l)})}},n.prototype.removeTrack=function(t){if(this._isClosed)throw a("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof d.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var i=this.transceivers.find(function(E){return E.rtpSender===t});if(!i)throw a("InvalidAccessError","Sender was not created by this connection.");var l=i.stream;i.rtpSender.stop(),i.rtpSender=null,i.track=null,i.stream=null,this.transceivers.map(function(E){return E.stream}).indexOf(l)===-1&&this.localStreams.indexOf(l)>-1&&this.localStreams.splice(this.localStreams.indexOf(l),1),this._maybeFireNegotiationNeeded()},n.prototype.removeStream=function(t){var i=this;t.getTracks().forEach(function(l){var E=i.getSenders().find(function(b){return b.track===l});E&&i.removeTrack(E)})},n.prototype.getSenders=function(){return this.transceivers.filter(function(t){return!!t.rtpSender}).map(function(t){return t.rtpSender})},n.prototype.getReceivers=function(){return this.transceivers.filter(function(t){return!!t.rtpReceiver}).map(function(t){return t.rtpReceiver})},n.prototype._createIceGatherer=function(t,i){var l=this;if(i&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var E=new d.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(E,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(b){var _=!b.candidate||Object.keys(b.candidate).length===0;E.state=_?"completed":"gathering",l.transceivers[t].bufferedCandidateEvents!==null&&l.transceivers[t].bufferedCandidateEvents.push(b)},E.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),E},n.prototype._gather=function(t,i){var l=this,E=this.transceivers[i].iceGatherer;if(!E.onlocalcandidate){var b=this.transceivers[i].bufferedCandidateEvents;this.transceivers[i].bufferedCandidateEvents=null,E.removeEventListener("localcandidate",this.transceivers[i].bufferCandidates),E.onlocalcandidate=function(_){if(!(l.usingBundle&&i>0)){var h=new Event("icecandidate");h.candidate={sdpMid:t,sdpMLineIndex:i};var o=_.candidate,g=!o||Object.keys(o).length===0;if(g)E.state!=="new"&&E.state!=="gathering"||(E.state="completed");else{E.state==="new"&&(E.state="gathering"),o.component=1,o.ufrag=E.getLocalParameters().usernameFragment;var m=v.writeCandidate(o);h.candidate=Object.assign(h.candidate,v.parseCandidate(m)),h.candidate.candidate=m,h.candidate.toJSON=function(){return{candidate:h.candidate.candidate,sdpMid:h.candidate.sdpMid,sdpMLineIndex:h.candidate.sdpMLineIndex,usernameFragment:h.candidate.usernameFragment}}}var T=v.getMediaSections(l._localDescription.sdp);T[h.candidate.sdpMLineIndex]+=g?`a=end-of-candidates\r
88
88
  `:"a="+h.candidate.candidate+`\r
89
- `,l._localDescription.sdp=v.getDescription(l._localDescription.sdp)+T.join("");var C=l.transceivers.every(function(D){return D.iceGatherer&&D.iceGatherer.state==="completed"});l.iceGatheringState!=="gathering"&&(l.iceGatheringState="gathering",l._emitGatheringStateChange()),g||l._dispatchEvent("icecandidate",h),C&&(l._dispatchEvent("icecandidate",new Event("icecandidate")),l.iceGatheringState="complete",l._emitGatheringStateChange())}},d.setTimeout(function(){b.forEach(function(_){E.onlocalcandidate(_)})},0)}},n.prototype._createIceAndDtlsTransports=function(){var t=this,i=new d.RTCIceTransport(null);i.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var l=new d.RTCDtlsTransport(i);return l.ondtlsstatechange=function(){t._updateConnectionState()},l.onerror=function(){Object.defineProperty(l,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:i,dtlsTransport:l}},n.prototype._disposeIceAndDtlsTransports=function(t){var i=this.transceivers[t].iceGatherer;i&&(delete i.onlocalcandidate,delete this.transceivers[t].iceGatherer);var l=this.transceivers[t].iceTransport;l&&(delete l.onicestatechange,delete this.transceivers[t].iceTransport);var E=this.transceivers[t].dtlsTransport;E&&(delete E.ondtlsstatechange,delete E.onerror,delete this.transceivers[t].dtlsTransport)},n.prototype._transceive=function(t,i,l){var E=u(t.localCapabilities,t.remoteCapabilities);i&&t.rtpSender&&(E.encodings=t.sendEncodingParameters,E.rtcp={cname:v.localCName,compound:t.rtcpParameters.compound},t.recvEncodingParameters.length&&(E.rtcp.ssrc=t.recvEncodingParameters[0].ssrc),t.rtpSender.send(E)),l&&t.rtpReceiver&&E.codecs.length>0&&(t.kind==="video"&&t.recvEncodingParameters&&p<15019&&t.recvEncodingParameters.forEach(function(b){delete b.rtx}),t.recvEncodingParameters.length?E.encodings=t.recvEncodingParameters:E.encodings=[{}],E.rtcp={compound:t.rtcpParameters.compound},t.rtcpParameters.cname&&(E.rtcp.cname=t.rtcpParameters.cname),t.sendEncodingParameters.length&&(E.rtcp.ssrc=t.sendEncodingParameters[0].ssrc),t.rtpReceiver.receive(E))},n.prototype.setLocalDescription=function(t){var i,l,E=this;if(["offer","answer"].indexOf(t.type)===-1)return Promise.reject(a("TypeError",'Unsupported type "'+t.type+'"'));if(!S("setLocalDescription",t.type,E.signalingState)||E._isClosed)return Promise.reject(a("InvalidStateError","Can not set local "+t.type+" in state "+E.signalingState));if(t.type==="offer")i=v.splitSections(t.sdp),l=i.shift(),i.forEach(function(_,h){var o=v.parseRtpParameters(_);E.transceivers[h].localCapabilities=o}),E.transceivers.forEach(function(_,h){E._gather(_.mid,h)});else if(t.type==="answer"){i=v.splitSections(E._remoteDescription.sdp),l=i.shift();var b=v.matchPrefix(l,"a=ice-lite").length>0;i.forEach(function(_,h){var o=E.transceivers[h],g=o.iceGatherer,m=o.iceTransport,T=o.dtlsTransport,C=o.localCapabilities,D=o.remoteCapabilities;if(!(v.isRejected(_)&&v.matchPrefix(_,"a=bundle-only").length===0)&&!o.rejected){var y=v.getIceParameters(_,l),A=v.getDtlsParameters(_,l);b&&(A.role="server"),E.usingBundle&&h!==0||(E._gather(o.mid,h),m.state==="new"&&m.start(g,y,b?"controlling":"controlled"),T.state==="new"&&T.start(A));var O=u(C,D);E._transceive(o,O.codecs.length>0,!1)}})}return E._localDescription={type:t.type,sdp:t.sdp},t.type==="offer"?E._updateSignalingState("have-local-offer"):E._updateSignalingState("stable"),Promise.resolve()},n.prototype.setRemoteDescription=function(t){var i=this;if(["offer","answer"].indexOf(t.type)===-1)return Promise.reject(a("TypeError",'Unsupported type "'+t.type+'"'));if(!S("setRemoteDescription",t.type,i.signalingState)||i._isClosed)return Promise.reject(a("InvalidStateError","Can not set remote "+t.type+" in state "+i.signalingState));var l={};i.remoteStreams.forEach(function(m){l[m.id]=m});var E=[],b=v.splitSections(t.sdp),_=b.shift(),h=v.matchPrefix(_,"a=ice-lite").length>0,o=v.matchPrefix(_,"a=group:BUNDLE ").length>0;i.usingBundle=o;var g=v.matchPrefix(_,"a=ice-options:")[0];return i.canTrickleIceCandidates=!!g&&g.substr(14).split(" ").indexOf("trickle")>=0,b.forEach(function(m,T){var C=v.splitLines(m),D=v.getKind(m),y=v.isRejected(m)&&v.matchPrefix(m,"a=bundle-only").length===0,A=C[0].substr(2).split(" ")[2],O=v.getDirection(m,_),j=v.parseMsid(m),I=v.getMid(m)||v.generateIdentifier();if(y||D==="application"&&(A==="DTLS/SCTP"||A==="UDP/DTLS/SCTP"))i.transceivers[T]={mid:I,kind:D,protocol:A,rejected:!0};else{var H,F,U,B,k,V,G,q,z;!y&&i.transceivers[T]&&i.transceivers[T].rejected&&(i.transceivers[T]=i._createTransceiver(D,!0));var $,re,ee=v.parseRtpParameters(m);y||($=v.getIceParameters(m,_),(re=v.getDtlsParameters(m,_)).role="client"),G=v.parseRtpEncodingParameters(m);var ie=v.parseRtcpParameters(m),se=v.matchPrefix(m,"a=end-of-candidates",_).length>0,ce=v.matchPrefix(m,"a=candidate:").map(function(pe){return v.parseCandidate(pe)}).filter(function(pe){return pe.component===1});if((t.type==="offer"||t.type==="answer")&&!y&&o&&T>0&&i.transceivers[T]&&(i._disposeIceAndDtlsTransports(T),i.transceivers[T].iceGatherer=i.transceivers[0].iceGatherer,i.transceivers[T].iceTransport=i.transceivers[0].iceTransport,i.transceivers[T].dtlsTransport=i.transceivers[0].dtlsTransport,i.transceivers[T].rtpSender&&i.transceivers[T].rtpSender.setTransport(i.transceivers[0].dtlsTransport),i.transceivers[T].rtpReceiver&&i.transceivers[T].rtpReceiver.setTransport(i.transceivers[0].dtlsTransport)),t.type!=="offer"||y)t.type==="answer"&&!y&&(F=(H=i.transceivers[T]).iceGatherer,U=H.iceTransport,B=H.dtlsTransport,k=H.rtpReceiver,V=H.sendEncodingParameters,q=H.localCapabilities,i.transceivers[T].recvEncodingParameters=G,i.transceivers[T].remoteCapabilities=ee,i.transceivers[T].rtcpParameters=ie,ce.length&&U.state==="new"&&(!h&&!se||o&&T!==0?ce.forEach(function(pe){f(H.iceTransport,pe)}):U.setRemoteCandidates(ce)),o&&T!==0||(U.state==="new"&&U.start(F,$,"controlling"),B.state==="new"&&B.start(re)),!u(H.localCapabilities,H.remoteCapabilities).codecs.filter(function(pe){return pe.name.toLowerCase()==="rtx"}).length&&H.sendEncodingParameters[0].rtx&&delete H.sendEncodingParameters[0].rtx,i._transceive(H,O==="sendrecv"||O==="recvonly",O==="sendrecv"||O==="sendonly"),!k||O!=="sendrecv"&&O!=="sendonly"?delete H.rtpReceiver:(z=k.track,j?(l[j.stream]||(l[j.stream]=new d.MediaStream),e(z,l[j.stream]),E.push([z,k,l[j.stream]])):(l.default||(l.default=new d.MediaStream),e(z,l.default),E.push([z,k,l.default]))));else{(H=i.transceivers[T]||i._createTransceiver(D)).mid=I,H.iceGatherer||(H.iceGatherer=i._createIceGatherer(T,o)),ce.length&&H.iceTransport.state==="new"&&(!se||o&&T!==0?ce.forEach(function(pe){f(H.iceTransport,pe)}):H.iceTransport.setRemoteCandidates(ce)),q=d.RTCRtpReceiver.getCapabilities(D),p<15019&&(q.codecs=q.codecs.filter(function(pe){return pe.name!=="rtx"})),V=H.sendEncodingParameters||[{ssrc:1001*(2*T+2)}];var ue,de=!1;O==="sendrecv"||O==="sendonly"?(de=!H.rtpReceiver,k=H.rtpReceiver||new d.RTCRtpReceiver(H.dtlsTransport,D),de&&(z=k.track,j&&j.stream==="-"||(j?(l[j.stream]||(l[j.stream]=new d.MediaStream,Object.defineProperty(l[j.stream],"id",{get:function(){return j.stream}})),Object.defineProperty(z,"id",{get:function(){return j.track}}),ue=l[j.stream]):(l.default||(l.default=new d.MediaStream),ue=l.default)),ue&&(e(z,ue),H.associatedRemoteMediaStreams.push(ue)),E.push([z,k,ue]))):H.rtpReceiver&&H.rtpReceiver.track&&(H.associatedRemoteMediaStreams.forEach(function(pe){var Ee=pe.getTracks().find(function(he){return he.id===H.rtpReceiver.track.id});Ee&&function(he,fe){fe.removeTrack(he),fe.dispatchEvent(new d.MediaStreamTrackEvent("removetrack",{track:he}))}(Ee,pe)}),H.associatedRemoteMediaStreams=[]),H.localCapabilities=q,H.remoteCapabilities=ee,H.rtpReceiver=k,H.rtcpParameters=ie,H.sendEncodingParameters=V,H.recvEncodingParameters=G,i._transceive(i.transceivers[T],!1,de)}}}),i._dtlsRole===void 0&&(i._dtlsRole=t.type==="offer"?"active":"passive"),i._remoteDescription={type:t.type,sdp:t.sdp},t.type==="offer"?i._updateSignalingState("have-remote-offer"):i._updateSignalingState("stable"),Object.keys(l).forEach(function(m){var T=l[m];if(T.getTracks().length){if(i.remoteStreams.indexOf(T)===-1){i.remoteStreams.push(T);var C=new Event("addstream");C.stream=T,d.setTimeout(function(){i._dispatchEvent("addstream",C)})}E.forEach(function(D){var y=D[0],A=D[1];T.id===D[2].id&&r(i,y,A,[T])})}}),E.forEach(function(m){m[2]||r(i,m[0],m[1],[])}),d.setTimeout(function(){i&&i.transceivers&&i.transceivers.forEach(function(m){m.iceTransport&&m.iceTransport.state==="new"&&m.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),m.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},n.prototype.close=function(){this.transceivers.forEach(function(t){t.iceTransport&&t.iceTransport.stop(),t.dtlsTransport&&t.dtlsTransport.stop(),t.rtpSender&&t.rtpSender.stop(),t.rtpReceiver&&t.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},n.prototype._updateSignalingState=function(t){this.signalingState=t;var i=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",i)},n.prototype._maybeFireNegotiationNeeded=function(){var t=this;this.signalingState==="stable"&&this.needNegotiation!==!0&&(this.needNegotiation=!0,d.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=!1;var i=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",i)}},0))},n.prototype._updateIceConnectionState=function(){var t,i={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(E){E.iceTransport&&!E.rejected&&i[E.iceTransport.state]++}),t="new",i.failed>0?t="failed":i.checking>0?t="checking":i.disconnected>0?t="disconnected":i.new>0?t="new":i.connected>0?t="connected":i.completed>0&&(t="completed"),t!==this.iceConnectionState){this.iceConnectionState=t;var l=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",l)}},n.prototype._updateConnectionState=function(){var t,i={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(E){E.iceTransport&&E.dtlsTransport&&!E.rejected&&(i[E.iceTransport.state]++,i[E.dtlsTransport.state]++)}),i.connected+=i.completed,t="new",i.failed>0?t="failed":i.connecting>0?t="connecting":i.disconnected>0?t="disconnected":i.new>0?t="new":i.connected>0&&(t="connected"),t!==this.connectionState){this.connectionState=t;var l=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",l)}},n.prototype.createOffer=function(){var t=this;if(t._isClosed)return Promise.reject(a("InvalidStateError","Can not call createOffer after close"));var i=t.transceivers.filter(function(h){return h.kind==="audio"}).length,l=t.transceivers.filter(function(h){return h.kind==="video"}).length,E=arguments[0];if(E){if(E.mandatory||E.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");E.offerToReceiveAudio!==void 0&&(i=E.offerToReceiveAudio===!0?1:E.offerToReceiveAudio===!1?0:E.offerToReceiveAudio),E.offerToReceiveVideo!==void 0&&(l=E.offerToReceiveVideo===!0?1:E.offerToReceiveVideo===!1?0:E.offerToReceiveVideo)}for(t.transceivers.forEach(function(h){h.kind==="audio"?--i<0&&(h.wantReceive=!1):h.kind==="video"&&--l<0&&(h.wantReceive=!1)});i>0||l>0;)i>0&&(t._createTransceiver("audio"),i--),l>0&&(t._createTransceiver("video"),l--);var b=v.writeSessionBoilerplate(t._sdpSessionId,t._sdpSessionVersion++);t.transceivers.forEach(function(h,o){var g=h.track,m=h.kind,T=h.mid||v.generateIdentifier();h.mid=T,h.iceGatherer||(h.iceGatherer=t._createIceGatherer(o,t.usingBundle));var C=d.RTCRtpSender.getCapabilities(m);p<15019&&(C.codecs=C.codecs.filter(function(y){return y.name!=="rtx"})),C.codecs.forEach(function(y){y.name==="H264"&&y.parameters["level-asymmetry-allowed"]===void 0&&(y.parameters["level-asymmetry-allowed"]="1"),h.remoteCapabilities&&h.remoteCapabilities.codecs&&h.remoteCapabilities.codecs.forEach(function(A){y.name.toLowerCase()===A.name.toLowerCase()&&y.clockRate===A.clockRate&&(y.preferredPayloadType=A.payloadType)})}),C.headerExtensions.forEach(function(y){(h.remoteCapabilities&&h.remoteCapabilities.headerExtensions||[]).forEach(function(A){y.uri===A.uri&&(y.id=A.id)})});var D=h.sendEncodingParameters||[{ssrc:1001*(2*o+1)}];g&&p>=15019&&m==="video"&&!D[0].rtx&&(D[0].rtx={ssrc:D[0].ssrc+1}),h.wantReceive&&(h.rtpReceiver=new d.RTCRtpReceiver(h.dtlsTransport,m)),h.localCapabilities=C,h.sendEncodingParameters=D}),t._config.bundlePolicy!=="max-compat"&&(b+="a=group:BUNDLE "+t.transceivers.map(function(h){return h.mid}).join(" ")+`\r
89
+ `,l._localDescription.sdp=v.getDescription(l._localDescription.sdp)+T.join("");var C=l.transceivers.every(function(D){return D.iceGatherer&&D.iceGatherer.state==="completed"});l.iceGatheringState!=="gathering"&&(l.iceGatheringState="gathering",l._emitGatheringStateChange()),g||l._dispatchEvent("icecandidate",h),C&&(l._dispatchEvent("icecandidate",new Event("icecandidate")),l.iceGatheringState="complete",l._emitGatheringStateChange())}},d.setTimeout(function(){b.forEach(function(_){E.onlocalcandidate(_)})},0)}},n.prototype._createIceAndDtlsTransports=function(){var t=this,i=new d.RTCIceTransport(null);i.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var l=new d.RTCDtlsTransport(i);return l.ondtlsstatechange=function(){t._updateConnectionState()},l.onerror=function(){Object.defineProperty(l,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:i,dtlsTransport:l}},n.prototype._disposeIceAndDtlsTransports=function(t){var i=this.transceivers[t].iceGatherer;i&&(delete i.onlocalcandidate,delete this.transceivers[t].iceGatherer);var l=this.transceivers[t].iceTransport;l&&(delete l.onicestatechange,delete this.transceivers[t].iceTransport);var E=this.transceivers[t].dtlsTransport;E&&(delete E.ondtlsstatechange,delete E.onerror,delete this.transceivers[t].dtlsTransport)},n.prototype._transceive=function(t,i,l){var E=u(t.localCapabilities,t.remoteCapabilities);i&&t.rtpSender&&(E.encodings=t.sendEncodingParameters,E.rtcp={cname:v.localCName,compound:t.rtcpParameters.compound},t.recvEncodingParameters.length&&(E.rtcp.ssrc=t.recvEncodingParameters[0].ssrc),t.rtpSender.send(E)),l&&t.rtpReceiver&&E.codecs.length>0&&(t.kind==="video"&&t.recvEncodingParameters&&p<15019&&t.recvEncodingParameters.forEach(function(b){delete b.rtx}),t.recvEncodingParameters.length?E.encodings=t.recvEncodingParameters:E.encodings=[{}],E.rtcp={compound:t.rtcpParameters.compound},t.rtcpParameters.cname&&(E.rtcp.cname=t.rtcpParameters.cname),t.sendEncodingParameters.length&&(E.rtcp.ssrc=t.sendEncodingParameters[0].ssrc),t.rtpReceiver.receive(E))},n.prototype.setLocalDescription=function(t){var i,l,E=this;if(["offer","answer"].indexOf(t.type)===-1)return Promise.reject(a("TypeError",'Unsupported type "'+t.type+'"'));if(!S("setLocalDescription",t.type,E.signalingState)||E._isClosed)return Promise.reject(a("InvalidStateError","Can not set local "+t.type+" in state "+E.signalingState));if(t.type==="offer")i=v.splitSections(t.sdp),l=i.shift(),i.forEach(function(_,h){var o=v.parseRtpParameters(_);E.transceivers[h].localCapabilities=o}),E.transceivers.forEach(function(_,h){E._gather(_.mid,h)});else if(t.type==="answer"){i=v.splitSections(E._remoteDescription.sdp),l=i.shift();var b=v.matchPrefix(l,"a=ice-lite").length>0;i.forEach(function(_,h){var o=E.transceivers[h],g=o.iceGatherer,m=o.iceTransport,T=o.dtlsTransport,C=o.localCapabilities,D=o.remoteCapabilities;if(!(v.isRejected(_)&&v.matchPrefix(_,"a=bundle-only").length===0)&&!o.rejected){var y=v.getIceParameters(_,l),A=v.getDtlsParameters(_,l);b&&(A.role="server"),E.usingBundle&&h!==0||(E._gather(o.mid,h),m.state==="new"&&m.start(g,y,b?"controlling":"controlled"),T.state==="new"&&T.start(A));var w=u(C,D);E._transceive(o,w.codecs.length>0,!1)}})}return E._localDescription={type:t.type,sdp:t.sdp},t.type==="offer"?E._updateSignalingState("have-local-offer"):E._updateSignalingState("stable"),Promise.resolve()},n.prototype.setRemoteDescription=function(t){var i=this;if(["offer","answer"].indexOf(t.type)===-1)return Promise.reject(a("TypeError",'Unsupported type "'+t.type+'"'));if(!S("setRemoteDescription",t.type,i.signalingState)||i._isClosed)return Promise.reject(a("InvalidStateError","Can not set remote "+t.type+" in state "+i.signalingState));var l={};i.remoteStreams.forEach(function(m){l[m.id]=m});var E=[],b=v.splitSections(t.sdp),_=b.shift(),h=v.matchPrefix(_,"a=ice-lite").length>0,o=v.matchPrefix(_,"a=group:BUNDLE ").length>0;i.usingBundle=o;var g=v.matchPrefix(_,"a=ice-options:")[0];return i.canTrickleIceCandidates=!!g&&g.substr(14).split(" ").indexOf("trickle")>=0,b.forEach(function(m,T){var C=v.splitLines(m),D=v.getKind(m),y=v.isRejected(m)&&v.matchPrefix(m,"a=bundle-only").length===0,A=C[0].substr(2).split(" ")[2],w=v.getDirection(m,_),j=v.parseMsid(m),I=v.getMid(m)||v.generateIdentifier();if(y||D==="application"&&(A==="DTLS/SCTP"||A==="UDP/DTLS/SCTP"))i.transceivers[T]={mid:I,kind:D,protocol:A,rejected:!0};else{var H,F,U,B,k,V,G,q,z;!y&&i.transceivers[T]&&i.transceivers[T].rejected&&(i.transceivers[T]=i._createTransceiver(D,!0));var $,re,ee=v.parseRtpParameters(m);y||($=v.getIceParameters(m,_),(re=v.getDtlsParameters(m,_)).role="client"),G=v.parseRtpEncodingParameters(m);var ie=v.parseRtcpParameters(m),se=v.matchPrefix(m,"a=end-of-candidates",_).length>0,ce=v.matchPrefix(m,"a=candidate:").map(function(pe){return v.parseCandidate(pe)}).filter(function(pe){return pe.component===1});if((t.type==="offer"||t.type==="answer")&&!y&&o&&T>0&&i.transceivers[T]&&(i._disposeIceAndDtlsTransports(T),i.transceivers[T].iceGatherer=i.transceivers[0].iceGatherer,i.transceivers[T].iceTransport=i.transceivers[0].iceTransport,i.transceivers[T].dtlsTransport=i.transceivers[0].dtlsTransport,i.transceivers[T].rtpSender&&i.transceivers[T].rtpSender.setTransport(i.transceivers[0].dtlsTransport),i.transceivers[T].rtpReceiver&&i.transceivers[T].rtpReceiver.setTransport(i.transceivers[0].dtlsTransport)),t.type!=="offer"||y)t.type==="answer"&&!y&&(F=(H=i.transceivers[T]).iceGatherer,U=H.iceTransport,B=H.dtlsTransport,k=H.rtpReceiver,V=H.sendEncodingParameters,q=H.localCapabilities,i.transceivers[T].recvEncodingParameters=G,i.transceivers[T].remoteCapabilities=ee,i.transceivers[T].rtcpParameters=ie,ce.length&&U.state==="new"&&(!h&&!se||o&&T!==0?ce.forEach(function(pe){f(H.iceTransport,pe)}):U.setRemoteCandidates(ce)),o&&T!==0||(U.state==="new"&&U.start(F,$,"controlling"),B.state==="new"&&B.start(re)),!u(H.localCapabilities,H.remoteCapabilities).codecs.filter(function(pe){return pe.name.toLowerCase()==="rtx"}).length&&H.sendEncodingParameters[0].rtx&&delete H.sendEncodingParameters[0].rtx,i._transceive(H,w==="sendrecv"||w==="recvonly",w==="sendrecv"||w==="sendonly"),!k||w!=="sendrecv"&&w!=="sendonly"?delete H.rtpReceiver:(z=k.track,j?(l[j.stream]||(l[j.stream]=new d.MediaStream),e(z,l[j.stream]),E.push([z,k,l[j.stream]])):(l.default||(l.default=new d.MediaStream),e(z,l.default),E.push([z,k,l.default]))));else{(H=i.transceivers[T]||i._createTransceiver(D)).mid=I,H.iceGatherer||(H.iceGatherer=i._createIceGatherer(T,o)),ce.length&&H.iceTransport.state==="new"&&(!se||o&&T!==0?ce.forEach(function(pe){f(H.iceTransport,pe)}):H.iceTransport.setRemoteCandidates(ce)),q=d.RTCRtpReceiver.getCapabilities(D),p<15019&&(q.codecs=q.codecs.filter(function(pe){return pe.name!=="rtx"})),V=H.sendEncodingParameters||[{ssrc:1001*(2*T+2)}];var ue,de=!1;w==="sendrecv"||w==="sendonly"?(de=!H.rtpReceiver,k=H.rtpReceiver||new d.RTCRtpReceiver(H.dtlsTransport,D),de&&(z=k.track,j&&j.stream==="-"||(j?(l[j.stream]||(l[j.stream]=new d.MediaStream,Object.defineProperty(l[j.stream],"id",{get:function(){return j.stream}})),Object.defineProperty(z,"id",{get:function(){return j.track}}),ue=l[j.stream]):(l.default||(l.default=new d.MediaStream),ue=l.default)),ue&&(e(z,ue),H.associatedRemoteMediaStreams.push(ue)),E.push([z,k,ue]))):H.rtpReceiver&&H.rtpReceiver.track&&(H.associatedRemoteMediaStreams.forEach(function(pe){var Ee=pe.getTracks().find(function(he){return he.id===H.rtpReceiver.track.id});Ee&&function(he,fe){fe.removeTrack(he),fe.dispatchEvent(new d.MediaStreamTrackEvent("removetrack",{track:he}))}(Ee,pe)}),H.associatedRemoteMediaStreams=[]),H.localCapabilities=q,H.remoteCapabilities=ee,H.rtpReceiver=k,H.rtcpParameters=ie,H.sendEncodingParameters=V,H.recvEncodingParameters=G,i._transceive(i.transceivers[T],!1,de)}}}),i._dtlsRole===void 0&&(i._dtlsRole=t.type==="offer"?"active":"passive"),i._remoteDescription={type:t.type,sdp:t.sdp},t.type==="offer"?i._updateSignalingState("have-remote-offer"):i._updateSignalingState("stable"),Object.keys(l).forEach(function(m){var T=l[m];if(T.getTracks().length){if(i.remoteStreams.indexOf(T)===-1){i.remoteStreams.push(T);var C=new Event("addstream");C.stream=T,d.setTimeout(function(){i._dispatchEvent("addstream",C)})}E.forEach(function(D){var y=D[0],A=D[1];T.id===D[2].id&&r(i,y,A,[T])})}}),E.forEach(function(m){m[2]||r(i,m[0],m[1],[])}),d.setTimeout(function(){i&&i.transceivers&&i.transceivers.forEach(function(m){m.iceTransport&&m.iceTransport.state==="new"&&m.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),m.iceTransport.addRemoteCandidate({}))})},4e3),Promise.resolve()},n.prototype.close=function(){this.transceivers.forEach(function(t){t.iceTransport&&t.iceTransport.stop(),t.dtlsTransport&&t.dtlsTransport.stop(),t.rtpSender&&t.rtpSender.stop(),t.rtpReceiver&&t.rtpReceiver.stop()}),this._isClosed=!0,this._updateSignalingState("closed")},n.prototype._updateSignalingState=function(t){this.signalingState=t;var i=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",i)},n.prototype._maybeFireNegotiationNeeded=function(){var t=this;this.signalingState==="stable"&&this.needNegotiation!==!0&&(this.needNegotiation=!0,d.setTimeout(function(){if(t.needNegotiation){t.needNegotiation=!1;var i=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",i)}},0))},n.prototype._updateIceConnectionState=function(){var t,i={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(E){E.iceTransport&&!E.rejected&&i[E.iceTransport.state]++}),t="new",i.failed>0?t="failed":i.checking>0?t="checking":i.disconnected>0?t="disconnected":i.new>0?t="new":i.connected>0?t="connected":i.completed>0&&(t="completed"),t!==this.iceConnectionState){this.iceConnectionState=t;var l=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",l)}},n.prototype._updateConnectionState=function(){var t,i={new:0,closed:0,connecting:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach(function(E){E.iceTransport&&E.dtlsTransport&&!E.rejected&&(i[E.iceTransport.state]++,i[E.dtlsTransport.state]++)}),i.connected+=i.completed,t="new",i.failed>0?t="failed":i.connecting>0?t="connecting":i.disconnected>0?t="disconnected":i.new>0?t="new":i.connected>0&&(t="connected"),t!==this.connectionState){this.connectionState=t;var l=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",l)}},n.prototype.createOffer=function(){var t=this;if(t._isClosed)return Promise.reject(a("InvalidStateError","Can not call createOffer after close"));var i=t.transceivers.filter(function(h){return h.kind==="audio"}).length,l=t.transceivers.filter(function(h){return h.kind==="video"}).length,E=arguments[0];if(E){if(E.mandatory||E.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");E.offerToReceiveAudio!==void 0&&(i=E.offerToReceiveAudio===!0?1:E.offerToReceiveAudio===!1?0:E.offerToReceiveAudio),E.offerToReceiveVideo!==void 0&&(l=E.offerToReceiveVideo===!0?1:E.offerToReceiveVideo===!1?0:E.offerToReceiveVideo)}for(t.transceivers.forEach(function(h){h.kind==="audio"?--i<0&&(h.wantReceive=!1):h.kind==="video"&&--l<0&&(h.wantReceive=!1)});i>0||l>0;)i>0&&(t._createTransceiver("audio"),i--),l>0&&(t._createTransceiver("video"),l--);var b=v.writeSessionBoilerplate(t._sdpSessionId,t._sdpSessionVersion++);t.transceivers.forEach(function(h,o){var g=h.track,m=h.kind,T=h.mid||v.generateIdentifier();h.mid=T,h.iceGatherer||(h.iceGatherer=t._createIceGatherer(o,t.usingBundle));var C=d.RTCRtpSender.getCapabilities(m);p<15019&&(C.codecs=C.codecs.filter(function(y){return y.name!=="rtx"})),C.codecs.forEach(function(y){y.name==="H264"&&y.parameters["level-asymmetry-allowed"]===void 0&&(y.parameters["level-asymmetry-allowed"]="1"),h.remoteCapabilities&&h.remoteCapabilities.codecs&&h.remoteCapabilities.codecs.forEach(function(A){y.name.toLowerCase()===A.name.toLowerCase()&&y.clockRate===A.clockRate&&(y.preferredPayloadType=A.payloadType)})}),C.headerExtensions.forEach(function(y){(h.remoteCapabilities&&h.remoteCapabilities.headerExtensions||[]).forEach(function(A){y.uri===A.uri&&(y.id=A.id)})});var D=h.sendEncodingParameters||[{ssrc:1001*(2*o+1)}];g&&p>=15019&&m==="video"&&!D[0].rtx&&(D[0].rtx={ssrc:D[0].ssrc+1}),h.wantReceive&&(h.rtpReceiver=new d.RTCRtpReceiver(h.dtlsTransport,m)),h.localCapabilities=C,h.sendEncodingParameters=D}),t._config.bundlePolicy!=="max-compat"&&(b+="a=group:BUNDLE "+t.transceivers.map(function(h){return h.mid}).join(" ")+`\r
90
90
  `),b+=`a=ice-options:trickle\r
91
91
  `,t.transceivers.forEach(function(h,o){b+=c(h,h.localCapabilities,"offer",h.stream,t._dtlsRole),b+=`a=rtcp-rsize\r
92
92
  `,!h.iceGatherer||t.iceGatheringState==="new"||o!==0&&t.usingBundle||(h.iceGatherer.getLocalCandidates().forEach(function(g){g.component=1,b+="a="+v.writeCandidate(g)+`\r
@@ -143,18 +143,18 @@ t=0 0\r
143
143
  `;S+="a="+f,S+="a=ssrc:"+x.sendEncodingParameters[0].ssrc+" "+f,x.sendEncodingParameters[0].rtx&&(S+="a=ssrc:"+x.sendEncodingParameters[0].rtx.ssrc+" "+f,S+="a=ssrc-group:FID "+x.sendEncodingParameters[0].ssrc+" "+x.sendEncodingParameters[0].rtx.ssrc+`\r
144
144
  `)}return S+="a=ssrc:"+x.sendEncodingParameters[0].ssrc+" cname:"+R.localCName+`\r
145
145
  `,x.rtpSender&&x.sendEncodingParameters[0].rtx&&(S+="a=ssrc:"+x.sendEncodingParameters[0].rtx.ssrc+" cname:"+R.localCName+`\r
146
- `),S},R.getDirection=function(x,v){for(var c=R.splitLines(x),u=0;u<c.length;u++)switch(c[u]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return c[u].substr(2)}return v?R.getDirection(v):"sendrecv"},R.getKind=function(x){return R.splitLines(x)[0].split(" ")[0].substr(2)},R.isRejected=function(x){return x.split(" ",2)[1]==="0"},R.parseMLine=function(x){var v=R.splitLines(x)[0].substr(2).split(" ");return{kind:v[0],port:parseInt(v[1],10),protocol:v[2],fmt:v.slice(3).join(" ")}},R.parseOLine=function(x){var v=R.matchPrefix(x,"o=")[0].substr(2).split(" ");return{username:v[0],sessionId:v[1],sessionVersion:parseInt(v[2],10),netType:v[3],addressType:v[4],address:v[5]}},R.isValidSDP=function(x){if(typeof x!="string"||x.length===0)return!1;for(var v=R.splitLines(x),c=0;c<v.length;c++)if(v[c].length<2||v[c].charAt(1)!=="=")return!1;return!0},L.exports=R},4845:function(L,R,x){var v=this&&this.__assign||function(){return v=Object.assign||function(t){for(var i,l=1,E=arguments.length;l<E;l++)for(var b in i=arguments[l])Object.prototype.hasOwnProperty.call(i,b)&&(t[b]=i[b]);return t},v.apply(this,arguments)},c=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(R,"__esModule",{value:!0}),R.AliRTS=void 0;var u=x(2550),S=x(9428),f=x(3412),a=x(7668),d=x(233),p=c(x(2818)),e=x(5259),r=x(7989),n=x(6420),s=function(){function t(){}return t.createClient=function(i){var l=i||{};return l.customReporter||(l.customReporter=t.customReporter),l.trackLog===void 0&&(l.trackLog=t.trackLog),new a.RtsClient(l)},t.getMicList=function(){var i=this;return new Promise(function(l,E){i.deviceManager.getMicList().then(function(b){l(b)}).catch(function(b){E(b)})})},t.getCameraList=function(){var i=this;return new Promise(function(l,E){i.deviceManager.getCameraList().then(function(b){l(b)}).catch(function(b){E(b)})})},t.getSpeakerList=function(){var i=this;return new Promise(function(l,E){i.deviceManager.getSpeakerList().then(function(b){l(b)}).catch(function(b){E(b)})})},t.createStream=function(i){return new Promise(function(l,E){var b=new u.LocalStream,_=new p.default({customReporter:t.customReporter,trackLog:t.trackLog});b.init(i).then(function(){l(b),_.reportStreamCreated(i,{videoTrack:!!b.videoTrack,audioTrack:!!b.audioTrack,screenAudio:!!b.screenAudioTrack,surface:b.screenSurfaceType})}).catch(function(h){var o=v(v({},h),{relatedLink:h.extraInfo});delete o.extraInfo,E(o),_.reportErrorInfo(S.ErrorCode.ERROR_INIT_LOCAL_FAIL,h.message,h.traceId,{config:i,originErr:h})})})},t.deviceManager=new f.BrowserDeviceManager,t.BrowserUtil=d.BrowserUtil,t.SystenUtil=d.SystemUtil,t.SupportUtil=r.SupportUtil,t.Clock=n.Clock,t.VideoProfileMap=e.VideoProfileMap,t.ScreenProfileMap=e.ScreenProfileMap,t.AudioProfileMap=e.AudioProfileMap,t.ErrorCode=S.ErrorCode,t.customReporter=function(){},t.trackLog=!0,t}();R.AliRTS=s},7028:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.default={version:"2.12.5",protocol_version:2,sdk_version:"0.0.1"}},9428:(L,R)=>{var x,v;Object.defineProperty(R,"__esModule",{value:!0}),R.PUB_RECONNECT_ERROR_LIST=R.RECONNECT_ERROR_EXCLUDE_LIST=R.SUB_RECONNECT_ERROR_LIST=R.DeviceErrorCode=R.ErrorCode=void 0,function(c){c[c.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",c[c.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",c[c.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",c[c.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",c[c.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",c[c.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",c[c.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",c[c.ERROR_DEIVCE_CONSTRAINEDERROR=10007]="ERROR_DEIVCE_CONSTRAINEDERROR",c[c.ERROR_SCREENSHARE_UNKNOWNERRO=10010]="ERROR_SCREENSHARE_UNKNOWNERRO",c[c.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",c[c.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",c[c.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",c[c.ERROR_SCREENSHARE_INVALIDACCESS=10014]="ERROR_SCREENSHARE_INVALIDACCESS",c[c.ERROR_SCREENSHARE_NOTSUPPORT=10018]="ERROR_SCREENSHARE_NOTSUPPORT",c[c.ERROR_DEVICE_NOTSUPPORT=10019]="ERROR_DEVICE_NOTSUPPORT",c[c.ERROR_SIGNAL_ERROR=10101]="ERROR_SIGNAL_ERROR",c[c.ERROR_PLAY_FAILED=10102]="ERROR_PLAY_FAILED",c[c.ERROR_NOTSUPPORT_WEBRTC=10110]="ERROR_NOTSUPPORT_WEBRTC",c[c.ERROR_BROWSER_NOTSUPPORT=10111]="ERROR_BROWSER_NOTSUPPORT",c[c.ERROR_BROWSER_VERSIONLOW=10112]="ERROR_BROWSER_VERSIONLOW",c[c.ERROR_NOTSUPPORT_H264=10113]="ERROR_NOTSUPPORT_H264",c[c.ERROR_CREATEOFFER=10114]="ERROR_CREATEOFFER",c[c.ERROR_NO_DATACHANNEL=10115]="ERROR_NO_DATACHANNEL",c[c.ERROR_INIT_LOCAL_FAIL=10116]="ERROR_INIT_LOCAL_FAIL",c[c.ERROR_HEMLELEMENT_NOTMATCH=10125]="ERROR_HEMLELEMENT_NOTMATCH",c[c.ERROR_AUTOPLAY_ERROR=10201]="ERROR_AUTOPLAY_ERROR",c[c.ERROR_PLAY_URL=10202]="ERROR_PLAY_URL",c[c.ERROR_SUBSCRIBE_NOTHING=10203]="ERROR_SUBSCRIBE_NOTHING",c[c.ERROR_HTMLELEMENT_ERROR=10204]="ERROR_HTMLELEMENT_ERROR",c[c.ERROR_HTTPREQUEST_ERROR=10205]="ERROR_HTTPREQUEST_ERROR",c[c.ERROR_ANSWER_ERROR=10206]="ERROR_ANSWER_ERROR",c[c.ERROR_INBOUND_TIMEOUT=10207]="ERROR_INBOUND_TIMEOUT",c[c.ERROR_STREAM_ENDED=10208]="ERROR_STREAM_ENDED",c[c.ERROR_PC_DISCONNECTED=10209]="ERROR_PC_DISCONNECTED",c[c.ERROR_TRANSPORT_CLOSED=10210]="ERROR_TRANSPORT_CLOSED",c[c.ERROR_SIGNAL_URL=10211]="ERROR_SIGNAL_URL",c[c.ERROR_IP_MIGRATE=10212]="ERROR_IP_MIGRATE",c[c.ERROR_PUBLISH_URL=10300]="ERROR_PUBLISH_URL",c[c.ERROR_PUBLISH_NOAUDIO=10301]="ERROR_PUBLISH_NOAUDIO",c[c.ERROR_PUBLISH_NOSTREAM=10302]="ERROR_PUBLISH_NOSTREAM",c[c.ERROR_DATACHANNEL_PARAM=10500]="ERROR_DATACHANNEL_PARAM",c[c.ERROR_DATACHANNEL_OPEN=10501]="ERROR_DATACHANNEL_OPEN",c[c.ERROR_MEDIASTREAMTRACK_TYPE_ERROR=11e3]="ERROR_MEDIASTREAMTRACK_TYPE_ERROR",c[c.ERROR_MEDIASTREAMTRACK_KIND_ERROR=11001]="ERROR_MEDIASTREAMTRACK_KIND_ERROR",c[c.ERROR_MEDIASTREAMTRACK_AUDIO_NONE=11002]="ERROR_MEDIASTREAMTRACK_AUDIO_NONE",c[c.ERROR_CUSTOMSTREAM_NONE=11003]="ERROR_CUSTOMSTREAM_NONE",c[c.ERROR_CUSTOMSTREAM_INVALID=11004]="ERROR_CUSTOMSTREAM_INVALID",c[c.ERROR_CUSTOMSTREAM_TRACK_NONE=11005]="ERROR_CUSTOMSTREAM_TRACK_NONE",c[c.ERROR_PREERCONNECTION_UNKNOWN=12e3]="ERROR_PREERCONNECTION_UNKNOWN",c[c.ERROR_SUBADD_NO_RESULT=13e3]="ERROR_SUBADD_NO_RESULT",c[c.ERROR_PUBADD_NO_RESULT=13001]="ERROR_PUBADD_NO_RESULT",c[c.ERROR_SINGLE_PC_STREAM_ERROR=13100]="ERROR_SINGLE_PC_STREAM_ERROR",c[c.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED=13101]="ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED",c[c.ERROR_SINGLE_PC_FULL_RECONNECT=13102]="ERROR_SINGLE_PC_FULL_RECONNECT",c[c.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED=13103]="ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED"}(x||(R.ErrorCode=x={})),function(c){c[c.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",c[c.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",c[c.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",c[c.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",c[c.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",c[c.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",c[c.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",c[c.ERROR_SCREENSHARE_NOTSUPPORT=10010]="ERROR_SCREENSHARE_NOTSUPPORT",c[c.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",c[c.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",c[c.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",c[c.ERROR_SCREENSHARE_SAFARI_INVALIDACCESS=10014]="ERROR_SCREENSHARE_SAFARI_INVALIDACCESS",c[c.ERROR_SCREENSHARE_UNKNOWNERRO=10019]="ERROR_SCREENSHARE_UNKNOWNERRO",c[c.ERROR_DEVICE_NOTSUPPORT=2e4]="ERROR_DEVICE_NOTSUPPORT"}(v||(R.DeviceErrorCode=v={})),R.SUB_RECONNECT_ERROR_LIST=[x.ERROR_INBOUND_TIMEOUT,x.ERROR_STREAM_ENDED,x.ERROR_PC_DISCONNECTED],R.RECONNECT_ERROR_EXCLUDE_LIST=[x.ERROR_AUTOPLAY_ERROR,x.ERROR_PLAY_URL,x.ERROR_SUBSCRIBE_NOTHING,x.ERROR_HTMLELEMENT_ERROR,x.ERROR_HEMLELEMENT_NOTMATCH,x.ERROR_PUBLISH_URL,x.ERROR_PUBLISH_NOAUDIO,x.ERROR_PUBLISH_NOSTREAM],R.PUB_RECONNECT_ERROR_LIST=[x.ERROR_PC_DISCONNECTED,x.ERROR_TRANSPORT_CLOSED]},5044:(L,R,x)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.RtsError=void 0;var v=x(9428),c=function(){function u(S,f,a,d){this.errorCode=S,this.errorCodeName=v.ErrorCode[S],this.message=f,this.traceId=a,d&&(this.extraInfo=d)}return u.prototype.renameCode=function(S){this.errorCode=S,this.errorCodeName=v.ErrorCode[S]},u}();R.RtsError=c},6091:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.PlayEvent=R.PlayType=void 0,R.PlayType={PLAY_CANPLAY:"canplay",PLAY_WAITING:"waiting",PLAY_PLAYING:"playing",PLAY_MEDIA:"media",PLAY_ENDED:"ended",PLAY_TIMEOUT:"timeout"};var x=function(v){this.event=v};R.PlayEvent=x},5917:(L,R)=>{var x,v,c,u;Object.defineProperty(R,"__esModule",{value:!0}),R.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=R.DEFAULT_HEARTBEAT_TIMEOUT=R.DEFAULT_RETRY_PUBLISH_INTERVAL=R.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=R.DEFAULT_RETRY_PUBLISH_LIMIT=R.DEFAULT_RETRY_SUBSCRIBE_LIMIT=R.EWorkerAction=R.EWorkerSource=R.EConnectStatus=R.TrackType=void 0,function(S){S.AUDIO="audio",S.VIDEO="video"}(x||(R.TrackType=x={})),function(S){S[S.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",S[S.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",S[S.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",S[S.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(v||(R.EConnectStatus=v={})),function(S){S.Sender="sender",S.Receiver="receiver"}(c||(R.EWorkerSource=c={})),function(S){S.Setup="setup",S.InserSEI="insertSEI"}(u||(R.EWorkerAction=u={})),R.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,R.DEFAULT_RETRY_PUBLISH_LIMIT=5,R.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,R.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,R.DEFAULT_HEARTBEAT_TIMEOUT=8,R.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},6600:function(L,R,x){var v,c=this&&this.__extends||(v=function(_,h){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,g){o.__proto__=g}||function(o,g){for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(o[m]=g[m])},v(_,h)},function(_,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function o(){this.constructor=_}v(_,h),_.prototype=h===null?Object.create(h):(o.prototype=h.prototype,new o)}),u=this&&this.__assign||function(){return u=Object.assign||function(_){for(var h,o=1,g=arguments.length;o<g;o++)for(var m in h=arguments[o])Object.prototype.hasOwnProperty.call(h,m)&&(_[m]=h[m]);return _},u.apply(this,arguments)},S=this&&this.__awaiter||function(_,h,o,g){return new(o||(o=Promise))(function(m,T){function C(A){try{y(g.next(A))}catch(O){T(O)}}function D(A){try{y(g.throw(A))}catch(O){T(O)}}function y(A){var O;A.done?m(A.value):(O=A.value,O instanceof o?O:new o(function(j){j(O)})).then(C,D)}y((g=g.apply(_,h||[])).next())})},f=this&&this.__generator||function(_,h){var o,g,m,T,C={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return T={next:D(0),throw:D(1),return:D(2)},typeof Symbol=="function"&&(T[Symbol.iterator]=function(){return this}),T;function D(y){return function(A){return function(O){if(o)throw new TypeError("Generator is already executing.");for(;T&&(T=0,O[0]&&(C=0)),C;)try{if(o=1,g&&(m=2&O[0]?g.return:O[0]?g.throw||((m=g.return)&&m.call(g),0):g.next)&&!(m=m.call(g,O[1])).done)return m;switch(g=0,m&&(O=[2&O[0],m.value]),O[0]){case 0:case 1:m=O;break;case 4:return C.label++,{value:O[1],done:!1};case 5:C.label++,g=O[1],O=[0];continue;case 7:O=C.ops.pop(),C.trys.pop();continue;default:if(m=C.trys,!((m=m.length>0&&m[m.length-1])||O[0]!==6&&O[0]!==2)){C=0;continue}if(O[0]===3&&(!m||O[1]>m[0]&&O[1]<m[3])){C.label=O[1];break}if(O[0]===6&&C.label<m[1]){C.label=m[1],m=O;break}if(m&&C.label<m[2]){C.label=m[2],C.ops.push(O);break}m[2]&&C.ops.pop(),C.trys.pop();continue}O=h.call(_,C)}catch(j){O=[6,j],g=0}finally{o=m=0}if(5&O[0])throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}([y,A])}}},a=this&&this.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(R,"__esModule",{value:!0}),R.CommonController=void 0;var d=x(771),p=x(5917),e=a(x(102)),r=x(9594),n=x(5044),s=x(9428),t=x(6091),i=x(5788),l=x(280),E=function(_){function h(o){var g=_.call(this)||this;return g.datachannelList=new b,g.receiverCodecPreferences={},g.senderCodecPreferences={},g.canAutoAssignDcId=!0,g.reporter=o,g.signalChannel=new i.SignalChannel({reporter:o}),g.proxySignalChannelEvents(),g}return c(h,_),h.prototype.setPeerconnection=function(o){var g=this;o!==this.peerconnection&&(this.peerconnection&&this.peerconnection.removeAllListeners(),this.peerconnection=o,this.signalChannel.isOpen||(this.waitForOpenPms=new Promise(function(m,T){g.peerconnection.on("datachannelStatusChange",function(C){var D;g.emit("datachannelStatusChange",C),C.status===l.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(g.signalChannel.setPeerConnection(o),g.canAutoAssignDcId=typeof((D=g.signalChannel.datachannelCore)===null||D===void 0?void 0:D.id)=="number",m())})})),this.peerconnection.on("innerSubscribeDeleteTracks",function(m){g.handleWorkerSubDelete(m)}),this.peerconnection.on("encodedFrame",function(m){var T;g.emit("encodedFrame",m),m.kind==="video"&&(0,r.parseSei)((T=m.frame)===null||T===void 0?void 0:T.data).forEach(function(C){g.emit("receivedSEI",{url:m.url,vMsid:m.vMsid,sei:C})})}),this.peerconnection.on("message",function(m){var T;(T=g.reporter)===null||T===void 0||T.reportNotifyMessage(m)}),this.peerconnection.on("hebtReceived",function(m){g.emit("heartbeat",m)}),this.peerconnection.on("streamError",function(m){g.emit("onError",new n.RtsError(s.ErrorCode.ERROR_SINGLE_PC_STREAM_ERROR,m.resMsg,"",u({},m)))}),this.peerconnection.on("streamReconnect",function(m){g.emit("reconnect",{type:m.type,reason:new n.RtsError(s.ErrorCode.ERROR_SINGLE_PC_STREAM_ERROR,m.resMsg,"",u({},m)),retryTimes:1,extraInfo:u({},m)}),g.singleStreamReconnect(m).then(function(){g.emit("reconnectFinish",{type:m.type,latestUrl:m.latestUrl,msids:m.msids})}).catch(function(T){g.emit("onError",new n.RtsError(s.ErrorCode.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED,"single stream reconnect failed","",{originError:T}))})}),this.peerconnection.on("traceIdUpdate",function(m){g.emit("traceId",m)}),this.peerconnection.on("pcReconnect",function(m){g.emit("reconnect",{type:"pc",reason:new n.RtsError(s.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT,m.reMsg,"",u({},m)),retryTimes:1,extraInfo:u({},m)})}),(this.receiverCodecPreferences.video||this.receiverCodecPreferences.audio)&&this.peerconnection.setReceiverCodecPreferences(this.receiverCodecPreferences),(this.senderCodecPreferences.video||this.senderCodecPreferences.audio)&&this.peerconnection.setSenderCodecPreferences(this.senderCodecPreferences))},Object.defineProperty(h.prototype,"peerCore",{get:function(){var o;return(o=this.peerconnection)===null||o===void 0?void 0:o.getPeerCore()},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"streamManager",{get:function(){var o;return(o=this.peerCore)===null||o===void 0?void 0:o.getStreamManager()},enumerable:!1,configurable:!0}),h.prototype.subscribeAdd=function(o,g){return S(this,void 0,void 0,function(){var m,T,C,D,y,A,O,j,I=this;return f(this,function(H){switch(H.label){case 0:if(o.forEach(function(F){var U;(U=I.reporter)===null||U===void 0||U.reportSubscribeStart(F.url,"",F.vMsid,F.aMsid,!0)}),!this.peerconnection)throw this.makeRtsError("subscribeAdd");this.peerconnection.isReused=!0,m=new Date().getTime(),H.label=1;case 1:return H.trys.push([1,3,,4]),[4,this.peerconnection.subAdd(o,g)];case 2:if(!(T=H.sent()).streamList)throw new n.RtsError(s.ErrorCode.ERROR_SUBADD_NO_RESULT,"subAdd streamList not found","",{api:"subscribeAdd",configList:o,response:T});return[3,4];case 3:throw C=H.sent(),D=C,(j=this.reporter)===null||j===void 0||j.reportErrorInfo(D.errorCode,D.message,D.traceId,D.extraInfo),D;case 4:return y=T.deleteRspTime-m,A=T.subAddRspTime-T.deleteRspTime,O=T.activeRspTime-T.subAddRspTime,T.streamList.forEach(function(F,U){var B,k,V,G;(B=I.reporter)===null||B===void 0||B.reportSubscribeOk({vurl:F.url||void 0,isSubAdd:!0});var q,z=o[U]||{},$=z.targetStream,re=z.vMsid,ee=z.aMsid,ie=F.stream;if($)return $.mergeStream(ie),(k=I.streamManager)===null||k===void 0||k.update(F.url,{stream:$,vMsid:re?.[0],aMsid:ee?.[0]}),void(F.stream=$);var se=(V=I.streamManager)===null||V===void 0?void 0:V.getStreamByMsid({url:F.url,vMsid:re?.[0],aMsid:ee?.[0]});if(se)se.mergeStream(ie),q=se;else{(q=new d.RemoteStream).updateMediaStream(ie),(G=I.streamManager)===null||G===void 0||G.update(F.url,{stream:q,vMsid:re?.[0],aMsid:ee?.[0]}),q.on("onCanPlay",function(){var ue,de,pe=new Date().getTime();(ue=I.reporter)===null||ue===void 0||ue.reportFirstFrameTime(F.url,F.traceId,-1,-1,pe-m,0,-1,{},y,A,O,re,ee,!0),(de=I.peerconnection)===null||de===void 0||de.playStart()});var ce=new t.PlayEvent(t.PlayType.PLAY_CANPLAY);ce.data={url:F.url,vMsid:re?.[0]||"vMsid unknown",aMsid:ee?.[0]||"aMsid unknown"},I.emit("onPlayEvent",ce)}F.stream=q}),[2,T.streamList]}})})},h.prototype.subscribeActive=function(o){return S(this,void 0,void 0,function(){var g;return f(this,function(m){if(!this.peerconnection)throw this.makeRtsError("subscribeActive");return[2,(g=this.peerconnection)===null||g===void 0?void 0:g.subActive(o)]})})},h.prototype.subscribeStop=function(o){return S(this,void 0,void 0,function(){var g,m,T,C,D;return f(this,function(y){switch(y.label){case 0:if(!this.peerconnection)throw this.makeRtsError("subscribeStop");y.label=1;case 1:return y.trys.push([1,3,,4]),[4,this.peerconnection.subStop(o)];case 2:return g=y.sent(),this.peerconnection.getSubMonitor().updateTranceiversController(),m=this.peerconnection.getWorkerManager(),o.forEach(function(A){m.removeByUrl({url:A.url,source:p.EWorkerSource.Receiver})}),[3,4];case 3:throw T=y.sent(),C=T,(D=this.reporter)===null||D===void 0||D.reportErrorInfo(C.errorCode,C.message,C.traceId,C.extraInfo),T;case 4:return[2,g]}})})},h.prototype.subscribeDeleteTracks=function(o){return S(this,void 0,void 0,function(){var g,m,T,C;return f(this,function(D){switch(D.label){case 0:if(!this.peerconnection)throw this.makeRtsError("subscribeDeleteTracks");D.label=1;case 1:return D.trys.push([1,3,,4]),[4,this.peerconnection.subDeleteTracks(o)];case 2:if(!(g=D.sent()))throw this.makeRtsError("subscribeDeleteTracks");return this.peerconnection.getSubMonitor().updateTranceiversController(),this.handleWorkerSubDelete(o),[3,4];case 3:throw m=D.sent(),T=m,(C=this.reporter)===null||C===void 0||C.reportErrorInfo(T.errorCode,T.message,T.traceId,T.extraInfo),m;case 4:return[2,g]}})})},h.prototype.handleWorkerSubDelete=function(o){if(this.peerconnection){var g=this.peerconnection.getWorkerManager();o.forEach(function(m){var T,C;!((T=m.vMsid)===null||T===void 0)&&T.length&&g.removeByMsid({url:m.url,source:p.EWorkerSource.Receiver,kind:"video",msid:m.vMsid[0]}),!((C=m.aMsid)===null||C===void 0)&&C.length&&g.removeByMsid({url:m.url,source:p.EWorkerSource.Receiver,kind:"audio",msid:m.aMsid[0]})})}},h.prototype.publishAdd=function(o){return S(this,void 0,void 0,function(){var g,m,T,C,D,y,A,O,j,I,H,F=this;return f(this,function(U){switch(U.label){case 0:if(o.forEach(function(B){var k;(k=F.reporter)===null||k===void 0||k.reportStartPublish(B.url,"",!0)}),g=new Date().getTime(),!this.peerconnection)throw this.makeRtsError("publishAdd");U.label=1;case 1:return U.trys.push([1,3,,4]),[4,(O=this.peerconnection)===null||O===void 0?void 0:O.pubAdd(o)];case 2:if(!(m=U.sent()))throw new n.RtsError(s.ErrorCode.ERROR_PUBADD_NO_RESULT,"pubAdd streamList not found","",{api:"publishAdd",publishInfoList:o});return[3,4];case 3:throw T=U.sent(),C=T,(j=this.reporter)===null||j===void 0||j.reportErrorInfo(C.errorCode,C.message,C.traceId,C.extraInfo),C;case 4:return this.peerconnection.isReused=!0,D=new Date().getTime(),y=D-g,m.forEach(function(B){var k;(k=F.reporter)===null||k===void 0||k.reportPublishOk(B.url||"","",-1,-1,-1,B.traceId||"",y,!0)}),(A=(I=this.peerconnection)===null||I===void 0?void 0:I.getPc())&&(o.forEach(function(B){F.peerconnection&&B.stream.setEncodeParam(A)}),this.peerCore&&((H=this.peerconnection)===null||H===void 0||H.getPubMonitor().startHeartbeat(A,this.peerCore)),A.getSenders().forEach(function(B){var k;B.track&&((k=F.peerconnection)===null||k===void 0||k.handleEncodedInsertableStreams({sender:B}))})),[2,m]}})})},h.prototype.publishDeleteTracks=function(o){return S(this,void 0,void 0,function(){var g,m,T,C,D;return f(this,function(y){switch(y.label){case 0:if(!this.peerconnection)throw this.makeRtsError("publishDeleteTracks");y.label=1;case 1:return y.trys.push([1,3,,4]),[4,this.peerconnection.pubDeleteTracks(o)];case 2:if(!(g=y.sent()))throw this.makeRtsError("publishDeleteTracks");return this.peerconnection.getPubMonitor().updateSenders(),m=this.peerconnection.getWorkerManager(),o.forEach(function(A){var O,j;!((O=A.vMsid)===null||O===void 0)&&O.length&&m.removeByMsid({url:A.url,source:p.EWorkerSource.Sender,kind:"video",msid:A.vMsid[0]}),!((j=A.aMsid)===null||j===void 0)&&j.length&&m.removeByMsid({url:A.url,source:p.EWorkerSource.Sender,kind:"audio",msid:A.aMsid[0]})}),[3,4];case 3:throw T=y.sent(),C=T,(D=this.reporter)===null||D===void 0||D.reportErrorInfo(C.errorCode,C.message,C.traceId,C.extraInfo),T;case 4:return[2,g]}})})},h.prototype.publishReplaceTracks=function(o){return S(this,void 0,void 0,function(){var g,m,T,C;return f(this,function(D){switch(D.label){case 0:if(!this.peerconnection)throw this.makeRtsError("publishReplaceTracks");D.label=1;case 1:return D.trys.push([1,3,,4]),[4,this.peerconnection.pubReplaceTracks(o)];case 2:if(!(g=D.sent()))throw this.makeRtsError("publishReplaceTracks");return this.peerconnection.getPubMonitor().updateSenders(),[3,4];case 3:throw m=D.sent(),T=m,(C=this.reporter)===null||C===void 0||C.reportErrorInfo(T.errorCode,T.message,T.traceId,T.extraInfo),m;case 4:return[2,g]}})})},h.prototype.publishStop=function(o){return S(this,void 0,void 0,function(){var g,m,T,C,D,y=this;return f(this,function(A){switch(A.label){case 0:if(o.forEach(function(O){var j;(j=y.reporter)===null||j===void 0||j.reportStopPublish(O.url,!0)}),!this.peerconnection)throw this.makeRtsError("publishStop");A.label=1;case 1:return A.trys.push([1,3,,4]),[4,this.peerconnection.pubStop(o)];case 2:return g=A.sent(),this.peerconnection.getPubMonitor().updateSenders(),m=this.peerconnection.getWorkerManager(),o.forEach(function(O){m.removeByUrl({url:O.url,source:p.EWorkerSource.Sender})}),[3,4];case 3:throw T=A.sent(),C=T,(D=this.reporter)===null||D===void 0||D.reportErrorInfo(C.errorCode,C.message,C.traceId,C.extraInfo),T;case 4:return[2,g]}})})},h.prototype.handleAddDatachannel=function(o){return S(this,void 0,void 0,function(){var g,m,T,C,D,y,A,O,j,I,H,F,U=this;return f(this,function(B){switch(B.label){case 0:if(!o.url||!o.signalUrl||!o.msid)throw m=new n.RtsError(s.ErrorCode.ERROR_DATACHANNEL_PARAM,"url, signalUrl, msid is required by subscribe(publish)AddDatachannel",""),(A=this.reporter)===null||A===void 0||A.reportErrorInfo(m.errorCode,m.message,m.traceId,m.extraInfo),m;return g=o.type==="sub",this.waitForOpenPms?[4,this.waitForOpenPms]:[3,2];case 1:B.sent(),this.waitForOpenPms=void 0,B.label=2;case 2:if(this.signalChannel.isOpen)return[3,4];if(console.warn("Creating a new signal channel"),!o.signalUrl)throw m=new n.RtsError(s.ErrorCode.ERROR_SIGNAL_URL,"signal url is required",""),(O=this.reporter)===null||O===void 0||O.reportErrorInfo(m.errorCode,m.message,m.traceId,m.extraInfo),m;return[4,this.initSignalChannel(o)];case 3:B.sent(),this.setPeerconnection(this.signalChannel.getPeerConnection()),this.canAutoAssignDcId=typeof((j=this.signalChannel.datachannelCore)===null||j===void 0?void 0:j.id)=="number",B.label=4;case 4:if(T=performance.now(),C={url:o.url,label:o.label,surl:o.signalUrl,msid:o.msid},g?(I=this.reporter)===null||I===void 0||I.reportDatachannelSubAdd(C):(H=this.reporter)===null||H===void 0||H.reportDatachannelPubAdd(C),!(D=(F=this.peerconnection)===null||F===void 0?void 0:F.getPc()))throw new Error("No avaliable peerconnection");return y=new l.DataChannelCore({pc:D,label:o.label,datachannelList:this.datachannelList.list,assignId:!this.canAutoAssignDcId}),this.datachannelList.update(y),[2,new Promise(function(k,V){return S(U,void 0,void 0,function(){var G,q,z,$,re,ee,ie,se,ce,ue,de,pe,Ee,he,fe,me,ge=this;return f(this,function(_e){switch(_e.label){case 0:G="",q=!1,z=!1,y.on("statusChange",function(Re){var Te;(Te=ge.reporter)===null||Te===void 0||Te.reportDatachannelStatusChange({state:l.EDatachannelStatus[Re],url:o.url,label:y.label,id:y.id,msid:o.msid}),Re===l.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(q=!0,z&&k({datachannel:y,traceId:G}))}),y.on("dispose",function(){var Re;(Re=ge.reporter)===null||Re===void 0||Re.reportDatachannelDispose({url:o.url,label:y.label,id:y.id,msid:o.msid})}),_e.label=1;case 1:return _e.trys.push([1,6,,7]),$=[{url:o.url,msid:o.msid,datachannelId:y.id,label:o.label,datachannel:y}],g?[4,(ue=this.peerCore)===null||ue===void 0?void 0:ue.subscribeAddDatachannel($)]:[3,3];case 2:return ee=_e.sent(),[3,5];case 3:return[4,(de=this.peerCore)===null||de===void 0?void 0:de.publishAddDatachannel($)];case 4:ee=_e.sent(),_e.label=5;case 5:return G=(Ee=(pe=(re=ee)==null?void 0:re.streams)===null||pe===void 0?void 0:pe[0])===null||Ee===void 0?void 0:Ee.traceid,[3,7];case 6:return ie=_e.sent(),se=ie,(he=this.reporter)===null||he===void 0||he.reportErrorInfo(se.errorCode,se.message||"datachannel ".concat(g?"sub":"pub"," add error"),se.traceId,se.extraInfo),[2,V(ie)];case 7:return ce={url:o.url,drct:Math.floor(performance.now()-T),tcid:G,label:y.label,id:y.id,msid:o.msid},g?(fe=this.reporter)===null||fe===void 0||fe.reportDatachannelSubAddOk(ce):(me=this.reporter)===null||me===void 0||me.reportDatachannelPubAddOk(ce),z=!0,q&&k({datachannel:y,traceId:G}),[2]}})})})]}})})},h.prototype.handleStopDatachannel=function(o){return S(this,void 0,void 0,function(){var g,m,T,C,D,y,A,O,j,I,H,F;return f(this,function(U){switch(U.label){case 0:if(!o.url||!o.datachannel)throw g=new n.RtsError(s.ErrorCode.ERROR_DATACHANNEL_PARAM,"url, datachannel is required by subscribe(publish)StopDatachannel",""),(D=this.reporter)===null||D===void 0||D.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g;if(!this.signalChannel.isOpen)throw g=new n.RtsError(s.ErrorCode.ERROR_NO_DATACHANNEL,"Signal channel is closed",""),(y=this.reporter)===null||y===void 0||y.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g;m=o.type==="sub",T=[{url:o.url}],C={url:o.url,label:o.datachannel.label,id:o.datachannel.id},m?(A=this.reporter)===null||A===void 0||A.reportDatachannelSubStop(C):(O=this.reporter)===null||O===void 0||O.reportDatachannelPubStop(C),U.label=1;case 1:return U.trys.push([1,6,,7]),m?[4,(j=this.peerCore)===null||j===void 0?void 0:j.subscribeStopDatachannel(T)]:[3,3];case 2:return U.sent(),[3,5];case 3:return[4,(I=this.peerCore)===null||I===void 0?void 0:I.publishStopDatachannel(T)];case 4:U.sent(),U.label=5;case 5:return[3,7];case 6:throw U.sent();case 7:return m?(H=this.reporter)===null||H===void 0||H.reportDatachannelSubStopOk(C):(F=this.reporter)===null||F===void 0||F.reportDatachannelPubStopOk(C),o.datachannel.dispose(),[2]}})})},h.prototype.subscribeAddDatachannel=function(o){return S(this,void 0,void 0,function(){return f(this,function(g){return[2,this.handleAddDatachannel(u(u({},o),{type:"sub"}))]})})},h.prototype.publishAddDatachannel=function(o){return S(this,void 0,void 0,function(){return f(this,function(g){return[2,this.handleAddDatachannel(u(u({},o),{type:"pub"}))]})})},h.prototype.subscribeStopDatachannel=function(o){return S(this,void 0,void 0,function(){return f(this,function(g){return[2,this.handleStopDatachannel(u(u({},o),{type:"sub"}))]})})},h.prototype.publishStopDatachannel=function(o){return S(this,void 0,void 0,function(){return f(this,function(g){return[2,this.handleStopDatachannel(u(u({},o),{type:"pub"}))]})})},h.prototype.getSubscribeVideoStats=function(o,g){return this.getSubscribeMediaStats(o,"video",g)},h.prototype.getSubscribeAudioStats=function(o,g){return this.getSubscribeMediaStats(o,"audio",g)},h.prototype.getPublishVideoStats=function(o,g){return this.getPublishMediaStats(o,"video",g)},h.prototype.getPublishAudioStats=function(o,g){return this.getPublishMediaStats(o,"audio",g)},h.prototype.sendSEI=function(o){var g,m;if(!((g=this.peerconnection)===null||g===void 0)&&g.isReused)return(m=this.peerconnection)===null||m===void 0?void 0:m.sendSEI(o)},h.prototype.setReceiverCodecPreferences=function(o){this.receiverCodecPreferences=u({},o)},h.prototype.setSenderCodecPreferences=function(o){this.senderCodecPreferences=u({},o)},h.prototype.getSubscribeMediaStats=function(o,g,m){var T=this;return new Promise(function(C){return S(T,void 0,void 0,function(){var D,y,A,O;return f(this,function(j){switch(j.label){case 0:return this.streamManager?(D=void 0,y=this.streamManager.getAllMediaInfoList(o,!0),m?y.forEach(function(I){var H,F,U,B=(F=(H=I.transceiver)===null||H===void 0?void 0:H.receiver)===null||F===void 0?void 0:F.track;B?.kind===g&&I.msid===m&&(D=(U=I.transceiver)===null||U===void 0?void 0:U.receiver)}):D=(O=(A=y?.find(function(I){var H,F,U;return((U=(F=(H=I.transceiver)===null||H===void 0?void 0:H.receiver)===null||F===void 0?void 0:F.track)===null||U===void 0?void 0:U.kind)===g}))===null||A===void 0?void 0:A.transceiver)===null||O===void 0?void 0:O.receiver,D?[4,D.getStats()]:[2,C({})]):[2,C({})];case 1:return j.sent().forEach(function(I){I.type==="inbound-rtp"&&C(I)}),[2]}})})})},h.prototype.getPublishMediaStats=function(o,g,m){var T=this;return new Promise(function(C){return S(T,void 0,void 0,function(){var D,y,A,O;return f(this,function(j){switch(j.label){case 0:return this.streamManager?(D=void 0,y=this.streamManager.getAllMediaInfoList(o,!0),m?y.forEach(function(I){var H,F,U,B=(F=(H=I.transceiver)===null||H===void 0?void 0:H.sender)===null||F===void 0?void 0:F.track;B?.kind===g&&I.msid===m&&(D=(U=I.transceiver)===null||U===void 0?void 0:U.sender)}):D=(O=(A=y?.find(function(I){var H,F,U;return((U=(F=(H=I.transceiver)===null||H===void 0?void 0:H.sender)===null||F===void 0?void 0:F.track)===null||U===void 0?void 0:U.kind)===g}))===null||A===void 0?void 0:A.transceiver)===null||O===void 0?void 0:O.sender,D?[4,D.getStats()]:[2,C({})]):[2,C({})];case 1:return j.sent().forEach(function(I){I.type==="outbound-rtp"&&C(I)}),[2]}})})})},h.prototype.proxySignalChannelEvents=function(){var o=this;this.signalChannel.on("connectStatusChange",function(g){o.emit("connectStatusChange",g)}),this.signalChannel.on("onError",function(g){o.emit("onError",g)})},h.prototype.initSignalChannel=function(o){return this.signalChannel.createDatachannel(o)},h.prototype.makeRtsError=function(o){var g,m=new n.RtsError(s.ErrorCode.ERROR_NO_DATACHANNEL,"No avaliable datachannel, you should subscribe/publish first.","",{api:o});return(g=this.reporter)===null||g===void 0||g.reportErrorInfo(m.errorCode,m.message,m.traceId,m.extraInfo),m},h.prototype.singleStreamReconnect=function(o){var g=this;return new Promise(function(m,T){var C,D,y=o.type,A=void 0,O=void 0;switch(y){case"sub":(C=o.streams)===null||C===void 0||C.forEach(function(I){var H=[],F=[],U=!0,B=!0;o.msids.forEach(function(k){k.streamId===I.id&&(k.type==="video"?F.push(k.name):k.type==="audio"&&H.push(k.name))}),H.length||(U=!1),F.length||(B=!1),g.subscribeAdd([{url:o.latestUrl,subAudio:U,subVideo:B,vMsid:F,aMsid:H,targetStream:I}],!0).then(function(){m()}).catch(function(k){T(k)})});break;case"pub":(D=o.streams)===null||D===void 0||D.forEach(function(I){var H=[],F=[];o.msids.forEach(function(U){U.streamId===I.id&&(U.type==="video"?F.push(U.name):U.type==="audio"&&H.push(U.name))}),g.publishAdd([{url:o.latestUrl,vMsid:F,aMsid:H,stream:I}]).then(function(){m()}).catch(function(U){T(U)})});break;case"pub-data":if(o.msids.forEach(function(I){A=I.name,O=I.label}),A&&O){var j=o.latestUrl;g.publishAddDatachannel({url:j,signalUrl:j,msid:A,label:O}).then(function(){m()}).catch(function(I){T(I)})}break;case"sub-data":o.msids.forEach(function(I){A=I.name,O=I.label}),A&&O&&(j=o.latestUrl,g.subscribeAddDatachannel({url:j,signalUrl:j,msid:A,label:O}).then(function(){m()}).catch(function(I){T(I)}));break;default:console.warn("RTS PC STREAM RECONNECT: Unknown signal")}})},h.prototype.updateAuth=function(o){var g;return!!(!((g=this.streamManager)===null||g===void 0)&&g.updateLatestUrl(o))},h}(e.default);R.CommonController=E;var b=function(){function _(){this._list=[]}return Object.defineProperty(_.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),_.prototype.update=function(h){var o=this._list.findIndex(function(g){return g.id===h.id});o!==-1?this._list.splice(o,1,h):this._list.push(h)},_}()},9796:function(L,R,x){var v,c=this&&this.__extends||(v=function(b,_){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,o){h.__proto__=o}||function(h,o){for(var g in o)Object.prototype.hasOwnProperty.call(o,g)&&(h[g]=o[g])},v(b,_)},function(b,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");function h(){this.constructor=b}v(b,_),b.prototype=_===null?Object.create(_):(h.prototype=_.prototype,new h)}),u=this&&this.__assign||function(){return u=Object.assign||function(b){for(var _,h=1,o=arguments.length;h<o;h++)for(var g in _=arguments[h])Object.prototype.hasOwnProperty.call(_,g)&&(b[g]=_[g]);return b},u.apply(this,arguments)},S=this&&this.__awaiter||function(b,_,h,o){return new(h||(h=Promise))(function(g,m){function T(y){try{D(o.next(y))}catch(A){m(A)}}function C(y){try{D(o.throw(y))}catch(A){m(A)}}function D(y){var A;y.done?g(y.value):(A=y.value,A instanceof h?A:new h(function(O){O(A)})).then(T,C)}D((o=o.apply(b,_||[])).next())})},f=this&&this.__generator||function(b,_){var h,o,g,m,T={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return m={next:C(0),throw:C(1),return:C(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function C(D){return function(y){return function(A){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,A[0]&&(T=0)),T;)try{if(h=1,o&&(g=2&A[0]?o.return:A[0]?o.throw||((g=o.return)&&g.call(o),0):o.next)&&!(g=g.call(o,A[1])).done)return g;switch(o=0,g&&(A=[2&A[0],g.value]),A[0]){case 0:case 1:g=A;break;case 4:return T.label++,{value:A[1],done:!1};case 5:T.label++,o=A[1],A=[0];continue;case 7:A=T.ops.pop(),T.trys.pop();continue;default:if(g=T.trys,!((g=g.length>0&&g[g.length-1])||A[0]!==6&&A[0]!==2)){T=0;continue}if(A[0]===3&&(!g||A[1]>g[0]&&A[1]<g[3])){T.label=A[1];break}if(A[0]===6&&T.label<g[1]){T.label=g[1],g=A;break}if(g&&T.label<g[2]){T.label=g[2],T.ops.push(A);break}g[2]&&T.ops.pop(),T.trys.pop();continue}A=_.call(b,T)}catch(O){A=[6,O],o=0}finally{h=g=0}if(5&A[0])throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}([D,y])}}},a=this&&this.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(R,"__esModule",{value:!0}),R.Publisher=void 0;var d=x(5917),p=x(4865),e=a(x(7028)),r=x(9428),n=x(5044),s=x(7989),t=a(x(102)),i=a(x(8219)),l=x(2718),E=function(b){function _(h){var o=b.call(this)||this;return o.publishStartTimeStamp=0,o.pubReconnectTimes=0,o.isConnecting=!1,o.reconnectTimerHandle=null,o.reportMonitorTimes=0,o.reportSubFlag=!1,o.reporter=h,o.peerconnection=new p.RtsPeerconnection,o.peerconnection.on("connectStatusChange",function(g){g.status!==d.EConnectStatus.CONNECT_STATUS_DISCONNECTED&&g.status!==d.EConnectStatus.CONNECT_STATUS_RECONNECTING||!o.hasRetries()?o.emit("connectStatusChange",g):o.emit("onError",new n.RtsError(r.ErrorCode.ERROR_PC_DISCONNECTED,"PC disconnected",""))}),o.peerconnection.on("onMonitorEvent",function(g){var m=g.eventList;g.type==="pub"?(o.reportMonitorTimes++,o.reportMonitorTimes%4==0&&(m.forEach(function(T){o.reporter.reportPushStats(T)}),o.reportSubFlag=!0,o.reportMonitorTimes=0)):g.type==="sub"&&o.reportSubFlag&&(o.handleSubMonitorEvent(m),o.reportSubFlag=!1)}),o.peerconnection.on("onTransportStateEvent",function(g){var m;o.peerconnection.isReused||((m=o.peerconnection.getPc())===null||m===void 0?void 0:m.connectionState)!=="closed"&&g.state==="closed"&&o.hasRetries()&&o.emit("onError",new n.RtsError(r.ErrorCode.ERROR_TRANSPORT_CLOSED,"Transport has been closed. ".concat(g.kind,"|").concat(g.type,"|").concat(g.url),"",{protocol:g.protocol}))}),o.peerconnection.on("pcReconnect",function(g){var m,T;g.ips?(m="Migrate with ips: ".concat(JSON.stringify(g.ips)),T=r.ErrorCode.ERROR_IP_MIGRATE):(m="PC disconnected",T=r.ErrorCode.ERROR_PC_DISCONNECTED),o.emit("onError",new n.RtsError(T,m,"",{pcErrorInfo:g}))}),o.signalingUrl="",o.publishUrl="",o.publishConfig={},o}return c(_,b),_.prototype.publish=function(h,o,g){var m=this;return new Promise(function(T,C){if(m.unpublish(),m.localStream=o,m.publishUrl=h,m.publishConfig=g||{},m.checkPublishUrl())if(o)if(o.audioTrack===null)C(new n.RtsError(r.ErrorCode.ERROR_PUBLISH_NOAUDIO,"publish need audiotrack",""));else{var D=g?.signalUrl;m.signalingUrl=D||m.signalingUrl,m.publishStartTimeStamp=new Date().getTime(),o.setReporter(m.reporter),m.peerconnection.createOffer(o.hasAudio,o.hasVideo||o.hasScreen,o,u(u({},g),{publishUrl:h})).then(function(y){var A=y.desp,O=y.publishTrackInfoList;m.publishTrackInfoList=O;var j=new Date().getTime();m.reporter.reportStartPublish(m.publishUrl,m.signalingUrl),m.excuteSignal(A).then(function(I){var H=new Date().getTime();m.peerconnection.recvAnswer(I.data,{answerSdpHook:g?.answerSdpHook,tcpOnly:g?.tcpOnly}).then(function(){m.reporter.reportPublishOk(m.publishUrl,m.signalingUrl,j-m.publishStartTimeStamp,H-j,new Date().getTime()-H,I.data.trace_id),T(I.data.trace_id),m.pubReconnectTimes=0,m.peerconnection.pushStart()}).catch(function(F){F.traceid=I.data?I.data.trace_id:"";var U=new n.RtsError(F.errorCode||r.ErrorCode.ERROR_ANSWER_ERROR,F.message||"set answer error",F.traceid,{sdp:F.sdp});C(U)})}).catch(function(I){var H=new n.RtsError(I.errorCode||r.ErrorCode.ERROR_HTTPREQUEST_ERROR,I.message||"","",{response:I.response,sdp:I.sdp});C(H)})}).catch(function(y){var A=new n.RtsError(y.errorCode||r.ErrorCode.ERROR_CREATEOFFER,y.message||"","");C(A)})}else C(new n.RtsError(r.ErrorCode.ERROR_PUBLISH_NOSTREAM,"publish stream not found",""));else C(new n.RtsError(r.ErrorCode.ERROR_PUBLISH_URL,"url need artc://",""))})},_.prototype.unpublish=function(){this.peerconnection.dispose(),this.reporter.reportStopPublish(),this.signalingUrl="",this.publishUrl="",this.publishTrackInfoList=null},_.prototype.getTrackInfoList=function(){return this.publishTrackInfoList||[]},_.prototype.getPeerConnection=function(){return this.peerconnection},_.prototype.replaceTrack=function(h,o){return this.peerconnection.replaceTrack(this.publishUrl,h,o)},_.prototype.excuteSignal=function(h){var o=this,g={type:h.type,sdp:h.sdp};return this.isSingleMsid()&&(g.sdp=g.sdp.replace(/msid\:-? /g,"msid:")),new Promise(function(m,T){i.default.post(o.signalingUrl,{version:e.default.protocol_version,sdk_version:e.default.sdk_version,mode:"rtc",push_stream:o.publishUrl,jsep:g}).then(function(C){C&&C.status===200?m(C):T({message:C?"response status:"+C.status:"response is null",sdp:g.sdp})}).catch(function(C){return S(o,void 0,void 0,function(){var D,y;return f(this,function(A){switch(A.label){case 0:if(![400,500].includes((y=C.response)===null||y===void 0?void 0:y.status))return[3,4];C.sdp=h.sdp,A.label=1;case 1:return A.trys.push([1,3,,4]),[4,new s.SupportUtil().isSupport({isReceiveVideo:!0})];case 2:return A.sent(),[3,4];case 3:return D=A.sent(),C.errorCode=D?.errorCode,C.message=D?.message,this.pubReconnectTimes=1/0,[3,4];case 4:return T(C),[2]}})})})})},_.prototype.checkPublishUrl=function(){if(!this.publishUrl||this.publishUrl.indexOf("artc://")!==0)return!1;var h=window.location.protocol,o=(["http:","https:"].indexOf(h)>-1?h:"https:")+"//";return this.signalingUrl=this.publishUrl.replace("artc://",o),!0},_.prototype.isSingleMsid=function(){if(!this.publishConfig)return!1;var h=this.publishConfig,o=h.vMsid,g=h.aMsid;return!(!o||!o[0]||o[0].indexOf(" ")!==-1)||!(!g||!g[0]||g[0].indexOf(" ")!==-1)},_.prototype.retryPublish=function(h,o){return S(this,void 0,void 0,function(){var g,m,T,C,D,y,A;return f(this,function(O){switch(O.label){case 0:if(h.extraInfo=u(u({},h.extraInfo),{retryTimes:this.pubReconnectTimes}),!this.hasRetries())return[2,!1];if(typeof(g=this.publishConfig).beforeRetry!="function")return[3,4];O.label=1;case 1:return O.trys.push([1,3,,4]),[4,g.beforeRetry({url:this.publishUrl,stream:this.localStream,vMsid:g.vMsid,aMsid:g.aMsid,useTcp:o})];case 2:return(m=O.sent())?(T=m.url,C=m.stream,D=m.vMsid,y=m.aMsid,C||(console.error("Stream is not returned by beforeRetry function."),this.pubReconnectTimes=1/0),this.reporter.reportReconnectParams("pub",T,D,y,m.useTcp,C?.id),this.publishUrl=T,this.localStream=C,this.publishConfig.vMsid=D,this.publishConfig.aMsid=y,typeof m.useTcp=="boolean"&&(o=m.useTcp),console.log(`Retry with:
146
+ `),S},R.getDirection=function(x,v){for(var c=R.splitLines(x),u=0;u<c.length;u++)switch(c[u]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return c[u].substr(2)}return v?R.getDirection(v):"sendrecv"},R.getKind=function(x){return R.splitLines(x)[0].split(" ")[0].substr(2)},R.isRejected=function(x){return x.split(" ",2)[1]==="0"},R.parseMLine=function(x){var v=R.splitLines(x)[0].substr(2).split(" ");return{kind:v[0],port:parseInt(v[1],10),protocol:v[2],fmt:v.slice(3).join(" ")}},R.parseOLine=function(x){var v=R.matchPrefix(x,"o=")[0].substr(2).split(" ");return{username:v[0],sessionId:v[1],sessionVersion:parseInt(v[2],10),netType:v[3],addressType:v[4],address:v[5]}},R.isValidSDP=function(x){if(typeof x!="string"||x.length===0)return!1;for(var v=R.splitLines(x),c=0;c<v.length;c++)if(v[c].length<2||v[c].charAt(1)!=="=")return!1;return!0},L.exports=R},4845:function(L,R,x){var v=this&&this.__assign||function(){return v=Object.assign||function(t){for(var i,l=1,E=arguments.length;l<E;l++)for(var b in i=arguments[l])Object.prototype.hasOwnProperty.call(i,b)&&(t[b]=i[b]);return t},v.apply(this,arguments)},c=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(R,"__esModule",{value:!0}),R.AliRTS=void 0;var u=x(2550),S=x(9428),f=x(3412),a=x(7668),d=x(233),p=c(x(2818)),e=x(5259),r=x(7989),n=x(6420),s=function(){function t(){}return t.createClient=function(i){var l=i||{};return l.customReporter||(l.customReporter=t.customReporter),l.trackLog===void 0&&(l.trackLog=t.trackLog),new a.RtsClient(l)},t.getMicList=function(){var i=this;return new Promise(function(l,E){i.deviceManager.getMicList().then(function(b){l(b)}).catch(function(b){E(b)})})},t.getCameraList=function(){var i=this;return new Promise(function(l,E){i.deviceManager.getCameraList().then(function(b){l(b)}).catch(function(b){E(b)})})},t.getSpeakerList=function(){var i=this;return new Promise(function(l,E){i.deviceManager.getSpeakerList().then(function(b){l(b)}).catch(function(b){E(b)})})},t.createStream=function(i){return new Promise(function(l,E){var b=new u.LocalStream,_=new p.default({customReporter:t.customReporter,trackLog:t.trackLog});b.init(i).then(function(){l(b),_.reportStreamCreated(i,{videoTrack:!!b.videoTrack,audioTrack:!!b.audioTrack,screenAudio:!!b.screenAudioTrack,surface:b.screenSurfaceType})}).catch(function(h){var o=v(v({},h),{relatedLink:h.extraInfo});delete o.extraInfo,E(o),_.reportErrorInfo(S.ErrorCode.ERROR_INIT_LOCAL_FAIL,h.message,h.traceId,{config:i,originErr:h})})})},t.deviceManager=new f.BrowserDeviceManager,t.BrowserUtil=d.BrowserUtil,t.SystenUtil=d.SystemUtil,t.SupportUtil=r.SupportUtil,t.Clock=n.Clock,t.VideoProfileMap=e.VideoProfileMap,t.ScreenProfileMap=e.ScreenProfileMap,t.AudioProfileMap=e.AudioProfileMap,t.ErrorCode=S.ErrorCode,t.customReporter=function(){},t.trackLog=!0,t}();R.AliRTS=s},7028:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.default={version:"2.12.5",protocol_version:2,sdk_version:"0.0.1"}},9428:(L,R)=>{var x,v;Object.defineProperty(R,"__esModule",{value:!0}),R.PUB_RECONNECT_ERROR_LIST=R.RECONNECT_ERROR_EXCLUDE_LIST=R.SUB_RECONNECT_ERROR_LIST=R.DeviceErrorCode=R.ErrorCode=void 0,function(c){c[c.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",c[c.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",c[c.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",c[c.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",c[c.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",c[c.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",c[c.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",c[c.ERROR_DEIVCE_CONSTRAINEDERROR=10007]="ERROR_DEIVCE_CONSTRAINEDERROR",c[c.ERROR_SCREENSHARE_UNKNOWNERRO=10010]="ERROR_SCREENSHARE_UNKNOWNERRO",c[c.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",c[c.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",c[c.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",c[c.ERROR_SCREENSHARE_INVALIDACCESS=10014]="ERROR_SCREENSHARE_INVALIDACCESS",c[c.ERROR_SCREENSHARE_NOTSUPPORT=10018]="ERROR_SCREENSHARE_NOTSUPPORT",c[c.ERROR_DEVICE_NOTSUPPORT=10019]="ERROR_DEVICE_NOTSUPPORT",c[c.ERROR_SIGNAL_ERROR=10101]="ERROR_SIGNAL_ERROR",c[c.ERROR_PLAY_FAILED=10102]="ERROR_PLAY_FAILED",c[c.ERROR_NOTSUPPORT_WEBRTC=10110]="ERROR_NOTSUPPORT_WEBRTC",c[c.ERROR_BROWSER_NOTSUPPORT=10111]="ERROR_BROWSER_NOTSUPPORT",c[c.ERROR_BROWSER_VERSIONLOW=10112]="ERROR_BROWSER_VERSIONLOW",c[c.ERROR_NOTSUPPORT_H264=10113]="ERROR_NOTSUPPORT_H264",c[c.ERROR_CREATEOFFER=10114]="ERROR_CREATEOFFER",c[c.ERROR_NO_DATACHANNEL=10115]="ERROR_NO_DATACHANNEL",c[c.ERROR_INIT_LOCAL_FAIL=10116]="ERROR_INIT_LOCAL_FAIL",c[c.ERROR_HEMLELEMENT_NOTMATCH=10125]="ERROR_HEMLELEMENT_NOTMATCH",c[c.ERROR_AUTOPLAY_ERROR=10201]="ERROR_AUTOPLAY_ERROR",c[c.ERROR_PLAY_URL=10202]="ERROR_PLAY_URL",c[c.ERROR_SUBSCRIBE_NOTHING=10203]="ERROR_SUBSCRIBE_NOTHING",c[c.ERROR_HTMLELEMENT_ERROR=10204]="ERROR_HTMLELEMENT_ERROR",c[c.ERROR_HTTPREQUEST_ERROR=10205]="ERROR_HTTPREQUEST_ERROR",c[c.ERROR_ANSWER_ERROR=10206]="ERROR_ANSWER_ERROR",c[c.ERROR_INBOUND_TIMEOUT=10207]="ERROR_INBOUND_TIMEOUT",c[c.ERROR_STREAM_ENDED=10208]="ERROR_STREAM_ENDED",c[c.ERROR_PC_DISCONNECTED=10209]="ERROR_PC_DISCONNECTED",c[c.ERROR_TRANSPORT_CLOSED=10210]="ERROR_TRANSPORT_CLOSED",c[c.ERROR_SIGNAL_URL=10211]="ERROR_SIGNAL_URL",c[c.ERROR_IP_MIGRATE=10212]="ERROR_IP_MIGRATE",c[c.ERROR_PUBLISH_URL=10300]="ERROR_PUBLISH_URL",c[c.ERROR_PUBLISH_NOAUDIO=10301]="ERROR_PUBLISH_NOAUDIO",c[c.ERROR_PUBLISH_NOSTREAM=10302]="ERROR_PUBLISH_NOSTREAM",c[c.ERROR_DATACHANNEL_PARAM=10500]="ERROR_DATACHANNEL_PARAM",c[c.ERROR_DATACHANNEL_OPEN=10501]="ERROR_DATACHANNEL_OPEN",c[c.ERROR_MEDIASTREAMTRACK_TYPE_ERROR=11e3]="ERROR_MEDIASTREAMTRACK_TYPE_ERROR",c[c.ERROR_MEDIASTREAMTRACK_KIND_ERROR=11001]="ERROR_MEDIASTREAMTRACK_KIND_ERROR",c[c.ERROR_MEDIASTREAMTRACK_AUDIO_NONE=11002]="ERROR_MEDIASTREAMTRACK_AUDIO_NONE",c[c.ERROR_CUSTOMSTREAM_NONE=11003]="ERROR_CUSTOMSTREAM_NONE",c[c.ERROR_CUSTOMSTREAM_INVALID=11004]="ERROR_CUSTOMSTREAM_INVALID",c[c.ERROR_CUSTOMSTREAM_TRACK_NONE=11005]="ERROR_CUSTOMSTREAM_TRACK_NONE",c[c.ERROR_PREERCONNECTION_UNKNOWN=12e3]="ERROR_PREERCONNECTION_UNKNOWN",c[c.ERROR_SUBADD_NO_RESULT=13e3]="ERROR_SUBADD_NO_RESULT",c[c.ERROR_PUBADD_NO_RESULT=13001]="ERROR_PUBADD_NO_RESULT",c[c.ERROR_SINGLE_PC_STREAM_ERROR=13100]="ERROR_SINGLE_PC_STREAM_ERROR",c[c.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED=13101]="ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED",c[c.ERROR_SINGLE_PC_FULL_RECONNECT=13102]="ERROR_SINGLE_PC_FULL_RECONNECT",c[c.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED=13103]="ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED"}(x||(R.ErrorCode=x={})),function(c){c[c.ERROR_DEVICE_UNKNOWNERROR=1e4]="ERROR_DEVICE_UNKNOWNERROR",c[c.ERROR_DEVICE_AUDIODEVICE_NOTFOUND=10001]="ERROR_DEVICE_AUDIODEVICE_NOTFOUND",c[c.ERROR_DEVICE_VIDEODEVICE_NOTFOUND=10002]="ERROR_DEVICE_VIDEODEVICE_NOTFOUND",c[c.ERROR_DEVICE_AUDIODEVICE_NOTALLOWED=10003]="ERROR_DEVICE_AUDIODEVICE_NOTALLOWED",c[c.ERROR_DEVICE_VIDEODEVICE_NOTALLOWED=10004]="ERROR_DEVICE_VIDEODEVICE_NOTALLOWED",c[c.ERROR_DEVICE_AUDIODEVICE_NOTREADABLE=10005]="ERROR_DEVICE_AUDIODEVICE_NOTREADABLE",c[c.ERROR_DEVICE_VIDEODEVICE_NOTREADABLE=10006]="ERROR_DEVICE_VIDEODEVICE_NOTREADABLE",c[c.ERROR_SCREENSHARE_NOTSUPPORT=10010]="ERROR_SCREENSHARE_NOTSUPPORT",c[c.ERROR_SCREENSHARE_NOTALLOWED=10011]="ERROR_SCREENSHARE_NOTALLOWED",c[c.ERROR_SCREENSHARE_ENDED=10012]="ERROR_SCREENSHARE_ENDED",c[c.ERROR_SCREENSHARE_NOPERMISSION=10013]="ERROR_SCREENSHARE_NOPERMISSION",c[c.ERROR_SCREENSHARE_SAFARI_INVALIDACCESS=10014]="ERROR_SCREENSHARE_SAFARI_INVALIDACCESS",c[c.ERROR_SCREENSHARE_UNKNOWNERRO=10019]="ERROR_SCREENSHARE_UNKNOWNERRO",c[c.ERROR_DEVICE_NOTSUPPORT=2e4]="ERROR_DEVICE_NOTSUPPORT"}(v||(R.DeviceErrorCode=v={})),R.SUB_RECONNECT_ERROR_LIST=[x.ERROR_INBOUND_TIMEOUT,x.ERROR_STREAM_ENDED,x.ERROR_PC_DISCONNECTED],R.RECONNECT_ERROR_EXCLUDE_LIST=[x.ERROR_AUTOPLAY_ERROR,x.ERROR_PLAY_URL,x.ERROR_SUBSCRIBE_NOTHING,x.ERROR_HTMLELEMENT_ERROR,x.ERROR_HEMLELEMENT_NOTMATCH,x.ERROR_PUBLISH_URL,x.ERROR_PUBLISH_NOAUDIO,x.ERROR_PUBLISH_NOSTREAM],R.PUB_RECONNECT_ERROR_LIST=[x.ERROR_PC_DISCONNECTED,x.ERROR_TRANSPORT_CLOSED]},5044:(L,R,x)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.RtsError=void 0;var v=x(9428),c=function(){function u(S,f,a,d){this.errorCode=S,this.errorCodeName=v.ErrorCode[S],this.message=f,this.traceId=a,d&&(this.extraInfo=d)}return u.prototype.renameCode=function(S){this.errorCode=S,this.errorCodeName=v.ErrorCode[S]},u}();R.RtsError=c},6091:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.PlayEvent=R.PlayType=void 0,R.PlayType={PLAY_CANPLAY:"canplay",PLAY_WAITING:"waiting",PLAY_PLAYING:"playing",PLAY_MEDIA:"media",PLAY_ENDED:"ended",PLAY_TIMEOUT:"timeout"};var x=function(v){this.event=v};R.PlayEvent=x},5917:(L,R)=>{var x,v,c,u;Object.defineProperty(R,"__esModule",{value:!0}),R.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=R.DEFAULT_HEARTBEAT_TIMEOUT=R.DEFAULT_RETRY_PUBLISH_INTERVAL=R.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=R.DEFAULT_RETRY_PUBLISH_LIMIT=R.DEFAULT_RETRY_SUBSCRIBE_LIMIT=R.EWorkerAction=R.EWorkerSource=R.EConnectStatus=R.TrackType=void 0,function(S){S.AUDIO="audio",S.VIDEO="video"}(x||(R.TrackType=x={})),function(S){S[S.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",S[S.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",S[S.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",S[S.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(v||(R.EConnectStatus=v={})),function(S){S.Sender="sender",S.Receiver="receiver"}(c||(R.EWorkerSource=c={})),function(S){S.Setup="setup",S.InserSEI="insertSEI"}(u||(R.EWorkerAction=u={})),R.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,R.DEFAULT_RETRY_PUBLISH_LIMIT=5,R.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,R.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,R.DEFAULT_HEARTBEAT_TIMEOUT=8,R.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},6600:function(L,R,x){var v,c=this&&this.__extends||(v=function(_,h){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,g){o.__proto__=g}||function(o,g){for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(o[m]=g[m])},v(_,h)},function(_,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function o(){this.constructor=_}v(_,h),_.prototype=h===null?Object.create(h):(o.prototype=h.prototype,new o)}),u=this&&this.__assign||function(){return u=Object.assign||function(_){for(var h,o=1,g=arguments.length;o<g;o++)for(var m in h=arguments[o])Object.prototype.hasOwnProperty.call(h,m)&&(_[m]=h[m]);return _},u.apply(this,arguments)},S=this&&this.__awaiter||function(_,h,o,g){return new(o||(o=Promise))(function(m,T){function C(A){try{y(g.next(A))}catch(w){T(w)}}function D(A){try{y(g.throw(A))}catch(w){T(w)}}function y(A){var w;A.done?m(A.value):(w=A.value,w instanceof o?w:new o(function(j){j(w)})).then(C,D)}y((g=g.apply(_,h||[])).next())})},f=this&&this.__generator||function(_,h){var o,g,m,T,C={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return T={next:D(0),throw:D(1),return:D(2)},typeof Symbol=="function"&&(T[Symbol.iterator]=function(){return this}),T;function D(y){return function(A){return function(w){if(o)throw new TypeError("Generator is already executing.");for(;T&&(T=0,w[0]&&(C=0)),C;)try{if(o=1,g&&(m=2&w[0]?g.return:w[0]?g.throw||((m=g.return)&&m.call(g),0):g.next)&&!(m=m.call(g,w[1])).done)return m;switch(g=0,m&&(w=[2&w[0],m.value]),w[0]){case 0:case 1:m=w;break;case 4:return C.label++,{value:w[1],done:!1};case 5:C.label++,g=w[1],w=[0];continue;case 7:w=C.ops.pop(),C.trys.pop();continue;default:if(m=C.trys,!((m=m.length>0&&m[m.length-1])||w[0]!==6&&w[0]!==2)){C=0;continue}if(w[0]===3&&(!m||w[1]>m[0]&&w[1]<m[3])){C.label=w[1];break}if(w[0]===6&&C.label<m[1]){C.label=m[1],m=w;break}if(m&&C.label<m[2]){C.label=m[2],C.ops.push(w);break}m[2]&&C.ops.pop(),C.trys.pop();continue}w=h.call(_,C)}catch(j){w=[6,j],g=0}finally{o=m=0}if(5&w[0])throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}([y,A])}}},a=this&&this.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(R,"__esModule",{value:!0}),R.CommonController=void 0;var d=x(771),p=x(5917),e=a(x(102)),r=x(9594),n=x(5044),s=x(9428),t=x(6091),i=x(5788),l=x(280),E=function(_){function h(o){var g=_.call(this)||this;return g.datachannelList=new b,g.receiverCodecPreferences={},g.senderCodecPreferences={},g.canAutoAssignDcId=!0,g.reporter=o,g.signalChannel=new i.SignalChannel({reporter:o}),g.proxySignalChannelEvents(),g}return c(h,_),h.prototype.setPeerconnection=function(o){var g=this;o!==this.peerconnection&&(this.peerconnection&&this.peerconnection.removeAllListeners(),this.peerconnection=o,this.signalChannel.isOpen||(this.waitForOpenPms=new Promise(function(m,T){g.peerconnection.on("datachannelStatusChange",function(C){var D;g.emit("datachannelStatusChange",C),C.status===l.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(g.signalChannel.setPeerConnection(o),g.canAutoAssignDcId=typeof((D=g.signalChannel.datachannelCore)===null||D===void 0?void 0:D.id)=="number",m())})})),this.peerconnection.on("innerSubscribeDeleteTracks",function(m){g.handleWorkerSubDelete(m)}),this.peerconnection.on("encodedFrame",function(m){var T;g.emit("encodedFrame",m),m.kind==="video"&&(0,r.parseSei)((T=m.frame)===null||T===void 0?void 0:T.data).forEach(function(C){g.emit("receivedSEI",{url:m.url,vMsid:m.vMsid,sei:C})})}),this.peerconnection.on("message",function(m){var T;(T=g.reporter)===null||T===void 0||T.reportNotifyMessage(m)}),this.peerconnection.on("hebtReceived",function(m){g.emit("heartbeat",m)}),this.peerconnection.on("streamError",function(m){g.emit("onError",new n.RtsError(s.ErrorCode.ERROR_SINGLE_PC_STREAM_ERROR,m.resMsg,"",u({},m)))}),this.peerconnection.on("streamReconnect",function(m){g.emit("reconnect",{type:m.type,reason:new n.RtsError(s.ErrorCode.ERROR_SINGLE_PC_STREAM_ERROR,m.resMsg,"",u({},m)),retryTimes:1,extraInfo:u({},m)}),g.singleStreamReconnect(m).then(function(){g.emit("reconnectFinish",{type:m.type,latestUrl:m.latestUrl,msids:m.msids})}).catch(function(T){g.emit("onError",new n.RtsError(s.ErrorCode.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED,"single stream reconnect failed","",{originError:T}))})}),this.peerconnection.on("traceIdUpdate",function(m){g.emit("traceId",m)}),this.peerconnection.on("pcReconnect",function(m){g.emit("reconnect",{type:"pc",reason:new n.RtsError(s.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT,m.reMsg,"",u({},m)),retryTimes:1,extraInfo:u({},m)})}),(this.receiverCodecPreferences.video||this.receiverCodecPreferences.audio)&&this.peerconnection.setReceiverCodecPreferences(this.receiverCodecPreferences),(this.senderCodecPreferences.video||this.senderCodecPreferences.audio)&&this.peerconnection.setSenderCodecPreferences(this.senderCodecPreferences))},Object.defineProperty(h.prototype,"peerCore",{get:function(){var o;return(o=this.peerconnection)===null||o===void 0?void 0:o.getPeerCore()},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"streamManager",{get:function(){var o;return(o=this.peerCore)===null||o===void 0?void 0:o.getStreamManager()},enumerable:!1,configurable:!0}),h.prototype.subscribeAdd=function(o,g){return S(this,void 0,void 0,function(){var m,T,C,D,y,A,w,j,I=this;return f(this,function(H){switch(H.label){case 0:if(o.forEach(function(F){var U;(U=I.reporter)===null||U===void 0||U.reportSubscribeStart(F.url,"",F.vMsid,F.aMsid,!0)}),!this.peerconnection)throw this.makeRtsError("subscribeAdd");this.peerconnection.isReused=!0,m=new Date().getTime(),H.label=1;case 1:return H.trys.push([1,3,,4]),[4,this.peerconnection.subAdd(o,g)];case 2:if(!(T=H.sent()).streamList)throw new n.RtsError(s.ErrorCode.ERROR_SUBADD_NO_RESULT,"subAdd streamList not found","",{api:"subscribeAdd",configList:o,response:T});return[3,4];case 3:throw C=H.sent(),D=C,(j=this.reporter)===null||j===void 0||j.reportErrorInfo(D.errorCode,D.message,D.traceId,D.extraInfo),D;case 4:return y=T.deleteRspTime-m,A=T.subAddRspTime-T.deleteRspTime,w=T.activeRspTime-T.subAddRspTime,T.streamList.forEach(function(F,U){var B,k,V,G;(B=I.reporter)===null||B===void 0||B.reportSubscribeOk({vurl:F.url||void 0,isSubAdd:!0});var q,z=o[U]||{},$=z.targetStream,re=z.vMsid,ee=z.aMsid,ie=F.stream;if($)return $.mergeStream(ie),(k=I.streamManager)===null||k===void 0||k.update(F.url,{stream:$,vMsid:re?.[0],aMsid:ee?.[0]}),void(F.stream=$);var se=(V=I.streamManager)===null||V===void 0?void 0:V.getStreamByMsid({url:F.url,vMsid:re?.[0],aMsid:ee?.[0]});if(se)se.mergeStream(ie),q=se;else{(q=new d.RemoteStream).updateMediaStream(ie),(G=I.streamManager)===null||G===void 0||G.update(F.url,{stream:q,vMsid:re?.[0],aMsid:ee?.[0]}),q.on("onCanPlay",function(){var ue,de,pe=new Date().getTime();(ue=I.reporter)===null||ue===void 0||ue.reportFirstFrameTime(F.url,F.traceId,-1,-1,pe-m,0,-1,{},y,A,w,re,ee,!0),(de=I.peerconnection)===null||de===void 0||de.playStart()});var ce=new t.PlayEvent(t.PlayType.PLAY_CANPLAY);ce.data={url:F.url,vMsid:re?.[0]||"vMsid unknown",aMsid:ee?.[0]||"aMsid unknown"},I.emit("onPlayEvent",ce)}F.stream=q}),[2,T.streamList]}})})},h.prototype.subscribeActive=function(o){return S(this,void 0,void 0,function(){var g;return f(this,function(m){if(!this.peerconnection)throw this.makeRtsError("subscribeActive");return[2,(g=this.peerconnection)===null||g===void 0?void 0:g.subActive(o)]})})},h.prototype.subscribeStop=function(o){return S(this,void 0,void 0,function(){var g,m,T,C,D;return f(this,function(y){switch(y.label){case 0:if(!this.peerconnection)throw this.makeRtsError("subscribeStop");y.label=1;case 1:return y.trys.push([1,3,,4]),[4,this.peerconnection.subStop(o)];case 2:return g=y.sent(),this.peerconnection.getSubMonitor().updateTranceiversController(),m=this.peerconnection.getWorkerManager(),o.forEach(function(A){m.removeByUrl({url:A.url,source:p.EWorkerSource.Receiver})}),[3,4];case 3:throw T=y.sent(),C=T,(D=this.reporter)===null||D===void 0||D.reportErrorInfo(C.errorCode,C.message,C.traceId,C.extraInfo),T;case 4:return[2,g]}})})},h.prototype.subscribeDeleteTracks=function(o){return S(this,void 0,void 0,function(){var g,m,T,C;return f(this,function(D){switch(D.label){case 0:if(!this.peerconnection)throw this.makeRtsError("subscribeDeleteTracks");D.label=1;case 1:return D.trys.push([1,3,,4]),[4,this.peerconnection.subDeleteTracks(o)];case 2:if(!(g=D.sent()))throw this.makeRtsError("subscribeDeleteTracks");return this.peerconnection.getSubMonitor().updateTranceiversController(),this.handleWorkerSubDelete(o),[3,4];case 3:throw m=D.sent(),T=m,(C=this.reporter)===null||C===void 0||C.reportErrorInfo(T.errorCode,T.message,T.traceId,T.extraInfo),m;case 4:return[2,g]}})})},h.prototype.handleWorkerSubDelete=function(o){if(this.peerconnection){var g=this.peerconnection.getWorkerManager();o.forEach(function(m){var T,C;!((T=m.vMsid)===null||T===void 0)&&T.length&&g.removeByMsid({url:m.url,source:p.EWorkerSource.Receiver,kind:"video",msid:m.vMsid[0]}),!((C=m.aMsid)===null||C===void 0)&&C.length&&g.removeByMsid({url:m.url,source:p.EWorkerSource.Receiver,kind:"audio",msid:m.aMsid[0]})})}},h.prototype.publishAdd=function(o){return S(this,void 0,void 0,function(){var g,m,T,C,D,y,A,w,j,I,H,F=this;return f(this,function(U){switch(U.label){case 0:if(o.forEach(function(B){var k;(k=F.reporter)===null||k===void 0||k.reportStartPublish(B.url,"",!0)}),g=new Date().getTime(),!this.peerconnection)throw this.makeRtsError("publishAdd");U.label=1;case 1:return U.trys.push([1,3,,4]),[4,(w=this.peerconnection)===null||w===void 0?void 0:w.pubAdd(o)];case 2:if(!(m=U.sent()))throw new n.RtsError(s.ErrorCode.ERROR_PUBADD_NO_RESULT,"pubAdd streamList not found","",{api:"publishAdd",publishInfoList:o});return[3,4];case 3:throw T=U.sent(),C=T,(j=this.reporter)===null||j===void 0||j.reportErrorInfo(C.errorCode,C.message,C.traceId,C.extraInfo),C;case 4:return this.peerconnection.isReused=!0,D=new Date().getTime(),y=D-g,m.forEach(function(B){var k;(k=F.reporter)===null||k===void 0||k.reportPublishOk(B.url||"","",-1,-1,-1,B.traceId||"",y,!0)}),(A=(I=this.peerconnection)===null||I===void 0?void 0:I.getPc())&&(o.forEach(function(B){F.peerconnection&&B.stream.setEncodeParam(A)}),this.peerCore&&((H=this.peerconnection)===null||H===void 0||H.getPubMonitor().startHeartbeat(A,this.peerCore)),A.getSenders().forEach(function(B){var k;B.track&&((k=F.peerconnection)===null||k===void 0||k.handleEncodedInsertableStreams({sender:B}))})),[2,m]}})})},h.prototype.publishDeleteTracks=function(o){return S(this,void 0,void 0,function(){var g,m,T,C,D;return f(this,function(y){switch(y.label){case 0:if(!this.peerconnection)throw this.makeRtsError("publishDeleteTracks");y.label=1;case 1:return y.trys.push([1,3,,4]),[4,this.peerconnection.pubDeleteTracks(o)];case 2:if(!(g=y.sent()))throw this.makeRtsError("publishDeleteTracks");return this.peerconnection.getPubMonitor().updateSenders(),m=this.peerconnection.getWorkerManager(),o.forEach(function(A){var w,j;!((w=A.vMsid)===null||w===void 0)&&w.length&&m.removeByMsid({url:A.url,source:p.EWorkerSource.Sender,kind:"video",msid:A.vMsid[0]}),!((j=A.aMsid)===null||j===void 0)&&j.length&&m.removeByMsid({url:A.url,source:p.EWorkerSource.Sender,kind:"audio",msid:A.aMsid[0]})}),[3,4];case 3:throw T=y.sent(),C=T,(D=this.reporter)===null||D===void 0||D.reportErrorInfo(C.errorCode,C.message,C.traceId,C.extraInfo),T;case 4:return[2,g]}})})},h.prototype.publishReplaceTracks=function(o){return S(this,void 0,void 0,function(){var g,m,T,C;return f(this,function(D){switch(D.label){case 0:if(!this.peerconnection)throw this.makeRtsError("publishReplaceTracks");D.label=1;case 1:return D.trys.push([1,3,,4]),[4,this.peerconnection.pubReplaceTracks(o)];case 2:if(!(g=D.sent()))throw this.makeRtsError("publishReplaceTracks");return this.peerconnection.getPubMonitor().updateSenders(),[3,4];case 3:throw m=D.sent(),T=m,(C=this.reporter)===null||C===void 0||C.reportErrorInfo(T.errorCode,T.message,T.traceId,T.extraInfo),m;case 4:return[2,g]}})})},h.prototype.publishStop=function(o){return S(this,void 0,void 0,function(){var g,m,T,C,D,y=this;return f(this,function(A){switch(A.label){case 0:if(o.forEach(function(w){var j;(j=y.reporter)===null||j===void 0||j.reportStopPublish(w.url,!0)}),!this.peerconnection)throw this.makeRtsError("publishStop");A.label=1;case 1:return A.trys.push([1,3,,4]),[4,this.peerconnection.pubStop(o)];case 2:return g=A.sent(),this.peerconnection.getPubMonitor().updateSenders(),m=this.peerconnection.getWorkerManager(),o.forEach(function(w){m.removeByUrl({url:w.url,source:p.EWorkerSource.Sender})}),[3,4];case 3:throw T=A.sent(),C=T,(D=this.reporter)===null||D===void 0||D.reportErrorInfo(C.errorCode,C.message,C.traceId,C.extraInfo),T;case 4:return[2,g]}})})},h.prototype.handleAddDatachannel=function(o){return S(this,void 0,void 0,function(){var g,m,T,C,D,y,A,w,j,I,H,F,U=this;return f(this,function(B){switch(B.label){case 0:if(!o.url||!o.signalUrl||!o.msid)throw m=new n.RtsError(s.ErrorCode.ERROR_DATACHANNEL_PARAM,"url, signalUrl, msid is required by subscribe(publish)AddDatachannel",""),(A=this.reporter)===null||A===void 0||A.reportErrorInfo(m.errorCode,m.message,m.traceId,m.extraInfo),m;return g=o.type==="sub",this.waitForOpenPms?[4,this.waitForOpenPms]:[3,2];case 1:B.sent(),this.waitForOpenPms=void 0,B.label=2;case 2:if(this.signalChannel.isOpen)return[3,4];if(console.warn("Creating a new signal channel"),!o.signalUrl)throw m=new n.RtsError(s.ErrorCode.ERROR_SIGNAL_URL,"signal url is required",""),(w=this.reporter)===null||w===void 0||w.reportErrorInfo(m.errorCode,m.message,m.traceId,m.extraInfo),m;return[4,this.initSignalChannel(o)];case 3:B.sent(),this.setPeerconnection(this.signalChannel.getPeerConnection()),this.canAutoAssignDcId=typeof((j=this.signalChannel.datachannelCore)===null||j===void 0?void 0:j.id)=="number",B.label=4;case 4:if(T=performance.now(),C={url:o.url,label:o.label,surl:o.signalUrl,msid:o.msid},g?(I=this.reporter)===null||I===void 0||I.reportDatachannelSubAdd(C):(H=this.reporter)===null||H===void 0||H.reportDatachannelPubAdd(C),!(D=(F=this.peerconnection)===null||F===void 0?void 0:F.getPc()))throw new Error("No avaliable peerconnection");return y=new l.DataChannelCore({pc:D,label:o.label,datachannelList:this.datachannelList.list,assignId:!this.canAutoAssignDcId}),this.datachannelList.update(y),[2,new Promise(function(k,V){return S(U,void 0,void 0,function(){var G,q,z,$,re,ee,ie,se,ce,ue,de,pe,Ee,he,fe,me,ge=this;return f(this,function(_e){switch(_e.label){case 0:G="",q=!1,z=!1,y.on("statusChange",function(Re){var Te;(Te=ge.reporter)===null||Te===void 0||Te.reportDatachannelStatusChange({state:l.EDatachannelStatus[Re],url:o.url,label:y.label,id:y.id,msid:o.msid}),Re===l.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(q=!0,z&&k({datachannel:y,traceId:G}))}),y.on("dispose",function(){var Re;(Re=ge.reporter)===null||Re===void 0||Re.reportDatachannelDispose({url:o.url,label:y.label,id:y.id,msid:o.msid})}),_e.label=1;case 1:return _e.trys.push([1,6,,7]),$=[{url:o.url,msid:o.msid,datachannelId:y.id,label:o.label,datachannel:y}],g?[4,(ue=this.peerCore)===null||ue===void 0?void 0:ue.subscribeAddDatachannel($)]:[3,3];case 2:return ee=_e.sent(),[3,5];case 3:return[4,(de=this.peerCore)===null||de===void 0?void 0:de.publishAddDatachannel($)];case 4:ee=_e.sent(),_e.label=5;case 5:return G=(Ee=(pe=(re=ee)==null?void 0:re.streams)===null||pe===void 0?void 0:pe[0])===null||Ee===void 0?void 0:Ee.traceid,[3,7];case 6:return ie=_e.sent(),se=ie,(he=this.reporter)===null||he===void 0||he.reportErrorInfo(se.errorCode,se.message||"datachannel ".concat(g?"sub":"pub"," add error"),se.traceId,se.extraInfo),[2,V(ie)];case 7:return ce={url:o.url,drct:Math.floor(performance.now()-T),tcid:G,label:y.label,id:y.id,msid:o.msid},g?(fe=this.reporter)===null||fe===void 0||fe.reportDatachannelSubAddOk(ce):(me=this.reporter)===null||me===void 0||me.reportDatachannelPubAddOk(ce),z=!0,q&&k({datachannel:y,traceId:G}),[2]}})})})]}})})},h.prototype.handleStopDatachannel=function(o){return S(this,void 0,void 0,function(){var g,m,T,C,D,y,A,w,j,I,H,F;return f(this,function(U){switch(U.label){case 0:if(!o.url||!o.datachannel)throw g=new n.RtsError(s.ErrorCode.ERROR_DATACHANNEL_PARAM,"url, datachannel is required by subscribe(publish)StopDatachannel",""),(D=this.reporter)===null||D===void 0||D.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g;if(!this.signalChannel.isOpen)throw g=new n.RtsError(s.ErrorCode.ERROR_NO_DATACHANNEL,"Signal channel is closed",""),(y=this.reporter)===null||y===void 0||y.reportErrorInfo(g.errorCode,g.message,g.traceId,g.extraInfo),g;m=o.type==="sub",T=[{url:o.url}],C={url:o.url,label:o.datachannel.label,id:o.datachannel.id},m?(A=this.reporter)===null||A===void 0||A.reportDatachannelSubStop(C):(w=this.reporter)===null||w===void 0||w.reportDatachannelPubStop(C),U.label=1;case 1:return U.trys.push([1,6,,7]),m?[4,(j=this.peerCore)===null||j===void 0?void 0:j.subscribeStopDatachannel(T)]:[3,3];case 2:return U.sent(),[3,5];case 3:return[4,(I=this.peerCore)===null||I===void 0?void 0:I.publishStopDatachannel(T)];case 4:U.sent(),U.label=5;case 5:return[3,7];case 6:throw U.sent();case 7:return m?(H=this.reporter)===null||H===void 0||H.reportDatachannelSubStopOk(C):(F=this.reporter)===null||F===void 0||F.reportDatachannelPubStopOk(C),o.datachannel.dispose(),[2]}})})},h.prototype.subscribeAddDatachannel=function(o){return S(this,void 0,void 0,function(){return f(this,function(g){return[2,this.handleAddDatachannel(u(u({},o),{type:"sub"}))]})})},h.prototype.publishAddDatachannel=function(o){return S(this,void 0,void 0,function(){return f(this,function(g){return[2,this.handleAddDatachannel(u(u({},o),{type:"pub"}))]})})},h.prototype.subscribeStopDatachannel=function(o){return S(this,void 0,void 0,function(){return f(this,function(g){return[2,this.handleStopDatachannel(u(u({},o),{type:"sub"}))]})})},h.prototype.publishStopDatachannel=function(o){return S(this,void 0,void 0,function(){return f(this,function(g){return[2,this.handleStopDatachannel(u(u({},o),{type:"pub"}))]})})},h.prototype.getSubscribeVideoStats=function(o,g){return this.getSubscribeMediaStats(o,"video",g)},h.prototype.getSubscribeAudioStats=function(o,g){return this.getSubscribeMediaStats(o,"audio",g)},h.prototype.getPublishVideoStats=function(o,g){return this.getPublishMediaStats(o,"video",g)},h.prototype.getPublishAudioStats=function(o,g){return this.getPublishMediaStats(o,"audio",g)},h.prototype.sendSEI=function(o){var g,m;if(!((g=this.peerconnection)===null||g===void 0)&&g.isReused)return(m=this.peerconnection)===null||m===void 0?void 0:m.sendSEI(o)},h.prototype.setReceiverCodecPreferences=function(o){this.receiverCodecPreferences=u({},o)},h.prototype.setSenderCodecPreferences=function(o){this.senderCodecPreferences=u({},o)},h.prototype.getSubscribeMediaStats=function(o,g,m){var T=this;return new Promise(function(C){return S(T,void 0,void 0,function(){var D,y,A,w;return f(this,function(j){switch(j.label){case 0:return this.streamManager?(D=void 0,y=this.streamManager.getAllMediaInfoList(o,!0),m?y.forEach(function(I){var H,F,U,B=(F=(H=I.transceiver)===null||H===void 0?void 0:H.receiver)===null||F===void 0?void 0:F.track;B?.kind===g&&I.msid===m&&(D=(U=I.transceiver)===null||U===void 0?void 0:U.receiver)}):D=(w=(A=y?.find(function(I){var H,F,U;return((U=(F=(H=I.transceiver)===null||H===void 0?void 0:H.receiver)===null||F===void 0?void 0:F.track)===null||U===void 0?void 0:U.kind)===g}))===null||A===void 0?void 0:A.transceiver)===null||w===void 0?void 0:w.receiver,D?[4,D.getStats()]:[2,C({})]):[2,C({})];case 1:return j.sent().forEach(function(I){I.type==="inbound-rtp"&&C(I)}),[2]}})})})},h.prototype.getPublishMediaStats=function(o,g,m){var T=this;return new Promise(function(C){return S(T,void 0,void 0,function(){var D,y,A,w;return f(this,function(j){switch(j.label){case 0:return this.streamManager?(D=void 0,y=this.streamManager.getAllMediaInfoList(o,!0),m?y.forEach(function(I){var H,F,U,B=(F=(H=I.transceiver)===null||H===void 0?void 0:H.sender)===null||F===void 0?void 0:F.track;B?.kind===g&&I.msid===m&&(D=(U=I.transceiver)===null||U===void 0?void 0:U.sender)}):D=(w=(A=y?.find(function(I){var H,F,U;return((U=(F=(H=I.transceiver)===null||H===void 0?void 0:H.sender)===null||F===void 0?void 0:F.track)===null||U===void 0?void 0:U.kind)===g}))===null||A===void 0?void 0:A.transceiver)===null||w===void 0?void 0:w.sender,D?[4,D.getStats()]:[2,C({})]):[2,C({})];case 1:return j.sent().forEach(function(I){I.type==="outbound-rtp"&&C(I)}),[2]}})})})},h.prototype.proxySignalChannelEvents=function(){var o=this;this.signalChannel.on("connectStatusChange",function(g){o.emit("connectStatusChange",g)}),this.signalChannel.on("onError",function(g){o.emit("onError",g)})},h.prototype.initSignalChannel=function(o){return this.signalChannel.createDatachannel(o)},h.prototype.makeRtsError=function(o){var g,m=new n.RtsError(s.ErrorCode.ERROR_NO_DATACHANNEL,"No avaliable datachannel, you should subscribe/publish first.","",{api:o});return(g=this.reporter)===null||g===void 0||g.reportErrorInfo(m.errorCode,m.message,m.traceId,m.extraInfo),m},h.prototype.singleStreamReconnect=function(o){var g=this;return new Promise(function(m,T){var C,D,y=o.type,A=void 0,w=void 0;switch(y){case"sub":(C=o.streams)===null||C===void 0||C.forEach(function(I){var H=[],F=[],U=!0,B=!0;o.msids.forEach(function(k){k.streamId===I.id&&(k.type==="video"?F.push(k.name):k.type==="audio"&&H.push(k.name))}),H.length||(U=!1),F.length||(B=!1),g.subscribeAdd([{url:o.latestUrl,subAudio:U,subVideo:B,vMsid:F,aMsid:H,targetStream:I}],!0).then(function(){m()}).catch(function(k){T(k)})});break;case"pub":(D=o.streams)===null||D===void 0||D.forEach(function(I){var H=[],F=[];o.msids.forEach(function(U){U.streamId===I.id&&(U.type==="video"?F.push(U.name):U.type==="audio"&&H.push(U.name))}),g.publishAdd([{url:o.latestUrl,vMsid:F,aMsid:H,stream:I}]).then(function(){m()}).catch(function(U){T(U)})});break;case"pub-data":if(o.msids.forEach(function(I){A=I.name,w=I.label}),A&&w){var j=o.latestUrl;g.publishAddDatachannel({url:j,signalUrl:j,msid:A,label:w}).then(function(){m()}).catch(function(I){T(I)})}break;case"sub-data":o.msids.forEach(function(I){A=I.name,w=I.label}),A&&w&&(j=o.latestUrl,g.subscribeAddDatachannel({url:j,signalUrl:j,msid:A,label:w}).then(function(){m()}).catch(function(I){T(I)}));break;default:console.warn("RTS PC STREAM RECONNECT: Unknown signal")}})},h.prototype.updateAuth=function(o){var g;return!!(!((g=this.streamManager)===null||g===void 0)&&g.updateLatestUrl(o))},h}(e.default);R.CommonController=E;var b=function(){function _(){this._list=[]}return Object.defineProperty(_.prototype,"list",{get:function(){return this._list},enumerable:!1,configurable:!0}),_.prototype.update=function(h){var o=this._list.findIndex(function(g){return g.id===h.id});o!==-1?this._list.splice(o,1,h):this._list.push(h)},_}()},9796:function(L,R,x){var v,c=this&&this.__extends||(v=function(b,_){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(h,o){h.__proto__=o}||function(h,o){for(var g in o)Object.prototype.hasOwnProperty.call(o,g)&&(h[g]=o[g])},v(b,_)},function(b,_){if(typeof _!="function"&&_!==null)throw new TypeError("Class extends value "+String(_)+" is not a constructor or null");function h(){this.constructor=b}v(b,_),b.prototype=_===null?Object.create(_):(h.prototype=_.prototype,new h)}),u=this&&this.__assign||function(){return u=Object.assign||function(b){for(var _,h=1,o=arguments.length;h<o;h++)for(var g in _=arguments[h])Object.prototype.hasOwnProperty.call(_,g)&&(b[g]=_[g]);return b},u.apply(this,arguments)},S=this&&this.__awaiter||function(b,_,h,o){return new(h||(h=Promise))(function(g,m){function T(y){try{D(o.next(y))}catch(A){m(A)}}function C(y){try{D(o.throw(y))}catch(A){m(A)}}function D(y){var A;y.done?g(y.value):(A=y.value,A instanceof h?A:new h(function(w){w(A)})).then(T,C)}D((o=o.apply(b,_||[])).next())})},f=this&&this.__generator||function(b,_){var h,o,g,m,T={label:0,sent:function(){if(1&g[0])throw g[1];return g[1]},trys:[],ops:[]};return m={next:C(0),throw:C(1),return:C(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function C(D){return function(y){return function(A){if(h)throw new TypeError("Generator is already executing.");for(;m&&(m=0,A[0]&&(T=0)),T;)try{if(h=1,o&&(g=2&A[0]?o.return:A[0]?o.throw||((g=o.return)&&g.call(o),0):o.next)&&!(g=g.call(o,A[1])).done)return g;switch(o=0,g&&(A=[2&A[0],g.value]),A[0]){case 0:case 1:g=A;break;case 4:return T.label++,{value:A[1],done:!1};case 5:T.label++,o=A[1],A=[0];continue;case 7:A=T.ops.pop(),T.trys.pop();continue;default:if(g=T.trys,!((g=g.length>0&&g[g.length-1])||A[0]!==6&&A[0]!==2)){T=0;continue}if(A[0]===3&&(!g||A[1]>g[0]&&A[1]<g[3])){T.label=A[1];break}if(A[0]===6&&T.label<g[1]){T.label=g[1],g=A;break}if(g&&T.label<g[2]){T.label=g[2],T.ops.push(A);break}g[2]&&T.ops.pop(),T.trys.pop();continue}A=_.call(b,T)}catch(w){A=[6,w],o=0}finally{h=g=0}if(5&A[0])throw A[1];return{value:A[0]?A[1]:void 0,done:!0}}([D,y])}}},a=this&&this.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(R,"__esModule",{value:!0}),R.Publisher=void 0;var d=x(5917),p=x(4865),e=a(x(7028)),r=x(9428),n=x(5044),s=x(7989),t=a(x(102)),i=a(x(8219)),l=x(2718),E=function(b){function _(h){var o=b.call(this)||this;return o.publishStartTimeStamp=0,o.pubReconnectTimes=0,o.isConnecting=!1,o.reconnectTimerHandle=null,o.reportMonitorTimes=0,o.reportSubFlag=!1,o.reporter=h,o.peerconnection=new p.RtsPeerconnection,o.peerconnection.on("connectStatusChange",function(g){g.status!==d.EConnectStatus.CONNECT_STATUS_DISCONNECTED&&g.status!==d.EConnectStatus.CONNECT_STATUS_RECONNECTING||!o.hasRetries()?o.emit("connectStatusChange",g):o.emit("onError",new n.RtsError(r.ErrorCode.ERROR_PC_DISCONNECTED,"PC disconnected",""))}),o.peerconnection.on("onMonitorEvent",function(g){var m=g.eventList;g.type==="pub"?(o.reportMonitorTimes++,o.reportMonitorTimes%4==0&&(m.forEach(function(T){o.reporter.reportPushStats(T)}),o.reportSubFlag=!0,o.reportMonitorTimes=0)):g.type==="sub"&&o.reportSubFlag&&(o.handleSubMonitorEvent(m),o.reportSubFlag=!1)}),o.peerconnection.on("onTransportStateEvent",function(g){var m;o.peerconnection.isReused||((m=o.peerconnection.getPc())===null||m===void 0?void 0:m.connectionState)!=="closed"&&g.state==="closed"&&o.hasRetries()&&o.emit("onError",new n.RtsError(r.ErrorCode.ERROR_TRANSPORT_CLOSED,"Transport has been closed. ".concat(g.kind,"|").concat(g.type,"|").concat(g.url),"",{protocol:g.protocol}))}),o.peerconnection.on("pcReconnect",function(g){var m,T;g.ips?(m="Migrate with ips: ".concat(JSON.stringify(g.ips)),T=r.ErrorCode.ERROR_IP_MIGRATE):(m="PC disconnected",T=r.ErrorCode.ERROR_PC_DISCONNECTED),o.emit("onError",new n.RtsError(T,m,"",{pcErrorInfo:g}))}),o.signalingUrl="",o.publishUrl="",o.publishConfig={},o}return c(_,b),_.prototype.publish=function(h,o,g){var m=this;return new Promise(function(T,C){if(m.unpublish(),m.localStream=o,m.publishUrl=h,m.publishConfig=g||{},m.checkPublishUrl())if(o)if(o.audioTrack===null)C(new n.RtsError(r.ErrorCode.ERROR_PUBLISH_NOAUDIO,"publish need audiotrack",""));else{var D=g?.signalUrl;m.signalingUrl=D||m.signalingUrl,m.publishStartTimeStamp=new Date().getTime(),o.setReporter(m.reporter),m.peerconnection.createOffer(o.hasAudio,o.hasVideo||o.hasScreen,o,u(u({},g),{publishUrl:h})).then(function(y){var A=y.desp,w=y.publishTrackInfoList;m.publishTrackInfoList=w;var j=new Date().getTime();m.reporter.reportStartPublish(m.publishUrl,m.signalingUrl),m.excuteSignal(A).then(function(I){var H=new Date().getTime();m.peerconnection.recvAnswer(I.data,{answerSdpHook:g?.answerSdpHook,tcpOnly:g?.tcpOnly}).then(function(){m.reporter.reportPublishOk(m.publishUrl,m.signalingUrl,j-m.publishStartTimeStamp,H-j,new Date().getTime()-H,I.data.trace_id),T(I.data.trace_id),m.pubReconnectTimes=0,m.peerconnection.pushStart()}).catch(function(F){F.traceid=I.data?I.data.trace_id:"";var U=new n.RtsError(F.errorCode||r.ErrorCode.ERROR_ANSWER_ERROR,F.message||"set answer error",F.traceid,{sdp:F.sdp});C(U)})}).catch(function(I){var H=new n.RtsError(I.errorCode||r.ErrorCode.ERROR_HTTPREQUEST_ERROR,I.message||"","",{response:I.response,sdp:I.sdp});C(H)})}).catch(function(y){var A=new n.RtsError(y.errorCode||r.ErrorCode.ERROR_CREATEOFFER,y.message||"","");C(A)})}else C(new n.RtsError(r.ErrorCode.ERROR_PUBLISH_NOSTREAM,"publish stream not found",""));else C(new n.RtsError(r.ErrorCode.ERROR_PUBLISH_URL,"url need artc://",""))})},_.prototype.unpublish=function(){this.peerconnection.dispose(),this.reporter.reportStopPublish(),this.signalingUrl="",this.publishUrl="",this.publishTrackInfoList=null},_.prototype.getTrackInfoList=function(){return this.publishTrackInfoList||[]},_.prototype.getPeerConnection=function(){return this.peerconnection},_.prototype.replaceTrack=function(h,o){return this.peerconnection.replaceTrack(this.publishUrl,h,o)},_.prototype.excuteSignal=function(h){var o=this,g={type:h.type,sdp:h.sdp};return this.isSingleMsid()&&(g.sdp=g.sdp.replace(/msid\:-? /g,"msid:")),new Promise(function(m,T){i.default.post(o.signalingUrl,{version:e.default.protocol_version,sdk_version:e.default.sdk_version,mode:"rtc",push_stream:o.publishUrl,jsep:g}).then(function(C){C&&C.status===200?m(C):T({message:C?"response status:"+C.status:"response is null",sdp:g.sdp})}).catch(function(C){return S(o,void 0,void 0,function(){var D,y;return f(this,function(A){switch(A.label){case 0:if(![400,500].includes((y=C.response)===null||y===void 0?void 0:y.status))return[3,4];C.sdp=h.sdp,A.label=1;case 1:return A.trys.push([1,3,,4]),[4,new s.SupportUtil().isSupport({isReceiveVideo:!0})];case 2:return A.sent(),[3,4];case 3:return D=A.sent(),C.errorCode=D?.errorCode,C.message=D?.message,this.pubReconnectTimes=1/0,[3,4];case 4:return T(C),[2]}})})})})},_.prototype.checkPublishUrl=function(){if(!this.publishUrl||this.publishUrl.indexOf("artc://")!==0)return!1;var h=window.location.protocol,o=(["http:","https:"].indexOf(h)>-1?h:"https:")+"//";return this.signalingUrl=this.publishUrl.replace("artc://",o),!0},_.prototype.isSingleMsid=function(){if(!this.publishConfig)return!1;var h=this.publishConfig,o=h.vMsid,g=h.aMsid;return!(!o||!o[0]||o[0].indexOf(" ")!==-1)||!(!g||!g[0]||g[0].indexOf(" ")!==-1)},_.prototype.retryPublish=function(h,o){return S(this,void 0,void 0,function(){var g,m,T,C,D,y,A;return f(this,function(w){switch(w.label){case 0:if(h.extraInfo=u(u({},h.extraInfo),{retryTimes:this.pubReconnectTimes}),!this.hasRetries())return[2,!1];if(typeof(g=this.publishConfig).beforeRetry!="function")return[3,4];w.label=1;case 1:return w.trys.push([1,3,,4]),[4,g.beforeRetry({url:this.publishUrl,stream:this.localStream,vMsid:g.vMsid,aMsid:g.aMsid,useTcp:o})];case 2:return(m=w.sent())?(T=m.url,C=m.stream,D=m.vMsid,y=m.aMsid,C||(console.error("Stream is not returned by beforeRetry function."),this.pubReconnectTimes=1/0),this.reporter.reportReconnectParams("pub",T,D,y,m.useTcp,C?.id),this.publishUrl=T,this.localStream=C,this.publishConfig.vMsid=D,this.publishConfig.aMsid=y,typeof m.useTcp=="boolean"&&(o=m.useTcp),console.log(`Retry with:
147
147
  [URL] `.concat(T,`
148
148
  [STREAM] `).concat(C?.id,`
149
149
  [VMSID]`).concat(D," [AMSID]").concat(y,`
150
- [PROTOCOL] `).concat(o?"TCP":"UDP"))):(this.reporter.reportReconnectParams("pub"),this.pubReconnectTimes=1/0),[3,4];case 3:return A=O.sent(),console.error("Error in beforeRetry",A),[3,4];case 4:return this.hasRetries()&&this.localStream?(this.emit("connectStatusChange",{status:d.EConnectStatus.CONNECT_STATUS_RECONNECTING}),this.incrementReconnectTimes(),h.extraInfo.retryTimes=this.pubReconnectTimes,h.extraInfo.tcpOnly=!!o,this.publishWithReconnect(this.publishUrl,this.localStream,u(u({},this.publishConfig),{tcpOnly:!!o})).catch(function(j){}),[2,!0]):(h.extraInfo.retryTimes=this.pubReconnectTimes,[2,!1])}})})},_.prototype.publishWithReconnect=function(h,o,g,m,T){var C=this;return new Promise(function(D,y){D=m||D,y=T||y,C.isConnecting=!0,C.publish(h,o,g).then(function(A){C.isConnecting=!1,D(A)}).catch(function(A){var O;if(!C.isConnecting)return y(A);if(!r.RECONNECT_ERROR_EXCLUDE_LIST.includes(A.errorCode)&&C.hasRetries(!0)){var j=((O=C.publishConfig)===null||O===void 0?void 0:O.retryInterval)||d.DEFAULT_RETRY_PUBLISH_INTERVAL;C.reconnectTimerHandle=setTimeout(function(){A.extraInfo=u(u({},A.extraInfo),{retryTimes:C.pubReconnectTimes}),C.emit("reconnect",A),C.publishWithReconnect(h,o,g,D,y)},j)}else y(A),A.extraInfo=u(u({},A.extraInfo),{retryTimes:C.pubReconnectTimes}),C.isConnecting=!1,C.emit("onError",A)})})},_.prototype.sendSEI=function(h){var o;(o=this.peerconnection)===null||o===void 0||o.sendSEI(h)},_.prototype.hasRetries=function(h){var o,g,m=d.DEFAULT_RETRY_PUBLISH_LIMIT;typeof((o=this.publishConfig)===null||o===void 0?void 0:o.retryTimes)=="number"&&(m=Math.floor((g=this.publishConfig)===null||g===void 0?void 0:g.retryTimes));var T=this.pubReconnectTimes<m;return h&&T&&this.incrementReconnectTimes(),T},_.prototype.resetRepublishStatus=function(){this.pubReconnectTimes=0,this.isConnecting=!1,this.reporter.updateTid(),this.reconnectTimerHandle!==null&&(clearTimeout(this.reconnectTimerHandle),this.reconnectTimerHandle=null)},_.prototype.handleSubMonitorEvent=function(h){var o=this;h.forEach(function(g){var m={ct:0,tt:4e3,url:g.url},T=g.video,C=g.audio;if(T){var D=T.transportStats,y=T.inboundRtpStats,A=T.inboundRtpStatsPerSec,O=T.localCandidate,j=T.remoteCandidate;m=u(u({},m),{rtt:D?.rtt!==-1?1e3*(D?.rtt||0):-1,cand_re_prot:j.protocol,cand_lo_prot:O.protocol,cand_re_addr:"".concat(j.ip||j.address,":").concat(j.port),cand_lo_addr:"".concat(O.ip||O.address,":").concat(O.port),w:y?.frameWidth,h:y?.frameHeight,vbps:Math.floor(8*A.bytesReceivedPerSecond),fps:y?.framesPerSecond,dfps:Math.floor(A?.framesDecodedPerSecond),vjb:Math.floor((0,l.getJitterBufferDelayAvg)(y?.jitterBufferDelay,y?.jitterBufferEmittedCount)),vMsid:g.vMsid})}C&&(D=C.transportStats,y=C.inboundRtpStats,A=C.inboundRtpStatsPerSec,O=C.localCandidate,j=C.remoteCandidate,m=u(u({},m),{rtt:D?.rtt!==-1?1e3*(D?.rtt||0):-1,cand_re_prot:j.protocol,cand_lo_prot:O.protocol,cand_re_addr:"".concat(j.ip||j.address,":").concat(j.port),cand_lo_addr:"".concat(O.ip||O.address,":").concat(O.port),abps:Math.floor(8*A.bytesReceivedPerSecond),ajb:Math.floor((0,l.getJitterBufferDelayAvg)(y?.jitterBufferDelay,y.jitterBufferEmittedCount)),aMsid:g.aMsid})),o.reporter.reportPullStats(m)})},_.prototype.incrementReconnectTimes=function(){this.pubReconnectTimes++},_.prototype.getPublishConfig=function(){return this.publishConfig},_}(t.default);R.Publisher=E},5788:function(L,R,x){var v,c=this&&this.__extends||(v=function(i,l){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,b){E.__proto__=b}||function(E,b){for(var _ in b)Object.prototype.hasOwnProperty.call(b,_)&&(E[_]=b[_])},v(i,l)},function(i,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function E(){this.constructor=i}v(i,l),i.prototype=l===null?Object.create(l):(E.prototype=l.prototype,new E)}),u=this&&this.__awaiter||function(i,l,E,b){return new(E||(E=Promise))(function(_,h){function o(T){try{m(b.next(T))}catch(C){h(C)}}function g(T){try{m(b.throw(T))}catch(C){h(C)}}function m(T){var C;T.done?_(T.value):(C=T.value,C instanceof E?C:new E(function(D){D(C)})).then(o,g)}m((b=b.apply(i,l||[])).next())})},S=this&&this.__generator||function(i,l){var E,b,_,h,o={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return h={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function g(m){return function(T){return function(C){if(E)throw new TypeError("Generator is already executing.");for(;h&&(h=0,C[0]&&(o=0)),o;)try{if(E=1,b&&(_=2&C[0]?b.return:C[0]?b.throw||((_=b.return)&&_.call(b),0):b.next)&&!(_=_.call(b,C[1])).done)return _;switch(b=0,_&&(C=[2&C[0],_.value]),C[0]){case 0:case 1:_=C;break;case 4:return o.label++,{value:C[1],done:!1};case 5:o.label++,b=C[1],C=[0];continue;case 7:C=o.ops.pop(),o.trys.pop();continue;default:if(_=o.trys,!((_=_.length>0&&_[_.length-1])||C[0]!==6&&C[0]!==2)){o=0;continue}if(C[0]===3&&(!_||C[1]>_[0]&&C[1]<_[3])){o.label=C[1];break}if(C[0]===6&&o.label<_[1]){o.label=_[1],_=C;break}if(_&&o.label<_[2]){o.label=_[2],o.ops.push(C);break}_[2]&&o.ops.pop(),o.trys.pop();continue}C=l.call(i,o)}catch(D){C=[6,D],b=0}finally{E=_=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([m,T])}}},f=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(R,"__esModule",{value:!0}),R.SignalChannel=void 0;var a=f(x(7028)),d=x(4865),p=f(x(102)),e=f(x(8219)),r=x(9428),n=x(5044),s=x(280),t=function(i){function l(E){var b=i.call(this)||this;return b.reporter=E.reporter,b}return c(l,i),Object.defineProperty(l.prototype,"isOpen",{get:function(){return this.readyState==="open"},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"readyState",{get:function(){var E,b;return((E=this.peerconnection)===null||E===void 0?void 0:E.isConnected)&&((b=this.datachannelCore)===null||b===void 0?void 0:b.readyState)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"datachannelCore",{get:function(){var E,b,_;return(_=(b=(E=this.peerconnection)===null||E===void 0?void 0:E.getPeerCore())===null||b===void 0?void 0:b.getSignal())===null||_===void 0?void 0:_.getDatachannelCore()},enumerable:!1,configurable:!0}),l.prototype.getPeerConnection=function(){return this.peerconnection},l.prototype.setPeerConnection=function(E){this.peerconnection=E},l.prototype.createDatachannel=function(E){return u(this,void 0,void 0,function(){var b,_,h,o,g,m,T,C,D,y,A,O;return S(this,function(j){switch(j.label){case 0:if(b=E.signalUrl,!this.checkUrl(b))throw new n.RtsError(r.ErrorCode.ERROR_DATACHANNEL_PARAM,"url need artc://","");this.closeDatachannel(),this.createPC(),this.reporter.updateUrl(b),this.reporter.reportDatachannelHttpConnect(b),_=performance.now(),j.label=1;case 1:return j.trys.push([1,3,,4]),[4,(y=this.peerconnection)===null||y===void 0?void 0:y.createOffer(!1,!1,void 0,E)];case 2:return h=j.sent(),[3,4];case 3:return o=j.sent(),this.throwRtsError(new n.RtsError(o.errorCode||r.ErrorCode.ERROR_CREATEOFFER,o.message||"","")),[3,4];case 4:m="",j.label=5;case 5:return j.trys.push([5,7,,8]),[4,this.excuteSignal(h.desp)];case 6:return g=j.sent(),m=((A=g?.data)===null||A===void 0?void 0:A.trace_id)||"",this.reporter.reportDatachannelHttpConnectOk({url:b,hrct:Math.floor(performance.now()-_),tcid:m}),[3,8];case 7:return T=j.sent(),this.throwRtsError(new n.RtsError(T.errorCode||r.ErrorCode.ERROR_HTTPREQUEST_ERROR,T.message||"",m)),[3,8];case 8:return j.trys.push([8,10,,11]),[4,(O=this.peerconnection)===null||O===void 0?void 0:O.recvAnswer(g?.data,{answerSdpHook:E.answerSdpHook})];case 9:return j.sent(),[3,11];case 10:return C=j.sent(),this.throwRtsError(new n.RtsError(C.errorCode||r.ErrorCode.ERROR_ANSWER_ERROR,C.message||"set answer error",m)),[3,11];case 11:return j.trys.push([11,13,,14]),[4,this.waitForOpen()];case 12:return j.sent(),[3,14];case 13:return D=j.sent(),this.throwRtsError(new n.RtsError(r.ErrorCode.ERROR_DATACHANNEL_OPEN,"datachannel open failed: ".concat(D),m)),[3,14];case 14:return[2,m]}})})},l.prototype.waitForOpen=function(){var E,b=this;return new Promise(function(_,h){var o;E=window.setTimeout(function(){var m;(m=b.peerconnection)===null||m===void 0||m.off("datachannelStatusChange",g),E=void 0,h("timeout")},5e3);var g=function(m){E&&(clearTimeout(E),E=void 0),m.status===s.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?_(!0):h("status is ".concat(m.status))};(o=b.peerconnection)===null||o===void 0||o.once("datachannelStatusChange",g)})},l.prototype.excuteSignal=function(E){return u(this,void 0,void 0,function(){var b;return S(this,function(_){switch(_.label){case 0:return[4,e.default.post(this.signalUrl,{version:a.default.protocol_version,sdk_version:a.default.sdk_version,mode:"live",jsep:E})];case 1:if(((b=_.sent())==null?void 0:b.status)!==200)throw new n.RtsError(r.ErrorCode.ERROR_SIGNAL_ERROR,b?"response status:"+b.status:"response is null","");return[2,b]}})})},l.prototype.closeDatachannel=function(){var E;(E=this.peerconnection)===null||E===void 0||E.dispose()},l.prototype.checkUrl=function(E){var b="artc://";if(E&&E.indexOf(b)===0){var _=window.location.protocol,h=(["http:","https:"].indexOf(_)>-1?_:"https:")+"//";return this.signalUrl=E.replace(b,h),!0}},l.prototype.throwRtsError=function(E){throw this.emit("onError",E),E},l.prototype.createPC=function(){var E=this;this.peerconnection=new d.RtsPeerconnection,this.peerconnection.on("connectStatusChange",function(b){E.emit("connectStatusChange",b)})},l}(p.default);R.SignalChannel=t},2550:function(L,R,x){var v,c=this&&this.__extends||(v=function(_,h){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,g){o.__proto__=g}||function(o,g){for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(o[m]=g[m])},v(_,h)},function(_,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function o(){this.constructor=_}v(_,h),_.prototype=h===null?Object.create(h):(o.prototype=h.prototype,new o)}),u=this&&this.__assign||function(){return u=Object.assign||function(_){for(var h,o=1,g=arguments.length;o<g;o++)for(var m in h=arguments[o])Object.prototype.hasOwnProperty.call(h,m)&&(_[m]=h[m]);return _},u.apply(this,arguments)},S=this&&this.__awaiter||function(_,h,o,g){return new(o||(o=Promise))(function(m,T){function C(A){try{y(g.next(A))}catch(O){T(O)}}function D(A){try{y(g.throw(A))}catch(O){T(O)}}function y(A){var O;A.done?m(A.value):(O=A.value,O instanceof o?O:new o(function(j){j(O)})).then(C,D)}y((g=g.apply(_,h||[])).next())})},f=this&&this.__generator||function(_,h){var o,g,m,T,C={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return T={next:D(0),throw:D(1),return:D(2)},typeof Symbol=="function"&&(T[Symbol.iterator]=function(){return this}),T;function D(y){return function(A){return function(O){if(o)throw new TypeError("Generator is already executing.");for(;T&&(T=0,O[0]&&(C=0)),C;)try{if(o=1,g&&(m=2&O[0]?g.return:O[0]?g.throw||((m=g.return)&&m.call(g),0):g.next)&&!(m=m.call(g,O[1])).done)return m;switch(g=0,m&&(O=[2&O[0],m.value]),O[0]){case 0:case 1:m=O;break;case 4:return C.label++,{value:O[1],done:!1};case 5:C.label++,g=O[1],O=[0];continue;case 7:O=C.ops.pop(),C.trys.pop();continue;default:if(m=C.trys,!((m=m.length>0&&m[m.length-1])||O[0]!==6&&O[0]!==2)){C=0;continue}if(O[0]===3&&(!m||O[1]>m[0]&&O[1]<m[3])){C.label=O[1];break}if(O[0]===6&&C.label<m[1]){C.label=m[1],m=O;break}if(m&&C.label<m[2]){C.label=m[2],C.ops.push(O);break}m[2]&&C.ops.pop(),C.trys.pop();continue}O=h.call(_,C)}catch(j){O=[6,j],g=0}finally{o=m=0}if(5&O[0])throw O[1];return{value:O[0]?O[1]:void 0,done:!0}}([y,A])}}},a=this&&this.__rest||function(_,h){var o={};for(var g in _)Object.prototype.hasOwnProperty.call(_,g)&&h.indexOf(g)<0&&(o[g]=_[g]);if(_!=null&&typeof Object.getOwnPropertySymbols=="function"){var m=0;for(g=Object.getOwnPropertySymbols(_);m<g.length;m++)h.indexOf(g[m])<0&&Object.prototype.propertyIsEnumerable.call(_,g[m])&&(o[g[m]]=_[g[m]])}return o},d=this&&this.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(R,"__esModule",{value:!0}),R.LocalStream=void 0;var p=x(5805),e=x(3412),r=x(5044),n=x(9428),s=x(5259),t=x(233),i=d(x(335)),l=x(6295),E=x(2718),b=function(_){function h(){var o=_.call(this)||this;return o.screenSurfaceType="",o.VideoProfileMap=new Map(s.VideoProfileMap),o.ScreenProfileMap=new Map(s.ScreenProfileMap),o.AudioProfileMap=new Map(s.AudioProfileMap),o.deviceManager=new e.BrowserDeviceManager,o.mediastream=new MediaStream,o.hasVideo=!1,o.hasScreen=!1,o.videoProfile="360p_1",o.screenProfile="720p_1",o.audioProfile="standard",o.isCustomStream=!1,o.handleVideoTrackEnded=o.handleVideoTrackEnded.bind(o),o.handleAudioTrackEnded=o.handleAudioTrackEnded.bind(o),o}return c(h,_),Object.defineProperty(h.prototype,"mediaStream",{get:function(){return this.mediastream},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"audioTrack",{get:function(){return this.audiotrack},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"videoTrack",{get:function(){return this.videotrack},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"hasAudio",{get:function(){return!!this.audioTrack},enumerable:!1,configurable:!0}),h.prototype.getVideoProfile=function(){if(this.hasVideo)return this.videoProfile},h.prototype.getScreenProfile=function(){if(this.hasScreen)return this.screenProfile},h.prototype.getAudioProfile=function(){if(this.hasAudio)return this.audioProfile},h.prototype.init=function(o){return o.custom?this.createCustomStream(o.mediaStream):this.initWithRetry(o)},h.prototype.initWithRetry=function(o,g,m){var T=this;return new Promise(function(C,D){C=g||C,D=m||D;var y=[];y.push(T.initMicAudio(o)),o.video?y.push(T.initCameraVideo(o)):o.screen&&y.push(T.initScreenVideoAudio(o)),Promise.all(y).then(function(){T.tryMixMicAndScreenAudio(o),T.initTracks(o),o.skipProfile?C():T.tryToSetProfile(o).then(function(){C()}).catch(function(A){console.log(A),T.resetLocalStream(),T.initWithRetry(u(u({},o),{skipProfile:!0}),C,D)})}).catch(function(A){T.stopAllTracks(),D(A)})})},h.prototype.initMicAudio=function(o){var g=this;return new Promise(function(m,T){if(!o||!o.audio)return m();var C={};o.audio===!0?C.deviceId="":C=o.audio,g.deviceManager.getAudioTrack(C).then(function(D){g.micAudioTrack=D,g.audiotrack=D,m()}).catch(function(D){T(new r.RtsError(D.code,D.reason,"",D.relatedLink))})})},h.prototype.initCameraVideo=function(o){var g=this;return new Promise(function(m,T){if(!o||!o.video)return m();var C={};o.video===!0?C.deviceId="":C=o.video,g.deviceManager.getVideoTrack(C).then(function(D){g.videotrack=D,g.hasVideo=!0,m()}).catch(function(D){T(new r.RtsError(D.code,D.reason,"",D.relatedLink))})})},h.prototype.initScreenVideoAudio=function(o){var g=this;return new Promise(function(m,T){if(o.screen){var C=!0,D=!1,y={};if(typeof o.screen!="boolean"){var A=o.screen,O=A.video,j=A.audio;y=a(A,["video","audio"]),C=typeof O!="object"||O,typeof j!="boolean"&&typeof j!="object"||(D=j)}t.SystemUtil.isMacOS&&t.BrowserUtil.isSafari&&["16.1","16.2","16.3"].indexOf(t.BrowserUtil.browserVersion)>-1&&typeof C=="object"&&(typeof C.width=="number"&&(C.width={max:C.width}),typeof C.height=="number"&&(C.height={max:C.height})),g.deviceManager.getScreenStream(u({video:C,audio:D},y)).then(function(I){g.videotrack=I.getVideoTracks()[0],g.videotrack&&g.videotrack.getSettings&&(g.screenSurfaceType=g.videotrack.getSettings().displaySurface),g.hasScreen=!0;var H=I.getAudioTracks()[0];H&&(g.screenAudioTrack=H),m()}).catch(function(I){T(new r.RtsError(I.code,I.reason,"",I.relatedLink))})}})},h.prototype.tryMixMicAndScreenAudio=function(o){o.audio&&this.micAudioTrack&&this.hasScreenAudioConfig(o)&&this.screenAudioTrack?(this.audioMixer||(this.audioMixer=new i.default({useGainNode:!1,trackList:[]})),this.audioMixer.updateTrackList([this.screenAudioTrack,this.micAudioTrack]),this.audiotrack=this.audioMixer.getMixedAudioTrack()):o.audio&&this.micAudioTrack?this.audiotrack=this.micAudioTrack:this.hasScreenAudioConfig(o)&&this.screenAudioTrack&&(this.audiotrack=this.screenAudioTrack)},h.prototype.initTracks=function(o){this.hasAudioTrackReady(o)&&this.audiotrack&&this.mediastream.addTrack(this.audiotrack),this.hasVideoTrackReady(o)&&this.videotrack&&this.mediastream.addTrack(this.videotrack),this.addTrackListener()},h.prototype.tryToSetProfile=function(o){var g=this;return new Promise(function(m,T){return S(g,void 0,void 0,function(){var C;return f(this,function(D){switch(D.label){case 0:return D.trys.push([0,4,,5]),o.video?[4,this.setVideoProfile(this.videoProfile)]:[3,2];case 1:return D.sent(),[3,3];case 2:o.screen&&this.setScreenProfile(this.screenProfile).catch(function(y){console.log(y)}),D.label=3;case 3:return m(),[3,5];case 4:return C=D.sent(),T(new r.RtsError(n.ErrorCode.ERROR_DEIVCE_CONSTRAINEDERROR,"apply constraint failed","",{originErr:C,config:o})),[3,5];case 5:return[2]}})})})},h.prototype.stopAllTracks=function(){this.screenAudioTrack&&(this.screenAudioTrack.stop(),this.screenAudioTrack=void 0),this.micAudioTrack&&(this.micAudioTrack.stop(),this.micAudioTrack=void 0),this.audioTrack&&(this.audioTrack.stop(),this.audiotrack=void 0),this.videoTrack&&(this.videoTrack.stop(),this.videotrack=void 0)},h.prototype.resetLocalStream=function(){this.deviceManager=new e.BrowserDeviceManager,this.mediastream=new MediaStream,this.hasVideo=!1,this.hasScreen=!1,this.videoProfile="360p_1",this.screenProfile="720p_1",this.isCustomStream=!1,this.stopAllTracks(),this.audioMixer=void 0,this.screenSurfaceType=""},h.prototype.setEncodeParam=function(o,g){var m=this;this.pc=o;var T=!1,C=!1;g?g==="video"?T=!0:g==="audio"&&(C=!0):T=C=!0,o.getSenders().forEach(function(D){var y=D.track;!y||y.kind!=="video"&&y.kind!=="audio"||(y.kind==="video"&&T&&m.setVideoEncodeParams(D),y.kind==="audio"&&C&&m.setAudioEncodeParams(D))})},h.prototype.setVideoEncodeParams=function(o){var g,m,T;if(((g=o.track)===null||g===void 0?void 0:g.id)===((m=this.videoTrack)===null||m===void 0?void 0:m.id)&&(this.hasVideo?T=this.VideoProfileMap.get(this.videoProfile):this.hasScreen&&(T=this.ScreenProfileMap.get(this.screenProfile)),T&&o.setParameters&&o.getParameters)){var C=o.getParameters();C.degradationPreference="maintain-resolution",C.encodings.forEach(function(D){T?.maxBitrate&&(D.maxBitrate=1024*T.maxBitrate),T?.frameRate&&(D.maxFramerate=T.frameRate)}),o.setParameters(C)}},h.prototype.setAudioEncodeParams=function(o){var g,m;if(((g=o.track)===null||g===void 0?void 0:g.id)===((m=this.audioTrack)===null||m===void 0?void 0:m.id)){var T=this.AudioProfileMap.get(this.audioProfile);if(T&&o.setParameters&&o.getParameters){var C=o.getParameters();C.encodings.forEach(function(D){T.maxBitrate&&(D.maxBitrate=1024*T.maxBitrate)}),o.setParameters(C)}}},h.prototype.play=function(o,g){var m,T=this;if((m=this.reporter)===null||m===void 0||m.reportPlay(o?o.nodeName:String(o)),o&&(this.element=o,this.mediastream)){if(this.element.srcObject=this.mediastream,(t.SystemUtil.isIos&&t.SystemUtil.systemVersion.indexOf("15.1")===0&&(t.BrowserUtil.isSafari||t.BrowserUtil.isChrome||t.BrowserUtil.isMicroMessenger)||g?.canvasStream)&&this.hasVideo){if(this.canvasRenderer)return;this.canvasRenderer=new l.CanvasRenderer({video:this.element});var C=this;this.element.addEventListener("loadeddata",function D(){if(C.element&&(C.element.removeEventListener("loadeddata",D),C.canvasRenderer)){C.canvasRenderer.start();var y=C.canvasRenderer.mediaStream;y&&(C.mediastream=y,C.videotrack=y.getVideoTracks()[0])}}),this.element.addEventListener("resize",function(){var D;if(T){var y=T.element;y&&((D=T.canvasRenderer)===null||D===void 0||D.resize(y.videoWidth,y.videoHeight))}})}if(g&&g.autoplay===!1)return;this.element.play()}},h.prototype.setVideoProfile=function(o){var g=this;return new Promise(function(m,T){return S(g,void 0,void 0,function(){var C,D,y;return f(this,function(A){switch(A.label){case 0:if((y=this.reporter)===null||y===void 0||y.reportVideoProfile(o),!(C=this.VideoProfileMap.get(o)))return[3,5];if(this.isCustomStream||!this.hasVideo||!this.videotrack||!this.videotrack.applyConstraints)return[3,4];A.label=1;case 1:return A.trys.push([1,3,,4]),[4,this.videotrack.applyConstraints(C)];case 2:return A.sent(),[3,4];case 3:return D=A.sent(),[2,T(D)];case 4:return this.videoProfile=o,this.pc&&this.setEncodeParam(this.pc,"video"),m(this.videoProfile),[3,6];case 5:T("Profile not found"),A.label=6;case 6:return[2]}})})})},h.prototype.setScreenProfile=function(o){var g=this;return new Promise(function(m,T){return S(g,void 0,void 0,function(){var C,D,y;return f(this,function(A){switch(A.label){case 0:if((y=this.reporter)===null||y===void 0||y.reportScreenProfile(o),!(C=this.ScreenProfileMap.get(o)))return[3,5];if(!(this.hasScreen&&this.videotrack&&this.videotrack.applyConstraints))return[3,4];A.label=1;case 1:return A.trys.push([1,3,,4]),[4,this.videotrack.applyConstraints(C)];case 2:return A.sent(),[3,4];case 3:return D=A.sent(),[2,T(D)];case 4:return this.screenProfile=o,this.pc&&this.setEncodeParam(this.pc,"video"),m(this.screenProfile),[3,6];case 5:T("Profile not found"),A.label=6;case 6:return[2]}})})})},h.prototype.setAudioProfile=function(o){var g=this;return new Promise(function(m,T){return S(g,void 0,void 0,function(){var C,D,y;return f(this,function(A){switch(A.label){case 0:if((y=this.reporter)===null||y===void 0||y.reportAudioProfile(o),!(C=this.AudioProfileMap.get(o)))return[3,5];if(this.isCustomStream||!this.hasAudio||!this.audioTrack||!this.audioTrack.applyConstraints)return[3,4];A.label=1;case 1:return A.trys.push([1,3,,4]),[4,this.audioTrack.applyConstraints(C)];case 2:return A.sent(),[3,4];case 3:return D=A.sent(),[2,T(D)];case 4:return this.audioProfile=o,this.pc&&this.setEncodeParam(this.pc,"audio"),m(this.audioProfile),[3,6];case 5:T("Profile not found"),A.label=6;case 6:return[2]}})})})},h.prototype.enableAudio=function(){var o;return(o=this.reporter)===null||o===void 0||o.reportEnableAudio(),!!this.audiotrack&&(this.audiotrack.enabled=!0,!0)},h.prototype.disableAudio=function(){var o;return(o=this.reporter)===null||o===void 0||o.reportDisableAudio(),!!this.audiotrack&&(this.audiotrack.enabled=!1,!0)},h.prototype.enableVideo=function(){var o;return(o=this.reporter)===null||o===void 0||o.reportEnableVideo(),!!this.videotrack&&(this.videotrack.enabled=!0,!0)},h.prototype.disableVideo=function(){var o;return(o=this.reporter)===null||o===void 0||o.reportDisableVideo(),!!this.videotrack&&(this.videotrack.enabled=!1,!0)},h.prototype.stop=function(){var o;_.prototype.stop.call(this),this.hasVideo=!1,this.hasScreen=!1,this.isCustomStream=!1,this.canvasRenderer&&(this.canvasRenderer.stop(),this.canvasRenderer=void 0),this.audiotrack&&(this.audiotrack.stop(),this.audiotrack=void 0),this.videotrack&&(this.videotrack.stop(),this.videotrack=void 0),this.micAudioTrack&&(this.micAudioTrack.stop(),this.micAudioTrack=void 0),this.screenAudioTrack&&(this.screenAudioTrack.stop(),this.screenAudioTrack=void 0),(o=this.reporter)===null||o===void 0||o.reportStop(0)},h.prototype.mergeStream=function(o){var g=o.videoTrack,m=o.audioTrack;g&&(this.videoTrack&&(this.videoTrack.removeEventListener("ended",this.handleVideoTrackEnded),this.mediaStream.removeTrack(this.videoTrack)),this.mediaStream.addTrack(g),this.videotrack=g,this.listenVideoEnded(),this.hasVideo=o.hasVideo,this.hasScreen=o.hasScreen,this.isCustomStream=o.isCustomStream,this.hasVideo&&(this.videoProfile=o.videoProfile),this.hasScreen&&(this.screenProfile=o.screenProfile)),m&&(this.audioTrack&&(this.audioTrack.removeEventListener("ended",this.handleAudioTrackEnded),this.mediaStream.removeTrack(this.audioTrack)),this.mediaStream.addTrack(m),this.audiotrack=m,this.listenAudioEnded())},h.prototype.deleteTracks=function(o){o.audio&&this.audioTrack&&(this.mediaStream.removeTrack(this.audioTrack),this.audiotrack=void 0),o.video&&this.videoTrack&&(this.mediaStream.removeTrack(this.videoTrack),this.videotrack=void 0,this.hasScreen=!1,this.hasVideo=!1)},h.prototype.createCustomStream=function(o){var g=this;return new Promise(function(m,T){if(!o)return T(new r.RtsError(n.ErrorCode.ERROR_CUSTOMSTREAM_NONE,"MediaStream is required.",""));if(!(o instanceof MediaStream))return T(new r.RtsError(n.ErrorCode.ERROR_CUSTOMSTREAM_INVALID,"MediaStream is invalid.",""));if(o.getTracks().length===0)return T(new r.RtsError(n.ErrorCode.ERROR_CUSTOMSTREAM_TRACK_NONE,"MediaStream has no track.",""));var C=(0,E.getVideoTrack)(o),D=(0,E.getAudioTrack)(o);C&&(g.hasVideo=!0,g.videotrack=C,g.mediastream.addTrack(C)),D&&(g.audiotrack=D,g.mediastream.addTrack(D)),g.isCustomStream=!0,g.setVideoProfile(g.videoProfile),g.addTrackListener(),m()})},h.prototype.releaseMediaStream=function(){var o=this;this.mediastream.getTracks().forEach(function(g){g.stop(),o.mediastream.removeTrack(g)})},h.prototype.hasVideoTrackReady=function(o){return!(!o.video&&!o.screen||!this.videotrack)||!o.video&&!o.screen},h.prototype.hasScreenAudioConfig=function(o){return typeof o.screen=="object"&&o.screen.audio},h.prototype.hasAudioTrackReady=function(o){return!(o.audio&&(!this.hasMicAudioAndReady(o)&&!this.hasScreenAudioAndReady(o)||!this.audiotrack))},h.prototype.hasMicAudioAndReady=function(o){return o.audio&&this.micAudioTrack},h.prototype.hasScreenAudioAndReady=function(o){return this.hasScreenAudioConfig(o)&&this.screenAudioTrack},h.prototype.addTrackListener=function(){this.listenVideoEnded(),this.listenAudioEnded()},h.prototype.listenVideoEnded=function(){var o=this;this.videotrack&&this.videotrack.addEventListener("ended",this.handleVideoTrackEnded),this.micAudioTrack&&this.micAudioTrack.addEventListener("ended",function(){var g;o.emit("micAudioTrackEnded"),o.screenAudioTrack&&o.screenAudioTrack.readyState==="ended"&&((g=o.audioMixer)===null||g===void 0||g.destroy(),o.emit("audioTrackEnded"))}),this.screenAudioTrack&&this.screenAudioTrack.addEventListener("ended",function(){var g;o.emit("screenAudioTrackEnded"),o.micAudioTrack&&o.micAudioTrack.readyState==="ended"&&((g=o.audioMixer)===null||g===void 0||g.destroy(),o.emit("audioTrackEnded"))})},h.prototype.listenAudioEnded=function(){this.audiotrack&&this.audiotrack.addEventListener("ended",this.handleAudioTrackEnded)},h.prototype.handleVideoTrackEnded=function(){this.hasScreen=!1,this.hasVideo=!1,this.emit("videoTrackEnded")},h.prototype.handleAudioTrackEnded=function(){this.emit("audioTrackEnded")},h}(p.Stream);R.LocalStream=b},771:function(L,R,x){var v,c=this&&this.__extends||(v=function(p,e){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},v(p,e)},function(p,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=p}v(p,e),p.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(R,"__esModule",{value:!0}),R.RemoteStream=void 0;var u=x(5805),S=x(233),f=x(5044),a=x(9428),d=function(p){function e(){var r=p.call(this)||this;return r.recvCanPlay=!1,r.autoplay=!0,r.onCanPlay=r.onCanPlay.bind(r),r}return c(e,p),Object.defineProperty(e.prototype,"muted",{get:function(){return!!this.element&&this.element.muted},set:function(r){this.element&&(this.element.muted=r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioTrack",{get:function(){var r;return(r=this.mediastream)===null||r===void 0?void 0:r.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoTrack",{get:function(){var r;return(r=this.mediastream)===null||r===void 0?void 0:r.getVideoTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasVideo",{get:function(){return!!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasAudio",{get:function(){return!!this.audioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaStream",{get:function(){return this.mediastream},enumerable:!1,configurable:!0}),e.prototype.updateMediaStream=function(r){var n=this.mediastream||new MediaStream;r.getTracks().forEach(function(s){return n.addTrack(s)}),this.mediastream=n,this.element&&this.play(this.element)},e.prototype.getMediaStream=function(){return this.mediastream},e.prototype.mergeStream=function(r){if(this.mediaStream){var n=r.getVideoTracks()[0],s=r.getAudioTracks()[0];n&&(this.videoTrack&&this.mediaStream.removeTrack(this.videoTrack),this.mediaStream.addTrack(n),this.videotrack=n),s&&(this.audioTrack&&this.mediaStream.removeTrack(this.audioTrack),this.mediaStream.addTrack(s),this.audiotrack=s)}},e.prototype.play=function(r,n){if(this.autoplay=!!(!n||n.autoplay),r){if(!(r instanceof HTMLMediaElement))throw new f.RtsError(a.ErrorCode.ERROR_HTMLELEMENT_ERROR,"Param is not a HTMLMediaElement","",{element:r});this.recvCanPlay=!1,this.emit("mediaElementBinded"),this.element=r,this.element.addEventListener("canplay",this.onCanPlay);var s=this.mediaStream;this.element.addEventListener("playing",function t(){r.removeEventListener("playing",t),S.SystemUtil.isIos&&parseInt(S.SystemUtil.systemVersion)<=13&&!r.muted&&s?.getAudioTracks().length&&(r.pause(),r.play())}),this.element.nodeName==="VIDEO"&&(this.element.setAttribute("playsinline",""),S.BrowserUtil.isMicroMessenger&&(this.element.setAttribute("x5-video-player-type","h5-page"),this.element.setAttribute("x5-playsinline",""),S.SystemUtil.isAndroid||S.SystemUtil.isIos&&this.element.setAttribute("x-webkit-airplay","allow"))),this.autoplay&&S.BrowserUtil.isSafari&&this.element.setAttribute("autoplay",""),this.mediastream&&this.bindMediaStream(this.mediastream)}else this.release()},e.prototype.disableVideo=function(){var r=this.getMediaStream();r&&r.getVideoTracks().forEach(function(n){n.enabled&&(n.enabled=!1)})},e.prototype.enableVideo=function(){var r=this.getMediaStream();r&&r.getVideoTracks().forEach(function(n){n.enabled||(n.enabled=!0)})},e.prototype.disableAudio=function(){var r=this.getMediaStream();r&&r.getAudioTracks().forEach(function(n){n.enabled&&(n.enabled=!1)})},e.prototype.enableAudio=function(){var r=this.getMediaStream();r&&r.getAudioTracks().forEach(function(n){n.enabled||(n.enabled=!0)})},e.prototype.stop=function(){p.prototype.stop.call(this),this.release()},e.prototype.onCanPlay=function(){var r=this;if(!this.recvCanPlay&&(this.emit("onCanPlay"),this.recvCanPlay=!0,this.autoplay))if(this.element)if(S.BrowserUtil.isMicroMessenger){var n=window.top!==window.self,s=window.WeixinJSBridge||window.top.WeixinJSBridge;s?s.invoke("getNetworkType",{},function(){r.tryToPlay()}):(n?window.top.document:document).addEventListener("WeixinJSBridgeReady",function(){s.invoke("getNetworkType",{},function(){r.tryToPlay()})})}else this.tryToPlay();else this.tryToPlay()},e.prototype.release=function(){this.element&&(this.element.pause(),this.element.srcObject=null,this.element.load(),this.element.removeEventListener("canplay",this.onCanPlay)),this.recvCanPlay=!1,this.mediastream=void 0},e.prototype.bindMediaStream=function(r){this.element&&(this.element.nodeName==="AUDIO"&&r.getVideoTracks()[0]&&r.removeTrack(r.getVideoTracks()[0]),this.element.srcObject=r),this.mediastream=r},e.prototype.tryToPlay=function(){var r=this;if(this.element){var n=this.element.play();n!==void 0&&n.then(function(){}).catch(function(s){console.log("playPromise err",s),r.element&&r.element.srcObject&&r.emit("onAutoPlayError")})}},e}(u.Stream);R.RemoteStream=d},5805:function(L,R,x){var v,c=this&&this.__extends||(v=function(a,d){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,e){p.__proto__=e}||function(p,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(p[r]=e[r])},v(a,d)},function(a,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function p(){this.constructor=a}v(a,d),a.prototype=d===null?Object.create(d):(p.prototype=d.prototype,new p)}),u=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(R,"__esModule",{value:!0}),R.Stream=void 0;var S=x(233),f=function(a){function d(){var p=a.call(this)||this;return p.traceid="",p.id=S.Guid.create(32),p}return c(d,a),Object.defineProperty(d.prototype,"traceId",{get:function(){return this.traceid},set:function(p){this.traceid=p},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"mediaElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),d.prototype.setReporter=function(p){this.reporter=p},d.prototype.play=function(p){},d.prototype.stop=function(){this.traceid="",this.reporter=void 0},d}(u(x(102)).default);R.Stream=f},5676:function(L,R,x){var v,c=this&&this.__extends||(v=function(m,T){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,D){C.__proto__=D}||function(C,D){for(var y in D)Object.prototype.hasOwnProperty.call(D,y)&&(C[y]=D[y])},v(m,T)},function(m,T){if(typeof T!="function"&&T!==null)throw new TypeError("Class extends value "+String(T)+" is not a constructor or null");function C(){this.constructor=m}v(m,T),m.prototype=T===null?Object.create(T):(C.prototype=T.prototype,new C)}),u=this&&this.__assign||function(){return u=Object.assign||function(m){for(var T,C=1,D=arguments.length;C<D;C++)for(var y in T=arguments[C])Object.prototype.hasOwnProperty.call(T,y)&&(m[y]=T[y]);return m},u.apply(this,arguments)},S=this&&this.__awaiter||function(m,T,C,D){return new(C||(C=Promise))(function(y,A){function O(H){try{I(D.next(H))}catch(F){A(F)}}function j(H){try{I(D.throw(H))}catch(F){A(F)}}function I(H){var F;H.done?y(H.value):(F=H.value,F instanceof C?F:new C(function(U){U(F)})).then(O,j)}I((D=D.apply(m,T||[])).next())})},f=this&&this.__generator||function(m,T){var C,D,y,A,O={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return A={next:j(0),throw:j(1),return:j(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function j(I){return function(H){return function(F){if(C)throw new TypeError("Generator is already executing.");for(;A&&(A=0,F[0]&&(O=0)),O;)try{if(C=1,D&&(y=2&F[0]?D.return:F[0]?D.throw||((y=D.return)&&y.call(D),0):D.next)&&!(y=y.call(D,F[1])).done)return y;switch(D=0,y&&(F=[2&F[0],y.value]),F[0]){case 0:case 1:y=F;break;case 4:return O.label++,{value:F[1],done:!1};case 5:O.label++,D=F[1],F=[0];continue;case 7:F=O.ops.pop(),O.trys.pop();continue;default:if(y=O.trys,!((y=y.length>0&&y[y.length-1])||F[0]!==6&&F[0]!==2)){O=0;continue}if(F[0]===3&&(!y||F[1]>y[0]&&F[1]<y[3])){O.label=F[1];break}if(F[0]===6&&O.label<y[1]){O.label=y[1],y=F;break}if(y&&O.label<y[2]){O.label=y[2],O.ops.push(F);break}y[2]&&O.ops.pop(),O.trys.pop();continue}F=T.call(m,O)}catch(U){F=[6,U],D=0}finally{C=y=0}if(5&F[0])throw F[1];return{value:F[0]?F[1]:void 0,done:!0}}([I,H])}}},a=this&&this.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(R,"__esModule",{value:!0}),R.Subscriber=void 0;var d,p=x(4865),e=x(5917),r=x(9428),n=a(x(8219)),s=a(x(102)),t=x(5044),i=x(7989),l=x(492),E=a(x(2818)),b=a(x(7028)),_=x(6091),h=x(771),o=x(2718);(function(m){m[m.Init=0]="Init",m[m.Requesting=1]="Requesting",m[m.Playing=2]="Playing",m[m.Waiting=3]="Waiting"})(d||(d={}));var g=function(m){function T(C,D){var y=m.call(this)||this;return y.monitorStatsHistory=[],y.playTimeIndex=0,y.playCatonIndex=0,y.reportPubFlag=!1,y.state=d.Init,y.subscribeAudio=!0,y.subscribeVideo=!0,y.signalingUrl="",y.pullStreamUrl="",y.noParsePullStreamUrl="",y.subReconnectTimes=0,y.isConnecting=!1,y.reconnectTimerHandle=null,y.reporter=C,y.playTimer=0,y.config=D||{playTimeOut:5e3},y.remoteStream=new h.RemoteStream,y.remoteStream.on("onAutoPlayError",function(){y.emit("onError",new t.RtsError(r.ErrorCode.ERROR_AUTOPLAY_ERROR,"auto play failed",""))}),y.remoteStream.on("onCanPlay",function(){return S(y,void 0,void 0,function(){var A,O,j,I,H,F,U,B,k,V,G;return f(this,function(q){switch(q.label){case 0:return A=new Date().getTime(),[4,this.peerconnection.sample()];case 1:return q.sent(),O=-1,j=[],I=-1,this.monitorStatsHistory&&this.monitorStatsHistory.length&&(H=this.monitorStatsHistory[this.monitorStatsHistory.length-1],this.monitorStatsHistory.forEach(function(z){var $=z.rtt;$&&$>0&&j.push($)}),O=Number((j.reduce(function(z,$){return z+$},0)/j.length).toFixed(3)),I=H.packetsLost,this.monitorStatsHistory=null),this.stopPlayTimer(),this.peerconnection.playStart(),this.subReconnectTimes=0,F=this._cnend||A,this.reporter.reportFirstFrameTime(this.noParsePullStreamUrl,this.remoteStream.traceId,this._cpend-this._cpstart,this._hrend-this._cpend,A-this._cpstart,0,F-this._hrend,{rttAvg:O,packetsLost:I},-1,-1,-1,(B=this.subscribeConfig)===null||B===void 0?void 0:B.vMsid,(k=this.subscribeConfig)===null||k===void 0?void 0:k.aMsid),(U=new _.PlayEvent(_.PlayType.PLAY_CANPLAY)).data={url:this.noParsePullStreamUrl,vMsid:(V=this.subscribeConfig)===null||V===void 0?void 0:V.vMsid,aMsid:(G=this.subscribeConfig)===null||G===void 0?void 0:G.aMsid},this.emit("onPlayEvent",U),[2]}})})}),y.peerconnection=new p.RtsPeerconnection,y.peerconnection.on("onConnected",function(){y._cnend=new Date().getTime()}),y.peerconnection.on("streamEnded",function(A){var O=new _.PlayEvent(_.PlayType.PLAY_ENDED);O.data=u({},A),y.emit("onPlayEvent",O),y.emit("onError",new t.RtsError(r.ErrorCode.ERROR_STREAM_ENDED,"Stream Receiver Transport is Closed",y.remoteStream.traceId))}),y.peerconnection.on("onTrackEvent",function(A){A.streams&&A.streams.length&&(y.remoteStream.updateMediaStream(A.streams[0]),y.onTrackFunction&&y.onTrackFunction())}),y.peerconnection.on("connectStatusChange",function(A){A.status!==e.EConnectStatus.CONNECT_STATUS_DISCONNECTED&&A.status!==e.EConnectStatus.CONNECT_STATUS_RECONNECTING||!y.hasRetries()?y.emit("connectStatusChange",A):y.emit("onError",new t.RtsError(r.ErrorCode.ERROR_PC_DISCONNECTED,"PC disconnected",y.remoteStream.traceId))}),y.peerconnection.on("pcReconnect",function(A){var O,j;A.ips?(O="Migrate with ips: ".concat(JSON.stringify(A.ips)),j=r.ErrorCode.ERROR_IP_MIGRATE):(O="PC disconnected",j=r.ErrorCode.ERROR_PC_DISCONNECTED),y.emit("onError",new t.RtsError(j,O,"",{pcErrorInfo:A}))}),y.mediaObserver=new l.MediaObserver({handler:function(A,O,j){var I,H=new _.PlayEvent(_.PlayType.PLAY_TIMEOUT),F={url:A};O&&(F.vMsid=O),j&&(F.aMsid=j),H.data=F,y.emit("onPlayEvent",H);var U=new t.RtsError(r.ErrorCode.ERROR_INBOUND_TIMEOUT,"Media data timeout after ".concat((I=y.mediaObserver)===null||I===void 0?void 0:I.actTimeout," ms."),y.remoteStream.traceId);y.emit("onError",U)}}),y.peerconnection.on("onMonitorEvent",function(A){var O=A.eventList;if(A.type!=="pub"){if(O.length){for(var j=void 0,I=0;I<O.length;I++)if(O[I].url===(0,o.pruneSubUrl)(y.noParsePullStreamUrl,!0)){j=O[I];break}if(j){y.lastMeidaEventData=j;var H=j.video,F=j.audio;H&&y.monitorStatsHistory?y.monitorStatsHistory.push({rtt:H.transportStats.rtt,packetsLost:H.inboundRtpStats.packetsLost}):F&&y.monitorStatsHistory&&y.monitorStatsHistory.push({rtt:F.transportStats.rtt,packetsLost:F.inboundRtpStats.packetsLost}),d.Requesting===y.state?j.video?j.video.inboundRtpStatsPerSec.framesDecodedPerSecond>5&&(y.state=d.Playing):j.audio&&j.audio.inboundRtpStatsPerSec.bytesReceivedPerSecond>0&&(y.state=d.Playing):y.state!==d.Playing&&y.state!==d.Waiting||(++y.playTimeIndex,j.video&&(j.video.inboundRtpStatsPerSec.framesDecodedPerSecond<=5?(++y.playCatonIndex,d.Waiting!==y.state&&(y.state=d.Waiting,y.emit("onPlayEvent",new _.PlayEvent(_.PlayType.PLAY_WAITING)))):d.Waiting===y.state&&(y.state=d.Playing,y.emit("onPlayEvent",new _.PlayEvent(_.PlayType.PLAY_PLAYING)))),E.default.HEARTHEAT_INTERVAL===y.playTimeIndex&&(y.reportPubFlag=!0,O.forEach(function(B){y.doReportPullStats(B)}),y.playTimeIndex=0,y.playCatonIndex=0))}var U=new _.PlayEvent(_.PlayType.PLAY_MEDIA);U.data=[],O.forEach(function(B){var k={};k.url=B.url;var V=y.calcStreamPullStats(B);if(B.audio&&(k.audio={bytesReceivedPerSecond:B.audio.inboundRtpStatsPerSec.bytesReceivedPerSecond,rtt:B.audio.transportStats.rtt,lossRate:V.aloss},k.aMsid=B.aMsid),B.video){var G=B.video,q=G.inboundRtpStats,z=G.inboundRtpStatsPerSec,$=G.transportStats;k.video={bytesReceivedPerSecond:z.bytesReceivedPerSecond,fps:q.framesPerSecond||z.framesDecodedPerSecond,framesDecodedPerSecond:z.framesDecodedPerSecond,rtt:$.rtt,width:q.frameWidth,height:q.frameHeight,lossRate:V.vloss},k.vMsid=B.vMsid}k.networkQuality=V.net_qual||0,U.data.push(k)}),U.data&&U.data.length&&(U.data.forEach(function(B){var k;(k=y.mediaObserver)===null||k===void 0||k.check({audio:B.audio,video:B.video},B.url,B.vMsid,B.aMsid)}),U.data.length===1&&(U.data[0].audio||U.data[0].video)&&(U.data=u({},U.data[0])),y.emit("onPlayEvent",U))}}else y.reportPubFlag&&(y.handlePubMonitorEvent(O),y.reportPubFlag=!1)}),y.playTimer=0,y._cpstart=0,y._cpend=0,y._hrend=0,y._cnend=0,y.subscribeConfig={},y}return c(T,m),T.prototype.getPeerConnection=function(){return this.peerconnection},T.prototype.subscribe=function(C,D,y){var A=this;return new Promise(function(O,j){return S(A,void 0,void 0,function(){var I,H,F=this;return f(this,function(U){switch(U.label){case 0:return this.monitorStatsHistory=[],this.unsubscribe(),this.subscribeConfig=D||{},this.state=d.Requesting,this.noParsePullStreamUrl=C,this.parseUrl(C),(H=this.mediaObserver)===null||H===void 0||H.updateConfig({timeout:D?.mediaTimeout}),I=D?.signalUrl,this.signalingUrl=I||this.signalingUrl,this.checkPullUrl()?[3,1]:(j(new t.RtsError(r.ErrorCode.ERROR_PLAY_URL,"url need artc://","")),[3,8]);case 1:return this.subscribeAudio||this.subscribeVideo?[3,2]:(j(new t.RtsError(r.ErrorCode.ERROR_SUBSCRIBE_NOTHING,"subscribe nothing","")),[3,8]);case 2:if(this._cpstart=new Date().getTime(),!this.subscribeVideo||D?.isH264Checked)return[3,7];U.label=3;case 3:return U.trys.push([3,5,,6]),[4,new i.SupportUtil().loadH264(3)];case 4:return U.sent(),[3,6];case 5:return U.sent(),[3,6];case 6:U.label=7;case 7:this.peerconnection.createOffer(this.subscribeAudio,this.subscribeVideo,void 0,{offerSdpHook:D?.offerSdpHook,answerSdpHook:D?.answerSdpHook,encodedInsertableStreams:D?.encodedInsertableStreams,disableStereo:D?.disableStereo,disableHeartbeat:D?.disableHeartbeat}).then(function(B){var k=B.desp;F._cpend=new Date().getTime(),F.reporter.reportSubscribeStart(F.noParsePullStreamUrl,F.signalingUrl,D?.vMsid,D?.aMsid),F.excuteSignal(k,{innerTcpOnly:!!y?.innerTcpOnly}).then(function(V){var G;F.remoteStream.traceId=V,O(F.remoteStream);try{(G=F.peerconnection.getPeerCore())===null||G===void 0||G.patchSubscribeStreamManagerRecord(F.noParsePullStreamUrl,u(u({},F.subscribeConfig),{stream:F.remoteStream}))}catch(q){console.log(q)}F.peerconnection.getSubMonitor().updateTranceiversController()}).catch(function(V){F._hrend=new Date().getTime();var G=new t.RtsError(V.errorCode?V.errorCode:r.ErrorCode.ERROR_HTTPREQUEST_ERROR,V.message,V?V.traceid:"",{response:V.response,sdp:V.sdp});j(G)})}).catch(function(B){F._cpend=new Date().getTime();var k=new t.RtsError(r.ErrorCode.ERROR_CREATEOFFER,B.message,"");j(k)}),U.label=8;case 8:return[2]}})})})},T.prototype.unsubscribe=function(){var C;this.lastMeidaEventData&&this.doReportPullStats(this.lastMeidaEventData),this.stopPlayTimer(),this.peerconnection.dispose(),this.remoteStream.stop(),this.subscribeVideo=!0,this.subscribeAudio=!0,this.subscribeConfig={},this.state=d.Init,this.signalingUrl="",this.pullStreamUrl="",this.noParsePullStreamUrl="",this.onTrackFunction=void 0,this.playTimer=0,this._cpstart=0,this._cpend=0,this._hrend=0,this._cnend=0,this.monitorStatsHistory=[],(C=this.mediaObserver)===null||C===void 0||C.reset()},T.prototype.startLiveStream=function(C,D,y){var A=this;return console.error("\u6B64API\u53EF\u80FD\u5B58\u5728\u7A33\u5B9A\u6027\u95EE\u9898\uFF0C\u5E76\u5C06\u5728\u672A\u6765\u7684\u7248\u672C\u79FB\u9664\u3002\u8BF7\u4F7F\u7528subscribe\u66FF\u4EE3\uFF0C\u8BE6\u7EC6\u7528\u6CD5\u8BF7\u53C2\u8003\u5B98\u65B9\u6587\u6863\u3002"),new Promise(function(O,j){A.unsubscribe(),A.state=d.Requesting,A.noParsePullStreamUrl=C,A.parseUrl(C);var I=y?.signalUrl;A.signalingUrl=I||A.signalingUrl,A.pullStreamUrl===""?j(new t.RtsError(r.ErrorCode.ERROR_PLAY_URL,"url need artc://","")):A.subscribeAudio||A.subscribeVideo?!D||D.nodeName!=="AUDIO"&&D.nodeName!=="VIDEO"?j(new t.RtsError(r.ErrorCode.ERROR_HTMLELEMENT_ERROR,"need htmlaudioelement or htmlvideoelement","")):(A.subscribeAudio&&A.subscribeVideo?D.nodeName!=="VIDEO"&&A.emit("onError",new t.RtsError(r.ErrorCode.ERROR_HEMLELEMENT_NOTMATCH,"need htmlvideoelement","")):A.subscribeAudio?D.nodeName!=="AUDIO"&&A.emit("onError",new t.RtsError(r.ErrorCode.ERROR_HEMLELEMENT_NOTMATCH,"need htmlaudioelement","")):D.nodeName!=="VIDEO"&&A.emit("onError",new t.RtsError(r.ErrorCode.ERROR_HEMLELEMENT_NOTMATCH,"need htmlvieoelement","")),A._cpstart=new Date().getTime(),A.reporter.updateTid(),A.peerconnection.createOffer(A.subscribeAudio,A.subscribeVideo).then(function(H){var F=H.desp;A._cpend=new Date().getTime(),A.excuteSignal(F).then(function(U){A.remoteStream.traceId=U,A._hrend=new Date().getTime(),A.remoteStream.play(D),O(U)}).catch(function(U){A._hrend=new Date().getTime(),A.reporter.reportFirstFrameTime(A.noParsePullStreamUrl,U?U.traceid:"",A._cpend-A._cpstart,A._hrend-A._cpend,-1,-1,A._cnend-A._hrend),j(new t.RtsError(U.errorCode?U.errorCode:r.ErrorCode.ERROR_HTTPREQUEST_ERROR,U.message,""))})}).catch(function(H){A._cpend=new Date().getTime(),A.reporter.reportFirstFrameTime(A.noParsePullStreamUrl,H?H.traceid:"",A._cpend-A._cpstart,-1,-1,-1,A._cnend-A._hrend),j(new t.RtsError(r.ErrorCode.ERROR_CREATEOFFER,H.message,""))})):j(new t.RtsError(r.ErrorCode.ERROR_SUBSCRIBE_NOTHING,"subscribe nothing",""))})},T.prototype.stopLiveStream=function(){this.unsubscribe()},T.prototype.muteLiveStream=function(C){return this.remoteStream.muted=C,!0},T.prototype.excuteSignal=function(C,D){var y=this;return new Promise(function(A,O){var j,I,H,F,U={url:y.pullStreamUrl,amsid:((j=y.subscribeConfig)===null||j===void 0?void 0:j.aMsid)||["rts audio"],vmsid:((I=y.subscribeConfig)===null||I===void 0?void 0:I.vMsid)||["rts video"]};y.subscribeAudio||delete U.amsid,y.subscribeVideo||delete U.vmsid,n.default.post(y.signalingUrl,{version:((H=y.subscribeConfig)===null||H===void 0?void 0:H.signalVersion)||b.default.protocol_version,sdk_version:b.default.sdk_version,mode:((F=y.subscribeConfig)===null||F===void 0?void 0:F.signalMode)||"live",pull_streams:[U],jsep:C}).then(function(B){var k,V,G,q,z;if(B&&B.status===200){y._hrend=new Date().getTime();var $=(k=B.data)===null||k===void 0?void 0:k.trace_id;y.reporter.reportSubscribeOk({vurl:y.noParsePullStreamUrl,surl:y.signalingUrl,traceId:$,hrct:y._hrend-y._cpend,rslt:(V=B.data)===null||V===void 0?void 0:V.code});var re=typeof((G=y.subscribeConfig)===null||G===void 0?void 0:G.tcpOnly)=="boolean"?y.subscribeConfig.tcpOnly:D?.innerTcpOnly;y.peerconnection.recvAnswer(B.data,{answerSdpHook:(q=y.subscribeConfig)===null||q===void 0?void 0:q.answerSdpHook,tcpOnly:re}).then(function(){A($)}).catch(function(ee){ee.traceid=B.data?B.data.trace_id:"",O({errorCode:r.ErrorCode.ERROR_ANSWER_ERROR,message:ee.message?ee.message:"set answer error",traceid:ee.traceid,sdp:ee.sdp})})}else O({message:B?"response status:"+B.status:"response is null",traceid:(z=B?.data)===null||z===void 0?void 0:z.trace_id,sdp:C.sdp})}).catch(function(B){return S(y,void 0,void 0,function(){var k,V;return f(this,function(G){switch(G.label){case 0:if(![400,500].includes((V=B.response)===null||V===void 0?void 0:V.status))return[3,4];B.sdp=C.sdp,G.label=1;case 1:return G.trys.push([1,3,,4]),[4,new i.SupportUtil().isSupport({isReceiveVideo:!0})];case 2:return G.sent(),[3,4];case 3:return k=G.sent(),B.errorCode=k?.errorCode,B.message=k?.message,this.subReconnectTimes=1/0,[3,4];case 4:return O(B),[2]}})})})})},T.prototype.checkPullUrl=function(){return!!this.noParsePullStreamUrl&&this.noParsePullStreamUrl.indexOf("artc://")===0},T.prototype.parseUrl=function(C){if(C===void 0&&(C=""),C?.indexOf("artc://")===0){var D=C.indexOf("@");if(D>-1){var y=C.substring(D+1,C.length);this.pullStreamUrl=C.substring(0,D);for(var A=y.split("&"),O=0;O<A.length;++O)A[O]==="subaudio=no"&&(this.subscribeAudio=!1),A[O]==="subvideo=no"&&(this.subscribeVideo=!1)}else this.pullStreamUrl=C;var j=window.location.protocol,I=(["http:","https:"].indexOf(j)>-1?j:"https:")+"//";this.signalingUrl=this.pullStreamUrl.replace("artc://",I)}},T.prototype.stopPlayTimer=function(){this.playTimer&&clearTimeout(this.playTimer),this.playTimer=0},T.prototype.calcStreamPullStats=function(C){var D={},y=C.video,A=C.audio;if(y){var O=y.transportStats,j=y.inboundRtpStats,I=y.inboundRtpStatsPerSec,H=y.localCandidate,F=y.remoteCandidate;D=u(u({},D),{rtt:O?.rtt!==-1?1e3*(O?.rtt||0):-1,cand_re_prot:F.protocol,cand_lo_prot:H.protocol,cand_re_addr:"".concat(F.ip||F.address,":").concat(F.port),cand_lo_addr:"".concat(H.ip||H.address,":").concat(H.port),w:j?.frameWidth,h:j?.frameHeight,vbps:Math.floor(8*I.bytesReceivedPerSecond),fps:j?.framesPerSecond,dfps:Math.floor(I?.framesDecodedPerSecond),vjb:Math.floor((0,o.getJitterBufferDelayAvg)(j?.jitterBufferDelay,j?.jitterBufferEmittedCount)),vMsid:C.vMsid,vloss:I.packetsLostRate})}return A&&(O=A.transportStats,j=A.inboundRtpStats,I=A.inboundRtpStatsPerSec,H=A.localCandidate,F=A.remoteCandidate,D=u(u({},D),{rtt:O?.rtt!==-1?1e3*(O?.rtt||0):-1,cand_re_prot:F.protocol,cand_lo_prot:H.protocol,cand_re_addr:"".concat(F.ip||F.address,":").concat(F.port),cand_lo_addr:"".concat(H.ip||H.address,":").concat(H.port),abps:Math.floor(8*I.bytesReceivedPerSecond),ajb:Math.floor((0,o.getJitterBufferDelayAvg)(j?.jitterBufferDelay,j.jitterBufferEmittedCount)),aMsid:C.aMsid,aloss:I.packetsLostRate})),D=u(u({},D),{net_qual:(0,o.evaluateNetworkCondition)(D.rtt,D.aloss,D.vloss,D.ajb,D.vjb)})},T.prototype.doReportPullStats=function(C){var D=this.calcStreamPullStats(C),y={ct:1e3*this.playCatonIndex,tt:1e3*this.playTimeIndex,url:C.url};y.tt&&(y=u(u({},y),D),this.reporter.reportPullStats(y),this.lastMeidaEventData=void 0)},T.prototype.retrySubscribe=function(C,D){return S(this,void 0,void 0,function(){var y,A,O,j,I,H,F;return f(this,function(U){switch(U.label){case 0:if(C.extraInfo=u(u({},C.extraInfo),{retryTimes:this.subReconnectTimes}),!this.hasRetries())return[2,!1];if(typeof((y=this.subscribeConfig)==null?void 0:y.beforeRetry)!="function")return[3,4];U.label=1;case 1:return U.trys.push([1,3,,4]),[4,y.beforeRetry({url:this.noParsePullStreamUrl,vMsid:y.vMsid,aMsid:y.aMsid,useTcp:D?.innerTcpOnly})];case 2:return(A=U.sent())?(O=A.url,j=A.vMsid,I=A.aMsid,H=A.useTcp,this.reporter.reportReconnectParams("sub",O,j,I,H),this.noParsePullStreamUrl=O,this.subscribeConfig.vMsid=j,this.subscribeConfig.aMsid=I,typeof H=="boolean"&&(D=u(u({},D),{innerTcpOnly:H})),console.log(`retry with:
151
- [URL] `.concat(O,`
150
+ [PROTOCOL] `).concat(o?"TCP":"UDP"))):(this.reporter.reportReconnectParams("pub"),this.pubReconnectTimes=1/0),[3,4];case 3:return A=w.sent(),console.error("Error in beforeRetry",A),[3,4];case 4:return this.hasRetries()&&this.localStream?(this.emit("connectStatusChange",{status:d.EConnectStatus.CONNECT_STATUS_RECONNECTING}),this.incrementReconnectTimes(),h.extraInfo.retryTimes=this.pubReconnectTimes,h.extraInfo.tcpOnly=!!o,this.publishWithReconnect(this.publishUrl,this.localStream,u(u({},this.publishConfig),{tcpOnly:!!o})).catch(function(j){}),[2,!0]):(h.extraInfo.retryTimes=this.pubReconnectTimes,[2,!1])}})})},_.prototype.publishWithReconnect=function(h,o,g,m,T){var C=this;return new Promise(function(D,y){D=m||D,y=T||y,C.isConnecting=!0,C.publish(h,o,g).then(function(A){C.isConnecting=!1,D(A)}).catch(function(A){var w;if(!C.isConnecting)return y(A);if(!r.RECONNECT_ERROR_EXCLUDE_LIST.includes(A.errorCode)&&C.hasRetries(!0)){var j=((w=C.publishConfig)===null||w===void 0?void 0:w.retryInterval)||d.DEFAULT_RETRY_PUBLISH_INTERVAL;C.reconnectTimerHandle=setTimeout(function(){A.extraInfo=u(u({},A.extraInfo),{retryTimes:C.pubReconnectTimes}),C.emit("reconnect",A),C.publishWithReconnect(h,o,g,D,y)},j)}else y(A),A.extraInfo=u(u({},A.extraInfo),{retryTimes:C.pubReconnectTimes}),C.isConnecting=!1,C.emit("onError",A)})})},_.prototype.sendSEI=function(h){var o;(o=this.peerconnection)===null||o===void 0||o.sendSEI(h)},_.prototype.hasRetries=function(h){var o,g,m=d.DEFAULT_RETRY_PUBLISH_LIMIT;typeof((o=this.publishConfig)===null||o===void 0?void 0:o.retryTimes)=="number"&&(m=Math.floor((g=this.publishConfig)===null||g===void 0?void 0:g.retryTimes));var T=this.pubReconnectTimes<m;return h&&T&&this.incrementReconnectTimes(),T},_.prototype.resetRepublishStatus=function(){this.pubReconnectTimes=0,this.isConnecting=!1,this.reporter.updateTid(),this.reconnectTimerHandle!==null&&(clearTimeout(this.reconnectTimerHandle),this.reconnectTimerHandle=null)},_.prototype.handleSubMonitorEvent=function(h){var o=this;h.forEach(function(g){var m={ct:0,tt:4e3,url:g.url},T=g.video,C=g.audio;if(T){var D=T.transportStats,y=T.inboundRtpStats,A=T.inboundRtpStatsPerSec,w=T.localCandidate,j=T.remoteCandidate;m=u(u({},m),{rtt:D?.rtt!==-1?1e3*(D?.rtt||0):-1,cand_re_prot:j.protocol,cand_lo_prot:w.protocol,cand_re_addr:"".concat(j.ip||j.address,":").concat(j.port),cand_lo_addr:"".concat(w.ip||w.address,":").concat(w.port),w:y?.frameWidth,h:y?.frameHeight,vbps:Math.floor(8*A.bytesReceivedPerSecond),fps:y?.framesPerSecond,dfps:Math.floor(A?.framesDecodedPerSecond),vjb:Math.floor((0,l.getJitterBufferDelayAvg)(y?.jitterBufferDelay,y?.jitterBufferEmittedCount)),vMsid:g.vMsid})}C&&(D=C.transportStats,y=C.inboundRtpStats,A=C.inboundRtpStatsPerSec,w=C.localCandidate,j=C.remoteCandidate,m=u(u({},m),{rtt:D?.rtt!==-1?1e3*(D?.rtt||0):-1,cand_re_prot:j.protocol,cand_lo_prot:w.protocol,cand_re_addr:"".concat(j.ip||j.address,":").concat(j.port),cand_lo_addr:"".concat(w.ip||w.address,":").concat(w.port),abps:Math.floor(8*A.bytesReceivedPerSecond),ajb:Math.floor((0,l.getJitterBufferDelayAvg)(y?.jitterBufferDelay,y.jitterBufferEmittedCount)),aMsid:g.aMsid})),o.reporter.reportPullStats(m)})},_.prototype.incrementReconnectTimes=function(){this.pubReconnectTimes++},_.prototype.getPublishConfig=function(){return this.publishConfig},_}(t.default);R.Publisher=E},5788:function(L,R,x){var v,c=this&&this.__extends||(v=function(i,l){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(E,b){E.__proto__=b}||function(E,b){for(var _ in b)Object.prototype.hasOwnProperty.call(b,_)&&(E[_]=b[_])},v(i,l)},function(i,l){if(typeof l!="function"&&l!==null)throw new TypeError("Class extends value "+String(l)+" is not a constructor or null");function E(){this.constructor=i}v(i,l),i.prototype=l===null?Object.create(l):(E.prototype=l.prototype,new E)}),u=this&&this.__awaiter||function(i,l,E,b){return new(E||(E=Promise))(function(_,h){function o(T){try{m(b.next(T))}catch(C){h(C)}}function g(T){try{m(b.throw(T))}catch(C){h(C)}}function m(T){var C;T.done?_(T.value):(C=T.value,C instanceof E?C:new E(function(D){D(C)})).then(o,g)}m((b=b.apply(i,l||[])).next())})},S=this&&this.__generator||function(i,l){var E,b,_,h,o={label:0,sent:function(){if(1&_[0])throw _[1];return _[1]},trys:[],ops:[]};return h={next:g(0),throw:g(1),return:g(2)},typeof Symbol=="function"&&(h[Symbol.iterator]=function(){return this}),h;function g(m){return function(T){return function(C){if(E)throw new TypeError("Generator is already executing.");for(;h&&(h=0,C[0]&&(o=0)),o;)try{if(E=1,b&&(_=2&C[0]?b.return:C[0]?b.throw||((_=b.return)&&_.call(b),0):b.next)&&!(_=_.call(b,C[1])).done)return _;switch(b=0,_&&(C=[2&C[0],_.value]),C[0]){case 0:case 1:_=C;break;case 4:return o.label++,{value:C[1],done:!1};case 5:o.label++,b=C[1],C=[0];continue;case 7:C=o.ops.pop(),o.trys.pop();continue;default:if(_=o.trys,!((_=_.length>0&&_[_.length-1])||C[0]!==6&&C[0]!==2)){o=0;continue}if(C[0]===3&&(!_||C[1]>_[0]&&C[1]<_[3])){o.label=C[1];break}if(C[0]===6&&o.label<_[1]){o.label=_[1],_=C;break}if(_&&o.label<_[2]){o.label=_[2],o.ops.push(C);break}_[2]&&o.ops.pop(),o.trys.pop();continue}C=l.call(i,o)}catch(D){C=[6,D],b=0}finally{E=_=0}if(5&C[0])throw C[1];return{value:C[0]?C[1]:void 0,done:!0}}([m,T])}}},f=this&&this.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(R,"__esModule",{value:!0}),R.SignalChannel=void 0;var a=f(x(7028)),d=x(4865),p=f(x(102)),e=f(x(8219)),r=x(9428),n=x(5044),s=x(280),t=function(i){function l(E){var b=i.call(this)||this;return b.reporter=E.reporter,b}return c(l,i),Object.defineProperty(l.prototype,"isOpen",{get:function(){return this.readyState==="open"},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"readyState",{get:function(){var E,b;return((E=this.peerconnection)===null||E===void 0?void 0:E.isConnected)&&((b=this.datachannelCore)===null||b===void 0?void 0:b.readyState)},enumerable:!1,configurable:!0}),Object.defineProperty(l.prototype,"datachannelCore",{get:function(){var E,b,_;return(_=(b=(E=this.peerconnection)===null||E===void 0?void 0:E.getPeerCore())===null||b===void 0?void 0:b.getSignal())===null||_===void 0?void 0:_.getDatachannelCore()},enumerable:!1,configurable:!0}),l.prototype.getPeerConnection=function(){return this.peerconnection},l.prototype.setPeerConnection=function(E){this.peerconnection=E},l.prototype.createDatachannel=function(E){return u(this,void 0,void 0,function(){var b,_,h,o,g,m,T,C,D,y,A,w;return S(this,function(j){switch(j.label){case 0:if(b=E.signalUrl,!this.checkUrl(b))throw new n.RtsError(r.ErrorCode.ERROR_DATACHANNEL_PARAM,"url need artc://","");this.closeDatachannel(),this.createPC(),this.reporter.updateUrl(b),this.reporter.reportDatachannelHttpConnect(b),_=performance.now(),j.label=1;case 1:return j.trys.push([1,3,,4]),[4,(y=this.peerconnection)===null||y===void 0?void 0:y.createOffer(!1,!1,void 0,E)];case 2:return h=j.sent(),[3,4];case 3:return o=j.sent(),this.throwRtsError(new n.RtsError(o.errorCode||r.ErrorCode.ERROR_CREATEOFFER,o.message||"","")),[3,4];case 4:m="",j.label=5;case 5:return j.trys.push([5,7,,8]),[4,this.excuteSignal(h.desp)];case 6:return g=j.sent(),m=((A=g?.data)===null||A===void 0?void 0:A.trace_id)||"",this.reporter.reportDatachannelHttpConnectOk({url:b,hrct:Math.floor(performance.now()-_),tcid:m}),[3,8];case 7:return T=j.sent(),this.throwRtsError(new n.RtsError(T.errorCode||r.ErrorCode.ERROR_HTTPREQUEST_ERROR,T.message||"",m)),[3,8];case 8:return j.trys.push([8,10,,11]),[4,(w=this.peerconnection)===null||w===void 0?void 0:w.recvAnswer(g?.data,{answerSdpHook:E.answerSdpHook})];case 9:return j.sent(),[3,11];case 10:return C=j.sent(),this.throwRtsError(new n.RtsError(C.errorCode||r.ErrorCode.ERROR_ANSWER_ERROR,C.message||"set answer error",m)),[3,11];case 11:return j.trys.push([11,13,,14]),[4,this.waitForOpen()];case 12:return j.sent(),[3,14];case 13:return D=j.sent(),this.throwRtsError(new n.RtsError(r.ErrorCode.ERROR_DATACHANNEL_OPEN,"datachannel open failed: ".concat(D),m)),[3,14];case 14:return[2,m]}})})},l.prototype.waitForOpen=function(){var E,b=this;return new Promise(function(_,h){var o;E=window.setTimeout(function(){var m;(m=b.peerconnection)===null||m===void 0||m.off("datachannelStatusChange",g),E=void 0,h("timeout")},5e3);var g=function(m){E&&(clearTimeout(E),E=void 0),m.status===s.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?_(!0):h("status is ".concat(m.status))};(o=b.peerconnection)===null||o===void 0||o.once("datachannelStatusChange",g)})},l.prototype.excuteSignal=function(E){return u(this,void 0,void 0,function(){var b;return S(this,function(_){switch(_.label){case 0:return[4,e.default.post(this.signalUrl,{version:a.default.protocol_version,sdk_version:a.default.sdk_version,mode:"live",jsep:E})];case 1:if(((b=_.sent())==null?void 0:b.status)!==200)throw new n.RtsError(r.ErrorCode.ERROR_SIGNAL_ERROR,b?"response status:"+b.status:"response is null","");return[2,b]}})})},l.prototype.closeDatachannel=function(){var E;(E=this.peerconnection)===null||E===void 0||E.dispose()},l.prototype.checkUrl=function(E){var b="artc://";if(E&&E.indexOf(b)===0){var _=window.location.protocol,h=(["http:","https:"].indexOf(_)>-1?_:"https:")+"//";return this.signalUrl=E.replace(b,h),!0}},l.prototype.throwRtsError=function(E){throw this.emit("onError",E),E},l.prototype.createPC=function(){var E=this;this.peerconnection=new d.RtsPeerconnection,this.peerconnection.on("connectStatusChange",function(b){E.emit("connectStatusChange",b)})},l}(p.default);R.SignalChannel=t},2550:function(L,R,x){var v,c=this&&this.__extends||(v=function(_,h){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(o,g){o.__proto__=g}||function(o,g){for(var m in g)Object.prototype.hasOwnProperty.call(g,m)&&(o[m]=g[m])},v(_,h)},function(_,h){if(typeof h!="function"&&h!==null)throw new TypeError("Class extends value "+String(h)+" is not a constructor or null");function o(){this.constructor=_}v(_,h),_.prototype=h===null?Object.create(h):(o.prototype=h.prototype,new o)}),u=this&&this.__assign||function(){return u=Object.assign||function(_){for(var h,o=1,g=arguments.length;o<g;o++)for(var m in h=arguments[o])Object.prototype.hasOwnProperty.call(h,m)&&(_[m]=h[m]);return _},u.apply(this,arguments)},S=this&&this.__awaiter||function(_,h,o,g){return new(o||(o=Promise))(function(m,T){function C(A){try{y(g.next(A))}catch(w){T(w)}}function D(A){try{y(g.throw(A))}catch(w){T(w)}}function y(A){var w;A.done?m(A.value):(w=A.value,w instanceof o?w:new o(function(j){j(w)})).then(C,D)}y((g=g.apply(_,h||[])).next())})},f=this&&this.__generator||function(_,h){var o,g,m,T,C={label:0,sent:function(){if(1&m[0])throw m[1];return m[1]},trys:[],ops:[]};return T={next:D(0),throw:D(1),return:D(2)},typeof Symbol=="function"&&(T[Symbol.iterator]=function(){return this}),T;function D(y){return function(A){return function(w){if(o)throw new TypeError("Generator is already executing.");for(;T&&(T=0,w[0]&&(C=0)),C;)try{if(o=1,g&&(m=2&w[0]?g.return:w[0]?g.throw||((m=g.return)&&m.call(g),0):g.next)&&!(m=m.call(g,w[1])).done)return m;switch(g=0,m&&(w=[2&w[0],m.value]),w[0]){case 0:case 1:m=w;break;case 4:return C.label++,{value:w[1],done:!1};case 5:C.label++,g=w[1],w=[0];continue;case 7:w=C.ops.pop(),C.trys.pop();continue;default:if(m=C.trys,!((m=m.length>0&&m[m.length-1])||w[0]!==6&&w[0]!==2)){C=0;continue}if(w[0]===3&&(!m||w[1]>m[0]&&w[1]<m[3])){C.label=w[1];break}if(w[0]===6&&C.label<m[1]){C.label=m[1],m=w;break}if(m&&C.label<m[2]){C.label=m[2],C.ops.push(w);break}m[2]&&C.ops.pop(),C.trys.pop();continue}w=h.call(_,C)}catch(j){w=[6,j],g=0}finally{o=m=0}if(5&w[0])throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}([y,A])}}},a=this&&this.__rest||function(_,h){var o={};for(var g in _)Object.prototype.hasOwnProperty.call(_,g)&&h.indexOf(g)<0&&(o[g]=_[g]);if(_!=null&&typeof Object.getOwnPropertySymbols=="function"){var m=0;for(g=Object.getOwnPropertySymbols(_);m<g.length;m++)h.indexOf(g[m])<0&&Object.prototype.propertyIsEnumerable.call(_,g[m])&&(o[g[m]]=_[g[m]])}return o},d=this&&this.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(R,"__esModule",{value:!0}),R.LocalStream=void 0;var p=x(5805),e=x(3412),r=x(5044),n=x(9428),s=x(5259),t=x(233),i=d(x(335)),l=x(6295),E=x(2718),b=function(_){function h(){var o=_.call(this)||this;return o.screenSurfaceType="",o.VideoProfileMap=new Map(s.VideoProfileMap),o.ScreenProfileMap=new Map(s.ScreenProfileMap),o.AudioProfileMap=new Map(s.AudioProfileMap),o.deviceManager=new e.BrowserDeviceManager,o.mediastream=new MediaStream,o.hasVideo=!1,o.hasScreen=!1,o.videoProfile="360p_1",o.screenProfile="720p_1",o.audioProfile="standard",o.isCustomStream=!1,o.handleVideoTrackEnded=o.handleVideoTrackEnded.bind(o),o.handleAudioTrackEnded=o.handleAudioTrackEnded.bind(o),o}return c(h,_),Object.defineProperty(h.prototype,"mediaStream",{get:function(){return this.mediastream},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"audioTrack",{get:function(){return this.audiotrack},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"videoTrack",{get:function(){return this.videotrack},enumerable:!1,configurable:!0}),Object.defineProperty(h.prototype,"hasAudio",{get:function(){return!!this.audioTrack},enumerable:!1,configurable:!0}),h.prototype.getVideoProfile=function(){if(this.hasVideo)return this.videoProfile},h.prototype.getScreenProfile=function(){if(this.hasScreen)return this.screenProfile},h.prototype.getAudioProfile=function(){if(this.hasAudio)return this.audioProfile},h.prototype.init=function(o){return o.custom?this.createCustomStream(o.mediaStream):this.initWithRetry(o)},h.prototype.initWithRetry=function(o,g,m){var T=this;return new Promise(function(C,D){C=g||C,D=m||D;var y=[];y.push(T.initMicAudio(o)),o.video?y.push(T.initCameraVideo(o)):o.screen&&y.push(T.initScreenVideoAudio(o)),Promise.all(y).then(function(){T.tryMixMicAndScreenAudio(o),T.initTracks(o),o.skipProfile?C():T.tryToSetProfile(o).then(function(){C()}).catch(function(A){console.log(A),T.resetLocalStream(),T.initWithRetry(u(u({},o),{skipProfile:!0}),C,D)})}).catch(function(A){T.stopAllTracks(),D(A)})})},h.prototype.initMicAudio=function(o){var g=this;return new Promise(function(m,T){if(!o||!o.audio)return m();var C={};o.audio===!0?C.deviceId="":C=o.audio,g.deviceManager.getAudioTrack(C).then(function(D){g.micAudioTrack=D,g.audiotrack=D,m()}).catch(function(D){T(new r.RtsError(D.code,D.reason,"",D.relatedLink))})})},h.prototype.initCameraVideo=function(o){var g=this;return new Promise(function(m,T){if(!o||!o.video)return m();var C={};o.video===!0?C.deviceId="":C=o.video,g.deviceManager.getVideoTrack(C).then(function(D){g.videotrack=D,g.hasVideo=!0,m()}).catch(function(D){T(new r.RtsError(D.code,D.reason,"",D.relatedLink))})})},h.prototype.initScreenVideoAudio=function(o){var g=this;return new Promise(function(m,T){if(o.screen){var C=!0,D=!1,y={};if(typeof o.screen!="boolean"){var A=o.screen,w=A.video,j=A.audio;y=a(A,["video","audio"]),C=typeof w!="object"||w,typeof j!="boolean"&&typeof j!="object"||(D=j)}t.SystemUtil.isMacOS&&t.BrowserUtil.isSafari&&["16.1","16.2","16.3"].indexOf(t.BrowserUtil.browserVersion)>-1&&typeof C=="object"&&(typeof C.width=="number"&&(C.width={max:C.width}),typeof C.height=="number"&&(C.height={max:C.height})),g.deviceManager.getScreenStream(u({video:C,audio:D},y)).then(function(I){g.videotrack=I.getVideoTracks()[0],g.videotrack&&g.videotrack.getSettings&&(g.screenSurfaceType=g.videotrack.getSettings().displaySurface),g.hasScreen=!0;var H=I.getAudioTracks()[0];H&&(g.screenAudioTrack=H),m()}).catch(function(I){T(new r.RtsError(I.code,I.reason,"",I.relatedLink))})}})},h.prototype.tryMixMicAndScreenAudio=function(o){o.audio&&this.micAudioTrack&&this.hasScreenAudioConfig(o)&&this.screenAudioTrack?(this.audioMixer||(this.audioMixer=new i.default({useGainNode:!1,trackList:[]})),this.audioMixer.updateTrackList([this.screenAudioTrack,this.micAudioTrack]),this.audiotrack=this.audioMixer.getMixedAudioTrack()):o.audio&&this.micAudioTrack?this.audiotrack=this.micAudioTrack:this.hasScreenAudioConfig(o)&&this.screenAudioTrack&&(this.audiotrack=this.screenAudioTrack)},h.prototype.initTracks=function(o){this.hasAudioTrackReady(o)&&this.audiotrack&&this.mediastream.addTrack(this.audiotrack),this.hasVideoTrackReady(o)&&this.videotrack&&this.mediastream.addTrack(this.videotrack),this.addTrackListener()},h.prototype.tryToSetProfile=function(o){var g=this;return new Promise(function(m,T){return S(g,void 0,void 0,function(){var C;return f(this,function(D){switch(D.label){case 0:return D.trys.push([0,4,,5]),o.video?[4,this.setVideoProfile(this.videoProfile)]:[3,2];case 1:return D.sent(),[3,3];case 2:o.screen&&this.setScreenProfile(this.screenProfile).catch(function(y){console.log(y)}),D.label=3;case 3:return m(),[3,5];case 4:return C=D.sent(),T(new r.RtsError(n.ErrorCode.ERROR_DEIVCE_CONSTRAINEDERROR,"apply constraint failed","",{originErr:C,config:o})),[3,5];case 5:return[2]}})})})},h.prototype.stopAllTracks=function(){this.screenAudioTrack&&(this.screenAudioTrack.stop(),this.screenAudioTrack=void 0),this.micAudioTrack&&(this.micAudioTrack.stop(),this.micAudioTrack=void 0),this.audioTrack&&(this.audioTrack.stop(),this.audiotrack=void 0),this.videoTrack&&(this.videoTrack.stop(),this.videotrack=void 0)},h.prototype.resetLocalStream=function(){this.deviceManager=new e.BrowserDeviceManager,this.mediastream=new MediaStream,this.hasVideo=!1,this.hasScreen=!1,this.videoProfile="360p_1",this.screenProfile="720p_1",this.isCustomStream=!1,this.stopAllTracks(),this.audioMixer=void 0,this.screenSurfaceType=""},h.prototype.setEncodeParam=function(o,g){var m=this;this.pc=o;var T=!1,C=!1;g?g==="video"?T=!0:g==="audio"&&(C=!0):T=C=!0,o.getSenders().forEach(function(D){var y=D.track;!y||y.kind!=="video"&&y.kind!=="audio"||(y.kind==="video"&&T&&m.setVideoEncodeParams(D),y.kind==="audio"&&C&&m.setAudioEncodeParams(D))})},h.prototype.setVideoEncodeParams=function(o){var g,m,T;if(((g=o.track)===null||g===void 0?void 0:g.id)===((m=this.videoTrack)===null||m===void 0?void 0:m.id)&&(this.hasVideo?T=this.VideoProfileMap.get(this.videoProfile):this.hasScreen&&(T=this.ScreenProfileMap.get(this.screenProfile)),T&&o.setParameters&&o.getParameters)){var C=o.getParameters();C.degradationPreference="maintain-resolution",C.encodings.forEach(function(D){T?.maxBitrate&&(D.maxBitrate=1024*T.maxBitrate),T?.frameRate&&(D.maxFramerate=T.frameRate)}),o.setParameters(C)}},h.prototype.setAudioEncodeParams=function(o){var g,m;if(((g=o.track)===null||g===void 0?void 0:g.id)===((m=this.audioTrack)===null||m===void 0?void 0:m.id)){var T=this.AudioProfileMap.get(this.audioProfile);if(T&&o.setParameters&&o.getParameters){var C=o.getParameters();C.encodings.forEach(function(D){T.maxBitrate&&(D.maxBitrate=1024*T.maxBitrate)}),o.setParameters(C)}}},h.prototype.play=function(o,g){var m,T=this;if((m=this.reporter)===null||m===void 0||m.reportPlay(o?o.nodeName:String(o)),o&&(this.element=o,this.mediastream)){if(this.element.srcObject=this.mediastream,(t.SystemUtil.isIos&&t.SystemUtil.systemVersion.indexOf("15.1")===0&&(t.BrowserUtil.isSafari||t.BrowserUtil.isChrome||t.BrowserUtil.isMicroMessenger)||g?.canvasStream)&&this.hasVideo){if(this.canvasRenderer)return;this.canvasRenderer=new l.CanvasRenderer({video:this.element});var C=this;this.element.addEventListener("loadeddata",function D(){if(C.element&&(C.element.removeEventListener("loadeddata",D),C.canvasRenderer)){C.canvasRenderer.start();var y=C.canvasRenderer.mediaStream;y&&(C.mediastream=y,C.videotrack=y.getVideoTracks()[0])}}),this.element.addEventListener("resize",function(){var D;if(T){var y=T.element;y&&((D=T.canvasRenderer)===null||D===void 0||D.resize(y.videoWidth,y.videoHeight))}})}if(g&&g.autoplay===!1)return;this.element.play()}},h.prototype.setVideoProfile=function(o){var g=this;return new Promise(function(m,T){return S(g,void 0,void 0,function(){var C,D,y;return f(this,function(A){switch(A.label){case 0:if((y=this.reporter)===null||y===void 0||y.reportVideoProfile(o),!(C=this.VideoProfileMap.get(o)))return[3,5];if(this.isCustomStream||!this.hasVideo||!this.videotrack||!this.videotrack.applyConstraints)return[3,4];A.label=1;case 1:return A.trys.push([1,3,,4]),[4,this.videotrack.applyConstraints(C)];case 2:return A.sent(),[3,4];case 3:return D=A.sent(),[2,T(D)];case 4:return this.videoProfile=o,this.pc&&this.setEncodeParam(this.pc,"video"),m(this.videoProfile),[3,6];case 5:T("Profile not found"),A.label=6;case 6:return[2]}})})})},h.prototype.setScreenProfile=function(o){var g=this;return new Promise(function(m,T){return S(g,void 0,void 0,function(){var C,D,y;return f(this,function(A){switch(A.label){case 0:if((y=this.reporter)===null||y===void 0||y.reportScreenProfile(o),!(C=this.ScreenProfileMap.get(o)))return[3,5];if(!(this.hasScreen&&this.videotrack&&this.videotrack.applyConstraints))return[3,4];A.label=1;case 1:return A.trys.push([1,3,,4]),[4,this.videotrack.applyConstraints(C)];case 2:return A.sent(),[3,4];case 3:return D=A.sent(),[2,T(D)];case 4:return this.screenProfile=o,this.pc&&this.setEncodeParam(this.pc,"video"),m(this.screenProfile),[3,6];case 5:T("Profile not found"),A.label=6;case 6:return[2]}})})})},h.prototype.setAudioProfile=function(o){var g=this;return new Promise(function(m,T){return S(g,void 0,void 0,function(){var C,D,y;return f(this,function(A){switch(A.label){case 0:if((y=this.reporter)===null||y===void 0||y.reportAudioProfile(o),!(C=this.AudioProfileMap.get(o)))return[3,5];if(this.isCustomStream||!this.hasAudio||!this.audioTrack||!this.audioTrack.applyConstraints)return[3,4];A.label=1;case 1:return A.trys.push([1,3,,4]),[4,this.audioTrack.applyConstraints(C)];case 2:return A.sent(),[3,4];case 3:return D=A.sent(),[2,T(D)];case 4:return this.audioProfile=o,this.pc&&this.setEncodeParam(this.pc,"audio"),m(this.audioProfile),[3,6];case 5:T("Profile not found"),A.label=6;case 6:return[2]}})})})},h.prototype.enableAudio=function(){var o;return(o=this.reporter)===null||o===void 0||o.reportEnableAudio(),!!this.audiotrack&&(this.audiotrack.enabled=!0,!0)},h.prototype.disableAudio=function(){var o;return(o=this.reporter)===null||o===void 0||o.reportDisableAudio(),!!this.audiotrack&&(this.audiotrack.enabled=!1,!0)},h.prototype.enableVideo=function(){var o;return(o=this.reporter)===null||o===void 0||o.reportEnableVideo(),!!this.videotrack&&(this.videotrack.enabled=!0,!0)},h.prototype.disableVideo=function(){var o;return(o=this.reporter)===null||o===void 0||o.reportDisableVideo(),!!this.videotrack&&(this.videotrack.enabled=!1,!0)},h.prototype.stop=function(){var o;_.prototype.stop.call(this),this.hasVideo=!1,this.hasScreen=!1,this.isCustomStream=!1,this.canvasRenderer&&(this.canvasRenderer.stop(),this.canvasRenderer=void 0),this.audiotrack&&(this.audiotrack.stop(),this.audiotrack=void 0),this.videotrack&&(this.videotrack.stop(),this.videotrack=void 0),this.micAudioTrack&&(this.micAudioTrack.stop(),this.micAudioTrack=void 0),this.screenAudioTrack&&(this.screenAudioTrack.stop(),this.screenAudioTrack=void 0),(o=this.reporter)===null||o===void 0||o.reportStop(0)},h.prototype.mergeStream=function(o){var g=o.videoTrack,m=o.audioTrack;g&&(this.videoTrack&&(this.videoTrack.removeEventListener("ended",this.handleVideoTrackEnded),this.mediaStream.removeTrack(this.videoTrack)),this.mediaStream.addTrack(g),this.videotrack=g,this.listenVideoEnded(),this.hasVideo=o.hasVideo,this.hasScreen=o.hasScreen,this.isCustomStream=o.isCustomStream,this.hasVideo&&(this.videoProfile=o.videoProfile),this.hasScreen&&(this.screenProfile=o.screenProfile)),m&&(this.audioTrack&&(this.audioTrack.removeEventListener("ended",this.handleAudioTrackEnded),this.mediaStream.removeTrack(this.audioTrack)),this.mediaStream.addTrack(m),this.audiotrack=m,this.listenAudioEnded())},h.prototype.deleteTracks=function(o){o.audio&&this.audioTrack&&(this.mediaStream.removeTrack(this.audioTrack),this.audiotrack=void 0),o.video&&this.videoTrack&&(this.mediaStream.removeTrack(this.videoTrack),this.videotrack=void 0,this.hasScreen=!1,this.hasVideo=!1)},h.prototype.createCustomStream=function(o){var g=this;return new Promise(function(m,T){if(!o)return T(new r.RtsError(n.ErrorCode.ERROR_CUSTOMSTREAM_NONE,"MediaStream is required.",""));if(!(o instanceof MediaStream))return T(new r.RtsError(n.ErrorCode.ERROR_CUSTOMSTREAM_INVALID,"MediaStream is invalid.",""));if(o.getTracks().length===0)return T(new r.RtsError(n.ErrorCode.ERROR_CUSTOMSTREAM_TRACK_NONE,"MediaStream has no track.",""));var C=(0,E.getVideoTrack)(o),D=(0,E.getAudioTrack)(o);C&&(g.hasVideo=!0,g.videotrack=C,g.mediastream.addTrack(C)),D&&(g.audiotrack=D,g.mediastream.addTrack(D)),g.isCustomStream=!0,g.setVideoProfile(g.videoProfile),g.addTrackListener(),m()})},h.prototype.releaseMediaStream=function(){var o=this;this.mediastream.getTracks().forEach(function(g){g.stop(),o.mediastream.removeTrack(g)})},h.prototype.hasVideoTrackReady=function(o){return!(!o.video&&!o.screen||!this.videotrack)||!o.video&&!o.screen},h.prototype.hasScreenAudioConfig=function(o){return typeof o.screen=="object"&&o.screen.audio},h.prototype.hasAudioTrackReady=function(o){return!(o.audio&&(!this.hasMicAudioAndReady(o)&&!this.hasScreenAudioAndReady(o)||!this.audiotrack))},h.prototype.hasMicAudioAndReady=function(o){return o.audio&&this.micAudioTrack},h.prototype.hasScreenAudioAndReady=function(o){return this.hasScreenAudioConfig(o)&&this.screenAudioTrack},h.prototype.addTrackListener=function(){this.listenVideoEnded(),this.listenAudioEnded()},h.prototype.listenVideoEnded=function(){var o=this;this.videotrack&&this.videotrack.addEventListener("ended",this.handleVideoTrackEnded),this.micAudioTrack&&this.micAudioTrack.addEventListener("ended",function(){var g;o.emit("micAudioTrackEnded"),o.screenAudioTrack&&o.screenAudioTrack.readyState==="ended"&&((g=o.audioMixer)===null||g===void 0||g.destroy(),o.emit("audioTrackEnded"))}),this.screenAudioTrack&&this.screenAudioTrack.addEventListener("ended",function(){var g;o.emit("screenAudioTrackEnded"),o.micAudioTrack&&o.micAudioTrack.readyState==="ended"&&((g=o.audioMixer)===null||g===void 0||g.destroy(),o.emit("audioTrackEnded"))})},h.prototype.listenAudioEnded=function(){this.audiotrack&&this.audiotrack.addEventListener("ended",this.handleAudioTrackEnded)},h.prototype.handleVideoTrackEnded=function(){this.hasScreen=!1,this.hasVideo=!1,this.emit("videoTrackEnded")},h.prototype.handleAudioTrackEnded=function(){this.emit("audioTrackEnded")},h}(p.Stream);R.LocalStream=b},771:function(L,R,x){var v,c=this&&this.__extends||(v=function(p,e){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},v(p,e)},function(p,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=p}v(p,e),p.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)});Object.defineProperty(R,"__esModule",{value:!0}),R.RemoteStream=void 0;var u=x(5805),S=x(233),f=x(5044),a=x(9428),d=function(p){function e(){var r=p.call(this)||this;return r.recvCanPlay=!1,r.autoplay=!0,r.onCanPlay=r.onCanPlay.bind(r),r}return c(e,p),Object.defineProperty(e.prototype,"muted",{get:function(){return!!this.element&&this.element.muted},set:function(r){this.element&&(this.element.muted=r)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"audioTrack",{get:function(){var r;return(r=this.mediastream)===null||r===void 0?void 0:r.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"videoTrack",{get:function(){var r;return(r=this.mediastream)===null||r===void 0?void 0:r.getVideoTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasVideo",{get:function(){return!!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasAudio",{get:function(){return!!this.audioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"mediaStream",{get:function(){return this.mediastream},enumerable:!1,configurable:!0}),e.prototype.updateMediaStream=function(r){var n=this.mediastream||new MediaStream;r.getTracks().forEach(function(s){return n.addTrack(s)}),this.mediastream=n,this.element&&this.play(this.element)},e.prototype.getMediaStream=function(){return this.mediastream},e.prototype.mergeStream=function(r){if(this.mediaStream){var n=r.getVideoTracks()[0],s=r.getAudioTracks()[0];n&&(this.videoTrack&&this.mediaStream.removeTrack(this.videoTrack),this.mediaStream.addTrack(n),this.videotrack=n),s&&(this.audioTrack&&this.mediaStream.removeTrack(this.audioTrack),this.mediaStream.addTrack(s),this.audiotrack=s)}},e.prototype.play=function(r,n){if(this.autoplay=!!(!n||n.autoplay),r){if(!(r instanceof HTMLMediaElement))throw new f.RtsError(a.ErrorCode.ERROR_HTMLELEMENT_ERROR,"Param is not a HTMLMediaElement","",{element:r});this.recvCanPlay=!1,this.emit("mediaElementBinded"),this.element=r,this.element.addEventListener("canplay",this.onCanPlay);var s=this.mediaStream;this.element.addEventListener("playing",function t(){r.removeEventListener("playing",t),S.SystemUtil.isIos&&parseInt(S.SystemUtil.systemVersion)<=13&&!r.muted&&s?.getAudioTracks().length&&(r.pause(),r.play())}),this.element.nodeName==="VIDEO"&&(this.element.setAttribute("playsinline",""),S.BrowserUtil.isMicroMessenger&&(this.element.setAttribute("x5-video-player-type","h5-page"),this.element.setAttribute("x5-playsinline",""),S.SystemUtil.isAndroid||S.SystemUtil.isIos&&this.element.setAttribute("x-webkit-airplay","allow"))),this.autoplay&&S.BrowserUtil.isSafari&&this.element.setAttribute("autoplay",""),this.mediastream&&this.bindMediaStream(this.mediastream)}else this.release()},e.prototype.disableVideo=function(){var r=this.getMediaStream();r&&r.getVideoTracks().forEach(function(n){n.enabled&&(n.enabled=!1)})},e.prototype.enableVideo=function(){var r=this.getMediaStream();r&&r.getVideoTracks().forEach(function(n){n.enabled||(n.enabled=!0)})},e.prototype.disableAudio=function(){var r=this.getMediaStream();r&&r.getAudioTracks().forEach(function(n){n.enabled&&(n.enabled=!1)})},e.prototype.enableAudio=function(){var r=this.getMediaStream();r&&r.getAudioTracks().forEach(function(n){n.enabled||(n.enabled=!0)})},e.prototype.stop=function(){p.prototype.stop.call(this),this.release()},e.prototype.onCanPlay=function(){var r=this;if(!this.recvCanPlay&&(this.emit("onCanPlay"),this.recvCanPlay=!0,this.autoplay))if(this.element)if(S.BrowserUtil.isMicroMessenger){var n=window.top!==window.self,s=window.WeixinJSBridge||window.top.WeixinJSBridge;s?s.invoke("getNetworkType",{},function(){r.tryToPlay()}):(n?window.top.document:document).addEventListener("WeixinJSBridgeReady",function(){s.invoke("getNetworkType",{},function(){r.tryToPlay()})})}else this.tryToPlay();else this.tryToPlay()},e.prototype.release=function(){this.element&&(this.element.pause(),this.element.srcObject=null,this.element.load(),this.element.removeEventListener("canplay",this.onCanPlay)),this.recvCanPlay=!1,this.mediastream=void 0},e.prototype.bindMediaStream=function(r){this.element&&(this.element.nodeName==="AUDIO"&&r.getVideoTracks()[0]&&r.removeTrack(r.getVideoTracks()[0]),this.element.srcObject=r),this.mediastream=r},e.prototype.tryToPlay=function(){var r=this;if(this.element){var n=this.element.play();n!==void 0&&n.then(function(){}).catch(function(s){console.log("playPromise err",s),r.element&&r.element.srcObject&&r.emit("onAutoPlayError")})}},e}(u.Stream);R.RemoteStream=d},5805:function(L,R,x){var v,c=this&&this.__extends||(v=function(a,d){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(p,e){p.__proto__=e}||function(p,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(p[r]=e[r])},v(a,d)},function(a,d){if(typeof d!="function"&&d!==null)throw new TypeError("Class extends value "+String(d)+" is not a constructor or null");function p(){this.constructor=a}v(a,d),a.prototype=d===null?Object.create(d):(p.prototype=d.prototype,new p)}),u=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(R,"__esModule",{value:!0}),R.Stream=void 0;var S=x(233),f=function(a){function d(){var p=a.call(this)||this;return p.traceid="",p.id=S.Guid.create(32),p}return c(d,a),Object.defineProperty(d.prototype,"traceId",{get:function(){return this.traceid},set:function(p){this.traceid=p},enumerable:!1,configurable:!0}),Object.defineProperty(d.prototype,"mediaElement",{get:function(){return this.element},enumerable:!1,configurable:!0}),d.prototype.setReporter=function(p){this.reporter=p},d.prototype.play=function(p){},d.prototype.stop=function(){this.traceid="",this.reporter=void 0},d}(u(x(102)).default);R.Stream=f},5676:function(L,R,x){var v,c=this&&this.__extends||(v=function(m,T){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(C,D){C.__proto__=D}||function(C,D){for(var y in D)Object.prototype.hasOwnProperty.call(D,y)&&(C[y]=D[y])},v(m,T)},function(m,T){if(typeof T!="function"&&T!==null)throw new TypeError("Class extends value "+String(T)+" is not a constructor or null");function C(){this.constructor=m}v(m,T),m.prototype=T===null?Object.create(T):(C.prototype=T.prototype,new C)}),u=this&&this.__assign||function(){return u=Object.assign||function(m){for(var T,C=1,D=arguments.length;C<D;C++)for(var y in T=arguments[C])Object.prototype.hasOwnProperty.call(T,y)&&(m[y]=T[y]);return m},u.apply(this,arguments)},S=this&&this.__awaiter||function(m,T,C,D){return new(C||(C=Promise))(function(y,A){function w(H){try{I(D.next(H))}catch(F){A(F)}}function j(H){try{I(D.throw(H))}catch(F){A(F)}}function I(H){var F;H.done?y(H.value):(F=H.value,F instanceof C?F:new C(function(U){U(F)})).then(w,j)}I((D=D.apply(m,T||[])).next())})},f=this&&this.__generator||function(m,T){var C,D,y,A,w={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return A={next:j(0),throw:j(1),return:j(2)},typeof Symbol=="function"&&(A[Symbol.iterator]=function(){return this}),A;function j(I){return function(H){return function(F){if(C)throw new TypeError("Generator is already executing.");for(;A&&(A=0,F[0]&&(w=0)),w;)try{if(C=1,D&&(y=2&F[0]?D.return:F[0]?D.throw||((y=D.return)&&y.call(D),0):D.next)&&!(y=y.call(D,F[1])).done)return y;switch(D=0,y&&(F=[2&F[0],y.value]),F[0]){case 0:case 1:y=F;break;case 4:return w.label++,{value:F[1],done:!1};case 5:w.label++,D=F[1],F=[0];continue;case 7:F=w.ops.pop(),w.trys.pop();continue;default:if(y=w.trys,!((y=y.length>0&&y[y.length-1])||F[0]!==6&&F[0]!==2)){w=0;continue}if(F[0]===3&&(!y||F[1]>y[0]&&F[1]<y[3])){w.label=F[1];break}if(F[0]===6&&w.label<y[1]){w.label=y[1],y=F;break}if(y&&w.label<y[2]){w.label=y[2],w.ops.push(F);break}y[2]&&w.ops.pop(),w.trys.pop();continue}F=T.call(m,w)}catch(U){F=[6,U],D=0}finally{C=y=0}if(5&F[0])throw F[1];return{value:F[0]?F[1]:void 0,done:!0}}([I,H])}}},a=this&&this.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(R,"__esModule",{value:!0}),R.Subscriber=void 0;var d,p=x(4865),e=x(5917),r=x(9428),n=a(x(8219)),s=a(x(102)),t=x(5044),i=x(7989),l=x(492),E=a(x(2818)),b=a(x(7028)),_=x(6091),h=x(771),o=x(2718);(function(m){m[m.Init=0]="Init",m[m.Requesting=1]="Requesting",m[m.Playing=2]="Playing",m[m.Waiting=3]="Waiting"})(d||(d={}));var g=function(m){function T(C,D){var y=m.call(this)||this;return y.monitorStatsHistory=[],y.playTimeIndex=0,y.playCatonIndex=0,y.reportPubFlag=!1,y.state=d.Init,y.subscribeAudio=!0,y.subscribeVideo=!0,y.signalingUrl="",y.pullStreamUrl="",y.noParsePullStreamUrl="",y.subReconnectTimes=0,y.isConnecting=!1,y.reconnectTimerHandle=null,y.reporter=C,y.playTimer=0,y.config=D||{playTimeOut:5e3},y.remoteStream=new h.RemoteStream,y.remoteStream.on("onAutoPlayError",function(){y.emit("onError",new t.RtsError(r.ErrorCode.ERROR_AUTOPLAY_ERROR,"auto play failed",""))}),y.remoteStream.on("onCanPlay",function(){return S(y,void 0,void 0,function(){var A,w,j,I,H,F,U,B,k,V,G;return f(this,function(q){switch(q.label){case 0:return A=new Date().getTime(),[4,this.peerconnection.sample()];case 1:return q.sent(),w=-1,j=[],I=-1,this.monitorStatsHistory&&this.monitorStatsHistory.length&&(H=this.monitorStatsHistory[this.monitorStatsHistory.length-1],this.monitorStatsHistory.forEach(function(z){var $=z.rtt;$&&$>0&&j.push($)}),w=Number((j.reduce(function(z,$){return z+$},0)/j.length).toFixed(3)),I=H.packetsLost,this.monitorStatsHistory=null),this.stopPlayTimer(),this.peerconnection.playStart(),this.subReconnectTimes=0,F=this._cnend||A,this.reporter.reportFirstFrameTime(this.noParsePullStreamUrl,this.remoteStream.traceId,this._cpend-this._cpstart,this._hrend-this._cpend,A-this._cpstart,0,F-this._hrend,{rttAvg:w,packetsLost:I},-1,-1,-1,(B=this.subscribeConfig)===null||B===void 0?void 0:B.vMsid,(k=this.subscribeConfig)===null||k===void 0?void 0:k.aMsid),(U=new _.PlayEvent(_.PlayType.PLAY_CANPLAY)).data={url:this.noParsePullStreamUrl,vMsid:(V=this.subscribeConfig)===null||V===void 0?void 0:V.vMsid,aMsid:(G=this.subscribeConfig)===null||G===void 0?void 0:G.aMsid},this.emit("onPlayEvent",U),[2]}})})}),y.peerconnection=new p.RtsPeerconnection,y.peerconnection.on("onConnected",function(){y._cnend=new Date().getTime()}),y.peerconnection.on("streamEnded",function(A){var w=new _.PlayEvent(_.PlayType.PLAY_ENDED);w.data=u({},A),y.emit("onPlayEvent",w),y.emit("onError",new t.RtsError(r.ErrorCode.ERROR_STREAM_ENDED,"Stream Receiver Transport is Closed",y.remoteStream.traceId))}),y.peerconnection.on("onTrackEvent",function(A){A.streams&&A.streams.length&&(y.remoteStream.updateMediaStream(A.streams[0]),y.onTrackFunction&&y.onTrackFunction())}),y.peerconnection.on("connectStatusChange",function(A){A.status!==e.EConnectStatus.CONNECT_STATUS_DISCONNECTED&&A.status!==e.EConnectStatus.CONNECT_STATUS_RECONNECTING||!y.hasRetries()?y.emit("connectStatusChange",A):y.emit("onError",new t.RtsError(r.ErrorCode.ERROR_PC_DISCONNECTED,"PC disconnected",y.remoteStream.traceId))}),y.peerconnection.on("pcReconnect",function(A){var w,j;A.ips?(w="Migrate with ips: ".concat(JSON.stringify(A.ips)),j=r.ErrorCode.ERROR_IP_MIGRATE):(w="PC disconnected",j=r.ErrorCode.ERROR_PC_DISCONNECTED),y.emit("onError",new t.RtsError(j,w,"",{pcErrorInfo:A}))}),y.mediaObserver=new l.MediaObserver({handler:function(A,w,j){var I,H=new _.PlayEvent(_.PlayType.PLAY_TIMEOUT),F={url:A};w&&(F.vMsid=w),j&&(F.aMsid=j),H.data=F,y.emit("onPlayEvent",H);var U=new t.RtsError(r.ErrorCode.ERROR_INBOUND_TIMEOUT,"Media data timeout after ".concat((I=y.mediaObserver)===null||I===void 0?void 0:I.actTimeout," ms."),y.remoteStream.traceId);y.emit("onError",U)}}),y.peerconnection.on("onMonitorEvent",function(A){var w=A.eventList;if(A.type!=="pub"){if(w.length){for(var j=void 0,I=0;I<w.length;I++)if(w[I].url===(0,o.pruneSubUrl)(y.noParsePullStreamUrl,!0)){j=w[I];break}if(j){y.lastMeidaEventData=j;var H=j.video,F=j.audio;H&&y.monitorStatsHistory?y.monitorStatsHistory.push({rtt:H.transportStats.rtt,packetsLost:H.inboundRtpStats.packetsLost}):F&&y.monitorStatsHistory&&y.monitorStatsHistory.push({rtt:F.transportStats.rtt,packetsLost:F.inboundRtpStats.packetsLost}),d.Requesting===y.state?j.video?j.video.inboundRtpStatsPerSec.framesDecodedPerSecond>5&&(y.state=d.Playing):j.audio&&j.audio.inboundRtpStatsPerSec.bytesReceivedPerSecond>0&&(y.state=d.Playing):y.state!==d.Playing&&y.state!==d.Waiting||(++y.playTimeIndex,j.video&&(j.video.inboundRtpStatsPerSec.framesDecodedPerSecond<=5?(++y.playCatonIndex,d.Waiting!==y.state&&(y.state=d.Waiting,y.emit("onPlayEvent",new _.PlayEvent(_.PlayType.PLAY_WAITING)))):d.Waiting===y.state&&(y.state=d.Playing,y.emit("onPlayEvent",new _.PlayEvent(_.PlayType.PLAY_PLAYING)))),E.default.HEARTHEAT_INTERVAL===y.playTimeIndex&&(y.reportPubFlag=!0,w.forEach(function(B){y.doReportPullStats(B)}),y.playTimeIndex=0,y.playCatonIndex=0))}var U=new _.PlayEvent(_.PlayType.PLAY_MEDIA);U.data=[],w.forEach(function(B){var k={};k.url=B.url;var V=y.calcStreamPullStats(B);if(B.audio&&(k.audio={bytesReceivedPerSecond:B.audio.inboundRtpStatsPerSec.bytesReceivedPerSecond,rtt:B.audio.transportStats.rtt,lossRate:V.aloss},k.aMsid=B.aMsid),B.video){var G=B.video,q=G.inboundRtpStats,z=G.inboundRtpStatsPerSec,$=G.transportStats;k.video={bytesReceivedPerSecond:z.bytesReceivedPerSecond,fps:q.framesPerSecond||z.framesDecodedPerSecond,framesDecodedPerSecond:z.framesDecodedPerSecond,rtt:$.rtt,width:q.frameWidth,height:q.frameHeight,lossRate:V.vloss},k.vMsid=B.vMsid}k.networkQuality=V.net_qual||0,U.data.push(k)}),U.data&&U.data.length&&(U.data.forEach(function(B){var k;(k=y.mediaObserver)===null||k===void 0||k.check({audio:B.audio,video:B.video},B.url,B.vMsid,B.aMsid)}),U.data.length===1&&(U.data[0].audio||U.data[0].video)&&(U.data=u({},U.data[0])),y.emit("onPlayEvent",U))}}else y.reportPubFlag&&(y.handlePubMonitorEvent(w),y.reportPubFlag=!1)}),y.playTimer=0,y._cpstart=0,y._cpend=0,y._hrend=0,y._cnend=0,y.subscribeConfig={},y}return c(T,m),T.prototype.getPeerConnection=function(){return this.peerconnection},T.prototype.subscribe=function(C,D,y){var A=this;return new Promise(function(w,j){return S(A,void 0,void 0,function(){var I,H,F=this;return f(this,function(U){switch(U.label){case 0:return this.monitorStatsHistory=[],this.unsubscribe(),this.subscribeConfig=D||{},this.state=d.Requesting,this.noParsePullStreamUrl=C,this.parseUrl(C),(H=this.mediaObserver)===null||H===void 0||H.updateConfig({timeout:D?.mediaTimeout}),I=D?.signalUrl,this.signalingUrl=I||this.signalingUrl,this.checkPullUrl()?[3,1]:(j(new t.RtsError(r.ErrorCode.ERROR_PLAY_URL,"url need artc://","")),[3,8]);case 1:return this.subscribeAudio||this.subscribeVideo?[3,2]:(j(new t.RtsError(r.ErrorCode.ERROR_SUBSCRIBE_NOTHING,"subscribe nothing","")),[3,8]);case 2:if(this._cpstart=new Date().getTime(),!this.subscribeVideo||D?.isH264Checked)return[3,7];U.label=3;case 3:return U.trys.push([3,5,,6]),[4,new i.SupportUtil().loadH264(3)];case 4:return U.sent(),[3,6];case 5:return U.sent(),[3,6];case 6:U.label=7;case 7:this.peerconnection.createOffer(this.subscribeAudio,this.subscribeVideo,void 0,{offerSdpHook:D?.offerSdpHook,answerSdpHook:D?.answerSdpHook,encodedInsertableStreams:D?.encodedInsertableStreams,disableStereo:D?.disableStereo,disableHeartbeat:D?.disableHeartbeat}).then(function(B){var k=B.desp;F._cpend=new Date().getTime(),F.reporter.reportSubscribeStart(F.noParsePullStreamUrl,F.signalingUrl,D?.vMsid,D?.aMsid),F.excuteSignal(k,{innerTcpOnly:!!y?.innerTcpOnly}).then(function(V){var G;F.remoteStream.traceId=V,w(F.remoteStream);try{(G=F.peerconnection.getPeerCore())===null||G===void 0||G.patchSubscribeStreamManagerRecord(F.noParsePullStreamUrl,u(u({},F.subscribeConfig),{stream:F.remoteStream}))}catch(q){console.log(q)}F.peerconnection.getSubMonitor().updateTranceiversController()}).catch(function(V){F._hrend=new Date().getTime();var G=new t.RtsError(V.errorCode?V.errorCode:r.ErrorCode.ERROR_HTTPREQUEST_ERROR,V.message,V?V.traceid:"",{response:V.response,sdp:V.sdp});j(G)})}).catch(function(B){F._cpend=new Date().getTime();var k=new t.RtsError(r.ErrorCode.ERROR_CREATEOFFER,B.message,"");j(k)}),U.label=8;case 8:return[2]}})})})},T.prototype.unsubscribe=function(){var C;this.lastMeidaEventData&&this.doReportPullStats(this.lastMeidaEventData),this.stopPlayTimer(),this.peerconnection.dispose(),this.remoteStream.stop(),this.subscribeVideo=!0,this.subscribeAudio=!0,this.subscribeConfig={},this.state=d.Init,this.signalingUrl="",this.pullStreamUrl="",this.noParsePullStreamUrl="",this.onTrackFunction=void 0,this.playTimer=0,this._cpstart=0,this._cpend=0,this._hrend=0,this._cnend=0,this.monitorStatsHistory=[],(C=this.mediaObserver)===null||C===void 0||C.reset()},T.prototype.startLiveStream=function(C,D,y){var A=this;return console.error("\u6B64API\u53EF\u80FD\u5B58\u5728\u7A33\u5B9A\u6027\u95EE\u9898\uFF0C\u5E76\u5C06\u5728\u672A\u6765\u7684\u7248\u672C\u79FB\u9664\u3002\u8BF7\u4F7F\u7528subscribe\u66FF\u4EE3\uFF0C\u8BE6\u7EC6\u7528\u6CD5\u8BF7\u53C2\u8003\u5B98\u65B9\u6587\u6863\u3002"),new Promise(function(w,j){A.unsubscribe(),A.state=d.Requesting,A.noParsePullStreamUrl=C,A.parseUrl(C);var I=y?.signalUrl;A.signalingUrl=I||A.signalingUrl,A.pullStreamUrl===""?j(new t.RtsError(r.ErrorCode.ERROR_PLAY_URL,"url need artc://","")):A.subscribeAudio||A.subscribeVideo?!D||D.nodeName!=="AUDIO"&&D.nodeName!=="VIDEO"?j(new t.RtsError(r.ErrorCode.ERROR_HTMLELEMENT_ERROR,"need htmlaudioelement or htmlvideoelement","")):(A.subscribeAudio&&A.subscribeVideo?D.nodeName!=="VIDEO"&&A.emit("onError",new t.RtsError(r.ErrorCode.ERROR_HEMLELEMENT_NOTMATCH,"need htmlvideoelement","")):A.subscribeAudio?D.nodeName!=="AUDIO"&&A.emit("onError",new t.RtsError(r.ErrorCode.ERROR_HEMLELEMENT_NOTMATCH,"need htmlaudioelement","")):D.nodeName!=="VIDEO"&&A.emit("onError",new t.RtsError(r.ErrorCode.ERROR_HEMLELEMENT_NOTMATCH,"need htmlvieoelement","")),A._cpstart=new Date().getTime(),A.reporter.updateTid(),A.peerconnection.createOffer(A.subscribeAudio,A.subscribeVideo).then(function(H){var F=H.desp;A._cpend=new Date().getTime(),A.excuteSignal(F).then(function(U){A.remoteStream.traceId=U,A._hrend=new Date().getTime(),A.remoteStream.play(D),w(U)}).catch(function(U){A._hrend=new Date().getTime(),A.reporter.reportFirstFrameTime(A.noParsePullStreamUrl,U?U.traceid:"",A._cpend-A._cpstart,A._hrend-A._cpend,-1,-1,A._cnend-A._hrend),j(new t.RtsError(U.errorCode?U.errorCode:r.ErrorCode.ERROR_HTTPREQUEST_ERROR,U.message,""))})}).catch(function(H){A._cpend=new Date().getTime(),A.reporter.reportFirstFrameTime(A.noParsePullStreamUrl,H?H.traceid:"",A._cpend-A._cpstart,-1,-1,-1,A._cnend-A._hrend),j(new t.RtsError(r.ErrorCode.ERROR_CREATEOFFER,H.message,""))})):j(new t.RtsError(r.ErrorCode.ERROR_SUBSCRIBE_NOTHING,"subscribe nothing",""))})},T.prototype.stopLiveStream=function(){this.unsubscribe()},T.prototype.muteLiveStream=function(C){return this.remoteStream.muted=C,!0},T.prototype.excuteSignal=function(C,D){var y=this;return new Promise(function(A,w){var j,I,H,F,U={url:y.pullStreamUrl,amsid:((j=y.subscribeConfig)===null||j===void 0?void 0:j.aMsid)||["rts audio"],vmsid:((I=y.subscribeConfig)===null||I===void 0?void 0:I.vMsid)||["rts video"]};y.subscribeAudio||delete U.amsid,y.subscribeVideo||delete U.vmsid,n.default.post(y.signalingUrl,{version:((H=y.subscribeConfig)===null||H===void 0?void 0:H.signalVersion)||b.default.protocol_version,sdk_version:b.default.sdk_version,mode:((F=y.subscribeConfig)===null||F===void 0?void 0:F.signalMode)||"live",pull_streams:[U],jsep:C}).then(function(B){var k,V,G,q,z;if(B&&B.status===200){y._hrend=new Date().getTime();var $=(k=B.data)===null||k===void 0?void 0:k.trace_id;y.reporter.reportSubscribeOk({vurl:y.noParsePullStreamUrl,surl:y.signalingUrl,traceId:$,hrct:y._hrend-y._cpend,rslt:(V=B.data)===null||V===void 0?void 0:V.code});var re=typeof((G=y.subscribeConfig)===null||G===void 0?void 0:G.tcpOnly)=="boolean"?y.subscribeConfig.tcpOnly:D?.innerTcpOnly;y.peerconnection.recvAnswer(B.data,{answerSdpHook:(q=y.subscribeConfig)===null||q===void 0?void 0:q.answerSdpHook,tcpOnly:re}).then(function(){A($)}).catch(function(ee){ee.traceid=B.data?B.data.trace_id:"",w({errorCode:r.ErrorCode.ERROR_ANSWER_ERROR,message:ee.message?ee.message:"set answer error",traceid:ee.traceid,sdp:ee.sdp})})}else w({message:B?"response status:"+B.status:"response is null",traceid:(z=B?.data)===null||z===void 0?void 0:z.trace_id,sdp:C.sdp})}).catch(function(B){return S(y,void 0,void 0,function(){var k,V;return f(this,function(G){switch(G.label){case 0:if(![400,500].includes((V=B.response)===null||V===void 0?void 0:V.status))return[3,4];B.sdp=C.sdp,G.label=1;case 1:return G.trys.push([1,3,,4]),[4,new i.SupportUtil().isSupport({isReceiveVideo:!0})];case 2:return G.sent(),[3,4];case 3:return k=G.sent(),B.errorCode=k?.errorCode,B.message=k?.message,this.subReconnectTimes=1/0,[3,4];case 4:return w(B),[2]}})})})})},T.prototype.checkPullUrl=function(){return!!this.noParsePullStreamUrl&&this.noParsePullStreamUrl.indexOf("artc://")===0},T.prototype.parseUrl=function(C){if(C===void 0&&(C=""),C?.indexOf("artc://")===0){var D=C.indexOf("@");if(D>-1){var y=C.substring(D+1,C.length);this.pullStreamUrl=C.substring(0,D);for(var A=y.split("&"),w=0;w<A.length;++w)A[w]==="subaudio=no"&&(this.subscribeAudio=!1),A[w]==="subvideo=no"&&(this.subscribeVideo=!1)}else this.pullStreamUrl=C;var j=window.location.protocol,I=(["http:","https:"].indexOf(j)>-1?j:"https:")+"//";this.signalingUrl=this.pullStreamUrl.replace("artc://",I)}},T.prototype.stopPlayTimer=function(){this.playTimer&&clearTimeout(this.playTimer),this.playTimer=0},T.prototype.calcStreamPullStats=function(C){var D={},y=C.video,A=C.audio;if(y){var w=y.transportStats,j=y.inboundRtpStats,I=y.inboundRtpStatsPerSec,H=y.localCandidate,F=y.remoteCandidate;D=u(u({},D),{rtt:w?.rtt!==-1?1e3*(w?.rtt||0):-1,cand_re_prot:F.protocol,cand_lo_prot:H.protocol,cand_re_addr:"".concat(F.ip||F.address,":").concat(F.port),cand_lo_addr:"".concat(H.ip||H.address,":").concat(H.port),w:j?.frameWidth,h:j?.frameHeight,vbps:Math.floor(8*I.bytesReceivedPerSecond),fps:j?.framesPerSecond,dfps:Math.floor(I?.framesDecodedPerSecond),vjb:Math.floor((0,o.getJitterBufferDelayAvg)(j?.jitterBufferDelay,j?.jitterBufferEmittedCount)),vMsid:C.vMsid,vloss:I.packetsLostRate})}return A&&(w=A.transportStats,j=A.inboundRtpStats,I=A.inboundRtpStatsPerSec,H=A.localCandidate,F=A.remoteCandidate,D=u(u({},D),{rtt:w?.rtt!==-1?1e3*(w?.rtt||0):-1,cand_re_prot:F.protocol,cand_lo_prot:H.protocol,cand_re_addr:"".concat(F.ip||F.address,":").concat(F.port),cand_lo_addr:"".concat(H.ip||H.address,":").concat(H.port),abps:Math.floor(8*I.bytesReceivedPerSecond),ajb:Math.floor((0,o.getJitterBufferDelayAvg)(j?.jitterBufferDelay,j.jitterBufferEmittedCount)),aMsid:C.aMsid,aloss:I.packetsLostRate})),D=u(u({},D),{net_qual:(0,o.evaluateNetworkCondition)(D.rtt,D.aloss,D.vloss,D.ajb,D.vjb)})},T.prototype.doReportPullStats=function(C){var D=this.calcStreamPullStats(C),y={ct:1e3*this.playCatonIndex,tt:1e3*this.playTimeIndex,url:C.url};y.tt&&(y=u(u({},y),D),this.reporter.reportPullStats(y),this.lastMeidaEventData=void 0)},T.prototype.retrySubscribe=function(C,D){return S(this,void 0,void 0,function(){var y,A,w,j,I,H,F;return f(this,function(U){switch(U.label){case 0:if(C.extraInfo=u(u({},C.extraInfo),{retryTimes:this.subReconnectTimes}),!this.hasRetries())return[2,!1];if(typeof((y=this.subscribeConfig)==null?void 0:y.beforeRetry)!="function")return[3,4];U.label=1;case 1:return U.trys.push([1,3,,4]),[4,y.beforeRetry({url:this.noParsePullStreamUrl,vMsid:y.vMsid,aMsid:y.aMsid,useTcp:D?.innerTcpOnly})];case 2:return(A=U.sent())?(w=A.url,j=A.vMsid,I=A.aMsid,H=A.useTcp,this.reporter.reportReconnectParams("sub",w,j,I,H),this.noParsePullStreamUrl=w,this.subscribeConfig.vMsid=j,this.subscribeConfig.aMsid=I,typeof H=="boolean"&&(D=u(u({},D),{innerTcpOnly:H})),console.log(`retry with:
151
+ [URL] `.concat(w,`
152
152
  [VMSID]`).concat(j," [AMSID]").concat(I,`
153
- [PROTOCOL] `).concat(H?"TCP":"UDP"))):(this.reporter.reportReconnectParams("sub"),this.subReconnectTimes=1/0),[3,4];case 3:return F=U.sent(),console.error("Error in beforeRetry",F),[3,4];case 4:return this.hasRetries()?(this.emit("connectStatusChange",{status:e.EConnectStatus.CONNECT_STATUS_RECONNECTING}),this.incrementReconnectTimes(),C.extraInfo.retryTimes=this.subReconnectTimes,C.extraInfo.tcpOnly=D?.innerTcpOnly,this.subscribeWithReconnect(this.noParsePullStreamUrl,u({innerTcpOnly:D?.innerTcpOnly},this.subscribeConfig)).catch(function(B){}),[2,!0]):(C.extraInfo.retryTimes=this.subReconnectTimes,[2,!1])}})})},T.prototype.subscribeWithReconnect=function(C,D,y,A){var O=this;return new Promise(function(j,I){j=y||j,I=A||I,O.isConnecting=!0;var H=(D||{}).innerTcpOnly;D==null||delete D.innerTcpOnly,O.subscribe(C,D,{innerTcpOnly:H}).then(function(F){O.isConnecting=!1,j(F)}).catch(function(F){var U;if(!O.isConnecting)return I(F);if(!r.RECONNECT_ERROR_EXCLUDE_LIST.includes(F.errorCode)&&O.hasRetries(!0)){var B=((U=O.subscribeConfig)===null||U===void 0?void 0:U.retryInterval)||e.DEFAULT_RETRY_SUBSCRIBE_INTERVAL;O.reconnectTimerHandle=setTimeout(function(){F.extraInfo=u(u({},F.extraInfo),{retryTimes:O.subReconnectTimes}),O.emit("reconnect",F),O.subscribeWithReconnect(C,D,j,I)},B)}else I(F),F.extraInfo=u(u({},F.extraInfo),{retryTimes:O.subReconnectTimes}),O.isConnecting=!1,O.emit("onError",F)})})},T.prototype.hasRetries=function(C){var D,y,A=e.DEFAULT_RETRY_SUBSCRIBE_LIMIT;typeof((D=this.subscribeConfig)===null||D===void 0?void 0:D.retryTimes)=="number"&&(A=Math.floor((y=this.subscribeConfig)===null||y===void 0?void 0:y.retryTimes));var O=this.subReconnectTimes<A;return C&&O&&this.incrementReconnectTimes(),O},T.prototype.resetResubscribeStatus=function(){this.subReconnectTimes=0,this.isConnecting=!1,this.reporter.updateTid(),this.reconnectTimerHandle!==null&&(clearTimeout(this.reconnectTimerHandle),this.reconnectTimerHandle=null)},T.prototype.handlePubMonitorEvent=function(C){var D=this;C.forEach(function(y){D.reporter.reportPushStats(y)})},T.prototype.incrementReconnectTimes=function(){this.subReconnectTimes++},T.prototype.getSubscribeConfig=function(){return this.subscribeConfig},T}(s.default);R.Subscriber=g},6901:function(L,R,x){var v,c=this&&this.__extends||(v=function(f,a){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,p){d.__proto__=p}||function(d,p){for(var e in p)Object.prototype.hasOwnProperty.call(p,e)&&(d[e]=p[e])},v(f,a)},function(f,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function d(){this.constructor=f}v(f,a),f.prototype=a===null?Object.create(a):(d.prototype=a.prototype,new d)});Object.defineProperty(R,"__esModule",{value:!0}),R.AudioReceiverMonitorData=void 0;var u=x(1353),S=function(f){function a(){return f.call(this,u.ReceiverMonitorType.AUDIO)||this}return c(a,f),a}(u.ReceiverMonitorData);R.AudioReceiverMonitorData=S},1353:function(L,R,x){var v,c=this&&this.__extends||(v=function(e,r){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&(n[t]=s[t])},v(e,r)},function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}v(e,r),e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}),u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R,"__esModule",{value:!0}),R.ReceiverMonitorData=R.ReceiverMonitorType=void 0;var S,f=x(233),a=u(x(102)),d=x(2688);(function(e){e.AUDIO="audio",e.VIDEO="video"})(S||(R.ReceiverMonitorType=S={}));var p=function(e){function r(n){var s=e.call(this)||this;return s.streamEnded=!1,s.currentTimeGap=0,s.lastTimeStamp=0,s.transportStats={},s.remoteCandidate={},s.localCandidate={},s.inboundRtpStreamStats={},s.inboundRtpStreamStatsDiff={},s.receiver=null,s.pc=null,s.canplay=!1,s.type=n,s}return c(r,e),Object.defineProperty(r.prototype,"rtpReceiver",{set:function(n){this.receiver=n},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RTCPeerconnection",{set:function(n){this.pc=n},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isExist",{get:function(){return this.receiver!=null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isPlaying",{get:function(){return this.canplay},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isStreamEnded",{get:function(){return this.streamEnded},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"monitorData",{get:function(){var n=this.inboundRtpStreamStatsDiff||{},s=(this.inboundRtpStreamStats,this.currentTimeGap),t=0;return n.nackCount!==void 0&&n.packetsReceived!==void 0&&(t=Math.round(n.nackCount/(n.packetsReceived+n.nackCount)*1e3)/1e3),{inboundRtpStats:this.inboundRtpStreamStats,inboundRtpStatsPerSec:{bytesReceivedPerSecond:n.bytesReceived/s||0,framesDecodedPerSecond:n.framesDecoded/s||0,packetsLostRate:t>0?t:0},transportStats:this.transportStats,remoteCandidate:this.remoteCandidate,localCandidate:this.localCandidate}},enumerable:!1,configurable:!0}),r.prototype.getInfo=function(){var n=this;if(this.receiver&&this.receiver.transport&&this.receiver.transport.state==="closed"&&this.canplay&&(this.streamEnded=!0,this.emit("streamEnded"),this.canplay=!1),this.receiver&&"getStats"in this.receiver||this.pc&&"getStats"in this.pc)return new Promise(function(s,t){var i=null,l=!1;n.receiver&&"getStats"in n.receiver?i=n.receiver.getStats():n.pc&&"getStats"in n.pc&&(i=n.pc.getStats(),l=!0),i?.then(function(E){E.forEach(function(b){var _,h;if(b)switch(b.type){case d.RTCStatsType.CandidatePair:n.onCandidatePair(b);break;case d.RTCStatsType.InboundRtp:f.SystemUtil.isIos&&l?!((_=b.id)===null||_===void 0)&&_.toLowerCase().includes(n.type)&&n.onInBoundRtp(b):f.BrowserUtil.isFirefox?b.kind===n.type&&n.onInBoundRtp(b):n.onInBoundRtp(b);break;case d.RTCStatsType.RemoteCandidate:n.onRemoteCandidate(b);break;case d.RTCStatsType.LocalCandidate:n.onLocalCandidate(b);break;case d.RTCStatsType.Track:if(n.type!==S.VIDEO)break;f.SystemUtil.isIos&&l?(!((h=b.id)===null||h===void 0)&&h.toLowerCase().includes(n.type)||b.trackIdentifier.toLowerCase()===n.type)&&n.onTrack(b):n.onTrack(b)}}),s("")}).catch(function(E){t(E)})})},r.prototype.dispose=function(){this.reset()},r.prototype.onCandidatePair=function(n){(n.state==="succeeded"||n.bytesReceived)&&(this.transportStats={timestamp:Math.floor(n.timestamp),rtt:n.currentRoundTripTime||-1,bytesReceived:n.bytesReceived,bytesSent:n.bytesSent})},r.prototype.onInBoundRtp=function(n){this.currentTimeGap=(n.timestamp-this.lastTimeStamp)/1e3,this.lastTimeStamp=n.timestamp,this.inboundRtpStreamStatsDiff=this.calcDiff(n,this.inboundRtpStreamStats,["bytesReceived","framesDecoded","packetsReceived","nackCount"]),this.inboundRtpStreamStats=n,!this.canplay&&Number(n.bytesReceived)>0&&(this.canplay=!0,this.emit("canPlay"))},r.prototype.calcDiff=function(n,s,t){var i={};return t.forEach(function(l){i[l]=Number(n[l]||0)-Number(s[l]||0)}),i},r.prototype.onRemoteCandidate=function(n){this.remoteCandidate=n||{}},r.prototype.onLocalCandidate=function(n){this.localCandidate=n||{}},r.prototype.onTrack=function(n){n.frameWidth&&(this.inboundRtpStreamStats.frameWidth=n.frameWidth,this.inboundRtpStreamStats.frameHeight=n.frameHeight)},r.prototype.reset=function(){this.currentTimeGap=0,this.lastTimeStamp=0,this.transportStats={},this.remoteCandidate={},this.localCandidate={},this.inboundRtpStreamStats={},this.inboundRtpStreamStatsDiff={},this.receiver=null,this.canplay=!1,this.streamEnded=!1},r}(a.default);R.ReceiverMonitorData=p},5250:function(L,R,x){var v,c=this&&this.__extends||(v=function(f,a){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,p){d.__proto__=p}||function(d,p){for(var e in p)Object.prototype.hasOwnProperty.call(p,e)&&(d[e]=p[e])},v(f,a)},function(f,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function d(){this.constructor=f}v(f,a),f.prototype=a===null?Object.create(a):(d.prototype=a.prototype,new d)});Object.defineProperty(R,"__esModule",{value:!0}),R.VideoReceiverMonitorData=void 0;var u=x(1353),S=function(f){function a(){return f.call(this,u.ReceiverMonitorType.VIDEO)||this}return c(a,f),a}(u.ReceiverMonitorData);R.VideoReceiverMonitorData=S},2688:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.RTCStatsType=void 0;var x=function(){function v(){}return v.CandidatePair="candidate-pair",v.Certificate="certificate",v.Codec="codec",v.Csrc="csrc",v.DataCahnnel="data-channel",v.InboundRtp="inbound-rtp",v.LocalCandidate="local-candidate",v.OutboundRtp="outbound-rtp",v.PeerConnection="peer-connection",v.Receiver="receiver",v.RemoteCandidate="remote-candidate",v.RemoteInboundRtp="remote-inbound-rtp",v.RemoteOutboundRtp="remote-outbound-rtp",v.Sender="sender",v.Stream="stream",v.Track="track",v.Transport="transport",v.MediaSource="media-source",v}();R.RTCStatsType=x},5657:(L,R,x)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.SenderMonitorData=void 0;var v=x(2688),c=function(){function u(){this._audiosender=null,this._videosender=null,this.timeStamp=0,this.curTimeStamp=0,this.audioBytesSent=0,this.curAudioBytesSent=0,this.videoBytesSent=0,this.curVideoBytesSent=0,this.audioRetransmittedBytesSent=0,this.curAudioRetransmittedBytesSent=0,this.videoRetransmiitedBytesSent=0,this.curVideoRetransmiitedBytesSent=0,this.framesSent=0,this.curFramesSent=0,this.framesEncoded=0,this.curFramesEncoded=0,this.rtt=0,this.localProtocol="",this.remoteProtocol="",this.localTransportAddr="",this.remoteTransportAddr="",this.frameHeight=0,this.frameWidth=0,this.efps=0,this.sfps=0,this.timeGap=0,this.abps=0,this.vbps=0,this.rt_abps=0,this.rt_vbps=0,this.stashedData={}}return Object.defineProperty(u.prototype,"videoSender",{set:function(S){this._videosender=S},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"audioSender",{set:function(S){this._audiosender=S},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"monitorData",{get:function(){return this.doCalc(),{tt:parseFloat(this.timeGap.toFixed(0)),rtt:this.rtt,cand_re_prot:this.remoteProtocol,cand_lo_prot:this.localProtocol,cand_re_addr:this.remoteTransportAddr,cand_lo_addr:this.localTransportAddr,w:this.frameWidth,h:this.frameHeight,efps:parseFloat(this.efps.toFixed(0)),fps:parseFloat(this.sfps.toFixed(0)),abps:parseFloat(this.abps.toFixed(0)),vbps:parseFloat(this.vbps.toFixed(0)),rt_abps:parseFloat(this.rt_abps.toFixed(0)),rt_vbps:parseFloat(this.rt_vbps.toFixed(0))}},enumerable:!1,configurable:!0}),u.prototype.doCalc=function(){this.timeStamp!==0&&(this.timeGap=this.curTimeStamp-this.timeStamp,this.timeGap>0&&(this.efps=1e3*(this.curFramesEncoded-this.framesEncoded)/this.timeGap,this.sfps=1e3*(this.curFramesSent-this.framesSent)/this.timeGap,this.abps=1e3*(this.curAudioBytesSent-this.audioBytesSent)/this.timeGap,this.vbps=1e3*(this.curVideoBytesSent-this.videoBytesSent)/this.timeGap,this.rt_abps=1e3*(this.curAudioRetransmittedBytesSent-this.audioRetransmittedBytesSent)/this.timeGap,this.rt_vbps=1e3*(this.curVideoRetransmiitedBytesSent-this.videoRetransmiitedBytesSent)/this.timeGap)),this.timeStamp=this.curTimeStamp,this.audioBytesSent=this.curAudioBytesSent,this.videoBytesSent=this.curVideoBytesSent,this.audioRetransmittedBytesSent=this.curAudioRetransmittedBytesSent,this.videoRetransmiitedBytesSent=this.curVideoRetransmiitedBytesSent,this.framesSent=this.curFramesSent,this.framesEncoded=this.curFramesEncoded},u.prototype.getInfo=function(){var S=this,f=new Promise(function(d,p){S._videosender&&S._videosender.getStats?S._videosender.getStats().then(function(e){e.forEach(function(r){if(r)switch(r.type){case v.RTCStatsType.CandidatePair:S.onCandidatePair(r);break;case v.RTCStatsType.OutboundRtp:S.onOutBoundRtp(r,"video");break;case v.RTCStatsType.RemoteCandidate:S.onRemoteCandidate(r);break;case v.RTCStatsType.LocalCandidate:S.onLocalCandidate(r)}}),d()}).catch(function(e){p(e)}):p("no video sender")}),a=new Promise(function(d,p){S._audiosender&&S._audiosender.getStats?S._audiosender.getStats().then(function(e){e.forEach(function(r){if(r)switch(r.type){case v.RTCStatsType.CandidatePair:S.onCandidatePair(r);break;case v.RTCStatsType.OutboundRtp:S.onOutBoundRtp(r,"audio");break;case v.RTCStatsType.RemoteCandidate:S.onRemoteCandidate(r);break;case v.RTCStatsType.LocalCandidate:S.onLocalCandidate(r)}}),d()}).catch(function(e){p(e)}):p("no audio sender")});return Promise.all([f,a])},u.prototype.onCandidatePair=function(S){this.curTimeStamp=S.timestamp,this.rtt=S.currentRoundTripTime},u.prototype.onOutBoundRtp=function(S,f){this.curTimeStamp=S.timestamp,f==="video"?(this.curVideoBytesSent=S.bytesSent,this.curVideoRetransmiitedBytesSent=S.retransmittedBytesSent,this.curFramesEncoded=S.framesEncoded,this.curFramesSent=S.framesSent,this.frameWidth=S.frameWidth,this.frameHeight=S.frameHeight):f==="audio"&&(this.curAudioBytesSent=S.bytesSent,this.curAudioRetransmittedBytesSent=S.retransmittedBytesSent)},u.prototype.onRemoteCandidate=function(S){this.curTimeStamp=S.timestamp,this.remoteProtocol=S.protocol,this.remoteTransportAddr=(S.ip||S.address)+(S.port?":"+S.port.toFixed(0):"")},u.prototype.onLocalCandidate=function(S){this.curTimeStamp=S.timestamp,this.localProtocol=S.protocol,this.localTransportAddr=(S.ip||S.address)+(S.port?":"+S.port.toFixed(0):"")},u}();R.SenderMonitorData=c},9752:function(L,R,x){var v,c=this&&this.__extends||(v=function(e,r){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&(n[t]=s[t])},v(e,r)},function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}v(e,r),e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}),u=this&&this.__assign||function(){return u=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++)for(var t in r=arguments[n])Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e},u.apply(this,arguments)},S=this&&this.__spreadArray||function(e,r,n){if(n||arguments.length===2)for(var s,t=0,i=r.length;t<i;t++)!s&&t in r||(s||(s=Array.prototype.slice.call(r,0,t)),s[t]=r[t]);return e.concat(s||Array.prototype.slice.call(r))},f=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R,"__esModule",{value:!0}),R.PubMonitor=void 0;var a=f(x(102)),d=x(5657),p=function(e){function r(){var n=e.call(this)||this;return n.heartbeatHandle=null,n.pc=null,n.pcCore=null,n.senderMonitorDataList=[],n}return c(r,e),r.prototype.startHeartbeat=function(n,s,t){var i=this;this.pc=n,this.pcCore=s,this.updateSenders(),this.stopHeartbeat(),this.heartbeatHandle=setInterval(function(){i.emitHeartBeat()},t||1e3)},r.prototype.stopHeartbeat=function(){this.heartbeatHandle!==null&&clearInterval(this.heartbeatHandle),this.heartbeatHandle=null},r.prototype.addTrackPair=function(n,s,t,i,l){var E=this;if(n){var b=new d.SenderMonitorData;if(s){b.videoSender=s;var _=s.transport;_&&(_.onstatechange=function(){var o,g,m,T;E.emit("onTransportStateEvent",{url:n,type:"pub",kind:"video",state:_.state,protocol:(T=(m=(g=(o=_.iceTransport)===null||o===void 0?void 0:o.getSelectedCandidatePair)===null||g===void 0?void 0:g.call(o))===null||m===void 0?void 0:m.local)===null||T===void 0?void 0:T.protocol})})}if(t){b.audioSender=t;var h=t.transport;h&&(h.onstatechange=function(){var o,g,m,T;E.emit("onTransportStateEvent",{url:n,type:"pub",kind:"audio",state:h.state,protocol:(T=(m=(g=(o=h.iceTransport)===null||o===void 0?void 0:o.getSelectedCandidatePair)===null||g===void 0?void 0:g.call(o))===null||m===void 0?void 0:m.local)===null||T===void 0?void 0:T.protocol})})}this.senderMonitorDataList.push({url:n,vMsid:i,aMsid:l,senderData:b})}},r.prototype.updateSenders=function(){var n,s=this,t=(n=this.pcCore)===null||n===void 0?void 0:n.getStreamManager().getAllTrackPairList("pub");this.senderMonitorDataList=[],t?.forEach(function(i){s.addTrackPair(i.url,i.vTransceiver,i.aTransceiver,i.vMsid,i.aMsid)})},r.prototype.emitHeartBeat=function(){var n=this;Promise.all(this.senderMonitorDataList.reduce(function(s,t){return S(S([],s,!0),[t.senderData.getInfo()],!1)},[])).then(function(){}).catch(function(s){}).finally(function(){var s=n.senderMonitorDataList.map(function(t){return u(u({},t.senderData.monitorData),{url:t.url,vMsid:t.vMsid,aMsid:t.aMsid})});n.emit("onMonitorEvent",{eventList:s,type:"pub"})})},r}(a.default);R.PubMonitor=p},4699:function(L,R,x){var v,c=this&&this.__extends||(v=function(s,t){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,l){i.__proto__=l}||function(i,l){for(var E in l)Object.prototype.hasOwnProperty.call(l,E)&&(i[E]=l[E])},v(s,t)},function(s,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=s}v(s,t),s.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}),u=this&&this.__awaiter||function(s,t,i,l){return new(i||(i=Promise))(function(E,b){function _(g){try{o(l.next(g))}catch(m){b(m)}}function h(g){try{o(l.throw(g))}catch(m){b(m)}}function o(g){var m;g.done?E(g.value):(m=g.value,m instanceof i?m:new i(function(T){T(m)})).then(_,h)}o((l=l.apply(s,t||[])).next())})},S=this&&this.__generator||function(s,t){var i,l,E,b,_={label:0,sent:function(){if(1&E[0])throw E[1];return E[1]},trys:[],ops:[]};return b={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(b[Symbol.iterator]=function(){return this}),b;function h(o){return function(g){return function(m){if(i)throw new TypeError("Generator is already executing.");for(;b&&(b=0,m[0]&&(_=0)),_;)try{if(i=1,l&&(E=2&m[0]?l.return:m[0]?l.throw||((E=l.return)&&E.call(l),0):l.next)&&!(E=E.call(l,m[1])).done)return E;switch(l=0,E&&(m=[2&m[0],E.value]),m[0]){case 0:case 1:E=m;break;case 4:return _.label++,{value:m[1],done:!1};case 5:_.label++,l=m[1],m=[0];continue;case 7:m=_.ops.pop(),_.trys.pop();continue;default:if(E=_.trys,!((E=E.length>0&&E[E.length-1])||m[0]!==6&&m[0]!==2)){_=0;continue}if(m[0]===3&&(!E||m[1]>E[0]&&m[1]<E[3])){_.label=m[1];break}if(m[0]===6&&_.label<E[1]){_.label=E[1],E=m;break}if(E&&_.label<E[2]){_.label=E[2],_.ops.push(m);break}E[2]&&_.ops.pop(),_.trys.pop();continue}m=t.call(s,_)}catch(T){m=[6,T],l=0}finally{i=E=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([o,g])}}},f=this&&this.__spreadArray||function(s,t,i){if(i||arguments.length===2)for(var l,E=0,b=t.length;E<b;E++)!l&&E in t||(l||(l=Array.prototype.slice.call(t,0,E)),l[E]=t[E]);return s.concat(l||Array.prototype.slice.call(t))},a=this&&this.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(R,"__esModule",{value:!0}),R.SubMonitor=void 0;var d=x(6901),p=x(5250),e=a(x(102)),r=function(){function s(){this.trackPairDataList=[]}return s.prototype.reset=function(){this.trackPairDataList=[]},s.prototype.addTrackPair=function(t,i,l,E,b,_){var h=new d.AudioReceiverMonitorData,o=new p.VideoReceiverMonitorData;E&&(o.rtpReceiver=E),b&&(h.rtpReceiver=b),_&&(o.RTCPeerconnection=_,h.RTCPeerconnection=_),this.trackPairDataList.push({url:t,vMsid:i,aMsid:l,audioReceiverMonitorData:h,videoReceiverMonitorData:o})},s}(),n=function(s){function t(){var i=s.call(this)||this;return i.canplay=!1,i.pc=null,i.pcCore=null,i.monitorTimerId=null,i.audioReceiverMonitorData=new d.AudioReceiverMonitorData,i.videoReceiverMonitorData=new p.VideoReceiverMonitorData,i.receiverMonitorController=new r,i}return c(t,s),t.prototype.start=function(i,l){this.pc=i,this.pcCore=l,this.updateTranceiversController(),this.startMonitorTimer(200)},t.prototype.updateTranceiversController=function(){var i=this;if(this.pc&&this.pcCore){var l=this.pcCore.getStreamManager().getAllTrackPairList("sub");this.receiverMonitorController.reset(),l.forEach(function(E){E.url&&i.receiverMonitorController.addTrackPair(E.url,E.vMsid,E.aMsid,E.vTransceiver,E.aTransceiver,i.pc)}),this.receiverMonitorController.trackPairDataList.forEach(function(E){i.initEvent(E)})}},t.prototype.resetTimer=function(i){this.updateTranceiversController(),this.stopMonitorTimer(),this.startMonitorTimer(i)},t.prototype.stop=function(){this.canplay=!1,this.stopMonitorTimer(),this.audioReceiverMonitorData.dispose(),this.videoReceiverMonitorData.dispose()},t.prototype.startMonitorTimer=function(i){var l=this;this.monitorTimerId||(this.monitorTimerId=window.setInterval(function(){l.onMonitorTimer()},i))},t.prototype.stopMonitorTimer=function(){this.monitorTimerId&&clearInterval(this.monitorTimerId),this.monitorTimerId=null},t.prototype.onMonitorTimer=function(){return u(this,void 0,void 0,function(){var i;return S(this,function(l){switch(l.label){case 0:return[4,this.updateMonitorData()];case 1:return l.sent(),i=[],this.receiverMonitorController.trackPairDataList.forEach(function(E){var b,_;if(E.url){var h={url:E.url};E.audioReceiverMonitorData.isExist&&(h.audio=(b=E.audioReceiverMonitorData)===null||b===void 0?void 0:b.monitorData,h.aMsid=E.aMsid),E.videoReceiverMonitorData.isExist&&(h.video=(_=E.videoReceiverMonitorData)===null||_===void 0?void 0:_.monitorData,h.vMsid=E.vMsid),i.push(h)}}),this.emit("onMonitorEvent",{eventList:i,type:"sub"}),[2]}})})},t.prototype.initEvent=function(i){var l=this,E={url:i.url||"url unknown",vMsid:i.vMsid||"vMsid unknown",aMsid:i.aMsid||"aMsid unknown"};i.audioReceiverMonitorData.isExist&&(i.audioReceiverMonitorData.on("streamEnded",function(){i.videoReceiverMonitorData&&!i.videoReceiverMonitorData.isStreamEnded||(l.emit("streamEnded",E),l.stopMonitorTimer())}),i.audioReceiverMonitorData.on("canPlay",function(){l.emitCanPlay()})),i.videoReceiverMonitorData.isExist&&(i.videoReceiverMonitorData.on("streamEnded",function(){i.audioReceiverMonitorData&&!i.audioReceiverMonitorData.isStreamEnded||(l.emit("streamEnded",E),l.stopMonitorTimer())}),i.videoReceiverMonitorData.on("canPlay",function(){l.emitCanPlay()}))},t.prototype.updateMonitorData=function(){return Promise.all(this.receiverMonitorController.trackPairDataList.reduce(function(i,l){var E,b;return f(f([],i,!0),[(E=l.audioReceiverMonitorData)===null||E===void 0?void 0:E.getInfo(),(b=l.videoReceiverMonitorData)===null||b===void 0?void 0:b.getInfo()],!1)},[]))},t.prototype.emitCanPlay=function(){this.canplay||(this.canplay=!0,this.emit("canPlay"))},t.prototype.copyMonitorData=function(){var i,l;!((l=(i=this.receiverMonitorController)===null||i===void 0?void 0:i.trackPairDataList)===null||l===void 0)&&l.length&&(this.audioReceiverMonitorData=this.receiverMonitorController.trackPairDataList[0].audioReceiverMonitorData,this.videoReceiverMonitorData=this.receiverMonitorController.trackPairDataList[0].videoReceiverMonitorData)},t.prototype.getTransportStats=function(){return u(this,void 0,void 0,function(){var i;return S(this,function(l){switch(l.label){case 0:return[4,this.updateMonitorData()];case 1:return l.sent(),this.copyMonitorData(),i={},this.videoReceiverMonitorData.isExist?i=this.videoReceiverMonitorData.monitorData.transportStats:this.audioReceiverMonitorData.isExist&&(i=this.audioReceiverMonitorData.monitorData.transportStats),[2,i]}})})},t.prototype.getRemoteVideoStats=function(){return u(this,void 0,void 0,function(){var i,l;return S(this,function(E){switch(E.label){case 0:return[4,this.updateMonitorData()];case 1:return E.sent(),this.copyMonitorData(),i={},this.videoReceiverMonitorData.isExist&&(l=this.videoReceiverMonitorData.monitorData.inboundRtpStats,i={timestamp:Math.floor(l.timestamp||0),framesDecodedPerSecond:l.framesPerSecond,framesDecoded:l.framesDecoded,frameWidth:l.frameWidth,frameHeight:l.frameHeight,bytesReceived:l.bytesReceived,jitter:l.jitter,jitterBufferDelayAvg:Number(l.jitterBufferDelay)/Number(l.jitterBufferEmittedCount),packetsLost:l.packetsLost,packetsReceived:l.packetsReceived}),[2,i]}})})},t.prototype.getRemoteAudioStats=function(){return u(this,void 0,void 0,function(){var i,l;return S(this,function(E){switch(E.label){case 0:return[4,this.updateMonitorData()];case 1:return E.sent(),this.copyMonitorData(),i={},this.audioReceiverMonitorData.isExist&&(l=this.audioReceiverMonitorData.monitorData.inboundRtpStats,i={timestamp:Math.floor(l.timestamp||0),bytesReceived:l.bytesReceived,jitter:l.jitter,jitterBufferDelayAvg:Number(l.jitterBufferDelay)/Number(l.jitterBufferEmittedCount),packetsLost:l.packetsLost,packetsReceived:l.packetsReceived}),[2,i]}})})},t}(e.default);R.SubMonitor=n},5259:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.AudioProfileMap=R.VideoProfileMap=R.ScreenProfileMap=void 0,R.ScreenProfileMap=new Map,R.ScreenProfileMap.set("480p_1",{width:640,height:480,frameRate:5,maxBitrate:300}),R.ScreenProfileMap.set("480p_2",{width:640,height:480,frameRate:30,maxBitrate:1e3}),R.ScreenProfileMap.set("720p_1",{width:1280,height:720,frameRate:5,maxBitrate:800}),R.ScreenProfileMap.set("720p_2",{width:1280,height:720,frameRate:30,maxBitrate:2e3}),R.ScreenProfileMap.set("1080p_1",{width:1920,height:1080,frameRate:5,maxBitrate:1e3}),R.ScreenProfileMap.set("1080p_2",{width:1920,height:1080,frameRate:30,maxBitrate:3e3}),R.VideoProfileMap=new Map,R.VideoProfileMap.set("120p_1",{width:160,height:120,frameRate:15,maxBitrate:65}),R.VideoProfileMap.set("120p_3",{width:120,height:120,frameRate:15,maxBitrate:50}),R.VideoProfileMap.set("180p_1",{width:320,height:180,frameRate:15,maxBitrate:140}),R.VideoProfileMap.set("180p_3",{width:180,height:180,frameRate:15,maxBitrate:100}),R.VideoProfileMap.set("180p_4",{width:240,height:180,frameRate:15,maxBitrate:120}),R.VideoProfileMap.set("240p_1",{width:320,height:240,frameRate:15,maxBitrate:200}),R.VideoProfileMap.set("240p_3",{width:240,height:240,frameRate:15,maxBitrate:140}),R.VideoProfileMap.set("240p_4",{width:424,height:240,frameRate:15,maxBitrate:220}),R.VideoProfileMap.set("360p_1",{width:640,height:360,frameRate:15,maxBitrate:400}),R.VideoProfileMap.set("360p_3",{width:360,height:360,frameRate:15,maxBitrate:260}),R.VideoProfileMap.set("360p_4",{width:640,height:360,frameRate:30,maxBitrate:600}),R.VideoProfileMap.set("360p_6",{width:360,height:360,frameRate:30,maxBitrate:400}),R.VideoProfileMap.set("360p_7",{width:480,height:360,frameRate:15,maxBitrate:320}),R.VideoProfileMap.set("360p_8",{width:480,height:360,frameRate:30,maxBitrate:490}),R.VideoProfileMap.set("360p_9",{width:640,height:360,frameRate:15,maxBitrate:800}),R.VideoProfileMap.set("360p_10",{width:640,height:360,frameRate:24,maxBitrate:800}),R.VideoProfileMap.set("360p_11",{width:640,height:360,frameRate:24,maxBitrate:1e3}),R.VideoProfileMap.set("480p_1",{width:640,height:480,frameRate:15,maxBitrate:500}),R.VideoProfileMap.set("480p_2",{width:640,height:480,frameRate:30,maxBitrate:1e3}),R.VideoProfileMap.set("480p_3",{width:480,height:480,frameRate:15,maxBitrate:400}),R.VideoProfileMap.set("480p_4",{width:640,height:480,frameRate:30,maxBitrate:750}),R.VideoProfileMap.set("480p_6",{width:480,height:480,frameRate:30,maxBitrate:600}),R.VideoProfileMap.set("480p_8",{width:848,height:480,frameRate:15,maxBitrate:610}),R.VideoProfileMap.set("480p_9",{width:848,height:480,frameRate:30,maxBitrate:930}),R.VideoProfileMap.set("480p_10",{width:640,height:480,frameRate:10,maxBitrate:400}),R.VideoProfileMap.set("720p_1",{width:1280,height:720,frameRate:15,maxBitrate:1130}),R.VideoProfileMap.set("720p_2",{width:1280,height:720,frameRate:30,maxBitrate:2e3}),R.VideoProfileMap.set("720p_3",{width:1280,height:720,frameRate:30,maxBitrate:1710}),R.VideoProfileMap.set("720p_5",{width:960,height:720,frameRate:15,maxBitrate:910}),R.VideoProfileMap.set("720p_6",{width:960,height:720,frameRate:30,maxBitrate:1380}),R.VideoProfileMap.set("1080p_1",{width:1920,height:1080,frameRate:15,maxBitrate:2080}),R.VideoProfileMap.set("1080p_2",{width:1920,height:1080,frameRate:30,maxBitrate:3e3}),R.VideoProfileMap.set("1080p_3",{width:1920,height:1080,frameRate:30,maxBitrate:3150}),R.VideoProfileMap.set("1080p_5",{width:1920,height:1080,frameRate:60,maxBitrate:4780}),R.VideoProfileMap.set("1440p_1",{width:2560,height:1440,frameRate:30,maxBitrate:4850}),R.VideoProfileMap.set("1440p_2",{width:2560,height:1440,frameRate:60,maxBitrate:7350}),R.VideoProfileMap.set("4K_1",{width:3840,height:2160,frameRate:30,maxBitrate:8910}),R.VideoProfileMap.set("4K_3",{width:3840,height:2160,frameRate:60,maxBitrate:13500}),R.AudioProfileMap=new Map,R.AudioProfileMap.set("standard",{sampleRate:48e3,channelCount:1,maxBitrate:64}),R.AudioProfileMap.set("high",{sampleRate:48e3,channelCount:1,maxBitrate:128}),R.AudioProfileMap.set("standard-stereo",{sampleRate:48e3,channelCount:2,maxBitrate:80}),R.AudioProfileMap.set("high-stereo",{sampleRate:48e3,channelCount:2,maxBitrate:192})},5553:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.Datachannel=void 0;var x=function(){function v(c){this.pc=c,this.messageId=1,this.dataChannel=this.pc.createDataChannel("GRTNDataChannel"),this.dataChannel.onopen=function(u){},this.dataChannel.onmessage=function(u){u.data},this.dataChannel.onclose=function(u){},this.dataChannel.onerror=function(u){}}return v.prototype.addTrack=function(c,u){return new Promise(function(S,f){})},v.prototype.removeTrack=function(c,u){return new Promise(function(S,f){})},v.prototype.createPublishPacket=function(){var c={type:"pub",version:1,msg_id:this.messageId,streams:[]};return++this.messageId,c},v}();R.Datachannel=x},2470:function(L,R,x){var v,c=this&&this.__extends||(v=function(n,s){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&(t[l]=i[l])},v(n,s)},function(n,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function t(){this.constructor=n}v(n,s),n.prototype=s===null?Object.create(s):(t.prototype=s.prototype,new t)}),u=this&&this.__assign||function(){return u=Object.assign||function(n){for(var s,t=1,i=arguments.length;t<i;t++)for(var l in s=arguments[t])Object.prototype.hasOwnProperty.call(s,l)&&(n[l]=s[l]);return n},u.apply(this,arguments)},S=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(R,"__esModule",{value:!0}),R.PcRestorer=void 0;var f=S(x(102)),a=x(5917),d=x(280),p=x(9428),e=x(5044),r=function(n){function s(t){var i=n.call(this)||this;return i.restoring=!1,i.subscriber=t.subscriber,i.publisher=t.publisher,i.commonController=t.commonController,i}return c(s,n),s.prototype.isReconnecting=function(){return this.restoring},s.prototype.restore=function(t){var i=this;if(!this.restoring)return new Promise(function(l,E){i.restoring=!0;var b=i.restructureStreams();if(b&&b.length){i.subscriber.unsubscribe(),i.publisher.unpublish();var _=[],h=b[0],o={retryTimes:a.DEFAULT_RETRY_SUBSCRIBE_LIMIT,retryInterval:a.DEFAULT_RETRY_SUBSCRIBE_INTERVAL},g=h.url;switch(t&&(g=i.makeIpQuery(g,t,h.type)),h.type){case"sub":i.commonController.setPeerconnection(i.subscriber.getPeerConnection()),i.subscriber.incrementReconnectTimes(),o.retryTimes=i.subscriber.getSubscribeConfig().retryTimes||a.DEFAULT_RETRY_SUBSCRIBE_LIMIT,o.retryInterval=i.subscriber.getSubscribeConfig().retryInterval||a.DEFAULT_RETRY_SUBSCRIBE_INTERVAL,_.push(i.subscriber.subscribeWithReconnect(g,u(u({},i.subscriber.getSubscribeConfig()),{vMsid:h.vMsid,aMsid:h.aMsid})));break;case"pub":h.targetStream&&(i.commonController.setPeerconnection(i.publisher.getPeerConnection()),i.publisher.incrementReconnectTimes(),o.retryTimes=i.publisher.getPublishConfig().retryTimes||a.DEFAULT_RETRY_PUBLISH_LIMIT,o.retryInterval=i.publisher.getPublishConfig().retryInterval||a.DEFAULT_RETRY_PUBLISH_INTERVAL,_.push(i.publisher.publishWithReconnect(g,h.targetStream,u(u({},i.publisher.getPublishConfig()),{vMsid:h.vMsid,aMsid:h.aMsid}))));break;case"sub-data":h.msid&&h.label&&_.push(i.commonController.subscribeAddDatachannel({signalUrl:g,url:g,label:h.label,msid:h.msid}));break;case"pub-data":h.msid&&h.label&&_.push(i.commonController.publishAddDatachannel({signalUrl:h.url,url:h.url,label:h.label,msid:h.msid}));break;default:console.log("RTS [PC RESTORER] unknown http reconnect type",h.type)}var m=new Promise(function(C,D){var y=setTimeout(function(){var A=new e.RtsError(p.ErrorCode.ERROR_DATACHANNEL_OPEN,"reconnect pc datachannel open timeout","",{});D(A)},o.retryTimes*o.retryInterval+a.DEFAULT_RETRY_DATACHANNEL_TIMEOUT);i.commonController.on("datachannelStatusChange",function(A){A.status===d.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(clearTimeout(y),C())})});_.push(m);var T=[];Promise.all(_).then(function(C){for(var D=1;D<b.length;D++){var y=b[D];if(y)switch(y.type){case"sub":T.push(i.commonController.subscribeAdd([{url:y.url,vMsid:y.vMsid,aMsid:y.aMsid,targetStream:y.targetStream,subAudio:!(!y.aMsid||!y.aMsid.length),subVideo:!(!y.vMsid||!y.vMsid.length)}],!0).catch(function(A){i.emit("onError",i.makeSingleStreamReconnectError(A))}));break;case"pub":T.push(i.commonController.publishAdd([{url:y.url,stream:y.targetStream,vMsid:y.vMsid,aMsid:y.aMsid}]).catch(function(A){i.emit("onError",i.makeSingleStreamReconnectError(A))}));break;case"sub-data":y.label&&y.msid&&T.push(i.commonController.subscribeAddDatachannel({signalUrl:y.url,url:y.url,label:y.label,msid:y.msid}).catch(function(A){i.emit("onError",i.makeSingleStreamReconnectError(A))}));break;case"pub-data":y.label&&y.msid&&T.push(i.commonController.publishAddDatachannel({signalUrl:y.url,url:y.url,label:y.label,msid:y.msid}).catch(function(A){i.emit("onError",i.makeSingleStreamReconnectError(A))}));break;default:console.log("RTS [PC RESTORER] unknown pc reconnect type")}}Promise.allSettled(T).then(function(){l()})}).catch(function(C){E(C)}).finally(function(){i.restoring=!1})}i.restoring=!1})},s.prototype.restructureStreams=function(){var t,i=(t=this.commonController.peerCore)===null||t===void 0?void 0:t.getStreamManager(),l=i?.getAllStreamListWithMsids(),E=i?.getAllDatachannelList(),b=[];return l?.forEach(function(_){var h;(h=_.streams)===null||h===void 0||h.forEach(function(o){var g=[],m=[],T=_.type,C=_.latestUrl,D=o;_.msids.forEach(function(y){y.streamId===o.id&&(y.type==="video"?m.push(y.name):y.type==="audio"&&g.push(y.name))}),b.push({aMsid:g,vMsid:m,type:T,url:C,targetStream:D})})}),E?.forEach(function(_){_.msids.forEach(function(h){if(h.name&&h.label){var o=h.name,g=h.label,m=_.type,T=_.latestUrl;b.push({msid:o,type:m,label:g,url:T})}})}),b},s.prototype.makeSingleStreamReconnectError=function(t){return new e.RtsError(p.ErrorCode.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED,"single stream reconnect failed","",{originError:t})},s.prototype.makeIpQuery=function(t,i,l){var E,b,_,h="ali_prefer_media_server",o="ip_migration",g=t,m="";if(l.indexOf("sub")===0&&(!((b=i.pull)===null||b===void 0)&&b.length)?m=i.pull[0]:l.indexOf("pub")===0&&(!((_=i.push)===null||_===void 0)&&_.length)&&(m=i.push[0]),m){var T=t.split("?"),C=T[0],D=T[1],y=void 0;D?((y=new URLSearchParams(D)).has(h)?y.set(h,m):y.append(h,m),!y.has(o)&&y.append(o,"on")):y=new URLSearchParams(((E={})[h]=m,E[o]="on",E)),g="".concat(C,"?").concat(y.toString())}return g},s}(f.default);R.PcRestorer=r},4865:function(L,R,x){var v,c=this&&this.__extends||(v=function(C,D){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,A){y.__proto__=A}||function(y,A){for(var O in A)Object.prototype.hasOwnProperty.call(A,O)&&(y[O]=A[O])},v(C,D)},function(C,D){if(typeof D!="function"&&D!==null)throw new TypeError("Class extends value "+String(D)+" is not a constructor or null");function y(){this.constructor=C}v(C,D),C.prototype=D===null?Object.create(D):(y.prototype=D.prototype,new y)}),u=this&&this.__assign||function(){return u=Object.assign||function(C){for(var D,y=1,A=arguments.length;y<A;y++)for(var O in D=arguments[y])Object.prototype.hasOwnProperty.call(D,O)&&(C[O]=D[O]);return C},u.apply(this,arguments)},S=this&&this.__awaiter||function(C,D,y,A){return new(y||(y=Promise))(function(O,j){function I(U){try{F(A.next(U))}catch(B){j(B)}}function H(U){try{F(A.throw(U))}catch(B){j(B)}}function F(U){var B;U.done?O(U.value):(B=U.value,B instanceof y?B:new y(function(k){k(B)})).then(I,H)}F((A=A.apply(C,D||[])).next())})},f=this&&this.__generator||function(C,D){var y,A,O,j,I={label:0,sent:function(){if(1&O[0])throw O[1];return O[1]},trys:[],ops:[]};return j={next:H(0),throw:H(1),return:H(2)},typeof Symbol=="function"&&(j[Symbol.iterator]=function(){return this}),j;function H(F){return function(U){return function(B){if(y)throw new TypeError("Generator is already executing.");for(;j&&(j=0,B[0]&&(I=0)),I;)try{if(y=1,A&&(O=2&B[0]?A.return:B[0]?A.throw||((O=A.return)&&O.call(A),0):A.next)&&!(O=O.call(A,B[1])).done)return O;switch(A=0,O&&(B=[2&B[0],O.value]),B[0]){case 0:case 1:O=B;break;case 4:return I.label++,{value:B[1],done:!1};case 5:I.label++,A=B[1],B=[0];continue;case 7:B=I.ops.pop(),I.trys.pop();continue;default:if(O=I.trys,!((O=O.length>0&&O[O.length-1])||B[0]!==6&&B[0]!==2)){I=0;continue}if(B[0]===3&&(!O||B[1]>O[0]&&B[1]<O[3])){I.label=B[1];break}if(B[0]===6&&I.label<O[1]){I.label=O[1],O=B;break}if(O&&I.label<O[2]){I.label=O[2],I.ops.push(B);break}O[2]&&I.ops.pop(),I.trys.pop();continue}B=D.call(C,I)}catch(k){B=[6,k],A=0}finally{y=O=0}if(5&B[0])throw B[1];return{value:B[0]?B[1]:void 0,done:!0}}([F,U])}}},a=this&&this.__importDefault||function(C){return C&&C.__esModule?C:{default:C}};Object.defineProperty(R,"__esModule",{value:!0}),R.RtsPeerconnection=void 0;var d,p=x(280),e=x(233),r=x(4315),n=x(2718),s=a(x(102)),t=x(5917),i=x(4699),l=x(9752),E=x(5553),b=x(9428),_=x(5044),h=a(x(6834));(function(C){C.Subscribe="sub",C.Publish="pub"})(d||(d={}));var o=window.RTCRtpReceiver&&"createEncodedStreams"in RTCRtpReceiver.prototype,g=window.RTCRtpReceiver&&"transform"in RTCRtpReceiver.prototype&&"RTCRtpScriptTransform"in window,m=function(C){function D(){var y=C.call(this)||this;return y.connectingEventSent=!1,y.reused=!1,y.transformWorkerList=new T,y.receiverCodecPreferences={},y.senderCodecPreferences={},y.heartbeatTimeoutHandler=null,y.noHeartbeatCount=0,y.subMonitor=new i.SubMonitor,y.subMonitor.on("onMonitorEvent",function(A){y.emit("onMonitorEvent",A)}),y.subMonitor.on("streamEnded",function(){y.emit("streamEnded")}),y.subMonitor.on("canPlay",function(){}),y.pubMonitor=new l.PubMonitor,y.pubMonitor.on("onMonitorEvent",function(A){y.emit("onMonitorEvent",A)}),y.pubMonitor.on("onTransportStateEvent",function(A){y.emit("onTransportStateEvent",A)}),y}return c(D,C),Object.defineProperty(D.prototype,"isConnected",{get:function(){var y;return((y=this.pc)===null||y===void 0?void 0:y.connectionState)==="connected"},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isReused",{get:function(){return this.reused},set:function(y){this.reused=!!y},enumerable:!1,configurable:!0}),D.prototype.getWorkerManager=function(){return this.transformWorkerList},D.prototype.getPc=function(){return this.pc},D.prototype.getPeerCore=function(){return this.peerCore},D.prototype.getSubMonitor=function(){return this.subMonitor},D.prototype.getPubMonitor=function(){return this.pubMonitor},D.prototype.playStart=function(){this.subMonitor.resetTimer(1e3)},D.prototype.pushStart=function(){this.pc&&this.peerCore&&this.pubMonitor.startHeartbeat(this.pc,this.peerCore)},D.prototype.sample=function(){return S(this,void 0,void 0,function(){return f(this,function(y){switch(y.label){case 0:return[4,this.subMonitor.onMonitorTimer()];case 1:return y.sent(),[2]}})})},D.prototype.subAdd=function(y,A){var O;return(O=this.peerCore)===null||O===void 0?void 0:O.subscribeAdd(y,A)},D.prototype.subActive=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.subscribeActive(y)},D.prototype.subStop=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.subscribeStop(y)},D.prototype.subDeleteTracks=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.subscribeDeleteTracks(y)},D.prototype.pubAdd=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.publishAdd(y)},D.prototype.pubDeleteTracks=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.publishDeleteTracks(y)},D.prototype.pubReplaceTracks=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.publishReplaceTracks(y)},D.prototype.pubStop=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.publishStop(y)},D.prototype.createOffer=function(y,A,O,j){var I=this;return j===void 0&&(j={publishUrl:""}),new Promise(function(H,F){var U;(U=I.cancelable)===null||U===void 0||U.cancel();var B={googCpuOveruseDetection:!1,sdpSemantics:"unified-plan",encodedInsertableStreams:j.encodedInsertableStreams,bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};if(e.BrowserUtil.isChrome&&Number(e.BrowserUtil.browserMainVersion)<=55&&(B.iceServers=[]),I.pc=new RTCPeerConnection(B),I.encodedInsertableStreams=j.encodedInsertableStreams,I.peerCore=new p.PeerConnectionCore({pc:I.pc,onDatachannelEvent:function(q){var z,$;I.emit("datachannelStatusChange",{status:q}),j.disableHeartbeat||(q===p.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?((0,n.hebtLog)("DATACHANNEL OPEN"," heartbeat send scheduler started"),(z=I.peerCore)===null||z===void 0||z.startSignalHeartbeatTimer()):q===p.EDatachannelStatus.DATACHANNEL_STATUS_CLOSE&&((0,n.hebtLog)("DATACHANNEL CLOSE"," heartbeats from now on will fail"),($=I.peerCore)===null||$===void 0||$.stopSignalHeartbeatTimer()))},onInnerSubscribeDelete:function(q){I.emit("innerSubscribeDeleteTracks",q)},offerSdpHook:j.offerSdpHook,answerSdpHook:j.answerSdpHook}),I.registerPeerCoreListeners(j),I.peerCore.setReceiverCodecPreferences(I.receiverCodecPreferences),I.peerCore.setSenderCodecPreferences(I.senderCodecPreferences),I.pc.onconnectionstatechange=function(){var q=(I.pc||{}).connectionState;switch(I.connectingEventSent||(I.connectingEventSent=!0,I.emit("connectStatusChange",{status:t.EConnectStatus.CONNECT_STATUS_CONNECTING})),q!=="connecting"&&I.clearStatusTimer(),q){case"connected":I.emit("onConnected"),I.emit("connectStatusChange",{status:t.EConnectStatus.CONNECT_STATUS_CONNECTED});break;case"disconnected":I.emit("connectStatusChange",{status:t.EConnectStatus.CONNECT_STATUS_RECONNECTING});break;case"failed":case"closed":I.handleClosed()}},I.clearStatusTimer(),I.statusTimer=window.setTimeout(function(){I.handleClosed()},D.CONNECT_TIMEOUT),O){I.localStream=O,I.sdpUtil=new r.SdpUtil(I.localStream);var k=I.addStream();if(k!==0)return I.pc=void 0,void F(new _.RtsError(k,k===b.ErrorCode.ERROR_MEDIASTREAMTRACK_AUDIO_NONE?"need audio track":"",""))}else I.sdpUtil=new r.SdpUtil;var V={};O||(V=I.handleSubTransceiver(y,A).added?{}:{offerToReceiveAudio:y,offerToReceiveVideo:A});var G=I.pc.createOffer(V);I.cancelable=(0,n.makeCancelable)(G),I.cancelable.promise.then(function(q){var z,$,re,ee,ie,se,ce;if(I.cancelable=void 0,I.sdpUtil){if(I.sdpUtil.init(String(q.sdp)),I.sdpUtil.addNack(),I.sdpUtil.addSps(),j.disableStereo||I.sdpUtil.addStereo(),O&&I.sdpUtil.modifyTrackName({vMsid:j.vMsid&&j.vMsid[0],aMsid:j.aMsid&&j.aMsid[0]}),I.pc){q.sdp=I.sdpUtil.sdp,O&&O.sdpHook&&typeof O.sdpHook=="function"&&(q.sdp=O.sdpHook(q.sdp)),(z=I.peerCore)===null||z===void 0||z.setPrevOfferSdp(q.sdp||"");var ue=[];if(O)try{($=I.peerCore)===null||$===void 0||$.patchPublishStreamManagerRecord(j.publishUrl||"",u(u({},j),{stream:O}));var de=(re=I.peerCore)===null||re===void 0?void 0:re.parseSdp(q.sdp||"");ue=(ee=I.peerCore)===null||ee===void 0?void 0:ee.updateTrackInfoList({url:j.publishUrl||"",stream:O,vMsid:(ie=I.peerCore)===null||ie===void 0?void 0:ie.unifyMsid(j.vMsid,"video"),aMsid:(se=I.peerCore)===null||se===void 0?void 0:se.unifyMsid(j.aMsid,"audio"),sdpMediaList:(ce=de?.detail)===null||ce===void 0?void 0:ce.media})}catch(pe){console.log(pe)}j.offerSdpHook&&typeof j.offerSdpHook=="function"&&(q.sdp=j.offerSdpHook(q.sdp||"")),I.pc.setLocalDescription(q).then(function(){I.pc?H({desp:I.pc.localDescription,publishTrackInfoList:ue}):F(new _.RtsError(b.ErrorCode.ERROR_CREATEOFFER,"no pc",""))}).catch(function(pe){F(new _.RtsError(b.ErrorCode.ERROR_CREATEOFFER,"setLocalDescription error "+pe.message,""))})}}else F(new _.RtsError(b.ErrorCode.ERROR_CREATEOFFER,"no sdp",""))}).catch(function(q){q.isCanceled||F(new _.RtsError(b.ErrorCode.ERROR_CREATEOFFER,q.message?q.message:"create offer error",""))})})},D.prototype.recvAnswer=function(y,A){var O,j,I=this;return A===void 0&&(A={}),(O=this.peerCore)===null||O===void 0||O.setPrevAnswerSdp((j=y?.jsep)===null||j===void 0?void 0:j.sdp),new Promise(function(H,F){var U,B,k,V,G,q;if(I.pc){if(I.pc.ontrack=function($){I.pc&&I.peerCore&&I.subMonitor.start(I.pc,I.peerCore),setTimeout(function(){I.handleEncodedInsertableStreams({receiver:$.receiver})}),I.isReused||I.emit("onTrackEvent",$)},I.pc.signalingState==="closed")return void F({message:"PeerConnection signalingState is closed"});if(!((U=y.jsep)===null||U===void 0)&&U.sdp){var z=new r.SdpUtil;z.init(String((B=y.jsep)===null||B===void 0?void 0:B.sdp)),I.localStream&&(I.localStream.audioTrack&&!I.localStream.videoTrack&&(z.removeTwccRtcpFb(),(k=I.peerCore)===null||k===void 0||k.setRemoveTwcc(!0)),z.setDirection()),A.tcpOnly&&z.hasTcpCandidate&&z.removeUdpCandidate(),y.jsep.sdp=z.sdp,(V=I.peerCore)===null||V===void 0||V.setPrevAnswerSdp((G=y?.jsep)===null||G===void 0?void 0:G.sdp)}!((q=y.jsep)===null||q===void 0)&&q.sdp&&A.answerSdpHook&&typeof A.answerSdpHook=="function"&&(y.jsep.sdp=A.answerSdpHook(y.jsep.sdp)),I.pc.setRemoteDescription(new RTCSessionDescription(y.jsep)).then(function($){var re;I.pc&&I.localStream&&(I.localStream.setEncodeParam(I.pc),(re=I.pc)===null||re===void 0||re.getSenders().forEach(function(ee){I.handleEncodedInsertableStreams({sender:ee})})),H($)}).catch(function($){$.sdp=y.jsep.sdp,F($)})}else F({message:"no PeerConnection"})})},D.prototype.setReceiverCodecPreferences=function(y){var A;this.receiverCodecPreferences=u({},y),(A=this.peerCore)===null||A===void 0||A.setReceiverCodecPreferences(this.receiverCodecPreferences)},D.prototype.setSenderCodecPreferences=function(y){var A;this.senderCodecPreferences=u({},y),(A=this.peerCore)===null||A===void 0||A.setSenderCodecPreferences(this.senderCodecPreferences)},D.prototype.removeTrack=function(y,A){var O=this;return new Promise(function(j,I){O.pc&&O.dataChannel&&O.dataChannel.removeTrack(y,A).then(function(){}).catch(function(H){I(H)})})},D.prototype.replaceTrack=function(y,A,O){var j=this;return new Promise(function(I,H){O||j.pc&&j.dataChannel&&j.dataChannel.removeTrack(y,A).then(function(){}).catch(function(F){H(F)})})},D.prototype.sendSEI=function(y){var A;if(!y.data)throw new Error("No data to send, please check your params.");if(!(y.data instanceof ArrayBuffer))throw new Error("data should be ArrayBuffer, please check your params.");if(!y.url)throw new Error("url is required, please check your params.");if(!y.vMsid)throw new Error("vMsid is required, please check your params.");if(o||g){var O=this.transformWorkerList.findByMsid({url:y.url,kind:t.TrackType.VIDEO,source:t.EWorkerSource.Sender,msid:y.vMsid});if(!O)throw new Error("No published stream found, please check your url: "+y.url);(A=O?.worker)===null||A===void 0||A.postMessage({operation:t.EWorkerAction.InserSEI,payloadType:y.payloadType,repeatCount:y.repeatCount,sei:y.data})}},D.prototype.dispose=function(){this.cancelable&&(this.cancelable.cancel(),this.cancelable=void 0),this.peerCore&&(this.peerCore.dispose(),this.peerCore=void 0),this.pc&&(this.pc.onconnectionstatechange=function(){},this.pc.ontrack=function(){},this.pc.close(),this.pc=void 0,this.clearStatusTimer()),this.sdpUtil&&(this.sdpUtil.dispose(),this.sdpUtil=void 0),this.localStream&&(this.localStream=void 0),this.transformWorkerList.dispose(),this.subMonitor.stop(),this.pubMonitor.stopHeartbeat(),this.isReused=!1,this.encodedInsertableStreams=void 0,this.stopHeartbeatTimeoutChecker()},D.prototype.addStream=function(){if(this.localStream){if(this.pc){if(this.localStream.audioTrack){var y=this.pc.addTransceiver(this.localStream.audioTrack,{direction:"sendonly",streams:[this.localStream.mediaStream]});if(this.senderCodecPreferences.audio)try{y.setCodecPreferences(this.senderCodecPreferences.audio)}catch(O){console.warn("setCodecPreferences error",O)}}if(this.localStream.videoTrack){var A=this.pc.addTransceiver(this.localStream.videoTrack,{direction:"sendonly",streams:[this.localStream.mediaStream]});if(this.senderCodecPreferences.video)try{A.setCodecPreferences(this.senderCodecPreferences.video)}catch(O){console.warn("setCodecPreferences error",O)}}return 0}return b.ErrorCode.ERROR_PREERCONNECTION_UNKNOWN}return b.ErrorCode.ERROR_MEDIASTREAMTRACK_AUDIO_NONE},D.prototype.handleEncodedInsertableStreams=function(y){var A,O,j=this;if(this.encodedInsertableStreams){var I=y.receiver,H=y.sender,F=I?t.EWorkerSource.Receiver:t.EWorkerSource.Sender,U=I||H,B=U.track;if(!B)return console.warn("no track in senderReceiver!");var k=B.kind,V=(O=(A=this.peerCore)===null||A===void 0?void 0:A.getStreamManager())===null||O===void 0?void 0:O.getAllTrackPairList(F===t.EWorkerSource.Receiver?d.Subscribe:d.Publish),G=V?.find(function(ie){var se,ce;return((ce=(se=ie[k===t.TrackType.VIDEO?"vTransceiver":"aTransceiver"])===null||se===void 0?void 0:se.track)===null||ce===void 0?void 0:ce.id)===B.id});if(!G)return console.warn("no existing stream info found");var q=new h.default;if(!this.transformWorkerList.add({worker:q,kind:k,source:F,info:G,receiver:I,sender:H}))return console.log("worker existing, skip.");var z=t.EWorkerAction.Setup;if(o){var $=U.createEncodedStreams(),re=$.readable,ee=$.writable;q.postMessage({source:F,readable:re,writable:ee,operation:z},[re,ee])}else g&&(U.transform=new RTCRtpScriptTransform(q,{source:F,operation:z}));q.onmessage=function(ie){var se=ie.data,ce=se.type,ue=se.data,de=se.frameInfo;ce==="encodedFrame"&&j.emit("encodedFrame",{kind:k,url:G.originUrl,vMsid:k==="video"?G?.vMsid:void 0,aMsid:k==="audio"?G?.aMsid:void 0,frame:u({data:ue},de)})}}},D.prototype.handleSubTransceiver=function(y,A){var O,j,I,H=!1;if(!((O=this.pc)===null||O===void 0)&&O.addTransceiver){if(y&&(j=this.pc.addTransceiver("audio",{direction:"recvonly"}),this.receiverCodecPreferences.audio))try{j.setCodecPreferences(this.receiverCodecPreferences.audio)}catch(F){console.warn("setCodecPreferences error",F)}if(A&&(I=this.pc.addTransceiver("video",{direction:"recvonly"}),this.receiverCodecPreferences.video))try{I.setCodecPreferences(this.receiverCodecPreferences.video)}catch(F){console.warn("setCodecPreferences error",F)}H=!0}return{added:H,aTransceiver:j,vTransceiver:I}},D.prototype.initDataChannel=function(){!this.dataChannel&&this.pc&&(this.dataChannel=new E.Datachannel(this.pc))},D.prototype.handleClosed=function(){this.subMonitor.stop(),this.emit("connectStatusChange",{status:t.EConnectStatus.CONNECT_STATUS_DISCONNECTED}),this.emit("onEnd")},D.prototype.clearStatusTimer=function(){this.statusTimer&&clearTimeout(this.statusTimer),this.statusTimer=void 0},D.prototype.registerPeerCoreListeners=function(y){var A=this;this.peerCore?(y.disableHeartbeat||((0,n.hebtLog)("heartbeat [timeout checker] started"),this.startHeartbeatTimeoutChecker()),this.peerCore.on("message",function(O){A.emit("message",O)}),this.peerCore.on("hebtReceived",function(O){(0,n.hebtLog)("EVENT: HEBT RECV",O),A.noHeartbeatCount=0,A.emit("hebtReceived",O)}),this.peerCore.on("streamError",function(O){(0,n.hebtLog)("EVENT: \u5355\u8DEF\u6D41\u9519\u8BEF",O),A.emit("streamError",O)}),this.peerCore.on("streamReconnect",function(O){(0,n.hebtLog)("EVENT: \u5355\u8DEF\u6D41\u91CD\u8FDE",O),A.emit("streamReconnect",O)}),this.peerCore.on("traceIdUpdate",function(O){(0,n.hebtLog)("EVENT: traceId",O),A.emit("traceIdUpdate",O)}),this.peerCore.on("pcReconnect",function(O){(0,n.hebtLog)("EVENT: PC\u91CD\u8FDE",O),A.emit("pcReconnect",O)}),this.peerCore.on("datachannelNotEnabled",function(){var O;(0,n.hebtLog)("EVENT: \u6570\u636E\u901A\u9053\u672A\u5F00\u542F"),A.stopHeartbeatTimeoutChecker(),(O=A.peerCore)===null||O===void 0||O.stopSignalHeartbeatTimer()})):(0,n.hebtLog)("PeerCore listeners registration failed.")},D.prototype.startHeartbeatTimeoutChecker=function(){var y=this;this.stopHeartbeatTimeoutChecker(),this.heartbeatTimeoutHandler=setInterval(function(){y.noHeartbeatCount++,y.noHeartbeatCount>=t.DEFAULT_HEARTBEAT_TIMEOUT&&((0,n.hebtLog)("EVENT: \u5FC3\u8DF3\u8D85\u65F6, PC\u91CD\u8FDE"),y.stopHeartbeatTimeoutChecker(),y.emit("pcReconnect",{recode:"",reMsg:"heartbeat timeout"}))},1e3)},D.prototype.stopHeartbeatTimeoutChecker=function(){this.heartbeatTimeoutHandler!==null&&clearInterval(this.heartbeatTimeoutHandler),this.heartbeatTimeoutHandler=null,this.noHeartbeatCount=0},D.CONNECT_TIMEOUT=1e4,D}(s.default);R.RtsPeerconnection=m;var T=function(){function C(){this.workerList=[]}return C.prototype.add=function(D){return!this.findByMsid({url:D.info.url,source:D.source,kind:D.kind,msid:D.kind===t.TrackType.VIDEO?D.info.vMsid:D.info.aMsid})&&(this.workerList.push(D),!0)},C.prototype.removeByUrl=function(D){var y=this;this.workerList.filter(function(A){return A.info.url.split("?")[0]===D.url.split("?")[0]&&A.source===D.source}).forEach(function(A){A.worker.terminate(),y.workerList=y.workerList.filter(function(O){return O!==A})})},C.prototype.removeByMsid=function(D){var y=this.findByMsid(D);y?(y.worker.terminate(),this.workerList=this.workerList.filter(function(A){return A!==y})):console.warn("no worker to remove")},C.prototype.findByUrl=function(D,y){return this.workerList.find(function(A){return A.info.url.split("?")[0]===D.split("?")[0]&&A.kind===y})},C.prototype.findByMsid=function(D){var y=D.url,A=D.kind,O=D.source,j=D.msid,I=A===t.TrackType.VIDEO?"vMsid":"aMsid";return this.workerList.find(function(H){return H.info.url.split("?")[0]===y.split("?")[0]&&H.source===O&&H.kind===A&&H.info[I]===j})},C.prototype.dispose=function(){this.workerList.forEach(function(D){D.worker.terminate()}),this.workerList=[]},C}()},2825:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0})},8156:function(L,R,x){var v=this&&this.__createBinding||(Object.create?function(a,d,p,e){e===void 0&&(e=p);var r=Object.getOwnPropertyDescriptor(d,p);r&&!("get"in r?!d.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return d[p]}}),Object.defineProperty(a,e,r)}:function(a,d,p,e){e===void 0&&(e=p),a[e]=d[p]}),c=this&&this.__exportStar||function(a,d){for(var p in a)p==="default"||Object.prototype.hasOwnProperty.call(d,p)||v(d,a,p)};Object.defineProperty(R,"__esModule",{value:!0}),R.EDatachannelStatus=R.EConnectStatus=R.AliRTS=void 0,x(9543);var u=x(4845);Object.defineProperty(R,"AliRTS",{enumerable:!0,get:function(){return u.AliRTS}}),window&&(window.AliRTS=u.AliRTS);var S=x(5917);Object.defineProperty(R,"EConnectStatus",{enumerable:!0,get:function(){return S.EConnectStatus}});var f=x(280);Object.defineProperty(R,"EDatachannelStatus",{enumerable:!0,get:function(){return f.EDatachannelStatus}}),c(x(2825),R)},2672:(L,R)=>{var x;Object.defineProperty(R,"__esModule",{value:!0}),R.EN=void 0,function(v){v.MESSAGE_NOTSUPPORT_WEBRTC="not support webrtc",v.MESSAGE_BROWSER_NOTSUPPORT="browser not support",v.MESSAGE_BROWSER_VERSIONLOW="browser version too low",v.MESSAGE_NOTSUPPORT_H264="not support h264",v.MESSAGE_CREATEOFFER="create offer error"}(x||(R.EN=x={}))},2818:function(L,R,x){var v=this&&this.__assign||function(){return v=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++)for(var t in r=arguments[n])Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e},v.apply(this,arguments)},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R,"__esModule",{value:!0});var u,S=x(233),f=c(x(7028)),a=x(9428),d=c(x(2632));(function(e){e[e.UA=101]="UA",e[e.SUB_STATS=107]="SUB_STATS",e[e.PUB_STATS=108]="PUB_STATS",e[e.CONNECT_STATE_CHANGE=109]="CONNECT_STATE_CHANGE",e[e.START_PLAY=120]="START_PLAY",e[e.STOP_PLAY=121]="STOP_PLAY",e[e.SUBSCRIBE_START=125]="SUBSCRIBE_START",e[e.SUBSCRIBE_OK=126]="SUBSCRIBE_OK",e[e.FIRST_FRAME_TIME=137]="FIRST_FRAME_TIME",e[e.DC_HTTP_CONNECT=140]="DC_HTTP_CONNECT",e[e.DC_HTTP_CONNECT_OK=141]="DC_HTTP_CONNECT_OK",e[e.DC_SUB_ADD=142]="DC_SUB_ADD",e[e.DC_SUB_ADD_OK=143]="DC_SUB_ADD_OK",e[e.DC_CONNECT_STATE_CHANGE=144]="DC_CONNECT_STATE_CHANGE",e[e.DC_SUB_STOP=145]="DC_SUB_STOP",e[e.DC_SUB_STOP_OK=146]="DC_SUB_STOP_OK",e[e.DC_DISPOSE=147]="DC_DISPOSE",e[e.ERROR_INFO=150]="ERROR_INFO",e[e.DC_PUB_ADD=152]="DC_PUB_ADD",e[e.DC_PUB_ADD_OK=153]="DC_PUB_ADD_OK",e[e.DC_PUB_STOP=155]="DC_PUB_STOP",e[e.DC_PUB_STOP_OK=156]="DC_PUB_STOP_OK",e[e.RECONNECT=160]="RECONNECT",e[e.RECONNECT_PARAMS=161]="RECONNECT_PARAMS",e[e.RECONNECT_FINISH=162]="RECONNECT_FINISH",e[e.NOTIFY_MESSAGE=170]="NOTIFY_MESSAGE",e[e.CREATE_CLIENT=200]="CREATE_CLIENT",e[e.LOCALSTREAM_INITED=201]="LOCALSTREAM_INITED",e[e.START_PUBLISH=220]="START_PUBLISH",e[e.STOP_PUBLISH=221]="STOP_PUBLISH",e[e.PUBLISH_OK=222]="PUBLISH_OK",e[e.SET_VIDEOPROFILE=230]="SET_VIDEOPROFILE",e[e.SET_SCREENPROFILE=231]="SET_SCREENPROFILE",e[e.SET_AUDIOPROFILE=238]="SET_AUDIOPROFILE",e[e.ENABLE_AUDIO=232]="ENABLE_AUDIO",e[e.DISABLE_AUDIO=233]="DISABLE_AUDIO",e[e.ENABLE_VIDEO=234]="ENABLE_VIDEO",e[e.DISABLE_VIDEO=235]="DISABLE_VIDEO",e[e.STOP=236]="STOP",e[e.PLAY=237]="PLAY"})(u||(u={}));var p=function(){function e(r){this.customReporter=r?.customReporter,this.ct=r&&r.customTag?r.customTag:"",this.enableLog=!r||r.trackLog!=0,this._initParam(),this.slsTracker=new d.default({host:"cn-hangzhou.log.aliyuncs.com",project:"videocloud",logstore:"live-client-log",time:10,count:10})}return e.prototype.updateTid=function(){this.param?this.param.tid=S.Guid.create(32):this._initParam()},e.prototype.updateUrl=function(r){this.param&&(this.param.pu=r)},e.prototype.reportUA=function(r){this.reporter({msgid:u.UA,args:JSON.stringify({ua:r})})},e.prototype.reportPullStats=function(r){this.reporter({msgid:u.SUB_STATS,args:JSON.stringify(v({},r))})},e.prototype.reportPushStats=function(r){this.reporter({msgid:u.PUB_STATS,args:JSON.stringify(v({},r))})},e.prototype.reportStartPlay=function(r){this.reporter({msgid:u.START_PLAY,args:JSON.stringify({vurl:r})})},e.prototype.reportStopPlay=function(){this.reporter({msgid:u.STOP_PLAY})},e.prototype.reportSubscribeStart=function(r,n,s,t,i){this.reporter({msgid:u.SUBSCRIBE_START,args:JSON.stringify({vurl:r,surl:n,vMsid:s?s.join(", "):"",aMsid:t?t.join(", "):"",isSubAdd:!!i})})},e.prototype.reportSubscribeOk=function(r){r===void 0&&(r={}),this.reporter({msgid:u.SUBSCRIBE_OK,args:JSON.stringify({vurl:r.vurl||"",surl:r.surl||"",hrct:r.hrct,tcid:r.traceId,rslt:r.rslt,isSubAdd:!!r.isSubAdd})})},e.prototype.reportFirstFrameTime=function(r,n,s,t,i,l,E,b,_,h,o,g,m,T){this.reporter({msgid:u.FIRST_FRAME_TIME,args:JSON.stringify({vurl:r,cpct:s,hrct:t,tcid:n,ffct:i,rslt:l,cnct:E,stats:b,delct:_,addct:h,actct:o,vMsid:g?g.join(", "):"",aMsid:m?m.join(", "):"",isSubAdd:!!T})})},e.prototype.reportErrorInfo=function(r,n,s,t){r!==a.ErrorCode.ERROR_AUTOPLAY_ERROR&&this.reporter({msgid:u.ERROR_INFO,args:JSON.stringify({errorCode:r,message:n,tcid:s,extraInfo:t})})},e.prototype.reportReconnect=function(r,n,s,t,i){this.reporter({msgid:u.RECONNECT,args:JSON.stringify({errorCode:r,message:n,tcid:s,retryTimes:t,useTcp:i})})},e.prototype.reportReconnectParams=function(r,n,s,t,i,l){this.reporter({msgid:u.RECONNECT_PARAMS,args:JSON.stringify({type:r,url:n,vMsid:(s||[]).join(","),aMsid:(t||[]).join(","),useTcp:i,streamId:l})})},e.prototype.reportReconnectFinish=function(r){r===void 0&&(r={}),this.reporter({msgid:u.RECONNECT_FINISH,args:JSON.stringify(v({},r))})},e.prototype.reportCreateClient=function(){this.reporter({msgid:u.CREATE_CLIENT})},e.prototype.reportStartPublish=function(r,n,s){this.reporter({msgid:u.START_PUBLISH,args:JSON.stringify({purl:r,surl:n,isPubAdd:!!s})})},e.prototype.reportPublishOk=function(r,n,s,t,i,l,E,b){this.reporter({msgid:u.PUBLISH_OK,args:JSON.stringify({purl:r,surl:n,coct:s,hrct:t,act:i,tcid:l,totalct:E||s+t+i,isPubAdd:!!b})})},e.prototype.reportStopPublish=function(r,n){this.reporter({msgid:u.STOP_PUBLISH,args:JSON.stringify({url:r,isPubStop:!!n})})},e.prototype.reportVideoProfile=function(r){this.reporter({msgid:u.SET_VIDEOPROFILE,args:JSON.stringify({vp:r})})},e.prototype.reportScreenProfile=function(r){this.reporter({msgid:u.SET_SCREENPROFILE,args:JSON.stringify({sp:r})})},e.prototype.reportAudioProfile=function(r){this.reporter({msgid:u.SET_AUDIOPROFILE,args:JSON.stringify({vp:r})})},e.prototype.reportEnableAudio=function(){this.reporter({msgid:u.ENABLE_AUDIO})},e.prototype.reportDisableAudio=function(){this.reporter({msgid:u.DISABLE_AUDIO})},e.prototype.reportEnableVideo=function(){this.reporter({msgid:u.ENABLE_VIDEO})},e.prototype.reportDisableVideo=function(){this.reporter({msgid:u.DISABLE_VIDEO})},e.prototype.reportStop=function(r){this.reporter({msgid:u.STOP,args:JSON.stringify({tp:r})})},e.prototype.reportPlay=function(r){this.reporter({msgid:u.PLAY,args:JSON.stringify({tp:r})})},e.prototype.reportStreamCreated=function(r,n){this.reporter({msgid:u.LOCALSTREAM_INITED,args:JSON.stringify({userConfig:r,localStreamInfo:n})})},e.prototype.reportConnectionChange=function(r,n){this.reporter({msgid:u.CONNECT_STATE_CHANGE,args:JSON.stringify({connectionState:r,direction:n})})},e.prototype.reportDatachannelHttpConnect=function(r){this.reporter({msgid:u.DC_HTTP_CONNECT,args:JSON.stringify({url:r})})},e.prototype.reportDatachannelHttpConnectOk=function(r){this.reporter({msgid:u.DC_HTTP_CONNECT_OK,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelSubAdd=function(r){this.reporter({msgid:u.DC_SUB_ADD,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelPubAdd=function(r){this.reporter({msgid:u.DC_PUB_ADD,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelSubAddOk=function(r){this.reporter({msgid:u.DC_SUB_ADD_OK,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelPubAddOk=function(r){this.reporter({msgid:u.DC_PUB_ADD_OK,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelStatusChange=function(r){this.reporter({msgid:u.DC_CONNECT_STATE_CHANGE,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelSubStop=function(r){this.reporter({msgid:u.DC_SUB_STOP,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelPubStop=function(r){this.reporter({msgid:u.DC_PUB_STOP,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelSubStopOk=function(r){this.reporter({msgid:u.DC_SUB_STOP_OK,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelPubStopOk=function(r){this.reporter({msgid:u.DC_PUB_STOP_OK,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelDispose=function(r){this.reporter({msgid:u.DC_DISPOSE,args:JSON.stringify(v({},r))})},e.prototype.reportNotifyMessage=function(r){this.reporter({msgid:u.NOTIFY_MESSAGE,args:JSON.stringify(v({},r))})},e.prototype._initParam=function(){this.param||(this.param={APIVersion:"0.6.0",os:S.SystemUtil.platform,osv:S.SystemUtil.systemVersion,bt:S.BrowserUtil.browserName,bv:S.BrowserUtil.browserVersion,host:window.location.origin,page:window.location.href,uid:S.LocalStorage.uuid,tid:S.Guid.create(32),ver:f.default.version,ct:this.ct,dt:"",lv:"1.0.0",ua:navigator&&navigator.userAgent||"",pu:""})},e.prototype.reporter=function(r){var n=v(v(v(v({},this.param||{}),{tm:new Date().getTime()}),r||{}),{msgname:u[r.msgid]});if(this.customReporter&&typeof this.customReporter=="function")try{this.customReporter(n)}catch(s){console.error("[Error in customReporter] ",s)}this.enableLog&&this.slsTracker.send(n)},e.prototype.data2String=function(r){var n="";for(var s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=s+"="+r[s]);return n},e.HEARTHEAT_INTERVAL=4,e}();R.default=p},7668:function(L,R,x){var v,c=this&&this.__extends||(v=function(g,m){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,C){T.__proto__=C}||function(T,C){for(var D in C)Object.prototype.hasOwnProperty.call(C,D)&&(T[D]=C[D])},v(g,m)},function(g,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");function T(){this.constructor=g}v(g,m),g.prototype=m===null?Object.create(m):(T.prototype=m.prototype,new T)}),u=this&&this.__assign||function(){return u=Object.assign||function(g){for(var m,T=1,C=arguments.length;T<C;T++)for(var D in m=arguments[T])Object.prototype.hasOwnProperty.call(m,D)&&(g[D]=m[D]);return g},u.apply(this,arguments)},S=this&&this.__awaiter||function(g,m,T,C){return new(T||(T=Promise))(function(D,y){function A(I){try{j(C.next(I))}catch(H){y(H)}}function O(I){try{j(C.throw(I))}catch(H){y(H)}}function j(I){var H;I.done?D(I.value):(H=I.value,H instanceof T?H:new T(function(F){F(H)})).then(A,O)}j((C=C.apply(g,m||[])).next())})},f=this&&this.__generator||function(g,m){var T,C,D,y,A={label:0,sent:function(){if(1&D[0])throw D[1];return D[1]},trys:[],ops:[]};return y={next:O(0),throw:O(1),return:O(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function O(j){return function(I){return function(H){if(T)throw new TypeError("Generator is already executing.");for(;y&&(y=0,H[0]&&(A=0)),A;)try{if(T=1,C&&(D=2&H[0]?C.return:H[0]?C.throw||((D=C.return)&&D.call(C),0):C.next)&&!(D=D.call(C,H[1])).done)return D;switch(C=0,D&&(H=[2&H[0],D.value]),H[0]){case 0:case 1:D=H;break;case 4:return A.label++,{value:H[1],done:!1};case 5:A.label++,C=H[1],H=[0];continue;case 7:H=A.ops.pop(),A.trys.pop();continue;default:if(D=A.trys,!((D=D.length>0&&D[D.length-1])||H[0]!==6&&H[0]!==2)){A=0;continue}if(H[0]===3&&(!D||H[1]>D[0]&&H[1]<D[3])){A.label=H[1];break}if(H[0]===6&&A.label<D[1]){A.label=D[1],D=H;break}if(D&&A.label<D[2]){A.label=D[2],A.ops.push(H);break}D[2]&&A.ops.pop(),A.trys.pop();continue}H=m.call(g,A)}catch(F){H=[6,F],C=0}finally{T=D=0}if(5&H[0])throw H[1];return{value:H[0]?H[1]:void 0,done:!0}}([j,I])}}},a=this&&this.__rest||function(g,m){var T={};for(var C in g)Object.prototype.hasOwnProperty.call(g,C)&&m.indexOf(C)<0&&(T[C]=g[C]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function"){var D=0;for(C=Object.getOwnPropertySymbols(g);D<C.length;D++)m.indexOf(C[D])<0&&Object.prototype.propertyIsEnumerable.call(g,C[D])&&(T[C[D]]=g[C[D]])}return T},d=this&&this.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(R,"__esModule",{value:!0}),R.RtsClient=void 0;var p=d(x(102)),e=x(5917),r=x(5676),n=x(9796),s=x(6600),t=d(x(2818)),i=d(x(7028)),l=x(7989),E=x(280),b=x(9428),_=x(5044),h=x(2470),o=function(g){function m(T){var C,D=g.call(this)||this;return D.pullH264Checked=!1,D.lastProtocol="udp",D.usePcReconnect=!1,D.reporter=new t.default(T),D.subscriber=new r.Subscriber(D.reporter,T?T.playConfig:void 0),D.publisher=new n.Publisher(D.reporter),D.commonController=new s.CommonController(D.reporter),D.pcRestorer=new h.PcRestorer({subscriber:D.subscriber,publisher:D.publisher,commonController:D.commonController}),D.usePcReconnect=!!(!((C=T?.singlePcConfig)===null||C===void 0)&&C.usePcReconnect),D.subscriber.on("onError",function(y){return S(D,void 0,void 0,function(){var A,O,j,I,H,F,U,B,k,V,G=this;return f(this,function(q){switch(q.label){case 0:return A=(j=y.extraInfo)===null||j===void 0?void 0:j.response,this.reporter.reportErrorInfo(y.errorCode,y.message,y.traceId,{sdp:(I=y.extraInfo)===null||I===void 0?void 0:I.sdp,response:{status:A?.status,data:A?.data},pcErrorInfo:(H=y.extraInfo)===null||H===void 0?void 0:H.pcErrorInfo}),this.usePcReconnect?[3,5]:b.SUB_RECONNECT_ERROR_LIST.includes(y.errorCode)?this.subscriber.isConnecting?[3,2]:(O=this.lastProtocol==="udp",this.lastProtocol=O?"tcp":"udp",console.log("retrying with",this.lastProtocol),[4,this.subscriber.retrySubscribe(y,{innerTcpOnly:O})]):[3,3];case 1:q.sent()?(this.reporter.reportReconnect(y.errorCode,y.message,y.traceId,(F=y.extraInfo)===null||F===void 0?void 0:F.retryTimes,O),this.emit("reconnect",this.makeReconnectEvent("sub",y))):this.emit("onError",y),q.label=2;case 2:return[3,4];case 3:this.emit("onError",y),q.label=4;case 4:return[3,6];case 5:[b.ErrorCode.ERROR_PC_DISCONNECTED,b.ErrorCode.ERROR_IP_MIGRATE].includes(y.errorCode)&&(this.pcRestorer.isReconnecting()||(y.extraInfo=u(u({},y.extraInfo),{retryTimes:1}),this.reporter.reportReconnect(y.errorCode,y.message,y.traceId,(U=y.extraInfo)===null||U===void 0?void 0:U.retryTimes),this.emit("reconnect",this.makeReconnectEvent("sub",y)),this.emit("connectStatusChange",{status:e.EConnectStatus.CONNECT_STATUS_RECONNECTING}),(V=(k=this.pcRestorer.restore((B=y.extraInfo.pcErrorInfo)===null||B===void 0?void 0:B.ips))===null||k===void 0?void 0:k.then(function(){G.reporter.reportReconnectFinish({level:"pc"}),G.emit("reconnectFinish")}))===null||V===void 0||V.catch(function(z){var $=new _.RtsError(b.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED,"pc full reconnect failed","",{originError:z});G.emit("onError",$),G.reporter.reportErrorInfo($.errorCode,$.message)}))),q.label=6;case 6:return[2]}})})}),D.subscriber.on("reconnect",function(y){var A;D.reporter.reportReconnect(y.errorCode,y.message,y.traceId,(A=y.extraInfo)===null||A===void 0?void 0:A.retryTimes),D.emit("reconnect",D.makeReconnectEvent("sub",y))}),D.subscriber.on("onPlayEvent",function(y){D.emit("onPlayEvent",y)}),D.subscriber.on("connectStatusChange",function(y){D.emit("connectStatusChange",y),D.reporter.reportConnectionChange(e.EConnectStatus[y.status],"sub")}),D.publisher.on("connectStatusChange",function(y){D.emit("connectStatusChange",y),D.reporter.reportConnectionChange(e.EConnectStatus[y.status],"pub")}),D.publisher.on("onError",function(y){return S(D,void 0,void 0,function(){var A,O,j,I,H,F,U,B,k,V,G,q=this;return f(this,function(z){switch(z.label){case 0:return A=(j=y.extraInfo)===null||j===void 0?void 0:j.response,this.reporter.reportErrorInfo(y.errorCode,y.message,y.traceId,{sdp:(I=y.extraInfo)===null||I===void 0?void 0:I.sdp,response:{status:A?.status,data:A?.data},pcErrorInfo:(H=y.extraInfo)===null||H===void 0?void 0:H.pcErrorInfo}),this.usePcReconnect?[3,5]:b.PUB_RECONNECT_ERROR_LIST.includes(y.errorCode)?this.publisher.isConnecting?[3,2]:(O=y.errorCode===b.ErrorCode.ERROR_TRANSPORT_CLOSED&&((F=y.extraInfo)===null||F===void 0?void 0:F.protocol)!=="tcp",console.log("Retrying with ",O?"TCP":"UDP"),[4,this.publisher.retryPublish(y,O)]):[3,3];case 1:z.sent()?(this.reporter.reportReconnect(y.errorCode,y.message,y.traceId,(U=y.extraInfo)===null||U===void 0?void 0:U.retryTimes,O),this.emit("reconnect",this.makeReconnectEvent("pub",y))):this.emit("onError",y),z.label=2;case 2:return[3,4];case 3:this.emit("onError",y),z.label=4;case 4:return[3,6];case 5:[b.ErrorCode.ERROR_PC_DISCONNECTED,b.ErrorCode.ERROR_IP_MIGRATE].includes(y.errorCode)&&(this.pcRestorer.isReconnecting()||(y.extraInfo=u(u({},y.extraInfo),{retryTimes:1}),this.reporter.reportReconnect(y.errorCode,y.message,y.traceId,(B=y.extraInfo)===null||B===void 0?void 0:B.retryTimes),this.emit("reconnect",this.makeReconnectEvent("pub",y)),this.emit("connectStatusChange",{status:e.EConnectStatus.CONNECT_STATUS_RECONNECTING}),(G=(V=this.pcRestorer.restore((k=y.extraInfo.pcErrorInfo)===null||k===void 0?void 0:k.ips))===null||V===void 0?void 0:V.then(function(){q.reporter.reportReconnectFinish({level:"pc"}),q.emit("reconnectFinish")}))===null||G===void 0||G.catch(function($){var re=new _.RtsError(b.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED,"pc full reconnect failed","",{originError:$});q.emit("onError",re),q.reporter.reportErrorInfo(re.errorCode,re.message)}))),z.label=6;case 6:return[2]}})})}),D.publisher.on("reconnect",function(y){var A;D.reporter.reportReconnect(y.errorCode,y.message,y.traceId,(A=y.extraInfo)===null||A===void 0?void 0:A.retryTimes),D.emit("reconnect",D.makeReconnectEvent("pub",y))}),D.commonController.on("connectStatusChange",function(y){D.emit("connectStatusChange",y),D.reporter.reportConnectionChange(e.EConnectStatus[y.status],"signalChannel")}),D.commonController.on("onError",function(y){D.reporter.reportErrorInfo(y.errorCode,y.message,y.traceId),D.emit("onError",y)}),D.commonController.on("datachannelStatusChange",function(y){D.emit("datachannelStatusChange",y),D.reporter.reportDatachannelStatusChange({state:E.EDatachannelStatus[y.status],url:"",label:"SIGNAL",id:-1,msid:""})}),D.commonController.on("encodedFrame",function(y){D.emit("encodedFrame",y)}),D.commonController.on("receivedSEI",function(y){D.emit("receivedSEI",y)}),D.commonController.on("onPlayEvent",function(y){D.emit("onPlayEvent",y)}),D.commonController.on("reconnect",function(y){y.type!=="pc"&&D.emit("reconnect",y)}),D.commonController.on("reconnectFinish",function(y){D.reporter.reportReconnectFinish(y),D.emit("reconnectFinish",y)}),D.commonController.on("traceId",function(y){D.emit("traceId",y)}),D.commonController.on("heartbeat",function(y){D.emit("heartbeat",y)}),D.reporter.reportCreateClient(),D}return c(m,g),m.prototype.getVersion=function(){return i.default.version},m.prototype.isSupport=function(T){var C=new l.SupportUtil;return this.pullH264Checked=!0,C.isSupport(T)},m.prototype.checkPublishSupport=function(){return new l.SupportUtil().checkPublishSupport()},m.prototype.checkEncodedTransformSupport=function(){return new l.SupportUtil().checkEncodedTransformSupport()},m.prototype.subscribe=function(T,C){return this.reporter.updateUrl(T),this.commonController.setPeerconnection(this.subscriber.getPeerConnection()),this.subscriber.resetResubscribeStatus(),this.subscriber.subscribeWithReconnect(T,u(u({},C),{isH264Checked:this.pullH264Checked}))},m.prototype.subscribeAdd=function(T){return this.commonController.subscribeAdd(T)},m.prototype.subscribeActive=function(T){return this.commonController.subscribeActive(T)},m.prototype.subscribeDeleteTracks=function(T){return this.commonController.subscribeDeleteTracks(T)},m.prototype.subscribeStop=function(T){return this.commonController.subscribeStop(T)},m.prototype.publishAdd=function(T){return this.commonController.publishAdd(T)},m.prototype.publishDeleteTracks=function(T){return this.commonController.publishDeleteTracks(T)},m.prototype.publishReplaceTracks=function(T){return this.commonController.publishReplaceTracks(T)},m.prototype.publishStop=function(T){return this.commonController.publishStop(T)},m.prototype.subscribeAddDatachannel=function(T){return this.commonController.subscribeAddDatachannel(T)},m.prototype.subscribeStopDatachannel=function(T){return this.commonController.subscribeStopDatachannel(T)},m.prototype.publishAddDatachannel=function(T){return this.commonController.publishAddDatachannel(T)},m.prototype.publishStopDatachannel=function(T){return this.commonController.publishStopDatachannel(T)},m.prototype.unsubscribe=function(){this.subscriber.resetResubscribeStatus(),this.subscriber.unsubscribe()},m.prototype.startLiveStream=function(T,C,D){return this.reporter.reportStartPlay(T),this.subscriber.startLiveStream(T,C,D)},m.prototype.stopLiveStream=function(){this.reporter.reportStopPlay(),this.subscriber.stopLiveStream()},m.prototype.muteLiveStream=function(T){this.subscriber.muteLiveStream(T)},m.prototype.publish=function(T,C,D){return S(this,void 0,void 0,function(){return f(this,function(y){return this.reporter.updateUrl(T),this.commonController.setPeerconnection(this.publisher.getPeerConnection()),this.publisher.resetRepublishStatus(),[2,this.publisher.publishWithReconnect(T,C,D)]})})},m.prototype.unpublish=function(){return this.publisher.resetRepublishStatus(),this.publisher.unpublish()},m.prototype.sendSEI=function(T){this.publisher.sendSEI(T),this.commonController.sendSEI(T)},m.prototype.getPublishTrackInfoList=function(){return this.publisher.getTrackInfoList()},m.prototype.getTransportStats=function(){return this.subscriber.getPeerConnection().getSubMonitor().getTransportStats()},m.prototype.getRemoteVideoStats=function(){return this.subscriber.getPeerConnection().getSubMonitor().getRemoteVideoStats()},m.prototype.getRemoteAudioStats=function(){return this.subscriber.getPeerConnection().getSubMonitor().getRemoteAudioStats()},m.prototype.getSubscribeVideoStats=function(T,C){return this.commonController.getSubscribeVideoStats(T,C)},m.prototype.getSubscribeAudioStats=function(T,C){return this.commonController.getSubscribeAudioStats(T,C)},m.prototype.getPublishVideoStats=function(T,C){return this.commonController.getPublishVideoStats(T,C)},m.prototype.getPublishAudioStats=function(T,C){return this.commonController.getPublishAudioStats(T,C)},m.prototype.setReceiverCodecPreferences=function(T){return this.commonController.setReceiverCodecPreferences(T)},m.prototype.setSenderCodecPreferences=function(T){return this.commonController.setSenderCodecPreferences(T)},m.prototype.makeReconnectEvent=function(T,C){var D=C||{},y=D.extraInfo,A=a(D,["extraInfo"]),O=y||{},j=O.retryTimes,I=a(O,["retryTimes"]),H=T;return{type:this.usePcReconnect?"pc":H,reason:A,retryTimes:j,extraInfo:I}},m.prototype.heartbeat=function(T){var C;(C=this.commonController.peerCore)===null||C===void 0||C.sendOnceHeartbeat(T)},m.prototype.setAutoHeartbeat=function(T){var C;(C=this.commonController.peerCore)===null||C===void 0||C.startSignalHeartbeatTimer(T)},m.prototype.clearAutoHeartbeat=function(){var T;(T=this.commonController.peerCore)===null||T===void 0||T.stopSignalHeartbeatTimer()},m.prototype.sendFalseHeartbeat=function(T){var C;(C=this.commonController.peerCore)===null||C===void 0||C.sendFalseHeartbeat(T)},m.prototype.updateAuth=function(T){return this.commonController.updateAuth(T)},m}(p.default);R.RtsClient=o},335:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0});var x=function(){function v(c){this.useGainNode=!0,this.audioContext=new AudioContext,this.audioDestination=this.audioContext.createMediaStreamDestination(),this.audioSource=[],this.gainNode=null,this.audioTrack=null,this.audioTrackArr=c.trackList||[],this.useGainNode=typeof c.useGainNode!="boolean"||c.useGainNode,this.useGainNode&&(this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination),this.gainNode.gain.value=0),this.getMixedAudioTrack()}return v.prototype.destroy=function(){var c;(c=this.getMixedAudioTrack())===null||c===void 0||c.stop(),this.disconnectSourceNode(),this.audioContext.close(),this.audioTrackArr=[]},v.prototype.updateTrackList=function(c){c.length&&(this.disconnectSourceNode(),this.audioTrackArr=c,this.connectNode())},v.prototype.getMixedAudioTrack=function(){return this.audioTrack||(this.connectNode(),this.audioTrack=this.audioDestination.stream.getAudioTracks()[0]),this.audioTrack},v.prototype.connectNode=function(){var c=this;this.audioTrackArr.forEach(function(u){var S=new MediaStream;S.addTrack(u);var f=c.audioContext.createMediaStreamSource(S);c.gainNode&&f.connect(c.gainNode),c.audioSource.push(f)}),this.audioSource.forEach(function(u){u.connect(c.audioDestination)})},v.prototype.disconnectSourceNode=function(){var c=this;this.audioSource.forEach(function(u){c.gainNode&&u.disconnect(c.gainNode),u.disconnect(c.audioDestination)}),this.audioSource=[]},v}();R.default=x},1893:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.TwoDRenderer=void 0;var x=function(){function v(c){this.video=c.video,this.canvas=c.canvas,this.ctx=this.canvas.getContext("2d")}return v.prototype.render=function(){var c,u,S=this.video,f=this.canvas;S&&f&&((c=this.ctx)===null||c===void 0||c.clearRect(0,0,f.width,f.height),(u=this.ctx)===null||u===void 0||u.drawImage(S,0,0,1*S.videoWidth,1*S.videoHeight),this.requestId=requestAnimationFrame(this.render.bind(this)))},v.prototype.stop=function(){this.requestId&&cancelAnimationFrame(this.requestId)},v}();R.TwoDRenderer=x},6295:(L,R,x)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.CanvasRenderer=void 0;var v=x(1893),c=function(){function u(S){this.video=S.video,this.canvas=this.initCanvas(),this.activeRenderer=this.initRenderer()}return Object.defineProperty(u.prototype,"mediaStream",{get:function(){var S;return this.ms||(this.ms=((S=this.canvas)===null||S===void 0?void 0:S.captureStream())||void 0),this.ms},enumerable:!1,configurable:!0}),u.prototype.start=function(){this.render()},u.prototype.stop=function(){this.activeRenderer.stop()},u.prototype.initCanvas=function(){var S=document.createElement("canvas"),f=this.video;return S.width=1*f.videoWidth,S.height=1*f.videoHeight,S},u.prototype.initRenderer=function(){return new v.TwoDRenderer({video:this.video,canvas:this.canvas})},u.prototype.render=function(){this.activeRenderer.render()},u.prototype.resize=function(S,f){this.canvas&&(this.canvas.width=S,this.canvas.height=f)},u}();R.CanvasRenderer=c},6420:function(L,R,x){var v=this&&this.__awaiter||function(a,d,p,e){return new(p||(p=Promise))(function(r,n){function s(l){try{i(e.next(l))}catch(E){n(E)}}function t(l){try{i(e.throw(l))}catch(E){n(E)}}function i(l){var E;l.done?r(l.value):(E=l.value,E instanceof p?E:new p(function(b){b(E)})).then(s,t)}i((e=e.apply(a,d||[])).next())})},c=this&&this.__generator||function(a,d){var p,e,r,n,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function t(i){return function(l){return function(E){if(p)throw new TypeError("Generator is already executing.");for(;n&&(n=0,E[0]&&(s=0)),s;)try{if(p=1,e&&(r=2&E[0]?e.return:E[0]?e.throw||((r=e.return)&&r.call(e),0):e.next)&&!(r=r.call(e,E[1])).done)return r;switch(e=0,r&&(E=[2&E[0],r.value]),E[0]){case 0:case 1:r=E;break;case 4:return s.label++,{value:E[1],done:!1};case 5:s.label++,e=E[1],E=[0];continue;case 7:E=s.ops.pop(),s.trys.pop();continue;default:if(r=s.trys,!((r=r.length>0&&r[r.length-1])||E[0]!==6&&E[0]!==2)){s=0;continue}if(E[0]===3&&(!r||E[1]>r[0]&&E[1]<r[3])){s.label=E[1];break}if(E[0]===6&&s.label<r[1]){s.label=r[1],r=E;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(E);break}r[2]&&s.ops.pop(),s.trys.pop();continue}E=d.call(a,s)}catch(b){E=[6,b],e=0}finally{p=r=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}([i,l])}}},u=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(R,"__esModule",{value:!0}),R.Clock=void 0;var S=u(x(2505)),f=function(){function a(){this.request=S.default.create({timeout:6e4}),this.offset=0,this.nextAttemptMs=a.DEFAULT_ATTEMPT_INTERVAL,this.attemptCount=0,this.random=Math.random(),this.startSyncClock()}return a.prototype.now=function(){if(this.offset&&!Number.isNaN(this.offset)){var d=Date.now()+this.offset;return Math.round(d)}return console.warn("return Date.now()"),Date.now()},a.prototype.syncClock=function(){return v(this,void 0,void 0,function(){var d,p,e,r,n;return c(this,function(s){switch(s.label){case 0:return d=!1,p=Date.now(),[4,this.fetchServerTime()];case 1:return e=s.sent(),r=Date.now(),e?(n=new Date(e).getTime(),Number.isNaN(n)||(this.offset=this.calculateOffset(p+this.fixRequestStartTime(),r,n),d=!0)):console.warn("Failed to fetch server time, should try again"),[2,d]}})})},a.prototype.startSyncClock=function(){return v(this,void 0,void 0,function(){var d,p=this;return c(this,function(e){switch(e.label){case 0:return[4,this.syncClock()];case 1:return d=e.sent(),this.nextAttemptMs=d?a.DEFAULT_ATTEMPT_INTERVAL:a.DEFAULT_ATTEMPT_RETRY_INTERVAL,this.stopSyncClock(),this.attemptTimer=setTimeout(function(){p.startSyncClock()},this.nextAttemptMs),[2]}})})},a.prototype.stopSyncClock=function(){this.attemptTimer&&clearTimeout(this.attemptTimer),this.attemptTimer=void 0},a.prototype.fetchServerTime=function(){return v(this,void 0,void 0,function(){var d,p,e;return c(this,function(r){switch(r.label){case 0:this.attemptCount++,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.request.get(this.attachCount(a.DEFAULT_TIME_SOURCE))];case 2:return d=(e=r.sent())===null||e===void 0?void 0:e.data,[3,4];case 3:return p=r.sent(),console.log("GetServerTime error",p),[3,4];case 4:return[2,d]}})})},a.prototype.calculateOffset=function(d,p,e){return e-(p-(p-d)/2)},a.prototype.fixRequestStartTime=function(){var d=0,p=performance.getEntriesByName(this.attachCount(a.DEFAULT_TIME_SOURCE),"resource");if(p?.length)if(p.length>1)console.warn("multiple resource entries found");else try{var e=p[0];d=e.requestStart-e.startTime,e.domainLookupEnd,e.domainLookupStart,e.secureConnectionStart,e.connectStart,e.requestStart,e.secureConnectionStart}catch(r){console.log(r)}else console.warn("no resource entry found"),window.RTS_DISABLE_CLEAR_RESOURCE_TIMINGS||performance.clearResourceTimings();return Math.max(0,d||0)},a.prototype.attachCount=function(d){return"".concat(d,"&count=").concat(this.random,"_").concat(this.attemptCount)},a.DEFAULT_TIME_SOURCE="https://time.akamai.com/?iso&ms",a.DEFAULT_ATTEMPT_INTERVAL=3e4,a.DEFAULT_ATTEMPT_RETRY_INTERVAL=5e3,a}();R.Clock=f},102:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0});var x=function(){function v(){this._eventMap={}}return v.prototype.listeners=function(c){return this._eventMap[c]||[]},v.prototype.emit=function(c){for(var u=this,S=[],f=1;f<arguments.length;f++)S[f-1]=arguments[f];var a=this._eventMap[c];return!!Array.isArray(a)&&(a.forEach(function(d){return d.apply(u,S)}),!0)},v.prototype.off=function(c,u){var S=this._eventMap[c];return Array.isArray(S)&&(this._eventMap[c]=S.filter(function(f){return f!==u})),this},v.prototype.removeAllListeners=function(c){return c===void 0?this._eventMap={}:this._eventMap[c]&&(this._eventMap[c]=[]),this},v.prototype.on=function(c,u){return this._eventMap[c]?this._eventMap[c].push(u):this._eventMap[c]=[u],this},v.prototype.once=function(c,u){var S=this,f=function(){for(var a=[],d=0;d<arguments.length;d++)a[d]=arguments[d];S.off(c,f),u.apply(S,a)};return this.on(c,f),this},v}();R.default=x},492:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.MediaObserver=void 0;var x=function(){function v(c){this.timeout=c.timeout||v.DEFAULT_TIMEOUT,this.handler=c.handler||function(){},this.watchTimer=null}return Object.defineProperty(v.prototype,"actTimeout",{get:function(){return this.timeout},enumerable:!1,configurable:!0}),v.prototype.check=function(c,u,S,f){var a=this;this.hasNoData(c)?this.watchTimer||(this.watchTimer=window.setTimeout(function(){a.handler(u,S,f)},this.timeout)):this.watchTimer&&(clearTimeout(this.watchTimer),this.watchTimer=null)},v.prototype.hasNoData=function(c){return!c||(c.video?!(Number(c.video.bytesReceivedPerSecond)>0):!c.audio||!(Number(c.audio.bytesReceivedPerSecond)>0))},v.prototype.updateConfig=function(c){this.timeout=c.timeout||this.timeout,this.handler=c.handler||this.handler},v.prototype.reset=function(){this.watchTimer&&(clearTimeout(this.watchTimer),this.watchTimer=null)},v.prototype.dispose=function(){this.timeout=v.DEFAULT_TIMEOUT,this.handler=function(){},this.watchTimer&&(clearTimeout(this.watchTimer),this.watchTimer=null)},v.DEFAULT_TIMEOUT=6e3,v}();R.MediaObserver=x},9594:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.readUUID=R.discardEPB=R.insertEPB=R.SODBtoRBSP=R.convertPayloadSize=R.NALU=R.SEI=R.parseSei=R.insertSei=void 0,R.insertSei=function(c,u,S,f){S===void 0&&(S=5);for(var a=c.data,d=new DataView(a),p=0;;){if(d.getUint32(p)===1){d.getUint8(p+4);var e=new x(u,S,f).buffer,r=new v(e).buffer,n=new ArrayBuffer(r.byteLength+a.byteLength),s=new Uint8Array(n),t=new Uint8Array(r);s.set(t);var i=new Uint8Array(a);s.set(i,r.byteLength),c.data=n,p+=1;break}if((p+=1)+4>=d.byteLength)break}},R.parseSei=function(c){for(var u=[],S=new DataView(c),f=0;;){var a=f,d=S.getUint32(a);if(a+=4,d===1){if((31&S.getUint8(a++))===6){for(var p=S.getUint8(a++),e=p===5?16:0,r=0;S.getUint8(a)==255;)a++,r+=255;if((r+=S.getUint8(a++))>0&&S.byteLength>a+r){var n=new Uint8Array(S.buffer),s="";if(p===5){var t=n.slice(a,a+e);s=(0,R.readUUID)((0,R.discardEPB)(t))}var i=n.slice(a+e,a+r);a+=r,u.push({payloadType:p,uuid:s,data:i.buffer})}}f=a}else f+=1;if(f+4>=S.byteLength)break}return u};var x=function(c,u,S){u===void 0&&(u=5);var f=u===5?16:0,a=c.byteLength+f,d=(0,R.convertPayloadSize)(a),p=d.buffer.byteLength,e=new ArrayBuffer(1+p+f+c.byteLength),r=new Uint8Array(e),n=0;if(r[n++]=u,r.set(d,n),n+=d.byteLength,u===5){S=(S||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var s=0;s<16;s++)r[n+s]=parseInt(S.substr(2*s,2),16);n+=16}var t=new Uint8Array(c);r.set(t,n);var i=(0,R.SODBtoRBSP)(r);this.buffer=i.buffer};R.SEI=x;var v=function(c){var u=new Uint8Array([0,0,0,1]),S=new Uint8Array([6]),f=new ArrayBuffer(u.byteLength+S.byteLength+c.byteLength),a=new Uint8Array(f);a.set(u),a.set(S,u.byteLength),a.set(new Uint8Array(c),u.byteLength+S.byteLength),this.buffer=f};R.NALU=v,R.convertPayloadSize=function(c){if(c<=0)throw new Error("payloadSize must be a positive integer.");for(var u=Math.ceil(c/255),S=new ArrayBuffer(u),f=new DataView(S),a=0;a<u-1;a++)f.setUint8(a,255);return f.setUint8(u-1,c%255&255),new Uint8Array(S)},R.SODBtoRBSP=function(c){for(var u=new Uint8Array(c),S="",f=0;f<u.length;f++)S+=u[f].toString(2).padStart(8,"0");for(S+="1";S.length%8!=0;)S+="0";var a=S.length/8,d=new Uint8Array(a);for(f=0;f<a;f++)d[f]=parseInt(S.slice(8*f,8*f+8),2);return(0,R.insertEPB)(d)},R.insertEPB=function(c){for(var u=[],S=0,f=0;f<c.length;f++)u.push(c[f]),c[f]===0?++S===2&&f<c.length-1&&c[f+1]<=3&&(u.push(3),S=0):S=0;return new Uint8Array(u)},R.discardEPB=function(c){for(var u=c.byteLength,S=[],f=1;f<u-2;)c[f]===0&&c[f+1]===0&&c[f+2]===3?(S.push(f+2),f+=2):f++;if(S.length===0)return c;var a=u-S.length,d=new Uint8Array(a),p=0;for(f=0;f<a;p++,f++)p===S[0]&&(p++,S.shift()),d[f]=c[p];return d},R.readUUID=function(c){if(c.length!==16)throw new Error("UUID must be 16 bytes long.");var u=c.reduce(function(S,f){return S+f.toString(16).padStart(2,"0")},"");return"".concat(u.slice(0,8),"-").concat(u.slice(8,12),"-").concat(u.slice(12,16),"-").concat(u.slice(16,20),"-").concat(u.slice(20))}},8219:function(L,R,x){var v=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(R,"__esModule",{value:!0});var c=v(x(2505));R.default=c.default.create({baseURL:"",timeout:5e3,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}})},4315:function(L,R,x){var v=this&&this.__spreadArray||function(f,a,d){if(d||arguments.length===2)for(var p,e=0,r=a.length;e<r;e++)!p&&e in a||(p||(p=Array.prototype.slice.call(a,0,e)),p[e]=a[e]);return f.concat(p||Array.prototype.slice.call(a))};Object.defineProperty(R,"__esModule",{value:!0}),R.SdpUtil=void 0;var c=x(233),u=function(){this.stramId="",this.audioTrackId="",this.videoTrackId="",this.screenTrackId="",this.customTrackId=""},S=function(){function f(a){this.sdpLines=new Array,this.localStream=a,this.publishStreamInfo=new u}return Object.defineProperty(f.prototype,"sdp",{get:function(){return this.sdpLines.join(`\r
153
+ [PROTOCOL] `).concat(H?"TCP":"UDP"))):(this.reporter.reportReconnectParams("sub"),this.subReconnectTimes=1/0),[3,4];case 3:return F=U.sent(),console.error("Error in beforeRetry",F),[3,4];case 4:return this.hasRetries()?(this.emit("connectStatusChange",{status:e.EConnectStatus.CONNECT_STATUS_RECONNECTING}),this.incrementReconnectTimes(),C.extraInfo.retryTimes=this.subReconnectTimes,C.extraInfo.tcpOnly=D?.innerTcpOnly,this.subscribeWithReconnect(this.noParsePullStreamUrl,u({innerTcpOnly:D?.innerTcpOnly},this.subscribeConfig)).catch(function(B){}),[2,!0]):(C.extraInfo.retryTimes=this.subReconnectTimes,[2,!1])}})})},T.prototype.subscribeWithReconnect=function(C,D,y,A){var w=this;return new Promise(function(j,I){j=y||j,I=A||I,w.isConnecting=!0;var H=(D||{}).innerTcpOnly;D==null||delete D.innerTcpOnly,w.subscribe(C,D,{innerTcpOnly:H}).then(function(F){w.isConnecting=!1,j(F)}).catch(function(F){var U;if(!w.isConnecting)return I(F);if(!r.RECONNECT_ERROR_EXCLUDE_LIST.includes(F.errorCode)&&w.hasRetries(!0)){var B=((U=w.subscribeConfig)===null||U===void 0?void 0:U.retryInterval)||e.DEFAULT_RETRY_SUBSCRIBE_INTERVAL;w.reconnectTimerHandle=setTimeout(function(){F.extraInfo=u(u({},F.extraInfo),{retryTimes:w.subReconnectTimes}),w.emit("reconnect",F),w.subscribeWithReconnect(C,D,j,I)},B)}else I(F),F.extraInfo=u(u({},F.extraInfo),{retryTimes:w.subReconnectTimes}),w.isConnecting=!1,w.emit("onError",F)})})},T.prototype.hasRetries=function(C){var D,y,A=e.DEFAULT_RETRY_SUBSCRIBE_LIMIT;typeof((D=this.subscribeConfig)===null||D===void 0?void 0:D.retryTimes)=="number"&&(A=Math.floor((y=this.subscribeConfig)===null||y===void 0?void 0:y.retryTimes));var w=this.subReconnectTimes<A;return C&&w&&this.incrementReconnectTimes(),w},T.prototype.resetResubscribeStatus=function(){this.subReconnectTimes=0,this.isConnecting=!1,this.reporter.updateTid(),this.reconnectTimerHandle!==null&&(clearTimeout(this.reconnectTimerHandle),this.reconnectTimerHandle=null)},T.prototype.handlePubMonitorEvent=function(C){var D=this;C.forEach(function(y){D.reporter.reportPushStats(y)})},T.prototype.incrementReconnectTimes=function(){this.subReconnectTimes++},T.prototype.getSubscribeConfig=function(){return this.subscribeConfig},T}(s.default);R.Subscriber=g},6901:function(L,R,x){var v,c=this&&this.__extends||(v=function(f,a){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,p){d.__proto__=p}||function(d,p){for(var e in p)Object.prototype.hasOwnProperty.call(p,e)&&(d[e]=p[e])},v(f,a)},function(f,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function d(){this.constructor=f}v(f,a),f.prototype=a===null?Object.create(a):(d.prototype=a.prototype,new d)});Object.defineProperty(R,"__esModule",{value:!0}),R.AudioReceiverMonitorData=void 0;var u=x(1353),S=function(f){function a(){return f.call(this,u.ReceiverMonitorType.AUDIO)||this}return c(a,f),a}(u.ReceiverMonitorData);R.AudioReceiverMonitorData=S},1353:function(L,R,x){var v,c=this&&this.__extends||(v=function(e,r){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&(n[t]=s[t])},v(e,r)},function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}v(e,r),e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}),u=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R,"__esModule",{value:!0}),R.ReceiverMonitorData=R.ReceiverMonitorType=void 0;var S,f=x(233),a=u(x(102)),d=x(2688);(function(e){e.AUDIO="audio",e.VIDEO="video"})(S||(R.ReceiverMonitorType=S={}));var p=function(e){function r(n){var s=e.call(this)||this;return s.streamEnded=!1,s.currentTimeGap=0,s.lastTimeStamp=0,s.transportStats={},s.remoteCandidate={},s.localCandidate={},s.inboundRtpStreamStats={},s.inboundRtpStreamStatsDiff={},s.receiver=null,s.pc=null,s.canplay=!1,s.type=n,s}return c(r,e),Object.defineProperty(r.prototype,"rtpReceiver",{set:function(n){this.receiver=n},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"RTCPeerconnection",{set:function(n){this.pc=n},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isExist",{get:function(){return this.receiver!=null},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isPlaying",{get:function(){return this.canplay},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"isStreamEnded",{get:function(){return this.streamEnded},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"monitorData",{get:function(){var n=this.inboundRtpStreamStatsDiff||{},s=(this.inboundRtpStreamStats,this.currentTimeGap),t=0;return n.nackCount!==void 0&&n.packetsReceived!==void 0&&(t=Math.round(n.nackCount/(n.packetsReceived+n.nackCount)*1e3)/1e3),{inboundRtpStats:this.inboundRtpStreamStats,inboundRtpStatsPerSec:{bytesReceivedPerSecond:n.bytesReceived/s||0,framesDecodedPerSecond:n.framesDecoded/s||0,packetsLostRate:t>0?t:0},transportStats:this.transportStats,remoteCandidate:this.remoteCandidate,localCandidate:this.localCandidate}},enumerable:!1,configurable:!0}),r.prototype.getInfo=function(){var n=this;if(this.receiver&&this.receiver.transport&&this.receiver.transport.state==="closed"&&this.canplay&&(this.streamEnded=!0,this.emit("streamEnded"),this.canplay=!1),this.receiver&&"getStats"in this.receiver||this.pc&&"getStats"in this.pc)return new Promise(function(s,t){var i=null,l=!1;n.receiver&&"getStats"in n.receiver?i=n.receiver.getStats():n.pc&&"getStats"in n.pc&&(i=n.pc.getStats(),l=!0),i?.then(function(E){E.forEach(function(b){var _,h;if(b)switch(b.type){case d.RTCStatsType.CandidatePair:n.onCandidatePair(b);break;case d.RTCStatsType.InboundRtp:f.SystemUtil.isIos&&l?!((_=b.id)===null||_===void 0)&&_.toLowerCase().includes(n.type)&&n.onInBoundRtp(b):f.BrowserUtil.isFirefox?b.kind===n.type&&n.onInBoundRtp(b):n.onInBoundRtp(b);break;case d.RTCStatsType.RemoteCandidate:n.onRemoteCandidate(b);break;case d.RTCStatsType.LocalCandidate:n.onLocalCandidate(b);break;case d.RTCStatsType.Track:if(n.type!==S.VIDEO)break;f.SystemUtil.isIos&&l?(!((h=b.id)===null||h===void 0)&&h.toLowerCase().includes(n.type)||b.trackIdentifier.toLowerCase()===n.type)&&n.onTrack(b):n.onTrack(b)}}),s("")}).catch(function(E){t(E)})})},r.prototype.dispose=function(){this.reset()},r.prototype.onCandidatePair=function(n){(n.state==="succeeded"||n.bytesReceived)&&(this.transportStats={timestamp:Math.floor(n.timestamp),rtt:n.currentRoundTripTime||-1,bytesReceived:n.bytesReceived,bytesSent:n.bytesSent})},r.prototype.onInBoundRtp=function(n){this.currentTimeGap=(n.timestamp-this.lastTimeStamp)/1e3,this.lastTimeStamp=n.timestamp,this.inboundRtpStreamStatsDiff=this.calcDiff(n,this.inboundRtpStreamStats,["bytesReceived","framesDecoded","packetsReceived","nackCount"]),this.inboundRtpStreamStats=n,!this.canplay&&Number(n.bytesReceived)>0&&(this.canplay=!0,this.emit("canPlay"))},r.prototype.calcDiff=function(n,s,t){var i={};return t.forEach(function(l){i[l]=Number(n[l]||0)-Number(s[l]||0)}),i},r.prototype.onRemoteCandidate=function(n){this.remoteCandidate=n||{}},r.prototype.onLocalCandidate=function(n){this.localCandidate=n||{}},r.prototype.onTrack=function(n){n.frameWidth&&(this.inboundRtpStreamStats.frameWidth=n.frameWidth,this.inboundRtpStreamStats.frameHeight=n.frameHeight)},r.prototype.reset=function(){this.currentTimeGap=0,this.lastTimeStamp=0,this.transportStats={},this.remoteCandidate={},this.localCandidate={},this.inboundRtpStreamStats={},this.inboundRtpStreamStatsDiff={},this.receiver=null,this.canplay=!1,this.streamEnded=!1},r}(a.default);R.ReceiverMonitorData=p},5250:function(L,R,x){var v,c=this&&this.__extends||(v=function(f,a){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(d,p){d.__proto__=p}||function(d,p){for(var e in p)Object.prototype.hasOwnProperty.call(p,e)&&(d[e]=p[e])},v(f,a)},function(f,a){if(typeof a!="function"&&a!==null)throw new TypeError("Class extends value "+String(a)+" is not a constructor or null");function d(){this.constructor=f}v(f,a),f.prototype=a===null?Object.create(a):(d.prototype=a.prototype,new d)});Object.defineProperty(R,"__esModule",{value:!0}),R.VideoReceiverMonitorData=void 0;var u=x(1353),S=function(f){function a(){return f.call(this,u.ReceiverMonitorType.VIDEO)||this}return c(a,f),a}(u.ReceiverMonitorData);R.VideoReceiverMonitorData=S},2688:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.RTCStatsType=void 0;var x=function(){function v(){}return v.CandidatePair="candidate-pair",v.Certificate="certificate",v.Codec="codec",v.Csrc="csrc",v.DataCahnnel="data-channel",v.InboundRtp="inbound-rtp",v.LocalCandidate="local-candidate",v.OutboundRtp="outbound-rtp",v.PeerConnection="peer-connection",v.Receiver="receiver",v.RemoteCandidate="remote-candidate",v.RemoteInboundRtp="remote-inbound-rtp",v.RemoteOutboundRtp="remote-outbound-rtp",v.Sender="sender",v.Stream="stream",v.Track="track",v.Transport="transport",v.MediaSource="media-source",v}();R.RTCStatsType=x},5657:(L,R,x)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.SenderMonitorData=void 0;var v=x(2688),c=function(){function u(){this._audiosender=null,this._videosender=null,this.timeStamp=0,this.curTimeStamp=0,this.audioBytesSent=0,this.curAudioBytesSent=0,this.videoBytesSent=0,this.curVideoBytesSent=0,this.audioRetransmittedBytesSent=0,this.curAudioRetransmittedBytesSent=0,this.videoRetransmiitedBytesSent=0,this.curVideoRetransmiitedBytesSent=0,this.framesSent=0,this.curFramesSent=0,this.framesEncoded=0,this.curFramesEncoded=0,this.rtt=0,this.localProtocol="",this.remoteProtocol="",this.localTransportAddr="",this.remoteTransportAddr="",this.frameHeight=0,this.frameWidth=0,this.efps=0,this.sfps=0,this.timeGap=0,this.abps=0,this.vbps=0,this.rt_abps=0,this.rt_vbps=0,this.stashedData={}}return Object.defineProperty(u.prototype,"videoSender",{set:function(S){this._videosender=S},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"audioSender",{set:function(S){this._audiosender=S},enumerable:!1,configurable:!0}),Object.defineProperty(u.prototype,"monitorData",{get:function(){return this.doCalc(),{tt:parseFloat(this.timeGap.toFixed(0)),rtt:this.rtt,cand_re_prot:this.remoteProtocol,cand_lo_prot:this.localProtocol,cand_re_addr:this.remoteTransportAddr,cand_lo_addr:this.localTransportAddr,w:this.frameWidth,h:this.frameHeight,efps:parseFloat(this.efps.toFixed(0)),fps:parseFloat(this.sfps.toFixed(0)),abps:parseFloat(this.abps.toFixed(0)),vbps:parseFloat(this.vbps.toFixed(0)),rt_abps:parseFloat(this.rt_abps.toFixed(0)),rt_vbps:parseFloat(this.rt_vbps.toFixed(0))}},enumerable:!1,configurable:!0}),u.prototype.doCalc=function(){this.timeStamp!==0&&(this.timeGap=this.curTimeStamp-this.timeStamp,this.timeGap>0&&(this.efps=1e3*(this.curFramesEncoded-this.framesEncoded)/this.timeGap,this.sfps=1e3*(this.curFramesSent-this.framesSent)/this.timeGap,this.abps=1e3*(this.curAudioBytesSent-this.audioBytesSent)/this.timeGap,this.vbps=1e3*(this.curVideoBytesSent-this.videoBytesSent)/this.timeGap,this.rt_abps=1e3*(this.curAudioRetransmittedBytesSent-this.audioRetransmittedBytesSent)/this.timeGap,this.rt_vbps=1e3*(this.curVideoRetransmiitedBytesSent-this.videoRetransmiitedBytesSent)/this.timeGap)),this.timeStamp=this.curTimeStamp,this.audioBytesSent=this.curAudioBytesSent,this.videoBytesSent=this.curVideoBytesSent,this.audioRetransmittedBytesSent=this.curAudioRetransmittedBytesSent,this.videoRetransmiitedBytesSent=this.curVideoRetransmiitedBytesSent,this.framesSent=this.curFramesSent,this.framesEncoded=this.curFramesEncoded},u.prototype.getInfo=function(){var S=this,f=new Promise(function(d,p){S._videosender&&S._videosender.getStats?S._videosender.getStats().then(function(e){e.forEach(function(r){if(r)switch(r.type){case v.RTCStatsType.CandidatePair:S.onCandidatePair(r);break;case v.RTCStatsType.OutboundRtp:S.onOutBoundRtp(r,"video");break;case v.RTCStatsType.RemoteCandidate:S.onRemoteCandidate(r);break;case v.RTCStatsType.LocalCandidate:S.onLocalCandidate(r)}}),d()}).catch(function(e){p(e)}):p("no video sender")}),a=new Promise(function(d,p){S._audiosender&&S._audiosender.getStats?S._audiosender.getStats().then(function(e){e.forEach(function(r){if(r)switch(r.type){case v.RTCStatsType.CandidatePair:S.onCandidatePair(r);break;case v.RTCStatsType.OutboundRtp:S.onOutBoundRtp(r,"audio");break;case v.RTCStatsType.RemoteCandidate:S.onRemoteCandidate(r);break;case v.RTCStatsType.LocalCandidate:S.onLocalCandidate(r)}}),d()}).catch(function(e){p(e)}):p("no audio sender")});return Promise.all([f,a])},u.prototype.onCandidatePair=function(S){this.curTimeStamp=S.timestamp,this.rtt=S.currentRoundTripTime},u.prototype.onOutBoundRtp=function(S,f){this.curTimeStamp=S.timestamp,f==="video"?(this.curVideoBytesSent=S.bytesSent,this.curVideoRetransmiitedBytesSent=S.retransmittedBytesSent,this.curFramesEncoded=S.framesEncoded,this.curFramesSent=S.framesSent,this.frameWidth=S.frameWidth,this.frameHeight=S.frameHeight):f==="audio"&&(this.curAudioBytesSent=S.bytesSent,this.curAudioRetransmittedBytesSent=S.retransmittedBytesSent)},u.prototype.onRemoteCandidate=function(S){this.curTimeStamp=S.timestamp,this.remoteProtocol=S.protocol,this.remoteTransportAddr=(S.ip||S.address)+(S.port?":"+S.port.toFixed(0):"")},u.prototype.onLocalCandidate=function(S){this.curTimeStamp=S.timestamp,this.localProtocol=S.protocol,this.localTransportAddr=(S.ip||S.address)+(S.port?":"+S.port.toFixed(0):"")},u}();R.SenderMonitorData=c},9752:function(L,R,x){var v,c=this&&this.__extends||(v=function(e,r){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var t in s)Object.prototype.hasOwnProperty.call(s,t)&&(n[t]=s[t])},v(e,r)},function(e,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function n(){this.constructor=e}v(e,r),e.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}),u=this&&this.__assign||function(){return u=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++)for(var t in r=arguments[n])Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e},u.apply(this,arguments)},S=this&&this.__spreadArray||function(e,r,n){if(n||arguments.length===2)for(var s,t=0,i=r.length;t<i;t++)!s&&t in r||(s||(s=Array.prototype.slice.call(r,0,t)),s[t]=r[t]);return e.concat(s||Array.prototype.slice.call(r))},f=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R,"__esModule",{value:!0}),R.PubMonitor=void 0;var a=f(x(102)),d=x(5657),p=function(e){function r(){var n=e.call(this)||this;return n.heartbeatHandle=null,n.pc=null,n.pcCore=null,n.senderMonitorDataList=[],n}return c(r,e),r.prototype.startHeartbeat=function(n,s,t){var i=this;this.pc=n,this.pcCore=s,this.updateSenders(),this.stopHeartbeat(),this.heartbeatHandle=setInterval(function(){i.emitHeartBeat()},t||1e3)},r.prototype.stopHeartbeat=function(){this.heartbeatHandle!==null&&clearInterval(this.heartbeatHandle),this.heartbeatHandle=null},r.prototype.addTrackPair=function(n,s,t,i,l){var E=this;if(n){var b=new d.SenderMonitorData;if(s){b.videoSender=s;var _=s.transport;_&&(_.onstatechange=function(){var o,g,m,T;E.emit("onTransportStateEvent",{url:n,type:"pub",kind:"video",state:_.state,protocol:(T=(m=(g=(o=_.iceTransport)===null||o===void 0?void 0:o.getSelectedCandidatePair)===null||g===void 0?void 0:g.call(o))===null||m===void 0?void 0:m.local)===null||T===void 0?void 0:T.protocol})})}if(t){b.audioSender=t;var h=t.transport;h&&(h.onstatechange=function(){var o,g,m,T;E.emit("onTransportStateEvent",{url:n,type:"pub",kind:"audio",state:h.state,protocol:(T=(m=(g=(o=h.iceTransport)===null||o===void 0?void 0:o.getSelectedCandidatePair)===null||g===void 0?void 0:g.call(o))===null||m===void 0?void 0:m.local)===null||T===void 0?void 0:T.protocol})})}this.senderMonitorDataList.push({url:n,vMsid:i,aMsid:l,senderData:b})}},r.prototype.updateSenders=function(){var n,s=this,t=(n=this.pcCore)===null||n===void 0?void 0:n.getStreamManager().getAllTrackPairList("pub");this.senderMonitorDataList=[],t?.forEach(function(i){s.addTrackPair(i.url,i.vTransceiver,i.aTransceiver,i.vMsid,i.aMsid)})},r.prototype.emitHeartBeat=function(){var n=this;Promise.all(this.senderMonitorDataList.reduce(function(s,t){return S(S([],s,!0),[t.senderData.getInfo()],!1)},[])).then(function(){}).catch(function(s){}).finally(function(){var s=n.senderMonitorDataList.map(function(t){return u(u({},t.senderData.monitorData),{url:t.url,vMsid:t.vMsid,aMsid:t.aMsid})});n.emit("onMonitorEvent",{eventList:s,type:"pub"})})},r}(a.default);R.PubMonitor=p},4699:function(L,R,x){var v,c=this&&this.__extends||(v=function(s,t){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(i,l){i.__proto__=l}||function(i,l){for(var E in l)Object.prototype.hasOwnProperty.call(l,E)&&(i[E]=l[E])},v(s,t)},function(s,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=s}v(s,t),s.prototype=t===null?Object.create(t):(i.prototype=t.prototype,new i)}),u=this&&this.__awaiter||function(s,t,i,l){return new(i||(i=Promise))(function(E,b){function _(g){try{o(l.next(g))}catch(m){b(m)}}function h(g){try{o(l.throw(g))}catch(m){b(m)}}function o(g){var m;g.done?E(g.value):(m=g.value,m instanceof i?m:new i(function(T){T(m)})).then(_,h)}o((l=l.apply(s,t||[])).next())})},S=this&&this.__generator||function(s,t){var i,l,E,b,_={label:0,sent:function(){if(1&E[0])throw E[1];return E[1]},trys:[],ops:[]};return b={next:h(0),throw:h(1),return:h(2)},typeof Symbol=="function"&&(b[Symbol.iterator]=function(){return this}),b;function h(o){return function(g){return function(m){if(i)throw new TypeError("Generator is already executing.");for(;b&&(b=0,m[0]&&(_=0)),_;)try{if(i=1,l&&(E=2&m[0]?l.return:m[0]?l.throw||((E=l.return)&&E.call(l),0):l.next)&&!(E=E.call(l,m[1])).done)return E;switch(l=0,E&&(m=[2&m[0],E.value]),m[0]){case 0:case 1:E=m;break;case 4:return _.label++,{value:m[1],done:!1};case 5:_.label++,l=m[1],m=[0];continue;case 7:m=_.ops.pop(),_.trys.pop();continue;default:if(E=_.trys,!((E=E.length>0&&E[E.length-1])||m[0]!==6&&m[0]!==2)){_=0;continue}if(m[0]===3&&(!E||m[1]>E[0]&&m[1]<E[3])){_.label=m[1];break}if(m[0]===6&&_.label<E[1]){_.label=E[1],E=m;break}if(E&&_.label<E[2]){_.label=E[2],_.ops.push(m);break}E[2]&&_.ops.pop(),_.trys.pop();continue}m=t.call(s,_)}catch(T){m=[6,T],l=0}finally{i=E=0}if(5&m[0])throw m[1];return{value:m[0]?m[1]:void 0,done:!0}}([o,g])}}},f=this&&this.__spreadArray||function(s,t,i){if(i||arguments.length===2)for(var l,E=0,b=t.length;E<b;E++)!l&&E in t||(l||(l=Array.prototype.slice.call(t,0,E)),l[E]=t[E]);return s.concat(l||Array.prototype.slice.call(t))},a=this&&this.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(R,"__esModule",{value:!0}),R.SubMonitor=void 0;var d=x(6901),p=x(5250),e=a(x(102)),r=function(){function s(){this.trackPairDataList=[]}return s.prototype.reset=function(){this.trackPairDataList=[]},s.prototype.addTrackPair=function(t,i,l,E,b,_){var h=new d.AudioReceiverMonitorData,o=new p.VideoReceiverMonitorData;E&&(o.rtpReceiver=E),b&&(h.rtpReceiver=b),_&&(o.RTCPeerconnection=_,h.RTCPeerconnection=_),this.trackPairDataList.push({url:t,vMsid:i,aMsid:l,audioReceiverMonitorData:h,videoReceiverMonitorData:o})},s}(),n=function(s){function t(){var i=s.call(this)||this;return i.canplay=!1,i.pc=null,i.pcCore=null,i.monitorTimerId=null,i.audioReceiverMonitorData=new d.AudioReceiverMonitorData,i.videoReceiverMonitorData=new p.VideoReceiverMonitorData,i.receiverMonitorController=new r,i}return c(t,s),t.prototype.start=function(i,l){this.pc=i,this.pcCore=l,this.updateTranceiversController(),this.startMonitorTimer(200)},t.prototype.updateTranceiversController=function(){var i=this;if(this.pc&&this.pcCore){var l=this.pcCore.getStreamManager().getAllTrackPairList("sub");this.receiverMonitorController.reset(),l.forEach(function(E){E.url&&i.receiverMonitorController.addTrackPair(E.url,E.vMsid,E.aMsid,E.vTransceiver,E.aTransceiver,i.pc)}),this.receiverMonitorController.trackPairDataList.forEach(function(E){i.initEvent(E)})}},t.prototype.resetTimer=function(i){this.updateTranceiversController(),this.stopMonitorTimer(),this.startMonitorTimer(i)},t.prototype.stop=function(){this.canplay=!1,this.stopMonitorTimer(),this.audioReceiverMonitorData.dispose(),this.videoReceiverMonitorData.dispose()},t.prototype.startMonitorTimer=function(i){var l=this;this.monitorTimerId||(this.monitorTimerId=window.setInterval(function(){l.onMonitorTimer()},i))},t.prototype.stopMonitorTimer=function(){this.monitorTimerId&&clearInterval(this.monitorTimerId),this.monitorTimerId=null},t.prototype.onMonitorTimer=function(){return u(this,void 0,void 0,function(){var i;return S(this,function(l){switch(l.label){case 0:return[4,this.updateMonitorData()];case 1:return l.sent(),i=[],this.receiverMonitorController.trackPairDataList.forEach(function(E){var b,_;if(E.url){var h={url:E.url};E.audioReceiverMonitorData.isExist&&(h.audio=(b=E.audioReceiverMonitorData)===null||b===void 0?void 0:b.monitorData,h.aMsid=E.aMsid),E.videoReceiverMonitorData.isExist&&(h.video=(_=E.videoReceiverMonitorData)===null||_===void 0?void 0:_.monitorData,h.vMsid=E.vMsid),i.push(h)}}),this.emit("onMonitorEvent",{eventList:i,type:"sub"}),[2]}})})},t.prototype.initEvent=function(i){var l=this,E={url:i.url||"url unknown",vMsid:i.vMsid||"vMsid unknown",aMsid:i.aMsid||"aMsid unknown"};i.audioReceiverMonitorData.isExist&&(i.audioReceiverMonitorData.on("streamEnded",function(){i.videoReceiverMonitorData&&!i.videoReceiverMonitorData.isStreamEnded||(l.emit("streamEnded",E),l.stopMonitorTimer())}),i.audioReceiverMonitorData.on("canPlay",function(){l.emitCanPlay()})),i.videoReceiverMonitorData.isExist&&(i.videoReceiverMonitorData.on("streamEnded",function(){i.audioReceiverMonitorData&&!i.audioReceiverMonitorData.isStreamEnded||(l.emit("streamEnded",E),l.stopMonitorTimer())}),i.videoReceiverMonitorData.on("canPlay",function(){l.emitCanPlay()}))},t.prototype.updateMonitorData=function(){return Promise.all(this.receiverMonitorController.trackPairDataList.reduce(function(i,l){var E,b;return f(f([],i,!0),[(E=l.audioReceiverMonitorData)===null||E===void 0?void 0:E.getInfo(),(b=l.videoReceiverMonitorData)===null||b===void 0?void 0:b.getInfo()],!1)},[]))},t.prototype.emitCanPlay=function(){this.canplay||(this.canplay=!0,this.emit("canPlay"))},t.prototype.copyMonitorData=function(){var i,l;!((l=(i=this.receiverMonitorController)===null||i===void 0?void 0:i.trackPairDataList)===null||l===void 0)&&l.length&&(this.audioReceiverMonitorData=this.receiverMonitorController.trackPairDataList[0].audioReceiverMonitorData,this.videoReceiverMonitorData=this.receiverMonitorController.trackPairDataList[0].videoReceiverMonitorData)},t.prototype.getTransportStats=function(){return u(this,void 0,void 0,function(){var i;return S(this,function(l){switch(l.label){case 0:return[4,this.updateMonitorData()];case 1:return l.sent(),this.copyMonitorData(),i={},this.videoReceiverMonitorData.isExist?i=this.videoReceiverMonitorData.monitorData.transportStats:this.audioReceiverMonitorData.isExist&&(i=this.audioReceiverMonitorData.monitorData.transportStats),[2,i]}})})},t.prototype.getRemoteVideoStats=function(){return u(this,void 0,void 0,function(){var i,l;return S(this,function(E){switch(E.label){case 0:return[4,this.updateMonitorData()];case 1:return E.sent(),this.copyMonitorData(),i={},this.videoReceiverMonitorData.isExist&&(l=this.videoReceiverMonitorData.monitorData.inboundRtpStats,i={timestamp:Math.floor(l.timestamp||0),framesDecodedPerSecond:l.framesPerSecond,framesDecoded:l.framesDecoded,frameWidth:l.frameWidth,frameHeight:l.frameHeight,bytesReceived:l.bytesReceived,jitter:l.jitter,jitterBufferDelayAvg:Number(l.jitterBufferDelay)/Number(l.jitterBufferEmittedCount),packetsLost:l.packetsLost,packetsReceived:l.packetsReceived}),[2,i]}})})},t.prototype.getRemoteAudioStats=function(){return u(this,void 0,void 0,function(){var i,l;return S(this,function(E){switch(E.label){case 0:return[4,this.updateMonitorData()];case 1:return E.sent(),this.copyMonitorData(),i={},this.audioReceiverMonitorData.isExist&&(l=this.audioReceiverMonitorData.monitorData.inboundRtpStats,i={timestamp:Math.floor(l.timestamp||0),bytesReceived:l.bytesReceived,jitter:l.jitter,jitterBufferDelayAvg:Number(l.jitterBufferDelay)/Number(l.jitterBufferEmittedCount),packetsLost:l.packetsLost,packetsReceived:l.packetsReceived}),[2,i]}})})},t}(e.default);R.SubMonitor=n},5259:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.AudioProfileMap=R.VideoProfileMap=R.ScreenProfileMap=void 0,R.ScreenProfileMap=new Map,R.ScreenProfileMap.set("480p_1",{width:640,height:480,frameRate:5,maxBitrate:300}),R.ScreenProfileMap.set("480p_2",{width:640,height:480,frameRate:30,maxBitrate:1e3}),R.ScreenProfileMap.set("720p_1",{width:1280,height:720,frameRate:5,maxBitrate:800}),R.ScreenProfileMap.set("720p_2",{width:1280,height:720,frameRate:30,maxBitrate:2e3}),R.ScreenProfileMap.set("1080p_1",{width:1920,height:1080,frameRate:5,maxBitrate:1e3}),R.ScreenProfileMap.set("1080p_2",{width:1920,height:1080,frameRate:30,maxBitrate:3e3}),R.VideoProfileMap=new Map,R.VideoProfileMap.set("120p_1",{width:160,height:120,frameRate:15,maxBitrate:65}),R.VideoProfileMap.set("120p_3",{width:120,height:120,frameRate:15,maxBitrate:50}),R.VideoProfileMap.set("180p_1",{width:320,height:180,frameRate:15,maxBitrate:140}),R.VideoProfileMap.set("180p_3",{width:180,height:180,frameRate:15,maxBitrate:100}),R.VideoProfileMap.set("180p_4",{width:240,height:180,frameRate:15,maxBitrate:120}),R.VideoProfileMap.set("240p_1",{width:320,height:240,frameRate:15,maxBitrate:200}),R.VideoProfileMap.set("240p_3",{width:240,height:240,frameRate:15,maxBitrate:140}),R.VideoProfileMap.set("240p_4",{width:424,height:240,frameRate:15,maxBitrate:220}),R.VideoProfileMap.set("360p_1",{width:640,height:360,frameRate:15,maxBitrate:400}),R.VideoProfileMap.set("360p_3",{width:360,height:360,frameRate:15,maxBitrate:260}),R.VideoProfileMap.set("360p_4",{width:640,height:360,frameRate:30,maxBitrate:600}),R.VideoProfileMap.set("360p_6",{width:360,height:360,frameRate:30,maxBitrate:400}),R.VideoProfileMap.set("360p_7",{width:480,height:360,frameRate:15,maxBitrate:320}),R.VideoProfileMap.set("360p_8",{width:480,height:360,frameRate:30,maxBitrate:490}),R.VideoProfileMap.set("360p_9",{width:640,height:360,frameRate:15,maxBitrate:800}),R.VideoProfileMap.set("360p_10",{width:640,height:360,frameRate:24,maxBitrate:800}),R.VideoProfileMap.set("360p_11",{width:640,height:360,frameRate:24,maxBitrate:1e3}),R.VideoProfileMap.set("480p_1",{width:640,height:480,frameRate:15,maxBitrate:500}),R.VideoProfileMap.set("480p_2",{width:640,height:480,frameRate:30,maxBitrate:1e3}),R.VideoProfileMap.set("480p_3",{width:480,height:480,frameRate:15,maxBitrate:400}),R.VideoProfileMap.set("480p_4",{width:640,height:480,frameRate:30,maxBitrate:750}),R.VideoProfileMap.set("480p_6",{width:480,height:480,frameRate:30,maxBitrate:600}),R.VideoProfileMap.set("480p_8",{width:848,height:480,frameRate:15,maxBitrate:610}),R.VideoProfileMap.set("480p_9",{width:848,height:480,frameRate:30,maxBitrate:930}),R.VideoProfileMap.set("480p_10",{width:640,height:480,frameRate:10,maxBitrate:400}),R.VideoProfileMap.set("720p_1",{width:1280,height:720,frameRate:15,maxBitrate:1130}),R.VideoProfileMap.set("720p_2",{width:1280,height:720,frameRate:30,maxBitrate:2e3}),R.VideoProfileMap.set("720p_3",{width:1280,height:720,frameRate:30,maxBitrate:1710}),R.VideoProfileMap.set("720p_5",{width:960,height:720,frameRate:15,maxBitrate:910}),R.VideoProfileMap.set("720p_6",{width:960,height:720,frameRate:30,maxBitrate:1380}),R.VideoProfileMap.set("1080p_1",{width:1920,height:1080,frameRate:15,maxBitrate:2080}),R.VideoProfileMap.set("1080p_2",{width:1920,height:1080,frameRate:30,maxBitrate:3e3}),R.VideoProfileMap.set("1080p_3",{width:1920,height:1080,frameRate:30,maxBitrate:3150}),R.VideoProfileMap.set("1080p_5",{width:1920,height:1080,frameRate:60,maxBitrate:4780}),R.VideoProfileMap.set("1440p_1",{width:2560,height:1440,frameRate:30,maxBitrate:4850}),R.VideoProfileMap.set("1440p_2",{width:2560,height:1440,frameRate:60,maxBitrate:7350}),R.VideoProfileMap.set("4K_1",{width:3840,height:2160,frameRate:30,maxBitrate:8910}),R.VideoProfileMap.set("4K_3",{width:3840,height:2160,frameRate:60,maxBitrate:13500}),R.AudioProfileMap=new Map,R.AudioProfileMap.set("standard",{sampleRate:48e3,channelCount:1,maxBitrate:64}),R.AudioProfileMap.set("high",{sampleRate:48e3,channelCount:1,maxBitrate:128}),R.AudioProfileMap.set("standard-stereo",{sampleRate:48e3,channelCount:2,maxBitrate:80}),R.AudioProfileMap.set("high-stereo",{sampleRate:48e3,channelCount:2,maxBitrate:192})},5553:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.Datachannel=void 0;var x=function(){function v(c){this.pc=c,this.messageId=1,this.dataChannel=this.pc.createDataChannel("GRTNDataChannel"),this.dataChannel.onopen=function(u){},this.dataChannel.onmessage=function(u){u.data},this.dataChannel.onclose=function(u){},this.dataChannel.onerror=function(u){}}return v.prototype.addTrack=function(c,u){return new Promise(function(S,f){})},v.prototype.removeTrack=function(c,u){return new Promise(function(S,f){})},v.prototype.createPublishPacket=function(){var c={type:"pub",version:1,msg_id:this.messageId,streams:[]};return++this.messageId,c},v}();R.Datachannel=x},2470:function(L,R,x){var v,c=this&&this.__extends||(v=function(n,s){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var l in i)Object.prototype.hasOwnProperty.call(i,l)&&(t[l]=i[l])},v(n,s)},function(n,s){if(typeof s!="function"&&s!==null)throw new TypeError("Class extends value "+String(s)+" is not a constructor or null");function t(){this.constructor=n}v(n,s),n.prototype=s===null?Object.create(s):(t.prototype=s.prototype,new t)}),u=this&&this.__assign||function(){return u=Object.assign||function(n){for(var s,t=1,i=arguments.length;t<i;t++)for(var l in s=arguments[t])Object.prototype.hasOwnProperty.call(s,l)&&(n[l]=s[l]);return n},u.apply(this,arguments)},S=this&&this.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(R,"__esModule",{value:!0}),R.PcRestorer=void 0;var f=S(x(102)),a=x(5917),d=x(280),p=x(9428),e=x(5044),r=function(n){function s(t){var i=n.call(this)||this;return i.restoring=!1,i.subscriber=t.subscriber,i.publisher=t.publisher,i.commonController=t.commonController,i}return c(s,n),s.prototype.isReconnecting=function(){return this.restoring},s.prototype.restore=function(t){var i=this;if(!this.restoring)return new Promise(function(l,E){i.restoring=!0;var b=i.restructureStreams();if(b&&b.length){i.subscriber.unsubscribe(),i.publisher.unpublish();var _=[],h=b[0],o={retryTimes:a.DEFAULT_RETRY_SUBSCRIBE_LIMIT,retryInterval:a.DEFAULT_RETRY_SUBSCRIBE_INTERVAL},g=h.url;switch(t&&(g=i.makeIpQuery(g,t,h.type)),h.type){case"sub":i.commonController.setPeerconnection(i.subscriber.getPeerConnection()),i.subscriber.incrementReconnectTimes(),o.retryTimes=i.subscriber.getSubscribeConfig().retryTimes||a.DEFAULT_RETRY_SUBSCRIBE_LIMIT,o.retryInterval=i.subscriber.getSubscribeConfig().retryInterval||a.DEFAULT_RETRY_SUBSCRIBE_INTERVAL,_.push(i.subscriber.subscribeWithReconnect(g,u(u({},i.subscriber.getSubscribeConfig()),{vMsid:h.vMsid,aMsid:h.aMsid})));break;case"pub":h.targetStream&&(i.commonController.setPeerconnection(i.publisher.getPeerConnection()),i.publisher.incrementReconnectTimes(),o.retryTimes=i.publisher.getPublishConfig().retryTimes||a.DEFAULT_RETRY_PUBLISH_LIMIT,o.retryInterval=i.publisher.getPublishConfig().retryInterval||a.DEFAULT_RETRY_PUBLISH_INTERVAL,_.push(i.publisher.publishWithReconnect(g,h.targetStream,u(u({},i.publisher.getPublishConfig()),{vMsid:h.vMsid,aMsid:h.aMsid}))));break;case"sub-data":h.msid&&h.label&&_.push(i.commonController.subscribeAddDatachannel({signalUrl:g,url:g,label:h.label,msid:h.msid}));break;case"pub-data":h.msid&&h.label&&_.push(i.commonController.publishAddDatachannel({signalUrl:h.url,url:h.url,label:h.label,msid:h.msid}));break;default:console.log("RTS [PC RESTORER] unknown http reconnect type",h.type)}var m=new Promise(function(C,D){var y=setTimeout(function(){var A=new e.RtsError(p.ErrorCode.ERROR_DATACHANNEL_OPEN,"reconnect pc datachannel open timeout","",{});D(A)},o.retryTimes*o.retryInterval+a.DEFAULT_RETRY_DATACHANNEL_TIMEOUT);i.commonController.on("datachannelStatusChange",function(A){A.status===d.EDatachannelStatus.DATACHANNEL_STATUS_OPEN&&(clearTimeout(y),C())})});_.push(m);var T=[];Promise.all(_).then(function(C){for(var D=1;D<b.length;D++){var y=b[D];if(y)switch(y.type){case"sub":T.push(i.commonController.subscribeAdd([{url:y.url,vMsid:y.vMsid,aMsid:y.aMsid,targetStream:y.targetStream,subAudio:!(!y.aMsid||!y.aMsid.length),subVideo:!(!y.vMsid||!y.vMsid.length)}],!0).catch(function(A){i.emit("onError",i.makeSingleStreamReconnectError(A))}));break;case"pub":T.push(i.commonController.publishAdd([{url:y.url,stream:y.targetStream,vMsid:y.vMsid,aMsid:y.aMsid}]).catch(function(A){i.emit("onError",i.makeSingleStreamReconnectError(A))}));break;case"sub-data":y.label&&y.msid&&T.push(i.commonController.subscribeAddDatachannel({signalUrl:y.url,url:y.url,label:y.label,msid:y.msid}).catch(function(A){i.emit("onError",i.makeSingleStreamReconnectError(A))}));break;case"pub-data":y.label&&y.msid&&T.push(i.commonController.publishAddDatachannel({signalUrl:y.url,url:y.url,label:y.label,msid:y.msid}).catch(function(A){i.emit("onError",i.makeSingleStreamReconnectError(A))}));break;default:console.log("RTS [PC RESTORER] unknown pc reconnect type")}}Promise.allSettled(T).then(function(){l()})}).catch(function(C){E(C)}).finally(function(){i.restoring=!1})}i.restoring=!1})},s.prototype.restructureStreams=function(){var t,i=(t=this.commonController.peerCore)===null||t===void 0?void 0:t.getStreamManager(),l=i?.getAllStreamListWithMsids(),E=i?.getAllDatachannelList(),b=[];return l?.forEach(function(_){var h;(h=_.streams)===null||h===void 0||h.forEach(function(o){var g=[],m=[],T=_.type,C=_.latestUrl,D=o;_.msids.forEach(function(y){y.streamId===o.id&&(y.type==="video"?m.push(y.name):y.type==="audio"&&g.push(y.name))}),b.push({aMsid:g,vMsid:m,type:T,url:C,targetStream:D})})}),E?.forEach(function(_){_.msids.forEach(function(h){if(h.name&&h.label){var o=h.name,g=h.label,m=_.type,T=_.latestUrl;b.push({msid:o,type:m,label:g,url:T})}})}),b},s.prototype.makeSingleStreamReconnectError=function(t){return new e.RtsError(p.ErrorCode.ERROR_SINGLE_PC_STREAM_RECONNECT_FAILED,"single stream reconnect failed","",{originError:t})},s.prototype.makeIpQuery=function(t,i,l){var E,b,_,h="ali_prefer_media_server",o="ip_migration",g=t,m="";if(l.indexOf("sub")===0&&(!((b=i.pull)===null||b===void 0)&&b.length)?m=i.pull[0]:l.indexOf("pub")===0&&(!((_=i.push)===null||_===void 0)&&_.length)&&(m=i.push[0]),m){var T=t.split("?"),C=T[0],D=T[1],y=void 0;D?((y=new URLSearchParams(D)).has(h)?y.set(h,m):y.append(h,m),!y.has(o)&&y.append(o,"on")):y=new URLSearchParams(((E={})[h]=m,E[o]="on",E)),g="".concat(C,"?").concat(y.toString())}return g},s}(f.default);R.PcRestorer=r},4865:function(L,R,x){var v,c=this&&this.__extends||(v=function(C,D){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(y,A){y.__proto__=A}||function(y,A){for(var w in A)Object.prototype.hasOwnProperty.call(A,w)&&(y[w]=A[w])},v(C,D)},function(C,D){if(typeof D!="function"&&D!==null)throw new TypeError("Class extends value "+String(D)+" is not a constructor or null");function y(){this.constructor=C}v(C,D),C.prototype=D===null?Object.create(D):(y.prototype=D.prototype,new y)}),u=this&&this.__assign||function(){return u=Object.assign||function(C){for(var D,y=1,A=arguments.length;y<A;y++)for(var w in D=arguments[y])Object.prototype.hasOwnProperty.call(D,w)&&(C[w]=D[w]);return C},u.apply(this,arguments)},S=this&&this.__awaiter||function(C,D,y,A){return new(y||(y=Promise))(function(w,j){function I(U){try{F(A.next(U))}catch(B){j(B)}}function H(U){try{F(A.throw(U))}catch(B){j(B)}}function F(U){var B;U.done?w(U.value):(B=U.value,B instanceof y?B:new y(function(k){k(B)})).then(I,H)}F((A=A.apply(C,D||[])).next())})},f=this&&this.__generator||function(C,D){var y,A,w,j,I={label:0,sent:function(){if(1&w[0])throw w[1];return w[1]},trys:[],ops:[]};return j={next:H(0),throw:H(1),return:H(2)},typeof Symbol=="function"&&(j[Symbol.iterator]=function(){return this}),j;function H(F){return function(U){return function(B){if(y)throw new TypeError("Generator is already executing.");for(;j&&(j=0,B[0]&&(I=0)),I;)try{if(y=1,A&&(w=2&B[0]?A.return:B[0]?A.throw||((w=A.return)&&w.call(A),0):A.next)&&!(w=w.call(A,B[1])).done)return w;switch(A=0,w&&(B=[2&B[0],w.value]),B[0]){case 0:case 1:w=B;break;case 4:return I.label++,{value:B[1],done:!1};case 5:I.label++,A=B[1],B=[0];continue;case 7:B=I.ops.pop(),I.trys.pop();continue;default:if(w=I.trys,!((w=w.length>0&&w[w.length-1])||B[0]!==6&&B[0]!==2)){I=0;continue}if(B[0]===3&&(!w||B[1]>w[0]&&B[1]<w[3])){I.label=B[1];break}if(B[0]===6&&I.label<w[1]){I.label=w[1],w=B;break}if(w&&I.label<w[2]){I.label=w[2],I.ops.push(B);break}w[2]&&I.ops.pop(),I.trys.pop();continue}B=D.call(C,I)}catch(k){B=[6,k],A=0}finally{y=w=0}if(5&B[0])throw B[1];return{value:B[0]?B[1]:void 0,done:!0}}([F,U])}}},a=this&&this.__importDefault||function(C){return C&&C.__esModule?C:{default:C}};Object.defineProperty(R,"__esModule",{value:!0}),R.RtsPeerconnection=void 0;var d,p=x(280),e=x(233),r=x(4315),n=x(2718),s=a(x(102)),t=x(5917),i=x(4699),l=x(9752),E=x(5553),b=x(9428),_=x(5044),h=a(x(6834));(function(C){C.Subscribe="sub",C.Publish="pub"})(d||(d={}));var o=window.RTCRtpReceiver&&"createEncodedStreams"in RTCRtpReceiver.prototype,g=window.RTCRtpReceiver&&"transform"in RTCRtpReceiver.prototype&&"RTCRtpScriptTransform"in window,m=function(C){function D(){var y=C.call(this)||this;return y.connectingEventSent=!1,y.reused=!1,y.transformWorkerList=new T,y.receiverCodecPreferences={},y.senderCodecPreferences={},y.heartbeatTimeoutHandler=null,y.noHeartbeatCount=0,y.subMonitor=new i.SubMonitor,y.subMonitor.on("onMonitorEvent",function(A){y.emit("onMonitorEvent",A)}),y.subMonitor.on("streamEnded",function(){y.emit("streamEnded")}),y.subMonitor.on("canPlay",function(){}),y.pubMonitor=new l.PubMonitor,y.pubMonitor.on("onMonitorEvent",function(A){y.emit("onMonitorEvent",A)}),y.pubMonitor.on("onTransportStateEvent",function(A){y.emit("onTransportStateEvent",A)}),y}return c(D,C),Object.defineProperty(D.prototype,"isConnected",{get:function(){var y;return((y=this.pc)===null||y===void 0?void 0:y.connectionState)==="connected"},enumerable:!1,configurable:!0}),Object.defineProperty(D.prototype,"isReused",{get:function(){return this.reused},set:function(y){this.reused=!!y},enumerable:!1,configurable:!0}),D.prototype.getWorkerManager=function(){return this.transformWorkerList},D.prototype.getPc=function(){return this.pc},D.prototype.getPeerCore=function(){return this.peerCore},D.prototype.getSubMonitor=function(){return this.subMonitor},D.prototype.getPubMonitor=function(){return this.pubMonitor},D.prototype.playStart=function(){this.subMonitor.resetTimer(1e3)},D.prototype.pushStart=function(){this.pc&&this.peerCore&&this.pubMonitor.startHeartbeat(this.pc,this.peerCore)},D.prototype.sample=function(){return S(this,void 0,void 0,function(){return f(this,function(y){switch(y.label){case 0:return[4,this.subMonitor.onMonitorTimer()];case 1:return y.sent(),[2]}})})},D.prototype.subAdd=function(y,A){var w;return(w=this.peerCore)===null||w===void 0?void 0:w.subscribeAdd(y,A)},D.prototype.subActive=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.subscribeActive(y)},D.prototype.subStop=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.subscribeStop(y)},D.prototype.subDeleteTracks=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.subscribeDeleteTracks(y)},D.prototype.pubAdd=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.publishAdd(y)},D.prototype.pubDeleteTracks=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.publishDeleteTracks(y)},D.prototype.pubReplaceTracks=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.publishReplaceTracks(y)},D.prototype.pubStop=function(y){var A;return(A=this.peerCore)===null||A===void 0?void 0:A.publishStop(y)},D.prototype.createOffer=function(y,A,w,j){var I=this;return j===void 0&&(j={publishUrl:""}),new Promise(function(H,F){var U;(U=I.cancelable)===null||U===void 0||U.cancel();var B={googCpuOveruseDetection:!1,sdpSemantics:"unified-plan",encodedInsertableStreams:j.encodedInsertableStreams,bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"};if(e.BrowserUtil.isChrome&&Number(e.BrowserUtil.browserMainVersion)<=55&&(B.iceServers=[]),I.pc=new RTCPeerConnection(B),I.encodedInsertableStreams=j.encodedInsertableStreams,I.peerCore=new p.PeerConnectionCore({pc:I.pc,onDatachannelEvent:function(q){var z,$;I.emit("datachannelStatusChange",{status:q}),j.disableHeartbeat||(q===p.EDatachannelStatus.DATACHANNEL_STATUS_OPEN?((0,n.hebtLog)("DATACHANNEL OPEN"," heartbeat send scheduler started"),(z=I.peerCore)===null||z===void 0||z.startSignalHeartbeatTimer()):q===p.EDatachannelStatus.DATACHANNEL_STATUS_CLOSE&&((0,n.hebtLog)("DATACHANNEL CLOSE"," heartbeats from now on will fail"),($=I.peerCore)===null||$===void 0||$.stopSignalHeartbeatTimer()))},onInnerSubscribeDelete:function(q){I.emit("innerSubscribeDeleteTracks",q)},offerSdpHook:j.offerSdpHook,answerSdpHook:j.answerSdpHook}),I.registerPeerCoreListeners(j),I.peerCore.setReceiverCodecPreferences(I.receiverCodecPreferences),I.peerCore.setSenderCodecPreferences(I.senderCodecPreferences),I.pc.onconnectionstatechange=function(){var q=(I.pc||{}).connectionState;switch(I.connectingEventSent||(I.connectingEventSent=!0,I.emit("connectStatusChange",{status:t.EConnectStatus.CONNECT_STATUS_CONNECTING})),q!=="connecting"&&I.clearStatusTimer(),q){case"connected":I.emit("onConnected"),I.emit("connectStatusChange",{status:t.EConnectStatus.CONNECT_STATUS_CONNECTED});break;case"disconnected":I.emit("connectStatusChange",{status:t.EConnectStatus.CONNECT_STATUS_RECONNECTING});break;case"failed":case"closed":I.handleClosed()}},I.clearStatusTimer(),I.statusTimer=window.setTimeout(function(){I.handleClosed()},D.CONNECT_TIMEOUT),w){I.localStream=w,I.sdpUtil=new r.SdpUtil(I.localStream);var k=I.addStream();if(k!==0)return I.pc=void 0,void F(new _.RtsError(k,k===b.ErrorCode.ERROR_MEDIASTREAMTRACK_AUDIO_NONE?"need audio track":"",""))}else I.sdpUtil=new r.SdpUtil;var V={};w||(V=I.handleSubTransceiver(y,A).added?{}:{offerToReceiveAudio:y,offerToReceiveVideo:A});var G=I.pc.createOffer(V);I.cancelable=(0,n.makeCancelable)(G),I.cancelable.promise.then(function(q){var z,$,re,ee,ie,se,ce;if(I.cancelable=void 0,I.sdpUtil){if(I.sdpUtil.init(String(q.sdp)),I.sdpUtil.addNack(),I.sdpUtil.addSps(),j.disableStereo||I.sdpUtil.addStereo(),w&&I.sdpUtil.modifyTrackName({vMsid:j.vMsid&&j.vMsid[0],aMsid:j.aMsid&&j.aMsid[0]}),I.pc){q.sdp=I.sdpUtil.sdp,w&&w.sdpHook&&typeof w.sdpHook=="function"&&(q.sdp=w.sdpHook(q.sdp)),(z=I.peerCore)===null||z===void 0||z.setPrevOfferSdp(q.sdp||"");var ue=[];if(w)try{($=I.peerCore)===null||$===void 0||$.patchPublishStreamManagerRecord(j.publishUrl||"",u(u({},j),{stream:w}));var de=(re=I.peerCore)===null||re===void 0?void 0:re.parseSdp(q.sdp||"");ue=(ee=I.peerCore)===null||ee===void 0?void 0:ee.updateTrackInfoList({url:j.publishUrl||"",stream:w,vMsid:(ie=I.peerCore)===null||ie===void 0?void 0:ie.unifyMsid(j.vMsid,"video"),aMsid:(se=I.peerCore)===null||se===void 0?void 0:se.unifyMsid(j.aMsid,"audio"),sdpMediaList:(ce=de?.detail)===null||ce===void 0?void 0:ce.media})}catch(pe){console.log(pe)}j.offerSdpHook&&typeof j.offerSdpHook=="function"&&(q.sdp=j.offerSdpHook(q.sdp||"")),I.pc.setLocalDescription(q).then(function(){I.pc?H({desp:I.pc.localDescription,publishTrackInfoList:ue}):F(new _.RtsError(b.ErrorCode.ERROR_CREATEOFFER,"no pc",""))}).catch(function(pe){F(new _.RtsError(b.ErrorCode.ERROR_CREATEOFFER,"setLocalDescription error "+pe.message,""))})}}else F(new _.RtsError(b.ErrorCode.ERROR_CREATEOFFER,"no sdp",""))}).catch(function(q){q.isCanceled||F(new _.RtsError(b.ErrorCode.ERROR_CREATEOFFER,q.message?q.message:"create offer error",""))})})},D.prototype.recvAnswer=function(y,A){var w,j,I=this;return A===void 0&&(A={}),(w=this.peerCore)===null||w===void 0||w.setPrevAnswerSdp((j=y?.jsep)===null||j===void 0?void 0:j.sdp),new Promise(function(H,F){var U,B,k,V,G,q;if(I.pc){if(I.pc.ontrack=function($){I.pc&&I.peerCore&&I.subMonitor.start(I.pc,I.peerCore),setTimeout(function(){I.handleEncodedInsertableStreams({receiver:$.receiver})}),I.isReused||I.emit("onTrackEvent",$)},I.pc.signalingState==="closed")return void F({message:"PeerConnection signalingState is closed"});if(!((U=y.jsep)===null||U===void 0)&&U.sdp){var z=new r.SdpUtil;z.init(String((B=y.jsep)===null||B===void 0?void 0:B.sdp)),I.localStream&&(I.localStream.audioTrack&&!I.localStream.videoTrack&&(z.removeTwccRtcpFb(),(k=I.peerCore)===null||k===void 0||k.setRemoveTwcc(!0)),z.setDirection()),A.tcpOnly&&z.hasTcpCandidate&&z.removeUdpCandidate(),y.jsep.sdp=z.sdp,(V=I.peerCore)===null||V===void 0||V.setPrevAnswerSdp((G=y?.jsep)===null||G===void 0?void 0:G.sdp)}!((q=y.jsep)===null||q===void 0)&&q.sdp&&A.answerSdpHook&&typeof A.answerSdpHook=="function"&&(y.jsep.sdp=A.answerSdpHook(y.jsep.sdp)),I.pc.setRemoteDescription(new RTCSessionDescription(y.jsep)).then(function($){var re;I.pc&&I.localStream&&(I.localStream.setEncodeParam(I.pc),(re=I.pc)===null||re===void 0||re.getSenders().forEach(function(ee){I.handleEncodedInsertableStreams({sender:ee})})),H($)}).catch(function($){$.sdp=y.jsep.sdp,F($)})}else F({message:"no PeerConnection"})})},D.prototype.setReceiverCodecPreferences=function(y){var A;this.receiverCodecPreferences=u({},y),(A=this.peerCore)===null||A===void 0||A.setReceiverCodecPreferences(this.receiverCodecPreferences)},D.prototype.setSenderCodecPreferences=function(y){var A;this.senderCodecPreferences=u({},y),(A=this.peerCore)===null||A===void 0||A.setSenderCodecPreferences(this.senderCodecPreferences)},D.prototype.removeTrack=function(y,A){var w=this;return new Promise(function(j,I){w.pc&&w.dataChannel&&w.dataChannel.removeTrack(y,A).then(function(){}).catch(function(H){I(H)})})},D.prototype.replaceTrack=function(y,A,w){var j=this;return new Promise(function(I,H){w||j.pc&&j.dataChannel&&j.dataChannel.removeTrack(y,A).then(function(){}).catch(function(F){H(F)})})},D.prototype.sendSEI=function(y){var A;if(!y.data)throw new Error("No data to send, please check your params.");if(!(y.data instanceof ArrayBuffer))throw new Error("data should be ArrayBuffer, please check your params.");if(!y.url)throw new Error("url is required, please check your params.");if(!y.vMsid)throw new Error("vMsid is required, please check your params.");if(o||g){var w=this.transformWorkerList.findByMsid({url:y.url,kind:t.TrackType.VIDEO,source:t.EWorkerSource.Sender,msid:y.vMsid});if(!w)throw new Error("No published stream found, please check your url: "+y.url);(A=w?.worker)===null||A===void 0||A.postMessage({operation:t.EWorkerAction.InserSEI,payloadType:y.payloadType,repeatCount:y.repeatCount,sei:y.data})}},D.prototype.dispose=function(){this.cancelable&&(this.cancelable.cancel(),this.cancelable=void 0),this.peerCore&&(this.peerCore.dispose(),this.peerCore=void 0),this.pc&&(this.pc.onconnectionstatechange=function(){},this.pc.ontrack=function(){},this.pc.close(),this.pc=void 0,this.clearStatusTimer()),this.sdpUtil&&(this.sdpUtil.dispose(),this.sdpUtil=void 0),this.localStream&&(this.localStream=void 0),this.transformWorkerList.dispose(),this.subMonitor.stop(),this.pubMonitor.stopHeartbeat(),this.isReused=!1,this.encodedInsertableStreams=void 0,this.stopHeartbeatTimeoutChecker()},D.prototype.addStream=function(){if(this.localStream){if(this.pc){if(this.localStream.audioTrack){var y=this.pc.addTransceiver(this.localStream.audioTrack,{direction:"sendonly",streams:[this.localStream.mediaStream]});if(this.senderCodecPreferences.audio)try{y.setCodecPreferences(this.senderCodecPreferences.audio)}catch(w){console.warn("setCodecPreferences error",w)}}if(this.localStream.videoTrack){var A=this.pc.addTransceiver(this.localStream.videoTrack,{direction:"sendonly",streams:[this.localStream.mediaStream]});if(this.senderCodecPreferences.video)try{A.setCodecPreferences(this.senderCodecPreferences.video)}catch(w){console.warn("setCodecPreferences error",w)}}return 0}return b.ErrorCode.ERROR_PREERCONNECTION_UNKNOWN}return b.ErrorCode.ERROR_MEDIASTREAMTRACK_AUDIO_NONE},D.prototype.handleEncodedInsertableStreams=function(y){var A,w,j=this;if(this.encodedInsertableStreams){var I=y.receiver,H=y.sender,F=I?t.EWorkerSource.Receiver:t.EWorkerSource.Sender,U=I||H,B=U.track;if(!B)return console.warn("no track in senderReceiver!");var k=B.kind,V=(w=(A=this.peerCore)===null||A===void 0?void 0:A.getStreamManager())===null||w===void 0?void 0:w.getAllTrackPairList(F===t.EWorkerSource.Receiver?d.Subscribe:d.Publish),G=V?.find(function(ie){var se,ce;return((ce=(se=ie[k===t.TrackType.VIDEO?"vTransceiver":"aTransceiver"])===null||se===void 0?void 0:se.track)===null||ce===void 0?void 0:ce.id)===B.id});if(!G)return console.warn("no existing stream info found");var q=new h.default;if(!this.transformWorkerList.add({worker:q,kind:k,source:F,info:G,receiver:I,sender:H}))return console.log("worker existing, skip.");var z=t.EWorkerAction.Setup;if(o){var $=U.createEncodedStreams(),re=$.readable,ee=$.writable;q.postMessage({source:F,readable:re,writable:ee,operation:z},[re,ee])}else g&&(U.transform=new RTCRtpScriptTransform(q,{source:F,operation:z}));q.onmessage=function(ie){var se=ie.data,ce=se.type,ue=se.data,de=se.frameInfo;ce==="encodedFrame"&&j.emit("encodedFrame",{kind:k,url:G.originUrl,vMsid:k==="video"?G?.vMsid:void 0,aMsid:k==="audio"?G?.aMsid:void 0,frame:u({data:ue},de)})}}},D.prototype.handleSubTransceiver=function(y,A){var w,j,I,H=!1;if(!((w=this.pc)===null||w===void 0)&&w.addTransceiver){if(y&&(j=this.pc.addTransceiver("audio",{direction:"recvonly"}),this.receiverCodecPreferences.audio))try{j.setCodecPreferences(this.receiverCodecPreferences.audio)}catch(F){console.warn("setCodecPreferences error",F)}if(A&&(I=this.pc.addTransceiver("video",{direction:"recvonly"}),this.receiverCodecPreferences.video))try{I.setCodecPreferences(this.receiverCodecPreferences.video)}catch(F){console.warn("setCodecPreferences error",F)}H=!0}return{added:H,aTransceiver:j,vTransceiver:I}},D.prototype.initDataChannel=function(){!this.dataChannel&&this.pc&&(this.dataChannel=new E.Datachannel(this.pc))},D.prototype.handleClosed=function(){this.subMonitor.stop(),this.emit("connectStatusChange",{status:t.EConnectStatus.CONNECT_STATUS_DISCONNECTED}),this.emit("onEnd")},D.prototype.clearStatusTimer=function(){this.statusTimer&&clearTimeout(this.statusTimer),this.statusTimer=void 0},D.prototype.registerPeerCoreListeners=function(y){var A=this;this.peerCore?(y.disableHeartbeat||((0,n.hebtLog)("heartbeat [timeout checker] started"),this.startHeartbeatTimeoutChecker()),this.peerCore.on("message",function(w){A.emit("message",w)}),this.peerCore.on("hebtReceived",function(w){(0,n.hebtLog)("EVENT: HEBT RECV",w),A.noHeartbeatCount=0,A.emit("hebtReceived",w)}),this.peerCore.on("streamError",function(w){(0,n.hebtLog)("EVENT: \u5355\u8DEF\u6D41\u9519\u8BEF",w),A.emit("streamError",w)}),this.peerCore.on("streamReconnect",function(w){(0,n.hebtLog)("EVENT: \u5355\u8DEF\u6D41\u91CD\u8FDE",w),A.emit("streamReconnect",w)}),this.peerCore.on("traceIdUpdate",function(w){(0,n.hebtLog)("EVENT: traceId",w),A.emit("traceIdUpdate",w)}),this.peerCore.on("pcReconnect",function(w){(0,n.hebtLog)("EVENT: PC\u91CD\u8FDE",w),A.emit("pcReconnect",w)}),this.peerCore.on("datachannelNotEnabled",function(){var w;(0,n.hebtLog)("EVENT: \u6570\u636E\u901A\u9053\u672A\u5F00\u542F"),A.stopHeartbeatTimeoutChecker(),(w=A.peerCore)===null||w===void 0||w.stopSignalHeartbeatTimer()})):(0,n.hebtLog)("PeerCore listeners registration failed.")},D.prototype.startHeartbeatTimeoutChecker=function(){var y=this;this.stopHeartbeatTimeoutChecker(),this.heartbeatTimeoutHandler=setInterval(function(){y.noHeartbeatCount++,y.noHeartbeatCount>=t.DEFAULT_HEARTBEAT_TIMEOUT&&((0,n.hebtLog)("EVENT: \u5FC3\u8DF3\u8D85\u65F6, PC\u91CD\u8FDE"),y.stopHeartbeatTimeoutChecker(),y.emit("pcReconnect",{recode:"",reMsg:"heartbeat timeout"}))},1e3)},D.prototype.stopHeartbeatTimeoutChecker=function(){this.heartbeatTimeoutHandler!==null&&clearInterval(this.heartbeatTimeoutHandler),this.heartbeatTimeoutHandler=null,this.noHeartbeatCount=0},D.CONNECT_TIMEOUT=1e4,D}(s.default);R.RtsPeerconnection=m;var T=function(){function C(){this.workerList=[]}return C.prototype.add=function(D){return!this.findByMsid({url:D.info.url,source:D.source,kind:D.kind,msid:D.kind===t.TrackType.VIDEO?D.info.vMsid:D.info.aMsid})&&(this.workerList.push(D),!0)},C.prototype.removeByUrl=function(D){var y=this;this.workerList.filter(function(A){return A.info.url.split("?")[0]===D.url.split("?")[0]&&A.source===D.source}).forEach(function(A){A.worker.terminate(),y.workerList=y.workerList.filter(function(w){return w!==A})})},C.prototype.removeByMsid=function(D){var y=this.findByMsid(D);y?(y.worker.terminate(),this.workerList=this.workerList.filter(function(A){return A!==y})):console.warn("no worker to remove")},C.prototype.findByUrl=function(D,y){return this.workerList.find(function(A){return A.info.url.split("?")[0]===D.split("?")[0]&&A.kind===y})},C.prototype.findByMsid=function(D){var y=D.url,A=D.kind,w=D.source,j=D.msid,I=A===t.TrackType.VIDEO?"vMsid":"aMsid";return this.workerList.find(function(H){return H.info.url.split("?")[0]===y.split("?")[0]&&H.source===w&&H.kind===A&&H.info[I]===j})},C.prototype.dispose=function(){this.workerList.forEach(function(D){D.worker.terminate()}),this.workerList=[]},C}()},2825:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0})},8156:function(L,R,x){var v=this&&this.__createBinding||(Object.create?function(a,d,p,e){e===void 0&&(e=p);var r=Object.getOwnPropertyDescriptor(d,p);r&&!("get"in r?!d.__esModule:r.writable||r.configurable)||(r={enumerable:!0,get:function(){return d[p]}}),Object.defineProperty(a,e,r)}:function(a,d,p,e){e===void 0&&(e=p),a[e]=d[p]}),c=this&&this.__exportStar||function(a,d){for(var p in a)p==="default"||Object.prototype.hasOwnProperty.call(d,p)||v(d,a,p)};Object.defineProperty(R,"__esModule",{value:!0}),R.EDatachannelStatus=R.EConnectStatus=R.AliRTS=void 0,x(9543);var u=x(4845);Object.defineProperty(R,"AliRTS",{enumerable:!0,get:function(){return u.AliRTS}}),window&&(window.AliRTS=u.AliRTS);var S=x(5917);Object.defineProperty(R,"EConnectStatus",{enumerable:!0,get:function(){return S.EConnectStatus}});var f=x(280);Object.defineProperty(R,"EDatachannelStatus",{enumerable:!0,get:function(){return f.EDatachannelStatus}}),c(x(2825),R)},2672:(L,R)=>{var x;Object.defineProperty(R,"__esModule",{value:!0}),R.EN=void 0,function(v){v.MESSAGE_NOTSUPPORT_WEBRTC="not support webrtc",v.MESSAGE_BROWSER_NOTSUPPORT="browser not support",v.MESSAGE_BROWSER_VERSIONLOW="browser version too low",v.MESSAGE_NOTSUPPORT_H264="not support h264",v.MESSAGE_CREATEOFFER="create offer error"}(x||(R.EN=x={}))},2818:function(L,R,x){var v=this&&this.__assign||function(){return v=Object.assign||function(e){for(var r,n=1,s=arguments.length;n<s;n++)for(var t in r=arguments[n])Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);return e},v.apply(this,arguments)},c=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(R,"__esModule",{value:!0});var u,S=x(233),f=c(x(7028)),a=x(9428),d=c(x(2632));(function(e){e[e.UA=101]="UA",e[e.SUB_STATS=107]="SUB_STATS",e[e.PUB_STATS=108]="PUB_STATS",e[e.CONNECT_STATE_CHANGE=109]="CONNECT_STATE_CHANGE",e[e.START_PLAY=120]="START_PLAY",e[e.STOP_PLAY=121]="STOP_PLAY",e[e.SUBSCRIBE_START=125]="SUBSCRIBE_START",e[e.SUBSCRIBE_OK=126]="SUBSCRIBE_OK",e[e.FIRST_FRAME_TIME=137]="FIRST_FRAME_TIME",e[e.DC_HTTP_CONNECT=140]="DC_HTTP_CONNECT",e[e.DC_HTTP_CONNECT_OK=141]="DC_HTTP_CONNECT_OK",e[e.DC_SUB_ADD=142]="DC_SUB_ADD",e[e.DC_SUB_ADD_OK=143]="DC_SUB_ADD_OK",e[e.DC_CONNECT_STATE_CHANGE=144]="DC_CONNECT_STATE_CHANGE",e[e.DC_SUB_STOP=145]="DC_SUB_STOP",e[e.DC_SUB_STOP_OK=146]="DC_SUB_STOP_OK",e[e.DC_DISPOSE=147]="DC_DISPOSE",e[e.ERROR_INFO=150]="ERROR_INFO",e[e.DC_PUB_ADD=152]="DC_PUB_ADD",e[e.DC_PUB_ADD_OK=153]="DC_PUB_ADD_OK",e[e.DC_PUB_STOP=155]="DC_PUB_STOP",e[e.DC_PUB_STOP_OK=156]="DC_PUB_STOP_OK",e[e.RECONNECT=160]="RECONNECT",e[e.RECONNECT_PARAMS=161]="RECONNECT_PARAMS",e[e.RECONNECT_FINISH=162]="RECONNECT_FINISH",e[e.NOTIFY_MESSAGE=170]="NOTIFY_MESSAGE",e[e.CREATE_CLIENT=200]="CREATE_CLIENT",e[e.LOCALSTREAM_INITED=201]="LOCALSTREAM_INITED",e[e.START_PUBLISH=220]="START_PUBLISH",e[e.STOP_PUBLISH=221]="STOP_PUBLISH",e[e.PUBLISH_OK=222]="PUBLISH_OK",e[e.SET_VIDEOPROFILE=230]="SET_VIDEOPROFILE",e[e.SET_SCREENPROFILE=231]="SET_SCREENPROFILE",e[e.SET_AUDIOPROFILE=238]="SET_AUDIOPROFILE",e[e.ENABLE_AUDIO=232]="ENABLE_AUDIO",e[e.DISABLE_AUDIO=233]="DISABLE_AUDIO",e[e.ENABLE_VIDEO=234]="ENABLE_VIDEO",e[e.DISABLE_VIDEO=235]="DISABLE_VIDEO",e[e.STOP=236]="STOP",e[e.PLAY=237]="PLAY"})(u||(u={}));var p=function(){function e(r){this.customReporter=r?.customReporter,this.ct=r&&r.customTag?r.customTag:"",this.enableLog=!r||r.trackLog!=0,this._initParam(),this.slsTracker=new d.default({host:"cn-hangzhou.log.aliyuncs.com",project:"videocloud",logstore:"live-client-log",time:10,count:10})}return e.prototype.updateTid=function(){this.param?this.param.tid=S.Guid.create(32):this._initParam()},e.prototype.updateUrl=function(r){this.param&&(this.param.pu=r)},e.prototype.reportUA=function(r){this.reporter({msgid:u.UA,args:JSON.stringify({ua:r})})},e.prototype.reportPullStats=function(r){this.reporter({msgid:u.SUB_STATS,args:JSON.stringify(v({},r))})},e.prototype.reportPushStats=function(r){this.reporter({msgid:u.PUB_STATS,args:JSON.stringify(v({},r))})},e.prototype.reportStartPlay=function(r){this.reporter({msgid:u.START_PLAY,args:JSON.stringify({vurl:r})})},e.prototype.reportStopPlay=function(){this.reporter({msgid:u.STOP_PLAY})},e.prototype.reportSubscribeStart=function(r,n,s,t,i){this.reporter({msgid:u.SUBSCRIBE_START,args:JSON.stringify({vurl:r,surl:n,vMsid:s?s.join(", "):"",aMsid:t?t.join(", "):"",isSubAdd:!!i})})},e.prototype.reportSubscribeOk=function(r){r===void 0&&(r={}),this.reporter({msgid:u.SUBSCRIBE_OK,args:JSON.stringify({vurl:r.vurl||"",surl:r.surl||"",hrct:r.hrct,tcid:r.traceId,rslt:r.rslt,isSubAdd:!!r.isSubAdd})})},e.prototype.reportFirstFrameTime=function(r,n,s,t,i,l,E,b,_,h,o,g,m,T){this.reporter({msgid:u.FIRST_FRAME_TIME,args:JSON.stringify({vurl:r,cpct:s,hrct:t,tcid:n,ffct:i,rslt:l,cnct:E,stats:b,delct:_,addct:h,actct:o,vMsid:g?g.join(", "):"",aMsid:m?m.join(", "):"",isSubAdd:!!T})})},e.prototype.reportErrorInfo=function(r,n,s,t){r!==a.ErrorCode.ERROR_AUTOPLAY_ERROR&&this.reporter({msgid:u.ERROR_INFO,args:JSON.stringify({errorCode:r,message:n,tcid:s,extraInfo:t})})},e.prototype.reportReconnect=function(r,n,s,t,i){this.reporter({msgid:u.RECONNECT,args:JSON.stringify({errorCode:r,message:n,tcid:s,retryTimes:t,useTcp:i})})},e.prototype.reportReconnectParams=function(r,n,s,t,i,l){this.reporter({msgid:u.RECONNECT_PARAMS,args:JSON.stringify({type:r,url:n,vMsid:(s||[]).join(","),aMsid:(t||[]).join(","),useTcp:i,streamId:l})})},e.prototype.reportReconnectFinish=function(r){r===void 0&&(r={}),this.reporter({msgid:u.RECONNECT_FINISH,args:JSON.stringify(v({},r))})},e.prototype.reportCreateClient=function(){this.reporter({msgid:u.CREATE_CLIENT})},e.prototype.reportStartPublish=function(r,n,s){this.reporter({msgid:u.START_PUBLISH,args:JSON.stringify({purl:r,surl:n,isPubAdd:!!s})})},e.prototype.reportPublishOk=function(r,n,s,t,i,l,E,b){this.reporter({msgid:u.PUBLISH_OK,args:JSON.stringify({purl:r,surl:n,coct:s,hrct:t,act:i,tcid:l,totalct:E||s+t+i,isPubAdd:!!b})})},e.prototype.reportStopPublish=function(r,n){this.reporter({msgid:u.STOP_PUBLISH,args:JSON.stringify({url:r,isPubStop:!!n})})},e.prototype.reportVideoProfile=function(r){this.reporter({msgid:u.SET_VIDEOPROFILE,args:JSON.stringify({vp:r})})},e.prototype.reportScreenProfile=function(r){this.reporter({msgid:u.SET_SCREENPROFILE,args:JSON.stringify({sp:r})})},e.prototype.reportAudioProfile=function(r){this.reporter({msgid:u.SET_AUDIOPROFILE,args:JSON.stringify({vp:r})})},e.prototype.reportEnableAudio=function(){this.reporter({msgid:u.ENABLE_AUDIO})},e.prototype.reportDisableAudio=function(){this.reporter({msgid:u.DISABLE_AUDIO})},e.prototype.reportEnableVideo=function(){this.reporter({msgid:u.ENABLE_VIDEO})},e.prototype.reportDisableVideo=function(){this.reporter({msgid:u.DISABLE_VIDEO})},e.prototype.reportStop=function(r){this.reporter({msgid:u.STOP,args:JSON.stringify({tp:r})})},e.prototype.reportPlay=function(r){this.reporter({msgid:u.PLAY,args:JSON.stringify({tp:r})})},e.prototype.reportStreamCreated=function(r,n){this.reporter({msgid:u.LOCALSTREAM_INITED,args:JSON.stringify({userConfig:r,localStreamInfo:n})})},e.prototype.reportConnectionChange=function(r,n){this.reporter({msgid:u.CONNECT_STATE_CHANGE,args:JSON.stringify({connectionState:r,direction:n})})},e.prototype.reportDatachannelHttpConnect=function(r){this.reporter({msgid:u.DC_HTTP_CONNECT,args:JSON.stringify({url:r})})},e.prototype.reportDatachannelHttpConnectOk=function(r){this.reporter({msgid:u.DC_HTTP_CONNECT_OK,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelSubAdd=function(r){this.reporter({msgid:u.DC_SUB_ADD,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelPubAdd=function(r){this.reporter({msgid:u.DC_PUB_ADD,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelSubAddOk=function(r){this.reporter({msgid:u.DC_SUB_ADD_OK,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelPubAddOk=function(r){this.reporter({msgid:u.DC_PUB_ADD_OK,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelStatusChange=function(r){this.reporter({msgid:u.DC_CONNECT_STATE_CHANGE,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelSubStop=function(r){this.reporter({msgid:u.DC_SUB_STOP,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelPubStop=function(r){this.reporter({msgid:u.DC_PUB_STOP,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelSubStopOk=function(r){this.reporter({msgid:u.DC_SUB_STOP_OK,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelPubStopOk=function(r){this.reporter({msgid:u.DC_PUB_STOP_OK,args:JSON.stringify(v({},r))})},e.prototype.reportDatachannelDispose=function(r){this.reporter({msgid:u.DC_DISPOSE,args:JSON.stringify(v({},r))})},e.prototype.reportNotifyMessage=function(r){this.reporter({msgid:u.NOTIFY_MESSAGE,args:JSON.stringify(v({},r))})},e.prototype._initParam=function(){this.param||(this.param={APIVersion:"0.6.0",os:S.SystemUtil.platform,osv:S.SystemUtil.systemVersion,bt:S.BrowserUtil.browserName,bv:S.BrowserUtil.browserVersion,host:window.location.origin,page:window.location.href,uid:S.LocalStorage.uuid,tid:S.Guid.create(32),ver:f.default.version,ct:this.ct,dt:"",lv:"1.0.0",ua:navigator&&navigator.userAgent||"",pu:""})},e.prototype.reporter=function(r){var n=v(v(v(v({},this.param||{}),{tm:new Date().getTime()}),r||{}),{msgname:u[r.msgid]});if(this.customReporter&&typeof this.customReporter=="function")try{this.customReporter(n)}catch(s){console.error("[Error in customReporter] ",s)}this.enableLog&&this.slsTracker.send(n)},e.prototype.data2String=function(r){var n="";for(var s in r)r.hasOwnProperty(s)&&(n.length&&(n+="&"),n+=s+"="+r[s]);return n},e.HEARTHEAT_INTERVAL=4,e}();R.default=p},7668:function(L,R,x){var v,c=this&&this.__extends||(v=function(g,m){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(T,C){T.__proto__=C}||function(T,C){for(var D in C)Object.prototype.hasOwnProperty.call(C,D)&&(T[D]=C[D])},v(g,m)},function(g,m){if(typeof m!="function"&&m!==null)throw new TypeError("Class extends value "+String(m)+" is not a constructor or null");function T(){this.constructor=g}v(g,m),g.prototype=m===null?Object.create(m):(T.prototype=m.prototype,new T)}),u=this&&this.__assign||function(){return u=Object.assign||function(g){for(var m,T=1,C=arguments.length;T<C;T++)for(var D in m=arguments[T])Object.prototype.hasOwnProperty.call(m,D)&&(g[D]=m[D]);return g},u.apply(this,arguments)},S=this&&this.__awaiter||function(g,m,T,C){return new(T||(T=Promise))(function(D,y){function A(I){try{j(C.next(I))}catch(H){y(H)}}function w(I){try{j(C.throw(I))}catch(H){y(H)}}function j(I){var H;I.done?D(I.value):(H=I.value,H instanceof T?H:new T(function(F){F(H)})).then(A,w)}j((C=C.apply(g,m||[])).next())})},f=this&&this.__generator||function(g,m){var T,C,D,y,A={label:0,sent:function(){if(1&D[0])throw D[1];return D[1]},trys:[],ops:[]};return y={next:w(0),throw:w(1),return:w(2)},typeof Symbol=="function"&&(y[Symbol.iterator]=function(){return this}),y;function w(j){return function(I){return function(H){if(T)throw new TypeError("Generator is already executing.");for(;y&&(y=0,H[0]&&(A=0)),A;)try{if(T=1,C&&(D=2&H[0]?C.return:H[0]?C.throw||((D=C.return)&&D.call(C),0):C.next)&&!(D=D.call(C,H[1])).done)return D;switch(C=0,D&&(H=[2&H[0],D.value]),H[0]){case 0:case 1:D=H;break;case 4:return A.label++,{value:H[1],done:!1};case 5:A.label++,C=H[1],H=[0];continue;case 7:H=A.ops.pop(),A.trys.pop();continue;default:if(D=A.trys,!((D=D.length>0&&D[D.length-1])||H[0]!==6&&H[0]!==2)){A=0;continue}if(H[0]===3&&(!D||H[1]>D[0]&&H[1]<D[3])){A.label=H[1];break}if(H[0]===6&&A.label<D[1]){A.label=D[1],D=H;break}if(D&&A.label<D[2]){A.label=D[2],A.ops.push(H);break}D[2]&&A.ops.pop(),A.trys.pop();continue}H=m.call(g,A)}catch(F){H=[6,F],C=0}finally{T=D=0}if(5&H[0])throw H[1];return{value:H[0]?H[1]:void 0,done:!0}}([j,I])}}},a=this&&this.__rest||function(g,m){var T={};for(var C in g)Object.prototype.hasOwnProperty.call(g,C)&&m.indexOf(C)<0&&(T[C]=g[C]);if(g!=null&&typeof Object.getOwnPropertySymbols=="function"){var D=0;for(C=Object.getOwnPropertySymbols(g);D<C.length;D++)m.indexOf(C[D])<0&&Object.prototype.propertyIsEnumerable.call(g,C[D])&&(T[C[D]]=g[C[D]])}return T},d=this&&this.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(R,"__esModule",{value:!0}),R.RtsClient=void 0;var p=d(x(102)),e=x(5917),r=x(5676),n=x(9796),s=x(6600),t=d(x(2818)),i=d(x(7028)),l=x(7989),E=x(280),b=x(9428),_=x(5044),h=x(2470),o=function(g){function m(T){var C,D=g.call(this)||this;return D.pullH264Checked=!1,D.lastProtocol="udp",D.usePcReconnect=!1,D.reporter=new t.default(T),D.subscriber=new r.Subscriber(D.reporter,T?T.playConfig:void 0),D.publisher=new n.Publisher(D.reporter),D.commonController=new s.CommonController(D.reporter),D.pcRestorer=new h.PcRestorer({subscriber:D.subscriber,publisher:D.publisher,commonController:D.commonController}),D.usePcReconnect=!!(!((C=T?.singlePcConfig)===null||C===void 0)&&C.usePcReconnect),D.subscriber.on("onError",function(y){return S(D,void 0,void 0,function(){var A,w,j,I,H,F,U,B,k,V,G=this;return f(this,function(q){switch(q.label){case 0:return A=(j=y.extraInfo)===null||j===void 0?void 0:j.response,this.reporter.reportErrorInfo(y.errorCode,y.message,y.traceId,{sdp:(I=y.extraInfo)===null||I===void 0?void 0:I.sdp,response:{status:A?.status,data:A?.data},pcErrorInfo:(H=y.extraInfo)===null||H===void 0?void 0:H.pcErrorInfo}),this.usePcReconnect?[3,5]:b.SUB_RECONNECT_ERROR_LIST.includes(y.errorCode)?this.subscriber.isConnecting?[3,2]:(w=this.lastProtocol==="udp",this.lastProtocol=w?"tcp":"udp",console.log("retrying with",this.lastProtocol),[4,this.subscriber.retrySubscribe(y,{innerTcpOnly:w})]):[3,3];case 1:q.sent()?(this.reporter.reportReconnect(y.errorCode,y.message,y.traceId,(F=y.extraInfo)===null||F===void 0?void 0:F.retryTimes,w),this.emit("reconnect",this.makeReconnectEvent("sub",y))):this.emit("onError",y),q.label=2;case 2:return[3,4];case 3:this.emit("onError",y),q.label=4;case 4:return[3,6];case 5:[b.ErrorCode.ERROR_PC_DISCONNECTED,b.ErrorCode.ERROR_IP_MIGRATE].includes(y.errorCode)&&(this.pcRestorer.isReconnecting()||(y.extraInfo=u(u({},y.extraInfo),{retryTimes:1}),this.reporter.reportReconnect(y.errorCode,y.message,y.traceId,(U=y.extraInfo)===null||U===void 0?void 0:U.retryTimes),this.emit("reconnect",this.makeReconnectEvent("sub",y)),this.emit("connectStatusChange",{status:e.EConnectStatus.CONNECT_STATUS_RECONNECTING}),(V=(k=this.pcRestorer.restore((B=y.extraInfo.pcErrorInfo)===null||B===void 0?void 0:B.ips))===null||k===void 0?void 0:k.then(function(){G.reporter.reportReconnectFinish({level:"pc"}),G.emit("reconnectFinish")}))===null||V===void 0||V.catch(function(z){var $=new _.RtsError(b.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED,"pc full reconnect failed","",{originError:z});G.emit("onError",$),G.reporter.reportErrorInfo($.errorCode,$.message)}))),q.label=6;case 6:return[2]}})})}),D.subscriber.on("reconnect",function(y){var A;D.reporter.reportReconnect(y.errorCode,y.message,y.traceId,(A=y.extraInfo)===null||A===void 0?void 0:A.retryTimes),D.emit("reconnect",D.makeReconnectEvent("sub",y))}),D.subscriber.on("onPlayEvent",function(y){D.emit("onPlayEvent",y)}),D.subscriber.on("connectStatusChange",function(y){D.emit("connectStatusChange",y),D.reporter.reportConnectionChange(e.EConnectStatus[y.status],"sub")}),D.publisher.on("connectStatusChange",function(y){D.emit("connectStatusChange",y),D.reporter.reportConnectionChange(e.EConnectStatus[y.status],"pub")}),D.publisher.on("onError",function(y){return S(D,void 0,void 0,function(){var A,w,j,I,H,F,U,B,k,V,G,q=this;return f(this,function(z){switch(z.label){case 0:return A=(j=y.extraInfo)===null||j===void 0?void 0:j.response,this.reporter.reportErrorInfo(y.errorCode,y.message,y.traceId,{sdp:(I=y.extraInfo)===null||I===void 0?void 0:I.sdp,response:{status:A?.status,data:A?.data},pcErrorInfo:(H=y.extraInfo)===null||H===void 0?void 0:H.pcErrorInfo}),this.usePcReconnect?[3,5]:b.PUB_RECONNECT_ERROR_LIST.includes(y.errorCode)?this.publisher.isConnecting?[3,2]:(w=y.errorCode===b.ErrorCode.ERROR_TRANSPORT_CLOSED&&((F=y.extraInfo)===null||F===void 0?void 0:F.protocol)!=="tcp",console.log("Retrying with ",w?"TCP":"UDP"),[4,this.publisher.retryPublish(y,w)]):[3,3];case 1:z.sent()?(this.reporter.reportReconnect(y.errorCode,y.message,y.traceId,(U=y.extraInfo)===null||U===void 0?void 0:U.retryTimes,w),this.emit("reconnect",this.makeReconnectEvent("pub",y))):this.emit("onError",y),z.label=2;case 2:return[3,4];case 3:this.emit("onError",y),z.label=4;case 4:return[3,6];case 5:[b.ErrorCode.ERROR_PC_DISCONNECTED,b.ErrorCode.ERROR_IP_MIGRATE].includes(y.errorCode)&&(this.pcRestorer.isReconnecting()||(y.extraInfo=u(u({},y.extraInfo),{retryTimes:1}),this.reporter.reportReconnect(y.errorCode,y.message,y.traceId,(B=y.extraInfo)===null||B===void 0?void 0:B.retryTimes),this.emit("reconnect",this.makeReconnectEvent("pub",y)),this.emit("connectStatusChange",{status:e.EConnectStatus.CONNECT_STATUS_RECONNECTING}),(G=(V=this.pcRestorer.restore((k=y.extraInfo.pcErrorInfo)===null||k===void 0?void 0:k.ips))===null||V===void 0?void 0:V.then(function(){q.reporter.reportReconnectFinish({level:"pc"}),q.emit("reconnectFinish")}))===null||G===void 0||G.catch(function($){var re=new _.RtsError(b.ErrorCode.ERROR_SINGLE_PC_FULL_RECONNECT_HTTP_FAILED,"pc full reconnect failed","",{originError:$});q.emit("onError",re),q.reporter.reportErrorInfo(re.errorCode,re.message)}))),z.label=6;case 6:return[2]}})})}),D.publisher.on("reconnect",function(y){var A;D.reporter.reportReconnect(y.errorCode,y.message,y.traceId,(A=y.extraInfo)===null||A===void 0?void 0:A.retryTimes),D.emit("reconnect",D.makeReconnectEvent("pub",y))}),D.commonController.on("connectStatusChange",function(y){D.emit("connectStatusChange",y),D.reporter.reportConnectionChange(e.EConnectStatus[y.status],"signalChannel")}),D.commonController.on("onError",function(y){D.reporter.reportErrorInfo(y.errorCode,y.message,y.traceId),D.emit("onError",y)}),D.commonController.on("datachannelStatusChange",function(y){D.emit("datachannelStatusChange",y),D.reporter.reportDatachannelStatusChange({state:E.EDatachannelStatus[y.status],url:"",label:"SIGNAL",id:-1,msid:""})}),D.commonController.on("encodedFrame",function(y){D.emit("encodedFrame",y)}),D.commonController.on("receivedSEI",function(y){D.emit("receivedSEI",y)}),D.commonController.on("onPlayEvent",function(y){D.emit("onPlayEvent",y)}),D.commonController.on("reconnect",function(y){y.type!=="pc"&&D.emit("reconnect",y)}),D.commonController.on("reconnectFinish",function(y){D.reporter.reportReconnectFinish(y),D.emit("reconnectFinish",y)}),D.commonController.on("traceId",function(y){D.emit("traceId",y)}),D.commonController.on("heartbeat",function(y){D.emit("heartbeat",y)}),D.reporter.reportCreateClient(),D}return c(m,g),m.prototype.getVersion=function(){return i.default.version},m.prototype.isSupport=function(T){var C=new l.SupportUtil;return this.pullH264Checked=!0,C.isSupport(T)},m.prototype.checkPublishSupport=function(){return new l.SupportUtil().checkPublishSupport()},m.prototype.checkEncodedTransformSupport=function(){return new l.SupportUtil().checkEncodedTransformSupport()},m.prototype.subscribe=function(T,C){return this.reporter.updateUrl(T),this.commonController.setPeerconnection(this.subscriber.getPeerConnection()),this.subscriber.resetResubscribeStatus(),this.subscriber.subscribeWithReconnect(T,u(u({},C),{isH264Checked:this.pullH264Checked}))},m.prototype.subscribeAdd=function(T){return this.commonController.subscribeAdd(T)},m.prototype.subscribeActive=function(T){return this.commonController.subscribeActive(T)},m.prototype.subscribeDeleteTracks=function(T){return this.commonController.subscribeDeleteTracks(T)},m.prototype.subscribeStop=function(T){return this.commonController.subscribeStop(T)},m.prototype.publishAdd=function(T){return this.commonController.publishAdd(T)},m.prototype.publishDeleteTracks=function(T){return this.commonController.publishDeleteTracks(T)},m.prototype.publishReplaceTracks=function(T){return this.commonController.publishReplaceTracks(T)},m.prototype.publishStop=function(T){return this.commonController.publishStop(T)},m.prototype.subscribeAddDatachannel=function(T){return this.commonController.subscribeAddDatachannel(T)},m.prototype.subscribeStopDatachannel=function(T){return this.commonController.subscribeStopDatachannel(T)},m.prototype.publishAddDatachannel=function(T){return this.commonController.publishAddDatachannel(T)},m.prototype.publishStopDatachannel=function(T){return this.commonController.publishStopDatachannel(T)},m.prototype.unsubscribe=function(){this.subscriber.resetResubscribeStatus(),this.subscriber.unsubscribe()},m.prototype.startLiveStream=function(T,C,D){return this.reporter.reportStartPlay(T),this.subscriber.startLiveStream(T,C,D)},m.prototype.stopLiveStream=function(){this.reporter.reportStopPlay(),this.subscriber.stopLiveStream()},m.prototype.muteLiveStream=function(T){this.subscriber.muteLiveStream(T)},m.prototype.publish=function(T,C,D){return S(this,void 0,void 0,function(){return f(this,function(y){return this.reporter.updateUrl(T),this.commonController.setPeerconnection(this.publisher.getPeerConnection()),this.publisher.resetRepublishStatus(),[2,this.publisher.publishWithReconnect(T,C,D)]})})},m.prototype.unpublish=function(){return this.publisher.resetRepublishStatus(),this.publisher.unpublish()},m.prototype.sendSEI=function(T){this.publisher.sendSEI(T),this.commonController.sendSEI(T)},m.prototype.getPublishTrackInfoList=function(){return this.publisher.getTrackInfoList()},m.prototype.getTransportStats=function(){return this.subscriber.getPeerConnection().getSubMonitor().getTransportStats()},m.prototype.getRemoteVideoStats=function(){return this.subscriber.getPeerConnection().getSubMonitor().getRemoteVideoStats()},m.prototype.getRemoteAudioStats=function(){return this.subscriber.getPeerConnection().getSubMonitor().getRemoteAudioStats()},m.prototype.getSubscribeVideoStats=function(T,C){return this.commonController.getSubscribeVideoStats(T,C)},m.prototype.getSubscribeAudioStats=function(T,C){return this.commonController.getSubscribeAudioStats(T,C)},m.prototype.getPublishVideoStats=function(T,C){return this.commonController.getPublishVideoStats(T,C)},m.prototype.getPublishAudioStats=function(T,C){return this.commonController.getPublishAudioStats(T,C)},m.prototype.setReceiverCodecPreferences=function(T){return this.commonController.setReceiverCodecPreferences(T)},m.prototype.setSenderCodecPreferences=function(T){return this.commonController.setSenderCodecPreferences(T)},m.prototype.makeReconnectEvent=function(T,C){var D=C||{},y=D.extraInfo,A=a(D,["extraInfo"]),w=y||{},j=w.retryTimes,I=a(w,["retryTimes"]),H=T;return{type:this.usePcReconnect?"pc":H,reason:A,retryTimes:j,extraInfo:I}},m.prototype.heartbeat=function(T){var C;(C=this.commonController.peerCore)===null||C===void 0||C.sendOnceHeartbeat(T)},m.prototype.setAutoHeartbeat=function(T){var C;(C=this.commonController.peerCore)===null||C===void 0||C.startSignalHeartbeatTimer(T)},m.prototype.clearAutoHeartbeat=function(){var T;(T=this.commonController.peerCore)===null||T===void 0||T.stopSignalHeartbeatTimer()},m.prototype.sendFalseHeartbeat=function(T){var C;(C=this.commonController.peerCore)===null||C===void 0||C.sendFalseHeartbeat(T)},m.prototype.updateAuth=function(T){return this.commonController.updateAuth(T)},m}(p.default);R.RtsClient=o},335:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0});var x=function(){function v(c){this.useGainNode=!0,this.audioContext=new AudioContext,this.audioDestination=this.audioContext.createMediaStreamDestination(),this.audioSource=[],this.gainNode=null,this.audioTrack=null,this.audioTrackArr=c.trackList||[],this.useGainNode=typeof c.useGainNode!="boolean"||c.useGainNode,this.useGainNode&&(this.gainNode=this.audioContext.createGain(),this.gainNode.connect(this.audioContext.destination),this.gainNode.gain.value=0),this.getMixedAudioTrack()}return v.prototype.destroy=function(){var c;(c=this.getMixedAudioTrack())===null||c===void 0||c.stop(),this.disconnectSourceNode(),this.audioContext.close(),this.audioTrackArr=[]},v.prototype.updateTrackList=function(c){c.length&&(this.disconnectSourceNode(),this.audioTrackArr=c,this.connectNode())},v.prototype.getMixedAudioTrack=function(){return this.audioTrack||(this.connectNode(),this.audioTrack=this.audioDestination.stream.getAudioTracks()[0]),this.audioTrack},v.prototype.connectNode=function(){var c=this;this.audioTrackArr.forEach(function(u){var S=new MediaStream;S.addTrack(u);var f=c.audioContext.createMediaStreamSource(S);c.gainNode&&f.connect(c.gainNode),c.audioSource.push(f)}),this.audioSource.forEach(function(u){u.connect(c.audioDestination)})},v.prototype.disconnectSourceNode=function(){var c=this;this.audioSource.forEach(function(u){c.gainNode&&u.disconnect(c.gainNode),u.disconnect(c.audioDestination)}),this.audioSource=[]},v}();R.default=x},1893:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.TwoDRenderer=void 0;var x=function(){function v(c){this.video=c.video,this.canvas=c.canvas,this.ctx=this.canvas.getContext("2d")}return v.prototype.render=function(){var c,u,S=this.video,f=this.canvas;S&&f&&((c=this.ctx)===null||c===void 0||c.clearRect(0,0,f.width,f.height),(u=this.ctx)===null||u===void 0||u.drawImage(S,0,0,1*S.videoWidth,1*S.videoHeight),this.requestId=requestAnimationFrame(this.render.bind(this)))},v.prototype.stop=function(){this.requestId&&cancelAnimationFrame(this.requestId)},v}();R.TwoDRenderer=x},6295:(L,R,x)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.CanvasRenderer=void 0;var v=x(1893),c=function(){function u(S){this.video=S.video,this.canvas=this.initCanvas(),this.activeRenderer=this.initRenderer()}return Object.defineProperty(u.prototype,"mediaStream",{get:function(){var S;return this.ms||(this.ms=((S=this.canvas)===null||S===void 0?void 0:S.captureStream())||void 0),this.ms},enumerable:!1,configurable:!0}),u.prototype.start=function(){this.render()},u.prototype.stop=function(){this.activeRenderer.stop()},u.prototype.initCanvas=function(){var S=document.createElement("canvas"),f=this.video;return S.width=1*f.videoWidth,S.height=1*f.videoHeight,S},u.prototype.initRenderer=function(){return new v.TwoDRenderer({video:this.video,canvas:this.canvas})},u.prototype.render=function(){this.activeRenderer.render()},u.prototype.resize=function(S,f){this.canvas&&(this.canvas.width=S,this.canvas.height=f)},u}();R.CanvasRenderer=c},6420:function(L,R,x){var v=this&&this.__awaiter||function(a,d,p,e){return new(p||(p=Promise))(function(r,n){function s(l){try{i(e.next(l))}catch(E){n(E)}}function t(l){try{i(e.throw(l))}catch(E){n(E)}}function i(l){var E;l.done?r(l.value):(E=l.value,E instanceof p?E:new p(function(b){b(E)})).then(s,t)}i((e=e.apply(a,d||[])).next())})},c=this&&this.__generator||function(a,d){var p,e,r,n,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return n={next:t(0),throw:t(1),return:t(2)},typeof Symbol=="function"&&(n[Symbol.iterator]=function(){return this}),n;function t(i){return function(l){return function(E){if(p)throw new TypeError("Generator is already executing.");for(;n&&(n=0,E[0]&&(s=0)),s;)try{if(p=1,e&&(r=2&E[0]?e.return:E[0]?e.throw||((r=e.return)&&r.call(e),0):e.next)&&!(r=r.call(e,E[1])).done)return r;switch(e=0,r&&(E=[2&E[0],r.value]),E[0]){case 0:case 1:r=E;break;case 4:return s.label++,{value:E[1],done:!1};case 5:s.label++,e=E[1],E=[0];continue;case 7:E=s.ops.pop(),s.trys.pop();continue;default:if(r=s.trys,!((r=r.length>0&&r[r.length-1])||E[0]!==6&&E[0]!==2)){s=0;continue}if(E[0]===3&&(!r||E[1]>r[0]&&E[1]<r[3])){s.label=E[1];break}if(E[0]===6&&s.label<r[1]){s.label=r[1],r=E;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(E);break}r[2]&&s.ops.pop(),s.trys.pop();continue}E=d.call(a,s)}catch(b){E=[6,b],e=0}finally{p=r=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}([i,l])}}},u=this&&this.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(R,"__esModule",{value:!0}),R.Clock=void 0;var S=u(x(2505)),f=function(){function a(){this.request=S.default.create({timeout:6e4}),this.offset=0,this.nextAttemptMs=a.DEFAULT_ATTEMPT_INTERVAL,this.attemptCount=0,this.random=Math.random(),this.startSyncClock()}return a.prototype.now=function(){if(this.offset&&!Number.isNaN(this.offset)){var d=Date.now()+this.offset;return Math.round(d)}return console.warn("return Date.now()"),Date.now()},a.prototype.syncClock=function(){return v(this,void 0,void 0,function(){var d,p,e,r,n;return c(this,function(s){switch(s.label){case 0:return d=!1,p=Date.now(),[4,this.fetchServerTime()];case 1:return e=s.sent(),r=Date.now(),e?(n=new Date(e).getTime(),Number.isNaN(n)||(this.offset=this.calculateOffset(p+this.fixRequestStartTime(),r,n),d=!0)):console.warn("Failed to fetch server time, should try again"),[2,d]}})})},a.prototype.startSyncClock=function(){return v(this,void 0,void 0,function(){var d,p=this;return c(this,function(e){switch(e.label){case 0:return[4,this.syncClock()];case 1:return d=e.sent(),this.nextAttemptMs=d?a.DEFAULT_ATTEMPT_INTERVAL:a.DEFAULT_ATTEMPT_RETRY_INTERVAL,this.stopSyncClock(),this.attemptTimer=setTimeout(function(){p.startSyncClock()},this.nextAttemptMs),[2]}})})},a.prototype.stopSyncClock=function(){this.attemptTimer&&clearTimeout(this.attemptTimer),this.attemptTimer=void 0},a.prototype.fetchServerTime=function(){return v(this,void 0,void 0,function(){var d,p,e;return c(this,function(r){switch(r.label){case 0:this.attemptCount++,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.request.get(this.attachCount(a.DEFAULT_TIME_SOURCE))];case 2:return d=(e=r.sent())===null||e===void 0?void 0:e.data,[3,4];case 3:return p=r.sent(),console.log("GetServerTime error",p),[3,4];case 4:return[2,d]}})})},a.prototype.calculateOffset=function(d,p,e){return e-(p-(p-d)/2)},a.prototype.fixRequestStartTime=function(){var d=0,p=performance.getEntriesByName(this.attachCount(a.DEFAULT_TIME_SOURCE),"resource");if(p?.length)if(p.length>1)console.warn("multiple resource entries found");else try{var e=p[0];d=e.requestStart-e.startTime,e.domainLookupEnd,e.domainLookupStart,e.secureConnectionStart,e.connectStart,e.requestStart,e.secureConnectionStart}catch(r){console.log(r)}else console.warn("no resource entry found"),window.RTS_DISABLE_CLEAR_RESOURCE_TIMINGS||performance.clearResourceTimings();return Math.max(0,d||0)},a.prototype.attachCount=function(d){return"".concat(d,"&count=").concat(this.random,"_").concat(this.attemptCount)},a.DEFAULT_TIME_SOURCE="https://time.akamai.com/?iso&ms",a.DEFAULT_ATTEMPT_INTERVAL=3e4,a.DEFAULT_ATTEMPT_RETRY_INTERVAL=5e3,a}();R.Clock=f},102:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0});var x=function(){function v(){this._eventMap={}}return v.prototype.listeners=function(c){return this._eventMap[c]||[]},v.prototype.emit=function(c){for(var u=this,S=[],f=1;f<arguments.length;f++)S[f-1]=arguments[f];var a=this._eventMap[c];return!!Array.isArray(a)&&(a.forEach(function(d){return d.apply(u,S)}),!0)},v.prototype.off=function(c,u){var S=this._eventMap[c];return Array.isArray(S)&&(this._eventMap[c]=S.filter(function(f){return f!==u})),this},v.prototype.removeAllListeners=function(c){return c===void 0?this._eventMap={}:this._eventMap[c]&&(this._eventMap[c]=[]),this},v.prototype.on=function(c,u){return this._eventMap[c]?this._eventMap[c].push(u):this._eventMap[c]=[u],this},v.prototype.once=function(c,u){var S=this,f=function(){for(var a=[],d=0;d<arguments.length;d++)a[d]=arguments[d];S.off(c,f),u.apply(S,a)};return this.on(c,f),this},v}();R.default=x},492:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.MediaObserver=void 0;var x=function(){function v(c){this.timeout=c.timeout||v.DEFAULT_TIMEOUT,this.handler=c.handler||function(){},this.watchTimer=null}return Object.defineProperty(v.prototype,"actTimeout",{get:function(){return this.timeout},enumerable:!1,configurable:!0}),v.prototype.check=function(c,u,S,f){var a=this;this.hasNoData(c)?this.watchTimer||(this.watchTimer=window.setTimeout(function(){a.handler(u,S,f)},this.timeout)):this.watchTimer&&(clearTimeout(this.watchTimer),this.watchTimer=null)},v.prototype.hasNoData=function(c){return!c||(c.video?!(Number(c.video.bytesReceivedPerSecond)>0):!c.audio||!(Number(c.audio.bytesReceivedPerSecond)>0))},v.prototype.updateConfig=function(c){this.timeout=c.timeout||this.timeout,this.handler=c.handler||this.handler},v.prototype.reset=function(){this.watchTimer&&(clearTimeout(this.watchTimer),this.watchTimer=null)},v.prototype.dispose=function(){this.timeout=v.DEFAULT_TIMEOUT,this.handler=function(){},this.watchTimer&&(clearTimeout(this.watchTimer),this.watchTimer=null)},v.DEFAULT_TIMEOUT=6e3,v}();R.MediaObserver=x},9594:(L,R)=>{Object.defineProperty(R,"__esModule",{value:!0}),R.readUUID=R.discardEPB=R.insertEPB=R.SODBtoRBSP=R.convertPayloadSize=R.NALU=R.SEI=R.parseSei=R.insertSei=void 0,R.insertSei=function(c,u,S,f){S===void 0&&(S=5);for(var a=c.data,d=new DataView(a),p=0;;){if(d.getUint32(p)===1){d.getUint8(p+4);var e=new x(u,S,f).buffer,r=new v(e).buffer,n=new ArrayBuffer(r.byteLength+a.byteLength),s=new Uint8Array(n),t=new Uint8Array(r);s.set(t);var i=new Uint8Array(a);s.set(i,r.byteLength),c.data=n,p+=1;break}if((p+=1)+4>=d.byteLength)break}},R.parseSei=function(c){for(var u=[],S=new DataView(c),f=0;;){var a=f,d=S.getUint32(a);if(a+=4,d===1){if((31&S.getUint8(a++))===6){for(var p=S.getUint8(a++),e=p===5?16:0,r=0;S.getUint8(a)==255;)a++,r+=255;if((r+=S.getUint8(a++))>0&&S.byteLength>a+r){var n=new Uint8Array(S.buffer),s="";if(p===5){var t=n.slice(a,a+e);s=(0,R.readUUID)((0,R.discardEPB)(t))}var i=n.slice(a+e,a+r);a+=r,u.push({payloadType:p,uuid:s,data:i.buffer})}}f=a}else f+=1;if(f+4>=S.byteLength)break}return u};var x=function(c,u,S){u===void 0&&(u=5);var f=u===5?16:0,a=c.byteLength+f,d=(0,R.convertPayloadSize)(a),p=d.buffer.byteLength,e=new ArrayBuffer(1+p+f+c.byteLength),r=new Uint8Array(e),n=0;if(r[n++]=u,r.set(d,n),n+=d.byteLength,u===5){S=(S||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var s=0;s<16;s++)r[n+s]=parseInt(S.substr(2*s,2),16);n+=16}var t=new Uint8Array(c);r.set(t,n);var i=(0,R.SODBtoRBSP)(r);this.buffer=i.buffer};R.SEI=x;var v=function(c){var u=new Uint8Array([0,0,0,1]),S=new Uint8Array([6]),f=new ArrayBuffer(u.byteLength+S.byteLength+c.byteLength),a=new Uint8Array(f);a.set(u),a.set(S,u.byteLength),a.set(new Uint8Array(c),u.byteLength+S.byteLength),this.buffer=f};R.NALU=v,R.convertPayloadSize=function(c){if(c<=0)throw new Error("payloadSize must be a positive integer.");for(var u=Math.ceil(c/255),S=new ArrayBuffer(u),f=new DataView(S),a=0;a<u-1;a++)f.setUint8(a,255);return f.setUint8(u-1,c%255&255),new Uint8Array(S)},R.SODBtoRBSP=function(c){for(var u=new Uint8Array(c),S="",f=0;f<u.length;f++)S+=u[f].toString(2).padStart(8,"0");for(S+="1";S.length%8!=0;)S+="0";var a=S.length/8,d=new Uint8Array(a);for(f=0;f<a;f++)d[f]=parseInt(S.slice(8*f,8*f+8),2);return(0,R.insertEPB)(d)},R.insertEPB=function(c){for(var u=[],S=0,f=0;f<c.length;f++)u.push(c[f]),c[f]===0?++S===2&&f<c.length-1&&c[f+1]<=3&&(u.push(3),S=0):S=0;return new Uint8Array(u)},R.discardEPB=function(c){for(var u=c.byteLength,S=[],f=1;f<u-2;)c[f]===0&&c[f+1]===0&&c[f+2]===3?(S.push(f+2),f+=2):f++;if(S.length===0)return c;var a=u-S.length,d=new Uint8Array(a),p=0;for(f=0;f<a;p++,f++)p===S[0]&&(p++,S.shift()),d[f]=c[p];return d},R.readUUID=function(c){if(c.length!==16)throw new Error("UUID must be 16 bytes long.");var u=c.reduce(function(S,f){return S+f.toString(16).padStart(2,"0")},"");return"".concat(u.slice(0,8),"-").concat(u.slice(8,12),"-").concat(u.slice(12,16),"-").concat(u.slice(16,20),"-").concat(u.slice(20))}},8219:function(L,R,x){var v=this&&this.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(R,"__esModule",{value:!0});var c=v(x(2505));R.default=c.default.create({baseURL:"",timeout:5e3,headers:{"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"}})},4315:function(L,R,x){var v=this&&this.__spreadArray||function(f,a,d){if(d||arguments.length===2)for(var p,e=0,r=a.length;e<r;e++)!p&&e in a||(p||(p=Array.prototype.slice.call(a,0,e)),p[e]=a[e]);return f.concat(p||Array.prototype.slice.call(a))};Object.defineProperty(R,"__esModule",{value:!0}),R.SdpUtil=void 0;var c=x(233),u=function(){this.stramId="",this.audioTrackId="",this.videoTrackId="",this.screenTrackId="",this.customTrackId=""},S=function(){function f(a){this.sdpLines=new Array,this.localStream=a,this.publishStreamInfo=new u}return Object.defineProperty(f.prototype,"sdp",{get:function(){return this.sdpLines.join(`\r
154
154
  `)},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"videoTrackId",{get:function(){return this.publishStreamInfo.videoTrackId},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"screenTrackId",{get:function(){return this.publishStreamInfo.videoTrackId},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"videoName",{get:function(){return"rts video"},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"screenName",{get:function(){return"rts screen"},enumerable:!1,configurable:!0}),Object.defineProperty(f.prototype,"hasTcpCandidate",{get:function(){return this.sdpLines.some(function(a){return a.indexOf("tcptype")!==-1})},enumerable:!1,configurable:!0}),f.prototype.init=function(a){this.sdpLines=a.split(`\r
155
155
  `)},f.prototype.addNack=function(){for(var a=0;a<this.sdpLines.length;++a)if(this.sdpLines[a].indexOf("opus")!=-1&&this.sdpLines[a+1].indexOf("rtcp-fb")!=-1){var d=this.sdpLines[a+1].split(" ");d.length==2&&(this.sdpLines[a+2].indexOf("rtcp-fb")!=-1?this.sdpLines.splice(a+3,0,d[0]+" nack"):this.sdpLines.splice(a+2,0,d[0]+" nack"))}},f.prototype.parseCustomMsid=function(a){var d={stream:"",track:""};if(!a)return d;var p=a.trim().split(" ");return p.length==2?(d.stream=p[0],d.track=p[1]):d.track=p[0],d},f.prototype.modifyTrackName=function(a){a===void 0&&(a={});var d=a.vMsid,p=a.aMsid,e=d?this.parseCustomMsid(d):{stream:"rts",track:"video"},r=p?this.parseCustomMsid(p):{stream:"rts",track:"audio"},n="";if(this.localStream){this.publishStreamInfo.stramId=this.localStream.mediaStream.id,this.localStream.audioTrack&&(this.publishStreamInfo.audioTrackId=this.localStream.audioTrack.id,n=r.stream||"-"),this.localStream.videoTrack&&(this.publishStreamInfo.videoTrackId=this.localStream.videoTrack.id,n=e.stream||"-");for(var s=!1,t=!1,i=0;i<this.sdpLines.length;++i){var l=this.sdpLines[i],E=l.indexOf(this.publishStreamInfo.stramId);this.publishStreamInfo.stramId&&E!=-1&&(this.sdpLines[i]=this.sdpLines[i].replace(this.publishStreamInfo.stramId,n),c.BrowserUtil.isFirefox&&(s?this.sdpLines[i]=this.sdpLines[i].substring(0,E+n.length+1)+r.track:t&&(this.sdpLines[i]=this.sdpLines[i].substring(0,E+n.length+1)+e.track))),this.publishStreamInfo.audioTrackId&&l.indexOf(this.publishStreamInfo.audioTrackId)!=-1?this.sdpLines[i]=this.sdpLines[i].replace(this.publishStreamInfo.audioTrackId,r.track):this.publishStreamInfo.videoTrackId&&l.indexOf(this.publishStreamInfo.videoTrackId)!=-1&&(this.sdpLines[i]=this.sdpLines[i].replace(this.publishStreamInfo.videoTrackId,e.track)),l.indexOf("m=audio")!=-1?(s=!0,t=!1):l.indexOf("m=video")!=-1&&(t=!0,s=!1),l.indexOf("a=ssrc")!=-1&&(E=l.indexOf("cname:"))!==-1&&(s?this.sdpLines[i]=l.substr(0,E+6)+r.track:t&&(this.sdpLines[i]=l.substr(0,E+6)+e.track))}}},f.prototype.getPublishVideoSdp=function(){for(var a=-1,d=-1,p=!1,e=0;e<this.sdpLines.length;++e){if(p&&this.sdpLines[e].indexOf("m=application")>-1){d=e-1;break}if(this.sdpLines[e].indexOf("m=video")>-1){if(p){d=e-1;break}a=e}this.sdpLines[e].indexOf("rts video")>-1&&(p=!0)}return p?(d===-1&&(d=this.sdpLines.length-1),this.sdpLines.splice(a,d-a).join(`\r
156
- `)):""},f.prototype.removeVideoTrack=function(a){for(var d="rts "+a,p=-1,e=-1,r=!1,n=0;n<this.sdpLines.length;++n){if(r&&this.sdpLines[n].indexOf("m=application")>-1){e=n-1;break}if(this.sdpLines[n].indexOf("m=video")>-1){if(r){e=n-1;break}p=n}this.sdpLines[n].indexOf(d)>-1&&(r=!0)}return!!r&&(e===-1&&(e=this.sdpLines.length-1),this.sdpLines.splice(p,e-p),!0)},f.prototype.ios15PushHack=function(){var a=!1,d=-1;if(this.sdpLines.forEach(function(r,n){r.includes("m=video")&&(a=!0),a&&d===-1&&r.includes("a=")&&(d=n)}),d!==-1){var p=this.getExtmapIds(),e=Math.max.apply(Math,p)+1;this.sdpLines.splice(d,0,"a=extmap:".concat(e," urn:3gpp:video-orientation"))}},f.prototype.addSps=function(){this.sdpLines=this.sdpLines.map(function(a){return a.includes("a=fmtp:")&&a.includes("level-asymmetry-allowed")?a+=";sps-pps-idr-in-keyframe=1":a})},f.prototype.removeTwccRtcpFb=function(){this.sdpLines=this.sdpLines.filter(function(a){return!a.includes("http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01")})},f.prototype.removeUdpCandidate=function(){this.sdpLines=this.sdpLines.filter(function(a){return!a.includes("a=candidate:")||!a.includes("UDP")}),console.log("removed udp candidate")},f.prototype.setDirection=function(a){a===void 0&&(a={direction:"recvonly"});var d=["sendonly","recvonly","sendrecv"].filter(function(r){return r!==a.direction}),p=!1,e=!1;this.sdpLines=this.sdpLines.map(function(r,n){if(r.includes("m=video"))p=!0,e=!1;else if(r.includes("m=audio"))e=!0,p=!1;else if(r.includes("m=application"))p=!1,e=!1;else if(p||e){var s;if(d.some(function(t){if(r.includes(t))return s=t,!0})&&s)return r.replace(s,a.direction)}return r})},f.prototype.removeSDES=function(){var a=["urn:ietf:params:rtp-hdrext:sdes:mid","urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id","urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"];this.sdpLines=this.sdpLines.filter(function(d){return!a.some(function(p){return d.includes(p)})})},f.prototype.addStereo=function(){var a=this;this.getPayloadType("opus").map(this.getFmtpIndex.bind(this)).filter(function(d){return d!==void 0}).forEach(function(d){a.sdpLines[d].indexOf("stereo=1")>-1||(a.sdpLines[d]=a.sdpLines[d]+";stereo=1")})},f.prototype.dispose=function(){this.localStream&&(this.localStream=void 0),this.sdpLines=new Array,this.publishStreamInfo=new u},f.prototype.getExtmapIds=function(){return this.sdpLines.reduce(function(a,d){if(d.includes("a=extmap")){var p=Number(d.replace("a=extmap:","").split(" ")[0]);return v(v([],a,!0),[p],!1)}return a},[]).filter(function(a){return a})},f.prototype.getPayloadType=function(a){for(var d=[],p=new RegExp("a\\=rtpmap\\:(\\d+) ".concat(a,".*"),"i"),e=0;e<this.sdpLines.length;e++){var r=this.sdpLines[e],n=p.exec(r);n?.length&&d.push(n[1])}return d},f.prototype.getFmtpIndex=function(a){for(var d=new RegExp("a\\=fmtp\\:".concat(a," .*"),"i"),p=0;p<this.sdpLines.length;p++){var e=this.sdpLines[p];if(d.test(e))return p}},f}();R.SdpUtil=S},7989:function(L,R,x){var v=this&&this.__awaiter||function(e,r,n,s){return new(n||(n=Promise))(function(t,i){function l(_){try{b(s.next(_))}catch(h){i(h)}}function E(_){try{b(s.throw(_))}catch(h){i(h)}}function b(_){var h;_.done?t(_.value):(h=_.value,h instanceof n?h:new n(function(o){o(h)})).then(l,E)}b((s=s.apply(e,r||[])).next())})},c=this&&this.__generator||function(e,r){var n,s,t,i,l={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return i={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function E(b){return function(_){return function(h){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,h[0]&&(l=0)),l;)try{if(n=1,s&&(t=2&h[0]?s.return:h[0]?s.throw||((t=s.return)&&t.call(s),0):s.next)&&!(t=t.call(s,h[1])).done)return t;switch(s=0,t&&(h=[2&h[0],t.value]),h[0]){case 0:case 1:t=h;break;case 4:return l.label++,{value:h[1],done:!1};case 5:l.label++,s=h[1],h=[0];continue;case 7:h=l.ops.pop(),l.trys.pop();continue;default:if(t=l.trys,!((t=t.length>0&&t[t.length-1])||h[0]!==6&&h[0]!==2)){l=0;continue}if(h[0]===3&&(!t||h[1]>t[0]&&h[1]<t[3])){l.label=h[1];break}if(h[0]===6&&l.label<t[1]){l.label=t[1],t=h;break}if(t&&l.label<t[2]){l.label=t[2],l.ops.push(h);break}t[2]&&l.ops.pop(),l.trys.pop();continue}h=r.call(e,l)}catch(o){h=[6,o],s=0}finally{n=t=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([b,_])}}};Object.defineProperty(R,"__esModule",{value:!0}),R.SupportUtil=void 0;var u=x(233),S=x(3412),f=x(9428),a=x(2672),d=function(){this.errorCode=0,this.message=""},p=function(){function e(){this.deviceManager=new S.BrowserDeviceManager}return e.prototype.isSupport=function(r){var n=this;return new Promise(function(s,t){return v(n,void 0,void 0,function(){var i,l,E,b;return c(this,function(_){switch(_.label){case 0:return i=new d,this.checkWebRtcSupport()?r.onlyCheckUA?this.checkBrowser(i)?[3,3]:[2,t(i)]:[3,1]:(i.errorCode=f.ErrorCode.ERROR_NOTSUPPORT_WEBRTC,i.message=a.EN.MESSAGE_NOTSUPPORT_WEBRTC,[2,t(i)]);case 1:return[4,this.checkWebrtcAbilities()];case 2:if(l=_.sent(),E=l[0],l[1],l[2],b=l[3],!E)return i.errorCode=f.ErrorCode.ERROR_NOTSUPPORT_WEBRTC,i.message=a.EN.MESSAGE_NOTSUPPORT_WEBRTC,[2,t(i)];if(b)return i.errorCode=f.ErrorCode.ERROR_BROWSER_NOTSUPPORT,i.message=a.EN.MESSAGE_BROWSER_NOTSUPPORT,[2,t(i)];_.label=3;case 3:return r.isReceiveVideo?this.checkH264Decode(i).then(function(){s(i)}).catch(function(){t(i)}):s(i),[2]}})})})},e.prototype.checkEncodedTransformSupport=function(){var r=window.RTCRtpReceiver&&"createEncodedStreams"in RTCRtpReceiver.prototype,n=window.RTCRtpReceiver&&"transform"in RTCRtpReceiver.prototype&&"RTCRtpScriptTransform"in window;return r||n},e.prototype.checkWebrtcAbilities=function(r){return v(this,void 0,void 0,function(){var n,s,t,i,l,E,b,_,h;return c(this,function(o){switch(o.label){case 0:n=window.RTCPeerConnection,s=!1,t=!1,i=null,l=!1,o.label=1;case 1:return o.trys.push([1,4,,5]),n?(E=new n,t="createDataChannel"in E,r&&(b=this.createBlankStream()).getTracks().forEach(function(g){E?.addTrack(g,b)}),[4,E.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0,iceRestart:!0})]):[3,3];case 2:_=o.sent(),h=(_||{}).sdp,i=r?!!(h&&h.indexOf("a=sendrecv")>-1):null,E.close(),E=void 0,s=!0,o.label=3;case 3:return[3,5];case 4:return o.sent(),s=!1,t=!1,i=!1,[3,5];case 5:return l=this.checkBlackList(),[2,[s,t,i,l]]}})})},e.prototype.checkPublishSupport=function(){return v(this,void 0,void 0,function(){var r,n,s,t,i,l,E,b;return c(this,function(_){switch(_.label){case 0:return r={isWebRTCSupported:!1,isH264EncodeSupported:!1,isMediaDevicesSupported:!1,isScreenCaptureSupported:!1,isAudioMixSupported:!1,cameraList:[],micList:[],speakerList:[]},this.checkWebRtcSupport()?[3,1]:(r.isWebRTCSupported=!1,r.isH264EncodeSupported=!1,[3,5]);case 1:return[4,this.checkWebrtcAbilities(!0)];case 2:return n=_.sent(),s=n[0],n[1],t=n[2],r.isWebRTCSupported=!(!s||!t),r.isWebRTCSupported?[3,3]:(r.isH264EncodeSupported=!1,[3,5]);case 3:return i=r,[4,this.checkH264Encode()];case 4:i.isH264EncodeSupported=_.sent(),_.label=5;case 5:if(r.isMediaDevicesSupported=this.checkMediaDevices(),r.isScreenCaptureSupported=this.checkScreenCapture(),r.isAudioMixSupported=this.checkAudioMix(),!r.isMediaDevicesSupported)return[3,11];_.label=6;case 6:return _.trys.push([6,10,,11]),l=r,[4,this.deviceManager.getCameraList()];case 7:return l.cameraList=_.sent().filter(function(h){return h.deviceId}),E=r,[4,this.deviceManager.getMicList()];case 8:return E.micList=_.sent().filter(function(h){return h.deviceId}),b=r,[4,this.deviceManager.getSpeakerList()];case 9:return b.speakerList=_.sent().filter(function(h){return h.deviceId}),[3,11];case 10:return _.sent(),[3,11];case 11:return[2,r]}})})},e.prototype.checkWebRtcSupport=function(){return!!window.RTCPeerConnection},e.prototype.checkMediaDevices=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)},e.prototype.checkScreenCapture=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},e.prototype.checkAudioMix=function(){if(!window.AudioContext)return!1;var r=new AudioContext;return!!r.createMediaStreamDestination&&!!r.createMediaStreamSource},e.prototype.checkBlackList=function(){var r=!1;if(u.BrowserUtil.isOppoBrowser&&u.SystemUtil.isAndroid){var n=(this.getUa().toLowerCase().match(/heytapbrowser\/([\d.]+)/)||[])[1]||"";r=!this.compareVersion(n,"40.7.39.1")}else(u.BrowserUtil.isUCBrowser||u.BrowserUtil.isQuarkBrowser)&&u.SystemUtil.isIos?r=!0:u.BrowserUtil.isWebView&&u.SystemUtil.isAndroid&&(r=!(u.BrowserUtil.browserMainVersion>=79));return r},e.prototype.checkBrowser=function(r){if(u.SystemUtil.isIos){if(u.BrowserUtil.isUCBrowser||u.BrowserUtil.isQuarkBrowser)return r.errorCode=f.ErrorCode.ERROR_BROWSER_NOTSUPPORT,r.message=a.EN.MESSAGE_BROWSER_NOTSUPPORT,!1;if(u.BrowserUtil.isSafari||u.BrowserUtil.isQQBrowser)return u.BrowserUtil.browserMainVersion>=11||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isEdge||u.BrowserUtil.isChrome)return u.BrowserUtil.browserMainVersion>=79||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isMicroMessenger)return!!this.compareVersion(u.SystemUtil.systemVersion,"12.1.4")||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isDingTalk)return!!u.SystemUtil.compareVersion("11.2.5")||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isWebView)return!!this.compareVersion(u.SystemUtil.systemVersion,"14.3")||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(u.SystemUtil.isAndroid){if(this.checkPrivateUcWebview())return!0;if(u.BrowserUtil.isChrome||u.BrowserUtil.isQQBrowser||u.BrowserUtil.isHuaweiBrowser||u.BrowserUtil.isSamsungBrowser)return u.BrowserUtil.browserMainVersion>=63||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isEdge)return u.BrowserUtil.browserMainVersion>=79||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isMicroMessenger)return!!this.compareVersion(this.getChromeCoreVersion(),"63")||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isDingTalk)return!!this.compareVersion(this.getChromeCoreVersion(),"69")||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isOppoBrowser){var n=(this.getUa().toLowerCase().match(/heytapbrowser\/([\d.]+)/)||[])[1]||"";return!!this.compareVersion(n,"40.7.39.1")||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}if(u.BrowserUtil.isX5Core)return!0;if(u.BrowserUtil.isWebView)return u.BrowserUtil.browserMainVersion>=79||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(u.SystemUtil.isMacOS){if(u.BrowserUtil.isElectron)return!0;if(u.BrowserUtil.isSafari)return u.BrowserUtil.browserMainVersion>=11||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isChrome)return u.BrowserUtil.browserMainVersion>=63||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isEdge)return u.BrowserUtil.browserMainVersion>=79||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isFirefox)return u.BrowserUtil.browserMainVersion>=62||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isOpera)return u.BrowserUtil.browserMainVersion>=15||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(u.SystemUtil.isWindows){if(u.BrowserUtil.isElectron||u.BrowserUtil.isMicroMessenger)return!0;if(u.BrowserUtil.isChrome||u.BrowserUtil.isQQBrowser)return u.BrowserUtil.browserMainVersion>=63||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isEdge)return u.BrowserUtil.browserMainVersion>=79||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isFirefox)return u.BrowserUtil.browserMainVersion>=62||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isOpera)return u.BrowserUtil.browserMainVersion>=15||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(u.SystemUtil.isLinux){if(u.BrowserUtil.isChrome)return u.BrowserUtil.browserMainVersion>=63||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isEdge)return u.BrowserUtil.browserMainVersion>=79||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isFirefox)return u.BrowserUtil.browserMainVersion>=62||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}return r.errorCode===0&&(r.errorCode=f.ErrorCode.ERROR_BROWSER_NOTSUPPORT,r.message=a.EN.MESSAGE_BROWSER_NOTSUPPORT),!1},e.prototype.checkH264Decode=function(r){var n=this;return new Promise(function(s,t){return v(n,void 0,void 0,function(){var i;return c(this,function(l){switch(l.label){case 0:return[4,this.tryFindH264FromSdp(r)];case 1:if(i=l.sent())return s(!0),[2];l.label=2;case 2:return l.trys.push([2,4,,5]),[4,this.loadH264(3)];case 3:return i=l.sent(),[3,5];case 4:return l.sent(),[3,5];case 5:return i?s(!0):(r&&r.errorCode===0&&(r.errorCode=f.ErrorCode.ERROR_NOTSUPPORT_H264,r.message=a.EN.MESSAGE_NOTSUPPORT_H264),t(!1)),[2]}})})})},e.prototype.checkSDPSupportH264=function(r){return r.indexOf("H264")>0||r.indexOf("h264")>0||r.indexOf("H.264")>0||r.indexOf("h.264")>0},e.prototype.checkPrivateUcWebview=function(){return this.getUa().indexOf("UniqueCode")>0},e.prototype.getUa=function(){return navigator&&navigator.userAgent||""},e.prototype.getChromeCoreVersion=function(){return(this.getUa().toLowerCase().match(/chrome\/([\d.]+)/)||[])[1]||""},e.prototype.compareVersion=function(r,n){r===void 0&&(r=""),n===void 0&&(n="");for(var s=(r||"").split("."),t=(n||"").split("."),i=0,l=0,E=0;E<s.length&&E<t.length;++E){if((i=isNaN(parseInt(s[E],10))?0:parseInt(s[E],10))<(l=isNaN(parseInt(t[E],10))?0:parseInt(t[E],10)))return!1;if(i>l)return!0}return!0},e.prototype.tryFindH264FromSdp=function(r){return v(this,void 0,void 0,function(){var n,s,t;return c(this,function(i){switch(i.label){case 0:if(n=!1,!RTCPeerConnection)return[2,n];s=new RTCPeerConnection,t=void 0,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,s.createOffer({offerToReceiveVideo:!0,offerToReceiveAudio:!0})];case 2:return(t=i.sent())&&t.sdp&&(n=this.checkSDPSupportH264(t.sdp)),[3,4];case 3:return i.sent(),n=!1,r&&(r.errorCode=f.ErrorCode.ERROR_CREATEOFFER,r.message=a.EN.MESSAGE_CREATEOFFER),[3,4];case 4:return s.close(),s=void 0,[2,n]}})})},e.prototype.loadH264=function(r){var n=this;return new Promise(function(s,t){return v(n,void 0,void 0,function(){var i,l,E,b,_=this;return c(this,function(h){if(!u.SystemUtil.isAndroid||!u.BrowserUtil.isChrome&&!u.BrowserUtil.isWebView)return s(!1),[2];for(i=0,l=[],E=0;i<r;)b=setTimeout(function(){return v(_,void 0,void 0,function(){return c(this,function(o){switch(o.label){case 0:return E++,[4,this.tryFindH264FromSdp()];case 1:return o.sent()?(l.forEach(function(g){clearTimeout(g)}),l=[],s(!0),[2]):(E===r&&s(!1),[2])}})})},1e3*i),l.push(b),i++;return[2]})})})},e.prototype.checkH264Encode=function(){return v(this,void 0,void 0,function(){var r,n,s;return c(this,function(t){switch(t.label){case 0:return[4,this.loadH264(3)];case 1:return!(r=t.sent())&&RTCRtpSender&&RTCRtpSender.getCapabilities&&(n=JSON.stringify((s=RTCRtpSender.getCapabilities("video"))===null||s===void 0?void 0:s.codecs),r=n.toLowerCase().includes("video/h264")),[2,!!r]}})})},e.prototype.createBlankStream=function(){var r,n,s,t=(r=new AudioContext,n=r.createOscillator(),s=n.connect(r.createMediaStreamDestination()),n.start(),Object.assign(s.stream.getAudioTracks()[0],{enabled:!1}));t.stop();var i=function(l){var E,b={},_=b.width,h=_===void 0?160:_,o=b.height,g=o===void 0?90:o,m=document.createElement("canvas");m.width=h,m.height=g,(E=m.getContext("2d"))===null||E===void 0||E.fillRect(0,0,h,g);var T=m.captureStream();return Object.assign(T.getVideoTracks()[0],{enabled:!1})}();return i.stop(),new MediaStream([t,i])},e}();R.SupportUtil=p},2718:function(L,R){var x=this&&this.__spreadArray||function(v,c,u){if(u||arguments.length===2)for(var S,f=0,a=c.length;f<a;f++)!S&&f in c||(S||(S=Array.prototype.slice.call(c,0,f)),S[f]=c[f]);return v.concat(S||Array.prototype.slice.call(c))};Object.defineProperty(R,"__esModule",{value:!0}),R.hebtLog=R.createUUID=R.evaluateNetworkCondition=R.makeCancelable=R.hasVideoTrack=R.hasAudioTrack=R.getVideoTrack=R.getAudioTrack=R.pruneSubUrl=R.getJitterBufferDelayAvg=void 0,R.getJitterBufferDelayAvg=function(v,c){return v&&c?Number(v)/Number(c)*1e3:-1},R.pruneSubUrl=function(v,c){var u=v||"";return u=u.replace("@subaudio=no","").replace("@subvideo=no",""),c&&(u=u.split("?")[0]),u},R.getAudioTrack=function(v){return v.getAudioTracks()[0]},R.getVideoTrack=function(v){return v.getVideoTracks()[0]},R.hasAudioTrack=function(v){return v.getAudioTracks().length>0},R.hasVideoTrack=function(v){return v.getVideoTracks().length>0},R.makeCancelable=function(v){var c=!1;return{promise:new Promise(function(u,S){v.then(function(f){return c?S({isCanceled:!0}):u(f)}),v.catch(function(f){return S(c?{isCanceled:!0}:f)})}),cancel:function(){c=!0}}},R.evaluateNetworkCondition=function(v,c,u,S,f){var a=0;if(!navigator.onLine)return a=6;var d=[{loss:0,rtt:0,jbd:1},{loss:0,rtt:1,jbd:0},{loss:0,rtt:.5,jbd:.5},{loss:1,rtt:0,jbd:0},{loss:.8,rtt:0,jbd:.2},{loss:.8,rtt:.2,jbd:0},{loss:.6,rtt:.2,jbd:.2}],p=-1,e=-1,r=-1;if(typeof c=="number"&&c>=0||typeof u=="number"&&u>=0){p=0;var n=!1,s=!1;typeof c=="number"&&c>=0&&(p+=c,n=!0),typeof u=="number"&&u>=0&&(p+=u,s=!0),n&&!s&&(p*=2),s&&!n&&(p*=1.8)}typeof v=="number"&&v>=0&&(r=v),(typeof S=="number"&&S>=0||typeof f=="number"&&f>=0)&&(e=0,typeof S=="number"&&S>=0&&(e+=S),typeof f=="number"&&f>=0&&(e+=f));var t;if((t=4*(p!==-1?1:0)+2*(r!==-1?1:0)+(e!==-1?1:0))>0){var i=1.2*p*d[t-1].loss+r/1500*d[t-1].rtt+e/3e3*d[t-1].jbd;a=i<=.1?1:i<=.23?2:i<=.36?3:i<=.49?4:5}else a=0;return a},R.createUUID=function(v,c){var u,S="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),f=[];if(c=c||S.length,v)for(u=0;u<v;u++)f[u]=S[0|Math.random()*c];else{var a=void 0;for(f[8]=f[13]=f[18]=f[23]="-",f[14]="4",u=0;u<36;u++)f[u]||(a=0|16*Math.random(),f[u]=S[u==19?3&a|8:a])}return f.join("")},R.hebtLog=function(){for(var v=[],c=0;c<arguments.length;c++)v[c]=arguments[c];window.RTS_HEBT_DEBUG&&console.log.apply(console,x(["[rts hebt]"],v,!1))}},233:L=>{/*! useragent-util - ver 1.3.1 created:9/4/2024, 4:31:28 PM */L.exports=(()=>{var R={622:(u,S,f)=>{Object.defineProperty(S,"__esModule",{value:!0}),S.BrowserUtil=S.BrowserType=void 0;var a,d=f(101);(function(e){e.IE="IE",e.Chrome="Chrome",e.Safari="Safari",e.Firefox="Firefox",e.Opera="Opera",e.Edge="Edge",e.MicroMessenger="MicroMessenger",e.X5Core="X5Core",e.Quark="Quark",e.QQ="QQ",e.QQBrowser="QQBrowser",e.DingTalk="DingTalk",e.Electron="Electron",e.Sogou="Sogou",e.Vivo="VivoBrowser",e.Oppo="OppoBrowser",e.UC="UCBrowser",e.MI="MiBrowser",e.Lenovo="SLBrowser",e.Maxthon="Maxthon",e.Liebao="Liebao",e.Huawei="Huawei",e.Meizu="MZBrowser",e.Finger="FingerBrowser",e.Samsung="SamsungBrowser",e.WebVeiw="WebVeiw",e.Unknown="unknown"})(a=S.BrowserType||(S.BrowserType={}));var p=function(){function e(){}return Object.defineProperty(e,"isBrowser",{get:function(){return typeof document<"u"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"domain",{get:function(){return window.location.protocol+window.location.host},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isHttps",{get:function(){return this.isBrowser&&document.location&&(document.location.protocol=="https:"||document.location.host.indexOf("127.0.0.1:")===0||document.location.host.indexOf("localhost:")===0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSupportScreenShare",{get:function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isChrome",{get:function(){return e._getBrowserInfo(),a.Chrome===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSafari",{get:function(){return e._getBrowserInfo(),a.Safari===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isIE",{get:function(){return e._getBrowserInfo(),a.IE===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isFirefox",{get:function(){return e._getBrowserInfo(),a.Firefox===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isEdge",{get:function(){return e._getBrowserInfo(),a.Edge===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSogou",{get:function(){return e._getBrowserInfo(),a.Sogou===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isVivoBroswer",{get:function(){return e._getBrowserInfo(),a.Vivo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isOppoBrowser",{get:function(){return e._getBrowserInfo(),a.Oppo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMiBrowser",{get:function(){return e._getBrowserInfo(),a.MI===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isLenovoBrowser",{get:function(){return e._getBrowserInfo(),a.Lenovo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMaxthonBrowser",{get:function(){return e._getBrowserInfo(),a.Maxthon===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isLiebaoBrowser",{get:function(){return e._getBrowserInfo(),a.Liebao===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isHuaweiBrowser",{get:function(){return e._getBrowserInfo(),a.Huawei===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMZBrowser",{get:function(){return e._getBrowserInfo(),a.Meizu===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSamsungBrowser",{get:function(){return e._getBrowserInfo(),a.Samsung===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isOpera",{get:function(){return e._getBrowserInfo(),a.Opera===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMicroMessenger",{get:function(){return e._getBrowserInfo(),e._browserName===a.MicroMessenger},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQQ",{get:function(){return e._getBrowserInfo(),a.QQ===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQQBrowser",{get:function(){return e._getBrowserInfo(),a.QQBrowser===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isX5Core",{get:function(){return e._getBrowserInfo(),e._browserName===a.X5Core},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isUCBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===a.UC},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQuarkBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===a.Quark},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isFingerBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===a.Finger},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isChromeCore",{get:function(){return e._getBrowserInfo(),e._core==="Chrome"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isWebView",{get:function(){return e._getBrowserInfo(),e._browserName===a.WebVeiw},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isDingTalk",{get:function(){return e._getBrowserInfo(),e._browserName===a.DingTalk},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isUnknown",{get:function(){return e._getBrowserInfo(),a.Unknown===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserName",{get:function(){return e._getBrowserInfo(),e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserVersion",{get:function(){return e._getBrowserInfo(),e._browserVersion},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserMainVersion",{get:function(){return e._getBrowserInfo(),e._browserVersion?parseInt(e._browserVersion.split(".")[0],10):0},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserCoreVersion",{get:function(){return navigator.userAgent.toLowerCase(),d.SystemUtil.isIos||d.SystemUtil.isMacOS,e.browserMainVersion},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isElectron",{get:function(){return e._getBrowserInfo(),a.Electron===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"userAgent",{get:function(){var r=navigator.userAgent.toLowerCase(),n=r.indexOf("gecko");if(n>-1){n=r.indexOf(" ",n);var s=(r=r.substring(n+1,r.length)).split(" ");r="";for(var t=0;t<s.length;++t){var i=s[t].split("/");i&&i.length&&(r+=i[0]+" ")}}return r},enumerable:!1,configurable:!0}),e.compareVersion=function(r){if(e._getBrowserInfo(),e._browserVersion){for(var n=e._browserVersion.split("."),s=r.split("."),t=0,i=0,l=0;l<n.length&&l<s.length;++l){if((t=isNaN(parseInt(n[l],10))?0:parseInt(n[l],10))<(i=isNaN(parseInt(s[l],10))?0:parseInt(s[l],10)))return!1;if(t>i)return!0}return!0}return!0},e._getBrowserInfo=function(){if(!e._browserName||!e._browserVersion)if(navigator&&navigator.userAgent){var r=navigator.userAgent.toLowerCase(),n=void 0;(n=r.match(/edg[e|a]?\/([\d.]+)/))||(n=r.match(/edgios\/([\d.]+)/))?e._updateBrowserInfo(a.Edge,r,n[1]):(n=r.match(/rv:([\d.]+)\) like gecko/))||(n=r.match(/msie ([\d.]+)/))?e._updateBrowserInfo(a.IE,r,n[1]):(n=r.match(/vivobrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Vivo,r,n[1]):(n=r.match(/miuibrowser\/([\d.]+)/))?e._updateBrowserInfo(a.MI,r,n[1]):(n=r.match(/samsungbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Samsung,r,n[1]):(n=r.match(/heytapbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Oppo,r,n[1]):(n=r.match(/mzbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Meizu,r,n[1]):(n=r.match(/ucbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.UC,r,n[1]):(n=r.match(/quark\/([\d.]+)/))?e._updateBrowserInfo(a.Quark,r,n[1]):(n=r.match(/slbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Lenovo,r,n[1]):(n=r.match(/lbbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Liebao,r,n[1]):(n=r.match(/fingerbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Finger,r,n[1]):(n=r.match(/huaweibrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Huawei,r,n[1]):(n=r.match(/maxthon\/([\d.]+)/))?e._updateBrowserInfo(a.Maxthon,r,n[1]):(n=r.match(/firefox\/([\d.]+)/))?e._updateBrowserInfo(a.Firefox,r,n[1]):(n=r.match(/electron\/([\d.]+)/))?e._updateBrowserInfo(a.Electron,r,n[1]):(n=r.match(/chrome\/([\d.]+)/))&&this._isChrome(r)||(n=r.match(/crios\/([\d.]+)/))&&this._isChrome(r)?e._updateBrowserInfo(a.Chrome,r,n[1]):(n=r.match(/metasr\s([\d.]+)/))||(n=r.match(/sogoumobilebrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Sogou,r,n[1]):(n=r.match(/opr.([\d.]+)/))?e._updateBrowserInfo(a.Opera,r,n[1]):(n=r.match(/micromessenger.([\d.]+)/))?e._updateBrowserInfo(a.MicroMessenger,r,n[1]):(n=r.match(/qq\/([\d.]+)/))?e._updateBrowserInfo(a.QQ,r,n[1]):(n=r.match(/m?qqbrowser\/([\d.]+)/))||(n=r.match(/qqbrowserlite\/([\d.]+)/))?e._updateBrowserInfo(a.QQBrowser,r,n[1]):(n=r.match(/dingtalk.([\d.]+)/))?e._updateBrowserInfo(a.DingTalk,r,n[1]):(n=r.match(/tbs\/([\d.]+)/))?e._updateBrowserInfo(a.X5Core,r,n[1]):(n=r.match(/version\/([\d.]+).*safari/))&&this._isSafari(r)&&e._updateBrowserInfo(a.Safari,r,n[1]),e._browserName===a.Unknown&&e._isWebview(r)&&e._updateBrowserInfo(a.WebVeiw,r,"")}else e._browserName=a.Unknown,e._browserVersion="0.0"},e._isChrome=function(r){var n=r.split(/\(|\)/);if(e._core="Chrome",n.length===5){var s=n[4].trim().split(" ");if(s.length===2){if(s[0].indexOf("chrome")>-1&&s[1].indexOf("safari")>-1)return!0}else if(s.length===3){if(s[1].indexOf("mobile")>-1&&s[2].indexOf("safari")>-1&&(s[0].indexOf("chrome")>-1||s[0].indexOf("crios")>-1))return!0}else if(r.indexOf("qianniu")>-1)return!0}return!1},e._isSafari=function(r){var n=r.split(/\(|\)/);if(n.length===5){var s=n[4].trim().split(" ");if(s.length===2){if(s[0].indexOf("version")>-1&&s[1].indexOf("safari")>-1)return!0}else if(s.length===3&&s[0].indexOf("version")>-1&&s[1].indexOf("mobile")>-1&&s[2].indexOf("safari")>-1)return!0}return!1},e._isWebview=function(r){if(r){var n=new RegExp("("+["WebView","(iPhone|iPod|iPad)(?!.*Safari)","Android.*(wv|.0.0.0)","Linux; U; Android"].join("|")+")","ig"),s=new RegExp("("+["VivoBrowser","MZBrowser","MiuiBrowser"].join("|")+")","ig");return!!r.match(n)&&!r.match(s)}},e._updateBrowserInfo=function(r,n,s){e._browserName=r;var t=null;switch(r){case a.QQBrowser:d.SystemUtil.isIos||d.SystemUtil.isMacOS?(t=n.match(/version\/([\d.]+).*safari/),e._browserVersion=t?t[1]:"0.0"):(t=n.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0");break;case a.Vivo:case a.Oppo:case a.Meizu:case a.Huawei:case a.Sogou:case a.Samsung:t=n.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0";break;case a.WebVeiw:d.SystemUtil.isAndroid?(t=n.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0"):d.SystemUtil.isIos&&(e._browserVersion=d.SystemUtil.systemVersion);break;default:e._browserVersion=s}},e._browserName=a.Unknown,e._browserVersion="",e._core="",e}();S.BrowserUtil=p},864:(u,S)=>{Object.defineProperty(S,"__esModule",{value:!0}),S.Guid=void 0;var f=function(){function a(){}return a.create=function(d,p){p===void 0&&(p=16);var e,r,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),s=[];if(p=p||n.length,d)for(e=0;e<d;e++)s[e]=n[0|Math.random()*p];else for(s[8]=s[13]=s[18]=s[23]="-",s[14]="4",e=0;e<36;e++)s[e]||(r=0|16*Math.random(),s[e]=n[e==19?3&r|8:r]);return s.join("")},a}();S.Guid=f},442:(u,S,f)=>{Object.defineProperty(S,"__esModule",{value:!0}),S.LocalStorage=void 0;var a=f(864),d=function(){function p(){}return Object.defineProperty(p,"uuid",{get:function(){var e="alirtc_uuid",r=p.get(e);return r||(r=a.Guid.create(32),p.set(e,r)),r},enumerable:!1,configurable:!0}),p.get=function(e){var r="";return window&&window.localStorage&&(r=window.localStorage.getItem(e)||""),r},p.set=function(e,r){e&&window&&window.localStorage&&window.localStorage.setItem(e,r)},p}();S.LocalStorage=d},72:(u,S)=>{Object.defineProperty(S,"__esModule",{value:!0}),S.ApiRequest=void 0;var f=function(){function a(){}return a.postBody=function(d,p,e){d=a._getUrl(d,p);var r,n={};return n.headers||(n.headers={}),n.headers.Accept="application/json",n.headers["Content-Type"]="application/json",new Promise(function(s,t){a.requestBody("POST",d,e).then(function(i){return r=i,i.ok?i.json():i.text()}).then(function(i){r.ok?i.code?(i=a._intercept(i),t(i)):s(i.data):t(a._httpErrorMessage(r,i))}).catch(function(i){i=a._httpErrorMessage(i),t(i)})})},a.get=function(d,p,e){var r;return e===void 0&&(e={}),d=a._getUrl(d,p),e.headers||(e.headers={}),e.headers["Content-Type"]="application/json",new Promise(function(n,s){a.request("GET",d,e).then(function(t){return r=t,t.ok?t.json():t.text()}).then(function(t){r.ok?t.code?(t=a._intercept(t),s(t)):n(t.data):s(a._httpErrorMessage(r,t))}).catch(function(t){t=a._httpErrorMessage(t),s(t)})})},a.post=function(d,p,e,r){var n;return r===void 0&&(r={}),d=a._getUrl(d,p),r.headers||(r.headers={}),r.body=e,r.headers.Accept="application/json",r.headers["Content-Type"]="application/json",new Promise(function(s,t){a.request("POST",d,r).then(function(i){return n=i,i.ok?i.json():i.text()}).then(function(i){n.ok?i.code?(i=a._intercept(i),t(i)):s(i.data):t(a._httpErrorMessage(n,i))}).catch(function(i){i=a._httpErrorMessage(i),t(i)})})},a.request=function(d,p,e){d===void 0&&(d="GET");var r=new Headers(e.headers),n=new Request(p,{method:d,headers:r});return fetch(n)},a.requestBody=function(d,p,e){return d===void 0&&(d="GET"),fetch(p,{method:d,body:e,headers:new Headers({"Content-Type":"application/json"})})},a.ajaxPost=function(d,p,e,r){return r===void 0&&(r={}),d=a._getUrl(d,p),r.headers||(r.headers={}),r.headers.Accept="application/json",r.headers["Content-Type"]="application/json",a.ajax("POST",d,e,r)},a.ajax=function(d,p,e,r){d===void 0&&(d="GET"),r===void 0&&(r={});var n=new XMLHttpRequest;return new Promise(function(s,t){n.onreadystatechange=function(){if(n.readyState===4)if(n.status===200){var l=JSON.parse(n.responseText);l.code?(l=a._intercept(l),t(l)):s(l)}else t({message:n.responseText||"\u8BF7\u6C42\u5931\u8D25:"+p})},n.open(d,p,!0);try{if(r.withCredentials&&(n.withCredentials=!0),r.headers)for(var i in r.headers)n.setRequestHeader(i,r.headers[i])}catch(l){return void t(l)}try{n.send(e)}catch(l){t(l)}})},a._getUrl=function(d,p){var e=[];if(p)for(var r in p)e.push(r+"="+p[r]);var n=e.join("&");return(d.indexOf("?")!=-1?d:d+"?")+n},a._httpErrorMessage=function(d,p){return d.message||(d.message="HTTP "+d.status+"("+d.statusText+") : "+p),d},a._intercept=function(d){var p=d.data;return d.code&&((p=p||{}).data=d.data,p.code=d.code,p.description=d.description,p.message="0x"+Number(d.code).toString(16)+", "+d.description,p.tid&&(p.message+=", tid="+p.tid)),p},a}();S.ApiRequest=f},101:(u,S)=>{var f,a;Object.defineProperty(S,"__esModule",{value:!0}),S.SystemUtil=S.WindowsType=S.SystemType=void 0,function(p){p.Unknown="Unknown",p.MacOS="Mac",p.Windows="Windows",p.Android="Android",p.Iphone="iphone",p.Ipad="ipad",p.iOS="iOS",p.Linux="Linux",p.ChromeOS="ChromeOS"}(f=S.SystemType||(S.SystemType={})),function(p){p.Windows10="Windows 10",p.Windows7="Windows 7",p.WindowsVista="Windows vista",p.WindowsXP="Windows xp"}(a=S.WindowsType||(S.WindowsType={}));var d=function(){function p(){}return Object.defineProperty(p,"isMacOS",{get:function(){return f.MacOS===p.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(p,"isWindows",{get:function(){return p.systemName.indexOf(f.Windows)>-1},enumerable:!1,configurable:!0}),Object.defineProperty(p,"isIos",{get:function(){return f.Iphone===p.systemName||f.Ipad===p.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(p,"isAndroid",{get:function(){return f.Android===p.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(p,"isLinux",{get:function(){return f.Linux===p.systemName||f.Linux===p._platform},enumerable:!1,configurable:!0}),Object.defineProperty(p,"systemName",{get:function(){return p._getSystemInfo(),p._systemName},enumerable:!1,configurable:!0}),Object.defineProperty(p,"systemVersion",{get:function(){return p._getSystemInfo(),p._systemVersion},enumerable:!1,configurable:!0}),Object.defineProperty(p,"platform",{get:function(){return p._getSystemInfo(),p._platform},enumerable:!1,configurable:!0}),Object.defineProperty(p,"isUnknown",{get:function(){return!p.platform||p.platform===f.Unknown},enumerable:!1,configurable:!0}),p.compareVersion=function(e){if(p._getSystemInfo(),p._systemVersion){for(var r=p._systemVersion.split("."),n=e.split("."),s=0,t=0,i=0;i<r.length&&i<n.length;++i){if((s=isNaN(parseInt(r[i],10))?0:parseInt(r[i],10))<(t=isNaN(parseInt(n[i],10))?0:parseInt(n[i],10)))return!1;if(s>t)return!0}return!0}return!0},p._getSystemInfo=function(){if(!p._systemName||!p._systemVersion||!p._platform)if(navigator&&navigator.userAgent){var e=navigator.userAgent.toLowerCase();e.indexOf("ipad")>-1?(p._systemName=f.Ipad,p._platform=f.iOS,p._systemVersion=p._getIosSystemVersion(e)):e.indexOf("iphone")>-1?(p._systemName=f.Iphone,p._platform=f.iOS,p._systemVersion=p._getIosSystemVersion(e)):e.indexOf("android")>-1?(p._platform=f.Android,p._systemName=f.Android,p._systemVersion=p._getAndroidSystemVersion(e)):e.indexOf("win")>-1?e.indexOf("windwos nt 10")>-1||e.indexOf("windows 10")?(p._systemName=a.Windows10,p._platform=f.Windows,p._systemVersion="10"):e.indexOf("windows nt 6.1")>-1||e.indexOf("windows 7")>-1?(p._systemName=a.Windows7,p._platform=f.Windows,p._systemVersion="7"):e.indexOf("windows nt 6.0")>-1||e.indexOf("windows vista")>-1?(p._systemName=a.WindowsVista,p._platform=f.Windows,p._systemVersion="vista"):e.indexOf("widows nt 5.1")>-1||e.indexOf("windows xp")>-1?(p._systemName=a.WindowsXP,p._platform=f.Windows,p._systemVersion="xp"):(p._platform=f.Windows,p._systemName=f.Windows,p._systemVersion="0.0"):e.indexOf("mac")>-1?navigator&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0?(p._systemName=f.Ipad,p._platform=f.iOS,p._systemVersion=p._getIosSystemVersion(e)):(p._platform=f.MacOS,p._systemName=f.MacOS,p._systemVersion=p._getMacSystemVersion(e)):e.indexOf("linux")>-1?(p._platform=f.Linux,p._systemName=f.Linux,p._systemVersion="0.0"):e.indexOf("cros")>-1?(p._platform=f.Linux,p._systemName=f.ChromeOS,p._systemVersion="0.0"):(p._systemName=f.Unknown,p._platform=f.Windows,p._systemVersion="0.0")}else p._systemName=f.Unknown,p._platform=f.Unknown,p._systemVersion="0.0"},p._getIosSystemVersion=function(e){return(e.match(/OS [\d._]*/gi)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,".")},p._getMacSystemVersion=function(e){return(e.match(/OS X [\d._]*/gi)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,".")},p._getAndroidSystemVersion=function(e){return e.substr(e.indexOf("android")+8,e.indexOf(";",e.indexOf("android"))-e.indexOf("android")-8)},p._systemName="",p._systemVersion="",p._platform=f.Unknown,p}();S.SystemUtil=d}},x={};function v(u){if(x[u])return x[u].exports;var S=x[u]={exports:{}};return R[u](S,S.exports,v),S.exports}var c={};return(()=>{var u=c;Object.defineProperty(u,"__esModule",{value:!0}),u.ApiRequest=u.LocalStorage=u.Guid=u.BrowserUtil=u.SystemUtil=void 0;var S=v(101);Object.defineProperty(u,"SystemUtil",{enumerable:!0,get:function(){return S.SystemUtil}});var f=v(622);Object.defineProperty(u,"BrowserUtil",{enumerable:!0,get:function(){return f.BrowserUtil}});var a=v(864);Object.defineProperty(u,"Guid",{enumerable:!0,get:function(){return a.Guid}});var d=v(442);Object.defineProperty(u,"LocalStorage",{enumerable:!0,get:function(){return d.LocalStorage}});var p=v(72);Object.defineProperty(u,"ApiRequest",{enumerable:!0,get:function(){return p.ApiRequest}}),window&&(window.SystemUtil=S.SystemUtil,window.BrowserUtil=f.BrowserUtil,window.Guid=a.Guid,window.LocalStorage=d.LocalStorage,window.ApiRequest=p.ApiRequest)})(),c})()},9543:(L,R,x)=>{x.r(R),x.d(R,{default:()=>xe});var v={};x.r(v),x.d(v,{fixNegotiationNeeded:()=>j,shimAddTrackRemoveTrack:()=>A,shimAddTrackRemoveTrackWithNative:()=>y,shimGetDisplayMedia:()=>o,shimGetSendersWithDtmf:()=>T,shimGetStats:()=>C,shimGetUserMedia:()=>h,shimMediaStream:()=>g,shimOnTrack:()=>m,shimPeerConnection:()=>O,shimSenderReceiverGetStats:()=>D});var c={};x.r(c),x.d(c,{shimGetDisplayMedia:()=>U,shimGetUserMedia:()=>F,shimPeerConnection:()=>B,shimReplaceTrack:()=>k});var u={};x.r(u),x.d(u,{shimAddTransceiver:()=>se,shimCreateAnswer:()=>de,shimCreateOffer:()=>ue,shimGetDisplayMedia:()=>G,shimGetParameters:()=>ce,shimGetUserMedia:()=>V,shimOnTrack:()=>q,shimPeerConnection:()=>z,shimRTCDataChannel:()=>ie,shimReceiverGetStats:()=>re,shimRemoveStream:()=>ee,shimSenderGetStats:()=>$});var S={};x.r(S),x.d(S,{shimAudioContext:()=>Te,shimCallbacksAPI:()=>he,shimConstraints:()=>me,shimCreateOfferLegacy:()=>Re,shimGetUserMedia:()=>fe,shimLocalStreamsAPI:()=>pe,shimRTCIceServerUrls:()=>ge,shimRemoteStreamsAPI:()=>Ee,shimTrackEventTransceiver:()=>_e});var f={};x.r(f),x.d(f,{removeExtmapAllowMixed:()=>we,shimAddIceCandidateNullOrEmpty:()=>He,shimConnectionState:()=>Pe,shimMaxMessageSize:()=>Ce,shimRTCIceCandidate:()=>Oe,shimSendThrowTypeError:()=>Ae});let a=!0,d=!0;function p(w,K,Y){const X=w.match(K);return X&&X.length>=Y&&parseInt(X[Y],10)}function e(w,K,Y){if(!w.RTCPeerConnection)return;const X=w.RTCPeerConnection.prototype,Z=X.addEventListener;X.addEventListener=function(Q,oe){if(Q!==K)return Z.apply(this,arguments);const ne=ae=>{const le=Y(ae);le&&(oe.handleEvent?oe.handleEvent(le):oe(le))};return this._eventMap=this._eventMap||{},this._eventMap[K]||(this._eventMap[K]=new Map),this._eventMap[K].set(oe,ne),Z.apply(this,[Q,ne])};const te=X.removeEventListener;X.removeEventListener=function(Q,oe){if(Q!==K||!this._eventMap||!this._eventMap[K])return te.apply(this,arguments);if(!this._eventMap[K].has(oe))return te.apply(this,arguments);const ne=this._eventMap[K].get(oe);return this._eventMap[K].delete(oe),this._eventMap[K].size===0&&delete this._eventMap[K],Object.keys(this._eventMap).length===0&&delete this._eventMap,te.apply(this,[Q,ne])},Object.defineProperty(X,"on"+K,{get(){return this["_on"+K]},set(Q){this["_on"+K]&&(this.removeEventListener(K,this["_on"+K]),delete this["_on"+K]),Q&&this.addEventListener(K,this["_on"+K]=Q)},enumerable:!0,configurable:!0})}function r(w){return typeof w!="boolean"?new Error("Argument type: "+typeof w+". Please use a boolean."):(a=w,w?"adapter.js logging disabled":"adapter.js logging enabled")}function n(w){return typeof w!="boolean"?new Error("Argument type: "+typeof w+". Please use a boolean."):(d=!w,"adapter.js deprecation warnings "+(w?"disabled":"enabled"))}function s(){if(typeof window=="object"){if(a)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function t(w,K){d&&console.warn(w+" is deprecated, please use "+K+" instead.")}function i(w){return Object.prototype.toString.call(w)==="[object Object]"}function l(w){return i(w)?Object.keys(w).reduce(function(K,Y){const X=i(w[Y]),Z=X?l(w[Y]):w[Y],te=X&&!Object.keys(Z).length;return Z===void 0||te?K:Object.assign(K,{[Y]:Z})},{}):w}function E(w,K,Y){K&&!Y.has(K.id)&&(Y.set(K.id,K),Object.keys(K).forEach(X=>{X.endsWith("Id")?E(w,w.get(K[X]),Y):X.endsWith("Ids")&&K[X].forEach(Z=>{E(w,w.get(Z),Y)})}))}function b(w,K,Y){const X=Y?"outbound-rtp":"inbound-rtp",Z=new Map;if(K===null)return Z;const te=[];return w.forEach(Q=>{Q.type==="track"&&Q.trackIdentifier===K.id&&te.push(Q)}),te.forEach(Q=>{w.forEach(oe=>{oe.type===X&&oe.trackId===Q.id&&E(w,oe,Z)})}),Z}const _=s;function h(w,K){const Y=w&&w.navigator;if(!Y.mediaDevices)return;const X=function(Q){if(typeof Q!="object"||Q.mandatory||Q.optional)return Q;const oe={};return Object.keys(Q).forEach(ne=>{if(ne==="require"||ne==="advanced"||ne==="mediaSource")return;const ae=typeof Q[ne]=="object"?Q[ne]:{ideal:Q[ne]};ae.exact!==void 0&&typeof ae.exact=="number"&&(ae.min=ae.max=ae.exact);const le=function(ve,be){return ve?ve+be.charAt(0).toUpperCase()+be.slice(1):be==="deviceId"?"sourceId":be};if(ae.ideal!==void 0){oe.optional=oe.optional||[];let ve={};typeof ae.ideal=="number"?(ve[le("min",ne)]=ae.ideal,oe.optional.push(ve),ve={},ve[le("max",ne)]=ae.ideal,oe.optional.push(ve)):(ve[le("",ne)]=ae.ideal,oe.optional.push(ve))}ae.exact!==void 0&&typeof ae.exact!="number"?(oe.mandatory=oe.mandatory||{},oe.mandatory[le("",ne)]=ae.exact):["min","max"].forEach(ve=>{ae[ve]!==void 0&&(oe.mandatory=oe.mandatory||{},oe.mandatory[le(ve,ne)]=ae[ve])})}),Q.advanced&&(oe.optional=(oe.optional||[]).concat(Q.advanced)),oe},Z=function(Q,oe){if(K.version>=61)return oe(Q);if((Q=JSON.parse(JSON.stringify(Q)))&&typeof Q.audio=="object"){const ne=function(ae,le,ve){le in ae&&!(ve in ae)&&(ae[ve]=ae[le],delete ae[le])};ne((Q=JSON.parse(JSON.stringify(Q))).audio,"autoGainControl","googAutoGainControl"),ne(Q.audio,"noiseSuppression","googNoiseSuppression"),Q.audio=X(Q.audio)}if(Q&&typeof Q.video=="object"){let ne=Q.video.facingMode;ne=ne&&(typeof ne=="object"?ne:{ideal:ne});const ae=K.version<66;if(ne&&(ne.exact==="user"||ne.exact==="environment"||ne.ideal==="user"||ne.ideal==="environment")&&(!Y.mediaDevices.getSupportedConstraints||!Y.mediaDevices.getSupportedConstraints().facingMode||ae)){let le;if(delete Q.video.facingMode,ne.exact==="environment"||ne.ideal==="environment"?le=["back","rear"]:ne.exact!=="user"&&ne.ideal!=="user"||(le=["front"]),le)return Y.mediaDevices.enumerateDevices().then(ve=>{let be=(ve=ve.filter(je=>je.kind==="videoinput")).find(je=>le.some(Le=>je.label.toLowerCase().includes(Le)));return!be&&ve.length&&le.includes("back")&&(be=ve[ve.length-1]),be&&(Q.video.deviceId=ne.exact?{exact:be.deviceId}:{ideal:be.deviceId}),Q.video=X(Q.video),_("chrome: "+JSON.stringify(Q)),oe(Q)})}Q.video=X(Q.video)}return _("chrome: "+JSON.stringify(Q)),oe(Q)},te=function(Q){return K.version>=64?Q:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[Q.name]||Q.name,message:Q.message,constraint:Q.constraint||Q.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(Y.getUserMedia=function(Q,oe,ne){Z(Q,ae=>{Y.webkitGetUserMedia(ae,oe,le=>{ne&&ne(te(le))})})}.bind(Y),Y.mediaDevices.getUserMedia){const Q=Y.mediaDevices.getUserMedia.bind(Y.mediaDevices);Y.mediaDevices.getUserMedia=function(oe){return Z(oe,ne=>Q(ne).then(ae=>{if(ne.audio&&!ae.getAudioTracks().length||ne.video&&!ae.getVideoTracks().length)throw ae.getTracks().forEach(le=>{le.stop()}),new DOMException("","NotFoundError");return ae},ae=>Promise.reject(te(ae))))}}}function o(w,K){w.navigator.mediaDevices&&"getDisplayMedia"in w.navigator.mediaDevices||w.navigator.mediaDevices&&(typeof K=="function"?w.navigator.mediaDevices.getDisplayMedia=function(Y){return K(Y).then(X=>{const Z=Y.video&&Y.video.width,te=Y.video&&Y.video.height,Q=Y.video&&Y.video.frameRate;return Y.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:X,maxFrameRate:Q||3}},Z&&(Y.video.mandatory.maxWidth=Z),te&&(Y.video.mandatory.maxHeight=te),w.navigator.mediaDevices.getUserMedia(Y)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function g(w){w.MediaStream=w.MediaStream||w.webkitMediaStream}function m(w){if(typeof w=="object"&&w.RTCPeerConnection&&!("ontrack"in w.RTCPeerConnection.prototype)){Object.defineProperty(w.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(Y){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=Y)},enumerable:!0,configurable:!0});const K=w.RTCPeerConnection.prototype.setRemoteDescription;w.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=Y=>{Y.stream.addEventListener("addtrack",X=>{let Z;Z=w.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(Q=>Q.track&&Q.track.id===X.track.id):{track:X.track};const te=new Event("track");te.track=X.track,te.receiver=Z,te.transceiver={receiver:Z},te.streams=[Y.stream],this.dispatchEvent(te)}),Y.stream.getTracks().forEach(X=>{let Z;Z=w.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(Q=>Q.track&&Q.track.id===X.id):{track:X};const te=new Event("track");te.track=X,te.receiver=Z,te.transceiver={receiver:Z},te.streams=[Y.stream],this.dispatchEvent(te)})},this.addEventListener("addstream",this._ontrackpoly)),K.apply(this,arguments)}}else e(w,"track",K=>(K.transceiver||Object.defineProperty(K,"transceiver",{value:{receiver:K.receiver}}),K))}function T(w){if(typeof w=="object"&&w.RTCPeerConnection&&!("getSenders"in w.RTCPeerConnection.prototype)&&"createDTMFSender"in w.RTCPeerConnection.prototype){const K=function(Z,te){return{track:te,get dtmf(){return this._dtmf===void 0&&(te.kind==="audio"?this._dtmf=Z.createDTMFSender(te):this._dtmf=null),this._dtmf},_pc:Z}};if(!w.RTCPeerConnection.prototype.getSenders){w.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const Z=w.RTCPeerConnection.prototype.addTrack;w.RTCPeerConnection.prototype.addTrack=function(Q,oe){let ne=Z.apply(this,arguments);return ne||(ne=K(this,Q),this._senders.push(ne)),ne};const te=w.RTCPeerConnection.prototype.removeTrack;w.RTCPeerConnection.prototype.removeTrack=function(Q){te.apply(this,arguments);const oe=this._senders.indexOf(Q);oe!==-1&&this._senders.splice(oe,1)}}const Y=w.RTCPeerConnection.prototype.addStream;w.RTCPeerConnection.prototype.addStream=function(Z){this._senders=this._senders||[],Y.apply(this,[Z]),Z.getTracks().forEach(te=>{this._senders.push(K(this,te))})};const X=w.RTCPeerConnection.prototype.removeStream;w.RTCPeerConnection.prototype.removeStream=function(Z){this._senders=this._senders||[],X.apply(this,[Z]),Z.getTracks().forEach(te=>{const Q=this._senders.find(oe=>oe.track===te);Q&&this._senders.splice(this._senders.indexOf(Q),1)})}}else if(typeof w=="object"&&w.RTCPeerConnection&&"getSenders"in w.RTCPeerConnection.prototype&&"createDTMFSender"in w.RTCPeerConnection.prototype&&w.RTCRtpSender&&!("dtmf"in w.RTCRtpSender.prototype)){const K=w.RTCPeerConnection.prototype.getSenders;w.RTCPeerConnection.prototype.getSenders=function(){const Y=K.apply(this,[]);return Y.forEach(X=>X._pc=this),Y},Object.defineProperty(w.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function C(w){if(!w.RTCPeerConnection)return;const K=w.RTCPeerConnection.prototype.getStats;w.RTCPeerConnection.prototype.getStats=function(){const[Y,X,Z]=arguments;if(arguments.length>0&&typeof Y=="function")return K.apply(this,arguments);if(K.length===0&&(arguments.length===0||typeof Y!="function"))return K.apply(this,[]);const te=function(oe){const ne={};return oe.result().forEach(ae=>{const le={id:ae.id,timestamp:ae.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[ae.type]||ae.type};ae.names().forEach(ve=>{le[ve]=ae.stat(ve)}),ne[le.id]=le}),ne},Q=function(oe){return new Map(Object.keys(oe).map(ne=>[ne,oe[ne]]))};if(arguments.length>=2){const oe=function(ne){X(Q(te(ne)))};return K.apply(this,[oe,Y])}return new Promise((oe,ne)=>{K.apply(this,[function(ae){oe(Q(te(ae)))},ne])}).then(X,Z)}}function D(w){if(!(typeof w=="object"&&w.RTCPeerConnection&&w.RTCRtpSender&&w.RTCRtpReceiver))return;if(!("getStats"in w.RTCRtpSender.prototype)){const Y=w.RTCPeerConnection.prototype.getSenders;Y&&(w.RTCPeerConnection.prototype.getSenders=function(){const Z=Y.apply(this,[]);return Z.forEach(te=>te._pc=this),Z});const X=w.RTCPeerConnection.prototype.addTrack;X&&(w.RTCPeerConnection.prototype.addTrack=function(){const Z=X.apply(this,arguments);return Z._pc=this,Z}),w.RTCRtpSender.prototype.getStats=function(){const Z=this;return this._pc.getStats().then(te=>b(te,Z.track,!0))}}if(!("getStats"in w.RTCRtpReceiver.prototype)){const Y=w.RTCPeerConnection.prototype.getReceivers;Y&&(w.RTCPeerConnection.prototype.getReceivers=function(){const X=Y.apply(this,[]);return X.forEach(Z=>Z._pc=this),X}),e(w,"track",X=>(X.receiver._pc=X.srcElement,X)),w.RTCRtpReceiver.prototype.getStats=function(){const X=this;return this._pc.getStats().then(Z=>b(Z,X.track,!1))}}if(!("getStats"in w.RTCRtpSender.prototype)||!("getStats"in w.RTCRtpReceiver.prototype))return;const K=w.RTCPeerConnection.prototype.getStats;w.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof w.MediaStreamTrack){const Y=arguments[0];let X,Z,te;return this.getSenders().forEach(Q=>{Q.track===Y&&(X?te=!0:X=Q)}),this.getReceivers().forEach(Q=>(Q.track===Y&&(Z?te=!0:Z=Q),Q.track===Y)),te||X&&Z?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):X?X.getStats():Z?Z.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return K.apply(this,arguments)}}function y(w){w.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(te=>this._shimmedLocalStreams[te][0])};const K=w.RTCPeerConnection.prototype.addTrack;w.RTCPeerConnection.prototype.addTrack=function(te,Q){if(!Q)return K.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const oe=K.apply(this,arguments);return this._shimmedLocalStreams[Q.id]?this._shimmedLocalStreams[Q.id].indexOf(oe)===-1&&this._shimmedLocalStreams[Q.id].push(oe):this._shimmedLocalStreams[Q.id]=[Q,oe],oe};const Y=w.RTCPeerConnection.prototype.addStream;w.RTCPeerConnection.prototype.addStream=function(te){this._shimmedLocalStreams=this._shimmedLocalStreams||{},te.getTracks().forEach(ne=>{if(this.getSenders().find(ae=>ae.track===ne))throw new DOMException("Track already exists.","InvalidAccessError")});const Q=this.getSenders();Y.apply(this,arguments);const oe=this.getSenders().filter(ne=>Q.indexOf(ne)===-1);this._shimmedLocalStreams[te.id]=[te].concat(oe)};const X=w.RTCPeerConnection.prototype.removeStream;w.RTCPeerConnection.prototype.removeStream=function(te){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[te.id],X.apply(this,arguments)};const Z=w.RTCPeerConnection.prototype.removeTrack;w.RTCPeerConnection.prototype.removeTrack=function(te){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},te&&Object.keys(this._shimmedLocalStreams).forEach(Q=>{const oe=this._shimmedLocalStreams[Q].indexOf(te);oe!==-1&&this._shimmedLocalStreams[Q].splice(oe,1),this._shimmedLocalStreams[Q].length===1&&delete this._shimmedLocalStreams[Q]}),Z.apply(this,arguments)}}function A(w,K){if(!w.RTCPeerConnection)return;if(w.RTCPeerConnection.prototype.addTrack&&K.version>=65)return y(w);const Y=w.RTCPeerConnection.prototype.getLocalStreams;w.RTCPeerConnection.prototype.getLocalStreams=function(){const ne=Y.apply(this);return this._reverseStreams=this._reverseStreams||{},ne.map(ae=>this._reverseStreams[ae.id])};const X=w.RTCPeerConnection.prototype.addStream;w.RTCPeerConnection.prototype.addStream=function(ne){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},ne.getTracks().forEach(ae=>{if(this.getSenders().find(le=>le.track===ae))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[ne.id]){const ae=new w.MediaStream(ne.getTracks());this._streams[ne.id]=ae,this._reverseStreams[ae.id]=ne,ne=ae}X.apply(this,[ne])};const Z=w.RTCPeerConnection.prototype.removeStream;function te(ne,ae){let le=ae.sdp;return Object.keys(ne._reverseStreams||[]).forEach(ve=>{const be=ne._reverseStreams[ve],je=ne._streams[be.id];le=le.replace(new RegExp(je.id,"g"),be.id)}),new RTCSessionDescription({type:ae.type,sdp:le})}w.RTCPeerConnection.prototype.removeStream=function(ne){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},Z.apply(this,[this._streams[ne.id]||ne]),delete this._reverseStreams[this._streams[ne.id]?this._streams[ne.id].id:ne.id],delete this._streams[ne.id]},w.RTCPeerConnection.prototype.addTrack=function(ne,ae){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const le=[].slice.call(arguments,1);if(le.length!==1||!le[0].getTracks().find(be=>be===ne))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(be=>be.track===ne))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const ve=this._streams[ae.id];if(ve)ve.addTrack(ne),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const be=new w.MediaStream([ne]);this._streams[ae.id]=be,this._reverseStreams[be.id]=ae,this.addStream(be)}return this.getSenders().find(be=>be.track===ne)},["createOffer","createAnswer"].forEach(function(ne){const ae=w.RTCPeerConnection.prototype[ne],le={[ne](){const ve=arguments;return arguments.length&&typeof arguments[0]=="function"?ae.apply(this,[be=>{const je=te(this,be);ve[0].apply(null,[je])},be=>{ve[1]&&ve[1].apply(null,be)},arguments[2]]):ae.apply(this,arguments).then(be=>te(this,be))}};w.RTCPeerConnection.prototype[ne]=le[ne]});const Q=w.RTCPeerConnection.prototype.setLocalDescription;w.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(ne,ae){let le=ae.sdp;return Object.keys(ne._reverseStreams||[]).forEach(ve=>{const be=ne._reverseStreams[ve],je=ne._streams[be.id];le=le.replace(new RegExp(be.id,"g"),je.id)}),new RTCSessionDescription({type:ae.type,sdp:le})}(this,arguments[0]),Q.apply(this,arguments)):Q.apply(this,arguments)};const oe=Object.getOwnPropertyDescriptor(w.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(w.RTCPeerConnection.prototype,"localDescription",{get(){const ne=oe.get.apply(this);return ne.type===""?ne:te(this,ne)}}),w.RTCPeerConnection.prototype.removeTrack=function(ne){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!ne._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(ne._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let ae;this._streams=this._streams||{},Object.keys(this._streams).forEach(le=>{this._streams[le].getTracks().find(ve=>ne.track===ve)&&(ae=this._streams[le])}),ae&&(ae.getTracks().length===1?this.removeStream(this._reverseStreams[ae.id]):ae.removeTrack(ne.track),this.dispatchEvent(new Event("negotiationneeded")))}}function O(w,K){!w.RTCPeerConnection&&w.webkitRTCPeerConnection&&(w.RTCPeerConnection=w.webkitRTCPeerConnection),w.RTCPeerConnection&&K.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(Y){const X=w.RTCPeerConnection.prototype[Y],Z={[Y](){return arguments[0]=new(Y==="addIceCandidate"?w.RTCIceCandidate:w.RTCSessionDescription)(arguments[0]),X.apply(this,arguments)}};w.RTCPeerConnection.prototype[Y]=Z[Y]})}function j(w,K){e(w,"negotiationneeded",Y=>{const X=Y.target;if(!(K.version<72||X.getConfiguration&&X.getConfiguration().sdpSemantics==="plan-b")||X.signalingState==="stable")return Y})}var I=x(6677),H=x.n(I);function F(w){const K=w&&w.navigator,Y=K.mediaDevices.getUserMedia.bind(K.mediaDevices);K.mediaDevices.getUserMedia=function(X){return Y(X).catch(Z=>Promise.reject(function(te){return{name:{PermissionDeniedError:"NotAllowedError"}[te.name]||te.name,message:te.message,constraint:te.constraint,toString(){return this.name}}}(Z)))}}function U(w){"getDisplayMedia"in w.navigator&&w.navigator.mediaDevices&&(w.navigator.mediaDevices&&"getDisplayMedia"in w.navigator.mediaDevices||(w.navigator.mediaDevices.getDisplayMedia=w.navigator.getDisplayMedia.bind(w.navigator)))}function B(w,K){if(w.RTCIceGatherer&&(w.RTCIceCandidate||(w.RTCIceCandidate=function(X){return X}),w.RTCSessionDescription||(w.RTCSessionDescription=function(X){return X}),K.version<15025)){const X=Object.getOwnPropertyDescriptor(w.MediaStreamTrack.prototype,"enabled");Object.defineProperty(w.MediaStreamTrack.prototype,"enabled",{set(Z){X.set.call(this,Z);const te=new Event("enabled");te.enabled=Z,this.dispatchEvent(te)}})}w.RTCRtpSender&&!("dtmf"in w.RTCRtpSender.prototype)&&Object.defineProperty(w.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=new w.RTCDtmfSender(this):this.track.kind==="video"&&(this._dtmf=null)),this._dtmf}}),w.RTCDtmfSender&&!w.RTCDTMFSender&&(w.RTCDTMFSender=w.RTCDtmfSender);const Y=H()(w,K.version);w.RTCPeerConnection=function(X){return X&&X.iceServers&&(X.iceServers=function(Z){let te=!1;return(Z=JSON.parse(JSON.stringify(Z))).filter(Q=>{if(Q&&(Q.urls||Q.url)){let oe=Q.urls||Q.url;Q.url&&!Q.urls&&t("RTCIceServer.url","RTCIceServer.urls");const ne=typeof oe=="string";return ne&&(oe=[oe]),oe=oe.filter(ae=>{if(ae.indexOf("stun:")===0)return!1;const le=ae.startsWith("turn")&&!ae.startsWith("turn:[")&&ae.includes("transport=udp");return le&&!te?(te=!0,!0):le&&!te}),delete Q.url,Q.urls=ne?oe[0]:oe,!!oe.length}})}(X.iceServers,K.version),s("ICE servers after filtering:",X.iceServers)),new Y(X)},w.RTCPeerConnection.prototype=Y.prototype}function k(w){w.RTCRtpSender&&!("replaceTrack"in w.RTCRtpSender.prototype)&&(w.RTCRtpSender.prototype.replaceTrack=w.RTCRtpSender.prototype.setTrack)}function V(w,K){const Y=w&&w.navigator,X=w&&w.MediaStreamTrack;if(Y.getUserMedia=function(Z,te,Q){t("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),Y.mediaDevices.getUserMedia(Z).then(te,Q)},!(K.version>55&&"autoGainControl"in Y.mediaDevices.getSupportedConstraints())){const Z=function(Q,oe,ne){oe in Q&&!(ne in Q)&&(Q[ne]=Q[oe],delete Q[oe])},te=Y.mediaDevices.getUserMedia.bind(Y.mediaDevices);if(Y.mediaDevices.getUserMedia=function(Q){return typeof Q=="object"&&typeof Q.audio=="object"&&(Q=JSON.parse(JSON.stringify(Q)),Z(Q.audio,"autoGainControl","mozAutoGainControl"),Z(Q.audio,"noiseSuppression","mozNoiseSuppression")),te(Q)},X&&X.prototype.getSettings){const Q=X.prototype.getSettings;X.prototype.getSettings=function(){const oe=Q.apply(this,arguments);return Z(oe,"mozAutoGainControl","autoGainControl"),Z(oe,"mozNoiseSuppression","noiseSuppression"),oe}}if(X&&X.prototype.applyConstraints){const Q=X.prototype.applyConstraints;X.prototype.applyConstraints=function(oe){return this.kind==="audio"&&typeof oe=="object"&&(oe=JSON.parse(JSON.stringify(oe)),Z(oe,"autoGainControl","mozAutoGainControl"),Z(oe,"noiseSuppression","mozNoiseSuppression")),Q.apply(this,[oe])}}}}function G(w,K){w.navigator.mediaDevices&&"getDisplayMedia"in w.navigator.mediaDevices||w.navigator.mediaDevices&&(w.navigator.mediaDevices.getDisplayMedia=function(Y){if(!Y||!Y.video){const X=new DOMException("getDisplayMedia without video constraints is undefined");return X.name="NotFoundError",X.code=8,Promise.reject(X)}return Y.video===!0?Y.video={mediaSource:K}:Y.video.mediaSource=K,w.navigator.mediaDevices.getUserMedia(Y)})}function q(w){typeof w=="object"&&w.RTCTrackEvent&&"receiver"in w.RTCTrackEvent.prototype&&!("transceiver"in w.RTCTrackEvent.prototype)&&Object.defineProperty(w.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function z(w,K){if(typeof w!="object"||!w.RTCPeerConnection&&!w.mozRTCPeerConnection)return;!w.RTCPeerConnection&&w.mozRTCPeerConnection&&(w.RTCPeerConnection=w.mozRTCPeerConnection),K.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(Z){const te=w.RTCPeerConnection.prototype[Z],Q={[Z](){return arguments[0]=new(Z==="addIceCandidate"?w.RTCIceCandidate:w.RTCSessionDescription)(arguments[0]),te.apply(this,arguments)}};w.RTCPeerConnection.prototype[Z]=Q[Z]});const Y={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},X=w.RTCPeerConnection.prototype.getStats;w.RTCPeerConnection.prototype.getStats=function(){const[Z,te,Q]=arguments;return X.apply(this,[Z||null]).then(oe=>{if(K.version<53&&!te)try{oe.forEach(ne=>{ne.type=Y[ne.type]||ne.type})}catch(ne){if(ne.name!=="TypeError")throw ne;oe.forEach((ae,le)=>{oe.set(le,Object.assign({},ae,{type:Y[ae.type]||ae.type}))})}return oe}).then(te,Q)}}function $(w){if(typeof w!="object"||!w.RTCPeerConnection||!w.RTCRtpSender||w.RTCRtpSender&&"getStats"in w.RTCRtpSender.prototype)return;const K=w.RTCPeerConnection.prototype.getSenders;K&&(w.RTCPeerConnection.prototype.getSenders=function(){const X=K.apply(this,[]);return X.forEach(Z=>Z._pc=this),X});const Y=w.RTCPeerConnection.prototype.addTrack;Y&&(w.RTCPeerConnection.prototype.addTrack=function(){const X=Y.apply(this,arguments);return X._pc=this,X}),w.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function re(w){if(typeof w!="object"||!w.RTCPeerConnection||!w.RTCRtpSender||w.RTCRtpSender&&"getStats"in w.RTCRtpReceiver.prototype)return;const K=w.RTCPeerConnection.prototype.getReceivers;K&&(w.RTCPeerConnection.prototype.getReceivers=function(){const Y=K.apply(this,[]);return Y.forEach(X=>X._pc=this),Y}),e(w,"track",Y=>(Y.receiver._pc=Y.srcElement,Y)),w.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function ee(w){w.RTCPeerConnection&&!("removeStream"in w.RTCPeerConnection.prototype)&&(w.RTCPeerConnection.prototype.removeStream=function(K){t("removeStream","removeTrack"),this.getSenders().forEach(Y=>{Y.track&&K.getTracks().includes(Y.track)&&this.removeTrack(Y)})})}function ie(w){w.DataChannel&&!w.RTCDataChannel&&(w.RTCDataChannel=w.DataChannel)}function se(w){if(typeof w!="object"||!w.RTCPeerConnection)return;const K=w.RTCPeerConnection.prototype.addTransceiver;K&&(w.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const Y=arguments[1],X=Y&&"sendEncodings"in Y;X&&Y.sendEncodings.forEach(te=>{if("rid"in te&&!/^[a-z0-9]{0,16}$/i.test(te.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in te&&!(parseFloat(te.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in te&&!(parseFloat(te.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const Z=K.apply(this,arguments);if(X){const{sender:te}=Z,Q=te.getParameters();(!("encodings"in Q)||Q.encodings.length===1&&Object.keys(Q.encodings[0]).length===0)&&(Q.encodings=Y.sendEncodings,te.sendEncodings=Y.sendEncodings,this.setParametersPromises.push(te.setParameters(Q).then(()=>{delete te.sendEncodings}).catch(()=>{delete te.sendEncodings})))}return Z})}function ce(w){if(typeof w!="object"||!w.RTCRtpSender)return;const K=w.RTCRtpSender.prototype.getParameters;K&&(w.RTCRtpSender.prototype.getParameters=function(){const Y=K.apply(this,arguments);return"encodings"in Y||(Y.encodings=[].concat(this.sendEncodings||[{}])),Y})}function ue(w){if(typeof w!="object"||!w.RTCPeerConnection)return;const K=w.RTCPeerConnection.prototype.createOffer;w.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>K.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):K.apply(this,arguments)}}function de(w){if(typeof w!="object"||!w.RTCPeerConnection)return;const K=w.RTCPeerConnection.prototype.createAnswer;w.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>K.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):K.apply(this,arguments)}}function pe(w){if(typeof w=="object"&&w.RTCPeerConnection){if("getLocalStreams"in w.RTCPeerConnection.prototype||(w.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in w.RTCPeerConnection.prototype)){const K=w.RTCPeerConnection.prototype.addTrack;w.RTCPeerConnection.prototype.addStream=function(Y){this._localStreams||(this._localStreams=[]),this._localStreams.includes(Y)||this._localStreams.push(Y),Y.getAudioTracks().forEach(X=>K.call(this,X,Y)),Y.getVideoTracks().forEach(X=>K.call(this,X,Y))},w.RTCPeerConnection.prototype.addTrack=function(Y,...X){return X&&X.forEach(Z=>{this._localStreams?this._localStreams.includes(Z)||this._localStreams.push(Z):this._localStreams=[Z]}),K.apply(this,arguments)}}"removeStream"in w.RTCPeerConnection.prototype||(w.RTCPeerConnection.prototype.removeStream=function(K){this._localStreams||(this._localStreams=[]);const Y=this._localStreams.indexOf(K);if(Y===-1)return;this._localStreams.splice(Y,1);const X=K.getTracks();this.getSenders().forEach(Z=>{X.includes(Z.track)&&this.removeTrack(Z)})})}}function Ee(w){if(typeof w=="object"&&w.RTCPeerConnection&&("getRemoteStreams"in w.RTCPeerConnection.prototype||(w.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in w.RTCPeerConnection.prototype))){Object.defineProperty(w.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(Y){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=Y),this.addEventListener("track",this._onaddstreampoly=X=>{X.streams.forEach(Z=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(Z))return;this._remoteStreams.push(Z);const te=new Event("addstream");te.stream=Z,this.dispatchEvent(te)})})}});const K=w.RTCPeerConnection.prototype.setRemoteDescription;w.RTCPeerConnection.prototype.setRemoteDescription=function(){const Y=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(X){X.streams.forEach(Z=>{if(Y._remoteStreams||(Y._remoteStreams=[]),Y._remoteStreams.indexOf(Z)>=0)return;Y._remoteStreams.push(Z);const te=new Event("addstream");te.stream=Z,Y.dispatchEvent(te)})}),K.apply(Y,arguments)}}}function he(w){if(typeof w!="object"||!w.RTCPeerConnection)return;const K=w.RTCPeerConnection.prototype,Y=K.createOffer,X=K.createAnswer,Z=K.setLocalDescription,te=K.setRemoteDescription,Q=K.addIceCandidate;K.createOffer=function(ne,ae){const le=arguments.length>=2?arguments[2]:arguments[0],ve=Y.apply(this,[le]);return ae?(ve.then(ne,ae),Promise.resolve()):ve},K.createAnswer=function(ne,ae){const le=arguments.length>=2?arguments[2]:arguments[0],ve=X.apply(this,[le]);return ae?(ve.then(ne,ae),Promise.resolve()):ve};let oe=function(ne,ae,le){const ve=Z.apply(this,[ne]);return le?(ve.then(ae,le),Promise.resolve()):ve};K.setLocalDescription=oe,oe=function(ne,ae,le){const ve=te.apply(this,[ne]);return le?(ve.then(ae,le),Promise.resolve()):ve},K.setRemoteDescription=oe,oe=function(ne,ae,le){const ve=Q.apply(this,[ne]);return le?(ve.then(ae,le),Promise.resolve()):ve},K.addIceCandidate=oe}function fe(w){const K=w&&w.navigator;if(K.mediaDevices&&K.mediaDevices.getUserMedia){const Y=K.mediaDevices,X=Y.getUserMedia.bind(Y);K.mediaDevices.getUserMedia=Z=>X(me(Z))}!K.getUserMedia&&K.mediaDevices&&K.mediaDevices.getUserMedia&&(K.getUserMedia=function(Y,X,Z){K.mediaDevices.getUserMedia(Y).then(X,Z)}.bind(K))}function me(w){return w&&w.video!==void 0?Object.assign({},w,{video:l(w.video)}):w}function ge(w){if(!w.RTCPeerConnection)return;const K=w.RTCPeerConnection;w.RTCPeerConnection=function(Y,X){if(Y&&Y.iceServers){const Z=[];for(let te=0;te<Y.iceServers.length;te++){let Q=Y.iceServers[te];!Q.hasOwnProperty("urls")&&Q.hasOwnProperty("url")?(t("RTCIceServer.url","RTCIceServer.urls"),Q=JSON.parse(JSON.stringify(Q)),Q.urls=Q.url,delete Q.url,Z.push(Q)):Z.push(Y.iceServers[te])}Y.iceServers=Z}return new K(Y,X)},w.RTCPeerConnection.prototype=K.prototype,"generateCertificate"in K&&Object.defineProperty(w.RTCPeerConnection,"generateCertificate",{get:()=>K.generateCertificate})}function _e(w){typeof w=="object"&&w.RTCTrackEvent&&"receiver"in w.RTCTrackEvent.prototype&&!("transceiver"in w.RTCTrackEvent.prototype)&&Object.defineProperty(w.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Re(w){const K=w.RTCPeerConnection.prototype.createOffer;w.RTCPeerConnection.prototype.createOffer=function(Y){if(Y){Y.offerToReceiveAudio!==void 0&&(Y.offerToReceiveAudio=!!Y.offerToReceiveAudio);const X=this.getTransceivers().find(te=>te.receiver.track.kind==="audio");Y.offerToReceiveAudio===!1&&X?X.direction==="sendrecv"?X.setDirection?X.setDirection("sendonly"):X.direction="sendonly":X.direction==="recvonly"&&(X.setDirection?X.setDirection("inactive"):X.direction="inactive"):Y.offerToReceiveAudio!==!0||X||this.addTransceiver("audio"),Y.offerToReceiveVideo!==void 0&&(Y.offerToReceiveVideo=!!Y.offerToReceiveVideo);const Z=this.getTransceivers().find(te=>te.receiver.track.kind==="video");Y.offerToReceiveVideo===!1&&Z?Z.direction==="sendrecv"?Z.setDirection?Z.setDirection("sendonly"):Z.direction="sendonly":Z.direction==="recvonly"&&(Z.setDirection?Z.setDirection("inactive"):Z.direction="inactive"):Y.offerToReceiveVideo!==!0||Z||this.addTransceiver("video")}return K.apply(this,arguments)}}function Te(w){typeof w!="object"||w.AudioContext||(w.AudioContext=w.webkitAudioContext)}var Ne=x(7963),ke=x.n(Ne);function Oe(w){if(!w.RTCIceCandidate||w.RTCIceCandidate&&"foundation"in w.RTCIceCandidate.prototype)return;const K=w.RTCIceCandidate;w.RTCIceCandidate=function(Y){if(typeof Y=="object"&&Y.candidate&&Y.candidate.indexOf("a=")===0&&((Y=JSON.parse(JSON.stringify(Y))).candidate=Y.candidate.substr(2)),Y.candidate&&Y.candidate.length){const X=new K(Y),Z=ke().parseCandidate(Y.candidate),te=Object.assign(X,Z);return te.toJSON=function(){return{candidate:te.candidate,sdpMid:te.sdpMid,sdpMLineIndex:te.sdpMLineIndex,usernameFragment:te.usernameFragment}},te}return new K(Y)},w.RTCIceCandidate.prototype=K.prototype,e(w,"icecandidate",Y=>(Y.candidate&&Object.defineProperty(Y,"candidate",{value:new w.RTCIceCandidate(Y.candidate),writable:"false"}),Y))}function Ce(w,K){if(!w.RTCPeerConnection)return;"sctp"in w.RTCPeerConnection.prototype||Object.defineProperty(w.RTCPeerConnection.prototype,"sctp",{get(){return this._sctp===void 0?null:this._sctp}});const Y=w.RTCPeerConnection.prototype.setRemoteDescription;w.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,K.browser==="chrome"&&K.version>=76){const{sdpSemantics:X}=this.getConfiguration();X==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return this._sctp===void 0?null:this._sctp},enumerable:!0,configurable:!0})}if(function(X){if(!X||!X.sdp)return!1;const Z=ke().splitSections(X.sdp);return Z.shift(),Z.some(te=>{const Q=ke().parseMLine(te);return Q&&Q.kind==="application"&&Q.protocol.indexOf("SCTP")!==-1})}(arguments[0])){const X=function(ne){const ae=ne.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(ae===null||ae.length<2)return-1;const le=parseInt(ae[1],10);return le!=le?-1:le}(arguments[0]),Z=function(ne){let ae=65536;return K.browser==="firefox"&&(ae=K.version<57?ne===-1?16384:2147483637:K.version<60?K.version===57?65535:65536:2147483637),ae}(X),te=function(ne,ae){let le=65536;K.browser==="firefox"&&K.version===57&&(le=65535);const ve=ke().matchPrefix(ne.sdp,"a=max-message-size:");return ve.length>0?le=parseInt(ve[0].substr(19),10):K.browser==="firefox"&&ae!==-1&&(le=2147483637),le}(arguments[0],X);let Q;Q=Z===0&&te===0?Number.POSITIVE_INFINITY:Z===0||te===0?Math.max(Z,te):Math.min(Z,te);const oe={};Object.defineProperty(oe,"maxMessageSize",{get:()=>Q}),this._sctp=oe}return Y.apply(this,arguments)}}function Ae(w){if(!w.RTCPeerConnection||!("createDataChannel"in w.RTCPeerConnection.prototype))return;function K(X,Z){const te=X.send;X.send=function(){const Q=arguments[0],oe=Q.length||Q.size||Q.byteLength;if(X.readyState==="open"&&Z.sctp&&oe>Z.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+Z.sctp.maxMessageSize+" bytes)");return te.apply(X,arguments)}}const Y=w.RTCPeerConnection.prototype.createDataChannel;w.RTCPeerConnection.prototype.createDataChannel=function(){const X=Y.apply(this,arguments);return K(X,this),X},e(w,"datachannel",X=>(K(X.channel,X.target),X))}function Pe(w){if(!w.RTCPeerConnection||"connectionState"in w.RTCPeerConnection.prototype)return;const K=w.RTCPeerConnection.prototype;Object.defineProperty(K,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(K,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(Y){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),Y&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=Y)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(Y=>{const X=K[Y];K[Y]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=Z=>{const te=Z.target;if(te._lastConnectionState!==te.connectionState){te._lastConnectionState=te.connectionState;const Q=new Event("connectionstatechange",Z);te.dispatchEvent(Q)}return Z},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),X.apply(this,arguments)}})}function we(w,K){if(!w.RTCPeerConnection||K.browser==="chrome"&&K.version>=71||K.browser==="safari"&&K.version>=605)return;const Y=w.RTCPeerConnection.prototype.setRemoteDescription;w.RTCPeerConnection.prototype.setRemoteDescription=function(X){if(X&&X.sdp&&X.sdp.indexOf(`
156
+ `)):""},f.prototype.removeVideoTrack=function(a){for(var d="rts "+a,p=-1,e=-1,r=!1,n=0;n<this.sdpLines.length;++n){if(r&&this.sdpLines[n].indexOf("m=application")>-1){e=n-1;break}if(this.sdpLines[n].indexOf("m=video")>-1){if(r){e=n-1;break}p=n}this.sdpLines[n].indexOf(d)>-1&&(r=!0)}return!!r&&(e===-1&&(e=this.sdpLines.length-1),this.sdpLines.splice(p,e-p),!0)},f.prototype.ios15PushHack=function(){var a=!1,d=-1;if(this.sdpLines.forEach(function(r,n){r.includes("m=video")&&(a=!0),a&&d===-1&&r.includes("a=")&&(d=n)}),d!==-1){var p=this.getExtmapIds(),e=Math.max.apply(Math,p)+1;this.sdpLines.splice(d,0,"a=extmap:".concat(e," urn:3gpp:video-orientation"))}},f.prototype.addSps=function(){this.sdpLines=this.sdpLines.map(function(a){return a.includes("a=fmtp:")&&a.includes("level-asymmetry-allowed")?a+=";sps-pps-idr-in-keyframe=1":a})},f.prototype.removeTwccRtcpFb=function(){this.sdpLines=this.sdpLines.filter(function(a){return!a.includes("http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01")})},f.prototype.removeUdpCandidate=function(){this.sdpLines=this.sdpLines.filter(function(a){return!a.includes("a=candidate:")||!a.includes("UDP")}),console.log("removed udp candidate")},f.prototype.setDirection=function(a){a===void 0&&(a={direction:"recvonly"});var d=["sendonly","recvonly","sendrecv"].filter(function(r){return r!==a.direction}),p=!1,e=!1;this.sdpLines=this.sdpLines.map(function(r,n){if(r.includes("m=video"))p=!0,e=!1;else if(r.includes("m=audio"))e=!0,p=!1;else if(r.includes("m=application"))p=!1,e=!1;else if(p||e){var s;if(d.some(function(t){if(r.includes(t))return s=t,!0})&&s)return r.replace(s,a.direction)}return r})},f.prototype.removeSDES=function(){var a=["urn:ietf:params:rtp-hdrext:sdes:mid","urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id","urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"];this.sdpLines=this.sdpLines.filter(function(d){return!a.some(function(p){return d.includes(p)})})},f.prototype.addStereo=function(){var a=this;this.getPayloadType("opus").map(this.getFmtpIndex.bind(this)).filter(function(d){return d!==void 0}).forEach(function(d){a.sdpLines[d].indexOf("stereo=1")>-1||(a.sdpLines[d]=a.sdpLines[d]+";stereo=1")})},f.prototype.dispose=function(){this.localStream&&(this.localStream=void 0),this.sdpLines=new Array,this.publishStreamInfo=new u},f.prototype.getExtmapIds=function(){return this.sdpLines.reduce(function(a,d){if(d.includes("a=extmap")){var p=Number(d.replace("a=extmap:","").split(" ")[0]);return v(v([],a,!0),[p],!1)}return a},[]).filter(function(a){return a})},f.prototype.getPayloadType=function(a){for(var d=[],p=new RegExp("a\\=rtpmap\\:(\\d+) ".concat(a,".*"),"i"),e=0;e<this.sdpLines.length;e++){var r=this.sdpLines[e],n=p.exec(r);n?.length&&d.push(n[1])}return d},f.prototype.getFmtpIndex=function(a){for(var d=new RegExp("a\\=fmtp\\:".concat(a," .*"),"i"),p=0;p<this.sdpLines.length;p++){var e=this.sdpLines[p];if(d.test(e))return p}},f}();R.SdpUtil=S},7989:function(L,R,x){var v=this&&this.__awaiter||function(e,r,n,s){return new(n||(n=Promise))(function(t,i){function l(_){try{b(s.next(_))}catch(h){i(h)}}function E(_){try{b(s.throw(_))}catch(h){i(h)}}function b(_){var h;_.done?t(_.value):(h=_.value,h instanceof n?h:new n(function(o){o(h)})).then(l,E)}b((s=s.apply(e,r||[])).next())})},c=this&&this.__generator||function(e,r){var n,s,t,i,l={label:0,sent:function(){if(1&t[0])throw t[1];return t[1]},trys:[],ops:[]};return i={next:E(0),throw:E(1),return:E(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function E(b){return function(_){return function(h){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,h[0]&&(l=0)),l;)try{if(n=1,s&&(t=2&h[0]?s.return:h[0]?s.throw||((t=s.return)&&t.call(s),0):s.next)&&!(t=t.call(s,h[1])).done)return t;switch(s=0,t&&(h=[2&h[0],t.value]),h[0]){case 0:case 1:t=h;break;case 4:return l.label++,{value:h[1],done:!1};case 5:l.label++,s=h[1],h=[0];continue;case 7:h=l.ops.pop(),l.trys.pop();continue;default:if(t=l.trys,!((t=t.length>0&&t[t.length-1])||h[0]!==6&&h[0]!==2)){l=0;continue}if(h[0]===3&&(!t||h[1]>t[0]&&h[1]<t[3])){l.label=h[1];break}if(h[0]===6&&l.label<t[1]){l.label=t[1],t=h;break}if(t&&l.label<t[2]){l.label=t[2],l.ops.push(h);break}t[2]&&l.ops.pop(),l.trys.pop();continue}h=r.call(e,l)}catch(o){h=[6,o],s=0}finally{n=t=0}if(5&h[0])throw h[1];return{value:h[0]?h[1]:void 0,done:!0}}([b,_])}}};Object.defineProperty(R,"__esModule",{value:!0}),R.SupportUtil=void 0;var u=x(233),S=x(3412),f=x(9428),a=x(2672),d=function(){this.errorCode=0,this.message=""},p=function(){function e(){this.deviceManager=new S.BrowserDeviceManager}return e.prototype.isSupport=function(r){var n=this;return new Promise(function(s,t){return v(n,void 0,void 0,function(){var i,l,E,b;return c(this,function(_){switch(_.label){case 0:return i=new d,this.checkWebRtcSupport()?r.onlyCheckUA?this.checkBrowser(i)?[3,3]:[2,t(i)]:[3,1]:(i.errorCode=f.ErrorCode.ERROR_NOTSUPPORT_WEBRTC,i.message=a.EN.MESSAGE_NOTSUPPORT_WEBRTC,[2,t(i)]);case 1:return[4,this.checkWebrtcAbilities()];case 2:if(l=_.sent(),E=l[0],l[1],l[2],b=l[3],!E)return i.errorCode=f.ErrorCode.ERROR_NOTSUPPORT_WEBRTC,i.message=a.EN.MESSAGE_NOTSUPPORT_WEBRTC,[2,t(i)];if(b)return i.errorCode=f.ErrorCode.ERROR_BROWSER_NOTSUPPORT,i.message=a.EN.MESSAGE_BROWSER_NOTSUPPORT,[2,t(i)];_.label=3;case 3:return r.isReceiveVideo?this.checkH264Decode(i).then(function(){s(i)}).catch(function(){t(i)}):s(i),[2]}})})})},e.prototype.checkEncodedTransformSupport=function(){var r=window.RTCRtpReceiver&&"createEncodedStreams"in RTCRtpReceiver.prototype,n=window.RTCRtpReceiver&&"transform"in RTCRtpReceiver.prototype&&"RTCRtpScriptTransform"in window;return r||n},e.prototype.checkWebrtcAbilities=function(r){return v(this,void 0,void 0,function(){var n,s,t,i,l,E,b,_,h;return c(this,function(o){switch(o.label){case 0:n=window.RTCPeerConnection,s=!1,t=!1,i=null,l=!1,o.label=1;case 1:return o.trys.push([1,4,,5]),n?(E=new n,t="createDataChannel"in E,r&&(b=this.createBlankStream()).getTracks().forEach(function(g){E?.addTrack(g,b)}),[4,E.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0,iceRestart:!0})]):[3,3];case 2:_=o.sent(),h=(_||{}).sdp,i=r?!!(h&&h.indexOf("a=sendrecv")>-1):null,E.close(),E=void 0,s=!0,o.label=3;case 3:return[3,5];case 4:return o.sent(),s=!1,t=!1,i=!1,[3,5];case 5:return l=this.checkBlackList(),[2,[s,t,i,l]]}})})},e.prototype.checkPublishSupport=function(){return v(this,void 0,void 0,function(){var r,n,s,t,i,l,E,b;return c(this,function(_){switch(_.label){case 0:return r={isWebRTCSupported:!1,isH264EncodeSupported:!1,isMediaDevicesSupported:!1,isScreenCaptureSupported:!1,isAudioMixSupported:!1,cameraList:[],micList:[],speakerList:[]},this.checkWebRtcSupport()?[3,1]:(r.isWebRTCSupported=!1,r.isH264EncodeSupported=!1,[3,5]);case 1:return[4,this.checkWebrtcAbilities(!0)];case 2:return n=_.sent(),s=n[0],n[1],t=n[2],r.isWebRTCSupported=!(!s||!t),r.isWebRTCSupported?[3,3]:(r.isH264EncodeSupported=!1,[3,5]);case 3:return i=r,[4,this.checkH264Encode()];case 4:i.isH264EncodeSupported=_.sent(),_.label=5;case 5:if(r.isMediaDevicesSupported=this.checkMediaDevices(),r.isScreenCaptureSupported=this.checkScreenCapture(),r.isAudioMixSupported=this.checkAudioMix(),!r.isMediaDevicesSupported)return[3,11];_.label=6;case 6:return _.trys.push([6,10,,11]),l=r,[4,this.deviceManager.getCameraList()];case 7:return l.cameraList=_.sent().filter(function(h){return h.deviceId}),E=r,[4,this.deviceManager.getMicList()];case 8:return E.micList=_.sent().filter(function(h){return h.deviceId}),b=r,[4,this.deviceManager.getSpeakerList()];case 9:return b.speakerList=_.sent().filter(function(h){return h.deviceId}),[3,11];case 10:return _.sent(),[3,11];case 11:return[2,r]}})})},e.prototype.checkWebRtcSupport=function(){return!!window.RTCPeerConnection},e.prototype.checkMediaDevices=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)},e.prototype.checkScreenCapture=function(){return!(!navigator.mediaDevices||!navigator.mediaDevices.getDisplayMedia)},e.prototype.checkAudioMix=function(){if(!window.AudioContext)return!1;var r=new AudioContext;return!!r.createMediaStreamDestination&&!!r.createMediaStreamSource},e.prototype.checkBlackList=function(){var r=!1;if(u.BrowserUtil.isOppoBrowser&&u.SystemUtil.isAndroid){var n=(this.getUa().toLowerCase().match(/heytapbrowser\/([\d.]+)/)||[])[1]||"";r=!this.compareVersion(n,"40.7.39.1")}else(u.BrowserUtil.isUCBrowser||u.BrowserUtil.isQuarkBrowser)&&u.SystemUtil.isIos?r=!0:u.BrowserUtil.isWebView&&u.SystemUtil.isAndroid&&(r=!(u.BrowserUtil.browserMainVersion>=79));return r},e.prototype.checkBrowser=function(r){if(u.SystemUtil.isIos){if(u.BrowserUtil.isUCBrowser||u.BrowserUtil.isQuarkBrowser)return r.errorCode=f.ErrorCode.ERROR_BROWSER_NOTSUPPORT,r.message=a.EN.MESSAGE_BROWSER_NOTSUPPORT,!1;if(u.BrowserUtil.isSafari||u.BrowserUtil.isQQBrowser)return u.BrowserUtil.browserMainVersion>=11||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isEdge||u.BrowserUtil.isChrome)return u.BrowserUtil.browserMainVersion>=79||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isMicroMessenger)return!!this.compareVersion(u.SystemUtil.systemVersion,"12.1.4")||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isDingTalk)return!!u.SystemUtil.compareVersion("11.2.5")||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isWebView)return!!this.compareVersion(u.SystemUtil.systemVersion,"14.3")||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(u.SystemUtil.isAndroid){if(this.checkPrivateUcWebview())return!0;if(u.BrowserUtil.isChrome||u.BrowserUtil.isQQBrowser||u.BrowserUtil.isHuaweiBrowser||u.BrowserUtil.isSamsungBrowser)return u.BrowserUtil.browserMainVersion>=63||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isEdge)return u.BrowserUtil.browserMainVersion>=79||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isMicroMessenger)return!!this.compareVersion(this.getChromeCoreVersion(),"63")||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isDingTalk)return!!this.compareVersion(this.getChromeCoreVersion(),"69")||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isOppoBrowser){var n=(this.getUa().toLowerCase().match(/heytapbrowser\/([\d.]+)/)||[])[1]||"";return!!this.compareVersion(n,"40.7.39.1")||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}if(u.BrowserUtil.isX5Core)return!0;if(u.BrowserUtil.isWebView)return u.BrowserUtil.browserMainVersion>=79||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(u.SystemUtil.isMacOS){if(u.BrowserUtil.isElectron)return!0;if(u.BrowserUtil.isSafari)return u.BrowserUtil.browserMainVersion>=11||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isChrome)return u.BrowserUtil.browserMainVersion>=63||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isEdge)return u.BrowserUtil.browserMainVersion>=79||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isFirefox)return u.BrowserUtil.browserMainVersion>=62||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isOpera)return u.BrowserUtil.browserMainVersion>=15||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(u.SystemUtil.isWindows){if(u.BrowserUtil.isElectron||u.BrowserUtil.isMicroMessenger)return!0;if(u.BrowserUtil.isChrome||u.BrowserUtil.isQQBrowser)return u.BrowserUtil.browserMainVersion>=63||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isEdge)return u.BrowserUtil.browserMainVersion>=79||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isFirefox)return u.BrowserUtil.browserMainVersion>=62||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isOpera)return u.BrowserUtil.browserMainVersion>=15||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}else if(u.SystemUtil.isLinux){if(u.BrowserUtil.isChrome)return u.BrowserUtil.browserMainVersion>=63||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isEdge)return u.BrowserUtil.browserMainVersion>=79||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1);if(u.BrowserUtil.isFirefox)return u.BrowserUtil.browserMainVersion>=62||(r.errorCode=f.ErrorCode.ERROR_BROWSER_VERSIONLOW,r.message=a.EN.MESSAGE_BROWSER_VERSIONLOW,!1)}return r.errorCode===0&&(r.errorCode=f.ErrorCode.ERROR_BROWSER_NOTSUPPORT,r.message=a.EN.MESSAGE_BROWSER_NOTSUPPORT),!1},e.prototype.checkH264Decode=function(r){var n=this;return new Promise(function(s,t){return v(n,void 0,void 0,function(){var i;return c(this,function(l){switch(l.label){case 0:return[4,this.tryFindH264FromSdp(r)];case 1:if(i=l.sent())return s(!0),[2];l.label=2;case 2:return l.trys.push([2,4,,5]),[4,this.loadH264(3)];case 3:return i=l.sent(),[3,5];case 4:return l.sent(),[3,5];case 5:return i?s(!0):(r&&r.errorCode===0&&(r.errorCode=f.ErrorCode.ERROR_NOTSUPPORT_H264,r.message=a.EN.MESSAGE_NOTSUPPORT_H264),t(!1)),[2]}})})})},e.prototype.checkSDPSupportH264=function(r){return r.indexOf("H264")>0||r.indexOf("h264")>0||r.indexOf("H.264")>0||r.indexOf("h.264")>0},e.prototype.checkPrivateUcWebview=function(){return this.getUa().indexOf("UniqueCode")>0},e.prototype.getUa=function(){return navigator&&navigator.userAgent||""},e.prototype.getChromeCoreVersion=function(){return(this.getUa().toLowerCase().match(/chrome\/([\d.]+)/)||[])[1]||""},e.prototype.compareVersion=function(r,n){r===void 0&&(r=""),n===void 0&&(n="");for(var s=(r||"").split("."),t=(n||"").split("."),i=0,l=0,E=0;E<s.length&&E<t.length;++E){if((i=isNaN(parseInt(s[E],10))?0:parseInt(s[E],10))<(l=isNaN(parseInt(t[E],10))?0:parseInt(t[E],10)))return!1;if(i>l)return!0}return!0},e.prototype.tryFindH264FromSdp=function(r){return v(this,void 0,void 0,function(){var n,s,t;return c(this,function(i){switch(i.label){case 0:if(n=!1,!RTCPeerConnection)return[2,n];s=new RTCPeerConnection,t=void 0,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,s.createOffer({offerToReceiveVideo:!0,offerToReceiveAudio:!0})];case 2:return(t=i.sent())&&t.sdp&&(n=this.checkSDPSupportH264(t.sdp)),[3,4];case 3:return i.sent(),n=!1,r&&(r.errorCode=f.ErrorCode.ERROR_CREATEOFFER,r.message=a.EN.MESSAGE_CREATEOFFER),[3,4];case 4:return s.close(),s=void 0,[2,n]}})})},e.prototype.loadH264=function(r){var n=this;return new Promise(function(s,t){return v(n,void 0,void 0,function(){var i,l,E,b,_=this;return c(this,function(h){if(!u.SystemUtil.isAndroid||!u.BrowserUtil.isChrome&&!u.BrowserUtil.isWebView)return s(!1),[2];for(i=0,l=[],E=0;i<r;)b=setTimeout(function(){return v(_,void 0,void 0,function(){return c(this,function(o){switch(o.label){case 0:return E++,[4,this.tryFindH264FromSdp()];case 1:return o.sent()?(l.forEach(function(g){clearTimeout(g)}),l=[],s(!0),[2]):(E===r&&s(!1),[2])}})})},1e3*i),l.push(b),i++;return[2]})})})},e.prototype.checkH264Encode=function(){return v(this,void 0,void 0,function(){var r,n,s;return c(this,function(t){switch(t.label){case 0:return[4,this.loadH264(3)];case 1:return!(r=t.sent())&&RTCRtpSender&&RTCRtpSender.getCapabilities&&(n=JSON.stringify((s=RTCRtpSender.getCapabilities("video"))===null||s===void 0?void 0:s.codecs),r=n.toLowerCase().includes("video/h264")),[2,!!r]}})})},e.prototype.createBlankStream=function(){var r,n,s,t=(r=new AudioContext,n=r.createOscillator(),s=n.connect(r.createMediaStreamDestination()),n.start(),Object.assign(s.stream.getAudioTracks()[0],{enabled:!1}));t.stop();var i=function(l){var E,b={},_=b.width,h=_===void 0?160:_,o=b.height,g=o===void 0?90:o,m=document.createElement("canvas");m.width=h,m.height=g,(E=m.getContext("2d"))===null||E===void 0||E.fillRect(0,0,h,g);var T=m.captureStream();return Object.assign(T.getVideoTracks()[0],{enabled:!1})}();return i.stop(),new MediaStream([t,i])},e}();R.SupportUtil=p},2718:function(L,R){var x=this&&this.__spreadArray||function(v,c,u){if(u||arguments.length===2)for(var S,f=0,a=c.length;f<a;f++)!S&&f in c||(S||(S=Array.prototype.slice.call(c,0,f)),S[f]=c[f]);return v.concat(S||Array.prototype.slice.call(c))};Object.defineProperty(R,"__esModule",{value:!0}),R.hebtLog=R.createUUID=R.evaluateNetworkCondition=R.makeCancelable=R.hasVideoTrack=R.hasAudioTrack=R.getVideoTrack=R.getAudioTrack=R.pruneSubUrl=R.getJitterBufferDelayAvg=void 0,R.getJitterBufferDelayAvg=function(v,c){return v&&c?Number(v)/Number(c)*1e3:-1},R.pruneSubUrl=function(v,c){var u=v||"";return u=u.replace("@subaudio=no","").replace("@subvideo=no",""),c&&(u=u.split("?")[0]),u},R.getAudioTrack=function(v){return v.getAudioTracks()[0]},R.getVideoTrack=function(v){return v.getVideoTracks()[0]},R.hasAudioTrack=function(v){return v.getAudioTracks().length>0},R.hasVideoTrack=function(v){return v.getVideoTracks().length>0},R.makeCancelable=function(v){var c=!1;return{promise:new Promise(function(u,S){v.then(function(f){return c?S({isCanceled:!0}):u(f)}),v.catch(function(f){return S(c?{isCanceled:!0}:f)})}),cancel:function(){c=!0}}},R.evaluateNetworkCondition=function(v,c,u,S,f){var a=0;if(!navigator.onLine)return a=6;var d=[{loss:0,rtt:0,jbd:1},{loss:0,rtt:1,jbd:0},{loss:0,rtt:.5,jbd:.5},{loss:1,rtt:0,jbd:0},{loss:.8,rtt:0,jbd:.2},{loss:.8,rtt:.2,jbd:0},{loss:.6,rtt:.2,jbd:.2}],p=-1,e=-1,r=-1;if(typeof c=="number"&&c>=0||typeof u=="number"&&u>=0){p=0;var n=!1,s=!1;typeof c=="number"&&c>=0&&(p+=c,n=!0),typeof u=="number"&&u>=0&&(p+=u,s=!0),n&&!s&&(p*=2),s&&!n&&(p*=1.8)}typeof v=="number"&&v>=0&&(r=v),(typeof S=="number"&&S>=0||typeof f=="number"&&f>=0)&&(e=0,typeof S=="number"&&S>=0&&(e+=S),typeof f=="number"&&f>=0&&(e+=f));var t;if((t=4*(p!==-1?1:0)+2*(r!==-1?1:0)+(e!==-1?1:0))>0){var i=1.2*p*d[t-1].loss+r/1500*d[t-1].rtt+e/3e3*d[t-1].jbd;a=i<=.1?1:i<=.23?2:i<=.36?3:i<=.49?4:5}else a=0;return a},R.createUUID=function(v,c){var u,S="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),f=[];if(c=c||S.length,v)for(u=0;u<v;u++)f[u]=S[0|Math.random()*c];else{var a=void 0;for(f[8]=f[13]=f[18]=f[23]="-",f[14]="4",u=0;u<36;u++)f[u]||(a=0|16*Math.random(),f[u]=S[u==19?3&a|8:a])}return f.join("")},R.hebtLog=function(){for(var v=[],c=0;c<arguments.length;c++)v[c]=arguments[c];window.RTS_HEBT_DEBUG&&console.log.apply(console,x(["[rts hebt]"],v,!1))}},233:L=>{/*! useragent-util - ver 1.3.1 created:9/4/2024, 4:31:28 PM */L.exports=(()=>{var R={622:(u,S,f)=>{Object.defineProperty(S,"__esModule",{value:!0}),S.BrowserUtil=S.BrowserType=void 0;var a,d=f(101);(function(e){e.IE="IE",e.Chrome="Chrome",e.Safari="Safari",e.Firefox="Firefox",e.Opera="Opera",e.Edge="Edge",e.MicroMessenger="MicroMessenger",e.X5Core="X5Core",e.Quark="Quark",e.QQ="QQ",e.QQBrowser="QQBrowser",e.DingTalk="DingTalk",e.Electron="Electron",e.Sogou="Sogou",e.Vivo="VivoBrowser",e.Oppo="OppoBrowser",e.UC="UCBrowser",e.MI="MiBrowser",e.Lenovo="SLBrowser",e.Maxthon="Maxthon",e.Liebao="Liebao",e.Huawei="Huawei",e.Meizu="MZBrowser",e.Finger="FingerBrowser",e.Samsung="SamsungBrowser",e.WebVeiw="WebVeiw",e.Unknown="unknown"})(a=S.BrowserType||(S.BrowserType={}));var p=function(){function e(){}return Object.defineProperty(e,"isBrowser",{get:function(){return typeof document<"u"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"domain",{get:function(){return window.location.protocol+window.location.host},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isHttps",{get:function(){return this.isBrowser&&document.location&&(document.location.protocol=="https:"||document.location.host.indexOf("127.0.0.1:")===0||document.location.host.indexOf("localhost:")===0)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSupportScreenShare",{get:function(){return!!(navigator&&navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isChrome",{get:function(){return e._getBrowserInfo(),a.Chrome===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSafari",{get:function(){return e._getBrowserInfo(),a.Safari===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isIE",{get:function(){return e._getBrowserInfo(),a.IE===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isFirefox",{get:function(){return e._getBrowserInfo(),a.Firefox===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isEdge",{get:function(){return e._getBrowserInfo(),a.Edge===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSogou",{get:function(){return e._getBrowserInfo(),a.Sogou===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isVivoBroswer",{get:function(){return e._getBrowserInfo(),a.Vivo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isOppoBrowser",{get:function(){return e._getBrowserInfo(),a.Oppo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMiBrowser",{get:function(){return e._getBrowserInfo(),a.MI===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isLenovoBrowser",{get:function(){return e._getBrowserInfo(),a.Lenovo===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMaxthonBrowser",{get:function(){return e._getBrowserInfo(),a.Maxthon===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isLiebaoBrowser",{get:function(){return e._getBrowserInfo(),a.Liebao===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isHuaweiBrowser",{get:function(){return e._getBrowserInfo(),a.Huawei===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMZBrowser",{get:function(){return e._getBrowserInfo(),a.Meizu===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isSamsungBrowser",{get:function(){return e._getBrowserInfo(),a.Samsung===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isOpera",{get:function(){return e._getBrowserInfo(),a.Opera===e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isMicroMessenger",{get:function(){return e._getBrowserInfo(),e._browserName===a.MicroMessenger},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQQ",{get:function(){return e._getBrowserInfo(),a.QQ===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQQBrowser",{get:function(){return e._getBrowserInfo(),a.QQBrowser===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isX5Core",{get:function(){return e._getBrowserInfo(),e._browserName===a.X5Core},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isUCBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===a.UC},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isQuarkBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===a.Quark},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isFingerBrowser",{get:function(){return e._getBrowserInfo(),e._browserName===a.Finger},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isChromeCore",{get:function(){return e._getBrowserInfo(),e._core==="Chrome"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isWebView",{get:function(){return e._getBrowserInfo(),e._browserName===a.WebVeiw},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isDingTalk",{get:function(){return e._getBrowserInfo(),e._browserName===a.DingTalk},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isUnknown",{get:function(){return e._getBrowserInfo(),a.Unknown===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserName",{get:function(){return e._getBrowserInfo(),e._browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserVersion",{get:function(){return e._getBrowserInfo(),e._browserVersion},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserMainVersion",{get:function(){return e._getBrowserInfo(),e._browserVersion?parseInt(e._browserVersion.split(".")[0],10):0},enumerable:!1,configurable:!0}),Object.defineProperty(e,"browserCoreVersion",{get:function(){return navigator.userAgent.toLowerCase(),d.SystemUtil.isIos||d.SystemUtil.isMacOS,e.browserMainVersion},enumerable:!1,configurable:!0}),Object.defineProperty(e,"isElectron",{get:function(){return e._getBrowserInfo(),a.Electron===e.browserName},enumerable:!1,configurable:!0}),Object.defineProperty(e,"userAgent",{get:function(){var r=navigator.userAgent.toLowerCase(),n=r.indexOf("gecko");if(n>-1){n=r.indexOf(" ",n);var s=(r=r.substring(n+1,r.length)).split(" ");r="";for(var t=0;t<s.length;++t){var i=s[t].split("/");i&&i.length&&(r+=i[0]+" ")}}return r},enumerable:!1,configurable:!0}),e.compareVersion=function(r){if(e._getBrowserInfo(),e._browserVersion){for(var n=e._browserVersion.split("."),s=r.split("."),t=0,i=0,l=0;l<n.length&&l<s.length;++l){if((t=isNaN(parseInt(n[l],10))?0:parseInt(n[l],10))<(i=isNaN(parseInt(s[l],10))?0:parseInt(s[l],10)))return!1;if(t>i)return!0}return!0}return!0},e._getBrowserInfo=function(){if(!e._browserName||!e._browserVersion)if(navigator&&navigator.userAgent){var r=navigator.userAgent.toLowerCase(),n=void 0;(n=r.match(/edg[e|a]?\/([\d.]+)/))||(n=r.match(/edgios\/([\d.]+)/))?e._updateBrowserInfo(a.Edge,r,n[1]):(n=r.match(/rv:([\d.]+)\) like gecko/))||(n=r.match(/msie ([\d.]+)/))?e._updateBrowserInfo(a.IE,r,n[1]):(n=r.match(/vivobrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Vivo,r,n[1]):(n=r.match(/miuibrowser\/([\d.]+)/))?e._updateBrowserInfo(a.MI,r,n[1]):(n=r.match(/samsungbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Samsung,r,n[1]):(n=r.match(/heytapbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Oppo,r,n[1]):(n=r.match(/mzbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Meizu,r,n[1]):(n=r.match(/ucbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.UC,r,n[1]):(n=r.match(/quark\/([\d.]+)/))?e._updateBrowserInfo(a.Quark,r,n[1]):(n=r.match(/slbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Lenovo,r,n[1]):(n=r.match(/lbbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Liebao,r,n[1]):(n=r.match(/fingerbrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Finger,r,n[1]):(n=r.match(/huaweibrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Huawei,r,n[1]):(n=r.match(/maxthon\/([\d.]+)/))?e._updateBrowserInfo(a.Maxthon,r,n[1]):(n=r.match(/firefox\/([\d.]+)/))?e._updateBrowserInfo(a.Firefox,r,n[1]):(n=r.match(/electron\/([\d.]+)/))?e._updateBrowserInfo(a.Electron,r,n[1]):(n=r.match(/chrome\/([\d.]+)/))&&this._isChrome(r)||(n=r.match(/crios\/([\d.]+)/))&&this._isChrome(r)?e._updateBrowserInfo(a.Chrome,r,n[1]):(n=r.match(/metasr\s([\d.]+)/))||(n=r.match(/sogoumobilebrowser\/([\d.]+)/))?e._updateBrowserInfo(a.Sogou,r,n[1]):(n=r.match(/opr.([\d.]+)/))?e._updateBrowserInfo(a.Opera,r,n[1]):(n=r.match(/micromessenger.([\d.]+)/))?e._updateBrowserInfo(a.MicroMessenger,r,n[1]):(n=r.match(/qq\/([\d.]+)/))?e._updateBrowserInfo(a.QQ,r,n[1]):(n=r.match(/m?qqbrowser\/([\d.]+)/))||(n=r.match(/qqbrowserlite\/([\d.]+)/))?e._updateBrowserInfo(a.QQBrowser,r,n[1]):(n=r.match(/dingtalk.([\d.]+)/))?e._updateBrowserInfo(a.DingTalk,r,n[1]):(n=r.match(/tbs\/([\d.]+)/))?e._updateBrowserInfo(a.X5Core,r,n[1]):(n=r.match(/version\/([\d.]+).*safari/))&&this._isSafari(r)&&e._updateBrowserInfo(a.Safari,r,n[1]),e._browserName===a.Unknown&&e._isWebview(r)&&e._updateBrowserInfo(a.WebVeiw,r,"")}else e._browserName=a.Unknown,e._browserVersion="0.0"},e._isChrome=function(r){var n=r.split(/\(|\)/);if(e._core="Chrome",n.length===5){var s=n[4].trim().split(" ");if(s.length===2){if(s[0].indexOf("chrome")>-1&&s[1].indexOf("safari")>-1)return!0}else if(s.length===3){if(s[1].indexOf("mobile")>-1&&s[2].indexOf("safari")>-1&&(s[0].indexOf("chrome")>-1||s[0].indexOf("crios")>-1))return!0}else if(r.indexOf("qianniu")>-1)return!0}return!1},e._isSafari=function(r){var n=r.split(/\(|\)/);if(n.length===5){var s=n[4].trim().split(" ");if(s.length===2){if(s[0].indexOf("version")>-1&&s[1].indexOf("safari")>-1)return!0}else if(s.length===3&&s[0].indexOf("version")>-1&&s[1].indexOf("mobile")>-1&&s[2].indexOf("safari")>-1)return!0}return!1},e._isWebview=function(r){if(r){var n=new RegExp("("+["WebView","(iPhone|iPod|iPad)(?!.*Safari)","Android.*(wv|.0.0.0)","Linux; U; Android"].join("|")+")","ig"),s=new RegExp("("+["VivoBrowser","MZBrowser","MiuiBrowser"].join("|")+")","ig");return!!r.match(n)&&!r.match(s)}},e._updateBrowserInfo=function(r,n,s){e._browserName=r;var t=null;switch(r){case a.QQBrowser:d.SystemUtil.isIos||d.SystemUtil.isMacOS?(t=n.match(/version\/([\d.]+).*safari/),e._browserVersion=t?t[1]:"0.0"):(t=n.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0");break;case a.Vivo:case a.Oppo:case a.Meizu:case a.Huawei:case a.Sogou:case a.Samsung:t=n.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0";break;case a.WebVeiw:d.SystemUtil.isAndroid?(t=n.match(/chrome\/([\d.]+)/),e._browserVersion=t?t[1]:"0.0"):d.SystemUtil.isIos&&(e._browserVersion=d.SystemUtil.systemVersion);break;default:e._browserVersion=s}},e._browserName=a.Unknown,e._browserVersion="",e._core="",e}();S.BrowserUtil=p},864:(u,S)=>{Object.defineProperty(S,"__esModule",{value:!0}),S.Guid=void 0;var f=function(){function a(){}return a.create=function(d,p){p===void 0&&(p=16);var e,r,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),s=[];if(p=p||n.length,d)for(e=0;e<d;e++)s[e]=n[0|Math.random()*p];else for(s[8]=s[13]=s[18]=s[23]="-",s[14]="4",e=0;e<36;e++)s[e]||(r=0|16*Math.random(),s[e]=n[e==19?3&r|8:r]);return s.join("")},a}();S.Guid=f},442:(u,S,f)=>{Object.defineProperty(S,"__esModule",{value:!0}),S.LocalStorage=void 0;var a=f(864),d=function(){function p(){}return Object.defineProperty(p,"uuid",{get:function(){var e="alirtc_uuid",r=p.get(e);return r||(r=a.Guid.create(32),p.set(e,r)),r},enumerable:!1,configurable:!0}),p.get=function(e){var r="";return window&&window.localStorage&&(r=window.localStorage.getItem(e)||""),r},p.set=function(e,r){e&&window&&window.localStorage&&window.localStorage.setItem(e,r)},p}();S.LocalStorage=d},72:(u,S)=>{Object.defineProperty(S,"__esModule",{value:!0}),S.ApiRequest=void 0;var f=function(){function a(){}return a.postBody=function(d,p,e){d=a._getUrl(d,p);var r,n={};return n.headers||(n.headers={}),n.headers.Accept="application/json",n.headers["Content-Type"]="application/json",new Promise(function(s,t){a.requestBody("POST",d,e).then(function(i){return r=i,i.ok?i.json():i.text()}).then(function(i){r.ok?i.code?(i=a._intercept(i),t(i)):s(i.data):t(a._httpErrorMessage(r,i))}).catch(function(i){i=a._httpErrorMessage(i),t(i)})})},a.get=function(d,p,e){var r;return e===void 0&&(e={}),d=a._getUrl(d,p),e.headers||(e.headers={}),e.headers["Content-Type"]="application/json",new Promise(function(n,s){a.request("GET",d,e).then(function(t){return r=t,t.ok?t.json():t.text()}).then(function(t){r.ok?t.code?(t=a._intercept(t),s(t)):n(t.data):s(a._httpErrorMessage(r,t))}).catch(function(t){t=a._httpErrorMessage(t),s(t)})})},a.post=function(d,p,e,r){var n;return r===void 0&&(r={}),d=a._getUrl(d,p),r.headers||(r.headers={}),r.body=e,r.headers.Accept="application/json",r.headers["Content-Type"]="application/json",new Promise(function(s,t){a.request("POST",d,r).then(function(i){return n=i,i.ok?i.json():i.text()}).then(function(i){n.ok?i.code?(i=a._intercept(i),t(i)):s(i.data):t(a._httpErrorMessage(n,i))}).catch(function(i){i=a._httpErrorMessage(i),t(i)})})},a.request=function(d,p,e){d===void 0&&(d="GET");var r=new Headers(e.headers),n=new Request(p,{method:d,headers:r});return fetch(n)},a.requestBody=function(d,p,e){return d===void 0&&(d="GET"),fetch(p,{method:d,body:e,headers:new Headers({"Content-Type":"application/json"})})},a.ajaxPost=function(d,p,e,r){return r===void 0&&(r={}),d=a._getUrl(d,p),r.headers||(r.headers={}),r.headers.Accept="application/json",r.headers["Content-Type"]="application/json",a.ajax("POST",d,e,r)},a.ajax=function(d,p,e,r){d===void 0&&(d="GET"),r===void 0&&(r={});var n=new XMLHttpRequest;return new Promise(function(s,t){n.onreadystatechange=function(){if(n.readyState===4)if(n.status===200){var l=JSON.parse(n.responseText);l.code?(l=a._intercept(l),t(l)):s(l)}else t({message:n.responseText||"\u8BF7\u6C42\u5931\u8D25:"+p})},n.open(d,p,!0);try{if(r.withCredentials&&(n.withCredentials=!0),r.headers)for(var i in r.headers)n.setRequestHeader(i,r.headers[i])}catch(l){return void t(l)}try{n.send(e)}catch(l){t(l)}})},a._getUrl=function(d,p){var e=[];if(p)for(var r in p)e.push(r+"="+p[r]);var n=e.join("&");return(d.indexOf("?")!=-1?d:d+"?")+n},a._httpErrorMessage=function(d,p){return d.message||(d.message="HTTP "+d.status+"("+d.statusText+") : "+p),d},a._intercept=function(d){var p=d.data;return d.code&&((p=p||{}).data=d.data,p.code=d.code,p.description=d.description,p.message="0x"+Number(d.code).toString(16)+", "+d.description,p.tid&&(p.message+=", tid="+p.tid)),p},a}();S.ApiRequest=f},101:(u,S)=>{var f,a;Object.defineProperty(S,"__esModule",{value:!0}),S.SystemUtil=S.WindowsType=S.SystemType=void 0,function(p){p.Unknown="Unknown",p.MacOS="Mac",p.Windows="Windows",p.Android="Android",p.Iphone="iphone",p.Ipad="ipad",p.iOS="iOS",p.Linux="Linux",p.ChromeOS="ChromeOS"}(f=S.SystemType||(S.SystemType={})),function(p){p.Windows10="Windows 10",p.Windows7="Windows 7",p.WindowsVista="Windows vista",p.WindowsXP="Windows xp"}(a=S.WindowsType||(S.WindowsType={}));var d=function(){function p(){}return Object.defineProperty(p,"isMacOS",{get:function(){return f.MacOS===p.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(p,"isWindows",{get:function(){return p.systemName.indexOf(f.Windows)>-1},enumerable:!1,configurable:!0}),Object.defineProperty(p,"isIos",{get:function(){return f.Iphone===p.systemName||f.Ipad===p.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(p,"isAndroid",{get:function(){return f.Android===p.systemName},enumerable:!1,configurable:!0}),Object.defineProperty(p,"isLinux",{get:function(){return f.Linux===p.systemName||f.Linux===p._platform},enumerable:!1,configurable:!0}),Object.defineProperty(p,"systemName",{get:function(){return p._getSystemInfo(),p._systemName},enumerable:!1,configurable:!0}),Object.defineProperty(p,"systemVersion",{get:function(){return p._getSystemInfo(),p._systemVersion},enumerable:!1,configurable:!0}),Object.defineProperty(p,"platform",{get:function(){return p._getSystemInfo(),p._platform},enumerable:!1,configurable:!0}),Object.defineProperty(p,"isUnknown",{get:function(){return!p.platform||p.platform===f.Unknown},enumerable:!1,configurable:!0}),p.compareVersion=function(e){if(p._getSystemInfo(),p._systemVersion){for(var r=p._systemVersion.split("."),n=e.split("."),s=0,t=0,i=0;i<r.length&&i<n.length;++i){if((s=isNaN(parseInt(r[i],10))?0:parseInt(r[i],10))<(t=isNaN(parseInt(n[i],10))?0:parseInt(n[i],10)))return!1;if(s>t)return!0}return!0}return!0},p._getSystemInfo=function(){if(!p._systemName||!p._systemVersion||!p._platform)if(navigator&&navigator.userAgent){var e=navigator.userAgent.toLowerCase();e.indexOf("ipad")>-1?(p._systemName=f.Ipad,p._platform=f.iOS,p._systemVersion=p._getIosSystemVersion(e)):e.indexOf("iphone")>-1?(p._systemName=f.Iphone,p._platform=f.iOS,p._systemVersion=p._getIosSystemVersion(e)):e.indexOf("android")>-1?(p._platform=f.Android,p._systemName=f.Android,p._systemVersion=p._getAndroidSystemVersion(e)):e.indexOf("win")>-1?e.indexOf("windwos nt 10")>-1||e.indexOf("windows 10")?(p._systemName=a.Windows10,p._platform=f.Windows,p._systemVersion="10"):e.indexOf("windows nt 6.1")>-1||e.indexOf("windows 7")>-1?(p._systemName=a.Windows7,p._platform=f.Windows,p._systemVersion="7"):e.indexOf("windows nt 6.0")>-1||e.indexOf("windows vista")>-1?(p._systemName=a.WindowsVista,p._platform=f.Windows,p._systemVersion="vista"):e.indexOf("widows nt 5.1")>-1||e.indexOf("windows xp")>-1?(p._systemName=a.WindowsXP,p._platform=f.Windows,p._systemVersion="xp"):(p._platform=f.Windows,p._systemName=f.Windows,p._systemVersion="0.0"):e.indexOf("mac")>-1?navigator&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0?(p._systemName=f.Ipad,p._platform=f.iOS,p._systemVersion=p._getIosSystemVersion(e)):(p._platform=f.MacOS,p._systemName=f.MacOS,p._systemVersion=p._getMacSystemVersion(e)):e.indexOf("linux")>-1?(p._platform=f.Linux,p._systemName=f.Linux,p._systemVersion="0.0"):e.indexOf("cros")>-1?(p._platform=f.Linux,p._systemName=f.ChromeOS,p._systemVersion="0.0"):(p._systemName=f.Unknown,p._platform=f.Windows,p._systemVersion="0.0")}else p._systemName=f.Unknown,p._platform=f.Unknown,p._systemVersion="0.0"},p._getIosSystemVersion=function(e){return(e.match(/OS [\d._]*/gi)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,".")},p._getMacSystemVersion=function(e){return(e.match(/OS X [\d._]*/gi)+"").replace(/[^0-9|_.]/gi,"").replace(/_/gi,".")},p._getAndroidSystemVersion=function(e){return e.substr(e.indexOf("android")+8,e.indexOf(";",e.indexOf("android"))-e.indexOf("android")-8)},p._systemName="",p._systemVersion="",p._platform=f.Unknown,p}();S.SystemUtil=d}},x={};function v(u){if(x[u])return x[u].exports;var S=x[u]={exports:{}};return R[u](S,S.exports,v),S.exports}var c={};return(()=>{var u=c;Object.defineProperty(u,"__esModule",{value:!0}),u.ApiRequest=u.LocalStorage=u.Guid=u.BrowserUtil=u.SystemUtil=void 0;var S=v(101);Object.defineProperty(u,"SystemUtil",{enumerable:!0,get:function(){return S.SystemUtil}});var f=v(622);Object.defineProperty(u,"BrowserUtil",{enumerable:!0,get:function(){return f.BrowserUtil}});var a=v(864);Object.defineProperty(u,"Guid",{enumerable:!0,get:function(){return a.Guid}});var d=v(442);Object.defineProperty(u,"LocalStorage",{enumerable:!0,get:function(){return d.LocalStorage}});var p=v(72);Object.defineProperty(u,"ApiRequest",{enumerable:!0,get:function(){return p.ApiRequest}}),window&&(window.SystemUtil=S.SystemUtil,window.BrowserUtil=f.BrowserUtil,window.Guid=a.Guid,window.LocalStorage=d.LocalStorage,window.ApiRequest=p.ApiRequest)})(),c})()},9543:(L,R,x)=>{x.r(R),x.d(R,{default:()=>xe});var v={};x.r(v),x.d(v,{fixNegotiationNeeded:()=>j,shimAddTrackRemoveTrack:()=>A,shimAddTrackRemoveTrackWithNative:()=>y,shimGetDisplayMedia:()=>o,shimGetSendersWithDtmf:()=>T,shimGetStats:()=>C,shimGetUserMedia:()=>h,shimMediaStream:()=>g,shimOnTrack:()=>m,shimPeerConnection:()=>w,shimSenderReceiverGetStats:()=>D});var c={};x.r(c),x.d(c,{shimGetDisplayMedia:()=>U,shimGetUserMedia:()=>F,shimPeerConnection:()=>B,shimReplaceTrack:()=>k});var u={};x.r(u),x.d(u,{shimAddTransceiver:()=>se,shimCreateAnswer:()=>de,shimCreateOffer:()=>ue,shimGetDisplayMedia:()=>G,shimGetParameters:()=>ce,shimGetUserMedia:()=>V,shimOnTrack:()=>q,shimPeerConnection:()=>z,shimRTCDataChannel:()=>ie,shimReceiverGetStats:()=>re,shimRemoveStream:()=>ee,shimSenderGetStats:()=>$});var S={};x.r(S),x.d(S,{shimAudioContext:()=>Te,shimCallbacksAPI:()=>he,shimConstraints:()=>me,shimCreateOfferLegacy:()=>Re,shimGetUserMedia:()=>fe,shimLocalStreamsAPI:()=>pe,shimRTCIceServerUrls:()=>ge,shimRemoteStreamsAPI:()=>Ee,shimTrackEventTransceiver:()=>_e});var f={};x.r(f),x.d(f,{removeExtmapAllowMixed:()=>Oe,shimAddIceCandidateNullOrEmpty:()=>He,shimConnectionState:()=>Pe,shimMaxMessageSize:()=>Ce,shimRTCIceCandidate:()=>we,shimSendThrowTypeError:()=>Ae});let a=!0,d=!0;function p(O,K,Y){const X=O.match(K);return X&&X.length>=Y&&parseInt(X[Y],10)}function e(O,K,Y){if(!O.RTCPeerConnection)return;const X=O.RTCPeerConnection.prototype,Z=X.addEventListener;X.addEventListener=function(Q,oe){if(Q!==K)return Z.apply(this,arguments);const ne=ae=>{const le=Y(ae);le&&(oe.handleEvent?oe.handleEvent(le):oe(le))};return this._eventMap=this._eventMap||{},this._eventMap[K]||(this._eventMap[K]=new Map),this._eventMap[K].set(oe,ne),Z.apply(this,[Q,ne])};const te=X.removeEventListener;X.removeEventListener=function(Q,oe){if(Q!==K||!this._eventMap||!this._eventMap[K])return te.apply(this,arguments);if(!this._eventMap[K].has(oe))return te.apply(this,arguments);const ne=this._eventMap[K].get(oe);return this._eventMap[K].delete(oe),this._eventMap[K].size===0&&delete this._eventMap[K],Object.keys(this._eventMap).length===0&&delete this._eventMap,te.apply(this,[Q,ne])},Object.defineProperty(X,"on"+K,{get(){return this["_on"+K]},set(Q){this["_on"+K]&&(this.removeEventListener(K,this["_on"+K]),delete this["_on"+K]),Q&&this.addEventListener(K,this["_on"+K]=Q)},enumerable:!0,configurable:!0})}function r(O){return typeof O!="boolean"?new Error("Argument type: "+typeof O+". Please use a boolean."):(a=O,O?"adapter.js logging disabled":"adapter.js logging enabled")}function n(O){return typeof O!="boolean"?new Error("Argument type: "+typeof O+". Please use a boolean."):(d=!O,"adapter.js deprecation warnings "+(O?"disabled":"enabled"))}function s(){if(typeof window=="object"){if(a)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function t(O,K){d&&console.warn(O+" is deprecated, please use "+K+" instead.")}function i(O){return Object.prototype.toString.call(O)==="[object Object]"}function l(O){return i(O)?Object.keys(O).reduce(function(K,Y){const X=i(O[Y]),Z=X?l(O[Y]):O[Y],te=X&&!Object.keys(Z).length;return Z===void 0||te?K:Object.assign(K,{[Y]:Z})},{}):O}function E(O,K,Y){K&&!Y.has(K.id)&&(Y.set(K.id,K),Object.keys(K).forEach(X=>{X.endsWith("Id")?E(O,O.get(K[X]),Y):X.endsWith("Ids")&&K[X].forEach(Z=>{E(O,O.get(Z),Y)})}))}function b(O,K,Y){const X=Y?"outbound-rtp":"inbound-rtp",Z=new Map;if(K===null)return Z;const te=[];return O.forEach(Q=>{Q.type==="track"&&Q.trackIdentifier===K.id&&te.push(Q)}),te.forEach(Q=>{O.forEach(oe=>{oe.type===X&&oe.trackId===Q.id&&E(O,oe,Z)})}),Z}const _=s;function h(O,K){const Y=O&&O.navigator;if(!Y.mediaDevices)return;const X=function(Q){if(typeof Q!="object"||Q.mandatory||Q.optional)return Q;const oe={};return Object.keys(Q).forEach(ne=>{if(ne==="require"||ne==="advanced"||ne==="mediaSource")return;const ae=typeof Q[ne]=="object"?Q[ne]:{ideal:Q[ne]};ae.exact!==void 0&&typeof ae.exact=="number"&&(ae.min=ae.max=ae.exact);const le=function(ve,be){return ve?ve+be.charAt(0).toUpperCase()+be.slice(1):be==="deviceId"?"sourceId":be};if(ae.ideal!==void 0){oe.optional=oe.optional||[];let ve={};typeof ae.ideal=="number"?(ve[le("min",ne)]=ae.ideal,oe.optional.push(ve),ve={},ve[le("max",ne)]=ae.ideal,oe.optional.push(ve)):(ve[le("",ne)]=ae.ideal,oe.optional.push(ve))}ae.exact!==void 0&&typeof ae.exact!="number"?(oe.mandatory=oe.mandatory||{},oe.mandatory[le("",ne)]=ae.exact):["min","max"].forEach(ve=>{ae[ve]!==void 0&&(oe.mandatory=oe.mandatory||{},oe.mandatory[le(ve,ne)]=ae[ve])})}),Q.advanced&&(oe.optional=(oe.optional||[]).concat(Q.advanced)),oe},Z=function(Q,oe){if(K.version>=61)return oe(Q);if((Q=JSON.parse(JSON.stringify(Q)))&&typeof Q.audio=="object"){const ne=function(ae,le,ve){le in ae&&!(ve in ae)&&(ae[ve]=ae[le],delete ae[le])};ne((Q=JSON.parse(JSON.stringify(Q))).audio,"autoGainControl","googAutoGainControl"),ne(Q.audio,"noiseSuppression","googNoiseSuppression"),Q.audio=X(Q.audio)}if(Q&&typeof Q.video=="object"){let ne=Q.video.facingMode;ne=ne&&(typeof ne=="object"?ne:{ideal:ne});const ae=K.version<66;if(ne&&(ne.exact==="user"||ne.exact==="environment"||ne.ideal==="user"||ne.ideal==="environment")&&(!Y.mediaDevices.getSupportedConstraints||!Y.mediaDevices.getSupportedConstraints().facingMode||ae)){let le;if(delete Q.video.facingMode,ne.exact==="environment"||ne.ideal==="environment"?le=["back","rear"]:ne.exact!=="user"&&ne.ideal!=="user"||(le=["front"]),le)return Y.mediaDevices.enumerateDevices().then(ve=>{let be=(ve=ve.filter(je=>je.kind==="videoinput")).find(je=>le.some(Le=>je.label.toLowerCase().includes(Le)));return!be&&ve.length&&le.includes("back")&&(be=ve[ve.length-1]),be&&(Q.video.deviceId=ne.exact?{exact:be.deviceId}:{ideal:be.deviceId}),Q.video=X(Q.video),_("chrome: "+JSON.stringify(Q)),oe(Q)})}Q.video=X(Q.video)}return _("chrome: "+JSON.stringify(Q)),oe(Q)},te=function(Q){return K.version>=64?Q:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[Q.name]||Q.name,message:Q.message,constraint:Q.constraint||Q.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(Y.getUserMedia=function(Q,oe,ne){Z(Q,ae=>{Y.webkitGetUserMedia(ae,oe,le=>{ne&&ne(te(le))})})}.bind(Y),Y.mediaDevices.getUserMedia){const Q=Y.mediaDevices.getUserMedia.bind(Y.mediaDevices);Y.mediaDevices.getUserMedia=function(oe){return Z(oe,ne=>Q(ne).then(ae=>{if(ne.audio&&!ae.getAudioTracks().length||ne.video&&!ae.getVideoTracks().length)throw ae.getTracks().forEach(le=>{le.stop()}),new DOMException("","NotFoundError");return ae},ae=>Promise.reject(te(ae))))}}}function o(O,K){O.navigator.mediaDevices&&"getDisplayMedia"in O.navigator.mediaDevices||O.navigator.mediaDevices&&(typeof K=="function"?O.navigator.mediaDevices.getDisplayMedia=function(Y){return K(Y).then(X=>{const Z=Y.video&&Y.video.width,te=Y.video&&Y.video.height,Q=Y.video&&Y.video.frameRate;return Y.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:X,maxFrameRate:Q||3}},Z&&(Y.video.mandatory.maxWidth=Z),te&&(Y.video.mandatory.maxHeight=te),O.navigator.mediaDevices.getUserMedia(Y)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}function g(O){O.MediaStream=O.MediaStream||O.webkitMediaStream}function m(O){if(typeof O=="object"&&O.RTCPeerConnection&&!("ontrack"in O.RTCPeerConnection.prototype)){Object.defineProperty(O.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(Y){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=Y)},enumerable:!0,configurable:!0});const K=O.RTCPeerConnection.prototype.setRemoteDescription;O.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=Y=>{Y.stream.addEventListener("addtrack",X=>{let Z;Z=O.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(Q=>Q.track&&Q.track.id===X.track.id):{track:X.track};const te=new Event("track");te.track=X.track,te.receiver=Z,te.transceiver={receiver:Z},te.streams=[Y.stream],this.dispatchEvent(te)}),Y.stream.getTracks().forEach(X=>{let Z;Z=O.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(Q=>Q.track&&Q.track.id===X.id):{track:X};const te=new Event("track");te.track=X,te.receiver=Z,te.transceiver={receiver:Z},te.streams=[Y.stream],this.dispatchEvent(te)})},this.addEventListener("addstream",this._ontrackpoly)),K.apply(this,arguments)}}else e(O,"track",K=>(K.transceiver||Object.defineProperty(K,"transceiver",{value:{receiver:K.receiver}}),K))}function T(O){if(typeof O=="object"&&O.RTCPeerConnection&&!("getSenders"in O.RTCPeerConnection.prototype)&&"createDTMFSender"in O.RTCPeerConnection.prototype){const K=function(Z,te){return{track:te,get dtmf(){return this._dtmf===void 0&&(te.kind==="audio"?this._dtmf=Z.createDTMFSender(te):this._dtmf=null),this._dtmf},_pc:Z}};if(!O.RTCPeerConnection.prototype.getSenders){O.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const Z=O.RTCPeerConnection.prototype.addTrack;O.RTCPeerConnection.prototype.addTrack=function(Q,oe){let ne=Z.apply(this,arguments);return ne||(ne=K(this,Q),this._senders.push(ne)),ne};const te=O.RTCPeerConnection.prototype.removeTrack;O.RTCPeerConnection.prototype.removeTrack=function(Q){te.apply(this,arguments);const oe=this._senders.indexOf(Q);oe!==-1&&this._senders.splice(oe,1)}}const Y=O.RTCPeerConnection.prototype.addStream;O.RTCPeerConnection.prototype.addStream=function(Z){this._senders=this._senders||[],Y.apply(this,[Z]),Z.getTracks().forEach(te=>{this._senders.push(K(this,te))})};const X=O.RTCPeerConnection.prototype.removeStream;O.RTCPeerConnection.prototype.removeStream=function(Z){this._senders=this._senders||[],X.apply(this,[Z]),Z.getTracks().forEach(te=>{const Q=this._senders.find(oe=>oe.track===te);Q&&this._senders.splice(this._senders.indexOf(Q),1)})}}else if(typeof O=="object"&&O.RTCPeerConnection&&"getSenders"in O.RTCPeerConnection.prototype&&"createDTMFSender"in O.RTCPeerConnection.prototype&&O.RTCRtpSender&&!("dtmf"in O.RTCRtpSender.prototype)){const K=O.RTCPeerConnection.prototype.getSenders;O.RTCPeerConnection.prototype.getSenders=function(){const Y=K.apply(this,[]);return Y.forEach(X=>X._pc=this),Y},Object.defineProperty(O.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function C(O){if(!O.RTCPeerConnection)return;const K=O.RTCPeerConnection.prototype.getStats;O.RTCPeerConnection.prototype.getStats=function(){const[Y,X,Z]=arguments;if(arguments.length>0&&typeof Y=="function")return K.apply(this,arguments);if(K.length===0&&(arguments.length===0||typeof Y!="function"))return K.apply(this,[]);const te=function(oe){const ne={};return oe.result().forEach(ae=>{const le={id:ae.id,timestamp:ae.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[ae.type]||ae.type};ae.names().forEach(ve=>{le[ve]=ae.stat(ve)}),ne[le.id]=le}),ne},Q=function(oe){return new Map(Object.keys(oe).map(ne=>[ne,oe[ne]]))};if(arguments.length>=2){const oe=function(ne){X(Q(te(ne)))};return K.apply(this,[oe,Y])}return new Promise((oe,ne)=>{K.apply(this,[function(ae){oe(Q(te(ae)))},ne])}).then(X,Z)}}function D(O){if(!(typeof O=="object"&&O.RTCPeerConnection&&O.RTCRtpSender&&O.RTCRtpReceiver))return;if(!("getStats"in O.RTCRtpSender.prototype)){const Y=O.RTCPeerConnection.prototype.getSenders;Y&&(O.RTCPeerConnection.prototype.getSenders=function(){const Z=Y.apply(this,[]);return Z.forEach(te=>te._pc=this),Z});const X=O.RTCPeerConnection.prototype.addTrack;X&&(O.RTCPeerConnection.prototype.addTrack=function(){const Z=X.apply(this,arguments);return Z._pc=this,Z}),O.RTCRtpSender.prototype.getStats=function(){const Z=this;return this._pc.getStats().then(te=>b(te,Z.track,!0))}}if(!("getStats"in O.RTCRtpReceiver.prototype)){const Y=O.RTCPeerConnection.prototype.getReceivers;Y&&(O.RTCPeerConnection.prototype.getReceivers=function(){const X=Y.apply(this,[]);return X.forEach(Z=>Z._pc=this),X}),e(O,"track",X=>(X.receiver._pc=X.srcElement,X)),O.RTCRtpReceiver.prototype.getStats=function(){const X=this;return this._pc.getStats().then(Z=>b(Z,X.track,!1))}}if(!("getStats"in O.RTCRtpSender.prototype)||!("getStats"in O.RTCRtpReceiver.prototype))return;const K=O.RTCPeerConnection.prototype.getStats;O.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof O.MediaStreamTrack){const Y=arguments[0];let X,Z,te;return this.getSenders().forEach(Q=>{Q.track===Y&&(X?te=!0:X=Q)}),this.getReceivers().forEach(Q=>(Q.track===Y&&(Z?te=!0:Z=Q),Q.track===Y)),te||X&&Z?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):X?X.getStats():Z?Z.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return K.apply(this,arguments)}}function y(O){O.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(te=>this._shimmedLocalStreams[te][0])};const K=O.RTCPeerConnection.prototype.addTrack;O.RTCPeerConnection.prototype.addTrack=function(te,Q){if(!Q)return K.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const oe=K.apply(this,arguments);return this._shimmedLocalStreams[Q.id]?this._shimmedLocalStreams[Q.id].indexOf(oe)===-1&&this._shimmedLocalStreams[Q.id].push(oe):this._shimmedLocalStreams[Q.id]=[Q,oe],oe};const Y=O.RTCPeerConnection.prototype.addStream;O.RTCPeerConnection.prototype.addStream=function(te){this._shimmedLocalStreams=this._shimmedLocalStreams||{},te.getTracks().forEach(ne=>{if(this.getSenders().find(ae=>ae.track===ne))throw new DOMException("Track already exists.","InvalidAccessError")});const Q=this.getSenders();Y.apply(this,arguments);const oe=this.getSenders().filter(ne=>Q.indexOf(ne)===-1);this._shimmedLocalStreams[te.id]=[te].concat(oe)};const X=O.RTCPeerConnection.prototype.removeStream;O.RTCPeerConnection.prototype.removeStream=function(te){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[te.id],X.apply(this,arguments)};const Z=O.RTCPeerConnection.prototype.removeTrack;O.RTCPeerConnection.prototype.removeTrack=function(te){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},te&&Object.keys(this._shimmedLocalStreams).forEach(Q=>{const oe=this._shimmedLocalStreams[Q].indexOf(te);oe!==-1&&this._shimmedLocalStreams[Q].splice(oe,1),this._shimmedLocalStreams[Q].length===1&&delete this._shimmedLocalStreams[Q]}),Z.apply(this,arguments)}}function A(O,K){if(!O.RTCPeerConnection)return;if(O.RTCPeerConnection.prototype.addTrack&&K.version>=65)return y(O);const Y=O.RTCPeerConnection.prototype.getLocalStreams;O.RTCPeerConnection.prototype.getLocalStreams=function(){const ne=Y.apply(this);return this._reverseStreams=this._reverseStreams||{},ne.map(ae=>this._reverseStreams[ae.id])};const X=O.RTCPeerConnection.prototype.addStream;O.RTCPeerConnection.prototype.addStream=function(ne){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},ne.getTracks().forEach(ae=>{if(this.getSenders().find(le=>le.track===ae))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[ne.id]){const ae=new O.MediaStream(ne.getTracks());this._streams[ne.id]=ae,this._reverseStreams[ae.id]=ne,ne=ae}X.apply(this,[ne])};const Z=O.RTCPeerConnection.prototype.removeStream;function te(ne,ae){let le=ae.sdp;return Object.keys(ne._reverseStreams||[]).forEach(ve=>{const be=ne._reverseStreams[ve],je=ne._streams[be.id];le=le.replace(new RegExp(je.id,"g"),be.id)}),new RTCSessionDescription({type:ae.type,sdp:le})}O.RTCPeerConnection.prototype.removeStream=function(ne){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},Z.apply(this,[this._streams[ne.id]||ne]),delete this._reverseStreams[this._streams[ne.id]?this._streams[ne.id].id:ne.id],delete this._streams[ne.id]},O.RTCPeerConnection.prototype.addTrack=function(ne,ae){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const le=[].slice.call(arguments,1);if(le.length!==1||!le[0].getTracks().find(be=>be===ne))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(be=>be.track===ne))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const ve=this._streams[ae.id];if(ve)ve.addTrack(ne),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const be=new O.MediaStream([ne]);this._streams[ae.id]=be,this._reverseStreams[be.id]=ae,this.addStream(be)}return this.getSenders().find(be=>be.track===ne)},["createOffer","createAnswer"].forEach(function(ne){const ae=O.RTCPeerConnection.prototype[ne],le={[ne](){const ve=arguments;return arguments.length&&typeof arguments[0]=="function"?ae.apply(this,[be=>{const je=te(this,be);ve[0].apply(null,[je])},be=>{ve[1]&&ve[1].apply(null,be)},arguments[2]]):ae.apply(this,arguments).then(be=>te(this,be))}};O.RTCPeerConnection.prototype[ne]=le[ne]});const Q=O.RTCPeerConnection.prototype.setLocalDescription;O.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=function(ne,ae){let le=ae.sdp;return Object.keys(ne._reverseStreams||[]).forEach(ve=>{const be=ne._reverseStreams[ve],je=ne._streams[be.id];le=le.replace(new RegExp(be.id,"g"),je.id)}),new RTCSessionDescription({type:ae.type,sdp:le})}(this,arguments[0]),Q.apply(this,arguments)):Q.apply(this,arguments)};const oe=Object.getOwnPropertyDescriptor(O.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(O.RTCPeerConnection.prototype,"localDescription",{get(){const ne=oe.get.apply(this);return ne.type===""?ne:te(this,ne)}}),O.RTCPeerConnection.prototype.removeTrack=function(ne){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!ne._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(ne._pc!==this)throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let ae;this._streams=this._streams||{},Object.keys(this._streams).forEach(le=>{this._streams[le].getTracks().find(ve=>ne.track===ve)&&(ae=this._streams[le])}),ae&&(ae.getTracks().length===1?this.removeStream(this._reverseStreams[ae.id]):ae.removeTrack(ne.track),this.dispatchEvent(new Event("negotiationneeded")))}}function w(O,K){!O.RTCPeerConnection&&O.webkitRTCPeerConnection&&(O.RTCPeerConnection=O.webkitRTCPeerConnection),O.RTCPeerConnection&&K.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(Y){const X=O.RTCPeerConnection.prototype[Y],Z={[Y](){return arguments[0]=new(Y==="addIceCandidate"?O.RTCIceCandidate:O.RTCSessionDescription)(arguments[0]),X.apply(this,arguments)}};O.RTCPeerConnection.prototype[Y]=Z[Y]})}function j(O,K){e(O,"negotiationneeded",Y=>{const X=Y.target;if(!(K.version<72||X.getConfiguration&&X.getConfiguration().sdpSemantics==="plan-b")||X.signalingState==="stable")return Y})}var I=x(6677),H=x.n(I);function F(O){const K=O&&O.navigator,Y=K.mediaDevices.getUserMedia.bind(K.mediaDevices);K.mediaDevices.getUserMedia=function(X){return Y(X).catch(Z=>Promise.reject(function(te){return{name:{PermissionDeniedError:"NotAllowedError"}[te.name]||te.name,message:te.message,constraint:te.constraint,toString(){return this.name}}}(Z)))}}function U(O){"getDisplayMedia"in O.navigator&&O.navigator.mediaDevices&&(O.navigator.mediaDevices&&"getDisplayMedia"in O.navigator.mediaDevices||(O.navigator.mediaDevices.getDisplayMedia=O.navigator.getDisplayMedia.bind(O.navigator)))}function B(O,K){if(O.RTCIceGatherer&&(O.RTCIceCandidate||(O.RTCIceCandidate=function(X){return X}),O.RTCSessionDescription||(O.RTCSessionDescription=function(X){return X}),K.version<15025)){const X=Object.getOwnPropertyDescriptor(O.MediaStreamTrack.prototype,"enabled");Object.defineProperty(O.MediaStreamTrack.prototype,"enabled",{set(Z){X.set.call(this,Z);const te=new Event("enabled");te.enabled=Z,this.dispatchEvent(te)}})}O.RTCRtpSender&&!("dtmf"in O.RTCRtpSender.prototype)&&Object.defineProperty(O.RTCRtpSender.prototype,"dtmf",{get(){return this._dtmf===void 0&&(this.track.kind==="audio"?this._dtmf=new O.RTCDtmfSender(this):this.track.kind==="video"&&(this._dtmf=null)),this._dtmf}}),O.RTCDtmfSender&&!O.RTCDTMFSender&&(O.RTCDTMFSender=O.RTCDtmfSender);const Y=H()(O,K.version);O.RTCPeerConnection=function(X){return X&&X.iceServers&&(X.iceServers=function(Z){let te=!1;return(Z=JSON.parse(JSON.stringify(Z))).filter(Q=>{if(Q&&(Q.urls||Q.url)){let oe=Q.urls||Q.url;Q.url&&!Q.urls&&t("RTCIceServer.url","RTCIceServer.urls");const ne=typeof oe=="string";return ne&&(oe=[oe]),oe=oe.filter(ae=>{if(ae.indexOf("stun:")===0)return!1;const le=ae.startsWith("turn")&&!ae.startsWith("turn:[")&&ae.includes("transport=udp");return le&&!te?(te=!0,!0):le&&!te}),delete Q.url,Q.urls=ne?oe[0]:oe,!!oe.length}})}(X.iceServers,K.version),s("ICE servers after filtering:",X.iceServers)),new Y(X)},O.RTCPeerConnection.prototype=Y.prototype}function k(O){O.RTCRtpSender&&!("replaceTrack"in O.RTCRtpSender.prototype)&&(O.RTCRtpSender.prototype.replaceTrack=O.RTCRtpSender.prototype.setTrack)}function V(O,K){const Y=O&&O.navigator,X=O&&O.MediaStreamTrack;if(Y.getUserMedia=function(Z,te,Q){t("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),Y.mediaDevices.getUserMedia(Z).then(te,Q)},!(K.version>55&&"autoGainControl"in Y.mediaDevices.getSupportedConstraints())){const Z=function(Q,oe,ne){oe in Q&&!(ne in Q)&&(Q[ne]=Q[oe],delete Q[oe])},te=Y.mediaDevices.getUserMedia.bind(Y.mediaDevices);if(Y.mediaDevices.getUserMedia=function(Q){return typeof Q=="object"&&typeof Q.audio=="object"&&(Q=JSON.parse(JSON.stringify(Q)),Z(Q.audio,"autoGainControl","mozAutoGainControl"),Z(Q.audio,"noiseSuppression","mozNoiseSuppression")),te(Q)},X&&X.prototype.getSettings){const Q=X.prototype.getSettings;X.prototype.getSettings=function(){const oe=Q.apply(this,arguments);return Z(oe,"mozAutoGainControl","autoGainControl"),Z(oe,"mozNoiseSuppression","noiseSuppression"),oe}}if(X&&X.prototype.applyConstraints){const Q=X.prototype.applyConstraints;X.prototype.applyConstraints=function(oe){return this.kind==="audio"&&typeof oe=="object"&&(oe=JSON.parse(JSON.stringify(oe)),Z(oe,"autoGainControl","mozAutoGainControl"),Z(oe,"noiseSuppression","mozNoiseSuppression")),Q.apply(this,[oe])}}}}function G(O,K){O.navigator.mediaDevices&&"getDisplayMedia"in O.navigator.mediaDevices||O.navigator.mediaDevices&&(O.navigator.mediaDevices.getDisplayMedia=function(Y){if(!Y||!Y.video){const X=new DOMException("getDisplayMedia without video constraints is undefined");return X.name="NotFoundError",X.code=8,Promise.reject(X)}return Y.video===!0?Y.video={mediaSource:K}:Y.video.mediaSource=K,O.navigator.mediaDevices.getUserMedia(Y)})}function q(O){typeof O=="object"&&O.RTCTrackEvent&&"receiver"in O.RTCTrackEvent.prototype&&!("transceiver"in O.RTCTrackEvent.prototype)&&Object.defineProperty(O.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function z(O,K){if(typeof O!="object"||!O.RTCPeerConnection&&!O.mozRTCPeerConnection)return;!O.RTCPeerConnection&&O.mozRTCPeerConnection&&(O.RTCPeerConnection=O.mozRTCPeerConnection),K.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(Z){const te=O.RTCPeerConnection.prototype[Z],Q={[Z](){return arguments[0]=new(Z==="addIceCandidate"?O.RTCIceCandidate:O.RTCSessionDescription)(arguments[0]),te.apply(this,arguments)}};O.RTCPeerConnection.prototype[Z]=Q[Z]});const Y={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},X=O.RTCPeerConnection.prototype.getStats;O.RTCPeerConnection.prototype.getStats=function(){const[Z,te,Q]=arguments;return X.apply(this,[Z||null]).then(oe=>{if(K.version<53&&!te)try{oe.forEach(ne=>{ne.type=Y[ne.type]||ne.type})}catch(ne){if(ne.name!=="TypeError")throw ne;oe.forEach((ae,le)=>{oe.set(le,Object.assign({},ae,{type:Y[ae.type]||ae.type}))})}return oe}).then(te,Q)}}function $(O){if(typeof O!="object"||!O.RTCPeerConnection||!O.RTCRtpSender||O.RTCRtpSender&&"getStats"in O.RTCRtpSender.prototype)return;const K=O.RTCPeerConnection.prototype.getSenders;K&&(O.RTCPeerConnection.prototype.getSenders=function(){const X=K.apply(this,[]);return X.forEach(Z=>Z._pc=this),X});const Y=O.RTCPeerConnection.prototype.addTrack;Y&&(O.RTCPeerConnection.prototype.addTrack=function(){const X=Y.apply(this,arguments);return X._pc=this,X}),O.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function re(O){if(typeof O!="object"||!O.RTCPeerConnection||!O.RTCRtpSender||O.RTCRtpSender&&"getStats"in O.RTCRtpReceiver.prototype)return;const K=O.RTCPeerConnection.prototype.getReceivers;K&&(O.RTCPeerConnection.prototype.getReceivers=function(){const Y=K.apply(this,[]);return Y.forEach(X=>X._pc=this),Y}),e(O,"track",Y=>(Y.receiver._pc=Y.srcElement,Y)),O.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function ee(O){O.RTCPeerConnection&&!("removeStream"in O.RTCPeerConnection.prototype)&&(O.RTCPeerConnection.prototype.removeStream=function(K){t("removeStream","removeTrack"),this.getSenders().forEach(Y=>{Y.track&&K.getTracks().includes(Y.track)&&this.removeTrack(Y)})})}function ie(O){O.DataChannel&&!O.RTCDataChannel&&(O.RTCDataChannel=O.DataChannel)}function se(O){if(typeof O!="object"||!O.RTCPeerConnection)return;const K=O.RTCPeerConnection.prototype.addTransceiver;K&&(O.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const Y=arguments[1],X=Y&&"sendEncodings"in Y;X&&Y.sendEncodings.forEach(te=>{if("rid"in te&&!/^[a-z0-9]{0,16}$/i.test(te.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in te&&!(parseFloat(te.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in te&&!(parseFloat(te.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const Z=K.apply(this,arguments);if(X){const{sender:te}=Z,Q=te.getParameters();(!("encodings"in Q)||Q.encodings.length===1&&Object.keys(Q.encodings[0]).length===0)&&(Q.encodings=Y.sendEncodings,te.sendEncodings=Y.sendEncodings,this.setParametersPromises.push(te.setParameters(Q).then(()=>{delete te.sendEncodings}).catch(()=>{delete te.sendEncodings})))}return Z})}function ce(O){if(typeof O!="object"||!O.RTCRtpSender)return;const K=O.RTCRtpSender.prototype.getParameters;K&&(O.RTCRtpSender.prototype.getParameters=function(){const Y=K.apply(this,arguments);return"encodings"in Y||(Y.encodings=[].concat(this.sendEncodings||[{}])),Y})}function ue(O){if(typeof O!="object"||!O.RTCPeerConnection)return;const K=O.RTCPeerConnection.prototype.createOffer;O.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>K.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):K.apply(this,arguments)}}function de(O){if(typeof O!="object"||!O.RTCPeerConnection)return;const K=O.RTCPeerConnection.prototype.createAnswer;O.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>K.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):K.apply(this,arguments)}}function pe(O){if(typeof O=="object"&&O.RTCPeerConnection){if("getLocalStreams"in O.RTCPeerConnection.prototype||(O.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in O.RTCPeerConnection.prototype)){const K=O.RTCPeerConnection.prototype.addTrack;O.RTCPeerConnection.prototype.addStream=function(Y){this._localStreams||(this._localStreams=[]),this._localStreams.includes(Y)||this._localStreams.push(Y),Y.getAudioTracks().forEach(X=>K.call(this,X,Y)),Y.getVideoTracks().forEach(X=>K.call(this,X,Y))},O.RTCPeerConnection.prototype.addTrack=function(Y,...X){return X&&X.forEach(Z=>{this._localStreams?this._localStreams.includes(Z)||this._localStreams.push(Z):this._localStreams=[Z]}),K.apply(this,arguments)}}"removeStream"in O.RTCPeerConnection.prototype||(O.RTCPeerConnection.prototype.removeStream=function(K){this._localStreams||(this._localStreams=[]);const Y=this._localStreams.indexOf(K);if(Y===-1)return;this._localStreams.splice(Y,1);const X=K.getTracks();this.getSenders().forEach(Z=>{X.includes(Z.track)&&this.removeTrack(Z)})})}}function Ee(O){if(typeof O=="object"&&O.RTCPeerConnection&&("getRemoteStreams"in O.RTCPeerConnection.prototype||(O.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in O.RTCPeerConnection.prototype))){Object.defineProperty(O.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(Y){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=Y),this.addEventListener("track",this._onaddstreampoly=X=>{X.streams.forEach(Z=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(Z))return;this._remoteStreams.push(Z);const te=new Event("addstream");te.stream=Z,this.dispatchEvent(te)})})}});const K=O.RTCPeerConnection.prototype.setRemoteDescription;O.RTCPeerConnection.prototype.setRemoteDescription=function(){const Y=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(X){X.streams.forEach(Z=>{if(Y._remoteStreams||(Y._remoteStreams=[]),Y._remoteStreams.indexOf(Z)>=0)return;Y._remoteStreams.push(Z);const te=new Event("addstream");te.stream=Z,Y.dispatchEvent(te)})}),K.apply(Y,arguments)}}}function he(O){if(typeof O!="object"||!O.RTCPeerConnection)return;const K=O.RTCPeerConnection.prototype,Y=K.createOffer,X=K.createAnswer,Z=K.setLocalDescription,te=K.setRemoteDescription,Q=K.addIceCandidate;K.createOffer=function(ne,ae){const le=arguments.length>=2?arguments[2]:arguments[0],ve=Y.apply(this,[le]);return ae?(ve.then(ne,ae),Promise.resolve()):ve},K.createAnswer=function(ne,ae){const le=arguments.length>=2?arguments[2]:arguments[0],ve=X.apply(this,[le]);return ae?(ve.then(ne,ae),Promise.resolve()):ve};let oe=function(ne,ae,le){const ve=Z.apply(this,[ne]);return le?(ve.then(ae,le),Promise.resolve()):ve};K.setLocalDescription=oe,oe=function(ne,ae,le){const ve=te.apply(this,[ne]);return le?(ve.then(ae,le),Promise.resolve()):ve},K.setRemoteDescription=oe,oe=function(ne,ae,le){const ve=Q.apply(this,[ne]);return le?(ve.then(ae,le),Promise.resolve()):ve},K.addIceCandidate=oe}function fe(O){const K=O&&O.navigator;if(K.mediaDevices&&K.mediaDevices.getUserMedia){const Y=K.mediaDevices,X=Y.getUserMedia.bind(Y);K.mediaDevices.getUserMedia=Z=>X(me(Z))}!K.getUserMedia&&K.mediaDevices&&K.mediaDevices.getUserMedia&&(K.getUserMedia=function(Y,X,Z){K.mediaDevices.getUserMedia(Y).then(X,Z)}.bind(K))}function me(O){return O&&O.video!==void 0?Object.assign({},O,{video:l(O.video)}):O}function ge(O){if(!O.RTCPeerConnection)return;const K=O.RTCPeerConnection;O.RTCPeerConnection=function(Y,X){if(Y&&Y.iceServers){const Z=[];for(let te=0;te<Y.iceServers.length;te++){let Q=Y.iceServers[te];!Q.hasOwnProperty("urls")&&Q.hasOwnProperty("url")?(t("RTCIceServer.url","RTCIceServer.urls"),Q=JSON.parse(JSON.stringify(Q)),Q.urls=Q.url,delete Q.url,Z.push(Q)):Z.push(Y.iceServers[te])}Y.iceServers=Z}return new K(Y,X)},O.RTCPeerConnection.prototype=K.prototype,"generateCertificate"in K&&Object.defineProperty(O.RTCPeerConnection,"generateCertificate",{get:()=>K.generateCertificate})}function _e(O){typeof O=="object"&&O.RTCTrackEvent&&"receiver"in O.RTCTrackEvent.prototype&&!("transceiver"in O.RTCTrackEvent.prototype)&&Object.defineProperty(O.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Re(O){const K=O.RTCPeerConnection.prototype.createOffer;O.RTCPeerConnection.prototype.createOffer=function(Y){if(Y){Y.offerToReceiveAudio!==void 0&&(Y.offerToReceiveAudio=!!Y.offerToReceiveAudio);const X=this.getTransceivers().find(te=>te.receiver.track.kind==="audio");Y.offerToReceiveAudio===!1&&X?X.direction==="sendrecv"?X.setDirection?X.setDirection("sendonly"):X.direction="sendonly":X.direction==="recvonly"&&(X.setDirection?X.setDirection("inactive"):X.direction="inactive"):Y.offerToReceiveAudio!==!0||X||this.addTransceiver("audio"),Y.offerToReceiveVideo!==void 0&&(Y.offerToReceiveVideo=!!Y.offerToReceiveVideo);const Z=this.getTransceivers().find(te=>te.receiver.track.kind==="video");Y.offerToReceiveVideo===!1&&Z?Z.direction==="sendrecv"?Z.setDirection?Z.setDirection("sendonly"):Z.direction="sendonly":Z.direction==="recvonly"&&(Z.setDirection?Z.setDirection("inactive"):Z.direction="inactive"):Y.offerToReceiveVideo!==!0||Z||this.addTransceiver("video")}return K.apply(this,arguments)}}function Te(O){typeof O!="object"||O.AudioContext||(O.AudioContext=O.webkitAudioContext)}var Ne=x(7963),ke=x.n(Ne);function we(O){if(!O.RTCIceCandidate||O.RTCIceCandidate&&"foundation"in O.RTCIceCandidate.prototype)return;const K=O.RTCIceCandidate;O.RTCIceCandidate=function(Y){if(typeof Y=="object"&&Y.candidate&&Y.candidate.indexOf("a=")===0&&((Y=JSON.parse(JSON.stringify(Y))).candidate=Y.candidate.substr(2)),Y.candidate&&Y.candidate.length){const X=new K(Y),Z=ke().parseCandidate(Y.candidate),te=Object.assign(X,Z);return te.toJSON=function(){return{candidate:te.candidate,sdpMid:te.sdpMid,sdpMLineIndex:te.sdpMLineIndex,usernameFragment:te.usernameFragment}},te}return new K(Y)},O.RTCIceCandidate.prototype=K.prototype,e(O,"icecandidate",Y=>(Y.candidate&&Object.defineProperty(Y,"candidate",{value:new O.RTCIceCandidate(Y.candidate),writable:"false"}),Y))}function Ce(O,K){if(!O.RTCPeerConnection)return;"sctp"in O.RTCPeerConnection.prototype||Object.defineProperty(O.RTCPeerConnection.prototype,"sctp",{get(){return this._sctp===void 0?null:this._sctp}});const Y=O.RTCPeerConnection.prototype.setRemoteDescription;O.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,K.browser==="chrome"&&K.version>=76){const{sdpSemantics:X}=this.getConfiguration();X==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return this._sctp===void 0?null:this._sctp},enumerable:!0,configurable:!0})}if(function(X){if(!X||!X.sdp)return!1;const Z=ke().splitSections(X.sdp);return Z.shift(),Z.some(te=>{const Q=ke().parseMLine(te);return Q&&Q.kind==="application"&&Q.protocol.indexOf("SCTP")!==-1})}(arguments[0])){const X=function(ne){const ae=ne.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(ae===null||ae.length<2)return-1;const le=parseInt(ae[1],10);return le!=le?-1:le}(arguments[0]),Z=function(ne){let ae=65536;return K.browser==="firefox"&&(ae=K.version<57?ne===-1?16384:2147483637:K.version<60?K.version===57?65535:65536:2147483637),ae}(X),te=function(ne,ae){let le=65536;K.browser==="firefox"&&K.version===57&&(le=65535);const ve=ke().matchPrefix(ne.sdp,"a=max-message-size:");return ve.length>0?le=parseInt(ve[0].substr(19),10):K.browser==="firefox"&&ae!==-1&&(le=2147483637),le}(arguments[0],X);let Q;Q=Z===0&&te===0?Number.POSITIVE_INFINITY:Z===0||te===0?Math.max(Z,te):Math.min(Z,te);const oe={};Object.defineProperty(oe,"maxMessageSize",{get:()=>Q}),this._sctp=oe}return Y.apply(this,arguments)}}function Ae(O){if(!O.RTCPeerConnection||!("createDataChannel"in O.RTCPeerConnection.prototype))return;function K(X,Z){const te=X.send;X.send=function(){const Q=arguments[0],oe=Q.length||Q.size||Q.byteLength;if(X.readyState==="open"&&Z.sctp&&oe>Z.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+Z.sctp.maxMessageSize+" bytes)");return te.apply(X,arguments)}}const Y=O.RTCPeerConnection.prototype.createDataChannel;O.RTCPeerConnection.prototype.createDataChannel=function(){const X=Y.apply(this,arguments);return K(X,this),X},e(O,"datachannel",X=>(K(X.channel,X.target),X))}function Pe(O){if(!O.RTCPeerConnection||"connectionState"in O.RTCPeerConnection.prototype)return;const K=O.RTCPeerConnection.prototype;Object.defineProperty(K,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(K,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(Y){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),Y&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=Y)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(Y=>{const X=K[Y];K[Y]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=Z=>{const te=Z.target;if(te._lastConnectionState!==te.connectionState){te._lastConnectionState=te.connectionState;const Q=new Event("connectionstatechange",Z);te.dispatchEvent(Q)}return Z},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),X.apply(this,arguments)}})}function Oe(O,K){if(!O.RTCPeerConnection||K.browser==="chrome"&&K.version>=71||K.browser==="safari"&&K.version>=605)return;const Y=O.RTCPeerConnection.prototype.setRemoteDescription;O.RTCPeerConnection.prototype.setRemoteDescription=function(X){if(X&&X.sdp&&X.sdp.indexOf(`
157
157
  a=extmap-allow-mixed`)!==-1){const Z=X.sdp.split(`
158
158
  `).filter(te=>te.trim()!=="a=extmap-allow-mixed").join(`
159
- `);w.RTCSessionDescription&&X instanceof w.RTCSessionDescription?arguments[0]=new w.RTCSessionDescription({type:X.type,sdp:Z}):X.sdp=Z}return Y.apply(this,arguments)}}function He(w,K){if(!w.RTCPeerConnection||!w.RTCPeerConnection.prototype)return;const Y=w.RTCPeerConnection.prototype.addIceCandidate;Y&&Y.length!==0&&(w.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(K.browser==="chrome"&&K.version<78||K.browser==="firefox"&&K.version<68||K.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():Y.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}const We=function({window:w}={},K={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const Y=s,X=function(te){const Q={browser:null,version:null};if(te===void 0||!te.navigator)return Q.browser="Not a browser.",Q;const{navigator:oe}=te;if(oe.mozGetUserMedia)Q.browser="firefox",Q.version=p(oe.userAgent,/Firefox\/(\d+)\./,1);else if(oe.webkitGetUserMedia||te.isSecureContext===!1&&te.webkitRTCPeerConnection&&!te.RTCIceGatherer)Q.browser="chrome",Q.version=p(oe.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(oe.mediaDevices&&oe.userAgent.match(/Edge\/(\d+).(\d+)$/))Q.browser="edge",Q.version=p(oe.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!te.RTCPeerConnection||!oe.userAgent.match(/AppleWebKit\/(\d+)\./))return Q.browser="Not a supported browser.",Q;Q.browser="safari",Q.version=p(oe.userAgent,/AppleWebKit\/(\d+)\./,1),Q.supportsUnifiedPlan=te.RTCRtpTransceiver&&"currentDirection"in te.RTCRtpTransceiver.prototype}return Q}(w),Z={browserDetails:X,commonShim:f,extractVersion:p,disableLog:r,disableWarnings:n};switch(X.browser){case"chrome":if(!v||!O||!K.shimChrome)return Y("Chrome shim is not included in this adapter release."),Z;if(X.version===null)return Y("Chrome shim can not determine version, not shimming."),Z;Y("adapter.js shimming chrome."),Z.browserShim=v,He(w,X),h(w,X),g(w),O(w,X),m(w),A(w,X),T(w),C(w),D(w),j(w,X),Oe(w),Pe(w),Ce(w,X),Ae(w),we(w,X);break;case"firefox":if(!u||!z||!K.shimFirefox)return Y("Firefox shim is not included in this adapter release."),Z;Y("adapter.js shimming firefox."),Z.browserShim=u,He(w,X),V(w,X),z(w,X),q(w),ee(w),$(w),re(w),ie(w),se(w),ce(w),ue(w),de(w),Oe(w),Pe(w),Ce(w,X),Ae(w);break;case"edge":if(!c||!B||!K.shimEdge)return Y("MS edge shim is not included in this adapter release."),Z;Y("adapter.js shimming edge."),Z.browserShim=c,F(w),U(w),B(w,X),k(w),Ce(w,X),Ae(w);break;case"safari":if(!S||!K.shimSafari)return Y("Safari shim is not included in this adapter release."),Z;Y("adapter.js shimming safari."),Z.browserShim=S,He(w,X),ge(w),Re(w),he(w),pe(w),Ee(w),_e(w),fe(w),Te(w),Oe(w),Ce(w,X),Ae(w),we(w,X);break;default:Y("Unsupported browser!")}return Z}({window:typeof window>"u"?void 0:window}),xe=We},6834:(L,R,x)=>{x.r(R),x.d(R,{default:()=>u});var v=x(5512),c=x.n(v);function u(){return c()('/*! aliyun rts sdk - ver2.12.5 created:2025/6/6 14:17:23 */(()=>{"use strict";var e={917:(e,r)=>{var t,n,a,o;Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=r.DEFAULT_HEARTBEAT_TIMEOUT=r.DEFAULT_RETRY_PUBLISH_INTERVAL=r.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=r.DEFAULT_RETRY_PUBLISH_LIMIT=r.DEFAULT_RETRY_SUBSCRIBE_LIMIT=r.EWorkerAction=r.EWorkerSource=r.EConnectStatus=r.TrackType=void 0,function(e){e.AUDIO="audio",e.VIDEO="video"}(t||(r.TrackType=t={})),function(e){e[e.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",e[e.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",e[e.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",e[e.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(n||(r.EConnectStatus=n={})),function(e){e.Sender="sender",e.Receiver="receiver"}(a||(r.EWorkerSource=a={})),function(e){e.Setup="setup",e.InserSEI="insertSEI"}(o||(r.EWorkerAction=o={})),r.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,r.DEFAULT_RETRY_PUBLISH_LIMIT=5,r.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,r.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,r.DEFAULT_HEARTBEAT_TIMEOUT=8,r.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},594:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.readUUID=r.discardEPB=r.insertEPB=r.SODBtoRBSP=r.convertPayloadSize=r.NALU=r.SEI=r.parseSei=r.insertSei=void 0;r.insertSei=function(e,r,a,o){void 0===a&&(a=5);for(var i=e.data,u=new DataView(i),c=0;;){if(1===u.getUint32(c)){u.getUint8(c+4);var s=new t(r,a,o).buffer,f=new n(s).buffer,T=new ArrayBuffer(f.byteLength+i.byteLength),E=new Uint8Array(T),l=new Uint8Array(f);E.set(l);var d=new Uint8Array(i);E.set(d,f.byteLength),e.data=T,c+=1;break}if((c+=1)+4>=u.byteLength)break}};r.parseSei=function(e){for(var t=[],n=new DataView(e),a=0;;){var o=a,i=n.getUint32(o);if(o+=4,1===i){if(6===(31&n.getUint8(o++))){for(var u=n.getUint8(o++),c=5===u?16:0,s=0;255==n.getUint8(o);)o++,s+=255;if((s+=n.getUint8(o++))>0&&n.byteLength>o+s){var f=new Uint8Array(n.buffer),T="";if(5===u){var E=f.slice(o,o+c);T=(0,r.readUUID)((0,r.discardEPB)(E))}var l=f.slice(o+c,o+s);o+=s,t.push({payloadType:u,uuid:T,data:l.buffer})}}a=o}else a+=1;if(a+4>=n.byteLength)break}return t};var t=function(e,t,n){void 0===t&&(t=5);var a=5===t?16:0,o=e.byteLength+a,i=(0,r.convertPayloadSize)(o),u=i.buffer.byteLength,c=new ArrayBuffer(1+u+a+e.byteLength),s=new Uint8Array(c),f=0;if(s[f++]=t,s.set(i,f),f+=i.byteLength,5===t){n=(n||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var T=0;T<16;T++)s[f+T]=parseInt(n.substr(2*T,2),16);f+=16}var E=new Uint8Array(e);s.set(E,f);var l=(0,r.SODBtoRBSP)(s);this.buffer=l.buffer};r.SEI=t;var n=function(e){var r=new Uint8Array([0,0,0,1]),t=new Uint8Array([6]),n=new ArrayBuffer(r.byteLength+t.byteLength+e.byteLength),a=new Uint8Array(n);a.set(r),a.set(t,r.byteLength),a.set(new Uint8Array(e),r.byteLength+t.byteLength),this.buffer=n};r.NALU=n;r.convertPayloadSize=function(e){if(e<=0)throw new Error("payloadSize must be a positive integer.");for(var r=Math.ceil(e/255),t=new ArrayBuffer(r),n=new DataView(t),a=0;a<r-1;a++)n.setUint8(a,255);return n.setUint8(r-1,e%255&255),new Uint8Array(t)};r.SODBtoRBSP=function(e){for(var t=new Uint8Array(e),n="",a=0;a<t.length;a++)n+=t[a].toString(2).padStart(8,"0");for(n+="1";n.length%8!=0;)n+="0";var o=n.length/8,i=new Uint8Array(o);for(a=0;a<o;a++)i[a]=parseInt(n.slice(8*a,8*a+8),2);return(0,r.insertEPB)(i)};r.insertEPB=function(e){for(var r=[],t=0,n=0;n<e.length;n++)r.push(e[n]),0===e[n]?2===++t&&n<e.length-1&&e[n+1]<=3&&(r.push(3),t=0):t=0;return new Uint8Array(r)};r.discardEPB=function(e){for(var r=e.byteLength,t=[],n=1;n<r-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(t.push(n+2),n+=2):n++;if(0===t.length)return e;var a=r-t.length,o=new Uint8Array(a),i=0;for(n=0;n<a;i++,n++)i===t[0]&&(i++,t.shift()),o[n]=e[i];return o};r.readUUID=function(e){if(16!==e.length)throw new Error("UUID must be 16 bytes long.");var r=e.reduce((function(e,r){return e+r.toString(16).padStart(2,"0")}),"");return"".concat(r.slice(0,8),"-").concat(r.slice(8,12),"-").concat(r.slice(12,16),"-").concat(r.slice(16,20),"-").concat(r.slice(20))}},718:function(e,r){var t=this&&this.__spreadArray||function(e,r,t){if(t||2===arguments.length)for(var n,a=0,o=r.length;a<o;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return e.concat(n||Array.prototype.slice.call(r))};Object.defineProperty(r,"__esModule",{value:!0}),r.hebtLog=r.createUUID=r.evaluateNetworkCondition=r.makeCancelable=r.hasVideoTrack=r.hasAudioTrack=r.getVideoTrack=r.getAudioTrack=r.pruneSubUrl=r.getJitterBufferDelayAvg=void 0;r.getJitterBufferDelayAvg=function(e,r){return e&&r?Number(e)/Number(r)*1e3:-1};r.pruneSubUrl=function(e,r){var t=e||"";return t=t.replace("@subaudio=no","").replace("@subvideo=no",""),r&&(t=t.split("?")[0]),t};r.getAudioTrack=function(e){return e.getAudioTracks()[0]};r.getVideoTrack=function(e){return e.getVideoTracks()[0]};r.hasAudioTrack=function(e){return e.getAudioTracks().length>0};r.hasVideoTrack=function(e){return e.getVideoTracks().length>0};r.makeCancelable=function(e){var r=!1;return{promise:new Promise((function(t,n){e.then((function(e){return r?n({isCanceled:!0}):t(e)})),e.catch((function(e){return n(r?{isCanceled:!0}:e)}))})),cancel:function(){r=!0}}};r.evaluateNetworkCondition=function(e,r,t,n,a){var o=0;if(!navigator.onLine)return o=6;var i=[{loss:0,rtt:0,jbd:1},{loss:0,rtt:1,jbd:0},{loss:0,rtt:.5,jbd:.5},{loss:1,rtt:0,jbd:0},{loss:.8,rtt:0,jbd:.2},{loss:.8,rtt:.2,jbd:0},{loss:.6,rtt:.2,jbd:.2}],u=-1,c=-1,s=-1;if("number"==typeof r&&r>=0||"number"==typeof t&&t>=0){u=0;var f=!1,T=!1;"number"==typeof r&&r>=0&&(u+=r,f=!0),"number"==typeof t&&t>=0&&(u+=t,T=!0),f&&!T&&(u*=2),T&&!f&&(u*=1.8)}if("number"==typeof e&&e>=0&&(s=e),"number"==typeof n&&n>=0||"number"==typeof a&&a>=0){c=0;"number"==typeof n&&n>=0&&(c+=n),"number"==typeof a&&a>=0&&(c+=a)}var E;if((E=4*(-1!==u?1:0)+2*(-1!==s?1:0)+(-1!==c?1:0))>0){var l=1.2*u*i[E-1].loss+s/1500*i[E-1].rtt+c/3e3*i[E-1].jbd;o=l<=.1?1:l<=.23?2:l<=.36?3:l<=.49?4:5}else o=0;return o};r.createUUID=function(e,r){var t,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=[];if(r=r||n.length,e)for(t=0;t<e;t++)a[t]=n[0|Math.random()*r];else{var o=void 0;for(a[8]=a[13]=a[18]=a[23]="-",a[14]="4",t=0;t<36;t++)a[t]||(o=0|16*Math.random(),a[t]=n[19==t?3&o|8:o])}return a.join("")};r.hebtLog=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];window.RTS_HEBT_DEBUG&&console.log.apply(console,t(["[rts hebt]"],e,!1))}}},r={};function t(n){var a=r[n];if(void 0!==a)return a.exports;var o=r[n]={exports:{}};return e[n].call(o.exports,o,o.exports,t),o.exports}var n,a,o,i,u,c,s;a=t(594),o=t(718),i=t(917),u=self,c=function(e,r,t,o){if(e===i.EWorkerSource.Sender){var u=new TransformStream({transform:function(e,r){e.type&&(n&&((0,a.insertSei)(e,n.sei,n.payloadType,n.uuid),void 0===n.repeatCount?n=null:-1!==n.repeatCount&&(n.repeatCount--,n.repeatCount<0&&(n=null))),o&&o(e)),r.enqueue(e)}});r.pipeThrough(u).pipeTo(t)}else e===i.EWorkerSource.Receiver&&(u=new TransformStream({transform:function(e,r){e.type&&o&&o(e),r.enqueue(e)}}),r.pipeThrough(u).pipeTo(t))},s=function(e){var r=e.data.slice(0);u.postMessage({type:"encodedFrame",data:r,frameInfo:{type:e.type,timestamp:e.timestamp}},[r]),r=null},u.RTCTransformEvent&&(u.onrtctransform=function(e){var r=e.transformer,t=r.options.source,n=r.readable,a=r.writable;c(t,n,a,(function(e){t===i.EWorkerSource.Receiver&&s(e)}))}),onmessage=function(e){switch(e.data.operation){case i.EWorkerAction.Setup:r=e.data,t=r.source,a=r.readable,u=r.writable,c(t,a,u,(function(e){t===i.EWorkerSource.Receiver&&s(e)}));break;case i.EWorkerAction.InserSEI:!function(e){(n=e)&&(n.uuid=(0,o.createUUID)().toLowerCase(),n.repeatCount=n.repeatCount||0)}(e.data)}var r,t,a,u}})();',"Worker",void 0,void 0)}},5512:L=>{L.exports=function(R,x,v,c){var u=self||window;try{try{var S;try{S=new u.Blob([R])}catch{(S=new(u.BlobBuilder||u.WebKitBlobBuilder||u.MozBlobBuilder||u.MSBlobBuilder)).append(R),S=S.getBlob()}var f=u.URL||u.webkitURL,a=f.createObjectURL(S),d=new u[x](a,v);return f.revokeObjectURL(a),d}catch{return new u[x]("data:application/javascript,".concat(encodeURIComponent(R)),v)}}catch{if(!c)throw Error("Inline worker is not supported");return new u[x](c,v)}}},2632:(L,R,x)=>{x.r(R),x.d(R,{default:()=>p});function v(e,r,n){Object.defineProperty(e,r,{writable:!0,enumerable:!0,configurable:!0,value:n})}Array(32);var c,u,S;class f{constructor(r){var n,s;this.timer=null,this.time=10,this.count=10,this.arr=[],this.time=(n=r.time)!=null?n:10,this.count=(s=r.count)!=null?s:10,r.host.startsWith("http://")||r.host.startsWith("https://")?this.url=r.host+"/logstores/"+r.logstore+"/track":this.url="https://"+r.project+"."+r.host+"/logstores/"+r.logstore+"/track",this.opt=r,r.installUnloadHook&&typeof r.installUnloadHook=="function"&&r.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(r=this.arr){const n={__logs__:r};return this.opt.tags&&(n.__tags__=this.opt.tags),this.opt.topic&&(n.__topic__=this.opt.topic),this.opt.source&&(n.__source__=this.opt.source),JSON.stringify(n)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const r=this.assemblePayload();this.opt.sendPayload(this.url,r)}}transString(r){let n={};for(let s in r)typeof r[s]=="object"?n[s]=JSON.stringify(r[s]):n[s]=String(r[s]);return n}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const r=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){r.sendImmediateInner()},1e3*this.time)}}send(r){const n=this.transString(r);this.arr.push(n),this.sendInner()}sendImmediate(r){const n=this.transString(r);this.arr.push(n),this.sendImmediateInner()}sendBatchLogs(r){const n=r.map(s=>this.transString(s));this.arr.push(...n),this.sendInner()}sendBatchLogsImmediate(r){const n=r.map(s=>this.transString(s));this.arr.push(...n),this.sendImmediateInner()}}function a(e,r){const n=new window.XMLHttpRequest;n.open("POST",`${e}?APIVersion=0.6.0`,!0),n.send(r)}function d(e,r){try{if(r.length>=32768)return void a(e,r);(function(n,s){return!(!navigator||!navigator.sendBeacon)&&navigator.sendBeacon(`${n}?APIVersion=0.6.0`,s)})(e,r)||a(e,r)}catch(n){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
160
- `+n),console.error("Failed log data:",e))}}class p extends f{constructor(r){super(Object.assign({},r,{installUnloadHook:n=>{window.addEventListener("beforeunload",()=>{n()})},sendPayload:(n,s)=>{d(n,s)}}))}}c=window,u="SLS_Tracker",S=p,v(c,u,S)},4198:L=>{L.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')}},N={};function J(L){var R=N[L];if(R!==void 0)return R.exports;var x=N[L]={exports:{}};return P[L].call(x.exports,x,x.exports,J),x.exports}return J.n=L=>{var R=L&&L.__esModule?()=>L.default:()=>L;return J.d(R,{a:R}),R},J.d=(L,R)=>{for(var x in R)J.o(R,x)&&!J.o(L,x)&&Object.defineProperty(L,x,{enumerable:!0,get:R[x]})},J.o=(L,R)=>Object.prototype.hasOwnProperty.call(L,R),J.r=L=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(L,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(L,"__esModule",{value:!0})},J(8156)})())})(Hr);for(var jn=Hr.exports,Be=[],Gt=0;Gt<256;++Gt)Be.push((Gt+256).toString(16).slice(1));function Wn(W,M=0){return(Be[W[M+0]]+Be[W[M+1]]+Be[W[M+2]]+Be[W[M+3]]+"-"+Be[W[M+4]]+Be[W[M+5]]+"-"+Be[W[M+6]]+Be[W[M+7]]+"-"+Be[W[M+8]]+Be[W[M+9]]+"-"+Be[W[M+10]]+Be[W[M+11]]+Be[W[M+12]]+Be[W[M+13]]+Be[W[M+14]]+Be[W[M+15]]).toLowerCase()}var nt,Gn=new Uint8Array(16);function zn(){if(!nt&&(nt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!nt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return nt(Gn)}var qn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vr={randomUUID:qn};function it(W,M,P){if(Vr.randomUUID&&!M&&!W)return Vr.randomUUID();W=W||{};var N=W.random||(W.rng||zn)();return N[6]=N[6]&15|64,N[8]=N[8]&63|128,Wn(N)}var Yn=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Kn=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Xn=/[^-+\dA-Z]/g;function zt(W,M,P,N){if(arguments.length===1&&typeof W=="string"&&!/\d/.test(W)&&(M=W,W=void 0),W=W||W===0?W:new Date,W instanceof Date||(W=new Date(W)),isNaN(W))throw TypeError("Invalid date");M=String(jr[M]||M||jr.default);var J=M.slice(0,4);(J==="UTC:"||J==="GMT:")&&(M=M.slice(4),P=!0,J==="GMT:"&&(N=!0));var L=function(){return P?"getUTC":"get"},R=function(){return W[L()+"Date"]()},x=function(){return W[L()+"Day"]()},v=function(){return W[L()+"Month"]()},c=function(){return W[L()+"FullYear"]()},u=function(){return W[L()+"Hours"]()},S=function(){return W[L()+"Minutes"]()},f=function(){return W[L()+"Seconds"]()},a=function(){return W[L()+"Milliseconds"]()},d=function(){return P?0:W.getTimezoneOffset()},p=function(){return Jn(W)},e=function(){return Qn(W)},r={d:function(){return R()},dd:function(){return Ve(R())},ddd:function(){return Ue.dayNames[x()]},DDD:function(){return Wr({y:c(),m:v(),d:R(),_:L(),dayName:Ue.dayNames[x()],short:!0})},dddd:function(){return Ue.dayNames[x()+7]},DDDD:function(){return Wr({y:c(),m:v(),d:R(),_:L(),dayName:Ue.dayNames[x()+7]})},m:function(){return v()+1},mm:function(){return Ve(v()+1)},mmm:function(){return Ue.monthNames[v()]},mmmm:function(){return Ue.monthNames[v()+12]},yy:function(){return String(c()).slice(2)},yyyy:function(){return Ve(c(),4)},h:function(){return u()%12||12},hh:function(){return Ve(u()%12||12)},H:function(){return u()},HH:function(){return Ve(u())},M:function(){return S()},MM:function(){return Ve(S())},s:function(){return f()},ss:function(){return Ve(f())},l:function(){return Ve(a(),3)},L:function(){return Ve(Math.floor(a()/10))},t:function(){return u()<12?Ue.timeNames[0]:Ue.timeNames[1]},tt:function(){return u()<12?Ue.timeNames[2]:Ue.timeNames[3]},T:function(){return u()<12?Ue.timeNames[4]:Ue.timeNames[5]},TT:function(){return u()<12?Ue.timeNames[6]:Ue.timeNames[7]},Z:function(){return N?"GMT":P?"UTC":$n(W)},o:function(){return(d()>0?"-":"+")+Ve(Math.floor(Math.abs(d())/60)*100+Math.abs(d())%60,4)},p:function(){return(d()>0?"-":"+")+Ve(Math.floor(Math.abs(d())/60),2)+":"+Ve(Math.floor(Math.abs(d())%60),2)},S:function(){return["th","st","nd","rd"][R()%10>3?0:(R()%100-R()%10!=10)*R()%10]},W:function(){return p()},WW:function(){return Ve(p())},N:function(){return e()}};return M.replace(Yn,function(n){return n in r?r[n]():n.slice(1,n.length-1)})}var jr={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Ue={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},Ve=function(M){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(M).padStart(P,"0")},Wr=function(M){var P=M.y,N=M.m,J=M.d,L=M._,R=M.dayName,x=M.short,v=x===void 0?!1:x,c=new Date,u=new Date;u.setDate(u[L+"Date"]()-1);var S=new Date;S.setDate(S[L+"Date"]()+1);var f=function(){return c[L+"Date"]()},a=function(){return c[L+"Month"]()},d=function(){return c[L+"FullYear"]()},p=function(){return u[L+"Date"]()},e=function(){return u[L+"Month"]()},r=function(){return u[L+"FullYear"]()},n=function(){return S[L+"Date"]()},s=function(){return S[L+"Month"]()},t=function(){return S[L+"FullYear"]()};return d()===P&&a()===N&&f()===J?v?"Tdy":"Today":r()===P&&e()===N&&p()===J?v?"Ysd":"Yesterday":t()===P&&s()===N&&n()===J?v?"Tmw":"Tomorrow":R},Jn=function(M){var P=new Date(M.getFullYear(),M.getMonth(),M.getDate());P.setDate(P.getDate()-(P.getDay()+6)%7+3);var N=new Date(P.getFullYear(),0,4);N.setDate(N.getDate()-(N.getDay()+6)%7+3);var J=P.getTimezoneOffset()-N.getTimezoneOffset();P.setHours(P.getHours()-J);var L=(P-N)/(864e5*7);return 1+Math.floor(L)},Qn=function(M){var P=M.getDay();return P===0&&(P=7),P},$n=function(M){return(String(M).match(Kn)||[""]).pop().replace(Xn,"").replace(/GMT\+0000/g,"UTC")},qt;(function(W){W.prod="rs.rtn.aliyuncs.com",W.pre="prs.rtn.aliyuncs.com"})(qt||(qt={}));var Gr;(function(W){W[W.ByClient=0]="ByClient",W[W.KickOut=1]="KickOut",W[W.ChannelClosed=2]="ChannelClosed",W[W.Restore=3]="Restore",W[W.Expired=4]="Expired",W[W.Reconnect=5]="Reconnect",W[W.ReconnectExhausted=6]="ReconnectExhausted"})(Gr||(Gr={}));const zr="7.1.2-beta.1";class Kt{static getVersionNumber(){let M=zr.split("."),P="";return M.forEach(N=>{N.length===1?P+="0"+N:P+=N}),parseInt(P)}static queryingParam(M){let P=[];if(M)for(let N in M)P.push(N+"="+M[N]);return P.join("&")}static getQueryParams(M){const P=window.location.search.substring(1).split("&");for(let N=0;N<P.length;N++){const J=P[N].split("=");if(decodeURIComponent(J[0])===M)return decodeURIComponent(J[1])}}static createCallid(M=""){const P=it();return M&&P&&P.length>M.length?`${M}${P.substring(M.length)}`:P}static checkSubOptionsValid(M){if(M){const{audio:P,video:N,screen:J}=M;if(P===!1&&N===!1&&J===!1)return!1}return!0}static async isNetworkAvailable(){const M=qt.prod,{onLine:P}=navigator;if(!P)return!1;try{return await fetch(`https://${M}/roomserver/v1/ws/version`),!0}catch{return!1}}static toString(M){let P;if(M instanceof Error)P=M.message;else if(typeof M=="string")P=M;else try{P=JSON.stringify(M)}catch{P="undefined"}return P}static paramArrayToString(M){let P="";for(let N=0;N<M.length;N++){P!==""&&(P+=" ");let J=Kt.toString(M[N]);P+=J}return P}}const Zn=(W,M)=>W.find(P=>{if(typeof P.test=="function")return P.test(M);if(Array.isArray(P.test))return P.test.some(N=>typeof N=="string"?M.indexOf(N)>-1:N instanceof RegExp?N.test(M):!1)}),ei=[{test:["wow64","win64","x64"],describe(){return"amd64"}},{test:["i686","x86"],describe(){return"x86"}},{test:["aarch64","arm64"],describe(){return"arm64"}},{test:["arm"],describe(){return"arm"}}],ti=()=>{let W="unknown";try{const M=navigator.userAgent||"",P=Zn(ei,M);if(!P)return W;W=P.describe(M)}catch{}return W};var ri=Object.defineProperty,ni=(W,M,P)=>M in W?ri(W,M,{enumerable:!0,configurable:!0,writable:!0,value:P}):W[M]=P,De=(W,M,P)=>ni(W,typeof M!="symbol"?M+"":M,P);const{BrowserUtil:qr,SystenUtil:Yr}=jn.AliRTS,ii=ti(),oi="woMMssV6jmyol9fr",ai=200,ot=10*60*1e3,at={host:"cn-hangzhou.log.aliyuncs.com",project:"alivc-aio",logstore:"logger",time:10,count:10};function Yt(){return zt(new Date,"HH:MM:ss.l")}function Kr(){return zt(new Date,"isoDate")}var Fe;(function(W){W[W.DEBUG=0]="DEBUG",W[W.INFO=1]="INFO",W[W.API=2]="API",W[W.WARNING=3]="WARNING",W[W.ERROR=4]="ERROR",W[W.NONE=5]="NONE"})(Fe||(Fe={}));var Ke;(function(W){W[W.TASK_UPLOAD_BEGIN=710201]="TASK_UPLOAD_BEGIN",W[W.SESSION_UPLOAD_BEGIN=710202]="SESSION_UPLOAD_BEGIN",W[W.SESSION_UPLOAD_ING=710203]="SESSION_UPLOAD_ING",W[W.SESSION_UPLOAD_END=710204]="SESSION_UPLOAD_END",W[W.TASK_UPLOAD_END=710205]="TASK_UPLOAD_END"})(Ke||(Ke={}));class si{constructor(){De(this,"tracker"),De(this,"slsPlugin"),De(this,"stsData"),De(this,"stsExpiration",Date.now()),De(this,"clientId",it()),De(this,"bSesid",it()),De(this,"logLevel",Fe.WARNING),De(this,"appId",""),De(this,"sessionId",""),De(this,"logCache",[]),De(this,"updateTaskTimer"),De(this,"endReported",!0),De(this,"logSequence",0),De(this,"sendLogBeforeUnload",async M=>{if(!this.slsPlugin)return;this.logSequence+=1,M.unshift(this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:`[${Kr()} ${Yt()}] [INF] beforeunload`,stat_log_seq:this.logSequence}));const P=`https://${at.project}.${at.host}/logstores/${at.logstore}`,N={__logs__:M.map(R=>this.slsPlugin.transString(R))},{data:J,header:L}=await this.slsPlugin.process(P,JSON.stringify(N));fetch(P,{keepalive:!0,method:"POST",headers:L,body:J})}),De(this,"logMethod",(M,P=console.log)=>(...N)=>{let J=Yt();this.logLevel<=M&&P(J,...N);let L=Kt.paramArrayToString(N);M>Fe.DEBUG&&this.addLog(L)}),De(this,"d",this.logMethod(Fe.DEBUG,console.debug)),De(this,"i",this.logMethod(Fe.INFO)),De(this,"w",this.logMethod(Fe.WARNING,console.warn)),De(this,"e",this.logMethod(Fe.ERROR,(...M)=>{const[P,...N]=M;console.error(P,"<error>",N)})),De(this,"ev",this.logMethod(Fe.API)),De(this,"a",this.logMethod(Fe.API,(...M)=>{const[P,...N]=M;if(N.length>2){const J=`${N[1]}`;J.startsWith("__g__")&&console.group(`${J.substring(5)}_${N[2]}`)}console.log(P,...N)})),De(this,"ar",this.logMethod(Fe.API,(...M)=>{const[P,...N]=M;console.log(P,...N),N.length>2&&`${N[1]}`.startsWith("__g__")&&console.groupEnd()})),De(this,"ae",this.logMethod(Fe.API,(...M)=>{const[P,...N]=M;console.error(P,"<error>",...N),N.length>2&&`${N[1]}`.startsWith("__g__")&&console.groupEnd()})),window.addEventListener("beforeunload",()=>{this.reportEnd(!0)})}init(){this.reset(),this.startSTSUpdateTask()}destroy(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer)}reset(){this.bSesid=it(),this.endReported=!0,this.logSequence=0,this.appId="",this.sessionId=""}async startSTSUpdateTask(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer);try{const M=await this.refreshSTSToken();this.createTracker(M)}catch{}this.updateTaskTimer=setTimeout(()=>{this.startSTSUpdateTask()},ot)}async refreshSTSToken(){if(!this.stsData||this.stsExpiration<=Date.now()-ot){const M=await this.requestSTSToken(),P=new Date(M?.Expiration).getTime()||0,N=Date.now()+ot;this.stsExpiration=Math.max(P,N),this.stsData=M}return this.stsData}requestSTSToken(){const M=Date.now(),P=`${this.clientId}|${oi}|${M}`,N={Action:"AssumeSlsRoleV2",AuthInfo:Ze.MD5(P).toString(Ze.enc.Hex),ClientId:this.clientId,BusinessType:"logger",AppVersion:"1.0",Version:"2017-03-14",AuthTimestamp:`${M}`,TerminalType:"web",DeviceModel:"",Format:"JSON",SignatureMethod:"HMAC-SHA1",SignatureVersion:"1.0",Timestamp:zt(M,"isoUtcDateTime")},J=`https://slsrole.alicdn.com/?${new URLSearchParams(N).toString()}`;return fetch(J).then(L=>L.json()).then(L=>JSON.parse(window.atob(L.SlsAuthResult)))}createTracker(M){if(!this.tracker){const P={accessKeyId:M.AccessKeyId,accessKeySecret:M.AccessKeySecret,securityToken:M.SecurityToken,refreshSTSTokenInterval:ot,stsTokenFreshTime:void 0,refreshSTSToken:()=>{this.refreshSTSToken().then(L=>{P.accessKeyId=L.AccessKeyId,P.accessKeySecret=L.AccessKeySecret,P.securityToken=L.SecurityToken}).catch(()=>{})}},N=new er(at),J=Fr(P);N.useStsPlugin(J),this.slsPlugin=J,this.tracker=N,this.reportStartAndCache()}}changeConfig(M){M.logLevel!==void 0&&M.logLevel>=Fe.DEBUG&&M.logLevel<=Fe.NONE&&(this.logLevel=M.logLevel)}setSessionID(M,P){!M||!P||(this.appId=M,this.sessionId=P,this.reportStartAndCache())}reportStartAndCache(){if(!this.tracker||!this.sessionId)return;this.endReported=!1;const M={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},P=[this.getLogParams(Ke.TASK_UPLOAD_BEGIN,M),this.getLogParams(Ke.SESSION_UPLOAD_BEGIN,M)];this.tracker.sendBatchLogsImmediate(P),this.logCache.forEach(N=>{this.sendLog(N)})}reportEnd(M=!1){if(!this.tracker||!this.sessionId||this.endReported){this.reset();return}const P={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},N=[this.getLogParams(Ke.SESSION_UPLOAD_END,P),this.getLogParams(Ke.TASK_UPLOAD_END,P)];M?this.sendLogBeforeUnload(N):(this.tracker.sendBatchLogsImmediate(N),this.endReported=!0),this.reset()}getLogParams(M,P){return{appid:`${window.location.host}`,appid_list:this.appId,appver:"",b_sesid:this.bSesid,biz_type:"rtc",cpu_info:ii,db:qr.browserName,dm:qr.browserVersion,install_uuid:this.clientId,logger_v:"0.0.1",os:Yr.systemName,osv:Yr.systemVersion,p_sesid:this.bSesid,sdk_version:zr,sdkname:"AliRTCSdk",stm:Date.now(),tar_pf:"web",traceid:this.sessionId,event_id:M,...P||{}}}sendLog(M){if(!this.tracker||!this.sessionId)return;this.logSequence+=1;const P=this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:M,stat_log_seq:this.logSequence});this.tracker.send(P)}addLog(M){const P=Yt(),N=`[${Kr()} ${P}] ${M}`;!this.sessionId||!this.tracker?(this.logCache.push(N),this.logCache.length>=ai&&this.logCache.shift()):this.sendLog(N)}}var ci=Object.defineProperty,ui=(W,M,P)=>M in W?ci(W,M,{enumerable:!0,configurable:!0,writable:!0,value:P}):W[M]=P,di=(W,M,P)=>ui(W,M+"",P);class et{static getLogger(){return this.logger||(this.logger=new si),this.logger}static init(){this.getLogger().init()}static destroy(){this.getLogger().destroy()}static setLogLevel(M){this.getLogger().changeConfig({logLevel:M})}static setSessionID(M,P){this.getLogger().setSessionID(M,P)}static reportEnd(){this.getLogger().reportEnd()}static interface(...M){this.getLogger().a("[API]",...M)}static interfaceResult(M,P,N,...J){N?this.getLogger().ar("[ARE]",M,P,...J):this.getLogger().ae("[ARE]",M,P,...J)}static event(...M){this.getLogger().ev("[EVT]",...M)}static debug(...M){this.getLogger().d("[DBG]",...M)}static info(...M){this.getLogger().i("[INF]",...M)}static warn(...M){this.getLogger().w("[WARN]",...M)}static error(...M){this.getLogger().e("[ERR]",...M)}}di(et,"logger");var li=Object.defineProperty,pi=(W,M,P)=>M in W?li(W,M,{enumerable:!0,configurable:!0,writable:!0,value:P}):W[M]=P,Qe=(W,M,P)=>pi(W,typeof M!="symbol"?M+"":M,P);const Xr=48e3,tt="[AliyunAudio3A] ";class fi extends Qr{constructor(M){super("AliRtcAudioProcessPlugin",$r.AliRtcSdkStreamTypeCapture,Zr.AUDIO),Qe(this,"audioProcessor"),Qe(this,"slsReporter"),Qe(this,"enableSoft3ACheck",!1),Qe(this,"lastDiffOutputLog",""),Qe(this,"audioContext",new AudioContext({sampleRate:Xr})),Qe(this,"farNode"),Qe(this,"createNode",P=>this.audioContext.createMediaStreamSource(new MediaStream([P]))),this.options=M,this.slsReporter=M?.slsReporter,this.enableSoft3ACheck=M?.enableSoft3ACheck||!1,this.zIndex=7,document.addEventListener("click",this.activeAudioContext)}activeAudioContext(){this.audioContext.resume(),document.removeEventListener("click",this.activeAudioContext)}audioUpdated(M){return this.lastInputAudioTrack?.id!==M.currentAudioTrack?.id}videoUpdated(M){return console.log("videoUpdated",M),!1}setOptions(M){this.farNode||!M.farMediaStream||(this.farNode=this.audioContext.createMediaStreamSource(M.farMediaStream),this.audioProcessor&&this.audioProcessor?.addFarNode(this.farNode),this.options={...this.options,...M})}isSupported(){return Qt.isSupported()}shouldUpdate(M){return!!(M.originAudioTrack&&!this.audioProcessor||!M.originAudioTrack&&this.audioProcessor)}async process(M){if(!M.currentAudioTrack){M.updateAudioTrack(),this.clear(M);return}if(!this.audioProcessor){et.info(tt,"create audio processor this.options:",this.options),this.audioProcessor=new Qt({aecOn:!0,ansOn:!0,agcOn:!0,dumpOn:this.options?.dumpAudioData||!1,aiaecOn:this.options.aiaecOn||!1,wasmCdnPath:this.options.wasmCdnPath||"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.6/"}),this.audioProcessor.on("dumpdata",(N,J)=>{let L=3e3;J.includes("far")?L=5e3:J.includes("output")?L=1e4:J.includes("meta")&&(L=8e3),setTimeout(()=>{const R=URL.createObjectURL(N),x=document.createElement("a");x.href=R,x.download=J,document.body.appendChild(x),x.click(),document.body.removeChild(x)},L)}),this.audioProcessor.on("loadsuccess",()=>{et.info(tt,"loadsuccess"),this.enableSoft3ACheck||M.updateAudioTrack(this.audioProcessor?.targetMediaTrack),this.options.dumpAudioData&&this.audioProcessor?.startDump()}),this.audioProcessor.on("loaderror",N=>{et.error(tt,"loaderror:",N?.message),this.emit("error",N)}),this.audioProcessor.on("outputlog",N=>{console.log(tt,"outputlog:",N),N?.includes("diff")&&(this.lastDiffOutputLog=N||"")}),this.audioProcessor.on("statdata",N=>{if(N)try{let J=N;if(this.lastDiffOutputLog){const L=this.extractDiffValue(this.lastDiffOutputLog),R=JSON.parse(N);L!==null&&(R.diff=L);const x=this.extractLeakValue(this.lastDiffOutputLog);x!==null&&(R.leak=x),J=JSON.stringify(R)}this.slsReporter?.reportPublishAudio3A("","","",J)}catch(J){et.error(tt,"statdata error:",J)}});const P=this.createNode(M.currentAudioTrack);await this.audioProcessor.createProcessor(this.audioContext,P,1,Xr,this.farNode)}}extractDiffValue(M){if(!M)return null;const P=M.match(/diff\s*=\s*(-?\d+\.?\d*)/);return P?parseFloat(P[1]):null}extractLeakValue(M){if(!M)return null;const P=M.match(/leak\s*=\s*(-?\d+\.?\d*)/);return P?parseFloat(P[1]):null}clear(M){this.options.dumpAudioData&&this.audioProcessor?.stopDump(),super.clear(M),this.audioProcessor?.destroy(),this.audioProcessor=void 0,document.removeEventListener("click",this.activeAudioContext),this.farNode?.disconnect(),this.farNode=void 0}dump(){this.audioProcessor?.stopDump()}}export{fi as default};
159
+ `);O.RTCSessionDescription&&X instanceof O.RTCSessionDescription?arguments[0]=new O.RTCSessionDescription({type:X.type,sdp:Z}):X.sdp=Z}return Y.apply(this,arguments)}}function He(O,K){if(!O.RTCPeerConnection||!O.RTCPeerConnection.prototype)return;const Y=O.RTCPeerConnection.prototype.addIceCandidate;Y&&Y.length!==0&&(O.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(K.browser==="chrome"&&K.version<78||K.browser==="firefox"&&K.version<68||K.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():Y.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}const We=function({window:O}={},K={shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0}){const Y=s,X=function(te){const Q={browser:null,version:null};if(te===void 0||!te.navigator)return Q.browser="Not a browser.",Q;const{navigator:oe}=te;if(oe.mozGetUserMedia)Q.browser="firefox",Q.version=p(oe.userAgent,/Firefox\/(\d+)\./,1);else if(oe.webkitGetUserMedia||te.isSecureContext===!1&&te.webkitRTCPeerConnection&&!te.RTCIceGatherer)Q.browser="chrome",Q.version=p(oe.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(oe.mediaDevices&&oe.userAgent.match(/Edge\/(\d+).(\d+)$/))Q.browser="edge",Q.version=p(oe.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!te.RTCPeerConnection||!oe.userAgent.match(/AppleWebKit\/(\d+)\./))return Q.browser="Not a supported browser.",Q;Q.browser="safari",Q.version=p(oe.userAgent,/AppleWebKit\/(\d+)\./,1),Q.supportsUnifiedPlan=te.RTCRtpTransceiver&&"currentDirection"in te.RTCRtpTransceiver.prototype}return Q}(O),Z={browserDetails:X,commonShim:f,extractVersion:p,disableLog:r,disableWarnings:n};switch(X.browser){case"chrome":if(!v||!w||!K.shimChrome)return Y("Chrome shim is not included in this adapter release."),Z;if(X.version===null)return Y("Chrome shim can not determine version, not shimming."),Z;Y("adapter.js shimming chrome."),Z.browserShim=v,He(O,X),h(O,X),g(O),w(O,X),m(O),A(O,X),T(O),C(O),D(O),j(O,X),we(O),Pe(O),Ce(O,X),Ae(O),Oe(O,X);break;case"firefox":if(!u||!z||!K.shimFirefox)return Y("Firefox shim is not included in this adapter release."),Z;Y("adapter.js shimming firefox."),Z.browserShim=u,He(O,X),V(O,X),z(O,X),q(O),ee(O),$(O),re(O),ie(O),se(O),ce(O),ue(O),de(O),we(O),Pe(O),Ce(O,X),Ae(O);break;case"edge":if(!c||!B||!K.shimEdge)return Y("MS edge shim is not included in this adapter release."),Z;Y("adapter.js shimming edge."),Z.browserShim=c,F(O),U(O),B(O,X),k(O),Ce(O,X),Ae(O);break;case"safari":if(!S||!K.shimSafari)return Y("Safari shim is not included in this adapter release."),Z;Y("adapter.js shimming safari."),Z.browserShim=S,He(O,X),ge(O),Re(O),he(O),pe(O),Ee(O),_e(O),fe(O),Te(O),we(O),Ce(O,X),Ae(O),Oe(O,X);break;default:Y("Unsupported browser!")}return Z}({window:typeof window>"u"?void 0:window}),xe=We},6834:(L,R,x)=>{x.r(R),x.d(R,{default:()=>u});var v=x(5512),c=x.n(v);function u(){return c()('/*! aliyun rts sdk - ver2.12.5 created:2025/6/6 14:17:23 */(()=>{"use strict";var e={917:(e,r)=>{var t,n,a,o;Object.defineProperty(r,"__esModule",{value:!0}),r.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=r.DEFAULT_HEARTBEAT_TIMEOUT=r.DEFAULT_RETRY_PUBLISH_INTERVAL=r.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=r.DEFAULT_RETRY_PUBLISH_LIMIT=r.DEFAULT_RETRY_SUBSCRIBE_LIMIT=r.EWorkerAction=r.EWorkerSource=r.EConnectStatus=r.TrackType=void 0,function(e){e.AUDIO="audio",e.VIDEO="video"}(t||(r.TrackType=t={})),function(e){e[e.CONNECT_STATUS_DISCONNECTED=0]="CONNECT_STATUS_DISCONNECTED",e[e.CONNECT_STATUS_CONNECTING=1]="CONNECT_STATUS_CONNECTING",e[e.CONNECT_STATUS_CONNECTED=2]="CONNECT_STATUS_CONNECTED",e[e.CONNECT_STATUS_RECONNECTING=3]="CONNECT_STATUS_RECONNECTING"}(n||(r.EConnectStatus=n={})),function(e){e.Sender="sender",e.Receiver="receiver"}(a||(r.EWorkerSource=a={})),function(e){e.Setup="setup",e.InserSEI="insertSEI"}(o||(r.EWorkerAction=o={})),r.DEFAULT_RETRY_SUBSCRIBE_LIMIT=5,r.DEFAULT_RETRY_PUBLISH_LIMIT=5,r.DEFAULT_RETRY_SUBSCRIBE_INTERVAL=2e3,r.DEFAULT_RETRY_PUBLISH_INTERVAL=2e3,r.DEFAULT_HEARTBEAT_TIMEOUT=8,r.DEFAULT_RETRY_DATACHANNEL_TIMEOUT=8e3},594:(e,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.readUUID=r.discardEPB=r.insertEPB=r.SODBtoRBSP=r.convertPayloadSize=r.NALU=r.SEI=r.parseSei=r.insertSei=void 0;r.insertSei=function(e,r,a,o){void 0===a&&(a=5);for(var i=e.data,u=new DataView(i),c=0;;){if(1===u.getUint32(c)){u.getUint8(c+4);var s=new t(r,a,o).buffer,f=new n(s).buffer,T=new ArrayBuffer(f.byteLength+i.byteLength),E=new Uint8Array(T),l=new Uint8Array(f);E.set(l);var d=new Uint8Array(i);E.set(d,f.byteLength),e.data=T,c+=1;break}if((c+=1)+4>=u.byteLength)break}};r.parseSei=function(e){for(var t=[],n=new DataView(e),a=0;;){var o=a,i=n.getUint32(o);if(o+=4,1===i){if(6===(31&n.getUint8(o++))){for(var u=n.getUint8(o++),c=5===u?16:0,s=0;255==n.getUint8(o);)o++,s+=255;if((s+=n.getUint8(o++))>0&&n.byteLength>o+s){var f=new Uint8Array(n.buffer),T="";if(5===u){var E=f.slice(o,o+c);T=(0,r.readUUID)((0,r.discardEPB)(E))}var l=f.slice(o+c,o+s);o+=s,t.push({payloadType:u,uuid:T,data:l.buffer})}}a=o}else a+=1;if(a+4>=n.byteLength)break}return t};var t=function(e,t,n){void 0===t&&(t=5);var a=5===t?16:0,o=e.byteLength+a,i=(0,r.convertPayloadSize)(o),u=i.buffer.byteLength,c=new ArrayBuffer(1+u+a+e.byteLength),s=new Uint8Array(c),f=0;if(s[f++]=t,s.set(i,f),f+=i.byteLength,5===t){n=(n||"00000000-0000-0000-0000-000000000000").replace(/-/g,"");for(var T=0;T<16;T++)s[f+T]=parseInt(n.substr(2*T,2),16);f+=16}var E=new Uint8Array(e);s.set(E,f);var l=(0,r.SODBtoRBSP)(s);this.buffer=l.buffer};r.SEI=t;var n=function(e){var r=new Uint8Array([0,0,0,1]),t=new Uint8Array([6]),n=new ArrayBuffer(r.byteLength+t.byteLength+e.byteLength),a=new Uint8Array(n);a.set(r),a.set(t,r.byteLength),a.set(new Uint8Array(e),r.byteLength+t.byteLength),this.buffer=n};r.NALU=n;r.convertPayloadSize=function(e){if(e<=0)throw new Error("payloadSize must be a positive integer.");for(var r=Math.ceil(e/255),t=new ArrayBuffer(r),n=new DataView(t),a=0;a<r-1;a++)n.setUint8(a,255);return n.setUint8(r-1,e%255&255),new Uint8Array(t)};r.SODBtoRBSP=function(e){for(var t=new Uint8Array(e),n="",a=0;a<t.length;a++)n+=t[a].toString(2).padStart(8,"0");for(n+="1";n.length%8!=0;)n+="0";var o=n.length/8,i=new Uint8Array(o);for(a=0;a<o;a++)i[a]=parseInt(n.slice(8*a,8*a+8),2);return(0,r.insertEPB)(i)};r.insertEPB=function(e){for(var r=[],t=0,n=0;n<e.length;n++)r.push(e[n]),0===e[n]?2===++t&&n<e.length-1&&e[n+1]<=3&&(r.push(3),t=0):t=0;return new Uint8Array(r)};r.discardEPB=function(e){for(var r=e.byteLength,t=[],n=1;n<r-2;)0===e[n]&&0===e[n+1]&&3===e[n+2]?(t.push(n+2),n+=2):n++;if(0===t.length)return e;var a=r-t.length,o=new Uint8Array(a),i=0;for(n=0;n<a;i++,n++)i===t[0]&&(i++,t.shift()),o[n]=e[i];return o};r.readUUID=function(e){if(16!==e.length)throw new Error("UUID must be 16 bytes long.");var r=e.reduce((function(e,r){return e+r.toString(16).padStart(2,"0")}),"");return"".concat(r.slice(0,8),"-").concat(r.slice(8,12),"-").concat(r.slice(12,16),"-").concat(r.slice(16,20),"-").concat(r.slice(20))}},718:function(e,r){var t=this&&this.__spreadArray||function(e,r,t){if(t||2===arguments.length)for(var n,a=0,o=r.length;a<o;a++)!n&&a in r||(n||(n=Array.prototype.slice.call(r,0,a)),n[a]=r[a]);return e.concat(n||Array.prototype.slice.call(r))};Object.defineProperty(r,"__esModule",{value:!0}),r.hebtLog=r.createUUID=r.evaluateNetworkCondition=r.makeCancelable=r.hasVideoTrack=r.hasAudioTrack=r.getVideoTrack=r.getAudioTrack=r.pruneSubUrl=r.getJitterBufferDelayAvg=void 0;r.getJitterBufferDelayAvg=function(e,r){return e&&r?Number(e)/Number(r)*1e3:-1};r.pruneSubUrl=function(e,r){var t=e||"";return t=t.replace("@subaudio=no","").replace("@subvideo=no",""),r&&(t=t.split("?")[0]),t};r.getAudioTrack=function(e){return e.getAudioTracks()[0]};r.getVideoTrack=function(e){return e.getVideoTracks()[0]};r.hasAudioTrack=function(e){return e.getAudioTracks().length>0};r.hasVideoTrack=function(e){return e.getVideoTracks().length>0};r.makeCancelable=function(e){var r=!1;return{promise:new Promise((function(t,n){e.then((function(e){return r?n({isCanceled:!0}):t(e)})),e.catch((function(e){return n(r?{isCanceled:!0}:e)}))})),cancel:function(){r=!0}}};r.evaluateNetworkCondition=function(e,r,t,n,a){var o=0;if(!navigator.onLine)return o=6;var i=[{loss:0,rtt:0,jbd:1},{loss:0,rtt:1,jbd:0},{loss:0,rtt:.5,jbd:.5},{loss:1,rtt:0,jbd:0},{loss:.8,rtt:0,jbd:.2},{loss:.8,rtt:.2,jbd:0},{loss:.6,rtt:.2,jbd:.2}],u=-1,c=-1,s=-1;if("number"==typeof r&&r>=0||"number"==typeof t&&t>=0){u=0;var f=!1,T=!1;"number"==typeof r&&r>=0&&(u+=r,f=!0),"number"==typeof t&&t>=0&&(u+=t,T=!0),f&&!T&&(u*=2),T&&!f&&(u*=1.8)}if("number"==typeof e&&e>=0&&(s=e),"number"==typeof n&&n>=0||"number"==typeof a&&a>=0){c=0;"number"==typeof n&&n>=0&&(c+=n),"number"==typeof a&&a>=0&&(c+=a)}var E;if((E=4*(-1!==u?1:0)+2*(-1!==s?1:0)+(-1!==c?1:0))>0){var l=1.2*u*i[E-1].loss+s/1500*i[E-1].rtt+c/3e3*i[E-1].jbd;o=l<=.1?1:l<=.23?2:l<=.36?3:l<=.49?4:5}else o=0;return o};r.createUUID=function(e,r){var t,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),a=[];if(r=r||n.length,e)for(t=0;t<e;t++)a[t]=n[0|Math.random()*r];else{var o=void 0;for(a[8]=a[13]=a[18]=a[23]="-",a[14]="4",t=0;t<36;t++)a[t]||(o=0|16*Math.random(),a[t]=n[19==t?3&o|8:o])}return a.join("")};r.hebtLog=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];window.RTS_HEBT_DEBUG&&console.log.apply(console,t(["[rts hebt]"],e,!1))}}},r={};function t(n){var a=r[n];if(void 0!==a)return a.exports;var o=r[n]={exports:{}};return e[n].call(o.exports,o,o.exports,t),o.exports}var n,a,o,i,u,c,s;a=t(594),o=t(718),i=t(917),u=self,c=function(e,r,t,o){if(e===i.EWorkerSource.Sender){var u=new TransformStream({transform:function(e,r){e.type&&(n&&((0,a.insertSei)(e,n.sei,n.payloadType,n.uuid),void 0===n.repeatCount?n=null:-1!==n.repeatCount&&(n.repeatCount--,n.repeatCount<0&&(n=null))),o&&o(e)),r.enqueue(e)}});r.pipeThrough(u).pipeTo(t)}else e===i.EWorkerSource.Receiver&&(u=new TransformStream({transform:function(e,r){e.type&&o&&o(e),r.enqueue(e)}}),r.pipeThrough(u).pipeTo(t))},s=function(e){var r=e.data.slice(0);u.postMessage({type:"encodedFrame",data:r,frameInfo:{type:e.type,timestamp:e.timestamp}},[r]),r=null},u.RTCTransformEvent&&(u.onrtctransform=function(e){var r=e.transformer,t=r.options.source,n=r.readable,a=r.writable;c(t,n,a,(function(e){t===i.EWorkerSource.Receiver&&s(e)}))}),onmessage=function(e){switch(e.data.operation){case i.EWorkerAction.Setup:r=e.data,t=r.source,a=r.readable,u=r.writable,c(t,a,u,(function(e){t===i.EWorkerSource.Receiver&&s(e)}));break;case i.EWorkerAction.InserSEI:!function(e){(n=e)&&(n.uuid=(0,o.createUUID)().toLowerCase(),n.repeatCount=n.repeatCount||0)}(e.data)}var r,t,a,u}})();',"Worker",void 0,void 0)}},5512:L=>{L.exports=function(R,x,v,c){var u=self||window;try{try{var S;try{S=new u.Blob([R])}catch{(S=new(u.BlobBuilder||u.WebKitBlobBuilder||u.MozBlobBuilder||u.MSBlobBuilder)).append(R),S=S.getBlob()}var f=u.URL||u.webkitURL,a=f.createObjectURL(S),d=new u[x](a,v);return f.revokeObjectURL(a),d}catch{return new u[x]("data:application/javascript,".concat(encodeURIComponent(R)),v)}}catch{if(!c)throw Error("Inline worker is not supported");return new u[x](c,v)}}},2632:(L,R,x)=>{x.r(R),x.d(R,{default:()=>p});function v(e,r,n){Object.defineProperty(e,r,{writable:!0,enumerable:!0,configurable:!0,value:n})}Array(32);var c,u,S;class f{constructor(r){var n,s;this.timer=null,this.time=10,this.count=10,this.arr=[],this.time=(n=r.time)!=null?n:10,this.count=(s=r.count)!=null?s:10,r.host.startsWith("http://")||r.host.startsWith("https://")?this.url=r.host+"/logstores/"+r.logstore+"/track":this.url="https://"+r.project+"."+r.host+"/logstores/"+r.logstore+"/track",this.opt=r,r.installUnloadHook&&typeof r.installUnloadHook=="function"&&r.installUnloadHook(()=>{this.sendImmediateInner()})}assemblePayload(r=this.arr){const n={__logs__:r};return this.opt.tags&&(n.__tags__=this.opt.tags),this.opt.topic&&(n.__topic__=this.opt.topic),this.opt.source&&(n.__source__=this.opt.source),JSON.stringify(n)}platformSend(){if(this.opt.sendPayload&&typeof this.opt.sendPayload=="function"){const r=this.assemblePayload();this.opt.sendPayload(this.url,r)}}transString(r){let n={};for(let s in r)typeof r[s]=="object"?n[s]=JSON.stringify(r[s]):n[s]=String(r[s]);return n}sendImmediateInner(){this.arr&&this.arr.length>0&&(this.platformSend(),this.timer!=null&&(clearTimeout(this.timer),this.timer=null),this.arr=[])}sendInner(){if(this.timer)this.arr.length>=this.count&&(clearTimeout(this.timer),this.timer=null,this.sendImmediateInner());else{const r=this;this.arr.length>=this.count||this.time<=0?this.sendImmediateInner():this.timer=setTimeout(function(){r.sendImmediateInner()},1e3*this.time)}}send(r){const n=this.transString(r);this.arr.push(n),this.sendInner()}sendImmediate(r){const n=this.transString(r);this.arr.push(n),this.sendImmediateInner()}sendBatchLogs(r){const n=r.map(s=>this.transString(s));this.arr.push(...n),this.sendInner()}sendBatchLogsImmediate(r){const n=r.map(s=>this.transString(s));this.arr.push(...n),this.sendImmediateInner()}}function a(e,r){const n=new window.XMLHttpRequest;n.open("POST",`${e}?APIVersion=0.6.0`,!0),n.send(r)}function d(e,r){try{if(r.length>=32768)return void a(e,r);(function(n,s){return!(!navigator||!navigator.sendBeacon)&&navigator.sendBeacon(`${n}?APIVersion=0.6.0`,s)})(e,r)||a(e,r)}catch(n){window&&window.console&&typeof window.console.error=="function"&&(console.error(`Failed to log to ali log service because of this exception:
160
+ `+n),console.error("Failed log data:",e))}}class p extends f{constructor(r){super(Object.assign({},r,{installUnloadHook:n=>{window.addEventListener("beforeunload",()=>{n()})},sendPayload:(n,s)=>{d(n,s)}}))}}c=window,u="SLS_Tracker",S=p,v(c,u,S)},4198:L=>{L.exports=JSON.parse('{"name":"axios","version":"0.21.4","description":"Promise based HTTP client for the browser and node.js","main":"index.js","scripts":{"test":"grunt test","start":"node ./sandbox/server.js","build":"NODE_ENV=production grunt build","preversion":"npm test","version":"npm run build && grunt version && git add -A dist && git add CHANGELOG.md bower.json package.json","postversion":"git push && git push --tags","examples":"node ./examples/server.js","coveralls":"cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js","fix":"eslint --fix lib/**/*.js"},"repository":{"type":"git","url":"https://github.com/axios/axios.git"},"keywords":["xhr","http","ajax","promise","node"],"author":"Matt Zabriskie","license":"MIT","bugs":{"url":"https://github.com/axios/axios/issues"},"homepage":"https://axios-http.com","devDependencies":{"coveralls":"^3.0.0","es6-promise":"^4.2.4","grunt":"^1.3.0","grunt-banner":"^0.6.0","grunt-cli":"^1.2.0","grunt-contrib-clean":"^1.1.0","grunt-contrib-watch":"^1.0.0","grunt-eslint":"^23.0.0","grunt-karma":"^4.0.0","grunt-mocha-test":"^0.13.3","grunt-ts":"^6.0.0-beta.19","grunt-webpack":"^4.0.2","istanbul-instrumenter-loader":"^1.0.0","jasmine-core":"^2.4.1","karma":"^6.3.2","karma-chrome-launcher":"^3.1.0","karma-firefox-launcher":"^2.1.0","karma-jasmine":"^1.1.1","karma-jasmine-ajax":"^0.1.13","karma-safari-launcher":"^1.0.0","karma-sauce-launcher":"^4.3.6","karma-sinon":"^1.0.5","karma-sourcemap-loader":"^0.3.8","karma-webpack":"^4.0.2","load-grunt-tasks":"^3.5.2","minimist":"^1.2.0","mocha":"^8.2.1","sinon":"^4.5.0","terser-webpack-plugin":"^4.2.3","typescript":"^4.0.5","url-search-params":"^0.10.0","webpack":"^4.44.2","webpack-dev-server":"^3.11.0"},"browser":{"./lib/adapters/http.js":"./lib/adapters/xhr.js"},"jsdelivr":"dist/axios.min.js","unpkg":"dist/axios.min.js","typings":"./index.d.ts","dependencies":{"follow-redirects":"^1.14.0"},"bundlesize":[{"path":"./dist/axios.min.js","threshold":"5kB"}]}')}},N={};function J(L){var R=N[L];if(R!==void 0)return R.exports;var x=N[L]={exports:{}};return P[L].call(x.exports,x,x.exports,J),x.exports}return J.n=L=>{var R=L&&L.__esModule?()=>L.default:()=>L;return J.d(R,{a:R}),R},J.d=(L,R)=>{for(var x in R)J.o(R,x)&&!J.o(L,x)&&Object.defineProperty(L,x,{enumerable:!0,get:R[x]})},J.o=(L,R)=>Object.prototype.hasOwnProperty.call(L,R),J.r=L=>{typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(L,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(L,"__esModule",{value:!0})},J(8156)})())})(Hr);for(var jn=Hr.exports,Be=[],Gt=0;Gt<256;++Gt)Be.push((Gt+256).toString(16).slice(1));function Wn(W,M=0){return(Be[W[M+0]]+Be[W[M+1]]+Be[W[M+2]]+Be[W[M+3]]+"-"+Be[W[M+4]]+Be[W[M+5]]+"-"+Be[W[M+6]]+Be[W[M+7]]+"-"+Be[W[M+8]]+Be[W[M+9]]+"-"+Be[W[M+10]]+Be[W[M+11]]+Be[W[M+12]]+Be[W[M+13]]+Be[W[M+14]]+Be[W[M+15]]).toLowerCase()}var nt,Gn=new Uint8Array(16);function zn(){if(!nt&&(nt=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!nt))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return nt(Gn)}var qn=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Vr={randomUUID:qn};function it(W,M,P){if(Vr.randomUUID&&!M&&!W)return Vr.randomUUID();W=W||{};var N=W.random||(W.rng||zn)();return N[6]=N[6]&15|64,N[8]=N[8]&63|128,Wn(N)}var Yn=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,Kn=/\b(?:[A-Z]{1,3}[A-Z][TC])(?:[-+]\d{4})?|((?:Australian )?(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time)\b/g,Xn=/[^-+\dA-Z]/g;function zt(W,M,P,N){if(arguments.length===1&&typeof W=="string"&&!/\d/.test(W)&&(M=W,W=void 0),W=W||W===0?W:new Date,W instanceof Date||(W=new Date(W)),isNaN(W))throw TypeError("Invalid date");M=String(jr[M]||M||jr.default);var J=M.slice(0,4);(J==="UTC:"||J==="GMT:")&&(M=M.slice(4),P=!0,J==="GMT:"&&(N=!0));var L=function(){return P?"getUTC":"get"},R=function(){return W[L()+"Date"]()},x=function(){return W[L()+"Day"]()},v=function(){return W[L()+"Month"]()},c=function(){return W[L()+"FullYear"]()},u=function(){return W[L()+"Hours"]()},S=function(){return W[L()+"Minutes"]()},f=function(){return W[L()+"Seconds"]()},a=function(){return W[L()+"Milliseconds"]()},d=function(){return P?0:W.getTimezoneOffset()},p=function(){return Jn(W)},e=function(){return Qn(W)},r={d:function(){return R()},dd:function(){return Ve(R())},ddd:function(){return Ue.dayNames[x()]},DDD:function(){return Wr({y:c(),m:v(),d:R(),_:L(),dayName:Ue.dayNames[x()],short:!0})},dddd:function(){return Ue.dayNames[x()+7]},DDDD:function(){return Wr({y:c(),m:v(),d:R(),_:L(),dayName:Ue.dayNames[x()+7]})},m:function(){return v()+1},mm:function(){return Ve(v()+1)},mmm:function(){return Ue.monthNames[v()]},mmmm:function(){return Ue.monthNames[v()+12]},yy:function(){return String(c()).slice(2)},yyyy:function(){return Ve(c(),4)},h:function(){return u()%12||12},hh:function(){return Ve(u()%12||12)},H:function(){return u()},HH:function(){return Ve(u())},M:function(){return S()},MM:function(){return Ve(S())},s:function(){return f()},ss:function(){return Ve(f())},l:function(){return Ve(a(),3)},L:function(){return Ve(Math.floor(a()/10))},t:function(){return u()<12?Ue.timeNames[0]:Ue.timeNames[1]},tt:function(){return u()<12?Ue.timeNames[2]:Ue.timeNames[3]},T:function(){return u()<12?Ue.timeNames[4]:Ue.timeNames[5]},TT:function(){return u()<12?Ue.timeNames[6]:Ue.timeNames[7]},Z:function(){return N?"GMT":P?"UTC":$n(W)},o:function(){return(d()>0?"-":"+")+Ve(Math.floor(Math.abs(d())/60)*100+Math.abs(d())%60,4)},p:function(){return(d()>0?"-":"+")+Ve(Math.floor(Math.abs(d())/60),2)+":"+Ve(Math.floor(Math.abs(d())%60),2)},S:function(){return["th","st","nd","rd"][R()%10>3?0:(R()%100-R()%10!=10)*R()%10]},W:function(){return p()},WW:function(){return Ve(p())},N:function(){return e()}};return M.replace(Yn,function(n){return n in r?r[n]():n.slice(1,n.length-1)})}var jr={default:"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",paddedShortDate:"mm/dd/yyyy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:sso",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'",expiresHeaderFormat:"ddd, dd mmm yyyy HH:MM:ss Z"},Ue={dayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],monthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec","January","February","March","April","May","June","July","August","September","October","November","December"],timeNames:["a","p","am","pm","A","P","AM","PM"]},Ve=function(M){var P=arguments.length>1&&arguments[1]!==void 0?arguments[1]:2;return String(M).padStart(P,"0")},Wr=function(M){var P=M.y,N=M.m,J=M.d,L=M._,R=M.dayName,x=M.short,v=x===void 0?!1:x,c=new Date,u=new Date;u.setDate(u[L+"Date"]()-1);var S=new Date;S.setDate(S[L+"Date"]()+1);var f=function(){return c[L+"Date"]()},a=function(){return c[L+"Month"]()},d=function(){return c[L+"FullYear"]()},p=function(){return u[L+"Date"]()},e=function(){return u[L+"Month"]()},r=function(){return u[L+"FullYear"]()},n=function(){return S[L+"Date"]()},s=function(){return S[L+"Month"]()},t=function(){return S[L+"FullYear"]()};return d()===P&&a()===N&&f()===J?v?"Tdy":"Today":r()===P&&e()===N&&p()===J?v?"Ysd":"Yesterday":t()===P&&s()===N&&n()===J?v?"Tmw":"Tomorrow":R},Jn=function(M){var P=new Date(M.getFullYear(),M.getMonth(),M.getDate());P.setDate(P.getDate()-(P.getDay()+6)%7+3);var N=new Date(P.getFullYear(),0,4);N.setDate(N.getDate()-(N.getDay()+6)%7+3);var J=P.getTimezoneOffset()-N.getTimezoneOffset();P.setHours(P.getHours()-J);var L=(P-N)/(864e5*7);return 1+Math.floor(L)},Qn=function(M){var P=M.getDay();return P===0&&(P=7),P},$n=function(M){return(String(M).match(Kn)||[""]).pop().replace(Xn,"").replace(/GMT\+0000/g,"UTC")},qt;(function(W){W.prod="rs.rtn.aliyuncs.com",W.pre="prs.rtn.aliyuncs.com"})(qt||(qt={}));var Gr;(function(W){W[W.ByClient=0]="ByClient",W[W.KickOut=1]="KickOut",W[W.ChannelClosed=2]="ChannelClosed",W[W.Restore=3]="Restore",W[W.Expired=4]="Expired",W[W.Reconnect=5]="Reconnect",W[W.ReconnectExhausted=6]="ReconnectExhausted"})(Gr||(Gr={}));const zr="7.1.2";class Kt{static getVersionNumber(){let M=zr.split("."),P="";return M.forEach(N=>{N.length===1?P+="0"+N:P+=N}),parseInt(P)}static queryingParam(M){let P=[];if(M)for(let N in M)P.push(N+"="+M[N]);return P.join("&")}static getQueryParams(M){const P=window.location.search.substring(1).split("&");for(let N=0;N<P.length;N++){const J=P[N].split("=");if(decodeURIComponent(J[0])===M)return decodeURIComponent(J[1])}}static createCallid(M=""){const P=it();return M&&P&&P.length>M.length?`${M}${P.substring(M.length)}`:P}static checkSubOptionsValid(M){if(M){const{audio:P,video:N,screen:J}=M;if(P===!1&&N===!1&&J===!1)return!1}return!0}static async isNetworkAvailable(){const M=qt.prod,{onLine:P}=navigator;if(!P)return!1;try{return await fetch(`https://${M}/roomserver/v1/ws/version`),!0}catch{return!1}}static toString(M){let P;if(M instanceof Error)P=M.message;else if(typeof M=="string")P=M;else try{P=JSON.stringify(M)}catch{P="undefined"}return P}static paramArrayToString(M){let P="";for(let N=0;N<M.length;N++){P!==""&&(P+=" ");let J=Kt.toString(M[N]);P+=J}return P}}const Zn=(W,M)=>W.find(P=>{if(typeof P.test=="function")return P.test(M);if(Array.isArray(P.test))return P.test.some(N=>typeof N=="string"?M.indexOf(N)>-1:N instanceof RegExp?N.test(M):!1)}),ei=[{test:["wow64","win64","x64"],describe(){return"amd64"}},{test:["i686","x86"],describe(){return"x86"}},{test:["aarch64","arm64"],describe(){return"arm64"}},{test:["arm"],describe(){return"arm"}}],ti=()=>{let W="unknown";try{const M=navigator.userAgent||"",P=Zn(ei,M);if(!P)return W;W=P.describe(M)}catch{}return W};var ri=Object.defineProperty,ni=(W,M,P)=>M in W?ri(W,M,{enumerable:!0,configurable:!0,writable:!0,value:P}):W[M]=P,De=(W,M,P)=>ni(W,typeof M!="symbol"?M+"":M,P);const{BrowserUtil:qr,SystenUtil:Yr}=jn.AliRTS,ii=ti(),oi="woMMssV6jmyol9fr",ai=200,ot=10*60*1e3,at={host:"cn-hangzhou.log.aliyuncs.com",project:"alivc-aio",logstore:"logger",time:10,count:10};function Yt(){return zt(new Date,"HH:MM:ss.l")}function Kr(){return zt(new Date,"isoDate")}var Fe;(function(W){W[W.DEBUG=0]="DEBUG",W[W.INFO=1]="INFO",W[W.API=2]="API",W[W.WARNING=3]="WARNING",W[W.ERROR=4]="ERROR",W[W.NONE=5]="NONE"})(Fe||(Fe={}));var Ke;(function(W){W[W.TASK_UPLOAD_BEGIN=710201]="TASK_UPLOAD_BEGIN",W[W.SESSION_UPLOAD_BEGIN=710202]="SESSION_UPLOAD_BEGIN",W[W.SESSION_UPLOAD_ING=710203]="SESSION_UPLOAD_ING",W[W.SESSION_UPLOAD_END=710204]="SESSION_UPLOAD_END",W[W.TASK_UPLOAD_END=710205]="TASK_UPLOAD_END"})(Ke||(Ke={}));class si{constructor(){De(this,"tracker"),De(this,"slsPlugin"),De(this,"stsData"),De(this,"stsExpiration",Date.now()),De(this,"clientId",it()),De(this,"bSesid",it()),De(this,"logLevel",Fe.WARNING),De(this,"appId",""),De(this,"sessionId",""),De(this,"logCache",[]),De(this,"updateTaskTimer"),De(this,"endReported",!0),De(this,"logSequence",0),De(this,"sendLogBeforeUnload",async M=>{if(!this.slsPlugin)return;this.logSequence+=1,M.unshift(this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:`[${Kr()} ${Yt()}] [INF] beforeunload`,stat_log_seq:this.logSequence}));const P=`https://${at.project}.${at.host}/logstores/${at.logstore}`,N={__logs__:M.map(R=>this.slsPlugin.transString(R))},{data:J,header:L}=await this.slsPlugin.process(P,JSON.stringify(N));fetch(P,{keepalive:!0,method:"POST",headers:L,body:J})}),De(this,"logMethod",(M,P=console.log)=>(...N)=>{let J=Yt();this.logLevel<=M&&P(J,...N);let L=Kt.paramArrayToString(N);M>Fe.DEBUG&&this.addLog(L)}),De(this,"d",this.logMethod(Fe.DEBUG,console.debug)),De(this,"i",this.logMethod(Fe.INFO)),De(this,"w",this.logMethod(Fe.WARNING,console.warn)),De(this,"e",this.logMethod(Fe.ERROR,(...M)=>{const[P,...N]=M;console.error(P,"<error>",N)})),De(this,"ev",this.logMethod(Fe.API)),De(this,"a",this.logMethod(Fe.API,(...M)=>{const[P,...N]=M;if(N.length>2){const J=`${N[1]}`;J.startsWith("__g__")&&console.group(`${J.substring(5)}_${N[2]}`)}console.log(P,...N)})),De(this,"ar",this.logMethod(Fe.API,(...M)=>{const[P,...N]=M;console.log(P,...N),N.length>2&&`${N[1]}`.startsWith("__g__")&&console.groupEnd()})),De(this,"ae",this.logMethod(Fe.API,(...M)=>{const[P,...N]=M;console.error(P,"<error>",...N),N.length>2&&`${N[1]}`.startsWith("__g__")&&console.groupEnd()})),window.addEventListener("beforeunload",()=>{this.reportEnd(!0)})}init(){this.reset(),this.startSTSUpdateTask()}destroy(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer)}reset(){this.bSesid=it(),this.endReported=!0,this.logSequence=0,this.appId="",this.sessionId=""}async startSTSUpdateTask(){this.updateTaskTimer&&clearTimeout(this.updateTaskTimer);try{const M=await this.refreshSTSToken();this.createTracker(M)}catch{}this.updateTaskTimer=setTimeout(()=>{this.startSTSUpdateTask()},ot)}async refreshSTSToken(){if(!this.stsData||this.stsExpiration<=Date.now()-ot){const M=await this.requestSTSToken(),P=new Date(M?.Expiration).getTime()||0,N=Date.now()+ot;this.stsExpiration=Math.max(P,N),this.stsData=M}return this.stsData}requestSTSToken(){const M=Date.now(),P=`${this.clientId}|${oi}|${M}`,N={Action:"AssumeSlsRoleV2",AuthInfo:et.MD5(P).toString(et.enc.Hex),ClientId:this.clientId,BusinessType:"logger",AppVersion:"1.0",Version:"2017-03-14",AuthTimestamp:`${M}`,TerminalType:"web",DeviceModel:"",Format:"JSON",SignatureMethod:"HMAC-SHA1",SignatureVersion:"1.0",Timestamp:zt(M,"isoUtcDateTime")},J=`https://slsrole.alicdn.com/?${new URLSearchParams(N).toString()}`;return fetch(J).then(L=>L.json()).then(L=>JSON.parse(window.atob(L.SlsAuthResult)))}createTracker(M){if(!this.tracker){const P={accessKeyId:M.AccessKeyId,accessKeySecret:M.AccessKeySecret,securityToken:M.SecurityToken,refreshSTSTokenInterval:ot,stsTokenFreshTime:void 0,refreshSTSToken:()=>{this.refreshSTSToken().then(L=>{P.accessKeyId=L.AccessKeyId,P.accessKeySecret=L.AccessKeySecret,P.securityToken=L.SecurityToken}).catch(()=>{})}},N=new er(at),J=Fr(P);N.useStsPlugin(J),this.slsPlugin=J,this.tracker=N,this.reportStartAndCache()}}changeConfig(M){M.logLevel!==void 0&&M.logLevel>=Fe.DEBUG&&M.logLevel<=Fe.NONE&&(this.logLevel=M.logLevel)}setSessionID(M,P){!M||!P||(this.appId=M,this.sessionId=P,this.reportStartAndCache())}reportStartAndCache(){if(!this.tracker||!this.sessionId)return;this.endReported=!1;const M={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},P=[this.getLogParams(Ke.TASK_UPLOAD_BEGIN,M),this.getLogParams(Ke.SESSION_UPLOAD_BEGIN,M)];this.tracker.sendBatchLogsImmediate(P),this.logCache.forEach(N=>{this.sendLog(N)})}reportEnd(M=!1){if(!this.tracker||!this.sessionId||this.endReported){this.reset();return}const P={task_btm_sec:0,task_duration:0,task_etm_sec:0,task_type:"session"},N=[this.getLogParams(Ke.SESSION_UPLOAD_END,P),this.getLogParams(Ke.TASK_UPLOAD_END,P)];M?this.sendLogBeforeUnload(N):(this.tracker.sendBatchLogsImmediate(N),this.endReported=!0),this.reset()}getLogParams(M,P){return{appid:`${window.location.host}`,appid_list:this.appId,appver:"",b_sesid:this.bSesid,biz_type:"rtc",cpu_info:ii,db:qr.browserName,dm:qr.browserVersion,install_uuid:this.clientId,logger_v:"0.0.1",os:Yr.systemName,osv:Yr.systemVersion,p_sesid:this.bSesid,sdk_version:zr,sdkname:"AliRTCSdk",stm:Date.now(),tar_pf:"web",traceid:this.sessionId,event_id:M,...P||{}}}sendLog(M){if(!this.tracker||!this.sessionId)return;this.logSequence+=1;const P=this.getLogParams(Ke.SESSION_UPLOAD_ING,{log:M,stat_log_seq:this.logSequence});this.tracker.send(P)}addLog(M){const P=Yt(),N=`[${Kr()} ${P}] ${M}`;!this.sessionId||!this.tracker?(this.logCache.push(N),this.logCache.length>=ai&&this.logCache.shift()):this.sendLog(N)}}var ci=Object.defineProperty,ui=(W,M,P)=>M in W?ci(W,M,{enumerable:!0,configurable:!0,writable:!0,value:P}):W[M]=P,di=(W,M,P)=>ui(W,M+"",P);class Ze{static getLogger(){return this.logger||(this.logger=new si),this.logger}static init(){this.getLogger().init()}static destroy(){this.getLogger().destroy()}static setLogLevel(M){this.getLogger().changeConfig({logLevel:M})}static setSessionID(M,P){this.getLogger().setSessionID(M,P)}static reportEnd(){this.getLogger().reportEnd()}static interface(...M){this.getLogger().a("[API]",...M)}static interfaceResult(M,P,N,...J){N?this.getLogger().ar("[ARE]",M,P,...J):this.getLogger().ae("[ARE]",M,P,...J)}static event(...M){this.getLogger().ev("[EVT]",...M)}static debug(...M){this.getLogger().d("[DBG]",...M)}static info(...M){this.getLogger().i("[INF]",...M)}static warn(...M){this.getLogger().w("[WARN]",...M)}static error(...M){this.getLogger().e("[ERR]",...M)}}di(Ze,"logger");var li=Object.defineProperty,pi=(W,M,P)=>M in W?li(W,M,{enumerable:!0,configurable:!0,writable:!0,value:P}):W[M]=P,Xe=(W,M,P)=>pi(W,typeof M!="symbol"?M+"":M,P);const Xr=48e3,tt="[AliyunAudio3A] ";class fi extends Qr{constructor(M){super("AliRtcAudioProcessPlugin",$r.AliRtcSdkStreamTypeCapture,Zr.AUDIO),Xe(this,"audioProcessor"),Xe(this,"slsReporter"),Xe(this,"enableSoft3ACheck",!1),Xe(this,"useHardOnly",!1),Xe(this,"lastDiffOutputLog",""),Xe(this,"audioContext",new AudioContext({sampleRate:Xr})),Xe(this,"farNode"),Xe(this,"createNode",P=>this.audioContext.createMediaStreamSource(new MediaStream([P]))),this.options=M,this.slsReporter=M?.slsReporter,this.enableSoft3ACheck=M?.enableSoft3ACheck||!1,this.useHardOnly=M?.useHardOnly||!1,this.zIndex=7,document.addEventListener("click",this.activeAudioContext)}activeAudioContext(){this.audioContext.resume(),document.removeEventListener("click",this.activeAudioContext)}audioUpdated(M){return this.lastInputAudioTrack?.id!==M.currentAudioTrack?.id}videoUpdated(M){return console.log("videoUpdated",M),!1}setOptions(M){this.farNode||!M.farMediaStream||(this.farNode=this.audioContext.createMediaStreamSource(M.farMediaStream),this.audioProcessor&&this.audioProcessor?.addFarNode(this.farNode),this.options={...this.options,...M})}isSupported(){return Qt.isSupported()}shouldUpdate(M){return!!(M.originAudioTrack&&!this.audioProcessor||!M.originAudioTrack&&this.audioProcessor)}async process(M){if(!M.currentAudioTrack){M.updateAudioTrack(),this.clear(M);return}if(!this.audioProcessor){Ze.info(tt,"create audio processor this.options:",this.options),this.audioProcessor=new Qt({aecOn:!0,ansOn:!0,agcOn:!0,dumpOn:this.options?.dumpAudioData||!1,aiaecOn:this.options.aiaecOn||!1,useHardOnly:this.useHardOnly,wasmCdnPath:this.options.wasmCdnPath||"https://g.alicdn.com/code/npm/@ali/aliyun-audio-3a/0.0.6/"}),this.audioProcessor.on("dumpdata",(N,J)=>{let L=3e3;J.includes("far")?L=5e3:J.includes("output")?L=1e4:J.includes("meta")&&(L=8e3),setTimeout(()=>{const R=URL.createObjectURL(N),x=document.createElement("a");x.href=R,x.download=J,document.body.appendChild(x),x.click(),document.body.removeChild(x)},L)}),this.audioProcessor.on("loadsuccess",()=>{Ze.info(tt,"loadsuccess"),this.enableSoft3ACheck||M.updateAudioTrack(this.audioProcessor?.targetMediaTrack),this.options.dumpAudioData&&this.audioProcessor?.startDump()}),this.audioProcessor.on("loaderror",N=>{Ze.error(tt,"loaderror:",N?.message),this.emit("error",N)}),this.audioProcessor.on("outputlog",N=>{Ze.info(tt,"outputlog:",N),N?.includes("diff")&&(this.lastDiffOutputLog=N||"")}),this.audioProcessor.on("statdata",N=>{if(N)try{let J=N;if(this.lastDiffOutputLog){const L=this.extractDiffValue(this.lastDiffOutputLog),R=JSON.parse(N);L!==null&&(R.diff=L);const x=this.extractLeakValue(this.lastDiffOutputLog);x!==null&&(R.leak=x),J=JSON.stringify(R)}this.slsReporter?.reportPublishAudio3A("","","",J)}catch(J){Ze.error(tt,"statdata error:",J)}});const P=this.createNode(M.currentAudioTrack);await this.audioProcessor.createProcessor(this.audioContext,P,1,Xr,this.farNode)}}extractDiffValue(M){if(!M)return null;const P=M.match(/diff\s*=\s*(-?\d+\.?\d*)/);return P?parseFloat(P[1]):null}extractLeakValue(M){if(!M)return null;const P=M.match(/leak\s*=\s*(-?\d+\.?\d*)/);return P?parseFloat(P[1]):null}clear(M){this.options.dumpAudioData&&this.audioProcessor?.stopDump(),super.clear(M),this.audioProcessor?.destroy(),this.audioProcessor=void 0,document.removeEventListener("click",this.activeAudioContext),this.farNode?.disconnect(),this.farNode=void 0}dump(){this.audioProcessor?.stopDump()}}export{fi as default};