multiple-police-situations/public/rtc/AgoraRTC_N-4.11.0.js

31 lines
1.0 MiB
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* AgoraWebSDK_N-v4.11.0-0-g961abf54 Copyright AgoraInc.
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).AgoraRTC=t()}(this,(function(){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},t=function(e){return e&&e.Math==Math&&e},r=t("object"==typeof globalThis&&globalThis)||t("object"==typeof window&&window)||t("object"==typeof self&&self)||t("object"==typeof e&&e)||function(){return this}()||Function("return this")(),i={},n=function(e){try{return!!e()}catch(e){return!0}},o=!n((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),s=!n((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),a=s,c=Function.prototype.call,d=a?c.bind(c):function(){return c.apply(c,arguments)},u={},A={}.propertyIsEnumerable,h=Object.getOwnPropertyDescriptor,l=h&&!A.call({1:2},1);u.f=l?function(e){var t=h(this,e);return!!t&&t.enumerable}:A;var p,g,f=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},E=s,I=Function.prototype,m=I.bind,_=I.call,C=E&&m.bind(_,_),v=E?function(e){return e&&C(e)}:function(e){return e&&function(){return _.apply(e,arguments)}},S=v,y=S({}.toString),R=S("".slice),T=function(e){return R(y(e),8,-1)},w=v,b=n,O=T,N=r.Object,D=w("".split),L=b((function(){return!N("z").propertyIsEnumerable(0)}))?function(e){return"String"==O(e)?D(e,""):N(e)}:N,k=r.TypeError,P=function(e){if(null==e)throw k("Can't call method on "+e);return e},B=L,M=P,U=function(e){return B(M(e))},Q=function(e){return"function"==typeof e},x=Q,F=function(e){return"object"==typeof e?null!==e:x(e)},V=r,j=Q,G=function(e){return j(e)?e:void 0},K=function(e,t){return arguments.length<2?G(V[e]):V[e]&&V[e][t]},H=v({}.isPrototypeOf),Y=K("navigator","userAgent")||"",W=r,J=Y,q=W.process,z=W.Deno,X=q&&q.versions||z&&z.version,Z=X&&X.v8;Z&&(g=(p=Z.split("."))[0]>0&&p[0]<4?1:+(p[0]+p[1])),!g&&J&&(!(p=J.match(/Edge\/(\d+)/))||p[1]>=74)&&(p=J.match(/Chrome\/(\d+)/))&&(g=+p[1]);var $=g,ee=$,te=n,re=!!Object.getOwnPropertySymbols&&!te((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ee&&ee<41})),ie=re&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ne=K,oe=Q,se=H,ae=ie,ce=r.Object,de=ae?function(e){return"symbol"==typeof e}:function(e){var t=ne("Symbol");return oe(t)&&se(t.prototype,ce(e))},ue=r.String,Ae=function(e){try{return ue(e)}catch(e){return"Object"}},he=Q,le=Ae,pe=r.TypeError,ge=function(e){if(he(e))return e;throw pe(le(e)+" is not a function")},fe=ge,Ee=function(e,t){var r=e[t];return null==r?void 0:fe(r)},Ie=d,me=Q,_e=F,Ce=r.TypeError,ve={exports:{}},Se=r,ye=Object.defineProperty,Re=function(e,t){try{ye(Se,e,{value:t,configurable:!0,writable:!0})}catch(r){Se[e]=t}return t},Te=Re,we="__core-js_shared__",be=r[we]||Te(we,{}),Oe=be;(ve.exports=function(e,t){return Oe[e]||(Oe[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.20.3",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE",source:"https://github.com/zloirock/core-js"});var Ne=P,De=r.Object,Le=function(e){return De(Ne(e))},ke=Le,Pe=v({}.hasOwnProperty),Be=Object.hasOwn||function(e,t){return Pe(ke(e),t)},Me=v,Ue=0,Qe=Math.random(),xe=Me(1..toString),Fe=function(e){return"Symbol("+(void 0===e?"":e)+")_"+xe(++Ue+Qe,36)},Ve=r,je=ve.exports,Ge=Be,Ke=Fe,He=re,Ye=ie,We=je("wks"),Je=Ve.Symbol,qe=Je&&Je.for,ze=Ye?Je:Je&&Je.withoutSetter||Ke,Xe=function(e){if(!Ge(We,e)||!He&&"string"!=typeof We[e]){var t="Symbol."+e;He&&Ge(Je,e)?We[e]=Je[e]:We[e]=Ye&&qe?qe(t):ze(t)}return We[e]},Ze=d,$e=F,et=de,tt=Ee,rt=function(e,t){var r,i;if("string"===t&&me(r=e.toString)&&!_e(i=Ie(r,e)))return i;if(me(r=e.valueOf)&&!_e(i=Ie(r,e)))return i;if("string"!==t&&me(r=e.toString)&&!_e(i=Ie(r,e)))return i;throw Ce("Can't convert object to primitive value")},it=Xe,nt=r.TypeError,ot=it("toPrimitive"),st=function(e,t){if(!$e(e)||et(e))return e;var r,i=tt(e,ot);if(i){if(void 0===t&&(t="default"),r=Ze(i,e,t),!$e(r)||et(r))return r;throw nt("Can't convert object to primitive value")}return void 0===t&&(t="number"),rt(e,t)},at=de,ct=function(e){var t=st(e,"string");return at(t)?t:t+""},dt=F,ut=r.document,At=dt(ut)&&dt(ut.createElement),ht=function(e){return At?ut.createElement(e):{}},lt=ht,pt=!o&&!n((function(){return 7!=Object.defineProperty(lt("div"),"a",{get:function(){return 7}}).a})),gt=o,ft=d,Et=u,It=f,mt=U,_t=ct,Ct=Be,vt=pt,St=Object.getOwnPropertyDescriptor;i.f=gt?St:function(e,t){if(e=mt(e),t=_t(t),vt)try{return St(e,t)}catch(e){}if(Ct(e,t))return It(!ft(Et.f,e,t),e[t])};var yt={},Rt=o&&n((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Tt=r,wt=F,bt=Tt.String,Ot=Tt.TypeError,Nt=function(e){if(wt(e))return e;throw Ot(bt(e)+" is not an object")},Dt=o,Lt=pt,kt=Rt,Pt=Nt,Bt=ct,Mt=r.TypeError,Ut=Object.defineProperty,Qt=Object.getOwnPropertyDescriptor,xt="enumerable",Ft="configurable",Vt="writable";yt.f=Dt?kt?function(e,t,r){if(Pt(e),t=Bt(t),Pt(r),"function"==typeof e&&"prototype"===t&&"value"in r&&Vt in r&&!r.writable){var i=Qt(e,t);i&&i.writable&&(e[t]=r.value,r={configurable:Ft in r?r.configurable:i.configurable,enumerable:xt in r?r.enumerable:i.enumerable,writable:!1})}return Ut(e,t,r)}:Ut:function(e,t,r){if(Pt(e),t=Bt(t),Pt(r),Lt)try{return Ut(e,t,r)}catch(e){}if("get"in r||"set"in r)throw Mt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var jt=yt,Gt=f,Kt=o?function(e,t,r){return jt.f(e,t,Gt(1,r))}:function(e,t,r){return e[t]=r,e},Ht={exports:{}},Yt=Q,Wt=be,Jt=v(Function.toString);Yt(Wt.inspectSource)||(Wt.inspectSource=function(e){return Jt(e)});var qt,zt,Xt,Zt=Wt.inspectSource,$t=Q,er=Zt,tr=r.WeakMap,rr=$t(tr)&&/native code/.test(er(tr)),ir=ve.exports,nr=Fe,or=ir("keys"),sr=function(e){return or[e]||(or[e]=nr(e))},ar={},cr=rr,dr=r,ur=v,Ar=F,hr=Kt,lr=Be,pr=be,gr=sr,fr=ar,Er="Object already initialized",Ir=dr.TypeError,mr=dr.WeakMap;if(cr||pr.state){var _r=pr.state||(pr.state=new mr),Cr=ur(_r.get),vr=ur(_r.has),Sr=ur(_r.set);qt=function(e,t){if(vr(_r,e))throw new Ir(Er);return t.facade=e,Sr(_r,e,t),t},zt=function(e){return Cr(_r,e)||{}},Xt=function(e){return vr(_r,e)}}else{var yr=gr("state");fr[yr]=!0,qt=function(e,t){if(lr(e,yr))throw new Ir(Er);return t.facade=e,hr(e,yr,t),t},zt=function(e){return lr(e,yr)?e[yr]:{}},Xt=function(e){return lr(e,yr)}}var Rr={set:qt,get:zt,has:Xt,enforce:function(e){return Xt(e)?zt(e):qt(e,{})},getterFor:function(e){return function(t){var r;if(!Ar(t)||(r=zt(t)).type!==e)throw Ir("Incompatible receiver, "+e+" required");return r}}},Tr=o,wr=Be,br=Function.prototype,Or=Tr&&Object.getOwnPropertyDescriptor,Nr=wr(br,"name"),Dr={EXISTS:Nr,PROPER:Nr&&"something"===function(){}.name,CONFIGURABLE:Nr&&(!Tr||Tr&&Or(br,"name").configurable)},Lr=r,kr=Q,Pr=Be,Br=Kt,Mr=Re,Ur=Zt,Qr=Dr.CONFIGURABLE,xr=Rr.get,Fr=Rr.enforce,Vr=String(String).split("String");(Ht.exports=function(e,t,r,i){var n,o=!!i&&!!i.unsafe,s=!!i&&!!i.enumerable,a=!!i&&!!i.noTargetGet,c=i&&void 0!==i.name?i.name:t;kr(r)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Pr(r,"name")||Qr&&r.name!==c)&&Br(r,"name",c),(n=Fr(r)).source||(n.source=Vr.join("string"==typeof c?c:""))),e!==Lr?(o?!a&&e[t]&&(s=!0):delete e[t],s?e[t]=r:Br(e,t,r)):s?e[t]=r:Mr(t,r)})(Function.prototype,"toString",(function(){return kr(this)&&xr(this).source||Ur(this)}));var jr={},Gr=Math.ceil,Kr=Math.floor,Hr=function(e){var t=+e;return t!=t||0===t?0:(t>0?Kr:Gr)(t)},Yr=Hr,Wr=Math.max,Jr=Math.min,qr=function(e,t){var r=Yr(e);return r<0?Wr(r+t,0):Jr(r,t)},zr=Hr,Xr=Math.min,Zr=function(e){return e>0?Xr(zr(e),9007199254740991):0},$r=Zr,ei=function(e){return $r(e.length)},ti=U,ri=qr,ii=ei,ni=function(e){return function(t,r,i){var n,o=ti(t),s=ii(o),a=ri(i,s);if(e&&r!=r){for(;s>a;)if((n=o[a++])!=n)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},oi={includes:ni(!0),indexOf:ni(!1)},si=Be,ai=U,ci=oi.indexOf,di=ar,ui=v([].push),Ai=function(e,t){var r,i=ai(e),n=0,o=[];for(r in i)!si(di,r)&&si(i,r)&&ui(o,r);for(;t.length>n;)si(i,r=t[n++])&&(~ci(o,r)||ui(o,r));return o},hi=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],li=Ai,pi=hi.concat("length","prototype");jr.f=Object.getOwnPropertyNames||function(e){return li(e,pi)};var gi={};gi.f=Object.getOwnPropertySymbols;var fi=K,Ei=jr,Ii=gi,mi=Nt,_i=v([].concat),Ci=fi("Reflect","ownKeys")||function(e){var t=Ei.f(mi(e)),r=Ii.f;return r?_i(t,r(e)):t},vi=Be,Si=Ci,yi=i,Ri=yt,Ti=function(e,t,r){for(var i=Si(t),n=Ri.f,o=yi.f,s=0;s<i.length;s++){var a=i[s];vi(e,a)||r&&vi(r,a)||n(e,a,o(t,a))}},wi=n,bi=Q,Oi=/#|\.prototype\./,Ni=function(e,t){var r=Li[Di(e)];return r==Pi||r!=ki&&(bi(t)?wi(t):!!t)},Di=Ni.normalize=function(e){return String(e).replace(Oi,".").toLowerCase()},Li=Ni.data={},ki=Ni.NATIVE="N",Pi=Ni.POLYFILL="P",Bi=Ni,Mi=r,Ui=i.f,Qi=Kt,xi=Ht.exports,Fi=Re,Vi=Ti,ji=Bi,Gi=function(e,t){var r,i,n,o,s,a=e.target,c=e.global,d=e.stat;if(r=c?Mi:d?Mi[a]||Fi(a,{}):(Mi[a]||{}).prototype)for(i in t){if(o=t[i],n=e.noTargetGet?(s=Ui(r,i))&&s.value:r[i],!ji(c?i:a+(d?".":"#")+i,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;Vi(o,n)}(e.sham||n&&n.sham)&&Qi(o,"sham",!0),xi(r,i,o,e)}},Ki=r.Promise,Hi=Ht.exports,Yi=function(e,t,r){for(var i in t)Hi(e,i,t[i],r);return e},Wi=r,Ji=Q,qi=Wi.String,zi=Wi.TypeError,Xi=v,Zi=Nt,$i=function(e){if("object"==typeof e||Ji(e))return e;throw zi("Can't set "+qi(e)+" as a prototype")},en=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Xi(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return Zi(r),$i(i),t?e(r,i):r.__proto__=i,r}}():void 0),tn=yt.f,rn=Be,nn=Xe("toStringTag"),on=function(e,t,r){e&&!r&&(e=e.prototype),e&&!rn(e,nn)&&tn(e,nn,{configurable:!0,value:t})},sn=K,an=yt,cn=o,dn=Xe("species"),un=function(e){var t=sn(e),r=an.f;cn&&t&&!t[dn]&&r(t,dn,{configurable:!0,get:function(){return this}})},An=H,hn=r.TypeError,ln=function(e,t){if(An(t,e))return e;throw hn("Incorrect invocation")},pn=ge,gn=s,fn=v(v.bind),En=function(e,t){return pn(e),void 0===t?e:gn?fn(e,t):function(){return e.apply(t,arguments)}},In={},mn=In,_n=Xe("iterator"),Cn=Array.prototype,vn=function(e){return void 0!==e&&(mn.Array===e||Cn[_n]===e)},Sn={};Sn[Xe("toStringTag")]="z";var yn=r,Rn="[object z]"===String(Sn),Tn=Q,wn=T,bn=Xe("toStringTag"),On=yn.Object,Nn="Arguments"==wn(function(){return arguments}()),Dn=Rn?wn:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=On(e),bn))?r:Nn?wn(t):"Object"==(i=wn(t))&&Tn(t.callee)?"Arguments":i},Ln=Dn,kn=Ee,Pn=In,Bn=Xe("iterator"),Mn=function(e){if(null!=e)return kn(e,Bn)||kn(e,"@@iterator")||Pn[Ln(e)]},Un=d,Qn=ge,xn=Nt,Fn=Ae,Vn=Mn,jn=r.TypeError,Gn=function(e,t){var r=arguments.length<2?Vn(e):t;if(Qn(r))return xn(Un(r,e));throw jn(Fn(e)+" is not iterable")},Kn=d,Hn=Nt,Yn=Ee,Wn=En,Jn=d,qn=Nt,zn=Ae,Xn=vn,Zn=ei,$n=H,eo=Gn,to=Mn,ro=function(e,t,r){var i,n;Hn(e);try{if(!(i=Yn(e,"return"))){if("throw"===t)throw r;return r}i=Kn(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return Hn(i),r},io=r.TypeError,no=function(e,t){this.stopped=e,this.result=t},oo=no.prototype,so=Xe("iterator"),ao=!1;try{var co=0,uo={next:function(){return{done:!!co++}},return:function(){ao=!0}};uo[so]=function(){return this},Array.from(uo,(function(){throw 2}))}catch(e){}var Ao=function(e,t){if(!t&&!ao)return!1;var r=!1;try{var i={};i[so]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},ho=v,lo=n,po=Q,go=Dn,fo=Zt,Eo=function(){},Io=[],mo=K("Reflect","construct"),_o=/^\s*(?:class|function)\b/,Co=ho(_o.exec),vo=!_o.exec(Eo),So=function(e){if(!po(e))return!1;try{return mo(Eo,Io,e),!0}catch(e){return!1}},yo=function(e){if(!po(e))return!1;switch(go(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return vo||!!Co(_o,fo(e))}catch(e){return!0}};yo.sham=!0;var Ro,To,wo,bo,Oo=!mo||lo((function(){var e;return So(So.call)||!So(Object)||!So((function(){e=!0}))||e}))?yo:So,No=Oo,Do=Ae,Lo=r.TypeError,ko=function(e){if(No(e))return e;throw Lo(Do(e)+" is not a constructor")},Po=Nt,Bo=ko,Mo=Xe("species"),Uo=function(e,t){var r,i=Po(e).constructor;return void 0===i||null==(r=Po(i)[Mo])?t:Bo(r)},Qo=s,xo=Function.prototype,Fo=xo.apply,Vo=xo.call,jo="object"==typeof Reflect&&Reflect.apply||(Qo?Vo.bind(Fo):function(){return Vo.apply(Fo,arguments)}),Go=K("document","documentElement"),Ko=v([].slice),Ho=/(?:ipad|iphone|ipod).*applewebkit/i.test(Y),Yo="process"==T(r.process),Wo=r,Jo=jo,qo=En,zo=Q,Xo=Be,Zo=n,$o=Go,es=Ko,ts=ht,rs=Ho,is=Yo,ns=Wo.setImmediate,os=Wo.clearImmediate,ss=Wo.process,as=Wo.Dispatch,cs=Wo.Function,ds=Wo.MessageChannel,us=Wo.String,As=0,hs={},ls="onreadystatechange";try{Ro=Wo.location}catch(e){}var ps=function(e){if(Xo(hs,e)){var t=hs[e];delete hs[e],t()}},gs=function(e){return function(){ps(e)}},fs=function(e){ps(e.data)},Es=function(e){Wo.postMessage(us(e),Ro.protocol+"//"+Ro.host)};ns&&os||(ns=function(e){var t=es(arguments,1);return hs[++As]=function(){Jo(zo(e)?e:cs(e),void 0,t)},To(As),As},os=function(e){delete hs[e]},is?To=function(e){ss.nextTick(gs(e))}:as&&as.now?To=function(e){as.now(gs(e))}:ds&&!rs?(bo=(wo=new ds).port2,wo.port1.onmessage=fs,To=qo(bo.postMessage,bo)):Wo.addEventListener&&zo(Wo.postMessage)&&!Wo.importScripts&&Ro&&"file:"!==Ro.protocol&&!Zo(Es)?(To=Es,Wo.addEventListener("message",fs,!1)):To=ls in ts("script")?function(e){$o.appendChild(ts("script")).onreadystatechange=function(){$o.removeChild(this),ps(e)}}:function(e){setTimeout(gs(e),0)});var Is,ms,_s,Cs,vs,Ss,ys,Rs,Ts={set:ns,clear:os},ws=r,bs=/ipad|iphone|ipod/i.test(Y)&&void 0!==ws.Pebble,Os=/web0s(?!.*chrome)/i.test(Y),Ns=r,Ds=En,Ls=i.f,ks=Ts.set,Ps=Ho,Bs=bs,Ms=Os,Us=Yo,Qs=Ns.MutationObserver||Ns.WebKitMutationObserver,xs=Ns.document,Fs=Ns.process,Vs=Ns.Promise,js=Ls(Ns,"queueMicrotask"),Gs=js&&js.value;Gs||(Is=function(){var e,t;for(Us&&(e=Fs.domain)&&e.exit();ms;){t=ms.fn,ms=ms.next;try{t()}catch(e){throw ms?Cs():_s=void 0,e}}_s=void 0,e&&e.enter()},Ps||Us||Ms||!Qs||!xs?!Bs&&Vs&&Vs.resolve?((ys=Vs.resolve(void 0)).constructor=Vs,Rs=Ds(ys.then,ys),Cs=function(){Rs(Is)}):Us?Cs=function(){Fs.nextTick(Is)}:(ks=Ds(ks,Ns),Cs=function(){ks(Is)}):(vs=!0,Ss=xs.createTextNode(""),new Qs(Is).observe(Ss,{characterData:!0}),Cs=function(){Ss.data=vs=!vs}));var Ks=Gs||function(e){var t={fn:e,next:void 0};_s&&(_s.next=t),ms||(ms=t,Cs()),_s=t},Hs={},Ys=ge,Ws=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=i})),this.resolve=Ys(t),this.reject=Ys(r)};Hs.f=function(e){return new Ws(e)};var Js=Nt,qs=F,zs=Hs,Xs=function(e,t){if(Js(e),qs(t)&&t.constructor===e)return t;var r=zs.f(e);return(0,r.resolve)(t),r.promise},Zs=r,$s=function(){this.head=null,this.tail=null};$s.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var ea,ta,ra,ia,na=$s,oa="object"==typeof window,sa=Gi,aa=r,ca=K,da=d,ua=Ki,Aa=Ht.exports,ha=Yi,la=en,pa=on,ga=un,fa=ge,Ea=Q,Ia=F,ma=ln,_a=Zt,Ca=function(e,t,r){var i,n,o,s,a,c,d,u=r&&r.that,A=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_ITERATOR),l=!(!r||!r.INTERRUPTED),p=Wn(t,u),g=function(e){return i&&ro(i,"normal",e),new no(!0,e)},f=function(e){return A?(qn(e),l?p(e[0],e[1],g):p(e[0],e[1])):l?p(e,g):p(e)};if(h)i=e;else{if(!(n=to(e)))throw io(zn(e)+" is not iterable");if(Xn(n)){for(o=0,s=Zn(e);s>o;o++)if((a=f(e[o]))&&$n(oo,a))return a;return new no(!1)}i=eo(e,n)}for(c=i.next;!(d=Jn(c,i)).done;){try{a=f(d.value)}catch(e){ro(i,"throw",e)}if("object"==typeof a&&a&&$n(oo,a))return a}return new no(!1)},va=Ao,Sa=Uo,ya=Ts.set,Ra=Ks,Ta=Xs,wa=function(e,t){var r=Zs.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},ba=Hs,Oa=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Na=na,Da=Rr,La=Bi,ka=oa,Pa=Yo,Ba=$,Ma=Xe("species"),Ua="Promise",Qa=Da.getterFor(Ua),xa=Da.set,Fa=Da.getterFor(Ua),Va=ua&&ua.prototype,ja=ua,Ga=Va,Ka=aa.TypeError,Ha=aa.document,Ya=aa.process,Wa=ba.f,Ja=Wa,qa=!!(Ha&&Ha.createEvent&&aa.dispatchEvent),za=Ea(aa.PromiseRejectionEvent),Xa="unhandledrejection",Za=!1,$a=La(Ua,(function(){var e=_a(ja),t=e!==String(ja);if(!t&&66===Ba)return!0;if(Ba>=51&&/native code/.test(e))return!1;var r=new ja((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};return(r.constructor={})[Ma]=i,!(Za=r.then((function(){}))instanceof i)||!t&&ka&&!za})),ec=$a||!va((function(e){ja.all(e).catch((function(){}))})),tc=function(e){var t;return!(!Ia(e)||!Ea(t=e.then))&&t},rc=function(e,t){var r,i,n,o=t.value,s=1==t.state,a=s?e.ok:e.fail,c=e.resolve,d=e.reject,u=e.domain;try{a?(s||(2===t.rejection&&ac(t),t.rejection=1),!0===a?r=o:(u&&u.enter(),r=a(o),u&&(u.exit(),n=!0)),r===e.promise?d(Ka("Promise-chain cycle")):(i=tc(r))?da(i,r,c,d):c(r)):d(o)}catch(e){u&&!n&&u.exit(),d(e)}},ic=function(e,t){e.notified||(e.notified=!0,Ra((function(){for(var r,i=e.reactions;r=i.get();)rc(r,e);e.notified=!1,t&&!e.rejection&&oc(e)})))},nc=function(e,t,r){var i,n;qa?((i=Ha.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),aa.dispatchEvent(i)):i={promise:t,reason:r},!za&&(n=aa["on"+e])?n(i):e===Xa&&wa("Unhandled promise rejection",r)},oc=function(e){da(ya,aa,(function(){var t,r=e.facade,i=e.value;if(sc(e)&&(t=Oa((function(){Pa?Ya.emit("unhandledRejection",i,r):nc(Xa,r,i)})),e.rejection=Pa||sc(e)?2:1,t.error))throw t.value}))},sc=function(e){return 1!==e.rejection&&!e.parent},ac=function(e){da(ya,aa,(function(){var t=e.facade;Pa?Ya.emit("rejectionHandled",t):nc("rejectionhandled",t,e.value)}))},cc=function(e,t,r){return function(i){e(t,i,r)}},dc=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,ic(e,!0))},uc=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Ka("Promise can't be resolved itself");var i=tc(t);i?Ra((function(){var r={done:!1};try{da(i,t,cc(uc,r,e),cc(dc,r,e))}catch(t){dc(r,t,e)}})):(e.value=t,e.state=1,ic(e,!1))}catch(t){dc({done:!1},t,e)}}};if($a&&(Ga=(ja=function(e){ma(this,Ga),fa(e),da(ea,this);var t=Qa(this);try{e(cc(uc,t),cc(dc,t))}catch(e){dc(t,e)}}).prototype,(ea=function(e){xa(this,{type:Ua,done:!1,notified:!1,parent:!1,reactions:new Na,rejection:!1,state:0,value:void 0})}).prototype=ha(Ga,{then:function(e,t){var r=Fa(this),i=Wa(Sa(this,ja));return r.parent=!0,i.ok=!Ea(e)||e,i.fail=Ea(t)&&t,i.domain=Pa?Ya.domain:void 0,0==r.state?r.reactions.add(i):Ra((function(){rc(i,r)})),i.promise},catch:function(e){return this.then(void 0,e)}}),ta=function(){var e=new ea,t=Qa(e);this.promise=e,this.resolve=cc(uc,t),this.reject=cc(dc,t)},ba.f=Wa=function(e){return e===ja||e===ra?new ta(e):Ja(e)},Ea(ua)&&Va!==Object.prototype)){ia=Va.then,Za||(Aa(Va,"then",(function(e,t){var r=this;return new ja((function(e,t){da(ia,r,e,t)})).then(e,t)}),{unsafe:!0}),Aa(Va,"catch",Ga.catch,{unsafe:!0}));try{delete Va.constructor}catch(e){}la&&la(Va,Ga)}sa({global:!0,wrap:!0,forced:$a},{Promise:ja}),pa(ja,Ua,!1),ga(Ua),ra=ca(Ua),sa({target:Ua,stat:!0,forced:$a},{reject:function(e){var t=Wa(this);return da(t.reject,void 0,e),t.promise}}),sa({target:Ua,stat:!0,forced:$a},{resolve:function(e){return Ta(this,e)}}),sa({target:Ua,stat:!0,forced:ec},{all:function(e){var t=this,r=Wa(t),i=r.resolve,n=r.reject,o=Oa((function(){var r=fa(t.resolve),o=[],s=0,a=1;Ca(e,(function(e){var c=s++,d=!1;a++,da(r,t,e).then((function(e){d||(d=!0,o[c]=e,--a||i(o))}),n)})),--a||i(o)}));return o.error&&n(o.value),r.promise},race:function(e){var t=this,r=Wa(t),i=r.reject,n=Oa((function(){var n=fa(t.resolve);Ca(e,(function(e){da(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var Ac=Gi,hc=K,lc=jo,pc=v,gc=n,fc=r.Array,Ec=hc("JSON","stringify"),Ic=pc(/./.exec),mc=pc("".charAt),_c=pc("".charCodeAt),Cc=pc("".replace),vc=pc(1..toString),Sc=/[\uD800-\uDFFF]/g,yc=/^[\uD800-\uDBFF]$/,Rc=/^[\uDC00-\uDFFF]$/,Tc=function(e,t,r){var i=mc(r,t-1),n=mc(r,t+1);return Ic(yc,e)&&!Ic(Rc,n)||Ic(Rc,e)&&!Ic(yc,i)?"\\u"+vc(_c(e,0),16):e},wc=gc((function(){return'"\\udf06\\ud834"'!==Ec("\udf06\ud834")||'"\\udead"'!==Ec("\udead")}));Ec&&Ac({target:"JSON",stat:!0,forced:wc},{stringify:function(e,t,r){for(var i=0,n=arguments.length,o=fc(n);i<n;i++)o[i]=arguments[i];var s=lc(Ec,null,o);return"string"==typeof s?Cc(s,Sc,Tc):s}});var bc=function(e){try{return!!e()}catch(e){return!0}},Oc=!bc((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),Nc=Oc,Dc=Function.prototype,Lc=Dc.bind,kc=Dc.call,Pc=Nc&&Lc.bind(kc,kc),Bc=Nc?function(e){return e&&Pc(e)}:function(e){return e&&function(){return kc.apply(e,arguments)}},Mc=Bc({}.isPrototypeOf),Uc=function(e){return e&&e.Math==Math&&e},Qc=Uc("object"==typeof globalThis&&globalThis)||Uc("object"==typeof window&&window)||Uc("object"==typeof self&&self)||Uc("object"==typeof e&&e)||function(){return this}()||Function("return this")(),xc=Oc,Fc=Function.prototype,Vc=Fc.apply,jc=Fc.call,Gc="object"==typeof Reflect&&Reflect.apply||(xc?jc.bind(Vc):function(){return jc.apply(Vc,arguments)}),Kc=function(e){return"function"==typeof e},Hc={},Yc=!bc((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),Wc=Oc,Jc=Function.prototype.call,qc=Wc?Jc.bind(Jc):function(){return Jc.apply(Jc,arguments)},zc={},Xc={}.propertyIsEnumerable,Zc=Object.getOwnPropertyDescriptor,$c=Zc&&!Xc.call({1:2},1);zc.f=$c?function(e){var t=Zc(this,e);return!!t&&t.enumerable}:Xc;var ed,td,rd=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},id=Bc,nd=id({}.toString),od=id("".slice),sd=function(e){return od(nd(e),8,-1)},ad=Bc,cd=bc,dd=sd,ud=Qc.Object,Ad=ad("".split),hd=cd((function(){return!ud("z").propertyIsEnumerable(0)}))?function(e){return"String"==dd(e)?Ad(e,""):ud(e)}:ud,ld=Qc.TypeError,pd=function(e){if(null==e)throw ld("Can't call method on "+e);return e},gd=hd,fd=pd,Ed=function(e){return gd(fd(e))},Id=Kc,md=function(e){return"object"==typeof e?null!==e:Id(e)},_d={},Cd=_d,vd=Qc,Sd=Kc,yd=function(e){return Sd(e)?e:void 0},Rd=function(e,t){return arguments.length<2?yd(Cd[e])||yd(vd[e]):Cd[e]&&Cd[e][t]||vd[e]&&vd[e][t]},Td=Rd("navigator","userAgent")||"",wd=Qc,bd=Td,Od=wd.process,Nd=wd.Deno,Dd=Od&&Od.versions||Nd&&Nd.version,Ld=Dd&&Dd.v8;Ld&&(td=(ed=Ld.split("."))[0]>0&&ed[0]<4?1:+(ed[0]+ed[1])),!td&&bd&&(!(ed=bd.match(/Edge\/(\d+)/))||ed[1]>=74)&&(ed=bd.match(/Chrome\/(\d+)/))&&(td=+ed[1]);var kd=td,Pd=kd,Bd=bc,Md=!!Object.getOwnPropertySymbols&&!Bd((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&Pd&&Pd<41})),Ud=Md&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,Qd=Rd,xd=Kc,Fd=Mc,Vd=Ud,jd=Qc.Object,Gd=Vd?function(e){return"symbol"==typeof e}:function(e){var t=Qd("Symbol");return xd(t)&&Fd(t.prototype,jd(e))},Kd=Qc.String,Hd=function(e){try{return Kd(e)}catch(e){return"Object"}},Yd=Kc,Wd=Hd,Jd=Qc.TypeError,qd=function(e){if(Yd(e))return e;throw Jd(Wd(e)+" is not a function")},zd=qd,Xd=function(e,t){var r=e[t];return null==r?void 0:zd(r)},Zd=qc,$d=Kc,eu=md,tu=Qc.TypeError,ru={exports:{}},iu=Qc,nu=Object.defineProperty,ou=function(e,t){try{nu(iu,e,{value:t,configurable:!0,writable:!0})}catch(r){iu[e]=t}return t},su="__core-js_shared__",au=Qc[su]||ou(su,{}),cu=au;(ru.exports=function(e,t){return cu[e]||(cu[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.20.3",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE",source:"https://github.com/zloirock/core-js"});var du=pd,uu=Qc.Object,Au=function(e){return uu(du(e))},hu=Au,lu=Bc({}.hasOwnProperty),pu=Object.hasOwn||function(e,t){return lu(hu(e),t)},gu=Bc,fu=0,Eu=Math.random(),Iu=gu(1..toString),mu=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Iu(++fu+Eu,36)},_u=Qc,Cu=ru.exports,vu=pu,Su=mu,yu=Md,Ru=Ud,Tu=Cu("wks"),wu=_u.Symbol,bu=wu&&wu.for,Ou=Ru?wu:wu&&wu.withoutSetter||Su,Nu=function(e){if(!vu(Tu,e)||!yu&&"string"!=typeof Tu[e]){var t="Symbol."+e;yu&&vu(wu,e)?Tu[e]=wu[e]:Tu[e]=Ru&&bu?bu(t):Ou(t)}return Tu[e]},Du=qc,Lu=md,ku=Gd,Pu=Xd,Bu=function(e,t){var r,i;if("string"===t&&$d(r=e.toString)&&!eu(i=Zd(r,e)))return i;if($d(r=e.valueOf)&&!eu(i=Zd(r,e)))return i;if("string"!==t&&$d(r=e.toString)&&!eu(i=Zd(r,e)))return i;throw tu("Can't convert object to primitive value")},Mu=Nu,Uu=Qc.TypeError,Qu=Mu("toPrimitive"),xu=function(e,t){if(!Lu(e)||ku(e))return e;var r,i=Pu(e,Qu);if(i){if(void 0===t&&(t="default"),r=Du(i,e,t),!Lu(r)||ku(r))return r;throw Uu("Can't convert object to primitive value")}return void 0===t&&(t="number"),Bu(e,t)},Fu=Gd,Vu=function(e){var t=xu(e,"string");return Fu(t)?t:t+""},ju=md,Gu=Qc.document,Ku=ju(Gu)&&ju(Gu.createElement),Hu=function(e){return Ku?Gu.createElement(e):{}},Yu=Hu,Wu=!Yc&&!bc((function(){return 7!=Object.defineProperty(Yu("div"),"a",{get:function(){return 7}}).a})),Ju=Yc,qu=qc,zu=zc,Xu=rd,Zu=Ed,$u=Vu,eA=pu,tA=Wu,rA=Object.getOwnPropertyDescriptor;Hc.f=Ju?rA:function(e,t){if(e=Zu(e),t=$u(t),tA)try{return rA(e,t)}catch(e){}if(eA(e,t))return Xu(!qu(zu.f,e,t),e[t])};var iA=bc,nA=Kc,oA=/#|\.prototype\./,sA=function(e,t){var r=cA[aA(e)];return r==uA||r!=dA&&(nA(t)?iA(t):!!t)},aA=sA.normalize=function(e){return String(e).replace(oA,".").toLowerCase()},cA=sA.data={},dA=sA.NATIVE="N",uA=sA.POLYFILL="P",AA=sA,hA=qd,lA=Oc,pA=Bc(Bc.bind),gA=function(e,t){return hA(e),void 0===t?e:lA?pA(e,t):function(){return e.apply(t,arguments)}},fA={},EA=Yc&&bc((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),IA=Qc,mA=md,_A=IA.String,CA=IA.TypeError,vA=function(e){if(mA(e))return e;throw CA(_A(e)+" is not an object")},SA=Yc,yA=Wu,RA=EA,TA=vA,wA=Vu,bA=Qc.TypeError,OA=Object.defineProperty,NA=Object.getOwnPropertyDescriptor,DA="enumerable",LA="configurable",kA="writable";fA.f=SA?RA?function(e,t,r){if(TA(e),t=wA(t),TA(r),"function"==typeof e&&"prototype"===t&&"value"in r&&kA in r&&!r.writable){var i=NA(e,t);i&&i.writable&&(e[t]=r.value,r={configurable:LA in r?r.configurable:i.configurable,enumerable:DA in r?r.enumerable:i.enumerable,writable:!1})}return OA(e,t,r)}:OA:function(e,t,r){if(TA(e),t=wA(t),TA(r),yA)try{return OA(e,t,r)}catch(e){}if("get"in r||"set"in r)throw bA("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var PA=fA,BA=rd,MA=Yc?function(e,t,r){return PA.f(e,t,BA(1,r))}:function(e,t,r){return e[t]=r,e},UA=Qc,QA=Gc,xA=Bc,FA=Kc,VA=Hc.f,jA=AA,GA=_d,KA=gA,HA=MA,YA=pu,WA=function(e){var t=function(r,i,n){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,i)}return new e(r,i,n)}return QA(e,this,arguments)};return t.prototype=e.prototype,t},JA=function(e,t){var r,i,n,o,s,a,c,d,u=e.target,A=e.global,h=e.stat,l=e.proto,p=A?UA:h?UA[u]:(UA[u]||{}).prototype,g=A?GA:GA[u]||HA(GA,u,{})[u],f=g.prototype;for(n in t)r=!jA(A?n:u+(h?".":"#")+n,e.forced)&&p&&YA(p,n),s=g[n],r&&(a=e.noTargetGet?(d=VA(p,n))&&d.value:p[n]),o=r&&a?a:t[n],r&&typeof s==typeof o||(c=e.bind&&r?KA(o,UA):e.wrap&&r?WA(o):l&&FA(o)?xA(o):o,(e.sham||o&&o.sham||s&&s.sham)&&HA(c,"sham",!0),HA(g,n,c),l&&(YA(GA,i=u+"Prototype")||HA(GA,i,{}),HA(GA[i],n,o),e.real&&f&&!f[n]&&HA(f,n,o)))},qA=Math.ceil,zA=Math.floor,XA=function(e){var t=+e;return t!=t||0===t?0:(t>0?zA:qA)(t)},ZA=XA,$A=Math.min,eh=function(e){return e>0?$A(ZA(e),9007199254740991):0},th=function(e){return eh(e.length)},rh=qd,ih=Au,nh=hd,oh=th,sh=Qc.TypeError,ah=function(e){return function(t,r,i,n){rh(r);var o=ih(t),s=nh(o),a=oh(o),c=e?a-1:0,d=e?-1:1;if(i<2)for(;;){if(c in s){n=s[c],c+=d;break}if(c+=d,e?c<0:a<=c)throw sh("Reduce of empty array with no initial value")}for(;e?c>=0:a>c;c+=d)c in s&&(n=r(n,s[c],c,o));return n}},ch={left:ah(!1),right:ah(!0)},dh=bc,uh=function(e,t){var r=[][e];return!!r&&dh((function(){r.call(null,t||function(){throw 1},1)}))},Ah="process"==sd(Qc.process),hh=ch.left,lh=kd,ph=Ah;JA({target:"Array",proto:!0,forced:!uh("reduce")||!ph&&lh>79&&lh<83},{reduce:function(e){var t=arguments.length;return hh(this,e,t,t>1?arguments[1]:void 0)}});var gh=_d,fh=function(e){return gh[e+"Prototype"]},Eh=fh("Array").reduce,Ih=Mc,mh=Eh,_h=Array.prototype,Ch=function(e){var t=e.reduce;return e===_h||Ih(_h,e)&&t===_h.reduce?mh:t},vh=Ch,Sh=Dn,yh=r.String,Rh=function(e){if("Symbol"===Sh(e))throw TypeError("Cannot convert a Symbol value to a string");return yh(e)},Th=Nt,wh=function(){var e=Th(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},bh=n,Oh=r.RegExp,Nh=bh((function(){var e=Oh("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),Dh=Nh||bh((function(){return!Oh("a","y").sticky})),Lh={BROKEN_CARET:Nh||bh((function(){var e=Oh("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:Dh,UNSUPPORTED_Y:Nh},kh={},Ph=Ai,Bh=hi,Mh=Object.keys||function(e){return Ph(e,Bh)},Uh=o,Qh=Rt,xh=yt,Fh=Nt,Vh=U,jh=Mh;kh.f=Uh&&!Qh?Object.defineProperties:function(e,t){Fh(e);for(var r,i=Vh(t),n=jh(t),o=n.length,s=0;o>s;)xh.f(e,r=n[s++],i[r]);return e};var Gh,Kh=Nt,Hh=kh,Yh=hi,Wh=ar,Jh=Go,qh=ht,zh=sr("IE_PROTO"),Xh=function(){},Zh=function(e){return"<script>"+e+"</"+"script>"},$h=function(e){e.write(Zh("")),e.close();var t=e.parentWindow.Object;return e=null,t},el=function(){try{Gh=new ActiveXObject("htmlfile")}catch(e){}var e,t;el="undefined"!=typeof document?document.domain&&Gh?$h(Gh):((t=qh("iframe")).style.display="none",Jh.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Zh("document.F=Object")),e.close(),e.F):$h(Gh);for(var r=Yh.length;r--;)delete el.prototype[Yh[r]];return el()};Wh[zh]=!0;var tl=Object.create||function(e,t){var r;return null!==e?(Xh.prototype=Kh(e),r=new Xh,Xh.prototype=null,r[zh]=e):r=el(),void 0===t?r:Hh.f(r,t)},rl=n,il=r.RegExp,nl=rl((function(){var e=il(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),ol=n,sl=r.RegExp,al=ol((function(){var e=sl("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),cl=d,dl=v,ul=Rh,Al=wh,hl=Lh,ll=ve.exports,pl=tl,gl=Rr.get,fl=nl,El=al,Il=ll("native-string-replace",String.prototype.replace),ml=RegExp.prototype.exec,_l=ml,Cl=dl("".charAt),vl=dl("".indexOf),Sl=dl("".replace),yl=dl("".slice),Rl=function(){var e=/a/,t=/b*/g;return cl(ml,e,"a"),cl(ml,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Tl=hl.BROKEN_CARET,wl=void 0!==/()??/.exec("")[1];(Rl||wl||Tl||fl||El)&&(_l=function(e){var t,r,i,n,o,s,a,c=this,d=gl(c),u=ul(e),A=d.raw;if(A)return A.lastIndex=c.lastIndex,t=cl(_l,A,u),c.lastIndex=A.lastIndex,t;var h=d.groups,l=Tl&&c.sticky,p=cl(Al,c),g=c.source,f=0,E=u;if(l&&(p=Sl(p,"y",""),-1===vl(p,"g")&&(p+="g"),E=yl(u,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Cl(u,c.lastIndex-1))&&(g="(?: "+g+")",E=" "+E,f++),r=new RegExp("^(?:"+g+")",p)),wl&&(r=new RegExp("^"+g+"$(?!\\s)",p)),Rl&&(i=c.lastIndex),n=cl(ml,l?r:c,E),l?n?(n.input=yl(n.input,f),n[0]=yl(n[0],f),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:Rl&&n&&(c.lastIndex=c.global?n.index+n[0].length:i),wl&&n&&n.length>1&&cl(Il,n[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n&&h)for(n.groups=s=pl(null),o=0;o<h.length;o++)s[(a=h[o])[0]]=n[a[1]];return n});var bl=_l;Gi({target:"RegExp",proto:!0,forced:/./.exec!==bl},{exec:bl});var Ol=tl,Nl=yt,Dl=Xe("unscopables"),Ll=Array.prototype;null==Ll[Dl]&&Nl.f(Ll,Dl,{configurable:!0,value:Ol(null)});var kl,Pl,Bl,Ml=!n((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Ul=r,Ql=Be,xl=Q,Fl=Le,Vl=Ml,jl=sr("IE_PROTO"),Gl=Ul.Object,Kl=Gl.prototype,Hl=Vl?Gl.getPrototypeOf:function(e){var t=Fl(e);if(Ql(t,jl))return t[jl];var r=t.constructor;return xl(r)&&t instanceof r?r.prototype:t instanceof Gl?Kl:null},Yl=n,Wl=Q,Jl=Hl,ql=Ht.exports,zl=Xe("iterator"),Xl=!1;[].keys&&("next"in(Bl=[].keys())?(Pl=Jl(Jl(Bl)))!==Object.prototype&&(kl=Pl):Xl=!0),(null==kl||Yl((function(){var e={};return kl[zl].call(e)!==e})))&&(kl={}),Wl(kl[zl])||ql(kl,zl,(function(){return this}));var Zl={IteratorPrototype:kl,BUGGY_SAFARI_ITERATORS:Xl},$l=Zl.IteratorPrototype,ep=tl,tp=f,rp=on,ip=In,np=function(){return this},op=Gi,sp=d,ap=Dr,cp=Q,dp=function(e,t,r,i){var n=t+" Iterator";return e.prototype=ep($l,{next:tp(+!i,r)}),rp(e,n,!1),ip[n]=np,e},up=Hl,Ap=en,hp=on,lp=Kt,pp=Ht.exports,gp=In,fp=ap.PROPER,Ep=ap.CONFIGURABLE,Ip=Zl.IteratorPrototype,mp=Zl.BUGGY_SAFARI_ITERATORS,_p=Xe("iterator"),Cp="keys",vp="values",Sp="entries",yp=function(){return this},Rp=U,Tp=function(e){Ll[Dl][e]=!0},wp=In,bp=Rr,Op=yt.f,Np=function(e,t,r,i,n,o,s){dp(r,t,i);var a,c,d,u=function(e){if(e===n&&g)return g;if(!mp&&e in l)return l[e];switch(e){case Cp:case vp:case Sp:return function(){return new r(this,e)}}return function(){return new r(this)}},A=t+" Iterator",h=!1,l=e.prototype,p=l[_p]||l["@@iterator"]||n&&l[n],g=!mp&&p||u(n),f="Array"==t&&l.entries||p;if(f&&(a=up(f.call(new e)))!==Object.prototype&&a.next&&(up(a)!==Ip&&(Ap?Ap(a,Ip):cp(a[_p])||pp(a,_p,yp)),hp(a,A,!0)),fp&&n==vp&&p&&p.name!==vp&&(Ep?lp(l,"name",vp):(h=!0,g=function(){return sp(p,this)})),n)if(c={values:u(vp),keys:o?g:u(Cp),entries:u(Sp)},s)for(d in c)(mp||h||!(d in l))&&pp(l,d,c[d]);else op({target:t,proto:!0,forced:mp||h},c);return l[_p]!==g&&pp(l,_p,g,{name:n}),gp[t]=g,c},Dp=o,Lp="Array Iterator",kp=bp.set,Pp=bp.getterFor(Lp),Bp=Np(Array,"Array",(function(e,t){kp(this,{type:Lp,target:Rp(e),index:0,kind:t})}),(function(){var e=Pp(this),t=e.target,r=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:i,done:!1}:"values"==r?{value:t[i],done:!1}:{value:[i,t[i]],done:!1}}),"values"),Mp=wp.Arguments=wp.Array;if(Tp("keys"),Tp("values"),Tp("entries"),Dp&&"values"!==Mp.name)try{Op(Mp,"name",{value:"values"})}catch(e){}var Up=ht("span").classList,Qp=Up&&Up.constructor&&Up.constructor.prototype,xp=Qp===Object.prototype?void 0:Qp,Fp=r,Vp={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},jp=xp,Gp=Bp,Kp=Kt,Hp=Xe,Yp=Hp("iterator"),Wp=Hp("toStringTag"),Jp=Gp.values,qp=function(e,t){if(e){if(e[Yp]!==Jp)try{Kp(e,Yp,Jp)}catch(t){e[Yp]=Jp}if(e[Wp]||Kp(e,Wp,t),Vp[t])for(var r in Gp)if(e[r]!==Gp[r])try{Kp(e,r,Gp[r])}catch(t){e[r]=Gp[r]}}};for(var zp in Vp)qp(Fp[zp]&&Fp[zp].prototype,zp);qp(jp,"DOMTokenList");var Xp=Q,Zp=F,$p=en,eg=function(e,t,r){var i,n;return $p&&Xp(i=t.constructor)&&i!==r&&Zp(n=i.prototype)&&n!==r.prototype&&$p(e,n),e},tg=Rh,rg=function(e,t){return void 0===e?arguments.length<2?"":t:tg(e)},ig=F,ng=Kt,og=v("".replace),sg=String(Error("zxcasd").stack),ag=/\n\s*at [^:]*:[^\n]*/,cg=ag.test(sg),dg=function(e,t){if(cg&&"string"==typeof e)for(;t--;)e=og(e,ag,"");return e},ug=f,Ag=!n((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",ug(1,7)),7!==e.stack)})),hg=K,lg=Be,pg=Kt,gg=H,fg=en,Eg=Ti,Ig=eg,mg=rg,_g=function(e,t){ig(t)&&"cause"in t&&ng(e,"cause",t.cause)},Cg=dg,vg=Ag,Sg=Gi,yg=jo,Rg=function(e,t,r,i){var n=i?2:1,o=e.split("."),s=o[o.length-1],a=hg.apply(null,o);if(a){var c=a.prototype;if(lg(c,"cause")&&delete c.cause,!r)return a;var d=hg("Error"),u=t((function(e,t){var r=mg(i?t:e,void 0),o=i?new a(e):new a;return void 0!==r&&pg(o,"message",r),vg&&pg(o,"stack",Cg(o.stack,2)),this&&gg(c,this)&&Ig(o,this,u),arguments.length>n&&_g(o,arguments[n]),o}));u.prototype=c,"Error"!==s&&(fg?fg(u,d):Eg(u,d,{name:!0})),Eg(u,a);try{c.name!==s&&pg(c,"name",s),c.constructor=u}catch(e){}return u}},Tg="WebAssembly",wg=r.WebAssembly,bg=7!==Error("e",{cause:7}).cause,Og=function(e,t){var r={};r[e]=Rg(e,t,bg),Sg({global:!0,forced:bg},r)},Ng=function(e,t){if(wg&&wg[e]){var r={};r[e]=Rg("WebAssembly."+e,t,bg),Sg({target:Tg,stat:!0,forced:bg},r)}};Og("Error",(function(e){return function(t){return yg(e,this,arguments)}})),Og("EvalError",(function(e){return function(t){return yg(e,this,arguments)}})),Og("RangeError",(function(e){return function(t){return yg(e,this,arguments)}})),Og("ReferenceError",(function(e){return function(t){return yg(e,this,arguments)}})),Og("SyntaxError",(function(e){return function(t){return yg(e,this,arguments)}})),Og("TypeError",(function(e){return function(t){return yg(e,this,arguments)}})),Og("URIError",(function(e){return function(t){return yg(e,this,arguments)}})),Ng("CompileError",(function(e){return function(t){return yg(e,this,arguments)}})),Ng("LinkError",(function(e){return function(t){return yg(e,this,arguments)}})),Ng("RuntimeError",(function(e){return function(t){return yg(e,this,arguments)}}));let Dg=!0,Lg=!0;function kg(e,t,r){const i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)}function Pg(e,t,r){if(!e.RTCPeerConnection)return;const i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);const o=e=>{const t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,o),n.apply(this,[e,o])};const o=i.removeEventListener;i.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);const i=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,i])},Object.defineProperty(i,"on"+t,{get(){return this["_on"+t]},set(e){this["_on"+t]&&(this.removeEventListener(t,this["_on"+t]),delete this["_on"+t]),e&&this.addEventListener(t,this["_on"+t]=e)},enumerable:!0,configurable:!0})}function Bg(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Dg=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function Mg(e){return"boolean"!=typeof e?new Error("Argument type: "+typeof e+". Please use a boolean."):(Lg=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function Ug(){if("object"==typeof window){if(Dg)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Qg(e,t){Lg&&console.warn(e+" is deprecated, please use "+t+" instead.")}function xg(e){const t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;const{navigator:r}=e;if(r.mozGetUserMedia)t.browser="firefox",t.version=kg(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=kg(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(r.mediaDevices&&r.userAgent.match(/Edge\/(\d+).(\d+)$/))t.browser="edge",t.version=kg(r.userAgent,/Edge\/(\d+).(\d+)$/,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=kg(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function Fg(e){return"[object Object]"===Object.prototype.toString.call(e)}function Vg(e){var t;return Fg(e)?vh(t=Object.keys(e)).call(t,(function(t,r){const i=Fg(e[r]),n=i?Vg(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,{[r]:n})}),{}):e}function jg(e,t,r){const i=r?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;const o=[];return e.forEach(e=>{"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)}),o.forEach(t=>{e.forEach(r=>{r.type===i&&r.trackId===t.id&&function e(t,r,i){r&&!i.has(r.id)&&(i.set(r.id,r),Object.keys(r).forEach(n=>{n.endsWith("Id")?e(t,t.get(r[n]),i):n.endsWith("Ids")&&r[n].forEach(r=>{e(t,t.get(r),i)})}))}(e,r,n)})}),n}var Gg=ru.exports,Kg=mu,Hg=Gg("keys"),Yg=function(e){return Hg[e]||(Hg[e]=Kg(e))},Wg=!bc((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Jg=Qc,qg=pu,zg=Kc,Xg=Au,Zg=Wg,$g=Yg("IE_PROTO"),ef=Jg.Object,tf=ef.prototype,rf=Zg?ef.getPrototypeOf:function(e){var t=Xg(e);if(qg(t,$g))return t[$g];var r=t.constructor;return zg(r)&&t instanceof r?r.prototype:t instanceof ef?tf:null},nf=Qc,of=Kc,sf=nf.String,af=nf.TypeError,cf=Bc,df=vA,uf=function(e){if("object"==typeof e||of(e))return e;throw af("Can't set "+sf(e)+" as a prototype")},Af=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=cf(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return df(r),uf(i),t?e(r,i):r.__proto__=i,r}}():void 0),hf={},lf=XA,pf=Math.max,gf=Math.min,ff=function(e,t){var r=lf(e);return r<0?pf(r+t,0):gf(r,t)},Ef=Ed,If=ff,mf=th,_f=function(e){return function(t,r,i){var n,o=Ef(t),s=mf(o),a=If(i,s);if(e&&r!=r){for(;s>a;)if((n=o[a++])!=n)return!0}else for(;s>a;a++)if((e||a in o)&&o[a]===r)return e||a||0;return!e&&-1}},Cf={includes:_f(!0),indexOf:_f(!1)},vf={},Sf=pu,yf=Ed,Rf=Cf.indexOf,Tf=vf,wf=Bc([].push),bf=function(e,t){var r,i=yf(e),n=0,o=[];for(r in i)!Sf(Tf,r)&&Sf(i,r)&&wf(o,r);for(;t.length>n;)Sf(i,r=t[n++])&&(~Rf(o,r)||wf(o,r));return o},Of=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],Nf=bf,Df=Of.concat("length","prototype");hf.f=Object.getOwnPropertyNames||function(e){return Nf(e,Df)};var Lf={};Lf.f=Object.getOwnPropertySymbols;var kf=Rd,Pf=hf,Bf=Lf,Mf=vA,Uf=Bc([].concat),Qf=kf("Reflect","ownKeys")||function(e){var t=Pf.f(Mf(e)),r=Bf.f;return r?Uf(t,r(e)):t},xf=pu,Ff=Qf,Vf=Hc,jf=fA,Gf={},Kf=bf,Hf=Of,Yf=Object.keys||function(e){return Kf(e,Hf)},Wf=Yc,Jf=EA,qf=fA,zf=vA,Xf=Ed,Zf=Yf;Gf.f=Wf&&!Jf?Object.defineProperties:function(e,t){zf(e);for(var r,i=Xf(t),n=Zf(t),o=n.length,s=0;o>s;)qf.f(e,r=n[s++],i[r]);return e};var $f,eE=Rd("document","documentElement"),tE=vA,rE=Gf,iE=Of,nE=vf,oE=eE,sE=Hu,aE=Yg("IE_PROTO"),cE=function(){},dE=function(e){return"<script>"+e+"</"+"script>"},uE=function(e){e.write(dE("")),e.close();var t=e.parentWindow.Object;return e=null,t},AE=function(){try{$f=new ActiveXObject("htmlfile")}catch(e){}var e,t;AE="undefined"!=typeof document?document.domain&&$f?uE($f):((t=sE("iframe")).style.display="none",oE.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(dE("document.F=Object")),e.close(),e.F):uE($f);for(var r=iE.length;r--;)delete AE.prototype[iE[r]];return AE()};nE[aE]=!0;var hE=Object.create||function(e,t){var r;return null!==e?(cE.prototype=tE(e),r=new cE,cE.prototype=null,r[aE]=e):r=AE(),void 0===t?r:rE.f(r,t)},lE=Bc("".replace),pE=String(Error("zxcasd").stack),gE=/\n\s*at [^:]*:[^\n]*/,fE=gE.test(pE),EE=md,IE=MA,mE={},_E=mE,CE=Nu("iterator"),vE=Array.prototype,SE=function(e){return void 0!==e&&(_E.Array===e||vE[CE]===e)},yE={};yE[Nu("toStringTag")]="z";var RE="[object z]"===String(yE),TE=Qc,wE=RE,bE=Kc,OE=sd,NE=Nu("toStringTag"),DE=TE.Object,LE="Arguments"==OE(function(){return arguments}()),kE=wE?OE:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=DE(e),NE))?r:LE?OE(t):"Object"==(i=OE(t))&&bE(t.callee)?"Arguments":i},PE=kE,BE=Xd,ME=mE,UE=Nu("iterator"),QE=function(e){if(null!=e)return BE(e,UE)||BE(e,"@@iterator")||ME[PE(e)]},xE=qc,FE=qd,VE=vA,jE=Hd,GE=QE,KE=Qc.TypeError,HE=function(e,t){var r=arguments.length<2?GE(e):t;if(FE(r))return VE(xE(r,e));throw KE(jE(e)+" is not iterable")},YE=qc,WE=vA,JE=Xd,qE=function(e,t,r){var i,n;WE(e);try{if(!(i=JE(e,"return"))){if("throw"===t)throw r;return r}i=YE(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return WE(i),r},zE=gA,XE=qc,ZE=vA,$E=Hd,eI=SE,tI=th,rI=Mc,iI=HE,nI=QE,oI=qE,sI=Qc.TypeError,aI=function(e,t){this.stopped=e,this.result=t},cI=aI.prototype,dI=function(e,t,r){var i,n,o,s,a,c,d,u=r&&r.that,A=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_ITERATOR),l=!(!r||!r.INTERRUPTED),p=zE(t,u),g=function(e){return i&&oI(i,"normal",e),new aI(!0,e)},f=function(e){return A?(ZE(e),l?p(e[0],e[1],g):p(e[0],e[1])):l?p(e,g):p(e)};if(h)i=e;else{if(!(n=nI(e)))throw sI($E(e)+" is not iterable");if(eI(n)){for(o=0,s=tI(e);s>o;o++)if((a=f(e[o]))&&rI(cI,a))return a;return new aI(!1)}i=iI(e,n)}for(c=i.next;!(d=XE(c,i)).done;){try{a=f(d.value)}catch(e){oI(i,"throw",e)}if("object"==typeof a&&a&&rI(cI,a))return a}return new aI(!1)},uI=kE,AI=Qc.String,hI=function(e){if("Symbol"===uI(e))throw TypeError("Cannot convert a Symbol value to a string");return AI(e)},lI=hI,pI=rd,gI=!bc((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",pI(1,7)),7!==e.stack)})),fI=JA,EI=Qc,II=Mc,mI=rf,_I=Af,CI=function(e,t,r){for(var i=Ff(t),n=jf.f,o=Vf.f,s=0;s<i.length;s++){var a=i[s];xf(e,a)||r&&xf(r,a)||n(e,a,o(t,a))}},vI=hE,SI=MA,yI=rd,RI=function(e,t){if(fE&&"string"==typeof e)for(;t--;)e=lE(e,gE,"");return e},TI=function(e,t){EE(t)&&"cause"in t&&IE(e,"cause",t.cause)},wI=dI,bI=function(e,t){return void 0===e?arguments.length<2?"":t:lI(e)},OI=gI,NI=Nu("toStringTag"),DI=EI.Error,LI=[].push,kI=function(e,t){var r,i=arguments.length>2?arguments[2]:void 0,n=II(PI,this);_I?r=_I(new DI,n?mI(this):PI):(r=n?this:vI(PI),SI(r,NI,"Error")),void 0!==t&&SI(r,"message",bI(t)),OI&&SI(r,"stack",RI(r.stack,1)),TI(r,i);var o=[];return wI(e,LI,{that:o}),SI(r,"errors",o),r};_I?_I(kI,DI):CI(kI,DI,{name:!0});var PI=kI.prototype=vI(DI.prototype,{constructor:yI(1,kI),message:yI(1,""),name:yI(1,"AggregateError")});fI({global:!0},{AggregateError:kI});var BI=Kc,MI=au,UI=Bc(Function.toString);BI(MI.inspectSource)||(MI.inspectSource=function(e){return UI(e)});var QI,xI,FI,VI=MI.inspectSource,jI=Kc,GI=VI,KI=Qc.WeakMap,HI=jI(KI)&&/native code/.test(GI(KI)),YI=Qc,WI=Bc,JI=md,qI=MA,zI=pu,XI=au,ZI=Yg,$I=vf,em="Object already initialized",tm=YI.TypeError,rm=YI.WeakMap;if(HI||XI.state){var im=XI.state||(XI.state=new rm),nm=WI(im.get),om=WI(im.has),sm=WI(im.set);QI=function(e,t){if(om(im,e))throw new tm(em);return t.facade=e,sm(im,e,t),t},xI=function(e){return nm(im,e)||{}},FI=function(e){return om(im,e)}}else{var am=ZI("state");$I[am]=!0,QI=function(e,t){if(zI(e,am))throw new tm(em);return t.facade=e,qI(e,am,t),t},xI=function(e){return zI(e,am)?e[am]:{}},FI=function(e){return zI(e,am)}}var cm,dm,um,Am={set:QI,get:xI,has:FI,enforce:function(e){return FI(e)?xI(e):QI(e,{})},getterFor:function(e){return function(t){var r;if(!JI(t)||(r=xI(t)).type!==e)throw tm("Incompatible receiver, "+e+" required");return r}}},hm=Yc,lm=pu,pm=Function.prototype,gm=hm&&Object.getOwnPropertyDescriptor,fm=lm(pm,"name"),Em={EXISTS:fm,PROPER:fm&&"something"===function(){}.name,CONFIGURABLE:fm&&(!hm||hm&&gm(pm,"name").configurable)},Im=MA,mm=function(e,t,r,i){i&&i.enumerable?e[t]=r:Im(e,t,r)},_m=bc,Cm=Kc,vm=hE,Sm=rf,ym=mm,Rm=Nu("iterator"),Tm=!1;[].keys&&("next"in(um=[].keys())?(dm=Sm(Sm(um)))!==Object.prototype&&(cm=dm):Tm=!0);var wm=null==cm||_m((function(){var e={};return cm[Rm].call(e)!==e}));Cm((cm=wm?{}:vm(cm))[Rm])||ym(cm,Rm,(function(){return this}));var bm={IteratorPrototype:cm,BUGGY_SAFARI_ITERATORS:Tm},Om=kE,Nm=RE?{}.toString:function(){return"[object "+Om(this)+"]"},Dm=RE,Lm=fA.f,km=MA,Pm=pu,Bm=Nm,Mm=Nu("toStringTag"),Um=function(e,t,r,i){if(e){var n=r?e:e.prototype;Pm(n,Mm)||Lm(n,Mm,{configurable:!0,value:t}),i&&!Dm&&km(n,"toString",Bm)}},Qm=bm.IteratorPrototype,xm=hE,Fm=rd,Vm=Um,jm=mE,Gm=function(){return this},Km=function(e,t,r,i){var n=t+" Iterator";return e.prototype=xm(Qm,{next:Fm(+!i,r)}),Vm(e,n,!1,!0),jm[n]=Gm,e},Hm=JA,Ym=qc,Wm=Km,Jm=rf,qm=Um,zm=mm,Xm=mE,Zm=Em.PROPER,$m=bm.BUGGY_SAFARI_ITERATORS,e_=Nu("iterator"),t_="keys",r_="values",i_="entries",n_=function(){return this},o_=function(e,t,r,i,n,o,s){Wm(r,t,i);var a,c,d,u=function(e){if(e===n&&g)return g;if(!$m&&e in l)return l[e];switch(e){case t_:case r_:case i_:return function(){return new r(this,e)}}return function(){return new r(this)}},A=t+" Iterator",h=!1,l=e.prototype,p=l[e_]||l["@@iterator"]||n&&l[n],g=!$m&&p||u(n),f="Array"==t&&l.entries||p;if(f&&(a=Jm(f.call(new e)))!==Object.prototype&&a.next&&(qm(a,A,!0,!0),Xm[A]=n_),Zm&&n==r_&&p&&p.name!==r_&&(h=!0,g=function(){return Ym(p,this)}),n)if(c={values:u(r_),keys:o?g:u(t_),entries:u(i_)},s)for(d in c)($m||h||!(d in l))&&zm(l,d,c[d]);else Hm({target:t,proto:!0,forced:$m||h},c);return s&&l[e_]!==g&&zm(l,e_,g,{name:n}),Xm[t]=g,c},s_=Ed,a_=mE,c_=Am;fA.f;var d_=o_,u_="Array Iterator",A_=c_.set,h_=c_.getterFor(u_);d_(Array,"Array",(function(e,t){A_(this,{type:u_,target:s_(e),index:0,kind:t})}),(function(){var e=h_(this),t=e.target,r=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:i,done:!1}:"values"==r?{value:t[i],done:!1}:{value:[i,t[i]],done:!1}}),"values"),a_.Arguments=a_.Array;var l_=Qc.Promise,p_=mm,g_=function(e,t,r){for(var i in t)r&&r.unsafe&&e[i]?e[i]=t[i]:p_(e,i,t[i],r);return e},f_=Rd,E_=fA,I_=Yc,m_=Nu("species"),__=Mc,C_=Qc.TypeError,v_=function(e,t){if(__(t,e))return e;throw C_("Incorrect invocation")},S_=Nu("iterator"),y_=!1;try{var R_=0,T_={next:function(){return{done:!!R_++}},return:function(){y_=!0}};T_[S_]=function(){return this},Array.from(T_,(function(){throw 2}))}catch(e){}var w_=Bc,b_=bc,O_=Kc,N_=kE,D_=VI,L_=function(){},k_=[],P_=Rd("Reflect","construct"),B_=/^\s*(?:class|function)\b/,M_=w_(B_.exec),U_=!B_.exec(L_),Q_=function(e){if(!O_(e))return!1;try{return P_(L_,k_,e),!0}catch(e){return!1}},x_=function(e){if(!O_(e))return!1;switch(N_(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return U_||!!M_(B_,D_(e))}catch(e){return!0}};x_.sham=!0;var F_,V_,j_,G_,K_=!P_||b_((function(){var e;return Q_(Q_.call)||!Q_(Object)||!Q_((function(){e=!0}))||e}))?x_:Q_,H_=K_,Y_=Hd,W_=Qc.TypeError,J_=vA,q_=function(e){if(H_(e))return e;throw W_(Y_(e)+" is not a constructor")},z_=Nu("species"),X_=function(e,t){var r,i=J_(e).constructor;return void 0===i||null==(r=J_(i)[z_])?t:q_(r)},Z_=Bc([].slice),$_=/(?:ipad|iphone|ipod).*applewebkit/i.test(Td),eC=Qc,tC=Gc,rC=gA,iC=Kc,nC=pu,oC=bc,sC=eE,aC=Z_,cC=Hu,dC=$_,uC=Ah,AC=eC.setImmediate,hC=eC.clearImmediate,lC=eC.process,pC=eC.Dispatch,gC=eC.Function,fC=eC.MessageChannel,EC=eC.String,IC=0,mC={},_C="onreadystatechange";try{F_=eC.location}catch(e){}var CC=function(e){if(nC(mC,e)){var t=mC[e];delete mC[e],t()}},vC=function(e){return function(){CC(e)}},SC=function(e){CC(e.data)},yC=function(e){eC.postMessage(EC(e),F_.protocol+"//"+F_.host)};AC&&hC||(AC=function(e){var t=aC(arguments,1);return mC[++IC]=function(){tC(iC(e)?e:gC(e),void 0,t)},V_(IC),IC},hC=function(e){delete mC[e]},uC?V_=function(e){lC.nextTick(vC(e))}:pC&&pC.now?V_=function(e){pC.now(vC(e))}:fC&&!dC?(G_=(j_=new fC).port2,j_.port1.onmessage=SC,V_=rC(G_.postMessage,G_)):eC.addEventListener&&iC(eC.postMessage)&&!eC.importScripts&&F_&&"file:"!==F_.protocol&&!oC(yC)?(V_=yC,eC.addEventListener("message",SC,!1)):V_=_C in cC("script")?function(e){sC.appendChild(cC("script")).onreadystatechange=function(){sC.removeChild(this),CC(e)}}:function(e){setTimeout(vC(e),0)});var RC,TC,wC,bC,OC,NC,DC,LC,kC={set:AC,clear:hC},PC=Qc,BC=/ipad|iphone|ipod/i.test(Td)&&void 0!==PC.Pebble,MC=/web0s(?!.*chrome)/i.test(Td),UC=Qc,QC=gA,xC=Hc.f,FC=kC.set,VC=$_,jC=BC,GC=MC,KC=Ah,HC=UC.MutationObserver||UC.WebKitMutationObserver,YC=UC.document,WC=UC.process,JC=UC.Promise,qC=xC(UC,"queueMicrotask"),zC=qC&&qC.value;zC||(RC=function(){var e,t;for(KC&&(e=WC.domain)&&e.exit();TC;){t=TC.fn,TC=TC.next;try{t()}catch(e){throw TC?bC():wC=void 0,e}}wC=void 0,e&&e.enter()},VC||KC||GC||!HC||!YC?!jC&&JC&&JC.resolve?((DC=JC.resolve(void 0)).constructor=JC,LC=QC(DC.then,DC),bC=function(){LC(RC)}):KC?bC=function(){WC.nextTick(RC)}:(FC=QC(FC,UC),bC=function(){FC(RC)}):(OC=!0,NC=YC.createTextNode(""),new HC(RC).observe(NC,{characterData:!0}),bC=function(){NC.data=OC=!OC}));var XC=zC||function(e){var t={fn:e,next:void 0};wC&&(wC.next=t),TC||(TC=t,bC()),wC=t},ZC={},$C=qd,ev=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=i})),this.resolve=$C(t),this.reject=$C(r)};ZC.f=function(e){return new ev(e)};var tv=vA,rv=md,iv=ZC,nv=function(e,t){if(tv(e),rv(t)&&t.constructor===e)return t;var r=iv.f(e);return(0,r.resolve)(t),r.promise},ov=Qc,sv=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},av=function(){this.head=null,this.tail=null};av.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}};var cv,dv,uv,Av="object"==typeof window,hv=JA,lv=Qc,pv=Rd,gv=qc,fv=l_,Ev=g_,Iv=Um,mv=function(e){var t=f_(e),r=E_.f;I_&&t&&!t[m_]&&r(t,m_,{configurable:!0,get:function(){return this}})},_v=qd,Cv=Kc,vv=md,Sv=v_,yv=VI,Rv=dI,Tv=function(e,t){if(!t&&!y_)return!1;var r=!1;try{var i={};i[S_]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},wv=X_,bv=kC.set,Ov=XC,Nv=nv,Dv=function(e,t){var r=ov.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},Lv=ZC,kv=sv,Pv=av,Bv=Am,Mv=AA,Uv=Av,Qv=Ah,xv=kd,Fv=Nu("species"),Vv="Promise",jv=Bv.getterFor(Vv),Gv=Bv.set,Kv=Bv.getterFor(Vv),Hv=fv&&fv.prototype,Yv=fv,Wv=Hv,Jv=lv.TypeError,qv=lv.document,zv=lv.process,Xv=Lv.f,Zv=Xv,$v=!!(qv&&qv.createEvent&&lv.dispatchEvent),eS=Cv(lv.PromiseRejectionEvent),tS="unhandledrejection",rS=Mv(Vv,(function(){var e=yv(Yv),t=e!==String(Yv);if(!t&&66===xv)return!0;if(!Wv.finally)return!0;if(xv>=51&&/native code/.test(e))return!1;var r=new Yv((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};return(r.constructor={})[Fv]=i,!(r.then((function(){}))instanceof i)||!t&&Uv&&!eS})),iS=rS||!Tv((function(e){Yv.all(e).catch((function(){}))})),nS=function(e){var t;return!(!vv(e)||!Cv(t=e.then))&&t},oS=function(e,t){var r,i,n,o=t.value,s=1==t.state,a=s?e.ok:e.fail,c=e.resolve,d=e.reject,u=e.domain;try{a?(s||(2===t.rejection&&uS(t),t.rejection=1),!0===a?r=o:(u&&u.enter(),r=a(o),u&&(u.exit(),n=!0)),r===e.promise?d(Jv("Promise-chain cycle")):(i=nS(r))?gv(i,r,c,d):c(r)):d(o)}catch(e){u&&!n&&u.exit(),d(e)}},sS=function(e,t){e.notified||(e.notified=!0,Ov((function(){for(var r,i=e.reactions;r=i.get();)oS(r,e);e.notified=!1,t&&!e.rejection&&cS(e)})))},aS=function(e,t,r){var i,n;$v?((i=qv.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),lv.dispatchEvent(i)):i={promise:t,reason:r},!eS&&(n=lv["on"+e])?n(i):e===tS&&Dv("Unhandled promise rejection",r)},cS=function(e){gv(bv,lv,(function(){var t,r=e.facade,i=e.value;if(dS(e)&&(t=kv((function(){Qv?zv.emit("unhandledRejection",i,r):aS(tS,r,i)})),e.rejection=Qv||dS(e)?2:1,t.error))throw t.value}))},dS=function(e){return 1!==e.rejection&&!e.parent},uS=function(e){gv(bv,lv,(function(){var t=e.facade;Qv?zv.emit("rejectionHandled",t):aS("rejectionhandled",t,e.value)}))},AS=function(e,t,r){return function(i){e(t,i,r)}},hS=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,sS(e,!0))},lS=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Jv("Promise can't be resolved itself");var i=nS(t);i?Ov((function(){var r={done:!1};try{gv(i,t,AS(lS,r,e),AS(hS,r,e))}catch(t){hS(r,t,e)}})):(e.value=t,e.state=1,sS(e,!1))}catch(t){hS({done:!1},t,e)}}};rS&&(Wv=(Yv=function(e){Sv(this,Wv),_v(e),gv(cv,this);var t=jv(this);try{e(AS(lS,t),AS(hS,t))}catch(e){hS(t,e)}}).prototype,(cv=function(e){Gv(this,{type:Vv,done:!1,notified:!1,parent:!1,reactions:new Pv,rejection:!1,state:0,value:void 0})}).prototype=Ev(Wv,{then:function(e,t){var r=Kv(this),i=Xv(wv(this,Yv));return r.parent=!0,i.ok=!Cv(e)||e,i.fail=Cv(t)&&t,i.domain=Qv?zv.domain:void 0,0==r.state?r.reactions.add(i):Ov((function(){oS(i,r)})),i.promise},catch:function(e){return this.then(void 0,e)}}),dv=function(){var e=new cv,t=jv(e);this.promise=e,this.resolve=AS(lS,t),this.reject=AS(hS,t)},Lv.f=Xv=function(e){return e===Yv||e===uv?new dv(e):Zv(e)}),hv({global:!0,wrap:!0,forced:rS},{Promise:Yv}),Iv(Yv,Vv,!1,!0),mv(Vv),uv=pv(Vv),hv({target:Vv,stat:!0,forced:rS},{reject:function(e){var t=Xv(this);return gv(t.reject,void 0,e),t.promise}}),hv({target:Vv,stat:!0,forced:true},{resolve:function(e){return Nv(this===uv?Yv:this,e)}}),hv({target:Vv,stat:!0,forced:iS},{all:function(e){var t=this,r=Xv(t),i=r.resolve,n=r.reject,o=kv((function(){var r=_v(t.resolve),o=[],s=0,a=1;Rv(e,(function(e){var c=s++,d=!1;a++,gv(r,t,e).then((function(e){d||(d=!0,o[c]=e,--a||i(o))}),n)})),--a||i(o)}));return o.error&&n(o.value),r.promise},race:function(e){var t=this,r=Xv(t),i=r.reject,n=kv((function(){var n=_v(t.resolve);Rv(e,(function(e){gv(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var pS=qc,gS=qd,fS=ZC,ES=sv,IS=dI;JA({target:"Promise",stat:!0},{allSettled:function(e){var t=this,r=fS.f(t),i=r.resolve,n=r.reject,o=ES((function(){var r=gS(t.resolve),n=[],o=0,s=1;IS(e,(function(e){var a=o++,c=!1;s++,pS(r,t,e).then((function(e){c||(c=!0,n[a]={status:"fulfilled",value:e},--s||i(n))}),(function(e){c||(c=!0,n[a]={status:"rejected",reason:e},--s||i(n))}))})),--s||i(n)}));return o.error&&n(o.value),r.promise}});var mS=qd,_S=Rd,CS=qc,vS=ZC,SS=sv,yS=dI,RS="No one promise resolved";JA({target:"Promise",stat:!0},{any:function(e){var t=this,r=_S("AggregateError"),i=vS.f(t),n=i.resolve,o=i.reject,s=SS((function(){var i=mS(t.resolve),s=[],a=0,c=1,d=!1;yS(e,(function(e){var u=a++,A=!1;c++,CS(i,t,e).then((function(e){A||d||(d=!0,n(e))}),(function(e){A||d||(A=!0,s[u]=e,--c||o(new r(s,RS)))}))})),--c||o(new r(s,RS))}));return s.error&&o(s.value),i.promise}});var TS=l_,wS=Rd,bS=Kc,OS=X_,NS=nv;JA({target:"Promise",proto:!0,real:!0,forced:!!TS&&bc((function(){TS.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=OS(this,wS("Promise")),r=bS(e);return this.then(r?function(r){return NS(t,e()).then((function(){return r}))}:e,r?function(r){return NS(t,e()).then((function(){throw r}))}:e)}});var DS=Bc,LS=XA,kS=hI,PS=pd,BS=DS("".charAt),MS=DS("".charCodeAt),US=DS("".slice),QS=function(e){return function(t,r){var i,n,o=kS(PS(t)),s=LS(r),a=o.length;return s<0||s>=a?e?"":void 0:(i=MS(o,s))<55296||i>56319||s+1===a||(n=MS(o,s+1))<56320||n>57343?e?BS(o,s):i:e?US(o,s,s+2):n-56320+(i-55296<<10)+65536}},xS={codeAt:QS(!1),charAt:QS(!0)},FS=xS.charAt,VS=hI,jS=Am,GS=o_,KS="String Iterator",HS=jS.set,YS=jS.getterFor(KS);GS(String,"String",(function(e){HS(this,{type:KS,string:VS(e),index:0})}),(function(){var e,t=YS(this),r=t.string,i=t.index;return i>=r.length?{value:void 0,done:!0}:(e=FS(r,i),t.index+=e.length,{value:e,done:!1})}));var WS=_d.Promise,JS={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0},qS=Qc,zS=kE,XS=MA,ZS=mE,$S=Nu("toStringTag");for(var ey in JS){var ty=qS[ey],ry=ty&&ty.prototype;ry&&zS(ry)!==$S&&XS(ry,$S,ey),ZS[ey]=ZS.Array}var iy=WS,ny=iy,oy=Yo,sy=o,ay=n,cy=Nt,dy=tl,uy=rg,Ay=Error.prototype.toString,hy=ay((function(){if(sy){var e=dy(Object.defineProperty({},"name",{get:function(){return this===e}}));if("true"!==Ay.call(e))return!0}return"2: 1"!==Ay.call({message:1,name:2})||"Error"!==Ay.call({})}))?function(){var e=cy(this),t=uy(e.name,"Error"),r=uy(e.message);return t?r?t+": "+r:t:r}:Ay,ly={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}},py=Gi,gy=function(e){try{if(oy)return Function('return require("'+e+'")')()}catch(e){}},fy=K,Ey=n,Iy=tl,my=f,_y=yt.f,Cy=kh.f,vy=Ht.exports,Sy=Be,yy=ln,Ry=Nt,Ty=hy,wy=rg,by=ly,Oy=dg,Ny=Rr,Dy=o,Ly="DOMException",ky="DATA_CLONE_ERR",Py=fy("Error"),By=fy(Ly)||function(){try{(new(fy("MessageChannel")||gy("worker_threads").MessageChannel)).port1.postMessage(new WeakMap)}catch(e){if(e.name==ky&&25==e.code)return e.constructor}}(),My=By&&By.prototype,Uy=Py.prototype,Qy=Ny.set,xy=Ny.getterFor(Ly),Fy="stack"in Py(Ly),Vy=function(e){return Sy(by,e)&&by[e].m?by[e].c:0},jy=function(){yy(this,Gy);var e=arguments.length,t=wy(e<1?void 0:arguments[0]),r=wy(e<2?void 0:arguments[1],"Error"),i=Vy(r);if(Qy(this,{type:Ly,name:r,message:t,code:i}),Dy||(this.name=r,this.message=t,this.code=i),Fy){var n=Py(t);n.name=Ly,_y(this,"stack",my(1,Oy(n.stack,1)))}},Gy=jy.prototype=Iy(Uy),Ky=function(e){return{enumerable:!0,configurable:!0,get:e}},Hy=function(e){return Ky((function(){return xy(this)[e]}))};Dy&&Cy(Gy,{name:Hy("name"),message:Hy("message"),code:Hy("code")}),_y(Gy,"constructor",my(1,jy));var Yy=Ey((function(){return!(new By instanceof Py)})),Wy=Yy||Ey((function(){return Uy.toString!==Ty||"2: 1"!==String(new By(1,2))})),Jy=Yy||Ey((function(){return 25!==new By(1,"DataCloneError").code}));Yy||25!==By.DATA_CLONE_ERR||My.DATA_CLONE_ERR;py({global:!0,forced:Yy},{DOMException:Yy?jy:By});var qy=fy(Ly),zy=qy.prototype;for(var Xy in Wy&&By===qy&&vy(zy,"toString",Ty),Jy&&Dy&&By===qy&&_y(zy,"code",Ky((function(){return Vy(Ry(this).name)}))),by)if(Sy(by,Xy)){var Zy=by[Xy],$y=Zy.s,eR=my(6,Zy.c);Sy(qy,$y)||_y(qy,$y,eR),Sy(zy,$y)||_y(zy,$y,eR)}var tR=Gi,rR=K,iR=f,nR=yt.f,oR=Be,sR=ln,aR=eg,cR=rg,dR=ly,uR=dg,AR="DOMException",hR=rR("Error"),lR=rR(AR),pR=function(){sR(this,gR);var e=arguments.length,t=cR(e<1?void 0:arguments[0]),r=cR(e<2?void 0:arguments[1],"Error"),i=new lR(t,r),n=hR(t);return n.name=AR,nR(i,"stack",iR(1,uR(n.stack,1))),aR(i,this,pR),i},gR=pR.prototype=lR.prototype,fR="stack"in hR(AR),ER="stack"in new lR(1,2),IR=fR&&!ER;tR({global:!0,forced:IR},{DOMException:IR?pR:lR});var mR=rR(AR),_R=mR.prototype;if(_R.constructor!==mR)for(var CR in nR(_R,"constructor",iR(1,mR)),dR)if(oR(dR,CR)){var vR=dR[CR],SR=vR.s;oR(mR,SR)||nR(mR,SR,iR(6,vR.c))}var yR="DOMException";on(K(yR),yR);var RR=v,TR=Ht.exports,wR=bl,bR=n,OR=Xe,NR=Kt,DR=OR("species"),LR=RegExp.prototype,kR=v,PR=Hr,BR=Rh,MR=P,UR=kR("".charAt),QR=kR("".charCodeAt),xR=kR("".slice),FR=function(e){return function(t,r){var i,n,o=BR(MR(t)),s=PR(r),a=o.length;return s<0||s>=a?e?"":void 0:(i=QR(o,s))<55296||i>56319||s+1===a||(n=QR(o,s+1))<56320||n>57343?e?UR(o,s):i:e?xR(o,s,s+2):n-56320+(i-55296<<10)+65536}},VR={codeAt:FR(!1),charAt:FR(!0)}.charAt,jR=v,GR=Le,KR=Math.floor,HR=jR("".charAt),YR=jR("".replace),WR=jR("".slice),JR=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,qR=/\$([$&'`]|\d{1,2})/g,zR=d,XR=Nt,ZR=Q,$R=T,eT=bl,tT=r.TypeError,rT=jo,iT=d,nT=v,oT=function(e,t,r,i){var n=OR(e),o=!bR((function(){var t={};return t[n]=function(){return 7},7!=""[e](t)})),s=o&&!bR((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[DR]=function(){return r},r.flags="",r[n]=/./[n]),r.exec=function(){return t=!0,null},r[n](""),!t}));if(!o||!s||r){var a=RR(/./[n]),c=t(n,""[e],(function(e,t,r,i,n){var s=RR(e),c=t.exec;return c===wR||c===LR.exec?o&&!n?{done:!0,value:a(t,r,i)}:{done:!0,value:s(r,t,i)}:{done:!1}}));TR(String.prototype,e,c[0]),TR(LR,n,c[1])}i&&NR(LR[n],"sham",!0)},sT=n,aT=Nt,cT=Q,dT=Hr,uT=Zr,AT=Rh,hT=P,lT=function(e,t,r){return t+(r?VR(e,t).length:1)},pT=Ee,gT=function(e,t,r,i,n,o){var s=r+e.length,a=i.length,c=qR;return void 0!==n&&(n=GR(n),c=JR),YR(o,c,(function(o,c){var d;switch(HR(c,0)){case"$":return"$";case"&":return e;case"`":return WR(t,0,r);case"'":return WR(t,s);case"<":d=n[WR(c,1,-1)];break;default:var u=+c;if(0===u)return o;if(u>a){var A=KR(u/10);return 0===A?o:A<=a?void 0===i[A-1]?HR(c,1):i[A-1]+HR(c,1):o}d=i[u-1]}return void 0===d?"":d}))},fT=function(e,t){var r=e.exec;if(ZR(r)){var i=zR(r,e,t);return null!==i&&XR(i),i}if("RegExp"===$R(e))return zR(eT,e,t);throw tT("RegExp#exec called on incompatible receiver")},ET=Xe("replace"),IT=Math.max,mT=Math.min,_T=nT([].concat),CT=nT([].push),vT=nT("".indexOf),ST=nT("".slice),yT="$0"==="a".replace(/./,"$0"),RT=!!/./[ET]&&""===/./[ET]("a","$0");oT("replace",(function(e,t,r){var i=RT?"$":"$0";return[function(e,r){var i=hT(this),n=null==e?void 0:pT(e,ET);return n?iT(n,e,i,r):iT(t,AT(i),e,r)},function(e,n){var o=aT(this),s=AT(e);if("string"==typeof n&&-1===vT(n,i)&&-1===vT(n,"$<")){var a=r(t,o,s,n);if(a.done)return a.value}var c=cT(n);c||(n=AT(n));var d=o.global;if(d){var u=o.unicode;o.lastIndex=0}for(var A=[];;){var h=fT(o,s);if(null===h)break;if(CT(A,h),!d)break;""===AT(h[0])&&(o.lastIndex=lT(s,uT(o.lastIndex),u))}for(var l,p="",g=0,f=0;f<A.length;f++){for(var E=AT((h=A[f])[0]),I=IT(mT(dT(h.index),s.length),0),m=[],_=1;_<h.length;_++)CT(m,void 0===(l=h[_])?l:String(l));var C=h.groups;if(c){var v=_T([E],m,I,s);void 0!==C&&CT(v,C);var S=AT(rT(n,void 0,v))}else S=gT(E,s,I,m,C,n);I>=g&&(p+=ST(s,g,I)+S,g=I+E.length)}return p+ST(s,g)}]}),!!sT((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!yT||RT);var TT=F,wT=T,bT=Xe("match"),OT=o,NT=r,DT=v,LT=Bi,kT=eg,PT=Kt,BT=yt.f,MT=jr.f,UT=H,QT=function(e){var t;return TT(e)&&(void 0!==(t=e[bT])?!!t:"RegExp"==wT(e))},xT=Rh,FT=wh,VT=Lh,jT=Ht.exports,GT=n,KT=Be,HT=Rr.enforce,YT=un,WT=nl,JT=al,qT=Xe("match"),zT=NT.RegExp,XT=zT.prototype,ZT=NT.SyntaxError,$T=DT(FT),ew=DT(XT.exec),tw=DT("".charAt),rw=DT("".replace),iw=DT("".indexOf),nw=DT("".slice),ow=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,sw=/a/g,aw=/a/g,cw=new zT(sw)!==sw,dw=VT.MISSED_STICKY,uw=VT.UNSUPPORTED_Y,Aw=OT&&(!cw||dw||WT||JT||GT((function(){return aw[qT]=!1,zT(sw)!=sw||zT(aw)==aw||"/a/i"!=zT(sw,"i")})));if(LT("RegExp",Aw)){for(var hw=function(e,t){var r,i,n,o,s,a,c=UT(XT,this),d=QT(e),u=void 0===t,A=[],h=e;if(!c&&d&&u&&e.constructor===hw)return e;if((d||UT(XT,e))&&(e=e.source,u&&(t="flags"in h?h.flags:$T(h))),e=void 0===e?"":xT(e),t=void 0===t?"":xT(t),h=e,WT&&"dotAll"in sw&&(i=!!t&&iw(t,"s")>-1)&&(t=rw(t,/s/g,"")),r=t,dw&&"sticky"in sw&&(n=!!t&&iw(t,"y")>-1)&&uw&&(t=rw(t,/y/g,"")),JT&&(e=(o=function(e){for(var t,r=e.length,i=0,n="",o=[],s={},a=!1,c=!1,d=0,u="";i<=r;i++){if("\\"===(t=tw(e,i)))t+=tw(e,++i);else if("]"===t)a=!1;else if(!a)switch(!0){case"["===t:a=!0;break;case"("===t:ew(ow,nw(e,i+1))&&(i+=2,c=!0),n+=t,d++;continue;case">"===t&&c:if(""===u||KT(s,u))throw new ZT("Invalid capture group name");s[u]=!0,o[o.length]=[u,d],c=!1,u="";continue}c?u+=t:n+=t}return[n,o]}(e))[0],A=o[1]),s=kT(zT(e,t),c?this:XT,hw),(i||n||A.length)&&(a=HT(s),i&&(a.dotAll=!0,a.raw=hw(function(e){for(var t,r=e.length,i=0,n="",o=!1;i<=r;i++)"\\"!==(t=tw(e,i))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+tw(e,++i);return n}(e),r)),n&&(a.sticky=!0),A.length&&(a.groups=A)),e!==h)try{PT(s,"source",""===h?"(?:)":h)}catch(e){}return s},lw=function(e){e in hw||BT(hw,e,{configurable:!0,get:function(){return zT[e]},set:function(t){zT[e]=t}})},pw=MT(zT),gw=0;pw.length>gw;)lw(pw[gw++]);XT.constructor=hw,hw.prototype=XT,jT(NT,"RegExp",hw)}YT("RegExp");var fw=r,Ew=o,Iw=nl,mw=T,_w=yt.f,Cw=Rr.get,vw=RegExp.prototype,Sw=fw.TypeError;Ew&&Iw&&_w(vw,"dotAll",{configurable:!0,get:function(){if(this!==vw){if("RegExp"===mw(this))return!!Cw(this).dotAll;throw Sw("Incompatible receiver, RegExp required")}}});const yw=Ug;function Rw(e,t){const r=e&&e.navigator;if(!r.mediaDevices)return;const i=function(e){if("object"!=typeof e||e.mandatory||e.optional)return e;const t={};return Object.keys(e).forEach(r=>{if("require"===r||"advanced"===r||"mediaSource"===r)return;const i="object"==typeof e[r]?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);const n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];let e={};"number"==typeof i.ideal?(e[n("min",r)]=i.ideal,t.optional.push(e),e={},e[n("max",r)]=i.ideal,t.optional.push(e)):(e[n("",r)]=i.ideal,t.optional.push(e))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",r)]=i.exact):["min","max"].forEach(e=>{void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,r)]=i[e])})}),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},n=function(e,n){if(t.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"==typeof e.audio){const t=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};t((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),t(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"==typeof e.video){let o=e.video.facingMode;o=o&&("object"==typeof o?o:{ideal:o});const s=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||s)){let t;if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?t=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(t=["front"]),t)return r.mediaDevices.enumerateDevices().then(r=>{let s=(r=r.filter(e=>"videoinput"===e.kind)).find(e=>t.some(t=>e.label.toLowerCase().includes(t)));return!s&&r.length&&t.includes("back")&&(s=r[r.length-1]),s&&(e.video.deviceId=o.exact?{exact:s.deviceId}:{ideal:s.deviceId}),e.video=i(e.video),yw("chrome: "+JSON.stringify(e)),n(e)})}e.video=i(e.video)}return yw("chrome: "+JSON.stringify(e)),n(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,i){n(e,e=>{r.webkitGetUserMedia(e,t,e=>{i&&i(o(e))})})}.bind(r),r.mediaDevices.getUserMedia){const e=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(t){return n(t,t=>e(t).then(e=>{if(t.audio&&!e.getAudioTracks().length||t.video&&!e.getVideoTracks().length)throw e.getTracks().forEach(e=>{e.stop()}),new DOMException("","NotFoundError");return e},e=>ny.reject(o(e))))}}}function Tw(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function ww(e){if("object"==typeof e&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=t=>{t.stream.addEventListener("addtrack",r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.track.id):{track:r.track};const n=new Event("track");n.track=r.track,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)}),t.stream.getTracks().forEach(r=>{let i;i=e.RTCPeerConnection.prototype.getReceivers?this.getReceivers().find(e=>e.track&&e.track.id===r.id):{track:r};const n=new Event("track");n.track=r,n.receiver=i,n.transceiver={receiver:i},n.streams=[t.stream],this.dispatchEvent(n)})},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else Pg(e,"track",e=>(e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e))}function bw(e){if("object"==typeof e&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){const t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){let n=r.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};const i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);const t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._senders=this._senders||[],r.apply(this,[e]),e.getTracks().forEach(e=>{this._senders.push(t(this,e))})};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach(e=>{const t=this._senders.find(t=>t.track===e);t&&this._senders.splice(this._senders.indexOf(t),1)})}}else if("object"==typeof e&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Ow(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,r,i]=arguments;if(arguments.length>0&&"function"==typeof e)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof e))return t.apply(this,[]);const n=function(e){const t={};return e.result().forEach(e=>{const r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach(t=>{r[t]=e.stat(t)}),t[r.id]=r}),t},o=function(e){return new Map(Object.keys(e).map(t=>[t,e[t]]))};if(arguments.length>=2){const i=function(e){r(o(n(e)))};return t.apply(this,[i,e])}return new ny((e,r)=>{t.apply(this,[function(t){e(o(n(t)))},r])}).then(r,i)}}function Nw(e){if(!("object"==typeof e&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver))return;if(!("getStats"in e.RTCRtpSender.prototype)){const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>jg(t,e.track,!0))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Pg(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){const e=this;return this._pc.getStats().then(t=>jg(t,e.track,!1))}}if(!("getStats"in e.RTCRtpSender.prototype)||!("getStats"in e.RTCRtpReceiver.prototype))return;const t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){const e=arguments[0];let t,r,i;return this.getSenders().forEach(r=>{r.track===e&&(t?i=!0:t=r)}),this.getReceivers().forEach(t=>(t.track===e&&(r?i=!0:r=t),t.track===e)),i||t&&r?ny.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():ny.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return t.apply(this,arguments)}}function Dw(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(e=>this._shimmedLocalStreams[e][0])};const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};const r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")});const t=this.getSenders();r.apply(this,arguments);const i=this.getSenders().filter(e=>-1===t.indexOf(e));this._shimmedLocalStreams[e.id]=[e].concat(i)};const i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};const n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach(t=>{const r=this._shimmedLocalStreams[t].indexOf(e);-1!==r&&this._shimmedLocalStreams[t].splice(r,1),1===this._shimmedLocalStreams[t].length&&delete this._shimmedLocalStreams[t]}),n.apply(this,arguments)}}function Lw(e,t){if(!e.RTCPeerConnection)return;if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Dw(e);const r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){const e=r.apply(this);return this._reverseStreams=this._reverseStreams||{},e.map(e=>this._reverseStreams[e.id])};const i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach(e=>{if(this.getSenders().find(t=>t.track===e))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[t.id]){const r=new e.MediaStream(t.getTracks());this._streams[t.id]=r,this._reverseStreams[r.id]=t,t=r}i.apply(this,[t])};const n=e.RTCPeerConnection.prototype.removeStream;function o(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)}),new RTCSessionDescription({type:t.type,sdp:r})}function s(e,t){let r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach(t=>{const i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.id)}),new RTCSessionDescription({type:t.type,sdp:r})}e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find(e=>e===t))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");const n=this.getSenders().find(e=>e.track===t);if(n)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const o=this._streams[r.id];if(o)o.addTrack(t),ny.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const i=new e.MediaStream([t]);this._streams[r.id]=i,this._reverseStreams[i.id]=r,this.addStream(i)}return this.getSenders().find(e=>e.track===t)},["createOffer","createAnswer"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){const e=arguments;return arguments.length&&"function"==typeof arguments[0]?r.apply(this,[t=>{const r=o(this,t);e[0].apply(null,[r])},t=>{e[1]&&e[1].apply(null,t)},arguments[2]]):r.apply(this,arguments).then(e=>o(this,e))}};e.RTCPeerConnection.prototype[t]=i[t]}));const a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=s(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};const c=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get(){const e=c.get.apply(this);return""===e.type?e:o(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!e._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(e._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");let t;this._streams=this._streams||{},Object.keys(this._streams).forEach(r=>{this._streams[r].getTracks().find(t=>e.track===t)&&(t=this._streams[r])}),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function kw(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}))}function Pw(e,t){Pg(e,"negotiationneeded",e=>{const r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e})}var Bw=Object.freeze({__proto__:null,shimMediaStream:Tw,shimOnTrack:ww,shimGetSendersWithDtmf:bw,shimGetStats:Ow,shimSenderReceiverGetStats:Nw,shimAddTrackRemoveTrackWithNative:Dw,shimAddTrackRemoveTrack:Lw,shimPeerConnection:kw,fixNegotiationNeeded:Pw,shimGetUserMedia:Rw,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then(t=>{const i=r.video&&r.video.width,n=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)})}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}});var Mw={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},i=8;i<t.length;i+=2)switch(t[i]){case"raddr":r.relatedAddress=t[i+1];break;case"rport":r.relatedPort=parseInt(t[i+1],10);break;case"tcptype":r.tcpType=t[i+1];break;case"ufrag":r.ufrag=t[i+1],r.usernameFragment=t[i+1];break;default:r[t[i]]=t[i+1]}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},i=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<i.length;n++)r[(t=i[n].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var i=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.getIceParameters=function(e,r){var i=t.splitLines(e);return{usernameFragment:(i=i.concat(t.splitLines(r))).filter((function(e){return 0===e.indexOf("a=ice-ufrag:")}))[0].substr(12),password:i.filter((function(e){return 0===e.indexOf("a=ice-pwd:")}))[0].substr(10)}},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=t.splitLines(e)[0].split(" "),n=3;n<i.length;n++){var o=i[n],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){var a=t.parseRtpMap(s),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(a.parameters=c.length?t.parseFmtp(c[0]):{},a.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(a),a.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(a.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){i+=t.writeRtpMap(e),i+=t.writeFmtp(e),i+=t.writeRtcpFb(e)}));var n=0;return r.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),i+="a=rtcp-mux\r\n",r.headerExtensions&&r.headerExtensions.forEach((function(e){i+=t.writeExtmap(e)})),i},t.parseRtpEncodingParameters=function(e){var r,i=[],n=t.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),s=-1!==n.fecMechanisms.indexOf("ULPFEC"),a=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=a.length>0&&a[0].ssrc,d=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));d.length>0&&d[0].length>1&&d[0][0]===c&&(r=d[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),i.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:s?"red+ulpfec":"red"},i.push(t))}})),0===i.length&&c&&i.push({ssrc:c});var u=t.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substr(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substr(5),10)*.95-16e3:void 0,i.forEach((function(e){e.maxBitrate=u}))),i},t.parseRtcpParameters=function(e){var r={},i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);var n=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=n.length>0,r.compound=0===n.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.parseMsid=function(e){var r,i=t.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(r=i[0].substr(7).split(" "))[0],track:r[1]};var n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(r=n[0].value.split(" "))[0],track:r[1]}:void 0},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,i){var n=void 0!==r?r:2;return"v=0\r\no="+(i||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,r,i,n){var o=t.writeRtpDescription(e.kind,r);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===i?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var s="msid:"+n.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+s,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),o},t.getDirection=function(e,r){for(var i=t.splitLines(e),n=0;n<i.length;n++)switch(i[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[n].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),i=0;i<r.length;i++)if(r[i].length<2||"="!==r[i].charAt(1))return!1;return!0},e.exports=t}(Mw);var Uw=Mw.exports;function Qw(e,t,r,i,n){var o=Uw.writeRtpDescription(e.kind,t);if(o+=Uw.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=Uw.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===r?"actpass":n||"active"),o+="a=mid:"+e.mid+"\r\n",e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var s=e.rtpSender._initialTrackId||e.rtpSender.track.id;e.rtpSender._initialTrackId=s;var a="msid:"+(i?i.id:"-")+" "+s+"\r\n";o+="a="+a,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+a,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+a,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+Uw.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+Uw.localCName+"\r\n"),o}function xw(e,t){var r={codecs:[],headerExtensions:[],fecMechanisms:[]},i=function(e,t){e=parseInt(e,10);for(var r=0;r<t.length;r++)if(t[r].payloadType===e||t[r].preferredPayloadType===e)return t[r]},n=function(e,t,r,n){var o=i(e.parameters.apt,r),s=i(t.parameters.apt,n);return o&&s&&o.name.toLowerCase()===s.name.toLowerCase()};return e.codecs.forEach((function(i){for(var o=0;o<t.codecs.length;o++){var s=t.codecs[o];if(i.name.toLowerCase()===s.name.toLowerCase()&&i.clockRate===s.clockRate){if("rtx"===i.name.toLowerCase()&&i.parameters&&s.parameters.apt&&!n(i,s,e.codecs,t.codecs))continue;(s=JSON.parse(JSON.stringify(s))).numChannels=Math.min(i.numChannels,s.numChannels),r.codecs.push(s),s.rtcpFeedback=s.rtcpFeedback.filter((function(e){for(var t=0;t<i.rtcpFeedback.length;t++)if(i.rtcpFeedback[t].type===e.type&&i.rtcpFeedback[t].parameter===e.parameter)return!0;return!1}));break}}})),e.headerExtensions.forEach((function(e){for(var i=0;i<t.headerExtensions.length;i++){var n=t.headerExtensions[i];if(e.uri===n.uri){r.headerExtensions.push(n);break}}})),r}function Fw(e,t,r){return-1!=={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"]}}[t][e].indexOf(r)}function Vw(e,t){var r=e.getRemoteCandidates().find((function(e){return t.foundation===e.foundation&&t.ip===e.ip&&t.port===e.port&&t.priority===e.priority&&t.protocol===e.protocol&&t.type===e.type}));return r||e.addRemoteCandidate(t),!r}function jw(e,t){var r=new Error(t);return r.name=e,r.code={NotSupportedError:9,InvalidStateError:11,InvalidAccessError:15,TypeError:void 0,OperationError:void 0}[e],r}var Gw=function(e,t){function r(t,r){r.addTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("addtrack",{track:t}))}function i(t,r,i,n){var o=new Event("track");o.track=r,o.receiver=i,o.transceiver={receiver:i},o.streams=n,e.setTimeout((function(){t._dispatchEvent("track",o)}))}var n=function(r){var i=this,n=document.createDocumentFragment();if(["addEventListener","removeEventListener","dispatchEvent"].forEach((function(e){i[e]=n[e].bind(n)})),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",r=JSON.parse(JSON.stringify(r||{})),this.usingBundle="max-bundle"===r.bundlePolicy,"negotiate"===r.rtcpMuxPolicy)throw jw("NotSupportedError","rtcpMuxPolicy 'negotiate' is not supported");switch(r.rtcpMuxPolicy||(r.rtcpMuxPolicy="require"),r.iceTransportPolicy){case"all":case"relay":break;default:r.iceTransportPolicy="all"}switch(r.bundlePolicy){case"balanced":case"max-compat":case"max-bundle":break;default:r.bundlePolicy="balanced"}if(r.iceServers=function(e,t){var r=!1;return(e=JSON.parse(JSON.stringify(e))).filter((function(e){if(e&&(e.urls||e.url)){var i=e.urls||e.url;e.url&&!e.urls&&console.warn("RTCIceServer.url is deprecated! Use urls instead.");var n="string"==typeof i;return n&&(i=[i]),i=i.filter((function(e){return 0!==e.indexOf("turn:")||-1===e.indexOf("transport=udp")||-1!==e.indexOf("turn:[")||r?0===e.indexOf("stun:")&&t>=14393&&-1===e.indexOf("?transport=udp"):(r=!0,!0)})),delete e.url,e.urls=n?i[0]:i,!!i.length}}))}(r.iceServers||[],t),this._iceGatherers=[],r.iceCandidatePoolSize)for(var o=r.iceCandidatePoolSize;o>0;o--)this._iceGatherers.push(new e.RTCIceGatherer({iceServers:r.iceServers,gatherPolicy:r.iceTransportPolicy}));else r.iceCandidatePoolSize=0;this._config=r,this.transceivers=[],this._sdpSessionId=Uw.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(e,t){this._isClosed||(this.dispatchEvent(t),"function"==typeof this["on"+e]&&this["on"+e](t))},n.prototype._emitGatheringStateChange=function(){var e=new Event("icegatheringstatechange");this._dispatchEvent("icegatheringstatechange",e)},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(e,t){var r=this.transceivers.length>0,i={track:null,iceGatherer:null,iceTransport:null,dtlsTransport:null,localCapabilities:null,remoteCapabilities:null,rtpSender:null,rtpReceiver:null,kind:e,mid:null,sendEncodingParameters:null,recvEncodingParameters:null,stream:null,associatedRemoteMediaStreams:[],wantReceive:!0};if(this.usingBundle&&r)i.iceTransport=this.transceivers[0].iceTransport,i.dtlsTransport=this.transceivers[0].dtlsTransport;else{var n=this._createIceAndDtlsTransports();i.iceTransport=n.iceTransport,i.dtlsTransport=n.dtlsTransport}return t||this.transceivers.push(i),i},n.prototype.addTrack=function(t,r){if(this._isClosed)throw jw("InvalidStateError","Attempted to call addTrack on a closed peerconnection.");var i;if(this.transceivers.find((function(e){return e.track===t})))throw jw("InvalidAccessError","Track already exists.");for(var n=0;n<this.transceivers.length;n++)this.transceivers[n].track||this.transceivers[n].kind!==t.kind||(i=this.transceivers[n]);return i||(i=this._createTransceiver(t.kind)),this._maybeFireNegotiationNeeded(),-1===this.localStreams.indexOf(r)&&this.localStreams.push(r),i.track=t,i.stream=r,i.rtpSender=new e.RTCRtpSender(t,i.dtlsTransport),i.rtpSender},n.prototype.addStream=function(e){var r=this;if(t>=15025)e.getTracks().forEach((function(t){r.addTrack(t,e)}));else{var i=e.clone();e.getTracks().forEach((function(e,t){var r=i.getTracks()[t];e.addEventListener("enabled",(function(e){r.enabled=e.enabled}))})),i.getTracks().forEach((function(e){r.addTrack(e,i)}))}},n.prototype.removeTrack=function(t){if(this._isClosed)throw jw("InvalidStateError","Attempted to call removeTrack on a closed peerconnection.");if(!(t instanceof e.RTCRtpSender))throw new TypeError("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.");var r=this.transceivers.find((function(e){return e.rtpSender===t}));if(!r)throw jw("InvalidAccessError","Sender was not created by this connection.");var i=r.stream;r.rtpSender.stop(),r.rtpSender=null,r.track=null,r.stream=null,-1===this.transceivers.map((function(e){return e.stream})).indexOf(i)&&this.localStreams.indexOf(i)>-1&&this.localStreams.splice(this.localStreams.indexOf(i),1),this._maybeFireNegotiationNeeded()},n.prototype.removeStream=function(e){var t=this;e.getTracks().forEach((function(e){var r=t.getSenders().find((function(t){return t.track===e}));r&&t.removeTrack(r)}))},n.prototype.getSenders=function(){return this.transceivers.filter((function(e){return!!e.rtpSender})).map((function(e){return e.rtpSender}))},n.prototype.getReceivers=function(){return this.transceivers.filter((function(e){return!!e.rtpReceiver})).map((function(e){return e.rtpReceiver}))},n.prototype._createIceGatherer=function(t,r){var i=this;if(r&&t>0)return this.transceivers[0].iceGatherer;if(this._iceGatherers.length)return this._iceGatherers.shift();var n=new e.RTCIceGatherer({iceServers:this._config.iceServers,gatherPolicy:this._config.iceTransportPolicy});return Object.defineProperty(n,"state",{value:"new",writable:!0}),this.transceivers[t].bufferedCandidateEvents=[],this.transceivers[t].bufferCandidates=function(e){var r=!e.candidate||0===Object.keys(e.candidate).length;n.state=r?"completed":"gathering",null!==i.transceivers[t].bufferedCandidateEvents&&i.transceivers[t].bufferedCandidateEvents.push(e)},n.addEventListener("localcandidate",this.transceivers[t].bufferCandidates),n},n.prototype._gather=function(t,r){var i=this,n=this.transceivers[r].iceGatherer;if(!n.onlocalcandidate){var o=this.transceivers[r].bufferedCandidateEvents;this.transceivers[r].bufferedCandidateEvents=null,n.removeEventListener("localcandidate",this.transceivers[r].bufferCandidates),n.onlocalcandidate=function(e){if(!(i.usingBundle&&r>0)){var o=new Event("icecandidate");o.candidate={sdpMid:t,sdpMLineIndex:r};var s=e.candidate,a=!s||0===Object.keys(s).length;if(a)"new"!==n.state&&"gathering"!==n.state||(n.state="completed");else{"new"===n.state&&(n.state="gathering"),s.component=1,s.ufrag=n.getLocalParameters().usernameFragment;var c=Uw.writeCandidate(s);o.candidate=Object.assign(o.candidate,Uw.parseCandidate(c)),o.candidate.candidate=c,o.candidate.toJSON=function(){return{candidate:o.candidate.candidate,sdpMid:o.candidate.sdpMid,sdpMLineIndex:o.candidate.sdpMLineIndex,usernameFragment:o.candidate.usernameFragment}}}var d=Uw.getMediaSections(i._localDescription.sdp);d[o.candidate.sdpMLineIndex]+=a?"a=end-of-candidates\r\n":"a="+o.candidate.candidate+"\r\n",i._localDescription.sdp=Uw.getDescription(i._localDescription.sdp)+d.join("");var u=i.transceivers.every((function(e){return e.iceGatherer&&"completed"===e.iceGatherer.state}));"gathering"!==i.iceGatheringState&&(i.iceGatheringState="gathering",i._emitGatheringStateChange()),a||i._dispatchEvent("icecandidate",o),u&&(i._dispatchEvent("icecandidate",new Event("icecandidate")),i.iceGatheringState="complete",i._emitGatheringStateChange())}},e.setTimeout((function(){o.forEach((function(e){n.onlocalcandidate(e)}))}),0)}},n.prototype._createIceAndDtlsTransports=function(){var t=this,r=new e.RTCIceTransport(null);r.onicestatechange=function(){t._updateIceConnectionState(),t._updateConnectionState()};var i=new e.RTCDtlsTransport(r);return i.ondtlsstatechange=function(){t._updateConnectionState()},i.onerror=function(){Object.defineProperty(i,"state",{value:"failed",writable:!0}),t._updateConnectionState()},{iceTransport:r,dtlsTransport:i}},n.prototype._disposeIceAndDtlsTransports=function(e){var t=this.transceivers[e].iceGatherer;t&&(delete t.onlocalcandidate,delete this.transceivers[e].iceGatherer);var r=this.transceivers[e].iceTransport;r&&(delete r.onicestatechange,delete this.transceivers[e].iceTransport);var i=this.transceivers[e].dtlsTransport;i&&(delete i.ondtlsstatechange,delete i.onerror,delete this.transceivers[e].dtlsTransport)},n.prototype._transceive=function(e,r,i){var n=xw(e.localCapabilities,e.remoteCapabilities);r&&e.rtpSender&&(n.encodings=e.sendEncodingParameters,n.rtcp={cname:Uw.localCName,compound:e.rtcpParameters.compound},e.recvEncodingParameters.length&&(n.rtcp.ssrc=e.recvEncodingParameters[0].ssrc),e.rtpSender.send(n)),i&&e.rtpReceiver&&n.codecs.length>0&&("video"===e.kind&&e.recvEncodingParameters&&t<15019&&e.recvEncodingParameters.forEach((function(e){delete e.rtx})),e.recvEncodingParameters.length?n.encodings=e.recvEncodingParameters:n.encodings=[{}],n.rtcp={compound:e.rtcpParameters.compound},e.rtcpParameters.cname&&(n.rtcp.cname=e.rtcpParameters.cname),e.sendEncodingParameters.length&&(n.rtcp.ssrc=e.sendEncodingParameters[0].ssrc),e.rtpReceiver.receive(n))},n.prototype.setLocalDescription=function(e){var t,r,i=this;if(-1===["offer","answer"].indexOf(e.type))return Promise.reject(jw("TypeError",'Unsupported type "'+e.type+'"'));if(!Fw("setLocalDescription",e.type,i.signalingState)||i._isClosed)return Promise.reject(jw("InvalidStateError","Can not set local "+e.type+" in state "+i.signalingState));if("offer"===e.type)t=Uw.splitSections(e.sdp),r=t.shift(),t.forEach((function(e,t){var r=Uw.parseRtpParameters(e);i.transceivers[t].localCapabilities=r})),i.transceivers.forEach((function(e,t){i._gather(e.mid,t)}));else if("answer"===e.type){t=Uw.splitSections(i._remoteDescription.sdp),r=t.shift();var n=Uw.matchPrefix(r,"a=ice-lite").length>0;t.forEach((function(e,t){var o=i.transceivers[t],s=o.iceGatherer,a=o.iceTransport,c=o.dtlsTransport,d=o.localCapabilities,u=o.remoteCapabilities;if(!(Uw.isRejected(e)&&0===Uw.matchPrefix(e,"a=bundle-only").length)&&!o.rejected){var A=Uw.getIceParameters(e,r),h=Uw.getDtlsParameters(e,r);n&&(h.role="server"),i.usingBundle&&0!==t||(i._gather(o.mid,t),"new"===a.state&&a.start(s,A,n?"controlling":"controlled"),"new"===c.state&&c.start(h));var l=xw(d,u);i._transceive(o,l.codecs.length>0,!1)}}))}return i._localDescription={type:e.type,sdp:e.sdp},"offer"===e.type?i._updateSignalingState("have-local-offer"):i._updateSignalingState("stable"),Promise.resolve()},n.prototype.setRemoteDescription=function(n){var o=this;if(-1===["offer","answer"].indexOf(n.type))return Promise.reject(jw("TypeError",'Unsupported type "'+n.type+'"'));if(!Fw("setRemoteDescription",n.type,o.signalingState)||o._isClosed)return Promise.reject(jw("InvalidStateError","Can not set remote "+n.type+" in state "+o.signalingState));var s={};o.remoteStreams.forEach((function(e){s[e.id]=e}));var a=[],c=Uw.splitSections(n.sdp),d=c.shift(),u=Uw.matchPrefix(d,"a=ice-lite").length>0,A=Uw.matchPrefix(d,"a=group:BUNDLE ").length>0;o.usingBundle=A;var h=Uw.matchPrefix(d,"a=ice-options:")[0];return o.canTrickleIceCandidates=!!h&&h.substr(14).split(" ").indexOf("trickle")>=0,c.forEach((function(i,c){var h=Uw.splitLines(i),l=Uw.getKind(i),p=Uw.isRejected(i)&&0===Uw.matchPrefix(i,"a=bundle-only").length,g=h[0].substr(2).split(" ")[2],f=Uw.getDirection(i,d),E=Uw.parseMsid(i),I=Uw.getMid(i)||Uw.generateIdentifier();if(p||"application"===l&&("DTLS/SCTP"===g||"UDP/DTLS/SCTP"===g))o.transceivers[c]={mid:I,kind:l,protocol:g,rejected:!0};else{var m,_,C,v,S,y,R,T,w;!p&&o.transceivers[c]&&o.transceivers[c].rejected&&(o.transceivers[c]=o._createTransceiver(l,!0));var b,O,N=Uw.parseRtpParameters(i);p||(b=Uw.getIceParameters(i,d),(O=Uw.getDtlsParameters(i,d)).role="client"),R=Uw.parseRtpEncodingParameters(i);var D=Uw.parseRtcpParameters(i),L=Uw.matchPrefix(i,"a=end-of-candidates",d).length>0,k=Uw.matchPrefix(i,"a=candidate:").map((function(e){return Uw.parseCandidate(e)})).filter((function(e){return 1===e.component}));if(("offer"===n.type||"answer"===n.type)&&!p&&A&&c>0&&o.transceivers[c]&&(o._disposeIceAndDtlsTransports(c),o.transceivers[c].iceGatherer=o.transceivers[0].iceGatherer,o.transceivers[c].iceTransport=o.transceivers[0].iceTransport,o.transceivers[c].dtlsTransport=o.transceivers[0].dtlsTransport,o.transceivers[c].rtpSender&&o.transceivers[c].rtpSender.setTransport(o.transceivers[0].dtlsTransport),o.transceivers[c].rtpReceiver&&o.transceivers[c].rtpReceiver.setTransport(o.transceivers[0].dtlsTransport)),"offer"!==n.type||p){if("answer"===n.type&&!p){_=(m=o.transceivers[c]).iceGatherer,C=m.iceTransport,v=m.dtlsTransport,S=m.rtpReceiver,y=m.sendEncodingParameters,T=m.localCapabilities,o.transceivers[c].recvEncodingParameters=R,o.transceivers[c].remoteCapabilities=N,o.transceivers[c].rtcpParameters=D,k.length&&"new"===C.state&&(!u&&!L||A&&0!==c?k.forEach((function(e){Vw(m.iceTransport,e)})):C.setRemoteCandidates(k)),A&&0!==c||("new"===C.state&&C.start(_,b,"controlling"),"new"===v.state&&v.start(O)),!xw(m.localCapabilities,m.remoteCapabilities).codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&m.sendEncodingParameters[0].rtx&&delete m.sendEncodingParameters[0].rtx,o._transceive(m,"sendrecv"===f||"recvonly"===f,"sendrecv"===f||"sendonly"===f),!S||"sendrecv"!==f&&"sendonly"!==f?delete m.rtpReceiver:(w=S.track,E?(s[E.stream]||(s[E.stream]=new e.MediaStream),r(w,s[E.stream]),a.push([w,S,s[E.stream]])):(s.default||(s.default=new e.MediaStream),r(w,s.default),a.push([w,S,s.default])))}}else{(m=o.transceivers[c]||o._createTransceiver(l)).mid=I,m.iceGatherer||(m.iceGatherer=o._createIceGatherer(c,A)),k.length&&"new"===m.iceTransport.state&&(!L||A&&0!==c?k.forEach((function(e){Vw(m.iceTransport,e)})):m.iceTransport.setRemoteCandidates(k)),T=e.RTCRtpReceiver.getCapabilities(l),t<15019&&(T.codecs=T.codecs.filter((function(e){return"rtx"!==e.name}))),y=m.sendEncodingParameters||[{ssrc:1001*(2*c+2)}];var P,B=!1;if("sendrecv"===f||"sendonly"===f){if(B=!m.rtpReceiver,S=m.rtpReceiver||new e.RTCRtpReceiver(m.dtlsTransport,l),B)w=S.track,E&&"-"===E.stream||(E?(s[E.stream]||(s[E.stream]=new e.MediaStream,Object.defineProperty(s[E.stream],"id",{get:function(){return E.stream}})),Object.defineProperty(w,"id",{get:function(){return E.track}}),P=s[E.stream]):(s.default||(s.default=new e.MediaStream),P=s.default)),P&&(r(w,P),m.associatedRemoteMediaStreams.push(P)),a.push([w,S,P])}else m.rtpReceiver&&m.rtpReceiver.track&&(m.associatedRemoteMediaStreams.forEach((function(t){var r=t.getTracks().find((function(e){return e.id===m.rtpReceiver.track.id}));r&&function(t,r){r.removeTrack(t),r.dispatchEvent(new e.MediaStreamTrackEvent("removetrack",{track:t}))}(r,t)})),m.associatedRemoteMediaStreams=[]);m.localCapabilities=T,m.remoteCapabilities=N,m.rtpReceiver=S,m.rtcpParameters=D,m.sendEncodingParameters=y,m.recvEncodingParameters=R,o._transceive(o.transceivers[c],!1,B)}}})),void 0===o._dtlsRole&&(o._dtlsRole="offer"===n.type?"active":"passive"),o._remoteDescription={type:n.type,sdp:n.sdp},"offer"===n.type?o._updateSignalingState("have-remote-offer"):o._updateSignalingState("stable"),Object.keys(s).forEach((function(t){var r=s[t];if(r.getTracks().length){if(-1===o.remoteStreams.indexOf(r)){o.remoteStreams.push(r);var n=new Event("addstream");n.stream=r,e.setTimeout((function(){o._dispatchEvent("addstream",n)}))}a.forEach((function(e){var t=e[0],n=e[1];r.id===e[2].id&&i(o,t,n,[r])}))}})),a.forEach((function(e){e[2]||i(o,e[0],e[1],[])})),e.setTimeout((function(){o&&o.transceivers&&o.transceivers.forEach((function(e){e.iceTransport&&"new"===e.iceTransport.state&&e.iceTransport.getRemoteCandidates().length>0&&(console.warn("Timeout for addRemoteCandidate. Consider sending an end-of-candidates notification"),e.iceTransport.addRemoteCandidate({}))}))}),4e3),Promise.resolve()},n.prototype.close=function(){this.transceivers.forEach((function(e){e.iceTransport&&e.iceTransport.stop(),e.dtlsTransport&&e.dtlsTransport.stop(),e.rtpSender&&e.rtpSender.stop(),e.rtpReceiver&&e.rtpReceiver.stop()})),this._isClosed=!0,this._updateSignalingState("closed")},n.prototype._updateSignalingState=function(e){this.signalingState=e;var t=new Event("signalingstatechange");this._dispatchEvent("signalingstatechange",t)},n.prototype._maybeFireNegotiationNeeded=function(){var t=this;"stable"===this.signalingState&&!0!==this.needNegotiation&&(this.needNegotiation=!0,e.setTimeout((function(){if(t.needNegotiation){t.needNegotiation=!1;var e=new Event("negotiationneeded");t._dispatchEvent("negotiationneeded",e)}}),0))},n.prototype._updateIceConnectionState=function(){var e,t={new:0,closed:0,checking:0,connected:0,completed:0,disconnected:0,failed:0};if(this.transceivers.forEach((function(e){e.iceTransport&&!e.rejected&&t[e.iceTransport.state]++})),e="new",t.failed>0?e="failed":t.checking>0?e="checking":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0?e="connected":t.completed>0&&(e="completed"),e!==this.iceConnectionState){this.iceConnectionState=e;var r=new Event("iceconnectionstatechange");this._dispatchEvent("iceconnectionstatechange",r)}},n.prototype._updateConnectionState=function(){var e,t={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&&(t[e.iceTransport.state]++,t[e.dtlsTransport.state]++)})),t.connected+=t.completed,e="new",t.failed>0?e="failed":t.connecting>0?e="connecting":t.disconnected>0?e="disconnected":t.new>0?e="new":t.connected>0&&(e="connected"),e!==this.connectionState){this.connectionState=e;var r=new Event("connectionstatechange");this._dispatchEvent("connectionstatechange",r)}},n.prototype.createOffer=function(){var r=this;if(r._isClosed)return Promise.reject(jw("InvalidStateError","Can not call createOffer after close"));var i=r.transceivers.filter((function(e){return"audio"===e.kind})).length,n=r.transceivers.filter((function(e){return"video"===e.kind})).length,o=arguments[0];if(o){if(o.mandatory||o.optional)throw new TypeError("Legacy mandatory/optional constraints not supported.");void 0!==o.offerToReceiveAudio&&(i=!0===o.offerToReceiveAudio?1:!1===o.offerToReceiveAudio?0:o.offerToReceiveAudio),void 0!==o.offerToReceiveVideo&&(n=!0===o.offerToReceiveVideo?1:!1===o.offerToReceiveVideo?0:o.offerToReceiveVideo)}for(r.transceivers.forEach((function(e){"audio"===e.kind?--i<0&&(e.wantReceive=!1):"video"===e.kind&&--n<0&&(e.wantReceive=!1)}));i>0||n>0;)i>0&&(r._createTransceiver("audio"),i--),n>0&&(r._createTransceiver("video"),n--);var s=Uw.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.transceivers.forEach((function(i,n){var o=i.track,s=i.kind,a=i.mid||Uw.generateIdentifier();i.mid=a,i.iceGatherer||(i.iceGatherer=r._createIceGatherer(n,r.usingBundle));var c=e.RTCRtpSender.getCapabilities(s);t<15019&&(c.codecs=c.codecs.filter((function(e){return"rtx"!==e.name}))),c.codecs.forEach((function(e){"H264"===e.name&&void 0===e.parameters["level-asymmetry-allowed"]&&(e.parameters["level-asymmetry-allowed"]="1"),i.remoteCapabilities&&i.remoteCapabilities.codecs&&i.remoteCapabilities.codecs.forEach((function(t){e.name.toLowerCase()===t.name.toLowerCase()&&e.clockRate===t.clockRate&&(e.preferredPayloadType=t.payloadType)}))})),c.headerExtensions.forEach((function(e){(i.remoteCapabilities&&i.remoteCapabilities.headerExtensions||[]).forEach((function(t){e.uri===t.uri&&(e.id=t.id)}))}));var d=i.sendEncodingParameters||[{ssrc:1001*(2*n+1)}];o&&t>=15019&&"video"===s&&!d[0].rtx&&(d[0].rtx={ssrc:d[0].ssrc+1}),i.wantReceive&&(i.rtpReceiver=new e.RTCRtpReceiver(i.dtlsTransport,s)),i.localCapabilities=c,i.sendEncodingParameters=d})),"max-compat"!==r._config.bundlePolicy&&(s+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),s+="a=ice-options:trickle\r\n",r.transceivers.forEach((function(e,t){s+=Qw(e,e.localCapabilities,"offer",e.stream,r._dtlsRole),s+="a=rtcp-rsize\r\n",!e.iceGatherer||"new"===r.iceGatheringState||0!==t&&r.usingBundle||(e.iceGatherer.getLocalCandidates().forEach((function(e){e.component=1,s+="a="+Uw.writeCandidate(e)+"\r\n"})),"completed"===e.iceGatherer.state&&(s+="a=end-of-candidates\r\n"))}));var a=new e.RTCSessionDescription({type:"offer",sdp:s});return Promise.resolve(a)},n.prototype.createAnswer=function(){var r=this;if(r._isClosed)return Promise.reject(jw("InvalidStateError","Can not call createAnswer after close"));if("have-remote-offer"!==r.signalingState&&"have-local-pranswer"!==r.signalingState)return Promise.reject(jw("InvalidStateError","Can not call createAnswer in signalingState "+r.signalingState));var i=Uw.writeSessionBoilerplate(r._sdpSessionId,r._sdpSessionVersion++);r.usingBundle&&(i+="a=group:BUNDLE "+r.transceivers.map((function(e){return e.mid})).join(" ")+"\r\n"),i+="a=ice-options:trickle\r\n";var n=Uw.getMediaSections(r._remoteDescription.sdp).length;r.transceivers.forEach((function(e,o){if(!(o+1>n)){if(e.rejected)return"application"===e.kind?"DTLS/SCTP"===e.protocol?i+="m=application 0 DTLS/SCTP 5000\r\n":i+="m=application 0 "+e.protocol+" webrtc-datachannel\r\n":"audio"===e.kind?i+="m=audio 0 UDP/TLS/RTP/SAVPF 0\r\na=rtpmap:0 PCMU/8000\r\n":"video"===e.kind&&(i+="m=video 0 UDP/TLS/RTP/SAVPF 120\r\na=rtpmap:120 VP8/90000\r\n"),void(i+="c=IN IP4 0.0.0.0\r\na=inactive\r\na=mid:"+e.mid+"\r\n");var s;if(e.stream)"audio"===e.kind?s=e.stream.getAudioTracks()[0]:"video"===e.kind&&(s=e.stream.getVideoTracks()[0]),s&&t>=15019&&"video"===e.kind&&!e.sendEncodingParameters[0].rtx&&(e.sendEncodingParameters[0].rtx={ssrc:e.sendEncodingParameters[0].ssrc+1});var a=xw(e.localCapabilities,e.remoteCapabilities);!a.codecs.filter((function(e){return"rtx"===e.name.toLowerCase()})).length&&e.sendEncodingParameters[0].rtx&&delete e.sendEncodingParameters[0].rtx,i+=Qw(e,a,"answer",e.stream,r._dtlsRole),e.rtcpParameters&&e.rtcpParameters.reducedSize&&(i+="a=rtcp-rsize\r\n")}}));var o=new e.RTCSessionDescription({type:"answer",sdp:i});return Promise.resolve(o)},n.prototype.addIceCandidate=function(e){var t,r=this;return e&&void 0===e.sdpMLineIndex&&!e.sdpMid?Promise.reject(new TypeError("sdpMLineIndex or sdpMid required")):new Promise((function(i,n){if(!r._remoteDescription)return n(jw("InvalidStateError","Can not add ICE candidate without a remote description"));if(e&&""!==e.candidate){var o=e.sdpMLineIndex;if(e.sdpMid)for(var s=0;s<r.transceivers.length;s++)if(r.transceivers[s].mid===e.sdpMid){o=s;break}var a=r.transceivers[o];if(!a)return n(jw("OperationError","Can not add ICE candidate"));if(a.rejected)return i();var c=Object.keys(e.candidate).length>0?Uw.parseCandidate(e.candidate):{};if("tcp"===c.protocol&&(0===c.port||9===c.port))return i();if(c.component&&1!==c.component)return i();if((0===o||o>0&&a.iceTransport!==r.transceivers[0].iceTransport)&&!Vw(a.iceTransport,c))return n(jw("OperationError","Can not add ICE candidate"));var d=e.candidate.trim();0===d.indexOf("a=")&&(d=d.substr(2)),(t=Uw.getMediaSections(r._remoteDescription.sdp))[o]+="a="+(c.type?d:"end-of-candidates")+"\r\n",r._remoteDescription.sdp=Uw.getDescription(r._remoteDescription.sdp)+t.join("")}else for(var u=0;u<r.transceivers.length&&(r.transceivers[u].rejected||(r.transceivers[u].iceTransport.addRemoteCandidate({}),(t=Uw.getMediaSections(r._remoteDescription.sdp))[u]+="a=end-of-candidates\r\n",r._remoteDescription.sdp=Uw.getDescription(r._remoteDescription.sdp)+t.join(""),!r.usingBundle));u++);i()}))},n.prototype.getStats=function(t){if(t&&t instanceof e.MediaStreamTrack){var r=null;if(this.transceivers.forEach((function(e){e.rtpSender&&e.rtpSender.track===t?r=e.rtpSender:e.rtpReceiver&&e.rtpReceiver.track===t&&(r=e.rtpReceiver)})),!r)throw jw("InvalidAccessError","Invalid selector.");return r.getStats()}var i=[];return this.transceivers.forEach((function(e){["rtpSender","rtpReceiver","iceGatherer","iceTransport","dtlsTransport"].forEach((function(t){e[t]&&i.push(e[t].getStats())}))})),Promise.all(i).then((function(e){var t=new Map;return e.forEach((function(e){e.forEach((function(e){t.set(e.id,e)}))})),t}))};["RTCRtpSender","RTCRtpReceiver","RTCIceGatherer","RTCIceTransport","RTCDtlsTransport"].forEach((function(t){var r=e[t];if(r&&r.prototype&&r.prototype.getStats){var i=r.prototype.getStats;r.prototype.getStats=function(){return i.apply(this).then((function(e){var t=new Map;return Object.keys(e).forEach((function(r){var i;e[r].type={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[(i=e[r]).type]||i.type,t.set(r,e[r])})),t}))}}}));var o=["createOffer","createAnswer"];return o.forEach((function(e){var t=n.prototype[e];n.prototype[e]=function(){var e=arguments;return"function"==typeof e[0]||"function"==typeof e[1]?t.apply(this,[arguments[2]]).then((function(t){"function"==typeof e[0]&&e[0].apply(null,[t])}),(function(t){"function"==typeof e[1]&&e[1].apply(null,[t])})):t.apply(this,arguments)}})),(o=["setLocalDescription","setRemoteDescription","addIceCandidate"]).forEach((function(e){var t=n.prototype[e];n.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]||"function"==typeof e[2]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)}),(function(t){"function"==typeof e[2]&&e[2].apply(null,[t])})):t.apply(this,arguments)}})),["getStats"].forEach((function(e){var t=n.prototype[e];n.prototype[e]=function(){var e=arguments;return"function"==typeof e[1]?t.apply(this,arguments).then((function(){"function"==typeof e[1]&&e[1].apply(null)})):t.apply(this,arguments)}})),n};function Kw(e){const t=e&&e.navigator,r=t.mediaDevices.getUserMedia.bind(t.mediaDevices);t.mediaDevices.getUserMedia=function(e){return r(e).catch(e=>ny.reject(function(e){return{name:{PermissionDeniedError:"NotAllowedError"}[e.name]||e.name,message:e.message,constraint:e.constraint,toString(){return this.name}}}(e)))}}function Hw(e){"getDisplayMedia"in e.navigator&&e.navigator.mediaDevices&&(e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||(e.navigator.mediaDevices.getDisplayMedia=e.navigator.getDisplayMedia.bind(e.navigator)))}function Yw(e,t){if(e.RTCIceGatherer&&(e.RTCIceCandidate||(e.RTCIceCandidate=function(e){return e}),e.RTCSessionDescription||(e.RTCSessionDescription=function(e){return e}),t.version<15025)){const t=Object.getOwnPropertyDescriptor(e.MediaStreamTrack.prototype,"enabled");Object.defineProperty(e.MediaStreamTrack.prototype,"enabled",{set(e){t.set.call(this,e);const r=new Event("enabled");r.enabled=e,this.dispatchEvent(r)}})}e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)&&Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=new e.RTCDtmfSender(this):"video"===this.track.kind&&(this._dtmf=null)),this._dtmf}}),e.RTCDtmfSender&&!e.RTCDTMFSender&&(e.RTCDTMFSender=e.RTCDtmfSender);const r=Gw(e,t.version);e.RTCPeerConnection=function(e){return e&&e.iceServers&&(e.iceServers=function(e,t){let r=!1;return(e=JSON.parse(JSON.stringify(e))).filter(e=>{if(e&&(e.urls||e.url)){let t=e.urls||e.url;e.url&&!e.urls&&Qg("RTCIceServer.url","RTCIceServer.urls");const i="string"==typeof t;return i&&(t=[t]),t=t.filter(e=>{if(0===e.indexOf("stun:"))return!1;const t=e.startsWith("turn")&&!e.startsWith("turn:[")&&e.includes("transport=udp");return t&&!r?(r=!0,!0):t&&!r}),delete e.url,e.urls=i?t[0]:t,!!t.length}})}(e.iceServers,t.version),Ug("ICE servers after filtering:",e.iceServers)),new r(e)},e.RTCPeerConnection.prototype=r.prototype}function Ww(e){e.RTCRtpSender&&!("replaceTrack"in e.RTCRtpSender.prototype)&&(e.RTCRtpSender.prototype.replaceTrack=e.RTCRtpSender.prototype.setTrack)}var Jw=Object.freeze({__proto__:null,shimPeerConnection:Yw,shimReplaceTrack:Ww,shimGetUserMedia:Kw,shimGetDisplayMedia:Hw}),qw=Gi,zw=Ki,Xw=n,Zw=K,$w=Q,eb=Uo,tb=Xs,rb=Ht.exports;if(qw({target:"Promise",proto:!0,real:!0,forced:!!zw&&Xw((function(){zw.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=eb(this,Zw("Promise")),r=$w(e);return this.then(r?function(r){return tb(t,e()).then((function(){return r}))}:e,r?function(r){return tb(t,e()).then((function(){throw r}))}:e)}}),$w(zw)){var ib=Zw("Promise").prototype.finally;zw.prototype.finally!==ib&&rb(zw.prototype,"finally",ib,{unsafe:!0})}function nb(e,t){const r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){Qg("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,i)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){const e=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},t=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(r){return"object"==typeof r&&"object"==typeof r.audio&&(r=JSON.parse(JSON.stringify(r)),e(r.audio,"autoGainControl","mozAutoGainControl"),e(r.audio,"noiseSuppression","mozNoiseSuppression")),t(r)},i&&i.prototype.getSettings){const t=i.prototype.getSettings;i.prototype.getSettings=function(){const r=t.apply(this,arguments);return e(r,"mozAutoGainControl","autoGainControl"),e(r,"mozNoiseSuppression","noiseSuppression"),r}}if(i&&i.prototype.applyConstraints){const t=i.prototype.applyConstraints;i.prototype.applyConstraints=function(r){return"audio"===this.kind&&"object"==typeof r&&(r=JSON.parse(JSON.stringify(r)),e(r,"autoGainControl","mozAutoGainControl"),e(r,"noiseSuppression","mozNoiseSuppression")),t.apply(this,[r])}}}}function ob(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function sb(e,t){if("object"!=typeof e||!e.RTCPeerConnection&&!e.mozRTCPeerConnection)return;!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){const r=e.RTCPeerConnection.prototype[t],i={[t](){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}};e.RTCPeerConnection.prototype[t]=i[t]}));const r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){const[e,n,o]=arguments;return i.apply(this,[e||null]).then(e=>{if(t.version<53&&!n)try{e.forEach(e=>{e.type=r[e.type]||e.type})}catch(t){if("TypeError"!==t.name)throw t;e.forEach((t,i)=>{e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))})}return e}).then(n,o)}}function ab(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpSender.prototype)return;const t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e});const r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){const e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):ny.resolve(new Map)}}function cb(e){if("object"!=typeof e||!e.RTCPeerConnection||!e.RTCRtpSender)return;if(e.RTCRtpSender&&"getStats"in e.RTCRtpReceiver.prototype)return;const t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){const e=t.apply(this,[]);return e.forEach(e=>e._pc=this),e}),Pg(e,"track",e=>(e.receiver._pc=e.srcElement,e)),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function db(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){Qg("removeStream","removeTrack"),this.getSenders().forEach(t=>{t.track&&e.getTracks().includes(t.track)&&this.removeTrack(t)})})}function ub(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Ab(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];const e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach(e=>{if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const i=t.apply(this,arguments);if(r){const{sender:t}=i,r=t.getParameters();(!("encodings"in r)||1===r.encodings.length&&0===Object.keys(r.encodings[0]).length)&&(r.encodings=e.sendEncodings,t.sendEncodings=e.sendEncodings,this.setParametersPromises.push(t.setParameters(r).then(()=>{delete t.sendEncodings}).catch(()=>{delete t.sendEncodings})))}return i})}function hb(e){if("object"!=typeof e||!e.RTCRtpSender)return;const t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){const e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}function lb(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?ny.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}function pb(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?ny.all(this.setParametersPromises).then(()=>t.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):t.apply(this,arguments)}}var gb=Object.freeze({__proto__:null,shimOnTrack:ob,shimPeerConnection:sb,shimSenderGetStats:ab,shimReceiverGetStats:cb,shimRemoveStream:db,shimRTCDataChannel:ub,shimAddTransceiver:Ab,shimGetParameters:hb,shimCreateOffer:lb,shimCreateAnswer:pb,shimGetUserMedia:nb,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){const e=new DOMException("getDisplayMedia without video constraints is undefined");return e.name="NotFoundError",e.code=8,ny.reject(e)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function fb(e){if("object"==typeof e&&e.RTCPeerConnection){if("getLocalStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in e.RTCPeerConnection.prototype)){const t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach(r=>t.call(this,r,e)),e.getVideoTracks().forEach(r=>t.call(this,r,e))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];return i&&i.forEach(e=>{this._localStreams?this._localStreams.includes(e)||this._localStreams.push(e):this._localStreams=[e]}),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const t=this._localStreams.indexOf(e);if(-1===t)return;this._localStreams.splice(t,1);const r=e.getTracks();this.getSenders().forEach(e=>{r.includes(e.track)&&this.removeTrack(e)})})}}function Eb(e){if("object"==typeof e&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get(){return this._onaddstream},set(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=e=>{e.streams.forEach(e=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(e))return;this._remoteStreams.push(e);const t=new Event("addstream");t.stream=e,this.dispatchEvent(t)})})}});const t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){const e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach(t=>{if(e._remoteStreams||(e._remoteStreams=[]),e._remoteStreams.indexOf(t)>=0)return;e._remoteStreams.push(t);const r=new Event("addstream");r.stream=t,e.dispatchEvent(r)})}),t.apply(e,arguments)}}}function Ib(e){if("object"!=typeof e||!e.RTCPeerConnection)return;const t=e.RTCPeerConnection.prototype,r=t.createOffer,i=t.createAnswer,n=t.setLocalDescription,o=t.setRemoteDescription,s=t.addIceCandidate;t.createOffer=function(e,t){const i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),ny.resolve()):n},t.createAnswer=function(e,t){const r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),ny.resolve()):n};let a=function(e,t,r){const i=n.apply(this,[e]);return r?(i.then(t,r),ny.resolve()):i};t.setLocalDescription=a,a=function(e,t,r){const i=o.apply(this,[e]);return r?(i.then(t,r),ny.resolve()):i},t.setRemoteDescription=a,a=function(e,t,r){const i=s.apply(this,[e]);return r?(i.then(t,r),ny.resolve()):i},t.addIceCandidate=a}function mb(e){const t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){const e=t.mediaDevices,r=e.getUserMedia.bind(e);t.mediaDevices.getUserMedia=e=>r(_b(e))}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function _b(e){return e&&void 0!==e.video?Object.assign({},e,{video:Vg(e.video)}):e}function Cb(e){if(!e.RTCPeerConnection)return;const t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){const t=[];for(let r=0;r<e.iceServers.length;r++){let i=e.iceServers[r];!i.hasOwnProperty("urls")&&i.hasOwnProperty("url")?(Qg("RTCIceServer.url","RTCIceServer.urls"),i=JSON.parse(JSON.stringify(i)),i.urls=i.url,delete i.url,t.push(i)):t.push(e.iceServers[r])}e.iceServers=t}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:()=>t.generateCertificate})}function vb(e){"object"==typeof e&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get(){return{receiver:this.receiver}}})}function Sb(e){const t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);const t=this.getTransceivers().find(e=>"audio"===e.receiver.track.kind);!1===e.offerToReceiveAudio&&t?"sendrecv"===t.direction?t.setDirection?t.setDirection("sendonly"):t.direction="sendonly":"recvonly"===t.direction&&(t.setDirection?t.setDirection("inactive"):t.direction="inactive"):!0!==e.offerToReceiveAudio||t||this.addTransceiver("audio"),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);const r=this.getTransceivers().find(e=>"video"===e.receiver.track.kind);!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video")}return t.apply(this,arguments)}}function yb(e){"object"!=typeof e||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var Rb=Object.freeze({__proto__:null,shimLocalStreamsAPI:fb,shimRemoteStreamsAPI:Eb,shimCallbacksAPI:Ib,shimGetUserMedia:mb,shimConstraints:_b,shimRTCIceServerUrls:Cb,shimTrackEventTransceiver:vb,shimCreateOfferLegacy:Sb,shimAudioContext:yb}),Tb="\t\n\v\f\r    \u2028\u2029\ufeff",wb=pd,bb=hI,Ob=Bc("".replace),Nb="[\t\n\v\f\r    \u2028\u2029\ufeff]",Db=RegExp("^"+Nb+Nb+"*"),Lb=RegExp(Nb+Nb+"*$"),kb=function(e){return function(t){var r=bb(wb(t));return 1&e&&(r=Ob(r,Db,"")),2&e&&(r=Ob(r,Lb,"")),r}},Pb={start:kb(1),end:kb(2),trim:kb(3)},Bb=Em.PROPER,Mb=bc,Ub=Tb,Qb=Pb.trim;JA({target:"String",proto:!0,forced:function(e){return Mb((function(){return!!Ub[e]()||"…"!=="…"[e]()||Bb&&Ub[e].name!==e}))}("trim")},{trim:function(){return Qb(this)}});var xb=fh("String").trim,Fb=Mc,Vb=xb,jb=String.prototype,Gb=function(e){var t=e.trim;return"string"==typeof e||e===jb||Fb(jb,e)&&t===jb.trim?Vb:t},Kb=d;Gi({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Kb(URL.prototype.toString,this)}});var Hb={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return Gb(e).call(e).split("\n").map((function(e){return Gb(e).call(e)}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){var r;return Gb(r=t>0?"m="+e:e).call(r)+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:parseInt(t[1],10),protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},i=8;i<t.length;i+=2)switch(t[i]){case"raddr":r.relatedAddress=t[i+1];break;case"rport":r.relatedPort=parseInt(t[i+1],10);break;case"tcptype":r.tcpType=t[i+1];break;case"ufrag":r.ufrag=t[i+1],r.usernameFragment=t[i+1];break;default:r[t[i]]=t[i+1]}return r},t.writeCandidate=function(e){var t=[];t.push(e.foundation),t.push(e.component),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var r=e.type;return t.push("typ"),t.push(r),"host"!==r&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},i=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<i.length;n++){var o,s;t=Gb(o=i[n]).call(o).split("="),r[Gb(s=t[0]).call(s)]=t[1]}return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var i=[];Object.keys(e.parameters).forEach((function(t){e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1]}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"==typeof e.keyParams?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var i=t.matchPrefix(e+r,"a=ice-ufrag:")[0],n=t.matchPrefix(e+r,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substr(12),password:n.substr(10)}:null},t.writeIceParameters=function(e){return"a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n"},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=t.splitLines(e)[0].split(" "),n=3;n<i.length;n++){var o=i[n],s=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(s){var a=t.parseRtpMap(s),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(a.parameters=c.length?t.parseFmtp(c[0]):{},a.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(a),a.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(a.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){i+=t.writeRtpMap(e),i+=t.writeFmtp(e),i+=t.writeRtcpFb(e)}));var n=0;return r.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),i+="a=rtcp-mux\r\n",r.headerExtensions&&r.headerExtensions.forEach((function(e){i+=t.writeExtmap(e)})),i},t.parseRtpEncodingParameters=function(e){var r,i=[],n=t.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),s=-1!==n.fecMechanisms.indexOf("ULPFEC"),a=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=a.length>0&&a[0].ssrc,d=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));d.length>0&&d[0].length>1&&d[0][0]===c&&(r=d[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),i.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:s?"red+ulpfec":"red"},i.push(t))}})),0===i.length&&c&&i.push({ssrc:c});var u=t.matchPrefix(e,"b=");return u.length&&(u=0===u[0].indexOf("b=TIAS:")?parseInt(u[0].substr(7),10):0===u[0].indexOf("b=AS:")?1e3*parseInt(u[0].substr(5),10)*.95-16e3:void 0,i.forEach((function(e){e.maxBitrate=u}))),i},t.parseRtcpParameters=function(e){var r={},i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);var n=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=n.length>0,r.compound=0===n.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.parseMsid=function(e){var r,i=t.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(r=i[0].substr(7).split(" "))[0],track:r[1]};var n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(r=n[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,i=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");n.length>0&&(r=parseInt(n[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:i.fmt,maxMessageSize:r};if(t.matchPrefix(e,"a=sctpmap:").length>0){var s=t.matchPrefix(e,"a=sctpmap:")[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,i){var n=void 0!==r?r:2;return"v=0\r\no="+(i||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.writeMediaSection=function(e,r,i,n){var o=t.writeRtpDescription(e.kind,r);if(o+=t.writeIceParameters(e.iceGatherer.getLocalParameters()),o+=t.writeDtlsParameters(e.dtlsTransport.getLocalParameters(),"offer"===i?"actpass":"active"),o+="a=mid:"+e.mid+"\r\n",e.direction?o+="a="+e.direction+"\r\n":e.rtpSender&&e.rtpReceiver?o+="a=sendrecv\r\n":e.rtpSender?o+="a=sendonly\r\n":e.rtpReceiver?o+="a=recvonly\r\n":o+="a=inactive\r\n",e.rtpSender){var s="msid:"+n.id+" "+e.rtpSender.track.id+"\r\n";o+="a="+s,o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" "+s,e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" "+s,o+="a=ssrc-group:FID "+e.sendEncodingParameters[0].ssrc+" "+e.sendEncodingParameters[0].rtx.ssrc+"\r\n")}return o+="a=ssrc:"+e.sendEncodingParameters[0].ssrc+" cname:"+t.localCName+"\r\n",e.rtpSender&&e.sendEncodingParameters[0].rtx&&(o+="a=ssrc:"+e.sendEncodingParameters[0].rtx.ssrc+" cname:"+t.localCName+"\r\n"),o},t.getDirection=function(e,r){for(var i=t.splitLines(e),n=0;n<i.length;n++)switch(i[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[n].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),i=0;i<r.length;i++)if(r[i].length<2||"="!==r[i].charAt(1))return!1;return!0},e.exports=t}(Hb);var Yb=Hb.exports;function Wb(e){if(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)return;const t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"==typeof e&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){const r=new t(e),i=Yb.parseCandidate(e.candidate),n=Object.assign(r,i);return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,Pg(e,"icecandidate",t=>(t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t))}function Jb(e,t){if(!e.RTCPeerConnection)return;"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get(){return void 0===this._sctp?null:this._sctp}});const r=function(e){if(!e||!e.sdp)return!1;const t=Yb.splitSections(e.sdp);return t.shift(),t.some(e=>{const t=Yb.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")})},i=function(e){const t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;const r=parseInt(t[1],10);return r!=r?-1:r},n=function(e){let r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){let i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);const n=Yb.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i},s=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){const{sdpSemantics:e}=this.getConfiguration();"plan-b"===e&&Object.defineProperty(this,"sctp",{get(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){const e=i(arguments[0]),t=n(e),r=o(arguments[0],e);let s;s=0===t&&0===r?Number.POSITIVE_INFINITY:0===t||0===r?Math.max(t,r):Math.min(t,r);const a={};Object.defineProperty(a,"maxMessageSize",{get:()=>s}),this._sctp=a}return s.apply(this,arguments)}}function qb(e){if(!e.RTCPeerConnection||!("createDataChannel"in e.RTCPeerConnection.prototype))return;function t(e,t){const r=e.send;e.send=function(){const i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}const r=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){const e=r.apply(this,arguments);return t(e,this),e},Pg(e,"datachannel",e=>(t(e.channel,e.target),e))}function zb(e){if(!e.RTCPeerConnection||"connectionState"in e.RTCPeerConnection.prototype)return;const t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const r=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=e=>{const t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;const r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}})}function Xb(e,t){if(!e.RTCPeerConnection)return;if("chrome"===t.browser&&t.version>=71)return;if("safari"===t.browser&&t.version>=605)return;const r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){const r=t.sdp.split("\n").filter(e=>"a=extmap-allow-mixed"!==Gb(e).call(e)).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return r.apply(this,arguments)}}function Zb(e,t){if(!e.RTCPeerConnection||!e.RTCPeerConnection.prototype)return;const r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?ny.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),ny.resolve())})}var $b=Object.freeze({__proto__:null,shimRTCIceCandidate:Wb,shimMaxMessageSize:Jb,shimSendThrowTypeError:qb,shimConnectionState:zb,removeExtmapAllowMixed:Xb,shimAddIceCandidateNullOrEmpty:Zb});let eO,tO;!function(){let{window:e}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimEdge:!0,shimSafari:!0};const r=Ug,i=xg(e),n={browserDetails:i,commonShim:$b,extractVersion:kg,disableLog:Bg,disableWarnings:Mg};switch(i.browser){case"chrome":if(!Bw||!kw||!t.shimChrome)return r("Chrome shim is not included in this adapter release."),n;if(null===i.version)return r("Chrome shim can not determine version, not shimming."),n;r("adapter.js shimming chrome."),n.browserShim=Bw,Zb(e,i),Rw(e,i),Tw(e),kw(e,i),ww(e),Lw(e,i),bw(e),Ow(e),Nw(e),Pw(e,i),Wb(e),zb(e),Jb(e,i),qb(e),Xb(e,i);break;case"firefox":if(!gb||!sb||!t.shimFirefox)return r("Firefox shim is not included in this adapter release."),n;r("adapter.js shimming firefox."),n.browserShim=gb,Zb(e,i),nb(e,i),sb(e,i),ob(e),db(e),ab(e),cb(e),ub(e),Ab(e),hb(e),lb(e),pb(e),Wb(e),zb(e),Jb(e,i),qb(e);break;case"edge":if(!Jw||!Yw||!t.shimEdge)return r("MS edge shim is not included in this adapter release."),n;r("adapter.js shimming edge."),n.browserShim=Jw,Kw(e),Hw(e),Yw(e,i),Ww(e),Jb(e,i),qb(e);break;case"safari":if(!Rb||!t.shimSafari)return r("Safari shim is not included in this adapter release."),n;r("adapter.js shimming safari."),n.browserShim=Rb,Zb(e,i),Cb(e),Sb(e),Ib(e),fb(e),Eb(e),vb(e),mb(e),yb(e),Wb(e),Jb(e,i),qb(e),Xb(e,i);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),function(e){e.WIN_10="Windows 10",e.WIN_81="Windows 8.1",e.WIN_8="Windows 8",e.WIN_7="Windows 7",e.WIN_VISTA="Windows Vista",e.WIN_SERVER_2003="Windows Server 2003",e.WIN_XP="Windows XP",e.WIN_2000="Windows 2000",e.ANDROID="Android",e.OPEN_BSD="Open BSD",e.SUN_OS="Sun OS",e.LINUX="Linux",e.IOS="iOS",e.MAC_OS="Mac OS",e.QNX="QNX",e.UNIX="UNIX",e.BEOS="BeOS",e.OS_2="OS/2",e.SEARCH_BOT="Search Bot"}(eO||(eO={})),function(e){e.CHROME="Chrome",e.SAFARI="Safari",e.EDGE="Edge",e.FIREFOX="Firefox",e.OPERA="OPR",e.QQ="QQBrowser",e.WECHAT="MicroMessenger"}(tO||(tO={}));var rO={exports:{}};
/*!@license
* UAParser.js v0.7.28
* Lightweight JavaScript-based User-Agent string parser
* https://github.com/faisalman/ua-parser-js
*
* Copyright © 2012-2021 Faisal Salman <f@faisalman.com>
* Licensed under MIT License
*/!function(t,r){!function(e,i){var n="function",o="object",s="string",a="model",c="name",d="type",u="vendor",A="version",h="architecture",l="console",p="mobile",g="tablet",f="smarttv",E="wearable",I="embedded",m={extend:function(e,t){var r={};for(var i in e)t[i]&&t[i].length%2==0?r[i]=t[i].concat(e[i]):r[i]=e[i];return r},has:function(e,t){return typeof e===s&&-1!==t.toLowerCase().indexOf(e.toLowerCase())},lowerize:function(e){return e.toLowerCase()},major:function(e){return typeof e===s?e.replace(/[^\d\.]/g,"").split(".")[0]:i},trim:function(e,t){return e=e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),void 0===t?e:e.substring(0,255)}},_={rgx:function(e,t){for(var r,s,a,c,d,u,A=0;A<t.length&&!d;){var h=t[A],l=t[A+1];for(r=s=0;r<h.length&&!d;)if(d=h[r++].exec(e))for(a=0;a<l.length;a++)u=d[++s],typeof(c=l[a])===o&&c.length>0?2==c.length?typeof c[1]==n?this[c[0]]=c[1].call(this,u):this[c[0]]=c[1]:3==c.length?typeof c[1]!==n||c[1].exec&&c[1].test?this[c[0]]=u?u.replace(c[1],c[2]):i:this[c[0]]=u?c[1].call(this,u,c[2]):i:4==c.length&&(this[c[0]]=u?c[3].call(this,u.replace(c[1],c[2])):i):this[c]=u||i;A+=2}},str:function(e,t){for(var r in t)if(typeof t[r]===o&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(m.has(t[r][n],e))return"?"===r?i:r}else if(m.has(t[r],e))return"?"===r?i:r;return e}},C={browser:{oldSafari:{version:{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}},oldEdge:{version:{.1:"12.",21:"13.",31:"14.",39:"15.",41:"16.",42:"17.",44:"18."}}},os:{windows:{version:{ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"}}}},v={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[A,[c,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[A,[c,"Edge"]],[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]{3,6})\b.+version\/([\w\.-]+)/i,/(opera)(?:.+version\/|[\/\s]+)([\w\.]+)/i],[c,A],[/opios[\/\s]+([\w\.]+)/i],[A,[c,"Opera Mini"]],[/\sopr\/([\w\.]+)/i],[A,[c,"Opera"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,/(avant\s|iemobile|slim)(?:browser)?[\/\s]?([\w\.]*)/i,/(ba?idubrowser)[\/\s]?([\w\.]+)/i,/(?:ms|\()(ie)\s([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon)\/([\w\.-]+)/i,/(rekonq|puffin|brave|whale|qqbrowserlite|qq)\/([\w\.]+)/i,/(weibo)__([\d\.]+)/i],[c,A],[/(?:[\s\/]uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[A,[c,"UCBrowser"]],[/(?:windowswechat)?\sqbcore\/([\w\.]+)\b.*(?:windowswechat)?/i],[A,[c,"WeChat(Win) Desktop"]],[/micromessenger\/([\w\.]+)/i],[A,[c,"WeChat"]],[/konqueror\/([\w\.]+)/i],[A,[c,"Konqueror"]],[/trident.+rv[:\s]([\w\.]{1,9})\b.+like\sgecko/i],[A,[c,"IE"]],[/yabrowser\/([\w\.]+)/i],[A,[c,"Yandex"]],[/(avast|avg)\/([\w\.]+)/i],[[c,/(.+)/,"$1 Secure Browser"],A],[/focus\/([\w\.]+)/i],[A,[c,"Firefox Focus"]],[/opt\/([\w\.]+)/i],[A,[c,"Opera Touch"]],[/coc_coc_browser\/([\w\.]+)/i],[A,[c,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[A,[c,"Dolphin"]],[/coast\/([\w\.]+)/i],[A,[c,"Opera Coast"]],[/xiaomi\/miuibrowser\/([\w\.]+)/i],[A,[c,"MIUI Browser"]],[/fxios\/([\w\.-]+)/i],[A,[c,"Firefox"]],[/(qihu|qhbrowser|qihoobrowser|360browser)/i],[[c,"360 Browser"]],[/(oculus|samsung|sailfish)browser\/([\w\.]+)/i],[[c,/(.+)/,"$1 Browser"],A],[/(comodo_dragon)\/([\w\.]+)/i],[[c,/_/g," "],A],[/\s(electron)\/([\w\.]+)\ssafari/i,/(tesla)(?:\sqtcarbrowser|\/(20[12]\d\.[\w\.-]+))/i,/m?(qqbrowser|baiduboxapp|2345Explorer)[\/\s]?([\w\.]+)/i],[c,A],[/(MetaSr)[\/\s]?([\w\.]+)/i,/(LBBROWSER)/i],[c],[/;fbav\/([\w\.]+);/i],[A,[c,"Facebook"]],[/FBAN\/FBIOS|FB_IAB\/FB4A/i],[[c,"Facebook"]],[/safari\s(line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(chromium|instagram)[\/\s]([\w\.-]+)/i],[c,A],[/\bgsa\/([\w\.]+)\s.*safari\//i],[A,[c,"GSA"]],[/headlesschrome(?:\/([\w\.]+)|\s)/i],[A,[c,"Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[[c,"Chrome WebView"],A],[/droid.+\sversion\/([\w\.]+)\b.+(?:mobile\ssafari|safari)/i],[A,[c,"Android Browser"]],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],[c,A],[/version\/([\w\.]+)\s.*mobile\/\w+\s(safari)/i],[A,[c,"Mobile Safari"]],[/version\/([\w\.]+)\s.*(mobile\s?safari|safari)/i],[A,c],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[c,[A,_.str,C.browser.oldSafari.version]],[/(webkit|khtml)\/([\w\.]+)/i],[c,A],[/(navigator|netscape)\/([\w\.-]+)/i],[[c,"Netscape"],A],[/ile\svr;\srv:([\w\.]+)\).+firefox/i],[A,[c,"Firefox Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i,/(firefox)\/([\w\.]+)\s[\w\s\-]+\/[\w\.]+$/i,/(mozilla)\/([\w\.]+)\s.+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]*)/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],[c,A]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],[[h,"amd64"]],[/(ia32(?=;))/i],[[h,m.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[[h,"ia32"]],[/\b(aarch64|armv?8e?l?)\b/i],[[h,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[h,"armhf"]],[/windows\s(ce|mobile);\sppc;/i],[[h,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[[h,/ower/,"",m.lowerize]],[/(sun4\w)[;\)]/i],[[h,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?:64|(?=v(?:[1-7]|[5-7]1)l?|;|eabi))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[h,m.lowerize]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[pt]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus\s10)/i],[a,[u,"Samsung"],[d,g]],[/\b((?:s[cgp]h|gt|sm)-\w+|galaxy\snexus)/i,/\ssamsung[\s-]([\w-]+)/i,/sec-(sgh\w+)/i],[a,[u,"Samsung"],[d,p]],[/\((ip(?:hone|od)[\s\w]*);/i],[a,[u,"Apple"],[d,p]],[/\((ipad);[\w\s\),;-]+apple/i,/applecoremedia\/[\w\.]+\s\((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[a,[u,"Apple"],[d,g]],[/\b((?:agr|ags[23]|bah2?|sht?)-a?[lw]\d{2})/i],[a,[u,"Huawei"],[d,g]],[/d\/huawei([\w\s-]+)[;\)]/i,/\b(nexus\s6p|vog-[at]?l\d\d|ane-[at]?l[x\d]\d|eml-a?l\d\da?|lya-[at]?l\d[\dc]|clt-a?l\d\di?|ele-l\d\d)/i,/\b(\w{2,4}-[atu][ln][01259][019])[;\)\s]/i],[a,[u,"Huawei"],[d,p]],[/\b(poco[\s\w]+)(?:\sbuild|\))/i,/\b;\s(\w+)\sbuild\/hm\1/i,/\b(hm[\s\-_]?note?[\s_]?(?:\d\w)?)\sbuild/i,/\b(redmi[\s\-_]?(?:note|k)?[\w\s_]+)(?:\sbuild|\))/i,/\b(mi[\s\-_]?(?:a\d|one|one[\s_]plus|note lte)?[\s_]?(?:\d?\w?)[\s_]?(?:plus)?)\sbuild/i],[[a,/_/g," "],[u,"Xiaomi"],[d,p]],[/\b(mi[\s\-_]?(?:pad)(?:[\w\s_]+))(?:\sbuild|\))/i],[[a,/_/g," "],[u,"Xiaomi"],[d,g]],[/;\s(\w+)\sbuild.+\soppo/i,/\s(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007)\b/i],[a,[u,"OPPO"],[d,p]],[/\svivo\s(\w+)(?:\sbuild|\))/i,/\s(v[12]\d{3}\w?[at])(?:\sbuild|;)/i],[a,[u,"Vivo"],[d,p]],[/\s(rmx[12]\d{3})(?:\sbuild|;)/i],[a,[u,"Realme"],[d,p]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)\b[\w\s]+build\//i,/\smot(?:orola)?[\s-](\w*)/i,/((?:moto[\s\w\(\)]+|xt\d{3,4}|nexus\s6)(?=\sbuild|\)))/i],[a,[u,"Motorola"],[d,p]],[/\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],[a,[u,"Motorola"],[d,g]],[/((?=lg)?[vl]k\-?\d{3})\sbuild|\s3\.[\s\w;-]{10}lg?-([06cv9]{3,4})/i],[a,[u,"LG"],[d,g]],[/(lm-?f100[nv]?|nexus\s[45])/i,/lg[e;\s\/-]+((?!browser|netcast)\w+)/i,/\blg(\-?[\d\w]+)\sbuild/i],[a,[u,"LG"],[d,p]],[/(ideatab[\w\-\s]+)/i,/lenovo\s?(s(?:5000|6000)(?:[\w-]+)|tab(?:[\s\w]+)|yt[\d\w-]{6}|tb[\d\w-]{6})/i],[a,[u,"Lenovo"],[d,g]],[/(?:maemo|nokia).*(n900|lumia\s\d+)/i,/nokia[\s_-]?([\w\.-]*)/i],[[a,/_/g," "],[u,"Nokia"],[d,p]],[/droid.+;\s(pixel\sc)[\s)]/i],[a,[u,"Google"],[d,g]],[/droid.+;\s(pixel[\s\daxl]{0,6})(?:\sbuild|\))/i],[a,[u,"Google"],[d,p]],[/droid.+\s([c-g]\d{4}|so[-l]\w+|xq-a\w[4-7][12])(?=\sbuild\/|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[a,[u,"Sony"],[d,p]],[/sony\stablet\s[ps]\sbuild\//i,/(?:sony)?sgp\w+(?:\sbuild\/|\))/i],[[a,"Xperia Tablet"],[u,"Sony"],[d,g]],[/\s(kb2005|in20[12]5|be20[12][59])\b/i,/\ba000(1)\sbuild/i,/\boneplus\s(a\d{4})[\s)]/i],[a,[u,"OnePlus"],[d,p]],[/(alexa)webm/i,/(kf[a-z]{2}wi)(\sbuild\/|\))/i,/(kf[a-z]+)(\sbuild\/|\)).+silk\//i],[a,[u,"Amazon"],[d,g]],[/(sd|kf)[0349hijorstuw]+(\sbuild\/|\)).+silk\//i],[[a,"Fire Phone"],[u,"Amazon"],[d,p]],[/\((playbook);[\w\s\),;-]+(rim)/i],[a,u,[d,g]],[/((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10;\s(\w+)/i],[a,[u,"BlackBerry"],[d,p]],[/(?:\b|asus_)(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus\s7|padfone|p00[cj])/i],[a,[u,"ASUS"],[d,g]],[/\s(z[es]6[027][01][km][ls]|zenfone\s\d\w?)\b/i],[a,[u,"ASUS"],[d,p]],[/(nexus\s9)/i],[a,[u,"HTC"],[d,g]],[/(htc)[;_\s-]{1,2}([\w\s]+(?=\)|\sbuild)|\w+)/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],[u,[a,/_/g," "],[d,p]],[/droid[x\d\.\s;]+\s([ab][1-7]\-?[0178a]\d\d?)/i],[a,[u,"Acer"],[d,g]],[/droid.+;\s(m[1-5]\snote)\sbuild/i,/\bmz-([\w-]{2,})/i],[a,[u,"Meizu"],[d,p]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i,/(microsoft);\s(lumia[\s\w]+)/i,/(lenovo)[_\s-]?([\w-]+)/i,/linux;.+(jolla);/i,/droid.+;\s(oppo)\s?([\w\s]+)\sbuild/i],[u,a,[d,p]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i,/[;\/]\s?(le[\s\-]+pan)[\s\-]+(\w{1,9})\sbuild/i,/[;\/]\s?(trinity)[\-\s]*(t\d{3})\sbuild/i,/\b(gigaset)[\s\-]+(q\w{1,9})\sbuild/i,/\b(vodafone)\s([\w\s]+)(?:\)|\sbuild)/i],[u,a,[d,g]],[/\s(surface\sduo)\s/i],[a,[u,"Microsoft"],[d,g]],[/droid\s[\d\.]+;\s(fp\du?)\sbuild/i],[a,[u,"Fairphone"],[d,p]],[/\s(u304aa)\sbuild/i],[a,[u,"AT&T"],[d,p]],[/sie-(\w*)/i],[a,[u,"Siemens"],[d,p]],[/[;\/]\s?(rct\w+)\sbuild/i],[a,[u,"RCA"],[d,g]],[/[;\/\s](venue[\d\s]{2,7})\sbuild/i],[a,[u,"Dell"],[d,g]],[/[;\/]\s?(q(?:mv|ta)\w+)\sbuild/i],[a,[u,"Verizon"],[d,g]],[/[;\/]\s(?:barnes[&\s]+noble\s|bn[rt])([\w\s\+]*)\sbuild/i],[a,[u,"Barnes & Noble"],[d,g]],[/[;\/]\s(tm\d{3}\w+)\sbuild/i],[a,[u,"NuVision"],[d,g]],[/;\s(k88)\sbuild/i],[a,[u,"ZTE"],[d,g]],[/;\s(nx\d{3}j)\sbuild/i],[a,[u,"ZTE"],[d,p]],[/[;\/]\s?(gen\d{3})\sbuild.*49h/i],[a,[u,"Swiss"],[d,p]],[/[;\/]\s?(zur\d{3})\sbuild/i],[a,[u,"Swiss"],[d,g]],[/[;\/]\s?((zeki)?tb.*\b)\sbuild/i],[a,[u,"Zeki"],[d,g]],[/[;\/]\s([yr]\d{2})\sbuild/i,/[;\/]\s(dragon[\-\s]+touch\s|dt)(\w{5})\sbuild/i],[[u,"Dragon Touch"],a,[d,g]],[/[;\/]\s?(ns-?\w{0,9})\sbuild/i],[a,[u,"Insignia"],[d,g]],[/[;\/]\s?((nxa|Next)-?\w{0,9})\sbuild/i],[a,[u,"NextBook"],[d,g]],[/[;\/]\s?(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05]))\sbuild/i],[[u,"Voice"],a,[d,p]],[/[;\/]\s?(lvtel\-)?(v1[12])\sbuild/i],[[u,"LvTel"],a,[d,p]],[/;\s(ph-1)\s/i],[a,[u,"Essential"],[d,p]],[/[;\/]\s?(v(100md|700na|7011|917g).*\b)\sbuild/i],[a,[u,"Envizen"],[d,g]],[/[;\/]\s?(trio[\s\w\-\.]+)\sbuild/i],[a,[u,"MachSpeed"],[d,g]],[/[;\/]\s?tu_(1491)\sbuild/i],[a,[u,"Rotor"],[d,g]],[/(shield[\w\s]+)\sbuild/i],[a,[u,"Nvidia"],[d,g]],[/(sprint)\s(\w+)/i],[u,a,[d,p]],[/(kin\.[onetw]{3})/i],[[a,/\./g," "],[u,"Microsoft"],[d,p]],[/droid\s[\d\.]+;\s(cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[a,[u,"Zebra"],[d,g]],[/droid\s[\d\.]+;\s(ec30|ps20|tc[2-8]\d[kx])\)/i],[a,[u,"Zebra"],[d,p]],[/\s(ouya)\s/i,/(nintendo)\s([wids3utch]+)/i],[u,a,[d,l]],[/droid.+;\s(shield)\sbuild/i],[a,[u,"Nvidia"],[d,l]],[/(playstation\s[345portablevi]+)/i],[a,[u,"Sony"],[d,l]],[/[\s\(;](xbox(?:\sone)?(?!;\sxbox))[\s\);]/i],[a,[u,"Microsoft"],[d,l]],[/smart-tv.+(samsung)/i],[u,[d,f]],[/hbbtv.+maple;(\d+)/i],[[a,/^/,"SmartTV"],[u,"Samsung"],[d,f]],[/(?:linux;\snetcast.+smarttv|lg\snetcast\.tv-201\d)/i],[[u,"LG"],[d,f]],[/(apple)\s?tv/i],[u,[a,"Apple TV"],[d,f]],[/crkey/i],[[a,"Chromecast"],[u,"Google"],[d,f]],[/droid.+aft([\w])(\sbuild\/|\))/i],[a,[u,"Amazon"],[d,f]],[/\(dtv[\);].+(aquos)/i],[a,[u,"Sharp"],[d,f]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[[u,m.trim],[a,m.trim],[d,f]],[/[\s\/\(](android\s|smart[-\s]?|opera\s)tv[;\)\s]/i],[[d,f]],[/((pebble))app\/[\d\.]+\s/i],[u,a,[d,E]],[/droid.+;\s(glass)\s\d/i],[a,[u,"Google"],[d,E]],[/droid\s[\d\.]+;\s(wt63?0{2,3})\)/i],[a,[u,"Zebra"],[d,E]],[/(tesla)(?:\sqtcarbrowser|\/20[12]\d\.[\w\.-]+)/i],[u,[d,I]],[/droid .+?; ([^;]+?)(?: build|\) applewebkit).+? mobile safari/i],[a,[d,p]],[/droid .+?;\s([^;]+?)(?: build|\) applewebkit).+?(?! mobile) safari/i],[a,[d,g]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[[d,m.lowerize]],[/(android[\w\.\s\-]{0,9});.+build/i],[a,[u,"Generic"]],[/(phone)/i],[[d,p]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],[A,[c,"EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[A,[c,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],[c,A],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[A,c]],os:[[/microsoft\s(windows)\s(vista|xp)/i],[c,A],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)(?!.+xbox)/i],[c,[A,_.str,C.os.windows.version]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[[c,"Windows"],[A,_.str,C.os.windows.version]],[/ip[honead]{2,4}\b(?:.*os\s([\w]+)\slike\smac|;\sopera)/i,/cfnetwork\/.+darwin/i],[[A,/_/g,"."],[c,"iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)(?!.+haiku)/i],[[c,"Mac OS"],[A,/_/g,"."]],[/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|sailfish|contiki)[\/\s-]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/\s]([\w\.]+)/i,/\((series40);/i],[c,A],[/\(bb(10);/i],[A,[c,"BlackBerry"]],[/(?:symbian\s?os|symbos|s60(?=;)|series60)[\/\s-]?([\w\.]*)/i],[A,[c,"Symbian"]],[/mozilla.+\(mobile;.+gecko.+firefox/i],[[c,"Firefox OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[A,[c,"webOS"]],[/crkey\/([\d\.]+)/i],[A,[c,"Chromecast"]],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[[c,"Chromium OS"],A],[/(nintendo|playstation)\s([wids345portablevuch]+)/i,/(xbox);\s+xbox\s([^\);]+)/i,/(mint)[\/\s\(\)]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?=\slinux)|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus|raspbian)(?:\sgnu\/linux)?(?:\slinux)?[\/\s-]?(?!chrom|package)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i,/\s([frentopc-]{0,4}bsd|dragonfly)\s?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku)\s(\w+)/i],[c,A],[/(sunos)\s?([\w\.\d]*)/i],[[c,"Solaris"],A],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms|fuchsia)/i,/(unix)\s?([\w\.]*)/i],[c,A]]},S=function(t,r){if("object"==typeof t&&(r=t,t=i),!(this instanceof S))return new S(t,r).getResult();var n=t||(void 0!==e&&e.navigator&&e.navigator.userAgent?e.navigator.userAgent:""),o=r?m.extend(v,r):v;return this.getBrowser=function(){var e={name:i,version:i};return _.rgx.call(e,n,o.browser),e.major=m.major(e.version),e},this.getCPU=function(){var e={architecture:i};return _.rgx.call(e,n,o.cpu),e},this.getDevice=function(){var e={vendor:i,model:i,type:i};return _.rgx.call(e,n,o.device),e},this.getEngine=function(){var e={name:i,version:i};return _.rgx.call(e,n,o.engine),e},this.getOS=function(){var e={name:i,version:i};return _.rgx.call(e,n,o.os),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===s&&e.length>255?m.trim(e,255):e,this},this.setUA(n),this};S.VERSION="0.7.28",S.BROWSER={NAME:c,MAJOR:"major",VERSION:A},S.CPU={ARCHITECTURE:h},S.DEVICE={MODEL:a,VENDOR:u,TYPE:d,CONSOLE:l,MOBILE:p,SMARTTV:f,TABLET:g,WEARABLE:E,EMBEDDED:I},S.ENGINE={NAME:c,VERSION:A},S.OS={NAME:c,VERSION:A},t.exports&&(r=t.exports=S),r.UAParser=S;var y=void 0!==e&&(e.jQuery||e.Zepto);if(y&&!y.ua){var R=new S;y.ua=R.getResult(),y.ua.get=function(){return R.getUA()},y.ua.set=function(e){R.setUA(e);var t=R.getResult();for(var r in t)y.ua[r]=t[r]}}}("object"==typeof window?window:e)}(rO,rO.exports);const iO=new(0,rO.exports);let nO=iO.getResult();function oO(e){return e&&iO.setUA(e),nO=iO.getResult(),{name:sO(nO),version:aO(nO),os:cO(nO),osVersion:nO.os.version}}function sO(e){if("Blink"===e.engine.name&&"WeChat"!==e.browser.name)return tO.CHROME;switch(e.browser.name){case"Chrome Headless":case"Chrome":case"Chromium":return tO.CHROME;case"Safari":case"Mobile Safari":return tO.SAFARI;case"Edge":return tO.EDGE;case"Firefox":return tO.FIREFOX;case"QQBrowser":return tO.QQ;case"Opera":return tO.OPERA;case"WeChat":return tO.WECHAT;default:return e.browser.name||""}}function aO(e){let t;return t="Blink"===e.engine.name?e.engine.version||"":e.browser.version||"",t.split(".")[0]}function cO(e){switch(e.os.name){case"Windows":return e.os.version?e.os.name+" "+e.os.version:e.os.name;default:return e.os.name||""}}function dO(){return oO().os}function uO(){const e=oO();return!!("WebKit"===nO.engine.name&&e.os===eO.MAC_OS&&navigator.maxTouchPoints&&navigator.maxTouchPoints>0&&e.name!==tO.SAFARI||fO()&&e.name!==tO.SAFARI)}function AO(){const e=oO();if(uO()){if(e.os===eO.MAC_OS)return!0;if(e.os===eO.IOS){const e=nO.os.version&&nO.os.version.split(".");if(e&&14===Number(e[0])&&e[1]&&Number(e[1])>=3)return!0;if(e&&Number(e[0])>14)return!0}}return!1}function hO(){return"WebKit"===nO.engine.name}function lO(){return oO().name===tO.CHROME}function pO(){return oO().name===tO.SAFARI}function gO(){return oO().name===tO.FIREFOX}function fO(){return oO().os===eO.IOS}function EO(){const e=oO();if(e.os!==eO.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])}function IO(){const e=oO();if(e.os!==eO.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&0===Number(t[1])}function mO(){const e=oO();if(e.os!==eO.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=1}function _O(){const e=oO();if(e.os!==eO.IOS||!e.osVersion)return!1;const t=e.osVersion.split(".");return 15===Number(t[0])&&Number(t[1])>=2}function CO(){return pO()&&navigator.maxTouchPoints>0}function vO(){return oO().name===tO.WECHAT}function SO(){return window.navigator.appVersion&&null!==window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)&&window.navigator.appVersion.match(/Chrome\/([\w\W]*?)\./)[1]<=35}function yO(){const e=oO();if(e.name===tO.EDGE||e.name===tO.SAFARI)return!1;return!!navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]./i)}function RO(){return oO().os===eO.ANDROID}var TO={exports:{}},wO=JA,bO=Yc,OO=fA.f;wO({target:"Object",stat:!0,forced:Object.defineProperty!==OO,sham:!bO},{defineProperty:OO});var NO=_d.Object,DO=TO.exports=function(e,t,r){return NO.defineProperty(e,t,r)};NO.defineProperty.sham&&(DO.sham=!0);var LO=TO.exports;function kO(e,t,r){return t in e?LO(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var PO={exports:{}},BO=function(e,t){return function(){for(var r=new Array(arguments.length),i=0;i<r.length;i++)r[i]=arguments[i];return e.apply(t,r)}},MO=BO,UO=function(e){return null!=e&&null!=e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},QO=Object.prototype.toString;function xO(e){return"[object Array]"===QO.call(e)}function FO(e){return null!==e&&"object"==typeof e}function VO(e){return"[object Function]"===QO.call(e)}function jO(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),xO(e))for(var r=0,i=e.length;r<i;r++)t.call(null,e[r],r,e);else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(null,e[n],n,e)}var GO={isArray:xO,isArrayBuffer:function(e){return"[object ArrayBuffer]"===QO.call(e)},isBuffer:UO,isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:FO,isUndefined:function(e){return void 0===e},isDate:function(e){return"[object Date]"===QO.call(e)},isFile:function(e){return"[object File]"===QO.call(e)},isBlob:function(e){return"[object Blob]"===QO.call(e)},isFunction:VO,isStream:function(e){return FO(e)&&VO(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:jO,merge:function e(){var t={};function r(r,i){"object"==typeof t[i]&&"object"==typeof r?t[i]=e(t[i],r):t[i]=r}for(var i=0,n=arguments.length;i<n;i++)jO(arguments[i],r);return t},deepMerge:function e(){var t={};function r(r,i){"object"==typeof t[i]&&"object"==typeof r?t[i]=e(t[i],r):t[i]="object"==typeof r?e({},r):r}for(var i=0,n=arguments.length;i<n;i++)jO(arguments[i],r);return t},extend:function(e,t,r){return jO(t,(function(t,i){e[i]=r&&"function"==typeof t?MO(t,r):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")}},KO=GO;function HO(e){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var YO=function(e,t,r){if(!t)return e;var i;if(r)i=r(t);else if(KO.isURLSearchParams(t))i=t.toString();else{var n=[];KO.forEach(t,(function(e,t){null!=e&&(KO.isArray(e)?t+="[]":e=[e],KO.forEach(e,(function(e){KO.isDate(e)?e=e.toISOString():KO.isObject(e)&&(e=JSON.stringify(e)),n.push(HO(t)+"="+HO(e))})))})),i=n.join("&")}if(i){var o=e.indexOf("#");-1!==o&&(e=e.slice(0,o)),e+=(-1===e.indexOf("?")?"?":"&")+i}return e},WO=GO;function JO(){this.handlers=[]}JO.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},JO.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},JO.prototype.forEach=function(e){WO.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var qO=JO,zO=GO,XO=function(e){return!(!e||!e.__CANCEL__)},ZO=GO,$O=function(e,t,r,i,n){return e.config=t,r&&(e.code=r),e.request=i,e.response=n,e.isAxiosError=!0,e.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}},e},eN=function(e,t,r,i,n){var o=new Error(e);return $O(o,t,r,i,n)},tN=eN,rN=GO,iN=["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"],nN=GO,oN=nN.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),r=document.createElement("a");function i(e){var i=e;return t&&(r.setAttribute("href",i),i=r.href),r.setAttribute("href",i),{href:r.href,protocol:r.protocol?r.protocol.replace(/:$/,""):"",host:r.host,search:r.search?r.search.replace(/^\?/,""):"",hash:r.hash?r.hash.replace(/^#/,""):"",hostname:r.hostname,port:r.port,pathname:"/"===r.pathname.charAt(0)?r.pathname:"/"+r.pathname}}return e=i(window.location.href),function(t){var r=nN.isString(t)?i(t):t;return r.protocol===e.protocol&&r.host===e.host}}():function(){return!0},sN=GO,aN=sN.isStandardBrowserEnv()?{write:function(e,t,r,i,n,o){var s=[];s.push(e+"="+encodeURIComponent(t)),sN.isNumber(r)&&s.push("expires="+new Date(r).toGMTString()),sN.isString(i)&&s.push("path="+i),sN.isString(n)&&s.push("domain="+n),!0===o&&s.push("secure"),document.cookie=s.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},cN=GO,dN=function(e,t,r){var i=r.config.validateStatus;!i||i(r.status)?e(r):t(tN("Request failed with status code "+r.status,r.config,null,r.request,r))},uN=YO,AN=function(e){var t,r,i,n={};return e?(rN.forEach(e.split("\n"),(function(e){if(i=e.indexOf(":"),t=rN.trim(e.substr(0,i)).toLowerCase(),r=rN.trim(e.substr(i+1)),t){if(n[t]&&iN.indexOf(t)>=0)return;n[t]="set-cookie"===t?(n[t]?n[t]:[]).concat([r]):n[t]?n[t]+", "+r:r}})),n):n},hN=oN,lN=eN,pN=function(e){return new Promise((function(t,r){var i=e.data,n=e.headers;cN.isFormData(i)&&delete n["Content-Type"];var o=new XMLHttpRequest;if(e.auth){var s=e.auth.username||"",a=e.auth.password||"";n.Authorization="Basic "+btoa(s+":"+a)}if(o.open(e.method.toUpperCase(),uN(e.url,e.params,e.paramsSerializer),!0),o.timeout=e.timeout,o.onreadystatechange=function(){if(o&&4===o.readyState&&(0!==o.status||o.responseURL&&0===o.responseURL.indexOf("file:"))){var i="getAllResponseHeaders"in o?AN(o.getAllResponseHeaders()):null,n={data:e.responseType&&"text"!==e.responseType?o.response:o.responseText,status:o.status,statusText:o.statusText,headers:i,config:e,request:o};dN(t,r,n),o=null}},o.onabort=function(){o&&(r(lN("Request aborted",e,"ECONNABORTED",o)),o=null)},o.onerror=function(){r(lN("Network Error",e,null,o)),o=null},o.ontimeout=function(){r(lN("timeout of "+e.timeout+"ms exceeded",e,"ECONNABORTED",o)),o=null},cN.isStandardBrowserEnv()){var c=aN,d=(e.withCredentials||hN(e.url))&&e.xsrfCookieName?c.read(e.xsrfCookieName):void 0;d&&(n[e.xsrfHeaderName]=d)}if("setRequestHeader"in o&&cN.forEach(n,(function(e,t){void 0===i&&"content-type"===t.toLowerCase()?delete n[t]:o.setRequestHeader(t,e)})),e.withCredentials&&(o.withCredentials=!0),e.responseType)try{o.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&o.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&o.upload&&o.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){o&&(o.abort(),r(e),o=null)})),void 0===i&&(i=null),o.send(i)}))},gN=GO,fN=function(e,t){ZO.forEach(e,(function(r,i){i!==t&&i.toUpperCase()===t.toUpperCase()&&(e[t]=r,delete e[i])}))},EN={"Content-Type":"application/x-www-form-urlencoded"};function IN(e,t){!gN.isUndefined(e)&&gN.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var mN,_N={adapter:(("undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process)||"undefined"!=typeof XMLHttpRequest)&&(mN=pN),mN),transformRequest:[function(e,t){return fN(t,"Accept"),fN(t,"Content-Type"),gN.isFormData(e)||gN.isArrayBuffer(e)||gN.isBuffer(e)||gN.isStream(e)||gN.isFile(e)||gN.isBlob(e)?e:gN.isArrayBufferView(e)?e.buffer:gN.isURLSearchParams(e)?(IN(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):gN.isObject(e)?(IN(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,validateStatus:function(e){return e>=200&&e<300}};_N.headers={common:{Accept:"application/json, text/plain, */*"}},gN.forEach(["delete","get","head"],(function(e){_N.headers[e]={}})),gN.forEach(["post","put","patch"],(function(e){_N.headers[e]=gN.merge(EN)}));var CN=_N,vN=GO,SN=function(e,t,r){return zO.forEach(r,(function(r){e=r(e,t)})),e},yN=XO,RN=CN,TN=function(e){return/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(e)},wN=function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e};function bN(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var ON=GO,NN=function(e,t){t=t||{};var r={};return ON.forEach(["url","method","params","data"],(function(e){void 0!==t[e]&&(r[e]=t[e])})),ON.forEach(["headers","auth","proxy"],(function(i){ON.isObject(t[i])?r[i]=ON.deepMerge(e[i],t[i]):void 0!==t[i]?r[i]=t[i]:ON.isObject(e[i])?r[i]=ON.deepMerge(e[i]):void 0!==e[i]&&(r[i]=e[i])})),ON.forEach(["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","maxContentLength","validateStatus","maxRedirects","httpAgent","httpsAgent","cancelToken","socketPath"],(function(i){void 0!==t[i]?r[i]=t[i]:void 0!==e[i]&&(r[i]=e[i])})),r},DN=GO,LN=YO,kN=qO,PN=function(e){return bN(e),e.baseURL&&!TN(e.url)&&(e.url=wN(e.baseURL,e.url)),e.headers=e.headers||{},e.data=SN(e.data,e.headers,e.transformRequest),e.headers=vN.merge(e.headers.common||{},e.headers[e.method]||{},e.headers||{}),vN.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||RN.adapter)(e).then((function(t){return bN(e),t.data=SN(t.data,t.headers,e.transformResponse),t}),(function(t){return yN(t)||(bN(e),t&&t.response&&(t.response.data=SN(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},BN=NN;function MN(e){this.defaults=e,this.interceptors={request:new kN,response:new kN}}MN.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=BN(this.defaults,e)).method=e.method?e.method.toLowerCase():"get";var t=[PN,void 0],r=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)r=r.then(t.shift(),t.shift());return r},MN.prototype.getUri=function(e){return e=BN(this.defaults,e),LN(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},DN.forEach(["delete","get","head","options"],(function(e){MN.prototype[e]=function(t,r){return this.request(DN.merge(r||{},{method:e,url:t}))}})),DN.forEach(["post","put","patch"],(function(e){MN.prototype[e]=function(t,r,i){return this.request(DN.merge(i||{},{method:e,url:t,data:r}))}}));var UN=MN;function QN(e){this.message=e}QN.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},QN.prototype.__CANCEL__=!0;var xN=QN,FN=xN;function VN(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var r=this;e((function(e){r.reason||(r.reason=new FN(e),t(r.reason))}))}VN.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},VN.source=function(){var e;return{token:new VN((function(t){e=t})),cancel:e}};var jN=VN,GN=GO,KN=BO,HN=UN,YN=NN;function WN(e){var t=new HN(e),r=KN(HN.prototype.request,t);return GN.extend(r,HN.prototype,t),GN.extend(r,t),r}var JN=WN(CN);JN.Axios=HN,JN.create=function(e){return WN(YN(JN.defaults,e))},JN.Cancel=xN,JN.CancelToken=jN,JN.isCancel=XO,JN.all=function(e){return Promise.all(e)},JN.spread=function(e){return function(t){return e.apply(null,t)}},PO.exports=JN,PO.exports.default=JN;var qN=PO.exports;class zN{constructor(e){kO(this,"logger",void 0),kO(this,"prefixLists",[]),this.logger=e}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.debug(...this.prefixLists,...t)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.info(...this.prefixLists,...t)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.warning(...this.prefixLists,...t)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.logger.error(...this.prefixLists,...t)}prefix(e){return this.prefixLists.push(e),this}popPrefix(){return this.prefixLists.pop(),this}}class XN{constructor(){kO(this,"_events",{}),kO(this,"addListener",this.on)}getListeners(e){return this._events[e]?this._events[e].map(e=>e.listener):[]}on(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!1})}once(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!0})}off(e,t){if(!this._events[e])return;const r=this._events[e],i=this._indexOfListener(r,t);-1!==i&&r.splice(i,1),0===this._events[e].length&&delete this._events[e]}removeAllListeners(e){e?delete this._events[e]:this._events={}}emit(e){this._events[e]||(this._events[e]=[]);const t=this._events[e].map(e=>e);for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];for(let r=0;r<t.length;r+=1){const n=t[r];n.once&&this.off(e,n.listener),n.listener.apply(this,i||[])}}_indexOfListener(e,t){let r=e.length;for(;r--;)if(e[r].listener===t)return r;return-1}}const ZN=new class extends XN{reportLogUploadError(e){this.emit("REPORT_LOG_UPLOAD",e)}};let $N;!function(e){e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.UNEXPECTED_RESPONSE="UNEXPECTED_RESPONSE",e.TIMEOUT="TIMEOUT",e.INVALID_PARAMS="INVALID_PARAMS",e.NOT_READABLE="NOT_READABLE",e.NOT_SUPPORTED="NOT_SUPPORTED",e.INVALID_OPERATION="INVALID_OPERATION",e.OPERATION_ABORTED="OPERATION_ABORTED",e.WEB_SECURITY_RESTRICT="WEB_SECURITY_RESTRICT",e.EXCHANGE_SDP_FAILED="EXCHANGE_SDP_FAILED",e.NETWORK_ERROR="NETWORK_ERROR",e.NETWORK_TIMEOUT="NETWORK_TIMEOUT",e.NETWORK_RESPONSE_ERROR="NETWORK_RESPONSE_ERROR",e.API_INVOKE_TIMEOUT="API_INVOKE_TIMEOUT",e.ENUMERATE_DEVICES_FAILED="ENUMERATE_DEVICES_FAILED",e.DEVICE_NOT_FOUND="DEVICE_NOT_FOUND",e.ELECTRON_IS_NULL="ELECTRON_IS_NULL",e.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR="ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR",e.CHROME_PLUGIN_NO_RESPONSE="CHROME_PLUGIN_NO_RESPONSE",e.CHROME_PLUGIN_NOT_INSTALL="CHROME_PLUGIN_NOT_INSTALL",e.MEDIA_OPTION_INVALID="MEDIA_OPTION_INVALID",e.PERMISSION_DENIED="PERMISSION_DENIED",e.CONSTRAINT_NOT_SATISFIED="CONSTRAINT_NOT_SATISFIED",e.TRACK_IS_DISABLED="TRACK_IS_DISABLED",e.GET_VIDEO_ELEMENT_VISIBLE_ERROR="GET_VIDEO_ELEMENT_VISIBLE_ERROR",e.SHARE_AUDIO_NOT_ALLOWED="SHARE_AUDIO_NOT_ALLOWED",e.LOW_STREAM_ENCODING_ERROR="LOW_STREAM_ENCODING_ERROR",e.SET_ENCODING_PARAMETER_ERROR="SET_ENCODING_PARAMETER_ERROR",e.TRACK_STATE_UNREACHABLE="TRACK_STATE_UNREACHABLE",e.INVALID_UINT_UID_FROM_STRING_UID="INVALID_UINT_UID_FROM_STRING_UID",e.CAN_NOT_GET_PROXY_SERVER="CAN_NOT_GET_PROXY_SERVER",e.CAN_NOT_GET_GATEWAY_SERVER="CAN_NOT_GET_GATEWAY_SERVER",e.VOID_GATEWAY_ADDRESS="VOID_GATEWAY_ADDRESS",e.UID_CONFLICT="UID_CONFLICT",e.MULTI_UNILBS_RESPONSE_ERROR="MULTI_UNILBS_RESPONSE_ERROR",e.UPDATE_TICKET_FAILED="UPDATE_TICKET_FAILED",e.INVALID_LOCAL_TRACK="INVALID_LOCAL_TRACK",e.INVALID_TRACK="INVALID_TRACK",e.SENDER_NOT_FOUND="SENDER_NOT_FOUND",e.CREATE_OFFER_FAILED="CREATE_OFFER_FAILED",e.SET_ANSWER_FAILED="SET_ANSWER_FAILED",e.ICE_FAILED="ICE_FAILED",e.PC_CLOSED="PC_CLOSED",e.SENDER_REPLACE_FAILED="SENDER_REPLACE_FAILED",e.GET_LOCAL_CAPABILITIES_FAILED="GET_LOCAL_CAPABILITIES_FAILED",e.GET_LOCAL_CONNECTION_PARAMS_FAILED="GET_LOCAL_CONNECTION_PARAMS_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",e.NO_ICE_CANDIDATE="NO_ICE_CANDIDATE",e.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS="CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS",e.EXIST_DISABLED_VIDEO_TRACK="EXIST_DISABLED_VIDEO_TRACK",e.INVALID_REMOTE_USER="INVALID_REMOTE_USER",e.REMOTE_USER_IS_NOT_PUBLISHED="REMOTE_USER_IS_NOT_PUBLISHED",e.CUSTOM_REPORT_SEND_FAILED="CUSTOM_REPORT_SEND_FAILED",e.CUSTOM_REPORT_FREQUENCY_TOO_HIGH="CUSTOM_REPORT_FREQUENCY_TOO_HIGH",e.FETCH_AUDIO_FILE_FAILED="FETCH_AUDIO_FILE_FAILED",e.READ_LOCAL_AUDIO_FILE_ERROR="READ_LOCAL_AUDIO_FILE_ERROR",e.DECODE_AUDIO_FILE_FAILED="DECODE_AUDIO_FILE_FAILED",e.WS_ABORT="WS_ABORT",e.WS_DISCONNECT="WS_DISCONNECT",e.WS_ERR="WS_ERR",e.LIVE_STREAMING_TASK_CONFLICT="LIVE_STREAMING_TASK_CONFLICT",e.LIVE_STREAMING_INVALID_ARGUMENT="LIVE_STREAMING_INVALID_ARGUMENT",e.LIVE_STREAMING_INTERNAL_SERVER_ERROR="LIVE_STREAMING_INTERNAL_SERVER_ERROR",e.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED="LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED",e.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED="LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED",e.LIVE_STREAMING_CDN_ERROR="LIVE_STREAMING_CDN_ERROR",e.LIVE_STREAMING_INVALID_RAW_STREAM="LIVE_STREAMING_INVALID_RAW_STREAM",e.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT="LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT",e.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE="LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE",e.LIVE_STREAMING_WARN_FREQUENT_REQUEST="LIVE_STREAMING_WARN_FREQUENT_REQUEST",e.WEBGL_INTERNAL_ERROR="WEBGL_INTERNAL_ERROR",e.BEAUTY_PROCESSOR_INTERNAL_ERROR="BEAUTY_PROCESSOR_INTERNAL_ERROR",e.CROSS_CHANNEL_WAIT_STATUS_ERROR="CROSS_CHANNEL_WAIT_STATUS_ERROR",e.CROSS_CHANNEL_FAILED_JOIN_SRC="CROSS_CHANNEL_FAILED_JOIN_SEC",e.CROSS_CHANNEL_FAILED_JOIN_DEST="CROSS_CHANNEL_FAILED_JOIN_DEST",e.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST="CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST",e.CROSS_CHANNEL_SERVER_ERROR_RESPONSE="CROSS_CHANNEL_SERVER_ERROR_RESPONSE",e.METADATA_OUT_OF_RANGE="METADATA_OUT_OF_RANGE",e.LOCAL_AEC_ERROR="LOCAL_AEC_ERROR",e.INVALID_PLUGIN="INVALID_PLUGIN",e.DISCONNECT_P2P="DISCONNECT_P2P",e.INIT_WEBSOCKET_TIMEOUT="INIT_WEBSOCKET_TIMEOUT"}($N||($N={}));class eD extends Error{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0;super(t),kO(this,"code",void 0),kO(this,"message",void 0),kO(this,"data",void 0),kO(this,"name","AgoraRTCException"),this.code=e,this.message="AgoraRTCError ".concat(this.code,": ").concat(t),this.data=r}toString(){return this.data?"data: ".concat(JSON.stringify(this.data),"\n").concat(this.stack):"".concat(this.stack)}print(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"error";return"error"===e&&cD.error(this.toString()),"warning"===e&&cD.warning(this.toString()),this}throw(){throw this.print(),this}}const tD={timeout:500,timeoutFactor:1.5,maxRetryCount:1/0,maxRetryTimeout:1e4};function rD(e,t){const r=Math.floor(t.timeout*Math.pow(t.timeoutFactor,e));return Math.min(t.maxRetryTimeout,r)}function iD(e,t,r,i){const n=Object.assign({},tD,i);let o=n.timeout;const s=async()=>{await function(e){return new ny(t=>{window.setTimeout(t,e)})}(o),o*=n.timeoutFactor,o=Math.min(n.maxRetryTimeout,o)};let a=!1;const c=new ny(async(i,o)=>{t=t||(()=>!1),r=r||(()=>!0);for(let c=0;c<n.maxRetryCount;c+=1){if(a)return o(new eD($N.OPERATION_ABORTED));try{const r=await e();if(!t(r,c))return i(r);if(c+1===n.maxRetryCount)return i(r);await s()}catch(e){if(!r(e,c))return o(e);if(c+1===n.maxRetryCount)return o(e);await s()}}});return c.cancel=()=>a=!0,c}function nD(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}const oD={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4},sD=Date.now(),aD=e=>{for(const t in oD)if(Object.prototype.hasOwnProperty.call(oD,t)&&oD[t]===e)return t;return"DEFAULT"};const cD=new class{constructor(){kO(this,"proxyServerURL",void 0),kO(this,"logLevel",oD.DEBUG),kO(this,"uploadState","collecting"),kO(this,"uploadLogWaitingList",[]),kO(this,"uploadLogUploadingList",[]),kO(this,"uploadErrorCount",0),kO(this,"currentLogID",0),kO(this,"url",void 0),kO(this,"extLog",(e,t)=>{this.appendLogToWaitingList(e,t)})}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[oD.DEBUG].concat(t);this.log.apply(this,i)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[oD.INFO].concat(t);this.log.apply(this,i)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[oD.WARNING].concat(t);this.log.apply(this,i)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[oD.ERROR].concat(t);this.log.apply(this,i)}upload(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[oD.DEBUG].concat(t);this.uploadLog.apply(this,i)}setLogLevel(e){e=Math.min(Math.max(0,e),4),this.logLevel=e}enableLogUpload(){YD("UPLOAD_LOG",!0)}disableLogUpload(){YD("UPLOAD_LOG",!1),this.uploadLogUploadingList=[],this.uploadLogWaitingList=[]}setProxyServer(e){this.proxyServerURL=e}prefix(e){return new zN(this).prefix(e)}log(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Date.now()-sD<100)return void setTimeout(()=>{this.log(...t)},Date.now()-sD);const i=Math.max(0,Math.min(4,t[0]));if(t[0]=nD()+" Agora-SDK [".concat(aD(i),"]:"),this.appendLogToWaitingList(i,t),i<this.logLevel)return;const n=nD()+" %cAgora-SDK [".concat(aD(i),"]:");let o=[];if(!WD("USE_NEW_LOG"))switch(i){case oD.DEBUG:o=[n,"color: #64B5F6;"].concat(t.slice(1)),console.log.apply(console,o);break;case oD.INFO:o=[n,"color: #1E88E5; font-weight: bold;"].concat(t.slice(1)),console.log.apply(console,o);break;case oD.WARNING:o=[n,"color: #FB8C00; font-weight: bold;"].concat(t.slice(1)),console.warn.apply(console,o);break;case oD.ERROR:o=[n,"color: #B00020; font-weight: bold;"].concat(t.slice(1)),console.error.apply(console,o)}}uploadLog(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];if(Date.now()-sD<100)return void setTimeout(()=>{this.uploadLog(...t)},Date.now()-sD);const i=Math.max(0,Math.min(4,t[0]));t[0]=nD()+" Agora-SDK [".concat(aD(i),"]:"),this.appendLogToWaitingList(i,t)}appendLogToWaitingList(e){if(!WD("UPLOAD_LOG"))return;let t="";for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];i.forEach(e=>{"object"==typeof e&&(e=JSON.stringify(e)),t+="".concat(e," ")}),this.uploadLogWaitingList.push({payload_str:t,log_level:e,log_item_id:this.currentLogID++}),"uploading"===this.uploadState&&0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}startUpload(){this.uploadState="uploading",0===this.uploadLogUploadingList.length&&this.uploadLogInterval()}async uploadLogs(){const e=this.uploadLogUploadingList,t={sdk_version:BD,process_id:WD("PROCESS_ID"),payload:JSON.stringify(e)};return iD(async()=>{const e=await qN.post(this.url||(this.proxyServerURL?"https://".concat(this.proxyServerURL,"/ls/?h=").concat(WD("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(WD("LOG_UPLOAD_SERVER"),"/upload/v1")),t,{responseType:"text"});if("OK"!==e.data){const t=new Error("unexpected upload log response");throw t.response=e,t}},()=>(this.uploadLogUploadingList=[],!1),e=>(e.response?ZN.reportLogUploadError({status:e.response.status,data:e.response.data,headers:e.response.headers,message:e.message}):e.request?ZN.reportLogUploadError({status:e.request.status,message:e.message}):ZN.reportLogUploadError({status:-1,message:e.message}),!0),{timeout:2e3,maxRetryTimeout:2e4})}uploadLogInterval(){0===this.uploadLogUploadingList.length&&0===this.uploadLogWaitingList.length||(0===this.uploadLogUploadingList.length&&(this.uploadLogUploadingList=this.uploadLogWaitingList.splice(0,10)),this.uploadLogs().then(()=>{this.uploadErrorCount=0,this.uploadLogWaitingList.length>0&&window.setTimeout(()=>this.uploadLogInterval(),3e3)}).catch(e=>{this.uploadErrorCount+=1,this.uploadErrorCount<2?window.setTimeout(()=>this.uploadLogInterval(),200):window.setTimeout(()=>this.uploadLogInterval(),1e3)}))}},dD={debug:console.log,info:console.log,warning:console.warn,error:console.error},uD={debug:"color: #64B5F6;",info:"color: #1E88E5; font-weight: bold;",warning:"color: #FB8C00; font-weight: bold;",error:"color: #B00020; font-weight: bold;"},AD={debug:0,info:1,warning:2,error:3},hD=[];let lD,pD=0,gD=0,fD=!1;function ED(){const e=new Date;return[e.getTime(),e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()]}function ID(e){if(!WD("UPLOAD_LOG"))return;let t;switch(e.type){case ak.MISC:t=[e.timestamp,e.level,e.type,e.module,e.instanceId,[e.msg]];break;case ak.INTERNAL_EVENT:case ak.PUBLIC_EVENT:case ak.WEB_EVENT:t=[e.timestamp,e.level,e.type,e.module,e.instanceId,[e.event,e.msg]];break;case ak.INTERNAL_API:case ak.PUBLIC_API:case ak.WEB_API:t=[e.timestamp,e.level,e.type,e.module,e.instanceId,[e.api,e.args,e.result]]}hD.push(t)}function mD(e,t){const[r,i]=ED(),n="warning",o="".concat(i," %cAgora-SDK [").concat(n,"] [INTERNAL API]:"),s={[ak.WEB_API]:"logWebAPI",[ak.PUBLIC_API]:"logPublicAPI",[ak.INTERNAL_API]:"logInternalAPI",[ak.WEB_EVENT]:"logWebEvent",[ak.PUBLIC_EVENT]:"logPublicEvent",[ak.INTERNAL_EVENT]:"logInternalEvent",[ak.MISC]:"logMisc"}[e],a=[o,uD.warning,"Log.".concat(s),t];WD("USE_NEW_LOG")&&(CD(n)&&dD.warning.apply(console,a),ID({timestamp:r,level:n,module:"Log",instanceId:void 0,type:ak.INTERNAL_API,api:s,args:void 0,result:t.toString()}))}function _D(e){if(Array.isArray(e)){let[t,r]=e;return t||(t="Global"),{module:t,instanceId:r}}let t,r;if("string"!=typeof e.__moduleName)throw new Error("Cannot get __moduleName from log instance.");t=e.__moduleName;try{r=e.__instanceId}catch(e){throw new Error("Cannot get __instanceId from log instance.")}return{module:t,instanceId:r}}function CD(e){return AD[e]>=gD}function vD(e,t,r,i,n,o){if(e===ak.PUBLIC_API||e===ak.WEB_API||e===ak.INTERNAL_API)try{const{module:s,instanceId:a}=_D(r);n=n&&JSON.stringify(n),o=o instanceof Error?o.toString():o&&JSON.stringify(o);const[c,d]=ED(),u=["".concat(d," %cAgora-SDK [").concat(t,"] [").concat({[ak.PUBLIC_API]:"PUBLIC API",[ak.WEB_API]:"WEB API",[ak.INTERNAL_API]:"INTERNAL API"}[e],"]:"),uD[t],"".concat(s).concat(a?"<".concat(a,">"):"",".").concat(i),n,o];WD("USE_NEW_LOG")&&(CD(t)&&dD[t].apply(console,u),ID({timestamp:c,level:t,module:s,instanceId:a,type:e,api:i,args:n,result:o}))}catch(t){mD(e,t)}}function SD(e,t,r,i,n){if(e===ak.WEB_EVENT||e===ak.INTERNAL_EVENT||e===ak.PUBLIC_EVENT)try{const{module:o,instanceId:s}=_D(r);"string"!=typeof n&&(n=n instanceof Error?n.toString():JSON.stringify(n));const[a,c]=ED(),d=["".concat(c," %cAgora-SDK [").concat(t,"] [").concat({[ak.WEB_EVENT]:"WEB EVENT",[ak.PUBLIC_EVENT]:"PUBLIC EVENT",[ak.INTERNAL_EVENT]:"INTERNAL EVENT"}[e],"]:"),uD[t],"".concat(o).concat(s?"<".concat(s,">"):"",".on(").concat(i,")"),n||""];WD("USE_NEW_LOG")&&(CD(t)&&dD[t].apply(console,d),ID({timestamp:a,level:t,module:o,instanceId:s,type:e,event:i,msg:n}))}catch(t){mD(e,t)}}function yD(e){lD=e}function RD(e,t,r){try{const{module:i,instanceId:n}=_D(t),[o,s]=ED(),a=["".concat(s," %cAgora-SDK [").concat(e,"] [MISC]:"),uD[e],"".concat(i).concat(n?"<".concat(n,">"):""),'"'.concat(r,'"')];WD("USE_NEW_LOG")&&(CD(e)&&dD[e].apply(console,a),ID({timestamp:o,level:e,module:i,instanceId:n,type:ak.MISC,msg:r}))}catch(e){OD("warning",["log"],"logMisc",void 0,e)}}function TD(e,t,r,i){SD(ak.INTERNAL_EVENT,e,t,r,i)}function wD(e,t,r,i){SD(ak.PUBLIC_EVENT,e,t,r,i)}function bD(e,t,r,i){SD(ak.WEB_EVENT,e,t,r,i)}function OD(e,t,r,i,n){vD(ak.INTERNAL_API,e,t,r,i,n)}function ND(e,t,r,i,n){vD(ak.WEB_API,e,t,r,i,n)}function DD(e,t,r,i,n){vD(ak.PUBLIC_API,e,t,r,i,n)}function LD(e,t){return function(r){return class extends r{get __moduleName(){return e}get __instanceId(){if(t){if("function"==typeof this[t])return this[t]();{const e=t.split(".");return e.length>0?vh(e).call(e,(e,t)=>{try{return e?e[t]:e}catch(e){return}},this):this[t]}}}}}}async function kD(e){if(!e&&fD)return;if(fD=!0,!WD("UPLOAD_LOG"))return void setTimeout(()=>kD(!0),5e3);if(0===hD.length)return void setTimeout(()=>kD(!0),3e3);const t=hD.slice(0,10),r={sdk_version:BD,log_version:WD("LOG_VERSION"),process_id:WD("PROCESS_ID"),index:pD,logs:JSON.stringify(t)};await iD(async()=>{const e=await qN.post(lD?"https://".concat(lD,"/ls/?h=").concat(WD("LOG_UPLOAD_SERVER"),"&p=443&d=upload/v1"):"https://".concat(WD("LOG_UPLOAD_SERVER"),"/upload/v1"),r,{responseType:"text"});if("OK"!==e.data)throw new Error("Log service response error ".concat(e.data));return e},void 0,void 0,{timeout:3e3,maxRetryTimeout:1e4}),hD.splice(0,10),pD+=t.length,setTimeout(()=>kD(!0),3e3)}const PD="v4.11.0-0-g961abf54(3/31/2022, 5:02:17 PM)",BD=function(e){if(e.match(/[0-9]+\.[0-9]+\.[0-9]+$/))return e;const t=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-alpha\.([0-9]+)/);if(t&&t[1]&&t[2]){const e=t[1],r=t[2];return"".concat(e,".").concat(r)}const r=e.match(/([0-9]+\.[0-9]+\.[0-9]+)\-special\.([0-9]+)/);if(r&&r[1]&&r[2]){const e=r[1],t=r[2];return"".concat(e,".").concat(100*(Number(t)+1))}return"4.0.0.999"}("4.11.0"),MD=function(){try{return!0===JSON.parse("true")}catch(e){return!0}}(),UD={username:"test",password:"111111",turnServerURL:"",tcpport:3433,udpport:3478,forceturn:!1};const QD={"90p":XD(160,90),"90p_1":XD(160,90),"120p":XD(160,120,15,30,65),"120p_1":XD(160,120,15,30,65),"120p_3":XD(120,120,15,30,50),"120p_4":XD(212,120),"180p":XD(320,180,15,30,140),"180p_1":XD(320,180,15,30,140),"180p_3":XD(180,180,15,30,100),"180p_4":XD(240,180,15,30,120),"240p":XD(320,240,15,40,200),"240p_1":XD(320,240,15,40,200),"240p_3":XD(240,240,15,40,140),"240p_4":XD(424,240,15,40,220),"360p":XD(640,360,15,80,400),"360p_1":XD(640,360,15,80,400),"360p_3":XD(360,360,15,80,260),"360p_4":XD(640,360,30,80,600),"360p_6":XD(360,360,30,80,400),"360p_7":XD(480,360,15,80,320),"360p_8":XD(480,360,30,80,490),"360p_9":XD(640,360,15,80,800),"360p_10":XD(640,360,24,80,800),"360p_11":XD(640,360,24,80,1e3),"480p":XD(640,480,15,100,500),"480p_1":XD(640,480,15,100,500),"480p_2":XD(640,480,30,100,1e3),"480p_3":XD(480,480,15,100,400),"480p_4":XD(640,480,30,100,750),"480p_6":XD(480,480,30,100,600),"480p_8":XD(848,480,15,100,610),"480p_9":XD(848,480,30,100,930),"480p_10":XD(640,480,10,100,400),"720p":XD(1280,720,15,120,1130),"720p_1":XD(1280,720,15,120,1130),"720p_2":XD(1280,720,30,120,2e3),"720p_3":XD(1280,720,30,120,1710),"720p_5":XD(960,720,15,120,910),"720p_6":XD(960,720,30,120,1380),"1080p":XD(1920,1080,15,120,2080),"1080p_1":XD(1920,1080,15,120,2080),"1080p_2":XD(1920,1080,30,120,3e3),"1080p_3":XD(1920,1080,30,120,3150),"1080p_5":XD(1920,1080,60,120,4780),"1440p":XD(2560,1440,30,120,4850),"1440p_1":XD(2560,1440,30,120,4850),"1440p_2":XD(2560,1440,60,120,7350),"4k":XD(3840,2160,30,120,8910),"4k_1":XD(3840,2160,30,120,8910),"4k_3":XD(3840,2160,60,120,13500)},xD={"480p":ZD(640,480,5),"480p_1":ZD(640,480,5),"480p_2":ZD(640,480,30),"480p_3":ZD(640,480,15),"720p":ZD(1280,720,5),"720p_1":ZD(1280,720,5),"720p_2":ZD(1280,720,30),"720p_3":ZD(1280,720,15),"1080p":ZD(1920,1080,5),"1080p_1":ZD(1920,1080,5),"1080p_2":ZD(1920,1080,30),"1080p_3":ZD(1920,1080,15)},FD={"1SL1TL":$D(1,1),"3SL3TL":$D(3,3),"2SL3TL":$D(2,3)};function VD(e){return"string"==typeof e?Object.assign({},QD[e]):e}function jD(e){return"string"==typeof e?Object.assign({},xD[e]):e}function GD(e){return"string"==typeof e?Object.assign({},FD[e]):e}const KD={speech_low_quality:zD(16e3,!1),speech_standard:zD(32e3,!1,18),music_standard:zD(48e3,!1),standard_stereo:zD(48e3,!0,56),high_quality:zD(48e3,!1,128),high_quality_stereo:zD(48e3,!0,192)};function HD(e){return"string"==typeof e?Object.assign({},KD[e]):e}function YD(e,t,r){Object.keys(JD).includes(e)&&(!r&&Object.keys(qD).includes(e)||(JD[e]=t))}function WD(e){return JD[e]}const JD={PROCESS_ID:"",ENCRYPT_AES:!0,AREAS:["CHINA","GLOBAL"],WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io","webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io","webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-web-2.ap.sd-rtn.com","cds-ap-web-3.agora.io","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-web-2.ap.sd-rtn.com","sua-ap-web-3.agora.io","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-ap-web-1.agora.io","uap-web-2.ap.sd-rtn.com","uap-ap-web-3.agora.io","uap-web-4.ap.sd-rtn.com"],LOG_UPLOAD_SERVER:"logservice.agora.io",EVENT_REPORT_DOMAIN:"statscollector-1.agora.io",EVENT_REPORT_BACKUP_DOMAIN:"web-2.statscollector.sd-rtn.com",GATEWAY_ADDRESS:[],GATEWAY_WSS_ADDRESS:"",LIVE_STREAMING_ADDRESS:"",HTTP_CONNECT_TIMEOUT:5e3,SIGNAL_REQUEST_TIMEOUT:1e4,REPORT_STATS:!0,UPLOAD_LOG:!1,NOT_REPORT_EVENT:[],SUBSCRIBE_TCC:!0,PING_PONG_TIME_OUT:10,WEBSOCKET_TIMEOUT_MIN:1e4,EVENT_REPORT_SEND_INTERVAL:3e3,CONFIG_DISTRIBUTE_INTERVAL:3e5,CANDIDATE_TIMEOUT:5e3,SHOW_REPORT_INVOKER_LOG:!1,JOIN_EXTEND:"",PUB_EXTEND:"",SUB_EXTEND:"",FORCE_TURN:!1,TURN_ENABLE_TCP:!0,TURN_ENABLE_UDP:!0,MAX_UPLOAD_CACHE:50,UPLOAD_CACHE_INTERVAL:2e3,AJAX_REQUEST_CONCURRENT:3,REPORT_APP_SCENARIO:void 0,GATEWAY_DOMAINS:["edge.agora.io","edge.sd-rtn.com"],WORKER_DOMAIN:"edge.agora.io",TURN_DOMAIN:"edge.agora.io",EVENT_REPORT_RETRY:!0,CHROME_FORCE_PLAN_B:!1,AUDIO_SOURCE_VOLUME_UPDATE_INTERVAL:400,AUDIO_SOURCE_AVG_VOLUME_DURATION:3e3,AUDIO_VOLUME_INDICATION_INTERVAL:2e3,VOLUME_VOICE_WEIGHT:10,NORMAL_EVENT_QUEUE_CAPACITY:100,CUSTOM_REPORT:!0,CUSTOM_REPORT_LIMIT:20,PROXY_SERVER_TYPE2:"webnginx-proxy.agora.io",PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com","webrtc-cloud-proxy.agora.io"],CUSTOM_PUB_ANSWER_MODIFIER:null,CUSTOM_SUB_ANSWER_MODIFIER:null,CUSTOM_PUB_OFFER_MODIFIER:null,CUSTOM_SUB_OFFER_MODIFIER:null,DSCP_TYPE:"high",REMOVE_NEW_CODECS:!0,FRAGEMENT_LENGTH:3,WEBSOCKET_COMPRESS:!1,SIMULCAST:!1,PRELOAD_MEDIA_COUNT:0,USE_RTX:!1,CHECK_VIDEO_VISIBLE_INTERVAL:3e4,ENUMERATE_DEVICES_INTERVAL:!1,ENUMERATE_DEVICES_INTERVAL_TIME:1e4,USE_NEW_TOKEN:!1,JOIN_WITH_FALLBACK_SIGNAL_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY:!0,JOIN_WITH_FALLBACK_MEDIA_PROXY_FORCE:!1,JOIN_WITH_FALLBACK_PROXY_PENDING_DURATION:2e3,USE_TURN_SERVER_OF_GATEWAY:!1,H264_PROFILE_LEVEL_ID:"",USE_NEW_LOG:!1,LOG_VERSION:3,MEDIA_DEVICE_CONSTRAINTS:null,ENCRYPT_PROXY_USERNAME_AND_PSW:!0,SDP_LOGGING:!1,REMOTE_AUDIO_TRACK_USES_WEB_AUDIO:!1,LOCAL_AUDIO_TRACK_USES_WEB_AUDIO:!0,BITRATE_ADAPTER_TYPE:"STANDARD_BITRATE",AI_DENOISER_PARAMETERS:{},ADJUST_3A_FROM_PLUGINS:!0,RAISE_H264_BASELINE_PRIORITY:!0,FILTER_SEND_H264_BASELINE:!1,ENABLE_PUBLISHED_USER_LIST:!0,MAX_SUBSCRIPTION:50,ACCOUNT_REGISTER_RETRY_TIMEOUT:1,ACCOUNT_REGISTER_RETRY_RATIO:2,ACCOUNT_REGISTER_RETRY_TIMEOUT_MAX:6e4,ACCOUNT_REGISTER_RETRY_COUNT_MAX:1e5,AUDIO_CONTEXT:null,WEBCS_BACKUP_CONNECT_TIMEOUT:6e3,PLAYER_STATE_DEFER:2e3,SIGNAL_REQUEST_WATCH_INTERVAL:1e3,FILEPATH_LENMAX:255,DUALSTREAM_OPERATION_CHECK:!0,MEDIA_ELEMENT_EXISTS_DEPTH:3,SHIM_CANDIDATE:!1,LEAVE_MSG_TIMEOUT:2e3,STATS_FILTER:{transportId:!0,googTrackId:!0}},qD={};function zD(e,t,r){return{sampleRate:e,stereo:t,bitrate:r}}function XD(e,t,r,i,n){return{width:e,height:t,frameRate:r,bitrateMin:i,bitrateMax:n}}function ZD(e,t,r,i,n){return{width:{max:e},height:{max:t},frameRate:r,bitrateMin:i,bitrateMax:n}}function $D(e,t){return{numSpatialLayers:e,numTemporalLayers:t}}MD||(JD.WEBCS_DOMAIN=["ap-web-1-oversea.agora.io","ap-web-1-north-america.agora.io"],JD.WEBCS_DOMAIN_BACKUP_LIST=["ap-web-2-oversea.agora.io","ap-web-2-north-america.agora.io"],JD.PROXY_CS=["proxy-ap-web-oversea.agora.io","proxy-ap-web-america.agora.io"],JD.CDS_AP=["cds-ap-web-oversea.agora.io","cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],JD.ACCOUNT_REGISTER=["sua-ap-web-oversea.agora.io","sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],JD.UAP_AP=["uap-ap-web-oversea.agora.io","uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],JD.LOG_UPLOAD_SERVER="logservice-oversea.agora.io",JD.EVENT_REPORT_DOMAIN="statscollector-1-oversea.agora.io",JD.EVENT_REPORT_BACKUP_DOMAIN="statscollector-2-oversea.agora.io",JD.PROXY_SERVER_TYPE3="webrtc-cloud-proxy.agora.io",JD.AREAS=["NORTH_AMERICA","OVERSEA"]);const eL=[[0,1,2,3,4,5,5],[0,2,2,3,4,5,5],[0,3,3,3,4,5,5],[0,4,4,4,4,5,5],[0,5,5,5,5,5,5]],tL=[],rL=[];var iL=Vu,nL=fA,oL=rd,sL=function(e,t,r){var i=iL(t);i in e?nL.f(e,i,oL(0,r)):e[i]=r},aL=ff,cL=th,dL=sL,uL=Qc.Array,AL=Math.max,hL=function(e,t,r){for(var i=cL(e),n=aL(t,i),o=aL(void 0===r?i:r,i),s=uL(AL(o-n,0)),a=0;n<o;n++,a++)dL(s,a,e[n]);return s.length=a,s},lL=hL,pL=Math.floor,gL=function(e,t){var r=e.length,i=pL(r/2);return r<8?fL(e,t):EL(e,gL(lL(e,0,i),t),gL(lL(e,i),t),t)},fL=function(e,t){for(var r,i,n=e.length,o=1;o<n;){for(i=o,r=e[o];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==o++&&(e[i]=r)}return e},EL=function(e,t,r,i){for(var n=t.length,o=r.length,s=0,a=0;s<n||a<o;)e[s+a]=s<n&&a<o?i(t[s],r[a])<=0?t[s++]:r[a++]:s<n?t[s++]:r[a++];return e},IL=gL,mL=Td.match(/firefox\/(\d+)/i),_L=!!mL&&+mL[1],CL=/MSIE|Trident/.test(Td),vL=Td.match(/AppleWebKit\/(\d+)\./),SL=!!vL&&+vL[1],yL=JA,RL=Bc,TL=qd,wL=Au,bL=th,OL=hI,NL=bc,DL=IL,LL=uh,kL=_L,PL=CL,BL=kd,ML=SL,UL=[],QL=RL(UL.sort),xL=RL(UL.push),FL=NL((function(){UL.sort(void 0)})),VL=NL((function(){UL.sort(null)})),jL=LL("sort"),GL=!NL((function(){if(BL)return BL<70;if(!(kL&&kL>3)){if(PL)return!0;if(ML)return ML<603;var e,t,r,i,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(i=0;i<47;i++)UL.push({k:t+i,v:r})}for(UL.sort((function(e,t){return t.v-e.v})),i=0;i<UL.length;i++)t=UL[i].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));yL({target:"Array",proto:!0,forced:FL||!VL||!jL||!GL},{sort:function(e){void 0!==e&&TL(e);var t=wL(this);if(GL)return void 0===e?QL(t):QL(t,e);var r,i,n=[],o=bL(t);for(i=0;i<o;i++)i in t&&xL(n,t[i]);for(DL(n,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:OL(t)>OL(r)?1:-1}}(e)),r=n.length,i=0;i<r;)t[i]=n[i++];for(;i<o;)delete t[i++];return t}});var KL=fh("Array").sort,HL=Mc,YL=KL,WL=Array.prototype,JL=function(e){var t=e.sort;return e===WL||HL(WL,e)&&t===WL.sort?YL:t};function qL(e,t){if("boolean"!=typeof e)throw new eD($N.INVALID_PARAMS,"Invalid ".concat(t,": The value is of the boolean type."))}function zL(e,t,r){if(r.includes(e))return;throw new eD($N.INVALID_PARAMS,"".concat(t," can only be set as ").concat(JSON.stringify(r)))}function XL(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e4,n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];if(e<r||e>i||n&&!nk(e)){throw new eD($N.INVALID_PARAMS,"invalid ".concat(t,": the value range is [").concat(r,", ").concat(i,"]. integer only"))}}function ZL(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:255,n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];if(null==e)throw new eD($N.INVALID_PARAMS,"".concat(t||"param"," cannot be empty"));if(!ik(e,r,i,n))throw new eD($N.INVALID_PARAMS,"Invalid ".concat(t||"string param",": Length of the string: [").concat(r,",").concat(i,"].").concat(n?" ASCII characters only.":""))}function $L(e,t){if(!Array.isArray(e))throw new eD($N.INVALID_PARAMS,"".concat(t," should be an array"))}function ek(e){if("string"!=typeof e||!/^[a-zA-Z0-9 \!\#\$\%\&\(\)\+\-\:\;\<\=\.\>\?\@\[\]\^\_\{\}\|\~\,]{1,64}$/.test(e))throw cD.error("Invalid Channel Name ".concat(e)),new eD($N.INVALID_PARAMS,"The length must be within 64 bytes. The supported characters: a-z,A-Z,0-9,space,!, #, $, %, &, (, ), +, -, :, ;, <, =, ., >, ?, @, [, ], ^, _, {, }, |, ~, ,")}function tk(e){if(!(t=e,"number"==typeof t&&Math.floor(t)===t&&0<=t&&t<=4294967295||ik(e,1,255)))throw cD.error("Invalid UID ".concat(e," ").concat(typeof e)),new eD($N.INVALID_PARAMS,"[String uid] Length of the string: [1,255]. ASCII characters only. [Number uid] The value range is [0,10000]");var t;"string"==typeof e&&cD.warning("You input a string as the user ID, to ensure better end-user experience, Agora highly suggests not using a string as the user ID.")}function rk(e){return null==e}function ik(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:255,i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];return"string"==typeof e&&e.length<=r&&e.length>=t&&(!i||ok(e))}function nk(e){return"number"==typeof e&&e%1==0}function ok(e){if("string"!=typeof e)return!1;for(let t=0;t<e.length;t+=1){const r=e.charCodeAt(t);if(r<0||r>255)return!1}return!0}let sk,ak,ck;!function(e){e.FREE="free",e.UPLOADING="uploading"}(sk||(sk={})),function(e){e[e.MISC=0]="MISC",e[e.INTERNAL_EVENT=1]="INTERNAL_EVENT",e[e.PUBLIC_EVENT=2]="PUBLIC_EVENT",e[e.WEB_EVENT=3]="WEB_EVENT",e[e.INTERNAL_API=4]="INTERNAL_API",e[e.WEB_API=5]="WEB_API",e[e.PUBLIC_API=6]="PUBLIC_API"}(ak||(ak={})),function(e){e.NONE="none",e.INIT="init",e.CANPLAY="canplay",e.PLAYING="playing",e.PAUSED="paused",e.SUSPEND="suspend",e.STALLED="stalled",e.WAITING="waiting",e.ERROR="error",e.DESTROYED="destroyed",e.ABORT="abort",e.ENDED="ended",e.EMPTIED="emptied",e.LOADEDDATA="loadeddata"}(ck||(ck={}));const dk={uninit:100,none:110,init:120,loadeddata:130,canplay:200,playing:210,paused:220,suspend:300,stalled:310,waiting:320,error:330,destroyed:340,abort:350,ended:360,emptied:370};function uk(e){return ZL(e.reportId,"params.reportId",0,100,!1),ZL(e.category,"params.category",0,100,!1),ZL(e.event,"params.event",0,100,!1),ZL(e.label,"params.label",0,100,!1),XL(e.value,"params.value",Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER,!1),!0}const Ak={sid:"",lts:0,success:null,cname:null,uid:null,peer:null,cid:null,elapse:null,extend:null,vid:0};let hk,lk,pk,gk,fk,Ek,Ik,mk,_k,Ck,vk,Sk,yk,Rk,Tk,wk,bk,Ok,Nk,Dk,Lk,kk,Pk;function Bk(e){return XL(e.timeout,"config.timeout",0,1e5),XL(e.timeoutFactor,"config.timeoutFactor",0,100,!1),XL(e.maxRetryCount,"config.maxRetryConfig",0,1/0),XL(e.maxRetryTimeout,"config.maxRetryTimeout",0,1/0),!0}function Mk(e){return zL(e.codec,"config.codec",["vp8","vp9","av1","h264"]),zL(e.mode,"config.mode",["rtc","live"]),void 0!==e.audioCodec&&zL(e.audioCodec,"config.audioCodec",["opus","pcmu","pcma","g722"]),void 0!==e.proxyServer&&ZL(e.proxyServer,"config.proxyServer",1,1e4),void 0!==e.turnServer&&Qk(e.turnServer),void 0!==e.httpRetryConfig&&Bk(e.httpRetryConfig),void 0!==e.websocketRetryConfig&&Bk(e.websocketRetryConfig),!0}function Uk(e){if(!Array.isArray(e)||e.length<1)return!1;try{e.forEach(e=>{if(!e.urls)throw Error()})}catch(e){return!1}return!0}function Qk(e){return ZL(e.turnServerURL,"turnServerURL"),ZL(e.username,"username"),ZL(e.password,"password"),e.udpport&&XL(e.udpport,"udpport",1,99999,!0),e.forceturn&&qL(e.forceturn,"forceturn"),e.security&&qL(e.security,"security"),e.tcpport&&XL(e.tcpport,"tcpport",1,99999,!0),!0}function xk(e){return void 0!==e.level&&zL(e.level,"level",[1,2,3]),!0}!function(e){e.PUBLISH="publish",e.SUBSCRIBE="subscribe",e.WS_COMPRESSOR_INIT="ws_compressor_init",e.SESSION_INIT="session_init",e.JOIN_CHOOSE_SERVER="join_choose_server",e.REQ_USER_ACCOUNT="req_user_account",e.JOIN_GATEWAY="join_gateway",e.REJOIN_GATEWAY="rejoin_gateway",e.STREAM_SWITCH="stream_switch",e.REQUEST_PROXY_WORKER_MANAGER="request_proxy_worker_manager",e.REQUEST_PROXY_APPCENTER="request_proxy_appcenter",e.FIRST_VIDEO_RECEIVED="first_video_received",e.FIRST_AUDIO_RECEIVED="first_audio_received",e.FIRST_VIDEO_DECODE="first_video_decode",e.FIRST_AUDIO_DECODE="first_audio_decode",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_UPDATE_STREAM="on_update_stream",e.ON_REMOVE_STREAM="on_remove_stream",e.USER_ANALYTICS="req_user_analytics"}(hk||(hk={})),function(e){e.SESSION="io.agora.pb.Wrtc.Session",e.JOIN_CHOOSE_SERVER="io.agora.pb.Wrtc.JoinChooseServer",e.REQ_USER_ACCOUNT="io.agora.pb.Wrtc.ReqUserAccount",e.JOIN_GATEWAT="io.agora.pb.Wrtc.JoinGateway",e.RE_JOIN_GATEWAY="io.agora.pb.Wrtc.ReJoinGateway",e.PUBLISH="io.agora.pb.Wrtc.Publish",e.SUBSCRIBE="io.agora.pb.Wrtc.Subscribe",e.WS_COMPRESSOR_INIT="io.agora.pb.Wrtc.WsCompressorInit",e.STREAM_SWITCH="io.agora.pb.Wrtc.StreamSwitch",e.AUDIO_SENDING_STOPPED="io.agora.pb.Wrtc.AudioSendingStopped",e.VIDEO_SENDING_STOPPED="io.agora.pb.Wrtc.VideoSendingStopped",e.REQUEST_PROXY_APPCENTER="io.agora.pb.Wrtc.RequestProxyAppCenter",e.REQUEST_PROXY_WORKER_MANAGER="io.agora.pb.Wrtc.RequestProxyWorkerManager",e.API_INVOKE="io.agora.pb.Wrtc.ApiInvoke",e.FIRST_VIDEO_RECEIVED="io.agora.pb.Wrtc.FirstVideoReceived",e.FIRST_AUDIO_RECEIVED="io.agora.pb.Wrtc.FirstAudioReceived",e.FIRST_VIDEO_DECODE="io.agora.pb.Wrtc.FirstVideoDecode",e.FIRST_AUDIO_DECODE="io.agora.pb.Wrtc.FirstAudioDecode",e.ON_ADD_AUDIO_STREAM="io.agora.pb.Wrtc.OnAddAudioStream",e.ON_ADD_VIDEO_STREAM="io.agora.pb.Wrtc.OnAddVideoStream",e.ON_UPDATE_STREAM="io.agora.pb.Wrtc.OnUpdateStream",e.ON_REMOVE_STREAM="io.agora.pb.Wrtc.OnRemoveStream",e.JOIN_CHANNEL_TIMEOUT="io.agora.pb.Wrtc.JoinChannelTimeout",e.PEER_PUBLISH_STATUS="io.agora.pb.Wrtc.PeerPublishStatus",e.WORKER_EVENT="io.agora.pb.Wrtc.WorkerEvent",e.AP_WORKER_EVENT="io.agora.pb.Wrtc.APWorkerEvent",e.JOIN_WEB_PROXY_AP="io.agora.pb.Wrtc.JoinWebProxyAP",e.WEBSOCKET_QUIT="io.agora.pb.Wrtc.WebSocketQuit",e.USER_ANALYTICS="io.agora.pb.Wrtc.UserAnalytics",e.AUTOPLAY_FAILED="io.agora.pb.Wrtc.AutoplayFailed"}(lk||(lk={})),function(e){e[e.WORKER_EVENT=156]="WORKER_EVENT",e[e.AP_WORKER_EVENT=160]="AP_WORKER_EVENT"}(pk||(pk={})),function(e){e.CREATE_CLIENT="createClient",e.CHECK_SYSTEM_REQUIREMENTS="checkSystemRequirements",e.SET_AREA="setArea",e.CHECK_VIDEO_TRACK_IS_ACTIVE="checkVideoTrackIsActive",e.CHECK_AUDIO_TRACK_IS_ACTIVE="checkAudioTrackIsActive",e.CREATE_MIC_AUDIO_TRACK="createMicrophoneAudioTrack",e.CREATE_CUSTOM_AUDIO_TRACK="createCustomAudioTrack",e.CREATE_BUFFER_AUDIO_TRACK="createBufferSourceAudioTrack",e.CREATE_CAM_VIDEO_TRACK="createCameraVideoTrack",e.CREATE_CUSTOM_VIDEO_TRACK="createCustomVideoTrack",e.CREATE_MIC_AND_CAM_TRACKS="createMicrophoneAndCameraTracks",e.CREATE_SCREEN_VIDEO_TRACK="createScreenVideoTrack",e.SET_ENCRYPTION_CONFIG="Client.setEncryptionConfig",e.START_PROXY_SERVER="Client.startProxyServer",e.STOP_PROXY_SERVER="Client.stopProxyServer",e.SET_PROXY_SERVER="Client.setProxyServer",e.SET_TURN_SERVER="Client.setTurnServer",e.SET_CLIENT_ROLE="Client.setClientRole",e.SET_LOW_STREAM_PARAMETER="Client.setLowStreamParameter",e.ENABLE_DUAL_STREAM="Client.enableDualStream",e.DISABLE_DUAL_STREAM="Client.disableDualStream",e.JOIN="Client.join",e.LEAVE="Client.leave",e.PUBLISH="Client.publish",e.UNPUBLISH="Client.unpublish",e.SUBSCRIBE="Client.subscribe",e.MASS_SUBSCRIBE="Client.massSubscribe",e.MASS_UNSUBSCRIBE="Client.massUnsubscribe",e.UNSUBSCRIBE="Client.unsubscribe",e.RENEW_TOKEN="Client.renewToken",e.SET_REMOTE_VIDEO_STREAM_TYPE="Client.setRemoteVideoStreamType",e.SET_STREAM_FALLBACK_OPTION="Client.setStreamFallbackOption",e.ENABLE_AUDIO_VOLUME_INDICATOR="Client.enableAudioVolumeIndicator",e.SEND_CUSTOM_REPORT_MESSAGE="Client.sendCustomReportMessage",e.JOIN_FALLBACK_TO_PROXY="Client._joinFallbackToProxy",e.ON_LIVE_STREAM_WARNING="Client.onLiveStreamWarning",e.ON_LIVE_STREAM_ERROR="Client.onLiveStreamingError",e.START_LIVE_STREAMING="Client.startLiveStreaming",e.SET_LIVE_TRANSCODING="Client.setLiveTranscoding",e.STOP_LIVE_STREAMING="Client.stopLiveStreaming",e.ADD_INJECT_STREAM_URL="Client.addInjectStreamUrl",e.REMOVE_INJECT_STREAM_URL="Client.removeInjectStreamUrl",e.START_CHANNEL_MEDIA_RELAY="Client.startChannelMediaRelay",e.UPDATE_CHANNEL_MEDIA_RELAY="Client.updateChannelMediaRelay",e.STOP_CHANNEL_MEDIA_RELAY="Client.stopChannelMediaRelay",e.REQUEST_CONFIG_DISTRIBUTE="_config-distribute-request",e.SET_CONFIG_DISTRIBUTE="_configDistribute",e.LOCAL_TRACK_SET_MUTED="LocalTrack.setMute",e.LOCAL_AUDIO_TRACK_PLAY="LocalAudioTrack.play",e.LOCAL_AUDIO_TRACK_PLAY_IN_ELEMENT="LocalAudioTrack.playInElement",e.LOCAL_AUDIO_TRACK_STOP="LocalAudioTrack.stop",e.LOCAL_AUDIO_TRACK_SET_VOLUME="LocalAudioTrack.setVolume",e.MIC_AUDIO_TRACK_SET_DEVICE="MicrophoneAudioTrack.setDevice",e.BUFFER_AUDIO_TRACK_START="BufferSourceAudioTrack.startProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_STOP="BufferSourceAudioTrack.stopProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_PAUSE="BufferSourceAudioTrack.pauseProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_RESUME="BufferSourceAudioTrack.resumeProcessAudioBuffer",e.BUFFER_AUDIO_TRACK_SEEK="BufferSourceAudioTrack.seekAudioBuffer",e.LOCAL_VIDEO_TRACK_PLAY="LocalVideoTrack.play",e.LOCAL_VIDEO_TRACK_STOP="LocalVideoTrack.stop",e.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE="LocalVideoTrack.getVideoElementVisibleStatus",e.LOCAL_VIDEO_TRACK_BEAUTY="LocalVideoTrack.setBeautyEffect",e.CAM_VIDEO_TRACK_SET_DEVICE="CameraVideoTrack.setDevice",e.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG="CameraVideoTrack.setEncoderConfiguration",e.REMOTE_VIDEO_TRACK_PLAY="RemoteVideoTrack.play",e.REMOTE_VIDEO_TRACK_STOP="RemoteVideoTrack.stop",e.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE="RemoteVideoTrack.getVideoElementVisibleStatus",e.REMOTE_AUDIO_TRACK_PLAY="RemoteAudioTrack.play",e.REMOTE_AUDIO_TRACK_STOP="RemoteAudioTrack.stop",e.REMOTE_AUDIO_SET_VOLUME="RemoteAudioTrack.setVolume",e.REMOTE_AUDIO_SET_OUTPUT_DEVICE="RemoteAudioTrack.setOutputDevice",e.GET_MEDIA_STREAM_TRACK="Track.getMediaStreamTrack",e.STREAM_TYPE_CHANGE="streamTypeChange",e.CONNECTION_STATE_CHANGE="connectionStateChange",e.LOAD_CONFIG_FROM_LOCALSTORAGE="loadConfigFromLocalStorage"}(gk||(gk={})),function(e){e.TRACER="tracer"}(fk||(fk={})),function(e){e.IDLE="IDLE",e.INITING="INITING",e.INITEND="INITEND"}(Ek||(Ek={})),function(e){e.STATE_CHANGE="state_change",e.RECORDING_DEVICE_CHANGED="recordingDeviceChanged",e.PLAYOUT_DEVICE_CHANGED="playoutDeviceChanged",e.CAMERA_DEVICE_CHANGED="cameraDeviceChanged"}(Ik||(Ik={})),function(e){e[e.ACCESS_POINT=101]="ACCESS_POINT",e[e.UNILBS=201]="UNILBS",e[e.STRING_UID_ALLOCATOR=901]="STRING_UID_ALLOCATOR"}(mk||(mk={})),function(e){e[e.IIIEGAL_APPID=1]="IIIEGAL_APPID",e[e.IIIEGAL_UID=2]="IIIEGAL_UID",e[e.INTERNAL_ERROR=3]="INTERNAL_ERROR"}(_k||(_k={})),function(e){e[e.INVALID_VENDOR_KEY=5]="INVALID_VENDOR_KEY",e[e.INVALID_CHANNEL_NAME=7]="INVALID_CHANNEL_NAME",e[e.INTERNAL_ERROR=8]="INTERNAL_ERROR",e[e.NO_AUTHORIZED=9]="NO_AUTHORIZED",e[e.DYNAMIC_KEY_TIMEOUT=10]="DYNAMIC_KEY_TIMEOUT",e[e.NO_ACTIVE_STATUS=11]="NO_ACTIVE_STATUS",e[e.DYNAMIC_KEY_EXPIRED=13]="DYNAMIC_KEY_EXPIRED",e[e.STATIC_USE_DYNAMIC_KEY=14]="STATIC_USE_DYNAMIC_KEY",e[e.DYNAMIC_USE_STATIC_KEY=15]="DYNAMIC_USE_STATIC_KEY",e[e.USER_OVERLOAD=16]="USER_OVERLOAD",e[e.FORBIDDEN_REGION=18]="FORBIDDEN_REGION",e[e.CANNOT_MEET_AREA_DEMAND=19]="CANNOT_MEET_AREA_DEMAND"}(Ck||(Ck={})),function(e){e[e.NO_FLAG_SET=100]="NO_FLAG_SET",e[e.FLAG_SET_BUT_EMPTY=101]="FLAG_SET_BUT_EMPTY",e[e.INVALID_FALG_SET=102]="INVALID_FALG_SET",e[e.FLAG_SET_BUT_NO_RE=103]="FLAG_SET_BUT_NO_RE",e[e.INVALID_SERVICE_ID=104]="INVALID_SERVICE_ID",e[e.NO_SERVICE_AVAILABLE=200]="NO_SERVICE_AVAILABLE",e[e.NO_SERVICE_AVAILABLE_P2P=201]="NO_SERVICE_AVAILABLE_P2P",e[e.NO_SERVICE_AVAILABLE_VOICE=202]="NO_SERVICE_AVAILABLE_VOICE",e[e.NO_SERVICE_AVAILABLE_WEBRTC=203]="NO_SERVICE_AVAILABLE_WEBRTC",e[e.NO_SERVICE_AVAILABLE_CDS=204]="NO_SERVICE_AVAILABLE_CDS",e[e.NO_SERVICE_AVAILABLE_CDN=205]="NO_SERVICE_AVAILABLE_CDN",e[e.NO_SERVICE_AVAILABLE_TDS=206]="NO_SERVICE_AVAILABLE_TDS",e[e.NO_SERVICE_AVAILABLE_REPORT=207]="NO_SERVICE_AVAILABLE_REPORT",e[e.NO_SERVICE_AVAILABLE_APP_CENTER=208]="NO_SERVICE_AVAILABLE_APP_CENTER",e[e.NO_SERVICE_AVAILABLE_ENV0=209]="NO_SERVICE_AVAILABLE_ENV0",e[e.NO_SERVICE_AVAILABLE_VOET=210]="NO_SERVICE_AVAILABLE_VOET",e[e.NO_SERVICE_AVAILABLE_STRING_UID=211]="NO_SERVICE_AVAILABLE_STRING_UID",e[e.NO_SERVICE_AVAILABLE_WEBRTC_UNILBS=212]="NO_SERVICE_AVAILABLE_WEBRTC_UNILBS",e[e.NO_SERVICE_AVAILABLE_UNILBS_FLV=213]="NO_SERVICE_AVAILABLE_UNILBS_FLV"}(vk||(vk={})),function(e){e[e.K_TIMESTAMP_EXPIRED=2]="K_TIMESTAMP_EXPIRED",e[e.K_CHANNEL_PERMISSION_INVALID=3]="K_CHANNEL_PERMISSION_INVALID",e[e.K_CERTIFICATE_INVALID=4]="K_CERTIFICATE_INVALID",e[e.K_CHANNEL_NAME_EMPTY=5]="K_CHANNEL_NAME_EMPTY",e[e.K_CHANNEL_NOT_FOUND=6]="K_CHANNEL_NOT_FOUND",e[e.K_TICKET_INVALID=7]="K_TICKET_INVALID",e[e.K_CHANNEL_CONFLICTED=8]="K_CHANNEL_CONFLICTED",e[e.K_SERVICE_NOT_READY=9]="K_SERVICE_NOT_READY",e[e.K_SERVICE_TOO_HEAVY=10]="K_SERVICE_TOO_HEAVY",e[e.K_UID_BANNED=14]="K_UID_BANNED",e[e.K_IP_BANNED=15]="K_IP_BANNED",e[e.K_CHANNEL_BANNED=16]="K_CHANNEL_BANNED",e[e.WARN_NO_AVAILABLE_CHANNEL=103]="WARN_NO_AVAILABLE_CHANNEL",e[e.WARN_LOOKUP_CHANNEL_TIMEOUT=104]="WARN_LOOKUP_CHANNEL_TIMEOUT",e[e.WARN_LOOKUP_CHANNEL_REJECTED=105]="WARN_LOOKUP_CHANNEL_REJECTED",e[e.WARN_OPEN_CHANNEL_TIMEOUT=106]="WARN_OPEN_CHANNEL_TIMEOUT",e[e.WARN_OPEN_CHANNEL_REJECTED=107]="WARN_OPEN_CHANNEL_REJECTED",e[e.WARN_REQUEST_DEFERRED=108]="WARN_REQUEST_DEFERRED",e[e.ERR_DYNAMIC_KEY_TIMEOUT=109]="ERR_DYNAMIC_KEY_TIMEOUT",e[e.ERR_NO_AUTHORIZED=110]="ERR_NO_AUTHORIZED",e[e.ERR_VOM_SERVICE_UNAVAILABLE=111]="ERR_VOM_SERVICE_UNAVAILABLE",e[e.ERR_NO_CHANNEL_AVAILABLE_CODE=112]="ERR_NO_CHANNEL_AVAILABLE_CODE",e[e.ERR_MASTER_VOCS_UNAVAILABLE=114]="ERR_MASTER_VOCS_UNAVAILABLE",e[e.ERR_INTERNAL_ERROR=115]="ERR_INTERNAL_ERROR",e[e.ERR_NO_ACTIVE_STATUS=116]="ERR_NO_ACTIVE_STATUS",e[e.ERR_INVALID_UID=117]="ERR_INVALID_UID",e[e.ERR_DYNAMIC_KEY_EXPIRED=118]="ERR_DYNAMIC_KEY_EXPIRED",e[e.ERR_STATIC_USE_DYANMIC_KE=119]="ERR_STATIC_USE_DYANMIC_KE",e[e.ERR_DYNAMIC_USE_STATIC_KE=120]="ERR_DYNAMIC_USE_STATIC_KE",e[e.ERR_NO_VOCS_AVAILABLE=2e3]="ERR_NO_VOCS_AVAILABLE",e[e.ERR_NO_VOS_AVAILABLE=2001]="ERR_NO_VOS_AVAILABLE",e[e.ERR_JOIN_CHANNEL_TIMEOUT=2002]="ERR_JOIN_CHANNEL_TIMEOUT",e[e.ERR_REPEAT_JOIN_CHANNEL=2003]="ERR_REPEAT_JOIN_CHANNEL",e[e.ERR_JOIN_BY_MULTI_IP=2004]="ERR_JOIN_BY_MULTI_IP",e[e.ERR_NOT_JOINED=2011]="ERR_NOT_JOINED",e[e.ERR_REPEAT_JOIN_REQUEST=2012]="ERR_REPEAT_JOIN_REQUEST",e[e.ERR_INVALID_VENDOR_KEY=2013]="ERR_INVALID_VENDOR_KEY",e[e.ERR_INVALID_CHANNEL_NAME=2014]="ERR_INVALID_CHANNEL_NAME",e[e.ERR_INVALID_STRINGUID=2015]="ERR_INVALID_STRINGUID",e[e.ERR_TOO_MANY_USERS=2016]="ERR_TOO_MANY_USERS",e[e.ERR_SET_CLIENT_ROLE_TIMEOUT=2017]="ERR_SET_CLIENT_ROLE_TIMEOUT",e[e.ERR_SET_CLIENT_ROLE_NO_PERMISSION=2018]="ERR_SET_CLIENT_ROLE_NO_PERMISSION",e[e.ERR_SET_CLIENT_ROLE_ALREADY_IN_USE=2019]="ERR_SET_CLIENT_ROLE_ALREADY_IN_USE",e[e.ERR_PUBLISH_REQUEST_INVALID=2020]="ERR_PUBLISH_REQUEST_INVALID",e[e.ERR_SUBSCRIBE_REQUEST_INVALID=2021]="ERR_SUBSCRIBE_REQUEST_INVALID",e[e.ERR_NOT_SUPPORTED_MESSAGE=2022]="ERR_NOT_SUPPORTED_MESSAGE",e[e.ERR_ILLEAGAL_PLUGIN=2023]="ERR_ILLEAGAL_PLUGIN",e[e.ERR_REJOIN_TOKEN_INVALID=2024]="ERR_REJOIN_TOKEN_INVALID",e[e.ERR_REJOIN_USER_NOT_JOINED=2025]="ERR_REJOIN_USER_NOT_JOINED",e[e.ERR_INVALID_OPTIONAL_INFO=2027]="ERR_INVALID_OPTIONAL_INFO",e[e.ILLEGAL_AES_PASSWORD=2028]="ILLEGAL_AES_PASSWORD",e[e.ILLEGAL_CLIENT_ROLE_LEVEL=2029]="ILLEGAL_CLIENT_ROLE_LEVEL",e[e.ERR_TOO_MANY_BROADCASTERS=2031]="ERR_TOO_MANY_BROADCASTERS",e[e.ERR_TOO_MANY_SUBSCRIBERS=2032]="ERR_TOO_MANY_SUBSCRIBERS",e[e.ERR_TEST_RECOVER=9e3]="ERR_TEST_RECOVER",e[e.ERR_TEST_TRYNEXT=9001]="ERR_TEST_TRYNEXT",e[e.ERR_TEST_RETRY=9002]="ERR_TEST_RETRY"}(Sk||(Sk={})),function(e){e[e.AUDIENCE_LEVEL_LOW_LATENCY=1]="AUDIENCE_LEVEL_LOW_LATENCY",e[e.AUDIENCE_LEVEL_ULTRA_LOW_LATENCY=2]="AUDIENCE_LEVEL_ULTRA_LOW_LATENCY",e[e.AUDIENCE_LEVEL_SYNC_LATENCY=3]="AUDIENCE_LEVEL_SYNC_LATENCY"}(yk||(yk={})),function(e){e.LEAVE="LEAVE",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.UID_BANNED="UID_BANNED",e.IP_BANNED="IP_BANNED",e.CHANNEL_BANNED="CHANNEL_BANNED",e.FALLBACK="FALLBACK"}(Rk||(Rk={})),function(e){e.CONNECTION_STATE_CHANGE="connection-state-change",e.MEDIA_RECONNECT_START="media-reconnect-start",e.MEDIA_RECONNECT_END="media-reconnect-end",e.IS_USING_CLOUD_PROXY="is-using-cloud-proxy",e.USER_JOINED="user-joined",e.USER_LEAVED="user-left",e.USER_PUBLISHED="user-published",e.USER_UNPUBLISHED="user-unpublished",e.USER_INFO_UPDATED="user-info-updated",e.CLIENT_BANNED="client-banned",e.CHANNEL_MEDIA_RELAY_STATE="channel-media-relay-state",e.CHANNEL_MEDIA_RELAY_EVENT="channel-media-relay-event",e.VOLUME_INDICATOR="volume-indicator",e.CRYPT_ERROR="crypt-error",e.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="token-privilege-will-expire",e.ON_TOKEN_PRIVILEGE_DID_EXPIRE="token-privilege-did-expire",e.NETWORK_QUALITY="network-quality",e.STREAM_TYPE_CHANGED="stream-type-changed",e.STREAM_FALLBACK="stream-fallback",e.RECEIVE_METADATA="receive-metadata",e.STREAM_MESSAGE="stream-message",e.LIVE_STREAMING_ERROR="live-streaming-error",e.LIVE_STREAMING_WARNING="live-streaming-warning",e.INJECT_STREAM_STATUS="stream-inject-status",e.EXCEPTION="exception",e.ERROR="error",e.P2P_LOST="p2p_lost",e.JOIN_FALLBACK_TO_PROXY="join-fallback-to-proxy",e.MEDIA_CONNECTION_TYPE_CHANGE="media-connection-type-change",e.PUBLISHED_USER_LIST="published-user-list"}(Tk||(Tk={})),function(e){e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.MULTI_IP="MULTI_IP",e.TIMEOUT="TIMEOUT",e.OFFLINE="OFFLINE",e.LEAVE="LEAVE",e.P2P_FAILED="P2P_FAILED",e.FALLBACK="FALLBACK"}(wk||(wk={})),function(e){e.CONNECTING="connecting",e.CONNECTED="connected",e.RECONNECTING="reconnecting",e.CLOSED="closed"}(bk||(bk={})),function(e){e.WS_CONNECTED="ws_connected",e.WS_RECONNECTING="ws_reconnecting",e.WS_CLOSED="ws_closed",e.WS_RECONNECT_WAITTING_FINISH="ws_reconnect_waitting_finish",e.WS_RECONNECT_CREATE_CONNECTION="ws_reconnect_create_connection",e.ON_BINARY_DATA="on_binary_data",e.REQUEST_RECOVER="request_recover",e.REQUEST_JOIN_INFO="request_join_info",e.REQUEST_REJOIN_INFO="req_rejoin_info",e.IS_P2P_DISCONNECTED="is_p2p_dis",e.DISCONNECT_P2P="dis_p2p",e.ABORT_P2P_EXECUTION="abort_p2p_execution",e.NEED_RENEW_SESSION="need-sid",e.REPORT_JOIN_GATEWAY="report_join_gateway",e.REQUEST_TIMEOUT="request_timeout",e.REQUEST_SUCCESS="request_success",e.JOIN_RESPONSE="join_response"}(Ok||(Ok={})),function(e){e.PING="ping",e.PING_BACK="ping_back",e.JOIN="join_v3",e.REJOIN="rejoin_v3",e.LEAVE="leave",e.SET_CLIENT_ROLE="set_client_role",e.PUBLISH="publish",e.UNPUBLISH="unpublish",e.SUBSCRIBE="subscribe",e.SUBSCRIBE_STREAMS="subscribe_streams",e.UNSUBSCRIBE="unsubscribe",e.UNSUBSCRIBE_STREAMS="unsubscribe_streams",e.SUBSCRIBE_CHANGE="subscribe_change",e.TRAFFIC_STATS="traffic_stats",e.RENEW_TOKEN="renew_token",e.SWITCH_VIDEO_STREAM="switch_video_stream",e.DEFAULT_VIDEO_STREAM="default_video_stream",e.SET_FALLBACK_OPTION="set_fallback_option",e.GATEWAY_INFO="gateway_info",e.CONTROL="control",e.SEND_METADATA="send_metadata",e.DATA_STREAM="data_stream",e.PICK_SVC_LAYER="pick_svc_layer",e.RESTART_ICE="restart_ice",e.CONNECT_PC="connect_pc",e.SET_VIDEO_PROFILE="set_video_profile"}(Nk||(Nk={})),function(e){e.PUBLISH_STATS="publish_stats",e.PUBLISH_RELATED_STATS="publish_related_stats",e.SUBSCRIBE_STATS="subscribe_stats",e.SUBSCRIBE_RELATED_STATS="subscribe_related_stats",e.WS_INFLATE_DATA_LENGTH="ws_inflate_data_length",e.DENOISER_STATS="denoiser_stats",e.TRANSPORT_STATS="transport_stats"}(Dk||(Dk={})),function(e){e.ON_USER_ONLINE="on_user_online",e.ON_USER_OFFLINE="on_user_offline",e.ON_STREAM_FALLBACK_UPDATE="on_stream_fallback_update",e.ON_PUBLISH_STREAM="on_publish_stream",e.ON_UPLINK_STATS="on_uplink_stats",e.ON_P2P_LOST="on_p2p_lost",e.ON_REMOVE_STREAM="on_remove_stream",e.ON_ADD_AUDIO_STREAM="on_add_audio_stream",e.ON_ADD_VIDEO_STREAM="on_add_video_stream",e.ON_TOKEN_PRIVILEGE_WILL_EXPIRE="on_token_privilege_will_expire",e.ON_TOKEN_PRIVILEGE_DID_EXPIRE="on_token_privilege_did_expire",e.ON_USER_BANNED="on_user_banned",e.ON_NOTIFICATION="on_notification",e.ON_CRYPT_ERROR="on_crypt_error",e.MUTE_AUDIO="mute_audio",e.MUTE_VIDEO="mute_video",e.UNMUTE_AUDIO="unmute_audio",e.UNMUTE_VIDEO="unmute_video",e.ON_P2P_OK="on_p2p_ok",e.RECEIVE_METADATA="receive_metadata",e.ON_DATA_STREAM="on_data_stream",e.ENABLE_LOCAL_VIDEO="enable_local_video",e.DISABLE_LOCAL_VIDEO="disable_local_video",e.ENABLE_LOCAL_AUDIO="enable_local_audio",e.DISABLE_LOCAL_AUDIO="disable_local_audio",e.ON_PUBLISHED_USER_LIST="on_published_user_list"}(Lk||(Lk={})),function(e){e.CONNECTION_STATE_CHANGE="CONNECTION_STATE_CHANGE",e.NEED_ANSWER="NEED_ANSWER",e.NEED_RENEGOTIATE="NEED_RENEGOTIATE",e.P2P_LOST="P2P_LOST",e.GATEWAY_P2P_LOST="GATEWAY_P2P_LOST",e.NEED_UNPUB="NEED_UNPUB",e.NEED_UNSUB="NEED_UNSUB",e.NEED_UPLOAD="NEED_UPLOAD",e.NEED_CONTROL="NEED_CONTROL",e.START_RECONNECT="START_RECONNECT",e.END_RECONNECT="END_RECONNECT",e.NEED_SIGNAL_RTT="NEED_SIGNAL_RTT"}(kk||(kk={})),function(e){e.AUDIO_SOURCE_STATE_CHANGE="audio_source_state_change",e.RECEIVE_TRACK_BUFFER="receive_track_buffer",e.ON_AUDIO_BUFFER="on_audio_buffer",e.UPDATE_SOURCE="update_source"}(Pk||(Pk={}));const Fk={sendVolumeLevel:0,sendBitrate:0,sendBytes:0,sendPackets:0,sendPacketsLost:0,currentPacketLossRate:0},Vk={sendBytes:0,sendBitrate:0,sendPackets:0,sendPacketsLost:0,sendResolutionHeight:0,sendResolutionWidth:0,captureResolutionHeight:0,captureResolutionWidth:0,targetSendBitrate:0,totalDuration:0,totalFreezeTime:0,currentPacketLossRate:0},jk={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveLevel:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1},Gk={uplinkNetworkQuality:0,downlinkNetworkQuality:0},Kk={transportDelay:0,end2EndDelay:0,receiveBitrate:0,receiveBytes:0,receiveDelay:0,receivePackets:0,receivePacketsLost:0,receiveResolutionHeight:0,receiveResolutionWidth:0,totalDuration:0,totalFreezeTime:0,freezeRate:0,packetLossRate:0,currentPacketLossRate:0,publishDuration:-1};let Hk,Yk,Wk;!function(e){e.CONNECTED="websocket:connected",e.RECONNECTING="websocket:reconnecting",e.WILL_RECONNECT="websocket:will_reconnect",e.CLOSED="websocket:closed",e.FAILED="websocket:failed",e.ON_MESSAGE="websocket:on_message",e.REQUEST_NEW_URLS="websocket:request_new_urls",e.RECONNECT_WAITTING_FINISH="websocket:reconnect_waitting_finish",e.RECONNECT_CREATE_CONNECTION="websocket:reconnect_create_connection"}(Hk||(Hk={})),function(e){e.TRANSCODE="mix_streaming",e.RAW="raw_streaming",e.INJECT="inject_streaming"}(Yk||(Yk={})),function(e){e[e.INJECT_STREAM_STATUS_START_SUCCESS=0]="INJECT_STREAM_STATUS_START_SUCCESS",e[e.INJECT_STREAM_STATUS_START_ALREADY_EXISTS=1]="INJECT_STREAM_STATUS_START_ALREADY_EXISTS",e[e.INJECT_STREAM_STATUS_START_UNAUTHORIZED=2]="INJECT_STREAM_STATUS_START_UNAUTHORIZED",e[e.INJECT_STREAM_STATUS_START_TIMEOUT=3]="INJECT_STREAM_STATUS_START_TIMEOUT",e[e.INJECT_STREAM_STATUS_START_FAILED=4]="INJECT_STREAM_STATUS_START_FAILED",e[e.INJECT_STREAM_STATUS_STOP_SUCCESS=5]="INJECT_STREAM_STATUS_STOP_SUCCESS",e[e.INJECT_STREAM_STATUS_STOP_NOT_FOUND=6]="INJECT_STREAM_STATUS_STOP_NOT_FOUND",e[e.INJECT_STREAM_STATUS_STOP_UNAUTHORIZED=7]="INJECT_STREAM_STATUS_STOP_UNAUTHORIZED",e[e.INJECT_STREAM_STATUS_STOP_TIMEOUT=8]="INJECT_STREAM_STATUS_STOP_TIMEOUT",e[e.INJECT_STREAM_STATUS_STOP_FAILED=9]="INJECT_STREAM_STATUS_STOP_FAILED",e[e.INJECT_STREAM_STATUS_BROKEN=10]="INJECT_STREAM_STATUS_BROKEN"}(Wk||(Wk={}));const Jk={alpha:1,height:640,width:360,x:0,y:0,zOrder:0,audioChannel:0},qk={x:0,y:0,width:160,height:160,zOrder:255,alpha:1};function zk(e,t){ZL(e.url,"".concat(t,".url"),1,1e3,!1),rk(e.x)||XL(e.x,"".concat(t,".x"),0,1e4),rk(e.y)||XL(e.y,"".concat(t,".y"),0,1e4),rk(e.width)||XL(e.width,"".concat(t,".width"),0,1e4),rk(e.height)||XL(e.height,"".concat(t,".height"),0,1e4),rk(e.zOrder)||XL(e.zOrder,"".concat(t,".zOrder"),0,255),rk(e.alpha)||XL(e.alpha,"".concat(t,".alpha"),0,1,!1)}const Xk={audioBitrate:48,audioChannels:1,audioSampleRate:48e3,backgroundColor:0,height:360,lowLatency:!1,videoBitrate:400,videoCodecProfile:100,videoCodecType:1,videoFrameRate:15,videoGop:30,width:640,images:[],userConfigs:[],userConfigExtraInfo:""},Zk={audioBitrate:48,audioChannels:2,audioVolume:100,audioSampleRate:48e3,height:0,width:0,videoBitrate:400,videoFramerate:15,videoGop:30};let $k,eP,tP,rP,iP,nP,oP,sP,aP,cP,dP,uP,AP,hP,lP,pP,gP,fP;function EP(e){if(!e.channelName)throw new eD($N.INVALID_PARAMS,"invalid channelName in info");if(!e.uid||"number"!=typeof e.uid)throw new eD($N.INVALID_PARAMS,"invalid uid in info, uid must be a number");return e.token&&ZL(e.token,"info.token",1,2047),tk(e.uid),ek(e.channelName),!0}function IP(e){return zL(e,"mediaSource",["screen","window","application"]),!0}!function(e){e.WARNING="@live_uap-warning",e.ERROR="@line_uap-error",e.PUBLISH_STREAM_STATUS="@live_uap-publish-status",e.INJECT_STREAM_STATUS="@live_uap-inject-status",e.WORKER_STATUS="@live_uap-worker-status",e.REQUEST_NEW_ADDRESS="@live_uap-request-address"}($k||($k={})),function(e){e.REQUEST_WORKER_MANAGER_LIST="@live_req_worker_manager"}(eP||(eP={})),function(e){e[e.LIVE_STREAM_RESPONSE_SUCCEED=200]="LIVE_STREAM_RESPONSE_SUCCEED",e[e.LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM=454]="LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM",e[e.LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR=450]="LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR",e[e.LIVE_STREAM_RESPONSE_BAD_STREAM=451]="LIVE_STREAM_RESPONSE_BAD_STREAM",e[e.LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR=400]="LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR",e[e.LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST=404]="LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST",e[e.LIVE_STREAM_RESPONSE_NOT_AUTHORIZED=456]="LIVE_STREAM_RESPONSE_NOT_AUTHORIZED",e[e.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE=457]="LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE",e[e.LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN=429]="LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN",e[e.LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH=452]="LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH",e[e.LIVE_STREAM_RESPONSE_NOT_SUPPORTED=453]="LIVE_STREAM_RESPONSE_NOT_SUPPORTED",e[e.LIVE_STREAM_RESPONSE_MAX_STREAM_NUM=455]="LIVE_STREAM_RESPONSE_MAX_STREAM_NUM",e[e.LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR=500]="LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR",e[e.LIVE_STREAM_RESPONSE_WORKER_LOST=501]="LIVE_STREAM_RESPONSE_WORKER_LOST",e[e.LIVE_STREAM_RESPONSE_RESOURCE_LIMIT=502]="LIVE_STREAM_RESPONSE_RESOURCE_LIMIT",e[e.LIVE_STREAM_RESPONSE_WORKER_QUIT=503]="LIVE_STREAM_RESPONSE_WORKER_QUIT",e[e.ERROR_FAIL_SEND_MESSAGE=504]="ERROR_FAIL_SEND_MESSAGE",e[e.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE=30]="PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE",e[e.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT=31]="PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT",e[e.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH=32]="PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH",e[e.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN=33]="PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN"}(tP||(tP={})),function(e){e.CONNECT_FAILED="connect failed",e.CONNECT_TIMEOUT="connect timeout",e.WS_DISCONNECTED="websocket disconnected",e.REQUEST_TIMEOUT="request timeout",e.REQUEST_FAILED="request failed",e.WAIT_STATUS_TIMEOUT="wait status timeout",e.WAIT_STATUS_ERROR="wait status error",e.BAD_STATE="bad state",e.WS_ABORT="ws abort",e.AP_REQUEST_TIMEOUT="AP request timeout",e.AP_JSON_PARSE_ERROR="AP json parse error",e.AP_REQUEST_ERROR="AP request error",e.AP_REQUEST_ABORT="AP request abort"}(rP||(rP={})),function(e){e[e.SetSdkProfile=0]="SetSdkProfile",e[e.SetSourceChannel=1]="SetSourceChannel",e[e.SetSourceUserId=2]="SetSourceUserId",e[e.SetDestChannel=3]="SetDestChannel",e[e.StartPacketTransfer=4]="StartPacketTransfer",e[e.StopPacketTransfer=5]="StopPacketTransfer",e[e.UpdateDestChannel=6]="UpdateDestChannel",e[e.Reconnect=7]="Reconnect",e[e.SetVideoProfile=8]="SetVideoProfile"}(iP||(iP={})),function(e){e.NETWORK_DISCONNECTED="NETWORK_DISCONNECTED",e.NETWORK_CONNECTED="NETWORK_CONNECTED",e.PACKET_JOINED_SRC_CHANNEL="PACKET_JOINED_SRC_CHANNEL",e.PACKET_JOINED_DEST_CHANNEL="PACKET_JOINED_DEST_CHANNEL",e.PACKET_SENT_TO_DEST_CHANNEL="PACKET_SENT_TO_DEST_CHANNEL",e.PACKET_RECEIVED_VIDEO_FROM_SRC="PACKET_RECEIVED_VIDEO_FROM_SRC",e.PACKET_RECEIVED_AUDIO_FROM_SRC="PACKET_RECEIVED_AUDIO_FROM_SRC",e.PACKET_UPDATE_DEST_CHANNEL="PACKET_UPDATE_DEST_CHANNEL",e.PACKET_UPDATE_DEST_CHANNEL_REFUSED="PACKET_UPDATE_DEST_CHANNEL_REFUSED",e.PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE="PACKET_UPDATE_DEST_CHANNEL_NOT_CHANGE"}(nP||(nP={})),function(e){e.RELAY_STATE_IDLE="RELAY_STATE_IDLE",e.RELAY_STATE_CONNECTING="RELAY_STATE_CONNECTING",e.RELAY_STATE_RUNNING="RELAY_STATE_RUNNING",e.RELAY_STATE_FAILURE="RELAY_STATE_FAILURE"}(oP||(oP={})),function(e){e.RELAY_OK="RELAY_OK",e.SERVER_CONNECTION_LOST="SERVER_CONNECTION_LOST",e.SRC_TOKEN_EXPIRED="SRC_TOKEN_EXPIRED",e.DEST_TOKEN_EXPIRED="DEST_TOKEN_EXPIRED"}(sP||(sP={})),function(e){e.High="high",e.Low="low",e.Audio="audio",e.Screen="screen",e.ScreenLow="screen_low"}(aP||(aP={})),function(e){e.DISCONNECT="disconnect",e.CONNECTION_STATE_CHANGE="connection-state-change",e.NETWORK_QUALITY="network-quality",e.STREAM_TYPE_CHANGE="stream-type-change",e.IS_P2P_DISCONNECTED="is-p2p-dis",e.DISCONNECT_P2P="dis-p2p",e.REQUEST_NEW_GATEWAY_LIST="req-gate-url",e.NEED_RENEW_SESSION="need-sid",e.REQUEST_P2P_CONNECTION_PARAMS="request-p2p-connection-params",e.JOIN_RESPONSE="join-response"}(cP||(cP={})),function(e){e[e.Nothing=0]="Nothing",e[e.Audio=1]="Audio",e[e.LwoVideo=2]="LwoVideo",e[e.Video=4]="Video",e[e.Data=8]="Data"}(dP||(dP={})),function(e){e.NEED_RENEGOTIATE="@need_renegotiate",e.NEED_REPLACE_TRACK="@need_replace_track",e.NEED_CLOSE="@need_close",e.NEED_ENABLE_TRACK="@need_enable_track",e.NEED_DISABLE_TRACK="@need_disable_track",e.NEED_SESSION_ID="@need_sid",e.SET_OPTIMIZATION_MODE="@set_optimization_mode",e.GET_STATS="@get_stats",e.GET_LOW_VIDEO_TRACK="@get_low_video_track",e.NEED_RESET_REMOTE_SDP="@need_reset_remote_sdp",e.NEED_UPDATE_VIDEO_ENCODER="@need_update_video_encoder",e.NEED_MUTE_TRACK="@need_mute_track",e.NEED_UNMUTE_TRACK="@need_unmute_track"}(uP||(uP={})),function(e){e.SCREEN_TRACK="screen_track",e.LOW_STREAM="low_stream"}(AP||(AP={})),function(e){e[e.HIGH_STREAM=0]="HIGH_STREAM",e[e.LOW_STREAM=1]="LOW_STREAM"}(hP||(hP={})),function(e){e[e.DISABLE=0]="DISABLE",e[e.LOW_STREAM=1]="LOW_STREAM",e[e.AUDIO_ONLY=2]="AUDIO_ONLY"}(lP||(lP={})),function(e){e.SOURCE_STATE_CHANGE="source-state-change",e.TRACK_ENDED="track-ended",e.BEAUTY_EFFECT_OVERLOAD="beauty-effect-overload",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status",e.CLOSED="closed"}(pP||(pP={})),function(e){e.FIRST_FRAME_DECODED="first-frame-decoded",e.VIDEO_ELEMENT_VISIBLE_STATUS="video-element-visible-status"}(gP||(gP={})),function(e){e.CHINA="CHINA",e.ASIA="ASIA",e.NORTH_AMERICA="NORTH_AMERICA",e.EUROPE="EUROPE",e.JAPAN="JAPAN",e.INDIA="INDIA",e.KOREA="KOREA",e.HKMC="HKMC",e.US="US",e.OCEANIA="OCEANIA",e.SOUTH_AMERICA="SOUTH_AMERICA",e.AFRICA="AFRICA",e.OVERSEA="OVERSEA",e.GLOBAL="GLOBAL"}(fP||(fP={}));const mP=[fP.AFRICA,fP.ASIA,fP.CHINA,fP.EUROPE,fP.GLOBAL,fP.INDIA,fP.JAPAN,fP.NORTH_AMERICA,fP.OCEANIA,fP.OVERSEA,fP.SOUTH_AMERICA];let _P;!function(e){e.CHINA="CN",e.ASIA="AS",e.NORTH_AMERICA="NA",e.EUROPE="EU",e.JAPAN="JP",e.INDIA="IN",e.KOREA="KR",e.HKMC="HK",e.US="US",e.OCEANIA="OC",e.SOUTH_AMERICA="SA",e.AFRICA="AF",e.OVERSEA="OVERSEA",e.GLOBAL="GLOBAL"}(_P||(_P={}));const CP={CHINA:{},ASIA:{CODE:_P.ASIA,WEBCS_DOMAIN:["ap-web-1-asia.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-asia.agora.io"],PROXY_CS:["proxy-ap-web-asia.agora.io"],CDS_AP:["cds-ap-web-asia.agora.io","cds-ap-web-asia2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-asia.agora.io","sua-ap-web-asia2.agora.io"],UAP_AP:["uap-ap-web-asia.agora.io","uap-ap-web-asia2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-asia.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-asia.agora.io"],LOG_UPLOAD_SERVER:["logservice-asia.agora.io"],PROXY_SERVER_TYPE3:["southeast-asia.webrtc-cloud-proxy.sd-rtn.com"]},NORTH_AMERICA:{CODE:_P.NORTH_AMERICA,WEBCS_DOMAIN:["ap-web-1-north-america.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-north-america.agora.io"],PROXY_CS:["proxy-ap-web-america.agora.io"],CDS_AP:["cds-ap-web-america.agora.io","cds-ap-web-america2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-america.agora.io","sua-ap-web-america2.agora.io"],UAP_AP:["uap-ap-web-america.agora.io","uap-ap-web-america2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-north-america.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-north-america.agora.io"],LOG_UPLOAD_SERVER:["logservice-north-america.agora.io"],PROXY_SERVER_TYPE3:["east-usa.webrtc-cloud-proxy.sd-rtn.com"]},EUROPE:{CODE:_P.EUROPE,WEBCS_DOMAIN:["ap-web-1-europe.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-europe.agora.io"],PROXY_CS:["proxy-ap-web-europe.agora.io"],CDS_AP:["cds-ap-web-europe.agora.io","cds-ap-web-europe2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-europe.agora.io","sua-ap-web-europe.agora.io"],UAP_AP:["uap-ap-web-europe.agora.io","uap-ap-web-europe2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-europe.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-europe.agora.io"],LOG_UPLOAD_SERVER:["logservice-europe.agora.io"],PROXY_SERVER_TYPE3:["europe.webrtc-cloud-proxy.sd-rtn.com"]},JAPAN:{CODE:_P.JAPAN,WEBCS_DOMAIN:["ap-web-1-japan.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-japan.agora.io"],PROXY_CS:["proxy-ap-web-japan.agora.io"],CDS_AP:["cds-ap-web-japan.agora.io","cds-ap-web-japan2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-japan.agora.io","sua-ap-web-japan2.agora.io"],UAP_AP:["uap-ap-web-japan.agora.io","\tuap-ap-web-japan2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-japan.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-japan.agora.io"],LOG_UPLOAD_SERVER:["logservice-japan.agora.io"],PROXY_SERVER_TYPE3:["japan.webrtc-cloud-proxy.sd-rtn.com"]},INDIA:{CODE:_P.INDIA,WEBCS_DOMAIN:["ap-web-1-india.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-india.agora.io"],PROXY_CS:["proxy-ap-web-india.agora.io"],CDS_AP:["cds-ap-web-india.agora.io","cds-ap-web-india2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-india.agora.io","sua-ap-web-india2.agora.io"],UAP_AP:["uap-ap-web-india.agora.io","uap-ap-web-india2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-india.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-india.agora.io"],LOG_UPLOAD_SERVER:["logservice-india.agora.io"],PROXY_SERVER_TYPE3:["india.webrtc-cloud-proxy.sd-rtn.com"]},KOREA:{CODE:_P.KOREA,WEBCS_DOMAIN:["ap-web-1-korea.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-korea.agora.io"],PROXY_CS:["proxy-ap-web-korea.agora.io"],CDS_AP:["cds-ap-web-korea.agora.io","cds-ap-web-korea2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-korea.agora.io","sua-ap-web-korea2.agora.io"],UAP_AP:["uap-ap-web-korea.agora.io","uap-ap-web-korea2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-korea.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-korea.agora.io"],LOG_UPLOAD_SERVER:["logservice-korea.agora.io"],PROXY_SERVER_TYPE3:["korea.webrtc-cloud-proxy.sd-rtn.com"]},HKMC:{CODE:_P.HKMC,WEBCS_DOMAIN:["ap-web-1-hkmc.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-hkmc.agora.io"],PROXY_CS:["proxy-ap-web-hkmc.agora.io"],CDS_AP:["cds-ap-web-hkmc.agora.io","cds-ap-web-hkmc2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-hkmc.agora.io","sua-ap-web-hkmc2.agora.io"],UAP_AP:["uap-ap-web-hkmc.agora.io","uap-ap-web-hkmc2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-hkmc.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-hkmc.agora.io"],LOG_UPLOAD_SERVER:["logservice-hkmc.agora.io"],PROXY_SERVER_TYPE3:["hkmc.webrtc-cloud-proxy.sd-rtn.com"]},US:{CODE:_P.US,WEBCS_DOMAIN:["ap-web-1-us.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-us.agora.io"],PROXY_CS:["proxy-ap-web-us.agora.io"],CDS_AP:["cds-ap-web-us.agora.io","cds-ap-web-us2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-us.agora.io","sua-ap-web-us2.agora.io"],UAP_AP:["uap-ap-web-us.agora.io","uap-ap-web-us2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-us.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-us.agora.io"],LOG_UPLOAD_SERVER:["logservice-us.agora.io"],PROXY_SERVER_TYPE3:["us.webrtc-cloud-proxy.sd-rtn.com"]},OVERSEA:{CODE:_P.OVERSEA,WEBCS_DOMAIN:["ap-web-1-oversea.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-oversea.agora.io"],PROXY_CS:["proxy-ap-web-oversea.agora.io"],CDS_AP:["cds-ap-web-oversea.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-oversea.agora.io"],UAP_AP:["uap-ap-web-oversea.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-oversea.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-oversea.agora.io"],LOG_UPLOAD_SERVER:["logservice-oversea.agora.io"],PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.agora.io"]},GLOBAL:{CODE:_P.GLOBAL,WEBCS_DOMAIN:["webrtc2-ap-web-1.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-ap-web-3.agora.io"],PROXY_CS:["ap-proxy-1.agora.io","ap-proxy-2.agora.io"],CDS_AP:["cds-ap-web-1.agora.io","cds-ap-web-3.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-1.agora.io","sua-ap-web-3.agora.io"],UAP_AP:["uap-ap-web-1.agora.io","uap-ap-web-3.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2.agora.io"],LOG_UPLOAD_SERVER:["logservice.agora.io"],PROXY_SERVER_TYPE3:["webrtc-cloud-proxy.sd-rtn.com"]},OCEANIA:{CODE:_P.OCEANIA,WEBCS_DOMAIN:["ap-web-1-oceania.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-oceania.agora.io"],PROXY_CS:["proxy-ap-web-oceania.agora.io"],CDS_AP:["cds-ap-web-oceania.agora.io","cds-ap-web-oceania2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-oceania.agora.io","sua-ap-web-oceania2.agora.io"],UAP_AP:["uap-ap-web-oceania.agora.io","uap-ap-web-oceania2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-oceania.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-oceania.agora.io"],LOG_UPLOAD_SERVER:["logservice-oceania.agora.io"],PROXY_SERVER_TYPE3:["oceania.webrtc-cloud-proxy.sd-rtn.com"]},SOUTH_AMERICA:{CODE:_P.SOUTH_AMERICA,WEBCS_DOMAIN:["ap-web-1-south-america.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-south-america.agora.io"],PROXY_CS:["proxy-ap-web-south-america.agora.io"],CDS_AP:["cds-ap-web-south-america.agora.io","cds-ap-web-south-america2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-south-america.agora.io","sua-ap-web-south-america2.agora.io"],UAP_AP:["uap-ap-web-south-america.agora.io","uap-ap-web-south-america2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-south-america.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-south-america.agora.io"],LOG_UPLOAD_SERVER:["logservice-south-america.agora.io"],PROXY_SERVER_TYPE3:["south-america.webrtc-cloud-proxy.sd-rtn.com"]},AFRICA:{CODE:_P.AFRICA,WEBCS_DOMAIN:["ap-web-1-africa.agora.io"],WEBCS_DOMAIN_BACKUP_LIST:["ap-web-2-africa.agora.io"],PROXY_CS:["proxy-ap-web-africa.agora.io"],CDS_AP:["cds-ap-web-africa.agora.io","cds-ap-web-africa2.agora.io"],ACCOUNT_REGISTER:["sua-ap-web-africa.agora.io","sua-ap-web-africa2.agora.io"],UAP_AP:["uap-ap-web-africa.agora.io","uap-ap-web-africa2.agora.io"],EVENT_REPORT_DOMAIN:["statscollector-1-africa.agora.io"],EVENT_REPORT_BACKUP_DOMAIN:["statscollector-2-africa.agora.io"],LOG_UPLOAD_SERVER:["logservice-south-africa.agora.io"],PROXY_SERVER_TYPE3:["africa.webrtc-cloud-proxy.sd-rtn.com"]}};let vP,SP,yP,RP,TP,wP,bP,OP;MD&&(CP.CHINA={CODE:_P.CHINA,WEBCS_DOMAIN:["webrtc2-2.ap.sd-rtn.com"],WEBCS_DOMAIN_BACKUP_LIST:["webrtc2-4.ap.sd-rtn.com"],PROXY_CS:["proxy-web.ap.sd-rtn.com"],CDS_AP:["cds-web-2.ap.sd-rtn.com","cds-web-4.ap.sd-rtn.com"],ACCOUNT_REGISTER:["sua-web-2.ap.sd-rtn.com","sua-web-4.ap.sd-rtn.com"],UAP_AP:["uap-web-2.ap.sd-rtn.com","uap-web-4.ap.sd-rtn.com"],EVENT_REPORT_DOMAIN:["web-3.statscollector.sd-rtn.com"],EVENT_REPORT_BACKUP_DOMAIN:["web-4.statscollector.sd-rtn.com"],LOG_UPLOAD_SERVER:["logservice-china.agora.io"],PROXY_SERVER_TYPE3:["east-cn.webrtc-cloud-proxy.sd-rtn.com"]}),function(e){e.UPDATE_BITRATE_LIMIT="update_bitrate_limit"}(vP||(vP={}));class NP extends XN{constructor(e,t){super(),kO(this,"onICEConnectionStateChange",void 0),kO(this,"onConnectionStateChange",void 0),kO(this,"onDTLSTransportStateChange",void 0),kO(this,"onDTLSTransportError",void 0),kO(this,"onICETransportStateChange",void 0),kO(this,"onFirstAudioReceived",void 0),kO(this,"onFirstVideoReceived",void 0),kO(this,"onFirstAudioDecoded",void 0),kO(this,"onFirstVideoDecoded",void 0),kO(this,"onSelectedLocalCandidateChanged",void 0),kO(this,"onSelectedRemoteCandidateChanged",void 0)}}!function(e){e.SEND="sendonly",e.RECV="recvonly",e.SENDRECV="sendrecv",e.INACTIVE="inactive"}(SP||(SP={})),function(e){e.VIDEO="video",e.AUDIO="audio"}(yP||(yP={})),function(e){e.LocalVideoTrack="videoTrack",e.LocalAudioTrack="audioTrack",e.LocalVideoLowTrack="videoLowTrack"}(RP||(RP={})),function(e){e.New="new",e.Connected="connected",e.Reconnecting="reconnecting",e.Disconnected="disconnected"}(TP||(TP={})),function(e){e.StateChange="stateChange",e.IceConnectionStateChange="iceConnectionStateChange",e.RequestMuteLocal="requestMuteLocal",e.RequestUnmuteLocal="requestUnmuteLocal",e.RequestRePublish="requestRePublish",e.RequestReSubscribe="requestReSubscribe",e.RequestUploadStats="requestUploadStats",e.MediaReconnectStart="MediaReconnectStart",e.MediaReconnectEnd="MediaReconnectEnd",e.NeedSignalRTT="NeedSignalRTT",e.RequestRestartICE="RequestRestartIce",e.PeerConnectionStateChange="PeerConnectionStateChange",e.RequestReconnect="RequestReconnect",e.RequestReconnectPC="RequestReconnectPC",e.RequestUnpublishForReconnectPC="RequestUnpublishForReconnectPC",e.P2PLost="P2PLost",e.UpdateVideoEncoder="UpdateVideoEncoder",e.ConnectionTypeChange="ConnectionTypeChange"}(wP||(wP={})),function(e){e.ONLINE="ONLINE",e.OFFLINE="OFFLINE"}(bP||(bP={})),function(e){e.NETWORK_STATE_CHANGE="NETWORK_STATE_CHANGE",e.ONLINE="ONLINE",e.OFFLINE="OFFLINE"}(OP||(OP={}));const DP={join:["startJoin","startRequestAp","startJoinGateway","finishJoin"],publish:["startPublish"]};let LP,kP;!function(e){e.ON_TRACK="on_track",e.ON_NODE="on_node"}(LP||(LP={})),function(e){e.REQUEST_UPDATE_CONSTRAINTS="request_update_constraints",e.REQUEST_CONSTRAINTS="request_constraints"}(kP||(kP={}));const PP={getDisplayMedia:!1,getStreamFromExtension:!1,supportUnifiedPlan:!1,supportMinBitrate:!1,supportSetRtpSenderParameters:!1,supportDualStream:!0,webAudioMediaStreamDest:!1,supportReplaceTrack:!1,supportWebGL:!1,webAudioWithAEC:!1,supportRequestFrame:!1,supportShareAudio:!1,supportDualStreamEncoding:!1};function BP(){return PP}var MP="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,UP=Hr,QP=Zr,xP=r.RangeError,FP=function(e){if(void 0===e)return 0;var t=UP(e),r=QP(t);if(t!==r)throw xP("Wrong length or index");return r},VP=r.Array,jP=Math.abs,GP=Math.pow,KP=Math.floor,HP=Math.log,YP=Math.LN2,WP={pack:function(e,t,r){var i,n,o,s=VP(r),a=8*r-t-1,c=(1<<a)-1,d=c>>1,u=23===t?GP(2,-24)-GP(2,-77):0,A=e<0||0===e&&1/e<0?1:0,h=0;for((e=jP(e))!=e||e===1/0?(n=e!=e?1:0,i=c):(i=KP(HP(e)/YP),e*(o=GP(2,-i))<1&&(i--,o*=2),(e+=i+d>=1?u/o:u*GP(2,1-d))*o>=2&&(i++,o/=2),i+d>=c?(n=0,i=c):i+d>=1?(n=(e*o-1)*GP(2,t),i+=d):(n=e*GP(2,d-1)*GP(2,t),i=0));t>=8;)s[h++]=255&n,n/=256,t-=8;for(i=i<<t|n,a+=t;a>0;)s[h++]=255&i,i/=256,a-=8;return s[--h]|=128*A,s},unpack:function(e,t){var r,i=e.length,n=8*i-t-1,o=(1<<n)-1,s=o>>1,a=n-7,c=i-1,d=e[c--],u=127&d;for(d>>=7;a>0;)u=256*u+e[c--],a-=8;for(r=u&(1<<-a)-1,u>>=-a,a+=t;a>0;)r=256*r+e[c--],a-=8;if(0===u)u=1-s;else{if(u===o)return r?NaN:d?-1/0:1/0;r+=GP(2,t),u-=s}return(d?-1:1)*r*GP(2,u-t)}},JP=Le,qP=qr,zP=ei,XP=ct,ZP=yt,$P=f,eB=qr,tB=ei,rB=function(e,t,r){var i=XP(t);i in e?ZP.f(e,i,$P(0,r)):e[i]=r},iB=r.Array,nB=Math.max,oB=function(e,t,r){for(var i=tB(e),n=eB(t,i),o=eB(void 0===r?i:r,i),s=iB(nB(o-n,0)),a=0;n<o;n++,a++)rB(s,a,e[n]);return s.length=a,s},sB=r,aB=v,cB=o,dB=MP,uB=Dr,AB=Kt,hB=Yi,lB=n,pB=ln,gB=Hr,fB=Zr,EB=FP,IB=WP,mB=Hl,_B=en,CB=jr.f,vB=yt.f,SB=function(e){for(var t=JP(this),r=zP(t),i=arguments.length,n=qP(i>1?arguments[1]:void 0,r),o=i>2?arguments[2]:void 0,s=void 0===o?r:qP(o,r);s>n;)t[n++]=e;return t},yB=oB,RB=on,TB=uB.PROPER,wB=uB.CONFIGURABLE,bB=Rr.get,OB=Rr.set,NB="ArrayBuffer",DB="DataView",LB="Wrong index",kB=sB.ArrayBuffer,PB=kB,BB=PB&&PB.prototype,MB=sB.DataView,UB=MB&&MB.prototype,QB=Object.prototype,xB=sB.Array,FB=sB.RangeError,VB=aB(SB),jB=aB([].reverse),GB=IB.pack,KB=IB.unpack,HB=function(e){return[255&e]},YB=function(e){return[255&e,e>>8&255]},WB=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},JB=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},qB=function(e){return GB(e,23,4)},zB=function(e){return GB(e,52,8)},XB=function(e,t){vB(e.prototype,t,{get:function(){return bB(this)[t]}})},ZB=function(e,t,r,i){var n=EB(r),o=bB(e);if(n+t>o.byteLength)throw FB(LB);var s=bB(o.buffer).bytes,a=n+o.byteOffset,c=yB(s,a,a+t);return i?c:jB(c)},$B=function(e,t,r,i,n,o){var s=EB(r),a=bB(e);if(s+t>a.byteLength)throw FB(LB);for(var c=bB(a.buffer).bytes,d=s+a.byteOffset,u=i(+n),A=0;A<t;A++)c[d+A]=u[o?A:t-A-1]};if(dB){var eM=TB&&kB.name!==NB;if(lB((function(){kB(1)}))&&lB((function(){new kB(-1)}))&&!lB((function(){return new kB,new kB(1.5),new kB(NaN),eM&&!wB})))eM&&wB&&AB(kB,"name",NB);else{(PB=function(e){return pB(this,BB),new kB(EB(e))}).prototype=BB;for(var tM,rM=CB(kB),iM=0;rM.length>iM;)(tM=rM[iM++])in PB||AB(PB,tM,kB[tM]);BB.constructor=PB}_B&&mB(UB)!==QB&&_B(UB,QB);var nM=new MB(new PB(2)),oM=aB(UB.setInt8);nM.setInt8(0,2147483648),nM.setInt8(1,2147483649),!nM.getInt8(0)&&nM.getInt8(1)||hB(UB,{setInt8:function(e,t){oM(this,e,t<<24>>24)},setUint8:function(e,t){oM(this,e,t<<24>>24)}},{unsafe:!0})}else BB=(PB=function(e){pB(this,BB);var t=EB(e);OB(this,{bytes:VB(xB(t),0),byteLength:t}),cB||(this.byteLength=t)}).prototype,UB=(MB=function(e,t,r){pB(this,UB),pB(e,BB);var i=bB(e).byteLength,n=gB(t);if(n<0||n>i)throw FB("Wrong offset");if(n+(r=void 0===r?i-n:fB(r))>i)throw FB("Wrong length");OB(this,{buffer:e,byteLength:r,byteOffset:n}),cB||(this.buffer=e,this.byteLength=r,this.byteOffset=n)}).prototype,cB&&(XB(PB,"byteLength"),XB(MB,"buffer"),XB(MB,"byteLength"),XB(MB,"byteOffset")),hB(UB,{getInt8:function(e){return ZB(this,1,e)[0]<<24>>24},getUint8:function(e){return ZB(this,1,e)[0]},getInt16:function(e){var t=ZB(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=ZB(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return JB(ZB(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return JB(ZB(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return KB(ZB(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return KB(ZB(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){$B(this,1,e,HB,t)},setUint8:function(e,t){$B(this,1,e,HB,t)},setInt16:function(e,t){$B(this,2,e,YB,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){$B(this,2,e,YB,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){$B(this,4,e,WB,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){$B(this,4,e,WB,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){$B(this,4,e,qB,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){$B(this,8,e,zB,t,arguments.length>2?arguments[2]:void 0)}});RB(PB,NB),RB(MB,DB);var sM={ArrayBuffer:PB,DataView:MB},aM=Gi,cM=v,dM=n,uM=Nt,AM=qr,hM=Zr,lM=Uo,pM=sM.ArrayBuffer,gM=sM.DataView,fM=gM.prototype,EM=cM(pM.prototype.slice),IM=cM(fM.getUint8),mM=cM(fM.setUint8);aM({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:dM((function(){return!new pM(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(EM&&void 0===t)return EM(uM(this),e);for(var r=uM(this).byteLength,i=AM(e,r),n=AM(void 0===t?r:t,r),o=new(lM(this,pM))(hM(n-i)),s=new gM(this),a=new gM(o),c=0;i<n;)mM(a,c++,IM(s,i++));return o}});var _M,CM,vM,SM={exports:{}},yM=MP,RM=o,TM=r,wM=Q,bM=F,OM=Be,NM=Dn,DM=Ae,LM=Kt,kM=Ht.exports,PM=yt.f,BM=H,MM=Hl,UM=en,QM=Xe,xM=Fe,FM=TM.Int8Array,VM=FM&&FM.prototype,jM=TM.Uint8ClampedArray,GM=jM&&jM.prototype,KM=FM&&MM(FM),HM=VM&&MM(VM),YM=Object.prototype,WM=TM.TypeError,JM=QM("toStringTag"),qM=xM("TYPED_ARRAY_TAG"),zM=xM("TYPED_ARRAY_CONSTRUCTOR"),XM=yM&&!!UM&&"Opera"!==NM(TM.opera),ZM=!1,$M={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},eU={BigInt64Array:8,BigUint64Array:8},tU=function(e){if(!bM(e))return!1;var t=NM(e);return OM($M,t)||OM(eU,t)};for(_M in $M)(vM=(CM=TM[_M])&&CM.prototype)?LM(vM,zM,CM):XM=!1;for(_M in eU)(vM=(CM=TM[_M])&&CM.prototype)&&LM(vM,zM,CM);if((!XM||!wM(KM)||KM===Function.prototype)&&(KM=function(){throw WM("Incorrect invocation")},XM))for(_M in $M)TM[_M]&&UM(TM[_M],KM);if((!XM||!HM||HM===YM)&&(HM=KM.prototype,XM))for(_M in $M)TM[_M]&&UM(TM[_M].prototype,HM);if(XM&&MM(GM)!==HM&&UM(GM,HM),RM&&!OM(HM,JM))for(_M in ZM=!0,PM(HM,JM,{get:function(){return bM(this)?this[qM]:void 0}}),$M)TM[_M]&&LM(TM[_M],qM,_M);var rU={NATIVE_ARRAY_BUFFER_VIEWS:XM,TYPED_ARRAY_CONSTRUCTOR:zM,TYPED_ARRAY_TAG:ZM&&qM,aTypedArray:function(e){if(tU(e))return e;throw WM("Target is not a typed array")},aTypedArrayConstructor:function(e){if(wM(e)&&(!UM||BM(KM,e)))return e;throw WM(DM(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,i){if(RM){if(r)for(var n in $M){var o=TM[n];if(o&&OM(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}HM[e]&&!r||kM(HM,e,r?t:XM&&VM[e]||t,i)}},exportTypedArrayStaticMethod:function(e,t,r){var i,n;if(RM){if(UM){if(r)for(i in $M)if((n=TM[i])&&OM(n,e))try{delete n[e]}catch(e){}if(KM[e]&&!r)return;try{return kM(KM,e,r?t:XM&&KM[e]||t)}catch(e){}}for(i in $M)!(n=TM[i])||n[e]&&!r||kM(n,e,t)}},isView:function(e){if(!bM(e))return!1;var t=NM(e);return"DataView"===t||OM($M,t)||OM(eU,t)},isTypedArray:tU,TypedArray:KM,TypedArrayPrototype:HM},iU=r,nU=n,oU=Ao,sU=rU.NATIVE_ARRAY_BUFFER_VIEWS,aU=iU.ArrayBuffer,cU=iU.Int8Array,dU=!sU||!nU((function(){cU(1)}))||!nU((function(){new cU(-1)}))||!oU((function(e){new cU,new cU(null),new cU(1.5),new cU(e)}),!0)||nU((function(){return 1!==new cU(new aU(2),1,void 0).length})),uU=F,AU=Math.floor,hU=Number.isInteger||function(e){return!uU(e)&&isFinite(e)&&AU(e)===e},lU=Hr,pU=r.RangeError,gU=function(e){var t=lU(e);if(t<0)throw pU("The argument can't be less than 0");return t},fU=r.RangeError,EU=function(e,t){var r=gU(e);if(r%t)throw fU("Wrong offset");return r},IU=En,mU=d,_U=ko,CU=Le,vU=ei,SU=Gn,yU=Mn,RU=vn,TU=rU.aTypedArrayConstructor,wU=T,bU=r,OU=Array.isArray||function(e){return"Array"==wU(e)},NU=Oo,DU=F,LU=Xe("species"),kU=bU.Array,PU=function(e){var t;return OU(e)&&(t=e.constructor,(NU(t)&&(t===kU||OU(t.prototype))||DU(t)&&null===(t=t[LU]))&&(t=void 0)),void 0===t?kU:t},BU=En,MU=L,UU=Le,QU=ei,xU=function(e,t){return new(PU(e))(0===t?0:t)},FU=v([].push),VU=function(e){var t=1==e,r=2==e,i=3==e,n=4==e,o=6==e,s=7==e,a=5==e||o;return function(c,d,u,A){for(var h,l,p=UU(c),g=MU(p),f=BU(d,u),E=QU(g),I=0,m=A||xU,_=t?m(c,E):r||s?m(c,0):void 0;E>I;I++)if((a||I in g)&&(l=f(h=g[I],I,p),e))if(t)_[I]=l;else if(l)switch(e){case 3:return!0;case 5:return h;case 6:return I;case 2:FU(_,h)}else switch(e){case 4:return!1;case 7:FU(_,h)}return o?-1:i||n?n:_}},jU={forEach:VU(0),map:VU(1),filter:VU(2),some:VU(3),every:VU(4),find:VU(5),findIndex:VU(6),filterReject:VU(7)},GU=Gi,KU=r,HU=d,YU=o,WU=dU,JU=rU,qU=sM,zU=ln,XU=f,ZU=Kt,$U=hU,eQ=Zr,tQ=FP,rQ=EU,iQ=ct,nQ=Be,oQ=Dn,sQ=F,aQ=de,cQ=tl,dQ=H,uQ=en,AQ=jr.f,hQ=function(e){var t,r,i,n,o,s,a=_U(this),c=CU(e),d=arguments.length,u=d>1?arguments[1]:void 0,A=void 0!==u,h=yU(c);if(h&&!RU(h))for(s=(o=SU(c,h)).next,c=[];!(n=mU(s,o)).done;)c.push(n.value);for(A&&d>2&&(u=IU(u,arguments[2])),r=vU(c),i=new(TU(a))(r),t=0;r>t;t++)i[t]=A?u(c[t],t):c[t];return i},lQ=jU.forEach,pQ=un,gQ=yt,fQ=i,EQ=eg,IQ=Rr.get,mQ=Rr.set,_Q=gQ.f,CQ=fQ.f,vQ=Math.round,SQ=KU.RangeError,yQ=qU.ArrayBuffer,RQ=yQ.prototype,TQ=qU.DataView,wQ=JU.NATIVE_ARRAY_BUFFER_VIEWS,bQ=JU.TYPED_ARRAY_CONSTRUCTOR,OQ=JU.TYPED_ARRAY_TAG,NQ=JU.TypedArray,DQ=JU.TypedArrayPrototype,LQ=JU.aTypedArrayConstructor,kQ=JU.isTypedArray,PQ="BYTES_PER_ELEMENT",BQ="Wrong length",MQ=function(e,t){LQ(e);for(var r=0,i=t.length,n=new e(i);i>r;)n[r]=t[r++];return n},UQ=function(e,t){_Q(e,t,{get:function(){return IQ(this)[t]}})},QQ=function(e){var t;return dQ(RQ,e)||"ArrayBuffer"==(t=oQ(e))||"SharedArrayBuffer"==t},xQ=function(e,t){return kQ(e)&&!aQ(t)&&t in e&&$U(+t)&&t>=0},FQ=function(e,t){return t=iQ(t),xQ(e,t)?XU(2,e[t]):CQ(e,t)},VQ=function(e,t,r){return t=iQ(t),!(xQ(e,t)&&sQ(r)&&nQ(r,"value"))||nQ(r,"get")||nQ(r,"set")||r.configurable||nQ(r,"writable")&&!r.writable||nQ(r,"enumerable")&&!r.enumerable?_Q(e,t,r):(e[t]=r.value,e)};YU?(wQ||(fQ.f=FQ,gQ.f=VQ,UQ(DQ,"buffer"),UQ(DQ,"byteOffset"),UQ(DQ,"byteLength"),UQ(DQ,"length")),GU({target:"Object",stat:!0,forced:!wQ},{getOwnPropertyDescriptor:FQ,defineProperty:VQ}),SM.exports=function(e,t,r){var i=e.match(/\d+$/)[0]/8,n=e+(r?"Clamped":"")+"Array",o="get"+e,s="set"+e,a=KU[n],c=a,d=c&&c.prototype,u={},A=function(e,t){_Q(e,t,{get:function(){return function(e,t){var r=IQ(e);return r.view[o](t*i+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=IQ(e);r&&(n=(n=vQ(n))<0?0:n>255?255:255&n),o.view[s](t*i+o.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};wQ?WU&&(c=t((function(e,t,r,n){return zU(e,d),EQ(sQ(t)?QQ(t)?void 0!==n?new a(t,rQ(r,i),n):void 0!==r?new a(t,rQ(r,i)):new a(t):kQ(t)?MQ(c,t):HU(hQ,c,t):new a(tQ(t)),e,c)})),uQ&&uQ(c,NQ),lQ(AQ(a),(function(e){e in c||ZU(c,e,a[e])})),c.prototype=d):(c=t((function(e,t,r,n){zU(e,d);var o,s,a,u=0,h=0;if(sQ(t)){if(!QQ(t))return kQ(t)?MQ(c,t):HU(hQ,c,t);o=t,h=rQ(r,i);var l=t.byteLength;if(void 0===n){if(l%i)throw SQ(BQ);if((s=l-h)<0)throw SQ(BQ)}else if((s=eQ(n)*i)+h>l)throw SQ(BQ);a=s/i}else a=tQ(t),o=new yQ(s=a*i);for(mQ(e,{buffer:o,byteOffset:h,byteLength:s,length:a,view:new TQ(o)});u<a;)A(e,u++)})),uQ&&uQ(c,NQ),d=c.prototype=cQ(DQ)),d.constructor!==c&&ZU(d,"constructor",c),ZU(d,bQ,c),OQ&&ZU(d,OQ,n),u[n]=c,GU({global:!0,forced:c!=a,sham:!wQ},u),PQ in c||ZU(c,PQ,i),PQ in d||ZU(d,PQ,i),pQ(n)}):SM.exports=function(){},(0,SM.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var jQ=ei,GQ=Hr,KQ=rU.aTypedArray;(0,rU.exportTypedArrayMethod)("at",(function(e){var t=KQ(this),r=jQ(t),i=GQ(e),n=i>=0?i:r+i;return n<0||n>=r?void 0:t[n]}));var HQ=r,YQ=d,WQ=rU,JQ=ei,qQ=EU,zQ=Le,XQ=n,ZQ=HQ.RangeError,$Q=HQ.Int8Array,ex=$Q&&$Q.prototype,tx=ex&&ex.set,rx=WQ.aTypedArray,ix=WQ.exportTypedArrayMethod,nx=!XQ((function(){var e=new Uint8ClampedArray(2);return YQ(tx,e,{length:1,0:3},1),3!==e[1]})),ox=nx&&WQ.NATIVE_ARRAY_BUFFER_VIEWS&&XQ((function(){var e=new $Q(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));ix("set",(function(e){rx(this);var t=qQ(arguments.length>1?arguments[1]:void 0,1),r=zQ(e);if(nx)return YQ(tx,this,r,t);var i=this.length,n=JQ(r),o=0;if(n+t>i)throw ZQ("Wrong length");for(;o<n;)this[t+o]=r[o++]}),!nx||ox);var sx=oB,ax=Math.floor,cx=function(e,t){var r=e.length,i=ax(r/2);return r<8?dx(e,t):ux(e,cx(sx(e,0,i),t),cx(sx(e,i),t),t)},dx=function(e,t){for(var r,i,n=e.length,o=1;o<n;){for(i=o,r=e[o];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==o++&&(e[i]=r)}return e},ux=function(e,t,r,i){for(var n=t.length,o=r.length,s=0,a=0;s<n||a<o;)e[s+a]=s<n&&a<o?i(t[s],r[a])<=0?t[s++]:r[a++]:s<n?t[s++]:r[a++];return e},Ax=cx,hx=Y.match(/firefox\/(\d+)/i),lx=!!hx&&+hx[1],px=/MSIE|Trident/.test(Y),gx=Y.match(/AppleWebKit\/(\d+)\./),fx=!!gx&&+gx[1],Ex=r,Ix=v,mx=n,_x=ge,Cx=Ax,vx=rU,Sx=lx,yx=px,Rx=$,Tx=fx,wx=Ex.Array,bx=vx.aTypedArray,Ox=vx.exportTypedArrayMethod,Nx=Ex.Uint16Array,Dx=Nx&&Ix(Nx.prototype.sort),Lx=!(!Dx||mx((function(){Dx(new Nx(2),null)}))&&mx((function(){Dx(new Nx(2),{})}))),kx=!!Dx&&!mx((function(){if(Rx)return Rx<74;if(Sx)return Sx<67;if(yx)return!0;if(Tx)return Tx<602;var e,t,r=new Nx(516),i=wx(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,i[e]=e-2*t+3;for(Dx(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==i[e])return!0}));Ox("sort",(function(e){return void 0!==e&&_x(e),kx?Dx(this,e):Cx(bx(this),function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}}(e))}),!kx||Lx);var Px=un,Bx="ArrayBuffer",Mx=sM.ArrayBuffer;let Ux;Gi({global:!0,forced:r.ArrayBuffer!==Mx},{ArrayBuffer:Mx}),Px(Bx),function(e){e[e.CHOOSE_SERVER=11]="CHOOSE_SERVER",e[e.CLOUD_PROXY=18]="CLOUD_PROXY",e[e.CLOUD_PROXY_5=20]="CLOUD_PROXY_5",e[e.CLOUD_PROXY_FALLBACK=26]="CLOUD_PROXY_FALLBACK"}(Ux||(Ux={}));var Qx=sd,xx=Array.isArray||function(e){return"Array"==Qx(e)},Fx=Qc,Vx=xx,jx=K_,Gx=md,Kx=Nu("species"),Hx=Fx.Array,Yx=function(e){var t;return Vx(e)&&(t=e.constructor,(jx(t)&&(t===Hx||Vx(t.prototype))||Gx(t)&&null===(t=t[Kx]))&&(t=void 0)),void 0===t?Hx:t},Wx=function(e,t){return new(Yx(e))(0===t?0:t)},Jx=gA,qx=hd,zx=Au,Xx=th,Zx=Wx,$x=Bc([].push),eF=function(e){var t=1==e,r=2==e,i=3==e,n=4==e,o=6==e,s=7==e,a=5==e||o;return function(c,d,u,A){for(var h,l,p=zx(c),g=qx(p),f=Jx(d,u),E=Xx(g),I=0,m=A||Zx,_=t?m(c,E):r||s?m(c,0):void 0;E>I;I++)if((a||I in g)&&(l=f(h=g[I],I,p),e))if(t)_[I]=l;else if(l)switch(e){case 3:return!0;case 5:return h;case 6:return I;case 2:$x(_,h)}else switch(e){case 4:return!1;case 7:$x(_,h)}return o?-1:i||n?n:_}},tF={forEach:eF(0),map:eF(1),filter:eF(2),some:eF(3),every:eF(4),find:eF(5),findIndex:eF(6),filterReject:eF(7)},rF=tF.forEach,iF=uh("forEach")?[].forEach:function(e){return rF(this,e,arguments.length>1?arguments[1]:void 0)};JA({target:"Array",proto:!0,forced:[].forEach!=iF},{forEach:iF});var nF=fh("Array").forEach,oF=kE,sF=pu,aF=Mc,cF=nF,dF=Array.prototype,uF={DOMTokenList:!0,NodeList:!0},AF=function(e){var t=e.forEach;return e===dF||aF(dF,e)&&t===dF.forEach||sF(uF,oF(e))?cF:t},hF=Au,lF=Yf;JA({target:"Object",stat:!0,forced:bc((function(){lF(1)}))},{keys:function(e){return lF(hF(e))}});var pF=_d.Object.keys,gF=Ch,fF=JA,EF=xx,IF=Bc([].reverse),mF=[1,2];fF({target:"Array",proto:!0,forced:String(mF)===String(mF.reverse())},{reverse:function(){return EF(this)&&(this.length=this.length),IF(this)}});var _F=fh("Array").reverse,CF=Mc,vF=_F,SF=Array.prototype,yF=function(e){var t=e.reverse;return e===SF||CF(SF,e)&&t===SF.reverse?vF:t},RF=bc,TF=kd,wF=Nu("species"),bF=function(e){return TF>=51||!RF((function(){var t=[];return(t.constructor={})[wF]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},OF=JA,NF=Qc,DF=xx,LF=K_,kF=md,PF=ff,BF=th,MF=Ed,UF=sL,QF=Nu,xF=Z_,FF=bF("slice"),VF=QF("species"),jF=NF.Array,GF=Math.max;OF({target:"Array",proto:!0,forced:!FF},{slice:function(e,t){var r,i,n,o=MF(this),s=BF(o),a=PF(e,s),c=PF(void 0===t?s:t,s);if(DF(o)&&(r=o.constructor,(LF(r)&&(r===jF||DF(r.prototype))||kF(r)&&null===(r=r[VF]))&&(r=void 0),r===jF||void 0===r))return xF(o,a,c);for(i=new(void 0===r?jF:r)(GF(c-a,0)),n=0;a<c;a++,n++)a in o&&UF(i,n,o[a]);return i.length=n,i}});var KF=fh("Array").slice,HF=Mc,YF=KF,WF=Array.prototype,JF=function(e){var t=e.slice;return e===WF||HF(WF,e)&&t===WF.slice?YF:t};function qF(e,t,r,i,n){var o,s,a,c={};return AF(o=pF(i)).call(o,(function(e){c[e]=i[e]})),c.enumerable=!!c.enumerable,c.configurable=!!c.configurable,("value"in c||c.initializer)&&(c.writable=!0),c=gF(s=yF(a=JF(r).call(r)).call(a)).call(s,(function(r,i){return i(e,t,r)||r}),c),n&&void 0!==c.initializer&&(c.value=c.initializer?c.initializer.call(n):void 0,c.initializer=void 0),void 0===c.initializer&&(LO(e,t,c),c=null),c}var zF=fh("Array").values,XF=kE,ZF=pu,$F=Mc,eV=zF,tV=Array.prototype,rV={DOMTokenList:!0,NodeList:!0},iV=function(e){var t=e.values;return e===tV||$F(tV,e)&&t===tV.values||ZF(rV,XF(e))?eV:t},nV=fh("Array").keys,oV=kE,sV=pu,aV=Mc,cV=nV,dV=Array.prototype,uV={DOMTokenList:!0,NodeList:!0},AV=function(e){var t=e.keys;return e===dV||aV(dV,e)&&t===dV.keys||sV(uV,oV(e))?cV:t};function hV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function lV(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?hV(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):hV(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let pV=0,gV=0;function fV(e,t,r){return new ny((i,n)=>{t.timeout=t.timeout||WD("HTTP_CONNECT_TIMEOUT"),t.responseType=t.responseType||"json",t.data&&!r?(t.data=JSON.stringify(t.data),pV+=mG(t.data)):r&&(t.data.size?pV+=t.data.size:t.data instanceof FormData?pV+=function(e){let t=0;/DingTalk/i.test(navigator.userAgent)&&e.realFormData&&(e=e.realFormData);return e.forEach(e=>{t+="string"==typeof e?mG(e):e.size}),t+138}(t.data):pV+=mG(JSON.stringify(t.data))),t.headers=t.headers||{},t.headers["Content-Type"]=t.headers["Content-Type"]||"application/json",t.method="POST",t.url=e,qN.request(t).then(e=>{"string"==typeof e.data?gV+=mG(e.data):e.data instanceof ArrayBuffer||e.data instanceof Uint8Array?gV+=e.data.byteLength:gV+=mG(JSON.stringify(e.data)),i(e.data)}).catch(e=>{qN.isCancel(e)?n(new eD($N.OPERATION_ABORTED,"cancel token canceled")):"ECONNABORTED"===e.code?n(new eD($N.NETWORK_TIMEOUT,e.message)):e.response?n(new eD($N.NETWORK_RESPONSE_ERROR,e.response.status)):n(new eD($N.NETWORK_ERROR,e.message))})})}async function EV(e,t){const r=new Blob([t.data],{type:"buffer"});return await fV(e,lV(lV({},t),{},{data:r,headers:{"Content-Type":"application/octet-stream"}}),!0)}const IV=new class extends XN{set networkState(e){cD.info("[".concat(this._moduleName,"]")+"network state changed, "+this._networkState+" -> "+e),this.emit(OP.NETWORK_STATE_CHANGE,e,this._networkState),e===bP.ONLINE?this.emit(OP.ONLINE):e===bP.OFFLINE&&(this.onlineWaiter=new ny(e=>{this.once(OP.ONLINE,()=>{this.onlineWaiter=void 0,e(bP.ONLINE)})}),this.emit(OP.OFFLINE)),this._networkState=e}get networkState(){return this._networkState}constructor(){super(),kO(this,"_moduleName","network-indicator"),kO(this,"_networkState",bP.ONLINE),kO(this,"onlineWaiter",void 0),window.addEventListener("online",()=>{this.networkState=bP.ONLINE}),window.addEventListener("offline",()=>{this.networkState=bP.OFFLINE})}};let mV=!1;const _V=new class extends XN{constructor(){super(...arguments),kO(this,"onAutoplayFailed",void 0),kO(this,"onAudioAutoplayFailed",void 0)}};function CV(){const e=oO();if(!mV){const t=r=>{r.preventDefault(),mV=!1,"Android"!==e.os||"Chrome"!==e.name&&e.name!==tO.WECHAT?(document.body.removeEventListener("touchstart",t,!0),document.body.removeEventListener("mousedown",t,!0)):document.body.removeEventListener("click",t,!0)};mV=!0,"Android"!==e.os||"Chrome"!==e.name&&e.name!==tO.WECHAT?(document.body.addEventListener("touchstart",t,!0),document.body.addEventListener("mousedown",t,!0)):document.body.addEventListener("click",t,!0),cD.info("detect media autoplay failed, document: https://docs.agora.io/cn/Voice/autoplay_policy_web_ng?platform=Web"),_V.onAutoplayFailed?_V.onAutoplayFailed():_V.onAudioAutoplayFailed?cD.warning("AgoraRTC.onAudioAutoplayFailed has been deprecated in favor of AgoraRTC.onAutoplayFailed.\n\n Please refer to the Agora document to migrate the newer API, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web ."):cD.warning("We have detected a media autoplay failed event, and found out that you haven't implemented AgoraRTC.onAutoplayFailed callback yet.\n\n It will cause audio/video element not playing automatically on some browsers without user interaction, possibly hurting user experiences.\n\n Please refer to the Agora document to properly handle autoplay failed event, https://docs.agora.io/en/Voice/autoplay_policy_web_ng?platform=Web ."),_V.emit("autoplay-failed")}}var vV;function SV(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function yV(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?SV(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):SV(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function RV(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{report:wV};return function(t,r,i){const n=t[r];if("function"==typeof n){const o="AgoraRTCClient"===t.constructor.name?"Client":t.constructor.name;i.value=function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];const a=e.report.reportApiInvoke(this._sessionId||null,{name:"".concat(o,".").concat(r),options:i,tag:fk.TRACER});try{const e=n.apply(this,i);return a.onSuccess(),e}catch(e){throw a.onError(e),e}}}return i}}function TV(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{report:wV};return function(t,r,i){const n=t[r];if("function"==typeof n){const o="AgoraRTCClient"===t.constructor.name?"Client":t.constructor.name;i.value=async function(){for(var t=arguments.length,i=new Array(t),s=0;s<t;s++)i[s]=arguments[s];const a=e.report.reportApiInvoke(this._sessionId||null,{name:"".concat(o,".").concat(r),options:i,tag:fk.TRACER});try{const e=await n.apply(this,i);return a.onSuccess(),e}catch(e){throw a.onError(e),e}}}return i}}const wV=new(LD("AgoraRTCEventReport")(vV=class{constructor(){kO(this,"baseInfoMap",new Map),kO(this,"proxyServer",void 0),kO(this,"clientList",tL),kO(this,"eventUploadTimer",void 0),kO(this,"setSessionIdTimer",void 0),kO(this,"url",void 0),kO(this,"backupUrl",void 0),kO(this,"keyEventUploadPendingItems",[]),kO(this,"normalEventUploadPendingItems",[]),kO(this,"apiInvokeUploadPendingItems",[]),kO(this,"apiInvokeCount",0),kO(this,"ltsList",[]),kO(this,"lastSendNormalEventTime",Date.now()),kO(this,"customReportCounterTimer",void 0),kO(this,"customReportCount",0),kO(this,"extApiInvoke",async e=>{for(const t of e){const e=yV(yV({},t),{},{sid:null,invokeId:++this.apiInvokeCount,tag:fk.TRACER});this.sendApiInvoke(e)}}),this.eventUploadTimer=window.setInterval(this.doSend.bind(this),WD("EVENT_REPORT_SEND_INTERVAL")),this.setSessionIdTimer=window.setInterval(this.appendSessionId.bind(this),WD("EVENT_REPORT_SEND_INTERVAL"))}adjustSessionStartTime(e){if(!this.baseInfoMap.has(e)&&!this.baseInfoMap.get(e))return cD.error("adjust session ".concat(e," start time, sid is not exist or info is undefined")),void OD("error",this,"adjustSessionStartTime","adjust session ".concat(e," start time, sid is not exist or info is undefined"));const t=this.baseInfoMap.get(e),r=Date.now(),i=t.startTime;t.startTime=r,cD.debug("rewrite session ".concat(e," startTime: ").concat(r," , ").concat(r-i,"ms")),OD("debug",this,"adjustSessionStartTime",void 0,"rewrite session ".concat(e," startTime: ").concat(r," , ").concat(r-i,"ms")),this.baseInfoMap.set(e,t)}reportApiInvoke(e,t,r){t.timeout=t.timeout||6e4,t.reportResult=void 0===t.reportResult||t.reportResult;const i=Date.now();this.apiInvokeCount+=1;const n=this.apiInvokeCount,o=()=>({tag:t.tag,invokeId:n,sid:e,name:t.name,apiInvokeTime:i,options:t.options,states:t.states||null}),s=!!WD("SHOW_REPORT_INVOKER_LOG");s&&cD.info("".concat(t.name," start"),t.options);let a=!1;_G(t.timeout).then(()=>{a||(this.sendApiInvoke(yV(yV({},o()),{},{error:$N.API_INVOKE_TIMEOUT,success:!1})),cD.debug("".concat(t.name," timeout")))});const c=new eD($N.UNEXPECTED_ERROR,"".concat(t.name,": this api invoke is end"));return{onSuccess:e=>{const i=()=>{if(a)throw c;return a=!0,this.sendApiInvoke(yV(yV({},o()),{},{success:!0},t.reportResult&&{result:e})),s&&cD.info("".concat(t.name," onSuccess")),e};return r?FG(i,t.name+"Success",r,()=>a=!0):i()},onError:e=>{const i=()=>{if(a)throw e;a=!0,this.sendApiInvoke(yV(yV({},o()),{},{success:!1,error:e.toString()})),s&&cD.info("".concat(t.name," onFailure"),e.toString())};return r?FG(i,t.name+"Error",r,()=>a=!0):i()}}}sessionInit(e,t){if(this.baseInfoMap.has(e))return;const r=Date.now(),i=this.createBaseInfo(e,r);i.cname=t.cname;const n=Object.assign({},{willUploadConsoleLog:WD("UPLOAD_LOG"),maxTouchPoints:navigator.maxTouchPoints,areaVersion:MD?"global":"oversea",areas:WD("AREAS")&&WD("AREAS").join(",")},t.extend),o=Date.now(),s=yV(yV({},i),{},{eventType:hk.SESSION_INIT,appid:t.appid,browser:navigator.userAgent,build:PD,lts:o,elapse:o-r,extend:JSON.stringify(n),mode:t.mode,process:WD("PROCESS_ID"),success:!0,version:BD});this.send({type:lk.SESSION,data:s},!0)}joinChooseServer(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=yV(yV({},i),{},{eventType:hk.JOIN_CHOOSE_SERVER,lts:n,eventElapse:n-t.lts,chooseServerAddr:t.csAddr,errorCode:t.ec,elapse:n-r.startTime,success:t.succ,chooseServerAddrList:JSON.stringify(t.serverList),uid:t.uid?parseInt(t.uid):null,cid:t.cid?parseInt(t.cid):null,chooseServerIp:t.csIp||"",opid:t.opid,unilbsServerIds:t.unilbsServerIds,extend:t.extend||void 0});this.send({type:lk.JOIN_CHOOSE_SERVER,data:o},!0)}reqUserAccount(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=yV(yV({},i),{},{eventType:hk.REQ_USER_ACCOUNT,lts:n,success:t.success,serverAddress:t.serverAddr,stringUid:t.stringUid,uid:t.uid,errorCode:t.errorCode,elapse:n-r.startTime,eventElapse:n-t.lts,extend:JSON.stringify(t.extend)});this.send({type:lk.REQ_USER_ACCOUNT,data:o},!0)}joinGateway(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info;t.vid&&(i.vid=t.vid),i.uid=t.uid,i.cid=t.cid;const n=Date.now(),{firstSuccess:o,avoidJoinStartTime:s,isProxy:a,addr:c}=t,d=n-(o&&s?s:r.startTime),u=yV(yV({},i),{},{eventType:hk.JOIN_GATEWAY,lts:n,gatewayAddr:t.addr,success:t.succ,errorCode:t.ec,elapse:d,eventElapse:n-t.lts,firstSuccess:o}),A=u.success?1:0;if(t.succ&&(r.lastJoinSuccessTime=n),o)this.send({type:lk.JOIN_GATEWAT,data:u},!0);else{let e;if(c)if(a){const t=c.match(/h=(\d{1,3}-){3}\d{1,3}/g),r=c.match(/p=[0-9]{1,6}/g);e={isSuccess:A,gatewayIp:t&&t.length?t[0].split("=")[1].replace(/-/g,"."):"",port:r&&r.length?r[0].split("=")[1]:"",isProxy:a?1:0}}else{const t=c.match(/wss:\/\/(\d{1,3}-){3}\d{1,3}/g),r=c.match(/:[0-9]{1,6}/g);e={isSuccess:A,gatewayIp:t&&t.length?t[0].split("//")[1].replace(/-/g,"."):"",port:r&&r.length?r[0].split(":")[1]:"",isProxy:a?1:0}}else e={isSuccess:A,gatewayIp:"",port:"",isProxy:a?1:0};delete u.success,delete u.eventType,delete u.firstSuccess,u.vid=Number(u.vid);const t=Object.assign({},u,e,{eventType:hk.REJOIN_GATEWAY});this.send({type:lk.RE_JOIN_GATEWAY,data:t},!0)}}joinChannelTimeout(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=Date.now(),n=yV(yV({},r.info),{},{lts:i,timeout:t,elapse:i-r.startTime});this.send({type:lk.JOIN_CHANNEL_TIMEOUT,data:n},!0)}publish(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=yV(yV({},i),{},{eventType:hk.PUBLISH,lts:n,eventElapse:t.eventElapse,elapse:n-r.startTime,success:t.succ,errorCode:t.ec,videoName:t.videoName,audioName:t.audioName,screenName:t.screenName,screenshare:t.screenshare,audio:t.audio,video:t.video,p2pid:t.p2pid,publishRequestid:t.publishRequestid});this.send({type:lk.PUBLISH,data:o},!0)}subscribe(e,t,r){const i=this.baseInfoMap.get(e);if(!i)return;const n=i.info,o=Date.now(),s=yV(yV({},n),{},{eventType:hk.SUBSCRIBE,lts:o,eventElapse:t.eventElapse,elapse:o-i.startTime,success:t.succ,errorCode:t.ec,video:t.video,audio:t.audio,subscribeRequestid:t.subscribeRequestid,p2pid:t.p2pid},r&&{extend:JSON.stringify({isMassSubscribe:!0})});"string"==typeof t.peerid?s.peerSuid=t.peerid:s.peer=t.peerid,this.send({type:lk.SUBSCRIBE,data:s},!0)}wsCompressorInit(e){var t;const r=[...AV(t=this.baseInfoMap).call(t)],i=r.length?r[0]:"UnableToGetSid",n=this.baseInfoMap.get(i);if(!n)return;const o=n.info,s=Date.now(),a=yV(yV({},o),{},{eventType:hk.WS_COMPRESSOR_INIT,lts:s,eventElapse:e.eventElapse,elapse:s-n.startTime,status:e.status?1:2});this.send({type:lk.WS_COMPRESSOR_INIT,data:a},!0)}firstRemoteFrame(e,t,r,i){const n=this.baseInfoMap.get(e);if(!n)return;const o=n.info,s=Date.now(),a=yV(yV(yV({},o),i),{},{elapse:s-n.startTime,eventType:t,lts:s});this.send({type:r,data:a},!0)}onGatewayStream(e,t,r,i){const n=this.baseInfoMap.get(e);if(!n)return;const o=n.info,s=Date.now(),a=yV(yV(yV({},o),i),{},{eventType:t,lts:s});this.send({type:r,data:a},!0)}streamSwitch(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=yV(yV({},i),{},{eventType:hk.STREAM_SWITCH,lts:n,isDual:t.isdual,elapse:n-r.startTime,success:t.succ});this.send({type:lk.STREAM_SWITCH,data:o},!0)}requestProxyAppCenter(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=yV(yV({},i),{},{eventType:hk.REQUEST_PROXY_APPCENTER,lts:n,eventElapse:n-t.lts,elapse:n-r.startTime,APAddr:t.APAddr,workerManagerList:t.workerManagerList,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:lk.REQUEST_PROXY_APPCENTER,data:o},!0)}requestProxyWorkerManager(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=yV(yV({},i),{},{eventType:hk.REQUEST_PROXY_WORKER_MANAGER,lts:n,eventElapse:n-t.lts,elapse:n-r.startTime,workerManagerAddr:t.workerManagerAddr,response:t.response,errorCode:t.ec,success:t.succ});this.send({type:lk.REQUEST_PROXY_WORKER_MANAGER,data:o},!0)}setProxyServer(e){this.proxyServer=e,e?cD.debug("reportProxyServerurl: ".concat(e)):cD.debug("disable reportProxyServerurl: ".concat(e)),OD("debug",this,"setProxyServer",e)}peerPublishStatus(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=yV(yV({},i),{},{subscribeElapse:t.subscribeElapse,peer:t.peer,peerPublishDuration:Math.max(t.audioPublishDuration,t.videoPublishDuration),audiotag:t.audioPublishDuration>0?1:-1,videotag:t.videoPublishDuration>0?1:-1,lts:n,elapse:n-r.startTime,joinChannelSuccessElapse:n-(r.lastJoinSuccessTime||n)});this.send({type:lk.PEER_PUBLISH_STATUS,data:o},!0)}workerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now();(function(e,t,r){const i=e[t];if(!i||"string"!=typeof i)return[e];e[t]="";const n=mG(JSON.stringify(e));let o=0;const s=[];let a=0;for(let c=0;c<i.length;c++)a+=i.charCodeAt(c)<=127?1:3,a<=r-n||(s[s.length]=IG(IG({},e),{},{[t]:i.substring(o,c)}),o=c,a=i.charCodeAt(c)<=127?1:3);o!==i.length-1&&(s[s.length]=IG(IG({},e),{},{[t]:i.substring(o)}));return s})(yV(yV(yV({},i),t),{},{elapse:n-r.startTime,lts:n,productType:"WebRTC"}),"payload",1300).forEach(e=>this.send({type:lk.WORKER_EVENT,data:e},!0))}apworkerEvent(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=yV(yV(yV({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:lk.AP_WORKER_EVENT,data:o},!0)}joinWebProxyAP(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=yV(yV(yV({},i),t),{},{elapse:n-r.startTime,lts:n,extend:t.extend||void 0});this.send({type:lk.JOIN_WEB_PROXY_AP,data:o},!0)}WebSocketQuit(e,t){const r=this.baseInfoMap.get(e);if(!r)return;const i=r.info,n=Date.now(),o=yV(yV(yV({},i),t),{},{elapse:n-r.startTime,lts:n});this.send({type:lk.WEBSOCKET_QUIT,data:o},!0)}async sendCustomReportMessage(e,t){if(this.customReportCount+=t.length,this.customReportCount>WD("CUSTOM_REPORT_LIMIT"))throw new eD($N.CUSTOM_REPORT_FREQUENCY_TOO_HIGH);this.customReportCounterTimer||(this.customReportCounterTimer=window.setInterval(()=>{this.customReportCount=0},5e3));const r=t.map(t=>({type:lk.USER_ANALYTICS,data:yV({sid:e},t)})),i={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:r.map(e=>JSON.stringify(e))};try{await this.postDataToStatsCollector(i)}catch(e){throw cD.error("send custom report message failed",e.toString()),new eD($N.CUSTOM_REPORT_SEND_FAILED,e.message)}}autoplayFailed(e,t,r,i){if(!e)return;const n=this.baseInfoMap.get(e);if(!n)return;const o=n.info,s=Date.now(),a=yV(yV({},o),{},{vid:void 0===o.vid?0:Number(o.vid),lts:s,elapse:s-n.startTime,cbRegistered:_V.onAutoplayFailed||_V.onAudioAutoplayFailed?1:-1,errorMsg:r,mediaType:t,trackId:i,extend:void 0});this.send({type:lk.AUTOPLAY_FAILED,data:a},!0)}sendApiInvoke(e){const t=WD("NOT_REPORT_EVENT");if(e.tag&&t.includes&&t.includes(e.tag))return!1;if(null===e.sid)return this.apiInvokeUploadPendingItems.push(e),!1;const r=this.baseInfoMap.get(e.sid);if(!r)return this.apiInvokeUploadPendingItems.push(e),!1;const{cname:i,uid:n,cid:o}=r.info;e.lts=e.lts||Date.now();const s={invokeId:e.invokeId,sid:e.sid,cname:i,cid:o,uid:n,lts:e.lts,success:e.success,elapse:e.lts-r.startTime,execElapse:e.lts-e.apiInvokeTime,apiName:e.name,options:e.options?JSON.stringify(e.options):void 0,execStates:e.states?JSON.stringify(e.states):void 0,execResult:e.result?JSON.stringify(e.result):void 0,errorCode:e.error?JSON.stringify(e.error):void 0};return this.send({type:lk.API_INVOKE,data:s},!1),!0}appendSessionId(){this.clientList.forEach(e=>{if(e._sessionId){const t=this.apiInvokeUploadPendingItems.length;for(let r=0;r<t;r++){const t=this.apiInvokeUploadPendingItems.shift();t&&(t.sid=e._sessionId,this.sendApiInvoke(Object.assign({},t)))}}})}send(e,t){if(t)return this.keyEventUploadPendingItems.push(e),void this.sendItems(this.keyEventUploadPendingItems,!0);this.normalEventUploadPendingItems.push(e),this.normalEventUploadPendingItems.length>WD("NORMAL_EVENT_QUEUE_CAPACITY")&&this.normalEventUploadPendingItems.splice(0,1),this.normalEventUploadPendingItems.length>=10&&this.sendItems(this.normalEventUploadPendingItems,!1)}doSend(){this.keyEventUploadPendingItems.length>0&&this.sendItems(this.keyEventUploadPendingItems,!0),this.normalEventUploadPendingItems.length>0&&Date.now()-this.lastSendNormalEventTime>=5e3&&this.sendItems(this.normalEventUploadPendingItems,!1)}sendItems(e,t){const r=[],i=[];for(;e.length;){const t=e.shift();r.length<20?r.push(t):i.push(t)}e.push(...i);for(const e of[...r]){var n;if(-1!==this.ltsList.indexOf(e.data.lts))e.data.lts=this.ltsList[this.ltsList.length-1]+1,this.ltsList.push(e.data.lts);else this.ltsList.push(e.data.lts),JL(n=this.ltsList).call(n,(e,t)=>e-t)}t||(this.lastSendNormalEventTime=Date.now());const o={msgType:"EventMessages",sentTs:Math.round(Date.now()/1e3),payloads:r.map(e=>JSON.stringify(e)),vid:(e=>{const t=e&&e.data.sid&&this.baseInfoMap.get(e.data.sid);return t&&t.info.vid&&+t.info.vid||0})(r[0])};return r.length&&this.postDataToStatsCollector(o).catch((e=>r=>{WD("EVENT_REPORT_RETRY")&&(t?this.keyEventUploadPendingItems=this.keyEventUploadPendingItems.concat(e):(this.normalEventUploadPendingItems=this.normalEventUploadPendingItems.concat(e),this.normalEventUploadPendingItems.length>WD("NORMAL_EVENT_QUEUE_CAPACITY")&&(this.normalEventUploadPendingItems.splice(0,this.normalEventUploadPendingItems.length-WD("NORMAL_EVENT_QUEUE_CAPACITY")),cD.warning("report: drop normal events"))))})(r)),e}async postDataToStatsCollector(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];IV.networkState===bP.OFFLINE&&await ny.race([IV.onlineWaiter,_G(2*tD.maxRetryTimeout)]);const r=t?"/events/proto-raws":"/events/messages";let i=this.url||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(WD("EVENT_REPORT_DOMAIN"),"&p=6443&d=").concat(r):"https://".concat(WD("EVENT_REPORT_DOMAIN"),":6443").concat(r));for(let n=0;n<2;n+=1){1===n&&(i=this.backupUrl||(this.proxyServer?"https://".concat(this.proxyServer,"/rs/?h=").concat(WD("EVENT_REPORT_BACKUP_DOMAIN"),"&p=6443&d=").concat(r):"https://".concat(WD("EVENT_REPORT_BACKUP_DOMAIN"),":6443").concat(r)));try{t?await EV(i,{timeout:1e4,data:e}):await fV(i,{timeout:1e4,data:e})}catch(e){if(1===n)throw e;continue}return}}createBaseInfo(e,t){const r=Object.assign({},Ak);return r.sid=e,this.baseInfoMap.set(e,{info:r,startTime:t}),r}reportResourceTiming(e,t){const r=performance.getEntriesByName(e),i=r[r.length-1];i&&this.reportApiInvoke(t,{name:"Client.resourceTiming",options:i,tag:fk.TRACER}).onSuccess()}})||vV);ZN.on("REPORT_LOG_UPLOAD",e=>{e.networkState=IV.networkState,wV.reportApiInvoke(null,{name:"logUploadError",options:e,tag:fk.TRACER})});class bV extends XN{constructor(e,t){super(),kO(this,"trackMediaType",void 0),kO(this,"_ID",void 0),kO(this,"_hints",[]),kO(this,"_isClosed",!1),kO(this,"_originMediaStreamTrack",void 0),kO(this,"_mediaStreamTrack",void 0),kO(this,"_external",{}),this._ID=t||vG(8,"track-"),this._originMediaStreamTrack=e,this._mediaStreamTrack=e,function(e){rL.includes(e)||rL.push(e)}(this)}toString(){return this._ID}getTrackId(){return this._ID}getMediaStreamTrack(e){if(!e){const e=wV.reportApiInvoke(null,{name:gk.GET_MEDIA_STREAM_TRACK,options:[],tag:fk.TRACER});this._mediaStreamTrack&&"string"==typeof this._mediaStreamTrack.label?e.onSuccess(this._mediaStreamTrack.label):e.onSuccess("")}return this._mediaStreamTrack}getMediaStreamTrackSettings(){return this.getMediaStreamTrack(!0).getSettings()}close(){this._isClosed=!0,function(e){const t=rL.indexOf(e);-1!==t&&rL.splice(t,1)}(this),this.emit(pP.CLOSED)}}let OV,NV,DV,LV=1;class kV{constructor(e){kO(this,"lockingPromise",ny.resolve()),kO(this,"locks",0),kO(this,"name",""),kO(this,"lockId",void 0),this.lockId=LV++,e&&(this.name=e),cD.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}get isLocked(){return this.locks>0}lock(e){let t;this.locks+=1,cD.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is locked, current queue ").concat(this.locks,". ").concat("string"==typeof e?e:""));const r=new ny(r=>{t=()=>{this.locks-=1,cD.debug("[lock-".concat(this.name,"-").concat(this.lockId,"] is not locked, current queue ").concat(this.locks,". ").concat("string"==typeof e?e:"")),r()}}),i=this.lockingPromise.then(()=>t);return this.lockingPromise=this.lockingPromise.then(()=>r),i}}function PV(e,t){return function(r,i,n){const o=r[i];if("function"!=typeof o)throw new Error("Cannot use mutex on object property.");return n.value=async function(){const r=this[t];if(!r)throw new Error("mutex property key ".concat(t," doesn't exist on ").concat(e));const n=await r.lock("From ".concat(e,".").concat(i));try{for(var s=arguments.length,a=new Array(s),c=0;c<s;c++)a[c]=arguments[c];return await o.apply(this,a)}finally{n()}},n}}class BV extends bV{get muted(){return this._muted}get enabled(){return this._enabled}constructor(e,t){super(e,t),kO(this,"_enabled",!0),kO(this,"_muted",!1),kO(this,"_isClosed",!1),kO(this,"_trackProcessors",[]),kO(this,"_enabledMutex",void 0),kO(this,"processor",void 0),kO(this,"processorContext",void 0),kO(this,"_handleTrackEnded",()=>{this.onTrackEnded()}),this._enabledMutex=new kV("".concat(t)),e.addEventListener("ended",this._handleTrackEnded)}getTrackLabel(){return this._originMediaStreamTrack.label}close(){this._isClosed||(this.stop(),this._trackProcessors.forEach(e=>e.destroy()),this._trackProcessors=[],this._originMediaStreamTrack.stop(),this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack.stop(),this._mediaStreamTrack=null),this._originMediaStreamTrack=null,this._enabledMutex=null,cD.debug("[".concat(this.getTrackId(),"] close")),OD("debug",this,"close"),this.emit(uP.NEED_CLOSE),super.close())}async _registerTrackProcessor(e){if(-1!==this._trackProcessors.indexOf(e))return;const t=this._trackProcessors[this._trackProcessors.length-1];this._trackProcessors.push(e),e.onOutputChange=async()=>{const t=e.output||this._originMediaStreamTrack;this._mediaStreamTrack=t,this._updatePlayerSource(),await bG(this,uP.NEED_REPLACE_TRACK,this)},t?(t.onOutputChange=async()=>{t.output&&await e.setInput(t.output)},await e.setInput(t.output||t.input||this._originMediaStreamTrack)):await e.setInput(this._originMediaStreamTrack)}_getOutputFromProcessors(){if(0===this._trackProcessors.length)return this._originMediaStreamTrack;const e=this._trackProcessors[this._trackProcessors.length-1];return e.output||e.input||this._originMediaStreamTrack}async _updateOriginMediaStreamTrack(e,t){if(e!==this._originMediaStreamTrack){if(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),t&&this._originMediaStreamTrack.stop(),e.addEventListener("ended",this._handleTrackEnded),this._originMediaStreamTrack=e,this._trackProcessors.length>0){await this._trackProcessors[0].setInput(e);const t=this._getOutputFromProcessors();this._mediaStreamTrack=t}else this._mediaStreamTrack=this._originMediaStreamTrack;this._updatePlayerSource(),await bG(this,uP.NEED_REPLACE_TRACK,this),this.processor&&this.processor.updateInput({track:this._originMediaStreamTrack,context:this.processorContext})}}_getDefaultPlayerConfig(){return{}}onTrackEnded(){cD.debug("[".concat(this.getTrackId(),"] track ended")),bD("debug",["MediaStreamTrack",this.getTrackId()],"ended"),this.emit(pP.TRACK_ENDED)}stateCheck(e,t){if(cD.debug("check track state, [muted: ".concat(this._muted,", enabled: ").concat(this._enabled,"] to [").concat(e,": ").concat(t,"]")),OD("debug",this,"stateCheck",{stateName:e,state:t,muted:this._muted,enabled:this._enabled}),qL(t,e),this._enabled&&this._muted&&"enabled"===e&&!1===t)throw new eD($N.TRACK_STATE_UNREACHABLE,"cannot set enabled while the track is muted").print();if(!this._enabled&&!this._muted&&"muted"===e&&!0===t)throw new eD($N.TRACK_STATE_UNREACHABLE,"cannot set muted while the track is disabled").print()}getProcessorStats(){return this.processorContext.gatherStats()}}!function(e){e.IOS_15_INTERRUPTION_START="ios15-interruption-start",e.IOS_15_INTERRUPTION_END="ios15-interruption-end",e.IOS_INTERRUPTION_START="ios-interruption-start",e.IOS_INTERRUPTION_END="ios-interruption-end",e.STATE_CHANGE="state-change"}(OV||(OV={})),function(e){e.AUDIO_CONTEXT_CREATED="audio_context_created"}(NV||(NV={})),function(e){e.AIDenoiser="AIDenoiser"}(DV||(DV={}));const MV={audioContextInitOptions:{}};const UV=new class extends XN{constructor(){super(),kO(this,"registeredPlugins",[])}setOptions(e,t){MV[e]&&(MV[e]=t)}getOptions(e){return MV[e]}installPlugin(e){e instanceof Object&&e.name&&this.registeredPlugins.push(e.name)}},QV=window.AudioContext||window.webkitAudioContext;let xV=null;const FV=new class extends XN{constructor(){super(...arguments),kO(this,"prevState",void 0),kO(this,"curState",void 0),kO(this,"interruptDetectorTrack",void 0),kO(this,"onLocalAudioTrackMute",()=>{cD.info("ios15-interruption-start"),TD("info",["WebAudio"],"ios15-interruption-start"),this.emit(OV.IOS_15_INTERRUPTION_START)}),kO(this,"onLocalAudioTrackUnmute",async()=>{cD.info("ios15-interruption-end"),TD("info",["WebAudio"],"ios15-interruption-end"),"running"!==this.curState||this.duringInterruption?cD.info("ios15-interruption-end-canceled"):(xV&&await xV.suspend(),this.emit(OV.IOS_15_INTERRUPTION_END))})}get duringInterruption(){return"running"===this.prevState&&"interrupted"===this.curState}bindInterruptDetectorTrack(e){cD.debug("webaudio bindInterruptDetectorTrack ".concat(e.getTrackId())),OD("debug",["WebAudio"],"bindInterruptDetectorTrack",e.getTrackId()),this.interruptDetectorTrack||(this.interruptDetectorTrack=e,this.interruptDetectorTrack._mediaStreamTrack.onmute=this.onLocalAudioTrackMute,this.interruptDetectorTrack._mediaStreamTrack.onunmute=this.onLocalAudioTrackUnmute)}unbindInterruptDetectorTrack(e){cD.debug("webaudio unbindInterruptDetectorTrack ".concat(e.getTrackId())),OD("debug",["WebAudio"],"unbindInterruptDetectorTrack",e.getTrackId()),this.interruptDetectorTrack&&this.interruptDetectorTrack===e&&(this.interruptDetectorTrack._mediaStreamTrack&&(this.interruptDetectorTrack._mediaStreamTrack.onmute=null,this.interruptDetectorTrack._mediaStreamTrack.onunmute=null),this.interruptDetectorTrack=void 0)}};function VV(){if(!QV)return cD.error("your browser is not support web audio"),void RD("error",["WebAudio"],"your browser is not support web audio");cD.info("create audio context"),ND("info",["WebAudio"],"WebAudioContext");const e=UV.getOptions("audioContextInitOptions");cD.debug("audio content init option:",JSON.stringify(e)),xV=new QV(e),UV.emit(NV.AUDIO_CONTEXT_CREATED,xV),FV.curState=xV.state,xV.onstatechange=()=>{FV.prevState=FV.curState,FV.curState=xV?xV.state:void 0,(fO()||CO())&&"running"===FV.prevState&&"interrupted"===FV.curState&&(cD.info("ios-interruption-start"),TD("info",["AudioState"],"ios-interruption-start"),FV.emit(OV.IOS_INTERRUPTION_START)),(fO()||CO())&&"interrupted"===FV.prevState&&"running"===FV.curState&&(cD.info("ios-interruption-end"),TD("info",["AudioState"],"ios-interruption-end"),FV.emit(OV.IOS_INTERRUPTION_END)),FV.prevState!==FV.curState&&(cD.debug("AudioContext State Change","".concat(FV.prevState,"=>").concat(FV.curState)),bD("debug",["AudioContext",void 0],"statechange","".concat(FV.prevState,"=>").concat(FV.curState)),FV.emit(OV.STATE_CHANGE))},async function(e){const t=["click","contextmenu","auxclick","dblclick","mousedown","mouseup","touchend","keydown","keyup"];let r,i=!1,n=!1,o=!1;function s(t){"running"===e.state?a(!1):fO()||CO()?"suspended"===e.state&&(a(!0),t&&e.resume().then(d,d)):"closed"!==e.state&&(a(!0),t&&e.resume().then(d,d))}function a(e){if(i!==e){i=e;for(let r=0,i=t;r<i.length;r+=1){const t=i[r];e?window.addEventListener(t,u,{capture:!0,passive:!0}):window.removeEventListener(t,u,{capture:!0,passive:!0})}}}function c(){s(!0)}function d(){s(!1)}function u(){s(!0)}function A(e){if(!o)if(r.paused)if(e){h(!1),o=!0;let e=void 0;try{e=r.play(),e?e.then(l,l):(r.addEventListener("playing",l),r.addEventListener("abort",l),r.addEventListener("error",l))}catch(e){l()}}else h(!0);else h(!1)}function h(e){if(n!==e){n=e;for(let r=0,i=t;r<i.length;r++){const t=i[r];e?window.addEventListener(t,p,{capture:!0,passive:!0}):window.removeEventListener(t,p,{capture:!0,passive:!0})}}}function l(){r.removeEventListener("playing",l),r.removeEventListener("abort",l),r.removeEventListener("error",l),o=!1,A(!1)}function p(){A(!0)}if(fO()){const t=e.createMediaStreamDestination(),i=document.createElement("div");i.innerHTML="<audio x-webkit-airplay='deny'></audio>",r=i.children.item(0),r.controls=!1,r.disableRemotePlayback=!0,r.preload="auto",r.srcObject=t.stream,A(!0)}FV.on(OV.STATE_CHANGE,c),s(!1)}(xV)}function jV(){if(!xV){if(VV(),!xV)throw new eD($N.NOT_SUPPORTED,"can not create audio context");return xV}return xV}function GV(e){if(function(){if(null!==KV)return KV;const e=jV(),t=e.createBufferSource(),r=e.createGain(),i=e.createGain();t.connect(r),t.connect(i),t.disconnect(r);let n=!1;try{t.disconnect(r)}catch(e){n=!0}return t.disconnect(),KV=n,n}())return;OD("debug",["WebAudio"],"polyfillAudioNode");const t=e.connect,r=e.disconnect;e.connect=(r,i,n)=>(e._inputNodes||(e._inputNodes=[]),e._inputNodes.includes(r)||(r instanceof AudioNode?(e._inputNodes.push(r),t.call(e,r,i,n)):t.call(e,r,i)),e),e.disconnect=(i,n,o)=>{r.call(e),i?DG(e._inputNodes,i):e._inputNodes=[];for(const r of e._inputNodes)t.call(e,r)}}let KV=null;function HV(e,t){const r=1/t,i=jV();let n=i.createGain();n.gain.value=0,n.connect(i.destination);let o=!1;const s=()=>{if(o)return void(n=null);const t=i.createOscillator();t.onended=s,t.connect(n),t.start(0),t.stop(i.currentTime+r),e(i.currentTime)};return s(),()=>{o=!0}}const YV=cD.prefix("[inject-node]");class WV{constructor(){kO(this,"nodeLists",[]),kO(this,"prevNode",void 0),kO(this,"nextNode",void 0)}get firstNode(){return this.nodeLists[0]}get lastNode(){return this.nodeLists[this.nodeLists.length-1]}get isActive(){return!!this.nodeLists.length}get isConnected(){return!(!this.prevNode||!this.nextNode)}connect(e,t){YV.debug("connect audio node, current list:"+this.nodeLists.length),this.nodeLists.length?(this.prevNode&&this.prevNode.disconnect(),e.connect(this.firstNode),this.nextNode&&this.lastNode&&this.lastNode.disconnect(),this.lastNode.connect(t),this.nodeLists.forEach((e,t)=>{const r=this.nodeLists[t+1];r&&e.connect(r)})):e.connect(t),this.nextNode=t,this.prevNode=e}disconnect(){var e;YV.debug("disconnect audio node, current list:"+this.nodeLists.length),this.nodeLists.forEach(e=>{e.disconnect()}),null===(e=this.prevNode)||void 0===e||e.disconnect(),this.prevNode=void 0,this.nextNode=void 0}addNode(e){YV.debug("add node in inject node, current list:",this.nodeLists.length),this.prevNode&&this.nextNode?(this.firstNode||(YV.debug("new node is the first node"),this.prevNode.disconnect(),this.prevNode.connect(e),e.connect(this.nextNode)),this.nextNode&&this.lastNode&&(this.lastNode.disconnect(this.nextNode),this.lastNode.connect(e),e.connect(this.nextNode)),this.nodeLists.push(e)):YV.debug("add node is called before inject node connected")}removeNode(e){YV.debug("remove node in inject node, current list:",this.nodeLists.length);const t=this.nodeLists.indexOf(e);if(-1===t)return void YV.debug("$[inject-node] cannot find the node to be removed");const r=this.nodeLists[t+1],i=this.nodeLists[t-1];0===t&&this.prevNode&&this.nextNode&&(this.prevNode.disconnect(e),r?this.prevNode.connect(r):this.prevNode.connect(this.nextNode)),t===this.nodeLists.length-1&&this.nextNode&&i&&(i.disconnect(e),i.connect(this.nextNode)),0!==t&&t!==this.nodeLists.length-1&&(i.disconnect(e),i.connect(r)),YV.debug("remove node in inject node success, current list:",this.nodeLists.length)}}class JV extends XN{get processSourceNode(){return this.sourceNode}set processedNode(e){var t;if(!this.isDestroyed&&this._processedNode!==e){try{var r;null===(r=this.sourceNode)||void 0===r||r.disconnect(this.outputNode)}catch(e){}null===(t=this._processedNode)||void 0===t||t.disconnect(),this._processedNode=e,this.connect()}}get processedNode(){return this._processedNode}constructor(){super(),kO(this,"outputNode",void 0),kO(this,"outputTrack",void 0),kO(this,"isPlayed",!1),kO(this,"sourceNode",void 0),kO(this,"analyserNode",void 0),kO(this,"context",void 0),kO(this,"audioBufferNode",void 0),kO(this,"destNode",void 0),kO(this,"injectNode",void 0),kO(this,"audioOutputLevel",0),kO(this,"_processedNode",void 0),kO(this,"playNode",void 0),kO(this,"isDestroyed",!1),kO(this,"onNoAudioInput",void 0),kO(this,"isNoAudioInput",!1),kO(this,"_noAudioInputCount",0),this.context=jV(),this.playNode=this.context.destination,this.outputNode=this.context.createGain(),GV(this.outputNode),this.analyserNode=this.context.createAnalyser(),this.analyserNode.smoothingTimeConstant=.4,this.analyserNode.fftSize=2048,this.injectNode=new WV}startGetAudioBuffer(e){this.audioBufferNode||(this.audioBufferNode=this.context.createScriptProcessor(e),this.outputNode.connect(this.audioBufferNode),this.audioBufferNode.connect(this.context.destination),this.audioBufferNode.onaudioprocess=e=>{this.emit(Pk.ON_AUDIO_BUFFER,function(e){for(let t=0;t<e.outputBuffer.numberOfChannels;t+=1){const r=e.outputBuffer.getChannelData(t);for(let e=0;e<r.length;e+=1)r[e]=0}return e.inputBuffer}(e))})}stopGetAudioBuffer(){this.audioBufferNode&&(this.audioBufferNode.onaudioprocess=null,this.outputNode.disconnect(this.audioBufferNode),this.audioBufferNode=void 0)}createOutputTrack(){if(!BP().webAudioMediaStreamDest)throw new eD($N.NOT_SUPPORTED,"your browser is not support audio processor");return this.destNode&&this.outputTrack||(this.destNode=this.context.createMediaStreamDestination(),this.outputNode.connect(this.destNode),this.outputTrack=this.destNode.stream.getAudioTracks()[0]),this.outputTrack}play(e){"running"!==this.context.state&&kG(()=>{FV.emit("autoplay-failed")}),this.isPlayed=!0,this.playNode=e||this.context.destination,this.outputNode.connect(this.playNode)}stop(){if(this.isPlayed)try{this.outputNode.disconnect(this.playNode)}catch(e){}this.isPlayed=!1}getAccurateVolumeLevel(){if(!this.context||fO()||CO()||"running"!==this.context.state&&this.context.resume(),!this.analyserNode)return 0;const e=new Uint8Array(this.analyserNode.frequencyBinCount);this.analyserNode.getByteFrequencyData(e);let t=0;for(let r=0;r<e.length;r++)t+=r<64?Math.abs(10*e[r]):Math.abs(6*e[r]/15);return t/e.length/255}async checkHasAudioInput(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(e>5)return this.isNoAudioInput=!0,this.onNoAudioInput&&this.onNoAudioInput(),!1;if(fO()||CO()?"suspended"===this.context.state&&this.context.resume():"running"!==this.context.state&&this.context.resume(),!this.analyserNode)return!1;const t=new Uint8Array(this.analyserNode.frequencyBinCount);this.analyserNode.getByteFrequencyData(t);let r=!1;for(let e=0;e<t.length;e++)0!==t[e]&&(r=!0);return r?(this.isNoAudioInput=!1,!0):(await _G(200),await this.checkHasAudioInput(e?e+1:1)&&r)}getAudioVolume(){return this.outputNode.gain.value}setVolume(e){this.outputNode.gain.setValueAtTime(e,this.context.currentTime)}destroy(){this.disconnect(),this.stop(),this.isDestroyed=!0,this.onNoAudioInput=void 0}injectAudioNode(e){this.injectNode.addNode(e)}removeAudioNode(e){this.injectNode.removeNode(e)}disconnect(){var e,t;null===(e=this.processedNode)||void 0===e||e.disconnect(),null===(t=this.sourceNode)||void 0===t||t.disconnect(),this.outputNode&&this.outputNode.disconnect()}connect(){var e;this.processedNode?null===(e=this.processedNode)||void 0===e||e.connect(this.outputNode):this.sourceNode&&this.sourceNode.connect(this.outputNode);this.outputNode.connect(this.analyserNode)}}class qV extends JV{get isFreeze(){return!1}constructor(e,t){var r;if(super(),kO(this,"sourceNode",void 0),kO(this,"track",void 0),kO(this,"audioElement",void 0),kO(this,"isCurrentTrackCloned",!1),kO(this,"isRemoteTrack",!1),kO(this,"rebuildWebAudio",async()=>{if(cD.debug("ready to rebuild web audio, state:",this.context.state),this.isNoAudioInput&&await this.checkHasAudioInput(),!this.isNoAudioInput||this.isDestroyed)return document.body.removeEventListener("click",this.rebuildWebAudio,!0),void cD.debug("rebuild web audio success, current volume status",this.getAccurateVolumeLevel());this.context.resume().then(()=>cD.info("resume success")),cD.debug("rebuild web audio because of ios 12 bugs"),this.disconnect();const e=this.track;this.track=this.track.clone(),this.isCurrentTrackCloned?e.stop():this.isCurrentTrackCloned=!0;const t=new MediaStream([this.track]);this.sourceNode=this.context.createMediaStreamSource(t),GV(this.sourceNode),this.analyserNode=this.context.createAnalyser();const r=this.outputNode.gain.value;this.outputNode=this.context.createGain(),this.outputNode.gain.setValueAtTime(r,this.context.currentTime),GV(this.outputNode),this.emit(Pk.UPDATE_SOURCE),this.connect(),this.audioElement.srcObject=t,this.isPlayed&&this.play(this.playNode),this.checkHasAudioInput()}),"audio"!==e.kind)throw new eD($N.UNEXPECTED_ERROR);this.track=e;const i=new MediaStream([this.track]);this.isRemoteTrack=!!t,this.sourceNode=this.context.createMediaStreamSource(i),GV(this.sourceNode),this.connect(),this.audioElement=document.createElement("audio"),this.audioElement.srcObject=i;const n=oO();t&&n.os===eO.IOS&&Number(null===(r=n.osVersion)||void 0===r?void 0:r.split(".")[0])<15&&(FV.on(OV.STATE_CHANGE,()=>{"suspended"===this.context.state?document.body.addEventListener("click",this.rebuildWebAudio,!0):"running"===this.context.state&&this.rebuildWebAudio()}),this.checkHasAudioInput().then(e=>{e||document.body.addEventListener("click",this.rebuildWebAudio,!0)}))}updateTrack(e){this.sourceNode.disconnect(),this.track=e,this.isCurrentTrackCloned=!1;const t=new MediaStream([e]);this.sourceNode=this.context.createMediaStreamSource(t),GV(this.sourceNode),this.processedNode||this.sourceNode.connect(this.outputNode),this.emit(Pk.UPDATE_SOURCE),this.audioElement.srcObject=t}destroy(){this.audioElement.srcObject=null,this.audioElement.remove(),FV.off("state-change",this.rebuildWebAudio),super.destroy()}}async function zV(e,t){const r=(e,t)=>e?"number"!=typeof e?e.max||e.exact||e.ideal||e.min||t:e:t,i={audio:!1,video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:e,maxHeight:r(t.height,1080),maxWidth:r(t.width,1920)}}};return t.frameRate&&"number"!=typeof t.frameRate?(i.video.mandatory.maxFrameRate=t.frameRate.max,i.video.mandatory.minFrameRate=t.frameRate.min):"number"==typeof t.frameRate&&(i.video.mandatory.maxFrameRate=t.frameRate),await navigator.mediaDevices.getUserMedia(i)}async function XV(e){const t=await ZV(e.mediaSource),r=await function(e){return new ny((t,r)=>{const i=document.createElement("div");i.innerText="share screen",i.setAttribute("style","text-align: center; height: 25px; line-height: 25px; border-radius: 4px 4px 0 0; background: #D4D2D4; border-bottom: solid 1px #B9B8B9;");const n=document.createElement("div");n.setAttribute("style","width: 100%; height: 500px; padding: 15px 25px ; box-sizing: border-box;");const o=document.createElement("div");o.innerText="Agora Web Screensharing wants to share the contents of your screen with webdemo.agorabeckon.com. Choose what you'd like to share.",o.setAttribute("style","height: 12%;");const s=document.createElement("div");s.setAttribute("style","width: 100%; height: 80%; background: #FFF; border: solid 1px #CBCBCB; display: flex; flex-wrap: wrap; justify-content: space-around; overflow-y: scroll; padding: 0 15px; box-sizing: border-box;");const a=document.createElement("div");a.setAttribute("style","text-align: right; padding: 16px 0;");const c=document.createElement("button");c.innerHTML="cancel",c.setAttribute("style","width: 85px;"),c.onclick=()=>{document.body.removeChild(d);const e=new Error("NotAllowedError");e.name="NotAllowedError",r(e)},a.appendChild(c),n.appendChild(o),n.appendChild(s),n.appendChild(a);const d=document.createElement("div");d.setAttribute("style","position: fixed; z-index: 99999999; top: 50%; left: 50%; width: 620px; height: 525px; background: #ECECEC; border-radius: 4px; -webkit-transform: translate(-50%,-50%); transform: translate(-50%,-50%);"),d.appendChild(i),d.appendChild(n),document.body.appendChild(d),e.map(e=>{if(e.id){const r=document.createElement("div");r.setAttribute("style","width: 30%; height: 160px; padding: 20px 0; text-align: center;box-sizing: content-box;");let i=e.thumbnail;const{width:n}=i.getSize();n>1920&&(i=i.resize({width:1920})),r.innerHTML='<div style="height: 120px; display: table-cell; vertical-align: middle;"><img style="width: 100%; background: #333333; box-shadow: 1px 1px 1px 1px rgba(0, 0, 0, 0.2);" src='+i.toDataURL()+' /></div><span style="\theight: 40px; line-height: 40px; display: inline-block; width: 70%; word-break: keep-all; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">'+(e.name.replace(/[\u00A0-\u9999<>\&]/g,(function(e){return"&#"+e.charCodeAt(0)+";"}))+"</span>"),r.onclick=()=>{document.body.removeChild(d),t(e.id)},s.appendChild(r)}})})}(t);return await zV(r,e)}async function ZV(e){let t=["window","screen"];"application"!==e&&"window"!==e||(t=["window"]),"screen"===e&&(t=["screen"]);const r=ej();if(!r)throw new eD($N.ELECTRON_IS_NULL);let i=null;try{i=r.desktopCapturer.getSources({types:t})}catch(e){i=null}i&&i.then||(i=new ny((e,i)=>{r.desktopCapturer.getSources({types:t},(t,r)=>{t?i(t):e(r)})}));try{return await i}catch(e){throw new eD($N.ELECTRON_DESKTOP_CAPTURER_GET_SOURCES_ERROR,e.toString())}}let $V=null;function ej(){if($V)return $V;try{return $V=window.require("electron"),$V}catch(e){return null}}const tj=new kV("safari");let rj=!1,ij=!1;async function nj(e,t){let r=0,i=null;for(;r<2;)try{i=await oj(e,t,r>0);break}catch(i){if(i instanceof eD)throw cD.error("[".concat(t,"] ").concat(i.toString())),OD("error",[],"getLocalStream",{config:e,id:t},i.toString()),i;const n=sj(i.name||i.code||i,i.message);if(n.code===$N.MEDIA_OPTION_INVALID){cD.debug("[".concat(t,"] detect media option invalid, retry")),RD("debug",[],"[".concat(t,"] detect media option invalid, retry")),r+=1,await _G(500);continue}throw cD.error("[".concat(t,"] ").concat(n.toString())),OD("error",[],"getLocalStream",{config:e,id:t},n.toString()),n}if(!i)throw new eD($N.UNEXPECTED_ERROR,"can not find stream after getUserMedia");return i}async function oj(e,t,r){if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new eD($N.NOT_SUPPORTED,"can not find getUserMedia");r&&(e.video&&(delete e.video.width,delete e.video.height),e.screen&&(delete e.screen.width,delete e.screen.height));const i=BP(),n=new MediaStream;if(e.audioSource&&n.addTrack(e.audioSource),e.videoSource&&n.addTrack(e.videoSource),!e.audio&&!e.video&&!e.screen)return cD.debug("Using Video Source/ Audio Source"),RD("debug",[],"Using Video Source/ Audio Source"),n;if(e.screen)if(ej())if(e.screen.sourceId){aj(n,await zV(e.screen.sourceId,e.screen))}else{aj(n,await XV(e.screen))}else if(lO()&&e.screen.extensionId&&e.screen.mandatory){if(!i.getStreamFromExtension)throw new eD($N.NOT_SUPPORTED,"This browser does not support screen sharing");cD.debug("[".concat(t,'] Screen access on chrome stable, looking for extension"')),RD("debug",[],"[".concat(t,'] Screen access on chrome stable, looking for extension"'));const r=await(o=e.screen.extensionId,s=t,new ny((e,t)=>{try{chrome.runtime.sendMessage(o,{getStream:!0},r=>{if(!r||!r.streamId)return cD.error("[".concat(s,"] No response from Chrome Plugin. Plugin not installed properly"),r),OD("error",[],"getSourceIdFromExtension",{extensionId:o,streamId:s},"No response from Chrome Plugin. Plugin not installed properly, ".concat(r)),void t(new eD($N.CHROME_PLUGIN_NO_RESPONSE,"No response from Chrome Plugin. Plugin not installed properly"));e(r.streamId)})}catch(e){cD.error("[".concat(s,"] AgoraRTC screensharing plugin is not accessible(").concat(o,")"),e.toString()),OD("error",[],"getSourceIdFromExtension",{extensionId:o,streamId:s},"AgoraRTC screensharing plugin is not accessible(".concat(o,"), ").concat(e.toString())),t(new eD($N.CHROME_PLUGIN_NOT_INSTALL))}}));e.screen.mandatory.chromeMediaSourceId=r;aj(n,await navigator.mediaDevices.getUserMedia({video:{mandatory:e.screen.mandatory}}))}else if(i.getDisplayMedia){e.screen.mediaSource&&IP(e.screen.mediaSource);const r={width:e.screen.width,height:e.screen.height,frameRate:e.screen.frameRate,displaySurface:"screen"===e.screen.mediaSource?"monitor":e.screen.mediaSource};cD.debug("[".concat(t,"] getDisplayMedia:"),JSON.stringify({video:r,audio:!!e.screenAudio})),ND("debug",["mediaDevices",t],"getDisplayMedia",{video:r,audio:!!e.screenAudio,trackId:t});aj(n,await navigator.mediaDevices.getDisplayMedia({video:r,audio:!!e.screenAudio}))}else{if(!gO())throw cD.error("[".concat(t,"] This browser does not support screenSharing")),new eD($N.NOT_SUPPORTED,"This browser does not support screen sharing");{e.screen.mediaSource&&IP(e.screen.mediaSource);const r={video:{mediaSource:e.screen.mediaSource,width:e.screen.width,height:e.screen.height,frameRate:e.screen.frameRate}};cD.debug("[".concat(t,"] getUserMedia: ").concat(JSON.stringify(r))),ND("debug",["mediaDevices",t],"getUserMedia",r);aj(n,await navigator.mediaDevices.getUserMedia(r))}}var o,s;if(!e.video&&!e.audio)return n;let a={video:e.video,audio:e.audio},c=WD("MEDIA_DEVICE_CONSTRAINTS");if(c)try{"string"==typeof c&&(c=JSON.parse(c)),a=function e(t,r){if(!jG(t)||!jG(r))return r;if(Array.isArray(t)&&!Array.isArray(r)||!Array.isArray(t)&&Array.isArray(r))return r;if(Array.isArray(r)&&Array.isArray(t)){const i=[...t];for(let n=0;n<r.length;n++)i[n]=e(t[n],r[n]);return i}{const i=IG({},t);for(const n in r)Object.prototype.hasOwnProperty.call(r,n)&&(Object.prototype.hasOwnProperty.call(t,n)?i[n]=e(t[n],r[n]):i[n]=r[n]);return i}}(a,c),RD("debug",["mediaDevices",t],"merge configConstraints ".concat(JSON.stringify(c)))}catch(e){}cD.debug("[".concat(t,"] GetUserMedia"),JSON.stringify(a)),ND("debug",["mediaDevices",t],"getUserMedia",a),oO();let d,u=null;(pO()||fO()||uO())&&(u=await tj.lock());try{d=await navigator.mediaDevices.getUserMedia(a)}catch(e){throw u&&u(),e}return a.audio&&(rj=!0),a.video&&(ij=!0),aj(n,d),u&&u(),n}function sj(e,t){switch(e){case"Starting video failed":case"OverconstrainedError":case"TrackStartError":return new eD($N.MEDIA_OPTION_INVALID,"".concat(e,": ").concat(t));case"NotFoundError":case"DevicesNotFoundError":return new eD($N.DEVICE_NOT_FOUND,"".concat(e,": ").concat(t));case"NotSupportedError":return new eD($N.NOT_SUPPORTED,"".concat(e,": ").concat(t));case"NotReadableError":return new eD($N.NOT_READABLE,"".concat(e,": ").concat(t));case"InvalidStateError":case"NotAllowedError":case"PERMISSION_DENIED":case"PermissionDeniedError":return new eD($N.PERMISSION_DENIED,"".concat(e,": ").concat(t));case"ConstraintNotSatisfiedError":return new eD($N.CONSTRAINT_NOT_SATISFIED,"".concat(e,": ").concat(t));default:return cD.error("getUserMedia unexpected error",e),OD("error",[],"handleGetUserMediaError",void 0,e),new eD($N.UNEXPECTED_ERROR,"".concat(e,": ").concat(t))}}function aj(e,t){const r=e.getVideoTracks()[0],i=e.getAudioTracks()[0],n=t.getVideoTracks()[0],o=t.getAudioTracks()[0];o&&(i&&e.removeTrack(i),e.addTrack(o)),n&&(r&&e.removeTrack(r),e.addTrack(n))}const cj=new class extends XN{get state(){return this._state}set state(e){e!==this._state&&(this.emit(Ik.STATE_CHANGE,e),this._state=e)}constructor(){super(),kO(this,"_state",Ek.IDLE),kO(this,"isAccessMicrophonePermission",!1),kO(this,"isAccessCameraPermission",!1),kO(this,"lastAccessMicrophonePermission",!1),kO(this,"lastAccessCameraPermission",!1),kO(this,"checkdeviceMatched",!1),kO(this,"deviceInfoMap",new Map),this.init().then(()=>{navigator.mediaDevices.addEventListener&&navigator.mediaDevices.addEventListener("devicechange",this.updateDevicesInfo.bind(this)),window.setInterval(()=>{(WD("ENUMERATE_DEVICES_INTERVAL")||RO()&&yO())&&this.updateDevicesInfo()},WD("ENUMERATE_DEVICES_INTERVAL_TIME"))}).catch(e=>cD.error(e.toString()))}async enumerateDevices(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!navigator.mediaDevices||!navigator.mediaDevices.enumerateDevices){return new eD($N.NOT_SUPPORTED,"enumerateDevices() not supported.").throw()}const i=await navigator.mediaDevices.enumerateDevices(),n=this.checkMediaDeviceInfoIsOk(i);let o=!this.isAccessMicrophonePermission&&e,s=!this.isAccessCameraPermission&&t;n.audio&&(o=!1),n.video&&(s=!1);let a=null,c=null,d=null;if(!r&&(o||s)){if(tj.isLocked){cD.debug("[device manager] wait GUM lock");(await tj.lock())(),cD.debug("[device manager] GUM unlock")}if(rj&&(o=!1,this.isAccessMicrophonePermission=!0),ij&&(s=!1,this.isAccessCameraPermission=!0),cD.debug("[device manager] check media device permissions",e,t,o,s),o&&s){try{d=await navigator.mediaDevices.getUserMedia({audio:!0,video:!0})}catch(e){const t=sj(e.name||e.code||e,e.message);if(t.code===$N.PERMISSION_DENIED)throw t;cD.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0,this.isAccessMicrophonePermission=!0}else if(o){try{a=await navigator.mediaDevices.getUserMedia({audio:e})}catch(e){const t=sj(e.name||e.code||e,e.message);if(t.code===$N.PERMISSION_DENIED)throw t;cD.warning("getUserMedia failed in getDevices",t)}this.isAccessMicrophonePermission=!0}else if(s){try{c=await navigator.mediaDevices.getUserMedia({video:t})}catch(e){const t=sj(e.name||e.code||e,e.message);if(t.code===$N.PERMISSION_DENIED)throw t;cD.warning("getUserMedia failed in getDevices",t)}this.isAccessCameraPermission=!0}cD.debug("[device manager] mic permission",e,"cam permission",t)}try{const e=await navigator.mediaDevices.enumerateDevices();return a&&a.getTracks().forEach(e=>e.stop()),c&&c.getTracks().forEach(e=>e.stop()),d&&d.getTracks().forEach(e=>e.stop()),a=null,c=null,d=null,e}catch(e){a&&a.getTracks().forEach(e=>e.stop()),c&&c.getTracks().forEach(e=>e.stop()),d&&d.getTracks().forEach(e=>e.stop()),a=null,c=null,d=null;return new eD($N.ENUMERATE_DEVICES_FAILED,e.toString()).throw()}}async getRecordingDevices(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!0,!1,e)).filter(e=>"audioinput"===e.kind)}async getCamerasDevices(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!1,!0,e)).filter(e=>"videoinput"===e.kind)}async getSpeakers(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return(await this.enumerateDevices(!0,!1,e)).filter(e=>"audiooutput"===e.kind)}searchDeviceIdByName(e){let t=null;return this.deviceInfoMap.forEach(r=>{r.device.label===e&&(t=r.device.deviceId)}),t}async getDeviceById(e){const t=(await this.enumerateDevices(!0,!0,!0)).find(t=>t.deviceId===e);if(!t)throw new eD($N.DEVICE_NOT_FOUND,"deviceId: ".concat(e));return t}async init(){this.state=Ek.INITING;try{await this.updateDevicesInfo(),this.state=Ek.INITEND}catch(e){if(cD.warning("Device Detection functionality cannot start properly.",e.toString()),this.state=Ek.IDLE,!function(){if("boolean"==typeof isSecureContext)return isSecureContext;return"https:"===location.protocol||"file:"===location.protocol||"localhost"===location.hostname||"127.0.0.1"===location.hostname||"::1"===location.hostname}()){new eD($N.WEB_SECURITY_RESTRICT,"Your context is limited by web security, please try using https protocol or localhost.").throw()}throw e}}async updateDevicesInfo(){const e=await this.enumerateDevices(!0,!0,!0),t=Date.now(),r=[];if(e[0]&&e[0].label&&!1===this.checkdeviceMatched){this.checkdeviceMatched=!0;const t=e.find(e=>"audioinput"===e.kind&&"default"===e.deviceId),r=e.find(e=>"audiooutput"===e.kind&&"default"===e.deviceId);t&&r?r.groupId===t.groupId?cD.debug("[device-check] default input ".concat(t.label," and output ").concat(r.label," is the same group")):cD.warning("[device-check] default input ".concat(t.label," and output ").concat(r.label," is not the same group")):cD.debug("[device-check] default input or output not found")}const i=this.checkMediaDeviceInfoIsOk(e);if(e.forEach(e=>{if(!e.deviceId)return;const i=this.deviceInfoMap.get("".concat(e.kind,"_").concat(e.deviceId));if("ACTIVE"!==(i?i.state:"INACTIVE")){const i={initAt:t,updateAt:t,device:e,state:"ACTIVE"};this.deviceInfoMap.set("".concat(e.kind,"_").concat(e.deviceId),i),r.push(i)}i&&(i.updateAt=t)}),this.deviceInfoMap.forEach((e,i)=>{"ACTIVE"===e.state&&e.updateAt!==t&&(e.state="INACTIVE",r.push(e))}),this.state!==Ek.INITEND)return i.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),void(i.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0));r.forEach(e=>{switch(e.device.kind){case"audioinput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(Ik.RECORDING_DEVICE_CHANGED,e);break;case"videoinput":this.lastAccessCameraPermission&&this.isAccessCameraPermission&&this.emit(Ik.CAMERA_DEVICE_CHANGED,e);break;case"audiooutput":this.lastAccessMicrophonePermission&&this.isAccessMicrophonePermission&&this.emit(Ik.PLAYOUT_DEVICE_CHANGED,e)}}),i.audio&&(this.lastAccessMicrophonePermission=!0,this.isAccessMicrophonePermission=!0),i.video&&(this.lastAccessCameraPermission=!0,this.isAccessCameraPermission=!0)}checkMediaDeviceInfoIsOk(e){const t=e.filter(e=>"audioinput"===e.kind),r=e.filter(e=>"videoinput"===e.kind),i={audio:!1,video:!1};for(const e of t)if(e.label&&e.deviceId){i.audio=!0;break}for(const e of r)if(e.label&&e.deviceId){i.video=!0;break}return i}};var dj;let uj=LD("AudioElementPlayCenter")(dj=class{constructor(){kO(this,"onAutoplayFailed",void 0),kO(this,"elementMap",new Map),kO(this,"elementStateMap",new Map),kO(this,"elementsNeedToResume",[]),kO(this,"sinkIdMap",new Map),kO(this,"autoResumeAfterInterruption",()=>{Array.from(this.elementMap.entries()).forEach(e=>{let[t,r]=e;const i=this.elementStateMap.get(t),n=r.srcObject.getAudioTracks()[0];EO()?n&&"live"===n.readyState&&"running"===FV.curState&&(cD.debug("auto resume after interruption for iOS 15"),RD("debug",["AudioElementPlayCenter",t],"auto resume after interruption for iOS15"),r.pause(),r.play()):i&&"paused"===i&&n&&"live"===n.readyState&&"running"===FV.curState&&(cD.debug("auto resume after interruption for iOS"),RD("debug",["AudioElementPlayCenter",t],"auto resume after interruption for iOS"),r.play())})}),kO(this,"autoResumeAfterInterruptionOnIOS15",()=>{Array.from(this.elementMap.entries()).forEach(e=>{let[t,r]=e;const i=r.srcObject.getAudioTracks()[0];i&&"live"===i.readyState&&(cD.debug("auto resume after interruption inside autoResumeAfterInterruptionOnIOS15"),OD("debug",["AudioElementPlayCenter",t],"autoResumeAfterInterruptionOnIOS15"),r.pause(),r.play())})}),this.autoResumeAudioElement(),FV.on(OV.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),FV.on(OV.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15),FV.on(OV.STATE_CHANGE,()=>{fO()&&"suspended"===FV.prevState&&"running"===FV.curState&&this.autoResumeAfterInterruption()})}async setSinkID(e,t){const r=this.elementMap.get(e);if(this.sinkIdMap.set(e,t),r)try{await r.setSinkId(t)}catch(e){throw new eD($N.PERMISSION_DENIED,"can not set sink id: "+e.toString())}}play(e,t,r,i){if(this.elementMap.has(t))return;const n=document.createElement("audio");n.autoplay=!0,n.srcObject=new MediaStream([e]),this.bindAudioElementEvents(t,n),this.elementMap.set(t,n),this.elementStateMap.set(t,ck.INIT),this.setVolume(t,r);const o=this.sinkIdMap.get(t);if(o)try{n.setSinkId(o).catch(e=>{cD.warning("[".concat(t,"] set sink id failed"),e.toString()),ND("warning",["HTMLAudioElement",t],"setSinkId",e.toString())})}catch(e){cD.warning("[".concat(t,"] set sink id failed"),e.toString())}const s=n.play();s&&s.then&&s.catch(e=>{i&&wV.autoplayFailed(i,"audio",e.message,t),cD.warning("audio element play warning",e.toString()),ND("warning",["HTMLAudioElement",t],"play",e.toString()),this.elementMap.has(t)&&"NotAllowedError"===e.name&&(cD.warning("detected audio element autoplay failed"),OD("warning",["AudioElementPlayCenter",t],"play",e.toString()),this.elementsNeedToResume.push(n),kG(()=>{this.onAutoplayFailed&&this.onAutoplayFailed(),CV()}))})}updateTrack(e,t){const r=this.elementMap.get(e);r&&(r.srcObject=new MediaStream([t]))}isPlaying(e){return this.elementMap.has(e)}setVolume(e,t){const r=this.elementMap.get(e);r&&(t=Math.max(0,Math.min(100,t)),r.volume=t/100)}stop(e){const t=this.elementMap.get(e);if(this.sinkIdMap.delete(e),!t)return;const r=this.elementsNeedToResume.indexOf(t);this.elementsNeedToResume.splice(r,1),t.srcObject=null,t.remove(),this.elementMap.delete(e),this.elementStateMap.delete(e)}bindAudioElementEvents(e,t){Aj.forEach(r=>{t.addEventListener(r,t=>{const r=this.elementStateMap.get(e),i="pause"===t.type?"paused":t.type;cD.debug("[".concat(e,"] audio-element-status change ").concat(r," => ").concat(i)),bD("debug",["HTMLAudioElement",e],"statusChange","".concat(r," => ").concat(i)),this.elementStateMap.set(e,i)})})}getPlayerState(e){return this.elementStateMap.get(e)||"uninit"}autoResumeAudioElement(){const e=()=>{this.elementsNeedToResume.forEach(e=>{e.play().then(e=>{cD.debug("Auto resume audio element success"),OD("debug",["AudioElementPlayCenter"],"autoResumeAudioElement")}).catch(e=>{cD.warning("Auto resume audio element failed!",e),OD("warning",["AudioElementPlayCenter"],"autoResumeAudioElement",e.toString())})}),this.elementsNeedToResume=[]};new ny(e=>{document.body?e():window.addEventListener("load",()=>e())}).then(()=>{const t=oO();"Android"!==t.os||"Chrome"!==t.name&&t.name!==tO.WECHAT?(document.body.addEventListener("touchstart",e,!0),document.body.addEventListener("mousedown",e,!0)):document.body.addEventListener("click",e,!0)})}})||dj;const Aj=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended"],hj=new uj;function lj(){return function(e,t,r){const i=e[t];"function"==typeof i&&(r.value=function(){this._isClosed&&new eD($N.INVALID_OPERATION,"[".concat(this.getTrackId(),"] cannot operate a closed track")).print("warning");for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const n=i.apply(this,t);return n instanceof ny?new ny((e,t)=>{n.then(e).catch(t)}):n})}}var pj,gj,fj,Ej,Ij,mj,_j,Cj,vj,Sj,yj,Rj,Tj,wj,bj,Oj,Nj,Dj,Lj,kj,Pj,Bj,Mj,Uj,Qj,xj,Fj,Vj;function jj(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function Gj(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jj(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jj(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let Kj=(pj=LD("LocalAudioTrack","getTrackId"),gj=lj(),fj=PV("LocalAudioTrack","_enabledMutex"),Ej=lj(),Ij=PV("LocalAudioTrack","_enabledMutex"),mj=lj(),_j=TV({report:wV}),Cj=lj(),vj=lj(),Sj=lj(),yj=lj(),pj((qF((Tj=class extends BV{get isPlaying(){return this._useAudioElement?hj.isPlaying(this.getTrackId()):this._source.isPlayed}constructor(e,t,r){super(e,r),kO(this,"trackMediaType","audio"),kO(this,"_encoderConfig",void 0),kO(this,"_source",void 0),kO(this,"_enabled",!0),kO(this,"_volume",100),kO(this,"_useAudioElement",!1),kO(this,"_bypassWebAudio",!1),kO(this,"processor",void 0),kO(this,"processorContext",void 0),kO(this,"processorDestination",void 0),this._encoderConfig=t,this._source=new qV(e),WD("LOCAL_AUDIO_TRACK_USES_WEB_AUDIO")||(this._useAudioElement=!0),this.processorContext=new qj(this._source.context,this.getTrackId()),this.processorDestination=new Jj(this.processorContext),this.bindProcessorDestinationEvents(),this._source.on(Pk.UPDATE_SOURCE,()=>{this.processor&&this.processor.updateInput({node:this._source.processSourceNode,context:this.processorContext})})}setVolume(e){XL(e,"volume",0,1e3);const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.LOCAL_AUDIO_TRACK_SET_VOLUME,options:[this.getTrackId(),e]},300);this._volume=e,this._source.setVolume(e/100),this._useAudioElement&&hj.setVolume(this.getTrackId(),e);try{if(this._bypassWebAudio)return cD.debug("[".concat(this.getTrackId(),"] setVolume returned because no pass through WebAudio.")),void t.onSuccess();const e=this._source.createOutputTrack();this._mediaStreamTrack!==e&&(this._mediaStreamTrack=e,bG(this,uP.NEED_REPLACE_TRACK,this).then(()=>{cD.debug("[".concat(this.getTrackId(),"] replace web audio track success")),RD("debug",this,"replace web audio track success")}).catch(e=>{cD.warning("[".concat(this.getTrackId(),"] replace web audio track failed"),e),RD("warning",this,"replace web audio track failed ".concat(e.toString()))}))}catch(e){}t.onSuccess()}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}async setPlaybackDevice(e){const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.REMOTE_AUDIO_SET_OUTPUT_DEVICE,options:[this.getTrackId(),e]});if(!this._useAudioElement)throw new eD($N.NOT_SUPPORTED,"your browser does not support setting the audio output device");try{await hj.setSinkID(this.getTrackId(),e)}catch(e){throw t.onError(e),e}t.onSuccess()}async setEnabled(e,t,r){if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(cD.info("[".concat(this.getTrackId(),"] start setEnabled"),e),OD("info",this,"setEnabled",e),e){this._originMediaStreamTrack.enabled=!0;try{r||(this._enabled=!0),await bG(this,uP.NEED_ENABLE_TRACK,this),cD.info("[".concat(this.getTrackId(),"] setEnabled to ").concat(e," success")),OD("info",this,"setEnabled",e,"success")}catch(t){throw r||(this._enabled=!1),cD.error("[".concat(this.getTrackId(),"] setEnabled to true error"),t.toString()),OD("error",this,"setEnabled",e,t.toString()),t}}else{this._originMediaStreamTrack.enabled=!1,r||(this._enabled=!1);try{await bG(this,uP.NEED_DISABLE_TRACK,this)}catch(t){throw r||(this._enabled=!0),cD.error("[".concat(this.getTrackId(),"] setEnabled to false error"),t.toString()),OD("info",this,"setEnabled",e,t.toString()),t}}}async setMuted(e){e!==this._muted&&(this.stateCheck("muted",e),this._muted=e,this._mediaStreamTrack.enabled=!e,cD.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),OD("debug",this,"setMuted",e),e?await bG(this,uP.NEED_MUTE_TRACK,this):await bG(this,uP.NEED_UNMUTE_TRACK,this))}getStats(){MG(()=>{cD.warning("[deprecated] LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead"),RD("warning",this,"LocalAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalAudioStats instead")},"localAudioTrackGetStatsWarning");const e=OG(this,uP.GET_STATS);return e||Gj({},Fk)}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(Pk.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Pk.ON_AUDIO_BUFFER),this._source.on(Pk.ON_AUDIO_BUFFER,t=>e(t))}play(){const e=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.LOCAL_AUDIO_TRACK_PLAY,options:[this.getTrackId()]});cD.debug("[".concat(this.getTrackId(),"] start audio playback")),OD("debug",this,"play"),this._useAudioElement?(cD.debug("[".concat(this.getTrackId(),"] start audio playback in element")),RD("debug",this,"start audio playback in element"),hj.play(this._mediaStreamTrack,this.getTrackId(),this._volume)):this._source.play(),e.onSuccess()}stop(){const e=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.LOCAL_AUDIO_TRACK_STOP,options:[this.getTrackId()]});cD.debug("[".concat(this.getTrackId(),"] stop audio playback")),OD("debug",this,"stop"),this._useAudioElement?hj.stop(this.getTrackId()):this._source.stop(),e.onSuccess()}close(){super.close(),this.unbindProcessorDestinationEvents(),this.unbindProcessorContextEvents(),this.unpipe(),this.processorDestination._source&&this.processorDestination._source.unpipe(),this._source.destroy()}_updatePlayerSource(){cD.debug("[".concat(this.getTrackId(),"] update player source track")),OD("debug",this,"_updatePlayerSource"),this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&hj.updateTrack(this.getTrackId(),this._mediaStreamTrack)}async _updateOriginMediaStreamTrack(e,t){this._originMediaStreamTrack!==e&&(this._originMediaStreamTrack.removeEventListener("ended",this._handleTrackEnded),e.addEventListener("ended",this._handleTrackEnded),t&&this._originMediaStreamTrack.stop(),this._originMediaStreamTrack=e,this.processor&&this.processor.updateInput({track:e,context:this.processorContext}),this._mediaStreamTrack!==this._source.outputTrack?(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await bG(this,uP.NEED_REPLACE_TRACK,this)):this._source.updateTrack(this._originMediaStreamTrack))}renewMediaStreamTrack(e){return ny.resolve(void 0)}pipe(e){if(this._bypassWebAudio)throw new eD($N.INVALID_OPERATION,"Can not process AudioTrack when bypassWebAudio set to true.");if(this.processor===e)return e;if(e._source)throw new eD($N.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,node:this._source.processSourceNode,context:this.processorContext}),e}unpipe(){var e;if(!this.processor)return;const t=this.processor;null===(e=this._source.processSourceNode)||void 0===e||e.disconnect(),this.processor._source=!1,this.processor=void 0,t.reset()}bindProcessorDestinationEvents(){this.processorDestination.on(LP.ON_TRACK,async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await bG(this,uP.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await bG(this,uP.NEED_REPLACE_TRACK,this))}),this.processorDestination.on(LP.ON_NODE,e=>{this._source.processedNode=e})}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(LP.ON_TRACK),this.processorDestination.removeAllListeners(LP.ON_NODE)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(kP.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(kP.REQUEST_CONSTRAINTS)}}).prototype,"setPlaybackDevice",[gj],Object.getOwnPropertyDescriptor(Tj.prototype,"setPlaybackDevice"),Tj.prototype),qF(Tj.prototype,"setEnabled",[fj,Ej],Object.getOwnPropertyDescriptor(Tj.prototype,"setEnabled"),Tj.prototype),qF(Tj.prototype,"setMuted",[Ij,mj,_j],Object.getOwnPropertyDescriptor(Tj.prototype,"setMuted"),Tj.prototype),qF(Tj.prototype,"getStats",[Cj],Object.getOwnPropertyDescriptor(Tj.prototype,"getStats"),Tj.prototype),qF(Tj.prototype,"setAudioFrameCallback",[vj],Object.getOwnPropertyDescriptor(Tj.prototype,"setAudioFrameCallback"),Tj.prototype),qF(Tj.prototype,"play",[Sj],Object.getOwnPropertyDescriptor(Tj.prototype,"play"),Tj.prototype),qF(Tj.prototype,"stop",[yj],Object.getOwnPropertyDescriptor(Tj.prototype,"stop"),Tj.prototype),Rj=Tj))||Rj),Hj=(wj=LD("MicrophoneAudioTrack","getTrackId"),bj=lj(),Oj=PV("MicrophoneAudioTrack","_enabledMutex"),Nj=lj(),wj((qF((Lj=class extends Kj{constructor(e,t,r,i){super(e,t.encoderConfig?HD(t.encoderConfig):{},i),kO(this,"_config",void 0),kO(this,"_deviceName","default"),kO(this,"_constraints",void 0),kO(this,"_originalConstraints",void 0),kO(this,"_enabled",!0),DD("info",this,"constructor",{trackId:i,deviceId:e.label,constraints:r}),this._config=t,this._constraints=r,this._originalConstraints=r,this._deviceName=e.label,"boolean"==typeof t.bypassWebAudio&&(this._bypassWebAudio=t.bypassWebAudio),EO()&&FV.bindInterruptDetectorTrack(this),this.bindProcessorContextEvents()}async setDevice(e){const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.MIC_AUDIO_TRACK_SET_DEVICE,options:[this.getTrackId(),e]});if(cD.info("[".concat(this.getTrackId(),"] start set device to ").concat(e)),OD("info",this,"setDevice",e),this._enabled)try{const t=await cj.getDeviceById(e),r={};r.audio=Gj({},this._constraints),r.audio.deviceId={exact:e},this._originMediaStreamTrack.stop();let i=null;try{i=await nj(r,this.getTrackId())}catch(t){throw cD.error("[".concat(this.getTrackId(),"] setDevice failed"),t.toString()),OD("error",this,"setDevice",e,t.toString()),i=await nj({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(i.getAudioTracks()[0],!1),t}await this._updateOriginMediaStreamTrack(i.getAudioTracks()[0],!1),this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(r){throw t.onError(r),cD.error("[".concat(this.getTrackId(),"] setDevice error"),r.toString()),OD("error",this,"setDevice",e,r.toString()),r}else try{const t=await cj.getDeviceById(e);this._deviceName=t.label,this._config.microphoneId=e,this._constraints.deviceId={exact:e}}catch(r){throw t.onError(r),cD.error("[".concat(this.getTrackId(),"] setDevice error"),r.toString()),OD("error",this,"setDevice",e,r.toString()),r}t.onSuccess(),cD.info("[".concat(this.getTrackId(),"] set device to ").concat(e," success")),OD("info",this,"setDevice",e,"success")}async setEnabled(e,t,r){if(t)return cD.debug("[".concat(this.getTrackId,"] setEnabled false (do not close microphone)")),RD("debug",this,"setEnabled false (do not close microphone)"),await super.setEnabled(e);if(!r){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(cD.info("[".concat(this.getTrackId(),"] start setEnabled"),e),OD("info",this,"setEnabled",e),!e){this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),r||(this._enabled=!1);try{await bG(this,uP.NEED_DISABLE_TRACK,this)}catch(t){throw cD.error("[".concat(this.getTrackId(),"] setEnabled false failed"),t.toString()),OD("error",this,"setEnabled",e,t.toString()),t}return}const i=Gj({},this._constraints),n=cj.searchDeviceIdByName(this._deviceName);n&&!i.deviceId&&(i.deviceId=n);try{r||(this._enabled=!0);const e=await nj({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getAudioTracks()[0],!1),await bG(this,uP.NEED_ENABLE_TRACK,this)}catch(t){throw r||(this._enabled=!1),cD.error("[".concat(this.getTrackId(),"] setEnabled true failed"),t.toString()),OD("error",this,"setEnabled",e,t.toString()),t}cD.info("[".concat(this.getTrackId(),"] setEnabled success")),OD("info",this,"setEnabled",e,"success")}close(){super.close(),EO()&&FV.unbindInterruptDetectorTrack(this)}onTrackEnded(){if((fO()||CO())&&this._enabled&&!this._isClosed&&FV.duringInterruption){const e=async()=>{FV.off(OV.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(cD.debug("[".concat(this.getTrackId(),"] try capture microphone media device for interrupted iOS device.")),RD("debug",this,"try capture microphone media device for interrupted iOS device"),await this.setEnabled(!1),await this.setEnabled(!0))};FV.on(OV.IOS_INTERRUPTION_END,e)}else cD.debug("[".concat(this.getTrackId(),"] track ended")),bD("debug",["MediaStreamTrack",this.getTrackId()],"ended"),this.emit(pP.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=cj.searchDeviceIdByName(this._deviceName);r&&!t.deviceId&&(t.deviceId=r),this._constraints=t,this._originMediaStreamTrack.stop();const i=await nj({audio:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(i.getAudioTracks()[0],!0)}bindProcessorContextEvents(){this.processorContext.on(kP.REQUEST_UPDATE_CONSTRAINTS,async(e,t,r)=>{try{const r=Object.assign({},this._originalConstraints,...e);await this.renewMediaStreamTrack(r),t()}catch(e){r(e)}}),this.processorContext.on(kP.REQUEST_CONSTRAINTS,async e=>{e(this._originMediaStreamTrack.getSettings())})}}).prototype,"setDevice",[bj],Object.getOwnPropertyDescriptor(Lj.prototype,"setDevice"),Lj.prototype),qF(Lj.prototype,"setEnabled",[Oj,Nj],Object.getOwnPropertyDescriptor(Lj.prototype,"setEnabled"),Lj.prototype),Dj=Lj))||Dj),Yj=(kj=LD("BufferSourceAudioTrack","getTrackId"),Pj=lj(),Bj=lj(),Mj=lj(),Uj=lj(),Qj=lj(),kj((qF((Fj=class extends Kj{constructor(e,t,r,i){super(t.createOutputTrack(),r,i),kO(this,"source",void 0),kO(this,"_bufferSource",void 0),DD("info",this,"constructor",{trackId:i}),this.source=e,this._bufferSource=t,this._bufferSource.on(Pk.AUDIO_SOURCE_STATE_CHANGE,e=>{this.emit(pP.SOURCE_STATE_CHANGE,e)});try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(e){}}get currentState(){return this._bufferSource.currentState}get duration(){return this._bufferSource.duration}getCurrentTime(){return this._bufferSource.currentTime}startProcessAudioBuffer(e){const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.BUFFER_AUDIO_TRACK_START,options:[this.getTrackId(),e,this.duration]});e&&this._bufferSource.updateOptions(e),this._bufferSource.startProcessAudioBuffer(),t.onSuccess()}pauseProcessAudioBuffer(){const e=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.BUFFER_AUDIO_TRACK_PAUSE,options:[this.getTrackId()]});this._bufferSource.pauseProcessAudioBuffer(),e.onSuccess()}seekAudioBuffer(e){const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.BUFFER_AUDIO_TRACK_SEEK,options:[this.getTrackId()]});this._bufferSource.seekAudioBuffer(e),t.onSuccess()}resumeProcessAudioBuffer(){const e=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.BUFFER_AUDIO_TRACK_RESUME,options:[this.getTrackId()]});this._bufferSource.resumeProcessAudioBuffer(),e.onSuccess()}stopProcessAudioBuffer(){const e=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.BUFFER_AUDIO_TRACK_STOP,options:[this.getTrackId()]});this._bufferSource.stopProcessAudioBuffer(),e.onSuccess()}}).prototype,"startProcessAudioBuffer",[Pj],Object.getOwnPropertyDescriptor(Fj.prototype,"startProcessAudioBuffer"),Fj.prototype),qF(Fj.prototype,"pauseProcessAudioBuffer",[Bj],Object.getOwnPropertyDescriptor(Fj.prototype,"pauseProcessAudioBuffer"),Fj.prototype),qF(Fj.prototype,"seekAudioBuffer",[Mj],Object.getOwnPropertyDescriptor(Fj.prototype,"seekAudioBuffer"),Fj.prototype),qF(Fj.prototype,"resumeProcessAudioBuffer",[Uj],Object.getOwnPropertyDescriptor(Fj.prototype,"resumeProcessAudioBuffer"),Fj.prototype),qF(Fj.prototype,"stopProcessAudioBuffer",[Qj],Object.getOwnPropertyDescriptor(Fj.prototype,"stopProcessAudioBuffer"),Fj.prototype),xj=Fj))||xj),Wj=LD("MixingAudioTrack","getTrackId")(Vj=class extends Kj{get isActive(){for(const e of this.trackList)if(e._enabled&&!e._isClosed&&!e.muted)return!0;return!1}constructor(){const e=jV().createMediaStreamDestination();super(e.stream.getAudioTracks()[0],void 0,vG(8,"track-mix-")),kO(this,"trackList",void 0),kO(this,"destNode",void 0);try{this._mediaStreamTrack=this._source.createOutputTrack()}catch(e){}this.destNode=e,this.trackList=[]}hasAudioTrack(e){return-1!==this.trackList.indexOf(e)}addAudioTrack(e){if(-1!==this.trackList.indexOf(e))return cD.debug("track ".concat(e.getTrackId()," is already added")),void RD("debug",this,"track already added");cD.debug("add ".concat(e.getTrackId()," to mixing track")),OD("debug",this,"addAudioTrack",e.getTrackId()),e._source.outputNode.connect(this.destNode),this.trackList.push(e),this.updateEncoderConfig()}removeAudioTrack(e){if(-1!==this.trackList.indexOf(e)){cD.debug("remove ".concat(e.getTrackId()," from mixing track")),OD("debug",this,"removeAudioTrack",e.getTrackId());try{e._source.outputNode.disconnect(this.destNode)}catch(e){}DG(this.trackList,e),this.updateEncoderConfig()}}updateEncoderConfig(){const e={};this.trackList.forEach(t=>{t._encoderConfig&&((t._encoderConfig.bitrate||0)>(e.bitrate||0)&&(e.bitrate=t._encoderConfig.bitrate),(t._encoderConfig.sampleRate||0)>(e.sampleRate||0)&&(e.sampleRate=t._encoderConfig.sampleRate),(t._encoderConfig.sampleSize||0)>(e.sampleSize||0)&&(e.sampleSize=t._encoderConfig.sampleSize),t._encoderConfig.stereo&&(e.stereo=!0))}),this._encoderConfig=e}})||Vj;class Jj extends XN{constructor(e){super(),kO(this,"name","AudioProcessorDestination"),kO(this,"ID","0"),kO(this,"inputTrack",void 0),kO(this,"inputNode",void 0),kO(this,"audioProcessorContext",void 0),kO(this,"_source",void 0),this.audioProcessorContext=e}get kind(){return"audio"}get enabled(){return!0}pipe(){throw new eD($N.NOT_SUPPORTED,"AudioProcessorDestination cannot pipe to any other Processor")}unpipe(){throw new eD($N.NOT_SUPPORTED,"VideoProcessor cannot unpipe to any other Processor")}enable(){}disable(){}reset(){this.inputTrack=void 0,this.inputNode=void 0,this.emit(LP.ON_TRACK,void 0),this.emit(LP.ON_NODE,void 0)}updateInput(e){if(e.context!==this.audioProcessorContext)throw new Error("ProcessorContext passed to VideoTrack.processorDestination doesn't match it's belonging VideoTrack's context.\n Probably you are making pipeline like this: audioTrack1.pipe(processor).pipe(audioTrack2.processorDestination).");e.track&&this.inputTrack!==e.track&&(this.inputTrack=e.track,this.emit(LP.ON_TRACK,this.inputTrack)),e.node&&this.inputNode!==e.node&&(this.inputNode=e.node,this.emit(LP.ON_NODE,this.inputNode))}}class qj extends XN{constructor(e,t){super(),kO(this,"constraintsMap",new Map),kO(this,"statsRegistry",[]),kO(this,"audioContext",void 0),kO(this,"trackId",void 0),this.audioContext=e,this.trackId=t}async getConstraints(){return wG(this,kP.REQUEST_CONSTRAINTS)}getAudioContext(){return this.audioContext}async requestApplyConstraints(e,t){var r;return cD.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),bG(this,kP.REQUEST_UPDATE_CONSTRAINTS,Array.from(iV(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return this.constraintsMap.delete(e),bG(this,kP.REQUEST_UPDATE_CONSTRAINTS,Array.from(iV(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find(r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t)||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){}gatherStats(){return this.statsRegistry.map(e=>{let{processorID:t,processorName:r,type:i,cb:n}=e;return{processorID:t,processorName:r,type:i,stats:n()}})}}class zj extends XN{constructor(){super(...arguments),kO(this,"resultStorage",new Map)}setLocalAudioStats(e,t,r){this.record("AUDIO_INPUT_LEVEL_TOO_LOW",e,this.checkAudioInputLevel(r,t)),this.record("SEND_AUDIO_BITRATE_TOO_LOW",e,this.checkSendAudioBitrate(r,t))}setLocalVideoStats(e,t,r){this.record("SEND_VIDEO_BITRATE_TOO_LOW",e,this.checkSendVideoBitrate(r,t)),this.record("FRAMERATE_INPUT_TOO_LOW",e,this.checkFramerateInput(r,t)),this.record("FRAMERATE_SENT_TOO_LOW",e,this.checkFramerateSent(r))}setRemoteAudioStats(e,t){const r=e.getUserId();this.record("AUDIO_OUTPUT_LEVEL_TOO_LOW",r,this.checkAudioOutputLevel(t))}setRemoteVideoStats(e,t){const r=e.getUserId();this.record("RECV_VIDEO_DECODE_FAILED",r,this.checkVideoDecode(t))}record(e,t,r){this.resultStorage.has(e)||this.resultStorage.set(e,{result:[],isPrevNormal:!0});const i=this.resultStorage.get(e);if(i&&(i.result.push(r),i.result.length>=5)){const r=i.result.includes(!0);i.isPrevNormal&&!r&&this.emit("exception",Xj[e],e,t),!i.isPrevNormal&&r&&this.emit("exception",Xj[e]+2e3,e+"_RECOVER",t),i.isPrevNormal=r,i.result=[]}}checkAudioOutputLevel(e){return!(e.receiveBitrate>0&&0===e.receiveLevel)}checkAudioInputLevel(e,t){return t instanceof Wj&&!t.isActive||(!!t.muted||0!==e.sendVolumeLevel)}checkFramerateInput(e,t){let r=null;t._encoderConfig&&t._encoderConfig.frameRate&&(r=dG(t._encoderConfig.frameRate));const i=e.captureFrameRate;return!r||!i||!(r>10&&i<5||r<10&&r>=5&&i<=1)}checkFramerateSent(e){return!(e.captureFrameRate&&e.sendFrameRate&&e.captureFrameRate>5&&e.sendFrameRate<=1)}checkSendVideoBitrate(e,t){return!!t.muted||0!==e.sendBitrate}checkSendAudioBitrate(e,t){return t instanceof Wj&&!t.isActive||(!!t.muted||0!==e.sendBitrate)}checkVideoDecode(e){return 0===e.receiveBitrate||0!==e.decodeFrameRate}}const Xj={FRAMERATE_INPUT_TOO_LOW:1001,FRAMERATE_SENT_TOO_LOW:1002,SEND_VIDEO_BITRATE_TOO_LOW:1003,RECV_VIDEO_DECODE_FAILED:1005,AUDIO_INPUT_LEVEL_TOO_LOW:2001,AUDIO_OUTPUT_LEVEL_TOO_LOW:2002,SEND_AUDIO_BITRATE_TOO_LOW:2003};const Zj=new class{markSubscribeStart(e,t){performance.mark("agora-web-sdk/".concat(e,"/subscribe-").concat(t))}markPublishStart(e,t){performance.mark("agora-web-sdk/".concat(e,"/publish-").concat(t))}measureFromSubscribeStart(e,t){const r=performance.getEntriesByName("agora-web-sdk/".concat(e,"/subscribe-").concat(t));if(r.length>0){const e=r[r.length-1];return Math.round(performance.now()-e.startTime)}return 0}measureFromPublishStart(e,t){const r=performance.getEntriesByName("agora-web-sdk/".concat(e,"/publish-").concat(t));if(r.length>0){const e=r[r.length-1];return Math.round(performance.now()-e.startTime)}return 0}};function $j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function eG(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?$j(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):$j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class tG{constructor(e){kO(this,"store",void 0),kO(this,"onStatsException",void 0),kO(this,"onUploadPublishDuration",void 0),kO(this,"localStats",new Map),kO(this,"remoteStats",new Map),kO(this,"updateStatsInterval",void 0),kO(this,"trafficStats",void 0),kO(this,"trafficStatsPeerList",[]),kO(this,"uplinkStats",void 0),kO(this,"exceptionMonitor",void 0),kO(this,"p2pChannel",void 0),kO(this,"updateStats",()=>{this.p2pChannel&&(this.updateRemoteStats(this.p2pChannel),this.updateLocalStats(this.p2pChannel))}),this.store=e,this.updateStatsInterval=window.setInterval(this.updateStats,1e3),this.exceptionMonitor=new zj,this.exceptionMonitor.on("exception",(e,t,r)=>{this.onStatsException&&this.onStatsException(e,t,r)})}reset(){this.localStats=new Map,this.remoteStats=new Map,this.trafficStats=void 0,this.trafficStatsPeerList=[],this.uplinkStats=void 0}getLocalAudioTrackStats(){return this.localStats.get(RP.LocalAudioTrack)||eG({},Fk)}getLocalVideoTrackStats(){return this.localStats.get(RP.LocalVideoTrack)||eG({},Vk)}getRemoteAudioTrackStats(e){const t=(e,t)=>{if(!this.trafficStats)return t;const r=this.trafficStats.peer_delay.find(t=>t.peer_uid===e);return r&&(t.publishDuration=r.B_ppad+(Date.now()-this.trafficStats.timestamp)),t},r={};if(e){var i;const n=null===(i=this.remoteStats.get(e))||void 0===i?void 0:i.audioStats;n&&(r[e]=t(e,n))}else Array.from(this.remoteStats.entries()).forEach(e=>{let[i,{audioStats:n}]=e;n&&(r[i]=t(i,n))});return r}getRemoteNetworkQualityStats(e){const t={};if(e){var r;const i=null===(r=this.remoteStats.get(e))||void 0===r?void 0:r.networkStats;i&&(t[e]=i)}else Array.from(this.remoteStats.entries()).forEach(e=>{let[r,{networkStats:i}]=e;i&&(t[r]=i)});return t}getRemoteVideoTrackStats(e){const t=(e,t)=>{if(!this.trafficStats)return t;const r=this.trafficStats.peer_delay.find(t=>t.peer_uid===e);return r&&(t.publishDuration=r.B_ppvd+(Date.now()-this.trafficStats.timestamp)),t},r={};if(e){var i;const n=null===(i=this.remoteStats.get(e))||void 0===i?void 0:i.videoStats;n&&(r[e]=t(e,n))}else Array.from(this.remoteStats.entries()).forEach(e=>{let[i,{videoStats:n}]=e;n&&(r[i]=t(i,n))});return r}getRTCStats(){let e=0,t=0,r=0,i=0;const n=this.localStats.get(RP.LocalAudioTrack);n&&(e+=n.sendBytes,t+=n.sendBitrate);const o=this.localStats.get(RP.LocalVideoTrack);o&&(e+=o.sendBytes,t+=o.sendBitrate);const s=this.localStats.get(RP.LocalVideoLowTrack);s&&(e+=s.sendBytes,t+=s.sendBitrate),this.remoteStats.forEach(e=>{let{audioStats:t,videoStats:n}=e;t&&(r+=t.receiveBytes,i+=t.receiveBitrate),n&&(r+=n.receiveBytes,i+=n.receiveBitrate)});let a=1;return this.trafficStats&&(a+=this.trafficStats.peer_delay.length),{Duration:0,UserCount:a,SendBitrate:t,SendBytes:e,RecvBytes:r,RecvBitrate:i,OutgoingAvailableBandwidth:this.uplinkStats?this.uplinkStats.B_uab/1e3:0,RTT:this.trafficStats?2*this.trafficStats.B_acd:0}}addLocalStats(e){this.localStats.set(e,void 0)}removeLocalStats(e){e?this.localStats.delete(e):this.localStats.clear()}addRemoteStats(e){this.remoteStats.set(e,{})}removeRemoteStats(e){e?this.remoteStats.delete(e):this.remoteStats.clear()}addP2PChannel(e){this.p2pChannel=e}updateTrafficStats(e){e.peer_delay=e.peer_delay.filter(e=>void 0!==e.B_ppad||void 0!==e.B_ppvd);e.peer_delay.filter(e=>-1===this.trafficStatsPeerList.indexOf(e.peer_uid)).forEach(e=>{var t;const r=null===(t=this.p2pChannel)||void 0===t?void 0:t.getRemoteMedia(e.peer_uid),i=null!=r&&r.videoSSRC?Zj.measureFromSubscribeStart(this.store.clientId,r.videoSSRC):0,n=null!=r&&r.audioSSRC?Zj.measureFromSubscribeStart(this.store.clientId,r.audioSSRC):0;void 0!==e.B_ppad&&void 0!==e.B_ppvd&&(this.onUploadPublishDuration&&this.onUploadPublishDuration(e.peer_uid,e.B_ppad,e.B_ppvd,i>n?i:n),this.trafficStatsPeerList.push(e.peer_uid))}),this.trafficStats=e}updateUplinkStats(e){this.uplinkStats&&this.uplinkStats.B_fir!==e.B_fir&&cD.debug("[".concat(this.store.clientId,"]: Period fir changes to ").concat(e.B_fir)),this.uplinkStats=e}static isRemoteVideoFreeze(e,t,r){if(!e)return!1;const i=!!r&&t.framesDecodeFreezeTime>r.framesDecodeFreezeTime,n=!r||t.framesDecodeCount>r.framesDecodeCount;return i||!n}static isRemoteAudioFreeze(e){return!!e&&e._isFreeze()}isLocalVideoFreeze(e){return!(!e.inputFrame||!e.sentFrame)&&(e.inputFrame.frameRate>5&&e.sentFrame.frameRate<3)}updateLocalStats(e){Array.from(this.localStats.entries()).forEach(t=>{let[r,i]=t;switch(r){case RP.LocalVideoTrack:case RP.LocalVideoLowTrack:{const t=i,n=eG({},Vk),o=e.getStats(),s=e.getLocalMedia(r);if(o){const r=o.videoSend.find(e=>e.ssrc===(null==s?void 0:s.ssrcs[0].ssrcId));if(r){const i=e.getLocalVideoSize(),o=e.getEncoderConfig(RP.LocalVideoTrack);"H264"!==r.codec&&"VP8"!==r.codec&&"VP9"!==r.codec&&"AV1X"!==r.codec&&"AV1"!==r.codec||(n.codecType=r.codec),n.sendBytes=r.bytes,n.sendBitrate=t?8*Math.max(0,n.sendBytes-t.sendBytes):0,r.inputFrame?(n.captureFrameRate=r.inputFrame.frameRate,n.captureResolutionHeight=r.inputFrame.height,n.captureResolutionWidth=r.inputFrame.width):i&&(n.captureResolutionWidth=i.width,n.captureResolutionHeight=i.height),r.sentFrame?(n.sendFrameRate=r.sentFrame.frameRate,n.sendResolutionHeight=r.sentFrame.height,n.sendResolutionWidth=r.sentFrame.width):i&&(n.sendResolutionWidth=i.width,n.sendResolutionHeight=i.height),r.avgEncodeMs&&(n.encodeDelay=r.avgEncodeMs),o&&o.bitrateMax&&(n.targetSendBitrate=1e3*o.bitrateMax),n.sendPackets=r.packets,n.sendPacketsLost=r.packetsLost,n.totalDuration=t?t.totalDuration+1:1,n.totalFreezeTime=t?t.totalFreezeTime:0,this.isLocalVideoFreeze(r)&&(n.totalFreezeTime+=1)}this.trafficStats&&(n.sendPacketsLost=this.trafficStats.B_pvlr4/100)}this.localStats.set(r,n),n&&s&&this.exceptionMonitor.setLocalVideoStats(this.store.uid,s.track,n);break}case RP.LocalAudioTrack:{const t=i,n=eG({},Fk),o=e.getStats(),s=e.getLocalMedia(r);if(o){const r=o.audioSend.find(e=>e.ssrc===(null==s?void 0:s.ssrcs[0].ssrcId));if(r){if("opus"!==r.codec&&"aac"!==r.codec&&"PCMU"!==r.codec&&"PCMA"!==r.codec&&"G722"!==r.codec||(n.codecType=r.codec),r.inputLevel)n.sendVolumeLevel=Math.round(32767*r.inputLevel);else{const t=e.getLocalAudioVolume();t&&(n.sendVolumeLevel=Math.round(32767*t))}n.sendBytes=r.bytes,n.sendPackets=r.packets,n.sendPacketsLost=r.packetsLost,n.sendBitrate=t?8*Math.max(0,n.sendBytes-t.sendBytes):0}}this.trafficStats&&(n.sendPacketsLost=this.trafficStats.B_pvlr4/100),this.localStats.set(RP.LocalAudioTrack,n),n&&s&&this.exceptionMonitor.setLocalAudioStats(this.store.uid,s.track,n);break}}})}updateRemoteStats(e){Array.from(this.remoteStats.entries()).forEach(t=>{let[r,{videoStats:i,audioStats:n,videoPcStats:o}]=t;const s=n,a=i,c=o,d=eG({},jk),u=eG({},Kk),A=eG({},Gk),{audioTrack:h,videoTrack:l,audioSSRC:p,videoSSRC:g}=e.getRemoteMedia(r),f=e.getStats(),E=null==f?void 0:f.audioRecv.find(e=>e.ssrc===p),I=null==f?void 0:f.videoRecv.find(e=>e.ssrc===g),m=this.trafficStats&&this.trafficStats.peer_delay.find(e=>e.peer_uid===r);if(E&&("opus"!==E.codec&&"aac"!==E.codec&&"PCMU"!==E.codec&&"PCMA"!==E.codec&&"G722"!==E.codec||(d.codecType=E.codec),E.outputLevel?d.receiveLevel=Math.round(32767*E.outputLevel):h&&(d.receiveLevel=Math.round(32767*h.getVolumeLevel())),d.receiveBytes=E.bytes,d.receivePackets=E.packets,d.receivePacketsLost=E.packetsLost,d.packetLossRate=d.receivePacketsLost/(d.receivePackets+d.receivePacketsLost),d.receiveBitrate=s?8*Math.max(0,d.receiveBytes-s.receiveBytes):0,d.totalDuration=s?s.totalDuration+1:1,d.totalFreezeTime=s?s.totalFreezeTime:0,d.freezeRate=d.totalFreezeTime/d.totalDuration,d.receiveDelay=E.jitterBufferMs,d.totalDuration>10&&tG.isRemoteAudioFreeze(h)&&(d.totalFreezeTime+=1)),I){"H264"!==I.codec&&"VP8"!==I.codec&&"VP9"!==I.codec&&"AV1X"!==I.codec&&"AV1"!==I.codec||(u.codecType=I.codec),u.receiveBytes=I.bytes,u.receiveBitrate=a?8*Math.max(0,u.receiveBytes-a.receiveBytes):0,u.decodeFrameRate=I.decodeFrameRate<0?0:I.decodeFrameRate,u.renderFrameRate=I.decodeFrameRate<0?0:I.decodeFrameRate,I.outputFrame&&(u.renderFrameRate=I.outputFrame.frameRate),I.receivedFrame?(u.receiveFrameRate=I.receivedFrame.frameRate,u.receiveResolutionHeight=I.receivedFrame.height,u.receiveResolutionWidth=I.receivedFrame.width):l&&(u.receiveResolutionHeight=l._videoHeight||0,u.receiveResolutionWidth=l._videoWidth||0),void 0!==I.framesRateFirefox&&(u.receiveFrameRate=Math.round(I.framesRateFirefox)),u.receivePackets=I.packets,u.receivePacketsLost=I.packetsLost,u.packetLossRate=u.receivePacketsLost/(u.receivePackets+u.receivePacketsLost),u.totalDuration=a?a.totalDuration+1:1,u.totalFreezeTime=a?a.totalFreezeTime:0,u.receiveDelay=I.jitterBufferMs||0;const t=!!g&&e.getRemoteVideoIsReady(g);l&&t&&tG.isRemoteVideoFreeze(l,I,c)&&(u.totalFreezeTime+=1),u.freezeRate=u.totalFreezeTime/u.totalDuration}m&&(d.end2EndDelay=m.B_ad,u.end2EndDelay=m.B_vd,d.transportDelay=m.B_ed,u.transportDelay=m.B_ed,d.currentPacketLossRate=m.B_ealr4/100,u.currentPacketLossRate=m.B_evlr4/100,A.uplinkNetworkQuality=m.B_punq?m.B_punq:0,A.downlinkNetworkQuality=m.B_pdnq?m.B_pdnq:0),this.remoteStats.set(r,{audioStats:d,videoStats:u,videoPcStats:I,networkStats:A}),h&&this.exceptionMonitor.setRemoteAudioStats(h,d),l&&this.exceptionMonitor.setRemoteVideoStats(l,u)})}}function rG(e){return(new TextEncoder).encode(e)}const iG=async e=>function(e,t){let r="";return new Uint8Array(e).forEach(e=>{r+=e.toString(t).padStart(2,"0")}),r}(await crypto.subtle.digest("SHA-256",rG(e)),16);function nG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function oG(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nG(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nG(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function sG(e){if(!e.address||!e.tcp)throw new eD($N.UNEXPECTED_RESPONSE,"Invalid address format ".concat(e));return e.address.match(/^[\.\:\d]+$/)?"".concat(e.address.replace(/[^\d]/g,"-"),".edge.agora.io"):(cD.info("Cannot recognized as IP address ".concat(e.address,". Used As Host instead")),"".concat(e.address,":").concat(e.tcp))}function aG(e){return e.match(/^[\.\:\d]+$/)?"".concat(e.replace(/[^\d]/g,"-"),".").concat(WD("TURN_DOMAIN")):(cD.info("Cannot recognized as IP address ".concat(e,". Used As Host instead")),e)}function cG(e,t){const r=WD("GATEWAY_DOMAINS");let i=r[1]&&-1!==t.indexOf(r[1])?1:0;e.addresses=e.addresses||[];return{gatewayAddrs:e.addresses.map(e=>e.domain_prefix?{address:"".concat(e.domain_prefix,".").concat(r[i++%r.length],":").concat(e.port)}:e.ip.match(/^[\.\:\d]+$/)?{ip:e.ip,port:e.port,address:"".concat(e.ip.replace(/[^\d]/g,"-"),".").concat(r[i++%r.length],":").concat(e.port)}:(cD.info("Cannot recognized as IP address ".concat(e.ip,". Used As Host instead")),{ip:e.ip,port:e.port,address:"".concat(e.ip,":").concat(e.port)})),uid:e.uid,cid:e.cid,vid:e.detail&&e.detail[8],uni_lbs_ip:e.detail&&e.detail[1],res:e,csIp:e.detail&&e.detail[502]}}function dG(e){return"number"==typeof e?e:e.exact||e.ideal||e.max||e.min||0}function uG(e){const t=e._encoderConfig;if(!t)return{};const r={resolution:t.width&&t.height?"".concat(dG(t.width),"x").concat(dG(t.height)):void 0,maxVideoBW:t.bitrateMax,minVideoBW:t.bitrateMin};return"number"==typeof t.frameRate?(r.maxFrameRate=t.frameRate,r.minFrameRate=t.frameRate):t.frameRate&&(r.maxFrameRate=t.frameRate.max||t.frameRate.ideal||t.frameRate.exact||t.frameRate.min,r.minFrameRate=t.frameRate.min||t.frameRate.ideal||t.frameRate.exact||t.frameRate.max),r}function AG(e,t,r){var i;const n=t.videoSend.find(t=>t.ssrc===e);if(!n)return null;const o=null==r||null===(i=r.videoSend.find(t=>t.ssrc===e))||void 0===i?void 0:i.inputFrame,s={id:vG(10,""),timestamp:new Date(t.timestamp).toISOString(),mediaType:"video",type:"ssrc",ssrc:n.ssrc.toString()};return n.inputFrame&&(o&&n.inputFrame.height===o.height||(s.A_fhi=n.inputFrame.height?n.inputFrame.height.toString():"0"),o&&n.inputFrame.width===o.width||(s.A_fwi=n.inputFrame.width?n.inputFrame.width.toString():"0"),o&&n.inputFrame.frameRate===o.frameRate||(s.A_fri=n.inputFrame.frameRate?n.inputFrame.frameRate.toString():"0")),s}function hG(e){return e>=0&&e<.17?1:e>=.17&&e<.36?2:e>=.36&&e<.59?3:e>=.59&&e<=1?4:e>1?5:0}function lG(e,t){let r,i,n=void 0;switch(t){case Ux.CHOOSE_SERVER:r=4096,i="choose server";break;case Ux.CLOUD_PROXY:r=1048576,i="proxy";break;case Ux.CLOUD_PROXY_5:r=4194304,i="proxy5";break;case Ux.CLOUD_PROXY_FALLBACK:r=4194310,i="proxy fallback";break;default:throw new eD($N.UNEXPECTED_ERROR,"multi unlibs response transformer get unknown service id",{csIp:e.detail&&e.detail[502],retry:!1})}if(e.response_body.forEach(t=>{t.buffer&&t.buffer.flag===r&&(n={code:t.buffer.code,addresses:(t.buffer.edges_services||[]).map(e=>oG(oG({},e),{},{ticket:t.buffer.cert})),server_ts:e.enter_ts,uid:t.buffer.uid,cid:t.buffer.cid,cname:t.buffer.cname,detail:oG(oG({},t.buffer.detail),e.detail),flag:t.buffer.flag,opid:e.opid})}),!n)throw new eD($N.MULTI_UNILBS_RESPONSE_ERROR,"cannot parse response ".concat(i," from multi unilbs response"),{csIp:e.detail&&e.detail[502]});return n}async function pG(e,t){return await ny.all(e.addresses.map(async e=>({address:aG(e.ip),tcpport:e.port,udpport:e.port,username:t&&WD("ENCRYPT_PROXY_USERNAME_AND_PSW")&&window.isSecureContext?t.toString():UD.username,password:t&&WD("ENCRYPT_PROXY_USERNAME_AND_PSW")&&window.isSecureContext?await iG(t.toString()):UD.password})))}function gG(e,t){const r=t._videoHeight||t.getMediaStreamTrack(!0).getSettings().height;return r?r/dG(e.height):4}function fG(e){let{candidateType:t,relayProtocol:r,type:i,address:n,port:o,protocol:s}=e;return"local-candidate"===i?{candidateType:t,relayProtocol:r,protocol:s}:{candidateType:t,relayProtocol:r,address:n,port:o,protocol:s}}function EG(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function IG(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?EG(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EG(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function mG(e){return window.TextEncoder?(new TextEncoder).encode(e).length:e.length}function _G(e){return new ny(t=>{window.setTimeout(t,e)})}function CG(e){const t=new eD($N.TIMEOUT,"timeout");return new ny((r,i)=>{window.setTimeout(()=>i(t),e)})}function vG(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7,t=arguments.length>1?arguments[1]:void 0;const r=Math.random().toString(16).substr(2,e).toLowerCase();return r.length===e?"".concat(t).concat(r):"".concat(t).concat(r)+vG(e-r.length,"")}function SG(){return vG(32,"").toUpperCase()}const yG=()=>{};function RG(e){return new ny((t,r)=>{let i=!1;const n=document.createElement("video");n.setAttribute("autoplay",""),n.setAttribute("muted",""),n.muted=!0,n.autoplay=!0,n.setAttribute("playsinline",""),n.setAttribute("style","position: fixed; top: 0; left: 0; width: 1px; height: 1px"),document.body.appendChild(n);const o=fO()?"canplay":"playing";n.addEventListener(o,()=>{const e=n.videoWidth,r=n.videoHeight;!e&&gO()||(i=!0,n.srcObject=null,n.remove(),t([e,r]))}),n.srcObject=new MediaStream([e]),n.play().catch(yG),setTimeout(()=>{i||(n.srcObject=null,n.remove(),t([n.videoWidth,n.videoHeight]))},4e3)})}function TG(e){return ny.all(e.map(e=>e.then(e=>{throw e},e=>e))).then(e=>{throw e},e=>e)}function wG(e,t){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];return 0===e.getListeners(t).length?ny.reject(new eD($N.UNEXPECTED_ERROR,"can not emit promise")):new ny((r,n)=>{e.emit(t,...i,r,n)})}function bG(e,t){if(0===e.getListeners(t).length)return ny.resolve();for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];return wG(e,t,...i)}function OG(e,t){if(0===e.getListeners(t).length)return null;for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];return NG(e,t,...i)}function NG(e,t){let r=null,i=null;for(var n=arguments.length,o=new Array(n>2?n-2:0),s=2;s<n;s++)o[s-2]=arguments[s];if(e.emit(t,...o,e=>{r=e},e=>{i=e}),null!==i)throw i;if(null===r)throw new eD($N.UNEXPECTED_ERROR,"handler is not sync");return r}function DG(e,t){const r=e.indexOf(t);-1!==r&&e.splice(r,1)}function LG(e){const t=[];return e.forEach(e=>{-1===t.indexOf(e)&&t.push(e)}),t}function kG(e){ny.resolve().then(e)}function PG(e){return JSON.parse(JSON.stringify(e))}const BG={};function MG(e,t){BG[t]||(BG[t]=!0,e())}function UG(e){const t=window.atob(e),r=new Uint8Array(new ArrayBuffer(t.length));for(let e=0;e<t.length;e+=1)r[e]=t.charCodeAt(e);return r}function QG(e){let t="";for(let r=0;r<e.length;r+=1)t+=String.fromCharCode(e[r]);return window.btoa(t)}const xG=new class{constructor(){kO(this,"fnMap",new Map)}throttleByKey(e,t,r,i){for(var n=arguments.length,o=new Array(n>4?n-4:0),s=4;s<n;s++)o[s-4]=arguments[s];if(this.fnMap.has(t)){const n=this.fnMap.get(t);if(n.threshold!==r){n.fn(...n.args),clearTimeout(n.timer);const s=window.setTimeout(()=>{const e=this.fnMap.get(t);e&&e.fn(...e.args),this.fnMap.delete(t)},r);this.fnMap.set(t,{fn:e,threshold:r,timer:s,args:o,skipFn:i})}else n.skipFn&&n.skipFn(...n.args),this.fnMap.set(t,IG(IG({},n),{},{fn:e,args:o,skipFn:i}))}else{const n=window.setTimeout(()=>{const e=this.fnMap.get(t);e&&e.fn(...e.args),this.fnMap.delete(t)},r);this.fnMap.set(t,{fn:e,threshold:r,timer:n,args:o,skipFn:i})}}},FG=xG.throttleByKey.bind(xG),VG=async e=>{let{fragementLength:t,referenceList:r,asyncMapHandler:i,allFailedhandler:n,promisesCollector:o}=e,s=0;const a=t;let c,d=0;const u=async()=>{const e=(()=>{const e=s*a,t=e+a;return r.slice(e,t).map(i)})();o&&o.push(...e);try{c=await TG(e)}catch(e){if(d+=a,s++,!(d>=r.length))return void await u();n(e)}e.forEach(e=>e.cancel())};return await u(),c};function jG(e){return"object"==typeof e&&null!==e&&!(e instanceof RegExp)}var GG=bc,KG=Nu("iterator"),HG=!GG((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,i){t.delete("b"),r+=i+e})),!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[KG]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==r||"x"!==new URL("http://x",void 0).host})),YG=Yc,WG=Bc,JG=qc,qG=bc,zG=Yf,XG=Lf,ZG=zc,$G=Au,eK=hd,tK=Object.assign,rK=Object.defineProperty,iK=WG([].concat),nK=!tK||qG((function(){if(YG&&1!==tK({b:1},tK(rK({},"a",{enumerable:!0,get:function(){rK(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!=tK({},e)[r]||zG(tK({},t)).join("")!=i}))?function(e,t){for(var r=$G(e),i=arguments.length,n=1,o=XG.f,s=ZG.f;i>n;)for(var a,c=eK(arguments[n++]),d=o?iK(zG(c),o(c)):zG(c),u=d.length,A=0;u>A;)a=d[A++],YG&&!JG(s,c,a)||(r[a]=c[a]);return r}:tK,oK=vA,sK=qE,aK=gA,cK=qc,dK=Au,uK=function(e,t,r,i){try{return i?t(oK(r)[0],r[1]):t(r)}catch(t){sK(e,"throw",t)}},AK=SE,hK=K_,lK=th,pK=sL,gK=HE,fK=QE,EK=Qc.Array,IK=Bc,mK=2147483647,_K=/[^\0-\u007E]/,CK=/[.\u3002\uFF0E\uFF61]/g,vK="Overflow: input needs wider integers to process",SK=Qc.RangeError,yK=IK(CK.exec),RK=Math.floor,TK=String.fromCharCode,wK=IK("".charCodeAt),bK=IK([].join),OK=IK([].push),NK=IK("".replace),DK=IK("".split),LK=IK("".toLowerCase),kK=function(e){return e+22+75*(e<26)},PK=function(e,t,r){var i=0;for(e=r?RK(e/700):e>>1,e+=RK(e/t);e>455;)e=RK(e/35),i+=36;return RK(i+36*e/(e+38))},BK=function(e){var t,r,i=[],n=(e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=wK(e,r++);if(n>=55296&&n<=56319&&r<i){var o=wK(e,r++);56320==(64512&o)?OK(t,((1023&n)<<10)+(1023&o)+65536):(OK(t,n),r--)}else OK(t,n)}return t}(e)).length,o=128,s=0,a=72;for(t=0;t<e.length;t++)(r=e[t])<128&&OK(i,TK(r));var c=i.length,d=c;for(c&&OK(i,"-");d<n;){var u=mK;for(t=0;t<e.length;t++)(r=e[t])>=o&&r<u&&(u=r);var A=d+1;if(u-o>RK((mK-s)/A))throw SK(vK);for(s+=(u-o)*A,o=u,t=0;t<e.length;t++){if((r=e[t])<o&&++s>mK)throw SK(vK);if(r==o){for(var h=s,l=36;;){var p=l<=a?1:l>=a+26?26:l-a;if(h<p)break;var g=h-p,f=36-p;OK(i,TK(kK(p+g%f))),h=RK(g/f),l+=36}OK(i,TK(kK(h))),a=PK(s,A,d==c),s=0,d++}}s++,o++}return bK(i,"")},MK=Qc.TypeError,UK=JA,QK=Qc,xK=Rd,FK=qc,VK=Bc,jK=HG,GK=mm,KK=g_,HK=Um,YK=Km,WK=Am,JK=v_,qK=Kc,zK=pu,XK=gA,ZK=kE,$K=vA,eH=md,tH=hI,rH=hE,iH=rd,nH=HE,oH=QE,sH=function(e,t){if(e<t)throw MK("Not enough arguments");return e},aH=IL,cH=Nu("iterator"),dH="URLSearchParams",uH="URLSearchParamsIterator",AH=WK.set,hH=WK.getterFor(dH),lH=WK.getterFor(uH),pH=xK("fetch"),gH=xK("Request"),fH=xK("Headers"),EH=gH&&gH.prototype,IH=fH&&fH.prototype,mH=QK.RegExp,_H=QK.TypeError,CH=QK.decodeURIComponent,vH=QK.encodeURIComponent,SH=VK("".charAt),yH=VK([].join),RH=VK([].push),TH=VK("".replace),wH=VK([].shift),bH=VK([].splice),OH=VK("".split),NH=VK("".slice),DH=/\+/g,LH=Array(4),kH=function(e){return LH[e-1]||(LH[e-1]=mH("((?:%[\\da-f]{2}){"+e+"})","gi"))},PH=function(e){try{return CH(e)}catch(t){return e}},BH=function(e){var t=TH(e,DH," "),r=4;try{return CH(t)}catch(e){for(;r;)t=TH(t,kH(r--),PH);return t}},MH=/[!'()~]|%20/g,UH={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},QH=function(e){return UH[e]},xH=function(e){return TH(vH(e),MH,QH)},FH=YK((function(e,t){AH(this,{type:uH,iterator:nH(hH(e).entries),kind:t})}),"Iterator",(function(){var e=lH(this),t=e.kind,r=e.iterator.next(),i=r.value;return r.done||(r.value="keys"===t?i.key:"values"===t?i.value:[i.key,i.value]),r}),!0),VH=function(e){this.entries=[],this.url=null,void 0!==e&&(eH(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===SH(e,0)?NH(e,1):e:tH(e)))};VH.prototype={type:dH,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,o,s,a,c=oH(e);if(c)for(r=(t=nH(e,c)).next;!(i=FK(r,t)).done;){if(o=(n=nH($K(i.value))).next,(s=FK(o,n)).done||(a=FK(o,n)).done||!FK(o,n).done)throw _H("Expected sequence with length 2");RH(this.entries,{key:tH(s.value),value:tH(a.value)})}else for(var d in e)zK(e,d)&&RH(this.entries,{key:d,value:tH(e[d])})},parseQuery:function(e){if(e)for(var t,r,i=OH(e,"&"),n=0;n<i.length;)(t=i[n++]).length&&(r=OH(t,"="),RH(this.entries,{key:BH(wH(r)),value:BH(yH(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],RH(r,xH(e.key)+"="+xH(e.value));return yH(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var jH=function(){JK(this,GH);var e=arguments.length>0?arguments[0]:void 0;AH(this,new VH(e))},GH=jH.prototype;if(KK(GH,{append:function(e,t){sH(arguments.length,2);var r=hH(this);RH(r.entries,{key:tH(e),value:tH(t)}),r.updateURL()},delete:function(e){sH(arguments.length,1);for(var t=hH(this),r=t.entries,i=tH(e),n=0;n<r.length;)r[n].key===i?bH(r,n,1):n++;t.updateURL()},get:function(e){sH(arguments.length,1);for(var t=hH(this).entries,r=tH(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){sH(arguments.length,1);for(var t=hH(this).entries,r=tH(e),i=[],n=0;n<t.length;n++)t[n].key===r&&RH(i,t[n].value);return i},has:function(e){sH(arguments.length,1);for(var t=hH(this).entries,r=tH(e),i=0;i<t.length;)if(t[i++].key===r)return!0;return!1},set:function(e,t){sH(arguments.length,1);for(var r,i=hH(this),n=i.entries,o=!1,s=tH(e),a=tH(t),c=0;c<n.length;c++)(r=n[c]).key===s&&(o?bH(n,c--,1):(o=!0,r.value=a));o||RH(n,{key:s,value:a}),i.updateURL()},sort:function(){var e=hH(this);aH(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=hH(this).entries,i=XK(e,arguments.length>1?arguments[1]:void 0),n=0;n<r.length;)i((t=r[n++]).value,t.key,this)},keys:function(){return new FH(this,"keys")},values:function(){return new FH(this,"values")},entries:function(){return new FH(this,"entries")}},{enumerable:!0}),GK(GH,cH,GH.entries,{name:"entries"}),GK(GH,"toString",(function(){return hH(this).serialize()}),{enumerable:!0}),HK(jH,dH),UK({global:!0,forced:!jK},{URLSearchParams:jH}),!jK&&qK(fH)){var KH=VK(IH.has),HH=VK(IH.set),YH=function(e){if(eH(e)){var t,r=e.body;if(ZK(r)===dH)return t=e.headers?new fH(e.headers):new fH,KH(t,"content-type")||HH(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),rH(e,{body:iH(0,tH(r)),headers:iH(0,t)})}return e};if(qK(pH)&&UK({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return pH(e,arguments.length>1?YH(arguments[1]):{})}}),qK(gH)){var WH=function(e){return JK(this,EH),new gH(e,arguments.length>1?YH(arguments[1]):{})};EH.constructor=WH,WH.prototype=EH,UK({global:!0,forced:!0},{Request:WH})}}var JH,qH={URLSearchParams:jH,getState:hH},zH=JA,XH=Yc,ZH=HG,$H=Qc,eY=gA,tY=Bc,rY=Gf.f,iY=mm,nY=v_,oY=pu,sY=nK,aY=function(e){var t=dK(e),r=hK(this),i=arguments.length,n=i>1?arguments[1]:void 0,o=void 0!==n;o&&(n=aK(n,i>2?arguments[2]:void 0));var s,a,c,d,u,A,h=fK(t),l=0;if(!h||this==EK&&AK(h))for(s=lK(t),a=r?new this(s):EK(s);s>l;l++)A=o?n(t[l],l):t[l],pK(a,l,A);else for(u=(d=gK(t,h)).next,a=r?new this:[];!(c=cK(u,d)).done;l++)A=o?uK(d,n,[c.value,l],!0):c.value,pK(a,l,A);return a.length=l,a},cY=hL,dY=xS.codeAt,uY=function(e){var t,r,i=[],n=DK(NK(LK(e),CK,"."),".");for(t=0;t<n.length;t++)r=n[t],OK(i,yK(_K,r)?"xn--"+BK(r):r);return bK(i,".")},AY=hI,hY=Um,lY=qH,pY=Am,gY=pY.set,fY=pY.getterFor("URL"),EY=lY.URLSearchParams,IY=lY.getState,mY=$H.URL,_Y=$H.TypeError,CY=$H.parseInt,vY=Math.floor,SY=Math.pow,yY=tY("".charAt),RY=tY(/./.exec),TY=tY([].join),wY=tY(1..toString),bY=tY([].pop),OY=tY([].push),NY=tY("".replace),DY=tY([].shift),LY=tY("".split),kY=tY("".slice),PY=tY("".toLowerCase),BY=tY([].unshift),MY="Invalid scheme",UY="Invalid host",QY="Invalid port",xY=/[a-z]/i,FY=/[\d+-.a-z]/i,VY=/\d/,jY=/^0x/i,GY=/^[0-7]+$/,KY=/^\d+$/,HY=/^[\da-f]+$/i,YY=/[\0\t\n\r #%/:<>?@[\\\]^|]/,WY=/[\0\t\n\r #/:<>?@[\\\]^|]/,JY=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,qY=/[\t\n\r]/g,zY=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)BY(t,e%256),e=vY(e/256);return TY(t,".")}if("object"==typeof e){for(t="",i=function(e){for(var t=null,r=1,i=null,n=0,o=0;o<8;o++)0!==e[o]?(n>r&&(t=i,r=n),i=null,n=0):(null===i&&(i=o),++n);return n>r&&(t=i,r=n),t}(e),r=0;r<8;r++)n&&0===e[r]||(n&&(n=!1),i===r?(t+=r?":":"::",n=!0):(t+=wY(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},XY={},ZY=sY({},XY,{" ":1,'"':1,"<":1,">":1,"`":1}),$Y=sY({},ZY,{"#":1,"?":1,"{":1,"}":1}),eW=sY({},$Y,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),tW=function(e,t){var r=dY(e,0);return r>32&&r<127&&!oY(t,e)?e:encodeURIComponent(e)},rW={ftp:21,file:null,http:80,https:443,ws:80,wss:443},iW=function(e,t){var r;return 2==e.length&&RY(xY,yY(e,0))&&(":"==(r=yY(e,1))||!t&&"|"==r)},nW=function(e){var t;return e.length>1&&iW(kY(e,0,2))&&(2==e.length||"/"===(t=yY(e,2))||"\\"===t||"?"===t||"#"===t)},oW=function(e){return"."===e||"%2e"===PY(e)},sW={},aW={},cW={},dW={},uW={},AW={},hW={},lW={},pW={},gW={},fW={},EW={},IW={},mW={},_W={},CW={},vW={},SW={},yW={},RW={},TW={},wW=function(e,t,r){var i,n,o,s=AY(e);if(t){if(n=this.parse(s))throw _Y(n);this.searchParams=null}else{if(void 0!==r&&(i=new wW(r,!0)),n=this.parse(s,null,i))throw _Y(n);(o=IY(new EY)).bindURL(this),this.searchParams=o}};wW.prototype={type:"URL",parse:function(e,t,r){var i,n,o,s,a,c=this,d=t||sW,u=0,A="",h=!1,l=!1,p=!1;for(e=AY(e),t||(c.scheme="",c.username="",c.password="",c.host=null,c.port=null,c.path=[],c.query=null,c.fragment=null,c.cannotBeABaseURL=!1,e=NY(e,JY,"")),e=NY(e,qY,""),i=aY(e);u<=i.length;){switch(n=i[u],d){case sW:if(!n||!RY(xY,n)){if(t)return MY;d=cW;continue}A+=PY(n),d=aW;break;case aW:if(n&&(RY(FY,n)||"+"==n||"-"==n||"."==n))A+=PY(n);else{if(":"!=n){if(t)return MY;A="",d=cW,u=0;continue}if(t&&(c.isSpecial()!=oY(rW,A)||"file"==A&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=A,t)return void(c.isSpecial()&&rW[c.scheme]==c.port&&(c.port=null));A="","file"==c.scheme?d=mW:c.isSpecial()&&r&&r.scheme==c.scheme?d=dW:c.isSpecial()?d=lW:"/"==i[u+1]?(d=uW,u++):(c.cannotBeABaseURL=!0,OY(c.path,""),d=yW)}break;case cW:if(!r||r.cannotBeABaseURL&&"#"!=n)return MY;if(r.cannotBeABaseURL&&"#"==n){c.scheme=r.scheme,c.path=cY(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,d=TW;break}d="file"==r.scheme?mW:AW;continue;case dW:if("/"!=n||"/"!=i[u+1]){d=AW;continue}d=pW,u++;break;case uW:if("/"==n){d=gW;break}d=SW;continue;case AW:if(c.scheme=r.scheme,n==JH)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=cY(r.path),c.query=r.query;else if("/"==n||"\\"==n&&c.isSpecial())d=hW;else if("?"==n)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=cY(r.path),c.query="",d=RW;else{if("#"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=cY(r.path),c.path.length--,d=SW;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=cY(r.path),c.query=r.query,c.fragment="",d=TW}break;case hW:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,d=SW;continue}d=gW}else d=pW;break;case lW:if(d=pW,"/"!=n||"/"!=yY(A,u+1))continue;u++;break;case pW:if("/"!=n&&"\\"!=n){d=gW;continue}break;case gW:if("@"==n){h&&(A="%40"+A),h=!0,o=aY(A);for(var g=0;g<o.length;g++){var f=o[g];if(":"!=f||p){var E=tW(f,eW);p?c.password+=E:c.username+=E}else p=!0}A=""}else if(n==JH||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==A)return"Invalid authority";u-=aY(A).length+1,A="",d=fW}else A+=n;break;case fW:case EW:if(t&&"file"==c.scheme){d=CW;continue}if(":"!=n||l){if(n==JH||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==A)return UY;if(t&&""==A&&(c.includesCredentials()||null!==c.port))return;if(s=c.parseHost(A))return s;if(A="",d=vW,t)return;continue}"["==n?l=!0:"]"==n&&(l=!1),A+=n}else{if(""==A)return UY;if(s=c.parseHost(A))return s;if(A="",d=IW,t==EW)return}break;case IW:if(!RY(VY,n)){if(n==JH||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=A){var I=CY(A,10);if(I>65535)return QY;c.port=c.isSpecial()&&I===rW[c.scheme]?null:I,A=""}if(t)return;d=vW;continue}return QY}A+=n;break;case mW:if(c.scheme="file","/"==n||"\\"==n)d=_W;else{if(!r||"file"!=r.scheme){d=SW;continue}if(n==JH)c.host=r.host,c.path=cY(r.path),c.query=r.query;else if("?"==n)c.host=r.host,c.path=cY(r.path),c.query="",d=RW;else{if("#"!=n){nW(TY(cY(i,u),""))||(c.host=r.host,c.path=cY(r.path),c.shortenPath()),d=SW;continue}c.host=r.host,c.path=cY(r.path),c.query=r.query,c.fragment="",d=TW}}break;case _W:if("/"==n||"\\"==n){d=CW;break}r&&"file"==r.scheme&&!nW(TY(cY(i,u),""))&&(iW(r.path[0],!0)?OY(c.path,r.path[0]):c.host=r.host),d=SW;continue;case CW:if(n==JH||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&iW(A))d=SW;else if(""==A){if(c.host="",t)return;d=vW}else{if(s=c.parseHost(A))return s;if("localhost"==c.host&&(c.host=""),t)return;A="",d=vW}continue}A+=n;break;case vW:if(c.isSpecial()){if(d=SW,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=JH&&(d=SW,"/"!=n))continue}else c.fragment="",d=TW;else c.query="",d=RW;break;case SW:if(n==JH||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(a=PY(a=A))||"%2e."===a||".%2e"===a||"%2e%2e"===a?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||OY(c.path,"")):oW(A)?"/"==n||"\\"==n&&c.isSpecial()||OY(c.path,""):("file"==c.scheme&&!c.path.length&&iW(A)&&(c.host&&(c.host=""),A=yY(A,0)+":"),OY(c.path,A)),A="","file"==c.scheme&&(n==JH||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)DY(c.path);"?"==n?(c.query="",d=RW):"#"==n&&(c.fragment="",d=TW)}else A+=tW(n,$Y);break;case yW:"?"==n?(c.query="",d=RW):"#"==n?(c.fragment="",d=TW):n!=JH&&(c.path[0]+=tW(n,XY));break;case RW:t||"#"!=n?n!=JH&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":tW(n,XY)):(c.fragment="",d=TW);break;case TW:n!=JH&&(c.fragment+=tW(n,ZY))}u++}},parseHost:function(e){var t,r,i;if("["==yY(e,0)){if("]"!=yY(e,e.length-1))return UY;if(!(t=function(e){var t,r,i,n,o,s,a,c=[0,0,0,0,0,0,0,0],d=0,u=null,A=0,h=function(){return yY(e,A)};if(":"==h()){if(":"!=yY(e,1))return;A+=2,u=++d}for(;h();){if(8==d)return;if(":"!=h()){for(t=r=0;r<4&&RY(HY,h());)t=16*t+CY(h(),16),A++,r++;if("."==h()){if(0==r)return;if(A-=r,d>6)return;for(i=0;h();){if(n=null,i>0){if(!("."==h()&&i<4))return;A++}if(!RY(VY,h()))return;for(;RY(VY,h());){if(o=CY(h(),10),null===n)n=o;else{if(0==n)return;n=10*n+o}if(n>255)return;A++}c[d]=256*c[d]+n,2!=++i&&4!=i||d++}if(4!=i)return;break}if(":"==h()){if(A++,!h())return}else if(h())return;c[d++]=t}else{if(null!==u)return;A++,u=++d}}if(null!==u)for(s=d-u,d=7;0!=d&&s>0;)a=c[d],c[d--]=c[u+s-1],c[u+--s]=a;else if(8!=d)return;return c}(kY(e,1,-1))))return UY;this.host=t}else if(this.isSpecial()){if(e=uY(e),RY(YY,e))return UY;if(null===(t=function(e){var t,r,i,n,o,s,a,c=LY(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],i=0;i<t;i++){if(""==(n=c[i]))return e;if(o=10,n.length>1&&"0"==yY(n,0)&&(o=RY(jY,n)?16:8,n=kY(n,8==o?1:2)),""===n)s=0;else{if(!RY(10==o?KY:8==o?GY:HY,n))return e;s=CY(n,o)}OY(r,s)}for(i=0;i<t;i++)if(s=r[i],i==t-1){if(s>=SY(256,5-t))return null}else if(s>255)return null;for(a=bY(r),i=0;i<r.length;i++)a+=r[i]*SY(256,3-i);return a}(e)))return UY;this.host=t}else{if(RY(WY,e))return UY;for(t="",r=aY(e),i=0;i<r.length;i++)t+=tW(r[i],XY);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return oY(rW,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&iW(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,i=e.password,n=e.host,o=e.port,s=e.path,a=e.query,c=e.fragment,d=t+":";return null!==n?(d+="//",e.includesCredentials()&&(d+=r+(i?":"+i:"")+"@"),d+=zY(n),null!==o&&(d+=":"+o)):"file"==t&&(d+="//"),d+=e.cannotBeABaseURL?s[0]:s.length?"/"+TY(s,"/"):"",null!==a&&(d+="?"+a),null!==c&&(d+="#"+c),d},setHref:function(e){var t=this.parse(e);if(t)throw _Y(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new bW(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+zY(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(AY(e)+":",sW)},getUsername:function(){return this.username},setUsername:function(e){var t=aY(AY(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=tW(t[r],eW)}},getPassword:function(){return this.password},setPassword:function(e){var t=aY(AY(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=tW(t[r],eW)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?zY(e):zY(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,fW)},getHostname:function(){var e=this.host;return null===e?"":zY(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,EW)},getPort:function(){var e=this.port;return null===e?"":AY(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=AY(e))?this.port=null:this.parse(e,IW))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+TY(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,vW))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=AY(e))?this.query=null:("?"==yY(e,0)&&(e=kY(e,1)),this.query="",this.parse(e,RW)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=AY(e))?("#"==yY(e,0)&&(e=kY(e,1)),this.fragment="",this.parse(e,TW)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var bW=function(e){var t=nY(this,OW),r=arguments.length>1?arguments[1]:void 0,i=gY(t,new wW(e,!1,r));XH||(t.href=i.serialize(),t.origin=i.getOrigin(),t.protocol=i.getProtocol(),t.username=i.getUsername(),t.password=i.getPassword(),t.host=i.getHost(),t.hostname=i.getHostname(),t.port=i.getPort(),t.pathname=i.getPathname(),t.search=i.getSearch(),t.searchParams=i.getSearchParams(),t.hash=i.getHash())},OW=bW.prototype,NW=function(e,t){return{get:function(){return fY(this)[e]()},set:t&&function(e){return fY(this)[t](e)},configurable:!0,enumerable:!0}};if(XH&&rY(OW,{href:NW("serialize","setHref"),origin:NW("getOrigin"),protocol:NW("getProtocol","setProtocol"),username:NW("getUsername","setUsername"),password:NW("getPassword","setPassword"),host:NW("getHost","setHost"),hostname:NW("getHostname","setHostname"),port:NW("getPort","setPort"),pathname:NW("getPathname","setPathname"),search:NW("getSearch","setSearch"),searchParams:NW("getSearchParams"),hash:NW("getHash","setHash")}),iY(OW,"toJSON",(function(){return fY(this).serialize()}),{enumerable:!0}),iY(OW,"toString",(function(){return fY(this).serialize()}),{enumerable:!0}),mY){var DW=mY.createObjectURL,LW=mY.revokeObjectURL;DW&&iY(bW,"createObjectURL",eY(DW,mY)),LW&&iY(bW,"revokeObjectURL",eY(LW,mY))}hY(bW,"URL"),zH({global:!0,forced:!ZH,sham:!XH},{URL:bW});var kW=_d.URL;const PW={[mk.ACCESS_POINT]:{[vk.NO_FLAG_SET]:{desc:"flag is zero",retry:!1},[vk.FLAG_SET_BUT_EMPTY]:{desc:"flag is empty",retry:!1},[vk.INVALID_FALG_SET]:{desc:"invalid flag",retry:!1},[vk.FLAG_SET_BUT_NO_RE]:{desc:"flag set unilbs but no request",retry:!1},[vk.INVALID_SERVICE_ID]:{desc:"invalid service id",retry:!1},[vk.NO_SERVICE_AVAILABLE]:{desc:"no service available",retry:!0},[vk.NO_SERVICE_AVAILABLE_P2P]:{desc:"no unilbs p2p service available",retry:!0},[vk.NO_SERVICE_AVAILABLE_VOET]:{desc:"no unilbs voice service available",retry:!0},[vk.NO_SERVICE_AVAILABLE_WEBRTC]:{desc:"no unilbs webrtc service available",retry:!0},[vk.NO_SERVICE_AVAILABLE_CDS]:{desc:"no cds service available",retry:!0},[vk.NO_SERVICE_AVAILABLE_CDN]:{desc:"no cdn dispatcher service available",retry:!0},[vk.NO_SERVICE_AVAILABLE_TDS]:{desc:"no tds service available",retry:!0},[vk.NO_SERVICE_AVAILABLE_REPORT]:{desc:"no unilbs report service available",retry:!0},[vk.NO_SERVICE_AVAILABLE_APP_CENTER]:{desc:"no app center service available",retry:!0},[vk.NO_SERVICE_AVAILABLE_ENV0]:{desc:"no unilbs sig env0 service available",retry:!0},[vk.NO_SERVICE_AVAILABLE_VOET]:{desc:"no unilbs voet service available",retry:!0},[vk.NO_SERVICE_AVAILABLE_STRING_UID]:{desc:"no string uid service available",retry:!0},[vk.NO_SERVICE_AVAILABLE_WEBRTC_UNILBS]:{desc:"no webrtc unilbs service available",retry:!0}},[mk.UNILBS]:{[Ck.INVALID_VENDOR_KEY]:{desc:"invalid vendor key, can not find appid",retry:!1},[Ck.INVALID_CHANNEL_NAME]:{desc:"invalid channel name",retry:!1},[Ck.INTERNAL_ERROR]:{desc:"unilbs internal error",retry:!1},[Ck.NO_AUTHORIZED]:{desc:"invalid token, authorized failed",retry:!1},[Ck.DYNAMIC_KEY_TIMEOUT]:{desc:"dynamic key or token timeout",retry:!1},[Ck.NO_ACTIVE_STATUS]:{desc:"no active status",retry:!1},[Ck.DYNAMIC_KEY_EXPIRED]:{desc:"dynamic key expired",retry:!1},[Ck.STATIC_USE_DYNAMIC_KEY]:{desc:"static use dynamic key",retry:!1},[Ck.DYNAMIC_USE_STATIC_KEY]:{desc:"dynamic use static key",retry:!1},[Ck.USER_OVERLOAD]:{desc:"amount of users over load",retry:!1},[Ck.FORBIDDEN_REGION]:{desc:"the request is forbidden in this area",retry:!1},[Ck.CANNOT_MEET_AREA_DEMAND]:{desc:"unable to allocate services in this area",retry:!1}},[mk.STRING_UID_ALLOCATOR]:{[_k.IIIEGAL_APPID]:{desc:"invalid appid",retry:!1},[_k.IIIEGAL_UID]:{desc:"invalid string uid",retry:!1},[_k.INTERNAL_ERROR]:{desc:"string uid allocator internal error",retry:!0}}};function BW(e){const t=PW[Math.floor(e/1e4)];if(!t)return{desc:"unkonw error",retry:!1};const r=t[e%1e4];if(!r){if(Math.floor(e/1e4)===mk.ACCESS_POINT){const t=e%1e4;if("1"===t.toString()[0])return{desc:e.toString(),retry:!1};if("2"===t.toString()[0])return{desc:e.toString(),retry:!0}}return{desc:"unkonw error",retry:!1}}return r}const MW={[Sk.K_TIMESTAMP_EXPIRED]:{desc:"K_TIMESTAMP_EXPIRED",action:"failed"},[Sk.K_CHANNEL_PERMISSION_INVALID]:{desc:"K_CHANNEL_PERMISSION_INVALID",action:"failed"},[Sk.K_CERTIFICATE_INVALID]:{desc:"K_CERTIFICATE_INVALID",action:"failed"},[Sk.K_CHANNEL_NAME_EMPTY]:{desc:"K_CHANNEL_NAME_EMPTY",action:"failed"},[Sk.K_CHANNEL_NOT_FOUND]:{desc:"K_CHANNEL_NOT_FOUND",action:"failed"},[Sk.K_TICKET_INVALID]:{desc:"K_TICKET_INVALID",action:"failed"},[Sk.K_CHANNEL_CONFLICTED]:{desc:"K_CHANNEL_CONFLICTED",action:"failed"},[Sk.K_SERVICE_NOT_READY]:{desc:"K_SERVICE_NOT_READY",action:"tryNext"},[Sk.K_SERVICE_TOO_HEAVY]:{desc:"K_SERVICE_TOO_HEAVY",action:"tryNext"},[Sk.K_UID_BANNED]:{desc:"K_UID_BANNED",action:"failed"},[Sk.K_IP_BANNED]:{desc:"K_IP_BANNED",action:"failed"},[Sk.ERR_INVALID_VENDOR_KEY]:{desc:"ERR_INVALID_VENDOR_KEY",action:"failed"},[Sk.ERR_INVALID_CHANNEL_NAME]:{desc:"ERR_INVALID_CHANNEL_NAME",action:"failed"},[Sk.WARN_NO_AVAILABLE_CHANNEL]:{desc:"WARN_NO_AVAILABLE_CHANNEL",action:"failed"},[Sk.WARN_LOOKUP_CHANNEL_TIMEOUT]:{desc:"WARN_LOOKUP_CHANNEL_TIMEOUT",action:"tryNext"},[Sk.WARN_LOOKUP_CHANNEL_REJECTED]:{desc:"WARN_LOOKUP_CHANNEL_REJECTED",action:"failed"},[Sk.WARN_OPEN_CHANNEL_TIMEOUT]:{desc:"WARN_OPEN_CHANNEL_TIMEOUT",action:"tryNext"},[Sk.WARN_OPEN_CHANNEL_REJECTED]:{desc:"WARN_OPEN_CHANNEL_REJECTED",action:"failed"},[Sk.WARN_REQUEST_DEFERRED]:{desc:"WARN_REQUEST_DEFERRED",action:"failed"},[Sk.ERR_DYNAMIC_KEY_TIMEOUT]:{desc:"ERR_DYNAMIC_KEY_TIMEOUT",action:"failed"},[Sk.ERR_NO_AUTHORIZED]:{desc:"ERR_NO_AUTHORIZED",action:"failed"},[Sk.ERR_VOM_SERVICE_UNAVAILABLE]:{desc:"ERR_VOM_SERVICE_UNAVAILABLE",action:"tryNext"},[Sk.ERR_NO_CHANNEL_AVAILABLE_CODE]:{desc:"ERR_NO_CHANNEL_AVAILABLE_CODE",action:"failed"},[Sk.ERR_MASTER_VOCS_UNAVAILABLE]:{desc:"ERR_MASTER_VOCS_UNAVAILABLE",action:"tryNext"},[Sk.ERR_INTERNAL_ERROR]:{desc:"ERR_INTERNAL_ERROR",action:"tryNext"},[Sk.ERR_NO_ACTIVE_STATUS]:{desc:"ERR_NO_ACTIVE_STATUS",action:"failed"},[Sk.ERR_INVALID_UID]:{desc:"ERR_INVALID_UID",action:"failed"},[Sk.ERR_DYNAMIC_KEY_EXPIRED]:{desc:"ERR_DYNAMIC_KEY_EXPIRED",action:"failed"},[Sk.ERR_STATIC_USE_DYANMIC_KE]:{desc:"ERR_STATIC_USE_DYANMIC_KE",action:"failed"},[Sk.ERR_DYNAMIC_USE_STATIC_KE]:{desc:"ERR_DYNAMIC_USE_STATIC_KE",action:"failed"},[Sk.ERR_NO_VOCS_AVAILABLE]:{desc:"ERR_NO_VOCS_AVAILABLE",action:"tryNext"},[Sk.ERR_NO_VOS_AVAILABLE]:{desc:"ERR_NO_VOS_AVAILABLE",action:"tryNext"},[Sk.ERR_JOIN_CHANNEL_TIMEOUT]:{desc:"ERR_JOIN_CHANNEL_TIMEOUT",action:"tryNext"},[Sk.ERR_JOIN_BY_MULTI_IP]:{desc:"ERR_JOIN_BY_MULTI_IP",action:"recover"},[Sk.ERR_NOT_JOINED]:{desc:"ERR_NOT_JOINED",action:"failed"},[Sk.ERR_REPEAT_JOIN_REQUEST]:{desc:"ERR_REPEAT_JOIN_REQUEST",action:"quit"},[Sk.ERR_REPEAT_JOIN_CHANNEL]:{desc:"ERR_REPEAT_JOIN_CHANNEL",action:"quit"},[Sk.ERR_INVALID_VENDOR_KEY]:{desc:"ERR_INVALID_VENDOR_KEY",action:"failed"},[Sk.ERR_INVALID_CHANNEL_NAME]:{desc:"ERR_INVALID_CHANNEL_NAME",action:"failed"},[Sk.ERR_INVALID_STRINGUID]:{desc:"ERR_INVALID_STRINGUID",action:"failed"},[Sk.ERR_TOO_MANY_USERS]:{desc:"ERR_TOO_MANY_USERS",action:"tryNext"},[Sk.ERR_SET_CLIENT_ROLE_TIMEOUT]:{desc:"ERR_SET_CLIENT_ROLE_TIMEOUT",action:"failed"},[Sk.ERR_SET_CLIENT_ROLE_NO_PERMISSION]:{desc:"ERR_SET_CLIENT_ROLE_TIMEOUT",action:"failed"},[Sk.ERR_SET_CLIENT_ROLE_ALREADY_IN_USE]:{desc:"ERR_SET_CLIENT_ROLE_ALREADY_IN_USE",action:"success"},[Sk.ERR_PUBLISH_REQUEST_INVALID]:{desc:"ERR_PUBLISH_REQUEST_INVALID",action:"failed"},[Sk.ERR_SUBSCRIBE_REQUEST_INVALID]:{desc:"ERR_SUBSCRIBE_REQUEST_INVALID",action:"failed"},[Sk.ERR_NOT_SUPPORTED_MESSAGE]:{desc:"ERR_NOT_SUPPORTED_MESSAGE",action:"failed"},[Sk.ERR_ILLEAGAL_PLUGIN]:{desc:"ERR_ILLEAGAL_PLUGIN",action:"failed"},[Sk.ILLEGAL_CLIENT_ROLE_LEVEL]:{desc:"ILLEGAL_CLIENT_ROLE_LEVEL",action:"failed"},[Sk.ERR_REJOIN_TOKEN_INVALID]:{desc:"ERR_REJOIN_TOKEN_INVALID",action:"failed"},[Sk.ERR_REJOIN_USER_NOT_JOINED]:{desc:"ERR_REJOIN_NOT_JOINED",action:"failed"},[Sk.ERR_INVALID_OPTIONAL_INFO]:{desc:"ERR_INVALID_OPTIONAL_INFO",action:"quit"},[Sk.ERR_TEST_RECOVER]:{desc:"ERR_TEST_RECOVER",action:"recover"},[Sk.ERR_TEST_TRYNEXT]:{desc:"ERR_TEST_TRYNEXT",action:"recover"},[Sk.ERR_TEST_RETRY]:{desc:"ERR_TEST_RETRY",action:"recover"},[Sk.ILLEGAL_AES_PASSWORD]:{desc:"ERR_TEST_RETRY",action:"failed"},[Sk.ERR_TOO_MANY_BROADCASTERS]:{desc:"ERR_TOO_MANY_BROADCASTERS",action:"failed"},[Sk.ERR_TOO_MANY_SUBSCRIBERS]:{desc:"ERR_TOO_MANY_SUBSCRIBERS",action:"failed"}};function UW(e){const t=MW[e];return t||{desc:"UNKNOW_ERROR_".concat(e),action:"failed"}}var QW={exports:{}};!function(e,t){e.exports=function(){var e={d:function(t,r){for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{DataViewIndexOutOfBoundsError:function(){return F},DecodeError:function(){return I},Decoder:function(){return G},EXT_TIMESTAMP:function(){return m},Encoder:function(){return O},ExtData:function(){return f},ExtensionCodec:function(){return T},decode:function(){return H},decodeArrayStream:function(){return $},decodeAsync:function(){return Z},decodeMulti:function(){return Y},decodeMultiStream:function(){return ee},decodeStream:function(){return te},decodeTimestampExtension:function(){return y},decodeTimestampToTimeSpec:function(){return S},encode:function(){return D},encodeDateToTimeSpec:function(){return C},encodeTimeSpecToTimestamp:function(){return _},encodeTimestampExtension:function(){return v}});var r=4294967295;function i(e,t,r){var i=Math.floor(r/4294967296),n=r;e.setUint32(t,i),e.setUint32(t+4,n)}function n(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}var o=function(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s},s=function(e,t){for(var r=0,i=t.length,n=e.length;r<i;r++,n++)e[n]=t[r];return e},a="undefined"!=typeof TextEncoder&&"undefined"!=typeof TextDecoder;function c(e){for(var t=e.length,r=0,i=0;i<t;){var n=e.charCodeAt(i++);if(0!=(4294967168&n))if(0==(4294965248&n))r+=2;else{if(n>=55296&&n<=56319&&i<t){var o=e.charCodeAt(i);56320==(64512&o)&&(++i,n=((1023&n)<<10)+(1023&o)+65536)}r+=0==(4294901760&n)?3:4}else r++}return r}var d=a?new TextEncoder:void 0,u=a?"undefined"!=typeof process?200:0:r,A=(null==d?void 0:d.encodeInto)?function(e,t,r){d.encodeInto(e,t.subarray(r))}:function(e,t,r){t.set(d.encode(e),r)};function h(e,t,r){for(var i=t,n=i+r,a=[],c="";i<n;){var d=e[i++];if(0==(128&d))a.push(d);else if(192==(224&d)){var u=63&e[i++];a.push((31&d)<<6|u)}else if(224==(240&d)){u=63&e[i++];var A=63&e[i++];a.push((31&d)<<12|u<<6|A)}else if(240==(248&d)){var h=(7&d)<<18|(u=63&e[i++])<<12|(A=63&e[i++])<<6|63&e[i++];h>65535&&(h-=65536,a.push(h>>>10&1023|55296),h=56320|1023&h),a.push(h)}else a.push(d);a.length>=4096&&(c+=String.fromCharCode.apply(String,s([],o(a))),a.length=0)}return a.length>0&&(c+=String.fromCharCode.apply(String,s([],o(a)))),c}var l,p=a?new TextDecoder:null,g=a?"undefined"!=typeof process?200:0:r,f=function(e,t){this.type=e,this.data=t},E=(l=function(e,t){return(l=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}l(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}),I=function(e){function t(r){var i=e.call(this,r)||this,n=Object.create(t.prototype);return Object.setPrototypeOf(i,n),Object.defineProperty(i,"name",{configurable:!0,enumerable:!1,value:t.name}),i}return E(t,e),t}(Error),m=-1;function _(e){var t,r=e.sec,n=e.nsec;if(r>=0&&n>=0&&r<=17179869183){if(0===n&&r<=4294967295){var o=new Uint8Array(4);return(t=new DataView(o.buffer)).setUint32(0,r),o}var s=r/4294967296,a=4294967295&r;return o=new Uint8Array(8),(t=new DataView(o.buffer)).setUint32(0,n<<2|3&s),t.setUint32(4,a),o}return o=new Uint8Array(12),(t=new DataView(o.buffer)).setUint32(0,n),i(t,4,r),o}function C(e){var t=e.getTime(),r=Math.floor(t/1e3),i=1e6*(t-1e3*r),n=Math.floor(i/1e9);return{sec:r+n,nsec:i-1e9*n}}function v(e){return e instanceof Date?_(C(e)):null}function S(e){var t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:var r=t.getUint32(0);return{sec:4294967296*(3&r)+t.getUint32(4),nsec:r>>>2};case 12:return{sec:n(t,4),nsec:t.getUint32(0)};default:throw new I("Unrecognized data size for timestamp (expected 4, 8, or 12): "+e.length)}}function y(e){var t=S(e);return new Date(1e3*t.sec+t.nsec/1e6)}var R={type:m,encode:v,decode:y},T=function(){function e(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(R)}return e.prototype.register=function(e){var t=e.type,r=e.encode,i=e.decode;if(t>=0)this.encoders[t]=r,this.decoders[t]=i;else{var n=1+t;this.builtInEncoders[n]=r,this.builtInDecoders[n]=i}},e.prototype.tryToEncode=function(e,t){for(var r=0;r<this.builtInEncoders.length;r++)if(null!=(i=this.builtInEncoders[r])&&null!=(n=i(e,t)))return new f(-1-r,n);for(r=0;r<this.encoders.length;r++){var i,n;if(null!=(i=this.encoders[r])&&null!=(n=i(e,t)))return new f(r,n)}return e instanceof f?e:null},e.prototype.decode=function(e,t,r){var i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(e,t,r):new f(t,e)},e.defaultCodec=new e,e}();function w(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?new Uint8Array(e):Uint8Array.from(e)}var b=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")},O=function(){function e(e,t,r,i,n,o,s,a){void 0===e&&(e=T.defaultCodec),void 0===t&&(t=void 0),void 0===r&&(r=100),void 0===i&&(i=2048),void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===a&&(a=!1),this.extensionCodec=e,this.context=t,this.maxDepth=r,this.initialBufferSize=i,this.sortKeys=n,this.forceFloat32=o,this.ignoreUndefined=s,this.forceIntegerToFloat=a,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}return e.prototype.getUint8Array=function(){return this.bytes.subarray(0,this.pos)},e.prototype.reinitializeState=function(){this.pos=0},e.prototype.encode=function(e){return this.reinitializeState(),this.doEncode(e,1),this.getUint8Array()},e.prototype.doEncode=function(e,t){if(t>this.maxDepth)throw new Error("Too deep objects in depth "+t);null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.encodeNumber(e):"string"==typeof e?this.encodeString(e):this.encodeObject(e,t)},e.prototype.ensureBufferSizeToWrite=function(e){var t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(2*t)},e.prototype.resizeBuffer=function(e){var t=new ArrayBuffer(e),r=new Uint8Array(t),i=new DataView(t);r.set(this.bytes),this.view=i,this.bytes=r},e.prototype.encodeNil=function(){this.writeU8(192)},e.prototype.encodeBoolean=function(e){!1===e?this.writeU8(194):this.writeU8(195)},e.prototype.encodeNumber=function(e){Number.isSafeInteger(e)&&!this.forceIntegerToFloat?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):(this.writeU8(211),this.writeI64(e)):this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))},e.prototype.writeStringHeader=function(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error("Too long string: "+e+" bytes in UTF-8");this.writeU8(219),this.writeU32(e)}},e.prototype.encodeString=function(e){if(e.length>u){var t=c(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),A(e,this.bytes,this.pos),this.pos+=t}else t=c(e),this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),function(e,t,r){for(var i=e.length,n=r,o=0;o<i;){var s=e.charCodeAt(o++);if(0!=(4294967168&s)){if(0==(4294965248&s))t[n++]=s>>6&31|192;else{if(s>=55296&&s<=56319&&o<i){var a=e.charCodeAt(o);56320==(64512&a)&&(++o,s=((1023&s)<<10)+(1023&a)+65536)}0==(4294901760&s)?(t[n++]=s>>12&15|224,t[n++]=s>>6&63|128):(t[n++]=s>>18&7|240,t[n++]=s>>12&63|128,t[n++]=s>>6&63|128)}t[n++]=63&s|128}else t[n++]=s}}(e,this.bytes,this.pos),this.pos+=t},e.prototype.encodeObject=function(e,t){var r=this.extensionCodec.tryToEncode(e,this.context);if(null!=r)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error("Unrecognized object: "+Object.prototype.toString.apply(e));this.encodeMap(e,t)}},e.prototype.encodeBinary=function(e){var t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large binary: "+t);this.writeU8(198),this.writeU32(t)}var r=w(e);this.writeU8a(r)},e.prototype.encodeArray=function(e,t){var r,i,n=e.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else{if(!(n<4294967296))throw new Error("Too large array: "+n);this.writeU8(221),this.writeU32(n)}try{for(var o=b(e),s=o.next();!s.done;s=o.next()){var a=s.value;this.doEncode(a,t+1)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}},e.prototype.countWithoutUndefined=function(e,t){var r,i,n=0;try{for(var o=b(t),s=o.next();!s.done;s=o.next())void 0!==e[s.value]&&n++}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=o.return)&&i.call(o)}finally{if(r)throw r.error}}return n},e.prototype.encodeMap=function(e,t){var r,i,n=Object.keys(e);this.sortKeys&&n.sort();var o=this.ignoreUndefined?this.countWithoutUndefined(e,n):n.length;if(o<16)this.writeU8(128+o);else if(o<65536)this.writeU8(222),this.writeU16(o);else{if(!(o<4294967296))throw new Error("Too large map object: "+o);this.writeU8(223),this.writeU32(o)}try{for(var s=b(n),a=s.next();!a.done;a=s.next()){var c=a.value,d=e[c];this.ignoreUndefined&&void 0===d||(this.encodeString(c),this.doEncode(d,t+1))}}catch(e){r={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(r)throw r.error}}},e.prototype.encodeExtension=function(e){var t=e.data.length;if(1===t)this.writeU8(212);else if(2===t)this.writeU8(213);else if(4===t)this.writeU8(214);else if(8===t)this.writeU8(215);else if(16===t)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else{if(!(t<4294967296))throw new Error("Too large extension object: "+t);this.writeU8(201),this.writeU32(t)}this.writeI8(e.type),this.writeU8a(e.data)},e.prototype.writeU8=function(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++},e.prototype.writeU8a=function(e){var t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t},e.prototype.writeI8=function(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++},e.prototype.writeU16=function(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2},e.prototype.writeI16=function(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2},e.prototype.writeU32=function(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4},e.prototype.writeI32=function(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4},e.prototype.writeF32=function(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4},e.prototype.writeF64=function(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8},e.prototype.writeU64=function(e){this.ensureBufferSizeToWrite(8),function(e,t,r){var i=r/4294967296,n=r;e.setUint32(t,i),e.setUint32(t+4,n)}(this.view,this.pos,e),this.pos+=8},e.prototype.writeI64=function(e){this.ensureBufferSizeToWrite(8),i(this.view,this.pos,e),this.pos+=8},e}(),N={};function D(e,t){return void 0===t&&(t=N),new O(t.extensionCodec,t.context,t.maxDepth,t.initialBufferSize,t.sortKeys,t.forceFloat32,t.ignoreUndefined,t.forceIntegerToFloat).encode(e)}function L(e){return(e<0?"-":"")+"0x"+Math.abs(e).toString(16).padStart(2,"0")}var k=function(){function e(e,t){void 0===e&&(e=16),void 0===t&&(t=16),this.maxKeyLength=e,this.maxLengthPerKey=t,this.hit=0,this.miss=0,this.caches=[];for(var r=0;r<this.maxKeyLength;r++)this.caches.push([])}return e.prototype.canBeCached=function(e){return e>0&&e<=this.maxKeyLength},e.prototype.find=function(e,t,r){var i,n,o=this.caches[r-1];try{e:for(var s=function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}(o),a=s.next();!a.done;a=s.next()){for(var c=a.value,d=c.bytes,u=0;u<r;u++)if(d[u]!==e[t+u])continue e;return c.str}}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(i)throw i.error}}return null},e.prototype.store=function(e,t){var r=this.caches[e.length-1],i={bytes:e,str:t};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=i:r.push(i)},e.prototype.decode=function(e,t,r){var i=this.find(e,t,r);if(null!=i)return this.hit++,i;this.miss++;var n=h(e,t,r),o=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(o,n),n},e}(),P=function(e,t){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},B=function(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e="function"==typeof __values?__values(e):e[Symbol.iterator](),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise((function(i,n){!function(e,t,r,i){Promise.resolve(i).then((function(t){e({value:t,done:r})}),t)}(i,n,(t=e[r](t)).done,t.value)}))}}},M=function(e){return this instanceof M?(this.v=e,this):new M(e)},U=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(e,t||[]),o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(e){n[e]&&(i[e]=function(t){return new Promise((function(r,i){o.push([e,t,r,i])>1||a(e,t)}))})}function a(e,t){try{(r=n[e](t)).value instanceof M?Promise.resolve(r.value.v).then(c,d):u(o[0][2],r)}catch(e){u(o[0][3],e)}var r}function c(e){a("next",e)}function d(e){a("throw",e)}function u(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}},Q=new DataView(new ArrayBuffer(0)),x=new Uint8Array(Q.buffer),F=function(){try{Q.getInt8(0)}catch(e){return e.constructor}throw new Error("never reached")}(),V=new F("Insufficient data"),j=new k,G=function(){function e(e,t,i,n,o,s,a,c){void 0===e&&(e=T.defaultCodec),void 0===t&&(t=void 0),void 0===i&&(i=r),void 0===n&&(n=r),void 0===o&&(o=r),void 0===s&&(s=r),void 0===a&&(a=r),void 0===c&&(c=j),this.extensionCodec=e,this.context=t,this.maxStrLength=i,this.maxBinLength=n,this.maxArrayLength=o,this.maxMapLength=s,this.maxExtLength=a,this.keyDecoder=c,this.totalPos=0,this.pos=0,this.view=Q,this.bytes=x,this.headByte=-1,this.stack=[]}return e.prototype.reinitializeState=function(){this.totalPos=0,this.headByte=-1,this.stack.length=0},e.prototype.setBuffer=function(e){this.bytes=w(e),this.view=function(e){if(e instanceof ArrayBuffer)return new DataView(e);var t=w(e);return new DataView(t.buffer,t.byteOffset,t.byteLength)}(this.bytes),this.pos=0},e.prototype.appendBuffer=function(e){if(-1!==this.headByte||this.hasRemaining(1)){var t=this.bytes.subarray(this.pos),r=w(e),i=new Uint8Array(t.length+r.length);i.set(t),i.set(r,t.length),this.setBuffer(i)}else this.setBuffer(e)},e.prototype.hasRemaining=function(e){return this.view.byteLength-this.pos>=e},e.prototype.createExtraByteError=function(e){var t=this.view,r=this.pos;return new RangeError("Extra "+(t.byteLength-r)+" of "+t.byteLength+" byte(s) found at buffer["+e+"]")},e.prototype.decode=function(e){this.reinitializeState(),this.setBuffer(e);var t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t},e.prototype.decodeMulti=function(e){return P(this,(function(t){switch(t.label){case 0:this.reinitializeState(),this.setBuffer(e),t.label=1;case 1:return this.hasRemaining(1)?[4,this.doDecodeSync()]:[3,3];case 2:return t.sent(),[3,1];case 3:return[2]}}))},e.prototype.decodeAsync=function(e){var t,r,i,n,o,s,a,c;return o=this,s=void 0,c=function(){var o,s,a,c,d,u,A,h;return P(this,(function(l){switch(l.label){case 0:o=!1,l.label=1;case 1:l.trys.push([1,6,7,12]),t=B(e),l.label=2;case 2:return[4,t.next()];case 3:if((r=l.sent()).done)return[3,5];if(a=r.value,o)throw this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{s=this.doDecodeSync(),o=!0}catch(e){if(!(e instanceof F))throw e}this.totalPos+=this.pos,l.label=4;case 4:return[3,2];case 5:return[3,12];case 6:return c=l.sent(),i={error:c},[3,12];case 7:return l.trys.push([7,,10,11]),r&&!r.done&&(n=t.return)?[4,n.call(t)]:[3,9];case 8:l.sent(),l.label=9;case 9:return[3,11];case 10:if(i)throw i.error;return[7];case 11:return[7];case 12:if(o){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return[2,s]}throw u=(d=this).headByte,A=d.pos,h=d.totalPos,new RangeError("Insufficient data in parsing "+L(u)+" at "+h+" ("+A+" in the current buffer)")}}))},new((a=void 0)||(a=Promise))((function(e,t){function r(e){try{n(c.next(e))}catch(e){t(e)}}function i(e){try{n(c.throw(e))}catch(e){t(e)}}function n(t){var n;t.done?e(t.value):(n=t.value,n instanceof a?n:new a((function(e){e(n)}))).then(r,i)}n((c=c.apply(o,s||[])).next())}))},e.prototype.decodeArrayStream=function(e){return this.decodeMultiAsync(e,!0)},e.prototype.decodeStream=function(e){return this.decodeMultiAsync(e,!1)},e.prototype.decodeMultiAsync=function(e,t){return U(this,arguments,(function(){var r,i,n,o,s,a,c,d,u;return P(this,(function(A){switch(A.label){case 0:r=t,i=-1,A.label=1;case 1:A.trys.push([1,13,14,19]),n=B(e),A.label=2;case 2:return[4,M(n.next())];case 3:if((o=A.sent()).done)return[3,12];if(s=o.value,t&&0===i)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),r&&(i=this.readArraySize(),r=!1,this.complete()),A.label=4;case 4:A.trys.push([4,9,,10]),A.label=5;case 5:return[4,M(this.doDecodeSync())];case 6:return[4,A.sent()];case 7:return A.sent(),0==--i?[3,8]:[3,5];case 8:return[3,10];case 9:if(!((a=A.sent())instanceof F))throw a;return[3,10];case 10:this.totalPos+=this.pos,A.label=11;case 11:return[3,2];case 12:return[3,19];case 13:return c=A.sent(),d={error:c},[3,19];case 14:return A.trys.push([14,,17,18]),o&&!o.done&&(u=n.return)?[4,M(u.call(n))]:[3,16];case 15:A.sent(),A.label=16;case 16:return[3,18];case 17:if(d)throw d.error;return[7];case 18:return[7];case 19:return[2]}}))}))},e.prototype.doDecodeSync=function(){e:for(;;){var e=this.readHeadByte(),t=void 0;if(e>=224)t=e-256;else if(e<192)if(e<128)t=e;else if(e<144){if(0!=(i=e-128)){this.pushMapState(i),this.complete();continue e}t={}}else if(e<160){if(0!=(i=e-144)){this.pushArrayState(i),this.complete();continue e}t=[]}else{var r=e-160;t=this.decodeUtf8String(r,0)}else if(192===e)t=null;else if(194===e)t=!1;else if(195===e)t=!0;else if(202===e)t=this.readF32();else if(203===e)t=this.readF64();else if(204===e)t=this.readU8();else if(205===e)t=this.readU16();else if(206===e)t=this.readU32();else if(207===e)t=this.readU64();else if(208===e)t=this.readI8();else if(209===e)t=this.readI16();else if(210===e)t=this.readI32();else if(211===e)t=this.readI64();else if(217===e)r=this.lookU8(),t=this.decodeUtf8String(r,1);else if(218===e)r=this.lookU16(),t=this.decodeUtf8String(r,2);else if(219===e)r=this.lookU32(),t=this.decodeUtf8String(r,4);else if(220===e){if(0!==(i=this.readU16())){this.pushArrayState(i),this.complete();continue e}t=[]}else if(221===e){if(0!==(i=this.readU32())){this.pushArrayState(i),this.complete();continue e}t=[]}else if(222===e){if(0!==(i=this.readU16())){this.pushMapState(i),this.complete();continue e}t={}}else if(223===e){if(0!==(i=this.readU32())){this.pushMapState(i),this.complete();continue e}t={}}else if(196===e){var i=this.lookU8();t=this.decodeBinary(i,1)}else if(197===e)i=this.lookU16(),t=this.decodeBinary(i,2);else if(198===e)i=this.lookU32(),t=this.decodeBinary(i,4);else if(212===e)t=this.decodeExtension(1,0);else if(213===e)t=this.decodeExtension(2,0);else if(214===e)t=this.decodeExtension(4,0);else if(215===e)t=this.decodeExtension(8,0);else if(216===e)t=this.decodeExtension(16,0);else if(199===e)i=this.lookU8(),t=this.decodeExtension(i,1);else if(200===e)i=this.lookU16(),t=this.decodeExtension(i,2);else{if(201!==e)throw new I("Unrecognized type byte: "+L(e));i=this.lookU32(),t=this.decodeExtension(i,4)}this.complete();for(var n=this.stack;n.length>0;){var o=n[n.length-1];if(0===o.type){if(o.array[o.position]=t,o.position++,o.position!==o.size)continue e;n.pop(),t=o.array}else{if(1===o.type){if("string"!=(s=typeof t)&&"number"!==s)throw new I("The type of key must be string or number but "+typeof t);if("__proto__"===t)throw new I("The key __proto__ is not allowed");o.key=t,o.type=2;continue e}if(o.map[o.key]=t,o.readCount++,o.readCount!==o.size){o.key=null,o.type=1;continue e}n.pop(),t=o.map}}return t}var s},e.prototype.readHeadByte=function(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte},e.prototype.complete=function(){this.headByte=-1},e.prototype.readArraySize=function(){var e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new I("Unrecognized array type byte: "+L(e))}},e.prototype.pushMapState=function(e){if(e>this.maxMapLength)throw new I("Max length exceeded: map length ("+e+") > maxMapLengthLength ("+this.maxMapLength+")");this.stack.push({type:1,size:e,key:null,readCount:0,map:{}})},e.prototype.pushArrayState=function(e){if(e>this.maxArrayLength)throw new I("Max length exceeded: array length ("+e+") > maxArrayLength ("+this.maxArrayLength+")");this.stack.push({type:0,size:e,array:new Array(e),position:0})},e.prototype.decodeUtf8String=function(e,t){var r;if(e>this.maxStrLength)throw new I("Max length exceeded: UTF-8 byte length ("+e+") > maxStrLength ("+this.maxStrLength+")");if(this.bytes.byteLength<this.pos+t+e)throw V;var i,n=this.pos+t;return i=this.stateIsMapKey()&&(null===(r=this.keyDecoder)||void 0===r?void 0:r.canBeCached(e))?this.keyDecoder.decode(this.bytes,n,e):e>g?function(e,t,r){var i=e.subarray(t,t+r);return p.decode(i)}(this.bytes,n,e):h(this.bytes,n,e),this.pos+=t+e,i},e.prototype.stateIsMapKey=function(){return this.stack.length>0&&1===this.stack[this.stack.length-1].type},e.prototype.decodeBinary=function(e,t){if(e>this.maxBinLength)throw new I("Max length exceeded: bin length ("+e+") > maxBinLength ("+this.maxBinLength+")");if(!this.hasRemaining(e+t))throw V;var r=this.pos+t,i=this.bytes.subarray(r,r+e);return this.pos+=t+e,i},e.prototype.decodeExtension=function(e,t){if(e>this.maxExtLength)throw new I("Max length exceeded: ext length ("+e+") > maxExtLength ("+this.maxExtLength+")");var r=this.view.getInt8(this.pos+t),i=this.decodeBinary(e,t+1);return this.extensionCodec.decode(i,r,this.context)},e.prototype.lookU8=function(){return this.view.getUint8(this.pos)},e.prototype.lookU16=function(){return this.view.getUint16(this.pos)},e.prototype.lookU32=function(){return this.view.getUint32(this.pos)},e.prototype.readU8=function(){var e=this.view.getUint8(this.pos);return this.pos++,e},e.prototype.readI8=function(){var e=this.view.getInt8(this.pos);return this.pos++,e},e.prototype.readU16=function(){var e=this.view.getUint16(this.pos);return this.pos+=2,e},e.prototype.readI16=function(){var e=this.view.getInt16(this.pos);return this.pos+=2,e},e.prototype.readU32=function(){var e=this.view.getUint32(this.pos);return this.pos+=4,e},e.prototype.readI32=function(){var e=this.view.getInt32(this.pos);return this.pos+=4,e},e.prototype.readU64=function(){var e,t,r=(e=this.view,t=this.pos,4294967296*e.getUint32(t)+e.getUint32(t+4));return this.pos+=8,r},e.prototype.readI64=function(){var e=n(this.view,this.pos);return this.pos+=8,e},e.prototype.readF32=function(){var e=this.view.getFloat32(this.pos);return this.pos+=4,e},e.prototype.readF64=function(){var e=this.view.getFloat64(this.pos);return this.pos+=8,e},e}(),K={};function H(e,t){return void 0===t&&(t=K),new G(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decode(e)}function Y(e,t){return void 0===t&&(t=K),new G(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeMulti(e)}var W=function(e,t){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},J=function(e){return this instanceof J?(this.v=e,this):new J(e)},q=function(e,t,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(e,t||[]),o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(e){n[e]&&(i[e]=function(t){return new Promise((function(r,i){o.push([e,t,r,i])>1||a(e,t)}))})}function a(e,t){try{(r=n[e](t)).value instanceof J?Promise.resolve(r.value.v).then(c,d):u(o[0][2],r)}catch(e){u(o[0][3],e)}var r}function c(e){a("next",e)}function d(e){a("throw",e)}function u(e,t){e(t),o.shift(),o.length&&a(o[0][0],o[0][1])}};function z(e){if(null==e)throw new Error("Assertion Failure: value must not be null nor undefined")}function X(e){return null!=e[Symbol.asyncIterator]?e:function(e){return q(this,arguments,(function(){var t,r,i,n;return W(this,(function(o){switch(o.label){case 0:t=e.getReader(),o.label=1;case 1:o.trys.push([1,,9,10]),o.label=2;case 2:return[4,J(t.read())];case 3:return r=o.sent(),i=r.done,n=r.value,i?[4,J(void 0)]:[3,5];case 4:return[2,o.sent()];case 5:return z(n),[4,J(n)];case 6:return[4,o.sent()];case 7:return o.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}}))}))}(e)}function Z(e,t){return void 0===t&&(t=K),r=this,i=void 0,o=function(){var r;return function(e,t){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!((n=(n=s.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}(this,(function(i){return r=X(e),[2,new G(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeAsync(r)]}))},new((n=void 0)||(n=Promise))((function(e,t){function s(e){try{c(o.next(e))}catch(e){t(e)}}function a(e){try{c(o.throw(e))}catch(e){t(e)}}function c(t){var r;t.done?e(t.value):(r=t.value,r instanceof n?r:new n((function(e){e(r)}))).then(s,a)}c((o=o.apply(r,i||[])).next())}));var r,i,n,o}function $(e,t){void 0===t&&(t=K);var r=X(e);return new G(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeArrayStream(r)}function ee(e,t){void 0===t&&(t=K);var r=X(e);return new G(t.extensionCodec,t.context,t.maxStrLength,t.maxBinLength,t.maxArrayLength,t.maxMapLength,t.maxExtLength).decodeStream(r)}function te(e,t){return void 0===t&&(t=K),ee(e,t)}return t}()}(QW),(0,SM.exports)("Int8",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,SM.exports)("Int16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,SM.exports)("Int32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,SM.exports)("Uint16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,SM.exports)("Uint32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,SM.exports)("Float32",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,SM.exports)("Float64",(function(e){return function(t,r,i){return e(this,t,r,i)}}));const xW=()=>function(e){const t=window.atob(e).split("").map(e=>e.charCodeAt(0));return new Uint8Array(t,0,t.length/Uint8Array.BYTES_PER_ELEMENT)}("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AAA2AkAgACgCKCABKAJMQQIgACgCIBEAACECIAFBADYCwC0gASACNgJEIAFBgAg2ApwtIAEgACgCKEGACEEEIAAoAiARAAAiAjYCCCABIAEoApwtIgNBAnQ2AgwCQAJAIAEoAjhFDQAgASgCQEUNACACRQ0AIAEoAkQNAQsgAUGaBTYCBCAAQbjfACgCADYCGCAAEAgPCyABQQA2AogBIAFBCTYChAEgAUEIOgAkIAEgAiADQQNsajYCmC0gASACIANBfnFqNgKkLSAAEAkNACAAKAIcIgAgACgCLEEBdDYCPCAAKAJEIgEgACgCTEEBdEECayIDakEAOwEAIAEgAxAgIABBADYCtC0gAEKAgICAIDcCdCAAQgA3AmggAEKAgICAIDcCXCAAQQA2AkggACAAKAKEAUEMbCIBQYTIAGovAQA2ApABIAAgAUGAyABqLwEANgKMASAAIAFBgsgAai8BADYCgAEgACABQYbIAGovAQA2AnwLC6kCAQN/AkAgAEUNACAAKAIgRQ0AIAAoAiQiA0UNACAAKAIcIgFFDQAgASgCACAARw0AAkACQCABKAIEIgJBOWsOOQECAgICAgICAgICAgECAgIBAgICAgICAgICAgICAgICAgIBAgICAgICAgICAgIBAgICAgICAgICAQALIAJBmgVGDQAgAkEqRw0BCwJ/An8CfyABKAIIIgIEQCAAKAIoIAIgAxECACAAKAIcIQELIAEoAkQiAgsEQCAAKAIoIAIgACgCJBECACAAKAIcIQELIAEoAkAiAgsEQCAAKAIoIAIgACgCJBECACAAKAIcIQELIAEoAjgiAgsEQCAAKAIoIAIgACgCJBECACAAKAIcIQELIAAoAiggASAAKAIkEQIAIABBADYCHAsLlgIBA39BfiECAkAgAEUNACAAKAIgRQ0AIAAoAiRFDQAgACgCHCIBRQ0AIAEoAgAgAEcNAAJAAkAgASgCBCIDQTlrDjkBAgICAgICAgICAgIBAgICAQICAgICAgICAgICAgICAgICAQICAgICAgICAgICAQICAgICAgICAgEACyADQZoFRg0AIANBKkcNAQsgAEECNgIsIABBADYCCCAAQgA3AhQgAUEANgIUIAEgASgCCDYCECABKAIYIgJBf0wEQCABQQAgAmsiAjYCGAsgAUE5QSpB8QAgAhsgAkECRhs2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KAIIaiACQR9wIAJyQR9zOgAAIAEoAmwEQCAAKAIwIQIgASABKAIUIgNBAWo2AhQgAyABKAIIaiACQRh2OgAAIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAkEQdjoAACAAKAIwIQIgASABKAIUIgNBAWo2AhQgAyABKAIIaiACQQh2OgAAIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAjoAAAsgAEEAQQBBABAENgIwIAFB8QA2AgQgACgCHCICEBMCQCAAKAIQIgMgAigCFCIEIAMgBEkbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrNgIQIAIgAigCFCADayIDNgIUIAMNACACIAIoAgg2AhALIAEoAhQNBCABKAIEIQMLAkACQAJAAkACQAJAAkAgA0E5RgR/IABBAEEAQQAQBjYCMCABIAEoAhQiAkEBajYCFCACIAEoAghqQR86AAAgASABKAIUIgJBAWo2AhQgAiABKAIIakGLAToAACABIAEoAhQiAkEBajYCFCACIAEoAghqQQg6AAAgASgCHCICDQIgASABKAIUIgJBAWo2AhQgAiABKAIIakEAOgAAIAEgASgCFCICQQFqNgIUIAIgASgCCGpBADoAACABIAEoAhQiAkEBajYCFCACIAEoAghqQQA6AAAgASABKAIUIgJBAWo2AhQgAiABKAIIakEAOgAAIAEgASgCFCICQQFqNgIUIAIgASgCCGpBADoAAEECIQIgASgChAEiA0EJRwRAQQQgASgCiAFBAUpBAnQgA0ECSBshAgsgASABKAIUIgNBAWo2AhQgAyABKAIIaiACOgAAIAEgASgCFCICQQFqNgIUIAIgASgCCGpBAzoAACABQfEANgIEIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQCyABKAIUDQEgASgCBAUgAwtBxQBrDiMCBgYGAwYGBgYGBgYGBgYGBgYGBgYGBAYGBgYGBgYGBgYGBQYLIAFBfzYCKA8LIAIoAiQhAyACKAIcIQQgAigCECEFIAIoAiwhBiACKAIAIQggASABKAIUIgdBAWo2AhRBAiECIAcgASgCCGogBkEAR0EBdCAIQQBHciAFQQBHQQJ0ciAEQQBHQQN0ciADQQBHQQR0cjoAACABKAIcKAIEIQMgASABKAIUIgRBAWo2AhQgBCABKAIIaiADOgAAIAEoAhwoAgQhAyABIAEoAhQiBEEBajYCFCAEIAEoAghqIANBCHY6AAAgASgCHC8BBiEDIAEgASgCFCIEQQFqNgIUIAQgASgCCGogAzoAACABKAIcLQAHIQMgASABKAIUIgRBAWo2AhQgBCABKAIIaiADOgAAIAEoAoQBIgNBCUcEQEEEIAEoAogBQQFKQQJ0IANBAkgbIQILIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAjoAACABKAIcKAIMIQIgASABKAIUIgNBAWo2AhQgAyABKAIIaiACOgAAIAEoAhwiAigCEAR/IAIoAhQhAiABIAEoAhQiA0EBajYCFCADIAEoAghqIAI6AAAgASgCHCgCFCECIAEgASgCFCIDQQFqNgIUIAMgASgCCGogAkEIdjoAACABKAIcBSACCygCLARAIAAgACgCMCABKAIIIAEoAhQQBjYCMAsgAUHFADYCBCABQQA2AiALIAEoAhwiBCgCECIDBEAgASgCFCICIAQvARQgASgCICIGayIFaiABKAIMIgRLBEADQCABKAIIIAJqIAMgBmogBCACayIEEB8aIAEgASgCDCIDNgIUAkAgAiADTw0AIAEoAhwoAixFDQAgACAAKAIwIAEoAgggAmogAyACaxAGNgIwCyABIAEoAiAgBGo2AiAgACgCHCICEBMCQCAAKAIQIgMgAigCFCIGIAMgBkkbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrNgIQIAIgAigCFCADayIDNgIUIAMNACACIAIoAgg2AhALIAEoAhQEQCABQX82AigPCyABKAIgIQYgASgCHCgCECEDQQAhAiAFIARrIgUgASgCDCIESw0ACwsgASgCCCACaiADIAZqIAUQHxogASABKAIUIAVqIgM2AhQCQCACIANPDQAgASgCHCgCLEUNACAAIAAoAjAgASgCCCACaiADIAJrEAY2AjALIAFBADYCIAsgAUHJADYCBAsgASgCHCgCHARAIAEoAhQiAiEFA0ACQCACIAEoAgxHDQACQCACIAVNDQAgASgCHCgCLEUNACAAIAAoAjAgASgCCCAFaiACIAVrEAY2AjALIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQC0EAIQJBACEFIAEoAhRFDQAgAUF/NgIoDwsgASgCHCgCHCEDIAEgASgCICIEQQFqNgIgIAMgBGotAAAhAyABIAJBAWo2AhQgASgCCCACaiADOgAAIAMEQCABKAIUIQIMAQsLAkAgASgCHCgCLEUNACABKAIUIgIgBU0NACAAIAAoAjAgASgCCCAFaiACIAVrEAY2AjALIAFBADYCIAsgAUHbADYCBAsCQCABKAIcKAIkRQ0AIAEoAhQiAiEFA0ACQCACIAEoAgxHDQACQCACIAVNDQAgASgCHCgCLEUNACAAIAAoAjAgASgCCCAFaiACIAVrEAY2AjALIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQC0EAIQJBACEFIAEoAhRFDQAgAUF/NgIoDwsgASgCHCgCJCEDIAEgASgCICIEQQFqNgIgIAMgBGotAAAhAyABIAJBAWo2AhQgASgCCCACaiADOgAAIAMEQCABKAIUIQIMAQsLIAEoAhwoAixFDQAgASgCFCICIAVNDQAgACAAKAIwIAEoAgggBWogAiAFaxAGNgIwCyABQecANgIECyABKAIcKAIsBEAgASgCDCABKAIUIgJBAmpJBEAgACgCHCICEBMCQCAAKAIQIgMgAigCFCIEIAMgBEkbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrNgIQIAIgAigCFCADayIDNgIUIAMNACACIAIoAgg2AhALIAEoAhQNBUEAIQILIAAoAjAhAyABIAJBAWo2AhQgASgCCCACaiADOgAAIAAoAjAhAiABIAEoAhQiA0EBajYCFCADIAEoAghqIAJBCHY6AAAgAEEAQQBBABAGNgIwCyABQfEANgIEIAAoAhwiAhATAkAgACgCECIDIAIoAhQiBCADIARJGyIDRQ0AIAAoAgwgAigCECADEB8aIAAgACgCDCADajYCDCACIAIoAhAgA2o2AhAgACAAKAIUIANqNgIUIAAgACgCECADazYCECACIAIoAhQgA2siAzYCFCADDQAgAiACKAIINgIQCyABKAIURQ0AIAFBfzYCKA8LIAAoAgQNAQsgASgCdA0AIAEoAgRBmgVGDQgLIAEoAoQBIgJFBEAgAUEDEAwMBAsCQAJAIAEoAogBQQJrDgIAAQQLA0ACQAJAIAEoAnQNACABEAogASgCdA0AIAFBADYCtC0MAQsgAUEANgJgIAEoAjggASgCbGotAAAhAiABKAKkLSABKAKgLSIDQQF0akEAOwEAIAEgA0EBajYCoC0gAyABKAKYLWogAjoAACABIAJBAnRqQZQBaiICIAIvAQBBAWo7AQAgASABKAJ0QQFrNgJ0IAEgASgCbEEBaiICNgJsIAEoAqAtIAEoApwtQQFrRw0BIAEgASgCXCIEQQBOBH8gASgCOCAEagVBAAsgAiAEa0EAEBQgASABKAJsNgJcIAEoAgAiAigCHCIDEBMCQCACKAIQIgQgAygCFCIFIAQgBUkbIgRFDQAgAigCDCADKAIQIAQQHxogAiACKAIMIARqNgIMIAMgAygCECAEajYCECACIAIoAhQgBGo2AhQgAiACKAIQIARrNgIQIAMgAygCFCAEayICNgIUIAINACADIAMoAgg2AhALIAEoAgAoAhANAQwHCwsgASgCoC1FDQcgASABKAJcIgNBAE4EfyABKAI4IANqBUEACyABKAJsIANrQQAQFCABIAEoAmw2AlwgASgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgASgCACgCEEUNBQwHCwNAAkACQAJAIAEoAnQiAkGDAk8EQCABQQA2AmAMAQsgARAKIAEoAnQiAgRAIAFBADYCYCACQQJLDQEgASgCbCEDDAILIAFBADYCtC0gASgCoC1FDQogASABKAJcIgNBAE4EfyABKAI4IANqBUEACyABKAJsIANrQQAQFCABIAEoAmw2AlwgASgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgASgCACgCEEUNCAwKCyABKAJsIgNFBEBBACEDDAELIAEoAjggA2oiBkEBayIFLQAAIgQgBi0AAEcNACAEIAUtAAJHDQAgBCAFLQADRw0AIAZBggJqIQlBfyEIAkACQAJAAkACQAJAA0AgBiAIaiIFLQAEIARGBEAgBCAFLQAFRw0CIAQgBS0ABkcNAyAEIAUtAAdHDQQgBCAGIAhBCGoiCmoiBy0AAEcNByAEIAUtAAlHDQUgBCAFLQAKRw0GIAVBC2ohByAIQfYBSg0HIAohCCAEIActAABGDQEMBwsLIAVBBGohBwwFCyAFQQVqIQcMBAsgBUEGaiEHDAMLIAVBB2ohBwwCCyAFQQlqIQcMAQsgBUEKaiEHCyABIAIgByAJa0GCAmoiBCACIARJGyICNgJgIAJBA0kNACABKAKkLSABKAKgLSIDQQF0akEBOwEAIAEgA0EBajYCoC0gAyABKAKYLWogAkEDayICOgAAIAJB/wFxQYDNAGotAABBAnQgAWpBmAlqIgIgAi8BAEEBajsBACABQYDJAC0AAEECdGpBiBNqIgIgAi8BAEEBajsBACABKAJgIQIgAUEANgJgIAEgASgCdCACazYCdCABIAIgASgCbGoiAjYCbCABKAKgLSABKAKcLUEBa0cNAgwBCyABKAI4IANqLQAAIQIgASgCpC0gASgCoC0iA0EBdGpBADsBACABIANBAWo2AqAtIAMgASgCmC1qIAI6AAAgASACQQJ0akGUAWoiAiACLwEAQQFqOwEAIAEgASgCdEEBazYCdCABIAEoAmxBAWoiAjYCbCABKAKgLSABKAKcLUEBa0cNAQsgASABKAJcIgRBAE4EfyABKAI4IARqBUEACyACIARrQQAQFCABIAEoAmw2AlwgASgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgASgCACgCEA0ACwwECyABQX82AigPCyABQX82AigPCyABQQMgAkEMbEGIyABqKAIAEQQACyICQX5xQQJGBEAgAUGaBTYCBAsgAkF9cQ0BCyAAKAIQDQMgAUF/NgIoDwsgAkEBRw0BCyABQQBBAEEAEBIgASgCRCICIAEoAkxBAXRBAmsiA2pBADsBACACIAMQICABKAJ0RQRAIAFBADYCtC0gAUEANgJcIAFBADYCbAsgACgCHCICEBMCQCAAKAIQIgQgAigCFCIDIAMgBEsbIgNFDQAgACgCDCACKAIQIAMQHxogACAAKAIMIANqNgIMIAIgAigCECADajYCECAAIAAoAhQgA2o2AhQgACAAKAIQIANrIgQ2AhAgAiACKAIUIANrIgM2AhQgAw0AIAIgAigCCDYCEAsgBA0AIAFBfzYCKAsLC7YNAQt/IAAoAgAiBCgCBCEJQQEhCAJAIAQoAhAiAyAAKAK8LUEqakEDdSICSQ0AIAAoAiwiBSAAKAIMQQVrIgYgBSAGSRshCiABQQRHIQsDQCAKIAMgAmsiAyAAKAJsIAAoAlxrIgYgBCgCBGoiAkH//wMgAkH//wNJGyIFIAMgBUkbIgNLBEAgAiADRw0CIAFFDQIgCyADRXENAgsgAEEAQQAgAUEERiACIANGcSIHEBIgACgCFCAAKAIIakEEayADOgAAIAAoAhQgACgCCGpBA2sgA0EIdjoAACAAKAIUIAAoAghqQQJrIANBf3MiAjoAACAAKAIUIAAoAghqQQFrIAJBCHY6AAAgACgCACICKAIcIgQQEwJAIAIoAhAiBSAEKAIUIgwgBSAMSRsiBUUNACACKAIMIAQoAhAgBRAfGiACIAIoAgwgBWo2AgwgBCAEKAIQIAVqNgIQIAIgAigCFCAFajYCFCACIAIoAhAgBWs2AhAgBCAEKAIUIAVrIgI2AhQgAg0AIAQgBCgCCDYCEAsCfyAGBEAgACgCACgCDCAAKAI4IAAoAlxqIAMgBiADIAZJGyICEB8aIAAoAgAiBCAEKAIMIAJqNgIMIAQgBCgCECACazYCECAEIAQoAhQgAmo2AhQgACAAKAJcIAJqNgJcIAMgAmshAwsgAwsEQCAAKAIAIgIoAgwhBSADIAIoAgQiBiADIAZJGyIEBEAgAiAGIARrNgIEIAUgAigCACAEEB8hBQJAAkACQCACKAIcKAIYQQFrDgIAAQILIAIgAigCMCAFIAQQBDYCMAwBCyACIAIoAjAgBSAEEAY2AjALIAIgAigCACAEajYCACACIAIoAgggBGo2AgggACgCACICKAIMIQULIAIgAyAFajYCDCACIAIoAhAgA2s2AhAgAiACKAIUIANqNgIUCyAAKAIAIQQgBwRAQQAhCAwCCyAEKAIQIgMgACgCvC1BKmpBA3UiAk8NAAsLAkAgCSAEKAIEayIDRQRAIAAoAmwhAgwBCwJAIAAoAiwiAiADTQRAIABBAjYCsC0gACgCOCAEKAIAIAJrIAIQHxogACAAKAIsIgQ2AmwgBCECDAELAkAgACgCPCAAKAJsIgRrIANLDQAgACAEIAJrIgQ2AmwgACgCOCIFIAIgBWogBBAfGiAAKAKwLSICQQFLDQAgACACQQFqNgKwLQsgACgCOCAAKAJsaiAAKAIAKAIAIANrIAMQHxogACAAKAJsIANqIgI2AmwgACgCLCEECyAAIAI2AlwgACAEIAAoArQtIgVrIgQgAyADIARLGyAFajYCtC0LIAIgACgCwC1LBEAgACACNgLALQtBAyEDAkAgCEUNACAAKAIAIgQoAgQhAwJAAkAgAUF7cUUNACADDQBBASEDIAIgACgCXEYNAiAAKAI8IAJBf3NqIQVBACEDDAELIAMgACgCPCACQX9zaiIFTQ0AIAAoAlwiByAAKAIsIgZIDQAgACACIAZrIgM2AmwgACAHIAZrNgJcIAAoAjgiAiACIAZqIAMQHxogACgCsC0iA0EBTQRAIAAgA0EBajYCsC0LIAAoAiwgBWohBSAAKAIAIgQoAgQhAwsCQCADIAUgAyAFSRsiAkUEQCAAKAJsIQMMAQsgACgCbCEFIAAoAjghBiAEIAMgAms2AgQgBSAGaiAEKAIAIAIQHyEDAkACQAJAIAQoAhwoAhhBAWsOAgABAgsgBCAEKAIwIAMgAhAENgIwDAELIAQgBCgCMCADIAIQBjYCMAsgBCAEKAIAIAJqNgIAIAQgBCgCCCACajYCCCAAIAAoAmwgAmoiAzYCbAsgAyAAKALALUsEQCAAIAM2AsAtCyADIAAoAlwiBmsiBCAAKAIsIgMgACgCDCAAKAK8LUEqakEDdWsiAkH//wMgAkH//wNJGyICIAIgA0sbSQRAQQAhAyABRQ0BIAFBBEYgBEEAR3JFDQEgAiAESQ0BIAAoAgAoAgQNAQtBACEFIAAgACgCOCAGaiACIAQgAiAESRsiAwJ/IAFBBEYEQCAAKAIAKAIERSACIARPcSEFCyAFCxASIAAgACgCXCADajYCXCAAKAIAIgAoAhwiAxATAkAgACgCECICIAMoAhQiBCACIARJGyICRQ0AIAAoAgwgAygCECACEB8aIAAgACgCDCACajYCDCADIAMoAhAgAmo2AhAgACAAKAIUIAJqNgIUIAAgACgCECACazYCECADIAMoAhQgAmsiADYCFCAADQAgAyADKAIINgIQC0ECQQAgBRshAwsgAwu5CwENfwJAA0ACQAJAIAAoAnRBhQJNBEAgABAKIAAoAnQhAgJAIAENACACQYYCTw0AQQAPCyACRQ0EIAJBA0kNAQsgACAAKAJUIAAoAmwiAiAAKAI4ai0AAiAAKAJIIAAoAlh0c3EiAzYCSCAAKAJAIAIgACgCNHFBAXRqIAAoAkQgA0EBdGoiBC8BACIDOwEAIAQgAjsBACADRQ0AIAAoAixBhgJrIAIgA2tJDQAgACAAIAMQDiICNgJgDAELIAAoAmAhAgsCQCACQQNPBEAgACgCpC0gACgCoC0iA0EBdGogACgCbCAAKAJwayIEOwEAIAAgA0EBajYCoC0gAyAAKAKYLWogAkEDayICOgAAIAJB/wFxQYDNAGotAABBAnQgAGpBmAlqIgIgAi8BAEEBajsBACAAIARBAWtB//8DcSICIAJBB3ZBgAJqIAJBgAJJG0GAyQBqLQAAQQJ0akGIE2oiAiACLwEAQQFqOwEAIAAgACgCdCAAKAJgIgJrIgM2AnQgACgCnC1BAWshBiAAKAKgLSEHAkAgA0EDSQ0AIAIgACgCgAFLDQAgACACQQFrIgM2AmAgACgCSCEEIAAoAmwhAiAAKAI0IQggACgCQCEJIAAoAkQhCiAAKAJUIQsgACgCOCEMIAAoAlghDQNAIAAgAiIFQQFqIgI2AmwgACAFIAxqLQADIAQgDXRzIAtxIgQ2AkggCSACIAhxQQF0aiAKIARBAXRqIg4vAQA7AQAgDiACOwEAIAAgA0EBayIDNgJgIAMNAAsgACAFQQJqIgI2AmwgBiAHRw0DDAILIABBADYCYCAAIAAoAmwgAmoiAjYCbCAAIAAoAjggAmoiAy0AACIENgJIIAAgACgCVCADLQABIAQgACgCWHRzcTYCSCAGIAdHDQIMAQsgACgCOCAAKAJsai0AACECIAAoAqQtIAAoAqAtIgNBAXRqQQA7AQAgACADQQFqNgKgLSADIAAoApgtaiACOgAAIAAgAkECdGpBlAFqIgIgAi8BAEEBajsBACAAIAAoAnRBAWs2AnQgACAAKAJsQQFqIgI2AmwgACgCoC0gACgCnC1BAWtHDQELQQAhAyAAIAAoAlwiBEEATgR/IAAoAjggBGoFIAMLIAIgBGtBABAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATAkAgAigCECIEIAMoAhQiBSAEIAVJGyIERQ0AIAIoAgwgAygCECAEEB8aIAIgAigCDCAEajYCDCADIAMoAhAgBGo2AhAgAiACKAIUIARqNgIUIAIgAigCECAEazYCECADIAMoAhQgBGsiAjYCFCACDQAgAyADKAIINgIQCyAAKAIAKAIQDQALQQAPCyAAIAAoAmwiAkECIAJBAkkbNgK0LSABQQRGBEBBACEDIAAgACgCXCIEQQBOBH8gACgCOCAEagUgAwsgAiAEa0EBEBQgACAAKAJsNgJcIAAoAgAiAigCHCIDEBMCQCACKAIQIgQgAygCFCIFIAQgBUkbIgRFDQAgAigCDCADKAIQIAQQHxogAiACKAIMIARqNgIMIAMgAygCECAEajYCECACIAIoAhQgBGo2AhQgAiACKAIQIARrNgIQIAMgAygCFCAEayICNgIUIAINACADIAMoAgg2AhALQQNBAiAAKAIAKAIQGw8LAkAgACgCoC1FDQBBACEDIAAgACgCXCIEQQBOBH8gACgCOCAEagUgAwsgAiAEa0EAEBQgACAAKAJsNgJcIAAoAgAiAigCHCIDEBMCQCACKAIQIgQgAygCFCIFIAQgBUkbIgRFDQAgAigCDCADKAIQIAQQHxogAiACKAIMIARqNgIMIAMgAygCECAEajYCECACIAIoAhQgBGo2AhQgAiACKAIQIARrNgIQIAMgAygCFCAEayICNgIUIAINACADIAMoAgg2AhALIAAoAgAoAhANAEEADwtBAQukBAEQfyAAKAJ8IgMgA0ECdiAAKAJ4IgQgACgCjAFJGyEJQQAgACgCbCIDIAAoAixrQYYCaiICIAIgA0sbIQwgACgCdCIHIAAoApABIgIgAiAHSxshDSAAKAI4Ig4gA2oiBUGCAmohDyAEIAVqIgMtAAAhCiADQQFrLQAAIQsgACgCNCEQIAAoAkAhEQNAAkACQCABIA5qIgMgBGoiAi0AACAKRw0AIAJBAWstAAAgC0cNACADLQAAIAUtAABHDQBBAiEGIAMtAAEgBS0AAUcNAAJAAkACQAJAAkACQAJAA0AgBSAGaiICLQABIAMtAANHDQYgAi0AAiADLQAERw0FIAItAAMgAy0ABUcNBCACLQAEIAMtAAZHDQMgAi0ABSADLQAHRw0CIAItAAYgAy0ACEcNASACLQAHIAMtAAlGBEAgBkH5AUshCCAFIAZBCGoiBmohAiAIDQggAy0ACiEIIANBCGohAyACLQAAIAhGDQEMCAsLIAJBB2ohAgwGCyACQQZqIQIMBQsgAkEFaiECDAQLIAJBBGohAgwDCyACQQNqIQIMAgsgAkECaiECDAELIAJBAWohAgsgAiAPayICQYICaiIDIARMDQAgACABNgJwIAMgDU4EQCADIQQMAgsgAyAFai0AACEKIAIgBWotAIECIQsgAyEECyAJQQFrIglFDQAgDCARIAEgEHFBAXRqLwEAIgFJDQELCyAHIAQgBCAHSxsL3Q4BB38DQAJAAkACQCAAKAJ0QYUCSw0AIAAQCiAAKAJ0IQICQCABDQAgAkGGAk8NAEEADwsgAkUNAiACQQJLDQAgACAAKAJgIgI2AnggACAAKAJwNgJkQQIhAyAAQQI2AmAMAQtBAiEDIAAgACgCVCAAKAJsIgIgACgCOGotAAIgACgCSCAAKAJYdHNxIgQ2AkggACgCQCACIAAoAjRxQQF0aiAAKAJEIARBAXRqIgUvAQAiBDsBACAFIAI7AQAgACAAKAJgIgI2AnggACAAKAJwNgJkIABBAjYCYCAERQ0AAkAgAiAAKAKAAU8NACAAKAIsQYYCayAAKAJsIARrSQ0AIAAgACAEEA4iAzYCYCADQQVLDQAgACgCiAFBAUcEQCADQQNHDQFBAyEDIAAoAmwgACgCcGtBgSBJDQELQQIhAyAAQQI2AmALIAAoAnghAgsCQCACQQNJDQAgAiADSQ0AIAAoAnQhBCAAKAKkLSAAKAKgLSIDQQF0aiAAKAJsIgUgACgCZEF/c2oiBjsBACAAIANBAWo2AqAtIAMgACgCmC1qIAJBA2siAjoAACACQf8BcUGAzQBqLQAAQQJ0IABqQZgJaiICIAIvAQBBAWo7AQAgACAGQQFrQf//A3EiAiACQQd2QYACaiACQYACSRtBgMkAai0AAEECdGpBiBNqIgIgAi8BAEEBajsBACAAIAAoAngiAkECayIDNgJ4IAAgACgCdCACa0EBajYCdCAEIAVqQQNrIQUgACgCnC1BAWshByAAKAJsIQIgACgCoC0hCANAIAAgAiIEQQFqIgI2AmwgAiAFTQRAIAAgACgCVCAEIAAoAjhqLQADIAAoAkggACgCWHRzcSIGNgJIIAAoAkAgACgCNCACcUEBdGogACgCRCAGQQF0aiIGLwEAOwEAIAYgAjsBAAsgACADQQFrIgM2AnggAw0ACyAAQQI2AmAgAEEANgJoIAAgBEECaiICNgJsIAcgCEcNAkEAIQMgACAAKAJcIgRBAE4EfyAAKAI4IARqBSADCyACIARrQQAQFCAAIAAoAmw2AlwgACgCACICKAIcIgMQEwJAIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgACgCACgCEA0CQQAPCyAAKAJoBEAgACgCbCAAKAI4akEBay0AACECIAAoAqQtIAAoAqAtIgNBAXRqQQA7AQAgACADQQFqNgKgLSADIAAoApgtaiACOgAAIAAgAkECdGpBlAFqIgIgAi8BAEEBajsBAAJAIAAoAqAtIAAoApwtQQFrRw0AQQAhAyAAIAAoAlwiAkEATgR/IAAoAjggAmoFIAMLIAAoAmwgAmtBABAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATIAIoAhAiBCADKAIUIgUgBCAFSRsiBEUNACACKAIMIAMoAhAgBBAfGiACIAIoAgwgBGo2AgwgAyADKAIQIARqNgIQIAIgAigCFCAEajYCFCACIAIoAhAgBGs2AhAgAyADKAIUIARrIgI2AhQgAg0AIAMgAygCCDYCEAsgACAAKAJsQQFqNgJsIAAgACgCdEEBazYCdCAAKAIAKAIQDQJBAA8FIABBATYCaCAAIAAoAmxBAWo2AmwgACAAKAJ0QQFrNgJ0DAILAAsLIAAoAmgEQCAAKAJsIAAoAjhqQQFrLQAAIQIgACgCpC0gACgCoC0iA0EBdGpBADsBACAAIANBAWo2AqAtIAMgACgCmC1qIAI6AAAgACACQQJ0akGUAWoiAiACLwEAQQFqOwEAIABBADYCaAsgACAAKAJsIgJBAiACQQJJGzYCtC0gAUEERgRAQQAhAyAAIAAoAlwiBEEATgR/IAAoAjggBGoFIAMLIAIgBGtBARAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATAkAgAigCECIEIAMoAhQiBSAEIAVJGyIERQ0AIAIoAgwgAygCECAEEB8aIAIgAigCDCAEajYCDCADIAMoAhAgBGo2AhAgAiACKAIUIARqNgIUIAIgAigCECAEazYCECADIAMoAhQgBGsiAjYCFCACDQAgAyADKAIINgIQC0EDQQIgACgCACgCEBsPCwJAIAAoAqAtRQ0AQQAhAyAAIAAoAlwiBEEATgR/IAAoAjggBGoFIAMLIAIgBGtBABAUIAAgACgCbDYCXCAAKAIAIgIoAhwiAxATAkAgAigCECIEIAMoAhQiBSAEIAVJGyIERQ0AIAIoAgwgAygCECAEEB8aIAIgAigCDCAEajYCDCADIAMoAhAgBGo2AhAgAiACKAIUIARqNgIUIAIgAigCECAEazYCECADIAMoAhQgBGsiAjYCFCACDQAgAyADKAIINgIQCyAAKAIAKAIQDQBBAA8LQQELYQAgAEEANgK8LSAAQQA7AbgtIABBuBZqQajPADYCACAAIABB/BRqNgKwFiAAQawWakGUzwA2AgAgACAAQYgTajYCpBYgAEGgFmpBgM8ANgIAIAAgAEGUAWo2ApgWIAAQEQvwBAEDfyAAQZQBaiECA0AgAiABQQJ0IgNqQQA7AQAgAiADQQRyakEAOwEAIAFBAmoiAUGeAkcNAAsgAEEAOwH8FCAAQQA7AYgTIABBxBVqQQA7AQAgAEHAFWpBADsBACAAQbwVakEAOwEAIABBuBVqQQA7AQAgAEG0FWpBADsBACAAQbAVakEAOwEAIABBrBVqQQA7AQAgAEGoFWpBADsBACAAQaQVakEAOwEAIABBoBVqQQA7AQAgAEGcFWpBADsBACAAQZgVakEAOwEAIABBlBVqQQA7AQAgAEGQFWpBADsBACAAQYwVakEAOwEAIABBiBVqQQA7AQAgAEGEFWpBADsBACAAQYAVakEAOwEAIABB/BNqQQA7AQAgAEH4E2pBADsBACAAQfQTakEAOwEAIABB8BNqQQA7AQAgAEHsE2pBADsBACAAQegTakEAOwEAIABB5BNqQQA7AQAgAEHgE2pBADsBACAAQdwTakEAOwEAIABB2BNqQQA7AQAgAEHUE2pBADsBACAAQdATakEAOwEAIABBzBNqQQA7AQAgAEHIE2pBADsBACAAQcQTakEAOwEAIABBwBNqQQA7AQAgAEG8E2pBADsBACAAQbgTakEAOwEAIABBtBNqQQA7AQAgAEGwE2pBADsBACAAQawTakEAOwEAIABBqBNqQQA7AQAgAEGkE2pBADsBACAAQaATakEAOwEAIABBnBNqQQA7AQAgAEGYE2pBADsBACAAQZQTakEAOwEAIABBkBNqQQA7AQAgAEGME2pBADsBACAAQgA3AqwtIABBlAlqQQE7AQAgAEEANgKoLSAAQQA2AqAtC7IDAQJ/IAAgAC8BuC0gA0H//wNxIgUgACgCvC0iBHRyIgM7AbgtAkACQAJ/IARBDk4EQCAAIAAoAhQiBEEBajYCFCAEIAAoAghqIAM6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAAQbktai0AADoAACAAIAVBECAAKAK8LSIEa3YiAzsBuC0gBEENawwBCyAEQQNqCyIEQQlOBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiADOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGohBCAAQbktai0AACEDDAELIARBAUgNASAAIAAoAhQiBEEBajYCFCAEIAAoAghqIQQLIAQgAzoAAAsgAEEANgK8LSAAQQA7AbgtIAAgACgCFCIDQQFqNgIUIAMgACgCCGogAjoAACAAIAAoAhQiA0EBajYCFCADIAAoAghqIAJBCHY6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiACQX9zIgM6AAAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiADQQh2OgAAIAAoAgggACgCFGogASACEB8aIAAgACgCFCACajYCFAusAQEBfwJAIAACfyAAKAK8LSIBQRBGBEAgACAAKAIUIgFBAWo2AhQgASAAKAIIaiAALQC4LToAACAAIAAoAhQiAUEBajYCFCABIAAoAghqIABBuS1qLQAAOgAAIABBADsBuC1BAAwBCyABQQhIDQEgACAAKAIUIgFBAWo2AhQgASAAKAIIaiAALQC4LToAACAAIABBuS1qLQAAOwG4LSAAKAK8LUEIaws2ArwtCwuhEwENfwJ/AkACQAJAIAAoAoQBQQFOBEAgACgCACIGKAIsQQJHDQNB/4D/n38hBANAAkAgBEEBcUUNACAAIAVBAnRqLwGUAUUNAEEAIQQMBAsCQCAEQQJxRQ0AIAAgBUECdEEEcmovAZQBRQ0AQQAhBAwECyAEQQJ2IQQgBUECaiIFQSBHDQALDAELIAJBBWoiBQwDCwJAIAAvAbgBDQAgAC8BvAENACAALwHIAQ0AQSAhBQNAIAAgBUECdCIEai8BlAENASAAIARBBHJqLwGUAQ0BIAAgBEEIcmovAZQBDQEgACAEQQxyai8BlAENAUEAIQQgBUEEaiIFQYACRw0ACwwBC0EBIQQLIAYgBDYCLAsgACAAQZgWahAVIAAgAEGkFmoQFSAALwGWASEEIAAgAEGcFmooAgAiCkECdGpB//8DOwGaASAKQQBOBEBBB0GKASAEGyEJQQRBAyAEGyELIABBwBVqIQ4gAEHEFWohDyAAQbwVaiEQQX8hDANAIAQhBSAAIAgiDUEBaiIIQQJ0ai8BlgEhBAJAAkAgB0EBaiIGIAlODQAgBCAFRw0AIAYhBwwBCwJ/IAYgC0gEQCAAIAVBAnRqQfwUaiIHLwEAIAZqDAELIAUEQCAFIAxHBEAgACAFQQJ0akH8FGoiBiAGLwEAQQFqOwEACyAQIgcvAQBBAWoMAQsgB0EJTARAIA4iBy8BAEEBagwBCyAPIgcvAQBBAWoLIQYgByAGOwEAQQAhBwJ/IARFBEBBAyELQYoBDAELQQNBBCAEIAVGIgYbIQtBBkEHIAYbCyEJIAUhDAsgCiANRw0ACwsgAEGKE2ovAQAhBCAAIABBqBZqKAIAIgpBAnRqQY4TakH//wM7AQBBACEHIApBAE4EQEEHQYoBIAQbIQlBBEEDIAQbIQsgAEHAFWohDiAAQcQVaiEPIABBvBVqIRBBfyEMQQAhCANAIAQhBSAAIAgiDUEBaiIIQQJ0akGKE2ovAQAhBAJAAkAgB0EBaiIGIAlODQAgBCAFRw0AIAYhBwwBCwJ/IAYgC0gEQCAAIAVBAnRqQfwUaiIHLwEAIAZqDAELIAUEQCAFIAxHBEAgACAFQQJ0akH8FGoiBiAGLwEAQQFqOwEACyAQIgcvAQBBAWoMAQsgB0EJTARAIA4iBy8BAEEBagwBCyAPIgcvAQBBAWoLIQYgByAGOwEAQQAhBwJ/IARFBEBBAyELQYoBDAELQQNBBCAEIAVGIgYbIQtBBkEHIAYbCyEJIAUhDAsgCiANRw0ACwsgACAAQbAWahAVIAAgACgCqC0Cf0ESIABBuhVqLwEADQAaQREgAEGCFWovAQANABpBECAAQbYVai8BAA0AGkEPIABBhhVqLwEADQAaQQ4gAEGyFWovAQANABpBDSAAQYoVai8BAA0AGkEMIABBrhVqLwEADQAaQQsgAEGOFWovAQANABpBCiAAQaoVai8BAA0AGkEJIABBkhVqLwEADQAaQQggAEGmFWovAQANABpBByAAQZYVai8BAA0AGkEGIABBohVqLwEADQAaQQUgAEGaFWovAQANABpBBCAAQZ4Vai8BAA0AGkEDQQIgAEH+FGovAQAbCyIIQQNsaiIEQRFqNgKoLSAEQRtqQQN2IgQgACgCrC1BCmpBA3YiBSAEIAVJGwshBAJAAkAgAUUNACACQQRqIARLDQAgACABIAIgAxASDAELIAAoArwtIQYCQCAEIAVHBEAgACgCiAFBBEcNAQsgACAALwG4LSADQQJqQf//A3EiBCAGdHIiBTsBuC0gAAJ/IAZBDk4EQCAAIAAoAhQiBkEBajYCFCAGIAAoAghqIAU6AAAgACAAKAIUIgVBAWo2AhQgBSAAKAIIaiAAQbktai0AADoAACAAIARBECAAKAK8LSIFa3Y7AbgtIAVBDWsMAQsgBkEDags2ArwtIABBwM8AQcDYABAWDAELIAAvAbgtIANBBGpB//8DcSIHIAZ0ciEFAkAgBkEOTgRAIAAgBTsBuC0gACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAFOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogAEG5LWotAAA6AAAgACgCvC0iBUENayEEIAdBECAFa3YhBQwBCyAGQQNqIQQLIAAgBDYCvC0gAEGcFmooAgAiCkGA/gNqQf//A3EiByAEdCEGIABBqBZqKAIAIQkCfyAEQQxOBEAgACAFIAZyIgQ7AbgtIAAgACgCFCIFQQFqNgIUIAUgACgCCGogBDoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIABBuS1qLQAAOgAAIAAoArwtIgVBC2shBCAHQRAgBWt2DAELIARBBWohBCAFIAZyCyEFIAAgBDYCvC0gCUH//wNxIgcgBHQhBgJ/IARBDE4EQCAAIAUgBnIiBDsBuC0gACAAKAIUIgVBAWo2AhQgBSAAKAIIaiAEOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogAEG5LWotAAA6AAAgACgCvC0iBUELayEEIAdBECAFa3YMAQsgBEEFaiEEIAUgBnILIQUgACAENgK8LSAIQf3/A2pB//8DcSIHIAR0IQYCfyAEQQ1OBEAgACAFIAZyIgQ7AbgtIAAgACgCFCIFQQFqNgIUIAUgACgCCGogBDoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIABBuS1qLQAAOgAAIAAoArwtIgVBDGshBCAHQRAgBWt2DAELIARBBGohBCAFIAZyCyEGIAAgBDYCvC1BACEFIABBuS1qIQ0DQCAAIAYgACAFQZDcAGotAABBAnRqQf4Uai8BACIHIAR0ciIGOwG4LSAAAn8gBEEOTgRAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogBjoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIA0tAAA6AAAgACAHQRAgACgCvC0iBGt2IgY7AbgtIARBDWsMAQsgBEEDagsiBDYCvC0gBSAIRyEHIAVBAWohBSAHDQALIAAgAEGUAWoiBCAKEBcgACAAQYgTaiIFIAkQFyAAIAQgBRAWCyAAEBEgAwRAAkACfyAAKAK8LSIEQQlOBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAALQC4LToAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIQQgAEG5LWotAAAMAQsgBEEBSA0BIAAgACgCFCIEQQFqNgIUIAQgACgCCGohBCAALQC4LQshBSAEIAU6AAALIABBADYCvC0gAEEAOwG4LQsLsRUBFX8jAEEgayEKIAEoAgAhCSABKAIIIgIoAgAhBSACKAIMIQ0gAEKAgICA0McANwLQKEF/IRACQCANQQBKBEBBACECA0ACQCAJIAJBAnRqIgMvAQAEQCAAIAAoAtAoQQFqIgM2AtAoIAAgA0ECdGpB3BZqIAI2AgAgACACakHYKGpBADoAACACIRAMAQsgA0EAOwECCyACQQFqIgIgDUcNAAsgACgC0CgiBEEBSg0BCwNAIAAgBEEBaiICNgLQKCAAIAJBAnRqQdwWaiAQQQFqIgNBACAQQQJIIgQbIgI2AgAgCSACQQJ0IgdqQQE7AQAgACACakHYKGpBADoAACAAIAAoAqgtQQFrNgKoLSAFBEAgACAAKAKsLSAFIAdqLwECazYCrC0LIAMgECAEGyEQIAAoAtAoIgRBAkgNAAsLIAEgEDYCBCAEQQF2IQgDQCAAIAhBAnRqQdwWaigCACELAkAgCCICQQF0IgMgBEoNACAAIAtqQdgoaiEPIAkgC0ECdGohBiAIIQUDQAJAIAMgBE4EQCADIQIMAQsgCSAAQdwWaiICIANBAXIiBEECdGooAgAiDkECdGovAQAiByAJIAIgA0ECdGooAgAiDEECdGovAQAiAk8EQCACIAdHBEAgAyECDAILIAMhAiAAQdgoaiIDIA5qLQAAIAMgDGotAABLDQELIAQhAgsgBi8BACIEIAkgACACQQJ0akHcFmooAgAiA0ECdGovAQAiB0kEQCAFIQIMAgsCQCAEIAdHDQAgDy0AACAAIANqQdgoai0AAEsNACAFIQIMAgsgACAFQQJ0akHcFmogAzYCACACIQUgAkEBdCIDIAAoAtAoIgRMDQALCyAAIAJBAnRqQdwWaiALNgIAIAhBAk4EQCAIQQFrIQggACgC0CghBAwBCwsgACgC0CghAwNAIA0hCCAAIANBAWsiBDYC0CggACgC4BYhCyAAIAAgA0ECdGpB3BZqKAIAIg02AuAWQQEhAgJAIANBA0gNACAAIA1qQdgoaiEPQQIhAyAJIA1BAnRqIQZBASEFA0ACQCADIAROBEAgAyECDAELIAkgAEHcFmoiAiADQQFyIgRBAnRqKAIAIg5BAnRqLwEAIgcgCSACIANBAnRqKAIAIgxBAnRqLwEAIgJPBEAgAiAHRwRAIAMhAgwCCyADIQIgAEHYKGoiAyAOai0AACADIAxqLQAASw0BCyAEIQILIAYvAQAiBCAJIAAgAkECdGpB3BZqKAIAIgNBAnRqLwEAIgdJBEAgBSECDAILAkAgBCAHRw0AIA8tAAAgACADakHYKGotAABLDQAgBSECDAILIAAgBUECdGpB3BZqIAM2AgAgAiEFIAJBAXQiAyAAKALQKCIETA0ACwtBAiEDIABB3BZqIgYgAkECdGogDTYCACAAIAAoAtQoQQFrIgQ2AtQoIAAoAuAWIQIgBiAEQQJ0aiALNgIAIAAgACgC1ChBAWsiBDYC1CggBiAEQQJ0aiACNgIAIAkgCEECdGoiDiAJIAJBAnRqIgQvAQAgCSALQQJ0aiIFLwEAajsBACAAQdgoaiIMIAhqIg8gAiAMai0AACICIAsgDGotAAAiByACIAdLG0EBajoAACAEIAg7AQIgBSAIOwECIAAgCDYC4BZBASEFQQEhAgJAIAAoAtAoIgRBAkgNAANAAn8gAyADIARODQAaIAkgBiADQQFyIgRBAnRqKAIAIgtBAnRqLwEAIgIgCSAGIANBAnRqKAIAIg1BAnRqLwEAIgdPBEAgAyACIAdHDQEaIAMgCyAMai0AACAMIA1qLQAASw0BGgsgBAshAiAOLwEAIgQgCSAAIAJBAnRqQdwWaigCACIDQQJ0ai8BACIHSQRAIAUhAgwCCwJAIAQgB0cNACAPLQAAIAAgA2pB2ChqLQAASw0AIAUhAgwCCyAAIAVBAnRqQdwWaiADNgIAIAIhBSACQQF0IgMgACgC0CgiBEwNAAsLIAhBAWohDSAAIAJBAnRqQdwWaiAINgIAIAAoAtAoIgNBAUoNAAsgACAAKALUKEEBayICNgLUKCAAQdwWaiIDIAJBAnRqIAAoAuAWNgIAIAEoAgQhByABKAIIIgIoAhAhBiACKAIIIREgAigCBCETIAIoAgAhEiABKAIAIQwgAEHUFmoiAUIANwEAIABBzBZqIhRCADcBACAAQcQWaiIVQgA3AQAgAEG8FmoiFkIANwEAQQAhCCAMIAMgACgC1ChBAnRqKAIAQQJ0akEAOwECAkAgACgC1CgiAkG7BEoNACACQQFqIQJBACEOA0AgDCAAIAJBAnRqQdwWaigCACIEQQJ0Ig1qIgUgDCAFLwECQQJ0ai8BAiIDQQFqIAYgAyAGSBsiDzsBAiADIAZOIQMCQCAEIAdKDQAgACAPQQF0akG8FmoiCyALLwEAQQFqOwEAQQAhCyAEIBFOBEAgEyAEIBFrQQJ0aigCACELCyAAIAAoAqgtIAUvAQAiBCALIA9qbGo2AqgtIBJFDQAgACAAKAKsLSALIA0gEmovAQJqIARsajYCrC0LIAMgDmohDiACQQFqIgJBvQRHDQALIA5FDQAgACAGQQF0akG8FmohDwNAIAYhAgNAIAAgAiIDQQFrIgJBAXRqQbwWaiIELwEAIgVFDQALIAQgBUEBazsBACAAIANBAXRqQbwWaiICIAIvAQBBAmo7AQAgDyAPLwEAQQFrIgI7AQAgDkECSiEDIA5BAmshDiADDQALIAZFDQBBvQQhBQNAIAJB//8DcSEDIAUhAgNAIAMEQCAAIAJBAWsiAkECdGpB3BZqKAIAIgQgB0oNASAMIARBAnRqIgQvAQIiBSAGRwRAIAAgACgCqC0gBC8BACAGIAVrbGo2AqgtIAQgBjsBAgsgA0EBayEDIAIhBQwBCwsgBkEBayIGRQ0BIAAgBkEBdGpBvBZqLwEAIQIMAAsACyAKIBYvAQBBAXQiAjsBAiAKIAIgAEG+FmovAQBqQQF0IgI7AQQgCiACIABBwBZqLwEAakEBdCICOwEGIAogAiAAQcIWai8BAGpBAXQiAjsBCCAKIAIgFS8BAGpBAXQiAjsBCiAKIAIgAEHGFmovAQBqQQF0IgI7AQwgCiACIABByBZqLwEAakEBdCICOwEOIAogAiAAQcoWai8BAGpBAXQiAjsBECAKIAIgFC8BAGpBAXQiAjsBEiAKIAIgAEHOFmovAQBqQQF0IgI7ARQgCiACIABB0BZqLwEAakEBdCICOwEWIAogAiAAQdIWai8BAGpBAXQiAjsBGCAKIAEvAQAgAmpBAXQiAjsBGiAKIABB1hZqLwEAIAJqQQF0IgI7ARwgCiACIABB2BZqLwEAakEBdDsBHiAQQQBOBEADQCAJIAhBAnRqIgcvAQIiBARAIAogBEEBdGoiACAALwEAIgBBAWo7AQAgBEEDcSEDQQAhAiAEQQFrQQNPBEAgBEH8/wNxIQUDQCAAQQN2QQFxIABBAnZBAXEgAEECcSACIABBAXFyQQJ0cnJBAXRyIgRBAXQhAiAAQQR2IQAgBUEEayIFDQALCyADBEADQCACIABBAXFyIgRBAXQhAiAAQQF2IQAgA0EBayIDDQALCyAHIAQ7AQALIAggEEchACAIQQFqIQggAA0ACwsL2QgBCn8CQCAAKAKgLUUEQCAAKAK8LSEDDAELIABBuS1qIQgDQCAEQQFqIQogACgCmC0gBGotAAAhBQJAIAACfyAAKAKkLSAEQQF0ai8BACIHRQRAIAEgBUECdGoiAy8BAiEEIAAgAC8BuC0gAy8BACIFIAAoArwtIgN0ciIHOwG4LUEQIARrIANIBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAHOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIAMgBGpBEGsMAgsgAyAEagwBCyAFQYDNAGotAAAiC0ECdCIJQYAIciABaiIDLwEGIQQgACAALwG4LSADLwEEIgwgACgCvC0iBnRyIgM7AbgtIAACf0EQIARrIAZIBEAgACAAKAIUIgZBAWo2AhQgBiAAKAIIaiADOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAxBECAAKAK8LSIGa3YiAzsBuC0gBCAGakEQawwBCyAEIAZqCyIENgK8LSALQQhrQRNNBEAgACADIAUgCUGw3ABqKAIAa0H//wNxIgYgBHRyIgM7AbgtIAACf0EQIAlBwNkAaigCACIFayAESARAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogAzoAACAAIAAoAhQiBEEBajYCFCAEIAAoAghqIAgtAAA6AAAgACAGQRAgACgCvC0iBGt2IgM7AbgtIAQgBWpBEGsMAQsgBCAFagsiBDYCvC0LIAIgB0EBayIFIAVBB3ZBgAJqIAVBgAJJG0GAyQBqLQAAIgtBAnQiCWoiBi8BAiEHIAAgAyAGLwEAIgwgBHRyIgY7AbgtIAACf0EQIAdrIARIBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAGOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogCC0AADoAACAAIAxBECAAKAK8LSIEa3YiBjsBuC0gBCAHakEQawwBCyAEIAdqCyIDNgK8LSALQQRJDQEgACAGIAUgCUGw3QBqKAIAa0H//wNxIgUgA3RyIgc7AbgtQRAgCUHA2gBqKAIAIgRrIANIBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAHOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIAMgBGpBEGsMAQsgAyAEagsiAzYCvC0LIAoiBCAAKAKgLUkNAAsLIAFBgghqLwEAIQQgACAALwG4LSABLwGACCIKIAN0ciIFOwG4LUEQIARrIANIBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAFOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogAEG5LWotAAA6AAAgACAKQRAgACgCvC0iA2t2OwG4LSAAIAMgBGpBEGs2ArwtDwsgACADIARqNgK8LQuXCwEMfyACQQBOBEBBBEEDIAEvAQIiChshBkEHQYoBIAobIQMgAEG5LWohCEF/IQcDQCAKIQkgASALIgxBAWoiC0ECdGovAQIhCgJAAkAgBUEBaiIEIANODQAgCSAKRw0AIAQhBQwBCwJAIAQgBkgEQCAAIAlBAnRqIgVB/BRqIQ0gBUH+FGohDiAAKAK8LSEFA0AgDi8BACEDIAAgAC8BuC0gDS8BACIGIAV0ciIHOwG4LSAAAn9BECADayAFSARAIAAgACgCFCIFQQFqNgIUIAUgACgCCGogBzoAACAAIAAoAhQiBUEBajYCFCAFIAAoAghqIAgtAAA6AAAgACAGQRAgACgCvC0iBWt2OwG4LSADIAVqQRBrDAELIAMgBWoLIgU2ArwtIARBAWsiBA0ACwwBCyAAAn8gCQRAAkAgByAJRgRAIAAoArwtIQMgBCEFDAELIAAgCUECdGoiBEH+FGovAQAhAyAAIAAvAbgtIARB/BRqLwEAIgYgACgCvC0iBHRyIgc7AbgtIAACf0EQIANrIARIBEAgACAAKAIUIgRBAWo2AhQgBCAAKAIIaiAHOgAAIAAgACgCFCIEQQFqNgIUIAQgACgCCGogCC0AADoAACAAIAZBECAAKAK8LSIEa3Y7AbgtIAMgBGpBEGsMAQsgAyAEagsiAzYCvC0LIAAvAbgtIAAvAbwVIgcgA3RyIQQCQEEQIAAvAb4VIgZrIANIBEAgACAEOwG4LSAAIAAoAhQiA0EBajYCFCADIAAoAghqIAQ6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAILQAAOgAAIAYgACgCvC0iBGpBEGshAyAHQRAgBGt2IQQMAQsgAyAGaiEDCyAAIAM2ArwtIAAgBCAFQf3/A2pB//8DcSIFIAN0ciIEOwG4LSADQQ9OBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAEOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIANBDmsMAgsgA0ECagwBCyAFQQlMBEAgAC8BuC0gAC8BwBUiByAAKAK8LSIDdHIhBAJAQRAgAC8BwhUiBmsgA0gEQCAAIAQ7AbgtIAAgACgCFCIDQQFqNgIUIAMgACgCCGogBDoAACAAIAAoAhQiA0EBajYCFCADIAAoAghqIAgtAAA6AAAgBiAAKAK8LSIEakEQayEDIAdBECAEa3YhBAwBCyADIAZqIQMLIAAgAzYCvC0gACAEIAVB/v8DakH//wNxIgUgA3RyIgQ7AbgtIANBDk4EQCAAIAAoAhQiA0EBajYCFCADIAAoAghqIAQ6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAILQAAOgAAIAAgBUEQIAAoArwtIgNrdjsBuC0gA0ENawwCCyADQQNqDAELIAAvAbgtIAAvAcQVIgcgACgCvC0iA3RyIQQCQEEQIAAvAcYVIgZrIANIBEAgACAEOwG4LSAAIAAoAhQiA0EBajYCFCADIAAoAghqIAQ6AAAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAILQAAOgAAIAYgACgCvC0iBGpBEGshAyAHQRAgBGt2IQQMAQsgAyAGaiEDCyAAIAM2ArwtIAAgBCAFQfb/A2pB//8DcSIFIAN0ciIEOwG4LSADQQpOBEAgACAAKAIUIgNBAWo2AhQgAyAAKAIIaiAEOgAAIAAgACgCFCIDQQFqNgIUIAMgACgCCGogCC0AADoAACAAIAVBECAAKAK8LSIDa3Y7AbgtIANBCWsMAQsgA0EHags2ArwtC0EAIQUCfyAKRQRAQYoBIQNBAwwBC0EGQQcgCSAKRiIEGyEDQQNBBCAEGwshBiAJIQcLIAIgDEcNAAsLCwkAIAEgAmwQHAsGACABEB0LXwEBfyMAQUBqIgMkACADQQA2AjAgA0IANwMoIAMgADYCCCADIAI2AhQgAyABNgIMIAMgAUEDbDYCGCADQQhqEAcgA0EIahALIANBCGoQCCADKAIcIQEgA0FAayQAIAELBgBB1N8AC6QuAQx/IwBBEGsiDCQAAkACQAJAAkACQAJAAkACQAJAAkACQAJAIABB9AFNBEBB2N8AKAIAIgZBECAAQQtqQXhxIABBC0kbIgRBA3YiAXYiAEEDcQRAIABBf3NBAXEgAWoiAkEDdCIDQYjgAGooAgAiAUEIaiEAAkAgASgCCCIEIANBgOAAaiIDRgRAQdjfACAGQX4gAndxNgIADAELIAQgAzYCDCADIAQ2AggLIAEgAkEDdCICQQNyNgIEIAEgAmoiASABKAIEQQFyNgIEDA0LIARB4N8AKAIAIghNDQEgAARAAkAgACABdEECIAF0IgBBACAAa3JxIgBBACAAa3FBAWsiACAAQQx2QRBxIgB2IgFBBXZBCHEiAiAAciABIAJ2IgBBAnZBBHEiAXIgACABdiIAQQF2QQJxIgFyIAAgAXYiAEEBdkEBcSIBciAAIAF2aiICQQN0IgNBiOAAaigCACIBKAIIIgAgA0GA4ABqIgNGBEBB2N8AIAZBfiACd3EiBjYCAAwBCyAAIAM2AgwgAyAANgIICyABQQhqIQAgASAEQQNyNgIEIAEgBGoiAyACQQN0IgUgBGsiAkEBcjYCBCABIAVqIAI2AgAgCARAIAhBA3YiBUEDdEGA4ABqIQRB7N8AKAIAIQECfyAGQQEgBXQiBXFFBEBB2N8AIAUgBnI2AgAgBAwBCyAEKAIICyEFIAQgATYCCCAFIAE2AgwgASAENgIMIAEgBTYCCAtB7N8AIAM2AgBB4N8AIAI2AgAMDQtB3N8AKAIAIglFDQEgCUEAIAlrcUEBayIAIABBDHZBEHEiAHYiAUEFdkEIcSICIAByIAEgAnYiAEECdkEEcSIBciAAIAF2IgBBAXZBAnEiAXIgACABdiIAQQF2QQFxIgFyIAAgAXZqQQJ0QYjiAGooAgAiAygCBEF4cSAEayEBIAMhAgNAAkAgAigCECIARQRAIAIoAhQiAEUNAQsgACgCBEF4cSAEayICIAEgASACSyICGyEBIAAgAyACGyEDIAAhAgwBCwsgAyAEaiILIANNDQIgAygCGCEKIAMgAygCDCIFRwRAIAMoAggiAEHo3wAoAgBJGiAAIAU2AgwgBSAANgIIDAwLIANBFGoiAigCACIARQRAIAMoAhAiAEUNBCADQRBqIQILA0AgAiEHIAAiBUEUaiICKAIAIgANACAFQRBqIQIgBSgCECIADQALIAdBADYCAAwLC0F/IQQgAEG/f0sNACAAQQtqIgBBeHEhBEHc3wAoAgAiCEUNAEEfIQcgBEH///8HTQRAIABBCHYiACAAQYD+P2pBEHZBCHEiAHQiASABQYDgH2pBEHZBBHEiAXQiAiACQYCAD2pBEHZBAnEiAnRBD3YgACABciACcmsiAEEBdCAEIABBFWp2QQFxckEcaiEHC0EAIARrIQECQAJAAkAgB0ECdEGI4gBqKAIAIgJFBEBBACEADAELQQAhACAEQQBBGSAHQQF2ayAHQR9GG3QhAwNAAkAgAigCBEF4cSAEayIGIAFPDQAgAiEFIAYiAQ0AQQAhASACIQAMAwsgACACKAIUIgYgBiACIANBHXZBBHFqKAIQIgJGGyAAIAYbIQAgA0EBdCEDIAINAAsLIAAgBXJFBEBBAiAHdCIAQQAgAGtyIAhxIgBFDQMgAEEAIABrcUEBayIAIABBDHZBEHEiAHYiAkEFdkEIcSIDIAByIAIgA3YiAEECdkEEcSICciAAIAJ2IgBBAXZBAnEiAnIgACACdiIAQQF2QQFxIgJyIAAgAnZqQQJ0QYjiAGooAgAhAAsgAEUNAQsDQCAAKAIEQXhxIARrIgYgAUkhAyAGIAEgAxshASAAIAUgAxshBSAAKAIQIgIEfyACBSAAKAIUCyIADQALCyAFRQ0AIAFB4N8AKAIAIARrTw0AIAQgBWoiByAFTQ0BIAUoAhghCSAFIAUoAgwiA0cEQCAFKAIIIgBB6N8AKAIASRogACADNgIMIAMgADYCCAwKCyAFQRRqIgIoAgAiAEUEQCAFKAIQIgBFDQQgBUEQaiECCwNAIAIhBiAAIgNBFGoiAigCACIADQAgA0EQaiECIAMoAhAiAA0ACyAGQQA2AgAMCQsgBEHg3wAoAgAiAE0EQEHs3wAoAgAhAQJAIAAgBGsiAkEQTwRAQeDfACACNgIAQezfACABIARqIgM2AgAgAyACQQFyNgIEIAAgAWogAjYCACABIARBA3I2AgQMAQtB7N8AQQA2AgBB4N8AQQA2AgAgASAAQQNyNgIEIAAgAWoiACAAKAIEQQFyNgIECyABQQhqIQAMCwsgBEHk3wAoAgAiA0kEQEHk3wAgAyAEayIBNgIAQfDfAEHw3wAoAgAiACAEaiICNgIAIAIgAUEBcjYCBCAAIARBA3I2AgQgAEEIaiEADAsLQQAhACAEQS9qIggCf0Gw4wAoAgAEQEG44wAoAgAMAQtBvOMAQn83AgBBtOMAQoCggICAgAQ3AgBBsOMAIAxBDGpBcHFB2KrVqgVzNgIAQcTjAEEANgIAQZTjAEEANgIAQYAgCyIBaiIGQQAgAWsiB3EiBSAETQ0KQZDjACgCACIBBEBBiOMAKAIAIgIgBWoiCSACTQ0LIAEgCUkNCwtBlOMALQAAQQRxDQUCQAJAQfDfACgCACIBBEBBmOMAIQADQCABIAAoAgAiAk8EQCACIAAoAgRqIAFLDQMLIAAoAggiAA0ACwtBABAeIgNBf0YNBiAFIQZBtOMAKAIAIgBBAWsiASADcQRAIAUgA2sgASADakEAIABrcWohBgsgBCAGTw0GIAZB/v///wdLDQZBkOMAKAIAIgAEQEGI4wAoAgAiASAGaiICIAFNDQcgACACSQ0HCyAGEB4iACADRw0BDAgLIAYgA2sgB3EiBkH+////B0sNBSAGEB4iAyAAKAIAIAAoAgRqRg0EIAMhAAsCQCAEQTBqIAZNDQAgAEF/Rg0AQbjjACgCACIBIAggBmtqQQAgAWtxIgFB/v///wdLBEAgACEDDAgLIAEQHkF/RwRAIAEgBmohBiAAIQMMCAtBACAGaxAeGgwFCyAAIQMgAEF/Rw0GDAQLAAtBACEFDAcLQQAhAwwFCyADQX9HDQILQZTjAEGU4wAoAgBBBHI2AgALIAVB/v///wdLDQEgBRAeIgNBABAeIgBPDQEgA0F/Rg0BIABBf0YNASAAIANrIgYgBEEoak0NAQtBiOMAQYjjACgCACAGaiIANgIAQYzjACgCACAASQRAQYzjACAANgIACwJAAkACQEHw3wAoAgAiAQRAQZjjACEAA0AgAyAAKAIAIgIgACgCBCIFakYNAiAAKAIIIgANAAsMAgtB6N8AKAIAIgBBACAAIANNG0UEQEHo3wAgAzYCAAtBACEAQZzjACAGNgIAQZjjACADNgIAQfjfAEF/NgIAQfzfAEGw4wAoAgA2AgBBpOMAQQA2AgADQCAAQQN0IgFBiOAAaiABQYDgAGoiAjYCACABQYzgAGogAjYCACAAQQFqIgBBIEcNAAtB5N8AIAZBKGsiAEF4IANrQQdxQQAgA0EIakEHcRsiAWsiAjYCAEHw3wAgASADaiIBNgIAIAEgAkEBcjYCBCAAIANqQSg2AgRB9N8AQcDjACgCADYCAAwCCyABIANPDQAgASACSQ0AIAAoAgxBCHENACAAIAUgBmo2AgRB8N8AIAFBeCABa0EHcUEAIAFBCGpBB3EbIgBqIgI2AgBB5N8AQeTfACgCACAGaiIDIABrIgA2AgAgAiAAQQFyNgIEIAEgA2pBKDYCBEH03wBBwOMAKAIANgIADAELQejfACgCACADSwRAQejfACADNgIACyADIAZqIQJBmOMAIQACQAJAAkACQAJAAkADQCACIAAoAgBHBEAgACgCCCIADQEMAgsLIAAtAAxBCHFFDQELQZjjACEAA0AgASAAKAIAIgJPBEAgAiAAKAIEaiICIAFLDQMLIAAoAgghAAwACwALIAAgAzYCACAAIAAoAgQgBmo2AgQgA0F4IANrQQdxQQAgA0EIakEHcRtqIgcgBEEDcjYCBCACQXggAmtBB3FBACACQQhqQQdxG2oiBiAHayAEayECIAQgB2ohBCABIAZGBEBB8N8AIAQ2AgBB5N8AQeTfACgCACACaiIANgIAIAQgAEEBcjYCBAwDCyAGQezfACgCAEYEQEHs3wAgBDYCAEHg3wBB4N8AKAIAIAJqIgA2AgAgBCAAQQFyNgIEIAAgBGogADYCAAwDCyAGKAIEIgBBA3FBAUYEQCAAQXhxIQgCQCAAQf8BTQRAIAYoAggiASAAQQN2IgVBA3RBgOAAakYaIAEgBigCDCIARgRAQdjfAEHY3wAoAgBBfiAFd3E2AgAMAgsgASAANgIMIAAgATYCCAwBCyAGKAIYIQkCQCAGIAYoAgwiA0cEQCAGKAIIIgAgAzYCDCADIAA2AggMAQsCQCAGQRRqIgAoAgAiAQ0AIAZBEGoiACgCACIBDQBBACEDDAELA0AgACEFIAEiA0EUaiIAKAIAIgENACADQRBqIQAgAygCECIBDQALIAVBADYCAAsgCUUNAAJAIAYgBigCHCIBQQJ0QYjiAGoiACgCAEYEQCAAIAM2AgAgAw0BQdzfAEHc3wAoAgBBfiABd3E2AgAMAgsgCUEQQRQgCSgCECAGRhtqIAM2AgAgA0UNAQsgAyAJNgIYIAYoAhAiAARAIAMgADYCECAAIAM2AhgLIAYoAhQiAEUNACADIAA2AhQgACADNgIYCyAGIAhqIQYgAiAIaiECCyAGIAYoAgRBfnE2AgQgBCACQQFyNgIEIAIgBGogAjYCACACQf8BTQRAIAJBA3YiAUEDdEGA4ABqIQACf0HY3wAoAgAiAkEBIAF0IgFxRQRAQdjfACABIAJyNgIAIAAMAQsgACgCCAshASAAIAQ2AgggASAENgIMIAQgADYCDCAEIAE2AggMAwtBHyEAIAJB////B00EQCACQQh2IgAgAEGA/j9qQRB2QQhxIgB0IgEgAUGA4B9qQRB2QQRxIgF0IgMgA0GAgA9qQRB2QQJxIgN0QQ92IAAgAXIgA3JrIgBBAXQgAiAAQRVqdkEBcXJBHGohAAsgBCAANgIcIARCADcCECAAQQJ0QYjiAGohAQJAQdzfACgCACIDQQEgAHQiBXFFBEBB3N8AIAMgBXI2AgAgASAENgIAIAQgATYCGAwBCyACQQBBGSAAQQF2ayAAQR9GG3QhACABKAIAIQMDQCADIgEoAgRBeHEgAkYNAyAAQR12IQMgAEEBdCEAIAEgA0EEcWpBEGoiBSgCACIDDQALIAUgBDYCACAEIAE2AhgLIAQgBDYCDCAEIAQ2AggMAgtB5N8AIAZBKGsiAEF4IANrQQdxQQAgA0EIakEHcRsiBWsiBzYCAEHw3wAgAyAFaiIFNgIAIAUgB0EBcjYCBCAAIANqQSg2AgRB9N8AQcDjACgCADYCACABIAJBJyACa0EHcUEAIAJBJ2tBB3EbakEvayIAIAAgAUEQakkbIgVBGzYCBCAFQaDjACkCADcCECAFQZjjACkCADcCCEGg4wAgBUEIajYCAEGc4wAgBjYCAEGY4wAgAzYCAEGk4wBBADYCACAFQRhqIQADQCAAQQc2AgQgAEEIaiEDIABBBGohACACIANLDQALIAEgBUYNAyAFIAUoAgRBfnE2AgQgASAFIAFrIgZBAXI2AgQgBSAGNgIAIAZB/wFNBEAgBkEDdiICQQN0QYDgAGohAAJ/QdjfACgCACIDQQEgAnQiAnFFBEBB2N8AIAIgA3I2AgAgAAwBCyAAKAIICyECIAAgATYCCCACIAE2AgwgASAANgIMIAEgAjYCCAwEC0EfIQAgAUIANwIQIAZB////B00EQCAGQQh2IgAgAEGA/j9qQRB2QQhxIgB0IgIgAkGA4B9qQRB2QQRxIgJ0IgMgA0GAgA9qQRB2QQJxIgN0QQ92IAAgAnIgA3JrIgBBAXQgBiAAQRVqdkEBcXJBHGohAAsgASAANgIcIABBAnRBiOIAaiECAkBB3N8AKAIAIgNBASAAdCIFcUUEQEHc3wAgAyAFcjYCACACIAE2AgAgASACNgIYDAELIAZBAEEZIABBAXZrIABBH0YbdCEAIAIoAgAhAwNAIAMiAigCBEF4cSAGRg0EIABBHXYhAyAAQQF0IQAgAiADQQRxakEQaiIFKAIAIgMNAAsgBSABNgIAIAEgAjYCGAsgASABNgIMIAEgATYCCAwDCyABKAIIIgAgBDYCDCABIAQ2AgggBEEANgIYIAQgATYCDCAEIAA2AggLIAdBCGohAAwFCyACKAIIIgAgATYCDCACIAE2AgggAUEANgIYIAEgAjYCDCABIAA2AggLQeTfACgCACIAIARNDQBB5N8AIAAgBGsiATYCAEHw3wBB8N8AKAIAIgAgBGoiAjYCACACIAFBAXI2AgQgACAEQQNyNgIEIABBCGohAAwDC0HU3wBBMDYCAEEAIQAMAgsCQCAJRQ0AAkAgBSgCHCICQQJ0QYjiAGoiACgCACAFRgRAIAAgAzYCACADDQFB3N8AIAhBfiACd3EiCDYCAAwCCyAJQRBBFCAJKAIQIAVGG2ogAzYCACADRQ0BCyADIAk2AhggBSgCECIABEAgAyAANgIQIAAgAzYCGAsgBSgCFCIARQ0AIAMgADYCFCAAIAM2AhgLAkAgAUEPTQRAIAUgASAEaiIAQQNyNgIEIAAgBWoiACAAKAIEQQFyNgIEDAELIAUgBEEDcjYCBCAHIAFBAXI2AgQgASAHaiABNgIAIAFB/wFNBEAgAUEDdiIBQQN0QYDgAGohAAJ/QdjfACgCACICQQEgAXQiAXFFBEBB2N8AIAEgAnI2AgAgAAwBCyAAKAIICyEBIAAgBzYCCCABIAc2AgwgByAANgIMIAcgATYCCAwBC0EfIQAgAUH///8HTQRAIAFBCHYiACAAQYD+P2pBEHZBCHEiAHQiAiACQYDgH2pBEHZBBHEiAnQiBCAEQYCAD2pBEHZBAnEiBHRBD3YgACACciAEcmsiAEEBdCABIABBFWp2QQFxckEcaiEACyAHIAA2AhwgB0IANwIQIABBAnRBiOIAaiECAkACQCAIQQEgAHQiBHFFBEBB3N8AIAQgCHI2AgAgAiAHNgIAIAcgAjYCGAwBCyABQQBBGSAAQQF2ayAAQR9GG3QhACACKAIAIQQDQCAEIgIoAgRBeHEgAUYNAiAAQR12IQQgAEEBdCEAIAIgBEEEcWpBEGoiAygCACIEDQALIAMgBzYCACAHIAI2AhgLIAcgBzYCDCAHIAc2AggMAQsgAigCCCIAIAc2AgwgAiAHNgIIIAdBADYCGCAHIAI2AgwgByAANgIICyAFQQhqIQAMAQsCQCAKRQ0AAkAgAygCHCICQQJ0QYjiAGoiACgCACADRgRAIAAgBTYCACAFDQFB3N8AIAlBfiACd3E2AgAMAgsgCkEQQRQgCigCECADRhtqIAU2AgAgBUUNAQsgBSAKNgIYIAMoAhAiAARAIAUgADYCECAAIAU2AhgLIAMoAhQiAEUNACAFIAA2AhQgACAFNgIYCwJAIAFBD00EQCADIAEgBGoiAEEDcjYCBCAAIANqIgAgACgCBEEBcjYCBAwBCyADIARBA3I2AgQgCyABQQFyNgIEIAEgC2ogATYCACAIBEAgCEEDdiIEQQN0QYDgAGohAkHs3wAoAgAhAAJ/QQEgBHQiBCAGcUUEQEHY3wAgBCAGcjYCACACDAELIAIoAggLIQQgAiAANgIIIAQgADYCDCAAIAI2AgwgACAENgIIC0Hs3wAgCzYCAEHg3wAgATYCAAsgA0EIaiEACyAMQRBqJAAgAAvMDAEHfwJAIABFDQAgAEEIayICIABBBGsoAgAiAUF4cSIAaiEFAkAgAUEBcQ0AIAFBA3FFDQEgAiACKAIAIgFrIgJB6N8AKAIASQ0BIAAgAWohACACQezfACgCAEcEQCABQf8BTQRAIAIoAggiBCABQQN2IgdBA3RBgOAAakYaIAQgAigCDCIBRgRAQdjfAEHY3wAoAgBBfiAHd3E2AgAMAwsgBCABNgIMIAEgBDYCCAwCCyACKAIYIQYCQCACIAIoAgwiA0cEQCACKAIIIgEgAzYCDCADIAE2AggMAQsCQCACQRRqIgEoAgAiBA0AIAJBEGoiASgCACIEDQBBACEDDAELA0AgASEHIAQiA0EUaiIBKAIAIgQNACADQRBqIQEgAygCECIEDQALIAdBADYCAAsgBkUNAQJAIAIgAigCHCIEQQJ0QYjiAGoiASgCAEYEQCABIAM2AgAgAw0BQdzfAEHc3wAoAgBBfiAEd3E2AgAMAwsgBkEQQRQgBigCECACRhtqIAM2AgAgA0UNAgsgAyAGNgIYIAIoAhAiAQRAIAMgATYCECABIAM2AhgLIAIoAhQiAUUNASADIAE2AhQgASADNgIYDAELIAUoAgQiAUEDcUEDRw0AQeDfACAANgIAIAUgAUF+cTYCBCACIABBAXI2AgQgACACaiAANgIADwsgAiAFTw0AIAUoAgQiAUEBcUUNAAJAIAFBAnFFBEAgBUHw3wAoAgBGBEBB8N8AIAI2AgBB5N8AQeTfACgCACAAaiIANgIAIAIgAEEBcjYCBCACQezfACgCAEcNA0Hg3wBBADYCAEHs3wBBADYCAA8LIAVB7N8AKAIARgRAQezfACACNgIAQeDfAEHg3wAoAgAgAGoiADYCACACIABBAXI2AgQgACACaiAANgIADwsgAUF4cSAAaiEAAkAgAUH/AU0EQCAFKAIIIgQgAUEDdiIHQQN0QYDgAGpGGiAEIAUoAgwiAUYEQEHY3wBB2N8AKAIAQX4gB3dxNgIADAILIAQgATYCDCABIAQ2AggMAQsgBSgCGCEGAkAgBSAFKAIMIgNHBEAgBSgCCCIBQejfACgCAEkaIAEgAzYCDCADIAE2AggMAQsCQCAFQRRqIgEoAgAiBA0AIAVBEGoiASgCACIEDQBBACEDDAELA0AgASEHIAQiA0EUaiIBKAIAIgQNACADQRBqIQEgAygCECIEDQALIAdBADYCAAsgBkUNAAJAIAUgBSgCHCIEQQJ0QYjiAGoiASgCAEYEQCABIAM2AgAgAw0BQdzfAEHc3wAoAgBBfiAEd3E2AgAMAgsgBkEQQRQgBigCECAFRhtqIAM2AgAgA0UNAQsgAyAGNgIYIAUoAhAiAQRAIAMgATYCECABIAM2AhgLIAUoAhQiAUUNACADIAE2AhQgASADNgIYCyACIABBAXI2AgQgACACaiAANgIAIAJB7N8AKAIARw0BQeDfACAANgIADwsgBSABQX5xNgIEIAIgAEEBcjYCBCAAIAJqIAA2AgALIABB/wFNBEAgAEEDdiIBQQN0QYDgAGohAAJ/QdjfACgCACIEQQEgAXQiAXFFBEBB2N8AIAEgBHI2AgAgAAwBCyAAKAIICyEBIAAgAjYCCCABIAI2AgwgAiAANgIMIAIgATYCCA8LQR8hASACQgA3AhAgAEH///8HTQRAIABBCHYiASABQYD+P2pBEHZBCHEiAXQiBCAEQYDgH2pBEHZBBHEiBHQiAyADQYCAD2pBEHZBAnEiA3RBD3YgASAEciADcmsiAUEBdCAAIAFBFWp2QQFxckEcaiEBCyACIAE2AhwgAUECdEGI4gBqIQQCQAJAAkBB3N8AKAIAIgNBASABdCIFcUUEQEHc3wAgAyAFcjYCACAEIAI2AgAgAiAENgIYDAELIABBAEEZIAFBAXZrIAFBH0YbdCEBIAQoAgAhAwNAIAMiBCgCBEF4cSAARg0CIAFBHXYhAyABQQF0IQEgBCADQQRxakEQaiIFKAIAIgMNAAsgBSACNgIAIAIgBDYCGAsgAiACNgIMIAIgAjYCCAwBCyAEKAIIIgAgAjYCDCAEIAI2AgggAkEANgIYIAIgBDYCDCACIAA2AggLQfjfAEH43wAoAgBBAWsiAkF/IAIbNgIACwtVAQJ/QdDfACgCACIBIABBA2pBfHEiAmohAAJAIAJBAU5BACAAIAFNGw0APwBBEHQgAEkEQCAAEABFDQELQdDfACAANgIAIAEPC0HU3wBBMDYCAEF/C4IEAQN/IAJBgARPBEAgACABIAIQARogAA8LIAAgAmohAwJAIAAgAXNBA3FFBEACQCACQQFIBEAgACECDAELIABBA3FFBEAgACECDAELIAAhAgNAIAIgAS0AADoAACABQQFqIQEgAkEBaiICIANPDQEgAkEDcQ0ACwsCQCADQXxxIgRBwABJDQAgAiAEQUBqIgVLDQADQCACIAEoAgA2AgAgAiABKAIENgIEIAIgASgCCDYCCCACIAEoAgw2AgwgAiABKAIQNgIQIAIgASgCFDYCFCACIAEoAhg2AhggAiABKAIcNgIcIAIgASgCIDYCICACIAEoAiQ2AiQgAiABKAIoNgIoIAIgASgCLDYCLCACIAEoAjA2AjAgAiABKAI0NgI0IAIgASgCODYCOCACIAEoAjw2AjwgAUFAayEBIAJBQGsiAiAFTQ0ACwsgAiAETw0BA0AgAiABKAIANgIAIAFBBGohASACQQRqIgIgBEkNAAsMAQsgA0EESQRAIAAhAgwBCyAAIANBBGsiBEsEQCAAIQIMAQsgACECA0AgAiABLQAAOgAAIAIgAS0AAToAASACIAEtAAI6AAIgAiABLQADOgADIAFBBGohASACQQRqIgIgBE0NAAsLIAIgA0kEQANAIAIgAS0AADoAACABQQFqIQEgAkEBaiICIANHDQALCyAAC9YCAQJ/AkAgAUUNACAAIAFqIgJBAWtBADoAACAAQQA6AAAgAUEDSQ0AIAJBAmtBADoAACAAQQA6AAEgAkEDa0EAOgAAIABBADoAAiABQQdJDQAgAkEEa0EAOgAAIABBADoAAyABQQlJDQAgAEEAIABrQQNxIgNqIgJBADYCACACIAEgA2tBfHEiA2oiAUEEa0EANgIAIANBCUkNACACQQA2AgggAkEANgIEIAFBCGtBADYCACABQQxrQQA2AgAgA0EZSQ0AIAJBADYCGCACQQA2AhQgAkEANgIQIAJBADYCDCABQRBrQQA2AgAgAUEUa0EANgIAIAFBGGtBADYCACABQRxrQQA2AgAgAyACQQRxQRhyIgNrIgFBIEkNACACIANqIQIDQCACQgA3AxggAkIANwMQIAJCADcDCCACQgA3AwAgAkEgaiECIAFBIGsiAUEfSw0ACwsLBAAjAAsGACAAJAALEAAjACAAa0FwcSIAJAAgAAsLvVYIAEGECAvxQJYwB3csYQ7uulEJmRnEbQeP9GpwNaVj6aOVZJ4yiNsOpLjceR7p1eCI2dKXK0y2Cb18sX4HLbjnkR2/kGQQtx3yILBqSHG5895BvoR91Noa6+TdbVG11PTHhdODVphsE8Coa2R6+WL97Mllik9cARTZbAZjYz0P+vUNCI3IIG47XhBpTORBYNVycWei0eQDPEfUBEv9hQ3Sa7UKpfqotTVsmLJC1sm720D5vKzjbNgydVzfRc8N1txZPdGrrDDZJjoA3lGAUdfIFmHQv7X0tCEjxLNWmZW6zw+lvbieuAIoCIgFX7LZDMYk6Quxh3xvLxFMaFirHWHBPS1mtpBB3HYGcdsBvCDSmCoQ1e+JhbFxH7W2BqXkv58z1LjooskHeDT5AA+OqAmWGJgO4bsNan8tPW0Il2xkkQFcY+b0UWtrYmFsHNgwZYVOAGLy7ZUGbHulARvB9AiCV8QP9cbZsGVQ6bcS6ri+i3yIufzfHd1iSS3aFfN804xlTNT7WGGyTc5RtTp0ALyj4jC71EGl30rXldg9bcTRpPv01tNq6WlD/NluNEaIZ63QuGDacy0EROUdAzNfTAqqyXwN3TxxBVCqQQInEBALvoYgDMkltWhXs4VvIAnUZrmf5GHODvneXpjJ2SkimNCwtKjXxxc9s1mBDbQuO1y9t61susAgg7jttrO/mgzitgOa0rF0OUfV6q930p0VJtsEgxbccxILY+OEO2SUPmptDahaanoLzw7knf8JkyeuAAqxngd9RJMP8NKjCIdo8gEe/sIGaV1XYvfLZ2WAcTZsGecGa252G9T+4CvTiVp62hDMSt1nb9+5+fnvvo5DvrcX1Y6wYOij1tZ+k9GhxMLYOFLy30/xZ7vRZ1e8pt0GtT9LNrJI2isN2EwbCq/2SgM2YHoEQcPvYN9V32eo745uMXm+aUaMs2HLGoNmvKDSbyU24mhSlXcMzANHC7u5FgIiLyYFVb47usUoC72yklq0KwRqs1yn/9fCMc/QtYue2Swdrt5bsMJkmybyY+yco2p1CpNtAqkGCZw/Ng7rhWcHchNXAAWCSr+VFHq44q4rsXs4G7YMm47Skg2+1eW379x8Id/bC9TS04ZC4tTx+LPdaG6D2h/NFr6BWya59uF3sG93R7cY5loIiHBqD//KOwZmXAsBEf+eZY9prmL40/9rYUXPbBZ44gqg7tIN11SDBE7CswM5YSZnp/cWYNBNR2lJ23duPkpq0a7cWtbZZgvfQPA72DdTrrypxZ673n/Pskfp/7UwHPK9vYrCusowk7NTpqO0JAU20LqTBtfNKVfeVL9n2SMuemazuEphxAIbaF2UK28qN74LtKGODMMb3wVaje8CLQAAAABBMRsZgmI2MsNTLSsExWxkRfR3fYanWlbHlkFPCIrZyEm7wtGK6O/6y9n04wxPtaxNfq61ji2Dns8cmIdREsJKECPZU9Nw9HiSQe9hVdeuLhTmtTfXtZgcloSDBVmYG4IYqQCb2/otsJrLNqldXXfmHGxs/98/QdSeDlrNoiSEleMVn4wgRrKnYXepvqbh6PHn0PPoJIPew2Wyxdqqrl1d659GRCjMa29p/XB2rmsxOe9aKiAsCQcLbTgcEvM2Rt+yB13GcVRw7TBla/T38yq7tsIxonWRHIk0oAeQ+7yfF7qNhA553qklOO+yPP9583O+SOhqfRvFQTwq3lgFT3nwRH5i6YctT8LGHFTbAYoVlEC7Do2D6COmwtk4vw3FoDhM9Lshj6eWCs6WjRMJAMxcSDHXRYti+m7KU+F3VF27uhVsoKPWP42Ilw6WkVCY194RqczH0vrh7JPL+vVc12JyHeZ5a961VECfhE9ZWBIOFhkjFQ/acDgkm0EjPadr/WXmWuZ8JQnLV2Q40E6jrpEB4p+KGCHMpzNg/bwqr+Ekre7QP7QtgxKfbLIJhqskSMnqFVPQKUZ++2h3ZeL2eT8vt0gkNnQbCR01KhIE8rxTS7ONSFJw3mV5Me9+YP7z5ue/wv3+fJHQ1T2gy8z6NoqDuweRmnhUvLE5ZaeoS5iDOwqpmCLJ+rUJiMuuEE9d718ObPRGzT/ZbYwOwnRDElrzAiNB6sFwbMGAQXfYR9c2lwbmLY7FtQClhIQbvBqKQXFbu1pomOh3Q9nZbFoeTy0VX342DJwtGyfdHAA+EgCYuVMxg6CQYq6L0VO1khbF9N1X9O/ElKfC79WW2fbpvAeuqI0ct2veMZwq7yqF7XlryqxIcNNvG134LipG4eE23magB8V/Y1ToVCJl803l87ICpMKpG2eRhDAmoJ8puK7F5Pmf3v06zPPWe/3oz7xrqYD9WrKZPgmfsn84hKuwJBws8RUHNTJGKh5zdzEHtOFwSPXQa1E2g0Z6d7JdY07X+ssP5uHSzLXM+Y2E1+BKEpavCyONtshwoJ2JQbuERl0jAwdsOBrEPxUxhQ4OKEKYT2cDqVR+wPp5VYHLYkwfxTiBXvQjmJ2nDrPclhWqGwBU5VoxT/yZYmLX2FN5zhdP4UlWfvpQlS3Xe9QczGITio0tUruWNJHoux/Q2aAG7PN+Xq3CZUdukUhsL6BTdeg2EjqpBwkjalQkCCtlPxHkeaeWpUi8j2YbkaQnKoq94LzL8qGN0Oti3v3AI+/m2b3hvBT80KcNP4OKJn6ykT+5JNBw+BXLaTtG5kJ6d/1btWtl3PRafsU3CVPudjhI97GuCbjwnxKhM8w/inL9JJMAAAAAN2rCAW7UhANZvkYC3KgJB+vCywayfI0EhRZPBbhREw6PO9EP1oWXDeHvVQxk+RoJU5PYCAotngo9R1wLcKMmHEfJ5B0ed6IfKR1gHqwLLxubYe0awt+rGPW1aRnI8jUS/5j3E6YmsRGRTHMQFFo8FSMw/hR6jrgWTeR6F+BGTTjXLI85jpLJO7n4Czo87kQ/C4SGPlI6wDxlUAI9WBdeNm99nDc2w9o1AakYNIS/VzGz1ZUw6mvTMt0BETOQ5Wskp4+pJf4x7yfJWy0mTE1iI3snoCIimeYgFfMkISi0eCof3rorRmD8KXEKPij0HHEtw3azLJrI9S6tojcvwI2acPfnWHGuWR5zmTPcchwlk3crT1F2cvEXdEWb1XV43Il+T7ZLfxYIDX0hYs98pHSAeZMeQnjKoAR6/crGe7AuvGyHRH5t3vo4b+mQ+m5shrVrW+x3agJSMWg1OPNpCH+vYj8VbWNmqythUcHpYNTXpmXjvWRkugMiZo1p4Gcgy9dIF6EVSU4fU0t5dZFK/GPeT8sJHE6St1pMpd2YTZiaxEav8AZH9k5ARcEkgkREMs1Bc1gPQCrmSUIdjItDUGjxVGcCM1U+vHVXCda3VozA+FO7qjpS4hR8UNV+vlHoOeJa31MgW4btZlmxh6RYNJHrXQP7KVxaRW9ebS+tX4AbNeG3cffg7s+x4tmlc+Ncszzma9n+5zJnuOUFDXrkOEom7w8g5O5WnqLsYfRg7eTiL+jTiO3pijar671caerwuBP9x9LR/J5sl/6pBlX/LBAa+ht62PtCxJ75da5c+EjpAPN/g8LyJj2E8BFXRvGUQQn0oyvL9fqVjffN/0/2YF142Vc3utgOifzaOeM+27z1cd6Ln7Pf0iH13eVLN9zYDGvX72ap1rbY79SBsi3VBKRi0DPOoNFqcObTXRok0hD+XsUnlJzEfiraxklAGMfMVlfC+zyVw6KC08GV6BHAqK9Ny5/Fj8rGe8nI8RELyXQHRMxDbYbNGtPAzy25As5Alq+Rd/xtkC5CK5IZKOmTnD6mlqtUZJfy6iKVxYDglPjHvJ/PrX6elhM4nKF5+p0kb7WYEwV3mUq7MZt90fOaMDWJjQdfS4xe4Q2OaYvPj+ydgIrb90KLgkkEibUjxoiIZJqDvw5YguawHoDR2tyBVMyThGOmUYU6GBeHDXLVhqDQ4qmXuiCozgRmqvlupKt8eOuuSxIprxKsb60lxq2sGIHxpy/rM6Z2VXWkQT+3pcQp+KDzQzqhqv18o52XvqLQc8S15xkGtL6nQLaJzYK3DNvNsjuxD7NiD0mxVWWLsGgi17tfSBW6BvZTuDGckbm0it68g+AcvdpeWr/tNJi+AAAAAGVnvLiLyAmq7q+1EleXYo8y8N433F9rJbk4153vKLTFik8IfWTgvW8BhwHXuL/WSt3YavIzd9/gVhBjWJ9XGVD6MKXoFJ8Q+nH4rELIwHvfrafHZ0MIcnUmb87NcH+tlRUYES37t6Q/ntAYhyfozxpCj3OirCDGsMlHegg+rzKgW8iOGLVnOwrQAIeyaThQLwxf7Jfi8FmFh5flPdGHhmW04DrdWk+Pzz8oM3eGEOTq43dYUg3Y7UBov1H4ofgr8MSfl0gqMCJaT1ee4vZvSX+TCPXHfadA1RjA/G1O0J81K7cjjcUYlp+gfyonGUf9unwgQQKSj/QQ9+hIqD1YFJtYP6gjtpAdMdP3oYlqz3YUD6jKrOEHf76EYMMG0nCgXrcXHOZZuKn0PN8VTIXnwtHggH5pDi/Le2tId8OiDw3Lx2ixcynHBGFMoLjZ9ZhvRJD/0/x+UGbuGzfaVk0nuQ4oQAW2xu+wpKOIDBwasNuBf9dnOZF40iv0H26TA/cmO2aQmoOIPy+R7ViTKVRgRLQxB/gM36hNHrrP8abs35L+ibguRmcXm1QCcCfsu0jwcd4vTMkwgPnbVedFY5ygP2v5x4PTF2g2wXIPinnLN13krlDhXED/VE4lmOj2c4iLrhbvNxb4QIIEnSc+vCQf6SFBeFWZr9fgi8qwXDM7tlntXtHlVbB+UEfVGez/bCE7YglGh9rn6TLIgo6OcNSe7Six+VGQX1bkgjoxWDqDCY+n5m4zHwjBhg1tpjq1pOFAvcGG/AUvKUkXSk71r/N2IjKWEZ6KeL4rmB3ZlyBLyfR4Lq5IwMAB/dKlZkFqHF6W93k5Kk+Xlp9d8vEj5QUZa01gftf1jtFi5+u23l9SjgnCN+m1etlGAGi8IbzQ6jHfiI9WYzBh+dYiBJ5qmr2mvQfYwQG/Nm60rVMJCBWaTnId/ynOpRGGe7d04ccPzdkQkqi+rCpGERk4I3algHVmxtgQAXpg/q7PcpvJc8oi8aRXR5YY76k5rf3MXhFFBu5NdmOJ8c6NJkTc6EH4ZFF5L/k0HpNB2rEmU7/WmuvpxvmzjKFFC2IO8BkHaUyhvlGbPNs2J4Q1mZKWUP4uLpm5VCb83uieEnFdjHcW4TTOLjapq0mKEUXmPwMggYO7dpHg4xP2XFv9WelJmD5V8SEGgmxEYT7Uqs6Lxs+pN344QX/WXSbDbrOJdnzW7srEb9YdWQqxoeHkHhTzgXmoS9dpyxOyDnerXKHCuTnGfgGA/qmc5ZkVJAs2oDZuURyOpxZmhsJx2j4s3m8sSbnTlPCBBAmV5rixe0kNox4usRtIPtJDLVlu+8P22+mmkWdRH6mwzHrODHSUYblm8QYF3gAAAAB3BzCW7g5hLJkJUboHbcQZcGr0j+ljpTWeZJWjDtuIMnncuKTg1ekel9LZiAm2TCt+sXy957gtB5C/HZEdtxBkarAg8vO5cUiEvkHeGtrUfW3d5Ov01LVRg9OFxxNsmFZka6jA/WL5eoplyewUAVxPYwZs2foPPWONCA31O24gyExpEF7VYEHkomdxcjwD5NFLBNRH0g2F/aUKtWs1taj6QrKYbNu7ydasvPlAMths40XfXHXc1g3Pq9E9WSbZMKxR3gA6yNdRgL/QYRYhtPS1VrPEI8+6lZm4vaUPKAK4nl8FiAjGDNmysQvpJC9vfIdYaEwRwWEdq7ZmLT123EGQAdtxBpjSILzv1RAqcbGFiQa2tR+fv+Sl6LjUM3gHyaIPAPk0lgmojuEOmBh/ag27CG09LZFkbJfmY1wBa2tR9BxsYWKFZTDY8mIATmwGle0bAaV7ggj0wfUPxFdlsNnGErfpUIu+uOr8uYh8Yt0d3xXaLUmM03zz+9RMZU2yYVg6tVHOo7wAdNS7MOJK36VBPdiV16TRxG3T1vT7Q2npajRu2fytZ4hG2mC40EQELXMzAx3lqgpMX90NfMlQBXE8JwJBqr4LEBDJDCCGV2i1JSBvhbO5ZtQJzmHkn17e+Q4p2cmYsNCYIsfXqLRZsz0XLrQNgbe9XDvAumyt7biDIJq/s7YDtuIMdLHSmurVRzmd0nevBNsmFXPcFoPjYwsSlGQ7hA1taj56alqo5A7PC5MJ/50KAK4nfQeesfAPk0SHCKPSHgHyaGkGwv73YlddgGVnyxlsNnFuawbn/tQbdonTK+AQ2npaZ91KzPm532+Ovu/5F7e+Q2CwjtXW1qPoodGTfjjYwsRP3/JS0btn8aa8V2c/tQbdSLI2S9gNK9qvChtMNgNK9kEEemDfYO/DqGffVTFuju9Gab55y2GzjLxmgxolb9KgUmjiNswMd5W7C0cDIgIWuVUFJi/Fuju+sr0LKCu0WpJcs2oEwtf/p7XQzzEs2Z6LW96uHZtkwrDsY/ImdWqjnAJtkwqcCQap6w42P3IHZ4UFAFcTlb9KguK4ehR7sSuuDLYbOJLSjpvl1b4NfNzvtwvb3yGG09LU8dTiQmjds/gf2oNugb4Wzfa5JltvsHfhGLdHd4gIWub/D2pwZgY7yhEBC1yPZZ7/+GKuaWFr/9MWbM9FoArieNcN0u5OBINUOQOzwqdnJmHQYBb3SWlHTT5ud9uu0WpK2dZa3EDfC2Y32DvwqbyuU967nsVHss9/MLX/6b298hzKusKKU7OTMCS0o6a60DYFzdcGk1TeVykj2We/s2Z6LsRhSrhdaBsCKm8rlLQLvjfDDI6hWgXfGy0C740AAAAAGRsxQTI2YoIrLVPDZGzFBH139EVWWqeGT0GWx8jZigjRwrtJ+u/oiuP02custU8Mta5+TZ6DLY6HmBzPSsISUVPZIxB49HDTYe9Bki6u11U3teYUHJi11wWDhJaCG5hZmwCpGLAt+tupNsua5nddXf9sbBzUQT/fzVoOnpWEJKKMnxXjp7JGIL6pd2Hx6OGm6PPQ58PegyTaxbJlXV2uqkRGn+tva8wodnD9aTkxa64gKlrvCwcJLBIcOG3fRjbzxl0Hsu1wVHH0a2Uwuyrz96IxwraJHJF1kAegNBefvPsOhI26JaneeTyy7zhz83n/auhIvkHFG31Y3io88HlPBelifkTCTy2H21QcxpQVigGNDrtApiPog7842cI4oMUNIbv0TAqWp48TjZbOXMwACUXXMUhu+mKLd+FTyrq7XVSjoGwViI0/1pGWDpfe15hQx8ypEezh+tL1+suTcmLXXGt55h1AVLXeWU+EnxYOElgPFSMZJDhw2j0jQZtl/WunfOZa5lfLCSVO0DhkAZGuoxiKn+Izp8whKrz9YK0k4a+0P9DunxKDLYYJsmzJSCSr0FMV6vt+RiniZXdoLz959jYkSLcdCRt0BBIqNUtTvPJSSI2zeWXecGB+7zHn5vP+/v3Cv9XQkXzMy6A9g4o2+pqRB7uxvFR4qKdlOTuDmEsimKkKCbX6yRCuy4hf711PRvRsDm3ZP810wg6M81oSQ+pBIwLBbHDB2HdBgJc210eOLeYGpQC1xbwbhIRxQYoaaFq7W0N36JhabNnZFS1PHgw2fl8nGy2cPgAc3bmYABKggzFTi65ikJK1U9Hd9MUWxO/0V+/Cp5T22ZbVrge86bccjaicMd5rhSrvKspree3TcEis+F0bb+FGKi5m3jbhf8UHoFToVGNN82UiArLz5RupwqQwhJFnKZ+gJuTFrrj93p/51vPMOs/o/XuAqWu8mbJa/bKfCT6rhDh/LBwksDUHFfEeKkYyBzF3c0hw4bRRa9D1ekaDNmNdsnfL+tdO0uHmD/nMtczg14SNr5YSSraNIwudoHDIhLtBiQMjXUYaOGwHMRU/xCgODoVnT5hCflSpA1V5+sBMYsuBgTjFH5gj9F6zDqedqhWW3OVUABv8TzFa12Jimc55U9hJ4U8XUPp+VnvXLZVizBzULY2KEzSWu1Ifu+iRBqDZ0F5+8+xHZcKtbEiRbnVToC86EjboIwkHqQgkVGoRP2Urlqd55I+8SKWkkRtmvYoqJ/LLvODr0I2hwP3eYtnm7yMUvOG9DafQ/CaKgz8/kbJ+cNAkuWnLFfhC5kY7W/13etxla7XFflr07lMJN/dIOHa4Ca6xoRKf8Io/zDOTJP1yAAAAAAHCajcDhNRuAka+WQcJqNwGy8LrBI18sgVPFoUOE1G4D9E7jw2XhdYMVe/hCRr5ZAjYk1MKni0KC1xHPRwmo3Ad5MlHH6J3Hh5gHSkbLwusGu1hmxir38IZabX1EjXyyBP3mP8RsSamEHNMkRU8WhQU/jAjFriOehd65E04TUbgOY8s1zvJko46C/i5P0TuPD6GhAs8wDpSPQJQZTZeF1g3nH1vNdrDNjQYqQExV7+EMJXVszLTa+ozEQHdJGvlkCWpj6cn7zH+Ji1bySNiTUwioCd7IOaZIiEk8xUqeLQoK7reHyn8YEYoPgpxLXEc9CyzdsMu9ciaLzeirXCajcBxWOf3cx5ZrnLcM5l3kyUcdlFPK3QX8XJ11ZtFfonceH9Ltk99DQgWfM9iIXmAdKR4Qh6TegSgynvGyv1svC6wbX5Eh284+t5u+pDpa7WGbGp37FtoMVICafM4NWKvfwhjbRU/YSurZmDpwVFlptfUZGS942YiA7pn4GmNSNfLIEkVoRdLUx9OSpF1eU/eY/xOHAnLTFq3kk2Y3aVGxJqYRwbwr0VATvZEgiTBQc0yREAPWHNCSeYqQ4uMHVTxaFBVMwJnV3W8Pla31glT+MCMUjqqu1B8FOJRvn7VWuI56FsgU99ZZu2GWKSHsV3rkTRcKfsDXm9FWl+tL23hNRuA4Pdxt+Kxz+7jc6XZ5jyzXOf+2WvluGcy5HoNBe8mSjju5CAP7KKeVu1g9GHoL+Lk6e2I0+urNorqaVy9/RO48PzR0sf+l2ye/1UGqfoaECz72Hob+Z7EQvhcrnXzAOlI8sKDf/CEPSbxRlcR9AlBlPXLK6P3jZX69k//zdl4XWDYujdX2vyJDts+4znecfW837Ofi931IdLcN0vl12sM2NapZu/U79i21S2ygdBipATRoM4z0+ZwatIkGl3FXv4QxJyUJ8baKn7HGEBJwldWzMOVPPvB04KiwBHolctNr6jKj8WfyMl7xskLEfHMRAd0zYZtQ8/A0xrOArktka+WQJBt/HeSK0Iuk+koGZamPpyXZFSrlSLq8pTggMWfvMf4nn6tz5w4E5ad+nmhmLVvJJl3BRObMbtKmvPRfY2JNTCMS18Hjg3hXo/Pi2mKgJ3si0L324kESYKIxiO1g5pkiIJYDr+AHrDmgdza0YSTzFSFUaZjhxcYOobVcg2p4tCgqCC6l6pmBM6rpG75rut4fK8pEkutb6wSrK3GJafxgRimM+svpHVVdqW3P0Gg+CnEoTpD86N8/aqivpedtcRz0LQGGee2QKe+t4LNibLN2wyzD7E7sUkPYrCLZVW71yJouhVIX7hT9ga5kZwxvN6KtL0c4IO/Wl7avpg07QAAAAC4vGdlqgnIixK1r+6PYpdXN97wMiVrX9yd1zi5xbQo730IT4pvveBk1wGHAUrWv7jyatjd4N93M1hjEFZQGVef6KUw+voQnxRCrPhx33vAyGfHp611cghDzc5vJpWtf3AtERgVP6S3+4cY0J4az+gnonOPQrDGIKwIekfJoDKvPhiOyFsKO2e1socA0C9QOGmX7F8MhVnw4j3ll4dlhofR3TrgtM+PT1p3Myg/6uQQhlJYd+NA7dgN+FG/aPAr+KFIl5/EWiIwKuKeV09/SW/2x/UIk9VAp31t/MAYNZ/QTo0jtyuflhjFJyp/oLr9RxkCQSB8EPSPkqhI6PebFFg9I6g/WDEdkLaJoffTFHbPaqzKqA++fwfhBsNghF6gcNLmHBe39Km4WUwV3zzRwueFaX6A4HvLLw7Dd0hryw0PonOxaMdhBMcp2bigTERvmPX80/+Q7mZQflbaNxsOuSdNtgVAKKSw78YcDIijgduwGjln138r0niRk24f9Dsm9wODmpBmkS8/iCmTWO20RGBUDPgHMR5NqN+m8c+6/pLf7EYuuIlUmxdn7CdwAnHwSLvJTC/e2/mAMGNF51VrP6Cc04PH+cE2aBd5ig9y5F03y1zhUK5OVP9A9uiYJa6LiHMWN+8WBIJA+Lw+J50h6R8kmVV4QYvg168zXLDK7Vm2O1Xl0V5HUH6w/+wZ1WI7IWzah0YJyDLp53COjoIo7Z7UkFH5sYLkVl86WDE6p48Jgx8zbuYNhsEItTqmbb1A4aQF/IbBF0kpL6/1TkoyInbzip4Rlpgrvnggl9kdePTJS8BIri7S/QHAakFmpfeWXhxPKjl5XZ+Wl+Uj8fJNaxkF9dd+YOdi0Y5f3rbrwgmOUnq16TdoAEbZ0LwhvIjfMeowY1aPItb5YZpqngQHvaa9vwHB2K20bjYVCAlTHXJOmqXOKf+3e4YRD8fhdJIQ2c0qrL6oOBkRRoCldiPYxmZ1YHoBEHLPrv7Kc8mbV6TxIu8Ylkf9rTmpRRFezHZN7gbO8Ylj3EQmjWT4Qej5L3lRQZMeNFMmsdrrmta/s/nG6QtFoYwZ8A5ioUxpBzybUb6EJzbblpKZNS4u/lAmVLmZnuje/IxdcRI04RZ3qTYuzhGKSasDP+ZFu4OBIOPgkXZbXPYTSelZ/fFVPphsggYh1D5hRMaLzqp+N6nP1n9BOG7DJl18domzxMru1lkd1m/hobEK8xQe5EuoeYETy2nXq3cOsrnCoVwBfsY5nKn+gCQVmeU2oDYLjhxRboZmFqc+2nHCLG/eLJTTuUkJBIHwsbjmlaMNSXsbsS4eQ9I+SPtuWS3p2/bDUWeRpsywqR90DM56ZrlhlN4FBvEAAAAAAAAAAAMAAAAEAAQACAAEAAQAAAAEAAUAEAAIAAQAAAAEAAYAIAAgAAQAAAAEAAQAEAAQAAUAAAAIABAAIAAgAAUAAAAIABAAgACAAAUAAAAIACAAgAAAAQUAAAAgAIAAAgEABAUAAAAgAAIBAgEAEAUAQYHJAAu2EAECAwQEBQUGBgYGBwcHBwgICAgICAgICQkJCQkJCQkKCgoKCgoKCgoKCgoKCgoKCwsLCwsLCwsLCwsLCwsLCwwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDwAAEBESEhMTFBQUFBUVFRUWFhYWFhYWFhcXFxcXFxcXGBgYGBgYGBgYGBgYGBgYGBkZGRkZGRkZGRkZGRkZGRkaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHB0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0dHR0AAQIDBAUGBwgICQkKCgsLDAwMDA0NDQ0ODg4ODw8PDxAQEBAQEBAQERERERERERESEhISEhISEhMTExMTExMTFBQUFBQUFBQUFBQUFBQUFBUVFRUVFRUVFRUVFRUVFRUWFhYWFhYWFhYWFhYWFhYWFxcXFxcXFxcXFxcXFxcXFxgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGBgYGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxsbGxscwCcAAMAsAAABAQAAHgEAAA8AAABALAAAQC0AAAAAAAAeAAAADwAAAAAAAADALQAAAAAAABMAAAAHAAAAAAAAAAwACACMAAgATAAIAMwACAAsAAgArAAIAGwACADsAAgAHAAIAJwACABcAAgA3AAIADwACAC8AAgAfAAIAPwACAACAAgAggAIAEIACADCAAgAIgAIAKIACABiAAgA4gAIABIACACSAAgAUgAIANIACAAyAAgAsgAIAHIACADyAAgACgAIAIoACABKAAgAygAIACoACACqAAgAagAIAOoACAAaAAgAmgAIAFoACADaAAgAOgAIALoACAB6AAgA+gAIAAYACACGAAgARgAIAMYACAAmAAgApgAIAGYACADmAAgAFgAIAJYACABWAAgA1gAIADYACAC2AAgAdgAIAPYACAAOAAgAjgAIAE4ACADOAAgALgAIAK4ACABuAAgA7gAIAB4ACACeAAgAXgAIAN4ACAA+AAgAvgAIAH4ACAD+AAgAAQAIAIEACABBAAgAwQAIACEACAChAAgAYQAIAOEACAARAAgAkQAIAFEACADRAAgAMQAIALEACABxAAgA8QAIAAkACACJAAgASQAIAMkACAApAAgAqQAIAGkACADpAAgAGQAIAJkACABZAAgA2QAIADkACAC5AAgAeQAIAPkACAAFAAgAhQAIAEUACADFAAgAJQAIAKUACABlAAgA5QAIABUACACVAAgAVQAIANUACAA1AAgAtQAIAHUACAD1AAgADQAIAI0ACABNAAgAzQAIAC0ACACtAAgAbQAIAO0ACAAdAAgAnQAIAF0ACADdAAgAPQAIAL0ACAB9AAgA/QAIABMACQATAQkAkwAJAJMBCQBTAAkAUwEJANMACQDTAQkAMwAJADMBCQCzAAkAswEJAHMACQBzAQkA8wAJAPMBCQALAAkACwEJAIsACQCLAQkASwAJAEsBCQDLAAkAywEJACsACQArAQkAqwAJAKsBCQBrAAkAawEJAOsACQDrAQkAGwAJABsBCQCbAAkAmwEJAFsACQBbAQkA2wAJANsBCQA7AAkAOwEJALsACQC7AQkAewAJAHsBCQD7AAkA+wEJAAcACQAHAQkAhwAJAIcBCQBHAAkARwEJAMcACQDHAQkAJwAJACcBCQCnAAkApwEJAGcACQBnAQkA5wAJAOcBCQAXAAkAFwEJAJcACQCXAQkAVwAJAFcBCQDXAAkA1wEJADcACQA3AQkAtwAJALcBCQB3AAkAdwEJAPcACQD3AQkADwAJAA8BCQCPAAkAjwEJAE8ACQBPAQkAzwAJAM8BCQAvAAkALwEJAK8ACQCvAQkAbwAJAG8BCQDvAAkA7wEJAB8ACQAfAQkAnwAJAJ8BCQBfAAkAXwEJAN8ACQDfAQkAPwAJAD8BCQC/AAkAvwEJAH8ACQB/AQkA/wAJAP8BCQAAAAcAQAAHACAABwBgAAcAEAAHAFAABwAwAAcAcAAHAAgABwBIAAcAKAAHAGgABwAYAAcAWAAHADgABwB4AAcABAAHAEQABwAkAAcAZAAHABQABwBUAAcANAAHAHQABwADAAgAgwAIAEMACADDAAgAIwAIAKMACABjAAgA4wAIAAAABQAQAAUACAAFABgABQAEAAUAFAAFAAwABQAcAAUAAgAFABIABQAKAAUAGgAFAAYABQAWAAUADgAFAB4ABQABAAUAEQAFAAkABQAZAAUABQAFABUABQANAAUAHQAFAAMABQATAAUACwAFABsABQAHAAUAFwAFAEHg2QALTQEAAAABAAAAAQAAAAEAAAACAAAAAgAAAAIAAAACAAAAAwAAAAMAAAADAAAAAwAAAAQAAAAEAAAABAAAAAQAAAAFAAAABQAAAAUAAAAFAEHQ2gALZQEAAAABAAAAAgAAAAIAAAADAAAAAwAAAAQAAAAEAAAABQAAAAUAAAAGAAAABgAAAAcAAAAHAAAACAAAAAgAAAAJAAAACQAAAAoAAAAKAAAACwAAAAsAAAAMAAAADAAAAA0AAAANAEGA3AALIwIAAAADAAAABwAAAAAAAAAQERIACAcJBgoFCwQMAw0CDgEPAEG03AALaQEAAAACAAAAAwAAAAQAAAAFAAAABgAAAAcAAAAIAAAACgAAAAwAAAAOAAAAEAAAABQAAAAYAAAAHAAAACAAAAAoAAAAMAAAADgAAABAAAAAUAAAAGAAAABwAAAAgAAAAKAAAADAAAAA4ABBtN0AC5oCAQAAAAIAAAADAAAABAAAAAYAAAAIAAAADAAAABAAAAAYAAAAIAAAADAAAABAAAAAYAAAAIAAAADAAAAAAAEAAIABAAAAAgAAAAMAAAAEAAAABgAAAAgAAAAMAAAAEAAAABgAAAAgAAAAMAAAAEAAAABgAABuZWVkIGRpY3Rpb25hcnkAc3RyZWFtIGVuZAAAZmlsZSBlcnJvcgBzdHJlYW0gZXJyb3IAZGF0YSBlcnJvcgBpbnN1ZmZpY2llbnQgbWVtb3J5AGJ1ZmZlciBlcnJvcgBpbmNvbXBhdGlibGUgdmVyc2lvbgAAAAAoLwAAOC8AAEMvAABELwAATy8AAFwvAABnLwAAey8AAIgvAABDLwAAMS4yLjExAEHQ3wALA9AxUA==");let FW,VW;async function jW(){if(FW)return FW;const e={};let t,r={};for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&(r[t]=e[t]);let i=!1,n=!1;i="object"==typeof window,n="function"==typeof importScripts,"object"==typeof process&&"object"==typeof process.versions&&process.versions.node;let o="";(i||n)&&(n?o=self.location.href:"undefined"!=typeof document&&document.currentScript&&(o=document.currentScript.src),o=0!==o.indexOf("blob:")?o.substr(0,o.lastIndexOf("/")+1):""),e.print||console.log.bind(console);const s=e.printErr||console.warn.bind(console);for(t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t]);let a;r=null,e.arguments,e.thisProgram,e.quit,e.wasmBinary,e.noExitRuntime,"object"!=typeof WebAssembly&&C("no native wasm support detected");let c=!1;function d(t){const r=e["_"+t];var i;return i="Cannot call unknown function "+t+", make sure it is exported",r||C("Assertion failed: "+i),r}function u(e,t,r,i,n){const o={string:function(e){let t=0;if(null!=e&&0!==e){const r=1+(e.length<<2);t=D(r),function(e,t,r){(function(e,t,r,i){if(!(i>0))return 0;const n=r,o=r+i-1;for(let i=0;i<e.length;++i){let n=e.charCodeAt(i);if(n>=55296&&n<=57343){n=65536+((1023&n)<<10)|1023&e.charCodeAt(++i)}if(n<=127){if(r>=o)break;t[r++]=n}else if(n<=2047){if(r+1>=o)break;t[r++]=192|n>>6,t[r++]=128|63&n}else if(n<=65535){if(r+2>=o)break;t[r++]=224|n>>12,t[r++]=128|n>>6&63,t[r++]=128|63&n}else{if(r+3>=o)break;t[r++]=240|n>>18,t[r++]=128|n>>12&63,t[r++]=128|n>>6&63,t[r++]=128|63&n}}t[r]=0})(e,l,t,r)}(e,t,r)}return t},array:function(e){const t=D(e.length);var r,i;return r=e,i=t,h.set(r,i),t}};const s=d(e),a=[];let c=0;if(i)for(let e=0;e<i.length;e++){const t=o[r[e]];t?(0===c&&(c=O()),a[e]=t(i[e])):a[e]=i[e]}let u=s.apply(null,a);return u=function(e){return"string"===t?(r=e)?function(e,t,r){const i=t+r;let n=t,o="";for(;e[n]&&!(n>=i);)++n;if(n-t>16&&e.subarray&&A)return A.decode(e.subarray(t,n));for(;t<n;){let r=e[t++];if(!(128&r)){o+=String.fromCharCode(r);continue}const i=63&e[t++];if(192==(224&r)){o+=String.fromCharCode((31&r)<<6|i);continue}const n=63&e[t++];if(r=224==(240&r)?(15&r)<<12|i<<6|n:(7&r)<<18|i<<12|n<<6|63&e[t++],r<65536)o+=String.fromCharCode(r);else{const e=r-65536;o+=String.fromCharCode(55296|e>>10,56320|1023&e)}}return o}(l,r,i):"":"boolean"===t?Boolean(e):e;var r,i}(u),0!==c&&N(c),u}const A="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;let h,l,p;"undefined"!=typeof TextDecoder&&new TextDecoder("utf-16le"),e.INITIAL_MEMORY;const g=[],f=[],E=[],I=[];f.push({func:function(){T()}});let m=0,_=null;function C(t){e.onAbort&&e.onAbort(t),s(t+=""),c=!0,t="abort("+t+"). Build with -s ASSERTIONS=1 for more info.";throw new WebAssembly.RuntimeError(t)}e.preloadedImages={},e.preloadedAudios={};let v="deflate.wasm";var S;function y(t){for(;t.length>0;){const r=t.shift();if("function"==typeof r){r(e);continue}const i=r.func;"number"==typeof i?void 0===r.arg?p.get(i)():p.get(i)(r.arg):i(void 0===r.arg?null:r.arg)}}S="data:application/octet-stream;base64,",v.startsWith(S)||(v=function(t){return e.locateFile?e.locateFile(t,o):o+t}(v));const R={emscripten_memcpy_big:function(e,t,r){l.copyWithin(e,t,t+r)},emscripten_resize_heap:function(e){C("OOM")}};await async function(){const t={env:R,wasi_snapshot_preview1:R};function r(t,r){const i=t.exports;var n;e.asm=i,a=e.asm.memory,n=a.buffer,e.HEAP8=h=new Int8Array(n),e.HEAP16=new Int16Array(n),e.HEAP32=new Int32Array(n),e.HEAPU8=l=new Uint8Array(n),e.HEAPU16=new Uint16Array(n),e.HEAPU32=new Uint32Array(n),e.HEAPF32=new Float32Array(n),e.HEAPF64=new Float64Array(n),p=e.asm.__indirect_function_table,function(t){if(m--,e.monitorRunDependencies&&e.monitorRunDependencies(m),0==m&&_){const e=_;_=null,e()}}()}function i(e){r(e.instance)}function n(e){return new ny((e,t)=>{e(xW().buffer)}).then((function(e){return WebAssembly.instantiate(e,t)})).then(e,(function(e){s("failed to asynchronously prepare wasm: "+e),C(e)}))}if(m++,e.monitorRunDependencies&&e.monitorRunDependencies(m),e.instantiateWasm)try{return e.instantiateWasm(t,r)}catch(e){return s("Module.instantiateWasm callback failed with error: "+e),!1}return await n(i),{}}();let T=e.___wasm_call_ctors=function(){return(T=e.___wasm_call_ctors=e.asm.__wasm_call_ctors).apply(null,arguments)},w=e._malloc=function(){return(w=e._malloc=e.asm.malloc).apply(null,arguments)};e._free=function(){return(e._free=e.asm.free).apply(null,arguments)},e.___errno_location=function(){return(e.___errno_location=e.asm.__errno_location).apply(null,arguments)},e._zlibCompress=function(){return(e._zlibCompress=e.asm.zlibCompress).apply(null,arguments)};let b,O=e.stackSave=function(){return(O=e.stackSave=e.asm.stackSave).apply(null,arguments)},N=e.stackRestore=function(){return(N=e.stackRestore=e.asm.stackRestore).apply(null,arguments)},D=e.stackAlloc=function(){return(D=e.stackAlloc=e.asm.stackAlloc).apply(null,arguments)};function L(t){function r(){b||(b=!0,e.calledRun=!0,c||(y(f),y(E),e.onRuntimeInitialized&&e.onRuntimeInitialized(),function(){if(e.postRun)for("function"==typeof e.postRun&&(e.postRun=[e.postRun]);e.postRun.length;)t=e.postRun.shift(),I.unshift(t);var t;y(I)}()))}m>0||(!function(){if(e.preRun)for("function"==typeof e.preRun&&(e.preRun=[e.preRun]);e.preRun.length;)t=e.preRun.shift(),g.unshift(t);var t;y(g)}(),m>0||(e.setStatus?(e.setStatus("Running..."),setTimeout((function(){setTimeout((function(){e.setStatus("")}),1),r()}),1)):r()))}if(e.ccall=u,e.cwrap=function(e,t,r,i){const n=(r=r||[]).every((function(e){return"number"===e}));return"string"!==t&&n&&!i?d(e):function(){return u(e,t,r,arguments)}},e.allocate=function(e,t){let r;return r=1==t?D(e.length):w(e.length),e.subarray||e.slice?l.set(e,r):l.set(new Uint8Array(e),r),r},_=function e(){b||L(),b||(_=e)},e.run=L,e.preInit)for("function"==typeof e.preInit&&(e.preInit=[e.preInit]);e.preInit.length>0;)e.preInit.pop()();return L(),FW=e,e}const GW=Uint8Array.BYTES_PER_ELEMENT;const KW={bytesReceived:"br",frameDropped:"fd",frameReceived:"fr",googJitterReceived:"jr",isAudioMute:"am",isFreeze:"fz",mediaType:"mt",packetsLost:"pl",packetsReceived:"pr",peerId:"pid",id:"id",ssrc:"ssrc",timestamp:"ts",type:"tp",frameRateInput:"fi",frameRateSent:"fs",googRtt:"rt",isVideoMute:"vm"},HW={stats:"sts",state:"st",stream_id:"stid",session_id:"seid",stream_type:"stt",app_id:"aid",channel_key:"ck",channel_name:"cn",sdk_version:"sv",browser:"b",process_id:"pcid",mode:"m",codec:"c",role:"r",has_changed_gateway:"hcg",ap_response:"ar",extends:"es",details:"d",features:"ft",p2p_id:"ppid",sdp:"sdp",audio:"a",video:"v",attributes:"at",hq:"h",lq:"l",stereo:"str",speech:"spe",extend:"e",pingpongElapse:"ppe"},YW={_message:"m",_type:"t",_id:"id"},WW={join_v2:"j2",publish:"pub",publish_related_stats:"prs",ping:"pi",traffic_stats:"ts",ping_back:"pib",publish_stats:"pubs"};let JW;class qW{constructor(){kO(this,"zlibCompress",void 0)}async init(){if(!JW){const e=await(async()=>(VW||(VW=await jW()),{zlibCompress:e=>{const t=new Uint8Array(e),r=GW*t.byteLength,i=VW._malloc(r),n=VW._malloc(3*r);for(let e=0;e<r;e++)VW.HEAP8[i/GW+e]=t[e];const o=VW._zlibCompress(i,r,n),s=new Uint8Array(VW.HEAP8.slice(n,n+o));return VW._free(i),VW._free(n),s}}))();JW=e.zlibCompress}this.zlibCompress=JW}msgPackCompress(e){return QW.exports.encode(e)}compress(e){const t=Date.now(),r=this.compressKeyAndValue(JSON.parse(JSON.stringify(e))),i=this.msgPackCompress(r),n=this.zlibCompress(i),o=new Uint8Array([49,49,49,50,...Array.from(n)]);return{origin:Object.assign({},e),originLength:JSON.stringify(e).length,shortKeyAndValue:r,msgpackSer:i,compressed:o,compressedLength:o.length,time:Date.now()-t}}compressKeyAndValue(e){return this._ObjectKeyCompress(this._typeCompress(e))}_typeCompress(e){const t=e._type;if(!t)return e;const r=WW[t];return e._type=r||t,e}_ObjectKeyCompress(e){const t=e._message;if(t){const r=t.stats;r&&(t.stats=this._statsCompress(r)),e._message=this._messageCompress(t)}return this._reportCompress(e)}_statsCompress(e){return this._keyCompress(e,KW)}_messageCompress(e){return this._keyCompress(e,HW)}_reportCompress(e){return this._keyCompress(e,YW)}_keyCompress(e,t){const r={},i=Object.keys(e);return vh(i).call(i,(i,n)=>{const o=e[n];return t[n]?r[t[n]]=o:r[n]=o,r},r),r}}class zW extends XN{get queue(){return[...this.highPriorityQueue,...this.lowPriorityQueue]}constructor(e){super(),kO(this,"lowPriorityQueue",[]),kO(this,"highPriorityQueue",[]),kO(this,"AgoraWebSocketManager",void 0),this.AgoraWebSocketManager=e}reset(){this.lowPriorityQueue=[],this.highPriorityQueue=[]}pushMessage(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1]?this.highPriorityQueue.push(e):this.lowPriorityQueue.push(e),this.sendMessage()}sendMessage(){const e=this.queue.length;let t=0;t=e<5?15*e:60+3*(e-4),setTimeout(()=>{this._sendMessage()},t)}_sendMessage(){if(!this.queue.length)return;const e=this.AgoraWebSocketManager.getConnection();if(!e||1!==e.readyState)return;const t=this.queue.shift();return this.lowPriorityQueue.includes(t)?this.lowPriorityQueue.shift():this.highPriorityQueue.shift(),e.send(t.compressed),t}}var XW;function ZW(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}let $W=LD("AgoraWebSocketManager","connectionID")(XW=class extends XN{get url(){return this.websocket?this.websocket.url:null}get reconnectMode(){return this._reconnectMode}set reconnectMode(e){["tryNext","recover"].includes(e)&&this.resetReconnectCount(e),this._reconnectMode=e}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,"reconnecting"===this._state?this.emit(Hk.RECONNECTING,this.reconnectReason):"connected"===this._state?this.emit(Hk.CONNECTED):"closed"===this._state?this.emit(Hk.CLOSED):"failed"===this._state&&this.emit(Hk.FAILED))}resetReconnectCount(e){cD.debug("websocket reset reconnect count, reason: "+e),OD("debug",this,"resetReconnectCount",e,"websocket reset reconnect count, reason: "+e),this.reconnectCount=0}constructor(e,t){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3];super(),kO(this,"connectionID",0),kO(this,"currentURLIndex",0),kO(this,"urls",void 0),kO(this,"_reconnectMode","tryNext"),kO(this,"reconnectReason",void 0),kO(this,"_initMutex",new kV("websocket")),kO(this,"name",void 0),kO(this,"_state","closed"),kO(this,"reconnectInterrupter",void 0),kO(this,"websocket",void 0),kO(this,"retryConfig",void 0),kO(this,"reconnectCount",0),kO(this,"onlineReconnectListener",void 0),kO(this,"compressor",new qW),kO(this,"compressorInitStatus","initializing"),kO(this,"compress",void 0),kO(this,"messageSender",void 0),kO(this,"useCompress",void 0),kO(this,"tryDoubleDomain",!1),kO(this,"wsInflateLength",0),kO(this,"wsDeflateLength",0),kO(this,"closeEstablishingWs",()=>{}),this.name=e,this.retryConfig=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ZW(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ZW(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},t),this.useCompress=r,this.tryDoubleDomain=i;const{timeout:n,timeoutFactor:o}=t,s=Math.max(300,Math.floor(3*n/5)),a=Math.max(1.2,Math.floor(8*o)/10);bP.ONLINE&&(this.retryConfig.timeout=s,this.retryConfig.timeoutFactor=a),IV.on(OP.NETWORK_STATE_CHANGE,(e,t)=>{e!==t&&(this.resetReconnectCount("network state change: ".concat(t," -> ").concat(e)),e===bP.ONLINE?(this.retryConfig.timeout=s,this.retryConfig.timeoutFactor=a):(this.retryConfig.timeout=n,this.retryConfig.timeoutFactor=o))});const c=Date.now();this.compressor.init().then(()=>{this.compressorInitStatus="initialized";const e=Date.now()-c;cD.debug("websocket compressor initialized successfully in ".concat(e,"ms")),OD("debug",this.compressor,"init",void 0,"websocket compressor initialized successfully in ".concat(e,"ms")),wV.wsCompressorInit({status:!0,ec:null,eventElapse:e}),this.compress=this.compressor.compress.bind(this.compressor)}).catch(e=>{this.compressorInitStatus="failed";const t=e?e.message||e.toString():"Empty Error";cD.debug("websocket compressor failed to initialize because of ".concat(t)),OD("debug",this.compressor,"init",void 0,"websocket compressor failed to initialize because of ".concat(t)),wV.wsCompressorInit({status:!1,ec:t,eventElapse:1})})}getConnection(){return this.websocket||void 0}init(e){const t=(t,r)=>{this.urls=e;const i=this.urls[this.currentURLIndex];this.state="connecting",this.messageSender=new zW(this),this.createWebSocketConnection(i).then(t).catch(r),this.once(Hk.CLOSED,()=>r(new eD($N.WS_DISCONNECT))),this.once(Hk.CONNECTED,()=>t())};return this._initMutex.lock().then(e=>new ny((e,r)=>{t(e,r)}).then(()=>{e()}).catch(()=>{e()}))}close(e,t){if(this.currentURLIndex=0,this.resetReconnectCount("close"),this.reconnectInterrupter&&this.reconnectInterrupter(),this.websocket){this.websocket.onclose=null,this.websocket.onopen=null,this.websocket.onmessage=null;const e=this.websocket;t?setTimeout(()=>e.close(),500):e.close(),this.websocket=void 0}this.state=e?"failed":"closed",this.closeEstablishingWs&&this.closeEstablishingWs()}reconnect(e,t){if(!this.websocket)return cD.warning("[".concat(this.name,"] can not reconnect, no websocket")),void OD("warning",this,"reconnect","can not reconnect, no websocket");void 0!==e&&(this.reconnectMode=e),cD.debug("[".concat(this.name,"] reconnect is triggered initiative")),OD("debug",this,"reconnect");const r=this.websocket.onclose;this.websocket.onclose=null,this.websocket.close(),r&&r.bind(this.websocket)({code:9999,reason:t})}sendMessageWithJSON(e){const t=JSON.stringify(e);return{compressed:t,compressedLength:t.length,origin:e}}sendMessage(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)throw new eD($N.WS_ABORT,"websocket is not ready");try{let r=null;if("initialized"===this.compressorInitStatus&&this.useCompress&&WD("WEBSOCKET_COMPRESS"))try{r=this.compress(e),this.setWsInflateData(r)}catch(t){r=this.sendMessageWithJSON(e)}else r=this.sendMessageWithJSON(e);t?this.websocket.send(r.compressed):this.messageSender.pushMessage(r)}catch(e){throw new eD($N.WS_ERR,"send websocket message error"+e.toString())}}setWsInflateData(e){this.wsDeflateLength=this.wsDeflateLength+e.originLength,this.wsInflateLength=this.wsInflateLength+e.compressedLength}getWsInflateData(){const e=this.wsInflateLength,t=this.wsDeflateLength;return this.clearWsInflateData(),{wsInflateLength:e,wsDeflateLength:t}}clearWsInflateData(){this.wsInflateLength=0,this.wsDeflateLength=0}async createWebSocketConnection(e,t){return this.connectionID+=1,this.connectionID,new ny((r,i)=>{const n=()=>{cD.debug("[".concat(this.name,"] websocket opened:"),e),bD("debug",["WebSocket",this.connectionID],"open",e),this.reconnectMode="retry",this.state="connected",this.resetReconnectCount("opened"),r()},o=async e=>{if(cD.debug("[".concat(this.name,"] websocket close ").concat(this.websocket&&this.websocket.url,", code: ").concat(e.code,", reason: ").concat(e.reason,", current mode: ").concat(this.reconnectMode)),bD("debug",["WebSocket",this.connectionID],"close",{code:e.code,reason:e.reason,url:this.websocket&&this.websocket.url,reconnectMode:this.reconnectMode}),this.reconnectCount<this.retryConfig.maxRetryCount){"connected"===this.state&&(this.reconnectReason=e.reason,this.state="reconnecting");const t=OG(this,Hk.WILL_RECONNECT,this.reconnectMode)||this.reconnectMode,n=await this.reconnectWithAction(t);if("closed"===this.state)return cD.debug("[".concat(this.connectionID,"] ws is closed, no need to reconnect")),void RD("debug",this,"ws is closed, no need to reconnect");if(!n)return i(new eD($N.WS_DISCONNECT,"websocket reconnect failed: ".concat(e.code))),void this.close(!0);r()}else i(new eD($N.WS_DISCONNECT,"websocket close: ".concat(e.code))),this.close()},s=e=>{this.emit(Hk.ON_MESSAGE,e)};this.websocket&&(this.websocket.onclose=null,this.websocket.close()),WD("GATEWAY_WSS_ADDRESS")&&this.name.startsWith("gateway")&&(e=WD("GATEWAY_WSS_ADDRESS")),cD.debug("[".concat(this.name,"] start connect, url: ").concat(e)),RD("debug",this,"start connect, url: ".concat(e)),this.chooseBestWebsocketConnection(e,!!t).then(e=>{this.websocket=e,n&&n(),e.onclose=o,e.onmessage=s}).catch(e=>{if("closed"!==this.state){if(e instanceof eD&&e.code===$N.WS_ERR){const t=new eD($N.WS_ERR,"init websocket failed! Error: ".concat(e.toString()));return cD.error("[".concat(this.name,"]").concat(t)),OD("error",this,"chooseBestWebsocketConnection",void 0,e.toString()),void i(t)}o&&o(e)}else i(new eD($N.WS_DISCONNECT,"websocket is closed: ".concat(e.toString())))})})}async reconnectWithAction(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.reconnectCount>=this.retryConfig.maxRetryCount)return!1;if(!this.urls)return!1;if("closed"===this.state)return!1;this.onlineReconnectListener||IV.networkState!==bP.OFFLINE||(this.onlineReconnectListener=IV.onlineWaiter&&IV.onlineWaiter.then(()=>{this.onlineReconnectListener=void 0}));let r=!0;if(this.reconnectInterrupter=()=>{r=!1},t){const t=rD(this.reconnectCount,this.retryConfig);cD.debug("[".concat(this.name,"] wait ").concat(t,"ms to reconnect websocket, mode: ").concat(e)),OD("debug",this,"reconnectWithAction",{timeout:t,action:e}),await ny.race([_G(t),this.onlineReconnectListener||new ny(()=>{})])}if("closed"===this.state||!r)return!1;this.reconnectCount+=1;const i=async(e,t)=>{this.emit(Hk.RECONNECT_CREATE_CONNECTION,t),await this.createWebSocketConnection(e)};try{if("retry"===e){const t=this.urls[this.currentURLIndex];this.emit(Hk.RECONNECT_WAITTING_FINISH,e),await i(t,e)}else if("tryNext"===e){if(this.currentURLIndex+=1,this.currentURLIndex>=this.urls.length)return await this.reconnectWithAction("recover",!1);cD.debug("[".concat(this.name,"] websocket url length: ").concat(this.urls.length," current index: ").concat(this.currentURLIndex)),RD("debug",this,"websocket url length: ".concat(this.urls.length," current index: ").concat(this.currentURLIndex));const t=this.urls[this.currentURLIndex];this.emit(Hk.RECONNECT_WAITTING_FINISH,e),await i(t,e)}else if("recover"===e){cD.debug("[".concat(this.name,"] request new urls")),RD("debug",this,"request new urls"),this.resetReconnectCount("recover mode"),this.emit(Hk.RECONNECT_WAITTING_FINISH,e),this.urls=await wG(this,Hk.REQUEST_NEW_URLS),this.currentURLIndex=0;const t=this.urls[this.currentURLIndex];await i(t,e)}return!0}catch(r){return cD.error("[".concat(this.name,"] reconnect failed"),r.toString()),OD("error",this,"reconnectWithAction",void 0,r.toString()),await this.reconnectWithAction(e,t)}}async chooseBestWebsocketConnection(e,t){return new ny((r,i)=>{let n=!1;const o=[];this.closeEstablishingWs=()=>{cD.debug("[choose-best-ws] close establishing websockets"),o.forEach(e=>{e.onclose=null,e.onopen=null,e.onmessage=null,e.close()}),i(new eD($N.WS_ABORT,"choose best websocket aborted"))};const s=WD("GATEWAY_DOMAINS");let a;const c=e.indexOf("?h="),d=s.find(t=>-1!==c?e.includes(t,c):e.includes(t));cD.debug("[choose-best-ws] currentDomain: ",d,", domains: ",s),OD("debug",this,"chooseBestWebsocketConnection",{currentDomain:d,domains:s});let u=!this.tryDoubleDomain||t||!d;if(!u&&d){const t=Date.now();try{s.forEach(t=>{const r=-1===c?e.replace(d,t):e.substr(0,c)+e.substr(c).replace(d,t),i=new WebSocket(r);i.binaryType="arraybuffer",o.push(i),cD.debug("[choose-best-ws] ws is connecting:",i.url),RD("debug",this,"ws is connecting: ".concat(i.url))})}catch(e){for(cD.debug("[choose-best-ws] ws create failed, fallback to single url"),RD("debug",this,"ws create failed, fallback to single url"),o.forEach(e=>e.close());o.length;)o.pop();u=!0}o.forEach(e=>{e.onopen=()=>{if(n)return;const i=Date.now()-t;cD.debug("[choose-best-ws] ws open cost ".concat(i,"ms")),o.filter(t=>t!==e).forEach(e=>{cD.debug("[choose-best-ws]close backup websocket: ".concat(e.url)),RD("debug",this,"close backup websocket: ".concat(e.url)),e.close()}),n=!0,r(e)},e.onclose=e=>{if(a=e,n)return;o.find(e=>!(e.readyState===WebSocket.CLOSED||e.readyState===WebSocket.CLOSING))||(cD.debug("[choose-best-ws] all websocket is closed"),RD("debug",this,"all websocket is closed"),n=!0,i(a))},e.onmessage=t=>{cD.debug("[choose-best-ws]".concat(e.url," onmessage: ").concat(t.data)),RD("debug",this,"".concat(e.url," onmessage: ").concat(t.data))}}),_G(5e3).then(()=>{o.forEach(e=>{e.readyState!==WebSocket.OPEN&&e.close()})})}if(u){let t;cD.debug("[choose-best-ws] use single url: ",e),RD("debug",this,"use single url: ".concat(e));try{t=new WebSocket(e),o.push(t),t.binaryType="arraybuffer"}catch(e){const t=new eD($N.WS_ERR,"init websocket failed! Error: ".concat(e.toString()));return cD.error("[".concat(this.name,"]").concat(t)),OD("error",this,"chooseBestWebsocketConnection",void 0,e.toString()),void i(t)}t.onopen=()=>{r(t)},t.onclose=e=>{i(e)},t.onmessage=e=>{cD.debug("[choose-best-ws]".concat(t.url," onmessage: ").concat(e.data)),RD("debug",this,"".concat(t.url," onmessage: ").concat(e.data))},_G(5e3).then(()=>{t&&t.readyState!==WebSocket.OPEN&&t.close()})}}).then(e=>(this.closeEstablishingWs=void 0,e)).catch(e=>{throw this.closeEstablishingWs=void 0,e})}})||XW;class eJ{constructor(e){kO(this,"input",[]),kO(this,"size",void 0),this.size=e}add(e){this.input.push(e),this.input.length>this.size&&this.input.splice(0,1)}mean(){var e;return 0===this.input.length?0:vh(e=this.input).call(e,(e,t)=>e+t)/this.input.length}}var tJ;let rJ=LD("AgoraRTCSignal","websocket.connectionID")(tJ=class extends XN{get connectionState(){return this._connectionState}set connectionState(e){e!==this._connectionState&&(this._connectionState=e,e===bk.CONNECTED?this.emit(Ok.WS_CONNECTED):e===bk.RECONNECTING?this.emit(Ok.WS_RECONNECTING,this._websocketReconnectReason):e===bk.CLOSED&&this.emit(Ok.WS_CLOSED,this._disconnectedReason))}get currentURLIndex(){return this.websocket.currentURLIndex}get url(){return this.websocket?this.websocket.url:null}get rtt(){return this.rttRolling.mean()}constructor(e){super(),kO(this,"_disconnectedReason",void 0),kO(this,"_websocketReconnectReason",void 0),kO(this,"_connectionState",bk.CLOSED),kO(this,"reconnectToken",void 0),kO(this,"websocket",void 0),kO(this,"openConnectionTime",void 0),kO(this,"clientId",void 0),kO(this,"lastMsgTime",Date.now()),kO(this,"uploadCache",[]),kO(this,"uploadCacheInterval",void 0),kO(this,"rttRolling",new eJ(5)),kO(this,"pingpongTimer",void 0),kO(this,"wsInflateDataTimer",void 0),kO(this,"pingpongTimeoutCount",0),kO(this,"joinResponse",void 0),kO(this,"multiIpOption",void 0),kO(this,"initError",void 0),kO(this,"spec",void 0),kO(this,"onWebsocketMessage",e=>{if(e.data instanceof ArrayBuffer)return void this.emit(Ok.ON_BINARY_DATA,e.data);const t=JSON.parse(e.data);if(this.lastMsgTime=Date.now(),Object.prototype.hasOwnProperty.call(t,"_id")){const e="res-@".concat(t._id);this.emit(e,t._result,t._message)}else if(Object.prototype.hasOwnProperty.call(t,"_type")&&(this.emit(t._type,t._message),t._type===Lk.ON_NOTIFICATION&&this.handleNotification(t._message),t._type===Lk.ON_USER_BANNED))switch(t._message.error_code){case 14:this.close(Rk.UID_BANNED);break;case 15:this.close(Rk.IP_BANNED);break;case 16:this.close(Rk.CHANNEL_BANNED)}}),this.clientId=e.clientId,this.spec=e,this.websocket=new $W("gateway-".concat(this.clientId),this.spec.retryConfig,!0,!0),this.handleWebsocketEvents(),window.addEventListener("offline",()=>{this.connectionState===bk.CONNECTED&&this.reconnect("retry",wk.OFFLINE)})}async request(e,t,r,i){const n=vG(6,""),o={_id:n,_type:e,_message:t},s=this.websocket.connectionID,a=()=>new ny((t,r)=>{if(this.connectionState===bk.CONNECTED)return t();const i=()=>{this.off(Ok.WS_CLOSED,n),t()},n=()=>{this.off(Ok.WS_CONNECTED,i),r(new eD($N.WS_ABORT))};this.once(Ok.WS_CONNECTED,i),this.once(Ok.WS_CLOSED,n),e!==Nk.PUBLISH&&e!==Nk.SUBSCRIBE&&e!==Nk.UNSUBSCRIBE&&e!==Nk.UNPUBLISH&&e!==Nk.CONTROL||this.once(Ok.DISCONNECT_P2P,()=>{r(new eD($N.DISCONNECT_P2P))}),e===Nk.PUBLISH&&this.once(Ok.ABORT_P2P_EXECUTION,()=>{r(new eD($N.DISCONNECT_P2P))})});if(this.connectionState!==bk.CONNECTING&&this.connectionState!==bk.RECONNECTING||e===Nk.JOIN||e===Nk.REJOIN||await a(),this.websocket.sendMessage(o,!0),i)return;const c=new ny((r,i)=>{let o=!1;const a=(i,n)=>{o=!0,r({isSuccess:"success"===i,message:n||{}}),this.off(Ok.WS_CLOSED,c),this.off(Ok.WS_RECONNECTING,c),this.emit(Ok.REQUEST_SUCCESS,e,t)};this.once("res-@".concat(n),a);const c=()=>{i(new eD($N.WS_ABORT,"type: ".concat(e))),this.off(Ok.WS_CLOSED,c),this.off(Ok.WS_RECONNECTING,c),this.off("res-@".concat(n),a)};this.once(Ok.WS_CLOSED,c),this.once(Ok.WS_RECONNECTING,c),_G(WD("SIGNAL_REQUEST_TIMEOUT")).then(()=>{this.websocket.connectionID!==s||o||(cD.warning("ws request timeout, type: ".concat(e)),RD("warning",this,"ws request timeout, type: ".concat(e)),this.emit(Ok.REQUEST_TIMEOUT,e,t))})});let d=null;try{d=await c}catch(i){if(this.connectionState===bk.CLOSED||e===Nk.LEAVE)throw new eD($N.WS_ABORT);return!this.spec.forceWaitGatewayResponse||r?i.throw():e===Nk.JOIN||e===Nk.REJOIN?null:(await a(),await this.request(e,t))}if(d.isSuccess)return d.message;const u=Number(d.message.error_code||d.message.code),A=UW(u),h=new eD($N.UNEXPECTED_RESPONSE,"".concat(A.desc,": ").concat(d.message.error_str),{code:u,data:d.message});return"success"===A.action?d.message:(cD.warning("[".concat(this.websocket.connectionID,"] unexpected response from type ").concat(e,", error_code: ").concat(u,", message: ").concat(A.desc,", action: ").concat(A.action)),RD("warning",this,"unexpected response from type ".concat(e,", error_code: ").concat(u,", message: ").concat(A.desc,", action: ").concat(A.action)),u===Sk.ERR_TOO_MANY_BROADCASTERS?e===Nk.JOIN||e===Nk.REJOIN?(this.initError=h,this.close(),h.throw()):h.throw():"failed"===A.action?h.throw():"quit"===A.action?(this.initError=h,this.close(),h.throw()):(u===Sk.ERR_JOIN_BY_MULTI_IP?(this.multiIpOption=d.message.option,cD.warning("[".concat(this.clientId,"] detect multi ip, recover")),RD("warning",this,"detect multi ip, recover"),this.reconnect("recover",wk.MULTI_IP)):this.reconnect(A.action,wk.SERVER_ERROR),e===Nk.JOIN||e===Nk.REJOIN?null:await this.request(e,t)))}waitMessage(e,t){return new ny(r=>{const i=n=>{(!t||t(n))&&(this.off(e,i),r(n))};this.on(e,i)})}upload(e,t){const r={_type:e,_message:t};try{this.websocket.sendMessage(r)}catch(e){const t=WD("MAX_UPLOAD_CACHE")||50;this.uploadCache.push(r),this.uploadCache.length>t&&this.uploadCache.splice(0,1),this.uploadCache.length>0&&!this.uploadCacheInterval&&(this.uploadCacheInterval=window.setInterval(()=>{if(this.connectionState!==bk.CONNECTED)return;const e=this.uploadCache.splice(0,1)[0];0===this.uploadCache.length&&(window.clearInterval(this.uploadCacheInterval),this.uploadCacheInterval=void 0),this.upload(e._type,e._message)},WD("UPLOAD_CACHE_INTERVAL")||2e3))}}send(e,t){const r={_type:e,_message:t};this.websocket.sendMessage(r)}init(e,t){return this.initError=void 0,this.multiIpOption=void 0,this.joinResponse=void 0,this.reconnectToken=void 0,this.openConnectionTime=void 0,new ny((r,i)=>{this.once(Ok.WS_CONNECTED,()=>r(this.joinResponse)),this.once(Ok.WS_CLOSED,()=>i(this.initError||new eD($N.WS_ABORT))),this.connectionState=bk.CONNECTING,this.websocket.init(e).catch(i),this.wsInflateDataTimer&&window.clearInterval(this.wsInflateDataTimer),this.wsInflateDataTimer=window.setInterval(()=>{this.handleWsInflateData()},2e4),setTimeout(()=>{t&&void 0===this.openConnectionTime&&(cD.debug("[".concat(this.clientId,"] init websocket timeout while join with fallback to proxy")),i(new eD($N.INIT_WEBSOCKET_TIMEOUT)))},WD("JOIN_WITH_FALLBACK_PROXY_PENDING_DURATION"))})}close(e){this.pingpongTimer&&(this.pingpongTimeoutCount=0,window.clearInterval(this.pingpongTimer),this.pingpongTimer=void 0),this.wsInflateDataTimer&&(this.handleWsInflateData(),window.clearInterval(this.wsInflateDataTimer),this.wsInflateDataTimer=void 0),this.reconnectToken=void 0,this.joinResponse=void 0,this._disconnectedReason=e||Rk.LEAVE,this.connectionState=bk.CLOSED,cD.debug("[".concat(this.clientId,"] ")+"will close websocket in signal"),this.websocket.close(),e===Rk.FALLBACK&&(this.websocket.removeAllListeners(),this.websocket=new $W("gateway-".concat(this.clientId),this.spec.retryConfig,!0,!0),this.handleWebsocketEvents())}async join(){if(!this.joinResponse){this.emit(Ok.ABORT_P2P_EXECUTION);const e=await wG(this,Ok.REQUEST_JOIN_INFO),t=await this.request(Nk.JOIN,e);if(!t)return this.emit(Ok.REPORT_JOIN_GATEWAY,$N.TIMEOUT,this.url||""),!1;this.joinResponse=t,this.emit(Ok.JOIN_RESPONSE,this.joinResponse),this.reconnectToken=this.joinResponse.rejoin_token}return this.connectionState=bk.CONNECTED,this.pingpongTimer&&window.clearInterval(this.pingpongTimer),this.pingpongTimer=window.setInterval(this.handlePingPong.bind(this),3e3),!0}async rejoin(){if(!this.reconnectToken)throw new eD($N.UNEXPECTED_ERROR,"can not rejoin, no rejoin token");const e=NG(this,Ok.REQUEST_REJOIN_INFO);e.token=this.reconnectToken;const t=await this.request(Nk.REJOIN,e);return!!t&&(this.connectionState=bk.CONNECTED,this.pingpongTimer&&window.clearInterval(this.pingpongTimer),this.pingpongTimer=window.setInterval(this.handlePingPong.bind(this),3e3),t.peers&&t.peers.forEach(e=>{this.emit(Lk.ON_USER_ONLINE,{uid:e.uid}),e.audio_mute?this.emit(Lk.MUTE_AUDIO,{uid:e.uid}):this.emit(Lk.UNMUTE_AUDIO,{uid:e.uid}),e.video_mute?this.emit(Lk.MUTE_VIDEO,{uid:e.uid}):this.emit(Lk.UNMUTE_VIDEO,{uid:e.uid}),e.audio_enable_local?this.emit(Lk.ENABLE_LOCAL_AUDIO,{uid:e.uid}):this.emit(Lk.DISABLE_LOCAL_AUDIO,{uid:e.uid}),e.video_enable_local?this.emit(Lk.ENABLE_LOCAL_VIDEO,{uid:e.uid}):this.emit(Lk.DISABLE_LOCAL_VIDEO,{uid:e.uid}),e.audio||e.video||this.emit(Lk.ON_REMOVE_STREAM,{uid:e.uid,uint_id:e.uint_id}),e.audio&&this.emit(Lk.ON_ADD_AUDIO_STREAM,{uid:e.uid,uint_id:e.uint_id,audio:!0,ssrcId:e.audio_ssrc}),e.video&&this.emit(Lk.ON_ADD_VIDEO_STREAM,{uid:e.uid,uint_id:e.uint_id,video:!0,ssrcId:e.video_ssrc})}),!0)}reconnect(e,t){this.pingpongTimer&&(this.pingpongTimeoutCount=0,window.clearInterval(this.pingpongTimer),this.pingpongTimer=void 0),this.websocket.reconnect(e,t)}handleNotification(e){cD.debug("[".concat(this.clientId,"] receive notification: "),e),OD("debug",this,"handleNotification",e);const t=UW(e.code);if("success"!==t.action)return"failed"===t.action?(cD.error("[".concat(this.clientId,"] ignore error: "),t.desc),void RD("error",this,"ignore error: ".concat(t.desc))):"quit"===t.action?("ERR_REPEAT_JOIN_CHANNEL"===t.desc&&this.close(Rk.UID_BANNED),void this.close()):void this.reconnect(t.action,wk.SERVER_ERROR)}handlePingPong(){if(!this.websocket||"connected"!==this.websocket.state)return;this.pingpongTimeoutCount>0&&this.rttRolling.add(3e3),this.pingpongTimeoutCount+=1;const e=WD("PING_PONG_TIME_OUT"),t=Date.now();this.pingpongTimeoutCount>=e&&(cD.warning("PINGPONG Timeout. Last Socket Message: ".concat(t-this.lastMsgTime,"ms")),RD("warning",this,"PINGPONG Timeout. Last Socket Message: ".concat(t-this.lastMsgTime,"ms")),t-this.lastMsgTime>WD("WEBSOCKET_TIMEOUT_MIN"))?this.reconnect("retry",wk.TIMEOUT):this.request(Nk.PING,void 0,!0).then(()=>{this.pingpongTimeoutCount=0;const e=Date.now()-t;this.rttRolling.add(e),WD("REPORT_STATS")&&this.send(Nk.PING_BACK,{pingpongElapse:e})}).catch(e=>{})}handleWsInflateData(){const{wsInflateLength:e,wsDeflateLength:t}=this.websocket.getWsInflateData();0!==e&&0!==t&&this.upload(Dk.WS_INFLATE_DATA_LENGTH,{ws_deflate_length:t,ws_inflate_length:e})}handleWebsocketEvents(){this.websocket.on(Hk.RECONNECT_WAITTING_FINISH,e=>{this.emit(Ok.WS_RECONNECT_WAITTING_FINISH,e)}),this.websocket.on(Hk.RECONNECT_CREATE_CONNECTION,e=>{this.emit(Ok.WS_RECONNECT_CREATE_CONNECTION,e)}),this.websocket.on(Hk.ON_MESSAGE,this.onWebsocketMessage),this.websocket.on(Hk.CLOSED,()=>{this.connectionState=bk.CLOSED}),this.websocket.on(Hk.FAILED,()=>{this._disconnectedReason=Rk.NETWORK_ERROR,this.connectionState=bk.CLOSED}),this.websocket.on(Hk.RECONNECTING,e=>{this._websocketReconnectReason=e,this.joinResponse=void 0,this.connectionState===bk.CONNECTED?this.connectionState=bk.RECONNECTING:this.connectionState=bk.CONNECTING}),this.websocket.on(Hk.WILL_RECONNECT,(e,t)=>{if(NG(this,Ok.IS_P2P_DISCONNECTED)&&"retry"===e)return cD.debug("".concat(this.clientId," reconnect mode is retry, but p2p lost, change to tryNext")),RD("debug",this,"".concat(this.clientId," reconnect mode is retry, but p2p lost, change to tryNext")),this.reconnectToken=void 0,this.emit(Ok.NEED_RENEW_SESSION),this.emit(Ok.DISCONNECT_P2P),t("tryNext");"retry"!==e&&(cD.debug("".concat(this.clientId," websockt will_connect event, renewSession reconnectMode is ").concat(e)),RD("debug",this,"".concat(this.clientId," websockt will_connect event, renewSession reconnectMode is ").concat(e)),this.reconnectToken=void 0,this.emit(Ok.NEED_RENEW_SESSION),this.emit(Ok.DISCONNECT_P2P)),t(e)}),this.websocket.on(Hk.CONNECTED,()=>{this.openConnectionTime=Date.now(),this.reconnectToken?this.rejoin().catch(e=>{cD.warning("[".concat(this.clientId,"] rejoin failed ").concat(e)),OD("warning",this,"rejoin",void 0,e.toString()),this.reconnect("tryNext",wk.SERVER_ERROR)}):this.join().catch(e=>{if(this.emit(Ok.REPORT_JOIN_GATEWAY,e.message||e.code,this.url||""),e instanceof eD&&e.code===$N.UNEXPECTED_RESPONSE&&e.data.code===Sk.ERR_NO_AUTHORIZED)return cD.warning("[".concat(this.clientId,"] reconnect no authorized, recover")),RD("warning",this,"reconnect no authorized, recover"),void this.reconnect("recover",wk.SERVER_ERROR);cD.error("[".concat(this.clientId,"] join gateway request failed"),e.toString()),OD("error",this,"join",void 0,e.toString()),this.spec.forceWaitGatewayResponse?this.reconnect("tryNext",wk.SERVER_ERROR):(this.initError=e,this.close())})}),this.websocket.on(Hk.REQUEST_NEW_URLS,(e,t)=>{wG(this,Ok.REQUEST_RECOVER,this.multiIpOption).then(e).catch(t)})}})||tJ;var iJ;function nJ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function oJ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?nJ(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):nJ(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const sJ=new Map;let aJ=LD("AgoraRTCGateway","store.clientId")(iJ=class extends XN{get state(){return this._state}set state(e){if(e===this._state)return;const t=this._state;this._state=e,"DISCONNECTED"===e&&this._disconnectedReason?this.emit(cP.CONNECTION_STATE_CHANGE,e,t,this._disconnectedReason):this.emit(cP.CONNECTION_STATE_CHANGE,e,t)}get joinGatewayStartTime(){return this._joinGatewayStartTime}set joinGatewayStartTime(e){cD.debug("[".concat(this.store.clientId,"] set joinGatewayStartTime at ").concat(e)),OD("debug",this,"joinGatewayStartTime",e,"[".concat(this.store.clientId,"] set joinGatewayStartTime at ").concat(e)),this._joinGatewayStartTime=e}constructor(e,t){super(),kO(this,"store",void 0),kO(this,"joinInfo",void 0),kO(this,"key",void 0),kO(this,"signal",void 0),kO(this,"role",void 0),kO(this,"inChannelInfo",{joinAt:null,duration:0}),kO(this,"spec",void 0),kO(this,"_state","DISCONNECTED"),kO(this,"_statsCollector",void 0),kO(this,"_disconnectedReason",void 0),kO(this,"isSignalRecover",!1),kO(this,"hasChangeBGPAddress",!1),kO(this,"trafficStatsInterval",void 0),kO(this,"networkQualityInterval",void 0),kO(this,"_joinGatewayStartTime",0),kO(this,"_signalTimeout",!1),kO(this,"_clientRoleOptions",void 0),kO(this,"_isProactiveJoin",!1),this.store=e,this.spec=t,this.signal=new rJ(oJ(oJ({},t),{},{retryConfig:t.websocketRetryConfig})),this._statsCollector=t.statsCollector,this.role=t.role||"audience",this._clientRoleOptions=t.clientRoleOptions,this.handleSignalEvents()}async join(e,t,r){this.store.joinGatewayStart(),"disabled"!==e.cloudProxyServer&&(this.hasChangeBGPAddress=!0);const i=Date.now();let n=sJ.get(e.cname);if(n||(n=new Map,sJ.set(e.cname,n)),this._isProactiveJoin=!0,n.has(e.uid)){const t=new eD($N.UID_CONFLICT);throw wV.joinGateway(e.sid,{lts:i,succ:!1,ec:t.message,addr:null,uid:e.uid,cid:e.cid,firstSuccess:this._isProactiveJoin,avoidJoinStartTime:this.store.avoidJoinStart,isProxy:!!e.proxyServer}),this._isProactiveJoin=!1,t}n.set(e.uid,!0),this.joinInfo=e,this.key=t;const o=e.proxyServer,s=o?e.gatewayAddrs.map(e=>{const t=e.address.split(":");return"wss://".concat(o,"/ws/?h=").concat(t[0],"&p=").concat(t[1])}):e.gatewayAddrs.map(e=>"wss://".concat(e.address));let a=0;this.joinGatewayStartTime=i;try{a=(await this.signal.init(s,r)).uid}catch(t){if(t&&t.code===$N.INIT_WEBSOCKET_TIMEOUT)throw cD.warning("[".concat(this.store.clientId,"] User join failed"),t.toString()),t;throw cD.error("[".concat(this.store.clientId,"] User join failed"),t.toString()),OD("error",this,"join",void 0,t.toString()),wV.joinGateway(e.sid,{lts:i,succ:!1,ec:t.message,addr:this.signal.url,uid:e.uid,cid:e.cid,firstSuccess:this._isProactiveJoin,avoidJoinStartTime:this.store.avoidJoinStart,isProxy:!!o}),this._isProactiveJoin=!1,n.delete(e.uid),this.signal.close(),t}return this.state="CONNECTED",this.inChannelInfo.joinAt=Date.now(),cD.debug("[".concat(this.store.clientId,"] Connected to gateway server")),OD("debug",this,"join",void 0,"success"),this.trafficStatsInterval=window.setInterval(()=>{this.updateTrafficStats().catch(e=>{cD.warning("[".concat(this.store.clientId,"] get traffic stats error"),e.toString()),OD("warning",this,"trafficStatsInterval",void 0,e.toString())})},3e3),this.networkQualityInterval=window.setInterval(()=>{navigator&&void 0!==navigator.onLine&&!navigator.onLine?this.emit(cP.NETWORK_QUALITY,{downlinkNetworkQuality:6,uplinkNetworkQuality:6}):this._signalTimeout?this.emit(cP.NETWORK_QUALITY,{downlinkNetworkQuality:5,uplinkNetworkQuality:5}):"CONNECTED"===this.state&&this._statsCollector.trafficStats?this.emit(cP.NETWORK_QUALITY,{uplinkNetworkQuality:hG(this._statsCollector.trafficStats.B_unq),downlinkNetworkQuality:hG(this._statsCollector.trafficStats.B_dnq)}):this.emit(cP.NETWORK_QUALITY,{uplinkNetworkQuality:0,downlinkNetworkQuality:0})},2e3),this.store.joinGatewayEnd(),a}async leave(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments.length>1?arguments[1]:void 0;if("DISCONNECTED"!==this.state){t!==Rk.FALLBACK&&(this.state="DISCONNECTING");try{e||this.signal.connectionState!==bk.CONNECTED||await function(e,t){return t===1/0?e:ny.race([e,CG(t)])}(this.signal.request(Nk.LEAVE,void 0,!0),3e3)}catch(e){cD.warning("[".concat(this.store.clientId,"] leave request failed, ignore"),e),RD("warning",this,"leave request failed, ignore, ".concat(e.toString()))}this.signal.close(t),t!==Rk.FALLBACK&&(this.state="DISCONNECTED"),this.reset()}}async publish(e,t,r){if("CONNECTED"!==this.state&&"RECONNECTING"!==this.state)throw new eD($N.INVALID_OPERATION,"can not publish when connection state is ".concat(this.state));const i={state:"offer",p2p_id:this.store.p2pId,ortc:t,mode:this.spec.mode,extend:WD("PUB_EXTEND")};try{return(await this.signal.request(Nk.PUBLISH,i,!0))._message}catch(i){if(r&&i.data&&i.data.code===Sk.ERR_PUBLISH_REQUEST_INVALID)return cD.warning("[".concat(this.store.clientId,"] receive publish error code, retry"),i.toString()),RD("warning",this,"receive publish error code, retry, ".concat(i.toString())),await this.tryUnpubBeforeRepub(e,t),this.publish(e,t,!1);throw i}}async unpublish(e,t){try{if("CONNECTED"!==this.state&&"RECONNECTING"!==this.state)throw new eD($N.INVALID_OPERATION,"can not publish when connection state is ".concat(this.state));await this.signal.request(Nk.UNPUBLISH,{stream_id:t,ortc:e},!0)}catch(e){cD.warning("unpublish warning: ",e),OD("warning",this,"unpublish",void 0,e.toString())}}async subscribe(e,t,r){if("CONNECTED"!==this.state&&"RECONNECTING"!==this.state)throw new eD($N.INVALID_OPERATION,"can not subscribe when connection state is ".concat(this.state));const i={stream_id:e,stream_type:t.stream_type,mode:this.spec.mode,codec:this.spec.codec,p2p_id:this.store.p2pId,tcc:!!WD("SUBSCRIBE_TCC"),extend:WD("SUB_EXTEND"),ssrcId:t.ssrcId};try{return(await this.signal.request(Nk.SUBSCRIBE,i,!0))._message}catch(i){if(r&&i.data&&i.data.code===Sk.ERR_SUBSCRIBE_REQUEST_INVALID)return cD.warning("[".concat(this.store.clientId,"] receiver subscribe error code, retry"),i.toString()),RD("warning",this,"receiver subscribe error code, retry"),await this.tryUnsubBeforeResub(e,t),await this.subscribe(e,t,!1);throw i}}async subscribeAll(e,t){if("CONNECTED"!==this.state&&"RECONNECTING"!==this.state)throw new eD($N.INVALID_OPERATION,"can not massSubscribe when connection state is ".concat(this.state));const r={p2p_id:this.store.p2pId,users:e,dtx:!1};try{return await this.signal.request(Nk.SUBSCRIBE_STREAMS,r,!0)}catch(r){if(t&&r.data&&r.data.code===Sk.ERR_SUBSCRIBE_REQUEST_INVALID)return cD.warning("[".concat(this.store.clientId,"] receiver massSubscribe error code, retry"),r.toString()),RD("warning",this,"receiver massSubscribe error code, retry"),await this.tryMassUnsubBeforeResub(e),await this.subscribeAll(e,!1);throw r}}async setVideoProfile(e){const t=function(e){if(!(e.bitrateMax&&e.bitrateMin&&e.frameRate&&e.height&&e.width))return;let t=e.frameRate,r=e.width,i=e.height,n=!0;return"number"!=typeof t&&(t=t.exact||t.ideal||t.max||t.min||0,t||(n=!1)),"number"!=typeof r&&(r=r.exact||r.ideal||r.max||r.min||0,r||(n=!1)),"number"!=typeof i&&(i=i.exact||i.ideal||i.max||i.min||0,t||(n=!1)),n?{stream_type:0,width:r,height:i,fps:t,start_bps:1e3*e.bitrateMax,min_bps:1e3*e.bitrateMin,target_bps:1e3*e.bitrateMax}:void 0}(e);return t?this.signal.request(Nk.SET_VIDEO_PROFILE,t):(cD.debug("[".concat(this.store.clientId,"] encoder config is not complete, do not report to gateway")),void RD("debug",this,"encoder config is not complete, do not report to gateway"))}async unsubscribe(e,t){try{await this.signal.request(Nk.UNSUBSCRIBE,{p2p_id:this.store.p2pId,ortc:e,stream_id:t},!0)}catch(e){cD.warning("unsubscribe warning: ",e),OD("warning",this,"unsubscribe",void 0,e.toString())}}async massUnsubscribe(e){try{await this.signal.request(Nk.UNSUBSCRIBE_STREAMS,e,!0)}catch(e){cD.warning("unsubscribeAll warning: ",e),OD("warning",this,"unsubscribeAll",void 0,e.toString())}}async reconnectPC(e){const{iceParameters:t,dtlsParameters:r,rtpCapabilities:i}=e,n=await this.signal.request(Nk.CONNECT_PC,{p2p_id:this.store.p2pId,stream_id:this.store.uid,ortc:{iceParameters:t,dtlsParameters:r,rtpCapabilities:i}},!0),o=this.getGatewayIpPort();return{gatewayEstablishParams:n,gatewayIP:null==o?void 0:o.ip,gatewayPort:null==o?void 0:o.port}}getGatewayInfo(){return this.signal.request(Nk.GATEWAY_INFO)}renewToken(e){return this.signal.request(Nk.RENEW_TOKEN,e)}async setClientRole(e,t){if(t&&(this._clientRoleOptions=Object.assign({},t)),"CONNECTED"!==this.state)return void(this.role=e);let r=void 0;r="audience"===e?this._clientRoleOptions&&this._clientRoleOptions.level?this._clientRoleOptions.level:2:0,await this.signal.request(Nk.SET_CLIENT_ROLE,{role:e,level:r}),this.role=e}async setRemoteVideoStreamType(e,t){await this.signal.request(Nk.SWITCH_VIDEO_STREAM,{stream_id:e,stream_type:t})}async setDefaultRemoteVideoStreamType(e){await this.signal.request(Nk.DEFAULT_VIDEO_STREAM,{stream_type:e})}async setStreamFallbackOption(e,t){await this.signal.request(Nk.SET_FALLBACK_OPTION,{stream_id:e,fallback_type:t})}async pickSVCLayer(e,t){await this.signal.request(Nk.PICK_SVC_LAYER,{stream_id:e,spatial_layer:t.spatialLayer,temporal_layer:t.temporalLayer})}getInChannelInfo(){return this.inChannelInfo.joinAt&&(this.inChannelInfo.duration=Date.now()-this.inChannelInfo.joinAt),oJ({},this.inChannelInfo)}async getGatewayVersion(){return(await this.signal.request(Nk.GATEWAY_INFO)).version}reset(){if(this.inChannelInfo.joinAt&&(this.inChannelInfo.duration=Date.now()-this.inChannelInfo.joinAt,this.inChannelInfo.joinAt=null),this.trafficStatsInterval&&(window.clearInterval(this.trafficStatsInterval),this.trafficStatsInterval=void 0),this.joinInfo){const e=sJ.get(this.joinInfo.cname);e&&e.delete(this.joinInfo.uid)}this.joinInfo=void 0,this.key=void 0,this.networkQualityInterval&&(window.clearInterval(this.networkQualityInterval),this.networkQualityInterval=void 0)}updateTurnConfigFromSignal(){if(!this.joinInfo)return;const e=function(e){const t=e.match(/(wss\:\/\/)?([^:]+):(\d+)/);return t?{username:UD.username,password:UD.password,turnServerURL:t[2],tcpport:parseInt(t[3])+30,udpport:parseInt(t[3])+30,forceturn:!1}:null}(("disabled"===this.joinInfo.cloudProxyServer?this.signal.url:this.joinInfo.gatewayAddrs[this.signal.currentURLIndex].address)||"");this.joinInfo.turnServer.serversFromGateway=[],e&&"off"!==this.joinInfo.turnServer.mode&&"disabled"===this.joinInfo.cloudProxyServer&&this.joinInfo.turnServer.serversFromGateway.push(oJ(oJ({},UD),{},{turnServerURL:e.turnServerURL,tcpport:e.tcpport,udpport:e.udpport,username:this.joinInfo.uid.toString(),password:this.joinInfo.token}))}async updateTrafficStats(){if("CONNECTED"!==this.state)return;const e=await this.signal.request(Nk.TRAFFIC_STATS,void 0,!0);e.timestamp=Date.now(),e.peer_delay.forEach(e=>{const t=this._statsCollector.trafficStats&&this._statsCollector.trafficStats.peer_delay.find(t=>t.peer_uid===e.peer_uid);t&&t.B_st!==e.B_st&&kG(()=>{this.emit(cP.STREAM_TYPE_CHANGE,e.peer_uid,e.B_st)})}),this._statsCollector.updateTrafficStats(e)}getJoinMessage(e){if(!this.joinInfo||!this.key)throw new eD($N.UNEXPECTED_ERROR,"can not generate join message, no join info");const t=Object.assign({},this.joinInfo.apResponse);let r=WD("REPORT_APP_SCENARIO");if("string"!=typeof r)try{r=JSON.stringify(r)}catch(e){r=void 0}r&&r.length>128&&(r=void 0);const i=oJ({p2p_id:this.store.p2pId,session_id:this.joinInfo.sid,app_id:this.joinInfo.appId,channel_key:this.key,channel_name:this.joinInfo.cname,sdk_version:BD,browser:navigator.userAgent,process_id:WD("PROCESS_ID"),mode:this.spec.mode,codec:this.spec.codec,role:this.role,has_changed_gateway:this.hasChangeBGPAddress,ap_response:t,extend:WD("JOIN_EXTEND"),details:{6:this.joinInfo.stringUid,cservice_map:"proxy3"===this.joinInfo.cloudProxyServer?"1":"proxy5"===this.joinInfo.cloudProxyServer?"2":void 0},features:{rejoin:!0},optionalInfo:this.joinInfo.optionalInfo,appScenario:r,attributes:{userAttributes:{enablePublishedUserList:WD("ENABLE_PUBLISHED_USER_LIST"),maxSubscription:WD("MAX_SUBSCRIPTION")}}},e);return this.joinInfo.stringUid&&(i.string_uid=this.joinInfo.stringUid),this.joinInfo.aesmode&&this.joinInfo.aespassword&&(i.aes_mode=this.joinInfo.aesmode,WD("ENCRYPT_AES")?(i.aes_secret=this.joinInfo.aespassword,i.aes_encrypt=!0):i.aes_secret=this.joinInfo.aespassword,this.joinInfo.aessalt&&(i.aes_salt=this.joinInfo.aessalt)),t.addresses[this.signal.websocket.currentURLIndex]&&(i.ap_response.ticket=t.addresses[this.signal.websocket.currentURLIndex].ticket,delete t.addresses),void 0!==this.joinInfo.defaultVideoStream&&(i.default_video_stream=this.joinInfo.defaultVideoStream),i}getRejoinMessage(){if(!this.joinInfo)throw new eD($N.UNEXPECTED_ERROR,"can not generate rejoin message, no join info");return{session_id:this.joinInfo.sid,channel_name:this.joinInfo.cname,cid:this.joinInfo.cid,uid:this.joinInfo.uid,vid:Number(this.joinInfo.vid)}}handleSignalEvents(){this.signal.on(Ok.WS_RECONNECT_WAITTING_FINISH,e=>{["tryNext","recover"].includes(e)&&this.joinInfo&&wV.adjustSessionStartTime(this.joinInfo.sid)}),this.signal.on(Ok.WS_RECONNECT_CREATE_CONNECTION,e=>{this.joinGatewayStartTime=Date.now()}),this.signal.on(Ok.WS_RECONNECTING,e=>{this.joinInfo&&wV.WebSocketQuit(this.joinInfo.sid,{lts:Date.now(),succ:-1,cname:this.joinInfo.cname,uid:this.joinInfo.uid,cid:this.joinInfo.cid,errorCode:e||wk.NETWORK_ERROR}),this.joinInfo&&(this.state="RECONNECTING",wV.sessionInit(this.joinInfo.sid,{lts:(new Date).getTime(),extend:this.isSignalRecover?{recover:!0}:{rejoin:!0},cname:this.joinInfo.cname,appid:this.joinInfo.appId,mode:this.spec.mode}),this.isSignalRecover=!1,this.joinGatewayStartTime=Date.now())}),this.signal.on(Ok.WS_CLOSED,e=>{let t;switch(e){case Rk.LEAVE:t=wk.LEAVE;break;case Rk.UID_BANNED:case Rk.IP_BANNED:case Rk.CHANNEL_BANNED:case Rk.SERVER_ERROR:t=wk.SERVER_ERROR;break;case Rk.FALLBACK:t=wk.FALLBACK;break;default:t=wk.NETWORK_ERROR}cD.debug("[signal] websocket closed, reason: ".concat(t||"undefined -> "+wk.NETWORK_ERROR)),TD("debug",this,"ws_closed","reason: ".concat(e)),this.joinInfo&&wV.WebSocketQuit(this.joinInfo.sid,{lts:Date.now(),succ:e===Rk.LEAVE?1:-1,cname:this.joinInfo.cname,uid:this.joinInfo.uid,cid:this.joinInfo.cid,errorCode:t}),this._disconnectedReason=e,e!==Rk.FALLBACK&&(this.state="DISCONNECTED"),this.reset()}),this.signal.on(Ok.WS_CONNECTED,()=>{if(this.updateTurnConfigFromSignal(),this.state="CONNECTED",this.joinInfo&&("audience"===this.role&&this._clientRoleOptions&&this._clientRoleOptions.level&&(cD.debug("[".concat(this.store.clientId,"] patch to send set client role, role: ").concat(this.role,", mode: ").concat(this.spec.mode,", level: ").concat(this._clientRoleOptions&&this._clientRoleOptions.level)),RD("debug",this,"patch to send set client role, role: ".concat(this.role,", mode: ").concat(this.spec.mode,", level: ").concat(this._clientRoleOptions&&this._clientRoleOptions.level)),this.setClientRole(this.role,this._clientRoleOptions)),wV.joinGateway(this.joinInfo.sid,{lts:this.joinGatewayStartTime,succ:!0,ec:null,vid:this.joinInfo.vid,addr:this.signal.url,uid:this.joinInfo.uid,cid:this.joinInfo.cid,firstSuccess:this._isProactiveJoin,avoidJoinStartTime:this.store.avoidJoinStart,isProxy:!!this.joinInfo.proxyServer}),this._isProactiveJoin=!1,this.joinInfo.useLocalAccessPoint)){const e=this.signal.url&&this.signal.url.match(/wss\:\/\/([^:]+):(\d+)/);if(!e)return cD.error("[".concat(this.store.clientId,"] set local access point after joined failed: ").concat(e)),void RD("error",this,"set local access point after joined failed: ".concat(e));YD("EVENT_REPORT_DOMAIN",e[1]),YD("EVENT_REPORT_BACKUP_DOMAIN",e[1]),YD("LOG_UPLOAD_SERVER","".concat(e[1],":6444"))}}),this.signal.on(Lk.ON_UPLINK_STATS,e=>{this._statsCollector.updateUplinkStats(e)}),this.signal.on(Ok.REQUEST_RECOVER,(e,t,r)=>{if(!this.joinInfo)return r(new eD($N.UNEXPECTED_ERROR,"gateway: can not recover, no join info"));e&&(this.joinInfo.multiIP=e,this.hasChangeBGPAddress=!0),this.isSignalRecover=!0,wG(this,cP.REQUEST_NEW_GATEWAY_LIST).then(t).catch(r)}),this.signal.on(Ok.REQUEST_JOIN_INFO,async e=>{var t;this.updateTurnConfigFromSignal();const{iceParameters:r,dtlsParameters:i,rtpCapabilities:n}=await wG(this,cP.REQUEST_P2P_CONNECTION_PARAMS,{turnServer:null===(t=this.joinInfo)||void 0===t?void 0:t.turnServer});e(this.getJoinMessage({ortc:{iceParameters:r,dtlsParameters:i,rtpCapabilities:n,version:"2"}}))}),this.signal.on(Ok.REQUEST_REJOIN_INFO,e=>{e(this.getRejoinMessage())}),this.signal.on(Ok.REPORT_JOIN_GATEWAY,(e,t)=>{this.joinInfo&&(wV.joinGateway(this.joinInfo.sid,{lts:this.joinGatewayStartTime,succ:!1,ec:e,addr:t,uid:this.joinInfo.uid,cid:this.joinInfo.cid,firstSuccess:this._isProactiveJoin,avoidJoinStartTime:this.store.avoidJoinStart,isProxy:!!this.joinInfo.proxyServer}),this._isProactiveJoin=!1)}),this.signal.on(Ok.IS_P2P_DISCONNECTED,e=>{e(NG(this,cP.IS_P2P_DISCONNECTED))}),this.signal.on(Ok.DISCONNECT_P2P,()=>{this.emit(cP.DISCONNECT_P2P)}),this.signal.on(Ok.NEED_RENEW_SESSION,()=>{this.emit(cP.NEED_RENEW_SESSION)}),this.signal.on(Ok.REQUEST_SUCCESS,()=>{this._signalTimeout=!1}),this.signal.on(Ok.REQUEST_TIMEOUT,()=>{this._signalTimeout=!0}),this.signal.on(Ok.JOIN_RESPONSE,e=>{const t=this.getGatewayIpPort();t?this.emit(cP.JOIN_RESPONSE,e,t.ip,t.port):this.emit(cP.JOIN_RESPONSE,e)})}async tryUnsubBeforeResub(e,t){try{await this.signal.request(Nk.UNSUBSCRIBE,{p2p_id:this.store.p2pId,stream_id:e,ortc:[t]},!0)}catch(t){throw cD.warning("unsubscribe warning",t),OD("warning",this,"tryUnsubBeforeResub",e,t.toString()),t}}async tryUnpubBeforeRepub(e,t){try{await this.signal.request(Nk.UNPUBLISH,{stream_id:e,ortc:t},!0)}catch(t){throw cD.warning("unpublish warning: ",t),OD("warning",this,"tryUnpubBeforeRepub",e,t.toString()),t}}async tryMassUnsubBeforeResub(e){const t={users:e.map(e=>({stream_id:e.stream_id,stream_type:e.stream_type}))};try{await this.signal.request(Nk.UNSUBSCRIBE_STREAMS,t,!0)}catch(t){throw cD.warning("massUnsubscribe warning",t),OD("warning",this,"tryUnsubAllBeforeResub",e.map(e=>e.stream_id),t.toString()),t}}async muteLocal(e,t){const r={action:e.find(e=>e.stream_type===aP.Audio)?"mute_local_audio":"mute_local_video",p2p_id:this.store.p2pId,ortc:e,stream_id:t};try{await this.signal.request(Nk.CONTROL,r,!0,!0)}catch(e){throw cD.warning("gateway unmuteLocal warning: ",e),OD("warning",this,"muteLocal",t,e.toString()),e}}async unmuteLocal(e,t){const r={action:e.find(e=>e.stream_type===aP.Audio)?"unmute_local_audio":"unmute_local_video",p2p_id:this.store.p2pId,ortc:e,stream_id:t};try{await this.signal.request(Nk.CONTROL,r,!0,!0)}catch(e){throw cD.warning("gateway muteLocal warning: ",e),OD("warning",this,"unmuteLocal",t,e.toString()),e}}uploadStats(e,t){this.signal.upload(e,t)}getSignalRTT(){return this.signal.rtt}async restartICE(e){const t={p2p_id:this.store.p2pId,stream_id:this.store.uid,ortc:e};try{const e=await this.signal.request(Nk.RESTART_ICE,t,!0),r=this.getGatewayIpPort();return{restartICEResponse:e,gatewayIP:null==r?void 0:r.ip,gatewayPort:null==r?void 0:r.port}}catch(e){throw cD.warning("P2PChannel.restartICE warning: ",e),OD("warning",this,"restartICE",void 0,e.toString()),e}}reconnect(){"CONNECTED"===this.state&&this.signal.reconnect(void 0,wk.P2P_FAILED)}getGatewayIpPort(){var e;if(!WD("GATEWAY_WSS_ADDRESS")&&null!==(e=this.joinInfo)&&void 0!==e&&e.gatewayAddrs){const e=this.joinInfo.gatewayAddrs[this.signal.currentURLIndex];return(e.ip||e.ip6)&&e.port?e.ip6?{ip:e.ip6,port:e.port}:{ip:e.ip,port:e.port}:void 0}}})||iJ;
/*! formdata-polyfill. MIT License. Jimmy W?rting <https://jimmy.warting.se/opensource> */function cJ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function dJ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?cJ(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):cJ(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!function(){var t;function r(e){var t=0;return function(){return t<e.length?{done:!1,value:e[t++]}:{done:!0}}}var i="function"==typeof Object.defineProperties?Object.defineProperty:function(e,t,r){return e==Array.prototype||e==Object.prototype||(e[t]=r.value),e};var n,o=function(t){t=["object"==typeof globalThis&&globalThis,t,"object"==typeof window&&window,"object"==typeof self&&self,"object"==typeof e&&e];for(var r=0;r<t.length;++r){var i=t[r];if(i&&i.Math==Math)return i}throw Error("Cannot find global object")}(this);function s(e,t){if(t)e:{var r=o;e=e.split(".");for(var n=0;n<e.length-1;n++){var s=e[n];if(!(s in r))break e;r=r[s]}(t=t(n=r[e=e[e.length-1]]))!=n&&null!=t&&i(r,e,{configurable:!0,writable:!0,value:t})}}function a(e){return(e={next:e})[Symbol.iterator]=function(){return this},e}function c(e){var t="undefined"!=typeof Symbol&&Symbol.iterator&&e[Symbol.iterator];return t?t.call(e):{next:r(e)}}if(s("Symbol",(function(e){function t(e,t){this.A=e,i(this,"description",{configurable:!0,writable:!0,value:t})}if(e)return e;t.prototype.toString=function(){return this.A};var r="jscomp_symbol_"+(1e9*Math.random()>>>0)+"_",n=0;return function e(i){if(this instanceof e)throw new TypeError("Symbol is not a constructor");return new t(r+(i||"")+"_"+n++,i)}})),s("Symbol.iterator",(function(e){if(e)return e;e=Symbol("Symbol.iterator");for(var t="Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array".split(" "),n=0;n<t.length;n++){var s=o[t[n]];"function"==typeof s&&"function"!=typeof s.prototype[e]&&i(s.prototype,e,{configurable:!0,writable:!0,value:function(){return a(r(this))}})}return e})),"function"==typeof Object.setPrototypeOf)n=Object.setPrototypeOf;else{var d;e:{var u={};try{u.__proto__={a:!0},d=u.a;break e}catch(e){}d=!1}n=d?function(e,t){if(e.__proto__=t,e.__proto__!==t)throw new TypeError(e+" is not extensible");return e}:null}var A=n;function h(){this.m=!1,this.j=null,this.v=void 0,this.h=1,this.u=this.C=0,this.l=null}function l(e){if(e.m)throw new TypeError("Generator is already running");e.m=!0}function p(e,t){return e.h=3,{value:t}}function g(e){this.g=new h,this.G=e}function f(e,t,r,i){try{var n=t.call(e.g.j,r);if(!(n instanceof Object))throw new TypeError("Iterator result "+n+" is not an object");if(!n.done)return e.g.m=!1,n;var o=n.value}catch(t){return e.g.j=null,e.g.s(t),E(e)}return e.g.j=null,i.call(e.g,o),E(e)}function E(e){for(;e.g.h;)try{var t=e.G(e.g);if(t)return e.g.m=!1,{value:t.value,done:!1}}catch(t){e.g.v=void 0,e.g.s(t)}if(e.g.m=!1,e.g.l){if(t=e.g.l,e.g.l=null,t.F)throw t.D;return{value:t.return,done:!0}}return{value:void 0,done:!0}}function I(e){this.next=function(t){return e.o(t)},this.throw=function(t){return e.s(t)},this.return=function(t){return function(e,t){l(e.g);var r=e.g.j;return r?f(e,"return"in r?r.return:function(e){return{value:e,done:!0}},t,e.g.return):(e.g.return(t),E(e))}(e,t)},this[Symbol.iterator]=function(){return this}}function m(e,t){return t=new I(new g(t)),A&&e.prototype&&A(t,e.prototype),t}if(h.prototype.o=function(e){this.v=e},h.prototype.s=function(e){this.l={D:e,F:!0},this.h=this.C||this.u},h.prototype.return=function(e){this.l={return:e},this.h=this.u},g.prototype.o=function(e){return l(this.g),this.g.j?f(this,this.g.j.next,e,this.g.o):(this.g.o(e),E(this))},g.prototype.s=function(e){return l(this.g),this.g.j?f(this,this.g.j.throw,e,this.g.o):(this.g.s(e),E(this))},s("Array.prototype.entries",(function(e){return e||function(){return function(e,t){e instanceof String&&(e+="");var r=0,i=!1,n={next:function(){if(!i&&r<e.length){var n=r++;return{value:t(n,e[n]),done:!1}}return i=!0,{done:!0,value:void 0}}};return n[Symbol.iterator]=function(){return n},n}(this,(function(e,t){return[e,t]}))}})),"undefined"!=typeof Blob&&("undefined"==typeof FormData||!FormData.prototype.keys)){var _=function(e,t){for(var r=0;r<e.length;r++)t(e[r])},C=function(e){return e.replace(/\r?\n|\r/g,"\r\n")},v=function(e,t,r){return t instanceof Blob?(r=void 0!==r?String(r+""):"string"==typeof t.name?t.name:"blob",t.name===r&&"[object Blob]"!==Object.prototype.toString.call(t)||(t=new File([t],r)),[String(e),t]):[String(e),String(t)]},S=function(e,t){if(e.length<t)throw new TypeError(t+" argument required, but only "+e.length+" present.")},y="object"==typeof globalThis?globalThis:"object"==typeof window?window:"object"==typeof self?self:this,R=y.FormData,T=y.XMLHttpRequest&&y.XMLHttpRequest.prototype.send,w=y.Request&&y.fetch,b=y.navigator&&y.navigator.sendBeacon,O=y.Element&&y.Element.prototype,N=y.Symbol&&Symbol.toStringTag;N&&(Blob.prototype[N]||(Blob.prototype[N]="Blob"),"File"in y&&!File.prototype[N]&&(File.prototype[N]="File"));try{new File([],"")}catch(e){y.File=function(e,t,r){return e=new Blob(e,r||{}),Object.defineProperties(e,{name:{value:t},lastModified:{value:+(r&&void 0!==r.lastModified?new Date(r.lastModified):new Date)},toString:{value:function(){return"[object File]"}}}),N&&Object.defineProperty(e,N,{value:"File"}),e}}var D=function(e){return e.replace(/\n/g,"%0A").replace(/\r/g,"%0D").replace(/"/g,"%22")},L=function(e){this.i=[];var t=this;e&&_(e.elements,(function(e){if(e.name&&!e.disabled&&"submit"!==e.type&&"button"!==e.type&&!e.matches("form fieldset[disabled] *"))if("file"===e.type){var r=e.files&&e.files.length?e.files:[new File([],"",{type:"application/octet-stream"})];_(r,(function(r){t.append(e.name,r)}))}else"select-multiple"===e.type||"select-one"===e.type?_(e.options,(function(r){!r.disabled&&r.selected&&t.append(e.name,r.value)})):"checkbox"===e.type||"radio"===e.type?e.checked&&t.append(e.name,e.value):(r="textarea"===e.type?C(e.value):e.value,t.append(e.name,r))}))};if((t=L.prototype).append=function(e,t,r){S(arguments,2),this.i.push(v(e,t,r))},t.delete=function(e){S(arguments,1);var t=[];e=String(e),_(this.i,(function(r){r[0]!==e&&t.push(r)})),this.i=t},t.entries=function e(){var t,r=this;return m(e,(function(e){if(1==e.h&&(t=0),3!=e.h)return t<r.i.length?e=p(e,r.i[t]):(e.h=0,e=void 0),e;t++,e.h=2}))},t.forEach=function(e,t){S(arguments,1);for(var r=c(this),i=r.next();!i.done;i=r.next()){var n=c(i.value);i=n.next().value,n=n.next().value,e.call(t,n,i,this)}},t.get=function(e){S(arguments,1);var t=this.i;e=String(e);for(var r=0;r<t.length;r++)if(t[r][0]===e)return t[r][1];return null},t.getAll=function(e){S(arguments,1);var t=[];return e=String(e),_(this.i,(function(r){r[0]===e&&t.push(r[1])})),t},t.has=function(e){S(arguments,1),e=String(e);for(var t=0;t<this.i.length;t++)if(this.i[t][0]===e)return!0;return!1},t.keys=function e(){var t,r,i,n,o=this;return m(e,(function(e){if(1==e.h&&(t=c(o),r=t.next()),3!=e.h)return r.done?void(e.h=0):(i=r.value,n=c(i),p(e,n.next().value));r=t.next(),e.h=2}))},t.set=function(e,t,r){S(arguments,2),e=String(e);var i=[],n=v(e,t,r),o=!0;_(this.i,(function(t){t[0]===e?o&&(o=!i.push(n)):i.push(t)})),o&&i.push(n),this.i=i},t.values=function e(){var t,r,i,n,o=this;return m(e,(function(e){if(1==e.h&&(t=c(o),r=t.next()),3!=e.h)return r.done?void(e.h=0):(i=r.value,(n=c(i)).next(),p(e,n.next().value));r=t.next(),e.h=2}))},L.prototype._asNative=function(){for(var e=new R,t=c(this),r=t.next();!r.done;r=t.next()){var i=c(r.value);r=i.next().value,i=i.next().value,e.append(r,i)}return e},L.prototype._blob=function(){var e="----formdata-polyfill-"+Math.random(),t=[],r="--"+e+'\r\nContent-Disposition: form-data; name="';return this.forEach((function(e,i){return"string"==typeof e?t.push(r+D(C(i))+'"\r\n\r\n'+C(e)+"\r\n"):t.push(r+D(C(i))+'"; filename="'+D(e.name)+'"\r\nContent-Type: '+(e.type||"application/octet-stream")+"\r\n\r\n",e,"\r\n")})),t.push("--"+e+"--"),new Blob(t,{type:"multipart/form-data; boundary="+e})},L.prototype[Symbol.iterator]=function(){return this.entries()},L.prototype.toString=function(){return"[object FormData]"},O&&!O.matches&&(O.matches=O.matchesSelector||O.mozMatchesSelector||O.msMatchesSelector||O.oMatchesSelector||O.webkitMatchesSelector||function(e){for(var t=(e=(this.document||this.ownerDocument).querySelectorAll(e)).length;0<=--t&&e.item(t)!==this;);return-1<t}),N&&(L.prototype[N]="FormData"),T){var k=y.XMLHttpRequest.prototype.setRequestHeader;y.XMLHttpRequest.prototype.setRequestHeader=function(e,t){k.call(this,e,t),"content-type"===e.toLowerCase()&&(this.B=!0)},y.XMLHttpRequest.prototype.send=function(e){e instanceof L?(e=e._blob(),this.B||this.setRequestHeader("Content-Type",e.type),T.call(this,e)):T.call(this,e)}}w&&(y.fetch=function(e,t){return t&&t.body&&t.body instanceof L&&(t.body=t.body._blob()),w.call(this,e,t)}),b&&(y.navigator.sendBeacon=function(e,t){return t instanceof L&&(t=t._asNative()),b.call(this,e,t)}),y.FormData=L}}();let uJ=1;function AJ(e,t,r,i,n){uJ+=1;const o={sid:r.sid,command:"convergeAllocateEdge",uid:"666",appId:r.appId,ts:Math.floor(Date.now()/1e3),seq:uJ,requestId:uJ,version:BD,cname:r.cname},s={service_name:t,json_body:JSON.stringify(o)};let a,c,d=e[0];return iD(async()=>{a=Date.now();const e=await fV(d,{data:s,cancelToken:i,headers:{"X-Packet-Service-Type":"0","X-Packet-URI":"61"}});if(c=Date.now()-a,0!==e.code){const t=new eD($N.UNEXPECTED_RESPONSE,"live streaming ap error, code"+e.code,{retry:!0,responseTime:c});throw cD.error(t.toString()),OD("error",["AjaxAPI"],"requestLiveStreamingWorkerManager",void 0,t.toString()),t}const r=JSON.parse(e.json_body);if(200!==r.code){const e=new eD($N.UNEXPECTED_RESPONSE,"live streaming app center error, code: ".concat(r.code,", reason: ").concat(r.reason),{code:r.code,responseTime:c});throw cD.error(e.toString()),OD("error",["AjaxAPI"],"requestLiveStreamingWorkerManager",void 0,e.toString()),e}if(!r.servers||0===r.servers.length){const e=new eD($N.UNEXPECTED_RESPONSE,"live streaming app center empty server",{code:r.code,responseTime:c});throw cD.error(e.toString()),OD("error",["AjaxAPI"],"requestLiveStreamingWorkerManager",void 0,e.toString()),e}const n=function(e,t){return{addressList:e.servers.map(e=>"wss://".concat(e.address.replace(/\./g,"-"),".").concat(WD("WORKER_DOMAIN"),":").concat(e.wss,"?serviceName=").concat(encodeURIComponent(t))),workerToken:e.workerToken,vid:e.vid}}(r,t);return WD("LIVE_STREAMING_ADDRESS")&&(n.addressList=WD("LIVE_STREAMING_ADDRESS")instanceof Array?WD("LIVE_STREAMING_ADDRESS"):[WD("LIVE_STREAMING_ADDRESS")]),dJ(dJ({},n),{},{responseTime:c})},(i,n)=>(wV.apworkerEvent(r.sid,{success:!0,sc:200,serviceName:t,responseDetail:JSON.stringify(i.addressList),firstSuccess:0===n,responseTime:c,serverIp:e[n%e.length]}),!1),(i,n)=>(wV.apworkerEvent(r.sid,{success:!1,sc:i.data&&i.data.code||200,serviceName:t,responseTime:c,serverIp:e[n%e.length]}),!!(i.code!==$N.OPERATION_ABORTED&&i.code!==$N.UNEXPECTED_RESPONSE||i.data&&i.data.retry)&&(d=e[(n+1)%e.length],!0)),n)}let hJ=1;function lJ(e,t,r,i){let{url:n,areaCode:o}=e;OD("debug",["AjaxAPI",t.clientId],"requestChooseServer",{url:n,areaCode:o});const s=Date.now(),[a,c]=IJ(t,o,[Ux.CHOOSE_SERVER]);let d=IV.networkState;return iD(async()=>{d&&IV.networkState===bP.OFFLINE&&IV.onlineWaiter&&await ny.race([IV.onlineWaiter,_G(i&&i.maxRetryTimeout||tD.maxRetryTimeout)]),d=IV.networkState;const e=await fV(n,{data:a,cancelToken:r,headers:{"Content-Type":"multipart/form-data;"}},!0);wV.reportResourceTiming(n,t.sid),gJ(e,n,t,s,[Ux.CHOOSE_SERVER]);const o=lG(e,Ux.CHOOSE_SERVER);return fJ(o),cG(o,n)},e=>(e&&wV.joinChooseServer(t.sid,{lts:s,succ:!0,csAddr:n,opid:c,serverList:e.gatewayAddrs.map(e=>e.address),ec:null,cid:e.cid.toString(),uid:e.uid.toString(),csIp:e.csIp,unilbsServerIds:[Ux.CHOOSE_SERVER].toString()}),!1),e=>e.code!==$N.OPERATION_ABORTED&&(e.code===$N.CAN_NOT_GET_GATEWAY_SERVER?e.data.retry:(wV.joinChooseServer(t.sid,{lts:s,succ:!1,csAddr:n,serverList:null,opid:c,ec:e.code,csIp:e.data&&e.data.csIp,unilbsServerIds:[Ux.CHOOSE_SERVER].toString(),extend:JSON.stringify({networkState:d})}),cD.warning("[".concat(t.clientId,"] Choose server network error, retry"),e),RD("warning",["AjaxAPI",t.clientId],"Choose server network error, retry, ".concat(e)),!0)),i)}function pJ(e,t,r,i){let{url:n,areaCode:o,serviceIds:s}=e;OD("debug",["AjaxAPI",t.clientId],"requestMultiUnilbs",{url:n,areaCode:o,serviceIds:s});const a=Date.now(),[c,d]=IJ(t,o,s);let u=void 0;return iD(async()=>{u&&IV.networkState===bP.OFFLINE&&IV.onlineWaiter&&await ny.race([IV.onlineWaiter,_G(i&&i.maxRetryTimeout||tD.maxRetryTimeout)]),u=IV.networkState;const e=await fV(n,{data:c,cancelToken:r,headers:{"Content-Type":"multipart/form-data;"}},!0);wV.reportResourceTiming(n,t.sid),gJ(e,n,t,a,s);const o=lG(e,Ux.CHOOSE_SERVER),d=lG(e,"proxy5"===t.cloudProxyServer?Ux.CLOUD_PROXY_5:"proxy3"===t.cloudProxyServer||"proxy4"===t.cloudProxyServer?Ux.CLOUD_PROXY:Ux.CLOUD_PROXY_FALLBACK);return fJ(o),{gatewayInfo:cG(o,n),proxyInfo:d,url:n}},e=>(e.gatewayInfo&&wV.joinChooseServer(t.sid,{lts:a,succ:!0,csAddr:n,serverList:e.gatewayInfo.gatewayAddrs.map(e=>e.address),ec:null,opid:d,cid:e.gatewayInfo.cid.toString(),uid:e.gatewayInfo.uid.toString(),csIp:e.gatewayInfo.csIp,unilbsServerIds:s.toString()}),e.proxyInfo&&wV.joinWebProxyAP(t.sid,{lts:a,sucess:1,apServerAddr:n,turnServerAddrList:e.proxyInfo.addresses.map(e=>e.ip).join(","),errorCode:null,eventType:t.cloudProxyServer,unilbsServerIds:s.toString()}),!1),e=>e.code!==$N.OPERATION_ABORTED&&(e.code===$N.CAN_NOT_GET_GATEWAY_SERVER?e.data.retry:(wV.joinWebProxyAP(t.sid,{lts:a,sucess:0,apServerAddr:n,turnServerAddrList:null,errorCode:e.code,eventType:t.cloudProxyServer,unilbsServerIds:s.toString(),extend:JSON.stringify({networkState:u})}),cD.warning("[".concat(t.clientId,"] multi unilbs network error, retry"),e),RD("warning",["AjaxAPI",t.clientId],"multi unilbs network error, retry, ".concat(e)),!0)),i)}const gJ=(e,t,r,i,n)=>{const o=[],s=o=>{4096===o.flag?wV.joinChooseServer(r.sid,{lts:i,succ:!1,csAddr:t,opid:e.opid,serverList:null,ec:o.error.message,csIp:o.error.data&&o.error.data.csIp,unilbsServerIds:n.toString()}):1048576!==o.flag&&4194304!==o.flag&&4194310!==o.flag||wV.joinWebProxyAP(r.sid,{lts:i,sucess:0,apServerAddr:t,turnServerAddrList:null,errorCode:o.error.code,eventType:r.cloudProxyServer,unilbsServerIds:n.toString()})};if(e.response_body.forEach(t=>{const r=t.buffer.code;if(23===t.uri&&0===r&&!t.buffer.edges_services)if(4194310===t.buffer.flag)cD.warning("no edge services in ap response of proxy fallback, will not set proxy in iceServers"),t.buffer.edges_services=[];else{const r={error:new eD($N.CAN_NOT_GET_GATEWAY_SERVER,"no edge services in ap response",{retry:!0,csIp:e.detail[502]}),flag:t.buffer.flag};o.push(r),s(r)}if(0!==r){const i=BW(r),n={error:new eD($N.CAN_NOT_GET_GATEWAY_SERVER,i.desc,{retry:i.retry,csIp:e.detail[502]}),flag:t.buffer.flag};4194310===t.buffer.flag?cD.warning(n.error.toString()):o.push(n),s(n)}}),o.length)throw cD.warning("[".concat(r.clientId,"] multi unilbs ").concat(t," failed, ").concat(o.map(e=>"flag: ".concat(e.flag,", message: ").concat(e.error.message,", retry: ").concat(e.error.data.retry)).join(" | "))),OD("warning",["AjaxAPI",r.clientId],"checkMultiUnilbsResponseValid",{url:t},o.map(e=>({flag:e.flag,message:e.error.message,retry:e.error.data.retry}))),new eD($N.CAN_NOT_GET_GATEWAY_SERVER,o.map(e=>"flag: ".concat(e.flag,", message: ").concat(e.error.message)).join(" | "),{retry:!!o.find(e=>e.error.data.retry),csIp:e.detail[502]})},fJ=e=>{if(e.addresses&&0===e.addresses.length&&0===e.code)throw new eD($N.CAN_NOT_GET_GATEWAY_SERVER,"void gateway address",{retry:!0,csIp:e.detail&&e.detail[502]});if(WD("GATEWAY_ADDRESS")&&WD("GATEWAY_ADDRESS").length>0){cD.debug("assign gateway address to",WD("GATEWAY_ADDRESS")),RD("debug",["AjaxAPI"],"assign gateway address to ".concat(JSON.stringify(WD("GATEWAY_ADDRESS"))));const t=WD("GATEWAY_ADDRESS").map(t=>({ip:t.ip,port:t.port,ticket:e.addresses[0]&&e.addresses[0].ticket}));e.addresses=t}},EJ=(e,t)=>{if(e.response_body&&e.response_body.length){const t=e.response_body[0];if(0!==t.buffer.code){const e=BW(t.buffer.code);throw new eD($N.UPDATE_TICKET_FAILED,"[".concat(t.buffer.code,"]: ").concat(e.desc),{retry:e.retry})}return t.buffer.ticket}throw cD.debug("update ticket request received ap response without response body:",t),RD("debug",["AjaxAPI"],"update ticket request received ap response without response body: ".concat(t)),new eD($N.UPDATE_TICKET_FAILED,"cannot find response body from ap response",{retry:!1})},IJ=(e,t,r)=>{const i=Math.floor(Math.random()*10**12),n={appid:e.appId,client_ts:Date.now(),opid:i,sid:e.sid,request_bodies:[{uri:22,buffer:{cname:e.cname,detail:{6:e.stringUid,11:t,12:WD("USE_NEW_TOKEN")?"1":void 0},key:e.token,service_ids:r,uid:e.uid||0}}]};n.request_bodies.forEach(t=>{e.multiIP&&e.multiIP.gateway_ip&&(t.buffer.detail[5]=JSON.stringify({vocs_ip:[e.multiIP.uni_lbs_ip],vos_ip:[e.multiIP.gateway_ip]}))});const o=new FormData;return o.append("request",JSON.stringify(n)),[o,i]},mJ=(e,t)=>{const r=Math.floor(Math.random()*10**12),i={appid:e.appId,client_ts:Date.now(),opid:r,sid:e.sid,request_bodies:[{uri:28,buffer:{cname:e.cname,detail:{1:"",6:e.stringUid,12:"1"},token:e.token,service_ids:t,uid:e.uid||0,edges_services:e.apResponse.addresses.map(e=>({ip:e.ip,port:e.port}))}}]},n=new FormData;return n.append("request",JSON.stringify(i)),[n,r]},_J=()=>{const e=WD("AREAS");0===e.length&&e.push(fP.GLOBAL);return vh(e).call(e,(e,t,r)=>{const i=CJ(t);return i?0===r?i:"".concat(e,",").concat(i):e},"")},CJ=e=>e===fP.OVERSEA?"".concat(_P.ASIA,",").concat(_P.EUROPE,",").concat(_P.AFRICA,",").concat(_P.NORTH_AMERICA,",").concat(_P.SOUTH_AMERICA,",").concat(_P.OCEANIA):_P[e],vJ={GLOBAL:{ASIA:[fP.CHINA,fP.JAPAN,fP.INDIA,fP.KOREA,fP.HKMC],EUROPE:[],NORTH_AMERICA:[fP.US],SOUTH_AMERICA:[],OCEANIA:[],AFRICA:[]}},SJ=Object.keys(vJ[fP.GLOBAL]),yJ=[fP.CHINA,fP.NORTH_AMERICA,fP.EUROPE,fP.ASIA,fP.JAPAN,fP.INDIA,fP.OCEANIA,fP.SOUTH_AMERICA,fP.AFRICA,fP.KOREA,fP.HKMC,fP.US],RJ=function(e,t){let r=[];if(e.includes(fP.GLOBAL)){const o=[fP.GLOBAL,fP.OVERSEA],s=Object.keys(CP);if(t===fP.GLOBAL)throw new eD($N.INVALID_PARAMS,"GLOBAL is an invalid excludedArea value");if(t===fP.CHINA)r=[fP.OVERSEA];else if(n=t,SJ.includes(n)){const e=(i=t,vJ[fP.GLOBAL][i]||[]),n=[...o,t,...e];r=s.filter(e=>!n.includes(e))}else if(function(e){let t=!1;return SJ.forEach(r=>{vJ[fP.GLOBAL][r].includes(e)&&(t=!0)}),t}(t)){const e=function(e){let t;return SJ.forEach(r=>{vJ[fP.GLOBAL][r].includes(e)&&(t=r)}),t}(t),i=[...o,e,t];r=s.filter(e=>!i.includes(e))}else r=e;r=function(e){const t=[];return yJ.forEach(r=>{e.includes(r)&&t.push(r)}),t.concat(e.filter(e=>!yJ.includes(e)))}(r)}else r=e;var i,n;return r};async function TJ(e,t,r){const i=async function(e,t,r){const i=WD("WEBCS_DOMAIN").slice(0,WD("AJAX_REQUEST_CONCURRENT")).map(t=>({url:e.proxyServer?"https://".concat(e.proxyServer,"/ap/?url=").concat(t+"/api/v2/transpond/webrtc?v=2"):"https://".concat(t,"/api/v2/transpond/webrtc?v=2"),areaCode:_J()}));let n=null;const o=[],s=async()=>await VG({fragementLength:WD("FRAGEMENT_LENGTH"),referenceList:i,asyncMapHandler:i=>(cD.debug("[".concat(e.clientId,"] Connect to choose_server:"),i.url),lJ(i,e,t,r)),allFailedhandler:e=>{throw e[0]},promisesCollector:o}),a=async()=>{if(await _G(1e3),null!==n)return n;const i=WD("WEBCS_DOMAIN_BACKUP_LIST").map(t=>({url:e.proxyServer?"https://".concat(e.proxyServer,"/ap/?url=").concat(t+"/api/v2/transpond/webrtc?v=2"):"https://".concat(t,"/api/v2/transpond/webrtc?v=2"),areaCode:_J()}));return await VG({fragementLength:WD("FRAGEMENT_LENGTH"),referenceList:i,asyncMapHandler:i=>(cD.debug("[".concat(e.clientId,"] Connect to backup choose_server:"),i.url),lJ(i,e,t,r)),allFailedhandler:e=>{throw e[0]},promisesCollector:o})};try{return n=await TG([s(),a()]),o.length&&o.forEach(e=>e.cancel&&"function"==typeof e.cancel&&e.cancel()),n}catch(e){throw e[0]}}(e,t,r);return{gatewayInfo:await i}}async function wJ(e,t,r,i){const n=e.cloudProxyServer;if("disabled"===n){if(!i)return;if(e.useLocalAccessPoint)return await TJ(e,t,r);if(WD("JOIN_WITH_FALLBACK_MEDIA_PROXY")){const{gatewayInfo:i,proxyInfo:n}=await DJ(e,t,r);return e.turnServer&&"auto"!==e.turnServer.mode?(RD("debug",["Server",e.clientId],"do not set fallback turn because of already having turnserver"),{gatewayInfo:i}):(e.turnServer={mode:"manual",servers:n.map(e=>({turnServerURL:e.address,tcpport:e.tcpport||UD.tcpport,udpport:e.udpport||UD.udpport,username:e.username||UD.username,password:e.password||UD.password,forceturn:WD("JOIN_WITH_FALLBACK_MEDIA_PROXY_FORCE"),security:!0}))},{gatewayInfo:i})}return await TJ(e,t,r)}let o;if(["443only","normal"].includes(n)){let s;i?"normal"!==n?[s,o]=await ny.all([OJ(e,t,r),TJ(e,t,r)]):(s=await OJ(e,t,r),e.proxyServer=s.addresses[0],wV.setProxyServer(e.proxyServer),cD.setProxyServer(e.proxyServer),yD(e.proxyServer),o=await TJ(e,t,r)):(o=void 0,"normal"!==n?s=await OJ(e,t,r):(s=await OJ(e,t,r),e.proxyServer=s.addresses[0],wV.setProxyServer(e.proxyServer),cD.setProxyServer(e.proxyServer),yD(e.proxyServer))),e.turnServer={mode:"manual",servers:s.addresses.map(e=>({turnServerURL:e,tcpport:s.serverResponse.tcpport?s.serverResponse.tcpport:UD.tcpport,udpport:s.serverResponse.udpport?s.serverResponse.udpport:UD.udpport,username:s.serverResponse.username||UD.username,password:s.serverResponse.password||UD.password,forceturn:!0,security:!1}))}}else{const{proxyInfo:i,gatewayInfo:s}=await DJ(e,t,r);o={gatewayInfo:s},e.turnServer={mode:"manual",servers:i.map(e=>({turnServerURL:e.address,tcpport:"proxy3"===n?void 0:e.tcpport?e.tcpport:UD.tcpport,udpport:"proxy4"===n?void 0:e.udpport?e.udpport:UD.udpport,username:e.username||UD.username,password:e.password||UD.password,forceturn:"proxy4"!==n,security:"proxy5"===n}))}}return cD.debug("[".concat(e.clientId,"] set proxy server: ").concat(e.proxyServer,", mode: ").concat(n)),OD("debug",["Server",e.clientId],"setCloudProxyServerAndGetServerInfo",{proxyServer:e.proxyServer,mode:e.cloudProxyServer}),o}async function bJ(e,t,r,i){const n=WD("ACCOUNT_REGISTER").slice(0,WD("AJAX_REQUEST_CONCURRENT"));let o=[];o=t.proxyServer?n.map(e=>"https://".concat(t.proxyServer,"/ap/?url=").concat(e+"/api/v1")):n.map(e=>"https://".concat(e,"/api/v1"));return(await async function(e,t,r,i,n){const o=Date.now(),s={sid:r.sid,opid:10,appid:r.appId,string_uid:t};let a=e[0];const c=await iD(()=>fV(a+"".concat(-1===a.indexOf("?")?"?":"&","action=stringuid"),{data:s,cancelToken:i,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":72}}),(r,i)=>{if(0===r.code){if(r.uid<=0||r.uid>=Math.pow(2,32))throw cD.error("Invalid Uint Uid ".concat(t," => ").concat(r.uid),r),OD("error",["AjaxAPI"],"requestUserAccount","Invalid Uint Uid ".concat(t," => ").concat(r.uid,", ").concat(r)),wV.reqUserAccount(s.sid,{lts:o,success:!1,serverAddr:a,stringUid:s.string_uid,uid:r.uid,errorCode:$N.INVALID_UINT_UID_FROM_STRING_UID,extend:s}),new eD($N.INVALID_UINT_UID_FROM_STRING_UID);return wV.reqUserAccount(s.sid,{lts:o,success:!0,serverAddr:a,stringUid:s.string_uid,uid:r.uid,errorCode:null,extend:s}),!1}const n=BW(r.code);return n.retry&&(a=e[(i+1)%e.length]),wV.reqUserAccount(s.sid,{lts:o,success:!1,serverAddr:a,stringUid:s.string_uid,uid:r.uid,errorCode:n.desc,extend:s}),n.retry},(t,r)=>t.code!==$N.OPERATION_ABORTED&&(wV.reqUserAccount(s.sid,{lts:o,success:!1,serverAddr:a,stringUid:s.string_uid,uid:null,errorCode:t.code,extend:s}),a=e[(r+1)%e.length],!0),n);if(0!==c.code){const e=BW(c.code);throw new eD($N.UNEXPECTED_RESPONSE,e.desc)}return c}(o,e,t,r,i)).uid}async function OJ(e,t,r){let i=Date.now();const n=e.cloudProxyServer,o=WD("normal"===n?"PROXY_CS":"WEBCS_DOMAIN").map(t=>e.proxyServer?"https://".concat(e.proxyServer,"/ap/?url=").concat(t+"/api/v1"):"https://".concat(t,"/api/v1"));if(["proxy3","proxy4","proxy5"].includes(n)){const i=o.map(e=>({url:e,areaCode:_J()}));let n=null;n=await VG({fragementLength:WD("FRAGEMENT_LENGTH"),referenceList:i,asyncMapHandler:i=>function(e,t,r,i){let{url:n,areaCode:o}=e;const s=Date.now(),a={opid:133,flag:"proxy5"===t.cloudProxyServer?4194304:1048576,ts:+new Date,key:t.token,cname:t.cname,sid:t.sid,detail:{6:t.stringUid,11:o},uid:t.uid||0};return iD(async()=>await fV(n,{data:a,cancelToken:r,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":69}}),e=>{if(0===e.code)return wV.joinWebProxyAP(t.sid,{lts:s,sucess:1,apServerAddr:n,turnServerAddrList:e.addresses.map(e=>e.ip).join(","),errorCode:null,eventType:t.cloudProxyServer}),!1;const r=BW(e.code);throw new eD($N.CAN_NOT_GET_GATEWAY_SERVER,r.desc,{retry:r.retry})},e=>e.code!==$N.OPERATION_ABORTED&&(e.code===$N.CAN_NOT_GET_GATEWAY_SERVER?(wV.joinWebProxyAP(a.sid,{lts:s,sucess:0,apServerAddr:n,turnServerAddrList:null,errorCode:e.code,eventType:t.cloudProxyServer}),cD.warning("[".concat(t.clientId,"] proxy ap server ").concat(n," failed, message: ").concat(e.message,", retry: ").concat(e.data.retry)),RD("warning",["AjaxAPI",t.clientId],"proxy ap server ".concat(n," failed, message: ").concat(e.message,", retry: ").concat(e.data.retry)),e.data.retry):(wV.joinWebProxyAP(a.sid,{lts:s,sucess:0,apServerAddr:n,turnServerAddrList:null,errorCode:e.code,eventType:t.cloudProxyServer}),!0)),i)}(i,e,t,r),allFailedhandler:()=>{throw cD.error("[".concat(e.clientId,"] can not get proxy server after trying several times")),new eD($N.CAN_NOT_GET_PROXY_SERVER)}});const s=n.addresses;if(!s||0===s.length)throw cD.error("[".concat(e.clientId,"] can not get proxy server, empty proxy server list")),new eD($N.CAN_NOT_GET_PROXY_SERVER,"empty proxy server list");return{addresses:s.map(e=>e.ip).map(aG),serverResponse:{tcpport:s[0].port||443,udpport:s[0].port||UD.udpport,username:UD.username,password:UD.password}}}let s=null;s=await VG({fragementLength:WD("FRAGEMENT_LENGTH"),referenceList:o,asyncMapHandler:i=>function(e,t,r,i){const n=Date.now(),o={command:"convergeAllocateEdge",sid:t.sid,appId:t.appId,token:t.token,uid:t.uid,cname:t.cname,ts:Math.floor(Date.now()/1e3),version:BD,seq:0,requestId:1};return iD(async()=>({res:await fV(e,{data:{service_name:"webrtc_proxy",json_body:JSON.stringify(o)},cancelToken:r,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":61}}),url:e}),e=>{if(!e.res.json_body)throw cD.debug("[".concat(t.clientId,"] Get proxy server failed: no json_body")),OD("error",["AjaxAPI",t.clientId],"requestProxyServerList","Get proxy server failed: no json_body"),new eD($N.UNEXPECTED_RESPONSE,JSON.stringify(e.res));const r=JSON.parse(e.res.json_body);if(200!==r.code)throw cD.debug("[".concat(t.clientId,"] Get proxy server failed: response code [").concat(r.code,"], reason [").concat(r.reason,"]")),OD("error",["AjaxAPI",t.clientId],"requestProxyServerList","Get proxy server failed: response code [".concat(r.code,"], reason [").concat(r.reason,"]")),new eD($N.UNEXPECTED_RESPONSE,JSON.stringify(e.res));return cD.debug("[".concat(t.clientId,"] App return server length"),r.servers.length),OD("debug",["AjaxAPI",t.clientId],"requestProxyServerList","",{length:r.servers.length}),!1},t=>t.code!==$N.OPERATION_ABORTED&&(wV.requestProxyAppCenter(o.sid,{lts:n,succ:!1,APAddr:e,workerManagerList:null,ec:t.code,response:t.message}),!0),i)}(i,e,t,r),allFailedhandler:()=>{throw cD.error("[".concat(e.clientId,"] can not get proxy server after trying several times")),new eD($N.CAN_NOT_GET_PROXY_SERVER)}});const a=JSON.parse(s.res.json_body).servers.map(sG);if("443only"===e.cloudProxyServer)return{addresses:a,serverResponse:{tcpport:443,udpport:UD.udpport,username:UD.username,password:UD.password}};wV.requestProxyAppCenter(e.sid,{lts:i,succ:!0,APAddr:s.url,workerManagerList:JSON.stringify(a),ec:null,response:JSON.stringify(s.res)}),i=Date.now();const c=a.map(i=>function(e,t,r,i){const n=Date.now();let o=e;e.startsWith("http")||(o="https://".concat(e,":4000/v2/machine"));const s={command:"request",gatewayType:"http",appId:t.appId,cname:t.cname,uid:(t.uid||"").toString(),sdkVersion:"2.3.1",sid:t.sid,seq:1,ts:Date.now(),requestId:3,clientRequest:{appId:t.appId,cname:t.cname,uid:(t.uid||"").toString(),sid:t.sid}};return iD(async()=>({res:await fV(o,{data:s,cancelToken:r}),url:e}),e=>{if(!e.res.serverResponse)throw new eD($N.UNEXPECTED_RESPONSE,"requeet worker manager server failed: serverResponse is undefined");return!1},t=>t.code!==$N.OPERATION_ABORTED&&(wV.requestProxyWorkerManager(s.sid,{lts:n,succ:!1,workerManagerAddr:e,ec:t.code,response:t.message}),!0),i)}(i,e,t,r));let d=null;try{d=await TG(c)}catch(t){throw cD.error("[".concat(e.clientId,"] can not get worker manager after trying several times")),new eD($N.CAN_NOT_GET_PROXY_SERVER)}return c.forEach(e=>e.cancel()),wV.requestProxyWorkerManager(e.sid,{lts:i,succ:!0,workerManagerAddr:d.url,ec:null,response:JSON.stringify(d.res)}),{addresses:[d.url],serverResponse:d.res.serverResponse}}async function NJ(e,t,r){const i=WD("CDS_AP").slice(0,WD("AJAX_REQUEST_CONCURRENT")).map(t=>e.proxyServer?"https://".concat(e.proxyServer,"/ap/?url=").concat(t+"/api/v1"):"https://".concat(t,"/api/v1?action=config")).map(i=>function(e,t,r,i){const n=oO(),o={flag:64,cipher_method:0,features:{device:n.name,system:n.os,system_general:navigator.userAgent,vendor:t.appId,version:BD,cname:t.cname,sid:t.sid,session_id:t.sid,detail:"",proxyServer:t.proxyServer}};return iD(()=>fV(e,{data:o,timeout:1e3,cancelToken:r,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":54}}),void 0,e=>e.code!==$N.OPERATION_ABORTED,i)}(i,e,t,r));let n=null,o=null,s={};try{n=await TG(i)}catch(e){if(e.code===$N.OPERATION_ABORTED)throw e;o=e}i.forEach(e=>e.cancel());if(wV.reportApiInvoke(e.sid,{name:gk.REQUEST_CONFIG_DISTRIBUTE,options:{error:o,res:n}}).onSuccess(),n&&n.test_tags)try{s=function(e){if(!e.test_tags)return{};const t=e.test_tags,r=Object.keys(t),i={};return r.forEach(e=>{var r;const n=Gb(r=e.slice(4)).call(r),o=JSON.parse(t[e])[1];i[n]=o}),i}(n)}catch(e){}return s}async function DJ(e,t,r){const i=WD("PROXY_SERVER_TYPE3"),n=(e,t)=>{let r=i;return Array.isArray(r)&&(r=t%2==0?i[1]:i[0]),"https://".concat(r,"/ap/?url=").concat(e)},o=WD("WEBCS_DOMAIN").slice(0,WD("AJAX_REQUEST_CONCURRENT")).map((t,r)=>({url:"disabled"===e.cloudProxyServer||"fallback"===e.cloudProxyServer?"https://".concat(t,"/api/v2/transpond/webrtc?v=2"):n("".concat(t,"/api/v2/transpond/webrtc?v=2"),r),areaCode:_J(),serviceIds:[Ux.CHOOSE_SERVER,"proxy5"===e.cloudProxyServer?Ux.CLOUD_PROXY_5:"proxy3"===e.cloudProxyServer||"proxy4"===e.cloudProxyServer?Ux.CLOUD_PROXY:Ux.CLOUD_PROXY_FALLBACK]}));let s=null;const a=[],c=async()=>await VG({fragementLength:WD("FRAGEMENT_LENGTH"),referenceList:o,asyncMapHandler:i=>(cD.debug("[".concat(e.clientId,"] Connect to choose_server:"),i.url),pJ(i,e,t,r)),allFailedhandler:e=>{throw e[0]},promisesCollector:a}),d=async()=>{if(await _G(1e3),null!==s)return s;const i=WD("WEBCS_DOMAIN_BACKUP_LIST").map((t,r)=>({url:"disabled"===e.cloudProxyServer||"fallback"===e.cloudProxyServer?"https://".concat(t,"/api/v2/transpond/webrtc?v=2"):n("".concat(t,"/api/v2/transpond/webrtc?v=2"),r),areaCode:_J(),serviceIds:[Ux.CHOOSE_SERVER,"proxy5"===e.cloudProxyServer?Ux.CLOUD_PROXY_5:"proxy3"===e.cloudProxyServer||"proxy4"===e.cloudProxyServer?Ux.CLOUD_PROXY:Ux.CLOUD_PROXY_FALLBACK]}));return await VG({fragementLength:WD("FRAGEMENT_LENGTH"),referenceList:i,asyncMapHandler:i=>(cD.debug("[".concat(e.clientId,"] Connect to backup choose_server:"),i.url),pJ(i,e,t,r)),allFailedhandler:e=>{throw e[0]},promisesCollector:a})};let u,A,h;try{({gatewayInfo:u,proxyInfo:A,url:h}=await TG([c(),d()]))}catch(e){throw e[0]}if(a.length&&a.forEach(e=>e.cancel&&"function"==typeof e.cancel&&e.cancel()),!u||!A)throw new eD($N.UNEXPECTED_ERROR,"missing gateway or proxy response").print();if(e.apUrl=h,"disabled"!==e.cloudProxyServer&&Array.isArray(i)&&h){const t=new kW(h).host;i.includes(t)&&(e.proxyServer=t,cD.setProxyServer(t),wV.setProxyServer(t),yD(t))}return s={gatewayInfo:u,proxyInfo:await pG(A,u.uid)},s}async function LJ(e,t,r,i){const n=WD("UAP_AP").slice(0,WD("AJAX_REQUEST_CONCURRENT")).map(e=>t.proxyServer?"https://".concat(t.proxyServer,"/ap/?url=").concat(e+"/api/v1?action=uap"):"https://".concat(e,"/api/v1?action=uap"));return await AJ(n,e,t,r,i)}async function kJ(e,t,r){const i=WD("UAP_AP").slice(0,WD("AJAX_REQUEST_CONCURRENT")).map(t=>e.proxyServer?"https://".concat(e.proxyServer,"/ap/?url=").concat(t+"/api/v1?action=uap"):"https://".concat(t,"/api/v1?action=uap")).map(i=>function(e,t,r,i){const n={command:"convergeAllocateEdge",sid:t.sid,appId:t.appId,token:t.token,ts:Date.now(),version:BD,cname:t.cname,uid:t.uid.toString(),requestId:hJ,seq:hJ};hJ+=1;const o={service_name:"tele_channel",json_body:JSON.stringify(n)};return iD(async()=>{const t=await fV(e,{data:o,cancelToken:r,headers:{"X-Packet-Service-Type":0,"X-Packet-URI":61}});if(0!==t.code){const e=new eD($N.UNEXPECTED_RESPONSE,"cross channel ap error, code"+t.code,{retry:!0});throw cD.error(e.toString()),OD("error",["AjaxAPI"],"requestChannelMediaRelayWorkerManager",void 0,e.toString()),e}const i=JSON.parse(t.json_body);if(200!==i.code){const e=new eD($N.UNEXPECTED_RESPONSE,"cross channel app center error, code: ".concat(i.code,", reason: ").concat(i.reason));throw cD.error(e.toString()),OD("error",["AjaxAPI"],"requestChannelMediaRelayWorkerManager",void 0,e.toString()),e}if(!i.servers||0===i.servers.length){const e=new eD($N.UNEXPECTED_RESPONSE,"cross channel app center empty server");throw cD.error(e.toString()),OD("error",["AjaxAPI"],"requestChannelMediaRelayWorkerManager",void 0,e.toString()),e}return{vid:i.vid,workerToken:i.workerToken,addressList:i.servers.map(e=>"wss://".concat(e.address.replace(/\./g,"-"),".").concat(WD("WORKER_DOMAIN"),":").concat(e.wss))}},void 0,e=>!!(e.code!==$N.OPERATION_ABORTED&&e.code!==$N.UNEXPECTED_RESPONSE||e.data&&e.data.retry),i)}(i,e,t,r));try{const e=await TG(i);return i.forEach(e=>e.cancel()),e}catch(e){throw e[0]}}async function PJ(e,t,r){let i=null;const n=[],o=async o=>{const s=WD(o?"WEBCS_DOMAIN_BACKUP_LIST":"WEBCS_DOMAIN").map(t=>e.proxyServer?"https://".concat(e.proxyServer,"/ap/?url=").concat(t+"/api/v2/transpond/webrtc?v=2"):"https://".concat(t,"/api/v2/transpond/webrtc?v=2"));return o&&(await _G(1e3),null!==i)?i:await VG({fragementLength:WD("FRAGEMENT_LENGTH"),referenceList:s,asyncMapHandler:i=>(cD.debug("[".concat(e.clientId,"] update ticket, Connect to ").concat(o?"backup":""," choose_server:"),i),function(e,t,r,i){const[n]=mJ(t,[Ux.CHOOSE_SERVER]);let o=IV.networkState;return iD(async()=>{o&&IV.networkState===bP.OFFLINE&&IV.onlineWaiter&&await ny.race([IV.onlineWaiter,_G(i&&i.maxRetryTimeout||tD.maxRetryTimeout)]),o=IV.networkState;const t=await fV(e,{data:n,cancelToken:r,headers:{"Content-Type":"multipart/form-data;"}},!0);return EJ(t,e)},()=>!1,e=>e.code!==$N.OPERATION_ABORTED&&(e.code===$N.UPDATE_TICKET_FAILED?e.data.retry:(cD.warning("[".concat(t.clientId,"] update ticket network error, retry"),e),RD("warning",["AjaxAPI",t.clientId],"update ticket network error, retry, ".concat(e)),!0)),i)}(i,e,t,r)),allFailedhandler:e=>{throw e[0]},promisesCollector:n})};try{return i=await TG([o(!1),o(!0)]),n.length&&n.forEach(e=>e.cancel&&"function"==typeof e.cancel&&e.cancel()),i}catch(e){throw e[0]}}var BJ;function MJ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function UJ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?MJ(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):MJ(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let QJ=LD("ConfigDistributeManager")(BJ=class extends XN{constructor(){super(),kO(this,"configs",void 0),kO(this,"joinInfo",void 0),kO(this,"cancelToken",void 0),kO(this,"retryConfig",{timeout:3e3,timeoutFactor:1.5,maxRetryCount:1,maxRetryTimeout:1e4}),kO(this,"interval",void 0),kO(this,"mutex",new kV("config-distribute")),kO(this,"mutableParamsRead",!1)}startGetConfigDistribute(e,t){this.joinInfo=e,this.cancelToken=t,this.interval&&this.stopGetConfigDistribute(),this.updateConfigDistribute(),this.interval=window.setInterval(()=>{this.updateConfigDistribute()},WD("CONFIG_DISTRIBUTE_INTERVAL"))}stopGetConfigDistribute(){this.interval&&clearInterval(this.interval),this.interval=void 0,this.joinInfo=void 0,this.cancelToken=void 0}async awaitConfigDistributeComplete(){if(!this.mutex.isLocked)return;(await this.mutex.lock())()}async updateConfigDistribute(){if(!this.mutableParamsRead){this.mutableParamsRead=!0;wV.reportApiInvoke(null,{options:void 0,name:gk.LOAD_CONFIG_FROM_LOCALSTORAGE,tag:fk.TRACER}).onSuccess(JSON.stringify(qD))}if(!this.joinInfo||!this.cancelToken||!this.retryConfig)return cD.debug("[config-distribute] get config distribute interrupted have no joininfo"),void OD("debug",this,"updateConfigDistribute",void 0,"get config distribute interrupted have no joininfo");let e;const t=await this.mutex.lock();try{e=await NJ(this.joinInfo,this.cancelToken,this.retryConfig),cD.debug("[config-distribute] get config distribute",JSON.stringify(e)),OD("debug",this,"updateConfigDistribute",e),e.limit_bitrate&&this.handleBitrateLimit(e.limit_bitrate),this.cacheGlobalParameterConfig(e),this.configs=e}catch(e){const t=new eD($N.NETWORK_RESPONSE_ERROR,e);cD.warning("[config-distribute] ".concat(t.toString())),OD("warning",this,"updateConfigDistribute",void 0,e.toString())}finally{t()}}getBitrateLimit(){return this.configs?this.configs.limit_bitrate:void 0}handleBitrateLimit(e){var t;(t=e)&&t.uplink&&t.id&&void 0!==t.uplink.max_bitrate&&void 0!==t.uplink.min_bitrate&&(this.configs&&this.configs.limit_bitrate?this.configs&&this.configs.limit_bitrate&&this.configs.limit_bitrate.id!==e.id&&this.emit(vP.UPDATE_BITRATE_LIMIT,e):this.emit(vP.UPDATE_BITRATE_LIMIT,e))}getLowStreamConfigDistribute(){return this.configs&&this.configs.limit_bitrate&&UJ({},this.configs.limit_bitrate.low_stream_uplink)}cacheGlobalParameterConfig(e){var t;const r=JL(t=Object.keys(e).filter(e=>/^webrtc_ng_global_parameter/.test(e))).call(t);for(let t=0;t<r.length;t++)for(let i=r.length-1;i>t;i--){const t=r[i];if("number"==typeof e[t].__priority){const n=e[t].__priority,o=r[i-1];if("number"==typeof e[o].__priority){if(!(n>e[o].__priority))continue;{const e=t;r[i]=r[i-1],r[i-1]=e}}else{const e=t;r[i]=r[i-1],r[i-1]=e}}}const i={};r.forEach(t=>{const r=e[t],n=r.__expires;Object.keys(r).forEach(e=>{"__priority"===e||"__expires"===e||Object.prototype.hasOwnProperty.call(i,e)||(i[e]=UJ({value:r[e]},n&&{expires:n}))})});try{const e=JSON.stringify(i),t=window.btoa(e);window.localStorage.setItem("websdk_ng_global_parameter",t),cD.debug("Caching global parameters ".concat(e)),OD("debug",this,"cacheGlobalParameterConfig",e)}catch(e){cD.error("Error caching global parameters:",e.message),OD("error",this,"cacheGlobalParameterConfig",void 0,e.message)}}})||BJ;function xJ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function FJ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?xJ(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):xJ(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class VJ extends XN{constructor(e,t,r,i){super(),kO(this,"spec",void 0),kO(this,"token",void 0),kO(this,"websocket",void 0),kO(this,"pingpongTimer",void 0),kO(this,"reconnectMode","retry"),kO(this,"serviceMode",void 0),kO(this,"reqId",0),kO(this,"commandReqId",0),kO(this,"handleWebSocketOpen",()=>{this.reconnectMode="retry",this.startPingPong()}),kO(this,"handleWebSocketMessage",e=>{if(!e.data)return;const t=JSON.parse(e.data);t.requestId?this.emit("@".concat(t.requestId,"-").concat(t.sid),t):this.serviceMode===Yk.INJECT?this.emit($k.INJECT_STREAM_STATUS,t):(wV.workerEvent(this.spec.sid,{actionType:"status",serverCode:t.code,workerType:this.serviceMode===Yk.TRANSCODE?1:2}),this.emit($k.PUBLISH_STREAM_STATUS,t))}),this.spec=t,this.token=e,this.serviceMode=i,this.websocket=new $W("live-streaming",r),this.websocket.on(Hk.CONNECTED,this.handleWebSocketOpen),this.websocket.on(Hk.ON_MESSAGE,this.handleWebSocketMessage),this.websocket.on(Hk.REQUEST_NEW_URLS,(e,t)=>{wG(this,$k.REQUEST_NEW_ADDRESS).then(e).catch(t)}),this.websocket.on(Hk.RECONNECTING,()=>{this.websocket.reconnectMode=this.reconnectMode})}init(e){return this.websocket.init(e)}async request(e,t,r,i){this.reqId+=1,"request"===e&&(this.commandReqId+=1);const n=this.commandReqId,o=this.reqId;if(!o||!this.websocket)throw new eD($N.UNEXPECTED_ERROR);const s=FJ({command:e,sdkVersion:"4.11.0"===BD?"0.0.1":BD,seq:o,requestId:o,allocate:r,cname:this.spec.cname,appId:this.spec.appId,sid:this.spec.sid,uid:this.spec.uid.toString(),ts:Math.floor(Date.now()/1e3)},t);if("closed"===this.websocket.state)throw new eD($N.WS_DISCONNECT);const a=()=>new ny((e,t)=>{this.websocket.once(Hk.CLOSED,()=>t(new eD($N.WS_ABORT))),this.websocket.once(Hk.CONNECTED,e)});"connected"!==this.websocket.state&&await a(),s.clientRequest&&(s.clientRequest.workerToken=this.token);const c=new ny((e,t)=>{const r=()=>{t(new eD($N.WS_ABORT))};this.websocket.once(Hk.RECONNECTING,r),this.websocket.once(Hk.CLOSED,r),this.once("@".concat(o,"-").concat(this.spec.sid),t=>{e(t)})});i&&wV.workerEvent(this.spec.sid,FJ(FJ({},i),{},{requestId:n,actionType:"request",payload:JSON.stringify(t.clientRequest),serverCode:0,code:0}));const d=Date.now();this.websocket.sendMessage(s);let u=null;try{u=await c}catch(i){if("closed"===this.websocket.state)throw i;return await a(),await this.request(e,t,r)}return i&&wV.workerEvent(this.spec.sid,FJ(FJ({},i),{},{requestId:n,actionType:"response",payload:JSON.stringify(u.serverResponse),serverCode:u.code,success:200===u.code,responseTime:Date.now()-d})),200!==u.code&&this.handleResponseError(u),u}tryNextAddress(){this.reconnectMode="tryNext",this.websocket.reconnect("tryNext")}close(){const e="4.11.0"===BD?"0.0.1":BD;this.reqId+=1,"connected"===this.websocket.state?(this.websocket.sendMessage({command:"request",appId:this.spec.appId,cname:this.spec.cname,uid:this.spec.uid.toString(),sdkVersion:e,sid:this.spec.sid,seq:this.reqId,ts:Math.floor(Date.now()/1e3),requestId:this.reqId,clientRequest:{command:"DestroyWorker"}}),this.websocket.close(!1,!0)):this.websocket.close(!1),this.pingpongTimer&&(window.clearInterval(this.pingpongTimer),this.pingpongTimer=void 0)}handleResponseError(e){switch(e.code){case tP.LIVE_STREAM_RESPONSE_ALREADY_EXISTS_STREAM:return void cD.warning("live stream response already exists stream");case tP.LIVE_STREAM_RESPONSE_TRANSCODING_PARAMETER_ERROR:case tP.LIVE_STREAM_RESPONSE_BAD_STREAM:case tP.LIVE_STREAM_RESPONSE_WM_PARAMETER_ERROR:return new eD($N.LIVE_STREAMING_INVALID_ARGUMENT,"",{code:e.code}).throw();case tP.LIVE_STREAM_RESPONSE_WM_WORKER_NOT_EXIST:if("UnpublishStream"===e.serverResponse.command||"UninjectStream"===e.serverResponse.command)return;throw new eD($N.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"live stream response wm worker not exist",{retry:!0});case tP.LIVE_STREAM_RESPONSE_NOT_AUTHORIZED:return new eD($N.LIVE_STREAMING_PUBLISH_STREAM_NOT_AUTHORIZED,"",{code:e.code}).throw();case tP.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE:{const t=new eD($N.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE);return this.emit($k.WARNING,t,e.serverResponse.url)}case tP.LIVE_STREAM_RESPONSE_REQUEST_TOO_OFTEN:{const t=new eD($N.LIVE_STREAMING_WARN_FREQUENT_REQUEST);return this.emit($k.WARNING,t,e.serverResponse.url)}case tP.LIVE_STREAM_RESPONSE_NOT_FOUND_PUBLISH:throw new eD($N.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"live stream response wm worker not exist",{retry:!0});case tP.LIVE_STREAM_RESPONSE_NOT_SUPPORTED:return new eD($N.LIVE_STREAMING_TRANSCODING_NOT_SUPPORTED,"",{code:e.code}).throw();case tP.LIVE_STREAM_RESPONSE_MAX_STREAM_NUM:{const t=new eD($N.LIVE_STREAMING_WARN_STREAM_NUM_REACH_LIMIT);return this.emit($k.WARNING,t,e.serverResponse.url)}case tP.LIVE_STREAM_RESPONSE_INTERNAL_SERVER_ERROR:return new eD($N.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"",{code:e.code}).throw();case tP.LIVE_STREAM_RESPONSE_RESOURCE_LIMIT:throw new eD($N.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"live stream resource limit",{retry:!0,changeAddress:!0});case tP.LIVE_STREAM_RESPONSE_WORKER_LOST:case tP.LIVE_STREAM_RESPONSE_WORKER_QUIT:if("UnpublishStream"===e.serverResponse.command||"UninjectStream"===e.serverResponse.command)return;throw new eD($N.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"error fail send message",{retry:!0,changeAddress:!0});case tP.ERROR_FAIL_SEND_MESSAGE:if("UnpublishStream"===e.serverResponse.command||"UninjectStream"===e.serverResponse.command)return;if("UpdateTranscoding"===e.serverResponse.command||"ControlStream"===e.serverResponse.command)return new eD($N.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"error fail send message",{code:e.code}).throw();throw new eD($N.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"error fail send message",{retry:!0,changeAddress:!0});case tP.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN:case tP.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT:case tP.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE:case tP.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH:return new eD($N.LIVE_STREAMING_CDN_ERROR,"",{code:e.code}).throw()}}startPingPong(){this.pingpongTimer&&window.clearInterval(this.pingpongTimer),this.pingpongTimer=window.setInterval(()=>{"connected"===this.websocket.state&&this.request("ping",{}).catch(yG)},6e3)}}function jJ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function GJ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?jJ(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):jJ(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class KJ extends XN{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:tD,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:tD;super(),kO(this,"onLiveStreamWarning",void 0),kO(this,"onLiveStreamError",void 0),kO(this,"onInjectStatusChange",void 0),kO(this,"spec",void 0),kO(this,"retryTimeout",1e4),kO(this,"connection",void 0),kO(this,"httpRetryConfig",void 0),kO(this,"wsRetryConfig",void 0),kO(this,"streamingTasks",new Map),kO(this,"isStartingStreamingTask",!1),kO(this,"taskMutex",new kV("live-streaming")),kO(this,"cancelToken",qN.CancelToken.source()),kO(this,"transcodingConfig",void 0),kO(this,"injectConfig",GJ({},Zk)),kO(this,"injectLoopTimes",0),kO(this,"uapResponse",void 0),kO(this,"lastTaskId",1),kO(this,"statusError",new Map),this.spec=e,this.httpRetryConfig=r,this.wsRetryConfig=t}async setTranscodingConfig(e){const t=GJ(GJ({},Xk),e);66!==t.videoCodecProfile&&77!==t.videoCodecProfile&&100!==t.videoCodecProfile&&(cD.debug("[".concat(this.spec.clientId,"] set transcoding config, fix video codec profile: ").concat(t.videoCodecProfile," -> 100")),t.videoCodecProfile=100),t.transcodingUsers||(t.transcodingUsers=t.userConfigs),t.transcodingUsers&&(t.transcodingUsers=t.transcodingUsers.map(e=>GJ(GJ(GJ({},Jk),e),{},{zOrder:e.zOrder?e.zOrder+1:1}))),function(e){rk(e.width)||XL(e.width,"config.width",0,1e4),rk(e.height)||XL(e.height,"config.height",0,1e4),rk(e.videoBitrate)||XL(e.videoBitrate,"config.videoBitrate",1,1e6),rk(e.videoFrameRate)||XL(e.videoFrameRate,"config.videoFrameRate"),rk(e.lowLatency)||qL(e.lowLatency,"config.lowLatency"),rk(e.audioSampleRate)||zL(e.audioSampleRate,"config.audioSampleRate",[32e3,44100,48e3]),rk(e.audioBitrate)||XL(e.audioBitrate,"config.audioBitrate",1,128),rk(e.audioChannels)||zL(e.audioChannels,"config.audioChannels",[1,2,3,4,5]),rk(e.videoGop)||XL(e.videoGop,"config.videoGop"),rk(e.videoCodecProfile)||zL(e.videoCodecProfile,"config.videoCodecProfile",[66,77,100]),rk(e.userCount)||XL(e.userCount,"config.userCount",0,17),rk(e.backgroundColor)||XL(e.backgroundColor,"config.backgroundColor",0,16777215),rk(e.userConfigExtraInfo)||ZL(e.userConfigExtraInfo,"config.userConfigExtraInfo",0,4096,!1),e.transcodingUsers&&!rk(e.transcodingUsers)&&($L(e.transcodingUsers,"config.transcodingUsers"),e.transcodingUsers.forEach((e,t)=>{tk(e.uid),rk(e.x)||XL(e.x,"transcodingUser[".concat(t,"].x"),0,1e4),rk(e.y)||XL(e.y,"transcodingUser[".concat(t,"].y"),0,1e4),rk(e.width)||XL(e.width,"transcodingUser[".concat(t,"].width"),0,1e4),rk(e.height)||XL(e.height,"transcodingUser[".concat(t,"].height"),0,1e4),rk(e.zOrder)||XL(e.zOrder-1,"transcodingUser[".concat(t,"].zOrder"),0,100),rk(e.alpha)||XL(e.alpha,"transcodingUser[".concat(t,"].alpha"),0,1,!1)})),rk(e.watermark)||zk(e.watermark,"watermark"),rk(e.backgroundImage)||zk(e.backgroundImage,"backgroundImage"),e.images&&!rk(e.images)&&($L(e.images,"config.images"),e.images.forEach((e,t)=>{zk(e,"images[".concat(t,"]"))}))}(t);const r=[];t.images&&r.push(...t.images.map(e=>GJ(GJ(GJ({},qk),e),{},{zOrder:255}))),t.backgroundImage&&(r.push(GJ(GJ(GJ({},qk),t.backgroundImage),{},{zOrder:0})),delete t.backgroundImage),t.watermark&&(r.push(GJ(GJ(GJ({},qk),t.watermark),{},{zOrder:255})),delete t.watermark),t.images=r,t.transcodingUsers&&(t.userConfigs=t.transcodingUsers.map(e=>GJ({},e)),t.userCount=t.transcodingUsers.length,delete t.transcodingUsers);const i=(t.userConfigs||[]).map(e=>"number"==typeof e.uid?ny.resolve(e.uid):bJ(e.uid,this.spec,this.cancelToken.token,this.httpRetryConfig));if((await ny.all(i)).forEach((e,r)=>{t.userConfigs&&t.userConfigs[r]&&(t.userConfigs[r].uid=e)}),this.transcodingConfig=t,this.connection)try{var n;const e=await this.connection.request("request",{clientRequest:{command:"UpdateTranscoding",transcodingConfig:this.transcodingConfig}},!1,{command:"UpdateTranscoding",workerType:1,requestByUser:!0,tid:Array.from(iV(n=this.streamingTasks).call(n)).map(e=>e.taskId).join("#")});cD.debug("[".concat(this.spec.clientId,"] update live transcoding config success, code: ").concat(e.code,", config:"),JSON.stringify(this.transcodingConfig))}catch(e){if(!e.data||!e.data.retry)throw e;e.data.changeAddress&&this.connection.tryNextAddress(),this.streamingTasks.forEach(t=>{cD.warning("[".concat(this.spec.clientId,"] live streaming receive error"),e.toString(),"try to republish",t.url),this.startLiveStreamingTask(t.url,t.mode,e).then(()=>{cD.debug("[".concat(this.spec.clientId,"] live streaming republish ").concat(t.url," success"))}).catch(e=>{cD.error("[".concat(this.spec.clientId,"] live streaming republish failed"),t.url,e.toString()),this.onLiveStreamError&&this.onLiveStreamError(t.url,e)})})}}setInjectStreamConfig(e,t){this.injectConfig=Object.assign({},this.injectConfig,e),this.injectLoopTimes=t}async startLiveStreamingTask(e,t,r){var i;if(Array.from(iV(i=this.streamingTasks).call(i)).find(e=>e.mode===Yk.INJECT)&&t===Yk.INJECT)return new eD($N.LIVE_STREAMING_TASK_CONFLICT,"inject stream over limit").throw();if(!this.transcodingConfig&&t===Yk.TRANSCODE)throw new eD($N.INVALID_OPERATION,"[LiveStreaming] no transcoding config found, can not start transcoding streaming task");let n={command:"PublishStream",ts:Date.now(),url:e,uid:this.spec.uid.toString(),autoDestroyTime:100,acceptImageTimeout:!0};cD.debug("[".concat(this.spec.clientId,"] start live streaming ").concat(e,", mode: ").concat(t));const o=await this.taskMutex.lock();if(!this.connection&&r)return void o();if(this.streamingTasks.get(e)&&!r)return o(),new eD($N.LIVE_STREAMING_TASK_CONFLICT).throw();try{this.connection||(this.connection=await this.connect(t))}catch(e){throw o(),e}switch(t){case Yk.TRANSCODE:n.transcodingConfig=GJ({},this.transcodingConfig);break;case Yk.RAW:break;case Yk.INJECT:n={cname:this.spec.cname,command:"InjectStream",sid:this.spec.sid,transcodingConfig:this.injectConfig,ts:Date.now(),url:e,loopTimes:this.injectLoopTimes}}this.uapResponse&&this.uapResponse.vid&&(n.vid=this.uapResponse.vid),this.isStartingStreamingTask=!0;const s=this.lastTaskId++;try{const i=new ny((t,i)=>{_G(this.retryTimeout).then(()=>{if(r)return i(r);const t=this.statusError.get(e);return t?(this.statusError.delete(e),i(t)):void 0})}),a=await ny.race([this.connection.request("request",{clientRequest:n},!0,{url:e,command:"PublishStream",workerType:t===Yk.TRANSCODE?1:2,requestByUser:!r,tid:s.toString()}),i]);this.isStartingStreamingTask=!1,cD.debug("[".concat(this.spec.clientId,"] live streaming started, code: ").concat(a.code)),this.streamingTasks.set(e,{clientRequest:n,mode:t,url:e,taskId:s}),o()}catch(i){if(o(),this.isStartingStreamingTask=!1,!i.data||!i.data.retry||r)throw i;return i.data.changeAddress?(this.connection.tryNextAddress(),await this.startLiveStreamingTask(e,t,i)):await this.startLiveStreamingTask(e,t,i)}}stopLiveStreamingTask(e){return new ny((t,r)=>{const i=this.streamingTasks.get(e);if(!i||!this.connection)return new eD($N.UNEXPECTED_ERROR,"can not find streaming task to stop").throw();const n=i.mode;i.abortTask=()=>{cD.debug("[".concat(this.spec.clientId,"] stop live streaming success(worker exception)")),this.streamingTasks.delete(e),t()},this.connection.request("request",{clientRequest:{command:n===Yk.INJECT?"UninjectStream":"UnpublishStream",url:i.url}},!1,{url:e,command:"UnPublishStream",workerType:n===Yk.TRANSCODE?1:2,requestByUser:!0,tid:(this.lastTaskId++).toString()}).then(r=>{cD.debug("[".concat(this.spec.clientId,"] stop live streaming success, code: ").concat(r.code)),this.streamingTasks.delete(e),0===this.streamingTasks.size&&n!==Yk.INJECT&&(this.connection&&this.connection.close(),this.connection=void 0),t(),n===Yk.INJECT&&this.onInjectStatusChange&&this.onInjectStatusChange(Wk.INJECT_STREAM_STATUS_STOP_SUCCESS,this.spec.uid,e)}).catch(r)})}async controlInjectStream(e,t,r,i){const n=this.streamingTasks.get(e);if(!n||!this.connection||n.mode!==Yk.INJECT)throw new eD($N.INVALID_OPERATION,"can not find inject stream task to control");return(await this.connection.request("request",{clientRequest:{command:"ControlStream",url:e,control:t,audioVolume:r,position:i}})).serverResponse}resetAllTask(){var e;const t=Array.from(iV(e=this.streamingTasks).call(e));this.terminate();for(const e of t)this.startLiveStreamingTask(e.url,e.mode).catch(t=>{this.onLiveStreamError&&this.onLiveStreamError(e.url,t)})}terminate(){this.cancelToken&&this.cancelToken.cancel(),this.streamingTasks=new Map,this.isStartingStreamingTask=!1,this.statusError=new Map,this.cancelToken=qN.CancelToken.source(),this.uapResponse=void 0,this.connection&&this.connection.close(),this.connection=void 0}async connect(e){if(this.connection)throw new eD($N.UNEXPECTED_ERROR,"live streaming connection has already connected");const t=await wG(this,eP.REQUEST_WORKER_MANAGER_LIST,e);return this.uapResponse=t,this.connection=new VJ(t.workerToken,this.spec,this.wsRetryConfig,e),this.connection.on($k.WARNING,(e,t)=>this.onLiveStreamWarning&&this.onLiveStreamWarning(t,e)),this.connection.on($k.PUBLISH_STREAM_STATUS,e=>this.handlePublishStreamServer(e)),this.connection.on($k.INJECT_STREAM_STATUS,e=>this.handleInjectStreamServerStatus(e)),this.connection.on($k.REQUEST_NEW_ADDRESS,(t,r)=>{if(!this.connection)return r(new eD($N.UNEXPECTED_ERROR,"can not get new live streaming address list"));wG(this,eP.REQUEST_WORKER_MANAGER_LIST,e).then(e=>{this.uapResponse=e,t(e.addressList)}).catch(r)}),await this.connection.init(t.addressList),this.connection}handlePublishStreamServer(e){const t=e.serverStatus&&e.serverStatus.url||"empty_url",r=this.streamingTasks.get(t),i=e.reason;switch(e.code){case tP.PUBLISH_STREAM_STATUS_ERROR_PUBLISH_BROKEN:case tP.PUBLISH_STREAM_STATUS_ERROR_RTMP_CONNECT:case tP.PUBLISH_STREAM_STATUS_ERROR_RTMP_HANDSHAKE:case tP.PUBLISH_STREAM_STATUS_ERROR_RTMP_PUBLISH:{const i=new eD($N.LIVE_STREAMING_CDN_ERROR,"",{code:e.code});if(r)return cD.error(i.toString()),this.onLiveStreamError&&this.onLiveStreamError(t,i);if(!this.isStartingStreamingTask)return;this.statusError.set(t,i)}case tP.LIVE_STREAM_RESPONSE_FAILED_LOAD_IMAGE:{const e=new eD($N.LIVE_STREAMING_WARN_FAILED_LOAD_IMAGE,i);return this.onLiveStreamWarning&&this.onLiveStreamWarning(t,e)}case tP.LIVE_STREAM_RESPONSE_WORKER_LOST:case tP.LIVE_STREAM_RESPONSE_WORKER_QUIT:{var n;if(!this.connection)return;this.connection.tryNextAddress();const t=Array.from(iV(n=this.streamingTasks).call(n));for(const r of t)r.abortTask?r.abortTask():(cD.warning("[".concat(this.spec.clientId,"] publish stream status code"),e.code,"try to republish",r.url),this.startLiveStreamingTask(r.url,r.mode,new eD($N.LIVE_STREAMING_INTERNAL_SERVER_ERROR,"",{code:e.code})).then(()=>{cD.debug("[".concat(this.spec.clientId,"] republish live stream success"),r.url)}).catch(e=>{cD.error(e.toString()),this.onLiveStreamError&&this.onLiveStreamError(r.url,e)}));return}}}handleInjectStreamServerStatus(e){const t=Number(e.uid),r=e.serverStatus&&e.serverStatus.url;switch(e.code){case 200:return void(this.onInjectStatusChange&&this.onInjectStatusChange(Wk.INJECT_STREAM_STATUS_START_SUCCESS,t,r));case 451:return this.onInjectStatusChange&&this.onInjectStatusChange(Wk.INJECT_STREAM_STATUS_START_ALREADY_EXISTS,t,r),void this.streamingTasks.delete(r);case 453:return this.onInjectStatusChange&&this.onInjectStatusChange(Wk.INJECT_STREAM_STATUS_START_UNAUTHORIZED,t,r),void this.streamingTasks.delete(r);case 470:return this.onInjectStatusChange&&this.onInjectStatusChange(Wk.INJECT_STREAM_STATUS_BROKEN,t,r),void this.streamingTasks.delete(r);case 499:return this.onInjectStatusChange&&this.onInjectStatusChange(Wk.INJECT_STREAM_STATUS_START_TIMEOUT,t,r),void this.streamingTasks.delete(r);default:return void cD.debug("inject stream server status",e)}}hasUrl(e){return this.streamingTasks.has(e)}}class HJ{constructor(){kO(this,"destChannelMediaInfos",new Map),kO(this,"srcChannelMediaInfo",void 0)}setSrcChannelInfo(e){EP(e),this.srcChannelMediaInfo=e}addDestChannelInfo(e){EP(e),this.destChannelMediaInfos.set(e.channelName,e)}removeDestChannelInfo(e){ek(e),this.destChannelMediaInfos.delete(e)}getSrcChannelMediaInfo(){return this.srcChannelMediaInfo}getDestChannelMediaInfo(){return this.destChannelMediaInfos}}function YJ(e){if(!(e instanceof HJ)){return new eD($N.INVALID_PARAMS,"Config should be instance of [ChannelMediaRelayConfiguration]").throw()}const t=e.getSrcChannelMediaInfo(),r=e.getDestChannelMediaInfo();if(!t){return new eD($N.INVALID_PARAMS,"srcChannelMediaInfo should not be empty").throw()}if(0===r.size){return new eD($N.INVALID_PARAMS,"destChannelMediaInfo should not be empty").throw()}}class WJ extends XN{constructor(e,t,r){super(),kO(this,"ws",void 0),kO(this,"requestId",1),kO(this,"heartBeatTimer",void 0),kO(this,"joinInfo",void 0),kO(this,"clientId",void 0),kO(this,"onOpen",()=>{this.emit("open"),this.startHeartBeatCheck()}),kO(this,"onClose",e=>{this.emit("close"),this.dispose()}),kO(this,"onMessage",e=>{const t=JSON.parse(e.data);if(!t||"serverResponse"!==t.command||!t.requestId)return t&&"serverStatus"===t.command&&t.serverStatus&&t.serverStatus.command?(this.emit("status",t.serverStatus),void this.emit(t.serverStatus.command,t.serverStatus)):void 0;this.emit("req_".concat(t.requestId),t)}),this.joinInfo=e,this.clientId=t,this.ws=new $W("cross-channel-".concat(this.clientId),r),this.ws.on(Hk.RECONNECTING,()=>{this.ws.reconnectMode="retry",this.emit("reconnecting")}),this.ws.on(Hk.CONNECTED,this.onOpen),this.ws.on(Hk.ON_MESSAGE,this.onMessage),this.ws.on(Hk.CLOSED,this.onClose)}isConnect(){return"connected"===this.ws.state}sendMessage(e){const t=this.requestId++;return e.requestId=t,e.seq=t,this.ws.sendMessage(e),t}waitStatus(e){return new ny((t,r)=>{const i=window.setTimeout(()=>{r(new eD($N.TIMEOUT,"wait status timeout, status: ".concat(e)))},5e3);this.once(e,n=>{window.clearTimeout(i),n.state&&0!==n.state?r(new eD($N.CROSS_CHANNEL_WAIT_STATUS_ERROR,"wait status error, status: ".concat(e))):t(void 0)}),this.once("dispose",()=>{window.clearTimeout(i),r(new eD($N.WS_ABORT))})})}async request(e){if("closed"===this.ws.state)throw new eD($N.WS_DISCONNECT);const t=()=>new ny((e,t)=>{this.ws.once(Hk.CLOSED,()=>t(new eD($N.WS_ABORT))),this.ws.once(Hk.CONNECTED,e)});"connected"!==this.ws.state&&await t();const r=this.sendMessage(e),i=new ny((e,t)=>{const i=()=>{t(new eD($N.WS_ABORT))};this.ws.once(Hk.RECONNECTING,i),this.ws.once(Hk.CLOSED,i),this.once("req_".concat(r),e),_G(3e3).then(()=>{this.removeAllListeners("req_".concat(r)),this.ws.off(Hk.RECONNECTING,i),this.ws.off(Hk.CLOSED,i),t(new eD($N.TIMEOUT,"cross channel ws request timeout"))})}),n=await i;if(!n||200!==n.code)throw new eD($N.CROSS_CHANNEL_SERVER_ERROR_RESPONSE,"response: ".concat(JSON.stringify(n)));return n}async connect(e){this.ws.removeAllListeners(Hk.REQUEST_NEW_URLS),this.ws.on(Hk.REQUEST_NEW_URLS,t=>{t(e)}),await this.ws.init(e)}dispose(){this.clearHeartBeatCheck(),this.emit("dispose"),this.removeAllListeners(),this.ws.close()}sendPing(e){const t=this.requestId++;return e.requestId=t,this.ws.sendMessage(e),t}startHeartBeatCheck(){this.heartBeatTimer=window.setInterval(()=>{this.sendPing({command:"ping",appId:this.joinInfo.appId,cname:this.joinInfo.cname,uid:this.joinInfo.uid.toString(),sid:this.joinInfo.sid,ts:+new Date,requestId:0})},3e3)}clearHeartBeatCheck(){window.clearInterval(this.heartBeatTimer),this.heartBeatTimer=void 0}}class JJ extends XN{set state(e){e!==this._state&&(e!==oP.RELAY_STATE_FAILURE&&(this.errorCode=sP.RELAY_OK),this.emit("state",e,this.errorCode),this._state=e)}get state(){return this._state}constructor(e,t,r,i){super(),kO(this,"joinInfo",void 0),kO(this,"clientId",void 0),kO(this,"cancelToken",qN.CancelToken.source()),kO(this,"workerToken",void 0),kO(this,"requestId",0),kO(this,"signal",void 0),kO(this,"prevChannelMediaConfig",void 0),kO(this,"httpRetryConfig",void 0),kO(this,"_state",oP.RELAY_STATE_IDLE),kO(this,"errorCode",sP.RELAY_OK),kO(this,"onStatus",e=>{cD.debug("[".concat(this.clientId,"] ChannelMediaStatus: ").concat(JSON.stringify(e))),e&&e.command&&("onAudioPacketReceived"===e.command&&this.emit("event",nP.PACKET_RECEIVED_AUDIO_FROM_SRC),"onVideoPacketReceived"===e.command&&this.emit("event",nP.PACKET_RECEIVED_VIDEO_FROM_SRC),"onSrcTokenPrivilegeDidExpire"===e.command&&(this.errorCode=sP.SRC_TOKEN_EXPIRED,this.state=oP.RELAY_STATE_FAILURE),"onDestTokenPrivilegeDidExpire"===e.command&&(this.errorCode=sP.DEST_TOKEN_EXPIRED,this.state=oP.RELAY_STATE_FAILURE))}),kO(this,"onReconnect",async()=>{cD.debug("[".concat(this.clientId,"] ChannelMediaSocket disconnect, reconnecting")),this.emit("event",nP.NETWORK_DISCONNECTED),this.state=oP.RELAY_STATE_IDLE,this.prevChannelMediaConfig&&this.sendStartRelayMessage(this.prevChannelMediaConfig).catch(e=>{this.state!==oP.RELAY_STATE_IDLE&&(cD.error("auto restart channel media relay failed",e.toString()),this.errorCode=sP.SERVER_CONNECTION_LOST,this.state=oP.RELAY_STATE_FAILURE)})}),this.joinInfo=e,this.clientId=t,this.signal=new WJ(this.joinInfo,this.clientId,r),this.httpRetryConfig=i}async startChannelMediaRelay(e){if(this.state!==oP.RELAY_STATE_IDLE)throw new eD($N.INVALID_OPERATION);this.state=oP.RELAY_STATE_CONNECTING,await this.connect(),cD.debug("[".concat(this.clientId,"] startChannelMediaRelay: connect success"));try{await this.sendStartRelayMessage(e)}catch(e){if(e.data&&e.data.serverResponse&&"SetSourceChannel"===e.data.serverResponse.command)throw new eD($N.CROSS_CHANNEL_FAILED_JOIN_SRC);if(e.data&&e.data.serverResponse&&"SetDestChannelStatus"===e.serverResponse.command)throw new eD($N.CROSS_CHANNEL_FAILED_JOIN_DEST);if(e.data&&e.data.serverResponse&&"StartPacketTransfer"===e.serverResponse.command)throw new eD($N.CROSS_CHANNEL_FAILED_PACKET_SENT_TO_DEST);throw e}this.prevChannelMediaConfig=e}async updateChannelMediaRelay(e){if(this.state!==oP.RELAY_STATE_RUNNING)throw new eD($N.INVALID_OPERATION);await this.sendUpdateMessage(e),this.prevChannelMediaConfig=e}async stopChannelMediaRelay(){await this.sendStopRelayMessage(),cD.debug("[".concat(this.clientId,"] stopChannelMediaRelay: send stop message success")),this.state=oP.RELAY_STATE_IDLE,this.dispose()}dispose(){cD.debug("[".concat(this.clientId,"] disposeChannelMediaRelay")),this.cancelToken.cancel(),this.cancelToken=qN.CancelToken.source(),this.state=oP.RELAY_STATE_IDLE,this.emit("dispose"),this.signal.dispose(),this.prevChannelMediaConfig=void 0}async connect(){const e=await kJ(this.joinInfo,this.cancelToken.token,this.httpRetryConfig);this.workerToken=e.workerToken,await this.signal.connect(e.addressList),this.emit("event",nP.NETWORK_CONNECTED),this.signal.on("status",this.onStatus),this.signal.on("reconnecting",this.onReconnect)}async sendStartRelayMessage(e){const t=this.genMessage(iP.StopPacketTransfer);await this.signal.request(t),await this.signal.waitStatus("Normal Quit"),cD.debug("[".concat(this.clientId,"] startChannelMediaRelay: StopPacketTransfer success"));const r=this.genMessage(iP.SetSdkProfile,e);await this.signal.request(r),cD.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetSdkProfile success"));const i=this.genMessage(iP.SetSourceChannel,e);await this.signal.request(i),await this.signal.waitStatus("SetSourceChannelStatus"),this.emit("event",nP.PACKET_JOINED_SRC_CHANNEL),cD.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetSourceChannel success"));const n=this.genMessage(iP.SetSourceUserId,e);await this.signal.request(n),cD.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetSourceUserId success"));const o=this.genMessage(iP.SetDestChannel,e);await this.signal.request(o),await this.signal.waitStatus("SetDestChannelStatus"),this.emit("event",nP.PACKET_JOINED_DEST_CHANNEL),cD.debug("[".concat(this.clientId,"] startChannelMediaRelay: SetDestChannel success"));const s=this.genMessage(iP.StartPacketTransfer,e);await this.signal.request(s),this.emit("event",nP.PACKET_SENT_TO_DEST_CHANNEL),this.state=oP.RELAY_STATE_RUNNING,cD.debug("[".concat(this.clientId,"] startChannelMediaRelay: StartPacketTransfer success"))}async sendUpdateMessage(e){const t=this.genMessage(iP.UpdateDestChannel,e);await this.signal.request(t),this.emit("event",nP.PACKET_UPDATE_DEST_CHANNEL),cD.debug("[".concat(this.clientId,"] sendUpdateMessage: UpdateDestChannel success"))}async sendStopRelayMessage(){const e=this.genMessage(iP.StopPacketTransfer);await this.signal.request(e),cD.debug("[".concat(this.clientId,"] sendStopRelayMessage: StopPacketTransfer success"))}genMessage(e,t){const r=[],i=[],n=[];this.requestId+=1;const o={appId:this.joinInfo.appId,cname:this.joinInfo.cname,uid:this.joinInfo.uid.toString(),sdkVersion:BD,sid:this.joinInfo.sid,ts:Date.now(),requestId:this.requestId,seq:this.requestId,allocate:!0,clientRequest:{}};"4.11.0"===o.sdkVersion&&(o.sdkVersion="0.0.1");let s=null,a=null;switch(e){case iP.SetSdkProfile:return o.clientRequest={command:"SetSdkProfile",type:"multi_channel"},o;case iP.SetSourceChannel:if(a=t&&t.getSrcChannelMediaInfo(),!a)throw new eD($N.UNEXPECTED_ERROR,"can not find source config");return o.clientRequest={command:"SetSourceChannel",uid:"0",channelName:a.channelName,token:a.token||this.joinInfo.appId},o;case iP.SetSourceUserId:if(a=t&&t.getSrcChannelMediaInfo(),!a)throw new eD($N.UNEXPECTED_ERROR,"can not find source config");return o.clientRequest={command:"SetSourceUserId",uid:a.uid+""},o;case iP.SetDestChannel:if(s=t&&t.getDestChannelMediaInfo(),!s)throw new eD($N.UNEXPECTED_ERROR,"can not find dest config");return s.forEach(e=>{r.push(e.channelName),i.push(e.uid+""),n.push(e.token||this.joinInfo.appId)}),o.clientRequest={command:"SetDestChannel",channelName:r,uid:i,token:n},o;case iP.StartPacketTransfer:return o.clientRequest={command:"StartPacketTransfer"},o;case iP.Reconnect:return o.clientRequest={command:"Reconnect"},o;case iP.StopPacketTransfer:return o.clientRequest={command:"StopPacketTransfer"},o;case iP.UpdateDestChannel:if(s=t&&t.getDestChannelMediaInfo(),!s)throw new eD($N.UNEXPECTED_ERROR,"can not find dest config");return s.forEach(e=>{r.push(e.channelName),i.push(e.uid+""),n.push(e.token||this.joinInfo.appId)}),o.clientRequest={command:"UpdateDestChannel",channelName:r,uid:i,token:n},o}return o}}var qJ;let zJ=LD("AgoraRTCPlayer","trackId")(qJ=class{get videoElementStatus(){return this._videoElementStatus}set videoElementStatus(e){e!==this._videoElementStatus&&(cD.debug("[".concat(this.trackId,"] video-element-status change ").concat(this._videoElementStatus," => ").concat(e)),bD("debug",["HTMLVideoElement",this.trackId],"statusChange","".concat(this._videoElementStatus," => ").concat(e)),this._videoElementStatus=e)}constructor(e){kO(this,"trackId",void 0),kO(this,"config",void 0),kO(this,"onFirstVideoFrameDecoded",void 0),kO(this,"freezeTimeCounterList",[]),kO(this,"timeUpdatedCount",0),kO(this,"freezeTime",0),kO(this,"playbackTime",0),kO(this,"lastTimeUpdatedTime",0),kO(this,"videoTrack",void 0),kO(this,"container",void 0),kO(this,"videoElement",void 0),kO(this,"videoElementCheckInterval",void 0),kO(this,"_videoElementStatus",ck.NONE),kO(this,"slot",void 0),kO(this,"isGettingVideoDimensions",!1),kO(this,"handleVideoEvents",e=>{switch(e.type){case"play":case"playing":this.startGetVideoDimensions(),this.videoElementStatus=ck.PLAYING;break;case"loadeddata":this.onFirstVideoFrameDecoded&&this.onFirstVideoFrameDecoded();break;case"canplay":this.videoElementStatus=ck.CANPLAY;break;case"stalled":this.videoElementStatus=ck.STALLED;break;case"suspend":this.videoElementStatus=ck.SUSPEND;break;case"pause":this.videoElementStatus=ck.PAUSED,!fO()&&!CO()&&this.videoElement&&this.videoTrack&&"live"===this.videoTrack.readyState&&(cD.debug("[track-".concat(this.trackId,"] video element paused, auto resume")),RD("debug",this,"video element paused, auto resume"),this.videoElement.play());break;case"waiting":this.videoElementStatus=ck.WAITING;break;case"abort":this.videoElementStatus=ck.ABORT;break;case"ended":this.videoElementStatus=ck.ENDED;break;case"emptied":this.videoElementStatus=ck.EMPTIED;break;case"timeupdate":{const e=Date.now();if(this.timeUpdatedCount+=1,this.timeUpdatedCount<10)return void(this.lastTimeUpdatedTime=e);const t=e-this.lastTimeUpdatedTime;for(this.lastTimeUpdatedTime=e,t>500&&(this.freezeTime+=t),this.playbackTime+=t;this.playbackTime>=6e3;)this.playbackTime-=6e3,this.freezeTimeCounterList.push(Math.min(6e3,this.freezeTime)),this.freezeTime=Math.max(0,this.freezeTime-6e3);break}}}),kO(this,"startGetVideoDimensions",()=>{const e=()=>{if(this.isGettingVideoDimensions=!0,this.videoElement&&this.videoElement.videoWidth*this.videoElement.videoHeight>4)return cD.debug("[".concat(this.trackId,"] current video dimensions:"),this.videoElement.videoWidth,this.videoElement.videoHeight),OD("debug",this,"startGetVideoDimensions",{videoWidth:this.videoElement.videoWidth,videoHeight:this.videoElement.videoHeight}),void(this.isGettingVideoDimensions=!1);setTimeout(e,500)};!this.isGettingVideoDimensions&&e()}),kO(this,"autoResumeAfterInterruption",()=>{this.videoElement&&this.videoTrack&&"live"===this.videoTrack.readyState&&"running"===FV.curState&&(_O()?(cD.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.2")),this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):mO()?(cD.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.1")),this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):IO()&&(cD.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.0")),this.videoElement.pause(),this.videoElement.play()))}),kO(this,"autoResumeAfterInterruptionOnIOS15",()=>{this.videoElement&&this.videoTrack&&"live"===this.videoTrack.readyState&&(_O()?(cD.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.2")),this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):mO()?(cD.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.1")),this.videoElement.srcObject=null,this.videoElement.srcObject=new MediaStream([this.videoTrack]),this.videoElement.play()):IO()&&(cD.debug("[track-".concat(this.trackId,"] video element paused, auto resume for iOS 15.0")),this.videoElement.pause(),this.videoElement.play()))}),this.slot=e.element,this.trackId=e.trackId,this.updateConfig(e),FV.on(OV.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),FV.on(OV.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15)}updateConfig(e){this.config=e,this.trackId=e.trackId;const t=e.element;t!==this.slot&&(this.destroy(),this.slot=t),this.createElements()}updateVideoTrack(e){this.videoTrack!==e&&(this.videoTrack=e,this.createElements())}play(e){if(this.videoElement){const t=this.videoElement.play();t&&t.catch&&t.catch(t=>{e&&wV.autoplayFailed(e,"video",t.message,this.trackId),OD("warning",this,"play",t.toString(),"error"),"NotAllowedError"===t.name?(cD.warning("detected video element autoplay failed",t),this.handleAutoPlayFailed()):cD.warning("[".concat(this.trackId,"] play warning: "),t)});const r=oO();if(("Safari"===r.name&&15===Number(r.version)||EO())&&t&&t.then&&t.catch){const e=()=>{this.config.mirror&&this.videoElement&&(this.videoElement.style.transform="rotateY(180deg)")};t.then(e).catch(e)}}}getCurrentFrame(){if(!this.videoElement)return new ImageData(2,2);const e=document.createElement("canvas");e.width=this.videoElement.videoWidth,e.height=this.videoElement.videoHeight;const t=e.getContext("2d");if(!t)return cD.error("create canvas context failed!"),OD("error",this,"getCurrentFrame","create canvas context failed!","error"),new ImageData(2,2);t.drawImage(this.videoElement,0,0,e.width,e.height);const r=t.getImageData(0,0,e.width,e.height);return e.remove(),r}destroy(){if(FV.off(OV.IOS_INTERRUPTION_END,this.autoResumeAfterInterruption),FV.off(OV.IOS_15_INTERRUPTION_END,this.autoResumeAfterInterruptionOnIOS15),this.videoElement&&(this.videoElement.srcObject=null,this.videoElement.remove(),this.videoElement=void 0),this.container){try{this.container.remove(),this.slot.removeChild(this.container)}catch(e){}this.container=void 0}this.freezeTimeCounterList=[]}createElements(){this.container||(this.container=document.createElement("div")),this.container.id="agora-video-player-".concat(this.trackId),this.container.style.width="100%",this.container.style.height="100%",this.container.style.position="relative",this.container.style.overflow="hidden",this.videoTrack?(this.container.style.backgroundColor="black",this.createVideoElement(),this.container.appendChild(this.videoElement)):this.removeVideoElement(),this.slot.appendChild(this.container)}createVideoElement(){this.videoElement||(this.videoElementStatus=ck.INIT,this.videoElement=document.createElement("video"),this.videoElement.onerror=()=>this.videoElementStatus=ck.ERROR,this.container&&this.container.appendChild(this.videoElement),XJ.forEach(e=>{this.videoElement&&this.videoElement.addEventListener(e,this.handleVideoEvents)}),this.videoElementCheckInterval=window.setInterval(()=>{!document.getElementById("video_".concat(this.trackId))&&this.videoElement&&(this.videoElementStatus=ck.DESTROYED)},1e3)),this.videoElement.id="video_".concat(this.trackId),this.videoElement.className="agora_video_player",this.videoElement.style.width="100%",this.videoElement.style.height="100%",this.videoElement.style.position="absolute",this.videoElement.controls=!1,this.videoElement.setAttribute("playsinline",""),this.videoElement.style.left="0",this.videoElement.style.top="0";const e=oO();if("Safari"===e.name&&15===Number(e.version)||EO()||!this.config.mirror||(this.videoElement.style.transform="rotateY(180deg)"),this.config.fit?this.videoElement.style.objectFit=this.config.fit:this.videoElement.style.objectFit="cover",this.videoElement.setAttribute("muted",""),this.videoElement.muted=!0,this.videoElement.srcObject&&this.videoElement.srcObject instanceof MediaStream){this.videoElement.srcObject.getVideoTracks()[0]!==this.videoTrack&&(this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,gO()&&this.videoElement.load())}else this.videoElement.srcObject=this.videoTrack?new MediaStream([this.videoTrack]):null,gO()&&this.videoElement.load();const t=this.videoElement.play();void 0!==t&&t.catch(e=>{cD.debug("[".concat(this.trackId,"] playback interrupted"),e.toString()),RD("debug",this,"play back interrupted: ".concat(e.toString()))})}removeVideoElement(){if(this.videoElement){XJ.forEach(e=>{this.videoElement&&this.videoElement.removeEventListener(e,this.handleVideoEvents)}),this.videoElementCheckInterval&&(window.clearInterval(this.videoElementCheckInterval),this.videoElementCheckInterval=void 0);try{this.container&&this.container.removeChild(this.videoElement)}catch(e){}this.videoElement=void 0,this.videoElementStatus=ck.NONE}}handleAutoPlayFailed(){const e=oO();if(this.videoElement){const t=r=>{r.preventDefault(),this.videoElement&&(this.videoElement.play().then(()=>{cD.debug("[".concat(this.trackId,"] Video element for trackId:").concat(this.trackId," autoplay resumed.")),RD("debug",this,"video element autoplay resumed")}).catch(e=>{cD.error(e)}),"Android"!==e.os||"Chrome"!==e.name&&e.name!==tO.WECHAT?(document.body.removeEventListener("touchstart",t,!0),document.body.removeEventListener("mousedown",t,!0)):document.body.removeEventListener("click",t,!0))};"Android"!==e.os||"Chrome"!==e.name&&e.name!==tO.WECHAT?(document.body.addEventListener("touchstart",t,!0),document.body.addEventListener("mousedown",t,!0)):document.body.addEventListener("click",t,!0),CV()}}getVideoElement(){return this.videoElement}getContainerElement(){return this.container}})||qJ;const XJ=["play","playing","loadeddata","canplay","pause","stalled","suspend","waiting","abort","emptied","ended","timeupdate"];var ZJ={exports:{}};function $J(e,t,r){const i=e.createShader(r);if(!i){return new eD($N.WEBGL_INTERNAL_ERROR,"can not create shader").throw()}e.shaderSource(i,t),e.compileShader(i);if(!e.getShaderParameter(i,e.COMPILE_STATUS)){const t=e.getShaderInfoLog(i);e.deleteShader(i);return new eD($N.WEBGL_INTERNAL_ERROR,"error compiling shader:"+t).throw()}return i}function eq(e,t,r,i){const n=[];for(let r=0;r<t.length;++r){const i=0===r?e.VERTEX_SHADER:e.FRAGMENT_SHADER;n.push($J(e,t[r],i))}return function(e,t,r,i){const n=e.createProgram();if(!n)throw new eD($N.WEBGL_INTERNAL_ERROR,"can not create webgl program");if(t.forEach(t=>{e.attachShader(n,t)}),r&&r.forEach((t,r)=>{e.bindAttribLocation(n,i?i[r]:r,t)}),e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS)){const t=e.getProgramInfoLog(n);throw e.deleteProgram(n),new eD($N.WEBGL_INTERNAL_ERROR,"error in program linking:"+t)}return n}(e,n,r,i)}!function(e,t){self,e.exports=(()=>{var e={3476:(e,t,r)=>{e.exports=r(7460)},4341:(e,t,r)=>{e.exports=r(3685)},3536:(e,t,r)=>{var i=r(1910);e.exports=i},8171:(e,t,r)=>{r(6450);var i=r(4058).Object,n=e.exports=function(e,t,r){return i.defineProperty(e,t,r)};i.defineProperty.sham&&(n.sham=!0)},2956:(e,t,r)=>{r(7627),r(6274),r(5967),r(8881),r(4560),r(7206),r(4349),r(7971);var i=r(4058);e.exports=i.Promise},3685:(e,t,r)=>{var i=r(3536);e.exports=i},4883:(e,t,r)=>{var i=r(1899),n=r(7475),o=r(9826),s=i.TypeError;e.exports=function(e){if(n(e))return e;throw s(o(e)+" is not a function")}},174:(e,t,r)=>{var i=r(1899),n=r(4284),o=r(9826),s=i.TypeError;e.exports=function(e){if(n(e))return e;throw s(o(e)+" is not a constructor")}},1851:(e,t,r)=>{var i=r(1899),n=r(7475),o=i.String,s=i.TypeError;e.exports=function(e){if("object"==typeof e||n(e))return e;throw s("Can't set "+o(e)+" as a prototype")}},8479:e=>{e.exports=function(){}},5743:(e,t,r)=>{var i=r(1899),n=r(7046),o=i.TypeError;e.exports=function(e,t){if(n(t,e))return e;throw o("Incorrect invocation")}},6059:(e,t,r)=>{var i=r(1899),n=r(941),o=i.String,s=i.TypeError;e.exports=function(e){if(n(e))return e;throw s(o(e)+" is not an object")}},1692:(e,t,r)=>{var i=r(4529),n=r(9413),o=r(623),s=function(e){return function(t,r,s){var a,c=i(t),d=o(c),u=n(s,d);if(e&&r!=r){for(;d>u;)if((a=c[u++])!=a)return!0}else for(;d>u;u++)if((e||u in c)&&c[u]===r)return e||u||0;return!e&&-1}};e.exports={includes:s(!0),indexOf:s(!1)}},3765:(e,t,r)=>{var i=r(5329);e.exports=i([].slice)},1385:(e,t,r)=>{var i=r(9813)("iterator"),n=!1;try{var o=0,s={next:function(){return{done:!!o++}},return:function(){n=!0}};s[i]=function(){return this},Array.from(s,(function(){throw 2}))}catch(e){}e.exports=function(e,t){if(!t&&!n)return!1;var r=!1;try{var o={};o[i]=function(){return{next:function(){return{done:r=!0}}}},e(o)}catch(e){}return r}},2532:(e,t,r)=>{var i=r(5329),n=i({}.toString),o=i("".slice);e.exports=function(e){return o(n(e),8,-1)}},9697:(e,t,r)=>{var i=r(1899),n=r(2885),o=r(7475),s=r(2532),a=r(9813)("toStringTag"),c=i.Object,d="Arguments"==s(function(){return arguments}());e.exports=n?s:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=c(e),a))?r:d?s(t):"Object"==(i=s(t))&&o(t.callee)?"Arguments":i}},8694:(e,t,r)=>{var i=r(5329)("".replace),n=String(Error("zxcasd").stack),o=/\n\s*at [^:]*:[^\n]*/,s=o.test(n);e.exports=function(e,t){if(s&&"string"==typeof e)for(;t--;)e=i(e,o,"");return e}},3489:(e,t,r)=>{var i=r(953),n=r(1136),o=r(9677),s=r(5988);e.exports=function(e,t,r){for(var a=n(t),c=s.f,d=o.f,u=0;u<a.length;u++){var A=a[u];i(e,A)||r&&i(r,A)||c(e,A,d(t,A))}}},4160:(e,t,r)=>{var i=r(5981);e.exports=!i((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},1046:(e,t,r)=>{var i=r(5143).IteratorPrototype,n=r(9290),o=r(1887),s=r(904),a=r(2077),c=function(){return this};e.exports=function(e,t,r,d){var u=t+" Iterator";return e.prototype=n(i,{next:o(+!d,r)}),s(e,u,!1,!0),a[u]=c,e}},2029:(e,t,r)=>{var i=r(5746),n=r(5988),o=r(1887);e.exports=i?function(e,t,r){return n.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},1887:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},7771:(e,t,r)=>{var i=r(6887),n=r(8834),o=r(2529),s=r(9417),a=r(7475),c=r(1046),d=r(249),u=r(8929),A=r(904),h=r(2029),l=r(9754),p=r(9813),g=r(2077),f=r(5143),E=s.PROPER,I=s.CONFIGURABLE,m=f.IteratorPrototype,_=f.BUGGY_SAFARI_ITERATORS,C=p("iterator"),v="keys",S="values",y="entries",R=function(){return this};e.exports=function(e,t,r,s,p,f,T){c(r,t,s);var w,b,O,N=function(e){if(e===p&&B)return B;if(!_&&e in k)return k[e];switch(e){case v:case S:case y:return function(){return new r(this,e)}}return function(){return new r(this)}},D=t+" Iterator",L=!1,k=e.prototype,P=k[C]||k["@@iterator"]||p&&k[p],B=!_&&P||N(p),M="Array"==t&&k.entries||P;if(M&&(w=d(M.call(new e)))!==Object.prototype&&w.next&&(o||d(w)===m||(u?u(w,m):a(w[C])||l(w,C,R)),A(w,D,!0,!0),o&&(g[D]=R)),E&&p==S&&P&&P.name!==S&&(!o&&I?h(k,"name",S):(L=!0,B=function(){return n(P,this)})),p)if(b={values:N(S),keys:f?B:N(v),entries:N(y)},T)for(O in b)(_||L||!(O in k))&&l(k,O,b[O]);else i({target:t,proto:!0,forced:_||L},b);return o&&!T||k[C]===B||l(k,C,B,{name:p}),g[t]=B,b}},5746:(e,t,r)=>{var i=r(5981);e.exports=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},1333:(e,t,r)=>{var i=r(1899),n=r(941),o=i.document,s=n(o)&&n(o.createElement);e.exports=function(e){return s?o.createElement(e):{}}},3281:e=>{e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},3321:e=>{e.exports="object"==typeof window},4470:(e,t,r)=>{var i=r(2861),n=r(1899);e.exports=/ipad|iphone|ipod/i.test(i)&&void 0!==n.Pebble},2749:(e,t,r)=>{var i=r(2861);e.exports=/(?:ipad|iphone|ipod).*applewebkit/i.test(i)},6049:(e,t,r)=>{var i=r(2532),n=r(1899);e.exports="process"==i(n.process)},8045:(e,t,r)=>{var i=r(2861);e.exports=/web0s(?!.*chrome)/i.test(i)},2861:(e,t,r)=>{var i=r(626);e.exports=i("navigator","userAgent")||""},3385:(e,t,r)=>{var i,n,o=r(1899),s=r(2861),a=o.process,c=o.Deno,d=a&&a.versions||c&&c.version,u=d&&d.v8;u&&(n=(i=u.split("."))[0]>0&&i[0]<4?1:+(i[0]+i[1])),!n&&s&&(!(i=s.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=s.match(/Chrome\/(\d+)/))&&(n=+i[1]),e.exports=n},6759:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},8780:(e,t,r)=>{var i=r(5981),n=r(1887);e.exports=!i((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",n(1,7)),7!==e.stack)}))},6887:(e,t,r)=>{var i=r(1899),n=r(9730),o=r(5329),s=r(7475),a=r(9677).f,c=r(7252),d=r(4058),u=r(6843),A=r(2029),h=r(953),l=function(e){var t=function(r,i,o){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,i)}return new e(r,i,o)}return n(e,this,arguments)};return t.prototype=e.prototype,t};e.exports=function(e,t){var r,n,p,g,f,E,I,m,_=e.target,C=e.global,v=e.stat,S=e.proto,y=C?i:v?i[_]:(i[_]||{}).prototype,R=C?d:d[_]||A(d,_,{})[_],T=R.prototype;for(p in t)r=!c(C?p:_+(v?".":"#")+p,e.forced)&&y&&h(y,p),f=R[p],r&&(E=e.noTargetGet?(m=a(y,p))&&m.value:y[p]),g=r&&E?E:t[p],r&&typeof f==typeof g||(I=e.bind&&r?u(g,i):e.wrap&&r?l(g):S&&s(g)?o(g):g,(e.sham||g&&g.sham||f&&f.sham)&&A(I,"sham",!0),A(R,p,I),S&&(h(d,n=_+"Prototype")||A(d,n,{}),A(d[n],p,g),e.real&&T&&!T[p]&&A(T,p,g)))}},5981:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},9730:(e,t,r)=>{var i=r(8285),n=Function.prototype,o=n.apply,s=n.call;e.exports="object"==typeof Reflect&&Reflect.apply||(i?s.bind(o):function(){return s.apply(o,arguments)})},6843:(e,t,r)=>{var i=r(5329),n=r(4883),o=r(8285),s=i(i.bind);e.exports=function(e,t){return n(e),void 0===t?e:o?s(e,t):function(){return e.apply(t,arguments)}}},8285:(e,t,r)=>{var i=r(5981);e.exports=!i((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},8834:(e,t,r)=>{var i=r(8285),n=Function.prototype.call;e.exports=i?n.bind(n):function(){return n.apply(n,arguments)}},9417:(e,t,r)=>{var i=r(5746),n=r(953),o=Function.prototype,s=i&&Object.getOwnPropertyDescriptor,a=n(o,"name"),c=a&&"something"===function(){}.name,d=a&&(!i||i&&s(o,"name").configurable);e.exports={EXISTS:a,PROPER:c,CONFIGURABLE:d}},5329:(e,t,r)=>{var i=r(8285),n=Function.prototype,o=n.bind,s=n.call,a=i&&o.bind(s,s);e.exports=i?function(e){return e&&a(e)}:function(e){return e&&function(){return s.apply(e,arguments)}}},626:(e,t,r)=>{var i=r(4058),n=r(1899),o=r(7475),s=function(e){return o(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?s(i[e])||s(n[e]):i[e]&&i[e][t]||n[e]&&n[e][t]}},2902:(e,t,r)=>{var i=r(9697),n=r(4229),o=r(2077),s=r(9813)("iterator");e.exports=function(e){if(null!=e)return n(e,s)||n(e,"@@iterator")||o[i(e)]}},429:(e,t,r)=>{var i=r(1899),n=r(8834),o=r(4883),s=r(6059),a=r(9826),c=r(2902),d=i.TypeError;e.exports=function(e,t){var r=arguments.length<2?c(e):t;if(o(r))return s(n(r,e));throw d(a(e)+" is not iterable")}},4229:(e,t,r)=>{var i=r(4883);e.exports=function(e,t){var r=e[t];return null==r?void 0:i(r)}},1899:(e,t,r)=>{var i=function(e){return e&&e.Math==Math&&e};e.exports=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof r.g&&r.g)||function(){return this}()||Function("return this")()},953:(e,t,r)=>{var i=r(5329),n=r(9678),o=i({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(n(e),t)}},7748:e=>{e.exports={}},4845:(e,t,r)=>{var i=r(1899);e.exports=function(e,t){var r=i.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))}},5463:(e,t,r)=>{var i=r(626);e.exports=i("document","documentElement")},2840:(e,t,r)=>{var i=r(5746),n=r(5981),o=r(1333);e.exports=!i&&!n((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},7026:(e,t,r)=>{var i=r(1899),n=r(5329),o=r(5981),s=r(2532),a=i.Object,c=n("".split);e.exports=o((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"==s(e)?c(e,""):a(e)}:a},1302:(e,t,r)=>{var i=r(5329),n=r(7475),o=r(3030),s=i(Function.toString);n(o.inspectSource)||(o.inspectSource=function(e){return s(e)}),e.exports=o.inspectSource},3794:(e,t,r)=>{var i=r(941),n=r(2029);e.exports=function(e,t){i(t)&&"cause"in t&&n(e,"cause",t.cause)}},5402:(e,t,r)=>{var i,n,o,s=r(8019),a=r(1899),c=r(5329),d=r(941),u=r(2029),A=r(953),h=r(3030),l=r(4262),p=r(7748),g="Object already initialized",f=a.TypeError,E=a.WeakMap;if(s||h.state){var I=h.state||(h.state=new E),m=c(I.get),_=c(I.has),C=c(I.set);i=function(e,t){if(_(I,e))throw new f(g);return t.facade=e,C(I,e,t),t},n=function(e){return m(I,e)||{}},o=function(e){return _(I,e)}}else{var v=l("state");p[v]=!0,i=function(e,t){if(A(e,v))throw new f(g);return t.facade=e,u(e,v,t),t},n=function(e){return A(e,v)?e[v]:{}},o=function(e){return A(e,v)}}e.exports={set:i,get:n,has:o,enforce:function(e){return o(e)?n(e):i(e,{})},getterFor:function(e){return function(t){var r;if(!d(t)||(r=n(t)).type!==e)throw f("Incompatible receiver, "+e+" required");return r}}}},6782:(e,t,r)=>{var i=r(9813),n=r(2077),o=i("iterator"),s=Array.prototype;e.exports=function(e){return void 0!==e&&(n.Array===e||s[o]===e)}},7475:e=>{e.exports=function(e){return"function"==typeof e}},4284:(e,t,r)=>{var i=r(5329),n=r(5981),o=r(7475),s=r(9697),a=r(626),c=r(1302),d=function(){},u=[],A=a("Reflect","construct"),h=/^\s*(?:class|function)\b/,l=i(h.exec),p=!h.exec(d),g=function(e){if(!o(e))return!1;try{return A(d,u,e),!0}catch(e){return!1}},f=function(e){if(!o(e))return!1;switch(s(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return p||!!l(h,c(e))}catch(e){return!0}};f.sham=!0,e.exports=!A||n((function(){var e;return g(g.call)||!g(Object)||!g((function(){e=!0}))||e}))?f:g},7252:(e,t,r)=>{var i=r(5981),n=r(7475),o=/#|\.prototype\./,s=function(e,t){var r=c[a(e)];return r==u||r!=d&&(n(t)?i(t):!!t)},a=s.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=s.data={},d=s.NATIVE="N",u=s.POLYFILL="P";e.exports=s},941:(e,t,r)=>{var i=r(7475);e.exports=function(e){return"object"==typeof e?null!==e:i(e)}},2529:e=>{e.exports=!0},6664:(e,t,r)=>{var i=r(1899),n=r(626),o=r(7475),s=r(7046),a=r(2302),c=i.Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return o(t)&&s(t.prototype,c(e))}},3091:(e,t,r)=>{var i=r(1899),n=r(6843),o=r(8834),s=r(6059),a=r(9826),c=r(6782),d=r(623),u=r(7046),A=r(429),h=r(2902),l=r(7609),p=i.TypeError,g=function(e,t){this.stopped=e,this.result=t},f=g.prototype;e.exports=function(e,t,r){var i,E,I,m,_,C,v,S=r&&r.that,y=!(!r||!r.AS_ENTRIES),R=!(!r||!r.IS_ITERATOR),T=!(!r||!r.INTERRUPTED),w=n(t,S),b=function(e){return i&&l(i,"normal",e),new g(!0,e)},O=function(e){return y?(s(e),T?w(e[0],e[1],b):w(e[0],e[1])):T?w(e,b):w(e)};if(R)i=e;else{if(!(E=h(e)))throw p(a(e)+" is not iterable");if(c(E)){for(I=0,m=d(e);m>I;I++)if((_=O(e[I]))&&u(f,_))return _;return new g(!1)}i=A(e,E)}for(C=i.next;!(v=o(C,i)).done;){try{_=O(v.value)}catch(e){l(i,"throw",e)}if("object"==typeof _&&_&&u(f,_))return _}return new g(!1)}},7609:(e,t,r)=>{var i=r(8834),n=r(6059),o=r(4229);e.exports=function(e,t,r){var s,a;n(e);try{if(!(s=o(e,"return"))){if("throw"===t)throw r;return r}s=i(s,e)}catch(e){a=!0,s=e}if("throw"===t)throw r;if(a)throw s;return n(s),r}},5143:(e,t,r)=>{var i,n,o,s=r(5981),a=r(7475),c=r(9290),d=r(249),u=r(9754),A=r(9813),h=r(2529),l=A("iterator"),p=!1;[].keys&&("next"in(o=[].keys())?(n=d(d(o)))!==Object.prototype&&(i=n):p=!0),null==i||s((function(){var e={};return i[l].call(e)!==e}))?i={}:h&&(i=c(i)),a(i[l])||u(i,l,(function(){return this})),e.exports={IteratorPrototype:i,BUGGY_SAFARI_ITERATORS:p}},2077:e=>{e.exports={}},623:(e,t,r)=>{var i=r(3057);e.exports=function(e){return i(e.length)}},6132:(e,t,r)=>{var i,n,o,s,a,c,d,u,A=r(1899),h=r(6843),l=r(9677).f,p=r(2941).set,g=r(2749),f=r(4470),E=r(8045),I=r(6049),m=A.MutationObserver||A.WebKitMutationObserver,_=A.document,C=A.process,v=A.Promise,S=l(A,"queueMicrotask"),y=S&&S.value;y||(i=function(){var e,t;for(I&&(e=C.domain)&&e.exit();n;){t=n.fn,n=n.next;try{t()}catch(e){throw n?s():o=void 0,e}}o=void 0,e&&e.enter()},g||I||E||!m||!_?!f&&v&&v.resolve?((d=v.resolve(void 0)).constructor=v,u=h(d.then,d),s=function(){u(i)}):I?s=function(){C.nextTick(i)}:(p=h(p,A),s=function(){p(i)}):(a=!0,c=_.createTextNode(""),new m(i).observe(c,{characterData:!0}),s=function(){c.data=a=!a})),e.exports=y||function(e){var t={fn:e,next:void 0};o&&(o.next=t),n||(n=t,s()),o=t}},9297:(e,t,r)=>{var i=r(1899);e.exports=i.Promise},2497:(e,t,r)=>{var i=r(3385),n=r(5981);e.exports=!!Object.getOwnPropertySymbols&&!n((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&i&&i<41}))},8019:(e,t,r)=>{var i=r(1899),n=r(7475),o=r(1302),s=i.WeakMap;e.exports=n(s)&&/native code/.test(o(s))},9520:(e,t,r)=>{var i=r(4883),n=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=i})),this.resolve=i(t),this.reject=i(r)};e.exports.f=function(e){return new n(e)}},4649:(e,t,r)=>{var i=r(5803);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:i(e)}},9290:(e,t,r)=>{var i,n=r(6059),o=r(9938),s=r(6759),a=r(7748),c=r(5463),d=r(1333),u=r(4262)("IE_PROTO"),A=function(){},h=function(e){return"<script>"+e+"<\/script>"},l=function(e){e.write(h("")),e.close();var t=e.parentWindow.Object;return e=null,t},p=function(){try{i=new ActiveXObject("htmlfile")}catch(e){}var e,t;p="undefined"!=typeof document?document.domain&&i?l(i):((t=d("iframe")).style.display="none",c.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(h("document.F=Object")),e.close(),e.F):l(i);for(var r=s.length;r--;)delete p.prototype[s[r]];return p()};a[u]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(A.prototype=n(e),r=new A,A.prototype=null,r[u]=e):r=p(),void 0===t?r:o.f(r,t)}},9938:(e,t,r)=>{var i=r(5746),n=r(3937),o=r(5988),s=r(6059),a=r(4529),c=r(4771);t.f=i&&!n?Object.defineProperties:function(e,t){s(e);for(var r,i=a(t),n=c(t),d=n.length,u=0;d>u;)o.f(e,r=n[u++],i[r]);return e}},5988:(e,t,r)=>{var i=r(1899),n=r(5746),o=r(2840),s=r(3937),a=r(6059),c=r(3894),d=i.TypeError,u=Object.defineProperty,A=Object.getOwnPropertyDescriptor;t.f=n?s?function(e,t,r){if(a(e),t=c(t),a(r),"function"==typeof e&&"prototype"===t&&"value"in r&&"writable"in r&&!r.writable){var i=A(e,t);i&&i.writable&&(e[t]=r.value,r={configurable:"configurable"in r?r.configurable:i.configurable,enumerable:"enumerable"in r?r.enumerable:i.enumerable,writable:!1})}return u(e,t,r)}:u:function(e,t,r){if(a(e),t=c(t),a(r),o)try{return u(e,t,r)}catch(e){}if("get"in r||"set"in r)throw d("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},9677:(e,t,r)=>{var i=r(5746),n=r(8834),o=r(6760),s=r(1887),a=r(4529),c=r(3894),d=r(953),u=r(2840),A=Object.getOwnPropertyDescriptor;t.f=i?A:function(e,t){if(e=a(e),t=c(t),u)try{return A(e,t)}catch(e){}if(d(e,t))return s(!n(o.f,e,t),e[t])}},946:(e,t,r)=>{var i=r(5629),n=r(6759).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return i(e,n)}},7857:(e,t)=>{t.f=Object.getOwnPropertySymbols},249:(e,t,r)=>{var i=r(1899),n=r(953),o=r(7475),s=r(9678),a=r(4262),c=r(4160),d=a("IE_PROTO"),u=i.Object,A=u.prototype;e.exports=c?u.getPrototypeOf:function(e){var t=s(e);if(n(t,d))return t[d];var r=t.constructor;return o(r)&&t instanceof r?r.prototype:t instanceof u?A:null}},7046:(e,t,r)=>{var i=r(5329);e.exports=i({}.isPrototypeOf)},5629:(e,t,r)=>{var i=r(5329),n=r(953),o=r(4529),s=r(1692).indexOf,a=r(7748),c=i([].push);e.exports=function(e,t){var r,i=o(e),d=0,u=[];for(r in i)!n(a,r)&&n(i,r)&&c(u,r);for(;t.length>d;)n(i,r=t[d++])&&(~s(u,r)||c(u,r));return u}},4771:(e,t,r)=>{var i=r(5629),n=r(6759);e.exports=Object.keys||function(e){return i(e,n)}},6760:(e,t)=>{var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,n=i&&!r.call({1:2},1);t.f=n?function(e){var t=i(this,e);return!!t&&t.enumerable}:r},8929:(e,t,r)=>{var i=r(5329),n=r(6059),o=r(1851);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=i(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return n(r),o(i),t?e(r,i):r.__proto__=i,r}}():void 0)},5623:(e,t,r)=>{var i=r(2885),n=r(9697);e.exports=i?{}.toString:function(){return"[object "+n(this)+"]"}},9811:(e,t,r)=>{var i=r(1899),n=r(8834),o=r(7475),s=r(941),a=i.TypeError;e.exports=function(e,t){var r,i;if("string"===t&&o(r=e.toString)&&!s(i=n(r,e)))return i;if(o(r=e.valueOf)&&!s(i=n(r,e)))return i;if("string"!==t&&o(r=e.toString)&&!s(i=n(r,e)))return i;throw a("Can't convert object to primitive value")}},1136:(e,t,r)=>{var i=r(626),n=r(5329),o=r(946),s=r(7857),a=r(6059),c=n([].concat);e.exports=i("Reflect","ownKeys")||function(e){var t=o.f(a(e)),r=s.f;return r?c(t,r(e)):t}},4058:e=>{e.exports={}},2:e=>{e.exports=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}}},6584:(e,t,r)=>{var i=r(6059),n=r(941),o=r(9520);e.exports=function(e,t){if(i(e),n(t)&&t.constructor===e)return t;var r=o.f(e);return(0,r.resolve)(t),r.promise}},8397:e=>{var t=function(){this.head=null,this.tail=null};t.prototype={add:function(e){var t={item:e,next:null};this.head?this.tail.next=t:this.head=t,this.tail=t},get:function(){var e=this.head;if(e)return this.head=e.next,this.tail===e&&(this.tail=null),e.item}},e.exports=t},7524:(e,t,r)=>{var i=r(9754);e.exports=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:i(e,n,t[n],r);return e}},9754:(e,t,r)=>{var i=r(2029);e.exports=function(e,t,r,n){n&&n.enumerable?e[t]=r:i(e,t,r)}},8219:(e,t,r)=>{var i=r(1899).TypeError;e.exports=function(e){if(null==e)throw i("Can't call method on "+e);return e}},4911:(e,t,r)=>{var i=r(1899),n=Object.defineProperty;e.exports=function(e,t){try{n(i,e,{value:t,configurable:!0,writable:!0})}catch(r){i[e]=t}return t}},4431:(e,t,r)=>{var i=r(626),n=r(5988),o=r(9813),s=r(5746),a=o("species");e.exports=function(e){var t=i(e),r=n.f;s&&t&&!t[a]&&r(t,a,{configurable:!0,get:function(){return this}})}},904:(e,t,r)=>{var i=r(2885),n=r(5988).f,o=r(2029),s=r(953),a=r(5623),c=r(9813)("toStringTag");e.exports=function(e,t,r,d){if(e){var u=r?e:e.prototype;s(u,c)||n(u,c,{configurable:!0,value:t}),d&&!i&&o(u,"toString",a)}}},4262:(e,t,r)=>{var i=r(8726),n=r(9418),o=i("keys");e.exports=function(e){return o[e]||(o[e]=n(e))}},3030:(e,t,r)=>{var i=r(1899),n=r(4911),o="__core-js_shared__",s=i[o]||n(o,{});e.exports=s},8726:(e,t,r)=>{var i=r(2529),n=r(3030);(e.exports=function(e,t){return n[e]||(n[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.20.3",mode:i?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE",source:"https://github.com/zloirock/core-js"})},487:(e,t,r)=>{var i=r(6059),n=r(174),o=r(9813)("species");e.exports=function(e,t){var r,s=i(e).constructor;return void 0===s||null==(r=i(s)[o])?t:n(r)}},4620:(e,t,r)=>{var i=r(5329),n=r(2435),o=r(5803),s=r(8219),a=i("".charAt),c=i("".charCodeAt),d=i("".slice),u=function(e){return function(t,r){var i,u,A=o(s(t)),h=n(r),l=A.length;return h<0||h>=l?e?"":void 0:(i=c(A,h))<55296||i>56319||h+1===l||(u=c(A,h+1))<56320||u>57343?e?a(A,h):i:e?d(A,h,h+2):u-56320+(i-55296<<10)+65536}};e.exports={codeAt:u(!1),charAt:u(!0)}},2941:(e,t,r)=>{var i,n,o,s,a=r(1899),c=r(9730),d=r(6843),u=r(7475),A=r(953),h=r(5981),l=r(5463),p=r(3765),g=r(1333),f=r(2749),E=r(6049),I=a.setImmediate,m=a.clearImmediate,_=a.process,C=a.Dispatch,v=a.Function,S=a.MessageChannel,y=a.String,R=0,T={};try{i=a.location}catch(e){}var w=function(e){if(A(T,e)){var t=T[e];delete T[e],t()}},b=function(e){return function(){w(e)}},O=function(e){w(e.data)},N=function(e){a.postMessage(y(e),i.protocol+"//"+i.host)};I&&m||(I=function(e){var t=p(arguments,1);return T[++R]=function(){c(u(e)?e:v(e),void 0,t)},n(R),R},m=function(e){delete T[e]},E?n=function(e){_.nextTick(b(e))}:C&&C.now?n=function(e){C.now(b(e))}:S&&!f?(s=(o=new S).port2,o.port1.onmessage=O,n=d(s.postMessage,s)):a.addEventListener&&u(a.postMessage)&&!a.importScripts&&i&&"file:"!==i.protocol&&!h(N)?(n=N,a.addEventListener("message",O,!1)):n="onreadystatechange"in g("script")?function(e){l.appendChild(g("script")).onreadystatechange=function(){l.removeChild(this),w(e)}}:function(e){setTimeout(b(e),0)}),e.exports={set:I,clear:m}},9413:(e,t,r)=>{var i=r(2435),n=Math.max,o=Math.min;e.exports=function(e,t){var r=i(e);return r<0?n(r+t,0):o(r,t)}},4529:(e,t,r)=>{var i=r(7026),n=r(8219);e.exports=function(e){return i(n(e))}},2435:e=>{var t=Math.ceil,r=Math.floor;e.exports=function(e){var i=+e;return i!=i||0===i?0:(i>0?r:t)(i)}},3057:(e,t,r)=>{var i=r(2435),n=Math.min;e.exports=function(e){return e>0?n(i(e),9007199254740991):0}},9678:(e,t,r)=>{var i=r(1899),n=r(8219),o=i.Object;e.exports=function(e){return o(n(e))}},6935:(e,t,r)=>{var i=r(1899),n=r(8834),o=r(941),s=r(6664),a=r(4229),c=r(9811),d=r(9813),u=i.TypeError,A=d("toPrimitive");e.exports=function(e,t){if(!o(e)||s(e))return e;var r,i=a(e,A);if(i){if(void 0===t&&(t="default"),r=n(i,e,t),!o(r)||s(r))return r;throw u("Can't convert object to primitive value")}return void 0===t&&(t="number"),c(e,t)}},3894:(e,t,r)=>{var i=r(6935),n=r(6664);e.exports=function(e){var t=i(e,"string");return n(t)?t:t+""}},2885:(e,t,r)=>{var i={};i[r(9813)("toStringTag")]="z",e.exports="[object z]"===String(i)},5803:(e,t,r)=>{var i=r(1899),n=r(9697),o=i.String;e.exports=function(e){if("Symbol"===n(e))throw TypeError("Cannot convert a Symbol value to a string");return o(e)}},9826:(e,t,r)=>{var i=r(1899).String;e.exports=function(e){try{return i(e)}catch(e){return"Object"}}},9418:(e,t,r)=>{var i=r(5329),n=0,o=Math.random(),s=i(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++n+o,36)}},2302:(e,t,r)=>{var i=r(2497);e.exports=i&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3937:(e,t,r)=>{var i=r(5746),n=r(5981);e.exports=i&&n((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},9813:(e,t,r)=>{var i=r(1899),n=r(8726),o=r(953),s=r(9418),a=r(2497),c=r(2302),d=n("wks"),u=i.Symbol,A=u&&u.for,h=c?u:u&&u.withoutSetter||s;e.exports=function(e){if(!o(d,e)||!a&&"string"!=typeof d[e]){var t="Symbol."+e;a&&o(u,e)?d[e]=u[e]:d[e]=c&&A?A(t):h(t)}return d[e]}},7627:(e,t,r)=>{var i=r(6887),n=r(1899),o=r(7046),s=r(249),a=r(8929),c=r(3489),d=r(9290),u=r(2029),A=r(1887),h=r(8694),l=r(3794),p=r(3091),g=r(4649),f=r(9813),E=r(8780),I=f("toStringTag"),m=n.Error,_=[].push,C=function(e,t){var r,i=arguments.length>2?arguments[2]:void 0,n=o(v,this);a?r=a(new m,n?s(this):v):(r=n?this:d(v),u(r,I,"Error")),void 0!==t&&u(r,"message",g(t)),E&&u(r,"stack",h(r.stack,1)),l(r,i);var c=[];return p(e,_,{that:c}),u(r,"errors",c),r};a?a(C,m):c(C,m,{name:!0});var v=C.prototype=d(m.prototype,{constructor:A(1,C),message:A(1,""),name:A(1,"AggregateError")});i({global:!0},{AggregateError:C})},6274:(e,t,r)=>{var i=r(4529),n=r(8479),o=r(2077),s=r(5402),a=r(5988).f,c=r(7771),d=r(2529),u=r(5746),A="Array Iterator",h=s.set,l=s.getterFor(A);e.exports=c(Array,"Array",(function(e,t){h(this,{type:A,target:i(e),index:0,kind:t})}),(function(){var e=l(this),t=e.target,r=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:i,done:!1}:"values"==r?{value:t[i],done:!1}:{value:[i,t[i]],done:!1}}),"values");var p=o.Arguments=o.Array;if(n("keys"),n("values"),n("entries"),!d&&u&&"values"!==p.name)try{a(p,"name",{value:"values"})}catch(e){}},6450:(e,t,r)=>{var i=r(6887),n=r(5746),o=r(5988).f;i({target:"Object",stat:!0,forced:Object.defineProperty!==o,sham:!n},{defineProperty:o})},5967:()=>{},4560:(e,t,r)=>{var i=r(6887),n=r(8834),o=r(4883),s=r(9520),a=r(2),c=r(3091);i({target:"Promise",stat:!0},{allSettled:function(e){var t=this,r=s.f(t),i=r.resolve,d=r.reject,u=a((function(){var r=o(t.resolve),s=[],a=0,d=1;c(e,(function(e){var o=a++,c=!1;d++,n(r,t,e).then((function(e){c||(c=!0,s[o]={status:"fulfilled",value:e},--d||i(s))}),(function(e){c||(c=!0,s[o]={status:"rejected",reason:e},--d||i(s))}))})),--d||i(s)}));return u.error&&d(u.value),r.promise}})},7206:(e,t,r)=>{var i=r(6887),n=r(4883),o=r(626),s=r(8834),a=r(9520),c=r(2),d=r(3091),u="No one promise resolved";i({target:"Promise",stat:!0},{any:function(e){var t=this,r=o("AggregateError"),i=a.f(t),A=i.resolve,h=i.reject,l=c((function(){var i=n(t.resolve),o=[],a=0,c=1,l=!1;d(e,(function(e){var n=a++,d=!1;c++,s(i,t,e).then((function(e){d||l||(l=!0,A(e))}),(function(e){d||l||(d=!0,o[n]=e,--c||h(new r(o,u)))}))})),--c||h(new r(o,u))}));return l.error&&h(l.value),i.promise}})},4349:(e,t,r)=>{var i=r(6887),n=r(2529),o=r(9297),s=r(5981),a=r(626),c=r(7475),d=r(487),u=r(6584),A=r(9754);if(i({target:"Promise",proto:!0,real:!0,forced:!!o&&s((function(){o.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=d(this,a("Promise")),r=c(e);return this.then(r?function(r){return u(t,e()).then((function(){return r}))}:e,r?function(r){return u(t,e()).then((function(){throw r}))}:e)}}),!n&&c(o)){var h=a("Promise").prototype.finally;o.prototype.finally!==h&&A(o.prototype,"finally",h,{unsafe:!0})}},8881:(e,t,r)=>{var i,n,o,s,a=r(6887),c=r(2529),d=r(1899),u=r(626),A=r(8834),h=r(9297),l=r(9754),p=r(7524),g=r(8929),f=r(904),E=r(4431),I=r(4883),m=r(7475),_=r(941),C=r(5743),v=r(1302),S=r(3091),y=r(1385),R=r(487),T=r(2941).set,w=r(6132),b=r(6584),O=r(4845),N=r(9520),D=r(2),L=r(8397),k=r(5402),P=r(7252),B=r(9813),M=r(3321),U=r(6049),Q=r(3385),x=B("species"),F="Promise",V=k.getterFor(F),j=k.set,G=k.getterFor(F),K=h&&h.prototype,H=h,Y=K,W=d.TypeError,J=d.document,q=d.process,z=N.f,X=z,Z=!!(J&&J.createEvent&&d.dispatchEvent),$=m(d.PromiseRejectionEvent),ee="unhandledrejection",te=!1,re=P(F,(function(){var e=v(H),t=e!==String(H);if(!t&&66===Q)return!0;if(c&&!Y.finally)return!0;if(Q>=51&&/native code/.test(e))return!1;var r=new H((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};return(r.constructor={})[x]=i,!(te=r.then((function(){}))instanceof i)||!t&&M&&!$})),ie=re||!y((function(e){H.all(e).catch((function(){}))})),ne=function(e){var t;return!(!_(e)||!m(t=e.then))&&t},oe=function(e,t){var r,i,n,o=t.value,s=1==t.state,a=s?e.ok:e.fail,c=e.resolve,d=e.reject,u=e.domain;try{a?(s||(2===t.rejection&&ue(t),t.rejection=1),!0===a?r=o:(u&&u.enter(),r=a(o),u&&(u.exit(),n=!0)),r===e.promise?d(W("Promise-chain cycle")):(i=ne(r))?A(i,r,c,d):c(r)):d(o)}catch(e){u&&!n&&u.exit(),d(e)}},se=function(e,t){e.notified||(e.notified=!0,w((function(){for(var r,i=e.reactions;r=i.get();)oe(r,e);e.notified=!1,t&&!e.rejection&&ce(e)})))},ae=function(e,t,r){var i,n;Z?((i=J.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),d.dispatchEvent(i)):i={promise:t,reason:r},!$&&(n=d["on"+e])?n(i):e===ee&&O("Unhandled promise rejection",r)},ce=function(e){A(T,d,(function(){var t,r=e.facade,i=e.value;if(de(e)&&(t=D((function(){U?q.emit("unhandledRejection",i,r):ae(ee,r,i)})),e.rejection=U||de(e)?2:1,t.error))throw t.value}))},de=function(e){return 1!==e.rejection&&!e.parent},ue=function(e){A(T,d,(function(){var t=e.facade;U?q.emit("rejectionHandled",t):ae("rejectionhandled",t,e.value)}))},Ae=function(e,t,r){return function(i){e(t,i,r)}},he=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,se(e,!0))},le=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw W("Promise can't be resolved itself");var i=ne(t);i?w((function(){var r={done:!1};try{A(i,t,Ae(le,r,e),Ae(he,r,e))}catch(t){he(r,t,e)}})):(e.value=t,e.state=1,se(e,!1))}catch(t){he({done:!1},t,e)}}};if(re&&(Y=(H=function(e){C(this,Y),I(e),A(i,this);var t=V(this);try{e(Ae(le,t),Ae(he,t))}catch(e){he(t,e)}}).prototype,(i=function(e){j(this,{type:F,done:!1,notified:!1,parent:!1,reactions:new L,rejection:!1,state:0,value:void 0})}).prototype=p(Y,{then:function(e,t){var r=G(this),i=z(R(this,H));return r.parent=!0,i.ok=!m(e)||e,i.fail=m(t)&&t,i.domain=U?q.domain:void 0,0==r.state?r.reactions.add(i):w((function(){oe(i,r)})),i.promise},catch:function(e){return this.then(void 0,e)}}),n=function(){var e=new i,t=V(e);this.promise=e,this.resolve=Ae(le,t),this.reject=Ae(he,t)},N.f=z=function(e){return e===H||e===o?new n(e):X(e)},!c&&m(h)&&K!==Object.prototype)){s=K.then,te||(l(K,"then",(function(e,t){var r=this;return new H((function(e,t){A(s,r,e,t)})).then(e,t)}),{unsafe:!0}),l(K,"catch",Y.catch,{unsafe:!0}));try{delete K.constructor}catch(e){}g&&g(K,Y)}a({global:!0,wrap:!0,forced:re},{Promise:H}),f(H,F,!1,!0),E(F),o=u(F),a({target:F,stat:!0,forced:re},{reject:function(e){var t=z(this);return A(t.reject,void 0,e),t.promise}}),a({target:F,stat:!0,forced:c||re},{resolve:function(e){return b(c&&this===o?H:this,e)}}),a({target:F,stat:!0,forced:ie},{all:function(e){var t=this,r=z(t),i=r.resolve,n=r.reject,o=D((function(){var r=I(t.resolve),o=[],s=0,a=1;S(e,(function(e){var c=s++,d=!1;a++,A(r,t,e).then((function(e){d||(d=!0,o[c]=e,--a||i(o))}),n)})),--a||i(o)}));return o.error&&n(o.value),r.promise},race:function(e){var t=this,r=z(t),i=r.reject,n=D((function(){var n=I(t.resolve);S(e,(function(e){A(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}})},7971:(e,t,r)=>{var i=r(4620).charAt,n=r(5803),o=r(5402),s=r(7771),a="String Iterator",c=o.set,d=o.getterFor(a);s(String,"String",(function(e){c(this,{type:a,string:n(e),index:0})}),(function(){var e,t=d(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=i(r,n),t.index+=e.length,{value:e,done:!1})}))},7634:(e,t,r)=>{r(6274);var i=r(3281),n=r(1899),o=r(9697),s=r(2029),a=r(2077),c=r(9813)("toStringTag");for(var d in i){var u=n[d],A=u&&u.prototype;A&&o(A)!==c&&s(A,c,d),a[d]=a.Array}},1910:(e,t,r)=>{var i=r(8171);e.exports=i},7460:(e,t,r)=>{var i=r(2956);r(7634),e.exports=i},9662:(e,t,r)=>{var i=r(7854),n=r(614),o=r(6330),s=i.TypeError;e.exports=function(e){if(n(e))return e;throw s(o(e)+" is not a function")}},6077:(e,t,r)=>{var i=r(7854),n=r(614),o=i.String,s=i.TypeError;e.exports=function(e){if("object"==typeof e||n(e))return e;throw s("Can't set "+o(e)+" as a prototype")}},1223:(e,t,r)=>{var i=r(5112),n=r(30),o=r(3070),s=i("unscopables"),a=Array.prototype;null==a[s]&&o.f(a,s,{configurable:!0,value:n(null)}),e.exports=function(e){a[s][e]=!0}},9670:(e,t,r)=>{var i=r(7854),n=r(111),o=i.String,s=i.TypeError;e.exports=function(e){if(n(e))return e;throw s(o(e)+" is not an object")}},1318:(e,t,r)=>{var i=r(5656),n=r(1400),o=r(6244),s=function(e){return function(t,r,s){var a,c=i(t),d=o(c),u=n(s,d);if(e&&r!=r){for(;d>u;)if((a=c[u++])!=a)return!0}else for(;d>u;u++)if((e||u in c)&&c[u]===r)return e||u||0;return!e&&-1}};e.exports={includes:s(!0),indexOf:s(!1)}},4326:(e,t,r)=>{var i=r(1702),n=i({}.toString),o=i("".slice);e.exports=function(e){return o(n(e),8,-1)}},648:(e,t,r)=>{var i=r(7854),n=r(1694),o=r(614),s=r(4326),a=r(5112)("toStringTag"),c=i.Object,d="Arguments"==s(function(){return arguments}());e.exports=n?s:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=c(e),a))?r:d?s(t):"Object"==(i=s(t))&&o(t.callee)?"Arguments":i}},7741:(e,t,r)=>{var i=r(1702)("".replace),n=String(Error("zxcasd").stack),o=/\n\s*at [^:]*:[^\n]*/,s=o.test(n);e.exports=function(e,t){if(s&&"string"==typeof e)for(;t--;)e=i(e,o,"");return e}},9920:(e,t,r)=>{var i=r(2597),n=r(3887),o=r(1236),s=r(3070);e.exports=function(e,t,r){for(var a=n(t),c=s.f,d=o.f,u=0;u<a.length;u++){var A=a[u];i(e,A)||r&&i(r,A)||c(e,A,d(t,A))}}},8544:(e,t,r)=>{var i=r(7293);e.exports=!i((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype}))},4994:(e,t,r)=>{var i=r(3383).IteratorPrototype,n=r(30),o=r(9114),s=r(8003),a=r(7497),c=function(){return this};e.exports=function(e,t,r,d){var u=t+" Iterator";return e.prototype=n(i,{next:o(+!d,r)}),s(e,u,!1,!0),a[u]=c,e}},8880:(e,t,r)=>{var i=r(9781),n=r(3070),o=r(9114);e.exports=i?function(e,t,r){return n.f(e,t,o(1,r))}:function(e,t,r){return e[t]=r,e}},9114:e=>{e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},654:(e,t,r)=>{var i=r(2109),n=r(6916),o=r(1913),s=r(6530),a=r(614),c=r(4994),d=r(9518),u=r(7674),A=r(8003),h=r(8880),l=r(1320),p=r(5112),g=r(7497),f=r(3383),E=s.PROPER,I=s.CONFIGURABLE,m=f.IteratorPrototype,_=f.BUGGY_SAFARI_ITERATORS,C=p("iterator"),v="keys",S="values",y="entries",R=function(){return this};e.exports=function(e,t,r,s,p,f,T){c(r,t,s);var w,b,O,N=function(e){if(e===p&&B)return B;if(!_&&e in k)return k[e];switch(e){case v:case S:case y:return function(){return new r(this,e)}}return function(){return new r(this)}},D=t+" Iterator",L=!1,k=e.prototype,P=k[C]||k["@@iterator"]||p&&k[p],B=!_&&P||N(p),M="Array"==t&&k.entries||P;if(M&&(w=d(M.call(new e)))!==Object.prototype&&w.next&&(o||d(w)===m||(u?u(w,m):a(w[C])||l(w,C,R)),A(w,D,!0,!0),o&&(g[D]=R)),E&&p==S&&P&&P.name!==S&&(!o&&I?h(k,"name",S):(L=!0,B=function(){return n(P,this)})),p)if(b={values:N(S),keys:f?B:N(v),entries:N(y)},T)for(O in b)(_||L||!(O in k))&&l(k,O,b[O]);else i({target:t,proto:!0,forced:_||L},b);return o&&!T||k[C]===B||l(k,C,B,{name:p}),g[t]=B,b}},9781:(e,t,r)=>{var i=r(7293);e.exports=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},317:(e,t,r)=>{var i=r(7854),n=r(111),o=i.document,s=n(o)&&n(o.createElement);e.exports=function(e){return s?o.createElement(e):{}}},8324:e=>{e.exports={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}},8509:(e,t,r)=>{var i=r(317)("span").classList,n=i&&i.constructor&&i.constructor.prototype;e.exports=n===Object.prototype?void 0:n},8113:(e,t,r)=>{var i=r(5005);e.exports=i("navigator","userAgent")||""},7392:(e,t,r)=>{var i,n,o=r(7854),s=r(8113),a=o.process,c=o.Deno,d=a&&a.versions||c&&c.version,u=d&&d.v8;u&&(n=(i=u.split("."))[0]>0&&i[0]<4?1:+(i[0]+i[1])),!n&&s&&(!(i=s.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=s.match(/Chrome\/(\d+)/))&&(n=+i[1]),e.exports=n},748:e=>{e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2914:(e,t,r)=>{var i=r(7293),n=r(9114);e.exports=!i((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",n(1,7)),7!==e.stack)}))},2109:(e,t,r)=>{var i=r(7854),n=r(1236).f,o=r(8880),s=r(1320),a=r(3505),c=r(9920),d=r(4705);e.exports=function(e,t){var r,u,A,h,l,p=e.target,g=e.global,f=e.stat;if(r=g?i:f?i[p]||a(p,{}):(i[p]||{}).prototype)for(u in t){if(h=t[u],A=e.noTargetGet?(l=n(r,u))&&l.value:r[u],!d(g?u:p+(f?".":"#")+u,e.forced)&&void 0!==A){if(typeof h==typeof A)continue;c(h,A)}(e.sham||A&&A.sham)&&o(h,"sham",!0),s(r,u,h,e)}}},7293:e=>{e.exports=function(e){try{return!!e()}catch(e){return!0}}},2104:(e,t,r)=>{var i=r(4374),n=Function.prototype,o=n.apply,s=n.call;e.exports="object"==typeof Reflect&&Reflect.apply||(i?s.bind(o):function(){return s.apply(o,arguments)})},4374:(e,t,r)=>{var i=r(7293);e.exports=!i((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")}))},6916:(e,t,r)=>{var i=r(4374),n=Function.prototype.call;e.exports=i?n.bind(n):function(){return n.apply(n,arguments)}},6530:(e,t,r)=>{var i=r(9781),n=r(2597),o=Function.prototype,s=i&&Object.getOwnPropertyDescriptor,a=n(o,"name"),c=a&&"something"===function(){}.name,d=a&&(!i||i&&s(o,"name").configurable);e.exports={EXISTS:a,PROPER:c,CONFIGURABLE:d}},1702:(e,t,r)=>{var i=r(4374),n=Function.prototype,o=n.bind,s=n.call,a=i&&o.bind(s,s);e.exports=i?function(e){return e&&a(e)}:function(e){return e&&function(){return s.apply(e,arguments)}}},5005:(e,t,r)=>{var i=r(7854),n=r(614),o=function(e){return n(e)?e:void 0};e.exports=function(e,t){return arguments.length<2?o(i[e]):i[e]&&i[e][t]}},8173:(e,t,r)=>{var i=r(9662);e.exports=function(e,t){var r=e[t];return null==r?void 0:i(r)}},7854:(e,t,r)=>{var i=function(e){return e&&e.Math==Math&&e};e.exports=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof r.g&&r.g)||function(){return this}()||Function("return this")()},2597:(e,t,r)=>{var i=r(1702),n=r(7908),o=i({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(n(e),t)}},3501:e=>{e.exports={}},490:(e,t,r)=>{var i=r(5005);e.exports=i("document","documentElement")},4664:(e,t,r)=>{var i=r(9781),n=r(7293),o=r(317);e.exports=!i&&!n((function(){return 7!=Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a}))},8361:(e,t,r)=>{var i=r(7854),n=r(1702),o=r(7293),s=r(4326),a=i.Object,c=n("".split);e.exports=o((function(){return!a("z").propertyIsEnumerable(0)}))?function(e){return"String"==s(e)?c(e,""):a(e)}:a},9587:(e,t,r)=>{var i=r(614),n=r(111),o=r(7674);e.exports=function(e,t,r){var s,a;return o&&i(s=t.constructor)&&s!==r&&n(a=s.prototype)&&a!==r.prototype&&o(e,a),e}},2788:(e,t,r)=>{var i=r(1702),n=r(614),o=r(5465),s=i(Function.toString);n(o.inspectSource)||(o.inspectSource=function(e){return s(e)}),e.exports=o.inspectSource},8340:(e,t,r)=>{var i=r(111),n=r(8880);e.exports=function(e,t){i(t)&&"cause"in t&&n(e,"cause",t.cause)}},9909:(e,t,r)=>{var i,n,o,s=r(8536),a=r(7854),c=r(1702),d=r(111),u=r(8880),A=r(2597),h=r(5465),l=r(6200),p=r(3501),g="Object already initialized",f=a.TypeError,E=a.WeakMap;if(s||h.state){var I=h.state||(h.state=new E),m=c(I.get),_=c(I.has),C=c(I.set);i=function(e,t){if(_(I,e))throw new f(g);return t.facade=e,C(I,e,t),t},n=function(e){return m(I,e)||{}},o=function(e){return _(I,e)}}else{var v=l("state");p[v]=!0,i=function(e,t){if(A(e,v))throw new f(g);return t.facade=e,u(e,v,t),t},n=function(e){return A(e,v)?e[v]:{}},o=function(e){return A(e,v)}}e.exports={set:i,get:n,has:o,enforce:function(e){return o(e)?n(e):i(e,{})},getterFor:function(e){return function(t){var r;if(!d(t)||(r=n(t)).type!==e)throw f("Incompatible receiver, "+e+" required");return r}}}},614:e=>{e.exports=function(e){return"function"==typeof e}},4705:(e,t,r)=>{var i=r(7293),n=r(614),o=/#|\.prototype\./,s=function(e,t){var r=c[a(e)];return r==u||r!=d&&(n(t)?i(t):!!t)},a=s.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=s.data={},d=s.NATIVE="N",u=s.POLYFILL="P";e.exports=s},111:(e,t,r)=>{var i=r(614);e.exports=function(e){return"object"==typeof e?null!==e:i(e)}},1913:e=>{e.exports=!1},2190:(e,t,r)=>{var i=r(7854),n=r(5005),o=r(614),s=r(7976),a=r(3307),c=i.Object;e.exports=a?function(e){return"symbol"==typeof e}:function(e){var t=n("Symbol");return o(t)&&s(t.prototype,c(e))}},3383:(e,t,r)=>{var i,n,o,s=r(7293),a=r(614),c=r(30),d=r(9518),u=r(1320),A=r(5112),h=r(1913),l=A("iterator"),p=!1;[].keys&&("next"in(o=[].keys())?(n=d(d(o)))!==Object.prototype&&(i=n):p=!0),null==i||s((function(){var e={};return i[l].call(e)!==e}))?i={}:h&&(i=c(i)),a(i[l])||u(i,l,(function(){return this})),e.exports={IteratorPrototype:i,BUGGY_SAFARI_ITERATORS:p}},7497:e=>{e.exports={}},6244:(e,t,r)=>{var i=r(7466);e.exports=function(e){return i(e.length)}},133:(e,t,r)=>{var i=r(7392),n=r(7293);e.exports=!!Object.getOwnPropertySymbols&&!n((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&i&&i<41}))},8536:(e,t,r)=>{var i=r(7854),n=r(614),o=r(2788),s=i.WeakMap;e.exports=n(s)&&/native code/.test(o(s))},6277:(e,t,r)=>{var i=r(1340);e.exports=function(e,t){return void 0===e?arguments.length<2?"":t:i(e)}},30:(e,t,r)=>{var i,n=r(9670),o=r(6048),s=r(748),a=r(3501),c=r(490),d=r(317),u=r(6200)("IE_PROTO"),A=function(){},h=function(e){return"<script>"+e+"<\/script>"},l=function(e){e.write(h("")),e.close();var t=e.parentWindow.Object;return e=null,t},p=function(){try{i=new ActiveXObject("htmlfile")}catch(e){}var e,t;p="undefined"!=typeof document?document.domain&&i?l(i):((t=d("iframe")).style.display="none",c.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(h("document.F=Object")),e.close(),e.F):l(i);for(var r=s.length;r--;)delete p.prototype[s[r]];return p()};a[u]=!0,e.exports=Object.create||function(e,t){var r;return null!==e?(A.prototype=n(e),r=new A,A.prototype=null,r[u]=e):r=p(),void 0===t?r:o.f(r,t)}},6048:(e,t,r)=>{var i=r(9781),n=r(3353),o=r(3070),s=r(9670),a=r(5656),c=r(1956);t.f=i&&!n?Object.defineProperties:function(e,t){s(e);for(var r,i=a(t),n=c(t),d=n.length,u=0;d>u;)o.f(e,r=n[u++],i[r]);return e}},3070:(e,t,r)=>{var i=r(7854),n=r(9781),o=r(4664),s=r(3353),a=r(9670),c=r(4948),d=i.TypeError,u=Object.defineProperty,A=Object.getOwnPropertyDescriptor;t.f=n?s?function(e,t,r){if(a(e),t=c(t),a(r),"function"==typeof e&&"prototype"===t&&"value"in r&&"writable"in r&&!r.writable){var i=A(e,t);i&&i.writable&&(e[t]=r.value,r={configurable:"configurable"in r?r.configurable:i.configurable,enumerable:"enumerable"in r?r.enumerable:i.enumerable,writable:!1})}return u(e,t,r)}:u:function(e,t,r){if(a(e),t=c(t),a(r),o)try{return u(e,t,r)}catch(e){}if("get"in r||"set"in r)throw d("Accessors not supported");return"value"in r&&(e[t]=r.value),e}},1236:(e,t,r)=>{var i=r(9781),n=r(6916),o=r(5296),s=r(9114),a=r(5656),c=r(4948),d=r(2597),u=r(4664),A=Object.getOwnPropertyDescriptor;t.f=i?A:function(e,t){if(e=a(e),t=c(t),u)try{return A(e,t)}catch(e){}if(d(e,t))return s(!n(o.f,e,t),e[t])}},8006:(e,t,r)=>{var i=r(6324),n=r(748).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return i(e,n)}},5181:(e,t)=>{t.f=Object.getOwnPropertySymbols},9518:(e,t,r)=>{var i=r(7854),n=r(2597),o=r(614),s=r(7908),a=r(6200),c=r(8544),d=a("IE_PROTO"),u=i.Object,A=u.prototype;e.exports=c?u.getPrototypeOf:function(e){var t=s(e);if(n(t,d))return t[d];var r=t.constructor;return o(r)&&t instanceof r?r.prototype:t instanceof u?A:null}},7976:(e,t,r)=>{var i=r(1702);e.exports=i({}.isPrototypeOf)},6324:(e,t,r)=>{var i=r(1702),n=r(2597),o=r(5656),s=r(1318).indexOf,a=r(3501),c=i([].push);e.exports=function(e,t){var r,i=o(e),d=0,u=[];for(r in i)!n(a,r)&&n(i,r)&&c(u,r);for(;t.length>d;)n(i,r=t[d++])&&(~s(u,r)||c(u,r));return u}},1956:(e,t,r)=>{var i=r(6324),n=r(748);e.exports=Object.keys||function(e){return i(e,n)}},5296:(e,t)=>{var r={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,n=i&&!r.call({1:2},1);t.f=n?function(e){var t=i(this,e);return!!t&&t.enumerable}:r},7674:(e,t,r)=>{var i=r(1702),n=r(9670),o=r(6077);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=i(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return n(r),o(i),t?e(r,i):r.__proto__=i,r}}():void 0)},2140:(e,t,r)=>{var i=r(7854),n=r(6916),o=r(614),s=r(111),a=i.TypeError;e.exports=function(e,t){var r,i;if("string"===t&&o(r=e.toString)&&!s(i=n(r,e)))return i;if(o(r=e.valueOf)&&!s(i=n(r,e)))return i;if("string"!==t&&o(r=e.toString)&&!s(i=n(r,e)))return i;throw a("Can't convert object to primitive value")}},3887:(e,t,r)=>{var i=r(5005),n=r(1702),o=r(8006),s=r(5181),a=r(9670),c=n([].concat);e.exports=i("Reflect","ownKeys")||function(e){var t=o.f(a(e)),r=s.f;return r?c(t,r(e)):t}},1320:(e,t,r)=>{var i=r(7854),n=r(614),o=r(2597),s=r(8880),a=r(3505),c=r(2788),d=r(9909),u=r(6530).CONFIGURABLE,A=d.get,h=d.enforce,l=String(String).split("String");(e.exports=function(e,t,r,c){var d,A=!!c&&!!c.unsafe,p=!!c&&!!c.enumerable,g=!!c&&!!c.noTargetGet,f=c&&void 0!==c.name?c.name:t;n(r)&&("Symbol("===String(f).slice(0,7)&&(f="["+String(f).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!o(r,"name")||u&&r.name!==f)&&s(r,"name",f),(d=h(r)).source||(d.source=l.join("string"==typeof f?f:""))),e!==i?(A?!g&&e[t]&&(p=!0):delete e[t],p?e[t]=r:s(e,t,r)):p?e[t]=r:a(t,r)})(Function.prototype,"toString",(function(){return n(this)&&A(this).source||c(this)}))},2261:(e,t,r)=>{var i,n,o=r(6916),s=r(1702),a=r(1340),c=r(7066),d=r(2999),u=r(2309),A=r(30),h=r(9909).get,l=r(9441),p=r(7168),g=u("native-string-replace",String.prototype.replace),f=RegExp.prototype.exec,E=f,I=s("".charAt),m=s("".indexOf),_=s("".replace),C=s("".slice),v=(n=/b*/g,o(f,i=/a/,"a"),o(f,n,"a"),0!==i.lastIndex||0!==n.lastIndex),S=d.BROKEN_CARET,y=void 0!==/()??/.exec("")[1];(v||y||S||l||p)&&(E=function(e){var t,r,i,n,s,d,u,l=this,p=h(l),R=a(e),T=p.raw;if(T)return T.lastIndex=l.lastIndex,t=o(E,T,R),l.lastIndex=T.lastIndex,t;var w=p.groups,b=S&&l.sticky,O=o(c,l),N=l.source,D=0,L=R;if(b&&(O=_(O,"y",""),-1===m(O,"g")&&(O+="g"),L=C(R,l.lastIndex),l.lastIndex>0&&(!l.multiline||l.multiline&&"\n"!==I(R,l.lastIndex-1))&&(N="(?: "+N+")",L=" "+L,D++),r=new RegExp("^(?:"+N+")",O)),y&&(r=new RegExp("^"+N+"$(?!\\s)",O)),v&&(i=l.lastIndex),n=o(f,b?r:l,L),b?n?(n.input=C(n.input,D),n[0]=C(n[0],D),n.index=l.lastIndex,l.lastIndex+=n[0].length):l.lastIndex=0:v&&n&&(l.lastIndex=l.global?n.index+n[0].length:i),y&&n&&n.length>1&&o(g,n[0],r,(function(){for(s=1;s<arguments.length-2;s++)void 0===arguments[s]&&(n[s]=void 0)})),n&&w)for(n.groups=d=A(null),s=0;s<w.length;s++)d[(u=w[s])[0]]=n[u[1]];return n}),e.exports=E},7066:(e,t,r)=>{var i=r(9670);e.exports=function(){var e=i(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t}},2999:(e,t,r)=>{var i=r(7293),n=r(7854).RegExp,o=i((function(){var e=n("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),s=o||i((function(){return!n("a","y").sticky})),a=o||i((function(){var e=n("^r","gy");return e.lastIndex=2,null!=e.exec("str")}));e.exports={BROKEN_CARET:a,MISSED_STICKY:s,UNSUPPORTED_Y:o}},9441:(e,t,r)=>{var i=r(7293),n=r(7854).RegExp;e.exports=i((function(){var e=n(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)}))},7168:(e,t,r)=>{var i=r(7293),n=r(7854).RegExp;e.exports=i((function(){var e=n("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")}))},4488:(e,t,r)=>{var i=r(7854).TypeError;e.exports=function(e){if(null==e)throw i("Can't call method on "+e);return e}},3505:(e,t,r)=>{var i=r(7854),n=Object.defineProperty;e.exports=function(e,t){try{n(i,e,{value:t,configurable:!0,writable:!0})}catch(r){i[e]=t}return t}},8003:(e,t,r)=>{var i=r(3070).f,n=r(2597),o=r(5112)("toStringTag");e.exports=function(e,t,r){e&&!r&&(e=e.prototype),e&&!n(e,o)&&i(e,o,{configurable:!0,value:t})}},6200:(e,t,r)=>{var i=r(2309),n=r(9711),o=i("keys");e.exports=function(e){return o[e]||(o[e]=n(e))}},5465:(e,t,r)=>{var i=r(7854),n=r(3505),o="__core-js_shared__",s=i[o]||n(o,{});e.exports=s},2309:(e,t,r)=>{var i=r(1913),n=r(5465);(e.exports=function(e,t){return n[e]||(n[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.20.3",mode:i?"pure":"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.20.3/LICENSE",source:"https://github.com/zloirock/core-js"})},1400:(e,t,r)=>{var i=r(9303),n=Math.max,o=Math.min;e.exports=function(e,t){var r=i(e);return r<0?n(r+t,0):o(r,t)}},5656:(e,t,r)=>{var i=r(8361),n=r(4488);e.exports=function(e){return i(n(e))}},9303:e=>{var t=Math.ceil,r=Math.floor;e.exports=function(e){var i=+e;return i!=i||0===i?0:(i>0?r:t)(i)}},7466:(e,t,r)=>{var i=r(9303),n=Math.min;e.exports=function(e){return e>0?n(i(e),9007199254740991):0}},7908:(e,t,r)=>{var i=r(7854),n=r(4488),o=i.Object;e.exports=function(e){return o(n(e))}},7593:(e,t,r)=>{var i=r(7854),n=r(6916),o=r(111),s=r(2190),a=r(8173),c=r(2140),d=r(5112),u=i.TypeError,A=d("toPrimitive");e.exports=function(e,t){if(!o(e)||s(e))return e;var r,i=a(e,A);if(i){if(void 0===t&&(t="default"),r=n(i,e,t),!o(r)||s(r))return r;throw u("Can't convert object to primitive value")}return void 0===t&&(t="number"),c(e,t)}},4948:(e,t,r)=>{var i=r(7593),n=r(2190);e.exports=function(e){var t=i(e,"string");return n(t)?t:t+""}},1694:(e,t,r)=>{var i={};i[r(5112)("toStringTag")]="z",e.exports="[object z]"===String(i)},1340:(e,t,r)=>{var i=r(7854),n=r(648),o=i.String;e.exports=function(e){if("Symbol"===n(e))throw TypeError("Cannot convert a Symbol value to a string");return o(e)}},6330:(e,t,r)=>{var i=r(7854).String;e.exports=function(e){try{return i(e)}catch(e){return"Object"}}},9711:(e,t,r)=>{var i=r(1702),n=0,o=Math.random(),s=i(1..toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++n+o,36)}},3307:(e,t,r)=>{var i=r(133);e.exports=i&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3353:(e,t,r)=>{var i=r(9781),n=r(7293);e.exports=i&&n((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},5112:(e,t,r)=>{var i=r(7854),n=r(2309),o=r(2597),s=r(9711),a=r(133),c=r(3307),d=n("wks"),u=i.Symbol,A=u&&u.for,h=c?u:u&&u.withoutSetter||s;e.exports=function(e){if(!o(d,e)||!a&&"string"!=typeof d[e]){var t="Symbol."+e;a&&o(u,e)?d[e]=u[e]:d[e]=c&&A?A(t):h(t)}return d[e]}},9191:(e,t,r)=>{var i=r(5005),n=r(2597),o=r(8880),s=r(7976),a=r(7674),c=r(9920),d=r(9587),u=r(6277),A=r(8340),h=r(7741),l=r(2914),p=r(1913);e.exports=function(e,t,r,g){var f=g?2:1,E=e.split("."),I=E[E.length-1],m=i.apply(null,E);if(m){var _=m.prototype;if(!p&&n(_,"cause")&&delete _.cause,!r)return m;var C=i("Error"),v=t((function(e,t){var r=u(g?t:e,void 0),i=g?new m(e):new m;return void 0!==r&&o(i,"message",r),l&&o(i,"stack",h(i.stack,2)),this&&s(_,this)&&d(i,this,v),arguments.length>f&&A(i,arguments[f]),i}));if(v.prototype=_,"Error"!==I&&(a?a(v,C):c(v,C,{name:!0})),c(v,m),!p)try{_.name!==I&&o(_,"name",I),_.constructor=v}catch(e){}return v}}},6992:(e,t,r)=>{var i=r(5656),n=r(1223),o=r(7497),s=r(9909),a=r(3070).f,c=r(654),d=r(1913),u=r(9781),A="Array Iterator",h=s.set,l=s.getterFor(A);e.exports=c(Array,"Array",(function(e,t){h(this,{type:A,target:i(e),index:0,kind:t})}),(function(){var e=l(this),t=e.target,r=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:i,done:!1}:"values"==r?{value:t[i],done:!1}:{value:[i,t[i]],done:!1}}),"values");var p=o.Arguments=o.Array;if(n("keys"),n("values"),n("entries"),!d&&u&&"values"!==p.name)try{a(p,"name",{value:"values"})}catch(e){}},1703:(e,t,r)=>{var i=r(2109),n=r(7854),o=r(2104),s=r(9191),a=n.WebAssembly,c=7!==Error("e",{cause:7}).cause,d=function(e,t){var r={};r[e]=s(e,t,c),i({global:!0,forced:c},r)},u=function(e,t){if(a&&a[e]){var r={};r[e]=s("WebAssembly."+e,t,c),i({target:"WebAssembly",stat:!0,forced:c},r)}};d("Error",(function(e){return function(t){return o(e,this,arguments)}})),d("EvalError",(function(e){return function(t){return o(e,this,arguments)}})),d("RangeError",(function(e){return function(t){return o(e,this,arguments)}})),d("ReferenceError",(function(e){return function(t){return o(e,this,arguments)}})),d("SyntaxError",(function(e){return function(t){return o(e,this,arguments)}})),d("TypeError",(function(e){return function(t){return o(e,this,arguments)}})),d("URIError",(function(e){return function(t){return o(e,this,arguments)}})),u("CompileError",(function(e){return function(t){return o(e,this,arguments)}})),u("LinkError",(function(e){return function(t){return o(e,this,arguments)}})),u("RuntimeError",(function(e){return function(t){return o(e,this,arguments)}}))},4916:(e,t,r)=>{var i=r(2109),n=r(2261);i({target:"RegExp",proto:!0,forced:/./.exec!==n},{exec:n})},3948:(e,t,r)=>{var i=r(7854),n=r(8324),o=r(8509),s=r(6992),a=r(8880),c=r(5112),d=c("iterator"),u=c("toStringTag"),A=s.values,h=function(e,t){if(e){if(e[d]!==A)try{a(e,d,A)}catch(t){e[d]=A}if(e[u]||a(e,u,t),n[t])for(var r in s)if(e[r]!==s[r])try{a(e,r,s[r])}catch(t){e[r]=s[r]}}};for(var l in n)h(i[l]&&i[l].prototype,l);h(o,"DOMTokenList")}},t={};function r(i){var n=t[i];if(void 0!==n)return n.exports;var o=t[i]={exports:{}};return e[i](o,o.exports,r),o.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{r.r(i),r.d(i,{AudioExtension:()=>C,AudioProcessor:()=>m,Extension:()=>_,Ticker:()=>S,VideoProcessor:()=>I,logger:()=>A,reporter:()=>p});var e=r(4341);function t(t,r,i){return r in t?e(t,r,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[r]=i,t}r(1703),r(6992),r(3948);var n=r(3476),o=r.n(n);function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:7,t=arguments.length>1?arguments[1]:void 0;const r=Math.random().toString(16).substr(2,e).toLowerCase();return r.length===e?"".concat(t).concat(r):"".concat(t).concat(r)+s(e-r.length,"")}r(4916);const a=Date.now(),c={DEBUG:0,INFO:1,WARNING:2,ERROR:3,NONE:4};function d(){const e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()}const u=e=>{for(const t in c)if(Object.prototype.hasOwnProperty.call(c,t)&&c[t]===e)return t;return"DEFAULT"},A=new class{constructor(){t(this,"logLevel",c.DEBUG),t(this,"hookLog",void 0)}debug(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[c.DEBUG].concat(t);this.log.apply(this,i)}info(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[c.INFO].concat(t);this.log.apply(this,i)}warning(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[c.WARNING].concat(t);this.log.apply(this,i)}error(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];const i=[c.ERROR].concat(t);this.log.apply(this,i)}log(){for(var e,t=arguments.length,r=new Array(t),i=0;i<t;i++)r[i]=arguments[i];if(Date.now()-a<100)return void setTimeout(()=>{this.log(...r)},Date.now()-a);const n=Math.max(0,Math.min(4,r[0]));if(r[0]=d()+" Agora-Extension [".concat(u(n),"]:"),n<this.logLevel)return;const o=d()+" %cAgora-Extension [".concat(u(n),"]:");let s=[];switch(n){case c.DEBUG:s=[o,"color: #64B5F6;"].concat(r.slice(1)),console.log.apply(console,s);break;case c.INFO:s=[o,"color: #1E88E5; font-weight: bold;"].concat(r.slice(1)),console.log.apply(console,s);break;case c.WARNING:s=[o,"color: #FB8C00; font-weight: bold;"].concat(r.slice(1)),console.warn.apply(console,s);break;case c.ERROR:s=[o,"color: #B00020; font-weight: bold;"].concat(r.slice(1)),console.error.apply(console,s)}null===(e=this.hookLog)||void 0===e||e.call(this,n,s)}};function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function l(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?h(Object(i),!0).forEach((function(r){t(e,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):h(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}const p=new class{constructor(){t(this,"apiInvokeMsgQueue",[]),t(this,"hookApiInvoke",void 0)}reportApiInvoke(e){e.timeout=e.timeout||6e4,e.reportResult=void 0===e.reportResult||e.reportResult;const t=Date.now(),r=()=>({name:e.name,apiInvokeTime:t,options:e.options});let i=!1;var n;(n=e.timeout,new(o())(e=>{window.setTimeout(e,n)})).then(()=>{i||(this.sendApiInvoke(l(l({},r()),{},{error:"API_INVOKE_TIMEOUT",success:!1})),A.debug("".concat(e.name," timeout")))});const s=new Error("".concat(e.name,": this api invoke is end"));return{onSuccess:t=>{if(i)throw s;i=!0,this.sendApiInvoke(l(l({},r()),{},{success:!0},e.reportResult&&{result:t}))},onError:e=>{if(i)throw e;i=!0,this.sendApiInvoke(l(l({},r()),{},{success:!1,error:e.toString()}))}}}sendApiInvoke(e){this.hookApiInvoke?(this.hookApiInvoke([...this.apiInvokeMsgQueue,e]),this.apiInvokeMsgQueue=[]):this.apiInvokeMsgQueue.push(e)}};function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function f(e){for(var r=1;r<arguments.length;r++){var i=null!=arguments[r]?arguments[r]:{};r%2?g(Object(i),!0).forEach((function(r){t(e,r,i[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):g(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}class E extends class{constructor(){t(this,"_events",{}),t(this,"addListener",this.on)}getListeners(e){return this._events[e]?this._events[e].map(e=>e.listener):[]}on(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!1})}once(e,t){this._events[e]||(this._events[e]=[]);const r=this._events[e];-1===this._indexOfListener(r,t)&&r.push({listener:t,once:!0})}off(e,t){if(!this._events[e])return;const r=this._events[e],i=this._indexOfListener(r,t);-1!==i&&r.splice(i,1),0===this._events[e].length&&delete this._events[e]}removeAllListeners(e){e?delete this._events[e]:this._events={}}emit(e){this._events[e]||(this._events[e]=[]);const t=this._events[e].map(e=>e);for(var r=arguments.length,i=new Array(r>1?r-1:0),n=1;n<r;n++)i[n-1]=arguments[n];for(let r=0;r<t.length;r+=1){const n=t[r];n.once&&this.off(e,n.listener),n.listener.apply(this,i||[])}}_indexOfListener(e,t){let r=e.length;for(;r--;)if(e[r].listener===t)return r;return-1}emitAsPromise(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return 0===this.getListeners(e).length?o().reject(new Error("No promise event handler.")):new(o())((t,i)=>{this.emit(e,...r,t,i)})}emitAsPromiseNoResponse(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),i=1;i<t;i++)r[i-1]=arguments[i];return 0===this.getListeners(e).length?o().resolve():new(o())((t,i)=>{this.emit(e,...r,t,i)})}}{get enabled(){return this._enabled}output(e,t){if(this.outputTrack===e)return;const r=p.reportApiInvoke({name:"".concat(this.name,".output"),options:{track:null==e?void 0:e.toString()}});this.outputTrack=e,this.destination&&this.destination.updateInput({track:e,context:t}),r.onSuccess()}constructor(){super(),t(this,"inputTrack",void 0),t(this,"outputTrack",void 0),t(this,"_enabled",!0),t(this,"_source",void 0),t(this,"ID",s(6,"")),t(this,"destination",void 0),t(this,"context",void 0),t(this,"name",void 0)}enable(){if(this._enabled)return;const e=p.reportApiInvoke({name:"".concat(this.name,".setEnabled"),options:!0});A.info("".concat(this.name,"-").concat(this.ID," enabled")),this._enabled=!0;try{var t;const r=null===(t=this.onEnableChange)||void 0===t?void 0:t.call(this,this._enabled);if(r instanceof o())return r.then(()=>{e.onSuccess()}).catch(t=>{throw e.onError(t),t});e.onSuccess()}catch(t){throw e.onError(t),t}}disable(){if(!this._enabled)return;const e=p.reportApiInvoke({name:"".concat(this.name,".setEnabled"),options:!1});A.info("".concat(this.name,"-").concat(this.ID," disabled")),this._enabled=!1;try{var t;const r=null===(t=this.onEnableChange)||void 0===t?void 0:t.call(this,this._enabled);if(r instanceof o())return r.then(()=>{e.onSuccess()}).catch(t=>{throw e.onError(t),t});e.onSuccess()}catch(t){throw e.onError(t),t}}}class I extends E{get kind(){return"video"}pipe(e){const t=p.reportApiInvoke({name:"".concat(this.name,".pipe"),options:{processor:e.name}});if(this.destination===e)return t.onSuccess(),e;if(e._source){const r=new Error("Processor ".concat(e.name," already piped, please call unpipe beforehand."));throw t.onError(r),r}return this.destination&&this.unpipe(),this.destination=e,e._source=this,this.context&&this.destination.updateInput({track:this.outputTrack,context:this.context}),t.onSuccess(),e}unpipe(){if(!this.destination)return;const e=p.reportApiInvoke({name:"".concat(this.name,".unpipe"),options:{processor:this.destination.name}});A.info("unpiping processor ".concat(this.destination.name,"-").concat(this.destination.ID));try{const t=this.destination;this.destination._source=void 0,this.destination=void 0,t.reset()}finally{e.onSuccess()}}updateInput(e){var t,r;e.context!==this.context&&(this.context=e.context,null===(t=this.onPiped)||void 0===t||t.call(this,this.context),this.destination&&this.destination.updateInput({track:this.outputTrack,context:e.context})),e.track&&this.inputTrack!==e.track&&(this.inputTrack=e.track,null===(r=this.onTrack)||void 0===r||r.call(this,e.track,this.context))}reset(){var e;this.context&&this.context.requestRevertConstraints(this),this.inputTrack=void 0,this.context=void 0,null===(e=this.onUnpiped)||void 0===e||e.call(this),this.destination&&this.destination.reset()}}class m extends E{constructor(){super(...arguments),t(this,"inputNode",void 0),t(this,"outputNode",void 0),t(this,"destination",void 0),t(this,"context",void 0)}get kind(){return"audio"}pipe(e){const t=p.reportApiInvoke({name:"".concat(this.name,".pipe"),options:{processor:e.name}});if(this.destination===e)return t.onSuccess(),e;if(e._source){const r=new Error("Processor ".concat(e.name," already piped, please call unpipe beforehand."));throw t.onError(r),r}return this.destination&&this.unpipe(),this.destination=e,e._source=this,this.context&&this.destination.updateInput({track:this.outputTrack,node:this.outputNode,context:this.context}),t.onSuccess(),e}unpipe(){if(!this.destination)return;A.info("unpiping processor ".concat(this.destination.name,"-").concat(this.destination.ID));const e=p.reportApiInvoke({name:"".concat(this.name,".unpipe"),options:{processor:this.destination.name}});try{var t;let r=this.destination;null===(t=this.outputNode)||void 0===t||t.disconnect(),this.destination._source=void 0,this.destination=void 0,r.reset()}finally{e.onSuccess()}}output(e,t){if(e instanceof MediaStreamTrack)super.output(e,t);else if(e instanceof AudioNode){if(this.outputNode===e)return;const r=p.reportApiInvoke({name:"".concat(this.name,".output"),options:f(f({},e instanceof MediaStreamTrack&&{track:e.toString()}),e instanceof AudioNode&&{audioNode:e.toString()})});this.outputNode=e,this.destination&&this.destination.updateInput({node:e,context:t}),r.onSuccess()}}updateInput(e){var t,r,i;e.context!==this.context&&(this.context=e.context,null===(t=this.onPiped)||void 0===t||t.call(this,this.context),this.destination&&this.destination.updateInput({track:this.outputTrack,node:this.outputNode,context:e.context})),e.track&&this.inputTrack!==e.track&&(this.inputTrack=e.track,null===(r=this.onTrack)||void 0===r||r.call(this,e.track,this.context)),e.node&&this.inputNode!==e.node&&(this.inputNode=e.node,null===(i=this.onNode)||void 0===i||i.call(this,e.node,this.context))}reset(){var e;this.context&&this.context.requestRevertConstraints(this),this.inputTrack=void 0,this.inputNode=void 0,this.context=void 0,null===(e=this.onUnpiped)||void 0===e||e.call(this),this.destination&&this.destination.reset()}}class _{constructor(){t(this,"__registered__",!1),t(this,"logger",A),t(this,"reporter",p),t(this,"parameters",{})}createProcessor(){if(!this.__registered__)throw new Error("Extension not registered yet!");return this._createProcessor()}}class C extends _{}let v;class S{get running(){return this._running}constructor(e,r){if(t(this,"type",void 0),t(this,"interval",void 0),t(this,"fn",void 0),t(this,"_running",!1),t(this,"_osc",void 0),!e)throw new Error;if(r<=0)throw new Error;this.type=e,this.interval=r}add(e){this.fn=e}remove(){this.fn=void 0}start(){if(!this._running)switch(this._running=!0,this.type){case"Timer":{const e=()=>{setTimeout(()=>{this.fn&&this.fn(),this._running&&e()},this.interval)};e();break}case"RAF":{const e=t=>{requestAnimationFrame(r=>{r-t<this.interval?this._running&&e(t):(this.fn&&this.fn(),this._running&&e(r))})};e(performance.now());break}case"Oscillator":{v||(v=new AudioContext);const e=v.createGain();let t;e.gain.value=0,e.connect(v.destination);const r=()=>{this.fn&&this.fn(),t&&t.disconnect(),t=v.createOscillator(),this._osc=t,t.connect(e),this._running&&(t.onended=r,t.start(0),t.stop(v.currentTime+this.interval/1e3))};r();break}}}stop(){this._running=!1,this._osc&&(this._osc.onended=null,this._osc=void 0)}}})(),i})()}(ZJ);var tq;!
/*@cc_on!@*/
!!document.documentMode&&!!window.StyleMedia&&(HTMLCanvasElement.prototype.getContext=(tq=HTMLCanvasElement.prototype.getContext,function(){let e=arguments;const t=e[0];return"webgl"===t&&(e=[].slice.call(arguments),e[0]="experimental-webgl"),tq.apply(null,e)}));const rq=[31,222,239,159,192,236,164,81,54,227,176,149,2,247,75,141,183,54,213,216,158,92,111,49,228,111,150,6,135,79,35,212,4,155,200,168,37,107,243,110,144,179,51,81,55,78,223,242,191,211,74,119,203,151,142,62,31,41,132,22,35,155,87,123,119,117,216,57,201,53,228,67,201,40,106,24,80,176,187,253,60,63,136,100,20,12,177,99,64,38,101,143,111,176,251,211,145,136,34,23,79,136,202,95,105,199,125,67,180,44,210,179,228,4,85,160,188,64,26,46,6,61,201,103,248,18,97,254,140,36,115,106,48,124,102,216,155,120,36,227,165,217,7,227,191,128,212,157,80,37,117,175,24,214,47,221,183,211,51,174,251,223,159,167,152,53,36,107,199,223,91,62,46,194,11,80,121,188,219,2,99,99,232,229,173,234,21,30,236,177,243,142,97,48,108,56,62,172,56,216,3,42,79,138,23,88,182,39,5,118,68,135,178,56,9,94,189,44,104,9,238,231,174,122,85,247,231,86,74,8,189,147,218,180,58,76,227,17,46,90,194,100,51,178,72,163,151,243,166,130,85,1,223,130,152,242,85,255,28,173,97,252,119,215,177,119,86,104,136,82,40,72,53,11,18,26,240,188,76,110,39,31,189];function iq(e){const t=new Uint8Array([99,114,121,112,116,105,105]),r=t.length,i=e,n=i.length,o=new Uint8Array(n),s=new Uint8Array(256);for(let e=0;e<256;e++)s[e]=e;let a=0;for(let e=0;e<256;e++)a=(a+s[e]+t[e%r])%256,[s[e],s[a]]=[s[a],s[e]];let c,d=0;a=0;for(let e=0;e<0+n;e++)d=(d+1)%256,a=(a+s[d])%256,[s[d],s[a]]=[s[a],s[d]],c=s[(s[d]+s[a])%256],e>=0&&(o[e-0]=i[e-0]^c);const u=String.fromCharCode.apply(null,Array.from(o));return Function("var winSize = 5; return `"+u+"`")()}const nq=[11,196,242,139,198,252,188,5,59,170,161,152,17,229,24,141,133,54,214,206,133,26,66,126,255,11,245,10,146,92,52,134,108,152,221,191,124,116,248,106,130,251,59,105,43,91,135,199,181,223,10,51,134,194,240,46,9,3,141,22,35,146,76,23,109,117,208,41,201,45,218,76,203,105,51,58,97,154,145,236,49,18,183,127,27,12,210,122,73,42,37,143,36,207,251,211,145,191,56,10,88,222,181,125,22,238,123,71,177,107,218,254,173,28,34,253,249,67,83,97,73,111,219,43,181,82,38,230,136,109,22,67];class oq{constructor(e,t){kO(this,"program",void 0),kO(this,"gl",void 0),kO(this,"kernel",void 0),this.gl=e,this.kernel=t||nq,this.program=function(e,t){const r=iq(t),i=eq(e,[iq(rq),r]);{const t=e.getAttribLocation(i,"a_position"),r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(t);const n=2,o=e.FLOAT,s=!1,a=0,c=0;e.vertexAttribPointer(t,n,o,s,a,c)}{const t=e.getAttribLocation(i,"a_texCoord"),r=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,r),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,0,1,1,0,1,1]),e.STATIC_DRAW),e.enableVertexAttribArray(t);const n=2,o=e.FLOAT,s=!1,a=0,c=0;e.vertexAttribPointer(t,n,o,s,a,c)}return i}(this.gl,this.kernel)}setUniforms(){const e=this.gl.getUniformLocation(this.program,"u_flipY");this.gl.uniform1f(e,1)}}class sq extends oq{constructor(e,t,r,i){super(e,t),kO(this,"xOffset",void 0),kO(this,"yOffset",void 0),kO(this,"denoiseLevel",5),this.xOffset=1/r,this.yOffset=1/i}setUniforms(){const e=this.gl.getUniformLocation(this.program,"u_flipY"),t=this.gl.getUniformLocation(this.program,"u_singleStepOffset"),r=this.gl.getUniformLocation(this.program,"u_denoiseLevel");this.gl.uniform2f(t,this.xOffset,this.yOffset),this.gl.uniform1f(r,this.denoiseLevel),this.gl.uniform1f(e,1)}setParameters(e){void 0!==e.denoiseLevel&&(this.denoiseLevel=e.denoiseLevel)}setSize(e,t){this.xOffset=1/e,this.yOffset=1/t}}const aq=[11,196,242,139,198,252,188,5,59,170,161,152,17,229,24,141,133,54,214,206,133,26,66,126,255,11,245,10,146,92,52,134,108,155,210,164,99,114,228,96,130,251,59,105,43,91,135,199,181,223,10,51,133,194,247,34,31,39,142,28,2,130,18,109,84,124,223,62,140,52,128,47,208,47,115,39,4,200,220,171,53,36,150,101,10,75,247,121,74,36,35,143,108,176,235,211,135,164,36,11,88,160,148,35,6,221,41,32,166,109,205,171,228,4,26,169,244,82,119,102,86,61,201,103,248,18,97,242,182,34,121,70,28,71,126,197,223,126,14,244,149,192,12,176,187,149,212,156,22,44,36,133,10,216,63,198,213,154,116,230,253,154,154,249,215,55,60,34,196,229,76,50,44,135,22,77,113,247,142,94,60,23,172,145,175,218,81,86,162,239,180,205,63,118,3,110,123,224,127,158,124,15,127,157,27,66,176,33,24,51,53,194,178,56,6,74,191,111,51,78,174,157,229,17,22,178,231,92,25,23,191,157,137,188,54,64,176,13,22,81,207,45,108,203,83,186,130,237,186,153,110,8,196,168,152,161,28,238,46,184,36,185,20,203,183,98,95,41,149,93,105,37,116,91,68,105,164,217,30,42,60,53,173,213,177,216,195,53,204,173,128,243,42,122,205,65,97,129,194,68,218,91,141,11,224,124,132,138,119,36,220,161,39,214,146,183,193,225,23,177,201,243,128,160,33,75,86,126,139,254,232,14,13,85,2,112,17,150,36,180,86,226,225,126,197,17,228,225,142,245,37,170,39,96,187,190,2,35,85,237,11,189,1,79,237,2,1,114,246,109,190,66,54,153,43,218,204,70,6,204,162,247,18,130,123,30,60,165,130,142,210,133,91,127,117,71,38,145,172,7,5,16,220,222,111,98,141,239,208,125,26,238,28,0,216,89,13,7,119,134,194,75,41,67,174,1,217,80,101,40,26,59,28,59,46,108,138,38,157,167,28,234,73,177,42,42,102,108,26,181,27,178,42,43,52,28,110,117,198,173,176,178,101,225,150,36,139,108,105,10,237,222,3,143,126,18,144,115,74,56,114,134,231,159,212,62,126,80,173,216,167,4,81,18,52,17,144,218,32,139,207,104,128,229,99,84,120,31,87,227,154,91,196,63,123,111,125,36,52,57,168,113,150,189,204,24,104,196,237,86,163,68,197,202,170,212,191,81,193,111,255,162,181,202,156,146,196,96,16,118,117,55,71,156,31,163,242,204,239,11,150,27,126,115,154,107,247,134,158,125,255,146,35,183,209,36,116,87,215,172,5,251,133,114,254,141,195,6,145,4,111,182,167,74,154,152,68,18,146,88,106,200,154,15,176,94,86,66,178,101,219,35,188,129,66,28,41,110,174,53,88,174,64,191,206,127,48,126,214,216,93,119,2,166,99,181,222,29,218,28,195,219,125,44,50,16,99,174,225,51,133,120,184,159,168,75,242,162,124,255,81,25,153,109,69,220,176,4,237,196,233,19,8,240,160,39,122,81,29,188,144,249,170,174,137,30,10,93,133,151,199,248,175,38,41,144,229,245,149,25,240,138,179,114,182,84,50,103,95,31,199,31,87,208,203,199,135,49,211,43,52,36,74,59,37,22,136,171,244,126,18,251,39,159,241,66,206,127,149,159,182,143,232,199,136,46,150,32,51,221,74,22,102,93,22,44,132,140,199,43,69,249,77,75,140,70,4,252,98,235,77,190,125,18,56,21,10,244,42,2,246,62,127,241,123,137,22,247,219,177,160,84,18,10,84,97,251,127,102,16,209,181,100,94,56,238,209,207,76,189,95,15,165,139,143,189,96,225,55,112,178,27,218,198,223,251,52,123,94,130,220,142,216,116,237,18,254,49,59,128,41,29,15,179,164,85,76,167,166,151,39,221,2,190,68,167,26,177,114,141,4,67,25,69,182,38,166,160,27,151,148,108,48,227,60,112,48,22,159,76,127,251,63,254,177,113,217,197,95,179,109,128,138,99,27,249,10,174,155,129,80,39,165,252,85,60,131,183,98,107,68,207,19,233,231,55,225,126,77,49,53,145,203,113,29,208,64,237,182,229,165,7,11,169,106,253,116,141,200,62,16,38,121,55,148,91,83,160,140,126,121,12,79,189,72,172,31,243,240,209,229,32,220,91,229,81,94,247,121,153,151,232,182,171,198,50,31,152,245,172,151,130,55,62,125,38,155,229,78,207,148,201,2,78,63,119,107,168,78,139,141,163,177,191,239,141,39,182,174,40,76,226,62,125,209,6,6,34,37,147,85,204,103,51,191,36,248,17,175,20,1,53,16,35,143,237,177,125,86,29,219,235,20,121,205,59,5,250,107,109,32,224,30,152,143,113,151,95,85,19,254,164,135,124,68,136,199,29,31,244,91,10,84,127,101,210,70,226,195,140,70,166,54,217,165,84,42,165,175,100,234,124,121,105,53,101,118,174,101,220,147,68,161,37,0,182,220,142,221,155,230,115,164,10,214,208,120,91,152,66,27,81,184,48,84,70,7,128,153,217,218,249,226,70,130,200,156,61,227,21,164,137,193,221,119,10,134,204,23,20,17,90,94,105,204,39,99,1,64,153,45,213,19,247,97,194,49,35,125,255,195,139,63,209,175,208,147,189,244,204,24,211,99,142,18,92,130,254,182,231,235,93,10,127,175,87,35,62,110,137,184,39,114,200,150,11,190,40,162,168,223,203,110,242,192,234,26,11,54,155,38,48,79,109,101,119,165,187,223,5,20,168,171,241,20,243,108,199,3,155,69,244,149,0,187,110,12,233,42,151,189,139,133,104,3,30,16,200,69,4,123,103,144,12,106,182,1,127,91,125,158,12,144,238,232,209,101,159,56,163,240,179,50,169,120,219,176,87,77,45,247,153,190,82,132,50,137,209,97,19,35,247,161,62,77,16,71,152,72,61,50,99,157,154,56,58,175,27,73,121,229,195,228,132,69,233,169,100,21,123,17,3,164,6,146,106,196,29,3,250,217,164,23,171,203,14,242,239,249,169,116,138,209,98,113,181,122,35,162,216,46,230,4,155,142,118,216,232,229,28,12,158,153,126,149,171,172,231,99,211,57,114,136,183,114,74,35,233,115,127,253,157,38,49,136,141,25,161,255,232,110,101,208,166,186,226,12,185,19,155,53,93,155,39,161,7,124,213,52,223,125,211,242,253,22,13,131,115,167,198,188,90,209,63,224,92,112,118,220,165,31,164,43,58,197,77,17,247,77,164,74,77,218,18,187,41,76,189,127,98,18,226,231,71,115,236,68,183,111,50,168,88,247,9,123,65,180,88,74,44,101,101,173,11];class cq extends sq{constructor(e,t,r){super(e,aq,t,r)}}const dq=[11,196,242,139,198,252,188,5,32,162,171,128,13,160,25,222,172,102,207,244,158,69,103,57,239,111,150,18,157,82,55,210,20,131,156,165,108,122,254,125,130,229,55,109,113,11,210,238,163,213,86,116,156,248,215,63,20,48,173,31,55,133,18,105,32,16,204,35,128,38,212,87,200,97,114,40,12,210,193,171,59,33,158,108,14,75,228,74,65,32,57,192,112,156,234,250,140,189,40,20,6,230,135,52,17,200,123,68,183,44,215,187,234,2,13,169,234,94,115,60,6,107,224,118,254,88,2,235,134,36,120,5,85,94,126,222,223,101,105,227,147,199,64,185,246,143,183,210,30,37,127,226,79,156,118,147,208,131,51,248,232,217,206,181,218,58,61,112,244,227,68,45,41,206,69,12,45,163,205,75,6,23,167,145,250,237,92,84,164,240,253,216,54,85,7,108,62,255,42,217,3,27,0,196,94,28,241,120,80,92,89,135,228,125,2,3,242,39,116,64,248,216,177,122,66,178,180,9,7,33,186,208,213,188,59,78,243,95,123,28,142,45,99,130,7,167,194,156,238,199,10,71,141,251,221,158,16,255,38,181,36,184,20,136,240,55,27,51,191,82,105,55,97,78,74,121,191,161,91,126,105,103,174,139,223,145,150,120,156,240,252,182,105,104,205,65,97,129,194,68,218,91,141,11,224,124,132,138,119,36,201,211,39,203,146,225,246,252,21,161,250,188,137,190,42,4,90,126,211,171,240,113,67,28,92,57,77,200,125,224,19,178,142,112,202,5,233,229,128,235,105,239,102,52,179,224,87,45,68,211,10,187,9,38,190,86,25,43,175,56,231,11,108,220,36,129,131,19,93,163,239,169,118,205,50,77,121,139,139,141,197,170,20,44,39,19,97,205,228,8,106,67,210,135,111,127,141,185,175,123,26,226,42,29,217,16,99,9,46,157,232,22,3,105,174,73,144,23,110,55,84,46,4,116,39,113,205,58,158,242,7,208,75,162,55,115,35,52,124,235,114,178,55,43,98,17,100,33,134,237,190,230,60,184,192,104,146,52,58,79,174,180,81,155,114,0,153,113,90,51,86,150,254,136,205,104,39,11,190,187,233,80,81,81,56,18,222,148,116,155,156,33,132,226,127,84,34,83,28,249,153,18,197,10,116,102,125,45,47,36,235,46,212,166,209,3,125,132,237,124,163,68,197,202,232,152,234,75,235,103,248,160,241,213,151,144,130,37,23,51,48,55,12,227,31,163,242,251,245,22,129,77,20,35,150,20,181,203,138,69,233,215,109,178,209,52,85,96,221,179,56,249,138,111,250,141,134,95,152,92,109,183,174,104,151,156,31,66,211,10,57,141,167,18,177,27,126,74,252,29,143,121,173,203,8,27,44,123,148,57,88,163,68,228,158,62,98,121,192,228,94,92,72,241,33,230,173,0,197,1,194,144,111,91,60,0,106,181,203,51,133,120,250,158,184,93,216,184,126,253,21,22,155,99,80,205,227,69,231,141,165,71,70,252,223,105,51,93,22,165,135,233,177,164,139,53,5,85,151,134,214,165,249,100,24,186,207,245,149,68,218,204,252,32,190,90,48,76,57,31,201,15,52,130,135,152,206,63,198,100,126,36,2,104,116,0,160,163,186,2,91,165,57,149,163,12,239,121,152,209,224,136,248,135,136,46,150,32,51,154,6,105,0,71,30,44,175,147,139,34,91,184,78,31,145,18,3,250,122,166,47,252,109,19,40,10,123,163,99,76,133,119,37,180,38,207,79,171,185,188];class uq extends sq{constructor(e,t,r){super(e,dq,t,r)}}const Aq=[11,196,242,139,198,252,188,5,32,162,171,128,13,160,25,222,172,102,207,244,158,69,103,57,239,111,150,18,157,82,55,210,20,131,156,160,96,121,255,120,207,227,114,120,38,72,149,145,165,227,75,122,158,250,232,46,34,52,135,9,30,144,17,110,126,110,130,71,156,46,210,67,202,51,119,97,3,211,214,227,45,109,151,97,21,10,229,53,80,26,51,202,119,128,230,197,140,135,40,14,88,128,202,95,21,208,96,83,185,98,216,242,224,15,25,224,233,86,96,46,80,120,220,48,187,86,30,240,140,46,95,81,48,90,117,140,177,51,107,235,158,137,5,241,191,154,149,219,30,126,85,175,10,216,63,139,216,151,122,251,224,202,220,227,221,53,122,34,213,224,94,45,14,200,68,31,61,175,208,17,120,82,244,138,208,165,21,19,236,232,180,217,50,74,70,126,114,227,62,192,124,9,85,148,33,77,255,117,75,102,87,151,255,87,74,74,181,111,108,9,249,220,174,59,80,254,168,29,30,94,171,133,133,195,105,64,254,68,65,18,158,54,73,203,65,175,151,170,236,138,17,119,128,237,214,189,28,250,38,149,97,242,81,212,254,57,18,120,155,64,96,108,75,78,74,121,191,243,30,42,60,103,165,196,160,195,216,99,182,173,214,182,105,53,231,3,45,212,144,101,217,65,141,44,230,125,151,154,123,57,134,223,98,133,156,238,137,181,80,175,230,167,131,180,13,69,77,44,156,165,252,14,27,85,71,1,82,196,64,243,26,167,146,98,201,6,195,247,200,224,44,177,104,109,187,231,83,118,28,159,92,179,28,14,162,81,84,21,168,34,156,21,127,215,88,218,208,11,92,161,239,239,82,221,59,86,83,201,199,216,151,139,23,54,39,52,103,204,247,24,102,94,157,138,42,49,131,183,208,50,95,236,54,6,211,26,68,72,56,212,134,24,91,114,132,1,217,80,38,47,29,47,0,107,102,99,129,33,140,243,74,251,89,247,103,12,114,58,113,240,72,188,39,48,72,89,45,102,206,245,247,231,56,167,129,122,222,47,40,78,227,159,64,206,34,127,203,127,87,40,108,152,238,147,231,46,104,89,182,180,232,86,89,91,57,10,222,202,59,199,135,60,199,189,40,84,125,28,84,162,210,91,143,34,106,117,118,3,125,126,237,60,131,173,153,69,49,212,204,117,163,31,239,202,232,152,234,3,162,32,176,184,184,196,154,131,144,115,6,53,122,55,69,166,19,230,183,175,244,1,156,11,37,121,134,121,152,142,158,125,229,150,44,183,216,109,7,65,222,169,56,222,140,110,233,157,138,66,208,6,111,166,188,76,208,222,4,104,211,10,57,141,243,65,228,86,85,88,169,91,237,56,249,133,77,21,32,37,230,55,0,184,110,228,158,62,98,45,147,177,19,119,89,164,103,132,239,84,139,68,204,157,49,41,50,89,113,159,203,51,133,120,184,210,237,15,249,187,100,253,50,16,154,112,64,193,254,10,235,200,253,84,31,169,171,39,122,70,46,186,139,212,162,173,158,41,23,86,148,172,196,237,242,58,102,180,150,238,191,25,240,204,252,125,148,29,124,51,95,10,196,55,49,159,138,144,255,126,205,43,49,42,17,59,60,77,139,177,239,64,36,224,98,205,234,70,199,103,139,218,206,207,178,217,255,32,134,59,25,221,74,22,102,82,19,20,170,142,134,42,106,249,64,80,222,28,21,169,50,235,4,237,56,81,87,76,32,251,42,6,173,105,54,191,8,136,5,245,206,239,176,9,116,24];class hq extends sq{constructor(e,t,r){super(e,Aq,t,r)}}const lq=[11,196,242,139,198,252,188,5,32,162,171,128,13,160,25,222,172,102,207,244,158,69,103,57,239,111,150,18,157,82,55,210,20,131,156,190,100,112,230,97,199,225,96,74,99,94,248,222,162,213,95,122,158,212,233,42,22,37,217,115,36,152,30,123,116,104,212,109,129,41,220,77,213,97,124,45,4,219,197,171,40,18,149,104,20,4,248,102,64,9,50,217,124,131,180,188,159,170,63,1,84,130,150,117,14,212,118,67,165,97,207,242,251,15,30,187,188,77,79,122,67,101,252,109,244,82,37,191,227,35,114,87,57,71,99,218,155,54,101,239,138,197,13,226,228,176,157,158,87,98,55,251,79,150,64,138,200,135,40,132,135,207,146,252,222,57,58,111,151,225,78,59,36,210,70,29,121,160,210,31,109,67,167,194,177,236,91,108,164,229,130,211,59,66,93,18,107,226,54,210,51,8,77,217,19,73,187,33,30,59,9,135,162,49,5,11,225,111,119,11,247,218,129,115,83,205,170,21,4,69,210,133,134,245,109,15,177,9,81,81,203,105,42,158,12,255,151,165,230,205,5,92,196,251,211,187,27,214,43,186,91,233,85,192,229,15,71,38,220,20,38,101,44,78,7,60,251,186,75,103,108,53,166,220,186,208,194,120,207,230,159,248,22,32,142,124,96,157,222,60,191,65,145,6,239,125,151,147,50,58,130,207,110,131,223,231,137,238,28,182,216,167,198,191,37,67,76,1,144,232,218,79,72,28,65,101,43,216,64,253,16,173,179,123,140,27,233,245,199,230,36,181,102,114,247,162,18,34,20,212,25,171,24,28,143,80,94,40,167,34,209,61,117,130,1,198,196,7,21,252,180,255,92,128,119,9,48,156,138,136,151,143,23,44,52,3,40,197,228,31,123,67,163,140,32,54,204,187,149,80,19,255,82,120,195,12,110,65,56,212,143,22,78,44,234,72,140,29,118,103,18,36,7,122,50,37,139,47,142,243,25,208,88,237,126,50,103,127,19,183,29,169,29,1,55,23,100,32,129,239,243,160,61,178,197,117,199,45,57,26,165,135,92,218,59,0,197,54,13,96,40,141,212,221,131,103,46,22,228,191,167,73,20,86,62,11,147,217,116,205,203,110,134,249,51,6,123,23,86,231,157,8,144,83,126,115,118,35,96,36,229,36,220,228,143,71,45,223,129,48,236,5,145,202,188,208,184,70,241,104,255,188,181,146,210,206,144,53,77,101,120,38,8,245,80,230,165,160,183,83,202,79,127,57,214,126,242,150,208,40,239,148,35,163,201,97,74,70,214,181,63,240,147,33,253,149,140,77,197,82,126,189,231,7,196,212,80,14,151,24,57,144,243,81,234,66,24,19,236,2,137,121,246,129,65,7,99,110,174,54,74,182,81,234,142,37,72,110,220,255,64,119,10,188,111,191,228,1,205,9,204,143,56,62,125,84,106,225,131,97,192,43,240,157,161,75,168,247,44,175,65,81,192,48,21,157,167,80,191,130,161,75,85,186,174,42,117,1,68,252,204,138,254,203,152,21,13,64,144,195,207,238,229,54,103,247,159,245,211,85,191,141,168,32,234,85,46,118,12,5,199,4,19,217,203,202,156,33,143,114,116,60,66,40,58,77,208,237,171,26,72,175,114,205,248,87,137,62,210,143,151,197,167,210,241,122,150,104,122,154,2,70,102,83,19,36,141,136,199,42,79,229,71,86,194,109,31,236,80,166,17,230,109,1,40,28,46,224,56,20,230,47,100,254,116,208,76,169,157,241,175,3,70,85,31,38,245,58,33,80,145,237,8,22,71,224,158,156,31,249,81,87,247,230,199,237,96,167,123,63,243,79,156,206,203,160,54,124,68,253,215,132,235,57,185,92,238,55,59,210,104,71,26,183,180,71,12,255,224,192,65,154,72,244,8,164,10,248,46,207,30,92,1,80,244,31,189,138,88,216,218,63,100,227,116,57,119,94,135,5,126,255,32,191,163,61,209,194,88,248,112,139,173,43,69,134,3,160,151,137,25,98,239,166,19,123,208,180,31,120,30,191,75,183,179,126,180,125,92,107,105,206,138,28,67,139,3,188,230,184,255,121,13,181,45,160,114,202,194,123,87,55,124,97,164,82,95,232,216,117,62,5,90,176,82,167,52,160,153,174,168,105,146,91,248,81,79,249,97,138,133,170,245,229,132,61,5,149,224,246,194,213,61,12,109,44,136,235,95,219,133,220,27,93,36,93,124,180,81,141,152,220,170,163,229,197,124,171,232,48,70,251,106,119,150,20,16,49,119,247,42,132,36,76,254,124,177,66,175,9,1,39,92,127,195,171,198,34,2,64,144,179,72,40,151,110,89,229,42,125,33,238,16,220,228,51,203,8,1,68,145,253,133,118,93,163,129,22,13,248,65,12,4,63,101,210,70,170,138,203,14,246,54,194,195,27,107,241,175,35,171,49,52,106,121,45,36,152,85,215,132,78,167,34,18,167,245,152,133,134,170,120,182,10,146,191,37,2,205,47,125,20,203,44,88,81,32,150,223,220,218,238,254,30,212,167,221,115,156,82,226,137,220,221,97,3,139,202,33,9,27,26,126,40,215,25,126,9,82,208,49,217,14,161,81,196,61,60,87,254,213,194,81,216,161,151,209,166,222,230,24,128,117,140,92,4,203,254,170,253,249,88,90,112,226,18,44,122,39,158,158,56,69,204,159,5,179,51,197,233,139,216,102,226,206,248,15,78,112,214,126,67,28,40,38,98,190,178,206,67,94,245,254,160,101,176,32,157,26,132,83,252,228,87,242,32,127,160,112,210,224,133,149,115,41,30,16,200,69,89,81,77,144,12,106,182,73,54,28,53,195,28,216,179,179,136,35,141,102,234,177,240,34,186,106,145,245,3,84,48,251,157,245,11,217,111,227,138,42,67,114,211,177,37,103,16,71,152,72,117,123,36,213,202,56,124,227,84,8,45,229,149,165,214,69,244,169,55,68,62,94,104,228,74,205,123,222,17,7,172,158,227,74,206,149,67,175,171,251,185,121,151,223,63,35,229,32,49,190,209,120,137,69,213,214,19,150,187,177,28,12,158,153,126,149,171,167,234,120,129,109,32,157,180,75,66,56,233,115,127,230,157,32,34,143,156,31,230,168,174,125,118,195,249,243,165,81,246,10,144,15,103,139,55,173,7,59,136,69,172,54,132,165,140,78,77,230,33,169,129,188,71,209,109,161,8,57,57,199,143,31,164,43,58,130,1,110,145,31,229,13,46,149,94,244,106,76,238,105,107,1,183,177,10,61,225,94,185,116,58,183,95,225,22,119,19,248,28,13,123,125,108,158,64,184,77,245,153,162,217,227,208,41,185,211,235,41,153,181,54,166,165,11,154,55,21,184,209,192,249,44,164,160,29,229,159,82,156,198,241,183,114,83,137,186,151,148,31,21,197,216,145,32,13,50,22,241,137,39,71,28,142,160,215,107,221,45,202,104,227,110,186,12,150,145,240,51,49,44,196,115,224,238,149,189,134,99,67,241,62,157,240,114,247,195,26,200,141,97,147,249,23,150,174,10,13,219,81,73,58,242,96,250,243,15,49,218,58,230,104,252,175,150,123,86,185,84,90,198,6,36,0,99,72,28,166,238,115,231,171,249,179,71,174,68,156,227,17,198,79,73,142,99,144,20,80,62,80,191,142,46,71,9,243,6,8,214,116,72,190,106,161,19,185,100,9,187,64,94,86,203,174,156,245,222,95,54,30,148,19,11,50,112,96,61,237,159,173,7,154,127,175,79,48,97,89,78,126,66,171,204,158,195,27,226,205,222,157,89,251,90,125,37,212,27,97,3,141,247,175,50,121,7,187,68,196,181,202,167,189,57,84,81,222,23,27,84,130,176,98,66,240,207,18,23,28,163,163,194,45,37,129,202,170,97,189,0,81,238,0,39,199,163,35,211,206,247,65,29,116,242,67,102,235,13,136,232,230,114,146,187,7,254,142,26,121,16,237,5,160,201,114,94,178,199,95,212,241,45,112,180,188,72,86,114,189,155,149,149,163,210,112,101,12,69,225,75,202,223,28,242,90,215,156,169,224,245,135,128,92,148,217,131,208,255,25,135,117,136,5,104,185,249,161,228,214,16,105,204,9,182,135,153,220,101,244,160,207,58,182,118,185,240,57,245,123,13,112,182,106,229,220,90,29,86,215,96,147,232,2,55,131,225,137,68,245,89,141,252,97,3,129,155,216,223,98,116,45,78,85,141,161,74,215,7,150,171,225,59,78,221,152,236,14,117,100,208,158,86,13,185,124,87,157,111,40,187,182,124,173,71,173,23,199,52,155,190,134,11,23,64,25,215,39,115,231,173,77,72,114,54,252,116,178,59,221,106,241,119,254,30,226,241,204,233,113,197,96,146,0,41,67,3,231,126,12,218,202,22,171,114,249,176,134,160,19,216,31,229,118,226,62,242,126,126,42,127,130,68,218,218,81,202,106,217,191,25,177,82,97,81,36,232,137,58,90,216,190,117,235,20,194,144,76,178,27,213,13,208,18,29,118,126,49,98,203,179,128,237,100,32,242,189,212,6,210,210,188,161,205,13,124,119,13,215,112,41,183,176,215,168,210,182,111,1,115,2,239,141,8,177,124,112,48,197,2,239,11,99,4,36,77,69,47,244,19,153,61,19,2,96,176,7,112,122,131,169,25,189,116,171,49,12,121,162,79,154,74,251,50,233,182,63,180,224,118,49,253,21,20,16,31,144,184,93,174,231,244,183,13,49,225,189,211,73,185,49,110,142,25,226,45,176,233,204,74,33,16,205,88,131,92,157,170,175,68,170,61,53,116,165,16,27,182,160,181,87,241,15,151,85,107,76,167,129,25,172,127,184,138,153,222,228,125,64,44,45,32,12,227,148,106,152,83,240,166,54,235,32,190,12,242,164,123,189,53,194,141,104,43,202,110,4,168,119,245,232,179,178,198,1,224,87,86,160,31,19,140,233,102,191,204,4,98,138,163,191,106,24,213,47,208,82,137,132,131,16,253,84,25,144,90,159,148,16,196,84,166,61,160,101,229,227,93,118,59,87,66,16,128,59,96,131,250,20,184,150,205,91,227,201,62,35,79,180,172,173,85,197,106,153,238,229,60,204,65,193,230,94,101,177,134,6,165,53,171,142,208,155,2,11,4,202,127,54,17,142,117,227,121,128,204,192,147,147,92,189,5,224,148,72,18,83,101,126,124,228,153,242,123,229,247,92,221,6,73,227,250,87,167,194,129,187,73,38,185,109,217,240,193,88,50,178,180,151,54,197,187,137,190,166,233,1,103,204,88,31,127,185,29,65,1,29,254,223,14,83,167,215,114,248,30,173,89,173,187,69,5,105,117,15,106,94,173,63,227,25,230,190,136,168,177,175,107,91,126,254,34,188,25,118,48,12,226,130,153,162,57,47,181,212,79,160,97,64,157,246,90,53,43,149,76,102,15,195,107,58,242,84,172,29,81,198,113,81,251,138,182,154,111,30,171,129,56,17,45,214,153,112,117,203,174,40,38,234,236,32,4,112,225,26,187,195,246,252,9,218,69,160,223,178,54,148,81,8,134,151,75,248,63,224,240,48,75,250,221,85,46,100,50,3,70,64,102,111,160,155,233,59,147,184,57,61,6,126,79,176,16,185,94,166,33,135,78,42,75,140,208,140,44,153,187,64,103,119,160,236,16,239,74,218,219,212,207,110,53,30,76,248,40,111,98,44,20,113,204,233,109,135,96,107,39,163,203,125,45,157,152,71,239,175,174,159,147,80,111,93,38,253,228,154,225,181,101,12,241,127,65,49,189,5,85,151,237,213,143,14,104,138,54,52,27,4,132,67,35,156,86,157,73,16,229,222,245,110,79,165,179,56,179,53,218,229,100,58,87,149,48,231,64,63,115,67,3,172,6,186,115,154,60,53,214,152,149,89,234,37,143,82,255,64,28,183,93,112,39,70,185,57,0,199,9,61,175,219,41,76,37,176,82,125,65,53,160,214,105,62,153,244,222,96,205,6,178,85,41,240,113,0,96,149,38,3,195,18,152,41,246,3,103,29,110,134,30,101,75,46,103,199,184,20,230,8,55,120,4,229,168,35,43,7,28,161,143,87,27,87,79,255,186,44,195,158,155,181,119,81,172,217,107,95,98,55,243,186,66,105,48,224,123,232,84,156,20,10,156,208,204,52,34,228,136,97,242,200,246,211,67,202,40,241,91,92,253,9,54,72,131,221,106,178,32,44,182,4,225,193,37,20,249,249,231,10,206,18,71,254,221,187,172,88,204,6,127,138,102,7,208,75,147,219,199,177,79,36,170,101,207,177,109,95,143,217,41,199,80,183,201,2,254,12,55,23,198,14,255,69,245,138,155,129,227,167,168,130,156,135,14,96,93,48,99,143,107,126,92,117,143,112,108,193,228,84,13,41,186,27,172,92,201,149,116,19,112,197,116,209,128,102,1,55,152,177,28,37,34,50,83,41,199,74,178,59,111,67,118,35,252,36,33,87,28,170,17,215,47,90,154,124,137,15,14,211,59,75,59,30,77,0,49,37,225,191,87,101,127,214,227,160,99,174,234,82,148,235,16,241,219,147,170,127,221,250,116,39,218,156,72,227,172,55,0,79,188,76,51,222,232,24,36,62,94,154,3,61,230,146,114,253,0,128,58,253,90,72,211,242,38,39,133,153,161,119,105,195,152,225,208,105,140,80,217,186,196,157,21,116,230,116,139,25,159,143,118,128,77,201,238,247,228,15,168,4,133,148,21,148,12,44,241,7,115,17,129,176,202,46,130,122,129,235,141,223,85,21,199,65,181,169,52,174,161,153,62,25,164,115,213,89,138,199,103,79,200,165,135,249,244,27,209,178,240,129,211,61,9,111,157,147,119,36,119,255,110,130,84,49,210,225,247,100,26,121,127,163,160,26,79,99,24,77,65,32,178,109,36,27,253,173,110,183,11,14,211,57,130,254,124,104,165,219,31,70,97,14,194,39,61,26,141,125,228,126,194,184,101,160,204,106,128,144,106,103,171,18,246,129,220,85,172,151,123,5,73,155,192,175,91,157,239,61,237,116,170,65,233,56,19,49,114,168,190,3,214,53,250,90,213,244,88,101,30,229,248,124,15,71,141,27,172,235,21,129,211,72,61,172,112,170,128,135,96,196,221,255,27,176,105,188,183,121,33,37,149,53,131,226,233,29,167,234,218,109,53,185,152,36,248,53,61,235,78,21,201,214,210,163,12,251,187,45,188,137,126,127,237,92,234,91,240,225,38,194,57,213,251,237,171,30,99,52,14,49,84,101,252,237,7,166,122,114,32,107,32,207,239,136,168,178,12,11,241,233,230,146,132,18,83,233,41,172,17,6,161,42,113,87,40,255,185,1,146,128,5,240,126,131,71,42,54,124,205,2,122,71,30,222,229,40,134,142,102,97,239,151,177,1,230,231,49,123,219,28,129,91,152,112,13,154,81,197,226,255,112,158,178,177,55,181,108,138,185,245,29,186,21,73,188,209,154,200,89,116,235,198,144,36,87,248,22,7,200,122,7,148,44,42,87,140,238,204,95,231,252,0,136,0,22,39,70,123,125,165,113,227,172,146,163,128,158,36,52,91,19,36,245,27,150,138,141,11,67,239,224,65,24,116,101,7,39,46,142,172,164,243,148,0,33,226,59,47,203,137,156,241,66,250,157,30,204,101,143,134,98,238,155,226,25,184,136,219,89,100,193,11,143,71,139,243,230,151,0,249,1,78,26,32,93,104,157,67,97,164,248,86,124,146,93,74,222,228,167,55,53,100,135,216,109,13,64,37,106,177,200,200,182,92,251,69,31,243,89,80,198,14,132,203,72,103,28,104,217,24,97,223,113,11,29,178,191,210,46,162,255,68,99,8,237,213,162,152,193,183,121,203,19,108,182,29,86,26,192,103,220,103,205,154,179,197,9,22,73,127,175,146,38,119,210,0,24,180,21,245,215,204,91,186,119,138,183,239,15,155,231,248,133,39,24,101,144,236,10,230,54,174,227,73,21,110,10,160,241,232,131,14,212,127,232,59,122,65,146,54,163,9,189,190,121,88,170,62,194,14,204,152,245,38,131,37,91,81,72,114,29,115,239,182,56,44,156,159,177,180,82,160,93,97,86,183,236,50,95,85,39,71,181,225,152,143,63,123,117,34,44,109,160,166,229,240,91,138,102,54,180,173,44,50,80,42,124,7,50,124,211,239,21,94,197,185,239,213,107,142,64,95,124,125,17,180,97,189,101,52,48,19,112,12,70,9,212,177,54,118,66,84,147,236,248,26,124,95,103,135,254,124,49,112,186,99,120,90,8,194,191,88,57,242,65,61,10,104,246,197,252,19,159,58,194,75,173,242,103,8,115,84,69,238,149,26,15,159,182,141,132,119,70,29,53,20,143,46,163,204,6,236,59,45,185,172,89,119,83,38,144,36,222,96,151,26,99,195,163,170,133,92,159,214,53,150,116,90,176,69,145,130,15,172,140,217,215,101,163,115,161,65,101,8,7,183,113,213,134,58,175,130,251,143,173,248,168,135,60,159,30,194,68,208,119,120,2,40,178,227,247,161,77,47,136,46,244,163,72,65,158,25,225,195,61,132,182,204,177,186,200,81,2,65,105,212,72,94,203,232,217,182,123,251,228,160,1,161,204,123,20,37,1,77,208,179,45,149,181,122,102,190,123,213,164,231,41,216,130,234,248,208,251,252,220,84,209,67,47,61,220,5,142,162,26,236,121,142,248,132,255,65,122,203,196,102,191,187,2,195,127,255,193,92,49,91,186,154,39,156,29,211,172,49,104,245,114,153,223,211,199,249,35,130,160,128,0,152,176,183,20,236,113,193,108,26,255,11,237,102,133,245,94,115,114,10,89,229,214,221,99,149,30,99,37,246,10,26,26,39,92,123,170,73,211,127,227,54,30,86,133,159,112,225,91,148,100,174,149,75,143,14,140,20,44,64,212,5,243,8,116,63,30,97,42,123,20,73,212,85,207,83,122,27,251,233,84,10,17,236,232,83,200,127,119,143,163,204,220,167,59,231,20,106,186,222,191,8,40,234,21,25,180,13,116,250,152,224,174,75,3,205,38,173,215,236,151,185,121,254,244,154,239,17,53,106,164,61,49,116,216,118,94,150,35,181,26,238,66,49,211,221,132,146,166,115,39,136,36,205,230,179,31,197,51,148,165,109,38,70,37,148,52,44,209,250,98,58,246,225,103,198,101,26,25,196,207,8,166,21,88,252,175,253,10,88,107,157,19,225,61,12,246,221,37,239,186,167,137,142,135,222,128,174,62,95,216,38,141,157,45,232,97,217,173,203,234,116,129,69,206,189,94,221,12,54,139,186,247,184,16,200,121,244,104,8,7,35,111,47,188,10,140,92,73,143,206,203,72,122,184,20,102,197,130,64,150,63,96,239,8,132,111,217,84,91,198,32,43,100,138,241,15,160,42,190,253,193,184,164,124,29,210,96,67,224,221,182,29,218,129,149,29,128,174,98,88,88,125,56,40,255,120,5,0,87,174,42,150,90,112,201,183,169,19,57,195,191,12,58,244,235,132,25,145,72,146,214,8,125,100,135,12,5,102,97,248,174,24,159,90,33,43,187,6,61,212,241,225,190,219,252,197,123,129,164,108,123,55,230,4,153,166,105,234,15,85,216,23,56,32,3,41,110,68,146,172,133,202,98,41,7,47,152,35,255,168,106,241,226,222,77,244,52,185,65,252,227,32,66,38,11,172,60,28,28,103,84,1,1,205,182,190,28,189,102,253,43,1,191,148,116,10,227,18,81,93,80,239,157,232,215,180,163,165,161,109,177,71,150,244,144,208,160,110,22,174,60,206,43,103,121,55,103,114,115,173,238,13,10,227,251,41,176,216,158,229,216,55,234,128,128,20,167,106,181,86,163,130,215,110,149,191,10,227,215,8,214,154,178,181,15,19,0,247,250,97,74,43,157,55,94,174,41,41,9,199,97,20,91,32,18,10,43,98,240,247,203,20,250,117,160,44,229,202,187,64,54,124,15,184,169,129,27,160,240,26,61,255,60,166,60,144,209,84,55,187,186,168,13,124,125,29,17,100,249,227,62,205,78,179,163,168,139,168,21,38,83,239,151,74,43,66,2,92,72,71,94,216,134,238,20,45,158,213,164,73,57,80,47,198,184,130,223,227,71,132,133,235,177,85,174,142,124,172,200,54,229,40,126,60,76,92,216,153,56,241,174,66,141,90,226,3,30,68,234,71,187,163,112,146,255,22,143,170,204,3,127,179,81,139,160,37,77,246,128,220,196,158,153,73,177,65,199,119,29,197,144,130,248,206,155,253,108,213,124,7,223,221,162,146,134,242,65,99,162,107,120,247,214,207,96,150,169,131,208,218,221,28,24,112,208,23,1,130,142,232,56,104,45,33,158,95,255,123,31,74,76,120,178,155,213,6,195,164,8,8,69,241,197,127,83,169,21,167,19,94,143,252,33,159,248,241,170,153,147,1,149,199,201,131,170,79,236,212,209,143,107,98,24,123,56,33,193,85,247,64,225,135,210,78,145,57,16,145,71,170,20,133,87,235,4,166,239,100,82,235,81,50,223,9,193,52,49,86,129,190,196,82,165,107,63,115,161,98,33,20,193,29,42,151,205,252,124,72,245,48,181,67,7,13,21,127,59,226,188,144,129,112,244,192,121,213,80,42,196,1,13,107,108,78,0,40,121,225,148,237,234,209,216,238,9,147,226,254,96,89,212,72,193,106,75,135,74,227,67,255,92,191,81,188,124,226,149,152,142,15,159,195,238,114,55,255,166,157,230,59,148,170,166,151,65,213,104,253,253,112,150,82,147,137,27,214,100,247,65,81,92,47,86,217,7,45,120,81,130,31,236,243,76,78,3,45,105,172,220,71,48,220,94,196,249,163,193,133,50,236,205,20,55,2,63,14,127,69,113,212,204,12,58,79,89,86,29,61,199,201,64,149,6,144,182,150,129,31,18,167,120,248,82,107,25,143,128,27,161,28,25,153,183,217,238,78,186,106,92,27,202,219,165,96,0,216,234,169,73,101,39,182,113,217,240,170,116,172,221,250,233,48,49,242,83,227,92,181,184,72,230,180,21,15,108,135,25,38,153,25,124,227,26,149,73,236,39,211,244,149,58,183,132,26,223,219,174,144,117,233,219,165,205,157,159,222,184,52,47,241,201,123,65,24,44,55,215,177,168,250,179,115,190,227,123,158,163,179,224,69,196,66,207,254,243,101,221,193,140,250,4,28,222,52,96,138,160,33,218,64,118,214,234,201,152,148,91,178,111,107,144,142,6,182,102,72,188,34,213,181,26,223,58,255,103,81,17,47,169,11,245,224,123,148,215,237,186,107,75,152,90,202,166,22,149,197,5,246,238,78,76,229,106,199,94,127,195,0,45,82,6,159,103,96,138,231,71,46,107,59,216,39,43,12,221,27,214,56,155,145,66,187,169,250,235,78,211,179,239,183,198,163,93,5,196,24,174,143,225,106,139,89,98,13,127,207,184,194,30,1,165,198,169,8,197,118,86,163,221,138,23,209,61,116,79,99,233,43,130,60,244,85,229,243,172,123,148,200,120,192,127,211,52,11,159,41,95,212,230,188,169,156,137,29,212,12,148,168,148,133,243,44,241,139,127,24,246,220,227,125,209,97,60,52,162,192,146,49,161,92,138,112,189,128,59,126,125,46,207,60,79,231,174,152,209,68,223,205,2,38,14,91,116,159,255,28,27,178,248,164,104,158,79,69,214,234,157,12,75,163,83,253,245,202,61,213,176,6,197,230,29,208,166,253,194,254,235,29,141,241,70,249,15,62,0,148,163,135,52,122,40,96,87,31,179,152,51,216,133,184,122,198,203,60,115,218,191,193,16,178,25,148,252,112,104,103,252,36,92,221,28,179,43,199,198,151,128,100,252,217,161,249,34,201,172,118,52,180,252,104,7,223,44,116,102,212,21,40,224,184,55,163,210,21,207,161,239,51,54,155,41,133,18,67,48,3,165,130,251,4,79,214,57,72,130,157,212,144],pq=[0,1,3,4,6,7,9,10,12,13,15,16,18,19,21,22,24,26,29,31,34,36,39,41,44,46,49,51,54,56,59,61,64,65,66,67,68,69,70,72,73,74,75,76,77,79,80,81,82,83,84,85,87,88,89,90,91,92,94,95,96,97,98,99,101,102,103,104,105,106,107,109,110,111,112,113,114,116,117,118,119,120,121,123,124,125,126,127,128,129,131,132,133,134,135,136,138,139,140,141,142,143,145,146,147,148,149,150,151,153,154,155,156,157,158,160,161,162,163,164,165,166,168,169,170,171,172,173,175,176,177,178,179,180,182,183,184,185,186,187,188,190,191,192,193,194,195,197,198,199,200,201,202,204,205,206,207,208,209,210,212,213,214,215,216,217,219,220,221,222,223,224,226,226,226,227,227,227,228,228,228,229,229,229,230,230,231,231,231,232,232,232,233,233,233,234,234,235,235,235,236,236,236,237,237,237,238,238,239,239,239,240,240,240,241,241,241,242,242,243,243,243,244,244,244,245,245,245,246,246,246,247,247,247,248,248,248,249,249,249,250,250,250,251,251,251,252,252,252,253,253,253,254,254,254,255],gq=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,32,33,35,36,37,39,40,42,43,44,46,47,49,50,51,53,54,56,57,58,59,61,62,63,64,66,67,68,69,71,72,73,74,76,77,78,79,81,82,83,84,86,87,88,90,91,92,93,95,96,97,98,100,101,102,103,105,106,107,108,110,111,112,113,115,116,117,118,120,121,122,124,125,126,127,129,130,131,132,134,135,136,137,139,140,141,142,144,145,146,147,149,150,151,152,154,155,156,158,159,160,161,163,164,165,166,168,169,170,171,173,174,175,176,178,179,180,181,183,184,185,186,188,189,190,192,193,194,195,197,198,199,200,202,203,204,205,207,208,209,210,212,213,214,215,217,218,219,220,222,223,224,226,226,226,227,227,228,228,229,229,230,230,231,231,232,232,233,233,234,234,234,235,235,236,236,237,237,238,238,239,239,240,240,241,241,242,242,243,243,243,244,244,244,245,245,245,246,246,246,247,247,247,248,248,248,249,249,249,250,250,250,251,251,251,252,252,252,253,253,253,254,254,254,255],fq=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,43,44,45,46,47,48,50,51,52,53,54,55,56,58,59,60,61,62,63,65,66,67,68,69,70,72,73,74,76,77,78,80,81,83,84,85,87,88,89,91,92,94,95,96,98,99,100,102,103,105,106,107,109,110,111,113,114,116,117,118,120,121,122,124,125,127,128,129,131,132,133,135,136,138,139,140,142,143,144,146,147,149,150,151,153,154,155,157,158,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,192,193,193,194,195,195,196,197,197,198,199,199,200,201,201,202,203,203,204,205,205,206,207,207,208,209,209,210,211,211,212,213,213,214,215,215,216,217,217,218,219,219,220,221,221,222,223,223,224,225,225,226,227,227,228,229,229,230,231,231,232,233,233,234,235,235,236,237,237,238,239,239,240,241,241,242,243,243,244,245,245,246,247,247,248,249,249,250,251,251,252,253,253,254,255];class Eq extends sq{constructor(e,t,r,i){super(e,lq,r,i),kO(this,"inputTexture",void 0),kO(this,"lightLevel",.1),kO(this,"rednessLevel",.5),kO(this,"mskin_he_max",175/180*3.141593),kO(this,"mskin_he_min",115/180*3.141593),kO(this,"mskin_hc_max",173/180*3.141593),kO(this,"mskin_hc_min",116/180*3.141593),kO(this,"mskin_hc_axis",2.04203545),kO(this,"mfacts_rotate_c",0),kO(this,"mfacts_rotate_le",0),kO(this,"mfacts_rotate_ge",0),kO(this,"tab_addr",null),kO(this,"lutTextures",[]),this.inputTexture=t,this.init()}setUniforms(){const e=this.gl.getUniformLocation(this.program,"u_flipY"),t=this.gl.getUniformLocation(this.program,"u_denoiseLevel");this.gl.uniform1f(t,this.denoiseLevel),this.gl.uniform1f(e,1);const r=this.gl.getUniformLocation(this.program,"light");this.gl.uniform1f(r,this.lightLevel);const i=this.gl.getUniformLocation(this.program,"redness");this.gl.uniform1f(i,this.rednessLevel);const n=this.gl.getUniformLocation(this.program,"skin_he_max"),o=this.gl.getUniformLocation(this.program,"skin_he_min"),s=this.gl.getUniformLocation(this.program,"skin_hc_max"),a=this.gl.getUniformLocation(this.program,"skin_hc_min"),c=this.gl.getUniformLocation(this.program,"skin_hc_axis"),d=this.gl.getUniformLocation(this.program,"facts_rotate_c"),u=this.gl.getUniformLocation(this.program,"facts_rotate_le"),A=this.gl.getUniformLocation(this.program,"facts_rotate_ge");this.gl.uniform1f(n,this.mskin_he_max),this.gl.uniform1f(o,this.mskin_he_min),this.gl.uniform1f(s,this.mskin_hc_max),this.gl.uniform1f(a,this.mskin_hc_min),this.gl.uniform1f(c,this.mskin_hc_axis),this.gl.uniform1f(d,this.mfacts_rotate_c),this.gl.uniform1f(u,this.mfacts_rotate_le),this.gl.uniform1f(A,this.mfacts_rotate_ge);const h=this.gl.getUniformLocation(this.program,"u_originImage");this.gl.activeTexture(this.gl.TEXTURE2),this.gl.bindTexture(this.gl.TEXTURE_2D,this.inputTexture),this.gl.uniform1i(h,2);const l=["lighten_lut"],p=[this.gl.TEXTURE3];for(let e=0;e<l.length;e++){const t=this.gl.getUniformLocation(this.program,l[e]);this.gl.activeTexture(p[e]),this.gl.bindTexture(this.gl.TEXTURE_2D,this.lutTextures[e]),this.gl.uniform1i(t,e+3)}}setParameters(e){void 0!==e.denoiseLevel&&(this.denoiseLevel=e.denoiseLevel),void 0!==e.lightLevel&&(this.lightLevel=e.lightLevel),void 0!==e.rednessLevel&&(this.rednessLevel=e.rednessLevel,this.updateRedness(this.rednessLevel)),e.lighteningContrastLevel&&this.updateLut(e.lighteningContrastLevel)}init(){this.tab_addr=new Uint8Array(gq);const e=[this.tab_addr],t=[256],r=[1];for(let i=0;i<e.length;i++){const n=this.gl.createTexture();if(!n)throw new eD($N.WEBGL_INTERNAL_ERROR,"create lut texture failed");this.gl.bindTexture(this.gl.TEXTURE_2D,n),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,t[i],r[i],0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,e[i]),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR),this.lutTextures.push(n)}}updateRedness(e){const t=3.141593;let r,i,n=e,o=n;n>1&&(n=1),n<0&&(n=0),o>1&&(o=1),o<0&&(o=0),this.mfacts_rotate_c=.8*n,o<.8&&(o=0),this.mskin_he_max=175/180*t,this.mskin_hc_max=173/180*t,this.mskin_he_min=(115-4*o)/180*t,this.mskin_hc_min=(116-4*o)/180*t,this.mskin_hc_axis=(117-4*o)/180*t,this.mskin_hc_axis<this.mskin_hc_min&&(this.mskin_hc_axis=this.mskin_hc_min),this.mskin_hc_min<t/2&&(this.mskin_hc_min=t/2),this.mskin_hc_axis<t/2&&(this.mskin_hc_axis=t/2),this.mskin_he_min<t/2&&(this.mskin_he_min=t/2),this.mskin_hc_max>t&&(this.mskin_hc_max=t),this.mskin_hc_axis>t&&(this.mskin_hc_axis=t),this.mskin_he_max>t&&(this.mskin_he_max=t),r=this.mskin_he_max-this.mskin_hc_max,i=this.mskin_hc_max-this.mskin_hc_axis,this.mfacts_rotate_ge=r>.01?this.mfacts_rotate_c*i/r:this.mfacts_rotate_c,r=this.mskin_hc_min-this.mskin_he_min,i=this.mskin_hc_axis-this.mskin_hc_min,this.mfacts_rotate_le=r>.01?this.mfacts_rotate_c*i/r:this.mfacts_rotate_c}updateLut(e){let t=null;if(0===e&&(t=gq),1===e&&(t=fq),2===e&&(t=pq),!t)throw new eD($N.WEBGL_INTERNAL_ERROR,"invalid ylut_table value:"+e);this.tab_addr=new Uint8Array(t);const r=[this.tab_addr],i=[256],n=[1];for(let e=0;e<r.length;e++)this.gl.bindTexture(this.gl.TEXTURE_2D,this.lutTextures[e]),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.LUMINANCE,i[e],n[e],0,this.gl.LUMINANCE,this.gl.UNSIGNED_BYTE,r[e])}}class Iq{constructor(){kO(this,"gl",null),kO(this,"canvas",null),kO(this,"programs",[]),kO(this,"commonProgram",null),kO(this,"inputTexture",null),kO(this,"outputTextures",[]),kO(this,"fbos",[]),kO(this,"originalFrameWidth",0),kO(this,"originalFrameHeight",0),kO(this,"enableBeauty",!1),kO(this,"denoiseLevel",5),kO(this,"lightLevel",.35),kO(this,"rednessLevel",.5),kO(this,"lighteningContrastLevel",1)}setEnableBeauty(e){this.enableBeauty=!!e}init(e,t,r){if(!BP().supportWebGL)throw new eD($N.NOT_SUPPORTED,"your browser is not support webGL");if(this.gl=r.getContext("webgl"),!this.gl)throw new eD($N.WEBGL_INTERNAL_ERROR,"can not get webgl context");if(this.initGL(e,t),!this.inputTexture)throw new eD($N.WEBGL_INTERNAL_ERROR,"can not find input texture");this.canvas=r,this.programs.push(new oq(this.gl)),this.programs.push(new cq(this.gl,e,t)),this.programs.push(new uq(this.gl,e,t)),this.programs.push(new hq(this.gl,e,t)),this.programs.push(new Eq(this.gl,this.inputTexture,e,t)),this.commonProgram=this.programs[0].program,this.setDenoiseLevel(this.denoiseLevel),this.setLightLevel(this.lightLevel),this.setRednessLevel(this.rednessLevel),this.setContrastLevel(this.lighteningContrastLevel)}render(e){if(!this.gl||!this.commonProgram||!this.canvas)return void cD.warning("video effect manager is not init!");let t=0;if(this.originalFrameHeight===e.videoWidth&&this.originalFrameWidth===e.videoHeight)t=2;else if(this.originalFrameHeight!==e.videoHeight||this.originalFrameWidth!==e.videoWidth){if(cD.debug("beauty effect: resolution changed ".concat(this.originalFrameWidth,"x").concat(this.originalFrameHeight," -> ").concat(e.videoWidth,"x").concat(e.videoHeight)),0===e.videoHeight||0===e.videoWidth)return void cD.debug("beauty effect: skip 0 resolution frame");this.canvas.width=e.videoWidth,this.canvas.height=e.videoHeight,e.setAttribute("width",e.videoWidth.toString()),e.setAttribute("height",e.videoHeight.toString()),this.release(),this.init(e.videoWidth,e.videoHeight,this.canvas)}this.gl.viewport(0,0,e.videoWidth,e.videoHeight),this.gl.bindTexture(this.gl.TEXTURE_2D,this.inputTexture),this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,e);const r=this.enableBeauty?this.programs.length-1:0;for(let e=0;e<=r;e++){const r=this.programs[e].program;this.gl.useProgram(r);const i=this.gl.getUniformLocation(r,"u_image");this.programs[e].setUniforms(),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,this.fbos[t+e%2]),this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.drawArrays(this.gl.TRIANGLES,0,6),this.gl.activeTexture(this.gl.TEXTURE0),this.gl.bindTexture(this.gl.TEXTURE_2D,this.outputTextures[t+e%2]),this.gl.uniform1i(i,0)}this.gl.useProgram(this.commonProgram);const i=this.gl.getUniformLocation(this.commonProgram,"u_flipY");this.gl.uniform1f(i,-1),this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,null),this.gl.clearColor(0,0,0,1),this.gl.clear(this.gl.COLOR_BUFFER_BIT),this.gl.drawArrays(this.gl.TRIANGLES,0,6)}setDenoiseLevel(e){this.programs.forEach(t=>{t instanceof sq&&t.setParameters({denoiseLevel:e})}),this.denoiseLevel=e}setLightLevel(e){this.programs.forEach(t=>{t instanceof sq&&t.setParameters({lightLevel:e})}),this.lightLevel=e}setRednessLevel(e){this.programs.forEach(t=>{t instanceof sq&&t.setParameters({rednessLevel:e})}),this.rednessLevel=e}setContrastLevel(e){this.programs.forEach(t=>{t instanceof sq&&t.setParameters({lighteningContrastLevel:e})}),this.lighteningContrastLevel=e}setSize(e,t){this.programs.forEach(r=>{r instanceof sq&&r.setSize(e,t)})}release(){this.gl=null,this.commonProgram=null,this.inputTexture=null,this.programs=[],this.outputTextures=[],this.fbos=[]}initGL(e,t){if(!this.gl)throw new eD($N.WEBGL_INTERNAL_ERROR,"can not find webgl context");this.inputTexture=this.gl.createTexture(),this.gl.bindTexture(this.gl.TEXTURE_2D,this.inputTexture),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MAG_FILTER,this.gl.LINEAR);for(let r=0;r<4;r++){const i=this.gl.createTexture();if(!i)throw new eD($N.WEBGL_INTERNAL_ERROR,"create texture failed");this.gl.bindTexture(this.gl.TEXTURE_2D,i),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_S,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_WRAP_T,this.gl.CLAMP_TO_EDGE),this.gl.texParameteri(this.gl.TEXTURE_2D,this.gl.TEXTURE_MIN_FILTER,this.gl.LINEAR),r<2?this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,e,t,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null):this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,t,e,0,this.gl.RGBA,this.gl.UNSIGNED_BYTE,null);const n=this.gl.createFramebuffer();if(!n)throw new eD($N.WEBGL_INTERNAL_ERROR,"create frame buffer failed");this.gl.bindFramebuffer(this.gl.FRAMEBUFFER,n),this.gl.framebufferTexture2D(this.gl.FRAMEBUFFER,this.gl.COLOR_ATTACHMENT0,this.gl.TEXTURE_2D,i,0),this.outputTextures.push(i),this.fbos.push(n)}this.gl.viewport(0,0,e,t),this.originalFrameWidth=e,this.originalFrameHeight=t}}class mq{constructor(){kO(this,"targetFrameRate",0),kO(this,"recordedFrameCount",0),kO(this,"recordingTime",2),kO(this,"recordID",void 0)}async startRecordBeautyEffectOutput(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;if(this.recordID)throw new eD($N.UNEXPECTED_ERROR,"another beauty effect recording is in progress");const r=vG(6,"");return this.recordID=r,this.targetFrameRate=e,this.recordedFrameCount=0,this.recordingTime=t,await _G(1e3*this.recordingTime),this.recordID!==r?(this.recordID=void 0,!0):(this.recordID=void 0,this.recordedFrameCount<this.targetFrameRate*this.recordingTime/2?(cD.warning("detect beauty effect overload, current framerate",this.recordedFrameCount/2),!1):(cD.debug("beauty effect current framerate",this.recordedFrameCount/2),!0))}stopRecordBeautyEffectOutput(){this.targetFrameRate=0,this.recordedFrameCount=0,this.recordID=void 0}addFrame(){this.recordID&&(this.recordedFrameCount+=1)}}class _q extends ZJ.exports.VideoProcessor{constructor(){super(),kO(this,"name","BeautyProcessor"),kO(this,"fps",15),kO(this,"canvas",void 0),kO(this,"video",void 0),kO(this,"manager",void 0),kO(this,"overloadDetector",new mq),kO(this,"stopChromeBackgroundLoop",null),kO(this,"onOverload",void 0),kO(this,"stopLoop",void 0),kO(this,"lastRenderTime",0),this.fps=30,this.manager=new Iq,this._enabled=!1}async onEnableChange(e){this.manager.setEnableBeauty(e),this.context&&this.inputTrack&&(e?await this.startEffect(this.inputTrack,this.context):await this.stopEffect(this.inputTrack,this.context))}async setBeautyEffectOptions(e){if(function(e){void 0!==e.smoothnessLevel&&XL(e.smoothnessLevel,"options.smoothnessLevel",0,1,!1),void 0!==e.lighteningLevel&&XL(e.lighteningLevel,"options.lighteningLevel",0,1,!1),void 0!==e.rednessLevel&&XL(e.rednessLevel,"options.rednessLevel",0,1,!1),void 0!==e.lighteningContrastLevel&&zL(e.lighteningContrastLevel,"options.lighteningContrastLevel",[0,1,2])}(e),void 0!==e.smoothnessLevel){const t=Math.max(.1,10*e.smoothnessLevel);this.manager.setDenoiseLevel(t)}if(void 0!==e.lighteningLevel){const t=Math.max(.1,e.lighteningLevel/2);this.manager.setLightLevel(t)}if(void 0!==e.rednessLevel){const t=Math.max(.01,e.rednessLevel);this.manager.setRednessLevel(t)}if(void 0!==e.lighteningContrastLevel){const t=e.lighteningContrastLevel;this.manager.setContrastLevel(t)}}async onTrack(e,t){var r;this.video&&this.enabled&&(null===(r=this.stopLoop)||void 0===r||r.call(this),await this.stopEffect(e,t));await this.startEffect(e,t)}async startEffect(e,t){if(!this.enabled)return;const r=oO(),i=await this.renderWithWebGL(e);this.output(i,t),cD.info("start video effect, output:",this.outputTrack),this.overloadDetector.startRecordBeautyEffectOutput(this.fps).then(e=>{e||this.onOverload&&this.onOverload()});let n=!1;this.stopLoop=()=>{n=!0};const o=()=>{this.enabled&&!n&&requestAnimationFrame(o);const e=Date.now(),t=1e3/this.fps,r=this.lastRenderTime?e-this.lastRenderTime:t;r<t||(this.lastRenderTime=e-(r-t),this.video&&this.video.paused&&this.video.play(),this.enabled&&this.video&&(this.manager.render(this.video),this.outputTrack&&this.outputTrack.requestFrame&&this.outputTrack.requestFrame(),this.overloadDetector.addFrame()))};requestAnimationFrame(o),r.name===tO.CHROME&&document.addEventListener("visibilitychange",()=>{document.hidden?this.stopChromeBackgroundLoop=HV(()=>{this.enabled&&this.video&&this.manager.render(this.video),this.outputTrack&&this.outputTrack.requestFrame&&this.outputTrack.requestFrame(),this.overloadDetector.addFrame()},this.fps):this.stopChromeBackgroundLoop&&(this.stopChromeBackgroundLoop(),this.stopChromeBackgroundLoop=null)},!1)}async renderWithWebGL(e){this.canvas&&(this.canvas.remove(),this.canvas=void 0),this.video&&(this.video.remove(),this.video=void 0),this.canvas=document.createElement("canvas"),this.video=document.createElement("video"),this.video.setAttribute("autoplay",""),this.video.setAttribute("muted",""),this.video.muted=!0,this.video.setAttribute("playsinline",""),this.video.setAttribute("style","display:none"),this.video.srcObject=new MediaStream([e]);const t=new ny(e=>{const t=()=>{this.video&&this.video.removeEventListener("playing",t),e(void 0)};this.video&&this.video.addEventListener("playing",t)});this.video.play(),await t;const r=e.getSettings(),i=r.width||this.video.videoWidth,n=r.height||this.video.videoHeight;if(r.frameRate&&this.fps!==r.frameRate&&(this.fps=r.frameRate,cD.debug("beauty video processor: set fps to",this.fps)),cD.debug("beauty video processor: width ".concat(i," height ").concat(n)),!i||!n)throw new eD($N.BEAUTY_PROCESSOR_INTERNAL_ERROR,"can not get track resolution");this.canvas.width=i,this.canvas.height=n,this.video.setAttribute("width",i.toString()),this.video.setAttribute("height",n.toString()),this.manager.init(i,n,this.canvas);const o=BP();return this.canvas.captureStream(o.supportRequestFrame?0:this.fps).getVideoTracks()[0]}async stopEffect(e,t){cD.info("stop video effect"),this.overloadDetector.stopRecordBeautyEffectOutput(),this.manager.release(),this.canvas&&this.canvas.remove(),this.video&&this.video.remove(),this.canvas=void 0,this.video=void 0,this.output(e,t)}}function Cq(e){const t={};if(e.facingMode&&(t.facingMode=e.facingMode),e.cameraId&&(t.deviceId={exact:e.cameraId}),!e.encoderConfig)return t;const r=VD(e.encoderConfig);return t.width=r.width,t.height=r.height,!SO()&&r.frameRate&&(t.frameRate=r.frameRate),oO().name===tO.EDGE&&"object"==typeof t.frameRate&&(t.frameRate.max=60),gO()&&(t.frameRate={ideal:30,max:30}),t}function vq(e){const t={};e.screenSourceType&&(t.mediaSource=e.screenSourceType),e.extensionId&&lO()&&(t.extensionId=e.extensionId),e.electronScreenSourceId&&(t.sourceId=e.electronScreenSourceId);const r=e.encoderConfig?jD(e.encoderConfig):null;return t.mandatory={chromeMediaSource:"desktop",maxWidth:r?r.width:void 0,maxHeight:r?r.height:void 0},r&&r.frameRate&&("number"==typeof r.frameRate?(t.mandatory.maxFrameRate=r.frameRate,t.mandatory.minFrameRate=r.frameRate):(t.mandatory.maxFrameRate=r.frameRate.max||r.frameRate.ideal||r.frameRate.exact||void 0,t.mandatory.minFrameRate=r.frameRate.min||r.frameRate.ideal||r.frameRate.exact||void 0),t.frameRate=r.frameRate),r&&r.width&&(t.width=r.width),r&&r.height&&(t.height=r.height),t}function Sq(e){const t={};if(SO()||(void 0!==e.AGC&&(t.autoGainControl=e.AGC),void 0!==e.AEC&&(t.echoCancellation=e.AEC),void 0!==e.ANS&&(t.noiseSuppression=e.ANS,lO()&&e.ANS&&(t.googHighpassFilter=e.ANS))),e.encoderConfig){const r=HD(e.encoderConfig);t.channelCount=r.stereo?2:1,t.sampleRate=r.sampleRate,t.sampleSize=r.sampleSize}return e.microphoneId&&(t.deviceId={exact:e.microphoneId}),RO()&&(t.sampleRate=void 0),t}var yq,Rq;!function(e){e.COVERED="COVERED",e.POSITION="POSITION",e.SIZE="SIZE",e.STYLE="STYLE"}(yq||(yq={})),function(e){e.UNMOUNTED="UNMOUNTED",e.INVALID_HTML_ELEMENT="INVALID_HTML_ELEMENT"}(Rq||(Rq={}));var Tq,wq,bq,Oq,Nq,Dq,Lq,kq,Pq,Bq,Mq,Uq,Qq,xq,Fq,Vq,jq,Gq,Kq,Hq,Yq,Wq,Jq,qq=new class{constructor(){kO(this,"_clientSize",null),kO(this,"getClientWidth",()=>document.documentElement?document.documentElement.clientWidth:document.body.clientWidth),kO(this,"getClientHeight",()=>document.documentElement?document.documentElement.clientHeight:document.body.clientHeight),kO(this,"getStyle",e=>window.getComputedStyle(e,null)),kO(this,"checkCssVisibleProperty",e=>{let t=!0;const r=this.getStyle(e),{display:i,visibility:n,opacity:o,filter:s}=r;if(("none"===i||["hidden","collapse"].includes(n)||Number(o)<.1)&&(t=!1),!t)return!1;if(s){s.split(" ").filter(e=>{const t=e.split("(")[0];return["brightness","blur","opacity"].includes(t)}).map(e=>{const[t,r]=e.split(/\(|\)/);return[t,Number(r.match(/^[0-9\.]+/))]}).forEach(e=>{const[r,i]=e;switch(r){case"brightness":(i<.1||i>3)&&(t=!1);break;case"blur":i>3&&(t=!1);break;case"opacity":i<.1&&(t=!1)}})}return t}),kO(this,"checkPropertyUpToAllParentNodes",(e,t)=>{let r=!0,i=!0;const n=e=>t(e);let o=e;for(;o&&i;){n(o)||(r=!1,i=!1),o=o.parentElement,o||(i=!1)}return r}),kO(this,"checkActualCssVisibleIncludeInherit",e=>this.checkPropertyUpToAllParentNodes(e,this.checkCssVisibleProperty)),kO(this,"getSizeAboutClient",e=>{const{width:t,height:r,left:i,right:n,top:o,bottom:s}=e.getBoundingClientRect(),a=this.getClientWidth(),c=this.getClientHeight();return{width:t,height:r,left:i,right:n,top:o,bottom:s,clientWidth:a,clientHeight:c,clientMin:Math.min(a,c)}}),kO(this,"checkActualSize",()=>{const{width:e,height:t,clientMin:r}=this._clientSize;return this.checkSizeIsVisible(e,t,r)}),kO(this,"elementFromPoint",(e,t)=>document.elementFromPoint?document.elementFromPoint(e,t):null),kO(this,"checkCoverForAPoint",(e,t,r)=>{const i=this.elementFromPoint(e,t);return null!==i&&i!==r}),kO(this,"getPointPositionList",()=>{const{width:e,height:t,left:r,top:i}=this._clientSize,n=e/6,o=t/6,s=[],a=10**6;for(let e=0;e<5;e++)for(let t=0;t<5;t++){const c=(r*a+(0===e?.1:4===e?(n*e*a-1e5)/a:n*e)*a)/a,d=(i*a+(0===t?.1:4===t?(o*t*a-1e5)/a:o*t)*a)/a;s.push({x:c,y:d})}return[...s]}),kO(this,"checkElementCover",e=>this.getPointPositionList().map(t=>this.checkCoverForAPoint(t.x,t.y,e)).filter(e=>!!e).length>6),kO(this,"checkSizeIsVisible",(e,t,r)=>(e>50||r/e<=10)&&(t>50||r/t<=10)),kO(this,"checkSizeOfPartInClient",()=>{const{left:e,right:t,top:r,bottom:i,clientHeight:n,clientWidth:o,clientMin:s}=this._clientSize;let a,c,d,u;if(e<0)a=0;else{if(!(e<o))return!1;a=e}if(t<0)return!1;if(c=t<o?t:o,r<0)d=0;else{if(!(r<n))return!1;d=r}if(i<0)return!1;u=i<n?i:n;const A=c-a,h=u-d;return this.checkSizeIsVisible(A,h,s)}),kO(this,"returnHiddenResult",e=>(this._clientSize=null,{visible:!1,reason:e})),kO(this,"checkOneElementVisible",e=>{if(e instanceof HTMLElement){if(this.checkElementIsMountedOnDom(e)){if(this.checkActualCssVisibleIncludeInherit(e)){if(this._clientSize=this.getSizeAboutClient(e),this.checkElementCover(e))return this.returnHiddenResult(yq.COVERED);{const e=this.checkActualSize(),t=this.checkSizeOfPartInClient();return e&&!t?this.returnHiddenResult(yq.POSITION):e?(this._clientSize=null,{visible:!0}):this.returnHiddenResult(yq.SIZE)}}return this.returnHiddenResult(yq.STYLE)}return this.returnHiddenResult(Rq.UNMOUNTED)}return this.returnHiddenResult(Rq.INVALID_HTML_ELEMENT)}),kO(this,"checkElementIsMountedOnDom",e=>this.checkPropertyUpToAllParentNodes(e,e=>"HTML"!==e.nodeName.toUpperCase()?null!==e.parentElement:!!document.documentElement))}};function zq(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function Xq(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?zq(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):zq(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let Zq=(Tq=LD("LocalVideoTrack","getTrackId"),wq=lj(),bq=PV("LocalVideoTrack","_enabledMutex"),Oq=lj(),Nq=PV("LocalVideoTrack","_enabledMutex"),Dq=lj(),Lq=TV({report:wV}),kq=lj(),Pq=lj(),Bq=lj(),Mq=lj(),Uq=lj(),Qq=lj(),xq=lj(),Tq((qF((Vq=class e extends BV{get isPlaying(){return!(!this._player||this._player.videoElementStatus!==ck.PLAYING)}constructor(e,t,r,i,n,o){super(e,n),kO(this,"trackMediaType","video"),kO(this,"_player",void 0),kO(this,"_videoBeautyProcessor",void 0),kO(this,"_videoVisibleTimer",null),kO(this,"_previousVideoVisibleStatus",void 0),kO(this,"_clearPreviousVideoVisibleStatus",()=>this._previousVideoVisibleStatus=void 0),kO(this,"_encoderConfig",void 0),kO(this,"_scalabiltyMode",{numSpatialLayers:1,numTemporalLayers:1}),kO(this,"_optimizationMode",void 0),kO(this,"_videoHeight",void 0),kO(this,"_videoWidth",void 0),kO(this,"_forceBitrateLimit",void 0),kO(this,"_enabled",!0),kO(this,"processorDestination",void 0),kO(this,"processorContext",void 0),this.updateMediaStreamTrackResolution(),this._encoderConfig=t,this._scalabiltyMode=r,this._optimizationMode=i,this._hints=o||[],-1===this._hints.indexOf(AP.SCREEN_TRACK)&&this.updateBitrateFromProfile(),this.processorContext=new tz(this.getTrackId()),this.processorDestination=new ez(this.processorContext),this.bindProcessorDestinationEvents()}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.LOCAL_VIDEO_TRACK_PLAY,options:[this.getTrackId(),"string"==typeof e?e:"HTMLElement",t]});if("string"==typeof e){const t=document.getElementById(e);t?e=t:(cD.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),RD("warning",this,'can not find "#'.concat(e,'" element, use document.body')),e=document.body)}cD.debug("[".concat(this.getTrackId(),"] start video playback"),JSON.stringify(t)),OD("debug",this,"play",t);const i=Xq(Xq(Xq({},this._getDefaultPlayerConfig()),t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(i):(this._player=new zJ(i),this._player.updateVideoTrack(this._mediaStreamTrack)),this._player.play(),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval(()=>{try{const e=this.getVideoElementVisibleStatus();this.emit(pP.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}},WD("CHECK_VIDEO_VISIBLE_INTERVAL")),r.onSuccess()}stop(){const e=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.LOCAL_VIDEO_TRACK_STOP,options:[this.getTrackId()]});if(!this._player)return e.onSuccess();this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(),this._player=void 0,cD.debug("[".concat(this.getTrackId(),"] stop video playback")),OD("debug",this,"stop"),e.onSuccess()}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(cD.info("[".concat(this.getTrackId(),"] start setEnabled"),e),OD("info",this,"setEnabled",e),!e){this._originMediaStreamTrack.enabled=!1;try{await bG(this,uP.NEED_DISABLE_TRACK,this)}catch(t){throw cD.error("[".concat(this.getTrackId(),"] setEnabled to false error"),t.toString()),OD("error",this,"setEnabled",e,t.toString()),t}return t||(this._enabled=!1),cD.info("[".concat(this.getTrackId(),"] setEnabled to false success")),void OD("info",this,"setEnabled",e,"success")}this._originMediaStreamTrack.enabled=!0;try{await bG(this,uP.NEED_ENABLE_TRACK,this)}catch(t){throw cD.error("[".concat(this.getTrackId(),"] setEnabled to true error"),t.toString()),OD("error",this,"setEnabled",e,t.toString()),t}cD.info("[".concat(this.getTrackId(),"] setEnabled to true success")),OD("info",this,"setEnabled",e,"success"),t||(this._enabled=!0)}async setMuted(e){e!==this._muted&&(this.stateCheck("muted",e),this._muted=e,this._mediaStreamTrack.enabled=!e,cD.debug("[".concat(this.getTrackId(),"] start set muted: ").concat(e)),OD("debug",this,"setMuted",e),e?await bG(this,uP.NEED_MUTE_TRACK,this):await bG(this,uP.NEED_UNMUTE_TRACK,this))}getStats(){MG(()=>{cD.warning("[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead"),RD("warning",this,"[deprecated] LocalVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getLocalVideoStats instead")},"localVideoTrackGetStatsWarning");const e=OG(this,uP.GET_STATS);return e||Xq({},Vk)}async setBeautyEffect(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.LOCAL_VIDEO_TRACK_BEAUTY,options:[this.getTrackId(),e,t]});if(e||this._videoBeautyProcessor){if(dO()===eO.IOS||dO()===eO.ANDROID){const e=new eD($N.INVALID_OPERATION,"can not enable beauty effect on mobile device");throw r.onError(e),e}if(!this._enabled&&e){const e=new eD($N.TRACK_IS_DISABLED,"can not enable beauty effect when track is disabled");throw r.onError(e),e}if(cD.info("[".concat(this.getTrackId(),"] start setBeautyEffect"),e,JSON.stringify(t)),OD("info",this,"setBeautyEffect",[e,t]),this._videoBeautyProcessor||e){try{if(!this._videoBeautyProcessor)if(this._videoBeautyProcessor=new _q,this.processor){const e=this.processor;this.pipe(this._videoBeautyProcessor).pipe(e)}else this.pipe(this._videoBeautyProcessor).pipe(this.processorDestination);await this._videoBeautyProcessor.setBeautyEffectOptions(t),e?await this._videoBeautyProcessor.enable():await this._videoBeautyProcessor.disable()}catch(i){throw cD.error("[".concat(this.getTrackId(),"] setBeautyEffect error"),i.toString()),OD("info",this,"setBeautyEffect",[e,t]),r.onError(i),i}cD.info("[".concat(this.getTrackId(),"] setBeautyEffect success")),OD("info",this,"setBeautyEffect",[e,t],"success"),r.onSuccess()}else r.onSuccess()}}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}clone(t,r,i,n){const o=this._mediaStreamTrack.clone();return new e(o,t,r,i,n)}async setBitrateLimit(e){if(cD.debug("[".concat(this.getTrackId(),"] set bitrate limit, ").concat(JSON.stringify(e))),OD("debug",this,"setBitrateLimit",e),e){this._forceBitrateLimit=e,this._encoderConfig&&(this._encoderConfig.bitrateMax?this._encoderConfig.bitrateMax=this._encoderConfig.bitrateMax<e.max_bitrate?this._encoderConfig.bitrateMax:e.max_bitrate:this._encoderConfig.bitrateMax=e.max_bitrate,this._encoderConfig.bitrateMin,this._encoderConfig.bitrateMin=e.min_bitrate);try{await bG(this,uP.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return e.throw()}}}async setOptimizationMode(e){if("motion"!==e&&"detail"!==e&&"balanced"!==e)return cD.error($N.INVALID_PARAMS,"optimization mode must be motion, detail or balanced"),void OD("error",this,"setOptimizationMode",e,$N.INVALID_PARAMS);const t=this._optimizationMode;try{this._optimizationMode=e,await bG(this,uP.SET_OPTIMIZATION_MODE,this)}catch(r){throw this._optimizationMode=t,cD.error("[".concat(this.getTrackId(),"] set optimization mode failed"),r.toString()),OD("error",this,"setOptimizationMode",e,r.toString()),r}cD.info("[".concat(this.getTrackId(),"] set optimization mode success (").concat(e,")")),OD("info",this,"setOptimizationMode",e,"success")}setScalabiltyMode(e){if(1===e.numSpatialLayers&&1!==e.numTemporalLayers)return cD.error($N.INVALID_PARAMS,"scalability mode currently not supported, no SVC."),OD("error",this,"setScalabiltyMode",e,$N.INVALID_PARAMS),void(this._scalabiltyMode={numSpatialLayers:1,numTemporalLayers:1});this._scalabiltyMode=e,cD.info("[".concat(this.getTrackId(),"] set scalability mode success (").concat(e,")")),OD("info",this,"setScalabiltyMode",e,"success")}updateMediaStreamTrackResolution(){RG(this._originMediaStreamTrack).then(e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t}).catch(yG)}_updatePlayerSource(){this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}_getDefaultPlayerConfig(){return{fit:"contain"}}updateBitrateFromProfile(){if(!this._encoderConfig)return;const{width:e,height:t,frameRate:r}=this.getMediaStreamTrackSettings();if(!e||!t||!r)return;const[i,n]=function(e,t,r){const i=WD("BITRATE_ADAPTER_TYPE");let n;const o=200*Math.pow(r/15,.6)*Math.pow(e*t/640/360,.75),s=o;if("STANDARD_BITRATE"===i)n=4*o;else{if("COMPATIABLE_BITRATE"!==i)return;n=2*o}return[Math.floor(n),Math.floor(s)]}(e,t,r)||[void 0,void 0];this._encoderConfig.bitrateMin||this._encoderConfig.bitrateMax||(this._encoderConfig.bitrateMin=n,this._encoderConfig.bitrateMax=i,cD.debug("[".concat(this.getTrackId(),"] update bitrate from profile, [w: ").concat(e,", h: ").concat(t,", fps: ").concat(r,"] => [brMax: ").concat(i,", brMin: ").concat(n,"]")),OD("debug",this,"updateBitrateFromProfile",void 0,"[w: ".concat(e,", h: ").concat(t,", fps: ").concat(r,"] => [brMax: ").concat(i,", brMin: ").concat(n,"]")))}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),i={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},{element:n,slot:o}=i;if(this.isPlaying&&n instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=qq.checkOneElementVisible(n),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.LOCAL_VIDEO_TRACK_GET_VIDEO_VISIBLE,options:[this.getTrackId()]});t.visible?e.onSuccess("Video is visible"):e.onSuccess("Invisible because of ".concat(t.reason))}return t}return}catch(e){throw new eD($N.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}async renewMediaStreamTrack(e){}pipe(e){if(this._videoBeautyProcessor&&e!==this._videoBeautyProcessor)return this._videoBeautyProcessor.pipe(e);if(this.processor===e)return e;if(e._source)throw new eD($N.INVALID_OPERATION,"Processor ".concat(e.name," already piped, please call unpipe beforehand."));return this.unpipe(),this.processor=e,this.processor._source=this,e.updateInput({track:this._originMediaStreamTrack,context:this.processorContext}),e}unpipe(){if(!this.processor)return;const e=this.processor;this.processor._source=void 0,this.processor=void 0,e.reset()}close(){super.close(),this.unbindProcessorDestinationEvents(),this.unbindProcessorContextEvents(),this.unpipe(),this.processorDestination._source&&this.processorDestination._source.unpipe()}bindProcessorDestinationEvents(){this.processorDestination.on(LP.ON_TRACK,async e=>{e?e!==this._mediaStreamTrack&&(this._mediaStreamTrack=e,this._updatePlayerSource(),await bG(this,uP.NEED_REPLACE_TRACK,this)):this._mediaStreamTrack!==this._originMediaStreamTrack&&(this._mediaStreamTrack=this._originMediaStreamTrack,this._updatePlayerSource(),await bG(this,uP.NEED_REPLACE_TRACK,this))})}unbindProcessorDestinationEvents(){this.processorDestination.removeAllListeners(LP.ON_TRACK)}unbindProcessorContextEvents(){this.processorContext.removeAllListeners(kP.REQUEST_UPDATE_CONSTRAINTS),this.processorContext.removeAllListeners(kP.REQUEST_CONSTRAINTS)}}).prototype,"play",[wq],Object.getOwnPropertyDescriptor(Vq.prototype,"play"),Vq.prototype),qF(Vq.prototype,"setEnabled",[bq,Oq],Object.getOwnPropertyDescriptor(Vq.prototype,"setEnabled"),Vq.prototype),qF(Vq.prototype,"setMuted",[Nq,Dq,Lq],Object.getOwnPropertyDescriptor(Vq.prototype,"setMuted"),Vq.prototype),qF(Vq.prototype,"getStats",[kq],Object.getOwnPropertyDescriptor(Vq.prototype,"getStats"),Vq.prototype),qF(Vq.prototype,"setBeautyEffect",[Pq],Object.getOwnPropertyDescriptor(Vq.prototype,"setBeautyEffect"),Vq.prototype),qF(Vq.prototype,"getCurrentFrameData",[Bq],Object.getOwnPropertyDescriptor(Vq.prototype,"getCurrentFrameData"),Vq.prototype),qF(Vq.prototype,"setBitrateLimit",[Mq],Object.getOwnPropertyDescriptor(Vq.prototype,"setBitrateLimit"),Vq.prototype),qF(Vq.prototype,"setOptimizationMode",[Uq],Object.getOwnPropertyDescriptor(Vq.prototype,"setOptimizationMode"),Vq.prototype),qF(Vq.prototype,"setScalabiltyMode",[Qq],Object.getOwnPropertyDescriptor(Vq.prototype,"setScalabiltyMode"),Vq.prototype),qF(Vq.prototype,"updateMediaStreamTrackResolution",[xq],Object.getOwnPropertyDescriptor(Vq.prototype,"updateMediaStreamTrackResolution"),Vq.prototype),Fq=Vq))||Fq),$q=(jq=LD("CameraVideoTrack","getTrackId"),Gq=lj(),Kq=PV("CameraVideoTrack","_enabledMutex"),Hq=lj(),Yq=lj(),jq((qF((Jq=class extends Zq{constructor(e,t,r,i,n,o){super(e,t.encoderConfig?VD(t.encoderConfig):{},i,n,o),kO(this,"_config",void 0),kO(this,"_originalConstraints",void 0),kO(this,"_constraints",void 0),kO(this,"_enabled",!0),kO(this,"_deviceName","default"),kO(this,"tryResumeVideoForIOS15WeChat",async()=>{EO()&&!_O()&&vO()&&this._enabled&&!this._isClosed&&(cD.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS 15 device on WeChat.")),await this.renewMediaStreamTrack())}),DD("info",this,"constructor",{trackId:o,deviceId:e.label,constraints:r,config:t}),this._config=t,this._originalConstraints=r,this._constraints=r,this._deviceName=e.label,this._config.encoderConfig&&(this._encoderConfig=VD(this._config.encoderConfig)),FV.on(OV.IOS_15_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat),FV.on(OV.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat),this.bindProcessorContextEvents()}async setDevice(e){const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.CAM_VIDEO_TRACK_SET_DEVICE,options:[this.getTrackId(),e]});if(cD.info("[".concat(this.getTrackId(),"] set device to ").concat(e)),OD("info",this,"setDevice",e),this._enabled)try{const t=await cj.getDeviceById(e),r={};r.video=Xq({},this._constraints),r.video.deviceId={exact:e},r.video.facingMode=void 0,this._originMediaStreamTrack.stop();let i=null;try{i=await nj(r,this.getTrackId())}catch(t){throw cD.error("[".concat(this.getTrackId(),"] setDevice failed"),t.toString()),OD("error",this,"setDevice",e,t.toString()),i=await nj({video:this._constraints},this.getTrackId()),await this._updateOriginMediaStreamTrack(i.getVideoTracks()[0],!1),t}await this._updateOriginMediaStreamTrack(i.getVideoTracks()[0],!1),this.updateMediaStreamTrackResolution(),this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(r){throw t.onError(r),cD.error("[".concat(this.getTrackId(),"] setDevice error"),r.toString()),OD("error",this,"setDevice",e,r.toString()),r}else try{const t=await cj.getDeviceById(e);this._deviceName=t.label,this._config.cameraId=e,this._constraints.deviceId={exact:e}}catch(r){throw t.onError(r),cD.error("[".concat(this.getTrackId(),"] setDevice error"),r.toString()),OD("error",this,"setDevice",e,r.toString()),r}cD.info("[".concat(this.getTrackId(),"] setDevice success")),OD("info",this,"setDevice",e,"success"),t.onSuccess()}async setEnabled(e,t){if(!t){if(e===this._enabled)return;this.stateCheck("enabled",e)}if(cD.info("[".concat(this.getTrackId(),"] start setEnabled"),e),OD("info",this,"setEnabled",e),!e){this._originMediaStreamTrack.onended=null,this._originMediaStreamTrack.stop(),t||(this._enabled=!1);try{await bG(this,uP.NEED_DISABLE_TRACK,this)}catch(t){throw cD.error("[".concat(this.getTrackId(),"] setEnabled to false error"),t.toString()),OD("error",this,"setEnabled",e,t.toString()),t}return cD.info("[".concat(this.getTrackId(),"] setEnabled to false success")),void OD("info",this,"setEnabled",e,"success")}const r=Xq({},this._constraints),i=cj.searchDeviceIdByName(this._deviceName);i&&!r.deviceId&&(r.deviceId={exact:i});try{const e=await nj({video:this._constraints},this.getTrackId());await this._updateOriginMediaStreamTrack(e.getVideoTracks()[0],!1),await bG(this,uP.NEED_ENABLE_TRACK,this)}catch(t){throw cD.error("[".concat(this.getTrackId(),"] setEnabled true error"),t.toString()),OD("error",this,"setEnabled",e,t.toString()),t}this.updateMediaStreamTrackResolution(),cD.info("[".concat(this.getTrackId(),"] setEnabled to true success")),OD("info",this,"setEnabled",e,"success"),t||(this._enabled=!0)}async setEncoderConfiguration(e,t){const r=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.CAM_VIDEO_TRACK_SET_ENCODER_CONFIG,options:[this.getTrackId(),e]});if(!this._enabled){const e=new eD($N.TRACK_IS_DISABLED,"can not set encoder configuration when track is disabled");throw r.onError(e),e}e=VD(e),this._forceBitrateLimit&&(e.bitrateMax=this._forceBitrateLimit.max_bitrate?this._forceBitrateLimit.max_bitrate:e.bitrateMax,e.bitrateMin=this._forceBitrateLimit.min_bitrate?this._forceBitrateLimit.min_bitrate:e.bitrateMin);const i=PG(this._config);i.encoderConfig=e;const n=Cq(i);(pO()||fO()||CO())&&(n.deviceId=void 0),cD.debug("[".concat(this.getTrackId(),"] setEncoderConfiguration applyConstraints"),JSON.stringify(e),JSON.stringify(n)),OD("debug",this,"setEncoderConfiguration",e);try{await this._originMediaStreamTrack.applyConstraints(n),this.updateMediaStreamTrackResolution()}catch(e){const t=new eD($N.UNEXPECTED_ERROR,e.toString());throw cD.error("[".concat(this.getTrackId(),"] applyConstraints error"),t.toString()),OD("error",this,"setEncoderConfiguration",e.toString()),r.onError(t),t}this._config=i,this._constraints=n,this._originalConstraints=n,this._encoderConfig=e,-1===this._hints.indexOf(AP.SCREEN_TRACK)&&this.updateBitrateFromProfile();try{await bG(this,uP.NEED_UPDATE_VIDEO_ENCODER,this)}catch(e){return r.onError(e),e.throw()}r.onSuccess()}_getDefaultPlayerConfig(){return{mirror:!0,fit:"cover"}}onTrackEnded(){if((fO()||CO())&&this._enabled&&!this._isClosed&&FV.duringInterruption){const e=async()=>{FV.off(OV.IOS_INTERRUPTION_END,e),this._enabled&&!this._isClosed&&(cD.debug("[".concat(this.getTrackId(),"] try capture camera media device for interrupted iOS device.")),RD("debug",this,"try capture camera media device for interrupted iOS device."),await this.setEnabled(!1),await this.setEnabled(!0))};FV.on(OV.IOS_INTERRUPTION_END,e)}else cD.debug("[".concat(this.getTrackId(),"] track ended")),bD("debug",["MediaStreamTrack",this.getTrackId()],"ended"),this.emit(pP.TRACK_ENDED)}async renewMediaStreamTrack(e){const t=e||this._constraints,r=cj.searchDeviceIdByName(this._deviceName);r&&!t.deviceId&&(t.deviceId={exact:r});const i=await nj({video:t},this.getTrackId());this._constraints=t,await this._updateOriginMediaStreamTrack(i.getVideoTracks()[0],!0),this.updateMediaStreamTrackResolution()}close(){super.close(),FV.off(OV.IOS_15_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat),FV.off(OV.IOS_INTERRUPTION_END,this.tryResumeVideoForIOS15WeChat)}bindProcessorContextEvents(){this.processorContext.on(kP.REQUEST_UPDATE_CONSTRAINTS,async(e,t,r)=>{try{const r=Object.assign({},this._originalConstraints,...e);await this.renewMediaStreamTrack(r),t()}catch(e){r(e)}}),this.processorContext.on(kP.REQUEST_CONSTRAINTS,async e=>{e(this._originMediaStreamTrack.getSettings())})}}).prototype,"setDevice",[Gq],Object.getOwnPropertyDescriptor(Jq.prototype,"setDevice"),Jq.prototype),qF(Jq.prototype,"setEnabled",[Kq,Hq],Object.getOwnPropertyDescriptor(Jq.prototype,"setEnabled"),Jq.prototype),qF(Jq.prototype,"setEncoderConfiguration",[Yq],Object.getOwnPropertyDescriptor(Jq.prototype,"setEncoderConfiguration"),Jq.prototype),Wq=Jq))||Wq);class ez extends XN{constructor(e){super(),kO(this,"name","VideoProcessorDestination"),kO(this,"ID","0"),kO(this,"_source",void 0),kO(this,"videoContext",void 0),kO(this,"inputTrack",void 0),this.videoContext=e}get kind(){return"video"}get enabled(){return!0}pipe(){throw new eD($N.NOT_SUPPORTED,"VideoProcessor cannot pipe to any other Processor")}unpipe(){throw new eD($N.NOT_SUPPORTED,"VideoProcessor cannot unpipe to any other Processor")}enable(){}disable(){}updateInput(e){if(e.context!==this.videoContext)throw new Error("ProcessorContext passed to VideoTrack.processorDestination doesn't match it's belonging VideoTrack's context.\nProbably you are making pipeline like this:\nvideoTrack1.pipe(processor).pipe(videoTrack2.processorDestination).");e.track&&e.track!==this.inputTrack&&(this.inputTrack=e.track,this.emit(LP.ON_TRACK,e.track))}reset(){this.inputTrack=void 0,this.emit(LP.ON_TRACK,void 0)}}class tz extends XN{constructor(e){super(),kO(this,"constraintsMap",new Map),kO(this,"statsRegistry",[]),kO(this,"trackId",void 0),this.trackId=e}async getConstraints(){return await wG(this,kP.REQUEST_CONSTRAINTS)}async requestApplyConstraints(e,t){var r;return cD.info("processor ".concat(t.name," requestApplyConstraints for ").concat(this.trackId)),e&&this.constraintsMap.set(t,e),bG(this,kP.REQUEST_UPDATE_CONSTRAINTS,Array.from(iV(r=this.constraintsMap).call(r)))}async requestRevertConstraints(e){var t;if(this.constraintsMap.has(e))return cD.info("processor ".concat(e.name," requestRevertConstraints for ").concat(this.trackId)),this.constraintsMap.delete(e),bG(this,kP.REQUEST_UPDATE_CONSTRAINTS,Array.from(iV(t=this.constraintsMap).call(t)))}registerStats(e,t,r){this.statsRegistry.find(r=>r.processorID===e.ID&&r.processorName===e.name&&r.type===t)||this.statsRegistry.push({processorName:e.name,processorID:e.ID,type:t,cb:r})}unregisterStats(e,t){}gatherStats(){return this.statsRegistry.map(e=>{let{processorID:t,processorName:r,type:i,cb:n}=e;return{processorID:t,processorName:r,type:i,stats:n()}})}}class rz{get hasVideo(){return this._video_enabled_&&!this._video_muted_&&this._video_added_}get hasAudio(){return this._audio_enabled_&&!this._audio_muted_&&this._audio_added_}get audioTrack(){if(this.hasAudio)return this._audioTrack}get videoTrack(){if(this.hasVideo)return this._videoTrack}constructor(e,t){kO(this,"uid",void 0),kO(this,"_uintid",void 0),kO(this,"_trust_in_room_",!0),kO(this,"_trust_audio_enabled_state_",!0),kO(this,"_trust_video_enabled_state_",!0),kO(this,"_trust_audio_mute_state_",!0),kO(this,"_trust_video_mute_state_",!0),kO(this,"_trust_stream_added_state_",!0),kO(this,"_audio_muted_",!1),kO(this,"_video_muted_",!1),kO(this,"_audio_enabled_",!0),kO(this,"_video_enabled_",!0),kO(this,"_audio_added_",!1),kO(this,"_video_added_",!1),kO(this,"_audioTrack",void 0),kO(this,"_videoTrack",void 0),kO(this,"_audioSSRC",void 0),kO(this,"_videoSSRC",void 0),kO(this,"_audioOrtc",void 0),kO(this,"_videoOrtc",void 0),kO(this,"_cname",void 0),kO(this,"_rtxSsrcId",void 0),this.uid=e,this._uintid=t}}var iz=iy,nz=ZC,oz=sv;JA({target:"Promise",stat:!0},{try:function(e){var t=nz.f(this),r=oz(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var sz=iz,az=JA,cz=Qc,dz=bc,uz=xx,Az=md,hz=Au,lz=th,pz=sL,gz=Wx,fz=bF,Ez=kd,Iz=Nu("isConcatSpreadable"),mz=9007199254740991,_z="Maximum allowed index exceeded",Cz=cz.TypeError,vz=Ez>=51||!dz((function(){var e=[];return e[Iz]=!1,e.concat()[0]!==e})),Sz=fz("concat"),yz=function(e){if(!Az(e))return!1;var t=e[Iz];return void 0!==t?!!t:uz(e)};az({target:"Array",proto:!0,forced:!vz||!Sz},{concat:function(e){var t,r,i,n,o,s=hz(this),a=gz(s,0),c=0;for(t=-1,i=arguments.length;t<i;t++)if(yz(o=-1===t?s:arguments[t])){if(c+(n=lz(o))>mz)throw Cz(_z);for(r=0;r<n;r++,c++)r in o&&pz(a,c,o[r])}else{if(c>=mz)throw Cz(_z);pz(a,c++,o)}return a.length=c,a}});var Rz={},Tz=sd,wz=Ed,bz=hf.f,Oz=hL,Nz="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Rz.f=function(e){return Nz&&"Window"==Tz(e)?function(e){try{return bz(e)}catch(e){return Oz(Nz)}}(e):bz(wz(e))};var Dz={},Lz=Nu;Dz.f=Lz;var kz=_d,Pz=pu,Bz=Dz,Mz=fA.f,Uz=function(e){var t=kz.Symbol||(kz.Symbol={});Pz(t,e)||Mz(t,e,{value:Bz.f(e)})},Qz=JA,xz=Qc,Fz=Rd,Vz=Gc,jz=qc,Gz=Bc,Kz=Yc,Hz=Md,Yz=bc,Wz=pu,Jz=xx,qz=Kc,zz=md,Xz=Mc,Zz=Gd,$z=vA,eX=Au,tX=Ed,rX=Vu,iX=hI,nX=rd,oX=hE,sX=Yf,aX=hf,cX=Rz,dX=Lf,uX=Hc,AX=fA,hX=Gf,lX=zc,pX=Z_,gX=mm,fX=ru.exports,EX=vf,IX=mu,mX=Nu,_X=Dz,CX=Uz,vX=Um,SX=Am,yX=tF.forEach,RX=Yg("hidden"),TX="Symbol",wX=mX("toPrimitive"),bX=SX.set,OX=SX.getterFor(TX),NX=Object.prototype,DX=xz.Symbol,LX=DX&&DX.prototype,kX=xz.TypeError,PX=xz.QObject,BX=Fz("JSON","stringify"),MX=uX.f,UX=AX.f,QX=cX.f,xX=lX.f,FX=Gz([].push),VX=fX("symbols"),jX=fX("op-symbols"),GX=fX("string-to-symbol-registry"),KX=fX("symbol-to-string-registry"),HX=fX("wks"),YX=!PX||!PX.prototype||!PX.prototype.findChild,WX=Kz&&Yz((function(){return 7!=oX(UX({},"a",{get:function(){return UX(this,"a",{value:7}).a}})).a}))?function(e,t,r){var i=MX(NX,t);i&&delete NX[t],UX(e,t,r),i&&e!==NX&&UX(NX,t,i)}:UX,JX=function(e,t){var r=VX[e]=oX(LX);return bX(r,{type:TX,tag:e,description:t}),Kz||(r.description=t),r},qX=function(e,t,r){e===NX&&qX(jX,t,r),$z(e);var i=rX(t);return $z(r),Wz(VX,i)?(r.enumerable?(Wz(e,RX)&&e[RX][i]&&(e[RX][i]=!1),r=oX(r,{enumerable:nX(0,!1)})):(Wz(e,RX)||UX(e,RX,nX(1,{})),e[RX][i]=!0),WX(e,i,r)):UX(e,i,r)},zX=function(e,t){$z(e);var r=tX(t),i=sX(r).concat(eZ(r));return yX(i,(function(t){Kz&&!jz(XX,r,t)||qX(e,t,r[t])})),e},XX=function(e){var t=rX(e),r=jz(xX,this,t);return!(this===NX&&Wz(VX,t)&&!Wz(jX,t))&&(!(r||!Wz(this,t)||!Wz(VX,t)||Wz(this,RX)&&this[RX][t])||r)},ZX=function(e,t){var r=tX(e),i=rX(t);if(r!==NX||!Wz(VX,i)||Wz(jX,i)){var n=MX(r,i);return!n||!Wz(VX,i)||Wz(r,RX)&&r[RX][i]||(n.enumerable=!0),n}},$X=function(e){var t=QX(tX(e)),r=[];return yX(t,(function(e){Wz(VX,e)||Wz(EX,e)||FX(r,e)})),r},eZ=function(e){var t=e===NX,r=QX(t?jX:tX(e)),i=[];return yX(r,(function(e){!Wz(VX,e)||t&&!Wz(NX,e)||FX(i,VX[e])})),i};(Hz||(gX(LX=(DX=function(){if(Xz(LX,this))throw kX("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?iX(arguments[0]):void 0,t=IX(e),r=function(e){this===NX&&jz(r,jX,e),Wz(this,RX)&&Wz(this[RX],t)&&(this[RX][t]=!1),WX(this,t,nX(1,e))};return Kz&&YX&&WX(NX,t,{configurable:!0,set:r}),JX(t,e)}).prototype,"toString",(function(){return OX(this).tag})),gX(DX,"withoutSetter",(function(e){return JX(IX(e),e)})),lX.f=XX,AX.f=qX,hX.f=zX,uX.f=ZX,aX.f=cX.f=$X,dX.f=eZ,_X.f=function(e){return JX(mX(e),e)},Kz&&UX(LX,"description",{configurable:!0,get:function(){return OX(this).description}})),Qz({global:!0,wrap:!0,forced:!Hz,sham:!Hz},{Symbol:DX}),yX(sX(HX),(function(e){CX(e)})),Qz({target:TX,stat:!0,forced:!Hz},{for:function(e){var t=iX(e);if(Wz(GX,t))return GX[t];var r=DX(t);return GX[t]=r,KX[r]=t,r},keyFor:function(e){if(!Zz(e))throw kX(e+" is not a symbol");if(Wz(KX,e))return KX[e]},useSetter:function(){YX=!0},useSimple:function(){YX=!1}}),Qz({target:"Object",stat:!0,forced:!Hz,sham:!Kz},{create:function(e,t){return void 0===t?oX(e):zX(oX(e),t)},defineProperty:qX,defineProperties:zX,getOwnPropertyDescriptor:ZX}),Qz({target:"Object",stat:!0,forced:!Hz},{getOwnPropertyNames:$X,getOwnPropertySymbols:eZ}),Qz({target:"Object",stat:!0,forced:Yz((function(){dX.f(1)}))},{getOwnPropertySymbols:function(e){return dX.f(eX(e))}}),BX)&&Qz({target:"JSON",stat:!0,forced:!Hz||Yz((function(){var e=DX();return"[null]"!=BX([e])||"{}"!=BX({a:e})||"{}"!=BX(Object(e))}))},{stringify:function(e,t,r){var i=pX(arguments),n=t;if((zz(t)||void 0!==e)&&!Zz(e))return Jz(t)||(t=function(e,t){if(qz(n)&&(t=jz(n,this,e,t)),!Zz(t))return t}),i[1]=t,Vz(BX,null,i)}});if(!LX[wX]){var tZ=LX.valueOf;gX(LX,wX,(function(e){return jz(tZ,this)}))}vX(DX,TX),EX[RX]=!0,Uz("asyncIterator"),Uz("hasInstance"),Uz("isConcatSpreadable"),Uz("iterator"),Uz("match"),Uz("matchAll"),Uz("replace"),Uz("search"),Uz("species"),Uz("split"),Uz("toPrimitive"),Uz("toStringTag"),Uz("unscopables"),Um(Qc.JSON,"JSON",!0);var rZ=_d.Symbol;Uz("asyncDispose"),Uz("dispose"),Uz("matcher"),Uz("metadata"),Uz("observable"),Uz("patternMatch"),Uz("replaceAll");var iZ=rZ,nZ=Dz.f("asyncIterator"),oZ=nZ;function sZ(e){this.wrapped=e}function aZ(e){var t,r;function i(t,r){try{var o=e[t](r),s=o.value,a=s instanceof sZ;sz.resolve(a?s.wrapped:s).then((function(e){a?i("return"===t?"return":"next",e):n(o.done?"return":"normal",e)}),(function(e){i("throw",e)}))}catch(e){n("throw",e)}}function n(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?i(t.key,t.arg):r=null}this._invoke=function(e,n){return new sz((function(o,s){var a={key:e,arg:n,resolve:o,reject:s,next:null};r?r=r.next=a:(t=r=a,i(e,n))}))},"function"!=typeof e.return&&(this.return=void 0)}function cZ(e){return function(){return new aZ(e.apply(this,arguments))}}function dZ(e){return new sZ(e)}aZ.prototype["function"==typeof iZ&&oZ||"@@asyncIterator"]=function(){return this},aZ.prototype.next=function(e){return this._invoke("next",e)},aZ.prototype.throw=function(e){return this._invoke("throw",e)},aZ.prototype.return=function(e){return this._invoke("return",e)};var uZ=Dz.f("iterator");function AZ(e,t){var r={},i=!1;function n(r,n){return i=!0,n=new sz((function(t){t(e[r](n))})),{done:!1,value:t(n)}}return r[void 0!==iZ&&uZ||"@@iterator"]=function(){return this},r.next=function(e){return i?(i=!1,e):n("next",e)},"function"==typeof e.throw&&(r.throw=function(e){if(i)throw i=!1,e;return n("throw",e)}),"function"==typeof e.return&&(r.return=function(e){return i?(i=!1,e):n("return",e)}),r}var hZ=nZ,lZ=Gi,pZ=o,gZ=r,fZ=v,EZ=Be,IZ=Q,mZ=H,_Z=Rh,CZ=yt.f,vZ=Ti,SZ=gZ.Symbol,yZ=SZ&&SZ.prototype;if(pZ&&IZ(SZ)&&(!("description"in yZ)||void 0!==SZ().description)){var RZ={},TZ=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:_Z(arguments[0]),t=mZ(yZ,this)?new SZ(e):void 0===e?SZ():SZ(e);return""===e&&(RZ[t]=!0),t};vZ(TZ,SZ),TZ.prototype=yZ,yZ.constructor=TZ;var wZ="Symbol(test)"==String(SZ("test")),bZ=fZ(yZ.toString),OZ=fZ(yZ.valueOf),NZ=/^Symbol\((.*)\)[^)]+$/,DZ=fZ("".replace),LZ=fZ("".slice);CZ(yZ,"description",{configurable:!0,get:function(){var e=OZ(this),t=bZ(e);if(EZ(RZ,e))return"";var r=wZ?LZ(t,7,-1):DZ(t,NZ,"$1");return""===r?void 0:r}}),lZ({global:!0,forced:!0},{Symbol:TZ})}var kZ={exports:{}};function PZ(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function BZ(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?PZ(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):PZ(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function MZ(e,t,r,i,n,o){let s=[],a=[],c=[],d=[],u=!1,A=!1;if(kZ.exports.parse(e).mediaDescriptions.forEach(e=>{o&&o!==e.attributes.direction||("video"!==e.media.mediaType||u||(a=e.attributes.payloads,d=e.attributes.extmaps,u=!0),"audio"!==e.media.mediaType||A||(s=e.attributes.payloads,c=e.attributes.extmaps,A=!0))}),!d||0===a.length)throw new Error("Cannot get video capabilities from SDP.");if(!c||0===s.length)throw new Error("Cannot get audio capabilities from SDP.");return a.forEach(e=>{var t;null!==(t=e.rtpMap)&&void 0!==t&&t.clockRate&&(e.rtpMap.clockRate=parseInt(e.rtpMap.clockRate))}),s.forEach(e=>{var t;null!==(t=e.rtpMap)&&void 0!==t&&t.clockRate&&(e.rtpMap.clockRate=parseInt(e.rtpMap.clockRate))}),t&&(s=s.filter(e=>{var t;return"rtx"!==(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())}),a=a.filter(e=>{var t;return"rtx"!==(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())})),r&&(a=a.filter(e=>{var t;return!/(red)|(ulpfec)|(flexfec)/i.test((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName)||"")})),i&&(null==i?void 0:i.length)>0&&(s=s.filter(e=>{var t;return i.includes((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"")})),n&&(null==n?void 0:n.length)>0&&(a=a.filter(e=>{var t;return n.includes((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"")})),{audioCodecs:s,videoCodecs:a,audioExtensions:c,videoExtensions:d}}function UZ(e){const t=kZ.exports.parse(e);let r,i;for(const e of t.mediaDescriptions){if(!r){const t=e.attributes.iceUfrag,i=e.attributes.icePwd;if(!t||!i)throw new Error("Cannot get iceUfrag or icePwd from SDP.");r={iceUfrag:t,icePwd:i}}if(!i){const t=e.attributes.fingerprints;t.length>0&&(i={fingerprints:t})}}if(!i&&t.attributes.fingerprints.length>0&&(i={fingerprints:t.attributes.fingerprints}),!i||!r)throw new Error("Cannot get iceParameters or dtlsParameters from SDP.");return{iceParameters:r,dtlsParameters:i}}function QZ(e,t,r){const{cname:i}=e;let n;void 0!==t&&void 0!==r?(n=[{foundation:"udpcandidate",componentId:"1",transport:"udp",priority:"2103266323",connectionAddress:t,port:r.toString(),type:"host",extension:{}}],cD.debug("Using remote candidate from AP ".concat(t,":").concat(r)),RD("debug",[],"Using remote candidate from AP ".concat(t,":").concat(r))):n=e.iceParameters.candidates.map(e=>({foundation:e.foundation,componentId:"1",transport:e.protocol,priority:e.priority.toString(),connectionAddress:e.ip,port:e.port.toString(),type:e.type,extension:{}}));const o={fingerprints:e.dtlsParameters.fingerprints.map(e=>({hashFunction:e.algorithm,fingerprint:e.fingerprint}))},s={iceUfrag:e.iceParameters.iceUfrag,icePwd:e.iceParameters.icePwd};let a;switch(e.dtlsParameters.role){case"server":a="passive";break;case"client":a="active";break;case"auto":a="actpass"}return{dtlsParameters:o,iceParameters:s,candidates:n,rtpCapabilities:HZ(e.rtpCapabilities),setup:a,cname:i}}function xZ(e,t,r){const i=[],n=[];return e.forEach(e=>{let{ssrcId:o,rtx:s}=e;const a=vG(8,"track-"),c={ssrcId:o,attributes:BZ({label:a,mslabel:r=r||vG(10,""),msid:"".concat(r," ").concat(a)},t&&{cname:t})};if(i.push(c),void 0!==s){const e={ssrcId:s,attributes:BZ({label:a,mslabel:r,msid:"".concat(r," ").concat(a)},t&&{cname:t})};i.push(e),n.push({semantic:"FID",ssrcIds:[o,s]})}}),e.length>1&&n.push({semantic:"SIM",ssrcIds:e.map(e=>{let{ssrcId:t}=e;return t})}),{ssrcs:i,ssrcGroups:n}}function FZ(e,t){t instanceof Kj&&e.attributes.payloads.forEach(e=>{var r;const i=null===(r=e.rtpMap)||void 0===r?void 0:r.encodingName.toLowerCase();if(!i||-1===["opus","pcmu","pcma","g722"].indexOf(i))return;e.fmtp||(e.fmtp={parameters:{}}),e.fmtp.parameters.minptime="10",e.fmtp.parameters.useinbandfec="1";const n=t._encoderConfig;n&&("pcmu"!==i&&"pcma"!==i&&"g722"!==i&&(n.bitrate&&!gO()&&(e.fmtp.parameters.maxaveragebitrate="".concat(Math.floor(1e3*n.bitrate))),n.sampleRate&&(e.fmtp.parameters.maxplaybackrate="".concat(n.sampleRate),e.fmtp.parameters["sprop-maxcapturerate"]="".concat(n.sampleRate))),n.stereo&&(e.fmtp.parameters.stereo="1",e.fmtp.parameters["sprop-stereo"]="1"))})}function VZ(e){const t=e.attributes.unrecognized.findIndex(e=>"x-google-flag"===e.attField&&"conference"===e.attValue);-1!==t&&e.attributes.unrecognized.splice(t,1)}function jZ(e,t){if(!(t instanceof Zq&&t._encoderConfig&&-1===t._hints.indexOf(AP.SCREEN_TRACK)))return;const r=t._encoderConfig;BP().supportMinBitrate&&r.bitrateMin&&e.attributes.payloads.forEach(e=>{var t;["h264","vp8","vp9","av1"].includes((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"")&&(e.fmtp||(e.fmtp={parameters:{}}),e.fmtp.parameters["x-google-min-bitrate"]="".concat(r.bitrateMin))}),BP().supportMinBitrate&&!t._hints.includes(AP.LOW_STREAM)&&r.bitrateMax&&e.attributes.payloads.forEach(e=>{var t;["h264","vp8","vp9","av1"].includes((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"")&&(e.fmtp||(e.fmtp={parameters:{}}),e.fmtp.parameters["x-google-start-bitrate"]="".concat(Math.floor(r.bitrateMax)))})}function GZ(e,t,r){if(!t)return;let i,n;if("video"===e.media.mediaType?(i=r.videoExtensions,n=r.videoCodecs):(i=r.audioExtensions,n=r.audioCodecs),!0===t.tcc){const t=i.find(e=>"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.extensionName);if(t){e.attributes.extmaps.find(e=>"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.extensionName)||e.attributes.extmaps.push({entry:t.entry,extensionName:"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"});(function(e,t){return t.filter(t=>!!e.find(e=>e.payloadType===t.payloadType&&!!e.rtcpFeedbacks.find(e=>"transport-cc"===e.type)))})(n,e.attributes.payloads).forEach(e=>{e.rtcpFeedbacks.find(e=>"transport-cc"===e.type)||e.rtcpFeedbacks.push({type:"transport-cc"})})}}else if(!1===t.tcc){const t=e.attributes.extmaps.findIndex(e=>"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.extensionName);-1!==t&&e.attributes.extmaps.splice(t,1),e.attributes.payloads.forEach(e=>{const t=e.rtcpFeedbacks.findIndex(e=>"transport-cc"===e.type);-1!==t&&e.rtcpFeedbacks.splice(t,1)})}if(!0===t.remb){const t=i.find(e=>"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"===e.extensionName);if(t){e.attributes.extmaps.find(e=>"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"===e.extensionName)||e.attributes.extmaps.push({entry:t.entry,extensionName:"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"});(function(e,t){return t.filter(t=>!!e.find(e=>e.payloadType===t.payloadType&&!!e.rtcpFeedbacks.find(e=>"goog-remb"===e.type)))})(n,e.attributes.payloads).forEach(e=>{e.rtcpFeedbacks.find(e=>"goog-remb"===e.type)||e.rtcpFeedbacks.push({type:"goog-remb"})})}}else if(!1===t.remb){const t=e.attributes.extmaps.findIndex(e=>"http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time"===e.extensionName);-1!==t&&e.attributes.extmaps.splice(t,1),e.attributes.payloads.forEach(e=>{const t=e.rtcpFeedbacks.findIndex(e=>"goog-remb"===e.type);-1!==t&&e.rtcpFeedbacks.splice(t,1)})}}function KZ(e,t,r,i,n,o){if("videoExtensions"===r||"audioExtensions"===r){const s=[];return e[r].forEach(e=>{t[r].some((t,r)=>{if(e.entry===t.entry&&e.extensionName===t.extensionName)return s.push(r),!0})?o[r].push(e):i[r].push(e)}),void t[r].forEach((e,t)=>{-1===s.indexOf(t)&&n[r].push(e)})}if("videoCodecs"===r||"audioCodecs"===r){const s=[];return e[r].forEach(e=>{t[r].some((t,r)=>{if(e.payloadType===t.payloadType&&JSON.stringify(e)===JSON.stringify(t))return s.push(r),!0})?o[r].push(e):i[r].push(e)}),void t[r].forEach((e,t)=>{-1===s.indexOf(t)&&n[r].push(e)})}}function HZ(e){const{send:t,recv:r,sendrecv:i}=e;if(!i){if(!t||!r)throw new Error("cannot merge rtp capabilities because one of send or recv is empty!");return{send:t,recv:r}}let n,o;return t?(n={audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]},n.audioCodecs=[...t.audioCodecs,...i.audioCodecs],n.videoCodecs=[...t.videoCodecs,...i.videoCodecs],n.audioExtensions=[...t.audioExtensions,...i.audioExtensions],n.videoExtensions=[...t.videoExtensions,...i.videoExtensions]):n=i,r?(o={audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]},o.audioCodecs=[...r.audioCodecs,...i.audioCodecs],o.videoCodecs=[...r.videoCodecs,...i.videoCodecs],o.audioExtensions=[...r.audioExtensions,...i.audioExtensions],o.videoExtensions=[...r.videoExtensions,...i.videoExtensions]):o=i,{send:n,recv:o}}!function(e,t){e.exports=(()=>{var e={8:(e,t,r)=>{r.r(t),r.d(t,{Parser:()=>v,Printer:()=>w,parse:()=>D,print:()=>L});const i="\n",n="".concat("\r").concat(i),o=" ";let s;function a(e){return e>="0"&&e<="9"}function c(e){return e>="!"&&e<="~"}function d(e){return c(e)||e>="€"&&e<="ÿ"}function u(e){return"!"===e||e>="#"&&e<="'"||e>="*"&&e<="+"||e>="-"&&e<="."||e>="0"&&e<="9"||e>="A"&&e<="Z"||e>="^"&&e<="~"}function A(e){return e>="1"&&e<="9"}function h(e){return e>="A"&&e<="Z"||e>="a"&&e<="z"}function l(e){return"d"===e||"h"===e||"m"===e||"s"===e}function p(e){return e>""&&e<"\t"||e>"\v"&&e<"\f"||e>""&&e<"ÿ"}function g(e){return h(e)||a(e)||"+"===e||"/"===e}function f(e){return a(e)||h(e)||"+"===e||"/"===e||"-"===e||"_"===e}function E(e){return h(e)||a(e)||"+"===e||"/"===e}function I(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function m(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?I(Object(r),!0).forEach((function(t){_(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}!function(e){e.VERSION="v",e.ORIGIN="o",e.SESSION_NAME="s",e.INFORMATION="i",e.URI="u",e.EMAIL="e",e.PHONE="p",e.CONNECTION="c",e.BANDWIDTH="b",e.TIME="t",e.REPEAT="r",e.ZONE_ADJUSTMENTS="z",e.KEY="k",e.ATTRIBUTE="a",e.MEDIA="m"}(s||(s={}));class C{consumeText(e,t){let r=t;for(;r<e.length;){const t=e[r];if("\0"===t||"\r"===t||t===i)break;r+=1}if(r-t==0)throw new Error("Invalid text, at ".concat(e));return r}consumeUnicastAddress(e,t,r){return this.consumeTill(e,t,o)}consumeOneOrMore(e,t,r){let i=t;for(;r(e[i]);)i++;if(i-t==0)throw new Error("Invalid rule at ".concat(t,"."));return i}consumeSpace(e,t){if(e[t]===o)return t+1;throw new Error("Invalid space at ".concat(t,"."))}consumeIP4Address(e,t){let r=t;for(let t=0;t<4;t++)if(r=this.consumeDecimalUChar(e,r),3!==t){if("."!==e[r])throw new Error("Invalid IP4 address.");r++}return r}consumeDecimalUChar(e,t){let r=t;for(let t=0;t<3&&a(e[r]);t++,r++);if(r-t==0)throw new Error("Invalid decimal uchar.");const i=parseInt(e.slice(t,r));if(i>=0&&i<=255)return r;throw new Error("Invalid decimal uchar")}consumeIP6Address(e,t){let r=this.consumeHexpart(e,t);return":"===e[r]?(r+=1,r=this.consumeIP4Address(e,r),r):r}consumeHexpart(e,t){let r=t;if(":"===e[r]&&":"===e[r+1]){r+=2;try{r=this.consumeHexseq(e,r)}catch(e){}return r}if(r=this.consumeHexseq(e,r),":"===e[r]&&":"===e[r+1]){r+=2;try{r=this.consumeHexseq(e,r)}catch(e){}return r}return r}consumeHexseq(e,t){let r=t;for(;r=this.consumeHex4(e,r),":"===e[r]&&":"!==e[r+1];)r+=1;return r}consumeHex4(e,t){let r=0;for(;r<4;r++)if(!((i=e[t+r])>="0"&&i<="9"||i>="a"&&i<="f"||i>="A"&&i<="F")){if(0===r)throw new Error("Invalid hex 4");break}var i;return t+r}consumeFQDN(e,t){let r=t;for(;a(e[r])||h(e[r])||"-"===e[r]||"."===e[r];)r+=1;if(r-t<4)throw new Error("Invalid FQDN");return r}consumeExtnAddr(e,t){return this.consumeOneOrMore(e,t,d)}consumeMulticastAddress(e,t,r){switch(r){case"IP4":case"ip4":return this.consumeIP4MulticastAddress(e,t);case"IP6":case"ip6":return this.consumeIP6MulticastAddress(e,t);default:try{return this.consumeFQDN(e,t)}catch(r){return this.consumeExtnAddr(e,t)}}}consumeIP6MulticastAddress(e,t){const r=this.consumeHexpart(e,t);return"/"===e[r]?this.consumeInteger(e,r+1):r}consumeIP4MulticastAddress(e,t){let r=t+3;const i=e.slice(t,r),n=parseInt(i);if(n<224||n>239)throw new Error("Invalid IP4 multicast address, IPv4 multicast addresses may be in the range 224.0.0.0 to 239.255.255.255.");for(let t=0;t<3;t++){if("."!==e[r])throw new Error("Invalid IP4 multicast address.");r+=1,r=this.consumeDecimalUChar(e,r)}return"/"===e[r]&&(r+=1),r=this.consumeTTL(e,r),"/"===e[r]&&(r=this.consumeInteger(e,r)),r}consumeInteger(e,t){if(!A(e[t]))throw new Error("Invalid integer.");for(t+=1;a(e[t]);)t+=1;return t}consumeTTL(e,t){if("0"===e[t])return t+1;if(!A(e[t]))throw new Error("Invalid TTL.");t+=1;for(let r=0;r<2&&a(e[t]);r++)t+=1;return t}consumeToken(e,t){return this.consumeOneOrMore(e,t,u)}consumeTime(e,t){let r=t;if("0"===e[r])return r+1;for(A(e[r])&&(r+=1);a(e[r]);)r++;if(r-t<10)throw new Error("Invalid time");return r}consumeAddress(e,t){return this.consumeTill(e,t,o)}consumeTypedTime(e,t){let r=t;return r=this.consumeOneOrMore(e,r,a),l(e[r])?r+1:r}consumeRepeatInterval(e,t){if(!A(e[t]))throw new Error("Invalid repeat interval");for(t+=1;a(e[t]);)t+=1;return l(e[t])&&(t+=1),t}consumePort(e,t){return this.consumeOneOrMore(e,t,a)}consume(e,t,r){for(let i=0;i<r.length;i++){if(t+i>=e.length)throw new Error("consume exceeding value length");if(e[t+i]!==r[i])throw new Error("consume ".concat(r," failed at ").concat(i))}return t+r.length}consumeTill(e,t,r){let i=t;for(;i<e.length&&("string"!=typeof r||e[i]!==r)&&("function"!=typeof r||!r(e[i]));)i++;return i}}class v extends C{constructor(){super(),_(this,"records",[]),_(this,"currentLine",0)}parse(e){const t=this.probeEOL(e);this.records=e.split(t).filter(e=>!!e.trim()).map(this.parseLine),this.currentLine=0;const r=this.parseVersion(),i=this.parseOrigin(),n=this.parseSessionName(),o=this.parseInformation(),s=this.parseUri(),a=this.parseEmail(),c=this.parsePhone(),d=this.parseConnection(),u=this.parseBandWidth(),A=this.parseTimeFields(),h=this.parseKey(),l=this.parseSessionAttribute(),p=this.parseMediaDescription();if(this.currentLine!==this.records.length)throw new Error("parsing failed, non exhaustive sdp lines.");return{version:r,origin:i,sessionName:n,information:o,uri:s,emails:a,phones:c,connection:d,bandwidths:u,timeFields:A,key:h,attributes:l,mediaDescriptions:p}}getCurrentRecord(){const e=this.records[this.currentLine];if(!e)throw new Error("Record doesn't exit.");return e}probeEOL(e){for(let t=0;t<e.length;t++)if(e[t]===i)return"\r"===e[t-1]?n:i;throw new Error("Invalid newline character.")}parseLine(e,t){if(e.length<2)throw new Error("Invalid sdp line, sdp line should be of form <type>=<value>.");const r=e[0];if("="!==e[1])throw new Error('Invalid sdp line, <type> should be a single character followed by an "=" sign.');return{type:r,value:e.slice(2),line:t,cur:0}}parseSessionAttribute(){const e=new y;for(;this.currentLine<this.records.length;){const t=this.getCurrentRecord();if(t.type!==s.ATTRIBUTE)break;const r={attField:this.extractOneOrMore(t,e=>u(e)&&":"!==e),_cur:0};":"===t.value[t.cur]&&(t.cur+=1,r.attValue=this.extractOneOrMore(t,p)),e.parse(r),this.currentLine++}return e.digest()}parseMediaAttributes(e){const t=new R(e);for(;this.currentLine<this.records.length;){const e=this.getCurrentRecord();if(e.type!==s.ATTRIBUTE)break;const r={attField:this.extractOneOrMore(e,e=>u(e)&&":"!==e),_cur:0};":"===e.value[e.cur]&&(e.cur+=1,r.attValue=this.extractOneOrMore(e,p)),t.parse(r),this.currentLine++}return t.digest()}parseKey(){const e=this.getCurrentRecord();if(e.type===s.KEY){if("prompt"===e.value||"clear:"===e.value||"base64:"===e.value||"uri:"===e.value)return e.value;throw this.currentLine++,new Error("Invalid key.")}}parseZone(){const e=this.getCurrentRecord();if(e.type===s.ZONE_ADJUSTMENTS){const t=[];for(;;)try{const r=this.extract(e,this.consumeTime);this.consumeSpaceForRecord(e);let i=!1;"-"===e.value[e.cur]&&(i=!0,e.cur+=1);const n=this.extract(e,this.consumeTypedTime);t.push({time:r,typedTime:n,back:i})}catch(e){break}if(0===t.length)throw new Error("Invalid zone adjustments");return this.currentLine++,t}return[]}parseRepeat(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.REPEAT)break;{const r=this.extract(t,this.consumeRepeatInterval),i=this.parseTypedTime(t);e.push({repeatInterval:r,typedTimes:i}),this.currentLine++}}return e}parseTypedTime(e){const t=[];for(;;)try{this.consumeSpaceForRecord(e),t.push(this.extract(e,this.consumeTypedTime))}catch(e){break}if(0===t.length)throw new Error("Invalid typed time.");return t}parseTime(){const e=this.getCurrentRecord(),t=this.extract(e,this.consumeTime);this.consumeSpaceForRecord(e);const r=this.extract(e,this.consumeTime);return this.currentLine++,{startTime:t,stopTime:r}}parseBandWidth(){const e=[];for(;this.currentLine<this.records.length;){const t=this.getCurrentRecord();if(t.type!==s.BANDWIDTH)break;{const r=this.extractOneOrMore(t,u);if(":"!==t.value[t.cur])throw new Error("Invalid bandwidth field.");t.cur++;const i=this.extractOneOrMore(t,a);e.push({bwtype:r,bandwidth:i}),this.currentLine++}}return e}parseVersion(){const e=this.getCurrentRecord();if(e.type!==s.VERSION)throw new Error("first sdp record must be version");const t=e.value.slice(0,this.consumeOneOrMore(e.value,0,a));if(t.length!==e.value.length)throw new Error('invalid proto version, "v='.concat(e.value,'"'));return this.currentLine++,t}parseOrigin(){const e=this.getCurrentRecord();if(e.type!==s.ORIGIN)throw new Error("second line of sdp must be origin");const t=this.extractOneOrMore(e,d);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,a);this.consumeSpaceForRecord(e);const i=this.extractOneOrMore(e,a);this.consumeSpaceForRecord(e);const n=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const o=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const c=this.extract(e,this.consumeUnicastAddress);return this.currentLine++,{username:t,sessId:r,sessVersion:i,nettype:n,addrtype:o,unicastAddress:c}}parseSessionName(){const e=this.getCurrentRecord();if(e.type===s.SESSION_NAME){const t=this.extract(e,this.consumeText);return this.currentLine++,t}}parseInformation(){const e=this.getCurrentRecord();if(e.type!==s.INFORMATION)return;const t=this.extract(e,this.consumeText);return this.currentLine++,t}parseUri(){const e=this.getCurrentRecord();if(e.type===s.URI)return this.currentLine++,e.value}parseEmail(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.EMAIL)break;e.push(t.value),this.currentLine++}return e}parsePhone(){const e=[];for(;;){const t=this.getCurrentRecord();if(t.type!==s.PHONE)break;e.push(t.value),this.currentLine++}return e}parseConnection(){const e=this.getCurrentRecord();if(e.type===s.CONNECTION){const t=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const r=this.extractOneOrMore(e,u);this.consumeSpaceForRecord(e);const i=this.extract(e,this.consumeAddress);return this.currentLine++,{nettype:t,addrtype:r,address:i}}}parseMedia(){const e=this.getCurrentRecord(),t=this.extract(e,this.consumeToken);this.consumeSpaceForRecord(e);let r=this.extract(e,this.consumePort);"/"===e.value[e.cur]&&(e.cur+=1,r+=this.extract(e,this.consumeInteger)),this.consumeSpaceForRecord(e);const i=[];for(i.push(this.extract(e,this.consumeToken));"/"===e.value[e.cur];)e.cur+=1,i.push(this.extract(e,this.consumeToken));if(0===i.length)throw new Error("Invalid proto");const n=this.parseFmt(e);return this.currentLine++,{mediaType:t,port:r,protos:i,fmts:n}}parseTimeFields(){const e=[];for(;this.getCurrentRecord().type===s.TIME;){const t=this.parseTime(),r=this.parseRepeat(),i=this.parseZone();e.push({time:t,repeats:r,zones:i})}return e}parseMediaDescription(){const e=[];for(;this.currentLine<this.records.length&&this.getCurrentRecord().type===s.MEDIA;){const t=this.parseMedia(),r=this.parseInformation(),i=this.parseConnections(),n=this.parseBandWidth(),o=this.parseKey(),s=this.parseMediaAttributes(t);e.push({media:t,information:r,connections:i,bandwidths:n,key:o,attributes:s})}return e}parseConnections(){const e=[];for(;this.currentLine<this.records.length&&this.getCurrentRecord().type===s.CONNECTION;)e.push(this.parseConnection());return e}parseFmt(e){const t=[];for(;;)try{this.consumeSpaceForRecord(e),t.push(this.extract(e,this.consumeToken))}catch(e){break}if(0===t.length)throw new Error("Invalid fmts");return t}extract(e,t,...r){const i=t.call(this,e.value,e.cur,...r),n=e.value.slice(e.cur,i);return e.cur=i,n}extractOneOrMore(e,t){const r=this.consumeOneOrMore(e.value,e.cur,t),i=e.value.slice(e.cur,r);return e.cur=r,i}consumeSpaceForRecord(e){if(e.value[e.cur]!==o)throw new Error("Invalid space at ".concat(e.cur,"."));e.cur+=1}}class S extends C{constructor(...e){super(...e),_(this,"attributes",void 0),_(this,"digested",!1)}extractOneOrMore(e,t,r){const i=this.consumeOneOrMore(e.attValue,e._cur,t),n=e.attValue.slice(e._cur,i),[o,s]=r||[];if("number"==typeof o&&n.length<o)throw new Error("error in length, should be more or equal than ".concat(o," characters."));if("number"==typeof s&&n.length>s)throw new Error("error in length, should be less or equal than ".concat(s," characters."));return e._cur=i,n}consumeAttributeSpace(e){if(e.attValue[e._cur]!==o)throw new Error("Invalid space at ".concat(e._cur,"."));e._cur+=1}extract(e,t,...r){if(!e.attValue)throw new Error("Nothing to extract from attValue.");const i=t.call(this,e.attValue,e._cur,...r),n=e.attValue.slice(e._cur,i);return e._cur=i,n}atEnd(e){if(!e.attValue)throw new Error;return e._cur>=e.attValue.length}peekChar(e){if(!e.attValue)throw new Error;return e.attValue[e._cur]}peek(e,t){if(!e.attValue)throw new Error;for(let r=0;r<t.length;r++)if(t[r]!==e.attValue[e._cur+r])return!1;return!0}parseIceUfrag(e){if(this.attributes.iceUfrag)throw new Error("Invalid ice-ufrag, should be only a single line if 'a=ice-ufrag'");this.attributes.iceUfrag=this.extractOneOrMore(e,g,[4,256])}parseIcePwd(e){if(this.attributes.icePwd)throw new Error("Invalid ice-pwd, should be only a single line if 'a=ice-pwd'");this.attributes.icePwd=this.extractOneOrMore(e,g,[22,256])}parseIceOptions(e){if(this.attributes.iceOptions)throw new Error("Invalid ice-options, should be only one 'ice-options' line");const t=[];for(;!this.atEnd(e);){t.push(this.extractOneOrMore(e,g));try{this.consumeAttributeSpace(e)}catch(t){if(this.atEnd(e))break;throw t}}this.attributes.iceOptions=t}parseFingerprint(e){const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill);this.attributes.fingerprints.push({hashFunction:t,fingerprint:r})}parseExtmap(e){const t=this.extractOneOrMore(e,a);let r;"/"===this.peekChar(e)&&(this.extract(e,this.consume,"/"),r=this.extract(e,this.consumeToken)),this.consumeAttributeSpace(e);const i=this.extract(e,this.consumeTill,o),n=m(m({entry:parseInt(t,10)},r&&{direction:r}),{},{extensionName:i});this.peekChar(e)===o&&(this.consumeAttributeSpace(e),n.extensionAttributes=this.extract(e,this.consumeTill)),this.attributes.extmaps.push(n)}parseSetup(e){if(this.attributes.setup)throw new Error("must only be one single 'a=setup' line.");const t=this.extract(e,this.consumeTill);if("active"!==t&&"passive"!==t&&"actpass"!==t&&"holdconn"!==t)throw new Error("role must be one of 'active', 'passive', 'actpass', 'holdconn'.");this.attributes.setup=t}}class y extends S{constructor(...e){super(...e),_(this,"attributes",{unrecognized:[],groups:[],extmaps:[],fingerprints:[],identities:[]})}parse(e){if(this.digested)throw new Error("already digested");try{switch(e.attField){case"group":this.parseGroup(e);break;case"ice-lite":this.parseIceLite();break;case"ice-ufrag":this.parseIceUfrag(e);break;case"ice-pwd":this.parseIcePwd(e);break;case"ice-options":this.parseIceOptions(e);break;case"fingerprint":this.parseFingerprint(e);break;case"setup":this.parseSetup(e);break;case"tls-id":this.parseTlsId(e);break;case"identity":this.parseIdentity(e);break;case"extmap":this.parseExtmap(e);break;case"msid-semantic":this.parseMsidSemantic(e);break;default:e.ignored=!0,this.attributes.unrecognized.push(e)}}catch(t){throw console.error("parsing session attribute ".concat(e.attField,' error, "a=').concat(e.attField,":").concat(e.attValue,'"')),t}if(!e.ignored&&e.attValue&&!this.atEnd(e))throw new Error("attribute parsing error")}digest(){return this.digested=!0,this.attributes}parseGroup(e){const t=this.extract(e,this.consumeToken),r=[];for(;!this.atEnd(e)&&this.peekChar(e)===o;)this.consumeAttributeSpace(e),r.push(this.extract(e,this.consumeToken));this.attributes.groups.push({semantic:t,identificationTag:r})}parseIceLite(){if(this.attributes.iceLite)throw new Error("Invalid ice-lite, should be only a single line of 'a=ice-lite'");this.attributes.iceLite=!0}parseTlsId(e){if(this.attributes.tlsId)throw new Error("must be only one tld-id line");this.attributes.tlsId=this.extractOneOrMore(e,f)}parseIdentity(e){const t=this.extractOneOrMore(e,E),r=[];for(;!this.atEnd(e)&&this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.extract(e,this.consume,"=");const i=this.extractOneOrMore(e,e=>e!==o&&p(e));r.push({name:t,value:i})}this.attributes.identities.push({assertionValue:t,extensions:r})}parseMsidSemantic(e){this.peekChar(e)===o&&this.consumeAttributeSpace(e);const t={semantic:this.extract(e,this.consumeToken),identifierList:[]};for(;;){try{this.consumeAttributeSpace(e)}catch(e){break}if("*"===this.peekChar(e)){this.extract(e,this.consume,"*"),t.applyForAll=!0;break}{const r=this.extract(e,this.consumeTill,o);t.identifierList.push(r)}}this.attributes.msidSemantic=t}}class R extends S{constructor(e){super(),_(this,"attributes",void 0),-1!==e.protos.indexOf("RTP")||e.protos.indexOf("rtp"),this.attributes={unrecognized:[],candidates:[],extmaps:[],fingerprints:[],imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:[],ssrcGroups:[],rtcpFeedbackWildcards:[],payloads:[]}}parse(e){if(this.digested)throw new Error("already digested");try{switch(e.attField){case"extmap":this.parseExtmap(e);break;case"setup":this.parseSetup(e);break;case"ice-ufrag":this.parseIceUfrag(e);break;case"ice-pwd":this.parseIcePwd(e);break;case"ice-options":this.parseIceOptions(e);break;case"candidate":this.parseCandidate(e);break;case"remote-candidate":this.parseRemoteCandidate(e);break;case"end-of-candidates":this.parseEndOfCandidates();break;case"fingerprint":this.parseFingerprint(e);break;case"rtpmap":this.parseRtpmap(e);break;case"ptime":this.parsePtime(e);break;case"maxptime":this.parseMaxPtime(e);break;case"sendrecv":case"recvonly":case"sendonly":case"inactive":this.parseDirection(e);break;case"ssrc":this.parseSSRC(e);break;case"fmtp":this.parseFmtp(e);break;case"rtcp-fb":this.parseRtcpFb(e);break;case"rtcp-mux":this.parseRTCPMux();break;case"rtcp-mux-only":this.parseRTCPMuxOnly();break;case"rtcp-rsize":this.parseRTCPRsize();break;case"rtcp":this.parseRTCP(e);break;case"mid":this.parseMid(e);break;case"msid":this.parseMsid(e);break;case"imageattr":this.parseImageAttr(e);break;case"rid":this.parseRid(e);break;case"simulcast":this.parseSimulcast(e);break;case"sctp-port":this.parseSctpPort(e);break;case"max-message-size":this.parseMaxMessageSize(e);break;case"ssrc-group":this.parseSSRCGroup(e);break;default:e.ignored=!0,this.attributes.unrecognized.push(e)}}catch(t){throw console.error("parsing media attribute ".concat(e.attField,' error, "a=').concat(e.attField,":").concat(e.attValue,'"')),t}if(!e.ignored&&e.attValue&&!this.atEnd(e))throw new Error("attribute parsing error")}parseCandidate(e){const t=this.extractOneOrMore(e,g,[1,32]);this.consumeAttributeSpace(e);const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const i=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const n=this.extractOneOrMore(e,a,[1,10]);this.consumeAttributeSpace(e);const s=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const d=this.extract(e,this.consumePort);this.consumeAttributeSpace(e),this.extract(e,this.consume,"typ"),this.consumeAttributeSpace(e);const u={foundation:t,componentId:r,transport:i,priority:n,connectionAddress:s,port:d,type:this.extract(e,this.consumeToken),extension:{}};for(this.peek(e," raddr")&&(this.extract(e,this.consume," raddr"),this.consumeAttributeSpace(e),u.relAddr=this.extract(e,this.consumeAddress)),this.peek(e," rport")&&(this.extract(e,this.consume," rport"),this.consumeAttributeSpace(e),u.relPort=this.extract(e,this.consumePort));this.peekChar(e)===o;){this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e),u.extension[t]=this.extractOneOrMore(e,c)}this.attributes.candidates.push(u)}parseRemoteCandidate(e){const t=[];for(;;){const r=this.extractOneOrMore(e,a,[1,5]);this.consumeAttributeSpace(e);const i=this.extract(e,this.consumeAddress);this.consumeAttributeSpace(e);const n=this.extract(e,this.consumePort);t.push({componentId:r,connectionAddress:i,port:n});try{this.consumeAttributeSpace(e)}catch(e){break}}this.attributes.remoteCandidatesList.push(t)}parseEndOfCandidates(){if(this.attributes.endOfCandidates)throw new Error("must be only one line of end-of-candidates");this.attributes.endOfCandidates=!0}parseRtpmap(e){const t=this.extract(e,this.consumeToken);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,"/");this.extract(e,this.consume,"/");const i={encodingName:r,clockRate:this.extractOneOrMore(e,a)};this.atEnd(e)||"/"!==this.peekChar(e)||(this.extract(e,this.consume,"/"),i.encodingParameters=parseInt(this.extract(e,this.consumeTill),10));const n=this.attributes.payloads.find(e=>e.payloadType===parseInt(t,10));n?n.rtpMap=i:this.attributes.payloads.push({payloadType:parseInt(t,10),rtpMap:i,rtcpFeedbacks:[]})}parsePtime(e){if(this.attributes.ptime)throw new Error("must be only one line of ptime");this.attributes.ptime=this.extract(e,this.consumeTill)}parseMaxPtime(e){if(this.attributes.maxPtime)throw new Error("must be only one line of ptime");this.attributes.maxPtime=this.extract(e,this.consumeTill)}parseDirection(e){if(this.attributes.direction)throw new Error("must be only one line of direction info");this.attributes.direction=e.attField}parseSSRC(e){const t=this.extractOneOrMore(e,a);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,":");let i;":"===this.peekChar(e)&&(this.extract(e,this.consume,":"),i=this.extract(e,this.consumeTill));const n=this.attributes.ssrcs.find(e=>e.ssrcId===parseInt(t,10));n?n.attributes[r]=i:this.attributes.ssrcs.push({ssrcId:parseInt(t,10),attributes:{[r]:i}})}parseFmtp(e){const t=this.extract(e,this.consumeTill,o);this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill),i={};r.split(";").forEach(e=>{let[t,r]=e.split("=");t=t.trim(),r="string"==typeof r?r.trim():r,"string"==typeof t&&t.length>0&&(i[t]=r)});const n=this.attributes.payloads.find(e=>e.payloadType===parseInt(t,10));n?n.fmtp={parameters:i}:this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[],fmtp:{parameters:i}})}parseFmtParameters(e){const t={},r=this.extract(e,this.consumeTill,"=");e._cur++;const i=this.extract(e,this.consumeTill,";");for(t[r]=i;";"===e.attValue[e._cur];){const r=this.extract(e,this.consumeTill,"=");e._cur++;const i=this.extract(e,this.consumeTill,";");t[r]=i}return t}parseRtcpFb(e){let t="";t="*"===this.peekChar(e)?this.extract(e,this.consume,"*"):this.extract(e,this.consumeTill,o),this.consumeAttributeSpace(e);const r=this.extract(e,this.consumeTill,o);let i;switch(r){case"trr-int":i={type:r,interval:this.extract(e,this.consumeTill)};break;case"ack":case"nack":default:{const t={type:r};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.parameter=this.extract(e,this.consumeToken),this.peekChar(e)===o&&(t.additional=this.extract(e,this.consumeTill))),i=t}}if("*"===t)this.attributes.rtcpFeedbackWildcards.push(i);else{const e=this.attributes.payloads.find(e=>e.payloadType===parseInt(t,10));e?e.rtcpFeedbacks.push(i):this.attributes.payloads.push({payloadType:parseInt(t,10),rtcpFeedbacks:[i]})}}parseRTCPMux(){if(this.attributes.rtcpMux)throw new Error("must be single line of rtcp-mux");this.attributes.rtcpMux=!0}parseRTCPMuxOnly(){if(this.attributes.rtcpMuxOnly)throw new Error("must be single line of rtcp-only");this.attributes.rtcpMuxOnly=!0}parseRTCPRsize(){if(this.attributes.rtcpRsize)throw new Error("must be single line of rtcp-rsize");this.attributes.rtcpRsize=!0}parseRTCP(e){if(this.attributes.rtcp)throw new Error("must be single line of rtcp");const t={port:this.extract(e,this.consumePort)};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.netType=this.extractOneOrMore(e,u),this.consumeAttributeSpace(e),t.addressType=this.extractOneOrMore(e,u),this.consumeAttributeSpace(e),t.address=this.extract(e,this.consumeAddress)),this.attributes.rtcp=t}parseMsid(e){const t={id:this.extractOneOrMore(e,u,[1,64])};this.peekChar(e)===o&&(this.consumeAttributeSpace(e),t.appdata=this.extractOneOrMore(e,u,[1,64])),this.attributes.msids.push(t)}parseImageAttr(e){this.attributes.imageattr.push(e.attValue)}parseRid(e){const t=this.extractOneOrMore(e,e=>h(e)||a(e)||"_"===e||"-"===e);this.consumeAttributeSpace(e);const r={id:t,direction:this.extract(e,this.consumeToken),params:[]};if(this.peekChar(e)===o){if(this.consumeAttributeSpace(e),this.peek(e,"pt=")){this.extract(e,this.consume,"pt=");const t=[];for(;;){const r=this.extract(e,this.consumeToken);t.push(r);try{this.extract(e,this.consume,",")}catch(e){break}}r.payloads=t,this.peekChar(e)===o&&this.extract(e,this.consume,o)}for(;;){const t=this.extract(e,this.consumeToken);switch(t){case"depend":{const i={type:t,rids:this.extract(e,this.consume,"=").split(",")};r.params.push(i);break}case"max-width":case"height-width":case"max-fps":case"max-fs":case"max-br":case"max-pps":case"max-bpp":default:{const i={type:t};"="===this.peekChar(e)&&(this.extract(e,this.consume,"="),i.val=this.extract(e,this.consumeTill,";")),r.params.push(i)}}try{this.extract(e,this.consume,";")}catch(e){break}}}this.attributes.rids.push(r)}parseSimulcast(e){if(this.attributes.simulcast)throw new Error("must be single line of simulcast");this.attributes.simulcast=e.attValue,this.extract(e,this.consumeTill)}parseSctpPort(e){this.attributes.sctpPort=this.extractOneOrMore(e,a,[1,5])}parseMaxMessageSize(e){this.attributes.maxMessageSize=this.extractOneOrMore(e,a,[1,void 0])}digest(){return this.digested=!0,this.attributes}parseMid(e){this.attributes.mid=this.extract(e,this.consumeToken)}parseSSRCGroup(e){const t=this.extract(e,this.consumeToken),r=[];for(;;)try{this.consumeAttributeSpace(e);const t=this.extract(e,this.consumeInteger);r.push(parseInt(t,10))}catch(e){break}this.attributes.ssrcGroups.push({semantic:t,ssrcIds:r})}}function T(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}class w{constructor(){T(this,"eol",n)}print(e,t){let r="";return t&&(this.eol=t),r+=this.printVersion(e.version),r+=this.printOrigin(e.origin),r+=this.printSessionName(e.sessionName),r+=this.printInformation(e.information),r+=this.printUri(e.uri),r+=this.printEmail(e.emails),r+=this.printPhone(e.phones),r+=this.printConnection(e.connection),r+=this.printBandwidth(e.bandwidths),r+=this.printTimeFields(e.timeFields),r+=this.printKey(e.key),r+=this.printSessionAttributes(e.attributes),r+=this.printMediaDescription(e.mediaDescriptions),r}printVersion(e){return"v=".concat(e).concat(this.eol)}printOrigin(e){return"o=".concat(e.username," ").concat(e.sessId," ").concat(e.sessVersion," ").concat(e.nettype," ").concat(e.addrtype," ").concat(e.unicastAddress).concat(this.eol)}printSessionName(e){return e?"s=".concat(e).concat(this.eol):""}printInformation(e){return e?"i=".concat(e).concat(this.eol):""}printUri(e){return e?"u=".concat(e).concat(this.eol):""}printEmail(e){let t="";for(const r of e)t+="e=".concat(r).concat(this.eol);return t}printPhone(e){let t="";for(const r of e)t+="e=".concat(r).concat(this.eol);return t}printConnection(e){return e?"c=".concat(e.nettype," ").concat(e.addrtype," ").concat(e.address).concat(this.eol):""}printBandwidth(e){let t="";for(const r of e)t+="b=".concat(r.bwtype,":").concat(r.bandwidth).concat(this.eol);return t}printTimeFields(e){let t="";for(const r of e){t+="t=".concat(r.time.startTime," ").concat(r.time.startTime).concat(this.eol);for(const e of r.repeats)t+="r=".concat(e.repeatInterval," ").concat(e.typedTimes.join(" ")).concat(this.eol);r.zoneAdjustments&&(t+="z=",t+="z=".concat(r.zoneAdjustments.map(e=>"".concat(e.time," ").concat(e.back?"-":""," ").concat(e.typedTime)).join(" ")).concat(this.eol),t+=this.eol)}return t}printKey(e){return e?"k=".concat(e).concat(this.eol):""}printAttributes(e){let t="";for(const r of e)t+="a=".concat(r.attField).concat(r.attValue?":".concat(r.attValue):"").concat(this.eol);return t}printMediaDescription(e){let t="";for(const r of e)t+=this.printMedia(r.media),t+=this.printInformation(r.information),t+=this.printConnections(r.connections),t+=this.printBandwidth(r.bandwidths),t+=this.printKey(r.key),t+=this.printMediaAttributes(r);return t}printConnections(e){let t="";for(const r of e)t+=this.printConnection(r);return t}printMedia(e){return"m=".concat(e.mediaType," ").concat(e.port," ").concat(e.protos.join("/")," ").concat(e.fmts.join(" ")).concat(this.eol)}printSessionAttributes(e){return new O(this.eol).print(e)}printMediaAttributes(e){return new N(this.eol).print(e)}}class b{constructor(e){T(this,"eol",void 0),this.eol=e}printIceUfrag(e){return void 0===e?"":"a=ice-ufrag:".concat(e).concat(this.eol)}printIcePwd(e){return void 0===e?"":"a=ice-pwd:".concat(e).concat(this.eol)}printIceOptions(e){return void 0===e?"":"a=ice-options:".concat(e.join(o)).concat(this.eol)}printFingerprints(e){return e.length>0?e.map(e=>"a=fingerprint:".concat(e.hashFunction).concat(o).concat(e.fingerprint)).join(this.eol)+this.eol:""}printExtmap(e){return e.map(e=>"a=extmap:".concat(e.entry).concat(e.direction?"/".concat(e.direction):"").concat(o).concat(e.extensionName).concat(e.extensionAttributes?"".concat(o).concat(e.extensionAttributes):"").concat(this.eol)).join("")}printSetup(e){return void 0===e?"":"a=setup:".concat(e).concat(this.eol)}printUnrecognized(e){return e.map(e=>"a=".concat(e.attField).concat(e.attValue?":".concat(e.attValue):"").concat(this.eol)).join("")}}class O extends b{print(e){let t="";return t+=this.printGroups(e.groups),t+=this.printMsidSemantic(e.msidSemantic),t+=this.printIceLite(e.iceLite),t+=this.printIceUfrag(e.iceUfrag),t+=this.printIcePwd(e.icePwd),t+=this.printIceOptions(e.iceOptions),t+=this.printFingerprints(e.fingerprints),t+=this.printSetup(e.setup),t+=this.printTlsId(e.tlsId),t+=this.printIdentity(e.identities),t+=this.printExtmap(e.extmaps),t+=this.printUnrecognized(e.unrecognized),t}printGroups(e){let t="";return e.length>0&&(t+=e.map(e=>"a=group:".concat(e.semantic).concat(e.identificationTag.map(e=>"".concat(o).concat(e)).join("")).concat(this.eol)).join("")),t}printIceLite(e){return void 0===e?"":"a=ice-lite"+this.eol}printTlsId(e){return e?"a=tls-id:".concat(e).concat(this.eol):""}printIdentity(e){return 0===e.length?"":e.map(e=>"a=identity:".concat(e.assertionValue).concat(e.extensions.map(e=>"".concat(o).concat(e.name).concat(e.value?"=".concat(e.value):"")))).join(this.eol)+this.eol}printMsidSemantic(e){if(!e)return"";let t="a=msid-semantic:".concat(e.semantic);return e.applyForAll?t+="".concat(o,"*"):e.identifierList.length>0&&(t+=e.identifierList.map(e=>"".concat(o).concat(e))),t+this.eol}}class N extends b{print(e){const t=e.attributes;let r="";return r+=this.printRTCP(t.rtcp),r+=this.printIceUfrag(t.iceUfrag),r+=this.printIcePwd(t.icePwd),r+=this.printIceOptions(t.iceOptions),r+=this.printCandidates(t.candidates),r+=this.printRemoteCandidatesList(t.remoteCandidatesList),r+=this.printEndOfCandidates(t.endOfCandidates),r+=this.printFingerprints(t.fingerprints),r+=this.printSetup(t.setup),r+=this.printMid(t.mid),r+=this.printExtmap(t.extmaps),r+=this.printRTPRelated(t),r+=this.printPtime(t.ptime),r+=this.printMaxPtime(t.maxPtime),r+=this.printDirection(t.direction),r+=this.printSSRCGroups(t.ssrcGroups),r+=this.printSSRC(t.ssrcs),r+=this.printRTCPMux(t.rtcpMux),r+=this.printRTCPMuxOnly(t.rtcpMuxOnly),r+=this.printRTCPRsize(t.rtcpRsize),r+=this.printMSId(t.msids),r+=this.printImageattr(t.imageattr),r+=this.printRid(t.rids),r+=this.printSimulcast(t.simulcast),r+=this.printSCRPPort(t.sctpPort),r+=this.printMaxMessageSize(t.maxMessageSize),r+=this.printUnrecognized(t.unrecognized),r}printCandidates(e){return e.map(e=>"a=candidate:".concat(e.foundation).concat(o).concat(e.componentId).concat(o).concat(e.transport).concat(o).concat(e.priority).concat(o).concat(e.connectionAddress).concat(o).concat(e.port).concat(o,"typ").concat(o).concat(e.type).concat(e.relAddr?"".concat(o,"raddr").concat(o).concat(e.relAddr):"").concat(e.relPort?"".concat(o,"rport").concat(o).concat(e.relPort):"").concat(Object.keys(e.extension).map(t=>"".concat(o).concat(t).concat(o).concat(e.extension[t])).join("")).concat(this.eol)).join("")}printRemoteCandidatesList(e){return e.map(e=>"a=remote-candidates:".concat(e.join(o)).concat(this.eol)).join("")}printEndOfCandidates(e){return void 0===e?"":"a=end-of-candidates"+this.eol}printRTPRelated(e){if(!e.payloads)return"";const t=e.payloads;let r="";r+=e.rtcpFeedbackWildcards.map(e=>this.printRTCPFeedback("*",e)).join("");for(const e of t)r+=this.printRtpMap(e.payloadType,e.rtpMap),r+=this.printFmtp(e.payloadType,e.fmtp),r+=e.rtcpFeedbacks.map(t=>this.printRTCPFeedback(e.payloadType,t)).join("");return r}printFmtp(e,t){if(!t)return"";const r=Object.keys(t.parameters);return 1===r.length&&void 0===t.parameters[r[0]]?"a=fmtp:".concat(e).concat(o).concat(r[0]).concat(this.eol):"a=fmtp:".concat(e).concat(o).concat(Object.keys(t.parameters).map(e=>"".concat(e,"=").concat(t.parameters[e])).join(";")).concat(this.eol)}printRtpMap(e,t){return t?"a=rtpmap:".concat(e).concat(o).concat(t.encodingName,"/").concat(t.clockRate).concat(t.encodingParameters?"/".concat(t.encodingParameters):"").concat(this.eol):""}printRTCPFeedback(e,t){let r="a=rtcp-fb:".concat(e).concat(o),i=t;switch(i.type){case"trr-int":r+="ttr-int".concat(o).concat(i.interval);break;case"ack":case"nack":default:i=i,r+="".concat(i.type),i.parameter&&(r+="".concat(o).concat(i.parameter),i.additional&&(r+="".concat(o).concat(i.additional)))}return r+this.eol}printPtime(e){return void 0===e?"":"a=ptime:".concat(e).concat(this.eol)}printMaxPtime(e){return void 0===e?"":"a=maxptime:".concat(e).concat(this.eol)}printDirection(e){return void 0===e?"":"a=".concat(e).concat(this.eol)}printSSRC(e){return e.map(e=>Object.keys(e.attributes).map(t=>"a=ssrc:".concat(e.ssrcId.toString(10)).concat(o).concat(t).concat(e.attributes[t]?":".concat(e.attributes[t]):"").concat(this.eol)).join("")).join("")}printRTCPMux(e){return void 0===e?"":"a=rtcp-mux".concat(this.eol)}printRTCPMuxOnly(e){return void 0===e?"":"a=rtcp-mux-only".concat(this.eol)}printRTCPRsize(e){return void 0===e?"":"a=rtcp-rsize".concat(this.eol)}printRTCP(e){if(void 0===e)return"";let t="a=rtcp:".concat(e.port);return e.netType&&(t+="".concat(o).concat(e.netType)),e.addressType&&(t+="".concat(o).concat(e.addressType)),e.address&&(t+="".concat(o).concat(e.address)),t+this.eol}printMSId(e){return e.map(e=>"a=msid:".concat(e.id).concat(e.appdata?"".concat(o).concat(e.appdata):"").concat(this.eol)).join("")}printImageattr(e){return e.map(e=>"a=imageattr:".concat(e).concat(this.eol)).join("")}printRid(e){return e.map(e=>{let t="a=rid:".concat(e.id).concat(o).concat(e.direction);return e.payloads&&(t+="".concat(o,"pt=").concat(e.payloads.join(","))),e.params.length>0&&(t+="".concat(o).concat(e.params.map(e=>"depend"===e.type?"depend=".concat(e.rids.join(",")):"".concat(e.type,"=").concat(e.val)).join(";"))),t+this.eol}).join("")}printSimulcast(e){return void 0===e?"":"a=simulcast:".concat(e).concat(this.eol)}printSCRPPort(e){return void 0===e?"":"a=sctp-port:".concat(e).concat(this.eol)}printMaxMessageSize(e){return void 0===e?"":"a=max-message-size:".concat(e)}printMid(e){return void 0===e?"":"a=mid:".concat(e).concat(this.eol)}printSSRCGroups(e){return e.map(e=>"a=ssrc-group:".concat(e.semantic).concat(e.ssrcIds.map(e=>"".concat(o).concat(e.toString(10))).join("")).concat(this.eol)).join("")}}function D(e){return(new v).parse(e)}function L(e,t){return(new w).print(e,t)}}},t={};function r(i){if(t[i])return t[i].exports;var n=t[i]={exports:{}};return e[i](n,n.exports,r),n.exports}return r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r(8)})()}(kZ);class YZ{constructor(e){kO(this,"sessionDesc",void 0),kO(this,"localCapabilities",void 0),kO(this,"rtpCapabilities",void 0),kO(this,"candidates",void 0),kO(this,"iceParameters",void 0),kO(this,"dtlsParameters",void 0),kO(this,"setup",void 0),kO(this,"currentMidIndex",void 0),kO(this,"cname",void 0),e=PG(e);const{remoteIceParameters:t,remoteDtlsParameters:r,candidates:i,remoteRTPCapabilities:n,remoteSetup:o,localCapabilities:s,sdkCodec:a,cname:c}=e,d=kZ.exports.parse("v=0\no=- 0 0 IN IP4 127.0.0.1\ns=AgoraGateway\nt=0 0\na=group:BUNDLE audio video\na=msid-semantic: WMS\na=ice-lite\nm=audio 9 UDP/TLS/RTP/SAVPF 0\nc=IN IP4 127.0.0.1\na=rtcp:9 IN IP4 0.0.0.0\na=sendrecv\na=rtcp-mux\na=rtcp-rsize\na=mid:audio\nm=video 9 UDP/TLS/RTP/SAVPF 0\nc=IN IP4 127.0.0.1\na=rtcp:9 IN IP4 0.0.0.0\na=sendrecv\na=rtcp-mux\na=rtcp-rsize\na=mid:video\n");this.rtpCapabilities=n,this.candidates=i,this.iceParameters=t,this.dtlsParameters=r,this.setup=o,this.localCapabilities=s,this.cname=c;for(let e=0;e<d.mediaDescriptions.length;e++){const s=d.mediaDescriptions[e];if(s.attributes.iceUfrag=t.iceUfrag,s.attributes.icePwd=t.icePwd,s.attributes.fingerprints=r.fingerprints,s.attributes.candidates=i,s.attributes.setup=o,"video"===s.media.mediaType){s.media.fmts=n.videoCodecs.map(e=>e.payloadType.toString(10));const e=n.videoCodecs.filter(e=>{var t;return null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase().includes(a)});if(0===e.length)throw new Error("Codec ".concat(a," not supported by remote SDP."));s.attributes.payloads=e,s.attributes.extmaps=n.videoExtensions}"audio"===s.media.mediaType&&(s.media.fmts=n.audioCodecs.map(e=>e.payloadType.toString(10)),s.attributes.payloads=n.audioCodecs,s.attributes.extmaps=n.audioExtensions),d.mediaDescriptions[e]=this.mungMediaDesc(s)}this.sessionDesc=d,this.currentMidIndex=d.mediaDescriptions.length-1}toString(){return kZ.exports.print(this.sessionDesc)}send(e,t,r){const{ssrcs:i,ssrcGroups:n}=xZ(t,this.cname),o=this.sessionDesc.mediaDescriptions.find(t=>e===yP.VIDEO?"video"===t.media.mediaType:"audio"===t.media.mediaType),s=i[0].attributes.label,a=i[0].attributes.mslabel;return o.attributes.ssrcs=o.attributes.ssrcs.concat(i),o.attributes.ssrcGroups=o.attributes.ssrcGroups.concat(n),{id:s,mslabel:a}}batchSend(e){return e.map(e=>{let{kind:t,ssrcMsg:r}=e;return this.send(t,r,void 0)})}stopSending(e){this.sessionDesc.mediaDescriptions.forEach(t=>{const r=[],i=[],n=[];t.attributes.ssrcs.forEach(t=>{e.includes(t.attributes.label||"")?n.push(t):r.push(t)}),t.attributes.ssrcGroups.forEach(e=>{n.map(e=>e.ssrcId).includes(e.ssrcIds[0])||i.push(e)}),t.attributes.ssrcs=r,t.attributes.ssrcGroups=i})}mute(e){const t=this.sessionDesc.mediaDescriptions.find(t=>t.attributes.mid===e);if(!t)throw new Error("mediaDescription not found with ".concat(e," in remote SDP when calling RemoteSDP.mute."));t.attributes.direction="inactive"}unmute(e){const t=this.sessionDesc.mediaDescriptions.find(t=>t.attributes.mid===e);if(!t)throw new Error("mediaDescription not found with ".concat(e," in remote SDP when calling RemoteSDP.unmute."));t.attributes.direction="sendonly"}receive(e,t,r){e.forEach((e,t)=>{const r=e._mediaStreamTrack,i=this.sessionDesc.mediaDescriptions.findIndex(e=>e.attributes.mid===r.kind),n=this.mungRecvMediaDsec(this.sessionDesc.mediaDescriptions[i],e);this.sessionDesc.mediaDescriptions[i]=n})}stopReceiving(e){}restartICE(e,t){e=PG(e),t=PG(t),this.iceParameters=e,this.candidates=t,this.sessionDesc.mediaDescriptions.forEach(t=>{t.attributes.iceUfrag=e.iceUfrag,t.attributes.icePwd=e.icePwd,t.attributes.candidates=this.candidates})}predictReceivingMids(e){const t=[];for(let r=0;r<e;r++)t.push((this.currentMidIndex+r+1).toString(10));return t}mungRecvMediaDsec(e,t){const r=PG(e);return FZ(r,t),jZ(r,t),r}updateRecvMedia(e,t){const r=this.sessionDesc.mediaDescriptions.findIndex(t=>t.attributes.mid===e);if(-1!==r){const e=this.mungRecvMediaDsec(this.sessionDesc.mediaDescriptions[r],t);this.sessionDesc.mediaDescriptions[r]=e}}bumpMid(e){this.currentMidIndex+=e}updateTrackLabel(e,t,r){const i=this.sessionDesc.mediaDescriptions.find(t=>e===yP.VIDEO?"video"===t.attributes.mid:"audio"===t.attributes.mid);if(i){const e=i.attributes.ssrcs.find(e=>e.attributes.label===t);var n;if(e)e.attributes.label=r,null===(n=e.attributes.msid)||void 0===n||n.replace(t,r)}}mungMediaDesc(e){const t=PG(e);return VZ(t),function(e){const t=e.attributes.extmaps.find(e=>"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01"===e.extensionName);t&&e.attributes.extmaps.splice(e.attributes.extmaps.indexOf(t),1),e.attributes.payloads.forEach(e=>{const t=e.rtcpFeedbacks.findIndex(e=>"transport-cc"===e.type);-1!==t&&e.rtcpFeedbacks.splice(t,1)})}(t),t}}function WZ(e){if(Array.isArray(e))return e.map((function(e){return e}));if(!JZ(e))return e;var t={};for(var r in e)JZ(e[r])||Array.isArray(e[r])?t[r]=WZ(e[r]):t[r]=e[r];return t}function JZ(e){return!("object"!=typeof e||Array.isArray(e)||!e)}var qZ=function(){function e(e){this.input=[],this.size=e}return e.prototype.add=function(e){this.input.push(e),this.input.length>this.size&&this.input.splice(0,1)},e.prototype.diffMean=function(){return 0===this.input.length?0:(this.input[this.input.length-1]-this.input[0])/this.input.length},e}(),zZ=function(e,t){return(zZ=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */function XZ(e,t){function r(){this.constructor=e}zZ(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var ZZ=function(){return(ZZ=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function $Z(e,t,r,i){return new(r||(r=Promise))((function(n,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){e.done?n(e.value):new r((function(t){t(e.value)})).then(s,a)}c((i=i.apply(e,t||[])).next())}))}function e$(e,t){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}}var t$,r$={address:"unknown",candidateType:"unknown",id:"unknown",port:0,priority:0,protocol:"unknown",type:"unknown"},i$={timestamp:0,bitrate:{actualEncoded:0,transmit:0},sendPacketLossRate:0,recvPacketLossRate:0,videoRecv:[],videoSend:[],audioRecv:[],audioSend:[],selectedCandidatePair:{id:"unknown",localCandidate:r$,remoteCandidate:r$}},n$={firsCount:0,nacksCount:0,plisCount:0,framesDecodeCount:0,framesDecodeInterval:0,framesDecodeFreezeTime:0,decodeFrameRate:0,bytes:0,packetsLost:0,packetLostRate:0,packets:0,ssrc:0,qpSumPerFrame:0},o$={firsCount:0,nacksCount:0,plisCount:0,frameCount:0,bytes:0,packets:0,packetsLost:0,packetLostRate:0,ssrc:0,rttMs:0,qpSumPerFrame:0},s$={bytes:0,packets:0,packetsLost:0,packetLostRate:0,ssrc:0,rttMs:0},a$={jitterBufferMs:0,jitterMs:0,bytes:0,packetsLost:0,packetLostRate:0,packets:0,ssrc:0,receivedFrames:0,droppedFrames:0},c$=function(){function e(e,t){var r=this;this.videoIsReady=!1,this.videoIsReady2={},this.stats=WZ(i$),this.isFirstVideoReceived={},this.isFirstVideoDecoded={},this.isFirstAudioReceived={},this.isFirstAudioDecoded={},this.lossRateWindowStats=[],this.pc=e,this.options=t,this.intervalTimer=window.setInterval((function(){return $Z(r,void 0,void 0,(function(){return e$(this,(function(e){return this.updateStats(),[2]}))}))}),this.options.updateInterval)}return e.prototype.getStats=function(){return this.stats},e.prototype.setVideoIsReady=function(e){this.videoIsReady=e},e.prototype.setVideoIsReady2=function(e,t){this.videoIsReady2[e]=t},e.prototype.getVideoIsReady=function(e){return this.videoIsReady2[e]||!1},e.prototype.setIsFirstAudioDecoded=function(e){},e.prototype.destroy=function(){window.clearInterval(this.intervalTimer),this.pc=void 0},e.prototype.calcLossRate=function(e){var t=this;this.lossRateWindowStats.push(e),this.lossRateWindowStats.length>this.options.lossRateInterval&&this.lossRateWindowStats.splice(0,1);for(var r=this.lossRateWindowStats.length,i=0,n=0,o=0,s=0,a=function(a){e[a].forEach((function(e,c){if(t.lossRateWindowStats[r-1][a][c]&&t.lossRateWindowStats[0][a][c]){var d=t.lossRateWindowStats[r-1][a][c].packets-t.lossRateWindowStats[0][a][c].packets,u=t.lossRateWindowStats[r-1][a][c].packetsLost-t.lossRateWindowStats[0][a][c].packetsLost;"videoSend"===a||"audioSend"===a?(i+=d,o+=u):(n+=d,s+=u),Number.isNaN(d)||Number.isNaN(d)?e.packetLostRate=0:e.packetLostRate=d<=0||u<=0?0:u/(d+u)}}))},c=0,d=["videoSend","audioSend","videoRecv","audioRecv"];c<d.length;c++){a(d[c])}e.sendPacketLossRate=i<=0||o<=0?0:o/(i+o),e.recvPacketLossRate=n<=0||s<=0?0:s/(n+s)},e}(),d$=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._stats=i$,t.lastDecodeVideoReceiverStats=new Map,t}return XZ(t,e),t.prototype.updateStats=function(){return $Z(this,void 0,void 0,(function(){var e,t,r,i;return e$(this,(function(n){switch(n.label){case 0:return[4,this._getStats()];case 1:return e=n.sent(),t=this.statsResponsesToObjects(e),this._stats=WZ(i$),r=t.filter((function(e){return"ssrc"===e.type})),this.processSSRCStats(r),(i=t.find((function(e){return"VideoBwe"===e.type})))&&this.processBandwidthStats(i),this._stats.timestamp=Date.now(),this.calcLossRate(this._stats),this.stats=this._stats,[2]}}))}))},t.prototype.processBandwidthStats=function(e){this._stats.bitrate={actualEncoded:Number(e.googActualEncBitrate),targetEncoded:Number(e.googTargetEncBitrate),retransmit:Number(e.googRetransmitBitrate),transmit:Number(e.googTransmitBitrate)},this._stats.sendBandwidth=Number(e.googAvailableSendBandwidth)},t.prototype.processSSRCStats=function(e){var t=this;e.forEach((function(e){var r=e.id.includes("send");switch(e.mediaType+"_"+(r?"send":"recv")){case"video_send":var i=WZ(o$);i.codec=e.googCodecName,i.adaptionChangeReason="none",e.googCpuLimitedResolution&&(i.adaptionChangeReason="cpu"),e.googBandwidthLimitedResolution&&(i.adaptionChangeReason="bandwidth"),i.avgEncodeMs=Number(e.googAvgEncodeMs),i.inputFrame={width:Number(e.googFrameWidthInput)||Number(e.googFrameWidthSent),height:Number(e.googFrameHeightInput)||Number(e.googFrameHeightSent),frameRate:Number(e.googFrameRateInput)},i.sentFrame={width:Number(e.googFrameWidthSent),height:Number(e.googFrameHeightSent),frameRate:Number(e.googFrameRateInput)},i.firsCount=Number(e.googFirReceived),i.nacksCount=Number(e.googNacksReceived),i.plisCount=Number(e.googPlisReceived),i.frameCount=Number(e.framesEncoded),i.bytes=Number(e.bytesSent),i.packets=Number(e.packetsSent),i.packetsLost=Number(e.packetsLost),i.ssrc=Number(e.ssrc),i.rttMs=Number(e.googRtt||0),t._stats.videoSend.push(i),t._stats.rtt=i.rttMs;break;case"video_recv":var n=WZ(n$),o=t.lastDecodeVideoReceiverStats.get(Number(e.ssrc));if(n.codec=e.googCodecName,n.targetDelayMs=Number(e.googTargetDelayMs),n.renderDelayMs=Number(e.googRenderDelayMs),n.currentDelayMs=Number(e.googCurrentDelayMs),n.minPlayoutDelayMs=Number(e.googMinPlayoutDelayMs),n.decodeMs=Number(e.googDecodeMs),n.maxDecodeMs=Number(e.googMaxDecodeMs),n.receivedFrame={width:Number(e.googFrameWidthReceived),height:Number(e.googFrameHeightReceived),frameRate:Number(e.googFrameRateReceived)},n.decodedFrame={width:Number(e.googFrameWidthReceived),height:Number(e.googFrameHeightReceived),frameRate:Number(e.googFrameRateDecoded)},n.outputFrame={width:Number(e.googFrameWidthReceived),height:Number(e.googFrameHeightReceived),frameRate:Number(e.googFrameRateOutput)},n.jitterBufferMs=Number(e.googJitterBufferMs),n.firsCount=Number(e.googFirsSent),n.nacksCount=Number(e.googNacksSent),n.plisCount=Number(e.googPlisSent),n.framesDecodeCount=Number(e.framesDecoded),n.bytes=Number(e.bytesReceived),n.packets=Number(e.packetsReceived),n.packetsLost=Number(e.packetsLost),n.ssrc=Number(e.ssrc),n.packets>0&&!t.isFirstVideoReceived[n.ssrc]&&(t.onFirstVideoReceived&&t.onFirstVideoReceived(n.ssrc),t.isFirstVideoReceived[n.ssrc]=!0),n.framesDecodeCount>0&&!t.isFirstVideoDecoded[n.ssrc]&&(t.onFirstVideoDecoded&&t.onFirstVideoDecoded(n.ssrc,n.decodedFrame.width,n.decodedFrame.height),t.isFirstVideoDecoded[n.ssrc]=!0),o){var s=o.stats,a=Date.now()-o.lts;n.framesDecodeFreezeTime=s.framesDecodeFreezeTime,n.framesDecodeInterval=s.framesDecodeInterval,n.framesDecodeCount>s.framesDecodeCount&&t.isFirstVideoDecoded?(o.lts=Date.now(),n.framesDecodeInterval=a,n.framesDecodeInterval>=t.options.freezeRateLimit&&(t.getVideoIsReady(parseInt(e.ssrc,10))?n.framesDecodeFreezeTime+=n.framesDecodeInterval:t.setVideoIsReady2(parseInt(e.ssrc,10),!0))):n.framesDecodeCount<o.stats.framesDecodeCount&&(n.framesDecodeInterval=0)}t.lastDecodeVideoReceiverStats.set(n.ssrc,{stats:ZZ({},n),lts:Date.now()}),t._stats.videoRecv.push(n);break;case"audio_recv":var c=WZ(a$);c.codec=e.googCodecName,c.outputLevel=Math.abs(Number(e.audioOutputLevel))/32767,c.decodingCNG=Number(e.googDecodingCNG),c.decodingCTN=Number(e.googDecodingCTN),c.decodingCTSG=Number(e.googDecodingCTSG),c.decodingNormal=Number(e.googDecodingNormal),c.decodingPLC=Number(e.googDecodingPLC),c.decodingPLCCNG=Number(e.googDecodingPLCCNG),c.expandRate=Number(e.googExpandRate),c.accelerateRate=Number(e.googAccelerateRate),c.preemptiveExpandRate=Number(e.googPreemptiveExpandRate),c.secondaryDecodedRate=Number(e.googSecondaryDecodedRate),c.speechExpandRate=Number(e.googSpeechExpandRate),c.preferredJitterBufferMs=Number(e.googPreferredJitterBufferMs),c.jitterBufferMs=Number(e.googJitterBufferMs),c.jitterMs=Number(e.googJitterReceived),c.bytes=Number(e.bytesReceived),c.packets=Number(e.packetsReceived),c.packetsLost=Number(e.packetsLost),c.ssrc=Number(e.ssrc),c.receivedFrames=Number(e.googDecodingCTN)||Number(e.packetsReceived),c.droppedFrames=Number(e.googDecodingPLC)+Number(e.googDecodingPLCCNG)||Number(e.packetsLost),c.receivedFrames>0&&!t.isFirstAudioReceived[c.ssrc]&&(t.onFirstAudioReceived&&t.onFirstAudioReceived(c.ssrc),t.isFirstAudioReceived[c.ssrc]=!0),c.decodingNormal>0&&!t.isFirstAudioDecoded[c.ssrc]&&(t.onFirstAudioDecoded&&t.onFirstAudioDecoded(c.ssrc),t.isFirstAudioDecoded[c.ssrc]=!0),t._stats.audioRecv.push(c);break;case"audio_send":var d=WZ(s$);d.codec=e.googCodecName,d.inputLevel=Math.abs(Number(e.audioInputLevel))/32767,d.aecReturnLoss=Number(e.googEchoCancellationReturnLoss||0),d.aecReturnLossEnhancement=Number(e.googEchoCancellationReturnLossEnhancement||0),d.residualEchoLikelihood=Number(e.googResidualEchoLikelihood||0),d.residualEchoLikelihoodRecentMax=Number(e.googResidualEchoLikelihoodRecentMax||0),d.bytes=Number(e.bytesSent),d.packets=Number(e.packetsSent),d.packetsLost=Number(e.packetsLost),d.ssrc=Number(e.ssrc),d.rttMs=Number(e.googRtt||0),t._stats.rtt=d.rttMs,t._stats.audioSend.push(d)}}))},t.prototype._getStats=function(){var e=this;return new Promise((function(t,r){e.pc.getStats(t,r)}))},t.prototype.statsResponsesToObjects=function(e){var t=[];return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp.valueOf().toString(),type:e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t.push(r)})),t},t}(c$);!function(e){e.CERTIFICATE="certificate",e.CODEC="codec",e.CANDIDATE_PAIR="candidate-pair",e.LOCAL_CANDIDATE="local-candidate",e.REMOTE_CANDIDATE="remote-candidate",e.INBOUND="inbound-rtp",e.TRACK="track",e.OUTBOUND="outbound-rtp",e.PC="peer-connection",e.REMOTE_INBOUND="remote-inbound-rtp",e.REMOTE_OUTBOUND="remote-outbound-rtp",e.TRANSPORT="transport",e.CSRC="csrc",e.DATA_CHANNEL="data-channel",e.STREAM="stream",e.SENDER="sender",e.RECEIVER="receiver"}(t$||(t$={}));var u$,A$=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._stats=i$,t.lastDecodeVideoReceiverStats=new Map,t.lastVideoFramesRecv=new Map,t.lastVideoFramesSent=new Map,t.lastVideoFramesDecode=new Map,t.lastVideoJBDelay=new Map,t.lastAudioJBDelay=new Map,t.mediaBytesSent=new Map,t.mediaBytesRetransmit=new Map,t.mediaBytesTargetEncode=new Map,t.lastEncoderMs=new Map,t}return XZ(t,e),t.prototype.updateStats=function(){return $Z(this,void 0,void 0,(function(){var e,t=this;return e$(this,(function(r){switch(r.label){case 0:return e=this,[4,this.pc.getStats()];case 1:return e.report=r.sent(),this._stats=WZ(i$),this.report.forEach((function(e){switch(e.type){case t$.OUTBOUND:"audio"===e.mediaType?t.processAudioOutboundStats(e):"video"===e.mediaType&&t.processVideoOutboundStats(e);break;case t$.INBOUND:"audio"===e.mediaType?t.processAudioInboundStats(e):"video"===e.mediaType&&t.processVideoInboundStats(e);break;case t$.TRANSPORT:var r=t.report.get(e.selectedCandidatePairId);r&&t.processCandidatePairStats(r);break;case t$.CANDIDATE_PAIR:e.selected&&t.processCandidatePairStats(e)}})),this.updateSendBitrate(),this._stats.timestamp=Date.now(),this.calcLossRate(this._stats),this.stats=this._stats,[2]}}))}))},t.prototype.processCandidatePairStats=function(e){if(this._stats.sendBandwidth=e.availableOutgoingBitrate||0,e.currentRoundTripTime&&(this._stats.rtt=1e3*e.currentRoundTripTime),this._stats.videoSend.forEach((function(t){!t.rttMs&&e.currentRoundTripTime&&(t.rttMs=1e3*e.currentRoundTripTime)})),this._stats.audioSend.forEach((function(t){!t.rttMs&&e.currentRoundTripTime&&(t.rttMs=1e3*e.currentRoundTripTime)})),this._stats.selectedCandidatePair.id=e.id,e.localCandidateId){var t=this.report.get(e.localCandidateId);t&&this.processCandidateStats(t)}if(e.remoteCandidateId){var r=this.report.get(e.remoteCandidateId);r&&this.processCandidateStats(r)}},t.prototype.processCandidateStats=function(e){var t;e.type===t$.LOCAL_CANDIDATE&&(t=this._stats.selectedCandidatePair.localCandidate),e.type===t$.REMOTE_CANDIDATE&&(t=this._stats.selectedCandidatePair.remoteCandidate),t&&(t.type=e.type,t.id=e.id,e.address&&(t.address=e.address),e.candidateType&&(t.candidateType=e.candidateType),e.port&&(t.port=e.port),e.priority&&(t.priority=e.priority),e.protocol&&(t.protocol=e.protocol),e.relayProtocol&&(t.relayProtocol=e.relayProtocol),e.type===t$.LOCAL_CANDIDATE&&this.stats.selectedCandidatePair.localCandidate.id!==t.id&&this.onSelectedLocalCandidateChanged&&this.onSelectedLocalCandidateChanged(ZZ({},t),ZZ({},this.stats.selectedCandidatePair.localCandidate)),e.type===t$.REMOTE_CANDIDATE&&this.stats.selectedCandidatePair.remoteCandidate.id!==t.id&&this.onSelectedRemoteCandidateChanged&&this.onSelectedRemoteCandidateChanged(ZZ({},t),ZZ({},this.stats.selectedCandidatePair.remoteCandidate)))},t.prototype.processAudioInboundStats=function(e){var t=this._stats.audioRecv.find((function(t){return t.ssrc===e.ssrc}));t||(t=WZ(a$),this._stats.audioRecv.push(t)),t.ssrc=e.ssrc,t.packets=e.packetsReceived,t.packetsLost=e.packetsLost,t.bytes=e.bytesReceived,t.jitterMs=1e3*e.jitter,e.trackId&&this.processAudioTrackReceiverStats(e.trackId,t),e.codecId&&(t.codec=this.getCodecFromCodecStats(e.codecId)),t.receivedFrames||(t.receivedFrames=e.packetsReceived),t.droppedFrames||(t.droppedFrames=e.packetsLost),t.receivedFrames>0&&!this.isFirstAudioReceived[t.ssrc]&&(this.onFirstAudioReceived&&this.onFirstAudioReceived(t.ssrc),this.isFirstAudioReceived[t.ssrc]=!0),t.outputLevel&&t.outputLevel>0&&!this.isFirstAudioDecoded[t.ssrc]&&(this.onFirstAudioDecoded&&this.onFirstAudioDecoded(t.ssrc),this.isFirstAudioDecoded[t.ssrc]=!0)},t.prototype.processVideoInboundStats=function(e){var t=this._stats.videoRecv.find((function(t){return t.ssrc===e.ssrc}));t||(t=WZ(n$),this._stats.videoRecv.push(t)),t.ssrc=e.ssrc,t.packets=e.packetsReceived,t.packetsLost=e.packetsLost,t.bytes=e.bytesReceived,t.firsCount=e.firCount,t.nacksCount=e.nackCount,t.plisCount=e.pliCount,t.framesDecodeCount=e.framesDecoded;var r=this.lastDecodeVideoReceiverStats.get(t.ssrc),i=this.lastVideoFramesDecode.get(t.ssrc),n=Date.now();if(t.framesDecodeCount>0&&!this.isFirstVideoDecoded[t.ssrc]){var o=t.decodedFrame?t.decodedFrame.width:0,s=t.decodedFrame?t.decodedFrame.height:0;this.onFirstVideoDecoded&&this.onFirstVideoDecoded(t.ssrc,o,s),this.isFirstVideoDecoded[t.ssrc]=!0}if(r){var a=r.stats,c=n-r.lts;t.framesDecodeFreezeTime=a.framesDecodeFreezeTime,t.framesDecodeInterval=a.framesDecodeInterval,t.framesDecodeCount>a.framesDecodeCount&&this.isFirstVideoDecoded?(r.lts=Date.now(),t.framesDecodeInterval=c,t.framesDecodeInterval>=this.options.freezeRateLimit&&(this.getVideoIsReady(parseInt(e.ssrc))?t.framesDecodeFreezeTime+=t.framesDecodeInterval:this.setVideoIsReady2(parseInt(e.ssrc,10),!0))):t.framesDecodeCount<a.framesDecodeCount&&(t.framesDecodeInterval=0),e.framesDecoded&&e.qpSum&&(r.stats.framesDecodeCount>e.framesDecoded?t.qpSumPerFrame=e.qpSum/e.framesDecoded:t.qpSumPerFrame=(e.qpSum-r.qpSum)/(e.framesDecoded-r.stats.framesDecodeCount))}i&&n-i.lts>=800?(t.decodeFrameRate=Math.round((t.framesDecodeCount-i.count)/((n-i.lts)/1e3)),this.lastVideoFramesDecode.set(t.ssrc,{count:t.framesDecodeCount,lts:n,rate:t.decodeFrameRate})):i?t.decodeFrameRate=i.rate:this.lastVideoFramesDecode.set(t.ssrc,{count:t.framesDecodeCount,lts:n,rate:0}),e.totalDecodeTime&&(t.decodeMs=1e3*e.totalDecodeTime),e.trackId&&this.processVideoTrackReceiverStats(e.trackId,t),e.codecId&&(t.codec=this.getCodecFromCodecStats(e.codecId)),e.framerateMean&&(t.framesRateFirefox=e.framerateMean),t.packets>0&&!this.isFirstVideoReceived[t.ssrc]&&(this.onFirstVideoReceived&&this.onFirstVideoReceived(t.ssrc),this.isFirstVideoReceived[t.ssrc]=!0),this.lastDecodeVideoReceiverStats.set(t.ssrc,{stats:ZZ({},t),lts:r?r.lts:Date.now(),qpSum:e.qpSum})},t.prototype.processVideoOutboundStats=function(e){var t=this._stats.videoSend.find((function(t){return t.ssrc===e.ssrc}));t||(t=WZ(o$),this._stats.videoSend.push(t));var r,i=this.mediaBytesSent.get(e.ssrc);i?i.add(e.bytesSent):((o=new qZ(10)).add(e.bytesSent),this.mediaBytesSent.set(e.ssrc,o));if(void 0!==e.retransmittedBytesSent){var n=this.mediaBytesRetransmit.get(e.ssrc);if(n)n.add(e.retransmittedBytesSent);else(o=new qZ(10)).add(e.retransmittedBytesSent),this.mediaBytesRetransmit.set(e.ssrc,o)}if(e.totalEncodedBytesTarget){var o,s=this.mediaBytesTargetEncode.get(e.ssrc);if(s)s.add(e.totalEncodedBytesTarget);else(o=new qZ(10)).add(e.totalEncodedBytesTarget),this.mediaBytesTargetEncode.set(e.ssrc,o)}if(t.ssrc=e.ssrc,t.bytes=e.bytesSent,t.packets=e.packetsSent,t.firsCount=e.firCount,t.nacksCount=e.nackCount,t.plisCount=e.pliCount,t.frameCount=e.framesEncoded,t.adaptionChangeReason=e.qualityLimitationReason,e.totalEncodeTime&&e.framesEncoded)if(!(r=this.lastEncoderMs.get(e.ssrc))||r.lastFrameCount>e.framesEncoded)t.avgEncodeMs=1e3*e.totalEncodeTime/e.framesEncoded;else{var a=e.framesEncoded-r.lastFrameCount,c=e.totalEncodeTime-r.lastEncoderTime;t.avgEncodeMs=1e3*c/a}e.framesEncoded&&e.qpSum&&(!(r=this.lastEncoderMs.get(e.ssrc))||r.lastFrameCount>e.framesEncoded?t.qpSumPerFrame=e.qpSum/e.framesEncoded:t.qpSumPerFrame=(e.qpSum-r.lastQpSum)/(e.framesEncoded-r.lastFrameCount));if(this.lastEncoderMs.set(e.ssrc,{lastFrameCount:e.framesEncoded,lastEncoderTime:e.totalEncodeTime,lastQpSum:e.qpSum,lts:Date.now()}),e.codecId&&(t.codec=this.getCodecFromCodecStats(e.codecId)),e.mediaSourceId&&this.processVideoMediaSource(e.mediaSourceId,t),e.trackId&&this.processVideoTrackSenderStats(e.trackId,t),e.remoteId)this.processRemoteInboundStats(e.remoteId,t);else{var d=this.findRemoteStatsId(e.ssrc,t$.REMOTE_INBOUND);d&&this.processRemoteInboundStats(d,t)}},t.prototype.processAudioOutboundStats=function(e){var t=this._stats.audioSend.find((function(t){return t.ssrc===e.ssrc}));if(t||(t=WZ(s$),this._stats.audioSend.push(t)),t.ssrc=e.ssrc,t.packets=e.packetsSent,t.bytes=e.bytesSent,e.mediaSourceId&&this.processAudioMediaSource(e.mediaSourceId,t),e.codecId&&(t.codec=this.getCodecFromCodecStats(e.codecId)),e.trackId&&this.processAudioTrackSenderStats(e.trackId,t),e.remoteId)this.processRemoteInboundStats(e.remoteId,t);else{var r=this.findRemoteStatsId(e.ssrc,t$.REMOTE_INBOUND);r&&this.processRemoteInboundStats(r,t)}},t.prototype.findRemoteStatsId=function(e,t){var r=Array.from(this.report.values()).find((function(r){return r.type===t&&r.ssrc===e}));return r?r.id:null},t.prototype.processVideoMediaSource=function(e,t){var r=this.report.get(e);r&&r.width&&r.height&&r.framesPerSecond&&(t.inputFrame={width:r.width,height:r.height,frameRate:r.framesPerSecond})},t.prototype.processAudioMediaSource=function(e,t){var r=this.report.get(e);r&&(t.inputLevel=r.audioLevel)},t.prototype.processVideoTrackSenderStats=function(e,t){var r=this.report.get(e);if(r){var i=0,n=Date.now(),o=this.lastVideoFramesSent.get(t.ssrc);o&&n-o.lts>=800?(i=Math.round((r.framesSent-o.count)/((n-o.lts)/1e3)),this.lastVideoFramesSent.set(t.ssrc,{count:r.framesSent,lts:n,rate:i})):o?i=o.rate:this.lastVideoFramesSent.set(t.ssrc,{count:r.framesSent,lts:n,rate:0}),t.sentFrame={width:r.frameWidth,height:r.frameHeight,frameRate:i}}},t.prototype.processVideoTrackReceiverStats=function(e,t){var r=this.report.get(e);if(r){var i=this.lastVideoFramesRecv.get(t.ssrc),n=Date.now();t.framesReceivedCount=r.framesReceived;var o=0;if(i&&n-i.lts>=800?(o=Math.round((r.framesReceived-i.count)/((n-i.lts)/1e3)),this.lastVideoFramesRecv.set(t.ssrc,{count:r.framesReceived,lts:n,rate:o})):i?o=i.rate:this.lastVideoFramesRecv.set(t.ssrc,{count:r.framesReceived,lts:n,rate:0}),t.receivedFrame={width:r.frameWidth||0,height:r.frameHeight||0,frameRate:o||0},t.decodedFrame={width:r.frameWidth||0,height:r.frameHeight||0,frameRate:t.decodeFrameRate||0},t.outputFrame={width:r.frameWidth||0,height:r.frameHeight||0,frameRate:t.decodeFrameRate||0},r.jitterBufferDelay&&r.jitterBufferEmittedCount){var s=this.lastVideoJBDelay.get(t.ssrc);this.lastVideoJBDelay.set(t.ssrc,{jitterBufferDelay:r.jitterBufferDelay,jitterBufferEmittedCount:r.jitterBufferEmittedCount}),s||(s={jitterBufferDelay:0,jitterBufferEmittedCount:0});var a=1e3*(r.jitterBufferDelay-s.jitterBufferDelay)/(r.jitterBufferEmittedCount-s.jitterBufferEmittedCount);t.jitterBufferMs=a,t.currentDelayMs=Math.round(a)}}},t.prototype.processAudioTrackSenderStats=function(e,t){var r=this.report.get(e);r&&(t.aecReturnLoss=r.echoReturnLoss||0,t.aecReturnLossEnhancement=r.echoReturnLossEnhancement||0)},t.prototype.processAudioTrackReceiverStats=function(e,t){var r=this.report.get(e);if(r){if(r.removedSamplesForAcceleration&&r.totalSamplesReceived&&(t.accelerateRate=r.removedSamplesForAcceleration/r.totalSamplesReceived),r.jitterBufferDelay&&r.jitterBufferEmittedCount){var i=this.lastAudioJBDelay.get(t.ssrc);this.lastAudioJBDelay.set(t.ssrc,{jitterBufferDelay:r.jitterBufferDelay,jitterBufferEmittedCount:r.jitterBufferEmittedCount}),i||(i={jitterBufferDelay:0,jitterBufferEmittedCount:0});var n=1e3*(r.jitterBufferDelay-i.jitterBufferDelay)/(r.jitterBufferEmittedCount-i.jitterBufferEmittedCount);t.jitterBufferMs=Math.round(n)}t.outputLevel=r.audioLevel;var o=1920;r.totalSamplesDuration&&r.totalSamplesReceived&&(o=r.totalSamplesReceived/r.totalSamplesDuration/50,t.receivedFrames=Math.round(r.totalSamplesReceived/o)),r.concealedSamples&&(t.droppedFrames=Math.round(r.concealedSamples/o))}},t.prototype.processRemoteInboundStats=function(e,t){var r=this.report.get(e);r&&(t.packetsLost=r.packetsLost,r.roundTripTime&&(t.rttMs=1e3*r.roundTripTime))},t.prototype.getCodecFromCodecStats=function(e){var t=this.report.get(e);if(!t)return"";var r=t.mimeType.match(/\/(.*)$/);return r&&r[1]?r[1]:""},t.prototype.updateSendBitrate=function(){var e=0,t=null,r=null;this.mediaBytesSent.forEach((function(t){e+=t.diffMean()})),this.mediaBytesRetransmit.forEach((function(e){t=null===t?e.diffMean():t+e.diffMean()})),this.mediaBytesTargetEncode.forEach((function(e){r=null===r?e.diffMean():r+e.diffMean()}));var i=null!==t?e-t:e;this._stats.bitrate={actualEncoded:8*i/(this.options.updateInterval/1e3),transmit:8*e/(this.options.updateInterval/1e3)},null!==t&&(this._stats.bitrate.retransmit=8*t/(this.options.updateInterval/1e3)),null!==r&&(this._stats.bitrate.targetEncoded=8*r/(this.options.updateInterval/1e3))},t}(c$),h$=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return XZ(t,e),t.prototype.updateStats=function(){return Promise.resolve()},t}(c$);function l$(e,t,r,i){void 0===t&&(t=250),void 0===r&&(r=8),void 0===i&&(i=500);var n,o=(n=navigator.userAgent.toLocaleLowerCase().match(/chrome\/[\d]*/i))&&n[0]?Number(n[0].split("/")[1]):null;return o?o<76?new d$(e,{updateInterval:t,lossRateInterval:r,freezeRateLimit:i}):new A$(e,{updateInterval:t,lossRateInterval:r,freezeRateLimit:i}):function(e){return!!window.RTCStatsReport&&e.getStats()instanceof Promise}(e)?new A$(e,{updateInterval:t,lossRateInterval:r,freezeRateLimit:i}):new h$(e,{updateInterval:t,lossRateInterval:r,freezeRateLimit:i})}function p$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function g$(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?p$(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):p$(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let f$=(qF((u$=class e extends NP{get peerConnectionState(){return this.peerConnection.connectionState}get iceConnectionState(){return this.peerConnection.iceConnectionState}get currentLocalDescription(){return this.peerConnection.currentLocalDescription}get currentRemoteDescription(){return this.peerConnection.currentRemoteDescription}constructor(t,r){super(t,r),kO(this,"store",void 0),kO(this,"peerConnection",void 0),kO(this,"remoteSDP",void 0),kO(this,"initialOffer",void 0),kO(this,"statsFilter",void 0),kO(this,"useRTX",!1),kO(this,"localCapabilities",void 0),kO(this,"localCandidateCount",0),kO(this,"allCandidatesReceived",!1),kO(this,"mutex",new kV("P2PConnection-mutex")),this.store=r,this.peerConnection=new RTCPeerConnection(e.resolvePCConfiguration(t),{optional:[{googDscp:!0}]}),this.statsFilter=l$(this.peerConnection,void 0,void 0,gO()?1200:void 0),this.bindPCEvents(),this.bindStatsEvents(),this.store.p2pId=this.store.p2pId+1}async establish(){try{const e=await this.peerConnection.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});if(!e.sdp)throw new Error("Cannot get initialOffer.sdp when trying to establish PeerConnection.");const t=UZ(e.sdp),r=MZ(e.sdp,!this.useRTX,!1,["opus"]);return this.localCapabilities=r,this.initialOffer=e,g$(g$({},t),{},{rtpCapabilities:{send:{audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]},recv:{audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]},sendrecv:r},offerSDP:e.sdp})}catch(e){throw new eD($N.GET_LOCAL_CONNECTION_PARAMS_FAILED,e.toString())}}async connect(e,t,r,i,n,o){try{if(!this.initialOffer)throw new Error("Cannot establish P2PConnection without initial offer.");this.remoteSDP=new YZ({remoteIceParameters:e,remoteDtlsParameters:t,candidates:r,remoteRTPCapabilities:i.send,remoteSetup:n,localCapabilities:this.localCapabilities,sdkCodec:this.store.codec,cname:o});const s=this.remoteSDP.toString();await this.peerConnection.setLocalDescription(this.initialOffer),await this.peerConnection.setRemoteDescription({type:"answer",sdp:s})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.connect failed; ".concat(e.toString()))}}send(e,t){var r=this;return cZ((function*(){const i=yield dZ(r.mutex.lock());try{if(!r.remoteSDP)throw new Error("Cannot call P2PConnection.send before remote SDP created");const n=e.map(e=>r.peerConnection.addTrack(e._mediaStreamTrack)),o=yield dZ(r.peerConnection.createOffer()),s=kZ.exports.parse(o.sdp),a=e.map(e=>{const t=e._mediaStreamTrack,i=s.mediaDescriptions.find(e=>e.attributes.mid===t.kind);if(!i)throw new Error("Cannot extract ssrc from mediaDescription.");return function(e,t,r){const i=e.attributes.ssrcs.filter(e=>e.attributes.label===t),n=e.attributes.ssrcGroups;if(0===i.length)throw new Error("Cannot extract ssrc from plan-b SDP.");if(n&&i.length>1){const e=n.find(e=>-1!==e.ssrcIds.indexOf(i[0].ssrcId));return e?[{ssrcId:e.ssrcIds[0],rtx:r?e.ssrcIds[1]:void 0}]:[{ssrcId:i[0].ssrcId}]}return[{ssrcId:i[0].ssrcId}]}(i,t.id,r.useRTX)});let c;try{c=yield a}catch(e){throw n.forEach(e=>{pO()&&e.replaceTrack(null),r.peerConnection.removeTrack(e)}),e}const d=r.mungSendOfferSDP(o.sdp,e);r.remoteSDP.receive(e,t,c);const u=r.remoteSDP.toString();return yield dZ(r.peerConnection.setLocalDescription({type:"offer",sdp:d})),yield dZ(r.applySendEncodings(n,e)),yield dZ(r.peerConnection.setRemoteDescription({type:"answer",sdp:u})),e.map((e,t)=>{const r=e._mediaStreamTrack.id;return{localSSRC:a[t],id:r}})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.send failed; ".concat(e.toString()))}finally{i()}}))()}async stopSending(e){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.stopSending before remote SDP created");const t=this.peerConnection.getSenders().filter(t=>{var r;return-1!==e.indexOf((null===(r=t.track)||void 0===r?void 0:r.id)||"")});if(t.length!==e.length)throw new Error("Transceivers' length doesn't match mids' length when trying to call P2PConnection.stopSending.");t.map(e=>{pO()&&e.replaceTrack(null),this.peerConnection.removeTrack(e)});const r=await this.peerConnection.createOffer();await this.peerConnection.setLocalDescription(r),this.remoteSDP.stopReceiving(e);const i=this.remoteSDP.toString();await this.peerConnection.setRemoteDescription({type:"answer",sdp:i})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.stopSending failed; ".concat(e.toString()))}}async receive(e,t,r,i){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.receive ".concat(e," before remoteSDP created."));const{id:r,mslabel:n}=this.remoteSDP.send(e,t,i),o=new ny((t,i)=>{const o=setTimeout(()=>{i(new Error("Cannot receive track, id: ".concat(r)))},1e4),s=i=>{const a=oO();if("Safari"===a.name&&11===Number(a.version)&&i.track.id!==r&&i.streams[0].id===n){var c;const n=i.streams[0].getTracks()[0];return null===(c=this.remoteSDP)||void 0===c||c.updateTrackLabel(e,r,i.track.id),this.peerConnection.removeEventListener("track",s),clearTimeout(o),void t(n)}if(i.track.id===r)return this.peerConnection.removeEventListener("track",s),clearTimeout(o),void t(i.track)};this.peerConnection.addEventListener("track",s)}),s=this.remoteSDP.toString();await this.peerConnection.setRemoteDescription({type:"offer",sdp:s});const a=await this.peerConnection.createAnswer();await this.peerConnection.setLocalDescription(a);return{track:await o,id:r}}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.receive failed; ".concat(e.toString()))}}async stopReceiving(e){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.stopReceiving before remote SDP created.");this.remoteSDP.stopSending(e);const t=this.remoteSDP.toString();await this.peerConnection.setRemoteDescription({type:"offer",sdp:t});const r=await this.peerConnection.createAnswer();await this.peerConnection.setLocalDescription(r)}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection stopReceiving failed; ".concat(e.toString()))}}async muteRemote(e){}async unmuteRemote(e){}async muteLocal(e){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.muteLocal before remote SDP created.");const t=this.peerConnection.getSenders().filter(t=>{var r;return-1!==e.indexOf((null===(r=t.track)||void 0===r?void 0:r.id)||"")});if(t.length!==e.length)throw new Error("sender' length doesn't match mids' length.");t.map(e=>{if(pO()&&e.track)e.track.enabled=!1;else{const t=e.getParameters();t.encodings.forEach(e=>e.active=!1),e.setParameters(t)}})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.muteLocal failed; ".concat(e.toString()))}}async unmuteLocal(e){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.unmuteLocal before remote SDP created.");const t=this.peerConnection.getSenders().filter(t=>{var r;return-1!==e.indexOf((null===(r=t.track)||void 0===r?void 0:r.id)||"")});if(t.length!==e.length)throw new Error("Senders' length doesn't match mids' length.");t.map(async e=>{if(pO()&&e.track)e.track.enabled=!0;else{const t=e.getParameters();t.encodings.forEach(e=>e.active=!0),await e.setParameters(t)}});const r=await this.peerConnection.createOffer();await this.peerConnection.setLocalDescription(r);const i=this.remoteSDP.toString();await this.peerConnection.setRemoteDescription({type:"answer",sdp:i})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.unmuteLocal failed; ".concat(e.toString()))}}async reEstablish(){const e=await this.peerConnection.createOffer({iceRestart:!0});if(!e.sdp)throw new Error("Cannot get SDP from restart offer.");return{iceParameters:UZ(e.sdp).iceParameters,restartICE:async(t,r)=>this.restartICE(e,t,r),restartOfferSDP:e.sdp}}close(){var e;this.peerConnection.close(),null===(e=this.onConnectionStateChange)||void 0===e||e.call(this,"closed"),this.unbindPCEvents(),this.unbindStatsEvents(),this.removeAllListeners(),this.statsFilter.destroy()}getStats(){return this.statsFilter.getStats()}getRemoteVideoIsReady(e){return this.statsFilter.getVideoIsReady(e)}async updateEncoderConfig(e,t){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.updateEncoderConfig before remote SDP created.");const e=await this.peerConnection.createOffer(),r=this.mungSendOfferSDP(e.sdp,[t]);this.remoteSDP.updateRecvMedia(t._mediaStreamTrack.kind,t);const i=this.remoteSDP.toString();await this.peerConnection.setLocalDescription({type:"offer",sdp:r}),await this.peerConnection.setRemoteDescription({type:"answer",sdp:i})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,e.toString())}}async updateSendParameters(e,t){const r=this.peerConnection.getSenders().filter(t=>{var r;return(null===(r=t.track)||void 0===r?void 0:r.id)===e});1===r.length&&await this.applySendEncodings(r,[t])}setStatsRemoteVideoIsReady(e,t){this.statsFilter.setVideoIsReady2(e,t)}async replaceTrack(e,t){const r=this.peerConnection.getSenders().find(e=>{var r;return(null===(r=e.track)||void 0===r?void 0:r.id)===t});r&&await r.replaceTrack(e._mediaStreamTrack)}async restartICE(e,t,r){try{if(!this.remoteSDP)throw new Error("Cannot restartICE before remoteSDP created.");this.remoteSDP.restartICE(t,r);const i=this.remoteSDP.toString();await this.peerConnection.setLocalDescription(e),await this.peerConnection.setRemoteDescription({type:"answer",sdp:i})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.restartICE failed; ".concat(e.toString()))}}bindPCEvents(){this.peerConnection.oniceconnectionstatechange=()=>{var e;null===(e=this.onICEConnectionStateChange)||void 0===e||e.call(this,this.peerConnection.iceConnectionState)},this.peerConnection.onconnectionstatechange=()=>{var e;null===(e=this.onConnectionStateChange)||void 0===e||e.call(this,this.peerConnection.connectionState)},this.peerConnection.onicecandidate=e=>{e.candidate?this.localCandidateCount+=1:(this.peerConnection.onicecandidate=null,this.allCandidatesReceived=!0,cD.debug("[pc-".concat(this.store.p2pId,"] local candidate count"),this.localCandidateCount))},setTimeout(()=>{this.allCandidatesReceived||(this.allCandidatesReceived=!0,cD.debug("[pc-".concat(this.store.p2pId,"] onicecandidate timeout, local candidate count"),this.localCandidateCount))},WD("CANDIDATE_TIMEOUT"))}unbindPCEvents(){this.peerConnection.oniceconnectionstatechange=null,this.peerConnection.onconnectionstatechange=null,this.peerConnection.onsignalingstatechange=null,this.peerConnection.onicecandidateerror=null,this.peerConnection.onicecandidate=null,this.peerConnection.ontrack=null}static resolvePCConfiguration(t){const r={iceServers:[],sdpSemantics:"plan-b"};return t.iceServers?r.iceServers=t.iceServers:t.turnServer&&"off"!==t.turnServer.mode&&(Uk(t.turnServer.servers)?r.iceServers=t.turnServer.servers:(r.iceServers&&r.iceServers.push(...e.turnServerConfigToIceServers(t.turnServer.servers)),WD("USE_TURN_SERVER_OF_GATEWAY")&&r.iceServers&&t.turnServer.serversFromGateway&&r.iceServers.push(...e.turnServerConfigToIceServers(t.turnServer.serversFromGateway)),t.turnServer.servers.concat(t.turnServer.serversFromGateway||[]).forEach(e=>{e.forceturn&&(r.iceTransportPolicy="relay")}))),r}static turnServerConfigToIceServers(e){const t=[];return e.forEach(e=>{e.security?e.tcpport&&t.push({username:e.username,credential:e.password,credentialType:"password",urls:"turns:".concat(e.turnServerURL,":").concat(e.tcpport,"?transport=tcp")}):(e.udpport&&t.push({username:e.username,credential:e.password,credentialType:"password",urls:"turn:".concat(e.turnServerURL,":").concat(e.udpport,"?transport=udp")}),e.tcpport&&t.push({username:e.username,credential:e.password,credentialType:"password",urls:"turn:".concat(e.turnServerURL,":").concat(e.tcpport,"?transport=tcp")}))}),t}async applySendEncodings(e,t){try{if(!BP().supportSetRtpSenderParameters)return;if(e.length!==t.length)return;for(let i=0;i<e.length;i++){var r;const n=e[i],o=t[i];if(!o)continue;const s={},a={};if(o instanceof Zq)switch(o._optimizationMode){case"motion":s.degradationPreference="maintain-framerate";break;case"detail":s.degradationPreference="maintain-resolution";break;default:s.degradationPreference="balanced"}if(WD("DSCP_TYPE")&&yO()){const e=WD("DSCP_TYPE");["very-low","low","medium","high"].includes(e)&&(a.networkPriority=e)}const c=n.getParameters(),d=null===(r=c.encodings)||void 0===r?void 0:r[0];d&&Object.assign(d,a),Object.assign(c,s),await n.setParameters(c)}}catch(e){cD.debug("Apply RTPSendEncodings failed.")}}mungSendOfferSDP(e,t){const r=kZ.exports.parse(e);return t.forEach((e,t)=>{const i=e._mediaStreamTrack,n=r.mediaDescriptions.find(e=>e.attributes.mid===i.kind);n&&FZ(n,e)}),kZ.exports.print(r)}bindStatsEvents(){this.statsFilter.onFirstAudioReceived=e=>{var t;null===(t=this.onFirstAudioReceived)||void 0===t||t.call(this,e)},this.statsFilter.onFirstVideoReceived=e=>{var t;null===(t=this.onFirstVideoReceived)||void 0===t||t.call(this,e)},this.statsFilter.onFirstAudioDecoded=e=>{var t;null===(t=this.onFirstAudioDecoded)||void 0===t||t.call(this,e)},this.statsFilter.onFirstVideoDecoded=(e,t,r)=>{var i;null===(i=this.onFirstVideoDecoded)||void 0===i||i.call(this,e,t,r)},this.statsFilter.onSelectedLocalCandidateChanged=(e,t)=>{var r;null===(r=this.onSelectedLocalCandidateChanged)||void 0===r||r.call(this,e,t)},this.statsFilter.onSelectedRemoteCandidateChanged=(e,t)=>{var r;null===(r=this.onSelectedRemoteCandidateChanged)||void 0===r||r.call(this,e,t)}}unbindStatsEvents(){this.statsFilter.onFirstAudioReceived=void 0,this.statsFilter.onFirstVideoReceived=void 0,this.statsFilter.onFirstAudioDecoded=void 0,this.statsFilter.onFirstVideoDecoded=void 0,this.statsFilter.onSelectedLocalCandidateChanged=void 0,this.statsFilter.onSelectedRemoteCandidateChanged=void 0}async batchReceive(e){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.batchReceive before remoteSDP created.");const t=this.remoteSDP.batchSend(e).map((t,r)=>{let{id:i,mslabel:n}=t;const{kind:o}=e[r];return new ny((e,t)=>{const r=setTimeout(()=>{t(new Error("Cannot receive track, id: ".concat(i)))},1e4),s=t=>{const a=oO();if("Safari"===a.name&&11===Number(a.version)&&t.track.id!==i&&t.streams[0].id===n){var c;const n=t.streams[0].getTracks()[0];return null===(c=this.remoteSDP)||void 0===c||c.updateTrackLabel(o,i,t.track.id),this.peerConnection.removeEventListener("track",s),clearTimeout(r),void e({track:n,id:i})}if(t.track.id===i)return this.peerConnection.removeEventListener("track",s),clearTimeout(r),void e({track:t.track,id:i})};this.peerConnection.addEventListener("track",s)})}),r=this.remoteSDP.toString();await this.peerConnection.setRemoteDescription({type:"offer",sdp:r});const i=await this.peerConnection.createAnswer();return await this.peerConnection.setLocalDescription(i),await ny.all(t)}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.receive failed; ".concat(e.toString()))}}}).prototype,"connect",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"connect"),u$.prototype),qF(u$.prototype,"stopSending",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"stopSending"),u$.prototype),qF(u$.prototype,"receive",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"receive"),u$.prototype),qF(u$.prototype,"stopReceiving",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"stopReceiving"),u$.prototype),qF(u$.prototype,"muteRemote",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"muteRemote"),u$.prototype),qF(u$.prototype,"unmuteRemote",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"unmuteRemote"),u$.prototype),qF(u$.prototype,"muteLocal",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"muteLocal"),u$.prototype),qF(u$.prototype,"unmuteLocal",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"unmuteLocal"),u$.prototype),qF(u$.prototype,"reEstablish",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"reEstablish"),u$.prototype),qF(u$.prototype,"close",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"close"),u$.prototype),qF(u$.prototype,"updateEncoderConfig",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"updateEncoderConfig"),u$.prototype),qF(u$.prototype,"updateSendParameters",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"updateSendParameters"),u$.prototype),qF(u$.prototype,"replaceTrack",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"replaceTrack"),u$.prototype),qF(u$.prototype,"restartICE",[E$],Object.getOwnPropertyDescriptor(u$.prototype,"restartICE"),u$.prototype),u$);function E$(e,t,r){const i=e[t];if("function"!=typeof i)throw new Error("Cannot use mutex on object property.");return r.value=async function(){const e=this.mutex,r=await e.lock("Locking from P2PConnection.".concat(t));try{for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return await i.apply(this,o)}finally{r()}},r}var I$;const m$="9",_$=4e4;let C$=LD("RemoteSDP")(I$=class{get localCapabilities(){return PG(this._localCapabilities)}get rtpCapabilities(){return PG(this._rtpCapabilities)}get candidates(){return PG(this._candidates)}get iceParameters(){return PG(this._iceParameters)}get dtlsParameters(){return PG(this._dtlsParameters)}constructor(e){kO(this,"sessionDesc",void 0),kO(this,"_localCapabilities",void 0),kO(this,"_rtpCapabilities",void 0),kO(this,"_candidates",void 0),kO(this,"_iceParameters",void 0),kO(this,"_dtlsParameters",void 0),kO(this,"setup",void 0),kO(this,"currentMidIndex",void 0),kO(this,"cname",void 0),e=PG(e);const{remoteIceParameters:t,remoteDtlsParameters:r,candidates:i,remoteRTPCapabilities:n,remoteSetup:o,localCapabilities:s,cname:a}=e,c=kZ.exports.parse("v=0\no=- 0 0 IN IP4 127.0.0.1\ns=AgoraGateway\nt=0 0\na=group:BUNDLE 0 1\na=msid-semantic: WMS\na=ice-lite\nm=video 9 UDP/TLS/RTP/SAVPF 0\nc=IN IP4 127.0.0.1\na=rtcp:9 IN IP4 0.0.0.0\na=sendonly\na=rtcp-mux\na=rtcp-rsize\na=mid:0\nm=audio 9 UDP/TLS/RTP/SAVPF 0\nc=IN IP4 127.0.0.1\na=rtcp:9 IN IP4 0.0.0.0\na=sendonly\na=rtcp-mux\na=rtcp-rsize\na=mid:1\n");this._rtpCapabilities=n,this._candidates=i,this._iceParameters=t,this._dtlsParameters=r,this._localCapabilities=s,this.setup=o,this.cname=a;const d=this.rtpCapabilities.send;for(const e of c.mediaDescriptions){if(e.attributes.iceUfrag=t.iceUfrag,e.attributes.icePwd=t.icePwd,e.attributes.fingerprints=r.fingerprints,e.attributes.candidates=i,e.attributes.setup=o,"video"===e.media.mediaType&&(e.media.fmts=d.videoCodecs.map(e=>e.payloadType.toString(10)),e.attributes.payloads=d.videoCodecs,e.attributes.extmaps=d.videoExtensions,WD("PRELOAD_MEDIA_COUNT")>0)){const{ssrcs:t,ssrcGroups:r}=xZ([{ssrcId:_$,rtx:WD("USE_RTX")?40001:void 0}],this.cname);e.attributes.ssrcs=t,e.attributes.ssrcGroups=r}if("audio"===e.media.mediaType&&(e.media.fmts=d.audioCodecs.map(e=>e.payloadType.toString(10)),e.attributes.payloads=d.audioCodecs,e.attributes.extmaps=d.audioExtensions,WD("PRELOAD_MEDIA_COUNT")>0)){const{ssrcs:t,ssrcGroups:r}=xZ([{ssrcId:2e4}],this.cname);e.attributes.ssrcs=t,e.attributes.ssrcGroups=r}}this.sessionDesc=c,this.currentMidIndex=c.mediaDescriptions.length-1}preloadRemoteMedia(){const e=WD("PRELOAD_MEDIA_COUNT");OD("debug",this,"preloadRemoteMedia",e),this.rtpCapabilities;const t=this.candidates,r=this.dtlsParameters,i=this.iceParameters,n=this.rtpCapabilities.send;for(let o=1;o<e;o++){const e=2*o+2e4,s=2*o+_$,{ssrcs:a,ssrcGroups:c}=xZ([{ssrcId:e}],this.cname),{ssrcs:d,ssrcGroups:u}=xZ([{ssrcId:s,rtx:WD("USE_RTX")?s+1:void 0}],this.cname);this.sessionDesc.mediaDescriptions.push({media:{mediaType:"video",port:m$,protos:["UDP","TLS","RTP","SAVPF"],fmts:n.videoCodecs.map(e=>e.payloadType.toString(10))},connections:[{nettype:"IN",addrtype:"IP4",address:"127.0.0.1"}],bandwidths:[],attributes:{iceUfrag:i.iceUfrag,icePwd:i.icePwd,unrecognized:[],candidates:t,extmaps:n.videoExtensions,fingerprints:r.fingerprints,imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:d,ssrcGroups:u,rtcpFeedbackWildcards:[],payloads:n.videoCodecs,rtcp:{port:"9",netType:"IN",addressType:"IP4",address:"0.0.0.0"},setup:this.setup,direction:"sendonly",rtcpMux:!0,rtcpRsize:!0,mid:"".concat(2*o)}}),this.sessionDesc.mediaDescriptions.push({media:{mediaType:"audio",port:m$,protos:["UDP","TLS","RTP","SAVPF"],fmts:n.audioCodecs.map(e=>e.payloadType.toString(10))},connections:[{nettype:"IN",addrtype:"IP4",address:"127.0.0.1"}],bandwidths:[],attributes:{iceUfrag:i.iceUfrag,icePwd:i.icePwd,unrecognized:[],candidates:t,extmaps:n.audioExtensions,fingerprints:r.fingerprints,imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:a,ssrcGroups:c,rtcpFeedbackWildcards:[],payloads:n.audioCodecs,rtcp:{port:"9",netType:"IN",addressType:"IP4",address:"0.0.0.0"},setup:this.setup,direction:"sendonly",rtcpMux:!0,rtcpRsize:!0,mid:"".concat(2*o+1)}}),this.currentMidIndex+=2}this.updateBundleMids()}toString(){return kZ.exports.print(this.sessionDesc)}send(e,t,r,i){const{ssrcs:n,ssrcGroups:o}=xZ(t,this.cname,r),s=this.findPreloadMediaDesc(n);if(s){if(i&&(i.tcc||i.remb)){const e=this.sessionDesc.mediaDescriptions.indexOf(s);return this.sessionDesc.mediaDescriptions[e]=this.mungSendMediaDesc(s,i),{mid:s.attributes.mid,needExchangeSDP:!0}}return{mid:s.attributes.mid,needExchangeSDP:!1}}{const t=this.findAvailableMediaIndex(e);if(pO()){if(-1!==t&&1!==t){const e=PG(this.sessionDesc.mediaDescriptions[t]);return e.attributes.direction="sendonly",e.attributes.ssrcs=n,e.attributes.ssrcGroups=o,this.sessionDesc.mediaDescriptions[t]=this.mungSendMediaDesc(e,i),{mid:e.attributes.mid,needExchangeSDP:!0}}{const t=this.createOrRecycleSendMedia(e,n,o,"sendonly",i);return this.updateBundleMids(),{mid:t.attributes.mid,needExchangeSDP:!0}}}if(-1!==t){const e=PG(this.sessionDesc.mediaDescriptions[t]);return e.attributes.direction="sendonly",e.attributes.ssrcs=n,e.attributes.ssrcGroups=o,this.sessionDesc.mediaDescriptions[t]=this.mungSendMediaDesc(e,i),{mid:e.attributes.mid,needExchangeSDP:!0}}{const t=this.createOrRecycleSendMedia(e,n,o,"sendonly",i);return this.updateBundleMids(),{mid:t.attributes.mid,needExchangeSDP:!0}}}}batchSend(e){const t=e.map(e=>{let{kind:t,ssrcMsg:r,mslabel:i}=e;return this.send(t,r,i)}),r=[];let i=!1;return t.forEach(e=>{let{mid:t,needExchangeSDP:n}=e;n&&(i=!0),r.push(t)}),{mids:r,needExchangeSDP:i}}stopSending(e){const t=this.sessionDesc.mediaDescriptions.filter(t=>t.attributes.mid&&-1!==e.indexOf(t.attributes.mid));if(t.length!==e.length)throw new Error("mediaDescriptions' length doesn't match mids' length when calling RemoteSDP.stopSending.");t.forEach(e=>{"0"===e.attributes.mid||gO()||pO()?e.attributes.ssrcs=[]:(e.attributes.ssrcs=[],e.attributes.direction="inactive",e.media.port="0")}),this.updateBundleMids()}mute(e){const t=this.sessionDesc.mediaDescriptions.find(t=>t.attributes.mid===e);if(!t)throw new Error("mediaDescription not found with ".concat(e," in remote SDP when calling RemoteSDP.mute."));t.attributes.direction="inactive"}unmute(e){const t=this.sessionDesc.mediaDescriptions.find(t=>t.attributes.mid===e);if(!t)throw new Error("mediaDescription not found with ".concat(e," in remote SDP when calling RemoteSDP.unmute."));t.attributes.direction="sendonly"}muteRemote(e){const t=this.sessionDesc.mediaDescriptions.filter(t=>e.includes(t.attributes.mid||""));if(t.length!==e.length)throw new Error("mediaDescriptions' length doesn't match mids' length when calling RemoteSDP.muteRemote.");t.forEach(e=>{e.attributes.direction="inactive"})}unmuteRemote(e){const t=this.sessionDesc.mediaDescriptions.filter(t=>e.includes(t.attributes.mid||""));if(t.length!==e.length)throw new Error("mediaDescriptions' length doesn't match mids' length when calling RemoteSDP.muteRemote.");t.forEach(e=>{e.attributes.direction="recvonly"})}receive(e,t,r,i){e.forEach((e,n)=>{this.createOrRecycleRecvMedia(e,[],"recvonly",t,r,i[n])}),this.updateBundleMids()}stopReceiving(e){const t=this.sessionDesc.mediaDescriptions.filter(t=>-1!==e.indexOf(t.attributes.mid));if(t.length!==e.length)throw new Error("MediaDescriptions' length doesn't match mids's length when calling RemoteSDP.receive.");t.forEach(e=>{e.media.port="0",e.attributes.direction="inactive"}),this.updateBundleMids()}restartICE(e,t){e=PG(e),t=PG(t),this._iceParameters=e,this._candidates=t,this.sessionDesc.mediaDescriptions.forEach(t=>{t.attributes.iceUfrag=e.iceUfrag,t.attributes.icePwd=e.icePwd,t.attributes.candidates=this.candidates})}predictReceivingMids(e){const t=[];for(let r=0;r<e;r++)t.push((this.currentMidIndex+r+1).toString(10));return t}findAvailableMediaIndex(e){return this.sessionDesc.mediaDescriptions.findIndex(t=>t.media.mediaType===e&&"0"!==t.media.port&&("sendonly"===t.attributes.direction||"sendrecv"===t.attributes.direction)&&0===t.attributes.ssrcs.length)}createOrRecycleRecvMedia(e,t,r,i,n,o){const s=e._mediaStreamTrack.kind,a=this.rtpCapabilities.recv,c=this.localCapabilities.send;let d=[];if(s===yP.VIDEO){var u,A;if(WD("H264_PROFILE_LEVEL_ID")&&"h264"===i&&(d=a.videoCodecs.filter(e=>{var t,r;return((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"").includes(i)&&(null==e||null===(r=e.fmtp)||void 0===r?void 0:r.parameters["profile-level-id"])===WD("H264_PROFILE_LEVEL_ID")})),!d||0===(null===(u=d)||void 0===u?void 0:u.length)){const e=c.videoCodecs.filter(e=>{var t;return((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"").includes(i)});0!==e.length&&(d=a.videoCodecs.filter(t=>e.some(e=>e.payloadType===t.payloadType)))}if(WD("USE_RTX")){const e=d.map(e=>e.payloadType.toString()),t=a.videoCodecs.filter(t=>{var r,i;return"rtx"===(null===(r=t.rtpMap)||void 0===r?void 0:r.encodingName)&&e.includes((null===(i=t.fmtp)||void 0===i?void 0:i.parameters.apt)||"")});d=[...d,...t]}if(0===d.length)cD.warning("codec ".concat(i," not included in rtpCapabilities, fallback to default payloads: ").concat(null===(A=a.videoCodecs[0].rtpMap)||void 0===A?void 0:A.encodingName)),d=a.videoCodecs}else d=a.audioCodecs.filter(e=>{var t;return((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"").includes(n)}),0===d.length&&(cD.warning("codec ".concat(n," not included in rtpCapabilities, fallback to opus")),d=a.audioCodecs.filter(e=>{var t;return((null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLowerCase())||"").includes("opus")}));const h=s===yP.VIDEO?a.videoExtensions:a.audioExtensions;this.currentMidIndex+=1;const l="".concat(this.currentMidIndex);let p={media:{mediaType:s,port:m$,protos:["UDP","TLS","RTP","SAVPF"],fmts:d.map(e=>e.payloadType.toString(10))},connections:[{nettype:"IN",addrtype:"IP4",address:"127.0.0.1"}],bandwidths:[],attributes:{iceUfrag:this.iceParameters.iceUfrag,icePwd:this.iceParameters.icePwd,unrecognized:[],candidates:this.candidates,extmaps:h,fingerprints:this.dtlsParameters.fingerprints,imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:t,ssrcGroups:[],rtcpFeedbackWildcards:[],payloads:d,rtcp:{port:"9",netType:"IN",addressType:"IP4",address:"0.0.0.0"},setup:this.setup,direction:r,rtcpMux:!0,rtcpRsize:!0,mid:"".concat(l)}};p=this.mungRecvMediaDsec(p,e,o);const g=this.findFirstClosedMedia(s);if(g){const e=this.sessionDesc.mediaDescriptions.indexOf(g);this.sessionDesc.mediaDescriptions[e]=p}else this.sessionDesc.mediaDescriptions.push(p);return p}createOrRecycleSendMedia(e,t,r,i,n){const o=this.rtpCapabilities.send,s=e===yP.VIDEO?o.videoCodecs:o.audioCodecs,a=e===yP.VIDEO?o.videoExtensions:o.audioExtensions;this.currentMidIndex+=1;const c="".concat(this.currentMidIndex);let d={media:{mediaType:e,port:m$,protos:["UDP","TLS","RTP","SAVPF"],fmts:s.map(e=>e.payloadType.toString(10))},connections:[{nettype:"IN",addrtype:"IP4",address:"127.0.0.1"}],bandwidths:[],attributes:{iceUfrag:this.iceParameters.iceUfrag,icePwd:this.iceParameters.icePwd,unrecognized:[],candidates:this.candidates,extmaps:a,fingerprints:this.dtlsParameters.fingerprints,imageattr:[],msids:[],remoteCandidatesList:[],rids:[],ssrcs:t,ssrcGroups:r,rtcpFeedbackWildcards:[],payloads:s,rtcp:{port:"9",netType:"IN",addressType:"IP4",address:"0.0.0.0"},setup:this.setup,direction:i,rtcpMux:!0,rtcpRsize:!0,mid:"".concat(c)}};d=this.mungSendMediaDesc(d,n);const u=this.findFirstClosedMedia(e);if(u){const e=this.sessionDesc.mediaDescriptions.indexOf(u);this.sessionDesc.mediaDescriptions[e]=d}else this.sessionDesc.mediaDescriptions.push(d);return d}updateBundleMids(){this.sessionDesc.attributes.groups[0].identificationTag=this.sessionDesc.mediaDescriptions.filter(e=>"0"!==e.media.port).map(e=>e.attributes.mid)}mungRecvMediaDsec(e,t,r){const i=PG(e);return VZ(i),FZ(i,t),jZ(i,t),function(e){if("video"!==e.media.mediaType)return;const t=oO();if(t.name!==tO.SAFARI&&t.os!==eO.IOS)return;const r=e.attributes.extmaps.findIndex(e=>/video-orientation/g.test(e.extensionName));-1!==r&&e.attributes.extmaps.splice(r,1)}(i),GZ(i,r,this.localCapabilities.send),i}mungSendMediaDesc(e,t){const r=PG(e);return GZ(r,t,this.localCapabilities.recv),r}updateRecvMedia(e,t){const r=this.sessionDesc.mediaDescriptions.findIndex(t=>t.attributes.mid===e);if(-1!==r){const e=this.mungRecvMediaDsec(this.sessionDesc.mediaDescriptions[r],t);this.sessionDesc.mediaDescriptions[r]=e}}bumpMid(e){this.currentMidIndex+=e}findFirstClosedMedia(e){return this.sessionDesc.mediaDescriptions.find(t=>gO()?"0"===t.media.port&&t.media.mediaType===e:"0"===t.media.port)}findPreloadMediaDesc(e){return this.sessionDesc.mediaDescriptions.find(t=>{var r,i;return(null===(r=t.attributes)||void 0===r||null===(i=r.ssrcs[0])||void 0===i?void 0:i.ssrcId)===e[0].ssrcId})}})||I$;var v$,S$;function y$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function R$(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y$(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y$(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let T$=LD("P2PConnection","store.p2pId")((qF((S$=class e extends NP{get currentLocalDescription(){return this.peerConnection.currentLocalDescription}get currentRemoteDescription(){return this.peerConnection.currentRemoteDescription}get peerConnectionState(){return this.peerConnection.connectionState}get iceConnectionState(){return this.peerConnection.iceConnectionState}constructor(t,r){super(t,r),kO(this,"store",void 0),kO(this,"peerConnection",void 0),kO(this,"remoteSDP",void 0),kO(this,"initialOffer",void 0),kO(this,"transportEventReceiver",void 0),kO(this,"statsFilter",void 0),kO(this,"useRTX",WD("USE_RTX")),kO(this,"localCapabilities",void 0),kO(this,"localCandidateCount",0),kO(this,"allCandidatesReceived",!1),kO(this,"mutex",new kV("P2PConnection-mutex")),this.store=r,this.peerConnection=new RTCPeerConnection(e.resolvePCConfiguration(t),{optional:[{googDscp:!0}]}),this.statsFilter=l$(this.peerConnection,void 0,void 0,gO()?1200:void 0),this.bindPCEvents(),this.bindStatsEvents(),this.store.p2pId=this.store.p2pId+1}async establish(){try{this.peerConnection.addTransceiver("video",{direction:"recvonly"}),this.peerConnection.addTransceiver("audio",{direction:"recvonly"});const e=await this.peerConnection.createOffer();if(!e.sdp)throw new Error("Cannot get initialOffer.sdp when trying to establish PeerConnection.");const t=UZ(e.sdp),r=await async function(e,t,r,i){const n=new RTCPeerConnection;n.addTransceiver("video",{direction:"sendonly"}),n.addTransceiver("audio",{direction:"sendonly"}),n.addTransceiver("video",{direction:"recvonly"}),n.addTransceiver("audio",{direction:"recvonly"});const o=(await n.createOffer()).sdp,s=MZ(o,e,t,r,i,"sendonly"),a=MZ(o,e,t,r,i,"recvonly"),c={audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]},d={audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]},u={audioCodecs:[],audioExtensions:[],videoCodecs:[],videoExtensions:[]};if(KZ(s,a,"videoExtensions",c,d,u),KZ(s,a,"videoCodecs",c,d,u),KZ(s,a,"audioExtensions",c,d,u),KZ(s,a,"audioCodecs",c,d,u),WD("RAISE_H264_BASELINE_PRIORITY")){const e=u.videoCodecs.findIndex(e=>{var t,r;return"h264"===(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLocaleLowerCase())&&"42001f"===(null===(r=e.fmtp)||void 0===r?void 0:r.parameters["profile-level-id"])});if(-1!==e){const t=u.videoCodecs.findIndex(e=>{var t;return"h264"===(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLocaleLowerCase())});if(t<e){cD.debug("raising H264 baseline profile priority");const r=u.videoCodecs[e];u.videoCodecs.splice(e,1),u.videoCodecs.splice(t,0,r)}-1!==t&&(d.videoCodecs=d.videoCodecs.filter(e=>{var t,r;return!("h264"===(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLocaleLowerCase())&&"42001f"!==(null===(r=e.fmtp)||void 0===r?void 0:r.parameters["profile-level-id"]))})),-1!==t&&WD("FILTER_SEND_H264_BASELINE")&&(c.videoCodecs=c.videoCodecs.filter(e=>{var t,r;return!("h264"===(null===(t=e.rtpMap)||void 0===t?void 0:t.encodingName.toLocaleLowerCase())&&"42001f"!==(null===(r=e.fmtp)||void 0===r?void 0:r.parameters["profile-level-id"]))}))}}try{n.close()}catch(e){}return{send:c,recv:d,sendrecv:u}}(!this.useRTX,!1);return this.localCapabilities=HZ(r),this.initialOffer=e,R$(R$({},t),{},{rtpCapabilities:r,offerSDP:e.sdp})}catch(e){throw new eD($N.GET_LOCAL_CONNECTION_PARAMS_FAILED,e.toString())}}async connect(e,t,r,i,n,o){try{if(!this.initialOffer)throw new Error("Cannot establish P2PConnection without initial offer.");this.remoteSDP=new C$({remoteIceParameters:e,remoteDtlsParameters:t,candidates:r,remoteRTPCapabilities:i,remoteSetup:n,localCapabilities:this.localCapabilities,cname:o});const s=this.remoteSDP.toString(),a=this.logSDPExchange(this.initialOffer.sdp||"","offer","local","connect");await this.peerConnection.setLocalDescription(this.initialOffer),null==a||a(s),await this.peerConnection.setRemoteDescription({type:"answer",sdp:s});const c=this.peerConnection.getTransceivers()[0];if(null!=c&&c.receiver&&this.tryBindTransportEvents(c.receiver),WD("PRELOAD_MEDIA_COUNT")>0){this.remoteSDP.preloadRemoteMedia();const e=this.remoteSDP.toString();await this.peerConnection.setRemoteDescription({type:"offer",sdp:e});const t=await this.peerConnection.createAnswer();await this.peerConnection.setLocalDescription(t)}}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.connect failed; ".concat(e.toString()))}}send(e,t,r){var i=this;return cZ((function*(){const n=yield dZ(i.mutex.lock());try{if(!i.remoteSDP)throw new Error("Cannot call P2PConnection.send before remote SDP created");const o=[];e.forEach(e=>{const t=i.peerConnection.addTransceiver(e._mediaStreamTrack,{direction:"sendonly"});o.push(t)}),gO()&&!0===WD("SIMULCAST")&&(RD("debug",i,"apply simulcast for firefox"),yield dZ(i.applySimulcastForFirefox(o,e)));const s=yield dZ(i.peerConnection.createOffer()),a=i.remoteSDP.predictReceivingMids(e.length),c=i.mungSendOfferSDP(s.sdp,e,a),d=kZ.exports.parse(c),u=a.map(e=>{const t=d.mediaDescriptions.find(t=>t.attributes.mid===e);if(!t)throw new Error("Cannot extract ssrc from mediaDescription.");return function(e,t){const r=[],i=e.attributes.ssrcGroups.filter(e=>"FID"===e.semantic),n=e.attributes.ssrcGroups.find(e=>"SIM"===e.semantic),o=e.attributes.ssrcs;if(n)n.ssrcIds.forEach(e=>{var n;const o=null===(n=i.find(t=>t.ssrcIds[0]===e))||void 0===n?void 0:n.ssrcIds[1];r.push({ssrcId:e,rtx:t?o:void 0})});else if(i.length>0){const e=i[0].ssrcIds[0],n=i[0].ssrcIds[1];r.push({ssrcId:e,rtx:t?n:void 0})}else{if(0===o.length)throw new Error("No ssrcs found on local media description.");r.push({ssrcId:o[0].ssrcId})}return r}(t,i.useRTX)});let A;try{A=yield u}catch(n){A=[],i.remoteSDP.receive(e,t,r,A);const o=i.remoteSDP.toString();throw yield dZ(i.peerConnection.setLocalDescription({type:"offer",sdp:c})),yield dZ(i.peerConnection.setRemoteDescription({type:"answer",sdp:o})),yield dZ(i.stopSending(a,!0)),n}i.remoteSDP.receive(e,t,r,A);const h=i.remoteSDP.toString(),l=i.logSDPExchange(c,"offer","local","send");return yield dZ(i.peerConnection.setLocalDescription({type:"offer",sdp:c})),yield dZ(i.applySimulcastEncodings(o,e)),yield dZ(i.applySendEncodings(o,e)),null==l||l(h),yield dZ(i.peerConnection.setRemoteDescription({type:"answer",sdp:h})),o.map((e,t)=>{const r=a[t];return{localSSRC:u[t],id:r,transceiver:e}})}catch(e){throw e instanceof eD?e:new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.send failed; ".concat(e.toString()))}finally{n()}}))()}async stopSending(e,t){const r=t?void 0:await this.mutex.lock("From P2PConnection.stopSending");try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.stopSending before remote SDP created");const t=this.peerConnection.getTransceivers().filter(t=>-1!==e.indexOf(t.mid));if(t.length!==e.length)throw new Error("Transceivers' length doesn't match mids' length when trying to call P2PConnection.stopSending.");t.map(e=>{var t;e.direction="inactive",null===(t=e.stop)||void 0===t||t.call(e)});const i=await this.peerConnection.createOffer(),n=this.logSDPExchange(i.sdp||"","offer","local","stopSending");await this.peerConnection.setLocalDescription(i),this.remoteSDP.stopReceiving(e);const o=this.remoteSDP.toString();null==n||n(o),await this.peerConnection.setRemoteDescription({type:"answer",sdp:o})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.stopSending failed; ".concat(e.toString()))}finally{r&&r()}}async receive(e,t,r,i){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.receive ".concat(e," before remoteSDP created."));const{mid:n,needExchangeSDP:o}=this.remoteSDP.send(e,t,r,i);if(o){const t=this.remoteSDP.toString(),r=this.logSDPExchange(t,"offer","remote","receive");await this.peerConnection.setRemoteDescription({type:"offer",sdp:t});const i=await this.peerConnection.createAnswer();null==r||r(i.sdp||""),await this.peerConnection.setLocalDescription(i),cD.debug("[P2PConnection] receive ".concat(e," by exchanging SDP."))}else cD.debug("[P2PConnection] receive ".concat(e," no need to exchange SDP."));const s=this.peerConnection.getTransceivers().find(e=>e.mid===n);if(!s)throw new Error("Cannot get transceiver after setLocalDescription.");return{track:s.receiver.track,id:n}}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.receive failed; ".concat(e.toString()))}}async batchReceive(e){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.batchReceive before remoteSDP created.");const{mids:t,needExchangeSDP:r}=this.remoteSDP.batchSend(e);if(r){const e=this.remoteSDP.toString(),t=this.logSDPExchange(e,"offer","remote","receive");await this.peerConnection.setRemoteDescription({type:"offer",sdp:e});const r=await this.peerConnection.createAnswer();null==t||t(r.sdp||""),await this.peerConnection.setLocalDescription(r),cD.debug("[P2PConnection] batchReceive by exchanging SDP.")}else cD.debug("[P2PConnection] batchReceive no need to exchange SDP.");return t.map(e=>{const t=this.peerConnection.getTransceivers().find(t=>t.mid===e);if(!t)throw new Error("Cannot get transceiver after setLocalDescription.");return{track:t.receiver.track,id:e}})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.receive failed; ".concat(e.toString()))}}async stopReceiving(e){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.stopReceiving before remote SDP created.");this.remoteSDP.stopSending(e);const t=this.remoteSDP.toString(),r=this.logSDPExchange(t,"offer","remote","stopReceiving");await this.peerConnection.setRemoteDescription({type:"offer",sdp:t});const i=await this.peerConnection.createAnswer();null==r||r(i.sdp||""),await this.peerConnection.setLocalDescription(i)}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection stopReceiving failed; ".concat(e.toString()))}}async muteRemote(e){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.muteRemote mid=".concat(e," before remote SDP created."));this.remoteSDP.mute(e);const t=this.remoteSDP.toString(),r=this.logSDPExchange(t,"offer","remote","muteRemote");await this.peerConnection.setRemoteDescription({type:"offer",sdp:t});const i=await this.peerConnection.createAnswer();null==r||r(i.sdp||""),await this.peerConnection.setLocalDescription(i)}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.muteRemote failed; ".concat(e.toString()))}}async unmuteRemote(e){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.unmuteRemote mid=".concat(e," before remote SDP created."));this.remoteSDP.unmute(e);const t=this.remoteSDP.toString(),r=this.logSDPExchange(t,"offer","remote","unmuteRemote");await this.peerConnection.setRemoteDescription({type:"offer",sdp:t});const i=await this.peerConnection.createAnswer();null==r||r(i.sdp||""),await this.peerConnection.setLocalDescription(i)}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.unmuteRemote failed; ".concat(e.toString()))}}async muteLocal(e){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.muteLocal before remote SDP created.");const t=this.peerConnection.getTransceivers().filter(t=>t.mid&&-1!==e.indexOf(t.mid));if(t.length!==e.length)throw new Error("Transceivers' length doesn't match mids' length.");t.map(e=>{e.direction="inactive"});const r=await this.peerConnection.createOffer(),i=this.logSDPExchange(r.sdp||"","offer","local","muteLocal");await this.peerConnection.setLocalDescription(r),this.remoteSDP.muteRemote(e);const n=this.remoteSDP.toString();null==i||i(n),await this.peerConnection.setRemoteDescription({type:"answer",sdp:n})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.muteLocal failed; ".concat(e.toString()))}}async unmuteLocal(e){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.unmuteLocal before remote SDP created.");const t=this.peerConnection.getTransceivers().filter(t=>t.mid&&-1!==e.indexOf(t.mid));if(t.length!==e.length)throw new Error("Transceivers' length doesn't match mids' length.");t.map(async(e,t)=>{e.direction="sendonly"});const r=await this.peerConnection.createOffer(),i=this.logSDPExchange(r.sdp||"","offer","local","unmuteLocal");await this.peerConnection.setLocalDescription(r),this.remoteSDP.unmuteRemote(e);const n=this.remoteSDP.toString();null==i||i(n),await this.peerConnection.setRemoteDescription({type:"answer",sdp:n})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.unmuteLocal failed; ".concat(e.toString()))}}async reEstablish(){const e=await this.peerConnection.createOffer({iceRestart:!0});if(!e.sdp)throw new Error("Cannot get SDP from restart offer.");return{iceParameters:UZ(e.sdp).iceParameters,restartICE:async(t,r)=>this.restartICE(e,t,r),restartOfferSDP:e.sdp}}close(){var e;this.peerConnection.close(),null===(e=this.onConnectionStateChange)||void 0===e||e.call(this,"closed"),this.tryUnbindTransportEvents(),this.unbindPCEvents(),this.unbindStatsEvents(),this.removeAllListeners(),this.transportEventReceiver=void 0,this.statsFilter.destroy()}getStats(){return this.statsFilter.getStats()}getRemoteVideoIsReady(e){return this.statsFilter.getVideoIsReady(e)}async updateEncoderConfig(e,t){try{if(!this.remoteSDP)throw new Error("Cannot call P2PConnection.updateEncoderConfig before remote SDP created.");const r=await this.peerConnection.createOffer(),i=this.mungSendOfferSDP(r.sdp,[t],[e]);this.remoteSDP.updateRecvMedia(e,t);const n=this.remoteSDP.toString(),o=this.logSDPExchange(i,"offer","local","updateEncoderConfig");await this.peerConnection.setLocalDescription({type:"offer",sdp:i}),null==o||o(n),await this.peerConnection.setRemoteDescription({type:"answer",sdp:n})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,e.toString())}}async updateSendParameters(e,t){const r=this.peerConnection.getTransceivers().filter(t=>t.mid===e);1===r.length&&(this.isVP8Simulcast(t)?gO()||await this.applySimulcastEncodings(r,[t]):await this.applySendEncodings(r,[t]))}setStatsRemoteVideoIsReady(e,t){this.statsFilter.setVideoIsReady2(e,t)}async replaceTrack(e,t){const r=this.peerConnection.getTransceivers().find(e=>e.mid===t);r&&await r.sender.replaceTrack(e._mediaStreamTrack)}async restartICE(e,t,r){try{if(!this.remoteSDP)throw new Error("Cannot restartICE before remoteSDP created.");this.remoteSDP.restartICE(t,r);const i=this.remoteSDP.toString(),n=this.logSDPExchange(e.sdp||"","offer","local","restartICE");await this.peerConnection.setLocalDescription(e),null==n||n(i),await this.peerConnection.setRemoteDescription({type:"answer",sdp:i})}catch(e){throw new eD($N.EXCHANGE_SDP_FAILED,"P2PConnection.restartICE failed; ".concat(e.toString()))}}bindPCEvents(){this.peerConnection.oniceconnectionstatechange=()=>{var e;null===(e=this.onICEConnectionStateChange)||void 0===e||e.call(this,this.peerConnection.iceConnectionState)},this.peerConnection.onconnectionstatechange=()=>{var e;null===(e=this.onConnectionStateChange)||void 0===e||e.call(this,this.peerConnection.connectionState)},this.peerConnection.onicecandidate=e=>{e.candidate?this.localCandidateCount+=1:(this.peerConnection.onicecandidate=null,this.allCandidatesReceived=!0,cD.debug("[pc-".concat(this.store.p2pId,"] local candidate count"),this.localCandidateCount))},setTimeout(()=>{this.allCandidatesReceived||(this.allCandidatesReceived=!0,cD.debug("[pc-".concat(this.store.p2pId,"] onicecandidate timeout, local candidate count"),this.localCandidateCount))},WD("CANDIDATE_TIMEOUT"))}unbindPCEvents(){this.peerConnection.oniceconnectionstatechange=null,this.peerConnection.onconnectionstatechange=null,this.peerConnection.onsignalingstatechange=null,this.peerConnection.onicecandidateerror=null,this.peerConnection.onicecandidate=null,this.peerConnection.ontrack=null}static resolvePCConfiguration(t){const r={iceServers:[]};return t.iceServers?r.iceServers=t.iceServers:t.turnServer&&"off"!==t.turnServer.mode&&(Uk(t.turnServer.servers)?r.iceServers=t.turnServer.servers:(r.iceServers&&r.iceServers.push(...e.turnServerConfigToIceServers(t.turnServer.servers)),WD("USE_TURN_SERVER_OF_GATEWAY")&&r.iceServers&&t.turnServer.serversFromGateway&&r.iceServers.push(...e.turnServerConfigToIceServers(t.turnServer.serversFromGateway)),t.turnServer.servers.concat(t.turnServer.serversFromGateway||[]).forEach(e=>{e.forceturn&&(r.iceTransportPolicy="relay")}))),r}static turnServerConfigToIceServers(e){const t=[];return e.forEach(e=>{e.security?e.tcpport&&t.push({username:e.username,credential:e.password,credentialType:"password",urls:"turns:".concat(aG(e.turnServerURL),":").concat(e.tcpport,"?transport=tcp")}):(e.udpport&&t.push({username:e.username,credential:e.password,credentialType:"password",urls:"turn:".concat(e.turnServerURL,":").concat(e.udpport,"?transport=udp")}),e.tcpport&&t.push({username:e.username,credential:e.password,credentialType:"password",urls:"turn:".concat(e.turnServerURL,":").concat(e.tcpport,"?transport=tcp")}))}),t}tryBindTransportEvents(e){e.transport&&(this.transportEventReceiver=e,e.transport.onstatechange=()=>{var t,r;null!==(t=e.transport)&&void 0!==t&&t.state&&(null===(r=this.onDTLSTransportStateChange)||void 0===r||r.call(this,e.transport.state))},e.transport.onerror=e=>{var t;null===(t=this.onDTLSTransportError)||void 0===t||t.call(this,e.error)},e.transport.iceTransport&&(e.transport.iceTransport.onstatechange=()=>{var t,r,i;null!==(t=e.transport)&&void 0!==t&&t.iceTransport.state&&(null===(r=this.onICETransportStateChange)||void 0===r||r.call(this,null===(i=e.transport)||void 0===i?void 0:i.iceTransport.state))}))}tryUnbindTransportEvents(){this.transportEventReceiver&&this.transportEventReceiver.transport&&(this.transportEventReceiver.transport.onstatechange=null,this.transportEventReceiver.transport.onerror=null,this.transportEventReceiver.transport.iceTransport&&(this.transportEventReceiver.transport.iceTransport.onstatechange=null))}async applySendEncodings(e,t){try{if(!BP().supportSetRtpSenderParameters)return;if(e.length!==t.length)return;for(let c=0;c<e.length;c++){const d=e[c],u=t[c];if(u&&u instanceof Zq){var r,i;if(this.isVP8Simulcast(u))continue;const e={},t={};switch(u._optimizationMode){case"motion":e.degradationPreference="maintain-framerate";break;case"detail":e.degradationPreference="maintain-resolution";break;default:e.degradationPreference="balanced"}var n,o,s,a;if(null!==(r=u._encoderConfig)&&void 0!==r&&r.bitrateMax)t.maxBitrate=1e3*(null===(n=u._encoderConfig)||void 0===n?void 0:n.bitrateMax);if(u._hints.includes(AP.LOW_STREAM))null!==(o=u._encoderConfig)&&void 0!==o&&o.frameRate&&(t.maxFramerate=dG(u._encoderConfig.frameRate)),null!==(s=u._encoderConfig)&&void 0!==s&&s.scaleResolutionDownBy&&(null===(a=u._encoderConfig)||void 0===a?void 0:a.scaleResolutionDownBy)>1&&(t.scaleResolutionDownBy=u._encoderConfig.scaleResolutionDownBy);if(WD("DSCP_TYPE")&&yO()){const e=WD("DSCP_TYPE");["very-low","low","medium","high"].includes(e)&&(t.networkPriority=e)}const c=d.sender.getParameters(),A=null===(i=c.encodings)||void 0===i?void 0:i[0];gO()&&!A&&(e.encodings=[t]),A&&Object.assign(A,t),Object.assign(c,e),await d.sender.setParameters(c)}}}catch(e){cD.debug("Apply RTPSendEncodings failed.")}}mungSendOfferSDP(e,t,r){const i=kZ.exports.parse(e);return t.forEach((e,t)=>{const n=r[t],o=i.mediaDescriptions.find(e=>e.attributes.mid===n);o&&(FZ(o,e),function(e,t,r){if(gO())return;if("video"!==e.media.mediaType)return;if(!(t instanceof Zq))return;if("vp9"!==r&&"vp8"!==r)return;if("vp8"===r&&!WD("SIMULCAST"))return;if(void 0===t._scalabiltyMode||t._scalabiltyMode.numSpatialLayers<=1)return;const i="vp8"===r?2:t._scalabiltyMode.numSpatialLayers,n=e.attributes.ssrcs[0],o=e.attributes.ssrcGroups.find(e=>"FID"===e.semantic&&e.ssrcIds[0]===n.ssrcId),s={semantic:"SIM",ssrcIds:[n.ssrcId]};for(let t=1;t<i;t++)e.attributes.ssrcs.push({ssrcId:n.ssrcId+t,attributes:PG(n.attributes)}),s.ssrcIds.push(n.ssrcId+t),o&&(e.attributes.ssrcs.push({ssrcId:o.ssrcIds[1]+t,attributes:PG(n.attributes)}),e.attributes.ssrcGroups.push({semantic:"FID",ssrcIds:[n.ssrcId+t,o.ssrcIds[1]+t]}));e.attributes.ssrcGroups.unshift(s)}(o,e,this.store.codec))}),kZ.exports.print(i)}bindStatsEvents(){this.statsFilter.onFirstAudioReceived=e=>{var t;null===(t=this.onFirstAudioReceived)||void 0===t||t.call(this,e)},this.statsFilter.onFirstVideoReceived=e=>{var t;null===(t=this.onFirstVideoReceived)||void 0===t||t.call(this,e)},this.statsFilter.onFirstAudioDecoded=e=>{var t;null===(t=this.onFirstAudioDecoded)||void 0===t||t.call(this,e)},this.statsFilter.onFirstVideoDecoded=(e,t,r)=>{var i;null===(i=this.onFirstVideoDecoded)||void 0===i||i.call(this,e,t,r)},this.statsFilter.onSelectedLocalCandidateChanged=(e,t)=>{var r;null===(r=this.onSelectedLocalCandidateChanged)||void 0===r||r.call(this,e,t)},this.statsFilter.onSelectedRemoteCandidateChanged=(e,t)=>{var r;null===(r=this.onSelectedRemoteCandidateChanged)||void 0===r||r.call(this,e,t)}}unbindStatsEvents(){this.statsFilter.onFirstAudioReceived=void 0,this.statsFilter.onFirstVideoReceived=void 0,this.statsFilter.onFirstAudioDecoded=void 0,this.statsFilter.onFirstVideoDecoded=void 0,this.statsFilter.onSelectedLocalCandidateChanged=void 0,this.statsFilter.onSelectedRemoteCandidateChanged=void 0}async applySimulcastForFirefox(e,t){if(e.length===t.length)for(let s=0;s<e.length;s++){var r,i,n,o;const a=e[s],c=t[s];if(c instanceof Zq&&!c._hints.includes(AP.LOW_STREAM)&&null!==(r=c._encoderConfig)&&void 0!==r&&r.bitrateMax&&(null===(i=c._encoderConfig)||void 0===i?void 0:i.bitrateMax)>200&&null!==(n=c._scalabiltyMode)&&void 0!==n&&n.numSpatialLayers&&(null===(o=c._scalabiltyMode)||void 0===o?void 0:o.numSpatialLayers)>1&&"vp8"===this.store.codec){const e={},t={high:1e3*(c._encoderConfig.bitrateMax-50),medium:5e4};e.encodings=[{rid:"m",active:!0,maxBitrate:t.medium,scaleResolutionDownBy:4},{rid:"h",active:!0,maxBitrate:t.high}];const r=a.sender.getParameters();await a.sender.setParameters(Object.assign(r,e))}}}async applySimulcastEncodings(e,t){if(!gO()&&e.length===t.length)for(let r=0;r<e.length;r++){const i=t[r];if(i instanceof Zq&&this.isVP8Simulcast(i)){const t=e[r],n={},o={high:1e3*(i._encoderConfig.bitrateMax-50),medium:5e4};n.encodings=[{active:!0,adaptivePtime:!1,networkPriority:"high",priority:"high",maxBitrate:o.high},{active:!0,adaptivePtime:!1,networkPriority:"low",priority:"low",maxBitrate:o.medium,scaleResolutionDownBy:4}];const s=t.sender.getParameters();await t.sender.setParameters(Object.assign(s,n))}}}isVP8Simulcast(e){var t,r,i,n;return!!(e instanceof Zq&&WD("SIMULCAST")&&"vp8"===this.store.codec&&!e._hints.includes(AP.LOW_STREAM)&&null!==(t=e._encoderConfig)&&void 0!==t&&t.bitrateMax&&(null===(r=e._encoderConfig)||void 0===r?void 0:r.bitrateMax)>200&&null!==(i=e._scalabiltyMode)&&void 0!==i&&i.numSpatialLayers&&(null===(n=e._scalabiltyMode)||void 0===n?void 0:n.numSpatialLayers)>1)}logSDPExchange(e,t,r,i){if(WD("SDP_LOGGING"))return cD.upload("exchanging ".concat(r," ").concat(t," SDP during P2PConnection.").concat(i,"\n"),e),"offer"===t?e=>{this.logSDPExchange(e,"answer","local"===r?"remote":"local",i)}:void 0}}).prototype,"connect",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"connect"),S$.prototype),qF(S$.prototype,"receive",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"receive"),S$.prototype),qF(S$.prototype,"batchReceive",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"batchReceive"),S$.prototype),qF(S$.prototype,"stopReceiving",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"stopReceiving"),S$.prototype),qF(S$.prototype,"muteRemote",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"muteRemote"),S$.prototype),qF(S$.prototype,"unmuteRemote",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"unmuteRemote"),S$.prototype),qF(S$.prototype,"muteLocal",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"muteLocal"),S$.prototype),qF(S$.prototype,"unmuteLocal",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"unmuteLocal"),S$.prototype),qF(S$.prototype,"reEstablish",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"reEstablish"),S$.prototype),qF(S$.prototype,"close",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"close"),S$.prototype),qF(S$.prototype,"updateEncoderConfig",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"updateEncoderConfig"),S$.prototype),qF(S$.prototype,"updateSendParameters",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"updateSendParameters"),S$.prototype),qF(S$.prototype,"replaceTrack",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"replaceTrack"),S$.prototype),qF(S$.prototype,"restartICE",[w$],Object.getOwnPropertyDescriptor(S$.prototype,"restartICE"),S$.prototype),v$=S$))||v$;function w$(e,t,r){const i=e[t];if("function"!=typeof i)throw new Error("Cannot use mutex on object property.");return r.value=async function(){const e=this.mutex,r=await e.lock("From P2PConnection.".concat(t));try{for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return await i.apply(this,o)}finally{r()}},r}function b$(e,t){let r=document.createElement("video"),i=document.createElement("canvas");r.setAttribute("style","display:none"),i.setAttribute("style","display:none"),r.setAttribute("muted",""),r.muted=!0,r.setAttribute("autoplay",""),r.autoplay=!0,r.setAttribute("playsinline",""),i.width=dG(t.width),i.height=dG(t.height);const n=dG(t.framerate||15);document.body.append(r),document.body.append(i);let o=e._mediaStreamTrack;r.srcObject=new MediaStream([o]),r.play();const s=i.getContext("2d");if(!s)throw new eD($N.UNEXPECTED_ERROR,"can not get canvas context");const a=BP(),c=i.captureStream(a.supportRequestFrame?0:n).getVideoTracks()[0],d=HV(()=>(()=>{if(r.paused&&r.play(),r.videoHeight>2&&r.videoWidth>2){const e=r.videoWidth,t=r.videoHeight/e,n=i.width*t;Math.abs(n-i.height)>=2&&(cD.debug("adjust low stream resolution","".concat(i.width,"x").concat(i.height," -> ").concat(i.width,"x").concat(n)),i.height=n)}s.drawImage(r,0,0,i.width,i.height),c.requestFrame&&c.requestFrame(),o!==e._mediaStreamTrack&&(o=e._mediaStreamTrack,r.srcObject=new MediaStream([o]))})(),n),u=c.stop;return c.stop=()=>{u.call(c),d(),r.remove(),i.width=0,i.remove(),i=null,r=null,cD.debug("clean low stream renderer")},c}var O$,N$;function D$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function L$(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?D$(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):D$(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class k$ extends bV{getUserId(){return this._userId}constructor(e,t,r,i){super(e,"track-".concat(e.kind,"-").concat(t,"-").concat(i.clientId,"_").concat(vG(5,""))),kO(this,"_userId",void 0),kO(this,"_uintId",void 0),kO(this,"_isDestroyed",!1),kO(this,"store",void 0),this._userId=t,this._uintId=r,this.store=i}_updateOriginMediaStreamTrack(e){this._originMediaStreamTrack=e,this._mediaStreamTrack=e,this._updatePlayerSource()}_destroy(){this._isDestroyed=!0,cD.info("[".concat(this.getTrackId(),"] is destroyed")),OD("info",this,"_destroy"),this.stop(),super.close()}}let P$=LD("RemoteVideoTrack","getTrackId")(O$=class extends k${get isPlaying(){return!(!this._player||this._player.videoElementStatus!==ck.PLAYING)}constructor(e,t,r,i){super(e,t,r,i),kO(this,"_videoVisibleTimer",null),kO(this,"_previousVideoVisibleStatus",void 0),kO(this,"_clearPreviousVideoVisibleStatus",()=>this._previousVideoVisibleStatus=void 0),kO(this,"trackMediaType","video"),kO(this,"_videoWidth",void 0),kO(this,"_videoHeight",void 0),kO(this,"_player",void 0),OD("info",this,"constructor",{userId:t}),this.updateMediaStreamTrackResolution()}getStats(){MG(()=>{cD.warning("[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead"),RD("warning",this,"[deprecated] RemoteVideoTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteVideoStats instead")},"remoteVideoTrackGetStatsWarning");return OG(this,uP.GET_STATS)||L$({},Kk)}play(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.REMOTE_VIDEO_TRACK_PLAY,options:[this.getTrackId(),"string"==typeof e?e:"HTMLElement",t]});if("string"==typeof e){const t=document.getElementById(e);t?e=t:(cD.warning("[".concat(this.getTrackId(),'] can not find "#').concat(e,'" element, use document.body')),RD("warning",this,'can not find "#'.concat(e,'" element, use document.body')),e=document.body)}cD.debug("[".concat(this.getTrackId(),"] start video playback"),JSON.stringify(t)),OD("debug",this,"play",t);const i=L$(L$({fit:"cover"},t),{},{trackId:this.getTrackId(),element:e});this._player?this._player.updateConfig(i):(this._player=new zJ(i),this._player.updateVideoTrack(this._mediaStreamTrack),this._player.onFirstVideoFrameDecoded=()=>{this.store.subscribe(this.getUserId(),"video",void 0,void 0,performance.now()),this.emit(gP.FIRST_FRAME_DECODED)}),this._player.play(this.store.sessionId||void 0),this._videoVisibleTimer&&window.clearInterval(this._videoVisibleTimer),this._clearPreviousVideoVisibleStatus(),this._videoVisibleTimer=window.setInterval(()=>{try{const e=this.getVideoElementVisibleStatus();this.emit(gP.VIDEO_ELEMENT_VISIBLE_STATUS,e)}catch(e){}},WD("CHECK_VIDEO_VISIBLE_INTERVAL")),r.onSuccess()}stop(){const e=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.REMOTE_VIDEO_TRACK_STOP,options:[this.getTrackId()]});if(!this._player)return e.onSuccess();this._videoVisibleTimer&&(window.clearInterval(this._videoVisibleTimer),this._videoVisibleTimer=null),this._clearPreviousVideoVisibleStatus(),this._player.destroy(),this._player=void 0,cD.debug("[".concat(this.getTrackId(),"] stop video playback")),OD("debug",this,"stop"),e.onSuccess()}getCurrentFrameData(){return this._player?this._player.getCurrentFrame():new ImageData(2,2)}updateMediaStreamTrackResolution(){RG(this._originMediaStreamTrack).then(e=>{let[t,r]=e;this._videoHeight=r,this._videoWidth=t}).catch(yG)}_updatePlayerSource(){cD.debug("[".concat(this.getTrackId(),"] update player source track")),OD("debug",this,"_updatePlayerSource"),this._player&&this._player.updateVideoTrack(this._mediaStreamTrack)}getVideoElementVisibleStatus(){try{var e,t;const r=null==this||null===(e=this._player)||void 0===e?void 0:e.getContainerElement(),i={track:this,element:null==this||null===(t=this._player)||void 0===t?void 0:t.getVideoElement(),slot:null==r?void 0:r.parentElement},{element:n,slot:o}=i;if(this.isPlaying&&n instanceof HTMLVideoElement&&o instanceof HTMLElement){const e=qq.checkOneElementVisible(n),t=Object.assign({},e);if(t.visible!==this._previousVideoVisibleStatus){this._previousVideoVisibleStatus=t.visible;const e=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.REMOTE_VIDEO_TRACK_GET_VIDEO_VISIBLE,options:[this.getTrackId()]});t.visible?e.onSuccess("Video is visible"):e.onSuccess("Invisible because of ".concat(t.reason))}return t}return}catch(e){throw new eD($N.GET_VIDEO_ELEMENT_VISIBLE_ERROR,e.message)}}})||O$,B$=LD("RemoteAudioTrack","getTrackId")(N$=class extends k${get isPlaying(){return this._useAudioElement?hj.isPlaying(this.getTrackId()):this._source.isPlayed}constructor(e,t,r,i){super(e,t,r,i),kO(this,"trackMediaType","audio"),kO(this,"_source",void 0),kO(this,"_useAudioElement",!0),kO(this,"_volume",100),OD("info",this,"constructor",{userId:t}),WD("REMOTE_AUDIO_TRACK_USES_WEB_AUDIO")&&(this._useAudioElement=!1),this._source=new qV(e,!0),this._source.once(Pk.RECEIVE_TRACK_BUFFER,()=>{this.emit(gP.FIRST_FRAME_DECODED)})}setAudioFrameCallback(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4096;if(!e)return this._source.removeAllListeners(Pk.ON_AUDIO_BUFFER),void this._source.stopGetAudioBuffer();this._source.startGetAudioBuffer(t),this._source.removeAllListeners(Pk.ON_AUDIO_BUFFER),this._source.on(Pk.ON_AUDIO_BUFFER,t=>e(t))}setVolume(e){const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.REMOTE_AUDIO_SET_VOLUME,options:[this.getTrackId(),e]},300);this._volume=e,this._useAudioElement?hj.setVolume(this.getTrackId(),e):this._source.setVolume(e/100),t.onSuccess()}async setPlaybackDevice(e){const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.REMOTE_AUDIO_SET_OUTPUT_DEVICE,options:[this.getTrackId(),e]});if(!this._useAudioElement)throw new eD($N.NOT_SUPPORTED,"your browser does not support setting the audio output device");try{await hj.setSinkID(this.getTrackId(),e)}catch(e){throw t.onError(e),e}t.onSuccess()}getVolumeLevel(){return this._source.getAccurateVolumeLevel()}getStats(){MG(()=>{cD.warning("[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead"),RD("warning",this,"[deprecated] RemoteAudioTrack.getStats will be removed in the future, use AgoraRTCClient.getRemoteAudioStats instead")},"remoteAudioTrackGetStatsWarning");return OG(this,uP.GET_STATS)||L$({},jk)}play(){const e=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.REMOTE_AUDIO_TRACK_PLAY,options:[this.getTrackId()]});cD.debug("[".concat(this.getTrackId(),"] start audio playback")),OD("debug",this,"play"),this._useAudioElement?(cD.debug("[".concat(this.getTrackId(),"] use audio element to play")),RD("debug",this,"use audio element to play"),hj.play(this._mediaStreamTrack,this.getTrackId(),this._volume,this.store.sessionId||void 0)):this._source.play(),e.onSuccess()}stop(){const e=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.REMOTE_AUDIO_TRACK_STOP,options:[this.getTrackId()]});cD.debug("[".concat(this.getTrackId(),"] stop audio playback")),OD("debug",this,"stop"),this._useAudioElement?hj.stop(this.getTrackId()):this._source.stop(),e.onSuccess()}_destroy(){super._destroy(),this._source.destroy()}_isFreeze(){return this._source.isFreeze}_updatePlayerSource(){cD.debug("[".concat(this.getTrackId(),"] update player source track")),OD("debug",this,"_updatePlayerSource"),this._source.updateTrack(this._mediaStreamTrack),this._useAudioElement&&hj.updateTrack(this.getTrackId(),this._mediaStreamTrack)}})||N$;function M$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function U$(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M$(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M$(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}class Q$ extends XN{constructor(){super(),kO(this,"uplinkStatsUploadInterval",void 0),kO(this,"uplinkStatsUploadSlowInterval",void 0),kO(this,"uplinkRelatedStatsUploadInterval",void 0),kO(this,"uplinkDenoiserStatsUploadInterval",void 0),kO(this,"transportStatsUploadInterval",void 0),kO(this,"extensionStatsUploadInterval",void 0),kO(this,"downlinkStatsUploadInterval",void 0),kO(this,"downlinkStatsUploadSlowInterval",void 0),kO(this,"downlinkRelatedStatsUploadInterval",void 0),kO(this,"lastStats",void 0),kO(this,"uploadUnplinkStarted",!1),kO(this,"uploadDownlinkStarted",!1),kO(this,"uploadTransportStarted",!1),kO(this,"requestStats",void 0),kO(this,"requestLocalMedia",void 0),kO(this,"requestRemoteMedia",void 0),kO(this,"requestAllTracks",void 0),kO(this,"requestVideoIsReady",void 0),kO(this,"requestUpload",void 0)}startUploadTransportStats(){this.uploadTransportStarted||(this.uploadTransportStarted=!0,this.transportStatsUploadInterval&&window.clearInterval(this.transportStatsUploadInterval),this.transportStatsUploadInterval=window.setInterval(()=>{var e;const t=null===(e=this.requestStats)||void 0===e?void 0:e.call(this);t&&this.uploadTransportStats(t)},6e3))}startUploadUplinkStats(){this.uploadUnplinkStarted||(this.uploadUnplinkStarted=!0,this.uplinkStatsUploadInterval&&window.clearInterval(this.uplinkStatsUploadInterval),this.uplinkStatsUploadInterval=window.setInterval(()=>{var e;const t=null===(e=this.requestStats)||void 0===e?void 0:e.call(this);t&&(this.uploadUplinkStats(t,this.lastStats),this.lastStats=t)},3e3),this.uplinkStatsUploadSlowInterval&&window.clearInterval(this.uplinkStatsUploadSlowInterval),this.uplinkStatsUploadSlowInterval=window.setInterval(()=>{var e;const t=null===(e=this.requestStats)||void 0===e?void 0:e.call(this);t&&this.uploadSlowUplinkStats(t)},6e4),this.uplinkRelatedStatsUploadInterval&&window.clearInterval(this.uplinkRelatedStatsUploadInterval),this.uplinkRelatedStatsUploadInterval=window.setInterval(()=>{var e;const t=null===(e=this.requestStats)||void 0===e?void 0:e.call(this);t&&this.uploadRelatedUplinkStats(t,this.lastStats),this.lastStats=t},1e3),this.uplinkDenoiserStatsUploadInterval&&window.clearInterval(this.uplinkDenoiserStatsUploadInterval),this.uplinkDenoiserStatsUploadInterval=window.setInterval(()=>{var e;const t=null===(e=this.requestAllTracks)||void 0===e?void 0:e.call(this);t&&this.uploadDenoiserStats(t)},2e3),this.extensionStatsUploadInterval&&window.clearInterval(this.extensionStatsUploadInterval),this.extensionStatsUploadInterval=window.setInterval(()=>{var e;const t=null===(e=this.requestAllTracks)||void 0===e?void 0:e.call(this);t&&this.uploadExtensionStats(t)},2e3))}uploadTransportStats(e){kG(()=>{var t;null===(t=this.requestUpload)||void 0===t||t.call(this,Dk.TRANSPORT_STATS,function(e){const t={connectionType:100};if("relay"===e.selectedCandidatePair.localCandidate.candidateType){const r=e.selectedCandidatePair.localCandidate.relayProtocol;"udp"===r&&(t.connectionType=101),"tcp"===r&&(t.connectionType=103),"tls"===r&&(t.connectionType=104)}return t}(e))})}uploadUplinkStats(e,t){var r;((null===(r=this.requestLocalMedia)||void 0===r?void 0:r.call(this))||[]).forEach(r=>{let[i,{track:n,ssrcs:o}]=r;switch(i){case RP.LocalVideoLowTrack:case RP.LocalVideoTrack:{const r=function(e,t,r){var i;const n=t.videoSend.find(t=>t.ssrc===e);if(!n)return null;const o={id:vG(10,""),timestamp:new Date(t.timestamp).toISOString(),mediaType:"video",type:"ssrc",ssrc:n.ssrc.toString()};switch(o.A_vstd=r._originMediaStreamTrack&&!r._originMediaStreamTrack.enabled||!r._mediaStreamTrack.enabled?"1":"0",n.sentFrame&&(o.A_fhs=n.sentFrame.height.toString(),o.A_frs=n.sentFrame.frameRate.toString(),o.A_fws=n.sentFrame.width.toString()),n.adaptionChangeReason){case"none":o.A_ac="0";break;case"cpu":o.A_ac="1";break;case"bandwidth":o.A_ac="2";break;case"other":o.A_ac="3"}return o.A_lvps=dk[r._player?r._player.videoElementStatus:"uninit"].toString(),o.A_nr=null===(i=n.nacksCount)||void 0===i?void 0:i.toString(),n.avgEncodeMs&&(o.A_aem=n.avgEncodeMs.toFixed(0).toString()),o}(o[0].ssrcId,e,n),s=AG(o[0].ssrcId,e,t);r&&kG(()=>{var e;return null===(e=this.requestUpload)||void 0===e?void 0:e.call(this,Dk.PUBLISH_STATS,{stream_type:i===RP.LocalVideoLowTrack?"low":"high",stats:U$(U$({},r),s)})});break}case RP.LocalAudioTrack:{const t=function(e,t,r){const i=t.audioSend.find(t=>t.ssrc===e);if(!i)return null;const n={id:vG(10,""),timestamp:new Date(t.timestamp).toISOString(),mediaType:"audio",type:"ssrc",ssrc:i.ssrc.toString()};return n.A_astd=r._originMediaStreamTrack.enabled&&r._mediaStreamTrack.enabled?"0":"1",i.inputLevel?n.A_ail=Math.round(100*i.inputLevel).toString():n.A_ail=Math.round(100*r._source.getAccurateVolumeLevel()).toString(),n.A_apil=Math.round(100*r._source.getAccurateVolumeLevel()).toString(),i.aecReturnLoss&&(n.A_ecrl=Math.round(i.aecReturnLoss).toString()),i.aecReturnLossEnhancement&&(n.A_ecrle=Math.round(i.aecReturnLossEnhancement).toString()),n}(o[0].ssrcId,e,n);t&&kG(()=>{var e;return null===(e=this.requestUpload)||void 0===e?void 0:e.call(this,Dk.PUBLISH_STATS,{stream_type:"high",stats:t})});break}}const s=function(e){const t={id:"bweforvideo",timestamp:new Date(e.timestamp).toISOString(),type:"VideoBwe"};return e.bitrate.retransmit&&(t.A_rb=e.bitrate.retransmit.toString()),e.bitrate.targetEncoded&&(t.A_teb=e.bitrate.targetEncoded.toString()),t.A_aeb=e.bitrate.actualEncoded.toString(),t.A_tb=e.bitrate.transmit.toString(),void 0!==e.sendBandwidth&&(t.A_asb=e.sendBandwidth.toString()),t}(e);s&&kG(()=>{var e;return null===(e=this.requestUpload)||void 0===e?void 0:e.call(this,Dk.PUBLISH_STATS,{stream_type:i===RP.LocalVideoLowTrack?"low":"high",stats:s})})})}uploadSlowUplinkStats(e){var t;((null===(t=this.requestLocalMedia)||void 0===t?void 0:t.call(this))||[]).filter(e=>{let[t]=e;return t===RP.LocalVideoLowTrack||t===RP.LocalVideoTrack}).forEach(t=>{let[r,{ssrcs:i}]=t;const n=AG(i[0].ssrcId,e);n&&kG(()=>{var e;return null===(e=this.requestUpload)||void 0===e?void 0:e.call(this,Dk.PUBLISH_STATS,{stream_type:r===RP.LocalVideoLowTrack?"low":"high",stats:n})})})}uploadRelatedUplinkStats(e,t){var r;((null===(r=this.requestLocalMedia)||void 0===r?void 0:r.call(this))||[]).filter(e=>{let[t]=e;return t===RP.LocalVideoLowTrack||t===RP.LocalVideoTrack}).forEach(t=>{let[r,{ssrcs:i}]=t;const n=function(e,t){const r=t.videoSend.find(t=>t.ssrc===e);return r?{mediaType:"video",isVideoMute:!1,frameRateInput:r.inputFrame&&r.inputFrame.frameRate.toString(),frameRateSent:r.sentFrame&&r.sentFrame.frameRate.toString(),googRtt:r.rttMs.toString(),qpSumPerFrame:Math.floor(r.qpSumPerFrame).toString()}:null}(i[0].ssrcId,e);n&&kG(()=>{var e;null===(e=this.requestUpload)||void 0===e||e.call(this,Dk.PUBLISH_RELATED_STATS,{stream_type:r===RP.LocalVideoLowTrack?"low":"high",stats:n})})})}uploadDenoiserStats(e){for(let n=0;n<e.length;n++){const o=e[n];if(o instanceof Hj){var t,r,i;const e=null===(t=(r=o._external).getDenoiserStats)||void 0===t?void 0:t.call(r);return void(e&&(null===(i=this.requestUpload)||void 0===i||i.call(this,Dk.DENOISER_STATS,e)))}}}uploadExtensionStats(e){for(let t=0;t<e.length;t++){const r=e[t];if(r instanceof Hj){return void r.getProcessorStats().forEach(e=>{var t;e.type===Dk.DENOISER_STATS&&(null===(t=this.requestUpload)||void 0===t||t.call(this,Dk.DENOISER_STATS,e.stats))})}}}stopUploadUplinkStats(){this.uploadUnplinkStarted&&(this.uploadUnplinkStarted=!1,this.uplinkStatsUploadInterval&&window.clearInterval(this.uplinkStatsUploadInterval),this.uplinkRelatedStatsUploadInterval&&window.clearInterval(this.uplinkRelatedStatsUploadInterval),this.uplinkDenoiserStatsUploadInterval&&window.clearInterval(this.uplinkDenoiserStatsUploadInterval),this.uplinkStatsUploadInterval=void 0,this.uplinkRelatedStatsUploadInterval=void 0,this.uplinkDenoiserStatsUploadInterval=void 0)}startUploadDownlinkStats(){this.uploadDownlinkStarted||(this.uploadDownlinkStarted=!0,this.downlinkStatsUploadInterval&&window.clearInterval(this.downlinkStatsUploadInterval),this.downlinkStatsUploadInterval=window.setInterval(()=>{var e;const t=null===(e=this.requestStats)||void 0===e?void 0:e.call(this);t&&(this.uploadDownlinkStats(t,this.lastStats),this.lastStats=t)},3e3),this.downlinkStatsUploadSlowInterval&&window.clearInterval(this.downlinkStatsUploadSlowInterval),this.downlinkStatsUploadSlowInterval=window.setInterval(()=>{var e;const t=null===(e=this.requestStats)||void 0===e?void 0:e.call(this);t&&this.uploadSlowDownlinkStats(t)},6e4),this.downlinkRelatedStatsUploadInterval&&window.clearInterval(this.downlinkRelatedStatsUploadInterval),this.downlinkRelatedStatsUploadInterval=window.setInterval(()=>{var e;const t=null===(e=this.requestStats)||void 0===e?void 0:e.call(this);t&&(this.uploadRelatedDownlinkStats(t,this.lastStats),this.lastStats=t)},1e3))}uploadDownlinkStats(e,t){var r;((null===(r=this.requestRemoteMedia)||void 0===r?void 0:r.call(this))||[]).forEach(t=>{let[r,i]=t;if(i.has(yP.VIDEO)&&r.videoTrack){const t=r.videoTrack?function(e,t,r){const i=t.videoRecv.find(t=>t.ssrc===e);if(!i)return null;const n={id:vG(10,""),timestamp:new Date(t.timestamp).toISOString(),mediaType:"video",type:"ssrc",ssrc:i.ssrc.toString()};var o,s;return n.bytesReceived=i.bytes.toString(),n.packetsLost=i.packetsLost.toString(),n.packetsReceived=i.packets.toString(),i.framesRateFirefox&&(n.A_frr=i.framesRateFirefox.toString()),i.receivedFrame?(n.A_frr=i.receivedFrame.frameRate.toString(),n.A_fhr=i.receivedFrame.height.toString(),n.A_fwr=i.receivedFrame.width.toString()):(n.A_fhr=null===(o=r._videoHeight)||void 0===o?void 0:o.toString(),n.A_fwr=null===(s=r._videoWidth)||void 0===s?void 0:s.toString()),n.A_frd=i.decodeFrameRate.toString(),i.outputFrame&&(n.A_fro=i.outputFrame.frameRate.toString()),void 0!==i.jitterBufferMs&&(n.A_jbm=Math.floor(i.jitterBufferMs).toString()),void 0!==i.currentDelayMs&&(n.A_cdm=Math.floor(i.currentDelayMs).toString()),n.A_fs=i.firsCount.toString(),n.A_ns=i.nacksCount.toString(),n.A_ps=i.plisCount.toString(),r&&(n.A_vrtd=r._originMediaStreamTrack.enabled&&r._mediaStreamTrack.enabled?"0":"1"),r._player&&r._player.freezeTimeCounterList.length>0&&(n.A_vrft=r._player.freezeTimeCounterList.splice(0,1)[0].toString()),n.A_rvps=dk[r._player?r._player.videoElementStatus:"uninit"].toString(),n}(r._videoSSRC,e,r.videoTrack):void 0;t&&kG(()=>{var e;return null===(e=this.requestUpload)||void 0===e?void 0:e.call(this,Dk.SUBSCRIBE_STATS,{stream_id:r.uid,stats:t})})}if(i.has(yP.AUDIO)&&r.audioTrack){const t=r.audioTrack?function(e,t,r){const i=t.audioRecv.find(t=>t.ssrc===e);if(!i)return null;const n={id:vG(10,""),timestamp:new Date(t.timestamp).toISOString(),mediaType:"audio",type:"ssrc",ssrc:i.ssrc.toString()};return n.bytesReceived=i.bytes.toString(),n.packetsLost=i.packetsLost.toString(),n.packetsReceived=i.packets.toString(),i.outputLevel?n.A_aol=Math.round(100*i.outputLevel).toString():n.A_aol=Math.round(100*r._source.getAccurateVolumeLevel()).toString(),n.A_apol=Math.round(100*r._source.getAccurateVolumeLevel()).toString(),r&&(n.A_artd=r._originMediaStreamTrack.enabled&&r._mediaStreamTrack.enabled?"0":"1"),n.A_jr=i.jitterMs.toString(),n.A_jbm=Math.floor(i.jitterBufferMs).toString(),n.A_cdm=Math.floor(i.jitterBufferMs).toString(),n.A_raps=dk[hj.getPlayerState(r.getTrackId())].toString(),n}(r._audioSSRC,e,r.audioTrack):void 0;t&&kG(()=>{var e;return null===(e=this.requestUpload)||void 0===e?void 0:e.call(this,Dk.SUBSCRIBE_STATS,{stream_id:r.uid,stats:t})})}})}uploadSlowDownlinkStats(e){}uploadRelatedDownlinkStats(e,t){var r;((null===(r=this.requestRemoteMedia)||void 0===r?void 0:r.call(this))||[]).forEach(r=>{let[i,n]=r;if(n.has(yP.VIDEO)&&i.videoTrack){var o;const r=!0===(i._videoSSRC&&(null===(o=this.requestVideoIsReady)||void 0===o?void 0:o.call(this,i._videoSSRC))||!1),n=function(e,t,r,i,n,o){const s=r.videoRecv.find(t=>t.ssrc===e),a=n?n.videoRecv.find(t=>t.ssrc===e):void 0;if(!s)return null;const c=tG.isRemoteVideoFreeze(o,s,a)&&t,d={mediaType:"video",isVideoMute:!1,peerId:i,frameRateReceived:s.receivedFrame&&s.receivedFrame.frameRate.toString(),frameRateDecoded:s.decodedFrame&&s.decodedFrame.frameRate.toString(),isFreeze:c,bytesReceived:s.bytes.toString(),packetsReceived:s.packets.toString(),packetsLost:s.packetsLost.toString(),qpSumPerFrame:Math.floor(s.qpSumPerFrame).toString()};return s.framesRateFirefox&&(d.frameRateDecoded=s.framesRateFirefox.toString(),d.frameRateReceived=s.framesRateFirefox.toString()),d}(i._videoSSRC,r,e,i.uid,t,i.videoTrack);n&&kG(()=>{var e;null===(e=this.requestUpload)||void 0===e||e.call(this,Dk.SUBSCRIBE_RELATED_STATS,{stream_id:i.uid,stats:n})})}if(n.has(yP.AUDIO)&&i.audioTrack){const t=function(e,t,r,i){const n=t.audioRecv.find(t=>t.ssrc===e);if(!n)return null;const o=tG.isRemoteAudioFreeze(i);return{mediaType:"audio",isAudioMute:!1,peerId:r,googJitterReceived:n.jitterMs.toString(),isFreeze:o,bytesReceived:n.bytes.toString(),packetsReceived:n.packets.toString(),packetsLost:n.packetsLost.toString(),frameReceived:n.receivedFrames.toString(),frameDropped:n.droppedFrames.toString()}}(i._audioSSRC,e,i.uid,i.audioTrack);t&&kG(()=>{var e;null===(e=this.requestUpload)||void 0===e||e.call(this,Dk.SUBSCRIBE_RELATED_STATS,{stream_id:i.uid,stats:t})})}})}stopUploadDownlinkStats(){this.uploadDownlinkStarted&&(this.uploadDownlinkStarted=!1,this.downlinkStatsUploadInterval&&window.clearInterval(this.downlinkStatsUploadInterval),this.downlinkRelatedStatsUploadInterval&&window.clearInterval(this.downlinkRelatedStatsUploadInterval),this.downlinkStatsUploadInterval=void 0,this.downlinkRelatedStatsUploadInterval=void 0)}stopUploadTransportStats(){this.uploadTransportStarted&&(this.uploadTransportStarted=!1,this.transportStatsUploadInterval&&window.clearInterval(this.transportStatsUploadInterval),this.transportStatsUploadInterval=void 0)}}var x$,F$;function V$(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function j$(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?V$(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):V$(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function G$(e){var t,r,i,n=2;for("undefined"!=typeof Symbol&&(r=hZ,i=Symbol.iterator);n--;){if(r&&null!=(t=e[r]))return t.call(e);if(i&&null!=(t=e[i]))return new K$(t.call(e));r="@@asyncIterator",i="@@iterator"}throw new TypeError("Object is not async iterable")}function K$(e){function t(e){if(Object(e)!==e)return ny.reject(new TypeError(e+" is not an object."));var t=e.done;return ny.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(K$=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?ny.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?ny.reject(e):t(r.apply(this.s,arguments))}},new K$(e)}let H$=LD("P2PChannel","store.p2pId")((qF((F$=class extends XN{get state(){return this._state}set state(e){const t=this._state;this._state=e,this.emit(wP.StateChange,t,this._state)}constructor(e,t){super(),kO(this,"store",void 0),kO(this,"statsUploader",void 0),kO(this,"connection",void 0),kO(this,"localTrackMap",new Map),kO(this,"remoteUserMap",new Map),kO(this,"pendingLocalTracks",[]),kO(this,"pendingRemoteTracks",[]),kO(this,"statsCollector",void 0),kO(this,"isPlanB",!1),kO(this,"iceFailedCount",0),kO(this,"dtlsFailedCount",0),kO(this,"mutex",new kV("P2PChannel-mutex")),kO(this,"_state",TP.Disconnected),kO(this,"handleMuteLocalTrack",async(e,t,r)=>{const i=await this.mutex.lock("Locking from P2PChannel.handleMuteLocalTrack");try{if(!this.connection)return void r(new eD($N.INVALID_OPERATION,"Cannot call P2PChannel.handleMuteLocalTrack before connection established."));OD("debug",this,"handleMuteLocalTrack",e.getTrackId()),await this.waitTillConnected();const n=this.filterTobeMutedTracks(e);if(0===n.length)return void t();await this.connection.muteLocal(n.map(e=>{let[,{id:t}]=e;return t}));const o=this.createMuteMessage(n);await bG(this,wP.RequestMuteLocal,o),t()}catch(e){r(e)}finally{i()}}),kO(this,"handleUnmuteLocalTrack",async(e,t,r)=>{const i=await this.mutex.lock("Locking from P2PChannel.handleUnmuteLocalTrack");try{if(!this.connection)return void r(new eD($N.INVALID_OPERATION,"Cannot call P2PChannel.handleUnmuteLocalTrack before connection established."));OD("debug",this,"handleUnmuteLocalTrack",e.getTrackId()),await this.waitTillConnected();const n=this.filterTobeUnmutedTracks(e);if(0===n.length)return void t();await this.connection.unmuteLocal(n.map(e=>{let[,{id:t}]=e;return t}));const o=this.createUnmuteMessage(n);await bG(this,wP.RequestUnmuteLocal,o),t()}catch(e){r(e)}finally{i()}}),kO(this,"handleUpdateVideoEncoder",async(e,t,r)=>{const i=await this.mutex.lock("Locking from P2PChannel.handleSetVideoEncoder");try{const r=this.localTrackMap.get(RP.LocalVideoTrack);if(!this.connection||!r||r.track!==e)return void t();await this.waitTillConnected();const{id:n,track:o}=r;await this.connection.updateSendParameters(n,o),await this.connection.updateEncoderConfig(n,o),this.emit(wP.UpdateVideoEncoder,o),t()}catch(e){r(e)}finally{i()}}),kO(this,"handleSetOptimizationMode",async(e,t,r)=>{const i=await this.mutex.lock("Locking from P2PChannel.handleSetOptimizationMode");try{const r=this.localTrackMap.get(RP.LocalVideoTrack);if(!this.connection||!r||r.track!==e)return;await this.waitTillConnected();const{id:n,track:o}=r;await this.connection.updateSendParameters(n,o),t()}catch(e){r(e)}finally{i()}}),kO(this,"handleReplaceTrack",async(e,t,r,i)=>{let n;cD.debug("P2PChannel handleReplaceTrack for [track-id-".concat(e.getTrackId(),"]")),"boolean"==typeof i&&i||(n=await this.mutex.lock("From P2PChannel.handleReplaceTrack"));try{const r=Array.from(this.localTrackMap.entries()).find(t=>{let[,{track:r}]=t;return e===r});if(!this.connection||!r)return void t();if(await this.waitTillConnected(),await this.connection.replaceTrack(e,r[1].id),this.isPlanB){const t=r[1];t.id=e._mediaStreamTrack.id,this.localTrackMap.set(r[0],t)}if(r[0]===RP.LocalVideoTrack&&BP().supportDualStreamEncoding){const t=this.localTrackMap.get(RP.LocalVideoLowTrack);if(t){const r=e._mediaStreamTrack.clone();t.track._originMediaStreamTrack.stop(),t.track._mediaStreamTrack=r,t.track._originMediaStreamTrack=r,await new ny((e,r)=>{this.handleReplaceTrack(t.track,e,r,!0)})}}t()}catch(e){r(e)}finally{var o;null===(o=n)||void 0===o||o()}}),kO(this,"handleGetLocalVideoStats",e=>{e(this.statsCollector.getLocalVideoTrackStats())}),kO(this,"handleGetLocalAudioStats",e=>{e(this.statsCollector.getLocalAudioTrackStats())}),kO(this,"handleGetRemoteVideoStats",e=>this.statsCollector.getRemoteVideoTrackStats(e.uid)[e.uid]),kO(this,"handleGetRemoteAudioStats",e=>this.statsCollector.getRemoteAudioTrackStats(e.uid)[e.uid]),this.store=e,this.statsCollector=t,this.statsCollector.addP2PChannel(this),this.statsUploader=new Q$,this.bindStatsUploaderEvents(),this.isPlanB=!BP().supportUnifiedPlan||WD("CHROME_FORCE_PLAN_B")&&yO()}async startP2PConnection(e){return this.state=TP.New,this.connection=this.isPlanB?new f$(e,this.store):new T$(e,this.store),this.bindConnectionEvents(this.connection),this.store.peerConnectionStart(),this.connection.establish()}async connect(e,t,r,i,n,o){if(!this.connection)throw new eD($N.UNEXPECTED_ERROR,"Cannot P2PChannel.connect before P2PChannel.startP2PConnection .");await this.connection.connect(e,t,r,i,n,o),this.statsUploader.startUploadTransportStats(),this.state=TP.Connected}publish(e,t,r){var i=this;return cZ((function*(){const n=yield dZ(i.mutex.lock("From P2PChannel.publish"));try{if(!i.connection){if(i.state===TP.Disconnected)throw new eD($N.UNEXPECTED_ERROR,"PeerConnection already disconnected.");i.throwIfTrackTypeNotMatch(e);const t=e.filter(e=>-1===i.pendingLocalTracks.indexOf(e));return void(i.pendingLocalTracks=i.pendingLocalTracks.concat(t))}i.store.pubId=i.store.pubId+1,Zj.markPublishStart(i.store.clientId,i.store.pubId),yield dZ(i.waitTillConnected());const o=i.filterTobePublishedTracks(e,t,r);if(0===o.length)return void(yield dZ(i.tryToUnmuteAudio(e)));yield*AZ(G$(i.doPublish(i.connection,o)),dZ)}finally{n()}}))()}doPublish(e,t){var r=this;return cZ((function*(){t.forEach(e=>{let{track:t,type:i}=e;const n=performance.now();r.store.publish(t.getTrackId(),i===RP.LocalAudioTrack?"audio":"video",n)}),r.bindLocalTrackEvents(t);const i=yield dZ(e.send(t.map(e=>{let{track:t}=e;return t}),r.store.codec,r.store.audioCodec)),n=(yield dZ(i.next())).value,o=r.createGatewayPublishMessage(t,n);let s;try{s=yield o}catch(e){throw RD("error",r,"doPublish yield error: ".concat(e.toString())),i.throw(e),(null==e?void 0:e.code)===$N.WS_ABORT&&t.forEach(e=>{let{track:t}=e;-1===r.pendingLocalTracks.indexOf(t)&&r.pendingLocalTracks.push(t)}),r.unbindLocalTrackEvents(t),e}const a=r.mapPubResToRemoteConfig(o,s);OD("debug",r,"doPublish",{remoteConfigs:a,tracks:t.map(e=>{let{track:t}=e;return t.getTrackId()}),pubMsg:o,pubAns:s});const c=(yield dZ(i.next(a))).value;t.forEach(e=>{let{type:t}=e;r.statsCollector.addLocalStats(t)}),r.assignLocalTracks(t,c),r.statsUploader.startUploadUplinkStats(),t.forEach(e=>{let{track:t,type:i}=e;const n=performance.now();r.store.publish(t.getTrackId(),i===RP.LocalAudioTrack?"audio":"video",void 0,n)})}))()}publishLowStream(e){var t=this;return cZ((function*(){if(!t.connection)return;OD("debug",t,"publishLowStream",e);const r=yield dZ(t.mutex.lock("Locking from P2PChannel.publishLowStream"));try{const n=t.localTrackMap.get(RP.LocalVideoTrack);if(!n)throw new eD($N.UNEXPECTED_ERROR,"Could not find high stream");if(t.localTrackMap.has(RP.LocalVideoLowTrack))throw new eD($N.UNEXPECTED_ERROR,"[".concat(t.store.clientId,"] Can't publish low stream when stream already publish"));yield dZ(t.waitTillConnected());const o=[{track:t.getLowVideoTrack(n.track,e),type:RP.LocalVideoLowTrack}];if(yield*AZ(G$(t.doPublish(t.connection,o)),dZ),n.track.muted||!n.track.enabled){var i;const e=null===(i=t.localTrackMap.get(RP.LocalVideoLowTrack))||void 0===i?void 0:i.id;void 0!==e&&(yield dZ(t.connection.muteLocal([e])))}}finally{r()}}))()}async republish(){this.pendingLocalTracks.length>0&&(cD.debug("Emit P2PChannelEvents.RequestRePublish to republish tracks."),OD("debug",this,"republish",this.pendingLocalTracks.map(e=>e.getTrackId())),await wG(this,wP.RequestRePublish,this.pendingLocalTracks),this.emit(wP.MediaReconnectEnd,this.store.uid),this.pendingLocalTracks=[])}async reSubscribe(e){OD("debug",this,"reSubscribe",this.pendingRemoteTracks.map(e=>{let{user:t}=e;return t.uid}));for(let e=this.pendingRemoteTracks.length-1;e>=0;e--){const{user:t,kind:r}=this.pendingRemoteTracks[e];(r!==yP.AUDIO||t._audio_added_&&t._audioSSRC)&&(r!==yP.VIDEO||t._video_added_&&t._videoSSRC)||this.pendingRemoteTracks.splice(e,1)}if(e)await wG(this,wP.RequestReSubscribe,this.pendingRemoteTracks);else for(const{user:e,kind:t}of this.pendingRemoteTracks)await this.subscribe(e,t,t===yP.VIDEO?e._videoSSRC:e._audioSSRC);this.pendingRemoteTracks.forEach(e=>{let{user:t}=e;this.emit(wP.MediaReconnectEnd,t.uid)}),this.pendingRemoteTracks=[]}async unpublish(e){if(!this.connection)return void e.forEach(e=>{const t=this.pendingLocalTracks.indexOf(e);-1!==t&&this.pendingLocalTracks.splice(t,1)});await this.waitTillConnected();const t=this.filterTobeUnpublishedTracks(e);return 0!==t.length?(OD("debug",this,"unpublish"),this.doUnpublish(this.connection,t)):void 0}async unpublishLowStream(){if(!this.connection)return;OD("debug",this,"unpublishLowStream");const e=this.localTrackMap.get(RP.LocalVideoLowTrack);if(!e)return;await this.waitTillConnected();const t=[[RP.LocalVideoLowTrack,e]];return this.doUnpublish(this.connection,t)}async doUnpublish(e,t){const r=this.createGatewayUnpublishMessage(t);return await e.stopSending(t.map(e=>{let[,{id:t}]=e;return t})),this.withdrawLocalTracks(t),this.unbindLocalTrackEvents(t.map(e=>{let[t,{track:r}]=e;return{type:t,track:r}})),t.forEach(e=>{let[t]=e;this.statsCollector.removeLocalStats(t)}),0===this.localTrackMap.size&&this.statsUploader.stopUploadUplinkStats(),r}async subscribe(e,t,r,i,n){var o;if(!this.connection)throw new eD($N.INVALID_OPERATION,"Cannot subscribe remote user when peerConnection disconnected.");if(OD("debug",this,"subscribe",{uid:e.uid,mediaType:t,ssrcId:r}),null!==(o=this.remoteUserMap.get(e))&&void 0!==o&&o.has(t))return;let s,a;if(await this.waitTillConnected(),n){const r=n.find(e=>{let{stream_type:r}=e;return r===t});if(!r)throw new eD($N.UNEXPECTED_ERROR,"Cannot subscribe to remote ".concat(t," for user: ").concat(e.uid," because subscribe answer from gateway does not contain stream_type: ").concat(t,"."));const i=await this.connection.receive(t,r.ssrcs,String(e.uid),r.attributes);s=i.track,a=i.id}else{const n=await this.connection.receive(t,[{ssrcId:r,rtx:i}],String(e.uid),void 0);s=n.track,a=n.id}t===yP.AUDIO?(e._audioTrack?e._audioTrack._updateOriginMediaStreamTrack(s):(e._audioTrack=new B$(s,e.uid,e._uintid,this.store),cD.info("[".concat(this.store.p2pId,"] create remote audio track: ").concat(e._audioTrack.getTrackId()))),this.bindRemoteTrackEvents(e,e._audioTrack)):(e._videoTrack?e._videoTrack._updateOriginMediaStreamTrack(s):(e._videoTrack=new P$(s,e.uid,e._uintid,this.store),cD.info("[".concat(this.store.p2pId,"] create remote video track: ").concat(e._videoTrack.getTrackId()))),this.bindRemoteTrackEvents(e,e._videoTrack));const c=this.remoteUserMap.get(e);c?c.set(t,a):this.remoteUserMap.set(e,new Map([[t,a]])),this.statsCollector.addRemoteStats(e.uid),this.statsUploader.startUploadDownlinkStats();const d=this.pendingRemoteTracks.findIndex(r=>{let{user:i,kind:n}=r;return i.uid===e.uid&&t===n});-1!==d&&(this.pendingRemoteTracks.splice(d,1),this.emit(wP.MediaReconnectEnd,e.uid))}async massSubscribe(e){return this.massSubscribeNoLock(e)}async massSubscribeNoLock(e){if(!this.connection)throw new eD($N.INVALID_OPERATION,"Cannot subscribeAll remote users when peerConnection disconnected.");OD("debug",this,"subscribeAll",e.map(e=>{let{user:t,mediaType:r,ssrcId:i}=e;return{uid:t.uid,mediaType:r,ssrcId:i}})),e=e.filter(e=>{var t;let{user:r,mediaType:i}=e;return!(null!==(t=this.remoteUserMap.get(r))&&void 0!==t&&t.has(i))}),await this.waitTillConnected();const t=await this.connection.batchReceive(e.map(e=>{let{user:t,mediaType:r,ssrcId:i,rtxSsrcId:n}=e;return{kind:r,ssrcMsg:[{ssrcId:i,rtx:n}],mslabel:String(t.uid)}}));e.forEach((e,r)=>{let{user:i,mediaType:n}=e;const{track:o,id:s}=t[r];n===yP.AUDIO?(i._audioTrack?i._audioTrack._updateOriginMediaStreamTrack(o):(i._audioTrack=new B$(o,i.uid,i._uintid,this.store),cD.info("[".concat(this.store.p2pId,"] create remote audio track: ").concat(i._audioTrack.getTrackId()))),this.bindRemoteTrackEvents(i,i._audioTrack)):(i._videoTrack?i._videoTrack._updateOriginMediaStreamTrack(o):(i._videoTrack=new P$(o,i.uid,i._uintid,this.store),cD.info("[".concat(this.store.p2pId,"] create remote video track: ").concat(i._videoTrack.getTrackId()))),this.bindRemoteTrackEvents(i,i._videoTrack));const a=this.remoteUserMap.get(i);a?a.set(n,s):this.remoteUserMap.set(i,new Map([[n,s]])),this.statsCollector.addRemoteStats(i.uid),this.statsUploader.startUploadDownlinkStats();const c=this.pendingRemoteTracks.findIndex(e=>{let{user:t,kind:r}=e;return t.uid===i.uid&&n===r});-1!==c&&(this.pendingRemoteTracks.splice(c,1),this.emit(wP.MediaReconnectEnd,i.uid))})}async unsubscribe(e,t){const r=this.pendingRemoteTracks.filter(r=>{let{user:i,kind:n}=r;return void 0!==t?i.uid===e.uid&&t===n:i.uid===e.uid});if(r.forEach(e=>{const t=this.pendingRemoteTracks.indexOf(e);this.pendingRemoteTracks.splice(t,1)}),!this.connection)return void r.forEach(t=>{let{kind:r}=t;var i;if(r===yP.AUDIO)null===(i=e._audioTrack)||void 0===i||i._destroy(),e._audioTrack=void 0;else if(r===yP.VIDEO){var n;null===(n=e._videoTrack)||void 0===n||n._destroy(),e._videoTrack=void 0}});OD("debug",this,"unsubscribe",{uid:e.uid,mediaType:t});const i=this.filterTobeUnSubscribedTracks(e,t);if(0===i.length)return;await this.connection.stopReceiving(i.map(e=>{let[,{id:t}]=e;return t}));const n=this.createUnsubscribeMessage(i);return this.withdrawRemoteTracks(i),0===this.remoteUserMap.size&&this.statsUploader.stopUploadDownlinkStats(),i.forEach(e=>{let[t,{kind:r}]=e;var i,n;r===yP.VIDEO&&t._videoSSRC&&(null===(i=this.connection)||void 0===i||i.setStatsRemoteVideoIsReady(t._videoSSRC,!1));if(r===yP.VIDEO)this.unbindRemoteTrackEvents(t._videoTrack),null===(n=t._videoTrack)||void 0===n||n._destroy(),t._videoTrack=void 0;else if(r===yP.AUDIO){var o;this.unbindRemoteTrackEvents(t._audioTrack),null===(o=t._audioTrack)||void 0===o||o._destroy(),t._audioTrack=void 0}}),n}async massUnsubscribe(e){return this.massUnsubscribeNoLock(e)}async massUnsubscribeNoLock(e){let t=[];for(const{user:r,mediaType:i}of e){const e=this.pendingRemoteTracks.filter(e=>{let{user:t,kind:n}=e;return void 0!==i?t.uid===r.uid&&i===n:t.uid===r.uid});e.forEach(e=>{const t=this.pendingRemoteTracks.indexOf(e);this.pendingRemoteTracks.splice(t,1)}),t=t.concat(e)}if(!this.connection)return void t.forEach(e=>{let{user:t,kind:r}=e;var i;if(r===yP.AUDIO)null===(i=t._audioTrack)||void 0===i||i._destroy(),t._audioTrack=void 0;else if(r===yP.VIDEO){var n;null===(n=t._videoTrack)||void 0===n||n._destroy(),t._videoTrack=void 0}});OD("debug",this,"batchUnsubscribe",e.map(e=>{let{user:t,mediaType:r}=e;return{uid:t.uid,mediaType:r}}));const r=vh(e).call(e,(e,t)=>{let{user:r,mediaType:i}=t;const n=this.filterTobeUnSubscribedTracks(r,i);return e.concat(n)},[]);if(0===r.length)return;await this.connection.stopReceiving(r.map(e=>{let[,{id:t}]=e;return t}));const i=this.createUnsubscribeAllMessage(r);return this.withdrawRemoteTracks(r),0===this.remoteUserMap.size&&this.statsUploader.stopUploadDownlinkStats(),r.forEach(e=>{let[t,{kind:r}]=e;var i,n;r===yP.VIDEO&&t._videoSSRC&&(null===(i=this.connection)||void 0===i||i.setStatsRemoteVideoIsReady(t._videoSSRC,!1));if(r===yP.VIDEO)this.unbindRemoteTrackEvents(t._videoTrack),null===(n=t._videoTrack)||void 0===n||n._destroy(),t._videoTrack=void 0;else if(r===yP.AUDIO){var o;this.unbindRemoteTrackEvents(t._audioTrack),null===(o=t._audioTrack)||void 0===o||o._destroy(),t._audioTrack=void 0}}),i}async muteRemote(e,t){if(!this.connection)return;OD("debug",this,"muteRemote",{uid:e.uid,kind:t});const r=this.remoteUserMap.get(e);if(!r)return cD.warning("P2PChannel.muteRemote has no remote user ".concat(e.uid,".")),void RD("warning",this,"P2PChannel.muteRemote has no remote user ".concat(e.uid,"."));const i=r.get(t);if(!i)return cD.warning("P2PChannel.muteRemote has no remote user ".concat(e.uid," media type ").concat(t,".")),void RD("warning",this,"P2PChannel.muteRemote has no remote user ".concat(e.uid," media type ").concat(t,"."));const n=t===yP.VIDEO?e._videoSSRC:e._audioSSRC;void 0!==n&&this.connection.setStatsRemoteVideoIsReady(n,!1),await this.connection.muteRemote(i)}async unmuteRemote(e,t){return this.unmuteRemoteNoLock(e,t)}async unmuteRemoteNoLock(e,t){if(!this.connection)return;OD("debug",this,"unmuteRemote",{uid:e.uid,kind:t});const r=this.remoteUserMap.get(e);if(!r)return cD.warning("P2PChannel.unmuteRemote has no remote user ".concat(e.uid,".")),void RD("warning",this,"unmuteRemote has no remote user ".concat(e.uid));const i=r.get(t);if(!i)return cD.warning("P2PChannel.unmuteRemote has no remote user ".concat(e.uid," media type ").concat(t,".")),void RD("warning",this,"unmuteRemote has no remote user ".concat(e.uid," media type ").concat(t));await this.connection.unmuteRemote(i)}getAllTracks(e){const t=this.localTrackMap.get(RP.LocalAudioTrack);if((null==t?void 0:t.track)instanceof Wj){const r=t.track;return Array.from(this.localTrackMap.entries()).filter(e=>{let[t]=e;return t!==RP.LocalAudioTrack}).filter(t=>{let[r]=t;return!(e&&r===RP.LocalVideoLowTrack)}).map(e=>{let[,{track:t}]=e;return t}).concat(r.trackList)}return Array.from(this.localTrackMap.entries()).filter(t=>{let[r]=t;return!(e&&r===RP.LocalVideoLowTrack)}).map(e=>{let[,{track:t}]=e;return t})}reportPublishEvent(e,t,r,i,n){if(e){const r=this.localTrackMap.get(RP.LocalAudioTrack),o=i?this.localTrackMap.get(RP.LocalVideoLowTrack):this.localTrackMap.get(RP.LocalVideoTrack);wV.publish(this.store.sessionId,{eventElapse:Zj.measureFromPublishStart(this.store.clientId,this.store.pubId),succ:e,ec:t,audioName:null==r?void 0:r.track.getTrackLabel(),videoName:null==o?void 0:o.track.getTrackLabel(),screenshare:-1!==(null==o?void 0:o.track._hints.indexOf(AP.SCREEN_TRACK)),audio:!!r,video:!!o,p2pid:this.store.p2pId,publishRequestid:this.store.pubId,extend:n})}else{var o;r||(r=[]);const s=r.find(e=>e instanceof Kj),a=i?null===(o=this.localTrackMap.get(RP.LocalVideoTrack))||void 0===o?void 0:o.track:r.find(e=>e instanceof Zq);wV.publish(this.store.sessionId,{eventElapse:Zj.measureFromPublishStart(this.store.clientId,this.store.pubId),succ:e,ec:t,audioName:null==s?void 0:s.getTrackLabel(),videoName:null==a?void 0:a.getTrackLabel(),screenshare:-1!==(null==a?void 0:a._hints.indexOf(AP.SCREEN_TRACK)),audio:!!s,video:!!a,p2pid:this.store.p2pId,publishRequestid:this.store.pubId,extend:n})}}reportSubscribeEvent(e,t,r,i){const n=i===yP.VIDEO?r._videoSSRC:r._audioSSRC;n&&wV.subscribe(this.store.sessionId,{succ:e,ec:t,video:i===yP.VIDEO,audio:i===yP.AUDIO,peerid:r.uid,subscribeRequestid:i===yP.VIDEO?r._videoSSRC:r._audioSSRC,p2pid:this.store.p2pId,eventElapse:Zj.measureFromSubscribeStart(this.store.clientId,n)})}reset(){cD.debug("P2PChannel.reset"),this.mutex=new kV("P2PChannel-mutex"),this.connection&&(this.connection.close(),this.unbindConnectionEvents(this.connection),this.connection=void 0),this.statsUploader.stopUploadUplinkStats(),this.statsUploader.stopUploadDownlinkStats(),this.statsUploader.stopUploadTransportStats(),this.unbindLocalTrackEvents(),this.unbindAllRemoteTrackEvents(),this.localTrackMap.clear(),this.remoteUserMap.clear(),this.statsCollector.removeRemoteStats(),this.statsCollector.removeLocalStats(),this.iceFailedCount=0,this.dtlsFailedCount=0,this.pendingLocalTracks=[],this.pendingRemoteTracks=[],this.state=TP.Disconnected}getStats(){var e;return null===(e=this.connection)||void 0===e?void 0:e.getStats()}getRemoteVideoIsReady(e){var t;return(null===(t=this.connection)||void 0===t?void 0:t.getRemoteVideoIsReady(e))||!1}getLocalAudioVolume(){const e=this.localTrackMap.get(RP.LocalAudioTrack);if(e)return e.track.getVolumeLevel()}getLocalVideoSize(){const e=this.localTrackMap.get(RP.LocalVideoTrack);if(e)return{width:e.track._videoWidth||0,height:e.track._videoHeight||0}}getEncoderConfig(e){const t=this.localTrackMap.get(e);return t&&t.track instanceof Zq||t&&t.track instanceof Kj?t.track._encoderConfig:void 0}getLocalMedia(e){return this.localTrackMap.get(e)}hasLocalMedia(){return this.localTrackMap.size>0}hasRemoteMedia(e,t){if(!e)return this.remoteUserMap.size>0;const r=this.remoteUserMap.get(e);return!!r&&(!t||r.has(t))}async hasRemoteMediaWithLock(e,t){if(!e)return this.remoteUserMap.size>0;const r=this.remoteUserMap.get(e);return!!r&&(!t||r.has(t))}getRemoteMedia(e){var t;const r=Array.from(AV(t=this.remoteUserMap).call(t)).find(t=>t.uid===e);return r?{audioTrack:r.audioTrack,audioSSRC:r._audioSSRC,videoTrack:r.videoTrack,videoSSRC:r._videoSSRC}:{}}getAudioLevels(){let e=Array.from(this.remoteUserMap.entries()).map(e=>{let[t]=e;return{uid:t.uid,level:t.audioTrack?100*t.audioTrack._source.getAccurateVolumeLevel():0}});const t=this.localTrackMap.get(RP.LocalAudioTrack);return t&&e.push({level:100*t.track._source.getAccurateVolumeLevel(),uid:this.store.uid}),e=JL(e).call(e,(e,t)=>e.level-t.level),e}async disconnectForReconnect(){this.connection&&(OD("debug",this,"disconnectForReconnect"),cD.debug("P2PChannel.disconnectForReconnect closing P2PConnection"),this.state=TP.Reconnecting,this.connection.close(),this.unbindConnectionEvents(this.connection),this.connection=void 0,0!==this.localTrackMap.size&&(Array.from(this.localTrackMap.entries()).forEach(e=>{let[t,{track:r}]=e;switch(t){case RP.LocalVideoTrack:r._hints.includes(AP.LOW_STREAM)?r.close():this.pendingLocalTracks.push(r);break;case RP.LocalAudioTrack:r instanceof Wj?this.pendingLocalTracks=this.pendingLocalTracks.concat(r.trackList):this.pendingLocalTracks.push(r);break;case RP.LocalVideoLowTrack:}}),this.emit(wP.MediaReconnectStart,this.store.uid)),this.unbindLocalTrackEvents(),this.localTrackMap.clear(),0!==this.remoteUserMap.size&&Array.from(this.remoteUserMap.entries()).forEach(e=>{let[t,r]=e;Array.from(AV(r).call(r)).forEach(e=>{this.setPendingRemoteMedia(t,e)}),this.emit(wP.MediaReconnectStart,t.uid)}),this.unbindAllRemoteTrackEvents(),this.remoteUserMap.clear(),this.statsUploader.stopUploadUplinkStats(),this.statsUploader.stopUploadDownlinkStats(),this.statsUploader.stopUploadTransportStats(),cD.debug("P2PChannel disconnected, waiting to reconnect."))}hasPendingRemoteMedia(e,t){for(const r of this.pendingRemoteTracks){const{user:i,kind:n}=r;if((e instanceof rz?e.uid:e)===i.uid&&t===n)return!0}return!1}setPendingRemoteMedia(e,t){this.hasPendingRemoteMedia(e,t)||this.pendingRemoteTracks.push({user:e,kind:t})}async reEstablish(){if(this.connection)return this.connection.reEstablish()}getUplinkNetworkQuality(){if(!this.connection)return 0;const e=this.connection.getStats(),t=this.localTrackMap.get(RP.LocalVideoTrack),r=this.localTrackMap.get(RP.LocalAudioTrack),i=e.videoSend.find(e=>e.ssrc===(null==t?void 0:t.ssrcs[0].ssrcId)),n=e.audioSend.find(e=>e.ssrc===(null==r?void 0:r.ssrcs[0].ssrcId));if(!i||!n)return 1;const o=OG(this,wP.NeedSignalRTT),s=i?i.rttMs:void 0,a=n?n.rttMs:void 0,c=s&&a?(s+a)/2:s||a,d=(c&&o?(c+o)/2:c||o)||0,u=100*e.sendPacketLossRate*.7/50+.3*d/1500,A=u<.17?1:u<.36?2:u<.59?3:u<.1?4:5,h=null==t?void 0:t.track;if(h&&h._encoderConfig&&-1===h._hints.indexOf(AP.SCREEN_TRACK)){const t=h._encoderConfig.bitrateMax,r=e.bitrate.actualEncoded;if(t&&r){const e=(1e3*t-r)/(1e3*t);return eL[e<.15?0:e<.3?1:e<.45?2:e<.6?3:4][A]}}return A}getDownlinkNetworkQuality(){if(!this.connection)return 0;const e=this.connection.getStats();let t=0;return Array.from(this.remoteUserMap.entries()).forEach(r=>{let[i]=r;const n=i._audioSSRC,o=i._videoSSRC,s=e.audioRecv.find(e=>e.ssrc===n),a=e.videoRecv.find(e=>e.ssrc===o);if(!s&&!a)return void(t+=1);const c=OG(this,wP.NeedSignalRTT),d=e.rtt,u=(d&&c?(d+c)/2:d||c)||0,A=s?s.jitterMs:void 0,h=e.recvPacketLossRate;let l=.7*h*100/50+.3*u/1500;A&&(l=.6*h*100/50+.2*u/1500+.2*A/400);t+=l<.1?1:l<.17?2:l<.36?3:l<.59?4:5}),this.remoteUserMap.size>0?Math.round(t/this.remoteUserMap.size):t}async muteLocalTrack(e){return new ny((t,r)=>{this.handleMuteLocalTrack(e,t,r)})}filterTobePublishedTracks(e,t,r){const i=[],n=BP(),o=this.getAllTracks();e=LG(e=e.filter(e=>-1===o.indexOf(e)));let s=!1,a=!1;for(const o of e){if(o instanceof Zq&&(this.localTrackMap.has(RP.LocalVideoTrack)||s?new eD($N.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS).throw():(i.push({track:o,type:RP.LocalVideoTrack}),s=!0),t)){const e=this.getLowVideoTrack(o,r);i.push({track:e,type:RP.LocalVideoLowTrack})}if(o instanceof Kj){const e=this.localTrackMap.get(RP.LocalAudioTrack);if(e){if(!(e.track instanceof Wj))throw new eD($N.NOT_SUPPORTED,"cannot publish multiple tracks which one of them configured with bypassWebAudio or your browser does not support audio mixing");if(o._bypassWebAudio)throw new eD($N.NOT_SUPPORTED,"cannot publish multiple tracks which one of them configured with bypassWebAudio");e.track.addAudioTrack(o),this.bindLocalAudioTrackEvents(o,!0)}else if(a){const e=i.find(e=>{let{type:t}=e;return t===RP.LocalAudioTrack});if(!(e.track instanceof Wj))throw new eD($N.NOT_SUPPORTED,"cannot publish multiple tracks which one of them configured with bypassWebAudio or your browser does not support audio mixing");if(o._bypassWebAudio)throw new eD($N.NOT_SUPPORTED,"cannot publish multiple tracks which one of them configured with bypassWebAudio");e.track.addAudioTrack(o)}else{if(!n.webAudioMediaStreamDest||o instanceof Wj||o._bypassWebAudio)i.push({track:o,type:RP.LocalAudioTrack});else{const e=new Wj;e.addAudioTrack(o),i.push({track:e,type:RP.LocalAudioTrack})}a=!0}}}return i}filterTobeUnpublishedTracks(e){const t=[],r=this.getAllTracks();e=LG(e=e.filter(e=>-1!==r.indexOf(e)));for(const r of e){if(r instanceof Kj){const e=this.localTrackMap.get(RP.LocalAudioTrack);if(!e)continue;e.track instanceof Wj?(e.track.removeAudioTrack(r),this.unbindLocalAudioTrackEvents(r),0===e.track.trackList.length&&(t.push([RP.LocalAudioTrack,e]),e.track.close())):t.push([RP.LocalAudioTrack,e])}if(r instanceof Zq){const e=this.localTrackMap.get(RP.LocalVideoTrack);if(!e)continue;t.push([RP.LocalVideoTrack,e]);const r=this.localTrackMap.get(RP.LocalVideoLowTrack);r&&t.push([RP.LocalVideoLowTrack,r])}}return t}bindLocalTrackEvents(e){e.forEach(e=>{let{track:t,type:r}=e;switch(r){case RP.LocalVideoTrack:t.addListener(uP.GET_STATS,this.handleGetLocalVideoStats),t.addListener(uP.NEED_DISABLE_TRACK,this.handleMuteLocalTrack),t.addListener(uP.NEED_ENABLE_TRACK,this.handleUnmuteLocalTrack),t.addListener(uP.NEED_UPDATE_VIDEO_ENCODER,this.handleUpdateVideoEncoder),t.addListener(uP.SET_OPTIMIZATION_MODE,this.handleSetOptimizationMode),t.addListener(uP.NEED_REPLACE_TRACK,this.handleReplaceTrack),t.addListener(uP.NEED_MUTE_TRACK,this.handleMuteLocalTrack),t.addListener(uP.NEED_UNMUTE_TRACK,this.handleUnmuteLocalTrack);break;case RP.LocalAudioTrack:this.bindLocalAudioTrackEvents(t);break;case RP.LocalVideoLowTrack:}})}bindLocalAudioTrackEvents(e,t){e instanceof Wj?e.trackList.forEach(e=>{e.addListener(uP.NEED_DISABLE_TRACK,this.handleMuteLocalTrack),e.addListener(uP.NEED_ENABLE_TRACK,this.handleUnmuteLocalTrack),e.addListener(uP.GET_STATS,this.handleGetLocalAudioStats),e.addListener(uP.NEED_MUTE_TRACK,this.handleMuteLocalTrack),e.addListener(uP.NEED_UNMUTE_TRACK,this.handleUnmuteLocalTrack)}):(e.addListener(uP.GET_STATS,this.handleGetLocalAudioStats),e.addListener(uP.NEED_DISABLE_TRACK,this.handleMuteLocalTrack),e.addListener(uP.NEED_ENABLE_TRACK,this.handleUnmuteLocalTrack),e.addListener(uP.NEED_MUTE_TRACK,this.handleMuteLocalTrack),e.addListener(uP.NEED_UNMUTE_TRACK,this.handleUnmuteLocalTrack),t||e.addListener(uP.NEED_REPLACE_TRACK,this.handleReplaceTrack))}unbindLocalTrackEvents(e){e||(e=Array.from(this.localTrackMap.entries()).map(e=>{let[t,{track:r}]=e;return{track:r,type:t}})),e.forEach(e=>{let{track:t,type:r}=e;switch(r){case RP.LocalVideoTrack:t.off(uP.GET_STATS,this.handleGetLocalVideoStats),t.off(uP.NEED_DISABLE_TRACK,this.handleMuteLocalTrack),t.off(uP.NEED_ENABLE_TRACK,this.handleUnmuteLocalTrack),t.off(uP.NEED_UPDATE_VIDEO_ENCODER,this.handleUpdateVideoEncoder),t.off(uP.SET_OPTIMIZATION_MODE,this.handleSetOptimizationMode),t.off(uP.NEED_REPLACE_TRACK,this.handleReplaceTrack),t.off(uP.NEED_MUTE_TRACK,this.handleMuteLocalTrack),t.off(uP.NEED_UNMUTE_TRACK,this.handleUnmuteLocalTrack);break;case RP.LocalAudioTrack:this.unbindLocalAudioTrackEvents(t);break;case RP.LocalVideoLowTrack:}})}unbindLocalAudioTrackEvents(e){e instanceof Wj?e.trackList.forEach(e=>{e.off(uP.NEED_DISABLE_TRACK,this.handleMuteLocalTrack),e.off(uP.NEED_ENABLE_TRACK,this.handleUnmuteLocalTrack),e.off(uP.GET_STATS,this.handleGetLocalAudioStats),e.off(uP.NEED_MUTE_TRACK,this.handleMuteLocalTrack),e.off(uP.NEED_UNMUTE_TRACK,this.handleUnmuteLocalTrack)}):(e.off(uP.GET_STATS,this.handleGetLocalAudioStats),e.off(uP.NEED_DISABLE_TRACK,this.handleMuteLocalTrack),e.off(uP.NEED_ENABLE_TRACK,this.handleUnmuteLocalTrack),e.off(uP.NEED_REPLACE_TRACK,this.handleReplaceTrack),e.off(uP.NEED_MUTE_TRACK,this.handleMuteLocalTrack),e.off(uP.NEED_UNMUTE_TRACK,this.handleUnmuteLocalTrack))}bindRemoteTrackEvents(e,t){t instanceof P$&&t.addListener(uP.GET_STATS,t=>{t(this.handleGetRemoteVideoStats(e))}),t instanceof B$&&t.addListener(uP.GET_STATS,t=>{t(this.handleGetRemoteAudioStats(e))})}unbindRemoteTrackEvents(e){e&&e.removeAllListeners(uP.GET_STATS)}unbindAllRemoteTrackEvents(){Array.from(this.remoteUserMap.entries()).forEach(e=>{let[t,r]=e;r.has(yP.AUDIO)&&this.unbindRemoteTrackEvents(t._audioTrack),r.has(yP.VIDEO)&&this.unbindRemoteTrackEvents(t._videoTrack)})}createGatewayPublishMessage(e,t){return e.map((e,r)=>{let i,n,{track:o,type:s}=e;switch(s){case RP.LocalAudioTrack:i=aP.Audio,n={dtx:o instanceof Hj&&o._config.DTX,hq:!1,lq:!1,stereo:!1,speech:!1};break;case RP.LocalVideoTrack:i=o._hints.includes(AP.SCREEN_TRACK)?aP.Screen:aP.High,n=j$(j$({},uG(o)),{},{codec:this.store.codec});break;case RP.LocalVideoLowTrack:i=aP.Low,n=j$(j$({},uG(o)),{},{codec:this.store.codec})}return{stream_type:i,attributes:n,ssrcs:t[r]}})}createGatewayUnpublishMessage(e){return e.map(e=>{let t,[r,{track:i,ssrcs:n,id:o}]=e;switch(r){case RP.LocalVideoTrack:t=i._hints.includes(AP.SCREEN_TRACK)?aP.Screen:aP.High;break;case RP.LocalAudioTrack:t=aP.Audio;break;case RP.LocalVideoLowTrack:t=aP.Low}return{stream_type:t,ssrcs:n,mid:o}})}assignLocalTracks(e,t){e.forEach((e,r)=>{let{track:i,type:n}=e;this.localTrackMap.set(n,{track:i,id:t[r].id,ssrcs:t[r].localSSRC})})}withdrawLocalTracks(e){e.forEach(e=>{let[t]=e;this.localTrackMap.delete(t)})}async waitTillConnected(){return new ny((e,t)=>{switch(this.state){case TP.New:case TP.Reconnecting:{const r=(i,n)=>n===TP.Disconnected?(this.off(wP.StateChange,r),void t(new eD($N.UNEXPECTED_ERROR,"PeerConnection already disconnected."))):n===TP.Connected?(this.off(wP.StateChange,r),void e(void 0)):void 0;this.on(wP.StateChange,r);break}case TP.Connected:e(void 0);break;case TP.Disconnected:t(new eD($N.UNEXPECTED_ERROR,"PeerConnection already disconnected."))}})}bindConnectionEvents(e){e.onConnectionStateChange=async t=>{if(cD.info("[p2pId: ".concat(this.store.p2pId,"]: P2PConnection.onConnectionStateChange(").concat(t,")")),TD("info",this,"connectionStateChange",t),this.emit(wP.PeerConnectionStateChange,t),"connected"!==t||this.store.keyMetrics.peerConnectionEnd||this.store.peerConnectionEnd(),"failed"===t){"failed"===e.iceConnectionState?(setTimeout(()=>this.emit(wP.P2PLost),0),this.iceFailedCount+=1,await _G(rD(this.iceFailedCount,tD)),this.emit(wP.RequestRestartICE)):await this.requestReconnect()}},e.onICEConnectionStateChange=e=>{cD.info("[p2pId: ".concat(this.store.p2pId,"]: P2PConnection.onICEConnectionStateChange(").concat(e,")")),TD("info",this,"iceConnectionStateChange",e),wV.reportApiInvoke(this.store.sessionId,{name:"ICEConnectionStateChange",options:e,tag:fk.TRACER}).onSuccess(),this.emit(wP.IceConnectionStateChange,e)},e.onICETransportStateChange=e=>{cD.info("[p2pId: ".concat(this.store.p2pId,"]: P2PConnection.onICETransportStateChange(").concat(e,")")),TD("info",this,"ICETransportStateChange",e)},e.onDTLSTransportStateChange=e=>{cD.info("[p2pId: ".concat(this.store.p2pId,"]: P2PConnection.onDTLSTransportStateChange(").concat(e,")")),TD("info",this,"DTLSTransportStateChange",e)},e.onDTLSTransportError=e=>{cD.info("[p2pId: ".concat(this.store.p2pId,"]: P2PConnection.onDTLSTransportError(").concat(e,")")),TD("info",this,"DTLSTransportError",e)},e.onFirstAudioDecoded=e=>{var t;const r=Array.from(AV(t=this.remoteUserMap).call(t)).find(t=>t._audioSSRC===e);var i;r&&(null===(i=r.audioTrack)||void 0===i||i.emit(gP.FIRST_FRAME_DECODED),wV.firstRemoteFrame(this.store.sessionId,hk.FIRST_AUDIO_DECODE,lk.FIRST_AUDIO_DECODE,{peer:r._uintid,subscribeElapse:Zj.measureFromSubscribeStart(this.store.clientId,e),subscribeRequestid:e,p2pid:this.store.p2pId}))},e.onFirstAudioReceived=e=>{var t;const r=Array.from(AV(t=this.remoteUserMap).call(t)).find(t=>t._audioSSRC===e);r&&wV.firstRemoteFrame(this.store.sessionId,hk.FIRST_AUDIO_RECEIVED,lk.FIRST_AUDIO_RECEIVED,{peer:r._uintid,subscribeElapse:Zj.measureFromSubscribeStart(this.store.clientId,e),subscribeRequestid:e,p2pid:this.store.p2pId})},e.onFirstVideoDecoded=(e,t,r)=>{var i;const n=Array.from(AV(i=this.remoteUserMap).call(i)).find(t=>t._videoSSRC===e);n&&wV.firstRemoteFrame(this.store.sessionId,hk.FIRST_VIDEO_DECODE,lk.FIRST_VIDEO_DECODE,{peer:n._uintid,videowidth:t,videoheight:r,subscribeElapse:Zj.measureFromSubscribeStart(this.store.clientId,e),subscribeRequestid:e,p2pid:this.store.p2pId})},e.onFirstVideoReceived=e=>{var t;const r=Array.from(AV(t=this.remoteUserMap).call(t)).find(t=>t._videoSSRC===e);r&&wV.firstRemoteFrame(this.store.sessionId,hk.FIRST_VIDEO_RECEIVED,lk.FIRST_VIDEO_RECEIVED,{peer:r._uintid,subscribeElapse:Zj.measureFromSubscribeStart(this.store.clientId,e),subscribeRequestid:e,p2pid:this.store.p2pId})},e.onSelectedLocalCandidateChanged=(e,t)=>{const r="relay"===e.candidateType,i="relay"===t.candidateType;"unknown"!==t.candidateType&&r===i||this.emit(wP.ConnectionTypeChange,r),cD.info("[p2pId: ".concat(this.store.p2pId,"]: P2PConnection.SelectedLocalCandidateChanged(").concat(JSON.stringify(fG(t))," -> ").concat(JSON.stringify(fG(e)),")")),TD("info",this,"SelectedLocalCandidateChanged","".concat(JSON.stringify(fG(t))," -> ").concat(JSON.stringify(fG(e))))},e.onSelectedRemoteCandidateChanged=(e,t)=>{cD.info("[p2pId: ".concat(this.store.p2pId,"]: P2PConnection.SelectedRemoteCandidateChanged(").concat(JSON.stringify(fG(t))," -> ").concat(JSON.stringify(fG(e)),")")),TD("info",this,"SelectedRemoteCandidateChanged","".concat(JSON.stringify(fG(t))," -> ").concat(JSON.stringify(fG(e))))}}unbindConnectionEvents(e){e.onConnectionStateChange=void 0,e.onICEConnectionStateChange=void 0,e.onICETransportStateChange=void 0,e.onDTLSTransportStateChange=void 0,e.onDTLSTransportError=void 0,e.onFirstAudioDecoded=void 0,e.onFirstAudioReceived=void 0,e.onFirstVideoDecoded=void 0,e.onFirstVideoReceived=void 0,e.onSelectedLocalCandidateChanged=void 0,e.onSelectedRemoteCandidateChanged=void 0}filterTobeMutedTracks(e){const t=[];if(-1===this.getAllTracks().indexOf(e))return t;const r=this.localTrackMap.get(RP.LocalAudioTrack);if(e instanceof Kj&&(null==r?void 0:r.track)instanceof Wj)return r.track.isActive||t.push([RP.LocalAudioTrack,r]),t;const i=Array.from(this.localTrackMap.entries()).find(t=>{let[,{track:r}]=t;return e===r});if(i&&(t.push(i),i[0]===RP.LocalVideoTrack)){const e=this.localTrackMap.get(RP.LocalVideoLowTrack);e&&t.push([RP.LocalVideoLowTrack,e])}return t}filterTobeUnmutedTracks(e){const t=[],r=this.localTrackMap.get(RP.LocalAudioTrack);if(e instanceof Kj&&(null==r?void 0:r.track)instanceof Wj)return r.track.isActive&&t.push([RP.LocalAudioTrack,r]),t;const i=Array.from(this.localTrackMap.entries()).find(t=>{let[,{track:r}]=t;return e===r});if(i)if(i[0]===RP.LocalVideoTrack){t.push(i);const e=this.localTrackMap.get(RP.LocalVideoLowTrack);e&&t.push([RP.LocalVideoLowTrack,e])}else t.push(i);return t}createMuteMessage(e){return e.map(e=>{let t,[r,{track:i,ssrcs:n,id:o}]=e;switch(r){case RP.LocalAudioTrack:t=aP.Audio;break;case RP.LocalVideoTrack:t=i._hints.includes(AP.SCREEN_TRACK)?aP.Screen:aP.High;break;case RP.LocalVideoLowTrack:t=aP.Low}return{stream_type:t,ssrcs:n,mid:o}})}createUnmuteMessage(e){return e.map(e=>{let t,[r,{track:i,ssrcs:n,id:o}]=e;switch(r){case RP.LocalAudioTrack:t=aP.Audio;break;case RP.LocalVideoTrack:t=i._hints.includes(AP.SCREEN_TRACK)?aP.Screen:aP.High;break;case RP.LocalVideoLowTrack:t=aP.Low}return{stream_type:t,ssrcs:n,mid:o}})}filterTobeUnSubscribedTracks(e,t){const r=[],i=this.remoteUserMap.get(e);if(!i)return r;if(t){const n=i.get(t);if(!n)return r;r.push([e,{kind:t,id:n}])}else Array.from(i.entries()).forEach(t=>{let[i,n]=t;r.push([e,{kind:i,id:n}])});return r}createUnsubscribeMessage(e){const t=[];return e.forEach(e=>{let[r,{kind:i,id:n}]=e;switch(i){case yP.VIDEO:return void(r._videoSSRC&&t.push({stream_type:yP.VIDEO,ssrcId:r._videoSSRC}));case yP.AUDIO:return void(r._audioSSRC&&t.push({stream_type:yP.AUDIO,ssrcId:r._audioSSRC}))}}),t}createUnsubscribeAllMessage(e){const t=new Map;return e.forEach(e=>{let[r,{kind:i}]=e;if(t.has(r)){let e=t.get(r);i===yP.VIDEO?e|=dP.Video:e|=dP.Audio,t.set(r,e)}else i===yP.VIDEO?t.set(r,dP.Video):t.set(r,dP.Audio)}),{users:Array.from(t.entries()).map(e=>{let[t,r]=e;return{stream_id:t.uid,stream_type:r}})}}withdrawRemoteTracks(e){e.forEach(e=>{let[t,{kind:r}]=e;const i=this.remoteUserMap.get(t);i&&(i.delete(r),0===Array.from(i.entries()).length&&this.remoteUserMap.delete(t))})}async updateBitrateLimit(e){const t=this.localTrackMap.get(RP.LocalVideoTrack),r=this.localTrackMap.get(RP.LocalVideoLowTrack);t&&await t.track.setBitrateLimit(e.uplink),r&&e.low_stream_uplink&&await r.track.setBitrateLimit({max_bitrate:e.low_stream_uplink.bitrate,min_bitrate:e.low_stream_uplink.bitrate||0})}isP2PDisconnected(){if(this.connection){return"connected"!==this.connection.peerConnectionState}return!0}mapPubResToRemoteConfig(e,t){return e.map((e,r)=>{var i;let{stream_type:n}=e;return null===(i=t.find(e=>{let{stream_type:t}=e;return n===t}))||void 0===i?void 0:i.attributes})}async tryToUnmuteAudio(e){for(let r=0;r<e.length;r++)if(e[r]instanceof Kj){var t;const i=this.filterTobeUnmutedTracks(e[r]);if(0===i.length)continue;await(null===(t=this.connection)||void 0===t?void 0:t.unmuteLocal(i.map(e=>{let[,{id:t}]=e;return t})));const n=this.createUnmuteMessage(i);return void await bG(this,wP.RequestUnmuteLocal,n)}}bindStatsUploaderEvents(){this.statsUploader.requestStats=()=>this.getStats(),this.statsUploader.requestLocalMedia=()=>Array.from(this.localTrackMap.entries()),this.statsUploader.requestRemoteMedia=()=>Array.from(this.remoteUserMap.entries()),this.statsUploader.requestVideoIsReady=e=>{var t;return!(null===(t=this.connection)||void 0===t||!t.getRemoteVideoIsReady(e))},this.statsUploader.requestUpload=(e,t)=>this.emit(wP.RequestUploadStats,e,t),this.statsUploader.requestAllTracks=()=>this.getAllTracks()}unbindStatsUploaderEvents(){this.statsUploader.requestStats=void 0,this.statsUploader.requestLocalMedia=void 0,this.statsUploader.requestRemoteMedia=void 0,this.statsUploader.requestVideoIsReady=void 0}async requestReconnect(){this.dtlsFailedCount+=1,await _G(rD(this.dtlsFailedCount,tD)),this.emit(wP.RequestReconnect)}async reconnectP2P(){const e=Array.from(this.localTrackMap.entries()),t=this.createGatewayUnpublishMessage(e);Array.from(this.remoteUserMap.entries()),t.length>0&&await wG(this,wP.RequestUnpublishForReconnectPC,t),this.disconnectForReconnect(),this.emit(wP.RequestReconnectPC)}canPublishLowStream(){return this.localTrackMap.has(RP.LocalVideoTrack)||this.pendingLocalTracks.some(e=>e instanceof Zq)}throwIfTrackTypeNotMatch(e){if(e.filter(e=>e instanceof Zq).length>1)throw new eD($N.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS);if(e.filter(e=>e instanceof Kj).length>1&&(e.some(e=>e instanceof Kj&&e._bypassWebAudio)||!BP().webAudioMediaStreamDest))throw new eD($N.NOT_SUPPORTED,"cannot publish multiple tracks which one of them configured with bypassWebAudio or your browser doesn't support MediaStreamDestNode");for(const t of e){if(t instanceof Zq&&this.pendingLocalTracks.some(e=>e instanceof Zq))throw new eD($N.CAN_NOT_PUBLISH_MULTIPLE_VIDEO_TRACKS);if(t instanceof Kj&&this.pendingLocalTracks.some(e=>e instanceof Kj)&&(!BP().webAudioMediaStreamDest||t._bypassWebAudio||this.pendingLocalTracks.some(e=>e instanceof Kj&&e._bypassWebAudio)))throw new eD($N.NOT_SUPPORTED,"cannot publish multiple tracks which one of them configured with bypassWebAudio or your browser doesn't support MediaStreamDestNode")}}getLowVideoTrack(e,t){const r=BP().supportDualStreamEncoding,i=j$(j$({},{width:160,height:120,framerate:15,bitrate:50}),t);let n;n=r?e._mediaStreamTrack.clone():b$(e,i);const o=new Zq(n,j$(j$({},r&&{scaleResolutionDownBy:gG(i,e)}),{},{frameRate:i.framerate,bitrateMax:i.bitrate,bitrateMin:i.bitrate}));return o._hints.push(AP.LOW_STREAM),o}async globalLock(){return this.mutex.lock("From P2PChannel.globalLock")}}).prototype,"startP2PConnection",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"startP2PConnection"),F$.prototype),qF(F$.prototype,"connect",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"connect"),F$.prototype),qF(F$.prototype,"unpublish",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"unpublish"),F$.prototype),qF(F$.prototype,"unpublishLowStream",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"unpublishLowStream"),F$.prototype),qF(F$.prototype,"subscribe",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"subscribe"),F$.prototype),qF(F$.prototype,"massSubscribe",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"massSubscribe"),F$.prototype),qF(F$.prototype,"unsubscribe",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"unsubscribe"),F$.prototype),qF(F$.prototype,"massUnsubscribe",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"massUnsubscribe"),F$.prototype),qF(F$.prototype,"muteRemote",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"muteRemote"),F$.prototype),qF(F$.prototype,"unmuteRemote",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"unmuteRemote"),F$.prototype),qF(F$.prototype,"hasRemoteMediaWithLock",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"hasRemoteMediaWithLock"),F$.prototype),qF(F$.prototype,"disconnectForReconnect",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"disconnectForReconnect"),F$.prototype),qF(F$.prototype,"reEstablish",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"reEstablish"),F$.prototype),qF(F$.prototype,"updateBitrateLimit",[Y$],Object.getOwnPropertyDescriptor(F$.prototype,"updateBitrateLimit"),F$.prototype),x$=F$))||x$;function Y$(e,t,r){const i=e[t];if("function"!=typeof i)throw new Error("Cannot use mutex on object property.");return r.value=async function(){const e=this.mutex,r=await e.lock("From P2PChannel.".concat(t));try{for(var n=arguments.length,o=new Array(n),s=0;s<n;s++)o[s]=arguments[s];return await i.apply(this,o)}finally{r()}},r}function W$(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var J$,q$="function"==typeof Symbol&&Symbol.observable||"@@observable",z$=function(){return Math.random().toString(36).substring(7).split("").join(".")},X$={INIT:"@@redux/INIT"+z$(),REPLACE:"@@redux/REPLACE"+z$(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+z$()}};function Z$(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}function $$(e,t,r){var i;if("function"==typeof t&&"function"==typeof r||"function"==typeof r&&"function"==typeof arguments[3])throw new Error(W$(0));if("function"==typeof t&&void 0===r&&(r=t,t=void 0),void 0!==r){if("function"!=typeof r)throw new Error(W$(1));return r($$)(e,t)}if("function"!=typeof e)throw new Error(W$(2));var n=e,o=t,s=[],a=s,c=!1;function d(){a===s&&(a=s.slice())}function u(){if(c)throw new Error(W$(3));return o}function A(e){if("function"!=typeof e)throw new Error(W$(4));if(c)throw new Error(W$(5));var t=!0;return d(),a.push(e),function(){if(t){if(c)throw new Error(W$(6));t=!1,d();var r=a.indexOf(e);a.splice(r,1),s=null}}}function h(e){if(!Z$(e))throw new Error(W$(7));if(void 0===e.type)throw new Error(W$(8));if(c)throw new Error(W$(9));try{c=!0,o=n(o,e)}finally{c=!1}for(var t=s=a,r=0;r<t.length;r++){(0,t[r])()}return e}function l(e){if("function"!=typeof e)throw new Error(W$(10));n=e,h({type:X$.REPLACE})}function p(){var e,t=A;return(e={subscribe:function(e){if("object"!=typeof e||null===e)throw new Error(W$(11));function r(){e.next&&e.next(u())}return r(),{unsubscribe:t(r)}}})[q$]=function(){return this},e}return h({type:X$.INIT}),(i={dispatch:h,subscribe:A,getState:u,replaceReducer:l})[q$]=p,i}function e1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function t1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?e1(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):e1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}!function(e){e.SET_SESSION_ID="SET_SESSION_ID",e.SET_P2P_ID="SET_P2P_id",e.SET_UID="SET_UID",e.SET_PUB_ID="SET_PUB_ID",e.KEY_METRIC_CLIENT_CREATED="KEY_METRIC_CLIENT_CREATED",e.KEY_METRIC_JOIN_START="KEY_METRIC_JOIN_START",e.AVOID_JOIN_START="AVOID_JOIN_START",e.KEY_METRIC_JOIN_END="KEY_METRIC_JOIN_END",e.KEY_METRIC_REQUEST_AP_START="KEY_METRIC_REQUEST_AP_START",e.KEY_METRIC_REQUEST_AP_END="KEY_METRIC_REQUEST_AP_END",e.KEY_METRIC_JOIN_GATEWAY_START="KEY_METRIC_JOIN_GATEWAY_START",e.KEY_METRIC_JOIN_GATEWAY_END="KEY_METRIC_JOIN_GATEWAY_END",e.KEY_METRIC_PEER_CONNECTION_START="KEY_METRIC_PEER_CONNECTION_START",e.KEY_METRIC_PEER_CONNECTION_END="KEY_METRIC_PEER_CONNECTION_END",e.KEY_METRIC_PUBLISH="KEY_METRIC_PUBLISH",e.KEY_METRIC_SUBSCRIBE="KEY_METRIC_SUBSCRIBE"}(J$||(J$={}));class r1{constructor(e,t,r,i){kO(this,"store",void 0),kO(this,"reducer",void 0);const n={codec:e,audioCodec:t,mode:r,clientId:i,sessionId:null,p2pId:0,pubId:0,subId:0,avoidJoinStart:0,keyMetrics:{publish:[],subscribe:[]}};this.reducer=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case J$.SET_SESSION_ID:return t1(t1({},e),{},{sessionId:t.sessionId});case J$.SET_P2P_ID:return t1(t1({},e),{},{p2pId:t.p2pId});case J$.SET_UID:return t1(t1({},e),{},{uid:t.uid});case J$.SET_PUB_ID:return t1(t1({},e),{},{pubId:t.pubId});case J$.KEY_METRIC_CLIENT_CREATED:return t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{clientCreated:t.metric})});case J$.KEY_METRIC_JOIN_START:return t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{joinStart:t.metric})});case J$.AVOID_JOIN_START:return t1(t1({},e),{},{avoidJoinStart:t.avoidJoinStart});case J$.KEY_METRIC_JOIN_END:return t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{joinEnd:t.metric})});case J$.KEY_METRIC_REQUEST_AP_START:return t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{requestAPStart:t.metric})});case J$.KEY_METRIC_REQUEST_AP_END:return t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{requestAPEnd:t.metric})});case J$.KEY_METRIC_JOIN_GATEWAY_START:return t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{joinGatewayStart:t.metric})});case J$.KEY_METRIC_JOIN_GATEWAY_END:return t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{joinGatewayEnd:t.metric})});case J$.KEY_METRIC_PEER_CONNECTION_START:return t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{peerConnectionStart:t.metric})});case J$.KEY_METRIC_PEER_CONNECTION_END:return t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{peerConnectionEnd:t.metric})});case J$.KEY_METRIC_PUBLISH:{const r=e.keyMetrics.publish,i=r.findIndex(e=>e.trackId===t.metric.trackId);return-1!==i?(r[i]=t1(t1({},r[i]),t.metric),t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{publish:[...r]})})):t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{publish:[...e.keyMetrics.publish,t.metric]})})}case J$.KEY_METRIC_SUBSCRIBE:{const r=e.keyMetrics.subscribe,i=r.findIndex(e=>e.userId===t.metric.userId&&e.type===t.metric.type);return-1!==i?(r[i]=t1(t1({},r[i]),t.metric),t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{subscribe:[...r]})})):t1(t1({},e),{},{keyMetrics:t1(t1({},e.keyMetrics),{},{subscribe:[...e.keyMetrics.subscribe,t.metric]})})}default:return e}},this.store=$$(this.reducer)}set sessionId(e){this.store.dispatch({type:J$.SET_SESSION_ID,sessionId:e})}get sessionId(){return this.store.getState().sessionId}get codec(){return this.store.getState().codec}get audioCodec(){return this.store.getState().audioCodec}get clientId(){return this.store.getState().clientId}set p2pId(e){this.store.dispatch({type:J$.SET_P2P_ID,p2pId:e})}get p2pId(){return this.store.getState().p2pId}set uid(e){this.store.dispatch({type:J$.SET_UID,uid:e})}get uid(){return this.store.getState().uid}set pubId(e){this.store.dispatch({type:J$.SET_PUB_ID,pubId:e})}get pubId(){return this.store.getState().pubId}clientCreated(){this.store.dispatch({type:J$.KEY_METRIC_CLIENT_CREATED,metric:performance.now()})}joinStart(){this.store.dispatch({type:J$.KEY_METRIC_JOIN_START,metric:performance.now()})}get avoidJoinStart(){return this.store.getState().avoidJoinStart}set avoidJoinStart(e){this.store.dispatch({type:J$.AVOID_JOIN_START,avoidJoinStart:e})}joinEnd(){this.store.dispatch({type:J$.KEY_METRIC_JOIN_END,metric:performance.now()})}requestAPStart(){this.store.dispatch({type:J$.KEY_METRIC_REQUEST_AP_START,metric:performance.now()})}requestAPEnd(){this.store.dispatch({type:J$.KEY_METRIC_REQUEST_AP_END,metric:performance.now()})}joinGatewayStart(){this.store.dispatch({type:J$.KEY_METRIC_JOIN_GATEWAY_START,metric:performance.now()})}joinGatewayEnd(){this.store.dispatch({type:J$.KEY_METRIC_JOIN_GATEWAY_END,metric:performance.now()})}peerConnectionStart(){this.store.dispatch({type:J$.KEY_METRIC_PEER_CONNECTION_START,metric:performance.now()})}peerConnectionEnd(){this.store.dispatch({type:J$.KEY_METRIC_PEER_CONNECTION_END,metric:performance.now()})}publish(e,t,r,i){this.store.dispatch({type:J$.KEY_METRIC_PUBLISH,metric:t1(t1({trackId:e,type:t},r&&{publishStart:r}),i&&{publishEnd:i})})}subscribe(e,t,r,i,n){this.store.dispatch({type:J$.KEY_METRIC_SUBSCRIBE,metric:t1(t1(t1({userId:e,type:t},r&&{subscribeStart:r}),i&&{subscribeEnd:i}),n&&{firstFrame:n})})}massSubscribe(e,t,r,i){e.forEach(e=>{this.store.dispatch({type:J$.KEY_METRIC_SUBSCRIBE,metric:t1(t1(t1({userId:e.userId,type:e.type},t&&{subscribeStart:t}),r&&{subscribeEnd:r}),i&&{firstFrame:i})})})}get keyMetrics(){return this.store.getState().keyMetrics}}let i1;const n1=()=>"HTTPS"===(i1||i1||(i1=(window.location.protocol.split(":")[0]||"").toUpperCase(),i1)),o1=()=>void 0!==window.isSecureContext;class s1{constructor(e,t){kO(this,"time",void 0),kO(this,"sequence",void 0),kO(this,"name",void 0),kO(this,"elapse",void 0),this.name=e,this.time=performance.now(),this.sequence=DP[t].indexOf(e)}setElapse(e){this.elapse=e}}const a1=new Map;class c1{constructor(e,t){kO(this,"records",[]),kO(this,"_id",void 0),kO(this,"_group",void 0),kO(this,"_localTimeStamp",void 0),kO(this,"_performanceTimeStamp",void 0),this._id=e,this._group=t,this._localTimeStamp=Date.now(),this._performanceTimeStamp=performance.now()}checkPoint(e){const t=new s1(e,this._group);-1===t.sequence&&cD.warning("[".concat(this._id,"] check point record failed, cannot get the sequence")),this.records.push(t);const r=this.records.find(e=>e.sequence===t.sequence-1);r&&t.setElapse(t.time-r.time)}getRecord(e){return this.records.find(t=>t&&t.name===e)}resetRecords(){this.records.length=0}}var d1,u1,A1,h1,l1,p1,g1,f1,E1;function I1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function m1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?I1(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):I1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}let _1=(d1=LD("AgoraRTCClient","store.clientId"),u1=RV({report:wV}),A1=RV(),h1=RV({report:wV}),l1=TV(),p1=RV({report:wV}),g1=TV({report:wV}),d1((qF((E1=class extends XN{get connectionState(){return this._gateway.state}get remoteUsers(){return this._users}get localTracks(){return this._p2pChannel.getAllTracks(!0)}get uid(){return this._uid}get channelName(){return this._channelName}get isStringUID(){return!!this._joinInfo&&!!this._joinInfo.stringUid}constructor(e){let t;if(super(),kO(this,"store",void 0),kO(this,"_uid",void 0),kO(this,"_channelName",void 0),kO(this,"_uintUid",void 0),kO(this,"_users",[]),kO(this,"_codec",void 0),kO(this,"_mode",void 0),kO(this,"_config",void 0),kO(this,"_clientId",void 0),kO(this,"_appId",void 0),kO(this,"_sessionId",null),kO(this,"_key",void 0),kO(this,"_joinInfo",void 0),kO(this,"_gateway",void 0),kO(this,"_statsCollector",void 0),kO(this,"_configDistribute",void 0),kO(this,"_leaveMutex",new kV("client-leave")),kO(this,"_publishMutex",new kV("client-publish")),kO(this,"_renewTokenMutex",new kV("client-renewtoken")),kO(this,"_subscribeMutex",new kV("client-subscribe")),kO(this,"_encryptionMode","none"),kO(this,"_encryptionSecret",null),kO(this,"_encryptionSalt",null),kO(this,"_proxyServer",void 0),kO(this,"_performanceRecorder",void 0),kO(this,"_turnServer",{servers:[],mode:"auto"}),kO(this,"_cloudProxyServerMode","disabled"),kO(this,"_isDualStreamEnabled",!1),kO(this,"_defaultStreamFallbackType",void 0),kO(this,"_lowStreamParameter",void 0),kO(this,"_streamFallbackTypeCacheMap",new Map),kO(this,"_remoteStreamTypeCacheMap",new Map),kO(this,"_axiosCancelSource",qN.CancelToken.source()),kO(this,"_audioVolumeIndicationInterval",void 0),kO(this,"_networkQualityInterval",void 0),kO(this,"_userOfflineTimeout",void 0),kO(this,"_streamRemovedTimeout",void 0),kO(this,"_injectStreamingClient",void 0),kO(this,"_liveTranscodeStreamingClient",void 0),kO(this,"_liveRawStreamingClient",void 0),kO(this,"_channelMediaRelayClient",void 0),kO(this,"_networkQualitySensitivity","normal"),kO(this,"_p2pChannel",void 0),kO(this,"_useLocalAccessPoint",!1),kO(this,"_joinAndNotLeaveYet",!1),kO(this,"_numberOfJoinCount",0),kO(this,"_remoteDefaultVideoStreamType",void 0),kO(this,"_handleLocalTrackEnable",(e,t,r)=>{this.publish(e,!1).then(t).catch(r)}),kO(this,"_handleLocalTrackDisable",(e,t,r)=>{this.unpublish(e).then(t).catch(r)}),kO(this,"_handleUserOnline",e=>{this.isStringUID&&"string"!=typeof e.uid&&(cD.error("[".concat(this._clientId,"] StringUID is Mixed with UintUID")),RD("error",this,"StringUID is Mixed with UintUID"));const t=this._users.find(t=>t.uid===e.uid);if(t)t._trust_in_room_=!0;else{const t=new rz(e.uid,e.uint_id||e.uid);this._users.push(t),cD.debug("[".concat(this._clientId,"] user online"),e.uid),wD("info",this,"user-joined",{uid:e.uid}),this.emit(Tk.USER_JOINED,t)}}),kO(this,"_handleUserOffline",e=>{const t=this._users.find(t=>t.uid===e.uid);t&&(this._handleRemoveStream(e),DG(this._users,t),this._remoteStreamTypeCacheMap.delete(t.uid),this._streamFallbackTypeCacheMap.delete(t.uid),cD.debug("[".concat(this._clientId,"] user offline"),e.uid,"reason:",e.reason),wD("info",this,"user-left",{reason:e.reason,uid:e.uid}),this.emit(Tk.USER_LEAVED,t,e.reason))}),kO(this,"_handleAddAudioOrVideoStream",(e,t,r,i,n,o,s)=>{const a=this._users.find(e=>e.uid===t);if(!a)return cD.error("[".concat(this._clientId,"] can not find target user!(on_add_stream)")),void TD("error",["AgoraRTCGateway",this._clientId],"add_".concat(e,"_stream"),"can not find target user!");cD.debug("[".concat(this._clientId,"] stream added with uid ").concat(t,", type ").concat(e)),TD("debug",["AgoraRTCGateway",this._clientId],"add_".concat(e,"_stream"),{uid:t,mediaType:e});const c="audio"===e?a.hasAudio:a.hasVideo;a._uintid||(a._uintid=n||t),a._trust_stream_added_state_=!0,"audio"===e?(a._audio_added_=!0,void 0!==r&&(a._audioSSRC=r),void 0!==i&&(a._cname=i),o&&(a._audioOrtc=o)):(a._video_added_=!0,void 0!==r&&(a._videoSSRC=r),void 0!==i&&(a._cname=i),void 0!==s&&(a._rtxSsrcId=s),o&&(a._videoOrtc=o)),("audio"===e?a.hasAudio:a.hasVideo)&&!c&&(cD.info("[".concat(this._clientId,"] remote user ").concat(a.uid," published ").concat(e)),RD("info",this,"remote user ".concat(a.uid," published ").concat(e)),wD("info",this,"user-published",{uid:a.uid,mediaType:e}),this.emit(Tk.USER_PUBLISHED,a,e)),"video"===e?wV.onGatewayStream(this._sessionId,hk.ON_ADD_VIDEO_STREAM,lk.ON_ADD_VIDEO_STREAM,{peer:n||t}):wV.onGatewayStream(this._sessionId,hk.ON_ADD_AUDIO_STREAM,lk.ON_ADD_AUDIO_STREAM,{peer:n||t}),this._p2pChannel.hasPendingRemoteMedia(a,e)&&this.subscribe(a,e).catch(e=>{cD.error("[".concat(this._clientId,"] resubscribe error"),e.toString()),RD("error",this,"resubscribe error: ".concat(e.toString()))})}),kO(this,"_handleRemoveStream",e=>{const t=this._users.find(t=>t.uid===e.uid);if(!t)return cD.warning("[".concat(this._clientId,"] can not find target user!(on_remove_stream)")),void TD("warning",["AgoraRTCGateway",this._clientId],"remove_stream",{uid:e.uid,info:"can not find target user!"});cD.debug("[".concat(this._clientId,"] stream removed with uid ").concat(e.uid)),TD("debug",["AgoraRTCGateway",this._clientId],"remove_stream",{uid:e.uid});let r=()=>{};t.hasAudio&&t.hasVideo?r=()=>{cD.info("[".concat(this._clientId,"] remote user ").concat(t.uid," unpublished audio track")),wD("info",this,"user-unpublished",{uid:t.uid,mediaType:"audio"}),this.emit(Tk.USER_UNPUBLISHED,t,"audio"),cD.info("[".concat(this._clientId,"] remote user ").concat(t.uid," unpublished video track")),wD("info",this,"user-unpublished",{uid:t.uid,mediaType:"video"}),this.emit(Tk.USER_UNPUBLISHED,t,"video")}:t.hasVideo?r=()=>{cD.info("[".concat(this._clientId,"] remote user ").concat(t.uid," unpublished video track")),wD("info",this,"user-unpublished",{uid:t.uid,mediaType:"video"}),this.emit(Tk.USER_UNPUBLISHED,t,"video")}:t.hasAudio&&(r=()=>{cD.info("[".concat(this._clientId,"] remote user ").concat(t.uid," unpublished audio track")),wD("info",this,"user-unpublished",{uid:t.uid,mediaType:"audio"}),this.emit(Tk.USER_UNPUBLISHED,t,"audio")}),t._trust_stream_added_state_=!0,t._audio_added_=!1,t._video_added_=!1,this._p2pChannel.unsubscribe(t).then(e=>{if(e)return this._gateway.unsubscribe(e,t.uid)}),t._audioSSRC=void 0,t._videoSSRC=void 0,t._audioOrtc=void 0,t._videoOrtc=void 0,t._rtxSsrcId=void 0,wV.onGatewayStream(this._sessionId,hk.ON_REMOVE_STREAM,lk.ON_REMOVE_STREAM,{peer:e.uint_id||e.uid}),r()}),kO(this,"_handleSetStreamLocalEnable",(e,t,r)=>{const i=this._users.find(e=>e.uid===t);if(!i)return cD.error("[".concat(this._clientId,"] can not find target user!(disable_local)")),void TD("error",this,"disable_local_video","can not find target user!(disable_local)");cD.debug("[".concat(this._clientId,"] local ").concat(e," ").concat(r?"enabled":"disabled"," with uid ").concat(t)),TD("debug",this,"disable_local_video","local ".concat(e," ").concat(r?"enabled":"disabled"," with uid ").concat(t));const n="audio"===e?i.hasAudio:i.hasVideo;if("audio"===e){i._trust_audio_enabled_state_=!0;const e=i._audio_enabled_;if(i._audio_enabled_=r,i._audio_enabled_===e)return;{const e=i._audio_enabled_?"enable-local-audio":"disable-local-audio";cD.debug("[".concat(this._clientId,"] user-info-updated, uid: ").concat(t,", msg: ").concat(e)),DD("debug",this,"user-info-updated",{uid:t,msg:e}),this.emit(Tk.USER_INFO_UPDATED,t,e)}}else{i._trust_video_enabled_state_=!0;const e=i._video_enabled_;if(i._video_enabled_=r,i._video_enabled_===e)return;{const e=i._video_enabled_?"enable-local-video":"disable-local-video";cD.debug("[".concat(this._clientId,"] user-info-update, uid: ").concat(t,", msg: ").concat(e)),DD("debug",this,"user-info-updated",{uid:t,msg:e}),this.emit(Tk.USER_INFO_UPDATED,t,e)}}const o="audio"===e?i.hasAudio:i.hasVideo;return n!==o?!n&&o?(cD.info("[".concat(this._clientId,"] remote user ").concat(t," published ").concat(e)),wD("info",this,"user-published",{uid:t,mediaType:e}),void this.emit(Tk.USER_PUBLISHED,i,e)):("video"===e&&i._videoTrack&&i._videoTrack._destroy(),"audio"===e&&i._audioTrack,this._p2pChannel.muteRemote(i,e),cD.info("[".concat(this._clientId,"] remote user ").concat(t," unpublished ").concat(e)),wD("info",this,"user-unpublished",{uid:t,mediaType:e}),void this.emit(Tk.USER_UNPUBLISHED,i,e)):void 0}),kO(this,"_handleMuteStream",(e,t,r)=>{cD.debug("[".concat(this._clientId,"] receive mute message"),e,t,r),TD("debug",this,"mute_".concat(t),r);const i=this._users.find(t=>t.uid===e);if(!i)return cD.warning("[".concat(this._clientId,"] can not find remote user, ignore mute event, uid: ").concat(e)),void TD("warning",this,"mute_".concat(t),"can not find remote user, ignore mute event, uid: ".concat(e));const n="audio"===t?i.hasAudio:i.hasVideo;if("audio"===t){i._trust_audio_mute_state_=!0;const t=i._audio_muted_;if(i._audio_muted_=r,i._audio_muted_===t)return;{const t=i._audio_muted_?"mute-audio":"unmute-audio";cD.debug("[".concat(this._clientId,"] user-info-update, uid: ").concat(e,", msg: ").concat(t)),DD("debug",this,"user-info-updated",{uid:e,msg:t}),this.emit(Tk.USER_INFO_UPDATED,e,t)}}else{i._trust_video_mute_state_=!0;const t=i._video_muted_;if(i._video_muted_=r,i._video_muted_===t)return;{const t=i._video_muted_?"mute-video":"unmute-video";cD.debug("[".concat(this._clientId,"] user-info-update, uid: ").concat(e,", msg: ").concat(t)),DD("debug",this,"user-info-updated",{uid:e,msg:t}),this.emit(Tk.USER_INFO_UPDATED,e,t)}}const o="audio"===t?i.hasAudio:i.hasVideo;return n!==o?!n&&o?(cD.info("[".concat(this._clientId,"] remote user ").concat(e," published ").concat(t)),wD("info",this,"user-published",{uid:i.uid,mediaType:t}),void this.emit(Tk.USER_PUBLISHED,i,t)):("video"===t&&i._videoTrack&&i._videoTrack._destroy(),"audio"===t&&i._audioTrack,this._p2pChannel.muteRemote(i,t),cD.info("[".concat(this._clientId,"] remote user ").concat(e," unpublished ").concat(t)),wD("info",this,"user-unpublished",{uid:e,mediaType:t}),void this.emit(Tk.USER_UNPUBLISHED,i,t)):void 0}),kO(this,"_handleP2PLost",async e=>{if(cD.debug("[".concat(this._clientId,"] receive p2p lost"),e),TD("debug",this,"p2p_lost",e),parseInt(e.p2pid,10)!==this.store.p2pId)return cD.warning("P2PLost stream not found",e),void TD("warning",this,"p2p_lost","P2PLost stream not found, ".concat(e));await this._p2pChannel.requestReconnect()}),kO(this,"_handleTokenWillExpire",()=>{cD.debug("[".concat(this._clientId,"] received message onTokenPrivilegeWillExpire")),TD("debug",this,"token_privilege_will_expire"),this.emit(Tk.ON_TOKEN_PRIVILEGE_WILL_EXPIRE)}),kO(this,"_handleBeforeUnload",e=>{"beforeunload"===e.type&&void 0!==e.returnValue&&""!==e.returnValue||(this.leave(),cD.info("[".concat(this._clientId,"] auto leave onbeforeunload or pagehide")),bD("info",["window",this.store.clientId],pO()?"beforeunload":"pagehide"))}),kO(this,"_handleUpdateNetworkQuality",()=>{if("normal"===this._networkQualitySensitivity)return;if(navigator&&void 0!==navigator.onLine&&!navigator.onLine)return void this.emit(Tk.NETWORK_QUALITY,{downlinkNetworkQuality:6,uplinkNetworkQuality:6});const e={downlinkNetworkQuality:0,uplinkNetworkQuality:0};e.uplinkNetworkQuality=this._p2pChannel.getUplinkNetworkQuality(),e.downlinkNetworkQuality=this._p2pChannel.getDownlinkNetworkQuality(),this.emit(Tk.NETWORK_QUALITY,e)}),this._codec=e.codec,this._mode=e.mode,this._clientId=vG(5,"client-"),this.store=new r1(e.codec,e.audioCodec,e.mode,this._clientId),this.store.clientCreated(),e.proxyServer&&this.setProxyServer(e.proxyServer,!0),e.turnServer&&this.setTurnServer(e.turnServer,!0),cD.info("[".concat(this._clientId,"] Initializing AgoraRTC client v").concat(BD," build: ").concat(PD,", mode: ").concat(this._mode,", codec: ").concat(this._codec)),DD("info",this,"constructor",{version:BD,build:PD,mode:this._mode,codec:this._codec}),this._performanceRecorder=function(e,t){const r=new c1(e,t);return a1.set(e,r),r}(this._clientId,"join"),e.clientRoleOptions)try{xk(e.clientRoleOptions),t=Object.assign({},e.clientRoleOptions)}catch(e){cD.warning("[".concat(this._clientId,"] ").concat(e.toString())),RD("warning",this,e.toString())}this._statsCollector=new tG(this.store),this._statsCollector.onStatsException=(e,t,r)=>{cD.debug("[".concat(this._clientId,"] receive exception msg, code: ").concat(e,", msg: ").concat(t,", uid: ").concat(r)),wD("debug",this,Tk.EXCEPTION,{code:e,message:t,uid:r}),this.emit(Tk.EXCEPTION,{code:e,msg:t,uid:r})},this._statsCollector.onUploadPublishDuration=(e,t,r,i)=>{const n=this._users.find(t=>t.uid===e);n&&wV.peerPublishStatus(this._sessionId,{subscribeElapse:i,audioPublishDuration:t,videoPublishDuration:r,peer:n._uintid})},this._gateway=new aJ(this.store,{clientId:this._clientId,mode:this._mode,codec:this._codec,websocketRetryConfig:e.websocketRetryConfig||tD,httpRetryConfig:e.httpRetryConfig||tD,forceWaitGatewayResponse:void 0===e.forceWaitGatewayResponse||e.forceWaitGatewayResponse,statsCollector:this._statsCollector,role:e.role,clientRoleOptions:t}),this._config=e,this._configDistribute=new QJ,this._p2pChannel=new H$(this.store,this._statsCollector),this._handleP2PChannelEvents(),this._handleGatewayEvents()}async join(e,t,r,i,n){const o=++this._numberOfJoinCount;this._performanceRecorder.checkPoint("startJoin"),this.store.joinStart();const s=n1(),a=o1()?window.isSecureContext:"Browser Not Support";if(!o1()&&!s||!window.isSecureContext){const e="The website must be running in a secure context (About secure context: https://developer.mozilla.org/en-US/docs/Web/Security/Secure_Contexts ), otherwise the media collection will be restricted by the browser";cD.warning(e),OD("warning",this,e)}const c=SG();"DISCONNECTED"===this.connectionState&&(this.store.avoidJoinStart=Math.round(Date.now()),cD.debug("[".concat(this._clientId,"] set avoidJoinStart to ").concat(this.store.avoidJoinStart)),OD("debug",this,"join",void 0,"[".concat(this._clientId,"] set avoidJoinStart to ").concat(this.store.avoidJoinStart)));const d=wV.reportApiInvoke(c,{name:gk.JOIN,options:[e,t,r,i],states:{isHttps:s,isSecureContext:a},tag:fk.TRACER});try{if(!r&&null!==r)throw new eD($N.INVALID_PARAMS,"Invalid token: ".concat(r,". If you don not use token, set it to null"));r&&ZL(r,"token",1,2047),ZL(e,"appid",1,2047),ek(t),i&&tk(i),n&&ZL(n,"optionalInfo",1,2047)}catch(e){throw d.onError(e),e}if(cD.info("[".concat(this._clientId,"] start join channel ").concat(t,", join number: ").concat(o)),DD("info",this,"join",{channel:t}),this._leaveMutex.isLocked){cD.debug("[".concat(this._clientId,"] join: waiting leave operation")),RD("debug",this,"join: waiting leave operation");(await this._leaveMutex.lock())(),cD.debug("[".concat(this._clientId,"] join: continue")),RD("debug",this,"join: continue")}if(this._joinAndNotLeaveYet=!0,"DISCONNECTED"!==this.connectionState){const e=new eD($N.INVALID_OPERATION,"[".concat(this._clientId,"] Client already in connecting/connected state"));throw d.onError(e),e}this._sessionId||(this._sessionId=c,this.store.sessionId=this._sessionId),this._gateway.state="CONNECTING";const u=m1({clientId:this._clientId,appId:e,sid:this._sessionId,cname:t,uid:"string"!=typeof i?i:null,turnServer:this._turnServer,proxyServer:this._proxyServer,token:r||e,cloudProxyServer:this._cloudProxyServerMode,optionalInfo:n,useLocalAccessPoint:this._useLocalAccessPoint},void 0!==this._remoteDefaultVideoStreamType&&{defaultVideoStream:this._remoteDefaultVideoStreamType});if("string"==typeof i&&(u.stringUid=i,this._uintUid?(u.uid=this._uintUid,this._uintUid=void 0):u.uid=0),"none"!==this._encryptionMode&&this._encryptionSecret){if(u.aesmode=this._encryptionMode,u.aespassword=await(async e=>{const t=UG("MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCMnXAHkKIGAM+x4N22gCI+Wyu\nSTM9ztkT3uYslTT2PuKmZfPzhH6kVdO7PTjGCOZnAsyb3oTtWat0KcxQ4jxvqQV+\nHvYl3iI1Yd4vl2c3qRMJPLtRDfNxa2Mcxgq7e9aEUibzdd0st+OJAy3tOj/Y0aVy\nxQiYDz3vqa6bP29adwIDAQAB"),r=await window.crypto.subtle.importKey("spki",t,{name:"RSA-OAEP",hash:"SHA-256"},!0,["encrypt"]),i=rG(e),n=await window.crypto.subtle.encrypt({name:"RSA-OAEP"},r,i);return QG(new Uint8Array(n))})(this._encryptionSecret),!this._joinAndNotLeaveYet)throw new eD($N.INVALID_OPERATION,"[".concat(this._clientId,"] Client already left"));this._encryptionSalt&&(u.aessalt=this._encryptionSalt)}this._startSession(this._sessionId,{channel:t,appId:e});const A=this._sessionId;setTimeout(()=>{"CONNECTING"===this.connectionState&&A===this._sessionId&&wV.joinChannelTimeout(this._sessionId,5)},5e3);try{let i;const n=u.cloudProxyServer;if("443only"===n)u.proxyServer=WD("PROXY_SERVER_TYPE2");else if(["proxy3","proxy4","proxy5"].includes(n)){const e=WD("PROXY_SERVER_TYPE3");Array.isArray(e)?u.proxyServer=e[0]:u.proxyServer=e}if(wV.setProxyServer(u.proxyServer),cD.setProxyServer(u.proxyServer),yD(u.proxyServer),this._performanceRecorder.checkPoint("startRequestAp"),this.store.requestAPStart(),u.stringUid&&!u.uid&&"normal"===n){await wJ(u,this._axiosCancelSource.token,this._config.httpRetryConfig||tD,!1);const e=await bJ(u.stringUid,u,this._axiosCancelSource.token,this._config.httpRetryConfig||tD);cD.debug("getUserAccount Success ".concat(u.stringUid," => ").concat(e)),RD("debug",this,"getUserAccount Success ".concat(u.stringUid," => ").concat(e)),u.uid=e,i=await TJ(u,this._axiosCancelSource.token,this._config.httpRetryConfig||tD)}else if(u.stringUid&&!u.uid){const e=await bJ(u.stringUid,u,this._axiosCancelSource.token,this._config.httpRetryConfig||tD);cD.debug("getUserAccount Success ".concat(u.stringUid," => ").concat(e)),RD("debug",this,"getUserAccount Success ".concat(u.stringUid," => ").concat(e)),u.uid=e,i=await wJ(u,this._axiosCancelSource.token,this._config.httpRetryConfig||tD,!0)}else i=await wJ(u,this._axiosCancelSource.token,this._config.httpRetryConfig||tD,!0);if(!this._joinAndNotLeaveYet)throw new eD($N.INVALID_OPERATION,"[".concat(this._clientId,"] Client already left"));this.store.requestAPEnd(),this._performanceRecorder.checkPoint("startJoinGateway"),setTimeout(()=>{this._configDistribute.startGetConfigDistribute(u,this._axiosCancelSource.token),this._configDistribute.on(vP.UPDATE_BITRATE_LIMIT,e=>{this._p2pChannel.updateBitrateLimit(e)})},0),this._key=r||e;const o=i.gatewayInfo;this._joinInfo=m1(m1({},u),{},{cid:o.cid,uid:u.uid?u.uid:o.uid,vid:o.vid,apResponse:o.res,uni_lbs_ip:o.uni_lbs_ip,gatewayAddrs:o.gatewayAddrs});const s=await this._joinGateway();if(!this._joinAndNotLeaveYet)throw new eD($N.INVALID_OPERATION,"[".concat(this._clientId,"] Client already left"));return d.onSuccess(s),this._appId=e,this._channelName=u.cname,this._uid=s,this.store.uid=s,setTimeout(()=>{this._networkQualityInterval&&window.clearInterval(this._networkQualityInterval),this._networkQualityInterval=window.setInterval(this._handleUpdateNetworkQuality,2e3),window.addEventListener(pO()?"beforeunload":"pagehide",this._handleBeforeUnload)},0),cD.info("[".concat(this._clientId,"] Joining channel success: ").concat(t)),DD("info",this,"join",t,"success"),setTimeout(()=>{WD("USE_NEW_LOG")?kD():cD.startUpload()},5e3),this._performanceRecorder.checkPoint("finishJoin"),this.store.joinEnd(),h=this,tL.includes(h)||tL.push(h),s}catch(e){const r=Array.isArray(e)?e[0]:e;throw cD.error("[".concat(this._clientId,"] join number: ").concat(o,", Joining channel failed, rollback"),r),DD("error",this,"join",t,r.toString()),r.code!==$N.OPERATION_ABORTED&&this._numberOfJoinCount===o&&(this._gateway.state="DISCONNECTED",this._reset()),d.onError(r),r}var h}_joinGateway(){if(!this._joinInfo||!this._key)throw new eD($N.INVALID_OPERATION);return this._gateway.join(this._joinInfo,this._key,!("disabled"!==this._joinInfo.cloudProxyServer||!WD("JOIN_WITH_FALLBACK_SIGNAL_PROXY"))).then(e=>e).catch(e=>{if(e.code===$N.INIT_WEBSOCKET_TIMEOUT)return this._gateway.leave(!0,Rk.FALLBACK);throw e}).then(e=>{if(e)return e;if(cD.info("[".concat(this._clientId,"] join timeout, fallback to proxy")),!this._joinInfo||!this._key)throw new eD($N.INVALID_OPERATION);this._joinInfo.cloudProxyServer="fallback",this._cloudProxyServerMode="fallback";const t=WD("PROXY_SERVER_TYPE3");if(Array.isArray(t))if(this._joinInfo.apUrl){const e=new kW(this._joinInfo.apUrl).host.split("."),r=e.slice(e.length-2).join(".");t.forEach(e=>{this._joinInfo&&e.includes(r)&&(this._joinInfo.proxyServer=e)}),this._joinInfo.proxyServer||(this._joinInfo.proxyServer=t[0])}else this._joinInfo.proxyServer=t[0];else this._joinInfo.proxyServer=t;cD.setProxyServer(this._joinInfo.proxyServer),wV.setProxyServer(this._joinInfo.proxyServer),yD(this._joinInfo.proxyServer);return wV.reportApiInvoke(this._sessionId,{name:gk.JOIN_FALLBACK_TO_PROXY,options:[this._joinInfo.proxyServer],tag:fk.TRACER}).onSuccess(),this.emit(Tk.JOIN_FALLBACK_TO_PROXY,this._joinInfo.proxyServer),this._gateway.join(this._joinInfo,this._key)}).then(e=>e)}async leave(){const e=wV.reportApiInvoke(this._sessionId,{name:gk.LEAVE,options:[],tag:fk.TRACER});cD.info("[".concat(this._clientId,"] Leaving channel")),DD("info",this,"leave"),window.removeEventListener(pO()?"beforeunload":"pagehide",this._handleBeforeUnload),this._reset(),function(e){const t=tL.indexOf(e);-1!==t&&tL.splice(t,1)}(this);const t=await this._leaveMutex.lock();if("DISCONNECTED"===this.connectionState)return cD.info("[".concat(this._clientId,"] Leaving channel repeated, success")),t(),e.onSuccess();await this._gateway.leave("CONNECTED"!==this.connectionState),cD.info("[".concat(this._clientId,"] Leaving channel success")),DD("info",this,"leave",void 0,"success"),this._joinAndNotLeaveYet=!1,t(),e.onSuccess()}async publish(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Array.isArray(e)||(e=[e]);const r=wV.reportApiInvoke(this._sessionId,{name:gk.PUBLISH,options:e.map(e=>e?Object(e).toString():"null"),tag:fk.TRACER});if(0===e.length){const e=new eD($N.INVALID_PARAMS,"track list is empty");return r.onError(e),e.throw()}if("audience"===this._gateway.role){const e=new eD($N.INVALID_OPERATION,"audience can not publish stream");return r.onError(e),e.throw()}for(const i of e){if(!(i instanceof BV)){const e=new eD($N.INVALID_PARAMS,"parameter is not local track");return r.onError(e),e.throw()}if(!i._enabled&&t){const e=new eD($N.TRACK_IS_DISABLED,"can not publish a disabled track: ".concat(i.getTrackId()));return r.onError(e),e.throw()}}cD.info("[".concat(this._clientId,"] Publishing tracks, id ").concat(e.map(e=>"".concat(e.getTrackId()," ")))),DD("info",this,"publish",e.map(e=>"".concat(e.getTrackId()))),await this._configDistribute.awaitConfigDistributeComplete(),t&&e.forEach(e=>{const t=this._configDistribute.getBitrateLimit();e instanceof Zq&&t&&e.setBitrateLimit(t.uplink)});const i=await this._publishMutex.lock();try{await this._publishHighStream(e),r.onSuccess(e.map(e=>e.trackMediaType+":"+e.getTrackLabel()).toString()),cD.info("[".concat(this._clientId,"] Publish success, id ").concat(e.map(e=>"".concat(e.getTrackId()," ")))),DD("info",this,"publish",e.map(e=>"".concat(e.getTrackId())),"success")}catch(e){throw r.onError(e),cD.error("[".concat(this._clientId,"] publish error"),e.toString()),DD("error",this,"publish",void 0,e.toString()),e}finally{i()}}async unpublish(e){if(!this._joinInfo||void 0===this._uid)throw new eD($N.INVALID_OPERATION,"Can't unpublish stream, haven't joined yet!");e?Array.isArray(e)||(e=[e]):e=this._p2pChannel.getAllTracks(!0);const t=wV.reportApiInvoke(this._sessionId,{name:gk.UNPUBLISH,options:e.map(e=>e.getTrackId()),tag:fk.TRACER});cD.info("[".concat(this._clientId,"] Unpublish tracks, tracks ").concat(e.map(e=>"".concat(e.getTrackId()," "))," ")),DD("info",this,"unpublish",e.map(e=>"".concat(e.getTrackId())));const r=await this._publishMutex.lock();try{const i=await this._p2pChannel.unpublish(e);i&&await this._gateway.unpublish(i,this._uid),cD.info("[".concat(this._clientId,"] Unpublish success,tracks ").concat(e.map(e=>"".concat(e.getTrackId())))),DD("info",this,"unpublish",e.map(e=>"".concat(e.getTrackId())),"success"),t.onSuccess()}catch(e){throw t.onError(e),cD.error("[".concat(this._clientId,"] unpublish error"),e.toString()),DD("error",this,"unpublish",void 0,e.toString()),e}finally{r&&r()}}async subscribe(e,t){zL(t,"mediaType",["audio","video"]);const r=wV.reportApiInvoke(this._sessionId,{name:gk.SUBSCRIBE,options:[e.uid,t],tag:fk.TRACER});if(!this._joinInfo){const e=new eD($N.INVALID_OPERATION,"Can't subscribe stream, not joined");throw r.onError(e),e}if("CONNECTED"!==this.connectionState&&"RECONNECTING"!==this.connectionState){const e=new eD($N.INVALID_OPERATION,"Can't subscribe stream in ".concat(this.connectionState," state"));throw r.onError(e),e}if(!this._users.find(t=>t===e)){const t=new eD($N.INVALID_REMOTE_USER,"user is not in the channel");throw cD.error("[".concat(this._clientId,"] can not subscribe ").concat(e.uid,", this user is not in the channel")),DD("error",this,"subscribe",e.uid,"this user is not in the channel"),r.onError(t),t}if(!e.hasAudio&&!e.hasVideo){const t=new eD($N.INVALID_REMOTE_USER,"user is not published");throw cD.error("[".concat(this._clientId,"] can not subscribe ").concat(e.uid,", user is not published")),DD("error",this,"subscribe",e.uid,"this user is not published"),r.onError(t),t}if("audio"===t&&(!e.hasAudio||void 0===e._audioSSRC)||"video"===t&&(!e.hasVideo||void 0===e._videoSSRC)){const i=new eD($N.REMOTE_USER_IS_NOT_PUBLISHED);throw cD.error("[".concat(this._clientId,"] can not subscribe ").concat(e.uid," with mediaType ").concat(t,", remote track is not published")),DD("error",this,"subscribe",e.uid,"mediaType ".concat(t,", remote track is not published")),r.onError(i),i}const i="audio"===t?e._audioSSRC:e._videoSSRC,n="audio"===t?e._audioOrtc:e._videoOrtc,o="video"===t?e._rtxSsrcId:void 0,s={stream_type:"audio"===t?yP.AUDIO:yP.VIDEO,ssrcId:i},a=await this._subscribeMutex.lock();cD.info("[".concat(this._clientId,"] subscribe user ").concat(e.uid,", mediaType: ").concat(t)),DD("info",this,"subscribe",{uid:e.uid,mediaType:t});try{if(await this._p2pChannel.hasRemoteMediaWithLock(e,t))await this._p2pChannel.unmuteRemote(e,t);else try{Zj.markSubscribeStart(this.store.clientId,i),this.store.subscribe(e.uid,t,performance.now()),await this._p2pChannel.subscribe(e,t,i,o,n);try{await this._gateway.subscribe(e.uid,s,!0)}catch(r){throw await this._p2pChannel.unsubscribe(e,t),r}this.store.subscribe(e.uid,t,void 0,performance.now()),this._p2pChannel.reportSubscribeEvent(!0,null,e,t)}catch(r){throw this._p2pChannel.reportSubscribeEvent(!1,null==r?void 0:r.code,e,t),r}cD.info("[".concat(this._clientId,"] subscribe success user ").concat(e.uid,", mediaType: ").concat(t)),DD("info",this,"subscribe",{uid:e.uid,mediaType:t},"success"),this._defaultStreamFallbackType&&this.setStreamFallbackOption(e.uid,this._defaultStreamFallbackType).catch(e=>{cD.warning("[".concat(this._clientId,"] auto set fallback failed"),e),RD("warning",this,"auto set fallback failed, ".concat(e.toString()))});const c="audio"===t?e._audioTrack:e._videoTrack;if(!c){const e=new eD($N.UNEXPECTED_ERROR,"can not find remote track in user object");return r.onError(e),e.throw()}return r.onSuccess(c.getTrackId()),c}catch(i){throw r.onError(i),cD.error("[".concat(this._clientId,"] subscribe user ").concat(e.uid," error"),i),DD("error",this,"subscribe",{uid:e.uid,mediaType:t},i.toString()),i}finally{a()}}async massSubscribe(e){$L(e,"subscribeList");const t=wV.reportApiInvoke(this._sessionId,{name:gk.MASS_SUBSCRIBE,options:e.map(e=>{let{user:t,mediaType:r}=e;return[null==t?void 0:t.uid,r]}),tag:fk.TRACER});if(!this._joinInfo){const e=new eD($N.INVALID_OPERATION,"Can't subscribe stream, not joined");throw t.onError(e),e}if("CONNECTED"!==this.connectionState&&"RECONNECTING"!==this.connectionState){const e=new eD($N.INVALID_OPERATION,"Can't subscribe stream in ".concat(this.connectionState," state"));throw t.onError(e),e}const r=performance.now(),i=new Map,n=await this._subscribeMutex.lock();cD.info("[".concat(this._clientId,"]start massSubscribe user ").concat(e.map(e=>{let{user:t,mediaType:r}=e;return"user: ".concat(null==t?void 0:t.uid,", mediaType: ").concat(r)}).join("; "))),DD("info",this,"massSubscribe",e);const o=(e=[...e]).map(e=>{let{user:t,mediaType:r}=e;return{user:t,mediaType:r}}),s=await this._p2pChannel.globalLock();try{var a;for(let r=e.length-1;r>=0;r--){const n=e[r],{user:s,mediaType:a}=n;if(zL(a,"mediaType",["audio","video"]),!s){const e=new eD($N.INVALID_PARAMS,"user property does not exist in subscribeList item");throw cD.error("[".concat(this._clientId,"] user property does not exist in subscribeList item")),t.onError(e),e}if(!this._users.find(e=>e===s)){const t=new eD($N.INVALID_REMOTE_USER,"user is not in the channel");cD.error("[".concat(this._clientId,"] can not massSubscribe ").concat(s.uid,", this user is not in the channel")),DD("error",this,"massSubscribe",s.uid,"this user is not in the channel"),o[r].error=t,e.splice(r,1);continue}if("audio"===a&&(!s.hasAudio||void 0===s._audioSSRC)||"video"===a&&(!s.hasVideo||void 0===s._videoSSRC)){const t=new eD($N.REMOTE_USER_IS_NOT_PUBLISHED);cD.error("[".concat(this._clientId,"] can not subscribe ").concat(s.uid," with mediaType ").concat(a,", remote user is not published")),DD("error",this,"subscribe",s.uid,"mediaType ".concat(a,", remote user is not published")),o[r].error=t,e.splice(r,1);continue}const c=dP.Video|dP.LwoVideo,d=i.get(s);if(d){if("video"===a?d&c:d&dP.Audio){e.splice(r,1),cD.warning("repeat massSubscribe user:".concat(s.uid,", mediaType:").concat(a," twice"));continue}i.set(s,d|("video"===a?c:dP.Audio))}else i.set(s,"video"===a?c:dP.Audio)}for(let t=e.length-1;t>=0;t--){const r=e[t],{user:n,mediaType:o}=r,s=dP.Video|dP.LwoVideo;if(this._p2pChannel.hasRemoteMedia(n,o)){await this._p2pChannel.unmuteRemoteNoLock(n,o);const r=i.get(n);i.set(n,"video"===o?r^s:r^dP.Audio),e.splice(t,1)}}this.store.massSubscribe(e.map(e=>({userId:e.user.uid,type:e.mediaType})),r);const c=vh(a=Array.from(i.entries())).call(a,(e,t)=>{let[r,i]=t;if(0===i)return e;const n={stream_id:r.uid,stream_type:i};return i&dP.Audio&&(n.audio_ssrc=r._audioSSRC),i&dP.Video&&(n.video_ssrc=r._videoSSRC),e.push(n),e},[]);try{e.length>0&&await this._p2pChannel.massSubscribeNoLock(e.map(e=>{let{user:t,mediaType:r}=e;return{user:t,mediaType:r,ssrcId:r===yP.VIDEO?t._videoSSRC:t._audioSSRC,rtxSsrcId:t._rtxSsrcId}}));const i=new Map;if(c.length>0){const e=await this._gateway.subscribeAll(c,!0);((null==e?void 0:e.users)||[]).forEach(e=>{let{stream_id:t,video_error_code:r,audio_error_code:n,error_code:o}=e;(r||n||o)&&i.set(t,{video_error_code:r,audio_error_code:n,error_code:o})})}if(Array.from(i.entries()).length>0){const e=Array.from(i.entries()).map(e=>{let t,[r,i]=e;i.error_code||i.video_error_code&&i.audio_error_code?t=void 0:i.video_error_code?t=yP.VIDEO:i.audio_error_code&&(t=yP.AUDIO);return{user:this.remoteUsers.find(e=>e.uid===r),mediaType:t}});await this._p2pChannel.massUnsubscribeNoLock(e)}for(const e of o){const t=i.get(e.user.uid);if(t){const r=t.error_code||"audio"===e.mediaType&&t.audio_error_code||"video"===e.mediaType&&t.video_error_code;if(r){const t=UW(r);cD.error("user:".concat(e.user.uid," mediaType:").concat(e.mediaType," has massSubscribe error ").concat(t.desc)),e.error=new eD($N.SUBSCRIBE_FAILED,"code ".concat(r,": ").concat(t.desc))}}e.error||("video"===e.mediaType?e.track=e.user.videoTrack:e.track=e.user.audioTrack)}return this.store.massSubscribe(o.filter(e=>!e.error).map(e=>({userId:e.user.uid,type:e.mediaType})),void 0,performance.now()),o.forEach(e=>{var t;wV.subscribe(this.store.sessionId,{succ:!!e.error,ec:(null===(t=e.error)||void 0===t?void 0:t.code)||null,video:e.mediaType===yP.VIDEO,audio:e.mediaType===yP.AUDIO,peerid:e.user.uid,subscribeRequestid:e.mediaType===yP.VIDEO?e.user._videoSSRC:e.user._audioSSRC,p2pid:this.store.p2pId,eventElapse:Math.floor(performance.now()-r)},!0)}),t.onSuccess(),cD.info("[".concat(this._clientId,"] massSubscribe success ").concat(e.map(e=>{let{user:t,mediaType:r}=e;return"user: ".concat(null==t?void 0:t.uid,", mediaType: ").concat(r)}).join("; "))),DD("info",this,"massSubscribe",e,"success"),o}catch(r){throw await this._p2pChannel.massUnsubscribeNoLock(e),t.onError(r),r}}finally{s(),n()}}async unsubscribe(e,t){if(t&&zL(t,"mediaType",["audio","video"]),!this._joinInfo)throw new eD($N.INVALID_OPERATION,"Can't unsubscribe stream, haven't joined yet!");const r=wV.reportApiInvoke(this._sessionId,{name:gk.UNSUBSCRIBE,options:[e.uid,t],tag:fk.TRACER});if(!this._users.find(t=>t===e)){const i=new eD($N.INVALID_REMOTE_USER,"user is not in the channel");throw cD.error("[".concat(this._clientId,"] can not subscribe ").concat(e.uid,", user is not in the channel")),DD("error",this,"unsubscribe",{uid:e.uid,mediaType:t},"user is not in the channel"),r.onError(i),i}cD.info("[".concat(this._clientId,"] unsubscribe uid: ").concat(e.uid,", mediaType: ").concat(t)),DD("info",this,"unsubscribe",{uid:e.uid,mediaType:t});try{const i=await this._p2pChannel.unsubscribe(e,t);i&&await this._gateway.unsubscribe(i,e.uid),cD.info("[".concat(this._clientId,"] unsubscribe success uid: ").concat(e.uid,", mediaType: ").concat(t)),DD("info",this,"unsubscribe",{uid:e.uid,mediaType:t},"success"),r.onSuccess()}catch(i){if(i.code===$N.DISCONNECT_P2P)return cD.warning("disconnecting p2p, abort unsubscribe request."),void r.onSuccess();throw cD.error("[".concat(this._clientId,"] unsubscribe user ").concat(e.uid," error"),i.toString()),DD("error",this,"unsubscribe",{uid:e.uid,mediaType:t},i.toString()),r.onError(i),i}}async massUnsubscribe(e){$L(e,"unsubscribeList");const t=wV.reportApiInvoke(this._sessionId,{name:gk.UNSUBSCRIBE,options:e.map(e=>{let{user:t,mediaType:r}=e;return{uid:null==t?void 0:t.uid,mediaType:r}}),tag:fk.TRACER});if(!this._joinInfo){const e=new eD($N.INVALID_OPERATION,"Can't unsubscribeAll stream, haven't joined yet!");throw t.onError(e),e}cD.info("[".concat(this._clientId,"] start massUnsubscribe ").concat(e.map(e=>{let{user:t,mediaType:r}=e;return"user: ".concat(null==t?void 0:t.uid,", mediaType: ").concat(r,";")}).join())),DD("info",this,"massUnsubscribe",e),e=[...e];const r=new Map;for(let i=e.length-1;i>=0;i--){const{user:n,mediaType:o}=e[i];if(!n){const e=new eD($N.INVALID_PARAMS,"user property does not exist in unsubscribeList item");throw cD.error("[".concat(this._clientId,"] user property does not exist in unsubscribeList item")),t.onError(e),e}zL(o,"mediaType",["video","audio",void 0]);if(!this._users.find(e=>e===n)){cD.warning("[".concat(this._clientId,"] can not subscribe ").concat(n.uid,", user is not in the channel")),DD("error",this,"unsubscribe",{uid:n.uid,mediaType:o},"user is not in the channel"),e.splice(i,1);continue}const s=dP.Video|dP.LwoVideo;if(r.has(n)){const t=r.get(n);let a;switch(o){case"video":a=t&s;break;case"audio":a=t&dP.Audio;break;default:a=t&(dP.Audio|s)}if(a){cD.warning("repeat massUnsubscribe user:".concat(n.uid,",mediaType:").concat(o," twice.")),e.splice(i,1);continue}o?"audio"===o?r.set(n,t|dP.Audio):"video"===o&&r.set(n,t|s):r.set(n,t|dP.Audio|s)}else o?"audio"===o?r.set(n,dP.Audio):"video"===o&&r.set(n,s):r.set(n,dP.Audio|s)}try{const r=await this._p2pChannel.massUnsubscribe(e);r&&await this._gateway.massUnsubscribe(r),cD.info("[".concat(this._clientId,"] massUnsubscribe success ").concat(e.map(e=>{let{user:t,mediaType:r}=e;return"user: ".concat(null==t?void 0:t.uid,", mediaType: ").concat(r,";")}).join())),DD("info",this,"massUnsubscribe",e,"success"),t.onSuccess()}catch(r){if(r.code===$N.DISCONNECT_P2P)return cD.warning("disconnecting p2p, abort unsubscribe request."),void t.onSuccess();throw cD.error("[".concat(this._clientId,"] massUnsubscribe error"),r.toString()),DD("error",this,"massUnsubscribe",e,r.toString()),t.onError(r),r}}setLowStreamParameter(e){!function(e){if(!e)throw new eD($N.INVALID_PARAMS);rk(e.width)||XL(e.width,"streamParameter.width"),rk(e.height)||XL(e.height,"streamParameter.height"),rk(e.framerate)||XL(e.framerate,"streamParameter.framerate"),rk(e.bitrate)||XL(e.bitrate,"streamParameter.bitrate")}(e);const t=wV.reportApiInvoke(this._sessionId,{name:gk.SET_LOW_STREAM_PARAMETER,options:[e],tag:fk.TRACER});(!e.width&&e.height||e.width&&!e.height)&&(cD.warning("[".concat(this._clientId,"] The width and height parameters take effect only when both are set")),RD("warning",this,"The width and height parameters take effect only when both are set")),cD.info("[".concat(this._clientId,"] set low stream parameter to"),JSON.stringify(e)),DD("info",this,"setLowStreamParameter",e);const r=this._configDistribute.getLowStreamConfigDistribute();r&&r.bitrate&&e.bitrate&&r.bitrate<e.bitrate&&(e.bitrate=r.bitrate),this._lowStreamParameter=e,t.onSuccess()}async enableDualStream(){const e=wV.reportApiInvoke(this._sessionId,{name:gk.ENABLE_DUAL_STREAM,options:[],tag:fk.TRACER});if(!BP().supportDualStream){wV.streamSwitch(this._sessionId,{lts:Date.now(),isdual:!0,succ:!1});const t=new eD($N.NOT_SUPPORTED,"Your browser is not support dual stream");throw e.onError(t),t}if(this._isDualStreamEnabled){const t=new eD($N.INVALID_OPERATION,"Dual stream is already enabled");throw e.onError(t),t}if(this._p2pChannel.canPublishLowStream())try{await this._publishLowStream()}catch(t){throw wV.streamSwitch(this._sessionId,{lts:Date.now(),isdual:!0,succ:!1}),e.onError(t),t}this._isDualStreamEnabled=!0,wV.streamSwitch(this._sessionId,{lts:Date.now(),isdual:!0,succ:!0}),cD.info("[".concat(this._clientId,"] enable dual stream")),DD("info",this,"enableDualStream"),e.onSuccess()}async disableDualStream(){if(!this._isDualStreamEnabled)return;if(!this._joinInfo)throw new eD($N.INVALID_OPERATION,"Can't publish stream, haven't joined yet!");const e=wV.reportApiInvoke(this._sessionId,{name:gk.DISABLE_DUAL_STREAM,options:[],tag:fk.TRACER});if(this._p2pChannel.getLocalMedia(RP.LocalVideoLowTrack))try{const e=await this._p2pChannel.unpublishLowStream();e&&await this._gateway.unpublish(e,this._joinInfo.stringUid||this._joinInfo.uid)}catch(t){throw wV.streamSwitch(this._sessionId,{lts:Date.now(),isdual:!1,succ:!1}),e.onError(t),t}this._isDualStreamEnabled=!1,wV.streamSwitch(this._sessionId,{lts:Date.now(),isdual:!1,succ:!0}),cD.info("[".concat(this._clientId,"] disable dual stream")),DD("info",this,"disableDualStream"),e.onSuccess()}async setClientRole(e,t){!function(e){zL(e,"role",["audience","host"])}(e),t&&xk(t);const r=wV.reportApiInvoke(this._sessionId,{name:gk.SET_CLIENT_ROLE,options:[e,t],tag:fk.TRACER});if("rtc"===this._mode){cD.warning("[".concat(this._clientId,"]rtc mode can not use setClientRole")),DD("warning",this,"setClientRole",e,"rtc mode can not use setClientRole");const t=new eD($N.INVALID_OPERATION,"rtc mode can not use setClientRole");return r.onError(t),t.throw()}if(t&&t.level&&"host"===e){const e=new eD($N.INVALID_OPERATION,"host mode can not set audience latency level");return r.onError(e),e.throw()}try{if("audience"===e&&this._p2pChannel.hasLocalMedia()){const e=new eD($N.INVALID_OPERATION,"can not set client role to audience when publishing stream");return r.onError(e),e.throw()}await this._gateway.setClientRole(e,t),cD.info("[".concat(this._clientId,"] set client role to ").concat(e,", level: ").concat(t&&t.level)),DD("info",this,"setClientRole",{role:e,level:t&&t.level}),r.onSuccess()}catch(e){throw r.onError(e),e}}setProxyServer(e,t){if(ZL(e,"proxyServer"),!t){if("DISCONNECTED"!==this.connectionState)throw new eD($N.INVALID_OPERATION,"Set proxy server before join channel");if("disabled"!==this._cloudProxyServerMode||this._useLocalAccessPoint)throw new eD($N.INVALID_OPERATION,"You have already set the proxy")}this._proxyServer=e,wV.setProxyServer(this._proxyServer),cD.setProxyServer(this._proxyServer),yD(this._proxyServer),cD.info("[".concat(this._clientId,"] Set proxy server ").concat(t?"by initialize call":""," success.")),DD("info",this,"setProxyServer",[...arguments],"success")}setTurnServer(e,t){if(Array.isArray(e)||(e=[e]),!t){if("DISCONNECTED"!==this.connectionState)throw new eD($N.INVALID_OPERATION,"Set turn server before join channel");if("disabled"!==this._cloudProxyServerMode||this._useLocalAccessPoint)throw new eD($N.INVALID_OPERATION,"You have already set the proxy")}if(Uk(e))return this._turnServer={servers:e,mode:"original-manual"},cD.info("[".concat(this._clientId,"] Set original turnserver ").concat(t?"by initialize call":""," success: ").concat(e.map(e=>e.urls).join(","),".")),void DD("info",this,"setOriginalTurnServer",[...arguments],"success");e.forEach(e=>Qk(e)),this._turnServer={servers:e,mode:"manual"},cD.info("[".concat(this._clientId,"] Set turnserver ").concat(t?"by initialize call":""," success.")),DD("info",this,"setTurnServer",[...arguments],"success")}startProxyServer(e){const t=wV.reportApiInvoke(this._sessionId,{name:gk.START_PROXY_SERVER,options:[],tag:fk.TRACER});if("DISCONNECTED"!==this.connectionState){const e=new eD($N.INVALID_OPERATION,"Start proxy server before join channel");throw t.onError(e),e}if(this._proxyServer||"manual"===this._turnServer.mode||this._useLocalAccessPoint){const e=new eD($N.INVALID_OPERATION,"You have already set the proxy");throw t.onError(e),e}const r=[1,2,3,4,5];switch(void 0===e&&(e=1),e){case 1:this._cloudProxyServerMode="normal";break;case 2:this._cloudProxyServerMode="443only";break;case 3:this._cloudProxyServerMode="proxy3";break;case 4:this._cloudProxyServerMode="proxy4";break;case 5:this._cloudProxyServerMode="proxy5";break;default:{const e=new eD($N.INVALID_PARAMS,"proxy server mode must be ".concat(r.join("|")));throw t.onError(e),e}}cD.info("[".concat(this._clientId,"] set cloud proxy server mode to"),this._cloudProxyServerMode),DD("info",this,"startProxyServer",this._cloudProxyServerMode),t.onSuccess()}stopProxyServer(){const e=wV.reportApiInvoke(this._sessionId,{name:gk.STOP_PROXY_SERVER,options:[],tag:fk.TRACER});if("DISCONNECTED"!==this.connectionState)throw new eD($N.INVALID_OPERATION,"Stop proxy server after leave channel");wV.setProxyServer(),cD.setProxyServer(),yD(),this._cloudProxyServerMode="disabled",cD.info("[".concat(this._clientId,"] set cloud proxy server mode to"),this._cloudProxyServerMode),DD("info",this,"stopProxyServer",this._cloudProxyServerMode),this._proxyServer=void 0,this._turnServer={mode:"auto",servers:[]},e.onSuccess()}setLocalAccessPoints(e,t){if($L(e,"serverList"),ZL(t,"domain"),this._proxyServer||"disabled"!==this._cloudProxyServerMode)throw new eD($N.INVALID_OPERATION,"set local access point failed, You have already set the cloud proxy");const r=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/;e=e.map(e=>r.test(e)?"".concat(e.replace(/\./g,"-"),".").concat(t):e),this._useLocalAccessPoint=!0,YD("WEBCS_DOMAIN",e),YD("WEBCS_DOMAIN_BACKUP_LIST",e),YD("GATEWAY_DOMAINS",[t]),YD("EVENT_REPORT_DOMAIN",e[0]),YD("EVENT_REPORT_BACKUP_DOMAIN",e[1]||e[0]),YD("LOG_UPLOAD_SERVER","".concat(e[0],":6444")),cD.info("set local access point success"),DD("info",this,"setLocalAccessPoints")}async setRemoteDefaultVideoStreamType(e){if(zL(e,"streamType",[0,1]),this._remoteDefaultVideoStreamType=e,this._joinInfo)try{await this._gateway.setDefaultRemoteVideoStreamType(e),this._joinInfo.defaultVideoStream=this._remoteDefaultVideoStreamType}catch(e){throw cD.error("[".concat(this._clientId,"] set default remote video stream type error"),e.toString()),e}else cD.debug("haven't joined yet, cache remoteDefaultVideoStreamType ".concat(e))}async setRemoteVideoStreamType(e,t){zL(t,"streamType",[0,1]);const r=wV.reportApiInvoke(this._sessionId,{name:gk.SET_REMOTE_VIDEO_STREAM_TYPE,options:[e,t],tag:fk.TRACER});try{await this._gateway.setRemoteVideoStreamType(e,t),setTimeout(()=>{const t=this._users.find(t=>t.uid===e);t&&t.videoTrack&&t.videoTrack.updateMediaStreamTrackResolution()},2e3)}catch(e){throw r.onError(e),cD.error("[".concat(this._clientId,"] set remote video stream type error"),e.toString()),DD("error",this,"setRemoteVideoStreamType",void 0,e.toString()),e}cD.info("[".concat(this._clientId,"] set remote ").concat(e," video stream type to ").concat(t)),DD("info",this,"setRemoteVideoStreamType",{uid:e,streamType:t}),this._remoteStreamTypeCacheMap.set(e,t),r.onSuccess()}async setStreamFallbackOption(e,t){zL(t,"fallbackType",[0,1,2]);const r=wV.reportApiInvoke(this._sessionId,{name:gk.SET_STREAM_FALLBACK_OPTION,options:["too long to show",t],tag:fk.TRACER});try{await this._gateway.setStreamFallbackOption(e,t)}catch(e){throw r.onError(e),cD.error("[".concat(this._clientId,"] set stream fallback option"),e.toString()),DD("error",this,"setStreamFallbackOption",void 0,e.toString()),e}cD.info("[".concat(this._clientId,"] set remote ").concat(e," stream fallback type to ").concat(t)),DD("info",this,"setStreamFallbackOption",{uid:e,fallbackType:t}),this._streamFallbackTypeCacheMap.set(e,t),r.onSuccess()}setEncryptionConfig(e,t,r){!function(e){zL(e,"encryptionMode",["aes-128-xts","aes-256-xts","aes-128-ecb","sm4-128-ecb","aes-128-gcm","aes-256-gcm","aes-128-gcm2","aes-256-gcm2","none"])}(e),ZL(t,"secret");if(["aes-128-gcm2","aes-256-gcm2"].includes(e)){if(!r||!(r instanceof Uint8Array&&32===r.length))throw new eD($N.INVALID_PARAMS,"salt must be an Uint8Array and exactly equal to 32 bytes")}else if(r)throw new eD($N.INVALID_PARAMS,"current encrypt mode does not need salt");new RegExp("^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!@#$%^&*,.<>?/:;'\"|{}\\[\\]])(?=.{8,})").test(t)||(cD.warning("The secret is not strong:\n The secret must contain at least 1 lowercase alphabetical character,\n The secret must contain at least 1 uppercase alphabetical character,\n The secret must contain at least 1 numeric character,\n The secret must contain at least one special character,\n The secret must be eight characters or longer.\n "),RD("warning",this,"The secret is not strong:\n The secret must contain at least 1 lowercase alphabetical character,\n The secret must contain at least 1 uppercase alphabetical character,\n The secret must contain at least 1 numeric character,\n The secret must contain at least one special character,\n The secret must be eight characters or longer.\n ")),this._encryptionMode=e,this._encryptionSecret=t,r&&(this._encryptionSalt=QG(r))}async renewToken(e){ZL(e,"token",1,2047);const t=wV.reportApiInvoke(this._sessionId,{name:gk.RENEW_TOKEN,options:[e],tag:fk.TRACER});if(!this._key||!this._joinInfo){const e=new eD($N.INVALID_OPERATION,"renewToken should not be called before user join");return t.onError(e),e.throw()}const r=this._key;this._key=e,this._joinInfo&&(this._joinInfo.token=e);const i=await this._renewTokenMutex.lock();try{if(WD("USE_NEW_TOKEN")){cD.debug("start renew token with ticket from unilbs"),DD("debug",this,"renewToken","unilbs");const t=await PJ(this._joinInfo,this._axiosCancelSource.token,this._config.httpRetryConfig||tD);cD.debug("[".concat(this._clientId,"] get ticket from unilbs success")),DD("debug",this,"renewToken","unilbs","success"),await this._gateway.renewToken({token:e,ticket:t})}else cD.debug("start renew token without ticket"),DD("debug",this,"renewToken"),await this._gateway.renewToken({token:e});cD.debug("[".concat(this._clientId,"] renewToken success")),DD("debug",this,"renewToken",void 0,"success"),t.onSuccess()}catch(e){throw this._key=r,this._joinInfo.token=r,t.onError(e),cD.error("[".concat(this._clientId,"] renewToken failed"),e.toString()),DD("error",this,"renewToken",void 0,e.toString()),e}finally{i()}}enableAudioVolumeIndicator(){const e=wV.reportApiInvoke(this._sessionId,{name:gk.ENABLE_AUDIO_VOLUME_INDICATOR,options:[],tag:fk.TRACER});if(this._audioVolumeIndicationInterval)return cD.warning("you have already enabled audio volume indicator!"),DD("warning",this,"enableAudioVolumeIndicator","you have already enabled audio volume indicator!"),e.onSuccess();this._audioVolumeIndicationInterval=window.setInterval(()=>{const e=this._p2pChannel.getAudioLevels();this.emit(Tk.VOLUME_INDICATOR,e)},WD("AUDIO_VOLUME_INDICATION_INTERVAL")||2e3),e.onSuccess()}getRTCStats(){const e=this._statsCollector.getRTCStats(),t=this._gateway.getInChannelInfo();return e.Duration=Math.round(t.duration/1e3),e}startLiveStreaming(e,t){const r=wV.reportApiInvoke(this._sessionId,{name:gk.START_LIVE_STREAMING,options:[e,t],tag:fk.TRACER});if(!t){if("h264"!==this._codec){const e=new eD($N.LIVE_STREAMING_INVALID_RAW_STREAM,"raw streaming is only support h264");return r.onError(e),ny.reject(e)}if(!this._p2pChannel.hasLocalMedia()){const e=new eD($N.LIVE_STREAMING_INVALID_RAW_STREAM,"can not find stream to raw streaming");return r.onError(e),ny.reject(e)}}if(this._liveRawStreamingClient&&this._liveRawStreamingClient.hasUrl(e)||this._liveTranscodeStreamingClient&&this._liveTranscodeStreamingClient.hasUrl(e)){const e=new eD($N.LIVE_STREAMING_TASK_CONFLICT);return r.onError(e),ny.reject(e)}const i=t?Yk.TRANSCODE:Yk.RAW;return this._createLiveStreamingClient(i).startLiveStreamingTask(e,i).then(()=>r.onSuccess()).catch(e=>{throw r.onError(e),e})}setLiveTranscoding(e){const t=wV.reportApiInvoke(this._sessionId,{name:gk.SET_LIVE_TRANSCODING,options:[e],tag:fk.TRACER});return this._createLiveStreamingClient(Yk.TRANSCODE).setTranscodingConfig(e).then(()=>t.onSuccess()).catch(e=>{throw t.onError(e),e})}stopLiveStreaming(e){const t=wV.reportApiInvoke(this._sessionId,{name:gk.STOP_LIVE_STREAMING,options:[e],tag:fk.TRACER}),r=[this._liveRawStreamingClient,this._liveTranscodeStreamingClient].filter(t=>t&&t.hasUrl(e));if(!r.length){const e=new eD($N.INVALID_PARAMS,"can not find live streaming url to stop");return t.onError(e),ny.reject(e)}return ny.all(r.map(t=>t&&t.stopLiveStreamingTask(e))).then(()=>t.onSuccess()).catch(e=>{throw t.onError(e),e})}async addInjectStreamUrl(e,t){const r=wV.reportApiInvoke(this._sessionId,{name:gk.ADD_INJECT_STREAM_URL,options:[e,t],tag:fk.TRACER});try{if(!this._joinInfo)throw new eD($N.INVALID_OPERATION,"can not addInjectStreamUrl, no joininfo");const r=this._createLiveStreamingClient(Yk.INJECT);r.setInjectStreamConfig(t,0),await r.startLiveStreamingTask(e,Yk.INJECT)}catch(e){throw r.onError(e),e}r.onSuccess()}async removeInjectStreamUrl(){const e=wV.reportApiInvoke(this._sessionId,{name:gk.REMOVE_INJECT_STREAM_URL,options:[],tag:fk.TRACER});try{var t;const e=this._createLiveStreamingClient(Yk.INJECT),r=Array.from(iV(t=e.streamingTasks).call(t)).find(e=>e.mode===Yk.INJECT);if(!this._joinInfo||!r)throw new eD($N.INVALID_OPERATION,"can remove addInjectStreamUrl, no joininfo or inject task");await e.stopLiveStreamingTask(r.url)}catch(t){throw e.onError(t),t}e.onSuccess()}async startChannelMediaRelay(e){const t=wV.reportApiInvoke(this._sessionId,{name:gk.START_CHANNEL_MEDIA_RELAY,options:[e],tag:fk.TRACER});try{YJ(e);const t=this._createChannelMediaRelayClient();await t.startChannelMediaRelay(e)}catch(e){return t.onError(e),e.throw()}t.onSuccess()}async updateChannelMediaRelay(e){const t=wV.reportApiInvoke(this._sessionId,{name:gk.UPDATE_CHANNEL_MEDIA_RELAY,options:[e],tag:fk.TRACER});try{YJ(e);const t=this._createChannelMediaRelayClient();await t.updateChannelMediaRelay(e)}catch(e){return t.onError(e),e.throw()}t.onSuccess()}async stopChannelMediaRelay(){const e=wV.reportApiInvoke(this._sessionId,{name:gk.STOP_CHANNEL_MEDIA_RELAY,options:[],tag:fk.TRACER});try{const e=this._createChannelMediaRelayClient();await e.stopChannelMediaRelay()}catch(t){return e.onError(t),t.throw()}e.onSuccess()}sendStreamMessage(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this._joinInfo)throw new eD($N.INVALID_OPERATION,"can not send data stream, not joined");if("string"==typeof e){e=(new TextEncoder).encode(e)}if(new Blob([e]).size>1024)throw new eD($N.INVALID_PARAMS,"stream message out of range.");return this._gateway.signal.request(Nk.DATA_STREAM,{payload:QG(e)},!t)}sendMetadata(e){if(!this._joinInfo)throw new eD($N.INVALID_OPERATION,"can not send metadata, not joined");if(new Blob([e]).size>1024)throw new eD($N.METADATA_OUT_OF_RANGE);return this._gateway.signal.request(Nk.SEND_METADATA,{session_id:this._joinInfo.sid,metadata:QG(e)})}async sendCustomReportMessage(e){Array.isArray(e)||(e=[e]),e.forEach(uk);const t=wV.reportApiInvoke(this._sessionId,{name:gk.SEND_CUSTOM_REPORT_MESSAGE,options:[JSON.stringify(e)],tag:fk.TRACER});if(!this._joinInfo){const e=new eD($N.INVALID_OPERATION,"can not send custom report, not joined");return t.onError(e),e.throw()}await wV.sendCustomReportMessage(this._joinInfo.sid,e),t.onSuccess()}getLocalAudioStats(){return this._statsCollector.getLocalAudioTrackStats()}getRemoteAudioStats(){return this._statsCollector.getRemoteAudioTrackStats()}getLocalVideoStats(){return this._statsCollector.getLocalVideoTrackStats()}getRemoteVideoStats(){return this._statsCollector.getRemoteVideoTrackStats()}getRemoteNetworkQuality(){return this._statsCollector.getRemoteNetworkQualityStats()}async pickSVCLayer(e,t){zL(t.spatialLayer,"spatialLayer",[0,1,2,3]),zL(t.temporalLayer,"temporalLayer",[0,1,2,3]);try{await this._gateway.pickSVCLayer(e,t)}catch(e){throw cD.error("[".concat(this._clientId,"] pick SVC layer failed"),e.toString()),OD("error",this,"pickSVCLayer",t,e.toString()),e}}_reset(){cD.debug("[".concat(this._clientId,"] reset client")),OD("debug",this,"_reset"),this._axiosCancelSource.cancel(),this._axiosCancelSource=qN.CancelToken.source(),this._streamFallbackTypeCacheMap=new Map,this._remoteStreamTypeCacheMap=new Map,this._configDistribute.stopGetConfigDistribute(),this._joinInfo=void 0,this._proxyServer=void 0,this._defaultStreamFallbackType=void 0,this._sessionId=null,this.store.sessionId=null,this._statsCollector.reset(),this._key=void 0,this._appId=void 0,this._uid=void 0,this.store.uid=void 0,this._channelName=void 0,this._encryptionMode="none",this._encryptionSecret=null,this._encryptionSalt=null,this._users.forEach(e=>{e._audioTrack&&e._audioTrack._destroy(),e._videoTrack&&e._videoTrack._destroy()}),this._users=[],this._audioVolumeIndicationInterval&&(window.clearInterval(this._audioVolumeIndicationInterval),this._audioVolumeIndicationInterval=void 0),"fallback"===this._cloudProxyServerMode&&(this._cloudProxyServerMode="disabled"),this._p2pChannel.reset(),this._publishMutex=new kV("client-publish"),this._subscribeMutex=new kV("client-subscribe"),this._networkQualityInterval&&(window.clearInterval(this._networkQualityInterval),this._networkQualityInterval=void 0),this._injectStreamingClient&&(this._injectStreamingClient.terminate(),this._injectStreamingClient.removeAllListeners(),this._injectStreamingClient=void 0),this._liveRawStreamingClient&&(this._liveRawStreamingClient.terminate(),this._liveRawStreamingClient.removeAllListeners(),this._liveRawStreamingClient=void 0),this._liveTranscodeStreamingClient&&(this._liveTranscodeStreamingClient.terminate(),this._liveTranscodeStreamingClient.removeAllListeners(),this._liveTranscodeStreamingClient=void 0),this._channelMediaRelayClient&&(this._channelMediaRelayClient.dispose(),this._channelMediaRelayClient=void 0)}_startSession(e,t){const r=e||SG();e?cD.debug("[".concat(this._clientId,"] new Session ").concat(r)):cD.debug("[".concat(this._clientId,"] renewSession ").concat(this._sessionId," => ").concat(r)),OD("debug",this,"_startSession",{newSid:r,sid:this._sessionId}),this._sessionId=r,this.store.sessionId=r,t?wV.sessionInit(this._sessionId,{lts:(new Date).getTime(),cname:t.channel,appid:t.appId,mode:this._mode}):this._joinInfo?wV.sessionInit(this._sessionId,{lts:(new Date).getTime(),cname:this._joinInfo.cname,appid:this._joinInfo.appId,mode:this._mode}):this._gateway.joinInfo&&wV.sessionInit(this._sessionId,{lts:(new Date).getTime(),cname:this._gateway.joinInfo.cname,appid:this._gateway.joinInfo.appId,mode:this._mode}),this._joinInfo&&(this._joinInfo.sid=r),this._gateway.joinInfo&&(this._gateway.joinInfo.sid=r)}async _publishHighStream(e){if(!this._joinInfo||void 0===this._uid)throw new eD($N.INVALID_OPERATION,"Can't publish stream, haven't joined yet!");if("CONNECTED"!==this.connectionState&&"RECONNECTING"!==this.connectionState)throw new eD($N.INVALID_OPERATION,"can not publish stream in ".concat(this.connectionState," state"));if("auto"===this._turnServer.mode&&WD("FORCE_TURN")&&!WD("TURN_ENABLE_TCP")&&!WD("TURN_ENABLE_UDP"))throw new eD($N.UNEXPECTED_ERROR,"force TURN With No TURN Configuration");cD.debug("[".concat(this._clientId,"] publish high stream")),OD("debug",this,"_publishHighStream");try{const r=await this._p2pChannel.publish(e,this._isDualStreamEnabled,this._lowStreamParameter),i=(await r.next()).value;if(i){var t;let e;try{e=await this._gateway.publish(this._uid,i,!0)}catch(e){if(e.code!==$N.DISCONNECT_P2P)throw r.throw(e),e}await r.next((null===(t=e)||void 0===t?void 0:t.ortc)||[])}this._p2pChannel.reportPublishEvent(!0,null);for(const t of e)t instanceof Zq&&t._encoderConfig&&this._gateway.setVideoProfile(t._encoderConfig),!t.muted&&t.enabled||await this._p2pChannel.muteLocalTrack(t)}catch(t){if(this._p2pChannel.reportPublishEvent(!1,null==t?void 0:t.code,e),(null==t?void 0:t.code)===$N.WS_ABORT)return;throw t}}async _publishLowStream(){if(!this._joinInfo||void 0===this._uid)throw new eD($N.INVALID_OPERATION,"Can't publish stream, haven't joined yet!");if("CONNECTED"!==this.connectionState&&"RECONNECTING"!==this.connectionState)throw new eD($N.INVALID_OPERATION,"can not publish stream in ".concat(this.connectionState," state"));cD.debug("[".concat(this._clientId,"] publish low stream")),OD("debug",this,"_publishLowStream");const e=this._configDistribute.getLowStreamConfigDistribute();e&&e.bitrate&&(this._lowStreamParameter||(this._lowStreamParameter={width:160,height:120,framerate:15,bitrate:50}),this._lowStreamParameter&&this._lowStreamParameter.bitrate&&e.bitrate<this._lowStreamParameter.bitrate&&(this._lowStreamParameter.bitrate=e.bitrate));try{const e=await this._p2pChannel.publishLowStream(this._lowStreamParameter),r=(await e.next()).value;if(r){var t;let i;try{i=await this._gateway.publish(this._uid,r,!0)}catch(t){if(t.code!==$N.DISCONNECT_P2P)throw e.throw(t),t}e.next((null===(t=i)||void 0===t?void 0:t.ortc)||[]),this._p2pChannel.reportPublishEvent(!0,null,void 0,!0)}}catch(e){if(this._p2pChannel.reportPublishEvent(!1,null==e?void 0:e.code,void 0,!0),(null==e?void 0:e.code)===$N.WS_ABORT)return;throw e}}_createLiveStreamingClient(e){if(!this._joinInfo||!this._appId){return new eD($N.INVALID_OPERATION,"can not create live streaming client, please join channel first").throw()}const t=()=>new KJ(this._joinInfo,this._config.websocketRetryConfig||tD,this._config.httpRetryConfig||tD),r=e=>{e.onLiveStreamError=(e,t)=>{wV.reportApiInvoke(this._sessionId,{name:gk.ON_LIVE_STREAM_ERROR,options:[e,t],tag:fk.TRACER}).onSuccess(),this.emit(Tk.LIVE_STREAMING_ERROR,e,t)},e.onLiveStreamWarning=(e,t)=>{wV.reportApiInvoke(this._sessionId,{name:gk.ON_LIVE_STREAM_WARNING,options:[e,t],tag:fk.TRACER}).onSuccess(),this.emit(Tk.LIVE_STREAMING_WARNING,e,t)},e.on(eP.REQUEST_WORKER_MANAGER_LIST,(e,t,r)=>{if(!this._joinInfo)return r(new eD($N.INVALID_OPERATION,"can not find join info to get worker manager"));LJ(e,this._joinInfo,this._axiosCancelSource.token,tD).then(t).catch(r)})};switch(e){case Yk.RAW:return this._liveRawStreamingClient||(this._liveRawStreamingClient=t(),r(this._liveRawStreamingClient)),this._liveRawStreamingClient;case Yk.TRANSCODE:return this._liveTranscodeStreamingClient||(this._liveTranscodeStreamingClient=t(),r(this._liveTranscodeStreamingClient)),this._liveTranscodeStreamingClient;case Yk.INJECT:return this._injectStreamingClient||(this._injectStreamingClient=t(),this._injectStreamingClient.on(eP.REQUEST_WORKER_MANAGER_LIST,(e,t,r)=>{if(!this._joinInfo)return r(new eD($N.INVALID_OPERATION,"can not find join info to get worker manager"));LJ(e,this._joinInfo,this._axiosCancelSource.token,tD).then(t).catch(r)}),this._injectStreamingClient.onInjectStatusChange=(e,t,r)=>{this.emit(Tk.INJECT_STREAM_STATUS,e,t,r)}),this._injectStreamingClient}}_createChannelMediaRelayClient(){if(!this._joinInfo){return new eD($N.INVALID_OPERATION,"can not create channel media relay client, please join channel first").throw()}return this._channelMediaRelayClient||(this._channelMediaRelayClient=new JJ(this._joinInfo,this._clientId,this._config.websocketRetryConfig||tD,this._config.httpRetryConfig||tD),this._channelMediaRelayClient.on("state",e=>{e===oP.RELAY_STATE_FAILURE&&this._channelMediaRelayClient&&this._channelMediaRelayClient.dispose(),this.emit(Tk.CHANNEL_MEDIA_RELAY_STATE,e)}),this._channelMediaRelayClient.on("event",e=>{this.emit(Tk.CHANNEL_MEDIA_RELAY_EVENT,e)})),this._channelMediaRelayClient}_handleGatewayEvents(){this._gateway.on(cP.DISCONNECT_P2P,async()=>{await this._p2pChannel.disconnectForReconnect()}),this._gateway.on(cP.CONNECTION_STATE_CHANGE,(e,t,r)=>{var i;if(r===Rk.FALLBACK)return;const n=()=>{this.emit(Tk.CONNECTION_STATE_CHANGE,e,t,r)};if(wV.reportApiInvoke(this._sessionId||(null===(i=this._gateway.joinInfo)||void 0===i?void 0:i.sid)||null,{name:gk.CONNECTION_STATE_CHANGE,options:[e,t,r],tag:fk.TRACER}).onSuccess(JSON.stringify({cur:e,prev:t,reason:r})),cD.info("[".concat(this._clientId,"] connection state change: ").concat(t," -> ").concat(e)),TD("info",this,"connection-state-change","".concat(t," -> ").concat(e)),"DISCONNECTED"===e)return this._reset(),void n();if("RECONNECTING"===e)this._users.forEach(e=>{e._trust_in_room_=!1,e._trust_audio_enabled_state_=!1,e._trust_video_enabled_state_=!1,e._trust_audio_mute_state_=!1,e._trust_video_mute_state_=!1,e._trust_stream_added_state_=!1}),this._userOfflineTimeout&&window.clearTimeout(this._userOfflineTimeout),this._streamRemovedTimeout&&window.clearTimeout(this._streamRemovedTimeout),this._userOfflineTimeout=void 0,this._streamRemovedTimeout=void 0;else if("CONNECTED"===e){var o;this._streamFallbackTypeCacheMap.forEach((e,t)=>{this._gateway.setStreamFallbackOption(t,e).catch(e=>{cD.warning("[".concat(this._clientId,"] auto set stream fallback option failed"),e),RD("warning",this,"auto set stream fallback option failed, ".concat(e.toString()))})}),this._remoteStreamTypeCacheMap.forEach((e,t)=>{this._gateway.setRemoteVideoStreamType(t,e).catch(e=>{cD.warning("[".concat(this._clientId,"] auto set remote stream type failed"),e),RD("warning",this,"auto set remote stream type failed, ".concat(e.toString()))})}),void 0!==this._remoteDefaultVideoStreamType&&void 0===(null===(o=this._joinInfo)||void 0===o?void 0:o.defaultVideoStream)&&this.setRemoteDefaultVideoStreamType(this._remoteDefaultVideoStreamType).then(()=>{cD.debug("[".concat(this._clientId,"] setRemoteDefaultVideoStreamType after gateway connected"))}).catch(e=>{cD.error("[".concat(this._clientId,"] setRemoteDefaultVideoStreamType after gateway failed, ").concat(e))}),this._p2pChannel.republish(),this._userOfflineTimeout=window.setTimeout(()=>{if("CONNECTED"!==this.connectionState)return;this._userOfflineTimeout=void 0;this._users.filter(e=>!e._trust_in_room_).forEach(e=>{cD.debug("[".concat(this._clientId,"] user offline timeout, emit user offline ").concat(e.uid)),RD("debug",this,"user offline timeout, emit user offline ".concat(e.uid)),this._handleUserOffline({uid:e.uid})})},3e3),this._streamRemovedTimeout=window.setTimeout(()=>{"CONNECTED"===this.connectionState&&(this._streamRemovedTimeout=void 0,this._users.forEach(e=>{e._trust_audio_mute_state_||(cD.debug("[".concat(this._clientId,"] auto dispatch audio unmute event ").concat(e.uid)),RD("debug",this,"auto dispatch audio unmute event ".concat(e.uid)),this._handleMuteStream(e.uid,"audio",!1)),e._trust_video_mute_state_||(cD.debug("[".concat(this._clientId,"] auto dispatch video unmute event ").concat(e.uid)),RD("debug",this,"auto dispatch video unmute event ".concat(e.uid)),this._handleMuteStream(e.uid,"video",!1)),e._trust_audio_enabled_state_||(cD.debug("[".concat(this._clientId,"] auto dispatch enable local audio ").concat(e.uid)),RD("debug",this,"auto dispatch enable local audio ".concat(e.uid)),this._handleSetStreamLocalEnable("audio",e.uid,!0)),!e._trust_video_enabled_state_&&e._video_enabled_&&(cD.debug("[".concat(this._clientId,"] auto dispatch enable local video ").concat(e.uid)),RD("debug",this,"auto dispatch enable local video ".concat(e.uid)),this._handleSetStreamLocalEnable("video",e.uid,!0)),e._trust_stream_added_state_||(cD.debug("[".concat(this._clientId,"] auto dispatch stream remove ").concat(e.uid)),RD("debug",this,"auto dispatch stream remove ".concat(e.uid)),this._handleRemoveStream({uid:e.uid,uint_id:e._uintid}))}))},1e3)}n()}),this._gateway.on(cP.REQUEST_NEW_GATEWAY_LIST,(e,t)=>{if(!this._joinInfo)return t(new eD($N.UNEXPECTED_ERROR,"can not recover, no join info"));TJ(this._joinInfo,this._axiosCancelSource.token,this._config.httpRetryConfig||tD).then(t=>{this._joinInfo&&(this._joinInfo.apResponse=t.gatewayInfo.res,this._joinInfo.gatewayAddrs=t.gatewayInfo.gatewayAddrs,this._joinInfo.uni_lbs_ip=t.gatewayInfo.uni_lbs_ip),e(t.gatewayInfo.gatewayAddrs.map(e=>{if(this._joinInfo&&this._joinInfo.proxyServer){const t=e.address.split(":");return"wss://".concat(this._joinInfo.proxyServer,"/ws/?h=").concat(t[0],"&p=").concat(t[1])}return"wss://".concat(e.address)}))}).catch(t)}),this._gateway.on(cP.NETWORK_QUALITY,e=>{"normal"===this._networkQualitySensitivity&&this.emit(Tk.NETWORK_QUALITY,e)}),this._gateway.on(cP.STREAM_TYPE_CHANGE,(e,t)=>{this.emit(Tk.STREAM_TYPE_CHANGED,e,t);wV.reportApiInvoke(this._sessionId,{name:gk.STREAM_TYPE_CHANGE,options:[e,t],tag:fk.TRACER}).onSuccess(JSON.stringify({uid:e,streamType:t}))}),this._gateway.on(cP.IS_P2P_DISCONNECTED,e=>{this._p2pChannel.isP2PDisconnected()?e(!0):this._p2pChannel.hasLocalMedia()||this._p2pChannel.hasRemoteMedia()?e(!1):e(!0)}),this._gateway.on(cP.NEED_RENEW_SESSION,()=>{this._startSession()}),this._gateway.on(cP.REQUEST_P2P_CONNECTION_PARAMS,async(e,t,r)=>{try{t(await this._p2pChannel.startP2PConnection(e))}catch(e){r(e)}}),this._gateway.on(cP.JOIN_RESPONSE,(e,t,r)=>{const{dtlsParameters:i,iceParameters:n,candidates:o,rtpCapabilities:s,setup:a,cname:c}=QZ(e.ortc,t,r);this._p2pChannel.connect(n,i,o,s,a,c)}),this._gateway.signal.on(Lk.ON_USER_ONLINE,this._handleUserOnline),this._gateway.signal.on(Lk.ON_USER_OFFLINE,this._handleUserOffline),this._gateway.signal.on(Lk.ON_ADD_AUDIO_STREAM,e=>this._handleAddAudioOrVideoStream("audio",e.uid,e.ssrcId,e.cname,e.uint_id,e.ortc)),this._gateway.signal.on(Lk.ON_ADD_VIDEO_STREAM,e=>this._handleAddAudioOrVideoStream("video",e.uid,e.ssrcId,e.cname,e.uint_id,e.ortc,e.rtxSsrcId)),this._gateway.signal.on(Lk.ON_REMOVE_STREAM,this._handleRemoveStream),this._gateway.signal.on(Lk.ON_P2P_LOST,this._handleP2PLost),this._gateway.signal.on(Lk.MUTE_AUDIO,e=>(TD("debug",["AgoraRTCGateway",this._clientId],"mute_audio",{uid:e.uid}),this._handleMuteStream(e.uid,"audio",!0))),this._gateway.signal.on(Lk.UNMUTE_AUDIO,e=>(TD("debug",["AgoraRTCGateway",this._clientId],"unmute_audio",{uid:e.uid}),this._handleMuteStream(e.uid,"audio",!1))),this._gateway.signal.on(Lk.MUTE_VIDEO,e=>(TD("debug",["AgoraRTCGateway",this._clientId],"mute_video",{uid:e.uid}),this._handleMuteStream(e.uid,"video",!0))),this._gateway.signal.on(Lk.UNMUTE_VIDEO,e=>(TD("debug",["AgoraRTCGateway",this._clientId],"unmute_video",{uid:e.uid}),this._handleMuteStream(e.uid,"video",!1))),this._gateway.signal.on(Lk.RECEIVE_METADATA,e=>{const t=UG(e.metadata);this.emit(Tk.RECEIVE_METADATA,e.uid,t)}),this._gateway.signal.on(Lk.ON_DATA_STREAM,e=>{e.seq&&delete e.seq,e.payload=UG(e.payload),this.emit(Tk.STREAM_MESSAGE,e.uid,e.payload),this.onStreamMessage&&this.onStreamMessage(e)}),this._gateway.signal.on(Lk.ON_CRYPT_ERROR,()=>{MG(()=>{cD.warning("[".concat(this._clientId,"] on crypt error")),TD("warning",this,"crypt_error"),this.emit(Tk.CRYPT_ERROR)},this._sessionId)}),this._gateway.signal.on(Lk.ON_TOKEN_PRIVILEGE_WILL_EXPIRE,this._handleTokenWillExpire),this._gateway.signal.on(Lk.ON_TOKEN_PRIVILEGE_DID_EXPIRE,()=>{cD.warning("[".concat(this._clientId,"] received message onTokenPrivilegeDidExpire, please get new token and join again")),TD("warning",this,"token_privilege_did_expire"),this._gateway.leave(!0),this.emit(Tk.ON_TOKEN_PRIVILEGE_DID_EXPIRE),this._reset()}),this._gateway.signal.on(Lk.ON_STREAM_FALLBACK_UPDATE,e=>{cD.debug("[".concat(this._clientId,"] stream fallback peerId: ").concat(e.stream_id,", attr: ").concat(e.stream_type)),TD("debug",this,"stream_fallback_update",{peerId:e.stream_id,attr:e.stream_type}),this.emit(Tk.STREAM_FALLBACK,e.stream_id,1===e.stream_type?"fallback":"recover")}),this._gateway.signal.on(Lk.ON_PUBLISH_STREAM,e=>{this.uid===this._uid&&(this._p2pChannel.reportPublishEvent(!0,null,void 0,!1,JSON.stringify({proxy:e.proxy})),cD.info("[".concat(this._clientId,"] on publish stream, ").concat(JSON.stringify(e))),TD("info",this,"publish_stream",e))}),this._gateway.signal.on(Lk.ENABLE_LOCAL_VIDEO,e=>{this._handleSetStreamLocalEnable("video",e.uid,!0)}),this._gateway.signal.on(Lk.DISABLE_LOCAL_VIDEO,e=>{this._handleSetStreamLocalEnable("video",e.uid,!1)}),this._gateway.signal.on(Ok.REQUEST_TIMEOUT,(e,t)=>{if(this._joinInfo)switch(e){case Nk.PUBLISH:{if(!t)return;const e=(t=t).ortc;if(e){var r,i,n,o;const s=e.some(e=>{let{stream_type:t}=e;return t===aP.Audio}),a=e.some(e=>{let{stream_type:t}=e;return t!==aP.Audio}),c=e.some(e=>{let{stream_type:t}=e;return t===aP.Screen||t===aP.ScreenLow});"offer"===t.state&&wV.publish(this._joinInfo.sid,{eventElapse:Zj.measureFromPublishStart(this.store.clientId,this.store.pubId),succ:!1,ec:$N.TIMEOUT,audio:s,video:a,p2pid:t.p2p_id,publishRequestid:this.store.pubId,screenshare:c,audioName:s?null===(r=e.find(e=>{let{stream_type:t}=e;return t===aP.Audio}))||void 0===r||null===(i=r.ssrcs[0])||void 0===i?void 0:i.ssrcId.toString():void 0,videoName:a?null===(n=e.find(e=>{let{stream_type:t}=e;return t!==aP.Audio}))||void 0===n||null===(o=n.ssrcs[0])||void 0===o?void 0:o.ssrcId.toString():void 0})}break}case Nk.SUBSCRIBE:(t=t)&&wV.subscribe(this._joinInfo.sid,{succ:!1,ec:$N.TIMEOUT,audio:t.stream_type===yP.AUDIO,video:t.stream_type===yP.VIDEO,peerid:t.stream_id,subscribeRequestid:t.ssrcId,p2pid:this.store.p2pId,eventElapse:Zj.measureFromSubscribeStart(this.store.clientId,t.ssrcId)})}}),this._gateway.signal.on(Lk.ON_P2P_OK,e=>{this.uid,this._uid}),this._gateway.signal.on(Lk.ON_PUBLISHED_USER_LIST,e=>{if(null==e||!e.users)return;const t=[],r=[];for(const i of e.users){let e=this._users.find(e=>e.uid===i.stream_id);e?e._trust_in_room_=!0:(e=new rz(i.stream_id,i.stream_id),this._users.push(e),0===this.getListeners(Tk.PUBLISHED_USER_LIST).length&&(cD.debug("[".concat(this._clientId,"] user online"),i.stream_id),wD("info",this,"user-joined",{uid:i.stream_id}),this.emit(Tk.USER_JOINED,e)));const n=dP.Audio&i.stream_type,o=(dP.Video|dP.LwoVideo)&i.stream_type,s=n&&e.hasAudio,a=o&&e.hasVideo;i.stream_type!==dP.Nothing&&(e._trust_stream_added_state_=!0),o&&(e._video_added_=!0,e._videoSSRC=i.video_ssrc),n&&(e._audio_added_=!0,e._audioSSRC=i.audio_ssrc),n&&!s&&0===this.getListeners(Tk.PUBLISHED_USER_LIST).length&&(cD.info("[".concat(this._clientId,"] remote user ").concat(e.uid," published audio")),RD("info",this,"remote user ".concat(e.uid," published audio")),this.emit(Tk.USER_PUBLISHED,e,"audio")),o&&!a&&0===this.getListeners(Tk.PUBLISHED_USER_LIST).length&&(cD.info("[".concat(this._clientId,"] remote user ").concat(e.uid," published video")),RD("info",this,"remote user ".concat(e.uid," published video")),this.emit(Tk.USER_PUBLISHED,e,"video")),(n&&!s||o&&!a)&&t.push(e),o&&this._p2pChannel.hasPendingRemoteMedia(e,"video")&&r.push({user:e,mediaType:"video"}),n&&this._p2pChannel.hasPendingRemoteMedia(e,"audio")&&r.push({user:e,mediaType:"audio"})}r.length>0&&(cD.debug("[".concat(this._clientId,"] RE massSubscribe after reconnect ").concat(r.map(e=>"user: ".concat(e.user.uid,", mediaType: ").concat(e.mediaType)).join("; ")," ")),this.massSubscribe(r).catch(e=>{cD.error("[".concat(this._clientId,"] mass resubscribe error"),e.toString())})),this.getListeners(Tk.PUBLISHED_USER_LIST).length>0?(cD.info("[".concat(this._clientId,"] client emit user-list event, users: ").concat(t.map(e=>e.uid).join(", "))),this.emit(Tk.PUBLISHED_USER_LIST,t)):cD.info("[".concat(this._clientId,"] client not emit user-list event case there is no user-list listener, users: ").concat(t.map(e=>e.uid).join(", ")))})}_handleP2PChannelEvents(){this._p2pChannel.on(wP.RequestMuteLocal,async(e,t,r)=>{if(this._joinInfo)try{await this._gateway.muteLocal(e,this._joinInfo.stringUid||this._joinInfo.uid),t()}catch(e){e.code===$N.DISCONNECT_P2P?t():r(e)}else t()}),this._p2pChannel.on(wP.RequestUnmuteLocal,async(e,t,r)=>{if(this._joinInfo)try{await this._gateway.unmuteLocal(e,this._joinInfo.stringUid||this._joinInfo.uid),t()}catch(e){e.code===$N.DISCONNECT_P2P?t():r(e)}else t()}),this._p2pChannel.on(wP.RequestRePublish,(e,t,r)=>{this.publish(e,!1).then(t).catch(r)}),this._p2pChannel.on(wP.RequestReSubscribe,async(e,t,r)=>{try{for(const{user:t,kind:r}of e)r===yP.VIDEO?await this.subscribe(t,"video"):await this.subscribe(t,"audio");t()}catch(e){r(e)}}),this._p2pChannel.on(wP.RequestUploadStats,(e,t)=>{this._gateway.uploadStats(e,t)}),this._p2pChannel.on(wP.MediaReconnectStart,e=>{this.emit(Tk.MEDIA_RECONNECT_START,e)}),this._p2pChannel.on(wP.MediaReconnectEnd,e=>{this.emit(Tk.MEDIA_RECONNECT_END,e)}),this._p2pChannel.on(wP.NeedSignalRTT,e=>{e(this._gateway.getSignalRTT())}),this._p2pChannel.on(wP.RequestRestartICE,async()=>{const e=await this._p2pChannel.reEstablish();if(e){const{restartICEResponse:t,gatewayIP:r,gatewayPort:i}=await this._gateway.restartICE({iceParameters:e.iceParameters}),{candidates:n,iceParameters:o}=function(e,t,r){const i=e.ice;let n;return void 0!==t&&void 0!==r?(n=[{foundation:"udpcandidate",componentId:"1",transport:"udp",priority:"2103266323",connectionAddress:t,port:r.toString(),type:"host",extension:{}}],cD.debug("Using remote candidate from AP ".concat(t,":").concat(r)),RD("debug",[],"Using remote candidate from AP ".concat(t,":").concat(r))):n=i.candidates.map(e=>({foundation:e.foundation,componentId:"1",transport:e.protocol,priority:e.priority.toString(),connectionAddress:e.ip,port:e.port.toString(),type:e.type,extension:{}})),{candidates:n,iceParameters:{iceUfrag:i.iceUfrag,icePwd:i.icePwd}}}(t,r,i);await e.restartICE(o,n)}}),this._p2pChannel.on(wP.RequestReconnect,async()=>{this._gateway.reconnect()}),this._p2pChannel.on(wP.RequestReconnectPC,async()=>{var e;const{iceParameters:t,dtlsParameters:r,rtpCapabilities:i}=await this._p2pChannel.startP2PConnection({turnServer:null===(e=this._joinInfo)||void 0===e?void 0:e.turnServer}),{gatewayEstablishParams:n,gatewayIP:o,gatewayPort:s}=await this._gateway.reconnectPC({iceParameters:t,dtlsParameters:r,rtpCapabilities:i}),{dtlsParameters:a,iceParameters:c,candidates:d,rtpCapabilities:u,setup:A,cname:h}=QZ(n,o,s);await this._p2pChannel.connect(c,a,d,u,A,h),await this._p2pChannel.republish(),await this._p2pChannel.reSubscribe()}),this._p2pChannel.on(wP.RequestUnpublishForReconnectPC,async(e,t,r)=>{this._joinInfo&&void 0!==this._uid?(await this._gateway.unpublish(e,this._uid),t()):r()}),this._p2pChannel.on(wP.P2PLost,()=>{this.emit(Tk.P2P_LOST,this.store.uid)}),this._p2pChannel.on(wP.UpdateVideoEncoder,e=>{e._encoderConfig&&this._gateway.setVideoProfile(e._encoderConfig)}),this._p2pChannel.on(wP.ConnectionTypeChange,e=>{this.emit(Tk.IS_USING_CLOUD_PROXY,e)})}getKeyMetrics(){return this.store.keyMetrics}}).prototype,"setProxyServer",[u1],Object.getOwnPropertyDescriptor(E1.prototype,"setProxyServer"),E1.prototype),qF(E1.prototype,"setTurnServer",[A1],Object.getOwnPropertyDescriptor(E1.prototype,"setTurnServer"),E1.prototype),qF(E1.prototype,"setLocalAccessPoints",[h1],Object.getOwnPropertyDescriptor(E1.prototype,"setLocalAccessPoints"),E1.prototype),qF(E1.prototype,"setRemoteDefaultVideoStreamType",[l1],Object.getOwnPropertyDescriptor(E1.prototype,"setRemoteDefaultVideoStreamType"),E1.prototype),qF(E1.prototype,"setEncryptionConfig",[p1],Object.getOwnPropertyDescriptor(E1.prototype,"setEncryptionConfig"),E1.prototype),qF(E1.prototype,"pickSVCLayer",[g1],Object.getOwnPropertyDescriptor(E1.prototype,"pickSVCLayer"),E1.prototype),f1=E1))||f1);class C1 extends JV{set currentState(e){e!==this._currentState&&(this._currentState=e,this.emit(Pk.AUDIO_SOURCE_STATE_CHANGE,this._currentState))}get currentState(){return this._currentState}constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),kO(this,"audioBuffer",void 0),kO(this,"sourceNode",void 0),kO(this,"startPlayTime",0),kO(this,"startPlayOffset",0),kO(this,"pausePlayTime",0),kO(this,"options",void 0),kO(this,"currentLoopCount",0),kO(this,"_currentState","stopped"),this.audioBuffer=e,this.options=t,this.startPlayOffset=this.options.startPlayTime||0}createWebAudioDiagram(){return this.context.createGain()}get duration(){return this.audioBuffer.duration}get currentTime(){return"stopped"===this.currentState?0:"paused"===this.currentState?this.pausePlayTime:(this.context.currentTime-this.startPlayTime+this.startPlayOffset)%this.audioBuffer.duration}updateOptions(e){"stopped"===this.currentState?(this.options=e,this.startPlayOffset=this.options.startPlayTime||0):cD.warning("can not set audio source options")}startProcessAudioBuffer(){this.sourceNode&&this.stopProcessAudioBuffer(),this.sourceNode=this.createSourceNode(),this.startSourceNode(),this.currentState="playing"}pauseProcessAudioBuffer(){this.sourceNode&&"playing"===this.currentState&&(this.pausePlayTime=this.currentTime,this.sourceNode.onended=null,this.sourceNode.stop(),this.sourceNode.buffer=null,this.sourceNode=this.createSourceNode(),this.currentState="paused")}seekAudioBuffer(e){this.sourceNode&&(this.sourceNode.onended=null,"playing"===this.currentState&&this.sourceNode.stop(),this.sourceNode=this.createSourceNode(),"playing"===this.currentState?(this.startPlayOffset=e,this.startSourceNode()):"paused"===this.currentState&&(this.pausePlayTime=e))}resumeProcessAudioBuffer(){"paused"===this.currentState&&this.sourceNode&&(this.startPlayOffset=this.pausePlayTime,this.pausePlayTime=0,this.startSourceNode(),this.currentState="playing")}stopProcessAudioBuffer(){if(this.sourceNode){this.sourceNode.onended=null;try{this.sourceNode.stop()}catch(e){}this.reset()}}startSourceNode(){this.sourceNode&&this.sourceNode.buffer&&(this.sourceNode.start(0,this.startPlayOffset),this.startPlayTime=this.context.currentTime,this.sourceNode.onended=this.handleSourceNodeEnded.bind(this))}createSourceNode(){const e=this.context.createBufferSource();return e.buffer=this.audioBuffer,e.loop=!!this.options.loop,e.connect(this.outputNode),e}handleSourceNodeEnded(){if(this.currentLoopCount+=1,this.options.cycle&&this.options.cycle>this.currentLoopCount)return this.startPlayOffset=0,this.sourceNode=void 0,void this.startProcessAudioBuffer();this.reset()}reset(){this.startPlayOffset=this.options.startPlayTime||0,this.currentState="stopped",this.sourceNode&&(this.sourceNode.disconnect(),this.sourceNode=void 0),this.currentLoopCount=0}}const v1=new Map;async function S1(e,t){let r=null;if("string"==typeof e){const t=v1.get(e);if(t)return cD.debug("use cached audio resource: ",e),t;try{r=(await iD(()=>qN.get(e,{responseType:"arraybuffer"}),void 0,void 0,{maxRetryCount:3})).data}catch(e){throw new eD($N.FETCH_AUDIO_FILE_FAILED,e.toString())}}else{const t=new ny((t,r)=>{const i=new FileReader;i.onload=e=>{e.target?t(e.target.result):r(new eD($N.READ_LOCAL_AUDIO_FILE_ERROR))},i.onerror=()=>{r(new eD($N.READ_LOCAL_AUDIO_FILE_ERROR))},i.readAsArrayBuffer(e)});r=await t}const i=await function(e){const t=jV();return new ny((r,i)=>{t.decodeAudioData(e,e=>{r(e)},e=>{i(new eD($N.DECODE_AUDIO_FILE_FAILED,e.toString()))})})}(r);return"string"==typeof e&&t&&v1.set(e,i),i}function y1(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function R1(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?y1(Object(r),!0).forEach((function(t){kO(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):y1(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function T1(e,t,r,i){r.optimizationMode&&(i&&i.width&&i.height?(r.encoderConfig=R1(R1({},i),{},{bitrateMin:i.bitrateMin,bitrateMax:i.bitrateMax}),"motion"!==r.optimizationMode&&"detail"!==r.optimizationMode||(t.contentHint=r.optimizationMode,t.contentHint===r.optimizationMode?(cD.debug("[".concat(e,"] set content hint to"),r.optimizationMode),DD("debug",["AgoraRTC"],"videoTrackOptimizationModeProcess",[e,r,i])):(cD.debug("[".concat(e,"] set content hint failed")),DD("warning",["AgoraRTC"],"videoTrackOptimizationModeProcess",[e,r,i],"failed")))):(cD.warning("[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig")),RD("warning",["AgoraRTC"],"[".concat(e,"] can not apply optimization mode bitrate config, no encoderConfig"))))}const w1=oO().name;function b1(e,t,r,i){let n,o=0,s=null;return new ny((a,c)=>{setTimeout(()=>{n&&(n(),a(o))},t),n=HV(()=>{!function(){o>i&&n&&(n(),a(o));const t=r.getContext("2d");if(!t){const e=new eD($N.UNEXPECTED_ERROR,"can not get canvas 2d context.");return cD.error(e.toString()),void c(e)}t.drawImage(e,0,0,160,120);const d=t.getImageData(0,0,r.width,r.height),u=Math.floor(d.data.length/3);if(s){for(let e=0;e<u;e+=3)if(d.data[e]!==s[e])return o+=1,void(s=d.data);s=d.data}else s=d.data}()},30)})}class O1{constructor(e,t){kO(this,"id",0),kO(this,"element",void 0),kO(this,"peerPair",void 0),kO(this,"context",void 0),kO(this,"audioPlayerElement",void 0),kO(this,"audioTrack",void 0),O1.count+=1,this.id=O1.count,this.element=e,this.context=t}initPeers(){this.peerPair=[new RTCPeerConnection,new RTCPeerConnection],this.peerPair[1].ontrack=e=>{const t=document.createElement("audio");t.srcObject=new MediaStream([e.track]),t.play(),this.audioPlayerElement=t}}async switchSdp(){if(!this.peerPair)return;const e=async(e,t)=>{const r="offer"===t?await e.createOffer():await e.createAnswer();return await e.setLocalDescription(r),"complete"===e.iceGatheringState?e.localDescription:new ny(t=>{e.onicegatheringstatechange=()=>{"complete"===e.iceGatheringState&&t(e.localDescription)}})},t=async(e,t)=>await e.setRemoteDescription(t);try{const r=await e(this.peerPair[0],"offer");await t(this.peerPair[1],r);const i=await e(this.peerPair[1],"answer");await t(this.peerPair[0],i)}catch(e){throw new eD($N.LOCAL_AEC_ERROR,e.toString()).print()}}async getTracksFromMediaElement(e){if(this.audioTrack)return this.audioTrack;let t;try{e instanceof HTMLVideoElement&&(e.captureStream?e.captureStream():e.mozCaptureStream()),t=this.context.createMediaStreamDestination();this.context.createMediaElementSource(e).connect(t)}catch(e){throw new eD($N.LOCAL_AEC_ERROR,e.toString()).print()}if(!t){throw new eD($N.LOCAL_AEC_ERROR,"no dest node when local aec").print()}const r=t.stream.getAudioTracks()[0];return this.audioTrack=r,r}getElement(){return this.element}async startEchoCancellation(){this.context.resume(),this.peerPair&&this.close(),this.initPeers();const e=this.element,t=await this.getTracksFromMediaElement(e);this.peerPair&&this.peerPair[0].addTrack(t),await this.switchSdp()}close(){cD.debug("close echo cancellation unit, id is",this.id),this.audioPlayerElement&&this.audioPlayerElement.pause(),this.peerPair&&this.peerPair.forEach(e=>{e.close()}),this.peerPair=void 0,this.audioPlayerElement=void 0}}var N1,D1;kO(O1,"count",0);const L1=window.AudioContext||window.webkitAudioContext;const k1=new(N1=RV({report:wV}),qF((D1=class{constructor(){kO(this,"units",[]),kO(this,"context",void 0)}processExternalMediaAEC(e){if(!this._doesEnvironmentNeedAEC())return cD.debug("the system does not need to process local aec"),-1;this.context||(this.context=new L1);let t=this.units.find(t=>t&&t.getElement()===e);return t||(t=new O1(e,this.context),this.units.push(t)),t.startEchoCancellation(),cD.debug("start processing local audio echo cancellation, id is",t.id),t.id}_doesEnvironmentNeedAEC(){return oO().name!==tO.SAFARI}}).prototype,"processExternalMediaAEC",[N1],Object.getOwnPropertyDescriptor(D1.prototype,"processExternalMediaAEC"),D1.prototype),D1);YD("PROCESS_ID","process-".concat(vG(8,""),"-").concat(vG(4,""),"-").concat(vG(4,""),"-").concat(vG(4,""),"-").concat(vG(12,""))),function(){const e=oO();PP.getDisplayMedia=function(e){if(navigator.mediaDevices&&navigator.mediaDevices.getDisplayMedia)return!0;return!1}(),PP.getStreamFromExtension=e.name===tO.CHROME&&Number(e.version)>34,PP.supportUnifiedPlan=function(){if(!window.RTCRtpTransceiver)return!1;if(!("currentDirection"in RTCRtpTransceiver.prototype))return!1;const e=new RTCPeerConnection;let t=!1;try{e.addTransceiver("audio"),t=!0}catch(e){}return e.close(),t}(),PP.supportMinBitrate=e.name===tO.CHROME||e.name===tO.EDGE,PP.supportSetRtpSenderParameters=function(){const e=oO();if(!window.RTCRtpSender||!window.RTCRtpSender.prototype.setParameters||!window.RTCRtpSender.prototype.getParameters)return!1;return!!yO()||(!(!pO()&&!uO())||e.name===tO.FIREFOX&&Number(e.version)>=64)}(),e.name===tO.SAFARI&&(Number(e.version)>=14?PP.supportDualStream=!0:PP.supportDualStream=!1),PP.webAudioMediaStreamDest=function(){const e=oO();if(e.name===tO.SAFARI&&Number(e.version)<12)return!1;return!0}(),PP.supportReplaceTrack=function(){if(!window.RTCRtpSender)return!1;if("function"==typeof RTCRtpSender.prototype.replaceTrack)return!0;return!1}(),PP.supportWebGL="undefined"!=typeof WebGLRenderingContext,PP.supportRequestFrame=!!window.CanvasCaptureMediaStreamTrack,yO()||(PP.webAudioWithAEC=!0),PP.supportShareAudio=function(){const e=oO();if((e.os===eO.WIN_10||e.os===eO.WIN_81||e.os===eO.WIN_7||e.os===eO.LINUX||e.os===eO.MAC_OS)&&e.name===tO.CHROME&&Number(e.version)>=74)return!0;return!1}(),PP.supportDualStreamEncoding=function(){const e=oO();return"Safari"===e.name&&Number(e.version)>=14}(),cD.info("browser compatibility",JSON.stringify(PP),JSON.stringify(e)),OD("info",[],"updateAgoraRTCCompatibility",{browserCompatibility:PP,browserInfo:e})}(),function(){let e;try{e=window.localStorage.getItem("websdk_ng_global_parameter")}catch(e){return void cD.error("Error loading sdk config",e.message)}if(e)try{const t=JSON.parse(window.atob(e)),r=Date.now();cD.debug("Loading global parameters from cache",t),OD("debug",[],"loadConfigFromLocalStorage",t),Object.keys(t).forEach(e=>{if(Object.prototype.hasOwnProperty.call(JD,e)){const{value:i,expires:n}=t[e];if(n&&n<=r)return;qD[e]=i,JD[e]=i}})}catch(t){cD.error("Error loading mutableParamsCache: ".concat(e),t.message)}}();const P1={__CLIENT_LIST__:tL,__TRACK_LIST__:rL,VERSION:BD,BUILD:PD,setParameter:YD,getParameter:WD,getSupportedCodec:async function(){let e={audio:[],video:[]};try{let t=new RTCPeerConnection;t.addTransceiver("video",{direction:"recvonly"}),t.addTransceiver("audio",{direction:"recvonly"});const r=(await t.createOffer()).sdp;if(!r)return e;t.close(),t=null,e=function(e){const t={video:[],audio:[]};return e.match(/ VP8/i)&&t.video.push("VP8"),e.match(/ VP9/i)&&t.video.push("VP9"),e.match(/ AV1/i)&&t.video.push("AV1"),e.match(/ H264/i)&&t.video.push("H264"),e.match(/ opus/i)&&t.audio.push("OPUS"),e.match(/ PCMU/i)&&t.audio.push("PCMU"),e.match(/ PCMA/i)&&t.audio.push("PCMA"),e.match(/ G722/i)&&t.audio.push("G722"),t}(r)}catch(e){throw new eD($N.CREATE_OFFER_FAILED,e.toString&&e.toString()).print()}return e},checkSystemRequirements:function(){const e=wV.reportApiInvoke(null,{name:gk.CHECK_SYSTEM_REQUIREMENTS,options:[],tag:fk.TRACER});let t=!1;try{const e=window.RTCPeerConnection,r=navigator.mediaDevices&&navigator.mediaDevices.getUserMedia,i=window.WebSocket;t=!!(e&&r&&i)}catch(e){return cD.error("check system requirement failed: ",e),!1}let r=!1;const i=oO();i.name===tO.CHROME&&Number(i.version)>=58&&(!hO()||AO())&&(r=!0),i.name===tO.FIREFOX&&Number(i.version)>=56&&(r=!0),i.name===tO.OPERA&&Number(i.version)>=45&&(r=!0),i.name===tO.SAFARI&&Number(i.version)>=11&&(r=!0),(vO()||oO().name===tO.QQ)&&(r=!0),cD.debug("checkSystemRequirements, api:",t,"browser",r);const n=t&&r;return e.onSuccess(n),n},getDevices:function(e){return cj.enumerateDevices(!0,!0,e)},getMicrophones:function(e){return cj.getRecordingDevices(e)},getCameras:function(e){return cj.getCamerasDevices(e)},getElectronScreenSources:ZV,getPlaybackDevices:function(e){return cj.getSpeakers(e)},createClient:function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{codec:"vp8",audioCodec:"opus",mode:"rtc"};const t=wV.reportApiInvoke(null,{name:gk.CREATE_CLIENT,options:[e],tag:fk.TRACER});try{Mk(e)}catch(e){throw t.onError(e),e}return void 0===e.audioCodec&&(e.audioCodec="opus"),t.onSuccess(),new _1(m1(m1({forceWaitGatewayResponse:!0},e),{},{role:"rtc"===e.mode?"host":e.role}))},createCameraVideoTrack:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{encoderConfig:"480p_1"};const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.CREATE_CAM_VIDEO_TRACK,options:[R1({},e)]}),r=Cq(e),i=vG(8,"track-cam-");let n=null;cD.info("start create camera video track with config",JSON.stringify(e),"trackId",i),DD("info",["AgoraRTC"],"createCameraVideoTrack",e);try{n=(await nj({video:r},i)).getVideoTracks()[0]||null}catch(e){throw t.onError(e),e}if(!n){const e=new eD($N.UNEXPECTED_ERROR,"can not find track in media stream");return t.onError(e),e.throw()}e.optimizationMode&&T1(i,n,e,e.encoderConfig&&VD(e.encoderConfig));const o=new $q(n,e,r,e.scalabiltyMode?GD(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,i);return t.onSuccess(o.getTrackId()),cD.info("create camera video success, trackId:",i),DD("info",["AgoraRTC"],"createCameraVideoTrack",void 0,i),o},createCustomVideoTrack:function(e){const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.CREATE_CUSTOM_VIDEO_TRACK,options:[e]}),r=new Zq(e.mediaStreamTrack,{bitrateMax:e.bitrateMax,bitrateMin:e.bitrateMin},e.scalabiltyMode?GD(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode);return t.onSuccess(r.getTrackId()),cD.info("create custom video track success with config",e,"trackId",r.getTrackId()),DD("info",["AgoraRTC"],"createCustomVideoTrack",e,r.getTrackId()),r},createScreenVideoTrack:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"disable";const r=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.CREATE_SCREEN_VIDEO_TRACK,options:[R1({},e),t]});e.encoderConfig?"string"==typeof e.encoderConfig||e.encoderConfig.width&&e.encoderConfig.height||(e.encoderConfig.width={max:1920},e.encoderConfig.height={max:1080}):e.encoderConfig="1080p_2";const i=vq(e),n=vG(8,"track-scr");let o=null,s=null;const a=BP();if(!a.supportShareAudio&&"enable"===t){const e=new eD($N.NOT_SUPPORTED,"your browser or platform is not support share-screen with audio");return r.onError(e),e.throw()}cD.info("start create screen video track with config",e,"withAudio",t,"trackId",n),DD("info",["AgoraRTC"],"createScreenVideoTrack",[e,t]);try{const e=await nj({screen:i,screenAudio:"auto"===t?a.supportShareAudio:"enable"===t},n);o=e.getVideoTracks()[0]||null,s=e.getAudioTracks()[0]||null}catch(e){throw r.onError(e),e}if(!o){const e=new eD($N.UNEXPECTED_ERROR,"can not find track in media stream");return r.onError(e),e.throw()}if(!s&&"enable"===t){o&&o.stop();const e=new eD($N.SHARE_AUDIO_NOT_ALLOWED);return r.onError(e),e.throw()}e.optimizationMode||(e.optimizationMode="detail"),e.optimizationMode&&(T1(n,o,e,e.encoderConfig&&jD(e.encoderConfig)),e.encoderConfig&&"string"!=typeof e.encoderConfig&&(e.encoderConfig.bitrateMin=e.encoderConfig.bitrateMax));const c=new Zq(o,e.encoderConfig?jD(e.encoderConfig):{},e.scalabiltyMode?GD(e.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},e.optimizationMode,n,[AP.SCREEN_TRACK]);if(!s)return r.onSuccess(c.getTrackId()),cD.info("create screen video track success","video:",c.getTrackId()),DD("info",["AgoraRTC"],"createScreenVideoTrack",void 0,{videoTrack:c.getTrackId()}),c;const d=new Kj(s);return r.onSuccess([c.getTrackId(),d.getTrackId()]),cD.info("create screen video track success","video:",c.getTrackId(),"audio:",d.getTrackId()),DD("info",["AgoraRTC"],"createScreenVideoTrack",void 0,{videoTrack:c.getTrackId(),audioTrack:d.getTrackId()}),[c,d]},createMicrophoneAndCameraTracks:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{encoderConfig:"480p_1"};const r=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.CREATE_MIC_AND_CAM_TRACKS,options:[e,t]}),i=Cq(t),n=Sq(e),o=vG(8,"track-mic-"),s=vG(8,"track-cam-");let a=null,c=null;cD.info("start create camera video track(".concat(s,") and microphone audio track(").concat(o,") with config, audio: ").concat(JSON.stringify(e),", video: ").concat(JSON.stringify(t))),DD("info",["AgoraRTC"],"createMicrophoneAndCameraTracks",{videoConfig:t,audioConfig:e});try{const e=await nj({audio:n,video:i},"".concat(o,"-").concat(s));a=e.getAudioTracks()[0],c=e.getVideoTracks()[0]}catch(e){throw r.onError(e),e}if(!a||!c){const e=new eD($N.UNEXPECTED_ERROR,"can not find tracks in media stream");return r.onError(e),e.throw()}t.optimizationMode&&T1(s,c,t,t.encoderConfig&&VD(t.encoderConfig));const d=new Hj(a,e,n,o),u=new $q(c,t,i,t.scalabiltyMode?GD(t.scalabiltyMode):{numSpatialLayers:1,numTemporalLayers:1},t.optimizationMode,s);return r.onSuccess([d.getTrackId(),u.getTrackId()]),cD.info("create camera video track(".concat(s,") and microphone audio track(").concat(o,") success")),DD("info",["AgoraRTC"],"createMicrophoneAndCameraTracks",void 0,{videoTrackId:s,audioTrackId:o}),[d,u]},createMicrophoneAudioTrack:async function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.CREATE_MIC_AUDIO_TRACK,options:[e]}),r=Sq(e),i=vG(8,"track-mic-");let n=null;cD.info("start create microphone audio track with config",JSON.stringify(e),"trackId",i),DD("info",["AgoraRTC"],"createMicrophoneAudioTrack",e);try{n=(await nj({audio:r},i)).getAudioTracks()[0]||null}catch(e){throw t.onError(e),e}if(!n){const e=new eD($N.UNEXPECTED_ERROR,"can not find track in media stream");return t.onError(e),e.throw()}const o=new Hj(n,e,r,i);return t.onSuccess(o.getTrackId()),cD.info("create microphone audio track success, trackId:",i),DD("info",["AgoraRTC"],"createMicrophoneAudioTrack",e,i),o},createCustomAudioTrack:function(e){const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.CREATE_CUSTOM_AUDIO_TRACK,options:[e]}),r=new Kj(e.mediaStreamTrack,e.encoderConfig?HD(e.encoderConfig):{});return cD.info("create custom audio track success with config",e,"trackId",r.getTrackId()),DD("info",["AgoraRTC"],"createCustomAudioTrack",e,r.getTrackId()),t.onSuccess(r.getTrackId()),r},createBufferSourceAudioTrack:async function(e){const t=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.CREATE_BUFFER_AUDIO_TRACK,options:[e]}),r=vG(8,"track-buf-");cD.info("start create buffer source audio track with config",JSON.stringify(e),"trackId",r),DD("info",[],"createBufferSourceAudioTrack",e);const i=e.source;if(!(e.source instanceof AudioBuffer))try{e.source=await S1(e.source,e.cacheOnlineFile)}catch(e){return t.onError(e),e.throw()}const n=new C1(e.source),o=new Yj(i,n,e.encoderConfig?HD(e.encoderConfig):{},r);return cD.info("create buffer source audio track success, trackId:",r),DD("info",["AgoraRTC"],"createBufferSourceAudioTrack",void 0,r),t.onSuccess(o.getTrackId()),o},setLogLevel:function(e){WD("USE_NEW_LOG")?function(e){e=Math.min(Math.max(0,e),4),gD=e}(e):cD.setLogLevel(e)},enableLogUpload:function(){WD("USE_NEW_LOG")?YD("UPLOAD_LOG",!0):cD.enableLogUpload()},disableLogUpload:function(){WD("USE_NEW_LOG")?YD("UPLOAD_LOG",!1):cD.disableLogUpload()},createChannelMediaRelayConfiguration:function(){return new HJ},checkAudioTrackIsActive:async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;const r=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.CHECK_AUDIO_TRACK_IS_ACTIVE,options:[t]});if(!(e instanceof Kj||e instanceof B$)){const e=new eD($N.INVALID_TRACK,"the parameter is not a audio track");return r.onError(e),e.throw()}t&&t<1e3&&(t=1e3);const i=e instanceof Kj?e.getTrackLabel():"remote_track",n=e.getVolumeLevel();let o=n,s=n;const a=Date.now();return new ny(n=>{const c=setInterval(()=>{const d=e.getVolumeLevel();o=d>o?d:o,s=d<s?d:s;const u=o-s>1e-4,A=Date.now()-a;if(u||A>t){clearInterval(c);const t=u,s={duration:A,deviceLabel:i,maxVolumeLevel:o,result:t};cD.info("[track-".concat(e.getTrackId(),"] check audio track active completed. ").concat(JSON.stringify(s))),r.onSuccess(s),n(t)}},200)})},checkVideoTrackIsActive:async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;const r=wV.reportApiInvoke(null,{tag:fk.TRACER,name:gk.CHECK_VIDEO_TRACK_IS_ACTIVE,options:[t]});if(!(e instanceof Zq||e instanceof P$)){const e=new eD($N.INVALID_TRACK,"the parameter is not a video track");return r.onError(e),e.throw()}const i=4;t&&t<1e3&&(t=1e3);const n=e instanceof Zq?e.getTrackLabel():"remote_track",o=e.getMediaStreamTrack(!0),s=document.createElement("video");s.style.width="1px",s.style.height="1px",s.setAttribute("muted",""),s.muted=!0,s.setAttribute("playsinline",""),s.controls=!1,(pO()||uO())&&(s.style.opacity="0.01",s.style.position="fixed",s.style.left="0",s.style.top="0",document.body.appendChild(s)),s.srcObject=new MediaStream([o]),s.play();const a=document.createElement("canvas");a.width=160,a.height=120;let c=0,d=0;try{const e=Date.now();c=await b1(s,t,a,i),d=Date.now()-e}catch(e){throw r.onError(e),e}w1===tO.SAFARI&&(s.pause(),s.remove()),s.srcObject=null;const u=c>i,A={duration:d,changedPicNum:c,deviceLabel:n,result:u};return cD.info("[track-".concat(e.getTrackId(),"] check video track active completed. ").concat(JSON.stringify(A))),r.onSuccess(A),u},setArea:function(e){const t=wV.reportApiInvoke(null,{name:gk.SET_AREA,options:e,tag:fk.TRACER});try{let t=[];if("string"==typeof e&&(t=[e]),Array.isArray(e)&&(e.forEach(e=>{if(!mP.includes(e))throw new eD($N.INVALID_PARAMS,"invalid area code")}),t=e),"[object Object]"===Object.prototype.toString.call(e)){const{areaCode:r,excludedArea:i}=e;if(!r)throw new eD($N.INVALID_PARAMS,"area code is needed");let n=r;"string"==typeof r&&(n=[r]),t=i?RJ(n,i):n}YD("AREAS",t);const r=(e=>{const t={CODE:"",WEBCS_DOMAIN:[],WEBCS_DOMAIN_BACKUP_LIST:[],PROXY_CS:[],CDS_AP:[],ACCOUNT_REGISTER:[],UAP_AP:[],EVENT_REPORT_DOMAIN:[],EVENT_REPORT_BACKUP_DOMAIN:[],LOG_UPLOAD_SERVER:[],PROXY_SERVER_TYPE3:[]};return e.map(e=>{const r=CP[e],i=Object.keys(r);i&&i.map(e=>{"CODE"!==e&&(t[e]=t[e].concat(r[e]))})}),t})(t);Object.keys(r).map(e=>{if("LOG_UPLOAD_SERVER"===e||"EVENT_REPORT_DOMAIN"===e||"EVENT_REPORT_BACKUP_DOMAIN"===e||"PROXY_SERVER_TYPE3"===e){YD(e,r[e][0])}else YD(e,r[e])}),cD.debug("set area success:",t.join(","))}catch(e){throw t.onError(e),e}t.onSuccess()},loadModule:async function(e,t){if(cD.debug("loadModule: ".concat(e.name,", loadOption: ").concat(JSON.stringify(t))),!e.moduleInit)throw cD.debug("Invalid Plugin"),new eD($N.INVALID_PLUGIN,"invalid plugin");try{UV.installPlugin(e),await e.moduleInit({logger:cD,report:wV,pluginCenter:UV,getParameter:WD},t)}catch(e){throw new eD($N.UNEXPECTED_ERROR,"unexpected error in loadModule",e)}},audioElementPlayCenter:hj,processExternalMediaAEC:function(e){k1.processExternalMediaAEC(e)},registerExtensions:function(e){e.forEach(e=>{const t=e;t.__registered__=!0,t.logger.hookLog=cD.extLog,t.reporter.hookApiInvoke=wV.extApiInvoke,t.parameters&&Object.keys(t.parameters).forEach(e=>{t.parameters[e]=WD(e)})})},ChannelMediaRelayError:sP,ChannelMediaRelayEvent:nP,ChannelMediaRelayState:oP,RemoteStreamFallbackType:lP,RemoteStreamType:hP,ConnectionDisconnectedReason:Rk,AudienceLatencyLevelType:yk,AREAS:fP};return Object.defineProperties(P1,{onAudioAutoplayFailed:{get:()=>_V.onAudioAutoplayFailed,set:e=>{_V.onAudioAutoplayFailed=e}},onAutoplayFailed:{get:()=>_V.onAutoplayFailed,set:e=>{_V.onAutoplayFailed=e}}}),cj.on(Ik.CAMERA_DEVICE_CHANGED,e=>{cD.info("camera device changed",JSON.stringify(e)),P1.onCameraChanged&&P1.onCameraChanged(e)}),cj.on(Ik.RECORDING_DEVICE_CHANGED,e=>{cD.info("microphone device changed",JSON.stringify(e)),P1.onMicrophoneChanged&&P1.onMicrophoneChanged(e)}),cj.on(Ik.PLAYOUT_DEVICE_CHANGED,e=>{cD.debug("playout device changed",JSON.stringify(e)),P1.onPlaybackDeviceChanged&&P1.onPlaybackDeviceChanged(e)}),hj.onAutoplayFailed=()=>{cD.info("detect audio element autoplay failed"),_V.onAudioAutoplayFailed&&_V.onAudioAutoplayFailed()},FV.on("autoplay-failed",()=>{cD.info("detect webaudio autoplay failed"),_V.onAudioAutoplayFailed&&_V.onAudioAutoplayFailed()}),window&&(window.__ARTC__=P1),P1}));