@byteplus/rtc 4.45.5 → 4.45.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2 -0
- package/index.esm.min.js +2 -2
- package/index.min.js +2 -2
- package/package.json +1 -1
package/index.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Copyright (c) 2020 The BytePlusRTC project authors. All Rights Reserved.
|
|
3
3
|
* @brief BytePlusRTC Advance API
|
|
4
|
-
* version: 4.45.
|
|
4
|
+
* version: 4.45.7
|
|
5
5
|
*/
|
|
6
|
-
!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).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(i){if("default"!==i&&!(i in e)){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}))})),Object.freeze(e)}function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){return e&&e.Math==Math&&e},n=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof i&&i)||function(){return this}()||Function("return this")(),o={},a=function(e){try{return!!e()}catch(e){return!0}},s=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),c=!a((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),u=c,d=Function.prototype.call,l=u?d.bind(d):function(){return d.apply(d,arguments)},h={},p={}.propertyIsEnumerable,_=Object.getOwnPropertyDescriptor,f=_&&!p.call({1:2},1);h.f=f?function(e){var t=_(this,e);return!!t&&t.enumerable}:p;var v,m,S=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},y=c,g=Function.prototype,E=g.bind,b=g.call,T=y&&E.bind(b,b),I=y?function(e){return e&&T(e)}:function(e){return e&&function(){return b.apply(e,arguments)}},R=I,A=R({}.toString),C=R("".slice),O=function(e){return C(A(e),8,-1)},w=I,N=a,P=O,D=n.Object,k=w("".split),M=N((function(){return!D("z").propertyIsEnumerable(0)}))?function(e){return"String"==P(e)?k(e,""):D(e)}:D,U=n.TypeError,L=function(e){if(null==e)throw U("Can't call method on "+e);return e},x=M,V=L,F=function(e){return x(V(e))},B=function(e){return"function"==typeof e},j=B,G=function(e){return"object"==typeof e?null!==e:j(e)},H=n,z=B,K=function(e){return z(e)?e:void 0},W=function(e,t){return arguments.length<2?K(H[e]):H[e]&&H[e][t]},X=I({}.isPrototypeOf),Y=W("navigator","userAgent")||"",q=n,J=Y,Q=q.process,Z=q.Deno,$=Q&&Q.versions||Z&&Z.version,ee=$&&$.v8;ee&&(m=(v=ee.split("."))[0]>0&&v[0]<4?1:+(v[0]+v[1])),!m&&J&&(!(v=J.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=J.match(/Chrome\/(\d+)/))&&(m=+v[1]);var te=m,ie=te,re=a,ne=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ie&&ie<41})),oe=ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ae=W,se=B,ce=X,ue=oe,de=n.Object,le=ue?function(e){return"symbol"==typeof e}:function(e){var t=ae("Symbol");return se(t)&&ce(t.prototype,de(e))},he=n.String,pe=function(e){try{return he(e)}catch(e){return"Object"}},_e=B,fe=pe,ve=n.TypeError,me=function(e){if(_e(e))return e;throw ve(fe(e)+" is not a function")},Se=me,ye=function(e,t){var i=e[t];return null==i?void 0:Se(i)},ge=l,Ee=B,be=G,Te=n.TypeError,Ie={exports:{}},Re=n,Ae=Object.defineProperty,Ce=function(e,t){try{Ae(Re,e,{value:t,configurable:!0,writable:!0})}catch(i){Re[e]=t}return t},Oe=Ce,we="__core-js_shared__",Ne=n[we]||Oe(we,{}),Pe=Ne;(Ie.exports=function(e,t){return Pe[e]||(Pe[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"});var De=L,ke=n.Object,Me=function(e){return ke(De(e))},Ue=Me,Le=I({}.hasOwnProperty),xe=Object.hasOwn||function(e,t){return Le(Ue(e),t)},Ve=I,Fe=0,Be=Math.random(),je=Ve(1..toString),Ge=function(e){return"Symbol("+(void 0===e?"":e)+")_"+je(++Fe+Be,36)},He=n,ze=Ie.exports,Ke=xe,We=Ge,Xe=ne,Ye=oe,qe=ze("wks"),Je=He.Symbol,Qe=Je&&Je.for,Ze=Ye?Je:Je&&Je.withoutSetter||We,$e=function(e){if(!Ke(qe,e)||!Xe&&"string"!=typeof qe[e]){var t="Symbol."+e;Xe&&Ke(Je,e)?qe[e]=Je[e]:qe[e]=Ye&&Qe?Qe(t):Ze(t)}return qe[e]},et=l,tt=G,it=le,rt=ye,nt=function(e,t){var i,r;if("string"===t&&Ee(i=e.toString)&&!be(r=ge(i,e)))return r;if(Ee(i=e.valueOf)&&!be(r=ge(i,e)))return r;if("string"!==t&&Ee(i=e.toString)&&!be(r=ge(i,e)))return r;throw Te("Can't convert object to primitive value")},ot=$e,at=n.TypeError,st=ot("toPrimitive"),ct=function(e,t){if(!tt(e)||it(e))return e;var i,r=rt(e,st);if(r){if(void 0===t&&(t="default"),i=et(r,e,t),!tt(i)||it(i))return i;throw at("Can't convert object to primitive value")}return void 0===t&&(t="number"),nt(e,t)},ut=ct,dt=le,lt=function(e){var t=ut(e,"string");return dt(t)?t:t+""},ht=G,pt=n.document,_t=ht(pt)&&ht(pt.createElement),ft=function(e){return _t?pt.createElement(e):{}},vt=ft,mt=!s&&!a((function(){return 7!=Object.defineProperty(vt("div"),"a",{get:function(){return 7}}).a})),St=s,yt=l,gt=h,Et=S,bt=F,Tt=lt,It=xe,Rt=mt,At=Object.getOwnPropertyDescriptor;o.f=St?At:function(e,t){if(e=bt(e),t=Tt(t),Rt)try{return At(e,t)}catch(e){}if(It(e,t))return Et(!yt(gt.f,e,t),e[t])};var Ct={},Ot=s&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),wt=n,Nt=G,Pt=wt.String,Dt=wt.TypeError,kt=function(e){if(Nt(e))return e;throw Dt(Pt(e)+" is not an object")},Mt=s,Ut=mt,Lt=Ot,xt=kt,Vt=lt,Ft=n.TypeError,Bt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,Gt="enumerable",Ht="configurable",zt="writable";Ct.f=Mt?Lt?function(e,t,i){if(xt(e),t=Vt(t),xt(i),"function"==typeof e&&"prototype"===t&&"value"in i&&zt in i&&!i.writable){var r=jt(e,t);r&&r.writable&&(e[t]=i.value,i={configurable:Ht in i?i.configurable:r.configurable,enumerable:Gt in i?i.enumerable:r.enumerable,writable:!1})}return Bt(e,t,i)}:Bt:function(e,t,i){if(xt(e),t=Vt(t),xt(i),Ut)try{return Bt(e,t,i)}catch(e){}if("get"in i||"set"in i)throw Ft("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var Kt=Ct,Wt=S,Xt=s?function(e,t,i){return Kt.f(e,t,Wt(1,i))}:function(e,t,i){return e[t]=i,e},Yt={exports:{}},qt=B,Jt=Ne,Qt=I(Function.toString);qt(Jt.inspectSource)||(Jt.inspectSource=function(e){return Qt(e)});var Zt,$t,ei,ti=Jt.inspectSource,ii=B,ri=ti,ni=n.WeakMap,oi=ii(ni)&&/native code/.test(ri(ni)),ai=Ie.exports,si=Ge,ci=ai("keys"),ui=function(e){return ci[e]||(ci[e]=si(e))},di={},li=oi,hi=n,pi=I,_i=G,fi=Xt,vi=xe,mi=Ne,Si=ui,yi=di,gi="Object already initialized",Ei=hi.TypeError,bi=hi.WeakMap;if(li||mi.state){var Ti=mi.state||(mi.state=new bi),Ii=pi(Ti.get),Ri=pi(Ti.has),Ai=pi(Ti.set);Zt=function(e,t){if(Ri(Ti,e))throw new Ei(gi);return t.facade=e,Ai(Ti,e,t),t},$t=function(e){return Ii(Ti,e)||{}},ei=function(e){return Ri(Ti,e)}}else{var Ci=Si("state");yi[Ci]=!0,Zt=function(e,t){if(vi(e,Ci))throw new Ei(gi);return t.facade=e,fi(e,Ci,t),t},$t=function(e){return vi(e,Ci)?e[Ci]:{}},ei=function(e){return vi(e,Ci)}}var Oi={set:Zt,get:$t,has:ei,enforce:function(e){return ei(e)?$t(e):Zt(e,{})},getterFor:function(e){return function(t){var i;if(!_i(t)||(i=$t(t)).type!==e)throw Ei("Incompatible receiver, "+e+" required");return i}}},wi=s,Ni=xe,Pi=Function.prototype,Di=wi&&Object.getOwnPropertyDescriptor,ki=Ni(Pi,"name"),Mi={EXISTS:ki,PROPER:ki&&"something"===function(){}.name,CONFIGURABLE:ki&&(!wi||wi&&Di(Pi,"name").configurable)},Ui=n,Li=B,xi=xe,Vi=Xt,Fi=Ce,Bi=ti,ji=Mi.CONFIGURABLE,Gi=Oi.get,Hi=Oi.enforce,zi=String(String).split("String");(Yt.exports=function(e,t,i,r){var n,o=!!r&&!!r.unsafe,a=!!r&&!!r.enumerable,s=!!r&&!!r.noTargetGet,c=r&&void 0!==r.name?r.name:t;Li(i)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!xi(i,"name")||ji&&i.name!==c)&&Vi(i,"name",c),(n=Hi(i)).source||(n.source=zi.join("string"==typeof c?c:""))),e!==Ui?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=i:Vi(e,t,i)):a?e[t]=i:Fi(t,i)})(Function.prototype,"toString",(function(){return Li(this)&&Gi(this).source||Bi(this)}));var Ki={},Wi=Math.ceil,Xi=Math.floor,Yi=function(e){var t=+e;return t!=t||0===t?0:(t>0?Xi:Wi)(t)},qi=Yi,Ji=Math.max,Qi=Math.min,Zi=function(e,t){var i=qi(e);return i<0?Ji(i+t,0):Qi(i,t)},$i=Yi,er=Math.min,tr=function(e){return e>0?er($i(e),9007199254740991):0},ir=tr,rr=function(e){return ir(e.length)},nr=F,or=Zi,ar=rr,sr=function(e){return function(t,i,r){var n,o=nr(t),a=ar(o),s=or(r,a);if(e&&i!=i){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===i)return e||s||0;return!e&&-1}},cr={includes:sr(!0),indexOf:sr(!1)},ur=xe,dr=F,lr=cr.indexOf,hr=di,pr=I([].push),_r=function(e,t){var i,r=dr(e),n=0,o=[];for(i in r)!ur(hr,i)&&ur(r,i)&&pr(o,i);for(;t.length>n;)ur(r,i=t[n++])&&(~lr(o,i)||pr(o,i));return o},fr=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],vr=_r,mr=fr.concat("length","prototype");Ki.f=Object.getOwnPropertyNames||function(e){return vr(e,mr)};var Sr={};Sr.f=Object.getOwnPropertySymbols;var yr=W,gr=Ki,Er=Sr,br=kt,Tr=I([].concat),Ir=yr("Reflect","ownKeys")||function(e){var t=gr.f(br(e)),i=Er.f;return i?Tr(t,i(e)):t},Rr=xe,Ar=Ir,Cr=o,Or=Ct,wr=function(e,t,i){for(var r=Ar(t),n=Or.f,o=Cr.f,a=0;a<r.length;a++){var s=r[a];Rr(e,s)||i&&Rr(i,s)||n(e,s,o(t,s))}},Nr=a,Pr=B,Dr=/#|\.prototype\./,kr=function(e,t){var i=Ur[Mr(e)];return i==xr||i!=Lr&&(Pr(t)?Nr(t):!!t)},Mr=kr.normalize=function(e){return String(e).replace(Dr,".").toLowerCase()},Ur=kr.data={},Lr=kr.NATIVE="N",xr=kr.POLYFILL="P",Vr=kr,Fr=n,Br=o.f,jr=Xt,Gr=Yt.exports,Hr=Ce,zr=wr,Kr=Vr,Wr=function(e,t){var i,r,n,o,a,s=e.target,c=e.global,u=e.stat;if(i=c?Fr:u?Fr[s]||Hr(s,{}):(Fr[s]||{}).prototype)for(r in t){if(o=t[r],n=e.noTargetGet?(a=Br(i,r))&&a.value:i[r],!Kr(c?r:s+(u?".":"#")+r,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;zr(o,n)}(e.sham||n&&n.sham)&&jr(o,"sham",!0),Gr(i,r,o,e)}},Xr=n,Yr=B,qr=Xr.String,Jr=Xr.TypeError,Qr=I,Zr=kt,$r=function(e){if("object"==typeof e||Yr(e))return e;throw Jr("Can't set "+qr(e)+" as a prototype")},en=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=Qr(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(i,[]),t=i instanceof Array}catch(e){}return function(i,r){return Zr(i),$r(r),t?e(i,r):i.__proto__=r,i}}():void 0);Wr({target:"Object",stat:!0},{setPrototypeOf:en});var tn={},rn=_r,nn=fr,on=Object.keys||function(e){return rn(e,nn)},an=s,sn=Ot,cn=Ct,un=kt,dn=F,ln=on;tn.f=an&&!sn?Object.defineProperties:function(e,t){un(e);for(var i,r=dn(t),n=ln(t),o=n.length,a=0;o>a;)cn.f(e,i=n[a++],r[i]);return e};var hn,pn=W("document","documentElement"),_n=kt,fn=tn,vn=fr,mn=di,Sn=pn,yn=ft,gn=ui("IE_PROTO"),En=function(){},bn=function(e){return"<script>"+e+"</"+"script>"},Tn=function(e){e.write(bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},In=function(){try{hn=new ActiveXObject("htmlfile")}catch(e){}var e,t;In="undefined"!=typeof document?document.domain&&hn?Tn(hn):((t=yn("iframe")).style.display="none",Sn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(bn("document.F=Object")),e.close(),e.F):Tn(hn);for(var i=vn.length;i--;)delete In.prototype[vn[i]];return In()};mn[gn]=!0;var Rn=Object.create||function(e,t){var i;return null!==e?(En.prototype=_n(e),i=new En,En.prototype=null,i[gn]=e):i=In(),void 0===t?i:fn.f(i,t)};Wr({target:"Object",stat:!0,sham:!s},{create:Rn});var An=s,Cn=I,On=l,wn=a,Nn=on,Pn=Sr,Dn=h,kn=Me,Mn=M,Un=Object.assign,Ln=Object.defineProperty,xn=Cn([].concat),Vn=!Un||wn((function(){if(An&&1!==Un({b:1},Un(Ln({},"a",{enumerable:!0,get:function(){Ln(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},i=Symbol(),r="abcdefghijklmnopqrst";return e[i]=7,r.split("").forEach((function(e){t[e]=e})),7!=Un({},e)[i]||Nn(Un({},t)).join("")!=r}))?function(e,t){for(var i=kn(e),r=arguments.length,n=1,o=Pn.f,a=Dn.f;r>n;)for(var s,c=Mn(arguments[n++]),u=o?xn(Nn(c),o(c)):Nn(c),d=u.length,l=0;d>l;)s=u[l++],An&&!On(a,c,s)||(i[s]=c[s]);return i}:Un,Fn=Vn;Wr({target:"Object",stat:!0,forced:Object.assign!==Fn},{assign:Fn});var Bn=a,jn=function(e,t){var i=[][e];return!!i&&Bn((function(){i.call(null,t||function(){throw 1},1)}))},Gn=Wr,Hn=cr.indexOf,zn=jn,Kn=I([].indexOf),Wn=!!Kn&&1/Kn([1],1,-0)<0,Xn=zn("indexOf");Gn({target:"Array",proto:!0,forced:Wn||!Xn},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Wn?Kn(this,e,t)||0:Hn(this,e,t)}});var Yn=c,qn=Function.prototype,Jn=qn.apply,Qn=qn.call,Zn="object"==typeof Reflect&&Reflect.apply||(Yn?Qn.bind(Jn):function(){return Qn.apply(Jn,arguments)}),$n=O,eo=Array.isArray||function(e){return"Array"==$n(e)},to={};to[$e("toStringTag")]="z";var io="[object z]"===String(to),ro=n,no=io,oo=B,ao=O,so=$e("toStringTag"),co=ro.Object,uo="Arguments"==ao(function(){return arguments}()),lo=no?ao:function(e){var t,i,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=co(e),so))?i:uo?ao(t):"Object"==(r=ao(t))&&oo(t.callee)?"Arguments":r},ho=lo,po=n.String,_o=function(e){if("Symbol"===ho(e))throw TypeError("Cannot convert a Symbol value to a string");return po(e)},fo={},vo=lt,mo=Ct,So=S,yo=function(e,t,i){var r=vo(t);r in e?mo.f(e,r,So(0,i)):e[r]=i},go=Zi,Eo=rr,bo=yo,To=n.Array,Io=Math.max,Ro=function(e,t,i){for(var r=Eo(e),n=go(t,r),o=go(void 0===i?r:i,r),a=To(Io(o-n,0)),s=0;n<o;n++,s++)bo(a,s,e[n]);return a.length=s,a},Ao=O,Co=F,Oo=Ki.f,wo=Ro,No="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];fo.f=function(e){return No&&"Window"==Ao(e)?function(e){try{return Oo(e)}catch(e){return wo(No)}}(e):Oo(Co(e))};var Po=I([].slice),Do={},ko=$e;Do.f=ko;var Mo=n,Uo=xe,Lo=Do,xo=Ct.f,Vo=function(e){var t=Mo.Symbol||(Mo.Symbol={});Uo(t,e)||xo(t,e,{value:Lo.f(e)})},Fo=Ct.f,Bo=xe,jo=$e("toStringTag"),Go=function(e,t,i){e&&!i&&(e=e.prototype),e&&!Bo(e,jo)&&Fo(e,jo,{configurable:!0,value:t})},Ho=me,zo=c,Ko=I(I.bind),Wo=function(e,t){return Ho(e),void 0===t?e:zo?Ko(e,t):function(){return e.apply(t,arguments)}},Xo=I,Yo=a,qo=B,Jo=lo,Qo=ti,Zo=function(){},$o=[],ea=W("Reflect","construct"),ta=/^\s*(?:class|function)\b/,ia=Xo(ta.exec),ra=!ta.exec(Zo),na=function(e){if(!qo(e))return!1;try{return ea(Zo,$o,e),!0}catch(e){return!1}},oa=function(e){if(!qo(e))return!1;switch(Jo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ra||!!ia(ta,Qo(e))}catch(e){return!0}};oa.sham=!0;var aa=!ea||Yo((function(){var e;return na(na.call)||!na(Object)||!na((function(){e=!0}))||e}))?oa:na,sa=n,ca=eo,ua=aa,da=G,la=$e("species"),ha=sa.Array,pa=function(e){var t;return ca(e)&&(t=e.constructor,(ua(t)&&(t===ha||ca(t.prototype))||da(t)&&null===(t=t[la]))&&(t=void 0)),void 0===t?ha:t},_a=function(e,t){return new(pa(e))(0===t?0:t)},fa=Wo,va=M,ma=Me,Sa=rr,ya=_a,ga=I([].push),Ea=function(e){var t=1==e,i=2==e,r=3==e,n=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,p,_=ma(c),f=va(_),v=fa(u,d),m=Sa(f),S=0,y=l||ya,g=t?y(c,m):i||a?y(c,0):void 0;m>S;S++)if((s||S in f)&&(p=v(h=f[S],S,_),e))if(t)g[S]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return S;case 2:ga(g,h)}else switch(e){case 4:return!1;case 7:ga(g,h)}return o?-1:r||n?n:g}},ba={forEach:Ea(0),map:Ea(1),filter:Ea(2),some:Ea(3),every:Ea(4),find:Ea(5),findIndex:Ea(6),filterReject:Ea(7)},Ta=Wr,Ia=n,Ra=W,Aa=Zn,Ca=l,Oa=I,wa=s,Na=ne,Pa=a,Da=xe,ka=eo,Ma=B,Ua=G,La=X,xa=le,Va=kt,Fa=Me,Ba=F,ja=lt,Ga=_o,Ha=S,za=Rn,Ka=on,Wa=Ki,Xa=fo,Ya=Sr,qa=o,Ja=Ct,Qa=tn,Za=h,$a=Po,es=Yt.exports,ts=Ie.exports,is=di,rs=Ge,ns=$e,os=Do,as=Vo,ss=Go,cs=Oi,us=ba.forEach,ds=ui("hidden"),ls="Symbol",hs=ns("toPrimitive"),ps=cs.set,_s=cs.getterFor(ls),fs=Object.prototype,vs=Ia.Symbol,ms=vs&&vs.prototype,Ss=Ia.TypeError,ys=Ia.QObject,gs=Ra("JSON","stringify"),Es=qa.f,bs=Ja.f,Ts=Xa.f,Is=Za.f,Rs=Oa([].push),As=ts("symbols"),Cs=ts("op-symbols"),Os=ts("string-to-symbol-registry"),ws=ts("symbol-to-string-registry"),Ns=ts("wks"),Ps=!ys||!ys.prototype||!ys.prototype.findChild,Ds=wa&&Pa((function(){return 7!=za(bs({},"a",{get:function(){return bs(this,"a",{value:7}).a}})).a}))?function(e,t,i){var r=Es(fs,t);r&&delete fs[t],bs(e,t,i),r&&e!==fs&&bs(fs,t,r)}:bs,ks=function(e,t){var i=As[e]=za(ms);return ps(i,{type:ls,tag:e,description:t}),wa||(i.description=t),i},Ms=function(e,t,i){e===fs&&Ms(Cs,t,i),Va(e);var r=ja(t);return Va(i),Da(As,r)?(i.enumerable?(Da(e,ds)&&e[ds][r]&&(e[ds][r]=!1),i=za(i,{enumerable:Ha(0,!1)})):(Da(e,ds)||bs(e,ds,Ha(1,{})),e[ds][r]=!0),Ds(e,r,i)):bs(e,r,i)},Us=function(e,t){Va(e);var i=Ba(t),r=Ka(i).concat(Fs(i));return us(r,(function(t){wa&&!Ca(Ls,i,t)||Ms(e,t,i[t])})),e},Ls=function(e){var t=ja(e),i=Ca(Is,this,t);return!(this===fs&&Da(As,t)&&!Da(Cs,t))&&(!(i||!Da(this,t)||!Da(As,t)||Da(this,ds)&&this[ds][t])||i)},xs=function(e,t){var i=Ba(e),r=ja(t);if(i!==fs||!Da(As,r)||Da(Cs,r)){var n=Es(i,r);return!n||!Da(As,r)||Da(i,ds)&&i[ds][r]||(n.enumerable=!0),n}},Vs=function(e){var t=Ts(Ba(e)),i=[];return us(t,(function(e){Da(As,e)||Da(is,e)||Rs(i,e)})),i},Fs=function(e){var t=e===fs,i=Ts(t?Cs:Ba(e)),r=[];return us(i,(function(e){!Da(As,e)||t&&!Da(fs,e)||Rs(r,As[e])})),r};(Na||(vs=function(){if(La(ms,this))throw Ss("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Ga(arguments[0]):void 0,t=rs(e),i=function(e){this===fs&&Ca(i,Cs,e),Da(this,ds)&&Da(this[ds],t)&&(this[ds][t]=!1),Ds(this,t,Ha(1,e))};return wa&&Ps&&Ds(fs,t,{configurable:!0,set:i}),ks(t,e)},es(ms=vs.prototype,"toString",(function(){return _s(this).tag})),es(vs,"withoutSetter",(function(e){return ks(rs(e),e)})),Za.f=Ls,Ja.f=Ms,Qa.f=Us,qa.f=xs,Wa.f=Xa.f=Vs,Ya.f=Fs,os.f=function(e){return ks(ns(e),e)},wa&&(bs(ms,"description",{configurable:!0,get:function(){return _s(this).description}}),es(fs,"propertyIsEnumerable",Ls,{unsafe:!0}))),Ta({global:!0,wrap:!0,forced:!Na,sham:!Na},{Symbol:vs}),us(Ka(Ns),(function(e){as(e)})),Ta({target:ls,stat:!0,forced:!Na},{for:function(e){var t=Ga(e);if(Da(Os,t))return Os[t];var i=vs(t);return Os[t]=i,ws[i]=t,i},keyFor:function(e){if(!xa(e))throw Ss(e+" is not a symbol");if(Da(ws,e))return ws[e]},useSetter:function(){Ps=!0},useSimple:function(){Ps=!1}}),Ta({target:"Object",stat:!0,forced:!Na,sham:!wa},{create:function(e,t){return void 0===t?za(e):Us(za(e),t)},defineProperty:Ms,defineProperties:Us,getOwnPropertyDescriptor:xs}),Ta({target:"Object",stat:!0,forced:!Na},{getOwnPropertyNames:Vs,getOwnPropertySymbols:Fs}),Ta({target:"Object",stat:!0,forced:Pa((function(){Ya.f(1)}))},{getOwnPropertySymbols:function(e){return Ya.f(Fa(e))}}),gs)&&Ta({target:"JSON",stat:!0,forced:!Na||Pa((function(){var e=vs();return"[null]"!=gs([e])||"{}"!=gs({a:e})||"{}"!=gs(Object(e))}))},{stringify:function(e,t,i){var r=$a(arguments),n=t;if((Ua(t)||void 0!==e)&&!xa(e))return ka(t)||(t=function(e,t){if(Ma(n)&&(t=Ca(n,this,e,t)),!xa(t))return t}),r[1]=t,Aa(gs,null,r)}});if(!ms[hs]){var Bs=ms.valueOf;es(ms,hs,(function(e){return Ca(Bs,this)}))}ss(vs,ls),is[ds]=!0;var js=Wr,Gs=a,Hs=F,zs=o.f,Ks=s,Ws=Gs((function(){zs(1)}));js({target:"Object",stat:!0,forced:!Ks||Ws,sham:!Ks},{getOwnPropertyDescriptor:function(e,t){return zs(Hs(e),t)}});var Xs=lo,Ys=io?{}.toString:function(){return"[object "+Xs(this)+"]"},qs=io,Js=Yt.exports,Qs=Ys;qs||Js(Object.prototype,"toString",Qs,{unsafe:!0});var Zs=Wr,$s=s,ec=Ct.f;Zs({target:"Object",stat:!0,forced:Object.defineProperty!==ec,sham:!$s},{defineProperty:ec});var tc=n.Promise,ic=Yt.exports,rc=function(e,t,i){for(var r in t)ic(e,r,t[r],i);return e},nc=W,oc=Ct,ac=s,sc=$e("species"),cc=function(e){var t=nc(e),i=oc.f;ac&&t&&!t[sc]&&i(t,sc,{configurable:!0,get:function(){return this}})},uc=X,dc=n.TypeError,lc=function(e,t){if(uc(t,e))return e;throw dc("Incorrect invocation")},hc={},pc=hc,_c=$e("iterator"),fc=Array.prototype,vc=function(e){return void 0!==e&&(pc.Array===e||fc[_c]===e)},mc=lo,Sc=ye,yc=hc,gc=$e("iterator"),Ec=function(e){if(null!=e)return Sc(e,gc)||Sc(e,"@@iterator")||yc[mc(e)]},bc=l,Tc=me,Ic=kt,Rc=pe,Ac=Ec,Cc=n.TypeError,Oc=function(e,t){var i=arguments.length<2?Ac(e):t;if(Tc(i))return Ic(bc(i,e));throw Cc(Rc(e)+" is not iterable")},wc=l,Nc=kt,Pc=ye,Dc=function(e,t,i){var r,n;Nc(e);try{if(!(r=Pc(e,"return"))){if("throw"===t)throw i;return i}r=wc(r,e)}catch(e){n=!0,r=e}if("throw"===t)throw i;if(n)throw r;return Nc(r),i},kc=Wo,Mc=l,Uc=kt,Lc=pe,xc=vc,Vc=rr,Fc=X,Bc=Oc,jc=Ec,Gc=Dc,Hc=n.TypeError,zc=function(e,t){this.stopped=e,this.result=t},Kc=zc.prototype,Wc=function(e,t,i){var r,n,o,a,s,c,u,d=i&&i.that,l=!(!i||!i.AS_ENTRIES),h=!(!i||!i.IS_ITERATOR),p=!(!i||!i.INTERRUPTED),_=kc(t,d),f=function(e){return r&&Gc(r,"normal",e),new zc(!0,e)},v=function(e){return l?(Uc(e),p?_(e[0],e[1],f):_(e[0],e[1])):p?_(e,f):_(e)};if(h)r=e;else{if(!(n=jc(e)))throw Hc(Lc(e)+" is not iterable");if(xc(n)){for(o=0,a=Vc(e);a>o;o++)if((s=v(e[o]))&&Fc(Kc,s))return s;return new zc(!1)}r=Bc(e,n)}for(c=r.next;!(u=Mc(c,r)).done;){try{s=v(u.value)}catch(e){Gc(r,"throw",e)}if("object"==typeof s&&s&&Fc(Kc,s))return s}return new zc(!1)},Xc=$e("iterator"),Yc=!1;try{var qc=0,Jc={next:function(){return{done:!!qc++}},return:function(){Yc=!0}};Jc[Xc]=function(){return this},Array.from(Jc,(function(){throw 2}))}catch(e){}var Qc,Zc,$c,eu,tu=function(e,t){if(!t&&!Yc)return!1;var i=!1;try{var r={};r[Xc]=function(){return{next:function(){return{done:i=!0}}}},e(r)}catch(e){}return i},iu=aa,ru=pe,nu=n.TypeError,ou=function(e){if(iu(e))return e;throw nu(ru(e)+" is not a constructor")},au=kt,su=ou,cu=$e("species"),uu=function(e,t){var i,r=au(e).constructor;return void 0===r||null==(i=au(r)[cu])?t:su(i)},du=n.TypeError,lu=function(e,t){if(e<t)throw du("Not enough arguments");return e},hu=/(?:ipad|iphone|ipod).*applewebkit/i.test(Y),pu="process"==O(n.process),_u=n,fu=Zn,vu=Wo,mu=B,Su=xe,yu=a,gu=pn,Eu=Po,bu=ft,Tu=lu,Iu=hu,Ru=pu,Au=_u.setImmediate,Cu=_u.clearImmediate,Ou=_u.process,wu=_u.Dispatch,Nu=_u.Function,Pu=_u.MessageChannel,Du=_u.String,ku=0,Mu={},Uu="onreadystatechange";try{Qc=_u.location}catch(e){}var Lu=function(e){if(Su(Mu,e)){var t=Mu[e];delete Mu[e],t()}},xu=function(e){return function(){Lu(e)}},Vu=function(e){Lu(e.data)},Fu=function(e){_u.postMessage(Du(e),Qc.protocol+"//"+Qc.host)};Au&&Cu||(Au=function(e){Tu(arguments.length,1);var t=mu(e)?e:Nu(e),i=Eu(arguments,1);return Mu[++ku]=function(){fu(t,void 0,i)},Zc(ku),ku},Cu=function(e){delete Mu[e]},Ru?Zc=function(e){Ou.nextTick(xu(e))}:wu&&wu.now?Zc=function(e){wu.now(xu(e))}:Pu&&!Iu?(eu=($c=new Pu).port2,$c.port1.onmessage=Vu,Zc=vu(eu.postMessage,eu)):_u.addEventListener&&mu(_u.postMessage)&&!_u.importScripts&&Qc&&"file:"!==Qc.protocol&&!yu(Fu)?(Zc=Fu,_u.addEventListener("message",Vu,!1)):Zc=Uu in bu("script")?function(e){gu.appendChild(bu("script")).onreadystatechange=function(){gu.removeChild(this),Lu(e)}}:function(e){setTimeout(xu(e),0)});var Bu,ju,Gu,Hu,zu,Ku,Wu,Xu,Yu={set:Au,clear:Cu},qu=n,Ju=/ipad|iphone|ipod/i.test(Y)&&void 0!==qu.Pebble,Qu=/web0s(?!.*chrome)/i.test(Y),Zu=n,$u=Wo,ed=o.f,td=Yu.set,id=hu,rd=Ju,nd=Qu,od=pu,ad=Zu.MutationObserver||Zu.WebKitMutationObserver,sd=Zu.document,cd=Zu.process,ud=Zu.Promise,dd=ed(Zu,"queueMicrotask"),ld=dd&&dd.value;ld||(Bu=function(){var e,t;for(od&&(e=cd.domain)&&e.exit();ju;){t=ju.fn,ju=ju.next;try{t()}catch(e){throw ju?Hu():Gu=void 0,e}}Gu=void 0,e&&e.enter()},id||od||nd||!ad||!sd?!rd&&ud&&ud.resolve?((Wu=ud.resolve(void 0)).constructor=ud,Xu=$u(Wu.then,Wu),Hu=function(){Xu(Bu)}):od?Hu=function(){cd.nextTick(Bu)}:(td=$u(td,Zu),Hu=function(){td(Bu)}):(zu=!0,Ku=sd.createTextNode(""),new ad(Bu).observe(Ku,{characterData:!0}),Hu=function(){Ku.data=zu=!zu}));var hd=ld||function(e){var t={fn:e,next:void 0};Gu&&(Gu.next=t),ju||(ju=t,Hu()),Gu=t},pd={},_d=me,fd=function(e){var t,i;this.promise=new e((function(e,r){if(void 0!==t||void 0!==i)throw TypeError("Bad Promise constructor");t=e,i=r})),this.resolve=_d(t),this.reject=_d(i)};pd.f=function(e){return new fd(e)};var vd=kt,md=G,Sd=pd,yd=function(e,t){if(vd(e),md(t)&&t.constructor===e)return t;var i=Sd.f(e);return(0,i.resolve)(t),i.promise},gd=n,Ed=function(){this.head=null,this.tail=null};Ed.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 bd,Td,Id,Rd,Ad=Ed,Cd="object"==typeof window,Od=Wr,wd=n,Nd=W,Pd=l,Dd=tc,kd=Yt.exports,Md=rc,Ud=en,Ld=Go,xd=cc,Vd=me,Fd=B,Bd=G,jd=lc,Gd=ti,Hd=Wc,zd=tu,Kd=uu,Wd=Yu.set,Xd=hd,Yd=yd,qd=function(e,t){var i=gd.console;i&&i.error&&(1==arguments.length?i.error(e):i.error(e,t))},Jd=pd,Qd=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Zd=Ad,$d=Oi,el=Vr,tl=Cd,il=pu,rl=te,nl=$e("species"),ol="Promise",al=$d.getterFor(ol),sl=$d.set,cl=$d.getterFor(ol),ul=Dd&&Dd.prototype,dl=Dd,ll=ul,hl=wd.TypeError,pl=wd.document,_l=wd.process,fl=Jd.f,vl=fl,ml=!!(pl&&pl.createEvent&&wd.dispatchEvent),Sl=Fd(wd.PromiseRejectionEvent),yl="unhandledrejection",gl=!1,El=el(ol,(function(){var e=Gd(dl),t=e!==String(dl);if(!t&&66===rl)return!0;if(rl>=51&&/native code/.test(e))return!1;var i=new dl((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};return(i.constructor={})[nl]=r,!(gl=i.then((function(){}))instanceof r)||!t&&tl&&!Sl})),bl=El||!zd((function(e){dl.all(e).catch((function(){}))})),Tl=function(e){var t;return!(!Bd(e)||!Fd(t=e.then))&&t},Il=function(e,t){var i,r,n,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&wl(t),t.rejection=1),!0===s?i=o:(d&&d.enter(),i=s(o),d&&(d.exit(),n=!0)),i===e.promise?u(hl("Promise-chain cycle")):(r=Tl(i))?Pd(r,i,c,u):c(i)):u(o)}catch(e){d&&!n&&d.exit(),u(e)}},Rl=function(e,t){e.notified||(e.notified=!0,Xd((function(){for(var i,r=e.reactions;i=r.get();)Il(i,e);e.notified=!1,t&&!e.rejection&&Cl(e)})))},Al=function(e,t,i){var r,n;ml?((r=pl.createEvent("Event")).promise=t,r.reason=i,r.initEvent(e,!1,!0),wd.dispatchEvent(r)):r={promise:t,reason:i},!Sl&&(n=wd["on"+e])?n(r):e===yl&&qd("Unhandled promise rejection",i)},Cl=function(e){Pd(Wd,wd,(function(){var t,i=e.facade,r=e.value;if(Ol(e)&&(t=Qd((function(){il?_l.emit("unhandledRejection",r,i):Al(yl,i,r)})),e.rejection=il||Ol(e)?2:1,t.error))throw t.value}))},Ol=function(e){return 1!==e.rejection&&!e.parent},wl=function(e){Pd(Wd,wd,(function(){var t=e.facade;il?_l.emit("rejectionHandled",t):Al("rejectionhandled",t,e.value)}))},Nl=function(e,t,i){return function(r){e(t,r,i)}},Pl=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,Rl(e,!0))},Dl=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw hl("Promise can't be resolved itself");var r=Tl(t);r?Xd((function(){var i={done:!1};try{Pd(r,t,Nl(Dl,i,e),Nl(Pl,i,e))}catch(t){Pl(i,t,e)}})):(e.value=t,e.state=1,Rl(e,!1))}catch(t){Pl({done:!1},t,e)}}};if(El&&(ll=(dl=function(e){jd(this,ll),Vd(e),Pd(bd,this);var t=al(this);try{e(Nl(Dl,t),Nl(Pl,t))}catch(e){Pl(t,e)}}).prototype,(bd=function(e){sl(this,{type:ol,done:!1,notified:!1,parent:!1,reactions:new Zd,rejection:!1,state:0,value:void 0})}).prototype=Md(ll,{then:function(e,t){var i=cl(this),r=fl(Kd(this,dl));return i.parent=!0,r.ok=!Fd(e)||e,r.fail=Fd(t)&&t,r.domain=il?_l.domain:void 0,0==i.state?i.reactions.add(r):Xd((function(){Il(r,i)})),r.promise},catch:function(e){return this.then(void 0,e)}}),Td=function(){var e=new bd,t=al(e);this.promise=e,this.resolve=Nl(Dl,t),this.reject=Nl(Pl,t)},Jd.f=fl=function(e){return e===dl||e===Id?new Td(e):vl(e)},Fd(Dd)&&ul!==Object.prototype)){Rd=ul.then,gl||(kd(ul,"then",(function(e,t){var i=this;return new dl((function(e,t){Pd(Rd,i,e,t)})).then(e,t)}),{unsafe:!0}),kd(ul,"catch",ll.catch,{unsafe:!0}));try{delete ul.constructor}catch(e){}Ud&&Ud(ul,ll)}Od({global:!0,wrap:!0,forced:El},{Promise:dl}),Ld(dl,ol,!1),xd(ol),Id=Nd(ol),Od({target:ol,stat:!0,forced:El},{reject:function(e){var t=fl(this);return Pd(t.reject,void 0,e),t.promise}}),Od({target:ol,stat:!0,forced:El},{resolve:function(e){return Yd(this,e)}}),Od({target:ol,stat:!0,forced:bl},{all:function(e){var t=this,i=fl(t),r=i.resolve,n=i.reject,o=Qd((function(){var i=Vd(t.resolve),o=[],a=0,s=1;Hd(e,(function(e){var c=a++,u=!1;s++,Pd(i,t,e).then((function(e){u||(u=!0,o[c]=e,--s||r(o))}),n)})),--s||r(o)}));return o.error&&n(o.value),i.promise},race:function(e){var t=this,i=fl(t),r=i.reject,n=Qd((function(){var n=Vd(t.resolve);Hd(e,(function(e){Pd(n,t,e).then(i.resolve,r)}))}));return n.error&&r(n.value),i.promise}});var kl=Wr,Ml=s,Ul=n,Ll=I,xl=xe,Vl=B,Fl=X,Bl=_o,jl=Ct.f,Gl=wr,Hl=Ul.Symbol,zl=Hl&&Hl.prototype;if(Ml&&Vl(Hl)&&(!("description"in zl)||void 0!==Hl().description)){var Kl={},Wl=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:Bl(arguments[0]),t=Fl(zl,this)?new Hl(e):void 0===e?Hl():Hl(e);return""===e&&(Kl[t]=!0),t};Gl(Wl,Hl),Wl.prototype=zl,zl.constructor=Wl;var Xl="Symbol(test)"==String(Hl("test")),Yl=Ll(zl.toString),ql=Ll(zl.valueOf),Jl=/^Symbol\((.*)\)[^)]+$/,Ql=Ll("".replace),Zl=Ll("".slice);jl(zl,"description",{configurable:!0,get:function(){var e=ql(this),t=Yl(e);if(xl(Kl,e))return"";var i=Xl?Zl(t,7,-1):Ql(t,Jl,"$1");return""===i?void 0:i}}),kl({global:!0,forced:!0},{Symbol:Wl})}Vo("iterator");var $l=Rn,eh=Ct,th=$e("unscopables"),ih=Array.prototype;null==ih[th]&&eh.f(ih,th,{configurable:!0,value:$l(null)});var rh,nh,oh,ah=function(e){ih[th][e]=!0},sh=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),ch=n,uh=xe,dh=B,lh=Me,hh=sh,ph=ui("IE_PROTO"),_h=ch.Object,fh=_h.prototype,vh=hh?_h.getPrototypeOf:function(e){var t=lh(e);if(uh(t,ph))return t[ph];var i=t.constructor;return dh(i)&&t instanceof i?i.prototype:t instanceof _h?fh:null},mh=a,Sh=B,yh=vh,gh=Yt.exports,Eh=$e("iterator"),bh=!1;[].keys&&("next"in(oh=[].keys())?(nh=yh(yh(oh)))!==Object.prototype&&(rh=nh):bh=!0);var Th=null==rh||mh((function(){var e={};return rh[Eh].call(e)!==e}));Th&&(rh={}),Sh(rh[Eh])||gh(rh,Eh,(function(){return this}));var Ih={IteratorPrototype:rh,BUGGY_SAFARI_ITERATORS:bh},Rh=Ih.IteratorPrototype,Ah=Rn,Ch=S,Oh=Go,wh=hc,Nh=function(){return this},Ph=function(e,t,i,r){var n=t+" Iterator";return e.prototype=Ah(Rh,{next:Ch(+!r,i)}),Oh(e,n,!1),wh[n]=Nh,e},Dh=Wr,kh=l,Mh=Mi,Uh=B,Lh=Ph,xh=vh,Vh=en,Fh=Go,Bh=Xt,jh=Yt.exports,Gh=hc,Hh=Mh.PROPER,zh=Mh.CONFIGURABLE,Kh=Ih.IteratorPrototype,Wh=Ih.BUGGY_SAFARI_ITERATORS,Xh=$e("iterator"),Yh="keys",qh="values",Jh="entries",Qh=function(){return this},Zh=function(e,t,i,r,n,o,a){Lh(i,t,r);var s,c,u,d=function(e){if(e===n&&f)return f;if(!Wh&&e in p)return p[e];switch(e){case Yh:case qh:case Jh:return function(){return new i(this,e)}}return function(){return new i(this)}},l=t+" Iterator",h=!1,p=e.prototype,_=p[Xh]||p["@@iterator"]||n&&p[n],f=!Wh&&_||d(n),v="Array"==t&&p.entries||_;if(v&&(s=xh(v.call(new e)))!==Object.prototype&&s.next&&(xh(s)!==Kh&&(Vh?Vh(s,Kh):Uh(s[Xh])||jh(s,Xh,Qh)),Fh(s,l,!0)),Hh&&n==qh&&_&&_.name!==qh&&(zh?Bh(p,"name",qh):(h=!0,f=function(){return kh(_,this)})),n)if(c={values:d(qh),keys:o?f:d(Yh),entries:d(Jh)},a)for(u in c)(Wh||h||!(u in p))&&jh(p,u,c[u]);else Dh({target:t,proto:!0,forced:Wh||h},c);return p[Xh]!==f&&jh(p,Xh,f,{name:n}),Gh[t]=f,c},$h=F,ep=ah,tp=hc,ip=Oi,rp=Ct.f,np=Zh,op=s,ap="Array Iterator",sp=ip.set,cp=ip.getterFor(ap),up=np(Array,"Array",(function(e,t){sp(this,{type:ap,target:$h(e),index:0,kind:t})}),(function(){var e=cp(this),t=e.target,i=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:r,done:!1}:"values"==i?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),dp=tp.Arguments=tp.Array;if(ep("keys"),ep("values"),ep("entries"),op&&"values"!==dp.name)try{rp(dp,"name",{value:"values"})}catch(e){}var lp=I,hp=Yi,pp=_o,_p=L,fp=lp("".charAt),vp=lp("".charCodeAt),mp=lp("".slice),Sp=function(e){return function(t,i){var r,n,o=pp(_p(t)),a=hp(i),s=o.length;return a<0||a>=s?e?"":void 0:(r=vp(o,a))<55296||r>56319||a+1===s||(n=vp(o,a+1))<56320||n>57343?e?fp(o,a):r:e?mp(o,a,a+2):n-56320+(r-55296<<10)+65536}},yp={codeAt:Sp(!1),charAt:Sp(!0)},gp=yp.charAt,Ep=_o,bp=Oi,Tp=Zh,Ip="String Iterator",Rp=bp.set,Ap=bp.getterFor(Ip);Tp(String,"String",(function(e){Rp(this,{type:Ip,string:Ep(e),index:0})}),(function(){var e,t=Ap(this),i=t.string,r=t.index;return r>=i.length?{value:void 0,done:!0}:(e=gp(i,r),t.index+=e.length,{value:e,done:!1})}));var Cp={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},Op=ft("span").classList,wp=Op&&Op.constructor&&Op.constructor.prototype,Np=wp===Object.prototype?void 0:wp,Pp=n,Dp=Cp,kp=Np,Mp=up,Up=Xt,Lp=$e,xp=Lp("iterator"),Vp=Lp("toStringTag"),Fp=Mp.values,Bp=function(e,t){if(e){if(e[xp]!==Fp)try{Up(e,xp,Fp)}catch(t){e[xp]=Fp}if(e[Vp]||Up(e,Vp,t),Dp[t])for(var i in Mp)if(e[i]!==Mp[i])try{Up(e,i,Mp[i])}catch(t){e[i]=Mp[i]}}};for(var jp in Dp)Bp(Pp[jp]&&Pp[jp].prototype,jp);Bp(kp,"DOMTokenList");var Gp=a,Hp=te,zp=$e("species"),Kp=function(e){return Hp>=51||!Gp((function(){var t=[];return(t.constructor={})[zp]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Wp=Wr,Xp=n,Yp=a,qp=eo,Jp=G,Qp=Me,Zp=rr,$p=yo,e_=_a,t_=Kp,i_=te,r_=$e("isConcatSpreadable"),n_=9007199254740991,o_="Maximum allowed index exceeded",a_=Xp.TypeError,s_=i_>=51||!Yp((function(){var e=[];return e[r_]=!1,e.concat()[0]!==e})),c_=t_("concat"),u_=function(e){if(!Jp(e))return!1;var t=e[r_];return void 0!==t?!!t:qp(e)};Wp({target:"Array",proto:!0,forced:!s_||!c_},{concat:function(e){var t,i,r,n,o,a=Qp(this),s=e_(a,0),c=0;for(t=-1,r=arguments.length;t<r;t++)if(u_(o=-1===t?a:arguments[t])){if(c+(n=Zp(o))>n_)throw a_(o_);for(i=0;i<n;i++,c++)i in o&&$p(s,c,o[i])}else{if(c>=n_)throw a_(o_);$p(s,c++,o)}return s.length=c,s}});var d_=Wr,l_=n,h_=eo,p_=aa,__=G,f_=Zi,v_=rr,m_=F,S_=yo,y_=$e,g_=Po,E_=Kp("slice"),b_=y_("species"),T_=l_.Array,I_=Math.max;d_({target:"Array",proto:!0,forced:!E_},{slice:function(e,t){var i,r,n,o=m_(this),a=v_(o),s=f_(e,a),c=f_(void 0===t?a:t,a);if(h_(o)&&(i=o.constructor,(p_(i)&&(i===T_||h_(i.prototype))||__(i)&&null===(i=i[b_]))&&(i=void 0),i===T_||void 0===i))return g_(o,s,c);for(r=new(void 0===i?T_:i)(I_(c-s,0)),n=0;s<c;s++,n++)s in o&&S_(r,n,o[s]);return r.length=n,r}}),Vo("asyncIterator");var R_=function(e,t){return R_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},R_(e,t)};function A_(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}R_(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var C_,O_,w_,N_,P_,D_,k_,M_,U_,L_,x_,V_,F_,B_,j_,G_,H_,z_,K_,W_,X_,Y_,q_,J_,Q_,Z_=function(){return Z_=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},Z_.apply(this,arguments)};function $_(e,i,r,n){var o,a=arguments.length,s=a<3?i:null===n?n=Object.getOwnPropertyDescriptor(i,r):n;if("object"===("undefined"==typeof Reflect?"undefined":t(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,i,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(s=(a<3?o(s):a>3?o(i,r,s):o(i,r))||s);return a>3&&s&&Object.defineProperty(i,r,s),s}function ef(e,t,i,r){return new(i||(i=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function tf(e,t){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function rf(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],r=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function nf(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var r,n,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return a}function of(e,t,i){if(i||2===arguments.length)for(var r,n=0,o=t.length;n<o;n++)!r&&n in t||(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(C_||(C_={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(O_||(O_={})),function(e){e[e.QUIT=0]="QUIT",e[e.DROPPED=1]="DROPPED",e[e.SWITCH_TO_INVISIBLE=2]="SWITCH_TO_INVISIBLE",e[e.KICKED_BY_ADMIN=3]="KICKED_BY_ADMIN"}(w_||(w_={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(N_||(N_={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(P_||(P_={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(D_||(D_={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(k_||(k_={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(M_||(M_={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(U_||(U_={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(L_||(L_={})),function(e){e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO"}(x_||(x_={})),function(e){e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER"}(V_||(V_={})),function(e){e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED",e[e.CONNECTION_STATE_LOST=6]="CONNECTION_STATE_LOST"}(F_||(F_={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(B_||(B_={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(j_||(j_={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(G_||(G_={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY"}(H_||(H_={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(z_||(z_={})),function(e){e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY"}(K_||(K_={})),function(e){e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH"}(W_||(W_={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(X_||(X_={})),function(e){e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth"}(Y_||(Y_={})),function(e){e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom"}(q_||(q_={})),function(e){e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono"}(J_||(J_={})),function(e){e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY"}(Q_||(Q_={}));var af,sf,cf,uf=Object.freeze({__proto__:null,get VideoSourceType(){return C_},get AudioSourceType(){return O_},get UserOfflineReason(){return w_},get ChannelProfile(){return N_},get SubscribeMode(){return P_},get SubscribeState(){return D_},get PublishState(){return k_},get MirrorMode(){return M_},get VideoRenderMode(){return U_},get StreamIndex(){return L_},get MediaType(){return x_},get StreamRemoveReason(){return V_},get ConnectionState(){return F_},get MirrorType(){return B_},get LogChannel(){return j_},get USER_ONLINE_STATUS(){return G_},get PublicStreamType(){return H_},get PublicInterpolationMode(){return z_},get SubscribeFallbackOption(){return K_},get RemoteUserPriority(){return W_},get NetworkQuality(){return X_},get FallbackOrRecoverReason(){return Y_},get RoomProfileType(){return q_},get AudioProfileType(){return J_},get RTCAutoPlayPolicy(){return Q_}});!function(e){e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX"}(af||(af={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(sf||(sf={})),function(e){e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED"}(cf||(cf={}));var df,lf,hf=Object.freeze({__proto__:null,get AudioMixingDualMonoMode(){return af},get AudioMixingType(){return sf},get AudioMixingState(){return cf}});!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onServerParamsSetResult="onServerParamsSetResult"}(df||(df={})),function(e){e[e.ERR_OK=0]="ERR_OK",e[e.ERR_PARAM_INVALID=1]="ERR_PARAM_INVALID",e[e.ERR_FRAME_TIMEOUT=2]="ERR_FRAME_TIMEOUT",e[e.ERR_POSTPROCESS=3]="ERR_POSTPROCESS",e[e.ERR_PUSH_CDN=4]="ERR_PUSH_CDN",e[e.ERR_UNKNOWN=9999]="ERR_UNKNOWN"}(lf||(lf={}));var pf=ba.forEach,_f=jn("forEach")?[].forEach:function(e){return pf(this,e,arguments.length>1?arguments[1]:void 0)};Wr({target:"Array",proto:!0,forced:[].forEach!=_f},{forEach:_f});var ff=n,vf=Cp,mf=Np,Sf=_f,yf=Xt,gf=function(e){if(e&&e.forEach!==Sf)try{yf(e,"forEach",Sf)}catch(t){e.forEach=Sf}};for(var Ef in vf)vf[Ef]&&gf(ff[Ef]&&ff[Ef].prototype);gf(mf);var bf=Wr,Tf=I,If=n.Date,Rf=Tf(If.prototype.getTime);bf({target:"Date",stat:!0},{now:function(){return Rf(new If)}});var Af=I,Cf=Yt.exports,Of=Date.prototype,wf="Invalid Date",Nf="toString",Pf=Af(Of.toString),Df=Af(Of.getTime);String(new Date(NaN))!=wf&&Cf(Of,Nf,(function(){var e=Df(this);return e==e?Pf(this):wf}));var kf=cr.includes,Mf=ah;Wr({target:"Array",proto:!0},{includes:function(e){return kf(this,e,arguments.length>1?arguments[1]:void 0)}}),Mf("includes");var Uf=G,Lf=O,xf=$e("match"),Vf=function(e){var t;return Uf(e)&&(void 0!==(t=e[xf])?!!t:"RegExp"==Lf(e))},Ff=Vf,Bf=n.TypeError,jf=function(e){if(Ff(e))throw Bf("The method doesn't accept regular expressions");return e},Gf=$e("match"),Hf=function(e){var t=/./;try{"/./"[e](t)}catch(i){try{return t[Gf]=!1,"/./"[e](t)}catch(e){}}return!1},zf=Wr,Kf=jf,Wf=L,Xf=_o,Yf=Hf,qf=I("".indexOf);zf({target:"String",proto:!0,forced:!Yf("includes")},{includes:function(e){return!!~qf(Xf(Wf(this)),Xf(Kf(e)),arguments.length>1?arguments[1]:void 0)}});var Jf=kt,Qf=function(){var e=Jf(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},Zf=a,$f=n.RegExp,ev=Zf((function(){var e=$f("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),tv=ev||Zf((function(){return!$f("a","y").sticky})),iv={BROKEN_CARET:ev||Zf((function(){var e=$f("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:tv,UNSUPPORTED_Y:ev},rv=a,nv=n.RegExp,ov=rv((function(){var e=nv(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),av=a,sv=n.RegExp,cv=av((function(){var e=sv("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),uv=l,dv=I,lv=_o,hv=Qf,pv=iv,_v=Ie.exports,fv=Rn,vv=Oi.get,mv=ov,Sv=cv,yv=_v("native-string-replace",String.prototype.replace),gv=RegExp.prototype.exec,Ev=gv,bv=dv("".charAt),Tv=dv("".indexOf),Iv=dv("".replace),Rv=dv("".slice),Av=function(){var e=/a/,t=/b*/g;return uv(gv,e,"a"),uv(gv,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Cv=pv.BROKEN_CARET,Ov=void 0!==/()??/.exec("")[1];(Av||Ov||Cv||mv||Sv)&&(Ev=function(e){var t,i,r,n,o,a,s,c=this,u=vv(c),d=lv(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=uv(Ev,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=Cv&&c.sticky,_=uv(hv,c),f=c.source,v=0,m=d;if(p&&(_=Iv(_,"y",""),-1===Tv(_,"g")&&(_+="g"),m=Rv(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==bv(d,c.lastIndex-1))&&(f="(?: "+f+")",m=" "+m,v++),i=new RegExp("^(?:"+f+")",_)),Ov&&(i=new RegExp("^"+f+"$(?!\\s)",_)),Av&&(r=c.lastIndex),n=uv(gv,p?i:c,m),p?n?(n.input=Rv(n.input,v),n[0]=Rv(n[0],v),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:Av&&n&&(c.lastIndex=c.global?n.index+n[0].length:r),Ov&&n&&n.length>1&&uv(yv,n[0],i,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n&&h)for(n.groups=a=fv(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=n[s[1]];return n});var wv=Ev;Wr({target:"RegExp",proto:!0,forced:/./.exec!==wv},{exec:wv});var Nv=I,Pv=Yt.exports,Dv=wv,kv=a,Mv=$e,Uv=Xt,Lv=Mv("species"),xv=RegExp.prototype,Vv=function(e,t,i,r){var n=Mv(e),o=!kv((function(){var t={};return t[n]=function(){return 7},7!=""[e](t)})),a=o&&!kv((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[Lv]=function(){return i},i.flags="",i[n]=/./[n]),i.exec=function(){return t=!0,null},i[n](""),!t}));if(!o||!a||i){var s=Nv(/./[n]),c=t(n,""[e],(function(e,t,i,r,n){var a=Nv(e),c=t.exec;return c===Dv||c===xv.exec?o&&!n?{done:!0,value:s(t,i,r)}:{done:!0,value:a(i,t,r)}:{done:!1}}));Pv(String.prototype,e,c[0]),Pv(xv,n,c[1])}r&&Uv(xv[n],"sham",!0)},Fv=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Bv=l,jv=kt,Gv=B,Hv=O,zv=wv,Kv=n.TypeError,Wv=function(e,t){var i=e.exec;if(Gv(i)){var r=Bv(i,e,t);return null!==r&&jv(r),r}if("RegExp"===Hv(e))return Bv(zv,e,t);throw Kv("RegExp#exec called on incompatible receiver")},Xv=l,Yv=kt,qv=L,Jv=Fv,Qv=_o,Zv=ye,$v=Wv;function em(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}Vv("search",(function(e,t,i){return[function(t){var i=qv(this),r=null==t?void 0:Zv(t,e);return r?Xv(r,t,i):new RegExp(t)[e](Qv(i))},function(e){var r=Yv(this),n=Qv(e),o=i(t,r,n);if(o.done)return o.value;var a=r.lastIndex;Jv(a,0)||(r.lastIndex=0);var s=$v(r,n);return Jv(r.lastIndex,a)||(r.lastIndex=a),null===s?-1:s.index}]}));var tm=yp.charAt,im=function(e,t,i){return t+(i?tm(e,t).length:1)},rm=l,nm=kt,om=tr,am=_o,sm=L,cm=ye,um=im,dm=Wv;Vv("match",(function(e,t,i){return[function(t){var i=sm(this),r=null==t?void 0:cm(t,e);return r?rm(r,t,i):new RegExp(t)[e](am(i))},function(e){var r=nm(this),n=am(e),o=i(t,r,n);if(o.done)return o.value;if(!r.global)return dm(r,n);var a=r.unicode;r.lastIndex=0;for(var s,c=[],u=0;null!==(s=dm(r,n));){var d=am(s[0]);c[u]=d,""===d&&(r.lastIndex=um(n,om(r.lastIndex),a)),u++}return 0===u?null:c}]}));var lm="\t\n\v\f\r \u2028\u2029\ufeff",hm=L,pm=_o,_m=I("".replace),fm="[\t\n\v\f\r \u2028\u2029\ufeff]",vm=RegExp("^"+fm+fm+"*"),mm=RegExp(fm+fm+"*$"),Sm=function(e){return function(t){var i=pm(hm(t));return 1&e&&(i=_m(i,vm,"")),2&e&&(i=_m(i,mm,"")),i}},ym={start:Sm(1),end:Sm(2),trim:Sm(3)},gm=n,Em=a,bm=I,Tm=_o,Im=ym.trim,Rm=lm,Am=gm.parseInt,Cm=gm.Symbol,Om=Cm&&Cm.iterator,wm=/^[+-]?0x/i,Nm=bm(wm.exec),Pm=8!==Am(Rm+"08")||22!==Am(Rm+"0x16")||Om&&!Em((function(){Am(Object(Om))}))?function(e,t){var i=Im(Tm(e));return Am(i,t>>>0||(Nm(wm,i)?16:10))}:Am;Wr({global:!0,forced:parseInt!=Pm},{parseInt:Pm});var Dm={exports:{}},km=a((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Mm=a,Um=G,Lm=O,xm=km,Vm=Object.isExtensible,Fm=Mm((function(){Vm(1)}))||xm?function(e){return!!Um(e)&&((!xm||"ArrayBuffer"!=Lm(e))&&(!Vm||Vm(e)))}:Vm,Bm=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),jm=Wr,Gm=I,Hm=di,zm=G,Km=xe,Wm=Ct.f,Xm=Ki,Ym=fo,qm=Fm,Jm=Bm,Qm=!1,Zm=Ge("meta"),$m=0,eS=function(e){Wm(e,Zm,{value:{objectID:"O"+$m++,weakData:{}}})},tS=Dm.exports={enable:function(){tS.enable=function(){},Qm=!0;var e=Xm.f,t=Gm([].splice),i={};i[Zm]=1,e(i).length&&(Xm.f=function(i){for(var r=e(i),n=0,o=r.length;n<o;n++)if(r[n]===Zm){t(r,n,1);break}return r},jm({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Ym.f}))},fastKey:function(e,t){if(!zm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Km(e,Zm)){if(!qm(e))return"F";if(!t)return"E";eS(e)}return e[Zm].objectID},getWeakData:function(e,t){if(!Km(e,Zm)){if(!qm(e))return!0;if(!t)return!1;eS(e)}return e[Zm].weakData},onFreeze:function(e){return Jm&&Qm&&qm(e)&&!Km(e,Zm)&&eS(e),e}};Hm[Zm]=!0;var iS=B,rS=G,nS=en,oS=function(e,t,i){var r,n;return nS&&iS(r=t.constructor)&&r!==i&&rS(n=r.prototype)&&n!==i.prototype&&nS(e,n),e},aS=Wr,sS=n,cS=I,uS=Vr,dS=Yt.exports,lS=Dm.exports,hS=Wc,pS=lc,_S=B,fS=G,vS=a,mS=tu,SS=Go,yS=oS,gS=function(e,t,i){var r=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=r?"set":"add",a=sS[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=cS(s[e]);dS(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(n&&!fS(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return n&&!fS(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(n&&!fS(e))&&t(this,0===e?0:e)}:function(e,i){return t(this,0===e?0:e,i),this})};if(uS(e,!_S(a)||!(n||s.forEach&&!vS((function(){(new a).entries().next()})))))c=i.getConstructor(t,e,r,o),lS.enable();else if(uS(e,!0)){var l=new c,h=l[o](n?{}:-0,1)!=l,p=vS((function(){l.has(1)})),_=mS((function(e){new a(e)})),f=!n&&vS((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));_||((c=t((function(e,t){pS(e,s);var i=yS(new a,e,c);return null!=t&&hS(t,i[o],{that:i,AS_ENTRIES:r}),i}))).prototype=s,s.constructor=c),(p||f)&&(d("delete"),d("has"),r&&d("get")),(f||h)&&d(o),n&&s.clear&&delete s.clear}return u[e]=c,aS({global:!0,forced:c!=a},u),SS(c,e),n||i.setStrong(c,e,r),c},ES=Ct.f,bS=Rn,TS=rc,IS=Wo,RS=lc,AS=Wc,CS=Zh,OS=cc,wS=s,NS=Dm.exports.fastKey,PS=Oi.set,DS=Oi.getterFor,kS={getConstructor:function(e,t,i,r){var n=e((function(e,n){RS(e,o),PS(e,{type:t,index:bS(null),first:void 0,last:void 0,size:0}),wS||(e.size=0),null!=n&&AS(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=DS(t),s=function(e,t,i){var r,n,o=a(e),s=c(e,t);return s?s.value=i:(o.last=s={index:n=NS(t,!0),key:t,value:i,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=s),r&&(r.next=s),wS?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},c=function(e,t){var i,r=a(e),n=NS(t);if("F"!==n)return r.index[n];for(i=r.first;i;i=i.next)if(i.key==t)return i};return TS(o,{clear:function(){for(var e=a(this),t=e.index,i=e.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete t[i.index],i=i.next;e.first=e.last=void 0,wS?e.size=0:this.size=0},delete:function(e){var t=this,i=a(t),r=c(t,e);if(r){var n=r.next,o=r.previous;delete i.index[r.index],r.removed=!0,o&&(o.next=n),n&&(n.previous=o),i.first==r&&(i.first=n),i.last==r&&(i.last=o),wS?i.size--:t.size--}return!!r},forEach:function(e){for(var t,i=a(this),r=IS(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:i.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),TS(o,i?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),wS&&ES(o,"size",{get:function(){return a(this).size}}),n},setStrong:function(e,t,i){var r=t+" Iterator",n=DS(t),o=DS(r);CS(e,t,(function(e,t){PS(this,{type:r,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,i=e.last;i&&i.removed;)i=i.previous;return e.target&&(e.last=i=i?i.next:e.state.first)?"keys"==t?{value:i.key,done:!1}:"values"==t?{value:i.value,done:!1}:{value:[i.key,i.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),i?"entries":"values",!i,!0),OS(t)}};gS("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),kS);var MS=Me,US=on;Wr({target:"Object",stat:!0,forced:a((function(){US(1)}))},{keys:function(e){return US(MS(e))}});var LS=me,xS=Me,VS=M,FS=rr,BS=n.TypeError,jS=function(e){return function(t,i,r,n){LS(i);var o=xS(t),a=VS(o),s=FS(o),c=e?s-1:0,u=e?-1:1;if(r<2)for(;;){if(c in a){n=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw BS("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(n=i(n,a[c],c,o));return n}},GS={left:jS(!1),right:jS(!0)},HS=GS.left,zS=te,KS=pu;Wr({target:"Array",proto:!0,forced:!jn("reduce")||!KS&&zS>79&&zS<83},{reduce:function(e){var t=arguments.length;return HS(this,e,t,t>1?arguments[1]:void 0)}});var WS,XS=Wr,YS=I,qS=o.f,JS=tr,QS=_o,ZS=jf,$S=L,ey=Hf,ty=YS("".endsWith),iy=YS("".slice),ry=Math.min,ny=ey("endsWith");XS({target:"String",proto:!0,forced:!!(ny||(WS=qS(String.prototype,"endsWith"),!WS||WS.writable))&&!ny},{endsWith:function(e){var t=QS($S(this));ZS(e);var i=arguments.length>1?arguments[1]:void 0,r=t.length,n=void 0===i?r:ry(JS(i),r),o=QS(e);return ty?ty(t,o,n):iy(t,n-o.length,n)===o}});var oy=!0,ay=!0;function sy(e,t,i){var r=e.match(t);return r&&r.length>=i&&parseInt(r[i],10)}function cy(e,t,i){if(e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,n=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return n.apply(this,arguments);var o=function(e){var t=i(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),n.apply(this,[e,o])};var o=r.removeEventListener;r.removeEventListener=function(e,i){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(i))return o.apply(this,arguments);var r=this._eventMap[t].get(i);return this._eventMap[t].delete(i),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get:function(){return this["_on"+t]},set:function(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 uy(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(oy=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function dy(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(ay=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function ly(){if("object"===("undefined"==typeof window?"undefined":t(window))){if(oy)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function hy(e,t){ay&&console.warn(e+" is deprecated, please use "+t+" instead.")}function py(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var i=e.navigator;if(i.mozGetUserMedia)t.browser="firefox",t.version=sy(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=sy(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!i.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=sy(i.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function _y(e){return"[object Object]"===Object.prototype.toString.call(e)}function fy(e){return _y(e)?Object.keys(e).reduce((function(t,i){var r=_y(e[i]),n=r?fy(e[i]):e[i],o=r&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,em({},i,n))}),{}):e}function vy(e,t,i){t&&!i.has(t.id)&&(i.set(t.id,t),Object.keys(t).forEach((function(r){r.endsWith("Id")?vy(e,e.get(t[r]),i):r.endsWith("Ids")&&t[r].forEach((function(t){vy(e,e.get(t),i)}))})))}function my(e,t,i){var r=i?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(i){i.type===r&&i.trackId===t.id&&vy(e,i,n)}))})),n}var Sy=Wr,yy=ba.find,gy=ah,Ey="find",by=!0;Ey in[]&&Array(1).find((function(){by=!1})),Sy({target:"Array",proto:!0,forced:by},{find:function(e){return yy(this,e,arguments.length>1?arguments[1]:void 0)}}),gy(Ey);var Ty=Wr,Iy=n,Ry=Zi,Ay=Yi,Cy=rr,Oy=Me,wy=_a,Ny=yo,Py=Kp("splice"),Dy=Iy.TypeError,ky=Math.max,My=Math.min,Uy=9007199254740991,Ly="Maximum allowed length exceeded";Ty({target:"Array",proto:!0,forced:!Py},{splice:function(e,t){var i,r,n,o,a,s,c=Oy(this),u=Cy(c),d=Ry(e,u),l=arguments.length;if(0===l?i=r=0:1===l?(i=0,r=u-d):(i=l-2,r=My(ky(Ay(t),0),u-d)),u+i-r>Uy)throw Dy(Ly);for(n=wy(c,r),o=0;o<r;o++)(a=d+o)in c&&Ny(n,o,c[a]);if(n.length=r,i<r){for(o=d;o<u-r;o++)s=o+i,(a=o+r)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-r+i;o--)delete c[o-1]}else if(i>r)for(o=u-r;o>d;o--)s=o+i-1,(a=o+r-1)in c?c[s]=c[a]:delete c[s];for(o=0;o<i;o++)c[o+d]=arguments[o+2];return c.length=u-r+i,n}});var xy=ba.map;Wr({target:"Array",proto:!0,forced:!Kp("map")},{map:function(e){return xy(this,e,arguments.length>1?arguments[1]:void 0)}});var Vy=ba.filter;Wr({target:"Array",proto:!0,forced:!Kp("filter")},{filter:function(e){return Vy(this,e,arguments.length>1?arguments[1]:void 0)}});var Fy=I,By=Me,jy=Math.floor,Gy=Fy("".charAt),Hy=Fy("".replace),zy=Fy("".slice),Ky=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,Wy=/\$([$&'`]|\d{1,2})/g,Xy=Zn,Yy=l,qy=I,Jy=Vv,Qy=a,Zy=kt,$y=B,eg=Yi,tg=tr,ig=_o,rg=L,ng=im,og=ye,ag=function(e,t,i,r,n,o){var a=i+e.length,s=r.length,c=Wy;return void 0!==n&&(n=By(n),c=Ky),Hy(o,c,(function(o,c){var u;switch(Gy(c,0)){case"$":return"$";case"&":return e;case"`":return zy(t,0,i);case"'":return zy(t,a);case"<":u=n[zy(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=jy(d/10);return 0===l?o:l<=s?void 0===r[l-1]?Gy(c,1):r[l-1]+Gy(c,1):o}u=r[d-1]}return void 0===u?"":u}))},sg=Wv,cg=$e("replace"),ug=Math.max,dg=Math.min,lg=qy([].concat),hg=qy([].push),pg=qy("".indexOf),_g=qy("".slice),fg="$0"==="a".replace(/./,"$0"),vg=!!/./[cg]&&""===/./[cg]("a","$0");Jy("replace",(function(e,t,i){var r=vg?"$":"$0";return[function(e,i){var r=rg(this),n=null==e?void 0:og(e,cg);return n?Yy(n,e,r,i):Yy(t,ig(r),e,i)},function(e,n){var o=Zy(this),a=ig(e);if("string"==typeof n&&-1===pg(n,r)&&-1===pg(n,"$<")){var s=i(t,o,a,n);if(s.done)return s.value}var c=$y(n);c||(n=ig(n));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=sg(o,a);if(null===h)break;if(hg(l,h),!u)break;""===ig(h[0])&&(o.lastIndex=ng(a,tg(o.lastIndex),d))}for(var p,_="",f=0,v=0;v<l.length;v++){for(var m=ig((h=l[v])[0]),S=ug(dg(eg(h.index),a.length),0),y=[],g=1;g<h.length;g++)hg(y,void 0===(p=h[g])?p:String(p));var E=h.groups;if(c){var b=lg([m],y,S,a);void 0!==E&&hg(b,E);var T=ig(Xy(n,void 0,b))}else T=ag(m,a,S,y,E,n);S>=f&&(_+=_g(a,f,S)+T,f=S+m.length)}return _+_g(a,f)}]}),!!Qy((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!fg||vg);var mg=s,Sg=n,yg=I,gg=Vr,Eg=oS,bg=Xt,Tg=Ct.f,Ig=Ki.f,Rg=X,Ag=Vf,Cg=_o,Og=Qf,wg=iv,Ng=Yt.exports,Pg=a,Dg=xe,kg=Oi.enforce,Mg=cc,Ug=ov,Lg=cv,xg=$e("match"),Vg=Sg.RegExp,Fg=Vg.prototype,Bg=Sg.SyntaxError,jg=yg(Og),Gg=yg(Fg.exec),Hg=yg("".charAt),zg=yg("".replace),Kg=yg("".indexOf),Wg=yg("".slice),Xg=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Yg=/a/g,qg=/a/g,Jg=new Vg(Yg)!==Yg,Qg=wg.MISSED_STICKY,Zg=wg.UNSUPPORTED_Y,$g=mg&&(!Jg||Qg||Ug||Lg||Pg((function(){return qg[xg]=!1,Vg(Yg)!=Yg||Vg(qg)==qg||"/a/i"!=Vg(Yg,"i")})));if(gg("RegExp",$g)){for(var eE=function(e,t){var i,r,n,o,a,s,c=Rg(Fg,this),u=Ag(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===eE)return e;if((u||Rg(Fg,e))&&(e=e.source,d&&(t="flags"in h?h.flags:jg(h))),e=void 0===e?"":Cg(e),t=void 0===t?"":Cg(t),h=e,Ug&&"dotAll"in Yg&&(r=!!t&&Kg(t,"s")>-1)&&(t=zg(t,/s/g,"")),i=t,Qg&&"sticky"in Yg&&(n=!!t&&Kg(t,"y")>-1)&&Zg&&(t=zg(t,/y/g,"")),Lg&&(o=function(e){for(var t,i=e.length,r=0,n="",o=[],a={},s=!1,c=!1,u=0,d="";r<=i;r++){if("\\"===(t=Hg(e,r)))t+=Hg(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:Gg(Xg,Wg(e,r+1))&&(r+=2,c=!0),n+=t,u++;continue;case">"===t&&c:if(""===d||Dg(a,d))throw new Bg("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:n+=t}return[n,o]}(e),e=o[0],l=o[1]),a=Eg(Vg(e,t),c?this:Fg,eE),(r||n||l.length)&&(s=kg(a),r&&(s.dotAll=!0,s.raw=eE(function(e){for(var t,i=e.length,r=0,n="",o=!1;r<=i;r++)"\\"!==(t=Hg(e,r))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+Hg(e,++r);return n}(e),i)),n&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{bg(a,"source",""===h?"(?:)":h)}catch(e){}return a},tE=function(e){e in eE||Tg(eE,e,{configurable:!0,get:function(){return Vg[e]},set:function(t){Vg[e]=t}})},iE=Ig(Vg),rE=0;iE.length>rE;)tE(iE[rE++]);Fg.constructor=eE,eE.prototype=Fg,Ng(Sg,"RegExp",eE)}Mg("RegExp");var nE=I,oE=Mi.PROPER,aE=Yt.exports,sE=kt,cE=X,uE=_o,dE=a,lE=Qf,hE="toString",pE=RegExp.prototype,_E=pE.toString,fE=nE(lE),vE=dE((function(){return"/a/b"!=_E.call({source:"a",flags:"b"})})),mE=oE&&_E.name!=hE;(vE||mE)&&aE(RegExp.prototype,hE,(function(){var e=sE(this),t=uE(e.source),i=e.flags;return"/"+t+"/"+uE(void 0===i&&cE(pE,e)&&!("flags"in pE)?fE(e):i)}),{unsafe:!0});var SE=ba.some;Wr({target:"Array",proto:!0,forced:!jn("some")},{some:function(e){return SE(this,e,arguments.length>1?arguments[1]:void 0)}});var yE=s,gE=Mi.EXISTS,EE=I,bE=Ct.f,TE=Function.prototype,IE=EE(TE.toString),RE=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,AE=EE(RE.exec);yE&&!gE&&bE(TE,"name",{configurable:!0,get:function(){try{return AE(RE,IE(this))[1]}catch(e){return""}}});var CE=I,OE=me,wE=G,NE=xe,PE=Po,DE=c,kE=n.Function,ME=CE([].concat),UE=CE([].join),LE={},xE=function(e,t,i){if(!NE(LE,t)){for(var r=[],n=0;n<t;n++)r[n]="a["+n+"]";LE[t]=kE("C,a","return new C("+UE(r,",")+")")}return LE[t](e,i)},VE=DE?kE.bind:function(e){var t=OE(this),i=t.prototype,r=PE(arguments,1),n=function(){var i=ME(r,PE(arguments));return this instanceof n?xE(t,i.length,i):t.apply(e,i)};return wE(i)&&(n.prototype=i),n},FE=VE;Wr({target:"Function",proto:!0,forced:Function.bind!==FE},{bind:FE});var BE=ly;function jE(e,i){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==t(e)||e.mandatory||e.optional)return e;var i={};return Object.keys(e).forEach((function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"===t(e[r])?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){i.optional=i.optional||[];var a={};"number"==typeof n.ideal?(a[o("min",r)]=n.ideal,i.optional.push(a),(a={})[o("max",r)]=n.ideal,i.optional.push(a)):(a[o("",r)]=n.ideal,i.optional.push(a))}void 0!==n.exact&&"number"!=typeof n.exact?(i.mandatory=i.mandatory||{},i.mandatory[o("",r)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(i.mandatory=i.mandatory||{},i.mandatory[o(e,r)]=n[e])}))}})),e.advanced&&(i.optional=(i.optional||[]).concat(e.advanced)),i},o=function(e,o){if(i.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===t(e.audio)){var a=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])};a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===t(e.video)){var s=e.video.facingMode;s=s&&("object"===t(s)?s:{ideal:s});var c,u=i.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||u))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?c=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(c=["front"]),c)return r.mediaDevices.enumerateDevices().then((function(t){var i=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return c.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!i&&t.length&&c.includes("back")&&(i=t[t.length-1]),i&&(e.video.deviceId=s.exact?{exact:i.deviceId}:{ideal:i.deviceId}),e.video=n(e.video),BE("chrome: "+JSON.stringify(e)),o(e)}));e.video=n(e.video)}return BE("chrome: "+JSON.stringify(e)),o(e)},a=function(e){return i.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:function(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,i){o(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){i&&i(a(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return o(e,(function(e){return s(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(a(e))}))}))}}}}function GE(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function HE(e){if("object"===t(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var t=this;return this._ontrackpoly||(this._ontrackpoly=function(i){i.stream.addEventListener("addtrack",(function(r){var n;n=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===r.track.id})):{track:r.track};var o=new Event("track");o.track=r.track,o.receiver=n,o.transceiver={receiver:n},o.streams=[i.stream],t.dispatchEvent(o)})),i.stream.getTracks().forEach((function(r){var n;n=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===r.id})):{track:r};var o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=[i.stream],t.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),i.apply(this,arguments)}}else cy(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function zE(e){if("object"===t(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var i=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()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,t){var n=r.apply(this,arguments);return n||(n=i(this,e),this._senders.push(n)),n};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var o=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){t._senders.push(i(t,e))}))};var a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],a.apply(this,[e]),e.getTracks().forEach((function(e){var i=t._senders.find((function(t){return t.track===e}));i&&t._senders.splice(t._senders.indexOf(i),1)}))}}else if("object"===t(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var s=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=s.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function KE(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,i=Array.prototype.slice.call(arguments),r=i[0],n=i[1],o=i[2];if(arguments.length>0&&"function"==typeof r)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof r))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var i={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){i[t]=e.stat(t)})),t[i.id]=i})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){n(s(a(e)))};return t.apply(this,[c,r])}return new Promise((function(i,r){t.apply(e,[function(e){i(s(a(e)))},r])})).then(n,o)}}}function WE(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var i=e.RTCPeerConnection.prototype.getSenders;i&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=i.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return my(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),cy(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return my(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var o=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,i,r,n=arguments[0];return this.getSenders().forEach((function(e){e.track===n&&(t?r=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===n&&(i?r=!0:i=e),e.track===n})),r||t&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return o.apply(this,arguments)}}}}function XE(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){if(!i)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var r=t.apply(this,arguments);return this._shimmedLocalStreams[i.id]?-1===this._shimmedLocalStreams[i.id].indexOf(r)&&this._shimmedLocalStreams[i.id].push(r):this._shimmedLocalStreams[i.id]=[i,r],r};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var r=this.getSenders();i.apply(this,arguments);var n=this.getSenders().filter((function(e){return-1===r.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(n)};var r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(i){var r=t._shimmedLocalStreams[i].indexOf(e);-1!==r&&t._shimmedLocalStreams[i].splice(r,1),1===t._shimmedLocalStreams[i].length&&delete t._shimmedLocalStreams[i]})),n.apply(this,arguments)}}function YE(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return XE(e);var i=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=i.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var i=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(i.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};var n=e.RTCPeerConnection.prototype.removeStream;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,i){var r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[i.id];if(a)a.addTrack(t),Promise.resolve().then((function(){r.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[i.id]=s,this._reverseStreams[s.id]=i,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=em({},t,(function(){var e=this,t=arguments,r=arguments.length&&"function"==typeof arguments[0];return r?i.apply(this,[function(i){var r=s(e,i);t[0].apply(null,[r])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):i.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=r[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,i=this;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");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(r){i._streams[r].getTracks().find((function(t){return e.track===t}))&&(t=i._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(n.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:i})}function c(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(r.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:i})}}function qE(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=em({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}))}function JE(e,t){cy(e,"negotiationneeded",(function(e){var i=e.target;if(!(t.version<72||i.getConfiguration&&"plan-b"===i.getConfiguration().sdpSemantics)||"stable"===i.signalingState)return e}))}var QE=Object.freeze({__proto__:null,shimMediaStream:GE,shimOnTrack:HE,shimGetSendersWithDtmf:zE,shimGetStats:KE,shimSenderReceiverGetStats:WE,shimAddTrackRemoveTrackWithNative:XE,shimAddTrackRemoveTrack:YE,shimPeerConnection:qE,fixNegotiationNeeded:JE,shimGetUserMedia:jE,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(i){return t(i).then((function(t){var r=i.video&&i.video.width,n=i.video&&i.video.height,o=i.video&&i.video.frameRate;return i.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(i.video.mandatory.maxWidth=r),n&&(i.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(i)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),ZE=n,$E=a,eb=_o,tb=ym.trim,ib=I("".charAt),rb=ZE.parseFloat,nb=ZE.Symbol,ob=nb&&nb.iterator,ab=1/rb("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||ob&&!$E((function(){rb(Object(ob))}))?function(e){var t=tb(eb(e)),i=rb(t);return 0===i&&"-"==ib(t,0)?-0:i}:rb;Wr({global:!0,forced:parseFloat!=ab},{parseFloat:ab});var sb=Wr,cb=tc,ub=a,db=W,lb=B,hb=uu,pb=yd,_b=Yt.exports;if(sb({target:"Promise",proto:!0,real:!0,forced:!!cb&&ub((function(){cb.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=hb(this,db("Promise")),i=lb(e);return this.then(i?function(i){return pb(t,e()).then((function(){return i}))}:e,i?function(i){return pb(t,e()).then((function(){throw i}))}:e)}}),lb(cb)){var fb=db("Promise").prototype.finally;cb.prototype.finally!==fb&&_b(cb.prototype,"finally",fb,{unsafe:!0})}function vb(e,i){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){hy("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,i)},!(i.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var o=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])},a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===t(e)&&"object"===t(e.audio)&&(e=JSON.parse(JSON.stringify(e)),o(e.audio,"autoGainControl","mozAutoGainControl"),o(e.audio,"noiseSuppression","mozNoiseSuppression")),a(e)},n&&n.prototype.getSettings){var s=n.prototype.getSettings;n.prototype.getSettings=function(){var e=s.apply(this,arguments);return o(e,"mozAutoGainControl","autoGainControl"),o(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var c=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===t(e)&&(e=JSON.parse(JSON.stringify(e)),o(e,"autoGainControl","mozAutoGainControl"),o(e,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[e])}}}}function mb(e){"object"===t(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Sb(e,i){if("object"===t(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),i.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=em({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),t=e[0],o=e[1],a=e[2];return n.apply(this,[t||null]).then((function(e){if(i.version<53&&!o)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,i){e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function yb(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var i=e.RTCPeerConnection.prototype.getSenders;i&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=i.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function gb(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var i=e.RTCPeerConnection.prototype.getReceivers;i&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=i.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),cy(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function Eb(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;hy("removeStream","removeTrack"),this.getSenders().forEach((function(i){i.track&&e.getTracks().includes(i.track)&&t.removeTrack(i)}))})}function bb(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Tb(e){if("object"===t(e)&&e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype.addTransceiver;i&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],t=e&&"sendEncodings"in e;t&&e.sendEncodings.forEach((function(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")}));var r=i.apply(this,arguments);if(t){var n=r.sender,o=n.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,n.sendEncodings=e.sendEncodings,this.setParametersPromises.push(n.setParameters(o).then((function(){delete n.sendEncodings})).catch((function(){delete n.sendEncodings}))))}return r})}}function Ib(e){if("object"===t(e)&&e.RTCRtpSender){var i=e.RTCRtpSender.prototype.getParameters;i&&(e.RTCRtpSender.prototype.getParameters=function(){var e=i.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function Rb(e){if("object"===t(e)&&e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,t=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return i.apply(t,e)})).finally((function(){t.setParametersPromises=[]})):i.apply(this,arguments)}}}function Ab(e){if("object"===t(e)&&e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,t=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return i.apply(t,e)})).finally((function(){t.setParametersPromises=[]})):i.apply(this,arguments)}}}var Cb=Object.freeze({__proto__:null,shimOnTrack:mb,shimPeerConnection:Sb,shimSenderGetStats:yb,shimReceiverGetStats:gb,shimRemoveStream:Eb,shimRTCDataChannel:bb,shimAddTransceiver:Tb,shimGetParameters:Ib,shimCreateOffer:Rb,shimCreateAnswer:Ab,shimGetUserMedia:vb,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(i){if(!i||!i.video){var r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return!0===i.video?i.video={mediaSource:t}:i.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(i)})}});function Ob(e){if("object"===t(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)){var i=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return i.call(t,r,e)})),e.getVideoTracks().forEach((function(r){return i.call(t,r,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n&&n.forEach((function(e){t._localStreams?t._localStreams.includes(e)||t._localStreams.push(e):t._localStreams=[e]})),i.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var i=this._localStreams.indexOf(e);if(-1!==i){this._localStreams.splice(i,1);var r=e.getTracks();this.getSenders().forEach((function(e){r.includes(e.track)&&t.removeTrack(e)}))}})}}function wb(e){if("object"===t(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:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var i=new Event("addstream");i.stream=e,t.dispatchEvent(i)}}))})}});var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var i=new Event("addstream");i.stream=t,e.dispatchEvent(i)}}))}),i.apply(e,arguments)}}}function Nb(e){if("object"===t(e)&&e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype,r=i.createOffer,n=i.createAnswer,o=i.setLocalDescription,a=i.setRemoteDescription,s=i.addIceCandidate;i.createOffer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n},i.createAnswer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],r=n.apply(this,[i]);return t?(r.then(e,t),Promise.resolve()):r};var c=function(e,t,i){var r=o.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r};i.setLocalDescription=c,c=function(e,t,i){var r=a.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},i.setRemoteDescription=c,c=function(e,t,i){var r=s.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},i.addIceCandidate=c}}function Pb(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var i=t.mediaDevices,r=i.getUserMedia.bind(i);t.mediaDevices.getUserMedia=function(e){return r(Db(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,i,r){t.mediaDevices.getUserMedia(e).then(i,r)}.bind(t))}function Db(e){return e&&void 0!==e.video?Object.assign({},e,{video:fy(e.video)}):e}function kb(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,i){if(e&&e.iceServers){for(var r=[],n=0;n<e.iceServers.length;n++){var o=e.iceServers[n];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(hy("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,r.push(o)):r.push(e.iceServers[n])}e.iceServers=r}return new t(e,i)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function Mb(e){"object"===t(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Ub(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveAudio||i||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var r=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Lb(e){"object"!==t(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var xb=Object.freeze({__proto__:null,shimLocalStreamsAPI:Ob,shimRemoteStreamsAPI:wb,shimCallbacksAPI:Nb,shimGetUserMedia:Pb,shimConstraints:Db,shimRTCIceServerUrls:kb,shimTrackEventTransceiver:Mb,shimCreateOfferLegacy:Ub,shimAudioContext:Lb}),Vb=Me,Fb=ct;Wr({target:"Date",proto:!0,forced:a((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=Vb(this),i=Fb(t,"number");return"number"!=typeof i||isFinite(i)?t.toISOString():null}});var Bb=l;Wr({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Bb(URL.prototype.toString,this)}});var jb=I(1..valueOf),Gb=s,Hb=n,zb=I,Kb=Vr,Wb=Yt.exports,Xb=xe,Yb=oS,qb=X,Jb=le,Qb=ct,Zb=a,$b=Ki.f,eT=o.f,tT=Ct.f,iT=jb,rT=ym.trim,nT="Number",oT=Hb.Number,aT=oT.prototype,sT=Hb.TypeError,cT=zb("".slice),uT=zb("".charCodeAt),dT=function(e){var t=Qb(e,"number");return"bigint"==typeof t?t:lT(t)},lT=function(e){var t,i,r,n,o,a,s,c,u=Qb(e,"number");if(Jb(u))throw sT("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=rT(u),43===(t=uT(u,0))||45===t){if(88===(i=uT(u,2))||120===i)return NaN}else if(48===t){switch(uT(u,1)){case 66:case 98:r=2,n=49;break;case 79:case 111:r=8,n=55;break;default:return+u}for(a=(o=cT(u,2)).length,s=0;s<a;s++)if((c=uT(o,s))<48||c>n)return NaN;return parseInt(o,r)}return+u};if(Kb(nT,!oT(" 0o1")||!oT("0b1")||oT("+0x1"))){for(var hT,pT=function(e){var t=arguments.length<1?0:oT(dT(e)),i=this;return qb(aT,i)&&Zb((function(){iT(i)}))?Yb(Object(t),i,pT):t},_T=Gb?$b(oT):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),fT=0;_T.length>fT;fT++)Xb(oT,hT=_T[fT])&&!Xb(pT,hT)&&tT(pT,hT,eT(oT,hT));pT.prototype=aT,aT.constructor=pT,Wb(Hb,nT,pT)}var vT=Wr,mT=M,ST=F,yT=jn,gT=I([].join),ET=mT!=Object,bT=yT("join",",");vT({target:"Array",proto:!0,forced:ET||!bT},{join:function(e){return gT(ST(this),void 0===e?",":e)}});var TT=Zn,IT=l,RT=I,AT=Vv,CT=Vf,OT=kt,wT=L,NT=uu,PT=im,DT=tr,kT=_o,MT=ye,UT=Ro,LT=Wv,xT=wv,VT=a,FT=iv.UNSUPPORTED_Y,BT=4294967295,jT=Math.min,GT=[].push,HT=RT(/./.exec),zT=RT(GT),KT=RT("".slice),WT=!VT((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var i="ab".split(e);return 2!==i.length||"a"!==i[0]||"b"!==i[1]}));AT("split",(function(e,t,i){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,i){var r=kT(wT(this)),n=void 0===i?BT:i>>>0;if(0===n)return[];if(void 0===e)return[r];if(!CT(e))return IT(t,r,e,n);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=IT(xT,l,r))&&!((a=l.lastIndex)>d&&(zT(c,KT(r,d,o.index)),o.length>1&&o.index<r.length&&TT(GT,c,UT(o,1)),s=o[0].length,d=a,c.length>=n));)l.lastIndex===o.index&&l.lastIndex++;return d===r.length?!s&&HT(l,"")||zT(c,""):zT(c,KT(r,d)),c.length>n?UT(c,0,n):c}:"0".split(void 0,0).length?function(e,i){return void 0===e&&0===i?[]:IT(t,this,e,i)}:t,[function(t,i){var n=wT(this),o=null==t?void 0:MT(t,e);return o?IT(o,t,n,i):IT(r,kT(n),t,i)},function(e,n){var o=OT(this),a=kT(e),s=i(r,o,a,n,r!==t);if(s.done)return s.value;var c=NT(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(FT?"g":"y"),l=new c(FT?"^(?:"+o.source+")":o,d),h=void 0===n?BT:n>>>0;if(0===h)return[];if(0===a.length)return null===LT(l,a)?[a]:[];for(var p=0,_=0,f=[];_<a.length;){l.lastIndex=FT?0:_;var v,m=LT(l,FT?KT(a,_):a);if(null===m||(v=jT(DT(l.lastIndex+(FT?_:0)),a.length))===p)_=PT(a,_,u);else{if(zT(f,KT(a,p,_)),f.length===h)return f;for(var S=1;S<=m.length-1;S++)if(zT(f,m[S]),f.length===h)return f;_=p=v}}return zT(f,KT(a,p)),f}]}),!WT,FT);var XT=Mi.PROPER,YT=a,qT=lm,JT=ym.trim;Wr({target:"String",proto:!0,forced:function(e){return YT((function(){return!!qT[e]()||"
"!=="
"[e]()||XT&&qT[e].name!==e}))}("trim")},{trim:function(){return JT(this)}});var QT={exports:{}};!function(e){var i={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};i.localCName=i.generateIdentifier(),i.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},i.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},i.getDescription=function(e){var t=i.splitSections(e);return t&&t[0]},i.getMediaSections=function(e){var t=i.splitSections(e);return t.shift(),t},i.matchPrefix=function(e,t){return i.splitLines(e).filter((function(e){return 0===e.indexOf(t)}))},i.parseCandidate=function(e){for(var t,i={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":i.relatedAddress=t[r+1];break;case"rport":i.relatedPort=parseInt(t[r+1],10);break;case"tcptype":i.tcpType=t[r+1];break;case"ufrag":i.ufrag=t[r+1],i.usernameFragment=t[r+1];break;default:void 0===i[t[r]]&&(i[t[r]]=t[r+1])}return i},i.writeCandidate=function(e){var t=[];t.push(e.foundation);var i=e.component;"rtp"===i?t.push(1):"rtcp"===i?t.push(2):t.push(i),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(" ")},i.parseIceOptions=function(e){return e.substr(14).split(" ")},i.parseRtpMap=function(e){var t=e.substr(9).split(" "),i={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),i.name=t[0],i.clockRate=parseInt(t[1],10),i.channels=3===t.length?parseInt(t[2],10):1,i.numChannels=i.channels,i},i.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var i=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==i?"/"+i:"")+"\r\n"},i.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]}},i.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},i.parseFmtp=function(e){for(var t,i={},r=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<r.length;n++)i[(t=r[n].trim().split("="))[0].trim()]=t[1];return i},i.writeFmtp=function(e){var t="",i=e.payloadType;if(void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+i+" "+r.join(";")+"\r\n"}return t},i.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},i.writeRtcpFb=function(e){var t="",i=e.payloadType;return void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+i+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},i.parseSsrcMedia=function(e){var t=e.indexOf(" "),i={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(i.attribute=e.substr(t+1,r-t-1),i.value=e.substr(r+1)):i.attribute=e.substr(t+1),i},i.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},i.getMid=function(e){var t=i.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},i.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},i.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:i.matchPrefix(e+t,"a=fingerprint:").map(i.parseFingerprint)}},i.writeDtlsParameters=function(e,t){var i="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){i+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),i},i.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)}},i.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===t(e.keyParams)?i.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},i.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}},i.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},i.getCryptoParameters=function(e,t){return i.matchPrefix(e+t,"a=crypto:").map(i.parseCryptoLine)},i.getIceParameters=function(e,t){var r=i.matchPrefix(e+t,"a=ice-ufrag:")[0],n=i.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},i.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},i.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=i.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var o=r[n],a=i.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=i.parseRtpMap(a),c=i.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?i.parseFmtp(c[0]):{},s.rtcpFeedback=i.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(i.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return i.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(i.parseExtmap(e))})),t},i.writeRtpDescription=function(e,t){var r="";r+="m="+e+" ",r+=t.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=t.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){r+=i.writeRtpMap(e),r+=i.writeFmtp(e),r+=i.writeRtcpFb(e)}));var n=0;return t.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(r+="a=maxptime:"+n+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){r+=i.writeExtmap(e)})),r},i.parseRtpEncodingParameters=function(e){var t,r=[],n=i.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=i.matchPrefix(e,"a=ssrc:").map((function(e){return i.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=i.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(t=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var i={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&t&&(i.rtx={ssrc:t}),r.push(i),o&&((i=JSON.parse(JSON.stringify(i))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},r.push(i))}})),0===r.length&&c&&r.push({ssrc:c});var d=i.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=d}))),r},i.parseRtcpParameters=function(e){var t={},r=i.matchPrefix(e,"a=ssrc:").map((function(e){return i.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(t.cname=r.value,t.ssrc=r.ssrc);var n=i.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=0===n.length;var o=i.matchPrefix(e,"a=rtcp-mux");return t.mux=o.length>0,t},i.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},i.parseMsid=function(e){var t,r=i.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(t=r[0].substr(7).split(" "))[0],track:t[1]};var n=i.matchPrefix(e,"a=ssrc:").map((function(e){return i.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(t=n[0].value.split(" "))[0],track:t[1]}:void 0},i.parseSctpDescription=function(e){var t,r=i.parseMLine(e),n=i.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=parseInt(n[0].substr(19),10)),isNaN(t)&&(t=65536);var o=i.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var a=i.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:t}}},i.writeSctpDescription=function(e,t){var i=[];return i="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&&i.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),i.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,21)},i.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||i.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},i.getDirection=function(e,t){for(var r=i.splitLines(e),n=0;n<r.length;n++)switch(r[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[n].substr(2)}return t?i.getDirection(t):"sendrecv"},i.getKind=function(e){return i.splitLines(e)[0].split(" ")[0].substr(2)},i.isRejected=function(e){return"0"===e.split(" ",2)[1]},i.parseMLine=function(e){var t=i.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},i.parseOLine=function(e){var t=i.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},i.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=i.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},e.exports=i}(QT);var ZT=QT.exports,$T=Object.freeze(e({__proto__:null,default:ZT},[QT.exports]));function eI(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var i=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===t(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var r=new i(e),n=ZT.parseCandidate(e.candidate),o=Object.assign(r,n);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new i(e)},e.RTCIceCandidate.prototype=i.prototype,cy(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function tI(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var i=function(e){if(!e||!e.sdp)return!1;var t=ZT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=ZT.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},r=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var i=parseInt(t[1],10);return i!=i?-1:i},n=function(e){var i=65536;return"firefox"===t.browser&&(i=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),i},o=function(e,i){var r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);var n=ZT.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?r=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==i&&(r=2147483637),r},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(i(arguments[0])){var c,u=r(arguments[0]),d=n(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function iI(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return i(e,this),e},cy(e,"datachannel",(function(e){return i(e.channel,e.target),e}))}function i(e,t){var i=e.send;e.send=function(){var r=arguments[0],n=r.length||r.size||r.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 i.apply(e,arguments)}}}function rI(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(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((function(e){var i=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var i=new Event("connectionstatechange",e);t.dispatchEvent(i)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}}))}}function nI(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var r=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return i.apply(this,arguments)}}}function oI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.addIceCandidate;i&&0!==i.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function aI(e,i){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,i=arguments[0]||{};if("object"!==t(i)||i.type&&i.sdp)return r.apply(this,arguments);if(!(i={type:i.type,sdp:i.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer"}if(i.sdp||"offer"!==i.type&&"answer"!==i.type)return r.apply(this,[i]);var n="offer"===i.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var sI=Object.freeze({__proto__:null,shimRTCIceCandidate:eI,shimMaxMessageSize:tI,shimSendThrowTypeError:iI,shimConnectionState:rI,removeExtmapAllowMixed:nI,shimAddIceCandidateNullOrEmpty:oI,shimParameterlessSetLocalDescription:aI});!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},r=ly,n=py(t),o={browserDetails:n,commonShim:sI,extractVersion:sy,disableLog:uy,disableWarnings:dy,sdp:$T};switch(n.browser){case"chrome":if(!QE||!qE||!i.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=QE,oI(t,n),aI(t),jE(t,n),GE(t),qE(t,n),HE(t),YE(t,n),zE(t),KE(t),WE(t),JE(t,n),eI(t),rI(t),tI(t,n),iI(t),nI(t,n);break;case"firefox":if(!Cb||!Sb||!i.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=Cb,oI(t,n),aI(t),vb(t,n),Sb(t,n),mb(t),Eb(t),yb(t),gb(t),bb(t),Tb(t),Ib(t),Rb(t),Ab(t),eI(t),rI(t),tI(t,n),iI(t);break;case"safari":if(!xb||!i.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=xb,oI(t,n),aI(t),kb(t),Ub(t),Nb(t),Ob(t),wb(t),Mb(t),Pb(t),Lb(t),eI(t),tI(t,n),iI(t),nI(t,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var cI=Wr,uI=n,dI=Zn,lI=B,hI=Po,pI=lu,_I=/MSIE .\./.test(Y),fI=uI.Function,vI=function(e){return function(t,i){var r=pI(arguments.length,1)>2,n=lI(t)?t:fI(t),o=r?hI(arguments,2):void 0;return e(r?function(){dI(n,this,o)}:n,i)}};cI({global:!0,bind:!0,forced:_I},{setTimeout:vI(uI.setTimeout),setInterval:vI(uI.setInterval)}),Wr({target:"Array",stat:!0},{isArray:eo});var mI=Ro,SI=Math.floor,yI=function(e,t){var i=e.length,r=SI(i/2);return i<8?gI(e,t):EI(e,yI(mI(e,0,r),t),yI(mI(e,r),t),t)},gI=function(e,t){for(var i,r,n=e.length,o=1;o<n;){for(r=o,i=e[o];r&&t(e[r-1],i)>0;)e[r]=e[--r];r!==o++&&(e[r]=i)}return e},EI=function(e,t,i,r){for(var n=t.length,o=i.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?r(t[a],i[s])<=0?t[a++]:i[s++]:a<n?t[a++]:i[s++];return e},bI=yI,TI=Y.match(/firefox\/(\d+)/i),II=!!TI&&+TI[1],RI=/MSIE|Trident/.test(Y),AI=Y.match(/AppleWebKit\/(\d+)\./),CI=!!AI&&+AI[1],OI=Wr,wI=I,NI=me,PI=Me,DI=rr,kI=_o,MI=a,UI=bI,LI=jn,xI=II,VI=RI,FI=te,BI=CI,jI=[],GI=wI(jI.sort),HI=wI(jI.push),zI=MI((function(){jI.sort(void 0)})),KI=MI((function(){jI.sort(null)})),WI=LI("sort"),XI=!MI((function(){if(FI)return FI<70;if(!(xI&&xI>3)){if(VI)return!0;if(BI)return BI<603;var e,t,i,r,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(r=0;r<47;r++)jI.push({k:t+r,v:i})}for(jI.sort((function(e,t){return t.v-e.v})),r=0;r<jI.length;r++)t=jI[r].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));OI({target:"Array",proto:!0,forced:zI||!KI||!WI||!XI},{sort:function(e){void 0!==e&&NI(e);var t=PI(this);if(XI)return void 0===e?GI(t):GI(t,e);var i,r,n=[],o=DI(t);for(r=0;r<o;r++)r in t&&HI(n,t[r]);for(UI(n,function(e){return function(t,i){return void 0===i?-1:void 0===t?1:void 0!==e?+e(t,i)||0:kI(t)>kI(i)?1:-1}}(e)),i=n.length,r=0;r<i;)t[r]=n[r++];for(;r<o;)delete t[r++];return t}});var YI="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,qI=Yi,JI=tr,QI=n.RangeError,ZI=function(e){if(void 0===e)return 0;var t=qI(e),i=JI(t);if(t!==i)throw QI("Wrong length or index");return i},$I=n.Array,eR=Math.abs,tR=Math.pow,iR=Math.floor,rR=Math.log,nR=Math.LN2,oR={pack:function(e,t,i){var r,n,o,a=$I(i),s=8*i-t-1,c=(1<<s)-1,u=c>>1,d=23===t?tR(2,-24)-tR(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=eR(e))!=e||e===1/0?(n=e!=e?1:0,r=c):(r=iR(rR(e)/nR),e*(o=tR(2,-r))<1&&(r--,o*=2),(e+=r+u>=1?d/o:d*tR(2,1-u))*o>=2&&(r++,o/=2),r+u>=c?(n=0,r=c):r+u>=1?(n=(e*o-1)*tR(2,t),r+=u):(n=e*tR(2,u-1)*tR(2,t),r=0));t>=8;)a[h++]=255&n,n/=256,t-=8;for(r=r<<t|n,s+=t;s>0;)a[h++]=255&r,r/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var i,r=e.length,n=8*r-t-1,o=(1<<n)-1,a=o>>1,s=n-7,c=r-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(i=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)i=256*i+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return i?NaN:u?-1/0:1/0;i+=tR(2,t),d-=a}return(u?-1:1)*i*tR(2,d-t)}},aR=Me,sR=Zi,cR=rr,uR=function(e){for(var t=aR(this),i=cR(t),r=arguments.length,n=sR(r>1?arguments[1]:void 0,i),o=r>2?arguments[2]:void 0,a=void 0===o?i:sR(o,i);a>n;)t[n++]=e;return t},dR=n,lR=I,hR=s,pR=YI,_R=Mi,fR=Xt,vR=rc,mR=a,SR=lc,yR=Yi,gR=tr,ER=ZI,bR=oR,TR=vh,IR=en,RR=Ki.f,AR=Ct.f,CR=uR,OR=Ro,wR=Go,NR=_R.PROPER,PR=_R.CONFIGURABLE,DR=Oi.get,kR=Oi.set,MR="ArrayBuffer",UR="DataView",LR="Wrong index",xR=dR.ArrayBuffer,VR=xR,FR=VR&&VR.prototype,BR=dR.DataView,jR=BR&&BR.prototype,GR=Object.prototype,HR=dR.Array,zR=dR.RangeError,KR=lR(CR),WR=lR([].reverse),XR=bR.pack,YR=bR.unpack,qR=function(e){return[255&e]},JR=function(e){return[255&e,e>>8&255]},QR=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},ZR=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},$R=function(e){return XR(e,23,4)},eA=function(e){return XR(e,52,8)},tA=function(e,t){AR(e.prototype,t,{get:function(){return DR(this)[t]}})},iA=function(e,t,i,r){var n=ER(i),o=DR(e);if(n+t>o.byteLength)throw zR(LR);var a=DR(o.buffer).bytes,s=n+o.byteOffset,c=OR(a,s,s+t);return r?c:WR(c)},rA=function(e,t,i,r,n,o){var a=ER(i),s=DR(e);if(a+t>s.byteLength)throw zR(LR);for(var c=DR(s.buffer).bytes,u=a+s.byteOffset,d=r(+n),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(pR){var nA=NR&&xR.name!==MR;if(mR((function(){xR(1)}))&&mR((function(){new xR(-1)}))&&!mR((function(){return new xR,new xR(1.5),new xR(NaN),nA&&!PR})))nA&&PR&&fR(xR,"name",MR);else{(VR=function(e){return SR(this,FR),new xR(ER(e))}).prototype=FR;for(var oA,aA=RR(xR),sA=0;aA.length>sA;)(oA=aA[sA++])in VR||fR(VR,oA,xR[oA]);FR.constructor=VR}IR&&TR(jR)!==GR&&IR(jR,GR);var cA=new BR(new VR(2)),uA=lR(jR.setInt8);cA.setInt8(0,2147483648),cA.setInt8(1,2147483649),!cA.getInt8(0)&&cA.getInt8(1)||vR(jR,{setInt8:function(e,t){uA(this,e,t<<24>>24)},setUint8:function(e,t){uA(this,e,t<<24>>24)}},{unsafe:!0})}else FR=(VR=function(e){SR(this,FR);var t=ER(e);kR(this,{bytes:KR(HR(t),0),byteLength:t}),hR||(this.byteLength=t)}).prototype,jR=(BR=function(e,t,i){SR(this,jR),SR(e,FR);var r=DR(e).byteLength,n=yR(t);if(n<0||n>r)throw zR("Wrong offset");if(n+(i=void 0===i?r-n:gR(i))>r)throw zR("Wrong length");kR(this,{buffer:e,byteLength:i,byteOffset:n}),hR||(this.buffer=e,this.byteLength=i,this.byteOffset=n)}).prototype,hR&&(tA(VR,"byteLength"),tA(BR,"buffer"),tA(BR,"byteLength"),tA(BR,"byteOffset")),vR(jR,{getInt8:function(e){return iA(this,1,e)[0]<<24>>24},getUint8:function(e){return iA(this,1,e)[0]},getInt16:function(e){var t=iA(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=iA(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return ZR(iA(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return ZR(iA(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return YR(iA(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return YR(iA(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){rA(this,1,e,qR,t)},setUint8:function(e,t){rA(this,1,e,qR,t)},setInt16:function(e,t){rA(this,2,e,JR,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){rA(this,2,e,JR,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){rA(this,4,e,QR,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){rA(this,4,e,QR,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){rA(this,4,e,$R,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){rA(this,8,e,eA,t,arguments.length>2?arguments[2]:void 0)}});wR(VR,MR),wR(BR,UR);var dA={ArrayBuffer:VR,DataView:BR},lA=Wr,hA=I,pA=a,_A=kt,fA=Zi,vA=tr,mA=uu,SA=dA.ArrayBuffer,yA=dA.DataView,gA=yA.prototype,EA=hA(SA.prototype.slice),bA=hA(gA.getUint8),TA=hA(gA.setUint8);lA({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:pA((function(){return!new SA(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(EA&&void 0===t)return EA(_A(this),e);for(var i=_A(this).byteLength,r=fA(e,i),n=fA(void 0===t?i:t,i),o=new(mA(this,SA))(vA(n-r)),a=new yA(this),s=new yA(o),c=0;r<n;)TA(s,c++,bA(a,r++));return o}});var IA,RA,AA,CA={exports:{}},OA=YI,wA=s,NA=n,PA=B,DA=G,kA=xe,MA=lo,UA=pe,LA=Xt,xA=Yt.exports,VA=Ct.f,FA=X,BA=vh,jA=en,GA=$e,HA=Ge,zA=NA.Int8Array,KA=zA&&zA.prototype,WA=NA.Uint8ClampedArray,XA=WA&&WA.prototype,YA=zA&&BA(zA),qA=KA&&BA(KA),JA=Object.prototype,QA=NA.TypeError,ZA=GA("toStringTag"),$A=HA("TYPED_ARRAY_TAG"),eC=HA("TYPED_ARRAY_CONSTRUCTOR"),tC=OA&&!!jA&&"Opera"!==MA(NA.opera),iC=!1,rC={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},nC={BigInt64Array:8,BigUint64Array:8},oC=function(e){if(!DA(e))return!1;var t=MA(e);return kA(rC,t)||kA(nC,t)};for(IA in rC)(AA=(RA=NA[IA])&&RA.prototype)?LA(AA,eC,RA):tC=!1;for(IA in nC)(AA=(RA=NA[IA])&&RA.prototype)&&LA(AA,eC,RA);if((!tC||!PA(YA)||YA===Function.prototype)&&(YA=function(){throw QA("Incorrect invocation")},tC))for(IA in rC)NA[IA]&&jA(NA[IA],YA);if((!tC||!qA||qA===JA)&&(qA=YA.prototype,tC))for(IA in rC)NA[IA]&&jA(NA[IA].prototype,qA);if(tC&&BA(XA)!==qA&&jA(XA,qA),wA&&!kA(qA,ZA))for(IA in iC=!0,VA(qA,ZA,{get:function(){return DA(this)?this[$A]:void 0}}),rC)NA[IA]&&LA(NA[IA],$A,IA);var aC={NATIVE_ARRAY_BUFFER_VIEWS:tC,TYPED_ARRAY_CONSTRUCTOR:eC,TYPED_ARRAY_TAG:iC&&$A,aTypedArray:function(e){if(oC(e))return e;throw QA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(PA(e)&&(!jA||FA(YA,e)))return e;throw QA(UA(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,r){if(wA){if(i)for(var n in rC){var o=NA[n];if(o&&kA(o.prototype,e))try{delete o.prototype[e]}catch(i){try{o.prototype[e]=t}catch(e){}}}qA[e]&&!i||xA(qA,e,i?t:tC&&KA[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,i){var r,n;if(wA){if(jA){if(i)for(r in rC)if((n=NA[r])&&kA(n,e))try{delete n[e]}catch(e){}if(YA[e]&&!i)return;try{return xA(YA,e,i?t:tC&&YA[e]||t)}catch(e){}}for(r in rC)!(n=NA[r])||n[e]&&!i||xA(n,e,t)}},isView:function(e){if(!DA(e))return!1;var t=MA(e);return"DataView"===t||kA(rC,t)||kA(nC,t)},isTypedArray:oC,TypedArray:YA,TypedArrayPrototype:qA},sC=n,cC=a,uC=tu,dC=aC.NATIVE_ARRAY_BUFFER_VIEWS,lC=sC.ArrayBuffer,hC=sC.Int8Array,pC=!dC||!cC((function(){hC(1)}))||!cC((function(){new hC(-1)}))||!uC((function(e){new hC,new hC(null),new hC(1.5),new hC(e)}),!0)||cC((function(){return 1!==new hC(new lC(2),1,void 0).length})),_C=G,fC=Math.floor,vC=Number.isInteger||function(e){return!_C(e)&&isFinite(e)&&fC(e)===e},mC=Yi,SC=n.RangeError,yC=function(e){var t=mC(e);if(t<0)throw SC("The argument can't be less than 0");return t},gC=n.RangeError,EC=function(e,t){var i=yC(e);if(i%t)throw gC("Wrong offset");return i},bC=Wo,TC=l,IC=ou,RC=Me,AC=rr,CC=Oc,OC=Ec,wC=vc,NC=aC.aTypedArrayConstructor,PC=Wr,DC=n,kC=l,MC=s,UC=pC,LC=aC,xC=dA,VC=lc,FC=S,BC=Xt,jC=vC,GC=tr,HC=ZI,zC=EC,KC=lt,WC=xe,XC=lo,YC=G,qC=le,JC=Rn,QC=X,ZC=en,$C=Ki.f,eO=function(e){var t,i,r,n,o,a,s=IC(this),c=RC(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=OC(c);if(h&&!wC(h))for(a=(o=CC(c,h)).next,c=[];!(n=TC(a,o)).done;)c.push(n.value);for(l&&u>2&&(d=bC(d,arguments[2])),i=AC(c),r=new(NC(s))(i),t=0;i>t;t++)r[t]=l?d(c[t],t):c[t];return r},tO=ba.forEach,iO=cc,rO=Ct,nO=o,oO=oS,aO=Oi.get,sO=Oi.set,cO=rO.f,uO=nO.f,dO=Math.round,lO=DC.RangeError,hO=xC.ArrayBuffer,pO=hO.prototype,_O=xC.DataView,fO=LC.NATIVE_ARRAY_BUFFER_VIEWS,vO=LC.TYPED_ARRAY_CONSTRUCTOR,mO=LC.TYPED_ARRAY_TAG,SO=LC.TypedArray,yO=LC.TypedArrayPrototype,gO=LC.aTypedArrayConstructor,EO=LC.isTypedArray,bO="BYTES_PER_ELEMENT",TO="Wrong length",IO=function(e,t){gO(e);for(var i=0,r=t.length,n=new e(r);r>i;)n[i]=t[i++];return n},RO=function(e,t){cO(e,t,{get:function(){return aO(this)[t]}})},AO=function(e){var t;return QC(pO,e)||"ArrayBuffer"==(t=XC(e))||"SharedArrayBuffer"==t},CO=function(e,t){return EO(e)&&!qC(t)&&t in e&&jC(+t)&&t>=0},OO=function(e,t){return t=KC(t),CO(e,t)?FC(2,e[t]):uO(e,t)},wO=function(e,t,i){return t=KC(t),!(CO(e,t)&&YC(i)&&WC(i,"value"))||WC(i,"get")||WC(i,"set")||i.configurable||WC(i,"writable")&&!i.writable||WC(i,"enumerable")&&!i.enumerable?cO(e,t,i):(e[t]=i.value,e)};MC?(fO||(nO.f=OO,rO.f=wO,RO(yO,"buffer"),RO(yO,"byteOffset"),RO(yO,"byteLength"),RO(yO,"length")),PC({target:"Object",stat:!0,forced:!fO},{getOwnPropertyDescriptor:OO,defineProperty:wO}),CA.exports=function(e,t,i){var r=e.match(/\d+$/)[0]/8,n=e+(i?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=DC[n],c=s,u=c&&c.prototype,d={},l=function(e,t){cO(e,t,{get:function(){return function(e,t){var i=aO(e);return i.view[o](t*r+i.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=aO(e);i&&(n=(n=dO(n))<0?0:n>255?255:255&n),o.view[a](t*r+o.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};fO?UC&&(c=t((function(e,t,i,n){return VC(e,u),oO(YC(t)?AO(t)?void 0!==n?new s(t,zC(i,r),n):void 0!==i?new s(t,zC(i,r)):new s(t):EO(t)?IO(c,t):kC(eO,c,t):new s(HC(t)),e,c)})),ZC&&ZC(c,SO),tO($C(s),(function(e){e in c||BC(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,i,n){VC(e,u);var o,a,s,d=0,h=0;if(YC(t)){if(!AO(t))return EO(t)?IO(c,t):kC(eO,c,t);o=t,h=zC(i,r);var p=t.byteLength;if(void 0===n){if(p%r)throw lO(TO);if((a=p-h)<0)throw lO(TO)}else if((a=GC(n)*r)+h>p)throw lO(TO);s=a/r}else s=HC(t),o=new hO(a=s*r);for(sO(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new _O(o)});d<s;)l(e,d++)})),ZC&&ZC(c,SO),u=c.prototype=JC(yO)),u.constructor!==c&&BC(u,"constructor",c),BC(u,vO,c),mO&&BC(u,mO,n),d[n]=c,PC({global:!0,forced:c!=s,sham:!fO},d),bO in c||BC(c,bO,r),bO in u||BC(u,bO,r),iO(n)}):CA.exports=function(){},(0,CA.exports)("Uint8",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var NO=Me,PO=Zi,DO=rr,kO=Math.min,MO=[].copyWithin||function(e,t){var i=NO(this),r=DO(i),n=PO(e,r),o=PO(t,r),a=arguments.length>2?arguments[2]:void 0,s=kO((void 0===a?r:PO(a,r))-o,r-n),c=1;for(o<n&&n<o+s&&(c=-1,o+=s-1,n+=s-1);s-- >0;)o in i?i[n]=i[o]:delete i[n],n+=c,o+=c;return i},UO=aC,LO=I(MO),xO=UO.aTypedArray;(0,UO.exportTypedArrayMethod)("copyWithin",(function(e,t){return LO(xO(this),e,t,arguments.length>2?arguments[2]:void 0)}));var VO=ba.every,FO=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("every",(function(e){return VO(FO(this),e,arguments.length>1?arguments[1]:void 0)}));var BO=l,jO=uR,GO=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return BO(jO,GO(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var HO=rr,zO=uu,KO=aC.TYPED_ARRAY_CONSTRUCTOR,WO=aC.aTypedArrayConstructor,XO=function(e){return WO(zO(e,e[KO]))},YO=function(e,t){for(var i=0,r=HO(t),n=new e(r);r>i;)n[i]=t[i++];return n},qO=XO,JO=ba.filter,QO=function(e,t){return YO(qO(e),t)},ZO=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("filter",(function(e){var t=JO(ZO(this),e,arguments.length>1?arguments[1]:void 0);return QO(this,t)}));var $O=ba.find,ew=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("find",(function(e){return $O(ew(this),e,arguments.length>1?arguments[1]:void 0)}));var tw=ba.findIndex,iw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("findIndex",(function(e){return tw(iw(this),e,arguments.length>1?arguments[1]:void 0)}));var rw=ba.forEach,nw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("forEach",(function(e){rw(nw(this),e,arguments.length>1?arguments[1]:void 0)}));var ow=cr.includes,aw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("includes",(function(e){return ow(aw(this),e,arguments.length>1?arguments[1]:void 0)}));var sw=cr.indexOf,cw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("indexOf",(function(e){return sw(cw(this),e,arguments.length>1?arguments[1]:void 0)}));var uw=n,dw=a,lw=I,hw=aC,pw=up,_w=$e("iterator"),fw=uw.Uint8Array,vw=lw(pw.values),mw=lw(pw.keys),Sw=lw(pw.entries),yw=hw.aTypedArray,gw=hw.exportTypedArrayMethod,Ew=fw&&fw.prototype,bw=!dw((function(){Ew[_w].call([1])})),Tw=!!Ew&&Ew.values&&Ew[_w]===Ew.values&&"values"===Ew.values.name,Iw=function(){return vw(yw(this))};gw("entries",(function(){return Sw(yw(this))}),bw),gw("keys",(function(){return mw(yw(this))}),bw),gw("values",Iw,bw||!Tw,{name:"values"}),gw(_w,Iw,bw||!Tw,{name:"values"});var Rw=aC.aTypedArray,Aw=aC.exportTypedArrayMethod,Cw=I([].join);Aw("join",(function(e){return Cw(Rw(this),e)}));var Ow=Zn,ww=F,Nw=Yi,Pw=rr,Dw=jn,kw=Math.min,Mw=[].lastIndexOf,Uw=!!Mw&&1/[1].lastIndexOf(1,-0)<0,Lw=Dw("lastIndexOf"),xw=Uw||!Lw?function(e){if(Uw)return Ow(Mw,this,arguments)||0;var t=ww(this),i=Pw(t),r=i-1;for(arguments.length>1&&(r=kw(r,Nw(arguments[1]))),r<0&&(r=i+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:Mw,Vw=Zn,Fw=xw,Bw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return Vw(Fw,Bw(this),t>1?[e,arguments[1]]:[e])}));var jw=ba.map,Gw=XO,Hw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("map",(function(e){return jw(Hw(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(Gw(e))(t)}))}));var zw=GS.left,Kw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return zw(Kw(this),e,t,t>1?arguments[1]:void 0)}));var Ww=GS.right,Xw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return Ww(Xw(this),e,t,t>1?arguments[1]:void 0)}));var Yw=aC.aTypedArray,qw=aC.exportTypedArrayMethod,Jw=Math.floor;qw("reverse",(function(){for(var e,t=this,i=Yw(t).length,r=Jw(i/2),n=0;n<r;)e=t[n],t[n++]=t[--i],t[i]=e;return t}));var Qw=n,Zw=l,$w=aC,eN=rr,tN=EC,iN=Me,rN=a,nN=Qw.RangeError,oN=Qw.Int8Array,aN=oN&&oN.prototype,sN=aN&&aN.set,cN=$w.aTypedArray,uN=$w.exportTypedArrayMethod,dN=!rN((function(){var e=new Uint8ClampedArray(2);return Zw(sN,e,{length:1,0:3},1),3!==e[1]})),lN=dN&&$w.NATIVE_ARRAY_BUFFER_VIEWS&&rN((function(){var e=new oN(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));uN("set",(function(e){cN(this);var t=tN(arguments.length>1?arguments[1]:void 0,1),i=iN(e);if(dN)return Zw(sN,this,i,t);var r=this.length,n=eN(i),o=0;if(n+t>r)throw nN("Wrong length");for(;o<n;)this[t+o]=i[o++]}),!dN||lN);var hN=XO,pN=Po,_N=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("slice",(function(e,t){for(var i=pN(_N(this),e,t),r=hN(this),n=0,o=i.length,a=new r(o);o>n;)a[n]=i[n++];return a}),a((function(){new Int8Array(1).slice()})));var fN=ba.some,vN=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("some",(function(e){return fN(vN(this),e,arguments.length>1?arguments[1]:void 0)}));var mN=n,SN=I,yN=a,gN=me,EN=bI,bN=aC,TN=II,IN=RI,RN=te,AN=CI,CN=mN.Array,ON=bN.aTypedArray,wN=bN.exportTypedArrayMethod,NN=mN.Uint16Array,PN=NN&&SN(NN.prototype.sort),DN=!(!PN||yN((function(){PN(new NN(2),null)}))&&yN((function(){PN(new NN(2),{})}))),kN=!!PN&&!yN((function(){if(RN)return RN<74;if(TN)return TN<67;if(IN)return!0;if(AN)return AN<602;var e,t,i=new NN(516),r=CN(516);for(e=0;e<516;e++)t=e%4,i[e]=515-e,r[e]=e-2*t+3;for(PN(i,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(i[e]!==r[e])return!0}));wN("sort",(function(e){return void 0!==e&&gN(e),kN?PN(this,e):EN(ON(this),function(e){return function(t,i){return void 0!==e?+e(t,i)||0:i!=i?-1:t!=t?1:0===t&&0===i?1/t>0&&1/i<0?1:-1:t>i}}(e))}),!kN||DN);var MN=tr,UN=Zi,LN=XO,xN=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("subarray",(function(e,t){var i=xN(this),r=i.length,n=UN(e,r);return new(LN(i))(i.buffer,i.byteOffset+n*i.BYTES_PER_ELEMENT,MN((void 0===t?r:UN(t,r))-n))}));var VN=Zn,FN=aC,BN=a,jN=Po,GN=n.Int8Array,HN=FN.aTypedArray,zN=FN.exportTypedArrayMethod,KN=[].toLocaleString,WN=!!GN&&BN((function(){KN.call(new GN(1))}));zN("toLocaleString",(function(){return VN(KN,WN?jN(HN(this)):HN(this),jN(arguments))}),BN((function(){return[1,2].toLocaleString()!=new GN([1,2]).toLocaleString()}))||!BN((function(){GN.prototype.toLocaleString.call([1,2])})));var XN=aC.exportTypedArrayMethod,YN=a,qN=I,JN=n.Uint8Array,QN=JN&&JN.prototype||{},ZN=[].toString,$N=qN([].join);YN((function(){ZN.call({})}))&&(ZN=function(){return $N(this)});var eP=QN.toString!=ZN;XN("toString",ZN,eP);var tP=Wr,iP=ba.findIndex,rP=ah,nP="findIndex",oP=!0;nP in[]&&Array(1).findIndex((function(){oP=!1})),tP({target:"Array",proto:!0,forced:oP},{findIndex:function(e){return iP(this,e,arguments.length>1?arguments[1]:void 0)}}),rP(nP);var aP,sP,cP=cc,uP="ArrayBuffer",dP=dA.ArrayBuffer;Wr({global:!0,forced:n.ArrayBuffer!==dP},{ArrayBuffer:dP}),cP(uP),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED"}(aP||(aP={})),function(e){e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK"}(sP||(sP={}));var lP=function(e,t,i){this.code=e,this.message=t,this.error=i},hP=s,pP=I,_P=on,fP=F,vP=pP(h.f),mP=pP([].push),SP=function(e){return function(t){for(var i,r=fP(t),n=_P(r),o=n.length,a=0,s=[];o>a;)i=n[a++],hP&&!vP(r,i)||mP(s,e?[i,r[i]]:r[i]);return s}},yP={entries:SP(!0),values:SP(!1)}.entries;Wr({target:"Object",stat:!0},{entries:function(e){return yP(e)}});var gP=Yi,EP=_o,bP=L,TP=n.RangeError,IP=function(e){var t=EP(bP(this)),i="",r=gP(e);if(r<0||r==1/0)throw TP("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(i+=t);return i},RP=I,AP=tr,CP=_o,OP=L,wP=RP(IP),NP=RP("".slice),PP=Math.ceil,DP=function(e){return function(t,i,r){var n,o,a=CP(OP(t)),s=AP(i),c=a.length,u=void 0===r?" ":CP(r);return s<=c||""==u?a:((o=wP(u,PP((n=s-c)/u.length))).length>n&&(o=NP(o,0,n)),e?a+o:o+a)}},kP={start:DP(!1),end:DP(!0)},MP=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Y),UP=kP.end;Wr({target:"String",proto:!0,forced:MP},{padEnd:function(e){return UP(this,e,arguments.length>1?arguments[1]:void 0)}});var LP=Pm;Wr({target:"Number",stat:!0,forced:Number.parseInt!=LP},{parseInt:LP});Wr({target:"ArrayBuffer",stat:!0,forced:!aC.NATIVE_ARRAY_BUFFER_VIEWS},{isView:aC.isView}),Wr({global:!0,forced:!YI},{DataView:dA.DataView});var xP=kt,VP=Dc,FP=Wo,BP=l,jP=Me,GP=function(e,t,i,r){try{return r?t(xP(i)[0],i[1]):t(i)}catch(t){VP(e,"throw",t)}},HP=vc,zP=aa,KP=rr,WP=yo,XP=Oc,YP=Ec,qP=n.Array,JP=function(e){var t=jP(e),i=zP(this),r=arguments.length,n=r>1?arguments[1]:void 0,o=void 0!==n;o&&(n=FP(n,r>2?arguments[2]:void 0));var a,s,c,u,d,l,h=YP(t),p=0;if(!h||this==qP&&HP(h))for(a=KP(t),s=i?new this(a):qP(a);a>p;p++)l=o?n(t[p],p):t[p],WP(s,p,l);else for(d=(u=XP(t,h)).next,s=i?new this:[];!(c=BP(d,u)).done;p++)l=o?GP(u,n,[c.value,p],!0):c.value,WP(s,p,l);return s.length=p,s},QP=JP;Wr({target:"Array",stat:!0,forced:!tu((function(e){Array.from(e)}))},{from:QP});var ZP=Wr,$P=eo,eD=I([].reverse),tD=[1,2];ZP({target:"Array",proto:!0,forced:String(tD)===String(tD.reverse())},{reverse:function(){return $P(this)&&(this.length=this.length),eD(this)}});var iD=Wr,rD=n,nD=I,oD=Yi,aD=jb,sD=IP,cD=a,uD=rD.RangeError,dD=rD.String,lD=Math.floor,hD=nD(sD),pD=nD("".slice),_D=nD(1..toFixed),fD=function(e,t,i){return 0===t?i:t%2==1?fD(e,t-1,i*e):fD(e*e,t/2,i)},vD=function(e,t,i){for(var r=-1,n=i;++r<6;)n+=t*e[r],e[r]=n%1e7,n=lD(n/1e7)},mD=function(e,t){for(var i=6,r=0;--i>=0;)r+=e[i],e[i]=lD(r/t),r=r%t*1e7},SD=function(e){for(var t=6,i="";--t>=0;)if(""!==i||0===t||0!==e[t]){var r=dD(e[t]);i=""===i?r:i+hD("0",7-r.length)+r}return i};iD({target:"Number",proto:!0,forced:cD((function(){return"0.000"!==_D(8e-5,3)||"1"!==_D(.9,0)||"1.25"!==_D(1.255,2)||"1000000000000000128"!==_D(0xde0b6b3a7640080,0)}))||!cD((function(){_D({})}))},{toFixed:function(e){var t,i,r,n,o=aD(this),a=oD(e),s=[0,0,0,0,0,0],c="",u="0";if(a<0||a>20)throw uD("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return dD(o);if(o<0&&(c="-",o=-o),o>1e-21)if(i=(t=function(e){for(var t=0,i=e;i>=4096;)t+=12,i/=4096;for(;i>=2;)t+=1,i/=2;return t}(o*fD(2,69,1))-69)<0?o*fD(2,-t,1):o/fD(2,t,1),i*=4503599627370496,(t=52-t)>0){for(vD(s,0,i),r=a;r>=7;)vD(s,1e7,0),r-=7;for(vD(s,fD(10,r,1),0),r=t-1;r>=23;)mD(s,1<<23),r-=23;mD(s,1<<r),vD(s,1,1),mD(s,2),u=SD(s)}else vD(s,0,i),vD(s,1<<-t,0),u=SD(s)+hD("0",a);return u=a>0?c+((n=u.length)<=a?"0."+hD("0",a-n)+u:pD(u,0,n-a)+"."+pD(u,n-a)):c+u}});var yD=Math.log,gD=Math.LOG10E;Wr({target:"Math",stat:!0},{log10:Math.log10||function(e){return yD(e)*gD}});var ED,bD=Wr,TD=I,ID=o.f,RD=tr,AD=_o,CD=jf,OD=L,wD=Hf,ND=TD("".startsWith),PD=TD("".slice),DD=Math.min,kD=wD("startsWith"),MD=!kD&&!!function(){var e=ID(String.prototype,"startsWith");return e&&!e.writable}();bD({target:"String",proto:!0,forced:!MD&&!kD},{startsWith:function(e){var t=AD(OD(this));CD(e);var i=RD(DD(arguments.length>1?arguments[1]:void 0,t.length)),r=AD(e);return ND?ND(t,r,i):PD(t,i,i+r.length)===r}});var UD=new Uint8Array(16);function LD(){if(!ED&&!(ED="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ED(UD)}var xD=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function VD(e){return"string"==typeof e&&xD.test(e)}for(var FD=[],BD=0;BD<256;++BD)FD.push((BD+256).toString(16).substr(1));function jD(e,t,i){var r=(e=e||{}).random||(e.rng||LD)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){i=i||0;for(var n=0;n<16;++n)t[i+n]=r[n];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(FD[e[t+0]]+FD[e[t+1]]+FD[e[t+2]]+FD[e[t+3]]+"-"+FD[e[t+4]]+FD[e[t+5]]+"-"+FD[e[t+6]]+FD[e[t+7]]+"-"+FD[e[t+8]]+FD[e[t+9]]+"-"+FD[e[t+10]]+FD[e[t+11]]+FD[e[t+12]]+FD[e[t+13]]+FD[e[t+14]]+FD[e[t+15]]).toLowerCase();if(!VD(i))throw TypeError("Stringified UUID is invalid");return i}(r)}var GD=new TextDecoder,HD=new TextEncoder,zD=function(){return jD()},KD=function(){return Date.now()};function WD(e){for(var t,i,r,n,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=rf(o),u=c.next();!u.done;u=c.next()){s+=(_=u.value).length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(t)throw t.error}}var d=new e(s),l=0;try{for(var h=rf(o),p=h.next();!p.done;p=h.next()){var _=p.value;d.set(_,l),l+=_.length}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}return d}var XD=function(){return"undefined"==typeof window},YD=function(){function e(){}return e.token2auth=function(t,i,r,n){return n?"Bearer ".concat(n):"Basic ".concat(e.createUnsafeToken(t,i,r))},e.createUnsafeToken=function(e,t,i){return window.btoa([e,t,i].filter((function(e){return null!==e})).join(":"))},e.merge=function(i,r){var n,o;void 0===i&&(i={}),void 0===r&&(r={});try{for(var a=rf(Object.entries(i)),s=a.next();!s.done;s=a.next()){var c=nf(s.value,2),u=c[0],d=c[1];null!==d&&"object"===t(d)?e.merge(i[u],r[u]):void 0!==r[u]&&(i[u]=r[u])}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.ab2str=function(e){return GD.decode(e)},e.ab2obj=function(t){try{var i=e.ab2str(t);return JSON.parse(i)}catch(e){return{}}},e.str2ab=function(e){return HD.encode(e).buffer},e.ab2b64str=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var i=new FileReader;i.onload=function(){return t(i.result)},i.readAsDataURL(new Blob([e]))}))];case 1:return[2,t.sent().split(",",2)[1]]}}))}))},e.b64str2ab=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function qD(){var e="none";return XD()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}var JD="mozilla"===qD(),QD="safari"===qD(),ZD=!XD()&&navigator.userAgent.toLowerCase().includes("mobile");function $D(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,i){var r=i===t.length-1?"0":"1";return Number.parseInt(r+e.join(""),2)}))}var ek=function(){return Math.floor(65535*Math.random())};function tk(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function ik(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var i=ArrayBuffer.isView(t)?t.buffer:t,r=i.byteLength,n=[];if(r>10){var o=new DataView(i),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return r-1-t})).reverse().map((function(e){return o.getUint8(e)}));n=of(of(of([],nf(a),!1),["..."],!1),nf(s),!1)}else n=Array.from(new Uint8Array(i));return"".concat(t.constructor.name,"(").concat(r,") [").concat(n.join(", "),"]")}if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var rk=function(e){return void 0===e&&(e=!1),ef(void 0,void 0,void 0,(function(){var t,i;return tf(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),t.addTransceiver("audio",{direction:"recvonly"}),t.addTransceiver("video",{direction:"recvonly"}),e&&(t.addTransceiver("audio",{direction:"sendonly"}),t.addTransceiver("video",{direction:"sendonly"})),[4,t.createOffer()];case 1:return i=r.sent(),t.close(),[2,i.sdp];case 2:return r.sent(),[3,3];case 3:return[2]}}))}))},nk=function(e){return new Promise((function(t,i){var r=(e=Array.isArray(e)?e:[]).length,n=[];0===r?i([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){r--,n.push(e),0===r&&i(n)}))}))}))};function ok(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function ak(e){return(e&x_.AUDIO)===x_.AUDIO}function sk(e){return(e&x_.VIDEO)===x_.VIDEO}function ck(e){var i={};return Object.keys(e).forEach((function(r){"object"===t(e[r])?i[r]=ck(e[r]):r.startsWith("_")||(i[r]=e[r])})),i}function uk(e,t){if("boolean"!=typeof e)throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function dk(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),e<i||e>r||"number"!=typeof e)throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(i,", ").concat(r,"]. integer only"))}function lk(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),null==e)throw new lP(aP.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,i){void 0===t&&(t=1);void 0===i&&(i=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=i&&e.length>=t}(e,i,r))throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(i,",").concat(r,"]"))}function hk(e,t,i){if(!i.includes(e))throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(i)))}function pk(e,t){if(vk(e))throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function _k(e,t){if(!(e instanceof ArrayBuffer))throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function fk(e){var t,i;try{var r=navigator.mediaDevices.getSupportedConstraints();try{for(var n=rf(Object.keys(e)),o=n.next();!o.done;o=n.next()){var a=o.value;r[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}}catch(e){}}function vk(e){return null==e}function mk(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lP(aP.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function Sk(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lP(aP.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function yk(e){pk(e,"videoPlayerOption")}function gk(e,t){var i,r;if(void 0===t&&(t=64),!e||0===(null===(i=e)||void 0===i?void 0:i.byteLength))throw new lP(aP.INVALID_PARAMS,"The message cannot be empty");if((null==(r=e instanceof ArrayBuffer?e:YD.str2ab(JSON.stringify(e)))?void 0:r.byteLength)>1e3*t)throw new lP(aP.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function Ek(e){return![df.onRemoteStreamStats,df.onLocalStreamStats,df.onAudioVolumeIndication,df.onLocalAudioPropertiesReport,df.onRemoteAudioPropertiesReport].includes(e)}var bk={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function r(){}function n(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new n(r,o||e,a),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,r,n=[];if(0===this._eventsCount)return n;for(r in e=this._events)t.call(e,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,o=r.length,a=new Array(o);n<o;n++)a[n]=r[n].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,n,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,n),!0;case 5:return d.fn.call(d.context,t,r,n,o),!0;case 6:return d.fn.call(d.context,t,r,n,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,r);break;case 4:d[u].fn.call(d[u].context,t,r,n);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,r,n){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||n&&!s.once||r&&s.context!==r||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||n&&!s[c].once||r&&s[c].context!==r)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}(bk);var Tk=bk.exports,Ik="[VERTC]",Rk=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],Ak=!XD()&&window.location.search.includes("_rtc_debug_"),Ck=function(){function e(e,t,i){this._module=e,this._indent=t}return e.prototype.print=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(Ak){for(var r="",n=0;n<this._indent;n++)r+=" ";console.log.apply(console,of(["%c".concat(Ik).concat(r,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(Rk[this._indent],";")],nf(t),!1))}},e}(),Ok=new Ck("VERTC",0),wk=function(e){function t(){return e.call(this)||this}return A_(t,e),t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];var n=this.listenerCount(t);try{return e.prototype.emit.apply(this,of([t],nf(i),!1))}catch(e){return Ok.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(n)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return ef(this,void 0,void 0,(function(){var i=this;return tf(this,(function(r){return[2,new Promise((function(r,n){try{i.emit.apply(i,of(of([e],nf(t),!1),[r,n],!1))}catch(t){Ok.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),n(t)}}))]}))}))},t}(bk.exports.EventEmitter),Nk=xe,Pk=function(e){return void 0!==e&&(Nk(e,"value")||Nk(e,"writable"))},Dk=l,kk=G,Mk=kt,Uk=Pk,Lk=o,xk=vh;Wr({target:"Reflect",stat:!0},{get:function e(t,i){var r,n,o=arguments.length<3?t:arguments[2];return Mk(t)===o?t[i]:(r=Lk.f(t,i))?Uk(r)?r.value:void 0===r.get?void 0:Dk(r.get,o):kk(n=xk(t))?e(n,i,o):void 0}});var Vk=Wr,Fk=l,Bk=kt,jk=G,Gk=Pk,Hk=Ct,zk=o,Kk=vh,Wk=S;var Xk=a((function(){var e=function(){},t=Hk.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));Vk({target:"Reflect",stat:!0,forced:Xk},{set:function e(t,i,r){var n,o,a,s=arguments.length<4?t:arguments[3],c=zk.f(Bk(t),i);if(!c){if(jk(o=Kk(t)))return e(o,i,r,s);c=Wk(0)}if(Gk(c)){if(!1===c.writable||!jk(s))return!1;if(n=zk.f(s,i)){if(n.get||n.set||!1===n.writable)return!1;n.value=r,Hk.f(s,i,n)}else Hk.f(s,i,Wk(0,r))}else{if(void 0===(a=c.set))return!1;Fk(a,s,r)}return!0}}),(0,CA.exports)("Uint16",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,CA.exports)("Int32",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var Yk={};!function(e){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var i=Array.prototype.slice.call(arguments,1);i.length;){var n=i.shift();if(n){if("object"!==t(n))throw new TypeError(n+"must be non-object");for(var o in n)r(n,o)&&(e[o]=n[o])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var o=0;o<r;o++)e[n+o]=t[i+o]},flattenChunks:function(e){var t,i,r,n,o,a;for(r=0,t=0,i=e.length;t<i;t++)r+=e[t].length;for(a=new Uint8Array(r),n=0,t=0,i=e.length;t<i;t++)o=e[t],a.set(o,n),n+=o.length;return a}},o={arraySet:function(e,t,i,r,n){for(var o=0;o<r;o++)e[n+o]=t[i+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,o))},e.setTyped(i)}(Yk);var qk={},Jk={},Qk={},Zk=Yk;function $k(e){for(var t=e.length;--t>=0;)e[t]=0}var eM=256,tM=286,iM=30,rM=15,nM=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],oM=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],aM=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],sM=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],cM=new Array(576);$k(cM);var uM=new Array(60);$k(uM);var dM=new Array(512);$k(dM);var lM=new Array(256);$k(lM);var hM=new Array(29);$k(hM);var pM,_M,fM,vM=new Array(iM);function mM(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function SM(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function yM(e){return e<256?dM[e]:dM[256+(e>>>7)]}function gM(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function EM(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,gM(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function bM(e,t,i){EM(e,i[2*t],i[2*t+1])}function TM(e,t){var i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1}function IM(e,t,i){var r,n,o=new Array(16),a=0;for(r=1;r<=rM;r++)o[r]=a=a+i[r-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=TM(o[s]++,s))}}function RM(e){var t;for(t=0;t<tM;t++)e.dyn_ltree[2*t]=0;for(t=0;t<iM;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function AM(e){e.bi_valid>8?gM(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function CM(e,t,i,r){var n=2*t,o=2*i;return e[n]<e[o]||e[n]===e[o]&&r[t]<=r[i]}function OM(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&CM(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!CM(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function wM(e,t,i){var r,n,o,a,s=0;if(0!==e.last_lit)do{r=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],n=e.pending_buf[e.l_buf+s],s++,0===r?bM(e,n,t):(bM(e,(o=lM[n])+eM+1,t),0!==(a=nM[o])&&EM(e,n-=hM[o],a),bM(e,o=yM(--r),i),0!==(a=oM[o])&&EM(e,r-=vM[o],a))}while(s<e.last_lit);bM(e,256,t)}function NM(e,t){var i,r,n,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<c;i++)0!==o[2*i]?(e.heap[++e.heap_len]=u=i,e.depth[i]=0):o[2*i+1]=0;for(;e.heap_len<2;)o[2*(n=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=a[2*n+1]);for(t.max_code=u,i=e.heap_len>>1;i>=1;i--)OM(e,o,i);n=c;do{i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],OM(e,o,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,o[2*n]=o[2*i]+o[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,o[2*i+1]=o[2*r+1]=n,e.heap[1]=n++,OM(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,_=t.stat_desc.max_length,f=0;for(o=0;o<=rM;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)(o=c[2*c[2*(r=e.heap[i])+1]+1]+1)>_&&(o=_,f++),c[2*r+1]=o,r>u||(e.bl_count[o]++,a=0,r>=p&&(a=h[r-p]),s=c[2*r],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*r+1]+a)));if(0!==f){do{for(o=_-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[_]--,f-=2}while(f>0);for(o=_;0!==o;o--)for(r=e.bl_count[o];0!==r;)(n=e.heap[--i])>u||(c[2*n+1]!==o&&(e.opt_len+=(o-c[2*n+1])*c[2*n],c[2*n+1]=o),r--)}}(e,t),IM(o,u,e.bl_count)}function PM(e,t,i){var r,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=a,a=t[2*(r+1)+1],++s<c&&n===a||(s<u?e.bl_tree[2*n]+=s:0!==n?(n!==o&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4))}function DM(e,t,i){var r,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),r=0;r<=i;r++)if(n=a,a=t[2*(r+1)+1],!(++s<c&&n===a)){if(s<u)do{bM(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(bM(e,n,e.bl_tree),s--),bM(e,16,e.bl_tree),EM(e,s-3,2)):s<=10?(bM(e,17,e.bl_tree),EM(e,s-3,3)):(bM(e,18,e.bl_tree),EM(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}}$k(vM);var kM=!1;function MM(e,t,i,r){EM(e,0+(r?1:0),3),function(e,t,i,r){AM(e),r&&(gM(e,i),gM(e,~i)),Zk.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}(e,t,i,!0)}Qk._tr_init=function(e){kM||(!function(){var e,t,i,r,n,o=new Array(16);for(i=0,r=0;r<28;r++)for(hM[r]=i,e=0;e<1<<nM[r];e++)lM[i++]=r;for(lM[i-1]=r,n=0,r=0;r<16;r++)for(vM[r]=n,e=0;e<1<<oM[r];e++)dM[n++]=r;for(n>>=7;r<iM;r++)for(vM[r]=n<<7,e=0;e<1<<oM[r]-7;e++)dM[256+n++]=r;for(t=0;t<=rM;t++)o[t]=0;for(e=0;e<=143;)cM[2*e+1]=8,e++,o[8]++;for(;e<=255;)cM[2*e+1]=9,e++,o[9]++;for(;e<=279;)cM[2*e+1]=7,e++,o[7]++;for(;e<=287;)cM[2*e+1]=8,e++,o[8]++;for(IM(cM,287,o),e=0;e<iM;e++)uM[2*e+1]=5,uM[2*e]=TM(e,5);pM=new mM(cM,nM,257,tM,rM),_M=new mM(uM,oM,0,iM,rM),fM=new mM(new Array(0),aM,0,19,7)}(),kM=!0),e.l_desc=new SM(e.dyn_ltree,pM),e.d_desc=new SM(e.dyn_dtree,_M),e.bl_desc=new SM(e.bl_tree,fM),e.bi_buf=0,e.bi_valid=0,RM(e)},Qk._tr_stored_block=MM,Qk._tr_flush_block=function(e,t,i,r){var n,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<eM;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),NM(e,e.l_desc),NM(e,e.d_desc),a=function(e){var t;for(PM(e,e.dyn_ltree,e.l_desc.max_code),PM(e,e.dyn_dtree,e.d_desc.max_code),NM(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*sM[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==t?MM(e,t,i,r):4===e.strategy||o===n?(EM(e,2+(r?1:0),3),wM(e,cM,uM)):(EM(e,4+(r?1:0),3),function(e,t,i,r){var n;for(EM(e,t-257,5),EM(e,i-1,5),EM(e,r-4,4),n=0;n<r;n++)EM(e,e.bl_tree[2*sM[n]+1],3);DM(e,e.dyn_ltree,t-1),DM(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),wM(e,e.dyn_ltree,e.dyn_dtree)),RM(e),r&&AM(e)},Qk._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(lM[i]+eM+1)]++,e.dyn_dtree[2*yM(t)]++),e.last_lit===e.lit_bufsize-1},Qk._tr_align=function(e){EM(e,2,3),bM(e,256,cM),function(e){16===e.bi_valid?(gM(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)};var UM=function(e,t,i,r){for(var n=65535&e|0,o=e>>>16&65535|0,a=0;0!==i;){i-=a=i>2e3?2e3:i;do{o=o+(n=n+t[r++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0};var LM=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();var xM,VM=function(e,t,i,r){var n=LM,o=r+i;e^=-1;for(var a=r;a<o;a++)e=e>>>8^n[255&(e^t[a])];return-1^e},FM={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},BM=Yk,jM=Qk,GM=UM,HM=VM,zM=FM,KM=-2,WM=258,XM=262,YM=103,qM=113,JM=666;function QM(e,t){return e.msg=zM[t],t}function ZM(e){return(e<<1)-(e>4?9:0)}function $M(e){for(var t=e.length;--t>=0;)e[t]=0}function eU(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(BM.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function tU(e,t){jM._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,eU(e.strm)}function iU(e,t){e.pending_buf[e.pending++]=t}function rU(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function nU(e,t){var i,r,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-XM?e.strstart-(e.w_size-XM):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+WM,p=u[o+a-1],_=u[o+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(i=t)+a]===_&&u[i+a-1]===p&&u[i]===u[o]&&u[++i]===u[o+1]){o+=2,i++;do{}while(u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&o<h);if(r=WM-(h-o),o=h-WM,r>a){if(e.match_start=t,a=r,r>=s)break;p=u[o+a-1],_=u[o+a]}}}while((t=l[t&d])>c&&0!=--n);return a<=e.lookahead?a:e.lookahead}function oU(e){var t,i,r,n,o,a,s,c,u,d,l=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-XM)){BM.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=i=e.hash_size;do{r=e.head[--t],e.head[t]=r>=l?r-l:0}while(--i);t=i=l;do{r=e.prev[--t],e.prev[t]=r>=l?r-l:0}while(--i);n+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=n,d=void 0,(d=a.avail_in)>u&&(d=u),i=0===d?0:(a.avail_in-=d,BM.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=GM(a.adler,s,d,c):2===a.state.wrap&&(a.adler=HM(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=i,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<XM&&0!==e.strm.avail_in)}function aU(e,t){for(var i,r;;){if(e.lookahead<XM){if(oU(e),e.lookahead<XM&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-XM&&(e.match_length=nU(e,i)),e.match_length>=3)if(r=jM._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=jM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(tU(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(tU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(tU(e,!1),0===e.strm.avail_out)?1:2}function sU(e,t){for(var i,r,n;;){if(e.lookahead<XM){if(oU(e),e.lookahead<XM&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-XM&&(e.match_length=nU(e,i),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,r=jM._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(tU(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=jM._tr_tally(e,0,e.window[e.strstart-1]))&&tU(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=jM._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(tU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(tU(e,!1),0===e.strm.avail_out)?1:2}function cU(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}function uU(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new BM.Buf16(1146),this.dyn_dtree=new BM.Buf16(122),this.bl_tree=new BM.Buf16(78),$M(this.dyn_ltree),$M(this.dyn_dtree),$M(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new BM.Buf16(16),this.heap=new BM.Buf16(573),$M(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new BM.Buf16(573),$M(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function dU(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:qM,e.adler=2===t.wrap?0:1,t.last_flush=0,jM._tr_init(t),0):QM(e,KM)}function lU(e){var t,i=dU(e);return 0===i&&((t=e.state).window_size=2*t.w_size,$M(t.head),t.max_lazy_match=xM[t.level].max_lazy,t.good_match=xM[t.level].good_length,t.nice_match=xM[t.level].nice_length,t.max_chain_length=xM[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),i}function hU(e,t,i,r,n,o){if(!e)return KM;var a=1;if(-1===t&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),n<1||n>9||8!==i||r<8||r>15||t<0||t>9||o<0||o>4)return QM(e,KM);8===r&&(r=9);var s=new uU;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new BM.Buf8(2*s.w_size),s.head=new BM.Buf16(s.hash_size),s.prev=new BM.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new BM.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=i,lU(e)}xM=[new cU(0,0,0,0,(function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(oU(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,tU(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-XM&&(tU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(tU(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(tU(e,!1),e.strm.avail_out),1)})),new cU(4,4,8,4,aU),new cU(4,5,16,8,aU),new cU(4,6,32,32,aU),new cU(4,4,16,16,sU),new cU(8,16,32,32,sU),new cU(8,16,128,128,sU),new cU(8,32,128,256,sU),new cU(32,128,258,1024,sU),new cU(32,258,258,4096,sU)],Jk.deflateInit=function(e,t){return hU(e,t,8,15,8,0)},Jk.deflateInit2=hU,Jk.deflateReset=lU,Jk.deflateResetKeep=dU,Jk.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?KM:(e.state.gzhead=t,0):KM},Jk.deflate=function(e,t){var i,r,n,o;if(!e||!e.state||t>5||t<0)return e?QM(e,KM):KM;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||r.status===JM&&4!==t)return QM(e,0===e.avail_out?-5:KM);if(r.strm=e,i=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,iU(r,31),iU(r,139),iU(r,8),r.gzhead?(iU(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),iU(r,255&r.gzhead.time),iU(r,r.gzhead.time>>8&255),iU(r,r.gzhead.time>>16&255),iU(r,r.gzhead.time>>24&255),iU(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),iU(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(iU(r,255&r.gzhead.extra.length),iU(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=HM(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(iU(r,0),iU(r,0),iU(r,0),iU(r,0),iU(r,0),iU(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),iU(r,3),r.status=qM);else{var a=8+(r.w_bits-8<<4)<<8;a|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(a|=32),a+=31-a%31,r.status=qM,rU(r,a),0!==r.strstart&&(rU(r,e.adler>>>16),rU(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(n=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>n&&(e.adler=HM(e.adler,r.pending_buf,r.pending-n,n)),eU(e),n=r.pending,r.pending!==r.pending_buf_size));)iU(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>n&&(e.adler=HM(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=HM(e.adler,r.pending_buf,r.pending-n,n)),eU(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,iU(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=HM(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=HM(e.adler,r.pending_buf,r.pending-n,n)),eU(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,iU(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=HM(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.status=YM)}else r.status=YM;if(r.status===YM&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&eU(e),r.pending+2<=r.pending_buf_size&&(iU(r,255&e.adler),iU(r,e.adler>>8&255),e.adler=0,r.status=qM)):r.status=qM),0!==r.pending){if(eU(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&ZM(t)<=ZM(i)&&4!==t)return QM(e,-5);if(r.status===JM&&0!==e.avail_in)return QM(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&r.status!==JM){var s=2===r.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(oU(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=jM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(tU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(tU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(tU(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var i,r,n,o,a=e.window;;){if(e.lookahead<=WM){if(oU(e),e.lookahead<=WM&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=a[n=e.strstart-1])===a[++n]&&r===a[++n]&&r===a[++n]){o=e.strstart+WM;do{}while(r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&n<o);e.match_length=WM-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=jM._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=jM._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(tU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(tU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(tU(e,!1),0===e.strm.avail_out)?1:2}(r,t):xM[r.level].func(r,t);if(3!==s&&4!==s||(r.status=JM),1===s||3===s)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===s&&(1===t?jM._tr_align(r):5!==t&&(jM._tr_stored_block(r,0,0,!1),3===t&&($M(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),eU(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap<=0?1:(2===r.wrap?(iU(r,255&e.adler),iU(r,e.adler>>8&255),iU(r,e.adler>>16&255),iU(r,e.adler>>24&255),iU(r,255&e.total_in),iU(r,e.total_in>>8&255),iU(r,e.total_in>>16&255),iU(r,e.total_in>>24&255)):(rU(r,e.adler>>>16),rU(r,65535&e.adler)),eU(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)},Jk.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==YM&&t!==qM&&t!==JM?QM(e,KM):(e.state=null,t===qM?QM(e,-3):0):KM},Jk.deflateSetDictionary=function(e,t){var i,r,n,o,a,s,c,u,d=t.length;if(!e||!e.state)return KM;if(2===(o=(i=e.state).wrap)||1===o&&42!==i.status||i.lookahead)return KM;for(1===o&&(e.adler=GM(e.adler,t,d,0)),i.wrap=0,d>=i.w_size&&(0===o&&($M(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new BM.Buf8(i.w_size),BM.arraySet(u,t,d-i.w_size,i.w_size,0),t=u,d=i.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,oU(i);i.lookahead>=3;){r=i.strstart,n=i.lookahead-2;do{i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++}while(--n);i.strstart=r,i.lookahead=2,oU(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,i.wrap=o,0},Jk.deflateInfo="pako deflate (from Nodeca project)";var pU={},_U=Yk,fU=!0,vU=!0;try{String.fromCharCode.apply(null,[0])}catch(e){fU=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){vU=!1}for(var mU=new _U.Buf8(256),SU=0;SU<256;SU++)mU[SU]=SU>=252?6:SU>=248?5:SU>=240?4:SU>=224?3:SU>=192?2:1;function yU(e,t){if(t<65534&&(e.subarray&&vU||!e.subarray&&fU))return String.fromCharCode.apply(null,_U.shrinkBuf(e,t));for(var i="",r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i}mU[254]=mU[254]=1,pU.string2buf=function(e){var t,i,r,n,o,a=e.length,s=0;for(n=0;n<a;n++)55296==(64512&(i=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),s+=i<128?1:i<2048?2:i<65536?3:4;for(t=new _U.Buf8(s),o=0,n=0;o<s;n++)55296==(64512&(i=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),i<128?t[o++]=i:i<2048?(t[o++]=192|i>>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},pU.buf2binstring=function(e){return yU(e,e.length)},pU.binstring2buf=function(e){for(var t=new _U.Buf8(e.length),i=0,r=t.length;i<r;i++)t[i]=e.charCodeAt(i);return t},pU.buf2string=function(e,t){var i,r,n,o,a=t||e.length,s=new Array(2*a);for(r=0,i=0;i<a;)if((n=e[i++])<128)s[r++]=n;else if((o=mU[n])>4)s[r++]=65533,i+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&i<a;)n=n<<6|63&e[i++],o--;o>1?s[r++]=65533:n<65536?s[r++]=n:(n-=65536,s[r++]=55296|n>>10&1023,s[r++]=56320|1023&n)}return yU(s,r)},pU.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+mU[e[i]]>t?i:t};var gU=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},EU=Jk,bU=Yk,TU=pU,IU=FM,RU=gU,AU=Object.prototype.toString;function CU(e){if(!(this instanceof CU))return new CU(e);this.options=bU.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new RU,this.strm.avail_out=0;var i=EU.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(IU[i]);if(t.header&&EU.deflateSetHeader(this.strm,t.header),t.dictionary){var r;if(r="string"==typeof t.dictionary?TU.string2buf(t.dictionary):"[object ArrayBuffer]"===AU.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=EU.deflateSetDictionary(this.strm,r)))throw new Error(IU[i]);this._dict_set=!0}}function OU(e,t){var i=new CU(t);if(i.push(e,!0),i.err)throw i.msg||IU[i.err];return i.result}CU.prototype.push=function(e,t){var i,r,n=this.strm,o=this.options.chunkSize;if(this.ended)return!1;r=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=TU.string2buf(e):"[object ArrayBuffer]"===AU.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new bU.Buf8(o),n.next_out=0,n.avail_out=o),1!==(i=EU.deflate(n,r))&&0!==i)return this.onEnd(i),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(TU.buf2binstring(bU.shrinkBuf(n.output,n.next_out))):this.onData(bU.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==i);return 4===r?(i=EU.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),n.avail_out=0,!0)},CU.prototype.onData=function(e){this.chunks.push(e)},CU.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=bU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},qk.Deflate=CU,qk.deflate=OU,qk.deflateRaw=function(e,t){return(t=t||{}).raw=!0,OU(e,t)},qk.gzip=function(e,t){return(t=t||{}).gzip=!0,OU(e,t)};var wU={},NU=s,PU=Ct,DU=Qf,kU=a,MU=RegExp.prototype;NU&&kU((function(){return"sy"!==Object.getOwnPropertyDescriptor(MU,"flags").get.call({dotAll:!0,sticky:!0})}))&&PU.f(MU,"flags",{configurable:!0,get:DU});var UU={},LU=Yk,xU=15,VU=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],FU=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],BU=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],jU=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],GU=Yk,HU=UM,zU=VM,KU=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A;i=e.state,r=e.next_in,R=e.input,n=r+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=i.dmax,u=i.wsize,d=i.whave,l=i.wnext,h=i.window,p=i.hold,_=i.bits,f=i.lencode,v=i.distcode,m=(1<<i.lenbits)-1,S=(1<<i.distbits)-1;e:do{_<15&&(p+=R[r++]<<_,_+=8,p+=R[r++]<<_,_+=8),y=f[p&m];t:for(;;){if(p>>>=g=y>>>24,_-=g,0===(g=y>>>16&255))A[o++]=65535&y;else{if(!(16&g)){if(0==(64&g)){y=f[(65535&y)+(p&(1<<g)-1)];continue t}if(32&g){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}E=65535&y,(g&=15)&&(_<g&&(p+=R[r++]<<_,_+=8),E+=p&(1<<g)-1,p>>>=g,_-=g),_<15&&(p+=R[r++]<<_,_+=8,p+=R[r++]<<_,_+=8),y=v[p&S];i:for(;;){if(p>>>=g=y>>>24,_-=g,!(16&(g=y>>>16&255))){if(0==(64&g)){y=v[(65535&y)+(p&(1<<g)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(b=65535&y,_<(g&=15)&&(p+=R[r++]<<_,(_+=8)<g&&(p+=R[r++]<<_,_+=8)),(b+=p&(1<<g)-1)>c){e.msg="invalid distance too far back",i.mode=30;break e}if(p>>>=g,_-=g,b>(g=o-a)){if((g=b-g)>d&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(T=0,I=h,0===l){if(T+=u-g,g<E){E-=g;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}}else if(l<g){if(T+=u+l-g,(g-=l)<E){E-=g;do{A[o++]=h[T++]}while(--g);if(T=0,l<E){E-=g=l;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}}}else if(T+=l-g,g<E){E-=g;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}for(;E>2;)A[o++]=I[T++],A[o++]=I[T++],A[o++]=I[T++],E-=3;E&&(A[o++]=I[T++],E>1&&(A[o++]=I[T++]))}else{T=o-b;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],E-=3}while(E>2);E&&(A[o++]=A[T++],E>1&&(A[o++]=A[T++]))}break}}break}}while(r<n&&o<s);r-=E=_>>3,p&=(1<<(_-=E<<3))-1,e.next_in=r,e.next_out=o,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=o<s?s-o+257:257-(o-s),i.hold=p,i.bits=_},WU=function(e,t,i,r,n,o,a,s){var c,u,d,l,h,p,_,f,v,m=s.bits,S=0,y=0,g=0,E=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,w=0,N=new LU.Buf16(16),P=new LU.Buf16(16),D=null,k=0;for(S=0;S<=xU;S++)N[S]=0;for(y=0;y<r;y++)N[t[i+y]]++;for(b=m,E=xU;E>=1&&0===N[E];E--);if(b>E&&(b=E),0===E)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(g=1;g<E&&0===N[g];g++);for(b<g&&(b=g),R=1,S=1;S<=xU;S++)if(R<<=1,(R-=N[S])<0)return-1;if(R>0&&(0===e||1!==E))return-1;for(P[1]=0,S=1;S<xU;S++)P[S+1]=P[S]+N[S];for(y=0;y<r;y++)0!==t[i+y]&&(a[P[t[i+y]]++]=y);if(0===e?(O=D=a,p=19):1===e?(O=VU,w-=257,D=FU,k-=257,p=256):(O=BU,D=jU,p=-1),C=0,y=0,S=g,h=o,T=b,I=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){_=S-I,a[y]<p?(f=0,v=a[y]):a[y]>p?(f=D[k+a[y]],v=O[w+a[y]]):(f=96,v=0),c=1<<S-I,g=u=1<<T;do{n[h+(C>>I)+(u-=c)]=_<<24|f<<16|v|0}while(0!==u);for(c=1<<S-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,y++,0==--N[S]){if(S===E)break;S=t[i+a[y]]}if(S>b&&(C&l)!==d){for(0===I&&(I=b),h+=g,R=1<<(T=S-I);T+I<E&&!((R-=N[T+I])<=0);)T++,R<<=1;if(A+=1<<T,1===e&&A>852||2===e&&A>592)return 1;n[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(n[h+C]=S-I<<24|64<<16|0),s.bits=b,0},XU=-2,YU=12,qU=30;function JU(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function QU(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new GU.Buf16(320),this.work=new GU.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function ZU(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new GU.Buf32(852),t.distcode=t.distdyn=new GU.Buf32(592),t.sane=1,t.back=-1,0):XU}function $U(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,ZU(e)):XU}function eL(e,t){var i,r;return e&&e.state?(r=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?XU:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,$U(e))):XU}function tL(e,t){var i,r;return e?(r=new QU,e.state=r,r.window=null,0!==(i=eL(e,t))&&(e.state=null),i):XU}var iL,rL,nL=!0;function oL(e){if(nL){var t;for(iL=new GU.Buf32(512),rL=new GU.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(WU(1,e.lens,0,288,iL,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;WU(2,e.lens,0,32,rL,0,e.work,{bits:5}),nL=!1}e.lencode=iL,e.lenbits=9,e.distcode=rL,e.distbits=5}function aL(e,t,i,r){var n,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new GU.Buf8(o.wsize)),r>=o.wsize?(GU.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>r&&(n=r),GU.arraySet(o.window,t,i-r,n,o.wnext),(r-=n)?(GU.arraySet(o.window,t,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}UU.inflateReset=$U,UU.inflateReset2=eL,UU.inflateResetKeep=ZU,UU.inflateInit=function(e){return tL(e,15)},UU.inflateInit2=tL,UU.inflate=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A=0,C=new GU.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return XU;(i=e.state).mode===YU&&(i.mode=13),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=i.hold,d=i.bits,l=s,h=c,T=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(2&i.wrap&&35615===u){i.check=0,C[0]=255&u,C[1]=u>>>8&255,i.check=zU(i.check,C,2,0),u=0,d=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=qU;break}if(8!=(15&u)){e.msg="unknown compression method",i.mode=qU;break}if(d-=4,b=8+(15&(u>>>=4)),0===i.wbits)i.wbits=b;else if(b>i.wbits){e.msg="invalid window size",i.mode=qU;break}i.dmax=1<<b,e.adler=i.check=1,i.mode=512&u?10:YU,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(i.flags=u,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=qU;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=qU;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=zU(i.check,C,2,0)),u=0,d=0,i.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.head&&(i.head.time=u),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,i.check=zU(i.check,C,4,0)),u=0,d=0,i.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.head&&(i.head.xflags=255&u,i.head.os=u>>8),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=zU(i.check,C,2,0)),u=0,d=0,i.mode=5;case 5:if(1024&i.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.length=u,i.head&&(i.head.extra_len=u),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=zU(i.check,C,2,0)),u=0,d=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((p=i.length)>s&&(p=s),p&&(i.head&&(b=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),GU.arraySet(i.head.extra,r,o,p,b)),512&i.flags&&(i.check=zU(i.check,r,p,o)),s-=p,o+=p,i.length-=p),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break e;p=0;do{b=r[o+p++],i.head&&b&&i.length<65536&&(i.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&i.flags&&(i.check=zU(i.check,r,p,o)),s-=p,o+=p,b)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===s)break e;p=0;do{b=r[o+p++],i.head&&b&&i.length<65536&&(i.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&i.flags&&(i.check=zU(i.check,r,p,o)),s-=p,o+=p,b)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u!==(65535&i.check)){e.msg="header crc mismatch",i.mode=qU;break}u=0,d=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=YU;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}e.adler=i.check=JU(u),u=0,d=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,2;e.adler=i.check=1,i.mode=YU;case YU:if(5===t||6===t)break e;case 13:if(i.last){u>>>=7&d,d-=7&d,i.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}switch(i.last=1&u,d-=1,3&(u>>>=1)){case 0:i.mode=14;break;case 1:if(oL(i),i.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=qU}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",i.mode=qU;break}if(i.length=65535&u,u=0,d=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(p=i.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;GU.arraySet(n,r,o,p,a),s-=p,o+=p,c-=p,a+=p,i.length-=p;break}i.mode=YU;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(i.nlen=257+(31&u),u>>>=5,d-=5,i.ndist=1+(31&u),u>>>=5,d-=5,i.ncode=4+(15&u),u>>>=4,d-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=qU;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.lens[O[i.have++]]=7&u,u>>>=3,d-=3}for(;i.have<19;)i.lens[O[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,I={bits:i.lenbits},T=WU(0,i.lens,0,19,i.lencode,0,i.work,I),i.lenbits=I.bits,T){e.msg="invalid code lengths set",i.mode=qU;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;m=(A=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(S<16)u>>>=v,d-=v,i.lens[i.have++]=S;else{if(16===S){for(R=v+2;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u>>>=v,d-=v,0===i.have){e.msg="invalid bit length repeat",i.mode=qU;break}b=i.lens[i.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===S){for(R=v+3;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(R=v+7;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=11+(127&(u>>>=v)),u>>>=7,d-=7}if(i.have+p>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=qU;break}for(;p--;)i.lens[i.have++]=b}}if(i.mode===qU)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=qU;break}if(i.lenbits=9,I={bits:i.lenbits},T=WU(1,i.lens,0,i.nlen,i.lencode,0,i.work,I),i.lenbits=I.bits,T){e.msg="invalid literal/lengths set",i.mode=qU;break}if(i.distbits=6,i.distcode=i.distdyn,I={bits:i.distbits},T=WU(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,I),i.distbits=I.bits,T){e.msg="invalid distances set",i.mode=qU;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,KU(e,h),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=i.hold,d=i.bits,i.mode===YU&&(i.back=-1);break}for(i.back=0;m=(A=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(m&&0==(240&m)){for(y=v,g=m,E=S;m=(A=i.lencode[E+((u&(1<<y+g)-1)>>y)])>>>16&255,S=65535&A,!(y+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=y,d-=y,i.back+=y}if(u>>>=v,d-=v,i.back+=v,i.length=S,0===m){i.mode=26;break}if(32&m){i.back=-1,i.mode=YU;break}if(64&m){e.msg="invalid literal/length code",i.mode=qU;break}i.extra=15&m,i.mode=22;case 22:if(i.extra){for(R=i.extra;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;m=(A=i.distcode[u&(1<<i.distbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(0==(240&m)){for(y=v,g=m,E=S;m=(A=i.distcode[E+((u&(1<<y+g)-1)>>y)])>>>16&255,S=65535&A,!(y+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=y,d-=y,i.back+=y}if(u>>>=v,d-=v,i.back+=v,64&m){e.msg="invalid distance code",i.mode=qU;break}i.offset=S,i.extra=15&m,i.mode=24;case 24:if(i.extra){for(R=i.extra;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=qU;break}i.mode=25;case 25:if(0===c)break e;if(p=h-c,i.offset>p){if((p=i.offset-p)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=qU;break}p>i.wnext?(p-=i.wnext,_=i.wsize-p):_=i.wnext-p,p>i.length&&(p=i.length),f=i.window}else f=n,_=a-i.offset,p=i.length;p>c&&(p=c),c-=p,i.length-=p;do{n[a++]=f[_++]}while(--p);0===i.length&&(i.mode=21);break;case 26:if(0===c)break e;n[a++]=i.length,c--,i.mode=21;break;case 27:if(i.wrap){for(;d<32;){if(0===s)break e;s--,u|=r[o++]<<d,d+=8}if(h-=c,e.total_out+=h,i.total+=h,h&&(e.adler=i.check=i.flags?zU(i.check,n,h,a-h):HU(i.check,n,h,a-h)),h=c,(i.flags?u:JU(u))!==i.check){e.msg="incorrect data check",i.mode=qU;break}u=0,d=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=qU;break}u=0,d=0}i.mode=29;case 29:T=1;break e;case qU:T=-3;break e;case 31:return-4;default:return XU}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,(i.wsize||h!==e.avail_out&&i.mode<qU&&(i.mode<27||4!==t))&&aL(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,i.total+=h,i.wrap&&h&&(e.adler=i.check=i.flags?zU(i.check,n,h,e.next_out-h):HU(i.check,n,h,e.next_out-h)),e.data_type=i.bits+(i.last?64:0)+(i.mode===YU?128:0)+(20===i.mode||15===i.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},UU.inflateEnd=function(e){if(!e||!e.state)return XU;var t=e.state;return t.window&&(t.window=null),e.state=null,0},UU.inflateGetHeader=function(e,t){var i;return e&&e.state?0==(2&(i=e.state).wrap)?XU:(i.head=t,t.done=!1,0):XU},UU.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?XU:11===i.mode&&HU(1,t,r,0)!==i.check?-3:aL(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):XU},UU.inflateInfo="pako inflate (from Nodeca project)";var sL={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var cL=UU,uL=Yk,dL=pU,lL=sL,hL=FM,pL=gU,_L=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},fL=Object.prototype.toString;function vL(e){if(!(this instanceof vL))return new vL(e);this.options=uL.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new pL,this.strm.avail_out=0;var i=cL.inflateInit2(this.strm,t.windowBits);if(i!==lL.Z_OK)throw new Error(hL[i]);if(this.header=new _L,cL.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=dL.string2buf(t.dictionary):"[object ArrayBuffer]"===fL.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=cL.inflateSetDictionary(this.strm,t.dictionary))!==lL.Z_OK))throw new Error(hL[i])}function mL(e,t){var i=new vL(t);if(i.push(e,!0),i.err)throw i.msg||hL[i.err];return i.result}vL.prototype.push=function(e,t){var i,r,n,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;r=t===~~t?t:!0===t?lL.Z_FINISH:lL.Z_NO_FLUSH,"string"==typeof e?s.input=dL.binstring2buf(e):"[object ArrayBuffer]"===fL.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new uL.Buf8(c),s.next_out=0,s.avail_out=c),(i=cL.inflate(s,lL.Z_NO_FLUSH))===lL.Z_NEED_DICT&&u&&(i=cL.inflateSetDictionary(this.strm,u)),i===lL.Z_BUF_ERROR&&!0===d&&(i=lL.Z_OK,d=!1),i!==lL.Z_STREAM_END&&i!==lL.Z_OK)return this.onEnd(i),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&i!==lL.Z_STREAM_END&&(0!==s.avail_in||r!==lL.Z_FINISH&&r!==lL.Z_SYNC_FLUSH)||("string"===this.options.to?(n=dL.utf8border(s.output,s.next_out),o=s.next_out-n,a=dL.buf2string(s.output,n),s.next_out=o,s.avail_out=c-o,o&&uL.arraySet(s.output,s.output,n,o,0),this.onData(a)):this.onData(uL.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&i!==lL.Z_STREAM_END);return i===lL.Z_STREAM_END&&(r=lL.Z_FINISH),r===lL.Z_FINISH?(i=cL.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===lL.Z_OK):r!==lL.Z_SYNC_FLUSH||(this.onEnd(lL.Z_OK),s.avail_out=0,!0)},vL.prototype.onData=function(e){this.chunks.push(e)},vL.prototype.onEnd=function(e){e===lL.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=uL.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},wU.Inflate=vL,wU.inflate=mL,wU.inflateRaw=function(e,t){return(t=t||{}).raw=!0,mL(e,t)},wU.ungzip=mL;var SL={};(0,Yk.assign)(SL,qk,wU,sL);var yL,gL,EL,bL,TL,IL,RL,AL,CL,OL,wL,NL,PL,DL,kL,ML,UL,LL,xL,VL,FL,BL,jL,GL,HL,zL,KL,WL,XL,YL,qL,JL,QL,ZL,$L,ex,tx,ix,rx,nx,ox,ax,sx,cx,ux,dx,lx,hx=SL;!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",e.RTC_GET_CONFIG="rtc_get_config",e.RTC_RECONNECT="rtc_reconnect",e.RTC_RECONNECTED="rtc_reconnected",e.RTC_GET_ACCESS="rtc_get_access",e.RTC_PRE_ICE_STATE="rtc_pre_ice_state",e.RTC_NODE_CHANGE="rtc_node_change",e.RTC_SIGNALING_MSG_ERROR="rtc_signaling_msg_error",e.RTC_SIGNALING="rtc_signaling",e.RTC_JOIN_ROOM="rtc_join_room",e.RTC_LEAVE_ROOM="rtc_leave_room",e.RTC_BEGIN_CREATE_OFFER="rtc_begin_create_offer",e.RTC_CREATE_OFFER="rtc_create_offer",e.RTC_SET_DESCRIPTION="rtc_set_description",e.RTC_RECV_ANSWER="rtc_recv_answer",e.FIRST_REMOTE_AUDIO_RENDER="first_remote_audio_render",e.FIRST_REMOTE_VIDEO_RENDER="first_remote_video_render",e.RTC_PUBLISH_STAT="rtc_publish_stat",e.RTC_SUBSCRIBE_STAT="rtc_subscribe_stat",e.RTC_AUDIO_DEVICE="rtc_audio_device",e.RTC_MEDIA_STATISTICS="rtc_media_statistics",e.RTC_MESSAGE_STATISTICS="rtc_message_statistics",e.RTC_ERROR="rtc_error",e.RTC_INVOKE_STATUS="rtc_invoke_status",e.RTC_FIRST_FRAME="rtc_first_frame",e.RTC_MUTE_REMOTE="rtc_mute_remote",e.SDK_INIT_ENGINE="sdk_init_engine",e.JOIN_ROOM="join_room",e.P2P_CONNECTION_STATUS="p2p_connection_status",e.P2P_CONNECT_CLOSED="p2p_connect_closed",e.RTC_DEVICE_ERROR="rtc_device_error",e.RTC_VIDEO_DEVICE="rtc_video_device",e.RTC_VIDEO_CAPTURE_EVENT="rtc_video_capture_event",e.RTC_ENCODE_FIRST_FRAME="rtc_encode_first_frame",e.RTC_FIRST_FRAME_ENCODED="rtc_first_frame_encoded",e.RTC_SEND_FIRST_PACKET="rtc_send_first_packet",e.RTC_RECV_FIRST_PACKET="rtc_recv_first_packet",e.RTC_RECV_FIRST_FRAME="rtc_recv_first_frame",e.RTC_DECODE_FIRST_FRAME="rtc_decode_first_frame"}(yL||(yL={})),function(e){e.RTC="rtc"}(gL||(gL={})),function(e){e.W_5="5"}(EL||(EL={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(bL||(bL={})),function(e){e.UNKNOWN="unknown",e.DISCONNECTED="disconnected",e.LAN="lan",e.WIFI="wifi",e.W_2="2g",e.W_3="3g",e.W_4="4g",e.W_5="5g"}(TL||(TL={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(IL||(IL={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(RL||(RL={})),function(e){e.WEBSOCKET_RECONNECTING="websocket reconnecting",e.PEERCONNECTION_RECONNECTING="peerconnection reconnecting",e.DISCONNECTED="DISCONNECTED",e.LAN="LAN",e.WIFI="WIFI",e.W_2="2G",e.W_3="3G",e.W_4="4G",e.W_5="5G",e.UNKNOWN="UNKNOWN"}(AL||(AL={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(CL||(CL={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(OL||(OL={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(wL||(wL={})),function(e){e.REQUEST="request",e.RESPONSE="response",e.KCP_REQUEST="kcp request",e.KCP_RESPONSE="kcp response",e.QUIC_REQUEST="quic request",e.QUIC_RESPONSE="quic response"}(NL||(NL={})),function(e){e.NEW="NEW",e.CHECKING="CHECKING",e.CONNECTED="CONNECTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED",e.DATACHANNEL_CONNECTING="DATACHANNEL_CONNECTING",e.DATACHANNEL_OPEN="DATACHANNEL_OPEN",e.DATACHANNEL_CLOSING="DATACHANNEL_CLOSING",e.DATACHANNEL_CLOSED="DATACHANNEL_CLOSED"}(PL||(PL={})),function(e){e.SUCCEED="succeed",e.MESSAGE_ID_ERROR="message id error",e.ZIP_FAILED="zip failed",e.UNZIP_FAILED="unzip failed",e.MESSAGE_KEY_EMPTY="message key empty",e.MESSAGE_KEY_PARSE_FAILED="message key parse failed",e.MESSAGE_KEY_INVALID="message key invalid",e.ENCRYPT_FAILED="encrypt failed",e.DECRYPT_FAILED="decrypt failed",e.MESSAGE_TOO_BIG="message too big",e.INVALID_DATA="invalid data",e.MESSAGE_PARSE_FAILED="message parse failed"}(DL||(DL={})),function(e){e.CALL_JOINROOM="call-joinRoom",e.JOINROOM="joinRoom",e.CALL_RECONNECTED="call-reconnected",e.RECONNECTED="reconnected",e.CALL_PUBLISH="call-publish",e.PUBLISH="publish",e.CALL_UPDATESTREAMATTRIBUTES="call-updateStreamAttributes",e.UPDATESTREAMATTRIBUTES="updateStreamAttributes",e.CALL_UNPUBLISH="call-unpublish",e.UNPUBLISH="unpublish",e.CALL_SUBSCRIBE="call-subscribe",e.SUBSCRIBE="subscribe",e.CALL_UPDATESUBSCRIBE="call-updateSubscribe",e.UPDATESUBSCRIBE="updateSubscribe",e.CALL_UNSUBSCRIBE="call-unsubscribe",e.UNSUBSCRIBE="unsubscribe",e.CALL_UPDATEUSERATTRIBUTES="call-updateUserAttributes",e.UPDATEUSERATTRIBUTES="updateUserAttributes",e.CALL_LEAVEROOM="call-leaveRoom",e.LEAVEROOM="leaveRoom",e.ON_USERCONNECTION="on-userConnection",e.ON_USERDISCONNECTION="on-userDisconnection",e.ON_ONADDSTREAM="on-onAddStream",e.ON_ONPUSHSTREAM="on-onPushStream",e.ON_ONREMOVESTREAM="on-onRemoveStream",e.ON_ONPUSHTRACK="on-onPushTrack",e.ON_ONREMOVETRACK="on-onRemoveTrack",e.ON_ONUPDATEUSERATTRIBUTES="on-onUpdateUserAttributes",e.ON_ONUPDATEROOMATTRIBUTES="on-onUpdateRoomAttributes",e.ON_ONUPDATESTREAMATTRIBUTES="on-onUpdateStreamAttributes",e.ON_STREAMFAILED="on-streamFailed",e.ON_POSTPROCESSINGMESSAGE="on-postProcessingMessage",e.ON_ENGINECONTROLMESSAGE="on-engineControlMessage",e.ON_WEBSOCKETENGINECUSTOMMESSAGE="on-websocketEngineCustomMessage",e.UNKNOWN="unknown",e.CALL_UPDATEPUBLISHSTREAMCHANNEL="call-updatePublishStreamChannel",e.UPDATEPUBLISHSTREAMCHANNEL="updatePublishStreamChannel",e.CALL_UPDATESUBSCRIBESTREAMCHANNEL="call-updateSubscribeStreamChannel",e.UPDATESUBSCRIBESTREAMCHANNEL="updateSubscribeStreamChannel",e.ON_ONSTREAMCHANNELCHANGE="on-onStreamChannelChange",e.P2PDIRECT="p2pdirect",e.INTERNAL_CUSTOM="internal_custom",e.REPORT="report",e.CONNECTION_CONTROL="connection_control",e.ON_INTERNAL_CUSTOM="on_internal_custom",e.CONTROLMESSAGE="controlMessage",e.CALL_LOGIN="call-login",e.LOGIN="login",e.CALL_RECONNECTLOGIN="call-reconnectLogin",e.RECONNECTLOGIN="reconnectLogin",e.CALL_LOGOUT="call-logout",e.LOGOUT="logout",e.CALL_UPDATELOGINTOKEN="call-updateLoginToken",e.UPDATELOGINTOKEN="updateLoginToken",e.CALL_SETSERVERPARAMS="call-setServerParams",e.SETSERVERPARAMS="setServerParams",e.CALL_GETPEERONLINESTATUS="call-getPeerOnlineStatus",e.GETPEERONLINESTATUS="getPeerOnlineStatus",e.ON_ONSCENECONFIG="on-onSceneConfig",e.ON_STREAMCONTROLMESSAGE="on-streamControlMessage",e.CALL_STARTPUSHSTREAM="call-startPushStream",e.STARTPUSHSTREAM="startPushStream",e.CALL_STOPPUSHSTREAM="call-stopPushStream",e.STOPPUSHSTREAM="stopPushStream",e.CALL_STARTPULLSTREAM="call-startPullStream",e.STARTPULLSTREAM="startPullStream",e.CALL_STOPPULLSTREAM="call-stopPullStream",e.STOPPULLSTREAM="stopPullStream",e.CALL_UPDATEPULLSTREAM="call-updatePullStream",e.UPDATEPULLSTREAM="updatePullStream",e.ON_ONSTREAMPUSHEDBYOTHER="on-onStreamPushedByOther",e.CALL_UPDATETOKEN="call-updateToken",e.UPDATETOKEN="updateToken",e.ON_ONTOKENWILLEXPIRE="on-onTokenWillExpire",e.ON_ONPUSHCLIENTCONFIG="on-onPushClientConfig",e.CALL_GETCLIENTCONFIG="call-getClientConfig",e.GETCLIENTCONFIG="getClientConfig"}(kL||(kL={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(ML||(ML={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(UL||(UL={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(LL||(LL={})),function(e){e.W_0="0",e.W_1="1"}(xL||(xL={})),function(e){e.UP="up",e.DOWN="down"}(VL||(VL={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(FL||(FL={})),function(e){e.UP="up",e.DOWN="down"}(BL||(BL={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(jL||(jL={})),function(e){e.W_0="0",e.W_1="1"}(GL||(GL={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown"}(HL||(HL={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(zL||(zL={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.ON_STREAM_REMOVE="on stream remove",e.PUBLISH_MUTE="publish mute",e.UNKNOWN="unknown",e.ON_STREAM_REMOVE_CLIENT_UNPUBLISHED="on stream remove:client unpublished",e.ON_STREAM_REMOVE_PUBLISH_FAILED="on stream remove:publish failed",e.ON_STREAM_REMOVE_STREAM_REMOVED="on stream remove:stream removed",e.ON_STREAM_REMOVE_CLIENT_DISCONNECTED="on stream remove:client disconnected",e.ON_STREAM_REMOVE_CLIENT_REPUBLISH="on stream remove:client republish"}(KL||(KL={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(WL||(WL={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(XL||(XL={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(YL||(YL={})),function(e){e.LOGIN="login",e.PUBLISHER="publisher",e.UNMUTE="unmute",e.ENABLE="enable",e.PUSH="push",e.PUBLISH="publish",e.ONDEMAND="ondemand",e.SUBSCRIBE="subscribe",e.PUSH_TRACK="push_track",e.REMOTE_UNMUTE="remote_unmute",e.P2P="p2p"}(qL||(qL={})),function(e){e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave"}(JL||(JL={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(QL||(QL={})),function(e){e.BEGIN="begin",e.END="end"}(ZL||(ZL={})),function(e){e.BEGIN="begin",e.END="end"}($L||($L={})),function(e){e.LEAVE_ROOM="leave_room",e.ACK_FAILED="ack_failed",e.TOKEN_ERROR="token_error",e.SIGNALING_ERROR="signaling_error",e.TIMEOUT_10="timeout_10",e.TIMEOUT_60="timeout_60"}(ex||(ex={})),function(e){e.UNKNOWN="unknown",e.NEW="new",e.CHECKING="checking",e.CONNECTED="connected",e.FAILED="failed",e.SELECTED="selected",e.CLOSING="closing",e.CLOSED="closed",e.UNSELECTED="unselected"}(tx||(tx={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(ix||(ix={})),function(e){e.UNKNOWN="UNKNOWN",e.AUDIO_RECORD="AUDIO_RECORD",e.AUDIO_PLAYOUT="AUDIO_PLAYOUT",e.VIDEO="VIDEO",e.SHARE_AUDIO_RECORD="SHARE_AUDIO_RECORD",e.SHARE_VIDEO="SHARE_VIDEO"}(rx||(rx={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(nx||(nx={})),function(e){e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped"}(ox||(ox={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(ax||(ax={})),function(e){e.SUCCESS="success",e.CAMERA_DEVICE_NO_PERMISSION="camera_device_no_permission",e.CAMERA_DEVICE_BUSY="camera_device_busy",e.CAMERA_DEVICE_FAILURE="camera_device_failure",e.CAMERA_DEVICE_NOT_FOUND="camera_device_not_found",e.CAMERA_DEVICE_DISCONNECTED="camera_device_disconnected",e.TIMEOUT="timeout",e.ABORT="abort"}(sx||(sx={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(cx||(cx={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(ux||(ux={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(dx||(dx={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(lx||(lx={}));var px=function(){function e(e){this.monitor=e}return e.prototype.setStats=function(e){var t=this;Object.keys(e).forEach((function(i){t["_"+i]=e[i]})),this.monitor.StartUp()},Object.defineProperty(e.prototype,"event_key",{get:function(){return this._event_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_id",{get:function(){return this._device_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_app_id",{get:function(){return this._rtc_app_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"product_line",{get:function(){return this._product_line},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_version",{get:function(){return this._report_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"os",{get:function(){return this._os},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_version",{get:function(){return this._rtc_sdk_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_timestamp",{get:function(){return this._rtc_timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_git_commit",{get:function(){return this._rtc_sdk_git_commit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_id",{get:function(){return this._report_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connection_id",{get:function(){return this._connection_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sid",{get:function(){return this._rtc_sid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"engine_session_id",{get:function(){return this._engine_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_business_id",{get:function(){return this._rtc_business_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"project_key",{get:function(){return this._project_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"network_type",{get:function(){return this._network_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app_version",{get:function(){return this._app_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aid",{get:function(){return this._aid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_model",{get:function(){return this._device_model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_brand",{get:function(){return this._device_brand},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"common_extra_info",{get:function(){return this._common_extra_info},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"had_selected_p2p",{get:function(){return this._had_selected_p2p},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_env_type",{get:function(){return this._rtc_env_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"room_id",{get:function(){return this._room_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_id",{get:function(){return this._user_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_session_id",{get:function(){return this._rtc_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_agent",{get:function(){return this._user_agent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"auto_play_policy",{get:function(){return this._auto_play_policy},enumerable:!1,configurable:!0}),e}(),_x=function(e){function t(){var t=e.call(this)||this;return t.report_id=0,t.dataBuffer=[],t.posting=!1,t.report_common={},t.modify_ids={},t.preSucTime=0,t.errSendDelay=100,t.commonStats=new px(t),XD()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return A_(t,e),t.prototype.push=function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))},t.prototype.unshift=function(e){this.dataBuffer=e.concat(this.dataBuffer)},t.prototype.send=function(e,t){var i=this;if(e||this.dataBuffer.length){var r={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},n=new XMLHttpRequest;n.timeout=1e4,n.onreadystatechange=function(){if(4===n.readyState){e||(i.posting=!1);var o=void 0;if(200===n.status||304===n.status)try{o=JSON.parse(n.responseText)}catch(e){}o&&0===o.StatusCode?e||t||i.sucSend():e?i.send(e):(i.unshift(r.data),t?i.send():i.errSend())}};var o=iV.LOG_SERVER_URL;if(n.open("POST",o,!0),e||(this.posting=!0),!XD()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",r),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!XD()&&location.search.includes("_rtc_debug_"))n.send(JSON.stringify(r));else{var a=hx.gzip(JSON.stringify(r));n.setRequestHeader("Content-Encoding","gzip"),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(a)}}},t.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},t.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},t.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,i=t.event_key,r=t.device_id,n=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,p=t.engine_session_id,_=t.rtc_business_id,f=t.project_key,v=t.network_type,m=t.app_version,S=t.aid,y=t.device_model,g=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,T=t.rtc_env_type,I=t.user_agent,R=t.auto_play_policy;Object.assign(e,{event_key:i,device_id:r,rtc_app_id:n,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:p,rtc_business_id:_,project_key:f,network_type:v,app_version:m,aid:S,device_model:y,device_brand:g,common_extra_info:E,had_selected_p2p:b,rtc_env_type:T,user_agent:I,auto_play_policy:R}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id),this.commonStats.connection_id&&(this.modify_ids.connection_id=this.commonStats.connection_id)},t.prototype.rtcSdkApiCall=function(e,t,i,r){void 0===r&&(r={});var n=Z_(Z_({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSdkCallback=function(e,t,i,r){void 0===r&&(r={});var n=Z_(Z_({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcGetConfig=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=Z_(Z_({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i,host:r,type:n,config_id:o,enable_cloud_proxy:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcReconnect=function(e,t,i,r,n){void 0===n&&(n={});var o=Z_(Z_({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:i,reconnect_type:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcReconnected=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcGetAccess=function(e,t,i,r,n,o,a){void 0===a&&(a={});var s=Z_(Z_({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i,type:r,host:n,connect_session_id:o},this.modify_ids),{common_extra_info:JSON.stringify(a)});this.push(s)},t.prototype.rtcPreIceState=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcNodeChange=function(e,t,i,r){void 0===r&&(r={});var n=Z_(Z_({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSignalingMsgError=function(e,t,i,r){void 0===r&&(r={});var n=Z_(Z_({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSignaling=function(e,t,i,r,n,o){void 0===o&&(o={});var a=Z_(Z_({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:i,signaling_type:r,direction:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcJoinRoom=function(e,t,i,r,n){void 0===n&&(n={});var o=Z_(Z_({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:i,elapse:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,i,r){void 0===r&&(r={});var n=Z_(Z_({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcBeginCreateOffer=function(e,t,i,r){void 0===r&&(r={});var n=Z_(Z_({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcCreateOffer=function(e,t,i,r,n,o){void 0===o&&(o={});var a=Z_(Z_({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:i,stream_user_id:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcSetDescription=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=Z_(Z_({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:i,direction:r,stream_id:n,stream_user_id:o,elapse:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcRecvAnswer=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=Z_(Z_({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:i,message:r,direction:n,stream_id:o,stream_user_id:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.firstRemoteAudioRender=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.firstRemoteVideoRender=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcPublishStat=function(e,t,i,r,n){void 0===n&&(n={});var o=Z_(Z_({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:i,message:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,i,r,n){void 0===n&&(n={});var o=Z_(Z_({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:i,stream_user_id:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcAudioDevice=function(e,t,i,r){void 0===r&&(r={});var n=Z_(Z_({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcMediaStatistics=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_(Z_(Z_({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcMessageStatistics=function(e,t,i,r){void 0===r&&(r={});var n=Z_(Z_({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcError=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcInvokeStatus=function(e,t,i,r,n,o){void 0===o&&(o={});var a=Z_(Z_({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:i,stream_id:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var i=Z_(Z_(Z_({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcMuteRemote=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.sdkInitEngine=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.joinRoom=function(e,t,i,r,n){void 0===n&&(n={});var o=Z_(Z_({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:i,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,i,r,n,o){void 0===o&&(o={});var a=Z_(Z_({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:i,status:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var i=Z_(Z_({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcDeviceError=function(e,t,i,r,n,o,a,s,c,u,d,l,h,p,_,f,v){void 0===v&&(v={});var m=Z_(Z_({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:i,system_error_code:r,system_api:n,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:p,device_vid:_,media_mode:f},this.modify_ids),{common_extra_info:JSON.stringify(v)});this.push(m)},t.prototype.rtcVideoDevice=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var i=Z_(Z_(Z_({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcEncodeFirstFrame=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_(Z_(Z_({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcFirstFrameEncoded=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_(Z_(Z_({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcSendFirstPacket=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_(Z_(Z_({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcRecvFirstPacket=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_(Z_(Z_({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcRecvFirstFrame=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_(Z_(Z_({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcDecodeFirstFrame=function(e,t,i){void 0===i&&(i={});var r=Z_(Z_(Z_(Z_({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t}(wk),fx=new _x,vx=new _x,mx=new _x,Sx=fx.commonStats,yx=vx.commonStats,gx=mx.commonStats,Ex={default:fx,rtm:vx,outsideRoom:mx};function bx(e){void 0===e&&(e="default");for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return function(i,r,n){if("function"==typeof n.value){var o=n.value;n.value=function(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var a={};t.forEach((function(e,t){a[e]=i[t]})),"joinRoom"===r&&Sx.setStats({room_id:i[1]}),Ex[e].rtcSdkApiCall(r,0,JSON.stringify(ik(i)),a);var s=o.apply(this,i);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return Ex[e].rtcSdkCallback(r,0,JSON.stringify(ik([t||{}]))),t})).catch((function(t){throw Ex[e].rtcSdkCallback(r,t.code,JSON.stringify(t.message)),t})):(Ex[e].rtcSdkCallback(r,0,JSON.stringify(ik([s||{}]))),s)}}}}function Tx(e,t,i){void 0===i&&(i=0),(e===df.onUserMessageReceivedOutsideRoom||e===df.onUserBinaryMessageReceivedOutsideRoom?vx:fx).rtcSdkCallback(e,i,JSON.stringify(t))}function Ix(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=!1),(r?vx:fx).rtcInvokeStatus(JSON.stringify(t),i,e,"",0)}var Rx="RTC_DEVICE_ID",Ax="RTC_ACCESS_NODE",Cx="RTC_ACCESS_URLS",Ox="RTC_H264_BLACK_LIST",wx="engine_BAC",Nx=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);if(!t)return null;try{var i=JSON.parse(t);return i.ttl>0&&Date.now()-i.saveTime>i.ttl?(this.delete(e),null):i.message}catch(e){return null}},e.prototype.set=function(e,t,i){void 0===i&&(i=-1);var r={ttl:i,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(r)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),Px=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return A_(t,e),t.prototype.getDeviceId=function(){if(XD())return"";var e=this.get(Rx);return e||(e=jD()),this.set(Rx,e),e},t.prototype.setDeviceId=function(e){return[Sx,yx,gx].forEach((function(t){return t.setStats({device_id:e})})),this.set(Rx,e),e},t.prototype.getAccessNode=function(e){return this.get("".concat(Ax,"_").concat(e,"-BytePlus"))},t.prototype.setAccessNode=function(e,t,i){return this.set("".concat(Ax,"_").concat(e,"-BytePlus"),t,1e3*i)},t.prototype.clearAccessNode=function(e){this.delete("".concat(Ax,"_").concat(e,"-BytePlus"))},t.prototype.getAccessUrls=function(){return this.get("".concat(Cx,"-BytePlus"))},t.prototype.setAccessUrls=function(e){var t=e.map((function(e){var t=e.host,i=e.path;return"https://".concat(t).concat(i)}));return this.set("".concat(Cx,"-BytePlus"),t)},t.prototype.clearAccessUrls=function(){this.delete("".concat(Cx,"-BytePlus"))},t.prototype.getH264BlackList=function(){return this.get(Ox)},t.prototype.setH264BlackList=function(e){return this.set(Ox,e)},t.prototype.getAudioProfile=function(){return this.get(wx)},t.prototype.setAudioProfile=function(e){return this.set(wx,e)},t}(Nx),Dx=new Px,kx="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function Mx(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var Ux="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",Lx="rtc.rtcplus.com".split(","),xx={VERSION:"4.45.5",ICE_CONFIG_REQUEST_URLS_INTERNAL:kx.map(Mx),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:Ux,CONFIG_REQUEST_DOMAINS:Lx,DEVICE_ID:"",OVERSEA:!1};function Vx(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(xx.ICE_CONFIG_REQUEST_URLS=t.map(Mx))):void("LOG_SERVER_URL"!==e||t!==j_.overseas?"LOG_SERVER_URL"!==e||t!==j_.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?("DEVICE_ID"===e&&Dx.setDeviceId(t),xx[e]=t):xx.OVERSEA=t:xx.LOG_SERVER_URL=t:xx.LOG_SERVER_URL=Ux:xx.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function Fx(e){return"DEVICE_ID"===e?Dx.getDeviceId():xx[e]}function Bx(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:(null===(i=t.audio)||void 0===i?void 0:i.codec)||$x.audio.codec,bitRate:1e3*((null===(r=t.audio)||void 0===r?void 0:r.kBitRate)||$x.audio.kBitRate),sampleRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.sampleRate)||$x.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||$x.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||$x.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||$x.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||$x.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||$x.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:$x.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||$x.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||$x.video.width,height:(null===(_=t.video)||void 0===_?void 0:_.height)||$x.video.height},layout:{canvas:{bgnd:(null===(f=t.layout)||void 0===f?void 0:f.backgroundColor)||$x.layout.backgroundColor},regions:(null===(m=null===(v=t.layout)||void 0===v?void 0:v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(S=t.layout)||void 0===S?void 0:S.appData)||$x.layout.appData}}}}function jx(e,t,i){var r,n,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(r=i.video)||void 0===r?void 0:r.fps)||15,bitrate:1e3*((null===(n=i.video)||void 0===n?void 0:n.kBitRate)||40),width:(null===(o=i.video)||void 0===o?void 0:o.width)||640,height:(null===(a=i.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=i.layout)||void 0===s?void 0:s.interpolationMode)||z_.PREV_FRAME,canvas:{bgColor:(null===(c=i.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=i.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(l=null===(d=i.layout)||void 0===d?void 0:d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:e.alpha,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var Gx,Hx,zx,Kx,Wx,Xx,Yx,qx,Jx,Qx,Zx,$x={url:"",video:{codec:"H264",width:640,height:360,fps:30,gop:60,kBitRate:600,lowLatency:!0},audio:{codec:"AAC",kBitRate:64,sampleRate:48,channels:2,AACProfile:"LC"},layout:{regions:[],appData:"",backgroundColor:"#000000"}},eV={width:640,height:360,frameRate:30,maxKbps:600},tV={width:1920,height:1080,frameRate:15,maxKbps:3e3},iV=xx;!function(e){e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted"}(Gx||(Gx={})),function(e){e.PushLimitWarn="PushLimitWarn"}(Hx||(Hx={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SCENE_CONFIG="onSceneConfig"}(zx||(zx={})),function(e){e.RSCP="RSCP"}(Kx||(Kx={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(Wx||(Wx={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(Xx||(Xx={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(Yx||(Yx={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(Jx||(Jx={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(Qx||(Qx={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.INIT=101]="INIT",e[e.NO_CONNECTION=102]="NO_CONNECTION",e[e.EXCEED_MAX_LENGTH=103]="EXCEED_MAX_LENGTH",e[e.EMPTY_USER=104]="EMPTY_USER",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN"}(Zx||(Zx={}));var rV,nV,oV=((qx={})[Zx.SUCCESS]=[0,"success"],qx[Zx.TIMEOUT]=[aP.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],qx[Zx.BROKEN]=[aP.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],qx[Zx.NO_RECEIVER]=[aP.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],qx[Zx.NO_RELAYPATH]=[aP.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],qx[Zx.SEND_TO_SERVER_ERROR]=[aP.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],qx[Zx.SERVER_RESPONSE_ERROR]=[aP.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],qx[Zx.NOT_JOIN]=[aP.USER_MESSAGE_NOT_JOIN,"not join room"],qx[Zx.INIT]=[aP.USER_MESSAGE_INIT,"not init."],qx[Zx.NO_CONNECTION]=[aP.USER_MESSAGE_NO_CONNECTION,"no connection."],qx[Zx.EXCEED_MAX_LENGTH]=[aP.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],qx[Zx.EMPTY_USER]=[aP.USER_MESSAGE_EMPTY_USER,"user id is empty."],qx[Zx.NOT_LOGIN]=[aP.USER_MESSAGE_NOT_LOGIN,"not login."],qx[Zx.SERVER_PARAMS_NOTSET]=[aP.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],qx[Zx.UNKNOWN]=[aP.USER_MESSAGE_UNKNOWN,"unknown."],qx),aV=new Ck("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(rV||(rV={})),function(e){e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM"}(nV||(nV={}));var sV=function(e){function t(t){var i=e.call(this)||this;return i._dataChannel=t,i._singlingCache=new Map,i._p2pCache=new Map,i._rttIds={},i._p2pMessageId=0,i._clearDataChannelListener=i._handleHandler(),window.__rtc_mock_signaling__=i.emit.bind(i),i}return A_(t,e),t.prototype.destroy=function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}},t.prototype.sendSignaling=function(e,t,i){var r=this;return fx.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",ML.UP),new Promise((function(n,o){var a=r._genHeader(i);a.id=$D();var s=a.id.join("-"),c=setTimeout((function(){r._singlingCache.delete(s),o(new lP(aP.TIME_OUT,"".concat(e," message time out")))}),6e4);r._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),n(e)},error:function(e){clearTimeout(c),o(e)}}),aV.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),r._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:nV.C2GW})},t.prototype.sendP2PMessage=function(e,t){var i=e.msg,r=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i}(e,["msg"]);return ef(this,void 0,void 0,(function(){var e,n,o,a,s;return tf(this,(function(c){switch(c.label){case 0:return e=i instanceof ArrayBuffer,n=this._sendP2PMessage,o=[Z_({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:Jx.SEND,type:Qx.P2P,err:Zx.SUCCESS},r)],s={binary:e},e?[4,YD.ab2b64str(i)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=i,c.label=3;case 3:return[2,n.apply(this,[Z_.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var i=this;return void 0===t&&(t={}),tk(e.msg)?this._rttIds[e.id]=e.id:e.dir===Jx.SEND&&aV.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(r,n){var o=i._genHeader(Z_(Z_({needAck:!0,functionType:nV.C2C},t),{id:$D()}));if(e.dir===Jx.SEND){var a=setTimeout((function(){i._p2pCache.delete(e.id),n(new lP(aP.TIME_OUT,"P2P message timeout"))}),6e4);i._p2pCache.set(e.id,{success:function(e,t){clearTimeout(a),r(t)},error:function(e){clearTimeout(a);var t=nf(oV[e.err]||[aP.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),i=t[0],r=t[1];n({code:i,message:e.msg||r})}})}i._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,i){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new lP(aP.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var r=t.version+(+t.zip<<5)+(+t.encrypt<<6),n=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=YD.str2ab(JSON.stringify([e,i])),a=WD(Uint8Array,of([r,n],nf(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),i=0,r=t[i++],n=t[i++],o={version:15&r,zip:16==(16&r),encrypt:32==(32&r),needAck:1==(1&n),direction:(2&n)>>1,functionType:(60&n)>>2,binary:64==(64&n)};if(o.needAck||o.direction===rV.ACK){for(;i<=6;i++)if(128!=(128&t[i])){i++;break}o.id=Array.from(t.slice(2,i))}return{header:o,data:t.slice(i)}},t.prototype._feedbackSignaling=function(e,t){var i=this._genHeader({needAck:!0,direction:rV.ACK,id:e.split("-").map((function(e){return+e}))});aV.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),i,"")},t.prototype._handleMessage=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A,C,O,w,N,P,D,k,M,U,L,x;return tf(this,(function(V){switch(V.label){case 0:r=this._dispartData(e),n=r.header,o=r.data,n.zip&&((a=new hx.Inflate).push(o,!0),o=a.result),s=YD.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&fx.rtcSignalingMsgError(-1,e.message,DL.MESSAGE_PARSE_FAILED),[2]}switch(n.functionType){case nV.C2S:return[3,1];case nV.C2C:return[3,6];case nV.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=n.id)||void 0===t?void 0:t.join("-"))||"",n.direction!==rV.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],aV.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,YD.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=V.sent(),V.label=4;case 4:this.emit(d,Z_({},c)),fx.rtcSignaling(0,s,"on-".concat(d),"Recv",ML.DOWN),V.label=5;case 5:return[3,19];case 6:switch(Array.isArray(c)&&(c=c[1]),h=null==c?void 0:c.id,this._rttIds[h]||(null==c?void 0:c.dir)===Jx.FEEDBACK||tk(null==c?void 0:c.msg)?delete this._rttIds[h]:aV.print("Signal","<<<<<< p2p response",c),c.dir){case Jx.SEND:return[3,7];case Jx.FEEDBACK:return[3,16]}return[3,17];case 7:return tk(null==c?void 0:c.msg)?[3,15]:(_=(p=c).binary,f=p.msg,v=p.room,m=p.to,S=p.from,y=""===v?_?zx.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:zx.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:_?zx.USER_BINARY_MESSAGE_RECEIVED:zx.USER_MESSAGE_RECEIVED,m?[3,11]:(g=this.emit,E=[zx.ON_CUSTOM_MESSAGE],L={clientId:S,binary:_},_?[4,YD.b64str2ab(f)]:[3,9]));case 8:return b=V.sent(),[3,10];case 9:b=f,V.label=10;case 10:return g.apply(this,E.concat([(L.message=b,L)])),[3,15];case 11:return T=this.emit,I=[y],R=[Z_({},c)],x={},_?[4,YD.b64str2ab(f)]:[3,13];case 12:return A=V.sent(),[3,14];case 13:A=f,V.label=14;case 14:T.apply(this,I.concat([Z_.apply(void 0,R.concat([(x.msg=A,x)]))])),V.label=15;case 15:return this._sendP2PMessage(Z_(Z_({},c),{dir:Jx.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===Zx.SUCCESS?C.success(c.id,c):C.error(c)),[3,17];case 17:return[3,19];case 18:if(n.direction===rV.ACK)O=(null===(i=n.id)||void 0===i?void 0:i.join("-"))||"",this._handleAckMessage(O,c[0]||{},s);else if(w=nf(c,2),N=w[0],P=w[1],D=void 0===P?{}:P,"RXMediaMsg"===N&&(k=D.type,M=D.data,fx.rtcSignaling(0,s,"on-".concat(k),"Recv",ML.DOWN),"RSCP"===k))try{U=JSON.parse(M),Array.isArray(U)&&this.emit(k,U)}catch(e){}V.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){aV.print("_handleHandler","dataChannel close",t),e.emit("close",t)},i=function(t){aV.print("_handleHandler","dataChannel error",t),e.emit("close",t)},r=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",i),this._dataChannel.addEventListener("message",r),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",i),e._dataChannel.removeEventListener("message",r)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),Z_({version:2,zip:!1,encrypt:!1,needAck:!0,direction:rV.SEND,functionType:nV.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,i){var r=this._singlingCache.get(e);r&&(this._singlingCache.delete(e),200===t.code?r.success(t):r.error(t),aV.print("Signal","<<<<<< [".concat(r.signalingType,"-ack]"),t)),fx.rtcSignaling(0,i,null==r?void 0:r.signalingType,"Ack",ML.DOWN)},t}(bk.exports.EventEmitter),cV=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,i=e.method,r=e.url,n=e.body,o=void 0===n?{}:n,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,n){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(i,r,!0);try{for(var l=rf(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=nf(h.value,2),_=p[0],f=p[1];d.setRequestHeader(_,f)}}catch(e){a={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(a)throw a.error}}d.onreadystatechange=function(){4===d.readyState&&(t.isSending=!1,200===d.status?e(JSON.parse(d.responseText)):n({message:d.statusText,code:d.status})),0===d.status&&n({code:0,message:"Request abort"})},d.onerror=function(e){t.isSending=!1,n({code:-1,message:d.responseText||"unknown"})},t.timeout&&(d.timeout=t.timeout),u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,i,r){return this.ajax({method:"POST",url:e,body:t,headers:i,stringify:r})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),uV=new Ck("ICE Request",3),dV=function(){function e(){this._request=new cV}return e.prototype.getAccessNode=function(e,t,i,r,n,o,a){return ef(this,void 0,void 0,(function(){var s;return tf(this,(function(c){return(s=Dx.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,i,r,n,o,a),Ix("es.R.node.cache",s),Array.isArray(s)?[2,Promise.resolve(s)]:[2,Promise.resolve([s])]):[2,this.getAccessNodeFromServer(e,t,i,r,n,o,a)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,i,r,n,o,a){return ef(this,void 0,void 0,(function(){var s,c,u=this;return tf(this,(function(d){return s=Dx.getAccessUrls(),c=!0,Ix("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=iV.ICE_CONFIG_REQUEST_URLS,c=!1,Ix("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=iV.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,Ix("es.R.req.internal.urls",s)),[2,this.getICEConfigFromServer(s,e,t,i,r,n,o,a).then((function(t){var i=t.nodes;return Dx.setAccessNode(e,i,t.ttl||11200),t.dispatchDomains&&Dx.setAccessUrls(t.dispatchDomains),i})).catch((function(s){if(c)return Ix("es.R.req.fallback",""),Dx.clearAccessUrls(),u.getAccessNodeFromServer(e,t,i,r,n,o,a);throw s}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,i,r,n,o,a,s){var c;return ef(this,void 0,void 0,(function(){var i,u,d,l=this;return tf(this,(function(h){return i={appID:t,userID:r,deviceID:n,connectSessionID:zD(),os:"web",sdkVersion:iV.VERSION,isOversea:iV.OVERSEA,expectedAddr:Fx("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:s},o&&a&&(i.feedbackInfo=[{feedbackIP:null===(c=a.publicIPs[0])||void 0===c?void 0:c.ip,feedbackReason:{type:"NODE_CHANGED",reason:o}}],delete i.expectedAddr),u=Date.now(),fx.rtcGetAccess(0,JSON.stringify(i),0,NL.REQUEST,e.join(","),i.connectSessionID),d=e.map((function(e,t){return ef(l,void 0,void 0,(function(){var r,n,o;return tf(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._request.post(e,i)];case 1:return r=a.sent(),[3,3];case 2:throw n=a.sent(),new lP(aP.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==r.code)throw new lP(aP.ICE_SERVER_WRONG,"get ICE config failed",{server_code:r.code,message:JSON.stringify(r)});if(!(o=r.nodes[0]))throw new lP(aP.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:r.code,message:JSON.stringify(r)});return[2,{result:r,firstNode:o,index:t}]}}))}))})),[2,nk(d).then((function(t){var r=t.result;t.firstNode;var n=t.index;return fx.rtcGetAccess(200,JSON.stringify(r),Date.now()-u,NL.RESPONSE,e[n],i.connectSessionID),r})).catch((function(t){var r,n,o=null===(r=t[0])||void 0===r?void 0:r.error;throw fx.rtcGetAccess(+((null==o?void 0:o.code)||(null==o?void 0:o.server_code)),null===(n=t[0])||void 0===n?void 0:n.message,Date.now()-u,NL.RESPONSE,e.join(","),i.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(uV.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),lV=function(){function e(){this._request=new cV}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.45.5",deviceType:"web"};this._request.timeout=800;var i=iV.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));fx.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),RL.REQUEST,"",!1);var r=i.map((function(i,r){return ef(e,void 0,void 0,(function(){var e;return tf(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(i,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new lP(aP.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new lP(aP.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){nk(r).then((function(t){var r=t.result,n=t.index;Dx.setH264BlackList(r.web_h264_black_list),fx.rtcGetConfig(200,JSON.stringify(r),0,i[n],RL.RESPONSE,"",!1),e(r.web_h264_black_list)})).catch((function(t){fx.rtcGetConfig(500,t.message,0,"",RL.RESPONSE,"",!1),e(Dx.getH264BlackList()||[])}))}))},e.prototype.getAudioProfile=function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.45.5",deviceType:"web"},i=iV.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));fx.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),RL.REQUEST,"",!1);var r=i.map((function(i,r){return ef(e,void 0,void 0,(function(){var e;return tf(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(i,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new lP(aP.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.engine_BAC))throw new lP(aP.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){nk(r).then((function(t){var r=t.result,n=t.index;Dx.setAudioProfile(r.engine_BAC),fx.rtcGetConfig(200,JSON.stringify(r),0,i[n],RL.RESPONSE,"",!1),e(r.engine_BAC)})).catch((function(t){fx.rtcGetConfig(500,t.message,0,"",RL.RESPONSE,"",!1),e(Dx.getAudioProfile()||[])}))}))},e}();function hV(e,t){var i=1,r=e;(e.width>t.width||e.height>t.height)&&(i=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,r={width:Math.floor(e.width/i),height:Math.floor(e.height/i)});return Z_(Z_({},r),{scaleResolutionDownBy:i})}var pV=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],_V=[{width:1920,height:1080,maxLayers:3,totalPixels:2073600},{width:1280,height:720,maxLayers:3,totalPixels:921600},{width:960,height:540,maxLayers:3,totalPixels:518400},{width:640,height:360,maxLayers:2,totalPixels:230400},{width:480,height:270,maxLayers:2,totalPixels:129600},{width:320,height:180,maxLayers:1,totalPixels:57600},{width:0,height:0,maxLayers:1,totalPixels:0}];var fV={width:160,height:90,frameRate:15,maxkbps:100},vV={width:480,height:270,frameRate:15,maxkbps:400};function mV(e){if(!e.length)return[];var t=e.shift(),i=t.width/t.height,r=0,n=0,o=Z_(Z_({},t),{video_index:n,sub_index:r++});delete o.rid;for(var a=[o],s=0,c=0;c<pV.length;c++)if(pV[c].height<t.height){s=c;break}var u=e.shift();for(c=s;c<pV.length;c++){var d=pV[c];if(u&&d.height<=(null==u?void 0:u.height)){var l=d.height===(null==u?void 0:u.height),h=Z_(Z_({},u),{video_index:++n,sub_index:r++});if(delete h.rid,a.push(h),u=e.shift(),l)continue}a.push(Z_(Z_({},d),{width:Math.floor(d.height*i),video_index:n,sub_index:r++}))}return a}var SV,yV,gV,EV,bV="chrome-stable"===qD();!function(e){e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server"}(SV||(SV={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(yV||(yV={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(gV||(gV={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(EV||(EV={}));var TV,IV=function(){function e(e){this.peer=e,this.stats=[]}return e.prototype.handleCodec=function(e){return e},e.prototype.handleInboundRtp=function(e){return e},e.prototype.handleOutboundRtp=function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e},e.prototype.handleRemoteInboundRtp=function(e){return e},e.prototype.handleRemoteOutboundRtp=function(e){return e},e.prototype.handleMediaSource=function(e){return e},e.prototype.handleCsrc=function(e){return e},e.prototype.handlePeerConnection=function(e){return e},e.prototype.handleDataChannel=function(e){return e},e.prototype.handleStream=function(e){return e},e.prototype.handleTrack=function(e){return e},e.prototype.handleTransceiver=function(e){return e},e.prototype.handleSender=function(e){return e},e.prototype.handleReceiver=function(e){return e},e.prototype.handleTransport=function(e){return e},e.prototype.handleSctpTransport=function(e){return e},e.prototype.handleCandidatePair=function(e){return e},e.prototype.handleLocalCandidate=function(e){return e},e.prototype.handleRemoteCandidate=function(e){return e},e.prototype.handleCertificate=function(e){return e},e.prototype.handleIceServer=function(e){return e},e.prototype.processStats=function(e){var t=this;e.forEach((function(e){var i;switch(e.type){case SV.candidatePair:i=t.handleCandidatePair;break;case SV.certificate:i=t.handleCertificate;break;case SV.remoteCandidate:i=t.handleRemoteCandidate;break;case SV.remoteInboundRtp:i=t.handleInboundRtp;break;case SV.remoteOutboundRtp:i=t.handleOutboundRtp;break;case SV.sctpTransport:i=t.handleSctpTransport;break;case SV.sender:i=t.handleSender;break;case SV.stream:i=t.handleStream;break;case SV.track:i=t.handleTrack;break;case SV.transceiver:i=t.handleTransceiver;break;case SV.transport:i=t.handleTransport;break;case SV.codec:i=t.handleCodec;break;case SV.csrc:i=t.handleCsrc;break;case SV.dataChannel:i=t.handleDataChannel;break;case SV.iceServer:i=t.handleIceServer;break;case SV.mediaSource:i=t.handleMediaSource;break;case SV.outboundRtp:i=t.handleOutboundRtp;break;case SV.inboundRtp:i=t.handleInboundRtp;break;case SV.peerConnection:i=t.handlePeerConnection;break;case SV.receiver:i=t.handleReceiver;break;case SV.localCandidate:i=t.handleLocalCandidate;break;default:i=function(e){return e}}i=i.bind(t),t.stats.push(i(e))}))},e.prototype.getExtraStats=function(e){return ef(this,void 0,void 0,(function(){var t=this;return tf(this,(function(i){return[2,new Promise((function(i,r){if(!bV||void 0!==window.InstallTrigger)return i(t.stats);try{t.peer.getStats((function(r){r.result().forEach((function(i){if(!RV.includes(i.type)){var r={};i.names().forEach((function(e){r[e]=i.stat(e)})),r.id=i.id,r.type=i.type,r.timestamp=i.timestamp,"ssrc"===r.type&&e&&e.id?e.id===r.googTrackId&&t.stats.push(r):t.stats.push(r)}})),i(t.stats)}))}catch(e){r(e)}}))]}))}))},e.prototype.getStats=function(e,t){return ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:return r.trys.push([0,7,,8]),[4,this.peer.getStats(e)];case 1:i=r.sent(),this.processStats(i),r.label=2;case 2:return r.trys.push([2,5,,6]),t?[3,4]:[4,this.getExtraStats(e)];case 3:r.sent(),r.label=4;case 4:return[3,6];case 5:return r.sent(),[3,6];case 6:return[3,8];case 7:return r.sent(),[3,8];case 8:return[2,this.stats]}}))}))},e}(),RV=["codec","inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","media-source","csrc","peer-connection","data-channel","stream","track","transceiver","sender","receiver","transport","sctp-transport","candidate-pair","local-candidate","remote-candidate","certificate","ice-server"],AV=function(e,t,i){return ef(void 0,void 0,void 0,(function(){var r;return tf(this,(function(n){switch(n.label){case 0:return r=[],e instanceof RTCPeerConnection?[4,new IV(e).getStats(t,i)]:[2,r];case 1:return[2,r=n.sent()]}}))}))},CV=function(){return ef(void 0,void 0,void 0,(function(){var e,t,i,r,n,o,a;return tf(this,(function(s){switch(s.label){case 0:if(TV)return[2,TV];e=[],s.label=1;case 1:return s.trys.push([1,5,,6]),[4,rk()];case 2:return(t=s.sent())?(null==t?void 0:t.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))||(null==t?void 0:t.includes("profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1"))||(null==t?void 0:t.includes("packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"))?(i=navigator.userAgent.toLowerCase(),r=!1,n=["heytapbrowser","mqqbrowser","miuibrowser"],[4,(new lV).getH264BlackList()]):[3,4]:[2,e];case 3:for(o=s.sent(),n.push.apply(n,of([],nf(o),!1)),a=0;a<n.length;a++)i.includes(n[a])&&(r=!0);!r&&e.push("H264"),s.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),TV=e,[2,e];case 5:return s.sent(),[2,e];case 6:return[2]}}))}))},OV=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},wV=new Ck("BasicHandler",3),NV={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!OV()||void 0},PV=function(e){function t(t,i){var r=e.call(this)||this;return r._offerIce={},r._answerIce={},r._initSctpEvents=!1,r.monitor=t,r._peerConnection=new RTCPeerConnection(NV),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=i,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,i;wV.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){wV.print("constructor","onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ").concat(r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var e=r._peerConnection.iceConnectionState;t.rtcPreIceState(e,PL["".concat(e.toUpperCase())])},r}return A_(t,e),t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){wV.print("destroy"),this.disconnect(),this._context=void 0},t.prototype._simulcast=function(e,t,i,r,n){var o=[],a=function(e){for(var t=0,i=e.width*e.height,r=0;r<_V.length;r++)if(i>=_V[r].totalPixels){t=r;break}if(0===t)return _V[t].maxLayers;var n=_V[t-1].totalPixels;return(n-i)/(n-_V[t].totalPixels)<.1?_V[t-1].maxLayers:_V[t].maxLayers}(t);wV.print("simulcast() ","maxLayers: %o",a),1===e.videoEncodeConfig.length?(o=function(e,t){var i=[];if(t<=1)return i;var r=1,n=1;return e.width/e.height>16/9?(r=e.width/fV.width,n=e.width/vV.width):(r=e.height/fV.height,n=e.height/vV.height),i.push({maxkbps:fV.maxkbps,scaleResolutionDownBy:r,frameRate:fV.frameRate,width:Math.floor(e.width/r),height:Math.floor(e.height/r)}),t<=2||r>2&&i.unshift({maxkbps:vV.maxkbps,scaleResolutionDownBy:n,frameRate:vV.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),i}(i,a),wV.print("simulcast() ","simulcastLayers: %o",o)):(o=e.videoEncodeConfig.slice(1).slice(1-a).map((function(e){return Z_({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},hV(i,e))})),wV.print("simulcast() ","simulcastLayers2: %o",o)),o.forEach((function(e,t){var i={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};r.sendEncodings&&r.sendEncodings.unshift(i),n.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))},t.prototype.internalPublish=function(e,t){var i=e.stream,r=e.videoTrack,n=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,c={direction:"sendonly",streams:[i]},u={direction:"sendonly",streams:[i]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==r?void 0:r.getTrack(),p={width:640,height:360,frameRate:30};if(h){var _=null==h?void 0:h.getSettings();p={width:Math.floor(_.width),height:Math.floor(_.height),frameRate:Math.floor(_.frameRate)}}var f=null==e?void 0:e.videoEncodeConfig[0],v=hV(p,f);e.prevScaleResolutionDownBy=v.scaleResolutionDownBy,e.videoInputConfig=p;var m={maxBitrate:1e3*f.maxKbps,scaleResolutionDownBy:v.scaleResolutionDownBy,rid:"0",maxFramerate:f.frameRate||15};u.sendEncodings=[m],d.push({width:v.width,height:v.height,framerate:f.frameRate,maxkbps:f.maxKbps,rid:"0"}),o&&(this._simulcast(e,v,p,u,d),(null==t?void 0:t.simulcastOnDemand)&&(l=mV(of([],nf(d),!1))),wV.print("subVideoDesc","desc: %o ",l))}wV.print("publish videoTransceiverInit videoDescriptions","",u,d);var S=null==n?void 0:n.getTrack();(null==n?void 0:n.mixType)!==sf.PLAYOUT&&(null==n?void 0:n.mixedAudioTrack)&&(S=null==n?void 0:n.mixedAudioTrack),S=a&&S?S:"audio";var y=null==r?void 0:r.getTrack();return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:S,vTrack:y=s&&y?y:"video",audioTransceiverInit:c,videoTransceiverInit:u}}},t.prototype.updateScaleResolutionDownBy=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n,o,a,s,c,u,d;return tf(this,(function(l){return wV.print("updateScaleResolutionDownBy()"),n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver,n&&e.pubVideo&&o?(a=null==n?void 0:n.getSettings(),s={width:Math.floor(a.width),height:Math.floor(a.height),frameRate:Math.floor(a.frameRate)},(c=hV(s,e.videoEncodeConfig[0])).scaleResolutionDownBy===e.prevScaleResolutionDownBy&&wV.print("updateScaleResolutionDownBy()","no change %o",e.prevScaleResolutionDownBy),(u=null===(i=o.sender)||void 0===i?void 0:i.getParameters())&&(d=c.scaleResolutionDownBy/e.prevScaleResolutionDownBy,u.encodings=null===(r=null==u?void 0:u.encodings)||void 0===r?void 0:r.map((function(t){var i,r;Math.max(t.scaleResolutionDownBy=(t.scaleResolutionDownBy||1)*d,1);var n=+t.rid||0;t.maxFramerate=(null===(i=e.videoEncodeConfig[n])||void 0===i?void 0:i.frameRate)||t.maxFramerate;var o=null===(r=e.videoEncodeConfig[n])||void 0===r?void 0:r.maxKbps;return"number"==typeof o&&(t.maxBitrate=1e3*o),t})),e.prevScaleResolutionDownBy=c.scaleResolutionDownBy,e.videoInputConfig=s,null==o||o.sender.setParameters(u)),[2]):(wV.print("updateScaleResolutionDownBy()","no pub"),[2])}))}))},t.prototype.getStats=function(e,t){return AV(this._peerConnection,e,t)},t.prototype.setLocalDescription=function(e,t){var i;return ef(this,void 0,void 0,(function(){var r,n,o,a=this;return tf(this,(function(s){switch(s.label){case 0:r=KD(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:e}))];case 2:return s.sent(),this.monitor.rtcSetDescription(0,e,xL.W_1,"local"===(null==t?void 0:t.streamUserId)?VL.UP:VL.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",KD()-r,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(n=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(n.onstatechange=function(){a.monitor.rtcInvokeStatus("sctp state change TO: ".concat(n.state),0,"sctp","",0)},n.transport&&(n.transport.onstatechange=function(){var e;a.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null===(e=null==n?void 0:n.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),[3,4];case 3:return o=s.sent(),this.monitor.rtcSetDescription(-1,o.message,xL.W_1,"local"===(null==t?void 0:t.streamUserId)?VL.UP:VL.DOWN,"","",KD()-r,{type:"offer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t){return ef(this,void 0,void 0,(function(){var i,r;return tf(this,(function(n){switch(n.label){case 0:i=KD(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e}))];case 2:return n.sent(),this.monitor.rtcSetDescription(0,e,xL.W_0,"local"===(null==t?void 0:t.streamUserId)?VL.UP:VL.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",KD()-i,{type:"answer"}),[3,4];case 3:return r=n.sent(),this.monitor.rtcSetDescription(-1,r.message,xL.W_1,"local"===(null==t?void 0:t.streamUserId)?VL.UP:VL.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",KD()-i,{type:"answer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){return[2]}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t}(bk.exports.EventEmitter),DV={},kV={},MV={exports:{}},UV=MV.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(UV).forEach((function(e){UV[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},i=function(e,i,r){var n=e.name&&e.names;e.push&&!i[e.push]?i[e.push]=[]:n&&!i[e.name]&&(i[e.name]={});var o=e.push?{}:n?i[e.name]:i;!function(e,i,r,n){if(n&&!r)i[n]=t(e[1]);else for(var o=0;o<r.length;o+=1)null!=e[o+1]&&(i[r[o]]=t(e[o+1]))}(r.match(e.reg),o,e.names,e.name),e.push&&i[e.push].push(o)},r=MV.exports,n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach((function(e){var t=e[0],n=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(r[t]||[]).length;s+=1){var c=r[t][s];if(c.reg.test(n))return i(c,a,n)}})),t.media=o,t};var o=function(e,i){var r=i.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&i.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var i=[],r=e.split(" ").map(t),n=0;n<r.length;n+=3)i.push({component:r[n],ip:r[n+1],port:r[n+2]});return i},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var i,r=!1;return"~"!==e[0]?i=t(e):(i=t(e.substring(1,e.length)),r=!0),{scid:i,paused:r}}))}))}}(kV);var LV=MV.exports,xV=/%[sdv%]/g,VV=function(e){var t=1,i=arguments,r=i.length;return e.replace(xV,(function(e){if(t>=r)return e;var n=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(n);case"%d":return Number(n);case"%v":return""}}))},FV=function(e,t,i){var r=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var n=0;n<t.names.length;n+=1){var o=t.names[n];t.name?r.push(i[t.name][o]):r.push(i[t.names[n]])}else r.push(i[t.name]);return VV.apply(null,r)},BV=["v","o","s","i","u","e","p","c","b","t","r","z","a"],jV=["i","c","b","a"],GV=kV,HV=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var i=t.outerOrder||BV,r=t.innerOrder||jV,n=[];return i.forEach((function(t){LV[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(FV(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(FV(t,i,e))}))}))})),e.media.forEach((function(e){n.push(FV("m",LV.m[0],e)),r.forEach((function(t){LV[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(FV(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(FV(t,i,e))}))}))}))})),n.join("\r\n")+"\r\n"};DV.write=HV,DV.parse=GV.parse,DV.parseParams=GV.parseParams,DV.parseFmtpConfig=GV.parseFmtpConfig,DV.parsePayloads=GV.parsePayloads,DV.parseRemoteCandidates=GV.parseRemoteCandidates,DV.parseImageAttributes=GV.parseImageAttributes,DV.parseSimulcastStreamList=GV.parseSimulcastStreamList;var zV=Math.pow(2,32),KV=function(){return Math.floor(Math.random()*zV+1e3)},WV=function(e,t,i){return i||(i=KV()),[{id:i,attribute:"cname",value:"kp34Za0H+aVf862l"},{id:i,attribute:"msid",value:"".concat(e.id," ").concat(e.id,"-").concat(t)},{id:i,attribute:"mslabel",value:"".concat(e.id)},{id:i,attribute:"label",value:"".concat(e.id,"-").concat(t)}]};function XV(e){return e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly,e}var YV=function(e,t,i){var r=Z_(Z_({},e),{invalid:[{value:"realx-exts:rscp"}],media:[t,i]});return delete r.groups,delete r.msidSemantic,DV.write(r)};function qV(e){return ef(this,void 0,void 0,(function(){var t,i,r,n,o;return tf(this,(function(a){switch(a.label){case 0:return t={},i=e.publicIPs,r=e.certFingerprint,n=e.iceParams,t.fingerprint={type:"sha-256",hash:r},t.icePwd=n.serverIcePwd,o=t,[4,JV(n.serverIceUfrag)];case 1:return o.iceUfrag=a.sent(),Sx.setStats({connection_id:t.iceUfrag}),t.candidates=function(e){if(!Array.isArray(e))return[];var t=0,i=2130706431,r=[];return e.forEach((function(e){var n={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){r.push(Z_(Z_({},n),{foundation:t++,transport:"udp",port:e,priority:i}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){r.push(Z_(Z_({},n),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:i-1e3}))}))})),r}(i),t.setup="active",t.iceOptions="renomination",[2,t]}}))}))}var JV=function(e){return ef(void 0,void 0,void 0,(function(){var t,i,r,n,o,a,s;return tf(this,(function(c){switch(c.label){case 0:return t=new TextEncoder,i=t.encode("PREC"),n=Uint8Array.bind,[4,YD.b64str2ab(e)];case 1:return r=new(n.apply(Uint8Array,[void 0,c.sent()])),o=t.encode(Date.now().toString()).slice(-4),(a=new Uint8Array(2))[0]=0,a[1]=1,s=WD(Uint8Array,i,r,o,a),[4,YD.ab2b64str(s.buffer)];case 2:return[2,c.sent()]}}))}))},QV=I,ZV=rc,$V=Dm.exports.getWeakData,eF=kt,tF=G,iF=lc,rF=Wc,nF=xe,oF=Oi.set,aF=Oi.getterFor,sF=ba.find,cF=ba.findIndex,uF=QV([].splice),dF=0,lF=function(e){return e.frozen||(e.frozen=new hF)},hF=function(){this.entries=[]},pF=function(e,t){return sF(e.entries,(function(e){return e[0]===t}))};hF.prototype={get:function(e){var t=pF(this,e);if(t)return t[1]},has:function(e){return!!pF(this,e)},set:function(e,t){var i=pF(this,e);i?i[1]=t:this.entries.push([e,t])},delete:function(e){var t=cF(this.entries,(function(t){return t[0]===e}));return~t&&uF(this.entries,t,1),!!~t}};var _F,fF={getConstructor:function(e,t,i,r){var n=e((function(e,n){iF(e,o),oF(e,{type:t,id:dF++,frozen:void 0}),null!=n&&rF(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=aF(t),s=function(e,t,i){var r=a(e),n=$V(eF(t),!0);return!0===n?lF(r).set(t,i):n[r.id]=i,e};return ZV(o,{delete:function(e){var t=a(this);if(!tF(e))return!1;var i=$V(e);return!0===i?lF(t).delete(e):i&&nF(i,t.id)&&delete i[t.id]},has:function(e){var t=a(this);if(!tF(e))return!1;var i=$V(e);return!0===i?lF(t).has(e):i&&nF(i,t.id)}}),ZV(o,i?{get:function(e){var t=a(this);if(tF(e)){var i=$V(e);return!0===i?lF(t).get(e):i?i[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),n}},vF=n,mF=I,SF=rc,yF=Dm.exports,gF=gS,EF=fF,bF=G,TF=Fm,IF=Oi.enforce,RF=oi,AF=!vF.ActiveXObject&&"ActiveXObject"in vF,CF=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},OF=gF("WeakMap",CF,EF);if(RF&&AF){_F=EF.getConstructor(CF,"WeakMap",!0),yF.enable();var wF=OF.prototype,NF=mF(wF.delete),PF=mF(wF.has),DF=mF(wF.get),kF=mF(wF.set);SF(wF,{delete:function(e){if(bF(e)&&!TF(e)){var t=IF(this);return t.frozen||(t.frozen=new _F),NF(this,e)||t.frozen.delete(e)}return NF(this,e)},has:function(e){if(bF(e)&&!TF(e)){var t=IF(this);return t.frozen||(t.frozen=new _F),PF(this,e)||t.frozen.has(e)}return PF(this,e)},get:function(e){if(bF(e)&&!TF(e)){var t=IF(this);return t.frozen||(t.frozen=new _F),PF(this,e)?DF(this,e):t.frozen.get(e)}return DF(this,e)},set:function(e,t){if(bF(e)&&!TF(e)){var i=IF(this);i.frozen||(i.frozen=new _F),PF(this,e)?kF(this,e,t):i.frozen.set(e,t)}else kF(this,e,t);return this}})}var MF,UF=function(e){function t(){var t=e.call(this)||this;return t._hasVideoPermission=!1,t._hasAudioPermission=!1,t.inited=!1,t.deviceMap={audioinput:new Map,audiooutput:new Map,videoinput:new Map},t._handleDeviceChange=t._handleDeviceChange.bind(t),!XD()&&t.refreshDevices(),t}return A_(t,e),t.prototype.refreshDevices=function(){return ef(this,void 0,void 0,(function(){var e=this;return tf(this,(function(t){switch(t.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2];case 1:return t.sent().forEach((function(t){var i;null===(i=e.deviceMap[t.kind])||void 0===i||i.set(t.deviceId,t)})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e;return ef(this,void 0,void 0,(function(){return tf(this,(function(t){return"function"==typeof(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",this._handleDeviceChange),[2]}))}))},t.prototype._handleDeviceChange=function(){return ef(this,void 0,void 0,(function(){var e,t,i=this;return tf(this,(function(r){switch(r.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=r.sent(),t=Array.from(of(of(of([],nf(this.deviceMap.audioinput.values()),!1),nf(this.deviceMap.videoinput.values()),!1),nf(this.deviceMap.audiooutput.values()),!1)),e.forEach((function(e){var t=i.deviceMap[e.kind].get(e.deviceId);i.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?i.emit(df.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(df.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),t.forEach((function(t){e.find((function(e){return e.deviceId===t.deviceId&&e.kind===t.kind}))||(i.deviceMap[t.kind].delete(t.deviceId),t.kind.includes("video")?i.emit(df.onVideoDeviceStateChanged,{mediaDeviceInfo:t,deviceState:"inactive"}):t.kind.includes("audio")&&i.emit(df.onAudioDeviceStateChanged,{mediaDeviceInfo:t,deviceState:"inactive"}))})),[2]}}))}))},t.prototype.getVideoPermission=function(){return ef(this,void 0,void 0,(function(){var e=this;return tf(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new lP(aP.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasVideoPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasVideoPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasVideoPermission]}}))}))},t.prototype.getAudioPermission=function(){return ef(this,void 0,void 0,(function(){var e=this;return tf(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new lP(aP.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasAudioPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasAudioPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasAudioPermission]}}))}))},t.prototype.enumerateDevices=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.getAudioPermission()];case 1:case 2:return e.sent(),[3,3];case 3:return e.trys.push([3,5,,6]),[4,this.getVideoPermission()];case 4:case 5:return e.sent(),[3,6];case 6:return[4,this.refreshDevices()];case 7:return e.sent(),[2,Array.from(of(of(of([],nf(this.deviceMap.audioinput.values()),!1),nf(this.deviceMap.videoinput.values()),!1),nf(this.deviceMap.audiooutput.values()),!1))]}}))}))},t.prototype.enumerateAudioCaptureDevices=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.audioinput.values())]}}))}))},t.prototype.enumerateVideoCaptureDevices=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.videoinput.values())]}}))}))},t.prototype.enumerateAudioPlaybackDevices=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.audiooutput.values())]}}))}))},t.prototype.getDeviceById=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return[4,this.enumerateDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},Object.defineProperty(t.prototype,"hasAudioPermission",{get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new lP(aP.NO_PERMISSION,"Cannot revoke audio permission");this.refreshDevices(),this._hasAudioPermission=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasVideoPermission",{get:function(){return this._hasVideoPermission},set:function(e){if(!e)throw new lP(aP.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(wk),LF=new UF,xF=function(){function e(){}return e.prototype.getAudioContextInstance=function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance},e}(),VF=function(){function e(e){var t=FF.getAudioContextInstance();if(e instanceof MediaStreamTrack){var i=new MediaStream;i.addTrack(e),this._audioSource=t.createMediaStreamSource(i)}else e instanceof AudioNode?this._audioSource=e:(this._audioSource=t.createMediaElementSource(e),this._audioSource.connect(t.destination));var r=t.createAnalyser();this._audioSource.connect(r),this._analyserNode=r,this._ctx=t}return e.prototype.getAudioLevel=function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var i=0;return t.forEach((function(e){return i=Math.max(i,Math.abs(e-128))})),i/128*255},e.prototype.destroy=function(){this._audioSource.disconnect(),this._analyserNode.disconnect()},e}(),FF=new xF,BF=new Ck("VERTC",0),jF=new WeakMap,GF=function(e){return jF.get(e)},HF=function(e){function t(t,i){var r=e.call(this)||this;return r._trackId=t,r.mediaType=i,r}return A_(t,e),t.prototype.getId=function(){return this._trackId},t}(wk),zF=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n._initListeners(),n}return A_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.setTrack=function(e){this._mediaTrack=e},t.prototype.close=function(){var e;return null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()},t.prototype._initListeners=function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){fx.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(HF),KF=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n}return A_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(HF),WF=function(e){function t(t,i){var r=e.call(this,t,i,"video")||this;return r.dummy=!1,r.resolution={width:0,height:0},r}return A_(t,e),t.prototype.updateVideoCaptureConfig=function(){return ef(this,void 0,void 0,(function(){var e;return tf(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig&&this.getTrack()?(BF.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),[4,this.getTrack().applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),((e=this.getTrack().getSettings()).width&&e.width!==this.resolution.width||e.height&&e.height!==this.resolution.height)&&(this.resolution={width:e.width,height:e.height},this.emit("resolution-change",this.resolution)),[2]}}))}))},t.prototype.replaceTrack=function(e){this.setTrack(e)},t}(zF),XF=function(e){function t(t,i){var r=e.call(this,t,i,"audio")||this;return r.mixType=sf.PLAYOUT_AND_PUBLISH,r}return A_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new VF(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.updateAudioCaptureConfig=function(){var e;return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(BF.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.audioCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t}(zF),YF=function(e){function t(t,i){return e.call(this,t,i,"video")||this}return A_(t,e),t}(KF),qF=function(e){function t(t,i){return e.call(this,t,i,"audio")||this}return A_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new VF(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(KF),JF=function(e){function t(t,i){return e.call(this,t,i)||this}return A_(t,e),t}(XF),QF=function(e){function t(t,i){return e.call(this,t,i)||this}return A_(t,e),t}(WF),ZF=function(e){function t(t,i){return e.call(this,t,i)||this}return A_(t,e),t}(WF),$F=function(e){function t(t,i){return e.call(this,t,i)||this}return A_(t,e),t}(XF),eB=function(e){function t(t,i){return e.call(this,t,i)||this}return A_(t,e),t}(WF),tB=function(e){function t(t,i){return e.call(this,t,i)||this}return A_(t,e),t}(XF);function iB(e){var t;return ef(this,void 0,void 0,(function(){var i,r,n,o,a,s;return tf(this,(function(c){switch(c.label){case 0:r=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",c.label=1;case 1:return c.trys.push([1,3,,4]),BF.print("createCameraVideoTrack","constraints:",e),fx.rtcVideoCaptureEvent({event_type:ox.START,media_device_id:r}),n=KD(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return i=c.sent(),fx.rtcVideoCaptureEvent({event_type:ox.START_CAPTURE_RESULT,media_device_id:r,reason:sx.SUCCESS,elapse:KD()-n}),LF.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),fx.rtcVideoCaptureEvent({event_type:ox.RUNNING_FAILED,media_device_id:r,error_code:o.code,reason:o.name+o.message}),new lP(aP.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=i.getVideoTracks()[0],jF.set(a,i),(s=new QF(a,zD())).videoCaptureConfig=e,[2,s]}}))}))}function rB(e,t){var i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p;return tf(this,(function(_){switch(_.label){case 0:BF.print("createCameraVideoTrack","constraints:",e),n=(null===(i=null==e?void 0:e.deviceId)||void 0===i?void 0:i.exact)||"default",a=(o=t||{}).sampleRate,s=o.channel,c=o.agc,u=o.ans,d=o.aec,void 0===e.sampleRate&&(e.sampleRate=a),void 0===e.channelCount&&(e.channelCount=s),void 0===e.autoGainControl&&(e.autoGainControl=c),void 0===e.noiseSuppression&&(e.noiseSuppression=u),void 0===e.echoCancellation&&(e.echoCancellation=d),_.label=1;case 1:return _.trys.push([1,3,,4]),fx.rtcVideoCaptureEvent({event_type:ox.START,media_device_id:n}),l=KD(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=_.sent(),fx.rtcVideoCaptureEvent({event_type:ox.START_CAPTURE_RESULT,media_device_id:n,reason:sx.SUCCESS,elapse:KD()-l}),LF.hasAudioPermission=!0,[3,4];case 3:throw h=_.sent(),fx.rtcVideoCaptureEvent({event_type:ox.RUNNING_FAILED,media_device_id:n,error_code:h.code,reason:h.name+h.message}),new lP(aP.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",h);case 4:return p=r.getAudioTracks()[0],jF.set(p,r),[2,new JF(p,zD())]}}))}))}function nB(e,t){return void 0===e&&(e=!1),ef(this,void 0,void 0,(function(){var i,r,n;return tf(this,(function(o){switch(o.label){case 0:BF.print("createScreenTracks","withAudio: %o, constraints: %o",e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),fx.rtcVideoCaptureEvent({event_type:ox.START,media_device_id:"screen"}),r=KD(),[4,navigator.mediaDevices.getDisplayMedia({video:!(t&&!QD)||t,audio:e})];case 2:return i=o.sent(),fx.rtcVideoCaptureEvent({event_type:ox.START_CAPTURE_RESULT,media_device_id:"screen",reason:sx.SUCCESS,elapse:KD()-r}),[3,4];case 3:throw n=o.sent(),fx.rtcVideoCaptureEvent({event_type:ox.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.name+n.message}),new lP(aP.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,i]}}))}))}!function(e){e[e.NONE=0]="NONE"}(MF||(MF={}));var oB,aB,sB=function(){function e(){}return e.getNalunits=function(t){if(t.length-t.position<4)return[];var i=t.position;return 1===t.getInt32(i)||0===t.getInt16(i)&&1===t.getInt8(i+2)?e.getAnnexbNals(t):e.getAvccNals(t)},e.getAnnexbNals=function(t){for(var i=[],r=e.getHeaderPositionAnnexB(t),n=r.pos,o=n;n<t.length-4;){var a=new Uint8Array(t.buffer.slice(n,n+r.headerLength));r.pos===t.position&&t.skip(r.headerLength),o=(r=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(n+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&i.push(s),t.skip(o-t.position),n=o}return i},e.getAvccNals=function(t){for(var i=[];t.position<t.length-4;){var r=t.getInt32(t.position);if(!(t.length-t.position>=r))break;var n=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+r));t.skip(r);var a={header:n,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&i.push(a)}return i},e.analyseNal=function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}},e.getHeaderPositionAnnexB=function(e){for(var t=e.position,i=0,r=e.length;3!==i&&4!==i&&t<r-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?i=4:1===e.getInt8(t+2)?i=3:t++:t++;return t===r-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?i=4:t=r:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?i=3:t=r)),{pos:t,headerLength:i}},e.getAvcc=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength+11);i[0]=1,i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=255,i[5]=225;var r=6;return i.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),r),r+=2,i.set(e,r),i[r+=e.byteLength]=1,r++,i.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),r),r+=2,i.set(t,r),i},e}(),cB=function(){function e(e){this._position=0,this._dataview=new DataView(e)}return Object.defineProperty(e.prototype,"length",{get:function(){return this.buffer.byteLength},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._dataview.buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),e.prototype.back=function(e){this.position-=e},e.prototype.getUint8=function(e){return this._dataview.getUint8(e)},e.prototype.getInt8=function(e){return this._dataview.getInt8(e)},e.prototype.getInt16=function(e){return this._dataview.getInt16(e)},e.prototype.getUint16=function(e){return this._dataview.getUint16(e)},e.prototype.getUint32=function(e){return this._dataview.getUint32(e)},e.prototype.getInt32=function(e){return this._dataview.getInt32(e)},e.prototype.skip=function(t){for(var i=Math.floor(t/4),r=t%4,n=0;n<i;n++)e.readByte(this,4);r>0&&e.readByte(this,r)},e.readByte=function(e,t,i){var r;switch(t){case 1:r=i?e.getInt8(e.position):e.getUint8(e.position);break;case 2:r=i?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(i)throw new Error("not supported for readByte 3");r=e.getUint8(e.position)<<16,r|=e.getUint8(e.position+1)<<8,r|=e.getUint8(e.position+2);break;case 4:r=i?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(i)throw new Error("not supported for readBody 8");r=e.getUint32(e.position)<<32,r|=e.getUint32(e.position+4);break;default:r=""}return e.position+=t,r},e.prototype.readUint8=function(){return e.readByte(this,1)},e.prototype.readUint16=function(){return e.readByte(this,2)},e.prototype.readUint24=function(){return e.readByte(this,3)},e.prototype.readUint32=function(){return e.readByte(this,4)},e.prototype.readUint64=function(){return e.readByte(this,8)},e.prototype.readInt8=function(){return e.readByte(this,1,!0)},e.prototype.readInt16=function(){return e.readByte(this,2,!0)},e.prototype.readInt32=function(){return e.readByte(this,4,!0)},e.prototype.writeUint32=function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])},e}();!function(e){e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass"}(oB||(oB={})),function(e){e[e.invalid=0]="invalid",e[e.cfgResolution=1]="cfgResolution",e[e.bitstreamHash=2]="bitstreamHash",e[e.screenCodec=3]="screenCodec"}(aB||(aB={}));var uB=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),dB=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]);function lB(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function hB(e,t){void 0===t&&(t=0);for(var i=0;255===e[t]&&t<e.byteLength;)t++,i+=255;return t<e.byteLength&&(i+=e[t++]),[i,t]}var pB=function(){function e(){}return e.generateSEI=function(e,t){void 0===t&&(t=!1);var i=new Uint8Array([0,0,0,1]),r=new Uint8Array([6]),n=new Uint8Array([5]),o=t?uB:dB,a=lB(e.byteLength+o.byteLength),s=function(e){for(var t=[],i=0;i<e.length;i++)e[i]<=3&&0===e[i-1]&&0===e[i-2]&&t.push(3),t.push(e[i]);return new Uint8Array(t)}(e);return new Uint8Array(of(of(of(of(of(of(of([],nf(i),!1),nf(r),!1),nf(n),!1),nf(a),!1),nf(o),!1),nf(s),!1),[128],!1))},e.decodeSeiBody=function(e){var t=function(e){for(var t=[],i=0;i<e.length;i++)e[i]<=3&&0===e[i-1]&&0===e[i-2]||t.push(e[i]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var i=0;if(5===t[1]||100===t[1]){var r=nf(hB(t,i+=2),2),n=r[0];i=r[1];var o=oB.bypass,a=i+n;return t.byteLength>=dB.byteLength&&n>=dB.byteLength&&t.slice(i,i+dB.byteLength).toString()===dB.toString()?(i+=dB.byteLength,o=oB.external):t.byteLength>=dB.byteLength&&n>=dB.byteLength&&t.slice(i,i+uB.byteLength).toString()===uB.toString()&&(i+=uB.byteLength,o=oB.internal),{type:o,payload:t.slice(i,a)}}}},e.parseInternalSEI=function(e){var t=new Map,i=0;if(e.type===oB.internal){for(;e.payload.byteLength-i>=2;){var r=nf(hB(e.payload,i),2),n=r[0];i=r[1];var o=nf(hB(e.payload,i),2),a=o[0];if(i=o[1],t.get(n)||!(a<e.payload.byteLength-i))break;t.set(n,e.payload.slice(i,i+a))}return t}},e.makeInternalSei=function(e){var t,i,r=[];try{for(var n=rf(e),o=n.next();!o.done;o=n.next()){var a=nf(o.value,2),s=a[0],c=a[1],u=lB(s),d=lB(c.byteLength);r.push(u,d,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}var l=r.reduce((function(e,t){return e+t.byteLength}),0),h=new Uint8Array(l);return r.reduce((function(e,t){return h.set(t,e),e+t.byteLength}),0),h},e}();Wr({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new Ck("Stats",2);var _B,fB,vB,mB,SB,yB,gB=function(){function e(e){this._stream=e}return e.prototype.setVar=function(e,t,i){this.client=e,this.handler=t,this.monitor=i},e.prototype.delStatsEvtInterval=function(){clearTimeout(this._timer),this._timer=void 0},e.prototype.destroy=function(){this.delStatsEvtInterval()},e}(),EB=function(e){function t(t){var i=e.call(this,t)||this;return i._stream=t,i}return A_(t,e),t.prototype.setLocalStreamStatsEvtInterval=function(e,t,i){var r,n,o=this;if(!this._timer){this.setVar(e,t,i),e.once(Wx.ABNORMAL_DISCONNECTION,(function(){o.destroy()}));var a={audio:{},video:{}},s=this._stream,c=null===(r=s.audioTrack)||void 0===r?void 0:r.getTrack(),u=null===(n=s.videoTrack)||void 0===n?void 0:n.getTrack();this.getAudioStats(c,a),this.getVideoStats(u,a),this.delStatsEvtInterval();this._timer=setTimeout((function e(){return ef(o,void 0,void 0,(function(){var t,i;return tf(this,(function(r){switch(r.label){case 0:return[4,ef(o,void 0,void 0,(function(){var e,t,i,r,n,o;return tf(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getAudioStats(e,a)];case 1:return i=c.sent(),[4,this.getVideoStats(t,a)];case 2:return r=c.sent(),[2,{audioStats:i,videoStats:r,isScreen:s.isScreen}]}}))}))];case 1:return t=r.sent(),null===(i=this.client)||void 0===i||i.emit("onLocalStreamStats",t),this._timer=setTimeout(e,2e3),[2]}}))}))}),2e3)}},t.prototype.unpublish=function(){this.delStatsEvtInterval()},t.prototype.getAudioStats=function(e,t){return ef(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l;return tf(this,(function(h){switch(h.label){case 0:return i={},r={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.audioMid,s=n.isScreen,c=n.pubAttributes,u={media_type:"audio",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(d=h.sent()).length?(d.forEach((function(e){var t=e.type,n=e.packetsSent,o=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,d=e.channels,l=e.audioLevel,h=e.googRtt,p=e.mimeType,_=e.availableIncomingBitrate,f=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,S=e.id,y=e.currentRoundTripTime,g=e.state,E=e.writable,b=e.requestsReceived,T=e.responsesReceived,I=e.requestsSent,R=e.consentRequestsSent,A=e.responsesSent,C=e.jitter,O=e.candidateType,w=e.ip,N=e.address,P=e.networkType,D=e.port,k=e.protocol,M=e.nackCount,U=e.retransmittedBytesSent,L=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType,H=e.fractionLost;"outbound-rtp"===t?(r.packetsSent=n,r.bytesSent=a,u.bytes=a,u.packetsSent=n,u.nackCount=M,u.ssrc=F,u.retransmitted_bytes_sent=U,u.retransmitted_packets_sent=L,r.retransmittedPacketsSent=L):"remote-inbound-rtp"===t?(r.packetsLost=o,u.packetsLost=o,u.jitter=1e3*C,i.rtt=1e3*c,u.rtt=i.rtt,u.round_trip_time_measurements=x,i._fractionLost=H||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=d,u.codecName=p):"media-source"===t?(u.audio_level=l?-10*Math.log10(Math.pow(l,2)):l,u.volume=255*l,u.total_audio_energy=B,u.total_samples_duration=j):"ssrc"===t&&"audio"===G?(u.audio_network_elapse=h,u.send_level=V):"candidate-pair"===t?(u.ice_available_incoming_bitrate=_,u.ice_available_outgoing_bitrate=f,u.ice_bytes_received=v,u.ice_bytes_sent=a,u.ice_nominated=+m,u.ice_pair_id=S,u.ice_pair_rtt=y,u.ice_pair_state=g,u.ice_pair_writable=E,u.recv_ping_requests=b,u.recv_ping_responses=T,u.sent_ping_requests_before_first_response=I,u.sent_ping_requests_total=I+(R||0),u.sent_ping_responses=A):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=w||N,u.local_network_type=P,u.local_port=D,u.protocol=k):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=w||N,u.remote_port=D)})),(l=t.audio).timestamp?(void 0!==r.packetsLost&&(i.audioLossRate=(r.packetsLost-l.packetsLost)/(r.packetsSent-l.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,u.fraction_lost=i.audioLossRate),i.statsInterval=r.timestamp-l.timestamp,u.stats_interval=i.statsInterval,i.sendKBitrate=(r.bytesSent-l.bytesSent||0)/i.statsInterval*8,u.bitrate=Math.round(1e3*i.sendKBitrate),u.bandwidth=Math.round(u.bitrate/1024),t.audio=r,this.monitor.rtcMediaStatistics(u,{}),i._retransmittedRate=(r.retransmittedPacketsSent-l.retransmittedPacketsSent)/(r.packetsSent-l.packetsSent),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),[2,i]):(t.audio=r,[2,i])):[2,i]}}))}))},t.prototype.getVideoStats=function(e,t){return ef(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,_,f;return tf(this,(function(v){switch(v.label){case 0:return i={},r={timestamp:Date.now(),simulcast:{}},n=this._stream,o=n.streamId,a=n.videoMid,s=n.isScreen,c=n.pubAttributes,u=n.enableSimulcast,d={media_type:"video",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localvideo?"capture_state_on":"capture_state_off"},e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 1:return(l=v.sent()).length?(h=0,l.forEach((function(e){var t=e.type,n=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,c=e.roundTripTime,l=e.mimeType,p=e.frameWidth,_=e.frameHeight,f=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,S=e.googAvailableSendBandwidth,y=e.googAvgEncodeMs,g=e.googBucketDelay,E=e.googEncodeUsagePercent,b=e.googFrameRateInput,T=e.availableIncomingBitrate,I=e.availableOutgoingBitrate,R=e.bytesReceived,A=e.nominated,C=e.id,O=e.currentRoundTripTime,w=e.state,N=e.writable,P=e.candidateType,D=e.ip,k=e.address,M=e.networkType,U=e.port,L=e.nackCount,x=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,K=e.responsesSent,W=e.ssrc,X=e.googTargetEncBitrate,Y=e.googTransmitBitrate,q=e.googRtt,J=e.retransmittedPacketsSent,Q=e.encoderImplementation,Z=e.jitter,$=e.rid,ee=e.fractionLost;"outbound-rtp"===t?(u&&($?r.simulcast[$]=e:r.simulcast[h]=e,h++),r.framesEncoded=n,r.bytesSent=a,r.framesSent=s,d.bytes=a,r.packetsSent=f,d.packetsSent=f,d.nackCount=L,d.pli_count=x,d.qp_sum=F,d.ssrc=W,d.retransmitted_packets_sent=J,r.retransmittedPacketsSent=J,d.encoder_implementation=Q):"track"===t?(i.encodedFrameWidth=p,i.encodedFrameHeight=_,d.frame_size_height=_,d.frame_size_width=p):"remote-inbound-rtp"===t?(r.packetsLost=o,i.rtt=1e3*c,d.rtt=i.rtt,d.jitter=Z,d.packetsLost=o,i._fractionLost=ee||0):"codec"===t?(i.codecType=l,d.codecName=l):"candidate-pair"===t?(d.ice_available_incoming_bitrate=T,d.ice_available_outgoing_bitrate=I,d.ice_bytes_received=R,d.ice_bytes_sent=a,d.ice_nominated=+A,d.ice_pair_id=C,d.ice_pair_rtt=O,d.ice_pair_state=w,d.ice_pair_writable=N,d.recv_ping_requests=B,d.recv_ping_responses=j,d.sent_ping_requests_before_first_response=H,d.sent_ping_requests_total=H+z,d.sent_ping_responses=K):"local-candidate"===t?(d.local_candidate_type=P,d.local_ip=D||k,d.local_network_type=M,d.local_port=U,d.protocol=V):"remote-candidate"===t?(d.remote_candidate_type=P,d.remote_ip=D||k,d.remote_port=U):"VideoBwe"===t?(d.encBitratebps=v,d.available_receive_bandwidth=m,d.available_send_bandwidth=S,d.bucket_delay=g,d.retransmitBitratebps=G,d.targetEncBitratebps=X,d.transmit_bitrate=Y,i._sendBandWidth=+S):"ssrc"===t&&(d.video_network_elapse=q,d.avg_encode_ms=y,d.encodeUsage=E,d.frame_rate_input=b,d.orignal_input_Framerate=+b)})),(p=t.video).timestamp?(i.statsInterval=r.timestamp-p.timestamp,d.stats_interval=i.statsInterval,_=Object.keys(r.simulcast),u?(d.sim_enc_width=[],d.sim_enc_height=[],d.sim_enc_bps=[],d.sim_enc_framerate=[],d.sim_rids=[],d.sim_enc_bandwidth=[],d.sim_sent_framerate=[],d.sim_fraction_lost=[],f=!1,_.sort((function(e,t){return+e-+t})).forEach((function(e){var t=r.simulcast[e],n=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,l=t.packetsSent,h=t.qualityLimitationReason,_=t.qualityLimitationDurations,v=t.qualityLimitationResolutionChanges,m=t.retransmittedPacketsSent;void 0!==h&&(d.sim_qualityLimitationReason||(d.sim_qualityLimitationReason=[],d.sim_qualityLimitationDurations=[],d.sim_qualityLimitationResolutionChanges=[]),d.sim_qualityLimitationReason.push(h),d.sim_qualityLimitationDurations.push(_),d.sim_qualityLimitationResolutionChanges.push(v));var S=p.simulcast[e];if(d.sim_enc_width.push(n||0),d.sim_enc_height.push(o||0),S){var y=(a-S.bytesSent||0)/i.statsInterval;d.sim_enc_bps.push(Math.round(8e3*y)),d.sim_enc_bandwidth.push(Math.round(8e3*y/1024));var g=1e3*(s-S.framesEncoded)/i.statsInterval;d.sim_enc_framerate.push(Math.round(g)),d.sim_rids.push(e);var E=void 0!==c?c-S.framesSent:s-S.framesEncoded,b=1e3*E/i.statsInterval;d.sim_sent_framerate.push(Math.round(b));var T=(u-S.packetsLost)/(l-S.packetsSent);i._retransmittedRate=(m-S.retransmittedPacketsSent)/(l-S.packetsSent),T=Number.isNaN(T)?0:T,d.sim_fraction_lost.push(T),n>0&&!f&&(i.sentKBitrate=8*y,i.encoderOutputFrameRate=g,i.encodedFrameCount=E,i.sentFrameRate=b,i.videoLossRate=T,f=!0)}})),this.monitor.rtcMediaStatistics(d,{})):(i.encodedFrameCount=void 0!==r.framesSent?r.framesSent-p.framesSent:r.framesEncoded-p.framesEncoded,i.sentKBitrate=(r.bytesSent-p.bytesSent||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.sentKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.encoderOutputFrameRate=1e3*(r.framesEncoded-p.framesEncoded)/i.statsInterval,d.frame_rate_encoded=Math.round(i.encoderOutputFrameRate),i.sentFrameRate=1e3*i.encodedFrameCount/i.statsInterval,d.frame_rate_sent=Math.round(i.sentFrameRate),i.videoLossRate=(r.packetsLost-p.packetsLost)/(r.packetsSent-p.packetsSent),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,i._retransmittedRate=(r.retransmittedPacketsSent-p.retransmittedPacketsSent)/(r.packetsSent-p.packetsSent),this.monitor.rtcMediaStatistics(d,{})),t.video=r,i._fractionLost=Math.max(i._fractionLost,i.videoLossRate),[2,i]):(t.video=r,[2,i])):[2,i]}}))}))},t}(gB),bB=function(e){function t(t){var i=e.call(this,t)||this;return i._videoInWaiting=!1,i}return A_(t,e),Object.defineProperty(t,"audioStallConfig",{set:function(e){t.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,t.audioStallRatio=null==e?void 0:e.audio_stall_ratio},enumerable:!1,configurable:!0}),t.prototype.setRemoteStreamStatsEvtInterval=function(e,i,r){var n,o;return ef(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,_,f,v,m,S=this;return tf(this,(function(y){switch(y.label){case 0:return this._timer?[2]:(this.setVar(e,i,r),e.once(Wx.ABNORMAL_DISCONNECTION,(function(){S.destroy()})),this._audioStallInterval=t.audioStallInterval||100,this._audioStallRatio=t.audioStallRatio||.6,a={audio:{},video:{}},s=this._stream,c=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),u=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),this.getRemoteVideoStats(u,a),[4,this.getRemoteAudioStats(c,a)]);case 1:return y.sent(),this.delStatsEvtInterval(),d=0,l=0,p=[],_=0,f=KD(),this._setAudioStallCount=function(){if(S._audioStallInterval>0&&void 0!==a.audio.concealedSamples){var e=a.audio.concealedSamples,t=a.audio.totalSamplesReceived;f=KD();var i={isStall:!1,counted:!1,diff:0},r=.5*S._audioStallInterval;S._audioStallCount=function(){return ef(S,void 0,void 0,(function(){var n,o,a,c,u,h,v,m,S,y,g,E,b,T,I;return tf(this,(function(R){switch(R.label){case 0:return n=s.hasAudio,o=s.subAudio,n&&o?(a=null===(I=s.audioTrack)||void 0===I?void 0:I.getTrack(),c=Date.now(),[4,this.handler.getStats(a,!0)]):(i.isStall=!1,i.counted=!1,p.push({reason:"hasAudio: ".concat(n,", subAudio: ").concat(o)}),f=KD(),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]);case 1:return u=R.sent(),h=Date.now(),v=KD(),(m=v-f)<r?(p.push({diff:m,start:f,end:v,get_stats_cost:h-c,get_stats_start:c,get_stats_end:h,reason:"diff(".concat(m,") < minInterval(").concat(r,")")}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]):(S=u.length,y=u.find((function(e){return"inbound-rtp"===e.type})),y?(g=y.concealedSamples,E=y.totalSamplesReceived,T=E-t,(b=g-e)>=0&&T>=0&&b>=this._audioStallRatio*T?(p.push({concealed:b,received:T,diff:m,start:f,end:v,get_stats_cost:h-c,get_stats_start:c,get_stats_end:h,is_stall:!0}),i.isStall?(i.counted?l+=m:(l=l+i.diff+m,d++),i.counted=!0):m>=200?(l+=m,d++,i.counted=!0):(i.counted=!1,i.diff=m),i.isStall=!0):(p.push({concealed:b,received:T,diff:m,start:f,end:v,get_stats_cost:h-c,get_stats_start:c,get_stats_end:h}),i.isStall=!1,i.counted=!1),e=g,t=E,f=v,_++,[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]):(p.push({diff:m,start:f,end:v,get_stats_cost:h-c,get_stats_start:c,get_stats_end:h,reason:S?"no inbound-rtp":"no report"}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:_}]))}}))}))},h=function(){return ef(S,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),this._audioStallCount?[4,this._audioStallCount()]:[3,2];case 1:e.sent(),this._audioStallTimer=setTimeout(h,this._audioStallInterval),e.label=2;case 2:return[2]}}))}))},S._audioStallTimer=setTimeout(h,S._audioStallInterval)}},this._setAudioStallCount(),v=function(){return ef(S,void 0,void 0,(function(){var e,t,i,r,n,o;return tf(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getRemoteAudioStats(e,a)];case 1:return i=c.sent(),d=0,l=0,p=[],_=0,[4,this.getRemoteVideoStats(t,a)];case 2:return r=c.sent(),[2,{audioStats:i,videoStats:r,isScreen:s.isScreen,userId:s.userId}]}}))}))},m=function(){return ef(S,void 0,void 0,(function(){var e,t;return tf(this,(function(i){switch(i.label){case 0:return[4,v()];case 1:return e=i.sent(),null===(t=this.client)||void 0===t||t.emit("onRemoteStreamStats",e),h&&(f=KD(),this._audioStallTimer=setTimeout(h,this._audioStallInterval)),this._timer=setTimeout(m,2e3),[2]}}))}))},this._timer=setTimeout(m,2e3),[2]}}))}))},t.prototype.delStatsEvtInterval=function(){e.prototype.delStatsEvtInterval.call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0},t.prototype.unsubscribe=function(){this.delStatsEvtInterval(),this._videoInWaiting=!1},t.prototype.getRemoteAudioStats=function(e,t){return ef(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y;return tf(this,(function(g){switch(g.label){case 0:return i={},r={},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.audioMid,u=n.subMediaType,d=n._attributes,l={media_type:"audio",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:c,connection_status:navigator.onLine,mute_state:ak(u)?"mute_state_off":"mute_state_on",remote_user_capture_state:d.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:d.localaudio&&d.audiostream?"mute_state_off":"mute_state_on"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(h=g.sent()).length?(h.forEach((function(e){var t=e.type,n=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,_=e.silentConcealedSamples,f=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,S=e.currentRoundTripTime,y=e.audioLevel,g=e.totalAudioEnergy,E=e.totalSamplesDuration,b=e.mimeType,T=e.googDecodingNormal,I=e.fecPacketsReceived,R=e.availableIncomingBitrate,A=e.availableOutgoingBitrate,C=e.bytesSent,O=e.nominated,w=e.id,N=e.writable,P=e.jitter,D=e.candidateType,k=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc,K=e.kind;"inbound-rtp"===t?(r.packetsLost=n,r.packetsReceived=o,l.packetsReceived=o,r.bytesReceived=a,l.bytes=a,void 0!==s&&(i.jitterBufferDelay=s/c*1e3,l.average_jitter_buffer_delay_ms=i.jitterBufferDelay),void 0!==h&&(r.totalSamplesReceived=h,i.concealedSamples=p,r.concealedSamples=p,r.silentConcealedSamples=_,l.concealedSamples=p,i.concealmentEvents=f,l.totalSamplesReceived=h),void 0!==I&&(l.fec_packets_received=I),l.jitter=1e3*P,l.ssrc=z):"codec"===t?(i.recordSampleRate=u,d&&(i.numChannels=d),l.codecName=b):"candidate-pair"===t?(l.ice_available_incoming_bitrate=R,l.ice_available_outgoing_bitrate=A,l.ice_bytes_received=a,l.ice_bytes_sent=C,l.ice_nominated=+O,l.ice_pair_id=w,l.ice_pair_rtt=S,l.rtt=1e3*S,l.ice_pair_state=m,l.ice_pair_writable=N,l.recv_ping_requests=F,l.recv_ping_responses=B,l.sent_ping_requests_before_first_response=j,l.sent_ping_requests_total=j+(G||0),l.sent_ping_responses=H,"succeeded"===m&&(i.rtt=1e3*S,i.total_rtt=1e3*v)):"track"===t&&"audio"===K?(l.audio_level=y?-10*Math.log10(Math.pow(y,2)):y,l.volume=255*y,l.total_audio_energy=g,l.totalAudioDuration=E):"ssrc"===t?(l.decodingNormal=T,l.recvAudioLevel=V):"local-candidate"===t?(l.local_candidate_type=D,l.local_ip=k||M,l.local_network_type=U,l.local_port=L,l.protocol=x):"remote-candidate"===t&&(l.remote_candidate_type=D,l.remote_ip=k||M,l.remote_port=L)})),(p=t.audio).timestamp?(_={},void 0!==r.concealedSamples&&(l.interval_concealed_samples=r.concealedSamples-p.concealedSamples,l.interval_samples_received=r.totalSamplesReceived-p.totalSamplesReceived,l.interval_silent_concealed_samples=r.silentConcealedSamples-p.silentConcealedSamples),this._audioStallInterval>0&&void 0!==p.concealedSamples?(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),this._audioStallCount?[4,this._audioStallCount()]:[3,3]):[3,3]):(r.timestamp=Date.now(),t.audio=r,[2,i])):[2,i];case 2:f=g.sent(),v=f.stall_count,m=f.stall_duration,S=f.stall_list,y=f.stats_count,_.stall_list=S,_.stats_count=y,l.concealedSamples===l.interval_concealed_samples&&l.totalSamplesReceived===l.interval_samples_received?(l.stall_count=0,l.stall_duration=0):(l.stall_count=v,l.stall_duration=m),i.stallCount=l.stall_count,i.stallDuration=l.stall_duration,g.label=3;case 3:return r.timestamp=Date.now(),i.audioLossRate=(r.packetsLost-p.packetsLost)/(r.packetsReceived-p.packetsReceived+(r.packetsLost-p.packetsLost)),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,l.packetsLost=Math.round(r.packetsLost-p.packetsLost),l.fraction_lost=i.audioLossRate,l.packets_lost_rate=i.audioLossRate,i.statsInterval=r.timestamp-p.timestamp,l.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-p.bytesReceived||0)/i.statsInterval*8,l.bitrate=Math.round(1e3*i.receivedKBitrate),l.bandwidth=Math.round(l.bitrate/1024),void 0!==r.concealedSamples&&(i.receivedSampleRate=1e3*l.interval_samples_received/i.statsInterval),t.audio=r,this.monitor.rtcMediaStatistics(l,{},_),[2,i]}}))}))},t.prototype.getRemoteVideoStats=function(e,t){return ef(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h;return tf(this,(function(p){switch(p.label){case 0:return i={},r={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.subMediaType,u=n._attributes,d={media_type:"video",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:this._stream.videoMid,connection_status:navigator.onLine,mute_state:sk(c)?"mute_state_off":"mute_state_on",remote_user_capture_state:u.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:u.localvideo&&u.videostream?"mute_state_off":"mute_state_on"},e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 1:return(l=p.sent()).length?(l.forEach((function(e){var t=e.type,n=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,_=e.firCount,f=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,S=e.nominated,y=e.id,g=e.currentRoundTripTime,E=e.state,b=e.writable,T=e.candidateType,I=e.ip,R=e.address,A=e.networkType,C=e.port,O=e.nackCount,w=e.pliCount,N=e.protocol,P=e.requestsReceived,D=e.responsesReceived,k=e.requestsSent,M=e.consentRequestsSent,U=e.responsesSent,L=e.ssrc;e.kind;var x=e.jitter,V=e.framesReceived,F=e.keyFramesDecoded,B=e.totalDecodeTime,j=e.decoderImplementation,G=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(r.packetsLost=a,d.packetsLost=a,r.packetsReceived=s,d.packetsReceived=s,r.bytesReceived=c,d.bytes=c,r.framesDecoded=u,void 0!==l&&(r.jitterBufferDelay=l/h*1e3,d.average_jitter_buffer_delay_ms=r.jitterBufferDelay),d.fir_count=_,d.nackCount=O,r.nackCount=O,d.pli_count=w,d.ssrc=L,d.jitter=x,d.framesReceived=V,r.framesReceived=V,d.framesDecoded=u,d.key_frames_decoded=F,d.total_decode_time=B,d.decoder_name=j,d.last_packet_received_timestamp=G):"track"===t&&void 0!==o?(i.width=o,d.frame_size_width=o,i.height=n,d.frame_size_height=n,void 0!==V&&(d.framesReceived=V,r.framesReceived=V)):"codec"===t?d.codecName=p:"candidate-pair"===t?(d.ice_available_incoming_bitrate=f,d.ice_available_outgoing_bitrate=v,d.ice_bytes_received=c,d.ice_bytes_sent=m,d.ice_nominated=+S,d.ice_pair_id=y,d.ice_pair_rtt=g,d.rtt=1e3*g,i.rtt=d.rtt,d.ice_pair_state=E,d.ice_pair_writable=b,d.recv_ping_requests=P,d.recv_ping_responses=D,d.sent_ping_requests_before_first_response=k,d.sent_ping_requests_total=k+(M||0),d.sent_ping_responses=U):"local-candidate"===t?(d.local_candidate_type=T,d.local_ip=I||R,d.local_network_type=A,d.local_port=C,d.protocol=N):"remote-candidate"===t&&(d.remote_candidate_type=T,d.remote_ip=I||R,d.remote_port=C)})),(h=t.video).timestamp?(i.videoLossRate=(r.packetsLost-h.packetsLost)/(r.packetsReceived-h.packetsReceived+(r.packetsLost-h.packetsLost)),i._retransmittedRate=(r.nackCount-h.nackCount)/(r.packetsReceived-h.packetsReceived+(r.packetsLost-h.packetsLost)),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,d.packets_lost_rate=i.videoLossRate,i.statsInterval=r.timestamp-h.timestamp,d.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-h.bytesReceived||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.decoderOutputFrameRate=1e3*(r.framesDecoded-h.framesDecoded)/i.statsInterval,i.receivedFrameRate=1e3*(r.framesReceived-h.framesReceived)/i.statsInterval,d.frame_rate_decoded=Math.round(i.decoderOutputFrameRate),d.frame_rate_received=d.frame_rate_decoded,t.video=r,this.processStall(this._stream,d,i,s),this.monitor.rtcMediaStatistics(d,{}),[2,i]):(t.video=r,[2,i])):[2,i]}}))}))},t.prototype.processStall=function(e,t,i,r){var n=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(n+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,n=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=n,r?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,i.stallCount=n,i.stallDuration=o},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1},t}(gB);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(_B||(_B={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.RECONNECT_FAILED="reconnect_failed"}(fB||(fB={})),function(e){e.TranscodeStateChanged="TranscodeStateChanged",e.TranscodeStarted="TranscodeStarted",e.TranscodeUpdated="TranscodeUpdated",e.TranscodeStoped="TranscodeStoped"}(vB||(vB={})),function(e){e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED"}(mB||(mB={})),function(e){e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB"}(SB||(SB={})),function(e){e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB"}(yB||(yB={}));var TB,IB=new Ck("Stream",0);!function(e){e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED"}(TB||(TB={}));var RB,AB,CB,OB,wB=function(){function e(){this.isScreen=!1,this.seiList=[],this.videoEncodeConfig=[eV],this.subVideoDescriptions=[],this.enableSimulcast=!1,this.prevScaleResolutionDownBy=1,this.pubAudio=!1,this.pubVideo=!1,this.stream=new MediaStream,this.videoInputConfig={width:640,height:360,frameRate:30},this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new EB(this)}return Object.defineProperty(e.prototype,"hasPublished",{get:function(){return this.videoTransceiver&&this.audioTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),e.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(OV()){var i=t.createEncodedStreams(),r=i.readable,n=i.writable,o=new TransformStream({transform:function(t,i){var r=e.seiList[0];if(r){var n=pB.generateSEI(r.content),o=new Uint8Array(n.byteLength+t.data.byteLength);0===r.repeatCount&&e.seiList.splice(0,1),r.repeatCount--,o.set(new Uint8Array(t.data)),o.set(n,t.data.byteLength),t.data=o.buffer,i.enqueue(t)}else i.enqueue(t)}});r.pipeThrough(o).pipeTo(n)}}else IB.print("no sender found when trying to bind encodedTransform")},e.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else IB.print("no sender found when trying to bind encodedTransform")},e.prototype.clean=function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]},e.prototype.switchTrackEnableState=function(e,t){var i;"audio"===e?i=this.audioTrack:"video"===e&&(i=this.videoTrack);var r=null==i?void 0:i.getTrack();return!(!r||(null==r?void 0:r.enabled)===t)&&(r.enabled=t,!0)},e}(),NB=function(e){function t(t,i,r,n,o){void 0===o&&(o=W_.LOW);var a=e.call(this)||this;return a.userPriority=o,a.originalStreamIndex=0,a.userId=t,a.isScreen=r,a.streamId=i,a.hasAudio=n.audiostream&&n.localaudio,a.hasVideo=n.videostream&&n.localvideo,a._attributes=n,a.subVideo=!1,a.subAudio=!1,a._sequenceId=0,a.subMediaType=MF.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=TB.INIT,a.statsReport=new bB(a),a}return A_(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSubscribed",{get:function(){return this.streamState===TB.SUB_ED},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),i=t.readable,r=t.writable;i.pipeThrough(new TransformStream({transform:function(t,i){var r=sB.getNalunits(new cB(t.data)).find((function(e){return e.sei}));if(r){var n=pB.decodeSeiBody(r.body);n&&n.type!==oB.internal&&e.safeEmit("onSEIMessage",n.payload)}i.enqueue(t)}})).pipeTo(r)}else IB.print("no receiver found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else IB.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,i,r;if((null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)===this.streamId){var n=e.track;"video"===(null==n?void 0:n.kind)?this._setVideoTrack(n):"audio"===(null===(r=e.track)||void 0===r?void 0:r.kind)&&this._setAudioTrack(n),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){var e;IB.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()},t.prototype.resetHasSubscribed=function(){this.streamState=TB.INIT},t.prototype.setRemoteUserPriority=function(e){this.userPriority=e},t.prototype.getStreamPriority=function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e},t.prototype.getSubscribeFallbackParams=function(e){if(e!==K_.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,yB.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===K_.AUDIO_ONLY)return[x_.VIDEO,yB.UNSUB]}return null},t.prototype.getSubscribeRecoverParams=function(){if(this.originalMediaType&&sk(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,yB.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,yB.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,i;(null===(i=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new qF(e,zD()),this.emit("ontrack",this.audioTrack))},t.prototype._setVideoTrack=function(e){var t,i;(null===(i=null===(t=this.videoTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new YF(e,zD()),this.emit("ontrack",this.videoTrack))},t.prototype._getSubLayerBySpatialLayer=function(e){var t=this._attributes,i=t.videoDescriptions,r=t.subVideoDescriptions,n=void 0===r?[]:r,o=i[e],a=o.width,s=o.height,c=n.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}},t}(wk),PB=new Ck("queue",4);!function(e){e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE"}(CB||(CB={})),function(e){e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack"}(OB||(OB={}));var DB,kB,MB,UB=((RB={})[OB.publish]="unpublish",RB[OB.unpublish]="publish",RB[OB.subscribe]="unsubscribe",RB[OB.unsubscribe]="subscribe",RB[OB.pushtrack]="removetrack",RB[OB.removetrack]="pushtrack",RB),LB=((AB={})[OB.publish]=CB.ADD,AB[OB.subscribe]=CB.ADD,AB[OB.pushtrack]=CB.ADD,AB[OB.unpublish]=CB.CLOSE,AB[OB.unsubscribe]=CB.CLOSE,AB[OB.removetrack]=CB.CLOSE,AB),xB=function(e){function t(){var t=e.call(this)||this;return t._queue=[],t}return A_(t,e),Object.defineProperty(t.prototype,"queue",{get:function(){return this._queue},enumerable:!1,configurable:!0}),t.prototype.enqueue=function(e){var t=this._queue.length,i="";return this._queue=this._queue.filter((function(t){return t.streamId!==e.streamId||e.action!==UB[t.action]||(i=t.streamId,PB.print("offsetStreamId",i),!1)})),this._queue.length===t&&this._queue.push(e),1===this._queue.length&&this.emit("start"),i},t.prototype.dequeue=function(){if(!this._queue.length)return null;for(var e=LB[this._queue[0].action],t=1;t<this._queue.length;t++)if(LB[this._queue[t].action]!==e)return{sdpStrategy:e,items:this._queue.splice(0,t)};return{sdpStrategy:e,items:this._queue.splice(0,this._queue.length)}},t}(Tk),VB=new Ck("ChromeHandler",3),FB=OV(),BB=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="chrome",r._queueBusy=!1,r._mid=0,r._offerMlines=[],r._answerMlines=[],r._inactiveMlineIndex=[],r._msidIndexMap={},r._mlinesCache={},r._sdpQueue=new xB,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(VB.print("dequeue start"),r.dequeue())})),r}return A_(t,e),t.prototype.connect=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return tf(this,(function(d){switch(d.label){case 0:return VB.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},r=this,[4,qV(e)];case 1:return r._answerIce=d.sent(),[4,this._peerConnection.createOffer()];case 2:return n=d.sent(),o=DV.parse(n.sdp),a=nf(o.media,1),s=a[0],this._offerIce.fingerprint=o.fingerprint||s.fingerprint,delete o.media,this._offerSession=Z_({},o),this._answerSession=Z_({},o),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),c=this._mid++,this._offerMlines=[Z_(Z_(Z_({},s),this._offerIce),{mid:"".concat(c)})],this._answerMlines=[Z_(Z_(Z_({},s),this._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(c)})],this.setDescription(),[4,new Promise((function(e,t){u._dataChannel.onopen=function(){VB.print("connect","dataChannel open"),Ix("es.dc.open",""),e("")},u._dataChannel.onerror=function(e){fx.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,DL.INVALID_DATA),Ix("es.dc.error",""),t(e)},u._dataChannel.onclose=function(e){Ix("es.dc.close",""),t(e)},u._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==u._peerConnection.iceConnectionState&&"closed"!==u._peerConnection.iceConnectionState&&"failed"!==u._peerConnection.connectionState||t(e)}))}))];case 3:return d.sent(),VB.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){e.prototype.destroy.call(this),this._mlinesCache={}},t.prototype.publish=function(t,i){return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E;return tf(this,(function(b){return r=t.stream,n=t.enableSimulcast,o=e.prototype.internalPublish.call(this,t,i),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,u="".concat(this._mid++),d="".concat(this._mid++),l=Z_(Z_(Z_({},this._aSendonlyOfferTpl),this._offerIce),{mid:u,msid:"".concat(r.id," ").concat(r.id,"-audio"),ssrcs:WV(r,"audio")}),h=Z_(Z_(Z_({},this._vSendonlyOfferTpl),this._offerIce),{mid:d,msid:"".concat(r.id," ").concat(r.id,"-video")}),n?(VB.print("subVideoDesc","desc: %o ",s),delete h.ssrcGroups,delete h.ssrcs,p=[],h.rids=a.map((function(e){var t=e.rid;return p.unshift(t),{id:t,direction:"send"}})),h.simulcast={dir1:"send",list1:p.join(";")}):(_=function(e,t){var i=KV(),r=KV();return{ssrcs:[i,r].reduce((function(i,r){return i.concat(WV(e,t,r))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(i," ").concat(r)}]}}(r,"video"),f=_.ssrcs,v=_.ssrcGroups,h.ssrcs=f,h.ssrcGroups=v),QD&&ZD&&Array.isArray(h.ext)&&(h.ext=h.ext.filter((function(e){var t;return!(null===(t=null==e?void 0:e.uri)||void 0===t?void 0:t.includes("video-orientation"))}))),(null==i?void 0:i.audioRed)&&Array.isArray(l.rtp)&&-1!==(m=l.rtp.findIndex((function(e){return"red"===e.codec})))&&(S=nf(l.rtp.splice(m,1),1),y=S[0],l.rtp.unshift(y)),(g=null==l?void 0:l.rtp.find((function(e){return"opus"===e.codec})))&&l.fmtp&&(E=l.fmtp.find((function(e){return e.payload===g.payload})))&&this._context&&(E.config+=this._context.audioProfileManager.getOpusConfigStr()),this._mlinesCache[t.stream.id]=[l,h],[2,{partialSdp:YV(this._offerSession,l,h),audioMid:u,videoMid:d,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}))}))},t.prototype.subscribe=function(e,t){return ef(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l;return tf(this,(function(h){switch(h.label){case 0:return VB.print("subscribe","mids: ",t),i="incroffer",r="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl?[3,3]:[4,rk(!0)];case 1:if(!(n=h.sent()))throw new lP(aP.NOT_SUPPORTED,"Get offer Error");return[4,this.createAVMlineOfferTpl(n)];case 2:h.sent(),h.label=3;case 3:return this._mlinesCache[e.streamId]?(o=nf(this._mlinesCache[e.streamId],2),a=o[0],s=o[1],[2,{partialSdp:YV(this._offerSession,a,s),audioMid:a.mid,videoMid:s.mid,type:i,semantics:r}]):(c="".concat(this._mid++),u="".concat(this._mid++),d=Z_(Z_(Z_({},this._aRecvonlyOfferTpl),this._offerIce),{mid:c}),l=Z_(Z_(Z_({},this._vRecvonlyOfferTpl),this._offerIce),{mid:u}),this._mlinesCache[e.streamId]=[d,l],[2,{partialSdp:YV(this._offerSession,d,l),audioMid:c,videoMid:u,type:i,semantics:r,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}}])}}))}))},t.prototype.handleAck=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){return VB.print("handleAck()","item: %o",e),[2,this._sdpQueue.enqueue(e)]}))}))},t.prototype.dequeue=function(){return ef(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s=this;return tf(this,(function(c){switch(c.label){case 0:return this._queueBusy=!0,e=this._sdpQueue.dequeue(),VB.print("dequeue()","ret: %o",e),e?(t=e.items,i=e.sdpStrategy,r=[],n=[],i===CB.ADD?(delete(o=Z_({},this._answerIce)).candidates,t.forEach((function(e){return ef(s,void 0,void 0,(function(){var t,i,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T;return tf(this,(function(I){switch(I.label){case 0:return t=e.action,i=e.transceiverInit,a=e.signalingAck,s=e.stream,(c=s instanceof NB)&&(null==a?void 0:a.sequenceId)<s.sequenceId?[2]:(u={},d={},l=DV.parse(a.sdp),Array.isArray(l.media)&&(h="",l.media.sort((function(e,t){var i;return null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.localeCompare(null==t?void 0:t.type)})).forEach((function(e){"audio"===(e=Z_(Z_({},e),o)).type?(u=e,VB.print("audioMsid",e.msid),e.msid&&(h=e.msid.replace("audio","video"))):(d=e,VB.print("videoMsid",h),h&&(d.msid=h,h=""))}))),p=s.streamId,t===OB.publish&&(p=null===(b=s.stream)||void 0===b?void 0:b.id),_=nf(this._mlinesCache[p],2),f=_[0],v=_[1],i?(s.audioTransceiver=this._peerConnection.addTransceiver(i.aTrack,i.audioTransceiverInit),s.videoTransceiver=this._peerConnection.addTransceiver(i.vTrack,i.videoTransceiverInit),(m=this._inactiveMlineIndex.shift())||(m=this._offerMlines.length),this._offerMlines[m]=Z_(Z_({},f),{mid:u.mid}),this._answerMlines[m]=u,(S=this._inactiveMlineIndex.shift())||(S=this._offerMlines.length),this._offerMlines[S]=Z_(Z_({},v),{mid:d.mid}),this._answerMlines[S]=d,this._msidIndexMap[s.streamId]=[m,S],FB&&(s.initAudioEncodedTransform(),s.initVideoEncodedTransform()),r.push(s.streamId||""),n.push(c?s.userId:"local"),[3,5]):[3,1]);case 1:return c?(y=nf(this._msidIndexMap[s.streamId]||[],2),g=y[0],E=y[1],g&&E?(null===(T=this._offerMlines[g])||void 0===T?void 0:T.mid)===u.mid?[3,3]:(this._offerMlines[g]=XV(this._offerMlines[g]),this._offerMlines[E]=XV(this._offerMlines[E]),this._answerMlines[g]=XV(this._answerMlines[g]),this._answerMlines[E]=XV(this._answerMlines[E]),[4,this.setDescription()]):[3,4]):[3,5];case 2:I.sent(),this._offerMlines[g]=Z_(Z_({},this._aRecvonlyOfferTpl),{mid:u.mid}),this._offerMlines[E]=Z_(Z_({},this._vRecvonlyOfferTpl),{mid:d.mid}),VB.print("enqueue","hack: %o",s.streamId),I.label=3;case 3:return this._answerMlines[g]=u,this._answerMlines[E]=d,[3,5];case 4:VB.print("dequeue","pushtrack before subscribe: %o",s.userId),I.label=5;case 5:return c&&(s.sequenceId=null==a?void 0:a.sequenceId),[2]}}))}))}))):(a={},t.forEach((function(e){var t,i=e.audioMid,r=e.videoMid;a[i]=i,a[r]=r,delete s._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return a[e.mid]&&(e=XV(e),s._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return a[e.mid]&&(e=XV(e)),e}))),[4,this.setDescription(r.length?{streamId:r.join(","),streamUserId:n.join(",")}:void 0)]):(this._queueBusy=!1,[2]);case 1:return c.sent(),VB.print("dequeue","loop"),this.dequeue(),[2]}}))}))},t.prototype.setDescription=function(e){return ef(this,void 0,void 0,(function(){var t,i;return tf(this,(function(r){switch(r.label){case 0:return VB.print("setDescription","_offerMlines: %o, _answerMlines: %o",this._offerMlines,this._answerMlines),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,t=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&t.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=t.join(" "),this._answerSession.groups[0].mids=t.join(" ")),i=KD(),e&&fx.rtcBeginCreateOffer("local"===e.streamUserId?UL.UP:UL.DOWN,e.streamId,e.streamUserId),[4,this._peerConnection.createOffer()];case 1:return r.sent(),e&&fx.rtcCreateOffer(0,"local"===e.streamUserId?LL.UP:LL.DOWN,e.streamId,e.streamUserId,KD()-i),[4,this.setLocalDescription(DV.write(this._offerSession),e)];case 2:return r.sent(),[4,this.setRemoteDescription(DV.write(this._answerSession),e)];case 3:return r.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return ef(this,void 0,void 0,(function(){var e,t,i;return tf(this,(function(r){switch(r.label){case 0:return[4,rk(!0)];case 1:if(!(e=r.sent()))throw new lP(aP.NOT_SUPPORTED,"Get offer Error");return this.createAVMlineOfferTpl(e),t=DV.parse(e),i=[],t.media=t.media.filter((function(e){return"recvonly"===e.direction&&(i.push(e.mid+""),!0)})),t.groups=[{mids:i.join(" "),type:"BUNDLE"}],[2,{sdp:DV.write(t),semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.rollback=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){return delete this._mlinesCache[e],[2]}))}))},t.prototype.createAVMlineOfferTpl=function(e){var t=this;DV.parse(e).media.forEach((function(e){"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:t._aRecvonlyOfferTpl=e:"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:t._vRecvonlyOfferTpl=e)}))},t}(PV),jB=new Ck("FirefoxHandler",3),GB=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="firefox",r}return A_(t,e),t.prototype.connect=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return tf(this,(function(d){switch(d.label){case 0:return jB.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},r=this,[4,qV(e)];case 1:return r._answerIce=d.sent(),[4,this._peerConnection.createOffer()];case 2:return n=d.sent(),o=DV.parse(n.sdp),a=nf(o.media,1),s=a[0],this._offerIce.fingerprint=o.fingerprint||s.fingerprint,o.media=o.media.map((function(e){return Z_(Z_({},e),u._offerIce)})),(c=Z_({},o)).fingerprint=this._answerIce.fingerprint,c.media=c.media.map((function(e){return Z_(Z_(Z_({},e),u._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),[4,this.setLocalDescription(DV.write(o))];case 3:return d.sent(),[4,this.setRemoteDescription(DV.write(c))];case 4:return d.sent(),[4,new Promise((function(e,t){u._dataChannel.onopen=function(){jB.print("connect","dataChannel open"),Ix("es.dc.open",""),e("")},u._dataChannel.onerror=function(e){fx.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,DL.INVALID_DATA),Ix("es.dc.error",""),t(e)},u._dataChannel.onclose=function(e){Ix("es.dc.close",""),t(e)},u._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==u._peerConnection.iceConnectionState&&"closed"!==u._peerConnection.iceConnectionState&&"failed"!==u._peerConnection.connectionState||t(e)}))}))];case 5:return d.sent(),jB.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,i){var r,n;return ef(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,_,f,v=this;return tf(this,(function(m){switch(m.label){case 0:return o=e.prototype.internalPublish.call(this,t,i),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(c.aTrack,c.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(c.vTrack,c.videoTransceiverInit),u=KD(),fx.rtcBeginCreateOffer(UL.UP,"",""),[4,this._peerConnection.createOffer()];case 1:return d=m.sent(),fx.rtcCreateOffer(0,LL.UP,"","",KD()-u),(l=DV.parse(d.sdp)).media=null===(r=l.media)||void 0===r?void 0:r.map((function(e){return Z_(Z_({},e),v._offerIce)})),[4,this.setLocalDescription(DV.write(l))];case 2:return m.sent(),h=t.audioTransceiver.mid,p=t.videoTransceiver.mid,_=null,f=null,l.media=null===(n=l.media)||void 0===n?void 0:n.map((function(e){if("".concat(e.mid)===h){var t=null==(_=e)?void 0:_.rtp.find((function(e){return"opus"===e.codec}));if(t&&_.fmtp){var i=_.fmtp.find((function(e){return e.payload===t.payload}));i&&v._context&&(i.config+=v._context.audioProfileManager.getOpusConfigStr())}}else"".concat(e.mid)===p&&(f=e);return e})),[4,this.setLocalDescription(DV.write(l))];case 3:return m.sent(),[2,{partialSdp:YV(l,_,f),audioMid:h,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}}))}))},t.prototype.subscribe=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d=this;return tf(this,(function(l){switch(l.label){case 0:return jB.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),r=KD(),fx.rtcBeginCreateOffer(UL.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:return n=l.sent(),fx.rtcCreateOffer(0,LL.UP,e.streamId,e.userId,KD()-r),(o=DV.parse(n.sdp)).media=null===(t=o.media)||void 0===t?void 0:t.map((function(e){return Z_(Z_({},e),d._offerIce)})),[4,this.setLocalDescription(DV.write(o),{streamId:e.streamId||"",streamUserId:e.userId})];case 2:return l.sent(),a=e.audioTransceiver.mid,s=e.videoTransceiver.mid,c=null,u=null,null===(i=o.media)||void 0===i||i.forEach((function(e){"".concat(e.mid)===a?c=e:"".concat(e.mid)===s&&(u=e)})),[2,{partialSdp:YV(o,c,u),audioMid:a,videoMid:s,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c=this;return tf(this,(function(u){return e.action===OB.unpublish||e.action===OB.unsubscribe||(r=e.signalingAck,n={},(o=DV.parse(null===(t=this._peerConnection.remoteDescription)||void 0===t?void 0:t.sdp)).media.forEach((function(e){n[e.mid]=e})),DV.parse(null==r?void 0:r.sdp).media.forEach((function(e){n[e.mid]=Z_(Z_({},e),c._answerIce)})),a=[],(s=DV.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media.forEach((function(e){a.push(n[e.mid])})),o.groups=s.groups,o.media=a,this.setRemoteDescription(DV.write(o))),[2,""]}))}))},t.prototype.getDefaultSdp=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){return[2,{semantics:"unified-plan",sdp:"",type:"offer"}]}))}))},t.prototype.rollback=function(e,t){var i,r;return ef(this,void 0,void 0,(function(){var e,n,o;return tf(this,(function(a){switch(a.label){case 0:return jB.print("rollback()"),t.audioTransceiver&&t.videoTransceiver?(t.audioTransceiver.stop(),t.videoTransceiver.stop(),e=[],(n=DV.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media=n.media.map((function(i){return"".concat(i.mid)!==t.audioMid&&"".concat(i.mid)!==t.videoMid||(i=XV(i)),"inactive"!==i.direction&&e.push(i.mid),i})),(o=DV.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media=o.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=XV(e)),e})),n.groups&&o.groups&&(n.groups[0].mids=e.join(" "),o.groups[0].mids=e.join(" ")),[4,this._peerConnection.createOffer()]):[3,4];case 1:return a.sent(),[4,this.setLocalDescription(DV.write(n))];case 2:return a.sent(),[4,this.setRemoteDescription(DV.write(o))];case 3:a.sent(),a.label=4;case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return[4,this._peerConnection.createOffer()];case 1:return e.sent(),this._peerConnection.localDescription&&this._peerConnection.remoteDescription?[4,this._peerConnection.setLocalDescription(this._peerConnection.localDescription)]:[3,4];case 2:return e.sent(),[4,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},t}(PV),HB=function(e,t){return JD?new GB(e,t):new BB(e,t)},zB=new Ck("Locker",2),KB=1,WB=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=KB++,e&&(this.name=e),zB.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return Object.defineProperty(e.prototype,"isLocked",{get:function(){return this.locks>0},enumerable:!1,configurable:!0}),e.prototype.lock=function(){var e,t=this;this.locks+=1,zB.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var i=new Promise((function(i){e=function(){t.locks-=1,zB.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),i()}})),r=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return i})),r},e}();!function(e){e[e.communication=0]="communication",e[e.live_broadcasting=1]="live_broadcasting",e[e.game=2]="game",e[e.cloud_game=3]="cloud_game",e[e.low_latency=4]="low_latency",e[e.chat=5]="chat",e[e.chat_room=6]="chat_room",e[e.lw_together=7]="lw_together",e[e.game_hd=8]="game_hd",e[e.co_host=9]="co_host",e[e.interactive_podcast=10]="interactive_podcast",e[e.ktv=11]="ktv",e[e.chorus=12]="chorus",e[e.vr_chat=13]="vr_chat",e[e.game_streaming=14]="game_streaming",e[e.lan_live_streaming=15]="lan_live_streaming",e[e.meeting=16]="meeting",e[e.meeting_room=17]="meeting_room",e[e.classroom=18]="classroom"}(kB||(kB={})),function(e){e.IES_living="IES_living",e.FeedShare="FeedShare",e.fluent="fluent",e.IES_chatroom="IES_chatroom",e.standard="standard",e.IES_PK="IES_PK",e.IES_KTV="IES_KTV"}(MB||(MB={}));var XB,YB=((DB={})[q_.communication]=[kB.communication],DB[q_.chat]=[kB.communication],DB[q_.chatRoom]=[kB.live_broadcasting,MB.IES_chatroom],DB[q_.coHost]=[kB.live_broadcasting,MB.IES_PK],DB[q_.meeting]=[kB.meeting],DB[q_.classRoom]=[kB.communication],DB),qB=new Ck("MediaServerClient",2),JB=5e3;!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(XB||(XB={}));var QB,ZB=function(e,t){qB.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},$B=function(e){function t(t,i){void 0===i&&(i=fx);var r=e.call(this)||this;return r._ontrackCallbackMap=new Map,r._subResolves={},r.supportConcurrent=!1,r._pubConfig={},r._subConfig={},r._roomProfile=q_.communication,r._subStreamQueue={},r.monitor=i,r._pubSubLock=new WB("pubSubLock"),r._joinLeaveLock=new WB("joinLeaveLock"),r._state=XB.DISCONNECTED,r._roomAttributes={multiChatMode:!1,bigRoomMode:!1},r._context=t,r.on("SUB_END",(function(e){return r._handleSubStreamQueue(e)})),r}return A_(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){qB.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(Wx.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[zx.ON_ADD_STREAM,zx.ON_REMOVE_STREAM,zx.USER_CONNECTION,zx.USER_DISCONNECTION,zx.ON_UPDATE_STREAM_ATTRIBUTES,zx.ON_UPDATE_ROOM_ATTRIBUTES,zx.ON_PUSH_TRACK,zx.ON_REMOVE_TRACK,zx.NODE_CHANGE,zx.ON_CUSTOM_MESSAGE,zx.USER_MESSAGE_RECEIVED,zx.USER_BINARY_MESSAGE_RECEIVED,zx.POST_PROCESSING_MESSAGE,zx.ON_USER_TOKEN_WILL_EXPIRE,zx.STREAM_CONTROL_MESSAGE,zx.ON_SCENE_CONFIG,Kx.RSCP].forEach((function(e){var i;null===(i=t._dataChannelSignal)||void 0===i||i.on(e,(function(i){t.safeEmit(e,i)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){qB.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(Wx.ABNORMAL_DISCONNECTION)}))},t.prototype._removeSignalEventHandler=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()},Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(Wx.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.connect=function(e,t,i,r){var n;return void 0===t&&(t=""),void 0===i&&(i=""),void 0===r&&(r={}),ef(this,void 0,void 0,(function(){var o,a,s,c,u,d=this;return tf(this,(function(l){switch(l.label){case 0:return this.connectionState=XB.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),r.node?(o=[r.node],Ix("es.join.nodeChange",r),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new dV,[4,null===(n=this._iceConfigRequestManager)||void 0===n?void 0:n.getAccessNode(e,t,i,Dx.getDeviceId(),null==r?void 0:r.reason,null==r?void 0:r.feedbackNode,this._useCloudProxy)];case 2:if(!(o=l.sent()))throw Ix("es.join.getNodeFailed",""),new lP(aP.ICE_SERVER_WRONG,"get ICE config failed");Ix("es.join.getNodeSuccess",o),l.label=3;case 3:this._addHandlerEvents(),Promise.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),l.label=4;case 4:return l.trys.push([4,6,,7]),s=!1,c=o.map((function(e){var t=HB(d.monitor,d._context);return t.connect(e).then((function(i){s?t.destroy():(s=!0,a=i,d.safeEmit("prevIceNode",e),d._handler=t,d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(e){throw t.destroy(),e}))})),[4,nk(c)];case 5:return l.sent(),qB.print("join","establish peerConnection success"),[3,7];case 6:throw u=l.sent(),this.connectionState=XB.DISCONNECTED,new lP(aP.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",u);case 7:if(!a)throw this.connectionState=XB.DISCONNECTED,new lP(aP.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");return this._dataChannelSignal=new sV(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,i,r){var n,o,a,s,c,u,d,l,h,p;return void 0===t&&(t={}),void 0===i&&(i=!1),ef(this,void 0,void 0,(function(){var _,f,v,m,S,y,g,E=this;return tf(this,(function(b){switch(b.label){case 0:return qB.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,i,r),this._appId=e.appId,this._token=e.token,this._roomId=e.roomId,this._clientId=e.userInfo.userId,this._businessId=e.userInfo.businessId,this._userInfo=e.userInfo,this._useCloudProxy=e.useCloudProxy,this._roomProfile=e.roomProfile,this._sessionId=t.sessionId,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return b.sent(),y={Authorization:YD.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId||"",timestamp:Date.now(),controlMessage:r,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role}},g={},[4,CV()];case 2:return y.params=(g.supportedCodecs=b.sent(),g.deviceType="web",g.userAgent=window.navigator.userAgent,g.sdkVersion=iV.VERSION,g.deviceId=Dx.getDeviceId(),g.appId=this._appId,g.roomId=this._roomId,g.userId=this._clientId,g.businessId=this._businessId,g.enable_cloud_proxy=this._useCloudProxy,g.channelProfile=YB[this._roomProfile]?YB[this._roomProfile][0]+"":"0",g),y.options={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0},_=y,JD?[3,4]:(f=_,[4,null===(n=this._handler)||void 0===n?void 0:n.getDefaultSdp()]);case 3:f.sdpInfo=b.sent(),_.options.enableUnBundleMode=!0,b.label=4;case 4:Promise.resolve().then((function(){return E.emit("onSendingJoinMessageHook")})),b.label=5;case 5:return b.trys.push([5,7,,8]),v=i?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(v,_)];case 6:return m=b.sent(),qB.print("join","send join message success"),this._authorization=_.Authorization,this.connectionState=XB.CONNECTED,bB.audioStallConfig=null===(o=m.config)||void 0===o?void 0:o.engine_WEB,this._pubConfig.audioRed=!!(null===(s=null===(a=m.config)||void 0===a?void 0:a.engine_WEB)||void 0===s?void 0:s.pub_audio_red),this._subConfig.muteReplaceUnsub=!!(null===(c=m.config)||void 0===c?void 0:c.mute_replace_unsub),this._pubConfig.simulcastOnDemand=!(!1===(null===(l=null===(d=null===(u=m.config)||void 0===u?void 0:u.engine_VPM)||void 0===d?void 0:d.ondemand)||void 0===l?void 0:l.enable)),null===(h=this._context)||void 0===h||h.audioProfileManager.updateEngineBAC(null===(p=m.config)||void 0===p?void 0:p.engine_BAC),[2,m];case 7:if(S=b.sent(),this.connectionState=XB.DISCONNECTED,(null==S?void 0:S.code)>=700&&(null==S?void 0:S.code)<800)throw new lP(aP.INVALID_TOKEN,(null==S?void 0:S.message)||"Invalid token");if(200!==(null==S?void 0:S.code))throw new lP(aP.JOIN_ROOM_FAILED,(null==S?void 0:S.message)||"Join room failed");return[3,8];case 8:return[2]}}))}))},t.prototype.publish=function(e){var t,i,r,n,o,a,s,c,u,d;return ef(this,void 0,void 0,(function(){var l,h,p,_,f,v,m,S,y;return tf(this,(function(g){switch(g.label){case 0:qB.print("publish()","localStream: %o",e),l=e.videoTrack,h=e.audioTrack,p=KD(),_="",f="",g.label=1;case 1:return g.trys.push([1,4,,6]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(v=g.sent()))throw new lP(aP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return _=v.audioMid,f=v.videoMid,e.pubAttributes={localaudio:!!h,localvideo:!!l,videostream:e.pubVideo,audiostream:e.pubAudio,extvideo:!!(l instanceof eB),extaudio:!!(h instanceof tB)},m={attributes:Z_({videoDescriptions:v.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:_,videoMid:f,sdpInfo:{msid:e.stream.id,type:v.type,sdp:v.partialSdp,semantics:v.semantics}},e.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(m.attributes.subVideoDescriptions=v.subVideoDescriptions),[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("publish",m)];case 3:if(200!==(null==(S=g.sent())?void 0:S.code))throw new lP(aP.PUBLISH_FAILED,(null==S?void 0:S.message)||"publish failed");return fx.rtcRecvAnswer(0,FL.INCRANSWER,(null===(r=null==S?void 0:S.relayMessage)||void 0===r?void 0:r.sequenceId)||0,null===(n=null==S?void 0:S.relayMessage)||void 0===n?void 0:n.sdp,BL.UP,"",""),null===(o=this._handler)||void 0===o||o.handleAck({action:OB.publish,streamId:S.streamId,audioMid:_,videoMid:f,transceiverInit:v.transceiverInit,signalingAck:{audioMid:null===(a=null==S?void 0:S.relayMessage)||void 0===a?void 0:a.audioMid,videoMid:null===(s=null==S?void 0:S.relayMessage)||void 0===s?void 0:s.videoMid,sdp:null===(c=null==S?void 0:S.relayMessage)||void 0===c?void 0:c.sdp,sequenceId:null===(u=null==S?void 0:S.relayMessage)||void 0===u?void 0:u.sequenceId},stream:e}),e.streamId=S.streamId,e.videoMid=f,e.audioMid=_,e.subVideoDescriptions=v.subVideoDescriptions,this.monitor.rtcPublishStat(jL.SUCCESS,GL.W_0,p,HL.UNKNOWN),e.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 4:return(y=g.sent())instanceof Error&&this.monitor.rtcPublishStat(jL.FAIL,GL.W_0,p,y.message),[4,null===(d=this._handler)||void 0===d?void 0:d.rollback(e.stream.id,e)];case 5:throw g.sent(),y;case 6:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,i,r,n,o,a,s;return ef(this,void 0,void 0,(function(){var c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A,C,O,w,N,P,D,k,M;return tf(this,(function(U){switch(U.label){case 0:qB.print("updatePubTrack()","localStream: %o",e),c=e.videoTrack,u=e.audioTrack,d=e.pubAudio,l=e.pubVideo,h=null==u?void 0:u.getTrack(),p=null==c?void 0:c.getTrack(),l&&p?null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack(p):null===(i=e.videoTransceiver)||void 0===i||i.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateScaleResolutionDownBy(e),d&&h?(f=(_=u).mixType,(v=_.mixedAudioTrack)&&f!==sf.PLAYOUT&&!0===h.enabled&&(h=v),null===(n=e.audioTransceiver)||void 0===n||n.sender.replaceTrack(h)):null===(o=e.audioTransceiver)||void 0===o||o.sender.replaceTrack(null),m={localaudio:!!u,localvideo:!!c,videostream:l,audiostream:d,extvideo:!!(c instanceof eB),extaudio:!!(u instanceof tB)},S={};try{for(y=rf(Object.entries(m)),g=y.next();!g.done;g=y.next())E=nf(g.value,2),b=E[0],(T=E[1])!==Reflect.get(e.pubAttributes,b)&&Reflect.set(S,b,T)}catch(e){k={error:e}}finally{try{g&&!g.done&&(M=y.return)&&M.call(y)}finally{if(k)throw k.error}}return Object.keys(S).length?(e.observer&&(I=e.observer,R=S.audiostream,A=S.videostream,C=S.localaudio,w=S.extaudio,N=S.extvideo,void 0!==(O=S.localvideo)?void 0!==N?I.setPushVideo(N):I.setEnableVideo(O):void 0!==A&&I.setUnmuteVideo(A),void 0!==C?void 0!==w?I.setPushAudio(w):I.setEnableAudio(C):void 0!==R&&I.setUnmuteAudio(R)),e.pubAttributes=m,P={roomId:this._roomId,streamId:e.streamId,attributes:S},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateStreamAttributes",P)]):[2];case 1:if(200!==(null==(D=U.sent())?void 0:D.code))throw new lP(aP.UPDATE_TRACK_FAILED,(null==D?void 0:D.message)||"update track failed");return JD?[4,null===(s=this._handler)||void 0===s?void 0:s.setCurrentDescription()]:[3,3];case 2:U.sent(),U.label=3;case 3:return[2]}}))}))},t.prototype.updateToken=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n,o;return tf(this,(function(a){switch(a.label){case 0:if(qB.print("updateToken()","newToken: %o",e),this._token=e,!this._appId||!(null===(t=this._userInfo)||void 0===t?void 0:t.userId)||!this._roomId)return[2];n={roomId:this._roomId,userId:null===(i=this._userInfo)||void 0===i?void 0:i.userId,appId:this._appId,token:"Bearer ".concat(e)},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateToken",n)];case 2:if(200!==(null==(o=a.sent())?void 0:o.code))throw new lP(aP.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new lP(aP.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n;return tf(this,(function(o){switch(o.label){case 0:return qB.print("unpublish()","localStream: %o",e),n={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},null===(t=this._dataChannelSignal)||void 0===t||t.sendSignaling("unpublish",n),null===(i=this._handler)||void 0===i||i.handleAck({action:OB.unpublish,audioMid:e.audioMid,videoMid:e.videoMid,stream:e,streamId:e.streamId}),e.statsReport.unpublish(),[4,null===(r=this._handler)||void 0===r?void 0:r.rollback(e.stream.id,e)];case 1:return o.sent(),[2]}}))}))},t.prototype.subscribe=function(e,t,i){return ef(this,void 0,void 0,(function(){var r=this;return tf(this,(function(n){return[2,new Promise((function(n,o){return ef(r,void 0,void 0,(function(){var r,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A,C,O,w,N,P,D,k,M,U,L,x=this;return tf(this,(function(V){switch(V.label){case 0:if(e.streamState===TB.SUB_ED)return[2,this._updateSubTrack(e,t,yB.SUB).then(n,o)];if(e.streamState===TB.SUB_ING)return this._subStreamQueue[e.streamId]||(this._subStreamQueue[e.streamId]=[]),qB.print("_subStreamQueue","streamId: %o, enqueue",e.streamId),this._subStreamQueue[e.streamId].push({fn:this.subscribe,args:[e,t,i],resolve:n,reject:o}),[2];if(qB.print("subscribe()","mediaType: %o",t),ZB("subscribe()",e),e.streamState=TB.SUB_ING,r=!1,a=!1,ak(t)&&(a=!0),sk(t)&&(r=!0),!r&&this._multiChatMode())return[2,n(null)];s=KD(),c=e.audioMid,u=e.videoMid,l=e.paused,h=e.subVideo,V.label=1;case 1:return V.trys.push([1,8,,10]),c&&u?[4,null===(R=this._handler)||void 0===R?void 0:R.subscribe(e,{audioMid:c,videoMid:u})]:[3,3];case 2:return d=V.sent(),[3,5];case 3:return[4,null===(A=this._handler)||void 0===A?void 0:A.subscribe(e)];case 4:if(!(d=V.sent()))throw new lP(aP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");c=d.audioMid,u=d.videoMid,V.label=5;case 5:return e.paused=!r,e.subVideo=r,p={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:u,audioMid:c,sdpInfo:{sdp:null==d?void 0:d.partialSdp,semantics:null==d?void 0:d.semantics,type:null==d?void 0:d.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||a,video:r},qualityLayer:{spatialLayer:(null==i?void 0:i.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==i?void 0:i.spatialSubLayer)||-1}}},[4,null===(C=this._dataChannelSignal)||void 0===C?void 0:C.sendSignaling("subscribe",p)];case 6:if(200!==(null==(_=V.sent())?void 0:_.code))throw new lP(aP.SUBSCRIBE_FAILED,(null==_?void 0:_.message)||"subscribe failed");return f=[],v=!this._multiChatMode(),m=!e.videoTrack,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),m&&f.push(new Promise((function(t,i){x._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),JB);e.on("ontrack",(function i(n){"video"===n.mediaType&&(qB.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),v&&f.push(new Promise((function(t,i){x._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),JB);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(qB.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),S=function(t){e.ontrack(t)},null===(O=this._handler)||void 0===O||O.on("ontrack",S),this._ontrackCallbackMap.set(e,S),y=null==_?void 0:_.relayMessage,g=y.audioMid,E=y.videoMid,(I={})[c]=g,I[u]=E,b=I,qB.print("sub midmap",e.userId,b),e.videoMid=E,e.audioMid=g,e._workaround_1_=!1,e.subMediaType=t,e.streamState=TB.SUB_ED,fx.rtcRecvAnswer(0,FL.INCRANSWER,(null===(w=null==_?void 0:_.relayMessage)||void 0===w?void 0:w.sequenceId)||0,null===(N=null==_?void 0:_.relayMessage)||void 0===N?void 0:N.sdp,BL.DOWN,e.streamId,e.userId),null===(P=this._handler)||void 0===P||P.handleAck({action:OB.subscribe,streamId:e.streamId,audioMid:c,videoMid:u,transceiverInit:null==d?void 0:d.transceiverInit,signalingAck:{audioMid:null===(D=null==_?void 0:_.relayMessage)||void 0===D?void 0:D.audioMid,videoMid:null===(k=null==_?void 0:_.relayMessage)||void 0===k?void 0:k.videoMid,sdp:null===(M=null==_?void 0:_.relayMessage)||void 0===M?void 0:M.sdp,sequenceId:null===(U=null==_?void 0:_.relayMessage)||void 0===U?void 0:U.sequenceId},stream:e}),[4,Promise.all(f)];case 7:return V.sent(),this._multiChatMode()||(e.subAudio=a),this.monitor.rtcSubscribeStat(zL.SUCCESS,s,KL.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),n(null),this.emit("SUB_END",e.streamId),[3,10];case 8:return(T=V.sent())instanceof Error&&this.monitor.rtcSubscribeStat(zL.FAIL,s,T.message,e.userId),e.paused=l,e.subVideo=h,e.streamState=TB.INIT,[4,null===(L=this._handler)||void 0===L?void 0:L.rollback(e.streamId,e)];case 9:return V.sent(),o(T),this.emit("SUB_END",e.streamId),[3,10];case 10:return[2]}}))}))}))]}))}))},t.prototype._handleSubStreamQueue=function(e){var t,i=this;if(null===(t=this._subStreamQueue[e])||void 0===t?void 0:t.length){qB.print("_subStreamQueue","streamId: %o, exec",e);var r=this._subStreamQueue[e].shift(),n=r.fn,o=r.args,a=r.resolve,s=r.reject;n.apply(this,o).then(a,s).finally((function(){return i._handleSubStreamQueue(e)}))}else qB.print("_subStreamQueue","streamId: %o, END",e)},t.prototype.controlMessage=function(e){var t;return ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:return qB.print("controlMessage()","params: %o",e),i=e,"transcode"===e.type&&(i.roomId=this._roomId),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",i)];case 1:return r.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return ef(this,void 0,void 0,(function(){return tf(this,(function(i){switch(i.label){case 0:return qB.print("updateUserAttributes()","attributes: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:e})];case 1:return i.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,i,r){return ef(this,void 0,void 0,(function(){return tf(this,(function(n){return[2,this._updateSubTrack(e,t,i,r||e.subLayer)]}))}))},t.prototype._updateSubTrack=function(e,t,i,r){var n,o,a,s,c;return void 0===r&&(r={spatialLayer:0,spatialSubLayer:-1}),ef(this,void 0,void 0,(function(){var u,d,l,h,p;return tf(this,(function(_){switch(_.label){case 0:return qB.print("updateSubTrack()","mediaType: %o, subLayer: %o",t,r),ZB("updateSubTrack()",e),u=0,u=i===yB.SUB?e.subMediaType|t:e.subMediaType-(e.subMediaType&t),qB.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",e.subMediaType,i,t,u),e.subMediaType===u&&qB.print("updateSubTrack","mediaType no change"),d=!1,l=!1,ak(u)&&(l=!0),sk(u)&&(d=!0),h={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:d,audio:!!this._multiChatMode()||l},qualityLayer:{spatialLayer:null!==(n=r.spatialLayer)&&void 0!==n?n:0,temporalLayer:0,spatialSubLayer:null!==(o=r.spatialSubLayer)&&void 0!==o?o:-1}}},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateSubscribe",h)];case 1:if(200!==(null==(p=_.sent())?void 0:p.code))throw new lP(aP.UPDATE_TRACK_FAILED,(null==p?void 0:p.message)||"update track failed");return e.paused=!d,this._multiChatMode()||(null===(s=e.observer)||void 0===s||s.setUnmuteAudio(l),e.subAudio=l),null===(c=e.observer)||void 0===c||c.setUnmuteVideo(d),e.subVideo=d,e.subMediaType=u,e.subLayer=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var i,r,n,o,a;return ef(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,_,f,v,m,S=this;return tf(this,(function(y){switch(y.label){case 0:if(qB.print("subscribe4pushTrack()","streamInfo: %o",t),ZB("subscribe4pushTrack()",e),s=null==t?void 0:t.message,c=s.audioMid,u=s.videoMid,d=s.sequenceId,e.subAudio=!0,d<e.sequenceId)return qB.print("subscribe4pushTrack","sequenceId return",d,e.sequenceId),[2];l=e.audioMid,h=e.videoMid,null===(i=e.observer)||void 0===i||i.setPushTrack(!0),y.label=1;case 1:return y.trys.push([1,7,,8]),l&&h?[4,null===(r=this._handler)||void 0===r?void 0:r.subscribe(e,{audioMid:l,videoMid:h})]:[3,3];case 2:return p=y.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(p=y.sent()))throw new lP(aP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");l=p.audioMid,h=p.videoMid,y.label=5;case 5:return(m={})[l]=c,m[h]=u,_=m,qB.print("onpushtrack midmap",e.userId,_),e.audioMid=c,e.videoMid=u,e.sequenceId=d,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),f=[],e.audioTrack||f.push(new Promise((function(t,i){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),JB);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(qB.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),v=function(t){e.ontrack(t)},null===(o=this._handler)||void 0===o||o.on("ontrack",v),this._ontrackCallbackMap.set(e,v),null===(a=this._handler)||void 0===a||a.handleAck({action:OB.pushtrack,streamId:e.streamId,audioMid:l,videoMid:h,stream:e,transceiverInit:null==p?void 0:p.transceiverInit,signalingAck:null==t?void 0:t.message}),[4,Promise.all(f)];case 6:return y.sent(),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 7:throw y.sent();case 8:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var i,r,n;return ef(this,void 0,void 0,(function(){return tf(this,(function(o){switch(o.label){case 0:return ZB("unsubscribe4removeTrack()",e),qB.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(qB.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):(null===(i=e.observer)||void 0===i||i.setPushTrack(!1),null===(r=this._handler)||void 0===r||r.handleAck({action:OB.removetrack,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e}),[4,null===(n=this._handler)||void 0===n?void 0:n.rollback(e.streamId,e)]));case 1:return o.sent(),this._subResolves[e.streamId]&&this._subResolves[e.streamId].forEach((function(e){return e(0)})),qB.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.unsubscribe=function(e,t,i){var r,n,o,a,s;return void 0===i&&(i=!1),ef(this,void 0,void 0,(function(){var c,u,d;return tf(this,(function(l){switch(l.label){case 0:return ZB("unsubscribe()",e),c=e.subMediaType-(e.subMediaType&t),i||!this._subConfig.muteReplaceUnsub&&c===MF.NONE?(u={roomId:this._roomId,streamId:e.streamId,userId:e.userId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unsubscribe",u),e.streamState=TB.INIT,this._subStreamQueue[e.streamId]&&(this._subStreamQueue[e.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[e.streamId]),e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(n=e.observer)||void 0===n||n.setSubscribeVideo(!1),e.subAudio?[3,3]:(null===(o=e.observer)||void 0===o||o.setSubscribeAudio(!1),[4,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:OB.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})])):[2,this._updateSubTrack(e,t,yB.UNSUB)];case 1:return d=l.sent(),[4,null===(s=this._handler)||void 0===s?void 0:s.rollback(e.streamId,e)];case 2:l.sent(),this._subResolves[d]&&this._subResolves[d].forEach((function(e){return e(0)})),qB.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),l.label=3;case 3:return[2]}}))}))},t.prototype.removeOnTrackListener=function(e){var t,i=this._ontrackCallbackMap.get(e);i&&(null===(t=this._handler)||void 0===t||t.off("ontrack",i),this._ontrackCallbackMap.delete(e))},t.prototype.handleRemoveStream=function(e,t){return ef(this,void 0,void 0,(function(){return tf(this,(function(i){return ZB("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==Gx.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,e.hasSubscribed?(this.unsubscribe(e,x_.AUDIO_AND_VIDEO,!0),[2]):[2]}))}))},t.prototype.leave=function(){var e;return ef(this,void 0,void 0,(function(){var t,i,r;return tf(this,(function(n){switch(n.label){case 0:return qB.print("leave()"),this.connectionState!==XB.CONNECTED?[3,7]:(this.connectionState=XB.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]);case 1:i=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("leaveRoom",t)];case 3:return n.sent(),this.connectionState=XB.DISCONNECTED,[3,6];case 4:throw r=n.sent(),this.connectionState=XB.CONNECTED,r;case 5:return i(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new lP(aP.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,i,r,n;return ef(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,_,f,v,m,S=this;return tf(this,(function(y){switch(y.label){case 0:return[4,null===(t=this._handler)||void 0===t?void 0:t.subscribe(e)];case 1:if(!(o=y.sent()))throw new lP(aP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return a=KD(),s=o.audioMid,c=o.videoMid,u={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:s,videoMid:c,sdpInfo:{sdp:null==o?void 0:o.partialSdp,semantics:null==o?void 0:o.semantics,type:null==o?void 0:o.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("startPullStream",u)];case 2:return d=y.sent(),l=[],this._subResolves[e.streamId]=[],l.push(new Promise((function(t,i){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),JB);e.on("ontrack",(function i(n){"video"===n.mediaType&&(qB.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),l.push(new Promise((function(t,i){S._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),JB);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(qB.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),h=function(t){e.ontrack(t)},null===(r=this._handler)||void 0===r||r.on("ontrack",h),this._ontrackCallbackMap.set(e,h),p=null==d?void 0:d.relayMessage,_=p.audioMid,f=p.videoMid,v=p.sequenceId,m=p.sdp,e.videoMid=f,e.audioMid=_,e.sequenceId=v,e._workaround_1_=!1,e.paused=!1,e.streamState=TB.SUB_ED,e.subAudio=!0,e.subVideo=!0,null===(n=this._handler)||void 0===n||n.handleAck({action:OB.subscribe,streamId:e.streamId,audioMid:s,videoMid:c,transceiverInit:null==o?void 0:o.transceiverInit,signalingAck:{audioMid:_,videoMid:f,sdp:m,sequenceId:v},stream:e}),[4,Promise.all(l)];case 3:return y.sent(),this.monitor.rtcSubscribeStat(zL.SUCCESS,a,KL.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n;return tf(this,(function(o){switch(o.label){case 0:ZB("unsubscribePublicStream()",e),n={appId:this._appId,streamId:e.streamId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("stopPullStream",n)];case 2:case 3:return o.sent(),[3,4];case 4:return e.streamState=TB.INIT,e.subVideo=!1,e.subAudio=!1,null===(i=this._handler)||void 0===i||i.handleAck({action:OB.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e}),[4,null===(r=this._handler)||void 0===r?void 0:r.rollback(e.streamId,e)];case 5:return o.sent(),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.destroy=function(){var e,t,i;qB.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,this._context=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(i=this._iceConfigRequestManager)||void 0===i||i.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState=XB.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=function(e,t){var i;return null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})},t.prototype.sendRoomMessage=function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)},t.prototype._multiChatMode=function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode},Object.defineProperty(t.prototype,"handler",{get:function(){return this._handler},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomAttributes",{get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),$_([ij],t.prototype,"join",null),$_([tj,ej],t.prototype,"publish",null),$_([tj,ej],t.prototype,"updatePubTrack",null),$_([tj,ej],t.prototype,"unpublish",null),$_([tj,ej],t.prototype,"subscribe",null),$_([ej],t.prototype,"controlMessage",null),$_([ej],t.prototype,"updateUserAttributes",null),$_([ej],t.prototype,"updateSubTrack",null),$_([ej],t.prototype,"subscribe4pushTrack",null),$_([ej],t.prototype,"unsubscribe4removeTrack",null),$_([tj,ej],t.prototype,"unsubscribe",null),$_([ej],t.prototype,"handleRemoveStream",null),$_([tj],t.prototype,"subscribePublicStream",null),$_([tj],t.prototype,"unsubscribePublicStream",null),t}(wk);function ej(e,t,i){var r=i.value;return i.value=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return ef(this,void 0,void 0,(function(){return tf(this,(function(i){switch(i.label){case 0:return this._handler&&this._state===XB.CONNECTED?[4,r.apply(this,e)]:[3,2];case 1:return i.sent(),[3,3];case 2:throw new lP(aP.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},i}function tj(e,t,i){var r=i.value;return i.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){switch(i.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=i.sent(),this.supportConcurrent&&t(),i.label=2;case 2:return i.trys.push([2,,4,5]),[4,r.apply(this,e)];case 3:return[2,i.sent()];case 4:return this.supportConcurrent||t(),[7];case 5:return[2]}}))}))},i}function ij(e,t,i){var r=i.value;return i.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(n){return t=!1,[2,new Promise((function(n,o){return ef(i,void 0,void 0,(function(){var i,a;return tf(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new lP(aP.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.apply(this,e)];case 2:return i=s.sent(),n(i),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},i}!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(QB||(QB={}));var rj,nj=function(){function e(e,t){this._audioEventSessionId=ek(),this._videoEventSessionId=ek(),this._isScreen=!1,this._audioFirstFrameState=QB.INITIAL,this._videoFirstFrameState=QB.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:qL.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:qL.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._publishVideo=!1,this._publishAudio=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._stream=e,this._handler=t,this.getTransportDelay()}return e.prototype.beginRecvFrame=function(e,t){var i,r,n,o,a;return ef(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,_=this;return tf(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:return f.sent(),s=this._transportDelay,c=!0,u=qL.LOGIN,d=qL.UNMUTE,l=qL.SUBSCRIBE,h=qL.PUSH_TRACK,[u,d,l,h].indexOf(t)>=0&&(s=0,c=!1),e===YL.AUDIO?(c||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},p={media_type:e,event_type:XL.BEGIN_RECV,type:t,start:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,transport_delay:s},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){_.stopRecvFrame(YL.AUDIO,JL.TIMEOUT),_._firstAudioFrameInterval&&window.clearInterval(_._firstAudioFrameInterval)}),this._timeout),fx.rtcFirstFrame(p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=QB.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===YL.VIDEO&&(c||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t},p={media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?YL.SCREEN_VIDEO:e,event_type:XL.BEGIN_RECV,type:t,start:null===(o=this._currentVideoRecv)||void 0===o?void 0:o.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(a=this._stream)||void 0===a?void 0:a.userId,transport_delay:s},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){_.stopRecvFrame(YL.VIDEO,JL.TIMEOUT),_._firstVideoFrameInterval&&window.clearInterval(_._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),fx.rtcFirstFrame(p),this._videoFirstFrameState=QB.BEGIN,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0),[2]}}))}))},e.prototype.stopRecvFrame=function(e,t){var i,r,n,o,a,s,c;if(e===YL.AUDIO){if(this._audioFirstFrameState!==QB.BEGIN)return;var u={event_type:XL.RECV_END,media_type:e,start:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.startTime,reason:t,result:!1,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,fx.rtcFirstFrame(u),this._audioFirstFrameState=QB.STOPPED}else if(e===YL.VIDEO){if(this._videoFirstFrameState!==QB.BEGIN)return;u={event_type:XL.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?YL.SCREEN_VIDEO:e,start:null===(a=this._currentVideoRecv)||void 0===a?void 0:a.startTime,reason:t,result:!1,stream_user_id:null===(s=this._stream)||void 0===s?void 0:s.userId,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,fx.rtcFirstFrame(u),this._videoFirstFrameState=QB.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p;return tf(this,(function(_){switch(_.label){case 0:return[4,this.getTransportDelay()];case 1:if(_.sent(),n=this._transportDelay,o=qL.LOGIN,a=qL.UNMUTE,s=qL.SUBSCRIBE,c=qL.PUSH_TRACK,e===YL.AUDIO){if(this._audioFirstFrameState!==QB.BEGIN)return[2];if(!this._currentAudioRecv)return[2];u=this._currentAudioRecv,l=u.type,h=u.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:XL.RECV_END,media_type:e,start:h,result:!0,stream_user_id:null===(t=this._stream)||void 0===t?void 0:t.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:n},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),fx.rtcFirstFrame(p),this._audioFirstFrameState=QB.RECEIVED}else if(e===YL.VIDEO){if(this._videoFirstFrameState!==QB.BEGIN)return[2];if(!this._currentVideoRecv)return[2];d=this._currentVideoRecv,l=d.type,h=d.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:XL.RECV_END,media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?YL.SCREEN_VIDEO:e,start:h,result:!0,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,event_session_id:this._videoEventSessionId,type:l,transport_delay:n},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),fx.rtcFirstFrame(p),this._videoFirstFrameState=QB.RECEIVED}return[2]}}))}))},e.prototype.setLogin=function(e,t){var i,r,n,o;void 0===t&&(t={audio:!0,video:!0}),this._login!==e&&(this._login=e,e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&t.audio&&this.beginRecvFrame(YL.AUDIO,qL.LOGIN),e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&t.video&&this.beginRecvFrame(YL.VIDEO,qL.LOGIN),!e&&(null===(n=this._stream)||void 0===n?void 0:n.hasAudio)&&this.stopRecvFrame(YL.AUDIO,JL.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(YL.VIDEO,JL.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(YL.AUDIO,qL.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(YL.AUDIO,JL.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(YL.AUDIO,qL.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(YL.AUDIO,JL.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(YL.AUDIO,qL.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(YL.AUDIO,JL.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(YL.VIDEO,qL.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(YL.VIDEO,JL.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(YL.VIDEO,qL.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(YL.VIDEO,JL.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(YL.VIDEO,qL.ENABLE):this.stopRecvFrame(YL.VIDEO,JL.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal=e},e.prototype.setPushAudio=function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(YL.AUDIO,qL.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(YL.AUDIO,qL.PUSH)},e.prototype.setExternalVideoSource=function(e){this._videoExternal=e},e.prototype.setPushVideo=function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(YL.VIDEO,qL.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(YL.VIDEO,qL.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(YL.VIDEO,qL.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(YL.VIDEO,JL.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(YL.AUDIO,qL.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(YL.AUDIO,JL.UNPUBLISH)},e.prototype.setAutoSubscribe=function(e){this._autoSubscribe=e},e.prototype.setAutoSubscribeVideo=function(e){this._autoSubscribeVideo=e},e.prototype.setAutoSubscribeAudio=function(e){this._autoSubscribeAudio=e},e.prototype.setSubscribeAudio=function(e){var t,i;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(YL.AUDIO,qL.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&this.stopRecvFrame(YL.AUDIO,JL.UNSUBSCRIBE)},e.prototype.setSubscribeVideo=function(e){var t,i;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(YL.VIDEO,qL.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasVideo)&&this.stopRecvFrame(YL.VIDEO,JL.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(YL.AUDIO,qL.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(YL.AUDIO,JL.REMOVE_TRACK))},e.prototype.setMultiChatMode=function(e){this._multiChatMode=e},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype._watchForFirstVideoFrameRecv=function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval((function(){return ef(e,void 0,void 0,(function(){var e,i,r,n,o,a,s,c;return tf(this,(function(u){switch(u.label){case 0:return(null===(r=this._handler)||void 0===r?void 0:r.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())?[4,AV(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.videoTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(i=e.find((function(e){return"inbound-rtp"===e.type})))&&i.framesReceived>t){if(-1===t)return t=i.framesReceived,[2];this.recvFrameFinish(YL.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype._watchForFirstAudioFrameRecv=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return ef(e,void 0,void 0,(function(){var e,i,r,n,o,a,s,c;return tf(this,(function(u){switch(u.label){case 0:return(null===(r=this._handler)||void 0===r?void 0:r.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())?[4,AV(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.audioTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(i=e.find((function(e){return"inbound-rtp"===e.type})))&&i.totalSamplesReceived>t){if(-1===t)return t=i.totalSamplesReceived,[2];this.recvFrameFinish(YL.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype.getTransportDelay=function(){return ef(this,void 0,void 0,(function(){var e=this;return tf(this,(function(t){switch(t.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return t.sent(),window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval((function(){return ef(e,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return e.sent(),[2]}}))}))}),2e3),[2]}}))}))},e.prototype.getTransportDelayIntl=function(){var e,t;return ef(this,void 0,void 0,(function(){var i,r,n;return tf(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,AV(null===(t=this._handler)||void 0===t?void 0:t.pc)]:[3,2];case 1:i=o.sent(),r=i.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(n=i.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==r?void 0:r.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*n.currentRoundTripTime/2)),o.label=2;case 2:return[2]}}))}))},e.prototype.reset=function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:qL.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:qL.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._transportDelayInterval&&window.clearInterval(this._transportDelayInterval)},e}();!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.SENT=3]="SENT"}(rj||(rj={}));var oj,aj,sj,cj,uj=function(){function e(e,t){this._audioEventSessionId=ek(),this._videoEventSessionId=ek(),this._currentAudioSend={startTime:0,eventSessionId:0,type:qL.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:qL.LOGIN},this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._timeout=1e4,this._audioFirstFrameState=rj.INITIAL,this._videoFirstFrameState=rj.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var i,r,n,o=this;if(e===YL.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:XL.BEGIN_SEND,type:t,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){o.stopSendFrame(YL.AUDIO,JL.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),fx.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=rj.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===YL.VIDEO){this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};a={media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?YL.SCREEN_VIDEO:e,event_type:XL.BEGIN_SEND,type:t,start:null===(n=this._currentVideoSend)||void 0===n?void 0:n.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){o.stopSendFrame(YL.VIDEO,JL.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),fx.rtcFirstFrame(a),this._videoFirstFrameState=rj.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}},e.prototype.stopSendFrame=function(e,t){var i,r,n,o,a;if(e===YL.AUDIO){if(this._audioFirstFrameState!==rj.BEGIN)return;var s={event_type:XL.SENT_END,media_type:e,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(r=this._currentAudioSend)||void 0===r?void 0:r.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,fx.rtcFirstFrame(s),this._audioFirstFrameState=rj.STOPPED}else if(e===YL.VIDEO){if(this._videoFirstFrameState!==rj.BEGIN)return;s={event_type:XL.SENT_END,media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?YL.SCREEN_VIDEO:e,start:null===(o=this._currentVideoSend)||void 0===o?void 0:o.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(a=this._currentVideoSend)||void 0===a?void 0:a.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,fx.rtcFirstFrame(s),this._videoFirstFrameState=rj.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===YL.AUDIO){if(this._audioFirstFrameState!==rj.BEGIN)return;if(!this._currentAudioSend)return;var i=this._currentAudioSend,r=i.type,n=i.startTime,o={event_type:XL.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:r};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),fx.rtcFirstFrame(o),this._audioFirstFrameState=rj.SENT}else if(e===YL.VIDEO){if(this._videoFirstFrameState!==rj.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;r=a.type,n=a.startTime,o={event_type:XL.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?YL.SCREEN_VIDEO:e,start:n,result:!0,event_session_id:this._videoEventSessionId,type:r};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),fx.rtcFirstFrame(o),this._videoFirstFrameState=rj.SENT}},e.prototype.setLogin=function(e){var t,i;this._login!==e&&(this._login=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(YL.VIDEO,qL.LOGIN),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(YL.AUDIO,qL.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(YL.AUDIO,JL.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(YL.VIDEO,JL.LEAVE_ROOM))},e.prototype.setPublish=function(e){var t,i;this._publish!==e&&(this._publish=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(YL.VIDEO,qL.PUBLISH),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(YL.AUDIO,qL.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(YL.AUDIO,JL.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(YL.VIDEO,JL.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(YL.AUDIO,qL.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(YL.AUDIO,JL.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(YL.AUDIO,qL.ENABLE),!e&&this._audioSending&&this.stopSendFrame(YL.AUDIO,JL.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(YL.VIDEO,qL.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(YL.VIDEO,JL.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(YL.VIDEO,qL.ENABLE),!e&&this._videoSending&&this.stopSendFrame(YL.VIDEO,JL.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(YL.AUDIO,JL.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(YL.AUDIO,JL.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(YL.AUDIO,qL.PUSH),!e&&this._audioSending&&this.stopSendFrame(YL.AUDIO,JL.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(YL.VIDEO,JL.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(YL.VIDEO,JL.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(YL.VIDEO,qL.PUSH),!e&&this._videoSending&&this.stopSendFrame(YL.VIDEO,JL.STOP_PUSH))},e.prototype.setAutoPublish=function(e){this._autoPublish=e},e.prototype.setPublisher=function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(YL.AUDIO,JL.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(YL.VIDEO,JL.AUDIENCE))},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype.setPCSessionId=function(e){this._pcSessionId=e},e.prototype.setHandler=function(e){this._handler=e},e.prototype._getFirstVideoFrameStats=function(){var e,t,i,r,n,o;return ef(this,void 0,void 0,(function(){var a;return tf(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(i=null===(t=this._stream)||void 0===t?void 0:t.videoTrack)||void 0===i?void 0:i.getTrack())?[4,AV(null===(r=this._handler)||void 0===r?void 0:r.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._getFirstAudioFrameStats=function(){var e,t,i,r,n,o;return ef(this,void 0,void 0,(function(){var a;return tf(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(i=null===(t=this._stream)||void 0===t?void 0:t.audioTrack)||void 0===i?void 0:i.getTrack())?[4,AV(null===(r=this._handler)||void 0===r?void 0:r.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._watchForFirstVideoFrameSend=function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval((function(){return ef(e,void 0,void 0,(function(){var e;return tf(this,(function(i){switch(i.label){case 0:return[4,this._getFirstVideoFrameStats()];case 1:if((e=i.sent())&&e.framesSent>t){if(-1===t)return t=e.framesSent,[2];this.sendFrameFinish(YL.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}return[2]}}))}))}),100)},e.prototype._watchForFirstAudioFrameSend=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return ef(e,void 0,void 0,(function(){var e;return tf(this,(function(i){switch(i.label){case 0:return[4,this._getFirstAudioFrameStats()];case 1:if((e=i.sent())&&e.packetsSent>t){if(-1===t)return t=e.packetsSent,[2];this.sendFrameFinish(YL.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}return[2]}}))}))}),100)},e.prototype.reset=function(){this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._audioFirstFrameState=rj.INITIAL,this._videoFirstFrameState=rj.INITIAL,this._currentAudioSend={startTime:0,eventSessionId:0,type:qL.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:qL.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)},e.prototype.destroy=function(){this.reset(),delete this._stream,delete this._handler},Object.defineProperty(e.prototype,"_audioSending",{get:function(){return this._audioFirstFrameState===rj.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===rj.BEGIN},enumerable:!1,configurable:!0}),e}();!function(e){e[e.UNKOWN=0]="UNKOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(aj||(aj={})),function(e){e[e.INVALID=0]="INVALID",e[e.GOOD=1]="GOOD",e[e.MEDIUM=2]="MEDIUM",e[e.POOR=3]="POOR"}(sj||(sj={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(cj||(cj={}));var dj=((oj={})[cj.AUDIO]={delay:1200,stallRadio:.3},oj[cj.VIDEO]={delay:1200,stallRadio:.6},oj[cj.SCREEN_AUDIO]={delay:1600,stallRadio:.8},oj[cj.SCREEN_VIDEO]={delay:1600,stallRadio:.8},oj),lj=function(){function e(){this._preUplinkStats=new Map,this._preDownlinkStats=new Map,this._connectionState=XB.CONNECTED}return e.prototype.updateUplinkStats=function(e){var t=e.audioStats,i=e.videoStats,r=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var n=r?cj.SCREEN_AUDIO:cj.AUDIO,o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,of(of([],nf(u),!1),[c],!1).slice(-2))}if(i.sentKBitrate>0&&i.rtt){n=r?cj.SCREEN_VIDEO:cj.VIDEO,o=i.rtt,a=i._fractionLost;i.videoLossRate;var d=i._sendBandWidth;s=i._retransmittedRate;0===d&&(a=Math.max(.65,a));c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,of(of([],nf(u),!1),[c],!1).slice(-2))}this._startNetworkQualityReport()},e.prototype.updateDownlinkStats=function(e,t){if(t){var i,r,n=this._getStreamActiveState(t),o=n.audioActive,a=n.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId;if(o&&s.rtt)if(0===s.receivedKBitrate)i=X_.VBAD;else{var l=s.rtt,h=s.audioLossRate,p=s.stallDuration,_=s.statsInterval,f=s.e2eDelay,v=p/_,m=u?cj.SCREEN_AUDIO:cj.AUDIO,S=this._getQosLevel(l,h||0,c._retransmittedRate||0),y=this._getDownlinkQoE(m,v,f);i=this._getNetworkQuality(S,y)}if(a)if(0===c.receivedKBitrate||0===c.rtt)r=X_.VBAD;else{l=c.rtt;var g=c.videoLossRate,E=(p=c.stallDuration,_=c.statsInterval,f=c.e2eDelay,c._retransmittedRate);v=p/_,m=u?cj.SCREEN_VIDEO:cj.VIDEO,S=this._getQosLevel(l,g||0,E||0),y=this._getDownlinkQoE(m,v,f);r=this._getNetworkQuality(S,y)}var b=i&&r?Math.ceil((i+r)/2):i||r;if(b){var T="".concat(d).concat(u?"_screen":""),I=this._preDownlinkStats.get(T)||[b];this._preDownlinkStats.set(T,of(of([],nf(I),!1),[b],!1).slice(-2)),this._startNetworkQualityReport()}}},e.prototype.setConnectionState=function(e){this._connectionState=e},e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()},e.prototype._startNetworkQualityReport=function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))},e.prototype._reportNetworkQuality=function(){var e,t,i=this;if(this._connectionState!==XB.CONNECTED)e=t=X_.VBAD;else{var r=this._getBetterQualityAndRemoveOldest(cj.AUDIO,"up"),n=this._getBetterQualityAndRemoveOldest(cj.VIDEO,"up");e=r&&n?Math.ceil((r+n)/2):r||n||this._getBetterQualityAndRemoveOldest(cj.SCREEN_VIDEO,"up")||this._getBetterQualityAndRemoveOldest(cj.SCREEN_AUDIO,"up")||X_.UNKNOWN;var o=Array.from(this._preDownlinkStats.keys()).map((function(e){return i._getBetterQualityAndRemoveOldest(e,"down")})).filter((function(e){return e}));t=Math.ceil(o.reduce((function(e,t){return t+e}),0)/o.length)||X_.UNKNOWN}this.reportor&&this.reportor(e,t)},e.prototype._getNetworkQuality=function(e,t){return t===sj.GOOD?Math.max(e-2,1):t===sj.MEDIUM?e:Math.min(e+1,5)},e.prototype._getQosLevel=function(e,t,i){var r;return r=e<=250&&t<=.15?aj.EXCELLENT:e<=500&&t<=.3?aj.GOOD:e<=750&&t<=.45?aj.POOR:e<=1e3&&t<=.6?aj.BAD:aj.VBAD,i>.5?r=Math.max(r,aj.BAD):i>.35?r=Math.max(r,aj.POOR):i>.15&&(r=Math.max(r,aj.GOOD)),r},e.prototype._getUplinkQoE=function(e,t){var i=sj.INVALID;switch(e){case cj.AUDIO:case cj.VIDEO:i=t<.05?sj.GOOD:t<.1?sj.MEDIUM:sj.POOR;break;case cj.SCREEN_VIDEO:case cj.SCREEN_AUDIO:i=t<.04?sj.GOOD:t<.08?sj.MEDIUM:sj.POOR}return i},e.prototype._getDownlinkQoE=function(e,t,i){var r=dj[e];return t>r.stallRadio||i>r.delay||t>r.stallRadio/2&&i>r.delay/2?sj.POOR:(t>r.stallRadio/2||r.delay,sj.MEDIUM)},e.prototype._getBetterQualityAndRemoveOldest=function(e,t){var i=X_.UNKNOWN,r="up"===t?this._preUplinkStats:this._preDownlinkStats,n=r.get(e);if(n){var o=n.filter((function(e){return e}));o.length>0&&(i=Math.min.apply(Math,of([],nf(o),!1))),n.shift(),0===n.length&&r.delete(e)}return i},e.prototype._getStreamActiveState=function(e){var t=e.subMediaType,i=e._attributes,r=e.subVideo;return{audioActive:e.subAudio&&ak(t)&&i.localaudio&&i.audiostream,videoActive:r&&sk(t)&&i.localvideo&&i.videostream}},e}(),hj=function(){function e(e){this._room=e,this._remoteVideoSizeCache={},this._remoteScreenSizeCache={},this._start()}return e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}},e.prototype._start=function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},i={};e._room.remoteStreams.forEach((function(r,n){r.forEach((function(r){var o,a=null===(o=r.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=r.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[n]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,p=a.getSettings(),_=p.width,f=void 0===_?0:_,v=p.height,m=void 0===v?0:v;h===m&&d===f||e.onchange&&e.onchange(n,r.isScreen,f,m),delete s[n],(r.isScreen?i:t)[n]={width:f,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=i}),1e3))},e}(),pj=ba.every;Wr({target:"Array",proto:!0,forced:!jn("every")},{every:function(e){return pj(this,e,arguments.length>1?arguments[1]:void 0)}});var _j=new Ck("SubscribeFallbackManager",2),fj=1e4,vj=function(){function e(e){this._room=e,this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,this._inSubscribeRecoverChecking=!1,this._forbidSubRecover=!1,this._forbidSubRecoverDuration=fj}return e.prototype.updateNetworkQuality=function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===X_.BAD||e===X_.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*X_.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===X_.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")},e.prototype.destroy=function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback},e.prototype._subscribeFallbackOrRecover=function(e){return ef(this,void 0,void 0,(function(){var t,i,r,n,o,a,s,c,u,d=this;return tf(this,(function(l){switch(l.label){case 0:if(this._isSubscribeFallbackOrRecover||this._room.connectionState!==XB.CONNECTED)return[2];if(this._room.subscribeFallbackOption!==K_.AUDIO_ONLY&&this._room.subscribeFallbackOption!==K_.VIDEO_STREAM_LOW)return[3,5];if(t=new Map,this._room.remoteStreams.forEach((function(i){i.forEach((function(i){if(i.hasSubscribed){var r="fallback"===e?i.getSubscribeFallbackParams(d._room.subscribeFallbackOption):i.getSubscribeRecoverParams();if(r){var n=i.getStreamPriority(),o=t.get(n)||[];o.push({stream:i,fallbackOrRecoverOption:r}),t.set(n,o)}}}))})),!(t.size>0))return[3,5];if(_j.print("_subscribeFallbackOrRecover()","start subscribe ".concat(e,".")),i=Array.from(t.keys()).sort((function(e,t){return e-t}))["fallback"===e?0:t.size-1],r=nf(t.get(i)||[],1),!(n=r[0]))return[3,5];o=n.stream,a=n.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,s=o.subLayer.spatialLayer,c=o.subVideo,_j.print("_subscribeFallbackOrRecover()","".concat(o.userId,"'s stream will be ").concat(e," to: MediaType=").concat(a[0]," subState=").concat(a[1]," subLayer=").concat(a[2])),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,nk([(u=this._room).updateSubTrack.apply(u,of([o],nf(a),!1)).then((function(){"recover"===e?d._startSubscribeRecoverCheck():_j.print("_subscribeFallbackOrRecover()","fallback success."),d.onSubscribeFallback&&d.onSubscribeFallback({userId:o.userId,isScreen:o.isScreen,beforeEnable:c,beforeVideoIndex:s,afterEnable:o.subVideo,afterVideoIndex:o.subLayer.spatialLayer,reason:"fallback"===e?Y_.SubscribeFallbackByBandwidth:Y_.SubscribeRecoverByBandwidth})})),(h=2e3,new Promise((function(e){window.setTimeout(e,h)})))])];case 2:case 3:return l.sent(),[3,4];case 4:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,l.label=5;case 5:return[2]}var h}))}))},e.prototype._startSubscribeRecoverCheck=function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=fj,delete e._subRecoverCheckTimer,_j.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)},e.prototype._stopSubscribeRecoverCheck=function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1},e.prototype._startForbidSubRecover=function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),_j.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)},e.prototype._stopForbidSubRecover=function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)},e}(),mj=new Ck("Room",1),Sj=function(e){function t(t,i){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._waitForNewToken=!1,r._userDuplicateLoginTimerMap=new Map,r._hasPublished=!1,r._roomConfig=t,r._mediaServerClient=new $B(i),r._reconnectRecord=new yj,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new lj,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(r),r._videoSizeObserver=new hj(r),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(r),r._subFallbackManager=new vj(r),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(r),r._context=i,r}return A_(t,e),Object.defineProperty(t.prototype,"hasScreenPublished",{get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasPublished",{get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._mediaServerClient.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){return this._remoteUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){return this._remoteStreams},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localStream",{get:function(){return this._localStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenStream",{get:function(){return this._localScreenStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomInfo",{get:function(){return this._roomInfo},enumerable:!1,configurable:!0}),t.prototype._addHandlerEventHandler=function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T=this;null===(e=this._mediaServerClient)||void 0===e||e.on(zx.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(zx.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(zx.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(zx.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(zx.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(zx.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(zx.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(zx.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(zx.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(zx.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(zx.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(zx.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(zx.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(zx.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(zx.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(zx.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(Kx.RSCP,this._onPublishOnDemand.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(Wx.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(Wx.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on("onRemoteStreamStats",(function(e){T._networkQualityManager.updateDownlinkStats(e,T._findRemoteStreamByScreen(e.userId,e.isScreen)),T.emit(fB.ON_REMOTE_STREAM_STATS,ck(e))})),null===(g=this._mediaServerClient)||void 0===g||g.on("onLocalStreamStats",(function(e){T._networkQualityManager.updateUplinkStats(e),T.emit(fB.ON_LOCAL_STREAM_STATS,ck(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e})),null===(b=this._mediaServerClient)||void 0===b||b.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,i,r,n,o){return ef(this,void 0,void 0,(function(){var a=this;return tf(this,(function(s){return Sx.setStats({rtc_app_id:e,room_id:t,user_id:r.userId}),mj.print("join()"),[2,new Promise((function(s,c){return ef(a,void 0,void 0,(function(){var a,u,d=this;return tf(this,(function(l){return this._joinResolveCallback=function(e){var t;fx.joinRoom($L.END,a,!0,"",{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)},this._joinRejectCallback=function(e){var t;fx.joinRoom($L.END,a,!1,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)},this._liveControlMessage=n,this._roomInfo={appId:e,roomId:t,token:i,userInfo:r,useCloudProxy:o,roomProfile:this._roomConfig.roomProfileType},a=KD(),this.setSessionId(),fx.joinRoom($L.BEGIN,a,!1,"",{enable_cloud_proxy:null===(u=this._roomInfo)||void 0===u?void 0:u.useCloudProxy}),this._join(this._joinResolveCallback,this._joinRejectCallback,!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,i){return void 0===i&&(i=!1),ef(this,void 0,void 0,(function(){var r,n,o;return tf(this,(function(a){switch(a.label){case 0:r=KD(),mj.print("_join()"),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},i,this._liveControlMessage)];case 2:return n=a.sent(),this._mediaServerClient.roomAttributes=n.roomAttributes,this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e({users:n.clients,streams:n.streams}),this._isReconnecting=!1,fx.rtcJoinRoom(0,"web","web",KD()-r),this._onJoinSucc(n,i),[3,4];case 3:return(o=a.sent()).code!==aP.OPERATION_CANCEL&&"function"==typeof t?[2,t(o)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,i,r,n){var o,a,s,c,u,d;return ef(this,void 0,void 0,(function(){var l,h,p,_;return tf(this,(function(f){switch(f.label){case 0:return mj.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new wB,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new uj(this._localScreenStream,this._mediaServerClient.handler))),l=!1,h=!1,p=!1,_=!1,!this._localScreenStream.videoTrack&&t?(t instanceof eB&&(h=!0),l=!0):this._localScreenStream.videoTrack&&!t&&(l=!1),!this._localScreenStream.audioTrack&&i?(i instanceof tB&&(_=!0),p=!0):this._localScreenStream.audioTrack&&!i&&(p=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=i,this._localScreenStream.videoEncodeConfig=e,r&&(ak(r)&&(this._localScreenStream.pubAudio=n===SB.PUB),sk(r)&&(this._localScreenStream.pubVideo=n===SB.PUB),mj.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo?this._localScreenStream.hasPublished?[3,2]:(null===(a=this._localScreenStream.observer)||void 0===a||a.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]):(null===(o=this._localScreenStream)||void 0===o?void 0:o.hasPublished)?[2,this.unpublishScreen()]:[2];case 1:return f.sent(),[3,4];case 2:return h?null===(s=this._localScreenStream.observer)||void 0===s||s.setPushVideo(l):null===(c=this._localScreenStream.observer)||void 0===c||c.setEnableVideo(l),_?null===(u=this._localScreenStream.observer)||void 0===u||u.setPushAudio(p):null===(d=this._localScreenStream.observer)||void 0===d||d.setEnableAudio(p),[4,this.updatePubScreenTrack()];case 3:f.sent(),f.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return mj.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),this._localScreenStream?[4,this._mediaServerClient.updatePubTrack(this._localScreenStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublishScreen=function(){var e;return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return mj.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?(null===(e=this._localScreenStream.observer)||void 0===e||e.setPublish(!1),[4,this._mediaServerClient.unpublish(this._localScreenStream)]):[3,2];case 1:t.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,t.label=2;case 2:return[2]}}))}))},t.prototype.liveControlMessage=function(e){var t;return ef(this,void 0,void 0,(function(){var i=this;return tf(this,(function(r){switch(r.label){case 0:return mj.print("controlMessage","Invoke controlMessage"),null===(t=e.transcodeMeta)||void 0===t||t.layout.regions.forEach((function(e){i.roomInfo&&(e.roomID=i.roomInfo.roomId)})),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return r.sent(),"stopped"===e.action&&delete this._liveControlMessage,[2]}}))}))},t.prototype.publicStreamControlMessage=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return"stopped"===e.action&&delete e.publicStreamMeta,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return mj.print("updateUserAttributes","Invoke updateUserAttributes"),e.role&&this._roomInfo&&(this._roomInfo.userInfo.role=e.role),[4,this._mediaServerClient.updateUserAttributes(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.publish=function(e,t,i,r,n,o,a){var s,c,u,d,l,h;return void 0===a&&(a=!1),ef(this,void 0,void 0,(function(){var p,_,f,v,m,S;return tf(this,(function(y){switch(y.label){case 0:if(mj.print("publish","Invoke publish"),p=!1,this._localStream||(this._localStream=new wB,this._mediaServerClient.handler&&(this._localStream.observer=new uj(this._localStream,this._mediaServerClient.handler)),p=!0),this._localStream.videoTrack=i,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.enableSimulcast=t,n&&(ak(n)&&(this._localStream.pubAudio=o===SB.PUB),sk(n)&&(this._localStream.pubVideo=o===SB.PUB),mj.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished)return[3,5];if(!this._localStream.pubAudio&&!this._localStream.pubVideo)return[2];y.label=1;case 1:return y.trys.push([1,3,,4]),a?null===(s=this._localStream.observer)||void 0===s||s.setLogin(!0):p&&(_=!!this._localStream.videoTrack,f=!!this._localStream.audioTrack,v=this._localStream.videoTrack instanceof eB,m=this._localStream.audioTrack instanceof tB,this._roomConfig.isAutoPublish&&!this._hasPublished?(_&&(v?null===(c=this._localStream.observer)||void 0===c||c.setPushVideo(!0):null===(u=this._localStream.observer)||void 0===u||u.setEnableVideo(!0)),f&&(m?null===(d=this._localStream.observer)||void 0===d||d.setPushAudio(!0):null===(l=this._localStream.observer)||void 0===l||l.setEnableAudio(!0))):null===(h=this._localStream.observer)||void 0===h||h.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return y.sent(),this._hasPublished=!0,this.emit(fB.ON_PUBLISH_RESULT,{isScreen:!1,state:k_.PUBLISH_SUCC}),[3,4];case 3:throw S=y.sent(),this.emit(fB.ON_PUBLISH_RESULT,{isScreen:!1,state:k_.PUBLISH_FAIL}),S;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:y.sent(),y.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return mj.print("updatePubTrack","Invoke updatePubTrack"),this._localStream?[4,this._mediaServerClient.updatePubTrack(this._localStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublish=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return mj.print("unpublish","Invoke unpublish"),this._localStream?[4,this._mediaServerClient.unpublish(this._localStream)]:[3,2];case 1:e.sent(),this._localStream.clean(),this._localStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.subscribe=function(e,t,i){return ef(this,void 0,void 0,(function(){var r;return tf(this,(function(n){switch(n.label){case 0:return mj.print("subscribe","remoteStream %o",e),r=void 0,i&&(r=this._getSubLayer(i,e)),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,i,r){var n;return ef(this,void 0,void 0,(function(){return tf(this,(function(o){return mj.print("updateSubTrack","Invoke updateSubTrack"),[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(e,t,i,r)]}))}))},t.prototype.updateSubVideoConfig=function(e,t){var i,r,n;return ef(this,void 0,void 0,(function(){var o,a;return tf(this,(function(s){return!(o=this._findRemoteStreamByScreen(e,!1))||!o.hasSubscribed||(null===(r=null===(i=null==o?void 0:o.attributes)||void 0===i?void 0:i.videoDescriptions)||void 0===r?void 0:r.length)<=1?[2]:(a=this._getSubLayer(t,o),o.originalStreamIndex=a.spatialLayer,[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(o,o.subMediaType,yB.SUB,a)])}))}))},t.prototype._getSubLayer=function(e,t){for(var i,r,n,o,a,s=null==t?void 0:t.attributes,c=s.videoDescriptions,u=s.subVideoDescriptions,d=Array.isArray(u)?u:c,l=-1,h=e.width*e.height,p=0;p<(null==d?void 0:d.length);p++)if(h>=(null===(i=d[p])||void 0===i?void 0:i.width)*(null===(r=d[p])||void 0===r?void 0:r.height)){l=p;break}var _=d[0];if(-1===l)_=d[l=d.length-1];else if(0!==l){var f=d[l-1].width*d[l-1].height,v=(f-h)/(f-d[l].width*d[l].height);_=v<.1?d[l-1]:d[l],l=v<.1?l-1:l}return a=null!==(n=null==_?void 0:_.sub_index)&&void 0!==n?n:-1,{spatialLayer:null!==(o=null==_?void 0:_.video_index)&&void 0!==o?o:l,spatialSubLayer:a}},t.prototype.unsubscribe=function(e,t){return ef(this,void 0,void 0,(function(){return tf(this,(function(i){switch(i.label){case 0:return mj.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e,t)];case 1:return i.sent(),[2]}}))}))},t.prototype.leave=function(e){var t;return void 0===e&&(e=!1),ef(this,void 0,void 0,(function(){var i,r,n,o,a,s,c;return tf(this,(function(u){switch(u.label){case 0:mj.print("leave","Invoke leave"),i=KD(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(r=rf(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())o=n.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(e){s={error:e}}finally{try{n&&!n.done&&(c=r.return)&&c.call(r)}finally{if(s)throw s.error}}return this._localStream&&(null===(t=this._localStream.observer)||void 0===t||t.setLogin(!1)),[4,this._mediaServerClient.leave()];case 2:return u.sent(),this.destroy(),fx.rtcLeaveRoom(0,"",KD()-i),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&fx.rtcLeaveRoom(-1,a.message,KD()-i),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteUserPriority=function(e,t){var i,r;null===(i=this.remoteStreams.get(e))||void 0===i||i.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(r=this.userPriorityMap)||void 0===r||r.set(e,t)},t.prototype.destroy=function(){var e,t,i,r;mj.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;try{for(var n=rf(this._remoteStreams),o=n.next();!o.done;o=n.next()){var a=nf(o.value,2)[1];Array.isArray(a)&&a.forEach((function(e){e&&e.clean()}))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._remoteStreams=new Map,this._localStream&&(null===(i=this._localStream)||void 0===i||i.clean(),this._localStream=void 0),this._localScreenStream&&(null===(r=this._localScreenStream)||void 0===r||r.clean(),this._localScreenStream=void 0),this._context=void 0,this._reconnectRecord=new yj,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy()},t.prototype.updateToken=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return mj.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return ef(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return tf(this,(function(c){t=[];try{for(i=rf(this._remoteStreams.values()),r=i.next();!r.done;r=i.next())n=r.value,Array.isArray(n)&&n.forEach((function(i){if(i.hasSubscribed){var r=s.updateSubTrack(i,e,yB.UNSUB);r&&t.push(r)}}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return ef(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return tf(this,(function(c){t=[];try{for(i=rf(this._remoteStreams.values()),r=i.next();!r.done;r=i.next())n=r.value,Array.isArray(n)&&n.forEach((function(i){if(i.hasSubscribed&&i.hasSubscribed){var r=s.updateSubTrack(i,e,yB.SUB);r&&t.push(r)}}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var i;return null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendUserMessage(e,t)},t.prototype.setSessionId=function(){this._sessionId=jD(),Sx.setStats({rtc_session_id:this._sessionId})},t.prototype.sendRoomMessage=function(e,t){var i,r;return void 0===t&&(t=!1),ef(this,void 0,void 0,(function(){var n,o;return tf(this,(function(a){switch(a.label){case 0:return n={clientId:null===(i=this._roomInfo)||void 0===i?void 0:i.userInfo.userId,binary:t,message:""},t?(o=n,[4,YD.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:n.message=e,a.label=3;case 3:return[2,null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendRoomMessage(n)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){mj.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new $B(this._context),this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var i,r,n,o,a,s=this;mj.print("JoinSuccess()"),this._serverConfig=e.config;var c=[],u=[],d=[],l=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var i=s._remoteUsers.get(t.clientId);i?i._stillExist=!0:c.push(t)}}));try{for(var h=rf(this._remoteUsers.values()),p=h.next();!p.done;p=h.next()){var _=p.value;_._stillExist||u.push({clientId:_.userId}),delete _._stillExist}}catch(e){i={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(i)throw i.error}}e.streams.forEach((function(e){var t=s._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):l.push(e)}));try{for(var f=rf(this._remoteStreams.values()),v=f.next();!v.done;v=f.next()){var m=v.value;Array.isArray(m)&&m.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:Gx.clientDisconnected})}))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}setTimeout((function(){u.forEach((function(e){return s._onUserDisconnection(e)})),c.forEach((function(e){return s._onUserConnection(e)})),d.forEach((function(e){return s._onRemoveStream(e)})),l.forEach((function(e){return s._onAddStream(e,!0,!1)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,i=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));try{for(var r=rf(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return ef(i,void 0,void 0,(function(){var t;return tf(this,(function(i){switch(i.label){case 0:if(!e.hasSubscribed)return[3,4];e.resetHasSubscribed(),i.label=1;case 1:return i.trys.push([1,3,,4]),mj.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType)];case 2:return i.sent(),mj.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(fB.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=i.sent(),mj.print("failed resubscribe ".concat(e.userId," with ").concat(e.subMediaType,", error:").concat(t)),e.clean(),null==e||e.resetHasSubscribed(),[3,4];case 4:return[2]}}))}))}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var i=this._remoteStreams.get(e);return Array.isArray(i)?i.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var i=this._remoteStreams.get(e);return Array.isArray(i)?i.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t,i){var r,n,o,a,s,c,u,d,l,h,p;if(void 0===t&&(t=!0),void 0===i&&(i=!0),e.clientId!==(null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId)){var _=this._findRemoteStream(e.clientId,e.streamId);if(!_){_=new NB(e.clientId,e.streamId,e.screen,e.attributes,null===(n=this.userPriorityMap)||void 0===n?void 0:n.get(e.clientId)),this._initStreamListeners(_);var f=this._remoteStreams.get(e.clientId);f?f.push(_):this._remoteStreams.set(e.clientId,[_])}if(this._mediaServerClient.handler&&(_.observer=new nj(_,this._mediaServerClient.handler)),!_.isScreen&&(i&&_.hasVideo&&(_.attributes.extvideo?(null===(o=_.observer)||void 0===o||o.setExternalVideoSource(!0),null===(a=_.observer)||void 0===a||a.setPushVideo(!0)):(null===(s=_.observer)||void 0===s||s.setExternalVideoSource(!1),null===(c=_.observer)||void 0===c||c.setPublishVideo(!0))),i&&_.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(_.attributes.extaudio?(null===(u=_.observer)||void 0===u||u.setExternalAudioSource(!0),null===(d=_.observer)||void 0===d||d.setPushAudio(!0)):(null===(l=_.observer)||void 0===l||l.setExternalAudioSource(!1),null===(h=_.observer)||void 0===h||h.setPublishAudio(!0))),!0===t&&!1===i)){var v=this._roomConfig,m=v.isAutoSubscribeAudio,S=v.isAutoSubscribeVideo;null===(p=_.observer)||void 0===p||p.setLogin(!0,{audio:!!m,video:!!S})}return t&&this.safeEmit(zx.ON_ADD_STREAM,{stream:_}),_}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof i)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(i);var r={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,Z_({},r)),this.safeEmit(zx.USER_CONNECTION,{userInfo:r})}},t.prototype._onUserDisconnection=function(e){var t,i=this,r=e.clientId,n=e.tag,o=e.code;if(r)if(r===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;n===Xx.kickedByAdmin?a=aP.KICKED_OUT:n===Xx.onUserTokenDidExpire?a=aP.TOKEN_EXPIRED:n===Xx.userDuplicateLogin&&(a=aP.DUPLICATE_LOGIN),o===Yx.roomDismissByAdmin&&(a=aP.ROOM_DISMISS),a&&this.safeEmit(fB.ON_ROOM_ERROR,{errorCode:a})}else{var s=w_.DROPPED;n===Xx.userLeave?s=w_.QUIT:n===Xx.kickedByAdmin?s=w_.KICKED_BY_ADMIN:n===Xx.roleChanged&&(s=w_.SWITCH_TO_INVISIBLE);var c=function(){i._remoteUsers.delete(r),i.safeEmit(fB.ON_USER_LEAVE,{userInfo:{userId:r},reason:s})};if(n===Xx.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(r);null!=u||self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(r,d)}else c()}},t.prototype._onRemoveStream=function(e){var t,i,r,n,o=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=this._remoteStreams.get(e.clientId);if(a){var s=a.find((function(t){return t.streamId==e.streamId}));s&&(null===(i=this._mediaServerClient)||void 0===i||i.handleRemoveStream(s,e).then((function(){if(!(null==s?void 0:s._workaround_1_)){var t=o._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),o._remoteStreams.set(e.clientId,t)}})).finally((function(){o.safeEmit(zx.ON_REMOVE_STREAM,{stream:s,reason:e.message})})),s.hasVideo&&(null===(r=s.observer)||void 0===r||r.setPublishVideo(!1)),s.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(null===(n=s.observer)||void 0===n||n.setPublishAudio(!1)))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t,i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y=e.clientId,g=e.streamId,E=e.attributes,b=this._findRemoteStream(y,g);if(b){var T=b.attributes,I=Z_(Z_({},T),E),R=!1,A=I.localaudio!==T.localaudio,C=!1,O=!1,w=I.localvideo!==T.localvideo,N=!1,P=MF.NONE,D=MF.NONE;I.audiostream!==T.audiostream&&(R=I.localaudio,C=!!I.audiostream,I.audiostream?P|=x_.AUDIO:D|=x_.AUDIO),I.videostream!==T.videostream&&(O=I.localvideo,N=!!I.videostream,I.videostream?P|=x_.VIDEO:D|=x_.VIDEO),P&&this.safeEmit(fB.ON_USER_PUBLISH_STATE_CHANGE,{userId:y,mediaType:P,isScreen:b.isScreen,pubState:SB.PUB,remoteStream:b}),D&&this.safeEmit(fB.ON_USER_PUBLISH_STATE_CHANGE,{userId:y,mediaType:D,isScreen:b.isScreen,pubState:SB.UNPUB,remoteStream:b}),I.localaudio!==T.localaudio&&(I.localaudio?(I.extaudio?(null===(t=b.observer)||void 0===t||t.setExternalAudioSource(!0),null===(i=b.observer)||void 0===i||i.setPushAudio(!0)):(null===(r=b.observer)||void 0===r||r.setExternalAudioSource(!1),null===(n=b.observer)||void 0===n||n.setEnableAudio(!0)),this.safeEmit(fB.ON_USER_START_AUDIO_CAPTURE,{userId:y})):(I.extaudio?(null===(o=b.observer)||void 0===o||o.setExternalAudioSource(!0),null===(a=b.observer)||void 0===a||a.setPushAudio(!1)):(null===(s=b.observer)||void 0===s||s.setExternalAudioSource(!1),null===(c=b.observer)||void 0===c||c.setEnableAudio(!1)),!b.isScreen&&this.safeEmit(fB.ON_USER_STOP_AUDIO_CAPTURE,{userId:y}))),I.localvideo!==T.localvideo&&(I.localvideo?(I.extvideo?(null===(u=b.observer)||void 0===u||u.setExternalVideoSource(!0),null===(d=b.observer)||void 0===d||d.setPushVideo(!0)):(null===(l=b.observer)||void 0===l||l.setExternalVideoSource(!1),null===(h=b.observer)||void 0===h||h.setEnableVideo(!0)),this.safeEmit(fB.ON_USER_START_VIDEO_CAPTURE,{userId:y})):(I.extvideo?(null===(p=b.observer)||void 0===p||p.setExternalVideoSource(!0),null===(_=b.observer)||void 0===_||_.setPushVideo(!1)):(null===(f=b.observer)||void 0===f||f.setExternalVideoSource(!1),null===(v=b.observer)||void 0===v||v.setEnableVideo(!1)),!b.isScreen&&this.safeEmit(fB.ON_USER_STOP_VIDEO_CAPTURE,{userId:y}))),R&&!A&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!w&&(null===(S=b.observer)||void 0===S||S.setRemoteUnmuteVideo(N)),b.attributes=I}},t.prototype._onPushTrack=function(e){var t=this,i=e.clientId,r=e.streamId,n=this._findRemoteStream(i,r);n||(n=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){return t.safeEmit(fB.SUBSCRIBE_PUSH_TRACK,{stream:n})})).catch((function(e){mj.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,i=e.clientId,r=e.streamId,n=e.message,o=this._findRemoteStream(i,r);o&&this._mediaServerClient.unsubscribe4removeTrack(o,n).then((function(){var e;if(o._workaround_1_){var n=null===(e=t._remoteStreams.get(i))||void 0===e?void 0:e.filter((function(e){return e.streamId!==r}));t._remoteStreams.set(i,n||[])}t.safeEmit(fB.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){mj.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,i=e.nodes,r=e.reason;Dx.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(i)&&i.length?this._getAccessNode=i[0]:this._getAccessFeedback=r,fx.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(r)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,i=this;this._isReconnecting=!0;try{for(var r=rf(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}fx.rtcReconnect(1002,AL.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,CL.PEERCONNECTION),this._join((function(){fx.rtcReconnected(OL.PEERCONNECTION_RECONNECTED,wL.PEERCONNECTION)}),(function(e){i._reconnectRecord.record(e),i._reconnectRecord.shouldReconnect?(mj.print("Reconnecting error, will reconnect after 3s",e),i._reconnectTimer=window.setTimeout(i._reconnect.bind(i),3e3)):(i.safeEmit(fB.RECONNECT_FAILED),i.destroy())}),!0)},t.prototype._handleAbnormalDisconnection=function(){mj.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t,i=this;if(e.next===XB.DISCONNECTED)t=F_.CONNECTION_STATE_DISCONNECTED;else if(e.next===XB.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?F_.CONNECTION_STATE_RECONNECTED:F_.CONNECTION_STATE_CONNECTED;else{if(e.next!==XB.CONNECTING)return;t=this._isReconnecting?F_.CONNECTION_STATE_RECONNECTING:F_.CONNECTION_STATE_CONNECTING}e.prev===XB.CONNECTED&&e.next===XB.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){i.safeEmit(Wx.ON_CONNECTION_STATE_CHANGE,{state:F_.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(Wx.ON_CONNECTION_STATE_CHANGE,{state:t})},t.prototype._initStreamListeners=function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(i){var r;t.emit(fB.ON_SEI_MESSAGED_RECEIVED,{sei:i,remoteStreamKey:{userId:e.userId,roomId:null===(r=t._roomInfo)||void 0===r?void 0:r.roomId,streamIndex:e.isScreen?L_.STREAM_INDEX_SCREEN:L_.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(zx.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(zx.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(zx.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){if(e.body){var t=e.body,i=t.error||0,r=mB.START,n=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(r=mB.START_FAILED);break;case"TranscodeStateChanged":r=0!==t.error?mB.START_FAILED:mB.START_SUCCESS;break;case"TranscodeStopped":r=0!==t.error?mB.STOP_FAILED:mB.STOP_SUCCESS;break;case"TranscodeUpdated":r=0!==t.error?mB.UPDATE_FAILED:mB.UPDATE_SUCCESS}this.safeEmit(zx.POST_PROCESSING_MESSAGE,{code:i,protocol:t.protocol,error:t.error,eventType:r,message:n[i]})}this.safeEmit(zx.POST_PROCESSING_MESSAGE,{code:i,message:n[i],type:e.type})}},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(zx.ON_USER_TOKEN_WILL_EXPIRE,null)},t.prototype._onSceneConfig=function(e){var t,i,r=e.multiSceneConfig,n=YB[this._roomConfig.roomProfileType][1];if(r){var o=r[n];o&&o.engine_BAC&&(null===(t=this._context)||void 0===t||t.audioProfileManager.updateEngineBAC(o.engine_BAC)),o&&o.engine_ANM&&(null===(i=this._context)||void 0===i||i.audioProfileManager.updateEngineANM(o.engine_ANM))}},t.prototype._onStreamControlMessage=function(e){var t,i;e.type===Hx.PushLimitWarn&&((null===(t=this._localStream)||void 0===t?void 0:t.pubAudio)||(null===(i=this._localStream)||void 0===i?void 0:i.pubVideo)||this.unpublish())},t.prototype._onPublishOnDemand=function(e){var t,i,r,n,o,a,s,c,u,d,l;if(!1!==(null===(r=null===(i=null===(t=this._serverConfig)||void 0===t?void 0:t.engine_VPM)||void 0===i?void 0:i.ondemand)||void 0===r?void 0:r.enable)&&(null===(n=this._localStream)||void 0===n?void 0:n.enableSimulcast)&&(null===(o=this._localStream)||void 0===o?void 0:o.videoTransceiver)){var h=null===(a=this._localStream)||void 0===a?void 0:a.stream.id,p=null===(s=this._localStream)||void 0===s?void 0:s.videoTransceiver.sender,_=p.getParameters();if(Array.isArray(_.encodings)&&Array.isArray(e)){var f={};mj.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null===(t=null==e?void 0:e.StreamIds)||void 0===t?void 0:t.includes(h)){var i=null==e?void 0:e.Metadata.SubvideoIndex;f[i]=i}}));var v={};null===(u=null===(c=this._localStream)||void 0===c?void 0:c.subVideoDescriptions)||void 0===u||u.forEach((function(e){void 0!==f[e.sub_index]&&(v[e.video_index]=e)}));var m=(null===(l=null===(d=p.track)||void 0===d?void 0:d.getSettings())||void 0===l?void 0:l.height)||720,S=[];_.encodings=_.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),S.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy})):(S.push({type:0,rid:e.rid}),e.active=!1)),e})),fx.rtcInvokeStatus(JSON.stringify(S),0,"rscp",h,0)}p.setParameters(_)}},t.prototype._reportNetworkQuality=function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(fB.ON_NETWORK_QUALITY,e,t)},t.prototype._emitVideoSizeChange=function(e,t,i,r){var n;this.emit(fB.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(n=this.roomInfo)||void 0===n?void 0:n.roomId,userId:e,streamIndex:t?L_.STREAM_INDEX_SCREEN:L_.STREAM_INDEX_MAIN},{width:i,height:r})},t.prototype._emitSubscribeFallback=function(e){this.emit(fB.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)},t}(wk),yj=function(){function e(){this._all_201_count=0,this._has_4xx=!1}return Object.defineProperty(e.prototype,"shouldReconnect",{get:function(){return!(this._all_201_count>=3||this._has_4xx)},enumerable:!1,configurable:!0}),e.prototype.record=function(e){var t=!1,i=!1;if(Array.isArray(e)){var r=0;e.map((function(e){var t,n,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(n=e.error)||void 0===n?void 0:n.code)<500&&(i=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&r++})),r===e.length&&(t=!0),t&&this._all_201_count++,i&&(this._has_4xx=!0)}},e.prototype.clear=function(){this._all_201_count=0,this._has_4xx=!1},e}(),gj=function(e,t){void 0===t&&(t={});var i=document.createElement(e);return t.id&&(i.id=t.id),t.classList&&t.classList.forEach((function(e){i.classList.add(e)})),t.style&&Object.assign(i.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=nf(e,2),r=t[0],n=t[1];"muted"===r?i.muted=!0:i.setAttribute(r,n)})),i},Ej=function(e,t){return void 0===t&&(t={}),t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var i=nf(t,2),r=i[0],n=i[1];e.setAttribute(r,n)})),e},bj=new Ck("Player",0),Tj=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],Ij={playsinline:"","webkit-playsinline":""},Rj={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},Aj=new(function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var i="audio"===e?Ij:Rj;if("video"===e&&this.videoCache.length>0){if(r=this.videoCache.pop())return Ej(r,{style:t,attributes:i}),r}else if("audio"===e&&this.audioCache.length>0){var r;if(r=this.audioCache.pop())return Ej(r,{style:t,attributes:i}),r}return gj(e,{style:t,attributes:i})},e.prototype.recycle=function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)},e}()),Cj=function(e){function t(t){var i=e.call(this)||this;i.mirrorType=B_.MIRROR_TYPE_NONE,i.played=!1,i._emitPlayFailed=!1,i.emitVideoEvent=function(e){var t,r,n={type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:e.type,currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0,isScreen:i.isScreen};i.emit("playback_event",n)},i._internalPlay=function(){var e;if(null===(e=i._videoDom)||void 0===e?void 0:e.paused){var t=i._videoDom.play();(null==t?void 0:t.then)&&t.catch((function(e){var t,r;i._emitPlayFailed||(i._emitPlayFailed=!0,fx.rtcError("video autoplay failed, userId: ".concat(i.userId),-1e3),i.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:"autoplay-error",currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0}))}))}};var r=t.renderDom,n=t.userId;i.renderMode=void 0!==t.renderMode?t.renderMode:U_.RENDER_MODE_FIT;var o="string"==typeof r?document.getElementById(r):r;if(!o)throw new lP(aP.CANT_FIND_DOM,"can't find dom");return i._containerDom=o,i.userId=n,i.isScreen=!!t.isScreen,i._initVideo(),i}return A_(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=Aj.getOrCreate("video",{width:"100%",height:"100%"}),this._videoDom.id="".concat(this.userId,"_").concat(zD()),this.renderMode===U_.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===B_.MIRROR_TYPE_RENDER)),this._containerDom.appendChild(this._videoDom),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&Tj.forEach((function(t){var i;null===(i=e._videoDom)||void 0===i||i.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._videoDom&&(Tj.forEach((function(t){var i;null===(i=e._videoDom)||void 0===i||i.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(i){var r;if("timeupdate"===i.eventName){var n=e.isScreen?1.5:.5;if(0===(null===(r=t._videoDom)||void 0===r?void 0:r.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>n;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var i;return ef(this,void 0,void 0,(function(){var r,n,o=this;return tf(this,(function(a){return r=this._videoDom,bj.print("playVideo","play video track: ".concat(this.userId)),r&&r.srcObject instanceof MediaStream&&r.srcObject.getTrackById(null===(i=e.getTrack())||void 0===i?void 0:i.id)||(r||(this._initVideo(),r=this._videoDom),bj.print("playVideo","play video by dom: ".concat(null==r?void 0:r.id)),(n=new MediaStream).addTrack(e.getTrack()),r.srcObject=n,r&&!this._containerDom.contains(r)&&this._containerDom.appendChild(r),r.addEventListener("canplay",this._internalPlay),r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return o._internalPlay()})),t&&this._recordFrame(t),this.played=!0),[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var i=new MediaStream;i.addTrack(t),this._videoDom.srcObject=i}},t.prototype.manuallyPlay=function(){if(bj.print("Invoke VideoPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._videoDom)throw new lP(aP.INVALID_PARAMS,"Player not found");return this._videoDom.play()},t.prototype.mirror=function(e){bj.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?B_.MIRROR_TYPE_RENDER:B_.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;bj.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0,this.played=!1},t.prototype.destroy=function(){bj.print("destroy","video player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._videoDom&&(Aj.recycle(this._videoDom),delete this._videoDom)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(bk.exports.EventEmitter),Oj=function(e){function t(t,i){var r=void 0===i?{divId:void 0,muted:!1}:i,n=r.divId,o=r.muted,a=e.call(this)||this;if(a.muted=!1,a._emitPlayFailed=!1,a.played=!1,a.emitAudioEvent=function(e){var t,i,r={type:"audio",rawEvent:e,readyState:(null===(t=a._audioDom)||void 0===t?void 0:t.readyState)||0,userId:a.userId,eventName:e.type,currentTime:(null===(i=a._audioDom)||void 0===i?void 0:i.currentTime)||0};a.emit("playback_event",r)},a._internalPlay=function(){var e,t;if(Ix("_internalPlay",{paused:null===(e=a._audioDom)||void 0===e?void 0:e.paused}),null===(t=a._audioDom)||void 0===t?void 0:t.paused)try{var i=a._audioDom.play();(null==i?void 0:i.then)&&i.catch((function(e){a._autoPlayError(e)})).then((function(){Ix("_internalPlay successfully",{userId:a.userId})}))}catch(e){a._autoPlayError(e)}},n){var s=document.getElementById(n);if(!s)throw new lP(aP.CANT_FIND_DOM,"can't find dom");a._containerDom=s}else a._containerDom=document.body;return a.userId=t,a.muted=o,a._initAudio(),a}return A_(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=Aj.getOrCreate("audio",{display:"none"}),this._audioDom.volume=this.muted?0:1,this._audioDom.id="".concat(this.userId,"_").concat(zD()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&Tj.forEach((function(t){var i;null===(i=e._audioDom)||void 0===i||i.addEventListener(t,e.emitAudioEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(Tj.forEach((function(t){var i;null===(i=e._audioDom)||void 0===i||i.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return ef(this,void 0,void 0,(function(){var i,r,n=this;return tf(this,(function(o){return bj.print("playAudio","play audio track: ".concat(this.userId)),(i=this._audioDom)&&i.srcObject instanceof MediaStream&&i.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)||(i||(this._initAudio(),i=this._audioDom),(r=new MediaStream).addTrack(e.getTrack()),i.srcObject=r,null==i||i.addEventListener("canplay",this._internalPlay),null==i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return n._internalPlay()})),this.played=!0),[2]}))}))},t.prototype._autoPlayError=function(e){var t,i;this._emitPlayFailed||(this._emitPlayFailed=!0,fx.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(i=this._audioDom)||void 0===i?void 0:i.currentTime)||0}))},t.prototype.manuallyPlay=function(){var e;if(bj.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new lP(aP.INVALID_PARAMS,"Player not found");null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return(null==t?void 0:t.then)?t:Promise.resolve(t)},t.prototype.setPlaybackDevice=function(e){return ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){switch(i.label){case 0:return bj.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,LF.enumerateAudioPlaybackDevices()];case 1:return t=i.sent(),t.map((function(e){return e.deviceId})).includes(e)&&this._audioDom&&this._audioDom.setSinkId?[4,this._audioDom.setSinkId(e)]:[2];case 2:return i.sent(),[2]}}))}))},t.prototype.stop=function(){var e=this._containerDom;bj.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){bj.print("destroy","audio player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._audioDom&&(Aj.recycle(this._audioDom),delete this._audioDom)},t}(bk.exports.EventEmitter),wj=function(){function e(){this.userMessage={},this.roomMessage={},this._setTimer()}return e.prototype._setTimer=function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()},e.prototype._reportAndgReset=function(){this._report(),this._reset()},e.prototype._report=function(){var e=this;fx.rtcMessageStatistics(Object.keys(this.userMessage).map((function(t){return e.userMessage[t]})),Object.keys(this.roomMessage).map((function(t){return e.roomMessage[t]})),"")},e.prototype._reset=function(){this.userMessage={},this.roomMessage={}},e.prototype._checkInitUserMessage=function(e,t){this.userMessage["".concat(t,"-").concat(e)]||(this.userMessage["".concat(t,"-").concat(e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_cost_time:0,dc_cost_e2s:0,dc_cost_s2s:0,dc_least_time:1/0,dc_most_time:0,dc_cost_peer_s2e:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_message_type:t,dc_send_binary:0})},e.prototype._sendUserMessage=function(e,t,i){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_send_total++,i&&this.userMessage["".concat(t,"-").concat(e)].dc_send_binary++},e.prototype._recvUserMessage=function(e,t){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_recv_total++},e.prototype._sendUserFail=function(e,t){var i=this.userMessage["".concat(t,"-").concat(e)];i&&i.dc_send_fail++},e.prototype._sendUserAck=function(e,t,i,r,n){var o=this.userMessage["".concat(t,"-").concat(e)];o&&(o.dc_send_ack++,o.dc_cost_time+=i,o.dc_cost_s2s+=r||0,o.dc_cost_peer_s2e+=n,o.dc_cost_e2s+=i-(r||0)-n,i<=100?(o.dc_send_ack_100++,o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=200?(o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=400?(o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=1e3&&o.dc_send_ack_1s++,i<o.dc_least_time&&(o.dc_least_time=i),i>o.dc_most_time&&(o.dc_most_time=i))},e.prototype.sendRoomMessage=function(e,t){this.roomMessage[e]||(this.roomMessage[e]={dc_room_id:e,dc_send_total:0,dc_send_ack:0,dc_cost_time:0,dc_least_time:1/0,dc_most_time:0,dc_send_fail:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_send_binary:0}),this.roomMessage[e].dc_send_total++,t&&this.roomMessage[e].dc_send_binary++},e.prototype.sendRoomFail=function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++},e.prototype.sendRoomAck=function(e,t){var i=this.roomMessage[e];i&&(i.dc_send_ack++,i.dc_cost_time+=t,t<i.dc_least_time&&(i.dc_least_time=t),t>i.dc_most_time&&(i.dc_most_time=t),t<=100?(i.dc_send_ack_100++,i.dc_send_ack_200++,i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=200?(i.dc_send_ack_200++,i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=400?(i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=1e3&&i.dc_send_ack_1s++)},e.prototype.sendP2PMessage=function(e,t){this._sendUserMessage(e,nx.P2P,t)},e.prototype.recvP2PMessage=function(e){this._recvUserMessage(e,nx.P2P)},e.prototype.sendP2PFail=function(e){this._sendUserFail(e,nx.P2P)},e.prototype.sendP2PAck=function(e,t,i,r){this._sendUserAck(e,nx.P2P,t,i,r)},e.prototype.sendP2POutRoomMessage=function(e,t){this._sendUserMessage(e,nx.P2P_OUTSIDE_ROOM,t)},e.prototype.recvP2POutRoomMessage=function(e){this._recvUserMessage(e,nx.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomFail=function(e){this._sendUserFail(e,nx.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomAck=function(e,t,i,r){this._sendUserAck(e,nx.P2P_OUTSIDE_ROOM,t,i,r)},e.prototype.sendP2serverMessage=function(e){this._sendUserMessage("",nx.P2SERVER,e)},e.prototype.sendP2serverFail=function(){this._sendUserFail("",nx.P2SERVER)},e.prototype.sendP2serveAck=function(e){this._sendUserAck("",nx.P2SERVER,e,0,0)},e.prototype.countP2PMessage=function(e,t,i,r,n){this.sendP2PMessage(t,i),e?this.sendP2PAck(t,Date.now()-r,n.s2s_time,n.s2e_time):this.sendP2PFail(t)},e.prototype.countRoomMessage=function(e,t,i,r){this.sendRoomMessage(t,i),e?this.sendRoomAck(t,Date.now()-r):this.sendRoomFail(t)},e.prototype.countUserMessageOutsideRoom=function(e,t,i,r,n){this.sendP2POutRoomMessage(t,i),e?this.sendP2POutRoomAck(t,Date.now()-r,n.s2s_time,n.s2e_time):this.sendP2POutRoomFail(t)},e.prototype.countServerMessage=function(e,t,i){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-i):this.sendP2serverFail()},e.prototype.destroy=function(){this._reset(),clearTimeout(this._timer)},e}(),Nj="object"==("undefined"==typeof global?"undefined":t(global))&&global&&global.Object===Object&&global,Pj="object"==("undefined"==typeof self?"undefined":t(self))&&self&&self.Object===Object&&self,Dj=Nj||Pj||Function("return this")(),kj=Dj.Symbol,Mj=Object.prototype,Uj=Mj.hasOwnProperty,Lj=Mj.toString,xj=kj?kj.toStringTag:void 0;var Vj=Object.prototype.toString;var Fj=kj?kj.toStringTag:void 0;function Bj(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Fj&&Fj in Object(e)?function(e){var t=Uj.call(e,xj),i=e[xj];try{e[xj]=void 0;var r=!0}catch(e){}var n=Lj.call(e);return r&&(t?e[xj]=i:delete e[xj]),n}(e):function(e){return Vj.call(e)}(e)}function jj(e){return null!=e&&"object"==t(e)}var Gj=Array.isArray;function Hj(e){var i=t(e);return null!=e&&("object"==i||"function"==i)}function zj(e){return e}function Kj(e){if(!Hj(e))return!1;var t=Bj(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var Wj=Dj["__core-js_shared__"],Xj=function(){var e=/[^.]+$/.exec(Wj&&Wj.keys&&Wj.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var Yj=Function.prototype.toString;var qj=/^\[object .+?Constructor\]$/,Jj=Function.prototype,Qj=Object.prototype,Zj=Jj.toString,$j=Qj.hasOwnProperty,eG=RegExp("^"+Zj.call($j).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function tG(e){return!(!Hj(e)||(t=e,Xj&&Xj in t))&&(Kj(e)?eG:qj).test(function(e){if(null!=e){try{return Yj.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function iG(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}var rG=Date.now;var nG,oG,aG,sG=function(){try{var e=function(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return tG(i)?i:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),cG=sG,uG=cG?function(e,t){return cG(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:zj,dG=(nG=uG,oG=0,aG=0,function(){var e=rG(),t=16-(e-aG);if(aG=e,t>0){if(++oG>=800)return arguments[0]}else oG=0;return nG.apply(void 0,arguments)}),lG=dG,hG=/^(?:0|[1-9]\d*)$/;function pG(e,i){var r=t(e);return!!(i=null==i?9007199254740991:i)&&("number"==r||"symbol"!=r&&hG.test(e))&&e>-1&&e%1==0&&e<i}function _G(e,t,i){"__proto__"==t&&cG?cG(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}function fG(e,t){return e===t||e!=e&&t!=t}var vG=Object.prototype.hasOwnProperty;function mG(e,t,i){var r=e[t];vG.call(e,t)&&fG(r,i)&&(void 0!==i||t in e)||_G(e,t,i)}var SG=Math.max;function yG(e,t){return lG(function(e,t,i){return t=SG(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,o=SG(r.length-t,0),a=Array(o);++n<o;)a[n]=r[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=r[n];return s[t]=i(a),iG(e,this,s)}}(e,t,zj),e+"")}function gG(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function EG(e){return null!=e&&gG(e.length)&&!Kj(e)}var bG=Object.prototype;function TG(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||bG)}function IG(e){return jj(e)&&"[object Arguments]"==Bj(e)}var RG=Object.prototype,AG=RG.hasOwnProperty,CG=RG.propertyIsEnumerable,OG=IG(function(){return arguments}())?IG:function(e){return jj(e)&&AG.call(e,"callee")&&!CG.call(e,"callee")},wG=OG;var NG="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,PG=NG&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,DG=PG&&PG.exports===NG?Dj.Buffer:void 0,kG=(DG?DG.isBuffer:void 0)||function(){return!1},MG={};MG["[object Float32Array]"]=MG["[object Float64Array]"]=MG["[object Int8Array]"]=MG["[object Int16Array]"]=MG["[object Int32Array]"]=MG["[object Uint8Array]"]=MG["[object Uint8ClampedArray]"]=MG["[object Uint16Array]"]=MG["[object Uint32Array]"]=!0,MG["[object Arguments]"]=MG["[object Array]"]=MG["[object ArrayBuffer]"]=MG["[object Boolean]"]=MG["[object DataView]"]=MG["[object Date]"]=MG["[object Error]"]=MG["[object Function]"]=MG["[object Map]"]=MG["[object Number]"]=MG["[object Object]"]=MG["[object RegExp]"]=MG["[object Set]"]=MG["[object String]"]=MG["[object WeakMap]"]=!1;var UG="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,LG=UG&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,xG=LG&&LG.exports===UG&&Nj.process,VG=function(){try{var e=LG&&LG.require&&LG.require("util").types;return e||xG&&xG.binding&&xG.binding("util")}catch(e){}}(),FG=VG&&VG.isTypedArray,BG=FG?function(e){return function(t){return e(t)}}(FG):function(e){return jj(e)&&gG(e.length)&&!!MG[Bj(e)]},jG=BG,GG=Object.prototype.hasOwnProperty;function HG(e,t){var i=Gj(e),r=!i&&wG(e),n=!i&&!r&&kG(e),o=!i&&!r&&!n&&jG(e),a=i||r||n||o,s=a?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],c=s.length;for(var u in e)!t&&!GG.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||pG(u,c))||s.push(u);return s}var zG=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object),KG=zG,WG=Object.prototype.hasOwnProperty;function XG(e){return EG(e)?HG(e):function(e){if(!TG(e))return KG(e);var t=[];for(var i in Object(e))WG.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}var YG=Object.prototype.hasOwnProperty;function qG(e){if(!Hj(e))return function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}(e);var t=TG(e),i=[];for(var r in e)("constructor"!=r||!t&&YG.call(e,r))&&i.push(r);return i}var JG,QG=(JG=function(e,t){!function(e,t,i,r){var n=!i;i||(i={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=r?r(i[s],e[s],s,i,e):void 0;void 0===c&&(c=e[s]),n?_G(i,s,c):mG(i,s,c)}}(t,function(e){return EG(e)?HG(e,!0):qG(e)}(t),e)},yG((function(e,i){var r=-1,n=i.length,o=n>1?i[n-1]:void 0,a=n>2?i[2]:void 0;for(o=JG.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,i,r){if(!Hj(r))return!1;var n=t(i);return!!("number"==n?EG(r)&&pG(i,r.length):"string"==n&&i in r)&&fG(r[i],e)}(i[0],i[1],a)&&(o=n<3?void 0:o,n=1),e=Object(e);++r<n;){var s=i[r];s&&JG(e,s,r,o)}return e}))),ZG=QG;function $G(e,t){return function(e,t){for(var i=-1,r=null==e?0:e.length,n=Array(r);++i<r;)n[i]=t(e[i],i,e);return n}(t,(function(t){return e[t]}))}function eH(e){return null==e?[]:$G(e,XG(e))}var tH=a,iH=$e("iterator"),rH=!tH((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,i="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),i+=r+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[iH]||"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"!==i||"x"!==new URL("http://x",void 0).host})),nH=I,oH=2147483647,aH=/[^\0-\u007E]/,sH=/[.\u3002\uFF0E\uFF61]/g,cH="Overflow: input needs wider integers to process",uH=n.RangeError,dH=nH(sH.exec),lH=Math.floor,hH=String.fromCharCode,pH=nH("".charCodeAt),_H=nH([].join),fH=nH([].push),vH=nH("".replace),mH=nH("".split),SH=nH("".toLowerCase),yH=function(e){return e+22+75*(e<26)},gH=function(e,t,i){var r=0;for(e=i?lH(e/700):e>>1,e+=lH(e/t);e>455;)e=lH(e/35),r+=36;return lH(r+36*e/(e+38))},EH=function(e){var t=[];e=function(e){for(var t=[],i=0,r=e.length;i<r;){var n=pH(e,i++);if(n>=55296&&n<=56319&&i<r){var o=pH(e,i++);56320==(64512&o)?fH(t,((1023&n)<<10)+(1023&o)+65536):(fH(t,n),i--)}else fH(t,n)}return t}(e);var i,r,n=e.length,o=128,a=0,s=72;for(i=0;i<e.length;i++)(r=e[i])<128&&fH(t,hH(r));var c=t.length,u=c;for(c&&fH(t,"-");u<n;){var d=oH;for(i=0;i<e.length;i++)(r=e[i])>=o&&r<d&&(d=r);var l=u+1;if(d-o>lH((oH-a)/l))throw uH(cH);for(a+=(d-o)*l,o=d,i=0;i<e.length;i++){if((r=e[i])<o&&++a>oH)throw uH(cH);if(r==o){for(var h=a,p=36;;){var _=p<=s?1:p>=s+26?26:p-s;if(h<_)break;var f=h-_,v=36-_;fH(t,hH(yH(_+f%v))),h=lH(f/v),p+=36}fH(t,hH(yH(h))),s=gH(a,l,u==c),a=0,u++}}a++,o++}return _H(t,"")},bH=Wr,TH=n,IH=W,RH=l,AH=I,CH=rH,OH=Yt.exports,wH=rc,NH=Go,PH=Ph,DH=Oi,kH=lc,MH=B,UH=xe,LH=Wo,xH=lo,VH=kt,FH=G,BH=_o,jH=Rn,GH=S,HH=Oc,zH=Ec,KH=lu,WH=bI,XH=$e("iterator"),YH="URLSearchParams",qH="URLSearchParamsIterator",JH=DH.set,QH=DH.getterFor(YH),ZH=DH.getterFor(qH),$H=IH("fetch"),ez=IH("Request"),tz=IH("Headers"),iz=ez&&ez.prototype,rz=tz&&tz.prototype,nz=TH.RegExp,oz=TH.TypeError,az=TH.decodeURIComponent,sz=TH.encodeURIComponent,cz=AH("".charAt),uz=AH([].join),dz=AH([].push),lz=AH("".replace),hz=AH([].shift),pz=AH([].splice),_z=AH("".split),fz=AH("".slice),vz=/\+/g,mz=Array(4),Sz=function(e){return mz[e-1]||(mz[e-1]=nz("((?:%[\\da-f]{2}){"+e+"})","gi"))},yz=function(e){try{return az(e)}catch(t){return e}},gz=function(e){var t=lz(e,vz," "),i=4;try{return az(t)}catch(e){for(;i;)t=lz(t,Sz(i--),yz);return t}},Ez=/[!'()~]|%20/g,bz={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Tz=function(e){return bz[e]},Iz=function(e){return lz(sz(e),Ez,Tz)},Rz=PH((function(e,t){JH(this,{type:qH,iterator:HH(QH(e).entries),kind:t})}),"Iterator",(function(){var e=ZH(this),t=e.kind,i=e.iterator.next(),r=i.value;return i.done||(i.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),i}),!0),Az=function(e){this.entries=[],this.url=null,void 0!==e&&(FH(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===cz(e,0)?fz(e,1):e:BH(e)))};Az.prototype={type:YH,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,r,n,o,a,s,c=zH(e);if(c)for(i=(t=HH(e,c)).next;!(r=RH(i,t)).done;){if(o=(n=HH(VH(r.value))).next,(a=RH(o,n)).done||(s=RH(o,n)).done||!RH(o,n).done)throw oz("Expected sequence with length 2");dz(this.entries,{key:BH(a.value),value:BH(s.value)})}else for(var u in e)UH(e,u)&&dz(this.entries,{key:u,value:BH(e[u])})},parseQuery:function(e){if(e)for(var t,i,r=_z(e,"&"),n=0;n<r.length;)(t=r[n++]).length&&(i=_z(t,"="),dz(this.entries,{key:gz(hz(i)),value:gz(uz(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],r=0;r<t.length;)e=t[r++],dz(i,Iz(e.key)+"="+Iz(e.value));return uz(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var Cz=function(){kH(this,Oz);var e=arguments.length>0?arguments[0]:void 0;JH(this,new Az(e))},Oz=Cz.prototype;if(wH(Oz,{append:function(e,t){KH(arguments.length,2);var i=QH(this);dz(i.entries,{key:BH(e),value:BH(t)}),i.updateURL()},delete:function(e){KH(arguments.length,1);for(var t=QH(this),i=t.entries,r=BH(e),n=0;n<i.length;)i[n].key===r?pz(i,n,1):n++;t.updateURL()},get:function(e){KH(arguments.length,1);for(var t=QH(this).entries,i=BH(e),r=0;r<t.length;r++)if(t[r].key===i)return t[r].value;return null},getAll:function(e){KH(arguments.length,1);for(var t=QH(this).entries,i=BH(e),r=[],n=0;n<t.length;n++)t[n].key===i&&dz(r,t[n].value);return r},has:function(e){KH(arguments.length,1);for(var t=QH(this).entries,i=BH(e),r=0;r<t.length;)if(t[r++].key===i)return!0;return!1},set:function(e,t){KH(arguments.length,1);for(var i,r=QH(this),n=r.entries,o=!1,a=BH(e),s=BH(t),c=0;c<n.length;c++)(i=n[c]).key===a&&(o?pz(n,c--,1):(o=!0,i.value=s));o||dz(n,{key:a,value:s}),r.updateURL()},sort:function(){var e=QH(this);WH(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,i=QH(this).entries,r=LH(e,arguments.length>1?arguments[1]:void 0),n=0;n<i.length;)r((t=i[n++]).value,t.key,this)},keys:function(){return new Rz(this,"keys")},values:function(){return new Rz(this,"values")},entries:function(){return new Rz(this,"entries")}},{enumerable:!0}),OH(Oz,XH,Oz.entries,{name:"entries"}),OH(Oz,"toString",(function(){return QH(this).serialize()}),{enumerable:!0}),NH(Cz,YH),bH({global:!0,forced:!CH},{URLSearchParams:Cz}),!CH&&MH(tz)){var wz=AH(rz.has),Nz=AH(rz.set),Pz=function(e){if(FH(e)){var t,i=e.body;if(xH(i)===YH)return t=e.headers?new tz(e.headers):new tz,wz(t,"content-type")||Nz(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),jH(e,{body:GH(0,BH(i)),headers:GH(0,t)})}return e};if(MH($H)&&bH({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return $H(e,arguments.length>1?Pz(arguments[1]):{})}}),MH(ez)){var Dz=function(e){return kH(this,iz),new ez(e,arguments.length>1?Pz(arguments[1]):{})};iz.constructor=Dz,Dz.prototype=iz,bH({global:!0,forced:!0},{Request:Dz})}}var kz,Mz={URLSearchParams:Cz,getState:QH},Uz=Wr,Lz=s,xz=rH,Vz=n,Fz=Wo,Bz=I,jz=tn.f,Gz=Yt.exports,Hz=lc,zz=xe,Kz=Vn,Wz=JP,Xz=Ro,Yz=yp.codeAt,qz=function(e){var t,i,r=[],n=mH(vH(SH(e),sH,"."),".");for(t=0;t<n.length;t++)i=n[t],fH(r,dH(aH,i)?"xn--"+EH(i):i);return _H(r,".")},Jz=_o,Qz=Go,Zz=lu,$z=Mz,eK=Oi,tK=eK.set,iK=eK.getterFor("URL"),rK=$z.URLSearchParams,nK=$z.getState,oK=Vz.URL,aK=Vz.TypeError,sK=Vz.parseInt,cK=Math.floor,uK=Math.pow,dK=Bz("".charAt),lK=Bz(/./.exec),hK=Bz([].join),pK=Bz(1..toString),_K=Bz([].pop),fK=Bz([].push),vK=Bz("".replace),mK=Bz([].shift),SK=Bz("".split),yK=Bz("".slice),gK=Bz("".toLowerCase),EK=Bz([].unshift),bK="Invalid scheme",TK="Invalid host",IK="Invalid port",RK=/[a-z]/i,AK=/[\d+-.a-z]/i,CK=/\d/,OK=/^0x/i,wK=/^[0-7]+$/,NK=/^\d+$/,PK=/^[\da-f]+$/i,DK=/[\0\t\n\r #%/:<>?@[\\\]^|]/,kK=/[\0\t\n\r #/:<>?@[\\\]^|]/,MK=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,UK=/[\t\n\r]/g,LK=function(e){var t,i,r,n;if("number"==typeof e){for(t=[],i=0;i<4;i++)EK(t,e%256),e=cK(e/256);return hK(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,i=1,r=null,n=0,o=0;o<8;o++)0!==e[o]?(n>i&&(t=r,i=n),r=null,n=0):(null===r&&(r=o),++n);return n>i&&(t=r,i=n),t}(e),i=0;i<8;i++)n&&0===e[i]||(n&&(n=!1),r===i?(t+=i?":":"::",n=!0):(t+=pK(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},xK={},VK=Kz({},xK,{" ":1,'"':1,"<":1,">":1,"`":1}),FK=Kz({},VK,{"#":1,"?":1,"{":1,"}":1}),BK=Kz({},FK,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),jK=function(e,t){var i=Yz(e,0);return i>32&&i<127&&!zz(t,e)?e:encodeURIComponent(e)},GK={ftp:21,file:null,http:80,https:443,ws:80,wss:443},HK=function(e,t){var i;return 2==e.length&&lK(RK,dK(e,0))&&(":"==(i=dK(e,1))||!t&&"|"==i)},zK=function(e){var t;return e.length>1&&HK(yK(e,0,2))&&(2==e.length||"/"===(t=dK(e,2))||"\\"===t||"?"===t||"#"===t)},KK=function(e){return"."===e||"%2e"===gK(e)},WK={},XK={},YK={},qK={},JK={},QK={},ZK={},$K={},eW={},tW={},iW={},rW={},nW={},oW={},aW={},sW={},cW={},uW={},dW={},lW={},hW={},pW=function(e,t,i){var r,n,o,a=Jz(e);if(t){if(n=this.parse(a))throw aK(n);this.searchParams=null}else{if(void 0!==i&&(r=new pW(i,!0)),n=this.parse(a,null,r))throw aK(n);(o=nK(new rK)).bindURL(this),this.searchParams=o}};pW.prototype={type:"URL",parse:function(e,t,i){var r,n,o,a,s,c=this,u=t||WK,d=0,l="",h=!1,p=!1,_=!1;for(e=Jz(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=vK(e,MK,"")),e=vK(e,UK,""),r=Wz(e);d<=r.length;){switch(n=r[d],u){case WK:if(!n||!lK(RK,n)){if(t)return bK;u=YK;continue}l+=gK(n),u=XK;break;case XK:if(n&&(lK(AK,n)||"+"==n||"-"==n||"."==n))l+=gK(n);else{if(":"!=n){if(t)return bK;l="",u=YK,d=0;continue}if(t&&(c.isSpecial()!=zz(GK,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&GK[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=oW:c.isSpecial()&&i&&i.scheme==c.scheme?u=qK:c.isSpecial()?u=$K:"/"==r[d+1]?(u=JK,d++):(c.cannotBeABaseURL=!0,fK(c.path,""),u=dW)}break;case YK:if(!i||i.cannotBeABaseURL&&"#"!=n)return bK;if(i.cannotBeABaseURL&&"#"==n){c.scheme=i.scheme,c.path=Xz(i.path),c.query=i.query,c.fragment="",c.cannotBeABaseURL=!0,u=hW;break}u="file"==i.scheme?oW:QK;continue;case qK:if("/"!=n||"/"!=r[d+1]){u=QK;continue}u=eW,d++;break;case JK:if("/"==n){u=tW;break}u=uW;continue;case QK:if(c.scheme=i.scheme,n==kz)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=Xz(i.path),c.query=i.query;else if("/"==n||"\\"==n&&c.isSpecial())u=ZK;else if("?"==n)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=Xz(i.path),c.query="",u=lW;else{if("#"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=Xz(i.path),c.path.length--,u=uW;continue}c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=Xz(i.path),c.query=i.query,c.fragment="",u=hW}break;case ZK:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,u=uW;continue}u=tW}else u=eW;break;case $K:if(u=eW,"/"!=n||"/"!=dK(l,d+1))continue;d++;break;case eW:if("/"!=n&&"\\"!=n){u=tW;continue}break;case tW:if("@"==n){h&&(l="%40"+l),h=!0,o=Wz(l);for(var f=0;f<o.length;f++){var v=o[f];if(":"!=v||_){var m=jK(v,BK);_?c.password+=m:c.username+=m}else _=!0}l=""}else if(n==kz||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=Wz(l).length+1,l="",u=iW}else l+=n;break;case iW:case rW:if(t&&"file"==c.scheme){u=sW;continue}if(":"!=n||p){if(n==kz||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return TK;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=cW,t)return;continue}"["==n?p=!0:"]"==n&&(p=!1),l+=n}else{if(""==l)return TK;if(a=c.parseHost(l))return a;if(l="",u=nW,t==rW)return}break;case nW:if(!lK(CK,n)){if(n==kz||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var S=sK(l,10);if(S>65535)return IK;c.port=c.isSpecial()&&S===GK[c.scheme]?null:S,l=""}if(t)return;u=cW;continue}return IK}l+=n;break;case oW:if(c.scheme="file","/"==n||"\\"==n)u=aW;else{if(!i||"file"!=i.scheme){u=uW;continue}if(n==kz)c.host=i.host,c.path=Xz(i.path),c.query=i.query;else if("?"==n)c.host=i.host,c.path=Xz(i.path),c.query="",u=lW;else{if("#"!=n){zK(hK(Xz(r,d),""))||(c.host=i.host,c.path=Xz(i.path),c.shortenPath()),u=uW;continue}c.host=i.host,c.path=Xz(i.path),c.query=i.query,c.fragment="",u=hW}}break;case aW:if("/"==n||"\\"==n){u=sW;break}i&&"file"==i.scheme&&!zK(hK(Xz(r,d),""))&&(HK(i.path[0],!0)?fK(c.path,i.path[0]):c.host=i.host),u=uW;continue;case sW:if(n==kz||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&HK(l))u=uW;else if(""==l){if(c.host="",t)return;u=cW}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=cW}continue}l+=n;break;case cW:if(c.isSpecial()){if(u=uW,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=kz&&(u=uW,"/"!=n))continue}else c.fragment="",u=hW;else c.query="",u=lW;break;case uW:if(n==kz||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(s=gK(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||fK(c.path,"")):KK(l)?"/"==n||"\\"==n&&c.isSpecial()||fK(c.path,""):("file"==c.scheme&&!c.path.length&&HK(l)&&(c.host&&(c.host=""),l=dK(l,0)+":"),fK(c.path,l)),l="","file"==c.scheme&&(n==kz||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)mK(c.path);"?"==n?(c.query="",u=lW):"#"==n&&(c.fragment="",u=hW)}else l+=jK(n,FK);break;case dW:"?"==n?(c.query="",u=lW):"#"==n?(c.fragment="",u=hW):n!=kz&&(c.path[0]+=jK(n,xK));break;case lW:t||"#"!=n?n!=kz&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":jK(n,xK)):(c.fragment="",u=hW);break;case hW:n!=kz&&(c.fragment+=jK(n,VK))}d++}},parseHost:function(e){var t,i,r;if("["==dK(e,0)){if("]"!=dK(e,e.length-1))return TK;if(t=function(e){var t,i,r,n,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return dK(e,l)};if(":"==h()){if(":"!=dK(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=i=0;i<4&&lK(PK,h());)t=16*t+sK(h(),16),l++,i++;if("."==h()){if(0==i)return;if(l-=i,u>6)return;for(r=0;h();){if(n=null,r>0){if(!("."==h()&&r<4))return;l++}if(!lK(CK,h()))return;for(;lK(CK,h());){if(o=sK(h(),10),null===n)n=o;else{if(0==n)return;n=10*n+o}if(n>255)return;l++}c[u]=256*c[u]+n,2!=++r&&4!=r||u++}if(4!=r)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(yK(e,1,-1)),!t)return TK;this.host=t}else if(this.isSpecial()){if(e=qz(e),lK(DK,e))return TK;if(t=function(e){var t,i,r,n,o,a,s,c=SK(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(i=[],r=0;r<t;r++){if(""==(n=c[r]))return e;if(o=10,n.length>1&&"0"==dK(n,0)&&(o=lK(OK,n)?16:8,n=yK(n,8==o?1:2)),""===n)a=0;else{if(!lK(10==o?NK:8==o?wK:PK,n))return e;a=sK(n,o)}fK(i,a)}for(r=0;r<t;r++)if(a=i[r],r==t-1){if(a>=uK(256,5-t))return null}else if(a>255)return null;for(s=_K(i),r=0;r<i.length;r++)s+=i[r]*uK(256,3-r);return s}(e),null===t)return TK;this.host=t}else{if(lK(kK,e))return TK;for(t="",i=Wz(e),r=0;r<i.length;r++)t+=jK(i[r],xK);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return zz(GK,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&HK(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,i=e.username,r=e.password,n=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==n?(u+="//",e.includesCredentials()&&(u+=i+(r?":"+r:"")+"@"),u+=LK(n),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+hK(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw aK(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new _W(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+LK(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Jz(e)+":",WK)},getUsername:function(){return this.username},setUsername:function(e){var t=Wz(Jz(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=jK(t[i],BK)}},getPassword:function(){return this.password},setPassword:function(e){var t=Wz(Jz(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=jK(t[i],BK)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?LK(e):LK(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,iW)},getHostname:function(){var e=this.host;return null===e?"":LK(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,rW)},getPort:function(){var e=this.port;return null===e?"":Jz(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=Jz(e))?this.port=null:this.parse(e,nW))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+hK(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,cW))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=Jz(e))?this.query=null:("?"==dK(e,0)&&(e=yK(e,1)),this.query="",this.parse(e,lW)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=Jz(e))?("#"==dK(e,0)&&(e=yK(e,1)),this.fragment="",this.parse(e,hW)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var _W=function(e){var t=Hz(this,fW),i=Zz(arguments.length,1)>1?arguments[1]:void 0,r=tK(t,new pW(e,!1,i));Lz||(t.href=r.serialize(),t.origin=r.getOrigin(),t.protocol=r.getProtocol(),t.username=r.getUsername(),t.password=r.getPassword(),t.host=r.getHost(),t.hostname=r.getHostname(),t.port=r.getPort(),t.pathname=r.getPathname(),t.search=r.getSearch(),t.searchParams=r.getSearchParams(),t.hash=r.getHash())},fW=_W.prototype,vW=function(e,t){return{get:function(){return iK(this)[e]()},set:t&&function(e){return iK(this)[t](e)},configurable:!0,enumerable:!0}};if(Lz&&jz(fW,{href:vW("serialize","setHref"),origin:vW("getOrigin"),protocol:vW("getProtocol","setProtocol"),username:vW("getUsername","setUsername"),password:vW("getPassword","setPassword"),host:vW("getHost","setHost"),hostname:vW("getHostname","setHostname"),port:vW("getPort","setPort"),pathname:vW("getPathname","setPathname"),search:vW("getSearch","setSearch"),searchParams:vW("getSearchParams"),hash:vW("getHash","setHash")}),Gz(fW,"toJSON",(function(){return iK(this).serialize()}),{enumerable:!0}),Gz(fW,"toString",(function(){return iK(this).serialize()}),{enumerable:!0}),oK){var mW=oK.createObjectURL,SW=oK.revokeObjectURL;mW&&Gz(_W,"createObjectURL",Fz(mW,oK)),SW&&Gz(_W,"revokeObjectURL",Fz(SW,oK))}Qz(_W,"URL"),Uz({global:!0,forced:!xz,sham:!Lz},{URL:_W});var yW,gW=function(e,t){return ef(void 0,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:i=new Audio(URL.createObjectURL(new Blob([e],t))),r.label=1;case 1:return r.trys.push([1,3,,4]),i.muted=!0,[4,i.play()];case 2:return r.sent(),i.pause(),[2,!0];case 3:return r.sent(),[2,!1];case 4:return[2]}}))}))},EW=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this._failedAudioList=[],this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],this._context=e,this._localGainNode.gain.value=1}return e.prototype.mixMediaStream=function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)},e.prototype.startAudioMixing=function(e,t,i){return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,_,f,v,m=this;return tf(this,(function(S){switch(S.label){case 0:if(r=i.playCount,hk(n=i.type,"mixingType",eH(sf)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=GF(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_STOPPED,error:sP.AUDIO_MIXING_ERROR_OK});try{s.gainNode.disconnect(this._audioDestination),s.audioSource.disconnect(s.gainNode)}catch(e){}}return(u=this.resourcesCache.get(e))&&u.filePath===t?(c=u.getAudioNode(),[3,4]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw m._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_START_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:return d=S.sent(),l=void 0,t.endsWith("mp3")?l={type:"audio/mpeg"}:t.endsWith("aac")&&(l={type:"audio/aac"}),[4,gW(d,l)];case 3:if(!S.sent())throw this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_START_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,"invalid audio resource");(c=new Audio).crossOrigin="anonymous",c.src=URL.createObjectURL(new Blob([d],l)),S.label=4;case 4:r<=0?c.loop=!0:r>0&&(h=r,c.onended=function(){--h>0?c.play():(m.mixingMap.delete(e),m._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_FINISHED,error:sP.AUDIO_MIXING_ERROR_OK}))}),S.label=5;case 5:return S.trys.push([5,7,,8]),[4,c.play()];case 6:return S.sent(),[3,8];case 7:return p=S.sent(),console.error(p),this._failedAudioList.push(c),this._context.onAutoPlayFailed(),[3,8];case 8:if(_=this._sharedAudioContext.createMediaElementSource(c),f=this._sharedAudioContext.createGain(),v=this.volumeConfig.get(e),f.gain.value=v?v/100:1,_.connect(f).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:_,audioNode:c,gainNode:f,type:"file"}),n===sf.PUBLISH)try{f.disconnect(this._sharedAudioContext.destination)}catch(e){}else f.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],i.type),this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_PLAYING,error:sP.AUDIO_MIXING_ERROR_OK}),[2]}}))}))},e.prototype.stopAudioMixing=function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_STOPPED,error:sP.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_PAUSED,error:sP.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())},e.prototype.resumeAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_PLAYING,error:sP.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return ef(this,void 0,void 0,(function(){var i,r=this;return tf(this,(function(n){switch(n.label){case 0:return this.stopAudioMixing(e),[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw r._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(t){throw r._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,"Load resources failed",t)}))];case 1:return i=n.sent(),[4,gW(i)];case 2:if(!n.sent())throw this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,"Load resources failed");return this._context.emitMessage({mixId:e,state:cf.AUDIO_MIXING_STATE_PRELOADED,error:sP.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(e,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([i])))},filePath:t}),[2]}}))}))},e.prototype.unloadAudioMixing=function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)},e.prototype.getAudioMixingVolume=function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0},e.prototype.setAudioMixingVolume=function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var i=this.mixingMap.get(e);i&&(i.gainNode.gain.value=Number(t)/100)},e.prototype.getAudioMixingDuration=function(e){var t=this.mixingMap.get(e),i=this.mixingMap.get(e);return t||i?t?1e3*t.audioNode.duration:i?1e3*i.audioNode.duration:0:0},e.prototype.getAudioMixingCurrentPosition=function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0},e.prototype.setAudioMixingPosition=function(e,t){var i=this.mixingMap.get(e);i&&(i.audioNode.currentTime=t/1e3,i.audioNode.play())},e.prototype.enableAudioMixingBuffer=function(e){hk(e,"type",eH(sf));var t=this._context.getLocalAudioTrack();if(t){var i=GF(t.getTrack());if(i&&this.mixMediaStream(i),e===sf.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:cf.AUDIO_MIXING_STATE_PCM_ENABLED,error:sP.AUDIO_MIXING_ERROR_OK})}},e.prototype.disableAudioMixingBuffer=function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:cf.AUDIO_MIXING_STATE_PCM_DISABLED,error:sP.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;if(!(this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0))){this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode);try{this._audioBufferSource.start()}catch(e){this._failedAudioList.push(this._audioBufferSource)}this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var i=t.cachedBuffer.shift();i&&t.pushAudioMixingBuffer(i)}}}},e.prototype.stopAll=function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(e){}this.mixingMap.forEach((function(t,i){e.stopAudioMixing(i)}))},Object.defineProperty(e.prototype,"mixTrack",{get:function(){return this._audioDestination.stream.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sharedAudioContext",{get:function(){return this._sharedAudioContext},enumerable:!1,configurable:!0}),e.prototype.resumeLocalPlay=function(){return ef(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s;return tf(this,(function(c){switch(c.label){case 0:e=[],c.label=1;case 1:c.trys.push([1,10,11,12]),t=rf(this._failedAudioList),i=t.next(),c.label=2;case 2:if(i.done)return[3,9];r=i.value,c.label=3;case 3:return c.trys.push([3,7,,8]),r instanceof HTMLAudioElement?(r.muted=!1,[4,r.play()]):[3,5];case 4:return c.sent(),[3,6];case 5:r.start(),c.label=6;case 6:return[3,8];case 7:return n=c.sent(),e.push(r),console.error(n),this._context.onAutoPlayFailed(),[3,9];case 8:return i=t.next(),[3,2];case 9:return[3,12];case 10:return o=c.sent(),a={error:o},[3,12];case 11:try{i&&!i.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 12:return this._failedAudioList=e,[2]}}))}))},e.prototype.destroy=function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()},$_([bx("default","id","filePath","options")],e.prototype,"startAudioMixing",null),$_([bx("default","id")],e.prototype,"stopAudioMixing",null),$_([bx("default","id")],e.prototype,"pauseAudioMixing",null),$_([bx("default","id")],e.prototype,"resumeAudioMixing",null),$_([bx("default","id")],e.prototype,"preloadAudioMixing",null),$_([bx("default","id")],e.prototype,"unloadAudioMixing",null),$_([bx("default","id")],e.prototype,"getAudioMixingVolume",null),$_([bx("default","id","volume")],e.prototype,"setAudioMixingVolume",null),$_([bx("default","id")],e.prototype,"getAudioMixingDuration",null),$_([bx("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),$_([bx("default","id","position")],e.prototype,"setAudioMixingPosition",null),$_([bx("default","type")],e.prototype,"enableAudioMixingBuffer",null),$_([bx()],e.prototype,"disableAudioMixingBuffer",null),$_([bx("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(yW||(yW={}));var bW=new Ck("RTMClient",1),TW=function(e){function t(t){var i=e.call(this)||this;return i._appId=t,i._dataChannelSignal=null,i._handler=null,i._dataChannelSignalState=XB.DISCONNECTED,i._loginSessionId=null,i._userId=null,i._token=null,i._isReconnecting=!1,i._reconnectTimer=null,i._loginResolveCallback=null,i._loginRejectCallback=null,i._iceConfigNode=null,i._wait_login_token=!1,i}return A_(t,e),t.prototype.login=function(e,t){var i=this;return new Promise((function(r,n){if(bW.print("login","invoke login, token: %o, userId: %o",e,t),i._loginSessionId)throw new lP(aP.ALREADY_LOGIN,"Already logined");if(i._loginResolveCallback)throw new lP(aP.LOGIN_FAILED,"Is logging in, please try again later.");i._userId=t,i._token=e,yx.setStats({rtc_app_id:i._appId,user_id:t}),i._loginResolveCallback=r,i._loginRejectCallback=n,i._dataChannelSignal?i._login():(bW.print("login","init dataChannelSingling"),i._dataChannelSignalState=XB.CONNECTING,i._createDataChannelSignaling(t).then((function(e){i._dataChannelSignal=e,i._login()})).catch((function(){i._onDisconnect()})))}))},t.prototype.logout=function(){var e;return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new lP(aP.NOT_LOGIN,"login first");return[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:nV.C2RTM}).catch((function(){}))];case 1:return t.sent(),this._closeDataChannelSignaling(),this._clearState(),[2]}}))}))},t.prototype.updateLoginToken=function(e){return ef(this,void 0,void 0,(function(){var t=this;return tf(this,(function(i){return this._token=e,[2,new Promise((function(e,i){t._wait_login_token?(t._loginResolveCallback=e,t._loginRejectCallback=i,t._login()):e()}))]}))}))},t.prototype.getPeerOnlineStatus=function(e){return ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){switch(i.label){case 0:if(!this._loginSessionId||!this._userId)throw new lP(aP.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:nV.C2RTM})];case 1:return[2,null==(t=i.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return ef(this,void 0,void 0,(function(){return tf(this,(function(i){if(!this._loginSessionId||!this._userId)throw new lP(aP.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})]}))}))},t.prototype.setServerParams=function(e,t){return ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),lk(e,"signature"),lk(t,"url"),!this._loginSessionId||!this._userId)throw new lP(aP.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:e,url:t},{functionType:nV.C2RTM}).catch((function(e){throw new lP(aP.UNEXPECTED_ERROR,e.msg)}))];case 1:return r.sent(),this._serverParamsCache={signature:e,url:t},this.emit("onServerParamsSetResult"),[3,3];case 2:throw i=r.sent(),this.emit("onServerParamsSetResult",i),i;case 3:return[2]}}))}))},t.prototype.sendServerMessage=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){if(!this._loginSessionId||!this._userId)throw new lP(aP.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:Qx.BUSINESS_SERVER,msg:e})]}))}))},t.prototype.destroy=function(){this._clearState(),this._closeDataChannelSignaling(),e.prototype.removeAllListeners.call(this),delete this._serverParamsCache},t.prototype._login=function(){var e=this;if(this._userId){var t=zD();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:YD.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:iV.VERSION,deviceId:Dx.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:nV.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1,e._serverParamsCache&&e.setServerParams(e._serverParamsCache.signature,e._serverParamsCache.url)})).catch((function(t){var i,r,n=t||{},o=n.code,a=n.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(i=aP.INVALID_PARAMS,r="Invalid userId"):(i=aP.INVALID_TOKEN,r="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(i=aP.LOGIN_FAILED,r="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new lP(i,a||r))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return tf(this,(function(d){switch(d.label){case 0:if(r=new dV,n=this._iceConfigNode)return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,null==r?void 0:r.getAccessNode(this._appId,"",e,Dx.getDeviceId(),"")];case 2:if(o=d.sent(),!(n=o[0]))throw new Error;return[3,4];case 3:throw d.sent(),Ix("rtm.login.getNodeFailed","",0,!0),new lP(aP.ICE_SERVER_WRONG,"get ICE config failed");case 4:Ix("rtm.login.getNodeSuccess",n,0,!0),bW.print("_createDataChannelSignaling()","get node success",n),this._handler=HB(vx),null===(t=this._handler)||void 0===t||t.once("disconnect",(function(){bW.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),u._onDisconnect()})),d.label=5;case 5:return d.trys.push([5,7,,8]),[4,null===(i=this._handler)||void 0===i?void 0:i.connect(n)];case 6:return a=d.sent(),bW.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=XB.CONNECTED,[3,8];case 7:throw s=d.sent(),this._iceConfigNode=null,this._dataChannelSignalState=XB.DISCONNECTED,new lP(aP.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 8:return c=new sV(a),bW.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){bW.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(zx.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(zx.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(zx.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(zx.NODE_CHANGE,(function(e){Ix("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(u._iceConfigNode=e.nodes[0]),u._loginResolveCallback&&u._loginRejectCallback?u._login():u._reconnect()})),[2,c]}}))}))},t.prototype._closeDataChannelSignaling=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null},t.prototype._checkDataChannelSignal=function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==XB.CONNECTED)throw new lP(aP.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=XB.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._reconnect=function(){var e=this;!this._isReconnecting&&this._userId&&(bW.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){bW.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){bW.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))},t.prototype._clearState=function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)},t}(bk.exports.EventEmitter),IW=function(e){function t(t){var i=e.call(this)||this;return i._appId=t,i.remoteStreams=new Map,i}return A_(t,e),t.prototype.connect=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return this._mediaServerClient=new $B,this._bindEvents(),[4,this._mediaServerClient.connect(this._appId)];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayPublicStream=function(e){return ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){switch(r.label){case 0:if(this.remoteStreams.get(e))throw new lP(aP.REPEAT_PLAY,"repeat play public media stream");return(t=new NB(e,e,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var r=function(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var i={seiCount:0,seis:[]},r=!1,n=2;n<t.byteLength;){var o=t.getUint16(n);if(n+=2,t.byteLength-n<o){r=!0;break}var a=new Uint8Array(e.buffer,n,o);if(n+=o,t.byteLength-n>0&&t.byteLength-n<=2){r=!0;break}i.seiCount++,i.seis.push(a)}return r&&(i.seiCount=1,i.seis=[e]),i}(e),n=0;n<r.seiCount;n++)i.emit(fB.ON_SEI_MESSAGED_RECEIVED,{sei:r.seis[n],publicStreamId:t.streamId})})),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return r.sent(),this.remoteStreams.set(e,t),[2,t]}}))}))},t.prototype.stopPlayPublicStream=function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)},t.prototype.destroy=function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()},t.prototype._handleReconnected=function(){return ef(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s,c=this;return tf(this,(function(u){clearTimeout(this._reconnectTimer),e=function(e){t.remoteStreams.delete(e),t.startPlayPublicStream(e).then((function(){var t=c.remoteStreams.get(e);c.safeEmit(fB.RESUBSCRIBE,{stream:t})}))},t=this;try{for(i=rf(this.remoteStreams),r=i.next();!r.done;r=i.next())n=nf(r.value,1),o=n[0],e(o)}catch(e){a={error:e}}finally{try{r&&!r.done&&(s=i.return)&&s.call(i)}finally{if(a)throw a.error}}return[2]}))}))},t.prototype._reconnect=function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)},t.prototype._bindEvents=function(){var e,t,i=this;null===(e=this._mediaServerClient)||void 0===e||e.on(Wx.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){i.emit("onRemoteStreamStats",e)}))},t}(wk),RW=new Ck("AudioDeviceManager",1),AW=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._isAudioPlaybackDeviceTesting=!1,t._isAudioDeviceRecordTesting=!1,t}return A_(t,e),t.prototype.startAudioPlaybackDeviceTest=function(e,t){return ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:if(this._isAudioPlaybackDeviceTesting||this._isAudioDeviceRecordTesting)throw new lP(aP.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");this._isAudioPlaybackDeviceTesting=!0,RW.print("startAudioPlaybackDeviceTest()","Invoke"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._playAudioFile(e,{loop:!0})];case 2:return r.sent(),[3,4];case 3:throw i=r.sent(),this.stopAudioPlaybackDeviceTest(),i;case 4:return this._startEmitAudioPlaybackDeviceTestVolume(t),[2]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){this._isAudioPlaybackDeviceTesting&&(RW.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.startAudioDeviceRecordTest=function(e){return ef(this,void 0,void 0,(function(){var t=this;return tf(this,(function(i){switch(i.label){case 0:if(this._isAudioDeviceRecordTesting)throw new lP(aP.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");return this._isAudioDeviceRecordTesting=!0,RW.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){RW.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),t._stopAudioCaptureAndRecoder()}),3e4),[4,this._startAudioCaptureAndRecoder(e)];case 1:return i.sent(),delete this._audioCaptureAndRecoderResolve,[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){RW.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()},t.prototype.stopAudioDevicePlayTest=function(){this._isAudioDeviceRecordTesting&&(RW.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.getRecordTrack=function(){return this._audioTrack},t.prototype.destroy=function(){RW.print("destroy()","Invoke"),e.prototype.removeAllListeners.call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()},t.prototype._playAudioFile=function(e,t){var i=this;return new Promise((function(r,n){i._audioElement=gj("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),i._audioElement.loop=t.loop,RW.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),i._audioElement.oncanplay=function(){RW.print("_playAudioFile()","oncanplay"),r()},i._audioElement.onerror=function(e){var t,r;n(new lP(aP.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(r=null===(t=i._audioElement)||void 0===t?void 0:t.error)||void 0===r?void 0:r.message))))}}))},t.prototype._destroyAudioElement=function(){this._audioElement&&(RW.print("_destroyAudioElement()","Invoke"),this._audioElement.src="",delete this._audioElement,this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())},t.prototype._startEmitAudioPlaybackDeviceTestVolume=function(e){var t=this;e=Math.max(e,100),this._audioElement&&(RW.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new VF(this._audioElement),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))},t.prototype._stopEmitAudioPlaybackDeviceTestVolume=function(){var e;void 0!==this._playbackDeviceTestTimer&&(RW.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher},t.prototype._startAudioCaptureAndRecoder=function(e){return ef(this,void 0,void 0,(function(){var t,i,r=this;return tf(this,(function(n){switch(n.label){case 0:return t=this,[4,rB({})];case 1:return t._audioTrack=n.sent(),i=GF(this._audioTrack.getTrack()),RW.print("startAudioDeviceRecordTest()","create microphone track success!"),[2,new Promise((function(t,n){r._mediaRecorder=new MediaRecorder(i),r._mediaRecorder.ondataavailable=function(i){return ef(r,void 0,void 0,(function(){var r,o,a,s=this;return tf(this,(function(c){switch(c.label){case 0:if(!this._isAudioDeviceRecordTesting)return[3,5];RW.print("startAudioDeviceRecordTest()","get recorded file."),r=new Blob([i.data]),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._playAudioFile(URL.createObjectURL(r),{loop:!1})];case 2:return c.sent(),[3,4];case 3:return o=c.sent(),[2,n(o)];case 4:return this._startEmitAudioPlaybackDeviceTestVolume(e),null===(a=this._audioElement)||void 0===a||a.addEventListener("ended",(function(){s.stopAudioDevicePlayTest(),t()})),this._audioCaptureAndRecoderResolve=t,[3,6];case 5:t(),c.label=6;case 6:return[2]}}))}))},r._mediaRecorder.onerror=function(e){n(new lP(aP.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},r._mediaRecorder.start()}))]}}))}))},t.prototype._stopAudioCaptureAndRecoder=function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.close(),delete this._audioTrack},t}(bk.exports.EventEmitter),CW=function(){function e(){this.engineBAC={adm:{},agc:{},ans:{}},this.engineANM={},this._init()}return e.prototype._init=function(){return ef(this,void 0,void 0,(function(){var e,t;return tf(this,(function(i){switch(i.label){case 0:return e=new lV,t=this,[4,e.getAudioProfile()];case 1:return t.engineBAC=i.sent(),[2]}}))}))},e.prototype.updateEngineBAC=function(e){e&&(this.engineBAC={codec:this.engineBAC.codec,adm:Z_(Z_({},this.engineBAC.adm),e.adm)},this.setAEC(!!e.aec),this.setAGC(!!e.agc))},e.prototype.updateEngineANM=function(e){e&&(this.engineANM=e)},e.prototype.setAudioProfile=function(e){var t,i,r;switch(e){case J_.fluent:i=16e3,t=24e3;break;case J_.standard:i=48e3,t=48e3;break;case J_.hd:i=48e3,t=128e3,r=2;break;case J_.standardStereo:i=48e3,t=8e4,r=2;break;case J_.hdMono:i=48e3,t=128e3}t&&(this.bitrate=t),r&&(this.channel=r),i&&(this.sampleRate=i)},e.prototype.setBitrate=function(e){e>128e3&&(e=128e3),this.bitrate=e},e.prototype.setAEC=function(e){this.aec=e},e.prototype.setAGC=function(e){this.agc=e},e.prototype.setANS=function(e){this.ans=e},e.prototype.getOpusConfigStr=function(){var e=";",t=this.config;return t.bitrate&&(e+="maxaveragebitrate=".concat(t.bitrate,";")),t.sampleRate&&(e+="sprop-maxcapturerate=".concat(t.sampleRate,";")),t.playbackRate&&(e+="maxplaybackrate=".concat(t.playbackRate,";")),t.channel&&t.channel>1&&(e+="sprop-stereo=1;"),t.playChannel&&t.playChannel>1&&(e+="stereo=1;"),e.slice(0,-1)},Object.defineProperty(e.prototype,"config",{get:function(){var e,t,i,r,n,o,a,s,c,u,d,l,h;return{bitrate:this.bitrate||(null===(e=this.engineANM.enc_param)||void 0===e?void 0:e.bitrate)||0,playChannel:(null===(i=null===(t=this.engineBAC.adm)||void 0===t?void 0:t.play)||void 0===i?void 0:i.chn)||1,channel:this.channel||(null===(n=null===(r=this.engineBAC.adm)||void 0===r?void 0:r.record)||void 0===n?void 0:n.chn)||(null===(a=null===(o=this.engineANM)||void 0===o?void 0:o.enc_param)||void 0===a?void 0:a.chn),aec:this.aec,agc:this.agc,ans:this.ans,sampleRate:this.sampleRate||(null===(c=null===(s=this.engineBAC.adm)||void 0===s?void 0:s.record)||void 0===c?void 0:c.sr)||(null===(u=this.engineBAC.codec)||void 0===u?void 0:u.enc_fs)||(null===(d=this.engineANM.enc_param)||void 0===d?void 0:d.sr),playbackRate:null===(h=null===(l=this.engineBAC.adm)||void 0===l?void 0:l.play)||void 0===h?void 0:h.sr}},enumerable:!1,configurable:!0}),e}(),OW=new Ck("Engine",0),wW=function(e){function t(t,i){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._publicStreamAudioPlayer=new Map,r._publicStreamVideoPlayer=new Map,r._publicStreamIds=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._enableSimulcast=!1,r._videoStreamEncodeConfig=[eV],r._screenStreamEncodeConfig=[tV],r._pauseAllSubscribeState={audio:!1,video:!1},r._audioPropertiesReportTimer=null,r._mirrorType=B_.MIRROR_TYPE_RENDER,r._audioDeviceManager=new AW,r._audioProfileManager=new CW,r._remoteVideoConfig=new Map,r._userPriorityMap=new Map,r._subscribeFallbackOption=K_.DISABLE,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=sf.PLAYOUT_AND_PUBLISH),ef(r,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:return OW.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(i=this._room)||void 0===i?void 0:i.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(df.onAudioMixingStateChanged,e)},r._onAudioMixingAutoplayFailed=function(){r.safeEmit(df.onAutoplayFailed,{})},r._appId=t,r._pubLock=new WB("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new EW({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=r,window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=r,r._trackSourceType={video:C_.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:C_.VIDEO_SOURCE_TYPE_INTERNAL,audio:O_.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:O_.AUDIO_SOURCE_TYPE_INTERNAL},r._config=i,r._rtmClient=new TW(t),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new wj,r}return A_(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n,o,a,s;return tf(this,(function(c){switch(c.label){case 0:return OW.print("updateToken()","token: %s",e),lk(e,"token"),this.waitForNewToken&&(null===(t=this._room)||void 0===t?void 0:t._roomInfo)&&this._tempRoomConfig?(n=null===(i=this._room)||void 0===i?void 0:i._roomInfo,o=n.roomId,a=n.userInfo,s=this._tempRoomConfig,delete this._tempRoomConfig,[4,this.joinRoom(e,o,a,s)]):[3,2];case 1:return[2,c.sent()];case 2:if(!this._room)throw new lP(aP.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");return[4,null===(r=this._room)||void 0===r?void 0:r.updateToken(e)];case 3:return c.sent(),[2]}}))}))},t.prototype.setVideoCaptureDevice=function(e){return ef(this,void 0,void 0,(function(){var t,i;return tf(this,(function(r){switch(r.label){case 0:return OW.print("setVideoCaptureDevice()","deviceId: %s",e),lk(e,"deviceId"),this._localVideoTrack?(t=this._videoStreamConstraints,"user"===e||"environment"===e||"left"===e||"right"===e?(delete t.deviceId,t.facingMode=e):t.deviceId={exact:e},this._videoStreamConstraints=t,[4,iB(t)]):(this._localVideoDeviceId=e,[2,Promise.resolve()]);case 1:return i=r.sent(),this._initLocalTrackEvents(i),this._localVideoTrack.close(),this._localVideoTrack=i,this._videoPlayer&&this._videoPlayer.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(i),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},t.prototype.setAudioCaptureDevice=function(e){return ef(this,void 0,void 0,(function(){var t,i;return tf(this,(function(r){switch(r.label){case 0:return OW.print("setAudioCaptureDevice()","deviceId: %s",e),lk(e,"deviceId"),this._localAudioTrack?((t=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=t,this._localAudioTrack.close(),[4,rB(t,this._audioProfileManager)]):(this._localAudioDeviceId=e,[2,Promise.resolve()]);case 1:return i=r.sent(),this._initLocalTrackEvents(i),this._localAudioTrack=i,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){LF.on(df.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),LF.on(df.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S,y,g,E,b,T,I,R,A,C,O=this;null===(e=this._room)||void 0===e||e.on(zx.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(zx.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._room)||void 0===i||i.on(zx.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._room)||void 0===r||r.on(fB.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(n=this._room)||void 0===n||n.on(fB.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(fB.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(zx.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(zx.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(zx.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(zx.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(zx.POST_PROCESSING_MESSAGE,(function(e){!function(e){return"2.0"===e.protocol}(e)?"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e):O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message})})),null===(l=this._room)||void 0===l||l.on(Wx.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(fB.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(p=this._room)||void 0===p||p.on(fB.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(fB.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(fB.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(fB.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=O._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&O.safeEmit(df.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(fB.ON_REMOTE_STREAM_STATS,(function(e){O.safeEmit(df.onRemoteStreamStats,e)})),null===(S=this._room)||void 0===S||S.on(fB.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(df.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(fB.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(g=this._room)||void 0===g||g.on(fB.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(df.onUserStartAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(fB.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(df.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(fB.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(df.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(fB.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(df.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(fB.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(df.onSEIMessageReceived,e)})),null===(R=this._room)||void 0===R||R.on(fB.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(df.onRemoteVideoSizeChanged,e,t)})),null===(A=this._room)||void 0===A||A.on(fB.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(df.onSimulcastSubscribeFallback,e)})),null===(C=this._room)||void 0===C||C.on(fB.RECONNECT_FAILED,(function(){O.safeEmit(df.onError,{errorCode:aP.RECONNECT_FAILED})}))},t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];return Ek(t)&&Tx(t,ik(i)),e.prototype.safeEmit.apply(this,of([t],nf(i),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,i,r){return ef(this,void 0,void 0,(function(){var n,o,a,s;return tf(this,(function(c){switch(c.label){case 0:if(OW.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,i,r),vk(e)||lk(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lP(aP.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){pk(e,"userInfo"),mk(e.userId),vk(e.extraInfo)||lk(e.extraInfo,"userInfo.extraInfo",1,200)}(i),n={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:q_.communication},ZG(n,r),function(e){pk(e,"roomConfig"),uk(e.isAutoPublish,"roomConfig.isAutoPublish"),uk(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),uk(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(n),!this._room||this._room.connectionState===XB.DISCONNECTED)return[3,1];throw new lP(aP.REPEAT_JOIN,"Already joined");case 1:this._room=new Sj(r,{audioProfileManager:this._audioProfileManager}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),o=this._liveTranscodeConfig&&Bx("started",this._liveTranscodeConfig),c.label=2;case 2:return c.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,Z_(Z_({},i),{businessId:this._businessId,role:this._visibility?yW.NORMAL_USER:yW.SILENT_USER}),o,this._useCloudProxy)];case 3:return a=c.sent(),this._roomConfig=r,this._tempRoomConfig&&delete this._tempRoomConfig,(null==r?void 0:r.isAutoPublish)&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:x_.AUDIO_AND_VIDEO}):this.safeEmit(df.onAutoPublishResult,{isScreen:!1,state:k_.PUBLISH_FAIL})),[2,a];case 4:throw(s=c.sent()).code===aP.INVALID_TOKEN&&(this._tempRoomConfig=r),s;case 5:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,i;return void 0===e&&(e=!1),ef(this,void 0,void 0,(function(){return tf(this,(function(r){switch(r.label){case 0:return OW.print("leaveRoom()"),e?[4,null===(t=this._room)||void 0===t?void 0:t.leave(e)]:[3,2];case 1:return r.sent(),[3,3];case 2:null===(i=this._room)||void 0===i||i.leave(e).catch(),r.label=3;case 3:return this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map,[2]}}))}))},t.prototype.destroy=function(){var e,t,i;OW.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),this._videoPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[eV],this._screenStreamEncodeConfig=[tV],this._pauseAllSubscribeState={audio:!1,video:!1},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(i=this._outsideRoom)||void 0===i||i.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear()},t.prototype.publishStream=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return OW.print("publishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),sk(e)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(i=this._localImgVideoTrack,new QF(i,zD())),this._localVideoTrack.dummy=!0),[4,this._updatePublish({mediaType:e})];case 1:return t.sent(),[2]}var i}))}))},t.prototype.unpublishStream=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return OW.print("unpublishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updatePublish({mediaType:e,pubState:SB.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.publishScreen=function(e){return ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){switch(i.label){case 0:OW.print("publishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),i.label=1;case 1:return i.trys.push([1,3,,4]),sk(e)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(r=this._localImgScreenTrack,new ZF(r,zD())),this._localScreenVideoTrack.dummy=!0),[4,this._updateScreenPublish({mediaType:e,pubState:SB.PUB})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof lP?t:new lP(aP.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}var r}))}))},t.prototype.unpublishScreen=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return OW.print("unpublishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updateScreenPublish({mediaType:e,pubState:SB.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.subscribeStream=function(e,t){return ef(this,void 0,void 0,(function(){return tf(this,(function(i){return OW.print("subscribeStream()","userId: %o, mediaType: %o",e,t),[2,this._subscribe(!1,e,t)]}))}))},t.prototype._subscribe=function(e,t,i){var r,n,o,a,s;return ef(this,void 0,void 0,(function(){var c,u,d,l,h;return tf(this,(function(p){switch(p.label){case 0:if(this._checkMediaType(i),this._assertNotInRoom(),c=this._room.remoteStreams.get(t),!(u=null==c?void 0:c.find((function(t){return t.isScreen===e}))))throw new lP(aP.STREAM_NOT_EXIST,"stream not exist");return this._pauseAllSubscribeState.audio&&(i-=i&x_.AUDIO),this._pauseAllSubscribeState.video&&(i-=i&x_.VIDEO),OW.print("subscribeStream()","due to pauseAll mediaType: %o",i),d=u.hasSubscribed,l=this._remoteVideoConfig.get(t)||(null===(r=this._roomConfig)||void 0===r?void 0:r.remoteVideoConfig),u.originalMediaType=i,[4,this._room.subscribe(u,i,l)];case 1:return p.sent(),ak(i)&&this._updateAudioPlayerState(u),sk(i)&&this._updateVideoPlayerState(u),e||!(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)&&!(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo)||(u.audioTrack||u.videoTrack)&&(h={userId:t,isScreen:!1,state:D_.SUBSCRIBE_SUCC},this.safeEmit(df.onAutoSubscribeResult,h)),!d&&ak(i)&&(null===(a=u.observer)||void 0===a||a.setSubscribeAudio(!0)),!d&&sk(i)&&(null===(s=u.observer)||void 0===s||s.setSubscribeVideo(!0)),[2]}}))}))},t.prototype.unsubscribeStream=function(e,t){return ef(this,void 0,void 0,(function(){var i,r;return tf(this,(function(n){if(OW.print("unsubscribeStream()","userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),i=this._room.remoteStreams.get(e),!(null==(r=null==i?void 0:i.find((function(e){return!e.isScreen})))?void 0:r.hasSubscribed))throw new lP(aP.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.subscribeScreen=function(e,t){return ef(this,void 0,void 0,(function(){return tf(this,(function(i){return OW.print("subscribeScreen() userId: %o, mediaType: %o",e,t),[2,this._subscribe(!0,e,t)]}))}))},t.prototype.unsubscribeScreen=function(e,t){return ef(this,void 0,void 0,(function(){var i,r;return tf(this,(function(n){if(OW.print("unsubscribeScreen() userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),i=this._room.remoteStreams.get(e),!(null==(r=null==i?void 0:i.find((function(e){return e.isScreen})))?void 0:r.hasSubscribed))throw new lP(aP.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.setRemoteVideoConfig=function(e,t){var i;return ef(this,void 0,void 0,(function(){return tf(this,(function(r){return OW.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",e,t),mk(e),function(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new lP(aP.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}(t),this._remoteVideoConfig.set(e,t),[2,null===(i=this._room)||void 0===i?void 0:i.updateSubVideoConfig(e,t).then((function(){}))]}))}))},t.prototype.startVideoCapture=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n,o,a,s,c,u,d=this;return tf(this,(function(l){switch(l.label){case 0:if(OW.print("startVideoCapture()","deviceId: %s",e),vk(e)||lk(e,"deviceId"),e=e||this._localVideoDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new lP(aP.REPEAT_CAPTURE,"Has already capture");return n=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?n.facingMode=e:n.deviceId={exact:e},this._videoStreamConstraints=n),[4,iB(n)];case 1:return o=l.sent(),this._initLocalTrackEvents(o),this._localVideoTrack=o,null===(t=this._videoPlayer)||void 0===t||t.playVideo(o),a={},(s=null==o?void 0:o.getTrack())&&(a=s.getSettings(),c={width:a.width,height:a.height},this._localVideoTrack.resolution=c,setTimeout((function(){return d.safeEmit(df.onLocalVideoSizeChanged,{streamIndex:L_.STREAM_INDEX_MAIN,info:c})}))),this._room?(u=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||u)&&(this._visibility?this._updatePublish():this.safeEmit(df.onAutoPublishResult,{isScreen:!1,state:k_.PUBLISH_FAIL})),null===(r=null===(i=this._room.localStream)||void 0===i?void 0:i.observer)||void 0===r||r.setEnableVideo(!0),[2,a]):[2,a]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,i,r,n;return ef(this,void 0,void 0,(function(){return tf(this,(function(o){switch(o.label){case 0:if(OW.print("stopVideoCapture()"),this._trackSourceType.video===C_.VIDEO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return null===(e=this._videoPlayer)||void 0===e||e.stop(),null===(t=this._localVideoTrack)||void 0===t||t.close(),this._localImgVideoTrack&&this._localVideoTrack?(null===(i=this._localVideoTrack)||void 0===i||i.setTrack(this._localImgVideoTrack),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:o.sent(),o.label=2;case 2:return null===(n=null===(r=this._room.localStream)||void 0===r?void 0:r.observer)||void 0===n||n.setEnableVideo(!1),[2]}}))}))},t.prototype.startAudioCapture=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o;return tf(this,(function(a){switch(a.label){case 0:if(OW.print("startAudioCapture()","deviceId: $o",e),vk(e)||lk(e,"deviceId"),e=e||this._localAudioDeviceId,this._localAudioTrack)throw new lP(aP.REPEAT_CAPTURE,"Has already capture");return r=this._audioStreamConstraints,e&&(r.deviceId={exact:e},this._audioStreamConstraints=r),[4,rB(r,this._audioProfileManager)];case 1:return n=a.sent(),this._initLocalTrackEvents(n),this._localAudioTrack=n,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(df.onAutoPublishResult,{isScreen:!1,state:k_.PUBLISH_FAIL})),null===(i=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===i||i.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.stopAudioCapture=function(){var e,t,i;return ef(this,void 0,void 0,(function(){return tf(this,(function(r){switch(r.label){case 0:if(OW.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===O_.AUDIO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:r.sent(),r.label=2;case 2:return null===(i=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===i||i.setEnableAudio(!1),[2]}}))}))},t.prototype.getAudioMixingManager=function(){return OW.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,i,r,n,o;return void 0===e&&(e={}),ef(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p=this;return tf(this,(function(_){switch(_.label){case 0:if(OW.print("startScreenCapture()","config: %o",e),(null===(t=this._localScreenVideoTrack)||void 0===t?void 0:t.dummy)||null===(i=this._localScreenVideoTrack)||void 0===i||i.close(),this._localScreenVideoTrack=void 0,a=e.enableAudio,s=void 0!==a&&a,this._trackSourceType.screenVideo===C_.VIDEO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===O_.AUDIO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,nB(s,this._screenStreamEncodeConfig[0])];case 1:return c=_.sent(),this._localScreenVideoTrack=new ZF(c.getVideoTracks()[0],zD()),(u=null===(r=this._localScreenVideoTrack)||void 0===r?void 0:r.getTrack())&&(d=u.getSettings(),l={width:d.width,height:d.height},this._localScreenVideoTrack.resolution=l,setTimeout((function(){return p.safeEmit(df.onLocalVideoSizeChanged,{streamIndex:L_.STREAM_INDEX_SCREEN,info:{width:d.width,height:d.height}})}))),(h=c.getAudioTracks()).length&&(this._localScreenAudioTrack=new $F(h[0],zD()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),(null===(o=this._room)||void 0===o?void 0:o.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,3];case 2:_.sent(),_.label=3;case 3:return[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,i,r;return ef(this,void 0,void 0,(function(){return tf(this,(function(n){switch(n.label){case 0:return OW.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localImgScreenTrack&&this._localScreenVideoTrack?(this._localScreenVideoTrack.setTrack(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0):this._localScreenVideoTrack=void 0,null===(i=this._localScreenAudioTrack)||void 0===i||i.close(),this._localScreenAudioTrack=void 0,(null===(r=this._room)||void 0===r?void 0:r.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var i,r,n,o;if(OW.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),hk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),t&&t.renderDom){var a=Z_({userId:this._getUserId()},t);return yk(a),e!=L_.STREAM_INDEX_MAIN||this._videoPlayer?e!=L_.STREAM_INDEX_SCREEN||this._screenPlayer?void 0:(this._screenPlayer=new Cj(Z_(Z_({},a),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)!==Q_.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement):(this._videoPlayer=new Cj(a),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Q_.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement)}e==L_.STREAM_INDEX_MAIN?(null===(i=this._videoPlayer)||void 0===i||i.destroy(),delete this._videoPlayer):(null===(r=this._screenPlayer)||void 0===r||r.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:OW.print("startLiveTranscoding()","transcode: %o",e),lk(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(df.onStreamMixingEvent,{event:mB.START,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(Bx("started",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof lP?i:new lP(aP.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:if(OW.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=ZG(this._liveTranscodeConfig,e),r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(df.onStreamMixingEvent,{event:mB.UPDATE,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(Bx("layoutChanged",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof lP?i:new lP(aP.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){switch(i.label){case 0:if(OW.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,i.label=1;case 1:return i.trys.push([1,3,,4]),this.safeEmit(df.onStreamMixingEvent,{event:mB.STOP,error:0,message:""}),[4,null===(e=this._room)||void 0===e?void 0:e.liveControlMessage({action:"stopped",type:"transcode"})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof lP?t:new lP(aP.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return OW.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(Sx.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t,i;return ef(this,void 0,void 0,(function(){return tf(this,(function(r){switch(r.label){case 0:if(OW.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==XB.CONNECTED)throw new lP(aP.NOT_CONNECTED_YET,"server not connected");return this._room.localStream&&(null===(t=this._room.localStream.observer)||void 0===t||t.setPublisher(e)),!e?[4,this._room.unpublish()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?yW.NORMAL_USER:yW.SILENT_USER})];case 3:return r.sent(),this._visibility=e,e&&(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoPublish)&&this._updatePublish({mediaType:x_.AUDIO_AND_VIDEO}),[2]}}))}))},t.prototype._initPlayerEvents=function(e,t){var i=this;void 0===t&&(t=!1),e.on("playback_event",(function(r){var n,o,a,s;switch(null===(o=null===(n=i._room)||void 0===n?void 0:n.remoteStreams.get(r.userId||""))||void 0===o||o.find((function(e){return!e.isScreen})),r.eventName){case"timeupdate":return;case"loadeddata":if("audio"===r.type)t?i.safeEmit(df.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):i.safeEmit(df.onAudioFirstFrameDecoded,{userId:e.userId}),fx.firstRemoteAudioRender("",r.userId||"");else{var c={userId:e.userId,height:(null===(a=e.domElement)||void 0===a?void 0:a.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0};t?(c.publicStreamId=c.userId,delete c.userId,i.safeEmit(df.onFirstPublicStreamVideoFrameDecoded,c),i.safeEmit(df.onFirstPublicStreamVideoFrameRendered,c)):(i.safeEmit(df.onVideoFirstFrameDecoded,c),i.safeEmit(df.onVideoFirstFrameRendered,c)),fx.firstRemoteVideoRender("",r.userId||"")}break;case"autoplay-error":return t&&(r.publicStreamId=r.userId),void i.safeEmit(df.onAutoplayFailed,{userId:r.userId||r.publicStreamId,kind:e instanceof Cj?"video":"audio"})}i.safeEmit(df.onPlayerEvent,r)}))},t.prototype._initLocalTrackEvents=function(e,t){var i=this;void 0===t&&(t=!1),e.on("track-ended",(function(e){var t=!1;e!==i._localScreenAudioTrack&&e!==i._localScreenVideoTrack||(t=!0),i.safeEmit(df.onTrackEnded,{kind:e.getTrack().kind,isScreen:t})})),e.on("resolution-change",(function(e){i.safeEmit(df.onLocalVideoSizeChanged,{streamIndex:t?L_.STREAM_INDEX_SCREEN:L_.STREAM_INDEX_MAIN,info:e})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var i,r,n,o,a,s;OW.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),hk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),yk(t);var c=t.userId;if(e==L_.STREAM_INDEX_MAIN){if(null===(i=this._remoteVideoPlayer.get(c))||void 0===i||i.destroy(),!t.renderDom)return;var u=new Cj(t);return this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(n=null===(r=this._room)||void 0===r?void 0:r.remoteStreams.get(c))||void 0===n?void 0:n.find((function(e){return!e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}if(null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy(),t.renderDom){var d;u=new Cj(Z_(Z_({},t),{isScreen:!0}));return this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}},t.prototype.setLocalVideoMirrorType=function(e){OW.print("setLocalVideoMirrorType()","mirrorType: %o",e),hk(e,"mirrorType",[B_.MIRROR_TYPE_NONE,B_.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){return ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){switch(i.label){case 0:return OW.print("setAudioPlaybackDevice()","deviceId: %s",e),lk(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(OW.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,LF.getDeviceById(e)];case 1:if(!(t=i.sent()))throw new lP(aP.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),this._audioPlaybackDeviceId=e,t&&this.safeEmit(df.onAudioPlaybackDeviceChanged,t),fx.rtcAudioDevice(WL.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){var t,i;return ef(this,void 0,void 0,(function(){var r,n,o;return tf(this,(function(a){switch(a.label){case 0:return OW.print("play()","userId | publicStreamId: %s",e),o=null===(i=null===(t=this._room)||void 0===t?void 0:t.remoteStreams.get(e||""))||void 0===i?void 0:i.find((function(e){return!e.isScreen})),r=this._remoteAudioPlayer.get(e||""),n=this._remoteVideoPlayer.get(e||""),r||(r=this._publicStreamAudioPlayer.get(e||"")),n||(n=this._publicStreamVideoPlayer.get(e||"")),e||!this._audioMixingManager?[3,2]:[4,this._audioMixingManager.resumeLocalPlay()];case 1:a.sent(),a.label=2;case 2:return!e&&this._videoPlayer&&(n=this._videoPlayer),n?n.played?[4,n.manuallyPlay()]:[3,4]:[3,5];case 3:return a.sent(),[3,5];case 4:o&&o.videoTrack?n.playVideo(o.videoTrack,o):!e&&this._localVideoTrack&&(n.mirror(!!this._mirrorType),n.playVideo(this._localVideoTrack)),a.label=5;case 5:return r?r.played?[4,r.manuallyPlay()]:[3,7]:[3,8];case 6:return a.sent(),[3,8];case 7:o&&o.audioTrack&&r.playAudio(o.audioTrack),a.label=8;case 8:return[2]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){return OW.print("pauseAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?[2,Promise.resolve()]:(t=function(){ak(e)&&(i._pauseAllSubscribeState.audio=!0),sk(e)&&(i._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()]))}))}))},t.prototype.resumeAllSubscribedStream=function(e){return ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){return OW.print("resumeAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video?(t=function(){ak(e)&&(i._pauseAllSubscribeState.audio=!1),sk(e)&&(i._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,r;t(),null===(r=null===(e=i._room)||void 0===e?void 0:e.remoteStreams)||void 0===r||r.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){i._updateAudioPlayerState(e),i._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])):[2,Promise.resolve()]}))}))},t.prototype.sendUserMessage=function(e,t){var i;return ef(this,void 0,void 0,(function(){var r,n=this;return tf(this,(function(o){if(mk(e),gk(t),!this._room||this._room.connectionState!==XB.CONNECTED)throw new lP(aP.IM_BEFORE_JOIN,"join first");return r=Date.now(),[2,null===(i=this._room.sendUserMessage(e,t))||void 0===i?void 0:i.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!1,r,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!1,r),t}))]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){var i;return ef(this,void 0,void 0,(function(){var r,n=this;return tf(this,(function(o){if(mk(e),_k(t,"message"),gk(t),!this._room||this._room.connectionState!==XB.CONNECTED)throw new lP(aP.IM_BEFORE_JOIN,"join first");return r=Date.now(),[2,null===(i=this._room.sendUserMessage(e,t))||void 0===i?void 0:i.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!0,r,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!0,r),t}))]}))}))},t.prototype.sendRoomMessage=function(e){return ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){if(gk(e),!this._room||this._room.connectionState!==XB.CONNECTED)throw new lP(aP.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e).then((function(e){var r,n;return i._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e})).catch((function(e){var r,n;throw i._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e}))]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){if(gk(e),!this._room||this._room.connectionState!==XB.CONNECTED)throw new lP(aP.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e,!0).then((function(e){var r,n;return i._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e})).catch((function(e){var r,n;throw i._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e}))]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:return OW.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,fk(e),i=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,i&&(this._audioStreamConstraints.deviceId=i),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){switch(r.label){case 0:return OW.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,fk(e),i=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=e,i&&(this._videoStreamConstraints.deviceId=i),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:r.sent(),this._updatePublish(),r.label=2;case 2:return[2]}}))}))},t.prototype.enableSimulcastMode=function(e){return OW.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0},t.prototype.setVideoEncoderConfig=function(e){var t;return ef(this,void 0,void 0,(function(){return tf(this,(function(i){return OW.print("setVideoEncoderConfig()"," descriptions: %o",e),Array.isArray(e)||(e=[e]),e.length>3&&(e=e.slice(0,3)),e.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._videoStreamEncodeConfig=e,(null===(t=this._room)||void 0===t?void 0:t.hasPublished)&&this._updatePublish(),[2]}))}))},t.prototype.setScreenEncoderConfig=function(e){var t;return ef(this,void 0,void 0,(function(){return tf(this,(function(i){return OW.print("setScreenEncoderConfig()","description: %o",e),this._screenStreamEncodeConfig=[e],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=e,this._localScreenVideoTrack.updateVideoCaptureConfig()),(null===(t=this._room)||void 0===t?void 0:t.hasScreenPublished)&&this._updateScreenPublish(),[2]}))}))},t.prototype.sendSEIMessage=function(e,t,i){var r,n,o,a,s,c;OW.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,i),hk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),dk(i,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(YD.str2ab(t)):t;if(t.length){var d;if(e===L_.STREAM_INDEX_MAIN){if(!(null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.hasPublished))return;d=null===(o=this._room)||void 0===o?void 0:o.localStream}else{if(!(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished))return;d=null===(c=this._room)||void 0===c?void 0:c.localScreenStream}if(u.byteLength>4096)OW.print("sei size must not bigger than 4KB");else{var l=zD();d.seiList.push({content:u,uuid:l,repeatCount:i}),setTimeout((function(){if(d){var e=d.seiList.findIndex((function(e){return e.uuid===l}));e&&d.seiList.splice(e,1)}}),2e3)}}else OW.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;OW.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var i=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,r;i=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var r;if(0!==e.length){var n=e.find((function(e){return!1===e.isScreen})),o=null===(r=null==n?void 0:n.audioTrack)||void 0===r?void 0:r.getAudioLevel();i.push({userId:t,volume:o||0})}}));var n=null===(r=t._localAudioTrack)||void 0===r?void 0:r.getAudioLevel();i.push({userId:t._getUserId(),volume:n||0}),t.safeEmit(df.onAudioVolumeIndication,{speakers:i})}),e)},t.prototype.enableAudioPropertiesReport=function(e){var t=this;void 0===e&&(e={}),OW.print("enableAudioPropertiesReport()","config %o: ",e);var i=e.interval,r=void 0===i?100:i,n=e.enableInBackground,o=void 0===n||n;this._stopAudioPropertiesReport(),r<=0||(r=Math.max(100,r),this._audioPropertiesReportTimer=self.setInterval((function(){if(o||"hidden"!==document.visibilityState){var e=[],i=t._audioDeviceManager.getRecordTrack()||t._localAudioTrack;if(i){var r=i.getAudioLevel();e.push({streamIndex:L_.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:r,nonlinearVolume:ok(r)}})}if(t._localScreenAudioTrack){r=t._localScreenAudioTrack.getAudioLevel();e.push({streamIndex:L_.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:r,nonlinearVolume:ok(r)}})}if(t.safeEmit(df.onLocalAudioPropertiesReport,e),t._room){var n=[];t._room.remoteStreams.forEach((function(e,i){e.forEach((function(e){var r,o;if(e.audioTrack){var a=e.audioTrack.getAudioLevel();n.push({streamKey:{userId:i,streamIndex:e.isScreen?L_.STREAM_INDEX_SCREEN:L_.STREAM_INDEX_MAIN,roomId:null===(o=null===(r=t._room)||void 0===r?void 0:r.roomInfo)||void 0===o?void 0:o.roomId},audioPropertiesInfo:{linearVolume:a,nonlinearVolume:ok(a)}})}}))})),t.safeEmit(df.onRemoteAudioPropertiesReport,n)}}}),r))},t.prototype.setVideoSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v,m,S;return ef(this,void 0,void 0,(function(){var y,g,E;return tf(this,(function(b){switch(b.label){case 0:return OW.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),hk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),hk(t,"VideoSourceType",[C_.VIDEO_SOURCE_TYPE_EXTERNAL,C_.VIDEO_SOURCE_TYPE_INTERNAL]),y=e===L_.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[y]===t?[3,4]:(this._trackSourceType[y]=t,OW.print("setVideoSourceType","set ".concat(y," source type to ").concat(t)),this._localVideoTrack&&e===L_.STREAM_INDEX_MAIN?(E=!1,t===C_.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,g=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,E?null===(a=null===(o=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!1):null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushVideo(!1),(null===(d=this._room)||void 0===d?void 0:d.hasPublished)||g?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===L_.STREAM_INDEX_SCREEN?(E=!1,t===C_.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localScreenVideoTrack.close()),null===(l=this._screenPlayer)||void 0===l||l.stop(),this._localScreenVideoTrack=void 0,E?null===(_=null===(p=null===(h=this._room)||void 0===h?void 0:h.localScreenStream)||void 0===p?void 0:p.observer)||void 0===_||_.setEnableVideo(!1):null===(m=null===(v=null===(f=this._room)||void 0===f?void 0:f.localScreenStream)||void 0===v?void 0:v.observer)||void 0===m||m.setPushVideo(!1),(null===(S=this._room)||void 0===S?void 0:S.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:b.sent(),b.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var i,r,n,o,a,s,c,u;return ef(this,void 0,void 0,(function(){var d;return tf(this,(function(l){switch(l.label){case 0:if(OW.print("setExternalVideoTrack()","index: %o, track: %o",e,t),hk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),e!==L_.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==C_.VIDEO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new eB(t,zD()),this._initLocalTrackEvents(this._localVideoTrack),null===(i=this._videoPlayer)||void 0===i||i.playVideo(this._localVideoTrack),d=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||d?[4,this._updatePublish()]:[3,2];case 1:l.sent(),l.label=2;case 2:if(e!==L_.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==C_.VIDEO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new eB(t,zD()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushVideo(!0),(null===(u=this._room)||void 0===u?void 0:u.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,_,f,v;return ef(this,void 0,void 0,(function(){var m,S,y;return tf(this,(function(g){switch(g.label){case 0:return OW.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),hk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),hk(t,"audioSourceType",[O_.AUDIO_SOURCE_TYPE_EXTERNAL,O_.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===L_.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,OW.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===L_.STREAM_INDEX_MAIN?(y=!1,this._trackSourceType.audio===O_.AUDIO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,S=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,y?null===(o=null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setEnableAudio(!1):null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushAudio(!1),(null===(u=this._room)||void 0===u?void 0:u.hasPublished)||S?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:g.sent(),g.label=2;case 2:return this._localScreenAudioTrack&&e===L_.STREAM_INDEX_SCREEN?(y=!1,this._trackSourceType.audio===O_.AUDIO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,y?null===(h=null===(l=null===(d=this._room)||void 0===d?void 0:d.localScreenStream)||void 0===l?void 0:l.observer)||void 0===h||h.setEnableAudio(!1):null===(f=null===(_=null===(p=this._room)||void 0===p?void 0:p.localScreenStream)||void 0===_?void 0:_.observer)||void 0===f||f.setPushAudio(!1),(null===(v=this._room)||void 0===v?void 0:v.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:g.sent(),g.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var i,r,n,o,a,s,c,u,d;return ef(this,void 0,void 0,(function(){var l;return tf(this,(function(h){switch(h.label){case 0:if(OW.print("setExternalAudioTrack()","index: %o, track: %o",e,t),hk(e,"streamIndex",[L_.STREAM_INDEX_MAIN,L_.STREAM_INDEX_SCREEN]),e!==L_.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==O_.AUDIO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new tB(t,zD()),this._initLocalTrackEvents(this._localAudioTrack),l=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,null===(o=null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setPushAudio(!0),(null===(a=this._room)||void 0===a?void 0:a.hasPublished)||l?[4,this._updatePublish()]:[3,2];case 1:h.sent(),h.label=2;case 2:if(e!==L_.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==O_.AUDIO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new tB(t,zD()),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localScreenStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushAudio(!0),(null===(d=this._room)||void 0===d?void 0:d.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},t.prototype.login=function(e,t){return ef(this,void 0,void 0,(function(){return tf(this,(function(i){return OW.print("login()","token: %o, userInfo: %o",e,t),vk(e)||lk(e,"token"),mk(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return ef(this,void 0,void 0,(function(){return tf(this,(function(e){return OW.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){return OW.print("updateLoginToken()","token: %o",e),vk(e)||lk(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){return OW.print("getPeerOnlineStatus()","userId: %o",e),mk(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return ef(this,void 0,void 0,(function(){var i,r=this;return tf(this,(function(n){mk(e),gk(t),i=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return r._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!1,i,t),t.id})).catch((function(t){throw r._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,i),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,i),t}return[2]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return ef(this,void 0,void 0,(function(){var i,r=this;return tf(this,(function(n){mk(e),_k(t,"message"),gk(t),i=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return r._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!0,i,t),t.id})).catch((function(t){throw r._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,i),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,i),t}return[2]}))}))},t.prototype.setServerParams=function(e,t){return ef(this,void 0,void 0,(function(){return tf(this,(function(i){return OW.print("setServerParams()","signature: %o, url: %0",e,t),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){lk(e,"message"),gk(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){i._messageStatisticsObserver.countServerMessage(!0,!1,t)})).catch((function(e){throw i._messageStatisticsObserver.countServerMessage(!1,!1,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!1,t),e}return[2]}))}))},t.prototype.sendServerBinaryMessage=function(e){return ef(this,void 0,void 0,(function(){var t,i=this;return tf(this,(function(r){_k(e,"message"),gk(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){i._messageStatisticsObserver.countServerMessage(!0,!0,t)})).catch((function(e){throw i._messageStatisticsObserver.countServerMessage(!1,!0,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!0,t),e}return[2]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new lP(aP.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;OW.print("startCloudProxy()",e),lk(e.logProxy,"logProxy"),lk(e.accessProxy,"accessProxy"),lk(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=Fx("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=Fx("LOG_SERVER_URL"),this._originConfigServerUrls=Fx("CONFIG_REQUEST_DOMAINS"),Vx("ICE_CONFIG_REQUEST_URLS",e.accessProxy),Vx("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),Vx("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new lP(aP.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");OW.print("stopCloudProxy()"),Vx("ICE_CONFIG_REQUEST_URLS",[]),Vx("LOG_SERVER_URL",this._originLogServerUrl),Vx("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0},t.prototype.startPushPublicStream=function(e,t){return ef(this,void 0,void 0,(function(){var i,r=this;return tf(this,(function(n){if(OW.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),Sk(e),!this._room||this._room.connectionState!==XB.CONNECTED)throw new lP(aP.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new lP(aP.REPEAT_PUSH,"repeat push public media stream");return i=jx(e,"started",t),[2,this._room.publicStreamControlMessage(i).then((function(){r._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return ef(this,void 0,void 0,(function(){var i;return tf(this,(function(r){if(OW.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),Sk(e),!this._room||this._room.connectionState!==XB.CONNECTED)throw new lP(aP.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return i=jx(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(i)]}))}))},t.prototype.stopPushPublicStream=function(e){return ef(this,void 0,void 0,(function(){var t=this;return tf(this,(function(i){if(OW.print("startPushPublicStream()","publicStreamId: %o",e),Sk(e),!this._room||this._room.connectionState!==XB.CONNECTED)throw new lP(aP.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return[2,this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:e}).then((function(){t._publicStreamIds.delete(e)}))]}))}))},t.prototype.startPlayPublicStream=function(e){var t,i,r;return ef(this,void 0,void 0,(function(){var n,o,a,s=this;return tf(this,(function(c){switch(c.label){case 0:return Sk(e),this._outsideRoom?[3,2]:(this._outsideRoom=new IW(this._appId),this._outsideRoom.on(fB.RESUBSCRIBE,(function(e){var t,i,r=e.stream;if(r){var n=s._publicStreamAudioPlayer.get(r.streamId);n&&r.audioTrack&&(n.stop(),n.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var o=s._publicStreamVideoPlayer.get(r.streamId);o&&r.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(t=this._outsideRoom)||void 0===t||t.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,s.safeEmit(df.onPublicStreamStats,e)})),null===(i=this._outsideRoom)||void 0===i||i.on(fB.ON_SEI_MESSAGED_RECEIVED,(function(e){s.safeEmit(df.onPublicStreamSEIMessageReceived,e)})),[4,this._outsideRoom.connect()]);case 1:c.sent(),c.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return n=c.sent(),(o=this._publicStreamVideoPlayer.get(e))&&(null==n?void 0:n.videoTrack)&&o.playVideo(n.videoTrack,n),!(a=this._publicStreamAudioPlayer.get(e))&&(null==n?void 0:n.audioTrack)&&(a=new Oj(e,{muted:(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)===Q_.VIDEO_ONLY}),this._initPlayerEvents(a,!0),a.playAudio(n.audioTrack),this._publicStreamAudioPlayer.set(e,a)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return ef(this,void 0,void 0,(function(){var t;return tf(this,(function(i){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.destroy(),this._publicStreamAudioPlayer.delete(e)),[2]):[2]}))}))},t.prototype.setAudioProfile=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){return this._audioProfileManager.setAudioProfile(e),[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var i,r,n;OW.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var o=this._publicStreamVideoPlayer.get(e);if(!(null==t?void 0:t.renderDom)&&o)return o.destroy(),void this._publicStreamVideoPlayer.delete(e);if(!o){o=new Cj(Z_(Z_({},t),{userId:e})),this._initPlayerEvents(o,!0),this._publicStreamVideoPlayer.set(e,o);var a=null===(r=null===(i=this._outsideRoom)||void 0===i?void 0:i.remoteStreams)||void 0===r?void 0:r.get(e);(null==a?void 0:a.videoTrack)&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Q_.PLAY_MANUALLY&&o.playVideo(a.videoTrack,a)}},t.prototype.setDummyCaptureImagePath=function(e,t){return ef(this,void 0,void 0,(function(){var i=this;return tf(this,(function(r){return[2,new Promise((function(r,n){lk(t,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=t,o.onload=function(){try{var t=document.createElement("canvas"),a=t.getContext("2d");if(!a)return n(new lP(aP.UNEXPECTED_ERROR,"Not support canvas"));t.width=o.width,t.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(i._dummyTimer),i._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=t.captureStream(5).getVideoTracks()[0];e===L_.STREAM_INDEX_MAIN?i._localImgVideoTrack=s:i._localImgScreenTrack=s,r()}catch(e){n(new lP(aP.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){n(new lP(aP.UNEXPECTED_ERROR,"Load image error"))}}))]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify($x))},t.prototype._updatePublish=function(e){return void 0===e&&(e={}),ef(this,void 0,void 0,(function(){var t,i,r;return tf(this,(function(n){switch(n.label){case 0:if(OW.print("_updatePublish()","config: %o",e),t={mediaType:void 0,invokeByJoinRoom:!1,pubState:SB.PUB},e=Z_(Z_({},t),e),!this._visibility)throw new lP(aP.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==XB.CONNECTED)return i(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,e.mediaType,e.pubState,e.invokeByJoinRoom)];case 3:return n.sent(),[3,6];case 4:throw(r=n.sent())instanceof lP?r:new lP(aP.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype.startAudioPlaybackDeviceTest=function(e,t){return ef(this,void 0,void 0,(function(){return tf(this,(function(i){switch(i.label){case 0:return OW.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",e,t),lk(e,"filePath"),dk(t,"indicationInterval"),[4,this._audioDeviceManager.startAudioPlaybackDeviceTest(e,t)];case 1:return[2,i.sent()]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){OW.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()},t.prototype.startAudioDeviceRecordTest=function(e){return ef(this,void 0,void 0,(function(){return tf(this,(function(t){switch(t.label){case 0:return OW.print("startAudioDeviceRecordTest()","indicationInterval: %o",e),dk(e,"indicationInterval"),[4,this._audioDeviceManager.startAudioDeviceRecordTest(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){OW.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()},t.prototype.stopAudioDevicePlayTest=function(){OW.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()},t.prototype.setRemoteUserPriority=function(e,t){var i;OW.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{mk(e),hk(t,"priority",[W_.HIGH,W_.MEDIUM,W_.LOW])}catch(e){return console.warn(e),!1}return this._userPriorityMap.set(e,t),null===(i=this._room)||void 0===i||i.setRemoteUserPriority(e,t),!0},t.prototype.setSubscribeFallbackOption=function(e){OW.print("setSubscribeFallbackOption()","option: %o",e);try{hk(e,"option",[K_.DISABLE,K_.VIDEO_STREAM_LOW,K_.AUDIO_ONLY])}catch(e){return console.warn(e),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)},t.prototype._updateScreenPublish=function(e){return void 0===e&&(e={}),ef(this,void 0,void 0,(function(){var t,i,r;return tf(this,(function(n){switch(n.label){case 0:return OW.print("_updateScreenPublish()"),t={mediaType:void 0,pubState:SB.PUB},e=Z_(Z_({},t),e),[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==XB.CONNECTED)return i(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,e.mediaType,e.pubState)];case 3:return n.sent(),[3,6];case 4:throw(r=n.sent())instanceof lP?r:new lP(aP.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){var t,i;OW.print("_updateAudioPlayerState()");var r,n=e.userId,o=e.isScreen;if(r=o?this._remoteAudioPlayer.get("".concat(n,"_screen")):this._remoteAudioPlayer.get(n),e.audioTrack){if(!r){var a=o?"".concat(n,"_screen"):n;r=new Oj(a,{muted:(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)===Q_.VIDEO_ONLY}),this._initPlayerEvents(r),this._remoteAudioPlayer.set(a,r),this._audioPlaybackDeviceId&&r.setPlaybackDevice(this._audioPlaybackDeviceId)}(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==Q_.PLAY_MANUALLY&&r.playAudio(e.audioTrack)}else null==r||r.stop()},t.prototype._updateVideoPlayerState=function(e){var t;OW.print("_updateVideoPlayerState()");var i,r=e.userId;i=e.isScreen?this._remoteScreenPlayer.get(r):this._remoteVideoPlayer.get(r),e.videoTrack?i&&(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)!==Q_.PLAY_MANUALLY&&i.playVideo(e.videoTrack,e):(null==i?void 0:i.played)&&(null==i||i.stop())},t.prototype._onAddStream=function(e){var t=e.stream,i=null==t?void 0:t.attributes,r=i.localaudio,n=i.audiostream,o=i.localvideo,a=i.videostream,s=MF.NONE;n&&(s|=x_.AUDIO),a&&(s|=x_.VIDEO),s&&((null==t?void 0:t.isScreen)?this.safeEmit(df.onUserPublishScreen,{userId:t.userId,mediaType:s}):(this.safeEmit(df.onUserPublishStream,{userId:t.userId,mediaType:s}),this._handleAutoSubscribe(t,!0)),(null==t?void 0:t.isScreen)||(r&&this.safeEmit(df.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(df.onUserStartVideoCapture,{userId:t.userId})))},t.prototype._handleAutoSubscribe=function(e,t){var i,r,n,o,a=MF.NONE;(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(a|=x_.AUDIO),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(a|=x_.VIDEO),OW.print("_onAddStream","autoSubType: ".concat(a)),a&&(t&&ak(a)&&(null===(n=e.observer)||void 0===n||n.setAutoSubscribeAudio(!0)),t&&sk(a)&&(null===(o=e.observer)||void 0===o||o.setAutoSubscribeVideo(!0)),this._subscribe(!1,e.userId,a))},t.prototype._onRemoveStream=function(e){var t,i=this,r=e.stream,n=null!==(t=NW[e.reason])&&void 0!==t?t:V_.STREAM_REMOVE_REASON_OTHER,o=r.isScreen?df.onUserUnpublishScreen:df.onUserUnpublishStream,a=x_.AUDIO_AND_VIDEO;(null==r?void 0:r._workaround_1_)&&(a=x_.VIDEO),this.safeEmit(o,{userId:r.userId,mediaType:a,reason:n}),this._getRemotePlayer(r.userId,r.isScreen).forEach((function(e){if(!(null==r?void 0:r._workaround_1_)){var t=r.isScreen?"".concat(r.userId,"_screen"):r.userId;i._remoteAudioPlayer.delete(t),r.isScreen?i._remoteScreenPlayer.delete(r.userId):i._remoteVideoPlayer.delete(r.userId),null==e||e.destroy()}}))},t.prototype._onUserConnection=function(e){this.safeEmit(df.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(df.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(df.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onNetworkQuality=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.safeEmit.apply(this,of([df.onNetworkQuality],nf(e),!1))},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===F_.CONNECTION_STATE_CONNECTED&&this.safeEmit(df.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(df.onConnectionStateChanged,e)},t.prototype._getRemotePlayer=function(e,t){return[this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]},t.prototype._stopAudioPropertiesReport=function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)},t.prototype._onResubscribe=function(e){e.stream&&(this._getRemotePlayer(e.stream.userId,e.stream.isScreen).forEach((function(e){return null==e?void 0:e.stop()})),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))},t.prototype._onSubscribePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onRemovePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onVideoFirstFrameDecoded=function(e){this.safeEmit(df.onVideoFirstFrameDecoded,e)},t.prototype._onVideoDeviceStateChange=function(e){this.safeEmit(df.onVideoDeviceStateChanged,e)},t.prototype._onAudioDeviceStateChange=function(e){this.safeEmit(df.onAudioDeviceStateChanged,e)},t.prototype._onUserPublishStateChange=function(e){var t=e.userId,i=e.isScreen,r=e.mediaType,n=e.pubState,o=e.remoteStream,a={userId:t,mediaType:r};i?n===SB.PUB?this.safeEmit(df.onUserPublishScreen,a):this.safeEmit(df.onUserUnpublishScreen,Z_(Z_({},a),{reason:V_.STREAM_REMOVE_REASON_UNPUBLISH})):n===SB.PUB?(this.safeEmit(df.onUserPublishStream,a),this._handleAutoSubscribe(o,!0)):this.safeEmit(df.onUserUnpublishStream,Z_(Z_({},a),{reason:V_.STREAM_REMOVE_REASON_UNPUBLISH}))},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(df.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(df.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(df.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(df.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(df.onLiveTranscodingResult,e)},t.prototype._onStreamMixingEvent=function(e){this.safeEmit(df.onStreamMixingEvent,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(df.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(df.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(df.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(df.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(df.onError,{errorCode:aP.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(df.onError,{errorCode:aP.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(df.onServerParamsSetResult,null==e?void 0:e.code)}))},Object.defineProperty(t.prototype,"waitForNewToken",{get:function(){return!!this._tempRoomConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localAudioTrack",{get:function(){return this._localAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localVideoTrack",{get:function(){return this._localVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenAudioTrack",{get:function(){return this._localScreenAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenVideoTrack",{get:function(){return this._localScreenVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){var e,t,i=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteStreams)&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){i.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))}))),i},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){var e,t,i=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteUsers)&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){i.push({userId:e.userId})}))),i},enumerable:!1,configurable:!0}),t.prototype._handleAudioDeviceManager=function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(df.onAudioPlaybackDeviceTestVolume,t)}))},t.prototype._assertNotInRoom=function(){if(!this._room||this._room.connectionState!==XB.CONNECTED)throw new lP(aP.INVOKED_BEFORE_JOIN_ROOM,"join first")},t.prototype._checkMediaType=function(e){hk(e,"mediaType",[x_.AUDIO,x_.VIDEO,x_.AUDIO_AND_VIDEO])},t.prototype._getUserId=function(){var e,t;return(null===(t=null===(e=this._room)||void 0===e?void 0:e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"},$_([bx()],t.prototype,"updateToken",null),$_([bx()],t.prototype,"setVideoCaptureDevice",null),$_([bx()],t.prototype,"setAudioCaptureDevice",null),$_([bx()],t.prototype,"joinRoom",null),$_([bx()],t.prototype,"leaveRoom",null),$_([bx()],t.prototype,"destroy",null),$_([bx()],t.prototype,"publishStream",null),$_([bx()],t.prototype,"unpublishStream",null),$_([bx()],t.prototype,"publishScreen",null),$_([bx()],t.prototype,"unpublishScreen",null),$_([bx()],t.prototype,"subscribeStream",null),$_([bx()],t.prototype,"unsubscribeStream",null),$_([bx()],t.prototype,"subscribeScreen",null),$_([bx()],t.prototype,"unsubscribeScreen",null),$_([bx()],t.prototype,"setRemoteVideoConfig",null),$_([bx()],t.prototype,"startVideoCapture",null),$_([bx()],t.prototype,"stopVideoCapture",null),$_([bx()],t.prototype,"startAudioCapture",null),$_([bx()],t.prototype,"stopAudioCapture",null),$_([bx()],t.prototype,"getAudioMixingManager",null),$_([bx()],t.prototype,"startScreenCapture",null),$_([bx()],t.prototype,"stopScreenCapture",null),$_([bx()],t.prototype,"setLocalVideoPlayer",null),$_([bx()],t.prototype,"startLiveTranscoding",null),$_([bx()],t.prototype,"updateLiveTranscoding",null),$_([bx()],t.prototype,"stopLiveTranscoding",null),$_([bx()],t.prototype,"setBusinessId",null),$_([bx()],t.prototype,"setUserVisibility",null),$_([bx()],t.prototype,"setRemoteVideoPlayer",null),$_([bx()],t.prototype,"setLocalVideoMirrorType",null),$_([bx()],t.prototype,"setAudioPlaybackDevice",null),$_([bx()],t.prototype,"play",null),$_([bx()],t.prototype,"pauseAllSubscribedStream",null),$_([bx()],t.prototype,"resumeAllSubscribedStream",null),$_([bx()],t.prototype,"sendUserMessage",null),$_([bx()],t.prototype,"sendUserBinaryMessage",null),$_([bx()],t.prototype,"sendRoomMessage",null),$_([bx()],t.prototype,"sendRoomBinaryMessage",null),$_([bx()],t.prototype,"setAudioCaptureConfig",null),$_([bx()],t.prototype,"setVideoCaptureConfig",null),$_([bx()],t.prototype,"enableSimulcastMode",null),$_([bx()],t.prototype,"setVideoEncoderConfig",null),$_([bx()],t.prototype,"setScreenEncoderConfig",null),$_([bx()],t.prototype,"sendSEIMessage",null),$_([bx()],t.prototype,"setAudioVolumeIndicationInterval",null),$_([bx()],t.prototype,"enableAudioPropertiesReport",null),$_([bx()],t.prototype,"setVideoSourceType",null),$_([bx()],t.prototype,"setExternalVideoTrack",null),$_([bx()],t.prototype,"setAudioSourceType",null),$_([bx()],t.prototype,"setExternalAudioTrack",null),$_([bx("rtm")],t.prototype,"login",null),$_([bx("rtm")],t.prototype,"logout",null),$_([bx("rtm")],t.prototype,"updateLoginToken",null),$_([bx("rtm")],t.prototype,"getPeerOnlineStatus",null),$_([bx("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),$_([bx("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),$_([bx("rtm")],t.prototype,"setServerParams",null),$_([bx("rtm")],t.prototype,"sendServerMessage",null),$_([bx("rtm")],t.prototype,"sendServerBinaryMessage",null),$_([bx()],t.prototype,"startCloudProxy",null),$_([bx()],t.prototype,"stopCloudProxy",null),$_([bx()],t.prototype,"startPushPublicStream",null),$_([bx()],t.prototype,"updatePublicStreamParam",null),$_([bx()],t.prototype,"stopPushPublicStream",null),$_([bx("outsideRoom")],t.prototype,"startPlayPublicStream",null),$_([bx("outsideRoom")],t.prototype,"stopPlayPublicStream",null),$_([bx()],t.prototype,"setAudioProfile",null),$_([bx("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),$_([bx()],t.prototype,"setDummyCaptureImagePath",null),$_([bx()],t.prototype,"startAudioPlaybackDeviceTest",null),$_([bx()],t.prototype,"stopAudioPlaybackDeviceTest",null),$_([bx()],t.prototype,"startAudioDeviceRecordTest",null),$_([bx()],t.prototype,"stopAudioDeviceRecordAndPlayTest",null),$_([bx()],t.prototype,"stopAudioDevicePlayTest",null),$_([bx()],t.prototype,"setRemoteUserPriority",null),$_([bx()],t.prototype,"setSubscribeFallbackOption",null),t}(wk),NW={"client unpublished":V_.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":V_.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":V_.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":V_.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":V_.STREAM_REMOVE_REASON_REPUBLISH},PW=new Ck("VERTC",0);[Sx,yx,gx].forEach((function(e){return e.setStats({rtc_sdk_version:iV.VERSION,product_line:gL.RTC,report_version:EL.W_5,os:bL.WEB,device_id:Dx.getDeviceId(),user_agent:XD()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var DW=function(e,t){return PW.print("createEngine","Invoke VERTC.createEngine"),lk(e,"appId"),[Sx,yx,gx].forEach((function(i){return i.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),fx.sdkInitEngine(Date.now(),ZL.BEGIN),new wW(e,t)},kW=function(e){if(PW.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof wW))throw new lP(aP.INVALID_ENGINE,"Invalid engine object");e.destroy(),fx.sdkInitEngine(Date.now(),ZL.END)},MW=function(){return ef(void 0,void 0,void 0,(function(){return tf(this,(function(e){return[2,LF.enumerateDevices()]}))}))},UW=function(e){return void 0===e&&(e={video:!0,audio:!0}),ef(void 0,void 0,void 0,(function(){var t,i,r,n,o;return tf(this,(function(a){switch(a.label){case 0:if(t=e.video,i=e.audio,r={video:!1,audio:!1},!t)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),n=r,[4,LF.getVideoPermission()];case 2:return n.video=a.sent(),[3,4];case 3:return a.sent(),[3,4];case 4:if(!i)return[3,8];a.label=5;case 5:return a.trys.push([5,7,,8]),o=r,[4,LF.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,r]}}))}))},LW=function(){return ef(void 0,void 0,void 0,(function(){return tf(this,(function(e){return[2,LF.enumerateAudioCaptureDevices()]}))}))},xW=function(){return ef(void 0,void 0,void 0,(function(){return tf(this,(function(e){return[2,LF.enumerateVideoCaptureDevices()]}))}))},VW=function(){return ef(void 0,void 0,void 0,(function(){return tf(this,(function(e){return[2,LF.enumerateAudioPlaybackDevices()]}))}))},FW=function(){return iV.VERSION},BW=function(){return fx.rtcSdkApiCall("isSupported",0,""),ef(void 0,void 0,void 0,(function(){var e;return tf(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),!XD()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,CV()]:[2,!1];case 1:return[2,null==(e=t.sent())?void 0:e.includes("H264")];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},jW=function(){return fx.rtcSdkApiCall("getSupportedCodecs",0,""),ef(void 0,void 0,void 0,(function(){return tf(this,(function(e){switch(e.label){case 0:return[4,CV()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!XD()&&location.search.includes("_rtc_autotest_");var GW=new function(){this.getSdkVersion=FW,this.createEngine=DW,this.destroyEngine=kW,this.enumerateDevices=MW,this.enableDevices=UW,this.enumerateAudioCaptureDevices=LW,this.enumerateVideoCaptureDevices=xW,this.enumerateAudioPlaybackDevices=VW,this.getParameter=Fx,this.setParameter=Vx,this.isSupported=BW,this.getSupportedCodecs=jW,this.events=df,this.ErrorCode=aP,this.platform="BytePlus",this._monitor=fx};return Z_(Z_(Z_(Z_({},GW),uf),hf),{events:df})}));
|
|
6
|
+
!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).BytePlusRTC=t()}(this,(function(){"use strict";function e(e,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(i){if("default"!==i&&!(i in e)){var r=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,r.get?r:{enumerable:!0,get:function(){return t[i]}})}}))})),Object.freeze(e)}function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},t(e)}var i="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var r=function(e){return e&&e.Math==Math&&e},n=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof i&&i)||function(){return this}()||Function("return this")(),o={},a=function(e){try{return!!e()}catch(e){return!0}},s=!a((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),c=!a((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),u=c,d=Function.prototype.call,l=u?d.bind(d):function(){return d.apply(d,arguments)},h={},p={}.propertyIsEnumerable,f=Object.getOwnPropertyDescriptor,_=f&&!p.call({1:2},1);h.f=_?function(e){var t=f(this,e);return!!t&&t.enumerable}:p;var v,m,y=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},S=c,g=Function.prototype,E=g.bind,b=g.call,T=S&&E.bind(b,b),I=S?function(e){return e&&T(e)}:function(e){return e&&function(){return b.apply(e,arguments)}},R=I,A=R({}.toString),C=R("".slice),O=function(e){return C(A(e),8,-1)},w=I,N=a,P=O,k=n.Object,D=w("".split),M=N((function(){return!k("z").propertyIsEnumerable(0)}))?function(e){return"String"==P(e)?D(e,""):k(e)}:k,U=n.TypeError,L=function(e){if(null==e)throw U("Can't call method on "+e);return e},x=M,V=L,F=function(e){return x(V(e))},B=function(e){return"function"==typeof e},j=B,G=function(e){return"object"==typeof e?null!==e:j(e)},H=n,z=B,K=function(e){return z(e)?e:void 0},W=function(e,t){return arguments.length<2?K(H[e]):H[e]&&H[e][t]},X=I({}.isPrototypeOf),Y=W("navigator","userAgent")||"",q=n,J=Y,Q=q.process,Z=q.Deno,$=Q&&Q.versions||Z&&Z.version,ee=$&&$.v8;ee&&(m=(v=ee.split("."))[0]>0&&v[0]<4?1:+(v[0]+v[1])),!m&&J&&(!(v=J.match(/Edge\/(\d+)/))||v[1]>=74)&&(v=J.match(/Chrome\/(\d+)/))&&(m=+v[1]);var te=m,ie=te,re=a,ne=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ie&&ie<41})),oe=ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ae=W,se=B,ce=X,ue=oe,de=n.Object,le=ue?function(e){return"symbol"==typeof e}:function(e){var t=ae("Symbol");return se(t)&&ce(t.prototype,de(e))},he=n.String,pe=function(e){try{return he(e)}catch(e){return"Object"}},fe=B,_e=pe,ve=n.TypeError,me=function(e){if(fe(e))return e;throw ve(_e(e)+" is not a function")},ye=me,Se=function(e,t){var i=e[t];return null==i?void 0:ye(i)},ge=l,Ee=B,be=G,Te=n.TypeError,Ie={exports:{}},Re=n,Ae=Object.defineProperty,Ce=function(e,t){try{Ae(Re,e,{value:t,configurable:!0,writable:!0})}catch(i){Re[e]=t}return t},Oe=Ce,we="__core-js_shared__",Ne=n[we]||Oe(we,{}),Pe=Ne;(Ie.exports=function(e,t){return Pe[e]||(Pe[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ke=L,De=n.Object,Me=function(e){return De(ke(e))},Ue=Me,Le=I({}.hasOwnProperty),xe=Object.hasOwn||function(e,t){return Le(Ue(e),t)},Ve=I,Fe=0,Be=Math.random(),je=Ve(1..toString),Ge=function(e){return"Symbol("+(void 0===e?"":e)+")_"+je(++Fe+Be,36)},He=n,ze=Ie.exports,Ke=xe,We=Ge,Xe=ne,Ye=oe,qe=ze("wks"),Je=He.Symbol,Qe=Je&&Je.for,Ze=Ye?Je:Je&&Je.withoutSetter||We,$e=function(e){if(!Ke(qe,e)||!Xe&&"string"!=typeof qe[e]){var t="Symbol."+e;Xe&&Ke(Je,e)?qe[e]=Je[e]:qe[e]=Ye&&Qe?Qe(t):Ze(t)}return qe[e]},et=l,tt=G,it=le,rt=Se,nt=function(e,t){var i,r;if("string"===t&&Ee(i=e.toString)&&!be(r=ge(i,e)))return r;if(Ee(i=e.valueOf)&&!be(r=ge(i,e)))return r;if("string"!==t&&Ee(i=e.toString)&&!be(r=ge(i,e)))return r;throw Te("Can't convert object to primitive value")},ot=$e,at=n.TypeError,st=ot("toPrimitive"),ct=function(e,t){if(!tt(e)||it(e))return e;var i,r=rt(e,st);if(r){if(void 0===t&&(t="default"),i=et(r,e,t),!tt(i)||it(i))return i;throw at("Can't convert object to primitive value")}return void 0===t&&(t="number"),nt(e,t)},ut=ct,dt=le,lt=function(e){var t=ut(e,"string");return dt(t)?t:t+""},ht=G,pt=n.document,ft=ht(pt)&&ht(pt.createElement),_t=function(e){return ft?pt.createElement(e):{}},vt=_t,mt=!s&&!a((function(){return 7!=Object.defineProperty(vt("div"),"a",{get:function(){return 7}}).a})),yt=s,St=l,gt=h,Et=y,bt=F,Tt=lt,It=xe,Rt=mt,At=Object.getOwnPropertyDescriptor;o.f=yt?At:function(e,t){if(e=bt(e),t=Tt(t),Rt)try{return At(e,t)}catch(e){}if(It(e,t))return Et(!St(gt.f,e,t),e[t])};var Ct={},Ot=s&&a((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),wt=n,Nt=G,Pt=wt.String,kt=wt.TypeError,Dt=function(e){if(Nt(e))return e;throw kt(Pt(e)+" is not an object")},Mt=s,Ut=mt,Lt=Ot,xt=Dt,Vt=lt,Ft=n.TypeError,Bt=Object.defineProperty,jt=Object.getOwnPropertyDescriptor,Gt="enumerable",Ht="configurable",zt="writable";Ct.f=Mt?Lt?function(e,t,i){if(xt(e),t=Vt(t),xt(i),"function"==typeof e&&"prototype"===t&&"value"in i&&zt in i&&!i.writable){var r=jt(e,t);r&&r.writable&&(e[t]=i.value,i={configurable:Ht in i?i.configurable:r.configurable,enumerable:Gt in i?i.enumerable:r.enumerable,writable:!1})}return Bt(e,t,i)}:Bt:function(e,t,i){if(xt(e),t=Vt(t),xt(i),Ut)try{return Bt(e,t,i)}catch(e){}if("get"in i||"set"in i)throw Ft("Accessors not supported");return"value"in i&&(e[t]=i.value),e};var Kt=Ct,Wt=y,Xt=s?function(e,t,i){return Kt.f(e,t,Wt(1,i))}:function(e,t,i){return e[t]=i,e},Yt={exports:{}},qt=B,Jt=Ne,Qt=I(Function.toString);qt(Jt.inspectSource)||(Jt.inspectSource=function(e){return Qt(e)});var Zt,$t,ei,ti=Jt.inspectSource,ii=B,ri=ti,ni=n.WeakMap,oi=ii(ni)&&/native code/.test(ri(ni)),ai=Ie.exports,si=Ge,ci=ai("keys"),ui=function(e){return ci[e]||(ci[e]=si(e))},di={},li=oi,hi=n,pi=I,fi=G,_i=Xt,vi=xe,mi=Ne,yi=ui,Si=di,gi="Object already initialized",Ei=hi.TypeError,bi=hi.WeakMap;if(li||mi.state){var Ti=mi.state||(mi.state=new bi),Ii=pi(Ti.get),Ri=pi(Ti.has),Ai=pi(Ti.set);Zt=function(e,t){if(Ri(Ti,e))throw new Ei(gi);return t.facade=e,Ai(Ti,e,t),t},$t=function(e){return Ii(Ti,e)||{}},ei=function(e){return Ri(Ti,e)}}else{var Ci=yi("state");Si[Ci]=!0,Zt=function(e,t){if(vi(e,Ci))throw new Ei(gi);return t.facade=e,_i(e,Ci,t),t},$t=function(e){return vi(e,Ci)?e[Ci]:{}},ei=function(e){return vi(e,Ci)}}var Oi={set:Zt,get:$t,has:ei,enforce:function(e){return ei(e)?$t(e):Zt(e,{})},getterFor:function(e){return function(t){var i;if(!fi(t)||(i=$t(t)).type!==e)throw Ei("Incompatible receiver, "+e+" required");return i}}},wi=s,Ni=xe,Pi=Function.prototype,ki=wi&&Object.getOwnPropertyDescriptor,Di=Ni(Pi,"name"),Mi={EXISTS:Di,PROPER:Di&&"something"===function(){}.name,CONFIGURABLE:Di&&(!wi||wi&&ki(Pi,"name").configurable)},Ui=n,Li=B,xi=xe,Vi=Xt,Fi=Ce,Bi=ti,ji=Mi.CONFIGURABLE,Gi=Oi.get,Hi=Oi.enforce,zi=String(String).split("String");(Yt.exports=function(e,t,i,r){var n,o=!!r&&!!r.unsafe,a=!!r&&!!r.enumerable,s=!!r&&!!r.noTargetGet,c=r&&void 0!==r.name?r.name:t;Li(i)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!xi(i,"name")||ji&&i.name!==c)&&Vi(i,"name",c),(n=Hi(i)).source||(n.source=zi.join("string"==typeof c?c:""))),e!==Ui?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=i:Vi(e,t,i)):a?e[t]=i:Fi(t,i)})(Function.prototype,"toString",(function(){return Li(this)&&Gi(this).source||Bi(this)}));var Ki={},Wi=Math.ceil,Xi=Math.floor,Yi=function(e){var t=+e;return t!=t||0===t?0:(t>0?Xi:Wi)(t)},qi=Yi,Ji=Math.max,Qi=Math.min,Zi=function(e,t){var i=qi(e);return i<0?Ji(i+t,0):Qi(i,t)},$i=Yi,er=Math.min,tr=function(e){return e>0?er($i(e),9007199254740991):0},ir=tr,rr=function(e){return ir(e.length)},nr=F,or=Zi,ar=rr,sr=function(e){return function(t,i,r){var n,o=nr(t),a=ar(o),s=or(r,a);if(e&&i!=i){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===i)return e||s||0;return!e&&-1}},cr={includes:sr(!0),indexOf:sr(!1)},ur=xe,dr=F,lr=cr.indexOf,hr=di,pr=I([].push),fr=function(e,t){var i,r=dr(e),n=0,o=[];for(i in r)!ur(hr,i)&&ur(r,i)&&pr(o,i);for(;t.length>n;)ur(r,i=t[n++])&&(~lr(o,i)||pr(o,i));return o},_r=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],vr=fr,mr=_r.concat("length","prototype");Ki.f=Object.getOwnPropertyNames||function(e){return vr(e,mr)};var yr={};yr.f=Object.getOwnPropertySymbols;var Sr=W,gr=Ki,Er=yr,br=Dt,Tr=I([].concat),Ir=Sr("Reflect","ownKeys")||function(e){var t=gr.f(br(e)),i=Er.f;return i?Tr(t,i(e)):t},Rr=xe,Ar=Ir,Cr=o,Or=Ct,wr=function(e,t,i){for(var r=Ar(t),n=Or.f,o=Cr.f,a=0;a<r.length;a++){var s=r[a];Rr(e,s)||i&&Rr(i,s)||n(e,s,o(t,s))}},Nr=a,Pr=B,kr=/#|\.prototype\./,Dr=function(e,t){var i=Ur[Mr(e)];return i==xr||i!=Lr&&(Pr(t)?Nr(t):!!t)},Mr=Dr.normalize=function(e){return String(e).replace(kr,".").toLowerCase()},Ur=Dr.data={},Lr=Dr.NATIVE="N",xr=Dr.POLYFILL="P",Vr=Dr,Fr=n,Br=o.f,jr=Xt,Gr=Yt.exports,Hr=Ce,zr=wr,Kr=Vr,Wr=function(e,t){var i,r,n,o,a,s=e.target,c=e.global,u=e.stat;if(i=c?Fr:u?Fr[s]||Hr(s,{}):(Fr[s]||{}).prototype)for(r in t){if(o=t[r],n=e.noTargetGet?(a=Br(i,r))&&a.value:i[r],!Kr(c?r:s+(u?".":"#")+r,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;zr(o,n)}(e.sham||n&&n.sham)&&jr(o,"sham",!0),Gr(i,r,o,e)}},Xr=n,Yr=B,qr=Xr.String,Jr=Xr.TypeError,Qr=I,Zr=Dt,$r=function(e){if("object"==typeof e||Yr(e))return e;throw Jr("Can't set "+qr(e)+" as a prototype")},en=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,i={};try{(e=Qr(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(i,[]),t=i instanceof Array}catch(e){}return function(i,r){return Zr(i),$r(r),t?e(i,r):i.__proto__=r,i}}():void 0);Wr({target:"Object",stat:!0},{setPrototypeOf:en});var tn={},rn=fr,nn=_r,on=Object.keys||function(e){return rn(e,nn)},an=s,sn=Ot,cn=Ct,un=Dt,dn=F,ln=on;tn.f=an&&!sn?Object.defineProperties:function(e,t){un(e);for(var i,r=dn(t),n=ln(t),o=n.length,a=0;o>a;)cn.f(e,i=n[a++],r[i]);return e};var hn,pn=W("document","documentElement"),fn=Dt,_n=tn,vn=_r,mn=di,yn=pn,Sn=_t,gn=ui("IE_PROTO"),En=function(){},bn=function(e){return"<script>"+e+"</"+"script>"},Tn=function(e){e.write(bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},In=function(){try{hn=new ActiveXObject("htmlfile")}catch(e){}var e,t;In="undefined"!=typeof document?document.domain&&hn?Tn(hn):((t=Sn("iframe")).style.display="none",yn.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(bn("document.F=Object")),e.close(),e.F):Tn(hn);for(var i=vn.length;i--;)delete In.prototype[vn[i]];return In()};mn[gn]=!0;var Rn=Object.create||function(e,t){var i;return null!==e?(En.prototype=fn(e),i=new En,En.prototype=null,i[gn]=e):i=In(),void 0===t?i:_n.f(i,t)};Wr({target:"Object",stat:!0,sham:!s},{create:Rn});var An=s,Cn=I,On=l,wn=a,Nn=on,Pn=yr,kn=h,Dn=Me,Mn=M,Un=Object.assign,Ln=Object.defineProperty,xn=Cn([].concat),Vn=!Un||wn((function(){if(An&&1!==Un({b:1},Un(Ln({},"a",{enumerable:!0,get:function(){Ln(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},i=Symbol(),r="abcdefghijklmnopqrst";return e[i]=7,r.split("").forEach((function(e){t[e]=e})),7!=Un({},e)[i]||Nn(Un({},t)).join("")!=r}))?function(e,t){for(var i=Dn(e),r=arguments.length,n=1,o=Pn.f,a=kn.f;r>n;)for(var s,c=Mn(arguments[n++]),u=o?xn(Nn(c),o(c)):Nn(c),d=u.length,l=0;d>l;)s=u[l++],An&&!On(a,c,s)||(i[s]=c[s]);return i}:Un,Fn=Vn;Wr({target:"Object",stat:!0,forced:Object.assign!==Fn},{assign:Fn});var Bn=a,jn=function(e,t){var i=[][e];return!!i&&Bn((function(){i.call(null,t||function(){throw 1},1)}))},Gn=Wr,Hn=cr.indexOf,zn=jn,Kn=I([].indexOf),Wn=!!Kn&&1/Kn([1],1,-0)<0,Xn=zn("indexOf");Gn({target:"Array",proto:!0,forced:Wn||!Xn},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Wn?Kn(this,e,t)||0:Hn(this,e,t)}});var Yn=c,qn=Function.prototype,Jn=qn.apply,Qn=qn.call,Zn="object"==typeof Reflect&&Reflect.apply||(Yn?Qn.bind(Jn):function(){return Qn.apply(Jn,arguments)}),$n=O,eo=Array.isArray||function(e){return"Array"==$n(e)},to={};to[$e("toStringTag")]="z";var io="[object z]"===String(to),ro=n,no=io,oo=B,ao=O,so=$e("toStringTag"),co=ro.Object,uo="Arguments"==ao(function(){return arguments}()),lo=no?ao:function(e){var t,i,r;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(i=function(e,t){try{return e[t]}catch(e){}}(t=co(e),so))?i:uo?ao(t):"Object"==(r=ao(t))&&oo(t.callee)?"Arguments":r},ho=lo,po=n.String,fo=function(e){if("Symbol"===ho(e))throw TypeError("Cannot convert a Symbol value to a string");return po(e)},_o={},vo=lt,mo=Ct,yo=y,So=function(e,t,i){var r=vo(t);r in e?mo.f(e,r,yo(0,i)):e[r]=i},go=Zi,Eo=rr,bo=So,To=n.Array,Io=Math.max,Ro=function(e,t,i){for(var r=Eo(e),n=go(t,r),o=go(void 0===i?r:i,r),a=To(Io(o-n,0)),s=0;n<o;n++,s++)bo(a,s,e[n]);return a.length=s,a},Ao=O,Co=F,Oo=Ki.f,wo=Ro,No="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];_o.f=function(e){return No&&"Window"==Ao(e)?function(e){try{return Oo(e)}catch(e){return wo(No)}}(e):Oo(Co(e))};var Po=I([].slice),ko={},Do=$e;ko.f=Do;var Mo=n,Uo=xe,Lo=ko,xo=Ct.f,Vo=function(e){var t=Mo.Symbol||(Mo.Symbol={});Uo(t,e)||xo(t,e,{value:Lo.f(e)})},Fo=Ct.f,Bo=xe,jo=$e("toStringTag"),Go=function(e,t,i){e&&!i&&(e=e.prototype),e&&!Bo(e,jo)&&Fo(e,jo,{configurable:!0,value:t})},Ho=me,zo=c,Ko=I(I.bind),Wo=function(e,t){return Ho(e),void 0===t?e:zo?Ko(e,t):function(){return e.apply(t,arguments)}},Xo=I,Yo=a,qo=B,Jo=lo,Qo=ti,Zo=function(){},$o=[],ea=W("Reflect","construct"),ta=/^\s*(?:class|function)\b/,ia=Xo(ta.exec),ra=!ta.exec(Zo),na=function(e){if(!qo(e))return!1;try{return ea(Zo,$o,e),!0}catch(e){return!1}},oa=function(e){if(!qo(e))return!1;switch(Jo(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return ra||!!ia(ta,Qo(e))}catch(e){return!0}};oa.sham=!0;var aa=!ea||Yo((function(){var e;return na(na.call)||!na(Object)||!na((function(){e=!0}))||e}))?oa:na,sa=n,ca=eo,ua=aa,da=G,la=$e("species"),ha=sa.Array,pa=function(e){var t;return ca(e)&&(t=e.constructor,(ua(t)&&(t===ha||ca(t.prototype))||da(t)&&null===(t=t[la]))&&(t=void 0)),void 0===t?ha:t},fa=function(e,t){return new(pa(e))(0===t?0:t)},_a=Wo,va=M,ma=Me,ya=rr,Sa=fa,ga=I([].push),Ea=function(e){var t=1==e,i=2==e,r=3==e,n=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,p,f=ma(c),_=va(f),v=_a(u,d),m=ya(_),y=0,S=l||Sa,g=t?S(c,m):i||a?S(c,0):void 0;m>y;y++)if((s||y in _)&&(p=v(h=_[y],y,f),e))if(t)g[y]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return y;case 2:ga(g,h)}else switch(e){case 4:return!1;case 7:ga(g,h)}return o?-1:r||n?n:g}},ba={forEach:Ea(0),map:Ea(1),filter:Ea(2),some:Ea(3),every:Ea(4),find:Ea(5),findIndex:Ea(6),filterReject:Ea(7)},Ta=Wr,Ia=n,Ra=W,Aa=Zn,Ca=l,Oa=I,wa=s,Na=ne,Pa=a,ka=xe,Da=eo,Ma=B,Ua=G,La=X,xa=le,Va=Dt,Fa=Me,Ba=F,ja=lt,Ga=fo,Ha=y,za=Rn,Ka=on,Wa=Ki,Xa=_o,Ya=yr,qa=o,Ja=Ct,Qa=tn,Za=h,$a=Po,es=Yt.exports,ts=Ie.exports,is=di,rs=Ge,ns=$e,os=ko,as=Vo,ss=Go,cs=Oi,us=ba.forEach,ds=ui("hidden"),ls="Symbol",hs=ns("toPrimitive"),ps=cs.set,fs=cs.getterFor(ls),_s=Object.prototype,vs=Ia.Symbol,ms=vs&&vs.prototype,ys=Ia.TypeError,Ss=Ia.QObject,gs=Ra("JSON","stringify"),Es=qa.f,bs=Ja.f,Ts=Xa.f,Is=Za.f,Rs=Oa([].push),As=ts("symbols"),Cs=ts("op-symbols"),Os=ts("string-to-symbol-registry"),ws=ts("symbol-to-string-registry"),Ns=ts("wks"),Ps=!Ss||!Ss.prototype||!Ss.prototype.findChild,ks=wa&&Pa((function(){return 7!=za(bs({},"a",{get:function(){return bs(this,"a",{value:7}).a}})).a}))?function(e,t,i){var r=Es(_s,t);r&&delete _s[t],bs(e,t,i),r&&e!==_s&&bs(_s,t,r)}:bs,Ds=function(e,t){var i=As[e]=za(ms);return ps(i,{type:ls,tag:e,description:t}),wa||(i.description=t),i},Ms=function(e,t,i){e===_s&&Ms(Cs,t,i),Va(e);var r=ja(t);return Va(i),ka(As,r)?(i.enumerable?(ka(e,ds)&&e[ds][r]&&(e[ds][r]=!1),i=za(i,{enumerable:Ha(0,!1)})):(ka(e,ds)||bs(e,ds,Ha(1,{})),e[ds][r]=!0),ks(e,r,i)):bs(e,r,i)},Us=function(e,t){Va(e);var i=Ba(t),r=Ka(i).concat(Fs(i));return us(r,(function(t){wa&&!Ca(Ls,i,t)||Ms(e,t,i[t])})),e},Ls=function(e){var t=ja(e),i=Ca(Is,this,t);return!(this===_s&&ka(As,t)&&!ka(Cs,t))&&(!(i||!ka(this,t)||!ka(As,t)||ka(this,ds)&&this[ds][t])||i)},xs=function(e,t){var i=Ba(e),r=ja(t);if(i!==_s||!ka(As,r)||ka(Cs,r)){var n=Es(i,r);return!n||!ka(As,r)||ka(i,ds)&&i[ds][r]||(n.enumerable=!0),n}},Vs=function(e){var t=Ts(Ba(e)),i=[];return us(t,(function(e){ka(As,e)||ka(is,e)||Rs(i,e)})),i},Fs=function(e){var t=e===_s,i=Ts(t?Cs:Ba(e)),r=[];return us(i,(function(e){!ka(As,e)||t&&!ka(_s,e)||Rs(r,As[e])})),r};(Na||(vs=function(){if(La(ms,this))throw ys("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Ga(arguments[0]):void 0,t=rs(e),i=function(e){this===_s&&Ca(i,Cs,e),ka(this,ds)&&ka(this[ds],t)&&(this[ds][t]=!1),ks(this,t,Ha(1,e))};return wa&&Ps&&ks(_s,t,{configurable:!0,set:i}),Ds(t,e)},es(ms=vs.prototype,"toString",(function(){return fs(this).tag})),es(vs,"withoutSetter",(function(e){return Ds(rs(e),e)})),Za.f=Ls,Ja.f=Ms,Qa.f=Us,qa.f=xs,Wa.f=Xa.f=Vs,Ya.f=Fs,os.f=function(e){return Ds(ns(e),e)},wa&&(bs(ms,"description",{configurable:!0,get:function(){return fs(this).description}}),es(_s,"propertyIsEnumerable",Ls,{unsafe:!0}))),Ta({global:!0,wrap:!0,forced:!Na,sham:!Na},{Symbol:vs}),us(Ka(Ns),(function(e){as(e)})),Ta({target:ls,stat:!0,forced:!Na},{for:function(e){var t=Ga(e);if(ka(Os,t))return Os[t];var i=vs(t);return Os[t]=i,ws[i]=t,i},keyFor:function(e){if(!xa(e))throw ys(e+" is not a symbol");if(ka(ws,e))return ws[e]},useSetter:function(){Ps=!0},useSimple:function(){Ps=!1}}),Ta({target:"Object",stat:!0,forced:!Na,sham:!wa},{create:function(e,t){return void 0===t?za(e):Us(za(e),t)},defineProperty:Ms,defineProperties:Us,getOwnPropertyDescriptor:xs}),Ta({target:"Object",stat:!0,forced:!Na},{getOwnPropertyNames:Vs,getOwnPropertySymbols:Fs}),Ta({target:"Object",stat:!0,forced:Pa((function(){Ya.f(1)}))},{getOwnPropertySymbols:function(e){return Ya.f(Fa(e))}}),gs)&&Ta({target:"JSON",stat:!0,forced:!Na||Pa((function(){var e=vs();return"[null]"!=gs([e])||"{}"!=gs({a:e})||"{}"!=gs(Object(e))}))},{stringify:function(e,t,i){var r=$a(arguments),n=t;if((Ua(t)||void 0!==e)&&!xa(e))return Da(t)||(t=function(e,t){if(Ma(n)&&(t=Ca(n,this,e,t)),!xa(t))return t}),r[1]=t,Aa(gs,null,r)}});if(!ms[hs]){var Bs=ms.valueOf;es(ms,hs,(function(e){return Ca(Bs,this)}))}ss(vs,ls),is[ds]=!0;var js=Wr,Gs=a,Hs=F,zs=o.f,Ks=s,Ws=Gs((function(){zs(1)}));js({target:"Object",stat:!0,forced:!Ks||Ws,sham:!Ks},{getOwnPropertyDescriptor:function(e,t){return zs(Hs(e),t)}});var Xs=lo,Ys=io?{}.toString:function(){return"[object "+Xs(this)+"]"},qs=io,Js=Yt.exports,Qs=Ys;qs||Js(Object.prototype,"toString",Qs,{unsafe:!0});var Zs=Wr,$s=s,ec=Ct.f;Zs({target:"Object",stat:!0,forced:Object.defineProperty!==ec,sham:!$s},{defineProperty:ec});var tc=n.Promise,ic=Yt.exports,rc=function(e,t,i){for(var r in t)ic(e,r,t[r],i);return e},nc=W,oc=Ct,ac=s,sc=$e("species"),cc=function(e){var t=nc(e),i=oc.f;ac&&t&&!t[sc]&&i(t,sc,{configurable:!0,get:function(){return this}})},uc=X,dc=n.TypeError,lc=function(e,t){if(uc(t,e))return e;throw dc("Incorrect invocation")},hc={},pc=hc,fc=$e("iterator"),_c=Array.prototype,vc=function(e){return void 0!==e&&(pc.Array===e||_c[fc]===e)},mc=lo,yc=Se,Sc=hc,gc=$e("iterator"),Ec=function(e){if(null!=e)return yc(e,gc)||yc(e,"@@iterator")||Sc[mc(e)]},bc=l,Tc=me,Ic=Dt,Rc=pe,Ac=Ec,Cc=n.TypeError,Oc=function(e,t){var i=arguments.length<2?Ac(e):t;if(Tc(i))return Ic(bc(i,e));throw Cc(Rc(e)+" is not iterable")},wc=l,Nc=Dt,Pc=Se,kc=function(e,t,i){var r,n;Nc(e);try{if(!(r=Pc(e,"return"))){if("throw"===t)throw i;return i}r=wc(r,e)}catch(e){n=!0,r=e}if("throw"===t)throw i;if(n)throw r;return Nc(r),i},Dc=Wo,Mc=l,Uc=Dt,Lc=pe,xc=vc,Vc=rr,Fc=X,Bc=Oc,jc=Ec,Gc=kc,Hc=n.TypeError,zc=function(e,t){this.stopped=e,this.result=t},Kc=zc.prototype,Wc=function(e,t,i){var r,n,o,a,s,c,u,d=i&&i.that,l=!(!i||!i.AS_ENTRIES),h=!(!i||!i.IS_ITERATOR),p=!(!i||!i.INTERRUPTED),f=Dc(t,d),_=function(e){return r&&Gc(r,"normal",e),new zc(!0,e)},v=function(e){return l?(Uc(e),p?f(e[0],e[1],_):f(e[0],e[1])):p?f(e,_):f(e)};if(h)r=e;else{if(!(n=jc(e)))throw Hc(Lc(e)+" is not iterable");if(xc(n)){for(o=0,a=Vc(e);a>o;o++)if((s=v(e[o]))&&Fc(Kc,s))return s;return new zc(!1)}r=Bc(e,n)}for(c=r.next;!(u=Mc(c,r)).done;){try{s=v(u.value)}catch(e){Gc(r,"throw",e)}if("object"==typeof s&&s&&Fc(Kc,s))return s}return new zc(!1)},Xc=$e("iterator"),Yc=!1;try{var qc=0,Jc={next:function(){return{done:!!qc++}},return:function(){Yc=!0}};Jc[Xc]=function(){return this},Array.from(Jc,(function(){throw 2}))}catch(e){}var Qc,Zc,$c,eu,tu=function(e,t){if(!t&&!Yc)return!1;var i=!1;try{var r={};r[Xc]=function(){return{next:function(){return{done:i=!0}}}},e(r)}catch(e){}return i},iu=aa,ru=pe,nu=n.TypeError,ou=function(e){if(iu(e))return e;throw nu(ru(e)+" is not a constructor")},au=Dt,su=ou,cu=$e("species"),uu=function(e,t){var i,r=au(e).constructor;return void 0===r||null==(i=au(r)[cu])?t:su(i)},du=n.TypeError,lu=function(e,t){if(e<t)throw du("Not enough arguments");return e},hu=/(?:ipad|iphone|ipod).*applewebkit/i.test(Y),pu="process"==O(n.process),fu=n,_u=Zn,vu=Wo,mu=B,yu=xe,Su=a,gu=pn,Eu=Po,bu=_t,Tu=lu,Iu=hu,Ru=pu,Au=fu.setImmediate,Cu=fu.clearImmediate,Ou=fu.process,wu=fu.Dispatch,Nu=fu.Function,Pu=fu.MessageChannel,ku=fu.String,Du=0,Mu={},Uu="onreadystatechange";try{Qc=fu.location}catch(e){}var Lu=function(e){if(yu(Mu,e)){var t=Mu[e];delete Mu[e],t()}},xu=function(e){return function(){Lu(e)}},Vu=function(e){Lu(e.data)},Fu=function(e){fu.postMessage(ku(e),Qc.protocol+"//"+Qc.host)};Au&&Cu||(Au=function(e){Tu(arguments.length,1);var t=mu(e)?e:Nu(e),i=Eu(arguments,1);return Mu[++Du]=function(){_u(t,void 0,i)},Zc(Du),Du},Cu=function(e){delete Mu[e]},Ru?Zc=function(e){Ou.nextTick(xu(e))}:wu&&wu.now?Zc=function(e){wu.now(xu(e))}:Pu&&!Iu?(eu=($c=new Pu).port2,$c.port1.onmessage=Vu,Zc=vu(eu.postMessage,eu)):fu.addEventListener&&mu(fu.postMessage)&&!fu.importScripts&&Qc&&"file:"!==Qc.protocol&&!Su(Fu)?(Zc=Fu,fu.addEventListener("message",Vu,!1)):Zc=Uu in bu("script")?function(e){gu.appendChild(bu("script")).onreadystatechange=function(){gu.removeChild(this),Lu(e)}}:function(e){setTimeout(xu(e),0)});var Bu,ju,Gu,Hu,zu,Ku,Wu,Xu,Yu={set:Au,clear:Cu},qu=n,Ju=/ipad|iphone|ipod/i.test(Y)&&void 0!==qu.Pebble,Qu=/web0s(?!.*chrome)/i.test(Y),Zu=n,$u=Wo,ed=o.f,td=Yu.set,id=hu,rd=Ju,nd=Qu,od=pu,ad=Zu.MutationObserver||Zu.WebKitMutationObserver,sd=Zu.document,cd=Zu.process,ud=Zu.Promise,dd=ed(Zu,"queueMicrotask"),ld=dd&&dd.value;ld||(Bu=function(){var e,t;for(od&&(e=cd.domain)&&e.exit();ju;){t=ju.fn,ju=ju.next;try{t()}catch(e){throw ju?Hu():Gu=void 0,e}}Gu=void 0,e&&e.enter()},id||od||nd||!ad||!sd?!rd&&ud&&ud.resolve?((Wu=ud.resolve(void 0)).constructor=ud,Xu=$u(Wu.then,Wu),Hu=function(){Xu(Bu)}):od?Hu=function(){cd.nextTick(Bu)}:(td=$u(td,Zu),Hu=function(){td(Bu)}):(zu=!0,Ku=sd.createTextNode(""),new ad(Bu).observe(Ku,{characterData:!0}),Hu=function(){Ku.data=zu=!zu}));var hd=ld||function(e){var t={fn:e,next:void 0};Gu&&(Gu.next=t),ju||(ju=t,Hu()),Gu=t},pd={},fd=me,_d=function(e){var t,i;this.promise=new e((function(e,r){if(void 0!==t||void 0!==i)throw TypeError("Bad Promise constructor");t=e,i=r})),this.resolve=fd(t),this.reject=fd(i)};pd.f=function(e){return new _d(e)};var vd=Dt,md=G,yd=pd,Sd=function(e,t){if(vd(e),md(t)&&t.constructor===e)return t;var i=yd.f(e);return(0,i.resolve)(t),i.promise},gd=n,Ed=function(){this.head=null,this.tail=null};Ed.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 bd,Td,Id,Rd,Ad=Ed,Cd="object"==typeof window,Od=Wr,wd=n,Nd=W,Pd=l,kd=tc,Dd=Yt.exports,Md=rc,Ud=en,Ld=Go,xd=cc,Vd=me,Fd=B,Bd=G,jd=lc,Gd=ti,Hd=Wc,zd=tu,Kd=uu,Wd=Yu.set,Xd=hd,Yd=Sd,qd=function(e,t){var i=gd.console;i&&i.error&&(1==arguments.length?i.error(e):i.error(e,t))},Jd=pd,Qd=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Zd=Ad,$d=Oi,el=Vr,tl=Cd,il=pu,rl=te,nl=$e("species"),ol="Promise",al=$d.getterFor(ol),sl=$d.set,cl=$d.getterFor(ol),ul=kd&&kd.prototype,dl=kd,ll=ul,hl=wd.TypeError,pl=wd.document,fl=wd.process,_l=Jd.f,vl=_l,ml=!!(pl&&pl.createEvent&&wd.dispatchEvent),yl=Fd(wd.PromiseRejectionEvent),Sl="unhandledrejection",gl=!1,El=el(ol,(function(){var e=Gd(dl),t=e!==String(dl);if(!t&&66===rl)return!0;if(rl>=51&&/native code/.test(e))return!1;var i=new dl((function(e){e(1)})),r=function(e){e((function(){}),(function(){}))};return(i.constructor={})[nl]=r,!(gl=i.then((function(){}))instanceof r)||!t&&tl&&!yl})),bl=El||!zd((function(e){dl.all(e).catch((function(){}))})),Tl=function(e){var t;return!(!Bd(e)||!Fd(t=e.then))&&t},Il=function(e,t){var i,r,n,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&wl(t),t.rejection=1),!0===s?i=o:(d&&d.enter(),i=s(o),d&&(d.exit(),n=!0)),i===e.promise?u(hl("Promise-chain cycle")):(r=Tl(i))?Pd(r,i,c,u):c(i)):u(o)}catch(e){d&&!n&&d.exit(),u(e)}},Rl=function(e,t){e.notified||(e.notified=!0,Xd((function(){for(var i,r=e.reactions;i=r.get();)Il(i,e);e.notified=!1,t&&!e.rejection&&Cl(e)})))},Al=function(e,t,i){var r,n;ml?((r=pl.createEvent("Event")).promise=t,r.reason=i,r.initEvent(e,!1,!0),wd.dispatchEvent(r)):r={promise:t,reason:i},!yl&&(n=wd["on"+e])?n(r):e===Sl&&qd("Unhandled promise rejection",i)},Cl=function(e){Pd(Wd,wd,(function(){var t,i=e.facade,r=e.value;if(Ol(e)&&(t=Qd((function(){il?fl.emit("unhandledRejection",r,i):Al(Sl,i,r)})),e.rejection=il||Ol(e)?2:1,t.error))throw t.value}))},Ol=function(e){return 1!==e.rejection&&!e.parent},wl=function(e){Pd(Wd,wd,(function(){var t=e.facade;il?fl.emit("rejectionHandled",t):Al("rejectionhandled",t,e.value)}))},Nl=function(e,t,i){return function(r){e(t,r,i)}},Pl=function(e,t,i){e.done||(e.done=!0,i&&(e=i),e.value=t,e.state=2,Rl(e,!0))},kl=function(e,t,i){if(!e.done){e.done=!0,i&&(e=i);try{if(e.facade===t)throw hl("Promise can't be resolved itself");var r=Tl(t);r?Xd((function(){var i={done:!1};try{Pd(r,t,Nl(kl,i,e),Nl(Pl,i,e))}catch(t){Pl(i,t,e)}})):(e.value=t,e.state=1,Rl(e,!1))}catch(t){Pl({done:!1},t,e)}}};if(El&&(ll=(dl=function(e){jd(this,ll),Vd(e),Pd(bd,this);var t=al(this);try{e(Nl(kl,t),Nl(Pl,t))}catch(e){Pl(t,e)}}).prototype,(bd=function(e){sl(this,{type:ol,done:!1,notified:!1,parent:!1,reactions:new Zd,rejection:!1,state:0,value:void 0})}).prototype=Md(ll,{then:function(e,t){var i=cl(this),r=_l(Kd(this,dl));return i.parent=!0,r.ok=!Fd(e)||e,r.fail=Fd(t)&&t,r.domain=il?fl.domain:void 0,0==i.state?i.reactions.add(r):Xd((function(){Il(r,i)})),r.promise},catch:function(e){return this.then(void 0,e)}}),Td=function(){var e=new bd,t=al(e);this.promise=e,this.resolve=Nl(kl,t),this.reject=Nl(Pl,t)},Jd.f=_l=function(e){return e===dl||e===Id?new Td(e):vl(e)},Fd(kd)&&ul!==Object.prototype)){Rd=ul.then,gl||(Dd(ul,"then",(function(e,t){var i=this;return new dl((function(e,t){Pd(Rd,i,e,t)})).then(e,t)}),{unsafe:!0}),Dd(ul,"catch",ll.catch,{unsafe:!0}));try{delete ul.constructor}catch(e){}Ud&&Ud(ul,ll)}Od({global:!0,wrap:!0,forced:El},{Promise:dl}),Ld(dl,ol,!1),xd(ol),Id=Nd(ol),Od({target:ol,stat:!0,forced:El},{reject:function(e){var t=_l(this);return Pd(t.reject,void 0,e),t.promise}}),Od({target:ol,stat:!0,forced:El},{resolve:function(e){return Yd(this,e)}}),Od({target:ol,stat:!0,forced:bl},{all:function(e){var t=this,i=_l(t),r=i.resolve,n=i.reject,o=Qd((function(){var i=Vd(t.resolve),o=[],a=0,s=1;Hd(e,(function(e){var c=a++,u=!1;s++,Pd(i,t,e).then((function(e){u||(u=!0,o[c]=e,--s||r(o))}),n)})),--s||r(o)}));return o.error&&n(o.value),i.promise},race:function(e){var t=this,i=_l(t),r=i.reject,n=Qd((function(){var n=Vd(t.resolve);Hd(e,(function(e){Pd(n,t,e).then(i.resolve,r)}))}));return n.error&&r(n.value),i.promise}});var Dl=Wr,Ml=s,Ul=n,Ll=I,xl=xe,Vl=B,Fl=X,Bl=fo,jl=Ct.f,Gl=wr,Hl=Ul.Symbol,zl=Hl&&Hl.prototype;if(Ml&&Vl(Hl)&&(!("description"in zl)||void 0!==Hl().description)){var Kl={},Wl=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:Bl(arguments[0]),t=Fl(zl,this)?new Hl(e):void 0===e?Hl():Hl(e);return""===e&&(Kl[t]=!0),t};Gl(Wl,Hl),Wl.prototype=zl,zl.constructor=Wl;var Xl="Symbol(test)"==String(Hl("test")),Yl=Ll(zl.toString),ql=Ll(zl.valueOf),Jl=/^Symbol\((.*)\)[^)]+$/,Ql=Ll("".replace),Zl=Ll("".slice);jl(zl,"description",{configurable:!0,get:function(){var e=ql(this),t=Yl(e);if(xl(Kl,e))return"";var i=Xl?Zl(t,7,-1):Ql(t,Jl,"$1");return""===i?void 0:i}}),Dl({global:!0,forced:!0},{Symbol:Wl})}Vo("iterator");var $l=Rn,eh=Ct,th=$e("unscopables"),ih=Array.prototype;null==ih[th]&&eh.f(ih,th,{configurable:!0,value:$l(null)});var rh,nh,oh,ah=function(e){ih[th][e]=!0},sh=!a((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),ch=n,uh=xe,dh=B,lh=Me,hh=sh,ph=ui("IE_PROTO"),fh=ch.Object,_h=fh.prototype,vh=hh?fh.getPrototypeOf:function(e){var t=lh(e);if(uh(t,ph))return t[ph];var i=t.constructor;return dh(i)&&t instanceof i?i.prototype:t instanceof fh?_h:null},mh=a,yh=B,Sh=vh,gh=Yt.exports,Eh=$e("iterator"),bh=!1;[].keys&&("next"in(oh=[].keys())?(nh=Sh(Sh(oh)))!==Object.prototype&&(rh=nh):bh=!0);var Th=null==rh||mh((function(){var e={};return rh[Eh].call(e)!==e}));Th&&(rh={}),yh(rh[Eh])||gh(rh,Eh,(function(){return this}));var Ih={IteratorPrototype:rh,BUGGY_SAFARI_ITERATORS:bh},Rh=Ih.IteratorPrototype,Ah=Rn,Ch=y,Oh=Go,wh=hc,Nh=function(){return this},Ph=function(e,t,i,r){var n=t+" Iterator";return e.prototype=Ah(Rh,{next:Ch(+!r,i)}),Oh(e,n,!1),wh[n]=Nh,e},kh=Wr,Dh=l,Mh=Mi,Uh=B,Lh=Ph,xh=vh,Vh=en,Fh=Go,Bh=Xt,jh=Yt.exports,Gh=hc,Hh=Mh.PROPER,zh=Mh.CONFIGURABLE,Kh=Ih.IteratorPrototype,Wh=Ih.BUGGY_SAFARI_ITERATORS,Xh=$e("iterator"),Yh="keys",qh="values",Jh="entries",Qh=function(){return this},Zh=function(e,t,i,r,n,o,a){Lh(i,t,r);var s,c,u,d=function(e){if(e===n&&_)return _;if(!Wh&&e in p)return p[e];switch(e){case Yh:case qh:case Jh:return function(){return new i(this,e)}}return function(){return new i(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[Xh]||p["@@iterator"]||n&&p[n],_=!Wh&&f||d(n),v="Array"==t&&p.entries||f;if(v&&(s=xh(v.call(new e)))!==Object.prototype&&s.next&&(xh(s)!==Kh&&(Vh?Vh(s,Kh):Uh(s[Xh])||jh(s,Xh,Qh)),Fh(s,l,!0)),Hh&&n==qh&&f&&f.name!==qh&&(zh?Bh(p,"name",qh):(h=!0,_=function(){return Dh(f,this)})),n)if(c={values:d(qh),keys:o?_:d(Yh),entries:d(Jh)},a)for(u in c)(Wh||h||!(u in p))&&jh(p,u,c[u]);else kh({target:t,proto:!0,forced:Wh||h},c);return p[Xh]!==_&&jh(p,Xh,_,{name:n}),Gh[t]=_,c},$h=F,ep=ah,tp=hc,ip=Oi,rp=Ct.f,np=Zh,op=s,ap="Array Iterator",sp=ip.set,cp=ip.getterFor(ap),up=np(Array,"Array",(function(e,t){sp(this,{type:ap,target:$h(e),index:0,kind:t})}),(function(){var e=cp(this),t=e.target,i=e.kind,r=e.index++;return!t||r>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==i?{value:r,done:!1}:"values"==i?{value:t[r],done:!1}:{value:[r,t[r]],done:!1}}),"values"),dp=tp.Arguments=tp.Array;if(ep("keys"),ep("values"),ep("entries"),op&&"values"!==dp.name)try{rp(dp,"name",{value:"values"})}catch(e){}var lp=I,hp=Yi,pp=fo,fp=L,_p=lp("".charAt),vp=lp("".charCodeAt),mp=lp("".slice),yp=function(e){return function(t,i){var r,n,o=pp(fp(t)),a=hp(i),s=o.length;return a<0||a>=s?e?"":void 0:(r=vp(o,a))<55296||r>56319||a+1===s||(n=vp(o,a+1))<56320||n>57343?e?_p(o,a):r:e?mp(o,a,a+2):n-56320+(r-55296<<10)+65536}},Sp={codeAt:yp(!1),charAt:yp(!0)},gp=Sp.charAt,Ep=fo,bp=Oi,Tp=Zh,Ip="String Iterator",Rp=bp.set,Ap=bp.getterFor(Ip);Tp(String,"String",(function(e){Rp(this,{type:Ip,string:Ep(e),index:0})}),(function(){var e,t=Ap(this),i=t.string,r=t.index;return r>=i.length?{value:void 0,done:!0}:(e=gp(i,r),t.index+=e.length,{value:e,done:!1})}));var Cp={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},Op=_t("span").classList,wp=Op&&Op.constructor&&Op.constructor.prototype,Np=wp===Object.prototype?void 0:wp,Pp=n,kp=Cp,Dp=Np,Mp=up,Up=Xt,Lp=$e,xp=Lp("iterator"),Vp=Lp("toStringTag"),Fp=Mp.values,Bp=function(e,t){if(e){if(e[xp]!==Fp)try{Up(e,xp,Fp)}catch(t){e[xp]=Fp}if(e[Vp]||Up(e,Vp,t),kp[t])for(var i in Mp)if(e[i]!==Mp[i])try{Up(e,i,Mp[i])}catch(t){e[i]=Mp[i]}}};for(var jp in kp)Bp(Pp[jp]&&Pp[jp].prototype,jp);Bp(Dp,"DOMTokenList");var Gp=a,Hp=te,zp=$e("species"),Kp=function(e){return Hp>=51||!Gp((function(){var t=[];return(t.constructor={})[zp]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Wp=Wr,Xp=n,Yp=a,qp=eo,Jp=G,Qp=Me,Zp=rr,$p=So,ef=fa,tf=Kp,rf=te,nf=$e("isConcatSpreadable"),of=9007199254740991,af="Maximum allowed index exceeded",sf=Xp.TypeError,cf=rf>=51||!Yp((function(){var e=[];return e[nf]=!1,e.concat()[0]!==e})),uf=tf("concat"),df=function(e){if(!Jp(e))return!1;var t=e[nf];return void 0!==t?!!t:qp(e)};Wp({target:"Array",proto:!0,forced:!cf||!uf},{concat:function(e){var t,i,r,n,o,a=Qp(this),s=ef(a,0),c=0;for(t=-1,r=arguments.length;t<r;t++)if(df(o=-1===t?a:arguments[t])){if(c+(n=Zp(o))>of)throw sf(af);for(i=0;i<n;i++,c++)i in o&&$p(s,c,o[i])}else{if(c>=of)throw sf(af);$p(s,c++,o)}return s.length=c,s}});var lf=Wr,hf=n,pf=eo,ff=aa,_f=G,vf=Zi,mf=rr,yf=F,Sf=So,gf=$e,Ef=Po,bf=Kp("slice"),Tf=gf("species"),If=hf.Array,Rf=Math.max;lf({target:"Array",proto:!0,forced:!bf},{slice:function(e,t){var i,r,n,o=yf(this),a=mf(o),s=vf(e,a),c=vf(void 0===t?a:t,a);if(pf(o)&&(i=o.constructor,(ff(i)&&(i===If||pf(i.prototype))||_f(i)&&null===(i=i[Tf]))&&(i=void 0),i===If||void 0===i))return Ef(o,s,c);for(r=new(void 0===i?If:i)(Rf(c-s,0)),n=0;s<c;s++,n++)s in o&&Sf(r,n,o[s]);return r.length=n,r}}),Vo("asyncIterator");var Af=function(e,t){return Af=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},Af(e,t)};function Cf(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function i(){this.constructor=e}Af(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}var Of,wf,Nf,Pf,kf,Df,Mf,Uf,Lf,xf,Vf,Ff,Bf,jf,Gf,Hf,zf,Kf,Wf,Xf,Yf,qf,Jf,Qf,Zf,$f=function(){return $f=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},$f.apply(this,arguments)};function e_(e,i,r,n){var o,a=arguments.length,s=a<3?i:null===n?n=Object.getOwnPropertyDescriptor(i,r):n;if("object"===("undefined"==typeof Reflect?"undefined":t(Reflect))&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,i,r,n);else for(var c=e.length-1;c>=0;c--)(o=e[c])&&(s=(a<3?o(s):a>3?o(i,r,s):o(i,r))||s);return a>3&&s&&Object.defineProperty(i,r,s),s}function t_(e,t,i,r){return new(i||(i=Promise))((function(n,o){function a(e){try{c(r.next(e))}catch(e){o(e)}}function s(e){try{c(r.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}function i_(e,t){var i,r,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,r=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],r=0}finally{i=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function r_(e){var t="function"==typeof Symbol&&Symbol.iterator,i=t&&e[t],r=0;if(i)return i.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function n_(e,t){var i="function"==typeof Symbol&&e[Symbol.iterator];if(!i)return e;var r,n,o=i.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(e){n={error:e}}finally{try{r&&!r.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}return a}function o_(e,t,i){if(i||2===arguments.length)for(var r,n=0,o=t.length;n<o;n++)!r&&n in t||(r||(r=Array.prototype.slice.call(t,0,n)),r[n]=t[n]);return e.concat(r||Array.prototype.slice.call(t))}!function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(Of||(Of={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(wf||(wf={})),function(e){e[e.QUIT=0]="QUIT",e[e.DROPPED=1]="DROPPED",e[e.SWITCH_TO_INVISIBLE=2]="SWITCH_TO_INVISIBLE",e[e.KICKED_BY_ADMIN=3]="KICKED_BY_ADMIN"}(Nf||(Nf={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(Pf||(Pf={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(kf||(kf={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(Df||(Df={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(Mf||(Mf={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(Uf||(Uf={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(Lf||(Lf={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(xf||(xf={})),function(e){e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO"}(Vf||(Vf={})),function(e){e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER"}(Ff||(Ff={})),function(e){e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED",e[e.CONNECTION_STATE_LOST=6]="CONNECTION_STATE_LOST"}(Bf||(Bf={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(jf||(jf={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(Gf||(Gf={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(Hf||(Hf={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY"}(zf||(zf={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(Kf||(Kf={})),function(e){e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY"}(Wf||(Wf={})),function(e){e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH"}(Xf||(Xf={})),function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(Yf||(Yf={})),function(e){e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth"}(qf||(qf={})),function(e){e[e.communication=0]="communication",e[e.chat=5]="chat",e[e.chatRoom=6]="chatRoom",e[e.coHost=9]="coHost",e[e.meeting=16]="meeting",e[e.classRoom=18]="classRoom"}(Jf||(Jf={})),function(e){e[e.default=0]="default",e[e.fluent=1]="fluent",e[e.standard=2]="standard",e[e.hd=3]="hd",e[e.standardStereo=4]="standardStereo",e[e.hdMono=5]="hdMono"}(Qf||(Qf={})),function(e){e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY"}(Zf||(Zf={}));var a_,s_,c_,u_=Object.freeze({__proto__:null,get VideoSourceType(){return Of},get AudioSourceType(){return wf},get UserOfflineReason(){return Nf},get ChannelProfile(){return Pf},get SubscribeMode(){return kf},get SubscribeState(){return Df},get PublishState(){return Mf},get MirrorMode(){return Uf},get VideoRenderMode(){return Lf},get StreamIndex(){return xf},get MediaType(){return Vf},get StreamRemoveReason(){return Ff},get ConnectionState(){return Bf},get MirrorType(){return jf},get LogChannel(){return Gf},get USER_ONLINE_STATUS(){return Hf},get PublicStreamType(){return zf},get PublicInterpolationMode(){return Kf},get SubscribeFallbackOption(){return Wf},get RemoteUserPriority(){return Xf},get NetworkQuality(){return Yf},get FallbackOrRecoverReason(){return qf},get RoomProfileType(){return Jf},get AudioProfileType(){return Qf},get RTCAutoPlayPolicy(){return Zf}});!function(e){e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX"}(a_||(a_={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(s_||(s_={})),function(e){e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED"}(c_||(c_={}));var d_,l_,h_=Object.freeze({__proto__:null,get AudioMixingDualMonoMode(){return a_},get AudioMixingType(){return s_},get AudioMixingState(){return c_}});!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onUserPublishStream="onUserPublishStream",e.onUserUnpublishStream="onUserUnpublishStream",e.onUserPublishScreen="onUserPublishScreen",e.onUserUnpublishScreen="onUserUnpublishScreen",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onVideoDeviceStateChanged="onVideoDeviceStateChanged",e.onAudioDeviceStateChanged="onAudioDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.onStreamMixingEvent="onStreamMixingEvent",e.onAudioPlaybackDeviceTestVolume="onAudioPlaybackDeviceTestVolume",e.onSEIMessageReceived="onSEIMessageReceived",e.onError="onError",e.onAudioMixingStateChanged="onAudioMixingStateChanged",e.onUserMessageReceivedOutsideRoom="onUserMessageReceivedOutsideRoom",e.onUserBinaryMessageReceivedOutsideRoom="onUserBinaryMessageReceivedOutsideRoom",e.onTokenWillExpire="onTokenWillExpire",e.onCloudProxyConnected="onCloudProxyConnected",e.onPushPublicStreamResult="onPushPublicStreamResult",e.onPublicStreamSEIMessageReceived="onPublicStreamSEIMessageReceived",e.onNetworkQuality="onNetworkQuality",e.onSimulcastSubscribeFallback="onSimulcastSubscribeFallback",e.onRemoteVideoSizeChanged="onRemoteVideoSizeChanged",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onServerParamsSetResult="onServerParamsSetResult"}(d_||(d_={})),function(e){e[e.ERR_OK=0]="ERR_OK",e[e.ERR_PARAM_INVALID=1]="ERR_PARAM_INVALID",e[e.ERR_FRAME_TIMEOUT=2]="ERR_FRAME_TIMEOUT",e[e.ERR_POSTPROCESS=3]="ERR_POSTPROCESS",e[e.ERR_PUSH_CDN=4]="ERR_PUSH_CDN",e[e.ERR_UNKNOWN=9999]="ERR_UNKNOWN"}(l_||(l_={}));var p_=ba.forEach,f_=jn("forEach")?[].forEach:function(e){return p_(this,e,arguments.length>1?arguments[1]:void 0)};Wr({target:"Array",proto:!0,forced:[].forEach!=f_},{forEach:f_});var __=n,v_=Cp,m_=Np,y_=f_,S_=Xt,g_=function(e){if(e&&e.forEach!==y_)try{S_(e,"forEach",y_)}catch(t){e.forEach=y_}};for(var E_ in v_)v_[E_]&&g_(__[E_]&&__[E_].prototype);g_(m_);var b_=Wr,T_=I,I_=n.Date,R_=T_(I_.prototype.getTime);b_({target:"Date",stat:!0},{now:function(){return R_(new I_)}});var A_=I,C_=Yt.exports,O_=Date.prototype,w_="Invalid Date",N_="toString",P_=A_(O_.toString),k_=A_(O_.getTime);String(new Date(NaN))!=w_&&C_(O_,N_,(function(){var e=k_(this);return e==e?P_(this):w_}));var D_=cr.includes,M_=ah;Wr({target:"Array",proto:!0},{includes:function(e){return D_(this,e,arguments.length>1?arguments[1]:void 0)}}),M_("includes");var U_=G,L_=O,x_=$e("match"),V_=function(e){var t;return U_(e)&&(void 0!==(t=e[x_])?!!t:"RegExp"==L_(e))},F_=V_,B_=n.TypeError,j_=function(e){if(F_(e))throw B_("The method doesn't accept regular expressions");return e},G_=$e("match"),H_=function(e){var t=/./;try{"/./"[e](t)}catch(i){try{return t[G_]=!1,"/./"[e](t)}catch(e){}}return!1},z_=Wr,K_=j_,W_=L,X_=fo,Y_=H_,q_=I("".indexOf);z_({target:"String",proto:!0,forced:!Y_("includes")},{includes:function(e){return!!~q_(X_(W_(this)),X_(K_(e)),arguments.length>1?arguments[1]:void 0)}});var J_=Dt,Q_=function(){var e=J_(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},Z_=a,$_=n.RegExp,ev=Z_((function(){var e=$_("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),tv=ev||Z_((function(){return!$_("a","y").sticky})),iv={BROKEN_CARET:ev||Z_((function(){var e=$_("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:tv,UNSUPPORTED_Y:ev},rv=a,nv=n.RegExp,ov=rv((function(){var e=nv(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),av=a,sv=n.RegExp,cv=av((function(){var e=sv("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),uv=l,dv=I,lv=fo,hv=Q_,pv=iv,fv=Ie.exports,_v=Rn,vv=Oi.get,mv=ov,yv=cv,Sv=fv("native-string-replace",String.prototype.replace),gv=RegExp.prototype.exec,Ev=gv,bv=dv("".charAt),Tv=dv("".indexOf),Iv=dv("".replace),Rv=dv("".slice),Av=function(){var e=/a/,t=/b*/g;return uv(gv,e,"a"),uv(gv,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),Cv=pv.BROKEN_CARET,Ov=void 0!==/()??/.exec("")[1];(Av||Ov||Cv||mv||yv)&&(Ev=function(e){var t,i,r,n,o,a,s,c=this,u=vv(c),d=lv(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=uv(Ev,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=Cv&&c.sticky,f=uv(hv,c),_=c.source,v=0,m=d;if(p&&(f=Iv(f,"y",""),-1===Tv(f,"g")&&(f+="g"),m=Rv(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==bv(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),i=new RegExp("^(?:"+_+")",f)),Ov&&(i=new RegExp("^"+_+"$(?!\\s)",f)),Av&&(r=c.lastIndex),n=uv(gv,p?i:c,m),p?n?(n.input=Rv(n.input,v),n[0]=Rv(n[0],v),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:Av&&n&&(c.lastIndex=c.global?n.index+n[0].length:r),Ov&&n&&n.length>1&&uv(Sv,n[0],i,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n&&h)for(n.groups=a=_v(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=n[s[1]];return n});var wv=Ev;Wr({target:"RegExp",proto:!0,forced:/./.exec!==wv},{exec:wv});var Nv=I,Pv=Yt.exports,kv=wv,Dv=a,Mv=$e,Uv=Xt,Lv=Mv("species"),xv=RegExp.prototype,Vv=function(e,t,i,r){var n=Mv(e),o=!Dv((function(){var t={};return t[n]=function(){return 7},7!=""[e](t)})),a=o&&!Dv((function(){var t=!1,i=/a/;return"split"===e&&((i={}).constructor={},i.constructor[Lv]=function(){return i},i.flags="",i[n]=/./[n]),i.exec=function(){return t=!0,null},i[n](""),!t}));if(!o||!a||i){var s=Nv(/./[n]),c=t(n,""[e],(function(e,t,i,r,n){var a=Nv(e),c=t.exec;return c===kv||c===xv.exec?o&&!n?{done:!0,value:s(t,i,r)}:{done:!0,value:a(i,t,r)}:{done:!1}}));Pv(String.prototype,e,c[0]),Pv(xv,n,c[1])}r&&Uv(xv[n],"sham",!0)},Fv=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Bv=l,jv=Dt,Gv=B,Hv=O,zv=wv,Kv=n.TypeError,Wv=function(e,t){var i=e.exec;if(Gv(i)){var r=Bv(i,e,t);return null!==r&&jv(r),r}if("RegExp"===Hv(e))return Bv(zv,e,t);throw Kv("RegExp#exec called on incompatible receiver")},Xv=l,Yv=Dt,qv=L,Jv=Fv,Qv=fo,Zv=Se,$v=Wv;function em(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}Vv("search",(function(e,t,i){return[function(t){var i=qv(this),r=null==t?void 0:Zv(t,e);return r?Xv(r,t,i):new RegExp(t)[e](Qv(i))},function(e){var r=Yv(this),n=Qv(e),o=i(t,r,n);if(o.done)return o.value;var a=r.lastIndex;Jv(a,0)||(r.lastIndex=0);var s=$v(r,n);return Jv(r.lastIndex,a)||(r.lastIndex=a),null===s?-1:s.index}]}));var tm=Sp.charAt,im=function(e,t,i){return t+(i?tm(e,t).length:1)},rm=l,nm=Dt,om=tr,am=fo,sm=L,cm=Se,um=im,dm=Wv;Vv("match",(function(e,t,i){return[function(t){var i=sm(this),r=null==t?void 0:cm(t,e);return r?rm(r,t,i):new RegExp(t)[e](am(i))},function(e){var r=nm(this),n=am(e),o=i(t,r,n);if(o.done)return o.value;if(!r.global)return dm(r,n);var a=r.unicode;r.lastIndex=0;for(var s,c=[],u=0;null!==(s=dm(r,n));){var d=am(s[0]);c[u]=d,""===d&&(r.lastIndex=um(n,om(r.lastIndex),a)),u++}return 0===u?null:c}]}));var lm="\t\n\v\f\r \u2028\u2029\ufeff",hm=L,pm=fo,fm=I("".replace),_m="[\t\n\v\f\r \u2028\u2029\ufeff]",vm=RegExp("^"+_m+_m+"*"),mm=RegExp(_m+_m+"*$"),ym=function(e){return function(t){var i=pm(hm(t));return 1&e&&(i=fm(i,vm,"")),2&e&&(i=fm(i,mm,"")),i}},Sm={start:ym(1),end:ym(2),trim:ym(3)},gm=n,Em=a,bm=I,Tm=fo,Im=Sm.trim,Rm=lm,Am=gm.parseInt,Cm=gm.Symbol,Om=Cm&&Cm.iterator,wm=/^[+-]?0x/i,Nm=bm(wm.exec),Pm=8!==Am(Rm+"08")||22!==Am(Rm+"0x16")||Om&&!Em((function(){Am(Object(Om))}))?function(e,t){var i=Im(Tm(e));return Am(i,t>>>0||(Nm(wm,i)?16:10))}:Am;Wr({global:!0,forced:parseInt!=Pm},{parseInt:Pm});var km={exports:{}},Dm=a((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Mm=a,Um=G,Lm=O,xm=Dm,Vm=Object.isExtensible,Fm=Mm((function(){Vm(1)}))||xm?function(e){return!!Um(e)&&((!xm||"ArrayBuffer"!=Lm(e))&&(!Vm||Vm(e)))}:Vm,Bm=!a((function(){return Object.isExtensible(Object.preventExtensions({}))})),jm=Wr,Gm=I,Hm=di,zm=G,Km=xe,Wm=Ct.f,Xm=Ki,Ym=_o,qm=Fm,Jm=Bm,Qm=!1,Zm=Ge("meta"),$m=0,ey=function(e){Wm(e,Zm,{value:{objectID:"O"+$m++,weakData:{}}})},ty=km.exports={enable:function(){ty.enable=function(){},Qm=!0;var e=Xm.f,t=Gm([].splice),i={};i[Zm]=1,e(i).length&&(Xm.f=function(i){for(var r=e(i),n=0,o=r.length;n<o;n++)if(r[n]===Zm){t(r,n,1);break}return r},jm({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Ym.f}))},fastKey:function(e,t){if(!zm(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Km(e,Zm)){if(!qm(e))return"F";if(!t)return"E";ey(e)}return e[Zm].objectID},getWeakData:function(e,t){if(!Km(e,Zm)){if(!qm(e))return!0;if(!t)return!1;ey(e)}return e[Zm].weakData},onFreeze:function(e){return Jm&&Qm&&qm(e)&&!Km(e,Zm)&&ey(e),e}};Hm[Zm]=!0;var iy=B,ry=G,ny=en,oy=function(e,t,i){var r,n;return ny&&iy(r=t.constructor)&&r!==i&&ry(n=r.prototype)&&n!==i.prototype&&ny(e,n),e},ay=Wr,sy=n,cy=I,uy=Vr,dy=Yt.exports,ly=km.exports,hy=Wc,py=lc,fy=B,_y=G,vy=a,my=tu,yy=Go,Sy=oy,gy=function(e,t,i){var r=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=r?"set":"add",a=sy[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=cy(s[e]);dy(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(n&&!_y(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return n&&!_y(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(n&&!_y(e))&&t(this,0===e?0:e)}:function(e,i){return t(this,0===e?0:e,i),this})};if(uy(e,!fy(a)||!(n||s.forEach&&!vy((function(){(new a).entries().next()})))))c=i.getConstructor(t,e,r,o),ly.enable();else if(uy(e,!0)){var l=new c,h=l[o](n?{}:-0,1)!=l,p=vy((function(){l.has(1)})),f=my((function(e){new a(e)})),_=!n&&vy((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));f||((c=t((function(e,t){py(e,s);var i=Sy(new a,e,c);return null!=t&&hy(t,i[o],{that:i,AS_ENTRIES:r}),i}))).prototype=s,s.constructor=c),(p||_)&&(d("delete"),d("has"),r&&d("get")),(_||h)&&d(o),n&&s.clear&&delete s.clear}return u[e]=c,ay({global:!0,forced:c!=a},u),yy(c,e),n||i.setStrong(c,e,r),c},Ey=Ct.f,by=Rn,Ty=rc,Iy=Wo,Ry=lc,Ay=Wc,Cy=Zh,Oy=cc,wy=s,Ny=km.exports.fastKey,Py=Oi.set,ky=Oi.getterFor,Dy={getConstructor:function(e,t,i,r){var n=e((function(e,n){Ry(e,o),Py(e,{type:t,index:by(null),first:void 0,last:void 0,size:0}),wy||(e.size=0),null!=n&&Ay(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=ky(t),s=function(e,t,i){var r,n,o=a(e),s=c(e,t);return s?s.value=i:(o.last=s={index:n=Ny(t,!0),key:t,value:i,previous:r=o.last,next:void 0,removed:!1},o.first||(o.first=s),r&&(r.next=s),wy?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},c=function(e,t){var i,r=a(e),n=Ny(t);if("F"!==n)return r.index[n];for(i=r.first;i;i=i.next)if(i.key==t)return i};return Ty(o,{clear:function(){for(var e=a(this),t=e.index,i=e.first;i;)i.removed=!0,i.previous&&(i.previous=i.previous.next=void 0),delete t[i.index],i=i.next;e.first=e.last=void 0,wy?e.size=0:this.size=0},delete:function(e){var t=this,i=a(t),r=c(t,e);if(r){var n=r.next,o=r.previous;delete i.index[r.index],r.removed=!0,o&&(o.next=n),n&&(n.previous=o),i.first==r&&(i.first=n),i.last==r&&(i.last=o),wy?i.size--:t.size--}return!!r},forEach:function(e){for(var t,i=a(this),r=Iy(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:i.first;)for(r(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Ty(o,i?{get:function(e){var t=c(this,e);return t&&t.value},set:function(e,t){return s(this,0===e?0:e,t)}}:{add:function(e){return s(this,e=0===e?0:e,e)}}),wy&&Ey(o,"size",{get:function(){return a(this).size}}),n},setStrong:function(e,t,i){var r=t+" Iterator",n=ky(t),o=ky(r);Cy(e,t,(function(e,t){Py(this,{type:r,target:e,state:n(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,i=e.last;i&&i.removed;)i=i.previous;return e.target&&(e.last=i=i?i.next:e.state.first)?"keys"==t?{value:i.key,done:!1}:"values"==t?{value:i.value,done:!1}:{value:[i.key,i.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),i?"entries":"values",!i,!0),Oy(t)}};gy("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Dy);var My=Me,Uy=on;Wr({target:"Object",stat:!0,forced:a((function(){Uy(1)}))},{keys:function(e){return Uy(My(e))}});var Ly=me,xy=Me,Vy=M,Fy=rr,By=n.TypeError,jy=function(e){return function(t,i,r,n){Ly(i);var o=xy(t),a=Vy(o),s=Fy(o),c=e?s-1:0,u=e?-1:1;if(r<2)for(;;){if(c in a){n=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw By("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(n=i(n,a[c],c,o));return n}},Gy={left:jy(!1),right:jy(!0)},Hy=Gy.left,zy=te,Ky=pu;Wr({target:"Array",proto:!0,forced:!jn("reduce")||!Ky&&zy>79&&zy<83},{reduce:function(e){var t=arguments.length;return Hy(this,e,t,t>1?arguments[1]:void 0)}});var Wy,Xy=Wr,Yy=I,qy=o.f,Jy=tr,Qy=fo,Zy=j_,$y=L,eS=H_,tS=Yy("".endsWith),iS=Yy("".slice),rS=Math.min,nS=eS("endsWith");Xy({target:"String",proto:!0,forced:!!(nS||(Wy=qy(String.prototype,"endsWith"),!Wy||Wy.writable))&&!nS},{endsWith:function(e){var t=Qy($y(this));Zy(e);var i=arguments.length>1?arguments[1]:void 0,r=t.length,n=void 0===i?r:rS(Jy(i),r),o=Qy(e);return tS?tS(t,o,n):iS(t,n-o.length,n)===o}});var oS=!0,aS=!0;function sS(e,t,i){var r=e.match(t);return r&&r.length>=i&&parseInt(r[i],10)}function cS(e,t,i){if(e.RTCPeerConnection){var r=e.RTCPeerConnection.prototype,n=r.addEventListener;r.addEventListener=function(e,r){if(e!==t)return n.apply(this,arguments);var o=function(e){var t=i(e);t&&(r.handleEvent?r.handleEvent(t):r(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(r,o),n.apply(this,[e,o])};var o=r.removeEventListener;r.removeEventListener=function(e,i){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(i))return o.apply(this,arguments);var r=this._eventMap[t].get(i);return this._eventMap[t].delete(i),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,r])},Object.defineProperty(r,"on"+t,{get:function(){return this["_on"+t]},set:function(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 uS(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(oS=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function dS(e){return"boolean"!=typeof e?new Error("Argument type: "+t(e)+". Please use a boolean."):(aS=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function lS(){if("object"===("undefined"==typeof window?"undefined":t(window))){if(oS)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function hS(e,t){aS&&console.warn(e+" is deprecated, please use "+t+" instead.")}function pS(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var i=e.navigator;if(i.mozGetUserMedia)t.browser="firefox",t.version=sS(i.userAgent,/Firefox\/(\d+)\./,1);else if(i.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=sS(i.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!i.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=sS(i.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function fS(e){return"[object Object]"===Object.prototype.toString.call(e)}function _S(e){return fS(e)?Object.keys(e).reduce((function(t,i){var r=fS(e[i]),n=r?_S(e[i]):e[i],o=r&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,em({},i,n))}),{}):e}function vS(e,t,i){t&&!i.has(t.id)&&(i.set(t.id,t),Object.keys(t).forEach((function(r){r.endsWith("Id")?vS(e,e.get(t[r]),i):r.endsWith("Ids")&&t[r].forEach((function(t){vS(e,e.get(t),i)}))})))}function mS(e,t,i){var r=i?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(i){i.type===r&&i.trackId===t.id&&vS(e,i,n)}))})),n}var yS=Wr,SS=ba.find,gS=ah,ES="find",bS=!0;ES in[]&&Array(1).find((function(){bS=!1})),yS({target:"Array",proto:!0,forced:bS},{find:function(e){return SS(this,e,arguments.length>1?arguments[1]:void 0)}}),gS(ES);var TS=Wr,IS=n,RS=Zi,AS=Yi,CS=rr,OS=Me,wS=fa,NS=So,PS=Kp("splice"),kS=IS.TypeError,DS=Math.max,MS=Math.min,US=9007199254740991,LS="Maximum allowed length exceeded";TS({target:"Array",proto:!0,forced:!PS},{splice:function(e,t){var i,r,n,o,a,s,c=OS(this),u=CS(c),d=RS(e,u),l=arguments.length;if(0===l?i=r=0:1===l?(i=0,r=u-d):(i=l-2,r=MS(DS(AS(t),0),u-d)),u+i-r>US)throw kS(LS);for(n=wS(c,r),o=0;o<r;o++)(a=d+o)in c&&NS(n,o,c[a]);if(n.length=r,i<r){for(o=d;o<u-r;o++)s=o+i,(a=o+r)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-r+i;o--)delete c[o-1]}else if(i>r)for(o=u-r;o>d;o--)s=o+i-1,(a=o+r-1)in c?c[s]=c[a]:delete c[s];for(o=0;o<i;o++)c[o+d]=arguments[o+2];return c.length=u-r+i,n}});var xS=ba.map;Wr({target:"Array",proto:!0,forced:!Kp("map")},{map:function(e){return xS(this,e,arguments.length>1?arguments[1]:void 0)}});var VS=ba.filter;Wr({target:"Array",proto:!0,forced:!Kp("filter")},{filter:function(e){return VS(this,e,arguments.length>1?arguments[1]:void 0)}});var FS=I,BS=Me,jS=Math.floor,GS=FS("".charAt),HS=FS("".replace),zS=FS("".slice),KS=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,WS=/\$([$&'`]|\d{1,2})/g,XS=Zn,YS=l,qS=I,JS=Vv,QS=a,ZS=Dt,$S=B,eg=Yi,tg=tr,ig=fo,rg=L,ng=im,og=Se,ag=function(e,t,i,r,n,o){var a=i+e.length,s=r.length,c=WS;return void 0!==n&&(n=BS(n),c=KS),HS(o,c,(function(o,c){var u;switch(GS(c,0)){case"$":return"$";case"&":return e;case"`":return zS(t,0,i);case"'":return zS(t,a);case"<":u=n[zS(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=jS(d/10);return 0===l?o:l<=s?void 0===r[l-1]?GS(c,1):r[l-1]+GS(c,1):o}u=r[d-1]}return void 0===u?"":u}))},sg=Wv,cg=$e("replace"),ug=Math.max,dg=Math.min,lg=qS([].concat),hg=qS([].push),pg=qS("".indexOf),fg=qS("".slice),_g="$0"==="a".replace(/./,"$0"),vg=!!/./[cg]&&""===/./[cg]("a","$0");JS("replace",(function(e,t,i){var r=vg?"$":"$0";return[function(e,i){var r=rg(this),n=null==e?void 0:og(e,cg);return n?YS(n,e,r,i):YS(t,ig(r),e,i)},function(e,n){var o=ZS(this),a=ig(e);if("string"==typeof n&&-1===pg(n,r)&&-1===pg(n,"$<")){var s=i(t,o,a,n);if(s.done)return s.value}var c=$S(n);c||(n=ig(n));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=sg(o,a);if(null===h)break;if(hg(l,h),!u)break;""===ig(h[0])&&(o.lastIndex=ng(a,tg(o.lastIndex),d))}for(var p,f="",_=0,v=0;v<l.length;v++){for(var m=ig((h=l[v])[0]),y=ug(dg(eg(h.index),a.length),0),S=[],g=1;g<h.length;g++)hg(S,void 0===(p=h[g])?p:String(p));var E=h.groups;if(c){var b=lg([m],S,y,a);void 0!==E&&hg(b,E);var T=ig(XS(n,void 0,b))}else T=ag(m,a,y,S,E,n);y>=_&&(f+=fg(a,_,y)+T,_=y+m.length)}return f+fg(a,_)}]}),!!QS((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!_g||vg);var mg=s,yg=n,Sg=I,gg=Vr,Eg=oy,bg=Xt,Tg=Ct.f,Ig=Ki.f,Rg=X,Ag=V_,Cg=fo,Og=Q_,wg=iv,Ng=Yt.exports,Pg=a,kg=xe,Dg=Oi.enforce,Mg=cc,Ug=ov,Lg=cv,xg=$e("match"),Vg=yg.RegExp,Fg=Vg.prototype,Bg=yg.SyntaxError,jg=Sg(Og),Gg=Sg(Fg.exec),Hg=Sg("".charAt),zg=Sg("".replace),Kg=Sg("".indexOf),Wg=Sg("".slice),Xg=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,Yg=/a/g,qg=/a/g,Jg=new Vg(Yg)!==Yg,Qg=wg.MISSED_STICKY,Zg=wg.UNSUPPORTED_Y,$g=mg&&(!Jg||Qg||Ug||Lg||Pg((function(){return qg[xg]=!1,Vg(Yg)!=Yg||Vg(qg)==qg||"/a/i"!=Vg(Yg,"i")})));if(gg("RegExp",$g)){for(var eE=function(e,t){var i,r,n,o,a,s,c=Rg(Fg,this),u=Ag(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===eE)return e;if((u||Rg(Fg,e))&&(e=e.source,d&&(t="flags"in h?h.flags:jg(h))),e=void 0===e?"":Cg(e),t=void 0===t?"":Cg(t),h=e,Ug&&"dotAll"in Yg&&(r=!!t&&Kg(t,"s")>-1)&&(t=zg(t,/s/g,"")),i=t,Qg&&"sticky"in Yg&&(n=!!t&&Kg(t,"y")>-1)&&Zg&&(t=zg(t,/y/g,"")),Lg&&(o=function(e){for(var t,i=e.length,r=0,n="",o=[],a={},s=!1,c=!1,u=0,d="";r<=i;r++){if("\\"===(t=Hg(e,r)))t+=Hg(e,++r);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:Gg(Xg,Wg(e,r+1))&&(r+=2,c=!0),n+=t,u++;continue;case">"===t&&c:if(""===d||kg(a,d))throw new Bg("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:n+=t}return[n,o]}(e),e=o[0],l=o[1]),a=Eg(Vg(e,t),c?this:Fg,eE),(r||n||l.length)&&(s=Dg(a),r&&(s.dotAll=!0,s.raw=eE(function(e){for(var t,i=e.length,r=0,n="",o=!1;r<=i;r++)"\\"!==(t=Hg(e,r))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+Hg(e,++r);return n}(e),i)),n&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{bg(a,"source",""===h?"(?:)":h)}catch(e){}return a},tE=function(e){e in eE||Tg(eE,e,{configurable:!0,get:function(){return Vg[e]},set:function(t){Vg[e]=t}})},iE=Ig(Vg),rE=0;iE.length>rE;)tE(iE[rE++]);Fg.constructor=eE,eE.prototype=Fg,Ng(yg,"RegExp",eE)}Mg("RegExp");var nE=I,oE=Mi.PROPER,aE=Yt.exports,sE=Dt,cE=X,uE=fo,dE=a,lE=Q_,hE="toString",pE=RegExp.prototype,fE=pE.toString,_E=nE(lE),vE=dE((function(){return"/a/b"!=fE.call({source:"a",flags:"b"})})),mE=oE&&fE.name!=hE;(vE||mE)&&aE(RegExp.prototype,hE,(function(){var e=sE(this),t=uE(e.source),i=e.flags;return"/"+t+"/"+uE(void 0===i&&cE(pE,e)&&!("flags"in pE)?_E(e):i)}),{unsafe:!0});var yE=ba.some;Wr({target:"Array",proto:!0,forced:!jn("some")},{some:function(e){return yE(this,e,arguments.length>1?arguments[1]:void 0)}});var SE=s,gE=Mi.EXISTS,EE=I,bE=Ct.f,TE=Function.prototype,IE=EE(TE.toString),RE=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,AE=EE(RE.exec);SE&&!gE&&bE(TE,"name",{configurable:!0,get:function(){try{return AE(RE,IE(this))[1]}catch(e){return""}}});var CE=I,OE=me,wE=G,NE=xe,PE=Po,kE=c,DE=n.Function,ME=CE([].concat),UE=CE([].join),LE={},xE=function(e,t,i){if(!NE(LE,t)){for(var r=[],n=0;n<t;n++)r[n]="a["+n+"]";LE[t]=DE("C,a","return new C("+UE(r,",")+")")}return LE[t](e,i)},VE=kE?DE.bind:function(e){var t=OE(this),i=t.prototype,r=PE(arguments,1),n=function(){var i=ME(r,PE(arguments));return this instanceof n?xE(t,i.length,i):t.apply(e,i)};return wE(i)&&(n.prototype=i),n},FE=VE;Wr({target:"Function",proto:!0,forced:Function.bind!==FE},{bind:FE});var BE=lS;function jE(e,i){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==t(e)||e.mandatory||e.optional)return e;var i={};return Object.keys(e).forEach((function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"===t(e[r])?e[r]:{ideal:e[r]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var o=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){i.optional=i.optional||[];var a={};"number"==typeof n.ideal?(a[o("min",r)]=n.ideal,i.optional.push(a),(a={})[o("max",r)]=n.ideal,i.optional.push(a)):(a[o("",r)]=n.ideal,i.optional.push(a))}void 0!==n.exact&&"number"!=typeof n.exact?(i.mandatory=i.mandatory||{},i.mandatory[o("",r)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(i.mandatory=i.mandatory||{},i.mandatory[o(e,r)]=n[e])}))}})),e.advanced&&(i.optional=(i.optional||[]).concat(e.advanced)),i},o=function(e,o){if(i.version>=61)return o(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===t(e.audio)){var a=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])};a((e=JSON.parse(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===t(e.video)){var s=e.video.facingMode;s=s&&("object"===t(s)?s:{ideal:s});var c,u=i.version<66;if(s&&("user"===s.exact||"environment"===s.exact||"user"===s.ideal||"environment"===s.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||u))if(delete e.video.facingMode,"environment"===s.exact||"environment"===s.ideal?c=["back","rear"]:"user"!==s.exact&&"user"!==s.ideal||(c=["front"]),c)return r.mediaDevices.enumerateDevices().then((function(t){var i=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return c.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!i&&t.length&&c.includes("back")&&(i=t[t.length-1]),i&&(e.video.deviceId=s.exact?{exact:i.deviceId}:{ideal:i.deviceId}),e.video=n(e.video),BE("chrome: "+JSON.stringify(e)),o(e)}));e.video=n(e.video)}return BE("chrome: "+JSON.stringify(e)),o(e)},a=function(e){return i.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:function(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,i){o(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){i&&i(a(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return o(e,(function(e){return s(e).then((function(t){if(e.audio&&!t.getAudioTracks().length||e.video&&!t.getVideoTracks().length)throw t.getTracks().forEach((function(e){e.stop()})),new DOMException("","NotFoundError");return t}),(function(e){return Promise.reject(a(e))}))}))}}}}function GE(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function HE(e){if("object"===t(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var t=this;return this._ontrackpoly||(this._ontrackpoly=function(i){i.stream.addEventListener("addtrack",(function(r){var n;n=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===r.track.id})):{track:r.track};var o=new Event("track");o.track=r.track,o.receiver=n,o.transceiver={receiver:n},o.streams=[i.stream],t.dispatchEvent(o)})),i.stream.getTracks().forEach((function(r){var n;n=e.RTCPeerConnection.prototype.getReceivers?t.getReceivers().find((function(e){return e.track&&e.track.id===r.id})):{track:r};var o=new Event("track");o.track=r,o.receiver=n,o.transceiver={receiver:n},o.streams=[i.stream],t.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),i.apply(this,arguments)}}else cS(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function zE(e){if("object"===t(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var i=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()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,t){var n=r.apply(this,arguments);return n||(n=i(this,e),this._senders.push(n)),n};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var o=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){t._senders.push(i(t,e))}))};var a=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],a.apply(this,[e]),e.getTracks().forEach((function(e){var i=t._senders.find((function(t){return t.track===e}));i&&t._senders.splice(t._senders.indexOf(i),1)}))}}else if("object"===t(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var s=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=s.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function KE(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,i=Array.prototype.slice.call(arguments),r=i[0],n=i[1],o=i[2];if(arguments.length>0&&"function"==typeof r)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof r))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var i={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){i[t]=e.stat(t)})),t[i.id]=i})),t},s=function(e){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){n(s(a(e)))};return t.apply(this,[c,r])}return new Promise((function(i,r){t.apply(e,[function(e){i(s(a(e)))},r])})).then(n,o)}}}function WE(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var i=e.RTCPeerConnection.prototype.getSenders;i&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=i.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return mS(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var n=e.RTCPeerConnection.prototype.getReceivers;n&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=n.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),cS(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){var e=this;return this._pc.getStats().then((function(t){return mS(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var o=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,i,r,n=arguments[0];return this.getSenders().forEach((function(e){e.track===n&&(t?r=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===n&&(i?r=!0:i=e),e.track===n})),r||t&&i?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():i?i.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return o.apply(this,arguments)}}}}function XE(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){if(!i)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var r=t.apply(this,arguments);return this._shimmedLocalStreams[i.id]?-1===this._shimmedLocalStreams[i.id].indexOf(r)&&this._shimmedLocalStreams[i.id].push(r):this._shimmedLocalStreams[i.id]=[i,r],r};var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var r=this.getSenders();i.apply(this,arguments);var n=this.getSenders().filter((function(e){return-1===r.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(n)};var r=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],r.apply(this,arguments)};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(i){var r=t._shimmedLocalStreams[i].indexOf(e);-1!==r&&t._shimmedLocalStreams[i].splice(r,1),1===t._shimmedLocalStreams[i].length&&delete t._shimmedLocalStreams[i]})),n.apply(this,arguments)}}function YE(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return XE(e);var i=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=i.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var i=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){if(i.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}r.apply(this,[t])};var n=e.RTCPeerConnection.prototype.removeStream;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,i){var r=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[i.id];if(a)a.addTrack(t),Promise.resolve().then((function(){r.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[i.id]=s,this._reverseStreams[s.id]=i,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=em({},t,(function(){var e=this,t=arguments,r=arguments.length&&"function"==typeof arguments[0];return r?i.apply(this,[function(i){var r=s(e,i);t[0].apply(null,[r])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):i.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=r[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,i=this;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");this._streams=this._streams||{},Object.keys(this._streams).forEach((function(r){i._streams[r].getTracks().find((function(t){return e.track===t}))&&(t=i._streams[r])})),t&&(1===t.getTracks().length?this.removeStream(this._reverseStreams[t.id]):t.removeTrack(e.track),this.dispatchEvent(new Event("negotiationneeded")))}}function s(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(n.id,"g"),r.id)})),new RTCSessionDescription({type:t.type,sdp:i})}function c(e,t){var i=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var r=e._reverseStreams[t],n=e._streams[r.id];i=i.replace(new RegExp(r.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:i})}}function qE(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=em({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}))}function JE(e,t){cS(e,"negotiationneeded",(function(e){var i=e.target;if(!(t.version<72||i.getConfiguration&&"plan-b"===i.getConfiguration().sdpSemantics)||"stable"===i.signalingState)return e}))}var QE=Object.freeze({__proto__:null,shimMediaStream:GE,shimOnTrack:HE,shimGetSendersWithDtmf:zE,shimGetStats:KE,shimSenderReceiverGetStats:WE,shimAddTrackRemoveTrackWithNative:XE,shimAddTrackRemoveTrack:YE,shimPeerConnection:qE,fixNegotiationNeeded:JE,shimGetUserMedia:jE,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(i){return t(i).then((function(t){var r=i.video&&i.video.width,n=i.video&&i.video.height,o=i.video&&i.video.frameRate;return i.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},r&&(i.video.mandatory.maxWidth=r),n&&(i.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(i)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),ZE=n,$E=a,eb=fo,tb=Sm.trim,ib=I("".charAt),rb=ZE.parseFloat,nb=ZE.Symbol,ob=nb&&nb.iterator,ab=1/rb("\t\n\v\f\r \u2028\u2029\ufeff-0")!=-1/0||ob&&!$E((function(){rb(Object(ob))}))?function(e){var t=tb(eb(e)),i=rb(t);return 0===i&&"-"==ib(t,0)?-0:i}:rb;Wr({global:!0,forced:parseFloat!=ab},{parseFloat:ab});var sb=Wr,cb=tc,ub=a,db=W,lb=B,hb=uu,pb=Sd,fb=Yt.exports;if(sb({target:"Promise",proto:!0,real:!0,forced:!!cb&&ub((function(){cb.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=hb(this,db("Promise")),i=lb(e);return this.then(i?function(i){return pb(t,e()).then((function(){return i}))}:e,i?function(i){return pb(t,e()).then((function(){throw i}))}:e)}}),lb(cb)){var _b=db("Promise").prototype.finally;cb.prototype.finally!==_b&&fb(cb.prototype,"finally",_b,{unsafe:!0})}function vb(e,i){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){hS("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,i)},!(i.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var o=function(e,t,i){t in e&&!(i in e)&&(e[i]=e[t],delete e[t])},a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===t(e)&&"object"===t(e.audio)&&(e=JSON.parse(JSON.stringify(e)),o(e.audio,"autoGainControl","mozAutoGainControl"),o(e.audio,"noiseSuppression","mozNoiseSuppression")),a(e)},n&&n.prototype.getSettings){var s=n.prototype.getSettings;n.prototype.getSettings=function(){var e=s.apply(this,arguments);return o(e,"mozAutoGainControl","autoGainControl"),o(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var c=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===t(e)&&(e=JSON.parse(JSON.stringify(e)),o(e,"autoGainControl","mozAutoGainControl"),o(e,"noiseSuppression","mozNoiseSuppression")),c.apply(this,[e])}}}}function mb(e){"object"===t(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function yb(e,i){if("object"===t(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),i.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var i=e.RTCPeerConnection.prototype[t],r=em({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=r[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),t=e[0],o=e[1],a=e[2];return n.apply(this,[t||null]).then((function(e){if(i.version<53&&!o)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,i){e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function Sb(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var i=e.RTCPeerConnection.prototype.getSenders;i&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=i.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t});var r=e.RTCPeerConnection.prototype.addTrack;r&&(e.RTCPeerConnection.prototype.addTrack=function(){var e=r.apply(this,arguments);return e._pc=this,e}),e.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}}function gb(e){if("object"===t(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var i=e.RTCPeerConnection.prototype.getReceivers;i&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=i.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),cS(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function Eb(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;hS("removeStream","removeTrack"),this.getSenders().forEach((function(i){i.track&&e.getTracks().includes(i.track)&&t.removeTrack(i)}))})}function bb(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Tb(e){if("object"===t(e)&&e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype.addTransceiver;i&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],t=e&&"sendEncodings"in e;t&&e.sendEncodings.forEach((function(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")}));var r=i.apply(this,arguments);if(t){var n=r.sender,o=n.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,n.sendEncodings=e.sendEncodings,this.setParametersPromises.push(n.setParameters(o).then((function(){delete n.sendEncodings})).catch((function(){delete n.sendEncodings}))))}return r})}}function Ib(e){if("object"===t(e)&&e.RTCRtpSender){var i=e.RTCRtpSender.prototype.getParameters;i&&(e.RTCRtpSender.prototype.getParameters=function(){var e=i.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function Rb(e){if("object"===t(e)&&e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,t=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return i.apply(t,e)})).finally((function(){t.setParametersPromises=[]})):i.apply(this,arguments)}}}function Ab(e){if("object"===t(e)&&e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,t=this;return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then((function(){return i.apply(t,e)})).finally((function(){t.setParametersPromises=[]})):i.apply(this,arguments)}}}var Cb=Object.freeze({__proto__:null,shimOnTrack:mb,shimPeerConnection:yb,shimSenderGetStats:Sb,shimReceiverGetStats:gb,shimRemoveStream:Eb,shimRTCDataChannel:bb,shimAddTransceiver:Tb,shimGetParameters:Ib,shimCreateOffer:Rb,shimCreateAnswer:Ab,shimGetUserMedia:vb,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(i){if(!i||!i.video){var r=new DOMException("getDisplayMedia without video constraints is undefined");return r.name="NotFoundError",r.code=8,Promise.reject(r)}return!0===i.video?i.video={mediaSource:t}:i.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(i)})}});function Ob(e){if("object"===t(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)){var i=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return i.call(t,r,e)})),e.getVideoTracks().forEach((function(r){return i.call(t,r,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var t=this,r=arguments.length,n=new Array(r>1?r-1:0),o=1;o<r;o++)n[o-1]=arguments[o];return n&&n.forEach((function(e){t._localStreams?t._localStreams.includes(e)||t._localStreams.push(e):t._localStreams=[e]})),i.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._localStreams||(this._localStreams=[]);var i=this._localStreams.indexOf(e);if(-1!==i){this._localStreams.splice(i,1);var r=e.getTracks();this.getSenders().forEach((function(e){r.includes(e.track)&&t.removeTrack(e)}))}})}}function wb(e){if("object"===t(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:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var i=new Event("addstream");i.stream=e,t.dispatchEvent(i)}}))})}});var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var e=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(t){t.streams.forEach((function(t){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var i=new Event("addstream");i.stream=t,e.dispatchEvent(i)}}))}),i.apply(e,arguments)}}}function Nb(e){if("object"===t(e)&&e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype,r=i.createOffer,n=i.createAnswer,o=i.setLocalDescription,a=i.setRemoteDescription,s=i.addIceCandidate;i.createOffer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n},i.createAnswer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],r=n.apply(this,[i]);return t?(r.then(e,t),Promise.resolve()):r};var c=function(e,t,i){var r=o.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r};i.setLocalDescription=c,c=function(e,t,i){var r=a.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},i.setRemoteDescription=c,c=function(e,t,i){var r=s.apply(this,[e]);return i?(r.then(t,i),Promise.resolve()):r},i.addIceCandidate=c}}function Pb(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var i=t.mediaDevices,r=i.getUserMedia.bind(i);t.mediaDevices.getUserMedia=function(e){return r(kb(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,i,r){t.mediaDevices.getUserMedia(e).then(i,r)}.bind(t))}function kb(e){return e&&void 0!==e.video?Object.assign({},e,{video:_S(e.video)}):e}function Db(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,i){if(e&&e.iceServers){for(var r=[],n=0;n<e.iceServers.length;n++){var o=e.iceServers[n];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(hS("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,r.push(o)):r.push(e.iceServers[n])}e.iceServers=r}return new t(e,i)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function Mb(e){"object"===t(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Ub(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&i?"sendrecv"===i.direction?i.setDirection?i.setDirection("sendonly"):i.direction="sendonly":"recvonly"===i.direction&&(i.setDirection?i.setDirection("inactive"):i.direction="inactive"):!0!==e.offerToReceiveAudio||i||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var r=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveVideo||r||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Lb(e){"object"!==t(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var xb=Object.freeze({__proto__:null,shimLocalStreamsAPI:Ob,shimRemoteStreamsAPI:wb,shimCallbacksAPI:Nb,shimGetUserMedia:Pb,shimConstraints:kb,shimRTCIceServerUrls:Db,shimTrackEventTransceiver:Mb,shimCreateOfferLegacy:Ub,shimAudioContext:Lb}),Vb=Me,Fb=ct;Wr({target:"Date",proto:!0,forced:a((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=Vb(this),i=Fb(t,"number");return"number"!=typeof i||isFinite(i)?t.toISOString():null}});var Bb=l;Wr({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Bb(URL.prototype.toString,this)}});var jb=I(1..valueOf),Gb=s,Hb=n,zb=I,Kb=Vr,Wb=Yt.exports,Xb=xe,Yb=oy,qb=X,Jb=le,Qb=ct,Zb=a,$b=Ki.f,eT=o.f,tT=Ct.f,iT=jb,rT=Sm.trim,nT="Number",oT=Hb.Number,aT=oT.prototype,sT=Hb.TypeError,cT=zb("".slice),uT=zb("".charCodeAt),dT=function(e){var t=Qb(e,"number");return"bigint"==typeof t?t:lT(t)},lT=function(e){var t,i,r,n,o,a,s,c,u=Qb(e,"number");if(Jb(u))throw sT("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=rT(u),43===(t=uT(u,0))||45===t){if(88===(i=uT(u,2))||120===i)return NaN}else if(48===t){switch(uT(u,1)){case 66:case 98:r=2,n=49;break;case 79:case 111:r=8,n=55;break;default:return+u}for(a=(o=cT(u,2)).length,s=0;s<a;s++)if((c=uT(o,s))<48||c>n)return NaN;return parseInt(o,r)}return+u};if(Kb(nT,!oT(" 0o1")||!oT("0b1")||oT("+0x1"))){for(var hT,pT=function(e){var t=arguments.length<1?0:oT(dT(e)),i=this;return qb(aT,i)&&Zb((function(){iT(i)}))?Yb(Object(t),i,pT):t},fT=Gb?$b(oT):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),_T=0;fT.length>_T;_T++)Xb(oT,hT=fT[_T])&&!Xb(pT,hT)&&tT(pT,hT,eT(oT,hT));pT.prototype=aT,aT.constructor=pT,Wb(Hb,nT,pT)}var vT=Wr,mT=M,yT=F,ST=jn,gT=I([].join),ET=mT!=Object,bT=ST("join",",");vT({target:"Array",proto:!0,forced:ET||!bT},{join:function(e){return gT(yT(this),void 0===e?",":e)}});var TT=Zn,IT=l,RT=I,AT=Vv,CT=V_,OT=Dt,wT=L,NT=uu,PT=im,kT=tr,DT=fo,MT=Se,UT=Ro,LT=Wv,xT=wv,VT=a,FT=iv.UNSUPPORTED_Y,BT=4294967295,jT=Math.min,GT=[].push,HT=RT(/./.exec),zT=RT(GT),KT=RT("".slice),WT=!VT((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var i="ab".split(e);return 2!==i.length||"a"!==i[0]||"b"!==i[1]}));AT("split",(function(e,t,i){var r;return r="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,i){var r=DT(wT(this)),n=void 0===i?BT:i>>>0;if(0===n)return[];if(void 0===e)return[r];if(!CT(e))return IT(t,r,e,n);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=IT(xT,l,r))&&!((a=l.lastIndex)>d&&(zT(c,KT(r,d,o.index)),o.length>1&&o.index<r.length&&TT(GT,c,UT(o,1)),s=o[0].length,d=a,c.length>=n));)l.lastIndex===o.index&&l.lastIndex++;return d===r.length?!s&&HT(l,"")||zT(c,""):zT(c,KT(r,d)),c.length>n?UT(c,0,n):c}:"0".split(void 0,0).length?function(e,i){return void 0===e&&0===i?[]:IT(t,this,e,i)}:t,[function(t,i){var n=wT(this),o=null==t?void 0:MT(t,e);return o?IT(o,t,n,i):IT(r,DT(n),t,i)},function(e,n){var o=OT(this),a=DT(e),s=i(r,o,a,n,r!==t);if(s.done)return s.value;var c=NT(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(FT?"g":"y"),l=new c(FT?"^(?:"+o.source+")":o,d),h=void 0===n?BT:n>>>0;if(0===h)return[];if(0===a.length)return null===LT(l,a)?[a]:[];for(var p=0,f=0,_=[];f<a.length;){l.lastIndex=FT?0:f;var v,m=LT(l,FT?KT(a,f):a);if(null===m||(v=jT(kT(l.lastIndex+(FT?f:0)),a.length))===p)f=PT(a,f,u);else{if(zT(_,KT(a,p,f)),_.length===h)return _;for(var y=1;y<=m.length-1;y++)if(zT(_,m[y]),_.length===h)return _;f=p=v}}return zT(_,KT(a,p)),_}]}),!WT,FT);var XT=Mi.PROPER,YT=a,qT=lm,JT=Sm.trim;Wr({target:"String",proto:!0,forced:function(e){return YT((function(){return!!qT[e]()||"
"!=="
"[e]()||XT&&qT[e].name!==e}))}("trim")},{trim:function(){return JT(this)}});var QT={exports:{}};!function(e){var i={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};i.localCName=i.generateIdentifier(),i.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},i.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},i.getDescription=function(e){var t=i.splitSections(e);return t&&t[0]},i.getMediaSections=function(e){var t=i.splitSections(e);return t.shift(),t},i.matchPrefix=function(e,t){return i.splitLines(e).filter((function(e){return 0===e.indexOf(t)}))},i.parseCandidate=function(e){for(var t,i={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},r=8;r<t.length;r+=2)switch(t[r]){case"raddr":i.relatedAddress=t[r+1];break;case"rport":i.relatedPort=parseInt(t[r+1],10);break;case"tcptype":i.tcpType=t[r+1];break;case"ufrag":i.ufrag=t[r+1],i.usernameFragment=t[r+1];break;default:void 0===i[t[r]]&&(i[t[r]]=t[r+1])}return i},i.writeCandidate=function(e){var t=[];t.push(e.foundation);var i=e.component;"rtp"===i?t.push(1):"rtcp"===i?t.push(2):t.push(i),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(" ")},i.parseIceOptions=function(e){return e.substr(14).split(" ")},i.parseRtpMap=function(e){var t=e.substr(9).split(" "),i={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),i.name=t[0],i.clockRate=parseInt(t[1],10),i.channels=3===t.length?parseInt(t[2],10):1,i.numChannels=i.channels,i},i.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var i=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==i?"/"+i:"")+"\r\n"},i.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]}},i.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},i.parseFmtp=function(e){for(var t,i={},r=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<r.length;n++)i[(t=r[n].trim().split("="))[0].trim()]=t[1];return i},i.writeFmtp=function(e){var t="",i=e.payloadType;if(void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var r=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?r.push(t+"="+e.parameters[t]):r.push(t)})),t+="a=fmtp:"+i+" "+r.join(";")+"\r\n"}return t},i.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},i.writeRtcpFb=function(e){var t="",i=e.payloadType;return void 0!==e.preferredPayloadType&&(i=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+i+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},i.parseSsrcMedia=function(e){var t=e.indexOf(" "),i={ssrc:parseInt(e.substr(7,t-7),10)},r=e.indexOf(":",t);return r>-1?(i.attribute=e.substr(t+1,r-t-1),i.value=e.substr(r+1)):i.attribute=e.substr(t+1),i},i.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},i.getMid=function(e){var t=i.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},i.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},i.getDtlsParameters=function(e,t){return{role:"auto",fingerprints:i.matchPrefix(e+t,"a=fingerprint:").map(i.parseFingerprint)}},i.writeDtlsParameters=function(e,t){var i="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){i+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),i},i.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)}},i.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===t(e.keyParams)?i.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},i.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}},i.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},i.getCryptoParameters=function(e,t){return i.matchPrefix(e+t,"a=crypto:").map(i.parseCryptoLine)},i.getIceParameters=function(e,t){var r=i.matchPrefix(e+t,"a=ice-ufrag:")[0],n=i.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},i.writeIceParameters=function(e){var t="a=ice-ufrag:"+e.usernameFragment+"\r\na=ice-pwd:"+e.password+"\r\n";return e.iceLite&&(t+="a=ice-lite\r\n"),t},i.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=i.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var o=r[n],a=i.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=i.parseRtpMap(a),c=i.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?i.parseFmtp(c[0]):{},s.rtcpFeedback=i.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(i.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return i.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(i.parseExtmap(e))})),t},i.writeRtpDescription=function(e,t){var r="";r+="m="+e+" ",r+=t.codecs.length>0?"9":"0",r+=" UDP/TLS/RTP/SAVPF ",r+=t.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",r+="c=IN IP4 0.0.0.0\r\n",r+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){r+=i.writeRtpMap(e),r+=i.writeFmtp(e),r+=i.writeRtcpFb(e)}));var n=0;return t.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(r+="a=maxptime:"+n+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){r+=i.writeExtmap(e)})),r},i.parseRtpEncodingParameters=function(e){var t,r=[],n=i.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=i.matchPrefix(e,"a=ssrc:").map((function(e){return i.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=i.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(t=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var i={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&t&&(i.rtx={ssrc:t}),r.push(i),o&&((i=JSON.parse(JSON.stringify(i))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},r.push(i))}})),0===r.length&&c&&r.push({ssrc:c});var d=i.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,r.forEach((function(e){e.maxBitrate=d}))),r},i.parseRtcpParameters=function(e){var t={},r=i.matchPrefix(e,"a=ssrc:").map((function(e){return i.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];r&&(t.cname=r.value,t.ssrc=r.ssrc);var n=i.matchPrefix(e,"a=rtcp-rsize");t.reducedSize=n.length>0,t.compound=0===n.length;var o=i.matchPrefix(e,"a=rtcp-mux");return t.mux=o.length>0,t},i.writeRtcpParameters=function(e){var t="";return e.reducedSize&&(t+="a=rtcp-rsize\r\n"),e.mux&&(t+="a=rtcp-mux\r\n"),void 0!==e.ssrc&&e.cname&&(t+="a=ssrc:"+e.ssrc+" cname:"+e.cname+"\r\n"),t},i.parseMsid=function(e){var t,r=i.matchPrefix(e,"a=msid:");if(1===r.length)return{stream:(t=r[0].substr(7).split(" "))[0],track:t[1]};var n=i.matchPrefix(e,"a=ssrc:").map((function(e){return i.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(t=n[0].value.split(" "))[0],track:t[1]}:void 0},i.parseSctpDescription=function(e){var t,r=i.parseMLine(e),n=i.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=parseInt(n[0].substr(19),10)),isNaN(t)&&(t=65536);var o=i.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var a=i.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:t}}},i.writeSctpDescription=function(e,t){var i=[];return i="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&&i.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),i.join("")},i.generateSessionId=function(){return Math.random().toString().substr(2,21)},i.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||i.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},i.getDirection=function(e,t){for(var r=i.splitLines(e),n=0;n<r.length;n++)switch(r[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return r[n].substr(2)}return t?i.getDirection(t):"sendrecv"},i.getKind=function(e){return i.splitLines(e)[0].split(" ")[0].substr(2)},i.isRejected=function(e){return"0"===e.split(" ",2)[1]},i.parseMLine=function(e){var t=i.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:parseInt(t[1],10),protocol:t[2],fmt:t.slice(3).join(" ")}},i.parseOLine=function(e){var t=i.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:parseInt(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},i.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=i.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},e.exports=i}(QT);var ZT=QT.exports,$T=Object.freeze(e({__proto__:null,default:ZT},[QT.exports]));function eI(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var i=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===t(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var r=new i(e),n=ZT.parseCandidate(e.candidate),o=Object.assign(r,n);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new i(e)},e.RTCIceCandidate.prototype=i.prototype,cS(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function tI(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var i=function(e){if(!e||!e.sdp)return!1;var t=ZT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=ZT.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},r=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var i=parseInt(t[1],10);return i!=i?-1:i},n=function(e){var i=65536;return"firefox"===t.browser&&(i=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),i},o=function(e,i){var r=65536;"firefox"===t.browser&&57===t.version&&(r=65535);var n=ZT.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?r=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==i&&(r=2147483637),r},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(i(arguments[0])){var c,u=r(arguments[0]),d=n(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function iI(e){if(e.RTCPeerConnection&&"createDataChannel"in e.RTCPeerConnection.prototype){var t=e.RTCPeerConnection.prototype.createDataChannel;e.RTCPeerConnection.prototype.createDataChannel=function(){var e=t.apply(this,arguments);return i(e,this),e},cS(e,"datachannel",(function(e){return i(e.channel,e.target),e}))}function i(e,t){var i=e.send;e.send=function(){var r=arguments[0],n=r.length||r.size||r.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 i.apply(e,arguments)}}}function rI(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(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((function(e){var i=t[e];t[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=function(e){var t=e.target;if(t._lastConnectionState!==t.connectionState){t._lastConnectionState=t.connectionState;var i=new Event("connectionstatechange",e);t.dispatchEvent(i)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}}))}}function nI(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var i=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var r=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:r}):t.sdp=r}return i.apply(this,arguments)}}}function oI(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var i=e.RTCPeerConnection.prototype.addIceCandidate;i&&0!==i.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?Promise.resolve():i.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function aI(e,i){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,i=arguments[0]||{};if("object"!==t(i)||i.type&&i.sdp)return r.apply(this,arguments);if(!(i={type:i.type,sdp:i.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":i.type="offer";break;default:i.type="answer"}if(i.sdp||"offer"!==i.type&&"answer"!==i.type)return r.apply(this,[i]);var n="offer"===i.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var sI=Object.freeze({__proto__:null,shimRTCIceCandidate:eI,shimMaxMessageSize:tI,shimSendThrowTypeError:iI,shimConnectionState:rI,removeExtmapAllowMixed:nI,shimAddIceCandidateNullOrEmpty:oI,shimParameterlessSetLocalDescription:aI});!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},r=lS,n=pS(t),o={browserDetails:n,commonShim:sI,extractVersion:sS,disableLog:uS,disableWarnings:dS,sdp:$T};switch(n.browser){case"chrome":if(!QE||!qE||!i.shimChrome)return r("Chrome shim is not included in this adapter release."),o;if(null===n.version)return r("Chrome shim can not determine version, not shimming."),o;r("adapter.js shimming chrome."),o.browserShim=QE,oI(t,n),aI(t),jE(t,n),GE(t),qE(t,n),HE(t),YE(t,n),zE(t),KE(t),WE(t),JE(t,n),eI(t),rI(t),tI(t,n),iI(t),nI(t,n);break;case"firefox":if(!Cb||!yb||!i.shimFirefox)return r("Firefox shim is not included in this adapter release."),o;r("adapter.js shimming firefox."),o.browserShim=Cb,oI(t,n),aI(t),vb(t,n),yb(t,n),mb(t),Eb(t),Sb(t),gb(t),bb(t),Tb(t),Ib(t),Rb(t),Ab(t),eI(t),rI(t),tI(t,n),iI(t);break;case"safari":if(!xb||!i.shimSafari)return r("Safari shim is not included in this adapter release."),o;r("adapter.js shimming safari."),o.browserShim=xb,oI(t,n),aI(t),Db(t),Ub(t),Nb(t),Ob(t),wb(t),Mb(t),Pb(t),Lb(t),eI(t),tI(t,n),iI(t),nI(t,n);break;default:r("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var cI=Wr,uI=n,dI=Zn,lI=B,hI=Po,pI=lu,fI=/MSIE .\./.test(Y),_I=uI.Function,vI=function(e){return function(t,i){var r=pI(arguments.length,1)>2,n=lI(t)?t:_I(t),o=r?hI(arguments,2):void 0;return e(r?function(){dI(n,this,o)}:n,i)}};cI({global:!0,bind:!0,forced:fI},{setTimeout:vI(uI.setTimeout),setInterval:vI(uI.setInterval)}),Wr({target:"Array",stat:!0},{isArray:eo});var mI=Ro,yI=Math.floor,SI=function(e,t){var i=e.length,r=yI(i/2);return i<8?gI(e,t):EI(e,SI(mI(e,0,r),t),SI(mI(e,r),t),t)},gI=function(e,t){for(var i,r,n=e.length,o=1;o<n;){for(r=o,i=e[o];r&&t(e[r-1],i)>0;)e[r]=e[--r];r!==o++&&(e[r]=i)}return e},EI=function(e,t,i,r){for(var n=t.length,o=i.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?r(t[a],i[s])<=0?t[a++]:i[s++]:a<n?t[a++]:i[s++];return e},bI=SI,TI=Y.match(/firefox\/(\d+)/i),II=!!TI&&+TI[1],RI=/MSIE|Trident/.test(Y),AI=Y.match(/AppleWebKit\/(\d+)\./),CI=!!AI&&+AI[1],OI=Wr,wI=I,NI=me,PI=Me,kI=rr,DI=fo,MI=a,UI=bI,LI=jn,xI=II,VI=RI,FI=te,BI=CI,jI=[],GI=wI(jI.sort),HI=wI(jI.push),zI=MI((function(){jI.sort(void 0)})),KI=MI((function(){jI.sort(null)})),WI=LI("sort"),XI=!MI((function(){if(FI)return FI<70;if(!(xI&&xI>3)){if(VI)return!0;if(BI)return BI<603;var e,t,i,r,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:i=3;break;case 68:case 71:i=4;break;default:i=2}for(r=0;r<47;r++)jI.push({k:t+r,v:i})}for(jI.sort((function(e,t){return t.v-e.v})),r=0;r<jI.length;r++)t=jI[r].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));OI({target:"Array",proto:!0,forced:zI||!KI||!WI||!XI},{sort:function(e){void 0!==e&&NI(e);var t=PI(this);if(XI)return void 0===e?GI(t):GI(t,e);var i,r,n=[],o=kI(t);for(r=0;r<o;r++)r in t&&HI(n,t[r]);for(UI(n,function(e){return function(t,i){return void 0===i?-1:void 0===t?1:void 0!==e?+e(t,i)||0:DI(t)>DI(i)?1:-1}}(e)),i=n.length,r=0;r<i;)t[r]=n[r++];for(;r<o;)delete t[r++];return t}});var YI="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,qI=Yi,JI=tr,QI=n.RangeError,ZI=function(e){if(void 0===e)return 0;var t=qI(e),i=JI(t);if(t!==i)throw QI("Wrong length or index");return i},$I=n.Array,eR=Math.abs,tR=Math.pow,iR=Math.floor,rR=Math.log,nR=Math.LN2,oR={pack:function(e,t,i){var r,n,o,a=$I(i),s=8*i-t-1,c=(1<<s)-1,u=c>>1,d=23===t?tR(2,-24)-tR(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=eR(e))!=e||e===1/0?(n=e!=e?1:0,r=c):(r=iR(rR(e)/nR),e*(o=tR(2,-r))<1&&(r--,o*=2),(e+=r+u>=1?d/o:d*tR(2,1-u))*o>=2&&(r++,o/=2),r+u>=c?(n=0,r=c):r+u>=1?(n=(e*o-1)*tR(2,t),r+=u):(n=e*tR(2,u-1)*tR(2,t),r=0));t>=8;)a[h++]=255&n,n/=256,t-=8;for(r=r<<t|n,s+=t;s>0;)a[h++]=255&r,r/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var i,r=e.length,n=8*r-t-1,o=(1<<n)-1,a=o>>1,s=n-7,c=r-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(i=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)i=256*i+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return i?NaN:u?-1/0:1/0;i+=tR(2,t),d-=a}return(u?-1:1)*i*tR(2,d-t)}},aR=Me,sR=Zi,cR=rr,uR=function(e){for(var t=aR(this),i=cR(t),r=arguments.length,n=sR(r>1?arguments[1]:void 0,i),o=r>2?arguments[2]:void 0,a=void 0===o?i:sR(o,i);a>n;)t[n++]=e;return t},dR=n,lR=I,hR=s,pR=YI,fR=Mi,_R=Xt,vR=rc,mR=a,yR=lc,SR=Yi,gR=tr,ER=ZI,bR=oR,TR=vh,IR=en,RR=Ki.f,AR=Ct.f,CR=uR,OR=Ro,wR=Go,NR=fR.PROPER,PR=fR.CONFIGURABLE,kR=Oi.get,DR=Oi.set,MR="ArrayBuffer",UR="DataView",LR="Wrong index",xR=dR.ArrayBuffer,VR=xR,FR=VR&&VR.prototype,BR=dR.DataView,jR=BR&&BR.prototype,GR=Object.prototype,HR=dR.Array,zR=dR.RangeError,KR=lR(CR),WR=lR([].reverse),XR=bR.pack,YR=bR.unpack,qR=function(e){return[255&e]},JR=function(e){return[255&e,e>>8&255]},QR=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},ZR=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},$R=function(e){return XR(e,23,4)},eA=function(e){return XR(e,52,8)},tA=function(e,t){AR(e.prototype,t,{get:function(){return kR(this)[t]}})},iA=function(e,t,i,r){var n=ER(i),o=kR(e);if(n+t>o.byteLength)throw zR(LR);var a=kR(o.buffer).bytes,s=n+o.byteOffset,c=OR(a,s,s+t);return r?c:WR(c)},rA=function(e,t,i,r,n,o){var a=ER(i),s=kR(e);if(a+t>s.byteLength)throw zR(LR);for(var c=kR(s.buffer).bytes,u=a+s.byteOffset,d=r(+n),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(pR){var nA=NR&&xR.name!==MR;if(mR((function(){xR(1)}))&&mR((function(){new xR(-1)}))&&!mR((function(){return new xR,new xR(1.5),new xR(NaN),nA&&!PR})))nA&&PR&&_R(xR,"name",MR);else{(VR=function(e){return yR(this,FR),new xR(ER(e))}).prototype=FR;for(var oA,aA=RR(xR),sA=0;aA.length>sA;)(oA=aA[sA++])in VR||_R(VR,oA,xR[oA]);FR.constructor=VR}IR&&TR(jR)!==GR&&IR(jR,GR);var cA=new BR(new VR(2)),uA=lR(jR.setInt8);cA.setInt8(0,2147483648),cA.setInt8(1,2147483649),!cA.getInt8(0)&&cA.getInt8(1)||vR(jR,{setInt8:function(e,t){uA(this,e,t<<24>>24)},setUint8:function(e,t){uA(this,e,t<<24>>24)}},{unsafe:!0})}else FR=(VR=function(e){yR(this,FR);var t=ER(e);DR(this,{bytes:KR(HR(t),0),byteLength:t}),hR||(this.byteLength=t)}).prototype,jR=(BR=function(e,t,i){yR(this,jR),yR(e,FR);var r=kR(e).byteLength,n=SR(t);if(n<0||n>r)throw zR("Wrong offset");if(n+(i=void 0===i?r-n:gR(i))>r)throw zR("Wrong length");DR(this,{buffer:e,byteLength:i,byteOffset:n}),hR||(this.buffer=e,this.byteLength=i,this.byteOffset=n)}).prototype,hR&&(tA(VR,"byteLength"),tA(BR,"buffer"),tA(BR,"byteLength"),tA(BR,"byteOffset")),vR(jR,{getInt8:function(e){return iA(this,1,e)[0]<<24>>24},getUint8:function(e){return iA(this,1,e)[0]},getInt16:function(e){var t=iA(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=iA(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return ZR(iA(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return ZR(iA(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return YR(iA(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return YR(iA(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){rA(this,1,e,qR,t)},setUint8:function(e,t){rA(this,1,e,qR,t)},setInt16:function(e,t){rA(this,2,e,JR,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){rA(this,2,e,JR,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){rA(this,4,e,QR,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){rA(this,4,e,QR,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){rA(this,4,e,$R,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){rA(this,8,e,eA,t,arguments.length>2?arguments[2]:void 0)}});wR(VR,MR),wR(BR,UR);var dA={ArrayBuffer:VR,DataView:BR},lA=Wr,hA=I,pA=a,fA=Dt,_A=Zi,vA=tr,mA=uu,yA=dA.ArrayBuffer,SA=dA.DataView,gA=SA.prototype,EA=hA(yA.prototype.slice),bA=hA(gA.getUint8),TA=hA(gA.setUint8);lA({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:pA((function(){return!new yA(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(EA&&void 0===t)return EA(fA(this),e);for(var i=fA(this).byteLength,r=_A(e,i),n=_A(void 0===t?i:t,i),o=new(mA(this,yA))(vA(n-r)),a=new SA(this),s=new SA(o),c=0;r<n;)TA(s,c++,bA(a,r++));return o}});var IA,RA,AA,CA={exports:{}},OA=YI,wA=s,NA=n,PA=B,kA=G,DA=xe,MA=lo,UA=pe,LA=Xt,xA=Yt.exports,VA=Ct.f,FA=X,BA=vh,jA=en,GA=$e,HA=Ge,zA=NA.Int8Array,KA=zA&&zA.prototype,WA=NA.Uint8ClampedArray,XA=WA&&WA.prototype,YA=zA&&BA(zA),qA=KA&&BA(KA),JA=Object.prototype,QA=NA.TypeError,ZA=GA("toStringTag"),$A=HA("TYPED_ARRAY_TAG"),eC=HA("TYPED_ARRAY_CONSTRUCTOR"),tC=OA&&!!jA&&"Opera"!==MA(NA.opera),iC=!1,rC={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},nC={BigInt64Array:8,BigUint64Array:8},oC=function(e){if(!kA(e))return!1;var t=MA(e);return DA(rC,t)||DA(nC,t)};for(IA in rC)(AA=(RA=NA[IA])&&RA.prototype)?LA(AA,eC,RA):tC=!1;for(IA in nC)(AA=(RA=NA[IA])&&RA.prototype)&&LA(AA,eC,RA);if((!tC||!PA(YA)||YA===Function.prototype)&&(YA=function(){throw QA("Incorrect invocation")},tC))for(IA in rC)NA[IA]&&jA(NA[IA],YA);if((!tC||!qA||qA===JA)&&(qA=YA.prototype,tC))for(IA in rC)NA[IA]&&jA(NA[IA].prototype,qA);if(tC&&BA(XA)!==qA&&jA(XA,qA),wA&&!DA(qA,ZA))for(IA in iC=!0,VA(qA,ZA,{get:function(){return kA(this)?this[$A]:void 0}}),rC)NA[IA]&&LA(NA[IA],$A,IA);var aC={NATIVE_ARRAY_BUFFER_VIEWS:tC,TYPED_ARRAY_CONSTRUCTOR:eC,TYPED_ARRAY_TAG:iC&&$A,aTypedArray:function(e){if(oC(e))return e;throw QA("Target is not a typed array")},aTypedArrayConstructor:function(e){if(PA(e)&&(!jA||FA(YA,e)))return e;throw QA(UA(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,i,r){if(wA){if(i)for(var n in rC){var o=NA[n];if(o&&DA(o.prototype,e))try{delete o.prototype[e]}catch(i){try{o.prototype[e]=t}catch(e){}}}qA[e]&&!i||xA(qA,e,i?t:tC&&KA[e]||t,r)}},exportTypedArrayStaticMethod:function(e,t,i){var r,n;if(wA){if(jA){if(i)for(r in rC)if((n=NA[r])&&DA(n,e))try{delete n[e]}catch(e){}if(YA[e]&&!i)return;try{return xA(YA,e,i?t:tC&&YA[e]||t)}catch(e){}}for(r in rC)!(n=NA[r])||n[e]&&!i||xA(n,e,t)}},isView:function(e){if(!kA(e))return!1;var t=MA(e);return"DataView"===t||DA(rC,t)||DA(nC,t)},isTypedArray:oC,TypedArray:YA,TypedArrayPrototype:qA},sC=n,cC=a,uC=tu,dC=aC.NATIVE_ARRAY_BUFFER_VIEWS,lC=sC.ArrayBuffer,hC=sC.Int8Array,pC=!dC||!cC((function(){hC(1)}))||!cC((function(){new hC(-1)}))||!uC((function(e){new hC,new hC(null),new hC(1.5),new hC(e)}),!0)||cC((function(){return 1!==new hC(new lC(2),1,void 0).length})),fC=G,_C=Math.floor,vC=Number.isInteger||function(e){return!fC(e)&&isFinite(e)&&_C(e)===e},mC=Yi,yC=n.RangeError,SC=function(e){var t=mC(e);if(t<0)throw yC("The argument can't be less than 0");return t},gC=n.RangeError,EC=function(e,t){var i=SC(e);if(i%t)throw gC("Wrong offset");return i},bC=Wo,TC=l,IC=ou,RC=Me,AC=rr,CC=Oc,OC=Ec,wC=vc,NC=aC.aTypedArrayConstructor,PC=Wr,kC=n,DC=l,MC=s,UC=pC,LC=aC,xC=dA,VC=lc,FC=y,BC=Xt,jC=vC,GC=tr,HC=ZI,zC=EC,KC=lt,WC=xe,XC=lo,YC=G,qC=le,JC=Rn,QC=X,ZC=en,$C=Ki.f,eO=function(e){var t,i,r,n,o,a,s=IC(this),c=RC(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=OC(c);if(h&&!wC(h))for(a=(o=CC(c,h)).next,c=[];!(n=TC(a,o)).done;)c.push(n.value);for(l&&u>2&&(d=bC(d,arguments[2])),i=AC(c),r=new(NC(s))(i),t=0;i>t;t++)r[t]=l?d(c[t],t):c[t];return r},tO=ba.forEach,iO=cc,rO=Ct,nO=o,oO=oy,aO=Oi.get,sO=Oi.set,cO=rO.f,uO=nO.f,dO=Math.round,lO=kC.RangeError,hO=xC.ArrayBuffer,pO=hO.prototype,fO=xC.DataView,_O=LC.NATIVE_ARRAY_BUFFER_VIEWS,vO=LC.TYPED_ARRAY_CONSTRUCTOR,mO=LC.TYPED_ARRAY_TAG,yO=LC.TypedArray,SO=LC.TypedArrayPrototype,gO=LC.aTypedArrayConstructor,EO=LC.isTypedArray,bO="BYTES_PER_ELEMENT",TO="Wrong length",IO=function(e,t){gO(e);for(var i=0,r=t.length,n=new e(r);r>i;)n[i]=t[i++];return n},RO=function(e,t){cO(e,t,{get:function(){return aO(this)[t]}})},AO=function(e){var t;return QC(pO,e)||"ArrayBuffer"==(t=XC(e))||"SharedArrayBuffer"==t},CO=function(e,t){return EO(e)&&!qC(t)&&t in e&&jC(+t)&&t>=0},OO=function(e,t){return t=KC(t),CO(e,t)?FC(2,e[t]):uO(e,t)},wO=function(e,t,i){return t=KC(t),!(CO(e,t)&&YC(i)&&WC(i,"value"))||WC(i,"get")||WC(i,"set")||i.configurable||WC(i,"writable")&&!i.writable||WC(i,"enumerable")&&!i.enumerable?cO(e,t,i):(e[t]=i.value,e)};MC?(_O||(nO.f=OO,rO.f=wO,RO(SO,"buffer"),RO(SO,"byteOffset"),RO(SO,"byteLength"),RO(SO,"length")),PC({target:"Object",stat:!0,forced:!_O},{getOwnPropertyDescriptor:OO,defineProperty:wO}),CA.exports=function(e,t,i){var r=e.match(/\d+$/)[0]/8,n=e+(i?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=kC[n],c=s,u=c&&c.prototype,d={},l=function(e,t){cO(e,t,{get:function(){return function(e,t){var i=aO(e);return i.view[o](t*r+i.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=aO(e);i&&(n=(n=dO(n))<0?0:n>255?255:255&n),o.view[a](t*r+o.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};_O?UC&&(c=t((function(e,t,i,n){return VC(e,u),oO(YC(t)?AO(t)?void 0!==n?new s(t,zC(i,r),n):void 0!==i?new s(t,zC(i,r)):new s(t):EO(t)?IO(c,t):DC(eO,c,t):new s(HC(t)),e,c)})),ZC&&ZC(c,yO),tO($C(s),(function(e){e in c||BC(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,i,n){VC(e,u);var o,a,s,d=0,h=0;if(YC(t)){if(!AO(t))return EO(t)?IO(c,t):DC(eO,c,t);o=t,h=zC(i,r);var p=t.byteLength;if(void 0===n){if(p%r)throw lO(TO);if((a=p-h)<0)throw lO(TO)}else if((a=GC(n)*r)+h>p)throw lO(TO);s=a/r}else s=HC(t),o=new hO(a=s*r);for(sO(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new fO(o)});d<s;)l(e,d++)})),ZC&&ZC(c,yO),u=c.prototype=JC(SO)),u.constructor!==c&&BC(u,"constructor",c),BC(u,vO,c),mO&&BC(u,mO,n),d[n]=c,PC({global:!0,forced:c!=s,sham:!_O},d),bO in c||BC(c,bO,r),bO in u||BC(u,bO,r),iO(n)}):CA.exports=function(){},(0,CA.exports)("Uint8",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var NO=Me,PO=Zi,kO=rr,DO=Math.min,MO=[].copyWithin||function(e,t){var i=NO(this),r=kO(i),n=PO(e,r),o=PO(t,r),a=arguments.length>2?arguments[2]:void 0,s=DO((void 0===a?r:PO(a,r))-o,r-n),c=1;for(o<n&&n<o+s&&(c=-1,o+=s-1,n+=s-1);s-- >0;)o in i?i[n]=i[o]:delete i[n],n+=c,o+=c;return i},UO=aC,LO=I(MO),xO=UO.aTypedArray;(0,UO.exportTypedArrayMethod)("copyWithin",(function(e,t){return LO(xO(this),e,t,arguments.length>2?arguments[2]:void 0)}));var VO=ba.every,FO=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("every",(function(e){return VO(FO(this),e,arguments.length>1?arguments[1]:void 0)}));var BO=l,jO=uR,GO=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return BO(jO,GO(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var HO=rr,zO=uu,KO=aC.TYPED_ARRAY_CONSTRUCTOR,WO=aC.aTypedArrayConstructor,XO=function(e){return WO(zO(e,e[KO]))},YO=function(e,t){for(var i=0,r=HO(t),n=new e(r);r>i;)n[i]=t[i++];return n},qO=XO,JO=ba.filter,QO=function(e,t){return YO(qO(e),t)},ZO=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("filter",(function(e){var t=JO(ZO(this),e,arguments.length>1?arguments[1]:void 0);return QO(this,t)}));var $O=ba.find,ew=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("find",(function(e){return $O(ew(this),e,arguments.length>1?arguments[1]:void 0)}));var tw=ba.findIndex,iw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("findIndex",(function(e){return tw(iw(this),e,arguments.length>1?arguments[1]:void 0)}));var rw=ba.forEach,nw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("forEach",(function(e){rw(nw(this),e,arguments.length>1?arguments[1]:void 0)}));var ow=cr.includes,aw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("includes",(function(e){return ow(aw(this),e,arguments.length>1?arguments[1]:void 0)}));var sw=cr.indexOf,cw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("indexOf",(function(e){return sw(cw(this),e,arguments.length>1?arguments[1]:void 0)}));var uw=n,dw=a,lw=I,hw=aC,pw=up,fw=$e("iterator"),_w=uw.Uint8Array,vw=lw(pw.values),mw=lw(pw.keys),yw=lw(pw.entries),Sw=hw.aTypedArray,gw=hw.exportTypedArrayMethod,Ew=_w&&_w.prototype,bw=!dw((function(){Ew[fw].call([1])})),Tw=!!Ew&&Ew.values&&Ew[fw]===Ew.values&&"values"===Ew.values.name,Iw=function(){return vw(Sw(this))};gw("entries",(function(){return yw(Sw(this))}),bw),gw("keys",(function(){return mw(Sw(this))}),bw),gw("values",Iw,bw||!Tw,{name:"values"}),gw(fw,Iw,bw||!Tw,{name:"values"});var Rw=aC.aTypedArray,Aw=aC.exportTypedArrayMethod,Cw=I([].join);Aw("join",(function(e){return Cw(Rw(this),e)}));var Ow=Zn,ww=F,Nw=Yi,Pw=rr,kw=jn,Dw=Math.min,Mw=[].lastIndexOf,Uw=!!Mw&&1/[1].lastIndexOf(1,-0)<0,Lw=kw("lastIndexOf"),xw=Uw||!Lw?function(e){if(Uw)return Ow(Mw,this,arguments)||0;var t=ww(this),i=Pw(t),r=i-1;for(arguments.length>1&&(r=Dw(r,Nw(arguments[1]))),r<0&&(r=i+r);r>=0;r--)if(r in t&&t[r]===e)return r||0;return-1}:Mw,Vw=Zn,Fw=xw,Bw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return Vw(Fw,Bw(this),t>1?[e,arguments[1]]:[e])}));var jw=ba.map,Gw=XO,Hw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("map",(function(e){return jw(Hw(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(Gw(e))(t)}))}));var zw=Gy.left,Kw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return zw(Kw(this),e,t,t>1?arguments[1]:void 0)}));var Ww=Gy.right,Xw=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return Ww(Xw(this),e,t,t>1?arguments[1]:void 0)}));var Yw=aC.aTypedArray,qw=aC.exportTypedArrayMethod,Jw=Math.floor;qw("reverse",(function(){for(var e,t=this,i=Yw(t).length,r=Jw(i/2),n=0;n<r;)e=t[n],t[n++]=t[--i],t[i]=e;return t}));var Qw=n,Zw=l,$w=aC,eN=rr,tN=EC,iN=Me,rN=a,nN=Qw.RangeError,oN=Qw.Int8Array,aN=oN&&oN.prototype,sN=aN&&aN.set,cN=$w.aTypedArray,uN=$w.exportTypedArrayMethod,dN=!rN((function(){var e=new Uint8ClampedArray(2);return Zw(sN,e,{length:1,0:3},1),3!==e[1]})),lN=dN&&$w.NATIVE_ARRAY_BUFFER_VIEWS&&rN((function(){var e=new oN(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));uN("set",(function(e){cN(this);var t=tN(arguments.length>1?arguments[1]:void 0,1),i=iN(e);if(dN)return Zw(sN,this,i,t);var r=this.length,n=eN(i),o=0;if(n+t>r)throw nN("Wrong length");for(;o<n;)this[t+o]=i[o++]}),!dN||lN);var hN=XO,pN=Po,fN=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("slice",(function(e,t){for(var i=pN(fN(this),e,t),r=hN(this),n=0,o=i.length,a=new r(o);o>n;)a[n]=i[n++];return a}),a((function(){new Int8Array(1).slice()})));var _N=ba.some,vN=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("some",(function(e){return _N(vN(this),e,arguments.length>1?arguments[1]:void 0)}));var mN=n,yN=I,SN=a,gN=me,EN=bI,bN=aC,TN=II,IN=RI,RN=te,AN=CI,CN=mN.Array,ON=bN.aTypedArray,wN=bN.exportTypedArrayMethod,NN=mN.Uint16Array,PN=NN&&yN(NN.prototype.sort),kN=!(!PN||SN((function(){PN(new NN(2),null)}))&&SN((function(){PN(new NN(2),{})}))),DN=!!PN&&!SN((function(){if(RN)return RN<74;if(TN)return TN<67;if(IN)return!0;if(AN)return AN<602;var e,t,i=new NN(516),r=CN(516);for(e=0;e<516;e++)t=e%4,i[e]=515-e,r[e]=e-2*t+3;for(PN(i,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(i[e]!==r[e])return!0}));wN("sort",(function(e){return void 0!==e&&gN(e),DN?PN(this,e):EN(ON(this),function(e){return function(t,i){return void 0!==e?+e(t,i)||0:i!=i?-1:t!=t?1:0===t&&0===i?1/t>0&&1/i<0?1:-1:t>i}}(e))}),!DN||kN);var MN=tr,UN=Zi,LN=XO,xN=aC.aTypedArray;(0,aC.exportTypedArrayMethod)("subarray",(function(e,t){var i=xN(this),r=i.length,n=UN(e,r);return new(LN(i))(i.buffer,i.byteOffset+n*i.BYTES_PER_ELEMENT,MN((void 0===t?r:UN(t,r))-n))}));var VN=Zn,FN=aC,BN=a,jN=Po,GN=n.Int8Array,HN=FN.aTypedArray,zN=FN.exportTypedArrayMethod,KN=[].toLocaleString,WN=!!GN&&BN((function(){KN.call(new GN(1))}));zN("toLocaleString",(function(){return VN(KN,WN?jN(HN(this)):HN(this),jN(arguments))}),BN((function(){return[1,2].toLocaleString()!=new GN([1,2]).toLocaleString()}))||!BN((function(){GN.prototype.toLocaleString.call([1,2])})));var XN=aC.exportTypedArrayMethod,YN=a,qN=I,JN=n.Uint8Array,QN=JN&&JN.prototype||{},ZN=[].toString,$N=qN([].join);YN((function(){ZN.call({})}))&&(ZN=function(){return $N(this)});var eP=QN.toString!=ZN;XN("toString",ZN,eP);var tP=Wr,iP=ba.findIndex,rP=ah,nP="findIndex",oP=!0;nP in[]&&Array(1).findIndex((function(){oP=!1})),tP({target:"Array",proto:!0,forced:oP},{findIndex:function(e){return iP(this,e,arguments.length>1?arguments[1]:void 0)}}),rP(nP);var aP,sP,cP=cc,uP="ArrayBuffer",dP=dA.ArrayBuffer;Wr({global:!0,forced:n.ArrayBuffer!==dP},{ArrayBuffer:dP}),cP(uP),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVOKED_BEFORE_JOIN_ROOM="INVOKED_BEFORE_JOIN_ROOM",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN",e.RECONNECT_FAILED="RECONNECT_FAILED"}(aP||(aP={})),function(e){e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK"}(sP||(sP={}));var lP=function(e,t,i){this.code=e,this.message=t,this.error=i},hP=s,pP=I,fP=on,_P=F,vP=pP(h.f),mP=pP([].push),yP=function(e){return function(t){for(var i,r=_P(t),n=fP(r),o=n.length,a=0,s=[];o>a;)i=n[a++],hP&&!vP(r,i)||mP(s,e?[i,r[i]]:r[i]);return s}},SP={entries:yP(!0),values:yP(!1)}.entries;Wr({target:"Object",stat:!0},{entries:function(e){return SP(e)}});var gP=Yi,EP=fo,bP=L,TP=n.RangeError,IP=function(e){var t=EP(bP(this)),i="",r=gP(e);if(r<0||r==1/0)throw TP("Wrong number of repetitions");for(;r>0;(r>>>=1)&&(t+=t))1&r&&(i+=t);return i},RP=I,AP=tr,CP=fo,OP=L,wP=RP(IP),NP=RP("".slice),PP=Math.ceil,kP=function(e){return function(t,i,r){var n,o,a=CP(OP(t)),s=AP(i),c=a.length,u=void 0===r?" ":CP(r);return s<=c||""==u?a:((o=wP(u,PP((n=s-c)/u.length))).length>n&&(o=NP(o,0,n)),e?a+o:o+a)}},DP={start:kP(!1),end:kP(!0)},MP=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(Y),UP=DP.end;Wr({target:"String",proto:!0,forced:MP},{padEnd:function(e){return UP(this,e,arguments.length>1?arguments[1]:void 0)}});var LP=Pm;Wr({target:"Number",stat:!0,forced:Number.parseInt!=LP},{parseInt:LP});Wr({target:"ArrayBuffer",stat:!0,forced:!aC.NATIVE_ARRAY_BUFFER_VIEWS},{isView:aC.isView}),Wr({global:!0,forced:!YI},{DataView:dA.DataView});var xP=Dt,VP=kc,FP=Wo,BP=l,jP=Me,GP=function(e,t,i,r){try{return r?t(xP(i)[0],i[1]):t(i)}catch(t){VP(e,"throw",t)}},HP=vc,zP=aa,KP=rr,WP=So,XP=Oc,YP=Ec,qP=n.Array,JP=function(e){var t=jP(e),i=zP(this),r=arguments.length,n=r>1?arguments[1]:void 0,o=void 0!==n;o&&(n=FP(n,r>2?arguments[2]:void 0));var a,s,c,u,d,l,h=YP(t),p=0;if(!h||this==qP&&HP(h))for(a=KP(t),s=i?new this(a):qP(a);a>p;p++)l=o?n(t[p],p):t[p],WP(s,p,l);else for(d=(u=XP(t,h)).next,s=i?new this:[];!(c=BP(d,u)).done;p++)l=o?GP(u,n,[c.value,p],!0):c.value,WP(s,p,l);return s.length=p,s},QP=JP;Wr({target:"Array",stat:!0,forced:!tu((function(e){Array.from(e)}))},{from:QP});var ZP=Wr,$P=eo,ek=I([].reverse),tk=[1,2];ZP({target:"Array",proto:!0,forced:String(tk)===String(tk.reverse())},{reverse:function(){return $P(this)&&(this.length=this.length),ek(this)}});var ik=Wr,rk=n,nk=I,ok=Yi,ak=jb,sk=IP,ck=a,uk=rk.RangeError,dk=rk.String,lk=Math.floor,hk=nk(sk),pk=nk("".slice),fk=nk(1..toFixed),_k=function(e,t,i){return 0===t?i:t%2==1?_k(e,t-1,i*e):_k(e*e,t/2,i)},vk=function(e,t,i){for(var r=-1,n=i;++r<6;)n+=t*e[r],e[r]=n%1e7,n=lk(n/1e7)},mk=function(e,t){for(var i=6,r=0;--i>=0;)r+=e[i],e[i]=lk(r/t),r=r%t*1e7},yk=function(e){for(var t=6,i="";--t>=0;)if(""!==i||0===t||0!==e[t]){var r=dk(e[t]);i=""===i?r:i+hk("0",7-r.length)+r}return i};ik({target:"Number",proto:!0,forced:ck((function(){return"0.000"!==fk(8e-5,3)||"1"!==fk(.9,0)||"1.25"!==fk(1.255,2)||"1000000000000000128"!==fk(0xde0b6b3a7640080,0)}))||!ck((function(){fk({})}))},{toFixed:function(e){var t,i,r,n,o=ak(this),a=ok(e),s=[0,0,0,0,0,0],c="",u="0";if(a<0||a>20)throw uk("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return dk(o);if(o<0&&(c="-",o=-o),o>1e-21)if(i=(t=function(e){for(var t=0,i=e;i>=4096;)t+=12,i/=4096;for(;i>=2;)t+=1,i/=2;return t}(o*_k(2,69,1))-69)<0?o*_k(2,-t,1):o/_k(2,t,1),i*=4503599627370496,(t=52-t)>0){for(vk(s,0,i),r=a;r>=7;)vk(s,1e7,0),r-=7;for(vk(s,_k(10,r,1),0),r=t-1;r>=23;)mk(s,1<<23),r-=23;mk(s,1<<r),vk(s,1,1),mk(s,2),u=yk(s)}else vk(s,0,i),vk(s,1<<-t,0),u=yk(s)+hk("0",a);return u=a>0?c+((n=u.length)<=a?"0."+hk("0",a-n)+u:pk(u,0,n-a)+"."+pk(u,n-a)):c+u}});var Sk=Math.log,gk=Math.LOG10E;Wr({target:"Math",stat:!0},{log10:Math.log10||function(e){return Sk(e)*gk}});var Ek,bk=Wr,Tk=I,Ik=o.f,Rk=tr,Ak=fo,Ck=j_,Ok=L,wk=H_,Nk=Tk("".startsWith),Pk=Tk("".slice),kk=Math.min,Dk=wk("startsWith"),Mk=!Dk&&!!function(){var e=Ik(String.prototype,"startsWith");return e&&!e.writable}();bk({target:"String",proto:!0,forced:!Mk&&!Dk},{startsWith:function(e){var t=Ak(Ok(this));Ck(e);var i=Rk(kk(arguments.length>1?arguments[1]:void 0,t.length)),r=Ak(e);return Nk?Nk(t,r,i):Pk(t,i,i+r.length)===r}});var Uk=new Uint8Array(16);function Lk(){if(!Ek&&!(Ek="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ek(Uk)}var xk=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Vk(e){return"string"==typeof e&&xk.test(e)}for(var Fk=[],Bk=0;Bk<256;++Bk)Fk.push((Bk+256).toString(16).substr(1));function jk(e,t,i){var r=(e=e||{}).random||(e.rng||Lk)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){i=i||0;for(var n=0;n<16;++n)t[i+n]=r[n];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=(Fk[e[t+0]]+Fk[e[t+1]]+Fk[e[t+2]]+Fk[e[t+3]]+"-"+Fk[e[t+4]]+Fk[e[t+5]]+"-"+Fk[e[t+6]]+Fk[e[t+7]]+"-"+Fk[e[t+8]]+Fk[e[t+9]]+"-"+Fk[e[t+10]]+Fk[e[t+11]]+Fk[e[t+12]]+Fk[e[t+13]]+Fk[e[t+14]]+Fk[e[t+15]]).toLowerCase();if(!Vk(i))throw TypeError("Stringified UUID is invalid");return i}(r)}(0,CA.exports)("Uint32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,CA.exports)("Int8",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,CA.exports)("Uint8",(function(e){return function(t,i,r){return e(this,t,i,r)}}),!0),(0,CA.exports)("Int16",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,CA.exports)("Uint16",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,CA.exports)("Int32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,CA.exports)("Float32",(function(e){return function(t,i,r){return e(this,t,i,r)}})),(0,CA.exports)("Float64",(function(e){return function(t,i,r){return e(this,t,i,r)}}));var Gk={exports:{}};Wr({global:!0},{globalThis:n});var Hk={exports:{}};!function(e,t){var r;e.exports=(r=r||function(e,t){var r;if("undefined"!=typeof window&&window.crypto&&(r=window.crypto),"undefined"!=typeof self&&self.crypto&&(r=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(r=globalThis.crypto),!r&&"undefined"!=typeof window&&window.msCrypto&&(r=window.msCrypto),!r&&void 0!==i&&i.crypto&&(r=i.crypto),!r)try{r=require("crypto")}catch(e){}var n=function(){if(r){if("function"==typeof r.getRandomValues)try{return r.getRandomValues(new Uint32Array(1))[0]}catch(e){}if("function"==typeof r.randomBytes)try{return r.randomBytes(4).readInt32LE()}catch(e){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||function(){function e(){}return function(t){var i;return e.prototype=t,i=new e,e.prototype=null,i}}(),a={},s=a.lib={},c=s.Base={extend:function(e){var t=o(this);return e&&t.mixIn(e),t.hasOwnProperty("init")&&this.init!==t.init||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},u=s.WordArray=c.extend({init:function(e,i){e=this.words=e||[],this.sigBytes=i!=t?i:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,i=e.words,r=this.sigBytes,n=e.sigBytes;if(this.clamp(),r%4)for(var o=0;o<n;o++){var a=i[o>>>2]>>>24-o%4*8&255;t[r+o>>>2]|=a<<24-(r+o)%4*8}else for(var s=0;s<n;s+=4)t[r+s>>>2]=i[s>>>2];return this.sigBytes+=n,this},clamp:function(){var t=this.words,i=this.sigBytes;t[i>>>2]&=4294967295<<32-i%4*8,t.length=e.ceil(i/4)},clone:function(){var e=c.clone.call(this);return e.words=this.words.slice(0),e},random:function(e){for(var t=[],i=0;i<e;i+=4)t.push(n());return new u.init(t,e)}}),d=a.enc={},l=d.Hex={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],n=0;n<i;n++){var o=t[n>>>2]>>>24-n%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r+=2)i[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new u.init(i,t/2)}},h=d.Latin1={stringify:function(e){for(var t=e.words,i=e.sigBytes,r=[],n=0;n<i;n++){var o=t[n>>>2]>>>24-n%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(e){for(var t=e.length,i=[],r=0;r<t;r++)i[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new u.init(i,t)}},p=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(e){return h.parse(unescape(encodeURIComponent(e)))}},f=s.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new u.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=p.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var i,r=this._data,n=r.words,o=r.sigBytes,a=this.blockSize,s=o/(4*a),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*a,d=e.min(4*c,o);if(c){for(var l=0;l<c;l+=a)this._doProcessBlock(n,l);i=n.splice(0,c),r.sigBytes-=d}return new u.init(i,d)},clone:function(){var e=c.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});s.Hasher=f.extend({cfg:c.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,i){return new e.init(i).finalize(t)}},_createHmacHelper:function(e){return function(t,i){return new _.HMAC.init(e,i).finalize(t)}}});var _=a.algo={};return a}(Math),r)}(Hk),function(e,t){var i;e.exports=(i=Hk.exports,function(){if("function"==typeof ArrayBuffer){var e=i.lib.WordArray,t=e.init,r=e.init=function(e){if(e instanceof ArrayBuffer&&(e=new Uint8Array(e)),(e instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array||e instanceof Float64Array)&&(e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),e instanceof Uint8Array){for(var i=e.byteLength,r=[],n=0;n<i;n++)r[n>>>2]|=e[n]<<24-n%4*8;t.call(this,r,i)}else t.apply(this,arguments)};r.prototype=e}}(),i.lib.WordArray)}(Gk);var zk=Gk.exports,Kk={exports:{}},Wk={exports:{}};!function(e,t){var i;e.exports=(i=Hk.exports,function(){var e=i,t=e.lib.WordArray;function r(e,i,r){for(var n=[],o=0,a=0;a<i;a++)if(a%4){var s=r[e.charCodeAt(a-1)]<<a%4*2|r[e.charCodeAt(a)]>>>6-a%4*2;n[o>>>2]|=s<<24-o%4*8,o++}return t.create(n,o)}e.enc.Base64={stringify:function(e){var t=e.words,i=e.sigBytes,r=this._map;e.clamp();for(var n=[],o=0;o<i;o+=3)for(var a=(t[o>>>2]>>>24-o%4*8&255)<<16|(t[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|t[o+2>>>2]>>>24-(o+2)%4*8&255,s=0;s<4&&o+.75*s<i;s++)n.push(r.charAt(a>>>6*(3-s)&63));var c=r.charAt(64);if(c)for(;n.length%4;)n.push(c);return n.join("")},parse:function(e){var t=e.length,i=this._map,n=this._reverseMap;if(!n){n=this._reverseMap=[];for(var o=0;o<i.length;o++)n[i.charCodeAt(o)]=o}var a=i.charAt(64);if(a){var s=e.indexOf(a);-1!==s&&(t=s)}return r(e,t,n)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),i.enc.Base64)}(Wk);var Xk={exports:{}};!function(e,t){var i;e.exports=(i=Hk.exports,function(e){var t=i,r=t.lib,n=r.WordArray,o=r.Hasher,a=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=a.MD5=o.extend({_doReset:function(){this._hash=new n.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var i=0;i<16;i++){var r=t+i,n=e[r];e[r]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var o=this._hash.words,a=e[t+0],c=e[t+1],p=e[t+2],f=e[t+3],_=e[t+4],v=e[t+5],m=e[t+6],y=e[t+7],S=e[t+8],g=e[t+9],E=e[t+10],b=e[t+11],T=e[t+12],I=e[t+13],R=e[t+14],A=e[t+15],C=o[0],O=o[1],w=o[2],N=o[3];C=u(C,O,w,N,a,7,s[0]),N=u(N,C,O,w,c,12,s[1]),w=u(w,N,C,O,p,17,s[2]),O=u(O,w,N,C,f,22,s[3]),C=u(C,O,w,N,_,7,s[4]),N=u(N,C,O,w,v,12,s[5]),w=u(w,N,C,O,m,17,s[6]),O=u(O,w,N,C,y,22,s[7]),C=u(C,O,w,N,S,7,s[8]),N=u(N,C,O,w,g,12,s[9]),w=u(w,N,C,O,E,17,s[10]),O=u(O,w,N,C,b,22,s[11]),C=u(C,O,w,N,T,7,s[12]),N=u(N,C,O,w,I,12,s[13]),w=u(w,N,C,O,R,17,s[14]),C=d(C,O=u(O,w,N,C,A,22,s[15]),w,N,c,5,s[16]),N=d(N,C,O,w,m,9,s[17]),w=d(w,N,C,O,b,14,s[18]),O=d(O,w,N,C,a,20,s[19]),C=d(C,O,w,N,v,5,s[20]),N=d(N,C,O,w,E,9,s[21]),w=d(w,N,C,O,A,14,s[22]),O=d(O,w,N,C,_,20,s[23]),C=d(C,O,w,N,g,5,s[24]),N=d(N,C,O,w,R,9,s[25]),w=d(w,N,C,O,f,14,s[26]),O=d(O,w,N,C,S,20,s[27]),C=d(C,O,w,N,I,5,s[28]),N=d(N,C,O,w,p,9,s[29]),w=d(w,N,C,O,y,14,s[30]),C=l(C,O=d(O,w,N,C,T,20,s[31]),w,N,v,4,s[32]),N=l(N,C,O,w,S,11,s[33]),w=l(w,N,C,O,b,16,s[34]),O=l(O,w,N,C,R,23,s[35]),C=l(C,O,w,N,c,4,s[36]),N=l(N,C,O,w,_,11,s[37]),w=l(w,N,C,O,y,16,s[38]),O=l(O,w,N,C,E,23,s[39]),C=l(C,O,w,N,I,4,s[40]),N=l(N,C,O,w,a,11,s[41]),w=l(w,N,C,O,f,16,s[42]),O=l(O,w,N,C,m,23,s[43]),C=l(C,O,w,N,g,4,s[44]),N=l(N,C,O,w,T,11,s[45]),w=l(w,N,C,O,A,16,s[46]),C=h(C,O=l(O,w,N,C,p,23,s[47]),w,N,a,6,s[48]),N=h(N,C,O,w,y,10,s[49]),w=h(w,N,C,O,R,15,s[50]),O=h(O,w,N,C,v,21,s[51]),C=h(C,O,w,N,T,6,s[52]),N=h(N,C,O,w,f,10,s[53]),w=h(w,N,C,O,E,15,s[54]),O=h(O,w,N,C,c,21,s[55]),C=h(C,O,w,N,S,6,s[56]),N=h(N,C,O,w,A,10,s[57]),w=h(w,N,C,O,m,15,s[58]),O=h(O,w,N,C,I,21,s[59]),C=h(C,O,w,N,_,6,s[60]),N=h(N,C,O,w,b,10,s[61]),w=h(w,N,C,O,p,15,s[62]),O=h(O,w,N,C,g,21,s[63]),o[0]=o[0]+C|0,o[1]=o[1]+O|0,o[2]=o[2]+w|0,o[3]=o[3]+N|0},_doFinalize:function(){var t=this._data,i=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;i[n>>>5]|=128<<24-n%32;var o=e.floor(r/4294967296),a=r;i[15+(n+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),i[14+(n+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(i.length+1),this._process();for(var s=this._hash,c=s.words,u=0;u<4;u++){var d=c[u];c[u]=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8)}return s},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,i,r,n,o,a){var s=e+(t&i|~t&r)+n+a;return(s<<o|s>>>32-o)+t}function d(e,t,i,r,n,o,a){var s=e+(t&r|i&~r)+n+a;return(s<<o|s>>>32-o)+t}function l(e,t,i,r,n,o,a){var s=e+(t^i^r)+n+a;return(s<<o|s>>>32-o)+t}function h(e,t,i,r,n,o,a){var s=e+(i^(t|~r))+n+a;return(s<<o|s>>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),i.MD5)}(Xk);var Yk={exports:{}},qk={exports:{}};!function(e,t){var i;e.exports=(i=Hk.exports,function(){var e=i,t=e.lib,r=t.WordArray,n=t.Hasher,o=e.algo,a=[],s=o.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var i=this._hash.words,r=i[0],n=i[1],o=i[2],s=i[3],c=i[4],u=0;u<80;u++){if(u<16)a[u]=0|e[t+u];else{var d=a[u-3]^a[u-8]^a[u-14]^a[u-16];a[u]=d<<1|d>>>31}var l=(r<<5|r>>>27)+c+a[u];l+=u<20?1518500249+(n&o|~n&s):u<40?1859775393+(n^o^s):u<60?(n&o|n&s|o&s)-1894007588:(n^o^s)-899497514,c=s,s=o,o=n<<30|n>>>2,n=r,r=l}i[0]=i[0]+r|0,i[1]=i[1]+n|0,i[2]=i[2]+o|0,i[3]=i[3]+s|0,i[4]=i[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return t[r>>>5]|=128<<24-r%32,t[14+(r+64>>>9<<4)]=Math.floor(i/4294967296),t[15+(r+64>>>9<<4)]=i,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=n.clone.call(this);return e._hash=this._hash.clone(),e}});e.SHA1=n._createHelper(s),e.HmacSHA1=n._createHmacHelper(s)}(),i.SHA1)}(qk);var Jk={exports:{}};!function(e,t){var i,r,n;e.exports=(r=(i=Hk.exports).lib.Base,n=i.enc.Utf8,void(i.algo.HMAC=r.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=n.parse(t));var i=e.blockSize,r=4*i;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),s=o.words,c=a.words,u=0;u<i;u++)s[u]^=1549556828,c[u]^=909522486;o.sigBytes=a.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher,i=t.finalize(e);return t.reset(),t.finalize(this._oKey.clone().concat(i))}})))}(Jk),function(e,t){var i;e.exports=(i=Hk.exports,function(){var e=i,t=e.lib,r=t.Base,n=t.WordArray,o=e.algo,a=o.MD5,s=o.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:a,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var i,r=this.cfg,o=r.hasher.create(),a=n.create(),s=a.words,c=r.keySize,u=r.iterations;s.length<c;){i&&o.update(i),i=o.update(e).finalize(t),o.reset();for(var d=1;d<u;d++)i=o.finalize(i),o.reset();a.concat(i)}return a.sigBytes=4*c,a}});e.EvpKDF=function(e,t,i){return s.create(i).compute(e,t)}}(),i.EvpKDF)}(Yk);var Qk={exports:{}};!function(e,t){var i;e.exports=void((i=Hk.exports).lib.Cipher||function(e){var t=i,r=t.lib,n=r.Base,o=r.WordArray,a=r.BufferedBlockAlgorithm,s=t.enc;s.Utf8;var c=s.Base64,u=t.algo.EvpKDF,d=r.Cipher=a.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,i){this.cfg=this.cfg.extend(i),this._xformMode=e,this._key=t,this.reset()},reset:function(){a.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function e(e){return"string"==typeof e?S:m}return function(t){return{encrypt:function(i,r,n){return e(r).encrypt(t,i,r,n)},decrypt:function(i,r,n){return e(r).decrypt(t,i,r,n)}}}}()});r.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=t.mode={},h=r.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}}),p=l.CBC=function(){var t=h.extend();function i(t,i,r){var n,o=this._iv;o?(n=o,this._iv=e):n=this._prevBlock;for(var a=0;a<r;a++)t[i+a]^=n[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize;i.call(this,e,t,n),r.encryptBlock(e,t),this._prevBlock=e.slice(t,t+n)}}),t.Decryptor=t.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,o=e.slice(t,t+n);r.decryptBlock(e,t),i.call(this,e,t,n),this._prevBlock=o}}),t}(),f=(t.pad={}).Pkcs7={pad:function(e,t){for(var i=4*t,r=i-e.sigBytes%i,n=r<<24|r<<16|r<<8|r,a=[],s=0;s<r;s+=4)a.push(n);var c=o.create(a,r);e.concat(c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};r.BlockCipher=d.extend({cfg:d.cfg.extend({mode:p,padding:f}),reset:function(){var e;d.reset.call(this);var t=this.cfg,i=t.iv,r=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=r.createEncryptor:(e=r.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,i&&i.words):(this._mode=e.call(r,this,i&&i.words),this._mode.__creator=e)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e,t=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(t.pad(this._data,this.blockSize),e=this._process(!0)):(e=this._process(!0),t.unpad(e)),e},blockSize:4});var _=r.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),v=(t.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext,i=e.salt;return(i?o.create([1398893684,1701076831]).concat(i).concat(t):t).toString(c)},parse:function(e){var t,i=c.parse(e),r=i.words;return 1398893684==r[0]&&1701076831==r[1]&&(t=o.create(r.slice(2,4)),r.splice(0,4),i.sigBytes-=16),_.create({ciphertext:i,salt:t})}},m=r.SerializableCipher=n.extend({cfg:n.extend({format:v}),encrypt:function(e,t,i,r){r=this.cfg.extend(r);var n=e.createEncryptor(i,r),o=n.finalize(t),a=n.cfg;return _.create({ciphertext:o,key:i,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,i,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(i,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,i,r,n){if(r||(r=o.random(8)),n)a=u.create({keySize:t+i,hasher:n}).compute(e,r);else var a=u.create({keySize:t+i}).compute(e,r);var s=o.create(a.words.slice(t),4*i);return a.sigBytes=4*t,_.create({key:a,iv:s,salt:r})}},S=r.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:y}),encrypt:function(e,t,i,r){var n=(r=this.cfg.extend(r)).kdf.execute(i,e.keySize,e.ivSize,r.salt,r.hasher);r.iv=n.iv;var o=m.encrypt.call(this,e,t,n.key,r);return o.mixIn(n),o},decrypt:function(e,t,i,r){r=this.cfg.extend(r),t=this._parse(t,r.format);var n=r.kdf.execute(i,e.keySize,e.ivSize,t.salt,r.hasher);return r.iv=n.iv,m.decrypt.call(this,e,t,n.key,r)}})}())}(Qk),function(e,t){var i;e.exports=(i=Hk.exports,function(){var e=i,t=e.lib.BlockCipher,r=e.algo,n=[],o=[],a=[],s=[],c=[],u=[],d=[],l=[],h=[],p=[];!function(){for(var e=[],t=0;t<256;t++)e[t]=t<128?t<<1:t<<1^283;var i=0,r=0;for(t=0;t<256;t++){var f=r^r<<1^r<<2^r<<3^r<<4;f=f>>>8^255&f^99,n[i]=f,o[f]=i;var _=e[i],v=e[_],m=e[v],y=257*e[f]^16843008*f;a[i]=y<<24|y>>>8,s[i]=y<<16|y>>>16,c[i]=y<<8|y>>>24,u[i]=y,y=16843009*m^65537*v^257*_^16843008*i,d[f]=y<<24|y>>>8,l[f]=y<<16|y>>>16,h[f]=y<<8|y>>>24,p[f]=y,i?(i=_^e[e[e[m^_]]],r^=e[e[r]]):i=r=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],_=r.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,i=e.sigBytes/4,r=4*((this._nRounds=i+6)+1),o=this._keySchedule=[],a=0;a<r;a++)a<i?o[a]=t[a]:(u=o[a-1],a%i?i>6&&a%i==4&&(u=n[u>>>24]<<24|n[u>>>16&255]<<16|n[u>>>8&255]<<8|n[255&u]):(u=n[(u=u<<8|u>>>24)>>>24]<<24|n[u>>>16&255]<<16|n[u>>>8&255]<<8|n[255&u],u^=f[a/i|0]<<24),o[a]=o[a-i]^u);for(var s=this._invKeySchedule=[],c=0;c<r;c++){if(a=r-c,c%4)var u=o[a];else u=o[a-4];s[c]=c<4||a<=4?u:d[n[u>>>24]]^l[n[u>>>16&255]]^h[n[u>>>8&255]]^p[n[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,n)},decryptBlock:function(e,t){var i=e[t+1];e[t+1]=e[t+3],e[t+3]=i,this._doCryptBlock(e,t,this._invKeySchedule,d,l,h,p,o),i=e[t+1],e[t+1]=e[t+3],e[t+3]=i},_doCryptBlock:function(e,t,i,r,n,o,a,s){for(var c=this._nRounds,u=e[t]^i[0],d=e[t+1]^i[1],l=e[t+2]^i[2],h=e[t+3]^i[3],p=4,f=1;f<c;f++){var _=r[u>>>24]^n[d>>>16&255]^o[l>>>8&255]^a[255&h]^i[p++],v=r[d>>>24]^n[l>>>16&255]^o[h>>>8&255]^a[255&u]^i[p++],m=r[l>>>24]^n[h>>>16&255]^o[u>>>8&255]^a[255&d]^i[p++],y=r[h>>>24]^n[u>>>16&255]^o[d>>>8&255]^a[255&l]^i[p++];u=_,d=v,l=m,h=y}_=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^i[p++],v=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&u])^i[p++],m=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^i[p++],y=(s[h>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^i[p++],e[t]=_,e[t+1]=v,e[t+2]=m,e[t+3]=y},keySize:8});e.AES=t._createHelper(_)}(),i.AES)}(Kk);var Zk={exports:{}};!function(e,t){e.exports=Hk.exports.enc.Hex}(Zk);var $k=Zk.exports,eD={exports:{}};!function(e,t){var i,r,n;e.exports=((n=Hk.exports).mode.CTR=(i=n.lib.BlockCipherMode.extend(),r=i.Encryptor=i.extend({processBlock:function(e,t){var i=this._cipher,r=i.blockSize,n=this._iv,o=this._counter;n&&(o=this._counter=n.slice(0),this._iv=void 0);var a=o.slice(0);i.encryptBlock(a,0),o[r-1]=o[r-1]+1|0;for(var s=0;s<r;s++)e[t+s]^=a[s]}}),i.Decryptor=r,i),n.mode.CTR)}(eD);var tD=eD.exports,iD={exports:{}};!function(e,t){var i;e.exports=((i=Hk.exports).pad.NoPadding={pad:function(){},unpad:function(){}},i.pad.NoPadding)}(iD);var rD=iD.exports,nD=new TextDecoder,oD=new TextEncoder,aD=function(){return jk()},sD=function(){return Date.now()};function cD(e){for(var t,i,r,n,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=r_(o),u=c.next();!u.done;u=c.next()){s+=(f=u.value).length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(t)throw t.error}}var d=new e(s),l=0;try{for(var h=r_(o),p=h.next();!p.done;p=h.next()){var f=p.value;d.set(f,l),l+=f.length}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}return d}var uD=function(){return"undefined"==typeof window},dD=function(){function e(){}return e.token2auth=function(t,i,r,n){return n?"Bearer ".concat(n):"Basic ".concat(e.createUnsafeToken(t,i,r))},e.createUnsafeToken=function(e,t,i){return window.btoa([e,t,i].filter((function(e){return null!==e})).join(":"))},e.merge=function(i,r){var n,o;void 0===i&&(i={}),void 0===r&&(r={});try{for(var a=r_(Object.entries(i)),s=a.next();!s.done;s=a.next()){var c=n_(s.value,2),u=c[0],d=c[1];null!==d&&"object"===t(d)?e.merge(i[u],r[u]):void 0!==r[u]&&(i[u]=r[u])}}catch(e){n={error:e}}finally{try{s&&!s.done&&(o=a.return)&&o.call(a)}finally{if(n)throw n.error}}},e.ab2str=function(e){return nD.decode(e)},e.ab2obj=function(t){try{var i=e.ab2str(t);return JSON.parse(i)}catch(e){return{}}},e.str2ab=function(e){return oD.encode(e).buffer},e.ab2b64str=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var i=new FileReader;i.onload=function(){return t(i.result)},i.readAsDataURL(new Blob([e]))}))];case 1:return[2,t.sent().split(",",2)[1]]}}))}))},e.b64str2ab=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function lD(){var e="none";return uD()||(null!==window.navigator.userAgent.match("Firefox")?e="mozilla":null!==window.navigator.userAgent.match("Chrome")?(e="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(e="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(e="safari")),e}var hD="mozilla"===lD(),pD="safari"===lD(),fD=!uD()&&navigator.userAgent.toLowerCase().includes("mobile");function _D(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,i){var r=i===t.length-1?"0":"1";return Number.parseInt(r+e.join(""),2)}))}var vD=function(){return Math.floor(65535*Math.random())};function mD(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function yD(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var i=ArrayBuffer.isView(t)?t.buffer:t,r=i.byteLength,n=[];if(r>10){var o=new DataView(i),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return r-1-t})).reverse().map((function(e){return o.getUint8(e)}));n=o_(o_(o_([],n_(a),!1),["..."],!1),n_(s),!1)}else n=Array.from(new Uint8Array(i));return"".concat(t.constructor.name,"(").concat(r,") [").concat(n.join(", "),"]")}if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var SD=function(e){return void 0===e&&(e=!1),t_(void 0,void 0,void 0,(function(){var t,i;return i_(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(t=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),t.addTransceiver("audio",{direction:"recvonly"}),t.addTransceiver("video",{direction:"recvonly"}),e&&(t.addTransceiver("audio",{direction:"sendonly"}),t.addTransceiver("video",{direction:"sendonly"})),[4,t.createOffer()];case 1:return i=r.sent(),t.close(),[2,i.sdp];case 2:return r.sent(),[3,3];case 3:return[2]}}))}))},gD=function(e){return new Promise((function(t,i){var r=(e=Array.isArray(e)?e:[]).length,n=[];0===r?i([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){r--,n.push(e),0===r&&i(n)}))}))}))};function ED(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function bD(e){return(e&Vf.AUDIO)===Vf.AUDIO}function TD(e){return(e&Vf.VIDEO)===Vf.VIDEO}function ID(e){var i={};return Object.keys(e).forEach((function(r){"object"===t(e[r])?i[r]=ID(e[r]):r.startsWith("_")||(i[r]=e[r])})),i}function RD(e){for(var t=atob(e),i=t.length,r=new Uint8Array(i),n=0;n<i;n++)r[n]=t.charCodeAt(n);return r}function AD(e){for(var t="",i=e.byteLength,r=0;r<i;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function CD(e,t,i){var r=OD(e),n=OD(t),o=OD(i);return function(e){for(var t=e.toString($k),i=new Uint8Array(t.length/2),r=0;r<t.length;r+=2)i[r/2]=parseInt(t.substr(r,2),16);return i}(Kk.exports.encrypt(r,n,{iv:o,mode:tD,padding:rD}).ciphertext)}function OD(e){for(var t=[],i=0;i<e.length;i+=4)t.push(e[i]<<24|(e[i+1]||0)<<16|(e[i+2]||0)<<8|(e[i+3]||0));return zk.create(t,e.length)}function wD(e,t){if("boolean"!=typeof e)throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function ND(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),e<i||e>r||"number"!=typeof e)throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(i,", ").concat(r,"]. integer only"))}function PD(e,t,i,r){if(void 0===i&&(i=1),void 0===r&&(r=Number.POSITIVE_INFINITY),null==e)throw new lP(aP.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,i){void 0===t&&(t=1);void 0===i&&(i=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=i&&e.length>=t}(e,i,r))throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(i,",").concat(r,"]"))}function kD(e,t,i){if(!i.includes(e))throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(i)))}function DD(e,t){if(LD(e))throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function MD(e,t){if(!(e instanceof ArrayBuffer))throw new lP(aP.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function UD(e){var t,i;try{var r=navigator.mediaDevices.getSupportedConstraints();try{for(var n=r_(Object.keys(e)),o=n.next();!o.done;o=n.next()){var a=o.value;r[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}}catch(e){}}function LD(e){return null==e}function xD(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lP(aP.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function VD(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lP(aP.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function FD(e){DD(e,"videoPlayerOption")}function BD(e,t){var i,r;if(void 0===t&&(t=64),!e||0===(null===(i=e)||void 0===i?void 0:i.byteLength))throw new lP(aP.INVALID_PARAMS,"The message cannot be empty");if((null==(r=e instanceof ArrayBuffer?e:dD.str2ab(JSON.stringify(e)))?void 0:r.byteLength)>1e3*t)throw new lP(aP.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function jD(e){return![d_.onRemoteStreamStats,d_.onLocalStreamStats,d_.onAudioVolumeIndication,d_.onLocalAudioPropertiesReport,d_.onRemoteAudioPropertiesReport].includes(e)}var GD={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,i="~";function r(){}function n(e,t,i){this.fn=e,this.context=t,this.once=i||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new n(r,o||e,a),c=i?i+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(i=!1)),s.prototype.eventNames=function(){var e,r,n=[];if(0===this._eventsCount)return n;for(r in e=this._events)t.call(e,r)&&n.push(i?r.slice(1):r);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=i?i+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var n=0,o=r.length,a=new Array(o);n<o;n++)a[n]=r[n].fn;return a},s.prototype.listenerCount=function(e){var t=i?i+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,n,o,a){var s=i?i+e:e;if(!this._events[s])return!1;var c,u,d=this._events[s],l=arguments.length;if(d.fn){switch(d.once&&this.removeListener(e,d.fn,void 0,!0),l){case 1:return d.fn.call(d.context),!0;case 2:return d.fn.call(d.context,t),!0;case 3:return d.fn.call(d.context,t,r),!0;case 4:return d.fn.call(d.context,t,r,n),!0;case 5:return d.fn.call(d.context,t,r,n,o),!0;case 6:return d.fn.call(d.context,t,r,n,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,r);break;case 4:d[u].fn.call(d[u].context,t,r,n);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,i){return o(this,e,t,i,!1)},s.prototype.once=function(e,t,i){return o(this,e,t,i,!0)},s.prototype.removeListener=function(e,t,r,n){var o=i?i+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||n&&!s.once||r&&s.context!==r||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||n&&!s[c].once||r&&s[c].context!==r)&&u.push(s[c]);u.length?this._events[o]=1===u.length?u[0]:u:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=i?i+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=i,s.EventEmitter=s,e.exports=s}(GD);var HD=GD.exports,zD="[VERTC]",KD=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],WD=!uD()&&window.location.search.includes("_rtc_debug_"),XD=function(){function e(e,t,i){this._module=e,this._indent=t}return e.prototype.print=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(WD){for(var r="",n=0;n<this._indent;n++)r+=" ";console.log.apply(console,o_(["%c".concat(zD).concat(r,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(KD[this._indent],";")],n_(t),!1))}},e}(),YD=new XD("VERTC",0),qD=function(e){function t(){return e.call(this)||this}return Cf(t,e),t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];var n=this.listenerCount(t);try{return e.prototype.emit.apply(this,o_([t],n_(i),!1))}catch(e){return YD.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(n)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return t_(this,void 0,void 0,(function(){var i=this;return i_(this,(function(r){return[2,new Promise((function(r,n){try{i.emit.apply(i,o_(o_([e],n_(t),!1),[r,n],!1))}catch(t){YD.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),n(t)}}))]}))}))},t}(GD.exports.EventEmitter),JD=xe,QD=function(e){return void 0!==e&&(JD(e,"value")||JD(e,"writable"))},ZD=l,$D=G,eM=Dt,tM=QD,iM=o,rM=vh;Wr({target:"Reflect",stat:!0},{get:function e(t,i){var r,n,o=arguments.length<3?t:arguments[2];return eM(t)===o?t[i]:(r=iM.f(t,i))?tM(r)?r.value:void 0===r.get?void 0:ZD(r.get,o):$D(n=rM(t))?e(n,i,o):void 0}});var nM=Wr,oM=l,aM=Dt,sM=G,cM=QD,uM=Ct,dM=o,lM=vh,hM=y;var pM=a((function(){var e=function(){},t=uM.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));nM({target:"Reflect",stat:!0,forced:pM},{set:function e(t,i,r){var n,o,a,s=arguments.length<4?t:arguments[3],c=dM.f(aM(t),i);if(!c){if(sM(o=lM(t)))return e(o,i,r,s);c=hM(0)}if(cM(c)){if(!1===c.writable||!sM(s))return!1;if(n=dM.f(s,i)){if(n.get||n.set||!1===n.writable)return!1;n.value=r,uM.f(s,i,n)}else uM.f(s,i,hM(0,r))}else{if(void 0===(a=c.set))return!1;oM(a,s,r)}return!0}});var fM={};!function(e){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var i=Array.prototype.slice.call(arguments,1);i.length;){var n=i.shift();if(n){if("object"!==t(n))throw new TypeError(n+"must be non-object");for(var o in n)r(n,o)&&(e[o]=n[o])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var n={arraySet:function(e,t,i,r,n){if(t.subarray&&e.subarray)e.set(t.subarray(i,i+r),n);else for(var o=0;o<r;o++)e[n+o]=t[i+o]},flattenChunks:function(e){var t,i,r,n,o,a;for(r=0,t=0,i=e.length;t<i;t++)r+=e[t].length;for(a=new Uint8Array(r),n=0,t=0,i=e.length;t<i;t++)o=e[t],a.set(o,n),n+=o.length;return a}},o={arraySet:function(e,t,i,r,n){for(var o=0;o<r;o++)e[n+o]=t[i+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,o))},e.setTyped(i)}(fM);var _M={},vM={},mM={},yM=fM;function SM(e){for(var t=e.length;--t>=0;)e[t]=0}var gM=256,EM=286,bM=30,TM=15,IM=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],RM=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],AM=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],CM=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],OM=new Array(576);SM(OM);var wM=new Array(60);SM(wM);var NM=new Array(512);SM(NM);var PM=new Array(256);SM(PM);var kM=new Array(29);SM(kM);var DM,MM,UM,LM=new Array(bM);function xM(e,t,i,r,n){this.static_tree=e,this.extra_bits=t,this.extra_base=i,this.elems=r,this.max_length=n,this.has_stree=e&&e.length}function VM(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function FM(e){return e<256?NM[e]:NM[256+(e>>>7)]}function BM(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function jM(e,t,i){e.bi_valid>16-i?(e.bi_buf|=t<<e.bi_valid&65535,BM(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=i-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=i)}function GM(e,t,i){jM(e,i[2*t],i[2*t+1])}function HM(e,t){var i=0;do{i|=1&e,e>>>=1,i<<=1}while(--t>0);return i>>>1}function zM(e,t,i){var r,n,o=new Array(16),a=0;for(r=1;r<=TM;r++)o[r]=a=a+i[r-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=HM(o[s]++,s))}}function KM(e){var t;for(t=0;t<EM;t++)e.dyn_ltree[2*t]=0;for(t=0;t<bM;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function WM(e){e.bi_valid>8?BM(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function XM(e,t,i,r){var n=2*t,o=2*i;return e[n]<e[o]||e[n]===e[o]&&r[t]<=r[i]}function YM(e,t,i){for(var r=e.heap[i],n=i<<1;n<=e.heap_len&&(n<e.heap_len&&XM(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!XM(t,r,e.heap[n],e.depth));)e.heap[i]=e.heap[n],i=n,n<<=1;e.heap[i]=r}function qM(e,t,i){var r,n,o,a,s=0;if(0!==e.last_lit)do{r=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],n=e.pending_buf[e.l_buf+s],s++,0===r?GM(e,n,t):(GM(e,(o=PM[n])+gM+1,t),0!==(a=IM[o])&&jM(e,n-=kM[o],a),GM(e,o=FM(--r),i),0!==(a=RM[o])&&jM(e,r-=LM[o],a))}while(s<e.last_lit);GM(e,256,t)}function JM(e,t){var i,r,n,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,i=0;i<c;i++)0!==o[2*i]?(e.heap[++e.heap_len]=u=i,e.depth[i]=0):o[2*i+1]=0;for(;e.heap_len<2;)o[2*(n=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=a[2*n+1]);for(t.max_code=u,i=e.heap_len>>1;i>=1;i--)YM(e,o,i);n=c;do{i=e.heap[1],e.heap[1]=e.heap[e.heap_len--],YM(e,o,1),r=e.heap[1],e.heap[--e.heap_max]=i,e.heap[--e.heap_max]=r,o[2*n]=o[2*i]+o[2*r],e.depth[n]=(e.depth[i]>=e.depth[r]?e.depth[i]:e.depth[r])+1,o[2*i+1]=o[2*r+1]=n,e.heap[1]=n++,YM(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var i,r,n,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,f=t.stat_desc.max_length,_=0;for(o=0;o<=TM;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,i=e.heap_max+1;i<573;i++)(o=c[2*c[2*(r=e.heap[i])+1]+1]+1)>f&&(o=f,_++),c[2*r+1]=o,r>u||(e.bl_count[o]++,a=0,r>=p&&(a=h[r-p]),s=c[2*r],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*r+1]+a)));if(0!==_){do{for(o=f-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[f]--,_-=2}while(_>0);for(o=f;0!==o;o--)for(r=e.bl_count[o];0!==r;)(n=e.heap[--i])>u||(c[2*n+1]!==o&&(e.opt_len+=(o-c[2*n+1])*c[2*n],c[2*n+1]=o),r--)}}(e,t),zM(o,u,e.bl_count)}function QM(e,t,i){var r,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(i+1)+1]=65535,r=0;r<=i;r++)n=a,a=t[2*(r+1)+1],++s<c&&n===a||(s<u?e.bl_tree[2*n]+=s:0!==n?(n!==o&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4))}function ZM(e,t,i){var r,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),r=0;r<=i;r++)if(n=a,a=t[2*(r+1)+1],!(++s<c&&n===a)){if(s<u)do{GM(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(GM(e,n,e.bl_tree),s--),GM(e,16,e.bl_tree),jM(e,s-3,2)):s<=10?(GM(e,17,e.bl_tree),jM(e,s-3,3)):(GM(e,18,e.bl_tree),jM(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}}SM(LM);var $M=!1;function eU(e,t,i,r){jM(e,0+(r?1:0),3),function(e,t,i,r){WM(e),r&&(BM(e,i),BM(e,~i)),yM.arraySet(e.pending_buf,e.window,t,i,e.pending),e.pending+=i}(e,t,i,!0)}mM._tr_init=function(e){$M||(!function(){var e,t,i,r,n,o=new Array(16);for(i=0,r=0;r<28;r++)for(kM[r]=i,e=0;e<1<<IM[r];e++)PM[i++]=r;for(PM[i-1]=r,n=0,r=0;r<16;r++)for(LM[r]=n,e=0;e<1<<RM[r];e++)NM[n++]=r;for(n>>=7;r<bM;r++)for(LM[r]=n<<7,e=0;e<1<<RM[r]-7;e++)NM[256+n++]=r;for(t=0;t<=TM;t++)o[t]=0;for(e=0;e<=143;)OM[2*e+1]=8,e++,o[8]++;for(;e<=255;)OM[2*e+1]=9,e++,o[9]++;for(;e<=279;)OM[2*e+1]=7,e++,o[7]++;for(;e<=287;)OM[2*e+1]=8,e++,o[8]++;for(zM(OM,287,o),e=0;e<bM;e++)wM[2*e+1]=5,wM[2*e]=HM(e,5);DM=new xM(OM,IM,257,EM,TM),MM=new xM(wM,RM,0,bM,TM),UM=new xM(new Array(0),AM,0,19,7)}(),$M=!0),e.l_desc=new VM(e.dyn_ltree,DM),e.d_desc=new VM(e.dyn_dtree,MM),e.bl_desc=new VM(e.bl_tree,UM),e.bi_buf=0,e.bi_valid=0,KM(e)},mM._tr_stored_block=eU,mM._tr_flush_block=function(e,t,i,r){var n,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,i=4093624447;for(t=0;t<=31;t++,i>>>=1)if(1&i&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<gM;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),JM(e,e.l_desc),JM(e,e.d_desc),a=function(e){var t;for(QM(e,e.dyn_ltree,e.l_desc.max_code),QM(e,e.dyn_dtree,e.d_desc.max_code),JM(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*CM[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=i+5,i+4<=n&&-1!==t?eU(e,t,i,r):4===e.strategy||o===n?(jM(e,2+(r?1:0),3),qM(e,OM,wM)):(jM(e,4+(r?1:0),3),function(e,t,i,r){var n;for(jM(e,t-257,5),jM(e,i-1,5),jM(e,r-4,4),n=0;n<r;n++)jM(e,e.bl_tree[2*CM[n]+1],3);ZM(e,e.dyn_ltree,t-1),ZM(e,e.dyn_dtree,i-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),qM(e,e.dyn_ltree,e.dyn_dtree)),KM(e),r&&WM(e)},mM._tr_tally=function(e,t,i){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&i,e.last_lit++,0===t?e.dyn_ltree[2*i]++:(e.matches++,t--,e.dyn_ltree[2*(PM[i]+gM+1)]++,e.dyn_dtree[2*FM(t)]++),e.last_lit===e.lit_bufsize-1},mM._tr_align=function(e){jM(e,2,3),GM(e,256,OM),function(e){16===e.bi_valid?(BM(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)};var tU=function(e,t,i,r){for(var n=65535&e|0,o=e>>>16&65535|0,a=0;0!==i;){i-=a=i>2e3?2e3:i;do{o=o+(n=n+t[r++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0};var iU=function(){for(var e,t=[],i=0;i<256;i++){e=i;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[i]=e}return t}();var rU,nU=function(e,t,i,r){var n=iU,o=r+i;e^=-1;for(var a=r;a<o;a++)e=e>>>8^n[255&(e^t[a])];return-1^e},oU={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},aU=fM,sU=mM,cU=tU,uU=nU,dU=oU,lU=-2,hU=258,pU=262,fU=103,_U=113,vU=666;function mU(e,t){return e.msg=dU[t],t}function yU(e){return(e<<1)-(e>4?9:0)}function SU(e){for(var t=e.length;--t>=0;)e[t]=0}function gU(e){var t=e.state,i=t.pending;i>e.avail_out&&(i=e.avail_out),0!==i&&(aU.arraySet(e.output,t.pending_buf,t.pending_out,i,e.next_out),e.next_out+=i,t.pending_out+=i,e.total_out+=i,e.avail_out-=i,t.pending-=i,0===t.pending&&(t.pending_out=0))}function EU(e,t){sU._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,gU(e.strm)}function bU(e,t){e.pending_buf[e.pending++]=t}function TU(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function IU(e,t){var i,r,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-pU?e.strstart-(e.w_size-pU):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+hU,p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(i=t)+a]===f&&u[i+a-1]===p&&u[i]===u[o]&&u[++i]===u[o+1]){o+=2,i++;do{}while(u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&u[++o]===u[++i]&&o<h);if(r=hU-(h-o),o=h-hU,r>a){if(e.match_start=t,a=r,r>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=l[t&d])>c&&0!=--n);return a<=e.lookahead?a:e.lookahead}function RU(e){var t,i,r,n,o,a,s,c,u,d,l=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-pU)){aU.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=i=e.hash_size;do{r=e.head[--t],e.head[t]=r>=l?r-l:0}while(--i);t=i=l;do{r=e.prev[--t],e.prev[t]=r>=l?r-l:0}while(--i);n+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=n,d=void 0,(d=a.avail_in)>u&&(d=u),i=0===d?0:(a.avail_in-=d,aU.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=cU(a.adler,s,d,c):2===a.state.wrap&&(a.adler=uU(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=i,e.lookahead+e.insert>=3)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[o+3-1])&e.hash_mask,e.prev[o&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=o,o++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<pU&&0!==e.strm.avail_in)}function AU(e,t){for(var i,r;;){if(e.lookahead<pU){if(RU(e),e.lookahead<pU&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==i&&e.strstart-i<=e.w_size-pU&&(e.match_length=IU(e,i)),e.match_length>=3)if(r=sU._tr_tally(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do{e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=sU._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(EU(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(EU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(EU(e,!1),0===e.strm.avail_out)?1:2}function CU(e,t){for(var i,r,n;;){if(e.lookahead<pU){if(RU(e),e.lookahead<pU&&0===t)return 1;if(0===e.lookahead)break}if(i=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==i&&e.prev_length<e.max_lazy_match&&e.strstart-i<=e.w_size-pU&&(e.match_length=IU(e,i),e.match_length<=5&&(1===e.strategy||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,r=sU._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,i=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,r&&(EU(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((r=sU._tr_tally(e,0,e.window[e.strstart-1]))&&EU(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=sU._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(EU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(EU(e,!1),0===e.strm.avail_out)?1:2}function OU(e,t,i,r,n){this.good_length=e,this.max_lazy=t,this.nice_length=i,this.max_chain=r,this.func=n}function wU(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=8,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new aU.Buf16(1146),this.dyn_dtree=new aU.Buf16(122),this.bl_tree=new aU.Buf16(78),SU(this.dyn_ltree),SU(this.dyn_dtree),SU(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new aU.Buf16(16),this.heap=new aU.Buf16(573),SU(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new aU.Buf16(573),SU(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function NU(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=2,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?42:_U,e.adler=2===t.wrap?0:1,t.last_flush=0,sU._tr_init(t),0):mU(e,lU)}function PU(e){var t,i=NU(e);return 0===i&&((t=e.state).window_size=2*t.w_size,SU(t.head),t.max_lazy_match=rU[t.level].max_lazy,t.good_match=rU[t.level].good_length,t.nice_match=rU[t.level].nice_length,t.max_chain_length=rU[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),i}function kU(e,t,i,r,n,o){if(!e)return lU;var a=1;if(-1===t&&(t=6),r<0?(a=0,r=-r):r>15&&(a=2,r-=16),n<1||n>9||8!==i||r<8||r>15||t<0||t>9||o<0||o>4)return mU(e,lU);8===r&&(r=9);var s=new wU;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=r,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new aU.Buf8(2*s.w_size),s.head=new aU.Buf16(s.hash_size),s.prev=new aU.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new aU.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=o,s.method=i,PU(e)}rU=[new OU(0,0,0,0,(function(e,t){var i=65535;for(i>e.pending_buf_size-5&&(i=e.pending_buf_size-5);;){if(e.lookahead<=1){if(RU(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+i;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,EU(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-pU&&(EU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(EU(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(EU(e,!1),e.strm.avail_out),1)})),new OU(4,4,8,4,AU),new OU(4,5,16,8,AU),new OU(4,6,32,32,AU),new OU(4,4,16,16,CU),new OU(8,16,32,32,CU),new OU(8,16,128,128,CU),new OU(8,32,128,256,CU),new OU(32,128,258,1024,CU),new OU(32,258,258,4096,CU)],vM.deflateInit=function(e,t){return kU(e,t,8,15,8,0)},vM.deflateInit2=kU,vM.deflateReset=PU,vM.deflateResetKeep=NU,vM.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?lU:(e.state.gzhead=t,0):lU},vM.deflate=function(e,t){var i,r,n,o;if(!e||!e.state||t>5||t<0)return e?mU(e,lU):lU;if(r=e.state,!e.output||!e.input&&0!==e.avail_in||r.status===vU&&4!==t)return mU(e,0===e.avail_out?-5:lU);if(r.strm=e,i=r.last_flush,r.last_flush=t,42===r.status)if(2===r.wrap)e.adler=0,bU(r,31),bU(r,139),bU(r,8),r.gzhead?(bU(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),bU(r,255&r.gzhead.time),bU(r,r.gzhead.time>>8&255),bU(r,r.gzhead.time>>16&255),bU(r,r.gzhead.time>>24&255),bU(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),bU(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(bU(r,255&r.gzhead.extra.length),bU(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=uU(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(bU(r,0),bU(r,0),bU(r,0),bU(r,0),bU(r,0),bU(r,9===r.level?2:r.strategy>=2||r.level<2?4:0),bU(r,3),r.status=_U);else{var a=8+(r.w_bits-8<<4)<<8;a|=(r.strategy>=2||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(a|=32),a+=31-a%31,r.status=_U,TU(r,a),0!==r.strstart&&(TU(r,e.adler>>>16),TU(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(n=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>n&&(e.adler=uU(e.adler,r.pending_buf,r.pending-n,n)),gU(e),n=r.pending,r.pending!==r.pending_buf_size));)bU(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>n&&(e.adler=uU(e.adler,r.pending_buf,r.pending-n,n)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=uU(e.adler,r.pending_buf,r.pending-n,n)),gU(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.name.length?255&r.gzhead.name.charCodeAt(r.gzindex++):0,bU(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=uU(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){n=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>n&&(e.adler=uU(e.adler,r.pending_buf,r.pending-n,n)),gU(e),n=r.pending,r.pending===r.pending_buf_size)){o=1;break}o=r.gzindex<r.gzhead.comment.length?255&r.gzhead.comment.charCodeAt(r.gzindex++):0,bU(r,o)}while(0!==o);r.gzhead.hcrc&&r.pending>n&&(e.adler=uU(e.adler,r.pending_buf,r.pending-n,n)),0===o&&(r.status=fU)}else r.status=fU;if(r.status===fU&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&gU(e),r.pending+2<=r.pending_buf_size&&(bU(r,255&e.adler),bU(r,e.adler>>8&255),e.adler=0,r.status=_U)):r.status=_U),0!==r.pending){if(gU(e),0===e.avail_out)return r.last_flush=-1,0}else if(0===e.avail_in&&yU(t)<=yU(i)&&4!==t)return mU(e,-5);if(r.status===vU&&0!==e.avail_in)return mU(e,-5);if(0!==e.avail_in||0!==r.lookahead||0!==t&&r.status!==vU){var s=2===r.strategy?function(e,t){for(var i;;){if(0===e.lookahead&&(RU(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,i=sU._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,i&&(EU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(EU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(EU(e,!1),0===e.strm.avail_out)?1:2}(r,t):3===r.strategy?function(e,t){for(var i,r,n,o,a=e.window;;){if(e.lookahead<=hU){if(RU(e),e.lookahead<=hU&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(r=a[n=e.strstart-1])===a[++n]&&r===a[++n]&&r===a[++n]){o=e.strstart+hU;do{}while(r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&r===a[++n]&&n<o);e.match_length=hU-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(i=sU._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(i=sU._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),i&&(EU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(EU(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(EU(e,!1),0===e.strm.avail_out)?1:2}(r,t):rU[r.level].func(r,t);if(3!==s&&4!==s||(r.status=vU),1===s||3===s)return 0===e.avail_out&&(r.last_flush=-1),0;if(2===s&&(1===t?sU._tr_align(r):5!==t&&(sU._tr_stored_block(r,0,0,!1),3===t&&(SU(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),gU(e),0===e.avail_out))return r.last_flush=-1,0}return 4!==t?0:r.wrap<=0?1:(2===r.wrap?(bU(r,255&e.adler),bU(r,e.adler>>8&255),bU(r,e.adler>>16&255),bU(r,e.adler>>24&255),bU(r,255&e.total_in),bU(r,e.total_in>>8&255),bU(r,e.total_in>>16&255),bU(r,e.total_in>>24&255)):(TU(r,e.adler>>>16),TU(r,65535&e.adler)),gU(e),r.wrap>0&&(r.wrap=-r.wrap),0!==r.pending?0:1)},vM.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==fU&&t!==_U&&t!==vU?mU(e,lU):(e.state=null,t===_U?mU(e,-3):0):lU},vM.deflateSetDictionary=function(e,t){var i,r,n,o,a,s,c,u,d=t.length;if(!e||!e.state)return lU;if(2===(o=(i=e.state).wrap)||1===o&&42!==i.status||i.lookahead)return lU;for(1===o&&(e.adler=cU(e.adler,t,d,0)),i.wrap=0,d>=i.w_size&&(0===o&&(SU(i.head),i.strstart=0,i.block_start=0,i.insert=0),u=new aU.Buf8(i.w_size),aU.arraySet(u,t,d-i.w_size,i.w_size,0),t=u,d=i.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,RU(i);i.lookahead>=3;){r=i.strstart,n=i.lookahead-2;do{i.ins_h=(i.ins_h<<i.hash_shift^i.window[r+3-1])&i.hash_mask,i.prev[r&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=r,r++}while(--n);i.strstart=r,i.lookahead=2,RU(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,i.wrap=o,0},vM.deflateInfo="pako deflate (from Nodeca project)";var DU={},MU=fM,UU=!0,LU=!0;try{String.fromCharCode.apply(null,[0])}catch(e){UU=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){LU=!1}for(var xU=new MU.Buf8(256),VU=0;VU<256;VU++)xU[VU]=VU>=252?6:VU>=248?5:VU>=240?4:VU>=224?3:VU>=192?2:1;function FU(e,t){if(t<65534&&(e.subarray&&LU||!e.subarray&&UU))return String.fromCharCode.apply(null,MU.shrinkBuf(e,t));for(var i="",r=0;r<t;r++)i+=String.fromCharCode(e[r]);return i}xU[254]=xU[254]=1,DU.string2buf=function(e){var t,i,r,n,o,a=e.length,s=0;for(n=0;n<a;n++)55296==(64512&(i=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),s+=i<128?1:i<2048?2:i<65536?3:4;for(t=new MU.Buf8(s),o=0,n=0;o<s;n++)55296==(64512&(i=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(r=e.charCodeAt(n+1)))&&(i=65536+(i-55296<<10)+(r-56320),n++),i<128?t[o++]=i:i<2048?(t[o++]=192|i>>>6,t[o++]=128|63&i):i<65536?(t[o++]=224|i>>>12,t[o++]=128|i>>>6&63,t[o++]=128|63&i):(t[o++]=240|i>>>18,t[o++]=128|i>>>12&63,t[o++]=128|i>>>6&63,t[o++]=128|63&i);return t},DU.buf2binstring=function(e){return FU(e,e.length)},DU.binstring2buf=function(e){for(var t=new MU.Buf8(e.length),i=0,r=t.length;i<r;i++)t[i]=e.charCodeAt(i);return t},DU.buf2string=function(e,t){var i,r,n,o,a=t||e.length,s=new Array(2*a);for(r=0,i=0;i<a;)if((n=e[i++])<128)s[r++]=n;else if((o=xU[n])>4)s[r++]=65533,i+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&i<a;)n=n<<6|63&e[i++],o--;o>1?s[r++]=65533:n<65536?s[r++]=n:(n-=65536,s[r++]=55296|n>>10&1023,s[r++]=56320|1023&n)}return FU(s,r)},DU.utf8border=function(e,t){var i;for((t=t||e.length)>e.length&&(t=e.length),i=t-1;i>=0&&128==(192&e[i]);)i--;return i<0||0===i?t:i+xU[e[i]]>t?i:t};var BU=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0},jU=vM,GU=fM,HU=DU,zU=oU,KU=BU,WU=Object.prototype.toString;function XU(e){if(!(this instanceof XU))return new XU(e);this.options=GU.assign({level:-1,method:8,chunkSize:16384,windowBits:15,memLevel:8,strategy:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new KU,this.strm.avail_out=0;var i=jU.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==i)throw new Error(zU[i]);if(t.header&&jU.deflateSetHeader(this.strm,t.header),t.dictionary){var r;if(r="string"==typeof t.dictionary?HU.string2buf(t.dictionary):"[object ArrayBuffer]"===WU.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(i=jU.deflateSetDictionary(this.strm,r)))throw new Error(zU[i]);this._dict_set=!0}}function YU(e,t){var i=new XU(t);if(i.push(e,!0),i.err)throw i.msg||zU[i.err];return i.result}XU.prototype.push=function(e,t){var i,r,n=this.strm,o=this.options.chunkSize;if(this.ended)return!1;r=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=HU.string2buf(e):"[object ArrayBuffer]"===WU.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new GU.Buf8(o),n.next_out=0,n.avail_out=o),1!==(i=jU.deflate(n,r))&&0!==i)return this.onEnd(i),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==r&&2!==r)||("string"===this.options.to?this.onData(HU.buf2binstring(GU.shrinkBuf(n.output,n.next_out))):this.onData(GU.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==i);return 4===r?(i=jU.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,0===i):2!==r||(this.onEnd(0),n.avail_out=0,!0)},XU.prototype.onData=function(e){this.chunks.push(e)},XU.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=GU.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},_M.Deflate=XU,_M.deflate=YU,_M.deflateRaw=function(e,t){return(t=t||{}).raw=!0,YU(e,t)},_M.gzip=function(e,t){return(t=t||{}).gzip=!0,YU(e,t)};var qU={},JU=s,QU=Ct,ZU=Q_,$U=a,eL=RegExp.prototype;JU&&$U((function(){return"sy"!==Object.getOwnPropertyDescriptor(eL,"flags").get.call({dotAll:!0,sticky:!0})}))&&QU.f(eL,"flags",{configurable:!0,get:ZU});var tL={},iL=fM,rL=15,nL=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],oL=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],aL=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],sL=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64],cL=fM,uL=tU,dL=nU,lL=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,S,g,E,b,T,I,R,A;i=e.state,r=e.next_in,R=e.input,n=r+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=i.dmax,u=i.wsize,d=i.whave,l=i.wnext,h=i.window,p=i.hold,f=i.bits,_=i.lencode,v=i.distcode,m=(1<<i.lenbits)-1,y=(1<<i.distbits)-1;e:do{f<15&&(p+=R[r++]<<f,f+=8,p+=R[r++]<<f,f+=8),S=_[p&m];t:for(;;){if(p>>>=g=S>>>24,f-=g,0===(g=S>>>16&255))A[o++]=65535&S;else{if(!(16&g)){if(0==(64&g)){S=_[(65535&S)+(p&(1<<g)-1)];continue t}if(32&g){i.mode=12;break e}e.msg="invalid literal/length code",i.mode=30;break e}E=65535&S,(g&=15)&&(f<g&&(p+=R[r++]<<f,f+=8),E+=p&(1<<g)-1,p>>>=g,f-=g),f<15&&(p+=R[r++]<<f,f+=8,p+=R[r++]<<f,f+=8),S=v[p&y];i:for(;;){if(p>>>=g=S>>>24,f-=g,!(16&(g=S>>>16&255))){if(0==(64&g)){S=v[(65535&S)+(p&(1<<g)-1)];continue i}e.msg="invalid distance code",i.mode=30;break e}if(b=65535&S,f<(g&=15)&&(p+=R[r++]<<f,(f+=8)<g&&(p+=R[r++]<<f,f+=8)),(b+=p&(1<<g)-1)>c){e.msg="invalid distance too far back",i.mode=30;break e}if(p>>>=g,f-=g,b>(g=o-a)){if((g=b-g)>d&&i.sane){e.msg="invalid distance too far back",i.mode=30;break e}if(T=0,I=h,0===l){if(T+=u-g,g<E){E-=g;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}}else if(l<g){if(T+=u+l-g,(g-=l)<E){E-=g;do{A[o++]=h[T++]}while(--g);if(T=0,l<E){E-=g=l;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}}}else if(T+=l-g,g<E){E-=g;do{A[o++]=h[T++]}while(--g);T=o-b,I=A}for(;E>2;)A[o++]=I[T++],A[o++]=I[T++],A[o++]=I[T++],E-=3;E&&(A[o++]=I[T++],E>1&&(A[o++]=I[T++]))}else{T=o-b;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],E-=3}while(E>2);E&&(A[o++]=A[T++],E>1&&(A[o++]=A[T++]))}break}}break}}while(r<n&&o<s);r-=E=f>>3,p&=(1<<(f-=E<<3))-1,e.next_in=r,e.next_out=o,e.avail_in=r<n?n-r+5:5-(r-n),e.avail_out=o<s?s-o+257:257-(o-s),i.hold=p,i.bits=f},hL=function(e,t,i,r,n,o,a,s){var c,u,d,l,h,p,f,_,v,m=s.bits,y=0,S=0,g=0,E=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,w=0,N=new iL.Buf16(16),P=new iL.Buf16(16),k=null,D=0;for(y=0;y<=rL;y++)N[y]=0;for(S=0;S<r;S++)N[t[i+S]]++;for(b=m,E=rL;E>=1&&0===N[E];E--);if(b>E&&(b=E),0===E)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(g=1;g<E&&0===N[g];g++);for(b<g&&(b=g),R=1,y=1;y<=rL;y++)if(R<<=1,(R-=N[y])<0)return-1;if(R>0&&(0===e||1!==E))return-1;for(P[1]=0,y=1;y<rL;y++)P[y+1]=P[y]+N[y];for(S=0;S<r;S++)0!==t[i+S]&&(a[P[t[i+S]]++]=S);if(0===e?(O=k=a,p=19):1===e?(O=nL,w-=257,k=oL,D-=257,p=256):(O=aL,k=sL,p=-1),C=0,S=0,y=g,h=o,T=b,I=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){f=y-I,a[S]<p?(_=0,v=a[S]):a[S]>p?(_=k[D+a[S]],v=O[w+a[S]]):(_=96,v=0),c=1<<y-I,g=u=1<<T;do{n[h+(C>>I)+(u-=c)]=f<<24|_<<16|v|0}while(0!==u);for(c=1<<y-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,S++,0==--N[y]){if(y===E)break;y=t[i+a[S]]}if(y>b&&(C&l)!==d){for(0===I&&(I=b),h+=g,R=1<<(T=y-I);T+I<E&&!((R-=N[T+I])<=0);)T++,R<<=1;if(A+=1<<T,1===e&&A>852||2===e&&A>592)return 1;n[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(n[h+C]=y-I<<24|64<<16|0),s.bits=b,0},pL=-2,fL=12,_L=30;function vL(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function mL(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new cL.Buf16(320),this.work=new cL.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function yL(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=1,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new cL.Buf32(852),t.distcode=t.distdyn=new cL.Buf32(592),t.sane=1,t.back=-1,0):pL}function SL(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,yL(e)):pL}function gL(e,t){var i,r;return e&&e.state?(r=e.state,t<0?(i=0,t=-t):(i=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?pL:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=i,r.wbits=t,SL(e))):pL}function EL(e,t){var i,r;return e?(r=new mL,e.state=r,r.window=null,0!==(i=gL(e,t))&&(e.state=null),i):pL}var bL,TL,IL=!0;function RL(e){if(IL){var t;for(bL=new cL.Buf32(512),TL=new cL.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(hL(1,e.lens,0,288,bL,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;hL(2,e.lens,0,32,TL,0,e.work,{bits:5}),IL=!1}e.lencode=bL,e.lenbits=9,e.distcode=TL,e.distbits=5}function AL(e,t,i,r){var n,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new cL.Buf8(o.wsize)),r>=o.wsize?(cL.arraySet(o.window,t,i-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>r&&(n=r),cL.arraySet(o.window,t,i-r,n,o.wnext),(r-=n)?(cL.arraySet(o.window,t,i-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}tL.inflateReset=SL,tL.inflateReset2=gL,tL.inflateResetKeep=yL,tL.inflateInit=function(e){return EL(e,15)},tL.inflateInit2=EL,tL.inflate=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,S,g,E,b,T,I,R,A=0,C=new cL.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return pL;(i=e.state).mode===fL&&(i.mode=13),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=i.hold,d=i.bits,l=s,h=c,T=0;e:for(;;)switch(i.mode){case 1:if(0===i.wrap){i.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(2&i.wrap&&35615===u){i.check=0,C[0]=255&u,C[1]=u>>>8&255,i.check=dL(i.check,C,2,0),u=0,d=0,i.mode=2;break}if(i.flags=0,i.head&&(i.head.done=!1),!(1&i.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",i.mode=_L;break}if(8!=(15&u)){e.msg="unknown compression method",i.mode=_L;break}if(d-=4,b=8+(15&(u>>>=4)),0===i.wbits)i.wbits=b;else if(b>i.wbits){e.msg="invalid window size",i.mode=_L;break}i.dmax=1<<b,e.adler=i.check=1,i.mode=512&u?10:fL,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(i.flags=u,8!=(255&i.flags)){e.msg="unknown compression method",i.mode=_L;break}if(57344&i.flags){e.msg="unknown header flags set",i.mode=_L;break}i.head&&(i.head.text=u>>8&1),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=dL(i.check,C,2,0)),u=0,d=0,i.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.head&&(i.head.time=u),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,i.check=dL(i.check,C,4,0)),u=0,d=0,i.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.head&&(i.head.xflags=255&u,i.head.os=u>>8),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=dL(i.check,C,2,0)),u=0,d=0,i.mode=5;case 5:if(1024&i.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.length=u,i.head&&(i.head.extra_len=u),512&i.flags&&(C[0]=255&u,C[1]=u>>>8&255,i.check=dL(i.check,C,2,0)),u=0,d=0}else i.head&&(i.head.extra=null);i.mode=6;case 6:if(1024&i.flags&&((p=i.length)>s&&(p=s),p&&(i.head&&(b=i.head.extra_len-i.length,i.head.extra||(i.head.extra=new Array(i.head.extra_len)),cL.arraySet(i.head.extra,r,o,p,b)),512&i.flags&&(i.check=dL(i.check,r,p,o)),s-=p,o+=p,i.length-=p),i.length))break e;i.length=0,i.mode=7;case 7:if(2048&i.flags){if(0===s)break e;p=0;do{b=r[o+p++],i.head&&b&&i.length<65536&&(i.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&i.flags&&(i.check=dL(i.check,r,p,o)),s-=p,o+=p,b)break e}else i.head&&(i.head.name=null);i.length=0,i.mode=8;case 8:if(4096&i.flags){if(0===s)break e;p=0;do{b=r[o+p++],i.head&&b&&i.length<65536&&(i.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&i.flags&&(i.check=dL(i.check,r,p,o)),s-=p,o+=p,b)break e}else i.head&&(i.head.comment=null);i.mode=9;case 9:if(512&i.flags){for(;d<16;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u!==(65535&i.check)){e.msg="header crc mismatch",i.mode=_L;break}u=0,d=0}i.head&&(i.head.hcrc=i.flags>>9&1,i.head.done=!0),e.adler=i.check=0,i.mode=fL;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}e.adler=i.check=vL(u),u=0,d=0,i.mode=11;case 11:if(0===i.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,2;e.adler=i.check=1,i.mode=fL;case fL:if(5===t||6===t)break e;case 13:if(i.last){u>>>=7&d,d-=7&d,i.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}switch(i.last=1&u,d-=1,3&(u>>>=1)){case 0:i.mode=14;break;case 1:if(RL(i),i.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:i.mode=17;break;case 3:e.msg="invalid block type",i.mode=_L}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",i.mode=_L;break}if(i.length=65535&u,u=0,d=0,i.mode=15,6===t)break e;case 15:i.mode=16;case 16:if(p=i.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;cL.arraySet(n,r,o,p,a),s-=p,o+=p,c-=p,a+=p,i.length-=p;break}i.mode=fL;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(i.nlen=257+(31&u),u>>>=5,d-=5,i.ndist=1+(31&u),u>>>=5,d-=5,i.ncode=4+(15&u),u>>>=4,d-=4,i.nlen>286||i.ndist>30){e.msg="too many length or distance symbols",i.mode=_L;break}i.have=0,i.mode=18;case 18:for(;i.have<i.ncode;){for(;d<3;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.lens[O[i.have++]]=7&u,u>>>=3,d-=3}for(;i.have<19;)i.lens[O[i.have++]]=0;if(i.lencode=i.lendyn,i.lenbits=7,I={bits:i.lenbits},T=hL(0,i.lens,0,19,i.lencode,0,i.work,I),i.lenbits=I.bits,T){e.msg="invalid code lengths set",i.mode=_L;break}i.have=0,i.mode=19;case 19:for(;i.have<i.nlen+i.ndist;){for(;m=(A=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(y<16)u>>>=v,d-=v,i.lens[i.have++]=y;else{if(16===y){for(R=v+2;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u>>>=v,d-=v,0===i.have){e.msg="invalid bit length repeat",i.mode=_L;break}b=i.lens[i.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===y){for(R=v+3;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(R=v+7;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}d-=v,b=0,p=11+(127&(u>>>=v)),u>>>=7,d-=7}if(i.have+p>i.nlen+i.ndist){e.msg="invalid bit length repeat",i.mode=_L;break}for(;p--;)i.lens[i.have++]=b}}if(i.mode===_L)break;if(0===i.lens[256]){e.msg="invalid code -- missing end-of-block",i.mode=_L;break}if(i.lenbits=9,I={bits:i.lenbits},T=hL(1,i.lens,0,i.nlen,i.lencode,0,i.work,I),i.lenbits=I.bits,T){e.msg="invalid literal/lengths set",i.mode=_L;break}if(i.distbits=6,i.distcode=i.distdyn,I={bits:i.distbits},T=hL(2,i.lens,i.nlen,i.ndist,i.distcode,0,i.work,I),i.distbits=I.bits,T){e.msg="invalid distances set",i.mode=_L;break}if(i.mode=20,6===t)break e;case 20:i.mode=21;case 21:if(s>=6&&c>=258){e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,lL(e,h),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,r=e.input,s=e.avail_in,u=i.hold,d=i.bits,i.mode===fL&&(i.back=-1);break}for(i.back=0;m=(A=i.lencode[u&(1<<i.lenbits)-1])>>>16&255,y=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(m&&0==(240&m)){for(S=v,g=m,E=y;m=(A=i.lencode[E+((u&(1<<S+g)-1)>>S)])>>>16&255,y=65535&A,!(S+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=S,d-=S,i.back+=S}if(u>>>=v,d-=v,i.back+=v,i.length=y,0===m){i.mode=26;break}if(32&m){i.back=-1,i.mode=fL;break}if(64&m){e.msg="invalid literal/length code",i.mode=_L;break}i.extra=15&m,i.mode=22;case 22:if(i.extra){for(R=i.extra;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.length+=u&(1<<i.extra)-1,u>>>=i.extra,d-=i.extra,i.back+=i.extra}i.was=i.length,i.mode=23;case 23:for(;m=(A=i.distcode[u&(1<<i.distbits)-1])>>>16&255,y=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(0==(240&m)){for(S=v,g=m,E=y;m=(A=i.distcode[E+((u&(1<<S+g)-1)>>S)])>>>16&255,y=65535&A,!(S+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}u>>>=S,d-=S,i.back+=S}if(u>>>=v,d-=v,i.back+=v,64&m){e.msg="invalid distance code",i.mode=_L;break}i.offset=y,i.extra=15&m,i.mode=24;case 24:if(i.extra){for(R=i.extra;d<R;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}i.offset+=u&(1<<i.extra)-1,u>>>=i.extra,d-=i.extra,i.back+=i.extra}if(i.offset>i.dmax){e.msg="invalid distance too far back",i.mode=_L;break}i.mode=25;case 25:if(0===c)break e;if(p=h-c,i.offset>p){if((p=i.offset-p)>i.whave&&i.sane){e.msg="invalid distance too far back",i.mode=_L;break}p>i.wnext?(p-=i.wnext,f=i.wsize-p):f=i.wnext-p,p>i.length&&(p=i.length),_=i.window}else _=n,f=a-i.offset,p=i.length;p>c&&(p=c),c-=p,i.length-=p;do{n[a++]=_[f++]}while(--p);0===i.length&&(i.mode=21);break;case 26:if(0===c)break e;n[a++]=i.length,c--,i.mode=21;break;case 27:if(i.wrap){for(;d<32;){if(0===s)break e;s--,u|=r[o++]<<d,d+=8}if(h-=c,e.total_out+=h,i.total+=h,h&&(e.adler=i.check=i.flags?dL(i.check,n,h,a-h):uL(i.check,n,h,a-h)),h=c,(i.flags?u:vL(u))!==i.check){e.msg="incorrect data check",i.mode=_L;break}u=0,d=0}i.mode=28;case 28:if(i.wrap&&i.flags){for(;d<32;){if(0===s)break e;s--,u+=r[o++]<<d,d+=8}if(u!==(4294967295&i.total)){e.msg="incorrect length check",i.mode=_L;break}u=0,d=0}i.mode=29;case 29:T=1;break e;case _L:T=-3;break e;case 31:return-4;default:return pL}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,i.hold=u,i.bits=d,(i.wsize||h!==e.avail_out&&i.mode<_L&&(i.mode<27||4!==t))&&AL(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,i.total+=h,i.wrap&&h&&(e.adler=i.check=i.flags?dL(i.check,n,h,e.next_out-h):uL(i.check,n,h,e.next_out-h)),e.data_type=i.bits+(i.last?64:0)+(i.mode===fL?128:0)+(20===i.mode||15===i.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},tL.inflateEnd=function(e){if(!e||!e.state)return pL;var t=e.state;return t.window&&(t.window=null),e.state=null,0},tL.inflateGetHeader=function(e,t){var i;return e&&e.state?0==(2&(i=e.state).wrap)?pL:(i.head=t,t.done=!1,0):pL},tL.inflateSetDictionary=function(e,t){var i,r=t.length;return e&&e.state?0!==(i=e.state).wrap&&11!==i.mode?pL:11===i.mode&&uL(1,t,r,0)!==i.check?-3:AL(e,t,r,r)?(i.mode=31,-4):(i.havedict=1,0):pL},tL.inflateInfo="pako inflate (from Nodeca project)";var CL={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};var OL=tL,wL=fM,NL=DU,PL=CL,kL=oU,DL=BU,ML=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1},UL=Object.prototype.toString;function LL(e){if(!(this instanceof LL))return new LL(e);this.options=wL.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&0==(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new DL,this.strm.avail_out=0;var i=OL.inflateInit2(this.strm,t.windowBits);if(i!==PL.Z_OK)throw new Error(kL[i]);if(this.header=new ML,OL.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=NL.string2buf(t.dictionary):"[object ArrayBuffer]"===UL.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(i=OL.inflateSetDictionary(this.strm,t.dictionary))!==PL.Z_OK))throw new Error(kL[i])}function xL(e,t){var i=new LL(t);if(i.push(e,!0),i.err)throw i.msg||kL[i.err];return i.result}LL.prototype.push=function(e,t){var i,r,n,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;r=t===~~t?t:!0===t?PL.Z_FINISH:PL.Z_NO_FLUSH,"string"==typeof e?s.input=NL.binstring2buf(e):"[object ArrayBuffer]"===UL.call(e)?s.input=new Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;do{if(0===s.avail_out&&(s.output=new wL.Buf8(c),s.next_out=0,s.avail_out=c),(i=OL.inflate(s,PL.Z_NO_FLUSH))===PL.Z_NEED_DICT&&u&&(i=OL.inflateSetDictionary(this.strm,u)),i===PL.Z_BUF_ERROR&&!0===d&&(i=PL.Z_OK,d=!1),i!==PL.Z_STREAM_END&&i!==PL.Z_OK)return this.onEnd(i),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&i!==PL.Z_STREAM_END&&(0!==s.avail_in||r!==PL.Z_FINISH&&r!==PL.Z_SYNC_FLUSH)||("string"===this.options.to?(n=NL.utf8border(s.output,s.next_out),o=s.next_out-n,a=NL.buf2string(s.output,n),s.next_out=o,s.avail_out=c-o,o&&wL.arraySet(s.output,s.output,n,o,0),this.onData(a)):this.onData(wL.shrinkBuf(s.output,s.next_out)))),0===s.avail_in&&0===s.avail_out&&(d=!0)}while((s.avail_in>0||0===s.avail_out)&&i!==PL.Z_STREAM_END);return i===PL.Z_STREAM_END&&(r=PL.Z_FINISH),r===PL.Z_FINISH?(i=OL.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===PL.Z_OK):r!==PL.Z_SYNC_FLUSH||(this.onEnd(PL.Z_OK),s.avail_out=0,!0)},LL.prototype.onData=function(e){this.chunks.push(e)},LL.prototype.onEnd=function(e){e===PL.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=wL.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},qU.Inflate=LL,qU.inflate=xL,qU.inflateRaw=function(e,t){return(t=t||{}).raw=!0,xL(e,t)},qU.ungzip=xL;var VL={};(0,fM.assign)(VL,_M,qU,CL);var FL,BL,jL,GL,HL,zL,KL,WL,XL,YL,qL,JL,QL,ZL,$L,ex,tx,ix,rx,nx,ox,ax,sx,cx,ux,dx,lx,hx,px,fx,_x,vx,mx,yx,Sx,gx,Ex,bx,Tx,Ix,Rx,Ax,Cx,Ox,wx,Nx,Px,kx=VL;!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",e.RTC_GET_CONFIG="rtc_get_config",e.RTC_RECONNECT="rtc_reconnect",e.RTC_RECONNECTED="rtc_reconnected",e.RTC_GET_ACCESS="rtc_get_access",e.RTC_PRE_ICE_STATE="rtc_pre_ice_state",e.RTC_NODE_CHANGE="rtc_node_change",e.RTC_SIGNALING_MSG_ERROR="rtc_signaling_msg_error",e.RTC_SIGNALING="rtc_signaling",e.RTC_JOIN_ROOM="rtc_join_room",e.RTC_LEAVE_ROOM="rtc_leave_room",e.RTC_BEGIN_CREATE_OFFER="rtc_begin_create_offer",e.RTC_CREATE_OFFER="rtc_create_offer",e.RTC_SET_DESCRIPTION="rtc_set_description",e.RTC_RECV_ANSWER="rtc_recv_answer",e.FIRST_REMOTE_AUDIO_RENDER="first_remote_audio_render",e.FIRST_REMOTE_VIDEO_RENDER="first_remote_video_render",e.RTC_PUBLISH_STAT="rtc_publish_stat",e.RTC_SUBSCRIBE_STAT="rtc_subscribe_stat",e.RTC_AUDIO_DEVICE="rtc_audio_device",e.RTC_MEDIA_STATISTICS="rtc_media_statistics",e.RTC_MESSAGE_STATISTICS="rtc_message_statistics",e.RTC_ERROR="rtc_error",e.RTC_INVOKE_STATUS="rtc_invoke_status",e.RTC_FIRST_FRAME="rtc_first_frame",e.RTC_MUTE_REMOTE="rtc_mute_remote",e.SDK_INIT_ENGINE="sdk_init_engine",e.JOIN_ROOM="join_room",e.P2P_CONNECTION_STATUS="p2p_connection_status",e.P2P_CONNECT_CLOSED="p2p_connect_closed",e.RTC_DEVICE_ERROR="rtc_device_error",e.RTC_VIDEO_DEVICE="rtc_video_device",e.RTC_VIDEO_CAPTURE_EVENT="rtc_video_capture_event",e.RTC_ENCODE_FIRST_FRAME="rtc_encode_first_frame",e.RTC_FIRST_FRAME_ENCODED="rtc_first_frame_encoded",e.RTC_SEND_FIRST_PACKET="rtc_send_first_packet",e.RTC_RECV_FIRST_PACKET="rtc_recv_first_packet",e.RTC_RECV_FIRST_FRAME="rtc_recv_first_frame",e.RTC_DECODE_FIRST_FRAME="rtc_decode_first_frame"}(FL||(FL={})),function(e){e.RTC="rtc"}(BL||(BL={})),function(e){e.W_5="5"}(jL||(jL={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(GL||(GL={})),function(e){e.UNKNOWN="unknown",e.DISCONNECTED="disconnected",e.LAN="lan",e.WIFI="wifi",e.W_2="2g",e.W_3="3g",e.W_4="4g",e.W_5="5g"}(HL||(HL={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(zL||(zL={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(KL||(KL={})),function(e){e.WEBSOCKET_RECONNECTING="websocket reconnecting",e.PEERCONNECTION_RECONNECTING="peerconnection reconnecting",e.DISCONNECTED="DISCONNECTED",e.LAN="LAN",e.WIFI="WIFI",e.W_2="2G",e.W_3="3G",e.W_4="4G",e.W_5="5G",e.UNKNOWN="UNKNOWN"}(WL||(WL={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(XL||(XL={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(YL||(YL={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(qL||(qL={})),function(e){e.REQUEST="request",e.RESPONSE="response",e.KCP_REQUEST="kcp request",e.KCP_RESPONSE="kcp response",e.QUIC_REQUEST="quic request",e.QUIC_RESPONSE="quic response"}(JL||(JL={})),function(e){e.NEW="NEW",e.CHECKING="CHECKING",e.CONNECTED="CONNECTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED",e.DATACHANNEL_CONNECTING="DATACHANNEL_CONNECTING",e.DATACHANNEL_OPEN="DATACHANNEL_OPEN",e.DATACHANNEL_CLOSING="DATACHANNEL_CLOSING",e.DATACHANNEL_CLOSED="DATACHANNEL_CLOSED"}(QL||(QL={})),function(e){e.SUCCEED="succeed",e.MESSAGE_ID_ERROR="message id error",e.ZIP_FAILED="zip failed",e.UNZIP_FAILED="unzip failed",e.MESSAGE_KEY_EMPTY="message key empty",e.MESSAGE_KEY_PARSE_FAILED="message key parse failed",e.MESSAGE_KEY_INVALID="message key invalid",e.ENCRYPT_FAILED="encrypt failed",e.DECRYPT_FAILED="decrypt failed",e.MESSAGE_TOO_BIG="message too big",e.INVALID_DATA="invalid data",e.MESSAGE_PARSE_FAILED="message parse failed"}(ZL||(ZL={})),function(e){e.CALL_JOINROOM="call-joinRoom",e.JOINROOM="joinRoom",e.CALL_RECONNECTED="call-reconnected",e.RECONNECTED="reconnected",e.CALL_PUBLISH="call-publish",e.PUBLISH="publish",e.CALL_UPDATESTREAMATTRIBUTES="call-updateStreamAttributes",e.UPDATESTREAMATTRIBUTES="updateStreamAttributes",e.CALL_UNPUBLISH="call-unpublish",e.UNPUBLISH="unpublish",e.CALL_SUBSCRIBE="call-subscribe",e.SUBSCRIBE="subscribe",e.CALL_UPDATESUBSCRIBE="call-updateSubscribe",e.UPDATESUBSCRIBE="updateSubscribe",e.CALL_UNSUBSCRIBE="call-unsubscribe",e.UNSUBSCRIBE="unsubscribe",e.CALL_UPDATEUSERATTRIBUTES="call-updateUserAttributes",e.UPDATEUSERATTRIBUTES="updateUserAttributes",e.CALL_LEAVEROOM="call-leaveRoom",e.LEAVEROOM="leaveRoom",e.ON_USERCONNECTION="on-userConnection",e.ON_USERDISCONNECTION="on-userDisconnection",e.ON_ONADDSTREAM="on-onAddStream",e.ON_ONPUSHSTREAM="on-onPushStream",e.ON_ONREMOVESTREAM="on-onRemoveStream",e.ON_ONPUSHTRACK="on-onPushTrack",e.ON_ONREMOVETRACK="on-onRemoveTrack",e.ON_ONUPDATEUSERATTRIBUTES="on-onUpdateUserAttributes",e.ON_ONUPDATEROOMATTRIBUTES="on-onUpdateRoomAttributes",e.ON_ONUPDATESTREAMATTRIBUTES="on-onUpdateStreamAttributes",e.ON_STREAMFAILED="on-streamFailed",e.ON_POSTPROCESSINGMESSAGE="on-postProcessingMessage",e.ON_ENGINECONTROLMESSAGE="on-engineControlMessage",e.ON_WEBSOCKETENGINECUSTOMMESSAGE="on-websocketEngineCustomMessage",e.UNKNOWN="unknown",e.CALL_UPDATEPUBLISHSTREAMCHANNEL="call-updatePublishStreamChannel",e.UPDATEPUBLISHSTREAMCHANNEL="updatePublishStreamChannel",e.CALL_UPDATESUBSCRIBESTREAMCHANNEL="call-updateSubscribeStreamChannel",e.UPDATESUBSCRIBESTREAMCHANNEL="updateSubscribeStreamChannel",e.ON_ONSTREAMCHANNELCHANGE="on-onStreamChannelChange",e.P2PDIRECT="p2pdirect",e.INTERNAL_CUSTOM="internal_custom",e.REPORT="report",e.CONNECTION_CONTROL="connection_control",e.ON_INTERNAL_CUSTOM="on_internal_custom",e.CONTROLMESSAGE="controlMessage",e.CALL_LOGIN="call-login",e.LOGIN="login",e.CALL_RECONNECTLOGIN="call-reconnectLogin",e.RECONNECTLOGIN="reconnectLogin",e.CALL_LOGOUT="call-logout",e.LOGOUT="logout",e.CALL_UPDATELOGINTOKEN="call-updateLoginToken",e.UPDATELOGINTOKEN="updateLoginToken",e.CALL_SETSERVERPARAMS="call-setServerParams",e.SETSERVERPARAMS="setServerParams",e.CALL_GETPEERONLINESTATUS="call-getPeerOnlineStatus",e.GETPEERONLINESTATUS="getPeerOnlineStatus",e.ON_ONSCENECONFIG="on-onSceneConfig",e.ON_STREAMCONTROLMESSAGE="on-streamControlMessage",e.CALL_STARTPUSHSTREAM="call-startPushStream",e.STARTPUSHSTREAM="startPushStream",e.CALL_STOPPUSHSTREAM="call-stopPushStream",e.STOPPUSHSTREAM="stopPushStream",e.CALL_STARTPULLSTREAM="call-startPullStream",e.STARTPULLSTREAM="startPullStream",e.CALL_STOPPULLSTREAM="call-stopPullStream",e.STOPPULLSTREAM="stopPullStream",e.CALL_UPDATEPULLSTREAM="call-updatePullStream",e.UPDATEPULLSTREAM="updatePullStream",e.ON_ONSTREAMPUSHEDBYOTHER="on-onStreamPushedByOther",e.CALL_UPDATETOKEN="call-updateToken",e.UPDATETOKEN="updateToken",e.ON_ONTOKENWILLEXPIRE="on-onTokenWillExpire",e.ON_ONPUSHCLIENTCONFIG="on-onPushClientConfig",e.CALL_GETCLIENTCONFIG="call-getClientConfig",e.GETCLIENTCONFIG="getClientConfig"}($L||($L={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(ex||(ex={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(tx||(tx={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(ix||(ix={})),function(e){e.W_0="0",e.W_1="1"}(rx||(rx={})),function(e){e.UP="up",e.DOWN="down"}(nx||(nx={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(ox||(ox={})),function(e){e.UP="up",e.DOWN="down"}(ax||(ax={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(sx||(sx={})),function(e){e.W_0="0",e.W_1="1"}(cx||(cx={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown"}(ux||(ux={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(dx||(dx={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.ON_STREAM_REMOVE="on stream remove",e.PUBLISH_MUTE="publish mute",e.UNKNOWN="unknown",e.ON_STREAM_REMOVE_CLIENT_UNPUBLISHED="on stream remove:client unpublished",e.ON_STREAM_REMOVE_PUBLISH_FAILED="on stream remove:publish failed",e.ON_STREAM_REMOVE_STREAM_REMOVED="on stream remove:stream removed",e.ON_STREAM_REMOVE_CLIENT_DISCONNECTED="on stream remove:client disconnected",e.ON_STREAM_REMOVE_CLIENT_REPUBLISH="on stream remove:client republish"}(lx||(lx={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(hx||(hx={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(px||(px={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(fx||(fx={})),function(e){e.LOGIN="login",e.PUBLISHER="publisher",e.UNMUTE="unmute",e.ENABLE="enable",e.PUSH="push",e.PUBLISH="publish",e.ONDEMAND="ondemand",e.SUBSCRIBE="subscribe",e.PUSH_TRACK="push_track",e.REMOTE_UNMUTE="remote_unmute",e.P2P="p2p"}(_x||(_x={})),function(e){e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave"}(vx||(vx={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(mx||(mx={})),function(e){e.BEGIN="begin",e.END="end"}(yx||(yx={})),function(e){e.BEGIN="begin",e.END="end"}(Sx||(Sx={})),function(e){e.LEAVE_ROOM="leave_room",e.ACK_FAILED="ack_failed",e.TOKEN_ERROR="token_error",e.SIGNALING_ERROR="signaling_error",e.TIMEOUT_10="timeout_10",e.TIMEOUT_60="timeout_60"}(gx||(gx={})),function(e){e.UNKNOWN="unknown",e.NEW="new",e.CHECKING="checking",e.CONNECTED="connected",e.FAILED="failed",e.SELECTED="selected",e.CLOSING="closing",e.CLOSED="closed",e.UNSELECTED="unselected"}(Ex||(Ex={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(bx||(bx={})),function(e){e.UNKNOWN="UNKNOWN",e.AUDIO_RECORD="AUDIO_RECORD",e.AUDIO_PLAYOUT="AUDIO_PLAYOUT",e.VIDEO="VIDEO",e.SHARE_AUDIO_RECORD="SHARE_AUDIO_RECORD",e.SHARE_VIDEO="SHARE_VIDEO"}(Tx||(Tx={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(Ix||(Ix={})),function(e){e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped"}(Rx||(Rx={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(Ax||(Ax={})),function(e){e.SUCCESS="success",e.CAMERA_DEVICE_NO_PERMISSION="camera_device_no_permission",e.CAMERA_DEVICE_BUSY="camera_device_busy",e.CAMERA_DEVICE_FAILURE="camera_device_failure",e.CAMERA_DEVICE_NOT_FOUND="camera_device_not_found",e.CAMERA_DEVICE_DISCONNECTED="camera_device_disconnected",e.TIMEOUT="timeout",e.ABORT="abort"}(Cx||(Cx={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(Ox||(Ox={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(wx||(wx={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(Nx||(Nx={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(Px||(Px={}));var Dx=function(){function e(e){this.monitor=e}return e.prototype.setStats=function(e){var t=this;Object.keys(e).forEach((function(i){t["_"+i]=e[i]})),this.monitor.StartUp()},Object.defineProperty(e.prototype,"event_key",{get:function(){return this._event_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_id",{get:function(){return this._device_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_app_id",{get:function(){return this._rtc_app_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"product_line",{get:function(){return this._product_line},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_version",{get:function(){return this._report_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"os",{get:function(){return this._os},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_version",{get:function(){return this._rtc_sdk_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_timestamp",{get:function(){return this._rtc_timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_git_commit",{get:function(){return this._rtc_sdk_git_commit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_id",{get:function(){return this._report_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connection_id",{get:function(){return this._connection_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sid",{get:function(){return this._rtc_sid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"engine_session_id",{get:function(){return this._engine_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_business_id",{get:function(){return this._rtc_business_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"project_key",{get:function(){return this._project_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"network_type",{get:function(){return this._network_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app_version",{get:function(){return this._app_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aid",{get:function(){return this._aid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_model",{get:function(){return this._device_model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_brand",{get:function(){return this._device_brand},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"common_extra_info",{get:function(){return this._common_extra_info},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"had_selected_p2p",{get:function(){return this._had_selected_p2p},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_env_type",{get:function(){return this._rtc_env_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"room_id",{get:function(){return this._room_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_id",{get:function(){return this._user_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_session_id",{get:function(){return this._rtc_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_agent",{get:function(){return this._user_agent},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"auto_play_policy",{get:function(){return this._auto_play_policy},enumerable:!1,configurable:!0}),e}(),Mx=function(e){function t(){var t=e.call(this)||this;return t.report_id=0,t.dataBuffer=[],t.posting=!1,t.report_common={},t.modify_ids={},t.preSucTime=0,t.errSendDelay=100,t.commonStats=new Dx(t),uD()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return Cf(t,e),t.prototype.push=function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))},t.prototype.unshift=function(e){this.dataBuffer=e.concat(this.dataBuffer)},t.prototype.send=function(e,t){var i=this;if(e||this.dataBuffer.length){var r={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},n=new XMLHttpRequest;n.timeout=1e4,n.onreadystatechange=function(){if(4===n.readyState){e||(i.posting=!1);var o=void 0;if(200===n.status||304===n.status)try{o=JSON.parse(n.responseText)}catch(e){}o&&0===o.StatusCode?e||t||i.sucSend():e?i.send(e):(i.unshift(r.data),t?i.send():i.errSend())}};var o=TV.LOG_SERVER_URL;if(n.open("POST",o,!0),e||(this.posting=!0),!uD()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",r),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!uD()&&location.search.includes("_rtc_debug_"))n.send(JSON.stringify(r));else{var a=kx.gzip(JSON.stringify(r));n.setRequestHeader("Content-Encoding","gzip"),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(a)}}},t.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},t.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},t.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,i=t.event_key,r=t.device_id,n=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.rtc_sid,p=t.engine_session_id,f=t.rtc_business_id,_=t.project_key,v=t.network_type,m=t.app_version,y=t.aid,S=t.device_model,g=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,T=t.rtc_env_type,I=t.user_agent,R=t.auto_play_policy;Object.assign(e,{event_key:i,device_id:r,rtc_app_id:n,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,rtc_sid:h,engine_session_id:p,rtc_business_id:f,project_key:_,network_type:v,app_version:m,aid:y,device_model:S,device_brand:g,common_extra_info:E,had_selected_p2p:b,rtc_env_type:T,user_agent:I,auto_play_policy:R}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id),this.commonStats.connection_id&&(this.modify_ids.connection_id=this.commonStats.connection_id)},t.prototype.rtcSdkApiCall=function(e,t,i,r){void 0===r&&(r={});var n=$f($f({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSdkCallback=function(e,t,i,r){void 0===r&&(r={});var n=$f($f({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcGetConfig=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=$f($f({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i,host:r,type:n,config_id:o,enable_cloud_proxy:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcReconnect=function(e,t,i,r,n){void 0===n&&(n={});var o=$f($f({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:i,reconnect_type:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcReconnected=function(e,t,i){void 0===i&&(i={});var r=$f($f({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcGetAccess=function(e,t,i,r,n,o,a){void 0===a&&(a={});var s=$f($f({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i,type:r,host:n,connect_session_id:o},this.modify_ids),{common_extra_info:JSON.stringify(a)});this.push(s)},t.prototype.rtcPreIceState=function(e,t,i){void 0===i&&(i={});var r=$f($f({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcNodeChange=function(e,t,i,r){void 0===r&&(r={});var n=$f($f({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSignalingMsgError=function(e,t,i,r){void 0===r&&(r={});var n=$f($f({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSignaling=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$f($f({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:i,signaling_type:r,direction:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcJoinRoom=function(e,t,i,r,n){void 0===n&&(n={});var o=$f($f({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:i,elapse:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,i,r){void 0===r&&(r={});var n=$f($f({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcBeginCreateOffer=function(e,t,i,r){void 0===r&&(r={});var n=$f($f({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcCreateOffer=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$f($f({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:i,stream_user_id:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcSetDescription=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=$f($f({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:i,direction:r,stream_id:n,stream_user_id:o,elapse:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcRecvAnswer=function(e,t,i,r,n,o,a,s){void 0===s&&(s={});var c=$f($f({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:i,message:r,direction:n,stream_id:o,stream_user_id:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.firstRemoteAudioRender=function(e,t,i){void 0===i&&(i={});var r=$f($f({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.firstRemoteVideoRender=function(e,t,i){void 0===i&&(i={});var r=$f($f({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcPublishStat=function(e,t,i,r,n){void 0===n&&(n={});var o=$f($f({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:i,message:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,i,r,n){void 0===n&&(n={});var o=$f($f({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:i,stream_user_id:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcAudioDevice=function(e,t,i,r){void 0===r&&(r={});var n=$f($f({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcMediaStatistics=function(e,t,i){void 0===i&&(i={});var r=$f($f($f($f({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcMessageStatistics=function(e,t,i,r){void 0===r&&(r={});var n=$f($f({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now(),dc_user_message:e,dc_room_message:t,media_server_ip:i},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcError=function(e,t,i){void 0===i&&(i={});var r=$f($f({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcInvokeStatus=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$f($f({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:i,stream_id:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var i=$f($f($f({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcMuteRemote=function(e,t,i){void 0===i&&(i={});var r=$f($f({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now(),mute_info:e,media_type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.sdkInitEngine=function(e,t,i){void 0===i&&(i={});var r=$f($f({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.joinRoom=function(e,t,i,r,n){void 0===n&&(n={});var o=$f($f({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:i,reason:r},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,i,r,n,o){void 0===o&&(o={});var a=$f($f({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:i,status:r,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var i=$f($f({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcDeviceError=function(e,t,i,r,n,o,a,s,c,u,d,l,h,p,f,_,v){void 0===v&&(v={});var m=$f($f({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:i,system_error_code:r,system_api:n,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:p,device_vid:f,media_mode:_},this.modify_ids),{common_extra_info:JSON.stringify(v)});this.push(m)},t.prototype.rtcVideoDevice=function(e,t,i){void 0===i&&(i={});var r=$f($f({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var i=$f($f($f({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(i)},t.prototype.rtcEncodeFirstFrame=function(e,t,i){void 0===i&&(i={});var r=$f($f($f($f({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcFirstFrameEncoded=function(e,t,i){void 0===i&&(i={});var r=$f($f($f($f({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcSendFirstPacket=function(e,t,i){void 0===i&&(i={});var r=$f($f($f($f({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcRecvFirstPacket=function(e,t,i){void 0===i&&(i={});var r=$f($f($f($f({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcRecvFirstFrame=function(e,t,i){void 0===i&&(i={});var r=$f($f($f($f({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t.prototype.rtcDecodeFirstFrame=function(e,t,i){void 0===i&&(i={});var r=$f($f($f($f({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(r)},t}(qD),Ux=new Mx,Lx=new Mx,xx=new Mx,Vx=Ux.commonStats,Fx=Lx.commonStats,Bx=xx.commonStats,jx={default:Ux,rtm:Lx,outsideRoom:xx};function Gx(e){void 0===e&&(e="default");for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return function(i,r,n){if("function"==typeof n.value){var o=n.value;n.value=function(){for(var i=[],n=0;n<arguments.length;n++)i[n]=arguments[n];var a={};t.forEach((function(e,t){a[e]=i[t]})),"joinRoom"===r&&Vx.setStats({room_id:i[1]}),jx[e].rtcSdkApiCall(r,0,JSON.stringify(yD(i)),a);var s=o.apply(this,i);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return jx[e].rtcSdkCallback(r,0,JSON.stringify(yD([t||{}]))),t})).catch((function(t){throw jx[e].rtcSdkCallback(r,t.code,JSON.stringify(t.message)),t})):(jx[e].rtcSdkCallback(r,0,JSON.stringify(yD([s||{}]))),s)}}}}function Hx(e,t,i){void 0===i&&(i=0),(e===d_.onUserMessageReceivedOutsideRoom||e===d_.onUserBinaryMessageReceivedOutsideRoom?Lx:Ux).rtcSdkCallback(e,i,JSON.stringify(t))}function zx(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=!1),(r?Lx:Ux).rtcInvokeStatus(JSON.stringify(t),i,e,"",0)}var Kx="RTC_DEVICE_ID",Wx="RTC_ACCESS_NODE",Xx="RTC_ACCESS_URLS",Yx="RTC_H264_BLACK_LIST",qx="engine_BAC",Jx="SERVER_CONFIG",Qx=function(){function e(){}return e.prototype.get=function(e){var t=localStorage.getItem(e);if(!t)return null;try{var i=JSON.parse(t);return i.ttl>0&&Date.now()-i.saveTime>i.ttl?(this.delete(e),null):i.message}catch(e){return null}},e.prototype.set=function(e,t,i){void 0===i&&(i=-1);var r={ttl:i,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(r)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),Zx=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._accessVersion="v2",t}return Cf(t,e),t.prototype.getDeviceId=function(){if(uD())return"";var e=this.get(Kx);return e||(e=jk()),this.set(Kx,e),e},t.prototype.setDeviceId=function(e){return[Vx,Fx,Bx].forEach((function(t){return t.setStats({device_id:e})})),this.set(Kx,e),e},t.prototype.getAccessNode=function(e){return this.get("".concat(Wx,"_").concat(e,"-BytePlus-").concat(this._accessVersion))},t.prototype.setAccessNode=function(e,t,i){return this.set("".concat(Wx,"_").concat(e,"-BytePlus-").concat(this._accessVersion),t,1e3*i)},t.prototype.clearAccessNode=function(e){this.delete("".concat(Wx,"_").concat(e,"-BytePlus"))},t.prototype.getAccessUrls=function(){return this.get("".concat(Xx,"-BytePlus"))},t.prototype.setAccessUrls=function(e){var t=e.map((function(e){var t=e.host,i=e.path;return"https://".concat(t).concat(i)}));return this.set("".concat(Xx,"-BytePlus"),t)},t.prototype.clearAccessUrls=function(){this.delete("".concat(Xx,"-BytePlus"))},t.prototype.getH264BlackList=function(){return this.get(Yx)},t.prototype.setH264BlackList=function(e){return this.set(Yx,e)},t.prototype.getAudioProfile=function(){return this.get(qx)},t.prototype.setAudioProfile=function(e){return this.set(qx,e)},t.prototype.getServerConfig=function(e){var t,i="".concat(e),r=this.get(Jx);return(null===(t=null==r?void 0:r.find((function(e){return e.key===i})))||void 0===t?void 0:t.config)||{}},t.prototype.setServerConfig=function(e,t){if(t){var i="".concat(e),r=this.get(Jx)||[];return(r=r.filter((function(e){return e.key!==i}))).push({key:i,config:t}),this.set(Jx,r.slice(-5))}},t}(Qx),$x=new Zx,eV="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function tV(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var iV="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",rV="rtc.rtcplus.com".split(","),nV={VERSION:"4.45.7",ICE_CONFIG_REQUEST_URLS_INTERNAL:eV.map(tV),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:iV,CONFIG_REQUEST_DOMAINS:rV,DEVICE_ID:"",OVERSEA:!1,ENABLE_FALLBACK_HANDLER:!1};function oV(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(nV.ICE_CONFIG_REQUEST_URLS=t.map(tV))):void("LOG_SERVER_URL"!==e||t!==Gf.overseas?"LOG_SERVER_URL"!==e||t!==Gf.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?"OVERSEA"!==e?"ENABLE_FALLBACK_HANDLER"!==e?("DEVICE_ID"===e&&$x.setDeviceId(t),nV[e]=t):nV.ENABLE_FALLBACK_HANDLER=t:nV.OVERSEA=t:nV.LOG_SERVER_URL=t:nV.LOG_SERVER_URL=iV:nV.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function aV(e){return"DEVICE_ID"===e?$x.getDeviceId():nV[e]}function sV(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:(null===(i=t.audio)||void 0===i?void 0:i.codec)||gV.audio.codec,bitRate:1e3*((null===(r=t.audio)||void 0===r?void 0:r.kBitRate)||gV.audio.kBitRate),sampleRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.sampleRate)||gV.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||gV.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||gV.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||gV.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||gV.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||gV.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:gV.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||gV.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||gV.video.width,height:(null===(f=t.video)||void 0===f?void 0:f.height)||gV.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||gV.layout.backgroundColor},regions:(null===(m=null===(v=t.layout)||void 0===v?void 0:v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(y=t.layout)||void 0===y?void 0:y.appData)||gV.layout.appData}}}}function cV(e,t,i){var r,n,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(r=i.video)||void 0===r?void 0:r.fps)||15,bitrate:1e3*((null===(n=i.video)||void 0===n?void 0:n.kBitRate)||40),width:(null===(o=i.video)||void 0===o?void 0:o.width)||640,height:(null===(a=i.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=i.layout)||void 0===s?void 0:s.interpolationMode)||Kf.PREV_FRAME,canvas:{bgColor:(null===(c=i.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=i.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(l=null===(d=i.layout)||void 0===d?void 0:d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:e.alpha,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var uV,dV,lV,hV,pV,fV,_V,vV,mV,yV,SV,gV={url:"",video:{codec:"H264",width:640,height:360,fps:30,gop:60,kBitRate:600,lowLatency:!0},audio:{codec:"AAC",kBitRate:64,sampleRate:48,channels:2,AACProfile:"LC"},layout:{regions:[],appData:"",backgroundColor:"#000000"}},EV={width:640,height:360,frameRate:30,maxKbps:600},bV={width:1920,height:1080,frameRate:15,maxKbps:3e3},TV=nV;!function(e){e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted"}(uV||(uV={})),function(e){e.PushLimitWarn="PushLimitWarn"}(dV||(dV={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire",e.STREAM_CONTROL_MESSAGE="streamControlMessage",e.ON_SCENE_CONFIG="onSceneConfig"}(lV||(lV={})),function(e){e.RSCP="RSCP"}(hV||(hV={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(pV||(pV={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(fV||(fV={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(_V||(_V={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(mV||(mV={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(yV||(yV={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.INIT=101]="INIT",e[e.NO_CONNECTION=102]="NO_CONNECTION",e[e.EXCEED_MAX_LENGTH=103]="EXCEED_MAX_LENGTH",e[e.EMPTY_USER=104]="EMPTY_USER",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN"}(SV||(SV={}));var IV,RV,AV=((vV={})[SV.SUCCESS]=[0,"success"],vV[SV.TIMEOUT]=[aP.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],vV[SV.BROKEN]=[aP.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],vV[SV.NO_RECEIVER]=[aP.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],vV[SV.NO_RELAYPATH]=[aP.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],vV[SV.SEND_TO_SERVER_ERROR]=[aP.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],vV[SV.SERVER_RESPONSE_ERROR]=[aP.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],vV[SV.NOT_JOIN]=[aP.USER_MESSAGE_NOT_JOIN,"not join room"],vV[SV.INIT]=[aP.USER_MESSAGE_INIT,"not init."],vV[SV.NO_CONNECTION]=[aP.USER_MESSAGE_NO_CONNECTION,"no connection."],vV[SV.EXCEED_MAX_LENGTH]=[aP.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],vV[SV.EMPTY_USER]=[aP.USER_MESSAGE_EMPTY_USER,"user id is empty."],vV[SV.NOT_LOGIN]=[aP.USER_MESSAGE_NOT_LOGIN,"not login."],vV[SV.SERVER_PARAMS_NOTSET]=[aP.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],vV[SV.UNKNOWN]=[aP.USER_MESSAGE_UNKNOWN,"unknown."],vV),CV=new XD("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(IV||(IV={})),function(e){e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM"}(RV||(RV={}));var OV=function(e){function t(t){var i=e.call(this)||this;return i._dataChannel=t,i._singlingCache=new Map,i._p2pCache=new Map,i._rttIds={},i._p2pMessageId=0,i._clearDataChannelListener=i._handleHandler(),window.__rtc_mock_signaling__=i.emit.bind(i),i}return Cf(t,e),t.prototype.destroy=function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}},t.prototype.sendSignaling=function(e,t,i){var r=this;return Ux.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",ex.UP),new Promise((function(n,o){var a=r._genHeader(i);a.id=_D();var s=a.id.join("-"),c=setTimeout((function(){r._singlingCache.delete(s),o(new lP(aP.TIME_OUT,"".concat(e," message time out")))}),6e4);r._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),n(e)},error:function(e){clearTimeout(c),o(e)}}),CV.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),r._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:RV.C2GW})},t.prototype.sendP2PMessage=function(e,t){var i=e.msg,r=function(e,t){var i={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(i[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(i[r[n]]=e[r[n]])}return i}(e,["msg"]);return t_(this,void 0,void 0,(function(){var e,n,o,a,s;return i_(this,(function(c){switch(c.label){case 0:return e=i instanceof ArrayBuffer,n=this._sendP2PMessage,o=[$f({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:mV.SEND,type:yV.P2P,err:SV.SUCCESS},r)],s={binary:e},e?[4,dD.ab2b64str(i)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=i,c.label=3;case 3:return[2,n.apply(this,[$f.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var i=this;return void 0===t&&(t={}),mD(e.msg)?this._rttIds[e.id]=e.id:e.dir===mV.SEND&&CV.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(r,n){var o=i._genHeader($f($f({needAck:!0,functionType:RV.C2C},t),{id:_D()}));if(e.dir===mV.SEND){var a=setTimeout((function(){i._p2pCache.delete(e.id),n(new lP(aP.TIME_OUT,"P2P message timeout"))}),6e4);i._p2pCache.set(e.id,{success:function(e,t){clearTimeout(a),r(t)},error:function(e){clearTimeout(a);var t=n_(AV[e.err]||[aP.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),i=t[0],r=t[1];n({code:i,message:e.msg||r})}})}i._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,i){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new lP(aP.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var r=t.version+(+t.zip<<5)+(+t.encrypt<<6),n=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=dD.str2ab(JSON.stringify([e,i])),a=cD(Uint8Array,o_([r,n],n_(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),i=0,r=t[i++],n=t[i++],o={version:15&r,zip:16==(16&r),encrypt:32==(32&r),needAck:1==(1&n),direction:(2&n)>>1,functionType:(60&n)>>2,binary:64==(64&n)};if(o.needAck||o.direction===IV.ACK){for(;i<=6;i++)if(128!=(128&t[i])){i++;break}o.id=Array.from(t.slice(2,i))}return{header:o,data:t.slice(i)}},t.prototype._feedbackSignaling=function(e,t){var i=this._genHeader({needAck:!0,direction:IV.ACK,id:e.split("-").map((function(e){return+e}))});CV.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),i,"")},t.prototype._handleMessage=function(e){var t,i;return t_(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,S,g,E,b,T,I,R,A,C,O,w,N,P,k,D,M,U,L,x;return i_(this,(function(V){switch(V.label){case 0:r=this._dispartData(e),n=r.header,o=r.data,n.zip&&((a=new kx.Inflate).push(o,!0),o=a.result),s=dD.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&Ux.rtcSignalingMsgError(-1,e.message,ZL.MESSAGE_PARSE_FAILED),[2]}switch(n.functionType){case RV.C2S:return[3,1];case RV.C2C:return[3,6];case RV.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=n.id)||void 0===t?void 0:t.join("-"))||"",n.direction!==IV.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],CV.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,dD.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=V.sent(),V.label=4;case 4:this.emit(d,$f({},c)),Ux.rtcSignaling(0,s,"on-".concat(d),"Recv",ex.DOWN),V.label=5;case 5:return[3,19];case 6:switch(Array.isArray(c)&&(c=c[1]),h=null==c?void 0:c.id,this._rttIds[h]||(null==c?void 0:c.dir)===mV.FEEDBACK||mD(null==c?void 0:c.msg)?delete this._rttIds[h]:CV.print("Signal","<<<<<< p2p response",c),c.dir){case mV.SEND:return[3,7];case mV.FEEDBACK:return[3,16]}return[3,17];case 7:return mD(null==c?void 0:c.msg)?[3,15]:(f=(p=c).binary,_=p.msg,v=p.room,m=p.to,y=p.from,S=""===v?f?lV.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:lV.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:f?lV.USER_BINARY_MESSAGE_RECEIVED:lV.USER_MESSAGE_RECEIVED,m?[3,11]:(g=this.emit,E=[lV.ON_CUSTOM_MESSAGE],L={clientId:y,binary:f},f?[4,dD.b64str2ab(_)]:[3,9]));case 8:return b=V.sent(),[3,10];case 9:b=_,V.label=10;case 10:return g.apply(this,E.concat([(L.message=b,L)])),[3,15];case 11:return T=this.emit,I=[S],R=[$f({},c)],x={},f?[4,dD.b64str2ab(_)]:[3,13];case 12:return A=V.sent(),[3,14];case 13:A=_,V.label=14;case 14:T.apply(this,I.concat([$f.apply(void 0,R.concat([(x.msg=A,x)]))])),V.label=15;case 15:return this._sendP2PMessage($f($f({},c),{dir:mV.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===SV.SUCCESS?C.success(c.id,c):C.error(c)),[3,17];case 17:return[3,19];case 18:if(n.direction===IV.ACK)O=(null===(i=n.id)||void 0===i?void 0:i.join("-"))||"",this._handleAckMessage(O,c[0]||{},s);else if(w=n_(c,2),N=w[0],P=w[1],k=void 0===P?{}:P,"RXMediaMsg"===N&&(D=k.type,M=k.data,Ux.rtcSignaling(0,s,"on-".concat(D),"Recv",ex.DOWN),"RSCP"===D))try{U=JSON.parse(M),Array.isArray(U)&&this.emit(D,U)}catch(e){}V.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){CV.print("_handleHandler","dataChannel close",t),e.emit("close",t)},i=function(t){CV.print("_handleHandler","dataChannel error",t),e.emit("close",t)},r=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",i),this._dataChannel.addEventListener("message",r),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",i),e._dataChannel.removeEventListener("message",r)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),$f({version:2,zip:!1,encrypt:!1,needAck:!0,direction:IV.SEND,functionType:RV.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,i){var r=this._singlingCache.get(e);r&&(this._singlingCache.delete(e),200===t.code?r.success(t):r.error(t),CV.print("Signal","<<<<<< [".concat(r.signalingType,"-ack]"),t)),Ux.rtcSignaling(0,i,null==r?void 0:r.signalingType,"Ack",ex.DOWN)},t}(GD.exports.EventEmitter),wV=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,i=e.method,r=e.url,n=e.body,o=void 0===n?{}:n,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,n){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(i,r,!0);try{for(var l=r_(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=n_(h.value,2),f=p[0],_=p[1];d.setRequestHeader(f,_)}}catch(e){a={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(a)throw a.error}}d.onreadystatechange=function(){4===d.readyState&&(t.isSending=!1,200===d.status?e(JSON.parse(d.responseText)):n({message:d.statusText,code:d.status})),0===d.status&&n({code:0,message:"Request abort"})},d.onerror=function(e){t.isSending=!1,n({code:-1,message:d.responseText||"unknown"})},t.timeout&&(d.timeout=t.timeout),u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,i,r){return this.ajax({method:"POST",url:e,body:t,headers:i,stringify:r})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),NV=new XD("ICE Request",3),PV=function(){function e(){this._request=new wV}return e.prototype.getAccessNode=function(e,t,i,r,n,o,a){return t_(this,void 0,void 0,(function(){var s;return i_(this,(function(c){return(s=$x.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,i,r,n,o,a),zx("es.R.node.cache",s),Array.isArray(s)?[2,Promise.resolve(s)]:[2,Promise.resolve([s])]):[2,this.getAccessNodeFromServer(e,t,i,r,n,o,a)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,i,r,n,o,a){return t_(this,void 0,void 0,(function(){var s,c,u=this;return i_(this,(function(d){return s=$x.getAccessUrls(),c=!0,zx("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=TV.ICE_CONFIG_REQUEST_URLS,c=!1,zx("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=TV.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,zx("es.R.req.internal.urls",s)),[2,this.getICEConfigFromServer(s,e,t,i,r,n,o,a).then((function(t){var i=t.nodes;return $x.setAccessNode(e,i,t.ttl||11200),t.dispatchDomains&&$x.setAccessUrls(t.dispatchDomains),i})).catch((function(s){if(c)return zx("es.R.req.fallback",""),$x.clearAccessUrls(),u.getAccessNodeFromServer(e,t,i,r,n,o,a);throw s}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,i,r,n,o,a,s){var c;return t_(this,void 0,void 0,(function(){var i,u,d,l=this;return i_(this,(function(h){return i={appID:t,userID:r,deviceID:n,connectSessionID:aD(),os:"web",sdkVersion:TV.VERSION,isOversea:TV.OVERSEA,expectedAddr:aV("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:s,accessParams:JSON.stringify({requireICEUfragV2:!0})},o&&a&&(i.feedbackInfo=[{feedbackIP:null===(c=a.publicIPs[0])||void 0===c?void 0:c.ip,feedbackReason:{type:"NODE_CHANGED",reason:o}}],delete i.expectedAddr),u=Date.now(),Ux.rtcGetAccess(0,JSON.stringify(i),0,JL.REQUEST,e.join(","),i.connectSessionID),d=e.map((function(e,t){return t_(l,void 0,void 0,(function(){var r,n,o;return i_(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._request.post(e,i)];case 1:return r=a.sent(),[3,3];case 2:throw n=a.sent(),new lP(aP.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==r.code)throw new lP(aP.ICE_SERVER_WRONG,"get ICE config failed",{server_code:r.code,message:JSON.stringify(r)});if(!(o=r.nodes[0]))throw new lP(aP.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:r.code,message:JSON.stringify(r)});return[2,{result:r,firstNode:o,index:t}]}}))}))})),[2,gD(d).then((function(t){var r=t.result;t.firstNode;var n=t.index;return Ux.rtcGetAccess(200,JSON.stringify(r),Date.now()-u,JL.RESPONSE,e[n],i.connectSessionID),r})).catch((function(t){var r,n,o=null===(r=t[0])||void 0===r?void 0:r.error;throw Ux.rtcGetAccess(+((null==o?void 0:o.code)||(null==o?void 0:o.server_code)),null===(n=t[0])||void 0===n?void 0:n.message,Date.now()-u,JL.RESPONSE,e.join(","),i.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(NV.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),kV=function(){function e(){this._request=new wV}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.45.7",deviceType:"web"};this._request.timeout=800;var i=TV.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));Ux.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),KL.REQUEST,"",!1);var r=i.map((function(i,r){return t_(e,void 0,void 0,(function(){var e;return i_(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(i,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new lP(aP.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new lP(aP.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){gD(r).then((function(t){var r=t.result,n=t.index;$x.setH264BlackList(r.web_h264_black_list),Ux.rtcGetConfig(200,JSON.stringify(r),0,i[n],KL.RESPONSE,"",!1),e(r.web_h264_black_list)})).catch((function(t){Ux.rtcGetConfig(500,t.message,0,"",KL.RESPONSE,"",!1),e($x.getH264BlackList()||[])}))}))},e.prototype.getAudioProfile=function(){var e=this,t={keys:["engine_BAC"],labelSelector:"",sdkVersion:"4.45.7",deviceType:"web"},i=TV.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));Ux.rtcGetConfig(0,JSON.stringify(t),0,i.join(","),KL.REQUEST,"",!1);var r=i.map((function(i,r){return t_(e,void 0,void 0,(function(){var e;return i_(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(i,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new lP(aP.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.engine_BAC))throw new lP(aP.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:r}]}}))}))}));return new Promise((function(e){gD(r).then((function(t){var r=t.result,n=t.index;$x.setAudioProfile(r.engine_BAC),Ux.rtcGetConfig(200,JSON.stringify(r),0,i[n],KL.RESPONSE,"",!1),e(r.engine_BAC)})).catch((function(t){Ux.rtcGetConfig(500,t.message,0,"",KL.RESPONSE,"",!1),e($x.getAudioProfile()||[])}))}))},e.prototype.getWebRtcConfig=function(e){var t=this,i=e.appId,r=e.deviceId,n={keys:["web_rtc_config"],labelSelector:"",sdkVersion:"4.45.7",deviceType:"web",appId:i,deviceId:r,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0},o=TV.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));Ux.rtcGetConfig(0,JSON.stringify(n),0,o.join(","),KL.REQUEST,"",!1);var a=o.map((function(e,i){return t_(t,void 0,void 0,(function(){var t;return i_(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this._request.post(e,n)];case 1:return t=r.sent(),[3,3];case 2:throw r.sent(),new lP(aP.ICE_SERVER_WRONG,"get config failed");case 3:return[2,{result:t,index:i}]}}))}))}));return new Promise((function(e){gD(a).then((function(t){var r=t.result,n=t.index;$x.setServerConfig(i,r),Ux.rtcGetConfig(200,JSON.stringify(r),0,o[n],KL.RESPONSE,"",!1),e(r.web_rtc_config)})).catch((function(t){Ux.rtcGetConfig(500,t.message,0,"",KL.RESPONSE,"",!1),e($x.getServerConfig(i).web_rtc_config||{})}))}))},e}();function DV(e,t){var i=1,r=e;(e.width>t.width||e.height>t.height)&&(i=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,r={width:Math.floor(e.width/i),height:Math.floor(e.height/i)});return $f($f({},r),{scaleResolutionDownBy:i})}var MV=[{sub_index:0,video_index:0,framerate:30,height:1080,maxkbps:3e3,width:1920},{sub_index:1,video_index:0,framerate:30,height:720,maxkbps:1200,width:1280},{sub_index:2,video_index:0,framerate:30,height:630,maxkbps:1100,width:1120},{sub_index:3,video_index:0,framerate:30,height:540,maxkbps:1e3,width:960},{sub_index:4,video_index:1,framerate:30,height:450,maxkbps:800,width:800},{sub_index:5,video_index:1,framerate:30,height:360,maxkbps:600,width:640},{sub_index:6,video_index:1,framerate:30,height:270,maxkbps:400,width:480},{sub_index:7,video_index:2,framerate:15,height:180,maxkbps:300,width:320},{sub_index:8,video_index:2,framerate:15,height:144,maxkbps:200,width:256},{sub_index:9,video_index:3,framerate:15,height:90,maxkbps:100,width:160}],UV=[{width:1920,height:1080,maxLayers:3,totalPixels:2073600},{width:1280,height:720,maxLayers:3,totalPixels:921600},{width:960,height:540,maxLayers:3,totalPixels:518400},{width:640,height:360,maxLayers:2,totalPixels:230400},{width:480,height:270,maxLayers:2,totalPixels:129600},{width:320,height:180,maxLayers:1,totalPixels:57600},{width:0,height:0,maxLayers:1,totalPixels:0}];var LV={width:160,height:90,frameRate:15,maxkbps:100},xV={width:480,height:270,frameRate:15,maxkbps:400};function VV(e){if(!e.length)return[];var t=e.shift(),i=t.width/t.height,r=0,n=0,o=$f($f({},t),{video_index:n,sub_index:r++});delete o.rid;for(var a=[o],s=0,c=0;c<MV.length;c++)if(MV[c].height<t.height){s=c;break}var u=e.shift();for(c=s;c<MV.length;c++){var d=MV[c];if(u&&d.height<=(null==u?void 0:u.height)){var l=d.height===(null==u?void 0:u.height),h=$f($f({},u),{video_index:++n,sub_index:r++});if(delete h.rid,a.push(h),u=e.shift(),l)continue}a.push($f($f({},d),{width:Math.floor(d.height*i),video_index:n,sub_index:r++}))}return a}var FV,BV,jV,GV,HV="chrome-stable"===lD();!function(e){e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server"}(FV||(FV={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(BV||(BV={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(jV||(jV={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(GV||(GV={}));var zV,KV=function(){function e(e){this.peer=e,this.stats=[]}return e.prototype.handleCodec=function(e){return e},e.prototype.handleInboundRtp=function(e){return e},e.prototype.handleOutboundRtp=function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e},e.prototype.handleRemoteInboundRtp=function(e){return e},e.prototype.handleRemoteOutboundRtp=function(e){return e},e.prototype.handleMediaSource=function(e){return e},e.prototype.handleCsrc=function(e){return e},e.prototype.handlePeerConnection=function(e){return e},e.prototype.handleDataChannel=function(e){return e},e.prototype.handleStream=function(e){return e},e.prototype.handleTrack=function(e){return e},e.prototype.handleTransceiver=function(e){return e},e.prototype.handleSender=function(e){return e},e.prototype.handleReceiver=function(e){return e},e.prototype.handleTransport=function(e){return e},e.prototype.handleSctpTransport=function(e){return e},e.prototype.handleCandidatePair=function(e){return e},e.prototype.handleLocalCandidate=function(e){return e},e.prototype.handleRemoteCandidate=function(e){return e},e.prototype.handleCertificate=function(e){return e},e.prototype.handleIceServer=function(e){return e},e.prototype.processStats=function(e){var t=this;e.forEach((function(e){var i;switch(e.type){case FV.candidatePair:i=t.handleCandidatePair;break;case FV.certificate:i=t.handleCertificate;break;case FV.remoteCandidate:i=t.handleRemoteCandidate;break;case FV.remoteInboundRtp:i=t.handleInboundRtp;break;case FV.remoteOutboundRtp:i=t.handleOutboundRtp;break;case FV.sctpTransport:i=t.handleSctpTransport;break;case FV.sender:i=t.handleSender;break;case FV.stream:i=t.handleStream;break;case FV.track:i=t.handleTrack;break;case FV.transceiver:i=t.handleTransceiver;break;case FV.transport:i=t.handleTransport;break;case FV.codec:i=t.handleCodec;break;case FV.csrc:i=t.handleCsrc;break;case FV.dataChannel:i=t.handleDataChannel;break;case FV.iceServer:i=t.handleIceServer;break;case FV.mediaSource:i=t.handleMediaSource;break;case FV.outboundRtp:i=t.handleOutboundRtp;break;case FV.inboundRtp:i=t.handleInboundRtp;break;case FV.peerConnection:i=t.handlePeerConnection;break;case FV.receiver:i=t.handleReceiver;break;case FV.localCandidate:i=t.handleLocalCandidate;break;default:i=function(e){return e}}i=i.bind(t),t.stats.push(i(e))}))},e.prototype.getExtraStats=function(e){return t_(this,void 0,void 0,(function(){var t=this;return i_(this,(function(i){return[2,new Promise((function(i,r){if(!HV||void 0!==window.InstallTrigger)return i(t.stats);try{t.peer.getStats((function(r){r.result().forEach((function(i){if(!WV.includes(i.type)){var r={};i.names().forEach((function(e){r[e]=i.stat(e)})),r.id=i.id,r.type=i.type,r.timestamp=i.timestamp,"ssrc"===r.type&&e&&e.id?e.id===r.googTrackId&&t.stats.push(r):t.stats.push(r)}})),i(t.stats)}))}catch(e){r(e)}}))]}))}))},e.prototype.getStats=function(e,t){return t_(this,void 0,void 0,(function(){var i;return i_(this,(function(r){switch(r.label){case 0:return r.trys.push([0,7,,8]),[4,this.peer.getStats(e)];case 1:i=r.sent(),this.processStats(i),r.label=2;case 2:return r.trys.push([2,5,,6]),t?[3,4]:[4,this.getExtraStats(e)];case 3:r.sent(),r.label=4;case 4:return[3,6];case 5:return r.sent(),[3,6];case 6:return[3,8];case 7:return r.sent(),[3,8];case 8:return[2,this.stats]}}))}))},e}(),WV=["codec","inbound-rtp","outbound-rtp","remote-inbound-rtp","remote-outbound-rtp","media-source","csrc","peer-connection","data-channel","stream","track","transceiver","sender","receiver","transport","sctp-transport","candidate-pair","local-candidate","remote-candidate","certificate","ice-server"],XV=function(e,t,i){return t_(void 0,void 0,void 0,(function(){var r;return i_(this,(function(n){switch(n.label){case 0:return r=[],e instanceof RTCPeerConnection?[4,new KV(e).getStats(t,i)]:[2,r];case 1:return[2,r=n.sent()]}}))}))},YV=function(){return t_(void 0,void 0,void 0,(function(){var e,t,i,r,n,o,a;return i_(this,(function(s){switch(s.label){case 0:if(zV)return[2,zV];e=[],s.label=1;case 1:return s.trys.push([1,5,,6]),[4,SD()];case 2:return(t=s.sent())?(null==t?void 0:t.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))||(null==t?void 0:t.includes("profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1"))||(null==t?void 0:t.includes("packetization-mode=1;profile-level-id=42e01f;level-asymmetry-allowed=1"))?(i=navigator.userAgent.toLowerCase(),r=!1,n=["heytapbrowser","mqqbrowser","miuibrowser"],[4,(new kV).getH264BlackList()]):[3,4]:[2,e];case 3:for(o=s.sent(),n.push.apply(n,o_([],n_(o),!1)),a=0;a<n.length;a++)i.includes(n[a])&&(r=!0);!r&&e.push("H264"),s.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),zV=e,[2,e];case 5:return s.sent(),[2,e];case 6:return[2]}}))}))},qV=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},JV=new XD("BasicHandler",3),QV={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!qV()||void 0},ZV=function(e){function t(t,i){var r=e.call(this)||this;return r._offerIce={},r._answerIce={},r._initSctpEvents=!1,r.monitor=t,r._peerConnection=new RTCPeerConnection(QV),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=i,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,i;JV.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){JV.print("constructor","onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ").concat(r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var e=r._peerConnection.iceConnectionState;t.rtcPreIceState(e,QL["".concat(e.toUpperCase())])},r}return Cf(t,e),t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){JV.print("destroy"),this.disconnect(),this._context=void 0},t.prototype._simulcast=function(e,t,i,r,n){var o=[],a=function(e){for(var t=0,i=e.width*e.height,r=0;r<UV.length;r++)if(i>=UV[r].totalPixels){t=r;break}if(0===t)return UV[t].maxLayers;var n=UV[t-1].totalPixels;return(n-i)/(n-UV[t].totalPixels)<.1?UV[t-1].maxLayers:UV[t].maxLayers}(t);JV.print("simulcast() ","maxLayers: %o",a),1===e.videoEncodeConfig.length?(o=function(e,t){var i=[];if(t<=1)return i;var r=1,n=1;return e.width/e.height>16/9?(r=e.width/LV.width,n=e.width/xV.width):(r=e.height/LV.height,n=e.height/xV.height),i.push({maxkbps:LV.maxkbps,scaleResolutionDownBy:r,frameRate:LV.frameRate,width:Math.floor(e.width/r),height:Math.floor(e.height/r)}),t<=2||r>2&&i.unshift({maxkbps:xV.maxkbps,scaleResolutionDownBy:n,frameRate:xV.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),i}(i,a),JV.print("simulcast() ","simulcastLayers: %o",o)):(o=e.videoEncodeConfig.slice(1).slice(1-a).map((function(e){return $f({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},DV(i,e))})),JV.print("simulcast() ","simulcastLayers2: %o",o)),o.forEach((function(e,t){var i={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};r.sendEncodings&&r.sendEncodings.unshift(i),n.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})}))},t.prototype.internalPublish=function(e,t){var i=e.stream,r=e.videoTrack,n=e.audioTrack,o=e.enableSimulcast,a=e.pubAudio,s=e.pubVideo,c={direction:"sendonly",streams:[i]},u={direction:"sendonly",streams:[i]},d=[],l=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var h=null==r?void 0:r.getTrack(),p={width:640,height:360,frameRate:30};if(h){var f=null==h?void 0:h.getSettings();p={width:Math.floor(f.width),height:Math.floor(f.height),frameRate:Math.floor(f.frameRate)}}var _=null==e?void 0:e.videoEncodeConfig[0],v=DV(p,_);e.prevScaleResolutionDownBy=v.scaleResolutionDownBy,e.videoInputConfig=p;var m={maxBitrate:1e3*_.maxKbps,scaleResolutionDownBy:v.scaleResolutionDownBy,rid:"0",maxFramerate:_.frameRate||15};u.sendEncodings=[m],d.push({width:v.width,height:v.height,framerate:_.frameRate,maxkbps:_.maxKbps,rid:"0"}),o&&(this._simulcast(e,v,p,u,d),(null==t?void 0:t.simulcastOnDemand)&&(l=VV(o_([],n_(d),!1))),JV.print("subVideoDesc","desc: %o ",l))}JV.print("publish videoTransceiverInit videoDescriptions","",u,d);var y=null==n?void 0:n.getTrack();(null==n?void 0:n.mixType)!==s_.PLAYOUT&&(null==n?void 0:n.mixedAudioTrack)&&(y=null==n?void 0:n.mixedAudioTrack),y=a&&y?y:"audio";var S=null==r?void 0:r.getTrack();return{semantics:"unified-plan",videoDescriptions:d,subVideoDescriptions:l,transceiverInit:{aTrack:y,vTrack:S=s&&S?S:"video",audioTransceiverInit:c,videoTransceiverInit:u}}},t.prototype.updateScaleResolutionDownBy=function(e){var t,i,r;return t_(this,void 0,void 0,(function(){var n,o,a,s,c,u,d;return i_(this,(function(l){return JV.print("updateScaleResolutionDownBy()"),n=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver,n&&e.pubVideo&&o?(a=null==n?void 0:n.getSettings(),s={width:Math.floor(a.width),height:Math.floor(a.height),frameRate:Math.floor(a.frameRate)},(c=DV(s,e.videoEncodeConfig[0])).scaleResolutionDownBy===e.prevScaleResolutionDownBy&&JV.print("updateScaleResolutionDownBy()","no change %o",e.prevScaleResolutionDownBy),(u=null===(i=o.sender)||void 0===i?void 0:i.getParameters())&&(d=c.scaleResolutionDownBy/e.prevScaleResolutionDownBy,u.encodings=null===(r=null==u?void 0:u.encodings)||void 0===r?void 0:r.map((function(t){var i,r;Math.max(t.scaleResolutionDownBy=(t.scaleResolutionDownBy||1)*d,1);var n=+t.rid||0;t.maxFramerate=(null===(i=e.videoEncodeConfig[n])||void 0===i?void 0:i.frameRate)||t.maxFramerate;var o=null===(r=e.videoEncodeConfig[n])||void 0===r?void 0:r.maxKbps;return"number"==typeof o&&(t.maxBitrate=1e3*o),t})),e.prevScaleResolutionDownBy=c.scaleResolutionDownBy,e.videoInputConfig=s,null==o||o.sender.setParameters(u)),[2]):(JV.print("updateScaleResolutionDownBy()","no pub"),[2])}))}))},t.prototype.getStats=function(e,t){return XV(this._peerConnection,e,t)},t.prototype.setLocalDescription=function(e,t){var i;return t_(this,void 0,void 0,(function(){var r,n,o,a=this;return i_(this,(function(s){switch(s.label){case 0:r=sD(),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:e}))];case 2:return s.sent(),this.monitor.rtcSetDescription(0,e,rx.W_1,"local"===(null==t?void 0:t.streamUserId)?nx.UP:nx.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",sD()-r,{type:"offer"}),this._initSctpEvents||(this._initSctpEvents=!0,(n=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(n.onstatechange=function(){a.monitor.rtcInvokeStatus("sctp state change TO: ".concat(n.state),0,"sctp","",0)},n.transport&&(n.transport.onstatechange=function(){var e;a.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null===(e=null==n?void 0:n.transport)||void 0===e?void 0:e.state),0,"dtls","",0)}))),[3,4];case 3:return o=s.sent(),this.monitor.rtcSetDescription(-1,o.message,rx.W_1,"local"===(null==t?void 0:t.streamUserId)?nx.UP:nx.DOWN,"","",sD()-r,{type:"offer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t){return t_(this,void 0,void 0,(function(){var i,r;return i_(this,(function(n){switch(n.label){case 0:i=sD(),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:e}))];case 2:return n.sent(),this.monitor.rtcSetDescription(0,e,rx.W_0,"local"===(null==t?void 0:t.streamUserId)?nx.UP:nx.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",sD()-i,{type:"answer"}),[3,4];case 3:return r=n.sent(),this.monitor.rtcSetDescription(-1,r.message,rx.W_1,"local"===(null==t?void 0:t.streamUserId)?nx.UP:nx.DOWN,(null==t?void 0:t.streamId)||"",(null==t?void 0:t.streamUserId)||"",sD()-i,{type:"answer"}),[3,4];case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){return[2]}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t}(GD.exports.EventEmitter),$V=ah;Wr({target:"Array",proto:!0},{fill:uR}),$V("fill");var eF={},tF={},iF={exports:{}},rF=iF.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(rF).forEach((function(e){rF[e].forEach((function(e){e.reg||(e.reg=/(.*)/),e.format||(e.format="%s")}))})),function(e){var t=function(e){return String(Number(e))===e?Number(e):e},i=function(e,i,r){var n=e.name&&e.names;e.push&&!i[e.push]?i[e.push]=[]:n&&!i[e.name]&&(i[e.name]={});var o=e.push?{}:n?i[e.name]:i;!function(e,i,r,n){if(n&&!r)i[n]=t(e[1]);else for(var o=0;o<r.length;o+=1)null!=e[o+1]&&(i[r[o]]=t(e[o+1]))}(r.match(e.reg),o,e.names,e.name),e.push&&i[e.push].push(o)},r=iF.exports,n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach((function(e){var t=e[0],n=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(r[t]||[]).length;s+=1){var c=r[t][s];if(c.reg.test(n))return i(c,a,n)}})),t.media=o,t};var o=function(e,i){var r=i.split(/=(.+)/,2);return 2===r.length?e[r[0]]=t(r[1]):1===r.length&&i.length>1&&(e[r[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var i=[],r=e.split(" ").map(t),n=0;n<r.length;n+=3)i.push({component:r[n],ip:r[n+1],port:r[n+2]});return i},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var i,r=!1;return"~"!==e[0]?i=t(e):(i=t(e.substring(1,e.length)),r=!0),{scid:i,paused:r}}))}))}}(tF);var nF=iF.exports,oF=/%[sdv%]/g,aF=function(e){var t=1,i=arguments,r=i.length;return e.replace(oF,(function(e){if(t>=r)return e;var n=i[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(n);case"%d":return Number(n);case"%v":return""}}))},sF=function(e,t,i){var r=[e+"="+(t.format instanceof Function?t.format(t.push?i:i[t.name]):t.format)];if(t.names)for(var n=0;n<t.names.length;n+=1){var o=t.names[n];t.name?r.push(i[t.name][o]):r.push(i[t.names[n]])}else r.push(i[t.name]);return aF.apply(null,r)},cF=["v","o","s","i","u","e","p","c","b","t","r","z","a"],uF=["i","c","b","a"],dF=tF,lF=function(e,t){t=t||{},null==e.version&&(e.version=0),null==e.name&&(e.name=" "),e.media.forEach((function(e){null==e.payloads&&(e.payloads="")}));var i=t.outerOrder||cF,r=t.innerOrder||uF,n=[];return i.forEach((function(t){nF[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(sF(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(sF(t,i,e))}))}))})),e.media.forEach((function(e){n.push(sF("m",nF.m[0],e)),r.forEach((function(t){nF[t].forEach((function(i){i.name in e&&null!=e[i.name]?n.push(sF(t,i,e)):i.push in e&&null!=e[i.push]&&e[i.push].forEach((function(e){n.push(sF(t,i,e))}))}))}))})),n.join("\r\n")+"\r\n"};eF.write=lF,eF.parse=dF.parse,eF.parseParams=dF.parseParams,eF.parseFmtpConfig=dF.parseFmtpConfig,eF.parsePayloads=dF.parsePayloads,eF.parseRemoteCandidates=dF.parseRemoteCandidates,eF.parseImageAttributes=dF.parseImageAttributes,eF.parseSimulcastStreamList=dF.parseSimulcastStreamList;var hF=Math.pow(2,32),pF=function(){return Math.floor(Math.random()*hF+1e3)},fF=function(e,t,i){return i||(i=pF()),[{id:i,attribute:"cname",value:"kp34Za0H+aVf862l"},{id:i,attribute:"msid",value:"".concat(e.id," ").concat(e.id,"-").concat(t)},{id:i,attribute:"mslabel",value:"".concat(e.id)},{id:i,attribute:"label",value:"".concat(e.id,"-").concat(t)}]};function _F(e){return e.direction="inactive",e.port=0,delete e.ext,delete e.ssrcs,delete e.ssrcGroups,delete e.simulcast,delete e.simulcast_03,delete e.rids,delete e.extmapAllowMixed,delete e.bundleOnly,e}var vF=function(e,t,i){var r=$f($f({},e),{invalid:[{value:"realx-exts:rscp"}],media:[t,i]});return delete r.groups,delete r.msidSemantic,eF.write(r)};function mF(e){return t_(this,void 0,void 0,(function(){var t,i,r,n,o;return i_(this,(function(a){switch(a.label){case 0:return t={},i=e.publicIPs,r=e.certFingerprint,n=e.iceParams,t.fingerprint={type:"sha-256",hash:r},t.icePwd=n.serverIcePwd,o=t,[4,SF(n.serverIceUfrag)];case 1:return o.iceUfrag=a.sent(),Vx.setStats({connection_id:t.iceUfrag}),t.candidates=function(e){if(!Array.isArray(e))return[];var t=0,i=2130706431,r=[];return e.forEach((function(e){var n={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){r.push($f($f({},n),{foundation:t++,transport:"udp",port:e,priority:i}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){r.push($f($f({},n),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:i-1e3}))}))})),r}(i),t.setup="active",t.iceOptions="renomination",[2,t]}}))}))}var yF,SF=function(e){return t_(void 0,void 0,void 0,(function(){var t,i,r,n,o,a,s;return i_(this,(function(c){switch(c.label){case 0:return t=new TextEncoder,i=t.encode("PREC"),n=Uint8Array.bind,[4,dD.b64str2ab(e)];case 1:return r=new(n.apply(Uint8Array,[void 0,c.sent()])),o=t.encode(Date.now().toString()).slice(-4),(a=new Uint8Array(2))[0]=0,a[1]=1,s=cD(Uint8Array,i,r,o,a),[4,dD.ab2b64str(s.buffer)];case 2:return[2,c.sent()]}}))}))};function gF(e){var t=e.random,i=e.serverUfrag,r=e.serverPwd,n=e.clientPwd,o=e.options,a=(new TextEncoder).encode("WPRE");t||(t=new Uint8Array(4),crypto.getRandomValues(t));var s=RD(i);s.byteLength;var c=CD(RD(n),RD(r).subarray(0,16),RD(i).subarray(0,16));c.byteLength;var u=new Uint8Array(Object.keys(o).reduce((function(e,t){var i=Number(t);return e.push(i),e.push(o[i]?1:0),e}),[]));u.byteLength;var d=cD(Uint8Array,a,t,[s.byteLength],s,[c.byteLength],c,u);return d.byteLength%3!=0&&(d=cD(Uint8Array,d,new Uint8Array(3-d.byteLength%3).fill(255))),[AD(d),AD(cD(Uint8Array,t,s.subarray(0,20)))]}!function(e){e[e.kICEConfigTypeSrtpDtlsType=0]="kICEConfigTypeSrtpDtlsType",e[e.kICEConfigTypeRenominationType=1]="kICEConfigTypeRenominationType",e[e.kICEConfigTypeTcpType=2]="kICEConfigTypeTcpType",e[e.kICEConfigTypeMultiSendType=3]="kICEConfigTypeMultiSendType",e[e.kICEConfigTypeKcpType=4]="kICEConfigTypeKcpType",e[e.kICEConfigTypeSrtpSdesType=5]="kICEConfigTypeSrtpSdesType"}(yF||(yF={}));var EF=I,bF=rc,TF=km.exports.getWeakData,IF=Dt,RF=G,AF=lc,CF=Wc,OF=xe,wF=Oi.set,NF=Oi.getterFor,PF=ba.find,kF=ba.findIndex,DF=EF([].splice),MF=0,UF=function(e){return e.frozen||(e.frozen=new LF)},LF=function(){this.entries=[]},xF=function(e,t){return PF(e.entries,(function(e){return e[0]===t}))};LF.prototype={get:function(e){var t=xF(this,e);if(t)return t[1]},has:function(e){return!!xF(this,e)},set:function(e,t){var i=xF(this,e);i?i[1]=t:this.entries.push([e,t])},delete:function(e){var t=kF(this.entries,(function(t){return t[0]===e}));return~t&&DF(this.entries,t,1),!!~t}};var VF,FF={getConstructor:function(e,t,i,r){var n=e((function(e,n){AF(e,o),wF(e,{type:t,id:MF++,frozen:void 0}),null!=n&&CF(n,e[r],{that:e,AS_ENTRIES:i})})),o=n.prototype,a=NF(t),s=function(e,t,i){var r=a(e),n=TF(IF(t),!0);return!0===n?UF(r).set(t,i):n[r.id]=i,e};return bF(o,{delete:function(e){var t=a(this);if(!RF(e))return!1;var i=TF(e);return!0===i?UF(t).delete(e):i&&OF(i,t.id)&&delete i[t.id]},has:function(e){var t=a(this);if(!RF(e))return!1;var i=TF(e);return!0===i?UF(t).has(e):i&&OF(i,t.id)}}),bF(o,i?{get:function(e){var t=a(this);if(RF(e)){var i=TF(e);return!0===i?UF(t).get(e):i?i[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),n}},BF=n,jF=I,GF=rc,HF=km.exports,zF=gy,KF=FF,WF=G,XF=Fm,YF=Oi.enforce,qF=oi,JF=!BF.ActiveXObject&&"ActiveXObject"in BF,QF=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},ZF=zF("WeakMap",QF,KF);if(qF&&JF){VF=KF.getConstructor(QF,"WeakMap",!0),HF.enable();var $F=ZF.prototype,eB=jF($F.delete),tB=jF($F.has),iB=jF($F.get),rB=jF($F.set);GF($F,{delete:function(e){if(WF(e)&&!XF(e)){var t=YF(this);return t.frozen||(t.frozen=new VF),eB(this,e)||t.frozen.delete(e)}return eB(this,e)},has:function(e){if(WF(e)&&!XF(e)){var t=YF(this);return t.frozen||(t.frozen=new VF),tB(this,e)||t.frozen.has(e)}return tB(this,e)},get:function(e){if(WF(e)&&!XF(e)){var t=YF(this);return t.frozen||(t.frozen=new VF),tB(this,e)?iB(this,e):t.frozen.get(e)}return iB(this,e)},set:function(e,t){if(WF(e)&&!XF(e)){var i=YF(this);i.frozen||(i.frozen=new VF),tB(this,e)?rB(this,e,t):i.frozen.set(e,t)}else rB(this,e,t);return this}})}var nB,oB=function(e){function t(){var t=e.call(this)||this;return t._hasVideoPermission=!1,t._hasAudioPermission=!1,t.inited=!1,t.deviceMap={audioinput:new Map,audiooutput:new Map,videoinput:new Map},t._handleDeviceChange=t._handleDeviceChange.bind(t),!uD()&&t.refreshDevices(),t}return Cf(t,e),t.prototype.refreshDevices=function(){return t_(this,void 0,void 0,(function(){var e=this;return i_(this,(function(t){switch(t.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2];case 1:return t.sent().forEach((function(t){var i;null===(i=e.deviceMap[t.kind])||void 0===i||i.set(t.deviceId,t)})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e;return t_(this,void 0,void 0,(function(){return i_(this,(function(t){return"function"==typeof(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",this._handleDeviceChange),[2]}))}))},t.prototype._handleDeviceChange=function(){return t_(this,void 0,void 0,(function(){var e,t,i=this;return i_(this,(function(r){switch(r.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=r.sent(),t=Array.from(o_(o_(o_([],n_(this.deviceMap.audioinput.values()),!1),n_(this.deviceMap.videoinput.values()),!1),n_(this.deviceMap.audiooutput.values()),!1)),e.forEach((function(e){var t=i.deviceMap[e.kind].get(e.deviceId);i.deviceMap[e.kind].set(e.deviceId,e),t||(e.kind.includes("video")?i.emit(d_.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):e.kind.includes("audio")&&i.emit(d_.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),t.forEach((function(t){e.find((function(e){return e.deviceId===t.deviceId&&e.kind===t.kind}))||(i.deviceMap[t.kind].delete(t.deviceId),t.kind.includes("video")?i.emit(d_.onVideoDeviceStateChanged,{mediaDeviceInfo:t,deviceState:"inactive"}):t.kind.includes("audio")&&i.emit(d_.onAudioDeviceStateChanged,{mediaDeviceInfo:t,deviceState:"inactive"}))})),[2]}}))}))},t.prototype.getVideoPermission=function(){return t_(this,void 0,void 0,(function(){var e=this;return i_(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new lP(aP.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasVideoPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasVideoPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasVideoPermission]}}))}))},t.prototype.getAudioPermission=function(){return t_(this,void 0,void 0,(function(){var e=this;return i_(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new lP(aP.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasAudioPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasAudioPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasAudioPermission]}}))}))},t.prototype.enumerateDevices=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.getAudioPermission()];case 1:case 2:return e.sent(),[3,3];case 3:return e.trys.push([3,5,,6]),[4,this.getVideoPermission()];case 4:case 5:return e.sent(),[3,6];case 6:return[4,this.refreshDevices()];case 7:return e.sent(),[2,Array.from(o_(o_(o_([],n_(this.deviceMap.audioinput.values()),!1),n_(this.deviceMap.videoinput.values()),!1),n_(this.deviceMap.audiooutput.values()),!1))]}}))}))},t.prototype.enumerateAudioCaptureDevices=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.audioinput.values())]}}))}))},t.prototype.enumerateVideoCaptureDevices=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.videoinput.values())]}}))}))},t.prototype.enumerateAudioPlaybackDevices=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.audiooutput.values())]}}))}))},t.prototype.getDeviceById=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return[4,this.enumerateDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},Object.defineProperty(t.prototype,"hasAudioPermission",{get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new lP(aP.NO_PERMISSION,"Cannot revoke audio permission");this.refreshDevices(),this._hasAudioPermission=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasVideoPermission",{get:function(){return this._hasVideoPermission},set:function(e){if(!e)throw new lP(aP.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(qD),aB=new oB,sB=function(){function e(){}return e.prototype.getAudioContextInstance=function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance},e}(),cB=function(){function e(e){var t=uB.getAudioContextInstance();if(e instanceof MediaStreamTrack){var i=new MediaStream;i.addTrack(e),this._audioSource=t.createMediaStreamSource(i)}else e instanceof AudioNode?this._audioSource=e:(this._audioSource=t.createMediaElementSource(e),this._audioSource.connect(t.destination));var r=t.createAnalyser();this._audioSource.connect(r),this._analyserNode=r,this._ctx=t}return e.prototype.getAudioLevel=function(){var e;"suspended"===(null===(e=this._ctx)||void 0===e?void 0:e.state)&&this._ctx.resume();var t=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(t);var i=0;return t.forEach((function(e){return i=Math.max(i,Math.abs(e-128))})),i/128*255},e.prototype.destroy=function(){this._audioSource.disconnect(),this._analyserNode.disconnect()},e}(),uB=new sB,dB=new XD("VERTC",0),lB=new WeakMap,hB=function(e){return lB.get(e)},pB=function(e){function t(t,i){var r=e.call(this)||this;return r._trackId=t,r.mediaType=i,r}return Cf(t,e),t.prototype.getId=function(){return this._trackId},t}(qD),fB=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n._initListeners(),n}return Cf(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.setTrack=function(e){this._mediaTrack=e},t.prototype.close=function(){var e;return null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()},t.prototype._initListeners=function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){Ux.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(pB),_B=function(e){function t(t,i,r){var n=e.call(this,i,r)||this;return n._mediaTrack=t,n}return Cf(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(pB),vB=function(e){function t(t,i){var r=e.call(this,t,i,"video")||this;return r.dummy=!1,r.resolution={width:0,height:0},r}return Cf(t,e),t.prototype.updateVideoCaptureConfig=function(){return t_(this,void 0,void 0,(function(){var e;return i_(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig&&this.getTrack()?(dB.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),[4,this.getTrack().applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),((e=this.getTrack().getSettings()).width&&e.width!==this.resolution.width||e.height&&e.height!==this.resolution.height)&&(this.resolution={width:e.width,height:e.height},this.emit("resolution-change",this.resolution)),[2]}}))}))},t.prototype.replaceTrack=function(e){this.setTrack(e)},t}(fB),mB=function(e){function t(t,i){var r=e.call(this,t,i,"audio")||this;return r.mixType=s_.PLAYOUT_AND_PUBLISH,r}return Cf(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new cB(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.updateAudioCaptureConfig=function(){var e;return t_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(dB.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.audioCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t}(fB),yB=function(e){function t(t,i){return e.call(this,t,i,"video")||this}return Cf(t,e),t}(_B),SB=function(e){function t(t,i){return e.call(this,t,i,"audio")||this}return Cf(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new cB(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(_B),gB=function(e){function t(t,i){return e.call(this,t,i)||this}return Cf(t,e),t}(mB),EB=function(e){function t(t,i){return e.call(this,t,i)||this}return Cf(t,e),t}(vB),bB=function(e){function t(t,i){return e.call(this,t,i)||this}return Cf(t,e),t}(vB),TB=function(e){function t(t,i){return e.call(this,t,i)||this}return Cf(t,e),t}(mB),IB=function(e){function t(t,i){return e.call(this,t,i)||this}return Cf(t,e),t}(vB),RB=function(e){function t(t,i){return e.call(this,t,i)||this}return Cf(t,e),t}(mB);function AB(e){var t;return t_(this,void 0,void 0,(function(){var i,r,n,o,a,s;return i_(this,(function(c){switch(c.label){case 0:r=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",c.label=1;case 1:return c.trys.push([1,3,,4]),dB.print("createCameraVideoTrack","constraints:",e),Ux.rtcVideoCaptureEvent({event_type:Rx.START,media_device_id:r}),n=sD(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return i=c.sent(),Ux.rtcVideoCaptureEvent({event_type:Rx.START_CAPTURE_RESULT,media_device_id:r,reason:Cx.SUCCESS,elapse:sD()-n}),aB.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),Ux.rtcVideoCaptureEvent({event_type:Rx.RUNNING_FAILED,media_device_id:r,error_code:o.code,reason:o.name+o.message}),new lP(aP.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=i.getVideoTracks()[0],lB.set(a,i),(s=new EB(a,aD())).videoCaptureConfig=e,[2,s]}}))}))}function CB(e,t){var i;return t_(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p;return i_(this,(function(f){switch(f.label){case 0:dB.print("createCameraVideoTrack","constraints:",e),n=(null===(i=null==e?void 0:e.deviceId)||void 0===i?void 0:i.exact)||"default",a=(o=t||{}).sampleRate,s=o.channel,c=o.agc,u=o.ans,d=o.aec,void 0===e.sampleRate&&(e.sampleRate=a),void 0===e.channelCount&&(e.channelCount=s),void 0===e.autoGainControl&&(e.autoGainControl=c),void 0===e.noiseSuppression&&(e.noiseSuppression=u),void 0===e.echoCancellation&&(e.echoCancellation=d),f.label=1;case 1:return f.trys.push([1,3,,4]),Ux.rtcVideoCaptureEvent({event_type:Rx.START,media_device_id:n}),l=sD(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=f.sent(),Ux.rtcVideoCaptureEvent({event_type:Rx.START_CAPTURE_RESULT,media_device_id:n,reason:Cx.SUCCESS,elapse:sD()-l}),aB.hasAudioPermission=!0,[3,4];case 3:throw h=f.sent(),Ux.rtcVideoCaptureEvent({event_type:Rx.RUNNING_FAILED,media_device_id:n,error_code:h.code,reason:h.name+h.message}),new lP(aP.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",h);case 4:return p=r.getAudioTracks()[0],lB.set(p,r),[2,new gB(p,aD())]}}))}))}function OB(e,t){return void 0===e&&(e=!1),t_(this,void 0,void 0,(function(){var i,r,n;return i_(this,(function(o){switch(o.label){case 0:dB.print("createScreenTracks","withAudio: %o, constraints: %o",e,t),o.label=1;case 1:return o.trys.push([1,3,,4]),Ux.rtcVideoCaptureEvent({event_type:Rx.START,media_device_id:"screen"}),r=sD(),[4,navigator.mediaDevices.getDisplayMedia({video:!(t&&!pD)||t,audio:e})];case 2:return i=o.sent(),Ux.rtcVideoCaptureEvent({event_type:Rx.START_CAPTURE_RESULT,media_device_id:"screen",reason:Cx.SUCCESS,elapse:sD()-r}),[3,4];case 3:throw n=o.sent(),Ux.rtcVideoCaptureEvent({event_type:Rx.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.name+n.message}),new lP(aP.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,i]}}))}))}!function(e){e[e.NONE=0]="NONE"}(nB||(nB={}));var wB,NB,PB=function(){function e(){}return e.getNalunits=function(t){if(t.length-t.position<4)return[];var i=t.position;return 1===t.getInt32(i)||0===t.getInt16(i)&&1===t.getInt8(i+2)?e.getAnnexbNals(t):e.getAvccNals(t)},e.getAnnexbNals=function(t){for(var i=[],r=e.getHeaderPositionAnnexB(t),n=r.pos,o=n;n<t.length-4;){var a=new Uint8Array(t.buffer.slice(n,n+r.headerLength));r.pos===t.position&&t.skip(r.headerLength),o=(r=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(n+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&i.push(s),t.skip(o-t.position),n=o}return i},e.getAvccNals=function(t){for(var i=[];t.position<t.length-4;){var r=t.getInt32(t.position);if(!(t.length-t.position>=r))break;var n=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+r));t.skip(r);var a={header:n,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&i.push(a)}return i},e.analyseNal=function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}},e.getHeaderPositionAnnexB=function(e){for(var t=e.position,i=0,r=e.length;3!==i&&4!==i&&t<r-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?i=4:1===e.getInt8(t+2)?i=3:t++:t++;return t===r-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?i=4:t=r:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?i=3:t=r)),{pos:t,headerLength:i}},e.getAvcc=function(e,t){var i=new Uint8Array(e.byteLength+t.byteLength+11);i[0]=1,i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=255,i[5]=225;var r=6;return i.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),r),r+=2,i.set(e,r),i[r+=e.byteLength]=1,r++,i.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),r),r+=2,i.set(t,r),i},e}(),kB=function(){function e(e){this._position=0,this._dataview=new DataView(e)}return Object.defineProperty(e.prototype,"length",{get:function(){return this.buffer.byteLength},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._dataview.buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),e.prototype.back=function(e){this.position-=e},e.prototype.getUint8=function(e){return this._dataview.getUint8(e)},e.prototype.getInt8=function(e){return this._dataview.getInt8(e)},e.prototype.getInt16=function(e){return this._dataview.getInt16(e)},e.prototype.getUint16=function(e){return this._dataview.getUint16(e)},e.prototype.getUint32=function(e){return this._dataview.getUint32(e)},e.prototype.getInt32=function(e){return this._dataview.getInt32(e)},e.prototype.skip=function(t){for(var i=Math.floor(t/4),r=t%4,n=0;n<i;n++)e.readByte(this,4);r>0&&e.readByte(this,r)},e.readByte=function(e,t,i){var r;switch(t){case 1:r=i?e.getInt8(e.position):e.getUint8(e.position);break;case 2:r=i?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(i)throw new Error("not supported for readByte 3");r=e.getUint8(e.position)<<16,r|=e.getUint8(e.position+1)<<8,r|=e.getUint8(e.position+2);break;case 4:r=i?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(i)throw new Error("not supported for readBody 8");r=e.getUint32(e.position)<<32,r|=e.getUint32(e.position+4);break;default:r=""}return e.position+=t,r},e.prototype.readUint8=function(){return e.readByte(this,1)},e.prototype.readUint16=function(){return e.readByte(this,2)},e.prototype.readUint24=function(){return e.readByte(this,3)},e.prototype.readUint32=function(){return e.readByte(this,4)},e.prototype.readUint64=function(){return e.readByte(this,8)},e.prototype.readInt8=function(){return e.readByte(this,1,!0)},e.prototype.readInt16=function(){return e.readByte(this,2,!0)},e.prototype.readInt32=function(){return e.readByte(this,4,!0)},e.prototype.writeUint32=function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])},e}();!function(e){e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass"}(wB||(wB={})),function(e){e[e.invalid=0]="invalid",e[e.cfgResolution=1]="cfgResolution",e[e.bitstreamHash=2]="bitstreamHash",e[e.screenCodec=3]="screenCodec"}(NB||(NB={}));var DB=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),MB=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]);function UB(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function LB(e,t){void 0===t&&(t=0);for(var i=0;255===e[t]&&t<e.byteLength;)t++,i+=255;return t<e.byteLength&&(i+=e[t++]),[i,t]}var xB=function(){function e(){}return e.generateSEI=function(e,t){void 0===t&&(t=!1);var i=new Uint8Array([0,0,0,1]),r=new Uint8Array([6]),n=new Uint8Array([5]),o=t?DB:MB,a=UB(e.byteLength+o.byteLength),s=function(e){for(var t=[],i=0;i<e.length;i++)e[i]<=3&&0===e[i-1]&&0===e[i-2]&&t.push(3),t.push(e[i]);return new Uint8Array(t)}(e);return new Uint8Array(o_(o_(o_(o_(o_(o_(o_([],n_(i),!1),n_(r),!1),n_(n),!1),n_(a),!1),n_(o),!1),n_(s),!1),[128],!1))},e.decodeSeiBody=function(e){var t=function(e){for(var t=[],i=0;i<e.length;i++)e[i]<=3&&0===e[i-1]&&0===e[i-2]||t.push(e[i]);return new Uint8Array(t)}(e=e.slice(0,e.length-1));if(!(t.byteLength<2)){var i=0;if(5===t[1]||100===t[1]){var r=n_(LB(t,i+=2),2),n=r[0];i=r[1];var o=wB.bypass,a=i+n;return t.byteLength>=MB.byteLength&&n>=MB.byteLength&&t.slice(i,i+MB.byteLength).toString()===MB.toString()?(i+=MB.byteLength,o=wB.external):t.byteLength>=MB.byteLength&&n>=MB.byteLength&&t.slice(i,i+DB.byteLength).toString()===DB.toString()&&(i+=DB.byteLength,o=wB.internal),{type:o,payload:t.slice(i,a)}}}},e.parseInternalSEI=function(e){var t=new Map,i=0;if(e.type===wB.internal){for(;e.payload.byteLength-i>=2;){var r=n_(LB(e.payload,i),2),n=r[0];i=r[1];var o=n_(LB(e.payload,i),2),a=o[0];if(i=o[1],t.get(n)||!(a<e.payload.byteLength-i))break;t.set(n,e.payload.slice(i,i+a))}return t}},e.makeInternalSei=function(e){var t,i,r=[];try{for(var n=r_(e),o=n.next();!o.done;o=n.next()){var a=n_(o.value,2),s=a[0],c=a[1],u=UB(s),d=UB(c.byteLength);r.push(u,d,c)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(i=n.return)&&i.call(n)}finally{if(t)throw t.error}}var l=r.reduce((function(e,t){return e+t.byteLength}),0),h=new Uint8Array(l);return r.reduce((function(e,t){return h.set(t,e),e+t.byteLength}),0),h},e}();Wr({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new XD("Stats",2);var VB,FB,BB,jB,GB,HB,zB=function(){function e(e){this._stream=e}return e.prototype.setVar=function(e,t,i){this.client=e,this.handler=t,this.monitor=i},e.prototype.delStatsEvtInterval=function(){clearTimeout(this._timer),this._timer=void 0},e.prototype.destroy=function(){this.delStatsEvtInterval()},e}(),KB=function(e){function t(t){var i=e.call(this,t)||this;return i._stream=t,i}return Cf(t,e),t.prototype.setLocalStreamStatsEvtInterval=function(e,t,i){var r,n,o=this;if(!this._timer){this.setVar(e,t,i),e.once(pV.ABNORMAL_DISCONNECTION,(function(){o.destroy()}));var a={audio:{},video:{}},s=this._stream,c=null===(r=s.audioTrack)||void 0===r?void 0:r.getTrack(),u=null===(n=s.videoTrack)||void 0===n?void 0:n.getTrack();this.getAudioStats(c,a),this.getVideoStats(u,a),this.delStatsEvtInterval();this._timer=setTimeout((function e(){return t_(o,void 0,void 0,(function(){var t,i;return i_(this,(function(r){switch(r.label){case 0:return[4,t_(o,void 0,void 0,(function(){var e,t,i,r,n,o;return i_(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getAudioStats(e,a)];case 1:return i=c.sent(),[4,this.getVideoStats(t,a)];case 2:return r=c.sent(),[2,{audioStats:i,videoStats:r,isScreen:s.isScreen}]}}))}))];case 1:return t=r.sent(),null===(i=this.client)||void 0===i||i.emit("onLocalStreamStats",t),this._timer=setTimeout(e,2e3),[2]}}))}))}),2e3)}},t.prototype.unpublish=function(){this.delStatsEvtInterval()},t.prototype.getAudioStats=function(e,t){return t_(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l;return i_(this,(function(h){switch(h.label){case 0:return i={},r={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.audioMid,s=n.isScreen,c=n.pubAttributes,u={media_type:"audio",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(d=h.sent()).length?(d.forEach((function(e){var t=e.type,n=e.packetsSent,o=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,d=e.channels,l=e.audioLevel,h=e.googRtt,p=e.mimeType,f=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,y=e.id,S=e.currentRoundTripTime,g=e.state,E=e.writable,b=e.requestsReceived,T=e.responsesReceived,I=e.requestsSent,R=e.consentRequestsSent,A=e.responsesSent,C=e.jitter,O=e.candidateType,w=e.ip,N=e.address,P=e.networkType,k=e.port,D=e.protocol,M=e.nackCount,U=e.retransmittedBytesSent,L=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType,H=e.fractionLost;"outbound-rtp"===t?(r.packetsSent=n,r.bytesSent=a,u.bytes=a,u.packetsSent=n,u.nackCount=M,u.ssrc=F,u.retransmitted_bytes_sent=U,u.retransmitted_packets_sent=L,r.retransmittedPacketsSent=L):"remote-inbound-rtp"===t?(r.packetsLost=o,u.packetsLost=o,u.jitter=1e3*C,i.rtt=1e3*c,u.rtt=i.rtt,u.round_trip_time_measurements=x,i._fractionLost=H||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=d,u.codecName=p):"media-source"===t?(u.audio_level=l?-10*Math.log10(Math.pow(l,2)):l,u.volume=255*l,u.total_audio_energy=B,u.total_samples_duration=j):"ssrc"===t&&"audio"===G?(u.audio_network_elapse=h,u.send_level=V):"candidate-pair"===t?(u.ice_available_incoming_bitrate=f,u.ice_available_outgoing_bitrate=_,u.ice_bytes_received=v,u.ice_bytes_sent=a,u.ice_nominated=+m,u.ice_pair_id=y,u.ice_pair_rtt=S,u.ice_pair_state=g,u.ice_pair_writable=E,u.recv_ping_requests=b,u.recv_ping_responses=T,u.sent_ping_requests_before_first_response=I,u.sent_ping_requests_total=I+(R||0),u.sent_ping_responses=A):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=w||N,u.local_network_type=P,u.local_port=k,u.protocol=D):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=w||N,u.remote_port=k)})),(l=t.audio).timestamp?(void 0!==r.packetsLost&&(i.audioLossRate=(r.packetsLost-l.packetsLost)/(r.packetsSent-l.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,u.fraction_lost=i.audioLossRate),i.statsInterval=r.timestamp-l.timestamp,u.stats_interval=i.statsInterval,i.sendKBitrate=(r.bytesSent-l.bytesSent||0)/i.statsInterval*8,u.bitrate=Math.round(1e3*i.sendKBitrate),u.bandwidth=Math.round(u.bitrate/1024),t.audio=r,this.monitor.rtcMediaStatistics(u,{}),i._retransmittedRate=(r.retransmittedPacketsSent-l.retransmittedPacketsSent)/(r.packetsSent-l.packetsSent),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),[2,i]):(t.audio=r,[2,i])):[2,i]}}))}))},t.prototype.getVideoStats=function(e,t){return t_(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,f,_;return i_(this,(function(v){switch(v.label){case 0:return i={},r={timestamp:Date.now(),simulcast:{}},n=this._stream,o=n.streamId,a=n.videoMid,s=n.isScreen,c=n.pubAttributes,u=n.enableSimulcast,d={media_type:"video",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localvideo?"capture_state_on":"capture_state_off"},e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 1:return(l=v.sent()).length?(h=0,l.forEach((function(e){var t=e.type,n=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,c=e.roundTripTime,l=e.mimeType,p=e.frameWidth,f=e.frameHeight,_=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,y=e.googAvailableSendBandwidth,S=e.googAvgEncodeMs,g=e.googBucketDelay,E=e.googEncodeUsagePercent,b=e.googFrameRateInput,T=e.availableIncomingBitrate,I=e.availableOutgoingBitrate,R=e.bytesReceived,A=e.nominated,C=e.id,O=e.currentRoundTripTime,w=e.state,N=e.writable,P=e.candidateType,k=e.ip,D=e.address,M=e.networkType,U=e.port,L=e.nackCount,x=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,K=e.responsesSent,W=e.ssrc,X=e.googTargetEncBitrate,Y=e.googTransmitBitrate,q=e.googRtt,J=e.retransmittedPacketsSent,Q=e.encoderImplementation,Z=e.jitter,$=e.rid,ee=e.fractionLost;"outbound-rtp"===t?(u&&($?r.simulcast[$]=e:r.simulcast[h]=e,h++),r.framesEncoded=n,r.bytesSent=a,r.framesSent=s,d.bytes=a,r.packetsSent=_,d.packetsSent=_,d.nackCount=L,d.pli_count=x,d.qp_sum=F,d.ssrc=W,d.retransmitted_packets_sent=J,r.retransmittedPacketsSent=J,d.encoder_implementation=Q):"track"===t?(i.encodedFrameWidth=p,i.encodedFrameHeight=f,d.frame_size_height=f,d.frame_size_width=p):"remote-inbound-rtp"===t?(r.packetsLost=o,i.rtt=1e3*c,d.rtt=i.rtt,d.jitter=Z,d.packetsLost=o,i._fractionLost=ee||0):"codec"===t?(i.codecType=l,d.codecName=l):"candidate-pair"===t?(d.ice_available_incoming_bitrate=T,d.ice_available_outgoing_bitrate=I,d.ice_bytes_received=R,d.ice_bytes_sent=a,d.ice_nominated=+A,d.ice_pair_id=C,d.ice_pair_rtt=O,d.ice_pair_state=w,d.ice_pair_writable=N,d.recv_ping_requests=B,d.recv_ping_responses=j,d.sent_ping_requests_before_first_response=H,d.sent_ping_requests_total=H+z,d.sent_ping_responses=K):"local-candidate"===t?(d.local_candidate_type=P,d.local_ip=k||D,d.local_network_type=M,d.local_port=U,d.protocol=V):"remote-candidate"===t?(d.remote_candidate_type=P,d.remote_ip=k||D,d.remote_port=U):"VideoBwe"===t?(d.encBitratebps=v,d.available_receive_bandwidth=m,d.available_send_bandwidth=y,d.bucket_delay=g,d.retransmitBitratebps=G,d.targetEncBitratebps=X,d.transmit_bitrate=Y,i._sendBandWidth=+y):"ssrc"===t&&(d.video_network_elapse=q,d.avg_encode_ms=S,d.encodeUsage=E,d.frame_rate_input=b,d.orignal_input_Framerate=+b)})),(p=t.video).timestamp?(i.statsInterval=r.timestamp-p.timestamp,d.stats_interval=i.statsInterval,f=Object.keys(r.simulcast),u?(d.sim_enc_width=[],d.sim_enc_height=[],d.sim_enc_bps=[],d.sim_enc_framerate=[],d.sim_rids=[],d.sim_enc_bandwidth=[],d.sim_sent_framerate=[],d.sim_fraction_lost=[],_=!1,f.sort((function(e,t){return+e-+t})).forEach((function(e){var t=r.simulcast[e],n=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,l=t.packetsSent,h=t.qualityLimitationReason,f=t.qualityLimitationDurations,v=t.qualityLimitationResolutionChanges,m=t.retransmittedPacketsSent;void 0!==h&&(d.sim_qualityLimitationReason||(d.sim_qualityLimitationReason=[],d.sim_qualityLimitationDurations=[],d.sim_qualityLimitationResolutionChanges=[]),d.sim_qualityLimitationReason.push(h),d.sim_qualityLimitationDurations.push(f),d.sim_qualityLimitationResolutionChanges.push(v));var y=p.simulcast[e];if(d.sim_enc_width.push(n||0),d.sim_enc_height.push(o||0),y){var S=(a-y.bytesSent||0)/i.statsInterval;d.sim_enc_bps.push(Math.round(8e3*S)),d.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var g=1e3*(s-y.framesEncoded)/i.statsInterval;d.sim_enc_framerate.push(Math.round(g)),d.sim_rids.push(e);var E=void 0!==c?c-y.framesSent:s-y.framesEncoded,b=1e3*E/i.statsInterval;d.sim_sent_framerate.push(Math.round(b));var T=(u-y.packetsLost)/(l-y.packetsSent);i._retransmittedRate=(m-y.retransmittedPacketsSent)/(l-y.packetsSent),T=Number.isNaN(T)?0:T,d.sim_fraction_lost.push(T),n>0&&!_&&(i.sentKBitrate=8*S,i.encoderOutputFrameRate=g,i.encodedFrameCount=E,i.sentFrameRate=b,i.videoLossRate=T,_=!0)}})),this.monitor.rtcMediaStatistics(d,{})):(i.encodedFrameCount=void 0!==r.framesSent?r.framesSent-p.framesSent:r.framesEncoded-p.framesEncoded,i.sentKBitrate=(r.bytesSent-p.bytesSent||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.sentKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.encoderOutputFrameRate=1e3*(r.framesEncoded-p.framesEncoded)/i.statsInterval,d.frame_rate_encoded=Math.round(i.encoderOutputFrameRate),i.sentFrameRate=1e3*i.encodedFrameCount/i.statsInterval,d.frame_rate_sent=Math.round(i.sentFrameRate),i.videoLossRate=(r.packetsLost-p.packetsLost)/(r.packetsSent-p.packetsSent),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,i._retransmittedRate=(r.retransmittedPacketsSent-p.retransmittedPacketsSent)/(r.packetsSent-p.packetsSent),this.monitor.rtcMediaStatistics(d,{})),t.video=r,i._fractionLost=Math.max(i._fractionLost,i.videoLossRate),[2,i]):(t.video=r,[2,i])):[2,i]}}))}))},t}(zB),WB=function(e){function t(t){var i=e.call(this,t)||this;return i._videoInWaiting=!1,i}return Cf(t,e),Object.defineProperty(t,"audioStallConfig",{set:function(e){t.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,t.audioStallRatio=null==e?void 0:e.audio_stall_ratio},enumerable:!1,configurable:!0}),t.prototype.setRemoteStreamStatsEvtInterval=function(e,i,r){var n,o;return t_(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,f,_,v,m,y=this;return i_(this,(function(S){switch(S.label){case 0:return this._timer?[2]:(this.setVar(e,i,r),e.once(pV.ABNORMAL_DISCONNECTION,(function(){y.destroy()})),this._audioStallInterval=t.audioStallInterval||100,this._audioStallRatio=t.audioStallRatio||.6,a={audio:{},video:{}},s=this._stream,c=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),u=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),this.getRemoteVideoStats(u,a),[4,this.getRemoteAudioStats(c,a)]);case 1:return S.sent(),this.delStatsEvtInterval(),d=0,l=0,p=[],f=0,_=sD(),this._setAudioStallCount=function(){if(y._audioStallInterval>0&&void 0!==a.audio.concealedSamples){var e=a.audio.concealedSamples,t=a.audio.totalSamplesReceived;_=sD();var i={isStall:!1,counted:!1,diff:0},r=.5*y._audioStallInterval;y._audioStallCount=function(){return t_(y,void 0,void 0,(function(){var n,o,a,c,u,h,v,m,y,S,g,E,b,T,I;return i_(this,(function(R){switch(R.label){case 0:return n=s.hasAudio,o=s.subAudio,n&&o?(a=null===(I=s.audioTrack)||void 0===I?void 0:I.getTrack(),c=Date.now(),[4,this.handler.getStats(a,!0)]):(i.isStall=!1,i.counted=!1,p.push({reason:"hasAudio: ".concat(n,", subAudio: ").concat(o)}),_=sD(),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]);case 1:return u=R.sent(),h=Date.now(),v=sD(),(m=v-_)<r?(p.push({diff:m,start:_,end:v,get_stats_cost:h-c,get_stats_start:c,get_stats_end:h,reason:"diff(".concat(m,") < minInterval(").concat(r,")")}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]):(y=u.length,S=u.find((function(e){return"inbound-rtp"===e.type})),S?(g=S.concealedSamples,E=S.totalSamplesReceived,T=E-t,(b=g-e)>=0&&T>=0&&b>=this._audioStallRatio*T?(p.push({concealed:b,received:T,diff:m,start:_,end:v,get_stats_cost:h-c,get_stats_start:c,get_stats_end:h,is_stall:!0}),i.isStall?(i.counted?l+=m:(l=l+i.diff+m,d++),i.counted=!0):m>=200?(l+=m,d++,i.counted=!0):(i.counted=!1,i.diff=m),i.isStall=!0):(p.push({concealed:b,received:T,diff:m,start:_,end:v,get_stats_cost:h-c,get_stats_start:c,get_stats_end:h}),i.isStall=!1,i.counted=!1),e=g,t=E,_=v,f++,[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]):(p.push({diff:m,start:_,end:v,get_stats_cost:h-c,get_stats_start:c,get_stats_end:h,reason:y?"no inbound-rtp":"no report"}),[2,{stall_count:d,stall_duration:l,stall_list:p,stats_count:f}]))}}))}))},h=function(){return t_(y,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),this._audioStallCount?[4,this._audioStallCount()]:[3,2];case 1:e.sent(),this._audioStallTimer=setTimeout(h,this._audioStallInterval),e.label=2;case 2:return[2]}}))}))},y._audioStallTimer=setTimeout(h,y._audioStallInterval)}},this._setAudioStallCount(),v=function(){return t_(y,void 0,void 0,(function(){var e,t,i,r,n,o;return i_(this,(function(c){switch(c.label){case 0:return e=null===(n=s.audioTrack)||void 0===n?void 0:n.getTrack(),t=null===(o=s.videoTrack)||void 0===o?void 0:o.getTrack(),[4,this.getRemoteAudioStats(e,a)];case 1:return i=c.sent(),d=0,l=0,p=[],f=0,[4,this.getRemoteVideoStats(t,a)];case 2:return r=c.sent(),[2,{audioStats:i,videoStats:r,isScreen:s.isScreen,userId:s.userId}]}}))}))},m=function(){return t_(y,void 0,void 0,(function(){var e,t;return i_(this,(function(i){switch(i.label){case 0:return[4,v()];case 1:return e=i.sent(),null===(t=this.client)||void 0===t||t.emit("onRemoteStreamStats",e),h&&(_=sD(),this._audioStallTimer=setTimeout(h,this._audioStallInterval)),this._timer=setTimeout(m,2e3),[2]}}))}))},this._timer=setTimeout(m,2e3),[2]}}))}))},t.prototype.delStatsEvtInterval=function(){e.prototype.delStatsEvtInterval.call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0},t.prototype.unsubscribe=function(){this.delStatsEvtInterval(),this._videoInWaiting=!1},t.prototype.getRemoteAudioStats=function(e,t){return t_(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,S;return i_(this,(function(g){switch(g.label){case 0:return i={},r={},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.audioMid,u=n.subMediaType,d=n._attributes,l={media_type:"audio",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:c,connection_status:navigator.onLine,mute_state:bD(u)?"mute_state_off":"mute_state_on",remote_user_capture_state:d.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:d.localaudio&&d.audiostream?"mute_state_off":"mute_state_on"},e&&this.handler?[4,this.handler.getStats(e)]:[2,i];case 1:return(h=g.sent()).length?(h.forEach((function(e){var t=e.type,n=e.packetsLost,o=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,h=e.totalSamplesReceived,p=e.concealedSamples,f=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,y=e.currentRoundTripTime,S=e.audioLevel,g=e.totalAudioEnergy,E=e.totalSamplesDuration,b=e.mimeType,T=e.googDecodingNormal,I=e.fecPacketsReceived,R=e.availableIncomingBitrate,A=e.availableOutgoingBitrate,C=e.bytesSent,O=e.nominated,w=e.id,N=e.writable,P=e.jitter,k=e.candidateType,D=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc,K=e.kind;"inbound-rtp"===t?(r.packetsLost=n,r.packetsReceived=o,l.packetsReceived=o,r.bytesReceived=a,l.bytes=a,void 0!==s&&(i.jitterBufferDelay=s/c*1e3,l.average_jitter_buffer_delay_ms=i.jitterBufferDelay),void 0!==h&&(r.totalSamplesReceived=h,i.concealedSamples=p,r.concealedSamples=p,r.silentConcealedSamples=f,l.concealedSamples=p,i.concealmentEvents=_,l.totalSamplesReceived=h),void 0!==I&&(l.fec_packets_received=I),l.jitter=1e3*P,l.ssrc=z):"codec"===t?(i.recordSampleRate=u,d&&(i.numChannels=d),l.codecName=b):"candidate-pair"===t?(l.ice_available_incoming_bitrate=R,l.ice_available_outgoing_bitrate=A,l.ice_bytes_received=a,l.ice_bytes_sent=C,l.ice_nominated=+O,l.ice_pair_id=w,l.ice_pair_rtt=y,l.rtt=1e3*y,l.ice_pair_state=m,l.ice_pair_writable=N,l.recv_ping_requests=F,l.recv_ping_responses=B,l.sent_ping_requests_before_first_response=j,l.sent_ping_requests_total=j+(G||0),l.sent_ping_responses=H,"succeeded"===m&&(i.rtt=1e3*y,i.total_rtt=1e3*v)):"track"===t&&"audio"===K?(l.audio_level=S?-10*Math.log10(Math.pow(S,2)):S,l.volume=255*S,l.total_audio_energy=g,l.totalAudioDuration=E):"ssrc"===t?(l.decodingNormal=T,l.recvAudioLevel=V):"local-candidate"===t?(l.local_candidate_type=k,l.local_ip=D||M,l.local_network_type=U,l.local_port=L,l.protocol=x):"remote-candidate"===t&&(l.remote_candidate_type=k,l.remote_ip=D||M,l.remote_port=L)})),(p=t.audio).timestamp?(f={},void 0!==r.concealedSamples&&(l.interval_concealed_samples=r.concealedSamples-p.concealedSamples,l.interval_samples_received=r.totalSamplesReceived-p.totalSamplesReceived,l.interval_silent_concealed_samples=r.silentConcealedSamples-p.silentConcealedSamples),this._audioStallInterval>0&&void 0!==p.concealedSamples?(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),this._audioStallCount?[4,this._audioStallCount()]:[3,3]):[3,3]):(r.timestamp=Date.now(),t.audio=r,[2,i])):[2,i];case 2:_=g.sent(),v=_.stall_count,m=_.stall_duration,y=_.stall_list,S=_.stats_count,f.stall_list=y,f.stats_count=S,l.concealedSamples===l.interval_concealed_samples&&l.totalSamplesReceived===l.interval_samples_received?(l.stall_count=0,l.stall_duration=0):(l.stall_count=v,l.stall_duration=m),i.stallCount=l.stall_count,i.stallDuration=l.stall_duration,g.label=3;case 3:return r.timestamp=Date.now(),i.audioLossRate=(r.packetsLost-p.packetsLost)/(r.packetsReceived-p.packetsReceived+(r.packetsLost-p.packetsLost)),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,l.packetsLost=Math.round(r.packetsLost-p.packetsLost),l.fraction_lost=i.audioLossRate,l.packets_lost_rate=i.audioLossRate,i.statsInterval=r.timestamp-p.timestamp,l.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-p.bytesReceived||0)/i.statsInterval*8,l.bitrate=Math.round(1e3*i.receivedKBitrate),l.bandwidth=Math.round(l.bitrate/1024),void 0!==r.concealedSamples&&(i.receivedSampleRate=1e3*l.interval_samples_received/i.statsInterval),t.audio=r,this.monitor.rtcMediaStatistics(l,{},f),[2,i]}}))}))},t.prototype.getRemoteVideoStats=function(e,t){return t_(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l,h;return i_(this,(function(p){switch(p.label){case 0:return i={},r={timestamp:Date.now()},n=this._stream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.subMediaType,u=n._attributes,d={media_type:"video",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:this._stream.videoMid,connection_status:navigator.onLine,mute_state:TD(c)?"mute_state_off":"mute_state_on",remote_user_capture_state:u.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:u.localvideo&&u.videostream?"mute_state_off":"mute_state_on"},e&&this.handler?(i.isScreen=s,[4,this.handler.getStats(e)]):[2,i];case 1:return(l=p.sent()).length?(l.forEach((function(e){var t=e.type,n=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,f=e.firCount,_=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,y=e.nominated,S=e.id,g=e.currentRoundTripTime,E=e.state,b=e.writable,T=e.candidateType,I=e.ip,R=e.address,A=e.networkType,C=e.port,O=e.nackCount,w=e.pliCount,N=e.protocol,P=e.requestsReceived,k=e.responsesReceived,D=e.requestsSent,M=e.consentRequestsSent,U=e.responsesSent,L=e.ssrc;e.kind;var x=e.jitter,V=e.framesReceived,F=e.keyFramesDecoded,B=e.totalDecodeTime,j=e.decoderImplementation,G=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(r.packetsLost=a,d.packetsLost=a,r.packetsReceived=s,d.packetsReceived=s,r.bytesReceived=c,d.bytes=c,r.framesDecoded=u,void 0!==l&&(r.jitterBufferDelay=l/h*1e3,d.average_jitter_buffer_delay_ms=r.jitterBufferDelay),d.fir_count=f,d.nackCount=O,r.nackCount=O,d.pli_count=w,d.ssrc=L,d.jitter=x,d.framesReceived=V,r.framesReceived=V,d.framesDecoded=u,d.key_frames_decoded=F,d.total_decode_time=B,d.decoder_name=j,d.last_packet_received_timestamp=G):"track"===t&&void 0!==o?(i.width=o,d.frame_size_width=o,i.height=n,d.frame_size_height=n,void 0!==V&&(d.framesReceived=V,r.framesReceived=V)):"codec"===t?d.codecName=p:"candidate-pair"===t?(d.ice_available_incoming_bitrate=_,d.ice_available_outgoing_bitrate=v,d.ice_bytes_received=c,d.ice_bytes_sent=m,d.ice_nominated=+y,d.ice_pair_id=S,d.ice_pair_rtt=g,d.rtt=1e3*g,i.rtt=d.rtt,d.ice_pair_state=E,d.ice_pair_writable=b,d.recv_ping_requests=P,d.recv_ping_responses=k,d.sent_ping_requests_before_first_response=D,d.sent_ping_requests_total=D+(M||0),d.sent_ping_responses=U):"local-candidate"===t?(d.local_candidate_type=T,d.local_ip=I||R,d.local_network_type=A,d.local_port=C,d.protocol=N):"remote-candidate"===t&&(d.remote_candidate_type=T,d.remote_ip=I||R,d.remote_port=C)})),(h=t.video).timestamp?(i.videoLossRate=(r.packetsLost-h.packetsLost)/(r.packetsReceived-h.packetsReceived+(r.packetsLost-h.packetsLost)),i._retransmittedRate=(r.nackCount-h.nackCount)/(r.packetsReceived-h.packetsReceived+(r.packetsLost-h.packetsLost)),i.videoLossRate=Number.isNaN(i.videoLossRate)?0:i.videoLossRate,d.fraction_lost=i.videoLossRate,d.packets_lost_rate=i.videoLossRate,i.statsInterval=r.timestamp-h.timestamp,d.stats_interval=i.statsInterval,i.receivedKBitrate=(r.bytesReceived-h.bytesReceived||0)/i.statsInterval*8,d.bitrate=Math.round(1e3*i.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),i.decoderOutputFrameRate=1e3*(r.framesDecoded-h.framesDecoded)/i.statsInterval,i.receivedFrameRate=1e3*(r.framesReceived-h.framesReceived)/i.statsInterval,d.frame_rate_decoded=Math.round(i.decoderOutputFrameRate),d.frame_rate_received=d.frame_rate_decoded,t.video=r,this.processStall(this._stream,d,i,s),this.monitor.rtcMediaStatistics(d,{}),[2,i]):(t.video=r,[2,i])):[2,i]}}))}))},t.prototype.processStall=function(e,t,i,r){var n=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(n+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,n=this._videoInWaiting?0:1,this._videoInWaiting=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting=!0:this._videoInWaiting=!1),e.recordedVideoFrames=[]}t.stall_count=n,r?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,i.stallCount=n,i.stallDuration=o},t.prototype.destroy=function(){e.prototype.destroy.call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1},t}(zB);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(VB||(VB={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_PUBLISH_STATE_CHANGE="on_user_publish_state_change",e.ON_USER_START_AUDIO_CAPTURE="on_user_start_audio_capture",e.ON_USER_STOP_AUDIO_CAPTURE="on_user_stop_audio_capture",e.ON_USER_START_VIDEO_CAPTURE="on_user_start_video_capture",e.ON_USER_STOP_VIDEO_CAPTURE="on_user_stop_video_capture",e.ON_SEI_MESSAGED_RECEIVED="on_sei_messaged_received",e.ON_PUBLISH_RESULT="on_publish_result",e.ON_UPDATE_TOKEN_SUCCESS="on_update_token_success",e.ON_REMOTE_STREAM_STATS="ON_REMOTE_STREAM_STATS",e.ON_LOCAL_STREAM_STATS="ON_LOCAL_STREAM_STATS",e.ON_USER_LEAVE="on_user_leave",e.ON_ROOM_ERROR="on_room_error",e.ON_NETWORK_QUALITY="on_network_quality",e.ON_SIMULCAST_SUBSCRIBE_FALLBACK="on_simulcast_subscribe_fallback",e.ON_REMOTE_VIDEO_SIZE_CHANGED="on_remote_video_size_changed",e.RECONNECT_FAILED="reconnect_failed"}(FB||(FB={})),function(e){e.TranscodeStateChanged="TranscodeStateChanged",e.TranscodeStarted="TranscodeStarted",e.TranscodeUpdated="TranscodeUpdated",e.TranscodeStoped="TranscodeStoped"}(BB||(BB={})),function(e){e[e.START=1]="START",e[e.START_SUCCESS=2]="START_SUCCESS",e[e.START_FAILED=3]="START_FAILED",e[e.UPDATE=4]="UPDATE",e[e.UPDATE_SUCCESS=5]="UPDATE_SUCCESS",e[e.UPDATE_FAILED=6]="UPDATE_FAILED",e[e.STOP=7]="STOP",e[e.STOP_SUCCESS=8]="STOP_SUCCESS",e[e.STOP_FAILED=9]="STOP_FAILED"}(jB||(jB={})),function(e){e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB"}(GB||(GB={})),function(e){e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB"}(HB||(HB={}));var XB,YB=new XD("Stream",0);!function(e){e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED"}(XB||(XB={}));var qB,JB,QB,ZB,$B=function(){function e(){this.isScreen=!1,this.seiList=[],this.videoEncodeConfig=[EV],this.subVideoDescriptions=[],this.enableSimulcast=!1,this.prevScaleResolutionDownBy=1,this.pubAudio=!1,this.pubVideo=!1,this.stream=new MediaStream,this.videoInputConfig={width:640,height:360,frameRate:30},this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new KB(this)}return Object.defineProperty(e.prototype,"hasPublished",{get:function(){return this.videoTransceiver&&this.audioTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),e.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(qV()){var i=t.createEncodedStreams(),r=i.readable,n=i.writable,o=new TransformStream({transform:function(t,i){var r=e.seiList[0];if(r){var n=xB.generateSEI(r.content),o=new Uint8Array(n.byteLength+t.data.byteLength);0===r.repeatCount&&e.seiList.splice(0,1),r.repeatCount--,o.set(new Uint8Array(t.data)),o.set(n,t.data.byteLength),t.data=o.buffer,i.enqueue(t)}else i.enqueue(t)}});r.pipeThrough(o).pipeTo(n)}}else YB.print("no sender found when trying to bind encodedTransform")},e.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else YB.print("no sender found when trying to bind encodedTransform")},e.prototype.clean=function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy(),this.prevScaleResolutionDownBy=1,this.subVideoDescriptions=[]},e.prototype.switchTrackEnableState=function(e,t){var i;"audio"===e?i=this.audioTrack:"video"===e&&(i=this.videoTrack);var r=null==i?void 0:i.getTrack();return!(!r||(null==r?void 0:r.enabled)===t)&&(r.enabled=t,!0)},e}(),ej=function(e){function t(t,i,r,n,o){void 0===o&&(o=Xf.LOW);var a=e.call(this)||this;return a.userPriority=o,a.originalStreamIndex=0,a.userId=t,a.isScreen=r,a.streamId=i,a.hasAudio=n.audiostream&&n.localaudio,a.hasVideo=n.videostream&&n.localvideo,a._attributes=n,a.subVideo=!1,a.subAudio=!1,a._sequenceId=0,a.subMediaType=nB.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=XB.INIT,a.statsReport=new WB(a),a}return Cf(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSubscribed",{get:function(){return this.streamState===XB.SUB_ED},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),i=t.readable,r=t.writable;i.pipeThrough(new TransformStream({transform:function(t,i){var r=PB.getNalunits(new kB(t.data)).find((function(e){return e.sei}));if(r){var n=xB.decodeSeiBody(r.body);n&&n.type!==wB.internal&&e.safeEmit("onSEIMessage",n.payload)}i.enqueue(t)}})).pipeTo(r)}else YB.print("no receiver found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,i=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(i)}else YB.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,i,r;if((null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)===this.streamId){var n=e.track;"video"===(null==n?void 0:n.kind)?this._setVideoTrack(n):"audio"===(null===(r=e.track)||void 0===r?void 0:r.kind)&&this._setAudioTrack(n),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){var e;YB.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset(),this.statsReport.destroy()},t.prototype.resetHasSubscribed=function(){this.streamState=XB.INIT},t.prototype.setRemoteUserPriority=function(e){this.userPriority=e},t.prototype.getStreamPriority=function(){var e=this.isScreen?20:this.hasAudio||this.hasVideo?this.attributes.videoDescriptions.length>1?10-this.subLayer.spatialLayer:9:0;return 1e4*this.userPriority+100*e},t.prototype.getSubscribeFallbackParams=function(e){if(e!==Wf.DISABLE&&this.subVideo){if(this.attributes.videoDescriptions.length-1>this.subLayer.spatialLayer)return[this.originalMediaType,HB.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer+1)];if(e===Wf.AUDIO_ONLY)return[Vf.VIDEO,HB.UNSUB]}return null},t.prototype.getSubscribeRecoverParams=function(){if(this.originalMediaType&&TD(this.originalMediaType)){if(!1===this.subVideo)return[this.originalMediaType,HB.SUB,this.subLayer];if("number"==typeof this.originalStreamIndex&&this.subLayer.spatialLayer>this.originalStreamIndex)return[this.originalMediaType,HB.SUB,this._getSubLayerBySpatialLayer(this.subLayer.spatialLayer-1)]}return null},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,i;(null===(i=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new SB(e,aD()),this.emit("ontrack",this.audioTrack))},t.prototype._setVideoTrack=function(e){var t,i;(null===(i=null===(t=this.videoTrack)||void 0===t?void 0:t.getTrack())||void 0===i?void 0:i.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new yB(e,aD()),this.emit("ontrack",this.videoTrack))},t.prototype._getSubLayerBySpatialLayer=function(e){var t=this._attributes,i=t.videoDescriptions,r=t.subVideoDescriptions,n=void 0===r?[]:r,o=i[e],a=o.width,s=o.height,c=n.find((function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}},t}(qD),tj=new XD("queue",4);!function(e){e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE"}(QB||(QB={})),function(e){e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack"}(ZB||(ZB={}));var ij,rj,nj,oj=((qB={})[ZB.publish]="unpublish",qB[ZB.unpublish]="publish",qB[ZB.subscribe]="unsubscribe",qB[ZB.unsubscribe]="subscribe",qB[ZB.pushtrack]="removetrack",qB[ZB.removetrack]="pushtrack",qB),aj=((JB={})[ZB.publish]=QB.ADD,JB[ZB.subscribe]=QB.ADD,JB[ZB.pushtrack]=QB.ADD,JB[ZB.unpublish]=QB.CLOSE,JB[ZB.unsubscribe]=QB.CLOSE,JB[ZB.removetrack]=QB.CLOSE,JB),sj=function(e){function t(){var t=e.call(this)||this;return t._queue=[],t}return Cf(t,e),Object.defineProperty(t.prototype,"queue",{get:function(){return this._queue},enumerable:!1,configurable:!0}),t.prototype.enqueue=function(e){var t=this._queue.length,i="";return this._queue=this._queue.filter((function(t){return t.streamId!==e.streamId||e.action!==oj[t.action]||(i=t.streamId,tj.print("offsetStreamId",i),!1)})),this._queue.length===t&&this._queue.push(e),1===this._queue.length&&this.emit("start"),i},t.prototype.dequeue=function(){if(!this._queue.length)return null;for(var e=aj[this._queue[0].action],t=1;t<this._queue.length;t++)if(aj[this._queue[t].action]!==e)return{sdpStrategy:e,items:this._queue.splice(0,t)};return{sdpStrategy:e,items:this._queue.splice(0,this._queue.length)}},t}(HD),cj=new XD("ChromeHandler",3),uj=qV(),dj=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="chrome",r._queueBusy=!1,r._mid=0,r._offerMlines=[],r._answerMlines=[],r._inactiveMlineIndex=[],r._msidIndexMap={},r._mlinesCache={},r._sdpQueue=new sj,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(cj.print("dequeue start"),r.dequeue())})),r}return Cf(t,e),t.prototype.connect=function(e){var t,i,r,n;return t_(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_=this;return i_(this,(function(v){switch(v.label){case 0:return cj.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},o=this,[4,mF(e)];case 1:return o._answerIce=v.sent(),[4,this._peerConnection.createOffer()];case 2:return a=v.sent(),s=eF.parse(a.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((c="renomination"===(null===(r=s.media[0])||void 0===r?void 0:r.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,u=n_(gF({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null===(n=s.media[0])||void 0===n?void 0:n.icePwd,options:(f={},f[yF.kICEConfigTypeSrtpDtlsType]=!0,f[yF.kICEConfigTypeRenominationType]=c,f)}),1),d=u[0],this._answerIce.iceUfrag=d,cj.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:c}))),l=n_(s.media,1),h=l[0],this._offerIce.fingerprint=s.fingerprint||h.fingerprint,delete s.media,this._offerSession=$f({},s),this._answerSession=$f({},s),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),p=this._mid++,this._offerMlines=[$f($f($f({},h),this._offerIce),{mid:"".concat(p)})],this._answerMlines=[$f($f($f({},h),this._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(p)})],this.setDescription(),[4,new Promise((function(e,t){_._dataChannel.onopen=function(){cj.print("connect","dataChannel open"),zx("es.dc.open",""),e("")},_._dataChannel.onerror=function(e){Ux.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,ZL.INVALID_DATA),zx("es.dc.error",""),t(e)},_._dataChannel.onclose=function(e){zx("es.dc.close",""),t(e)},_._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==_._peerConnection.iceConnectionState&&"closed"!==_._peerConnection.iceConnectionState&&"failed"!==_._peerConnection.connectionState||t(e)}))}))];case 3:return v.sent(),cj.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){e.prototype.destroy.call(this),this._mlinesCache={}},t.prototype.publish=function(t,i){return t_(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,S,g,E;return i_(this,(function(b){return r=t.stream,n=t.enableSimulcast,o=e.prototype.internalPublish.call(this,t,i),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,u="".concat(this._mid++),d="".concat(this._mid++),l=$f($f($f({},this._aSendonlyOfferTpl),this._offerIce),{mid:u,msid:"".concat(r.id," ").concat(r.id,"-audio"),ssrcs:fF(r,"audio")}),h=$f($f($f({},this._vSendonlyOfferTpl),this._offerIce),{mid:d,msid:"".concat(r.id," ").concat(r.id,"-video")}),n?(cj.print("subVideoDesc","desc: %o ",s),delete h.ssrcGroups,delete h.ssrcs,p=[],h.rids=a.map((function(e){var t=e.rid;return p.unshift(t),{id:t,direction:"send"}})),h.simulcast={dir1:"send",list1:p.join(";")}):(f=function(e,t){var i=pF(),r=pF();return{ssrcs:[i,r].reduce((function(i,r){return i.concat(fF(e,t,r))}),[]),ssrcGroups:[{semantics:"FID",ssrcs:"".concat(i," ").concat(r)}]}}(r,"video"),_=f.ssrcs,v=f.ssrcGroups,h.ssrcs=_,h.ssrcGroups=v),pD&&fD&&Array.isArray(h.ext)&&(h.ext=h.ext.filter((function(e){var t;return!(null===(t=null==e?void 0:e.uri)||void 0===t?void 0:t.includes("video-orientation"))}))),(null==i?void 0:i.audioRed)&&Array.isArray(l.rtp)&&-1!==(m=l.rtp.findIndex((function(e){return"red"===e.codec})))&&(y=n_(l.rtp.splice(m,1),1),S=y[0],l.rtp.unshift(S)),(g=null==l?void 0:l.rtp.find((function(e){return"opus"===e.codec})))&&l.fmtp&&(E=l.fmtp.find((function(e){return e.payload===g.payload})))&&this._context&&(E.config+=this._context.audioProfileManager.getOpusConfigStr()),this._mlinesCache[t.stream.id]=[l,h],[2,{partialSdp:vF(this._offerSession,l,h),audioMid:u,videoMid:d,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}))}))},t.prototype.subscribe=function(e,t){return t_(this,void 0,void 0,(function(){var i,r,n,o,a,s,c,u,d,l;return i_(this,(function(h){switch(h.label){case 0:return cj.print("subscribe","mids: ",t),i="incroffer",r="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl?[3,3]:[4,SD(!0)];case 1:if(!(n=h.sent()))throw new lP(aP.NOT_SUPPORTED,"Get offer Error");return[4,this.createAVMlineOfferTpl(n)];case 2:h.sent(),h.label=3;case 3:return this._mlinesCache[e.streamId]?(o=n_(this._mlinesCache[e.streamId],2),a=o[0],s=o[1],[2,{partialSdp:vF(this._offerSession,a,s),audioMid:a.mid,videoMid:s.mid,type:i,semantics:r}]):(c="".concat(this._mid++),u="".concat(this._mid++),d=$f($f($f({},this._aRecvonlyOfferTpl),this._offerIce),{mid:c}),l=$f($f($f({},this._vRecvonlyOfferTpl),this._offerIce),{mid:u}),this._mlinesCache[e.streamId]=[d,l],[2,{partialSdp:vF(this._offerSession,d,l),audioMid:c,videoMid:u,type:i,semantics:r,transceiverInit:{aTrack:"audio",vTrack:"video",audioTransceiverInit:{direction:"recvonly"},videoTransceiverInit:{direction:"recvonly"}}}])}}))}))},t.prototype.handleAck=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){return cj.print("handleAck()","item: %o",e),[2,this._sdpQueue.enqueue(e)]}))}))},t.prototype.dequeue=function(){return t_(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s=this;return i_(this,(function(c){switch(c.label){case 0:return this._queueBusy=!0,e=this._sdpQueue.dequeue(),cj.print("dequeue()","ret: %o",e),e?(t=e.items,i=e.sdpStrategy,r=[],n=[],i===QB.ADD?(delete(o=$f({},this._answerIce)).candidates,t.forEach((function(e){return t_(s,void 0,void 0,(function(){var t,i,a,s,c,u,d,l,h,p,f,_,v,m,y,S,g,E,b,T;return i_(this,(function(I){switch(I.label){case 0:return t=e.action,i=e.transceiverInit,a=e.signalingAck,s=e.stream,(c=s instanceof ej)&&(null==a?void 0:a.sequenceId)<s.sequenceId?[2]:(u={},d={},l=eF.parse(a.sdp),Array.isArray(l.media)&&(h="",l.media.sort((function(e,t){var i;return null===(i=null==e?void 0:e.type)||void 0===i?void 0:i.localeCompare(null==t?void 0:t.type)})).forEach((function(e){"audio"===(e=$f($f({},e),o)).type?(u=e,cj.print("audioMsid",e.msid),e.msid&&(h=e.msid.replace("audio","video"))):(d=e,cj.print("videoMsid",h),h&&(d.msid=h,h=""))}))),p=s.streamId,t===ZB.publish&&(p=null===(b=s.stream)||void 0===b?void 0:b.id),f=n_(this._mlinesCache[p],2),_=f[0],v=f[1],i?(s.audioTransceiver=this._peerConnection.addTransceiver(i.aTrack,i.audioTransceiverInit),s.videoTransceiver=this._peerConnection.addTransceiver(i.vTrack,i.videoTransceiverInit),(m=this._inactiveMlineIndex.shift())||(m=this._offerMlines.length),this._offerMlines[m]=$f($f({},_),{mid:u.mid}),this._answerMlines[m]=u,(y=this._inactiveMlineIndex.shift())||(y=this._offerMlines.length),this._offerMlines[y]=$f($f({},v),{mid:d.mid}),this._answerMlines[y]=d,this._msidIndexMap[s.streamId]=[m,y],uj&&(s.initAudioEncodedTransform(),s.initVideoEncodedTransform()),r.push(s.streamId||""),n.push(c?s.userId:"local"),[3,5]):[3,1]);case 1:return c?(S=n_(this._msidIndexMap[s.streamId]||[],2),g=S[0],E=S[1],g&&E?(null===(T=this._offerMlines[g])||void 0===T?void 0:T.mid)===u.mid?[3,3]:(this._offerMlines[g]=_F(this._offerMlines[g]),this._offerMlines[E]=_F(this._offerMlines[E]),this._answerMlines[g]=_F(this._answerMlines[g]),this._answerMlines[E]=_F(this._answerMlines[E]),[4,this.setDescription()]):[3,4]):[3,5];case 2:I.sent(),this._offerMlines[g]=$f($f({},this._aRecvonlyOfferTpl),{mid:u.mid}),this._offerMlines[E]=$f($f({},this._vRecvonlyOfferTpl),{mid:d.mid}),cj.print("enqueue","hack: %o",s.streamId),I.label=3;case 3:return this._answerMlines[g]=u,this._answerMlines[E]=d,[3,5];case 4:cj.print("dequeue","pushtrack before subscribe: %o",s.userId),I.label=5;case 5:return c&&(s.sequenceId=null==a?void 0:a.sequenceId),[2]}}))}))}))):(a={},t.forEach((function(e){var t,i=e.audioMid,r=e.videoMid;a[i]=i,a[r]=r,delete s._msidIndexMap[null===(t=e.stream)||void 0===t?void 0:t.streamId]})),this._offerMlines=this._offerMlines.map((function(e,t){return a[e.mid]&&(e=_F(e),s._inactiveMlineIndex.push(t)),e})),this._inactiveMlineIndex.sort((function(e,t){return e-t})),this._answerMlines=this._answerMlines.map((function(e){return a[e.mid]&&(e=_F(e)),e}))),[4,this.setDescription(r.length?{streamId:r.join(","),streamUserId:n.join(",")}:void 0)]):(this._queueBusy=!1,[2]);case 1:return c.sent(),cj.print("dequeue","loop"),this.dequeue(),[2]}}))}))},t.prototype.setDescription=function(e){return t_(this,void 0,void 0,(function(){var t,i;return i_(this,(function(r){switch(r.label){case 0:return cj.print("setDescription","_offerMlines: %o, _answerMlines: %o",this._offerMlines,this._answerMlines),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,t=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&t.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=t.join(" "),this._answerSession.groups[0].mids=t.join(" ")),i=sD(),e&&Ux.rtcBeginCreateOffer("local"===e.streamUserId?tx.UP:tx.DOWN,e.streamId,e.streamUserId),[4,this._peerConnection.createOffer()];case 1:return r.sent(),e&&Ux.rtcCreateOffer(0,"local"===e.streamUserId?ix.UP:ix.DOWN,e.streamId,e.streamUserId,sD()-i),[4,this.setLocalDescription(eF.write(this._offerSession),e)];case 2:return r.sent(),[4,this.setRemoteDescription(eF.write(this._answerSession),e)];case 3:return r.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return t_(this,void 0,void 0,(function(){var e,t,i;return i_(this,(function(r){switch(r.label){case 0:return[4,SD(!0)];case 1:if(!(e=r.sent()))throw new lP(aP.NOT_SUPPORTED,"Get offer Error");return this.createAVMlineOfferTpl(e),t=eF.parse(e),i=[],t.media=t.media.filter((function(e){return"recvonly"===e.direction&&(i.push(e.mid+""),!0)})),t.groups=[{mids:i.join(" "),type:"BUNDLE"}],[2,{sdp:eF.write(t),semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.rollback=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){return delete this._mlinesCache[e],[2]}))}))},t.prototype.createAVMlineOfferTpl=function(e){var t=this;eF.parse(e).media.forEach((function(e){"audio"===e.type?"sendonly"===e.direction?t._aSendonlyOfferTpl=e:t._aRecvonlyOfferTpl=e:"video"===e.type&&("sendonly"===e.direction?t._vSendonlyOfferTpl=e:t._vRecvonlyOfferTpl=e)}))},t}(ZV),lj=new XD("FirefoxHandler",3),hj=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="firefox",r}return Cf(t,e),t.prototype.connect=function(e){var t,i,r,n;return t_(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_=this;return i_(this,(function(v){switch(v.label){case 0:return lj.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},o=this,[4,mF(e)];case 1:return o._answerIce=v.sent(),[4,this._peerConnection.createOffer()];case 2:return a=v.sent(),s=eF.parse(a.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((c="renomination"===(null===(r=s.media[0])||void 0===r?void 0:r.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,u=n_(gF({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null===(n=s.media[0])||void 0===n?void 0:n.icePwd,options:(f={},f[yF.kICEConfigTypeSrtpDtlsType]=!0,f[yF.kICEConfigTypeRenominationType]=c,f)}),1),d=u[0],this._answerIce.iceUfrag=d,lj.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:c}))),l=n_(s.media,1),h=l[0],this._offerIce.fingerprint=s.fingerprint||h.fingerprint,s.media=s.media.map((function(e){return $f($f({},e),_._offerIce)})),(p=$f({},s)).fingerprint=this._answerIce.fingerprint,p.media=p.media.map((function(e){return $f($f($f({},e),_._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),[4,this.setLocalDescription(eF.write(s))];case 3:return v.sent(),[4,this.setRemoteDescription(eF.write(p))];case 4:return v.sent(),[4,new Promise((function(e,t){_._dataChannel.onopen=function(){lj.print("connect","dataChannel open"),zx("es.dc.open",""),e("")},_._dataChannel.onerror=function(e){Ux.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,ZL.INVALID_DATA),zx("es.dc.error",""),t(e)},_._dataChannel.onclose=function(e){zx("es.dc.close",""),t(e)},_._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==_._peerConnection.iceConnectionState&&"closed"!==_._peerConnection.iceConnectionState&&"failed"!==_._peerConnection.connectionState||t(e)}))}))];case 5:return v.sent(),lj.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,i){var r,n;return t_(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v=this;return i_(this,(function(m){switch(m.label){case 0:return o=e.prototype.internalPublish.call(this,t,i),a=o.videoDescriptions,s=o.subVideoDescriptions,c=o.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(c.aTrack,c.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(c.vTrack,c.videoTransceiverInit),u=sD(),Ux.rtcBeginCreateOffer(tx.UP,"",""),[4,this._peerConnection.createOffer()];case 1:return d=m.sent(),Ux.rtcCreateOffer(0,ix.UP,"","",sD()-u),(l=eF.parse(d.sdp)).media=null===(r=l.media)||void 0===r?void 0:r.map((function(e){return $f($f({},e),v._offerIce)})),[4,this.setLocalDescription(eF.write(l))];case 2:return m.sent(),h=t.audioTransceiver.mid,p=t.videoTransceiver.mid,f=null,_=null,l.media=null===(n=l.media)||void 0===n?void 0:n.map((function(e){if("".concat(e.mid)===h){var t=null==(f=e)?void 0:f.rtp.find((function(e){return"opus"===e.codec}));if(t&&f.fmtp){var i=f.fmtp.find((function(e){return e.payload===t.payload}));i&&v._context&&(i.config+=v._context.audioProfileManager.getOpusConfigStr())}}else"".concat(e.mid)===p&&(_=e);return e})),[4,this.setLocalDescription(eF.write(l))];case 3:return m.sent(),[2,{partialSdp:vF(l,f,_),audioMid:h,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:s,transceiverInit:c}]}}))}))},t.prototype.subscribe=function(e){var t,i;return t_(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d=this;return i_(this,(function(l){switch(l.label){case 0:return lj.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),r=sD(),Ux.rtcBeginCreateOffer(tx.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:return n=l.sent(),Ux.rtcCreateOffer(0,ix.UP,e.streamId,e.userId,sD()-r),(o=eF.parse(n.sdp)).media=null===(t=o.media)||void 0===t?void 0:t.map((function(e){return $f($f({},e),d._offerIce)})),[4,this.setLocalDescription(eF.write(o),{streamId:e.streamId||"",streamUserId:e.userId})];case 2:return l.sent(),a=e.audioTransceiver.mid,s=e.videoTransceiver.mid,c=null,u=null,null===(i=o.media)||void 0===i||i.forEach((function(e){"".concat(e.mid)===a?c=e:"".concat(e.mid)===s&&(u=e)})),[2,{partialSdp:vF(o,c,u),audioMid:a,videoMid:s,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){var t,i;return t_(this,void 0,void 0,(function(){var r,n,o,a,s,c=this;return i_(this,(function(u){return e.action===ZB.unpublish||e.action===ZB.unsubscribe||(r=e.signalingAck,n={},(o=eF.parse(null===(t=this._peerConnection.remoteDescription)||void 0===t?void 0:t.sdp)).media.forEach((function(e){n[e.mid]=e})),eF.parse(null==r?void 0:r.sdp).media.forEach((function(e){n[e.mid]=$f($f({},e),c._answerIce)})),a=[],(s=eF.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media.forEach((function(e){a.push(n[e.mid])})),o.groups=s.groups,o.media=a,this.setRemoteDescription(eF.write(o))),[2,""]}))}))},t.prototype.getDefaultSdp=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){return[2,{semantics:"unified-plan",sdp:"",type:"offer"}]}))}))},t.prototype.rollback=function(e,t){var i,r;return t_(this,void 0,void 0,(function(){var e,n,o;return i_(this,(function(a){switch(a.label){case 0:return lj.print("rollback()"),t.audioTransceiver&&t.videoTransceiver?(t.audioTransceiver.stop(),t.videoTransceiver.stop(),e=[],(n=eF.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media=n.media.map((function(i){return"".concat(i.mid)!==t.audioMid&&"".concat(i.mid)!==t.videoMid||(i=_F(i)),"inactive"!==i.direction&&e.push(i.mid),i})),(o=eF.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media=o.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=_F(e)),e})),n.groups&&o.groups&&(n.groups[0].mids=e.join(" "),o.groups[0].mids=e.join(" ")),[4,this._peerConnection.createOffer()]):[3,4];case 1:return a.sent(),[4,this.setLocalDescription(eF.write(n))];case 2:return a.sent(),[4,this.setRemoteDescription(eF.write(o))];case 3:a.sent(),a.label=4;case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,this._peerConnection.createOffer()];case 1:return e.sent(),this._peerConnection.localDescription&&this._peerConnection.remoteDescription?[4,this._peerConnection.setLocalDescription(this._peerConnection.localDescription)]:[3,4];case 2:return e.sent(),[4,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},t}(ZV),pj=new XD("FallbackHandler",3),fj=function(e){function t(t,i){var r=e.call(this,t,i)||this;return r.name="fallback",pj.print("ctor","using fallback handler"),t.rtcError("using fallback handler",-1),r}return Cf(t,e),t.prototype.connect=function(e){var t,i,r,n;return t_(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_=this;return i_(this,(function(v){switch(v.label){case 0:return pj.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(t=e.iceParams)||void 0===t?void 0:t.clientIceUfrag,icePwd:null===(i=e.iceParams)||void 0===i?void 0:i.clientIcePwd,iceOptions:"renomination"},o=this,[4,mF(e)];case 1:return o._answerIce=v.sent(),[4,this._peerConnection.createOffer()];case 2:return a=v.sent(),s=eF.parse(a.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((c="renomination"===(null===(r=s.media[0])||void 0===r?void 0:r.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,u=n_(gF({serverUfrag:e.iceParams.serverIceUfrag,serverPwd:e.iceParams.serverIcePwd,clientPwd:null===(n=s.media[0])||void 0===n?void 0:n.icePwd,options:(f={},f[yF.kICEConfigTypeSrtpDtlsType]=!0,f[yF.kICEConfigTypeRenominationType]=c,f)}),1),d=u[0],this._answerIce.iceUfrag=d,pj.print("use serverUfrag v2",JSON.stringify({dtls:!0,renomination:c}))),l=n_(s.media,1),h=l[0],this._offerIce.fingerprint=s.fingerprint||h.fingerprint,s.media=s.media.map((function(e){return $f($f({},e),_._offerIce)})),(p=$f({},s)).fingerprint=this._answerIce.fingerprint,p.media=p.media.map((function(e){return $f($f($f({},e),_._answerIce),{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}})})),[4,this.setLocalDescription(a.sdp)];case 3:return v.sent(),[4,this.setRemoteDescription(eF.write(p))];case 4:return v.sent(),[4,new Promise((function(e,t){_._dataChannel.onopen=function(){pj.print("connect","dataChannel open"),zx("es.dc.open",""),e("")},_._dataChannel.onerror=function(e){Ux.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,ZL.INVALID_DATA),zx("es.dc.error",""),t(e)},_._dataChannel.onclose=function(e){zx("es.dc.close",""),t(e)},_._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==_._peerConnection.iceConnectionState&&"closed"!==_._peerConnection.iceConnectionState&&"failed"!==_._peerConnection.connectionState||t(e)}))}))];case 5:return v.sent(),pj.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.publish=function(t,i){var r;return t_(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p,f;return i_(this,(function(_){switch(_.label){case 0:return n=e.prototype.internalPublish.call(this,t,i),o=n.videoDescriptions,a=n.subVideoDescriptions,s=n.transceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(s.aTrack,s.audioTransceiverInit),t.videoTransceiver=this._peerConnection.addTransceiver(s.vTrack,s.videoTransceiverInit),c=sD(),Ux.rtcBeginCreateOffer(tx.UP,"",""),[4,this._peerConnection.createOffer()];case 1:return u=_.sent(),Ux.rtcCreateOffer(0,ix.UP,"","",sD()-c),d=eF.parse(u.sdp),[4,this.setLocalDescription(u.sdp)];case 2:return _.sent(),l=t.audioTransceiver.mid,h=t.videoTransceiver.mid,p=null,f=null,d.media=null===(r=d.media)||void 0===r?void 0:r.map((function(e){return"".concat(e.mid)===l?p=e:"".concat(e.mid)===h&&(f=e),e})),qV()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),[2,{partialSdp:vF(d,p,f),audioMid:l,videoMid:h,type:"incroffer",semantics:"unified-plan",videoDescriptions:o,subVideoDescriptions:a,transceiverInit:s}]}}))}))},t.prototype.subscribe=function(e){var t;return t_(this,void 0,void 0,(function(){var i,r,n,o,a,s,c;return i_(this,(function(u){switch(u.label){case 0:return pj.print("subscribe()"),e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),i=sD(),Ux.rtcBeginCreateOffer(tx.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:return r=u.sent(),Ux.rtcCreateOffer(0,ix.UP,e.streamId,e.userId,sD()-i),n=eF.parse(r.sdp),[4,this.setLocalDescription(r.sdp,{streamId:e.streamId||"",streamUserId:e.userId})];case 2:return u.sent(),o=e.audioTransceiver.mid,a=e.videoTransceiver.mid,s=null,c=null,null===(t=n.media)||void 0===t||t.forEach((function(e){"".concat(e.mid)===o?s=e:"".concat(e.mid)===a&&(c=e)})),qV()&&(e.initVideoEncodedTransform(),e.initAudioEncodedTransform()),[2,{partialSdp:vF(n,s,c),audioMid:o,videoMid:a,type:"incroffer",semantics:"unified-plan"}]}}))}))},t.prototype.handleAck=function(e){var t,i;return t_(this,void 0,void 0,(function(){var r,n,o,a,s,c=this;return i_(this,(function(u){return e.action===ZB.unpublish||e.action===ZB.unsubscribe||(r=e.signalingAck,n={},(o=eF.parse(null===(t=this._peerConnection.remoteDescription)||void 0===t?void 0:t.sdp)).media.forEach((function(e){n[e.mid]=e})),eF.parse(null==r?void 0:r.sdp).media.forEach((function(e){n[e.mid]=$f($f({},e),c._answerIce)})),a=[],(s=eF.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media.forEach((function(e){a.push(n[e.mid])})),o.groups=s.groups,o.media=a,this.setRemoteDescription(eF.write(o))),[2,""]}))}))},t.prototype.getDefaultSdp=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){return[2,{semantics:"unified-plan",sdp:"",type:"offer"}]}))}))},t.prototype.rollback=function(e,t){var i,r;return t_(this,void 0,void 0,(function(){var e,n,o,a;return i_(this,(function(s){switch(s.label){case 0:return pj.print("rollback()"),t.audioTransceiver&&t.videoTransceiver?(t.audioTransceiver.stop(),t.videoTransceiver.stop(),e=[],(n=eF.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp)).media=n.media.map((function(i){return"".concat(i.mid)!==t.audioMid&&"".concat(i.mid)!==t.videoMid||(i=_F(i)),"inactive"!==i.direction&&e.push(i.mid),i})),(o=eF.parse(null===(r=this._peerConnection.remoteDescription)||void 0===r?void 0:r.sdp)).media=o.media.map((function(e){return"".concat(e.mid)!==t.audioMid&&"".concat(e.mid)!==t.videoMid||(e=_F(e)),e})),n.groups&&o.groups&&(n.groups[0].mids=e.join(" "),o.groups[0].mids=e.join(" ")),[4,this._peerConnection.createOffer()]):[3,4];case 1:return a=s.sent(),[4,this.setLocalDescription(a.sdp)];case 2:return s.sent(),[4,this.setRemoteDescription(eF.write(o))];case 3:s.sent(),s.label=4;case 4:return[2]}}))}))},t.prototype.setCurrentDescription=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,this._peerConnection.createOffer()];case 1:return e.sent(),this._peerConnection.localDescription&&this._peerConnection.remoteDescription?[4,this._peerConnection.setLocalDescription(this._peerConnection.localDescription)]:[3,4];case 2:return e.sent(),[4,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))},t}(ZV),_j=function(e,t){return(null==t?void 0:t.enableFallbackHandler)?new fj(e,t):hD?new hj(e,t):new dj(e,t)},vj=new XD("Locker",2),mj=1,yj=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=mj++,e&&(this.name=e),vj.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return Object.defineProperty(e.prototype,"isLocked",{get:function(){return this.locks>0},enumerable:!1,configurable:!0}),e.prototype.lock=function(){var e,t=this;this.locks+=1,vj.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var i=new Promise((function(i){e=function(){t.locks-=1,vj.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),i()}})),r=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return i})),r},e}();!function(e){e[e.communication=0]="communication",e[e.live_broadcasting=1]="live_broadcasting",e[e.game=2]="game",e[e.cloud_game=3]="cloud_game",e[e.low_latency=4]="low_latency",e[e.chat=5]="chat",e[e.chat_room=6]="chat_room",e[e.lw_together=7]="lw_together",e[e.game_hd=8]="game_hd",e[e.co_host=9]="co_host",e[e.interactive_podcast=10]="interactive_podcast",e[e.ktv=11]="ktv",e[e.chorus=12]="chorus",e[e.vr_chat=13]="vr_chat",e[e.game_streaming=14]="game_streaming",e[e.lan_live_streaming=15]="lan_live_streaming",e[e.meeting=16]="meeting",e[e.meeting_room=17]="meeting_room",e[e.classroom=18]="classroom"}(rj||(rj={})),function(e){e.IES_living="IES_living",e.FeedShare="FeedShare",e.fluent="fluent",e.IES_chatroom="IES_chatroom",e.standard="standard",e.IES_PK="IES_PK",e.IES_KTV="IES_KTV"}(nj||(nj={}));var Sj,gj=((ij={})[Jf.communication]=[rj.communication],ij[Jf.chat]=[rj.communication],ij[Jf.chatRoom]=[rj.live_broadcasting,nj.IES_chatroom],ij[Jf.coHost]=[rj.live_broadcasting,nj.IES_PK],ij[Jf.meeting]=[rj.meeting],ij[Jf.classRoom]=[rj.communication],ij),Ej=new XD("MediaServerClient",2),bj=5e3;!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(Sj||(Sj={}));var Tj,Ij=function(e,t){Ej.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},Rj=function(e){function t(t,i){void 0===i&&(i=Ux);var r=e.call(this)||this;return r._ontrackCallbackMap=new Map,r._subResolves={},r.supportConcurrent=!1,r._pubConfig={},r._subConfig={},r._roomProfile=Jf.communication,r._subStreamQueue={},r.monitor=i,r._pubSubLock=new yj("pubSubLock"),r._joinLeaveLock=new yj("joinLeaveLock"),r._state=Sj.DISCONNECTED,r._roomAttributes={multiChatMode:!1,bigRoomMode:!1},r._context=t,r.on("SUB_END",(function(e){return r._handleSubStreamQueue(e)})),r}return Cf(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){Ej.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(pV.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[lV.ON_ADD_STREAM,lV.ON_REMOVE_STREAM,lV.USER_CONNECTION,lV.USER_DISCONNECTION,lV.ON_UPDATE_STREAM_ATTRIBUTES,lV.ON_UPDATE_ROOM_ATTRIBUTES,lV.ON_PUSH_TRACK,lV.ON_REMOVE_TRACK,lV.NODE_CHANGE,lV.ON_CUSTOM_MESSAGE,lV.USER_MESSAGE_RECEIVED,lV.USER_BINARY_MESSAGE_RECEIVED,lV.POST_PROCESSING_MESSAGE,lV.ON_USER_TOKEN_WILL_EXPIRE,lV.STREAM_CONTROL_MESSAGE,lV.ON_SCENE_CONFIG,hV.RSCP].forEach((function(e){var i;null===(i=t._dataChannelSignal)||void 0===i||i.on(e,(function(i){t.safeEmit(e,i)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){Ej.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(pV.ABNORMAL_DISCONNECTION)}))},t.prototype._removeSignalEventHandler=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()},Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(pV.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.connect=function(e,t,i,r){var n;return void 0===t&&(t=""),void 0===i&&(i=""),void 0===r&&(r={}),t_(this,void 0,void 0,(function(){var o,a,s,c,u,d=this;return i_(this,(function(l){switch(l.label){case 0:return this.connectionState=Sj.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),r.node?(o=[r.node],zx("es.join.nodeChange",r),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new PV,[4,null===(n=this._iceConfigRequestManager)||void 0===n?void 0:n.getAccessNode(e,t,i,$x.getDeviceId(),null==r?void 0:r.reason,null==r?void 0:r.feedbackNode,this._useCloudProxy)];case 2:if(!(o=l.sent()))throw zx("es.join.getNodeFailed",""),new lP(aP.ICE_SERVER_WRONG,"get ICE config failed");zx("es.join.getNodeSuccess",o),l.label=3;case 3:this._addHandlerEvents(),Promise.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),l.label=4;case 4:return l.trys.push([4,6,,7]),s=!1,c=o.map((function(e){var t=_j(d.monitor,d._context);return t.connect(e).then((function(i){s?t.destroy():(s=!0,a=i,d.safeEmit("prevIceNode",e),d._handler=t,d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(e){throw t.destroy(),e}))})),[4,gD(c)];case 5:return l.sent(),Ej.print("join","establish peerConnection success"),[3,7];case 6:throw u=l.sent(),this.connectionState=Sj.DISCONNECTED,new lP(aP.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",u);case 7:if(!a)throw this.connectionState=Sj.DISCONNECTED,new lP(aP.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");return this._dataChannelSignal=new OV(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,i,r){var n,o,a,s,c,u,d,l,h,p;return void 0===t&&(t={}),void 0===i&&(i=!1),t_(this,void 0,void 0,(function(){var f,_,v,m,y,S,g,E=this;return i_(this,(function(b){switch(b.label){case 0:return Ej.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,i,r),this._appId=e.appId,this._token=e.token,this._roomId=e.roomId,this._clientId=e.userInfo.userId,this._businessId=e.userInfo.businessId,this._userInfo=e.userInfo,this._useCloudProxy=e.useCloudProxy,this._roomProfile=e.roomProfile,this._sessionId=t.sessionId,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return b.sent(),S={Authorization:dD.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId||"",timestamp:Date.now(),controlMessage:r,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role}},g={},[4,YV()];case 2:return S.params=(g.supportedCodecs=b.sent(),g.deviceType="web",g.userAgent=window.navigator.userAgent,g.sdkVersion=TV.VERSION,g.deviceId=$x.getDeviceId(),g.appId=this._appId,g.roomId=this._roomId,g.userId=this._clientId,g.businessId=this._businessId,g.enable_cloud_proxy=this._useCloudProxy,g.channelProfile=gj[this._roomProfile]?gj[this._roomProfile][0]+"":"0",g),S.options={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0},S.accessParams=JSON.stringify({requireICEUfragV2:!0}),f=S,hD?[3,4]:(_=f,[4,null===(n=this._handler)||void 0===n?void 0:n.getDefaultSdp()]);case 3:_.sdpInfo=b.sent(),f.options.enableUnBundleMode=!0,b.label=4;case 4:Promise.resolve().then((function(){return E.emit("onSendingJoinMessageHook")})),b.label=5;case 5:return b.trys.push([5,7,,8]),v=i?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(v,f)];case 6:return m=b.sent(),Ej.print("join","send join message success"),this._authorization=f.Authorization,this.connectionState=Sj.CONNECTED,WB.audioStallConfig=null===(o=m.config)||void 0===o?void 0:o.engine_WEB,this._pubConfig.audioRed=!!(null===(s=null===(a=m.config)||void 0===a?void 0:a.engine_WEB)||void 0===s?void 0:s.pub_audio_red),this._subConfig.muteReplaceUnsub=!!(null===(c=m.config)||void 0===c?void 0:c.mute_replace_unsub),this._pubConfig.simulcastOnDemand=!(!1===(null===(l=null===(d=null===(u=m.config)||void 0===u?void 0:u.engine_VPM)||void 0===d?void 0:d.ondemand)||void 0===l?void 0:l.enable)),null===(h=this._context)||void 0===h||h.audioProfileManager.updateEngineBAC(null===(p=m.config)||void 0===p?void 0:p.engine_BAC),[2,m];case 7:if(y=b.sent(),this.connectionState=Sj.DISCONNECTED,(null==y?void 0:y.code)>=700&&(null==y?void 0:y.code)<800)throw new lP(aP.INVALID_TOKEN,(null==y?void 0:y.message)||"Invalid token");if(200!==(null==y?void 0:y.code))throw new lP(aP.JOIN_ROOM_FAILED,(null==y?void 0:y.message)||"Join room failed");return[3,8];case 8:return[2]}}))}))},t.prototype.publish=function(e){var t,i,r,n,o,a,s,c,u,d;return t_(this,void 0,void 0,(function(){var l,h,p,f,_,v,m,y,S;return i_(this,(function(g){switch(g.label){case 0:Ej.print("publish()","localStream: %o",e),l=e.videoTrack,h=e.audioTrack,p=sD(),f="",_="",g.label=1;case 1:return g.trys.push([1,4,,6]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(v=g.sent()))throw new lP(aP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return f=v.audioMid,_=v.videoMid,e.pubAttributes={localaudio:!!h,localvideo:!!l,videostream:e.pubVideo,audiostream:e.pubAudio,extvideo:!!(l instanceof IB),extaudio:!!(h instanceof RB)},m={attributes:$f({videoDescriptions:v.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:f,videoMid:_,sdpInfo:{msid:e.stream.id,type:v.type,sdp:v.partialSdp,semantics:v.semantics}},e.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(m.attributes.subVideoDescriptions=v.subVideoDescriptions),[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("publish",m)];case 3:if(200!==(null==(y=g.sent())?void 0:y.code))throw new lP(aP.PUBLISH_FAILED,(null==y?void 0:y.message)||"publish failed");return Ux.rtcRecvAnswer(0,ox.INCRANSWER,(null===(r=null==y?void 0:y.relayMessage)||void 0===r?void 0:r.sequenceId)||0,null===(n=null==y?void 0:y.relayMessage)||void 0===n?void 0:n.sdp,ax.UP,"",""),null===(o=this._handler)||void 0===o||o.handleAck({action:ZB.publish,streamId:y.streamId,audioMid:f,videoMid:_,transceiverInit:v.transceiverInit,signalingAck:{audioMid:null===(a=null==y?void 0:y.relayMessage)||void 0===a?void 0:a.audioMid,videoMid:null===(s=null==y?void 0:y.relayMessage)||void 0===s?void 0:s.videoMid,sdp:null===(c=null==y?void 0:y.relayMessage)||void 0===c?void 0:c.sdp,sequenceId:null===(u=null==y?void 0:y.relayMessage)||void 0===u?void 0:u.sequenceId},stream:e}),e.streamId=y.streamId,e.videoMid=_,e.audioMid=f,e.subVideoDescriptions=v.subVideoDescriptions,this.monitor.rtcPublishStat(sx.SUCCESS,cx.W_0,p,ux.UNKNOWN),e.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 4:return(S=g.sent())instanceof Error&&this.monitor.rtcPublishStat(sx.FAIL,cx.W_0,p,S.message),[4,null===(d=this._handler)||void 0===d?void 0:d.rollback(e.stream.id,e)];case 5:throw g.sent(),S;case 6:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,i,r,n,o,a,s;return t_(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_,v,m,y,S,g,E,b,T,I,R,A,C,O,w,N,P,k,D,M;return i_(this,(function(U){switch(U.label){case 0:Ej.print("updatePubTrack()","localStream: %o",e),c=e.videoTrack,u=e.audioTrack,d=e.pubAudio,l=e.pubVideo,h=null==u?void 0:u.getTrack(),p=null==c?void 0:c.getTrack(),l&&p?null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack(p):null===(i=e.videoTransceiver)||void 0===i||i.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateScaleResolutionDownBy(e),d&&h?(_=(f=u).mixType,(v=f.mixedAudioTrack)&&_!==s_.PLAYOUT&&!0===h.enabled&&(h=v),null===(n=e.audioTransceiver)||void 0===n||n.sender.replaceTrack(h)):null===(o=e.audioTransceiver)||void 0===o||o.sender.replaceTrack(null),m={localaudio:!!u,localvideo:!!c,videostream:l,audiostream:d,extvideo:!!(c instanceof IB),extaudio:!!(u instanceof RB)},y={};try{for(S=r_(Object.entries(m)),g=S.next();!g.done;g=S.next())E=n_(g.value,2),b=E[0],(T=E[1])!==Reflect.get(e.pubAttributes,b)&&Reflect.set(y,b,T)}catch(e){D={error:e}}finally{try{g&&!g.done&&(M=S.return)&&M.call(S)}finally{if(D)throw D.error}}return Object.keys(y).length?(e.observer&&(I=e.observer,R=y.audiostream,A=y.videostream,C=y.localaudio,w=y.extaudio,N=y.extvideo,void 0!==(O=y.localvideo)?void 0!==N?I.setPushVideo(N):I.setEnableVideo(O):void 0!==A&&I.setUnmuteVideo(A),void 0!==C?void 0!==w?I.setPushAudio(w):I.setEnableAudio(C):void 0!==R&&I.setUnmuteAudio(R)),e.pubAttributes=m,P={roomId:this._roomId,streamId:e.streamId,attributes:y},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateStreamAttributes",P)]):[2];case 1:if(200!==(null==(k=U.sent())?void 0:k.code))throw new lP(aP.UPDATE_TRACK_FAILED,(null==k?void 0:k.message)||"update track failed");return hD?[4,null===(s=this._handler)||void 0===s?void 0:s.setCurrentDescription()]:[3,3];case 2:U.sent(),U.label=3;case 3:return[2]}}))}))},t.prototype.updateToken=function(e){var t,i,r;return t_(this,void 0,void 0,(function(){var n,o;return i_(this,(function(a){switch(a.label){case 0:if(Ej.print("updateToken()","newToken: %o",e),this._token=e,!this._appId||!(null===(t=this._userInfo)||void 0===t?void 0:t.userId)||!this._roomId)return[2];n={roomId:this._roomId,userId:null===(i=this._userInfo)||void 0===i?void 0:i.userId,appId:this._appId,token:"Bearer ".concat(e)},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateToken",n)];case 2:if(200!==(null==(o=a.sent())?void 0:o.code))throw new lP(aP.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new lP(aP.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=function(e){var t,i,r;return t_(this,void 0,void 0,(function(){var n;return i_(this,(function(o){switch(o.label){case 0:return Ej.print("unpublish()","localStream: %o",e),n={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},null===(t=this._dataChannelSignal)||void 0===t||t.sendSignaling("unpublish",n),null===(i=this._handler)||void 0===i||i.handleAck({action:ZB.unpublish,audioMid:e.audioMid,videoMid:e.videoMid,stream:e,streamId:e.streamId}),e.statsReport.unpublish(),[4,null===(r=this._handler)||void 0===r?void 0:r.rollback(e.stream.id,e)];case 1:return o.sent(),[2]}}))}))},t.prototype.subscribe=function(e,t,i){return t_(this,void 0,void 0,(function(){var r=this;return i_(this,(function(n){return[2,new Promise((function(n,o){return t_(r,void 0,void 0,(function(){var r,a,s,c,u,d,l,h,p,f,_,v,m,y,S,g,E,b,T,I,R,A,C,O,w,N,P,k,D,M,U,L,x=this;return i_(this,(function(V){switch(V.label){case 0:if(e.streamState===XB.SUB_ED)return[2,this._updateSubTrack(e,t,HB.SUB).then(n,o)];if(e.streamState===XB.SUB_ING)return this._subStreamQueue[e.streamId]||(this._subStreamQueue[e.streamId]=[]),Ej.print("_subStreamQueue","streamId: %o, enqueue",e.streamId),this._subStreamQueue[e.streamId].push({fn:this.subscribe,args:[e,t,i],resolve:n,reject:o}),[2];if(Ej.print("subscribe()","mediaType: %o",t),Ij("subscribe()",e),e.streamState=XB.SUB_ING,r=!1,a=!1,bD(t)&&(a=!0),TD(t)&&(r=!0),!r&&this._multiChatMode())return[2,n(null)];s=sD(),c=e.audioMid,u=e.videoMid,l=e.paused,h=e.subVideo,V.label=1;case 1:return V.trys.push([1,8,,10]),c&&u?[4,null===(R=this._handler)||void 0===R?void 0:R.subscribe(e,{audioMid:c,videoMid:u})]:[3,3];case 2:return d=V.sent(),[3,5];case 3:return[4,null===(A=this._handler)||void 0===A?void 0:A.subscribe(e)];case 4:if(!(d=V.sent()))throw new lP(aP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");c=d.audioMid,u=d.videoMid,V.label=5;case 5:return e.paused=!r,e.subVideo=r,p={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:u,audioMid:c,sdpInfo:{sdp:null==d?void 0:d.partialSdp,semantics:null==d?void 0:d.semantics,type:null==d?void 0:d.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||a,video:r},qualityLayer:{spatialLayer:(null==i?void 0:i.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==i?void 0:i.spatialSubLayer)||-1}}},[4,null===(C=this._dataChannelSignal)||void 0===C?void 0:C.sendSignaling("subscribe",p)];case 6:if(200!==(null==(f=V.sent())?void 0:f.code))throw new lP(aP.SUBSCRIBE_FAILED,(null==f?void 0:f.message)||"subscribe failed");return _=[],v=!this._multiChatMode(),m=!e.videoTrack,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),m&&_.push(new Promise((function(t,i){x._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),bj);e.on("ontrack",(function i(n){"video"===n.mediaType&&(Ej.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),v&&_.push(new Promise((function(t,i){x._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),bj);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(Ej.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),y=function(t){e.ontrack(t)},null===(O=this._handler)||void 0===O||O.on("ontrack",y),this._ontrackCallbackMap.set(e,y),S=null==f?void 0:f.relayMessage,g=S.audioMid,E=S.videoMid,(I={})[c]=g,I[u]=E,b=I,Ej.print("sub midmap",e.userId,b),e.videoMid=E,e.audioMid=g,e._workaround_1_=!1,e.subMediaType=t,e.streamState=XB.SUB_ED,Ux.rtcRecvAnswer(0,ox.INCRANSWER,(null===(w=null==f?void 0:f.relayMessage)||void 0===w?void 0:w.sequenceId)||0,null===(N=null==f?void 0:f.relayMessage)||void 0===N?void 0:N.sdp,ax.DOWN,e.streamId,e.userId),null===(P=this._handler)||void 0===P||P.handleAck({action:ZB.subscribe,streamId:e.streamId,audioMid:c,videoMid:u,transceiverInit:null==d?void 0:d.transceiverInit,signalingAck:{audioMid:null===(k=null==f?void 0:f.relayMessage)||void 0===k?void 0:k.audioMid,videoMid:null===(D=null==f?void 0:f.relayMessage)||void 0===D?void 0:D.videoMid,sdp:null===(M=null==f?void 0:f.relayMessage)||void 0===M?void 0:M.sdp,sequenceId:null===(U=null==f?void 0:f.relayMessage)||void 0===U?void 0:U.sequenceId},stream:e}),[4,Promise.all(_)];case 7:return V.sent(),this._multiChatMode()||(e.subAudio=a),this.monitor.rtcSubscribeStat(dx.SUCCESS,s,lx.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),n(null),this.emit("SUB_END",e.streamId),[3,10];case 8:return(T=V.sent())instanceof Error&&this.monitor.rtcSubscribeStat(dx.FAIL,s,T.message,e.userId),e.paused=l,e.subVideo=h,e.streamState=XB.INIT,[4,null===(L=this._handler)||void 0===L?void 0:L.rollback(e.streamId,e)];case 9:return V.sent(),o(T),this.emit("SUB_END",e.streamId),[3,10];case 10:return[2]}}))}))}))]}))}))},t.prototype._handleSubStreamQueue=function(e){var t,i=this;if(null===(t=this._subStreamQueue[e])||void 0===t?void 0:t.length){Ej.print("_subStreamQueue","streamId: %o, exec",e);var r=this._subStreamQueue[e].shift(),n=r.fn,o=r.args,a=r.resolve,s=r.reject;n.apply(this,o).then(a,s).finally((function(){return i._handleSubStreamQueue(e)}))}else Ej.print("_subStreamQueue","streamId: %o, END",e)},t.prototype.controlMessage=function(e){var t;return t_(this,void 0,void 0,(function(){var i;return i_(this,(function(r){switch(r.label){case 0:return Ej.print("controlMessage()","params: %o",e),i=e,"transcode"===e.type&&(i.roomId=this._roomId),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",i)];case 1:return r.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return t_(this,void 0,void 0,(function(){return i_(this,(function(i){switch(i.label){case 0:return Ej.print("updateUserAttributes()","attributes: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:e})];case 1:return i.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,i,r){return t_(this,void 0,void 0,(function(){return i_(this,(function(n){return[2,this._updateSubTrack(e,t,i,r||e.subLayer)]}))}))},t.prototype._updateSubTrack=function(e,t,i,r){var n,o,a,s,c;return void 0===r&&(r={spatialLayer:0,spatialSubLayer:-1}),t_(this,void 0,void 0,(function(){var u,d,l,h,p;return i_(this,(function(f){switch(f.label){case 0:return Ej.print("updateSubTrack()","mediaType: %o, subLayer: %o",t,r),Ij("updateSubTrack()",e),u=0,u=i===HB.SUB?e.subMediaType|t:e.subMediaType-(e.subMediaType&t),Ej.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",e.subMediaType,i,t,u),e.subMediaType===u&&Ej.print("updateSubTrack","mediaType no change"),d=!1,l=!1,bD(u)&&(l=!0),TD(u)&&(d=!0),h={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:d,audio:!!this._multiChatMode()||l},qualityLayer:{spatialLayer:null!==(n=r.spatialLayer)&&void 0!==n?n:0,temporalLayer:0,spatialSubLayer:null!==(o=r.spatialSubLayer)&&void 0!==o?o:-1}}},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateSubscribe",h)];case 1:if(200!==(null==(p=f.sent())?void 0:p.code))throw new lP(aP.UPDATE_TRACK_FAILED,(null==p?void 0:p.message)||"update track failed");return e.paused=!d,this._multiChatMode()||(null===(s=e.observer)||void 0===s||s.setUnmuteAudio(l),e.subAudio=l),null===(c=e.observer)||void 0===c||c.setUnmuteVideo(d),e.subVideo=d,e.subMediaType=u,e.subLayer=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var i,r,n,o,a;return t_(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f,_,v,m,y=this;return i_(this,(function(S){switch(S.label){case 0:if(Ej.print("subscribe4pushTrack()","streamInfo: %o",t),Ij("subscribe4pushTrack()",e),s=null==t?void 0:t.message,c=s.audioMid,u=s.videoMid,d=s.sequenceId,e.subAudio=!0,d<e.sequenceId)return Ej.print("subscribe4pushTrack","sequenceId return",d,e.sequenceId),[2];l=e.audioMid,h=e.videoMid,null===(i=e.observer)||void 0===i||i.setPushTrack(!0),S.label=1;case 1:return S.trys.push([1,7,,8]),l&&h?[4,null===(r=this._handler)||void 0===r?void 0:r.subscribe(e,{audioMid:l,videoMid:h})]:[3,3];case 2:return p=S.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(p=S.sent()))throw new lP(aP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");l=p.audioMid,h=p.videoMid,S.label=5;case 5:return(m={})[l]=c,m[h]=u,f=m,Ej.print("onpushtrack midmap",e.userId,f),e.audioMid=c,e.videoMid=u,e.sequenceId=d,this._subResolves[e.streamId]||(this._subResolves[e.streamId]=[]),_=[],e.audioTrack||_.push(new Promise((function(t,i){y._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),bj);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(Ej.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),v=function(t){e.ontrack(t)},null===(o=this._handler)||void 0===o||o.on("ontrack",v),this._ontrackCallbackMap.set(e,v),null===(a=this._handler)||void 0===a||a.handleAck({action:ZB.pushtrack,streamId:e.streamId,audioMid:l,videoMid:h,stream:e,transceiverInit:null==p?void 0:p.transceiverInit,signalingAck:null==t?void 0:t.message}),[4,Promise.all(_)];case 6:return S.sent(),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2];case 7:throw S.sent();case 8:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var i,r,n;return t_(this,void 0,void 0,(function(){return i_(this,(function(o){switch(o.label){case 0:return Ij("unsubscribe4removeTrack()",e),Ej.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(Ej.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):(null===(i=e.observer)||void 0===i||i.setPushTrack(!1),null===(r=this._handler)||void 0===r||r.handleAck({action:ZB.removetrack,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e}),[4,null===(n=this._handler)||void 0===n?void 0:n.rollback(e.streamId,e)]));case 1:return o.sent(),this._subResolves[e.streamId]&&this._subResolves[e.streamId].forEach((function(e){return e(0)})),Ej.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.unsubscribe=function(e,t,i){var r,n,o,a,s;return void 0===i&&(i=!1),t_(this,void 0,void 0,(function(){var c,u,d;return i_(this,(function(l){switch(l.label){case 0:return Ij("unsubscribe()",e),c=e.subMediaType-(e.subMediaType&t),i||!this._subConfig.muteReplaceUnsub&&c===nB.NONE?(u={roomId:this._roomId,streamId:e.streamId,userId:e.userId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unsubscribe",u),e.streamState=XB.INIT,this._subStreamQueue[e.streamId]&&(this._subStreamQueue[e.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[e.streamId]),e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(n=e.observer)||void 0===n||n.setSubscribeVideo(!1),e.subAudio?[3,3]:(null===(o=e.observer)||void 0===o||o.setSubscribeAudio(!1),[4,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:ZB.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e})])):[2,this._updateSubTrack(e,t,HB.UNSUB)];case 1:return d=l.sent(),[4,null===(s=this._handler)||void 0===s?void 0:s.rollback(e.streamId,e)];case 2:l.sent(),this._subResolves[d]&&this._subResolves[d].forEach((function(e){return e(0)})),Ej.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),l.label=3;case 3:return[2]}}))}))},t.prototype.removeOnTrackListener=function(e){var t,i=this._ontrackCallbackMap.get(e);i&&(null===(t=this._handler)||void 0===t||t.off("ontrack",i),this._ontrackCallbackMap.delete(e))},t.prototype.handleRemoveStream=function(e,t){return t_(this,void 0,void 0,(function(){return i_(this,(function(i){return Ij("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==uV.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,e.hasSubscribed?(this.unsubscribe(e,Vf.AUDIO_AND_VIDEO,!0),[2]):[2]}))}))},t.prototype.leave=function(){var e;return t_(this,void 0,void 0,(function(){var t,i,r;return i_(this,(function(n){switch(n.label){case 0:return Ej.print("leave()"),this.connectionState!==Sj.CONNECTED?[3,7]:(this.connectionState=Sj.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]);case 1:i=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("leaveRoom",t)];case 3:return n.sent(),this.connectionState=Sj.DISCONNECTED,[3,6];case 4:throw r=n.sent(),this.connectionState=Sj.CONNECTED,r;case 5:return i(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new lP(aP.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,i,r,n;return t_(this,void 0,void 0,(function(){var o,a,s,c,u,d,l,h,p,f,_,v,m,y=this;return i_(this,(function(S){switch(S.label){case 0:return[4,null===(t=this._handler)||void 0===t?void 0:t.subscribe(e)];case 1:if(!(o=S.sent()))throw new lP(aP.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return a=sD(),s=o.audioMid,c=o.videoMid,u={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:s,videoMid:c,sdpInfo:{sdp:null==o?void 0:o.partialSdp,semantics:null==o?void 0:o.semantics,type:null==o?void 0:o.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("startPullStream",u)];case 2:return d=S.sent(),l=[],this._subResolves[e.streamId]=[],l.push(new Promise((function(t,i){y._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),bj);e.on("ontrack",(function i(n){"video"===n.mediaType&&(Ej.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),l.push(new Promise((function(t,i){y._subResolves[e.streamId].push(t);var r=setTimeout((function(){return i(new lP(aP.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),bj);e.on("ontrack",(function i(n){"audio"===n.mediaType&&(Ej.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",i),clearTimeout(r),t(0))}))}))),h=function(t){e.ontrack(t)},null===(r=this._handler)||void 0===r||r.on("ontrack",h),this._ontrackCallbackMap.set(e,h),p=null==d?void 0:d.relayMessage,f=p.audioMid,_=p.videoMid,v=p.sequenceId,m=p.sdp,e.videoMid=_,e.audioMid=f,e.sequenceId=v,e._workaround_1_=!1,e.paused=!1,e.streamState=XB.SUB_ED,e.subAudio=!0,e.subVideo=!0,null===(n=this._handler)||void 0===n||n.handleAck({action:ZB.subscribe,streamId:e.streamId,audioMid:s,videoMid:c,transceiverInit:null==o?void 0:o.transceiverInit,signalingAck:{audioMid:f,videoMid:_,sdp:m,sequenceId:v},stream:e}),[4,Promise.all(l)];case 3:return S.sent(),this.monitor.rtcSubscribeStat(dx.SUCCESS,a,lx.UNKNOWN,e.userId),e.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,i,r;return t_(this,void 0,void 0,(function(){var n;return i_(this,(function(o){switch(o.label){case 0:Ij("unsubscribePublicStream()",e),n={appId:this._appId,streamId:e.streamId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("stopPullStream",n)];case 2:case 3:return o.sent(),[3,4];case 4:return e.streamState=XB.INIT,e.subVideo=!1,e.subAudio=!1,null===(i=this._handler)||void 0===i||i.handleAck({action:ZB.unsubscribe,streamId:e.streamId,audioMid:e.audioMid,videoMid:e.videoMid,stream:e}),[4,null===(r=this._handler)||void 0===r?void 0:r.rollback(e.streamId,e)];case 5:return o.sent(),e.clean(),this.removeOnTrackListener(e),e.statsReport.unsubscribe(),[2]}}))}))},t.prototype.destroy=function(){var e,t,i;Ej.print("destroy()"),this._token=void 0,this._appId=void 0,this._roomId=void 0,this._clientId=void 0,this._authorization=void 0,this._sessionId=void 0,this._context=void 0,null===(e=this._handler)||void 0===e||e.destroy(),null===(t=this._dataChannelSignal)||void 0===t||t.destroy(),null===(i=this._iceConfigRequestManager)||void 0===i||i.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState=Sj.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=function(e,t){var i;return null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})},t.prototype.sendRoomMessage=function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)},t.prototype._multiChatMode=function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode},Object.defineProperty(t.prototype,"handler",{get:function(){return this._handler},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomAttributes",{get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),e_([Oj],t.prototype,"join",null),e_([Cj,Aj],t.prototype,"publish",null),e_([Cj,Aj],t.prototype,"updatePubTrack",null),e_([Cj,Aj],t.prototype,"unpublish",null),e_([Cj,Aj],t.prototype,"subscribe",null),e_([Aj],t.prototype,"controlMessage",null),e_([Aj],t.prototype,"updateUserAttributes",null),e_([Aj],t.prototype,"updateSubTrack",null),e_([Aj],t.prototype,"subscribe4pushTrack",null),e_([Aj],t.prototype,"unsubscribe4removeTrack",null),e_([Cj,Aj],t.prototype,"unsubscribe",null),e_([Aj],t.prototype,"handleRemoveStream",null),e_([Cj],t.prototype,"subscribePublicStream",null),e_([Cj],t.prototype,"unsubscribePublicStream",null),t}(qD);function Aj(e,t,i){var r=i.value;return i.value=function(){for(var e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return t_(this,void 0,void 0,(function(){return i_(this,(function(i){switch(i.label){case 0:return this._handler&&this._state===Sj.CONNECTED?[4,r.apply(this,e)]:[3,2];case 1:return i.sent(),[3,3];case 2:throw new lP(aP.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},i}function Cj(e,t,i){var r=i.value;return i.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return t_(this,void 0,void 0,(function(){var t;return i_(this,(function(i){switch(i.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=i.sent(),this.supportConcurrent&&t(),i.label=2;case 2:return i.trys.push([2,,4,5]),[4,r.apply(this,e)];case 3:return[2,i.sent()];case 4:return this.supportConcurrent||t(),[7];case 5:return[2]}}))}))},i}function Oj(e,t,i){var r=i.value;return i.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return t_(this,void 0,void 0,(function(){var t,i=this;return i_(this,(function(n){return t=!1,[2,new Promise((function(n,o){return t_(i,void 0,void 0,(function(){var i,a;return i_(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new lP(aP.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,r.apply(this,e)];case 2:return i=s.sent(),n(i),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},i}!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(Tj||(Tj={}));var wj,Nj=function(){function e(e,t){this._audioEventSessionId=vD(),this._videoEventSessionId=vD(),this._isScreen=!1,this._audioFirstFrameState=Tj.INITIAL,this._videoFirstFrameState=Tj.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:_x.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:_x.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._publishVideo=!1,this._publishAudio=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._stream=e,this._handler=t,this.getTransportDelay()}return e.prototype.beginRecvFrame=function(e,t){var i,r,n,o,a;return t_(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f=this;return i_(this,(function(_){switch(_.label){case 0:return[4,this.getTransportDelay()];case 1:return _.sent(),s=this._transportDelay,c=!0,u=_x.LOGIN,d=_x.UNMUTE,l=_x.SUBSCRIBE,h=_x.PUSH_TRACK,[u,d,l,h].indexOf(t)>=0&&(s=0,c=!1),e===fx.AUDIO?(c||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},p={media_type:e,event_type:px.BEGIN_RECV,type:t,start:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,transport_delay:s},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){f.stopRecvFrame(fx.AUDIO,vx.TIMEOUT),f._firstAudioFrameInterval&&window.clearInterval(f._firstAudioFrameInterval)}),this._timeout),Ux.rtcFirstFrame(p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=Tj.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===fx.VIDEO&&(c||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t},p={media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?fx.SCREEN_VIDEO:e,event_type:px.BEGIN_RECV,type:t,start:null===(o=this._currentVideoRecv)||void 0===o?void 0:o.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(a=this._stream)||void 0===a?void 0:a.userId,transport_delay:s},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){f.stopRecvFrame(fx.VIDEO,vx.TIMEOUT),f._firstVideoFrameInterval&&window.clearInterval(f._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),Ux.rtcFirstFrame(p),this._videoFirstFrameState=Tj.BEGIN,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0),[2]}}))}))},e.prototype.stopRecvFrame=function(e,t){var i,r,n,o,a,s,c;if(e===fx.AUDIO){if(this._audioFirstFrameState!==Tj.BEGIN)return;var u={event_type:px.RECV_END,media_type:e,start:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.startTime,reason:t,result:!1,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,Ux.rtcFirstFrame(u),this._audioFirstFrameState=Tj.STOPPED}else if(e===fx.VIDEO){if(this._videoFirstFrameState!==Tj.BEGIN)return;u={event_type:px.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?fx.SCREEN_VIDEO:e,start:null===(a=this._currentVideoRecv)||void 0===a?void 0:a.startTime,reason:t,result:!1,stream_user_id:null===(s=this._stream)||void 0===s?void 0:s.userId,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,Ux.rtcFirstFrame(u),this._videoFirstFrameState=Tj.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,i,r;return t_(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p;return i_(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:if(f.sent(),n=this._transportDelay,o=_x.LOGIN,a=_x.UNMUTE,s=_x.SUBSCRIBE,c=_x.PUSH_TRACK,e===fx.AUDIO){if(this._audioFirstFrameState!==Tj.BEGIN)return[2];if(!this._currentAudioRecv)return[2];u=this._currentAudioRecv,l=u.type,h=u.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:px.RECV_END,media_type:e,start:h,result:!0,stream_user_id:null===(t=this._stream)||void 0===t?void 0:t.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:n},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),Ux.rtcFirstFrame(p),this._audioFirstFrameState=Tj.RECEIVED}else if(e===fx.VIDEO){if(this._videoFirstFrameState!==Tj.BEGIN)return[2];if(!this._currentVideoRecv)return[2];d=this._currentVideoRecv,l=d.type,h=d.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:px.RECV_END,media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?fx.SCREEN_VIDEO:e,start:h,result:!0,stream_user_id:null===(r=this._stream)||void 0===r?void 0:r.userId,event_session_id:this._videoEventSessionId,type:l,transport_delay:n},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),Ux.rtcFirstFrame(p),this._videoFirstFrameState=Tj.RECEIVED}return[2]}}))}))},e.prototype.setLogin=function(e,t){var i,r,n,o;void 0===t&&(t={audio:!0,video:!0}),this._login!==e&&(this._login=e,e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&t.audio&&this.beginRecvFrame(fx.AUDIO,_x.LOGIN),e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&t.video&&this.beginRecvFrame(fx.VIDEO,_x.LOGIN),!e&&(null===(n=this._stream)||void 0===n?void 0:n.hasAudio)&&this.stopRecvFrame(fx.AUDIO,vx.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(fx.VIDEO,vx.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(fx.AUDIO,_x.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(fx.AUDIO,vx.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(fx.AUDIO,_x.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(fx.AUDIO,vx.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(fx.AUDIO,_x.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(fx.AUDIO,vx.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(fx.VIDEO,_x.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(fx.VIDEO,vx.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(fx.VIDEO,_x.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(fx.VIDEO,vx.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(fx.VIDEO,_x.ENABLE):this.stopRecvFrame(fx.VIDEO,vx.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal=e},e.prototype.setPushAudio=function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(fx.AUDIO,_x.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(fx.AUDIO,_x.PUSH)},e.prototype.setExternalVideoSource=function(e){this._videoExternal=e},e.prototype.setPushVideo=function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(fx.VIDEO,_x.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(fx.VIDEO,_x.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(fx.VIDEO,_x.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(fx.VIDEO,vx.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(fx.AUDIO,_x.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(fx.AUDIO,vx.UNPUBLISH)},e.prototype.setAutoSubscribe=function(e){this._autoSubscribe=e},e.prototype.setAutoSubscribeVideo=function(e){this._autoSubscribeVideo=e},e.prototype.setAutoSubscribeAudio=function(e){this._autoSubscribeAudio=e},e.prototype.setSubscribeAudio=function(e){var t,i;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(fx.AUDIO,_x.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&this.stopRecvFrame(fx.AUDIO,vx.UNSUBSCRIBE)},e.prototype.setSubscribeVideo=function(e){var t,i;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(fx.VIDEO,_x.SUBSCRIBE)),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasVideo)&&this.stopRecvFrame(fx.VIDEO,vx.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(fx.AUDIO,_x.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(fx.AUDIO,vx.REMOVE_TRACK))},e.prototype.setMultiChatMode=function(e){this._multiChatMode=e},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype._watchForFirstVideoFrameRecv=function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval((function(){return t_(e,void 0,void 0,(function(){var e,i,r,n,o,a,s,c;return i_(this,(function(u){switch(u.label){case 0:return(null===(r=this._handler)||void 0===r?void 0:r.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())?[4,XV(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.videoTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(i=e.find((function(e){return"inbound-rtp"===e.type})))&&i.framesReceived>t){if(-1===t)return t=i.framesReceived,[2];this.recvFrameFinish(fx.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype._watchForFirstAudioFrameRecv=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return t_(e,void 0,void 0,(function(){var e,i,r,n,o,a,s,c;return i_(this,(function(u){switch(u.label){case 0:return(null===(r=this._handler)||void 0===r?void 0:r.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())?[4,XV(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.audioTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(i=e.find((function(e){return"inbound-rtp"===e.type})))&&i.totalSamplesReceived>t){if(-1===t)return t=i.totalSamplesReceived,[2];this.recvFrameFinish(fx.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype.getTransportDelay=function(){return t_(this,void 0,void 0,(function(){var e=this;return i_(this,(function(t){switch(t.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return t.sent(),window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval((function(){return t_(e,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return e.sent(),[2]}}))}))}),2e3),[2]}}))}))},e.prototype.getTransportDelayIntl=function(){var e,t;return t_(this,void 0,void 0,(function(){var i,r,n;return i_(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,XV(null===(t=this._handler)||void 0===t?void 0:t.pc)]:[3,2];case 1:i=o.sent(),r=i.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(n=i.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==r?void 0:r.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*n.currentRoundTripTime/2)),o.label=2;case 2:return[2]}}))}))},e.prototype.reset=function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:_x.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:_x.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._transportDelayInterval&&window.clearInterval(this._transportDelayInterval)},e}();!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.SENT=3]="SENT"}(wj||(wj={}));var Pj,kj,Dj,Mj,Uj=function(){function e(e,t){this._audioEventSessionId=vD(),this._videoEventSessionId=vD(),this._currentAudioSend={startTime:0,eventSessionId:0,type:_x.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:_x.LOGIN},this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._timeout=1e4,this._audioFirstFrameState=wj.INITIAL,this._videoFirstFrameState=wj.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var i,r,n,o=this;if(e===fx.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:px.BEGIN_SEND,type:t,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){o.stopSendFrame(fx.AUDIO,vx.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),Ux.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=wj.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===fx.VIDEO){this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};a={media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?fx.SCREEN_VIDEO:e,event_type:px.BEGIN_SEND,type:t,start:null===(n=this._currentVideoSend)||void 0===n?void 0:n.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){o.stopSendFrame(fx.VIDEO,vx.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),Ux.rtcFirstFrame(a),this._videoFirstFrameState=wj.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}},e.prototype.stopSendFrame=function(e,t){var i,r,n,o,a;if(e===fx.AUDIO){if(this._audioFirstFrameState!==wj.BEGIN)return;var s={event_type:px.SENT_END,media_type:e,start:null===(i=this._currentAudioSend)||void 0===i?void 0:i.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(r=this._currentAudioSend)||void 0===r?void 0:r.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,Ux.rtcFirstFrame(s),this._audioFirstFrameState=wj.STOPPED}else if(e===fx.VIDEO){if(this._videoFirstFrameState!==wj.BEGIN)return;s={event_type:px.SENT_END,media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?fx.SCREEN_VIDEO:e,start:null===(o=this._currentVideoSend)||void 0===o?void 0:o.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(a=this._currentVideoSend)||void 0===a?void 0:a.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,Ux.rtcFirstFrame(s),this._videoFirstFrameState=wj.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===fx.AUDIO){if(this._audioFirstFrameState!==wj.BEGIN)return;if(!this._currentAudioSend)return;var i=this._currentAudioSend,r=i.type,n=i.startTime,o={event_type:px.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:r};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),Ux.rtcFirstFrame(o),this._audioFirstFrameState=wj.SENT}else if(e===fx.VIDEO){if(this._videoFirstFrameState!==wj.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;r=a.type,n=a.startTime,o={event_type:px.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?fx.SCREEN_VIDEO:e,start:n,result:!0,event_session_id:this._videoEventSessionId,type:r};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),Ux.rtcFirstFrame(o),this._videoFirstFrameState=wj.SENT}},e.prototype.setLogin=function(e){var t,i;this._login!==e&&(this._login=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(fx.VIDEO,_x.LOGIN),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(fx.AUDIO,_x.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(fx.AUDIO,vx.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(fx.VIDEO,vx.LEAVE_ROOM))},e.prototype.setPublish=function(e){var t,i;this._publish!==e&&(this._publish=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(fx.VIDEO,_x.PUBLISH),(null===(i=this._stream)||void 0===i?void 0:i.audioTrack)&&this.beginSendFrame(fx.AUDIO,_x.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(fx.AUDIO,vx.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(fx.VIDEO,vx.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(fx.AUDIO,_x.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(fx.AUDIO,vx.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(fx.AUDIO,_x.ENABLE),!e&&this._audioSending&&this.stopSendFrame(fx.AUDIO,vx.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(fx.VIDEO,_x.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(fx.VIDEO,vx.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(fx.VIDEO,_x.ENABLE),!e&&this._videoSending&&this.stopSendFrame(fx.VIDEO,vx.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(fx.AUDIO,vx.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(fx.AUDIO,vx.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(fx.AUDIO,_x.PUSH),!e&&this._audioSending&&this.stopSendFrame(fx.AUDIO,vx.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(fx.VIDEO,vx.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(fx.VIDEO,vx.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(fx.VIDEO,_x.PUSH),!e&&this._videoSending&&this.stopSendFrame(fx.VIDEO,vx.STOP_PUSH))},e.prototype.setAutoPublish=function(e){this._autoPublish=e},e.prototype.setPublisher=function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(fx.AUDIO,vx.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(fx.VIDEO,vx.AUDIENCE))},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype.setPCSessionId=function(e){this._pcSessionId=e},e.prototype.setHandler=function(e){this._handler=e},e.prototype._getFirstVideoFrameStats=function(){var e,t,i,r,n,o;return t_(this,void 0,void 0,(function(){var a;return i_(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(i=null===(t=this._stream)||void 0===t?void 0:t.videoTrack)||void 0===i?void 0:i.getTrack())?[4,XV(null===(r=this._handler)||void 0===r?void 0:r.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._getFirstAudioFrameStats=function(){var e,t,i,r,n,o;return t_(this,void 0,void 0,(function(){var a;return i_(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(i=null===(t=this._stream)||void 0===t?void 0:t.audioTrack)||void 0===i?void 0:i.getTrack())?[4,XV(null===(r=this._handler)||void 0===r?void 0:r.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._watchForFirstVideoFrameSend=function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval((function(){return t_(e,void 0,void 0,(function(){var e;return i_(this,(function(i){switch(i.label){case 0:return[4,this._getFirstVideoFrameStats()];case 1:if((e=i.sent())&&e.framesSent>t){if(-1===t)return t=e.framesSent,[2];this.sendFrameFinish(fx.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}return[2]}}))}))}),100)},e.prototype._watchForFirstAudioFrameSend=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return t_(e,void 0,void 0,(function(){var e;return i_(this,(function(i){switch(i.label){case 0:return[4,this._getFirstAudioFrameStats()];case 1:if((e=i.sent())&&e.packetsSent>t){if(-1===t)return t=e.packetsSent,[2];this.sendFrameFinish(fx.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}return[2]}}))}))}),100)},e.prototype.reset=function(){this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._audioFirstFrameState=wj.INITIAL,this._videoFirstFrameState=wj.INITIAL,this._currentAudioSend={startTime:0,eventSessionId:0,type:_x.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:_x.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)},e.prototype.destroy=function(){this.reset(),delete this._stream,delete this._handler},Object.defineProperty(e.prototype,"_audioSending",{get:function(){return this._audioFirstFrameState===wj.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===wj.BEGIN},enumerable:!1,configurable:!0}),e}();!function(e){e[e.UNKOWN=0]="UNKOWN",e[e.EXCELLENT=1]="EXCELLENT",e[e.GOOD=2]="GOOD",e[e.POOR=3]="POOR",e[e.BAD=4]="BAD",e[e.VBAD=5]="VBAD"}(kj||(kj={})),function(e){e[e.INVALID=0]="INVALID",e[e.GOOD=1]="GOOD",e[e.MEDIUM=2]="MEDIUM",e[e.POOR=3]="POOR"}(Dj||(Dj={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(Mj||(Mj={}));var Lj=((Pj={})[Mj.AUDIO]={delay:1200,stallRadio:.3},Pj[Mj.VIDEO]={delay:1200,stallRadio:.6},Pj[Mj.SCREEN_AUDIO]={delay:1600,stallRadio:.8},Pj[Mj.SCREEN_VIDEO]={delay:1600,stallRadio:.8},Pj),xj=function(){function e(){this._preUplinkStats=new Map,this._preDownlinkStats=new Map,this._connectionState=Sj.CONNECTED}return e.prototype.updateUplinkStats=function(e){var t=e.audioStats,i=e.videoStats,r=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var n=r?Mj.SCREEN_AUDIO:Mj.AUDIO,o=t.rtt,a=t._fractionLost,s=t._retransmittedRate,c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,o_(o_([],n_(u),!1),[c],!1).slice(-2))}if(i.sentKBitrate>0&&i.rtt){n=r?Mj.SCREEN_VIDEO:Mj.VIDEO,o=i.rtt,a=i._fractionLost;i.videoLossRate;var d=i._sendBandWidth;s=i._retransmittedRate;0===d&&(a=Math.max(.65,a));c=this._getQosLevel(o,a||0,s||0),u=this._preUplinkStats.get(n)||[c];this._preUplinkStats.set(n,o_(o_([],n_(u),!1),[c],!1).slice(-2))}this._startNetworkQualityReport()},e.prototype.updateDownlinkStats=function(e,t){if(t){var i,r,n=this._getStreamActiveState(t),o=n.audioActive,a=n.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId;if(o&&s.rtt)if(0===s.receivedKBitrate)i=Yf.VBAD;else{var l=s.rtt,h=s.audioLossRate,p=s.stallDuration,f=s.statsInterval,_=s.e2eDelay,v=p/f,m=u?Mj.SCREEN_AUDIO:Mj.AUDIO,y=this._getQosLevel(l,h||0,c._retransmittedRate||0),S=this._getDownlinkQoE(m,v,_);i=this._getNetworkQuality(y,S)}if(a)if(0===c.receivedKBitrate||0===c.rtt)r=Yf.VBAD;else{l=c.rtt;var g=c.videoLossRate,E=(p=c.stallDuration,f=c.statsInterval,_=c.e2eDelay,c._retransmittedRate);v=p/f,m=u?Mj.SCREEN_VIDEO:Mj.VIDEO,y=this._getQosLevel(l,g||0,E||0),S=this._getDownlinkQoE(m,v,_);r=this._getNetworkQuality(y,S)}var b=i&&r?Math.ceil((i+r)/2):i||r;if(b){var T="".concat(d).concat(u?"_screen":""),I=this._preDownlinkStats.get(T)||[b];this._preDownlinkStats.set(T,o_(o_([],n_(I),!1),[b],!1).slice(-2)),this._startNetworkQualityReport()}}},e.prototype.setConnectionState=function(e){this._connectionState=e},e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._delayTimer&&(window.clearTimeout(this._delayTimer),delete this._delayTimer),this._preUplinkStats.clear(),this._preDownlinkStats.clear()},e.prototype._startNetworkQualityReport=function(){var e=this;this._delayTimer||this._timer||(this._preUplinkStats.size>0||this._preDownlinkStats.size>0)&&(this._delayTimer=window.setTimeout((function(){delete e._delayTimer,e._reportNetworkQuality(),e._timer=window.setInterval((function(){e._reportNetworkQuality()}),2e3)}),300))},e.prototype._reportNetworkQuality=function(){var e,t,i=this;if(this._connectionState!==Sj.CONNECTED)e=t=Yf.VBAD;else{var r=this._getBetterQualityAndRemoveOldest(Mj.AUDIO,"up"),n=this._getBetterQualityAndRemoveOldest(Mj.VIDEO,"up");e=r&&n?Math.ceil((r+n)/2):r||n||this._getBetterQualityAndRemoveOldest(Mj.SCREEN_VIDEO,"up")||this._getBetterQualityAndRemoveOldest(Mj.SCREEN_AUDIO,"up")||Yf.UNKNOWN;var o=Array.from(this._preDownlinkStats.keys()).map((function(e){return i._getBetterQualityAndRemoveOldest(e,"down")})).filter((function(e){return e}));t=Math.ceil(o.reduce((function(e,t){return t+e}),0)/o.length)||Yf.UNKNOWN}this.reportor&&this.reportor(e,t)},e.prototype._getNetworkQuality=function(e,t){return t===Dj.GOOD?Math.max(e-2,1):t===Dj.MEDIUM?e:Math.min(e+1,5)},e.prototype._getQosLevel=function(e,t,i){var r;return r=e<=250&&t<=.15?kj.EXCELLENT:e<=500&&t<=.3?kj.GOOD:e<=750&&t<=.45?kj.POOR:e<=1e3&&t<=.6?kj.BAD:kj.VBAD,i>.5?r=Math.max(r,kj.BAD):i>.35?r=Math.max(r,kj.POOR):i>.15&&(r=Math.max(r,kj.GOOD)),r},e.prototype._getUplinkQoE=function(e,t){var i=Dj.INVALID;switch(e){case Mj.AUDIO:case Mj.VIDEO:i=t<.05?Dj.GOOD:t<.1?Dj.MEDIUM:Dj.POOR;break;case Mj.SCREEN_VIDEO:case Mj.SCREEN_AUDIO:i=t<.04?Dj.GOOD:t<.08?Dj.MEDIUM:Dj.POOR}return i},e.prototype._getDownlinkQoE=function(e,t,i){var r=Lj[e];return t>r.stallRadio||i>r.delay||t>r.stallRadio/2&&i>r.delay/2?Dj.POOR:(t>r.stallRadio/2||r.delay,Dj.MEDIUM)},e.prototype._getBetterQualityAndRemoveOldest=function(e,t){var i=Yf.UNKNOWN,r="up"===t?this._preUplinkStats:this._preDownlinkStats,n=r.get(e);if(n){var o=n.filter((function(e){return e}));o.length>0&&(i=Math.min.apply(Math,o_([],n_(o),!1))),n.shift(),0===n.length&&r.delete(e)}return i},e.prototype._getStreamActiveState=function(e){var t=e.subMediaType,i=e._attributes,r=e.subVideo;return{audioActive:e.subAudio&&bD(t)&&i.localaudio&&i.audiostream,videoActive:r&&TD(t)&&i.localvideo&&i.videostream}},e}(),Vj=function(){function e(e){this._room=e,this._remoteVideoSizeCache={},this._remoteScreenSizeCache={},this._start()}return e.prototype.destroy=function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}},e.prototype._start=function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},i={};e._room.remoteStreams.forEach((function(r,n){r.forEach((function(r){var o,a=null===(o=r.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=r.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[n]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,p=a.getSettings(),f=p.width,_=void 0===f?0:f,v=p.height,m=void 0===v?0:v;h===m&&d===_||e.onchange&&e.onchange(n,r.isScreen,_,m),delete s[n],(r.isScreen?i:t)[n]={width:_,height:m}}}))})),Object.keys(e._remoteVideoSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!1,0,0)})),Object.keys(e._remoteScreenSizeCache).forEach((function(t){e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=i}),1e3))},e}(),Fj=ba.every;Wr({target:"Array",proto:!0,forced:!jn("every")},{every:function(e){return Fj(this,e,arguments.length>1?arguments[1]:void 0)}});var Bj=new XD("SubscribeFallbackManager",2),jj=1e4,Gj=function(){function e(e){this._room=e,this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,this._inSubscribeRecoverChecking=!1,this._forbidSubRecover=!1,this._forbidSubRecoverDuration=jj}return e.prototype.updateNetworkQuality=function(e,t){this._preDownlinkNetworkQuality.push(t),this._preDownlinkNetworkQuality=this._preDownlinkNetworkQuality.slice(-10),this._inSubscribeRecoverChecking&&this._preDownlinkNetworkQuality.find((function(e){return e===Yf.BAD||e===Yf.VBAD}))&&this._startForbidSubRecover(),this._preDownlinkNetworkQuality.slice(-3).reduce((function(e,t){return e+t}),0)>3*Yf.POOR&&this._subscribeFallbackOrRecover("fallback"),!this._forbidSubRecover&&10===this._preDownlinkNetworkQuality.length&&this._preDownlinkNetworkQuality.every((function(e){return e===Yf.EXCELLENT}))&&this._subscribeFallbackOrRecover("recover")},e.prototype.destroy=function(){this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),delete this.onSubscribeFallback},e.prototype._subscribeFallbackOrRecover=function(e){return t_(this,void 0,void 0,(function(){var t,i,r,n,o,a,s,c,u,d=this;return i_(this,(function(l){switch(l.label){case 0:if(this._isSubscribeFallbackOrRecover||this._room.connectionState!==Sj.CONNECTED)return[2];if(this._room.subscribeFallbackOption!==Wf.AUDIO_ONLY&&this._room.subscribeFallbackOption!==Wf.VIDEO_STREAM_LOW)return[3,5];if(t=new Map,this._room.remoteStreams.forEach((function(i){i.forEach((function(i){if(i.hasSubscribed){var r="fallback"===e?i.getSubscribeFallbackParams(d._room.subscribeFallbackOption):i.getSubscribeRecoverParams();if(r){var n=i.getStreamPriority(),o=t.get(n)||[];o.push({stream:i,fallbackOrRecoverOption:r}),t.set(n,o)}}}))})),!(t.size>0))return[3,5];if(Bj.print("_subscribeFallbackOrRecover()","start subscribe ".concat(e,".")),i=Array.from(t.keys()).sort((function(e,t){return e-t}))["fallback"===e?0:t.size-1],r=n_(t.get(i)||[],1),!(n=r[0]))return[3,5];o=n.stream,a=n.fallbackOrRecoverOption,this._isSubscribeFallbackOrRecover=!0,s=o.subLayer.spatialLayer,c=o.subVideo,Bj.print("_subscribeFallbackOrRecover()","".concat(o.userId,"'s stream will be ").concat(e," to: MediaType=").concat(a[0]," subState=").concat(a[1]," subLayer=").concat(a[2])),l.label=1;case 1:return l.trys.push([1,3,,4]),[4,gD([(u=this._room).updateSubTrack.apply(u,o_([o],n_(a),!1)).then((function(){"recover"===e?d._startSubscribeRecoverCheck():Bj.print("_subscribeFallbackOrRecover()","fallback success."),d.onSubscribeFallback&&d.onSubscribeFallback({userId:o.userId,isScreen:o.isScreen,beforeEnable:c,beforeVideoIndex:s,afterEnable:o.subVideo,afterVideoIndex:o.subLayer.spatialLayer,reason:"fallback"===e?qf.SubscribeFallbackByBandwidth:qf.SubscribeRecoverByBandwidth})})),(h=2e3,new Promise((function(e){window.setTimeout(e,h)})))])];case 2:case 3:return l.sent(),[3,4];case 4:this._preDownlinkNetworkQuality=[],this._isSubscribeFallbackOrRecover=!1,l.label=5;case 5:return[2]}var h}))}))},e.prototype._startSubscribeRecoverCheck=function(){var e=this;this._stopSubscribeRecoverCheck(),this._inSubscribeRecoverChecking=!0,this._subRecoverCheckTimer=window.setTimeout((function(){e._inSubscribeRecoverChecking=!1,e._forbidSubRecoverDuration=jj,delete e._subRecoverCheckTimer,Bj.print("_subscribeFallbackOrRecover()","recover success.")}),2e4)},e.prototype._stopSubscribeRecoverCheck=function(){this._subRecoverCheckTimer&&(window.clearTimeout(this._subRecoverCheckTimer),delete this._subRecoverCheckTimer),this._inSubscribeRecoverChecking=!1},e.prototype._startForbidSubRecover=function(){var e=this;this._stopSubscribeRecoverCheck(),this._stopForbidSubRecover(),this._forbidSubRecoverDuration=Math.min(this._forbidSubRecoverDuration+2e4,12e4),Bj.print("_subscribeFallbackOrRecover()","subscribe-recover failed, and subscribe-recover not allowed within ".concat(this._forbidSubRecoverDuration/1e3,"s")),this._forbidSubRecover=!0,this._forbidSubRecoverTimer=window.setTimeout((function(){e._forbidSubRecover=!1,delete e._forbidSubRecoverTimer}),this._forbidSubRecoverDuration)},e.prototype._stopForbidSubRecover=function(){this._forbidSubRecoverTimer&&(window.clearTimeout(this._forbidSubRecoverTimer),delete this._forbidSubRecoverTimer)},e}(),Hj=new XD("Room",1),zj=function(e){function t(t,i){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._waitForNewToken=!1,r._userDuplicateLoginTimerMap=new Map,r._hasPublished=!1,r._roomConfig=t,r._mediaServerClient=new Rj(i),r._reconnectRecord=new Kj,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new xj,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(r),r._videoSizeObserver=new Vj(r),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(r),r._subFallbackManager=new Gj(r),r._subFallbackManager.onSubscribeFallback=r._emitSubscribeFallback.bind(r),r._context=i,r}return Cf(t,e),Object.defineProperty(t.prototype,"hasScreenPublished",{get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasPublished",{get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._mediaServerClient.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){return this._remoteUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){return this._remoteStreams},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localStream",{get:function(){return this._localStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenStream",{get:function(){return this._localScreenStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomInfo",{get:function(){return this._roomInfo},enumerable:!1,configurable:!0}),t.prototype._addHandlerEventHandler=function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,S,g,E,b,T=this;null===(e=this._mediaServerClient)||void 0===e||e.on(lV.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(lV.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(lV.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(lV.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(lV.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(lV.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(lV.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(lV.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(lV.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(lV.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(lV.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(lV.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(lV.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(lV.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(lV.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(lV.ON_SCENE_CONFIG,this._onSceneConfig.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(hV.RSCP,this._onPublishOnDemand.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(pV.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(pV.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on("onRemoteStreamStats",(function(e){T._networkQualityManager.updateDownlinkStats(e,T._findRemoteStreamByScreen(e.userId,e.isScreen)),T.emit(FB.ON_REMOTE_STREAM_STATS,ID(e))})),null===(g=this._mediaServerClient)||void 0===g||g.on("onLocalStreamStats",(function(e){T._networkQualityManager.updateUplinkStats(e),T.emit(FB.ON_LOCAL_STREAM_STATS,ID(e))})),null===(E=this._mediaServerClient)||void 0===E||E.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e})),null===(b=this._mediaServerClient)||void 0===b||b.on("prevIceNode",(function(e){T._getAccessFeedbackIceNode=e}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,i,r,n,o){return t_(this,void 0,void 0,(function(){var a=this;return i_(this,(function(s){return Vx.setStats({rtc_app_id:e,room_id:t,user_id:r.userId}),Hj.print("join()"),[2,new Promise((function(s,c){return t_(a,void 0,void 0,(function(){var a,u,d=this;return i_(this,(function(l){return this._joinResolveCallback=function(e){var t;Ux.joinRoom(Sx.END,a,!0,"",{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)},this._joinRejectCallback=function(e){var t;Ux.joinRoom(Sx.END,a,!1,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)},this._liveControlMessage=n,this._roomInfo={appId:e,roomId:t,token:i,userInfo:r,useCloudProxy:o,roomProfile:this._roomConfig.roomProfileType},a=sD(),this.setSessionId(),Ux.joinRoom(Sx.BEGIN,a,!1,"",{enable_cloud_proxy:null===(u=this._roomInfo)||void 0===u?void 0:u.useCloudProxy}),this._join(this._joinResolveCallback,this._joinRejectCallback,!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,i){return void 0===i&&(i=!1),t_(this,void 0,void 0,(function(){var r,n,o;return i_(this,(function(a){switch(a.label){case 0:r=sD(),Hj.print("_join()"),a.label=1;case 1:return a.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},i,this._liveControlMessage)];case 2:return n=a.sent(),this._mediaServerClient.roomAttributes=n.roomAttributes,this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e({users:n.clients,streams:n.streams}),this._isReconnecting=!1,Ux.rtcJoinRoom(0,"web","web",sD()-r),this._onJoinSucc(n,i),[3,4];case 3:return(o=a.sent()).code!==aP.OPERATION_CANCEL&&"function"==typeof t?[2,t(o)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,i,r,n){var o,a,s,c,u,d;return t_(this,void 0,void 0,(function(){var l,h,p,f;return i_(this,(function(_){switch(_.label){case 0:return Hj.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new $B,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new Uj(this._localScreenStream,this._mediaServerClient.handler))),l=!1,h=!1,p=!1,f=!1,!this._localScreenStream.videoTrack&&t?(t instanceof IB&&(h=!0),l=!0):this._localScreenStream.videoTrack&&!t&&(l=!1),!this._localScreenStream.audioTrack&&i?(i instanceof RB&&(f=!0),p=!0):this._localScreenStream.audioTrack&&!i&&(p=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=i,this._localScreenStream.videoEncodeConfig=e,r&&(bD(r)&&(this._localScreenStream.pubAudio=n===GB.PUB),TD(r)&&(this._localScreenStream.pubVideo=n===GB.PUB),Hj.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo?this._localScreenStream.hasPublished?[3,2]:(null===(a=this._localScreenStream.observer)||void 0===a||a.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]):(null===(o=this._localScreenStream)||void 0===o?void 0:o.hasPublished)?[2,this.unpublishScreen()]:[2];case 1:return _.sent(),[3,4];case 2:return h?null===(s=this._localScreenStream.observer)||void 0===s||s.setPushVideo(l):null===(c=this._localScreenStream.observer)||void 0===c||c.setEnableVideo(l),f?null===(u=this._localScreenStream.observer)||void 0===u||u.setPushAudio(p):null===(d=this._localScreenStream.observer)||void 0===d||d.setEnableAudio(p),[4,this.updatePubScreenTrack()];case 3:_.sent(),_.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return Hj.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),this._localScreenStream?[4,this._mediaServerClient.updatePubTrack(this._localScreenStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublishScreen=function(){var e;return t_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return Hj.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?(null===(e=this._localScreenStream.observer)||void 0===e||e.setPublish(!1),[4,this._mediaServerClient.unpublish(this._localScreenStream)]):[3,2];case 1:t.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,t.label=2;case 2:return[2]}}))}))},t.prototype.liveControlMessage=function(e){var t;return t_(this,void 0,void 0,(function(){var i=this;return i_(this,(function(r){switch(r.label){case 0:return Hj.print("controlMessage","Invoke controlMessage"),null===(t=e.transcodeMeta)||void 0===t||t.layout.regions.forEach((function(e){i.roomInfo&&(e.roomID=i.roomInfo.roomId)})),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return r.sent(),"stopped"===e.action&&delete this._liveControlMessage,[2]}}))}))},t.prototype.publicStreamControlMessage=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return"stopped"===e.action&&delete e.publicStreamMeta,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return Hj.print("updateUserAttributes","Invoke updateUserAttributes"),e.role&&this._roomInfo&&(this._roomInfo.userInfo.role=e.role),[4,this._mediaServerClient.updateUserAttributes(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.publish=function(e,t,i,r,n,o,a){var s,c,u,d,l,h;return void 0===a&&(a=!1),t_(this,void 0,void 0,(function(){var p,f,_,v,m,y;return i_(this,(function(S){switch(S.label){case 0:if(Hj.print("publish","Invoke publish"),p=!1,this._localStream||(this._localStream=new $B,this._mediaServerClient.handler&&(this._localStream.observer=new Uj(this._localStream,this._mediaServerClient.handler)),p=!0),this._localStream.videoTrack=i,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.enableSimulcast=t,n&&(bD(n)&&(this._localStream.pubAudio=o===GB.PUB),TD(n)&&(this._localStream.pubVideo=o===GB.PUB),Hj.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished)return[3,5];if(!this._localStream.pubAudio&&!this._localStream.pubVideo)return[2];S.label=1;case 1:return S.trys.push([1,3,,4]),a?null===(s=this._localStream.observer)||void 0===s||s.setLogin(!0):p&&(f=!!this._localStream.videoTrack,_=!!this._localStream.audioTrack,v=this._localStream.videoTrack instanceof IB,m=this._localStream.audioTrack instanceof RB,this._roomConfig.isAutoPublish&&!this._hasPublished?(f&&(v?null===(c=this._localStream.observer)||void 0===c||c.setPushVideo(!0):null===(u=this._localStream.observer)||void 0===u||u.setEnableVideo(!0)),_&&(m?null===(d=this._localStream.observer)||void 0===d||d.setPushAudio(!0):null===(l=this._localStream.observer)||void 0===l||l.setEnableAudio(!0))):null===(h=this._localStream.observer)||void 0===h||h.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return S.sent(),this._hasPublished=!0,this.emit(FB.ON_PUBLISH_RESULT,{isScreen:!1,state:Mf.PUBLISH_SUCC}),[3,4];case 3:throw y=S.sent(),this.emit(FB.ON_PUBLISH_RESULT,{isScreen:!1,state:Mf.PUBLISH_FAIL}),y;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:S.sent(),S.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return Hj.print("updatePubTrack","Invoke updatePubTrack"),this._localStream?[4,this._mediaServerClient.updatePubTrack(this._localStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublish=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return Hj.print("unpublish","Invoke unpublish"),this._localStream?[4,this._mediaServerClient.unpublish(this._localStream)]:[3,2];case 1:e.sent(),this._localStream.clean(),this._localStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.subscribe=function(e,t,i){return t_(this,void 0,void 0,(function(){var r;return i_(this,(function(n){switch(n.label){case 0:return Hj.print("subscribe","remoteStream %o",e),r=void 0,i&&(r=this._getSubLayer(i,e)),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,i,r){var n;return t_(this,void 0,void 0,(function(){return i_(this,(function(o){return Hj.print("updateSubTrack","Invoke updateSubTrack"),[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(e,t,i,r)]}))}))},t.prototype.updateSubVideoConfig=function(e,t){var i,r,n;return t_(this,void 0,void 0,(function(){var o,a;return i_(this,(function(s){return!(o=this._findRemoteStreamByScreen(e,!1))||!o.hasSubscribed||(null===(r=null===(i=null==o?void 0:o.attributes)||void 0===i?void 0:i.videoDescriptions)||void 0===r?void 0:r.length)<=1?[2]:(a=this._getSubLayer(t,o),o.originalStreamIndex=a.spatialLayer,[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(o,o.subMediaType,HB.SUB,a)])}))}))},t.prototype._getSubLayer=function(e,t){for(var i,r,n,o,a,s=null==t?void 0:t.attributes,c=s.videoDescriptions,u=s.subVideoDescriptions,d=Array.isArray(u)?u:c,l=-1,h=e.width*e.height,p=0;p<(null==d?void 0:d.length);p++)if(h>=(null===(i=d[p])||void 0===i?void 0:i.width)*(null===(r=d[p])||void 0===r?void 0:r.height)){l=p;break}var f=d[0];if(-1===l)f=d[l=d.length-1];else if(0!==l){var _=d[l-1].width*d[l-1].height,v=(_-h)/(_-d[l].width*d[l].height);f=v<.1?d[l-1]:d[l],l=v<.1?l-1:l}return a=null!==(n=null==f?void 0:f.sub_index)&&void 0!==n?n:-1,{spatialLayer:null!==(o=null==f?void 0:f.video_index)&&void 0!==o?o:l,spatialSubLayer:a}},t.prototype.unsubscribe=function(e,t){return t_(this,void 0,void 0,(function(){return i_(this,(function(i){switch(i.label){case 0:return Hj.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e,t)];case 1:return i.sent(),[2]}}))}))},t.prototype.leave=function(e){var t;return void 0===e&&(e=!1),t_(this,void 0,void 0,(function(){var i,r,n,o,a,s,c;return i_(this,(function(u){switch(u.label){case 0:Hj.print("leave","Invoke leave"),i=sD(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(r=r_(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())o=n.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(e){s={error:e}}finally{try{n&&!n.done&&(c=r.return)&&c.call(r)}finally{if(s)throw s.error}}return this._localStream&&(null===(t=this._localStream.observer)||void 0===t||t.setLogin(!1)),[4,this._mediaServerClient.leave()];case 2:return u.sent(),this.destroy(),Ux.rtcLeaveRoom(0,"",sD()-i),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&Ux.rtcLeaveRoom(-1,a.message,sD()-i),[3,4];case 4:return[2]}}))}))},t.prototype.setRemoteUserPriority=function(e,t){var i,r;null===(i=this.remoteStreams.get(e))||void 0===i||i.forEach((function(e){return e.setRemoteUserPriority(t)})),null===(r=this.userPriorityMap)||void 0===r||r.set(e,t)},t.prototype.destroy=function(){var e,t,i,r;Hj.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;try{for(var n=r_(this._remoteStreams),o=n.next();!o.done;o=n.next()){var a=n_(o.value,2)[1];Array.isArray(a)&&a.forEach((function(e){e&&e.clean()}))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._remoteStreams=new Map,this._localStream&&(null===(i=this._localStream)||void 0===i||i.clean(),this._localStream=void 0),this._localScreenStream&&(null===(r=this._localScreenStream)||void 0===r||r.clean(),this._localScreenStream=void 0),this._context=void 0,this._reconnectRecord=new Kj,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._subFallbackManager.destroy()},t.prototype.updateToken=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return Hj.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return t_(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return i_(this,(function(c){t=[];try{for(i=r_(this._remoteStreams.values()),r=i.next();!r.done;r=i.next())n=r.value,Array.isArray(n)&&n.forEach((function(i){if(i.hasSubscribed){var r=s.updateSubTrack(i,e,HB.UNSUB);r&&t.push(r)}}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return t_(this,void 0,void 0,(function(){var t,i,r,n,o,a,s=this;return i_(this,(function(c){t=[];try{for(i=r_(this._remoteStreams.values()),r=i.next();!r.done;r=i.next())n=r.value,Array.isArray(n)&&n.forEach((function(i){if(i.hasSubscribed&&i.hasSubscribed){var r=s.updateSubTrack(i,e,HB.SUB);r&&t.push(r)}}))}catch(e){o={error:e}}finally{try{r&&!r.done&&(a=i.return)&&a.call(i)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var i;return null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendUserMessage(e,t)},t.prototype.setSessionId=function(){this._sessionId=jk(),Vx.setStats({rtc_session_id:this._sessionId})},t.prototype.sendRoomMessage=function(e,t){var i,r;return void 0===t&&(t=!1),t_(this,void 0,void 0,(function(){var n,o;return i_(this,(function(a){switch(a.label){case 0:return n={clientId:null===(i=this._roomInfo)||void 0===i?void 0:i.userInfo.userId,binary:t,message:""},t?(o=n,[4,dD.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:n.message=e,a.label=3;case 3:return[2,null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendRoomMessage(n)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){Hj.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new Rj(this._context),this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var i,r,n,o,a,s=this;Hj.print("JoinSuccess()"),this._serverConfig=e.config;var c=[],u=[],d=[],l=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var i=s._remoteUsers.get(t.clientId);i?i._stillExist=!0:c.push(t)}}));try{for(var h=r_(this._remoteUsers.values()),p=h.next();!p.done;p=h.next()){var f=p.value;f._stillExist||u.push({clientId:f.userId}),delete f._stillExist}}catch(e){i={error:e}}finally{try{p&&!p.done&&(r=h.return)&&r.call(h)}finally{if(i)throw i.error}}e.streams.forEach((function(e){var t=s._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):l.push(e)}));try{for(var _=r_(this._remoteStreams.values()),v=_.next();!v.done;v=_.next()){var m=v.value;Array.isArray(m)&&m.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:uV.clientDisconnected})}))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(o=_.return)&&o.call(_)}finally{if(n)throw n.error}}setTimeout((function(){u.forEach((function(e){return s._onUserDisconnection(e)})),c.forEach((function(e){return s._onUserConnection(e)})),d.forEach((function(e){return s._onRemoveStream(e)})),l.forEach((function(e){return s._onAddStream(e,!0,!1)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,i=this;this._localStream&&(this._localStream.clean(),this._mediaServerClient.publish(this._localStream).catch((function(e){}))),this._localScreenStream&&(this._localScreenStream.clean(),this._mediaServerClient.publish(this._localScreenStream).catch((function(e){})));try{for(var r=r_(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return t_(i,void 0,void 0,(function(){var t;return i_(this,(function(i){switch(i.label){case 0:if(!e.hasSubscribed)return[3,4];e.resetHasSubscribed(),i.label=1;case 1:return i.trys.push([1,3,,4]),Hj.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType)];case 2:return i.sent(),Hj.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(FB.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=i.sent(),Hj.print("failed resubscribe ".concat(e.userId," with ").concat(e.subMediaType,", error:").concat(t)),e.clean(),null==e||e.resetHasSubscribed(),[3,4];case 4:return[2]}}))}))}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var i=this._remoteStreams.get(e);return Array.isArray(i)?i.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var i=this._remoteStreams.get(e);return Array.isArray(i)?i.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t,i){var r,n,o,a,s,c,u,d,l,h,p;if(void 0===t&&(t=!0),void 0===i&&(i=!0),e.clientId!==(null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId)){var f=this._findRemoteStream(e.clientId,e.streamId);if(!f){f=new ej(e.clientId,e.streamId,e.screen,e.attributes,null===(n=this.userPriorityMap)||void 0===n?void 0:n.get(e.clientId)),this._initStreamListeners(f);var _=this._remoteStreams.get(e.clientId);_?_.push(f):this._remoteStreams.set(e.clientId,[f])}if(this._mediaServerClient.handler&&(f.observer=new Nj(f,this._mediaServerClient.handler)),!f.isScreen&&(i&&f.hasVideo&&(f.attributes.extvideo?(null===(o=f.observer)||void 0===o||o.setExternalVideoSource(!0),null===(a=f.observer)||void 0===a||a.setPushVideo(!0)):(null===(s=f.observer)||void 0===s||s.setExternalVideoSource(!1),null===(c=f.observer)||void 0===c||c.setPublishVideo(!0))),i&&f.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(f.attributes.extaudio?(null===(u=f.observer)||void 0===u||u.setExternalAudioSource(!0),null===(d=f.observer)||void 0===d||d.setPushAudio(!0)):(null===(l=f.observer)||void 0===l||l.setExternalAudioSource(!1),null===(h=f.observer)||void 0===h||h.setPublishAudio(!0))),!0===t&&!1===i)){var v=this._roomConfig,m=v.isAutoSubscribeAudio,y=v.isAutoSubscribeVideo;null===(p=f.observer)||void 0===p||p.setLogin(!0,{audio:!!m,video:!!y})}return t&&this.safeEmit(lV.ON_ADD_STREAM,{stream:f}),f}},t.prototype._onUserConnection=function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var i=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof i)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(i);var r={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,$f({},r)),this.safeEmit(lV.USER_CONNECTION,{userInfo:r})}},t.prototype._onUserDisconnection=function(e){var t,i=this,r=e.clientId,n=e.tag,o=e.code;if(r)if(r===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;n===fV.kickedByAdmin?a=aP.KICKED_OUT:n===fV.onUserTokenDidExpire?a=aP.TOKEN_EXPIRED:n===fV.userDuplicateLogin&&(a=aP.DUPLICATE_LOGIN),o===_V.roomDismissByAdmin&&(a=aP.ROOM_DISMISS),a&&this.safeEmit(FB.ON_ROOM_ERROR,{errorCode:a})}else{var s=Nf.DROPPED;n===fV.userLeave?s=Nf.QUIT:n===fV.kickedByAdmin?s=Nf.KICKED_BY_ADMIN:n===fV.roleChanged&&(s=Nf.SWITCH_TO_INVISIBLE);var c=function(){i._remoteUsers.delete(r),i.safeEmit(FB.ON_USER_LEAVE,{userInfo:{userId:r},reason:s})};if(n===fV.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(r);null!=u||self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(r,d)}else c()}},t.prototype._onRemoveStream=function(e){var t,i,r,n,o=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=this._remoteStreams.get(e.clientId);if(a){var s=a.find((function(t){return t.streamId==e.streamId}));s&&(null===(i=this._mediaServerClient)||void 0===i||i.handleRemoveStream(s,e).then((function(){if(!(null==s?void 0:s._workaround_1_)){var t=o._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),o._remoteStreams.set(e.clientId,t)}})).finally((function(){o.safeEmit(lV.ON_REMOVE_STREAM,{stream:s,reason:e.message})})),s.hasVideo&&(null===(r=s.observer)||void 0===r||r.setPublishVideo(!1)),s.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(null===(n=s.observer)||void 0===n||n.setPublishAudio(!1)))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t,i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,S=e.clientId,g=e.streamId,E=e.attributes,b=this._findRemoteStream(S,g);if(b){var T=b.attributes,I=$f($f({},T),E),R=!1,A=I.localaudio!==T.localaudio,C=!1,O=!1,w=I.localvideo!==T.localvideo,N=!1,P=nB.NONE,k=nB.NONE;I.audiostream!==T.audiostream&&(R=I.localaudio,C=!!I.audiostream,I.audiostream?P|=Vf.AUDIO:k|=Vf.AUDIO),I.videostream!==T.videostream&&(O=I.localvideo,N=!!I.videostream,I.videostream?P|=Vf.VIDEO:k|=Vf.VIDEO),P&&this.safeEmit(FB.ON_USER_PUBLISH_STATE_CHANGE,{userId:S,mediaType:P,isScreen:b.isScreen,pubState:GB.PUB,remoteStream:b}),k&&this.safeEmit(FB.ON_USER_PUBLISH_STATE_CHANGE,{userId:S,mediaType:k,isScreen:b.isScreen,pubState:GB.UNPUB,remoteStream:b}),I.localaudio!==T.localaudio&&(I.localaudio?(I.extaudio?(null===(t=b.observer)||void 0===t||t.setExternalAudioSource(!0),null===(i=b.observer)||void 0===i||i.setPushAudio(!0)):(null===(r=b.observer)||void 0===r||r.setExternalAudioSource(!1),null===(n=b.observer)||void 0===n||n.setEnableAudio(!0)),this.safeEmit(FB.ON_USER_START_AUDIO_CAPTURE,{userId:S})):(I.extaudio?(null===(o=b.observer)||void 0===o||o.setExternalAudioSource(!0),null===(a=b.observer)||void 0===a||a.setPushAudio(!1)):(null===(s=b.observer)||void 0===s||s.setExternalAudioSource(!1),null===(c=b.observer)||void 0===c||c.setEnableAudio(!1)),!b.isScreen&&this.safeEmit(FB.ON_USER_STOP_AUDIO_CAPTURE,{userId:S}))),I.localvideo!==T.localvideo&&(I.localvideo?(I.extvideo?(null===(u=b.observer)||void 0===u||u.setExternalVideoSource(!0),null===(d=b.observer)||void 0===d||d.setPushVideo(!0)):(null===(l=b.observer)||void 0===l||l.setExternalVideoSource(!1),null===(h=b.observer)||void 0===h||h.setEnableVideo(!0)),this.safeEmit(FB.ON_USER_START_VIDEO_CAPTURE,{userId:S})):(I.extvideo?(null===(p=b.observer)||void 0===p||p.setExternalVideoSource(!0),null===(f=b.observer)||void 0===f||f.setPushVideo(!1)):(null===(_=b.observer)||void 0===_||_.setExternalVideoSource(!1),null===(v=b.observer)||void 0===v||v.setEnableVideo(!1)),!b.isScreen&&this.safeEmit(FB.ON_USER_STOP_VIDEO_CAPTURE,{userId:S}))),R&&!A&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!w&&(null===(y=b.observer)||void 0===y||y.setRemoteUnmuteVideo(N)),b.attributes=I}},t.prototype._onPushTrack=function(e){var t=this,i=e.clientId,r=e.streamId,n=this._findRemoteStream(i,r);n||(n=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){return t.safeEmit(FB.SUBSCRIBE_PUSH_TRACK,{stream:n})})).catch((function(e){Hj.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,i=e.clientId,r=e.streamId,n=e.message,o=this._findRemoteStream(i,r);o&&this._mediaServerClient.unsubscribe4removeTrack(o,n).then((function(){var e;if(o._workaround_1_){var n=null===(e=t._remoteStreams.get(i))||void 0===e?void 0:e.filter((function(e){return e.streamId!==r}));t._remoteStreams.set(i,n||[])}t.safeEmit(FB.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){Hj.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,i=e.nodes,r=e.reason;$x.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(i)&&i.length?this._getAccessNode=i[0]:this._getAccessFeedback=r,Ux.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(r)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,i=this;this._isReconnecting=!0;try{for(var r=r_(this._remoteStreams.values()),n=r.next();!n.done;n=r.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}Ux.rtcReconnect(1002,WL.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,XL.PEERCONNECTION),this._join((function(){Ux.rtcReconnected(YL.PEERCONNECTION_RECONNECTED,qL.PEERCONNECTION)}),(function(e){i._reconnectRecord.record(e),i._reconnectRecord.shouldReconnect?(Hj.print("Reconnecting error, will reconnect after 3s",e),i._reconnectTimer=window.setTimeout(i._reconnect.bind(i),3e3)):(i.safeEmit(FB.RECONNECT_FAILED),i.destroy())}),!0)},t.prototype._handleAbnormalDisconnection=function(){Hj.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t,i=this;if(e.next===Sj.DISCONNECTED)t=Bf.CONNECTION_STATE_DISCONNECTED;else if(e.next===Sj.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?Bf.CONNECTION_STATE_RECONNECTED:Bf.CONNECTION_STATE_CONNECTED;else{if(e.next!==Sj.CONNECTING)return;t=this._isReconnecting?Bf.CONNECTION_STATE_RECONNECTING:Bf.CONNECTION_STATE_CONNECTING}e.prev===Sj.CONNECTED&&e.next===Sj.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){i.safeEmit(pV.ON_CONNECTION_STATE_CHANGE,{state:Bf.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(pV.ON_CONNECTION_STATE_CHANGE,{state:t})},t.prototype._initStreamListeners=function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(i){var r;t.emit(FB.ON_SEI_MESSAGED_RECEIVED,{sei:i,remoteStreamKey:{userId:e.userId,roomId:null===(r=t._roomInfo)||void 0===r?void 0:r.roomId,streamIndex:e.isScreen?xf.STREAM_INDEX_SCREEN:xf.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(lV.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(lV.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(lV.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){if(e.body){var t=e.body,i=t.error||0,r=jB.START,n=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(r=jB.START_FAILED);break;case"TranscodeStateChanged":r=0!==t.error?jB.START_FAILED:jB.START_SUCCESS;break;case"TranscodeStopped":r=0!==t.error?jB.STOP_FAILED:jB.STOP_SUCCESS;break;case"TranscodeUpdated":r=0!==t.error?jB.UPDATE_FAILED:jB.UPDATE_SUCCESS}this.safeEmit(lV.POST_PROCESSING_MESSAGE,{code:i,protocol:t.protocol,error:t.error,eventType:r,message:n[i]})}this.safeEmit(lV.POST_PROCESSING_MESSAGE,{code:i,message:n[i],type:e.type})}},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(lV.ON_USER_TOKEN_WILL_EXPIRE,null)},t.prototype._onSceneConfig=function(e){var t,i,r=e.multiSceneConfig,n=gj[this._roomConfig.roomProfileType][1];if(r){var o=r[n];o&&o.engine_BAC&&(null===(t=this._context)||void 0===t||t.audioProfileManager.updateEngineBAC(o.engine_BAC)),o&&o.engine_ANM&&(null===(i=this._context)||void 0===i||i.audioProfileManager.updateEngineANM(o.engine_ANM))}},t.prototype._onStreamControlMessage=function(e){var t,i;e.type===dV.PushLimitWarn&&((null===(t=this._localStream)||void 0===t?void 0:t.pubAudio)||(null===(i=this._localStream)||void 0===i?void 0:i.pubVideo)||this.unpublish())},t.prototype._onPublishOnDemand=function(e){var t,i,r,n,o,a,s,c,u,d,l;if(!1!==(null===(r=null===(i=null===(t=this._serverConfig)||void 0===t?void 0:t.engine_VPM)||void 0===i?void 0:i.ondemand)||void 0===r?void 0:r.enable)&&(null===(n=this._localStream)||void 0===n?void 0:n.enableSimulcast)&&(null===(o=this._localStream)||void 0===o?void 0:o.videoTransceiver)){var h=null===(a=this._localStream)||void 0===a?void 0:a.stream.id,p=null===(s=this._localStream)||void 0===s?void 0:s.videoTransceiver.sender,f=p.getParameters();if(Array.isArray(f.encodings)&&Array.isArray(e)){var _={};Hj.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null===(t=null==e?void 0:e.StreamIds)||void 0===t?void 0:t.includes(h)){var i=null==e?void 0:e.Metadata.SubvideoIndex;_[i]=i}}));var v={};null===(u=null===(c=this._localStream)||void 0===c?void 0:c.subVideoDescriptions)||void 0===u||u.forEach((function(e){void 0!==_[e.sub_index]&&(v[e.video_index]=e)}));var m=(null===(l=null===(d=p.track)||void 0===d?void 0:d.getSettings())||void 0===l?void 0:l.height)||720,y=[];f.encodings=f.encodings.map((function(e){return e.rid&&(v[e.rid]?(e.active=!0,e.scaleResolutionDownBy=Math.max(m/v[e.rid].height,1),y.push({type:1,rid:e.rid,downBy:e.scaleResolutionDownBy})):(y.push({type:0,rid:e.rid}),e.active=!1)),e})),Ux.rtcInvokeStatus(JSON.stringify(y),0,"rscp",h,0)}p.setParameters(f)}},t.prototype._reportNetworkQuality=function(e,t){this._subFallbackManager.updateNetworkQuality(e,t),this.emit(FB.ON_NETWORK_QUALITY,e,t)},t.prototype._emitVideoSizeChange=function(e,t,i,r){var n;this.emit(FB.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(n=this.roomInfo)||void 0===n?void 0:n.roomId,userId:e,streamIndex:t?xf.STREAM_INDEX_SCREEN:xf.STREAM_INDEX_MAIN},{width:i,height:r})},t.prototype._emitSubscribeFallback=function(e){this.emit(FB.ON_SIMULCAST_SUBSCRIBE_FALLBACK,e)},t}(qD),Kj=function(){function e(){this._all_201_count=0,this._has_4xx=!1}return Object.defineProperty(e.prototype,"shouldReconnect",{get:function(){return!(this._all_201_count>=3||this._has_4xx)},enumerable:!1,configurable:!0}),e.prototype.record=function(e){var t=!1,i=!1;if(Array.isArray(e)){var r=0;e.map((function(e){var t,n,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(n=e.error)||void 0===n?void 0:n.code)<500&&(i=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&r++})),r===e.length&&(t=!0),t&&this._all_201_count++,i&&(this._has_4xx=!0)}},e.prototype.clear=function(){this._all_201_count=0,this._has_4xx=!1},e}(),Wj=function(e,t){void 0===t&&(t={});var i=document.createElement(e);return t.id&&(i.id=t.id),t.classList&&t.classList.forEach((function(e){i.classList.add(e)})),t.style&&Object.assign(i.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=n_(e,2),r=t[0],n=t[1];"muted"===r?i.muted=!0:i.setAttribute(r,n)})),i},Xj=function(e,t){return void 0===t&&(t={}),t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var i=n_(t,2),r=i[0],n=i[1];e.setAttribute(r,n)})),e},Yj=new XD("Player",0),qj=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],Jj={playsinline:"","webkit-playsinline":""},Qj={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},Zj=new(function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var i="audio"===e?Jj:Qj;if("video"===e&&this.videoCache.length>0){if(r=this.videoCache.pop())return Xj(r,{style:t,attributes:i}),r}else if("audio"===e&&this.audioCache.length>0){var r;if(r=this.audioCache.pop())return Xj(r,{style:t,attributes:i}),r}return Wj(e,{style:t,attributes:i})},e.prototype.recycle=function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)},e}()),$j=function(e){function t(t){var i=e.call(this)||this;i.mirrorType=jf.MIRROR_TYPE_NONE,i.played=!1,i._emitPlayFailed=!1,i.emitVideoEvent=function(e){var t,r,n={type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:e.type,currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0,isScreen:i.isScreen};i.emit("playback_event",n)},i._internalPlay=function(){var e;if(null===(e=i._videoDom)||void 0===e?void 0:e.paused){var t=i._videoDom.play();(null==t?void 0:t.then)&&t.catch((function(e){var t,r;i._emitPlayFailed||(i._emitPlayFailed=!0,Ux.rtcError("video autoplay failed, userId: ".concat(i.userId),-1e3),i.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(t=i._videoDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:"autoplay-error",currentTime:(null===(r=i._videoDom)||void 0===r?void 0:r.currentTime)||0}))}))}};var r=t.renderDom,n=t.userId;i.renderMode=void 0!==t.renderMode?t.renderMode:Lf.RENDER_MODE_FIT;var o="string"==typeof r?document.getElementById(r):r;if(!o)throw new lP(aP.CANT_FIND_DOM,"can't find dom");return i._containerDom=o,i.userId=n,i.isScreen=!!t.isScreen,i._initVideo(),i}return Cf(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=Zj.getOrCreate("video",{width:"100%",height:"100%"}),this._videoDom.id="".concat(this.userId,"_").concat(aD()),this.renderMode===Lf.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===jf.MIRROR_TYPE_RENDER)),this._containerDom.appendChild(this._videoDom),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&qj.forEach((function(t){var i;null===(i=e._videoDom)||void 0===i||i.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._videoDom&&(qj.forEach((function(t){var i;null===(i=e._videoDom)||void 0===i||i.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(i){var r;if("timeupdate"===i.eventName){var n=e.isScreen?1.5:.5;if(0===(null===(r=t._videoDom)||void 0===r?void 0:r.currentTime))return;if(void 0===t.__cumulativeTime)return void(t.__cumulativeTime=t._videoDom.currentTime);if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>n;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var i;return t_(this,void 0,void 0,(function(){var r,n,o=this;return i_(this,(function(a){return r=this._videoDom,Yj.print("playVideo","play video track: ".concat(this.userId)),r&&r.srcObject instanceof MediaStream&&r.srcObject.getTrackById(null===(i=e.getTrack())||void 0===i?void 0:i.id)||(r||(this._initVideo(),r=this._videoDom),Yj.print("playVideo","play video by dom: ".concat(null==r?void 0:r.id)),(n=new MediaStream).addTrack(e.getTrack()),r.srcObject=n,r&&!this._containerDom.contains(r)&&this._containerDom.appendChild(r),r.addEventListener("canplay",this._internalPlay),r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return o._internalPlay()})),t&&this._recordFrame(t),this.played=!0),[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var i=new MediaStream;i.addTrack(t),this._videoDom.srcObject=i}},t.prototype.manuallyPlay=function(){if(Yj.print("Invoke VideoPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._videoDom)throw new lP(aP.INVALID_PARAMS,"Player not found");return this._videoDom.play()},t.prototype.mirror=function(e){Yj.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?jf.MIRROR_TYPE_RENDER:jf.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;Yj.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0,this.played=!1},t.prototype.destroy=function(){Yj.print("destroy","video player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._videoDom&&(Zj.recycle(this._videoDom),delete this._videoDom)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(GD.exports.EventEmitter),eG=function(e){function t(t,i){var r=void 0===i?{divId:void 0,muted:!1}:i,n=r.divId,o=r.muted,a=e.call(this)||this;if(a.muted=!1,a._emitPlayFailed=!1,a.played=!1,a.emitAudioEvent=function(e){var t,i,r={type:"audio",rawEvent:e,readyState:(null===(t=a._audioDom)||void 0===t?void 0:t.readyState)||0,userId:a.userId,eventName:e.type,currentTime:(null===(i=a._audioDom)||void 0===i?void 0:i.currentTime)||0};a.emit("playback_event",r)},a._internalPlay=function(){var e,t;if(zx("_internalPlay",{paused:null===(e=a._audioDom)||void 0===e?void 0:e.paused}),null===(t=a._audioDom)||void 0===t?void 0:t.paused)try{var i=a._audioDom.play();(null==i?void 0:i.then)&&i.catch((function(e){a._autoPlayError(e)})).then((function(){zx("_internalPlay successfully",{userId:a.userId})}))}catch(e){a._autoPlayError(e)}},n){var s=document.getElementById(n);if(!s)throw new lP(aP.CANT_FIND_DOM,"can't find dom");a._containerDom=s}else a._containerDom=document.body;return a.userId=t,a.muted=o,a._initAudio(),a}return Cf(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=Zj.getOrCreate("audio",{display:"none"}),this._audioDom.volume=this.muted?0:1,this._audioDom.id="".concat(this.userId,"_").concat(aD()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&qj.forEach((function(t){var i;null===(i=e._audioDom)||void 0===i||i.addEventListener(t,e.emitAudioEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(qj.forEach((function(t){var i;null===(i=e._audioDom)||void 0===i||i.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return t_(this,void 0,void 0,(function(){var i,r,n=this;return i_(this,(function(o){return Yj.print("playAudio","play audio track: ".concat(this.userId)),(i=this._audioDom)&&i.srcObject instanceof MediaStream&&i.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)||(i||(this._initAudio(),i=this._audioDom),(r=new MediaStream).addTrack(e.getTrack()),i.srcObject=r,null==i||i.addEventListener("canplay",this._internalPlay),null==i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return n._internalPlay()})),this.played=!0),[2]}))}))},t.prototype._autoPlayError=function(e){var t,i;this._emitPlayFailed||(this._emitPlayFailed=!0,Ux.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(i=this._audioDom)||void 0===i?void 0:i.currentTime)||0}))},t.prototype.manuallyPlay=function(){var e;if(Yj.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new lP(aP.INVALID_PARAMS,"Player not found");null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return(null==t?void 0:t.then)?t:Promise.resolve(t)},t.prototype.setPlaybackDevice=function(e){return t_(this,void 0,void 0,(function(){var t;return i_(this,(function(i){switch(i.label){case 0:return Yj.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,aB.enumerateAudioPlaybackDevices()];case 1:return t=i.sent(),t.map((function(e){return e.deviceId})).includes(e)&&this._audioDom&&this._audioDom.setSinkId?[4,this._audioDom.setSinkId(e)]:[2];case 2:return i.sent(),[2]}}))}))},t.prototype.stop=function(){var e=this._containerDom;Yj.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){Yj.print("destroy","audio player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._audioDom&&(Zj.recycle(this._audioDom),delete this._audioDom)},t}(GD.exports.EventEmitter),tG=function(){function e(){this.userMessage={},this.roomMessage={},this._setTimer()}return e.prototype._setTimer=function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()},e.prototype._reportAndgReset=function(){this._report(),this._reset()},e.prototype._report=function(){var e=this;Ux.rtcMessageStatistics(Object.keys(this.userMessage).map((function(t){return e.userMessage[t]})),Object.keys(this.roomMessage).map((function(t){return e.roomMessage[t]})),"")},e.prototype._reset=function(){this.userMessage={},this.roomMessage={}},e.prototype._checkInitUserMessage=function(e,t){this.userMessage["".concat(t,"-").concat(e)]||(this.userMessage["".concat(t,"-").concat(e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_cost_time:0,dc_cost_e2s:0,dc_cost_s2s:0,dc_least_time:1/0,dc_most_time:0,dc_cost_peer_s2e:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_message_type:t,dc_send_binary:0})},e.prototype._sendUserMessage=function(e,t,i){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_send_total++,i&&this.userMessage["".concat(t,"-").concat(e)].dc_send_binary++},e.prototype._recvUserMessage=function(e,t){this._checkInitUserMessage(e,t),this.userMessage["".concat(t,"-").concat(e)].dc_recv_total++},e.prototype._sendUserFail=function(e,t){var i=this.userMessage["".concat(t,"-").concat(e)];i&&i.dc_send_fail++},e.prototype._sendUserAck=function(e,t,i,r,n){var o=this.userMessage["".concat(t,"-").concat(e)];o&&(o.dc_send_ack++,o.dc_cost_time+=i,o.dc_cost_s2s+=r||0,o.dc_cost_peer_s2e+=n,o.dc_cost_e2s+=i-(r||0)-n,i<=100?(o.dc_send_ack_100++,o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=200?(o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=400?(o.dc_send_ack_400++,o.dc_send_ack_1s++):i<=1e3&&o.dc_send_ack_1s++,i<o.dc_least_time&&(o.dc_least_time=i),i>o.dc_most_time&&(o.dc_most_time=i))},e.prototype.sendRoomMessage=function(e,t){this.roomMessage[e]||(this.roomMessage[e]={dc_room_id:e,dc_send_total:0,dc_send_ack:0,dc_cost_time:0,dc_least_time:1/0,dc_most_time:0,dc_send_fail:0,dc_send_ack_100:0,dc_send_ack_200:0,dc_send_ack_400:0,dc_send_ack_1s:0,dc_send_binary:0}),this.roomMessage[e].dc_send_total++,t&&this.roomMessage[e].dc_send_binary++},e.prototype.sendRoomFail=function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++},e.prototype.sendRoomAck=function(e,t){var i=this.roomMessage[e];i&&(i.dc_send_ack++,i.dc_cost_time+=t,t<i.dc_least_time&&(i.dc_least_time=t),t>i.dc_most_time&&(i.dc_most_time=t),t<=100?(i.dc_send_ack_100++,i.dc_send_ack_200++,i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=200?(i.dc_send_ack_200++,i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=400?(i.dc_send_ack_400++,i.dc_send_ack_1s++):t<=1e3&&i.dc_send_ack_1s++)},e.prototype.sendP2PMessage=function(e,t){this._sendUserMessage(e,Ix.P2P,t)},e.prototype.recvP2PMessage=function(e){this._recvUserMessage(e,Ix.P2P)},e.prototype.sendP2PFail=function(e){this._sendUserFail(e,Ix.P2P)},e.prototype.sendP2PAck=function(e,t,i,r){this._sendUserAck(e,Ix.P2P,t,i,r)},e.prototype.sendP2POutRoomMessage=function(e,t){this._sendUserMessage(e,Ix.P2P_OUTSIDE_ROOM,t)},e.prototype.recvP2POutRoomMessage=function(e){this._recvUserMessage(e,Ix.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomFail=function(e){this._sendUserFail(e,Ix.P2P_OUTSIDE_ROOM)},e.prototype.sendP2POutRoomAck=function(e,t,i,r){this._sendUserAck(e,Ix.P2P_OUTSIDE_ROOM,t,i,r)},e.prototype.sendP2serverMessage=function(e){this._sendUserMessage("",Ix.P2SERVER,e)},e.prototype.sendP2serverFail=function(){this._sendUserFail("",Ix.P2SERVER)},e.prototype.sendP2serveAck=function(e){this._sendUserAck("",Ix.P2SERVER,e,0,0)},e.prototype.countP2PMessage=function(e,t,i,r,n){this.sendP2PMessage(t,i),e?this.sendP2PAck(t,Date.now()-r,n.s2s_time,n.s2e_time):this.sendP2PFail(t)},e.prototype.countRoomMessage=function(e,t,i,r){this.sendRoomMessage(t,i),e?this.sendRoomAck(t,Date.now()-r):this.sendRoomFail(t)},e.prototype.countUserMessageOutsideRoom=function(e,t,i,r,n){this.sendP2POutRoomMessage(t,i),e?this.sendP2POutRoomAck(t,Date.now()-r,n.s2s_time,n.s2e_time):this.sendP2POutRoomFail(t)},e.prototype.countServerMessage=function(e,t,i){this.sendP2serverMessage(t),e?this.sendP2serveAck(Date.now()-i):this.sendP2serverFail()},e.prototype.destroy=function(){this._reset(),clearTimeout(this._timer)},e}(),iG="object"==("undefined"==typeof global?"undefined":t(global))&&global&&global.Object===Object&&global,rG="object"==("undefined"==typeof self?"undefined":t(self))&&self&&self.Object===Object&&self,nG=iG||rG||Function("return this")(),oG=nG.Symbol,aG=Object.prototype,sG=aG.hasOwnProperty,cG=aG.toString,uG=oG?oG.toStringTag:void 0;var dG=Object.prototype.toString;var lG=oG?oG.toStringTag:void 0;function hG(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":lG&&lG in Object(e)?function(e){var t=sG.call(e,uG),i=e[uG];try{e[uG]=void 0;var r=!0}catch(e){}var n=cG.call(e);return r&&(t?e[uG]=i:delete e[uG]),n}(e):function(e){return dG.call(e)}(e)}function pG(e){return null!=e&&"object"==t(e)}var fG=Array.isArray;function _G(e){var i=t(e);return null!=e&&("object"==i||"function"==i)}function vG(e){return e}function mG(e){if(!_G(e))return!1;var t=hG(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var yG=nG["__core-js_shared__"],SG=function(){var e=/[^.]+$/.exec(yG&&yG.keys&&yG.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var gG=Function.prototype.toString;var EG=/^\[object .+?Constructor\]$/,bG=Function.prototype,TG=Object.prototype,IG=bG.toString,RG=TG.hasOwnProperty,AG=RegExp("^"+IG.call(RG).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function CG(e){return!(!_G(e)||(t=e,SG&&SG in t))&&(mG(e)?AG:EG).test(function(e){if(null!=e){try{return gG.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function OG(e,t,i){switch(i.length){case 0:return e.call(t);case 1:return e.call(t,i[0]);case 2:return e.call(t,i[0],i[1]);case 3:return e.call(t,i[0],i[1],i[2])}return e.apply(t,i)}var wG=Date.now;var NG,PG,kG,DG=function(){try{var e=function(e,t){var i=function(e,t){return null==e?void 0:e[t]}(e,t);return CG(i)?i:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),MG=DG,UG=MG?function(e,t){return MG(e,"toString",{configurable:!0,enumerable:!1,value:(i=t,function(){return i}),writable:!0});var i}:vG,LG=(NG=UG,PG=0,kG=0,function(){var e=wG(),t=16-(e-kG);if(kG=e,t>0){if(++PG>=800)return arguments[0]}else PG=0;return NG.apply(void 0,arguments)}),xG=LG,VG=/^(?:0|[1-9]\d*)$/;function FG(e,i){var r=t(e);return!!(i=null==i?9007199254740991:i)&&("number"==r||"symbol"!=r&&VG.test(e))&&e>-1&&e%1==0&&e<i}function BG(e,t,i){"__proto__"==t&&MG?MG(e,t,{configurable:!0,enumerable:!0,value:i,writable:!0}):e[t]=i}function jG(e,t){return e===t||e!=e&&t!=t}var GG=Object.prototype.hasOwnProperty;function HG(e,t,i){var r=e[t];GG.call(e,t)&&jG(r,i)&&(void 0!==i||t in e)||BG(e,t,i)}var zG=Math.max;function KG(e,t){return xG(function(e,t,i){return t=zG(void 0===t?e.length-1:t,0),function(){for(var r=arguments,n=-1,o=zG(r.length-t,0),a=Array(o);++n<o;)a[n]=r[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=r[n];return s[t]=i(a),OG(e,this,s)}}(e,t,vG),e+"")}function WG(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function XG(e){return null!=e&&WG(e.length)&&!mG(e)}var YG=Object.prototype;function qG(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||YG)}function JG(e){return pG(e)&&"[object Arguments]"==hG(e)}var QG=Object.prototype,ZG=QG.hasOwnProperty,$G=QG.propertyIsEnumerable,eH=JG(function(){return arguments}())?JG:function(e){return pG(e)&&ZG.call(e,"callee")&&!$G.call(e,"callee")},tH=eH;var iH="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,rH=iH&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,nH=rH&&rH.exports===iH?nG.Buffer:void 0,oH=(nH?nH.isBuffer:void 0)||function(){return!1},aH={};aH["[object Float32Array]"]=aH["[object Float64Array]"]=aH["[object Int8Array]"]=aH["[object Int16Array]"]=aH["[object Int32Array]"]=aH["[object Uint8Array]"]=aH["[object Uint8ClampedArray]"]=aH["[object Uint16Array]"]=aH["[object Uint32Array]"]=!0,aH["[object Arguments]"]=aH["[object Array]"]=aH["[object ArrayBuffer]"]=aH["[object Boolean]"]=aH["[object DataView]"]=aH["[object Date]"]=aH["[object Error]"]=aH["[object Function]"]=aH["[object Map]"]=aH["[object Number]"]=aH["[object Object]"]=aH["[object RegExp]"]=aH["[object Set]"]=aH["[object String]"]=aH["[object WeakMap]"]=!1;var sH="object"==("undefined"==typeof exports?"undefined":t(exports))&&exports&&!exports.nodeType&&exports,cH=sH&&"object"==("undefined"==typeof module?"undefined":t(module))&&module&&!module.nodeType&&module,uH=cH&&cH.exports===sH&&iG.process,dH=function(){try{var e=cH&&cH.require&&cH.require("util").types;return e||uH&&uH.binding&&uH.binding("util")}catch(e){}}(),lH=dH&&dH.isTypedArray,hH=lH?function(e){return function(t){return e(t)}}(lH):function(e){return pG(e)&&WG(e.length)&&!!aH[hG(e)]},pH=hH,fH=Object.prototype.hasOwnProperty;function _H(e,t){var i=fG(e),r=!i&&tH(e),n=!i&&!r&&oH(e),o=!i&&!r&&!n&&pH(e),a=i||r||n||o,s=a?function(e,t){for(var i=-1,r=Array(e);++i<e;)r[i]=t(i);return r}(e.length,String):[],c=s.length;for(var u in e)!t&&!fH.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||FG(u,c))||s.push(u);return s}var vH=function(e,t){return function(i){return e(t(i))}}(Object.keys,Object),mH=vH,yH=Object.prototype.hasOwnProperty;function SH(e){return XG(e)?_H(e):function(e){if(!qG(e))return mH(e);var t=[];for(var i in Object(e))yH.call(e,i)&&"constructor"!=i&&t.push(i);return t}(e)}var gH=Object.prototype.hasOwnProperty;function EH(e){if(!_G(e))return function(e){var t=[];if(null!=e)for(var i in Object(e))t.push(i);return t}(e);var t=qG(e),i=[];for(var r in e)("constructor"!=r||!t&&gH.call(e,r))&&i.push(r);return i}var bH,TH=(bH=function(e,t){!function(e,t,i,r){var n=!i;i||(i={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=r?r(i[s],e[s],s,i,e):void 0;void 0===c&&(c=e[s]),n?BG(i,s,c):HG(i,s,c)}}(t,function(e){return XG(e)?_H(e,!0):EH(e)}(t),e)},KG((function(e,i){var r=-1,n=i.length,o=n>1?i[n-1]:void 0,a=n>2?i[2]:void 0;for(o=bH.length>3&&"function"==typeof o?(n--,o):void 0,a&&function(e,i,r){if(!_G(r))return!1;var n=t(i);return!!("number"==n?XG(r)&&FG(i,r.length):"string"==n&&i in r)&&jG(r[i],e)}(i[0],i[1],a)&&(o=n<3?void 0:o,n=1),e=Object(e);++r<n;){var s=i[r];s&&bH(e,s,r,o)}return e}))),IH=TH;function RH(e,t){return function(e,t){for(var i=-1,r=null==e?0:e.length,n=Array(r);++i<r;)n[i]=t(e[i],i,e);return n}(t,(function(t){return e[t]}))}function AH(e){return null==e?[]:RH(e,SH(e))}var CH=a,OH=$e("iterator"),wH=!CH((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,i="";return e.pathname="c%20d",t.forEach((function(e,r){t.delete("b"),i+=r+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[OH]||"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"!==i||"x"!==new URL("http://x",void 0).host})),NH=I,PH=2147483647,kH=/[^\0-\u007E]/,DH=/[.\u3002\uFF0E\uFF61]/g,MH="Overflow: input needs wider integers to process",UH=n.RangeError,LH=NH(DH.exec),xH=Math.floor,VH=String.fromCharCode,FH=NH("".charCodeAt),BH=NH([].join),jH=NH([].push),GH=NH("".replace),HH=NH("".split),zH=NH("".toLowerCase),KH=function(e){return e+22+75*(e<26)},WH=function(e,t,i){var r=0;for(e=i?xH(e/700):e>>1,e+=xH(e/t);e>455;)e=xH(e/35),r+=36;return xH(r+36*e/(e+38))},XH=function(e){var t=[];e=function(e){for(var t=[],i=0,r=e.length;i<r;){var n=FH(e,i++);if(n>=55296&&n<=56319&&i<r){var o=FH(e,i++);56320==(64512&o)?jH(t,((1023&n)<<10)+(1023&o)+65536):(jH(t,n),i--)}else jH(t,n)}return t}(e);var i,r,n=e.length,o=128,a=0,s=72;for(i=0;i<e.length;i++)(r=e[i])<128&&jH(t,VH(r));var c=t.length,u=c;for(c&&jH(t,"-");u<n;){var d=PH;for(i=0;i<e.length;i++)(r=e[i])>=o&&r<d&&(d=r);var l=u+1;if(d-o>xH((PH-a)/l))throw UH(MH);for(a+=(d-o)*l,o=d,i=0;i<e.length;i++){if((r=e[i])<o&&++a>PH)throw UH(MH);if(r==o){for(var h=a,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var _=h-f,v=36-f;jH(t,VH(KH(f+_%v))),h=xH(_/v),p+=36}jH(t,VH(KH(h))),s=WH(a,l,u==c),a=0,u++}}a++,o++}return BH(t,"")},YH=Wr,qH=n,JH=W,QH=l,ZH=I,$H=wH,ez=Yt.exports,tz=rc,iz=Go,rz=Ph,nz=Oi,oz=lc,az=B,sz=xe,cz=Wo,uz=lo,dz=Dt,lz=G,hz=fo,pz=Rn,fz=y,_z=Oc,vz=Ec,mz=lu,yz=bI,Sz=$e("iterator"),gz="URLSearchParams",Ez="URLSearchParamsIterator",bz=nz.set,Tz=nz.getterFor(gz),Iz=nz.getterFor(Ez),Rz=JH("fetch"),Az=JH("Request"),Cz=JH("Headers"),Oz=Az&&Az.prototype,wz=Cz&&Cz.prototype,Nz=qH.RegExp,Pz=qH.TypeError,kz=qH.decodeURIComponent,Dz=qH.encodeURIComponent,Mz=ZH("".charAt),Uz=ZH([].join),Lz=ZH([].push),xz=ZH("".replace),Vz=ZH([].shift),Fz=ZH([].splice),Bz=ZH("".split),jz=ZH("".slice),Gz=/\+/g,Hz=Array(4),zz=function(e){return Hz[e-1]||(Hz[e-1]=Nz("((?:%[\\da-f]{2}){"+e+"})","gi"))},Kz=function(e){try{return kz(e)}catch(t){return e}},Wz=function(e){var t=xz(e,Gz," "),i=4;try{return kz(t)}catch(e){for(;i;)t=xz(t,zz(i--),Kz);return t}},Xz=/[!'()~]|%20/g,Yz={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},qz=function(e){return Yz[e]},Jz=function(e){return xz(Dz(e),Xz,qz)},Qz=rz((function(e,t){bz(this,{type:Ez,iterator:_z(Tz(e).entries),kind:t})}),"Iterator",(function(){var e=Iz(this),t=e.kind,i=e.iterator.next(),r=i.value;return i.done||(i.value="keys"===t?r.key:"values"===t?r.value:[r.key,r.value]),i}),!0),Zz=function(e){this.entries=[],this.url=null,void 0!==e&&(lz(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===Mz(e,0)?jz(e,1):e:hz(e)))};Zz.prototype={type:gz,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,i,r,n,o,a,s,c=vz(e);if(c)for(i=(t=_z(e,c)).next;!(r=QH(i,t)).done;){if(o=(n=_z(dz(r.value))).next,(a=QH(o,n)).done||(s=QH(o,n)).done||!QH(o,n).done)throw Pz("Expected sequence with length 2");Lz(this.entries,{key:hz(a.value),value:hz(s.value)})}else for(var u in e)sz(e,u)&&Lz(this.entries,{key:u,value:hz(e[u])})},parseQuery:function(e){if(e)for(var t,i,r=Bz(e,"&"),n=0;n<r.length;)(t=r[n++]).length&&(i=Bz(t,"="),Lz(this.entries,{key:Wz(Vz(i)),value:Wz(Uz(i,"="))}))},serialize:function(){for(var e,t=this.entries,i=[],r=0;r<t.length;)e=t[r++],Lz(i,Jz(e.key)+"="+Jz(e.value));return Uz(i,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var $z=function(){oz(this,eK);var e=arguments.length>0?arguments[0]:void 0;bz(this,new Zz(e))},eK=$z.prototype;if(tz(eK,{append:function(e,t){mz(arguments.length,2);var i=Tz(this);Lz(i.entries,{key:hz(e),value:hz(t)}),i.updateURL()},delete:function(e){mz(arguments.length,1);for(var t=Tz(this),i=t.entries,r=hz(e),n=0;n<i.length;)i[n].key===r?Fz(i,n,1):n++;t.updateURL()},get:function(e){mz(arguments.length,1);for(var t=Tz(this).entries,i=hz(e),r=0;r<t.length;r++)if(t[r].key===i)return t[r].value;return null},getAll:function(e){mz(arguments.length,1);for(var t=Tz(this).entries,i=hz(e),r=[],n=0;n<t.length;n++)t[n].key===i&&Lz(r,t[n].value);return r},has:function(e){mz(arguments.length,1);for(var t=Tz(this).entries,i=hz(e),r=0;r<t.length;)if(t[r++].key===i)return!0;return!1},set:function(e,t){mz(arguments.length,1);for(var i,r=Tz(this),n=r.entries,o=!1,a=hz(e),s=hz(t),c=0;c<n.length;c++)(i=n[c]).key===a&&(o?Fz(n,c--,1):(o=!0,i.value=s));o||Lz(n,{key:a,value:s}),r.updateURL()},sort:function(){var e=Tz(this);yz(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,i=Tz(this).entries,r=cz(e,arguments.length>1?arguments[1]:void 0),n=0;n<i.length;)r((t=i[n++]).value,t.key,this)},keys:function(){return new Qz(this,"keys")},values:function(){return new Qz(this,"values")},entries:function(){return new Qz(this,"entries")}},{enumerable:!0}),ez(eK,Sz,eK.entries,{name:"entries"}),ez(eK,"toString",(function(){return Tz(this).serialize()}),{enumerable:!0}),iz($z,gz),YH({global:!0,forced:!$H},{URLSearchParams:$z}),!$H&&az(Cz)){var tK=ZH(wz.has),iK=ZH(wz.set),rK=function(e){if(lz(e)){var t,i=e.body;if(uz(i)===gz)return t=e.headers?new Cz(e.headers):new Cz,tK(t,"content-type")||iK(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),pz(e,{body:fz(0,hz(i)),headers:fz(0,t)})}return e};if(az(Rz)&&YH({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Rz(e,arguments.length>1?rK(arguments[1]):{})}}),az(Az)){var nK=function(e){return oz(this,Oz),new Az(e,arguments.length>1?rK(arguments[1]):{})};Oz.constructor=nK,nK.prototype=Oz,YH({global:!0,forced:!0},{Request:nK})}}var oK,aK={URLSearchParams:$z,getState:Tz},sK=Wr,cK=s,uK=wH,dK=n,lK=Wo,hK=I,pK=tn.f,fK=Yt.exports,_K=lc,vK=xe,mK=Vn,yK=JP,SK=Ro,gK=Sp.codeAt,EK=function(e){var t,i,r=[],n=HH(GH(zH(e),DH,"."),".");for(t=0;t<n.length;t++)i=n[t],jH(r,LH(kH,i)?"xn--"+XH(i):i);return BH(r,".")},bK=fo,TK=Go,IK=lu,RK=aK,AK=Oi,CK=AK.set,OK=AK.getterFor("URL"),wK=RK.URLSearchParams,NK=RK.getState,PK=dK.URL,kK=dK.TypeError,DK=dK.parseInt,MK=Math.floor,UK=Math.pow,LK=hK("".charAt),xK=hK(/./.exec),VK=hK([].join),FK=hK(1..toString),BK=hK([].pop),jK=hK([].push),GK=hK("".replace),HK=hK([].shift),zK=hK("".split),KK=hK("".slice),WK=hK("".toLowerCase),XK=hK([].unshift),YK="Invalid scheme",qK="Invalid host",JK="Invalid port",QK=/[a-z]/i,ZK=/[\d+-.a-z]/i,$K=/\d/,eW=/^0x/i,tW=/^[0-7]+$/,iW=/^\d+$/,rW=/^[\da-f]+$/i,nW=/[\0\t\n\r #%/:<>?@[\\\]^|]/,oW=/[\0\t\n\r #/:<>?@[\\\]^|]/,aW=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,sW=/[\t\n\r]/g,cW=function(e){var t,i,r,n;if("number"==typeof e){for(t=[],i=0;i<4;i++)XK(t,e%256),e=MK(e/256);return VK(t,".")}if("object"==typeof e){for(t="",r=function(e){for(var t=null,i=1,r=null,n=0,o=0;o<8;o++)0!==e[o]?(n>i&&(t=r,i=n),r=null,n=0):(null===r&&(r=o),++n);return n>i&&(t=r,i=n),t}(e),i=0;i<8;i++)n&&0===e[i]||(n&&(n=!1),r===i?(t+=i?":":"::",n=!0):(t+=FK(e[i],16),i<7&&(t+=":")));return"["+t+"]"}return e},uW={},dW=mK({},uW,{" ":1,'"':1,"<":1,">":1,"`":1}),lW=mK({},dW,{"#":1,"?":1,"{":1,"}":1}),hW=mK({},lW,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),pW=function(e,t){var i=gK(e,0);return i>32&&i<127&&!vK(t,e)?e:encodeURIComponent(e)},fW={ftp:21,file:null,http:80,https:443,ws:80,wss:443},_W=function(e,t){var i;return 2==e.length&&xK(QK,LK(e,0))&&(":"==(i=LK(e,1))||!t&&"|"==i)},vW=function(e){var t;return e.length>1&&_W(KK(e,0,2))&&(2==e.length||"/"===(t=LK(e,2))||"\\"===t||"?"===t||"#"===t)},mW=function(e){return"."===e||"%2e"===WK(e)},yW={},SW={},gW={},EW={},bW={},TW={},IW={},RW={},AW={},CW={},OW={},wW={},NW={},PW={},kW={},DW={},MW={},UW={},LW={},xW={},VW={},FW=function(e,t,i){var r,n,o,a=bK(e);if(t){if(n=this.parse(a))throw kK(n);this.searchParams=null}else{if(void 0!==i&&(r=new FW(i,!0)),n=this.parse(a,null,r))throw kK(n);(o=NK(new wK)).bindURL(this),this.searchParams=o}};FW.prototype={type:"URL",parse:function(e,t,i){var r,n,o,a,s,c=this,u=t||yW,d=0,l="",h=!1,p=!1,f=!1;for(e=bK(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=GK(e,aW,"")),e=GK(e,sW,""),r=yK(e);d<=r.length;){switch(n=r[d],u){case yW:if(!n||!xK(QK,n)){if(t)return YK;u=gW;continue}l+=WK(n),u=SW;break;case SW:if(n&&(xK(ZK,n)||"+"==n||"-"==n||"."==n))l+=WK(n);else{if(":"!=n){if(t)return YK;l="",u=gW,d=0;continue}if(t&&(c.isSpecial()!=vK(fW,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&fW[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=PW:c.isSpecial()&&i&&i.scheme==c.scheme?u=EW:c.isSpecial()?u=RW:"/"==r[d+1]?(u=bW,d++):(c.cannotBeABaseURL=!0,jK(c.path,""),u=LW)}break;case gW:if(!i||i.cannotBeABaseURL&&"#"!=n)return YK;if(i.cannotBeABaseURL&&"#"==n){c.scheme=i.scheme,c.path=SK(i.path),c.query=i.query,c.fragment="",c.cannotBeABaseURL=!0,u=VW;break}u="file"==i.scheme?PW:TW;continue;case EW:if("/"!=n||"/"!=r[d+1]){u=TW;continue}u=AW,d++;break;case bW:if("/"==n){u=CW;break}u=UW;continue;case TW:if(c.scheme=i.scheme,n==oK)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=SK(i.path),c.query=i.query;else if("/"==n||"\\"==n&&c.isSpecial())u=IW;else if("?"==n)c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=SK(i.path),c.query="",u=xW;else{if("#"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=SK(i.path),c.path.length--,u=UW;continue}c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,c.path=SK(i.path),c.query=i.query,c.fragment="",u=VW}break;case IW:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=i.username,c.password=i.password,c.host=i.host,c.port=i.port,u=UW;continue}u=CW}else u=AW;break;case RW:if(u=AW,"/"!=n||"/"!=LK(l,d+1))continue;d++;break;case AW:if("/"!=n&&"\\"!=n){u=CW;continue}break;case CW:if("@"==n){h&&(l="%40"+l),h=!0,o=yK(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||f){var m=pW(v,hW);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(n==oK||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=yK(l).length+1,l="",u=OW}else l+=n;break;case OW:case wW:if(t&&"file"==c.scheme){u=DW;continue}if(":"!=n||p){if(n==oK||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return qK;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=MW,t)return;continue}"["==n?p=!0:"]"==n&&(p=!1),l+=n}else{if(""==l)return qK;if(a=c.parseHost(l))return a;if(l="",u=NW,t==wW)return}break;case NW:if(!xK($K,n)){if(n==oK||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var y=DK(l,10);if(y>65535)return JK;c.port=c.isSpecial()&&y===fW[c.scheme]?null:y,l=""}if(t)return;u=MW;continue}return JK}l+=n;break;case PW:if(c.scheme="file","/"==n||"\\"==n)u=kW;else{if(!i||"file"!=i.scheme){u=UW;continue}if(n==oK)c.host=i.host,c.path=SK(i.path),c.query=i.query;else if("?"==n)c.host=i.host,c.path=SK(i.path),c.query="",u=xW;else{if("#"!=n){vW(VK(SK(r,d),""))||(c.host=i.host,c.path=SK(i.path),c.shortenPath()),u=UW;continue}c.host=i.host,c.path=SK(i.path),c.query=i.query,c.fragment="",u=VW}}break;case kW:if("/"==n||"\\"==n){u=DW;break}i&&"file"==i.scheme&&!vW(VK(SK(r,d),""))&&(_W(i.path[0],!0)?jK(c.path,i.path[0]):c.host=i.host),u=UW;continue;case DW:if(n==oK||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&_W(l))u=UW;else if(""==l){if(c.host="",t)return;u=MW}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=MW}continue}l+=n;break;case MW:if(c.isSpecial()){if(u=UW,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=oK&&(u=UW,"/"!=n))continue}else c.fragment="",u=VW;else c.query="",u=xW;break;case UW:if(n==oK||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(s=WK(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||jK(c.path,"")):mW(l)?"/"==n||"\\"==n&&c.isSpecial()||jK(c.path,""):("file"==c.scheme&&!c.path.length&&_W(l)&&(c.host&&(c.host=""),l=LK(l,0)+":"),jK(c.path,l)),l="","file"==c.scheme&&(n==oK||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)HK(c.path);"?"==n?(c.query="",u=xW):"#"==n&&(c.fragment="",u=VW)}else l+=pW(n,lW);break;case LW:"?"==n?(c.query="",u=xW):"#"==n?(c.fragment="",u=VW):n!=oK&&(c.path[0]+=pW(n,uW));break;case xW:t||"#"!=n?n!=oK&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":pW(n,uW)):(c.fragment="",u=VW);break;case VW:n!=oK&&(c.fragment+=pW(n,dW))}d++}},parseHost:function(e){var t,i,r;if("["==LK(e,0)){if("]"!=LK(e,e.length-1))return qK;if(t=function(e){var t,i,r,n,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return LK(e,l)};if(":"==h()){if(":"!=LK(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=i=0;i<4&&xK(rW,h());)t=16*t+DK(h(),16),l++,i++;if("."==h()){if(0==i)return;if(l-=i,u>6)return;for(r=0;h();){if(n=null,r>0){if(!("."==h()&&r<4))return;l++}if(!xK($K,h()))return;for(;xK($K,h());){if(o=DK(h(),10),null===n)n=o;else{if(0==n)return;n=10*n+o}if(n>255)return;l++}c[u]=256*c[u]+n,2!=++r&&4!=r||u++}if(4!=r)return;break}if(":"==h()){if(l++,!h())return}else if(h())return;c[u++]=t}else{if(null!==d)return;l++,d=++u}}if(null!==d)for(a=u-d,u=7;0!=u&&a>0;)s=c[u],c[u--]=c[d+a-1],c[d+--a]=s;else if(8!=u)return;return c}(KK(e,1,-1)),!t)return qK;this.host=t}else if(this.isSpecial()){if(e=EK(e),xK(nW,e))return qK;if(t=function(e){var t,i,r,n,o,a,s,c=zK(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(i=[],r=0;r<t;r++){if(""==(n=c[r]))return e;if(o=10,n.length>1&&"0"==LK(n,0)&&(o=xK(eW,n)?16:8,n=KK(n,8==o?1:2)),""===n)a=0;else{if(!xK(10==o?iW:8==o?tW:rW,n))return e;a=DK(n,o)}jK(i,a)}for(r=0;r<t;r++)if(a=i[r],r==t-1){if(a>=UK(256,5-t))return null}else if(a>255)return null;for(s=BK(i),r=0;r<i.length;r++)s+=i[r]*UK(256,3-r);return s}(e),null===t)return qK;this.host=t}else{if(xK(oW,e))return qK;for(t="",i=yK(e),r=0;r<i.length;r++)t+=pW(i[r],uW);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return vK(fW,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&_W(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,i=e.username,r=e.password,n=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==n?(u+="//",e.includesCredentials()&&(u+=i+(r?":"+r:"")+"@"),u+=cW(n),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+VK(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw kK(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+"://"+cW(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(bK(e)+":",yW)},getUsername:function(){return this.username},setUsername:function(e){var t=yK(bK(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var i=0;i<t.length;i++)this.username+=pW(t[i],hW)}},getPassword:function(){return this.password},setPassword:function(e){var t=yK(bK(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var i=0;i<t.length;i++)this.password+=pW(t[i],hW)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?cW(e):cW(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,OW)},getHostname:function(){var e=this.host;return null===e?"":cW(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,wW)},getPort:function(){var e=this.port;return null===e?"":bK(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=bK(e))?this.port=null:this.parse(e,NW))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+VK(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,MW))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=bK(e))?this.query=null:("?"==LK(e,0)&&(e=KK(e,1)),this.query="",this.parse(e,xW)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=bK(e))?("#"==LK(e,0)&&(e=KK(e,1)),this.fragment="",this.parse(e,VW)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var BW=function(e){var t=_K(this,jW),i=IK(arguments.length,1)>1?arguments[1]:void 0,r=CK(t,new FW(e,!1,i));cK||(t.href=r.serialize(),t.origin=r.getOrigin(),t.protocol=r.getProtocol(),t.username=r.getUsername(),t.password=r.getPassword(),t.host=r.getHost(),t.hostname=r.getHostname(),t.port=r.getPort(),t.pathname=r.getPathname(),t.search=r.getSearch(),t.searchParams=r.getSearchParams(),t.hash=r.getHash())},jW=BW.prototype,GW=function(e,t){return{get:function(){return OK(this)[e]()},set:t&&function(e){return OK(this)[t](e)},configurable:!0,enumerable:!0}};if(cK&&pK(jW,{href:GW("serialize","setHref"),origin:GW("getOrigin"),protocol:GW("getProtocol","setProtocol"),username:GW("getUsername","setUsername"),password:GW("getPassword","setPassword"),host:GW("getHost","setHost"),hostname:GW("getHostname","setHostname"),port:GW("getPort","setPort"),pathname:GW("getPathname","setPathname"),search:GW("getSearch","setSearch"),searchParams:GW("getSearchParams"),hash:GW("getHash","setHash")}),fK(jW,"toJSON",(function(){return OK(this).serialize()}),{enumerable:!0}),fK(jW,"toString",(function(){return OK(this).serialize()}),{enumerable:!0}),PK){var HW=PK.createObjectURL,zW=PK.revokeObjectURL;HW&&fK(BW,"createObjectURL",lK(HW,PK)),zW&&fK(BW,"revokeObjectURL",lK(zW,PK))}TK(BW,"URL"),sK({global:!0,forced:!uK,sham:!cK},{URL:BW});var KW,WW=function(e,t){return t_(void 0,void 0,void 0,(function(){var i;return i_(this,(function(r){switch(r.label){case 0:i=new Audio(URL.createObjectURL(new Blob([e],t))),r.label=1;case 1:return r.trys.push([1,3,,4]),i.muted=!0,[4,i.play()];case 2:return r.sent(),i.pause(),[2,!0];case 3:return r.sent(),[2,!1];case 4:return[2]}}))}))},XW=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this._failedAudioList=[],this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],this._context=e,this._localGainNode.gain.value=1}return e.prototype.mixMediaStream=function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)},e.prototype.startAudioMixing=function(e,t,i){return t_(this,void 0,void 0,(function(){var r,n,o,a,s,c,u,d,l,h,p,f,_,v,m=this;return i_(this,(function(y){switch(y.label){case 0:if(r=i.playCount,kD(n=i.type,"mixingType",AH(s_)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=hB(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:c_.AUDIO_MIXING_STATE_STOPPED,error:sP.AUDIO_MIXING_ERROR_OK});try{s.gainNode.disconnect(this._audioDestination),s.audioSource.disconnect(s.gainNode)}catch(e){}}return(u=this.resourcesCache.get(e))&&u.filePath===t?(c=u.getAudioNode(),[3,4]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw m._context.emitMessage({mixId:e,state:c_.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_START_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:return d=y.sent(),l=void 0,t.endsWith("mp3")?l={type:"audio/mpeg"}:t.endsWith("aac")&&(l={type:"audio/aac"}),[4,WW(d,l)];case 3:if(!y.sent())throw this._context.emitMessage({mixId:e,state:c_.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_START_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,"invalid audio resource");(c=new Audio).crossOrigin="anonymous",c.src=URL.createObjectURL(new Blob([d],l)),y.label=4;case 4:r<=0?c.loop=!0:r>0&&(h=r,c.onended=function(){--h>0?c.play():(m.mixingMap.delete(e),m._context.emitMessage({mixId:e,state:c_.AUDIO_MIXING_STATE_FINISHED,error:sP.AUDIO_MIXING_ERROR_OK}))}),y.label=5;case 5:return y.trys.push([5,7,,8]),[4,c.play()];case 6:return y.sent(),[3,8];case 7:return p=y.sent(),console.error(p),this._failedAudioList.push(c),this._context.onAutoPlayFailed(),[3,8];case 8:if(f=this._sharedAudioContext.createMediaElementSource(c),_=this._sharedAudioContext.createGain(),v=this.volumeConfig.get(e),_.gain.value=v?v/100:1,f.connect(_).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:f,audioNode:c,gainNode:_,type:"file"}),n===s_.PUBLISH)try{_.disconnect(this._sharedAudioContext.destination)}catch(e){}else _.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],i.type),this._context.emitMessage({mixId:e,state:c_.AUDIO_MIXING_STATE_PLAYING,error:sP.AUDIO_MIXING_ERROR_OK}),[2]}}))}))},e.prototype.stopAudioMixing=function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.emitMessage({mixId:e,state:c_.AUDIO_MIXING_STATE_STOPPED,error:sP.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:c_.AUDIO_MIXING_STATE_PAUSED,error:sP.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())},e.prototype.resumeAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:c_.AUDIO_MIXING_STATE_PLAYING,error:sP.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return t_(this,void 0,void 0,(function(){var i,r=this;return i_(this,(function(n){switch(n.label){case 0:return this.stopAudioMixing(e),[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw r._context.emitMessage({mixId:e,state:c_.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(t){throw r._context.emitMessage({mixId:e,state:c_.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,"Load resources failed",t)}))];case 1:return i=n.sent(),[4,WW(i)];case 2:if(!n.sent())throw this._context.emitMessage({mixId:e,state:c_.AUDIO_MIXING_STATE_FAILED,error:sP.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new lP(aP.LOAD_RESOURCES_FAILED,"Load resources failed");return this._context.emitMessage({mixId:e,state:c_.AUDIO_MIXING_STATE_PRELOADED,error:sP.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(e,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([i])))},filePath:t}),[2]}}))}))},e.prototype.unloadAudioMixing=function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)},e.prototype.getAudioMixingVolume=function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0},e.prototype.setAudioMixingVolume=function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var i=this.mixingMap.get(e);i&&(i.gainNode.gain.value=Number(t)/100)},e.prototype.getAudioMixingDuration=function(e){var t=this.mixingMap.get(e),i=this.mixingMap.get(e);return t||i?t?1e3*t.audioNode.duration:i?1e3*i.audioNode.duration:0:0},e.prototype.getAudioMixingCurrentPosition=function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0},e.prototype.setAudioMixingPosition=function(e,t){var i=this.mixingMap.get(e);i&&(i.audioNode.currentTime=t/1e3,i.audioNode.play())},e.prototype.enableAudioMixingBuffer=function(e){kD(e,"type",AH(s_));var t=this._context.getLocalAudioTrack();if(t){var i=hB(t.getTrack());if(i&&this.mixMediaStream(i),e===s_.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:c_.AUDIO_MIXING_STATE_PCM_ENABLED,error:sP.AUDIO_MIXING_ERROR_OK})}},e.prototype.disableAudioMixingBuffer=function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:c_.AUDIO_MIXING_STATE_PCM_DISABLED,error:sP.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;if(!(this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0))){this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode);try{this._audioBufferSource.start()}catch(e){this._failedAudioList.push(this._audioBufferSource)}this._audioBufferSource.onended=function(){var e;if(null===(e=t._audioBufferSource)||void 0===e||e.disconnect(t._bufferGainNode),t._audioBufferSource=void 0,t.cachedBuffer.length){var i=t.cachedBuffer.shift();i&&t.pushAudioMixingBuffer(i)}}}},e.prototype.stopAll=function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(e){}this.mixingMap.forEach((function(t,i){e.stopAudioMixing(i)}))},Object.defineProperty(e.prototype,"mixTrack",{get:function(){return this._audioDestination.stream.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sharedAudioContext",{get:function(){return this._sharedAudioContext},enumerable:!1,configurable:!0}),e.prototype.resumeLocalPlay=function(){return t_(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s;return i_(this,(function(c){switch(c.label){case 0:e=[],c.label=1;case 1:c.trys.push([1,10,11,12]),t=r_(this._failedAudioList),i=t.next(),c.label=2;case 2:if(i.done)return[3,9];r=i.value,c.label=3;case 3:return c.trys.push([3,7,,8]),r instanceof HTMLAudioElement?(r.muted=!1,[4,r.play()]):[3,5];case 4:return c.sent(),[3,6];case 5:r.start(),c.label=6;case 6:return[3,8];case 7:return n=c.sent(),e.push(r),console.error(n),this._context.onAutoPlayFailed(),[3,9];case 8:return i=t.next(),[3,2];case 9:return[3,12];case 10:return o=c.sent(),a={error:o},[3,12];case 11:try{i&&!i.done&&(s=t.return)&&s.call(t)}finally{if(a)throw a.error}return[7];case 12:return this._failedAudioList=e,[2]}}))}))},e.prototype.destroy=function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()},e_([Gx("default","id","filePath","options")],e.prototype,"startAudioMixing",null),e_([Gx("default","id")],e.prototype,"stopAudioMixing",null),e_([Gx("default","id")],e.prototype,"pauseAudioMixing",null),e_([Gx("default","id")],e.prototype,"resumeAudioMixing",null),e_([Gx("default","id")],e.prototype,"preloadAudioMixing",null),e_([Gx("default","id")],e.prototype,"unloadAudioMixing",null),e_([Gx("default","id")],e.prototype,"getAudioMixingVolume",null),e_([Gx("default","id","volume")],e.prototype,"setAudioMixingVolume",null),e_([Gx("default","id")],e.prototype,"getAudioMixingDuration",null),e_([Gx("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),e_([Gx("default","id","position")],e.prototype,"setAudioMixingPosition",null),e_([Gx("default","type")],e.prototype,"enableAudioMixingBuffer",null),e_([Gx()],e.prototype,"disableAudioMixingBuffer",null),e_([Gx("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(KW||(KW={}));var YW=new XD("RTMClient",1),qW=function(e){function t(t){var i=e.call(this)||this;return i._appId=t,i._dataChannelSignal=null,i._handler=null,i._dataChannelSignalState=Sj.DISCONNECTED,i._loginSessionId=null,i._userId=null,i._token=null,i._isReconnecting=!1,i._reconnectTimer=null,i._loginResolveCallback=null,i._loginRejectCallback=null,i._iceConfigNode=null,i._wait_login_token=!1,i}return Cf(t,e),t.prototype.login=function(e,t){var i=this;return new Promise((function(r,n){if(YW.print("login","invoke login, token: %o, userId: %o",e,t),i._loginSessionId)throw new lP(aP.ALREADY_LOGIN,"Already logined");if(i._loginResolveCallback)throw new lP(aP.LOGIN_FAILED,"Is logging in, please try again later.");i._userId=t,i._token=e,Fx.setStats({rtc_app_id:i._appId,user_id:t}),i._loginResolveCallback=r,i._loginRejectCallback=n,i._dataChannelSignal?i._login():(YW.print("login","init dataChannelSingling"),i._dataChannelSignalState=Sj.CONNECTING,i._createDataChannelSignaling(t).then((function(e){i._dataChannelSignal=e,i._login()})).catch((function(){i._onDisconnect()})))}))},t.prototype.logout=function(){var e;return t_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new lP(aP.NOT_LOGIN,"login first");return[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:RV.C2RTM}).catch((function(){}))];case 1:return t.sent(),this._closeDataChannelSignaling(),this._clearState(),[2]}}))}))},t.prototype.updateLoginToken=function(e){return t_(this,void 0,void 0,(function(){var t=this;return i_(this,(function(i){return this._token=e,[2,new Promise((function(e,i){t._wait_login_token?(t._loginResolveCallback=e,t._loginRejectCallback=i,t._login()):e()}))]}))}))},t.prototype.getPeerOnlineStatus=function(e){return t_(this,void 0,void 0,(function(){var t;return i_(this,(function(i){switch(i.label){case 0:if(!this._loginSessionId||!this._userId)throw new lP(aP.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:RV.C2RTM})];case 1:return[2,null==(t=i.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return t_(this,void 0,void 0,(function(){return i_(this,(function(i){if(!this._loginSessionId||!this._userId)throw new lP(aP.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})]}))}))},t.prototype.setServerParams=function(e,t){return t_(this,void 0,void 0,(function(){var i;return i_(this,(function(r){switch(r.label){case 0:if(r.trys.push([0,2,,3]),PD(e,"signature"),PD(t,"url"),!this._loginSessionId||!this._userId)throw new lP(aP.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:e,url:t},{functionType:RV.C2RTM}).catch((function(e){throw new lP(aP.UNEXPECTED_ERROR,e.msg)}))];case 1:return r.sent(),this._serverParamsCache={signature:e,url:t},this.emit("onServerParamsSetResult"),[3,3];case 2:throw i=r.sent(),this.emit("onServerParamsSetResult",i),i;case 3:return[2]}}))}))},t.prototype.sendServerMessage=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){if(!this._loginSessionId||!this._userId)throw new lP(aP.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[2,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:yV.BUSINESS_SERVER,msg:e})]}))}))},t.prototype.destroy=function(){this._clearState(),this._closeDataChannelSignaling(),e.prototype.removeAllListeners.call(this),delete this._serverParamsCache},t.prototype._login=function(){var e=this;if(this._userId){var t=aD();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:dD.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:TV.VERSION,deviceId:$x.getDeviceId(),appId:this._appId,userId:this._userId},accessParams:JSON.stringify({requireICEUfragV2:!0})},{functionType:RV.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1,e._serverParamsCache&&e.setServerParams(e._serverParamsCache.signature,e._serverParamsCache.url)})).catch((function(t){var i,r,n=t||{},o=n.code,a=n.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(i=aP.INVALID_PARAMS,r="Invalid userId"):(i=aP.INVALID_TOKEN,r="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(i=aP.LOGIN_FAILED,r="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new lP(i,a||r))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){var t,i;return t_(this,void 0,void 0,(function(){var r,n,o,a,s,c,u=this;return i_(this,(function(d){switch(d.label){case 0:if(r=new PV,n=this._iceConfigNode)return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,null==r?void 0:r.getAccessNode(this._appId,"",e,$x.getDeviceId(),"")];case 2:if(o=d.sent(),!(n=o[0]))throw new Error;return[3,4];case 3:throw d.sent(),zx("rtm.login.getNodeFailed","",0,!0),new lP(aP.ICE_SERVER_WRONG,"get ICE config failed");case 4:zx("rtm.login.getNodeSuccess",n,0,!0),YW.print("_createDataChannelSignaling()","get node success",n),this._handler=_j(Lx),null===(t=this._handler)||void 0===t||t.once("disconnect",(function(){YW.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),u._onDisconnect()})),d.label=5;case 5:return d.trys.push([5,7,,8]),[4,null===(i=this._handler)||void 0===i?void 0:i.connect(n)];case 6:return a=d.sent(),YW.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=Sj.CONNECTED,[3,8];case 7:throw s=d.sent(),this._iceConfigNode=null,this._dataChannelSignalState=Sj.DISCONNECTED,new lP(aP.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 8:return c=new OV(a),YW.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){YW.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(lV.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(lV.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(lV.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(lV.NODE_CHANGE,(function(e){zx("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(u._iceConfigNode=e.nodes[0]),u._loginResolveCallback&&u._loginRejectCallback?u._login():u._reconnect()})),[2,c]}}))}))},t.prototype._closeDataChannelSignaling=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null},t.prototype._checkDataChannelSignal=function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==Sj.CONNECTED)throw new lP(aP.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=Sj.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._reconnect=function(){var e=this;!this._isReconnecting&&this._userId&&(YW.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){YW.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){YW.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))},t.prototype._clearState=function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)},t}(GD.exports.EventEmitter),JW=function(e){function t(t,i){var r=e.call(this)||this;return r._appId=t,r.remoteStreams=new Map,r._context=i,r}return Cf(t,e),t.prototype.connect=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return this._mediaServerClient=new Rj(this._context),this._bindEvents(),[4,this._mediaServerClient.connect(this._appId)];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayPublicStream=function(e){return t_(this,void 0,void 0,(function(){var t,i=this;return i_(this,(function(r){switch(r.label){case 0:if(this.remoteStreams.get(e))throw new lP(aP.REPEAT_PLAY,"repeat play public media stream");return(t=new ej(e,e,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var r=function(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var i={seiCount:0,seis:[]},r=!1,n=2;n<t.byteLength;){var o=t.getUint16(n);if(n+=2,t.byteLength-n<o){r=!0;break}var a=new Uint8Array(e.buffer,n,o);if(n+=o,t.byteLength-n>0&&t.byteLength-n<=2){r=!0;break}i.seiCount++,i.seis.push(a)}return r&&(i.seiCount=1,i.seis=[e]),i}(e),n=0;n<r.seiCount;n++)i.emit(FB.ON_SEI_MESSAGED_RECEIVED,{sei:r.seis[n],publicStreamId:t.streamId})})),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return r.sent(),this.remoteStreams.set(e,t),[2,t]}}))}))},t.prototype.stopPlayPublicStream=function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)},t.prototype.destroy=function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()},t.prototype._handleReconnected=function(){return t_(this,void 0,void 0,(function(){var e,t,i,r,n,o,a,s,c=this;return i_(this,(function(u){clearTimeout(this._reconnectTimer),e=function(e){t.remoteStreams.delete(e),t.startPlayPublicStream(e).then((function(){var t=c.remoteStreams.get(e);c.safeEmit(FB.RESUBSCRIBE,{stream:t})}))},t=this;try{for(i=r_(this.remoteStreams),r=i.next();!r.done;r=i.next())n=n_(r.value,1),o=n[0],e(o)}catch(e){a={error:e}}finally{try{r&&!r.done&&(s=i.return)&&s.call(i)}finally{if(a)throw a.error}}return[2]}))}))},t.prototype._reconnect=function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)},t.prototype._bindEvents=function(){var e,t,i=this;null===(e=this._mediaServerClient)||void 0===e||e.on(pV.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){i.emit("onRemoteStreamStats",e)}))},t}(qD),QW=new XD("AudioDeviceManager",1),ZW=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._isAudioPlaybackDeviceTesting=!1,t._isAudioDeviceRecordTesting=!1,t}return Cf(t,e),t.prototype.startAudioPlaybackDeviceTest=function(e,t){return t_(this,void 0,void 0,(function(){var i;return i_(this,(function(r){switch(r.label){case 0:if(this._isAudioPlaybackDeviceTesting||this._isAudioDeviceRecordTesting)throw new lP(aP.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");this._isAudioPlaybackDeviceTesting=!0,QW.print("startAudioPlaybackDeviceTest()","Invoke"),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._playAudioFile(e,{loop:!0})];case 2:return r.sent(),[3,4];case 3:throw i=r.sent(),this.stopAudioPlaybackDeviceTest(),i;case 4:return this._startEmitAudioPlaybackDeviceTestVolume(t),[2]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){this._isAudioPlaybackDeviceTesting&&(QW.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.startAudioDeviceRecordTest=function(e){return t_(this,void 0,void 0,(function(){var t=this;return i_(this,(function(i){switch(i.label){case 0:if(this._isAudioDeviceRecordTesting)throw new lP(aP.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");return this._isAudioDeviceRecordTesting=!0,QW.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){QW.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),t._stopAudioCaptureAndRecoder()}),3e4),[4,this._startAudioCaptureAndRecoder(e)];case 1:return i.sent(),delete this._audioCaptureAndRecoderResolve,[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){QW.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()},t.prototype.stopAudioDevicePlayTest=function(){this._isAudioDeviceRecordTesting&&(QW.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.getRecordTrack=function(){return this._audioTrack},t.prototype.destroy=function(){QW.print("destroy()","Invoke"),e.prototype.removeAllListeners.call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()},t.prototype._playAudioFile=function(e,t){var i=this;return new Promise((function(r,n){i._audioElement=Wj("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),i._audioElement.loop=t.loop,QW.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),i._audioElement.oncanplay=function(){QW.print("_playAudioFile()","oncanplay"),r()},i._audioElement.onerror=function(e){var t,r;n(new lP(aP.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(r=null===(t=i._audioElement)||void 0===t?void 0:t.error)||void 0===r?void 0:r.message))))}}))},t.prototype._destroyAudioElement=function(){this._audioElement&&(QW.print("_destroyAudioElement()","Invoke"),this._audioElement.src="",delete this._audioElement,this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())},t.prototype._startEmitAudioPlaybackDeviceTestVolume=function(e){var t=this;e=Math.max(e,100),this._audioElement&&(QW.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new cB(this._audioElement),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))},t.prototype._stopEmitAudioPlaybackDeviceTestVolume=function(){var e;void 0!==this._playbackDeviceTestTimer&&(QW.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher},t.prototype._startAudioCaptureAndRecoder=function(e){return t_(this,void 0,void 0,(function(){var t,i,r=this;return i_(this,(function(n){switch(n.label){case 0:return t=this,[4,CB({})];case 1:return t._audioTrack=n.sent(),i=hB(this._audioTrack.getTrack()),QW.print("startAudioDeviceRecordTest()","create microphone track success!"),[2,new Promise((function(t,n){r._mediaRecorder=new MediaRecorder(i),r._mediaRecorder.ondataavailable=function(i){return t_(r,void 0,void 0,(function(){var r,o,a,s=this;return i_(this,(function(c){switch(c.label){case 0:if(!this._isAudioDeviceRecordTesting)return[3,5];QW.print("startAudioDeviceRecordTest()","get recorded file."),r=new Blob([i.data]),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._playAudioFile(URL.createObjectURL(r),{loop:!1})];case 2:return c.sent(),[3,4];case 3:return o=c.sent(),[2,n(o)];case 4:return this._startEmitAudioPlaybackDeviceTestVolume(e),null===(a=this._audioElement)||void 0===a||a.addEventListener("ended",(function(){s.stopAudioDevicePlayTest(),t()})),this._audioCaptureAndRecoderResolve=t,[3,6];case 5:t(),c.label=6;case 6:return[2]}}))}))},r._mediaRecorder.onerror=function(e){n(new lP(aP.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},r._mediaRecorder.start()}))]}}))}))},t.prototype._stopAudioCaptureAndRecoder=function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.close(),delete this._audioTrack},t}(GD.exports.EventEmitter),$W=function(){function e(){this.engineBAC={adm:{},agc:{},ans:{}},this.engineANM={},this._init()}return e.prototype._init=function(){return t_(this,void 0,void 0,(function(){var e,t;return i_(this,(function(i){switch(i.label){case 0:return e=new kV,t=this,[4,e.getAudioProfile()];case 1:return t.engineBAC=i.sent(),[2]}}))}))},e.prototype.updateEngineBAC=function(e){e&&(this.engineBAC={codec:this.engineBAC.codec,adm:$f($f({},this.engineBAC.adm),e.adm)},this.setAEC(!!e.aec),this.setAGC(!!e.agc))},e.prototype.updateEngineANM=function(e){e&&(this.engineANM=e)},e.prototype.setAudioProfile=function(e){var t,i,r;switch(e){case Qf.fluent:i=16e3,t=24e3;break;case Qf.standard:i=48e3,t=48e3;break;case Qf.hd:i=48e3,t=128e3,r=2;break;case Qf.standardStereo:i=48e3,t=8e4,r=2;break;case Qf.hdMono:i=48e3,t=128e3}t&&(this.bitrate=t),r&&(this.channel=r),i&&(this.sampleRate=i)},e.prototype.setBitrate=function(e){e>128e3&&(e=128e3),this.bitrate=e},e.prototype.setAEC=function(e){this.aec=e},e.prototype.setAGC=function(e){this.agc=e},e.prototype.setANS=function(e){this.ans=e},e.prototype.getOpusConfigStr=function(){var e=";",t=this.config;return t.bitrate&&(e+="maxaveragebitrate=".concat(t.bitrate,";")),t.sampleRate&&(e+="sprop-maxcapturerate=".concat(t.sampleRate,";")),t.playbackRate&&(e+="maxplaybackrate=".concat(t.playbackRate,";")),t.channel&&t.channel>1&&(e+="sprop-stereo=1;"),t.playChannel&&t.playChannel>1&&(e+="stereo=1;"),e.slice(0,-1)},Object.defineProperty(e.prototype,"config",{get:function(){var e,t,i,r,n,o,a,s,c,u,d,l,h;return{bitrate:this.bitrate||(null===(e=this.engineANM.enc_param)||void 0===e?void 0:e.bitrate)||0,playChannel:(null===(i=null===(t=this.engineBAC.adm)||void 0===t?void 0:t.play)||void 0===i?void 0:i.chn)||1,channel:this.channel||(null===(n=null===(r=this.engineBAC.adm)||void 0===r?void 0:r.record)||void 0===n?void 0:n.chn)||(null===(a=null===(o=this.engineANM)||void 0===o?void 0:o.enc_param)||void 0===a?void 0:a.chn),aec:this.aec,agc:this.agc,ans:this.ans,sampleRate:this.sampleRate||(null===(c=null===(s=this.engineBAC.adm)||void 0===s?void 0:s.record)||void 0===c?void 0:c.sr)||(null===(u=this.engineBAC.codec)||void 0===u?void 0:u.enc_fs)||(null===(d=this.engineANM.enc_param)||void 0===d?void 0:d.sr),playbackRate:null===(h=null===(l=this.engineBAC.adm)||void 0===l?void 0:l.play)||void 0===h?void 0:h.sr}},enumerable:!1,configurable:!0}),e}(),eX=new XD("Engine",0),tX=function(e){function t(t,i){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._publicStreamAudioPlayer=new Map,r._publicStreamVideoPlayer=new Map,r._publicStreamIds=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._enableSimulcast=!1,r._videoStreamEncodeConfig=[EV],r._screenStreamEncodeConfig=[bV],r._pauseAllSubscribeState={audio:!1,video:!1},r._audioPropertiesReportTimer=null,r._mirrorType=jf.MIRROR_TYPE_RENDER,r._audioDeviceManager=new ZW,r._audioProfileManager=new $W,r._remoteVideoConfig=new Map,r._userPriorityMap=new Map,r._subscribeFallbackOption=Wf.DISABLE,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=s_.PLAYOUT_AND_PUBLISH),t_(r,void 0,void 0,(function(){var i;return i_(this,(function(r){switch(r.label){case 0:return eX.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(i=this._room)||void 0===i?void 0:i.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(d_.onAudioMixingStateChanged,e)},r._onAudioMixingAutoplayFailed=function(){r.safeEmit(d_.onAutoplayFailed,{})},r._appId=t,r._pubLock=new yj("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new XW({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),window.__rtc_engine__=r,window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=r,r._trackSourceType={video:Of.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:Of.VIDEO_SOURCE_TYPE_INTERNAL,audio:wf.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:wf.AUDIO_SOURCE_TYPE_INTERNAL},r._config=i,r._rtmClient=new qW(t),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new tG,(new kV).getWebRtcConfig({appId:r.appId,deviceId:$x.getDeviceId()}),r}return Cf(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t,i,r;return t_(this,void 0,void 0,(function(){var n,o,a,s;return i_(this,(function(c){switch(c.label){case 0:return eX.print("updateToken()","token: %s",e),PD(e,"token"),this.waitForNewToken&&(null===(t=this._room)||void 0===t?void 0:t._roomInfo)&&this._tempRoomConfig?(n=null===(i=this._room)||void 0===i?void 0:i._roomInfo,o=n.roomId,a=n.userInfo,s=this._tempRoomConfig,delete this._tempRoomConfig,[4,this.joinRoom(e,o,a,s)]):[3,2];case 1:return[2,c.sent()];case 2:if(!this._room)throw new lP(aP.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");return[4,null===(r=this._room)||void 0===r?void 0:r.updateToken(e)];case 3:return c.sent(),[2]}}))}))},t.prototype.setVideoCaptureDevice=function(e){return t_(this,void 0,void 0,(function(){var t,i;return i_(this,(function(r){switch(r.label){case 0:return eX.print("setVideoCaptureDevice()","deviceId: %s",e),PD(e,"deviceId"),this._localVideoTrack?(t=this._videoStreamConstraints,"user"===e||"environment"===e||"left"===e||"right"===e?(delete t.deviceId,t.facingMode=e):t.deviceId={exact:e},this._videoStreamConstraints=t,[4,AB(t)]):(this._localVideoDeviceId=e,[2,Promise.resolve()]);case 1:return i=r.sent(),this._initLocalTrackEvents(i),this._localVideoTrack.close(),this._localVideoTrack=i,this._videoPlayer&&this._videoPlayer.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(i),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},t.prototype.setAudioCaptureDevice=function(e){return t_(this,void 0,void 0,(function(){var t,i;return i_(this,(function(r){switch(r.label){case 0:return eX.print("setAudioCaptureDevice()","deviceId: %s",e),PD(e,"deviceId"),this._localAudioTrack?((t=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=t,this._localAudioTrack.close(),[4,CB(t,this._audioProfileManager)]):(this._localAudioDeviceId=e,[2,Promise.resolve()]);case 1:return i=r.sent(),this._initLocalTrackEvents(i),this._localAudioTrack=i,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:r.sent(),r.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){aB.on(d_.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),aB.on(d_.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y,S,g,E,b,T,I,R,A,C,O=this;null===(e=this._room)||void 0===e||e.on(lV.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(lV.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(i=this._room)||void 0===i||i.on(lV.USER_CONNECTION,this._onUserConnection.bind(this)),null===(r=this._room)||void 0===r||r.on(FB.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(n=this._room)||void 0===n||n.on(FB.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(FB.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(lV.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(lV.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(lV.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(lV.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(lV.POST_PROCESSING_MESSAGE,(function(e){!function(e){return"2.0"===e.protocol}(e)?"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e):O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message})})),null===(l=this._room)||void 0===l||l.on(pV.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(FB.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(p=this._room)||void 0===p||p.on(FB.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(FB.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(_=this._room)||void 0===_||_.on(FB.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(v=this._room)||void 0===v||v.on(FB.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=O._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&O.safeEmit(d_.onAutoPublishResult,e)})),null===(m=this._room)||void 0===m||m.on(FB.ON_REMOTE_STREAM_STATS,(function(e){O.safeEmit(d_.onRemoteStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(FB.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(d_.onLocalStreamStats,e)})),null===(S=this._room)||void 0===S||S.on(FB.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(g=this._room)||void 0===g||g.on(FB.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(d_.onUserStartAudioCapture,{userId:t})})),null===(E=this._room)||void 0===E||E.on(FB.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(d_.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(FB.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(d_.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(FB.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(d_.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(FB.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(d_.onSEIMessageReceived,e)})),null===(R=this._room)||void 0===R||R.on(FB.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(d_.onRemoteVideoSizeChanged,e,t)})),null===(A=this._room)||void 0===A||A.on(FB.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(d_.onSimulcastSubscribeFallback,e)})),null===(C=this._room)||void 0===C||C.on(FB.RECONNECT_FAILED,(function(){O.safeEmit(d_.onError,{errorCode:aP.RECONNECT_FAILED})}))},t.prototype.safeEmit=function(t){for(var i=[],r=1;r<arguments.length;r++)i[r-1]=arguments[r];return jD(t)&&Hx(t,yD(i)),e.prototype.safeEmit.apply(this,o_([t],n_(i),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,i,r){return t_(this,void 0,void 0,(function(){var n,o,a,s;return i_(this,(function(c){switch(c.label){case 0:if(eX.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,i,r),LD(e)||PD(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new lP(aP.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){DD(e,"userInfo"),xD(e.userId),LD(e.extraInfo)||PD(e.extraInfo,"userInfo.extraInfo",1,200)}(i),n={isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Jf.communication},IH(n,r),function(e){DD(e,"roomConfig"),wD(e.isAutoPublish,"roomConfig.isAutoPublish"),wD(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),wD(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(n),!this._room||this._room.connectionState===Sj.DISCONNECTED)return[3,1];throw new lP(aP.REPEAT_JOIN,"Already joined");case 1:this._room=new zj(r,{audioProfileManager:this._audioProfileManager,enableFallbackHandler:rX(this.appId)}),this._room.userPriorityMap=this._userPriorityMap,this._room.subscribeFallbackOption=this._subscribeFallbackOption,this._addHandlerEventHandler(),o=this._liveTranscodeConfig&&sV("started",this._liveTranscodeConfig),c.label=2;case 2:return c.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,$f($f({},i),{businessId:this._businessId,role:this._visibility?KW.NORMAL_USER:KW.SILENT_USER}),o,this._useCloudProxy)];case 3:return a=c.sent(),this._roomConfig=r,this._tempRoomConfig&&delete this._tempRoomConfig,(null==r?void 0:r.isAutoPublish)&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:Vf.AUDIO_AND_VIDEO}):this.safeEmit(d_.onAutoPublishResult,{isScreen:!1,state:Mf.PUBLISH_FAIL})),[2,a];case 4:throw(s=c.sent()).code===aP.INVALID_TOKEN&&(this._tempRoomConfig=r),s;case 5:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,i;return void 0===e&&(e=!1),t_(this,void 0,void 0,(function(){return i_(this,(function(r){switch(r.label){case 0:return eX.print("leaveRoom()"),e?[4,null===(t=this._room)||void 0===t?void 0:t.leave(e)]:[3,2];case 1:return r.sent(),[3,3];case 2:null===(i=this._room)||void 0===i||i.leave(e).catch(),r.label=3;case 3:return this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map,[2]}}))}))},t.prototype.destroy=function(){var e,t,i;eX.print("destroy()"),this.removeAllListeners(),this._removeHandlerEventHandler(),null===(e=this._room)||void 0===e||e.destroy(),this._room=void 0,null===(t=this._videoPlayer)||void 0===t||t.destroy(),this._videoPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[EV],this._screenStreamEncodeConfig=[bV],this._pauseAllSubscribeState={audio:!1,video:!1},this._messageStatisticsObserver.destroy(),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(i=this._outsideRoom)||void 0===i||i.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new Map,this._userPriorityMap.clear()},t.prototype.publishStream=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return eX.print("publishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),TD(e)&&!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=(i=this._localImgVideoTrack,new EB(i,aD())),this._localVideoTrack.dummy=!0),[4,this._updatePublish({mediaType:e})];case 1:return t.sent(),[2]}var i}))}))},t.prototype.unpublishStream=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return eX.print("unpublishStream()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updatePublish({mediaType:e,pubState:GB.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.publishScreen=function(e){return t_(this,void 0,void 0,(function(){var t;return i_(this,(function(i){switch(i.label){case 0:eX.print("publishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),i.label=1;case 1:return i.trys.push([1,3,,4]),TD(e)&&!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=(r=this._localImgScreenTrack,new bB(r,aD())),this._localScreenVideoTrack.dummy=!0),[4,this._updateScreenPublish({mediaType:e,pubState:GB.PUB})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof lP?t:new lP(aP.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}var r}))}))},t.prototype.unpublishScreen=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return eX.print("unpublishScreen()","mediaType: %o",e),this._checkMediaType(e),this._assertNotInRoom(),[4,this._updateScreenPublish({mediaType:e,pubState:GB.UNPUB})];case 1:return t.sent(),[2]}}))}))},t.prototype.subscribeStream=function(e,t){return t_(this,void 0,void 0,(function(){return i_(this,(function(i){return eX.print("subscribeStream()","userId: %o, mediaType: %o",e,t),[2,this._subscribe(!1,e,t)]}))}))},t.prototype._subscribe=function(e,t,i){var r,n,o,a,s;return t_(this,void 0,void 0,(function(){var c,u,d,l,h;return i_(this,(function(p){switch(p.label){case 0:if(this._checkMediaType(i),this._assertNotInRoom(),c=this._room.remoteStreams.get(t),!(u=null==c?void 0:c.find((function(t){return t.isScreen===e}))))throw new lP(aP.STREAM_NOT_EXIST,"stream not exist");return this._pauseAllSubscribeState.audio&&(i-=i&Vf.AUDIO),this._pauseAllSubscribeState.video&&(i-=i&Vf.VIDEO),eX.print("subscribeStream()","due to pauseAll mediaType: %o",i),d=u.hasSubscribed,l=this._remoteVideoConfig.get(t)||(null===(r=this._roomConfig)||void 0===r?void 0:r.remoteVideoConfig),u.originalMediaType=i,[4,this._room.subscribe(u,i,l)];case 1:return p.sent(),bD(i)&&this._updateAudioPlayerState(u),TD(i)&&this._updateVideoPlayerState(u),e||!(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)&&!(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo)||(u.audioTrack||u.videoTrack)&&(h={userId:t,isScreen:!1,state:Df.SUBSCRIBE_SUCC},this.safeEmit(d_.onAutoSubscribeResult,h)),!d&&bD(i)&&(null===(a=u.observer)||void 0===a||a.setSubscribeAudio(!0)),!d&&TD(i)&&(null===(s=u.observer)||void 0===s||s.setSubscribeVideo(!0)),[2]}}))}))},t.prototype.unsubscribeStream=function(e,t){return t_(this,void 0,void 0,(function(){var i,r;return i_(this,(function(n){if(eX.print("unsubscribeStream()","userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),i=this._room.remoteStreams.get(e),!(null==(r=null==i?void 0:i.find((function(e){return!e.isScreen})))?void 0:r.hasSubscribed))throw new lP(aP.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.subscribeScreen=function(e,t){return t_(this,void 0,void 0,(function(){return i_(this,(function(i){return eX.print("subscribeScreen() userId: %o, mediaType: %o",e,t),[2,this._subscribe(!0,e,t)]}))}))},t.prototype.unsubscribeScreen=function(e,t){return t_(this,void 0,void 0,(function(){var i,r;return i_(this,(function(n){if(eX.print("unsubscribeScreen() userId: %o, mediaType: %o",e,t),this._checkMediaType(t),this._assertNotInRoom(),i=this._room.remoteStreams.get(e),!(null==(r=null==i?void 0:i.find((function(e){return e.isScreen})))?void 0:r.hasSubscribed))throw new lP(aP.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(r,t),[2]}))}))},t.prototype.setRemoteVideoConfig=function(e,t){var i;return t_(this,void 0,void 0,(function(){return i_(this,(function(r){return eX.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",e,t),xD(e),function(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new lP(aP.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}(t),this._remoteVideoConfig.set(e,t),[2,null===(i=this._room)||void 0===i?void 0:i.updateSubVideoConfig(e,t).then((function(){}))]}))}))},t.prototype.startVideoCapture=function(e){var t,i,r;return t_(this,void 0,void 0,(function(){var n,o,a,s,c,u,d=this;return i_(this,(function(l){switch(l.label){case 0:if(eX.print("startVideoCapture()","deviceId: %s",e),LD(e)||PD(e,"deviceId"),e=e||this._localVideoDeviceId,this._localVideoTrack&&!this._localVideoTrack.dummy)throw new lP(aP.REPEAT_CAPTURE,"Has already capture");return n=this._videoStreamConstraints,e&&("user"===e||"environment"===e||"left"===e||"right"===e?n.facingMode=e:n.deviceId={exact:e},this._videoStreamConstraints=n),[4,AB(n)];case 1:return o=l.sent(),this._initLocalTrackEvents(o),this._localVideoTrack=o,null===(t=this._videoPlayer)||void 0===t||t.playVideo(o),a={},(s=null==o?void 0:o.getTrack())&&(a=s.getSettings(),c={width:a.width,height:a.height},this._localVideoTrack.resolution=c,setTimeout((function(){return d.safeEmit(d_.onLocalVideoSizeChanged,{streamIndex:xf.STREAM_INDEX_MAIN,info:c})}))),this._room?(u=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||u)&&(this._visibility?this._updatePublish():this.safeEmit(d_.onAutoPublishResult,{isScreen:!1,state:Mf.PUBLISH_FAIL})),null===(r=null===(i=this._room.localStream)||void 0===i?void 0:i.observer)||void 0===r||r.setEnableVideo(!0),[2,a]):[2,a]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,i,r,n;return t_(this,void 0,void 0,(function(){return i_(this,(function(o){switch(o.label){case 0:if(eX.print("stopVideoCapture()"),this._trackSourceType.video===Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return null===(e=this._videoPlayer)||void 0===e||e.stop(),null===(t=this._localVideoTrack)||void 0===t||t.close(),this._localImgVideoTrack&&this._localVideoTrack?(null===(i=this._localVideoTrack)||void 0===i||i.setTrack(this._localImgVideoTrack),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:o.sent(),o.label=2;case 2:return null===(n=null===(r=this._room.localStream)||void 0===r?void 0:r.observer)||void 0===n||n.setEnableVideo(!1),[2]}}))}))},t.prototype.startAudioCapture=function(e){var t,i;return t_(this,void 0,void 0,(function(){var r,n,o;return i_(this,(function(a){switch(a.label){case 0:if(eX.print("startAudioCapture()","deviceId: $o",e),LD(e)||PD(e,"deviceId"),e=e||this._localAudioDeviceId,this._localAudioTrack)throw new lP(aP.REPEAT_CAPTURE,"Has already capture");return r=this._audioStreamConstraints,e&&(r.deviceId={exact:e},this._audioStreamConstraints=r),[4,CB(r,this._audioProfileManager)];case 1:return n=a.sent(),this._initLocalTrackEvents(n),this._localAudioTrack=n,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(d_.onAutoPublishResult,{isScreen:!1,state:Mf.PUBLISH_FAIL})),null===(i=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===i||i.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.stopAudioCapture=function(){var e,t,i;return t_(this,void 0,void 0,(function(){return i_(this,(function(r){switch(r.label){case 0:if(eX.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===wf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:r.sent(),r.label=2;case 2:return null===(i=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===i||i.setEnableAudio(!1),[2]}}))}))},t.prototype.getAudioMixingManager=function(){return eX.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,i,r,n,o;return void 0===e&&(e={}),t_(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p=this;return i_(this,(function(f){switch(f.label){case 0:if(eX.print("startScreenCapture()","config: %o",e),(null===(t=this._localScreenVideoTrack)||void 0===t?void 0:t.dummy)||null===(i=this._localScreenVideoTrack)||void 0===i||i.close(),this._localScreenVideoTrack=void 0,a=e.enableAudio,s=void 0!==a&&a,this._trackSourceType.screenVideo===Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===wf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,OB(s,this._screenStreamEncodeConfig[0])];case 1:return c=f.sent(),this._localScreenVideoTrack=new bB(c.getVideoTracks()[0],aD()),(u=null===(r=this._localScreenVideoTrack)||void 0===r?void 0:r.getTrack())&&(d=u.getSettings(),l={width:d.width,height:d.height},this._localScreenVideoTrack.resolution=l,setTimeout((function(){return p.safeEmit(d_.onLocalVideoSizeChanged,{streamIndex:xf.STREAM_INDEX_SCREEN,info:{width:d.width,height:d.height}})}))),(h=c.getAudioTracks()).length&&(this._localScreenAudioTrack=new TB(h[0],aD()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),(null===(o=this._room)||void 0===o?void 0:o.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,3];case 2:f.sent(),f.label=3;case 3:return[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,i,r;return t_(this,void 0,void 0,(function(){return i_(this,(function(n){switch(n.label){case 0:return eX.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localImgScreenTrack&&this._localScreenVideoTrack?(this._localScreenVideoTrack.setTrack(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0):this._localScreenVideoTrack=void 0,null===(i=this._localScreenAudioTrack)||void 0===i||i.close(),this._localScreenAudioTrack=void 0,(null===(r=this._room)||void 0===r?void 0:r.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var i,r,n,o;if(eX.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),kD(e,"streamIndex",[xf.STREAM_INDEX_MAIN,xf.STREAM_INDEX_SCREEN]),t&&t.renderDom){var a=$f({userId:this._getUserId()},t);return FD(a),e!=xf.STREAM_INDEX_MAIN||this._videoPlayer?e!=xf.STREAM_INDEX_SCREEN||this._screenPlayer?void 0:(this._screenPlayer=new $j($f($f({},a),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)!==Zf.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement):(this._videoPlayer=new $j(a),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Zf.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement)}e==xf.STREAM_INDEX_MAIN?(null===(i=this._videoPlayer)||void 0===i||i.destroy(),delete this._videoPlayer):(null===(r=this._screenPlayer)||void 0===r||r.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return t_(this,void 0,void 0,(function(){var i;return i_(this,(function(r){switch(r.label){case 0:eX.print("startLiveTranscoding()","transcode: %o",e),PD(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(d_.onStreamMixingEvent,{event:jB.START,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(sV("started",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof lP?i:new lP(aP.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return t_(this,void 0,void 0,(function(){var i;return i_(this,(function(r){switch(r.label){case 0:if(eX.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=IH(this._liveTranscodeConfig,e),r.label=1;case 1:return r.trys.push([1,3,,4]),this.safeEmit(d_.onStreamMixingEvent,{event:jB.UPDATE,error:0,message:""}),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(sV("layoutChanged",this._liveTranscodeConfig))];case 2:return r.sent(),[3,4];case 3:throw(i=r.sent())instanceof lP?i:new lP(aP.UNEXPECTED_ERROR,"unexpected error",i);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return t_(this,void 0,void 0,(function(){var t;return i_(this,(function(i){switch(i.label){case 0:if(eX.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,i.label=1;case 1:return i.trys.push([1,3,,4]),this.safeEmit(d_.onStreamMixingEvent,{event:jB.STOP,error:0,message:""}),[4,null===(e=this._room)||void 0===e?void 0:e.liveControlMessage({action:"stopped",type:"transcode"})];case 2:return i.sent(),[3,4];case 3:throw(t=i.sent())instanceof lP?t:new lP(aP.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return eX.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(Vx.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t,i;return t_(this,void 0,void 0,(function(){return i_(this,(function(r){switch(r.label){case 0:if(eX.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==Sj.CONNECTED)throw new lP(aP.NOT_CONNECTED_YET,"server not connected");return this._room.localStream&&(null===(t=this._room.localStream.observer)||void 0===t||t.setPublisher(e)),!e?[4,this._room.unpublish()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?KW.NORMAL_USER:KW.SILENT_USER})];case 3:return r.sent(),this._visibility=e,e&&(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoPublish)&&this._updatePublish({mediaType:Vf.AUDIO_AND_VIDEO}),[2]}}))}))},t.prototype._initPlayerEvents=function(e,t){var i=this;void 0===t&&(t=!1),e.on("playback_event",(function(r){var n,o,a,s;switch(null===(o=null===(n=i._room)||void 0===n?void 0:n.remoteStreams.get(r.userId||""))||void 0===o||o.find((function(e){return!e.isScreen})),r.eventName){case"timeupdate":return;case"loadeddata":if("audio"===r.type)t?i.safeEmit(d_.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):i.safeEmit(d_.onAudioFirstFrameDecoded,{userId:e.userId}),Ux.firstRemoteAudioRender("",r.userId||"");else{var c={userId:e.userId,height:(null===(a=e.domElement)||void 0===a?void 0:a.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0};t?(c.publicStreamId=c.userId,delete c.userId,i.safeEmit(d_.onFirstPublicStreamVideoFrameDecoded,c),i.safeEmit(d_.onFirstPublicStreamVideoFrameRendered,c)):(i.safeEmit(d_.onVideoFirstFrameDecoded,c),i.safeEmit(d_.onVideoFirstFrameRendered,c)),Ux.firstRemoteVideoRender("",r.userId||"")}break;case"autoplay-error":return t&&(r.publicStreamId=r.userId),void i.safeEmit(d_.onAutoplayFailed,{userId:r.userId||r.publicStreamId,kind:e instanceof $j?"video":"audio"})}i.safeEmit(d_.onPlayerEvent,r)}))},t.prototype._initLocalTrackEvents=function(e,t){var i=this;void 0===t&&(t=!1),e.on("track-ended",(function(e){var t=!1;e!==i._localScreenAudioTrack&&e!==i._localScreenVideoTrack||(t=!0),i.safeEmit(d_.onTrackEnded,{kind:e.getTrack().kind,isScreen:t})})),e.on("resolution-change",(function(e){i.safeEmit(d_.onLocalVideoSizeChanged,{streamIndex:t?xf.STREAM_INDEX_SCREEN:xf.STREAM_INDEX_MAIN,info:e})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var i,r,n,o,a,s;eX.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),kD(e,"streamIndex",[xf.STREAM_INDEX_MAIN,xf.STREAM_INDEX_SCREEN]),FD(t);var c=t.userId;if(e==xf.STREAM_INDEX_MAIN){if(null===(i=this._remoteVideoPlayer.get(c))||void 0===i||i.destroy(),!t.renderDom)return;var u=new $j(t);return this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(n=null===(r=this._room)||void 0===r?void 0:r.remoteStreams.get(c))||void 0===n?void 0:n.find((function(e){return!e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}if(null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy(),t.renderDom){var d;u=new $j($f($f({},t),{isScreen:!0}));return this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}},t.prototype.setLocalVideoMirrorType=function(e){eX.print("setLocalVideoMirrorType()","mirrorType: %o",e),kD(e,"mirrorType",[jf.MIRROR_TYPE_NONE,jf.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){return t_(this,void 0,void 0,(function(){var t;return i_(this,(function(i){switch(i.label){case 0:return eX.print("setAudioPlaybackDevice()","deviceId: %s",e),PD(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(eX.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,aB.getDeviceById(e)];case 1:if(!(t=i.sent()))throw new lP(aP.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),this._audioPlaybackDeviceId=e,t&&this.safeEmit(d_.onAudioPlaybackDeviceChanged,t),Ux.rtcAudioDevice(hx.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){var t,i;return t_(this,void 0,void 0,(function(){var r,n,o;return i_(this,(function(a){switch(a.label){case 0:return eX.print("play()","userId | publicStreamId: %s",e),o=null===(i=null===(t=this._room)||void 0===t?void 0:t.remoteStreams.get(e||""))||void 0===i?void 0:i.find((function(e){return!e.isScreen})),r=this._remoteAudioPlayer.get(e||""),n=this._remoteVideoPlayer.get(e||""),r||(r=this._publicStreamAudioPlayer.get(e||"")),n||(n=this._publicStreamVideoPlayer.get(e||"")),e||!this._audioMixingManager?[3,2]:[4,this._audioMixingManager.resumeLocalPlay()];case 1:a.sent(),a.label=2;case 2:return!e&&this._videoPlayer&&(n=this._videoPlayer),n?n.played?[4,n.manuallyPlay()]:[3,4]:[3,5];case 3:return a.sent(),[3,5];case 4:o&&o.videoTrack?n.playVideo(o.videoTrack,o):!e&&this._localVideoTrack&&(n.mirror(!!this._mirrorType),n.playVideo(this._localVideoTrack)),a.label=5;case 5:return r?r.played?[4,r.manuallyPlay()]:[3,7]:[3,8];case 6:return a.sent(),[3,8];case 7:o&&o.audioTrack&&r.playAudio(o.audioTrack),a.label=8;case 8:return[2]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return t_(this,void 0,void 0,(function(){var t,i=this;return i_(this,(function(r){return eX.print("pauseAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?[2,Promise.resolve()]:(t=function(){bD(e)&&(i._pauseAllSubscribeState.audio=!0),TD(e)&&(i._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()]))}))}))},t.prototype.resumeAllSubscribedStream=function(e){return t_(this,void 0,void 0,(function(){var t,i=this;return i_(this,(function(r){return eX.print("resumeAllSubscribedStream()","mediaType: %o",e),this._checkMediaType(e),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video?(t=function(){bD(e)&&(i._pauseAllSubscribeState.audio=!1),TD(e)&&(i._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,r;t(),null===(r=null===(e=i._room)||void 0===e?void 0:e.remoteStreams)||void 0===r||r.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){i._updateAudioPlayerState(e),i._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])):[2,Promise.resolve()]}))}))},t.prototype.sendUserMessage=function(e,t){var i;return t_(this,void 0,void 0,(function(){var r,n=this;return i_(this,(function(o){if(xD(e),BD(t),!this._room||this._room.connectionState!==Sj.CONNECTED)throw new lP(aP.IM_BEFORE_JOIN,"join first");return r=Date.now(),[2,null===(i=this._room.sendUserMessage(e,t))||void 0===i?void 0:i.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!1,r,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!1,r),t}))]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){var i;return t_(this,void 0,void 0,(function(){var r,n=this;return i_(this,(function(o){if(xD(e),MD(t,"message"),BD(t),!this._room||this._room.connectionState!==Sj.CONNECTED)throw new lP(aP.IM_BEFORE_JOIN,"join first");return r=Date.now(),[2,null===(i=this._room.sendUserMessage(e,t))||void 0===i?void 0:i.then((function(t){return n._messageStatisticsObserver.countP2PMessage(!0,e,!0,r,t),t.id})).catch((function(t){throw n._messageStatisticsObserver.countP2PMessage(!1,e,!0,r),t}))]}))}))},t.prototype.sendRoomMessage=function(e){return t_(this,void 0,void 0,(function(){var t,i=this;return i_(this,(function(r){if(BD(e),!this._room||this._room.connectionState!==Sj.CONNECTED)throw new lP(aP.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e).then((function(e){var r,n;return i._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e})).catch((function(e){var r,n;throw i._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!1,t),e}))]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return t_(this,void 0,void 0,(function(){var t,i=this;return i_(this,(function(r){if(BD(e),!this._room||this._room.connectionState!==Sj.CONNECTED)throw new lP(aP.IM_BEFORE_JOIN,"join first");return t=Date.now(),[2,this._room.sendRoomMessage(e,!0).then((function(e){var r,n;return i._messageStatisticsObserver.countRoomMessage(!0,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e})).catch((function(e){var r,n;throw i._messageStatisticsObserver.countRoomMessage(!1,null===(n=null===(r=i._room)||void 0===r?void 0:r.roomInfo)||void 0===n?void 0:n.roomId,!0,t),e}))]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),t_(this,void 0,void 0,(function(){var i;return i_(this,(function(r){switch(r.label){case 0:return eX.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,UD(e),i=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,i&&(this._audioStreamConstraints.deviceId=i),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:r.sent(),r.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),t_(this,void 0,void 0,(function(){var i;return i_(this,(function(r){switch(r.label){case 0:return eX.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,UD(e),i=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=e,i&&(this._videoStreamConstraints.deviceId=i),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:r.sent(),this._updatePublish(),r.label=2;case 2:return[2]}}))}))},t.prototype.enableSimulcastMode=function(e){return eX.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0},t.prototype.setVideoEncoderConfig=function(e){var t;return t_(this,void 0,void 0,(function(){return i_(this,(function(i){return eX.print("setVideoEncoderConfig()"," descriptions: %o",e),Array.isArray(e)||(e=[e]),e.length>3&&(e=e.slice(0,3)),e.sort((function(e,t){return t.maxKbps-e.maxKbps})),this._videoStreamEncodeConfig=e,(null===(t=this._room)||void 0===t?void 0:t.hasPublished)&&this._updatePublish(),[2]}))}))},t.prototype.setScreenEncoderConfig=function(e){var t;return t_(this,void 0,void 0,(function(){return i_(this,(function(i){return eX.print("setScreenEncoderConfig()","description: %o",e),this._screenStreamEncodeConfig=[e],this._localScreenVideoTrack&&(this._localScreenVideoTrack.videoCaptureConfig=e,this._localScreenVideoTrack.updateVideoCaptureConfig()),(null===(t=this._room)||void 0===t?void 0:t.hasScreenPublished)&&this._updateScreenPublish(),[2]}))}))},t.prototype.sendSEIMessage=function(e,t,i){var r,n,o,a,s,c;eX.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,i),kD(e,"streamIndex",[xf.STREAM_INDEX_MAIN,xf.STREAM_INDEX_SCREEN]),ND(i,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(dD.str2ab(t)):t;if(t.length){var d;if(e===xf.STREAM_INDEX_MAIN){if(!(null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.hasPublished))return;d=null===(o=this._room)||void 0===o?void 0:o.localStream}else{if(!(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished))return;d=null===(c=this._room)||void 0===c?void 0:c.localScreenStream}if(u.byteLength>4096)eX.print("sei size must not bigger than 4KB");else{var l=aD();d.seiList.push({content:u,uuid:l,repeatCount:i}),setTimeout((function(){if(d){var e=d.seiList.findIndex((function(e){return e.uuid===l}));e&&d.seiList.splice(e,1)}}),2e3)}}else eX.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;eX.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var i=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,r;i=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var r;if(0!==e.length){var n=e.find((function(e){return!1===e.isScreen})),o=null===(r=null==n?void 0:n.audioTrack)||void 0===r?void 0:r.getAudioLevel();i.push({userId:t,volume:o||0})}}));var n=null===(r=t._localAudioTrack)||void 0===r?void 0:r.getAudioLevel();i.push({userId:t._getUserId(),volume:n||0}),t.safeEmit(d_.onAudioVolumeIndication,{speakers:i})}),e)},t.prototype.enableAudioPropertiesReport=function(e){var t=this;void 0===e&&(e={}),eX.print("enableAudioPropertiesReport()","config %o: ",e);var i=e.interval,r=void 0===i?100:i,n=e.enableInBackground,o=void 0===n||n;this._stopAudioPropertiesReport(),r<=0||(r=Math.max(100,r),this._audioPropertiesReportTimer=self.setInterval((function(){if(o||"hidden"!==document.visibilityState){var e=[],i=t._audioDeviceManager.getRecordTrack()||t._localAudioTrack;if(i){var r=i.getAudioLevel();e.push({streamIndex:xf.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:r,nonlinearVolume:ED(r)}})}if(t._localScreenAudioTrack){r=t._localScreenAudioTrack.getAudioLevel();e.push({streamIndex:xf.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:r,nonlinearVolume:ED(r)}})}if(t.safeEmit(d_.onLocalAudioPropertiesReport,e),t._room){var n=[];t._room.remoteStreams.forEach((function(e,i){e.forEach((function(e){var r,o;if(e.audioTrack){var a=e.audioTrack.getAudioLevel();n.push({streamKey:{userId:i,streamIndex:e.isScreen?xf.STREAM_INDEX_SCREEN:xf.STREAM_INDEX_MAIN,roomId:null===(o=null===(r=t._room)||void 0===r?void 0:r.roomInfo)||void 0===o?void 0:o.roomId},audioPropertiesInfo:{linearVolume:a,nonlinearVolume:ED(a)}})}}))})),t.safeEmit(d_.onRemoteAudioPropertiesReport,n)}}}),r))},t.prototype.setVideoSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v,m,y;return t_(this,void 0,void 0,(function(){var S,g,E;return i_(this,(function(b){switch(b.label){case 0:return eX.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),kD(e,"streamIndex",[xf.STREAM_INDEX_MAIN,xf.STREAM_INDEX_SCREEN]),kD(t,"VideoSourceType",[Of.VIDEO_SOURCE_TYPE_EXTERNAL,Of.VIDEO_SOURCE_TYPE_INTERNAL]),S=e===xf.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[S]===t?[3,4]:(this._trackSourceType[S]=t,eX.print("setVideoSourceType","set ".concat(S," source type to ").concat(t)),this._localVideoTrack&&e===xf.STREAM_INDEX_MAIN?(E=!1,t===Of.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localVideoTrack.close()),null===(i=this._videoPlayer)||void 0===i||i.stop(),this._localVideoTrack=void 0,g=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,E?null===(a=null===(o=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!1):null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushVideo(!1),(null===(d=this._room)||void 0===d?void 0:d.hasPublished)||g?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===xf.STREAM_INDEX_SCREEN?(E=!1,t===Of.VIDEO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localScreenVideoTrack.close()),null===(l=this._screenPlayer)||void 0===l||l.stop(),this._localScreenVideoTrack=void 0,E?null===(f=null===(p=null===(h=this._room)||void 0===h?void 0:h.localScreenStream)||void 0===p?void 0:p.observer)||void 0===f||f.setEnableVideo(!1):null===(m=null===(v=null===(_=this._room)||void 0===_?void 0:_.localScreenStream)||void 0===v?void 0:v.observer)||void 0===m||m.setPushVideo(!1),(null===(y=this._room)||void 0===y?void 0:y.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:b.sent(),b.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var i,r,n,o,a,s,c,u;return t_(this,void 0,void 0,(function(){var d;return i_(this,(function(l){switch(l.label){case 0:if(eX.print("setExternalVideoTrack()","index: %o, track: %o",e,t),kD(e,"streamIndex",[xf.STREAM_INDEX_MAIN,xf.STREAM_INDEX_SCREEN]),e!==xf.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new IB(t,aD()),this._initLocalTrackEvents(this._localVideoTrack),null===(i=this._videoPlayer)||void 0===i||i.playVideo(this._localVideoTrack),d=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||d?[4,this._updatePublish()]:[3,2];case 1:l.sent(),l.label=2;case 2:if(e!==xf.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==Of.VIDEO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new IB(t,aD()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushVideo(!0),(null===(u=this._room)||void 0===u?void 0:u.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var i,r,n,o,a,s,c,u,d,l,h,p,f,_,v;return t_(this,void 0,void 0,(function(){var m,y,S;return i_(this,(function(g){switch(g.label){case 0:return eX.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),kD(e,"streamIndex",[xf.STREAM_INDEX_MAIN,xf.STREAM_INDEX_SCREEN]),kD(t,"audioSourceType",[wf.AUDIO_SOURCE_TYPE_EXTERNAL,wf.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===xf.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,eX.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===xf.STREAM_INDEX_MAIN?(S=!1,this._trackSourceType.audio===wf.AUDIO_SOURCE_TYPE_EXTERNAL&&(S=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,y=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,S?null===(o=null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setEnableAudio(!1):null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushAudio(!1),(null===(u=this._room)||void 0===u?void 0:u.hasPublished)||y?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:g.sent(),g.label=2;case 2:return this._localScreenAudioTrack&&e===xf.STREAM_INDEX_SCREEN?(S=!1,this._trackSourceType.audio===wf.AUDIO_SOURCE_TYPE_EXTERNAL&&(S=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,S?null===(h=null===(l=null===(d=this._room)||void 0===d?void 0:d.localScreenStream)||void 0===l?void 0:l.observer)||void 0===h||h.setEnableAudio(!1):null===(_=null===(f=null===(p=this._room)||void 0===p?void 0:p.localScreenStream)||void 0===f?void 0:f.observer)||void 0===_||_.setPushAudio(!1),(null===(v=this._room)||void 0===v?void 0:v.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:g.sent(),g.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var i,r,n,o,a,s,c,u,d;return t_(this,void 0,void 0,(function(){var l;return i_(this,(function(h){switch(h.label){case 0:if(eX.print("setExternalAudioTrack()","index: %o, track: %o",e,t),kD(e,"streamIndex",[xf.STREAM_INDEX_MAIN,xf.STREAM_INDEX_SCREEN]),e!==xf.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==wf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new RB(t,aD()),this._initLocalTrackEvents(this._localAudioTrack),l=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,null===(o=null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setPushAudio(!0),(null===(a=this._room)||void 0===a?void 0:a.hasPublished)||l?[4,this._updatePublish()]:[3,2];case 1:h.sent(),h.label=2;case 2:if(e!==xf.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==wf.AUDIO_SOURCE_TYPE_EXTERNAL)throw new lP(aP.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new RB(t,aD()),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localScreenStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushAudio(!0),(null===(d=this._room)||void 0===d?void 0:d.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},t.prototype.login=function(e,t){return t_(this,void 0,void 0,(function(){return i_(this,(function(i){return eX.print("login()","token: %o, userInfo: %o",e,t),LD(e)||PD(e,"token"),xD(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return t_(this,void 0,void 0,(function(){return i_(this,(function(e){return eX.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){return eX.print("updateLoginToken()","token: %o",e),LD(e)||PD(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){return eX.print("getPeerOnlineStatus()","userId: %o",e),xD(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return t_(this,void 0,void 0,(function(){var i,r=this;return i_(this,(function(n){xD(e),BD(t),i=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return r._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!1,i,t),t.id})).catch((function(t){throw r._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,i),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!1,i),t}return[2]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return t_(this,void 0,void 0,(function(){var i,r=this;return i_(this,(function(n){xD(e),MD(t,"message"),BD(t),i=Date.now();try{return[2,this._rtmClient.sendUserMessageOutsideRoom(e,t).then((function(t){return r._messageStatisticsObserver.countUserMessageOutsideRoom(!0,e,!0,i,t),t.id})).catch((function(t){throw r._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,i),t}))]}catch(t){throw this._messageStatisticsObserver.countUserMessageOutsideRoom(!1,e,!0,i),t}return[2]}))}))},t.prototype.setServerParams=function(e,t){return t_(this,void 0,void 0,(function(){return i_(this,(function(i){return eX.print("setServerParams()","signature: %o, url: %0",e,t),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return t_(this,void 0,void 0,(function(){var t,i=this;return i_(this,(function(r){PD(e,"message"),BD(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){i._messageStatisticsObserver.countServerMessage(!0,!1,t)})).catch((function(e){throw i._messageStatisticsObserver.countServerMessage(!1,!1,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!1,t),e}return[2]}))}))},t.prototype.sendServerBinaryMessage=function(e){return t_(this,void 0,void 0,(function(){var t,i=this;return i_(this,(function(r){MD(e,"message"),BD(e),t=Date.now();try{return[2,this._rtmClient.sendServerMessage(e).then((function(){i._messageStatisticsObserver.countServerMessage(!0,!0,t)})).catch((function(e){throw i._messageStatisticsObserver.countServerMessage(!1,!0,t),e}))]}catch(e){throw this._messageStatisticsObserver.countServerMessage(!1,!0,t),e}return[2]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new lP(aP.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;eX.print("startCloudProxy()",e),PD(e.logProxy,"logProxy"),PD(e.accessProxy,"accessProxy"),PD(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=aV("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=aV("LOG_SERVER_URL"),this._originConfigServerUrls=aV("CONFIG_REQUEST_DOMAINS"),oV("ICE_CONFIG_REQUEST_URLS",e.accessProxy),oV("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),oV("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new lP(aP.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");eX.print("stopCloudProxy()"),oV("ICE_CONFIG_REQUEST_URLS",[]),oV("LOG_SERVER_URL",this._originLogServerUrl),oV("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0},t.prototype.startPushPublicStream=function(e,t){return t_(this,void 0,void 0,(function(){var i,r=this;return i_(this,(function(n){if(eX.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),VD(e),!this._room||this._room.connectionState!==Sj.CONNECTED)throw new lP(aP.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new lP(aP.REPEAT_PUSH,"repeat push public media stream");return i=cV(e,"started",t),[2,this._room.publicStreamControlMessage(i).then((function(){r._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return t_(this,void 0,void 0,(function(){var i;return i_(this,(function(r){if(eX.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),VD(e),!this._room||this._room.connectionState!==Sj.CONNECTED)throw new lP(aP.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return i=cV(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(i)]}))}))},t.prototype.stopPushPublicStream=function(e){return t_(this,void 0,void 0,(function(){var t=this;return i_(this,(function(i){if(eX.print("startPushPublicStream()","publicStreamId: %o",e),VD(e),!this._room||this._room.connectionState!==Sj.CONNECTED)throw new lP(aP.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return[2,this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:e}).then((function(){t._publicStreamIds.delete(e)}))]}))}))},t.prototype.startPlayPublicStream=function(e){var t,i,r;return t_(this,void 0,void 0,(function(){var n,o,a,s=this;return i_(this,(function(c){switch(c.label){case 0:return VD(e),this._outsideRoom?[3,2]:(this._outsideRoom=new JW(this._appId,{audioProfileManager:this._audioProfileManager,enableFallbackHandler:rX(this._appId)}),this._outsideRoom.on(FB.RESUBSCRIBE,(function(e){var t,i,r=e.stream;if(r){var n=s._publicStreamAudioPlayer.get(r.streamId);n&&r.audioTrack&&(n.stop(),n.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var o=s._publicStreamVideoPlayer.get(r.streamId);o&&r.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(t=this._outsideRoom)||void 0===t||t.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,s.safeEmit(d_.onPublicStreamStats,e)})),null===(i=this._outsideRoom)||void 0===i||i.on(FB.ON_SEI_MESSAGED_RECEIVED,(function(e){s.safeEmit(d_.onPublicStreamSEIMessageReceived,e)})),[4,this._outsideRoom.connect()]);case 1:c.sent(),c.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return n=c.sent(),(o=this._publicStreamVideoPlayer.get(e))&&(null==n?void 0:n.videoTrack)&&o.playVideo(n.videoTrack,n),!(a=this._publicStreamAudioPlayer.get(e))&&(null==n?void 0:n.audioTrack)&&(a=new eG(e,{muted:(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)===Zf.VIDEO_ONLY}),this._initPlayerEvents(a,!0),a.playAudio(n.audioTrack),this._publicStreamAudioPlayer.set(e,a)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return t_(this,void 0,void 0,(function(){var t;return i_(this,(function(i){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.destroy(),this._publicStreamAudioPlayer.delete(e)),[2]):[2]}))}))},t.prototype.setAudioProfile=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){return this._audioProfileManager.setAudioProfile(e),[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var i,r,n;eX.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var o=this._publicStreamVideoPlayer.get(e);if(!(null==t?void 0:t.renderDom)&&o)return o.destroy(),void this._publicStreamVideoPlayer.delete(e);if(!o){o=new $j($f($f({},t),{userId:e})),this._initPlayerEvents(o,!0),this._publicStreamVideoPlayer.set(e,o);var a=null===(r=null===(i=this._outsideRoom)||void 0===i?void 0:i.remoteStreams)||void 0===r?void 0:r.get(e);(null==a?void 0:a.videoTrack)&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Zf.PLAY_MANUALLY&&o.playVideo(a.videoTrack,a)}},t.prototype.setDummyCaptureImagePath=function(e,t){return t_(this,void 0,void 0,(function(){var i=this;return i_(this,(function(r){return[2,new Promise((function(r,n){PD(t,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=t,o.onload=function(){try{var t=document.createElement("canvas"),a=t.getContext("2d");if(!a)return n(new lP(aP.UNEXPECTED_ERROR,"Not support canvas"));t.width=o.width,t.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(i._dummyTimer),i._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=t.captureStream(5).getVideoTracks()[0];e===xf.STREAM_INDEX_MAIN?i._localImgVideoTrack=s:i._localImgScreenTrack=s,r()}catch(e){n(new lP(aP.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){n(new lP(aP.UNEXPECTED_ERROR,"Load image error"))}}))]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(gV))},t.prototype._updatePublish=function(e){return void 0===e&&(e={}),t_(this,void 0,void 0,(function(){var t,i,r;return i_(this,(function(n){switch(n.label){case 0:if(eX.print("_updatePublish()","config: %o",e),t={mediaType:void 0,invokeByJoinRoom:!1,pubState:GB.PUB},e=$f($f({},t),e),!this._visibility)throw new lP(aP.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==Sj.CONNECTED)return i(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,e.mediaType,e.pubState,e.invokeByJoinRoom)];case 3:return n.sent(),[3,6];case 4:throw(r=n.sent())instanceof lP?r:new lP(aP.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype.startAudioPlaybackDeviceTest=function(e,t){return t_(this,void 0,void 0,(function(){return i_(this,(function(i){switch(i.label){case 0:return eX.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",e,t),PD(e,"filePath"),ND(t,"indicationInterval"),[4,this._audioDeviceManager.startAudioPlaybackDeviceTest(e,t)];case 1:return[2,i.sent()]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){eX.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()},t.prototype.startAudioDeviceRecordTest=function(e){return t_(this,void 0,void 0,(function(){return i_(this,(function(t){switch(t.label){case 0:return eX.print("startAudioDeviceRecordTest()","indicationInterval: %o",e),ND(e,"indicationInterval"),[4,this._audioDeviceManager.startAudioDeviceRecordTest(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){eX.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()},t.prototype.stopAudioDevicePlayTest=function(){eX.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()},t.prototype.setRemoteUserPriority=function(e,t){var i;eX.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{xD(e),kD(t,"priority",[Xf.HIGH,Xf.MEDIUM,Xf.LOW])}catch(e){return console.warn(e),!1}return this._userPriorityMap.set(e,t),null===(i=this._room)||void 0===i||i.setRemoteUserPriority(e,t),!0},t.prototype.setSubscribeFallbackOption=function(e){eX.print("setSubscribeFallbackOption()","option: %o",e);try{kD(e,"option",[Wf.DISABLE,Wf.VIDEO_STREAM_LOW,Wf.AUDIO_ONLY])}catch(e){return console.warn(e),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)},t.prototype._updateScreenPublish=function(e){return void 0===e&&(e={}),t_(this,void 0,void 0,(function(){var t,i,r;return i_(this,(function(n){switch(n.label){case 0:return eX.print("_updateScreenPublish()"),t={mediaType:void 0,pubState:GB.PUB},e=$f($f({},t),e),[4,this._pubLock.lock()];case 1:if(i=n.sent(),!this._room||this._room.connectionState!==Sj.CONNECTED)return i(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,e.mediaType,e.pubState)];case 3:return n.sent(),[3,6];case 4:throw(r=n.sent())instanceof lP?r:new lP(aP.UNEXPECTED_ERROR,"unexpected error",r);case 5:return i(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){var t,i;eX.print("_updateAudioPlayerState()");var r,n=e.userId,o=e.isScreen;if(r=o?this._remoteAudioPlayer.get("".concat(n,"_screen")):this._remoteAudioPlayer.get(n),e.audioTrack){if(!r){var a=o?"".concat(n,"_screen"):n;r=new eG(a,{muted:(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)===Zf.VIDEO_ONLY}),this._initPlayerEvents(r),this._remoteAudioPlayer.set(a,r),this._audioPlaybackDeviceId&&r.setPlaybackDevice(this._audioPlaybackDeviceId)}(null===(i=this._config)||void 0===i?void 0:i.autoPlayPolicy)!==Zf.PLAY_MANUALLY&&r.playAudio(e.audioTrack)}else null==r||r.stop()},t.prototype._updateVideoPlayerState=function(e){var t;eX.print("_updateVideoPlayerState()");var i,r=e.userId;i=e.isScreen?this._remoteScreenPlayer.get(r):this._remoteVideoPlayer.get(r),e.videoTrack?i&&(null===(t=this._config)||void 0===t?void 0:t.autoPlayPolicy)!==Zf.PLAY_MANUALLY&&i.playVideo(e.videoTrack,e):(null==i?void 0:i.played)&&(null==i||i.stop())},t.prototype._onAddStream=function(e){var t=e.stream,i=null==t?void 0:t.attributes,r=i.localaudio,n=i.audiostream,o=i.localvideo,a=i.videostream,s=nB.NONE;n&&(s|=Vf.AUDIO),a&&(s|=Vf.VIDEO),s&&((null==t?void 0:t.isScreen)?this.safeEmit(d_.onUserPublishScreen,{userId:t.userId,mediaType:s}):(this.safeEmit(d_.onUserPublishStream,{userId:t.userId,mediaType:s}),this._handleAutoSubscribe(t,!0)),(null==t?void 0:t.isScreen)||(r&&this.safeEmit(d_.onUserStartAudioCapture,{userId:t.userId}),o&&this.safeEmit(d_.onUserStartVideoCapture,{userId:t.userId})))},t.prototype._handleAutoSubscribe=function(e,t){var i,r,n,o,a=nB.NONE;(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(a|=Vf.AUDIO),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(a|=Vf.VIDEO),eX.print("_onAddStream","autoSubType: ".concat(a)),a&&(t&&bD(a)&&(null===(n=e.observer)||void 0===n||n.setAutoSubscribeAudio(!0)),t&&TD(a)&&(null===(o=e.observer)||void 0===o||o.setAutoSubscribeVideo(!0)),this._subscribe(!1,e.userId,a))},t.prototype._onRemoveStream=function(e){var t,i=this,r=e.stream,n=null!==(t=iX[e.reason])&&void 0!==t?t:Ff.STREAM_REMOVE_REASON_OTHER,o=r.isScreen?d_.onUserUnpublishScreen:d_.onUserUnpublishStream,a=Vf.AUDIO_AND_VIDEO;(null==r?void 0:r._workaround_1_)&&(a=Vf.VIDEO),this.safeEmit(o,{userId:r.userId,mediaType:a,reason:n}),this._getRemotePlayer(r.userId,r.isScreen).forEach((function(e){if(!(null==r?void 0:r._workaround_1_)){var t=r.isScreen?"".concat(r.userId,"_screen"):r.userId;i._remoteAudioPlayer.delete(t),r.isScreen?i._remoteScreenPlayer.delete(r.userId):i._remoteVideoPlayer.delete(r.userId),null==e||e.destroy()}}))},t.prototype._onUserConnection=function(e){this.safeEmit(d_.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(d_.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(d_.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onNetworkQuality=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.safeEmit.apply(this,o_([d_.onNetworkQuality],n_(e),!1))},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===Bf.CONNECTION_STATE_CONNECTED&&this.safeEmit(d_.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(d_.onConnectionStateChanged,e)},t.prototype._getRemotePlayer=function(e,t){return[this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]},t.prototype._stopAudioPropertiesReport=function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)},t.prototype._onResubscribe=function(e){e.stream&&(this._getRemotePlayer(e.stream.userId,e.stream.isScreen).forEach((function(e){return null==e?void 0:e.stop()})),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))},t.prototype._onSubscribePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onRemovePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onVideoFirstFrameDecoded=function(e){this.safeEmit(d_.onVideoFirstFrameDecoded,e)},t.prototype._onVideoDeviceStateChange=function(e){this.safeEmit(d_.onVideoDeviceStateChanged,e)},t.prototype._onAudioDeviceStateChange=function(e){this.safeEmit(d_.onAudioDeviceStateChanged,e)},t.prototype._onUserPublishStateChange=function(e){var t=e.userId,i=e.isScreen,r=e.mediaType,n=e.pubState,o=e.remoteStream,a={userId:t,mediaType:r};i?n===GB.PUB?this.safeEmit(d_.onUserPublishScreen,a):this.safeEmit(d_.onUserUnpublishScreen,$f($f({},a),{reason:Ff.STREAM_REMOVE_REASON_UNPUBLISH})):n===GB.PUB?(this.safeEmit(d_.onUserPublishStream,a),this._handleAutoSubscribe(o,!0)):this.safeEmit(d_.onUserUnpublishStream,$f($f({},a),{reason:Ff.STREAM_REMOVE_REASON_UNPUBLISH}))},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(d_.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(d_.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(d_.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(d_.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(d_.onLiveTranscodingResult,e)},t.prototype._onStreamMixingEvent=function(e){this.safeEmit(d_.onStreamMixingEvent,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(d_.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(d_.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(d_.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(d_.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(d_.onError,{errorCode:aP.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(d_.onError,{errorCode:aP.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(d_.onServerParamsSetResult,null==e?void 0:e.code)}))},Object.defineProperty(t.prototype,"waitForNewToken",{get:function(){return!!this._tempRoomConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localAudioTrack",{get:function(){return this._localAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localVideoTrack",{get:function(){return this._localVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenAudioTrack",{get:function(){return this._localScreenAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenVideoTrack",{get:function(){return this._localScreenVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){var e,t,i=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteStreams)&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){i.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))}))),i},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){var e,t,i=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteUsers)&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){i.push({userId:e.userId})}))),i},enumerable:!1,configurable:!0}),t.prototype._handleAudioDeviceManager=function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(d_.onAudioPlaybackDeviceTestVolume,t)}))},t.prototype._assertNotInRoom=function(){if(!this._room||this._room.connectionState!==Sj.CONNECTED)throw new lP(aP.INVOKED_BEFORE_JOIN_ROOM,"join first")},t.prototype._checkMediaType=function(e){kD(e,"mediaType",[Vf.AUDIO,Vf.VIDEO,Vf.AUDIO_AND_VIDEO])},t.prototype._getUserId=function(){var e,t;return(null===(t=null===(e=this._room)||void 0===e?void 0:e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"},e_([Gx()],t.prototype,"updateToken",null),e_([Gx()],t.prototype,"setVideoCaptureDevice",null),e_([Gx()],t.prototype,"setAudioCaptureDevice",null),e_([Gx()],t.prototype,"joinRoom",null),e_([Gx()],t.prototype,"leaveRoom",null),e_([Gx()],t.prototype,"destroy",null),e_([Gx()],t.prototype,"publishStream",null),e_([Gx()],t.prototype,"unpublishStream",null),e_([Gx()],t.prototype,"publishScreen",null),e_([Gx()],t.prototype,"unpublishScreen",null),e_([Gx()],t.prototype,"subscribeStream",null),e_([Gx()],t.prototype,"unsubscribeStream",null),e_([Gx()],t.prototype,"subscribeScreen",null),e_([Gx()],t.prototype,"unsubscribeScreen",null),e_([Gx()],t.prototype,"setRemoteVideoConfig",null),e_([Gx()],t.prototype,"startVideoCapture",null),e_([Gx()],t.prototype,"stopVideoCapture",null),e_([Gx()],t.prototype,"startAudioCapture",null),e_([Gx()],t.prototype,"stopAudioCapture",null),e_([Gx()],t.prototype,"getAudioMixingManager",null),e_([Gx()],t.prototype,"startScreenCapture",null),e_([Gx()],t.prototype,"stopScreenCapture",null),e_([Gx()],t.prototype,"setLocalVideoPlayer",null),e_([Gx()],t.prototype,"startLiveTranscoding",null),e_([Gx()],t.prototype,"updateLiveTranscoding",null),e_([Gx()],t.prototype,"stopLiveTranscoding",null),e_([Gx()],t.prototype,"setBusinessId",null),e_([Gx()],t.prototype,"setUserVisibility",null),e_([Gx()],t.prototype,"setRemoteVideoPlayer",null),e_([Gx()],t.prototype,"setLocalVideoMirrorType",null),e_([Gx()],t.prototype,"setAudioPlaybackDevice",null),e_([Gx()],t.prototype,"play",null),e_([Gx()],t.prototype,"pauseAllSubscribedStream",null),e_([Gx()],t.prototype,"resumeAllSubscribedStream",null),e_([Gx()],t.prototype,"sendUserMessage",null),e_([Gx()],t.prototype,"sendUserBinaryMessage",null),e_([Gx()],t.prototype,"sendRoomMessage",null),e_([Gx()],t.prototype,"sendRoomBinaryMessage",null),e_([Gx()],t.prototype,"setAudioCaptureConfig",null),e_([Gx()],t.prototype,"setVideoCaptureConfig",null),e_([Gx()],t.prototype,"enableSimulcastMode",null),e_([Gx()],t.prototype,"setVideoEncoderConfig",null),e_([Gx()],t.prototype,"setScreenEncoderConfig",null),e_([Gx()],t.prototype,"sendSEIMessage",null),e_([Gx()],t.prototype,"setAudioVolumeIndicationInterval",null),e_([Gx()],t.prototype,"enableAudioPropertiesReport",null),e_([Gx()],t.prototype,"setVideoSourceType",null),e_([Gx()],t.prototype,"setExternalVideoTrack",null),e_([Gx()],t.prototype,"setAudioSourceType",null),e_([Gx()],t.prototype,"setExternalAudioTrack",null),e_([Gx("rtm")],t.prototype,"login",null),e_([Gx("rtm")],t.prototype,"logout",null),e_([Gx("rtm")],t.prototype,"updateLoginToken",null),e_([Gx("rtm")],t.prototype,"getPeerOnlineStatus",null),e_([Gx("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),e_([Gx("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),e_([Gx("rtm")],t.prototype,"setServerParams",null),e_([Gx("rtm")],t.prototype,"sendServerMessage",null),e_([Gx("rtm")],t.prototype,"sendServerBinaryMessage",null),e_([Gx()],t.prototype,"startCloudProxy",null),e_([Gx()],t.prototype,"stopCloudProxy",null),e_([Gx()],t.prototype,"startPushPublicStream",null),e_([Gx()],t.prototype,"updatePublicStreamParam",null),e_([Gx()],t.prototype,"stopPushPublicStream",null),e_([Gx("outsideRoom")],t.prototype,"startPlayPublicStream",null),e_([Gx("outsideRoom")],t.prototype,"stopPlayPublicStream",null),e_([Gx()],t.prototype,"setAudioProfile",null),e_([Gx("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),e_([Gx()],t.prototype,"setDummyCaptureImagePath",null),e_([Gx()],t.prototype,"startAudioPlaybackDeviceTest",null),e_([Gx()],t.prototype,"stopAudioPlaybackDeviceTest",null),e_([Gx()],t.prototype,"startAudioDeviceRecordTest",null),e_([Gx()],t.prototype,"stopAudioDeviceRecordAndPlayTest",null),e_([Gx()],t.prototype,"stopAudioDevicePlayTest",null),e_([Gx()],t.prototype,"setRemoteUserPriority",null),e_([Gx()],t.prototype,"setSubscribeFallbackOption",null),t}(qD),iX={"client unpublished":Ff.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":Ff.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":Ff.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":Ff.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":Ff.STREAM_REMOVE_REASON_REPUBLISH};function rX(e){var t=$x.getServerConfig(e).web_rtc_config;return!!(null==t?void 0:t.fallback)||!!aV("ENABLE_FALLBACK_HANDLER")}var nX=new XD("VERTC",0);[Vx,Fx,Bx].forEach((function(e){return e.setStats({rtc_sdk_version:TV.VERSION,product_line:BL.RTC,report_version:jL.W_5,os:GL.WEB,device_id:$x.getDeviceId(),user_agent:uD()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var oX=function(e,t){return nX.print("createEngine","Invoke VERTC.createEngine"),PD(e,"appId"),[Vx,Fx,Bx].forEach((function(i){return i.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),Ux.sdkInitEngine(Date.now(),yx.BEGIN),new tX(e,t)},aX=function(e){if(nX.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof tX))throw new lP(aP.INVALID_ENGINE,"Invalid engine object");e.destroy(),Ux.sdkInitEngine(Date.now(),yx.END)},sX=function(){return t_(void 0,void 0,void 0,(function(){return i_(this,(function(e){return[2,aB.enumerateDevices()]}))}))},cX=function(e){return void 0===e&&(e={video:!0,audio:!0}),t_(void 0,void 0,void 0,(function(){var t,i,r,n,o;return i_(this,(function(a){switch(a.label){case 0:if(t=e.video,i=e.audio,r={video:!1,audio:!1},!t)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),n=r,[4,aB.getVideoPermission()];case 2:return n.video=a.sent(),[3,4];case 3:return a.sent(),[3,4];case 4:if(!i)return[3,8];a.label=5;case 5:return a.trys.push([5,7,,8]),o=r,[4,aB.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,r]}}))}))},uX=function(){return t_(void 0,void 0,void 0,(function(){return i_(this,(function(e){return[2,aB.enumerateAudioCaptureDevices()]}))}))},dX=function(){return t_(void 0,void 0,void 0,(function(){return i_(this,(function(e){return[2,aB.enumerateVideoCaptureDevices()]}))}))},lX=function(){return t_(void 0,void 0,void 0,(function(){return i_(this,(function(e){return[2,aB.enumerateAudioPlaybackDevices()]}))}))},hX=function(){return TV.VERSION},pX=function(){return Ux.rtcSdkApiCall("isSupported",0,""),t_(void 0,void 0,void 0,(function(){var e;return i_(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),!uD()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,YV()]:[2,!1];case 1:return[2,null==(e=t.sent())?void 0:e.includes("H264")];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},fX=function(){return Ux.rtcSdkApiCall("getSupportedCodecs",0,""),t_(void 0,void 0,void 0,(function(){return i_(this,(function(e){switch(e.label){case 0:return[4,YV()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!uD()&&location.search.includes("_rtc_autotest_");var _X=new function(){this.getSdkVersion=hX,this.createEngine=oX,this.destroyEngine=aX,this.enumerateDevices=sX,this.enableDevices=cX,this.enumerateAudioCaptureDevices=uX,this.enumerateVideoCaptureDevices=dX,this.enumerateAudioPlaybackDevices=lX,this.getParameter=aV,this.setParameter=oV,this.isSupported=pX,this.getSupportedCodecs=fX,this.events=d_,this.ErrorCode=aP,this.platform="BytePlus",this._monitor=Ux};return $f($f($f($f({},_X),u_),h_),{events:d_})}));
|