@byteplus/rtc 4.51.10 → 4.51.12

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.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.51.10
4
+ * version: 4.51.12
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(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var t="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 t&&t)||function(){return this}()||Function("return this")(),i=function(e){try{return!!e()}catch(t){return!0}},o=!i((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),a=o,s=Function.prototype,c=s.apply,u=s.call,d="object"==typeof Reflect&&Reflect.apply||(a?u.bind(c):function(){return u.apply(c,arguments)}),l=o,h=Function.prototype,p=h.call,f=l&&h.bind.bind(p,p),v=l?f:function(e){return function(){return p.apply(e,arguments)}},_=v,m=_({}.toString),y=_("".slice),g=function(e){return y(m(e),8,-1)},S=g,E=v,b=function(e){if("Function"===S(e))return E(e)},k="object"==typeof document&&document.all,T={all:k,IS_HTMLDDA:void 0===k&&void 0!==k},I=T.all,A=T.IS_HTMLDDA?function(e){return"function"==typeof e||e===I}:function(e){return"function"==typeof e},R={},C=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),w=o,x=Function.prototype.call,O=w?x.bind(x):function(){return x.apply(x,arguments)},D={},P={}.propertyIsEnumerable,N=Object.getOwnPropertyDescriptor,M=N&&!P.call({1:2},1);D.f=M?function(e){var t=N(this,e);return!!t&&t.enumerable}:P;var L,U,V=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},F=i,B=g,j=Object,G=b("".split),H=F((function(){return!j("z").propertyIsEnumerable(0)}))?function(e){return"String"==B(e)?G(e,""):j(e)}:j,z=function(e){return null==e},K=z,X=TypeError,q=function(e){if(K(e))throw X("Can't call method on "+e);return e},W=H,Y=q,Q=function(e){return W(Y(e))},J=A,Z=T.all,$=T.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:J(e)||e===Z}:function(e){return"object"==typeof e?null!==e:J(e)},ee={},te=ee,re=n,ne=A,ie=function(e){return ne(e)?e:void 0},oe=function(e,t){return arguments.length<2?ie(te[e])||ie(re[e]):te[e]&&te[e][t]||re[e]&&re[e][t]},ae=b({}.isPrototypeOf),se=oe("navigator","userAgent")||"",ce=n,ue=se,de=ce.process,le=ce.Deno,he=de&&de.versions||le&&le.version,pe=he&&he.v8;pe&&(U=(L=pe.split("."))[0]>0&&L[0]<4?1:+(L[0]+L[1])),!U&&ue&&(!(L=ue.match(/Edge\/(\d+)/))||L[1]>=74)&&(L=ue.match(/Chrome\/(\d+)/))&&(U=+L[1]);var fe=U,ve=fe,_e=i,me=!!Object.getOwnPropertySymbols&&!_e((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ve&&ve<41})),ye=me&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ge=oe,Se=A,Ee=ae,be=Object,ke=ye?function(e){return"symbol"==typeof e}:function(e){var t=ge("Symbol");return Se(t)&&Ee(t.prototype,be(e))},Te=String,Ie=function(e){try{return Te(e)}catch(t){return"Object"}},Ae=A,Re=Ie,Ce=TypeError,we=function(e){if(Ae(e))return e;throw Ce(Re(e)+" is not a function")},xe=we,Oe=z,De=function(e,t){var r=e[t];return Oe(r)?void 0:xe(r)},Pe=O,Ne=A,Me=$,Le=TypeError,Ue={exports:{}},Ve=n,Fe=Object.defineProperty,Be=function(e,t){try{Fe(Ve,e,{value:t,configurable:!0,writable:!0})}catch(r){Ve[e]=t}return t},je="__core-js_shared__",Ge=n[je]||Be(je,{}),He=Ge;(Ue.exports=function(e,t){return He[e]||(He[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.0",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ze=q,Ke=Object,Xe=function(e){return Ke(ze(e))},qe=Xe,We=b({}.hasOwnProperty),Ye=Object.hasOwn||function(e,t){return We(qe(e),t)},Qe=b,Je=0,Ze=Math.random(),$e=Qe(1..toString),et=function(e){return"Symbol("+(void 0===e?"":e)+")_"+$e(++Je+Ze,36)},tt=n,rt=Ue.exports,nt=Ye,it=et,ot=me,at=ye,st=rt("wks"),ct=tt.Symbol,ut=ct&&ct.for,dt=at?ct:ct&&ct.withoutSetter||it,lt=function(e){if(!nt(st,e)||!ot&&"string"!=typeof st[e]){var t="Symbol."+e;ot&&nt(ct,e)?st[e]=ct[e]:st[e]=at&&ut?ut(t):dt(t)}return st[e]},ht=O,pt=$,ft=ke,vt=De,_t=function(e,t){var r,n;if("string"===t&&Ne(r=e.toString)&&!Me(n=Pe(r,e)))return n;if(Ne(r=e.valueOf)&&!Me(n=Pe(r,e)))return n;if("string"!==t&&Ne(r=e.toString)&&!Me(n=Pe(r,e)))return n;throw Le("Can't convert object to primitive value")},mt=TypeError,yt=lt("toPrimitive"),gt=function(e,t){if(!pt(e)||ft(e))return e;var r,n=vt(e,yt);if(n){if(void 0===t&&(t="default"),r=ht(n,e,t),!pt(r)||ft(r))return r;throw mt("Can't convert object to primitive value")}return void 0===t&&(t="number"),_t(e,t)},St=ke,Et=function(e){var t=gt(e,"string");return St(t)?t:t+""},bt=$,kt=n.document,Tt=bt(kt)&&bt(kt.createElement),It=function(e){return Tt?kt.createElement(e):{}},At=It,Rt=!C&&!i((function(){return 7!=Object.defineProperty(At("div"),"a",{get:function(){return 7}}).a})),Ct=C,wt=O,xt=D,Ot=V,Dt=Q,Pt=Et,Nt=Ye,Mt=Rt,Lt=Object.getOwnPropertyDescriptor;R.f=Ct?Lt:function(e,t){if(e=Dt(e),t=Pt(t),Mt)try{return Lt(e,t)}catch(r){}if(Nt(e,t))return Ot(!wt(xt.f,e,t),e[t])};var Ut=i,Vt=A,Ft=/#|\.prototype\./,Bt=function(e,t){var r=Gt[jt(e)];return r==zt||r!=Ht&&(Vt(t)?Ut(t):!!t)},jt=Bt.normalize=function(e){return String(e).replace(Ft,".").toLowerCase()},Gt=Bt.data={},Ht=Bt.NATIVE="N",zt=Bt.POLYFILL="P",Kt=Bt,Xt=we,qt=o,Wt=b(b.bind),Yt=function(e,t){return Xt(e),void 0===t?e:qt?Wt(e,t):function(){return e.apply(t,arguments)}},Qt={},Jt=C&&i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Zt=$,$t=String,er=TypeError,tr=function(e){if(Zt(e))return e;throw er($t(e)+" is not an object")},rr=C,nr=Rt,ir=Jt,or=tr,ar=Et,sr=TypeError,cr=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,dr="enumerable",lr="configurable",hr="writable";Qt.f=rr?ir?function(e,t,r){if(or(e),t=ar(t),or(r),"function"==typeof e&&"prototype"===t&&"value"in r&&hr in r&&!r.writable){var n=ur(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:lr in r?r.configurable:n.configurable,enumerable:dr in r?r.enumerable:n.enumerable,writable:!1})}return cr(e,t,r)}:cr:function(e,t,r){if(or(e),t=ar(t),or(r),nr)try{return cr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw sr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var pr=Qt,fr=V,vr=C?function(e,t,r){return pr.f(e,t,fr(1,r))}:function(e,t,r){return e[t]=r,e},_r=n,mr=d,yr=b,gr=A,Sr=R.f,Er=Kt,br=ee,kr=Yt,Tr=vr,Ir=Ye,Ar=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return mr(e,this,arguments)};return t.prototype=e.prototype,t},Rr=function(e,t){var r,n,i,o,a,s,c,u,d=e.target,l=e.global,h=e.stat,p=e.proto,f=l?_r:h?_r[d]:(_r[d]||{}).prototype,v=l?br:br[d]||Tr(br,d,{})[d],_=v.prototype;for(i in t)r=!Er(l?i:d+(h?".":"#")+i,e.forced)&&f&&Ir(f,i),a=v[i],r&&(s=e.dontCallGetSet?(u=Sr(f,i))&&u.value:f[i]),o=r&&s?s:t[i],r&&typeof a==typeof o||(c=e.bind&&r?kr(o,_r):e.wrap&&r?Ar(o):p&&gr(o)?yr(o):o,(e.sham||o&&o.sham||a&&a.sham)&&Tr(c,"sham",!0),Tr(v,i,c),p&&(Ir(br,n=d+"Prototype")||Tr(br,n,{}),Tr(br[n],i,o),e.real&&_&&!_[i]&&Tr(_,i,o)))},Cr=Math.ceil,wr=Math.floor,xr=Math.trunc||function(e){var t=+e;return(t>0?wr:Cr)(t)},Or=function(e){var t=+e;return t!=t||0===t?0:xr(t)},Dr=Or,Pr=Math.max,Nr=Math.min,Mr=function(e,t){var r=Dr(e);return r<0?Pr(r+t,0):Nr(r,t)},Lr=Or,Ur=Math.min,Vr=function(e){return e>0?Ur(Lr(e),9007199254740991):0},Fr=Vr,Br=function(e){return Fr(e.length)},jr=Q,Gr=Mr,Hr=Br,zr=function(e){return function(t,r,n){var i,o=jr(t),a=Hr(o),s=Gr(n,a);if(e&&r!=r){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},Kr={includes:zr(!0),indexOf:zr(!1)},Xr={},qr=Ye,Wr=Q,Yr=Kr.indexOf,Qr=Xr,Jr=b([].push),Zr=function(e,t){var r,n=Wr(e),i=0,o=[];for(r in n)!qr(Qr,r)&&qr(n,r)&&Jr(o,r);for(;t.length>i;)qr(n,r=t[i++])&&(~Yr(o,r)||Jr(o,r));return o},$r=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],en=Zr,tn=$r,rn=Object.keys||function(e){return en(e,tn)},nn=Xe,on=rn;Rr({target:"Object",stat:!0,forced:i((function(){on(1)}))},{keys:function(e){return on(nn(e))}});var an=ee.Object.keys,sn={};sn[lt("toStringTag")]="z";var cn="[object z]"===String(sn),un=cn,dn=A,ln=g,hn=lt("toStringTag"),pn=Object,fn="Arguments"==ln(function(){return arguments}()),vn=un?ln:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(r){}}(t=pn(e),hn))?r:fn?ln(t):"Object"==(n=ln(t))&&dn(t.callee)?"Arguments":n},_n=vn,mn=String,yn=function(e){if("Symbol"===_n(e))throw TypeError("Cannot convert a Symbol value to a string");return mn(e)},gn={},Sn=C,En=Jt,bn=Qt,kn=tr,Tn=Q,In=rn;gn.f=Sn&&!En?Object.defineProperties:function(e,t){kn(e);for(var r,n=Tn(t),i=In(t),o=i.length,a=0;o>a;)bn.f(e,r=i[a++],n[r]);return e};var An,Rn=oe("document","documentElement"),Cn=Ue.exports,wn=et,xn=Cn("keys"),On=function(e){return xn[e]||(xn[e]=wn(e))},Dn=tr,Pn=gn,Nn=$r,Mn=Xr,Ln=Rn,Un=It,Vn=On("IE_PROTO"),Fn=function(){},Bn=function(e){return"<script>"+e+"</"+"script>"},jn=function(e){e.write(Bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},Gn=function(){try{An=new ActiveXObject("htmlfile")}catch(n){}var e,t;Gn="undefined"!=typeof document?document.domain&&An?jn(An):((t=Un("iframe")).style.display="none",Ln.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Bn("document.F=Object")),e.close(),e.F):jn(An);for(var r=Nn.length;r--;)delete Gn.prototype[Nn[r]];return Gn()};Mn[Vn]=!0;var Hn=Object.create||function(e,t){var r;return null!==e?(Fn.prototype=Dn(e),r=new Fn,Fn.prototype=null,r[Vn]=e):r=Gn(),void 0===t?r:Pn.f(r,t)},zn={},Kn=Zr,Xn=$r.concat("length","prototype");zn.f=Object.getOwnPropertyNames||function(e){return Kn(e,Xn)};var qn={},Wn=Et,Yn=Qt,Qn=V,Jn=function(e,t,r){var n=Wn(t);n in e?Yn.f(e,n,Qn(0,r)):e[n]=r},Zn=Mr,$n=Br,ei=Jn,ti=Array,ri=Math.max,ni=function(e,t,r){for(var n=$n(e),i=Zn(t,n),o=Zn(void 0===r?n:r,n),a=ti(ri(o-i,0)),s=0;i<o;i++,s++)ei(a,s,e[i]);return a.length=s,a},ii=g,oi=Q,ai=zn.f,si=ni,ci="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];qn.f=function(e){return ci&&"Window"==ii(e)?function(e){try{return ai(e)}catch(t){return si(ci)}}(e):ai(oi(e))};var ui={};ui.f=Object.getOwnPropertySymbols;var di=vr,li=function(e,t,r,n){return n&&n.enumerable?e[t]=r:di(e,t,r),e},hi={},pi=lt;hi.f=pi;var fi,vi,_i,mi=ee,yi=Ye,gi=hi,Si=Qt.f,Ei=function(e){var t=mi.Symbol||(mi.Symbol={});yi(t,e)||Si(t,e,{value:gi.f(e)})},bi=O,ki=oe,Ti=lt,Ii=li,Ai=function(){var e=ki("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=Ti("toPrimitive");t&&!t[n]&&Ii(t,n,(function(e){return bi(r,this)}),{arity:1})},Ri=vn,Ci=cn?{}.toString:function(){return"[object "+Ri(this)+"]"},wi=cn,xi=Qt.f,Oi=vr,Di=Ye,Pi=Ci,Ni=lt("toStringTag"),Mi=function(e,t,r,n){if(e){var i=r?e:e.prototype;Di(i,Ni)||xi(i,Ni,{configurable:!0,value:t}),n&&!wi&&Oi(i,"toString",Pi)}},Li=A,Ui=n.WeakMap,Vi=Li(Ui)&&/native code/.test(String(Ui)),Fi=Vi,Bi=n,ji=$,Gi=vr,Hi=Ye,zi=Ge,Ki=On,Xi=Xr,qi="Object already initialized",Wi=Bi.TypeError,Yi=Bi.WeakMap;if(Fi||zi.state){var Qi=zi.state||(zi.state=new Yi);Qi.get=Qi.get,Qi.has=Qi.has,Qi.set=Qi.set,fi=function(e,t){if(Qi.has(e))throw Wi(qi);return t.facade=e,Qi.set(e,t),t},vi=function(e){return Qi.get(e)||{}},_i=function(e){return Qi.has(e)}}else{var Ji=Ki("state");Xi[Ji]=!0,fi=function(e,t){if(Hi(e,Ji))throw Wi(qi);return t.facade=e,Gi(e,Ji,t),t},vi=function(e){return Hi(e,Ji)?e[Ji]:{}},_i=function(e){return Hi(e,Ji)}}var Zi={set:fi,get:vi,has:_i,enforce:function(e){return _i(e)?vi(e):fi(e,{})},getterFor:function(e){return function(t){var r;if(!ji(t)||(r=vi(t)).type!==e)throw Wi("Incompatible receiver, "+e+" required");return r}}},$i=g,eo=Array.isArray||function(e){return"Array"==$i(e)},to=A,ro=Ge,no=b(Function.toString);to(ro.inspectSource)||(ro.inspectSource=function(e){return no(e)});var io=ro.inspectSource,oo=b,ao=i,so=A,co=vn,uo=io,lo=function(){},ho=[],po=oe("Reflect","construct"),fo=/^\s*(?:class|function)\b/,vo=oo(fo.exec),_o=!fo.exec(lo),mo=function(e){if(!so(e))return!1;try{return po(lo,ho,e),!0}catch(t){return!1}},yo=function(e){if(!so(e))return!1;switch(co(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return _o||!!vo(fo,uo(e))}catch(t){return!0}};yo.sham=!0;var go=!po||ao((function(){var e;return mo(mo.call)||!mo(Object)||!mo((function(){e=!0}))||e}))?yo:mo,So=eo,Eo=go,bo=$,ko=lt("species"),To=Array,Io=function(e){var t;return So(e)&&(t=e.constructor,(Eo(t)&&(t===To||So(t.prototype))||bo(t)&&null===(t=t[ko]))&&(t=void 0)),void 0===t?To:t},Ao=function(e,t){return new(Io(e))(0===t?0:t)},Ro=Yt,Co=H,wo=Xe,xo=Br,Oo=Ao,Do=b([].push),Po=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,p,f=wo(c),v=Co(f),_=Ro(u,d),m=xo(v),y=0,g=l||Oo,S=t?g(c,m):r||a?g(c,0):void 0;m>y;y++)if((s||y in v)&&(p=_(h=v[y],y,f),e))if(t)S[y]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return y;case 2:Do(S,h)}else switch(e){case 4:return!1;case 7:Do(S,h)}return o?-1:n||i?i:S}},No={forEach:Po(0),map:Po(1),filter:Po(2),some:Po(3),every:Po(4),find:Po(5),findIndex:Po(6),filterReject:Po(7)},Mo=Rr,Lo=n,Uo=O,Vo=b,Fo=C,Bo=me,jo=i,Go=Ye,Ho=ae,zo=tr,Ko=Q,Xo=Et,qo=yn,Wo=V,Yo=Hn,Qo=rn,Jo=zn,Zo=qn,$o=ui,ea=R,ta=Qt,ra=gn,na=D,ia=li,oa=Ue.exports,aa=Xr,sa=et,ca=lt,ua=hi,da=Ei,la=Ai,ha=Mi,pa=Zi,fa=No.forEach,va=On("hidden"),_a="Symbol",ma=pa.set,ya=pa.getterFor(_a),ga=Object.prototype,Sa=Lo.Symbol,Ea=Sa&&Sa.prototype,ba=Lo.TypeError,ka=Lo.QObject,Ta=ea.f,Ia=ta.f,Aa=Zo.f,Ra=na.f,Ca=Vo([].push),wa=oa("symbols"),xa=oa("op-symbols"),Oa=oa("wks"),Da=!ka||!ka.prototype||!ka.prototype.findChild,Pa=Fo&&jo((function(){return 7!=Yo(Ia({},"a",{get:function(){return Ia(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=Ta(ga,t);n&&delete ga[t],Ia(e,t,r),n&&e!==ga&&Ia(ga,t,n)}:Ia,Na=function(e,t){var r=wa[e]=Yo(Ea);return ma(r,{type:_a,tag:e,description:t}),Fo||(r.description=t),r},Ma=function(e,t,r){e===ga&&Ma(xa,t,r),zo(e);var n=Xo(t);return zo(r),Go(wa,n)?(r.enumerable?(Go(e,va)&&e[va][n]&&(e[va][n]=!1),r=Yo(r,{enumerable:Wo(0,!1)})):(Go(e,va)||Ia(e,va,Wo(1,{})),e[va][n]=!0),Pa(e,n,r)):Ia(e,n,r)},La=function(e,t){zo(e);var r=Ko(t),n=Qo(r).concat(Ba(r));return fa(n,(function(t){Fo&&!Uo(Ua,r,t)||Ma(e,t,r[t])})),e},Ua=function(e){var t=Xo(e),r=Uo(Ra,this,t);return!(this===ga&&Go(wa,t)&&!Go(xa,t))&&(!(r||!Go(this,t)||!Go(wa,t)||Go(this,va)&&this[va][t])||r)},Va=function(e,t){var r=Ko(e),n=Xo(t);if(r!==ga||!Go(wa,n)||Go(xa,n)){var i=Ta(r,n);return!i||!Go(wa,n)||Go(r,va)&&r[va][n]||(i.enumerable=!0),i}},Fa=function(e){var t=Aa(Ko(e)),r=[];return fa(t,(function(e){Go(wa,e)||Go(aa,e)||Ca(r,e)})),r},Ba=function(e){var t=e===ga,r=Aa(t?xa:Ko(e)),n=[];return fa(r,(function(e){!Go(wa,e)||t&&!Go(ga,e)||Ca(n,wa[e])})),n};Bo||(Sa=function(){if(Ho(Ea,this))throw ba("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?qo(arguments[0]):void 0,t=sa(e),r=function(e){this===ga&&Uo(r,xa,e),Go(this,va)&&Go(this[va],t)&&(this[va][t]=!1),Pa(this,t,Wo(1,e))};return Fo&&Da&&Pa(ga,t,{configurable:!0,set:r}),Na(t,e)},ia(Ea=Sa.prototype,"toString",(function(){return ya(this).tag})),ia(Sa,"withoutSetter",(function(e){return Na(sa(e),e)})),na.f=Ua,ta.f=Ma,ra.f=La,ea.f=Va,Jo.f=Zo.f=Fa,$o.f=Ba,ua.f=function(e){return Na(ca(e),e)},Fo&&Ia(Ea,"description",{configurable:!0,get:function(){return ya(this).description}})),Mo({global:!0,constructor:!0,wrap:!0,forced:!Bo,sham:!Bo},{Symbol:Sa}),fa(Qo(Oa),(function(e){da(e)})),Mo({target:_a,stat:!0,forced:!Bo},{useSetter:function(){Da=!0},useSimple:function(){Da=!1}}),Mo({target:"Object",stat:!0,forced:!Bo,sham:!Fo},{create:function(e,t){return void 0===t?Yo(e):La(Yo(e),t)},defineProperty:Ma,defineProperties:La,getOwnPropertyDescriptor:Va}),Mo({target:"Object",stat:!0,forced:!Bo},{getOwnPropertyNames:Fa}),la(),ha(Sa,_a),aa[va]=!0;var ja=me&&!!Symbol.for&&!!Symbol.keyFor,Ga=Rr,Ha=oe,za=Ye,Ka=yn,Xa=Ue.exports,qa=ja,Wa=Xa("string-to-symbol-registry"),Ya=Xa("symbol-to-string-registry");Ga({target:"Symbol",stat:!0,forced:!qa},{for:function(e){var t=Ka(e);if(za(Wa,t))return Wa[t];var r=Ha("Symbol")(t);return Wa[t]=r,Ya[r]=t,r}});var Qa=Rr,Ja=Ye,Za=ke,$a=Ie,es=ja,ts=(0,Ue.exports)("symbol-to-string-registry");Qa({target:"Symbol",stat:!0,forced:!es},{keyFor:function(e){if(!Za(e))throw TypeError($a(e)+" is not a symbol");if(Ja(ts,e))return ts[e]}});var rs=b([].slice),ns=Rr,is=oe,os=d,as=O,ss=b,cs=i,us=eo,ds=A,ls=$,hs=ke,ps=rs,fs=me,vs=is("JSON","stringify"),_s=ss(/./.exec),ms=ss("".charAt),ys=ss("".charCodeAt),gs=ss("".replace),Ss=ss(1..toString),Es=/[\uD800-\uDFFF]/g,bs=/^[\uD800-\uDBFF]$/,ks=/^[\uDC00-\uDFFF]$/,Ts=!fs||cs((function(){var e=is("Symbol")();return"[null]"!=vs([e])||"{}"!=vs({a:e})||"{}"!=vs(Object(e))})),Is=cs((function(){return'"\\udf06\\ud834"'!==vs("\udf06\ud834")||'"\\udead"'!==vs("\udead")})),As=function(e,t){var r=ps(arguments),n=t;if((ls(t)||void 0!==e)&&!hs(e))return us(t)||(t=function(e,t){if(ds(n)&&(t=as(n,this,e,t)),!hs(t))return t}),r[1]=t,os(vs,null,r)},Rs=function(e,t,r){var n=ms(r,t-1),i=ms(r,t+1);return _s(bs,e)&&!_s(ks,i)||_s(ks,e)&&!_s(bs,n)?"\\u"+Ss(ys(e,0),16):e};vs&&ns({target:"JSON",stat:!0,arity:3,forced:Ts||Is},{stringify:function(e,t,r){var n=ps(arguments),i=os(Ts?As:vs,null,n);return Is&&"string"==typeof i?gs(i,Es,Rs):i}});var Cs=ui,ws=Xe;Rr({target:"Object",stat:!0,forced:!me||i((function(){Cs.f(1)}))},{getOwnPropertySymbols:function(e){var t=Cs.f;return t?t(ws(e)):[]}});var xs=ee.Object.getOwnPropertySymbols,Os=i,Ds=fe,Ps=lt("species"),Ns=function(e){return Ds>=51||!Os((function(){var t=[];return(t.constructor={})[Ps]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Ms=No.filter;Rr({target:"Array",proto:!0,forced:!Ns("filter")},{filter:function(e){return Ms(this,e,arguments.length>1?arguments[1]:void 0)}});var Ls=ee,Us=function(e){return Ls[e+"Prototype"]},Vs=Us("Array").filter,Fs=ae,Bs=Vs,js=Array.prototype,Gs=function(e){var t=e.filter;return e===js||Fs(js,e)&&t===js.filter?Bs:t},Hs={exports:{}},zs=Rr,Ks=i,Xs=Q,qs=R.f,Ws=C,Ys=Ks((function(){qs(1)}));zs({target:"Object",stat:!0,forced:!Ws||Ys,sham:!Ws},{getOwnPropertyDescriptor:function(e,t){return qs(Xs(e),t)}});var Qs=ee.Object,Js=Hs.exports=function(e,t){return Qs.getOwnPropertyDescriptor(e,t)};Qs.getOwnPropertyDescriptor.sham&&(Js.sham=!0);var Zs,$s,ec,tc=Hs.exports,rc={},nc=C,ic=Ye,oc=Function.prototype,ac=nc&&Object.getOwnPropertyDescriptor,sc=ic(oc,"name"),cc={EXISTS:sc,PROPER:sc&&"something"===function(){}.name,CONFIGURABLE:sc&&(!nc||nc&&ac(oc,"name").configurable)},uc=!i((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),dc=Ye,lc=A,hc=Xe,pc=uc,fc=On("IE_PROTO"),vc=Object,_c=vc.prototype,mc=pc?vc.getPrototypeOf:function(e){var t=hc(e);if(dc(t,fc))return t[fc];var r=t.constructor;return lc(r)&&t instanceof r?r.prototype:t instanceof vc?_c:null},yc=i,gc=A,Sc=$,Ec=Hn,bc=mc,kc=li,Tc=lt("iterator"),Ic=!1;[].keys&&("next"in(ec=[].keys())?($s=bc(bc(ec)))!==Object.prototype&&(Zs=$s):Ic=!0);var Ac=!Sc(Zs)||yc((function(){var e={};return Zs[Tc].call(e)!==e}));gc((Zs=Ac?{}:Ec(Zs))[Tc])||kc(Zs,Tc,(function(){return this}));var Rc={IteratorPrototype:Zs,BUGGY_SAFARI_ITERATORS:Ic},Cc=Rc.IteratorPrototype,wc=Hn,xc=V,Oc=Mi,Dc=rc,Pc=function(){return this},Nc=function(e,t,r,n){var i=t+" Iterator";return e.prototype=wc(Cc,{next:xc(+!n,r)}),Oc(e,i,!1,!0),Dc[i]=Pc,e},Mc=A,Lc=String,Uc=TypeError,Vc=b,Fc=tr,Bc=function(e){if("object"==typeof e||Mc(e))return e;throw Uc("Can't set "+Lc(e)+" as a prototype")},jc=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Vc(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Fc(r),Bc(n),t?e(r,n):r.__proto__=n,r}}():void 0),Gc=Rr,Hc=O,zc=cc,Kc=Nc,Xc=mc,qc=Mi,Wc=li,Yc=rc,Qc=Rc,Jc=zc.PROPER,Zc=Qc.BUGGY_SAFARI_ITERATORS,$c=lt("iterator"),eu="keys",tu="values",ru="entries",nu=function(){return this},iu=function(e,t,r,n,i,o,a){Kc(r,t,n);var s,c,u,d=function(e){if(e===i&&v)return v;if(!Zc&&e in p)return p[e];switch(e){case eu:case tu:case ru:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[$c]||p["@@iterator"]||i&&p[i],v=!Zc&&f||d(i),_="Array"==t&&p.entries||f;if(_&&(s=Xc(_.call(new e)))!==Object.prototype&&s.next&&(qc(s,l,!0,!0),Yc[l]=nu),Jc&&i==tu&&f&&f.name!==tu&&(h=!0,v=function(){return Hc(f,this)}),i)if(c={values:d(tu),keys:o?v:d(eu),entries:d(ru)},a)for(u in c)(Zc||h||!(u in p))&&Wc(p,u,c[u]);else Gc({target:t,proto:!0,forced:Zc||h},c);return a&&p[$c]!==v&&Wc(p,$c,v,{name:i}),Yc[t]=v,c},ou=function(e,t){return{value:e,done:t}},au=Q,su=function(){},cu=rc,uu=Zi,du=(Qt.f,iu),lu=ou,hu="Array Iterator",pu=uu.set,fu=uu.getterFor(hu);du(Array,"Array",(function(e,t){pu(this,{type:hu,target:au(e),index:0,kind:t})}),(function(){var e=fu(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,lu(void 0,!0)):lu("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values");cu.Arguments=cu.Array;su(),su(),su();var vu={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},_u=n,mu=vn,yu=vr,gu=rc,Su=lt("toStringTag");for(var Eu in vu){var bu=_u[Eu],ku=bu&&bu.prototype;ku&&mu(ku)!==Su&&yu(ku,Su,Eu),gu[Eu]=gu.Array}var Tu=i,Iu=function(e,t){var r=[][e];return!!r&&Tu((function(){r.call(null,t||function(){return 1},1)}))},Au=No.forEach,Ru=Iu("forEach")?[].forEach:function(e){return Au(this,e,arguments.length>1?arguments[1]:void 0)};Rr({target:"Array",proto:!0,forced:[].forEach!=Ru},{forEach:Ru});var Cu=Us("Array").forEach,wu=vn,xu=Ye,Ou=ae,Du=Cu,Pu=Array.prototype,Nu={DOMTokenList:!0,NodeList:!0},Mu=function(e){var t=e.forEach;return e===Pu||Ou(Pu,e)&&t===Pu.forEach||xu(Nu,wu(e))?Du:t},Lu=oe,Uu=zn,Vu=ui,Fu=tr,Bu=b([].concat),ju=Lu("Reflect","ownKeys")||function(e){var t=Uu.f(Fu(e)),r=Vu.f;return r?Bu(t,r(e)):t},Gu=ju,Hu=Q,zu=R,Ku=Jn;Rr({target:"Object",stat:!0,sham:!C},{getOwnPropertyDescriptors:function(e){for(var t,r,n=Hu(e),i=zu.f,o=Gu(n),a={},s=0;o.length>s;)void 0!==(r=i(n,t=o[s++]))&&Ku(a,t,r);return a}});var Xu=ee.Object.getOwnPropertyDescriptors,qu={exports:{}},Wu=Rr,Yu=C,Qu=gn.f;Wu({target:"Object",stat:!0,forced:Object.defineProperties!==Qu,sham:!Yu},{defineProperties:Qu});var Ju=ee.Object,Zu=qu.exports=function(e,t){return Ju.defineProperties(e,t)};Ju.defineProperties.sham&&(Zu.sham=!0);var $u=qu.exports,ed={exports:{}},td=Rr,rd=C,nd=Qt.f;td({target:"Object",stat:!0,forced:Object.defineProperty!==nd,sham:!rd},{defineProperty:nd});var id=ee.Object,od=ed.exports=function(e,t,r){return id.defineProperty(e,t,r)};id.defineProperty.sham&&(od.sham=!0);var ad=ed.exports;function sd(e,t,r){return t in e?ad(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cd(e,t){var r=an(e);if(xs){var n=xs(e);t&&(n=Gs(n).call(n,(function(t){return tc(e,t).enumerable}))),r.push.apply(r,n)}return r}function ud(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?Mu(r=cd(Object(i),!0)).call(r,(function(t){sd(e,t,i[t])})):Xu?$u(e,Xu(i)):Mu(n=cd(Object(i))).call(n,(function(t){ad(e,t,tc(i,t))}))}return e}var dd=function(e){return e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL",e}(dd||{}),ld=function(e){return e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL",e}(ld||{}),hd=function(e){return 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",e}(hd||{}),pd=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(pd||{}),fd=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(fd||{}),vd=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(vd||{}),_d=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(_d||{}),md=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(md||{}),yd=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(yd||{}),gd=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(gd||{}),Sd=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(Sd||{}),Ed=function(e){return 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",e}(Ed||{}),bd=function(e){return 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",e}(bd||{}),kd=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(kd||{}),Td=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(Td||{}),Id=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(Id||{}),Ad=function(e){return e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY",e}(Ad||{}),Rd=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(Rd||{}),Cd=function(e){return e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e}(Cd||{}),wd=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(wd||{}),xd=function(e){return 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",e}(xd||{}),Od=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(Od||{}),Dd=function(e){return 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",e}(Dd||{}),Pd=function(e){return 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",e}(Pd||{}),Nd=function(e){return e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY",e}(Nd||{}),Md=function(e){return e.LC="LC",e.HEv1="HEv1",e.HEv2="HEv2",e}(Md||{}),Ld=function(e){return e.H264="H264",e.H265="H265",e}(Ld||{}),Ud=function(e){return e[e.ASR_ONLY=0]="ASR_ONLY",e[e.ASR_AND_TRANSLATION=1]="ASR_AND_TRANSLATION",e}(Ud||{}),Vd=function(e){return e[e.STARTED=0]="STARTED",e[e.STOPPED=1]="STOPPED",e[e.ERROR=2]="ERROR",e}(Vd||{}),Fd=function(e){return e.AUTO="auto",e.FORCE_TCP="forceTCP",e.FORCE_UDP="forceUDP",e}(Fd||{}),Bd=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:dd,AudioSourceType:ld,UserOfflineReason:hd,ChannelProfile:pd,SubscribeMode:fd,SubscribeState:vd,PublishState:_d,MirrorMode:md,VideoRenderMode:yd,StreamIndex:gd,MediaType:Sd,StreamRemoveReason:Ed,ConnectionState:bd,MirrorType:kd,LogChannel:Td,USER_ONLINE_STATUS:Id,PublicStreamType:Ad,PublicInterpolationMode:Rd,SubscribeFallbackOption:Cd,RemoteUserPriority:wd,NetworkQuality:xd,FallbackOrRecoverReason:Od,RoomProfileType:Dd,AudioProfileType:Pd,RTCAutoPlayPolicy:Nd,AAC_PROFILE:Md,TRANSCODING_VIDEO_CODEC:Ld,SUBTITLE_MODE:Ud,SubtitleEventType:Vd,ConnectionMode:Fd},Symbol.toStringTag,{value:"Module"})),jd=function(e){return 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",e}(jd||{}),Gd=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(Gd||{}),Hd=function(e){return 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",e}(Hd||{}),zd=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:jd,AudioMixingType:Gd,AudioMixingState:Hd},Symbol.toStringTag,{value:"Module"})),Kd=function(e){return 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.onRemoteVideoFirstFrame="onRemoteVideoFirstFrame",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onRemoteAudioFirstFrame="onRemoteAudioFirstFrame",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.onActiveSpeaker="onActiveSpeaker",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.onVideoStreamBanned="onVideoStreamBanned",e.onAudioStreamBanned="onAudioStreamBanned",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onSubtitleStateChanged="onSubtitleStateChanged",e.onSubtitleMessageReceived="onSubtitleMessageReceived",e.onServerParamsSetResult="onServerParamsSetResult",e}(Kd||{});function Xd(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),ad(e,n.key,n)}}function qd(e,t,r){return t&&Xd(e.prototype,t),r&&Xd(e,r),ad(e,"prototype",{writable:!1}),e}function Wd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Yd=Ye,Qd=ju,Jd=R,Zd=Qt,$d=Error,el=b("".replace),tl=String($d("zxcasd").stack),rl=/\n\s*at [^:]*:[^\n]*/,nl=rl.test(tl),il=$,ol=vr,al=rc,sl=lt("iterator"),cl=Array.prototype,ul=function(e){return void 0!==e&&(al.Array===e||cl[sl]===e)},dl=vn,ll=De,hl=z,pl=rc,fl=lt("iterator"),vl=function(e){if(!hl(e))return ll(e,fl)||ll(e,"@@iterator")||pl[dl(e)]},_l=O,ml=we,yl=tr,gl=Ie,Sl=vl,El=TypeError,bl=function(e,t){var r=arguments.length<2?Sl(e):t;if(ml(r))return yl(_l(r,e));throw El(gl(e)+" is not iterable")},kl=O,Tl=tr,Il=De,Al=function(e,t,r){var n,i;Tl(e);try{if(!(n=Il(e,"return"))){if("throw"===t)throw r;return r}n=kl(n,e)}catch(o){i=!0,n=o}if("throw"===t)throw r;if(i)throw n;return Tl(n),r},Rl=Yt,Cl=O,wl=tr,xl=Ie,Ol=ul,Dl=Br,Pl=ae,Nl=bl,Ml=vl,Ll=Al,Ul=TypeError,Vl=function(e,t){this.stopped=e,this.result=t},Fl=Vl.prototype,Bl=function(e,t,r){var n,i,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),v=Rl(t,d),_=function(e){return n&&Ll(n,"normal",e),new Vl(!0,e)},m=function(e){return l?(wl(e),f?v(e[0],e[1],_):v(e[0],e[1])):f?v(e,_):v(e)};if(h)n=e.iterator;else if(p)n=e;else{if(!(i=Ml(e)))throw Ul(xl(e)+" is not iterable");if(Ol(i)){for(o=0,a=Dl(e);a>o;o++)if((s=m(e[o]))&&Pl(Fl,s))return s;return new Vl(!1)}n=Nl(e,i)}for(c=h?e.next:n.next;!(u=Cl(c,n)).done;){try{s=m(u.value)}catch(y){Ll(n,"throw",y)}if("object"==typeof s&&s&&Pl(Fl,s))return s}return new Vl(!1)},jl=yn,Gl=V,Hl=!i((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Gl(1,7)),7!==e.stack)})),zl=Rr,Kl=ae,Xl=mc,ql=jc,Wl=function(e,t,r){for(var n=Qd(t),i=Zd.f,o=Jd.f,a=0;a<n.length;a++){var s=n[a];Yd(e,s)||r&&Yd(r,s)||i(e,s,o(t,s))}},Yl=Hn,Ql=vr,Jl=V,Zl=function(e,t){if(nl&&"string"==typeof e&&!$d.prepareStackTrace)for(;t--;)e=el(e,rl,"");return e},$l=function(e,t){il(t)&&"cause"in t&&ol(e,"cause",t.cause)},eh=Bl,th=function(e,t){return void 0===e?arguments.length<2?"":t:jl(e)},rh=Hl,nh=lt("toStringTag"),ih=Error,oh=[].push,ah=function(e,t){var r,n=arguments.length>2?arguments[2]:void 0,i=Kl(sh,this);ql?r=ql(ih(),i?Xl(this):sh):(r=i?this:Yl(sh),Ql(r,nh,"Error")),void 0!==t&&Ql(r,"message",th(t)),rh&&Ql(r,"stack",Zl(r.stack,1)),$l(r,n);var o=[];return eh(e,oh,{that:o}),Ql(r,"errors",o),r};ql?ql(ah,ih):Wl(ah,ih,{name:!0});var sh=ah.prototype=Yl(ih.prototype,{constructor:Jl(1,ah),message:Jl(1,""),name:Jl(1,"AggregateError")});zl({global:!0,constructor:!0,arity:2},{AggregateError:ah});var ch,uh,dh,lh,hh="process"==g(n.process),ph=oe,fh=Qt,vh=C,_h=lt("species"),mh=function(e){var t=ph(e),r=fh.f;vh&&t&&!t[_h]&&r(t,_h,{configurable:!0,get:function(){return this}})},yh=ae,gh=TypeError,Sh=function(e,t){if(yh(t,e))return e;throw gh("Incorrect invocation")},Eh=go,bh=Ie,kh=TypeError,Th=function(e){if(Eh(e))return e;throw kh(bh(e)+" is not a constructor")},Ih=tr,Ah=Th,Rh=z,Ch=lt("species"),wh=function(e,t){var r,n=Ih(e).constructor;return void 0===n||Rh(r=Ih(n)[Ch])?t:Ah(r)},xh=TypeError,Oh=function(e,t){if(e<t)throw xh("Not enough arguments");return e},Dh=/(?:ipad|iphone|ipod).*applewebkit/i.test(se),Ph=n,Nh=d,Mh=Yt,Lh=A,Uh=Ye,Vh=i,Fh=Rn,Bh=rs,jh=It,Gh=Oh,Hh=Dh,zh=hh,Kh=Ph.setImmediate,Xh=Ph.clearImmediate,qh=Ph.process,Wh=Ph.Dispatch,Yh=Ph.Function,Qh=Ph.MessageChannel,Jh=Ph.String,Zh=0,$h={},ep="onreadystatechange";try{ch=Ph.location}catch(gX){}var tp=function(e){if(Uh($h,e)){var t=$h[e];delete $h[e],t()}},rp=function(e){return function(){tp(e)}},np=function(e){tp(e.data)},ip=function(e){Ph.postMessage(Jh(e),ch.protocol+"//"+ch.host)};Kh&&Xh||(Kh=function(e){Gh(arguments.length,1);var t=Lh(e)?e:Yh(e),r=Bh(arguments,1);return $h[++Zh]=function(){Nh(t,void 0,r)},uh(Zh),Zh},Xh=function(e){delete $h[e]},zh?uh=function(e){qh.nextTick(rp(e))}:Wh&&Wh.now?uh=function(e){Wh.now(rp(e))}:Qh&&!Hh?(lh=(dh=new Qh).port2,dh.port1.onmessage=np,uh=Mh(lh.postMessage,lh)):Ph.addEventListener&&Lh(Ph.postMessage)&&!Ph.importScripts&&ch&&"file:"!==ch.protocol&&!Vh(ip)?(uh=ip,Ph.addEventListener("message",np,!1)):uh=ep in jh("script")?function(e){Fh.appendChild(jh("script")).onreadystatechange=function(){Fh.removeChild(this),tp(e)}}:function(e){setTimeout(rp(e),0)});var op,ap,sp,cp,up,dp,lp,hp,pp={set:Kh,clear:Xh},fp=n,vp=/ipad|iphone|ipod/i.test(se)&&void 0!==fp.Pebble,_p=/web0s(?!.*chrome)/i.test(se),mp=n,yp=Yt,gp=R.f,Sp=pp.set,Ep=Dh,bp=vp,kp=_p,Tp=hh,Ip=mp.MutationObserver||mp.WebKitMutationObserver,Ap=mp.document,Rp=mp.process,Cp=mp.Promise,wp=gp(mp,"queueMicrotask"),xp=wp&&wp.value;xp||(op=function(){var e,t;for(Tp&&(e=Rp.domain)&&e.exit();ap;){t=ap.fn,ap=ap.next;try{t()}catch(gX){throw ap?cp():sp=void 0,gX}}sp=void 0,e&&e.enter()},Ep||Tp||kp||!Ip||!Ap?!bp&&Cp&&Cp.resolve?((lp=Cp.resolve(void 0)).constructor=Cp,hp=yp(lp.then,lp),cp=function(){hp(op)}):Tp?cp=function(){Rp.nextTick(op)}:(Sp=yp(Sp,mp),cp=function(){Sp(op)}):(up=!0,dp=Ap.createTextNode(""),new Ip(op).observe(dp,{characterData:!0}),cp=function(){dp.data=up=!up}));var Op=xp||function(e){var t={fn:e,next:void 0};sp&&(sp.next=t),ap||(ap=t,cp()),sp=t},Dp=n,Pp=function(e){try{return{error:!1,value:e()}}catch(gX){return{error:!0,value:gX}}},Np=function(){this.head=null,this.tail=null};Np.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 Mp=Np,Lp=n.Promise,Up="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Vp=!Up&&!hh&&"object"==typeof window&&"object"==typeof document,Fp=n,Bp=Lp,jp=A,Gp=Kt,Hp=io,zp=lt,Kp=Vp,Xp=Up,qp=fe,Wp=Bp&&Bp.prototype,Yp=zp("species"),Qp=!1,Jp=jp(Fp.PromiseRejectionEvent),Zp={CONSTRUCTOR:Gp("Promise",(function(){var e=Hp(Bp),t=e!==String(Bp);if(!t&&66===qp)return!0;if(!Wp.catch||!Wp.finally)return!0;if(!qp||qp<51||!/native code/.test(e)){var r=new Bp((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Yp]=n,!(Qp=r.then((function(){}))instanceof n))return!0}return!t&&(Kp||Xp)&&!Jp})),REJECTION_EVENT:Jp,SUBCLASSING:Qp},$p={},ef=we,tf=TypeError,rf=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw tf("Bad Promise constructor");t=e,r=n})),this.resolve=ef(t),this.reject=ef(r)};$p.f=function(e){return new rf(e)};var nf,of,af=Rr,sf=hh,cf=n,uf=O,df=li,lf=Mi,hf=mh,pf=we,ff=A,vf=$,_f=Sh,mf=wh,yf=pp.set,gf=Op,Sf=function(e,t){var r=Dp.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},Ef=Pp,bf=Mp,kf=Zi,Tf=Lp,If=Zp,Af=$p,Rf="Promise",Cf=If.CONSTRUCTOR,wf=If.REJECTION_EVENT,xf=kf.getterFor(Rf),Of=kf.set,Df=Tf&&Tf.prototype,Pf=Tf,Nf=Df,Mf=cf.TypeError,Lf=cf.document,Uf=cf.process,Vf=Af.f,Ff=Vf,Bf=!!(Lf&&Lf.createEvent&&cf.dispatchEvent),jf="unhandledrejection",Gf=function(e){var t;return!(!vf(e)||!ff(t=e.then))&&t},Hf=function(e,t){var r,n,i,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&&Wf(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(Mf("Promise-chain cycle")):(n=Gf(r))?uf(n,r,c,u):c(r)):u(o)}catch(gX){d&&!i&&d.exit(),u(gX)}},zf=function(e,t){e.notified||(e.notified=!0,gf((function(){for(var r,n=e.reactions;r=n.get();)Hf(r,e);e.notified=!1,t&&!e.rejection&&Xf(e)})))},Kf=function(e,t,r){var n,i;Bf?((n=Lf.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),cf.dispatchEvent(n)):n={promise:t,reason:r},!wf&&(i=cf["on"+e])?i(n):e===jf&&Sf("Unhandled promise rejection",r)},Xf=function(e){uf(yf,cf,(function(){var t,r=e.facade,n=e.value;if(qf(e)&&(t=Ef((function(){sf?Uf.emit("unhandledRejection",n,r):Kf(jf,r,n)})),e.rejection=sf||qf(e)?2:1,t.error))throw t.value}))},qf=function(e){return 1!==e.rejection&&!e.parent},Wf=function(e){uf(yf,cf,(function(){var t=e.facade;sf?Uf.emit("rejectionHandled",t):Kf("rejectionhandled",t,e.value)}))},Yf=function(e,t,r){return function(n){e(t,n,r)}},Qf=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,zf(e,!0))},Jf=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Mf("Promise can't be resolved itself");var n=Gf(t);n?gf((function(){var r={done:!1};try{uf(n,t,Yf(Jf,r,e),Yf(Qf,r,e))}catch(gX){Qf(r,gX,e)}})):(e.value=t,e.state=1,zf(e,!1))}catch(gX){Qf({done:!1},gX,e)}}};Cf&&(Nf=(Pf=function(e){_f(this,Nf),pf(e),uf(nf,this);var t=xf(this);try{e(Yf(Jf,t),Yf(Qf,t))}catch(gX){Qf(t,gX)}}).prototype,(nf=function(e){Of(this,{type:Rf,done:!1,notified:!1,parent:!1,reactions:new bf,rejection:!1,state:0,value:void 0})}).prototype=df(Nf,"then",(function(e,t){var r=xf(this),n=Vf(mf(this,Pf));return r.parent=!0,n.ok=!ff(e)||e,n.fail=ff(t)&&t,n.domain=sf?Uf.domain:void 0,0==r.state?r.reactions.add(n):gf((function(){Hf(n,r)})),n.promise})),of=function(){var e=new nf,t=xf(e);this.promise=e,this.resolve=Yf(Jf,t),this.reject=Yf(Qf,t)},Af.f=Vf=function(e){return e===Pf||undefined===e?new of(e):Ff(e)}),af({global:!0,constructor:!0,wrap:!0,forced:Cf},{Promise:Pf}),lf(Pf,Rf,!1,!0),hf(Rf);var Zf=lt("iterator"),$f=!1;try{var ev=0,tv={next:function(){return{done:!!ev++}},return:function(){$f=!0}};tv[Zf]=function(){return this},Array.from(tv,(function(){throw 2}))}catch(gX){}var rv=function(e,t){if(!t&&!$f)return!1;var r=!1;try{var n={};n[Zf]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(gX){}return r},nv=Lp,iv=Zp.CONSTRUCTOR||!rv((function(e){nv.all(e).then(void 0,(function(){}))})),ov=O,av=we,sv=$p,cv=Pp,uv=Bl;Rr({target:"Promise",stat:!0,forced:iv},{all:function(e){var t=this,r=sv.f(t),n=r.resolve,i=r.reject,o=cv((function(){var r=av(t.resolve),o=[],a=0,s=1;uv(e,(function(e){var c=a++,u=!1;s++,ov(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||n(o))}),i)})),--s||n(o)}));return o.error&&i(o.value),r.promise}});var dv=Rr,lv=Zp.CONSTRUCTOR;Lp&&Lp.prototype,dv({target:"Promise",proto:!0,forced:lv,real:!0},{catch:function(e){return this.then(void 0,e)}});var hv=O,pv=we,fv=$p,vv=Pp,_v=Bl;Rr({target:"Promise",stat:!0,forced:iv},{race:function(e){var t=this,r=fv.f(t),n=r.reject,i=vv((function(){var i=pv(t.resolve);_v(e,(function(e){hv(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var mv=O,yv=$p;Rr({target:"Promise",stat:!0,forced:Zp.CONSTRUCTOR},{reject:function(e){var t=yv.f(this);return mv(t.reject,void 0,e),t.promise}});var gv=tr,Sv=$,Ev=$p,bv=function(e,t){if(gv(e),Sv(t)&&t.constructor===e)return t;var r=Ev.f(e);return(0,r.resolve)(t),r.promise},kv=Rr,Tv=Lp,Iv=Zp.CONSTRUCTOR,Av=bv,Rv=oe("Promise"),Cv=!Iv;kv({target:"Promise",stat:!0,forced:true},{resolve:function(e){return Av(Cv&&this===Rv?Tv:this,e)}});var wv=O,xv=we,Ov=$p,Dv=Pp,Pv=Bl;Rr({target:"Promise",stat:!0},{allSettled:function(e){var t=this,r=Ov.f(t),n=r.resolve,i=r.reject,o=Dv((function(){var r=xv(t.resolve),i=[],o=0,a=1;Pv(e,(function(e){var s=o++,c=!1;a++,wv(r,t,e).then((function(e){c||(c=!0,i[s]={status:"fulfilled",value:e},--a||n(i))}),(function(e){c||(c=!0,i[s]={status:"rejected",reason:e},--a||n(i))}))})),--a||n(i)}));return o.error&&i(o.value),r.promise}});var Nv=O,Mv=we,Lv=oe,Uv=$p,Vv=Pp,Fv=Bl,Bv="No one promise resolved";Rr({target:"Promise",stat:!0},{any:function(e){var t=this,r=Lv("AggregateError"),n=Uv.f(t),i=n.resolve,o=n.reject,a=Vv((function(){var n=Mv(t.resolve),a=[],s=0,c=1,u=!1;Fv(e,(function(e){var d=s++,l=!1;c++,Nv(n,t,e).then((function(e){l||u||(u=!0,i(e))}),(function(e){l||u||(l=!0,a[d]=e,--c||o(new r(a,Bv)))}))})),--c||o(new r(a,Bv))}));return a.error&&o(a.value),n.promise}});var jv=Rr,Gv=Lp,Hv=i,zv=oe,Kv=A,Xv=wh,qv=bv,Wv=Gv&&Gv.prototype;jv({target:"Promise",proto:!0,real:!0,forced:!!Gv&&Hv((function(){Wv.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=Xv(this,zv("Promise")),r=Kv(e);return this.then(r?function(r){return qv(t,e()).then((function(){return r}))}:e,r?function(r){return qv(t,e()).then((function(){throw r}))}:e)}});var Yv=b,Qv=Or,Jv=yn,Zv=q,$v=Yv("".charAt),e_=Yv("".charCodeAt),t_=Yv("".slice),r_=function(e){return function(t,r){var n,i,o=Jv(Zv(t)),a=Qv(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=e_(o,a))<55296||n>56319||a+1===s||(i=e_(o,a+1))<56320||i>57343?e?$v(o,a):n:e?t_(o,a,a+2):i-56320+(n-55296<<10)+65536}},n_={codeAt:r_(!1),charAt:r_(!0)},i_=n_.charAt,o_=yn,a_=Zi,s_=iu,c_=ou,u_="String Iterator",d_=a_.set,l_=a_.getterFor(u_);s_(String,"String",(function(e){d_(this,{type:u_,string:o_(e),index:0})}),(function(){var e,t=l_(this),r=t.string,n=t.index;return n>=r.length?c_(void 0,!0):(e=i_(r,n),t.index+=e.length,c_(e,!1))}));var h_=ee.Promise,p_=$p,f_=Pp;Rr({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=p_.f(this),r=f_(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var v_=h_;function __(e,t,r,n,i,o,a){try{var s=e[o](a),c=s.value}catch(gX){return void r(gX)}s.done?t(c):v_.resolve(c).then(n,i)}function m_(e){return function(){var t=this,r=arguments;return new v_((function(n,i){var o=e.apply(t,r);function a(e){__(o,n,i,a,s,"next",e)}function s(e){__(o,n,i,a,s,"throw",e)}a(void 0)}))}}var y_={exports:{}},g_={exports:{}},S_=TypeError,E_=function(e){if(e>9007199254740991)throw S_("Maximum allowed index exceeded");return e},b_=Rr,k_=i,T_=eo,I_=$,A_=Xe,R_=Br,C_=E_,w_=Jn,x_=Ao,O_=Ns,D_=fe,P_=lt("isConcatSpreadable"),N_=D_>=51||!k_((function(){var e=[];return e[P_]=!1,e.concat()[0]!==e})),M_=O_("concat"),L_=function(e){if(!I_(e))return!1;var t=e[P_];return void 0!==t?!!t:T_(e)};b_({target:"Array",proto:!0,arity:1,forced:!N_||!M_},{concat:function(e){var t,r,n,i,o,a=A_(this),s=x_(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(L_(o=-1===t?a:arguments[t]))for(i=R_(o),C_(c+i),r=0;r<i;r++,c++)r in o&&w_(s,c,o[r]);else C_(c+1),w_(s,c++,o);return s.length=c,s}}),Ei("asyncIterator"),Ei("hasInstance"),Ei("isConcatSpreadable"),Ei("iterator"),Ei("match"),Ei("matchAll"),Ei("replace"),Ei("search"),Ei("species"),Ei("split");var U_=Ai;Ei("toPrimitive"),U_();var V_=oe,F_=Mi;Ei("toStringTag"),F_(V_("Symbol"),"Symbol"),Ei("unscopables"),Mi(n.JSON,"JSON",!0);var B_=ee.Symbol;Ei("asyncDispose"),Ei("dispose"),Ei("matcher"),Ei("metadataKey"),Ei("observable"),Ei("metadata"),Ei("patternMatch"),Ei("replaceAll");var j_=B_,G_=hi.f("iterator");!function(e){var t=j_,r=G_;function n(i){return e.exports=n="function"==typeof t&&"symbol"==typeof r?function(e){return typeof e}:function(e){return e&&"function"==typeof t&&e.constructor===t&&e!==t.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,n(i)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(g_),Rr({target:"Object",stat:!0,sham:!C},{create:Hn});var H_=ee.Object,z_=function(e,t){return H_.create(e,t)},K_=Xe,X_=mc,q_=uc;Rr({target:"Object",stat:!0,forced:i((function(){X_(1)})),sham:!q_},{getPrototypeOf:function(e){return X_(K_(e))}});var W_=ee.Object.getPrototypeOf;Rr({target:"Object",stat:!0},{setPrototypeOf:jc});var Y_=ee.Object.setPrototypeOf,Q_=Rr,J_=eo,Z_=b([].reverse),$_=[1,2];Q_({target:"Array",proto:!0,forced:String($_)===String($_.reverse())},{reverse:function(){return J_(this)&&(this.length=this.length),Z_(this)}});var em=Us("Array").reverse,tm=ae,rm=em,nm=Array.prototype,im=function(e){var t=e.reverse;return e===nm||tm(nm,e)&&t===nm.reverse?rm:t},om=Rr,am=eo,sm=go,cm=$,um=Mr,dm=Br,lm=Q,hm=Jn,pm=lt,fm=rs,vm=Ns("slice"),_m=pm("species"),mm=Array,ym=Math.max;om({target:"Array",proto:!0,forced:!vm},{slice:function(e,t){var r,n,i,o=lm(this),a=dm(o),s=um(e,a),c=um(void 0===t?a:t,a);if(am(o)&&(r=o.constructor,(sm(r)&&(r===mm||am(r.prototype))||cm(r)&&null===(r=r[_m]))&&(r=void 0),r===mm||void 0===r))return fm(o,s,c);for(n=new(void 0===r?mm:r)(ym(c-s,0)),i=0;s<c;s++,i++)s in o&&hm(n,i,o[s]);return n.length=i,n}});var gm=Us("Array").slice,Sm=ae,Em=gm,bm=Array.prototype,km=function(e){var t=e.slice;return e===bm||Sm(bm,e)&&t===bm.slice?Em:t};!function(e){var t=g_.exports.default,r=ad,n=j_,i=z_,o=W_,a=Mu,s=Y_,c=v_,u=im,d=km;function l(){e.exports=l=function(){return h},e.exports.__esModule=!0,e.exports.default=e.exports;var h={},p=Object.prototype,f=p.hasOwnProperty,v=r||function(e,t,r){e[t]=r.value},_="function"==typeof n?n:{},m=_.iterator||"@@iterator",y=_.asyncIterator||"@@asyncIterator",g=_.toStringTag||"@@toStringTag";function S(e,t,n){return r(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{S({},"")}catch(F){S=function(e,t,r){return e[t]=r}}function E(e,t,r,n){var o=t&&t.prototype instanceof T?t:T,a=i(o.prototype),s=new L(n||[]);return v(a,"_invoke",{value:D(e,r,s)}),a}function b(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(F){return{type:"throw",arg:F}}}h.wrap=E;var k={};function T(){}function I(){}function A(){}var R={};S(R,m,(function(){return this}));var C=o&&o(o(U([])));C&&C!==p&&f.call(C,m)&&(R=C);var w=A.prototype=T.prototype=i(R);function x(e){var t;a(t=["next","throw","return"]).call(t,(function(t){S(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,r){function n(i,o,a,s){var c=b(e[i],e,o);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==t(d)&&f.call(d,"__await")?r.resolve(d.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):r.resolve(d).then((function(e){u.value=e,a(u)}),(function(e){return n("throw",e,a,s)}))}s(c.arg)}var i;v(this,"_invoke",{value:function(e,t){function o(){return new r((function(r,i){n(e,t,r,i)}))}return i=i?i.then(o,o):o()}})}function D(e,t,r){var n="suspendedStart";return function(i,o){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw o;return{value:void 0,done:!0}}for(r.method=i,r.arg=o;;){var a=r.delegate;if(a){var s=P(a,r);if(s){if(s===k)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=b(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===k)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function P(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,P(e,t),"throw"===t.method))return k;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return k}var n=b(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,k;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,k):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,k)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],a(e).call(e,N,this),this.reset(!0)}function U(e){if(e){var t=e[m];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(f.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return n.next=n}}return{next:V}}function V(){return{value:void 0,done:!0}}return I.prototype=A,v(w,"constructor",{value:A,configurable:!0}),v(A,"constructor",{value:I,configurable:!0}),I.displayName=S(A,g,"GeneratorFunction"),h.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===I||"GeneratorFunction"===(t.displayName||t.name))},h.mark=function(e){return s?s(e,A):(e.__proto__=A,S(e,g,"GeneratorFunction")),e.prototype=i(w),e},h.awrap=function(e){return{__await:e}},x(O.prototype),S(O.prototype,y,(function(){return this})),h.AsyncIterator=O,h.async=function(e,t,r,n,i){void 0===i&&(i=c);var o=new O(E(e,t,r,n),i);return h.isGeneratorFunction(t)?o:o.next().then((function(e){return e.done?e.value:o.next()}))},x(w),S(w,g,"Generator"),S(w,m,(function(){return this})),S(w,"toString",(function(){return"[object Generator]"})),h.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return u(r).call(r),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},h.values=U,L.prototype={constructor:L,reset:function(e){var t;if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,a(t=this.tryEntries).call(t,M),!e)for(var r in this)"t"===r.charAt(0)&&f.call(this,r)&&!isNaN(+d(r).call(r,1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return o.type="throw",o.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],o=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var a=f.call(i,"catchLoc"),s=f.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&f.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,k):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),k},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),M(r),k}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;M(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:U(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),k}},h}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports}(y_);var Tm=y_.exports(),Im=Tm;try{regeneratorRuntime=Tm}catch(SX){"object"==typeof globalThis?globalThis.regeneratorRuntime=Tm:Function("r","regeneratorRuntime = r")(Tm)}var Am=Us("Array").concat,Rm=ae,Cm=Am,wm=Array.prototype,xm=function(e){var t=e.concat;return e===wm||Rm(wm,e)&&t===wm.concat?Cm:t},Om=Kr.includes;Rr({target:"Array",proto:!0,forced:i((function(){return!Array(1).includes()}))},{includes:function(e){return Om(this,e,arguments.length>1?arguments[1]:void 0)}});var Dm=Us("Array").includes,Pm=$,Nm=g,Mm=lt("match"),Lm=function(e){var t;return Pm(e)&&(void 0!==(t=e[Mm])?!!t:"RegExp"==Nm(e))},Um=TypeError,Vm=function(e){if(Lm(e))throw Um("The method doesn't accept regular expressions");return e},Fm=lt("match"),Bm=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Fm]=!1,"/./"[e](t)}catch(n){}}return!1},jm=Rr,Gm=Vm,Hm=q,zm=yn,Km=Bm,Xm=b("".indexOf);jm({target:"String",proto:!0,forced:!Km("includes")},{includes:function(e){return!!~Xm(zm(Hm(this)),zm(Gm(e)),arguments.length>1?arguments[1]:void 0)}});var qm=Us("String").includes,Wm=ae,Ym=Dm,Qm=qm,Jm=Array.prototype,Zm=String.prototype,$m=function(e){var t=e.includes;return e===Jm||Wm(Jm,e)&&t===Jm.includes?Ym:"string"==typeof e||e===Zm||Wm(Zm,e)&&t===Zm.includes?Qm:t},ey=ee,ty=d;ey.JSON||(ey.JSON={stringify:JSON.stringify});var ry=function(e,t,r){return ty(ey.JSON.stringify,null,arguments)},ny=ry,iy=No.map;Rr({target:"Array",proto:!0,forced:!Ns("map")},{map:function(e){return iy(this,e,arguments.length>1?arguments[1]:void 0)}});var oy=Us("Array").map,ay=ae,sy=oy,cy=Array.prototype,uy=function(e){var t=e.map;return e===cy||ay(cy,e)&&t===cy.map?sy:t};function dy(e){return(dy="function"==typeof j_&&"symbol"==typeof G_?function(e){return typeof e}:function(e){return e&&"function"==typeof j_&&e.constructor===j_&&e!==j_.prototype?"symbol":typeof e})(e)}var ly="\t\n\v\f\r                 \u2028\u2029\ufeff",hy=q,py=yn,fy=b("".replace),vy="[\t\n\v\f\r                 \u2028\u2029\ufeff]",_y=RegExp("^"+vy+vy+"*"),my=RegExp(vy+vy+"*$"),yy=function(e){return function(t){var r=py(hy(t));return 1&e&&(r=fy(r,_y,"")),2&e&&(r=fy(r,my,"")),r}},gy={start:yy(1),end:yy(2),trim:yy(3)},Sy=n,Ey=i,by=b,ky=yn,Ty=gy.trim,Iy=ly,Ay=Sy.parseInt,Ry=Sy.Symbol,Cy=Ry&&Ry.iterator,wy=/^[+-]?0x/i,xy=by(wy.exec),Oy=8!==Ay(Iy+"08")||22!==Ay(Iy+"0x16")||Cy&&!Ey((function(){Ay(Object(Cy))}))?function(e,t){var r=Ty(ky(e));return Ay(r,t>>>0||(xy(wy,r)?16:10))}:Ay;Rr({global:!0,forced:parseInt!=Oy},{parseInt:Oy});var Dy=ee.parseInt,Py={exports:{}},Ny=i((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),My=i,Ly=$,Uy=g,Vy=Ny,Fy=Object.isExtensible,By=My((function(){Fy(1)}))||Vy?function(e){return!!Ly(e)&&((!Vy||"ArrayBuffer"!=Uy(e))&&(!Fy||Fy(e)))}:Fy,jy=!i((function(){return Object.isExtensible(Object.preventExtensions({}))})),Gy=Rr,Hy=b,zy=Xr,Ky=$,Xy=Ye,qy=Qt.f,Wy=zn,Yy=qn,Qy=By,Jy=jy,Zy=!1,$y=et("meta"),eg=0,tg=function(e){qy(e,$y,{value:{objectID:"O"+eg++,weakData:{}}})},rg=Py.exports={enable:function(){rg.enable=function(){},Zy=!0;var e=Wy.f,t=Hy([].splice),r={};r[$y]=1,e(r).length&&(Wy.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===$y){t(n,i,1);break}return n},Gy({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Yy.f}))},fastKey:function(e,t){if(!Ky(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Xy(e,$y)){if(!Qy(e))return"F";if(!t)return"E";tg(e)}return e[$y].objectID},getWeakData:function(e,t){if(!Xy(e,$y)){if(!Qy(e))return!0;if(!t)return!1;tg(e)}return e[$y].weakData},onFreeze:function(e){return Jy&&Zy&&Qy(e)&&!Xy(e,$y)&&tg(e),e}};zy[$y]=!0;var ng=Rr,ig=n,og=Py.exports,ag=i,sg=vr,cg=Bl,ug=Sh,dg=A,lg=$,hg=Mi,pg=Qt.f,fg=No.forEach,vg=C,_g=Zi.set,mg=Zi.getterFor,yg=function(e,t,r){var n,i=-1!==e.indexOf("Map"),o=-1!==e.indexOf("Weak"),a=i?"set":"add",s=ig[e],c=s&&s.prototype,u={};if(vg&&dg(s)&&(o||c.forEach&&!ag((function(){(new s).entries().next()})))){var d=(n=t((function(t,r){_g(ug(t,d),{type:e,collection:new s}),null!=r&&cg(r,t[a],{that:t,AS_ENTRIES:i})}))).prototype,l=mg(e);fg(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"==e||"set"==e;!(e in c)||o&&"clear"==e||sg(d,e,(function(r,n){var i=l(this).collection;if(!t&&o&&!lg(r))return"get"==e&&void 0;var a=i[e](0===r?0:r,n);return t?this:a}))})),o||pg(d,"size",{configurable:!0,get:function(){return l(this).collection.size}})}else n=r.getConstructor(t,e,i,a),og.enable();return hg(n,e,!1,!0),u[e]=n,ng({global:!0,forced:!0},u),o||r.setStrong(n,e,i),n},gg=li,Sg=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:gg(e,n,t[n],r);return e},Eg=Qt.f,bg=Hn,kg=Sg,Tg=Yt,Ig=Sh,Ag=z,Rg=Bl,Cg=iu,wg=ou,xg=mh,Og=C,Dg=Py.exports.fastKey,Pg=Zi.set,Ng=Zi.getterFor,Mg={getConstructor:function(e,t,r,n){var i=e((function(e,i){Ig(e,o),Pg(e,{type:t,index:bg(null),first:void 0,last:void 0,size:0}),Og||(e.size=0),Ag(i)||Rg(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=Ng(t),s=function(e,t,r){var n,i,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:i=Dg(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),Og?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=Dg(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return kg(o,{clear:function(){for(var e=a(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,Og?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),n=c(t,e);if(n){var i=n.next,o=n.previous;delete r.index[n.index],n.removed=!0,o&&(o.next=i),i&&(i.previous=o),r.first==n&&(r.first=i),r.last==n&&(r.last=o),Og?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=Tg(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),kg(o,r?{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)}}),Og&&Eg(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Ng(t),o=Ng(n);Cg(e,t,(function(e,t){Pg(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=o(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?wg("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,wg(void 0,!0))}),r?"entries":"values",!r,!0),xg(t)}};yg("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Mg);var Lg=ee.Map,Ug=Yt,Vg=O,Fg=we,Bg=Th,jg=z,Gg=Bl,Hg=[].push,zg=function(e){var t,r,n,i,o=arguments.length,a=o>1?arguments[1]:void 0;return Bg(this),(t=void 0!==a)&&Fg(a),jg(e)?new this:(r=[],t?(n=0,i=Ug(a,o>2?arguments[2]:void 0),Gg(e,(function(e){Vg(Hg,r,i(e,n++))}))):Gg(e,Hg,{that:r}),new this(r))};Rr({target:"Map",stat:!0,forced:!0},{from:zg});var Kg=rs,Xg=function(){return new this(Kg(arguments))};Rr({target:"Map",stat:!0,forced:!0},{of:Xg});var qg=O,Wg=we,Yg=tr,Qg=function(){for(var e,t=Yg(this),r=Wg(t.delete),n=!0,i=0,o=arguments.length;i<o;i++)e=qg(r,t,arguments[i]),n=n&&e;return!!n};Rr({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:Qg});var Jg=O,Zg=we,$g=tr,eS=function(e,t){var r,n,i=$g(this),o=Zg(i.get),a=Zg(i.has),s=Zg(i.set);return Jg(a,i,e)?(r=Jg(o,i,e),"update"in t&&(r=t.update(r,e,i),Jg(s,i,e,r)),r):(n=t.insert(e,i),Jg(s,i,e,n),n)};Rr({target:"Map",proto:!0,real:!0,forced:!0},{emplace:eS});var tS=bl,rS=tr,nS=Yt,iS=tS,oS=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=rS(this),r=iS(t),n=nS(e,arguments.length>1?arguments[1]:void 0);return!oS(r,(function(e,r,i){if(!n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var aS=oe,sS=Yt,cS=O,uS=we,dS=tr,lS=wh,hS=tS,pS=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=dS(this),r=hS(t),n=sS(e,arguments.length>1?arguments[1]:void 0),i=new(lS(t,aS("Map"))),o=uS(i.set);return pS(r,(function(e,r){n(r,e,t)&&cS(o,i,e,r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var fS=tr,vS=Yt,_S=tS,mS=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{find:function(e){var t=fS(this),r=_S(t),n=vS(e,arguments.length>1?arguments[1]:void 0);return mS(r,(function(e,r,i){if(n(r,e,t))return i(r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var yS=tr,gS=Yt,SS=tS,ES=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=yS(this),r=SS(t),n=gS(e,arguments.length>1?arguments[1]:void 0);return ES(r,(function(e,r,i){if(n(r,e,t))return i(e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var bS=Rr,kS=O,TS=we,IS=bl,AS=Bl,RS=b([].push);bS({target:"Map",stat:!0,forced:!0},{groupBy:function(e,t){TS(t);var r=IS(e),n=new this,i=TS(n.has),o=TS(n.get),a=TS(n.set);return AS(r,(function(e){var r=t(e);kS(i,n,r)?RS(kS(o,n,r),e):kS(a,n,r,[e])}),{IS_ITERATOR:!0}),n}});var CS=tr,wS=tS,xS=function(e,t){return e===t||e!=e&&t!=t},OS=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return OS(wS(CS(this)),(function(t,r,n){if(xS(r,e))return n()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var DS=O,PS=Bl,NS=we;Rr({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var r=new this;NS(t);var n=NS(r.set);return PS(e,(function(e){DS(n,r,t(e),e)})),r}});var MS=tr,LS=tS,US=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){return US(LS(MS(this)),(function(t,r,n){if(r===e)return n(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var VS=oe,FS=Yt,BS=O,jS=we,GS=tr,HS=wh,zS=tS,KS=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=GS(this),r=zS(t),n=FS(e,arguments.length>1?arguments[1]:void 0),i=new(HS(t,VS("Map"))),o=jS(i.set);return KS(r,(function(e,r){BS(o,i,n(r,e,t),r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var XS=oe,qS=Yt,WS=O,YS=we,QS=tr,JS=wh,ZS=tS,$S=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=QS(this),r=ZS(t),n=qS(e,arguments.length>1?arguments[1]:void 0),i=new(JS(t,XS("Map"))),o=YS(i.set);return $S(r,(function(e,r){WS(o,i,e,n(r,e,t))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var eE=we,tE=tr,rE=Bl;Rr({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=tE(this),r=eE(t.set),n=arguments.length,i=0;i<n;)rE(arguments[i++],r,{that:t,AS_ENTRIES:!0});return t}});var nE=tr,iE=we,oE=tS,aE=Bl,sE=TypeError;Rr({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=nE(this),r=oE(t),n=arguments.length<2,i=n?void 0:arguments[1];if(iE(e),aE(r,(function(r,o){n?(n=!1,i=o):i=e(i,o,r,t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),n)throw sE("Reduce of empty map with no initial value");return i}});var cE=tr,uE=Yt,dE=tS,lE=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=cE(this),r=dE(t),n=uE(e,arguments.length>1?arguments[1]:void 0);return lE(r,(function(e,r,i){if(n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var hE=O,pE=tr,fE=we,vE=TypeError;Rr({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var r=pE(this),n=fE(r.get),i=fE(r.has),o=fE(r.set),a=arguments.length;fE(t);var s=hE(i,r,e);if(!s&&a<3)throw vE("Updating absent value");var c=s?hE(n,r,e):fE(a>2?arguments[2]:void 0)(e,r);return hE(o,r,e,t(c,e,r)),r}});var _E=O,mE=we,yE=A,gE=tr,SE=TypeError,EE=function(e,t){var r,n=gE(this),i=mE(n.get),o=mE(n.has),a=mE(n.set),s=arguments.length>2?arguments[2]:void 0;if(!yE(t)&&!yE(s))throw SE("At least one callback required");return _E(o,n,e)?(r=_E(i,n,e),yE(t)&&(r=t(r),_E(a,n,e,r))):yE(s)&&(r=s(),_E(a,n,e,r)),r};Rr({target:"Map",proto:!0,real:!0,forced:!0},{upsert:EE}),Rr({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:EE});var bE=Lg,kE=we,TE=Xe,IE=H,AE=Br,RE=TypeError,CE=function(e){return function(t,r,n,i){kE(r);var o=TE(t),a=IE(o),s=AE(o),c=e?s-1:0,u=e?-1:1;if(n<2)for(;;){if(c in a){i=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw RE("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(i=r(i,a[c],c,o));return i}},wE={left:CE(!1),right:CE(!0)}.left,xE=fe,OE=hh;Rr({target:"Array",proto:!0,forced:!Iu("reduce")||!OE&&xE>79&&xE<83},{reduce:function(e){var t=arguments.length;return wE(this,e,t,t>1?arguments[1]:void 0)}});var DE=Us("Array").reduce,PE=ae,NE=DE,ME=Array.prototype,LE=function(e){var t=e.reduce;return e===ME||PE(ME,e)&&t===ME.reduce?NE:t},UE=C,VE=b,FE=O,BE=i,jE=rn,GE=ui,HE=D,zE=Xe,KE=H,XE=Object.assign,qE=Object.defineProperty,WE=VE([].concat),YE=!XE||BE((function(){if(UE&&1!==XE({b:1},XE(qE({},"a",{enumerable:!0,get:function(){qE(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=XE({},e)[r]||jE(XE({},t)).join("")!=n}))?function(e,t){for(var r=zE(e),n=arguments.length,i=1,o=GE.f,a=HE.f;n>i;)for(var s,c=KE(arguments[i++]),u=o?WE(jE(c),o(c)):jE(c),d=u.length,l=0;d>l;)s=u[l++],UE&&!FE(a,c,s)||(r[s]=c[s]);return r}:XE,QE=YE;Rr({target:"Object",stat:!0,arity:2,forced:Object.assign!==QE},{assign:QE});var JE=ee.Object.assign,ZE=Rr,$E=b;R.f;var eb=Vr,tb=yn,rb=Vm,nb=q,ib=Bm,ob=$E("".endsWith),ab=$E("".slice),sb=Math.min;ZE({target:"String",proto:!0,forced:!ib("endsWith")},{endsWith:function(e){var t=tb(nb(this));rb(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:sb(eb(r),n),o=tb(e);return ob?ob(t,o,i):ab(t,i-o.length,i)===o}});var cb=Us("String").endsWith,ub=ae,db=cb,lb=String.prototype,hb=function(e){var t=e.endsWith;return"string"==typeof e||e===lb||ub(lb,e)&&t===lb.endsWith?db:t},pb=!0,fb=!0;function vb(e,t,r){var n=e.match(t);return n&&n.length>=r&&Dy(n[r],10)}function _b(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var o=function(e){var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new bE),this._eventMap[t].set(n,o),i.apply(this,[e,o])};var o=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===an(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},ad(n,"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 mb(e){return"boolean"!=typeof e?new Error("Argument type: "+dy(e)+". Please use a boolean."):(pb=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function yb(e){return"boolean"!=typeof e?new Error("Argument type: "+dy(e)+". Please use a boolean."):(fb=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function gb(){if("object"===("undefined"==typeof window?"undefined":dy(window))){if(pb)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Sb(e,t){fb&&console.warn(e+" is deprecated, please use "+t+" instead.")}function Eb(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var r=e.navigator;if(r.mozGetUserMedia)t.browser="firefox",t.version=vb(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=vb(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=vb(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function bb(e){return"[object Object]"===Object.prototype.toString.call(e)}function kb(e){var t;return bb(e)?LE(t=an(e)).call(t,(function(t,r){var n=bb(e[r]),i=n?kb(e[r]):e[r],o=n&&!an(i).length;return void 0===i||o?t:JE(t,sd({},r,i))}),{}):e}function Tb(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),an(t).forEach((function(n){hb(n).call(n,"Id")?Tb(e,e.get(t[n]),r):hb(n).call(n,"Ids")&&t[n].forEach((function(t){Tb(e,e.get(t),r)}))})))}function Ib(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new bE;if(null===t)return i;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(r){r.type===n&&r.trackId===t.id&&Tb(e,r,i)}))})),i}var Ab=Rr,Rb=No.find,Cb="find",wb=!0;Cb in[]&&Array(1).find((function(){wb=!1})),Ab({target:"Array",proto:!0,forced:wb},{find:function(e){return Rb(this,e,arguments.length>1?arguments[1]:void 0)}});var xb=Us("Array").find,Ob=ae,Db=xb,Pb=Array.prototype,Nb=function(e){var t=e.find;return e===Pb||Ob(Pb,e)&&t===Pb.find?Db:t},Mb=Rr,Lb=Kr.indexOf,Ub=Iu,Vb=b([].indexOf),Fb=!!Vb&&1/Vb([1],1,-0)<0,Bb=Ub("indexOf");Mb({target:"Array",proto:!0,forced:Fb||!Bb},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Fb?Vb(this,e,t)||0:Lb(this,e,t)}});var jb=Us("Array").indexOf,Gb=ae,Hb=jb,zb=Array.prototype,Kb=function(e){var t=e.indexOf;return e===zb||Gb(zb,e)&&t===zb.indexOf?Hb:t},Xb=C,qb=eo,Wb=TypeError,Yb=Object.getOwnPropertyDescriptor,Qb=Xb&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(gX){return gX instanceof TypeError}}(),Jb=Ie,Zb=TypeError,$b=function(e,t){if(!delete e[t])throw Zb("Cannot delete property "+Jb(t)+" of "+Jb(e))},ek=Rr,tk=Xe,rk=Mr,nk=Or,ik=Br,ok=Qb?function(e,t){if(qb(e)&&!Yb(e,"length").writable)throw Wb("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},ak=E_,sk=Ao,ck=Jn,uk=$b,dk=Ns("splice"),lk=Math.max,hk=Math.min;ek({target:"Array",proto:!0,forced:!dk},{splice:function(e,t){var r,n,i,o,a,s,c=tk(this),u=ik(c),d=rk(e,u),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=hk(lk(nk(t),0),u-d)),ak(u+r-n),i=sk(c,n),o=0;o<n;o++)(a=d+o)in c&&ck(i,o,c[a]);if(i.length=n,r<n){for(o=d;o<u-n;o++)s=o+r,(a=o+n)in c?c[s]=c[a]:uk(c,s);for(o=u;o>u-n+r;o--)uk(c,o-1)}else if(r>n)for(o=u-n;o>d;o--)s=o+r-1,(a=o+n-1)in c?c[s]=c[a]:uk(c,s);for(o=0;o<r;o++)c[o+d]=arguments[o+2];return ok(c,u-n+r),i}});var pk=Us("Array").splice,fk=ae,vk=pk,_k=Array.prototype,mk=function(e){var t=e.splice;return e===_k||fk(_k,e)&&t===_k.splice?vk:t},yk=gb;function gk(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==dy(e)||e.mandatory||e.optional)return e;var t,r={};(an(e).forEach((function(t){if("require"!==t&&"advanced"!==t&&"mediaSource"!==t){var n="object"===dy(e[t])?e[t]:{ideal:e[t]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+km(t).call(t,1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){r.optional=r.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",t)]=n.ideal,r.optional.push(o),(o={})[i("max",t)]=n.ideal,r.optional.push(o)):(o[i("",t)]=n.ideal,r.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(r.mandatory=r.mandatory||{},r.mandatory[i("",t)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(r.mandatory=r.mandatory||{},r.mandatory[i(e,t)]=n[e])}))}})),e.advanced)&&(r.optional=xm(t=r.optional||[]).call(t,e.advanced));return r},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(ny(e)))&&"object"===dy(e.audio)){var o=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};o((e=JSON.parse(ny(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===dy(e.video)){var a=e.video.facingMode;a=a&&("object"===dy(a)?a:{ideal:a});var s,c=t.version<66;if(a&&("user"===a.exact||"environment"===a.exact||"user"===a.ideal||"environment"===a.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===a.exact||"environment"===a.ideal?s=["back","rear"]:"user"!==a.exact&&"user"!==a.ideal||(s=["front"]),s)return r.mediaDevices.enumerateDevices().then((function(t){t=Gs(t).call(t,(function(e){return"videoinput"===e.kind}));var r=Nb(t).call(t,(function(e){return s.some((function(t){var r;return $m(r=e.label.toLowerCase()).call(r,t)}))}));return!r&&t.length&&$m(s).call(s,"back")&&(r=t[t.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),yk("chrome: "+ny(e)),i(e)}));e.video=n(e.video)}return yk("chrome: "+ny(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){n&&n(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return a(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 v_.reject(o(e))}))}))}}}}function Sk(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Ek(e){if("object"===dy(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){ad(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 t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var r=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(n){var i,o;e.RTCPeerConnection.prototype.getReceivers?i=Nb(o=r.getReceivers()).call(o,(function(e){return e.track&&e.track.id===n.track.id})):i={track:n.track};var a=new Event("track");a.track=n.track,a.receiver=i,a.transceiver={receiver:i},a.streams=[t.stream],r.dispatchEvent(a)})),t.stream.getTracks().forEach((function(n){var i,o;e.RTCPeerConnection.prototype.getReceivers?i=Nb(o=r.getReceivers()).call(o,(function(e){return e.track&&e.track.id===n.id})):i={track:n};var a=new Event("track");a.track=n,a.receiver=i,a.transceiver={receiver:i},a.streams=[t.stream],r.dispatchEvent(a)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else _b(e,"track",(function(e){return e.transceiver||ad(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function bk(e){if("object"===dy(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){var e;return this._senders=this._senders||[],km(e=this._senders).call(e)};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t;n.apply(this,arguments);var r,i=Kb(t=this._senders).call(t,e);-1!==i&&mk(r=this._senders).call(r,i,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((function(e){r._senders.push(t(r,e))}))};var o=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;this._senders=this._senders||[],o.apply(this,[e]),e.getTracks().forEach((function(e){var r,n,i,o=Nb(r=t._senders).call(r,(function(t){return t.track===e}));o&&mk(n=t._senders).call(n,Kb(i=t._senders).call(i,o),1)}))}}else if("object"===dy(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var a=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=a.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},ad(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 kk(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=km(Array.prototype).call(arguments),n=r[0],i=r[1],o=r[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))return t.apply(this,[]);var a=function(e){var t={};return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t[r.id]=r})),t},s=function(e){var t;return new bE(uy(t=an(e)).call(t,(function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){i(s(a(e)))};return t.apply(this,[c,n])}return new v_((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function Tk(e){if("object"===dy(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});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 Ib(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}),_b(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 Ib(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(r?n=!0:r=e),e.track===o})),n||t&&r?v_.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():v_.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Ik(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e,t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},uy(e=an(this._shimmedLocalStreams)).call(e,(function(e){return t._shimmedLocalStreams[e][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var n;if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===Kb(n=this._shimmedLocalStreams[r.id]).call(n,i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t,n,i=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){var t;if(Nb(t=i.getSenders()).call(t,(function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var o=this.getSenders();r.apply(this,arguments);var a=Gs(t=this.getSenders()).call(t,(function(e){return-1===Kb(o).call(o,e)}));this._shimmedLocalStreams[e.id]=xm(n=[e]).call(n,a)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&an(this._shimmedLocalStreams).forEach((function(r){var n,i,o=Kb(n=t._shimmedLocalStreams[r]).call(n,e);-1!==o&&mk(i=t._shimmedLocalStreams[r]).call(i,o,1);1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function Ak(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Ik(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},uy(t).call(t,(function(t){return e._reverseStreams[t.id]}))};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){var t;if(Nb(t=r.getSenders()).call(t,(function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){var n,i,o,a=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var s=km([]).call(arguments,1);if(1!==s.length||!Nb(n=s[0].getTracks()).call(n,(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 c=Nb(i=this.getSenders()).call(i,(function(e){return e.track===t}));if(c)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var u=this._streams[r.id];if(u)u.addTrack(t),v_.resolve().then((function(){a.dispatchEvent(new Event("negotiationneeded"))}));else{var d=new e.MediaStream([t]);this._streams[r.id]=d,this._reverseStreams[d.id]=r,this.addStream(d)}return Nb(o=this.getSenders()).call(o,(function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=sd({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=n[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=tc(e.RTCPeerConnection.prototype,"localDescription");ad(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,r=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||{},an(this._streams).forEach((function(n){var i;Nb(i=r._streams[n].getTracks()).call(i,(function(t){return e.track===t}))&&(t=r._streams[n])})),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 r=t.sdp;return an(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return an(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function Rk(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=sd({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}))}function Ck(e,t){_b(e,"negotiationneeded",(function(e){var r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var wk=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:Sk,shimOnTrack:Ek,shimGetSendersWithDtmf:bk,shimGetStats:kk,shimSenderReceiverGetStats:Tk,shimAddTrackRemoveTrackWithNative:Ik,shimAddTrackRemoveTrack:Ak,shimPeerConnection:Rk,fixNegotiationNeeded:Ck,shimGetUserMedia:gk,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((function(t){var n=r.video&&r.video.width,i=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}},Symbol.toStringTag,{value:"Module"}));Rr({target:"Array",stat:!0},{isArray:eo});var xk=ee.Array.isArray;function Ok(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Dk=vl,Pk=tr,Nk=Al,Mk=Yt,Lk=O,Uk=Xe,Vk=function(e,t,r,n){try{return n?t(Pk(r)[0],r[1]):t(r)}catch(gX){Nk(e,"throw",gX)}},Fk=ul,Bk=go,jk=Br,Gk=Jn,Hk=bl,zk=vl,Kk=Array,Xk=function(e){var t=Uk(e),r=Bk(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=Mk(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=zk(t),p=0;if(!h||this===Kk&&Fk(h))for(a=jk(t),s=r?new this(a):Kk(a);a>p;p++)l=o?i(t[p],p):t[p],Gk(s,p,l);else for(d=(u=Hk(t,h)).next,s=r?new this:[];!(c=Lk(d,u)).done;p++)l=o?Vk(u,i,[c.value,p],!0):c.value,Gk(s,p,l);return s.length=p,s},qk=Xk;Rr({target:"Array",stat:!0,forced:!rv((function(e){Array.from(e)}))},{from:qk});var Wk=ee.Array.from;function Yk(e,t){var r;if(e){if("string"==typeof e)return Ok(e,t);var n=km(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Wk(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ok(e,t):void 0}}function Qk(e){return function(e){if(xk(e))return Ok(e)}(e)||function(e){if(void 0!==j_&&null!=Dk(e)||null!=e["@@iterator"])return Wk(e)}(e)||Yk(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Jk=n,Zk=i,$k=yn,eT=gy.trim,tT=b("".charAt),rT=Jk.parseFloat,nT=Jk.Symbol,iT=nT&&nT.iterator,oT=1/rT("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||iT&&!Zk((function(){rT(Object(iT))}))?function(e){var t=eT($k(e)),r=rT(t);return 0===r&&"-"==tT(t,0)?-0:r}:rT;Rr({global:!0,forced:parseFloat!=oT},{parseFloat:oT});var aT=ee.parseFloat;function sT(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){Sb("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===dy(e)&&"object"===dy(e.audio)&&(e=JSON.parse(ny(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},n&&n.prototype.getSettings){var a=n.prototype.getSettings;n.prototype.getSettings=function(){var e=a.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===dy(e)&&(e=JSON.parse(ny(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function cT(e){"object"===dy(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&ad(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function uT(e,t){if("object"===dy(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=sd({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[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=km(Array.prototype).call(arguments),i=e[0],o=e[1],a=e[2];return n.apply(this,[i||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(n){if("TypeError"!==n.name)throw n;e.forEach((function(t,n){e.set(n,JE({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function dT(e){if("object"===dy(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});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):v_.resolve(new bE)}}}function lT(e){if("object"===dy(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r}),_b(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function hT(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;Sb("removeStream","removeTrack"),this.getSenders().forEach((function(r){var n;r.track&&$m(n=e.getTracks()).call(n,r.track)&&t.removeTrack(r)}))})}function pT(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function fT(e){if("object"===dy(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);var r=(e=Qk(e)).length>0;r&&e.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&&!(aT(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(aT(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var n=t.apply(this,arguments);if(r){var i=n.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===an(o.encodings[0]).length)&&(o.encodings=e,i.sendEncodings=e,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function vT(e){if("object"===dy(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e,r=t.apply(this,arguments);"encodings"in r||(r.encodings=xm(e=[]).call(e,this.sendEncodings||[{}]));return r})}}function _T(e){if("object"===dy(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?v_.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function mT(e){if("object"===dy(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?v_.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var yT=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:cT,shimPeerConnection:uT,shimSenderGetStats:dT,shimReceiverGetStats:lT,shimRemoveStream:hT,shimRTCDataChannel:pT,shimAddTransceiver:fT,shimGetParameters:vT,shimCreateOffer:_T,shimCreateAnswer:mT,shimGetUserMedia:sT,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,v_.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}},Symbol.toStringTag,{value:"Module"}));function gT(e){if("object"===dy(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 t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var r,n=this;this._localStreams||(this._localStreams=[]),$m(r=this._localStreams).call(r,e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return t.call(n,r,e)})),e.getVideoTracks().forEach((function(r){return t.call(n,r,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=this,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return i&&i.forEach((function(e){var t;r._localStreams?$m(t=r._localStreams).call(t,e)||r._localStreams.push(e):r._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t,r,n=this;this._localStreams||(this._localStreams=[]);var i=Kb(t=this._localStreams).call(t,e);if(-1!==i){mk(r=this._localStreams).call(r,i,1);var o=e.getTracks();this.getSenders().forEach((function(e){$m(o).call(o,e.track)&&n.removeTrack(e)}))}})}}function ST(e){if("object"===dy(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){ad(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){var r;if(t._remoteStreams||(t._remoteStreams=[]),!$m(r=t._remoteStreams).call(r,e)){t._remoteStreams.push(e);var n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}}))})}});var t=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){var r;if(e._remoteStreams||(e._remoteStreams=[]),!(Kb(r=e._remoteStreams).call(r,t)>=0)){e._remoteStreams.push(t);var n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}}))}),t.apply(e,arguments)}}}function ET(e){if("object"===dy(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),v_.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),v_.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),v_.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),v_.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),v_.resolve()):n},t.addIceCandidate=s}}function bT(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return n(kT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function kT(e){return e&&void 0!==e.video?JE({},e,{video:kb(e.video)}):e}function TT(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var o=e.iceServers[i];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(Sb("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(ny(o))).urls=o.url,delete o.url,n.push(o)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&ad(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function IT(e){"object"===dy(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&ad(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function AT(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){var r,n;void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=Nb(r=this.getTransceivers()).call(r,(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 o=Nb(n=this.getTransceivers()).call(n,(function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&o?"sendrecv"===o.direction?o.setDirection?o.setDirection("sendonly"):o.direction="sendonly":"recvonly"===o.direction&&(o.setDirection?o.setDirection("inactive"):o.direction="inactive"):!0!==e.offerToReceiveVideo||o||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function RT(e){"object"!==dy(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var CT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:gT,shimRemoteStreamsAPI:ST,shimCallbacksAPI:ET,shimGetUserMedia:bT,shimConstraints:kT,shimRTCIceServerUrls:TT,shimTrackEventTransceiver:IT,shimCreateOfferLegacy:AT,shimAudioContext:RT},Symbol.toStringTag,{value:"Module"})),wT=cc.PROPER,xT=i,OT=ly,DT=gy.trim;Rr({target:"String",proto:!0,forced:function(e){return xT((function(){return!!OT[e]()||"​…᠎"!=="​…᠎"[e]()||wT&&OT[e].name!==e}))}("trim")},{trim:function(){return DT(this)}});var PT,NT,MT=Us("String").trim,LT=ae,UT=MT,VT=String.prototype,FT=function(e){var t=e.trim;return"string"==typeof e||e===VT||LT(VT,e)&&t===VT.trim?UT:t},BT={exports:{}};PT=BT,(NT={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}}).localCName=NT.generateIdentifier(),NT.splitLines=function(e){var t;return uy(t=FT(e).call(e).split("\n")).call(t,(function(e){return FT(e).call(e)}))},NT.splitSections=function(e){var t=e.split("\nm=");return uy(t).call(t,(function(e,t){var r;return FT(r=t>0?"m="+e:e).call(r)+"\r\n"}))},NT.getDescription=function(e){var t=NT.splitSections(e);return t&&t[0]},NT.getMediaSections=function(e){var t=NT.splitSections(e);return t.shift(),t},NT.matchPrefix=function(e,t){var r;return Gs(r=NT.splitLines(e)).call(r,(function(e){return 0===Kb(e).call(e,t)}))},NT.parseCandidate=function(e){for(var t,r={foundation:(t=0===Kb(e).call(e,"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:Dy(t[3],10),ip:t[4],address:t[4],port:Dy(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=Dy(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:void 0===r[t[n]]&&(r[t[n]]=t[n+1])}return r},NT.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},NT.parseIceOptions=function(e){return e.substr(14).split(" ")},NT.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:Dy(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=Dy(t[1],10),r.channels=3===t.length?Dy(t[2],10):1,r.numChannels=r.channels,r},NT.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},NT.parseExtmap=function(e){var t,r=e.substr(9).split(" ");return{id:Dy(r[0],10),direction:Kb(t=r[0]).call(t,"/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1]}},NT.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},NT.parseFmtp=function(e){for(var t,r={},n=e.substr(Kb(e).call(e," ")+1).split(";"),i=0;i<n.length;i++){var o,a;t=FT(o=n[i]).call(o).split("="),r[FT(a=t[0]).call(a)]=t[1]}return r},NT.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&an(e.parameters).length){var n=[];an(e.parameters).forEach((function(t){void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},NT.parseRtcpFb=function(e){var t=e.substr(Kb(e).call(e," ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},NT.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},NT.parseSsrcMedia=function(e){var t=Kb(e).call(e," "),r={ssrc:Dy(e.substr(7,t-7),10)},n=Kb(e).call(e,":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},NT.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:uy(t).call(t,(function(e){return Dy(e,10)}))}},NT.getMid=function(e){var t=NT.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},NT.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},NT.getDtlsParameters=function(e,t){var r=NT.matchPrefix(e+t,"a=fingerprint:");return{role:"auto",fingerprints:uy(r).call(r,NT.parseFingerprint)}},NT.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},NT.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:Dy(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:km(t).call(t,3)}},NT.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===dy(e.keyParams)?NT.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},NT.parseCryptoKeyParams=function(e){if(0!==Kb(e).call(e,"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}},NT.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},NT.getCryptoParameters=function(e,t){var r=NT.matchPrefix(e+t,"a=crypto:");return uy(r).call(r,NT.parseCryptoLine)},NT.getIceParameters=function(e,t){var r=NT.matchPrefix(e+t,"a=ice-ufrag:")[0],n=NT.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},NT.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},NT.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=NT.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var i=r[n],o=NT.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(o){var a,s=NT.parseRtpMap(o),c=NT.matchPrefix(e,"a=fmtp:"+i+" ");switch(s.parameters=c.length?NT.parseFmtp(c[0]):{},s.rtcpFeedback=uy(a=NT.matchPrefix(e,"a=rtcp-fb:"+i+" ")).call(a,NT.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return NT.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(NT.parseExtmap(e))})),t},NT.writeRtpDescription=function(e,t){var r,n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=uy(r=t.codecs).call(r,(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){n+=NT.writeRtpMap(e),n+=NT.writeFmtp(e),n+=NT.writeRtcpFb(e)}));var i=0;return t.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){n+=NT.writeExtmap(e)})),n},NT.parseRtpEncodingParameters=function(e){var t,r,n,i,o,a,s=[],c=NT.parseRtpParameters(e),u=-1!==Kb(t=c.fecMechanisms).call(t,"RED"),d=-1!==Kb(r=c.fecMechanisms).call(r,"ULPFEC"),l=Gs(n=uy(i=NT.matchPrefix(e,"a=ssrc:")).call(i,(function(e){return NT.parseSsrcMedia(e)}))).call(n,(function(e){return"cname"===e.attribute})),h=l.length>0&&l[0].ssrc,p=uy(o=NT.matchPrefix(e,"a=ssrc-group:FID")).call(o,(function(e){var t=e.substr(17).split(" ");return uy(t).call(t,(function(e){return Dy(e,10)}))}));p.length>0&&p[0].length>1&&p[0][0]===h&&(a=p[0][1]),c.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:h,codecPayloadType:Dy(e.parameters.apt,10)};h&&a&&(t.rtx={ssrc:a}),s.push(t),u&&((t=JSON.parse(ny(t))).fec={ssrc:h,mechanism:d?"red+ulpfec":"red"},s.push(t))}})),0===s.length&&h&&s.push({ssrc:h});var f,v,_=NT.matchPrefix(e,"b=");return _.length&&(_=0===Kb(f=_[0]).call(f,"b=TIAS:")?Dy(_[0].substr(7),10):0===Kb(v=_[0]).call(v,"b=AS:")?1e3*Dy(_[0].substr(5),10)*.95-16e3:void 0,s.forEach((function(e){e.maxBitrate=_}))),s},NT.parseRtcpParameters=function(e){var t,r,n={},i=Gs(t=uy(r=NT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return NT.parseSsrcMedia(e)}))).call(t,(function(e){return"cname"===e.attribute}))[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);var o=NT.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=o.length>0,n.compound=0===o.length;var a=NT.matchPrefix(e,"a=rtcp-mux");return n.mux=a.length>0,n},NT.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},NT.parseMsid=function(e){var t,r,n,i=NT.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(n=i[0].substr(7).split(" "))[0],track:n[1]};var o=Gs(t=uy(r=NT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return NT.parseSsrcMedia(e)}))).call(t,(function(e){return"msid"===e.attribute}));return o.length>0?{stream:(n=o[0].value.split(" "))[0],track:n[1]}:void 0},NT.parseSctpDescription=function(e){var t,r=NT.parseMLine(e),n=NT.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=Dy(n[0].substr(19),10)),isNaN(t)&&(t=65536);var i=NT.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:Dy(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var o=NT.matchPrefix(e,"a=sctpmap:");if(o.length>0){var a=o[0].substr(10).split(" ");return{port:Dy(a[0],10),protocol:a[1],maxMessageSize:t}}},NT.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},NT.generateSessionId=function(){return Math.random().toString().substr(2,21)},NT.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||NT.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},NT.getDirection=function(e,t){for(var r=NT.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?NT.getDirection(t):"sendrecv"},NT.getKind=function(e){return NT.splitLines(e)[0].split(" ")[0].substr(2)},NT.isRejected=function(e){return"0"===e.split(" ",2)[1]},NT.parseMLine=function(e){var t=NT.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:Dy(t[1],10),protocol:t[2],fmt:km(t).call(t,3).join(" ")}},NT.parseOLine=function(e){var t=NT.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:Dy(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},NT.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=NT.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},PT.exports=NT;var jT=BT.exports,GT=e({__proto__:null,default:jT},[BT.exports]);function HT(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){var r;if("object"===dy(e)&&e.candidate&&0===Kb(r=e.candidate).call(r,"a=")&&((e=JSON.parse(ny(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var n=new t(e),i=jT.parseCandidate(e.candidate),o=JE(n,i);return o.toJSON=function(){return{candidate:o.candidate,sdpMid:o.sdpMid,sdpMLineIndex:o.sdpMLineIndex,usernameFragment:o.usernameFragment}},o}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,_b(e,"icecandidate",(function(t){return t.candidate&&ad(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function zT(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||_b(e,"icecandidate",(function(e){if(e.candidate){var t=jT.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function KT(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||ad(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var r=function(e){if(!e||!e.sdp)return!1;var t=jT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t,r=jT.parseMLine(e);return r&&"application"===r.kind&&-1!==Kb(t=r.protocol).call(t,"SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=Dy(t[1],10);return r!=r?-1:r},i=function(e){var r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},o=function(e,r){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=jT.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=Dy(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&ad(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var c,u=n(arguments[0]),d=i(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={};ad(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function XT(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 r(e,this),e},_b(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}function qT(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;ad(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),ad(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 r=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 r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}}function WT(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){var n;if(t&&t.sdp&&-1!==Kb(n=t.sdp).call(n,"\na=extmap-allow-mixed")){var i,o=Gs(i=t.sdp.split("\n")).call(i,(function(e){return"a=extmap-allow-mixed"!==FT(e).call(e)})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:o}):t.sdp=o}return r.apply(this,arguments)}}}function YT(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?v_.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),v_.resolve())})}}function QT(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==dy(t)||t.type&&t.sdp)return r.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return r.apply(this,[t]);var n="offer"===t.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var JT=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:HT,shimRTCIceCandidateRelayProtocol:zT,shimMaxMessageSize:KT,shimSendThrowTypeError:XT,shimConnectionState:qT,removeExtmapAllowMixed:WT,shimAddIceCandidateNullOrEmpty:YT,shimParameterlessSetLocalDescription:QT},Symbol.toStringTag,{value:"Module"}));function ZT(e,t){var r=void 0!==j_&&Dk(e)||e["@@iterator"];if(!r){if(xk(e)||(r=Yk(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function $T(e,t){return function(e){if(xk(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==j_&&Dk(e)||e["@@iterator"];if(null!=r){var n,i,o=[],a=!0,s=!1;try{for(r=r.call(e);!(a=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);a=!0);}catch(c){s=!0,i=c}finally{try{a||null==r.return||r.return()}finally{if(s)throw i}}return o}}(e,t)||Yk(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eI(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},n=gb,i=Eb(t),o={browserDetails:i,commonShim:JT,extractVersion:vb,disableLog:mb,disableWarnings:yb,sdp:GT};switch(i.browser){case"chrome":if(!wk||!Rk||!r.shimChrome)return n("Chrome shim is not included in this adapter release."),o;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),o;n("adapter.js shimming chrome."),o.browserShim=wk,YT(t,i),QT(t),gk(t,i),Sk(t),Rk(t,i),Ek(t),Ak(t,i),bk(t),kk(t),Tk(t),Ck(t,i),HT(t),zT(t),qT(t),KT(t,i),XT(t),WT(t,i);break;case"firefox":if(!yT||!uT||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=yT,YT(t,i),QT(t),sT(t,i),uT(t,i),cT(t),hT(t),dT(t),lT(t),pT(t),fT(t),vT(t),_T(t),mT(t),HT(t),qT(t),KT(t,i),XT(t);break;case"safari":if(!CT||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=CT,YT(t,i),QT(t),TT(t),AT(t),ET(t),gT(t),ST(t),IT(t),bT(t),RT(t),HT(t),zT(t),KT(t,i),XT(t),WT(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var tI=Ye,rI=function(e){return void 0!==e&&(tI(e,"value")||tI(e,"writable"))},nI=O,iI=$,oI=tr,aI=rI,sI=R,cI=mc;Rr({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return oI(t)===o?t[r]:(n=sI.f(t,r))?aI(n)?n.value:void 0===n.get?void 0:nI(n.get,o):iI(i=cI(t))?e(i,r,o):void 0}});var uI=ee.Reflect.get,dI=b,lI=we,hI=$,pI=Ye,fI=rs,vI=o,_I=Function,mI=dI([].concat),yI=dI([].join),gI={},SI=function(e,t,r){if(!pI(gI,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";gI[t]=_I("C,a","return new C("+yI(n,",")+")")}return gI[t](e,r)},EI=vI?_I.bind:function(e){var t=lI(this),r=t.prototype,n=fI(arguments,1),i=function(){var r=mI(n,fI(arguments));return this instanceof i?SI(t,r.length,r):t.apply(e,r)};return hI(r)&&(i.prototype=r),i},bI=EI;Rr({target:"Function",proto:!0,forced:Function.bind!==bI},{bind:bI});var kI=Us("Function").bind,TI=ae,II=kI,AI=Function.prototype,RI=function(e){var t=e.bind;return e===AI||TI(AI,e)&&t===AI.bind?II:t};function CI(e){var t;return(CI=Y_?RI(t=W_).call(t):function(e){return e.__proto__||W_(e)})(e)}function wI(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=CI(e)););return e}function xI(){var e;"undefined"!=typeof Reflect&&uI?xI=RI(e=uI).call(e):xI=function(e,t,r){var n=wI(e,t);if(n){var i=tc(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}};return xI.apply(this,arguments)}function OI(e,t){var r;return(OI=Y_?RI(r=Y_).call(r):function(e,t){return e.__proto__=t,e})(e,t)}function DI(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=z_(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),ad(e,"prototype",{writable:!1}),t&&OI(e,t)}var PI=Rr,NI=d,MI=EI,LI=Th,UI=tr,VI=$,FI=Hn,BI=i,jI=oe("Reflect","construct"),GI=Object.prototype,HI=[].push,zI=BI((function(){function e(){}return!(jI((function(){}),[],e)instanceof e)})),KI=!BI((function(){jI((function(){}))})),XI=zI||KI;PI({target:"Reflect",stat:!0,forced:XI,sham:XI},{construct:function(e,t){LI(e),UI(t);var r=arguments.length<3?e:LI(arguments[2]);if(KI&&!zI)return jI(e,t,r);if(e==r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return NI(HI,n,t),new(NI(MI,e,n))}var i=r.prototype,o=FI(VI(i)?i:GI),a=NI(e,o,t);return VI(a)?a:o}});var qI=ee.Reflect.construct;function WI(e,t){if(t&&("object"===dy(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return eI(e)}function YI(e){var t=function(){if("undefined"==typeof Reflect||!qI)return!1;if(qI.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(qI(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=CI(e);if(t){var i=CI(this).constructor;r=qI(n,arguments,i)}else r=n.apply(this,arguments);return WI(this,r)}}var QI=Us("Array").values,JI=vn,ZI=Ye,$I=ae,eA=QI,tA=Array.prototype,rA={DOMTokenList:!0,NodeList:!0},nA=function(e){var t=e.values;return e===tA||$I(tA,e)&&t===tA.values||ZI(rA,JI(e))?eA:t},iA=ni,oA=Math.floor,aA=function(e,t){var r=e.length,n=oA(r/2);return r<8?sA(e,t):cA(e,aA(iA(e,0,n),t),aA(iA(e,n),t),t)},sA=function(e,t){for(var r,n,i=e.length,o=1;o<i;){for(n=o,r=e[o];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==o++&&(e[n]=r)}return e},cA=function(e,t,r,n){for(var i=t.length,o=r.length,a=0,s=0;a<i||s<o;)e[a+s]=a<i&&s<o?n(t[a],r[s])<=0?t[a++]:r[s++]:a<i?t[a++]:r[s++];return e},uA=aA,dA=se.match(/firefox\/(\d+)/i),lA=!!dA&&+dA[1],hA=/MSIE|Trident/.test(se),pA=se.match(/AppleWebKit\/(\d+)\./),fA=!!pA&&+pA[1],vA=Rr,_A=b,mA=we,yA=Xe,gA=Br,SA=$b,EA=yn,bA=i,kA=uA,TA=Iu,IA=lA,AA=hA,RA=fe,CA=fA,wA=[],xA=_A(wA.sort),OA=_A(wA.push),DA=bA((function(){wA.sort(void 0)})),PA=bA((function(){wA.sort(null)})),NA=TA("sort"),MA=!bA((function(){if(RA)return RA<70;if(!(IA&&IA>3)){if(AA)return!0;if(CA)return CA<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)wA.push({k:t+n,v:r})}for(wA.sort((function(e,t){return t.v-e.v})),n=0;n<wA.length;n++)t=wA[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));vA({target:"Array",proto:!0,forced:DA||!PA||!NA||!MA},{sort:function(e){void 0!==e&&mA(e);var t=yA(this);if(MA)return void 0===e?xA(t):xA(t,e);var r,n,i=[],o=gA(t);for(n=0;n<o;n++)n in t&&OA(i,t[n]);for(kA(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:EA(t)>EA(r)?1:-1}}(e)),r=gA(i),n=0;n<r;)t[n]=i[n++];for(;n<o;)SA(t,n++);return t}});var LA=Us("Array").sort,UA=ae,VA=LA,FA=Array.prototype,BA=function(e){var t=e.sort;return e===FA||UA(FA,e)&&t===FA.sort?VA:t},jA=Rr,GA=No.findIndex,HA="findIndex",zA=!0;HA in[]&&Array(1).findIndex((function(){zA=!1})),jA({target:"Array",proto:!0,forced:zA},{findIndex:function(e){return GA(this,e,arguments.length>1?arguments[1]:void 0)}});var KA=Us("Array").findIndex,XA=ae,qA=KA,WA=Array.prototype,YA=function(e){var t=e.findIndex;return e===WA||XA(WA,e)&&t===WA.findIndex?qA:t},QA=Rr,JA=b;R.f;var ZA=Vr,$A=yn,eR=Vm,tR=q,rR=Bm,nR=JA("".startsWith),iR=JA("".slice),oR=Math.min;QA({target:"String",proto:!0,forced:!rR("startsWith")},{startsWith:function(e){var t=$A(tR(this));eR(e);var r=ZA(oR(arguments.length>1?arguments[1]:void 0,t.length)),n=$A(e);return nR?nR(t,n,r):iR(t,r,r+n.length)===n}});var aR=Us("String").startsWith,sR=ae,cR=aR,uR=String.prototype,dR=function(e){var t=e.startsWith;return"string"==typeof e||e===uR||sR(uR,e)&&t===uR.startsWith?cR:t},lR=function(e){return 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.INVOKED_BEFORE_CAPTURE="INVOKED_BEFORE_CAPTURE",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.INTERRUPT="INTERRUPT",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_EXCEED_QPS="USER_MESSAGE_EXCEED_QPS",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_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",e.SUBTITLE_ALREADY_ON="SUBTITLE_ALREADY_ON",e.SUBTITLE_NOT_TURNED_ON="SUBTITLE_NOT_TURNED_ON",e.SUBTITLE_ERR_POSTPROCESS="SUBTITLE_ERR_POSTPROCESS",e.SUBTITLE_ERR_CONNECTION_ERROR="SUBTITLE_ERR_CONNECTION_ERROR",e.SUBTITLE_ERR_PROCESS_ERROR="SUBTITLE_ERR_PROCESS_ERROR",e.SUBTITLE_ERR_UNKNOWN="SUBTITLE_ERR_UNKNOWN",e}(lR||{}),hR=function(e){return 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",e}(hR||{}),pR=qd((function e(t,r,n){Wd(this,e),sd(this,"code",void 0),sd(this,"message",void 0),sd(this,"error",void 0),this.code=t,this.message=r,this.error=n})),fR=C,vR=b,_R=rn,mR=Q,yR=vR(D.f),gR=vR([].push),SR=function(e){return function(t){for(var r,n=mR(t),i=_R(n),o=i.length,a=0,s=[];o>a;)r=i[a++],fR&&!yR(n,r)||gR(s,e?[r,n[r]]:n[r]);return s}},ER={entries:SR(!0),values:SR(!1)}.entries;Rr({target:"Object",stat:!0},{entries:function(e){return ER(e)}});var bR=ee.Object.entries,kR=Or,TR=yn,IR=q,AR=RangeError,RR=b,CR=Vr,wR=yn,xR=function(e){var t=TR(IR(this)),r="",n=kR(e);if(n<0||n==1/0)throw AR("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},OR=q,DR=RR(xR),PR=RR("".slice),NR=Math.ceil,MR=function(e){return function(t,r,n){var i,o,a=wR(OR(t)),s=CR(r),c=a.length,u=void 0===n?" ":wR(n);return s<=c||""==u?a:((o=DR(u,NR((i=s-c)/u.length))).length>i&&(o=PR(o,0,i)),e?a+o:o+a)}},LR={start:MR(!1),end:MR(!0)},UR=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(se),VR=LR.end;Rr({target:"String",proto:!0,forced:UR},{padEnd:function(e){return VR(this,e,arguments.length>1?arguments[1]:void 0)}});var FR=Us("String").padEnd,BR=ae,jR=FR,GR=String.prototype,HR=function(e){var t=e.padEnd;return"string"==typeof e||e===GR||BR(GR,e)&&t===GR.padEnd?jR:t},zR=Oy;Rr({target:"Number",stat:!0,forced:Number.parseInt!=zR},{parseInt:zR});var KR=ee.Number.parseInt,XR=Math.log,qR=Math.LOG10E;Rr({target:"Math",stat:!0},{log10:Math.log10||function(e){return XR(e)*qR}});var WR,YR=ee.Math.log10,QR=new Uint8Array(16);function JR(){if(!WR&&!(WR="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 WR(QR)}var ZR=/^(?:[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 $R(e){return"string"==typeof e&&ZR.test(e)}for(var eC=[],tC=0;tC<256;++tC)eC.push((tC+256).toString(16).substr(1));function rC(e,t,r){var n=(e=e||{}).random||(e.rng||JR)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(eC[e[t+0]]+eC[e[t+1]]+eC[e[t+2]]+eC[e[t+3]]+"-"+eC[e[t+4]]+eC[e[t+5]]+"-"+eC[e[t+6]]+eC[e[t+7]]+"-"+eC[e[t+8]]+eC[e[t+9]]+"-"+eC[e[t+10]]+eC[e[t+11]]+eC[e[t+12]]+eC[e[t+13]]+eC[e[t+14]]+eC[e[t+15]]).toLowerCase();if(!$R(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var nC={exports:{}},iC=n;Rr({global:!0,forced:iC.globalThis!==iC},{globalThis:iC});var oC=n,aC={exports:{}};!function(e,r){var n;e.exports=(n=n||function(e,r){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),void 0!==oC&&oC.crypto&&(n=oC.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==t&&t.crypto&&(n=t.crypto),!n)try{n=require("crypto")}catch(_){}var i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(_){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(_){}}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 r;return e.prototype=t,r=new e,e.prototype=null,r}}(),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,t){e=this.words=e||[],this.sigBytes=t!=r?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var o=0;o<i;o++){var a=r[o>>>2]>>>24-o%4*8&255;t[n+o>>>2]|=a<<24-(n+o)%4*8}else for(var s=0;s<i;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e,t=c.clone.call(this);return t.words=km(e=this.words).call(e,0),t},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(i());return new u.init(t,e)}}),d=a.enc={},l=d.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push((o>>>4).toString(16)),n.push((15&o).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=Dy(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},h=d.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var o=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(o))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},p=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(t){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){var t;"string"==typeof e&&(e=p.parse(e)),xm(t=this._data).call(t,e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,o=n.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(i,l);r=mk(i).call(i,0,c),n.sigBytes-=d}return new u.init(r,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,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new v.HMAC.init(e,r).finalize(t)}}});var v=a.algo={};return a}(Math),n)}(aC),function(e,t){var r;e.exports=(r=aC.exports,function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init,n=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 r=e.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=e[i]<<24-i%4*8;t.call(this,n,r)}else t.apply(this,arguments)};n.prototype=e}}(),r.lib.WordArray)}(nC);var sC=nC.exports,cC={exports:{}},uC={exports:{}};!function(e,t){var r;e.exports=(r=aC.exports,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var i=[],o=0,a=0;a<r;a++)if(a%4){var s=n[e.charCodeAt(a-1)]<<a%4*2|n[e.charCodeAt(a)]>>>6-a%4*2;i[o>>>2]|=s<<24-o%4*8,o++}return t.create(i,o)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],o=0;o<r;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<r;s++)i.push(n.charAt(a>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<r.length;o++)i[r.charCodeAt(o)]=o}var a=r.charAt(64);if(a){var s=Kb(e).call(e,a);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),r.enc.Base64)}(uC);var dC={exports:{}};!function(e,t){var r;e.exports=(r=aC.exports,function(e){var t=r,n=t.lib,i=n.WordArray,o=n.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 i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var o=this._hash.words,a=e[t+0],c=e[t+1],p=e[t+2],f=e[t+3],v=e[t+4],_=e[t+5],m=e[t+6],y=e[t+7],g=e[t+8],S=e[t+9],E=e[t+10],b=e[t+11],k=e[t+12],T=e[t+13],I=e[t+14],A=e[t+15],R=o[0],C=o[1],w=o[2],x=o[3];R=u(R,C,w,x,a,7,s[0]),x=u(x,R,C,w,c,12,s[1]),w=u(w,x,R,C,p,17,s[2]),C=u(C,w,x,R,f,22,s[3]),R=u(R,C,w,x,v,7,s[4]),x=u(x,R,C,w,_,12,s[5]),w=u(w,x,R,C,m,17,s[6]),C=u(C,w,x,R,y,22,s[7]),R=u(R,C,w,x,g,7,s[8]),x=u(x,R,C,w,S,12,s[9]),w=u(w,x,R,C,E,17,s[10]),C=u(C,w,x,R,b,22,s[11]),R=u(R,C,w,x,k,7,s[12]),x=u(x,R,C,w,T,12,s[13]),w=u(w,x,R,C,I,17,s[14]),R=d(R,C=u(C,w,x,R,A,22,s[15]),w,x,c,5,s[16]),x=d(x,R,C,w,m,9,s[17]),w=d(w,x,R,C,b,14,s[18]),C=d(C,w,x,R,a,20,s[19]),R=d(R,C,w,x,_,5,s[20]),x=d(x,R,C,w,E,9,s[21]),w=d(w,x,R,C,A,14,s[22]),C=d(C,w,x,R,v,20,s[23]),R=d(R,C,w,x,S,5,s[24]),x=d(x,R,C,w,I,9,s[25]),w=d(w,x,R,C,f,14,s[26]),C=d(C,w,x,R,g,20,s[27]),R=d(R,C,w,x,T,5,s[28]),x=d(x,R,C,w,p,9,s[29]),w=d(w,x,R,C,y,14,s[30]),R=l(R,C=d(C,w,x,R,k,20,s[31]),w,x,_,4,s[32]),x=l(x,R,C,w,g,11,s[33]),w=l(w,x,R,C,b,16,s[34]),C=l(C,w,x,R,I,23,s[35]),R=l(R,C,w,x,c,4,s[36]),x=l(x,R,C,w,v,11,s[37]),w=l(w,x,R,C,y,16,s[38]),C=l(C,w,x,R,E,23,s[39]),R=l(R,C,w,x,T,4,s[40]),x=l(x,R,C,w,a,11,s[41]),w=l(w,x,R,C,f,16,s[42]),C=l(C,w,x,R,m,23,s[43]),R=l(R,C,w,x,S,4,s[44]),x=l(x,R,C,w,k,11,s[45]),w=l(w,x,R,C,A,16,s[46]),R=h(R,C=l(C,w,x,R,p,23,s[47]),w,x,a,6,s[48]),x=h(x,R,C,w,y,10,s[49]),w=h(w,x,R,C,I,15,s[50]),C=h(C,w,x,R,_,21,s[51]),R=h(R,C,w,x,k,6,s[52]),x=h(x,R,C,w,f,10,s[53]),w=h(w,x,R,C,E,15,s[54]),C=h(C,w,x,R,c,21,s[55]),R=h(R,C,w,x,g,6,s[56]),x=h(x,R,C,w,A,10,s[57]),w=h(w,x,R,C,m,15,s[58]),C=h(C,w,x,R,T,21,s[59]),R=h(R,C,w,x,v,6,s[60]),x=h(x,R,C,w,b,10,s[61]),w=h(w,x,R,C,p,15,s[62]),C=h(C,w,x,R,S,21,s[63]),o[0]=o[0]+R|0,o[1]=o[1]+C|0,o[2]=o[2]+w|0,o[3]=o[3]+x|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var o=e.floor(n/4294967296),a=n;r[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),r[14+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),t.sigBytes=4*(r.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,r,n,i,o,a){var s=e+(t&r|~t&n)+i+a;return(s<<o|s>>>32-o)+t}function d(e,t,r,n,i,o,a){var s=e+(t&n|r&~n)+i+a;return(s<<o|s>>>32-o)+t}function l(e,t,r,n,i,o,a){var s=e+(t^r^n)+i+a;return(s<<o|s>>>32-o)+t}function h(e,t,r,n,i,o,a){var s=e+(r^(t|~n))+i+a;return(s<<o|s>>>32-o)+t}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)}(Math),r.MD5)}(dC);var lC={exports:{}},hC={exports:{}};!function(e,t){var r,n,i,o,a,s,c,u;e.exports=(n=(r=u=aC.exports).lib,i=n.WordArray,o=n.Hasher,a=r.algo,s=[],c=a.SHA1=o.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],o=r[2],a=r[3],c=r[4],u=0;u<80;u++){if(u<16)s[u]=0|e[t+u];else{var d=s[u-3]^s[u-8]^s[u-14]^s[u-16];s[u]=d<<1|d>>>31}var l=(n<<5|n>>>27)+c+s[u];l+=u<20?1518500249+(i&o|~i&a):u<40?1859775393+(i^o^a):u<60?(i&o|i&a|o&a)-1894007588:(i^o^a)-899497514,c=a,a=o,o=i<<30|i>>>2,i=n,n=l}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+o|0,r[3]=r[3]+a|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=o.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=o._createHelper(c),r.HmacSHA1=o._createHmacHelper(c),u.SHA1)}(hC);var pC={exports:{}};!function(e,t){var r,n,i;e.exports=(n=(r=aC.exports).lib.Base,i=r.enc.Utf8,void(r.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(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<r;u++)s[u]^=1549556828,c[u]^=909522486;o.sigBytes=a.sigBytes=n,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,r=this._hasher,n=r.finalize(e);return r.reset(),r.finalize(xm(t=this._oKey.clone()).call(t,n))}})))}(pC),function(e,t){var r,n,i,o,a,s,c,u;e.exports=(n=(r=u=aC.exports).lib,i=n.Base,o=n.WordArray,a=r.algo,s=a.MD5,c=a.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,i=n.hasher.create(),a=o.create(),s=a.words,c=n.keySize,u=n.iterations;s.length<c;){r&&i.update(r),r=i.update(e).finalize(t),i.reset();for(var d=1;d<u;d++)r=i.finalize(r),i.reset();xm(a).call(a,r)}return a.sigBytes=4*c,a}}),r.EvpKDF=function(e,t,r){return c.create(r).compute(e,t)},u.EvpKDF)}(lC);var fC={exports:{}};!function(e,t){var r;e.exports=void((r=aC.exports).lib.Cipher||function(e){var t=r,n=t.lib,i=n.Base,o=n.WordArray,a=n.BufferedBlockAlgorithm,s=t.enc;s.Utf8;var c=s.Base64,u=t.algo.EvpKDF,d=n.Cipher=a.extend({cfg:i.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,r){this.cfg=this.cfg.extend(r),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?g:m}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()});n.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=t.mode={},h=n.BlockCipherMode=i.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 r(t,r,n){var i,o=this._iv;o?(i=o,this._iv=e):i=this._prevBlock;for(var a=0;a<n;a++)t[r+a]^=i[a]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=km(e).call(e,t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,o=km(e).call(e,t,t+i);n.decryptBlock(e,t),r.call(this,e,t,i),this._prevBlock=o}}),t}(),f=(t.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,a=[],s=0;s<n;s+=4)a.push(i);var c=o.create(a,n);xm(e).call(e,c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};n.BlockCipher=d.extend({cfg:d.cfg.extend({mode:p,padding:f}),reset:function(){var e;d.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.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 v=n.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t,r,n=e.ciphertext,i=e.salt;return(i?xm(t=xm(r=o.create([1398893684,1701076831])).call(r,i)).call(t,n):n).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=o.create(km(n).call(n,2,4)),mk(n).call(n,0,4),r.sigBytes-=16),v.create({ciphertext:r,salt:t})}},m=n.SerializableCipher=i.extend({cfg:i.extend({format:_}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),o=i.finalize(t),a=i.cfg;return v.create({ciphertext:o,key:r,iv:a.iv,algorithm:e,mode:a.mode,padding:a.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,n,i){var a;if(n||(n=o.random(8)),i)s=u.create({keySize:t+r,hasher:i}).compute(e,n);else var s=u.create({keySize:t+r}).compute(e,n);var c=o.create(km(a=s.words).call(a,t),4*r);return s.sigBytes=4*t,v.create({key:s,iv:c,salt:n})}},g=n.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:y}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize,n.salt,n.hasher);n.iv=i.iv;var o=m.encrypt.call(this,e,t,i.key,n);return o.mixIn(i),o},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt,n.hasher);return n.iv=i.iv,m.decrypt.call(this,e,t,i.key,n)}})}())}(fC),function(e,t){var r;e.exports=(r=aC.exports,function(){var e=r,t=e.lib.BlockCipher,n=e.algo,i=[],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 r=0,n=0;for(t=0;t<256;t++){var f=n^n<<1^n<<2^n<<3^n<<4;f=f>>>8^255&f^99,i[r]=f,o[f]=r;var v=e[r],_=e[v],m=e[_],y=257*e[f]^16843008*f;a[r]=y<<24|y>>>8,s[r]=y<<16|y>>>16,c[r]=y<<8|y>>>24,u[r]=y,y=16843009*m^65537*_^257*v^16843008*r,d[f]=y<<24|y>>>8,l[f]=y<<16|y>>>16,h[f]=y<<8|y>>>24,p[f]=y,r?(r=v^e[e[e[m^v]]],n^=e[e[n]]):r=n=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],v=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),o=this._keySchedule=[],a=0;a<n;a++)a<r?o[a]=t[a]:(u=o[a-1],a%r?r>6&&a%r==4&&(u=i[u>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u]):(u=i[(u=u<<8|u>>>24)>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u],u^=f[a/r|0]<<24),o[a]=o[a-r]^u);for(var s=this._invKeySchedule=[],c=0;c<n;c++){if(a=n-c,c%4)var u=o[a];else u=o[a-4];s[c]=c<4||a<=4?u:d[i[u>>>24]]^l[i[u>>>16&255]]^h[i[u>>>8&255]]^p[i[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,s,c,u,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,d,l,h,p,o),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,o,a,s){for(var c=this._nRounds,u=e[t]^r[0],d=e[t+1]^r[1],l=e[t+2]^r[2],h=e[t+3]^r[3],p=4,f=1;f<c;f++){var v=n[u>>>24]^i[d>>>16&255]^o[l>>>8&255]^a[255&h]^r[p++],_=n[d>>>24]^i[l>>>16&255]^o[h>>>8&255]^a[255&u]^r[p++],m=n[l>>>24]^i[h>>>16&255]^o[u>>>8&255]^a[255&d]^r[p++],y=n[h>>>24]^i[u>>>16&255]^o[d>>>8&255]^a[255&l]^r[p++];u=v,d=_,l=m,h=y}v=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^r[p++],_=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&u])^r[p++],m=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^r[p++],y=(s[h>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^r[p++],e[t]=v,e[t+1]=_,e[t+2]=m,e[t+3]=y},keySize:8});e.AES=t._createHelper(v)}(),r.AES)}(cC);var vC={exports:{}};!function(e,t){e.exports=aC.exports.enc.Hex}(vC);var _C=vC.exports,mC={exports:{}};!function(e,t){var r,n,i;e.exports=((i=aC.exports).mode.CTR=(r=i.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,o=this._counter;i&&(o=this._counter=km(i).call(i,0),this._iv=void 0);var a=km(o).call(o,0);r.encryptBlock(a,0),o[n-1]=o[n-1]+1|0;for(var s=0;s<n;s++)e[t+s]^=a[s]}}),r.Decryptor=n,r),i.mode.CTR)}(mC);var yC=mC.exports,gC={exports:{}};!function(e,t){var r;e.exports=((r=aC.exports).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)}(gC);var SC,EC,bC,kC=gC.exports,TC=new TextDecoder,IC=new TextEncoder,AC=function(){return rC()},RC=function(){return Date.now()};function CC(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var o=0,a=n;o<a.length;o++){var s=a[o];t+=s.length}for(var c=new e(t),u=0,d=0,l=n;d<l.length;d++){var h=l[d];c.set(h,u),u+=h.length}return c}var wC=function(){return"undefined"==typeof window},xC=function(){function e(){Wd(this,e)}var t,r;return qd(e,null,[{key:"token2auth",value:function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))}},{key:"createUnsafeToken",value:function(e,t,r){var n;return window.btoa(Gs(n=[e,t,r]).call(n,(function(e){return null!==e})).join(":"))}},{key:"merge",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,i=bR(t);n<i.length;n++){var o=$T(i[n],2),a=o[0],s=o[1];null!==s&&"object"===dy(s)?e.merge(t[a],r[a]):void 0!==r[a]&&(t[a]=r[a])}}},{key:"ab2str",value:function(e){return TC.decode(e)}},{key:"ab2obj",value:function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(n){return{}}}},{key:"str2ab",value:function(e){return IC.encode(e).buffer}},{key:"ab2b64str",value:(r=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new v_((function(e){var r=new FileReader;r.onload=function(){return e(r.result)},r.readAsDataURL(new Blob([t]))}));case 2:return r=e.sent,e.abrupt("return",r.split(",",2)[1]);case 4:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"b64str2ab",value:(t=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fetch("data:application/octet;base64,"+t).then((function(e){return e.arrayBuffer()})));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),e}();function OC(){var e="none";return wC()||(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 DC=function(){if("chrome-stable"===OC()){var e=window.navigator.userAgent.match(/Chrome\/([\d.]+)/);if(e&&e.length>1)if(Number(e[1].split(".")[0])<114)return!0}return!1}(),PC="mozilla"===OC(),NC="safari"===OC(),MC=0,LC=!wC()&&(null===(SC=navigator.userAgent.match(/version\/(\d+)/i))||void 0===SC?void 0:SC[1]);NC&&LC&&(MC=+LC);var UC=!wC()&&(null===(EC=navigator.userAgent.match(/Firefox\/(\d+)/i))||void 0===EC?void 0:EC[1]);PC&&UC&&(MC=+UC);var VC=MC,FC=MC,BC=!wC()&&!!/(iPhone|iPad|iPod)/i.exec(navigator.userAgent);!wC()&&/(iPhone|iPod)/i.exec(navigator.userAgent);var jC=!wC()&&(!!/(iPad)/i.exec(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&"ontouchend"in document),GC=!wC()&&/MicroMessenger/i.test(navigator.userAgent),HC=!wC()&&/Android/i.test(navigator.userAgent);!wC()&&$m(bC=navigator.userAgent.toLowerCase()).call(bC,"mobile");var zC=!wC()&&/chrome\/(86)|(87)|(88)|(89)|(90)|(91)|(92)/i.test(navigator.userAgent);function KC(){for(var e,t,r=(+HR(e=km(t="".concat(Math.random())).call(t,-7)).call(e,7,"0")).toString(2),n=HR(r).call(r,28,"1").split(""),i=[];n.length;)i.push(mk(n).call(n,0,7));return uy(i).call(i,(function(e,t){var r=t===i.length-1?"0":"1";return KR(r+e.join(""),2)}))}var XC=function(){return Math.floor(65535*Math.random())};function qC(e){return"string"==typeof e&&Kb(e).call(e,"__web__rtc__rtt__")>-1}function WC(e){return uy(e).call(e,(function e(t){var r;if(null!=t&&t._reportName)return t._reportName;if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var n,i,o=ArrayBuffer.isView(t)?t.buffer:t,a=o.byteLength,s=[];if(a>10){var c,u,d,l,h=new DataView(o),p=uy(c=Wk({length:5})).call(c,(function(e,t){return h.getUint8(t)})),f=uy(u=uy(d=Wk({length:5})).call(d,(function(e,t){return a-1-t})).reverse()).call(u,(function(e){return h.getUint8(e)}));s=xm(l=[]).call(l,Qk(p),["..."],Qk(f))}else s=Wk(new Uint8Array(o));return xm(n=xm(i="".concat(t.constructor.name,"(")).call(i,a,") [")).call(n,s.join(", "),"]")}if(t instanceof ImageData)return"ImageData";if(Array.isArray(t))return uy(t).call(t,e);if($m(r=["[object Object]","[object MediaStreamTrack]"]).call(r,Object.prototype.toString.call(t))){var v={};for(var _ in t)v[_]=e(t[_]);return v}return t}))}var YC=function(){var e=m_(Im.mark((function e(){var t,r,n,i=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],(r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),t&&(r.addTransceiver("audio",{direction:"sendonly"}),r.addTransceiver("video",{direction:"sendonly"})),e.next=8,r.createOffer();case 8:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),QC=function(e){return new v_((function(t,r){var n=(e=Array.isArray(e)?e:[]).length,i=[];0===n?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){n--,i.push(e),0===n&&r(i)}))}))}))};function JC(e){return+Math.max(-127,10*YR(Math.pow(e/255,2))).toFixed(2)}function ZC(e){return(e&Sd.AUDIO)===Sd.AUDIO}function $C(e){return(e&Sd.VIDEO)===Sd.VIDEO}function ew(e){var t={};return an(e).forEach((function(r){"object"===dy(e[r])?t[r]=ew(e[r]):dR(r).call(r,"_")||(t[r]=e[r])})),t}function tw(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var r={seiCount:0,seis:[]},n=!1,i=2;i<t.byteLength;){var o=t.getUint16(i);if(i+=2,t.byteLength-i<o){n=!0;break}var a=new Uint8Array(e.buffer,i,o);if(i+=o,t.byteLength-i>0&&t.byteLength-i<=2){n=!0;break}r.seiCount++,r.seis.push(a)}return n&&(r.seiCount=1,r.seis=[e]),r}function rw(e){return null==e?"undefined | null":"string"==typeof e?e:ny({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function nw(e){return void 0===e}function iw(e){return function(t,r,n){var i=n.value;n.value=function(){var t;console.warn(xm(t="[RTC WebSDK]: Api: ".concat(r," has been abandoned from version ")).call(t,e));for(var n=arguments.length,o=new Array(n),a=0;a<n;a++)o[a]=arguments[a];return i.apply(this,o)}}}function ow(e){console.warn("[RTC WebSDK]: "+e)}function aw(e){return"number"==typeof e?e:"number"==typeof(null==e?void 0:e.exact)?e.exact:"number"==typeof(null==e?void 0:e.ideal)?e.ideal:"number"==typeof(null==e?void 0:e.max)?e.max:"number"==typeof(null==e?void 0:e.min)?e.min:1}var sw=function(){function e(){Wd(this,e),sd(this,"_running",!1),sd(this,"_queue",[])}return qd(e,[{key:"add",value:function(e,t){this._queue.push([e,t]),this._running||(this._running=!0,this._process())}},{key:"_process",value:function(){var e=this,t=$T(this._queue.shift()||[],2),r=t[0],n=t[1];r&&n?r.then((function(t){n(t),e._process()})).catch((function(){e._process()})):this._running=!1}}]),e}();function cw(e){for(var t=atob(e),r=t.length,n=new Uint8Array(r),i=0;i<r;i++)n[i]=t.charCodeAt(i);return n}function uw(e){for(var t="",r=e.byteLength,n=0;n<r;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function dw(e,t,r){var n=lw(e),i=lw(t),o=lw(r);return function(e){for(var t=e.toString(_C),r=new Uint8Array(t.length/2),n=0;n<t.length;n+=2)r[n/2]=Dy(t.substr(n,2),16);return r}(cC.exports.encrypt(n,i,{iv:o,mode:yC,padding:kC}).ciphertext)}function lw(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|(e[r+1]||0)<<16|(e[r+2]||0)<<8|(e[r+3]||0));return sC.create(t,e.length)}function hw(e,t){if("boolean"!=typeof e)throw new pR(lR.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function pw(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(e<r||e>n||"number"!=typeof e){var i,o,a=new pR(lR.INVALID_PARAMS,xm(i=xm(o="Invalid ".concat(t,": the value range is [")).call(o,r,", ")).call(i,n,"]. integer only"));throw a}}function fw(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(null==e)throw new pR(lR.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!Sw(e,i,o))throw new pR(lR.INVALID_PARAMS,xm(r=xm(n="Invalid ".concat(t,": The value should be string type. Length of the string: [")).call(n,i,",")).call(r,o,"]"))}function vw(e,t,r){var n;if(!$m(r).call(r,e))throw new pR(lR.INVALID_PARAMS,xm(n="Invalid ".concat(t,": The value can only be set as ")).call(n,ny(r)))}function _w(e){if(!(e instanceof MediaStreamTrack))throw new pR(lR.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function mw(e,t){if(Ew(e))throw new pR(lR.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function yw(e,t){if(!(e instanceof ArrayBuffer))throw new pR(lR.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function gw(e){try{for(var t=navigator.mediaDevices.getSupportedConstraints(),r=0,n=an(e);r<n.length;r++){var i=n[r];t[i]||delete e[i]}}catch(o){}}function Sw(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.POSITIVE_INFINITY;return"string"==typeof e&&e.length<=r&&e.length>=t}function Ew(e){return null==e}function bw(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new pR(lR.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function kw(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new pR(lR.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function Tw(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new pR(lR.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function Iw(e){mw(e,"userInfo"),kw(e.userId),Ew(e.extraInfo)||fw(e.extraInfo,"userInfo.extraInfo",1,200)}function Aw(e){mw(e,"roomConfig"),hw(e.isAutoPublish,"roomConfig.isAutoPublish"),hw(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),hw(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo"),Ew(e.roomProfileType)||vw(e.roomProfileType,"roomConfig",[Dd.communication,Dd.chat,Dd.chatRoom,Dd.coHost,Dd.meeting,Dd.classRoom])}function Rw(e){mw(e,"videoPlayerOption")}function Cw(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64;if(!e||0===(null==e?void 0:e.byteLength))throw new pR(lR.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:xC.str2ab(ny(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new pR(lR.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function ww(e){var t;return!$m(t=[Kd.onRemoteStreamStats,Kd.onLocalStreamStats,Kd.onAudioVolumeIndication,Kd.onLocalAudioPropertiesReport,Kd.onRemoteAudioPropertiesReport]).call(t,e)}function xw(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new pR(lR.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}function Ow(e,t){if("number"!=typeof e||Number.isNaN(e)||!(e>=1)){var r=e;if(!(null!=r&&r.min||null!=r&&r.max||null!=r&&r.exact||null!=r&&r.ideal))throw new pR(lR.INVALID_PARAMS,"".concat(t," is not a valid ConstrainULong"))}}function Dw(e){var t,r=ZT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;pw(null==n?void 0:n.maxKbps,"maxKbps"),Ow(null==n?void 0:n.width,"width"),Ow(null==n?void 0:n.height,"height"),Ow(null==n?void 0:n.frameRate,"frameRate")}}catch(i){r.e(i)}finally{r.f()}}var Pw={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,n,o,a){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,o||e,a),c=r?r+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 n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?km(n).call(n,1):n);return xs?xm(i).call(i,xs(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,o=n.length,a=new Array(o);i<o;i++)a[i]=n[i].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,o,a){var s=r?r+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,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,o),!0;case 6:return d.fn.call(d.context,t,n,i,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,n);break;case 4:d[u].fn.call(d[u].context,t,n,i);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,r){return o(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return o(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var o=r?r+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||i&&!s.once||n&&s.context!==n||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&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=r?r+e:e,this._events[t]&&a(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(Pw);var Nw,Mw=Pw.exports,Lw=Us("Array").keys,Uw=vn,Vw=Ye,Fw=ae,Bw=Lw,jw=Array.prototype,Gw={DOMTokenList:!0,NodeList:!0},Hw=function(e){var t=e.keys;return e===jw||Fw(jw,e)&&t===jw.keys||Vw(Gw,Uw(e))?Bw:t},zw="@byted/ve-rtc",Kw="@byted/ve-rtc-cache-size",Xw=function(){function e(){Wd(this,e),sd(this,"storeKey",void 0),sd(this,"logLevel",void 0),sd(this,"LogfileSize",void 0),sd(this,"db",void 0),sd(this,"logId",void 0),sd(this,"cacheLog",void 0),sd(this,"cachedSize",void 0),sd(this,"preCacheTime",void 0),sd(this,"timer",void 0),sd(this,"_getSize",(function(e){return new Blob(e).size/1048576})),this.storeKey="",this.logId=1,this.cacheLog="",this.logLevel="none",this.LogfileSize=100,this._createStore()}return qd(e,[{key:"_createStore",value:function(){var e=this;if(!wC()&&window.indexedDB){var t=indexedDB.open("@byted/ve-rtc");t.onupgradeneeded=function(){t.result.createObjectStore(zw);try{localStorage.removeItem(Kw)}catch(gX){}},t.onerror=function(e){},t.onsuccess=function(){e.db=t.result,e._getCachedSize()}}}},{key:"_getCachedSize",value:function(){var e=this;try{var t=localStorage.getItem(Kw);if(t)this.cachedSize=+t;else nA(this).call(this).then((function(t){e.cachedSize=e._getSize(t),e._setCachedSize()}))}catch(gX){}}},{key:"_setCachedSize",value:function(){try{localStorage.setItem(Kw,"".concat(this.cachedSize))}catch(gX){}}},{key:"_getStore",value:function(e){if(this.db)return this.db.transaction(zw,e).objectStore(zw)}},{key:"set",value:function(e){var t=this;return new v_((function(r,n){if("none"===t.logLevel)return r();var i;if(e&&t.preCacheTime&&t.preCacheTime-Date.now()<1e3)return t.cacheLog+=xm(i="\n\n".concat(t.logId,": ")).call(i,e),t.logId++,t.timer||(t.timer=setTimeout((function(){t.set("")}),1e3-(t.preCacheTime-Date.now()))),r();clearTimeout(t.timer),t.timer=null;var o=t._getStore("readwrite");if(!o)return n("get store fail");t.cachedSize&&t.cachedSize>t.LogfileSize&&t.keyEarliest().then((function(e){t.get(e).then((function(r){t.del(e).then((function(){t.cachedSize=t.cachedSize-t._getSize(["".concat(r)]),t._setCachedSize()}))}))}));var a=o.get(t.storeKey);a.onsuccess=function(){try{var i,s,c,u,d,l=xm(i="".concat(a.result||"")).call(i,t.cacheLog),h=e?xm(s=xm(c="".concat(l?"\n\n":"")).call(c,t.logId,": ")).call(s,e):"";o.put(xm(u="".concat(l)).call(u,h),t.storeKey),e&&t.logId++,t.cacheLog="",t.cachedSize=(t.cachedSize||0)+t._getSize([xm(d="".concat(t.cacheLog)).call(d,h)]),t._setCachedSize(),t.preCacheTime=Date.now(),r()}catch(f){var p;if(!e)return n(f);t.cacheLog+=xm(p="\n\n".concat(t.logId,": ")).call(p,e),t.logId++,n(f)}},a.onerror=function(r){var i;if(!e)return n(r);t.cacheLog+=xm(i="\n\n".concat(t.logId,": ")).call(i,e),t.logId++,n(r)}}))}},{key:"get",value:function(e){var t=this;return new v_((function(r,n){var i=t._getStore("readonly");if(!i)return n();var o=i.get(e);o.onsuccess=function(){r(o.result)},o.onerror=function(e){n(e)}}))}},{key:"del",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.storeKey;return new v_((function(r,n){var i=e._getStore("readwrite");if(!i)return n();var o=i.delete(t);o.onsuccess=function(){return r(o.result)},o.onerror=function(e){return n(e)}}))}},{key:"keyEarliest",value:function(){return Hw(this).call(this).then((function(e){var t,r=Date.now();return e.forEach((function(e){if(e&&e.length){var n=e.split("-")[0];Number(n)<r&&(r=Number(n),t=e)}})),t}))}},{key:"keys",value:function(){var e=this;return new v_((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAllKeys){var i=n.getAllKeys();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var o=[];n.openCursor().onsuccess=function(){this.result&&(o.push(this.result.key),this.result.continue())},n.transaction.oncomplete=function(){return t(o)}}))}},{key:"values",value:function(){var e=this;return new v_((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAll){var i=n.getAll();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var o=[];n.openCursor().onsuccess=function(){this.result&&(o.push(this.result.value),this.result.continue())},n.transaction.oncomplete=function(){return t(o)}}))}},{key:"download",value:function(e){e=e||this.storeKey,this.get(e).then((function(t){var r=document.createElement("a");r.download="".concat(e,".txt"),r.href="data:text/paint;utf-8,"+(t||""),r.click()}))}}]),e}(),qw=new Xw,Ww="[VERTC]",Yw=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],Qw=!wC()&&$m(Nw=window.location.search).call(Nw,"_rtc_debug_"),Jw=function(){function e(t,r,n){Wd(this,e),sd(this,"_indent",void 0),sd(this,"_module",void 0),sd(this,"_id",void 0),this._module=t,this._indent=r}return qd(e,[{key:"print",value:function(e){for(var t,r,n,i,o,a,s,c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];var l=u.shift();try{var h,p,f,v,_,m=xm(h=[]).call(h,u),y="".concat(l).replace(/\%o/gi,(function(){var e=m.shift();return ny(e)}));qw.set(xm(p=xm(f=xm(v=xm(_="".concat(Ww,"[")).call(_,this._module,".")).call(v,e,"] ")).call(f,y," ")).call(p,uy(m).call(m,(function(e){return ny(e)})).join(", ")))}catch(gX){}if(Qw){for(var g="",S=0;S<this._indent;S++)g+=" ";(t=console).log.apply(t,xm(r=[xm(n=xm(i=xm(o=xm(a=xm(s="%c".concat(Zw(),"-")).call(s,Ww)).call(a,g,"[")).call(o,this._module,".")).call(i,e,"] ")).call(n,l),"color:".concat(Yw[this._indent],";")]).call(r,u))}}}]),e}(),Zw=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},$w=new Jw("VERTC",0),ex=function(e){DI(r,e);var t=YI(r);function r(){return Wd(this,r),t.apply(this,arguments)}return qd(r,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var n,i,o=arguments.length,a=new Array(o>1?o-1:0),s=1;s<o;s++)a[s-1]=arguments[s];return(n=xI(CI(r.prototype),"emit",this)).call.apply(n,xm(i=[this,e]).call(i,a))}catch(gX){return $w.print("safeEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,gX),console.error(gX),Boolean(t)}}}]),r}(Pw.exports.EventEmitter),tx=O,rx=tr,nx=$,ix=rI,ox=Qt,ax=R,sx=mc,cx=V;Rr({target:"Reflect",stat:!0,forced:i((function(){var e=function(){},t=ox.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}))},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=ax.f(rx(t),r);if(!c){if(nx(o=sx(t)))return e(o,r,n,s);c=cx(0)}if(ix(c)){if(!1===c.writable||!nx(s))return!1;if(i=ax.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,ox.f(s,r,i)}else ox.f(s,r,cx(0,n))}else{if(void 0===(a=c.set))return!1;tx(a,s,n)}return!0}});var ux=ee.Reflect.set,dx={};!function(e){var t="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 t=km(Array.prototype).call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==dy(n))throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(e[i]=n[i])}}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,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){var t,r,n,i,o,a;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(a=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,i),i+=o.length;return a}},i={arraySet:function(e,t,r,n,i){for(var o=0;o<n;o++)e[i+o]=t[r+o]},flattenChunks:function(e){return xm([]).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,i))},e.setTyped(t)}(dx);var lx={},hx={},px={},fx=dx;function vx(e){for(var t=e.length;--t>=0;)e[t]=0}var _x=256,mx=286,yx=30,gx=15,Sx=[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],Ex=[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],bx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],kx=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Tx=new Array(576);vx(Tx);var Ix=new Array(60);vx(Ix);var Ax=new Array(512);vx(Ax);var Rx=new Array(256);vx(Rx);var Cx=new Array(29);vx(Cx);var wx,xx,Ox,Dx=new Array(yx);function Px(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function Nx(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Mx(e){return e<256?Ax[e]:Ax[256+(e>>>7)]}function Lx(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function Ux(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,Lx(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function Vx(e,t,r){Ux(e,r[2*t],r[2*t+1])}function Fx(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function Bx(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=gx;n++)o[n]=a=a+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=Fx(o[s]++,s))}}function jx(e){var t;for(t=0;t<mx;t++)e.dyn_ltree[2*t]=0;for(t=0;t<yx;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 Gx(e){e.bi_valid>8?Lx(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 Hx(e,t,r,n){var i=2*t,o=2*r;return e[i]<e[o]||e[i]===e[o]&&n[t]<=n[r]}function zx(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&Hx(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Hx(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function Kx(e,t,r){var n,i,o,a,s=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===n?Vx(e,i,t):(Vx(e,(o=Rx[i])+_x+1,t),0!==(a=Sx[o])&&Ux(e,i-=Cx[o],a),Vx(e,o=Mx(--n),r),0!==(a=Ex[o])&&Ux(e,n-=Dx[o],a))}while(s<e.last_lit);Vx(e,256,t)}function Xx(e,t){var r,n,i,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,r=0;r<c;r++)0!==o[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):o[2*r+1]=0;for(;e.heap_len<2;)o[2*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=a[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)zx(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],zx(e,o,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,o[2*i]=o[2*r]+o[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,o[2*r+1]=o[2*n+1]=i,e.heap[1]=i++,zx(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,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,v=0;for(o=0;o<=gx;o++)e.bl_count[o]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(o=c[2*c[2*(n=e.heap[r])+1]+1]+1)>f&&(o=f,v++),c[2*n+1]=o,n>u||(e.bl_count[o]++,a=0,n>=p&&(a=h[n-p]),s=c[2*n],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*n+1]+a)));if(0!==v){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]--,v-=2}while(v>0);for(o=f;0!==o;o--)for(n=e.bl_count[o];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==o&&(e.opt_len+=(o-c[2*i+1])*c[2*i],c[2*i+1]=o),n--)}}(e,t),Bx(o,u,e.bl_count)}function qx(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=a,a=t[2*(n+1)+1],++s<c&&i===a||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==o&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4))}function Wx(e,t,r){var n,i,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),n=0;n<=r;n++)if(i=a,a=t[2*(n+1)+1],!(++s<c&&i===a)){if(s<u)do{Vx(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(Vx(e,i,e.bl_tree),s--),Vx(e,16,e.bl_tree),Ux(e,s-3,2)):s<=10?(Vx(e,17,e.bl_tree),Ux(e,s-3,3)):(Vx(e,18,e.bl_tree),Ux(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}vx(Dx);var Yx=!1;function Qx(e,t,r,n){Ux(e,0+(n?1:0),3),function(e,t,r,n){Gx(e),n&&(Lx(e,r),Lx(e,~r)),fx.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}px._tr_init=function(e){Yx||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(Cx[n]=r,e=0;e<1<<Sx[n];e++)Rx[r++]=n;for(Rx[r-1]=n,i=0,n=0;n<16;n++)for(Dx[n]=i,e=0;e<1<<Ex[n];e++)Ax[i++]=n;for(i>>=7;n<yx;n++)for(Dx[n]=i<<7,e=0;e<1<<Ex[n]-7;e++)Ax[256+i++]=n;for(t=0;t<=gx;t++)o[t]=0;for(e=0;e<=143;)Tx[2*e+1]=8,e++,o[8]++;for(;e<=255;)Tx[2*e+1]=9,e++,o[9]++;for(;e<=279;)Tx[2*e+1]=7,e++,o[7]++;for(;e<=287;)Tx[2*e+1]=8,e++,o[8]++;for(Bx(Tx,287,o),e=0;e<yx;e++)Ix[2*e+1]=5,Ix[2*e]=Fx(e,5);wx=new Px(Tx,Sx,257,mx,gx),xx=new Px(Ix,Ex,0,yx,gx),Ox=new Px(new Array(0),bx,0,19,7)}(),Yx=!0),e.l_desc=new Nx(e.dyn_ltree,wx),e.d_desc=new Nx(e.dyn_dtree,xx),e.bl_desc=new Nx(e.bl_tree,Ox),e.bi_buf=0,e.bi_valid=0,jx(e)},px._tr_stored_block=Qx,px._tr_flush_block=function(e,t,r,n){var i,o,a=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<_x;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),Xx(e,e.l_desc),Xx(e,e.d_desc),a=function(e){var t;for(qx(e,e.dyn_ltree,e.l_desc.max_code),qx(e,e.dyn_dtree,e.d_desc.max_code),Xx(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*kx[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=i&&(i=o)):i=o=r+5,r+4<=i&&-1!==t?Qx(e,t,r,n):4===e.strategy||o===i?(Ux(e,2+(n?1:0),3),Kx(e,Tx,Ix)):(Ux(e,4+(n?1:0),3),function(e,t,r,n){var i;for(Ux(e,t-257,5),Ux(e,r-1,5),Ux(e,n-4,4),i=0;i<n;i++)Ux(e,e.bl_tree[2*kx[i]+1],3);Wx(e,e.dyn_ltree,t-1),Wx(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Kx(e,e.dyn_ltree,e.dyn_dtree)),jx(e),n&&Gx(e)},px._tr_tally=function(e,t,r){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&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(Rx[r]+_x+1)]++,e.dyn_dtree[2*Mx(t)]++),e.last_lit===e.lit_bufsize-1},px._tr_align=function(e){Ux(e,2,3),Vx(e,256,Tx),function(e){16===e.bi_valid?(Lx(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 Jx=function(e,t,r,n){for(var i=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(i=i+t[n++]|0)|0}while(--a);i%=65521,o%=65521}return i|o<<16|0};var Zx=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var $x,eO=function(e,t,r,n){var i=Zx,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},tO={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"},rO=dx,nO=px,iO=Jx,oO=eO,aO=tO,sO=-2,cO=258,uO=262,dO=103,lO=113,hO=666;function pO(e,t){return e.msg=aO[t],t}function fO(e){return(e<<1)-(e>4?9:0)}function vO(e){for(var t=e.length;--t>=0;)e[t]=0}function _O(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(rO.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function mO(e,t){nO._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,_O(e.strm)}function yO(e,t){e.pending_buf[e.pending++]=t}function gO(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function SO(e,t){var r,n,i=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-uO?e.strstart-(e.w_size-uO):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+cO,p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+a]===f&&u[r+a-1]===p&&u[r]===u[o]&&u[++r]===u[o+1]){o+=2,r++;do{}while(u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&u[++o]===u[++r]&&o<h);if(n=cO-(h-o),o=h-cO,n>a){if(e.match_start=t,a=n,n>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=l[t&d])>c&&0!=--i);return a<=e.lookahead?a:e.lookahead}function EO(e){var t,r,n,i,o,a,s,c,u,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-uO)){rO.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=i,d=void 0,(d=a.avail_in)>u&&(d=u),r=0===d?0:(a.avail_in-=d,rO.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=iO(a.adler,s,d,c):2===a.state.wrap&&(a.adler=oO(a.adler,s,d,c)),a.next_in+=d,a.total_in+=d,d),e.lookahead+=r,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<uO&&0!==e.strm.avail_in)}function bO(e,t){for(var r,n;;){if(e.lookahead<uO){if(EO(e),e.lookahead<uO&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-uO&&(e.match_length=SO(e,r)),e.match_length>=3)if(n=nO._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,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=nO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(mO(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(mO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(mO(e,!1),0===e.strm.avail_out)?1:2}function kO(e,t){for(var r,n,i;;){if(e.lookahead<uO){if(EO(e),e.lookahead<uO&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-uO&&(e.match_length=SO(e,r),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){i=e.strstart+e.lookahead-3,n=nO._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<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(mO(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=nO._tr_tally(e,0,e.window[e.strstart-1]))&&mO(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=nO._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(mO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(mO(e,!1),0===e.strm.avail_out)?1:2}function TO(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function IO(){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 rO.Buf16(1146),this.dyn_dtree=new rO.Buf16(122),this.bl_tree=new rO.Buf16(78),vO(this.dyn_ltree),vO(this.dyn_dtree),vO(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new rO.Buf16(16),this.heap=new rO.Buf16(573),vO(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new rO.Buf16(573),vO(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 AO(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:lO,e.adler=2===t.wrap?0:1,t.last_flush=0,nO._tr_init(t),0):pO(e,sO)}function RO(e){var t,r=AO(e);return 0===r&&((t=e.state).window_size=2*t.w_size,vO(t.head),t.max_lazy_match=$x[t.level].max_lazy,t.good_match=$x[t.level].good_length,t.nice_match=$x[t.level].nice_length,t.max_chain_length=$x[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),r}function CO(e,t,r,n,i,o){if(!e)return sO;var a=1;if(-1===t&&(t=6),n<0?(a=0,n=-n):n>15&&(a=2,n-=16),i<1||i>9||8!==r||n<8||n>15||t<0||t>9||o<0||o>4)return pO(e,sO);8===n&&(n=9);var s=new IO;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new rO.Buf8(2*s.w_size),s.head=new rO.Buf16(s.hash_size),s.prev=new rO.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new rO.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=r,RO(e)}$x=[new TO(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(EO(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,mO(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-uO&&(mO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(mO(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(mO(e,!1),e.strm.avail_out),1)})),new TO(4,4,8,4,bO),new TO(4,5,16,8,bO),new TO(4,6,32,32,bO),new TO(4,4,16,16,kO),new TO(8,16,32,32,kO),new TO(8,16,128,128,kO),new TO(8,32,128,256,kO),new TO(32,128,258,1024,kO),new TO(32,258,258,4096,kO)],hx.deflateInit=function(e,t){return CO(e,t,8,15,8,0)},hx.deflateInit2=CO,hx.deflateReset=RO,hx.deflateResetKeep=AO,hx.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?sO:(e.state.gzhead=t,0):sO},hx.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?pO(e,sO):sO;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===hO&&4!==t)return pO(e,0===e.avail_out?-5:sO);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,yO(n,31),yO(n,139),yO(n,8),n.gzhead?(yO(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),yO(n,255&n.gzhead.time),yO(n,n.gzhead.time>>8&255),yO(n,n.gzhead.time>>16&255),yO(n,n.gzhead.time>>24&255),yO(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),yO(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(yO(n,255&n.gzhead.extra.length),yO(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=oO(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(yO(n,0),yO(n,0),yO(n,0),yO(n,0),yO(n,0),yO(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),yO(n,3),n.status=lO);else{var a=8+(n.w_bits-8<<4)<<8;a|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(a|=32),a+=31-a%31,n.status=lO,gO(n,a),0!==n.strstart&&(gO(n,e.adler>>>16),gO(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=oO(e.adler,n.pending_buf,n.pending-i,i)),_O(e),i=n.pending,n.pending!==n.pending_buf_size));)yO(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=oO(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=oO(e.adler,n.pending_buf,n.pending-i,i)),_O(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,yO(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=oO(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=oO(e.adler,n.pending_buf,n.pending-i,i)),_O(e),i=n.pending,n.pending===n.pending_buf_size)){o=1;break}o=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,yO(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=oO(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=dO)}else n.status=dO;if(n.status===dO&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&_O(e),n.pending+2<=n.pending_buf_size&&(yO(n,255&e.adler),yO(n,e.adler>>8&255),e.adler=0,n.status=lO)):n.status=lO),0!==n.pending){if(_O(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&fO(t)<=fO(r)&&4!==t)return pO(e,-5);if(n.status===hO&&0!==e.avail_in)return pO(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==hO){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(EO(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=nO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(mO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(mO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(mO(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,i,o,a=e.window;;){if(e.lookahead<=cO){if(EO(e),e.lookahead<=cO&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=a[i=e.strstart-1])===a[++i]&&n===a[++i]&&n===a[++i]){o=e.strstart+cO;do{}while(n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&n===a[++i]&&i<o);e.match_length=cO-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=nO._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=nO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(mO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(mO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(mO(e,!1),0===e.strm.avail_out)?1:2}(n,t):$x[n.level].func(n,t);if(3!==s&&4!==s||(n.status=hO),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?nO._tr_align(n):5!==t&&(nO._tr_stored_block(n,0,0,!1),3===t&&(vO(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),_O(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(yO(n,255&e.adler),yO(n,e.adler>>8&255),yO(n,e.adler>>16&255),yO(n,e.adler>>24&255),yO(n,255&e.total_in),yO(n,e.total_in>>8&255),yO(n,e.total_in>>16&255),yO(n,e.total_in>>24&255)):(gO(n,e.adler>>>16),gO(n,65535&e.adler)),_O(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},hx.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==dO&&t!==lO&&t!==hO?pO(e,sO):(e.state=null,t===lO?pO(e,-3):0):sO},hx.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return sO;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return sO;for(1===o&&(e.adler=iO(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(vO(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new rO.Buf8(r.w_size),rO.arraySet(u,t,d-r.w_size,r.w_size,0),t=u,d=r.w_size),a=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,EO(r);r.lookahead>=3;){n=r.strstart,i=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--i);r.strstart=n,r.lookahead=2,EO(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=a,r.wrap=o,0},hx.deflateInfo="pako deflate (from Nodeca project)";var wO={},xO=dx,OO=!0,DO=!0;try{String.fromCharCode.apply(null,[0])}catch(EX){OO=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(EX){DO=!1}for(var PO=new xO.Buf8(256),NO=0;NO<256;NO++)PO[NO]=NO>=252?6:NO>=248?5:NO>=240?4:NO>=224?3:NO>=192?2:1;function MO(e,t){if(t<65534&&(e.subarray&&DO||!e.subarray&&OO))return String.fromCharCode.apply(null,xO.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}PO[254]=PO[254]=1,wO.string2buf=function(e){var t,r,n,i,o,a=e.length,s=0;for(i=0;i<a;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new xO.Buf8(s),o=0,i=0;o<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<a&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[o++]=r:r<2048?(t[o++]=192|r>>>6,t[o++]=128|63&r):r<65536?(t[o++]=224|r>>>12,t[o++]=128|r>>>6&63,t[o++]=128|63&r):(t[o++]=240|r>>>18,t[o++]=128|r>>>12&63,t[o++]=128|r>>>6&63,t[o++]=128|63&r);return t},wO.buf2binstring=function(e){return MO(e,e.length)},wO.binstring2buf=function(e){for(var t=new xO.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},wO.buf2string=function(e,t){var r,n,i,o,a=t||e.length,s=new Array(2*a);for(n=0,r=0;r<a;)if((i=e[r++])<128)s[n++]=i;else if((o=PO[i])>4)s[n++]=65533,r+=o-1;else{for(i&=2===o?31:3===o?15:7;o>1&&r<a;)i=i<<6|63&e[r++],o--;o>1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return MO(s,n)},wO.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+PO[e[r]]>t?r:t};var LO=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},UO=hx,VO=dx,FO=wO,BO=tO,jO=LO,GO=Object.prototype.toString;function HO(e){if(!(this instanceof HO))return new HO(e);this.options=VO.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 jO,this.strm.avail_out=0;var r=UO.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(BO[r]);if(t.header&&UO.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?FO.string2buf(t.dictionary):"[object ArrayBuffer]"===GO.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=UO.deflateSetDictionary(this.strm,n)))throw new Error(BO[r]);this._dict_set=!0}}function zO(e,t){var r=new HO(t);if(r.push(e,!0),r.err)throw r.msg||BO[r.err];return r.result}HO.prototype.push=function(e,t){var r,n,i=this.strm,o=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=FO.string2buf(e):"[object ArrayBuffer]"===GO.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new VO.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=UO.deflate(i,n))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(FO.buf2binstring(VO.shrinkBuf(i.output,i.next_out))):this.onData(VO.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=UO.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},HO.prototype.onData=function(e){this.chunks.push(e)},HO.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=VO.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},lx.Deflate=HO,lx.deflate=zO,lx.deflateRaw=function(e,t){return(t=t||{}).raw=!0,zO(e,t)},lx.gzip=function(e,t){return(t=t||{}).gzip=!0,zO(e,t)};var KO={},XO=tr,qO=O,WO=Ye,YO=ae,QO=function(){var e=XO(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},JO=RegExp.prototype,ZO=ae,$O=function(e){var t=e.flags;return void 0!==t||"flags"in JO||WO(e,"flags")||!YO(JO,e)?t:qO(QO,e)},eD=RegExp.prototype,tD=function(e){return e===eD||ZO(eD,e)?$O(e):e.flags},rD={},nD=dx,iD=15,oD=[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],aD=[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],sD=[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],cD=[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],uD=dx,dD=Jx,lD=eO,hD=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A;r=e.state,n=e.next_in,I=e.input,i=n+(e.avail_in-5),o=e.next_out,A=e.output,a=o-(t-e.avail_out),s=o+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,p=r.hold,f=r.bits,v=r.lencode,_=r.distcode,m=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{f<15&&(p+=I[n++]<<f,f+=8,p+=I[n++]<<f,f+=8),g=v[p&m];t:for(;;){if(p>>>=S=g>>>24,f-=S,0===(S=g>>>16&255))A[o++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=v[(65535&g)+(p&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}E=65535&g,(S&=15)&&(f<S&&(p+=I[n++]<<f,f+=8),E+=p&(1<<S)-1,p>>>=S,f-=S),f<15&&(p+=I[n++]<<f,f+=8,p+=I[n++]<<f,f+=8),g=_[p&y];r:for(;;){if(p>>>=S=g>>>24,f-=S,!(16&(S=g>>>16&255))){if(0==(64&S)){g=_[(65535&g)+(p&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&g,f<(S&=15)&&(p+=I[n++]<<f,(f+=8)<S&&(p+=I[n++]<<f,f+=8)),(b+=p&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=S,f-=S,b>(S=o-a)){if((S=b-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=u-S,S<E){E-=S;do{A[o++]=h[k++]}while(--S);k=o-b,T=A}}else if(l<S){if(k+=u+l-S,(S-=l)<E){E-=S;do{A[o++]=h[k++]}while(--S);if(k=0,l<E){E-=S=l;do{A[o++]=h[k++]}while(--S);k=o-b,T=A}}}else if(k+=l-S,S<E){E-=S;do{A[o++]=h[k++]}while(--S);k=o-b,T=A}for(;E>2;)A[o++]=T[k++],A[o++]=T[k++],A[o++]=T[k++],E-=3;E&&(A[o++]=T[k++],E>1&&(A[o++]=T[k++]))}else{k=o-b;do{A[o++]=A[k++],A[o++]=A[k++],A[o++]=A[k++],E-=3}while(E>2);E&&(A[o++]=A[k++],E>1&&(A[o++]=A[k++]))}break}}break}}while(n<i&&o<s);n-=E=f>>3,p&=(1<<(f-=E<<3))-1,e.next_in=n,e.next_out=o,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=p,r.bits=f},pD=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,p,f,v,_,m=s.bits,y=0,g=0,S=0,E=0,b=0,k=0,T=0,I=0,A=0,R=0,C=null,w=0,x=new nD.Buf16(16),O=new nD.Buf16(16),D=null,P=0;for(y=0;y<=iD;y++)x[y]=0;for(g=0;g<n;g++)x[t[r+g]]++;for(b=m,E=iD;E>=1&&0===x[E];E--);if(b>E&&(b=E),0===E)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(S=1;S<E&&0===x[S];S++);for(b<S&&(b=S),I=1,y=1;y<=iD;y++)if(I<<=1,(I-=x[y])<0)return-1;if(I>0&&(0===e||1!==E))return-1;for(O[1]=0,y=1;y<iD;y++)O[y+1]=O[y]+x[y];for(g=0;g<n;g++)0!==t[r+g]&&(a[O[t[r+g]]++]=g);if(0===e?(C=D=a,p=19):1===e?(C=oD,w-=257,D=aD,P-=257,p=256):(C=sD,D=cD,p=-1),R=0,g=0,y=S,h=o,k=b,T=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){f=y-T,a[g]<p?(v=0,_=a[g]):a[g]>p?(v=D[P+a[g]],_=C[w+a[g]]):(v=96,_=0),c=1<<y-T,S=u=1<<k;do{i[h+(R>>T)+(u-=c)]=f<<24|v<<16|_|0}while(0!==u);for(c=1<<y-1;R&c;)c>>=1;if(0!==c?(R&=c-1,R+=c):R=0,g++,0==--x[y]){if(y===E)break;y=t[r+a[g]]}if(y>b&&(R&l)!==d){for(0===T&&(T=b),h+=S,I=1<<(k=y-T);k+T<E&&!((I-=x[k+T])<=0);)k++,I<<=1;if(A+=1<<k,1===e&&A>852||2===e&&A>592)return 1;i[d=R&l]=b<<24|k<<16|h-o|0}}return 0!==R&&(i[h+R]=y-T<<24|64<<16|0),s.bits=b,0},fD=-2,vD=12,_D=30;function mD(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function yD(){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 uD.Buf16(320),this.work=new uD.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function gD(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 uD.Buf32(852),t.distcode=t.distdyn=new uD.Buf32(592),t.sane=1,t.back=-1,0):fD}function SD(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,gD(e)):fD}function ED(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?fD:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,SD(e))):fD}function bD(e,t){var r,n;return e?(n=new yD,e.state=n,n.window=null,0!==(r=ED(e,t))&&(e.state=null),r):fD}var kD,TD,ID=!0;function AD(e){if(ID){var t;for(kD=new uD.Buf32(512),TD=new uD.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(pD(1,e.lens,0,288,kD,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;pD(2,e.lens,0,32,TD,0,e.work,{bits:5}),ID=!1}e.lencode=kD,e.lenbits=9,e.distcode=TD,e.distbits=5}function RD(e,t,r,n){var i,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new uD.Buf8(o.wsize)),n>=o.wsize?(uD.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((i=o.wsize-o.wnext)>n&&(i=n),uD.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(uD.arraySet(o.window,t,r-n,n,0),o.wnext=n,o.whave=o.wsize):(o.wnext+=i,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=i))),0}rD.inflateReset=SD,rD.inflateReset2=ED,rD.inflateResetKeep=gD,rD.inflateInit=function(e){return bD(e,15)},rD.inflateInit2=bD,rD.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A=0,R=new uD.Buf8(4),C=[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 fD;(r=e.state).mode===vD&&(r.mode=13),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,k=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,R[0]=255&u,R[1]=u>>>8&255,r.check=lD(r.check,R,2,0),u=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=_D;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=_D;break}if(d-=4,b=8+(15&(u>>>=4)),0===r.wbits)r.wbits=b;else if(b>r.wbits){e.msg="invalid window size",r.mode=_D;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:vD,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.flags=u,8!=(255&tD(r))){e.msg="unknown compression method",r.mode=_D;break}if(57344&tD(r)){e.msg="unknown header flags set",r.mode=_D;break}r.head&&(r.head.text=u>>8&1),512&tD(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=lD(r.check,R,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.time=u),512&tD(r)&&(R[0]=255&u,R[1]=u>>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,r.check=lD(r.check,R,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&tD(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=lD(r.check,R,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&tD(r)){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&tD(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=lD(r.check,R,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&tD(r)&&((p=r.length)>s&&(p=s),p&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),uD.arraySet(r.head.extra,n,o,p,b)),512&tD(r)&&(r.check=lD(r.check,n,p,o)),s-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&tD(r)){if(0===s)break e;p=0;do{b=n[o+p++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&tD(r)&&(r.check=lD(r.check,n,p,o)),s-=p,o+=p,b)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&tD(r)){if(0===s)break e;p=0;do{b=n[o+p++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&tD(r)&&(r.check=lD(r.check,n,p,o)),s-=p,o+=p,b)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&tD(r)){for(;d<16;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=_D;break}u=0,d=0}r.head&&(r.head.hcrc=tD(r)>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=vD;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=mD(u),u=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,2;e.adler=r.check=1,r.mode=vD;case vD:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(AD(r),r.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=_D}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=_D;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;uD.arraySet(i,n,o,p,a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=vD;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=_D;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.lens[C[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[C[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},k=pD(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=_D;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,y=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(y<16)u>>>=_,d-=_,r.lens[r.have++]=y;else{if(16===y){for(I=_+2;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=_,d-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=_D;break}b=r.lens[r.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===y){for(I=_+3;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,b=0,p=3+(7&(u>>>=_)),u>>>=3,d-=3}else{for(I=_+7;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=_,b=0,p=11+(127&(u>>>=_)),u>>>=7,d-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=_D;break}for(;p--;)r.lens[r.have++]=b}}if(r.mode===_D)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=_D;break}if(r.lenbits=9,T={bits:r.lenbits},k=pD(1,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid literal/lengths set",r.mode=_D;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=pD(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,k){e.msg="invalid distances set",r.mode=_D;break}if(r.mode=20,6===t)break e;case 20:r.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,r.hold=u,r.bits=d,hD(e,h),a=e.next_out,i=e.output,c=e.avail_out,o=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===vD&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,y=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(g=_,S=m,E=y;m=(A=r.lencode[E+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&A,!(g+(_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=_,d-=_,r.back+=_,r.length=y,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=vD;break}if(64&m){e.msg="invalid literal/length code",r.mode=_D;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<<r.distbits)-1])>>>16&255,y=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(g=_,S=m,E=y;m=(A=r.distcode[E+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&A,!(g+(_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=_,d-=_,r.back+=_,64&m){e.msg="invalid distance code",r.mode=_D;break}r.offset=y,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=_D;break}r.mode=25;case 25:if(0===c)break e;if(p=h-c,r.offset>p){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=_D;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),v=r.window}else v=i,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{i[a++]=v[f++]}while(--p);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=tD(r)?lD(r.check,i,h,a-h):dD(r.check,i,h,a-h)),h=c,(tD(r)?u:mD(u))!==r.check){e.msg="incorrect data check",r.mode=_D;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&tD(r)){for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=_D;break}u=0,d=0}r.mode=29;case 29:k=1;break e;case _D:k=-3;break e;case 31:return-4;default:return fD}return e.next_out=a,e.avail_out=c,e.next_in=o,e.avail_in=s,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<_D&&(r.mode<27||4!==t))&&RD(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,r.wrap&&h&&(e.adler=r.check=tD(r)?lD(r.check,i,h,e.next_out-h):dD(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===vD?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},rD.inflateEnd=function(e){if(!e||!e.state)return fD;var t=e.state;return t.window&&(t.window=null),e.state=null,0},rD.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?fD:(r.head=t,t.done=!1,0):fD},rD.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?fD:11===r.mode&&dD(1,t,n,0)!==r.check?-3:RD(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):fD},rD.inflateInfo="pako inflate (from Nodeca project)";var CD={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 wD=rD,xD=dx,OD=wO,DD=CD,PD=tO,ND=LO,MD=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},LD=Object.prototype.toString;function UD(e){if(!(this instanceof UD))return new UD(e);this.options=xD.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 ND,this.strm.avail_out=0;var r=wD.inflateInit2(this.strm,t.windowBits);if(r!==DD.Z_OK)throw new Error(PD[r]);if(this.header=new MD,wD.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=OD.string2buf(t.dictionary):"[object ArrayBuffer]"===LD.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=wD.inflateSetDictionary(this.strm,t.dictionary))!==DD.Z_OK))throw new Error(PD[r])}function VD(e,t){var r=new UD(t);if(r.push(e,!0),r.err)throw r.msg||PD[r.err];return r.result}UD.prototype.push=function(e,t){var r,n,i,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?DD.Z_FINISH:DD.Z_NO_FLUSH,"string"==typeof e?s.input=OD.binstring2buf(e):"[object ArrayBuffer]"===LD.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 xD.Buf8(c),s.next_out=0,s.avail_out=c),(r=wD.inflate(s,DD.Z_NO_FLUSH))===DD.Z_NEED_DICT&&u&&(r=wD.inflateSetDictionary(this.strm,u)),r===DD.Z_BUF_ERROR&&!0===d&&(r=DD.Z_OK,d=!1),r!==DD.Z_STREAM_END&&r!==DD.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==DD.Z_STREAM_END&&(0!==s.avail_in||n!==DD.Z_FINISH&&n!==DD.Z_SYNC_FLUSH)||("string"===this.options.to?(i=OD.utf8border(s.output,s.next_out),o=s.next_out-i,a=OD.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&xD.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(xD.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)&&r!==DD.Z_STREAM_END);return r===DD.Z_STREAM_END&&(n=DD.Z_FINISH),n===DD.Z_FINISH?(r=wD.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===DD.Z_OK):n!==DD.Z_SYNC_FLUSH||(this.onEnd(DD.Z_OK),s.avail_out=0,!0)},UD.prototype.onData=function(e){this.chunks.push(e)},UD.prototype.onEnd=function(e){e===DD.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=xD.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},KO.Inflate=UD,KO.inflate=VD,KO.inflateRaw=function(e,t){return(t=t||{}).raw=!0,VD(e,t)},KO.ungzip=VD;var FD={};(0,dx.assign)(FD,lx,KO,CD);var BD=FD,jD="BytePlusRTC",GD=function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},HD=function(){function e(t){Wd(this,e),sd(this,"storeName",void 0),sd(this,"pendingList",[]),this.storeName=t,!wC()&&GD()&&this._checkAndCreateStore(t)}var t,r;return qd(e,[{key:"_checkAndCreateStore",value:function(t,r){var n=this;e.db&&e.db.close();var i=r?GD().open(jD,r):GD().open(jD);i.onupgradeneeded=function(){i.result.createObjectStore(t)},i.onerror=function(e){console.error("IndexedDBInterface error",i.error)},i.onsuccess=function(){var r=i.result;e.db=r;try{e.db.transaction(n.storeName,"readonly"),n.pendingList.forEach(function(){var e=m_(Im.mark((function e(t){var r,i,o,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.txMode,i=t.resolve,o=t.reject,e.prev=1,e.next=4,n._getStore(r);case 4:a=e.sent,i(a),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),o();case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}())}catch(o){n._checkAndCreateStore(t,r.version+1)}}}},{key:"_getStore",value:function(t){var r=this;return new v_((function(n,i){e.db?n(e.db.transaction(r.storeName,t).objectStore(r.storeName)):r.pendingList.push({txMode:t,resolve:n,reject:i})}))}},{key:"put",value:(r=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readwrite");case 2:return n=e.sent,e.abrupt("return",new v_((function(e,i){var o=n.put(t,r);o.onsuccess=function(){e()},o.onerror=function(e){i(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"get",value:(t=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readonly");case 2:return r=e.sent,e.abrupt("return",new v_((function(e,n){var i=r.get(t);i.onsuccess=function(){e(i.result)},i.onerror=function(e){n(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}();sd(HD,"db",void 0),sd(HD,"state","init");var zD=function(e){return e.RTC="rtc",e}(zD||{}),KD=function(e){return e.W_5="5",e}(KD||{}),XD=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(XD||{}),qD=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(qD||{}),WD=function(e){return 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",e}(WD||{}),YD=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(YD||{}),QD=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(QD||{}),JD=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(JD||{}),ZD=function(e){return 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",e}(ZD||{}),$D=function(e){return 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",e}($D||{}),eP=function(e){return 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",e}(eP||{}),tP=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(tP||{}),rP=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(rP||{}),nP=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(nP||{}),iP=function(e){return e.W_0="0",e.W_1="1",e}(iP||{}),oP=function(e){return e.UP="up",e.DOWN="down",e}(oP||{}),aP=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(aP||{}),sP=function(e){return e.UP="up",e.DOWN="down",e}(sP||{}),cP=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(cP||{}),uP=function(e){return e.W_0="0",e.W_1="1",e}(uP||{}),dP=function(e){return 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",e}(dP||{}),lP=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(lP||{}),hP=function(e){return 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",e}(hP||{}),pP=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(pP||{}),fP=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(fP||{}),vP=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(vP||{}),_P=function(e){return 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",e}(_P||{}),mP=function(e){return 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",e}(mP||{}),yP=function(e){return e.BEGIN="begin",e.END="end",e}(yP||{}),gP=function(e){return e.BEGIN="begin",e.END="end",e}(gP||{}),SP=function(e){return 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",e}(SP||{}),EP=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(EP||{}),bP=function(e){return e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped",e}(bP||{}),kP=function(e){return 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",e}(kP||{}),TP=function(){function e(t){Wd(this,e),sd(this,"_event_key",void 0),sd(this,"_device_id",void 0),sd(this,"_rtc_app_id",void 0),sd(this,"_product_line",void 0),sd(this,"_report_version",void 0),sd(this,"_os",void 0),sd(this,"_rtc_sdk_version",void 0),sd(this,"_rtc_timestamp",void 0),sd(this,"_rtc_sdk_git_commit",void 0),sd(this,"_report_id",void 0),sd(this,"_connection_id",void 0),sd(this,"_rtc_sid",void 0),sd(this,"_engine_session_id",void 0),sd(this,"_rtc_business_id",void 0),sd(this,"_app_state",void 0),sd(this,"_project_key",void 0),sd(this,"_network_type",void 0),sd(this,"_app_version",void 0),sd(this,"_aid",void 0),sd(this,"_device_model",void 0),sd(this,"_device_brand",void 0),sd(this,"_common_extra_info",void 0),sd(this,"_had_selected_p2p",void 0),sd(this,"_rtc_env_type",void 0),sd(this,"_room_id",void 0),sd(this,"_user_id",void 0),sd(this,"_rtc_session_id",void 0),sd(this,"_user_agent",void 0),sd(this,"_auto_play_policy",void 0),sd(this,"_platform",void 0),sd(this,"_product",void 0),sd(this,"_log_cache_key",void 0),sd(this,"_overSea","0"),this.monitor=t}return qd(e,[{key:"setStats",value:function(e){var t=this;an(e).forEach((function(r){t["_"+r]=e[r]})),this.monitor.StartUp()}},{key:"event_key",get:function(){return this._event_key}},{key:"device_id",get:function(){return this._device_id}},{key:"rtc_app_id",get:function(){return this._rtc_app_id}},{key:"product_line",get:function(){return this._product_line}},{key:"report_version",get:function(){return this._report_version}},{key:"os",get:function(){return this._os}},{key:"rtc_sdk_version",get:function(){return this._rtc_sdk_version}},{key:"rtc_timestamp",get:function(){return this._rtc_timestamp}},{key:"rtc_sdk_git_commit",get:function(){return this._rtc_sdk_git_commit}},{key:"report_id",get:function(){return this._report_id}},{key:"connection_id",get:function(){return this._connection_id}},{key:"rtc_sid",get:function(){return this._rtc_sid}},{key:"engine_session_id",get:function(){return this._engine_session_id}},{key:"rtc_business_id",get:function(){return this._rtc_business_id}},{key:"app_state",get:function(){return this._app_state}},{key:"project_key",get:function(){return this._project_key}},{key:"network_type",get:function(){return this._network_type}},{key:"app_version",get:function(){return this._app_version}},{key:"aid",get:function(){return this._aid}},{key:"device_model",get:function(){return this._device_model}},{key:"device_brand",get:function(){return this._device_brand}},{key:"common_extra_info",get:function(){return this._common_extra_info}},{key:"had_selected_p2p",get:function(){return this._had_selected_p2p}},{key:"rtc_env_type",get:function(){return this._rtc_env_type}},{key:"room_id",get:function(){return this._room_id}},{key:"user_id",get:function(){return this._user_id}},{key:"rtc_session_id",get:function(){return this._rtc_session_id}},{key:"user_agent",get:function(){return this._user_agent}},{key:"auto_play_policy",get:function(){return this._auto_play_policy}},{key:"platform",get:function(){return this._platform||"web"}},{key:"product",get:function(){return this._product||"webrtc"}},{key:"log_cache_key",get:function(){return this._log_cache_key}},{key:"overSea",get:function(){return this._overSea}}]),e}(),IP="ReportErrorBuffer",AP=function(){function e(){Wd(this,e),sd(this,"_buffer",new HD(IP))}var t,r;return qd(e,[{key:"set",value:(r=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._buffer.put(t,IP);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"get",value:(t=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.prev=1,e.next=4,this._buffer.get(IP);case 4:t=e.sent,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(){return t.apply(this,arguments)})}]),e}(),RP=function(e){DI(n,e);var t,r=YI(n);function n(){var e;return Wd(this,n),sd(eI(e=r.call(this)),"report_id",void 0),sd(eI(e),"report_common",void 0),sd(eI(e),"modify_ids",void 0),sd(eI(e),"dataBuffer",void 0),sd(eI(e),"posting",void 0),sd(eI(e),"sucSendTimer",void 0),sd(eI(e),"preSucTime",void 0),sd(eI(e),"errSendTimer",void 0),sd(eI(e),"errSendDelay",void 0),sd(eI(e),"errSendBuffer",void 0),sd(eI(e),"commonStats",void 0),sd(eI(e),"_retryCount",0),e.report_id=0,e.dataBuffer=[],e.posting=!1,e.report_common={},e.modify_ids={},e.preSucTime=0,e.errSendDelay=100,e.commonStats=new TP(eI(e)),wC()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return qd(n,[{key:"push",value: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()))}},{key:"enableErrorBuffer",value:function(){this.errSendBuffer=new AP,this.loadErrorBuffer()}},{key:"unshift",value:function(e){this.dataBuffer=xm(e).call(e,this.dataBuffer)}},{key:"send",value:function(e,t){var r,n,i=this;if(e||this.dataBuffer.length){var o={data:e||mk(r=this.dataBuffer).call(r,0,4e3),header:ud(ud({},this.report_common),{},{http_retry_count:this._retryCount}),from:"web",os:"web",version:"1"},a=new XMLHttpRequest;a.timeout=1e4,a.onreadystatechange=function(){if(4===a.readyState){var r,n,s,c,u;if(e||(i.posting=!1),200===a.status||304===a.status)try{r=JSON.parse(a.responseText)}catch(gX){n=gX}if(r&&0===r.StatusCode){if(!e&&!t)!wC()&&$m(s=location.search).call(s,"_rtc_autotest_")&&i.safeEmit("report_event",o),null===(c=i.errSendBuffer)||void 0===c||c.set([]),i.sucSend()}else if(setTimeout((function(){var e,t;i.rtcError(xm(e="reportor error, res:".concat(null===(t=r)||void 0===t?void 0:t.toString()," err:")).call(e,n),a.status,n)}),0),e)i.send(e);else i.unshift(o.data),null===(u=i.errSendBuffer)||void 0===u||u.set(Qk(i.dataBuffer)),t?i.send():i.errSend()}};var s=eN.LOG_SERVER_URL;if(a.open("POST",s,!0),e||(this.posting=!0),!wC()&&$m(n=location.search).call(n,"_rtc_debug_"))a.send(ny(o));else{var c=BD.gzip(ny(o));a.setRequestHeader("Content-Encoding","gzip"),a.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),a.send(c)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this._retryCount=0,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)}},{key:"errSend",value:function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2,this._retryCount++}},{key:"loadErrorBuffer",value:(t=m_(Im.mark((function e(){var t,r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this.errSendBuffer)||void 0===r?void 0:r.get();case 2:if(e.t1=t=e.sent,e.t0=null!==e.t1,!e.t0){e.next=6;break}e.t0=void 0!==t;case 6:if(!e.t0){e.next=10;break}e.t2=t,e.next=11;break;case 10:e.t2=[];case 11:e.t2.forEach((function(e){n.push(e)}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"StartUp",value:function(){var e=this.report_common,t=this.commonStats,r=t.event_key,n=t.device_id,i=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,v=t.project_key,_=t.network_type,m=t.app_version,y=t.aid,g=t.device_model,S=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,k=t.rtc_env_type,T=t.user_agent,I=t.auto_play_policy,A=t.platform,R=t.product,C=t.log_cache_key,w=t.overSea;JE(e,{event_key:r,device_id:n,rtc_app_id:i,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:v,network_type:_,app_version:m,aid:y,device_model:g,device_brand:S,common_extra_info:E,had_selected_p2p:b,rtc_env_type:k,user_agent:T,auto_play_policy:I,platform:A,product:R,log_cache_key:C,extra_is_oversea:w}),this.modify_ids.room_id=this.commonStats.room_id,this.modify_ids.user_id=this.commonStats.user_id,this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id,this.modify_ids.connection_id=this.commonStats.connection_id,this.modify_ids.app_state=this.commonStats.app_state}},{key:"rtcSdkApiCall",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:ny(n)});n.streamId&&(i.stream_id=n.streamId),this.push(i)}},{key:"rtcSdkCallback",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtcGetConfig",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=ud(ud({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:n,type:i,config_id:o,enable_cloud_proxy:a},this.modify_ids),{},{common_extra_info:ny(s)});this.push(c)}},{key:"rtcReconnect",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},this.modify_ids),{},{common_extra_info:ny(i)});this.push(o)}},{key:"rtcReconnected",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcGetAccess",value:function(e,t,r,n,i,o){var a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},s=ud(ud({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:i,connect_session_id:o},this.modify_ids),{},{common_extra_info:ny(a)});this.push(s)}},{key:"rtcPreIceState",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{},{connection_id:r,common_extra_info:ny(n)});this.push(i)}},{key:"rtcNodeChange",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtcSignalingMsgError",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtcSignaling",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=ud(ud({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,stream_id:i,stream_user_id:o,direction:a},this.modify_ids),{},{common_extra_info:ny(s)});this.push(c)}},{key:"rtcJoinRoom",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},this.modify_ids),{},{common_extra_info:ny(i)});this.push(o)}},{key:"rtcLeaveRoom",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtcBeginCreateOffer",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtcCreateOffer",value:function(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=ud(ud({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:n,elapse:i},this.modify_ids),{},{common_extra_info:ny(o)});this.push(a)}},{key:"rtcSetDescription",value:function(e,t,r,n,i,o,a,s){var c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:{},u=ud(ud({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:i,stream_user_id:o,elapse:a},this.modify_ids),{},{connection_id:s,common_extra_info:ny(c)});this.push(u)}},{key:"rtcRecvAnswer",value:function(e,t,r,n,i,o,a){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=ud(ud({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:n,direction:i,stream_id:o,stream_user_id:a},this.modify_ids),{},{common_extra_info:ny(s)});this.push(c)}},{key:"firstRemoteAudioRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:ny(r)});this.push(n)}},{key:"firstRemoteVideoRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:ny(r)});this.push(n)}},{key:"rtcPublishStat",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},this.modify_ids),{},{common_extra_info:ny(i)});this.push(o)}},{key:"rtcSubscribeStat",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},this.modify_ids),{},{common_extra_info:ny(i)});this.push(o)}},{key:"rtcAudioDevice",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtcMediaStatistics",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcMessageStatistics",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({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:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtsMessageReport",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud(ud({event_key:"rts_message",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:ny(t)});this.push(r)}},{key:"rtcError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcInvokeStatus",value:function(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"",s=ud(ud({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:n,elapse:i},this.modify_ids),{},{connection_id:a,common_extra_info:ny(o),direction:o.direction});this.push(s)}},{key:"rtcFirstFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud(ud({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:ny(t)});this.push(r)}},{key:"rtcMuteRemote",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:ny(r)});this.push(n)}},{key:"sdkInitEngine",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"joinRoom",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},o=ud(ud({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},this.modify_ids),{},{common_extra_info:ny(i)});this.push(o)}},{key:"p2pConnectionStatus",value:function(e,t,r,n,i){var o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},a=ud(ud({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:n,elapse:i},this.modify_ids),{},{common_extra_info:ny(o)});this.push(a)}},{key:"p2pConnectClosed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{},{common_extra_info:ny(t)});this.push(r)}},{key:"rtcDeviceError",value:function(e,t,r,n,i,o,a,s,c,u,d,l,h,p,f,v){var _=arguments.length>16&&void 0!==arguments[16]?arguments[16]:{},m=ud(ud({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:n,system_api:i,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:v},this.modify_ids),{},{common_extra_info:ny(_)});this.push(m)}},{key:"rtcVideoDevice",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:ny(r)});this.push(n)}},{key:"rtcVideoCaptureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud(ud({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:ny(t)});this.push(r)}},{key:"rtcEncodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcFirstFrameEncoded",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcSendFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcRecvFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcRecvFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcDecodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}}]),n}(ex),CP=new RP,wP=new RP,xP=new RP,OP=CP.commonStats,DP=wP.commonStats,PP=xP.commonStats;function NP(e){OP.setStats({app_state:e}),DP.setStats({app_state:e}),PP.setStats({app_state:e})}!wC()&&(NP("active"),document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?NP("active"):"hidden"===document.visibilityState&&NP("background")})));var MP={default:CP,rtm:wP,outsideRoom:xP},LP=function(e,t,r){CP.rtcSdkApiCall(e,t,r)},UP=function(e,t,r){CP.rtcSdkCallback(e,t,r)};function VP(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(t,n,i){if("function"==typeof i.value){var o=i.value;i.value=function(){for(var t=arguments.length,i=new Array(t),a=0;a<t;a++)i[a]=arguments[a];var s={};r.forEach((function(e,t){s[e]=i[t]})),"joinRoom"===n&&OP.setStats({room_id:i[1]}),MP[e].rtcSdkApiCall(n,0,ny(WC(i)),s);var c=o.apply(this,i);return"function"==typeof(null==c?void 0:c.then)?c.then((function(t){return MP[e].rtcSdkCallback(n,0,ny(WC([t||{}]))),t})).catch((function(t){throw MP[e].rtcSdkCallback(n,t.code,ny(t.message)),t})):(MP[e].rtcSdkCallback(n,0,ny(WC([c||{}]))),c)}}}}function FP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===Kd.onUserMessageReceivedOutsideRoom||e===Kd.onUserBinaryMessageReceivedOutsideRoom;(n?wP:CP).rtcSdkCallback(e,r,ny(t))}function BP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};(n?wP:CP).rtcInvokeStatus(ny(t),r,e,"",0,o,i)}var jP="BytePlus",GP="RTC_DEVICE_ID",HP="RTC_ACCESS_NODE",zP="RTC_ACCESS_URLS",KP="ENGINE_WEB_CONFIG",XP="SERVER_CONFIG",qP=function(){function e(){Wd(this,e)}return qd(e,[{key:"get",value:function(e){var t=localStorage.getItem(e);if(!t)return null;try{var r=JSON.parse(t);return r.ttl>0&&Date.now()-r.saveTime>r.ttl?(this.delete(e),null):r.message}catch(n){return null}}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,ny(n)),!0}catch(i){return!1}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(t){return!1}}}]),e}(),WP=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,o))),"_accessVersion","v2"),n}return qd(r,[{key:"getDeviceId",value:function(){if(wC())return"";var e=this.get(GP);return e&&!/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(e)||(e=function(e){for(var t="",r=0;r<e;r++)t+=Math.floor(10*Math.random());return t}(30)),this.setDeviceId(e),e}},{key:"setDeviceId",value:function(e){return[OP,DP,PP].forEach((function(t){return t.setStats({device_id:e})})),this.set(GP,e),e}},{key:"getAccessNode",value:function(e){var t,r,n;return this.get(xm(t=xm(r=xm(n="".concat(HP,"_")).call(n,e,"-")).call(r,jP,"-")).call(t,this._accessVersion))}},{key:"setAccessNode",value:function(e,t,r){var n,i,o;return this.set(xm(n=xm(i=xm(o="".concat(HP,"_")).call(o,e,"-")).call(i,jP,"-")).call(n,this._accessVersion),t,1e3*r)}},{key:"clearAccessNode",value:function(e){var t,r;this.delete(xm(t=xm(r="".concat(HP,"_")).call(r,e,"-")).call(t,jP))}},{key:"getAccessUrls",value:function(){var e;return this.get(xm(e="".concat(zP,"-")).call(e,jP))}},{key:"setAccessUrls",value:function(e){var t,r=uy(e).call(e,(function(e){var t,r=e.host,n=e.path;return xm(t="https://".concat(r)).call(t,n)}));return this.set(xm(t="".concat(zP,"-")).call(t,jP),r)}},{key:"clearAccessUrls",value:function(){var e;this.delete(xm(e="".concat(zP,"-")).call(e,jP))}},{key:"getEngineWebConfig",value:function(e,t){var r,n,i,o=xm(r=xm(n="".concat(e,"_")).call(n,t,"_")).call(r,this.getDeviceId()),a=this.get(KP);return(null==a||null===(i=Nb(a).call(a,(function(e){return e.key===o})))||void 0===i?void 0:i.config)||{}}},{key:"setEngineWebConfig",value:function(e,t,r){var n,i;if(r){var o=xm(n=xm(i="".concat(e,"_")).call(i,t,"_")).call(n,this.getDeviceId()),a=this.get(KP)||[];return(a=Gs(a).call(a,(function(e){return e.key!==o}))).push({key:o,config:r}),this.set(KP,km(a).call(a,-5))}}},{key:"getServerConfig",value:function(e){var t,r="".concat(e),n=this.get(XP);return(null==n||null===(t=Nb(n).call(n,(function(e){return e.key===r})))||void 0===t?void 0:t.config)||{}}},{key:"setServerConfig",value:function(e,t){if(t){var r="".concat(e),n=this.get(XP)||[];return(n=Gs(n).call(n,(function(e){return e.key!==r}))).push({key:r,config:t}),this.set(XP,km(n).call(n,-5))}}}]),r}(qP),YP=new WP,QP="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function JP(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var ZP="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",$P="rtc.rtcplus.com".split(","),eN={VERSION:"4.51.10",ICE_CONFIG_REQUEST_URLS_INTERNAL:uy(QP).call(QP,JP),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:ZP,CONFIG_REQUEST_DOMAINS:$P,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:"",CONNECTION_MODE:Fd.AUTO,AUDIO_STALL:!0,VIDEO_STALL:!0,STATS_SCALLBACK_SUPPORT:!0,ENABLE_REPORT_ERROR_BUFFER:!1,ENABLE_FALLBACK_HANDLER:!1};function tN(e,t){var r;if(CP.rtcSdkApiCall("setParameter",0,xm(r="key: ".concat(e,", value: ")).call(r,t)),"VERSION"!==e){if("ICE_CONFIG_REQUEST_URLS"===e)return"string"==typeof t&&(t=[t]),void(eN.ICE_CONFIG_REQUEST_URLS=uy(t).call(t,JP));if("PLATFORM"!==e||"string"!=typeof t)if("PRODUCT"!==e||"string"!=typeof t)if("LOG_SERVER_URL"!==e||t!==Td.overseas)if("LOG_SERVER_URL"!==e||t!==Td.domestic)if("LOG_SERVER_URL"!==e||"string"!=typeof t){if("OVERSEA"===e)return OP.setStats({overSea:t?"1":"0"}),void(eN.OVERSEA=t);"DEVICE_ID"===e&&YP.setDeviceId(t),"ENABLE_REPORT_ERROR_BUFFER"===e&&t&&CP.enableErrorBuffer(),eN[e]=t}else eN.LOG_SERVER_URL=t;else eN.LOG_SERVER_URL=ZP;else eN.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/";else OP.setStats({product:t});else OP.setStats({platform:t})}}function rN(e){return"DEVICE_ID"===e?YP.getDeviceId():eN[e]}function nN(e,t,r){var n,i,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(n=r.video)||void 0===n?void 0:n.fps)||15,bitrate:1e3*((null===(i=r.video)||void 0===i?void 0:i.kBitRate)||40),width:(null===(o=r.video)||void 0===o?void 0:o.width)||640,height:(null===(a=r.video)||void 0===a?void 0:a.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||Rd.PREV_FRAME,canvas:{bgColor:(null===(c=r.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=r.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(d=r.layout)||void 0===d||null===(l=d.regions)||void 0===l?void 0:uy(l).call(l,(function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:!e.alpha||+e.alpha>1||+e.alpha<=0?1:+e.alpha,x:!e.x||+e.x>=1||+e.x<0?0:+e.x,y:!e.y||+e.y>=1||+e.y<0?0:+e.y,w:!e.w||+e.w>1||+e.w<=0?1:+e.w,h:!e.h||+e.h>1||+e.h<=0?1:+e.h,zorder:!e.zorder||+e.zorder<0||+e.zorder>100?0:+e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var iN={width:640,height:480,frameRate:15,maxKbps:600},oN={width:1920,height:1080,frameRate:15,maxKbps:3e3};function aN(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},o=an(e);for(n=0;n<o.length;n++)r=o[n],Kb(t).call(t,r)>=0||(i[r]=e[r]);return i}(e,t);if(xs){var o=xs(e);for(n=0;n<o.length;n++)r=o[n],Kb(t).call(t,r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var sN,cN=function(e){return e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted",e}(cN||{}),uN=function(e){return e.PushLimitWarn="PushLimitWarn",e}(uN||{}),dN=function(e){return e.ON_ADD_STREAM="onAddStream",e.ON_ADD_STREAM_LIST="onAddStreamList",e.ON_REMOVE_STREAM="onRemoveStream",e.ON_REMOVE_STREAM_LIST="onRemoveStreamList",e.USER_DISCONNECTION="userDisconnection",e.USER_DISCONNECTION_LIST="userDisconnectionList",e.USER_CONNECTION="userConnection",e.USER_CONNECTION_LIST="userConnectionList",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_UPDATE_USER_ATTRIBUTES="onUpdateUserAttributes",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_SPEAKER_CHANGE="onSpeakerChange",e.ON_STREAM_FAILED="streamFailed",e}(dN||{}),lN=function(e){return e.RSCP="RSCP",e.RTT="RTT",e}(lN||{}),hN=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(hN||{}),pN=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(pN||{}),fN=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(fN||{}),vN=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(vN||{}),_N=function(e){return e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER",e}(_N||{}),mN=function(e){return 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.EXCEED_QPS=5]="EXCEED_QPS",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.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN",e}(mN||{}),yN=(sd(sN={},0,[0,"success"]),sd(sN,1,[lR.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),sd(sN,2,[lR.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),sd(sN,3,[lR.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),sd(sN,4,[lR.USER_MESSAGE_NO_RECEIVER,"cannot find relay path."]),sd(sN,5,[lR.USER_MESSAGE_EXCEED_QPS,"cannot find relay path."]),sd(sN,17,[lR.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),sd(sN,18,[lR.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),sd(sN,100,[lR.USER_MESSAGE_NOT_JOIN,"not join room"]),sd(sN,105,[lR.USER_MESSAGE_NOT_LOGIN,"not login."]),sd(sN,106,[lR.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),sd(sN,1e3,[lR.USER_MESSAGE_UNKNOWN,"unknown."]),sN),gN=new Jw("RTSMsgReportor",1),SN=function(){function e(t){Wd(this,e),sd(this,"_preTime",Date.now()),sd(this,"_one2oneNum",0),sd(this,"_one2manyNum",0),sd(this,"_one2oneMsgCache",new bE),sd(this,"_one2manyMsgCache",new bE),sd(this,"roomInfo",void 0),sd(this,"rtsSessionId",""),this.id=t}return qd(e,[{key:"needReport",value:function(t){return!!e.config&&(Date.now()-this._preTime>=36e5&&(this._preTime=Date.now(),this._one2oneNum=0,this._one2manyNum=0),"one2one"===t&&this._one2oneNum<e.config.max_one2one_fpt_per_hour&&Math.random()<=e.config.one2one_fpt_ratio/100||"one2many"===t&&this._one2manyNum<e.config.max_one2many_fpt_per_hour&&Math.random()<=e.config.one2many_fpt_ratio/100)}},{key:"cacheP2PMsg",value:function(t){var r;this._one2oneMsgCache.set(t.msg_id,ud({config_version:(null===(r=e.config)||void 0===r?void 0:r.version)||""},t))}},{key:"updateP2PMsg",value:function(e,t){var r=this._one2oneMsgCache.get(e);r&&this._one2oneMsgCache.set(e,ud(ud({},r),t))}},{key:"cacheCustomMsg",value:function(t){var r;this._one2manyMsgCache.set(t.msg_id,ud({config_version:(null===(r=e.config)||void 0===r?void 0:r.version)||""},t))}},{key:"updateOne2ManyMsg",value:function(e,t){var r=this._one2manyMsgCache.get(e);r&&this._one2manyMsgCache.set(e,ud(ud({},r),t))}},{key:"reportP2PMsg",value:function(e){var t=this._one2oneMsgCache.get(e);t&&(gN.print("reportP2PMsg",t.msg_type,ny(t)),CP.rtsMessageReport(t))}},{key:"reportOne2ManyMsg",value:function(e){var t=this._one2manyMsgCache.get(e);t&&(gN.print("reportOne2ManyMsg",t.msg_type,ny(t)),CP.rtsMessageReport(t))}},{key:"reportMsgRecv",value:function(t){var r;t.config_version=(null===(r=e.config)||void 0===r?void 0:r.version)||"",gN.print("reportMsgRecv",t.msg_type,ny(t)),CP.rtsMessageReport(t)}},{key:"destroy",value:function(){this._one2manyNum=0,this._one2oneNum=0,this._one2manyMsgCache.clear(),this._one2oneMsgCache.clear(),this._preTime=Date.now(),delete this.roomInfo,this.rtsSessionId=""}}]),e}();sd(SN,"config",void 0);var EN=new bE,bN=function(e){gN.print("setConfig","get config: "+ny(e)),SN.config=e},kN=function(e){var t=EN.get(e)||new SN(e);return EN.set(e,t),t},TN=function(e){var t=EN.get(e);t&&(t.destroy(),EN.delete(e))},IN=function(e,t){var r=EN.get(e);r&&(r.roomInfo=t)},AN=function(e,t){var r=EN.get(e);r&&(r.rtsSessionId=t)},RN=function(e,t,r){var n,i;t.enable_report&&t.report_msg_id&&(null===(n=EN.get(e))||void 0===n||n.updateP2PMsg(xm(i="".concat(t.from)).call(i,t.report_msg_id),{send_ts:Date.now(),msg_size:r}))},CN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=EN.get(e);null==o||o.updateP2PMsg(xm(n="".concat(t.from)).call(n,t.report_msg_id),{ack_ts:Date.now(),error_code:r}),null==o||o.reportP2PMsg(xm(i="".concat(t.from)).call(i,t.report_msg_id))}},wN=function(e,t,r){var n,i,o,a=EN.get(e);null!=a&&a.needReport("one2many")&&(r.enable_report=!0,r.report_msg_id=t,a.cacheCustomMsg({rts_session_id:a.rtsSessionId,msg_id:xm(n="".concat(r.clientId)).call(n,t),node_role:"src_sdk",from:r.clientId,to:(null===(i=a.roomInfo)||void 0===i?void 0:i.roomId)||"",msg_type:"one2many",rts_room_id:(null===(o=a.roomInfo)||void 0===o?void 0:o.roomId)||"",req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0}));return r},xN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i=EN.get(e);if(i)i.updateOne2ManyMsg(xm(n="".concat(t.clientId)).call(n,t.report_msg_id),{send_ts:Date.now(),msg_size:r})}},ON=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=EN.get(e);if(o)null==o||o.updateOne2ManyMsg(xm(n="".concat(t.clientId)).call(n,t.report_msg_id),{ack_ts:Date.now(),error_code:r}),null==o||o.reportOne2ManyMsg(xm(i="".concat(t.clientId)).call(i,t.report_msg_id))}},DN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=EN.get(e);null==o||o.reportMsgRecv({rts_session_id:o.rtsSessionId,msg_id:xm(n="".concat(t.from)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",msg_type:t.to?"one2one":"one2many",rts_room_id:t.room,from:t.from,to:t.to||t.room,error_code:0,recv_msg_ts:r.recv_msg_ts,fwd_msg_ts:r.fwd_msg_ts,reply_ack_ts:Date.now(),cur_dst_uid:t.to?"":null===(i=o.roomInfo)||void 0===i?void 0:i.userInfo.userId})}},PN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,o=EN.get(e);null==o||o.reportMsgRecv({rts_session_id:o.rtsSessionId,msg_id:xm(n="".concat(t.clientId)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",msg_type:"one2many",rts_room_id:t.roomId,from:t.clientId,to:t.roomId,error_code:0,recv_msg_ts:r.recv_msg_ts,fwd_msg_ts:r.fwd_msg_ts,reply_ack_ts:Date.now(),cur_dst_uid:null===(i=o.roomInfo)||void 0===i?void 0:i.userInfo.userId})}},NN=Object.freeze(Object.defineProperty({__proto__:null,_cache:EN,setConfig:bN,setRtsSessionId:AN,createRTSMsgReportor:kN,destroyRTSMsgReportor:TN,setRoomInfo:IN,samplingP2PMsg:function(e,t){var r=EN.get(e);if(null!=r&&r.needReport("one2one")){var n,i=xm(n="".concat(t.from)).call(n,t.id);t.enable_report=!0,t.report_msg_id=t.id,r.cacheP2PMsg({rts_session_id:r.rtsSessionId,msg_id:i,node_role:"src_sdk",from:t.from,to:t.to||"server",msg_type:t.to?"one2one":"one2server",rts_room_id:t.room,req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0})}return t},updateP2PMsgReq:RN,updateP2PMsgAck:CN,samplingOne2ManyMsg:wN,reportP2PMsgRecv:DN,updateOne2ManyMsgAck:ON,updateOne2ManyMsgReq:xN,reportOne2ManyMsgRecv:PN},Symbol.toStringTag,{value:"Module"})),MN=["msg"],LN=new Jw("DataChannelSignaling",3),UN=["onSpeakerChange"],VN=function(e){return 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",e}(VN||{}),FN=function(e){DI(i,e);var t,r,n=YI(i);function i(e,t){var r;return Wd(this,i),sd(eI(r=n.call(this)),"_singlingCache",new bE),sd(eI(r),"_p2pCache",new bE),sd(eI(r),"_rttIds",{}),sd(eI(r),"_p2pMessageId",0),sd(eI(r),"_clearDataChannelListener",void 0),sd(eI(r),"_asyncQueue",new sw),r.id=e,r._dataChannel=t,r._clearDataChannelListener=r._handleHandler(),window.__rtc_mock_signaling__=r.emit.bind(eI(r)),r}return qd(i,[{key:"destroy",value:function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}}},{key:"sendSignaling",value:function(e,t,r){var n=this;return CP.rtcSignaling(0,ny(t),"call-".concat(e),"Send",t.streamId,t.streamUserId,tP.UP),new v_((function(i,o){var a,s=n._genHeader(r);s.id=KC();var c=s.id.join("-"),u="customMessage"===e;u&&wN(n.id,+s.id.join(""),t);var d=setTimeout((function(){n._singlingCache.delete(c),o(new pR(lR.TIME_OUT,"".concat(e," message time out"))),u&&ON(n.id,t,999)}),6e4);n._singlingCache.set(c,{signalingType:e,success:function(e){clearTimeout(d),i(e),u&&ON(n.id,t,0)},error:function(e){clearTimeout(d),o(e),u&&ON(n.id,t,e.code)}}),LN.print("Signal",xm(a=">>>>>> [".concat(e,"][")).call(a,c,"]"),t),n._sendMessage(e,s,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(r=m_(Im.mark((function e(t,r){var n,i,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.msg,i=aN(t,MN),o=n instanceof ArrayBuffer,e.t0=this,e.t1=NN,e.t2=this.id,e.t3=ud,e.t4=ud({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:vN.SEND,type:_N.P2P,err:mN.SUCCESS},i),e.t5={},e.t6=o,!o){e.next=15;break}return e.next=12,xC.ab2b64str(n);case 12:e.t7=e.sent,e.next=16;break;case 15:e.t7=n;case 16:return e.t8=e.t7,e.t9={binary:e.t6,msg:e.t8},e.t10=(0,e.t3)(e.t4,e.t5,e.t9),e.t11=e.t1.samplingP2PMsg.call(e.t1,e.t2,e.t10),e.t12=r,e.abrupt("return",e.t0._sendP2PMessage.call(e.t0,e.t11,e.t12));case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return qC(e.msg)?this._rttIds[e.id]=e.id:e.dir===vN.SEND&&LN.print("_sendP2PMessage [DC Signaling p2p >>]",ny(e)),new v_((function(n,i){var o=t._genHeader(ud(ud({needAck:!0,functionType:1},r),{},{id:KC()}));if(e.dir===vN.SEND){var a=setTimeout((function(){t._p2pCache.delete(e.id),i(new pR(lR.USER_MESSAGE_TIMEOUT,"P2P message timeout")),CN(t.id,e,999)}),12e3);t._p2pCache.set(e.id,{success:function(r,i){clearTimeout(a),n(i),CN(t.id,e,0)},error:function(r){var n;clearTimeout(a),CN(t.id,e,r.err);var o=$T(yN[r.err]||[lR.USER_MESSAGE_UNKNOWN,xm(n="err: ".concat(r.err,", msg: ")).call(n,r.msg)],2),s=o[0],c=o[1];i({err:r.err,code:s,message:r.msg||c})}})}try{t._sendMessage("p2p",o,e)}catch(s){throw s.code===lR.SIGNALING_CHANNEL_NOT_OPEN&&(s.code=lR.USER_MESSAGE_BROKEN),s}}))}},{key:"_sendMessage",value:function(e,t,r){var n;if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new pR(lR.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var i=t.version+(+t.zip<<5)+(+t.encrypt<<6),o=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),a=xC.str2ab(ny([e,r])),s=CC(Uint8Array,xm(n=[i,o]).call(n,Qk(t.id||[])),new Uint8Array(a));this._dataChannel.send(s.buffer),"p2p"===e?RN(this.id,r,s.buffer.byteLength):"customMessage"===e&&xN(this.id,r,s.buffer.byteLength)}},{key:"_dispartData",value:function(e){var t=new Uint8Array(e),r=0,n=t[r++],i=t[r++],o={version:15&n,zip:16==(16&n),encrypt:32==(32&n),needAck:1==(1&i),direction:(2&i)>>1,functionType:(60&i)>>2,binary:64==(64&i)};if(o.needAck||1===o.direction){for(;r<=6;r++)if(128!=(128&t[r])){r++;break}o.id=Wk(km(t).call(t,2,r))}return{header:o,data:km(t).call(t,r)}}},{key:"_feedbackSignaling",value:function(e,t,r){var n,i,o=this._genHeader({needAck:!0,direction:1,id:uy(n=e.split("-")).call(n,(function(e){return+e}))});$m(UN).call(UN,t)||LN.print("Signal",xm(i=">>>>>> [".concat(t,"-res][")).call(i,e,"]"));this._sendMessage("".concat(t,"-res"),o,r)}},{key:"_handleMessage",value:(t=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O,D,P,N,M,L,U=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=Date.now(),c=t.byteLength,u=this._dispartData(t),d=u.data,(l=u.header).zip&&((h=new BD.Inflate).push(d,!0),d=h.result),p=xC.ab2str(d),f=[],e.prev=8,f=JSON.parse(p),e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(8),e.t0 instanceof Error&&CP.rtcSignalingMsgError(-1,e.t0.message,eP.MESSAGE_PARSE_FAILED),e.abrupt("return");case 16:e.t1=l.functionType,e.next=0===e.t1?19:1===e.t1?38:2===e.t1?73:91;break;case 19:if(v=(null===(r=l.id)||void 0===r?void 0:r.join("-"))||"",1!==l.direction){e.next=24;break}this._handleAckMessage(v,f[0]||{},p),e.next=37;break;case 24:if(!Array.isArray(f)){e.next=37;break}if(_=f[0],f=f[1],$m(UN).call(UN,_)||LN.print("Signal","<<<<<< ".concat(_),f,v),this._feedbackSignaling(v,_,_===dN.ON_CUSTOM_MESSAGE?ud(ud({},f),{},{message:""}):""),!f.binary||"string"!=typeof f.message){e.next=33;break}return e.next=32,xC.b64str2ab(f.message);case 32:f.message=e.sent;case 33:m=Date.now(),this.emit(_,ud({},f)),_===dN.ON_CUSTOM_MESSAGE&&PN(this.id,f,{msg_size:c,recv_msg_ts:s,fwd_msg_ts:m}),CP.rtcSignaling(0,p,"on-".concat(_),"Recv",f.streamId,f.clientId,tP.DOWN);case 37:return e.abrupt("break",92);case 38:Array.isArray(f)&&(f=f[1]),y=null===(n=f)||void 0===n?void 0:n.id,this._rttIds[y]||(null===(i=f)||void 0===i?void 0:i.dir)===vN.FEEDBACK||qC(null===(o=f)||void 0===o?void 0:o.msg)?delete this._rttIds[y]:LN.print("Signal","<<<<<< p2p response",f),e.t2=f.dir,e.next=e.t2===vN.SEND?44:e.t2===vN.FEEDBACK?69:71;break;case 44:if(g=Date.now(),qC(null===(a=f)||void 0===a?void 0:a.msg)){e.next=66;break}if(E=(S=f).binary,b=S.msg,k=S.room,T=S.to,I=S.from,A=""===k?E?dN.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:dN.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:E?dN.USER_BINARY_MESSAGE_RECEIVED:dN.USER_MESSAGE_RECEIVED,T){e.next=65;break}if(e.t3=this,e.t4=dN.ON_CUSTOM_MESSAGE,e.t5=I,e.t6=E,!E){e.next=59;break}return e.next=56,xC.b64str2ab(b);case 56:e.t7=e.sent,e.next=60;break;case 59:e.t7=b;case 60:e.t8=e.t7,e.t9={clientId:e.t5,binary:e.t6,message:e.t8},e.t3.emit.call(e.t3,e.t4,e.t9),e.next=66;break;case 65:E?this._asyncQueue.add(xC.b64str2ab(b),(function(e){return U.emit(A,ud(ud({},f),{},{msg:e}))})):this.emit(A,ud(ud({},f),{},{msg:b}));case 66:return this._sendP2PMessage(ud(ud({},f),{},{dir:vN.FEEDBACK,msg:""})),DN(this.id,f,{msg_size:c,recv_msg_ts:s,fwd_msg_ts:g}),e.abrupt("break",72);case 69:return this._handleP2PMsgFeedback(f),e.abrupt("break",72);case 71:return e.abrupt("break",72);case 72:return e.abrupt("break",92);case 73:if(1!==l.direction){e.next=78;break}C=(null===(R=l.id)||void 0===R?void 0:R.join("-"))||"",this._handleAckMessage(C,f[0]||{},p),e.next=90;break;case 78:if(w=$T(f,2),x=w[0],O=w[1],D=void 0===O?{}:O,"RXMediaMsg"!==x){e.next=90;break}P=D.type,N=D.data,CP.rtcSignaling(0,p,"on-".concat(P),"Recv","","",tP.DOWN),e.t10=P,e.next="RSCP"===e.t10?85:"RTT"===e.t10?87:89;break;case 85:try{M=JSON.parse(N),Array.isArray(M)&&this.emit(P,M)}catch(V){}return e.abrupt("break",90);case 87:try{(L=JSON.parse(N)).length&&this.emit(P,L[0])}catch(V){}return e.abrupt("break",90);case 89:return e.abrupt("break",90);case 90:case 91:return e.abrupt("break",92);case 92:case"end":return e.stop()}}),e,this,[[8,12]])}))),function(e){return t.apply(this,arguments)})},{key:"_handleHandler",value:function(){var e=this,t=function(t){LN.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){LN.print("_handleHandler","dataChannel error",t),e.emit("close",t)},n=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",n),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",n)}}},{key:"_genHeader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ud({version:2,zip:!1,encrypt:!1,needAck:!0,direction:0,functionType:0,binary:!1},e)}},{key:"_handleAckMessage",value:function(e,t,r){var n,i=this._singlingCache.get(e);i&&(this._singlingCache.delete(e),200===t.code?i.success(t):i.error(t),LN.print("Signal",xm(n="<<<<<< [".concat(i.signalingType,"-ack] ")).call(n,e),t));CP.rtcSignaling(0,r,null==i?void 0:i.signalingType,"Ack","","",tP.DOWN)}},{key:"_handleP2PMsgFeedback",value:function(e){var t=this._p2pCache.get(e.id);t&&(this._p2pCache.delete(e.id),e.err===mN.SUCCESS?t.success(e.id,e):t.error(e))}}]),i}(Pw.exports.EventEmitter),BN=function(){function e(){Wd(this,e),sd(this,"xhr",void 0),sd(this,"isSending",void 0),sd(this,"timeout",void 0),this.isSending=!1}return qd(e,[{key:"ajax",value:function(e){var t=this,r=e.method,n=e.url,i=e.body,o=void 0===i?{}:i,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new v_((function(e,i){t.isSending=!0;var a=new XMLHttpRequest;a.open(r,n,!0);for(var c=0,d=bR(s);c<d.length;c++){var l=$T(d[c],2),h=l[0],p=l[1];a.setRequestHeader(h,p)}a.onreadystatechange=function(){if(4===a.readyState)if(t.isSending=!1,200===a.status)e(JSON.parse(a.responseText));else{var r=a.statusText,n=a.status;if(a.responseText)try{var o=JSON.parse(a.responseText);o.errMessage&&(r=o.errMessage),o.code&&(n=o.code)}catch(s){}i({message:r,code:n})}},a.onabort=function(){i({code:0,message:"Request abort"})},a.onerror=function(e){t.isSending=!1,i({code:-1,message:a.responseText||"unknown"})},t.timeout&&(a.timeout=t.timeout),u&&(o=ny(o)),a.send(o),t.xhr=a}))}},{key:"get",value:function(e,t){return this.ajax({method:"GET",url:e,headers:t})}},{key:"post",value:function(e,t,r,n){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:n})}},{key:"abort",value:function(){var e;null===(e=this.xhr)||void 0===e||e.abort()}}]),e}(),jN=new Jw("ICE Request",3),GN=function(){function e(){Wd(this,e),sd(this,"_request",void 0),this._request=new BN}var t,r,n;return qd(e,[{key:"getAccessNode",value:(n=m_(Im.mark((function e(t,r,n,i,o,a,s,c){var u;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(u=YP.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,o,a,s,c),BP("es.R.node.cache",u),!Array.isArray(u)){e.next=8;break}return e.abrupt("return",v_.resolve(u));case 8:return e.abrupt("return",v_.resolve([u]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,o,a,s,c));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,o,a,s,c){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=m_(Im.mark((function e(t,r,n,i,o,a,s,c){var u,d,l,h,p=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=YP.getAccessUrls(),h=!0,BP("es.R.req.cache.urls",l),(null===(u=l)||void 0===u?void 0:u.length)>0||(l=eN.ICE_CONFIG_REQUEST_URLS,h=!1,BP("es.R.req.external.urls",l)),(null===(d=l)||void 0===d?void 0:d.length)>0||(l=eN.ICE_CONFIG_REQUEST_URLS_INTERNAL,h=!1,BP("es.R.req.internal.urls",l)),e.abrupt("return",this.getICEConfigFromServer(l,t,r,n,i,o,a,s,c).then((function(e){var r=e.nodes;return YP.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&YP.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(h)return BP("es.R.req.fallback",""),YP.clearAccessUrls(),p.getAccessNodeFromServer(t,r,n,i,o,a,s);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,o,a,s,c){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=m_(Im.mark((function e(t,r,n,i,o,a,s,c,u){var d,l,h,p,f=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d={appID:r,userID:i,deviceID:o,connectSessionID:AC(),os:"web",sdkVersion:eN.VERSION,isOversea:eN.OVERSEA,expectedAddr:rN("EXPECTED_ADDR"),productPlatform:"BytePlus",accessParams:ny({requireICEUfragV2:!0})},a&&s&&(d.feedbackInfo=[{feedbackIP:null===(l=s.publicIPs[0])||void 0===l?void 0:l.ip,feedbackReason:{type:"NODE_CHANGED",reason:a}}],delete d.expectedAddr),h=Date.now(),CP.rtcGetAccess(0,ny(d),0,ZD.REQUEST,t.join(","),d.connectSessionID),p=uy(t).call(t,function(){var e=m_(Im.mark((function e(t,r){var n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,f._request.post(t,d);case 3:n=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new pR(lR.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new pR(lR.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:ny(n)});case 11:if(i=n.nodes[0]){e.next=14;break}throw new pR(lR.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:ny(n)});case 14:return e.abrupt("return",{result:n,firstNode:i,index:r});case 15:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("return",QC(p).then((function(e){var r=e.result;e.firstNode;var n=e.index;return CP.rtcGetAccess(200,ny(r),Date.now()-h,ZD.RESPONSE,t[n],d.connectSessionID),r})).catch((function(e){var r,n,i=null===(r=e[0])||void 0===r?void 0:r.error;throw CP.rtcGetAccess(+((null==i?void 0:i.code)||(null==i?void 0:i.server_code)),null===(n=e[0])||void 0===n?void 0:n.message,Date.now()-h,ZD.RESPONSE,t.join(","),d.connectSessionID,{error:ny(i)}),e})));case 6:case"end":return e.stop()}}),e)}))),function(e,r,n,i,o,a,s,c,u){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(jN.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),HN=function(){function e(){Wd(this,e),sd(this,"_request",void 0),this._request=new BN}return qd(e,[{key:"getConfig",value:function(e,t){var r,n=this,i={keys:["rts_report","web_rtc_config"],labelSelector:"",sdkVersion:"4.51.10",deviceType:"web",appId:e,deviceId:t,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0},o=uy(r=eN.CONFIG_REQUEST_DOMAINS).call(r,(function(e){return"https://".concat(e,"/decision/v1/multi")}));CP.rtcGetConfig(0,ny(i),0,o.join(","),qD.REQUEST,"",!1);var a=uy(o).call(o,function(){var e=m_(Im.mark((function e(t,r){var o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n._request.post(t,i);case 3:o=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new pR(lR.ICE_SERVER_WRONG,"get config failed");case 9:return e.abrupt("return",{result:o,index:r});case 10:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}());return new v_((function(t){QC(a).then((function(r){var n=r.result,i=r.index;CP.rtcGetConfig(200,ny(n),0,o[i],qD.RESPONSE,"",!1),YP.setServerConfig(e,n),t(n)})).catch((function(e){CP.rtcGetConfig(500,e.message,0,"",qD.RESPONSE,"",!1)}))}))}}]),e}(),zN=hi.f("asyncIterator");function KN(e){var t,r,n,i=2;for(void 0!==j_&&(r=zN,n=G_);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new XN(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function XN(e){function t(e){if(Object(e)!==e)return v_.reject(new TypeError(e+" is not an object."));var t=e.done;return v_.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(XN=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?v_.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?v_.reject(e):t(r.apply(this.s,arguments))}},new XN(e)}var qN=[{maxLayers:3,totalPixels:2073600},{maxLayers:3,totalPixels:921600},{maxLayers:3,totalPixels:518400},{maxLayers:2,totalPixels:230400},{maxLayers:2,totalPixels:129600},{maxLayers:1,totalPixels:57600},{maxLayers:1,totalPixels:0}];yg("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Mg);var WN=ee.Set;Rr({target:"Set",stat:!0,forced:!0},{from:zg}),Rr({target:"Set",stat:!0,forced:!0},{of:Xg});var YN=O,QN=we,JN=tr,ZN=function(){for(var e=JN(this),t=QN(e.add),r=0,n=arguments.length;r<n;r++)YN(t,e,arguments[r]);return e};Rr({target:"Set",proto:!0,real:!0,forced:!0},{addAll:ZN}),Rr({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:Qg});var $N=bl,eM=tr,tM=Yt,rM=$N,nM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{every:function(e){var t=eM(this),r=rM(t),n=tM(e,arguments.length>1?arguments[1]:void 0);return!nM(r,(function(e,r){if(!n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var iM=oe,oM=O,aM=we,sM=tr,cM=wh,uM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(e){var t=sM(this),r=new(cM(t,iM("Set")))(t),n=aM(r.delete);return uM(e,(function(e){oM(n,r,e)})),r}});var dM=oe,lM=O,hM=we,pM=tr,fM=Yt,vM=wh,_M=$N,mM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=pM(this),r=_M(t),n=fM(e,arguments.length>1?arguments[1]:void 0),i=new(vM(t,dM("Set"))),o=hM(i.add);return mM(r,(function(e){n(e,e,t)&&lM(o,i,e)}),{IS_ITERATOR:!0}),i}});var yM=tr,gM=Yt,SM=$N,EM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=yM(this),r=SM(t),n=gM(e,arguments.length>1?arguments[1]:void 0);return EM(r,(function(e,r){if(n(e,e,t))return r(e)}),{IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var bM=oe,kM=O,TM=we,IM=tr,AM=wh,RM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){var t=IM(this),r=new(AM(t,bM("Set"))),n=TM(t.has),i=TM(r.add);return RM(e,(function(e){kM(n,t,e)&&kM(i,r,e)})),r}});var CM=O,wM=we,xM=tr,OM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){var t=xM(this),r=wM(t.has);return!OM(e,(function(e,n){if(!0===CM(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var DM=oe,PM=O,NM=we,MM=A,LM=tr,UM=bl,VM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){var t=UM(this),r=LM(e),n=r.has;return MM(n)||(r=new(DM("Set"))(e),n=NM(r.has)),!VM(t,(function(e,t){if(!1===PM(n,r,e))return t()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var FM=O,BM=we,jM=tr,GM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){var t=jM(this),r=BM(t.has);return!GM(e,(function(e,n){if(!1===FM(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var HM=Rr,zM=tr,KM=yn,XM=$N,qM=Bl,WM=b([].join),YM=[].push;HM({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=zM(this),r=XM(t),n=void 0===e?",":KM(e),i=[];return qM(r,YM,{that:i,IS_ITERATOR:!0}),WM(i,n)}});var QM=oe,JM=Yt,ZM=O,$M=we,eL=tr,tL=wh,rL=$N,nL=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=eL(this),r=rL(t),n=JM(e,arguments.length>1?arguments[1]:void 0),i=new(tL(t,QM("Set"))),o=$M(i.add);return nL(r,(function(e){ZM(o,i,n(e,e,t))}),{IS_ITERATOR:!0}),i}});var iL=we,oL=tr,aL=$N,sL=Bl,cL=TypeError;Rr({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=oL(this),r=aL(t),n=arguments.length<2,i=n?void 0:arguments[1];if(iL(e),sL(r,(function(r){n?(n=!1,i=r):i=e(i,r,r,t)}),{IS_ITERATOR:!0}),n)throw cL("Reduce of empty set with no initial value");return i}});var uL=tr,dL=Yt,lL=$N,hL=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=uL(this),r=lL(t),n=dL(e,arguments.length>1?arguments[1]:void 0);return hL(r,(function(e,r){if(n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var pL=oe,fL=O,vL=we,_L=tr,mL=wh,yL=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){var t=_L(this),r=new(mL(t,pL("Set")))(t),n=vL(r.delete),i=vL(r.add);return yL(e,(function(e){fL(n,r,e)||fL(i,r,e)})),r}});var gL=oe,SL=we,EL=tr,bL=wh,kL=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){var t=EL(this),r=new(bL(t,gL("Set")))(t);return kL(e,SL(r.add),{that:r}),r}});var TL=WN,IL=new bE,AL=function(){var e=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new v_((function(e,r){var n=rN("STATS_SCALLBACK_SUPPORT");if("chrome-stable"===OC()&&void 0===window.InstallTrigger&&DC&&n)try{t.getStats((function(t){var r=[];t.result().forEach((function(e){if(!$m(xL).call(xL,e.type)){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),r.push(ud(ud({},t),{},{id:e.id,type:e.type,timestamp:e.timestamp}))}})),e({all:r,getTrackStats:function(e){return Gs(r).call(r,(function(t){return"ssrc"!==t.type||t.googTrackId===e}))}})}))}catch(gX){r(gX)}else e({all:[],getTrackStats:function(){return[]}})})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),RL=function(){var e=m_(Im.mark((function e(t){var r,n,i,o,a,s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getStats();case 2:return i=e.sent,o={all:[]},a=new bE,i.forEach((function(e){var t=a.get(e.type)||new bE;t.set(e.id,e),a.set(e.type,t),o.all.push(e)})),s=function(e,t){e.forEach((function(e){var r,n,i,o,s,c,u=e.codecId,d=e.transportId,l=e.trackId,h=e.playoutId;if(null===(r=a.get(wL.codec))||void 0===r||r.forEach((function(e){e.id===u&&t.add(e)})),null===(n=a.get(wL.transport))||void 0===n||n.forEach((function(e){e.id===d&&(s=e,t.add(e))})),null===(i=a.get(wL.track))||void 0===i||i.forEach((function(e){e.id===l&&t.add(e)})),null===(o=a.get(wL.mediaPlayout))||void 0===o||o.forEach((function(e){e.id===h&&t.add(e)})),s){var p,f,v=s,_=v.localCertificateId,m=v.remoteCertificateId,y=v.selectedCandidatePairId;null===(p=a.get(wL.certificate))||void 0===p||p.forEach((function(e){(e.id===_||e.id===m)&&t.add(e)})),null===(f=a.get(wL.candidatePair))||void 0===f||f.forEach((function(e){e.id===y&&(c=e,t.add(e))}))}if(c){var g,S,E=c,b=E.localCandidateId,k=E.remoteCandidateId;null===(g=a.get(wL.localCandidate))||void 0===g||g.forEach((function(e){e.id===b&&t.add(e)})),null===(S=a.get(wL.remoteCandidate))||void 0===S||S.forEach((function(e){e.id===k&&t.add(e)}))}}))},null===(r=a.get(wL.mediaSource))||void 0===r||r.forEach((function(e){var t,r=new TL;r.add(e);var n=[];null===(t=a.get(wL.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(r.add(t),n.push(t),null===(i=a.get(wL.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),s(n,r),o[e.trackIdentifier]=Wk(r)})),null===(n=a.get(wL.inboundRtp))||void 0===n||n.forEach((function(e){var t,r=new TL;r.add(e),null===(t=a.get(wL.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&r.add(t)})),s([e],r);var n,i=e.trackIdentifier;i||(null===(n=a.get(wL.track))||void 0===n||n.forEach((function(t){t.id===e.trackId&&(i=t.trackIdentifier)})));o[i]=Wk(r)})),e.abrupt("return",o);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),CL=function(){var e=m_(Im.mark((function e(t,r,n){var i,o,a,s,c,u;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=null==r?void 0:r.id,t instanceof RTCPeerConnection){e.next=3;break}return e.abrupt("return",[]);case 3:if(!PC&&!NC){e.next=10;break}return o=[],e.next=7,t.getStats(r);case 7:return e.sent.forEach((function(e){o.push(e)})),e.abrupt("return",o);case 10:return(!(a=IL.get(t))||Date.now()-a.timestamp>150)&&(a={timestamp:Date.now(),statsPromise:RL(t),extraStatsPromise:AL(t)},IL.set(t,a)),e.next=14,a.statsPromise;case 14:if(s=e.sent,c=(i?s[i]:s.all)||[],n){e.next=21;break}return e.next=19,a.extraStatsPromise;case 19:u=e.sent,c=xm(c).call(c,(i?u.getTrackStats(i):u.all)||[]);case 21:return e.abrupt("return",c);case 22:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}();OC();var wL=function(e){return 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",e.mediaPlayout="media-playout",e}(wL||{}),xL=["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"],OL=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!wC()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,BL();case 5:if(e.t0=e.sent,!e.t0){e.next=10;break}return e.next=9,FL();case 9:e.t0=e.sent;case 10:return e.abrupt("return",e.t0);case 13:return e.prev=13,e.t1=e.catch(0),e.abrupt("return",!1);case 16:case"end":return e.stop()}}),e,null,[[0,13]])})));return function(){return e.apply(this,arguments)}}(),DL=function(){var e=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,BL();case 3:if(e.t0=e.sent,!e.t0){e.next=8;break}return e.next=7,FL();case 7:e.t0=e.sent;case 8:if(!e.t0){e.next=10;break}t.push("H264");case 10:return e.next=12,GL();case 12:if(e.t1=e.sent,!e.t1){e.next=17;break}return e.next=16,jL();case 16:e.t1=e.sent;case 17:if(!e.t1){e.next=19;break}t.push("vp8");case 19:return e.abrupt("return",t);case 20:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),PL=function(){var e=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,DL();case 2:return t=e.sent,e.abrupt("return",uy(t).call(t,(function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),NL={};function ML(e){var t,r=!1,n=ZT(e.split("\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value;if($m(i).call(i,"level-asymmetry-allowed=1")&&$m(i).call(i,"packetization-mode=1")&&$m(i).call(i,"profile-level-id=42e0")){r=!0;break}}}catch(d){n.e(d)}finally{n.f()}if(r){for(var o=navigator.userAgent.toLowerCase(),a=!1,s=0,c=["miuibrowser"];s<c.length;s++){var u=c[s];$m(o).call(o,u)&&(a=!0)}return!a}return!1}var LL=function(){var e=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=new RTCPeerConnection).addTransceiver("audio",{direction:t}),r.addTransceiver("video",{direction:t}),e.next=5,r.createOffer();case 5:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),UL=function(){var e=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,LL("sendonly");case 2:if(r=e.sent,!$m(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,LL("sendonly");case 6:r=e.sent;case 7:return NL.h264encode=ML(r),NL.vp8encode=Kb(r).call(r,"VP8")>-1,e.abrupt("return",NL);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),VL=function(){var e=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,LL("recvonly");case 2:if(r=e.sent,!$m(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,LL("recvonly");case 6:r=e.sent;case 7:return NL.h264decode=ML(r),NL.vp8decode=Kb(r).call(r,"VP8")>-1,e.abrupt("return",NL);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),FL=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==NL.h264encode){e.next=9;break}return e.prev=1,e.next=4,UL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",NL.h264encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),BL=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==NL.h264decode){e.next=9;break}return e.prev=1,e.next=4,VL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",NL.h264decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),jL=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==NL.vp8encode){e.next=9;break}return e.prev=1,e.next=4,UL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",NL.vp8encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),GL=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==NL.vp8decode){e.next=9;break}return e.prev=1,e.next=4,VL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",NL.vp8decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),HL=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},zL={},KL={},XL={exports:{}},qL=XL.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"]}]};an(qL).forEach((function(e){qL[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},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var o=0;o<n.length;o+=1)null!=e[o+1]&&(r[n[o]]=t(e[o+1]))}(n.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},n=XL.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t,o={},a=[],s=o;return Gs(t=e.split(/(\r\n|\r|\n)/)).call(t,i).forEach((function(e){var t=e[0],i=km(e).call(e,2);"m"===t&&(a.push({rtp:[],fmtp:[]}),s=a[a.length-1]);for(var o=0;o<(n[t]||[]).length;o+=1){var c=n[t][o];if(c.reg.test(i))return r(c,s,i)}})),o.media=a,o};var o=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){var t;return LE(t=e.split(/;\s?/)).call(t,o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){var t;return uy(t=e.toString().split(" ")).call(t,Number)},e.parseRemoteCandidates=function(e){for(var r,n=[],i=uy(r=e.split(" ")).call(r,t),o=0;o<i.length;o+=3)n.push({component:i[o],ip:i[o+1],port:i[o+2]});return n},e.parseImageAttributes=function(e){var t;return uy(t=e.split(" ")).call(t,(function(e){var t;return LE(t=e.substring(1,e.length-1).split(",")).call(t,o,{})}))},e.parseSimulcastStreamList=function(e){var r;return uy(r=e.split(";")).call(r,(function(e){var r;return uy(r=e.split(",")).call(r,(function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(KL);var WL=XL.exports,YL=/%[sdv%]/g,QL=function(e){var t=1,r=arguments,n=r.length;return e.replace(YL,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},JL=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var o=t.names[i];t.name?n.push(r[t.name][o]):n.push(r[t.names[i]])}else n.push(r[t.name]);return QL.apply(null,n)},ZL=["v","o","s","i","u","e","p","c","b","t","r","z","a"],$L=["i","c","b","a"],eU=KL,tU=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 r=t.outerOrder||ZL,n=t.innerOrder||$L,i=[];return r.forEach((function(t){WL[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(JL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(JL(t,r,e))}))}))})),e.media.forEach((function(e){i.push(JL("m",WL.m[0],e)),n.forEach((function(t){WL[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(JL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(JL(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};zL.write=tU,zL.parse=eU.parse,zL.parseParams=eU.parseParams,zL.parseFmtpConfig=eU.parseFmtpConfig,zL.parsePayloads=eU.parsePayloads,zL.parseRemoteCandidates=eU.parseRemoteCandidates,zL.parseImageAttributes=eU.parseImageAttributes,zL.parseSimulcastStreamList=eU.parseSimulcastStreamList;var rU=Xe,nU=Mr,iU=Br,oU=function(e){for(var t=rU(this),r=iU(t),n=arguments.length,i=nU(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:nU(o,r);a>i;)t[i++]=e;return t};Rr({target:"Array",proto:!0},{fill:oU});var aU=Us("Array").fill,sU=ae,cU=aU,uU=Array.prototype,dU=function(e){var t=e.fill;return e===uU||sU(uU,e)&&t===uU.fill?cU:t},lU=new Jw("FirefoxHandler",3),hU=Math.pow(2,32),pU="kp34Za0H+aVf862l",fU="o/i14u9pJrxRKAsu";function vU(e){return e>hU-18?(lU.print("generateAllSsrc","reset start id",e),vU(e=e-hU+1e4+18)):{audio:e,audioFec:e+1,audioRtx:e+2,video:e+3,videoFec:e+4,videoRtx:e+5,next:e+18}}var _U=function(e,t,r){var n,i,o,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:fU;return[{id:r,attribute:"cname",value:a},{id:r,attribute:"msid",value:xm(n=xm(i="".concat(e," ")).call(i,e,"-")).call(n,t)},{id:r,attribute:"mslabel",value:"".concat(e)},{id:r,attribute:"label",value:xm(o="".concat(e,"-")).call(o,t)}]},mU=function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.video,o=t.videoRtx,a=t.videoFec,s=[i,o],c=n.cname,u=n.flexfec;u&&s.push(a);var d,l=LE(s).call(s,(function(t,r){return xm(t).call(t,_U(e,"video",r,c))}),[]),h=[{semantics:"FID",ssrcs:xm(r="".concat(i," ")).call(r,o)}];u&&h.push({semantics:"FEC-FR",ssrcs:xm(d="".concat(i," ")).call(d,a)});return{ssrcs:l,ssrcGroups:h}};function yU(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 gU=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=ud(ud({},e),{},{media:[]});return n&&(i.invalid=[{value:"realx-exts:rscp"}]),t&&i.media.push(t),r&&i.media.push(r),delete i.groups,delete i.msidSemantic,zL.write(i)};function SU(e){return EU.apply(this,arguments)}function EU(){return(EU=m_(Im.mark((function e(t){var r,n,i,o,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,o=t.iceParams,a=t.iceConfig,r.fingerprint={type:"sha-256",hash:i},r.icePwd=o.serverIcePwd,e.next=6,kU(o.serverIceUfrag);case 6:return r.iceUfrag=e.sent,r.candidates=bU(n,a),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bU(e,t){if(!Array.isArray(e))return[];var r=0,n=2130706431,i=[],o=rN("CONNECTION_MODE");return e.forEach((function(e){var a={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&!t.tcpOnly&&o!==Fd.FORCE_TCP&&e.udpPorts.forEach((function(e){i.push(ud(ud({},a),{},{foundation:r++,transport:"udp",port:e,priority:n}))})),e.tcpPorts&&o!==Fd.FORCE_UDP&&e.tcpPorts.forEach((function(e){i.push(ud(ud({},a),{},{foundation:r++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),i}var kU=function(){var e=m_(Im.mark((function e(t){var r,n,i,o,a,s,c;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new TextEncoder,n=r.encode("PREC"),e.t0=Uint8Array,e.next=5,xC.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),o=new Uint8Array(4),crypto.getRandomValues(o),(a=new Uint8Array(2))[0]=0,a[1]=1,s=CC(Uint8Array,n,i,o,a),e.next=15,xC.ab2b64str(s.buffer);case 15:return c=e.sent,e.abrupt("return",c);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),TU=function(e){return 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",e}(TU||{});function IU(e){var t,r=e.random,n=e.serverUfrag,i=e.serverPwd,o=e.clientPwd,a=e.options,s=(new TextEncoder).encode("WPRE");r||(r=new Uint8Array(4),crypto.getRandomValues(r));var c=cw(n);c.byteLength;var u=dw(cw(o),cw(i).subarray(0,16),cw(n).subarray(0,16));u.byteLength;var d=new Uint8Array(LE(t=an(a)).call(t,(function(e,t){var r=Number(t);return e.push(r),e.push(a[r]?1:0),e}),[]));d.byteLength;var l,h=CC(Uint8Array,s,r,[c.byteLength],c,[u.byteLength],u,d);h.byteLength%3!=0&&(h=CC(Uint8Array,h,dU(l=new Uint8Array(3-h.byteLength%3)).call(l,255)));return[uw(h),uw(CC(Uint8Array,r,c.subarray(0,20)))]}var AU=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=ZT(e.fmtp);try{for(i.s();!(n=i.n()).done;){var o,a,s,c=n.value;if($m(o=c.config).call(o,"level-asymmetry-allowed=1")&&$m(a=c.config).call(a,"packetization-mode=1")&&$m(s=c.config).call(s,"profile-level-id=42e0")){r=c.payload;break}}}catch(f){i.e(f)}finally{i.f()}for(var u=0;u<e.rtp.length;u++){var d=e.rtp[u];if("H264"===t){if(d.payload===r){var l;e.rtp.unshift(mk(l=e.rtp).call(l,u,1)[0]);break}}else if(d.codec===t){var h;e.rtp.unshift(mk(h=e.rtp).call(h,u,1)[0]);break}}var p=[];e.rtp.forEach((function(e){return p.push(e.payload)})),e.payloads=p.join(" ")}},RU=new Jw("BasicHandler",3),CU={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!HL()||void 0},wU=function(e){DI(o,e);var t,r,n,i=YI(o);function o(e,t){var r;return Wd(this,o),sd(eI(r=i.call(this)),"_peerConnection",void 0),sd(eI(r),"_dataChannel",void 0),sd(eI(r),"_context",void 0),sd(eI(r),"monitor",void 0),sd(eI(r),"_offerIce",{}),sd(eI(r),"_answerIce",{}),sd(eI(r),"_initSctpEvents",!1),sd(eI(r),"_nextSsrc",Math.floor(Math.random()*hU+1e4)),sd(eI(r),"_aSendonlyAnswerTpl",void 0),sd(eI(r),"_vSendonlyAnswerTpl",void 0),sd(eI(r),"_enableSubFlexfec",!1),sd(eI(r),"audioTrack4ff",void 0),sd(eI(r),"connection_id",""),sd(eI(r),"ms_addr",""),r.monitor=e,r._peerConnection=new RTCPeerConnection(CU),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=t,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,n,i,o,a=null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id;RU.print("constructor",xm(i=xm(o="pc.ontrack ".concat(e.track.kind," ")).call(o,e.track.id," ")).call(i,a)),"ff-stream"===a&&(r.audioTrack4ff=e.track),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){var t;RU.print("constructor",xm(t="onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ")).call(t,r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var t=r._peerConnection.iceConnectionState;e.rtcPreIceState(t,$D["".concat(t.toUpperCase())],r.connection_id,{ms_addr:r.ms_addr})},r}return qd(o,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){RU.print("destroy"),this.disconnect(),this._context=void 0}},{key:"getTransceivers",value:function(){return this._peerConnection.getTransceivers()}},{key:"_simulcast",value:function(e,t,r,n,i){var o,a,s,c=[];1===e.videoEncodeConfig.length?(c=function(e,t){var r=[];if(t<=1)return r;var n=Math.min(e.width,e.height)/90;return r.push({scaleResolutionDownBy:n,width:Math.floor(e.width/n),height:Math.floor(e.height/n),maxkbps:100,frameRate:10}),t<=2||r.unshift({scaleResolutionDownBy:2,width:Math.floor(e.width/2),height:Math.floor(e.height/2),maxkbps:Math.floor(e.maxKbps/2),frameRate:e.frameRate>=30?Math.floor(e.frameRate/2):e.frameRate}),r}(t,i),RU.print("simulcast() ","simulcastLayers: %o",c)):(c=uy(o=km(a=km(s=e.videoEncodeConfig).call(s,1)).call(a,1-i)).call(o,(function(e){var r=aw(e.width),n=t.width/r;return{width:r,height:Math.floor(t.height/n),scaleResolutionDownBy:n,frameRate:aw(e.frameRate)||15,maxkbps:e.maxKbps||600}})),RU.print("simulcast() ","simulcastLayers2: %o",c));var u=[!0];c.forEach((function(e,t){var i,o={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};null===(i=r.sendEncodings)||void 0===i||i.unshift(o),n.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)}),u.push(!0)})),this._context&&(this._context.activeSimStreams=u)}},{key:"internalPublish",value:function(e){var t=e.stream,r=e.videoTrack,n=e.audioTrack,i=e.enableSimulcast,o=e.pubAudio,a=e.pubVideo,s={direction:"sendonly",streams:[t]},c={direction:"sendonly",streams:[t]},u=[],d=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var l=null==r?void 0:r.getTrack(),h=ud({},iN);if(l){var p=null==l?void 0:l.getSettings();h={width:Math.floor(p.width),height:Math.floor(p.height),frameRate:Math.floor(p.frameRate)}}"number"!=typeof h.frameRate&&(h.frameRate=30);var f=null==e?void 0:e.videoEncodeConfig[0],v={maxBitrate:1e3*f.maxKbps,rid:"0"};if(e.prevBitrate=f.maxKbps,c.sendEncodings=[v],u.push({width:h.width,height:h.height,framerate:h.frameRate,maxkbps:f.maxKbps,rid:"0"}),!PC&&i){var _,m,y=function(e){for(var t=0,r=e.width*e.height,n=0;n<qN.length;n++)if(r>=qN[n].totalPixels){t=n;break}if(0===t)return qN[t].maxLayers;var i=qN[t-1].totalPixels;return(i-r)/(i-qN[t].totalPixels)<.1?qN[t-1].maxLayers:qN[t].maxLayers}(h);if(RU.print("simulcast() ","maxLayers: %o",y),y>1)this._simulcast(e,ud(ud({},h),{},{maxKbps:f.maxKbps}),c,u,y),null!==(_=this._context)&&void 0!==_&&null!==(m=_.serverConfig)&&void 0!==m&&m.simulcastOnDemand&&(d=uy(u).call(u,(function(e,t){return ud(ud({},e),{},{video_index:t,sub_index:t})})))}}RU.print("publish videoTransceiverInit videoDescriptions","",c,u);var g=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==Gd.PLAYOUT&&null!=n&&n.mixedAudioTrack&&(g=null==n?void 0:n.mixedAudioTrack),g=o&&g?g:"audio";var S=null==r?void 0:r.getTrack("preprocessing");S=a&&S?S:"video";try{this.monitor.rtcInvokeStatus(ny({aTrack:rw(g),vTrack:rw(S),audioTransceiverInit:s,videoTransceiverInit:c}),0,"Handler.internalPublish","",0)}catch(gX){}return{semantics:"unified-plan",videoDescriptions:u,subVideoDescriptions:d,audioTransceiverInit:{track:g,init:s},videoTransceiverInit:{track:S,init:c}}}},{key:"updateMaxBitrate",value:function(e){var t,r,n,i;RU.print("updateMaxBitrate()");var o=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),a=e.videoTransceiver;if(o&&e.pubVideo&&a){var s=null===(r=e.videoEncodeConfig)||void 0===r||null===(n=r[0])||void 0===n?void 0:n.maxKbps;if(s){if(s===e.prevBitrate)return void RU.print("updateMaxBitrate()","no change");e.prevBitrate=s}var c=null===(i=a.sender)||void 0===i?void 0:i.getParameters();if(c){var u;c.encodings=null==c||null===(u=c.encodings)||void 0===u?void 0:uy(u).call(u,(function(t){var r,n=+t.rid||0,i=null===(r=e.videoEncodeConfig[n])||void 0===r?void 0:r.maxKbps;return"number"==typeof i&&(t.maxBitrate=1e3*i),t})),null==a||a.sender.setParameters(c);try{this.monitor.rtcInvokeStatus(ny(c.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(gX){}}}else RU.print("updateMaxBitrate()","no pub")}},{key:"getStats",value:function(e,t){return CL(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=m_(Im.mark((function e(t,r){var n,i,o,a=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=RC(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,iP.W_1,"local"===(null==r?void 0:r.streamUserId)?oP.UP:oP.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",RC()-n,this.connection_id,{type:"offer",ms_addr:this.ms_addr}),this._initSctpEvents||(this._initSctpEvents=!0,(o=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(o.onstatechange=function(){a.monitor.rtcInvokeStatus("sctp state change TO: ".concat(o.state),0,"sctp","",0,{ms_addr:a.ms_addr},a.connection_id)},o.transport&&(o.transport.onstatechange=function(){var e;a.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null==o||null===(e=o.transport)||void 0===e?void 0:e.state),0,"dtls","",0,{ms_addr:a.ms_addr},a.connection_id)}))),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,iP.W_1,"local"===(null==r?void 0:r.streamUserId)?oP.UP:oP.DOWN,"","",RC()-n,this.connection_id,{type:"offer",ms_addr:this.ms_addr});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=RC(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,iP.W_0,"local"===(null==r?void 0:r.streamUserId)?oP.UP:oP.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",RC()-n,this.connection_id,{type:"answer",ms_addr:this.ms_addr}),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,iP.W_1,"local"===(null==r?void 0:r.streamUserId)?oP.UP:oP.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",RC()-n,this.connection_id,{type:"answer",ms_addr:this.ms_addr});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"createAVMlineAnswerTpl",value:function(e){var t=this;zL.parse(e).media.forEach((function(e){if("audio"===e.type){if("sendonly"===e.direction){var r,n=null==e?void 0:Nb(r=e.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&null!=e&&e.fmtp){var i,o=null==e?void 0:Nb(i=e.fmtp).call(i,(function(e){return e.payload===n.payload}));o&&t._context&&(o.config+=";stereo=1;sprop-stereo=1")}t._aSendonlyAnswerTpl=e}}else"video"===e.type&&("sendonly"===e.direction&&(t._vSendonlyAnswerTpl=e),Array.isArray(e.rtp)&&e.rtp.forEach((function(e){var r;null!==(r=e.codec)&&void 0!==r&&$m(r).call(r,"flexfec")&&(t._enableSubFlexfec=!0)})))}))}},{key:"pc",get:function(){return this._peerConnection}},{key:"addBitrateLimit",value:function(e,t){null==e||e.rtp.forEach((function(r){var n,i=r.codec,o=r.payload;if($m(n=["vp8","h264"]).call(n,i.toLocaleLowerCase())){var a,s,c=Nb(a=e.fmtp).call(a,(function(e){return e.payload===o}));if(c)c.config=xm(s=[]).call(s,Qk(c.config.split(";")),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)]).join(";");else e.fmtp.push({payload:o,config:"x-google-min-bitrate=100;x-google-start-bitrate=".concat(t)})}}))}}]),o}(Pw.exports.EventEmitter),xU=b,OU=Sg,DU=Py.exports.getWeakData,PU=Sh,NU=tr,MU=z,LU=$,UU=Bl,VU=Ye,FU=Zi.set,BU=Zi.getterFor,jU=No.find,GU=No.findIndex,HU=xU([].splice),zU=0,KU=function(e){return e.frozen||(e.frozen=new XU)},XU=function(){this.entries=[]},qU=function(e,t){return jU(e.entries,(function(e){return e[0]===t}))};XU.prototype={get:function(e){var t=qU(this,e);if(t)return t[1]},has:function(e){return!!qU(this,e)},set:function(e,t){var r=qU(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=GU(this.entries,(function(t){return t[0]===e}));return~t&&HU(this.entries,t,1),!!~t}};var WU,YU={getConstructor:function(e,t,r,n){var i=e((function(e,i){PU(e,o),FU(e,{type:t,id:zU++,frozen:void 0}),MU(i)||UU(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=BU(t),s=function(e,t,r){var n=a(e),i=DU(NU(t),!0);return!0===i?KU(n).set(t,r):i[n.id]=r,e};return OU(o,{delete:function(e){var t=a(this);if(!LU(e))return!1;var r=DU(e);return!0===r?KU(t).delete(e):r&&VU(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!LU(e))return!1;var r=DU(e);return!0===r?KU(t).has(e):r&&VU(r,t.id)}}),OU(o,r?{get:function(e){var t=a(this);if(LU(e)){var r=DU(e);return!0===r?KU(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),i}},QU=n,JU=b,ZU=Sg,$U=Py.exports,eV=yg,tV=YU,rV=$,nV=By,iV=Zi.enforce,oV=Vi,aV=!QU.ActiveXObject&&"ActiveXObject"in QU,sV=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},cV=eV("WeakMap",sV,tV);if(oV&&aV){WU=tV.getConstructor(sV,"WeakMap",!0),$U.enable();var uV=cV.prototype,dV=JU(uV.delete),lV=JU(uV.has),hV=JU(uV.get),pV=JU(uV.set);ZU(uV,{delete:function(e){if(rV(e)&&!nV(e)){var t=iV(this);return t.frozen||(t.frozen=new WU),dV(this,e)||t.frozen.delete(e)}return dV(this,e)},has:function(e){if(rV(e)&&!nV(e)){var t=iV(this);return t.frozen||(t.frozen=new WU),lV(this,e)||t.frozen.has(e)}return lV(this,e)},get:function(e){if(rV(e)&&!nV(e)){var t=iV(this);return t.frozen||(t.frozen=new WU),lV(this,e)?hV(this,e):t.frozen.get(e)}return hV(this,e)},set:function(e,t){if(rV(e)&&!nV(e)){var r=iV(this);r.frozen||(r.frozen=new WU),lV(this,e)?pV(this,e,t):r.frozen.set(e,t)}else pV(this,e,t);return this}})}var fV=ee.WeakMap;Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{emplace:eS}),Rr({target:"WeakMap",stat:!0,forced:!0},{from:zg}),Rr({target:"WeakMap",stat:!0,forced:!0},{of:Xg}),Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{deleteAll:Qg}),Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{upsert:EE});var vV=fV,_V=function(e){DI(p,e);var t,r,n,i,o,a,s,c,u,d,l,h=YI(p);function p(){var e,t,r;return Wd(this,p),sd(eI(r=h.call(this)),"inited",!1),sd(eI(r),"deviceMap",{audioinput:new bE,audiooutput:new bE,videoinput:new bE}),sd(eI(r),"checkDeviceChangeTimer",null),sd(eI(r),"isSupportedPermissionsQuery",!1),sd(eI(r),"isGrantedMicrophonePermission",!1),sd(eI(r),"isGrantedCameraPermission",!1),r.isSupportedPermissionsQuery=!wC()&&!(null===(e=navigator)||void 0===e||null===(t=e.permissions)||void 0===t||!t.query),r._handleDeviceChange=r._handleDeviceChange.bind(eI(r)),!wC()&&r.refreshDevices(),r}return qd(p,[{key:"refreshDevices",value:(l=m_(Im.mark((function e(){var t,r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices){e.next=2;break}return e.abrupt("return");case 2:if(t=void 0,!PC){e.next=12;break}return e.prev=4,e.next=7,navigator.mediaDevices.getUserMedia({audio:!0});case 7:t=e.sent,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(4);case 12:return e.next=14,navigator.mediaDevices.enumerateDevices();case 14:r=e.sent,t&&t.getTracks().forEach((function(e){return e.stop()})),r.forEach((function(e){var t;e.deviceId&&(null===(t=n.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))})),this.inited||this.initListener(),this.inited=!0;case 19:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return l.apply(this,arguments)})},{key:"initListener",value:(d=m_(Im.mark((function e(){var t,r,n,i,o=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.ondevicechange)&&"function"==typeof(null===(r=navigator.mediaDevices)||void 0===r?void 0:r.addEventListener)?navigator.mediaDevices.addEventListener("devicechange",(function(){o._handleDeviceChange(),setTimeout((function(){o._handleDeviceChange()}),300)})):this.checkDeviceChangeTimer=window.setInterval((function(){o._handleDeviceChange()}),3e3),!this.isSupportedPermissionsQuery){e.next=22;break}return e.prev=2,e.next=5,navigator.permissions.query({name:"microphone"});case 5:n=e.sent,this.isGrantedMicrophonePermission="granted"===n.state,n.addEventListener("change",(function(){o.isGrantedMicrophonePermission="granted"===n.state})),e.next=12;break;case 10:e.prev=10,e.t0=e.catch(2);case 12:return e.prev=12,e.next=15,navigator.permissions.query({name:"camera"});case 15:i=e.sent,this.isGrantedCameraPermission="granted"===i.state,i.addEventListener("change",(function(){o.isGrantedCameraPermission="granted"===i.state})),e.next=22;break;case 20:e.prev=20,e.t1=e.catch(12);case 22:case"end":return e.stop()}}),e,this,[[2,10],[12,20]])}))),function(){return d.apply(this,arguments)})},{key:"_handleDeviceChange",value:(u=m_(Im.mark((function e(){var t,r,n,i,o,a,s,c=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=void 0,!PC){e.next=5;break}return e.next=4,navigator.mediaDevices.getUserMedia({audio:!0});case 4:o=e.sent;case 5:return e.next=7,navigator.mediaDevices.enumerateDevices();case 7:a=e.sent,a=Gs(a).call(a,(function(e){return!!e.deviceId})),o&&o.getTracks().forEach((function(e){return e.stop()})),s=Wk(xm(t=[]).call(t,Qk(nA(r=this.deviceMap.audioinput).call(r)),Qk(nA(n=this.deviceMap.videoinput).call(n)),Qk(nA(i=this.deviceMap.audiooutput).call(i)))),a.forEach((function(e){var t,r,n=c.deviceMap[e.kind].get(e.deviceId);c.deviceMap[e.kind].set(e.deviceId,e),n||($m(t=e.kind).call(t,"video")?c.emit(Kd.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):$m(r=e.kind).call(r,"audio")&&c.emit(Kd.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),s.forEach((function(e){var t,r;Nb(a).call(a,(function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(c.deviceMap[e.kind].delete(e.deviceId),$m(t=e.kind).call(t,"video")?c.emit(Kd.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):$m(r=e.kind).call(r,"audio")&&c.emit(Kd.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"getUserMedia",value:(c=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.getUserMedia(t);case 2:return r=e.sent,null!=t&&t.audio&&(this.isGrantedMicrophonePermission=!0),null!=t&&t.video&&(this.isGrantedCameraPermission=!0),this.refreshDevices(),e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"checkPermissionsByDevices",value:(s=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={audio:!1,video:!1},navigator.mediaDevices){e.next=3;break}return e.abrupt("return",t);case 3:return e.next=5,navigator.mediaDevices.enumerateDevices();case 5:return r=e.sent,t.audio=Gs(r).call(r,(function(e){return"audioinput"===e.kind&&e.label&&e.deviceId})).length>0,t.video=Gs(r).call(r,(function(e){return"videoinput"===e.kind&&e.label&&e.deviceId})).length>0,e.abrupt("return",t);case 9:case"end":return e.stop()}}),e)}))),function(){return s.apply(this,arguments)})},{key:"getPermissions",value:(a=m_(Im.mark((function e(){var t,r,n,i,o,a,s,c=this,u=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>0&&void 0!==u[0]?u[0]:{},n=r.audio,i=r.video,o=r.force,n||i||(n=!0,i=!0),a={audio:!1,video:!1},o){e.next=30;break}if(!this.isSupportedPermissionsQuery){e.next=20;break}if(!n||!i){e.next=14;break}if(!this.isGrantedMicrophonePermission||!this.isGrantedCameraPermission){e.next=12;break}return a.audio=!0,a.video=!0,e.abrupt("return",a);case 12:e.next=18;break;case 14:if(!(n&&this.isGrantedMicrophonePermission||i&&this.isGrantedCameraPermission)){e.next=18;break}return a.audio=this.isGrantedMicrophonePermission,a.video=this.isGrantedCameraPermission,e.abrupt("return",a);case 18:case 26:e.next=30;break;case 20:return e.next=22,this.checkPermissionsByDevices();case 22:if(s=e.sent,!n||!i){e.next=28;break}if(!s.audio||!s.video){e.next=26;break}return e.abrupt("return",s);case 28:if(!(n&&s.audio||i&&s.video)){e.next=30;break}return e.abrupt("return",s);case 30:if(null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=33;break}return e.next=33,navigator.mediaDevices.getUserMedia({audio:n,video:i}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),n&&(a.audio=!0,c.isGrantedMicrophonePermission=!0),i&&(a.video=!0,c.isGrantedCameraPermission=!0))})).catch((function(){}));case 33:return e.next=35,this.refreshDevices();case 35:return e.abrupt("return",a);case 36:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"enumerateDevices",value:(o=m_(Im.mark((function e(){var t,r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions();case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Wk(xm(t=[]).call(t,Qk(nA(r=this.deviceMap.audioinput).call(r)),Qk(nA(n=this.deviceMap.videoinput).call(n)),Qk(nA(i=this.deviceMap.audiooutput).call(i)))));case 5:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(i=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Wk(nA(t=this.deviceMap.audioinput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(n=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({video:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Wk(nA(t=this.deviceMap.videoinput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(r=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Wk(nA(t=this.deviceMap.audiooutput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getDeviceById",value:(t=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.enumerateDevices();case 2:return r=e.sent,e.abrupt("return",Nb(r).call(r,(function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),p}(ex),mV=new _V;!wC()&&(window.__rtc_dd__=mV);var yV=function(){function e(){Wd(this,e),sd(this,"_audioContextInstance",void 0)}return qd(e,[{key:"getAudioContextInstance",value:function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance}}]),e}(),gV=function(){function e(t){Wd(this,e),sd(this,"_ctx",void 0),sd(this,"_analyserNode",void 0),sd(this,"_audioSource",void 0);var r=SV.getAudioContextInstance();if(t instanceof MediaStreamTrack){var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n)}else this._audioSource=r.createMediaElementSource(t),this._audioSource.connect(r.destination);var i=r.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=r}var t;return qd(e,[{key:"getAudioLevel",value: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 r=0;t.forEach((function(e){return r=Math.max(r,Math.abs(e-128))}));var n=r/128*255;return n>2?n:0}},{key:"resume",value:(t=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this._ctx)||void 0===t?void 0:t.resume();case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._audioSource.disconnect(),this._analyserNode.disconnect()}}]),e}(),SV=new yV,EV=function(e){return e[e.CAPTURE=0]="CAPTURE",e[e.PRE_PROCESSING=1]="PRE_PROCESSING",e[e.ENCODE=2]="ENCODE",e[e.TRANSFER=3]="TRANSFER",e[e.POST_PROCESSING=4]="POST_PROCESSING",e[e.DECODE=5]="DECODE",e[e.RENDERING=6]="RENDERING",e}(EV||{}),bV=function(){function e(){Wd(this,e),sd(this,"_plugins",new bE),sd(this,"_monitor",void 0)}var t;return qd(e,[{key:"setMinotor",value:function(e){this._monitor=e}},{key:"register",value:function(e){e.monitor=this._monitor;var t=this._plugins.get(e.type)||[];if(YA(t).call(t,(function(t){return t.name===e.name}))>-1)throw new Error("Failed to register ".concat(e.name,": name is repeated."));t.push(e),this._plugins.set(e.type,t)}},{key:"getPluginsByType",value:function(e){return this._plugins.get(e)||[]}},{key:"getPluginByName",value:function(e,t){var r;return Nb(r=this._plugins.get(e)||[]).call(r,(function(e){return e.name===t}))}},{key:"getPreProcessingTrack",value:(t=m_(Im.mark((function e(t){var r,n,i,o,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._plugins.get(1)||[],n=t.getTrack(),i=ZT(r),e.prev=3,i.s();case 5:if((o=i.n()).done){e.next=12;break}return a=o.value,e.next=9,a.effect(t,n);case 9:n=e.sent;case 10:e.next=5;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),i.e(e.t0);case 17:return e.prev=17,i.f(),e.finish(17);case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[3,14,17,20]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._plugins.forEach((function(e){e.forEach((function(e){return e.destroy()}))})),this._plugins.clear()}}]),e}(),kV=function(e){return e[e.EXTERNAL=0]="EXTERNAL",e[e.INTERNAL=1]="INTERNAL",e}(kV||{}),TV=new Jw("VERTC",0),IV=new vV,AV=function(e){DI(r,e);var t=YI(r);function r(e,n){var i;return Wd(this,r),sd(eI(i=t.call(this)),"sourceType",1),sd(eI(i),"mediaType",void 0),sd(eI(i),"_trackId",void 0),i._trackId=e,i.mediaType=n,i}return qd(r,[{key:"getId",value:function(){return this._trackId}}]),r}(ex),RV=function(e){DI(n,e);var t,r=YI(n);function n(e,t,i){var o;return Wd(this,n),sd(eI(o=r.call(this,t,i)),"_mediaTrack",void 0),sd(eI(o),"_preProcessingTrack",void 0),sd(eI(o),"handleTrackEnded",(function(){CP.rtcError("track-ended mediaType: ".concat(o._mediaTrack.kind),-1001),o.emit("track-ended",eI(o))})),o._mediaTrack=e,o._initListeners(),o}return qd(n,[{key:"getTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"origin";return"origin"===e?this._mediaTrack:this._preProcessingTrack||this._mediaTrack}},{key:"setTrack",value:function(e,t){this._mediaTrack=e,t&&this.generatePreProcessingTrack(t)}},{key:"generatePreProcessingTrack",value:(t=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.getPreProcessingTrack(this);case 3:(r=e.sent)instanceof MediaStreamTrack&&(this._preProcessingTrack=r),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return t.apply(this,arguments)})},{key:"close",value:function(){var e,t,r;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._mediaTrack)||void 0===e||e.removeEventListener("ended",this.handleTrackEnded),null===(t=this._preProcessingTrack)||void 0===t||t.stop(),null===(r=this._mediaTrack)||void 0===r?void 0:r.stop()}},{key:"_initListeners",value:function(){this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",this.handleTrackEnded)}}]),n}(AV),CV=function(e){DI(r,e);var t=YI(r);function r(e,n,i){var o;return Wd(this,r),sd(eI(o=t.call(this,n,i)),"_mediaTrack",void 0),o._mediaTrack=e,o}return qd(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(AV),wV=function(e){DI(n,e);var t,r=YI(n);function n(e,t){var i;return Wd(this,n),sd(eI(i=r.call(this,e,t,"video")),"resolution",void 0),sd(eI(i),"dummy",!1),i.resolution={width:0,height:0},i}return qd(n,[{key:"updateVideoCaptureConfig",value:(t=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.getTrack()){e.next=2;break}return e.abrupt("return");case 2:return TV.print("updateVideoEncoderConfig","update localVideoTrack: ",t),delete(r=ud({},t)).contentHint,PC&&(r.frameRate={ideal:30,max:30}),e.next=8,this.getTrack().applyConstraints(r);case 8:((n=this.getTrack().getSettings()).width&&n.width!==this.resolution.width||n.height&&n.height!==this.resolution.height)&&(this.resolution={width:n.width,height:n.height},this.emit("resolution-change",this.resolution));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"replaceTrack",value:function(e){this.setTrack(e)}},{key:"setContentHint",value:function(e){var t;this._mediaTrack&&"contentHint"in this._mediaTrack&&$m(t=["text","motion","detail"]).call(t,e)&&(this._mediaTrack.contentHint=e)}}]),n}(RV),xV=function(e){DI(n,e);var t,r=YI(n);function n(e,t){var i;return Wd(this,n),sd(eI(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),sd(eI(i),"_audioLevelFetcher",void 0),sd(eI(i),"mixedAudioTrack",void 0),sd(eI(i),"mixType",Gd.PLAYOUT_AND_PUBLISH),i}return qd(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new gV(this.getTrack("preprocessing"))),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.audioCaptureConfig){e.next=2;break}return e.abrupt("return");case 2:return TV.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),e.next=5,null===(t=this.getTrack())||void 0===t?void 0:t.applyConstraints(this.audioCaptureConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),n}(RV),OV=function(e){DI(r,e);var t=YI(r);function r(e,n){return Wd(this,r),t.call(this,e,n,"video")}return qd(r)}(CV),DV=function(e){DI(r,e);var t=YI(r);function r(e,n){var i;return Wd(this,r),sd(eI(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return qd(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new gV(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(CV),PV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,o))),"streamIndex",gd.STREAM_INDEX_MAIN),n}return qd(r)}(xV),NV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,o))),"streamIndex",gd.STREAM_INDEX_MAIN),n}return qd(r)}(wV),MV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,o))),"streamIndex",gd.STREAM_INDEX_MAIN),sd(eI(n),"sourceType",0),n}return qd(r)}(wV),LV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,o))),"streamIndex",gd.STREAM_INDEX_MAIN),sd(eI(n),"sourceType",0),n}return qd(r)}(xV),UV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,o))),"streamIndex",gd.STREAM_INDEX_SCREEN),n}return qd(r)}(wV),VV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,o))),"streamIndex",gd.STREAM_INDEX_SCREEN),n}return qd(r)}(xV),FV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,o))),"streamIndex",gd.STREAM_INDEX_SCREEN),sd(eI(n),"sourceType",0),n}return qd(r)}(wV),BV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,o))),"streamIndex",gd.STREAM_INDEX_SCREEN),sd(eI(n),"sourceType",0),n}return qd(r)}(xV);function jV(e,t){return GV.apply(this,arguments)}function GV(){return(GV=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new NV(t,AC())).dummy=!0,e.next=4,n.generatePreProcessingTrack(r);case 4:return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function HV(e,t){return zV.apply(this,arguments)}function zV(){return(zV=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new UV(t,AC())).dummy=!0,e.next=4,n.generatePreProcessingTrack(r);case 4:return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function KV(e,t){return XV.apply(this,arguments)}function XV(){return(XV=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=1,TV.print("createCameraVideoTrack","constraints:",t),CP.rtcVideoCaptureEvent({event_type:bP.START,media_device_id:o}),a=RC(),PC&&(t.frameRate={ideal:30,max:30}),e.next=8,mV.getUserMedia({video:t});case 8:i=e.sent,CP.rtcVideoCaptureEvent({event_type:bP.START_CAPTURE_RESULT,media_device_id:o,reason:kP.SUCCESS,elapse:RC()-a}),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(1),CP.rtcVideoCaptureEvent({event_type:bP.RUNNING_FAILED,media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new pR(lR.GET_VIDEO_TRACK_FAILED,xm(s="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(s,e.t0.message||"unknown message","."),e.t0);case 16:return c=i.getVideoTracks()[0],IV.set(c,i),u=new NV(c,AC()),e.next=21,u.generatePreProcessingTrack(r);case 21:return e.abrupt("return",u);case 22:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}function qV(e,t){return WV.apply(this,arguments)}function WV(){return(WV=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return TV.print("createMicrophoneAudioTrack","constraints:",t),o=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=2,CP.rtcVideoCaptureEvent({event_type:bP.START,media_device_id:o}),a=RC(),(s=r.getPluginByName(EV.PRE_PROCESSING,"RTCAIAnsExtension"))&&(s.isOpen()?(t.autoGainControl=!0,t.noiseSuppression=!1):t.noiseSuppression=!0),e.next=9,mV.getUserMedia({audio:t});case 9:i=e.sent,CP.rtcVideoCaptureEvent({event_type:bP.START_CAPTURE_RESULT,media_device_id:o,reason:kP.SUCCESS,elapse:RC()-a}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(2),CP.rtcVideoCaptureEvent({event_type:bP.RUNNING_FAILED,media_device_id:o,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new pR(lR.GET_AUDIO_TRACK_FAILED,xm(c="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(c,e.t0.message||"unknown message","."),e.t0);case 17:return u=i.getAudioTracks()[0],IV.set(u,i),d=new PV(u,AC()),e.next=22,d.generatePreProcessingTrack(r);case 22:return e.abrupt("return",d);case 23:case"end":return e.stop()}}),e,null,[[2,13]])})))).apply(this,arguments)}function YV(){return QV.apply(this,arguments)}function QV(){return QV=m_(Im.mark((function e(){var t,r,n,i,o,a,s,c,u,d=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=d.length>0&&void 0!==d[0]&&d[0],r=d.length>1?d[1]:void 0,n=d.length>2?d[2]:void 0,TV.print("createScreenTracks","withAudio: %o, constraints: %o",t,n),e.prev=4,CP.rtcVideoCaptureEvent({event_type:bP.START,media_device_id:"screen"}),o=RC(),e.next=9,navigator.mediaDevices.getDisplayMedia({video:!(n&&(!NC||16!==VC))||n,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 9:i=e.sent,CP.rtcVideoCaptureEvent({event_type:bP.START_CAPTURE_RESULT,media_device_id:"screen",reason:kP.SUCCESS,elapse:RC()-o}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),CP.rtcVideoCaptureEvent({event_type:bP.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new pR(lR.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 17:return a=i.getVideoTracks()[0],s=new UV(a,AC()),e.next=21,s.generatePreProcessingTrack(r);case 21:if(!(c=i.getAudioTracks()[0])){e.next=27;break}return u=new VV(c,AC()),e.next=26,u.generatePreProcessingTrack(r);case 26:return e.abrupt("return",[s,u]);case 27:return e.abrupt("return",[s,void 0]);case 28:case"end":return e.stop()}}),e,null,[[4,13]])}))),QV.apply(this,arguments)}function JV(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:AC();return new DV(e,t)}function ZV(e,t){return $V.apply(this,arguments)}function $V(){return($V=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new MV(t,AC()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function eF(e,t){return tF.apply(this,arguments)}function tF(){return(tF=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new LV(t,AC()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function rF(e,t){return nF.apply(this,arguments)}function nF(){return(nF=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new FV(t,AC()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function iF(e,t){return oF.apply(this,arguments)}function oF(){return(oF=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new BV(t,AC()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var aF=xV,sF=function(e){return e[e.NONE=0]="NONE",e}(sF||{}),cF=function(){function e(){Wd(this,e)}return qd(e,null,[{key:"getNalunits",value:function(t){if(t.length-t.position<4)return[];var r=t.position;return 1===t.getInt32(r)||0===t.getInt16(r)&&1===t.getInt8(r+2)?e.getAnnexbNals(t):e.getAvccNals(t)}},{key:"getAnnexbNals",value:function(t){for(var r=[],n=e.getHeaderPositionAnnexB(t),i=n.pos,o=i;i<t.length-4;){var a,s,c=new Uint8Array(km(a=t.buffer).call(a,i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var u={header:c,body:new Uint8Array(km(s=t.buffer).call(s,i+c.byteLength,o)),type:-1};e.analyseNal(u),u.type<=9&&0!==u.type&&r.push(u),t.skip(o-t.position),i=o}return r}},{key:"getAvccNals",value:function(t){for(var r=[];t.position<t.length-4;){var n=t.getInt32(t.position);if(!(t.length-t.position>=n))break;var i,o,a=new Uint8Array(km(i=t.buffer).call(i,t.position,t.position+4));t.skip(4);var s=new Uint8Array(km(o=t.buffer).call(o,t.position,t.position+n));t.skip(n);var c={header:a,body:s,type:-1};e.analyseNal(c),c.type<=9&&0!==c.type&&r.push(c)}return r}},{key:"analyseNal",value: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}}},{key:"getHeaderPositionAnnexB",value:function(e){for(var t=e.position,r=0,n=e.length;3!==r&&4!==r&&t<n-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===n-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=n:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=n)),{pos:t,headerLength:r}}}]),e}(),uF=function(){function e(t){Wd(this,e),sd(this,"_position",0),sd(this,"_dataview",void 0),this._dataview=new DataView(t)}return qd(e,[{key:"length",get:function(){return this.buffer.byteLength}},{key:"buffer",get:function(){return this._dataview.buffer}},{key:"position",get:function(){return this._position},set:function(e){this._position=e}},{key:"back",value:function(e){this.position-=e}},{key:"getUint8",value:function(e){return this._dataview.getUint8(e)}},{key:"getInt8",value:function(e){return this._dataview.getInt8(e)}},{key:"getInt16",value:function(e){return this._dataview.getInt16(e)}},{key:"getUint16",value:function(e){return this._dataview.getUint16(e)}},{key:"getUint32",value:function(e){return this._dataview.getUint32(e)}},{key:"getInt32",value:function(e){return this._dataview.getInt32(e)}},{key:"skip",value:function(t){for(var r=Math.floor(t/4),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)}},{key:"readUint8",value:function(){return e.readByte(this,1)}},{key:"readUint16",value:function(){return e.readByte(this,2)}},{key:"readUint24",value:function(){return e.readByte(this,3)}},{key:"readUint32",value:function(){return e.readByte(this,4)}},{key:"readUint64",value:function(){return e.readByte(this,8)}},{key:"readInt8",value:function(){return e.readByte(this,1,!0)}},{key:"readInt16",value:function(){return e.readByte(this,2,!0)}},{key:"readInt32",value:function(){return e.readByte(this,4,!0)}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}}],[{key:"readByte",value:function(e,t,r){var n;switch(t){case 1:n=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:n=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");n=e.getUint8(e.position)<<16,n|=e.getUint8(e.position+1)<<8,n|=e.getUint8(e.position+2);break;case 4:n=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");n=e.getUint32(e.position)<<32,n|=e.getUint32(e.position+4);break;default:n=""}return e.position+=t,n}}]),e}(),dF=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(dF||{}),lF=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),hF=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),pF=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]&&t.push(3),t.push(e[r]);return new Uint8Array(t)};function fF(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function vF(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0;255===e[t]&&t<e.byteLength;)t++,r+=255;return t<e.byteLength&&(r+=e[t++]),[r,t]}var _F=function(){function e(){Wd(this,e)}return qd(e,null,[{key:"generateSEI",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint8Array([0,0,0,1]),i=new Uint8Array([6]),o=new Uint8Array([5]),a=r?lF:hF,s=fF(e.byteLength+a.byteLength),c=pF(e);return new Uint8Array(xm(t=[]).call(t,Qk(n),Qk(i),Qk(o),Qk(s),Qk(a),Qk(c),[128]))}},{key:"decodeSeiBody",value:function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=km(e).call(e,0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=$T(vF(t,r+=2),2),i=n[0],o=2,a=(r=n[1])+i;return t.byteLength>=hF.byteLength&&i>=hF.byteLength&&km(t).call(t,r,r+hF.byteLength).toString()===hF.toString()?(r+=hF.byteLength,o=1):t.byteLength>=hF.byteLength&&i>=hF.byteLength&&km(t).call(t,r,r+lF.byteLength).toString()===lF.toString()&&(r+=lF.byteLength,o=0),{type:o,payload:km(t).call(t,r,a)}}}}},{key:"parseInternalSEI",value:function(e){var t=new bE,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=$T(vF(e.payload,r),2),i=n[0];r=n[1];var o,a=$T(vF(e.payload,r),2),s=a[0];if(r=a[1],t.get(i)||!(s<=e.payload.byteLength-r))break;t.set(i,km(o=e.payload).call(o,r,r+s)),r+=s}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=ZT(e);try{for(n.s();!(t=n.n()).done;){var i=$T(t.value,2),o=i[0],a=i[1],s=fF(o),c=fF(a.byteLength);r.push(s,c,a)}}catch(l){n.e(l)}finally{n.f()}var u=LE(r).call(r,(function(e,t){return e+t.byteLength}),0),d=new Uint8Array(u);return LE(r).call(r,(function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),mF=function(){function e(t){Wd(this,e),sd(this,"player",void 0),sd(this,"_stream",void 0),sd(this,"_timer",void 0),sd(this,"client",void 0),sd(this,"handler",void 0),sd(this,"monitor",void 0),this._stream=t}return qd(e,[{key:"setVar",value:function(e,t,r){this.client=e,this.handler=t,this.monitor=r}},{key:"delStatsEvtInterval",value:function(){var e;clearTimeout(this._timer),this._timer=void 0,null===(e=this.monitor)||void 0===e||e.rtcInvokeStatus("".concat((new Error).stack),0,"del_media_statistics_timer",this._stream.streamId||"",0)}},{key:"filterIllegal",value:function(e){var t={};return an(e).forEach((function(r){null===e[r]||void 0===e[r]||Number.isNaN(e[r])||(t[r]=e[r])})),t}},{key:"destroy",value:function(){var e;null===(e=this.monitor)||void 0===e||e.rtcInvokeStatus("".concat((new Error).stack),0,"media_statistics_destroy","".concat(this._stream.streamId),0),this.delStatsEvtInterval()}}]),e}(),yF=function(e){DI(i,e);var t,r,n=YI(i);function i(e){var t;return Wd(this,i),sd(eI(t=n.call(this,e)),"_context",void 0),t._stream=e,t}return qd(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r,n){var i,o,a,s=this;if(!this._timer){this.setVar(e,t,r),this._context=n,e.once(hN.ABNORMAL_DISCONNECTION,(function(){s.destroy()}));var c={audio:{},video:{}},u=this._stream,d=null===(i=u.audioTrack)||void 0===i?void 0:i.getTrack("preprocessing"),l=null===(o=u.videoTrack)||void 0===o?void 0:o.getTrack("preprocessing");this.getAudioStats(d,c,null===(a=u.audioTrack)||void 0===a?void 0:a.getAudioLevel()),this.getVideoStats(l,c),this.delStatsEvtInterval();var h=function(){var e=m_(Im.mark((function e(){var t,r,n,i,o,a,d;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=u.audioTrack)||void 0===t?void 0:t.getTrack("preprocessing"),o=null===(r=u.videoTrack)||void 0===r?void 0:r.getTrack("preprocessing"),e.next=4,s.getAudioStats(i,c,null===(n=u.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return a=e.sent,e.next=7,s.getVideoStats(o,c);case 7:return d=e.sent,e.abrupt("return",{audioStats:a,videoStats:d,isScreen:u.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h();case 2:r=e.sent,null===(t=s.client)||void 0===t||t.emit("onLocalStreamStats",r),s._timer&&clearTimeout(s._timer),s._timer=setTimeout(p,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer&&clearTimeout(this._timer),this._timer=setTimeout(p,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=m_(Im.mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},o={timestamp:Date.now()},a=this._stream,s=a.streamId,c=a.audioMid,u=a.isScreen,d=a.pubAttributes,l=a.pubAudio,h={media_type:"audio",is_screen:!!u,direction:"up",stream_id:s,vid:c,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:d.localaudio?"capture_state_on":"capture_state_off",mute_state:l?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",i);case 6:return e.next=8,this.handler.getStats(t);case 8:if((p=e.sent).length){e.next=11;break}return e.abrupt("return",i);case 11:if(p.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,u=e.channels,d=e.audioLevel;e.googRtt;var l=e.mimeType,p=e.availableIncomingBitrate,f=e.availableOutgoingBitrate,v=e.bytesReceived,_=e.nominated,m=e.id,y=e.currentRoundTripTime,g=e.state,S=e.writable,E=e.requestsReceived,b=e.responsesReceived,k=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,A=e.jitter,R=e.candidateType,C=e.ip,w=e.address,x=e.networkType,O=e.port,D=e.protocol,P=e.nackCount,N=e.retransmittedBytesSent,M=e.retransmittedPacketsSent,L=e.audioInputLevel,U=e.ssrc,V=e.totalAudioEnergy,F=e.totalSamplesDuration,B=e.mediaType,j=e.fractionLost;"outbound-rtp"===t?(o.packetsSent=r,o.bytesSent=a,h.bytes=a,h.packetsSent=r,h.nackCount=P,h.ssrc=U,h.retransmitted_bytes_sent=N,h.retransmitted_packets_sent=M,o.retransmittedBytesSent=N,o.retransmittedPacketsSent=M):"remote-inbound-rtp"===t?(o.packetsLost=n,h.packetsLost=n,h.net_jitter=1e3*A,i.rtt=1e3*c,h.rtt=i.rtt,i._fractionLost=j||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=u,h.codecName=l):"media-source"===t&&void 0!==d?(h.audio_level=d?-10*YR(Math.pow(d,2)):d,h.volume=255*d,h.total_audio_energy=V,h.totalInputDuration=F):"ssrc"===t&&"audio"===B?h.send_level=L:"candidate-pair"===t?(h.ice_available_incoming_bitrate=p,h.ice_available_outgoing_bitrate=f,h.ice_bytes_received=v,h.ice_bytes_sent=a,h.ice_nominated=+_,h.ice_pair_id=m,h.ice_pair_rtt=y,h.ice_pair_state=g,h.ice_pair_writable=S,h.recv_ping_requests=E,h.recv_ping_responses=b,h.sent_ping_requests_before_first_response=k,h.sent_ping_requests_total=k+(T||0),h.sent_ping_responses=I):"local-candidate"===t?(h.local_candidate_type=R,h.local_ip=C||w,h.local_network_type=x,h.local_port=O,h.protocol=D):"remote-candidate"===t&&(h.remote_candidate_type=R,h.remote_ip=C||w,h.remote_port=O);var G=rN("STATS_SCALLBACK_SUPPORT");DC&&G||"media-source"===t&&(h.send_level=d)})),void 0===h.volume&&void 0!==n&&(h.volume=n,h.audio_level=n?-10*YR(Math.pow(n/255,2)):n),(f=r.audio).timestamp){e.next=17;break}return r.audio=o,e.abrupt("return",this.filterIllegal(i));case 17:return void 0!==o.packetsLost&&(i.audioLossRate=(o.packetsLost-f.packetsLost)/(o.packetsSent-f.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,h.fraction_lost=i.audioLossRate),i.statsInterval=o.timestamp-f.timestamp,h.stats_interval=i.statsInterval,i.sendKBitrate=(o.bytesSent-f.bytesSent||0)/i.statsInterval*8,h.mediaBitratebps=Math.round(1e3*i.sendKBitrate),h.bandwidth=Math.round(h.mediaBitratebps/1024),void 0!==o.retransmittedBytesSent&&(h.retransmitBitratebps=(o.retransmittedBytesSent-f.retransmittedBytesSent||0)/i.statsInterval),r.audio=o,this.monitor.rtcMediaStatistics(h,{}),i._retransmittedRate=(o.retransmittedPacketsSent-f.retransmittedPacketsSent)/(o.packetsSent-f.packetsSent),void 0===i.audioLossRate&&(i.audioLossRate=i._retransmittedRate,h.fraction_lost=i.audioLossRate),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),e.abrupt("return",this.filterIllegal(i));case 30:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},a={timestamp:Date.now(),simulcast:{}},s=this._stream,c=s.streamId,u=s.videoMid,d=s.isScreen,l=s.pubAttributes,h=s.enableSimulcast,p=s.pubVideo,f={media_type:"video",is_screen:!!d,direction:"up",stream_id:c,vid:u,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:l.localvideo?"capture_state_on":"capture_state_off",mute_state:p?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",o);case 6:return f.cap_frame_width=t.getSettings().width,f.cap_frame_height=t.getSettings().height,o.isScreen=d,e.next=11,this.handler.getStats(t);case 11:if((v=e.sent).length){e.next=14;break}return e.abrupt("return",o);case 14:if(null===(n=this.monitor)||void 0===n||n.rtcInvokeStatus(xm(i="reports.length: ".concat(v.length,"; videoTrack: ")).call(i,t.id),0,"get_video_stats",c||"",0),_=0,v.forEach((function(e){var n=e.type,i=e.framesEncoded,s=e.packetsLost,c=e.bytesSent,u=e.framesSent,d=e.retransmittedBytesSent,l=e.totalPacketSendDelay,p=e.totalEncodeTime,v=e.firCount,m=e.targetBitrate,y=e.roundTripTime,g=e.mimeType,S=e.frameWidth,E=e.frameHeight,b=e.packetsSent,k=e.googActualEncBitrate,T=e.googAvailableReceiveBandwidth,I=e.googAvailableSendBandwidth,A=e.googAvgEncodeMs,R=e.googBucketDelay,C=e.googEncodeUsagePercent,w=e.googFrameRateInput,x=e.availableIncomingBitrate,O=e.availableOutgoingBitrate,D=e.bytesReceived,P=e.nominated,N=e.id,M=e.currentRoundTripTime,L=e.state,U=e.writable,V=e.candidateType,F=e.ip,B=e.address,j=e.networkType,G=e.port,H=e.nackCount,z=e.pliCount,K=e.protocol,X=e.qpSum,q=e.requestsReceived,W=e.responsesReceived,Y=e.googRetransmitBitrate,Q=e.requestsSent,J=e.consentRequestsSent,Z=e.responsesSent,$=e.ssrc,ee=e.googTargetEncBitrate,te=e.googTransmitBitrate,re=e.retransmittedPacketsSent,ne=e.encoderImplementation,ie=e.jitter,oe=e.rid,ae=e.fractionLost,se=e.googAdaptationChanges,ce=e.qualityLimitationReason,ue=e.qualityLimitationDurations,de=e.googFirsReceived,le=e.googFrameRateSent,he=e.keyFramesEncoded;"outbound-rtp"===n?(h&&(oe?a.simulcast[oe]=e:a.simulcast[_]=e,_++),a.framesEncoded=i||a.framesEncoded||0,f.key_frames_encoded=he||0,a.bytesSent=c||a.bytesSent||0,a.framesSent=u||a.framesSent||0,f.bytes=c||f.bytes||0,a.packetsSent=b||a.packetsSent||0,f.packetsSent=b||f.packetsSent||0,f.nackCount=H||f.nackCount||0,f.pli_count=z||f.pli_count||0,f.qp_sum=X||f.qp_sum||0,f.ssrc=$||f.ssrc||0,f.retransmitted_packets_sent=re,a.retransmittedPacketsSent=re,a.retransmittedBytesSent=d,f.encoder_implementation=ne,f.qualityLimitationReason=ce,f.qualityLimitationDurations=ue,void 0!==S&&((!o.encodedFrameWidth||S>o.encodedFrameWidth)&&(o.encodedFrameWidth=S),(!o.encodedFrameHeight||E>o.encodedFrameHeight)&&(o.encodedFrameHeight=E),f.frame_size_height=E,f.frame_size_width=S)):"track"===n?(o.encodedFrameWidth=S,o.encodedFrameHeight=E,f.frame_size_height=E,f.frame_size_width=S):"remote-inbound-rtp"===n?(a.packetsLost=s,o.rtt=1e3*y,f.rtt=o.rtt,f.jitter=ie,f.packetsLost=s,o._fractionLost=ae||0):"codec"===n?(o.codecType=g,f.codecName=g):"candidate-pair"===n?(f.ice_available_incoming_bitrate=x,f.ice_available_outgoing_bitrate=O,f.ice_bytes_received=D,f.ice_bytes_sent=c,f.ice_nominated=+P,f.ice_pair_id=N,f.ice_pair_rtt=M,f.ice_pair_state=L,f.ice_pair_writable=U,f.recv_ping_requests=q,f.recv_ping_responses=W,f.sent_ping_requests_before_first_response=Q,f.sent_ping_requests_total=Q+J,f.sent_ping_responses=Z):"local-candidate"===n?(f.local_candidate_type=V,f.local_ip=F||B,f.local_network_type=j,f.local_port=G,f.protocol=K):"remote-candidate"===n?(f.remote_candidate_type=V,f.remote_ip=F||B,f.remote_port=G):"VideoBwe"===n?(f.encBitratebps=k,f.available_receive_bandwidth=T,f.available_send_bandwidth=I,f.bucket_delay=R,f.retransmitBitratebps=Y,f.targetEncBitratebps=ee,f.transmit_bitrate=te,o._sendBandWidth=+I):"ssrc"===n&&(f.avg_encode_ms=A,f.encodeUsage=C,f.frame_rate_input=w,f.orignal_input_Framerate=+w,f.ddaptationChanges=se,f.firsReceived=de,f.frameRateSent=le);var pe=rN("STATS_SCALLBACK_SUPPORT");if(!DC||!pe){var fe=r.video,ve=a.timestamp-fe.timestamp;if("outbound-rtp"===n){var _e=c-fe.bytesSent,me=d-fe.retransmittedBytesSent;f.encBitratebps=Math.round(8e3*(_e-me)/ve),f.bucket_delay=l/b,f.retransmitBitratebps=Math.round(8e3*me/ve),f.targetEncBitratebps=m,f.transmit_bitrate=Math.round(1e3*(c-fe.bytesSent)*8/ve),f.avg_encode_ms=1e3*p/i,f.firsReceived=v+z}else"candidate-pair"===n&&(f.available_send_bandwidth=O,o._sendBandWidth=O);if(t){var ye=null==t?void 0:t.getSettings().frameRate;f.orignal_input_Framerate=ye,f.frameRateSent=t.getSettings().frameRate}}})),(m=r.video).timestamp){e.next=21;break}return r.video=a,e.abrupt("return",this.filterIllegal(o));case 21:return o.statsInterval=a.timestamp-m.timestamp,f.stats_interval=o.statsInterval,y=an(a.simulcast),h?(f.sim_enc_width=[],f.sim_enc_height=[],f.sim_enc_bps=[],f.sim_enc_framerate=[],f.sim_enc_key_frames=[],f.sim_rids=[],f.sim_enc_bandwidth=[],f.sim_sent_framerate=[],f.sim_fraction_lost=[],f.sim_keyencoded=[],f.active_sim_streams=(null===(g=this._context)||void 0===g?void 0:g.activeSimStreams)||[],f.sim_retransmittedRate=[],S=!1,BA(y).call(y,(function(e,t){return+e-+t})).forEach((function(e){var t=a.simulcast[e],r=t.frameWidth,n=t.frameHeight,i=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,h=t.qualityLimitationDurations,p=t.qualityLimitationResolutionChanges,v=t.retransmittedPacketsSent,_=t.pliCount,y=t.keyFramesEncoded;void 0!==l&&(f.sim_qualityLimitationReason||(f.sim_qualityLimitationReason=[],f.sim_qualityLimitationDurations=[],f.sim_qualityLimitationResolutionChanges=[]),f.sim_qualityLimitationReason.push(l),f.sim_qualityLimitationDurations.push(h),f.sim_qualityLimitationResolutionChanges.push(p));var g=m.simulcast[e];if(f.sim_enc_width.push(r||0),f.sim_enc_height.push(n||0),f.sim_enc_key_frames.push(y||0),g){var E=(i-g.bytesSent||0)/o.statsInterval;f.sim_enc_bps.push(Math.round(8e3*E)),f.sim_enc_bandwidth.push(Math.round(8e3*E/1024));var b=1e3*(s-g.framesEncoded)/o.statsInterval;f.sim_enc_framerate.push(Math.round(b)),f.sim_rids.push(e);var k=void 0!==c?c-g.framesSent:s-g.framesEncoded,T=1e3*k/o.statsInterval;f.sim_sent_framerate.push(Math.round(T));var I=(u-g.packetsLost)/(d-g.packetsSent);o._retransmittedRate=(v-g.retransmittedPacketsSent)/(d-g.packetsSent),I=Number.isNaN(I)?0:I,f.sim_fraction_lost.push(I),f.sim_keyencoded.push(_-g.pliCount>0),f.sim_retransmittedRate.push(o._retransmittedRate),r>0&&!S&&(o.sentKBitrate=8*E,o.encoderOutputFrameRate=b,o.encodedFrameCount=k,o.sentFrameRate=T,o.videoLossRate=I,S=!0)}})),this.monitor.rtcMediaStatistics(f,{})):(o.encodedFrameCount=void 0!==a.framesSent?a.framesSent-m.framesSent:a.framesEncoded-m.framesEncoded,o.sentKBitrate=(a.bytesSent-m.bytesSent||0)/o.statsInterval*8,f.bitrate=Math.round(1e3*o.sentKBitrate),f.bandwidth=Math.round(f.bitrate/1024),o.encoderOutputFrameRate=1e3*(a.framesEncoded-m.framesEncoded)/o.statsInterval,f.frame_rate_encoded=Math.round(o.encoderOutputFrameRate),o.sentFrameRate=1e3*o.encodedFrameCount/o.statsInterval,f.frame_rate_sent=Math.round(o.sentFrameRate),o.videoLossRate=(a.packetsLost-m.packetsLost)/(a.packetsSent-m.packetsSent),o.videoLossRate=Number.isNaN(o.videoLossRate)?0:o.videoLossRate,f.fraction_lost=o.videoLossRate,o._retransmittedRate=(a.retransmittedPacketsSent-m.retransmittedPacketsSent)/(a.packetsSent-m.packetsSent),this.monitor.rtcMediaStatistics(f,{})),r.video=a,o._fractionLost=Math.max(o._fractionLost,o.videoLossRate),e.abrupt("return",this.filterIllegal(o));case 28:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(mF),gF=function(e){DI(o,e);var t,r,n,i=YI(o);function o(e){var t;return Wd(this,o),sd(eI(t=i.call(this,e)),"isPaused",void 0),sd(eI(t),"pauseStart",void 0),sd(eI(t),"pauseDuration",void 0),sd(eI(t),"_audioStallCount",void 0),sd(eI(t),"_setAudioStallCount",void 0),sd(eI(t),"_audioStallTimer",void 0),sd(eI(t),"_audioStallInterval",void 0),sd(eI(t),"_audioStallRatio",void 0),sd(eI(t),"_videoInWaiting",void 0),sd(eI(t),"_context",void 0),t._videoInWaiting=!1,t.pauseDuration=0,t}return qd(o,[{key:"setRemoteStreamStatsEvtInterval",value:(n=m_(Im.mark((function e(t,r,n,i){var a,s,c,u,d,l,h,p,f,v,_,m,y,g,S=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._timer){e.next=2;break}return e.abrupt("return");case 2:return this.setVar(t,r,n),this._context=i,t.once(hN.ABNORMAL_DISCONNECTION,(function(){S.destroy()})),this._audioStallInterval=o.audioStallInterval||100,this._audioStallRatio=o.audioStallRatio||.6,c={audio:{},video:{}},u=this._stream,d=null===(a=u.audioTrack)||void 0===a?void 0:a.getTrack(),l=null===(s=u.videoTrack)||void 0===s?void 0:s.getTrack(),this.getRemoteVideoStats(l,c),e.next=14,this.getRemoteAudioStats(d,c);case 14:this.delStatsEvtInterval(),h=0,p=0,v=[],_=0,m=RC(),this._setAudioStallCount=function(){if(eN.AUDIO_STALL&&S._audioStallInterval>0&&void 0!==c.audio.concealedSamples){var e=c.audio.concealedSamples,t=c.audio.totalSamplesReceived;m=RC();var r={isStall:!1,counted:!1,diff:0},n=.5*S._audioStallInterval;S._audioStallCount=m_(Im.mark((function i(){var o,a,s,c,d,l,f,y,g,E,b,k,T,I,A,R,C;return Im.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(a=u.hasAudio,s=u.subAudio,a&&s){i.next=7;break}return r.isStall=!1,r.counted=!1,v.push({reason:xm(c="hasAudio: ".concat(a,", subAudio: ")).call(c,s)}),m=RC(),i.abrupt("return",{stall_count:h,stall_duration:p,stall_list:v,stats_count:_});case 7:return d=null===(o=u.audioTrack)||void 0===o?void 0:o.getTrack(),l=Date.now(),i.next=11,S.handler.getStats(d,!0);case 11:if(f=i.sent,y=Date.now(),g=RC(),!((E=g-m)<n)){i.next=18;break}return v.push({diff:E,start:m,end:g,get_stats_cost:y-l,get_stats_start:l,get_stats_end:y,reason:xm(b="diff(".concat(E,") < minInterval(")).call(b,n,")")}),i.abrupt("return",{stall_count:h,stall_duration:p,stall_list:v,stats_count:_});case 18:if(k=f.length,T=Nb(f).call(f,(function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return v.push({diff:E,start:m,end:g,get_stats_cost:y-l,get_stats_start:l,get_stats_end:y,reason:k?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:h,stall_duration:p,stall_list:v,stats_count:_});case 23:return I=T.concealedSamples,A=T.totalSamplesReceived,C=A-t,(R=I-e)>=0&&C>=0&&R>=S._audioStallRatio*C?(v.push({concealed:R,received:C,diff:E,start:m,end:g,get_stats_cost:y-l,get_stats_start:l,get_stats_end:y,is_stall:!0}),r.isStall?(r.counted?p+=E:(p=p+r.diff+E,h++),r.counted=!0):E>=200?(p+=E,h++,r.counted=!0):(r.counted=!1,r.diff=E),r.isStall=!0):(v.push({concealed:R,received:C,diff:E,start:m,end:g,get_stats_cost:y-l,get_stats_start:l,get_stats_end:y}),r.isStall=!1,r.counted=!1),e=I,t=A,m=g,_++,i.abrupt("return",{stall_count:h,stall_duration:p,stall_list:v,stats_count:_});case 32:case"end":return i.stop()}}),i)}))),f=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S._audioStallCount&&S._setAudioStallCount&&S._setAudioStallCount(),!S._audioStallCount){e.next=6;break}return e.next=4,S._audioStallCount();case 4:S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(f,S._audioStallInterval);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(f,S._audioStallInterval)}},this._setAudioStallCount(),y=function(){var e=m_(Im.mark((function e(){var t,r,n,i,o,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=u.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=u.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,S.getRemoteAudioStats(n,c);case 4:return o=e.sent,h=0,p=0,v=[],_=0,e.next=11,S.getRemoteVideoStats(i,c);case 11:return a=e.sent,e.abrupt("return",{audioStats:o,videoStats:a,isScreen:u.isScreen,userId:u.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),g=function(){var e=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y();case 2:r=e.sent,null===(t=S.client)||void 0===t||t.emit("onRemoteStreamStats",r),f&&(m=RC(),S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(f,S._audioStallInterval)),S._timer&&clearTimeout(S._timer),S._timer=setTimeout(g,2e3);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(g,2e3);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){xI(CI(o.prototype),"delStatsEvtInterval",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0,this.pauseDuration=0}},{key:"unsubscribe",value:function(){this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},o=this._stream,a=o.streamId,s=o.userId,c=o.isScreen,u=o.audioMid,d=o.subMediaType,l=o._attributes,h=o.virtual,p={media_type:"audio",is_screen:!!c,direction:"down",stream_id:a,stream_user_id:s,vid:u,audio_mux:h,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:ZC(d)?"mute_state_off":"mute_state_on",remote_user_capture_state:l.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:l.localaudio&&l.audiostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return e.next=8,this.handler.getStats(t);case 8:if((f=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(f.forEach((function(e){var t=e.type,r=e.packetsLost,o=e.packetsReceived,s=e.bytesReceived,c=e.jitterBufferDelay,u=e.jitterBufferEmittedCount,d=e.clockRate,l=e.channels,h=e.totalSamplesReceived,f=e.concealedSamples,v=e.silentConcealedSamples,_=e.concealmentEvents,m=e.totalRoundTripTime,y=e.packetsDiscarded,g=e.state,S=e.currentRoundTripTime,E=e.audioLevel,k=e.totalAudioEnergy,T=e.totalSamplesDuration,I=e.mimeType,A=e.googDecodingNormal,R=e.googDecodingMuted,C=e.availableIncomingBitrate,w=e.availableOutgoingBitrate,x=e.bytesSent,O=e.nominated,D=e.id,P=e.writable,N=e.jitter,M=e.candidateType,L=e.ip,U=e.address,V=e.networkType,F=e.port,B=e.protocol,j=e.audioOutputLevel,G=e.requestsReceived,H=e.responsesReceived,z=e.requestsSent,K=e.consentRequestsSent,X=e.responsesSent,q=e.ssrc;e.kind;var W=e.nackCount,Y=e.lastPacketReceivedTimestamp,Q=e.concealmentevents,J=e.fecPacketsReceived;if("inbound-rtp"===t)i.packetsLost=r,i.packetsReceived=o,p.packetsReceived=o,p.packetsDiscarded=y,p.nackCount=W,p.lastPacketReceivedTimestamp=Y,p.concealmentevents=Q,i.bytesReceived=s,void 0!==c&&(n.jitterBufferDelay=c/u*1e3,p.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==h&&(i.totalSamplesReceived=h,n.concealedSamples=f,i.concealedSamples=f,i.silentConcealedSamples=v,p.concealedSamples=f,n.concealmentEvents=_,p.totalSamplesReceived=h),void 0!==J&&(p.fec_packets_received=J,i.fecPacketsReceived=J),p.jitter=1e3*N,p.ssrc=q,void 0!==E&&(p.audio_level=E?-10*YR(Math.pow(E,2)):E),void 0!==E&&(p.volume=255*E),void 0!==k&&(p.total_audio_energy=k),void 0!==T&&(p.totalAudioDuration=T);else if("codec"===t)n.recordSampleRate=d,l&&(n.numChannels=l),p.codecName=I;else if("candidate-pair"===t){var Z,$,ee;p.ice_available_incoming_bitrate=C,p.ice_available_outgoing_bitrate=w,p.ice_bytes_received=s,p.ice_bytes_sent=x,p.ice_nominated=+O,p.ice_pair_id=D,p.ice_pair_rtt=S,p.rtt=1e3*S,p.rtt&&null!==(Z=b._context)&&void 0!==Z&&null!==($=Z.streamRTT)&&void 0!==$&&null!==(ee=$[a])&&void 0!==ee&&ee.audio&&(p.total_rtt_ms=p.rtt+b._context.streamRTT[a].audio),p.ice_pair_state=g,p.ice_pair_writable=P,p.recv_ping_requests=G,p.recv_ping_responses=H,p.sent_ping_requests_before_first_response=z,p.sent_ping_requests_total=z+(K||0),p.sent_ping_responses=X,"succeeded"===g&&(n.rtt=1e3*S,n.total_rtt=1e3*m)}else"track"===t&&void 0!==E?(p.audio_level=E?-10*YR(Math.pow(E,2)):E,p.volume=255*E,p.total_audio_energy=k,p.totalAudioDuration=T):"ssrc"===t?(p.decodingNormal=A,p.recvAudioLevel=j,p.decodingMuted=R):"local-candidate"===t?(p.local_candidate_type=M,p.local_ip=L||U,p.local_network_type=V,p.local_port=F,p.protocol=B):"remote-candidate"===t&&(p.remote_candidate_type=M,p.remote_ip=L||U,p.remote_port=F)})),(v=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",this.filterIllegal(n));case 17:if(_={},void 0!==i.concealedSamples&&(p.interval_concealed_samples=i.concealedSamples-v.concealedSamples,p.interval_samples_received=i.totalSamplesReceived-v.totalSamplesReceived,p.interval_silent_concealed_samples=i.silentConcealedSamples-v.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==v.concealedSamples)){e.next=35;break}if(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),!this._audioStallCount){e.next=35;break}return e.next=25,this._audioStallCount();case 25:m=e.sent,y=m.stall_count,g=m.stall_duration,S=m.stall_list,E=m.stats_count,_.stall_list=S,_.stats_count=E,p.concealedSamples===p.interval_concealed_samples&&p.totalSamplesReceived===p.interval_samples_received?(p.stall_count=0,p.stall_duration=0):(p.stall_count=y,p.stall_duration=g),n.stallCount=p.stall_count,n.stallDuration=p.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-v.packetsLost)/(i.packetsReceived-v.packetsReceived+(i.packetsLost-v.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,p.packetsLost=Math.round(i.packetsLost-v.packetsLost),p.fraction_lost=n.audioLossRate,n.statsInterval=i.timestamp-v.timestamp,p.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-v.bytesReceived||0)/n.statsInterval*8,p.bandwidth=Math.round(1e3*n.receivedKBitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*p.interval_samples_received/n.statsInterval),void 0!==i.fecPacketsReceived&&(p.fecBitratebps=(i.fecPacketsReceived-v.fecPacketsReceived||0)/n.statsInterval),p.average_jitter_buffer_delay_ms&&p.total_rtt_ms&&(n.e2eDelay=p.average_jitter_buffer_delay_ms+p.total_rtt_ms),r.audio=i,this.monitor.rtcMediaStatistics(p,{},_),e.abrupt("return",this.filterIllegal(n));case 50:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o={},a={timestamp:Date.now()},s=this._stream,c=s.streamId,u=s.userId,d=s.isScreen,l=s.subMediaType,h=s._attributes,p={media_type:"video",is_screen:!!d,direction:"down",stream_id:c,stream_user_id:u,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:$C(l)?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localvideo&&h.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",o);case 6:return o.isScreen=d,e.next=9,this.handler.getStats(t);case 9:if(f=e.sent,null===(n=this.monitor)||void 0===n||n.rtcInvokeStatus(xm(i="reports.length: ".concat(f.length,"; videoTrack: ")).call(i,t.id),0,"get_remote_video_stats",c,0),f.length){e.next=13;break}return e.abrupt("return",o);case 13:if(f.forEach((function(e){var t=e.type,r=e.frameHeight,n=e.frameWidth,i=e.packetsLost,s=e.packetsReceived,u=e.bytesReceived,d=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,f=e.mimeType,v=e.firCount,_=e.availableIncomingBitrate,y=e.availableOutgoingBitrate,g=e.bytesSent,S=e.nominated,E=e.id,b=e.currentRoundTripTime,k=e.state,T=e.writable,I=e.candidateType,A=e.ip,R=e.address,C=e.networkType,w=e.port,x=e.nackCount,O=e.pliCount,D=e.protocol,P=e.requestsReceived,N=e.responsesReceived,M=e.requestsSent,L=e.consentRequestsSent,U=e.responsesSent,V=e.ssrc,F=e.jitter,B=e.framesReceived,j=e.keyFramesDecoded,G=e.totalDecodeTime,H=e.decoderImplementation,z=e.lastPacketReceivedTimestamp;if("inbound-rtp"===t)a.packetsLost=i,p.packetsLost=i,a.packetsReceived=s,p.packetsReceived=s,a.bytesReceived=u,p.bytes=u,a.framesDecoded=d,a.totalDecodeTime=G,void 0!==l&&(a.jitterBufferDelay=l/h*1e3,p.average_jitter_buffer_delay_ms=a.jitterBufferDelay),p.fir_count=v,p.nackCount=x,a.nackCount=x,p.pli_count=O,p.ssrc=V,p.jitter=F,p.framesReceived=B,a.framesReceived=B,p.framesDecoded=d,p.key_frames_decoded=j,p.decoder_name=H,p.last_packet_received_timestamp=z,void 0!==n&&(o.width=n,p.frame_size_width=n,o.height=r,p.frame_size_height=r);else if("track"===t&&void 0!==n)o.width=n,p.frame_size_width=n,o.height=r,p.frame_size_height=r,void 0!==B&&(p.framesReceived=B,a.framesReceived=B);else if("codec"===t)p.codecName=f;else if("candidate-pair"===t){var K,X,q;p.ice_available_incoming_bitrate=_,p.ice_available_outgoing_bitrate=y,p.ice_bytes_received=u,p.ice_bytes_sent=g,p.ice_nominated=+S,p.ice_pair_id=E,p.ice_pair_rtt=b,p.rtt=1e3*b,p.rtt&&null!==(K=m._context)&&void 0!==K&&null!==(X=K.streamRTT)&&void 0!==X&&null!==(q=X[c])&&void 0!==q&&q.video&&(p.total_rtt_ms=p.rtt+m._context.streamRTT[c].video),o.rtt=p.rtt,p.ice_pair_state=k,p.ice_pair_writable=T,p.recv_ping_requests=P,p.recv_ping_responses=N,p.sent_ping_requests_before_first_response=M,p.sent_ping_requests_total=M+(L||0),p.sent_ping_responses=U}else"local-candidate"===t?(p.local_candidate_type=I,p.local_ip=A||R,p.local_network_type=C,p.local_port=w,p.protocol=D):"remote-candidate"===t&&(p.remote_candidate_type=I,p.remote_ip=A||R,p.remote_port=w)})),(v=r.video).timestamp){e.next=18;break}return r.video=a,e.abrupt("return",this.filterIllegal(o));case 18:return o.videoLossRate=(a.packetsLost-v.packetsLost)/(a.packetsReceived-v.packetsReceived+(a.packetsLost-v.packetsLost)),v.totalDecodeTime&&v.framesDecoded&&a.framesDecoded!==v.framesDecoded&&(p.decode_elapse_per_frame=+((a.totalDecodeTime-v.totalDecodeTime)/(a.framesDecoded-v.framesDecoded)*1e3).toFixed(2)),o._retransmittedRate=(a.nackCount-v.nackCount)/(a.packetsReceived-v.packetsReceived+(a.packetsLost-v.packetsLost)),o.videoLossRate=Number.isNaN(o.videoLossRate)?0:o.videoLossRate,p.fraction_lost=o.videoLossRate,o.statsInterval=a.timestamp-v.timestamp,p.stats_interval=o.statsInterval,o.receivedKBitrate=(a.bytesReceived-v.bytesReceived||0)/o.statsInterval*8,p.bitrate=Math.round(1e3*o.receivedKBitrate),p.bandwidth=Math.round(p.bitrate/1024),o.decoderOutputFrameRate=1e3*(a.framesDecoded-v.framesDecoded)/o.statsInterval,o.receivedFrameRate=1e3*(a.framesReceived-v.framesReceived)/o.statsInterval,p.frame_rate_decoded=Math.round(o.decoderOutputFrameRate),p.frame_rate_received=Math.round(o.receivedFrameRate),p.average_jitter_buffer_delay_ms&&p.total_rtt_ms&&(o.e2eDelay=p.average_jitter_buffer_delay_ms+p.total_rtt_ms),r.video=a,this.processStall(this._stream,p,o,d),this.isPaused?(_=a.timestamp-(this.pauseStart||0),p.pause_duration=this.pauseDuration+(_>500?_:0),this.pauseStart=a.timestamp):p.pause_duration=this.pauseDuration,p.pause_duration=Math.min(p.stall_duration||p.stuck_length||0,p.pause_duration),this.pauseDuration=0,this.monitor.rtcMediaStatistics(p,{}),e.abrupt("return",this.filterIllegal(o));case 40:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"processStall",value:function(e,t,r,n){var i=0,o=0,a=0;if(e.recordedVideoFrames&&this.player&&this.player.played){e.recordedVideoFrames.forEach((function(e){e.isStall&&(i+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,i=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=i,n?(t.stuck_length=Math.min(o,t.stats_interval),t.stall_duration=void 0):(t.stall_duration=Math.min(o,t.stats_interval),t.stuck_length=void 0),t.play_time=a,r.stallCount=i,r.stallDuration=o}},{key:"destroy",value:function(){xI(CI(o.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){o.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,o.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),o}(mF);sd(gF,"audioStallInterval",void 0),sd(gF,"audioStallRatio",void 0);var SF,EF,bF,kF=new Jw("Stream",0),TF=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(TF||{}),IF=function(){function e(){Wd(this,e),sd(this,"isScreen",!1),sd(this,"stream",void 0),sd(this,"streamId",void 0),sd(this,"audioMid",void 0),sd(this,"videoMid",void 0),sd(this,"seiList",[]),sd(this,"videoTrack",void 0),sd(this,"audioTrack",void 0),sd(this,"videoTransceiver",void 0),sd(this,"audioTransceiver",void 0),sd(this,"videoEncodeConfig",[iN]),sd(this,"subVideoDescriptions",[]),sd(this,"enableSimulcast",!1),sd(this,"observer",void 0),sd(this,"statsReport",void 0),sd(this,"prevBitrate",0),sd(this,"pubAudio",!1),sd(this,"pubVideo",!1),sd(this,"pubAttributes",void 0),this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new yF(this)}return qd(e,[{key:"audioHasCapture",get:function(){return this.pubAttributes.localaudio}},{key:"audioHasPublish",get:function(){return this.pubAttributes.audiostream}},{key:"videoHasCapture",get:function(){return this.pubAttributes.localvideo}},{key:"videoHasPublish",get:function(){return this.pubAttributes.videostream}},{key:"hasPublished",get:function(){return this.audioMid&&this.videoMid}},{key:"isEmptyStream",get:function(){return!this.audioTrack&&!this.videoTrack}},{key:"initStreamId",get:function(){return this.stream.id}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(HL()){var r=t.createEncodedStreams(),n=r.readable,i=r.writable,o=new TransformStream({transform:function(t,r){var n=e.seiList[0];if(n){var i,o=_F.generateSEI(n.content),a=new Uint8Array(o.byteLength+t.data.byteLength);if(0===n.repeatCount)mk(i=e.seiList).call(i,0,1);n.repeatCount--,a.set(new Uint8Array(t.data)),a.set(o,t.data.byteLength),t.data=a.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else kF.print("no sender found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else kF.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e;CP.rtcInvokeStatus("".concat((new Error).stack),0,"localstream_clean",this.streamId||"",0),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.prevBitrate=0,this.subVideoDescriptions=[]}},{key:"switchTrackEnableState",value:function(e,t){var r,n;"audio"===e?n=this.audioTrack:"video"===e&&(n=this.videoTrack);var i=null===(r=n)||void 0===r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)}}]),e}(),AF=function(e){DI(r,e);var t=YI(r);function r(e,n,i,o){var a;return Wd(this,r),sd(eI(a=t.call(this)),"streamId",void 0),sd(eI(a),"userId",void 0),sd(eI(a),"isScreen",void 0),sd(eI(a),"hasVideo",void 0),sd(eI(a),"hasAudio",void 0),sd(eI(a),"_attributes",void 0),sd(eI(a),"streamState",void 0),sd(eI(a),"observer",void 0),sd(eI(a),"statsReport",void 0),sd(eI(a),"subVideo",void 0),sd(eI(a),"subAudio",void 0),sd(eI(a),"subMediaType",void 0),sd(eI(a),"subLayer",void 0),sd(eI(a),"audioMid",void 0),sd(eI(a),"videoMid",void 0),sd(eI(a),"_sequenceId",void 0),sd(eI(a),"stream",void 0),sd(eI(a),"videoTrack",void 0),sd(eI(a),"audioTrack",void 0),sd(eI(a),"videoTransceiver",void 0),sd(eI(a),"audioTransceiver",void 0),sd(eI(a),"recordedVideoFrames",void 0),sd(eI(a),"stillExist",void 0),sd(eI(a),"originalMediaType",void 0),sd(eI(a),"originalStreamIndex",0),sd(eI(a),"virtual",void 0),a.virtual=!1,a.userId=e,a.isScreen=i,a.streamId=n,a.hasAudio=o.audiostream&&o.localaudio,a.hasVideo=o.videostream&&o.localvideo,a._attributes=o,a.subVideo=!1,a.subAudio=!1,a._sequenceId=0,a.subMediaType=sF.NONE,a.subLayer={spatialLayer:0,spatialSubLayer:-1},a.streamState=0,a.statsReport=new gF(eI(a)),a}return qd(r,[{key:"audioHasCapture",get:function(){return this._attributes.localaudio}},{key:"audioHasPublish",get:function(){return this._attributes.audiostream}},{key:"videoHasCapture",get:function(){return this._attributes.localvideo}},{key:"videoHasPublish",get:function(){return this._attributes.videostream}},{key:"sequenceId",get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)}},{key:"hasSubscribed",get:function(){return 2===this.streamState}},{key:"attributes",get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){cF.getNalunits(new uF(t.data)).forEach((function(t){if(t.sei){var r=_F.decodeSeiBody(t.body);r&&r.type!==dF.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else kF.print("no receiver found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else kF.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r,n,i,o,a;try{var s;CP.rtcInvokeStatus(ny({uid:this.userId,streamId:this.streamId,streams:LE(s=e.streams).call(s,(function(e,t){return e+(null==(r=t)?"undefined | null":"string"==typeof r?r:ny({id:r.id,active:r.active}));var r}),""),transceiver:(i=e.transceiver,null==i?"undefined | null":"string"==typeof i?i:ny({currentDirection:i.currentDirection,direction:i.direction,mid:i.mid,stopped:i.stopped,receiver:(a=i.receiver,null==a?"undefined | null":"string"==typeof a?a:ny({track:rw(a.track)})),sender:(o=i.sender,null==o?"undefined | null":"string"==typeof o?o:ny({track:rw(o.track)}))})),track:rw(e.track)}),0,"Stream.ontrack","",0)}catch(gX){}if(null!==(t=e.streams)&&void 0!==t&&null!==(r=t[0])&&void 0!==r&&null!==(n=r.id)&&void 0!==n&&$m(n).call(n,this.streamId)){var c,u=e.track;"video"===(null==u?void 0:u.kind)?this._setVideoTrack(u):"audio"===(null===(c=e.track)||void 0===c?void 0:c.kind)&&this._setAudioTrack(u),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e,t;kF.print("clean",xm(e="exec stream.clean ".concat(this.streamId," ")).call(e,this.userId)),CP.rtcInvokeStatus("".concat((new Error).stack),0,"remotestream_clean",this.streamId,0),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,null===(t=this.observer)||void 0===t||t.reset(),this.statsReport.destroy()}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{key:"_setStream",value: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)}}},{key:"_setAudioTrack",value:function(e){var t,r;(null===(t=this.audioTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=JV(e),this.emit("ontrack",this.audioTrack))}},{key:"_setVideoTrack",value:function(e){var t,r;(null===(t=this.videoTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:AC();return new OV(e,t)}(e),this.emit("ontrack",this.videoTrack))}},{key:"_getSubLayerBySpatialLayer",value:function(e){var t=this._attributes,r=t.videoDescriptions,n=t.subVideoDescriptions,i=void 0===n?[]:n,o=r[e],a=o.width,s=o.height,c=Nb(i).call(i,(function(e){return e.width===a&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}}}]),r}(ex),RF=new Jw("queue",4),CF=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(CF||{}),wF=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(wF||{}),xF=(sd(SF={},"publish","unpublish"),sd(SF,"subscribe","unsubscribe"),sd(SF,"pushtrack","removetrack"),SF),OF=(sd(EF={},"publish",0),sd(EF,"subscribe",0),sd(EF,"pushtrack",0),sd(EF,"unpublish",1),sd(EF,"unsubscribe",1),sd(EF,"removetrack",1),EF),DF=function(e){DI(r,e);var t=YI(r);function r(){var e;return Wd(this,r),sd(eI(e=t.call(this)),"_queue",void 0),e._queue=[],e}return qd(r,[{key:"queue",get:function(){return this._queue}},{key:"enqueue",value:function(e){var t,r=this._queue.length,n="";return this._queue=Gs(t=this._queue).call(t,(function(t){return t.streamId!==e.streamId||e.action!==xF[t.action]||(n=t.streamId,RF.print("offsetStreamId",n),!1)})),this._queue.length===r&&this._queue.push(e),this.emit("start"),n}},{key:"dequeue",value:function(){var e;if(!this._queue.length)return null;var t=this._queue.length;zC&&(t=Math.min(this._queue.length,5));for(var r=OF[this._queue[0].action],n=1;n<t;n++){var i;if(OF[this._queue[n].action]!==r)return{sdpStrategy:r,items:mk(i=this._queue).call(i,0,n)}}return{sdpStrategy:r,items:mk(e=this._queue).call(e,0,t)}}}]),r}(Mw),PF=new Jw("ChromeHandler",3),NF=HL(),MF=function(e){DI(l,e);var t,r,n,i,o,a,s,c,u,d=YI(l);function l(e,t){var r;return Wd(this,l),sd(eI(r=d.call(this,e,t)),"name","chrome"),sd(eI(r),"_queueBusy",!1),sd(eI(r),"_sdpQueue",void 0),sd(eI(r),"_aSendonlyOfferTpl",void 0),sd(eI(r),"_vSendonlyOfferTpl",void 0),sd(eI(r),"_aRecvonlyOfferTpl",void 0),sd(eI(r),"_vRecvonlyOfferTpl",void 0),sd(eI(r),"_mid",10),sd(eI(r),"_offerSession",void 0),sd(eI(r),"_answerSession",void 0),sd(eI(r),"_offerMlines",[]),sd(eI(r),"_answerMlines",[]),sd(eI(r),"_inactiveMlineIndex",[]),sd(eI(r),"_mlinesCache",{}),r._sdpQueue=new DF,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(PF.print("dequeue start"),r.dequeue())})),r}return qd(l,[{key:"connect",value:(u=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return PF.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,SU(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=ny((null==t||null===(i=t.publicIPs)||void 0===i?void 0:uy(i).call(i,(function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),e.next=9,this._peerConnection.createOffer();case 9:return o=e.sent,a=zL.parse(o.sdp),(s=!this._offerIce.iceUfrag&&!this._offerIce.icePwd)&&((l="renomination"===(null===(c=a.media[0])||void 0===c?void 0:c.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,h=IU({serverUfrag:t.iceParams.serverIceUfrag,serverPwd:t.iceParams.serverIcePwd,clientPwd:null===(u=a.media[0])||void 0===u?void 0:u.icePwd,options:(d={},sd(d,TU.kICEConfigTypeSrtpDtlsType,!0),sd(d,TU.kICEConfigTypeRenominationType,l),d)}),p=$T(h,2),f=p[0],p[1],this._answerIce.iceUfrag=f,PF.print("use serverUfrag v2",ny({dtls:!0,renomination:l}))),v=$T(a.media,1),_=v[0],this._offerIce.fingerprint=a.fingerprint||_.fingerprint,delete a.media,this._offerSession=ud({},a),this._answerSession=ud({},a),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),s&&(this._offerIce.iceUfrag=_.iceUfrag,this._offerIce.icePwd=_.icePwd),this._offerMlines=[ud(ud(ud({},_),this._offerIce),{},{mid:"".concat(0)})],this._answerMlines=[ud(ud(ud({},_),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(0)})],this.setDescription(),e.next=26,new v_((function(e,t){m._dataChannel.onopen=function(){PF.print("connect","dataChannel open"),BP("es.dc.open","",0,!1,m.connection_id,{ms_addr:m.ms_addr}),e("")},m._dataChannel.onerror=function(e){CP.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,eP.INVALID_DATA),BP("es.dc.error","",0,!1,m.connection_id,{ms_addr:m.ms_addr}),t(e)},m._dataChannel.onclose=function(e){BP("es.dc.close","",0,!1,m.connection_id,{ms_addr:m.ms_addr}),t(e)},m._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==m._peerConnection.iceConnectionState&&"closed"!==m._peerConnection.iceConnectionState&&"failed"!==m._peerConnection.connectionState||t(e)}))}));case 26:return PF.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 28:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){xI(CI(l.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(c=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O,D,P,N,M,L,U,V,F;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=t.stream,d=t.enableSimulcast,h=xI(CI(l.prototype),"internalPublish",this).call(this,t),p=h.videoDescriptions,f=h.subVideoDescriptions,v=h.audioTransceiverInit,_=h.videoTransceiverInit,m=vU(this._nextSsrc),this._nextSsrc=m.next,y="".concat(this._mid++),g="".concat(this._mid++),S=ud(ud(ud({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:y,msid:xm(r="".concat(u.id," ")).call(r,u.id,"-audio"),ssrcs:_U(u.id,"audio",m.audio,pU)}),E=ud(ud(ud({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:g,msid:xm(n="".concat(u.id," ")).call(n,u.id,"-video")}),d?(PF.print("subVideoDesc","desc: %o ",f),delete E.ssrcGroups,delete E.ssrcs,b=[],E.rids=uy(p).call(p,(function(e){var t=e.rid;return b.unshift(t),{id:t,direction:"send"}})),E.simulcast={dir1:"send",list1:b.join(";")}):(k=mU(u.id,m,{cname:pU}),T=k.ssrcs,I=k.ssrcGroups,E.ssrcs=T,E.ssrcGroups=I),null!==(i=this._context)&&void 0!==i&&null!==(o=i.serverConfig)&&void 0!==o&&o.audioRed&&Array.isArray(S.rtp)&&(-1!==(R=YA(A=S.rtp).call(A,(function(e){return"red"===e.codec})))&&(w=mk(C=S.rtp).call(C,R,1),x=$T(w,1),O=x[0],S.rtp.unshift(O)),D=[],S.rtp.forEach((function(e){return D.push(e.payload)})),S.payloads=D.join(" ")),null!==(a=this._context)&&void 0!==a&&null!==(s=a.serverConfig)&&void 0!==s&&s.videoCodec&&AU(E,null===(P=this._context)||void 0===P||null===(N=P.serverConfig)||void 0===N?void 0:N.videoCodec),(NC||BC)&&Array.isArray(E.ext)&&(E.ext=Gs(M=E.ext).call(M,(function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&$m(t).call(t,"video-orientation"))}))),(L=null==S?void 0:Nb(c=S.rtp).call(c,(function(e){return"opus"===e.codec})))&&S.fmtp&&(F=Nb(U=S.fmtp).call(U,(function(e){return e.payload===L.payload})))&&null!==(V=this._context)&&void 0!==V&&V.audioProfileManager&&(F.config=this._context.audioProfileManager.getOpusConfigStr(F.config)),d||NC||this.addBitrateLimit(E,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[S,E],e.abrupt("return",{partialSdp:gU(this._offerSession,S,E),audioMid:y,videoMid:g,type:"incroffer",semantics:"unified-plan",videoDescriptions:p,subVideoDescriptions:f,audioTransceiverInit:v,videoTransceiverInit:_});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O,D,P=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(PF.print("subscribe"),a="incroffer",s="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=9;break}return e.next=6,this._genOfferSdp();case 6:return c=e.sent,e.next=9,this.createAVMlineOfferTpl(c);case 9:if(u="",d="",l=!1,h=!1,p=void 0,f=void 0,this._mlinesCache[t.streamId]=[p,f],t.virtual?(u="".concat(this._mid++),l=!0):r.multiChatMode?(u="".concat(this._mid++),d="".concat(this._mid++),h=!0):(l=!0,h=!0,u="".concat(this._mid++),d="".concat(this._mid++)),u&&(p=ud(ud({},this._aRecvonlyOfferTpl),{},{mid:u})),l&&(this._mlinesCache[t.streamId][0]=p,v={track:"audio",init:{direction:"recvonly"}}),d&&(f=ud(ud({},this._vRecvonlyOfferTpl),{},{mid:d})),h&&(this._mlinesCache[t.streamId][1]=f,_={track:"video",init:{direction:"recvonly"}}),m=gU(this._offerSession,p,f),y=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._vSendonlyAnswerTpl){e.next=32;break}return y=vU(this._nextSsrc),this._nextSsrc=y.next,A=ud(ud(ud({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:xm(g=xm(S="".concat(t.streamId)).call(S,null!==(E=this._context)&&void 0!==E&&E.avSync?"":"-audio"," ")).call(g,t.streamId,"-audio"),ssrcs:_U(t.streamId,"audio",y.audio)}),R=ud(ud(ud({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:xm(b=xm(k="".concat(t.streamId)).call(k,null!==(T=this._context)&&void 0!==T&&T.avSync?"":"-video"," ")).call(b,t.streamId,"-video")},mU(t.streamId,y,{flexfec:this._enableSubFlexfec})),C=new v_((function(e){P._sdpQueue.enqueue({action:wF.subscribe,streamId:t.streamId,audioMid:u,videoMid:d,audioTransceiverInit:v,videoTransceiverInit:_,signalingAck:{sdp:zL.write(ud(ud({},P._answerSession),{},{media:[A,R]})),sequenceId:t.sequenceId?++t.sequenceId:0},stream:t,sdp:m,onSuccess:function(){PF.print("subscribe()","sub success"),e(0)}})})),e.next=31,C;case 31:null===(I=y)||void 0===I||delete I.next;case 32:return(w=null===(n=p)||void 0===n?void 0:Nb(i=n.rtp).call(i,(function(e){return"opus"===e.codec})))&&null!==(o=p)&&void 0!==o&&o.fmtp&&(D=null===(x=p)||void 0===x?void 0:Nb(O=x.fmtp).call(O,(function(e){return e.payload===w.payload})))&&this._context&&(D.config+=";stereo=1;sprop-stereo=1"),e.abrupt("return",{partialSdp:m,audioMid:u,videoMid:d,type:a,semantics:s,audioTransceiverInit:v,videoTransceiverInit:_,allSsrc:y});case 35:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(PF.print("handleAck()","item: %o",t),!t.generatorSsrc){e.next=4;break}return PF.print("already set remote"),e.abrupt("return","");case 4:return e.abrupt("return",this._sdpQueue.enqueue(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"dequeue",value:(o=m_(Im.mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,p,f,v,_=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,t=this._sdpQueue.dequeue(),PF.print("dequeue()","ret: %o",t),t){e.next=6;break}return this._queueBusy=!1,e.abrupt("return");case 6:if(e.prev=6,r=t.items,n=t.sdpStrategy,i=[],o=[],a=[],n!==CF.ADD){e.next=15;break}return e.delegateYield(Im.mark((function e(){var t,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete(t=ud({},_._answerIce)).candidates,s=!1,c=!1,e.prev=4,d=KN(r);case 6:return e.next=8,d.next();case 8:if(!(s=!(l=e.sent).done)){e.next=16;break}if(n=l.value,"break"!==function(){var e=n.audioMid,r=n.videoMid,s=n.action,c=n.audioTransceiverInit,u=n.videoTransceiverInit,d=n.signalingAck,l=n.stream,h=l instanceof AF;if(n.onSuccess&&a.push(n.onSuccess),h&&(null==d?void 0:d.sequenceId)<l.sequenceId)return"break";var p,f={},v={},m=zL.parse(d.sdp);Array.isArray(m.media)&&BA(p=m.media).call(p,(function(e,t){var r;return null==e||null===(r=e.type)||void 0===r?void 0:r.localeCompare(null==t?void 0:t.type)})).forEach((function(n){"audio"===(n=ud(ud({},n),t)).type?(f=n).mid=e:(v=n).mid=r}));var y,g=l.streamId;if(s===wF.publish&&(g=null===(y=l.stream)||void 0===y?void 0:y.id),!_._mlinesCache[g])return"break";var S=$T(_._mlinesCache[g],2),E=S[0],b=S[1];if(c&&E){l.audioTransceiver=_._peerConnection.addTransceiver(c.track,c.init),_.monitor.rtcInvokeStatus(ny({audioStreamTrack:rw(c.track)}),0,"chromeHandler.addTrack","",0);var k=_._inactiveMlineIndex.shift();k||(k=_._offerMlines.length),_._offerMlines[k]=ud({},E),_._answerMlines[k]=f,NF&&l.initAudioEncodedTransform()}if(u&&b){var T,I;l.videoTransceiver=_._peerConnection.addTransceiver(u.track,u.init),_.monitor.rtcInvokeStatus(ny({videoStreamTrack:rw(u.track)}),0,"chromeHandler.addTrack","",0);var A,R,C=_._inactiveMlineIndex.shift();C||(C=_._offerMlines.length),_._offerMlines[C]=ud({},b),s===wF.publish&&null!==(T=_._context)&&void 0!==T&&null!==(I=T.serverConfig)&&void 0!==I&&I.videoCodec&&AU(v,null===(A=_._context)||void 0===A||null===(R=A.serverConfig)||void 0===R?void 0:R.videoCodec),_._answerMlines[C]=v,NF&&l.initVideoEncodedTransform()}i.push(l.streamId||""),o.push(h?l.userId:"local"),h&&(l.sequenceId=null==d?void 0:d.sequenceId),delete _._mlinesCache[g]}()){e.next=13;break}return e.abrupt("break",16);case 13:s=!1,e.next=6;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(4),c=!0,u=e.t0;case 22:if(e.prev=22,e.prev=23,!s||null==d.return){e.next=27;break}return e.next=27,d.return();case 27:if(e.prev=27,!c){e.next=30;break}throw u;case 30:return e.finish(27);case 31:return e.finish(22);case 32:case"end":return e.stop()}}),e,null,[[4,18,22,32],[23,,27,31]])}))(),"t0",13);case 13:e.next=20;break;case 15:v={},r.forEach((function(e){var t=e.audioMid,r=e.videoMid,n=e.action;v[t]=t,n!==wF.removetrack&&(v[r]=r),v[t]=t})),this._offerMlines=uy(h=this._offerMlines).call(h,(function(e,t){return v[e.mid]&&(e=yU(e),_._inactiveMlineIndex.push(t)),e})),BA(p=this._inactiveMlineIndex).call(p,(function(e,t){return e-t})),this._answerMlines=uy(f=this._answerMlines).call(f,(function(e){return v[e.mid]&&(e=yU(e)),e}));case 20:return e.next=22,this._peerConnection.createOffer();case 22:return e.next=24,this.setDescription(i.length?{streamId:i.join(","),streamUserId:o.join(",")}:void 0);case 24:try{a.forEach((function(e){return e()}))}catch(gX){}PF.print("dequeue","loop"),e.next=31;break;case 28:e.prev=28,e.t1=e.catch(6),PF.print("dequeue","unknown error: %o",e.t1);case 31:return e.prev=31,this.dequeue(),e.finish(31);case 34:case"end":return e.stop()}}),e,this,[[6,28,31,34]])}))),function(){return o.apply(this,arguments)})},{key:"setDescription",value:(i=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return PF.print("setDescription"),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,r=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&r.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=r.join(" "),this._answerSession.groups[0].mids=r.join(" ")),n=RC(),t&&CP.rtcBeginCreateOffer("local"===t.streamUserId?rP.UP:rP.DOWN,t.streamId,t.streamUserId),t&&CP.rtcCreateOffer(0,"local"===t.streamUserId?nP.UP:nP.DOWN,t.streamId,t.streamUserId,RC()-n),e.next=11,this.setLocalDescription(zL.write(this._offerSession),t);case 11:return e.next=13,this.setRemoteDescription(zL.write(this._answerSession),t);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=m_(Im.mark((function e(){var t,r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._genOfferSdp();case 2:return r=e.sent,this.createAVMlineOfferTpl(r),n=zL.parse(r),i=[],n.media=Gs(t=n.media).call(t,(function(e){var t;return"recvonly"===e.direction&&(Array.isArray(e.ext)&&(e.ext=Gs(t=e.ext).call(t,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),i.push(e.mid+""),!0)})),n.groups=[{mids:i.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:zL.write(n),semantics:"unified-plan",type:"incroffer"});case 9:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"rollback",value:(r=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete this._mlinesCache[t];case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;zL.parse(e).media.forEach((function(e){if(e.icePwd=t._offerIce.icePwd,e.iceUfrag=t._offerIce.iceUfrag,"audio"===e.type)if("sendonly"===e.direction)t._aSendonlyOfferTpl=e;else{var r;if(Array.isArray(e.ext))e.ext=Gs(r=e.ext).call(r,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}));t._aRecvonlyOfferTpl=e}else if("video"===e.type)if("sendonly"===e.direction)t._vSendonlyOfferTpl=e;else{var n;if(Array.isArray(e.ext))e.ext=Gs(n=e.ext).call(n,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}));t._vRecvonlyOfferTpl=e}}))}},{key:"_genOfferSdp",value:(t=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,YC(!0);case 3:if(t=e.sent){e.next=6;break}throw"pc.createOffer() return empty.";case 6:e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(0),r="Get offer Error. ".concat(e.t0.message|e.t0),new pR(lR.NOT_SUPPORTED,r);case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,null,[[0,8]])}))),function(){return t.apply(this,arguments)})}]),l}(wU),LF=new Jw("FirefoxHandler",3),UF=function(e){DI(l,e);var t,r,n,i,o,a,s,c,u,d=YI(l);function l(){var e,t;Wd(this,l);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return sd(eI(t=d.call.apply(d,xm(e=[this]).call(e,n))),"name","firefox"),sd(eI(t),"_aRecvonlyOfferTpl",void 0),t}return qd(l,[{key:"connect",value:(u=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return LF.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,SU(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=ny((null==t||null===(i=t.publicIPs)||void 0===i?void 0:uy(i).call(i,(function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),FC<138&&(this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"})),e.next=10,this._peerConnection.createOffer();case 10:return c=e.sent,u=zL.parse(c.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((p="renomination"===(null===(d=u.media[0])||void 0===d?void 0:d.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,f=IU({serverUfrag:t.iceParams.serverIceUfrag,serverPwd:t.iceParams.serverIcePwd,clientPwd:null===(l=u.media[0])||void 0===l?void 0:l.icePwd,options:(h={},sd(h,TU.kICEConfigTypeSrtpDtlsType,!0),sd(h,TU.kICEConfigTypeRenominationType,p),h)}),v=$T(f,2),_=v[0],v[1],this._answerIce.iceUfrag=_,LF.print("use serverUfrag v2",ny({dtls:!0,renomination:p}))),m=$T(u.media,1),y=m[0],this._offerIce.fingerprint=u.fingerprint||y.fingerprint,u.media=uy(o=u.media).call(o,(function(e){return ud(ud({},e),S._offerIce)})),uy(a=u.media).call(a,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Kb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),(g=ud({},u)).fingerprint=this._answerIce.fingerprint,g.media=uy(s=g.media).call(s,(function(e){return delete(e=ud(ud({},e),S._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:("audio"===e.type&&(e.msid="ff-stream ff-stream-audio"),e.direction="sendonly"),e})),e.next=23,this.setLocalDescription(zL.write(u));case 23:return e.next=25,this.setRemoteDescription(zL.write(g));case 25:return e.next=27,new v_((function(e,t){S._dataChannel.onopen=function(){LF.print("connect","dataChannel open"),BP("es.dc.open","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),e("")},S._dataChannel.onerror=function(e){CP.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,eP.INVALID_DATA),BP("es.dc.error","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),t(e)},S._dataChannel.onclose=function(e){BP("es.dc.close","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),t(e)},S._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==S._peerConnection.iceConnectionState&&"closed"!==S._peerConnection.iceConnectionState&&"failed"!==S._peerConnection.connectionState||t(e)}))}));case 27:return LF.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 29:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"publish",value:(c=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,h,p,f,v,_,m=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=xI(CI(l.prototype),"internalPublish",this).call(this,t),o=i.videoDescriptions,a=i.subVideoDescriptions,s=i.audioTransceiverInit,c=i.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(s.track,s.init),t.videoTransceiver=this._peerConnection.addTransceiver(c.track,c.init),u=RC(),CP.rtcBeginCreateOffer(rP.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return d=e.sent,CP.rtcCreateOffer(0,nP.UP,"","",RC()-u),(h=zL.parse(d.sdp)).media=null===(r=h.media)||void 0===r?void 0:uy(r).call(r,(function(e){return ud(ud({},e),m._offerIce)})),e.next=13,this.setLocalDescription(zL.write(h));case 13:return p=t.audioTransceiver.mid,f=t.videoTransceiver.mid,v=null,_=null,h.media=null===(n=h.media)||void 0===n?void 0:uy(n).call(n,(function(e){if("".concat(e.mid)===p){var t,r,n=null===(t=v=e)||void 0===t?void 0:Nb(r=t.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&v.fmtp){var i,o,a=Nb(i=v.fmtp).call(i,(function(e){return e.payload===n.payload}));a&&null!==(o=m._context)&&void 0!==o&&o.audioProfileManager&&(a.config=m._context.audioProfileManager.getOpusConfigStr(a.config))}}else if("".concat(e.mid)===f){var s,c,u,d;null!==(s=m._context)&&void 0!==s&&null!==(c=s.serverConfig)&&void 0!==c&&c.videoCodec&&AU(e,null===(u=m._context)||void 0===u||null===(d=u.serverConfig)||void 0===d?void 0:d.videoCodec),_=e}return e})),this.addBitrateLimit(_,t.videoEncodeConfig[0].maxKbps),e.next=21,this.setLocalDescription(zL.write(h));case 21:return e.abrupt("return",{partialSdp:gU(h,v,_,!1),audioMid:p,videoMid:f,type:"incroffer",semantics:"unified-plan",videoDescriptions:o,subVideoDescriptions:a,audioTransceiverInit:s,videoTransceiverInit:c});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return LF.print("subscribe()"),c="",u="",d=!1,l=!1,h=void 0,p=void 0,t.virtual?d=!0:(r.multiChatMode||(d=!0),l=!0),d&&(t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"})),l&&(t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"})),f=RC(),CP.rtcBeginCreateOffer(rP.UP,t.streamId,t.userId),e.next=14,this._peerConnection.createOffer();case 14:return v=e.sent,CP.rtcCreateOffer(0,nP.UP,t.streamId,t.userId,RC()-f),(_=zL.parse(v.sdp)).media=null===(n=_.media)||void 0===n?void 0:uy(n).call(n,(function(e){return ud(ud({},e),R._offerIce)})),uy(i=_.media).call(i,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Kb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),e.next=21,this.setLocalDescription(zL.write(_),{streamId:t.streamId||"",streamUserId:t.userId});case 21:if(c=null===(o=t.audioTransceiver)||void 0===o?void 0:o.mid,u=null===(a=t.videoTransceiver)||void 0===a?void 0:a.mid,null===(s=_.media)||void 0===s||s.forEach((function(e){"".concat(e.mid)===c?h=e:"".concat(e.mid)===u&&(p=e)})),c&&h||(c="audio_".concat(u),h=ud(ud({},this._aRecvonlyOfferTpl),{},{mid:c})),t.audioMid=c,t.videoMid=u,m=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=36;break}return m=vU(this._nextSsrc),this._nextSsrc=m.next,I=ud(ud(ud({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:c,msid:xm(y=xm(g="".concat(t.streamId)).call(g,null!==(S=this._context)&&void 0!==S&&S.avSync?"":"-audio"," ")).call(y,t.streamId,"-audio"),ssrcs:_U(t.streamId,"audio",m.audio)}),A=ud(ud(ud({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:xm(E=xm(b="".concat(t.streamId)).call(b,null!==(k=this._context)&&void 0!==k&&k.avSync?"":"-video"," ")).call(E,t.streamId,"-video")},mU(t.streamId,m,{flexfec:this._enableSubFlexfec})),e.next=35,this._internalSetRemoteDescription([I,A],t);case 35:null===(T=m)||void 0===T||delete T.next;case 36:return e.abrupt("return",{partialSdp:gU(_,h,p,!1),audioMid:c,videoMid:u,type:"incroffer",semantics:"unified-plan",audioTransceiverInit:t.audioTransceiver?{track:"audio",init:{direction:"recvonly"}}:void 0,videoTransceiverInit:t.videoTransceiver?{track:"video",init:{direction:"recvonly"}}:void 0,allSsrc:m});case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=m_(Im.mark((function e(t){var r,n,i,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.signalingAck,n=t.stream,(i=t.action)!==wF.unpublish&&i!==wF.unsubscribe&&i!==wF.removetrack){e.next=5;break}return e.next=4,this.close(n);case 4:return e.abrupt("return",n.streamId||"");case 5:if(!t.generatorSsrc){e.next=8;break}return LF.print("already set remote"),e.abrupt("return","");case 8:return o=zL.parse(null==r?void 0:r.sdp),e.next=11,this._internalSetRemoteDescription(o.media,n);case 11:return e.abrupt("return","");case 12:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"_internalSetRemoteDescription",value:(o=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={},(c=zL.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp)).media.forEach((function(e){void 0!==e.mid&&(s[e.mid]=e)})),t.forEach((function(e){if("audio"===(e=ud(ud({},e),l._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type){if(r instanceof IF&&FC<=87){var t,n,i,o,a={};Array.isArray(e.rtp)&&(e.rtp=Gs(t=e.rtp).call(t,(function(e){return"rtx"!==e.codec||(a[e.payload]=e.payload,!1)}))),"string"==typeof e.payloads&&(e.payloads=Gs(n=e.payloads.split(" ")).call(n,(function(e){return!a[e]})).join(" ")),Array.isArray(e.fmtp)&&(e.fmtp=Gs(i=e.fmtp).call(i,(function(e){return!a[e.payload]}))),Array.isArray(e.rtcpFb)&&(e.fmtp=Gs(o=e.fmtp).call(o,(function(e){return!a[e.payload]})))}r.videoMid?(e.mid=r.videoMid,s[r.videoMid]=e):s[e.mid]=e}})),u=zL.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp),d=uy(o=u.media).call(o,(function(e){var t=s[e.mid];return"inactive"===e.direction?e:t})),c.groups=u.groups,c.media=d,uy(a=c.media).call(a,(function(e){var t,r,n;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Kb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})),FC>=138&&(e.ext=null===(n=e.ext)||void 0===n?void 0:Gs(n).call(n,(function(e){var t;return!$m(t=e.uri).call(t,"sdes:mid")}))))})),e.next=11,this.setRemoteDescription(zL.write(c));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"getDefaultSdp",value:(i=m_(Im.mark((function e(){var t,r,n,i,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=new RTCPeerConnection).addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),e.next=5,r.createOffer();case 5:return n=e.sent,i=zL.parse(n.sdp),this.createAVMlineOfferTpl(n.sdp),o=[],i.media=Gs(t=i.media).call(t,(function(e){if("recvonly"===e.direction){var t="template_".concat(e.type);return e.mid=t,o.push(t),!0}return!1})),i.groups=[{mids:o.join(" "),type:"BUNDLE"}],r.close(),e.abrupt("return",{sdp:zL.write(i),semantics:"unified-plan",type:"incroffer"});case 13:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"rollback",value:(n=m_(Im.mark((function e(t,r,n){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return LF.print("rollback()"),e.abrupt("return",this.close(r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"close",value:(r=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return LF.print("close()"),a={},t.audioTransceiver&&t.audioMid&&(t.audioTransceiver.stop(),a[t.audioMid]=t.audioMid),t.videoTransceiver&&t.videoMid&&!r&&(t.videoTransceiver.stop(),a[t.videoMid]=t.videoMid),s=[],e.next=7,this._peerConnection.createOffer();case 7:return c=e.sent,(u=zL.parse(null==c?void 0:c.sdp)).media=uy(n=u.media).call(n,(function(e){return a[e.mid]&&(e=yU(e)),"inactive"!==e.direction&&s.push(e.mid),ud(ud({},e),h._offerIce)})),d=zL.parse(null===(i=this._peerConnection.remoteDescription)||void 0===i?void 0:i.sdp),l={},d.media.forEach((function(e){void 0!==e.mid&&(l[e.mid]=e)})),d.media=uy(o=u.media).call(o,(function(e){return"inactive"===e.direction?e:l[e.mid]})),u.groups&&d.groups&&(u.groups[0].mids=s.join(" "),d.groups[0].mids=s.join(" ")),e.next=17,this.setLocalDescription(zL.write(u));case 17:return e.next=19,this.setRemoteDescription(zL.write(d));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._peerConnection.createOffer();case 2:if(!this._peerConnection.localDescription||!this._peerConnection.remoteDescription){e.next=7;break}return e.next=5,this._peerConnection.setLocalDescription(this._peerConnection.localDescription);case 5:return e.next=7,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription);case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;zL.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),l}(wU),VF=new Jw("FallbackHandler",3),FF=function(e){DI(l,e);var t,r,n,i,o,a,s,c,u,d=YI(l);function l(e,t){var r;return Wd(this,l),sd(eI(r=d.call(this,e,t)),"name","fallback"),sd(eI(r),"_aRecvonlyOfferTpl",void 0),VF.print("ctor","using fallback handler"),e.rtcError("using fallback handler",-1),r}return qd(l,[{key:"connect",value:(u=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return VF.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,SU(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=ny((null==t||null===(i=t.publicIPs)||void 0===i?void 0:uy(i).call(i,(function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=11,this._peerConnection.createOffer();case 11:return c=e.sent,u=zL.parse(c.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((p="renomination"===(null===(d=u.media[0])||void 0===d?void 0:d.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,f=IU({serverUfrag:t.iceParams.serverIceUfrag,serverPwd:t.iceParams.serverIcePwd,clientPwd:null===(l=u.media[0])||void 0===l?void 0:l.icePwd,options:(h={},sd(h,TU.kICEConfigTypeSrtpDtlsType,!0),sd(h,TU.kICEConfigTypeRenominationType,p),h)}),v=$T(f,1),_=v[0],this._answerIce.iceUfrag=_,VF.print("use serverUfrag v2",ny({dtls:!0,renomination:p}))),m=$T(u.media,1),y=m[0],this._offerIce.fingerprint=u.fingerprint||y.fingerprint,u.media=uy(o=u.media).call(o,(function(e){return ud(ud({},e),S._offerIce)})),uy(a=u.media).call(a,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Kb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),(g=ud({},u)).fingerprint=this._answerIce.fingerprint,g.media=uy(s=g.media).call(s,(function(e){return delete(e=ud(ud({},e),S._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:("audio"===e.type&&(e.msid="ff-stream ff-stream-audio"),e.direction="sendonly"),e})),e.next=24,this.setLocalDescription(c.sdp);case 24:return e.next=26,this.setRemoteDescription(zL.write(g));case 26:return e.next=28,new v_((function(e,t){S._dataChannel.onopen=function(){VF.print("connect","dataChannel open"),BP("es.dc.open","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),e("")},S._dataChannel.onerror=function(e){CP.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,eP.INVALID_DATA),BP("es.dc.error","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),t(e)},S._dataChannel.onclose=function(e){BP("es.dc.close","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),t(e)},S._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==S._peerConnection.iceConnectionState&&"closed"!==S._peerConnection.iceConnectionState&&"failed"!==S._peerConnection.connectionState||t(e)}))}));case 28:return VF.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 30:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"publish",value:(c=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,h,p,f,v;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=xI(CI(l.prototype),"internalPublish",this).call(this,t),i=n.videoDescriptions,o=n.subVideoDescriptions,a=n.audioTransceiverInit,s=n.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(a.track,a.init),t.videoTransceiver=this._peerConnection.addTransceiver(s.track,s.init),c=RC(),CP.rtcBeginCreateOffer(rP.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return u=e.sent,CP.rtcCreateOffer(0,nP.UP,"","",RC()-c),d=zL.parse(u.sdp),e.next=12,this.setLocalDescription(u.sdp);case 12:return h=t.audioTransceiver.mid,p=t.videoTransceiver.mid,f=null,v=null,d.media=null===(r=d.media)||void 0===r?void 0:uy(r).call(r,(function(e){return"".concat(e.mid)===h?f=e:"".concat(e.mid)===p&&(v=e),e})),HL()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),e.abrupt("return",{partialSdp:gU(d,f,v,!1),audioMid:h,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:i,subVideoDescriptions:o,audioTransceiverInit:a,videoTransceiverInit:s});case 19:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return VF.print("subscribe()"),a="",s="",c=!1,u=!1,d=void 0,l=void 0,t.virtual?c=!0:(r.multiChatMode||(c=!0),u=!0),c&&(t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"})),u&&(t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"})),h=RC(),CP.rtcBeginCreateOffer(rP.UP,t.streamId,t.userId),e.next=14,this._peerConnection.createOffer();case 14:return p=e.sent,CP.rtcCreateOffer(0,nP.UP,t.streamId,t.userId,RC()-h),f=zL.parse(p.sdp),e.next=19,this.setLocalDescription(p.sdp,{streamId:t.streamId||"",streamUserId:t.userId});case 19:if(a=null===(n=t.audioTransceiver)||void 0===n?void 0:n.mid,s=null===(i=t.videoTransceiver)||void 0===i?void 0:i.mid,null===(o=f.media)||void 0===o||o.forEach((function(e){"".concat(e.mid)===a?d=e:"".concat(e.mid)===s&&(l=e)})),a&&d||(a="audio_".concat(s),d=ud(ud({},this._aRecvonlyOfferTpl),{},{mid:a})),t.audioMid=a,t.videoMid=s,v=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=34;break}return v=vU(this._nextSsrc),this._nextSsrc=v.next,k=ud(ud(ud({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:a,msid:xm(_=xm(m="".concat(t.streamId)).call(m,null!==(y=this._context)&&void 0!==y&&y.avSync?"":"-audio"," ")).call(_,t.streamId,"-audio"),ssrcs:_U(t.streamId,"audio",v.audio)}),T=ud(ud(ud({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:s,msid:xm(g=xm(S="".concat(t.streamId)).call(S,null!==(E=this._context)&&void 0!==E&&E.avSync?"":"-video"," ")).call(g,t.streamId,"-video")},mU(t.streamId,v,{flexfec:this._enableSubFlexfec})),e.next=33,this._internalSetRemoteDescription([k,T],t);case 33:null===(b=v)||void 0===b||delete b.next;case 34:return HL()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),e.abrupt("return",{partialSdp:gU(f,d,l,!1),audioMid:a,videoMid:s,type:"incroffer",semantics:"unified-plan",audioTransceiverInit:t.audioTransceiver?{track:"audio",init:{direction:"recvonly"}}:void 0,videoTransceiverInit:t.videoTransceiver?{track:"video",init:{direction:"recvonly"}}:void 0,allSsrc:v});case 36:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(a=m_(Im.mark((function e(t){var r,n,i,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.signalingAck,n=t.stream,(i=t.action)!==wF.unpublish&&i!==wF.unsubscribe&&i!==wF.removetrack){e.next=5;break}return e.next=4,this.close(n);case 4:return e.abrupt("return",n.streamId||"");case 5:if(!t.generatorSsrc){e.next=8;break}return VF.print("already set remote"),e.abrupt("return","");case 8:return o=zL.parse(null==r?void 0:r.sdp),e.next=11,this._internalSetRemoteDescription(o.media,n);case 11:return e.abrupt("return","");case 12:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"_internalSetRemoteDescription",value:(o=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={},(c=zL.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp)).media.forEach((function(e){void 0!==e.mid&&(s[e.mid]=e)})),t.forEach((function(e){"audio"===(e=ud(ud({},e),l._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type&&(r.videoMid?(e.mid=r.videoMid,s[r.videoMid]=e):s[e.mid]=e)})),u=zL.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp),d=uy(o=u.media).call(o,(function(e){var t=s[e.mid];return"inactive"===e.direction?e:t})),c.groups=u.groups,c.media=d,uy(a=c.media).call(a,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Kb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),e.next=11,this.setRemoteDescription(zL.write(c));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"getDefaultSdp",value:(i=m_(Im.mark((function e(){var t,r,n,i,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=zL.parse(null===(t=this._peerConnection.localDescription)||void 0===t?void 0:t.sdp),this.createAVMlineOfferTpl(null===(r=this._peerConnection.localDescription)||void 0===r?void 0:r.sdp),o=[],i.media=Gs(n=i.media).call(n,(function(e){return"recvonly"===e.direction&&(e.mid=e.mid+1,o.push("".concat(e.mid)),!0)})),i.groups=[{mids:o.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:zL.write(i),semantics:"unified-plan",type:"incroffer"});case 6:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"rollback",value:(n=m_(Im.mark((function e(t,r,n){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return VF.print("rollback()"),e.abrupt("return",this.close(r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"close",value:(r=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return VF.print("close()"),a={},t.audioTransceiver&&t.audioMid&&(t.audioTransceiver.stop(),a[t.audioMid]=t.audioMid),t.videoTransceiver&&t.videoMid&&!r&&(t.videoTransceiver.stop(),a[t.videoMid]=t.videoMid),s=[],e.next=7,this._peerConnection.createOffer();case 7:return c=e.sent,(u=zL.parse(null==c?void 0:c.sdp)).media=uy(n=u.media).call(n,(function(e){return a[e.mid]&&(e=yU(e)),"inactive"!==e.direction&&s.push(e.mid),ud(ud({},e),h._offerIce)})),d=zL.parse(null===(i=this._peerConnection.remoteDescription)||void 0===i?void 0:i.sdp),l={},d.media.forEach((function(e){void 0!==e.mid&&(l[e.mid]=e)})),d.media=uy(o=u.media).call(o,(function(e){return"inactive"===e.direction?e:l[e.mid]})),u.groups&&d.groups&&(u.groups[0].mids=s.join(" "),d.groups[0].mids=s.join(" ")),e.next=17,this.setLocalDescription(null==c?void 0:c.sdp);case 17:return e.next=19,this.setRemoteDescription(zL.write(d));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._peerConnection.createOffer();case 2:if(!this._peerConnection.localDescription||!this._peerConnection.remoteDescription){e.next=7;break}return e.next=5,this._peerConnection.setLocalDescription(this._peerConnection.localDescription);case 5:return e.next=7,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription);case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;zL.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),l}(wU),BF=function(e,t){return null!=t&&t.enableFallbackHandler?new FF(e,t):PC?new UF(e,t):new MF(e,t)},jF=new Jw("Locker",2),GF=1,HF=function(){function e(t){var r;Wd(this,e),sd(this,"lockingPromise",v_.resolve()),sd(this,"locks",0),sd(this,"name",""),sd(this,"lockId",void 0),this.lockId=GF++,t&&(this.name=t),jF.print(xm(r="[lock-".concat(this.name,"-")).call(r,this.lockId,"] is created."))}return qd(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t,r,n=this;this.locks+=1,jF.print(xm(e=xm(t="[lock-".concat(this.name,"-")).call(t,this.lockId,"] locked, current queue ")).call(e,this.locks,"."));var i=new v_((function(e){r=function(){var t,r;n.locks-=1,jF.print(xm(t=xm(r="[lock-".concat(n.name,"-")).call(r,n.lockId,"] unlocked, current queue ")).call(t,n.locks,".")),e()}})),o=this.lockingPromise.then((function(){return r}));return this.lockingPromise=this.lockingPromise.then((function(){return i})),o}}]),e}(),zF=function(e){return 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",e.ON_SUBTITLE_STATE_CHANGED="ON_SUBTITLE_STATE_CHANGED",e.ON_SUBTITLE_MESSAGE_RECEIVED="ON_SUBTITLE_MESSAGE_RECEIVED",e.ON_VIDEO_STREAM_BANNED="ON_VIDEO_STREAM_BANNED",e.ON_AUDIO_STREAM_BANNED="ON_AUDIO_STREAM_BANNED",e}(zF||{}),KF=function(e){return 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",e}(KF||{}),XF=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(XF||{}),qF=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(qF||{}),WF=(sd(bF={},Dd.communication,[0]),sd(bF,Dd.chat,[0]),sd(bF,Dd.chatRoom,[1,"IES_chatroom"]),sd(bF,Dd.coHost,[1,"IES_PK"]),sd(bF,Dd.meeting,[16]),sd(bF,Dd.classRoom,[0]),bF),YF=ad,QF=tc,JF=function(e,t,r,n){for(var i,o=n>1?void 0:n?QF(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&YF(t,r,o),o},ZF=new Jw("MediaServerClient",2),$F=6e4,eB=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(eB||{}),tB=function(e,t){ZF.print(e,"userId: %o, subAudio: %o, subVideo: %o, audioMid: %o, videoMid: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.audioMid,t.videoMid,t.sequenceId)},rB=function(e){DI(b,e);var t,r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E=YI(b);function b(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:CP;return Wd(this,b),sd(eI(t=E.call(this)),"id",void 0),sd(eI(t),"_token",void 0),sd(eI(t),"_appId",void 0),sd(eI(t),"_roomId",void 0),sd(eI(t),"_roomAttributes",void 0),sd(eI(t),"_clientId",void 0),sd(eI(t),"_businessId",void 0),sd(eI(t),"_userInfo",void 0),sd(eI(t),"_useCloudProxy",void 0),sd(eI(t),"_expectedIDC",void 0),sd(eI(t),"_authorization",void 0),sd(eI(t),"_sessionId",void 0),sd(eI(t),"_iceConfigRequestManager",void 0),sd(eI(t),"_ontrackCallbackMap",new bE),sd(eI(t),"_subResolves",{}),sd(eI(t),"supportConcurrent",!1),sd(eI(t),"_handler",void 0),sd(eI(t),"_pubSubLock",void 0),sd(eI(t),"_joinLeaveLock",void 0),sd(eI(t),"_state",void 0),sd(eI(t),"_dataChannelSignal",void 0),sd(eI(t),"_subConfig",{}),sd(eI(t),"monitor",void 0),sd(eI(t),"_roomProfile",Dd.communication),sd(eI(t),"_context",void 0),sd(eI(t),"_subStreamQueue",{}),t.id=null==e?void 0:e.id,t.monitor=r,t._pubSubLock=new HF("pubSubLock"),t._joinLeaveLock=new HF("joinLeaveLock"),t._state="disconnected",t._roomAttributes={multiChatMode:!1,bigRoomMode:!1},t._context=e,t.on("SUB_END",(function(e){return t._handleSubStreamQueue(e)})),t}return qd(b,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){ZF.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(hN.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[dN.ON_ADD_STREAM,dN.ON_ADD_STREAM_LIST,dN.ON_REMOVE_STREAM,dN.ON_REMOVE_STREAM_LIST,dN.USER_CONNECTION,dN.USER_CONNECTION_LIST,dN.USER_DISCONNECTION,dN.USER_DISCONNECTION_LIST,dN.ON_UPDATE_STREAM_ATTRIBUTES,dN.ON_UPDATE_ROOM_ATTRIBUTES,dN.ON_PUSH_TRACK,dN.NODE_CHANGE,dN.ON_CUSTOM_MESSAGE,dN.USER_MESSAGE_RECEIVED,dN.USER_BINARY_MESSAGE_RECEIVED,dN.POST_PROCESSING_MESSAGE,dN.ON_USER_TOKEN_WILL_EXPIRE,dN.STREAM_CONTROL_MESSAGE,dN.ON_UPDATE_USER_ATTRIBUTES,dN.ON_SPEAKER_CHANGE,lN.RSCP,lN.RTT,dN.ON_STREAM_FAILED].forEach((function(e){var r;null===(r=t._dataChannelSignal)||void 0===r||r.on(e,(function(r){t.safeEmit(e,r)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){ZF.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(hN.ABNORMAL_DISCONNECTION)}))}},{key:"_removeSignalEventHandler",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()}},{key:"connectionState",get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(hN.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"businessId",set:function(e){this._businessId=e}},{key:"connect",value:(S=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d=this,l=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:"",n=l.length>2&&void 0!==l[2]?l[2]:"",i=l.length>3&&void 0!==l[3]?l[3]:{},this.connectionState="connecting",this._appId=t,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),!i.node){e.next=11;break}o=[i.node],BP("es.join.nodeChange",i),e.next=20;break;case 11:return v_.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new GN,e.next=15,null===(a=this._iceConfigRequestManager)||void 0===a?void 0:a.getAccessNode(t,r,n,YP.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy,this._expectedIDC);case 15:if(o=e.sent){e.next=19;break}throw BP("es.join.getNodeFailed",""),new pR(lR.ICE_SERVER_WRONG,"get ICE config failed");case 19:BP("es.join.getNodeSuccess",o);case 20:return v_.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),e.prev=21,c=!1,u=uy(o).call(o,(function(e){var t=BF(d.monitor,d._context);return t.connect(e).then((function(r){var n;d.emit("onConnectSuccessHook",null===(n=o)||void 0===n?void 0:n.length),c?t.destroy():(c=!0,s=r,d.safeEmit("prevIceNode",e),d._handler=t,OP.setStats({connection_id:t.connection_id}),d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(e){throw t.destroy(),e}))})),e.next=26,QC(u);case 26:ZF.print("join","establish peerConnection success"),e.next=33;break;case 29:throw e.prev=29,e.t0=e.catch(21),this.connectionState="disconnected",new pR(lR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 33:if(!s){e.next=39;break}this._dataChannelSignal=new FN(this.id,s),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=41;break;case 39:throw this.connectionState="disconnected",new pR(lR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 41:case"end":return e.stop()}}),e,this,[[21,29]])}))),function(e){return S.apply(this,arguments)})},{key:"join",value:(g=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m=this,y=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=y.length>1&&void 0!==y[1]?y[1]:{},i=y.length>2&&void 0!==y[2]&&y[2],o=y.length>3?y[3]:void 0,ZF.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",t,n,i,o),this._appId=t.appId,this._token=t.token,this._roomId=t.roomId,this._clientId=t.userInfo.userId,this._businessId=t.userInfo.businessId,this._userInfo=t.userInfo,this._useCloudProxy=t.useCloudProxy,this._expectedIDC=t.expectedIDC,this._roomProfile=t.roomProfile,this._sessionId=n.sessionId,e.next=16,this.connect(this._appId,this._roomId,this._clientId,n);case 16:return e.t0=xC.token2auth(this._appId,this._roomId,this._clientId,this._token),e.t1=this._sessionId||"",e.t2=Date.now(),e.t3=o,e.t4={extra_info:this._userInfo.extraInfo,role:this._userInfo.role},e.next=23,null===(r=this._handler)||void 0===r?void 0:r.getDefaultSdp();case 23:return e.t5=e.sent,e.next=26,DL();case 26:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=eN.VERSION,e.t9=YP.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=WF[this._roomProfile]?WF[this._roomProfile][0]+"":"0",e.t16={supportedCodecs:e.t6,deviceType:"web",userAgent:e.t7,sdkVersion:e.t8,deviceId:e.t9,appId:e.t10,roomId:e.t11,userId:e.t12,businessId:e.t13,enableCloudProxy:e.t14,channelProfile:e.t15},e.t17={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0,enableUnBundleMode:!0,enableAudioMux:!0,enableBigRoomMode:!0,needNegotiateSDP:!0},e.t18=ny({requireICEUfragV2:!0}),a={Authorization:e.t0,sessionId:e.t1,timestamp:e.t2,controlMessage:e.t3,userAttributes:e.t4,sdpInfo:e.t5,params:e.t16,options:e.t17,accessParams:e.t18},v_.resolve().then((function(){return m.emit("onSendingJoinMessageHook")})),e.prev=41,c=i?"reconnected":"joinRoom",e.next=45,this._dataChannelSignal.sendSignaling(c,a);case 45:return u=e.sent,ZF.print("join","send join message success"),d=u.config||{},l=d.engine_WEB,this._authorization=a.Authorization,this.connectionState="connected",YP.setEngineWebConfig(this._appId,this._roomId,l),this._context&&(this._context.serverConfig={videoCodec:(null==l?void 0:l.video_codec)||"H264",audioRed:!(null==l||!l.pub_audio_red),muteReplaceUnsub:!(null===(h=u.config)||void 0===h||!h.mute_replace_unsub),simulcastOnDemand:!(PC||!1===(null===(p=u.config)||void 0===p||null===(f=p.engine_VPM)||void 0===f||null===(v=f.ondemand)||void 0===v?void 0:v.enable))},"boolean"==typeof(null==l?void 0:l.av_sync)&&(this._context.avSync=l.av_sync)),gF.audioStallConfig=l,null!=u&&null!==(s=u.relayMessage)&&void 0!==s&&s.sdp&&(null===(_=this._handler)||void 0===_||_.createAVMlineAnswerTpl(u.relayMessage.sdp)),e.abrupt("return",u);case 57:if(e.prev=57,e.t19=e.catch(41),this.connectionState="disconnected",!((null===e.t19||void 0===e.t19?void 0:e.t19.code)>=700&&(null===e.t19||void 0===e.t19?void 0:e.t19.code)<800)){e.next=62;break}throw new pR(lR.INVALID_TOKEN,(null===e.t19||void 0===e.t19?void 0:e.t19.message)||"Invalid token");case 62:if(200===(null===e.t19||void 0===e.t19?void 0:e.t19.code)){e.next=64;break}throw new pR(lR.JOIN_ROOM_FAILED,(null===e.t19||void 0===e.t19?void 0:e.t19.message)||"Join room failed");case 64:case"end":return e.stop()}}),e,this,[[41,57]])}))),function(e){return g.apply(this,arguments)})},{key:"publish",value:(y=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ZF.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,i=RC(),o="",a="",e.prev=6,e.next=9,null===(s=this._handler)||void 0===s?void 0:s.publish(t);case 9:if(m=e.sent){e.next=12;break}throw new pR(lR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:if("H264"!==(null===(c=this._context)||void 0===c||null===(u=c.serverConfig)||void 0===u?void 0:u.videoCodec)){e.next=18;break}return e.next=15,FL();case 15:if(e.sent){e.next=18;break}throw new pR(lR.PUBLISH_FAILED,"h264 is not supported");case 18:return o=m.audioMid,a=m.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof MV),extaudio:!!(n instanceof LV)},y={attributes:ud({videoDescriptions:m.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:o,videoMid:a,sdpInfo:{msid:t.stream.id,type:m.type,sdp:m.partialSdp,semantics:m.semantics}},(g=t.enableSimulcast&&(null===(d=this._context)||void 0===d||null===(l=d.serverConfig)||void 0===l?void 0:l.simulcastOnDemand)&&(null===(h=m.subVideoDescriptions)||void 0===h?void 0:h.length))&&(y.attributes.subVideoDescriptions=m.subVideoDescriptions),e.next=26,null===(p=this._dataChannelSignal)||void 0===p?void 0:p.sendSignaling("publish",y);case 26:if(200===(null==(S=e.sent)?void 0:S.code)){e.next=29;break}throw new pR(lR.PUBLISH_FAILED,(null==S?void 0:S.message)||"publish failed");case 29:if(CP.rtcRecvAnswer(0,aP.INCRANSWER,(null==S||null===(f=S.relayMessage)||void 0===f?void 0:f.sequenceId)||0,null==S||null===(v=S.relayMessage)||void 0===v?void 0:v.sdp,sP.UP,"",""),E=new v_((function(e,r){var n,i,s;null===(n=k._handler)||void 0===n||n.handleAck({action:wF.publish,streamId:S.streamId,audioMid:o,videoMid:a,audioTransceiverInit:null==m?void 0:m.audioTransceiverInit,videoTransceiverInit:null==m?void 0:m.videoTransceiverInit,signalingAck:{sdp:null==S||null===(i=S.relayMessage)||void 0===i?void 0:i.sdp,sequenceId:null==S||null===(s=S.relayMessage)||void 0===s?void 0:s.sequenceId},sdp:m.sdp,stream:t,onSuccess:function(){ZF.print("publish()","publish success"),e(0)}})})),"chrome"!==(null===(_=this.handler)||void 0===_?void 0:_.name)){e.next=34;break}return e.next=34,E;case 34:return g&&this.emit(lN.RSCP,[{StreamIds:[t.stream.id],Metadata:{VideoIndex:0}}]),t.streamId=S.streamId,t.videoMid=a,t.audioMid=o,t.subVideoDescriptions=m.subVideoDescriptions,this.monitor.rtcPublishStat(cP.SUCCESS,uP.W_0,i,dP.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor,this._context),e.abrupt("return");case 44:return e.prev=44,e.t0=e.catch(6),e.t0 instanceof Error&&this.monitor.rtcPublishStat(cP.FAIL,uP.W_0,i,e.t0.message),e.next=49,null===(b=this._handler)||void 0===b?void 0:b.rollback(t.stream.id,t);case 49:throw e.t0;case 50:case"end":return e.stop()}}),e,this,[[6,44]])}))),function(e){return y.apply(this,arguments)})},{key:"updatePubTrack",value:(m=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O,D;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:ZF.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,o=t.audioTrack,a=t.pubAudio,s=t.pubVideo,c=null==o?void 0:o.getTrack("preprocessing"),u=null==i?void 0:i.getTrack("preprocessing"),s&&u?null===(d=t.videoTransceiver)||void 0===d||d.sender.replaceTrack(u):null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateMaxBitrate(t),a&&c?(p=o.mixType,(f=o.mixedAudioTrack)&&p!==Gd.PLAYOUT&&!0===c.enabled&&(c=f),null===(h=t.audioTransceiver)||void 0===h||h.sender.replaceTrack(c)):(null===(v=t.audioTransceiver)||void 0===v||v.sender.replaceTrack(null),this.monitor.rtcInvokeStatus("null",0,"MediaClient.updatePubTrack(audio)","",0));try{this.monitor.rtcInvokeStatus(ny({audioStreamTrack:rw(c),videoStreamTrack:rw(u)}),0,"MediaClient.updatePubTrack","",0)}catch(gX){}for(m={},y=0,g=bR(_={localaudio:!!o,localvideo:!!i,videostream:s,audiostream:a,extvideo:!!(i instanceof MV),extaudio:!!(o instanceof LV)});y<g.length;y++)S=$T(g[y],2),E=S[0],(b=S[1])!==uI(t.pubAttributes,E)&&ux(m,E,b);if(an(m).length){e.next=13;break}return e.abrupt("return");case 13:return t.observer&&(k=t.observer,T=m.audiostream,I=m.videostream,A=m.localaudio,R=m.localvideo,C=m.extaudio,w=m.extvideo,void 0!==R?void 0!==w?k.setPushVideo(w):k.setEnableVideo(R):void 0!==I&&k.setUnmuteVideo(I),void 0!==A?void 0!==C?k.setPushAudio(C):k.setEnableAudio(A):void 0!==T&&k.setUnmuteAudio(T)),t.pubAttributes=_,x={roomId:this._roomId,streamId:t.streamId,attributes:m},e.next=18,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",x);case 18:if(200===(null==(O=e.sent)?void 0:O.code)){e.next=21;break}throw new pR(lR.UPDATE_TRACK_FAILED,(null==O?void 0:O.message)||"update track failed");case 21:if(!PC){e.next=24;break}return e.next=24,null===(D=this._handler)||void 0===D?void 0:D.setCurrentDescription();case 24:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"updateToken",value:(_=m_(Im.mark((function e(t){var r,n,i,o,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ZF.print("updateToken()","newToken: %o",t),this._token=t,this._appId&&null!==(r=this._userInfo)&&void 0!==r&&r.userId&&this._roomId){e.next=4;break}return e.abrupt("return");case 4:return i={roomId:this._roomId,userId:null===(n=this._userInfo)||void 0===n?void 0:n.userId,appId:this._appId,token:"Bearer ".concat(t)},e.prev=5,e.next=8,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("updateToken",i);case 8:if(200===(null==(a=e.sent)?void 0:a.code)){e.next=11;break}throw new pR(lR.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 11:e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(5),new pR(lR.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 16:case"end":return e.stop()}}),e,this,[[5,13]])}))),function(e){return _.apply(this,arguments)})},{key:"unpublish",value:(v=m_(Im.mark((function e(t){var r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ZF.print("unpublish()","localStream: %o",t),i={roomId:this._roomId,initStreamId:t.initStreamId,streamId:t.streamId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unpublish",i),e.next=5,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:wF.unpublish,audioMid:t.audioMid,videoMid:t.videoMid,stream:t,streamId:t.streamId});case 5:t.statsReport.unpublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"subscribe",value:(f=m_(Im.mark((function e(t,r,n){var i=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new v_(function(){var e=m_(Im.mark((function e(o,a){var s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O,D,P,N,M,L;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==TF.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,qF.SUB).then(o,a));case 2:if(t.streamState!==TF.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),ZF.print("_subStreamQueue","streamId: %o, enqueue",t.streamId),i._subStreamQueue[t.streamId].push({fn:i.subscribe,args:[t,r,n],resolve:o,reject:a}),e.abrupt("return");case 7:if(ZF.print("subscribe()","mediaType: %o",r),tB("subscribe()",t),t.streamState=TF.SUB_ING,c=!1,u=!1,ZC(r)&&(u=!0),$C(r)&&(c=!0),c||!i.multiChatMode()){e.next=17;break}return t.streamState=TF.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",o(null));case 17:return d=RC(),l=t.subVideo,h=[],p=!i.multiChatMode(),i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),h.push(new v_((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new pR(lR.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),$F);t.on("ontrack",(function r(i){"video"===i.mediaType&&(ZF.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p&&h.push(new v_((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new pR(lR.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),$F);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(ZF.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f=function(e){t.ontrack(e)},null===(s=i._handler)||void 0===s||s.on("ontrack",f),i._ontrackCallbackMap.set(t,f),e.prev=27,e.next=30,null===(v=i._handler)||void 0===v?void 0:v.subscribe(t,{multiChatMode:i.multiChatMode()});case 30:if(k=e.sent){e.next=33;break}throw new pR(lR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 33:return T=k.audioMid,I=k.videoMid,t.subVideo=c,A={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},R={audio:!i.multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:I,audioMid:T,sdpInfo:{sdp:null==k?void 0:k.partialSdp,semantics:null==k?void 0:k.semantics,type:null==k?void 0:k.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i.multiChatMode()||u,video:c},qualityLayer:A},extra:{enableSendRTT:!0}},C=i._context||{},w=C.subscribeFallbackOption,x=C.userPriority,"number"==typeof w&&(R.config.fallbackOption=w),null!=x&&x.has(t.userId)&&(R.config.priority=x.get(t.userId)),null!=k&&k.allSsrc&&(R.extra.subscribeSSRC=k.allSsrc),e.next=44,null===(_=i._dataChannelSignal)||void 0===_?void 0:_.sendSignaling("subscribe",R);case 44:if(200===(null==(O=e.sent)?void 0:O.code)){e.next=47;break}throw new pR(lR.SUBSCRIBE_FAILED,(null==O?void 0:O.message)||"subscribe failed");case 47:return D=null==O?void 0:O.relayMessage,P=D.audioMid,N=D.videoMid,sd(m={},T,P),sd(m,I,N),M=m,ZF.print("sub midmap",t.userId,M),t.videoMid=I,t.audioMid=T,t.subMediaType=r,t.streamState=TF.SUB_ED,t.subLayer=A,CP.rtcRecvAnswer(0,aP.INCRANSWER,(null==O||null===(y=O.relayMessage)||void 0===y?void 0:y.sequenceId)||0,null==O||null===(g=O.relayMessage)||void 0===g?void 0:g.sdp,sP.DOWN,t.streamId,t.userId),e.next=58,null===(S=i._handler)||void 0===S?void 0:S.handleAck({action:wF.subscribe,streamId:t.streamId,audioMid:T,videoMid:I,audioTransceiverInit:null==k?void 0:k.audioTransceiverInit,videoTransceiverInit:null==k?void 0:k.videoTransceiverInit,signalingAck:{sdp:null==O||null===(E=O.relayMessage)||void 0===E?void 0:E.sdp,sequenceId:null==O||null===(b=O.relayMessage)||void 0===b?void 0:b.sequenceId},stream:t,sdp:k.sdp,generatorSsrc:!!k.allSsrc});case 58:return e.next=60,v_.all(h);case 60:i.multiChatMode()||(t.subAudio=u),i.monitor.rtcSubscribeStat(lP.SUCCESS,d,hP.UNKNOWN,t.userId),i._context&&t.statsReport.setRemoteStreamStatsEvtInterval(i,i._handler,i.monitor,i._context),o(null),i.emit("SUB_END",t.streamId),e.next=76;break;case 67:return e.prev=67,e.t0=e.catch(27),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(lP.FAIL,d,e.t0.message,t.userId),t.subVideo=l,t.streamState=TF.INIT,e.next=74,null===(L=i._handler)||void 0===L?void 0:L.rollback(t.streamId,t);case 74:a(e.t0),i.emit("SUB_END",t.streamId);case 76:case"end":return e.stop()}}),e,null,[[27,67]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return f.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){ZF.print("_subStreamQueue","streamId: %o, exec",e);var n=this._subStreamQueue[e].shift(),i=n.fn,o=n.args,a=n.resolve,s=n.reject;i.apply(this,o).then(a,s).finally((function(){return r._handleSubStreamQueue(e)}))}else ZF.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(p=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ZF.print("controlMessage()","params: %o",t),n=t,"transcode"===t.type&&(n.roomId=this._roomId),e.next=5,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("controlMessage",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"updateUserAttributes",value:(h=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ZF.print("updateUserAttributes()","attributes: %o",t),e.next=3,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:t});case 3:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"updateSubTrack",value:(l=m_(Im.mark((function e(t,r,n){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._updateSubTrack(t,r,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return l.apply(this,arguments)})},{key:"updateSubTrackLayer",value:(d=m_(Im.mark((function e(t,r){var n,i,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ZF.print("updateSubTrack()","subLayer: %o",r),t.subLayer.spatialLayer!==r.spatialLayer||t.subLayer.spatialSubLayer!==r.spatialSubLayer){e.next=4;break}return ZF.print("updateSubTrack()","subLayer no change"),e.abrupt("return");case 4:return i={roomId:this._roomId,streamList:[t.streamId],streamId:t.streamId,streamUserId:t.userId,config:{qualityLayer:r}},e.next=7,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateSubscribe",i);case 7:if(200===(null==(o=e.sent)?void 0:o.code)){e.next=10;break}throw new pR(lR.UPDATE_TRACK_FAILED,(null==o?void 0:o.message)||"update track failed");case 10:return t.subLayer=r,e.abrupt("return",t);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"_updateSubTrack",value:(u=m_(Im.mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ZF.print("updateSubTrack()","mediaType: %o",r),tB("updateSubTrack()",t),!this.multiChatMode()||r!==Sd.AUDIO){e.next=5;break}return ZF.print("updateSubTrack","multiChatMode mediaType only audio"),e.abrupt("return",t);case 5:return a=0,a=n===qF.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),ZF.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,a),t.subMediaType===a&&ZF.print("updateSubTrack","mediaType no change"),s=!1,c=!1,ZC(a)&&(c=!0),$C(a)&&(s=!0),u={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:s,audio:!!this.multiChatMode()||c}}},d=this._context||{},l=d.subscribeFallbackOption,h=d.userPriority,"number"==typeof l&&(u.config.fallbackOption=l),null!=h&&h.has(t.userId)&&(u.config.priority=h.get(t.userId)),e.next=18,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",u);case 18:if(200===(null==(p=e.sent)?void 0:p.code)){e.next=21;break}throw new pR(lR.UPDATE_TRACK_FAILED,(null==p?void 0:p.message)||"update track failed");case 21:return this.multiChatMode()||(null===(f=t.observer)||void 0===f||f.setUnmuteAudio(c),t.subAudio=c),null===(o=t.observer)||void 0===o||o.setUnmuteVideo(s),t.subVideo=s,t.subMediaType=a,e.abrupt("return",t);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(c=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return ZF.print("subscribe4pushTrack()","streamInfo: %o",r),tB("subscribe4pushTrack()",t),t.subAudio=!0,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),e.next=6,null===(i=this._handler)||void 0===i?void 0:i.subscribe(t,{multiChatMode:this.multiChatMode()});case 6:if(s=e.sent){e.next=9;break}throw new pR(lR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 9:return c=s.audioMid,u=s.videoMid,(d=[]).push(new v_((function(e,r){var n=setTimeout((function(){return r(new pR(lR.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),$F);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(ZF.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),l=function(e){t.ontrack(e)},null===(o=this._handler)||void 0===o||o.on("ontrack",l),this._ontrackCallbackMap.set(t,l),e.next=18,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:wF.pushtrack,streamId:t.streamId,audioMid:c,videoMid:u,stream:t,audioTransceiverInit:null==s?void 0:s.audioTransceiverInit,videoTransceiverInit:null==s?void 0:s.videoTransceiverInit,signalingAck:null==r?void 0:r.message,sdp:s.sdp});case 18:return e.next=20,v_.all(d);case 20:this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(s=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:tB("unsubscribe4removeTrack()",t),ZF.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId);case 2:case"end":return e.stop()}}),e)}))),function(e,t){return s.apply(this,arguments)})},{key:"unsubscribe",value:(a=m_(Im.mark((function e(t,r){var n,i,o=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=o.length>2&&void 0!==o[2]&&o[2],tB("unsubscribe()",t),!n){e.next=4;break}return e.abrupt("return",this._unsubscribe(t,r));case 4:if(!this.multiChatMode()||!$C(r)){e.next=6;break}return e.abrupt("return",this._unsubscribe(t,r));case 6:if(i=t.subMediaType-(t.subMediaType&r),this.multiChatMode()||i!==sF.NONE){e.next=9;break}return e.abrupt("return",this._unsubscribe(t,r));case 9:return e.abrupt("return",this._updateSubTrack(t,r,qF.UNSUB));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"_unsubscribe",value:(o=m_(Im.mark((function e(t,r){var n,i,o,a,s,c;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.hasSubscribed){e.next=2;break}return e.abrupt("return");case 2:if(!this._subConfig.muteReplaceUnsub){e.next=4;break}return e.abrupt("return",this._updateSubTrack(t,r,qF.UNSUB));case 4:return s={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",s).catch((function(){})),t.streamState=TF.INIT,this._subStreamQueue[t.streamId]&&(this._subStreamQueue[t.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[t.streamId]),t.subVideo=!1,null===(i=t.observer)||void 0===i||i.setSubscribeVideo(!1),!this.multiChatMode()&&(null===(o=t.observer)||void 0===o||o.setSubscribeAudio(!1)),e.next=13,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:wF.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 13:c=e.sent,this._subResolves[c]&&this._subResolves[c].forEach((function(e){return e(0)})),ZF.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"removeOnTrackListener",value:function(e){var t,r=this._ontrackCallbackMap.get(e);r&&(null===(t=this._handler)||void 0===t||t.off("ontrack",r),this._ontrackCallbackMap.delete(e))}},{key:"handleRemoveStream",value:(i=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(tB("handleRemoveStream()",t),t.subVideo=!1,t.hasSubscribed){e.next=4;break}return e.abrupt("return");case 4:this.unsubscribe(t,Sd.AUDIO_AND_VIDEO,!0);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"leave",value:(n=m_(Im.mark((function e(){var t,r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(ZF.print("leave()"),"connected"!==this.connectionState){e.next=22;break}return this.connectionState="disconnecting",t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},e.next=6,this._joinLeaveLock.lock();case 6:return r=e.sent,e.prev=7,e.next=10,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("leaveRoom",t);case 10:this.connectionState="disconnected",e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(7),this.connectionState="connected",e.t0;case 17:return e.prev=17,r(),e.finish(17);case 20:e.next=23;break;case 22:return e.abrupt("return",v_.reject(new pR(lR.NOT_CONNECTED_YET,"server not connected")));case 23:case"end":return e.stop()}}),e,this,[[7,13,17,20]])}))),function(){return n.apply(this,arguments)})},{key:"subscribePublicStream",value:(r=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this._handler)||void 0===r?void 0:r.subscribe(t,{multiChatMode:!1});case 2:if(a=e.sent){e.next=5;break}throw new pR(lR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return s=RC(),c=a.audioMid,u=a.videoMid,e.t0=this._appId,e.t1=t.streamId,e.t2=c,e.t3=u,e.t4={sdp:null==a?void 0:a.partialSdp,semantics:null==a?void 0:a.semantics,type:null==a?void 0:a.type},e.next=15,DL();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=eN.VERSION,e.t8=YP.getDeviceId(),e.t9=this._appId,e.t10=this._businessId,e.t11=this._useCloudProxy,e.t12={supportedCodecs:e.t5,deviceType:"web",userAgent:e.t6,sdkVersion:e.t7,deviceId:e.t8,appId:e.t9,businessId:e.t10,enableCloudProxy:e.t11},e.t13={enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},d={appId:e.t0,streamId:e.t1,audio:!0,video:!0,data:!0,audioMid:e.t2,videoMid:e.t3,sdpInfo:e.t4,params:e.t12,config:e.t13},e.next=27,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("startPullStream",d);case 27:return l=e.sent,h=[],this._subResolves[t.streamId]=[],h.push(new v_((function(e,r){m._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new pR(lR.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),$F);t.on("ontrack",(function r(i){"video"===i.mediaType&&(ZF.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),h.push(new v_((function(e,r){m._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new pR(lR.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),$F);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(ZF.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p=function(e){t.ontrack(e)},null===(i=this._handler)||void 0===i||i.on("ontrack",p),this._ontrackCallbackMap.set(t,p),f=null==l?void 0:l.relayMessage,v=f.sequenceId,_=f.sdp,t.videoMid=u,t.audioMid=c,t.sequenceId=v,t.streamState=TF.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=44,null===(o=this._handler)||void 0===o?void 0:o.handleAck({action:wF.subscribe,streamId:t.streamId,audioMid:c,videoMid:u,audioTransceiverInit:null==a?void 0:a.audioTransceiverInit,videoTransceiverInit:null==a?void 0:a.videoTransceiverInit,signalingAck:{sdp:_,sequenceId:v},stream:t});case 44:return e.next=46,v_.all(h);case 46:this.monitor.rtcSubscribeStat(lP.SUCCESS,s,hP.UNKNOWN,t.userId),this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 48:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=m_(Im.mark((function e(t){var r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return tB("unsubscribePublicStream()",t),n={appId:this._appId,streamId:t.streamId},e.prev=2,e.next=5,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("stopPullStream",n);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:return t.streamState=TF.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:wF.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 14:t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 17:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;ZF.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===(r=this._iceConfigRequestManager)||void 0===r||r.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState="disconnected",this.emit("INTERRUPT")}},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})}},{key:"sendRoomMessage",value:function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)}},{key:"multiChatMode",value:function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode}},{key:"handler",get:function(){return this._handler}},{key:"roomAttributes",get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e}}]),b}(ex);function nB(e,t,r){var n=r.value;return r.value=m_(Im.mark((function e(){var r,i,o,a=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._handler||"connected"!==this._state){e.next=6;break}for(r=a.length,i=new Array(r),o=0;o<r;o++)i[o]=a[o];return e.next=4,n.apply(this,i);case 4:e.next=7;break;case 6:throw new pR(lR.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function iB(e,t,r){var n=r.value;return r.value=m_(Im.mark((function e(){var t,r,i,o,a=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._pubSubLock.lock();case 2:for(t=e.sent,this.supportConcurrent&&t(),e.prev=4,r=a.length,i=new Array(r),o=0;o<r;o++)i[o]=a[o];return e.next=8,n.apply(this,i);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,this.supportConcurrent||t(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),r}JF([function(e,t,r){var n=r.value;return r.value=m_(Im.mark((function e(){var t,r,i,o,a=this,s=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=s.length,r=new Array(t),i=0;i<t;i++)r[i]=s[i];return o=!1,e.abrupt("return",new v_(function(){var e=m_(Im.mark((function e(t,i){var s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a.on("INTERRUPT",(function(){o=!0,i(new pR(lR.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(a,r);case 4:s=e.sent,t(s),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),o||i(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,r){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)}))),r}],rB.prototype,"join",1),JF([iB,nB],rB.prototype,"publish",1),JF([iB,nB],rB.prototype,"updatePubTrack",1),JF([iB,nB],rB.prototype,"unpublish",1),JF([iB,nB],rB.prototype,"subscribe",1),JF([nB],rB.prototype,"controlMessage",1),JF([nB],rB.prototype,"updateUserAttributes",1),JF([nB],rB.prototype,"updateSubTrack",1),JF([nB],rB.prototype,"updateSubTrackLayer",1),JF([iB,nB],rB.prototype,"subscribe4pushTrack",1),JF([iB,nB],rB.prototype,"unsubscribe4removeTrack",1),JF([iB,nB],rB.prototype,"unsubscribe",1),JF([nB],rB.prototype,"handleRemoveStream",1),JF([iB],rB.prototype,"subscribePublicStream",1),JF([iB],rB.prototype,"unsubscribePublicStream",1);var oB,aB=new Jw("RecvFrameObserver",0),sB=function(){function e(t,r){Wd(this,e),sd(this,"_audioEventSessionId",XC()),sd(this,"_videoEventSessionId",XC()),sd(this,"_handler",void 0),sd(this,"_stream",void 0),sd(this,"_firstAudioFrameTimer",void 0),sd(this,"_firstVideoFrameTimer",void 0),sd(this,"_transportDelayInterval",void 0),sd(this,"_transportDelay",void 0),sd(this,"_firstVideoFrameInterval",void 0),sd(this,"_firstAudioFrameInterval",void 0),sd(this,"_isScreen",!1),sd(this,"_audioFirstFrameState",0),sd(this,"_videoFirstFrameState",0),sd(this,"_timeout",1e4),sd(this,"_currentAudioRecv",{startTime:0,eventSessionId:0,type:_P.LOGIN}),sd(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:_P.LOGIN}),sd(this,"_login",!1),sd(this,"_unMuteAudio",!1),sd(this,"_enableAudio",!1),sd(this,"_unMuteVideo",!1),sd(this,"_enableVideo",!1),sd(this,"_remoteUnmuteAudio",!1),sd(this,"_remoteUnmuteVideo",!1),sd(this,"_audioExternal",!1),sd(this,"_pushAudio",!1),sd(this,"_videoExternal",!1),sd(this,"_pushVideo",!1),sd(this,"_autoSubscribeVideo",!1),sd(this,"_autoSubscribeAudio",!1),sd(this,"_autoSubscribe",!1),sd(this,"_publishVideo",!1),sd(this,"_publishAudio",!1),sd(this,"_subscribeAudio",!1),sd(this,"_subscribeVideo",!1),sd(this,"_subscribe",!1),sd(this,"_pushTrack",!1),sd(this,"_multiChatMode",!1),this._stream=t,this._handler=r,this.getTransportDelay()}var t,r,n,i;return qd(e,[{key:"beginRecvFrame",value:(i=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:i=this._transportDelay,o=!0,a=_P.LOGIN,s=_P.UNMUTE,c=_P.SUBSCRIBE,u=_P.PUSH_TRACK,Kb(n=[a,s,c,u]).call(n,r)>=0&&(i=0,o=!1),t===vP.AUDIO?(o||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},p={media_type:t,event_type:fP.BEGIN_RECV,type:r,is_screen:!(null===(d=this._stream)||void 0===d||!d.isScreen),start:null===(l=this._currentAudioRecv)||void 0===l?void 0:l.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(h=this._stream)||void 0===h?void 0:h.userId,transport_delay:i},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){y.stopRecvFrame(vP.AUDIO,mP.TIMEOUT),y._firstAudioFrameInterval&&window.clearInterval(y._firstAudioFrameInterval)}),this._timeout),aB.print("rtcFirstFrameRecv",ny(p)),CP.rtcFirstFrame(p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===vP.VIDEO&&(o||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},m={media_type:t,event_type:fP.BEGIN_RECV,type:r,is_screen:!(null===(f=this._stream)||void 0===f||!f.isScreen),start:null===(v=this._currentVideoRecv)||void 0===v?void 0:v.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,transport_delay:i},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){y.stopRecvFrame(vP.VIDEO,mP.TIMEOUT),y._firstVideoFrameInterval&&window.clearInterval(y._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),aB.print("rtcFirstFrameRecv",ny(m)),CP.rtcFirstFrame(m),this._videoFirstFrameState=1,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"stopRecvFrame",value:function(e,t){if(e===vP.AUDIO){var r,n,i,o;if(1!==this._audioFirstFrameState)return;var a={event_type:fP.RECV_END,media_type:e,is_screen:!(null===(r=this._stream)||void 0===r||!r.isScreen),start:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.startTime,reason:t,result:!1,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,event_session_id:this._audioEventSessionId,type:null===(o=this._currentAudioRecv)||void 0===o?void 0:o.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,aB.print("rtcFirstFrameRecv",ny(a)),CP.rtcFirstFrame(a),this._audioFirstFrameState=2}else if(e===vP.VIDEO){var s,c,u,d;if(1!==this._videoFirstFrameState)return;var l={event_type:fP.RECV_END,media_type:e,is_screen:!(null===(s=this._stream)||void 0===s||!s.isScreen),start:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.startTime,reason:t,result:!1,stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._videoEventSessionId,type:null===(d=this._currentVideoRecv)||void 0===d?void 0:d.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,aB.print("rtcFirstFrameRecv",ny(l)),CP.rtcFirstFrame(l),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,n=_P.LOGIN,i=_P.UNMUTE,o=_P.SUBSCRIBE,a=_P.PUSH_TRACK,t!==vP.AUDIO){e.next=19;break}if(1===this._audioFirstFrameState){e.next=7;break}return e.abrupt("return");case 7:if(this._currentAudioRecv){e.next=9;break}return e.abrupt("return");case 9:d=this._currentAudioRecv,l=d.type,h=d.startTime,Kb(s=[n,i,o,a]).call(s,l)>=0&&(r=0),p={event_type:fP.RECV_END,media_type:t,start:h,result:!0,is_screen:!(null===(c=this._stream)||void 0===c||!c.isScreen),stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),aB.print("rtcFirstFrameRecv",ny(p)),CP.rtcFirstFrame(p),this._audioFirstFrameState=3,e.next=32;break;case 19:if(t!==vP.VIDEO){e.next=32;break}if(1===this._videoFirstFrameState){e.next=22;break}return e.abrupt("return");case 22:if(this._currentVideoRecv){e.next=24;break}return e.abrupt("return");case 24:m=this._currentVideoRecv,y=m.type,g=m.startTime,Kb(f=[n,i,o,a]).call(f,y)>=0&&(r=0),S={event_type:fP.RECV_END,media_type:t,is_screen:!(null===(v=this._stream)||void 0===v||!v.isScreen),start:g,result:!0,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,event_session_id:this._videoEventSessionId,type:y,transport_delay:r},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),aB.print("rtcFirstFrameRecv",ny(S)),CP.rtcFirstFrame(S),this._videoFirstFrameState=3;case 32:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setLogin",value:function(e){var t,r,n,i,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{audio:!0,video:!0};this._login!==e&&(this._login=e,e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&o.audio&&this.beginRecvFrame(vP.AUDIO,_P.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&o.video&&this.beginRecvFrame(vP.VIDEO,_P.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(vP.AUDIO,mP.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(vP.VIDEO,mP.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t,r,n;if(this._unMuteAudio!==e){this._unMuteAudio=e;var i=!(null===(t=this._stream)||void 0===t||!t.hasAudio);null!==(r=this._stream)&&void 0!==r&&r.audioHasCapture&&null!==(n=this._stream)&&void 0!==n&&n.audioHasPublish&&(this._unMuteAudio&&i?this.beginRecvFrame(vP.AUDIO,_P.UNMUTE):i&&this.stopRecvFrame(vP.AUDIO,mP.MUTE))}}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(vP.AUDIO,_P.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(vP.AUDIO,mP.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(vP.AUDIO,_P.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(vP.AUDIO,mP.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t,r,n;if(this._unMuteVideo!==e){this._unMuteVideo=e;var i=!(null===(t=this._stream)||void 0===t||!t.hasVideo);null!==(r=this._stream)&&void 0!==r&&r.videoHasCapture&&null!==(n=this._stream)&&void 0!==n&&n.videoHasPublish&&(this._unMuteVideo&&i?this.beginRecvFrame(vP.VIDEO,_P.UNMUTE):i&&this.stopRecvFrame(vP.VIDEO,mP.MUTE))}}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(vP.VIDEO,_P.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(vP.VIDEO,mP.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(vP.VIDEO,_P.ENABLE):this.stopRecvFrame(vP.VIDEO,mP.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal=e}},{key:"setPushAudio",value:function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(vP.AUDIO,_P.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(vP.AUDIO,_P.PUSH)}},{key:"setExternalVideoSource",value:function(e){this._videoExternal=e}},{key:"setPushVideo",value:function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(vP.VIDEO,_P.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(vP.VIDEO,_P.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(vP.VIDEO,_P.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(vP.VIDEO,mP.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(vP.AUDIO,_P.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(vP.AUDIO,mP.UNPUBLISH)}},{key:"setAutoSubscribe",value:function(e){this._autoSubscribe=e}},{key:"setAutoSubscribeVideo",value:function(e){this._autoSubscribeVideo=e}},{key:"setAutoSubscribeAudio",value:function(e){this._autoSubscribeAudio=e}},{key:"setSubscribeAudio",value:function(e){var t,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasAudio&&this.beginRecvFrame(vP.AUDIO,_P.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(vP.AUDIO,mP.UNSUBSCRIBE)}},{key:"setSubscribeVideo",value:function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&this.beginRecvFrame(vP.VIDEO,_P.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(vP.VIDEO,mP.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(vP.AUDIO,_P.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(vP.AUDIO,mP.REMOVE_TRACK))}},{key:"setMultiChatMode",value:function(e){this._multiChatMode=e}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"_watchForFirstVideoFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(m_(Im.mark((function n(){var i,o,a,s,c,u,d,l;return Im.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(o=e._stream)||void 0===o||null===(a=o.videoTrack)||void 0===a||!a.getTrack()){n.next=12;break}return n.next=3,CL(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(c=e._stream)||void 0===c||null===(u=c.videoTrack)||void 0===u?void 0:u.getTrack());case 3:if(d=n.sent,!(l=Nb(d).call(d,(function(e){return"inbound-rtp"===e.type})))||!(l.framesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.framesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(vP.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"_watchForFirstAudioFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(m_(Im.mark((function n(){var i,o,a,s,c,u,d,l;return Im.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(o=e._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a||!a.getTrack()){n.next=12;break}return n.next=3,CL(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(c=e._stream)||void 0===c||null===(u=c.audioTrack)||void 0===u?void 0:u.getTrack());case 3:if(d=n.sent,!(l=Nb(d).call(d,(function(e){return"inbound-rtp"===e.type})))||!(l.totalSamplesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.totalSamplesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(vP.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=m_(Im.mark((function e(){var t=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelayIntl();case 2:window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval(m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getTransportDelayIntl();case 2:case"end":return e.stop()}}),e)}))),2e3);case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getTransportDelayIntl",value:(t=m_(Im.mark((function e(){var t,r,n,i,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc){e.next=7;break}return e.next=3,CL(null===(r=this._handler)||void 0===r?void 0:r.pc);case 3:n=e.sent,i=Nb(n).call(n,(function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(o=Nb(n).call(n,(function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==i?void 0:i.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*o.currentRoundTripTime/2));case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:_P.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:_P.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}(),cB=new Jw("SendFrameObserver",0),uB=function(){function e(t,r){Wd(this,e),sd(this,"_audioEventSessionId",XC()),sd(this,"_videoEventSessionId",XC()),sd(this,"_pcSessionId",void 0),sd(this,"_handler",void 0),sd(this,"_firstAudioFrameTimer",void 0),sd(this,"_firstVideoFrameTimer",void 0),sd(this,"_stream",void 0),sd(this,"_firstVideoFrameInterval",void 0),sd(this,"_firstAudioFrameInterval",void 0),sd(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:_P.LOGIN}),sd(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:_P.LOGIN}),sd(this,"_login",!1),sd(this,"_publisher",!1),sd(this,"_unMuteAudio",!1),sd(this,"_enableAudio",!1),sd(this,"_unMuteVideo",!1),sd(this,"_enableVideo",!1),sd(this,"_audioExternal",!1),sd(this,"_pushAudio",!1),sd(this,"_videoExternal",!1),sd(this,"_pushVideo",!1),sd(this,"_autoPublish",!1),sd(this,"_publish",!1),sd(this,"_timeout",1e4),sd(this,"_audioFirstFrameState",0),sd(this,"_videoFirstFrameState",0),this._stream=t,this._handler=r}var t,r;return qd(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if(e===vP.AUDIO){var n,i;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var o={event_type:fP.BEGIN_SEND,media_type:e,is_screen:!(null===(n=this._stream)||void 0===n||!n.isScreen),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(){r.stopSendFrame(vP.AUDIO,mP.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),cB.print("rtcFirstFrameSend",ny(o)),CP.rtcFirstFrame(o),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===vP.VIDEO){var a,s;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var c={event_type:fP.BEGIN_SEND,media_type:e,is_screen:!(null===(a=this._stream)||void 0===a||!a.isScreen),type:t,start:null===(s=this._currentVideoSend)||void 0===s?void 0:s.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){r.stopSendFrame(vP.VIDEO,mP.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),cB.print("rtcFirstFrameSend",ny(c)),CP.rtcFirstFrame(c),this._videoFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}}},{key:"stopSendFrame",value:function(e,t){if(e===vP.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var o={event_type:fP.SENT_END,media_type:e,is_screen:!(null===(r=this._stream)||void 0===r||!r.isScreen),start:null===(n=this._currentAudioSend)||void 0===n?void 0:n.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioSend)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,cB.print("rtcFirstFrameSend",ny(o)),CP.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===vP.VIDEO){var a,s,c;if(1!==this._videoFirstFrameState)return;var u={event_type:fP.SENT_END,media_type:e,start:null===(a=this._currentVideoSend)||void 0===a?void 0:a.startTime,is_screen:!(null===(s=this._stream)||void 0===s||!s.isScreen),reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoSend)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,cB.print("rtcFirstFrameSend",ny(u)),CP.rtcFirstFrame(u),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===vP.AUDIO){var t;if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var r=this._currentAudioSend,n=r.type,i=r.startTime,o={event_type:fP.SENT_END,media_type:e,is_screen:!(null===(t=this._stream)||void 0===t||!t.isScreen),start:i,result:!0,event_session_id:this._audioEventSessionId,type:n};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),cB.print("rtcFirstFrameSend",ny(o)),CP.rtcFirstFrame(o),this._audioFirstFrameState=3}else if(e===vP.VIDEO){var a;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var s=this._currentVideoSend,c=s.type,u=s.startTime,d={event_type:fP.SENT_END,media_type:e,is_screen:!(null===(a=this._stream)||void 0===a||!a.isScreen),start:u,result:!0,event_session_id:this._videoEventSessionId,type:c};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),cB.print("rtcFirstFrameSend",ny(d)),CP.rtcFirstFrame(d),this._videoFirstFrameState=3}}},{key:"setLogin",value:function(e){if(this._login!==e){var t,r;if(this._login=e,e)null!==(t=this._stream)&&void 0!==t&&t.videoTrack&&this.beginSendFrame(vP.VIDEO,_P.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(vP.AUDIO,_P.LOGIN);!e&&this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r,n,i;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&(null===(r=this._stream)||void 0===r?void 0:r.pubVideo)&&this.beginSendFrame(vP.VIDEO,_P.PUBLISH),(null===(n=this._stream)||void 0===n?void 0:n.audioTrack)&&(null===(i=this._stream)||void 0===i?void 0:i.pubAudio)&&this.beginSendFrame(vP.AUDIO,_P.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,null!==(t=this._stream)&&void 0!==t&&t.audioHasCapture&&(e&&this.beginSendFrame(vP.AUDIO,_P.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.MUTE)))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubAudio&&(this._enableAudio=e,e&&this.beginSendFrame(vP.AUDIO,_P.ENABLE),!e&&this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,null!==(t=this._stream)&&void 0!==t&&t.videoHasCapture&&(e&&this.beginSendFrame(vP.VIDEO,_P.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.MUTE)))}},{key:"setEnableVideo",value:function(e){var t;this._enableVideo!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubVideo&&(this._enableVideo=e,e&&this.beginSendFrame(vP.VIDEO,_P.ENABLE),!e&&this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(vP.AUDIO,_P.PUSH),!e&&this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(vP.VIDEO,_P.PUSH),!e&&this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.STOP_PUSH))}},{key:"setAutoPublish",value:function(e){this._autoPublish=e}},{key:"setPublisher",value:function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.AUDIENCE))}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"setPCSessionId",value:function(e){this._pcSessionId=e}},{key:"setHandler",value:function(e){this._handler=e}},{key:"_getFirstVideoFrameStats",value:(r=m_(Im.mark((function e(){var t,r,n,i,o,a,s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.videoTrack)||void 0===n||!n.getTrack("preprocessing")){e.next=5;break}return e.next=3,CL(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=this._stream)||void 0===o||null===(a=o.videoTrack)||void 0===a?void 0:a.getTrack("preprocessing"));case 3:return s=e.sent,e.abrupt("return",Nb(s).call(s,(function(e){return"outbound-rtp"===e.type})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=m_(Im.mark((function e(){var t,r,n,i,o,a,s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.audioTrack)||void 0===n||!n.getTrack("preprocessing")){e.next=5;break}return e.next=3,CL(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=this._stream)||void 0===o||null===(a=o.audioTrack)||void 0===a?void 0:a.getTrack("preprocessing"));case 3:return s=e.sent,e.abrupt("return",Nb(s).call(s,(function(e){return"outbound-rtp"===e.type})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_watchForFirstVideoFrameSend",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(m_(Im.mark((function n(){var i;return Im.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e._getFirstVideoFrameStats();case 2:if(!(i=n.sent)||!(i.framesSent>t||i.packetsSent>r)){n.next=10;break}if(-1!==t||-1!==r){n.next=8;break}return t=i.framesSent,r=i.packetsSent,n.abrupt("return");case 8:e.sendFrameFinish(vP.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 10:case"end":return n.stop()}}),n)}))),100)}},{key:"_watchForFirstAudioFrameSend",value:function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(m_(Im.mark((function r(){var n;return Im.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e._getFirstAudioFrameStats();case 2:if(!((n=r.sent)&&n.packetsSent>t)){r.next=9;break}if(-1!==t){r.next=7;break}return t=n.packetsSent,r.abrupt("return");case 7:e.sendFrameFinish(vP.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 9:case"end":return r.stop()}}),r)}))),100)}},{key:"reset",value: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=0,this._videoFirstFrameState=0,this._currentAudioSend={startTime:0,eventSessionId:0,type:_P.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:_P.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)}},{key:"destroy",value:function(){this.reset(),delete this._stream,delete this._handler}},{key:"_audioSending",get:function(){return 1===this._audioFirstFrameState}},{key:"_videoSending",get:function(){return 1===this._videoFirstFrameState}}]),e}(),dB=(sd(oB={},"audio",{delay:1200,stallRadio:.3}),sd(oB,"video",{delay:1200,stallRadio:.6}),sd(oB,"screen_audio",{delay:1600,stallRadio:.8}),sd(oB,"screen_video",{delay:1600,stallRadio:.8}),oB),lB=function(){function e(){Wd(this,e),sd(this,"_preUplinkStats",new bE),sd(this,"_preDownlinkStats",new bE),sd(this,"_timer",void 0),sd(this,"_delayTimer",void 0),sd(this,"_connectionState",eB.CONNECTED),sd(this,"reportor",void 0)}return qd(e,[{key:"updateUplinkStats",value:function(e){var t=e.audioStats,r=e.videoStats,n=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var i,o,a=n?"screen_audio":"audio",s=t.rtt,c=t._fractionLost,u=t._retransmittedRate,d=this._getQosLevel(s,c||0,u||0),l=this._preUplinkStats.get(a)||[d];this._preUplinkStats.set(a,km(i=xm(o=[]).call(o,Qk(l),[d])).call(i,-2))}if(r.sentKBitrate>0&&r.rtt){var h,p,f=n?"screen_video":"video",v=r._fractionLost,_=r.rtt,m=r._sendBandWidth,y=r._retransmittedRate;0===m&&(v=Math.max(.65,v));var g=this._getQosLevel(_,v||0,y||0),S=this._preUplinkStats.get(f)||[g];this._preUplinkStats.set(f,km(h=xm(p=[]).call(p,Qk(S),[g])).call(h,-2))}this._startNetworkQualityReport()}},{key:"updateDownlinkStats",value:function(e,t){if(t){var r,n,i=this._getStreamActiveState(t),o=i.audioActive,a=i.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId;if(o)if(0===s.receivedKBitrate)r=xd.VBAD;else{var l=s.rtt,h=s.audioLossRate,p=s.stallDuration,f=s.statsInterval,v=s.e2eDelay,_=p/f,m=u?"screen_audio":"audio",y=this._getQosLevel(l,h||0,c._retransmittedRate||0),g=this._getDownlinkQoE(m,_,v);r=this._getNetworkQuality(y,g)}if(a)if(0===c.receivedKBitrate||0===c.rtt)n=xd.VBAD;else{var S=c.rtt,E=c.videoLossRate,b=c.stallDuration,k=c.statsInterval,T=c.e2eDelay,I=c._retransmittedRate,A=b/k,R=u?"screen_video":"video",C=this._getQosLevel(S,E||0,I||0),w=this._getDownlinkQoE(R,A,T);n=this._getNetworkQuality(C,w)}var x=r&&n?Math.ceil((r+n)/2):r||n;if(x){var O,D,P,N=xm(O="".concat(d)).call(O,u?"_screen":""),M=this._preDownlinkStats.get(N)||[x];this._preDownlinkStats.set(N,km(D=xm(P=[]).call(P,Qk(M),[x])).call(D,-2)),this._startNetworkQualityReport()}}}},{key:"setConnectionState",value:function(e){this._connectionState=e}},{key:"destroy",value: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()}},{key:"_startNetworkQualityReport",value: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))}},{key:"_reportNetworkQuality",value:function(){var e,t,r=this;if(this._connectionState!==eB.CONNECTED)e=t=xd.VBAD;else{var n,i,o,a=this._getBetterQualityAndRemoveOldest("audio","up"),s=this._getBetterQualityAndRemoveOldest("video","up");e=a&&s?Math.ceil((a+s)/2):a||s||this._getBetterQualityAndRemoveOldest("screen_video","up")||this._getBetterQualityAndRemoveOldest("screen_audio","up")||xd.EXCELLENT;var c=Gs(n=uy(i=Wk(Hw(o=this._preDownlinkStats).call(o))).call(i,(function(e){return r._getBetterQualityAndRemoveOldest(e,"down")}))).call(n,(function(e){return e}));t=Math.ceil(LE(c).call(c,(function(e,t){return t+e}),0)/c.length)||xd.UNKNOWN}"function"==typeof this.reportor&&this.reportor(e,t)}},{key:"_getNetworkQuality",value:function(e,t){return 1===t?Math.max(e-2,1):2===t?e:Math.min(e+1,5)}},{key:"_getQosLevel",value:function(e,t,r){var n;return n=(!e||e<=250)&&t<=.15?1:(!e||e<=500)&&t<=.3?2:(!e||e<=750)&&t<=.45?3:(!e||e<=1e3)&&t<=.6?4:5,r>.5?n=Math.max(n,4):r>.35?n=Math.max(n,3):r>.15&&(n=Math.max(n,2)),n}},{key:"_getUplinkQoE",value:function(e,t){var r=0;switch(e){case"audio":case"video":r=t<.05?1:t<.1?2:3;break;case"screen_video":case"screen_audio":r=t<.04?1:t<.08?2:3}return r}},{key:"_getDownlinkQoE",value:function(e,t,r){var n=dB[e];return t>n.stallRadio||r>n.delay||t>n.stallRadio/2&&r>n.delay/2?3:(t>n.stallRadio/2||n.delay,2)}},{key:"_getBetterQualityAndRemoveOldest",value:function(e,t){var r=xd.UNKNOWN,n="up"===t?this._preUplinkStats:this._preDownlinkStats,i=n.get(e);if(i){var o=Gs(i).call(i,(function(e){return e}));o.length>0&&(r=Math.min.apply(Math,Qk(o))),i.shift(),0===i.length&&n.delete(e)}return r}},{key:"_getStreamActiveState",value:function(e){var t=e.subMediaType,r=e._attributes,n=e.subVideo;return{audioActive:e.subAudio&&ZC(t)&&r.localaudio&&r.audiostream,videoActive:n&&$C(t)&&r.localvideo&&r.videostream}}}]),e}(),hB=function(){function e(t){Wd(this,e),sd(this,"_timer",void 0),sd(this,"_remoteVideoSizeCache",{}),sd(this,"_remoteScreenSizeCache",{}),sd(this,"onchange",void 0),this._room=t,this._start()}return qd(e,[{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}}},{key:"_start",value:function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},r={};e._room.remoteStreams.forEach((function(n,i){n.forEach((function(n){var o,a=null===(o=n.videoTrack)||void 0===o?void 0:o.getTrack();if(a){var s=n.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[i]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,p=a.getSettings(),f=p.width,v=void 0===f?0:f,_=p.height,m=void 0===_?0:_;h===m&&d===v||"function"==typeof e.onchange&&e.onchange(i,n.isScreen,v,m),delete s[i],(n.isScreen?r:t)[i]={width:v,height:m}}}))})),an(e._remoteVideoSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!1,0,0)})),an(e._remoteScreenSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))}}]),e}(),pB=Wk((new TextEncoder).encode("subt")),fB={1:lR.SUBTITLE_ERR_POSTPROCESS,2:lR.SUBTITLE_ERR_CONNECTION_ERROR,3:lR.SUBTITLE_ERR_PROCESS_ERROR},vB=new Jw("SubtitleTool",1),_B=function(e){if(e.extraInfo)try{var t,r=JSON.parse(e.extraInfo);r.source_language&&Kb(t=["zh","en","ja"]).call(t,r.source_language)}catch(a){}else{var n,i,o=(null===(n=navigator.language)||void 0===n?void 0:n.substring(0,2))||"";Kb(i=["zh","en","ja"]).call(i,o)>-1&&(e.extraInfo=ny({source_language:o}))}},mB=function(){function e(t){var r,n,i;Wd(this,e),sd(this,"_taskId",void 0),sd(this,"_appId",void 0),sd(this,"_roomId",void 0),sd(this,"_userId",void 0),sd(this,"onEvent",void 0),sd(this,"onMessage",void 0),sd(this,"_preConfig",void 0),sd(this,"_timer",void 0),this._room=t,this._appId=null===(r=this._room._roomInfo)||void 0===r?void 0:r.appId,this._roomId=null===(n=this._room._roomInfo)||void 0===n?void 0:n.roomId,this._userId=null===(i=this._room._roomInfo)||void 0===i?void 0:i.userInfo.userId}var t,r,n;return qd(e,[{key:"start",value:(n=m_(Im.mark((function e(t){var r=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vB.print("start","Invoke config: %o",t),vw(t.mode,"mode",[Ud.ASR_ONLY,Ud.ASR_AND_TRANSLATION]),t.mode!==Ud.ASR_AND_TRANSLATION||-1!==Kb(gB).call(gB,t.targetLanguage||"")){e.next=4;break}throw new pR(lR.INVALID_PARAMS,"Invalid targetLanguage.");case 4:if(!this._taskId){e.next=6;break}throw new pR(lR.SUBTITLE_ALREADY_ON,"Already turned on subtitle");case 6:return this._preConfig=t,this._taskId=(Date.now().toString()+this._roomId+this._userId).substring(0,20),e.next=10,this._room.subtitleControlMessage(this._genSubtitleSignaling("started",t,this._taskId));case 10:this._preConfig=t,this._timer=self.setTimeout((function(){var e;null===(e=r.onEvent)||void 0===e||e.call(r,{event:Vd.ERROR,errorCode:lR.TIME_OUT,errorMessage:"start subtitle timeout."}),delete r._timer,r.stop()}),3e4);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"update",value:(r=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vw(t.mode,"mode",[Ud.ASR_ONLY,Ud.ASR_AND_TRANSLATION]),t.mode!==Ud.ASR_AND_TRANSLATION||-1!==Kb(gB).call(gB,t.targetLanguage||"")){e.next=3;break}throw new pR(lR.INVALID_PARAMS,"Invalid targetLanguage.");case 3:if(!this._taskId){e.next=5;break}throw new pR(lR.SUBTITLE_ALREADY_ON,"Already started subtitle");case 5:if(this._taskId){e.next=7;break}throw new pR(lR.SUBTITLE_NOT_TURNED_ON,"Start subtitle first.");case 7:if((null===(r=this._preConfig)||void 0===r?void 0:r.mode)===t.mode&&this._preConfig.targetLanguage===t.targetLanguage){e.next=11;break}return this._preConfig=t,e.next=11,this._room.subtitleControlMessage(this._genSubtitleSignaling("update",t,this._taskId));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stop",value:function(){var e=this;vB.print("stop","Invoke"),this._taskId&&this._room.subtitleControlMessage({type:"subtitle",action:"stopped",appId:this._appId,roomId:this._roomId,userId:this._userId,taskId:this._taskId}).finally((function(){var t;delete e._taskId,null===(t=e.onEvent)||void 0===t||t.call(e,{event:Vd.STOPPED}),e._clearTimer()}))}},{key:"reconnect",value:(t=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._taskId||!this._preConfig){e.next=5;break}return e.next=3,this._room.subtitleControlMessage({type:"subtitle",action:"stopped",appId:this._appId,roomId:this._roomId,userId:this._userId,taskId:this._taskId});case 3:delete this._taskId,this.start(this._preConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getConfig",value:function(){return this._preConfig}},{key:"destroy",value:function(){vB.print("destroy","Invoke"),this.stop(),delete this._preConfig,delete this._taskId}},{key:"onResult",value:function(e){var t=e.body,r=t.error,n=t.errorMessage,i=t.eventType;if(0!==r){var o,a=new pR(fB[r]||lR.SUBTITLE_ERR_UNKNOWN,n||"");null===(o=this.onEvent)||void 0===o||o.call(this,{event:Vd.ERROR,errorCode:a.code,errorMessage:a.message}),this._clearTimer()}else if("SubtitleStarted"===i){var s;null===(s=this.onEvent)||void 0===s||s.call(this,{event:Vd.STARTED}),this._clearTimer()}}},{key:"onMessageRecv",value:function(e){if(this._taskId&&this._preConfig){var t=yB(e);if(t&&t.length>0){var r,n=this._preConfig,i=n.mode,o=n.targetLanguage,a=[];if(t.forEach((function(e){i===Ud.ASR_ONLY?e.mode===i&&a.push(e):i===Ud.ASR_AND_TRANSLATION&&(e.language!==o&&e.mode!==Ud.ASR_ONLY||a.push(e),e.mode===Ud.ASR_ONLY&&e.language===o&&a.push(ud(ud({},e),{},{mode:Ud.ASR_AND_TRANSLATION})))})),a.length>0)null===(r=this.onMessage)||void 0===r||r.call(this,a)}return!!t}return!1}},{key:"_genSubtitleSignaling",value:function(e,t,r){return{taskId:r,type:"subtitle",action:e,roomId:this._roomId,appId:this._appId,userId:this._userId,subtitleMeta:{subtitleConfig:{mode:t.mode,usersConfig:[{userId:this._userId,targetLanguages:[t.targetLanguage||""]}]},vendorConfig:{type:0}}}}},{key:"_clearTimer",value:function(){this._timer&&(self.clearTimeout(this._timer),delete this._timer)}}]),e}(),yB=function(e){var t=e.message;if(t instanceof ArrayBuffer&&t.byteLength>8)try{var r=new DataView(t,0),n=0;if(pB.every((function(e){return r.getUint8(n++)===e}))){var i=r.getUint32(n);if(n+=4,i===r.byteLength-8){var o=xC.ab2str(km(t).call(t,8)),a=JSON.parse(o),s=a.data;if("subtitle"===a.type)return s}}}catch(c){}return!1},gB=["zh","zh-Hant","tn","vi","iu","it","id","hi","en","ho","he","es","el","uk","ur","tk","tr","ti","ty","tl","to","th","ta","te","sl","sk","ss","eo","sm","sg","st","sv","ja","tw","qu","pt","pa","no","nb","nr","my","bn","mn","mh","mk","ml","mr","ms","lu","ro","lt","lv","lo","kj","hr","kn","ki","cs","ca","nl","ko","ht","gu","ka","kl","km","lg","kg","fi","fj","fr","ru","ng","de","tt","da","ts","cv","fa","bs","pl","bi","nd","ba","bg","az","ar","af","sq","ab","os","ee","et","ay","lzh","am","ckb","cy","gl","ha","hy","ig","kmr","ln","nso","ny","om","sn","so","sr","sw","xh","yo","zu"],SB=new Jw("Room",1),EB={audiostream:!0,extaudio:!1,extvideo:!1,localaudio:!0,localvideo:!1,videoDescriptions:[],videostream:!1},bB=function(e){DI(I,e);var t,r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T=YI(I);function I(e,t){var r;return Wd(this,I),sd(eI(r=T.call(this)),"id",void 0),sd(eI(r),"_mediaServerClient",void 0),sd(eI(r),"_localStream",void 0),sd(eI(r),"_localScreenStream",void 0),sd(eI(r),"_remoteUsers",new bE),sd(eI(r),"_remoteStreams",new bE),sd(eI(r),"_remoteStreamStreamIdUserIdMap",{}),sd(eI(r),"_virtualStreams",[]),sd(eI(r),"_joinResolveCallback",void 0),sd(eI(r),"_joinRejectCallback",void 0),sd(eI(r),"_getAccessNode",void 0),sd(eI(r),"_getAccessFeedback",void 0),sd(eI(r),"_getAccessFeedbackIceNode",void 0),sd(eI(r),"_reconnectTimer",void 0),sd(eI(r),"_isReconnecting",void 0),sd(eI(r),"_context",void 0),sd(eI(r),"_sessionId",void 0),sd(eI(r),"_reconnectRecord",void 0),sd(eI(r),"_connectionLostTimer",void 0),sd(eI(r),"_liveControlMessage",void 0),sd(eI(r),"_serverConfig",void 0),sd(eI(r),"_liveTranscodingOnceSucc",!1),sd(eI(r),"_roomConfig",void 0),sd(eI(r),"_roomInfo",void 0),sd(eI(r),"_waitForNewToken",!1),sd(eI(r),"_userDuplicateLoginTimerMap",new bE),sd(eI(r),"_networkQualityManager",void 0),sd(eI(r),"_videoSizeObserver",void 0),sd(eI(r),"_hasPublished",!1),sd(eI(r),"_subtitleTool",void 0),sd(eI(r),"_csrcUserIdMap",void 0),sd(eI(r),"_publishOnDemandItem",void 0),sd(eI(r),"_publishOnDemandBusy",!1),r.id=null==t?void 0:t.id,r._roomConfig=e,r._mediaServerClient=new rB(t),r._reconnectRecord=new kB,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new lB,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(eI(r)),r._videoSizeObserver=new hB(eI(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(eI(r)),r._context=t,r._csrcUserIdMap={},r}return qd(I,[{key:"hasScreenPublished",get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished}},{key:"hasPublished",get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished}},{key:"connectionState",get:function(){return this._mediaServerClient.connectionState}},{key:"remoteUsers",get:function(){return this._remoteUsers}},{key:"remoteStreams",get:function(){return this._remoteStreams}},{key:"localStream",get:function(){return this._localStream}},{key:"localScreenStream",get:function(){return this._localScreenStream}},{key:"roomInfo",get:function(){return this._roomInfo}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x=this;null===(e=this._mediaServerClient)||void 0===e||e.on(dN.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(dN.ON_ADD_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return x._onAddStream(e)}))})),null===(r=this._mediaServerClient)||void 0===r||r.on(dN.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(dN.ON_REMOVE_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return x._onRemoveStream(e)}))})),null===(i=this._mediaServerClient)||void 0===i||i.on(dN.USER_CONNECTION,this._onUserConnection.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(dN.USER_CONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return x._onUserConnection(e)}))})),null===(a=this._mediaServerClient)||void 0===a||a.on(dN.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(dN.USER_DISCONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return x._onUserDisconnection(e)}))})),null===(c=this._mediaServerClient)||void 0===c||c.on(dN.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(dN.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(dN.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(dN.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(dN.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(dN.NODE_CHANGE,this._nodeChange.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(dN.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(dN.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(dN.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(dN.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(dN.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(dN.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(dN.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(E=this._mediaServerClient)||void 0===E||E.on(lN.RSCP,(function(e){!!Nb(e).call(e,(function(e){var t,r,n;return null==e||null===(t=e.StreamIds)||void 0===t?void 0:$m(t).call(t,null===(r=x._localStream)||void 0===r||null===(n=r.stream)||void 0===n?void 0:n.id)}))&&(x._publishOnDemandItem=e,x._onPublishOnDemand())})),null===(b=this._mediaServerClient)||void 0===b||b.on(lN.RTT,this._onRTT.bind(this)),null===(k=this._mediaServerClient)||void 0===k||k.on(hN.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(T=this._mediaServerClient)||void 0===T||T.on(hN.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(I=this._mediaServerClient)||void 0===I||I.on(dN.ON_SPEAKER_CHANGE,this._onMeetingSpeakerChange.bind(this)),null===(A=this._mediaServerClient)||void 0===A||A.on("onRemoteStreamStats",(function(e){x._networkQualityManager.updateDownlinkStats(e,x._findRemoteStreamByScreen(e.userId,e.isScreen)),x.emit(zF.ON_REMOTE_STREAM_STATS,ew(e))})),null===(R=this._mediaServerClient)||void 0===R||R.on("onLocalStreamStats",(function(e){x._networkQualityManager.updateUplinkStats(e),x.emit(zF.ON_LOCAL_STREAM_STATS,ew(e))})),null===(C=this._mediaServerClient)||void 0===C||C.on("prevIceNode",(function(e){x._getAccessFeedbackIceNode=e})),null===(w=this._mediaServerClient)||void 0===w||w.on("prevIceNode",(function(e){x._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(k=m_(Im.mark((function e(t,r,n,i,o,a,s){var c=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return OP.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),SB.print("join()"),e.abrupt("return",new v_((function(e,u){var d,l,h=RC();c._joinResolveCallback=function(t){var r;CP.joinRoom(gP.END,h,!0,"",{enable_cloud_proxy:null===(r=c._roomInfo)||void 0===r?void 0:r.useCloudProxy}),c._initSubtitleTool(),e(t)},c._joinRejectCallback=function(e){var t;Array.isArray(e)&&e.length&&(e=e[0]),CP.joinRoom(gP.END,h,!1,e.message,{enable_cloud_proxy:null===(t=c._roomInfo)||void 0===t?void 0:t.useCloudProxy}),u(e)},c._liveControlMessage=o,c._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:a,roomProfile:c._roomConfig.roomProfileType,expectedIDC:s},c.setSessionId(),CP.joinRoom(gP.BEGIN,h,!1,"",{enable_cloud_proxy:null===(d=c._roomInfo)||void 0===d?void 0:d.useCloudProxy,expectedIDC:null===(l=c._roomInfo)||void 0===l?void 0:l.expectedIDC}),c._join(c._joinResolveCallback,c._joinRejectCallback,!1)})));case 3:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,o,a){return k.apply(this,arguments)})},{key:"_join",value:(b=m_(Im.mark((function e(t,r){var n,i,o,a,s=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]&&s[2],i=RC(),SB.print("_join()"),e.prev=3,e.next=6,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},n,this._liveControlMessage);case 6:a=e.sent,this._mediaServerClient.roomAttributes=a.roomAttributes,null!==(o=a.roomAttributes)&&void 0!==o&&o.multiChatMode&&this._handleFFAudioTrack(),this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof t&&t({users:a.clients,streams:a.streams}),this._isReconnecting=!1,CP.rtcJoinRoom(0,"web","web",RC()-i),this._onJoinSucc(a,n),e.next=26;break;case 20:if(e.prev=20,e.t0=e.catch(3),this._getAccessFeedback=void 0,this._getAccessNode=void 0,e.t0.code===lR.OPERATION_CANCEL||"function"!=typeof r){e.next=26;break}return e.abrupt("return",r(e.t0));case 26:case"end":return e.stop()}}),e,this,[[3,20]])}))),function(e,t){return b.apply(this,arguments)})},{key:"publishScreen",value:(E=m_(Im.mark((function e(t,r,n,i,o){var a,s,c,u,d,l,h,p,f,v;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(SB.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new IF,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new uB(this._localScreenStream,this._mediaServerClient.handler))),a=!1,s=!1,c=!1,u=!1,!this._localScreenStream.videoTrack&&r?(r instanceof MV&&(s=!0),a=!0):this._localScreenStream.videoTrack&&!r&&(a=!1),!this._localScreenStream.audioTrack&&n?(n instanceof LV&&(u=!0),c=!0):this._localScreenStream.audioTrack&&!n&&(c=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(ZC(i)&&(this._localScreenStream.pubAudio=o===XF.PUB),$C(i)&&(this._localScreenStream.pubVideo=o===XF.PUB),SB.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo){e.next=18;break}if(null===(d=this._localScreenStream)||void 0===d||!d.hasPublished){e.next=17;break}return e.abrupt("return",this.unpublishScreen());case 17:return e.abrupt("return");case 18:if(this._localScreenStream.hasPublished){e.next=24;break}return null===(l=this._localScreenStream.observer)||void 0===l||l.setPublish(!0),e.next=22,this._mediaServerClient.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return s?null===(h=this._localScreenStream.observer)||void 0===h||h.setPushVideo(a):null===(p=this._localScreenStream.observer)||void 0===p||p.setEnableVideo(a),u?null===(f=this._localScreenStream.observer)||void 0===f||f.setPushAudio(c):null===(v=this._localScreenStream.observer)||void 0===v||v.setEnableAudio(c),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return E.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(S=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(SB.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),!this._localScreenStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localScreenStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return S.apply(this,arguments)})},{key:"unpublishScreen",value:(g=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(SB.print("unpublish","Invoke unpublishScreen"),!this._localScreenStream){e.next=7;break}return null===(t=this._localScreenStream.observer)||void 0===t||t.setPublish(!1),e.next=5,this._mediaServerClient.unpublish(this._localScreenStream);case 5:this._localScreenStream.clean(),this._localScreenStream=void 0;case 7:case"end":return e.stop()}}),e,this)}))),function(){return g.apply(this,arguments)})},{key:"liveControlMessage",value:(y=m_(Im.mark((function e(t){var r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return SB.print("controlMessage","Invoke controlMessage"),null===(r=t.transcodeMeta)||void 0===r||r.layout.regions.forEach((function(e){n.roomInfo&&(e.roomID=n.roomInfo.roomId)})),this._liveControlMessage=t,e.next=5,this._mediaServerClient.controlMessage(t);case 5:"stopped"===t.action&&(delete this._liveControlMessage,this._liveTranscodingOnceSucc=!1),this._liveTranscodingOnceSucc=!0;case 7:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(m=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"stopped"===t.action&&delete t.publicStreamMeta,e.next=3,this._mediaServerClient.controlMessage(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"subtitleControlMessage",value:(_=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._mediaServerClient.controlMessage(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"updateUserAttributes",value:(v=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return SB.print("updateUserAttributes","Invoke updateUserAttributes"),t.role&&this._roomInfo&&(this._roomInfo.userInfo.role=t.role),e.next=4,this._mediaServerClient.updateUserAttributes(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"publish",value:(f=m_(Im.mark((function e(t,r,n,i,o,a){var s,c,u,d,l,h,p,f,v,_,m,y,g=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=g.length>6&&void 0!==g[6]&&g[6],SB.print("publish","Invoke publish"),c=!1,this._localStream||(this._localStream=new IF,this._mediaServerClient.handler&&(this._localStream.observer=new uB(this._localStream,this._mediaServerClient.handler)),c=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,o&&(ZC(o)&&(this._localStream.pubAudio=a===XF.PUB),$C(o)&&(this._localStream.pubVideo=a===XF.PUB),SB.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished){e.next=26;break}if(this._localStream.pubAudio||this._localStream.pubVideo){e.next=12;break}return e.abrupt("return");case 12:return e.prev=12,s?null===(u=this._localStream.observer)||void 0===u||u.setLogin(!0):c&&(d=!!this._localStream.videoTrack,l=!!this._localStream.audioTrack,h=this._localStream.videoTrack instanceof MV,p=this._localStream.audioTrack instanceof LV,this._roomConfig.isAutoPublish&&!this._hasPublished?(d&&(h?null===(f=this._localStream.observer)||void 0===f||f.setPushVideo(!0):null===(v=this._localStream.observer)||void 0===v||v.setEnableVideo(!0)),l&&(p?null===(_=this._localStream.observer)||void 0===_||_.setPushAudio(!0):null===(m=this._localStream.observer)||void 0===m||m.setEnableAudio(!0))):null===(y=this._localStream.observer)||void 0===y||y.setPublish(!0)),e.next=16,this._mediaServerClient.publish(this._localStream);case 16:this._hasPublished=!0,this.emit(zF.ON_PUBLISH_RESULT,{isScreen:!1,state:_d.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(zF.ON_PUBLISH_RESULT,{isScreen:!1,state:_d.PUBLISH_FAIL}),e.t0;case 24:e.next=28;break;case 26:return e.next=28,this.updatePubTrack();case 28:case"end":return e.stop()}}),e,this,[[12,20]])}))),function(e,t,r,n,i,o){return f.apply(this,arguments)})},{key:"updatePubTrack",value:(p=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(SB.print("updatePubTrack","Invoke updatePubTrack"),!this._localStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"unpublish",value:(h=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(SB.print("unpublish","Invoke unpublish"),!this._localStream){e.next=6;break}return e.next=4,this._mediaServerClient.unpublish(this._localStream);case 4:this._localStream.clean(),this._localStream=void 0;case 6:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"subscribe",value:(l=m_(Im.mark((function e(t,r,n){var i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return SB.print("subscribe","remoteStream %o",t),i=void 0,n&&(i=this._getSubLayer(n,t)),e.next=5,this._mediaServerClient.subscribe(t,r,i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return l.apply(this,arguments)})},{key:"updateSubTrack",value:(d=m_(Im.mark((function e(t,r,n,i){var o,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(SB.print("updateSubTrack","Invoke updateSubTrack"),!i){e.next=4;break}return e.next=4,null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrackLayer(t,i);case 4:return e.abrupt("return",null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrack(t,r,n));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return d.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(u=m_(Im.mark((function e(t,r){var n,i,o,a,s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((a=this._findRemoteStreamByScreen(t,!1))&&a.hasSubscribed&&!((null==a||null===(n=a.attributes)||void 0===n||null===(i=n.videoDescriptions)||void 0===i?void 0:i.length)<=1)){e.next=3;break}return e.abrupt("return");case 3:return s=this._getSubLayer(r,a),a.originalStreamIndex=s.spatialLayer,e.abrupt("return",null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrackLayer(a,s));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"_getSubLayer",value:function(e,t){for(var r,n,i,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++){var f,v;if(h>=(null===(f=d[p])||void 0===f?void 0:f.width)*(null===(v=d[p])||void 0===v?void 0:v.height)){l=p;break}}var _=d[0];if(-1===l)_=d[l=d.length-1];else if(0!==l){var m=d[l-1].width*d[l-1].height,y=(m-h)/(m-d[l].width*d[l].height);_=y<.1?d[l-1]:d[l],l=y<.1?l-1:l}return a=null!==(r=null===(n=_)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(o=_)||void 0===o?void 0:o.video_index)&&void 0!==i?i:l,spatialSubLayer:a}}},{key:"unsubscribe",value:(c=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return SB.print("unsubscribe","Invoke unsubscribe"),e.next=3,this._mediaServerClient.unsubscribe(t,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"startSubtitle",value:(s=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._subtitleTool){e.next=5;break}return e.next=3,this._subtitleTool.start(t);case 3:e.next=6;break;case 5:throw new pR(lR.INVOKED_BEFORE_JOIN_ROOM,"join first");case 6:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"stopSubtitle",value:(a=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null===(t=this._subtitleTool)||void 0===t||t.stop();case 1:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"leave",value:(o=m_(Im.mark((function e(){var t,r,n,i,o,a,s,c,u=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=u.length>0&&void 0!==u[0]&&u[0],SB.print("leave","Invoke leave"),n=RC(),null===(t=this._subtitleTool)||void 0===t||t.destroy(),delete this._subtitleTool,e.prev=5,this._mediaServerClient.connectionState!==eB.CONNECTED&&this._joinRejectCallback&&this._joinRejectCallback(new Error(SP.LEAVE_ROOM)),clearTimeout(this._reconnectTimer),o=ZT(nA(i=this._remoteStreams).call(i));try{for(o.s();!(a=o.n()).done;)s=a.value,Array.isArray(s)&&s.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(d){o.e(d)}finally{o.f()}return this._localStream&&(null===(c=this._localStream.observer)||void 0===c||c.setLogin(!1)),e.next=13,this._mediaServerClient.leave();case 13:this.destroy(),CP.rtcLeaveRoom(0,"",RC()-n),OP.setStats({room_id:void 0,user_id:void 0,rtc_session_id:void 0}),e.next=26;break;case 18:if(e.prev=18,e.t0=e.catch(5),!r){e.next=24;break}throw e.t0;case 24:this.destroy();case 25:e.t0 instanceof Error&&CP.rtcLeaveRoom(-1,e.t0.message,RC()-n);case 26:case"end":return e.stop()}}),e,this,[[5,18]])}))),function(){return o.apply(this,arguments)})},{key:"updateRemoteUserPriority",value:function(e){var t,r=this;null===(t=this.remoteStreams.get(e))||void 0===t||t.forEach((function(e){e.streamState!==TF.INIT&&r._mediaServerClient.subscribe(e,e.subMediaType)}))}},{key:"destroy",value:function(){var e;SB.print("destroy","Invoke destroy"),CP.rtcInvokeStatus("".concat((new Error).stack),0,"room_destroy","",0),null===(e=this._subtitleTool)||void 0===e||e.destroy(),delete this._subtitleTool,this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new bE;var t,r,n,i=ZT(this._remoteStreams);try{for(i.s();!(t=i.n()).done;){var o=$T(t.value,2)[1];Array.isArray(o)&&o.forEach((function(e){e&&e.clean()}))}}catch(a){i.e(a)}finally{i.f()}(this._virtualStreams.forEach((function(e){null==e||e.clean()})),this._remoteStreams=new bE,this._localStream)&&(null===(r=this._localStream)||void 0===r||r.clean(),this._localStream=void 0);this._localScreenStream&&(null===(n=this._localScreenStream)||void 0===n||n.clean(),this._localScreenStream=void 0);this._context=void 0,this._reconnectRecord=new kB,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._csrcUserIdMap={},this._virtualStreams=[],this._remoteStreamStreamIdUserIdMap={}}},{key:"updateToken",value:(i=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return SB.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=t),e.next=4,this._mediaServerClient.updateToken(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)}},{key:"setSessionId",value:function(){this._sessionId=rC(),OP.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(n=m_(Im.mark((function e(t){var r,n,i,o,a,s=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=s.length>1&&void 0!==s[1]&&s[1],a={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:o,message:"",roomId:null===(n=this._roomInfo)||void 0===n?void 0:n.roomId},!o){e.next=8;break}return e.next=5,xC.ab2b64str(t);case 5:a.message=e.sent,e.next=9;break;case 8:a.message=t;case 9:return e.abrupt("return",null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendRoomMessage(a));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){SB.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new rB(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n,i,o=this;SB.print("JoinSuccess()"),this._serverConfig=e.config;var a=[],s=[],c=[],u=[],d=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&o.safeEmit(zF.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&o.safeEmit(zF.ON_AUDIO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteAudio})),t.clientId!==e.clientId){var r=o._remoteUsers.get(t.clientId);r?r._stillExist=!0:a.push(t)}}));var l,h=ZT(nA(n=this._remoteUsers).call(n));try{for(h.s();!(l=h.n()).done;){var p=l.value;p._stillExist||s.push({clientId:p.userId}),delete p._stillExist}}catch(m){h.e(m)}finally{h.f()}e.streams.forEach((function(e){var t=o._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId,d.push(e)):u.push(e)}));var f,v=ZT(nA(i=this._remoteStreams).call(i));try{for(v.s();!(f=v.n()).done;){var _=f.value;Array.isArray(_)&&_.forEach((function(e){e.stillExist?delete e.stillExist:c.push({clientId:e.userId,streamId:e.streamId,message:cN.clientDisconnected})}))}}catch(m){v.e(m)}finally{v.f()}s.forEach((function(e){return o._onUserDisconnection(e)})),a.forEach((function(e){return o._onUserConnection(e)})),c.forEach((function(e){return o._onRemoveStream(e)})),u.forEach((function(e){return o._onAddStream(e,{fromSignal:!1})})),d.forEach((function(e){return o._onUpdateStreamAttributes(e)})),t&&this._handleSendOrRecvStreamAfterReconnect()}},{key:"_handleSendOrRecvStreamAfterReconnect",value:function(){var e,t,r=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){})));var n,i=ZT(nA(t=this._remoteStreams).call(t));try{for(i.s();!(n=i.n()).done;){var o=n.value;Array.isArray(o)&&o.forEach(function(){var e=m_(Im.mark((function e(t){var n,i,o,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.hasSubscribed){e.next=15;break}return t.resetHasSubscribed(),e.prev=2,SB.print(xm(n="start resubscribe ".concat(t.userId," with ")).call(n,t.subMediaType)),e.next=6,r._mediaServerClient.subscribe(t,t.subMediaType);case 6:SB.print(xm(i="success resubscribe ".concat(t.userId," with ")).call(i,t.subMediaType)),r.safeEmit(zF.RESUBSCRIBE,{stream:t}),e.next=15;break;case 10:e.prev=10,e.t0=e.catch(2),SB.print(xm(o=xm(a="failed resubscribe ".concat(t.userId," with ")).call(a,t.subMediaType,", error:")).call(o,e.t0)),t.clean(),null==t||t.resetHasSubscribed();case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(t){return e.apply(this,arguments)}}())}}catch(a){i.e(a)}finally{i.f()}null===(e=this._subtitleTool)||void 0===e||e.reconnect()}},{key:"_handleFFAudioTrack",value:function(){var e,t,r,n,i=null===(e=this._mediaServerClient)||void 0===e||null===(t=e.handler)||void 0===t?void 0:t.audioTrack4ff,o=null===(r=this._mediaServerClient)||void 0===r||null===(n=r.handler)||void 0===n?void 0:n.getTransceivers();if(i&&Array.isArray(o)){var a=Nb(o).call(o,(function(e){var t;return(null==e||null===(t=e.receiver)||void 0===t?void 0:t.track)===i}));if(a){var s=new AF("ff-stream","ff-stream",!1,EB);s.virtual=!0,s.audioTransceiver=a,s.audioMid="0",s.audioTrack=JV(i),this._virtualStreams.push(s),this.safeEmit(zF.SUBSCRIBE_PUSH_TRACK,{stream:s})}}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?Nb(r).call(r,(function(e){return e.streamId===t})):null}},{key:"_findRemoteStreamByScreen",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?Nb(r).call(r,(function(e){return e.isScreen===t})):null}},{key:"_onAddStream",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.needEmit,i=void 0===n||n,o=r.fromSignal,a=void 0===o||o,s=r.virtual,c=void 0!==s&&s;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var u=this._roomConfig,d=u.isAutoSubscribeAudio,l=u.isAutoSubscribeVideo,h=this._findRemoteStreamByScreen(e.clientId,e.screen);if(h&&h.streamId!==e.streamId){var p,f=null===(p=this._remoteStreams.get(e.clientId))||void 0===p?void 0:Gs(p).call(p,(function(e){return e.streamId!==h.streamId}));h.clean(),this._remoteStreams.set(e.clientId,f||[])}var v=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,v)v.attributes=e.attributes;else if((v=new AF(e.clientId,e.streamId,e.screen,e.attributes)).virtual=c,this._initStreamListeners(v),!c){var _=this._remoteStreams.get(e.clientId);_?_.push(v):this._remoteStreams.set(e.clientId,[v])}if(this._mediaServerClient.handler&&(v.observer=new sB(v,this._mediaServerClient.handler)),!v.isScreen&&l){var m,y,g,S,E,b,k,T;if(a&&v.hasVideo)if(v.attributes.extvideo)null===(m=v.observer)||void 0===m||m.setExternalVideoSource(!0),null===(y=v.observer)||void 0===y||y.setPushVideo(!0);else null===(g=v.observer)||void 0===g||g.setExternalVideoSource(!1),null===(S=v.observer)||void 0===S||S.setPublishVideo(!0);if(a&&v.hasAudio&&d&&!this._mediaServerClient.roomAttributes.multiChatMode)if(v.attributes.extaudio)null===(E=v.observer)||void 0===E||E.setExternalAudioSource(!0),null===(b=v.observer)||void 0===b||b.setPushAudio(!0);else null===(k=v.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=v.observer)||void 0===T||T.setPublishAudio(!0);if(!0===i&&!1===a){var I,A=this._roomConfig,R=A.isAutoSubscribeAudio,C=A.isAutoSubscribeVideo;null===(I=v.observer)||void 0===I||I.setLogin(!0,{audio:!!R,video:!!C})}}return i&&this.safeEmit(dN.ON_ADD_STREAM,{stream:v}),v}}},{key:"_onUserConnection",value:function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof r)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(r);var n={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,ud({},n)),this.safeEmit(dN.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(zF.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(zF.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}}},{key:"_onUserDisconnection",value:function(e){var t,r=this,n=e.clientId,i=e.tag,o=e.code;if(n)if(n===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;i===pN.kickedByAdmin?a=lR.KICKED_OUT:i===pN.onUserTokenDidExpire?a=lR.TOKEN_EXPIRED:i===pN.userDuplicateLogin&&(a=lR.DUPLICATE_LOGIN),o===fN.roomDismissByAdmin&&(a=lR.ROOM_DISMISS),a&&this.safeEmit(zF.ON_ROOM_ERROR,{errorCode:a})}else{var s=hd.DROPPED;i===pN.userLeave?s=hd.QUIT:i===pN.kickedByAdmin?s=hd.KICKED_BY_ADMIN:i===pN.roleChanged&&(s=hd.SWITCH_TO_INVISIBLE);var c=function(){var e;r._remoteUsers.delete(n),null===(e=r._remoteStreams.get(n))||void 0===e||e.forEach((function(e){e.clean(),r._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:cN.clientDisconnected})})),r._remoteStreams.delete(n),r.safeEmit(zF.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===pN.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(n);u&&self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else c()}}},{key:"_onRemoveStream",value:function(e){var t,r=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var n=this._remoteStreams.get(e.clientId);if(n){var i=Nb(n).call(n,(function(t){return t.streamId===e.streamId}));if(i){var o,a,s;if(null===(o=this._mediaServerClient)||void 0===o||o.handleRemoveStream(i,e).then((function(){var t=r._remoteStreams.get(e.clientId);t&&(t=Gs(t).call(t,(function(t){return t.streamId!==e.streamId||(t.clean(),!1)})),r._remoteStreams.set(e.clientId,t))})).finally((function(){r.safeEmit(dN.ON_REMOVE_STREAM,{stream:i,reason:e.message})})),i.hasVideo)null===(a=i.observer)||void 0===a||a.setPublishVideo(!1);if(i.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode)null===(s=i.observer)||void 0===s||s.setPublishAudio(!1)}}}}},{key:"_onUpdateUserAttributes",value:function(e){e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(zF.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(zF.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){var t;e.roomAttributes&&(this._mediaServerClient.roomAttributes=ud(ud({},this._mediaServerClient.roomAttributes),e.roomAttributes)),null!==(t=e.roomAttributes)&&void 0!==t&&t.multiChatMode&&this._handleFFAudioTrack()}},{key:"_onUpdateStreamAttributes",value:function(e){var t=this._roomConfig,r=t.isAutoSubscribeAudio,n=t.isAutoSubscribeVideo,i=e.clientId,o=e.streamId,a=e.attributes,s=this._findRemoteStream(i,o);if(s){var c,u,d=s.attributes,l=ud(ud({},d),a),h=!1,p=l.localaudio!==d.localaudio,f=!1,v=!1,_=l.localvideo!==d.localvideo,m=!1,y=sF.NONE,g=sF.NONE;if(l.audiostream!==d.audiostream&&(h=l.localaudio,f=!!l.audiostream,l.audiostream?y|=Sd.AUDIO:g|=Sd.AUDIO),l.videostream!==d.videostream&&(v=l.localvideo,m=!!l.videostream,l.videostream?y|=Sd.VIDEO:g|=Sd.VIDEO),y&&this.safeEmit(zF.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:y,isScreen:s.isScreen,pubState:XF.PUB,remoteStream:s}),g&&this.safeEmit(zF.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:g,isScreen:s.isScreen,pubState:XF.UNPUB,remoteStream:s}),s.attributes=l,l.localaudio!==d.localaudio)if(l.localaudio){var S,E,b,k;if(r)if(l.extaudio)null===(S=s.observer)||void 0===S||S.setExternalAudioSource(!0),null===(E=s.observer)||void 0===E||E.setPushAudio(!0);else null===(b=s.observer)||void 0===b||b.setExternalAudioSource(!1),null===(k=s.observer)||void 0===k||k.setEnableAudio(!0);this.safeEmit(zF.ON_USER_START_AUDIO_CAPTURE,{userId:i},s)}else{var T,I,A,R;if(l.extaudio)null===(T=s.observer)||void 0===T||T.setExternalAudioSource(!0),null===(I=s.observer)||void 0===I||I.setPushAudio(!1);else null===(A=s.observer)||void 0===A||A.setExternalAudioSource(!1),null===(R=s.observer)||void 0===R||R.setEnableAudio(!1);!s.isScreen&&this.safeEmit(zF.ON_USER_STOP_AUDIO_CAPTURE,{userId:i})}if(l.localvideo!==d.localvideo)if(l.localvideo){var C,w,x,O;if(n)if(l.extvideo)null===(C=s.observer)||void 0===C||C.setExternalVideoSource(!0),null===(w=s.observer)||void 0===w||w.setPushVideo(!0);else null===(x=s.observer)||void 0===x||x.setExternalVideoSource(!1),null===(O=s.observer)||void 0===O||O.setEnableVideo(!0);this.safeEmit(zF.ON_USER_START_VIDEO_CAPTURE,{userId:i})}else{var D,P,N,M;if(l.extvideo)null===(D=s.observer)||void 0===D||D.setExternalVideoSource(!0),null===(P=s.observer)||void 0===P||P.setPushVideo(!1);else null===(N=s.observer)||void 0===N||N.setExternalVideoSource(!1),null===(M=s.observer)||void 0===M||M.setEnableVideo(!1);!s.isScreen&&this.safeEmit(zF.ON_USER_STOP_VIDEO_CAPTURE,{userId:i})}if(h&&!p)null===(c=s.observer)||void 0===c||c.setRemoteUnmuteAudio(f);if(v&&!_)null===(u=s.observer)||void 0===u||u.setRemoteUnmuteVideo(m)}}},{key:"_onPushTrack",value:function(e){var t,r=this;if(null!==(t=e.streamId)&&void 0!==t&&dR(t).call(t,"audio_mux")){var n=this._onAddStream(ud(ud({},e),{},{attributes:EB}),{needEmit:!1,fromSignal:!1,virtual:!0});n&&this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){r.safeEmit(zF.SUBSCRIBE_PUSH_TRACK,{stream:n}),r._virtualStreams.push(n)})).catch((function(e){SB.print("subscribe","push track failed %o",e)}))}else{var i;CP.rtcError(xm(i="onPushTrack, userId: ".concat(e.clientId,", ")).call(i,e.streamId),-1001)}}},{key:"_onRemoveTrack",value:function(e){var t,r=e.clientId,n=e.streamId,i=e.message;SB.print("_onRemoveTrack","remove track: %o",r);var o=this._findRemoteStream(r,n);o&&(null===(t=this._mediaServerClient)||void 0===t||t.unsubscribe4removeTrack(o,i))}},{key:"_onMeetingSpeakerChange",value:function(e){if(Array.isArray(null==e?void 0:e.speakerCsrcInfo)){var t={};null==e||e.speakerCsrcInfo.forEach((function(e){var r=e.csrc,n=e.userId;e.isScreen||(t[r]=n)})),this._csrcUserIdMap=t}}},{key:"getActiveSpeakerInMultiChatMode",value:function(){var e=this,t=[];return this._virtualStreams.forEach((function(r){var n,i=null===(n=r.audioTransceiver)||void 0===n?void 0:n.receiver;if(i){var o=$T(i.getContributingSources()||[],1)[0];if(o){var a=o.audioLevel,s=o.source;e._csrcUserIdMap[s]&&t.push({userId:e._csrcUserIdMap[s],audioLevel:a})}}})),t.length&&BA(t).call(t,(function(e,t){return e.audioLevel-t.audioLevel})),t}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;YP.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(r)&&r.length?this._getAccessNode=r[0]:this._getAccessFeedback=n,CP.rtcNodeChange(0,ny(e),ny(n)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()}},{key:"_reconnect",value:function(){var e,t=this;this._isReconnecting=!0;var r,n=ZT(nA(e=this._remoteStreams).call(e));try{for(n.s();!(r=n.n()).done;){var i=r.value;Array.isArray(i)&&i.forEach((function(e){return e.clean()}))}}catch(o){n.e(o)}finally{n.f()}CP.rtcReconnect(1002,WD.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,YD.PEERCONNECTION),this._liveTranscodingOnceSucc||delete this._liveControlMessage,this._join((function(){CP.rtcReconnected(QD.PEERCONNECTION_RECONNECTED,JD.PEERCONNECTION)}),(function(e){t._reconnectRecord.record(e),t._reconnectRecord.shouldReconnect?(SB.print("Reconnecting error, will reconnect after 3s",e),t._reconnectTimer=window.setTimeout(t._reconnect.bind(t),3e3)):(t.safeEmit(zF.RECONNECT_FAILED),t.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){SB.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_onConnectionStateChange",value:function(e){var t,r=this;if(e.next===eB.DISCONNECTED)t=bd.CONNECTION_STATE_DISCONNECTED;else if(e.next===eB.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?bd.CONNECTION_STATE_RECONNECTED:bd.CONNECTION_STATE_CONNECTED;else{if(e.next!==eB.CONNECTING)return;t=this._isReconnecting?bd.CONNECTION_STATE_RECONNECTING:bd.CONNECTION_STATE_CONNECTING}e.prev===eB.CONNECTED&&e.next===eB.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(hN.ON_CONNECTION_STATE_CHANGE,{state:bd.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(hN.ON_CONNECTION_STATE_CHANGE,{state:t})}},{key:"_initStreamListeners",value:function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){var n;t.emit(zF.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(n=t._roomInfo)||void 0===n?void 0:n.roomId,streamIndex:e.isScreen?gd.STREAM_INDEX_SCREEN:gd.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(dN.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(dN.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){var t,r={userId:e.from,message:e.msg};null!==(t=this._subtitleTool)&&void 0!==t&&t.onMessageRecv(r)||this.safeEmit(dN.USER_BINARY_MESSAGE_RECEIVED,r)}},{key:"_initSubtitleTool",value:function(){var e=this;this._subtitleTool=new mB(this),this._subtitleTool.onEvent=function(t){e.emit(zF.ON_SUBTITLE_STATE_CHANGED,t)},this._subtitleTool.onMessage=function(t){e.emit(zF.ON_SUBTITLE_MESSAGE_RECEIVED,t)}}},{key:"_onPostProcessingMessage",value:function(e){if(e.body)if("subtitleCallback"!==e.type){var t=e.body,r=t.error||0,n=KF.START,i=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(n=KF.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?KF.START_FAILED:KF.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?KF.STOP_FAILED:KF.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?KF.UPDATE_FAILED:KF.UPDATE_SUCCESS}this.safeEmit(dN.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(dN.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}else{var o;null===(o=this._subtitleTool)||void 0===o||o.onResult(e)}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(dN.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onStreamFailed",value:(r=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,l;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("publish"!==t.type){e.next=11;break}if(s=void 0,(null===(r=this.localStream)||void 0===r?void 0:r.streamId)===t.streamId?s=this.localStream:(null===(n=this.localScreenStream)||void 0===n?void 0:n.streamId)===t.streamId&&(s=this.localScreenStream),s){e.next=5;break}return e.abrupt("return");case 5:return null===(i=s)||void 0===i||i.clean(),e.next=8,null===(o=this._mediaServerClient)||void 0===o?void 0:o.unpublish(s).catch((function(){}));case 8:null===(a=this._mediaServerClient)||void 0===a||a.publish(s).catch((function(){})),e.next=20;break;case 11:if("subscribe"!==t.type){e.next=20;break}if(c=this._remoteStreamStreamIdUserIdMap[t.streamId],!(u=this._findRemoteStream(c,t.streamId))){e.next=20;break}return e.next=17,null===(d=this._mediaServerClient)||void 0===d?void 0:d.unsubscribe(u,Sd.AUDIO_AND_VIDEO);case 17:return e.next=19,null===(l=this._mediaServerClient)||void 0===l?void 0:l.subscribe(u,u.subMediaType,u.subLayer);case 19:this.safeEmit(zF.RESUBSCRIBE,{stream:u});case 20:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===uN.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:(t=m_(Im.mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,p,f;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._publishOnDemandBusy&&!1!==(null===(t=this._serverConfig)||void 0===t||null===(r=t.engine_VPM)||void 0===r||null===(n=r.ondemand)||void 0===n?void 0:n.enable)){e.next=2;break}return e.abrupt("return");case 2:if(a=this._publishOnDemandItem,this._publishOnDemandItem=void 0,a){e.next=6;break}return e.abrupt("return");case 6:if(null===(i=this._localStream)||void 0===i||!i.enableSimulcast||null===(o=this._localStream)||void 0===o||!o.videoTransceiver){e.next=16;break}return u=[],this._publishOnDemandBusy=!0,d=null===(s=this._localStream)||void 0===s?void 0:s.stream.id,l=null===(c=this._localStream)||void 0===c?void 0:c.videoTransceiver.sender,h=l.getParameters(),Array.isArray(h.encodings)&&Array.isArray(a)&&(f={},SB.print("_onPublishOnDemand exec","usedDescriptions: %o",a),a.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&$m(t).call(t,d)){var r=null==e?void 0:e.Metadata.VideoIndex;f[r]=!0}})),h.encodings=uy(p=h.encodings).call(p,(function(e){if(e.rid){f[e.rid]?e.active=!0:e.active=!1;var t=+e.rid;u[t]=e.active}return e})),this._context&&(this._context.activeSimStreams=u)),e.next=15,l.setParameters(h);case 15:this._publishOnDemandBusy=!1;case 16:this._onPublishOnDemand();case 17:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_onRTT",value:function(e){var t=e.StreamIds,r=e.Metadata;if(t.length&&r){var n,i=t[0];null!==(n=this._context)&&void 0!==n&&n.streamRTT&&(this._context.streamRTT[i]={audio:r.audio_rtt,video:r.video_rtt})}}},{key:"_reportNetworkQuality",value:function(e,t){this.emit(zF.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(zF.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?gd.STREAM_INDEX_SCREEN:gd.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"multiChatMode",get:function(){var e;return null===(e=this._mediaServerClient)||void 0===e?void 0:e.multiChatMode()}}]),I}(ex),kB=function(){function e(){Wd(this,e),sd(this,"_all_201_count",void 0),sd(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return qd(e,[{key:"shouldReconnect",get:function(){return!(this._all_201_count>=3||this._has_4xx)}},{key:"record",value:function(e){var t=!1,r=!1;if(Array.isArray(e)){var n=0;uy(e).call(e,(function(e){var t,i,o;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(i=e.error)||void 0===i?void 0:i.code)<500&&(r=!0),201===(null===(o=e.error)||void 0===o?void 0:o.code)&&n++})),n===e.length&&(t=!0),t&&this._all_201_count++,r&&(this._has_4xx=!0)}}},{key:"clear",value:function(){this._all_201_count=0,this._has_4xx=!1}}]),e}(),TB=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&JE(r.style,t.style),t.attributes&&bR(t.attributes).forEach((function(e){var t=$T(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},IB=new Jw("Player",0),AB=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],RB={playsinline:"","webkit-playsinline":""},CB={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},wB=function(e){DI(n,e);var t,r=YI(n);function n(e){var t;Wd(this,n),sd(eI(t=r.call(this)),"_containerDom",void 0),sd(eI(t),"_videoDom",void 0),sd(eI(t),"__cumulativeTime",void 0),sd(eI(t),"userId",void 0),sd(eI(t),"renderMode",void 0),sd(eI(t),"mirrorType",kd.MIRROR_TYPE_NONE),sd(eI(t),"isScreen",void 0),sd(eI(t),"isLocal",void 0),sd(eI(t),"played",!1),sd(eI(t),"_emitPlayFailed",!1),sd(eI(t),"_videoContainer",void 0),sd(eI(t),"_safari15VideoTimer",void 0),sd(eI(t),"emitVideoEvent",(function(e){var r,n,i={type:"video",rawEvent:e,readyState:(null===(r=t._videoDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:t.isScreen};switch(t.emit("playback_event",i),e.type){case"canplay":case"loadeddata":t._internalPlay();break;case"playing":IB.print("VideoPlayerPlaying","[userId-".concat(t.userId,"] video element playing"))}})),sd(eI(t),"_internalPlay",(function(){var e;if(null!==(e=t._videoDom)&&void 0!==e&&e.paused){var r=t._videoDom.play();null!=r&&r.then&&r.catch((function(e){var r,n,i,o;t._emitPlayFailed||("AbortError"!==e.name?(t._emitPlayFailed=!0,CP.rtcError(xm(r="video autoplay failed, userId: ".concat(t.userId,", ")).call(r,e.name),-1e3),t.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(n=t._videoDom)||void 0===n?void 0:n.readyState)||0,userId:t.userId,eventName:"autoplay-error",currentTime:(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime)||0,isScreen:t.isScreen})):CP.rtcError(xm(o="video autoplay failed, userId: ".concat(t.userId,", ")).call(o,e.name),-1e3))}))}}));var i=e.renderDom,o=e.userId;t.renderMode=void 0!==e.renderMode?e.renderMode:yd.RENDER_MODE_FIT;var a="string"==typeof i?document.getElementById(i):i;if(!a)throw new pR(lR.CANT_FIND_DOM,"can't find dom");return t._videoContainer=document.createElement("div"),t._videoContainer.style.width="100%",t._videoContainer.style.height="100%",t._videoContainer.style.position="relative",t._videoContainer.style.overflow="hidden",t._containerDom=a,t.userId=o,t.isLocal=!!e.isLocal,t.isScreen=!!e.isScreen,t._initVideo(),t}return qd(n,[{key:"_initVideo",value:function(){var e;this._videoDom||(this._videoDom=TB("video",{style:{width:"100%",height:"100%"},attributes:CB}),this._videoDom.id=xm(e="".concat(this.userId,"_")).call(e,AC()),this.renderMode===yd.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===kd.MIRROR_TYPE_RENDER));this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&AB.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._videoDom&&AB.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)}))}},{key:"_recordFrame",value:function(e){var t=this,r=e.isScreen?1.5:.5;if(NC&&eN.VIDEO_STALL){var n;if(null===(n=this._videoDom)||void 0===n||!n.requestVideoFrameCallback)return;this._videoDom.requestVideoFrameCallback((function n(i,o){var a=o.presentationTime;if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t.__cumulativeTime){var s,c=(a-t.__cumulativeTime)%2e3,u=c>1e3*r;null===(s=e.recordedVideoFrames)||void 0===s||s.push({playTime:a,isStall:u,stallCount:u?1:0,stallDuration:c})}t.__cumulativeTime=a,t._videoDom.requestVideoFrameCallback(n)}))}else this.on("playback_event",(function(n){var i;if("timeupdate"===n.eventName){if(!eN.VIDEO_STALL)return;if(0===(null===(i=t._videoDom)||void 0===i?void 0:i.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>r;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))}},{key:"_recordPause",value:function(e){var t=this;void 0===e.statsReport.isPaused&&this.on("playback_event",(function(r){if("pause"===r.eventName)e.statsReport.isPaused=!0,e.statsReport.pauseStart=RC();else if("timeupdate"===r.eventName){var n;if((null===(n=t._videoDom)||void 0===n||!n.paused)&&e.statsReport.isPaused){e.statsReport.isPaused=!1;var i=RC()-(e.statsReport.pauseStart||0);i>500&&(e.statsReport.pauseDuration+=i)}}}))}},{key:"playVideo",value:(t=m_(Im.mark((function e(t,r){var n,i,o,a,s=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=this._videoDom,IB.print("playVideo","play video track: ".concat(this.userId)),!(o&&o.srcObject instanceof MediaStream&&o.srcObject.getTrackById(null===(n=t.getTrack())||void 0===n?void 0:n.id))){e.next=5;break}try{CP.rtcInvokeStatus("play video repeatedly",0,"playVideo",this.userId,0)}catch(gX){}return e.abrupt("return");case 5:o||(this._initVideo(),o=this._videoDom),IB.print("playVideo","play video by dom: ".concat(null===(i=o)||void 0===i?void 0:i.id)),(a=new MediaStream).addTrack(t.getTrack("preprocessing")),o.srcObject=a,o&&!this._containerDom.contains(this._videoContainer)&&this._containerDom.appendChild(this._videoContainer),o&&!this._videoContainer.contains(o)&&this._videoContainer.appendChild(o),setTimeout((function(){return s._internalPlay()})),r&&(this._recordFrame(r),this._recordPause(r),r.statsReport.player=this),this.played=!0;case 15:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"updateSrcObject",value:function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}}},{key:"manuallyPlay",value:function(){if(IB.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,!this._videoDom)throw new pR(lR.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||GC?this._videoDom.play():v_.resolve()}},{key:"mirror",value:function(e){var t;IB.print("mirror",xm(t="".concat(this.userId," set mirror: ")).call(t,e)),this.mirrorType=e?kd.MIRROR_TYPE_RENDER:kd.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this._containerDom;(IB.print("stop","stop video track: ".concat(this.userId)),this._videoDom)&&(t||(this._videoDom.srcObject=null),null!=r&&r.contains(this._videoContainer)&&r.removeChild(this._videoContainer),null!==(e=this._videoContainer)&&void 0!==e&&e.contains(this._videoDom)&&this._videoContainer.removeChild(this._videoDom));this.__cumulativeTime=void 0,this.played=!1}},{key:"destroy",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];IB.print("destroy","video player: ".concat(this.userId)),this.stop(e),xI(CI(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&delete this._videoDom,this._safari15VideoTimer&&(window.clearInterval(this._safari15VideoTimer),this._safari15VideoTimer=void 0)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(Pw.exports.EventEmitter),xB=function(e){DI(i,e);var t,r,n=YI(i);function i(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{divId:void 0,muted:!1,isScreen:!1},o=r.divId,a=r.muted,s=r.isScreen;if(Wd(this,i),sd(eI(t=n.call(this)),"_containerDom",void 0),sd(eI(t),"_audioDom",void 0),sd(eI(t),"_fakeAudioDom",void 0),sd(eI(t),"userId",void 0),sd(eI(t),"muted",!1),sd(eI(t),"_emitPlayFailed",!1),sd(eI(t),"played",!1),sd(eI(t),"isScreen",void 0),sd(eI(t),"_wechatTimer",void 0),sd(eI(t),"emitAudioEvent",(function(e){var r,n,i={type:"audio",rawEvent:e,readyState:(null===(r=t._audioDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._audioDom)||void 0===n?void 0:n.currentTime)||0};"playing"===e.type&&IB.print("AudioPlayerPlaying","[userId-".concat(t.userId,"] audio element playing")),"pause"===e.type&&IB.print("AudioPlayerPause","[userId-".concat(t.userId,"] audio element pause")),HC&&GC&&("canplay"===e.type?(clearTimeout(t._wechatTimer),t._wechatTimer=window.setTimeout((function(){t._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(t._wechatTimer)),t.emit("playback_event",i)})),sd(eI(t),"_internalPlay",(function(){var e,r;if(BP("_internalPlay",{paused:null===(e=t._audioDom)||void 0===e?void 0:e.paused}),null!==(r=t._audioDom)&&void 0!==r&&r.paused)try{var n=t._audioDom.play();null!=n&&n.then&&n.catch((function(e){var r,n;t._autoPlayError(e),CP.rtcError(xm(r=xm(n="audio autoplay failed, userId: ".concat(t.userId,": ")).call(n,e.message," ")).call(r,e.name),-1e3)})).then((function(){BP("_internalPlay successfully",{userId:t.userId})}))}catch(a){var i,o;t._autoPlayError(a),CP.rtcError(xm(i=xm(o="audio autoplay failed, userId: ".concat(t.userId,": ")).call(o,a.message," ")).call(i,a.name),-1e3)}})),o){var c=document.getElementById(o);if(!c)throw new pR(lR.CANT_FIND_DOM,"can't find dom");t._containerDom=c}else t._containerDom=document.body;return t.userId=e,t.muted=a,t.isScreen=s,t._initAudio(),t}return qd(i,[{key:"_initAudio",value:function(){var e;this._audioDom||(this._audioDom=TB("audio",{style:{display:"none"},attributes:RB}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id=xm(e="".concat(this.userId,"_")).call(e,AC()),this._containerDom.appendChild(this._audioDom));this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&AB.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitAudioEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._audioDom&&(AB.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))}},{key:"playAudio",value:(r=m_(Im.mark((function e(t){var r,n,i,o,a,s=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(IB.print("playAudio","play audio track: ".concat(this.userId)),!((o=this._audioDom)&&o.srcObject instanceof MediaStream&&o.srcObject.getTrackById(null===(r=t.getTrack())||void 0===r?void 0:r.id))){e.next=4;break}return e.abrupt("return");case 4:o||(this._initAudio(),o=this._audioDom),(a=new MediaStream).addTrack(t.getTrack("preprocessing")),o.srcObject=a,null===(n=o)||void 0===n||n.addEventListener("canplay",this._internalPlay),null===(i=o)||void 0===i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return s._internalPlay()})),this.played=!0;case 12:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_autoPlayError",value:function(e){var t,r;this._emitPlayFailed||(this._emitPlayFailed=!0,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===(r=this._audioDom)||void 0===r?void 0:r.currentTime)||0}))}},{key:"pause",value:function(){if(!this._audioDom)throw new pR(lR.INVALID_PARAMS,"Player not found");this._audioDom.pause()}},{key:"manuallyPlay",value:function(){var e;if(IB.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new pR(lR.INVALID_PARAMS,"Player not found");if(!this.played)return v_.resolve();this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return null!=t&&t.then?t:v_.resolve(t)}},{key:"setPlaybackDevice",value:(t=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return IB.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,mV.enumerateAudioPlaybackDevices();case 3:if(r=e.sent,n=uy(r).call(r,(function(e){return e.deviceId})),$m(n).call(n,t)&&this._audioDom&&this._audioDom.setSinkId){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this._audioDom.setSinkId(t);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"stop",value:function(){var e=this._containerDom;IB.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,null!=e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0),this.played=!1}},{key:"domElement",get:function(){return this._audioDom}},{key:"destroy",value:function(){IB.print("destroy","audio player: ".concat(this.userId)),this.stop(),xI(CI(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom)}}]),i}(Pw.exports.EventEmitter);function OB(e,t,r,n){var i=function(){var e=m_(Im.mark((function e(t,i){var o,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=null==n?void 0:n.get(i),Array.isArray(o)&&(o=null===(a=o)||void 0===a?void 0:Nb(a).call(a,(function(e){return e.isScreen===r}))),!t){e.next=9;break}if(!t.played){e.next=8;break}return e.next=6,t.manuallyPlay();case 6:e.next=9;break;case 8:o&&(t instanceof wB&&o.videoTrack&&t.playVideo(o.videoTrack,o),t instanceof xB&&o.audioTrack&&t.playAudio(o.audioTrack));case 9:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();if(t)return i(e.get(t),t);var o=[];return e.forEach((function(e,t){return o.push(i(e,t))})),v_.all(o)}var DB=function(){function e(){Wd(this,e),sd(this,"_timer",void 0),sd(this,"userMessage",void 0),sd(this,"roomMessage",void 0),this.userMessage={},this.roomMessage={},this._setTimer()}return qd(e,[{key:"_setTimer",value:function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()}},{key:"_reportAndgReset",value:function(){(an(this.userMessage).length||an(this.roomMessage).length)&&(this._report(),this._reset())}},{key:"_report",value:function(){var e,t,r=this;CP.rtcMessageStatistics(uy(e=an(this.userMessage)).call(e,(function(e){return r.userMessage[e]})),uy(t=an(this.roomMessage)).call(t,(function(e){return r.roomMessage[e]})),"")}},{key:"_reset",value:function(){this.userMessage={},this.roomMessage={}}},{key:"_checkInitUserMessage",value:function(e,t){var r,n;this.userMessage[xm(r="".concat(t,"-")).call(r,e)]||(this.userMessage[xm(n="".concat(t,"-")).call(n,e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_fail_timeout:0,dc_fail_no_receiver:0,dc_fail_no_relay_path: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})}},{key:"_sendUserMessage",value:function(e,t,r){var n,i;(this._checkInitUserMessage(e,t),this.userMessage[xm(n="".concat(t,"-")).call(n,e)].dc_send_total++,r)&&this.userMessage[xm(i="".concat(t,"-")).call(i,e)].dc_send_binary++}},{key:"_recvUserMessage",value:function(e,t){var r;this._checkInitUserMessage(e,t),this.userMessage[xm(r="".concat(t,"-")).call(r,e)].dc_recv_total++}},{key:"_sendUserFail",value:function(e,t,r){var n,i=this.userMessage[xm(n="".concat(t,"-")).call(n,e)];i&&(i.dc_send_fail++,this._handleUserFail(i,r))}},{key:"_handleUserFail",value:function(e,t){t&&(t.code||t.err)&&(t.code===lR.TIME_OUT||t.code===lR.USER_MESSAGE_TIMEOUT?e.dc_fail_timeout++:t.err===mN.NO_RECEIVER?e.dc_fail_no_receiver++:t.err===mN.NO_RELAYPATH?e.dc_fail_no_relay_path++:t.err===mN.TIMEOUT&&e.dc_fail_timeout++)}},{key:"_sendUserAck",value:function(e,t,r,n,i){var o,a=this.userMessage[xm(o="".concat(t,"-")).call(o,e)];a&&(a.dc_send_ack++,a.dc_cost_time+=r,a.dc_cost_s2s+=n||0,a.dc_cost_peer_s2e+=i,a.dc_cost_e2s+=r-(n||0)-i,r<=100?(a.dc_send_ack_100++,a.dc_send_ack_200++,a.dc_send_ack_400++,a.dc_send_ack_1s++):r<=200?(a.dc_send_ack_200++,a.dc_send_ack_400++,a.dc_send_ack_1s++):r<=400?(a.dc_send_ack_400++,a.dc_send_ack_1s++):r<=1e3&&a.dc_send_ack_1s++,r<a.dc_least_time&&(a.dc_least_time=r),r>a.dc_most_time&&(a.dc_most_time=r))}},{key:"sendRoomMessage",value: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++}},{key:"sendRoomFail",value:function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++}},{key:"sendRoomAck",value:function(e,t){var r=this.roomMessage[e];r&&(r.dc_send_ack++,r.dc_cost_time+=t,t<r.dc_least_time&&(r.dc_least_time=t),t>r.dc_most_time&&(r.dc_most_time=t),t<=100?(r.dc_send_ack_100++,r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=200?(r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=400?(r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=1e3&&r.dc_send_ack_1s++)}},{key:"sendP2PMessage",value:function(e,t){this._sendUserMessage(e,EP.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,EP.P2P)}},{key:"sendP2PFail",value:function(e,t){this._sendUserFail(e,EP.P2P,t)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,EP.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,EP.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,EP.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e,t){this._sendUserFail(e,EP.P2P_OUTSIDE_ROOM,t)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,EP.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",EP.P2SERVER,e)}},{key:"sendP2serverFail",value:function(e){this._sendUserFail("",EP.P2SERVER,e)}},{key:"sendP2serveAck",value:function(e,t,r){this._sendUserAck("",EP.P2SERVER,e,t,r)}},{key:"countP2PMessage",value:function(e,t,r,n,i){this.sendP2PMessage(t,r),e?this.sendP2PAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2PFail(t,i)}},{key:"countRoomMessage",value:function(e,t,r,n){this.sendRoomMessage(t,r),e?this.sendRoomAck(t,Date.now()-n):this.sendRoomFail(t)}},{key:"countUserMessageOutsideRoom",value:function(e,t,r,n,i){this.sendP2POutRoomMessage(t,r),e?this.sendP2POutRoomAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2POutRoomFail(t,i)}},{key:"countServerMessage",value:function(e,t,r,n){this.sendP2serverMessage(t),e?(n=n||{},this.sendP2serveAck(Date.now()-r,n.s2s_time||0,n.s2e_time||0)):this.sendP2serverFail(n)}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),PB="object"==typeof global&&global&&global.Object===Object&&global,NB="object"==typeof self&&self&&self.Object===Object&&self,MB=PB||NB||Function("return this")(),LB=MB.Symbol,UB=Object.prototype,VB=UB.hasOwnProperty,FB=UB.toString,BB=LB?LB.toStringTag:void 0;var jB=Object.prototype.toString;var GB=LB?LB.toStringTag:void 0;function HB(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":GB&&GB in Object(e)?function(e){var t=VB.call(e,BB),r=e[BB];try{e[BB]=void 0;var n=!0}catch(o){}var i=FB.call(e);return n&&(t?e[BB]=r:delete e[BB]),i}(e):function(e){return jB.call(e)}(e)}function zB(e){return null!=e&&"object"==typeof e}var KB=Array.isArray;function XB(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function qB(e){return e}function WB(e){if(!XB(e))return!1;var t=HB(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var YB,QB=MB["__core-js_shared__"],JB=(YB=/[^.]+$/.exec(QB&&QB.keys&&QB.keys.IE_PROTO||""))?"Symbol(src)_1."+YB:"";var ZB=Function.prototype.toString;var $B=/^\[object .+?Constructor\]$/,ej=Function.prototype,tj=Object.prototype,rj=ej.toString,nj=tj.hasOwnProperty,ij=RegExp("^"+rj.call(nj).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function oj(e){return!(!XB(e)||(t=e,JB&&JB in t))&&(WB(e)?ij:$B).test(function(e){if(null!=e){try{return ZB.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function aj(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var sj=Date.now;var cj,uj,dj,lj=function(){try{var e=oj(t=function(e,t){return null==e?void 0:e[t]}(Object,"defineProperty"))?t:void 0;return e({},"",{}),e}catch(r){}var t}(),hj=lj,pj=hj?function(e,t){return hj(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:qB,fj=(cj=pj,uj=0,dj=0,function(){var e=sj(),t=16-(e-dj);if(dj=e,t>0){if(++uj>=800)return arguments[0]}else uj=0;return cj.apply(void 0,arguments)}),vj=fj,_j=/^(?:0|[1-9]\d*)$/;function mj(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&_j.test(e))&&e>-1&&e%1==0&&e<t}function yj(e,t,r){"__proto__"==t&&hj?hj(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function gj(e,t){return e===t||e!=e&&t!=t}var Sj=Object.prototype.hasOwnProperty;function Ej(e,t,r){var n=e[t];Sj.call(e,t)&&gj(n,r)&&(void 0!==r||t in e)||yj(e,t,r)}var bj=Math.max;function kj(e,t){return vj(function(e,t,r){return t=bj(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=bj(n.length-t,0),a=Array(o);++i<o;)a[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(a),aj(e,this,s)}}(e,t,qB),e+"")}function Tj(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Ij(e){return null!=e&&Tj(e.length)&&!WB(e)}var Aj=Object.prototype;function Rj(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Aj)}function Cj(e){return zB(e)&&"[object Arguments]"==HB(e)}var wj=Object.prototype,xj=wj.hasOwnProperty,Oj=wj.propertyIsEnumerable,Dj=Cj(function(){return arguments}())?Cj:function(e){return zB(e)&&xj.call(e,"callee")&&!Oj.call(e,"callee")},Pj=Dj;var Nj="object"==typeof exports&&exports&&!exports.nodeType&&exports,Mj=Nj&&"object"==typeof module&&module&&!module.nodeType&&module,Lj=Mj&&Mj.exports===Nj?MB.Buffer:void 0,Uj=(Lj?Lj.isBuffer:void 0)||function(){return!1},Vj={};Vj["[object Float32Array]"]=Vj["[object Float64Array]"]=Vj["[object Int8Array]"]=Vj["[object Int16Array]"]=Vj["[object Int32Array]"]=Vj["[object Uint8Array]"]=Vj["[object Uint8ClampedArray]"]=Vj["[object Uint16Array]"]=Vj["[object Uint32Array]"]=!0,Vj["[object Arguments]"]=Vj["[object Array]"]=Vj["[object ArrayBuffer]"]=Vj["[object Boolean]"]=Vj["[object DataView]"]=Vj["[object Date]"]=Vj["[object Error]"]=Vj["[object Function]"]=Vj["[object Map]"]=Vj["[object Number]"]=Vj["[object Object]"]=Vj["[object RegExp]"]=Vj["[object Set]"]=Vj["[object String]"]=Vj["[object WeakMap]"]=!1;var Fj="object"==typeof exports&&exports&&!exports.nodeType&&exports,Bj=Fj&&"object"==typeof module&&module&&!module.nodeType&&module,jj=Bj&&Bj.exports===Fj&&PB.process,Gj=function(){try{var e=Bj&&Bj.require&&Bj.require("util").types;return e||jj&&jj.binding&&jj.binding("util")}catch(t){}}(),Hj=Gj&&Gj.isTypedArray,zj=Hj?function(e){return function(t){return e(t)}}(Hj):function(e){return zB(e)&&Tj(e.length)&&!!Vj[HB(e)]},Kj=zj,Xj=Object.prototype.hasOwnProperty;function qj(e,t){var r=KB(e),n=!r&&Pj(e),i=!r&&!n&&Uj(e),o=!r&&!n&&!i&&Kj(e),a=r||n||i||o,s=a?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!Xj.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||mj(u,c))||s.push(u);return s}var Wj=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),Yj=Wj,Qj=Object.prototype.hasOwnProperty;function Jj(e){return Ij(e)?qj(e):function(e){if(!Rj(e))return Yj(e);var t=[];for(var r in Object(e))Qj.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var Zj=Object.prototype.hasOwnProperty;function $j(e){if(!XB(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=Rj(e),r=[];for(var n in e)("constructor"!=n||!t&&Zj.call(e,n))&&r.push(n);return r}var eG,tG=(eG=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),i?yj(r,s,c):Ej(r,s,c)}}(t,function(e){return Ij(e)?qj(e,!0):$j(e)}(t),e)},kj((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,o=n>2?t[2]:void 0;for(i=eG.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!XB(r))return!1;var n=typeof t;return!!("number"==n?Ij(r)&&mj(t,r.length):"string"==n&&t in r)&&gj(r[t],e)}(t[0],t[1],o)&&(i=n<3?void 0:i,n=1),e=Object(e);++r<n;){var a=t[r];a&&eG(e,a,r,i)}return e})));function rG(e,t){return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}function nG(e){return null==e?[]:rG(e,Jj(e))}var iG=i,oG=lt("iterator"),aG=!iG((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,n){t.delete("b"),r+=n+e})),!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[oG]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==r||"x"!==new URL("http://x",void 0).host})),sG=Qt,cG=b,uG=2147483647,dG=/[^\0-\u007E]/,lG=/[.\u3002\uFF0E\uFF61]/g,hG="Overflow: input needs wider integers to process",pG=RangeError,fG=cG(lG.exec),vG=Math.floor,_G=String.fromCharCode,mG=cG("".charCodeAt),yG=cG([].join),gG=cG([].push),SG=cG("".replace),EG=cG("".split),bG=cG("".toLowerCase),kG=function(e){return e+22+75*(e<26)},TG=function(e,t,r){var n=0;for(e=r?vG(e/700):e>>1,e+=vG(e/t);e>455;)e=vG(e/35),n+=36;return vG(n+36*e/(e+38))},IG=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=mG(e,r++);if(i>=55296&&i<=56319&&r<n){var o=mG(e,r++);56320==(64512&o)?gG(t,((1023&i)<<10)+(1023&o)+65536):(gG(t,i),r--)}else gG(t,i)}return t}(e);var r,n,i=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&gG(t,_G(n));var c=t.length,u=c;for(c&&gG(t,"-");u<i;){var d=uG;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>vG((uG-a)/l))throw pG(hG);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>uG)throw pG(hG);if(n==o){for(var h=a,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var v=h-f,_=36-f;gG(t,_G(kG(f+v%_))),h=vG(v/_),p+=36}gG(t,_G(kG(h))),s=TG(a,l,u==c),a=0,u++}}a++,o++}return yG(t,"")},AG=Rr,RG=n,CG=O,wG=b,xG=C,OG=aG,DG=li,PG=Sg,NG=Mi,MG=Nc,LG=Zi,UG=Sh,VG=A,FG=Ye,BG=Yt,jG=vn,GG=tr,HG=$,zG=yn,KG=Hn,XG=V,qG=bl,WG=vl,YG=Oh,QG=uA,JG=lt("iterator"),ZG="URLSearchParams",$G="URLSearchParamsIterator",eH=LG.set,tH=LG.getterFor(ZG),rH=LG.getterFor($G),nH=Object.getOwnPropertyDescriptor,iH=function(e){if(!xG)return RG[e];var t=nH(RG,e);return t&&t.value},oH=iH("fetch"),aH=iH("Request"),sH=iH("Headers"),cH=aH&&aH.prototype,uH=sH&&sH.prototype,dH=RG.RegExp,lH=RG.TypeError,hH=RG.decodeURIComponent,pH=RG.encodeURIComponent,fH=wG("".charAt),vH=wG([].join),_H=wG([].push),mH=wG("".replace),yH=wG([].shift),gH=wG([].splice),SH=wG("".split),EH=wG("".slice),bH=/\+/g,kH=Array(4),TH=function(e){return kH[e-1]||(kH[e-1]=dH("((?:%[\\da-f]{2}){"+e+"})","gi"))},IH=function(e){try{return hH(e)}catch(gX){return e}},AH=function(e){var t=mH(e,bH," "),r=4;try{return hH(t)}catch(gX){for(;r;)t=mH(t,TH(r--),IH);return t}},RH=/[!'()~]|%20/g,CH={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},wH=function(e){return CH[e]},xH=function(e){return mH(pH(e),RH,wH)},OH=MG((function(e,t){eH(this,{type:$G,iterator:qG(tH(e).entries),kind:t})}),"Iterator",(function(){var e=rH(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),DH=function(e){this.entries=[],this.url=null,void 0!==e&&(HG(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===fH(e,0)?EH(e,1):e:zG(e)))};DH.prototype={type:ZG,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=WG(e);if(c)for(r=(t=qG(e,c)).next;!(n=CG(r,t)).done;){if(o=(i=qG(GG(n.value))).next,(a=CG(o,i)).done||(s=CG(o,i)).done||!CG(o,i).done)throw lH("Expected sequence with length 2");_H(this.entries,{key:zG(a.value),value:zG(s.value)})}else for(var u in e)FG(e,u)&&_H(this.entries,{key:u,value:zG(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=SH(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=SH(t,"="),_H(this.entries,{key:AH(yH(r)),value:AH(vH(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],_H(r,xH(e.key)+"="+xH(e.value));return vH(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var PH=function(){UG(this,NH);var e=arguments.length>0?arguments[0]:void 0;eH(this,new DH(e))},NH=PH.prototype;if(PG(NH,{append:function(e,t){YG(arguments.length,2);var r=tH(this);_H(r.entries,{key:zG(e),value:zG(t)}),r.updateURL()},delete:function(e){YG(arguments.length,1);for(var t=tH(this),r=t.entries,n=zG(e),i=0;i<r.length;)r[i].key===n?gH(r,i,1):i++;t.updateURL()},get:function(e){YG(arguments.length,1);for(var t=tH(this).entries,r=zG(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){YG(arguments.length,1);for(var t=tH(this).entries,r=zG(e),n=[],i=0;i<t.length;i++)t[i].key===r&&_H(n,t[i].value);return n},has:function(e){YG(arguments.length,1);for(var t=tH(this).entries,r=zG(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){YG(arguments.length,1);for(var r,n=tH(this),i=n.entries,o=!1,a=zG(e),s=zG(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?gH(i,c--,1):(o=!0,r.value=s));o||_H(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=tH(this);QG(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=tH(this).entries,n=BG(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new OH(this,"keys")},values:function(){return new OH(this,"values")},entries:function(){return new OH(this,"entries")}},{enumerable:!0}),DG(NH,JG,NH.entries,{name:"entries"}),DG(NH,"toString",(function(){return tH(this).serialize()}),{enumerable:!0}),NG(PH,ZG),AG({global:!0,constructor:!0,forced:!OG},{URLSearchParams:PH}),!OG&&VG(sH)){var MH=wG(uH.has),LH=wG(uH.set),UH=function(e){if(HG(e)){var t,r=e.body;if(jG(r)===ZG)return t=e.headers?new sH(e.headers):new sH,MH(t,"content-type")||LH(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),KG(e,{body:XG(0,zG(r)),headers:XG(0,t)})}return e};if(VG(oH)&&AG({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return oH(e,arguments.length>1?UH(arguments[1]):{})}}),VG(aH)){var VH=function(e){return UG(this,cH),new aH(e,arguments.length>1?UH(arguments[1]):{})};cH.constructor=VH,VH.prototype=cH,AG({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:VH})}}var FH,BH=Rr,jH=C,GH=aG,HH=n,zH=Yt,KH=b,XH=li,qH=function(e,t,r){return sG.f(e,t,r)},WH=Sh,YH=Ye,QH=YE,JH=Xk,ZH=ni,$H=n_.codeAt,ez=function(e){var t,r,n=[],i=EG(SG(bG(e),lG,"."),".");for(t=0;t<i.length;t++)r=i[t],gG(n,fG(dG,r)?"xn--"+IG(r):r);return yG(n,".")},tz=yn,rz=Mi,nz=Oh,iz={URLSearchParams:PH,getState:tH},oz=Zi,az=oz.set,sz=oz.getterFor("URL"),cz=iz.URLSearchParams,uz=iz.getState,dz=HH.URL,lz=HH.TypeError,hz=HH.parseInt,pz=Math.floor,fz=Math.pow,vz=KH("".charAt),_z=KH(/./.exec),mz=KH([].join),yz=KH(1..toString),gz=KH([].pop),Sz=KH([].push),Ez=KH("".replace),bz=KH([].shift),kz=KH("".split),Tz=KH("".slice),Iz=KH("".toLowerCase),Az=KH([].unshift),Rz="Invalid scheme",Cz="Invalid host",wz="Invalid port",xz=/[a-z]/i,Oz=/[\d+-.a-z]/i,Dz=/\d/,Pz=/^0x/i,Nz=/^[0-7]+$/,Mz=/^\d+$/,Lz=/^[\da-f]+$/i,Uz=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Vz=/[\0\t\n\r #/:<>?@[\\\]^|]/,Fz=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,Bz=/[\t\n\r]/g,jz=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)Az(t,e%256),e=pz(e/256);return mz(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,o=0;o<8;o++)0!==e[o]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=o),++i);return i>r&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=yz(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},Gz={},Hz=QH({},Gz,{" ":1,'"':1,"<":1,">":1,"`":1}),zz=QH({},Hz,{"#":1,"?":1,"{":1,"}":1}),Kz=QH({},zz,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Xz=function(e,t){var r=$H(e,0);return r>32&&r<127&&!YH(t,e)?e:encodeURIComponent(e)},qz={ftp:21,file:null,http:80,https:443,ws:80,wss:443},Wz=function(e,t){var r;return 2==e.length&&_z(xz,vz(e,0))&&(":"==(r=vz(e,1))||!t&&"|"==r)},Yz=function(e){var t;return e.length>1&&Wz(Tz(e,0,2))&&(2==e.length||"/"===(t=vz(e,2))||"\\"===t||"?"===t||"#"===t)},Qz=function(e){return"."===e||"%2e"===Iz(e)},Jz={},Zz={},$z={},eK={},tK={},rK={},nK={},iK={},oK={},aK={},sK={},cK={},uK={},dK={},lK={},hK={},pK={},fK={},vK={},_K={},mK={},yK=function(e,t,r){var n,i,o,a=tz(e);if(t){if(i=this.parse(a))throw lz(i);this.searchParams=null}else{if(void 0!==r&&(n=new yK(r,!0)),i=this.parse(a,null,n))throw lz(i);(o=uz(new cz)).bindURL(this),this.searchParams=o}};yK.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||Jz,d=0,l="",h=!1,p=!1,f=!1;for(e=tz(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=Ez(e,Fz,"")),e=Ez(e,Bz,""),n=JH(e);d<=n.length;){switch(i=n[d],u){case Jz:if(!i||!_z(xz,i)){if(t)return Rz;u=$z;continue}l+=Iz(i),u=Zz;break;case Zz:if(i&&(_z(Oz,i)||"+"==i||"-"==i||"."==i))l+=Iz(i);else{if(":"!=i){if(t)return Rz;l="",u=$z,d=0;continue}if(t&&(c.isSpecial()!=YH(qz,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&qz[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=dK:c.isSpecial()&&r&&r.scheme==c.scheme?u=eK:c.isSpecial()?u=iK:"/"==n[d+1]?(u=tK,d++):(c.cannotBeABaseURL=!0,Sz(c.path,""),u=vK)}break;case $z:if(!r||r.cannotBeABaseURL&&"#"!=i)return Rz;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=ZH(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=mK;break}u="file"==r.scheme?dK:rK;continue;case eK:if("/"!=i||"/"!=n[d+1]){u=rK;continue}u=oK,d++;break;case tK:if("/"==i){u=aK;break}u=fK;continue;case rK:if(c.scheme=r.scheme,i==FH)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=ZH(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=nK;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=ZH(r.path),c.query="",u=_K;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=ZH(r.path),c.path.length--,u=fK;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=ZH(r.path),c.query=r.query,c.fragment="",u=mK}break;case nK:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=fK;continue}u=aK}else u=oK;break;case iK:if(u=oK,"/"!=i||"/"!=vz(l,d+1))continue;d++;break;case oK:if("/"!=i&&"\\"!=i){u=aK;continue}break;case aK:if("@"==i){h&&(l="%40"+l),h=!0,o=JH(l);for(var v=0;v<o.length;v++){var _=o[v];if(":"!=_||f){var m=Xz(_,Kz);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(i==FH||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=JH(l).length+1,l="",u=sK}else l+=i;break;case sK:case cK:if(t&&"file"==c.scheme){u=hK;continue}if(":"!=i||p){if(i==FH||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return Cz;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=pK,t)return;continue}"["==i?p=!0:"]"==i&&(p=!1),l+=i}else{if(""==l)return Cz;if(a=c.parseHost(l))return a;if(l="",u=uK,t==cK)return}break;case uK:if(!_z(Dz,i)){if(i==FH||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var y=hz(l,10);if(y>65535)return wz;c.port=c.isSpecial()&&y===qz[c.scheme]?null:y,l=""}if(t)return;u=pK;continue}return wz}l+=i;break;case dK:if(c.scheme="file","/"==i||"\\"==i)u=lK;else{if(!r||"file"!=r.scheme){u=fK;continue}if(i==FH)c.host=r.host,c.path=ZH(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=ZH(r.path),c.query="",u=_K;else{if("#"!=i){Yz(mz(ZH(n,d),""))||(c.host=r.host,c.path=ZH(r.path),c.shortenPath()),u=fK;continue}c.host=r.host,c.path=ZH(r.path),c.query=r.query,c.fragment="",u=mK}}break;case lK:if("/"==i||"\\"==i){u=hK;break}r&&"file"==r.scheme&&!Yz(mz(ZH(n,d),""))&&(Wz(r.path[0],!0)?Sz(c.path,r.path[0]):c.host=r.host),u=fK;continue;case hK:if(i==FH||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&Wz(l))u=fK;else if(""==l){if(c.host="",t)return;u=pK}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=pK}continue}l+=i;break;case pK:if(c.isSpecial()){if(u=fK,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=FH&&(u=fK,"/"!=i))continue}else c.fragment="",u=mK;else c.query="",u=_K;break;case fK:if(i==FH||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=Iz(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||Sz(c.path,"")):Qz(l)?"/"==i||"\\"==i&&c.isSpecial()||Sz(c.path,""):("file"==c.scheme&&!c.path.length&&Wz(l)&&(c.host&&(c.host=""),l=vz(l,0)+":"),Sz(c.path,l)),l="","file"==c.scheme&&(i==FH||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)bz(c.path);"?"==i?(c.query="",u=_K):"#"==i&&(c.fragment="",u=mK)}else l+=Xz(i,zz);break;case vK:"?"==i?(c.query="",u=_K):"#"==i?(c.fragment="",u=mK):i!=FH&&(c.path[0]+=Xz(i,Gz));break;case _K:t||"#"!=i?i!=FH&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":Xz(i,Gz)):(c.fragment="",u=mK);break;case mK:i!=FH&&(c.fragment+=Xz(i,Hz))}d++}},parseHost:function(e){var t,r,n;if("["==vz(e,0)){if("]"!=vz(e,e.length-1))return Cz;if(t=function(e){var t,r,n,i,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return vz(e,l)};if(":"==h()){if(":"!=vz(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&_z(Lz,h());)t=16*t+hz(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!_z(Dz,h()))return;for(;_z(Dz,h());){if(o=hz(h(),10),null===i)i=o;else{if(0==i)return;i=10*i+o}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!=n||u++}if(4!=n)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}(Tz(e,1,-1)),!t)return Cz;this.host=t}else if(this.isSpecial()){if(e=ez(e),_z(Uz,e))return Cz;if(t=function(e){var t,r,n,i,o,a,s,c=kz(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(o=10,i.length>1&&"0"==vz(i,0)&&(o=_z(Pz,i)?16:8,i=Tz(i,8==o?1:2)),""===i)a=0;else{if(!_z(10==o?Mz:8==o?Nz:Lz,i))return e;a=hz(i,o)}Sz(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=fz(256,5-t))return null}else if(a>255)return null;for(s=gz(r),n=0;n<r.length;n++)s+=r[n]*fz(256,3-n);return s}(e),null===t)return Cz;this.host=t}else{if(_z(Vz,e))return Cz;for(t="",r=JH(e),n=0;n<r.length;n++)t+=Xz(r[n],Gz);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return YH(qz,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&Wz(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=jz(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+mz(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw lz(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new gK(e.path[0]).origin}catch(gX){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+jz(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(tz(e)+":",Jz)},getUsername:function(){return this.username},setUsername:function(e){var t=JH(tz(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=Xz(t[r],Kz)}},getPassword:function(){return this.password},setPassword:function(e){var t=JH(tz(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=Xz(t[r],Kz)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?jz(e):jz(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,sK)},getHostname:function(){var e=this.host;return null===e?"":jz(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,cK)},getPort:function(){var e=this.port;return null===e?"":tz(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=tz(e))?this.port=null:this.parse(e,uK))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+mz(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,pK))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=tz(e))?this.query=null:("?"==vz(e,0)&&(e=Tz(e,1)),this.query="",this.parse(e,_K)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=tz(e))?("#"==vz(e,0)&&(e=Tz(e,1)),this.fragment="",this.parse(e,mK)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var gK=function(e){var t=WH(this,SK),r=nz(arguments.length,1)>1?arguments[1]:void 0,n=az(t,new yK(e,!1,r));jH||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},SK=gK.prototype,EK=function(e,t){return{get:function(){return sz(this)[e]()},set:t&&function(e){return sz(this)[t](e)},configurable:!0,enumerable:!0}};if(jH&&(qH(SK,"href",EK("serialize","setHref")),qH(SK,"origin",EK("getOrigin")),qH(SK,"protocol",EK("getProtocol","setProtocol")),qH(SK,"username",EK("getUsername","setUsername")),qH(SK,"password",EK("getPassword","setPassword")),qH(SK,"host",EK("getHost","setHost")),qH(SK,"hostname",EK("getHostname","setHostname")),qH(SK,"port",EK("getPort","setPort")),qH(SK,"pathname",EK("getPathname","setPathname")),qH(SK,"search",EK("getSearch","setSearch")),qH(SK,"searchParams",EK("getSearchParams")),qH(SK,"hash",EK("getHash","setHash"))),XH(SK,"toJSON",(function(){return sz(this).serialize()}),{enumerable:!0}),XH(SK,"toString",(function(){return sz(this).serialize()}),{enumerable:!0}),dz){var bK=dz.createObjectURL,kK=dz.revokeObjectURL;bK&&XH(gK,"createObjectURL",zH(bK,dz)),kK&&XH(gK,"revokeObjectURL",zH(kK,dz))}rz(gK,"URL"),BH({global:!0,constructor:!0,forced:!GH,sham:!jH},{URL:gK});var TK=ee.URL,IK=function(){var e=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Audio(TK.createObjectURL(new Blob([t],r))),e.prev=1,n.muted=!0,e.next=5,n.play();case 5:return n.pause(),e.abrupt("return",!0);case 9:return e.prev=9,e.t0=e.catch(1),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,r){return e.apply(this,arguments)}}(),AK=ad,RK=tc,CK=function(e,t,r,n){for(var i,o=n>1?void 0:n?RK(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&AK(t,r,o),o},wK=function(){function e(t){Wd(this,e),sd(this,"_sharedAudioContext",new AudioContext),sd(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),sd(this,"_localGainNode",this._sharedAudioContext.createGain()),sd(this,"_bufferGainNode",this._sharedAudioContext.createGain()),sd(this,"_audioBufferSource",void 0),sd(this,"_localSource",void 0),sd(this,"_context",void 0),sd(this,"_failedAudioList",[]),sd(this,"_startingIds",new bE),sd(this,"_revokeURLs",new TL),sd(this,"mixingMap",new bE),sd(this,"resourcesCache",new bE),sd(this,"volumeConfig",new bE),sd(this,"cachedBuffer",[]),sd(this,"id","AudioMixingManager"),this._context=t,this._localGainNode.gain.value=1}var t,r,n;return qd(e,[{key:"mixMediaStream",value:function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)}},{key:"startAudioMixing",value:(n=m_(Im.mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f,v,_,m=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===this._startingIds.get(t)){e.next=3;break}return console.warn("AudioMixing task id: ".concat(t," is starting")),e.abrupt("return");case 3:if(this._startingIds.set(t,t),console.log(this._startingIds),i=n.playCount,vw(o=n.type,"mixingType",nG(Gd)),a=this._context.getLocalAudioTrack()){e.next=10;break}return e.abrupt("return");case 10:if((s=a.getTrack("preprocessing"))&&this.mixMediaStream(new MediaStream([s])),null!=(c=this.mixingMap.get(t))&&c.audioNode){c.audioNode.pause(),this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_STOPPED,error:hR.AUDIO_MIXING_ERROR_OK});try{c.gainNode.disconnect(this._audioDestination),c.audioSource.disconnect(c.gainNode)}catch(y){}}if(!(d=this.resourcesCache.get(t))||d.filePath!==r){e.next=19;break}u=d.getAudioNode(),e.next=32;break;case 19:return e.next=21,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw m._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:hR.AUDIO_MIXING_ERROR_START_FAILED}),new pR(lR.LOAD_RESOURCES_FAILED,e.statusText)}));case 21:return l=e.sent,hb(r).call(r,"mp3")?h={type:"audio/mpeg"}:hb(r).call(r,"aac")&&(h={type:"audio/aac"}),e.next=25,IK(l,h);case 25:if(e.sent){e.next=29;break}throw this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:hR.AUDIO_MIXING_ERROR_START_FAILED}),new pR(lR.LOAD_RESOURCES_FAILED,"invalid audio resource");case 29:(u=new Audio).crossOrigin="anonymous",u.src=TK.createObjectURL(new Blob([l],h));case 32:return i<=0?u.loop=!0:i>0&&(p=i,u.onended=function(){--p>0?u.play():(m.mixingMap.delete(t),m._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FINISHED,error:hR.AUDIO_MIXING_ERROR_OK}))}),e.prev=33,e.next=36,u.play();case 36:e.next=43;break;case 38:e.prev=38,e.t0=e.catch(33),console.error(e.t0),this._failedAudioList.push(u),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:gd.STREAM_INDEX_MAIN,mediaType:Sd.AUDIO});case 43:if(this._startingIds.delete(t),f=this._sharedAudioContext.createMediaElementSource(u),v=this._sharedAudioContext.createGain(),_=this.volumeConfig.get(t),v.gain.value=_?_/100:1,f.connect(v).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:f,audioNode:u,gainNode:v,type:"file"}),o===Gd.PUBLISH)try{v.disconnect(this._sharedAudioContext.destination)}catch(y){}else v.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_PLAYING,error:hR.AUDIO_MIXING_ERROR_OK});case 53:case"end":return e.stop()}}),e,this,[[33,38]])}))),function(e,t,r){return n.apply(this,arguments)})},{key:"stopAudioMixing",value: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:Hd.AUDIO_MIXING_STATE_STOPPED,error:hR.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Hd.AUDIO_MIXING_STATE_PAUSED,error:hR.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())}},{key:"resumeAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Hd.AUDIO_MIXING_STATE_PLAYING,error:hR.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=m_(Im.mark((function e(t,r){var n,i,o=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.stopAudioMixing(t),e.next=3,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw new pR(lR.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){if(o._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:hR.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),e instanceof pR)throw e;throw new pR(lR.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,hb(r).call(r,"mp3")?i={type:"audio/mpeg"}:hb(r).call(r,"aac")&&(i={type:"audio/aac"}),e.next=7,IK(n,i);case 7:if(e.sent){e.next=11;break}throw this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:hR.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new pR(lR.LOAD_RESOURCES_FAILED,"Load resources failed");case 11:return this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_PRELOADED,error:hR.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){var e=TK.createObjectURL(new Blob([n],i));return o._revokeURLs.add(e),new Audio(e)},filePath:r,duration:0}),e.next=15,new v_((function(e){var r=TK.createObjectURL(new Blob([n],i)),a=new Audio(r);a.addEventListener("durationchange",(function(){var n=o.resourcesCache.get(t);n&&(n.duration=a.duration,o.resourcesCache.set(t,n)),TK.revokeObjectURL(r),e(null)}))}));case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"unloadAudioMixing",value:function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)}},{key:"getAudioMixingVolume",value:function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0}},{key:"setAudioMixingVolume",value:function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)}},{key:"getAudioMixingDuration",value:function(e){var t=this.mixingMap.get(e),r=this.resourcesCache.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.duration:0:0}},{key:"getAudioMixingCurrentPosition",value:function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0}},{key:"setAudioMixingPosition",value:function(e,t){var r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())}},{key:"enableAudioMixingBuffer",value:function(e){vw(e,"type",nG(Gd));var t=this._context.getLocalAudioTrack();if(t){var r=t.getTrack("preprocessing");if(r&&this.mixMediaStream(new MediaStream([r])),e===Gd.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(n){}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:Hd.AUDIO_MIXING_STATE_PCM_ENABLED,error:hR.AUDIO_MIXING_ERROR_OK})}}},{key:"disableAudioMixingBuffer",value: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:Hd.AUDIO_MIXING_STATE_PCM_DISABLED,error:hR.AUDIO_MIXING_ERROR_OK})}}},{key:"pushAudioMixingBuffer",value: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(r){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 r=t.cachedBuffer.shift();r&&t.pushAudioMixingBuffer(r)}}}}},{key:"stopAll",value:function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(t){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))}},{key:"mixTrack",get:function(){return this._audioDestination.stream.getAudioTracks()[0]}},{key:"sharedAudioContext",get:function(){return this._sharedAudioContext}},{key:"resumeLocalPlay",value:(t=m_(Im.mark((function e(){var t,r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=ZT(this._failedAudioList),e.prev=2,r.s();case 4:if((n=r.n()).done){e.next=24;break}if(i=n.value,e.prev=6,!(i instanceof HTMLAudioElement)){e.next=13;break}return i.muted=!1,e.next=11,i.play();case 11:e.next=14;break;case 13:i.start();case 14:e.next=22;break;case 16:return e.prev=16,e.t0=e.catch(6),t.push(i),console.error(e.t0),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:gd.STREAM_INDEX_MAIN,mediaType:Sd.AUDIO}),e.abrupt("break",24);case 22:e.next=4;break;case 24:e.next=29;break;case 26:e.prev=26,e.t1=e.catch(2),r.e(e.t1);case 29:return e.prev=29,r.f(),e.finish(29);case 32:this._failedAudioList=t;case 33:case"end":return e.stop()}}),e,this,[[2,26,29,32],[6,16]])}))),function(){return t.apply(this,arguments)})},{key:"destroy",value: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(),this._startingIds=new bE,this._revokeURLs.forEach((function(e){TK.revokeObjectURL(e)}))}}]),e}();CK([VP("default","id","filePath","options")],wK.prototype,"startAudioMixing",1),CK([VP("default","id")],wK.prototype,"stopAudioMixing",1),CK([VP("default","id")],wK.prototype,"pauseAudioMixing",1),CK([VP("default","id")],wK.prototype,"resumeAudioMixing",1),CK([VP("default","id")],wK.prototype,"preloadAudioMixing",1),CK([VP("default","id")],wK.prototype,"unloadAudioMixing",1),CK([VP("default","id")],wK.prototype,"getAudioMixingVolume",1),CK([VP("default","id","volume")],wK.prototype,"setAudioMixingVolume",1),CK([VP("default","id")],wK.prototype,"getAudioMixingDuration",1),CK([VP("default","id")],wK.prototype,"getAudioMixingCurrentPosition",1),CK([VP("default","id","position")],wK.prototype,"setAudioMixingPosition",1),CK([VP("default","type")],wK.prototype,"enableAudioMixingBuffer",1),CK([VP()],wK.prototype,"disableAudioMixingBuffer",1),CK([VP("default","buffer")],wK.prototype,"pushAudioMixingBuffer",1);var xK=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(xK||{}),OK=new Jw("RTMClient",1),DK=function(e){DI(u,e);var t,r,n,i,o,a,s,c=YI(u);function u(e,t){var r;return Wd(this,u),sd(eI(r=c.call(this)),"_dataChannelSignal",null),sd(eI(r),"_handler",null),sd(eI(r),"_dataChannelSignalState",eB.DISCONNECTED),sd(eI(r),"_loginSessionId",null),sd(eI(r),"_userId",null),sd(eI(r),"_token",null),sd(eI(r),"_isReconnecting",!1),sd(eI(r),"_reconnectTimer",null),sd(eI(r),"_loginResolveCallback",null),sd(eI(r),"_loginRejectCallback",null),sd(eI(r),"_iceConfigNode",null),sd(eI(r),"_wait_login_token",!1),sd(eI(r),"_serverParamsCache",void 0),r.id=e,r._appId=t,r}return qd(u,[{key:"login",value:function(e,t){var r=this;return new v_((function(n,i){if(OK.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new pR(lR.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new pR(lR.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,DP.setStats({rtc_app_id:r._appId,rtm_user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(OK.print("login","init dataChannelSingling"),r._dataChannelSignalState=eB.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(s=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new pR(lR.NOT_LOGIN,"login first");case 2:return e.next=4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:VN.C2RTM}).catch((function(){}));case 4:this._closeDataChannelSignaling(),this._clearState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"updateLoginToken",value:(a=m_(Im.mark((function e(t){var r=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._token=t,e.abrupt("return",new v_((function(e,t){r._wait_login_token?(r._loginResolveCallback=e,r._loginRejectCallback=t,r._login()):e()})));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(o=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new pR(lR.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.next=5,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:t},{functionType:VN.C2RTM});case 5:return r=e.sent,e.abrupt("return",null==r?void 0:r.status);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(i=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new pR(lR.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:t,room:"",msg:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"setServerParams",value:(n=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,fw(t,"signature"),fw(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new pR(lR.NOT_LOGIN,"login first");case 5:return this._checkDataChannelSignal(),e.next=8,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:t,url:r},{functionType:VN.C2RTM}).catch((function(e){throw new pR(lR.UNEXPECTED_ERROR,e.msg)}));case 8:this._serverParamsCache={signature:t,url:r},this.emit("onServerParamsSetResult"),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(0),this.emit("onServerParamsSetResult",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[0,12]])}))),function(e,t){return n.apply(this,arguments)})},{key:"sendServerMessage",value:(r=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new pR(lR.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:_N.BUSINESS_SERVER,msg:t}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(){this._clearState(),this._closeDataChannelSignaling(),xI(CI(u.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=AC();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:xC.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:eN.VERSION,deviceId:YP.getDeviceId(),appId:this._appId,userId:this._userId},accessParams:ny({requireICEUfragV2:!0})},{functionType:VN.C2RTM}).then((function(){"function"==typeof e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,AN(e.id,t),e._wait_login_token=!1,e._serverParamsCache&&e.setServerParams(e._serverParamsCache.signature,e._serverParamsCache.url)})).catch((function(t){var r,n,i=t||{},o=i.code,a=i.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=lR.INVALID_PARAMS,n="Invalid userId"):(r=lR.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=lR.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new pR(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new GN,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,YP.getDeviceId(),"");case 6:if(o=e.sent,i=o[0]){e.next=10;break}throw new Error;case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),BP("rtm.login.getNodeFailed","",0,!0),new pR(lR.ICE_SERVER_WRONG,"get ICE config failed");case 16:return BP("rtm.login.getNodeSuccess",i,0,!0),OK.print("_createDataChannelSignaling()","get node success",i),this._handler=BF(wP),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){OK.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),u._onDisconnect()})),e.prev=20,e.next=23,null===(s=this._handler)||void 0===s?void 0:s.connect(i);case 23:a=e.sent,OK.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=eB.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=eB.DISCONNECTED,new pR(lR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return c=new FN(this.id,a),OK.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){OK.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(dN.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(dN.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(dN.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(dN.NODE_CHANGE,(function(e){BP("rtm.nodeChange",ny(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(u._iceConfigNode=e.nodes[0]),u._loginResolveCallback&&u._loginRejectCallback?u._login():u._reconnect()})),e.abrupt("return",c);case 42:case"end":return e.stop()}}),e,this,[[3,12],[20,28]])}))),function(e){return t.apply(this,arguments)})},{key:"_closeDataChannelSignaling",value: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}},{key:"_checkDataChannelSignal",value:function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==eB.CONNECTED)throw new pR(lR.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=eB.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_reconnect",value:function(){var e=this;!this._isReconnecting&&this._userId&&(OK.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){OK.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){OK.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))}},{key:"_clearState",value:function(){this._userId=null,this._token=null,this._loginSessionId=null,AN(this.id,""),null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}}]),u}(Pw.exports.EventEmitter),PK=function(e){DI(o,e);var t,r,n,i=YI(o);function o(e,t,r){var n,a=r.businessId;return Wd(this,o),sd(eI(n=i.call(this)),"_mediaServerClient",void 0),sd(eI(n),"_appId",void 0),sd(eI(n),"_reconnectTimer",void 0),sd(eI(n),"remoteStreams",void 0),sd(eI(n),"_businessId",void 0),n.id=e,n._appId=t,n.remoteStreams=new bE,n._businessId=a,n}return qd(o,[{key:"connect",value:(n=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new rB({id:this.id,avSync:!0,enableFallbackHandler:nX(this._appId)}),this._businessId&&(this._mediaServerClient.businessId=this._businessId),this._bindEvents(),e.next=5,this._mediaServerClient.connect(this._appId);case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"startPlayPublicStream",value:(r=m_(Im.mark((function e(t){var r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.remoteStreams.get(t)){e.next=2;break}throw new pR(lR.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new AF(t,t,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var t=tw(e),i=0;i<t.seiCount;i++)n.emit(zF.ON_SEI_MESSAGED_RECEIVED,{sei:t.seis[i],publicStreamId:r.streamId})})),e.next=6,this._mediaServerClient.subscribePublicStream(r);case 6:return this.remoteStreams.set(t,r),e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stopPlayPublicStream",value:function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)}},{key:"destroy",value:function(){this.remoteStreams=new bE,this._mediaServerClient&&this._mediaServerClient.destroy()}},{key:"_handleReconnected",value:(t=m_(Im.mark((function e(){var t,r,n,i=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:clearTimeout(this._reconnectTimer),t=ZT(this.remoteStreams);try{for(n=function(){var e=$T(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(zF.RESUBSCRIBE,{stream:t})}))},t.s();!(r=t.n()).done;)n()}catch(o){t.e(o)}finally{t.f()}case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_reconnect",value:function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=window.setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)}},{key:"_bindEvents",value:function(){var e,t,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(hN.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),o}(ex),NK=new Jw("AudioDeviceManager",1),MK=function(e){DI(c,e);var t,r,n,i,o,a,s=YI(c);function c(e){var t;return Wd(this,c),sd(eI(t=s.call(this)),"_audioLevelFetcher",void 0),sd(eI(t),"_playbackDeviceTestTimer",void 0),sd(eI(t),"_audioElement",void 0),sd(eI(t),"_audioTrack",void 0),sd(eI(t),"_mediaRecorder",void 0),sd(eI(t),"_recoderTimer",void 0),sd(eI(t),"_isAudioPlaybackDeviceTesting",!1),sd(eI(t),"_isAudioDeviceRecordTesting",!1),sd(eI(t),"_audioCaptureAndRecoderResolve",void 0),sd(eI(t),"_onAutoplayFailed",void 0),sd(eI(t),"_audioPlaybackDeviceId",void 0),t._extensionManager=e,t}return qd(c,[{key:"startAudioPlaybackDeviceTest",value:(a=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new pR(lR.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,NK.print("startAudioPlaybackDeviceTest()","Invoke"),e.prev=4,e.next=7,this._playAudioFile(t,{loop:!0});case 7:e.next=14;break;case 9:throw e.prev=9,e.t0=e.catch(4),NK.print("startAudioPlaybackDeviceTest()","error",e.t0),this.stopAudioPlaybackDeviceTest(),e.t0;case 14:this._startEmitAudioPlaybackDeviceTestVolume(r);case 15:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e,t){return a.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(NK.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(o=m_(Im.mark((function e(t,r){var n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.MediaRecorder){e.next=2;break}throw new pR(lR.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");case 2:if(!this._isAudioDeviceRecordTesting){e.next=4;break}throw new pR(lR.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 4:return this._isAudioDeviceRecordTesting=!0,NK.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){NK.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),n._stopAudioCaptureAndRecoder()}),3e4),e.prev=7,this._onAutoplayFailed=r,e.next=11,this._startAudioCaptureAndRecoder(t);case 11:e.next=18;break;case 13:throw e.prev=13,e.t0=e.catch(7),this._isAudioDeviceRecordTesting=!1,delete this._onAutoplayFailed,e.t0;case 18:delete this._audioCaptureAndRecoderResolve;case 19:case"end":return e.stop()}}),e,this,[[7,13]])}))),function(e,t){return o.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){NK.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(NK.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement()),delete this._onAutoplayFailed}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"setSinkId",value:(i=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(NK.print("setSinkId()","Invoke"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=3;break}throw new pR(lR.NOT_SUPPORTED,"setSinkId not supported by current browser");case 3:return e.next=5,mV.getDeviceById(t);case 5:if(r=e.sent){e.next=8;break}throw new pR(lR.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 8:return this._audioPlaybackDeviceId=t,this._setAudioCtxSinkId(),e.abrupt("return",r);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getSinkId",value:function(){return this._audioPlaybackDeviceId}},{key:"destroy",value:function(){NK.print("destroy()","Invoke"),xI(CI(c.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:(n=m_(Im.mark((function e(t,r){var n,i=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return NK.print("_playAudioFile()",xm(n="Invoke url=".concat(t,"; loop=")).call(n,r.loop)),e.abrupt("return",new v_((function(e,n){var o=TB("audio",{attributes:{src:t,crossOrigin:"anonymous"}});i._audioElement=o,o.loop=r.loop,i._audioLevelFetcher=new gV(o),o.onplaying=function(){o.onplaying=null,NK.print("_playAudioFile()","onplaying"),e()},o.onerror=function(){var e=m_(Im.mark((function e(t){var r,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:NK.print("_playAudioFile()","onerror",t),i=t.message||(null==o||null===(r=o.error)||void 0===r?void 0:r.message),n(new pR(lR.LOAD_RESOURCES_FAILED,"Failed to play recorded audio"+(i?", reason: ".concat(i):".")));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i._setAudioCtxSinkId().then((function(){var e,t;return null===(e=o.play())||void 0===e||null===(t=e.catch)||void 0===t?void 0:t.call(e,(function(e){var t;NK.print("_playAudioFile()","autoplay error",e);var r=xm(t="Failed to play recorded audio, ".concat(e.name,": ")).call(t,e.message);"NotAllowedError"===e.name&&i._onAutoplayFailed?i._onAutoplayFailed((function(){var e;return v_.all([null===(e=i._audioLevelFetcher)||void 0===e?void 0:e.resume(),o.play()])})):n(new pR(lR.LOAD_RESOURCES_FAILED,r))}))}))})));case 2:case"end":return e.stop()}}),e)}))),function(e,t){return n.apply(this,arguments)})},{key:"_destroyAudioElement",value:function(){this._audioElement&&(NK.print("_destroyAudioElement()","Invoke"),this._audioElement.onplaying=null,this._audioElement.onerror=null,this._audioElement.src="",delete this._audioElement,"function"==typeof this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())}},{key:"_startEmitAudioPlaybackDeviceTestVolume",value:function(e){var t=this;e=Math.max(e,100),this._audioElement&&(NK.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))}},{key:"_stopEmitAudioPlaybackDeviceTestVolume",value:function(){var e;void 0!==this._playbackDeviceTestTimer&&(NK.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher}},{key:"_startAudioCaptureAndRecoder",value:(r=m_(Im.mark((function e(t){var r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,qV({},this._extensionManager);case 2:return this._audioTrack=e.sent,i=this._audioTrack.getTrack("preprocessing"),r=IV.get(i),NK.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new v_((function(e,i){var o,a;"function"==typeof MediaRecorder.isTypeSupported&&(o=Nb(a=["audio/webm","audio/mp4"]).call(a,(function(e){return MediaRecorder.isTypeSupported(e)})),NK.print("startAudioDeviceRecordTest()","use mimeType: ".concat(o))),n._mediaRecorder=new MediaRecorder(r,o?{mimeType:o}:void 0);var s=n._mediaRecorder.mimeType;n._mediaRecorder.ondataavailable=function(){var r=m_(Im.mark((function r(o){var a,c;return Im.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return NK.print("startAudioDeviceRecordTest()","get recorded file(mimeType: ".concat(s,").")),c=new Blob([o.data],{type:s}),r.prev=3,r.next=6,n._playAudioFile(TK.createObjectURL(c),{loop:!1});case 6:r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(3),r.abrupt("return",i(r.t0));case 11:n._startEmitAudioPlaybackDeviceTestVolume(t),null===(a=n._audioElement)||void 0===a||a.addEventListener("ended",(function(){n.stopAudioDevicePlayTest(),e()})),n._audioCaptureAndRecoderResolve=e,r.next=17;break;case 16:e();case 17:case"end":return r.stop()}}),r,null,[[3,8]])})));return function(e){return r.apply(this,arguments)}}(),n._mediaRecorder.onerror=function(e){i(new pR(lR.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},n._mediaRecorder.start()})));case 6:case"end":return e.stop()}var i}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_stopAudioCaptureAndRecoder",value: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}},{key:"_setAudioCtxSinkId",value:(t=m_(Im.mark((function e(){var t,r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._audioPlaybackDeviceId){"default"===t&&(t="");try{null===(r=SV.getAudioContextInstance())||void 0===r||null===(n=r.setSinkId)||void 0===n||n.call(r,t),NK.print("setSinkId","ctx.sinkId=".concat(t))}catch(o){NK.print("setSinkId",xm(i="failed, ".concat(o.name," - ")).call(i,o.message))}}case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),c}(Pw.exports.EventEmitter),LK=function(){function e(t){Wd(this,e),sd(this,"_roomId",void 0),sd(this,"_constraints",{}),sd(this,"_profile",void 0),this._appId=t}return qd(e,[{key:"setRoomId",value:function(e){this._roomId=e}},{key:"setAudioProfile",value:function(e){this._profile=e}},{key:"getOpusConfigStr",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=YP.getEngineWebConfig(this._appId,this._roomId||""),n=r.audio_encode,i=this.getConstraints(),o=i.sampleRate,a=i.channelCount,s="number"==typeof o?o:null==o?void 0:o.exact,c="number"==typeof a?a:null==a?void 0:a.exact,u={};t.split(";").forEach((function(e){var t=$T(e.split("="),2),r=t[0],n=t[1];r&&n&&(u[r]=n)}));var d=(null==n?void 0:n.bitrate)||this._getConfigByAudioProfile().bitrate;d&&(u.maxaveragebitrate=d);var l=(null==n?void 0:n.enc_sample_rate)||s;l&&(u["sprop-maxcapturerate"]=l);var h=(null==n?void 0:n.playback_rate)||s;return h&&(u.maxplaybackrate=h),(c&&c>1||null!=n&&n.stereo)&&(u["sprop-stereo"]=1,u.stereo=1),null!=n&&n.dtx&&(u.usedtx=1),uy(e=an(u)).call(e,(function(e){var t;return xm(t="".concat(e,"=")).call(t,u[e])})).join(";")}},{key:"updateConstraints",value:function(e){this._constraints=ud(ud({},this._constraints),e)}},{key:"getConstraints",value:function(){var e=ud({},this._constraints),t=YP.getEngineWebConfig(this._appId,this._roomId||"").audio_capture;nw(null==t?void 0:t.sample_rate)||(e.sampleRate=t.sample_rate),nw(null==t?void 0:t.channel)||(e.channelCount=t.channel),nw(null==t?void 0:t.agc)||(e.autoGainControl=t.agc),nw(null==t?void 0:t.ans)||(e.noiseSuppression=t.ans),nw(null==t?void 0:t.aec)||(e.echoCancellation=t.aec);var r=this._getConfigByAudioProfile(),n=r.sampleRate,i=r.channel;return nw(e.sampleRate)&&!nw(n)&&(e.sampleRate=n),nw(e.channelCount)&&!nw(i)&&(e.channelCount=i),e}},{key:"_getConfigByAudioProfile",value:function(){var e={};switch(this._profile){case Pd.fluent:e.sampleRate=16e3,e.bitrate=24e3;break;case Pd.standard:e.sampleRate=48e3,e.bitrate=48e3;break;case Pd.hd:e.sampleRate=48e3,e.bitrate=128e3,e.channel=2;break;case Pd.standardStereo:e.sampleRate=48e3,e.bitrate=8e4,e.channel=2;break;case Pd.hdMono:e.sampleRate=48e3,e.bitrate=128e3}return e}}]),e}(),UK=new Jw("VideoSnapshot",1),VK=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},FK=function(){var e=m_(Im.mark((function e(t,r,n){var i,o,a,s,c,u,d,l;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=document.createElement("canvas"),o=i.getContext("2d")){e.next=4;break}throw new Error("canvas.getContext error");case 4:if(a=function(e,t,n){return t=t||e.width,n=n||e.height,i.width=t,i.height=n,r?o.setTransform(-1,0,0,1,t,0):o.setTransform(1,0,0,1,0,0),o.drawImage(e,0,0,t,n),o.getImageData(0,0,t,n)},s=Date.now(),!(c=VK(n))){e.next=16;break}return UK.print("takeSnapshot","VideoPlayer already set."),e.next=11,a(c,c.videoWidth,c.videoHeight);case 11:return u=e.sent,UK.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",u);case 16:if(!window.ImageCapture){e.next=29;break}if("live"!==(d=new window.ImageCapture(t)).track.readyState||!d.track.enabled||d.track.muted){e.next=29;break}return UK.print("takeSnapshot","use ImageCapture"),e.t0=a,e.next=23,d.grabFrame();case 23:return e.t1=e.sent,e.next=26,(0,e.t0)(e.t1);case 26:return l=e.sent,UK.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",l);case 29:return UK.print("takeSnapshot","use temp video"),e.abrupt("return",new v_((function(e,r){var n=new MediaStream([t]),i=document.createElement("video");i.setAttribute("playsinline",""),i.muted=!0,document.body.appendChild(i),i.onplaying=function(){var r=a(i,i.videoWidth,i.videoHeight);UK.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e(r),n.removeTrack(t),i.srcObject=null,i.load()},i.onerror=r,i.srcObject=n,i.play()})));case 31:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),BK=function(){return{url:"",video:{codec:Ld.H264,width:640,height:360,fps:15,gop:2,kBitRate:jK(640,360,15)},audio:{codec:"AAC",kBitRate:64,sampleRate:48e3,channels:2,AACProfile:Md.LC},layout:{regions:[],appData:"",backgroundColor:"#000000"}}};function jK(e,t,r){return e*t<=288e3?r<=15?800:1200:e*t<=864e3?r<=15?1200:1800:e*t<=1152e3?r<=15?1600:2400:e*t<=2592e3?r<=15?2500:3750:r<=15?3300:5e3}function GK(e){if("string"!=typeof e||!/^rtmps?:\/\//.test(e))throw new pR(lR.INVALID_PARAMS,"Invalid rtmp address")}function HK(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e||!e.length)throw new pR(lR.INVALID_PARAMS,"regions should not be empty.");var t,r=ZT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if("string"!=typeof n.userId)throw new pR(lR.INVALID_PARAMS,"region.userId(".concat(n.userId,") should be a string."));if("boolean"!=typeof n.isScreenStream)throw new pR(lR.INVALID_PARAMS,"region.isScreenStream(".concat(n.isScreenStream,") should be a boolean."))}}catch(i){r.e(i)}finally{r.f()}}function zK(e,t){var r,n,i,o=function(e,r){var n=LE(e).call(e,(function(e,t){return null==e?void 0:e[t]}),t),i=LE(e).call(e,(function(e,t){return null==e?void 0:e[t]}),BK());return n&&r(n)?n:i},a=function(e){return e%2==0?e:e+1},s=a(o(["video","width"],(function(e){return e>=2&&e<=1920}))),c=a(o(["video","height"],(function(e){return e>=2&&e<=1920}))),u=o(["video","fps"],(function(e){return e>=1&&e<=60})),d=(null===(r=t.video)||void 0===r?void 0:r.kBitRate)||0,l=o(["audio","sampleRate"],(function(e){var t;return!!Nb(t=[32e3,44100,48e3]).call(t,(function(t){return t===e||t/1e3===e}))}));return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:o(["audio","codec"],(function(e){return"AAC"===e})),bitRate:1e3*o(["audio","kBitRate"],(function(e){return e>=32&&e<=192})),sampleRate:l<100?1e3*l:l,channels:o(["audio","channels"],(function(e){var t;return $m(t=[1,2]).call(t,e)})),profile:o(["audio","AACProfile"],(function(e){var t;return $m(t=[Md.LC,Md.HEv1,Md.HEv2]).call(t,e)}))},video:{codec:o(["video","codec"],(function(e){var t;return $m(t=["H264","H265"]).call(t,e)})),fps:u,gop:o(["video","gop"],(function(e){return e>=1&&e<=5}))*u,bitRate:1e3*(d>=16&&d<=1e4?d:jK(s,c,u)),width:s,height:c},layout:{canvas:{bgnd:o(["layout","backgroundColor"],(function(e){return/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(e)}))},regions:(null===(n=t.layout)||void 0===n||null===(i=n.regions)||void 0===i?void 0:uy(i).call(i,(function(e){var t,r;return{alpha:!e.alpha||+e.alpha>1||+e.alpha<=0?1:+e.alpha,uid:e.userId,zorder:!e.zorder||+e.zorder<0||+e.zorder>100?0:+e.zorder,x:!e.x||+e.x>=1||+e.x<0?0:+e.x,y:!e.y||+e.y>=1||+e.y<0?0:+e.y,w:!e.w||+e.w>1||+e.w<=0?1:+e.w,h:!e.h||+e.h>1||+e.h<=0?1:+e.h,renderMode:e.renderMode&&$m(t=[1,2,3]).call(t,e.renderMode)?e.renderMode:1,contentControl:e.contentControl&&$m(r=[0,1,2]).call(r,e.contentControl)?e.contentControl:0,screen:!!e.isScreenStream}})))||[],app_data:o(["layout","appData"],(function(e){return"string"==typeof e}))}}}}var KK,XK,qK={getDefaultValue:BK,checkStartParams:function(e){var t;GK(e.url),HK(null===(t=e.layout)||void 0===t?void 0:t.regions)},checckUpdateParams:function(e){var t;e.url&&GK(e.url),HK(null===(t=e.layout)||void 0===t?void 0:t.regions)},getStartParams:function(e){return zK("started",e)},getUpdateParams:function(e){return zK("layoutChanged",e)}},WK=ad,YK=tc,QK=function(e,t,r,n){for(var i,o=n>1?void 0:n?YK(t,r):t,a=e.length-1;a>=0;a--)(i=e[a])&&(o=(n?i(t,r,o):i(o))||o);return n&&o&&WK(t,r,o),o},JK=new Jw("Engine",0),ZK=(XK=function(e){DI(_e,e);var t,r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O,D,P,N,M,L,U,V,F,B,j,G,H,z,K,X,q,W,Y,Q,J,Z,$,ee,te,re,ne,ie,oe,ae,se,ce,ue,de,le,he,pe,fe,ve=YI(_e);function _e(e,t){var r;Wd(this,_e),sd(eI(r=ve.call(this)),"id",(_e.GUID++).toString()),sd(eI(r),"_room",void 0),sd(eI(r),"_publicStreamManager",void 0),sd(eI(r),"_appId",void 0),sd(eI(r),"_businessId",void 0),sd(eI(r),"_visibility",!0),sd(eI(r),"_localVideoTrack",void 0),sd(eI(r),"_localAudioTrack",void 0),sd(eI(r),"_localImgVideoTrack",void 0),sd(eI(r),"_localImgScreenTrack",void 0),sd(eI(r),"_localScreenVideoTrack",void 0),sd(eI(r),"_localScreenAudioTrack",void 0),sd(eI(r),"_tempMixingAudioTrack",void 0),sd(eI(r),"_videoPlayer",void 0),sd(eI(r),"_screenPlayer",void 0),sd(eI(r),"_remoteVideoPlayer",new bE),sd(eI(r),"_remoteScreenPlayer",new bE),sd(eI(r),"_remoteAudioPlayer",new bE),sd(eI(r),"_remoteScreenAudioPlayer",new bE),sd(eI(r),"_publicStreamAudioPlayer",new bE),sd(eI(r),"_publicStreamVideoPlayer",new bE),sd(eI(r),"_publicStreamIds",new bE),sd(eI(r),"_roomConfig",void 0),sd(eI(r),"_videoStreamConstraints",iN),sd(eI(r),"_audioStreamConstraints",{}),sd(eI(r),"_enableSimulcast",!1),sd(eI(r),"_videoStreamEncodeConfig",[iN]),sd(eI(r),"_screenStreamEncodeConfig",[oN]),sd(eI(r),"_dummyMainImage",void 0),sd(eI(r),"_dummyScreenImage",void 0),sd(eI(r),"_trackSourceType",void 0),sd(eI(r),"_liveTranscodeConfig",void 0),sd(eI(r),"_useCloudProxy",void 0),sd(eI(r),"_startCloudProxyTimestamp",void 0),sd(eI(r),"_localVideoDeviceId",void 0),sd(eI(r),"_localAudioDeviceId",void 0),sd(eI(r),"_pauseAllSubscribeState",{audio:void 0,video:void 0,resumeStreamIds:{}}),sd(eI(r),"_audioVolumeIndicationTimer",void 0),sd(eI(r),"_dummyMainTimer",void 0),sd(eI(r),"_dummyScreenTimer",void 0),sd(eI(r),"_audioPropertiesReportTimer",null),sd(eI(r),"_mirrorType",kd.MIRROR_TYPE_RENDER),sd(eI(r),"_audioMixingManager",void 0),sd(eI(r),"_pubLock",void 0),sd(eI(r),"_rtmClient",void 0),sd(eI(r),"_messageStatisticsObserver",void 0),sd(eI(r),"_tempRoomInfo",void 0),sd(eI(r),"_originIceConfigRequestUrls",void 0),sd(eI(r),"_originConfigServerUrls",void 0),sd(eI(r),"_originLogServerUrl",void 0),sd(eI(r),"_extensionManager",new bV),sd(eI(r),"_audioDeviceManager",new MK(r._extensionManager)),sd(eI(r),"_audioProfileManager",void 0),sd(eI(r),"_requestManager",new HN),sd(eI(r),"_remoteVideoConfig",new bE),sd(eI(r),"_userPriorityMap",new bE),sd(eI(r),"_subscribeFallbackOption",void 0),sd(eI(r),"_cameraCapturing",!1),sd(eI(r),"_interruptCameraCapture",!1),sd(eI(r),"_micCapturing",!1),sd(eI(r),"_interruptMicCapture",!1),sd(eI(r),"_avSync",!0),sd(eI(r),"_config",void 0),sd(eI(r),"_needClosePreTrack",!1),sd(eI(r),"_updateMixAudioTrack",function(){var e=m_(Im.mark((function e(t){var n,i,o=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=o.length>1&&void 0!==o[1]?o[1]:Gd.PLAYOUT_AND_PUBLISH,JK.print("_updateMixAudioTrack()"),r._localAudioTrack){e.next=5;break}return t&&(r._tempMixingAudioTrack={track:t,type:i}),e.abrupt("return");case 5:if(t?(r._localAudioTrack.mixType=i,r._localAudioTrack.mixedAudioTrack=t):(delete r._localAudioTrack.mixType,delete r._localAudioTrack.mixedAudioTrack),null===(n=r._room)||void 0===n||!n.hasPublished){e.next=9;break}return e.next=9,r._updatePublish();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),sd(eI(r),"_onAudioMixingMessage",(function(e){r.safeEmit(Kd.onAudioMixingStateChanged,e)})),sd(eI(r),"_onAudioMixingAutoplayFailed",(function(e){r.safeEmit(Kd.onAutoplayFailed,e)})),r._appId=e,r._pubLock=new HF("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new wK({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),r._audioProfileManager=new LK(e),window.__rtc_engine__=eI(r),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=eI(r),r._trackSourceType={video:dd.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:dd.VIDEO_SOURCE_TYPE_INTERNAL,audio:ld.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:ld.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new DK(r.id,e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new DB,r._extensionManager.setMinotor(CP),kN(r.id);var n=YP.getDeviceId();return r._requestManager.getConfig(e,n).then((function(e){e.rts_report&&bN(e.rts_report)})),r}return qd(_e,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(fe=m_(Im.mark((function e(t){var r,n,i,o,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("updateToken()","token: %s",t),fw(t,"token"),!this.waitForNewToken||!this._tempRoomInfo){e.next=8;break}return n=this._tempRoomInfo,i=n.config,o=n.userInfo,a=n.roomId,delete this._tempRoomInfo,e.next=7,this.joinRoom(t,a,o,i);case 7:return e.abrupt("return",e.sent);case 8:if(this._room){e.next=10;break}throw new pR(lR.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");case 10:return e.next=12,null===(r=this._room)||void 0===r?void 0:r.updateToken(t);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return fe.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(pe=m_(Im.mark((function e(t){var r,n,i=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("setVideoCaptureDevice()","deviceId: %s",t),fw(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=tG({},this._videoStreamConstraints),"user"===t||"environment"===t||"left"===t||"right"===t?(delete r.deviceId,r.facingMode=t):r.deviceId={exact:t},this._needClosePreTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),delete this._localVideoTrack),JK.print("setVideoCaptureDevice()","start createCameraVideoTrack..."),e.next=11,KV(r,this._extensionManager).catch((function(e){if(i._localVideoTrack&&!i._localVideoTrack.dummy)return JK.print("setVideoCaptureDevice()","createCameraVideoTrack failed, stop pre VideoTrack."),i._removeLocalTrackEvents(i._localVideoTrack),i._localVideoTrack.close(),delete i._localVideoTrack,KV(r,i._extensionManager).then((function(e){return i._needClosePreTrack=!0,e})).catch(m_(Im.mark((function t(){var r;return Im.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return JK.print("setVideoCaptureDevice()","createCameraVideoTrack failed, rollback."),t.next=3,KV(i._videoStreamConstraints,i._extensionManager);case 3:throw r=t.sent,i._switchTrack(r),e;case 6:case"end":return t.stop()}}),t)}))));throw e}));case 11:return n=e.sent,JK.print("setVideoCaptureDevice()","createCameraVideoTrack success."),this._videoStreamConstraints=r,this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),e.next=17,this._switchTrack(n);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return pe.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(he=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("setAudioCaptureDevice()","deviceId: %s",t),fw(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return this._audioProfileManager.updateConstraints({deviceId:{exact:t}}),this._localAudioTrack.close(),this._removeLocalTrackEvents(this._localAudioTrack),e.next=10,qV(this._audioProfileManager.getConstraints(),this._extensionManager);case 10:if(r=e.sent,this._initLocalTrackEvents(r),this._localAudioTrack=r,this._room){e.next=15;break}return e.abrupt("return");case 15:if(!this._room.hasPublished){e.next=18;break}return e.next=18,this._updatePublish();case 18:case"end":return e.stop()}}),e,this)}))),function(e){return he.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){mV.on(Kd.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),mV.on(Kd.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O=this;null===(e=this._room)||void 0===e||e.on(dN.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(dN.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(dN.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(zF.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(zF.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(zF.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(a=this._room)||void 0===a||a.on(dN.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(dN.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(dN.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(dN.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(dN.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(hN.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(zF.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(p=this._room)||void 0===p||p.on(zF.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(zF.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(v=this._room)||void 0===v||v.on(zF.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=O._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&O.safeEmit(Kd.onAutoPublishResult,e)})),null===(_=this._room)||void 0===_||_.on(zF.ON_REMOTE_STREAM_STATS,(function(e){O.safeEmit(Kd.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(zF.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(Kd.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(zF.ON_SUBTITLE_STATE_CHANGED,(function(e){O.safeEmit(Kd.onSubtitleStateChanged,e)})),null===(g=this._room)||void 0===g||g.on(zF.ON_SUBTITLE_MESSAGE_RECEIVED,(function(e){O.safeEmit(Kd.onSubtitleMessageReceived,e)})),null===(S=this._room)||void 0===S||S.on(zF.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(E=this._room)||void 0===E||E.on(zF.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;O._updateAudioPlayerState(t),O.safeEmit(Kd.onUserStartAudioCapture,{userId:r})})),null===(b=this._room)||void 0===b||b.on(zF.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(Kd.onUserStopAudioCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(zF.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(Kd.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(zF.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(Kd.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(zF.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(Kd.onSEIMessageReceived,e)})),null===(A=this._room)||void 0===A||A.on(zF.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(Kd.onRemoteVideoSizeChanged,e,t)})),null===(R=this._room)||void 0===R||R.on(zF.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(Kd.onSimulcastSubscribeFallback,e)})),null===(C=this._room)||void 0===C||C.on(zF.RECONNECT_FAILED,(function(){O.safeEmit(Kd.onError,{errorCode:lR.RECONNECT_FAILED})})),null===(w=this._room)||void 0===w||w.on(zF.ON_VIDEO_STREAM_BANNED,(function(e){O.safeEmit(Kd.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(x=this._room)||void 0===x||x.on(zF.ON_AUDIO_STREAM_BANNED,(function(e){O.safeEmit(Kd.onAudioStreamBanned,{uid:e.uid,banned:e.banned})}))}},{key:"safeEmit",value:function(e){for(var t,r,n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return ww(e)&&FP(e,WC(i)),(t=xI(CI(_e.prototype),"safeEmit",this)).call.apply(t,xm(r=[this,e]).call(r,i))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()}},{key:"setConnectionMode",value:function(e){vw(e,"mode",[Fd.AUTO,Fd.FORCE_TCP,Fd.FORCE_UDP]),tN("CONNECTION_MODE",e)}},{key:"joinRoom",value:(le=m_(Im.mark((function e(t,r,n,i){var o,a,s,c,u,d;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,i),Ew(t)||fw(t,"token"),bw(r),Iw(n),Aw(i=tG({isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Dd.communication},i)),!this._room||this._room.connectionState===eB.DISCONNECTED){e.next=10;break}throw new pR(lR.REPEAT_JOIN,"Already joined");case 10:return this._room=new bB(i,{id:this.id,audioProfileManager:this._audioProfileManager,streamRTT:{},subscribeFallbackOption:this._subscribeFallbackOption,userPriority:this._userPriorityMap,avSync:this._avSync,enableFallbackHandler:nX(this.appId)}),this._addHandlerEventHandler(),o=this._liveTranscodeConfig&&qK.getStartParams(this._liveTranscodeConfig),a=ud(ud({},n),{},{businessId:this._businessId,role:this._visibility?xK.NORMAL_USER:xK.SILENT_USER}),e.prev=14,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),_B(a),e.next=19,this._room.join(this._appId,r,t,a,o,this._useCloudProxy,null===(s=this._config)||void 0===s?void 0:s.expectedIDC);case 19:return u=e.sent,this._roomConfig=i,this._audioProfileManager.setRoomId(r),this._tempRoomInfo&&delete this._tempRoomInfo,null!==(c=i)&&void 0!==c&&c.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:Sd.AUDIO_AND_VIDEO}):this.safeEmit(Kd.onAutoPublishResult,{isScreen:!1,state:_d.PUBLISH_FAIL})),IN(this.id,this._room.roomInfo),e.abrupt("return",u);case 28:throw e.prev=28,e.t0=e.catch(14),e.t0.code===lR.INVALID_TOKEN&&(this._tempRoomInfo={config:i,roomId:r,userInfo:a}),null===(d=this._room)||void 0===d||d.destroy(),e.t0;case 33:case"end":return e.stop()}}),e,this,[[14,28]])}))),function(e,t,r,n){return le.apply(this,arguments)})},{key:"leaveRoom",value:(de=m_(Im.mark((function e(){var t,r,n,i=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],JK.print("leaveRoom()"),!t){e.next=7;break}return e.next=5,null===(r=this._room)||void 0===r?void 0:r.leave(t);case 5:e.next=8;break;case 7:null===(n=this._room)||void 0===n||n.leave(t).catch();case 8:this._removeHandlerEventHandler(),this._audioProfileManager.setRoomId(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new bE,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new bE,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new bE,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new bE,this._roomConfig=void 0,this._publicStreamIds=new bE,IN(this.id);case 23:case"end":return e.stop()}}),e,this)}))),function(){return de.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;JK.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._videoStreamEncodeConfig=[iN],this._screenStreamEncodeConfig=[oN],this._pauseAllSubscribeState={audio:void 0,video:void 0,resumeStreamIds:{}},this._messageStatisticsObserver.destroy(),TN(this.id),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyMainTimer),clearInterval(this._dummyScreenTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._removeLocalTrackEvents(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 bE,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new bE,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new bE,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new bE,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new bE,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new bE,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._publicStreamManager)||void 0===r||r.destroy(),this._publicStreamIds=new bE,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new bE,this._userPriorityMap.clear(),this._extensionManager.destroy(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1,this._avSync=!0}},{key:"publishStream",value:(ue=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!$C(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,jV(this._localImgVideoTrack,this._extensionManager);case 6:this._localVideoTrack=e.sent;case 7:return e.next=9,this._updatePublish({mediaType:t});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ue.apply(this,arguments)})},{key:"unpublishStream",value:(ce=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("unpublishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!r){e.next=5;break}return e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.unpublish());case 5:return e.next=7,this._updatePublish({mediaType:t,pubState:XF.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return ce.apply(this,arguments)})},{key:"publishScreen",value:(se=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!$C(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,HV(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:XF.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof pR)){e.next=18;break}throw e.t0;case 18:throw new pR(lR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 19:case"end":return e.stop()}}),e,this,[[3,12]])}))),function(e){return se.apply(this,arguments)})},{key:"unpublishScreen",value:(ae=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:XF.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return ae.apply(this,arguments)})},{key:"subscribeStream",value:(oe=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("subscribeStream()","userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!1,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return oe.apply(this,arguments)})},{key:"_subscribe",value:(ie=m_(Im.mark((function e(t,r,n){var i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),n!==Sd.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){e.next=5;break}return JK.print("subscribeStream()","due to multiChatMode return"),e.abrupt("return");case 5:if(u=this._room.remoteStreams.get(r),d=null==u?void 0:Nb(u).call(u,(function(e){return e.isScreen===t}))){e.next=9;break}throw new pR(lR.STREAM_NOT_EXIST,"stream not exist");case 9:return l=this._pauseAllSubscribeState.audio,h=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(n-=n&Sd.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&Sd.VIDEO),JK.print("subscribeStream()","due to pauseAll mediaType: %o",n),p=d.hasSubscribed,f=this._remoteVideoConfig.get(r)||(null===(o=this._roomConfig)||void 0===o?void 0:o.remoteVideoConfig),d.originalMediaType=n,e.next=19,this._room.subscribe(d,n,f);case 19:ZC(n)&&this._updateAudioPlayerState(d),$C(n)&&this._updateVideoPlayerState(d),v=0,_=0,l!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?v|=Sd.AUDIO:_|=Sd.AUDIO),h!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?v|=Sd.VIDEO:_|=Sd.VIDEO),v&&this.pauseAllSubscribedStream(v),_&&this.resumeAllSubscribedStream(_),this._pauseAllSubscribeState.resumeStreamIds[d.streamId]=d.streamId,!t&&(null!==(a=this._roomConfig)&&void 0!==a&&a.isAutoSubscribeAudio||null!==(s=this._roomConfig)&&void 0!==s&&s.isAutoSubscribeVideo)&&(d.audioTrack||d.videoTrack)&&(m={userId:r,isScreen:!1,state:vd.SUBSCRIBE_SUCC},this.safeEmit(Kd.onAutoSubscribeResult,m)),null!==(c=this._room)&&void 0!==c&&c.multiChatMode||p||!ZC(n)||!d.hasAudio||null===(y=d.observer)||void 0===y||y.setSubscribeAudio(!0),!p&&$C(n)&&d.hasVideo&&(null===(g=d.observer)||void 0===g||g.setSubscribeVideo(!0));case 31:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return ie.apply(this,arguments)})},{key:"unsubscribeStream",value:(ne=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:JK.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this._unsubscribe(!1,t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return ne.apply(this,arguments)})},{key:"subscribeScreen",value:(re=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("subscribeScreen() userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!0,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return re.apply(this,arguments)})},{key:"unsubscribeScreen",value:(te=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:JK.print("unsubscribeScreen() userId: %o, mediaType: %o",t,r),this._unsubscribe(!0,t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return te.apply(this,arguments)})},{key:"_unsubscribe",value:function(e,t,r,n){var i,o=this;if(this._checkMediaType(r),this._assertNotInRoom(),r!==Sd.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){var a=this._room.remoteStreams.get(t),s=null==a?void 0:Nb(a).call(a,(function(t){return t.isScreen===e}));if(null==s||!s.hasSubscribed)throw new pR(lR.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(s,r).then((function(){n||delete o._pauseAllSubscribeState.resumeStreamIds[s.streamId]}))}JK.print("subscribeStream()","due to multiChatMode return")}},{key:"setRemoteVideoConfig",value:(ee=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),kw(t),xw(r),this._remoteVideoConfig.set(t,r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.updateSubVideoConfig(t,r).then((function(){})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return ee.apply(this,arguments)})},{key:"startVideoCapture",value:($=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,l=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("startVideoCapture()","deviceId: %s",t),Ew(t)||fw(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,this._trackSourceType.video!==dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 6:if(!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=8;break}throw new pR(lR.REPEAT_CAPTURE,"Has already capture");case 8:return i=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?i.facingMode=t:i.deviceId={exact:t},this._videoStreamConstraints=i),o={},e.prev=11,this._cameraCapturing=!0,e.next=15,KV(i,this._extensionManager);case 15:if(s=e.sent,!this._interruptCameraCapture){e.next=21;break}throw this._interruptCameraCapture=!1,this._removeLocalTrackEvents(s),s.close(),new pR(lR.INTERRUPT,"interrupt by stopVideoCapture");case 21:if(this._initLocalTrackEvents(s),this._localVideoTrack=s,null===(a=this._videoPlayer)||void 0===a||a.playVideo(s),(c=null==s?void 0:s.getTrack())&&(o=c.getSettings(),u={width:o.width,height:o.height},this._localVideoTrack.resolution=u,setTimeout((function(){return l.safeEmit(Kd.onLocalVideoSizeChanged,{streamIndex:gd.STREAM_INDEX_MAIN,info:u})}))),this._room){e.next=28;break}return e.abrupt("return",o);case 28:return e.prev=28,this._cameraCapturing=!1,e.finish(28);case 31:return d=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||d)&&(this._visibility?this._updatePublish():this.safeEmit(Kd.onAutoPublishResult,{isScreen:!1,state:_d.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableVideo(!0),e.abrupt("return",o);case 35:case"end":return e.stop()}}),e,this,[[11,,28,31]])}))),function(e){return $.apply(this,arguments)})},{key:"stopVideoCapture",value:(Z=m_(Im.mark((function e(){var t,r,n,i,o,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,JK.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 7:if(null===(t=this._videoPlayer)||void 0===t||t.stop(),this._localVideoTrack&&(this._localVideoTrack.dummy||(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localImgVideoTrack?(null===(a=this._localVideoTrack)||void 0===a||a.setTrack(this._localImgVideoTrack,this._extensionManager),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0)),this._room){e.next=11;break}return e.abrupt("return");case 11:if(null===(r=this._room)||void 0===r||!r.hasPublished){e.next=14;break}return e.next=14,this._updatePublish();case 14:null===(n=this._room)||void 0===n||null===(i=n.localStream)||void 0===i||null===(o=i.observer)||void 0===o||o.setEnableVideo(!1);case 15:case"end":return e.stop()}}),e,this)}))),function(){return Z.apply(this,arguments)})},{key:"startAudioCapture",value:(J=m_(Im.mark((function e(t){var r,n,i,o,a,s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("startAudioCapture()","deviceId: $o",t),Ew(t)||fw(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,this._trackSourceType.audio!==ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:if(!this._micCapturing&&!this._localAudioTrack){e.next=8;break}throw new pR(lR.REPEAT_CAPTURE,"Has already capture");case 8:return t&&this._audioProfileManager.updateConstraints({deviceId:{exact:t}}),i={},e.prev=10,this._micCapturing=!0,e.next=14,qV(this._audioProfileManager.getConstraints(),this._extensionManager);case 14:if(o=e.sent,!this._interruptMicCapture){e.next=20;break}throw this._interruptMicCapture=!1,this._removeLocalTrackEvents(o),o.close(),new pR(lR.INTERRUPT,"interrupt by stopAudioCapture");case 20:if(this._initLocalTrackEvents(o),this._localAudioTrack=o,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),(a=null==o?void 0:o.getTrack())&&(i=a.getSettings()),this._room){e.next=27;break}return e.abrupt("return",i);case 27:return e.prev=27,this._micCapturing=!1,e.finish(27);case 30:return s=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||s)&&(this._visibility?this._updatePublish():this.safeEmit(Kd.onAutoPublishResult,{isScreen:!1,state:_d.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!0),e.abrupt("return",i);case 34:case"end":return e.stop()}}),e,this,[[10,,27,30]])}))),function(e){return J.apply(this,arguments)})},{key:"stopAudioCapture",value:(Q=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,JK.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.audio!==ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:if(this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._room){e.next=12;break}return e.abrupt("return");case 12:if(!this._room.hasPublished){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(t=this._room.localStream)||void 0===t||null===(r=t.observer)||void 0===r||r.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return Q.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return JK.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(Y=m_(Im.mark((function e(){var t,r,n,i,o,a,s,c,u,d,l,h,p,f=this,v=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=v.length>0&&void 0!==v[0]?v[0]:{},JK.print("startScreenCapture()","config: %o",o),a=o.enableAudio,s=void 0!==a&&a,this._trackSourceType.screenVideo!==dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 5:if(this._trackSourceType.screenAudio!==ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:return e.next=9,YV(s,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(c=e.sent,u=$T(c,2),d=u[0],l=u[1],this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(t=this._localScreenAudioTrack)||void 0===t||t.close(),delete this._localScreenAudioTrack,this._localScreenVideoTrack=d,null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&d.setContentHint(null===(h=this._screenStreamEncodeConfig[0])||void 0===h?void 0:h.contentHint),(p=null==d?void 0:d.getTrack())&&setTimeout((function(){var e=p.getSettings(),t={width:e.width,height:e.height};d.resolution=t,f.safeEmit(Kd.onLocalVideoSizeChanged,{streamIndex:gd.STREAM_INDEX_SCREEN,info:{width:e.width,height:e.height}})}),500),l&&(this._localScreenAudioTrack=l,this._initLocalTrackEvents(l)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(i=this._room)||void 0===i||!i.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(){return Y.apply(this,arguments)})},{key:"stopScreenCapture",value:(W=m_(Im.mark((function e(){var t,r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),this._localScreenVideoTrack&&(this._localScreenVideoTrack.dummy||(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close(),this._localImgScreenTrack&&(null===(n=this._localScreenVideoTrack)||void 0===n||n.setTrack(this._localImgScreenTrack,this._extensionManager),this._localScreenVideoTrack.dummy=!0))),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,null===(r=this._room)||void 0===r||!r.hasScreenPublished){e.next=8;break}return e.next=8,this._updateScreenPublish();case 8:case"end":return e.stop()}}),e,this)}))),function(){return W.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(JK.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),vw(e,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,i=ud(ud({userId:this._getUserId()},t),{},{isLocal:!0});if(Rw(i),e===gd.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new wB(i),this._initPlayerEvents(this._videoPlayer,!1,e),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===gd.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new wB(ud(ud({},i),{},{isScreen:!0,isLocal:!0})),this._initPlayerEvents(this._screenPlayer,!1,e),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var o,a;e===gd.STREAM_INDEX_MAIN?(null===(o=this._videoPlayer)||void 0===o||o.destroy(!0),delete this._videoPlayer):(null===(a=this._screenPlayer)||void 0===a||a.destroy(),delete this._screenPlayer)}}},{key:"startLiveTranscoding",value:(q=m_(Im.mark((function e(t){var r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("startLiveTranscoding()","transcode: %o",t),qK.checkStartParams(t),this._liveTranscodeConfig=t,!((n=null===(r=this._room)||void 0===r?void 0:r.roomInfo)&&n.roomId.length+n.userInfo.userId.length>126)){e.next=6;break}throw new pR(lR.INVALID_PARAMS,"The roomId+userId must be within 126 bytes");case 6:if(e.prev=6,this.safeEmit(Kd.onStreamMixingEvent,{event:KF.START,error:0,message:""}),!this._room||this._room.connectionState!==eB.CONNECTED){e.next=11;break}return e.next=11,null===(i=this._room)||void 0===i?void 0:i.liveControlMessage(qK.getStartParams(this._liveTranscodeConfig));case 11:e.next=20;break;case 13:if(e.prev=13,e.t0=e.catch(6),!(e.t0 instanceof pR)){e.next=19;break}throw e.t0;case 19:throw new pR(lR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 20:case"end":return e.stop()}}),e,this,[[6,13]])}))),function(e){return q.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(X=m_(Im.mark((function e(t){var r,n,i,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete(i=tG({},t)).audio,null===(r=i.video)||void 0===r||delete r.codec,null===(n=i.video)||void 0===n||delete n.gop,qK.checckUpdateParams(i),this._liveTranscodeConfig=tG(this._liveTranscodeConfig,i),e.prev=9,this.safeEmit(Kd.onStreamMixingEvent,{event:KF.UPDATE,error:0,message:""}),e.next=13,null===(o=this._room)||void 0===o?void 0:o.liveControlMessage(qK.getUpdateParams(this._liveTranscodeConfig));case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(9),!(e.t0 instanceof pR)){e.next=21;break}throw e.t0;case 21:throw new pR(lR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:case"end":return e.stop()}}),e,this,[[9,15]])}))),function(e){return X.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(K=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(Kd.onStreamMixingEvent,{event:KF.STOP,error:0,message:""}),e.next=8,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage({action:"stopped",type:"transcode"});case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof pR)){e.next=16;break}throw e.t0;case 16:throw new pR(lR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return K.apply(this,arguments)})},{key:"startSubtitle",value:(z=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("startSubtitle()","config: %o",t),this._assertNotInRoom(),e.next=4,null===(r=this._room)||void 0===r?void 0:r.startSubtitle(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return z.apply(this,arguments)})},{key:"stopSubtitle",value:function(){var e;JK.print("stopSubtitle()","invoke"),null===(e=this._room)||void 0===e||e.stopSubtitle()}},{key:"setBusinessId",value:function(e){return JK.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(OP.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(H=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("setUserVisibility()","enable: %o",t),t=!!t,this._visibility!==t){e.next=4;break}return e.abrupt("return");case 4:if(this._room){e.next=7;break}return this._visibility=t,e.abrupt("return");case 7:if(this._assertNotInRoom(),this._room.localStream&&(null===(n=this._room.localStream.observer)||void 0===n||n.setPublisher(t)),e.t0=!t,!e.t0){e.next=13;break}return e.next=13,this._room.unpublish();case 13:return e.next=15,this._room.updateUserAttributes({role:t?xK.NORMAL_USER:xK.SILENT_USER});case 15:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:Sd.AUDIO_AND_VIDEO});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"_initPlayerEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:gd.STREAM_INDEX_MAIN,i=n===gd.STREAM_INDEX_SCREEN;e.on("playback_event",(function(n){switch(n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type){var o=e.userId.replace("_screen","");r?t.safeEmit(Kd.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:o}):(t.safeEmit(Kd.onAudioFirstFrameDecoded,{userId:o,isScreen:i}),t.safeEmit(Kd.onRemoteAudioFirstFrame,{userId:o,isScreen:i})),CP.firstRemoteAudioRender("",o||"",{isScreen:i})}else{var a,s,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,isScreen:i};r?(c.publicStreamId=c.userId,delete c.userId,delete c.isScreen,t.safeEmit(Kd.onFirstPublicStreamVideoFrameRendered,c),t.safeEmit(Kd.onFirstPublicStreamVideoFrameDecoded,c)):e.isLocal||(t.safeEmit(Kd.onVideoFirstFrameRendered,c),t.safeEmit(Kd.onVideoFirstFrameDecoded,c),t.safeEmit(Kd.onRemoteVideoFirstFrame,c)),CP.firstRemoteVideoRender("",n.userId||"",{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),CP.rtcInvokeStatus(e instanceof wB?"video":"audio",0,"autoplay-error",n.userId||"",0),void t.safeEmit(Kd.onAutoplayFailed,{userId:n.userId,kind:e instanceof wB?"video":"audio",mediaType:e instanceof wB?Sd.VIDEO:Sd.AUDIO,streamIndex:e.isScreen?gd.STREAM_INDEX_SCREEN:gd.STREAM_INDEX_MAIN})}t.safeEmit(Kd.onPlayerEvent,n)}))}},{key:"_initLocalTrackEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(Kd.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t._extensionManager.getPluginsByType(EV.PRE_PROCESSING).forEach((function(t){var r;null==t||null===(r=t.applyConstraints)||void 0===r||r.call(t,e)})),t.safeEmit(Kd.onLocalVideoSizeChanged,{streamIndex:r?gd.STREAM_INDEX_SCREEN:gd.STREAM_INDEX_MAIN,info:e})}))}},{key:"_removeLocalTrackEvents",value:function(e){e.removeAllListeners("track-ended"),e.removeAllListeners("resolution-change")}},{key:"setRemoteVideoPlayer",value:function(e,t){JK.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),vw(e,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),Rw(t);var r,n,i,o=t.userId;if(e===gd.STREAM_INDEX_MAIN){var a,s,c;if(null===(a=this._remoteVideoPlayer.get(o))||void 0===a||a.destroy(),!t.renderDom)return;var u=new wB(t);this._initPlayerEvents(u,!1,e),this._remoteVideoPlayer.set(o,u);var d=null===(s=this._room)||void 0===s||null===(c=s.remoteStreams.get(o))||void 0===c?void 0:Nb(c).call(c,(function(e){return!e.isScreen}));return d&&this._updateVideoPlayerState(d),u.domElement}if(null===(r=this._remoteScreenPlayer.get(o))||void 0===r||r.destroy(),t.renderDom){var l=new wB(ud(ud({},t),{},{isScreen:!0}));this._remoteScreenPlayer.set(o,l),this._initPlayerEvents(l,!1,e);var h=null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(o))||void 0===i?void 0:Nb(i).call(i,(function(e){return e.isScreen}));return h&&this._updateVideoPlayerState(h),l.domElement}}},{key:"setLocalVideoMirrorType",value:function(e){JK.print("setLocalVideoMirrorType()","mirrorType: %o",e),vw(e,"mirrorType",[kd.MIRROR_TYPE_NONE,kd.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(G=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("setAudioPlaybackDevice()","deviceId: %s",t),fw(t,"deviceId"),e.next=4,this._audioDeviceManager.setSinkId(t);case 4:r=e.sent,this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._remoteScreenAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this.safeEmit(Kd.onAudioPlaybackDeviceChanged,r),CP.rtcAudioDevice(pP.PLAYOUT_DEVICE_SWITCH,t,0);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"play",value:(j=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=y.length>1&&void 0!==y[1]?y[1]:Sd.AUDIO_AND_VIDEO,a=y.length>2?y[2]:void 0,JK.print("play()","userId: %s, mediaType: %s, streamIndex: %s",t,o,a),s=!t||t===this._getUserId()||"local_user"===t,c=void 0===a||a===gd.STREAM_INDEX_MAIN,u=void 0===a||a===gd.STREAM_INDEX_SCREEN,d=o!==Sd.VIDEO,l=o!==Sd.AUDIO,h=[],s&&l&&(c&&this._localVideoTrack&&(null===(p=this._videoPlayer)||void 0===p||p.mirror(!!this._mirrorType),h.push(null===(f=this._videoPlayer)||void 0===f?void 0:f.playVideo(this._localVideoTrack))),u&&this._localScreenVideoTrack&&h.push(null===(v=this._screenPlayer)||void 0===v?void 0:v.playVideo(this._localScreenVideoTrack))),t===(null===(r=this._audioMixingManager)||void 0===r?void 0:r.id)&&h.push(this._audioMixingManager.resumeLocalPlay()),_=null===(n=this._room)||void 0===n?void 0:n.remoteStreams,l&&c&&h.push(OB(this._remoteVideoPlayer,t,!1,_)),l&&u&&h.push(OB(this._remoteScreenPlayer,t,!0,_)),d&&c&&h.push(OB(this._remoteAudioPlayer,t,!1,_)),l&&u&&h.push(OB(this._remoteScreenAudioPlayer,t,!0,_)),m=null===(i=this._publicStreamManager)||void 0===i?void 0:i.remoteStreams,d&&h.push(OB(this._publicStreamVideoPlayer,t,!1,m)),l&&h.push(OB(this._publicStreamAudioPlayer,t,!1,m)),e.abrupt("return",v_.all(h).then((function(){})));case 20:case"end":return e.stop()}}),e,this)}))),function(e){return j.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(B=m_(Im.mark((function e(t){var r,n,i,o,a,s=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),ZC(t)&&(s._pauseAllSubscribeState.audio=!0),$C(t)&&(s._pauseAllSubscribeState.video=!0),this._room){e.next=6;break}return e.abrupt("return",v_.resolve());case 6:n=[],i=ZT(nA(r=this._room.remoteStreams).call(r));try{for(i.s();!(o=i.n()).done;)a=o.value,Array.isArray(a)&&a.forEach((function(e){if(e.hasSubscribed){s._pauseAllSubscribeState.resumeStreamIds[e.streamId]=e.streamId;var r=s._unsubscribe(e.isScreen,e.userId,t,!0);r&&n.push(r)}}))}catch(c){i.e(c)}finally{i.f()}return e.abrupt("return",v_.all(n).then((function(){})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(F=m_(Im.mark((function e(t){var r,n,i,o,a,s=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),ZC(t)&&(s._pauseAllSubscribeState.audio=!1),$C(t)&&(s._pauseAllSubscribeState.video=!1),this._room){e.next=6;break}return e.abrupt("return",v_.resolve());case 6:n=[],i=ZT(nA(r=this._room.remoteStreams).call(r));try{for(i.s();!(o=i.n()).done;)a=o.value,Array.isArray(a)&&a.forEach((function(e){if(s._pauseAllSubscribeState.resumeStreamIds[e.streamId]){delete s._pauseAllSubscribeState.resumeStreamIds[e.streamId];var r=s._subscribe(e.isScreen,e.userId,t);r&&n.push(r)}}))}catch(c){i.e(c)}finally{i.f()}return e.abrupt("return",v_.all(n).then((function(){var e,t;null===(e=s._room)||void 0===e||null===(t=e.remoteStreams)||void 0===t||t.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){s._updateAudioPlayerState(e),s._updateVideoPlayerState(e)}))}))})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return F.apply(this,arguments)})},{key:"sendUserMessage",value:(V=m_(Im.mark((function e(t,r){var n,i,o,a=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kw(t),Cw(r),this._assertNotInRoom(),o=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!1,o,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!1,o,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return V.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(U=m_(Im.mark((function e(t,r){var n,i,o,a=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kw(t),yw(r,"message"),Cw(r),this._assertNotInRoom(),o=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return a._messageStatisticsObserver.countP2PMessage(!0,t,!0,o,e),e.id})).catch((function(e){throw a._messageStatisticsObserver.countP2PMessage(!1,t,!0,o,e),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return U.apply(this,arguments)})},{key:"sendRoomMessage",value:(L=m_(Im.mark((function e(t){var r,n,i,o=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Cw(t),this._assertNotInRoom(),i=Date.now(),e.abrupt("return",null===(r=this._room)||void 0===r||null===(n=r.sendRoomMessage(t))||void 0===n?void 0:n.then((function(e){var t,r;return o._messageStatisticsObserver.countRoomMessage(!0,null===(t=o._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!1,i),e})).catch((function(e){var t,r;throw o._messageStatisticsObserver.countRoomMessage(!1,null===(t=o._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!1,i),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(M=m_(Im.mark((function e(t){var r,n,i,o=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Cw(t),this._assertNotInRoom(),i=Date.now(),e.abrupt("return",null===(r=this._room)||void 0===r||null===(n=r.sendRoomMessage(t,!0))||void 0===n?void 0:n.then((function(e){var t,r;return o._messageStatisticsObserver.countRoomMessage(!0,null===(t=o._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!0,i),e})).catch((function(e){var t,r;throw o._messageStatisticsObserver.countRoomMessage(!1,null===(t=o._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!0,i),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(N=m_(Im.mark((function e(){var t,r=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=r.length>0&&void 0!==r[0]?r[0]:{},JK.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,gw(t),this._shouldUpdateAudioConf("setAudioCaptureConfig")&&this._audioProfileManager.updateConstraints(t);case 5:case"end":return e.stop()}}),e,this)}))),function(){return N.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(P=m_(Im.mark((function e(){var t,r=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:{},JK.print("setVideoCaptureConfig()","config: %o",t),e.abrupt("return",this._setVideoCaptureConfig(t));case 3:case"end":return e.stop()}}),e,this)}))),function(){return P.apply(this,arguments)})},{key:"_setVideoCaptureConfig",value:(D=m_(Im.mark((function e(){var t,r,n,i=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(delete(r=i.length>0&&void 0!==i[0]?i[0]:{}).deviceId,gw(r),n=ud(ud({},r),{},{deviceId:this._videoStreamConstraints.deviceId}),!this._localVideoTrack){e.next=7;break}return e.next=7,this._localVideoTrack.updateVideoCaptureConfig(n);case 7:return this._videoStreamConstraints=n,e.abrupt("return",(null===(t=this._localVideoTrack)||void 0===t?void 0:t.getTrack().getSettings())||{});case 9:case"end":return e.stop()}}),e,this)}))),function(){return D.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){var t;return JK.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,null!==(t=this._room)&&void 0!==t&&t.hasPublished&&ow("You must call this API before publishing the video streams"),!0}},{key:"setVideoEncoderConfig",value:(O=m_(Im.mark((function e(t){var r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(JK.print("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),Dw(t=Gs(t).call(t,(function(e){return!!e}))),t.length>3&&(ow("setVideoEncoderConfig: You can set parameters for up to 3 streams"),t=km(t).call(t,0,3)),n=1;n<t.length;n++)i=aw(t[0].width)/aw(t[n].width)||1,Math.floor(i)!==i&&ow("setVideoEncoderConfig: The resolution setting needs to be an integer multiple");BA(t).call(t,(function(e,t){return t.maxKbps-e.maxKbps})),this._setVideoCaptureConfig(ud({},t[0])),this._videoStreamEncodeConfig=t,this._updateDummyCaptureImage(gd.STREAM_INDEX_MAIN),null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 11:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(x=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:JK.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.updateVideoCaptureConfig(t),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),this._updateDummyCaptureImage(gd.STREAM_INDEX_SCREEN),null!==(r=this._room)&&void 0!==r&&r.hasScreenPublished&&this._updateScreenPublish();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){if(JK.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),!HL())throw new pR(lR.NOT_SUPPORTED,"Browser does not support sending SEI");vw(e,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),pw(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(xC.str2ab(t)):t;if(t.length){var i;if(e===gd.STREAM_INDEX_MAIN){var o,a,s;if(null===(o=this._room)||void 0===o||null===(a=o.localStream)||void 0===a||!a.hasPublished)return;i=null===(s=this._room)||void 0===s?void 0:s.localStream}else{var c,u,d;if(null===(c=this._room)||void 0===c||null===(u=c.localScreenStream)||void 0===u||!u.hasPublished)return;i=null===(d=this._room)||void 0===d?void 0:d.localScreenStream}if(n.byteLength>4096)JK.print("sei size must not bigger than 4KB");else{var l=AC();i.seiList.push({content:n,uuid:l,repeatCount:r}),setTimeout((function(){var e;if(i){var t,r=YA(e=i.seiList).call(e,(function(e){return e.uuid===l}));if(r)mk(t=i.seiList).call(t,r,1)}}),2e3)}}else JK.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;JK.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,n;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n;if(0!==e.length){var i=Nb(e).call(e,(function(e){return!1===e.isScreen})),o=null==i||null===(n=i.audioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t,volume:o||0})}}));var i=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t._getUserId(),volume:i||0}),t.safeEmit(Kd.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n=e[0],i=LE(t).call(t,(function(e,t){return e&&e.audioPropertiesInfo.nonlinearVolume>t.audioPropertiesInfo.nonlinearVolume?e:t}),void 0);if((r=n?i?n.audioPropertiesInfo.nonlinearVolume>i.audioPropertiesInfo.nonlinearVolume?n:i:n:i)&&r.audioPropertiesInfo.nonlinearVolume>-35){var o,a;if(r.streamKey)o=this._room.remoteUsers.get(r.streamKey.userId);else o=null===(a=this._room._roomInfo)||void 0===a?void 0:a.userInfo;o&&this.safeEmit(Kd.onActiveSpeaker,{userId:o.userId,extraInfo:o.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};JK.print("enableAudioPropertiesReport()","config %o: ",t);var r=t.enableInBackground,n=void 0===r||r,i=t.interval,o=void 0===i?100:i;this._stopAudioPropertiesReport(),o<=0||(o=Math.max(100,o),this._audioPropertiesReportTimer=self.setInterval((function(){if(n||"hidden"!==document.visibilityState){var t=[],r=e._audioDeviceManager.getRecordTrack()||e._localAudioTrack;if(r){var i=r.getAudioLevel();t.push({streamIndex:gd.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:JC(i)}})}if(e._localScreenAudioTrack){var o=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:gd.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:o,nonlinearVolume:JC(o)}})}if(e.safeEmit(Kd.onLocalAudioPropertiesReport,t),e._room){var a,s=[];if(null!==(a=e._room)&&void 0!==a&&a.multiChatMode)e._room.getActiveSpeakerInMultiChatMode().forEach((function(t){var r,n,i=255*t.audioLevel;s.push({streamKey:{userId:t.userId,streamIndex:gd.STREAM_INDEX_MAIN,roomId:null===(r=e._room)||void 0===r||null===(n=r._roomInfo)||void 0===n?void 0:n.roomId},audioPropertiesInfo:{linearVolume:i,nonlinearVolume:JC(i)}})}));else e._room.remoteStreams.forEach((function(t,r){t.forEach((function(t){if(t.audioTrack){var n,i,o=t.audioTrack.getAudioLevel();s.push({streamKey:{userId:r,streamIndex:t.isScreen?gd.STREAM_INDEX_SCREEN:gd.STREAM_INDEX_MAIN,roomId:null===(n=e._room)||void 0===n||null===(i=n.roomInfo)||void 0===i?void 0:i.roomId},audioPropertiesInfo:{linearVolume:o,nonlinearVolume:JC(o)}})}}))}));e.safeEmit(Kd.onRemoteAudioPropertiesReport,s),e._sendActiveSpeaker(t,Gs(s).call(s,(function(e){return e.streamKey.streamIndex!==gd.STREAM_INDEX_SCREEN})))}}}),o))}},{key:"setVideoSourceType",value:(w=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),vw(t,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),vw(r,"VideoSourceType",[dd.VIDEO_SOURCE_TYPE_EXTERNAL,dd.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===gd.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,JK.print("setVideoSourceType",xm(i="set ".concat(n," source type to ")).call(i,r)),!this._localVideoTrack||t!==gd.STREAM_INDEX_MAIN){e.next=17;break}if(c=!1,r===dd.VIDEO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),null===(o=this._videoPlayer)||void 0===o||o.stop(),this._localVideoTrack=void 0,u=null===(a=this._room)||void 0===a?void 0:a._roomConfig.isAutoPublish,c?null===(d=this._room)||void 0===d||null===(l=d.localStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setEnableVideo(!1):null===(p=this._room)||void 0===p||null===(f=p.localStream)||void 0===f||null===(v=f.observer)||void 0===v||v.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||u)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==gd.STREAM_INDEX_SCREEN){e.next=26;break}if(y=!1,r===dd.VIDEO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(_=this._screenPlayer)||void 0===_||_.stop(),this._localScreenVideoTrack=void 0,y?null===(g=this._room)||void 0===g||null===(S=g.localScreenStream)||void 0===S||null===(E=S.observer)||void 0===E||E.setEnableVideo(!1):null===(b=this._room)||void 0===b||null===(k=b.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushVideo(!1),null===(m=this._room)||void 0===m||!m.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(C=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("setExternalVideoTrack()","index: %o, track: %o",t,r),vw(t,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),_w(r),t!==gd.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.video===dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,ZV(r,this._extensionManager);case 8:if(this._localVideoTrack=e.sent,this._initLocalTrackEvents(this._localVideoTrack),null===(n=this._videoPlayer)||void 0===n||n.playVideo(this._localVideoTrack),a=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(o=this._room)&&void 0!==o&&o.hasPublished||a)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==gd.STREAM_INDEX_SCREEN){e.next=27;break}if(this._trackSourceType.screenVideo===dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 18:return e.next=20,rF(r,this._extensionManager);case 20:if(this._localScreenVideoTrack=e.sent,this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(s=this._screenPlayer)||void 0===s||s.playVideo(this._localScreenVideoTrack),null===(c=this._room)||void 0===c||null===(u=c.localScreenStream)||void 0===u||null===(d=u.observer)||void 0===d||d.setPushVideo(!0),null===(l=this._room)||void 0===l||!l.hasScreenPublished){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"setAudioSourceType",value:(R=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),vw(t,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),vw(r,"audioSourceType",[ld.AUDIO_SOURCE_TYPE_EXTERNAL,ld.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===gd.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,JK.print("setVideoSourceType",xm(i="set ".concat(n," source type to ")).call(i,r)),!this._localAudioTrack||t!==gd.STREAM_INDEX_MAIN){e.next=16;break}if(s=!1,this._trackSourceType.audio===ld.AUDIO_SOURCE_TYPE_EXTERNAL&&(s=!0,this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,c=null===(o=this._room)||void 0===o?void 0:o._roomConfig.isAutoPublish,s?null===(u=this._room)||void 0===u||null===(d=u.localStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setEnableAudio(!1):null===(h=this._room)||void 0===h||null===(p=h.localStream)||void 0===p||null===(f=p.observer)||void 0===f||f.setPushAudio(!1),!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||c)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==gd.STREAM_INDEX_SCREEN){e.next=24;break}if(_=!1,this._trackSourceType.audio===ld.AUDIO_SOURCE_TYPE_EXTERNAL&&(_=!0,this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,_?null===(m=this._room)||void 0===m||null===(y=m.localScreenStream)||void 0===y||null===(g=y.observer)||void 0===g||g.setEnableAudio(!1):null===(S=this._room)||void 0===S||null===(E=S.localScreenStream)||void 0===E||null===(b=E.observer)||void 0===b||b.setPushAudio(!1),null===(v=this._room)||void 0===v||!v.hasScreenPublished){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(A=m_(Im.mark((function e(t,r){var n,i,o,a,s,c,u,d,l,h;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("setExternalAudioTrack()","index: %o, track: %o",t,r),vw(t,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),_w(r),t!==gd.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.audio===ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,eF(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._initLocalTrackEvents(this._localAudioTrack),c=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,null===(i=this._room)||void 0===i||null===(o=i.localStream)||void 0===o||null===(a=o.observer)||void 0===a||a.setPushAudio(!0),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||c)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==gd.STREAM_INDEX_SCREEN){e.next=26;break}if(this._trackSourceType.screenAudio===ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 18:return e.next=20,iF(r,this._extensionManager);case 20:if(this._localScreenAudioTrack=e.sent,this._initLocalTrackEvents(this._localScreenAudioTrack),null===(u=this._room)||void 0===u||null===(d=u.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushAudio(!0),null===(h=this._room)||void 0===h||!h.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"login",value:(I=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("login()","token: %o, userInfo: %o",t,r),Ew(t)||fw(t,"token"),kw(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"logout",value:(T=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return T.apply(this,arguments)})},{key:"updateLoginToken",value:(k=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("updateLoginToken()","token: %o",t),Ew(t)||fw(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(b=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("getPeerOnlineStatus()","userId: %o",t),kw(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(E=m_(Im.mark((function e(t,r){var n,i=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kw(t),Cw(r),n=Date.now(),e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!1,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(S=m_(Im.mark((function e(t,r){var n,i=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kw(t),yw(r,"message"),Cw(r),n=Date.now(),e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!0,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"setServerParams",value:(g=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("setServerParams()","signature: %o, url: %0",t,r),e.abrupt("return",this._rtmClient.setServerParams(t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"sendServerMessage",value:(y=m_(Im.mark((function e(t){var r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fw(t,"message"),Cw(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(e){n._messageStatisticsObserver.countServerMessage(!0,!1,r,e)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!1,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(m=m_(Im.mark((function e(t){var r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return yw(t,"message"),Cw(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(e){n._messageStatisticsObserver.countServerMessage(!0,!0,r,e)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!0,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new pR(lR.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");JK.print("startCloudProxy()",e),fw(e.logProxy,"logProxy"),fw(e.accessProxy,"accessProxy"),fw(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=rN("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=rN("LOG_SERVER_URL"),this._originConfigServerUrls=rN("CONFIG_REQUEST_DOMAINS"),tN("ICE_CONFIG_REQUEST_URLS",e.accessProxy),tN("LOG_SERVER_URL",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/video/v1/webrtc_log/")}(e.logProxy)),tN("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new pR(lR.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");JK.print("stopCloudProxy()"),tN("ICE_CONFIG_REQUEST_URLS",[]),tN("LOG_SERVER_URL",this._originLogServerUrl),tN("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(_=m_(Im.mark((function e(t,r){var n,i,o,a=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),Tw(t),this._assertNotInRoom(),!this._publicStreamIds.get(t)){e.next=5;break}throw new pR(lR.REPEAT_PUSH,"repeat push public media stream");case 5:return o=nN(t,"started",r),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.publicStreamControlMessage(o))||void 0===i?void 0:i.then((function(){a._publicStreamIds.set(t,t)})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(v=m_(Im.mark((function e(t,r){var n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),Tw(t),this._assertNotInRoom(),i=nN(t,"layoutChanged",r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.publicStreamControlMessage(i));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"stopPushPublicStream",value:(f=m_(Im.mark((function e(t){var r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("startPushPublicStream()","publicStreamId: %o",t),Tw(t),this._assertNotInRoom(),e.abrupt("return",null===(r=this._room)||void 0===r?void 0:r.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:t}).then((function(){n._publicStreamIds.delete(t)})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"startPlayPublicStream",value:(p=m_(Im.mark((function e(t){var r,n,i,o,a,s,c=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Tw(t),this._publicStreamManager){e.next=8;break}return this._publicStreamManager=new PK(this.id,this._appId,{businessId:this._businessId}),this._publicStreamManager.on(zF.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=c._publicStreamAudioPlayer.get(t.streamId);n&&t.audioTrack&&(n.stop(),n.playAudio(null===(r=e.stream)||void 0===r?void 0:r.audioTrack));var i,o=c._publicStreamVideoPlayer.get(t.streamId);o&&t.videoTrack&&o.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._publicStreamManager)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,c.safeEmit(Kd.onPublicStreamStats,e)})),null===(n=this._publicStreamManager)||void 0===n||n.on(zF.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(Kd.onPublicStreamSEIMessageReceived,e)})),e.next=8,this._publicStreamManager.connect();case 8:return e.next=10,this._publicStreamManager.startPlayPublicStream(t);case 10:i=e.sent,(o=this._publicStreamVideoPlayer.get(t))&&null!=i&&i.videoTrack&&o.playVideo(i.videoTrack,i),!(a=this._publicStreamAudioPlayer.get(t))&&null!=i&&i.audioTrack&&(a=new xB(t,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===Nd.VIDEO_ONLY,isScreen:!1}),this._initPlayerEvents(a,!0),a.playAudio(i.audioTrack),this._publicStreamAudioPlayer.set(t,a));case 15:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(h=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._publicStreamManager){e.next=2;break}return e.abrupt("return");case 2:this._publicStreamManager.stopPlayPublicStream(t),(r=this._publicStreamAudioPlayer.get(t))&&(r.destroy(),this._publicStreamAudioPlayer.delete(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"setAudioProfile",value:(l=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:JK.print("setAudioProfile()","profile: %o",t),this._shouldUpdateAudioConf("setAudioProfile")&&this._audioProfileManager.setAudioProfile(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,i,o;JK.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var a=this._publicStreamVideoPlayer.get(e);if(null===(r=a)||void 0===r||r.destroy(),null!=t&&t.renderDom){a=new wB(ud(ud({},t),{},{userId:e})),this._initPlayerEvents(a,!0),this._publicStreamVideoPlayer.set(e,a);var s=null===(n=this._publicStreamManager)||void 0===n||null===(i=n.remoteStreams)||void 0===i?void 0:i.get(e);null!=s&&s.videoTrack&&(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&a.playVideo(s.videoTrack,s)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(d=m_(Im.mark((function e(t,r){var n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new v_((function(e,i){fw(r,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=r,o.onload=function(){t===gd.STREAM_INDEX_MAIN?n._dummyMainImage=o:n._dummyScreenImage=o;try{n._updateDummyCaptureImage(t),e()}catch(r){i(new pR(lR.UNEXPECTED_ERROR,r.message))}},o.onerror=function(){i(new pR(lR.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return d.apply(this,arguments)})},{key:"_updateDummyCaptureImage",value:function(e){var t,r;if(e===gd.STREAM_INDEX_MAIN?(t=this._dummyMainImage,r=this._videoStreamEncodeConfig[0]):(t=this._dummyScreenImage,r=this._screenStreamEncodeConfig[0]),t){var n,i,o=document.createElement("canvas"),a=o.getContext("2d"),s=aw(r.width),c=aw(r.height);if(!a)throw new pR(lR.UNEXPECTED_ERROR,"Not support canvas");!s||!c||t.width<=s&&t.height<=c?(n=t.width,i=t.height):(n=Math.min(s,t.width*c/t.height),i=Math.min(c,t.height*s/t.width)),o.width=n,o.height=i,a.drawImage(t,0,0,t.width,t.height,0,0,n,i);var u=window.setInterval((function(){t&&a.drawImage(t,0,0,t.width,t.height,0,0,n,i)}),200);e===gd.STREAM_INDEX_MAIN?(clearInterval(this._dummyMainTimer),this._dummyMainTimer=u):(clearInterval(this._dummyScreenTimer),this._dummyScreenTimer=u);var d,l,h,p,f=o.captureStream(5).getVideoTracks()[0];if(e===gd.STREAM_INDEX_MAIN){if(this._localImgVideoTrack=f,null!==(d=this._localVideoTrack)&&void 0!==d&&d.dummy)null===(l=this._localVideoTrack)||void 0===l||l.setTrack(this._localImgVideoTrack,this._extensionManager)}else if(this._localImgScreenTrack=f,null!==(h=this._localScreenVideoTrack)&&void 0!==h&&h.dummy)null===(p=this._localScreenVideoTrack)||void 0===p||p.setTrack(this._localImgScreenTrack,this._extensionManager)}}},{key:"_addListenExtensionEvent",value:function(e){var t=this;e.on("re-capture-audio",(function(){t._localAudioTrack&&t.stopAudioCapture().then((function(){t.startAudioCapture()}))})),e.on("re-capture-video",(function(){t._localVideoTrack&&!t._localVideoTrack.dummy&&t.stopVideoCapture().then((function(){t.startVideoCapture()}))}))}},{key:"registerExtension",value:(u=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor=CP,t.isSupported()){e.next=3;break}throw new Error("This extension is not supported.");case 3:return e.next=5,t.init();case 5:this._extensionManager.register(t),this._addListenExtensionEvent(t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(ny(qK.getDefaultValue()))}},{key:"_updatePublish",value:(c=m_(Im.mark((function e(){var t,r,n,i=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},JK.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:XF.PUB},t=ud(ud({},r),t),this._visibility){e.next=6;break}throw new pR(lR.NO_PUBLISH_PERMISSION,"no publish permission");case 6:return e.next=8,this._pubLock.lock();case 8:if(n=e.sent,this._room&&this._room.connectionState===eB.CONNECTED){e.next=12;break}return n(),e.abrupt("return");case 12:return e.prev=12,e.next=15,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,t.mediaType,t.pubState,t.invokeByJoinRoom);case 15:e.next=24;break;case 17:if(e.prev=17,e.t0=e.catch(12),!(e.t0 instanceof pR)){e.next=23;break}throw e.t0;case 23:throw new pR(lR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 24:return e.prev=24,n(),e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[12,17,24,27]])}))),function(){return c.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(s=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),fw(t,"filePath"),pw(r,"indicationInterval"),e.next=5,this._audioDeviceManager.startAudioPlaybackDeviceTest(t,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){JK.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(a=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return JK.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),pw(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t,r);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){JK.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){JK.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;JK.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{kw(e),vw(t,"priority",[wd.HIGH,wd.MEDIUM,wd.LOW])}catch(n){return console.warn(n),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.updateRemoteUserPriority(e),!0}},{key:"takeLocalSnapshot",value:(o=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("takeLocalSnapshot()","streamIndex: %o",t),vw(t,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),r=t===gd.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new pR(lR.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===gd.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",FK(r.getTrack("preprocessing"),(null==n?void 0:n.mirrorType)===kd.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(i=m_(Im.mark((function e(t,r){var n,i,o,a,s,c;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(JK.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),fw(t,"id"),vw(r,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),c=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(o=Nb(i).call(i,(function(e){return e.isScreen===(r===gd.STREAM_INDEX_SCREEN)})))||void 0===o?void 0:o.videoTrack)||(null===(a=this._publicStreamManager)||void 0===a||null===(s=a.remoteStreams.get(t))||void 0===s?void 0:s.videoTrack)){e.next=6;break}throw new pR(lR.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",FK(c.getTrack(),!1,r===gd.STREAM_INDEX_MAIN?this._remoteVideoPlayer.get(t):this._remoteScreenPlayer.get(t)));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){JK.print("setSubscribeFallbackOption()","option: %o",e);try{vw(e,"option",[Cd.DISABLE,Cd.VIDEO_STREAM_LOW,Cd.AUDIO_ONLY])}catch(t){return console.warn(t),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)}},{key:"getLocalStreamTrack",value:function(e,t){var r,n,i,o=this;if(e===gd.STREAM_INDEX_MAIN?(n="video"===t?this.localVideoTrack:this.localAudioTrack,i=function(){var e;return null===(e=o._room)||void 0===e?void 0:e.localStream}):(n="video"===t?this.localScreenVideoTrack:this.localScreenAudioTrack,i=function(){var e;return null===(e=o._room)||void 0===e?void 0:e.localScreenStream}),n){var a=n instanceof aF&&n.mixedAudioTrack?n.mixedAudioTrack:n.getTrack("preprocessing");if(a){var s=i();return this._reportMsTrackEvent(a,(null==s||null===(r=s.stream)||void 0===r?void 0:r.id)||"local"),a}}}},{key:"getRemoteStreamTrack",value:function(e,t,r){var n,i,o=(null===(n=this._room)||void 0===n?void 0:n.remoteStreams.get(e))||[];if(o&&o.length){var a,s,c,u,d;if(t===gd.STREAM_INDEX_MAIN)a=Nb(o).call(o,(function(e){return!e.isScreen})),i="video"===r?null===(s=a)||void 0===s?void 0:s.videoTrack:null===(c=a)||void 0===c?void 0:c.audioTrack;else a=Nb(o).call(o,(function(e){return e.isScreen})),i="video"===r?null===(u=a)||void 0===u?void 0:u.videoTrack:null===(d=a)||void 0===d?void 0:d.audioTrack;if(i){var l=i.getTrack();if(l&&a){var h=a.streamId;return this._reportMsTrackEvent(l,h),l}}}}},{key:"getPublicStreamTrack",value:function(e,t){if(this._publicStreamManager&&this._publicStreamManager.remoteStreams){var r=this._publicStreamManager.remoteStreams.get(e);if(r){var n="video"===t?r.videoTrack:r.audioTrack;if(n){var i=n.getTrack();if(i){var o=r.streamId;return this._reportMsTrackEvent(i,o),i}}}}}},{key:"setRemoteStreamRenderSync",value:function(e){return!this._room&&(this._avSync=!!e,!0)}},{key:"_reportMsTrackEvent",value:function(e,t){if(!e.hookStop){e.hookStop=!0;var r=e.stop;e.stop=function(){CP.rtcInvokeStatus(t,0,"stop",t||"",0),r.call(e)}}}},{key:"_updateScreenPublish",value:(n=m_(Im.mark((function e(){var t,r,n,i=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:{},JK.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:XF.PUB},t=ud(ud({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===eB.CONNECTED){e.next=10;break}return n(),e.abrupt("return");case 10:return e.prev=10,e.next=13,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,t.mediaType,t.pubState);case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(10),!(e.t0 instanceof pR)){e.next=21;break}throw e.t0;case 21:throw new pR(lR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:return e.prev=22,n(),e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[10,15,22,25]])}))),function(){return n.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){JK.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen,i=n?this._remoteScreenAudioPlayer:this._remoteAudioPlayer,o=i.get(r);if(e.audioTrack&&(e.attributes.audiostream&&e.subAudio||this.multiChatMode)){var a;if(!o){var s;o=new xB(r,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===Nd.VIDEO_ONLY,isScreen:n}),this._initPlayerEvents(o,!1,n?gd.STREAM_INDEX_SCREEN:gd.STREAM_INDEX_MAIN),i.set(r,o);var c=this._audioDeviceManager.getSinkId();c&&o.setPlaybackDevice(c)}(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&o.playAudio(e.audioTrack),NC&&jC&&(t=this._remoteAudioPlayer,KK&&clearTimeout(KK),KK=setTimeout((function(){var e,r=ZT(t);try{for(r.s();!(e=r.n()).done;){var n=$T(e.value,2),i=n[0],o=n[1];null!=i&&dR(i).call(i,"mux")&&o.pause()}}catch(l){r.e(l)}finally{r.f()}var a,s=ZT(t);try{for(s.s();!(a=s.n()).done;){var c=$T(a.value,2),u=c[0],d=c[1];null!=u&&dR(u).call(u,"mux")&&d.manuallyPlay()}}catch(l){s.e(l)}finally{s.f()}}),2e3))}else{var u;null===(u=o)||void 0===u||u.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;JK.print("_updateVideoPlayerState()");var r,n,i=e.userId;if(r=e.isScreen?this._remoteScreenPlayer.get(i):this._remoteVideoPlayer.get(i),e.videoTrack)r&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&r.playVideo(e.videoTrack,e);else if(null!==(t=r)&&void 0!==t&&t.played){var o;null===(o=r)||void 0===o||o.stop()}}},{key:"_onAddStream",value:(r=m_(Im.mark((function e(t){var r,n,i,o,a,s,c,u;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.stream,n=null==r?void 0:r.attributes,i=n.localaudio,o=n.audiostream,a=n.localvideo,s=n.videostream,c=sF.NONE,o&&(c|=Sd.AUDIO),s&&(c|=Sd.VIDEO),!c){e.next=11;break}return e.next=8,new v_((function(e){return setTimeout(e)}));case 8:null!=r&&r.isScreen?this.safeEmit(Kd.onUserPublishScreen,{userId:r.userId,mediaType:c}):(this.safeEmit(Kd.onUserPublishStream,{userId:r.userId,mediaType:c,videoStreamDescriptions:null==r||null===(u=r.attributes)||void 0===u?void 0:u.videoDescriptions}),this._handleAutoSubscribe(r,!0)),this.safeEmit("onAddStream",{userId:r.userId,mediaType:c,isScreen:!(null==r||!r.isScreen)}),null!=r&&r.isScreen||(i&&this.safeEmit(Kd.onUserStartAudioCapture,{userId:r.userId}),a&&this.safeEmit(Kd.onUserStartVideoCapture,{userId:r.userId}));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=sF.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=Sd.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=Sd.VIDEO),i){var o,a;if(t&&ZC(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeAudio(!0);if(t&&$C(i))null===(a=e.observer)||void 0===a||a.setAutoSubscribeVideo(!0);this._subscribe(!1,e.userId,i)}}},{key:"_onRemoveStream",value:function(e){var t,r=this,n=e.stream,i=null!==(t=rX[e.reason])&&void 0!==t?t:Ed.STREAM_REMOVE_REASON_OTHER,o=n.isScreen?Kd.onUserUnpublishScreen:Kd.onUserUnpublishStream,a=sF.NONE;n.attributes.audiostream&&(a|=Sd.AUDIO),n.attributes.videostream&&(a|=Sd.VIDEO),a!==sF.NONE&&(this.safeEmit(o,{userId:n.userId,mediaType:a,reason:i}),this.safeEmit("onRemoveStream",{userId:n.userId,isScreen:n.isScreen})),this._getRemotePlayer(n.userId,n.isScreen).forEach((function(e){var t=n.isScreen?"".concat(n.userId,"_screen"):n.userId;r._remoteAudioPlayer.delete(t),n.isScreen?r._remoteScreenPlayer.delete(n.userId):r._remoteVideoPlayer.delete(n.userId),null==e||e.destroy()}))}},{key:"_onUserConnection",value:function(e){var t=this;setTimeout((function(){return t.safeEmit(Kd.onUserJoined,e)}))}},{key:"_onUserLeave",value:function(e){this.safeEmit(Kd.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(Kd.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0}},{key:"_onNetworkQuality",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this.safeEmit.apply(this,xm(e=[Kd.onNetworkQuality]).call(e,r))}},{key:"_onConnectionStateChange",value:function(e){if(void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===bd.CONNECTION_STATE_CONNECTED&&this.safeEmit(Kd.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(Kd.onConnectionStateChanged,e),e.state===bd.CONNECTION_STATE_RECONNECTING){var t,r=ZT(this._remoteAudioPlayer);try{for(r.s();!(t=r.n()).done;){var n=$T(t.value,2),i=n[0],o=n[1];null!=i&&dR(i).call(i,"mux")&&o.stop()}}catch(a){r.e(a)}finally{r.f()}}}},{key:"_getRemotePlayer",value:function(e,t){return[(t?this._remoteScreenAudioPlayer:this._remoteAudioPlayer).get(e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]}},{key:"_stopAudioPropertiesReport",value:function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)}},{key:"_onResubscribe",value: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))}},{key:"_onSubscribePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onRemovePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onVideoDeviceStateChange",value:function(e){this.safeEmit(Kd.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(Kd.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t,r=this,n=e.userId,i=e.isScreen,o=e.mediaType,a=e.pubState,s=e.remoteStream,c={userId:n,mediaType:o};(o&Sd.AUDIO&&setTimeout((function(){r._updateAudioPlayerState(s)})),i)?a===XF.PUB?this.safeEmit(Kd.onUserPublishScreen,c):this.safeEmit(Kd.onUserUnpublishScreen,ud(ud({},c),{},{reason:Ed.STREAM_REMOVE_REASON_UNPUBLISH})):a===XF.PUB?(c.videoStreamDescriptions=null==s||null===(t=s.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(Kd.onUserPublishStream,c),this._handleAutoSubscribe(s,!0)):this.safeEmit(Kd.onUserUnpublishStream,ud(ud({},c),{},{reason:Ed.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(Kd.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(Kd.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Kd.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Kd.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(Kd.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(Kd.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(Kd.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(Kd.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Kd.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Kd.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(Kd.onError,{errorCode:lR.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(Kd.onError,{errorCode:lR.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(Kd.onServerParamsSetResult,null==e?void 0:e.code)}))}},{key:"waitForNewToken",get:function(){return!!this._tempRoomInfo}},{key:"localAudioTrack",get:function(){return this._localAudioTrack}},{key:"localVideoTrack",get:function(){return this._localVideoTrack}},{key:"localScreenAudioTrack",get:function(){return this._localScreenAudioTrack}},{key:"localScreenVideoTrack",get:function(){return this._localScreenVideoTrack}},{key:"remoteStreams",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteStreams&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))})));return r}},{key:"iceState",get:function(){var e,t,r,n;return null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||null===(r=t.handler)||void 0===r||null===(n=r._peerConnection)||void 0===n?void 0:n.iceConnectionState}},{key:"remoteUsers",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteUsers&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})})));return r}},{key:"multiChatMode",get:function(){var e,t;return!(null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||!t.roomAttributes.multiChatMode)}},{key:"_handleAudioDeviceManager",value:function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(Kd.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==eB.CONNECTED)throw new pR(lR.NOT_CONNECTED_YET,"server not connected")}},{key:"_checkMediaType",value:function(e){vw(e,"mediaType",[Sd.AUDIO,Sd.VIDEO,Sd.AUDIO_AND_VIDEO])}},{key:"_getUserId",value:function(){var e,t;return(null===(e=this._room)||void 0===e||null===(t=e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"}},{key:"_switchTrack",value:(t=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._initLocalTrackEvents(t),this._localVideoTrack=t,null!==(r=this._videoPlayer)&&void 0!==r&&r.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(t),this._videoPlayer.mirror(!!this._mirrorType)),null===(n=this._room)||void 0===n||!n.hasPublished){e.next=6;break}return e.next=6,this._updatePublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_shouldUpdateAudioConf",value:function(e){var t,r=(null===(t=this._room)||void 0===t?void 0:t.hasPublished)||this._localAudioTrack&&this._localAudioTrack.sourceType===kV.INTERNAL;if(r){var n="engine.".concat(e," should be called before publishing or capturing.");console.warn("[RTC WebSDK]: "+n),BP(e,n)}return!r}}]),_e}(ex),sd(XK,"GUID",1),XK),$K=ZK;QK([VP()],$K.prototype,"updateToken",1),QK([VP()],$K.prototype,"setVideoCaptureDevice",1),QK([VP()],$K.prototype,"setAudioCaptureDevice",1),QK([VP()],$K.prototype,"joinRoom",1),QK([VP()],$K.prototype,"leaveRoom",1),QK([VP()],$K.prototype,"destroy",1),QK([VP()],$K.prototype,"publishStream",1),QK([VP()],$K.prototype,"unpublishStream",1),QK([VP()],$K.prototype,"publishScreen",1),QK([VP()],$K.prototype,"unpublishScreen",1),QK([VP()],$K.prototype,"subscribeStream",1),QK([VP()],$K.prototype,"unsubscribeStream",1),QK([VP()],$K.prototype,"subscribeScreen",1),QK([VP()],$K.prototype,"unsubscribeScreen",1),QK([VP()],$K.prototype,"setRemoteVideoConfig",1),QK([VP()],$K.prototype,"startVideoCapture",1),QK([VP()],$K.prototype,"stopVideoCapture",1),QK([VP()],$K.prototype,"startAudioCapture",1),QK([VP()],$K.prototype,"stopAudioCapture",1),QK([VP()],$K.prototype,"getAudioMixingManager",1),QK([VP()],$K.prototype,"startScreenCapture",1),QK([VP()],$K.prototype,"stopScreenCapture",1),QK([VP()],$K.prototype,"setLocalVideoPlayer",1),QK([VP()],$K.prototype,"startLiveTranscoding",1),QK([VP()],$K.prototype,"updateLiveTranscoding",1),QK([VP()],$K.prototype,"stopLiveTranscoding",1),QK([VP()],$K.prototype,"startSubtitle",1),QK([VP()],$K.prototype,"stopSubtitle",1),QK([VP()],$K.prototype,"setBusinessId",1),QK([VP()],$K.prototype,"setUserVisibility",1),QK([VP()],$K.prototype,"setRemoteVideoPlayer",1),QK([VP()],$K.prototype,"setLocalVideoMirrorType",1),QK([VP()],$K.prototype,"setAudioPlaybackDevice",1),QK([VP()],$K.prototype,"play",1),QK([VP()],$K.prototype,"pauseAllSubscribedStream",1),QK([VP()],$K.prototype,"resumeAllSubscribedStream",1),QK([VP()],$K.prototype,"sendUserMessage",1),QK([VP()],$K.prototype,"sendUserBinaryMessage",1),QK([VP()],$K.prototype,"sendRoomMessage",1),QK([VP()],$K.prototype,"sendRoomBinaryMessage",1),QK([VP()],$K.prototype,"setAudioCaptureConfig",1),QK([iw("4.51"),VP()],$K.prototype,"setVideoCaptureConfig",1),QK([VP()],$K.prototype,"enableSimulcastMode",1),QK([VP()],$K.prototype,"setVideoEncoderConfig",1),QK([VP()],$K.prototype,"setScreenEncoderConfig",1),QK([VP()],$K.prototype,"sendSEIMessage",1),QK([iw("4.42"),VP()],$K.prototype,"setAudioVolumeIndicationInterval",1),QK([VP()],$K.prototype,"enableAudioPropertiesReport",1),QK([VP()],$K.prototype,"setVideoSourceType",1),QK([VP()],$K.prototype,"setExternalVideoTrack",1),QK([VP()],$K.prototype,"setAudioSourceType",1),QK([VP()],$K.prototype,"setExternalAudioTrack",1),QK([VP("rtm")],$K.prototype,"login",1),QK([VP("rtm")],$K.prototype,"logout",1),QK([VP("rtm")],$K.prototype,"updateLoginToken",1),QK([VP("rtm")],$K.prototype,"getPeerOnlineStatus",1),QK([VP("rtm")],$K.prototype,"sendUserMessageOutsideRoom",1),QK([VP("rtm")],$K.prototype,"sendUserBinaryMessageOutsideRoom",1),QK([VP("rtm")],$K.prototype,"setServerParams",1),QK([VP("rtm")],$K.prototype,"sendServerMessage",1),QK([VP("rtm")],$K.prototype,"sendServerBinaryMessage",1),QK([VP()],$K.prototype,"startCloudProxy",1),QK([VP()],$K.prototype,"stopCloudProxy",1),QK([VP()],$K.prototype,"startPushPublicStream",1),QK([VP()],$K.prototype,"updatePublicStreamParam",1),QK([VP()],$K.prototype,"stopPushPublicStream",1),QK([VP("outsideRoom","streamId")],$K.prototype,"startPlayPublicStream",1),QK([VP("outsideRoom","streamId")],$K.prototype,"stopPlayPublicStream",1),QK([VP()],$K.prototype,"setAudioProfile",1),QK([VP("outsideRoom")],$K.prototype,"setPublicStreamVideoPlayer",1),QK([VP()],$K.prototype,"setDummyCaptureImagePath",1),QK([VP()],$K.prototype,"registerExtension",1),QK([VP()],$K.prototype,"startAudioPlaybackDeviceTest",1),QK([VP()],$K.prototype,"stopAudioPlaybackDeviceTest",1),QK([VP()],$K.prototype,"startAudioDeviceRecordTest",1),QK([VP()],$K.prototype,"stopAudioDeviceRecordAndPlayTest",1),QK([VP()],$K.prototype,"stopAudioDevicePlayTest",1),QK([VP()],$K.prototype,"setRemoteUserPriority",1),QK([VP()],$K.prototype,"takeLocalSnapshot",1),QK([VP()],$K.prototype,"takeRemoteSnapshot",1),QK([VP()],$K.prototype,"setSubscribeFallbackOption",1),QK([VP()],$K.prototype,"getLocalStreamTrack",1),QK([VP()],$K.prototype,"getRemoteStreamTrack",1),QK([VP()],$K.prototype,"getPublicStreamTrack",1),QK([VP()],$K.prototype,"setRemoteStreamRenderSync",1);var eX,tX,rX={"client unpublished":Ed.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":Ed.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":Ed.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":Ed.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":Ed.STREAM_REMOVE_REASON_REPUBLISH};function nX(e){var t=YP.getServerConfig(e).web_rtc_config;return!(null==t||!t.fallback)||!!rN("ENABLE_FALLBACK_HANDLER")}var iX=new Jw("VERTC",0);qw.storeKey=xm(eX="".concat(Date.now(),"-")).call(eX,YP.getDeviceId()),[OP,DP,PP].forEach((function(e){var t;return e.setStats({rtc_sdk_version:eN.VERSION,product_line:zD.RTC,report_version:KD.W_5,os:XD.WEB,device_id:YP.getDeviceId(),log_cache_key:qw.storeKey,user_agent:wC()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})}));var oX=function(e,t){return iX.print("createEngine","Invoke VERTC.createEngine"),fw(e,"appId"),[OP,DP,PP].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),CP.sdkInitEngine(Date.now(),yP.BEGIN),new $K(e,t)},aX=function(e){if(iX.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof $K))throw new pR(lR.INVALID_ENGINE,"Invalid engine object");e.destroy(),CP.sdkInitEngine(Date.now(),yP.END)},sX=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",mV.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),cX=function(){var e=m_(Im.mark((function e(){var t,r,n,i,o,a,s=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]?s[0]:{video:!0,audio:!0},r=t.video,n=t.audio,i={video:!1,audio:!1},!r){e.next=13;break}return e.prev=4,e.next=7,mV.getPermissions({video:!0,force:!0});case 7:o=e.sent,i.video=o.video,e.next=13;break;case 11:e.prev=11,e.t0=e.catch(4);case 13:if(!n){e.next=23;break}return e.prev=14,e.next=17,mV.getPermissions({audio:!0,force:!0});case 17:a=e.sent,i.audio=a.audio,e.next=23;break;case 21:e.prev=21,e.t1=e.catch(14);case 23:return e.abrupt("return",i);case 24:case"end":return e.stop()}}),e,null,[[4,11],[14,21]])})));return function(){return e.apply(this,arguments)}}(),uX=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",mV.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),dX=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",mV.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),lX=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",mV.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),hX=function(){return eN.VERSION},pX=function(){return CP.rtcSdkApiCall("isSupported",0,""),OL()},fX=function(){return CP.rtcSdkApiCall("getSupportedCodecs",0,""),PL()},vX=function(e){var t=e.logLevel,r=e.LogfileSize;t&&(qw.logLevel=t),r&&(qw.LogfileSize=r)},_X=function(e){qw.download(e)};function mX(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return ny(uy(t).call(t,(function(e){return e instanceof $K?"[ENGINE]":e})))}function yX(e,t){return function(){LP(t,0,mX.apply(void 0,arguments));var r=e.apply(void 0,arguments);return"function"==typeof(null==r?void 0:r.then)?r.then((function(e){return UP(t,0,mX(e)),e})).catch((function(e){throw UP(t,e.code,e.message),e})):(UP(t,0,mX(r)),r)}}return!wC()&&$m(tX=location.search).call(tX,"_rtc_autotest_"),ud(ud(ud(ud({},new(qd((function e(){Wd(this,e),sd(this,"getSdkVersion",yX(hX,"getSdkVersion")),sd(this,"createEngine",yX(oX,"createEngine")),sd(this,"destroyEngine",yX(aX,"destroyEngine")),sd(this,"enumerateDevices",yX(sX,"enumerateDevices")),sd(this,"enableDevices",yX(cX,"enableDevices")),sd(this,"enumerateAudioCaptureDevices",yX(uX,"enumerateAudioCaptureDevices")),sd(this,"enumerateVideoCaptureDevices",yX(dX,"enumerateVideoCaptureDevices")),sd(this,"enumerateAudioPlaybackDevices",yX(lX,"enumerateAudioPlaybackDevices")),sd(this,"getParameter",rN),sd(this,"setParameter",tN),sd(this,"isSupported",yX(pX,"isSupported")),sd(this,"getSupportedCodecs",yX(fX,"getSupportedCodecs")),sd(this,"ConnectionMode",Fd),sd(this,"events",Kd),sd(this,"ErrorCode",lR),sd(this,"platform","BytePlus"),sd(this,"_monitor",CP),sd(this,"_rtmMonitor",wP),sd(this,"downloadLog",yX(_X,"downloadLog")),sd(this,"setLogConfig",yX(vX,"setLogConfig"))})))),Bd),zd),{},{events:Kd})}));
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(r){if("default"!==r&&!(r in e)){var n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var t="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 t&&t)||function(){return this}()||Function("return this")(),i=function(e){try{return!!e()}catch(t){return!0}},a=!i((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),o=a,s=Function.prototype,c=s.apply,u=s.call,d="object"==typeof Reflect&&Reflect.apply||(o?u.bind(c):function(){return u.apply(c,arguments)}),l=a,h=Function.prototype,p=h.call,f=l&&h.bind.bind(p,p),v=l?f:function(e){return function(){return p.apply(e,arguments)}},_=v,m=_({}.toString),y=_("".slice),g=function(e){return y(m(e),8,-1)},S=g,E=v,b=function(e){if("Function"===S(e))return E(e)},k="object"==typeof document&&document.all,T={all:k,IS_HTMLDDA:void 0===k&&void 0!==k},I=T.all,A=T.IS_HTMLDDA?function(e){return"function"==typeof e||e===I}:function(e){return"function"==typeof e},R={},C=!i((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),w=a,x=Function.prototype.call,O=w?x.bind(x):function(){return x.apply(x,arguments)},D={},P={}.propertyIsEnumerable,N=Object.getOwnPropertyDescriptor,M=N&&!P.call({1:2},1);D.f=M?function(e){var t=N(this,e);return!!t&&t.enumerable}:P;var L,U,V=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},F=i,B=g,j=Object,G=b("".split),H=F((function(){return!j("z").propertyIsEnumerable(0)}))?function(e){return"String"==B(e)?G(e,""):j(e)}:j,z=function(e){return null==e},K=z,X=TypeError,q=function(e){if(K(e))throw X("Can't call method on "+e);return e},W=H,Y=q,Q=function(e){return W(Y(e))},J=A,Z=T.all,$=T.IS_HTMLDDA?function(e){return"object"==typeof e?null!==e:J(e)||e===Z}:function(e){return"object"==typeof e?null!==e:J(e)},ee={},te=ee,re=n,ne=A,ie=function(e){return ne(e)?e:void 0},ae=function(e,t){return arguments.length<2?ie(te[e])||ie(re[e]):te[e]&&te[e][t]||re[e]&&re[e][t]},oe=b({}.isPrototypeOf),se=ae("navigator","userAgent")||"",ce=n,ue=se,de=ce.process,le=ce.Deno,he=de&&de.versions||le&&le.version,pe=he&&he.v8;pe&&(U=(L=pe.split("."))[0]>0&&L[0]<4?1:+(L[0]+L[1])),!U&&ue&&(!(L=ue.match(/Edge\/(\d+)/))||L[1]>=74)&&(L=ue.match(/Chrome\/(\d+)/))&&(U=+L[1]);var fe=U,ve=fe,_e=i,me=!!Object.getOwnPropertySymbols&&!_e((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&ve&&ve<41})),ye=me&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ge=ae,Se=A,Ee=oe,be=Object,ke=ye?function(e){return"symbol"==typeof e}:function(e){var t=ge("Symbol");return Se(t)&&Ee(t.prototype,be(e))},Te=String,Ie=function(e){try{return Te(e)}catch(t){return"Object"}},Ae=A,Re=Ie,Ce=TypeError,we=function(e){if(Ae(e))return e;throw Ce(Re(e)+" is not a function")},xe=we,Oe=z,De=function(e,t){var r=e[t];return Oe(r)?void 0:xe(r)},Pe=O,Ne=A,Me=$,Le=TypeError,Ue={exports:{}},Ve=n,Fe=Object.defineProperty,Be=function(e,t){try{Fe(Ve,e,{value:t,configurable:!0,writable:!0})}catch(r){Ve[e]=t}return t},je="__core-js_shared__",Ge=n[je]||Be(je,{}),He=Ge;(Ue.exports=function(e,t){return He[e]||(He[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.26.0",mode:"pure",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.26.0/LICENSE",source:"https://github.com/zloirock/core-js"});var ze=q,Ke=Object,Xe=function(e){return Ke(ze(e))},qe=Xe,We=b({}.hasOwnProperty),Ye=Object.hasOwn||function(e,t){return We(qe(e),t)},Qe=b,Je=0,Ze=Math.random(),$e=Qe(1..toString),et=function(e){return"Symbol("+(void 0===e?"":e)+")_"+$e(++Je+Ze,36)},tt=n,rt=Ue.exports,nt=Ye,it=et,at=me,ot=ye,st=rt("wks"),ct=tt.Symbol,ut=ct&&ct.for,dt=ot?ct:ct&&ct.withoutSetter||it,lt=function(e){if(!nt(st,e)||!at&&"string"!=typeof st[e]){var t="Symbol."+e;at&&nt(ct,e)?st[e]=ct[e]:st[e]=ot&&ut?ut(t):dt(t)}return st[e]},ht=O,pt=$,ft=ke,vt=De,_t=function(e,t){var r,n;if("string"===t&&Ne(r=e.toString)&&!Me(n=Pe(r,e)))return n;if(Ne(r=e.valueOf)&&!Me(n=Pe(r,e)))return n;if("string"!==t&&Ne(r=e.toString)&&!Me(n=Pe(r,e)))return n;throw Le("Can't convert object to primitive value")},mt=TypeError,yt=lt("toPrimitive"),gt=function(e,t){if(!pt(e)||ft(e))return e;var r,n=vt(e,yt);if(n){if(void 0===t&&(t="default"),r=ht(n,e,t),!pt(r)||ft(r))return r;throw mt("Can't convert object to primitive value")}return void 0===t&&(t="number"),_t(e,t)},St=ke,Et=function(e){var t=gt(e,"string");return St(t)?t:t+""},bt=$,kt=n.document,Tt=bt(kt)&&bt(kt.createElement),It=function(e){return Tt?kt.createElement(e):{}},At=It,Rt=!C&&!i((function(){return 7!=Object.defineProperty(At("div"),"a",{get:function(){return 7}}).a})),Ct=C,wt=O,xt=D,Ot=V,Dt=Q,Pt=Et,Nt=Ye,Mt=Rt,Lt=Object.getOwnPropertyDescriptor;R.f=Ct?Lt:function(e,t){if(e=Dt(e),t=Pt(t),Mt)try{return Lt(e,t)}catch(r){}if(Nt(e,t))return Ot(!wt(xt.f,e,t),e[t])};var Ut=i,Vt=A,Ft=/#|\.prototype\./,Bt=function(e,t){var r=Gt[jt(e)];return r==zt||r!=Ht&&(Vt(t)?Ut(t):!!t)},jt=Bt.normalize=function(e){return String(e).replace(Ft,".").toLowerCase()},Gt=Bt.data={},Ht=Bt.NATIVE="N",zt=Bt.POLYFILL="P",Kt=Bt,Xt=we,qt=a,Wt=b(b.bind),Yt=function(e,t){return Xt(e),void 0===t?e:qt?Wt(e,t):function(){return e.apply(t,arguments)}},Qt={},Jt=C&&i((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Zt=$,$t=String,er=TypeError,tr=function(e){if(Zt(e))return e;throw er($t(e)+" is not an object")},rr=C,nr=Rt,ir=Jt,ar=tr,or=Et,sr=TypeError,cr=Object.defineProperty,ur=Object.getOwnPropertyDescriptor,dr="enumerable",lr="configurable",hr="writable";Qt.f=rr?ir?function(e,t,r){if(ar(e),t=or(t),ar(r),"function"==typeof e&&"prototype"===t&&"value"in r&&hr in r&&!r.writable){var n=ur(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:lr in r?r.configurable:n.configurable,enumerable:dr in r?r.enumerable:n.enumerable,writable:!1})}return cr(e,t,r)}:cr:function(e,t,r){if(ar(e),t=or(t),ar(r),nr)try{return cr(e,t,r)}catch(n){}if("get"in r||"set"in r)throw sr("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var pr=Qt,fr=V,vr=C?function(e,t,r){return pr.f(e,t,fr(1,r))}:function(e,t,r){return e[t]=r,e},_r=n,mr=d,yr=b,gr=A,Sr=R.f,Er=Kt,br=ee,kr=Yt,Tr=vr,Ir=Ye,Ar=function(e){var t=function(r,n,i){if(this instanceof t){switch(arguments.length){case 0:return new e;case 1:return new e(r);case 2:return new e(r,n)}return new e(r,n,i)}return mr(e,this,arguments)};return t.prototype=e.prototype,t},Rr=function(e,t){var r,n,i,a,o,s,c,u,d=e.target,l=e.global,h=e.stat,p=e.proto,f=l?_r:h?_r[d]:(_r[d]||{}).prototype,v=l?br:br[d]||Tr(br,d,{})[d],_=v.prototype;for(i in t)r=!Er(l?i:d+(h?".":"#")+i,e.forced)&&f&&Ir(f,i),o=v[i],r&&(s=e.dontCallGetSet?(u=Sr(f,i))&&u.value:f[i]),a=r&&s?s:t[i],r&&typeof o==typeof a||(c=e.bind&&r?kr(a,_r):e.wrap&&r?Ar(a):p&&gr(a)?yr(a):a,(e.sham||a&&a.sham||o&&o.sham)&&Tr(c,"sham",!0),Tr(v,i,c),p&&(Ir(br,n=d+"Prototype")||Tr(br,n,{}),Tr(br[n],i,a),e.real&&_&&!_[i]&&Tr(_,i,a)))},Cr=Math.ceil,wr=Math.floor,xr=Math.trunc||function(e){var t=+e;return(t>0?wr:Cr)(t)},Or=function(e){var t=+e;return t!=t||0===t?0:xr(t)},Dr=Or,Pr=Math.max,Nr=Math.min,Mr=function(e,t){var r=Dr(e);return r<0?Pr(r+t,0):Nr(r,t)},Lr=Or,Ur=Math.min,Vr=function(e){return e>0?Ur(Lr(e),9007199254740991):0},Fr=Vr,Br=function(e){return Fr(e.length)},jr=Q,Gr=Mr,Hr=Br,zr=function(e){return function(t,r,n){var i,a=jr(t),o=Hr(a),s=Gr(n,o);if(e&&r!=r){for(;o>s;)if((i=a[s++])!=i)return!0}else for(;o>s;s++)if((e||s in a)&&a[s]===r)return e||s||0;return!e&&-1}},Kr={includes:zr(!0),indexOf:zr(!1)},Xr={},qr=Ye,Wr=Q,Yr=Kr.indexOf,Qr=Xr,Jr=b([].push),Zr=function(e,t){var r,n=Wr(e),i=0,a=[];for(r in n)!qr(Qr,r)&&qr(n,r)&&Jr(a,r);for(;t.length>i;)qr(n,r=t[i++])&&(~Yr(a,r)||Jr(a,r));return a},$r=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],en=Zr,tn=$r,rn=Object.keys||function(e){return en(e,tn)},nn=Xe,an=rn;Rr({target:"Object",stat:!0,forced:i((function(){an(1)}))},{keys:function(e){return an(nn(e))}});var on=ee.Object.keys,sn={};sn[lt("toStringTag")]="z";var cn="[object z]"===String(sn),un=cn,dn=A,ln=g,hn=lt("toStringTag"),pn=Object,fn="Arguments"==ln(function(){return arguments}()),vn=un?ln:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(r){}}(t=pn(e),hn))?r:fn?ln(t):"Object"==(n=ln(t))&&dn(t.callee)?"Arguments":n},_n=vn,mn=String,yn=function(e){if("Symbol"===_n(e))throw TypeError("Cannot convert a Symbol value to a string");return mn(e)},gn={},Sn=C,En=Jt,bn=Qt,kn=tr,Tn=Q,In=rn;gn.f=Sn&&!En?Object.defineProperties:function(e,t){kn(e);for(var r,n=Tn(t),i=In(t),a=i.length,o=0;a>o;)bn.f(e,r=i[o++],n[r]);return e};var An,Rn=ae("document","documentElement"),Cn=Ue.exports,wn=et,xn=Cn("keys"),On=function(e){return xn[e]||(xn[e]=wn(e))},Dn=tr,Pn=gn,Nn=$r,Mn=Xr,Ln=Rn,Un=It,Vn=On("IE_PROTO"),Fn=function(){},Bn=function(e){return"<script>"+e+"</"+"script>"},jn=function(e){e.write(Bn("")),e.close();var t=e.parentWindow.Object;return e=null,t},Gn=function(){try{An=new ActiveXObject("htmlfile")}catch(n){}var e,t;Gn="undefined"!=typeof document?document.domain&&An?jn(An):((t=Un("iframe")).style.display="none",Ln.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(Bn("document.F=Object")),e.close(),e.F):jn(An);for(var r=Nn.length;r--;)delete Gn.prototype[Nn[r]];return Gn()};Mn[Vn]=!0;var Hn=Object.create||function(e,t){var r;return null!==e?(Fn.prototype=Dn(e),r=new Fn,Fn.prototype=null,r[Vn]=e):r=Gn(),void 0===t?r:Pn.f(r,t)},zn={},Kn=Zr,Xn=$r.concat("length","prototype");zn.f=Object.getOwnPropertyNames||function(e){return Kn(e,Xn)};var qn={},Wn=Et,Yn=Qt,Qn=V,Jn=function(e,t,r){var n=Wn(t);n in e?Yn.f(e,n,Qn(0,r)):e[n]=r},Zn=Mr,$n=Br,ei=Jn,ti=Array,ri=Math.max,ni=function(e,t,r){for(var n=$n(e),i=Zn(t,n),a=Zn(void 0===r?n:r,n),o=ti(ri(a-i,0)),s=0;i<a;i++,s++)ei(o,s,e[i]);return o.length=s,o},ii=g,ai=Q,oi=zn.f,si=ni,ci="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];qn.f=function(e){return ci&&"Window"==ii(e)?function(e){try{return oi(e)}catch(t){return si(ci)}}(e):oi(ai(e))};var ui={};ui.f=Object.getOwnPropertySymbols;var di=vr,li=function(e,t,r,n){return n&&n.enumerable?e[t]=r:di(e,t,r),e},hi={},pi=lt;hi.f=pi;var fi,vi,_i,mi=ee,yi=Ye,gi=hi,Si=Qt.f,Ei=function(e){var t=mi.Symbol||(mi.Symbol={});yi(t,e)||Si(t,e,{value:gi.f(e)})},bi=O,ki=ae,Ti=lt,Ii=li,Ai=function(){var e=ki("Symbol"),t=e&&e.prototype,r=t&&t.valueOf,n=Ti("toPrimitive");t&&!t[n]&&Ii(t,n,(function(e){return bi(r,this)}),{arity:1})},Ri=vn,Ci=cn?{}.toString:function(){return"[object "+Ri(this)+"]"},wi=cn,xi=Qt.f,Oi=vr,Di=Ye,Pi=Ci,Ni=lt("toStringTag"),Mi=function(e,t,r,n){if(e){var i=r?e:e.prototype;Di(i,Ni)||xi(i,Ni,{configurable:!0,value:t}),n&&!wi&&Oi(i,"toString",Pi)}},Li=A,Ui=n.WeakMap,Vi=Li(Ui)&&/native code/.test(String(Ui)),Fi=Vi,Bi=n,ji=$,Gi=vr,Hi=Ye,zi=Ge,Ki=On,Xi=Xr,qi="Object already initialized",Wi=Bi.TypeError,Yi=Bi.WeakMap;if(Fi||zi.state){var Qi=zi.state||(zi.state=new Yi);Qi.get=Qi.get,Qi.has=Qi.has,Qi.set=Qi.set,fi=function(e,t){if(Qi.has(e))throw Wi(qi);return t.facade=e,Qi.set(e,t),t},vi=function(e){return Qi.get(e)||{}},_i=function(e){return Qi.has(e)}}else{var Ji=Ki("state");Xi[Ji]=!0,fi=function(e,t){if(Hi(e,Ji))throw Wi(qi);return t.facade=e,Gi(e,Ji,t),t},vi=function(e){return Hi(e,Ji)?e[Ji]:{}},_i=function(e){return Hi(e,Ji)}}var Zi={set:fi,get:vi,has:_i,enforce:function(e){return _i(e)?vi(e):fi(e,{})},getterFor:function(e){return function(t){var r;if(!ji(t)||(r=vi(t)).type!==e)throw Wi("Incompatible receiver, "+e+" required");return r}}},$i=g,ea=Array.isArray||function(e){return"Array"==$i(e)},ta=A,ra=Ge,na=b(Function.toString);ta(ra.inspectSource)||(ra.inspectSource=function(e){return na(e)});var ia=ra.inspectSource,aa=b,oa=i,sa=A,ca=vn,ua=ia,da=function(){},la=[],ha=ae("Reflect","construct"),pa=/^\s*(?:class|function)\b/,fa=aa(pa.exec),va=!pa.exec(da),_a=function(e){if(!sa(e))return!1;try{return ha(da,la,e),!0}catch(t){return!1}},ma=function(e){if(!sa(e))return!1;switch(ca(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return va||!!fa(pa,ua(e))}catch(t){return!0}};ma.sham=!0;var ya=!ha||oa((function(){var e;return _a(_a.call)||!_a(Object)||!_a((function(){e=!0}))||e}))?ma:_a,ga=ea,Sa=ya,Ea=$,ba=lt("species"),ka=Array,Ta=function(e){var t;return ga(e)&&(t=e.constructor,(Sa(t)&&(t===ka||ga(t.prototype))||Ea(t)&&null===(t=t[ba]))&&(t=void 0)),void 0===t?ka:t},Ia=function(e,t){return new(Ta(e))(0===t?0:t)},Aa=Yt,Ra=H,Ca=Xe,wa=Br,xa=Ia,Oa=b([].push),Da=function(e){var t=1==e,r=2==e,n=3==e,i=4==e,a=6==e,o=7==e,s=5==e||a;return function(c,u,d,l){for(var h,p,f=Ca(c),v=Ra(f),_=Aa(u,d),m=wa(v),y=0,g=l||xa,S=t?g(c,m):r||o?g(c,0):void 0;m>y;y++)if((s||y in v)&&(p=_(h=v[y],y,f),e))if(t)S[y]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return y;case 2:Oa(S,h)}else switch(e){case 4:return!1;case 7:Oa(S,h)}return a?-1:n||i?i:S}},Pa={forEach:Da(0),map:Da(1),filter:Da(2),some:Da(3),every:Da(4),find:Da(5),findIndex:Da(6),filterReject:Da(7)},Na=Rr,Ma=n,La=O,Ua=b,Va=C,Fa=me,Ba=i,ja=Ye,Ga=oe,Ha=tr,za=Q,Ka=Et,Xa=yn,qa=V,Wa=Hn,Ya=rn,Qa=zn,Ja=qn,Za=ui,$a=R,eo=Qt,to=gn,ro=D,no=li,io=Ue.exports,ao=Xr,oo=et,so=lt,co=hi,uo=Ei,lo=Ai,ho=Mi,po=Zi,fo=Pa.forEach,vo=On("hidden"),_o="Symbol",mo=po.set,yo=po.getterFor(_o),go=Object.prototype,So=Ma.Symbol,Eo=So&&So.prototype,bo=Ma.TypeError,ko=Ma.QObject,To=$a.f,Io=eo.f,Ao=Ja.f,Ro=ro.f,Co=Ua([].push),wo=io("symbols"),xo=io("op-symbols"),Oo=io("wks"),Do=!ko||!ko.prototype||!ko.prototype.findChild,Po=Va&&Ba((function(){return 7!=Wa(Io({},"a",{get:function(){return Io(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=To(go,t);n&&delete go[t],Io(e,t,r),n&&e!==go&&Io(go,t,n)}:Io,No=function(e,t){var r=wo[e]=Wa(Eo);return mo(r,{type:_o,tag:e,description:t}),Va||(r.description=t),r},Mo=function(e,t,r){e===go&&Mo(xo,t,r),Ha(e);var n=Ka(t);return Ha(r),ja(wo,n)?(r.enumerable?(ja(e,vo)&&e[vo][n]&&(e[vo][n]=!1),r=Wa(r,{enumerable:qa(0,!1)})):(ja(e,vo)||Io(e,vo,qa(1,{})),e[vo][n]=!0),Po(e,n,r)):Io(e,n,r)},Lo=function(e,t){Ha(e);var r=za(t),n=Ya(r).concat(Bo(r));return fo(n,(function(t){Va&&!La(Uo,r,t)||Mo(e,t,r[t])})),e},Uo=function(e){var t=Ka(e),r=La(Ro,this,t);return!(this===go&&ja(wo,t)&&!ja(xo,t))&&(!(r||!ja(this,t)||!ja(wo,t)||ja(this,vo)&&this[vo][t])||r)},Vo=function(e,t){var r=za(e),n=Ka(t);if(r!==go||!ja(wo,n)||ja(xo,n)){var i=To(r,n);return!i||!ja(wo,n)||ja(r,vo)&&r[vo][n]||(i.enumerable=!0),i}},Fo=function(e){var t=Ao(za(e)),r=[];return fo(t,(function(e){ja(wo,e)||ja(ao,e)||Co(r,e)})),r},Bo=function(e){var t=e===go,r=Ao(t?xo:za(e)),n=[];return fo(r,(function(e){!ja(wo,e)||t&&!ja(go,e)||Co(n,wo[e])})),n};Fa||(So=function(){if(Ga(Eo,this))throw bo("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Xa(arguments[0]):void 0,t=oo(e),r=function(e){this===go&&La(r,xo,e),ja(this,vo)&&ja(this[vo],t)&&(this[vo][t]=!1),Po(this,t,qa(1,e))};return Va&&Do&&Po(go,t,{configurable:!0,set:r}),No(t,e)},no(Eo=So.prototype,"toString",(function(){return yo(this).tag})),no(So,"withoutSetter",(function(e){return No(oo(e),e)})),ro.f=Uo,eo.f=Mo,to.f=Lo,$a.f=Vo,Qa.f=Ja.f=Fo,Za.f=Bo,co.f=function(e){return No(so(e),e)},Va&&Io(Eo,"description",{configurable:!0,get:function(){return yo(this).description}})),Na({global:!0,constructor:!0,wrap:!0,forced:!Fa,sham:!Fa},{Symbol:So}),fo(Ya(Oo),(function(e){uo(e)})),Na({target:_o,stat:!0,forced:!Fa},{useSetter:function(){Do=!0},useSimple:function(){Do=!1}}),Na({target:"Object",stat:!0,forced:!Fa,sham:!Va},{create:function(e,t){return void 0===t?Wa(e):Lo(Wa(e),t)},defineProperty:Mo,defineProperties:Lo,getOwnPropertyDescriptor:Vo}),Na({target:"Object",stat:!0,forced:!Fa},{getOwnPropertyNames:Fo}),lo(),ho(So,_o),ao[vo]=!0;var jo=me&&!!Symbol.for&&!!Symbol.keyFor,Go=Rr,Ho=ae,zo=Ye,Ko=yn,Xo=Ue.exports,qo=jo,Wo=Xo("string-to-symbol-registry"),Yo=Xo("symbol-to-string-registry");Go({target:"Symbol",stat:!0,forced:!qo},{for:function(e){var t=Ko(e);if(zo(Wo,t))return Wo[t];var r=Ho("Symbol")(t);return Wo[t]=r,Yo[r]=t,r}});var Qo=Rr,Jo=Ye,Zo=ke,$o=Ie,es=jo,ts=(0,Ue.exports)("symbol-to-string-registry");Qo({target:"Symbol",stat:!0,forced:!es},{keyFor:function(e){if(!Zo(e))throw TypeError($o(e)+" is not a symbol");if(Jo(ts,e))return ts[e]}});var rs=b([].slice),ns=Rr,is=ae,as=d,os=O,ss=b,cs=i,us=ea,ds=A,ls=$,hs=ke,ps=rs,fs=me,vs=is("JSON","stringify"),_s=ss(/./.exec),ms=ss("".charAt),ys=ss("".charCodeAt),gs=ss("".replace),Ss=ss(1..toString),Es=/[\uD800-\uDFFF]/g,bs=/^[\uD800-\uDBFF]$/,ks=/^[\uDC00-\uDFFF]$/,Ts=!fs||cs((function(){var e=is("Symbol")();return"[null]"!=vs([e])||"{}"!=vs({a:e})||"{}"!=vs(Object(e))})),Is=cs((function(){return'"\\udf06\\ud834"'!==vs("\udf06\ud834")||'"\\udead"'!==vs("\udead")})),As=function(e,t){var r=ps(arguments),n=t;if((ls(t)||void 0!==e)&&!hs(e))return us(t)||(t=function(e,t){if(ds(n)&&(t=os(n,this,e,t)),!hs(t))return t}),r[1]=t,as(vs,null,r)},Rs=function(e,t,r){var n=ms(r,t-1),i=ms(r,t+1);return _s(bs,e)&&!_s(ks,i)||_s(ks,e)&&!_s(bs,n)?"\\u"+Ss(ys(e,0),16):e};vs&&ns({target:"JSON",stat:!0,arity:3,forced:Ts||Is},{stringify:function(e,t,r){var n=ps(arguments),i=as(Ts?As:vs,null,n);return Is&&"string"==typeof i?gs(i,Es,Rs):i}});var Cs=ui,ws=Xe;Rr({target:"Object",stat:!0,forced:!me||i((function(){Cs.f(1)}))},{getOwnPropertySymbols:function(e){var t=Cs.f;return t?t(ws(e)):[]}});var xs=ee.Object.getOwnPropertySymbols,Os=i,Ds=fe,Ps=lt("species"),Ns=function(e){return Ds>=51||!Os((function(){var t=[];return(t.constructor={})[Ps]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},Ms=Pa.filter;Rr({target:"Array",proto:!0,forced:!Ns("filter")},{filter:function(e){return Ms(this,e,arguments.length>1?arguments[1]:void 0)}});var Ls=ee,Us=function(e){return Ls[e+"Prototype"]},Vs=Us("Array").filter,Fs=oe,Bs=Vs,js=Array.prototype,Gs=function(e){var t=e.filter;return e===js||Fs(js,e)&&t===js.filter?Bs:t},Hs={exports:{}},zs=Rr,Ks=i,Xs=Q,qs=R.f,Ws=C,Ys=Ks((function(){qs(1)}));zs({target:"Object",stat:!0,forced:!Ws||Ys,sham:!Ws},{getOwnPropertyDescriptor:function(e,t){return qs(Xs(e),t)}});var Qs=ee.Object,Js=Hs.exports=function(e,t){return Qs.getOwnPropertyDescriptor(e,t)};Qs.getOwnPropertyDescriptor.sham&&(Js.sham=!0);var Zs,$s,ec,tc=Hs.exports,rc={},nc=C,ic=Ye,ac=Function.prototype,oc=nc&&Object.getOwnPropertyDescriptor,sc=ic(ac,"name"),cc={EXISTS:sc,PROPER:sc&&"something"===function(){}.name,CONFIGURABLE:sc&&(!nc||nc&&oc(ac,"name").configurable)},uc=!i((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),dc=Ye,lc=A,hc=Xe,pc=uc,fc=On("IE_PROTO"),vc=Object,_c=vc.prototype,mc=pc?vc.getPrototypeOf:function(e){var t=hc(e);if(dc(t,fc))return t[fc];var r=t.constructor;return lc(r)&&t instanceof r?r.prototype:t instanceof vc?_c:null},yc=i,gc=A,Sc=$,Ec=Hn,bc=mc,kc=li,Tc=lt("iterator"),Ic=!1;[].keys&&("next"in(ec=[].keys())?($s=bc(bc(ec)))!==Object.prototype&&(Zs=$s):Ic=!0);var Ac=!Sc(Zs)||yc((function(){var e={};return Zs[Tc].call(e)!==e}));gc((Zs=Ac?{}:Ec(Zs))[Tc])||kc(Zs,Tc,(function(){return this}));var Rc={IteratorPrototype:Zs,BUGGY_SAFARI_ITERATORS:Ic},Cc=Rc.IteratorPrototype,wc=Hn,xc=V,Oc=Mi,Dc=rc,Pc=function(){return this},Nc=function(e,t,r,n){var i=t+" Iterator";return e.prototype=wc(Cc,{next:xc(+!n,r)}),Oc(e,i,!1,!0),Dc[i]=Pc,e},Mc=A,Lc=String,Uc=TypeError,Vc=b,Fc=tr,Bc=function(e){if("object"==typeof e||Mc(e))return e;throw Uc("Can't set "+Lc(e)+" as a prototype")},jc=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=Vc(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(n){}return function(r,n){return Fc(r),Bc(n),t?e(r,n):r.__proto__=n,r}}():void 0),Gc=Rr,Hc=O,zc=cc,Kc=Nc,Xc=mc,qc=Mi,Wc=li,Yc=rc,Qc=Rc,Jc=zc.PROPER,Zc=Qc.BUGGY_SAFARI_ITERATORS,$c=lt("iterator"),eu="keys",tu="values",ru="entries",nu=function(){return this},iu=function(e,t,r,n,i,a,o){Kc(r,t,n);var s,c,u,d=function(e){if(e===i&&v)return v;if(!Zc&&e in p)return p[e];switch(e){case eu:case tu:case ru:return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[$c]||p["@@iterator"]||i&&p[i],v=!Zc&&f||d(i),_="Array"==t&&p.entries||f;if(_&&(s=Xc(_.call(new e)))!==Object.prototype&&s.next&&(qc(s,l,!0,!0),Yc[l]=nu),Jc&&i==tu&&f&&f.name!==tu&&(h=!0,v=function(){return Hc(f,this)}),i)if(c={values:d(tu),keys:a?v:d(eu),entries:d(ru)},o)for(u in c)(Zc||h||!(u in p))&&Wc(p,u,c[u]);else Gc({target:t,proto:!0,forced:Zc||h},c);return o&&p[$c]!==v&&Wc(p,$c,v,{name:i}),Yc[t]=v,c},au=function(e,t){return{value:e,done:t}},ou=Q,su=function(){},cu=rc,uu=Zi,du=(Qt.f,iu),lu=au,hu="Array Iterator",pu=uu.set,fu=uu.getterFor(hu);du(Array,"Array",(function(e,t){pu(this,{type:hu,target:ou(e),index:0,kind:t})}),(function(){var e=fu(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,lu(void 0,!0)):lu("keys"==r?n:"values"==r?t[n]:[n,t[n]],!1)}),"values");cu.Arguments=cu.Array;su(),su(),su();var vu={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},_u=n,mu=vn,yu=vr,gu=rc,Su=lt("toStringTag");for(var Eu in vu){var bu=_u[Eu],ku=bu&&bu.prototype;ku&&mu(ku)!==Su&&yu(ku,Su,Eu),gu[Eu]=gu.Array}var Tu=i,Iu=function(e,t){var r=[][e];return!!r&&Tu((function(){r.call(null,t||function(){return 1},1)}))},Au=Pa.forEach,Ru=Iu("forEach")?[].forEach:function(e){return Au(this,e,arguments.length>1?arguments[1]:void 0)};Rr({target:"Array",proto:!0,forced:[].forEach!=Ru},{forEach:Ru});var Cu=Us("Array").forEach,wu=vn,xu=Ye,Ou=oe,Du=Cu,Pu=Array.prototype,Nu={DOMTokenList:!0,NodeList:!0},Mu=function(e){var t=e.forEach;return e===Pu||Ou(Pu,e)&&t===Pu.forEach||xu(Nu,wu(e))?Du:t},Lu=ae,Uu=zn,Vu=ui,Fu=tr,Bu=b([].concat),ju=Lu("Reflect","ownKeys")||function(e){var t=Uu.f(Fu(e)),r=Vu.f;return r?Bu(t,r(e)):t},Gu=ju,Hu=Q,zu=R,Ku=Jn;Rr({target:"Object",stat:!0,sham:!C},{getOwnPropertyDescriptors:function(e){for(var t,r,n=Hu(e),i=zu.f,a=Gu(n),o={},s=0;a.length>s;)void 0!==(r=i(n,t=a[s++]))&&Ku(o,t,r);return o}});var Xu=ee.Object.getOwnPropertyDescriptors,qu={exports:{}},Wu=Rr,Yu=C,Qu=gn.f;Wu({target:"Object",stat:!0,forced:Object.defineProperties!==Qu,sham:!Yu},{defineProperties:Qu});var Ju=ee.Object,Zu=qu.exports=function(e,t){return Ju.defineProperties(e,t)};Ju.defineProperties.sham&&(Zu.sham=!0);var $u=qu.exports,ed={exports:{}},td=Rr,rd=C,nd=Qt.f;td({target:"Object",stat:!0,forced:Object.defineProperty!==nd,sham:!rd},{defineProperty:nd});var id=ee.Object,ad=ed.exports=function(e,t,r){return id.defineProperty(e,t,r)};id.defineProperty.sham&&(ad.sham=!0);var od=ed.exports;function sd(e,t,r){return t in e?od(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function cd(e,t){var r=on(e);if(xs){var n=xs(e);t&&(n=Gs(n).call(n,(function(t){return tc(e,t).enumerable}))),r.push.apply(r,n)}return r}function ud(e){for(var t=1;t<arguments.length;t++){var r,n,i=null!=arguments[t]?arguments[t]:{};t%2?Mu(r=cd(Object(i),!0)).call(r,(function(t){sd(e,t,i[t])})):Xu?$u(e,Xu(i)):Mu(n=cd(Object(i))).call(n,(function(t){od(e,t,tc(i,t))}))}return e}var dd=function(e){return e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL",e}(dd||{}),ld=function(e){return e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL",e}(ld||{}),hd=function(e){return 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",e}(hd||{}),pd=function(e){return e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING",e}(pd||{}),fd=function(e){return e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE",e}(fd||{}),vd=function(e){return e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL",e}(vd||{}),_d=function(e){return e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL",e}(_d||{}),md=function(e){return e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON",e}(md||{}),yd=function(e){return e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT",e}(yd||{}),gd=function(e){return e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN",e}(gd||{}),Sd=function(e){return e[e.AUDIO=1]="AUDIO",e[e.VIDEO=2]="VIDEO",e[e.AUDIO_AND_VIDEO=3]="AUDIO_AND_VIDEO",e}(Sd||{}),Ed=function(e){return 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",e}(Ed||{}),bd=function(e){return 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",e}(bd||{}),kd=function(e){return e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER",e}(kd||{}),Td=function(e){return e[e.domestic=0]="domestic",e[e.overseas=1]="overseas",e}(Td||{}),Id=function(e){return e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE",e}(Id||{}),Ad=function(e){return e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY",e}(Ad||{}),Rd=function(e){return e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME",e}(Rd||{}),Cd=function(e){return e[e.DISABLE=0]="DISABLE",e[e.VIDEO_STREAM_LOW=1]="VIDEO_STREAM_LOW",e[e.AUDIO_ONLY=2]="AUDIO_ONLY",e}(Cd||{}),wd=function(e){return e[e.LOW=0]="LOW",e[e.MEDIUM=100]="MEDIUM",e[e.HIGH=200]="HIGH",e}(wd||{}),xd=function(e){return 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",e}(xd||{}),Od=function(e){return e[e.Unknown=-1]="Unknown",e[e.SubscribeFallbackByBandwidth=0]="SubscribeFallbackByBandwidth",e[e.SubscribeRecoverByBandwidth=2]="SubscribeRecoverByBandwidth",e}(Od||{}),Dd=function(e){return 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",e}(Dd||{}),Pd=function(e){return 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",e}(Pd||{}),Nd=function(e){return e[e.AUTO_PLAY=0]="AUTO_PLAY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.PLAY_MANUALLY=2]="PLAY_MANUALLY",e}(Nd||{}),Md=function(e){return e.LC="LC",e.HEv1="HEv1",e.HEv2="HEv2",e}(Md||{}),Ld=function(e){return e.H264="H264",e.H265="H265",e}(Ld||{}),Ud=function(e){return e[e.ASR_ONLY=0]="ASR_ONLY",e[e.ASR_AND_TRANSLATION=1]="ASR_AND_TRANSLATION",e}(Ud||{}),Vd=function(e){return e[e.STARTED=0]="STARTED",e[e.STOPPED=1]="STOPPED",e[e.ERROR=2]="ERROR",e}(Vd||{}),Fd=function(e){return e.AUTO="auto",e.FORCE_TCP="forceTCP",e.FORCE_UDP="forceUDP",e}(Fd||{}),Bd=Object.freeze(Object.defineProperty({__proto__:null,VideoSourceType:dd,AudioSourceType:ld,UserOfflineReason:hd,ChannelProfile:pd,SubscribeMode:fd,SubscribeState:vd,PublishState:_d,MirrorMode:md,VideoRenderMode:yd,StreamIndex:gd,MediaType:Sd,StreamRemoveReason:Ed,ConnectionState:bd,MirrorType:kd,LogChannel:Td,USER_ONLINE_STATUS:Id,PublicStreamType:Ad,PublicInterpolationMode:Rd,SubscribeFallbackOption:Cd,RemoteUserPriority:wd,NetworkQuality:xd,FallbackOrRecoverReason:Od,RoomProfileType:Dd,AudioProfileType:Pd,RTCAutoPlayPolicy:Nd,AAC_PROFILE:Md,TRANSCODING_VIDEO_CODEC:Ld,SUBTITLE_MODE:Ud,SubtitleEventType:Vd,ConnectionMode:Fd},Symbol.toStringTag,{value:"Module"})),jd=function(e){return 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",e}(jd||{}),Gd=function(e){return e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH",e}(Gd||{}),Hd=function(e){return 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",e}(Hd||{}),zd=Object.freeze(Object.defineProperty({__proto__:null,AudioMixingDualMonoMode:jd,AudioMixingType:Gd,AudioMixingState:Hd},Symbol.toStringTag,{value:"Module"})),Kd=function(e){return 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.onRemoteVideoFirstFrame="onRemoteVideoFirstFrame",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onRemoteAudioFirstFrame="onRemoteAudioFirstFrame",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.onActiveSpeaker="onActiveSpeaker",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.onVideoStreamBanned="onVideoStreamBanned",e.onAudioStreamBanned="onAudioStreamBanned",e.onLocalVideoSizeChanged="onLocalVideoSizeChanged",e.onSubtitleStateChanged="onSubtitleStateChanged",e.onSubtitleMessageReceived="onSubtitleMessageReceived",e.onServerParamsSetResult="onServerParamsSetResult",e}(Kd||{});function Xd(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),od(e,n.key,n)}}function qd(e,t,r){return t&&Xd(e.prototype,t),r&&Xd(e,r),od(e,"prototype",{writable:!1}),e}function Wd(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var Yd=Ye,Qd=ju,Jd=R,Zd=Qt,$d=Error,el=b("".replace),tl=String($d("zxcasd").stack),rl=/\n\s*at [^:]*:[^\n]*/,nl=rl.test(tl),il=$,al=vr,ol=rc,sl=lt("iterator"),cl=Array.prototype,ul=function(e){return void 0!==e&&(ol.Array===e||cl[sl]===e)},dl=vn,ll=De,hl=z,pl=rc,fl=lt("iterator"),vl=function(e){if(!hl(e))return ll(e,fl)||ll(e,"@@iterator")||pl[dl(e)]},_l=O,ml=we,yl=tr,gl=Ie,Sl=vl,El=TypeError,bl=function(e,t){var r=arguments.length<2?Sl(e):t;if(ml(r))return yl(_l(r,e));throw El(gl(e)+" is not iterable")},kl=O,Tl=tr,Il=De,Al=function(e,t,r){var n,i;Tl(e);try{if(!(n=Il(e,"return"))){if("throw"===t)throw r;return r}n=kl(n,e)}catch(a){i=!0,n=a}if("throw"===t)throw r;if(i)throw n;return Tl(n),r},Rl=Yt,Cl=O,wl=tr,xl=Ie,Ol=ul,Dl=Br,Pl=oe,Nl=bl,Ml=vl,Ll=Al,Ul=TypeError,Vl=function(e,t){this.stopped=e,this.result=t},Fl=Vl.prototype,Bl=function(e,t,r){var n,i,a,o,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_RECORD),p=!(!r||!r.IS_ITERATOR),f=!(!r||!r.INTERRUPTED),v=Rl(t,d),_=function(e){return n&&Ll(n,"normal",e),new Vl(!0,e)},m=function(e){return l?(wl(e),f?v(e[0],e[1],_):v(e[0],e[1])):f?v(e,_):v(e)};if(h)n=e.iterator;else if(p)n=e;else{if(!(i=Ml(e)))throw Ul(xl(e)+" is not iterable");if(Ol(i)){for(a=0,o=Dl(e);o>a;a++)if((s=m(e[a]))&&Pl(Fl,s))return s;return new Vl(!1)}n=Nl(e,i)}for(c=h?e.next:n.next;!(u=Cl(c,n)).done;){try{s=m(u.value)}catch(y){Ll(n,"throw",y)}if("object"==typeof s&&s&&Pl(Fl,s))return s}return new Vl(!1)},jl=yn,Gl=V,Hl=!i((function(){var e=Error("a");return!("stack"in e)||(Object.defineProperty(e,"stack",Gl(1,7)),7!==e.stack)})),zl=Rr,Kl=oe,Xl=mc,ql=jc,Wl=function(e,t,r){for(var n=Qd(t),i=Zd.f,a=Jd.f,o=0;o<n.length;o++){var s=n[o];Yd(e,s)||r&&Yd(r,s)||i(e,s,a(t,s))}},Yl=Hn,Ql=vr,Jl=V,Zl=function(e,t){if(nl&&"string"==typeof e&&!$d.prepareStackTrace)for(;t--;)e=el(e,rl,"");return e},$l=function(e,t){il(t)&&"cause"in t&&al(e,"cause",t.cause)},eh=Bl,th=function(e,t){return void 0===e?arguments.length<2?"":t:jl(e)},rh=Hl,nh=lt("toStringTag"),ih=Error,ah=[].push,oh=function(e,t){var r,n=arguments.length>2?arguments[2]:void 0,i=Kl(sh,this);ql?r=ql(ih(),i?Xl(this):sh):(r=i?this:Yl(sh),Ql(r,nh,"Error")),void 0!==t&&Ql(r,"message",th(t)),rh&&Ql(r,"stack",Zl(r.stack,1)),$l(r,n);var a=[];return eh(e,ah,{that:a}),Ql(r,"errors",a),r};ql?ql(oh,ih):Wl(oh,ih,{name:!0});var sh=oh.prototype=Yl(ih.prototype,{constructor:Jl(1,oh),message:Jl(1,""),name:Jl(1,"AggregateError")});zl({global:!0,constructor:!0,arity:2},{AggregateError:oh});var ch,uh,dh,lh,hh="process"==g(n.process),ph=ae,fh=Qt,vh=C,_h=lt("species"),mh=function(e){var t=ph(e),r=fh.f;vh&&t&&!t[_h]&&r(t,_h,{configurable:!0,get:function(){return this}})},yh=oe,gh=TypeError,Sh=function(e,t){if(yh(t,e))return e;throw gh("Incorrect invocation")},Eh=ya,bh=Ie,kh=TypeError,Th=function(e){if(Eh(e))return e;throw kh(bh(e)+" is not a constructor")},Ih=tr,Ah=Th,Rh=z,Ch=lt("species"),wh=function(e,t){var r,n=Ih(e).constructor;return void 0===n||Rh(r=Ih(n)[Ch])?t:Ah(r)},xh=TypeError,Oh=function(e,t){if(e<t)throw xh("Not enough arguments");return e},Dh=/(?:ipad|iphone|ipod).*applewebkit/i.test(se),Ph=n,Nh=d,Mh=Yt,Lh=A,Uh=Ye,Vh=i,Fh=Rn,Bh=rs,jh=It,Gh=Oh,Hh=Dh,zh=hh,Kh=Ph.setImmediate,Xh=Ph.clearImmediate,qh=Ph.process,Wh=Ph.Dispatch,Yh=Ph.Function,Qh=Ph.MessageChannel,Jh=Ph.String,Zh=0,$h={},ep="onreadystatechange";try{ch=Ph.location}catch(PX){}var tp=function(e){if(Uh($h,e)){var t=$h[e];delete $h[e],t()}},rp=function(e){return function(){tp(e)}},np=function(e){tp(e.data)},ip=function(e){Ph.postMessage(Jh(e),ch.protocol+"//"+ch.host)};Kh&&Xh||(Kh=function(e){Gh(arguments.length,1);var t=Lh(e)?e:Yh(e),r=Bh(arguments,1);return $h[++Zh]=function(){Nh(t,void 0,r)},uh(Zh),Zh},Xh=function(e){delete $h[e]},zh?uh=function(e){qh.nextTick(rp(e))}:Wh&&Wh.now?uh=function(e){Wh.now(rp(e))}:Qh&&!Hh?(lh=(dh=new Qh).port2,dh.port1.onmessage=np,uh=Mh(lh.postMessage,lh)):Ph.addEventListener&&Lh(Ph.postMessage)&&!Ph.importScripts&&ch&&"file:"!==ch.protocol&&!Vh(ip)?(uh=ip,Ph.addEventListener("message",np,!1)):uh=ep in jh("script")?function(e){Fh.appendChild(jh("script")).onreadystatechange=function(){Fh.removeChild(this),tp(e)}}:function(e){setTimeout(rp(e),0)});var ap,op,sp,cp,up,dp,lp,hp,pp={set:Kh,clear:Xh},fp=n,vp=/ipad|iphone|ipod/i.test(se)&&void 0!==fp.Pebble,_p=/web0s(?!.*chrome)/i.test(se),mp=n,yp=Yt,gp=R.f,Sp=pp.set,Ep=Dh,bp=vp,kp=_p,Tp=hh,Ip=mp.MutationObserver||mp.WebKitMutationObserver,Ap=mp.document,Rp=mp.process,Cp=mp.Promise,wp=gp(mp,"queueMicrotask"),xp=wp&&wp.value;xp||(ap=function(){var e,t;for(Tp&&(e=Rp.domain)&&e.exit();op;){t=op.fn,op=op.next;try{t()}catch(PX){throw op?cp():sp=void 0,PX}}sp=void 0,e&&e.enter()},Ep||Tp||kp||!Ip||!Ap?!bp&&Cp&&Cp.resolve?((lp=Cp.resolve(void 0)).constructor=Cp,hp=yp(lp.then,lp),cp=function(){hp(ap)}):Tp?cp=function(){Rp.nextTick(ap)}:(Sp=yp(Sp,mp),cp=function(){Sp(ap)}):(up=!0,dp=Ap.createTextNode(""),new Ip(ap).observe(dp,{characterData:!0}),cp=function(){dp.data=up=!up}));var Op=xp||function(e){var t={fn:e,next:void 0};sp&&(sp.next=t),op||(op=t,cp()),sp=t},Dp=n,Pp=function(e){try{return{error:!1,value:e()}}catch(PX){return{error:!0,value:PX}}},Np=function(){this.head=null,this.tail=null};Np.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 Mp=Np,Lp=n.Promise,Up="object"==typeof Deno&&Deno&&"object"==typeof Deno.version,Vp=!Up&&!hh&&"object"==typeof window&&"object"==typeof document,Fp=n,Bp=Lp,jp=A,Gp=Kt,Hp=ia,zp=lt,Kp=Vp,Xp=Up,qp=fe,Wp=Bp&&Bp.prototype,Yp=zp("species"),Qp=!1,Jp=jp(Fp.PromiseRejectionEvent),Zp={CONSTRUCTOR:Gp("Promise",(function(){var e=Hp(Bp),t=e!==String(Bp);if(!t&&66===qp)return!0;if(!Wp.catch||!Wp.finally)return!0;if(!qp||qp<51||!/native code/.test(e)){var r=new Bp((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};if((r.constructor={})[Yp]=n,!(Qp=r.then((function(){}))instanceof n))return!0}return!t&&(Kp||Xp)&&!Jp})),REJECTION_EVENT:Jp,SUBCLASSING:Qp},$p={},ef=we,tf=TypeError,rf=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw tf("Bad Promise constructor");t=e,r=n})),this.resolve=ef(t),this.reject=ef(r)};$p.f=function(e){return new rf(e)};var nf,af,of=Rr,sf=hh,cf=n,uf=O,df=li,lf=Mi,hf=mh,pf=we,ff=A,vf=$,_f=Sh,mf=wh,yf=pp.set,gf=Op,Sf=function(e,t){var r=Dp.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},Ef=Pp,bf=Mp,kf=Zi,Tf=Lp,If=Zp,Af=$p,Rf="Promise",Cf=If.CONSTRUCTOR,wf=If.REJECTION_EVENT,xf=kf.getterFor(Rf),Of=kf.set,Df=Tf&&Tf.prototype,Pf=Tf,Nf=Df,Mf=cf.TypeError,Lf=cf.document,Uf=cf.process,Vf=Af.f,Ff=Vf,Bf=!!(Lf&&Lf.createEvent&&cf.dispatchEvent),jf="unhandledrejection",Gf=function(e){var t;return!(!vf(e)||!ff(t=e.then))&&t},Hf=function(e,t){var r,n,i,a=t.value,o=1==t.state,s=o?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(o||(2===t.rejection&&Wf(t),t.rejection=1),!0===s?r=a:(d&&d.enter(),r=s(a),d&&(d.exit(),i=!0)),r===e.promise?u(Mf("Promise-chain cycle")):(n=Gf(r))?uf(n,r,c,u):c(r)):u(a)}catch(PX){d&&!i&&d.exit(),u(PX)}},zf=function(e,t){e.notified||(e.notified=!0,gf((function(){for(var r,n=e.reactions;r=n.get();)Hf(r,e);e.notified=!1,t&&!e.rejection&&Xf(e)})))},Kf=function(e,t,r){var n,i;Bf?((n=Lf.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),cf.dispatchEvent(n)):n={promise:t,reason:r},!wf&&(i=cf["on"+e])?i(n):e===jf&&Sf("Unhandled promise rejection",r)},Xf=function(e){uf(yf,cf,(function(){var t,r=e.facade,n=e.value;if(qf(e)&&(t=Ef((function(){sf?Uf.emit("unhandledRejection",n,r):Kf(jf,r,n)})),e.rejection=sf||qf(e)?2:1,t.error))throw t.value}))},qf=function(e){return 1!==e.rejection&&!e.parent},Wf=function(e){uf(yf,cf,(function(){var t=e.facade;sf?Uf.emit("rejectionHandled",t):Kf("rejectionhandled",t,e.value)}))},Yf=function(e,t,r){return function(n){e(t,n,r)}},Qf=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,zf(e,!0))},Jf=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Mf("Promise can't be resolved itself");var n=Gf(t);n?gf((function(){var r={done:!1};try{uf(n,t,Yf(Jf,r,e),Yf(Qf,r,e))}catch(PX){Qf(r,PX,e)}})):(e.value=t,e.state=1,zf(e,!1))}catch(PX){Qf({done:!1},PX,e)}}};Cf&&(Nf=(Pf=function(e){_f(this,Nf),pf(e),uf(nf,this);var t=xf(this);try{e(Yf(Jf,t),Yf(Qf,t))}catch(PX){Qf(t,PX)}}).prototype,(nf=function(e){Of(this,{type:Rf,done:!1,notified:!1,parent:!1,reactions:new bf,rejection:!1,state:0,value:void 0})}).prototype=df(Nf,"then",(function(e,t){var r=xf(this),n=Vf(mf(this,Pf));return r.parent=!0,n.ok=!ff(e)||e,n.fail=ff(t)&&t,n.domain=sf?Uf.domain:void 0,0==r.state?r.reactions.add(n):gf((function(){Hf(n,r)})),n.promise})),af=function(){var e=new nf,t=xf(e);this.promise=e,this.resolve=Yf(Jf,t),this.reject=Yf(Qf,t)},Af.f=Vf=function(e){return e===Pf||undefined===e?new af(e):Ff(e)}),of({global:!0,constructor:!0,wrap:!0,forced:Cf},{Promise:Pf}),lf(Pf,Rf,!1,!0),hf(Rf);var Zf=lt("iterator"),$f=!1;try{var ev=0,tv={next:function(){return{done:!!ev++}},return:function(){$f=!0}};tv[Zf]=function(){return this},Array.from(tv,(function(){throw 2}))}catch(PX){}var rv=function(e,t){if(!t&&!$f)return!1;var r=!1;try{var n={};n[Zf]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(PX){}return r},nv=Lp,iv=Zp.CONSTRUCTOR||!rv((function(e){nv.all(e).then(void 0,(function(){}))})),av=O,ov=we,sv=$p,cv=Pp,uv=Bl;Rr({target:"Promise",stat:!0,forced:iv},{all:function(e){var t=this,r=sv.f(t),n=r.resolve,i=r.reject,a=cv((function(){var r=ov(t.resolve),a=[],o=0,s=1;uv(e,(function(e){var c=o++,u=!1;s++,av(r,t,e).then((function(e){u||(u=!0,a[c]=e,--s||n(a))}),i)})),--s||n(a)}));return a.error&&i(a.value),r.promise}});var dv=Rr,lv=Zp.CONSTRUCTOR;Lp&&Lp.prototype,dv({target:"Promise",proto:!0,forced:lv,real:!0},{catch:function(e){return this.then(void 0,e)}});var hv=O,pv=we,fv=$p,vv=Pp,_v=Bl;Rr({target:"Promise",stat:!0,forced:iv},{race:function(e){var t=this,r=fv.f(t),n=r.reject,i=vv((function(){var i=pv(t.resolve);_v(e,(function(e){hv(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var mv=O,yv=$p;Rr({target:"Promise",stat:!0,forced:Zp.CONSTRUCTOR},{reject:function(e){var t=yv.f(this);return mv(t.reject,void 0,e),t.promise}});var gv=tr,Sv=$,Ev=$p,bv=function(e,t){if(gv(e),Sv(t)&&t.constructor===e)return t;var r=Ev.f(e);return(0,r.resolve)(t),r.promise},kv=Rr,Tv=Lp,Iv=Zp.CONSTRUCTOR,Av=bv,Rv=ae("Promise"),Cv=!Iv;kv({target:"Promise",stat:!0,forced:true},{resolve:function(e){return Av(Cv&&this===Rv?Tv:this,e)}});var wv=O,xv=we,Ov=$p,Dv=Pp,Pv=Bl;Rr({target:"Promise",stat:!0},{allSettled:function(e){var t=this,r=Ov.f(t),n=r.resolve,i=r.reject,a=Dv((function(){var r=xv(t.resolve),i=[],a=0,o=1;Pv(e,(function(e){var s=a++,c=!1;o++,wv(r,t,e).then((function(e){c||(c=!0,i[s]={status:"fulfilled",value:e},--o||n(i))}),(function(e){c||(c=!0,i[s]={status:"rejected",reason:e},--o||n(i))}))})),--o||n(i)}));return a.error&&i(a.value),r.promise}});var Nv=O,Mv=we,Lv=ae,Uv=$p,Vv=Pp,Fv=Bl,Bv="No one promise resolved";Rr({target:"Promise",stat:!0},{any:function(e){var t=this,r=Lv("AggregateError"),n=Uv.f(t),i=n.resolve,a=n.reject,o=Vv((function(){var n=Mv(t.resolve),o=[],s=0,c=1,u=!1;Fv(e,(function(e){var d=s++,l=!1;c++,Nv(n,t,e).then((function(e){l||u||(u=!0,i(e))}),(function(e){l||u||(l=!0,o[d]=e,--c||a(new r(o,Bv)))}))})),--c||a(new r(o,Bv))}));return o.error&&a(o.value),n.promise}});var jv=Rr,Gv=Lp,Hv=i,zv=ae,Kv=A,Xv=wh,qv=bv,Wv=Gv&&Gv.prototype;jv({target:"Promise",proto:!0,real:!0,forced:!!Gv&&Hv((function(){Wv.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=Xv(this,zv("Promise")),r=Kv(e);return this.then(r?function(r){return qv(t,e()).then((function(){return r}))}:e,r?function(r){return qv(t,e()).then((function(){throw r}))}:e)}});var Yv=b,Qv=Or,Jv=yn,Zv=q,$v=Yv("".charAt),e_=Yv("".charCodeAt),t_=Yv("".slice),r_=function(e){return function(t,r){var n,i,a=Jv(Zv(t)),o=Qv(r),s=a.length;return o<0||o>=s?e?"":void 0:(n=e_(a,o))<55296||n>56319||o+1===s||(i=e_(a,o+1))<56320||i>57343?e?$v(a,o):n:e?t_(a,o,o+2):i-56320+(n-55296<<10)+65536}},n_={codeAt:r_(!1),charAt:r_(!0)},i_=n_.charAt,a_=yn,o_=Zi,s_=iu,c_=au,u_="String Iterator",d_=o_.set,l_=o_.getterFor(u_);s_(String,"String",(function(e){d_(this,{type:u_,string:a_(e),index:0})}),(function(){var e,t=l_(this),r=t.string,n=t.index;return n>=r.length?c_(void 0,!0):(e=i_(r,n),t.index+=e.length,c_(e,!1))}));var h_=ee.Promise,p_=$p,f_=Pp;Rr({target:"Promise",stat:!0,forced:!0},{try:function(e){var t=p_.f(this),r=f_(e);return(r.error?t.reject:t.resolve)(r.value),t.promise}});var v_=h_;function __(e,t,r,n,i,a,o){try{var s=e[a](o),c=s.value}catch(PX){return void r(PX)}s.done?t(c):v_.resolve(c).then(n,i)}function m_(e){return function(){var t=this,r=arguments;return new v_((function(n,i){var a=e.apply(t,r);function o(e){__(a,n,i,o,s,"next",e)}function s(e){__(a,n,i,o,s,"throw",e)}o(void 0)}))}}var y_={exports:{}},g_={exports:{}},S_=TypeError,E_=function(e){if(e>9007199254740991)throw S_("Maximum allowed index exceeded");return e},b_=Rr,k_=i,T_=ea,I_=$,A_=Xe,R_=Br,C_=E_,w_=Jn,x_=Ia,O_=Ns,D_=fe,P_=lt("isConcatSpreadable"),N_=D_>=51||!k_((function(){var e=[];return e[P_]=!1,e.concat()[0]!==e})),M_=O_("concat"),L_=function(e){if(!I_(e))return!1;var t=e[P_];return void 0!==t?!!t:T_(e)};b_({target:"Array",proto:!0,arity:1,forced:!N_||!M_},{concat:function(e){var t,r,n,i,a,o=A_(this),s=x_(o,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(L_(a=-1===t?o:arguments[t]))for(i=R_(a),C_(c+i),r=0;r<i;r++,c++)r in a&&w_(s,c,a[r]);else C_(c+1),w_(s,c++,a);return s.length=c,s}}),Ei("asyncIterator"),Ei("hasInstance"),Ei("isConcatSpreadable"),Ei("iterator"),Ei("match"),Ei("matchAll"),Ei("replace"),Ei("search"),Ei("species"),Ei("split");var U_=Ai;Ei("toPrimitive"),U_();var V_=ae,F_=Mi;Ei("toStringTag"),F_(V_("Symbol"),"Symbol"),Ei("unscopables"),Mi(n.JSON,"JSON",!0);var B_=ee.Symbol;Ei("asyncDispose"),Ei("dispose"),Ei("matcher"),Ei("metadataKey"),Ei("observable"),Ei("metadata"),Ei("patternMatch"),Ei("replaceAll");var j_=B_,G_=hi.f("iterator");!function(e){var t=j_,r=G_;function n(i){return e.exports=n="function"==typeof t&&"symbol"==typeof r?function(e){return typeof e}:function(e){return e&&"function"==typeof t&&e.constructor===t&&e!==t.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,n(i)}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(g_),Rr({target:"Object",stat:!0,sham:!C},{create:Hn});var H_=ee.Object,z_=function(e,t){return H_.create(e,t)},K_=Xe,X_=mc,q_=uc;Rr({target:"Object",stat:!0,forced:i((function(){X_(1)})),sham:!q_},{getPrototypeOf:function(e){return X_(K_(e))}});var W_=ee.Object.getPrototypeOf;Rr({target:"Object",stat:!0},{setPrototypeOf:jc});var Y_=ee.Object.setPrototypeOf,Q_=Rr,J_=ea,Z_=b([].reverse),$_=[1,2];Q_({target:"Array",proto:!0,forced:String($_)===String($_.reverse())},{reverse:function(){return J_(this)&&(this.length=this.length),Z_(this)}});var em=Us("Array").reverse,tm=oe,rm=em,nm=Array.prototype,im=function(e){var t=e.reverse;return e===nm||tm(nm,e)&&t===nm.reverse?rm:t},am=Rr,om=ea,sm=ya,cm=$,um=Mr,dm=Br,lm=Q,hm=Jn,pm=lt,fm=rs,vm=Ns("slice"),_m=pm("species"),mm=Array,ym=Math.max;am({target:"Array",proto:!0,forced:!vm},{slice:function(e,t){var r,n,i,a=lm(this),o=dm(a),s=um(e,o),c=um(void 0===t?o:t,o);if(om(a)&&(r=a.constructor,(sm(r)&&(r===mm||om(r.prototype))||cm(r)&&null===(r=r[_m]))&&(r=void 0),r===mm||void 0===r))return fm(a,s,c);for(n=new(void 0===r?mm:r)(ym(c-s,0)),i=0;s<c;s++,i++)s in a&&hm(n,i,a[s]);return n.length=i,n}});var gm=Us("Array").slice,Sm=oe,Em=gm,bm=Array.prototype,km=function(e){var t=e.slice;return e===bm||Sm(bm,e)&&t===bm.slice?Em:t};!function(e){var t=g_.exports.default,r=od,n=j_,i=z_,a=W_,o=Mu,s=Y_,c=v_,u=im,d=km;function l(){e.exports=l=function(){return h},e.exports.__esModule=!0,e.exports.default=e.exports;var h={},p=Object.prototype,f=p.hasOwnProperty,v=r||function(e,t,r){e[t]=r.value},_="function"==typeof n?n:{},m=_.iterator||"@@iterator",y=_.asyncIterator||"@@asyncIterator",g=_.toStringTag||"@@toStringTag";function S(e,t,n){return r(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{S({},"")}catch(F){S=function(e,t,r){return e[t]=r}}function E(e,t,r,n){var a=t&&t.prototype instanceof T?t:T,o=i(a.prototype),s=new L(n||[]);return v(o,"_invoke",{value:D(e,r,s)}),o}function b(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(F){return{type:"throw",arg:F}}}h.wrap=E;var k={};function T(){}function I(){}function A(){}var R={};S(R,m,(function(){return this}));var C=a&&a(a(U([])));C&&C!==p&&f.call(C,m)&&(R=C);var w=A.prototype=T.prototype=i(R);function x(e){var t;o(t=["next","throw","return"]).call(t,(function(t){S(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,r){function n(i,a,o,s){var c=b(e[i],e,a);if("throw"!==c.type){var u=c.arg,d=u.value;return d&&"object"==t(d)&&f.call(d,"__await")?r.resolve(d.__await).then((function(e){n("next",e,o,s)}),(function(e){n("throw",e,o,s)})):r.resolve(d).then((function(e){u.value=e,o(u)}),(function(e){return n("throw",e,o,s)}))}s(c.arg)}var i;v(this,"_invoke",{value:function(e,t){function a(){return new r((function(r,i){n(e,t,r,i)}))}return i=i?i.then(a,a):a()}})}function D(e,t,r){var n="suspendedStart";return function(i,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw a;return{value:void 0,done:!0}}for(r.method=i,r.arg=a;;){var o=r.delegate;if(o){var s=P(o,r);if(s){if(s===k)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=b(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===k)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}function P(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,P(e,t),"throw"===t.method))return k;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return k}var n=b(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,k;var i=n.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,k):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,k)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function M(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function L(e){this.tryEntries=[{tryLoc:"root"}],o(e).call(e,N,this),this.reset(!0)}function U(e){if(e){var t=e[m];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,n=function t(){for(;++r<e.length;)if(f.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return n.next=n}}return{next:V}}function V(){return{value:void 0,done:!0}}return I.prototype=A,v(w,"constructor",{value:A,configurable:!0}),v(A,"constructor",{value:I,configurable:!0}),I.displayName=S(A,g,"GeneratorFunction"),h.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===I||"GeneratorFunction"===(t.displayName||t.name))},h.mark=function(e){return s?s(e,A):(e.__proto__=A,S(e,g,"GeneratorFunction")),e.prototype=i(w),e},h.awrap=function(e){return{__await:e}},x(O.prototype),S(O.prototype,y,(function(){return this})),h.AsyncIterator=O,h.async=function(e,t,r,n,i){void 0===i&&(i=c);var a=new O(E(e,t,r,n),i);return h.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},x(w),S(w,g,"Generator"),S(w,m,(function(){return this})),S(w,"toString",(function(){return"[object Generator]"})),h.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return u(r).call(r),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},h.values=U,L.prototype={constructor:L,reset:function(e){var t;if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,o(t=this.tryEntries).call(t,M),!e)for(var r in this)"t"===r.charAt(0)&&f.call(this,r)&&!isNaN(+d(r).call(r,1))&&(this[r]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,n){return a.type="throw",a.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var o=f.call(i,"catchLoc"),s=f.call(i,"finallyLoc");if(o&&s){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&f.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,k):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),k},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),M(r),k}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var i=n.arg;M(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:U(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),k}},h}e.exports=l,e.exports.__esModule=!0,e.exports.default=e.exports}(y_);var Tm=y_.exports(),Im=Tm;try{regeneratorRuntime=Tm}catch(NX){"object"==typeof globalThis?globalThis.regeneratorRuntime=Tm:Function("r","regeneratorRuntime = r")(Tm)}var Am=Us("Array").concat,Rm=oe,Cm=Am,wm=Array.prototype,xm=function(e){var t=e.concat;return e===wm||Rm(wm,e)&&t===wm.concat?Cm:t},Om=Kr.includes;Rr({target:"Array",proto:!0,forced:i((function(){return!Array(1).includes()}))},{includes:function(e){return Om(this,e,arguments.length>1?arguments[1]:void 0)}});var Dm=Us("Array").includes,Pm=$,Nm=g,Mm=lt("match"),Lm=function(e){var t;return Pm(e)&&(void 0!==(t=e[Mm])?!!t:"RegExp"==Nm(e))},Um=TypeError,Vm=function(e){if(Lm(e))throw Um("The method doesn't accept regular expressions");return e},Fm=lt("match"),Bm=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Fm]=!1,"/./"[e](t)}catch(n){}}return!1},jm=Rr,Gm=Vm,Hm=q,zm=yn,Km=Bm,Xm=b("".indexOf);jm({target:"String",proto:!0,forced:!Km("includes")},{includes:function(e){return!!~Xm(zm(Hm(this)),zm(Gm(e)),arguments.length>1?arguments[1]:void 0)}});var qm=Us("String").includes,Wm=oe,Ym=Dm,Qm=qm,Jm=Array.prototype,Zm=String.prototype,$m=function(e){var t=e.includes;return e===Jm||Wm(Jm,e)&&t===Jm.includes?Ym:"string"==typeof e||e===Zm||Wm(Zm,e)&&t===Zm.includes?Qm:t},ey=ee,ty=d;ey.JSON||(ey.JSON={stringify:JSON.stringify});var ry=function(e,t,r){return ty(ey.JSON.stringify,null,arguments)},ny=ry,iy=Pa.map;Rr({target:"Array",proto:!0,forced:!Ns("map")},{map:function(e){return iy(this,e,arguments.length>1?arguments[1]:void 0)}});var ay=Us("Array").map,oy=oe,sy=ay,cy=Array.prototype,uy=function(e){var t=e.map;return e===cy||oy(cy,e)&&t===cy.map?sy:t};function dy(e){return(dy="function"==typeof j_&&"symbol"==typeof G_?function(e){return typeof e}:function(e){return e&&"function"==typeof j_&&e.constructor===j_&&e!==j_.prototype?"symbol":typeof e})(e)}var ly="\t\n\v\f\r                 \u2028\u2029\ufeff",hy=q,py=yn,fy=b("".replace),vy="[\t\n\v\f\r                 \u2028\u2029\ufeff]",_y=RegExp("^"+vy+vy+"*"),my=RegExp(vy+vy+"*$"),yy=function(e){return function(t){var r=py(hy(t));return 1&e&&(r=fy(r,_y,"")),2&e&&(r=fy(r,my,"")),r}},gy={start:yy(1),end:yy(2),trim:yy(3)},Sy=n,Ey=i,by=b,ky=yn,Ty=gy.trim,Iy=ly,Ay=Sy.parseInt,Ry=Sy.Symbol,Cy=Ry&&Ry.iterator,wy=/^[+-]?0x/i,xy=by(wy.exec),Oy=8!==Ay(Iy+"08")||22!==Ay(Iy+"0x16")||Cy&&!Ey((function(){Ay(Object(Cy))}))?function(e,t){var r=Ty(ky(e));return Ay(r,t>>>0||(xy(wy,r)?16:10))}:Ay;Rr({global:!0,forced:parseInt!=Oy},{parseInt:Oy});var Dy=ee.parseInt,Py={exports:{}},Ny=i((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),My=i,Ly=$,Uy=g,Vy=Ny,Fy=Object.isExtensible,By=My((function(){Fy(1)}))||Vy?function(e){return!!Ly(e)&&((!Vy||"ArrayBuffer"!=Uy(e))&&(!Fy||Fy(e)))}:Fy,jy=!i((function(){return Object.isExtensible(Object.preventExtensions({}))})),Gy=Rr,Hy=b,zy=Xr,Ky=$,Xy=Ye,qy=Qt.f,Wy=zn,Yy=qn,Qy=By,Jy=jy,Zy=!1,$y=et("meta"),eg=0,tg=function(e){qy(e,$y,{value:{objectID:"O"+eg++,weakData:{}}})},rg=Py.exports={enable:function(){rg.enable=function(){},Zy=!0;var e=Wy.f,t=Hy([].splice),r={};r[$y]=1,e(r).length&&(Wy.f=function(r){for(var n=e(r),i=0,a=n.length;i<a;i++)if(n[i]===$y){t(n,i,1);break}return n},Gy({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:Yy.f}))},fastKey:function(e,t){if(!Ky(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Xy(e,$y)){if(!Qy(e))return"F";if(!t)return"E";tg(e)}return e[$y].objectID},getWeakData:function(e,t){if(!Xy(e,$y)){if(!Qy(e))return!0;if(!t)return!1;tg(e)}return e[$y].weakData},onFreeze:function(e){return Jy&&Zy&&Qy(e)&&!Xy(e,$y)&&tg(e),e}};zy[$y]=!0;var ng=Rr,ig=n,ag=Py.exports,og=i,sg=vr,cg=Bl,ug=Sh,dg=A,lg=$,hg=Mi,pg=Qt.f,fg=Pa.forEach,vg=C,_g=Zi.set,mg=Zi.getterFor,yg=function(e,t,r){var n,i=-1!==e.indexOf("Map"),a=-1!==e.indexOf("Weak"),o=i?"set":"add",s=ig[e],c=s&&s.prototype,u={};if(vg&&dg(s)&&(a||c.forEach&&!og((function(){(new s).entries().next()})))){var d=(n=t((function(t,r){_g(ug(t,d),{type:e,collection:new s}),null!=r&&cg(r,t[o],{that:t,AS_ENTRIES:i})}))).prototype,l=mg(e);fg(["add","clear","delete","forEach","get","has","set","keys","values","entries"],(function(e){var t="add"==e||"set"==e;!(e in c)||a&&"clear"==e||sg(d,e,(function(r,n){var i=l(this).collection;if(!t&&a&&!lg(r))return"get"==e&&void 0;var o=i[e](0===r?0:r,n);return t?this:o}))})),a||pg(d,"size",{configurable:!0,get:function(){return l(this).collection.size}})}else n=r.getConstructor(t,e,i,o),ag.enable();return hg(n,e,!1,!0),u[e]=n,ng({global:!0,forced:!0},u),a||r.setStrong(n,e,i),n},gg=li,Sg=function(e,t,r){for(var n in t)r&&r.unsafe&&e[n]?e[n]=t[n]:gg(e,n,t[n],r);return e},Eg=Qt.f,bg=Hn,kg=Sg,Tg=Yt,Ig=Sh,Ag=z,Rg=Bl,Cg=iu,wg=au,xg=mh,Og=C,Dg=Py.exports.fastKey,Pg=Zi.set,Ng=Zi.getterFor,Mg={getConstructor:function(e,t,r,n){var i=e((function(e,i){Ig(e,a),Pg(e,{type:t,index:bg(null),first:void 0,last:void 0,size:0}),Og||(e.size=0),Ag(i)||Rg(i,e[n],{that:e,AS_ENTRIES:r})})),a=i.prototype,o=Ng(t),s=function(e,t,r){var n,i,a=o(e),s=c(e,t);return s?s.value=r:(a.last=s={index:i=Dg(t,!0),key:t,value:r,previous:n=a.last,next:void 0,removed:!1},a.first||(a.first=s),n&&(n.next=s),Og?a.size++:e.size++,"F"!==i&&(a.index[i]=s)),e},c=function(e,t){var r,n=o(e),i=Dg(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return kg(a,{clear:function(){for(var e=o(this),t=e.index,r=e.first;r;)r.removed=!0,r.previous&&(r.previous=r.previous.next=void 0),delete t[r.index],r=r.next;e.first=e.last=void 0,Og?e.size=0:this.size=0},delete:function(e){var t=this,r=o(t),n=c(t,e);if(n){var i=n.next,a=n.previous;delete r.index[n.index],n.removed=!0,a&&(a.next=i),i&&(i.previous=a),r.first==n&&(r.first=i),r.last==n&&(r.last=a),Og?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=o(this),n=Tg(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(n(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),kg(a,r?{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)}}),Og&&Eg(a,"size",{get:function(){return o(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Ng(t),a=Ng(n);Cg(e,t,(function(e,t){Pg(this,{type:n,target:e,state:i(e),kind:t,last:void 0})}),(function(){for(var e=a(this),t=e.kind,r=e.last;r&&r.removed;)r=r.previous;return e.target&&(e.last=r=r?r.next:e.state.first)?wg("keys"==t?r.key:"values"==t?r.value:[r.key,r.value],!1):(e.target=void 0,wg(void 0,!0))}),r?"entries":"values",!r,!0),xg(t)}};yg("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Mg);var Lg=ee.Map,Ug=Yt,Vg=O,Fg=we,Bg=Th,jg=z,Gg=Bl,Hg=[].push,zg=function(e){var t,r,n,i,a=arguments.length,o=a>1?arguments[1]:void 0;return Bg(this),(t=void 0!==o)&&Fg(o),jg(e)?new this:(r=[],t?(n=0,i=Ug(o,a>2?arguments[2]:void 0),Gg(e,(function(e){Vg(Hg,r,i(e,n++))}))):Gg(e,Hg,{that:r}),new this(r))};Rr({target:"Map",stat:!0,forced:!0},{from:zg});var Kg=rs,Xg=function(){return new this(Kg(arguments))};Rr({target:"Map",stat:!0,forced:!0},{of:Xg});var qg=O,Wg=we,Yg=tr,Qg=function(){for(var e,t=Yg(this),r=Wg(t.delete),n=!0,i=0,a=arguments.length;i<a;i++)e=qg(r,t,arguments[i]),n=n&&e;return!!n};Rr({target:"Map",proto:!0,real:!0,forced:!0},{deleteAll:Qg});var Jg=O,Zg=we,$g=tr,eS=function(e,t){var r,n,i=$g(this),a=Zg(i.get),o=Zg(i.has),s=Zg(i.set);return Jg(o,i,e)?(r=Jg(a,i,e),"update"in t&&(r=t.update(r,e,i),Jg(s,i,e,r)),r):(n=t.insert(e,i),Jg(s,i,e,n),n)};Rr({target:"Map",proto:!0,real:!0,forced:!0},{emplace:eS});var tS=bl,rS=tr,nS=Yt,iS=tS,aS=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{every:function(e){var t=rS(this),r=iS(t),n=nS(e,arguments.length>1?arguments[1]:void 0);return!aS(r,(function(e,r,i){if(!n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var oS=ae,sS=Yt,cS=O,uS=we,dS=tr,lS=wh,hS=tS,pS=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{filter:function(e){var t=dS(this),r=hS(t),n=sS(e,arguments.length>1?arguments[1]:void 0),i=new(lS(t,oS("Map"))),a=uS(i.set);return pS(r,(function(e,r){n(r,e,t)&&cS(a,i,e,r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var fS=tr,vS=Yt,_S=tS,mS=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{find:function(e){var t=fS(this),r=_S(t),n=vS(e,arguments.length>1?arguments[1]:void 0);return mS(r,(function(e,r,i){if(n(r,e,t))return i(r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var yS=tr,gS=Yt,SS=tS,ES=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{findKey:function(e){var t=yS(this),r=SS(t),n=gS(e,arguments.length>1?arguments[1]:void 0);return ES(r,(function(e,r,i){if(n(r,e,t))return i(e)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var bS=Rr,kS=O,TS=we,IS=bl,AS=Bl,RS=b([].push);bS({target:"Map",stat:!0,forced:!0},{groupBy:function(e,t){TS(t);var r=IS(e),n=new this,i=TS(n.has),a=TS(n.get),o=TS(n.set);return AS(r,(function(e){var r=t(e);kS(i,n,r)?RS(kS(a,n,r),e):kS(o,n,r,[e])}),{IS_ITERATOR:!0}),n}});var CS=tr,wS=tS,xS=function(e,t){return e===t||e!=e&&t!=t},OS=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{includes:function(e){return OS(wS(CS(this)),(function(t,r,n){if(xS(r,e))return n()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var DS=O,PS=Bl,NS=we;Rr({target:"Map",stat:!0,forced:!0},{keyBy:function(e,t){var r=new this;NS(t);var n=NS(r.set);return PS(e,(function(e){DS(n,r,t(e),e)})),r}});var MS=tr,LS=tS,US=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{keyOf:function(e){return US(LS(MS(this)),(function(t,r,n){if(r===e)return n(t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var VS=ae,FS=Yt,BS=O,jS=we,GS=tr,HS=wh,zS=tS,KS=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{mapKeys:function(e){var t=GS(this),r=zS(t),n=FS(e,arguments.length>1?arguments[1]:void 0),i=new(HS(t,VS("Map"))),a=jS(i.set);return KS(r,(function(e,r){BS(a,i,n(r,e,t),r)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var XS=ae,qS=Yt,WS=O,YS=we,QS=tr,JS=wh,ZS=tS,$S=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{mapValues:function(e){var t=QS(this),r=ZS(t),n=qS(e,arguments.length>1?arguments[1]:void 0),i=new(JS(t,XS("Map"))),a=YS(i.set);return $S(r,(function(e,r){WS(a,i,e,n(r,e,t))}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),i}});var eE=we,tE=tr,rE=Bl;Rr({target:"Map",proto:!0,real:!0,arity:1,forced:!0},{merge:function(e){for(var t=tE(this),r=eE(t.set),n=arguments.length,i=0;i<n;)rE(arguments[i++],r,{that:t,AS_ENTRIES:!0});return t}});var nE=tr,iE=we,aE=tS,oE=Bl,sE=TypeError;Rr({target:"Map",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=nE(this),r=aE(t),n=arguments.length<2,i=n?void 0:arguments[1];if(iE(e),oE(r,(function(r,a){n?(n=!1,i=a):i=e(i,a,r,t)}),{AS_ENTRIES:!0,IS_ITERATOR:!0}),n)throw sE("Reduce of empty map with no initial value");return i}});var cE=tr,uE=Yt,dE=tS,lE=Bl;Rr({target:"Map",proto:!0,real:!0,forced:!0},{some:function(e){var t=cE(this),r=dE(t),n=uE(e,arguments.length>1?arguments[1]:void 0);return lE(r,(function(e,r,i){if(n(r,e,t))return i()}),{AS_ENTRIES:!0,IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var hE=O,pE=tr,fE=we,vE=TypeError;Rr({target:"Map",proto:!0,real:!0,forced:!0},{update:function(e,t){var r=pE(this),n=fE(r.get),i=fE(r.has),a=fE(r.set),o=arguments.length;fE(t);var s=hE(i,r,e);if(!s&&o<3)throw vE("Updating absent value");var c=s?hE(n,r,e):fE(o>2?arguments[2]:void 0)(e,r);return hE(a,r,e,t(c,e,r)),r}});var _E=O,mE=we,yE=A,gE=tr,SE=TypeError,EE=function(e,t){var r,n=gE(this),i=mE(n.get),a=mE(n.has),o=mE(n.set),s=arguments.length>2?arguments[2]:void 0;if(!yE(t)&&!yE(s))throw SE("At least one callback required");return _E(a,n,e)?(r=_E(i,n,e),yE(t)&&(r=t(r),_E(o,n,e,r))):yE(s)&&(r=s(),_E(o,n,e,r)),r};Rr({target:"Map",proto:!0,real:!0,forced:!0},{upsert:EE}),Rr({target:"Map",proto:!0,real:!0,name:"upsert",forced:!0},{updateOrInsert:EE});var bE=Lg,kE=we,TE=Xe,IE=H,AE=Br,RE=TypeError,CE=function(e){return function(t,r,n,i){kE(r);var a=TE(t),o=IE(a),s=AE(a),c=e?s-1:0,u=e?-1:1;if(n<2)for(;;){if(c in o){i=o[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw RE("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in o&&(i=r(i,o[c],c,a));return i}},wE={left:CE(!1),right:CE(!0)}.left,xE=fe,OE=hh;Rr({target:"Array",proto:!0,forced:!Iu("reduce")||!OE&&xE>79&&xE<83},{reduce:function(e){var t=arguments.length;return wE(this,e,t,t>1?arguments[1]:void 0)}});var DE=Us("Array").reduce,PE=oe,NE=DE,ME=Array.prototype,LE=function(e){var t=e.reduce;return e===ME||PE(ME,e)&&t===ME.reduce?NE:t},UE=C,VE=b,FE=O,BE=i,jE=rn,GE=ui,HE=D,zE=Xe,KE=H,XE=Object.assign,qE=Object.defineProperty,WE=VE([].concat),YE=!XE||BE((function(){if(UE&&1!==XE({b:1},XE(qE({},"a",{enumerable:!0,get:function(){qE(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),n="abcdefghijklmnopqrst";return e[r]=7,n.split("").forEach((function(e){t[e]=e})),7!=XE({},e)[r]||jE(XE({},t)).join("")!=n}))?function(e,t){for(var r=zE(e),n=arguments.length,i=1,a=GE.f,o=HE.f;n>i;)for(var s,c=KE(arguments[i++]),u=a?WE(jE(c),a(c)):jE(c),d=u.length,l=0;d>l;)s=u[l++],UE&&!FE(o,c,s)||(r[s]=c[s]);return r}:XE,QE=YE;Rr({target:"Object",stat:!0,arity:2,forced:Object.assign!==QE},{assign:QE});var JE=ee.Object.assign,ZE=Rr,$E=b;R.f;var eb=Vr,tb=yn,rb=Vm,nb=q,ib=Bm,ab=$E("".endsWith),ob=$E("".slice),sb=Math.min;ZE({target:"String",proto:!0,forced:!ib("endsWith")},{endsWith:function(e){var t=tb(nb(this));rb(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:sb(eb(r),n),a=tb(e);return ab?ab(t,a,i):ob(t,i-a.length,i)===a}});var cb=Us("String").endsWith,ub=oe,db=cb,lb=String.prototype,hb=function(e){var t=e.endsWith;return"string"==typeof e||e===lb||ub(lb,e)&&t===lb.endsWith?db:t},pb=!0,fb=!0;function vb(e,t,r){var n=e.match(t);return n&&n.length>=r&&Dy(n[r],10)}function _b(e,t,r){if(e.RTCPeerConnection){var n=e.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(e,n){if(e!==t)return i.apply(this,arguments);var a=function(e){var t=r(e);t&&(n.handleEvent?n.handleEvent(t):n(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new bE),this._eventMap[t].set(n,a),i.apply(this,[e,a])};var a=n.removeEventListener;n.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return a.apply(this,arguments);if(!this._eventMap[t].has(r))return a.apply(this,arguments);var n=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===on(this._eventMap).length&&delete this._eventMap,a.apply(this,[e,n])},od(n,"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 mb(e){return"boolean"!=typeof e?new Error("Argument type: "+dy(e)+". Please use a boolean."):(pb=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function yb(e){return"boolean"!=typeof e?new Error("Argument type: "+dy(e)+". Please use a boolean."):(fb=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function gb(){if("object"===("undefined"==typeof window?"undefined":dy(window))){if(pb)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function Sb(e,t){fb&&console.warn(e+" is deprecated, please use "+t+" instead.")}function Eb(e){var t={browser:null,version:null};if(void 0===e||!e.navigator)return t.browser="Not a browser.",t;var r=e.navigator;if(r.mozGetUserMedia)t.browser="firefox",t.version=vb(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection)t.browser="chrome",t.version=vb(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else{if(!e.RTCPeerConnection||!r.userAgent.match(/AppleWebKit\/(\d+)\./))return t.browser="Not a supported browser.",t;t.browser="safari",t.version=vb(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function bb(e){return"[object Object]"===Object.prototype.toString.call(e)}function kb(e){var t;return bb(e)?LE(t=on(e)).call(t,(function(t,r){var n=bb(e[r]),i=n?kb(e[r]):e[r],a=n&&!on(i).length;return void 0===i||a?t:JE(t,sd({},r,i))}),{}):e}function Tb(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),on(t).forEach((function(n){hb(n).call(n,"Id")?Tb(e,e.get(t[n]),r):hb(n).call(n,"Ids")&&t[n].forEach((function(t){Tb(e,e.get(t),r)}))})))}function Ib(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new bE;if(null===t)return i;var a=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&a.push(e)})),a.forEach((function(t){e.forEach((function(r){r.type===n&&r.trackId===t.id&&Tb(e,r,i)}))})),i}var Ab=Rr,Rb=Pa.find,Cb="find",wb=!0;Cb in[]&&Array(1).find((function(){wb=!1})),Ab({target:"Array",proto:!0,forced:wb},{find:function(e){return Rb(this,e,arguments.length>1?arguments[1]:void 0)}});var xb=Us("Array").find,Ob=oe,Db=xb,Pb=Array.prototype,Nb=function(e){var t=e.find;return e===Pb||Ob(Pb,e)&&t===Pb.find?Db:t},Mb=Rr,Lb=Kr.indexOf,Ub=Iu,Vb=b([].indexOf),Fb=!!Vb&&1/Vb([1],1,-0)<0,Bb=Ub("indexOf");Mb({target:"Array",proto:!0,forced:Fb||!Bb},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Fb?Vb(this,e,t)||0:Lb(this,e,t)}});var jb=Us("Array").indexOf,Gb=oe,Hb=jb,zb=Array.prototype,Kb=function(e){var t=e.indexOf;return e===zb||Gb(zb,e)&&t===zb.indexOf?Hb:t},Xb=C,qb=ea,Wb=TypeError,Yb=Object.getOwnPropertyDescriptor,Qb=Xb&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(PX){return PX instanceof TypeError}}(),Jb=Ie,Zb=TypeError,$b=function(e,t){if(!delete e[t])throw Zb("Cannot delete property "+Jb(t)+" of "+Jb(e))},ek=Rr,tk=Xe,rk=Mr,nk=Or,ik=Br,ak=Qb?function(e,t){if(qb(e)&&!Yb(e,"length").writable)throw Wb("Cannot set read only .length");return e.length=t}:function(e,t){return e.length=t},ok=E_,sk=Ia,ck=Jn,uk=$b,dk=Ns("splice"),lk=Math.max,hk=Math.min;ek({target:"Array",proto:!0,forced:!dk},{splice:function(e,t){var r,n,i,a,o,s,c=tk(this),u=ik(c),d=rk(e,u),l=arguments.length;for(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=hk(lk(nk(t),0),u-d)),ok(u+r-n),i=sk(c,n),a=0;a<n;a++)(o=d+a)in c&&ck(i,a,c[o]);if(i.length=n,r<n){for(a=d;a<u-n;a++)s=a+r,(o=a+n)in c?c[s]=c[o]:uk(c,s);for(a=u;a>u-n+r;a--)uk(c,a-1)}else if(r>n)for(a=u-n;a>d;a--)s=a+r-1,(o=a+n-1)in c?c[s]=c[o]:uk(c,s);for(a=0;a<r;a++)c[a+d]=arguments[a+2];return ak(c,u-n+r),i}});var pk=Us("Array").splice,fk=oe,vk=pk,_k=Array.prototype,mk=function(e){var t=e.splice;return e===_k||fk(_k,e)&&t===_k.splice?vk:t},yk=gb;function gk(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==dy(e)||e.mandatory||e.optional)return e;var t,r={};(on(e).forEach((function(t){if("require"!==t&&"advanced"!==t&&"mediaSource"!==t){var n="object"===dy(e[t])?e[t]:{ideal:e[t]};void 0!==n.exact&&"number"==typeof n.exact&&(n.min=n.max=n.exact);var i=function(e,t){return e?e+t.charAt(0).toUpperCase()+km(t).call(t,1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){r.optional=r.optional||[];var a={};"number"==typeof n.ideal?(a[i("min",t)]=n.ideal,r.optional.push(a),(a={})[i("max",t)]=n.ideal,r.optional.push(a)):(a[i("",t)]=n.ideal,r.optional.push(a))}void 0!==n.exact&&"number"!=typeof n.exact?(r.mandatory=r.mandatory||{},r.mandatory[i("",t)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(r.mandatory=r.mandatory||{},r.mandatory[i(e,t)]=n[e])}))}})),e.advanced)&&(r.optional=xm(t=r.optional||[]).call(t,e.advanced));return r},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(ny(e)))&&"object"===dy(e.audio)){var a=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])};a((e=JSON.parse(ny(e))).audio,"autoGainControl","googAutoGainControl"),a(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===dy(e.video)){var o=e.video.facingMode;o=o&&("object"===dy(o)?o:{ideal:o});var s,c=t.version<66;if(o&&("user"===o.exact||"environment"===o.exact||"user"===o.ideal||"environment"===o.ideal)&&(!r.mediaDevices.getSupportedConstraints||!r.mediaDevices.getSupportedConstraints().facingMode||c))if(delete e.video.facingMode,"environment"===o.exact||"environment"===o.ideal?s=["back","rear"]:"user"!==o.exact&&"user"!==o.ideal||(s=["front"]),s)return r.mediaDevices.enumerateDevices().then((function(t){t=Gs(t).call(t,(function(e){return"videoinput"===e.kind}));var r=Nb(t).call(t,(function(e){return s.some((function(t){var r;return $m(r=e.label.toLowerCase()).call(r,t)}))}));return!r&&t.length&&$m(s).call(s,"back")&&(r=t[t.length-1]),r&&(e.video.deviceId=o.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),yk("chrome: "+ny(e)),i(e)}));e.video=n(e.video)}return yk("chrome: "+ny(e)),i(e)},a=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,n){i(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){n&&n(a(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var o=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return i(e,(function(e){return o(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 v_.reject(a(e))}))}))}}}}function Sk(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Ek(e){if("object"===dy(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){od(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 t=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){var r=this;return this._ontrackpoly||(this._ontrackpoly=function(t){t.stream.addEventListener("addtrack",(function(n){var i,a;e.RTCPeerConnection.prototype.getReceivers?i=Nb(a=r.getReceivers()).call(a,(function(e){return e.track&&e.track.id===n.track.id})):i={track:n.track};var o=new Event("track");o.track=n.track,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)})),t.stream.getTracks().forEach((function(n){var i,a;e.RTCPeerConnection.prototype.getReceivers?i=Nb(a=r.getReceivers()).call(a,(function(e){return e.track&&e.track.id===n.id})):i={track:n};var o=new Event("track");o.track=n,o.receiver=i,o.transceiver={receiver:i},o.streams=[t.stream],r.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else _b(e,"track",(function(e){return e.transceiver||od(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function bk(e){if("object"===dy(e)&&e.RTCPeerConnection&&!("getSenders"in e.RTCPeerConnection.prototype)&&"createDTMFSender"in e.RTCPeerConnection.prototype){var t=function(e,t){return{track:t,get dtmf(){return void 0===this._dtmf&&("audio"===t.kind?this._dtmf=e.createDTMFSender(t):this._dtmf=null),this._dtmf},_pc:e}};if(!e.RTCPeerConnection.prototype.getSenders){e.RTCPeerConnection.prototype.getSenders=function(){var e;return this._senders=this._senders||[],km(e=this._senders).call(e)};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,n){var i=r.apply(this,arguments);return i||(i=t(this,e),this._senders.push(i)),i};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t;n.apply(this,arguments);var r,i=Kb(t=this._senders).call(t,e);-1!==i&&mk(r=this._senders).call(r,i,1)}}var i=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],i.apply(this,[e]),e.getTracks().forEach((function(e){r._senders.push(t(r,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 r,n,i,a=Nb(r=t._senders).call(r,(function(t){return t.track===e}));a&&mk(n=t._senders).call(n,Kb(i=t._senders).call(i,a),1)}))}}else if("object"===dy(e)&&e.RTCPeerConnection&&"getSenders"in e.RTCPeerConnection.prototype&&"createDTMFSender"in e.RTCPeerConnection.prototype&&e.RTCRtpSender&&!("dtmf"in e.RTCRtpSender.prototype)){var o=e.RTCPeerConnection.prototype.getSenders;e.RTCPeerConnection.prototype.getSenders=function(){var e=this,t=o.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t},od(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 kk(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=km(Array.prototype).call(arguments),n=r[0],i=r[1],a=r[2];if(arguments.length>0&&"function"==typeof n)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof n))return t.apply(this,[]);var o=function(e){var t={};return e.result().forEach((function(e){var r={id:e.id,timestamp:e.timestamp,type:{localcandidate:"local-candidate",remotecandidate:"remote-candidate"}[e.type]||e.type};e.names().forEach((function(t){r[t]=e.stat(t)})),t[r.id]=r})),t},s=function(e){var t;return new bE(uy(t=on(e)).call(t,(function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){i(s(o(e)))};return t.apply(this,[c,n])}return new v_((function(r,n){t.apply(e,[function(e){r(s(o(e)))},n])})).then(i,a)}}}function Tk(e){if("object"===dy(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&e.RTCRtpReceiver){if(!("getStats"in e.RTCRtpSender.prototype)){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});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 Ib(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}),_b(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 Ib(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,n,a=arguments[0];return this.getSenders().forEach((function(e){e.track===a&&(t?n=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===a&&(r?n=!0:r=e),e.track===a})),n||t&&r?v_.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():v_.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Ik(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e,t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},uy(e=on(this._shimmedLocalStreams)).call(e,(function(e){return t._shimmedLocalStreams[e][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){var n;if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===Kb(n=this._shimmedLocalStreams[r.id]).call(n,i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t,n,i=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){var t;if(Nb(t=i.getSenders()).call(t,(function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var a=this.getSenders();r.apply(this,arguments);var o=Gs(t=this.getSenders()).call(t,(function(e){return-1===Kb(a).call(a,e)}));this._shimmedLocalStreams[e.id]=xm(n=[e]).call(n,o)};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],n.apply(this,arguments)};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&on(this._shimmedLocalStreams).forEach((function(r){var n,i,a=Kb(n=t._shimmedLocalStreams[r]).call(n,e);-1!==a&&mk(i=t._shimmedLocalStreams[r]).call(i,a,1);1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function Ak(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Ik(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},uy(t).call(t,(function(t){return e._reverseStreams[t.id]}))};var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(t){var r=this;if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},t.getTracks().forEach((function(e){var t;if(Nb(t=r.getSenders()).call(t,(function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var i=new e.MediaStream(t.getTracks());this._streams[t.id]=i,this._reverseStreams[i.id]=t,t=i}n.apply(this,[t])};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},i.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){var n,i,a,o=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var s=km([]).call(arguments,1);if(1!==s.length||!Nb(n=s[0].getTracks()).call(n,(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 c=Nb(i=this.getSenders()).call(i,(function(e){return e.track===t}));if(c)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var u=this._streams[r.id];if(u)u.addTrack(t),v_.resolve().then((function(){o.dispatchEvent(new Event("negotiationneeded"))}));else{var d=new e.MediaStream([t]);this._streams[r.id]=d,this._reverseStreams[d.id]=r,this.addStream(d)}return Nb(a=this.getSenders()).call(a,(function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=sd({},t,(function(){var e=this,t=arguments,n=arguments.length&&"function"==typeof arguments[0];return n?r.apply(this,[function(r){var n=s(e,r);t[0].apply(null,[n])},function(e){t[1]&&t[1].apply(null,e)},arguments[2]]):r.apply(this,arguments).then((function(t){return s(e,t)}))}));e.RTCPeerConnection.prototype[t]=n[t]}));var a=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),a.apply(this,arguments)):a.apply(this,arguments)};var o=tc(e.RTCPeerConnection.prototype,"localDescription");od(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=o.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,r=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||{},on(this._streams).forEach((function(n){var i;Nb(i=r._streams[n].getTracks()).call(i,(function(t){return e.track===t}))&&(t=r._streams[n])})),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 r=t.sdp;return on(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return on(e._reverseStreams||[]).forEach((function(t){var n=e._reverseStreams[t],i=e._streams[n.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function Rk(e,t){!e.RTCPeerConnection&&e.webkitRTCPeerConnection&&(e.RTCPeerConnection=e.webkitRTCPeerConnection),e.RTCPeerConnection&&t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=sd({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[t]}))}function Ck(e,t){_b(e,"negotiationneeded",(function(e){var r=e.target;if(!(t.version<72||r.getConfiguration&&"plan-b"===r.getConfiguration().sdpSemantics)||"stable"===r.signalingState)return e}))}var wk=Object.freeze(Object.defineProperty({__proto__:null,shimMediaStream:Sk,shimOnTrack:Ek,shimGetSendersWithDtmf:bk,shimGetStats:kk,shimSenderReceiverGetStats:Tk,shimAddTrackRemoveTrackWithNative:Ik,shimAddTrackRemoveTrack:Ak,shimPeerConnection:Rk,fixNegotiationNeeded:Ck,shimGetUserMedia:gk,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&("function"==typeof t?e.navigator.mediaDevices.getDisplayMedia=function(r){return t(r).then((function(t){var n=r.video&&r.video.width,i=r.video&&r.video.height,a=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:a||3}},n&&(r.video.mandatory.maxWidth=n),i&&(r.video.mandatory.maxHeight=i),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}},Symbol.toStringTag,{value:"Module"}));Rr({target:"Array",stat:!0},{isArray:ea});var xk=ee.Array.isArray;function Ok(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var Dk=vl,Pk=tr,Nk=Al,Mk=Yt,Lk=O,Uk=Xe,Vk=function(e,t,r,n){try{return n?t(Pk(r)[0],r[1]):t(r)}catch(PX){Nk(e,"throw",PX)}},Fk=ul,Bk=ya,jk=Br,Gk=Jn,Hk=bl,zk=vl,Kk=Array,Xk=function(e){var t=Uk(e),r=Bk(this),n=arguments.length,i=n>1?arguments[1]:void 0,a=void 0!==i;a&&(i=Mk(i,n>2?arguments[2]:void 0));var o,s,c,u,d,l,h=zk(t),p=0;if(!h||this===Kk&&Fk(h))for(o=jk(t),s=r?new this(o):Kk(o);o>p;p++)l=a?i(t[p],p):t[p],Gk(s,p,l);else for(d=(u=Hk(t,h)).next,s=r?new this:[];!(c=Lk(d,u)).done;p++)l=a?Vk(u,i,[c.value,p],!0):c.value,Gk(s,p,l);return s.length=p,s},qk=Xk;Rr({target:"Array",stat:!0,forced:!rv((function(e){Array.from(e)}))},{from:qk});var Wk=ee.Array.from;function Yk(e,t){var r;if(e){if("string"==typeof e)return Ok(e,t);var n=km(r=Object.prototype.toString.call(e)).call(r,8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Wk(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Ok(e,t):void 0}}function Qk(e){return function(e){if(xk(e))return Ok(e)}(e)||function(e){if(void 0!==j_&&null!=Dk(e)||null!=e["@@iterator"])return Wk(e)}(e)||Yk(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Jk=n,Zk=i,$k=yn,eT=gy.trim,tT=b("".charAt),rT=Jk.parseFloat,nT=Jk.Symbol,iT=nT&&nT.iterator,aT=1/rT("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||iT&&!Zk((function(){rT(Object(iT))}))?function(e){var t=eT($k(e)),r=rT(t);return 0===r&&"-"==tT(t,0)?-0:r}:rT;Rr({global:!0,forced:parseFloat!=aT},{parseFloat:aT});var oT=ee.parseFloat;function sT(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){Sb("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,n)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(e,t,r){t in e&&!(r in e)&&(e[r]=e[t],delete e[t])},a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(e){return"object"===dy(e)&&"object"===dy(e.audio)&&(e=JSON.parse(ny(e)),i(e.audio,"autoGainControl","mozAutoGainControl"),i(e.audio,"noiseSuppression","mozNoiseSuppression")),a(e)},n&&n.prototype.getSettings){var o=n.prototype.getSettings;n.prototype.getSettings=function(){var e=o.apply(this,arguments);return i(e,"mozAutoGainControl","autoGainControl"),i(e,"mozNoiseSuppression","noiseSuppression"),e}}if(n&&n.prototype.applyConstraints){var s=n.prototype.applyConstraints;n.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===dy(e)&&(e=JSON.parse(ny(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function cT(e){"object"===dy(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&od(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function uT(e,t){if("object"===dy(e)&&(e.RTCPeerConnection||e.mozRTCPeerConnection)){!e.RTCPeerConnection&&e.mozRTCPeerConnection&&(e.RTCPeerConnection=e.mozRTCPeerConnection),t.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=sd({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=n[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=km(Array.prototype).call(arguments),i=e[0],a=e[1],o=e[2];return n.apply(this,[i||null]).then((function(e){if(t.version<53&&!a)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(n){if("TypeError"!==n.name)throw n;e.forEach((function(t,n){e.set(n,JE({},t,{type:r[t.type]||t.type}))}))}return e})).then(a,o)}}}function dT(e){if("object"===dy(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpSender.prototype))){var t=e.RTCPeerConnection.prototype.getSenders;t&&(e.RTCPeerConnection.prototype.getSenders=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r});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):v_.resolve(new bE)}}}function lT(e){if("object"===dy(e)&&e.RTCPeerConnection&&e.RTCRtpSender&&(!e.RTCRtpSender||!("getStats"in e.RTCRtpReceiver.prototype))){var t=e.RTCPeerConnection.prototype.getReceivers;t&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,r=t.apply(this,[]);return r.forEach((function(t){return t._pc=e})),r}),_b(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function hT(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;Sb("removeStream","removeTrack"),this.getSenders().forEach((function(r){var n;r.track&&$m(n=e.getTracks()).call(n,r.track)&&t.removeTrack(r)}))})}function pT(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function fT(e){if("object"===dy(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1]&&arguments[1].sendEncodings;void 0===e&&(e=[]);var r=(e=Qk(e)).length>0;r&&e.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&&!(oT(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(oT(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var n=t.apply(this,arguments);if(r){var i=n.sender,a=i.getParameters();(!("encodings"in a)||1===a.encodings.length&&0===on(a.encodings[0]).length)&&(a.encodings=e,i.sendEncodings=e,this.setParametersPromises.push(i.setParameters(a).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function vT(e){if("object"===dy(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e,r=t.apply(this,arguments);"encodings"in r||(r.encodings=xm(e=[]).call(e,this.sendEncodings||[{}]));return r})}}function _T(e){if("object"===dy(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?v_.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function mT(e){if("object"===dy(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.createAnswer;e.RTCPeerConnection.prototype.createAnswer=function(){var e=arguments,r=this;return this.setParametersPromises&&this.setParametersPromises.length?v_.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var yT=Object.freeze(Object.defineProperty({__proto__:null,shimOnTrack:cT,shimPeerConnection:uT,shimSenderGetStats:dT,shimReceiverGetStats:lT,shimRemoveStream:hT,shimRTCDataChannel:pT,shimAddTransceiver:fT,shimGetParameters:vT,shimCreateOffer:_T,shimCreateAnswer:mT,shimGetUserMedia:sT,shimGetDisplayMedia:function(e,t){e.navigator.mediaDevices&&"getDisplayMedia"in e.navigator.mediaDevices||e.navigator.mediaDevices&&(e.navigator.mediaDevices.getDisplayMedia=function(r){if(!r||!r.video){var n=new DOMException("getDisplayMedia without video constraints is undefined");return n.name="NotFoundError",n.code=8,v_.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}},Symbol.toStringTag,{value:"Module"}));function gT(e){if("object"===dy(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 t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addStream=function(e){var r,n=this;this._localStreams||(this._localStreams=[]),$m(r=this._localStreams).call(r,e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(r){return t.call(n,r,e)})),e.getVideoTracks().forEach((function(r){return t.call(n,r,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=this,n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];return i&&i.forEach((function(e){var t;r._localStreams?$m(t=r._localStreams).call(t,e)||r._localStreams.push(e):r._localStreams=[e]})),t.apply(this,arguments)}}"removeStream"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.removeStream=function(e){var t,r,n=this;this._localStreams||(this._localStreams=[]);var i=Kb(t=this._localStreams).call(t,e);if(-1!==i){mk(r=this._localStreams).call(r,i,1);var a=e.getTracks();this.getSenders().forEach((function(e){$m(a).call(a,e.track)&&n.removeTrack(e)}))}})}}function ST(e){if("object"===dy(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){od(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){var r;if(t._remoteStreams||(t._remoteStreams=[]),!$m(r=t._remoteStreams).call(r,e)){t._remoteStreams.push(e);var n=new Event("addstream");n.stream=e,t.dispatchEvent(n)}}))})}});var t=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){var r;if(e._remoteStreams||(e._remoteStreams=[]),!(Kb(r=e._remoteStreams).call(r,t)>=0)){e._remoteStreams.push(t);var n=new Event("addstream");n.stream=t,e.dispatchEvent(n)}}))}),t.apply(e,arguments)}}}function ET(e){if("object"===dy(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,n=t.createAnswer,i=t.setLocalDescription,a=t.setRemoteDescription,o=t.addIceCandidate;t.createOffer=function(e,t){var n=arguments.length>=2?arguments[2]:arguments[0],i=r.apply(this,[n]);return t?(i.then(e,t),v_.resolve()):i},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],i=n.apply(this,[r]);return t?(i.then(e,t),v_.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),v_.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),v_.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),v_.resolve()):n},t.addIceCandidate=s}}function bT(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,n=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return n(kT(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function kT(e){return e&&void 0!==e.video?JE({},e,{video:kb(e.video)}):e}function TT(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var n=[],i=0;i<e.iceServers.length;i++){var a=e.iceServers[i];!a.hasOwnProperty("urls")&&a.hasOwnProperty("url")?(Sb("RTCIceServer.url","RTCIceServer.urls"),(a=JSON.parse(ny(a))).urls=a.url,delete a.url,n.push(a)):n.push(e.iceServers[i])}e.iceServers=n}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&od(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function IT(e){"object"===dy(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&od(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function AT(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){var r,n;void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var i=Nb(r=this.getTransceivers()).call(r,(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 a=Nb(n=this.getTransceivers()).call(n,(function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&a?"sendrecv"===a.direction?a.setDirection?a.setDirection("sendonly"):a.direction="sendonly":"recvonly"===a.direction&&(a.setDirection?a.setDirection("inactive"):a.direction="inactive"):!0!==e.offerToReceiveVideo||a||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function RT(e){"object"!==dy(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var CT=Object.freeze(Object.defineProperty({__proto__:null,shimLocalStreamsAPI:gT,shimRemoteStreamsAPI:ST,shimCallbacksAPI:ET,shimGetUserMedia:bT,shimConstraints:kT,shimRTCIceServerUrls:TT,shimTrackEventTransceiver:IT,shimCreateOfferLegacy:AT,shimAudioContext:RT},Symbol.toStringTag,{value:"Module"})),wT=cc.PROPER,xT=i,OT=ly,DT=gy.trim;Rr({target:"String",proto:!0,forced:function(e){return xT((function(){return!!OT[e]()||"​…᠎"!=="​…᠎"[e]()||wT&&OT[e].name!==e}))}("trim")},{trim:function(){return DT(this)}});var PT,NT,MT=Us("String").trim,LT=oe,UT=MT,VT=String.prototype,FT=function(e){var t=e.trim;return"string"==typeof e||e===VT||LT(VT,e)&&t===VT.trim?UT:t},BT={exports:{}};PT=BT,(NT={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}}).localCName=NT.generateIdentifier(),NT.splitLines=function(e){var t;return uy(t=FT(e).call(e).split("\n")).call(t,(function(e){return FT(e).call(e)}))},NT.splitSections=function(e){var t=e.split("\nm=");return uy(t).call(t,(function(e,t){var r;return FT(r=t>0?"m="+e:e).call(r)+"\r\n"}))},NT.getDescription=function(e){var t=NT.splitSections(e);return t&&t[0]},NT.getMediaSections=function(e){var t=NT.splitSections(e);return t.shift(),t},NT.matchPrefix=function(e,t){var r;return Gs(r=NT.splitLines(e)).call(r,(function(e){return 0===Kb(e).call(e,t)}))},NT.parseCandidate=function(e){for(var t,r={foundation:(t=0===Kb(e).call(e,"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:Dy(t[3],10),ip:t[4],address:t[4],port:Dy(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=Dy(t[n+1],10);break;case"tcptype":r.tcpType=t[n+1];break;case"ufrag":r.ufrag=t[n+1],r.usernameFragment=t[n+1];break;default:void 0===r[t[n]]&&(r[t[n]]=t[n+1])}return r},NT.writeCandidate=function(e){var t=[];t.push(e.foundation);var r=e.component;"rtp"===r?t.push(1):"rtcp"===r?t.push(2):t.push(r),t.push(e.protocol.toUpperCase()),t.push(e.priority),t.push(e.address||e.ip),t.push(e.port);var n=e.type;return t.push("typ"),t.push(n),"host"!==n&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},NT.parseIceOptions=function(e){return e.substr(14).split(" ")},NT.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:Dy(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=Dy(t[1],10),r.channels=3===t.length?Dy(t[2],10):1,r.numChannels=r.channels,r},NT.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},NT.parseExtmap=function(e){var t,r=e.substr(9).split(" ");return{id:Dy(r[0],10),direction:Kb(t=r[0]).call(t,"/")>0?r[0].split("/")[1]:"sendrecv",uri:r[1]}},NT.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},NT.parseFmtp=function(e){for(var t,r={},n=e.substr(Kb(e).call(e," ")+1).split(";"),i=0;i<n.length;i++){var a,o;t=FT(a=n[i]).call(a).split("="),r[FT(o=t[0]).call(o)]=t[1]}return r},NT.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&on(e.parameters).length){var n=[];on(e.parameters).forEach((function(t){void 0!==e.parameters[t]?n.push(t+"="+e.parameters[t]):n.push(t)})),t+="a=fmtp:"+r+" "+n.join(";")+"\r\n"}return t},NT.parseRtcpFb=function(e){var t=e.substr(Kb(e).call(e," ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},NT.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},NT.parseSsrcMedia=function(e){var t=Kb(e).call(e," "),r={ssrc:Dy(e.substr(7,t-7),10)},n=Kb(e).call(e,":",t);return n>-1?(r.attribute=e.substr(t+1,n-t-1),r.value=e.substr(n+1)):r.attribute=e.substr(t+1),r},NT.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:uy(t).call(t,(function(e){return Dy(e,10)}))}},NT.getMid=function(e){var t=NT.matchPrefix(e,"a=mid:")[0];if(t)return t.substr(6)},NT.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},NT.getDtlsParameters=function(e,t){var r=NT.matchPrefix(e+t,"a=fingerprint:");return{role:"auto",fingerprints:uy(r).call(r,NT.parseFingerprint)}},NT.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},NT.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:Dy(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:km(t).call(t,3)}},NT.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===dy(e.keyParams)?NT.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},NT.parseCryptoKeyParams=function(e){if(0!==Kb(e).call(e,"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}},NT.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},NT.getCryptoParameters=function(e,t){var r=NT.matchPrefix(e+t,"a=crypto:");return uy(r).call(r,NT.parseCryptoLine)},NT.getIceParameters=function(e,t){var r=NT.matchPrefix(e+t,"a=ice-ufrag:")[0],n=NT.matchPrefix(e+t,"a=ice-pwd:")[0];return r&&n?{usernameFragment:r.substr(12),password:n.substr(10)}:null},NT.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},NT.parseRtpParameters=function(e){for(var t={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},r=NT.splitLines(e)[0].split(" "),n=3;n<r.length;n++){var i=r[n],a=NT.matchPrefix(e,"a=rtpmap:"+i+" ")[0];if(a){var o,s=NT.parseRtpMap(a),c=NT.matchPrefix(e,"a=fmtp:"+i+" ");switch(s.parameters=c.length?NT.parseFmtp(c[0]):{},s.rtcpFeedback=uy(o=NT.matchPrefix(e,"a=rtcp-fb:"+i+" ")).call(o,NT.parseRtcpFb),t.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":t.fecMechanisms.push(s.name.toUpperCase())}}}return NT.matchPrefix(e,"a=extmap:").forEach((function(e){t.headerExtensions.push(NT.parseExtmap(e))})),t},NT.writeRtpDescription=function(e,t){var r,n="";n+="m="+e+" ",n+=t.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=uy(r=t.codecs).call(r,(function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",n+="c=IN IP4 0.0.0.0\r\n",n+="a=rtcp:9 IN IP4 0.0.0.0\r\n",t.codecs.forEach((function(e){n+=NT.writeRtpMap(e),n+=NT.writeFmtp(e),n+=NT.writeRtcpFb(e)}));var i=0;return t.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),t.headerExtensions&&t.headerExtensions.forEach((function(e){n+=NT.writeExtmap(e)})),n},NT.parseRtpEncodingParameters=function(e){var t,r,n,i,a,o,s=[],c=NT.parseRtpParameters(e),u=-1!==Kb(t=c.fecMechanisms).call(t,"RED"),d=-1!==Kb(r=c.fecMechanisms).call(r,"ULPFEC"),l=Gs(n=uy(i=NT.matchPrefix(e,"a=ssrc:")).call(i,(function(e){return NT.parseSsrcMedia(e)}))).call(n,(function(e){return"cname"===e.attribute})),h=l.length>0&&l[0].ssrc,p=uy(a=NT.matchPrefix(e,"a=ssrc-group:FID")).call(a,(function(e){var t=e.substr(17).split(" ");return uy(t).call(t,(function(e){return Dy(e,10)}))}));p.length>0&&p[0].length>1&&p[0][0]===h&&(o=p[0][1]),c.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:h,codecPayloadType:Dy(e.parameters.apt,10)};h&&o&&(t.rtx={ssrc:o}),s.push(t),u&&((t=JSON.parse(ny(t))).fec={ssrc:h,mechanism:d?"red+ulpfec":"red"},s.push(t))}})),0===s.length&&h&&s.push({ssrc:h});var f,v,_=NT.matchPrefix(e,"b=");return _.length&&(_=0===Kb(f=_[0]).call(f,"b=TIAS:")?Dy(_[0].substr(7),10):0===Kb(v=_[0]).call(v,"b=AS:")?1e3*Dy(_[0].substr(5),10)*.95-16e3:void 0,s.forEach((function(e){e.maxBitrate=_}))),s},NT.parseRtcpParameters=function(e){var t,r,n={},i=Gs(t=uy(r=NT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return NT.parseSsrcMedia(e)}))).call(t,(function(e){return"cname"===e.attribute}))[0];i&&(n.cname=i.value,n.ssrc=i.ssrc);var a=NT.matchPrefix(e,"a=rtcp-rsize");n.reducedSize=a.length>0,n.compound=0===a.length;var o=NT.matchPrefix(e,"a=rtcp-mux");return n.mux=o.length>0,n},NT.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},NT.parseMsid=function(e){var t,r,n,i=NT.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(n=i[0].substr(7).split(" "))[0],track:n[1]};var a=Gs(t=uy(r=NT.matchPrefix(e,"a=ssrc:")).call(r,(function(e){return NT.parseSsrcMedia(e)}))).call(t,(function(e){return"msid"===e.attribute}));return a.length>0?{stream:(n=a[0].value.split(" "))[0],track:n[1]}:void 0},NT.parseSctpDescription=function(e){var t,r=NT.parseMLine(e),n=NT.matchPrefix(e,"a=max-message-size:");n.length>0&&(t=Dy(n[0].substr(19),10)),isNaN(t)&&(t=65536);var i=NT.matchPrefix(e,"a=sctp-port:");if(i.length>0)return{port:Dy(i[0].substr(12),10),protocol:r.fmt,maxMessageSize:t};var a=NT.matchPrefix(e,"a=sctpmap:");if(a.length>0){var o=a[0].substr(10).split(" ");return{port:Dy(o[0],10),protocol:o[1],maxMessageSize:t}}},NT.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},NT.generateSessionId=function(){return Math.random().toString().substr(2,21)},NT.writeSessionBoilerplate=function(e,t,r){var n=void 0!==t?t:2;return"v=0\r\no="+(r||"thisisadapterortc")+" "+(e||NT.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},NT.getDirection=function(e,t){for(var r=NT.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?NT.getDirection(t):"sendrecv"},NT.getKind=function(e){return NT.splitLines(e)[0].split(" ")[0].substr(2)},NT.isRejected=function(e){return"0"===e.split(" ",2)[1]},NT.parseMLine=function(e){var t=NT.splitLines(e)[0].substr(2).split(" ");return{kind:t[0],port:Dy(t[1],10),protocol:t[2],fmt:km(t).call(t,3).join(" ")}},NT.parseOLine=function(e){var t=NT.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:t[0],sessionId:t[1],sessionVersion:Dy(t[2],10),netType:t[3],addressType:t[4],address:t[5]}},NT.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var t=NT.splitLines(e),r=0;r<t.length;r++)if(t[r].length<2||"="!==t[r].charAt(1))return!1;return!0},PT.exports=NT;var jT=BT.exports,GT=e({__proto__:null,default:jT},[BT.exports]);function HT(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){var r;if("object"===dy(e)&&e.candidate&&0===Kb(r=e.candidate).call(r,"a=")&&((e=JSON.parse(ny(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var n=new t(e),i=jT.parseCandidate(e.candidate),a=JE(n,i);return a.toJSON=function(){return{candidate:a.candidate,sdpMid:a.sdpMid,sdpMLineIndex:a.sdpMLineIndex,usernameFragment:a.usernameFragment}},a}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,_b(e,"icecandidate",(function(t){return t.candidate&&od(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function zT(e){!e.RTCIceCandidate||e.RTCIceCandidate&&"relayProtocol"in e.RTCIceCandidate.prototype||_b(e,"icecandidate",(function(e){if(e.candidate){var t=jT.parseCandidate(e.candidate.candidate);"relay"===t.type&&(e.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[t.priority>>24])}return e}))}function KT(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||od(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var r=function(e){if(!e||!e.sdp)return!1;var t=jT.splitSections(e.sdp);return t.shift(),t.some((function(e){var t,r=jT.parseMLine(e);return r&&"application"===r.kind&&-1!==Kb(t=r.protocol).call(t,"SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=Dy(t[1],10);return r!=r?-1:r},i=function(e){var r=65536;return"firefox"===t.browser&&(r=t.version<57?-1===e?16384:2147483637:t.version<60?57===t.version?65535:65536:2147483637),r},a=function(e,r){var n=65536;"firefox"===t.browser&&57===t.version&&(n=65535);var i=jT.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=Dy(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},o=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&&od(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var c,u=n(arguments[0]),d=i(u),l=a(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={};od(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return o.apply(this,arguments)}}}function XT(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 r(e,this),e},_b(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var n=arguments[0],i=n.length||n.size||n.byteLength;if("open"===e.readyState&&t.sctp&&i>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}function qT(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;od(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),od(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 r=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 r=new Event("connectionstatechange",e);t.dispatchEvent(r)}return e},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),r.apply(this,arguments)}}))}}function WT(e,t){if(e.RTCPeerConnection&&!("chrome"===t.browser&&t.version>=71||"safari"===t.browser&&t.version>=605)){var r=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(t){var n;if(t&&t.sdp&&-1!==Kb(n=t.sdp).call(n,"\na=extmap-allow-mixed")){var i,a=Gs(i=t.sdp.split("\n")).call(i,(function(e){return"a=extmap-allow-mixed"!==FT(e).call(e)})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:a}):t.sdp=a}return r.apply(this,arguments)}}}function YT(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.addIceCandidate;r&&0!==r.length&&(e.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?("chrome"===t.browser&&t.version<78||"firefox"===t.browser&&t.version<68||"safari"===t.browser)&&arguments[0]&&""===arguments[0].candidate?v_.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),v_.resolve())})}}function QT(e,t){if(e.RTCPeerConnection&&e.RTCPeerConnection.prototype){var r=e.RTCPeerConnection.prototype.setLocalDescription;r&&0!==r.length&&(e.RTCPeerConnection.prototype.setLocalDescription=function(){var e=this,t=arguments[0]||{};if("object"!==dy(t)||t.type&&t.sdp)return r.apply(this,arguments);if(!(t={type:t.type,sdp:t.sdp}).type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":t.type="offer";break;default:t.type="answer"}if(t.sdp||"offer"!==t.type&&"answer"!==t.type)return r.apply(this,[t]);var n="offer"===t.type?this.createOffer:this.createAnswer;return n.apply(this).then((function(t){return r.apply(e,[t])}))})}}var JT=Object.freeze(Object.defineProperty({__proto__:null,shimRTCIceCandidate:HT,shimRTCIceCandidateRelayProtocol:zT,shimMaxMessageSize:KT,shimSendThrowTypeError:XT,shimConnectionState:qT,removeExtmapAllowMixed:WT,shimAddIceCandidateNullOrEmpty:YT,shimParameterlessSetLocalDescription:QT},Symbol.toStringTag,{value:"Module"}));function ZT(e,t){var r=void 0!==j_&&Dk(e)||e["@@iterator"];if(!r){if(xk(e)||(r=Yk(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function $T(e,t){return function(e){if(xk(e))return e}(e)||function(e,t){var r=null==e?null:void 0!==j_&&Dk(e)||e["@@iterator"];if(null!=r){var n,i,a=[],o=!0,s=!1;try{for(r=r.call(e);!(o=(n=r.next()).done)&&(a.push(n.value),!t||a.length!==t);o=!0);}catch(c){s=!0,i=c}finally{try{o||null==r.return||r.return()}finally{if(s)throw i}}return a}}(e,t)||Yk(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function eI(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}!function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.window,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0},n=gb,i=Eb(t),a={browserDetails:i,commonShim:JT,extractVersion:vb,disableLog:mb,disableWarnings:yb,sdp:GT};switch(i.browser){case"chrome":if(!wk||!Rk||!r.shimChrome)return n("Chrome shim is not included in this adapter release."),a;if(null===i.version)return n("Chrome shim can not determine version, not shimming."),a;n("adapter.js shimming chrome."),a.browserShim=wk,YT(t,i),QT(t),gk(t,i),Sk(t),Rk(t,i),Ek(t),Ak(t,i),bk(t),kk(t),Tk(t),Ck(t,i),HT(t),zT(t),qT(t),KT(t,i),XT(t),WT(t,i);break;case"firefox":if(!yT||!uT||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),a;n("adapter.js shimming firefox."),a.browserShim=yT,YT(t,i),QT(t),sT(t,i),uT(t,i),cT(t),hT(t),dT(t),lT(t),pT(t),fT(t),vT(t),_T(t),mT(t),HT(t),qT(t),KT(t,i),XT(t);break;case"safari":if(!CT||!r.shimSafari)return n("Safari shim is not included in this adapter release."),a;n("adapter.js shimming safari."),a.browserShim=CT,YT(t,i),QT(t),TT(t),AT(t),ET(t),gT(t),ST(t),IT(t),bT(t),RT(t),HT(t),zT(t),KT(t,i),XT(t),WT(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window});var tI=Ye,rI=function(e){return void 0!==e&&(tI(e,"value")||tI(e,"writable"))},nI=O,iI=$,aI=tr,oI=rI,sI=R,cI=mc;Rr({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,a=arguments.length<3?t:arguments[2];return aI(t)===a?t[r]:(n=sI.f(t,r))?oI(n)?n.value:void 0===n.get?void 0:nI(n.get,a):iI(i=cI(t))?e(i,r,a):void 0}});var uI=ee.Reflect.get,dI=b,lI=we,hI=$,pI=Ye,fI=rs,vI=a,_I=Function,mI=dI([].concat),yI=dI([].join),gI={},SI=function(e,t,r){if(!pI(gI,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";gI[t]=_I("C,a","return new C("+yI(n,",")+")")}return gI[t](e,r)},EI=vI?_I.bind:function(e){var t=lI(this),r=t.prototype,n=fI(arguments,1),i=function(){var r=mI(n,fI(arguments));return this instanceof i?SI(t,r.length,r):t.apply(e,r)};return hI(r)&&(i.prototype=r),i},bI=EI;Rr({target:"Function",proto:!0,forced:Function.bind!==bI},{bind:bI});var kI=Us("Function").bind,TI=oe,II=kI,AI=Function.prototype,RI=function(e){var t=e.bind;return e===AI||TI(AI,e)&&t===AI.bind?II:t};function CI(e){var t;return(CI=Y_?RI(t=W_).call(t):function(e){return e.__proto__||W_(e)})(e)}function wI(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=CI(e)););return e}function xI(){var e;"undefined"!=typeof Reflect&&uI?xI=RI(e=uI).call(e):xI=function(e,t,r){var n=wI(e,t);if(n){var i=tc(n,t);return i.get?i.get.call(arguments.length<3?e:r):i.value}};return xI.apply(this,arguments)}function OI(e,t){var r;return(OI=Y_?RI(r=Y_).call(r):function(e,t){return e.__proto__=t,e})(e,t)}function DI(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=z_(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),od(e,"prototype",{writable:!1}),t&&OI(e,t)}var PI=Rr,NI=d,MI=EI,LI=Th,UI=tr,VI=$,FI=Hn,BI=i,jI=ae("Reflect","construct"),GI=Object.prototype,HI=[].push,zI=BI((function(){function e(){}return!(jI((function(){}),[],e)instanceof e)})),KI=!BI((function(){jI((function(){}))})),XI=zI||KI;PI({target:"Reflect",stat:!0,forced:XI,sham:XI},{construct:function(e,t){LI(e),UI(t);var r=arguments.length<3?e:LI(arguments[2]);if(KI&&!zI)return jI(e,t,r);if(e==r){switch(t.length){case 0:return new e;case 1:return new e(t[0]);case 2:return new e(t[0],t[1]);case 3:return new e(t[0],t[1],t[2]);case 4:return new e(t[0],t[1],t[2],t[3])}var n=[null];return NI(HI,n,t),new(NI(MI,e,n))}var i=r.prototype,a=FI(VI(i)?i:GI),o=NI(e,a,t);return VI(o)?o:a}});var qI=ee.Reflect.construct;function WI(e,t){if(t&&("object"===dy(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return eI(e)}function YI(e){var t=function(){if("undefined"==typeof Reflect||!qI)return!1;if(qI.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(qI(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=CI(e);if(t){var i=CI(this).constructor;r=qI(n,arguments,i)}else r=n.apply(this,arguments);return WI(this,r)}}var QI=Us("Array").values,JI=vn,ZI=Ye,$I=oe,eA=QI,tA=Array.prototype,rA={DOMTokenList:!0,NodeList:!0},nA=function(e){var t=e.values;return e===tA||$I(tA,e)&&t===tA.values||ZI(rA,JI(e))?eA:t},iA=ni,aA=Math.floor,oA=function(e,t){var r=e.length,n=aA(r/2);return r<8?sA(e,t):cA(e,oA(iA(e,0,n),t),oA(iA(e,n),t),t)},sA=function(e,t){for(var r,n,i=e.length,a=1;a<i;){for(n=a,r=e[a];n&&t(e[n-1],r)>0;)e[n]=e[--n];n!==a++&&(e[n]=r)}return e},cA=function(e,t,r,n){for(var i=t.length,a=r.length,o=0,s=0;o<i||s<a;)e[o+s]=o<i&&s<a?n(t[o],r[s])<=0?t[o++]:r[s++]:o<i?t[o++]:r[s++];return e},uA=oA,dA=se.match(/firefox\/(\d+)/i),lA=!!dA&&+dA[1],hA=/MSIE|Trident/.test(se),pA=se.match(/AppleWebKit\/(\d+)\./),fA=!!pA&&+pA[1],vA=Rr,_A=b,mA=we,yA=Xe,gA=Br,SA=$b,EA=yn,bA=i,kA=uA,TA=Iu,IA=lA,AA=hA,RA=fe,CA=fA,wA=[],xA=_A(wA.sort),OA=_A(wA.push),DA=bA((function(){wA.sort(void 0)})),PA=bA((function(){wA.sort(null)})),NA=TA("sort"),MA=!bA((function(){if(RA)return RA<70;if(!(IA&&IA>3)){if(AA)return!0;if(CA)return CA<603;var e,t,r,n,i="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(n=0;n<47;n++)wA.push({k:t+n,v:r})}for(wA.sort((function(e,t){return t.v-e.v})),n=0;n<wA.length;n++)t=wA[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));vA({target:"Array",proto:!0,forced:DA||!PA||!NA||!MA},{sort:function(e){void 0!==e&&mA(e);var t=yA(this);if(MA)return void 0===e?xA(t):xA(t,e);var r,n,i=[],a=gA(t);for(n=0;n<a;n++)n in t&&OA(i,t[n]);for(kA(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:EA(t)>EA(r)?1:-1}}(e)),r=gA(i),n=0;n<r;)t[n]=i[n++];for(;n<a;)SA(t,n++);return t}});var LA=Us("Array").sort,UA=oe,VA=LA,FA=Array.prototype,BA=function(e){var t=e.sort;return e===FA||UA(FA,e)&&t===FA.sort?VA:t},jA=Rr,GA=Pa.findIndex,HA="findIndex",zA=!0;HA in[]&&Array(1).findIndex((function(){zA=!1})),jA({target:"Array",proto:!0,forced:zA},{findIndex:function(e){return GA(this,e,arguments.length>1?arguments[1]:void 0)}});var KA=Us("Array").findIndex,XA=oe,qA=KA,WA=Array.prototype,YA=function(e){var t=e.findIndex;return e===WA||XA(WA,e)&&t===WA.findIndex?qA:t},QA=Rr,JA=b;R.f;var ZA=Vr,$A=yn,eR=Vm,tR=q,rR=Bm,nR=JA("".startsWith),iR=JA("".slice),aR=Math.min;QA({target:"String",proto:!0,forced:!rR("startsWith")},{startsWith:function(e){var t=$A(tR(this));eR(e);var r=ZA(aR(arguments.length>1?arguments[1]:void 0,t.length)),n=$A(e);return nR?nR(t,n,r):iR(t,r,r+n.length)===n}});var oR=Us("String").startsWith,sR=oe,cR=oR,uR=String.prototype,dR=function(e){var t=e.startsWith;return"string"==typeof e||e===uR||sR(uR,e)&&t===uR.startsWith?cR:t},lR=function(e){return 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.INVOKED_BEFORE_CAPTURE="INVOKED_BEFORE_CAPTURE",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.INTERRUPT="INTERRUPT",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_EXCEED_QPS="USER_MESSAGE_EXCEED_QPS",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_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",e.SUBTITLE_ALREADY_ON="SUBTITLE_ALREADY_ON",e.SUBTITLE_NOT_TURNED_ON="SUBTITLE_NOT_TURNED_ON",e.SUBTITLE_ERR_POSTPROCESS="SUBTITLE_ERR_POSTPROCESS",e.SUBTITLE_ERR_CONNECTION_ERROR="SUBTITLE_ERR_CONNECTION_ERROR",e.SUBTITLE_ERR_PROCESS_ERROR="SUBTITLE_ERR_PROCESS_ERROR",e.SUBTITLE_ERR_UNKNOWN="SUBTITLE_ERR_UNKNOWN",e}(lR||{}),hR=function(e){return 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",e}(hR||{}),pR=qd((function e(t,r,n){Wd(this,e),sd(this,"code",void 0),sd(this,"message",void 0),sd(this,"error",void 0),this.code=t,this.message=r,this.error=n})),fR=C,vR=b,_R=rn,mR=Q,yR=vR(D.f),gR=vR([].push),SR=function(e){return function(t){for(var r,n=mR(t),i=_R(n),a=i.length,o=0,s=[];a>o;)r=i[o++],fR&&!yR(n,r)||gR(s,e?[r,n[r]]:n[r]);return s}},ER={entries:SR(!0),values:SR(!1)}.entries;Rr({target:"Object",stat:!0},{entries:function(e){return ER(e)}});var bR=ee.Object.entries,kR=Or,TR=yn,IR=q,AR=RangeError,RR=b,CR=Vr,wR=yn,xR=function(e){var t=TR(IR(this)),r="",n=kR(e);if(n<0||n==1/0)throw AR("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},OR=q,DR=RR(xR),PR=RR("".slice),NR=Math.ceil,MR=function(e){return function(t,r,n){var i,a,o=wR(OR(t)),s=CR(r),c=o.length,u=void 0===n?" ":wR(n);return s<=c||""==u?o:((a=DR(u,NR((i=s-c)/u.length))).length>i&&(a=PR(a,0,i)),e?o+a:a+o)}},LR={start:MR(!1),end:MR(!0)},UR=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(se),VR=LR.end;Rr({target:"String",proto:!0,forced:UR},{padEnd:function(e){return VR(this,e,arguments.length>1?arguments[1]:void 0)}});var FR=Us("String").padEnd,BR=oe,jR=FR,GR=String.prototype,HR=function(e){var t=e.padEnd;return"string"==typeof e||e===GR||BR(GR,e)&&t===GR.padEnd?jR:t},zR=Oy;Rr({target:"Number",stat:!0,forced:Number.parseInt!=zR},{parseInt:zR});var KR=ee.Number.parseInt,XR=Math.log,qR=Math.LOG10E;Rr({target:"Math",stat:!0},{log10:Math.log10||function(e){return XR(e)*qR}});var WR,YR=ee.Math.log10,QR=new Uint8Array(16);function JR(){if(!WR&&!(WR="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 WR(QR)}var ZR=/^(?:[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 $R(e){return"string"==typeof e&&ZR.test(e)}for(var eC=[],tC=0;tC<256;++tC)eC.push((tC+256).toString(16).substr(1));function rC(e,t,r){var n=(e=e||{}).random||(e.rng||JR)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(eC[e[t+0]]+eC[e[t+1]]+eC[e[t+2]]+eC[e[t+3]]+"-"+eC[e[t+4]]+eC[e[t+5]]+"-"+eC[e[t+6]]+eC[e[t+7]]+"-"+eC[e[t+8]]+eC[e[t+9]]+"-"+eC[e[t+10]]+eC[e[t+11]]+eC[e[t+12]]+eC[e[t+13]]+eC[e[t+14]]+eC[e[t+15]]).toLowerCase();if(!$R(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var nC={exports:{}},iC=n;Rr({global:!0,forced:iC.globalThis!==iC},{globalThis:iC});var aC=n,oC={exports:{}};!function(e,r){var n;e.exports=(n=n||function(e,r){var n;if("undefined"!=typeof window&&window.crypto&&(n=window.crypto),"undefined"!=typeof self&&self.crypto&&(n=self.crypto),void 0!==aC&&aC.crypto&&(n=aC.crypto),!n&&"undefined"!=typeof window&&window.msCrypto&&(n=window.msCrypto),!n&&void 0!==t&&t.crypto&&(n=t.crypto),!n)try{n=require("crypto")}catch(_){}var i=function(){if(n){if("function"==typeof n.getRandomValues)try{return n.getRandomValues(new Uint32Array(1))[0]}catch(_){}if("function"==typeof n.randomBytes)try{return n.randomBytes(4).readInt32LE()}catch(_){}}throw new Error("Native crypto module could not be used to get secure random number.")},a=Object.create||function(){function e(){}return function(t){var r;return e.prototype=t,r=new e,e.prototype=null,r}}(),o={},s=o.lib={},c=s.Base={extend:function(e){var t=a(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,t){e=this.words=e||[],this.sigBytes=t!=r?t:4*e.length},toString:function(e){return(e||l).stringify(this)},concat:function(e){var t=this.words,r=e.words,n=this.sigBytes,i=e.sigBytes;if(this.clamp(),n%4)for(var a=0;a<i;a++){var o=r[a>>>2]>>>24-a%4*8&255;t[n+a>>>2]|=o<<24-(n+a)%4*8}else for(var s=0;s<i;s+=4)t[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,r=this.sigBytes;t[r>>>2]&=4294967295<<32-r%4*8,t.length=e.ceil(r/4)},clone:function(){var e,t=c.clone.call(this);return t.words=km(e=this.words).call(e,0),t},random:function(e){for(var t=[],r=0;r<e;r+=4)t.push(i());return new u.init(t,e)}}),d=o.enc={},l=d.Hex={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push((a>>>4).toString(16)),n.push((15&a).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n+=2)r[n>>>3]|=Dy(e.substr(n,2),16)<<24-n%8*4;return new u.init(r,t/2)}},h=d.Latin1={stringify:function(e){for(var t=e.words,r=e.sigBytes,n=[],i=0;i<r;i++){var a=t[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(a))}return n.join("")},parse:function(e){for(var t=e.length,r=[],n=0;n<t;n++)r[n>>>2]|=(255&e.charCodeAt(n))<<24-n%4*8;return new u.init(r,t)}},p=d.Utf8={stringify:function(e){try{return decodeURIComponent(escape(h.stringify(e)))}catch(t){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){var t;"string"==typeof e&&(e=p.parse(e)),xm(t=this._data).call(t,e),this._nDataBytes+=e.sigBytes},_process:function(t){var r,n=this._data,i=n.words,a=n.sigBytes,o=this.blockSize,s=a/(4*o),c=(s=t?e.ceil(s):e.max((0|s)-this._minBufferSize,0))*o,d=e.min(4*c,a);if(c){for(var l=0;l<c;l+=o)this._doProcessBlock(i,l);r=mk(i).call(i,0,c),n.sigBytes-=d}return new u.init(r,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,r){return new e.init(r).finalize(t)}},_createHmacHelper:function(e){return function(t,r){return new v.HMAC.init(e,r).finalize(t)}}});var v=o.algo={};return o}(Math),n)}(oC),function(e,t){var r;e.exports=(r=oC.exports,function(){if("function"==typeof ArrayBuffer){var e=r.lib.WordArray,t=e.init,n=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 r=e.byteLength,n=[],i=0;i<r;i++)n[i>>>2]|=e[i]<<24-i%4*8;t.call(this,n,r)}else t.apply(this,arguments)};n.prototype=e}}(),r.lib.WordArray)}(nC);var sC=nC.exports,cC={exports:{}},uC={exports:{}};!function(e,t){var r;e.exports=(r=oC.exports,function(){var e=r,t=e.lib.WordArray;function n(e,r,n){for(var i=[],a=0,o=0;o<r;o++)if(o%4){var s=n[e.charCodeAt(o-1)]<<o%4*2|n[e.charCodeAt(o)]>>>6-o%4*2;i[a>>>2]|=s<<24-a%4*8,a++}return t.create(i,a)}e.enc.Base64={stringify:function(e){var t=e.words,r=e.sigBytes,n=this._map;e.clamp();for(var i=[],a=0;a<r;a+=3)for(var o=(t[a>>>2]>>>24-a%4*8&255)<<16|(t[a+1>>>2]>>>24-(a+1)%4*8&255)<<8|t[a+2>>>2]>>>24-(a+2)%4*8&255,s=0;s<4&&a+.75*s<r;s++)i.push(n.charAt(o>>>6*(3-s)&63));var c=n.charAt(64);if(c)for(;i.length%4;)i.push(c);return i.join("")},parse:function(e){var t=e.length,r=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var a=0;a<r.length;a++)i[r.charCodeAt(a)]=a}var o=r.charAt(64);if(o){var s=Kb(e).call(e,o);-1!==s&&(t=s)}return n(e,t,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),r.enc.Base64)}(uC);var dC={exports:{}};!function(e,t){var r;e.exports=(r=oC.exports,function(e){var t=r,n=t.lib,i=n.WordArray,a=n.Hasher,o=t.algo,s=[];!function(){for(var t=0;t<64;t++)s[t]=4294967296*e.abs(e.sin(t+1))|0}();var c=o.MD5=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,t){for(var r=0;r<16;r++){var n=t+r,i=e[n];e[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var a=this._hash.words,o=e[t+0],c=e[t+1],p=e[t+2],f=e[t+3],v=e[t+4],_=e[t+5],m=e[t+6],y=e[t+7],g=e[t+8],S=e[t+9],E=e[t+10],b=e[t+11],k=e[t+12],T=e[t+13],I=e[t+14],A=e[t+15],R=a[0],C=a[1],w=a[2],x=a[3];R=u(R,C,w,x,o,7,s[0]),x=u(x,R,C,w,c,12,s[1]),w=u(w,x,R,C,p,17,s[2]),C=u(C,w,x,R,f,22,s[3]),R=u(R,C,w,x,v,7,s[4]),x=u(x,R,C,w,_,12,s[5]),w=u(w,x,R,C,m,17,s[6]),C=u(C,w,x,R,y,22,s[7]),R=u(R,C,w,x,g,7,s[8]),x=u(x,R,C,w,S,12,s[9]),w=u(w,x,R,C,E,17,s[10]),C=u(C,w,x,R,b,22,s[11]),R=u(R,C,w,x,k,7,s[12]),x=u(x,R,C,w,T,12,s[13]),w=u(w,x,R,C,I,17,s[14]),R=d(R,C=u(C,w,x,R,A,22,s[15]),w,x,c,5,s[16]),x=d(x,R,C,w,m,9,s[17]),w=d(w,x,R,C,b,14,s[18]),C=d(C,w,x,R,o,20,s[19]),R=d(R,C,w,x,_,5,s[20]),x=d(x,R,C,w,E,9,s[21]),w=d(w,x,R,C,A,14,s[22]),C=d(C,w,x,R,v,20,s[23]),R=d(R,C,w,x,S,5,s[24]),x=d(x,R,C,w,I,9,s[25]),w=d(w,x,R,C,f,14,s[26]),C=d(C,w,x,R,g,20,s[27]),R=d(R,C,w,x,T,5,s[28]),x=d(x,R,C,w,p,9,s[29]),w=d(w,x,R,C,y,14,s[30]),R=l(R,C=d(C,w,x,R,k,20,s[31]),w,x,_,4,s[32]),x=l(x,R,C,w,g,11,s[33]),w=l(w,x,R,C,b,16,s[34]),C=l(C,w,x,R,I,23,s[35]),R=l(R,C,w,x,c,4,s[36]),x=l(x,R,C,w,v,11,s[37]),w=l(w,x,R,C,y,16,s[38]),C=l(C,w,x,R,E,23,s[39]),R=l(R,C,w,x,T,4,s[40]),x=l(x,R,C,w,o,11,s[41]),w=l(w,x,R,C,f,16,s[42]),C=l(C,w,x,R,m,23,s[43]),R=l(R,C,w,x,S,4,s[44]),x=l(x,R,C,w,k,11,s[45]),w=l(w,x,R,C,A,16,s[46]),R=h(R,C=l(C,w,x,R,p,23,s[47]),w,x,o,6,s[48]),x=h(x,R,C,w,y,10,s[49]),w=h(w,x,R,C,I,15,s[50]),C=h(C,w,x,R,_,21,s[51]),R=h(R,C,w,x,k,6,s[52]),x=h(x,R,C,w,f,10,s[53]),w=h(w,x,R,C,E,15,s[54]),C=h(C,w,x,R,c,21,s[55]),R=h(R,C,w,x,g,6,s[56]),x=h(x,R,C,w,A,10,s[57]),w=h(w,x,R,C,m,15,s[58]),C=h(C,w,x,R,T,21,s[59]),R=h(R,C,w,x,v,6,s[60]),x=h(x,R,C,w,b,10,s[61]),w=h(w,x,R,C,p,15,s[62]),C=h(C,w,x,R,S,21,s[63]),a[0]=a[0]+R|0,a[1]=a[1]+C|0,a[2]=a[2]+w|0,a[3]=a[3]+x|0},_doFinalize:function(){var t=this._data,r=t.words,n=8*this._nDataBytes,i=8*t.sigBytes;r[i>>>5]|=128<<24-i%32;var a=e.floor(n/4294967296),o=n;r[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8),r[14+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),t.sigBytes=4*(r.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=a.clone.call(this);return e._hash=this._hash.clone(),e}});function u(e,t,r,n,i,a,o){var s=e+(t&r|~t&n)+i+o;return(s<<a|s>>>32-a)+t}function d(e,t,r,n,i,a,o){var s=e+(t&n|r&~n)+i+o;return(s<<a|s>>>32-a)+t}function l(e,t,r,n,i,a,o){var s=e+(t^r^n)+i+o;return(s<<a|s>>>32-a)+t}function h(e,t,r,n,i,a,o){var s=e+(r^(t|~n))+i+o;return(s<<a|s>>>32-a)+t}t.MD5=a._createHelper(c),t.HmacMD5=a._createHmacHelper(c)}(Math),r.MD5)}(dC);var lC={exports:{}},hC={exports:{}};!function(e,t){var r,n,i,a,o,s,c,u;e.exports=(n=(r=u=oC.exports).lib,i=n.WordArray,a=n.Hasher,o=r.algo,s=[],c=o.SHA1=a.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(e,t){for(var r=this._hash.words,n=r[0],i=r[1],a=r[2],o=r[3],c=r[4],u=0;u<80;u++){if(u<16)s[u]=0|e[t+u];else{var d=s[u-3]^s[u-8]^s[u-14]^s[u-16];s[u]=d<<1|d>>>31}var l=(n<<5|n>>>27)+c+s[u];l+=u<20?1518500249+(i&a|~i&o):u<40?1859775393+(i^a^o):u<60?(i&a|i&o|a&o)-1894007588:(i^a^o)-899497514,c=o,o=a,a=i<<30|i>>>2,i=n,n=l}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+c|0},_doFinalize:function(){var e=this._data,t=e.words,r=8*this._nDataBytes,n=8*e.sigBytes;return t[n>>>5]|=128<<24-n%32,t[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),t[15+(n+64>>>9<<4)]=r,e.sigBytes=4*t.length,this._process(),this._hash},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}}),r.SHA1=a._createHelper(c),r.HmacSHA1=a._createHmacHelper(c),u.SHA1)}(hC);var pC={exports:{}};!function(e,t){var r,n,i;e.exports=(n=(r=oC.exports).lib.Base,i=r.enc.Utf8,void(r.algo.HMAC=n.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var r=e.blockSize,n=4*r;t.sigBytes>n&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),o=this._iKey=t.clone(),s=a.words,c=o.words,u=0;u<r;u++)s[u]^=1549556828,c[u]^=909522486;a.sigBytes=o.sigBytes=n,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,r=this._hasher,n=r.finalize(e);return r.reset(),r.finalize(xm(t=this._oKey.clone()).call(t,n))}})))}(pC),function(e,t){var r,n,i,a,o,s,c,u;e.exports=(n=(r=u=oC.exports).lib,i=n.Base,a=n.WordArray,o=r.algo,s=o.MD5,c=o.EvpKDF=i.extend({cfg:i.extend({keySize:4,hasher:s,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var r,n=this.cfg,i=n.hasher.create(),o=a.create(),s=o.words,c=n.keySize,u=n.iterations;s.length<c;){r&&i.update(r),r=i.update(e).finalize(t),i.reset();for(var d=1;d<u;d++)r=i.finalize(r),i.reset();xm(o).call(o,r)}return o.sigBytes=4*c,o}}),r.EvpKDF=function(e,t,r){return c.create(r).compute(e,t)},u.EvpKDF)}(lC);var fC={exports:{}};!function(e,t){var r;e.exports=void((r=oC.exports).lib.Cipher||function(e){var t=r,n=t.lib,i=n.Base,a=n.WordArray,o=n.BufferedBlockAlgorithm,s=t.enc;s.Utf8;var c=s.Base64,u=t.algo.EvpKDF,d=n.Cipher=o.extend({cfg:i.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,r){this.cfg=this.cfg.extend(r),this._xformMode=e,this._key=t,this.reset()},reset:function(){o.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?g:m}return function(t){return{encrypt:function(r,n,i){return e(n).encrypt(t,r,n,i)},decrypt:function(r,n,i){return e(n).decrypt(t,r,n,i)}}}}()});n.StreamCipher=d.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var l=t.mode={},h=n.BlockCipherMode=i.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 r(t,r,n){var i,a=this._iv;a?(i=a,this._iv=e):i=this._prevBlock;for(var o=0;o<n;o++)t[r+o]^=i[o]}return t.Encryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize;r.call(this,e,t,i),n.encryptBlock(e,t),this._prevBlock=km(e).call(e,t,t+i)}}),t.Decryptor=t.extend({processBlock:function(e,t){var n=this._cipher,i=n.blockSize,a=km(e).call(e,t,t+i);n.decryptBlock(e,t),r.call(this,e,t,i),this._prevBlock=a}}),t}(),f=(t.pad={}).Pkcs7={pad:function(e,t){for(var r=4*t,n=r-e.sigBytes%r,i=n<<24|n<<16|n<<8|n,o=[],s=0;s<n;s+=4)o.push(i);var c=a.create(o,n);xm(e).call(e,c)},unpad:function(e){var t=255&e.words[e.sigBytes-1>>>2];e.sigBytes-=t}};n.BlockCipher=d.extend({cfg:d.cfg.extend({mode:p,padding:f}),reset:function(){var e;d.reset.call(this);var t=this.cfg,r=t.iv,n=t.mode;this._xformMode==this._ENC_XFORM_MODE?e=n.createEncryptor:(e=n.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==e?this._mode.init(this,r&&r.words):(this._mode=e.call(n,this,r&&r.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 v=n.CipherParams=i.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),_=(t.format={}).OpenSSL={stringify:function(e){var t,r,n=e.ciphertext,i=e.salt;return(i?xm(t=xm(r=a.create([1398893684,1701076831])).call(r,i)).call(t,n):n).toString(c)},parse:function(e){var t,r=c.parse(e),n=r.words;return 1398893684==n[0]&&1701076831==n[1]&&(t=a.create(km(n).call(n,2,4)),mk(n).call(n,0,4),r.sigBytes-=16),v.create({ciphertext:r,salt:t})}},m=n.SerializableCipher=i.extend({cfg:i.extend({format:_}),encrypt:function(e,t,r,n){n=this.cfg.extend(n);var i=e.createEncryptor(r,n),a=i.finalize(t),o=i.cfg;return v.create({ciphertext:a,key:r,iv:o.iv,algorithm:e,mode:o.mode,padding:o.padding,blockSize:e.blockSize,formatter:n.format})},decrypt:function(e,t,r,n){return n=this.cfg.extend(n),t=this._parse(t,n.format),e.createDecryptor(r,n).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}}),y=(t.kdf={}).OpenSSL={execute:function(e,t,r,n,i){var o;if(n||(n=a.random(8)),i)s=u.create({keySize:t+r,hasher:i}).compute(e,n);else var s=u.create({keySize:t+r}).compute(e,n);var c=a.create(km(o=s.words).call(o,t),4*r);return s.sigBytes=4*t,v.create({key:s,iv:c,salt:n})}},g=n.PasswordBasedCipher=m.extend({cfg:m.cfg.extend({kdf:y}),encrypt:function(e,t,r,n){var i=(n=this.cfg.extend(n)).kdf.execute(r,e.keySize,e.ivSize,n.salt,n.hasher);n.iv=i.iv;var a=m.encrypt.call(this,e,t,i.key,n);return a.mixIn(i),a},decrypt:function(e,t,r,n){n=this.cfg.extend(n),t=this._parse(t,n.format);var i=n.kdf.execute(r,e.keySize,e.ivSize,t.salt,n.hasher);return n.iv=i.iv,m.decrypt.call(this,e,t,i.key,n)}})}())}(fC),function(e,t){var r;e.exports=(r=oC.exports,function(){var e=r,t=e.lib.BlockCipher,n=e.algo,i=[],a=[],o=[],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 r=0,n=0;for(t=0;t<256;t++){var f=n^n<<1^n<<2^n<<3^n<<4;f=f>>>8^255&f^99,i[r]=f,a[f]=r;var v=e[r],_=e[v],m=e[_],y=257*e[f]^16843008*f;o[r]=y<<24|y>>>8,s[r]=y<<16|y>>>16,c[r]=y<<8|y>>>24,u[r]=y,y=16843009*m^65537*_^257*v^16843008*r,d[f]=y<<24|y>>>8,l[f]=y<<16|y>>>16,h[f]=y<<8|y>>>24,p[f]=y,r?(r=v^e[e[e[m^v]]],n^=e[e[n]]):r=n=1}}();var f=[0,1,2,4,8,16,32,64,128,27,54],v=n.AES=t.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var e=this._keyPriorReset=this._key,t=e.words,r=e.sigBytes/4,n=4*((this._nRounds=r+6)+1),a=this._keySchedule=[],o=0;o<n;o++)o<r?a[o]=t[o]:(u=a[o-1],o%r?r>6&&o%r==4&&(u=i[u>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u]):(u=i[(u=u<<8|u>>>24)>>>24]<<24|i[u>>>16&255]<<16|i[u>>>8&255]<<8|i[255&u],u^=f[o/r|0]<<24),a[o]=a[o-r]^u);for(var s=this._invKeySchedule=[],c=0;c<n;c++){if(o=n-c,c%4)var u=a[o];else u=a[o-4];s[c]=c<4||o<=4?u:d[i[u>>>24]]^l[i[u>>>16&255]]^h[i[u>>>8&255]]^p[i[255&u]]}}},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,c,u,i)},decryptBlock:function(e,t){var r=e[t+1];e[t+1]=e[t+3],e[t+3]=r,this._doCryptBlock(e,t,this._invKeySchedule,d,l,h,p,a),r=e[t+1],e[t+1]=e[t+3],e[t+3]=r},_doCryptBlock:function(e,t,r,n,i,a,o,s){for(var c=this._nRounds,u=e[t]^r[0],d=e[t+1]^r[1],l=e[t+2]^r[2],h=e[t+3]^r[3],p=4,f=1;f<c;f++){var v=n[u>>>24]^i[d>>>16&255]^a[l>>>8&255]^o[255&h]^r[p++],_=n[d>>>24]^i[l>>>16&255]^a[h>>>8&255]^o[255&u]^r[p++],m=n[l>>>24]^i[h>>>16&255]^a[u>>>8&255]^o[255&d]^r[p++],y=n[h>>>24]^i[u>>>16&255]^a[d>>>8&255]^o[255&l]^r[p++];u=v,d=_,l=m,h=y}v=(s[u>>>24]<<24|s[d>>>16&255]<<16|s[l>>>8&255]<<8|s[255&h])^r[p++],_=(s[d>>>24]<<24|s[l>>>16&255]<<16|s[h>>>8&255]<<8|s[255&u])^r[p++],m=(s[l>>>24]<<24|s[h>>>16&255]<<16|s[u>>>8&255]<<8|s[255&d])^r[p++],y=(s[h>>>24]<<24|s[u>>>16&255]<<16|s[d>>>8&255]<<8|s[255&l])^r[p++],e[t]=v,e[t+1]=_,e[t+2]=m,e[t+3]=y},keySize:8});e.AES=t._createHelper(v)}(),r.AES)}(cC);var vC={exports:{}};!function(e,t){e.exports=oC.exports.enc.Hex}(vC);var _C=vC.exports,mC={exports:{}};!function(e,t){var r,n,i;e.exports=((i=oC.exports).mode.CTR=(r=i.lib.BlockCipherMode.extend(),n=r.Encryptor=r.extend({processBlock:function(e,t){var r=this._cipher,n=r.blockSize,i=this._iv,a=this._counter;i&&(a=this._counter=km(i).call(i,0),this._iv=void 0);var o=km(a).call(a,0);r.encryptBlock(o,0),a[n-1]=a[n-1]+1|0;for(var s=0;s<n;s++)e[t+s]^=o[s]}}),r.Decryptor=n,r),i.mode.CTR)}(mC);var yC=mC.exports,gC={exports:{}};!function(e,t){var r;e.exports=((r=oC.exports).pad.NoPadding={pad:function(){},unpad:function(){}},r.pad.NoPadding)}(gC);var SC,EC,bC,kC=gC.exports,TC=new TextDecoder,IC=new TextEncoder,AC=function(){return rC()},RC=function(){return Date.now()};function CC(e){for(var t=0,r=arguments.length,n=new Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];for(var a=0,o=n;a<o.length;a++){var s=o[a];t+=s.length}for(var c=new e(t),u=0,d=0,l=n;d<l.length;d++){var h=l[d];c.set(h,u),u+=h.length}return c}var wC=function(){return"undefined"==typeof window},xC=function(){function e(){Wd(this,e)}var t,r;return qd(e,null,[{key:"token2auth",value:function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))}},{key:"createUnsafeToken",value:function(e,t,r){var n;return window.btoa(Gs(n=[e,t,r]).call(n,(function(e){return null!==e})).join(":"))}},{key:"merge",value:function(){for(var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,i=bR(t);n<i.length;n++){var a=$T(i[n],2),o=a[0],s=a[1];null!==s&&"object"===dy(s)?e.merge(t[o],r[o]):void 0!==r[o]&&(t[o]=r[o])}}},{key:"ab2str",value:function(e){return TC.decode(e)}},{key:"ab2obj",value:function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(n){return{}}}},{key:"str2ab",value:function(e){return IC.encode(e).buffer}},{key:"ab2b64str",value:(r=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new v_((function(e){var r=new FileReader;r.onload=function(){return e(r.result)},r.readAsDataURL(new Blob([t]))}));case 2:return r=e.sent,e.abrupt("return",r.split(",",2)[1]);case 4:case"end":return e.stop()}}),e)}))),function(e){return r.apply(this,arguments)})},{key:"b64str2ab",value:(t=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",fetch("data:application/octet;base64,"+t).then((function(e){return e.arrayBuffer()})));case 1:case"end":return e.stop()}}),e)}))),function(e){return t.apply(this,arguments)})}]),e}();function OC(){var e="none";return wC()||(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 DC=function(){if("chrome-stable"===OC()){var e=window.navigator.userAgent.match(/Chrome\/([\d.]+)/);if(e&&e.length>1)if(Number(e[1].split(".")[0])<114)return!0}return!1}(),PC="mozilla"===OC(),NC="safari"===OC(),MC=0,LC=!wC()&&(null===(SC=navigator.userAgent.match(/version\/(\d+)/i))||void 0===SC?void 0:SC[1]);NC&&LC&&(MC=+LC);var UC=!wC()&&(null===(EC=navigator.userAgent.match(/Firefox\/(\d+)/i))||void 0===EC?void 0:EC[1]);PC&&UC&&(MC=+UC);var VC=MC,FC=MC,BC=!wC()&&!!/(iPhone|iPad|iPod)/i.exec(navigator.userAgent);!wC()&&/(iPhone|iPod)/i.exec(navigator.userAgent);var jC=!wC()&&(!!/(iPad)/i.exec(navigator.userAgent)||/Macintosh/i.test(navigator.userAgent)&&"ontouchend"in document),GC=!wC()&&/MicroMessenger/i.test(navigator.userAgent),HC=!wC()&&/Android/i.test(navigator.userAgent);!wC()&&$m(bC=navigator.userAgent.toLowerCase()).call(bC,"mobile");var zC=!wC()&&/chrome\/(86)|(87)|(88)|(89)|(90)|(91)|(92)/i.test(navigator.userAgent);function KC(){for(var e,t,r=(+HR(e=km(t="".concat(Math.random())).call(t,-7)).call(e,7,"0")).toString(2),n=HR(r).call(r,28,"1").split(""),i=[];n.length;)i.push(mk(n).call(n,0,7));return uy(i).call(i,(function(e,t){var r=t===i.length-1?"0":"1";return KR(r+e.join(""),2)}))}var XC=function(){return Math.floor(65535*Math.random())};function qC(e){return"string"==typeof e&&Kb(e).call(e,"__web__rtc__rtt__")>-1}function WC(e){return uy(e).call(e,(function e(t){var r;if(null!=t&&t._reportName)return t._reportName;if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var n,i,a=ArrayBuffer.isView(t)?t.buffer:t,o=a.byteLength,s=[];if(o>10){var c,u,d,l,h=new DataView(a),p=uy(c=Wk({length:5})).call(c,(function(e,t){return h.getUint8(t)})),f=uy(u=uy(d=Wk({length:5})).call(d,(function(e,t){return o-1-t})).reverse()).call(u,(function(e){return h.getUint8(e)}));s=xm(l=[]).call(l,Qk(p),["..."],Qk(f))}else s=Wk(new Uint8Array(a));return xm(n=xm(i="".concat(t.constructor.name,"(")).call(i,o,") [")).call(n,s.join(", "),"]")}if(t instanceof ImageData)return"ImageData";if(Array.isArray(t))return uy(t).call(t,e);if($m(r=["[object Object]","[object MediaStreamTrack]"]).call(r,Object.prototype.toString.call(t))){var v={};for(var _ in t)v[_]=e(t[_]);return v}return t}))}var YC=function(){var e=m_(Im.mark((function e(){var t,r,n,i=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]&&i[0],(r=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),r.addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),t&&(r.addTransceiver("audio",{direction:"sendonly"}),r.addTransceiver("video",{direction:"sendonly"})),e.next=8,r.createOffer();case 8:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),QC=function(e){return new v_((function(t,r){var n=(e=Array.isArray(e)?e:[]).length,i=[];0===n?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){n--,i.push(e),0===n&&r(i)}))}))}))};function JC(e){return+Math.max(-127,10*YR(Math.pow(e/255,2))).toFixed(2)}function ZC(e){return(e&Sd.AUDIO)===Sd.AUDIO}function $C(e){return(e&Sd.VIDEO)===Sd.VIDEO}function ew(e){var t={};return on(e).forEach((function(r){"object"===dy(e[r])?t[r]=ew(e[r]):dR(r).call(r,"_")||(t[r]=e[r])})),t}function tw(e){var t=new DataView(e.buffer);if(t.byteLength<=4||65535!==t.getUint16(0))return{seiCount:1,seis:[e]};for(var r={seiCount:0,seis:[]},n=!1,i=2;i<t.byteLength;){var a=t.getUint16(i);if(i+=2,t.byteLength-i<a){n=!0;break}var o=new Uint8Array(e.buffer,i,a);if(i+=a,t.byteLength-i>0&&t.byteLength-i<=2){n=!0;break}r.seiCount++,r.seis.push(o)}return n&&(r.seiCount=1,r.seis=[e]),r}function rw(e){return null==e?"undefined | null":"string"==typeof e?e:ny({contentHint:e.contentHint,enabled:e.enabled,id:e.id,kind:e.kind,label:e.label,muted:e.muted,readyState:e.readyState})}function nw(e){return void 0===e}function iw(e){return function(t,r,n){var i=n.value;n.value=function(){var t;console.warn(xm(t="[RTC WebSDK]: Api: ".concat(r," has been abandoned from version ")).call(t,e));for(var n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];return i.apply(this,a)}}}function aw(e){console.warn("[RTC WebSDK]: "+e)}function ow(e){return"number"==typeof e?e:"number"==typeof(null==e?void 0:e.exact)?e.exact:"number"==typeof(null==e?void 0:e.ideal)?e.ideal:"number"==typeof(null==e?void 0:e.max)?e.max:"number"==typeof(null==e?void 0:e.min)?e.min:1}var sw=function(){function e(){Wd(this,e),sd(this,"_running",!1),sd(this,"_queue",[])}return qd(e,[{key:"add",value:function(e,t){this._queue.push([e,t]),this._running||(this._running=!0,this._process())}},{key:"_process",value:function(){var e=this,t=$T(this._queue.shift()||[],2),r=t[0],n=t[1];r&&n?r.then((function(t){n(t),e._process()})).catch((function(){e._process()})):this._running=!1}}]),e}();function cw(e){for(var t=atob(e),r=t.length,n=new Uint8Array(r),i=0;i<r;i++)n[i]=t.charCodeAt(i);return n}function uw(e){for(var t="",r=e.byteLength,n=0;n<r;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function dw(e,t,r){var n=lw(e),i=lw(t),a=lw(r);return function(e){for(var t=e.toString(_C),r=new Uint8Array(t.length/2),n=0;n<t.length;n+=2)r[n/2]=Dy(t.substr(n,2),16);return r}(cC.exports.encrypt(n,i,{iv:a,mode:yC,padding:kC}).ciphertext)}function lw(e){for(var t=[],r=0;r<e.length;r+=4)t.push(e[r]<<24|(e[r+1]||0)<<16|(e[r+2]||0)<<8|(e[r+3]||0));return sC.create(t,e.length)}function hw(e,t){if("boolean"!=typeof e)throw new pR(lR.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function pw(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(e<r||e>n||"number"!=typeof e){var i,a,o=new pR(lR.INVALID_PARAMS,xm(i=xm(a="Invalid ".concat(t,": the value range is [")).call(a,r,", ")).call(i,n,"]. integer only"));throw o}}function fw(e,t){var r,n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Number.POSITIVE_INFINITY;if(null==e)throw new pR(lR.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!Sw(e,i,a))throw new pR(lR.INVALID_PARAMS,xm(r=xm(n="Invalid ".concat(t,": The value should be string type. Length of the string: [")).call(n,i,",")).call(r,a,"]"))}function vw(e,t,r){var n;if(!$m(r).call(r,e))throw new pR(lR.INVALID_PARAMS,xm(n="Invalid ".concat(t,": The value can only be set as ")).call(n,ny(r)))}function _w(e){if(!(e instanceof MediaStreamTrack))throw new pR(lR.INVALID_PARAMS,"Invalid track, The value should be MediaStreamTrack type.")}function mw(e,t){if(Ew(e))throw new pR(lR.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function yw(e,t){if(!(e instanceof ArrayBuffer))throw new pR(lR.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function gw(e){try{for(var t=navigator.mediaDevices.getSupportedConstraints(),r=0,n=on(e);r<n.length;r++){var i=n[r];t[i]||delete e[i]}}catch(a){}}function Sw(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Number.POSITIVE_INFINITY;return"string"==typeof e&&e.length<=r&&e.length>=t}function Ew(e){return null==e}function bw(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new pR(lR.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function kw(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new pR(lR.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function Tw(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new pR(lR.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function Iw(e){mw(e,"userInfo"),kw(e.userId),Ew(e.extraInfo)||fw(e.extraInfo,"userInfo.extraInfo",1,200)}function Aw(e){mw(e,"roomConfig"),hw(e.isAutoPublish,"roomConfig.isAutoPublish"),hw(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),hw(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo"),Ew(e.roomProfileType)||vw(e.roomProfileType,"roomConfig",[Dd.communication,Dd.chat,Dd.chatRoom,Dd.coHost,Dd.meeting,Dd.classRoom])}function Rw(e){mw(e,"videoPlayerOption")}function Cw(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:64;if(!e||0===(null==e?void 0:e.byteLength))throw new pR(lR.INVALID_PARAMS,"The message cannot be empty");if((null===(t=e instanceof ArrayBuffer?e:xC.str2ab(ny(e)))||void 0===t?void 0:t.byteLength)>1e3*r)throw new pR(lR.INVALID_PARAMS,"The message length must be less than ".concat(r,"K"))}function ww(e){var t;return!$m(t=[Kd.onRemoteStreamStats,Kd.onLocalStreamStats,Kd.onAudioVolumeIndication,Kd.onLocalAudioPropertiesReport,Kd.onRemoteAudioPropertiesReport]).call(t,e)}function xw(e){if("number"!=typeof(null==e?void 0:e.width)||"number"!=typeof(null==e?void 0:e.height))throw new pR(lR.INVALID_PARAMS,"remoteVideoConfig must contain width, height, frameRate")}function Ow(e,t){if("number"!=typeof e||Number.isNaN(e)||!(e>=1)){var r=e;if(!(null!=r&&r.min||null!=r&&r.max||null!=r&&r.exact||null!=r&&r.ideal))throw new pR(lR.INVALID_PARAMS,"".concat(t," is not a valid ConstrainULong"))}}function Dw(e){var t,r=ZT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;pw(null==n?void 0:n.maxKbps,"maxKbps"),Ow(null==n?void 0:n.width,"width"),Ow(null==n?void 0:n.height,"height"),Ow(null==n?void 0:n.frameRate,"frameRate")}}catch(i){r.e(i)}finally{r.f()}}var Pw={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,n,a,o){if("function"!=typeof n)throw new TypeError("The listener must be a function");var s=new i(n,a||e,o),c=r?r+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 o(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function s(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?km(n).call(n,1):n);return xs?xm(i).call(i,xs(e)):i},s.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=new Array(a);i<a;i++)o[i]=n[i].fn;return o},s.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},s.prototype.emit=function(e,t,n,i,a,o){var s=r?r+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,n),!0;case 4:return d.fn.call(d.context,t,n,i),!0;case 5:return d.fn.call(d.context,t,n,i,a),!0;case 6:return d.fn.call(d.context,t,n,i,a,o),!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,n);break;case 4:d[u].fn.call(d[u].context,t,n,i);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,r){return a(this,e,t,r,!1)},s.prototype.once=function(e,t,r){return a(this,e,t,r,!0)},s.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return o(this,a),this;var s=this._events[a];if(s.fn)s.fn!==t||i&&!s.once||n&&s.context!==n||o(this,a);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||i&&!s[c].once||n&&s[c].context!==n)&&u.push(s[c]);u.length?this._events[a]=1===u.length?u[0]:u:o(this,a)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&o(this,t)):(this._events=new n,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=r,s.EventEmitter=s,e.exports=s}(Pw);var Nw,Mw=Pw.exports,Lw=Us("Array").keys,Uw=vn,Vw=Ye,Fw=oe,Bw=Lw,jw=Array.prototype,Gw={DOMTokenList:!0,NodeList:!0},Hw=function(e){var t=e.keys;return e===jw||Fw(jw,e)&&t===jw.keys||Vw(Gw,Uw(e))?Bw:t},zw="@byted/ve-rtc",Kw="@byted/ve-rtc-cache-size",Xw=function(){function e(){Wd(this,e),sd(this,"storeKey",void 0),sd(this,"logLevel",void 0),sd(this,"LogfileSize",void 0),sd(this,"db",void 0),sd(this,"logId",void 0),sd(this,"cacheLog",void 0),sd(this,"cachedSize",void 0),sd(this,"preCacheTime",void 0),sd(this,"timer",void 0),sd(this,"_getSize",(function(e){return new Blob(e).size/1048576})),this.storeKey="",this.logId=1,this.cacheLog="",this.logLevel="none",this.LogfileSize=100,this._createStore()}return qd(e,[{key:"_createStore",value:function(){var e=this;if(!wC()&&window.indexedDB){var t=indexedDB.open("@byted/ve-rtc");t.onupgradeneeded=function(){t.result.createObjectStore(zw);try{localStorage.removeItem(Kw)}catch(PX){}},t.onerror=function(e){},t.onsuccess=function(){e.db=t.result,e._getCachedSize()}}}},{key:"_getCachedSize",value:function(){var e=this;try{var t=localStorage.getItem(Kw);if(t)this.cachedSize=+t;else nA(this).call(this).then((function(t){e.cachedSize=e._getSize(t),e._setCachedSize()}))}catch(PX){}}},{key:"_setCachedSize",value:function(){try{localStorage.setItem(Kw,"".concat(this.cachedSize))}catch(PX){}}},{key:"_getStore",value:function(e){if(this.db)return this.db.transaction(zw,e).objectStore(zw)}},{key:"set",value:function(e){var t=this;return new v_((function(r,n){if("none"===t.logLevel)return r();var i;if(e&&t.preCacheTime&&t.preCacheTime-Date.now()<1e3)return t.cacheLog+=xm(i="\n\n".concat(t.logId,": ")).call(i,e),t.logId++,t.timer||(t.timer=setTimeout((function(){t.set("")}),1e3-(t.preCacheTime-Date.now()))),r();clearTimeout(t.timer),t.timer=null;var a=t._getStore("readwrite");if(!a)return n("get store fail");t.cachedSize&&t.cachedSize>t.LogfileSize&&t.keyEarliest().then((function(e){t.get(e).then((function(r){t.del(e).then((function(){t.cachedSize=t.cachedSize-t._getSize(["".concat(r)]),t._setCachedSize()}))}))}));var o=a.get(t.storeKey);o.onsuccess=function(){try{var i,s,c,u,d,l=xm(i="".concat(o.result||"")).call(i,t.cacheLog),h=e?xm(s=xm(c="".concat(l?"\n\n":"")).call(c,t.logId,": ")).call(s,e):"";a.put(xm(u="".concat(l)).call(u,h),t.storeKey),e&&t.logId++,t.cacheLog="",t.cachedSize=(t.cachedSize||0)+t._getSize([xm(d="".concat(t.cacheLog)).call(d,h)]),t._setCachedSize(),t.preCacheTime=Date.now(),r()}catch(f){var p;if(!e)return n(f);t.cacheLog+=xm(p="\n\n".concat(t.logId,": ")).call(p,e),t.logId++,n(f)}},o.onerror=function(r){var i;if(!e)return n(r);t.cacheLog+=xm(i="\n\n".concat(t.logId,": ")).call(i,e),t.logId++,n(r)}}))}},{key:"get",value:function(e){var t=this;return new v_((function(r,n){var i=t._getStore("readonly");if(!i)return n();var a=i.get(e);a.onsuccess=function(){r(a.result)},a.onerror=function(e){n(e)}}))}},{key:"del",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.storeKey;return new v_((function(r,n){var i=e._getStore("readwrite");if(!i)return n();var a=i.delete(t);a.onsuccess=function(){return r(a.result)},a.onerror=function(e){return n(e)}}))}},{key:"keyEarliest",value:function(){return Hw(this).call(this).then((function(e){var t,r=Date.now();return e.forEach((function(e){if(e&&e.length){var n=e.split("-")[0];Number(n)<r&&(r=Number(n),t=e)}})),t}))}},{key:"keys",value:function(){var e=this;return new v_((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAllKeys){var i=n.getAllKeys();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var a=[];n.openCursor().onsuccess=function(){this.result&&(a.push(this.result.key),this.result.continue())},n.transaction.oncomplete=function(){return t(a)}}))}},{key:"values",value:function(){var e=this;return new v_((function(t,r){var n=e._getStore("readonly");if(!n)return r();if(n.getAll){var i=n.getAll();return i.onsuccess=function(){t(i.result)},void(i.onerror=function(){r()})}var a=[];n.openCursor().onsuccess=function(){this.result&&(a.push(this.result.value),this.result.continue())},n.transaction.oncomplete=function(){return t(a)}}))}},{key:"download",value:function(e){e=e||this.storeKey,this.get(e).then((function(t){var r=document.createElement("a");r.download="".concat(e,".txt"),r.href="data:text/paint;utf-8,"+(t||""),r.click()}))}}]),e}(),qw=new Xw,Ww="[VERTC]",Yw=["#0050b3","#0050b3","#0050b3","#0050b3","#0050b3"],Qw=!wC()&&$m(Nw=window.location.search).call(Nw,"_rtc_debug_"),Jw=function(){function e(t,r,n){Wd(this,e),sd(this,"_indent",void 0),sd(this,"_module",void 0),sd(this,"_id",void 0),this._module=t,this._indent=r}return qd(e,[{key:"print",value:function(e){for(var t,r,n,i,a,o,s,c=arguments.length,u=new Array(c>1?c-1:0),d=1;d<c;d++)u[d-1]=arguments[d];var l=u.shift();try{var h,p,f,v,_,m=xm(h=[]).call(h,u),y="".concat(l).replace(/\%o/gi,(function(){var e=m.shift();return ny(e)}));qw.set(xm(p=xm(f=xm(v=xm(_="".concat(Ww,"[")).call(_,this._module,".")).call(v,e,"] ")).call(f,y," ")).call(p,uy(m).call(m,(function(e){return ny(e)})).join(", ")))}catch(PX){}if(Qw){for(var g="",S=0;S<this._indent;S++)g+=" ";(t=console).log.apply(t,xm(r=[xm(n=xm(i=xm(a=xm(o=xm(s="%c".concat(Zw(),"-")).call(s,Ww)).call(o,g,"[")).call(a,this._module,".")).call(i,e,"] ")).call(n,l),"color:".concat(Yw[this._indent],";")]).call(r,u))}}}]),e}(),Zw=function(){var e=new Date;return e.toTimeString().split(" ")[0]+":"+e.getMilliseconds()},$w=new Jw("VERTC",0),ex=function(e){DI(r,e);var t=YI(r);function r(){return Wd(this,r),t.apply(this,arguments)}return qd(r,[{key:"safeEmit",value:function(e){var t=this.listenerCount(e);try{for(var n,i,a=arguments.length,o=new Array(a>1?a-1:0),s=1;s<a;s++)o[s-1]=arguments[s];return(n=xI(CI(r.prototype),"emit",this)).call.apply(n,xm(i=[this,e]).call(i,o))}catch(PX){return $w.print("safeEmit","safeEmit() | event listener threw an error [event:%s]:%o",e,PX),console.error(PX),Boolean(t)}}}]),r}(Pw.exports.EventEmitter),tx=O,rx=tr,nx=$,ix=rI,ax=Qt,ox=R,sx=mc,cx=V;Rr({target:"Reflect",stat:!0,forced:i((function(){var e=function(){},t=ax.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}))},{set:function e(t,r,n){var i,a,o,s=arguments.length<4?t:arguments[3],c=ox.f(rx(t),r);if(!c){if(nx(a=sx(t)))return e(a,r,n,s);c=cx(0)}if(ix(c)){if(!1===c.writable||!nx(s))return!1;if(i=ox.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,ax.f(s,r,i)}else ax.f(s,r,cx(0,n))}else{if(void 0===(o=c.set))return!1;tx(o,s,n)}return!0}});var ux=ee.Reflect.set,dx={};!function(e){var t="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 t=km(Array.prototype).call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==dy(n))throw new TypeError(n+"must be non-object");for(var i in n)r(n,i)&&(e[i]=n[i])}}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,r,n,i){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+n),i);else for(var a=0;a<n;a++)e[i+a]=t[r+a]},flattenChunks:function(e){var t,r,n,i,a,o;for(n=0,t=0,r=e.length;t<r;t++)n+=e[t].length;for(o=new Uint8Array(n),i=0,t=0,r=e.length;t<r;t++)a=e[t],o.set(a,i),i+=a.length;return o}},i={arraySet:function(e,t,r,n,i){for(var a=0;a<n;a++)e[i+a]=t[r+a]},flattenChunks:function(e){return xm([]).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,i))},e.setTyped(t)}(dx);var lx={},hx={},px={},fx=dx;function vx(e){for(var t=e.length;--t>=0;)e[t]=0}var _x=256,mx=286,yx=30,gx=15,Sx=[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],Ex=[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],bx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],kx=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Tx=new Array(576);vx(Tx);var Ix=new Array(60);vx(Ix);var Ax=new Array(512);vx(Ax);var Rx=new Array(256);vx(Rx);var Cx=new Array(29);vx(Cx);var wx,xx,Ox,Dx=new Array(yx);function Px(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}function Nx(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Mx(e){return e<256?Ax[e]:Ax[256+(e>>>7)]}function Lx(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function Ux(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,Lx(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=r-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=r)}function Vx(e,t,r){Ux(e,r[2*t],r[2*t+1])}function Fx(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function Bx(e,t,r){var n,i,a=new Array(16),o=0;for(n=1;n<=gx;n++)a[n]=o=o+r[n-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];0!==s&&(e[2*i]=Fx(a[s]++,s))}}function jx(e){var t;for(t=0;t<mx;t++)e.dyn_ltree[2*t]=0;for(t=0;t<yx;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 Gx(e){e.bi_valid>8?Lx(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 Hx(e,t,r,n){var i=2*t,a=2*r;return e[i]<e[a]||e[i]===e[a]&&n[t]<=n[r]}function zx(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&Hx(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Hx(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function Kx(e,t,r){var n,i,a,o,s=0;if(0!==e.last_lit)do{n=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],i=e.pending_buf[e.l_buf+s],s++,0===n?Vx(e,i,t):(Vx(e,(a=Rx[i])+_x+1,t),0!==(o=Sx[a])&&Ux(e,i-=Cx[a],o),Vx(e,a=Mx(--n),r),0!==(o=Ex[a])&&Ux(e,n-=Dx[a],o))}while(s<e.last_lit);Vx(e,256,t)}function Xx(e,t){var r,n,i,a=t.dyn_tree,o=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,r=0;r<c;r++)0!==a[2*r]?(e.heap[++e.heap_len]=u=r,e.depth[r]=0):a[2*r+1]=0;for(;e.heap_len<2;)a[2*(i=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[i]=0,e.opt_len--,s&&(e.static_len-=o[2*i+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)zx(e,a,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],zx(e,a,1),n=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=n,a[2*i]=a[2*r]+a[2*n],e.depth[i]=(e.depth[r]>=e.depth[n]?e.depth[r]:e.depth[n])+1,a[2*r+1]=a[2*n+1]=i,e.heap[1]=i++,zx(e,a,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,n,i,a,o,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,v=0;for(a=0;a<=gx;a++)e.bl_count[a]=0;for(c[2*e.heap[e.heap_max]+1]=0,r=e.heap_max+1;r<573;r++)(a=c[2*c[2*(n=e.heap[r])+1]+1]+1)>f&&(a=f,v++),c[2*n+1]=a,n>u||(e.bl_count[a]++,o=0,n>=p&&(o=h[n-p]),s=c[2*n],e.opt_len+=s*(a+o),l&&(e.static_len+=s*(d[2*n+1]+o)));if(0!==v){do{for(a=f-1;0===e.bl_count[a];)a--;e.bl_count[a]--,e.bl_count[a+1]+=2,e.bl_count[f]--,v-=2}while(v>0);for(a=f;0!==a;a--)for(n=e.bl_count[a];0!==n;)(i=e.heap[--r])>u||(c[2*i+1]!==a&&(e.opt_len+=(a-c[2*i+1])*c[2*i],c[2*i+1]=a),n--)}}(e,t),Bx(a,u,e.bl_count)}function qx(e,t,r){var n,i,a=-1,o=t[1],s=0,c=7,u=4;for(0===o&&(c=138,u=3),t[2*(r+1)+1]=65535,n=0;n<=r;n++)i=o,o=t[2*(n+1)+1],++s<c&&i===o||(s<u?e.bl_tree[2*i]+=s:0!==i?(i!==a&&e.bl_tree[2*i]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,a=i,0===o?(c=138,u=3):i===o?(c=6,u=3):(c=7,u=4))}function Wx(e,t,r){var n,i,a=-1,o=t[1],s=0,c=7,u=4;for(0===o&&(c=138,u=3),n=0;n<=r;n++)if(i=o,o=t[2*(n+1)+1],!(++s<c&&i===o)){if(s<u)do{Vx(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==a&&(Vx(e,i,e.bl_tree),s--),Vx(e,16,e.bl_tree),Ux(e,s-3,2)):s<=10?(Vx(e,17,e.bl_tree),Ux(e,s-3,3)):(Vx(e,18,e.bl_tree),Ux(e,s-11,7));s=0,a=i,0===o?(c=138,u=3):i===o?(c=6,u=3):(c=7,u=4)}}vx(Dx);var Yx=!1;function Qx(e,t,r,n){Ux(e,0+(n?1:0),3),function(e,t,r,n){Gx(e),n&&(Lx(e,r),Lx(e,~r)),fx.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}px._tr_init=function(e){Yx||(!function(){var e,t,r,n,i,a=new Array(16);for(r=0,n=0;n<28;n++)for(Cx[n]=r,e=0;e<1<<Sx[n];e++)Rx[r++]=n;for(Rx[r-1]=n,i=0,n=0;n<16;n++)for(Dx[n]=i,e=0;e<1<<Ex[n];e++)Ax[i++]=n;for(i>>=7;n<yx;n++)for(Dx[n]=i<<7,e=0;e<1<<Ex[n]-7;e++)Ax[256+i++]=n;for(t=0;t<=gx;t++)a[t]=0;for(e=0;e<=143;)Tx[2*e+1]=8,e++,a[8]++;for(;e<=255;)Tx[2*e+1]=9,e++,a[9]++;for(;e<=279;)Tx[2*e+1]=7,e++,a[7]++;for(;e<=287;)Tx[2*e+1]=8,e++,a[8]++;for(Bx(Tx,287,a),e=0;e<yx;e++)Ix[2*e+1]=5,Ix[2*e]=Fx(e,5);wx=new Px(Tx,Sx,257,mx,gx),xx=new Px(Ix,Ex,0,yx,gx),Ox=new Px(new Array(0),bx,0,19,7)}(),Yx=!0),e.l_desc=new Nx(e.dyn_ltree,wx),e.d_desc=new Nx(e.dyn_dtree,xx),e.bl_desc=new Nx(e.bl_tree,Ox),e.bi_buf=0,e.bi_valid=0,jx(e)},px._tr_stored_block=Qx,px._tr_flush_block=function(e,t,r,n){var i,a,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,r=4093624447;for(t=0;t<=31;t++,r>>>=1)if(1&r&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<_x;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),Xx(e,e.l_desc),Xx(e,e.d_desc),o=function(e){var t;for(qx(e,e.dyn_ltree,e.l_desc.max_code),qx(e,e.dyn_dtree,e.d_desc.max_code),Xx(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*kx[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),i=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=i&&(i=a)):i=a=r+5,r+4<=i&&-1!==t?Qx(e,t,r,n):4===e.strategy||a===i?(Ux(e,2+(n?1:0),3),Kx(e,Tx,Ix)):(Ux(e,4+(n?1:0),3),function(e,t,r,n){var i;for(Ux(e,t-257,5),Ux(e,r-1,5),Ux(e,n-4,4),i=0;i<n;i++)Ux(e,e.bl_tree[2*kx[i]+1],3);Wx(e,e.dyn_ltree,t-1),Wx(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Kx(e,e.dyn_ltree,e.dyn_dtree)),jx(e),n&&Gx(e)},px._tr_tally=function(e,t,r){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&r,e.last_lit++,0===t?e.dyn_ltree[2*r]++:(e.matches++,t--,e.dyn_ltree[2*(Rx[r]+_x+1)]++,e.dyn_dtree[2*Mx(t)]++),e.last_lit===e.lit_bufsize-1},px._tr_align=function(e){Ux(e,2,3),Vx(e,256,Tx),function(e){16===e.bi_valid?(Lx(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 Jx=function(e,t,r,n){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;0!==r;){r-=o=r>2e3?2e3:r;do{a=a+(i=i+t[n++]|0)|0}while(--o);i%=65521,a%=65521}return i|a<<16|0};var Zx=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var $x,eO=function(e,t,r,n){var i=Zx,a=n+r;e^=-1;for(var o=n;o<a;o++)e=e>>>8^i[255&(e^t[o])];return-1^e},tO={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"},rO=dx,nO=px,iO=Jx,aO=eO,oO=tO,sO=-2,cO=258,uO=262,dO=103,lO=113,hO=666;function pO(e,t){return e.msg=oO[t],t}function fO(e){return(e<<1)-(e>4?9:0)}function vO(e){for(var t=e.length;--t>=0;)e[t]=0}function _O(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(rO.arraySet(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,0===t.pending&&(t.pending_out=0))}function mO(e,t){nO._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,_O(e.strm)}function yO(e,t){e.pending_buf[e.pending++]=t}function gO(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function SO(e,t){var r,n,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-uO?e.strstart-(e.w_size-uO):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+cO,p=u[a+o-1],f=u[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(r=t)+o]===f&&u[r+o-1]===p&&u[r]===u[a]&&u[++r]===u[a+1]){a+=2,r++;do{}while(u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&u[++a]===u[++r]&&a<h);if(n=cO-(h-a),a=h-cO,n>o){if(e.match_start=t,o=n,n>=s)break;p=u[a+o-1],f=u[a+o]}}}while((t=l[t&d])>c&&0!=--i);return o<=e.lookahead?o:e.lookahead}function EO(e){var t,r,n,i,a,o,s,c,u,d,l=e.w_size;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-uO)){rO.arraySet(e.window,e.window,l,l,0),e.match_start-=l,e.strstart-=l,e.block_start-=l,t=r=e.hash_size;do{n=e.head[--t],e.head[t]=n>=l?n-l:0}while(--r);t=r=l;do{n=e.prev[--t],e.prev[t]=n>=l?n-l:0}while(--r);i+=l}if(0===e.strm.avail_in)break;if(o=e.strm,s=e.window,c=e.strstart+e.lookahead,u=i,d=void 0,(d=o.avail_in)>u&&(d=u),r=0===d?0:(o.avail_in-=d,rO.arraySet(s,o.input,o.next_in,d,c),1===o.state.wrap?o.adler=iO(o.adler,s,d,c):2===o.state.wrap&&(o.adler=aO(o.adler,s,d,c)),o.next_in+=d,o.total_in+=d,d),e.lookahead+=r,e.lookahead+e.insert>=3)for(a=e.strstart-e.insert,e.ins_h=e.window[a],e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[a+3-1])&e.hash_mask,e.prev[a&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=a,a++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<uO&&0!==e.strm.avail_in)}function bO(e,t){for(var r,n;;){if(e.lookahead<uO){if(EO(e),e.lookahead<uO&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==r&&e.strstart-r<=e.w_size-uO&&(e.match_length=SO(e,r)),e.match_length>=3)if(n=nO._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,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart}while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else n=nO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(mO(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(mO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(mO(e,!1),0===e.strm.avail_out)?1:2}function kO(e,t){for(var r,n,i;;){if(e.lookahead<uO){if(EO(e),e.lookahead<uO&&0===t)return 1;if(0===e.lookahead)break}if(r=0,e.lookahead>=3&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==r&&e.prev_length<e.max_lazy_match&&e.strstart-r<=e.w_size-uO&&(e.match_length=SO(e,r),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){i=e.strstart+e.lookahead-3,n=nO._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<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,r=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart)}while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,n&&(mO(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=nO._tr_tally(e,0,e.window[e.strstart-1]))&&mO(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(n=nO._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(mO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(mO(e,!1),0===e.strm.avail_out)?1:2}function TO(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}function IO(){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 rO.Buf16(1146),this.dyn_dtree=new rO.Buf16(122),this.bl_tree=new rO.Buf16(78),vO(this.dyn_ltree),vO(this.dyn_dtree),vO(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new rO.Buf16(16),this.heap=new rO.Buf16(573),vO(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new rO.Buf16(573),vO(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 AO(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:lO,e.adler=2===t.wrap?0:1,t.last_flush=0,nO._tr_init(t),0):pO(e,sO)}function RO(e){var t,r=AO(e);return 0===r&&((t=e.state).window_size=2*t.w_size,vO(t.head),t.max_lazy_match=$x[t.level].max_lazy,t.good_match=$x[t.level].good_length,t.nice_match=$x[t.level].nice_length,t.max_chain_length=$x[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),r}function CO(e,t,r,n,i,a){if(!e)return sO;var o=1;if(-1===t&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>9||8!==r||n<8||n>15||t<0||t>9||a<0||a>4)return pO(e,sO);8===n&&(n=9);var s=new IO;return e.state=s,s.strm=e,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new rO.Buf8(2*s.w_size),s.head=new rO.Buf16(s.hash_size),s.prev=new rO.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new rO.Buf8(s.pending_buf_size),s.d_buf=1*s.lit_bufsize,s.l_buf=3*s.lit_bufsize,s.level=t,s.strategy=a,s.method=r,RO(e)}$x=[new TO(0,0,0,0,(function(e,t){var r=65535;for(r>e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(EO(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((0===e.strstart||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,mO(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-uO&&(mO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(mO(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(mO(e,!1),e.strm.avail_out),1)})),new TO(4,4,8,4,bO),new TO(4,5,16,8,bO),new TO(4,6,32,32,bO),new TO(4,4,16,16,kO),new TO(8,16,32,32,kO),new TO(8,16,128,128,kO),new TO(8,32,128,256,kO),new TO(32,128,258,1024,kO),new TO(32,258,258,4096,kO)],hx.deflateInit=function(e,t){return CO(e,t,8,15,8,0)},hx.deflateInit2=CO,hx.deflateReset=RO,hx.deflateResetKeep=AO,hx.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?sO:(e.state.gzhead=t,0):sO},hx.deflate=function(e,t){var r,n,i,a;if(!e||!e.state||t>5||t<0)return e?pO(e,sO):sO;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||n.status===hO&&4!==t)return pO(e,0===e.avail_out?-5:sO);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,yO(n,31),yO(n,139),yO(n,8),n.gzhead?(yO(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),yO(n,255&n.gzhead.time),yO(n,n.gzhead.time>>8&255),yO(n,n.gzhead.time>>16&255),yO(n,n.gzhead.time>>24&255),yO(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),yO(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(yO(n,255&n.gzhead.extra.length),yO(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=aO(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(yO(n,0),yO(n,0),yO(n,0),yO(n,0),yO(n,0),yO(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),yO(n,3),n.status=lO);else{var o=8+(n.w_bits-8<<4)<<8;o|=(n.strategy>=2||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(o|=32),o+=31-o%31,n.status=lO,gO(n,o),0!==n.strstart&&(gO(n,e.adler>>>16),gO(n,65535&e.adler)),e.adler=1}if(69===n.status)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(65535&n.gzhead.extra.length)&&(n.pending!==n.pending_buf_size||(n.gzhead.hcrc&&n.pending>i&&(e.adler=aO(e.adler,n.pending_buf,n.pending-i,i)),_O(e),i=n.pending,n.pending!==n.pending_buf_size));)yO(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=aO(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=73)}else n.status=73;if(73===n.status)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=aO(e.adler,n.pending_buf,n.pending-i,i)),_O(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}a=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,yO(n,a)}while(0!==a);n.gzhead.hcrc&&n.pending>i&&(e.adler=aO(e.adler,n.pending_buf,n.pending-i,i)),0===a&&(n.gzindex=0,n.status=91)}else n.status=91;if(91===n.status)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=aO(e.adler,n.pending_buf,n.pending-i,i)),_O(e),i=n.pending,n.pending===n.pending_buf_size)){a=1;break}a=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,yO(n,a)}while(0!==a);n.gzhead.hcrc&&n.pending>i&&(e.adler=aO(e.adler,n.pending_buf,n.pending-i,i)),0===a&&(n.status=dO)}else n.status=dO;if(n.status===dO&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&_O(e),n.pending+2<=n.pending_buf_size&&(yO(n,255&e.adler),yO(n,e.adler>>8&255),e.adler=0,n.status=lO)):n.status=lO),0!==n.pending){if(_O(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&fO(t)<=fO(r)&&4!==t)return pO(e,-5);if(n.status===hO&&0!==e.avail_in)return pO(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&n.status!==hO){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(EO(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=nO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(mO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(mO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(mO(e,!1),0===e.strm.avail_out)?1:2}(n,t):3===n.strategy?function(e,t){for(var r,n,i,a,o=e.window;;){if(e.lookahead<=cO){if(EO(e),e.lookahead<=cO&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(n=o[i=e.strstart-1])===o[++i]&&n===o[++i]&&n===o[++i]){a=e.strstart+cO;do{}while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&i<a);e.match_length=cO-(a-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=nO._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=nO._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(mO(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(mO(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(mO(e,!1),0===e.strm.avail_out)?1:2}(n,t):$x[n.level].func(n,t);if(3!==s&&4!==s||(n.status=hO),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?nO._tr_align(n):5!==t&&(nO._tr_stored_block(n,0,0,!1),3===t&&(vO(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),_O(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(yO(n,255&e.adler),yO(n,e.adler>>8&255),yO(n,e.adler>>16&255),yO(n,e.adler>>24&255),yO(n,255&e.total_in),yO(n,e.total_in>>8&255),yO(n,e.total_in>>16&255),yO(n,e.total_in>>24&255)):(gO(n,e.adler>>>16),gO(n,65535&e.adler)),_O(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},hx.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&t!==dO&&t!==lO&&t!==hO?pO(e,sO):(e.state=null,t===lO?pO(e,-3):0):sO},hx.deflateSetDictionary=function(e,t){var r,n,i,a,o,s,c,u,d=t.length;if(!e||!e.state)return sO;if(2===(a=(r=e.state).wrap)||1===a&&42!==r.status||r.lookahead)return sO;for(1===a&&(e.adler=iO(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===a&&(vO(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new rO.Buf8(r.w_size),rO.arraySet(u,t,d-r.w_size,r.w_size,0),t=u,d=r.w_size),o=e.avail_in,s=e.next_in,c=e.input,e.avail_in=d,e.next_in=0,e.input=t,EO(r);r.lookahead>=3;){n=r.strstart,i=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[n+3-1])&r.hash_mask,r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++}while(--i);r.strstart=n,r.lookahead=2,EO(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=2,r.match_available=0,e.next_in=s,e.input=c,e.avail_in=o,r.wrap=a,0},hx.deflateInfo="pako deflate (from Nodeca project)";var wO={},xO=dx,OO=!0,DO=!0;try{String.fromCharCode.apply(null,[0])}catch(MX){OO=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(MX){DO=!1}for(var PO=new xO.Buf8(256),NO=0;NO<256;NO++)PO[NO]=NO>=252?6:NO>=248?5:NO>=240?4:NO>=224?3:NO>=192?2:1;function MO(e,t){if(t<65534&&(e.subarray&&DO||!e.subarray&&OO))return String.fromCharCode.apply(null,xO.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}PO[254]=PO[254]=1,wO.string2buf=function(e){var t,r,n,i,a,o=e.length,s=0;for(i=0;i<o;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<o&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new xO.Buf8(s),a=0,i=0;a<s;i++)55296==(64512&(r=e.charCodeAt(i)))&&i+1<o&&56320==(64512&(n=e.charCodeAt(i+1)))&&(r=65536+(r-55296<<10)+(n-56320),i++),r<128?t[a++]=r:r<2048?(t[a++]=192|r>>>6,t[a++]=128|63&r):r<65536?(t[a++]=224|r>>>12,t[a++]=128|r>>>6&63,t[a++]=128|63&r):(t[a++]=240|r>>>18,t[a++]=128|r>>>12&63,t[a++]=128|r>>>6&63,t[a++]=128|63&r);return t},wO.buf2binstring=function(e){return MO(e,e.length)},wO.binstring2buf=function(e){for(var t=new xO.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},wO.buf2string=function(e,t){var r,n,i,a,o=t||e.length,s=new Array(2*o);for(n=0,r=0;r<o;)if((i=e[r++])<128)s[n++]=i;else if((a=PO[i])>4)s[n++]=65533,r+=a-1;else{for(i&=2===a?31:3===a?15:7;a>1&&r<o;)i=i<<6|63&e[r++],a--;a>1?s[n++]=65533:i<65536?s[n++]=i:(i-=65536,s[n++]=55296|i>>10&1023,s[n++]=56320|1023&i)}return MO(s,n)},wO.utf8border=function(e,t){var r;for((t=t||e.length)>e.length&&(t=e.length),r=t-1;r>=0&&128==(192&e[r]);)r--;return r<0||0===r?t:r+PO[e[r]]>t?r:t};var LO=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},UO=hx,VO=dx,FO=wO,BO=tO,jO=LO,GO=Object.prototype.toString;function HO(e){if(!(this instanceof HO))return new HO(e);this.options=VO.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 jO,this.strm.avail_out=0;var r=UO.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(BO[r]);if(t.header&&UO.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?FO.string2buf(t.dictionary):"[object ArrayBuffer]"===GO.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=UO.deflateSetDictionary(this.strm,n)))throw new Error(BO[r]);this._dict_set=!0}}function zO(e,t){var r=new HO(t);if(r.push(e,!0),r.err)throw r.msg||BO[r.err];return r.result}HO.prototype.push=function(e,t){var r,n,i=this.strm,a=this.options.chunkSize;if(this.ended)return!1;n=t===~~t?t:!0===t?4:0,"string"==typeof e?i.input=FO.string2buf(e):"[object ArrayBuffer]"===GO.call(e)?i.input=new Uint8Array(e):i.input=e,i.next_in=0,i.avail_in=i.input.length;do{if(0===i.avail_out&&(i.output=new VO.Buf8(a),i.next_out=0,i.avail_out=a),1!==(r=UO.deflate(i,n))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==i.avail_out&&(0!==i.avail_in||4!==n&&2!==n)||("string"===this.options.to?this.onData(FO.buf2binstring(VO.shrinkBuf(i.output,i.next_out))):this.onData(VO.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=UO.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},HO.prototype.onData=function(e){this.chunks.push(e)},HO.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=VO.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},lx.Deflate=HO,lx.deflate=zO,lx.deflateRaw=function(e,t){return(t=t||{}).raw=!0,zO(e,t)},lx.gzip=function(e,t){return(t=t||{}).gzip=!0,zO(e,t)};var KO={},XO=tr,qO=O,WO=Ye,YO=oe,QO=function(){var e=XO(this),t="";return e.hasIndices&&(t+="d"),e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.unicodeSets&&(t+="v"),e.sticky&&(t+="y"),t},JO=RegExp.prototype,ZO=oe,$O=function(e){var t=e.flags;return void 0!==t||"flags"in JO||WO(e,"flags")||!YO(JO,e)?t:qO(QO,e)},eD=RegExp.prototype,tD=function(e){return e===eD||ZO(eD,e)?$O(e):e.flags},rD={},nD=dx,iD=15,aD=[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],oD=[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],sD=[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],cD=[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],uD=dx,dD=Jx,lD=eO,hD=function(e,t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A;r=e.state,n=e.next_in,I=e.input,i=n+(e.avail_in-5),a=e.next_out,A=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=r.dmax,u=r.wsize,d=r.whave,l=r.wnext,h=r.window,p=r.hold,f=r.bits,v=r.lencode,_=r.distcode,m=(1<<r.lenbits)-1,y=(1<<r.distbits)-1;e:do{f<15&&(p+=I[n++]<<f,f+=8,p+=I[n++]<<f,f+=8),g=v[p&m];t:for(;;){if(p>>>=S=g>>>24,f-=S,0===(S=g>>>16&255))A[a++]=65535&g;else{if(!(16&S)){if(0==(64&S)){g=v[(65535&g)+(p&(1<<S)-1)];continue t}if(32&S){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}E=65535&g,(S&=15)&&(f<S&&(p+=I[n++]<<f,f+=8),E+=p&(1<<S)-1,p>>>=S,f-=S),f<15&&(p+=I[n++]<<f,f+=8,p+=I[n++]<<f,f+=8),g=_[p&y];r:for(;;){if(p>>>=S=g>>>24,f-=S,!(16&(S=g>>>16&255))){if(0==(64&S)){g=_[(65535&g)+(p&(1<<S)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&g,f<(S&=15)&&(p+=I[n++]<<f,(f+=8)<S&&(p+=I[n++]<<f,f+=8)),(b+=p&(1<<S)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=S,f-=S,b>(S=a-o)){if((S=b-S)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(k=0,T=h,0===l){if(k+=u-S,S<E){E-=S;do{A[a++]=h[k++]}while(--S);k=a-b,T=A}}else if(l<S){if(k+=u+l-S,(S-=l)<E){E-=S;do{A[a++]=h[k++]}while(--S);if(k=0,l<E){E-=S=l;do{A[a++]=h[k++]}while(--S);k=a-b,T=A}}}else if(k+=l-S,S<E){E-=S;do{A[a++]=h[k++]}while(--S);k=a-b,T=A}for(;E>2;)A[a++]=T[k++],A[a++]=T[k++],A[a++]=T[k++],E-=3;E&&(A[a++]=T[k++],E>1&&(A[a++]=T[k++]))}else{k=a-b;do{A[a++]=A[k++],A[a++]=A[k++],A[a++]=A[k++],E-=3}while(E>2);E&&(A[a++]=A[k++],E>1&&(A[a++]=A[k++]))}break}}break}}while(n<i&&a<s);n-=E=f>>3,p&=(1<<(f-=E<<3))-1,e.next_in=n,e.next_out=a,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=a<s?s-a+257:257-(a-s),r.hold=p,r.bits=f},pD=function(e,t,r,n,i,a,o,s){var c,u,d,l,h,p,f,v,_,m=s.bits,y=0,g=0,S=0,E=0,b=0,k=0,T=0,I=0,A=0,R=0,C=null,w=0,x=new nD.Buf16(16),O=new nD.Buf16(16),D=null,P=0;for(y=0;y<=iD;y++)x[y]=0;for(g=0;g<n;g++)x[t[r+g]]++;for(b=m,E=iD;E>=1&&0===x[E];E--);if(b>E&&(b=E),0===E)return i[a++]=20971520,i[a++]=20971520,s.bits=1,0;for(S=1;S<E&&0===x[S];S++);for(b<S&&(b=S),I=1,y=1;y<=iD;y++)if(I<<=1,(I-=x[y])<0)return-1;if(I>0&&(0===e||1!==E))return-1;for(O[1]=0,y=1;y<iD;y++)O[y+1]=O[y]+x[y];for(g=0;g<n;g++)0!==t[r+g]&&(o[O[t[r+g]]++]=g);if(0===e?(C=D=o,p=19):1===e?(C=aD,w-=257,D=oD,P-=257,p=256):(C=sD,D=cD,p=-1),R=0,g=0,y=S,h=a,k=b,T=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){f=y-T,o[g]<p?(v=0,_=o[g]):o[g]>p?(v=D[P+o[g]],_=C[w+o[g]]):(v=96,_=0),c=1<<y-T,S=u=1<<k;do{i[h+(R>>T)+(u-=c)]=f<<24|v<<16|_|0}while(0!==u);for(c=1<<y-1;R&c;)c>>=1;if(0!==c?(R&=c-1,R+=c):R=0,g++,0==--x[y]){if(y===E)break;y=t[r+o[g]]}if(y>b&&(R&l)!==d){for(0===T&&(T=b),h+=S,I=1<<(k=y-T);k+T<E&&!((I-=x[k+T])<=0);)k++,I<<=1;if(A+=1<<k,1===e&&A>852||2===e&&A>592)return 1;i[d=R&l]=b<<24|k<<16|h-a|0}}return 0!==R&&(i[h+R]=y-T<<24|64<<16|0),s.bits=b,0},fD=-2,vD=12,_D=30;function mD(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function yD(){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 uD.Buf16(320),this.work=new uD.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function gD(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 uD.Buf32(852),t.distcode=t.distdyn=new uD.Buf32(592),t.sane=1,t.back=-1,0):fD}function SD(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,gD(e)):fD}function ED(e,t){var r,n;return e&&e.state?(n=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?fD:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,SD(e))):fD}function bD(e,t){var r,n;return e?(n=new yD,e.state=n,n.window=null,0!==(r=ED(e,t))&&(e.state=null),r):fD}var kD,TD,ID=!0;function AD(e){if(ID){var t;for(kD=new uD.Buf32(512),TD=new uD.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(pD(1,e.lens,0,288,kD,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;pD(2,e.lens,0,32,TD,0,e.work,{bits:5}),ID=!1}e.lencode=kD,e.lenbits=9,e.distcode=TD,e.distbits=5}function RD(e,t,r,n){var i,a=e.state;return null===a.window&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new uD.Buf8(a.wsize)),n>=a.wsize?(uD.arraySet(a.window,t,r-a.wsize,a.wsize,0),a.wnext=0,a.whave=a.wsize):((i=a.wsize-a.wnext)>n&&(i=n),uD.arraySet(a.window,t,r-n,i,a.wnext),(n-=i)?(uD.arraySet(a.window,t,r-n,n,0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0}rD.inflateReset=SD,rD.inflateReset2=ED,rD.inflateResetKeep=gD,rD.inflateInit=function(e){return bD(e,15)},rD.inflateInit2=bD,rD.inflate=function(e,t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A=0,R=new uD.Buf8(4),C=[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 fD;(r=e.state).mode===vD&&(r.mode=13),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,k=0;e:for(;;)switch(r.mode){case 1:if(0===r.wrap){r.mode=13;break}for(;d<16;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,R[0]=255&u,R[1]=u>>>8&255,r.check=lD(r.check,R,2,0),u=0,d=0,r.mode=2;break}if(r.flags=0,r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&u)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=_D;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=_D;break}if(d-=4,b=8+(15&(u>>>=4)),0===r.wbits)r.wbits=b;else if(b>r.wbits){e.msg="invalid window size",r.mode=_D;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:vD,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}if(r.flags=u,8!=(255&tD(r))){e.msg="unknown compression method",r.mode=_D;break}if(57344&tD(r)){e.msg="unknown header flags set",r.mode=_D;break}r.head&&(r.head.text=u>>8&1),512&tD(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=lD(r.check,R,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}r.head&&(r.head.time=u),512&tD(r)&&(R[0]=255&u,R[1]=u>>>8&255,R[2]=u>>>16&255,R[3]=u>>>24&255,r.check=lD(r.check,R,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&tD(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=lD(r.check,R,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&tD(r)){for(;d<16;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&tD(r)&&(R[0]=255&u,R[1]=u>>>8&255,r.check=lD(r.check,R,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&tD(r)&&((p=r.length)>s&&(p=s),p&&(r.head&&(b=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),uD.arraySet(r.head.extra,n,a,p,b)),512&tD(r)&&(r.check=lD(r.check,n,p,a)),s-=p,a+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&tD(r)){if(0===s)break e;p=0;do{b=n[a+p++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&tD(r)&&(r.check=lD(r.check,n,p,a)),s-=p,a+=p,b)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=8;case 8:if(4096&tD(r)){if(0===s)break e;p=0;do{b=n[a+p++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&tD(r)&&(r.check=lD(r.check,n,p,a)),s-=p,a+=p,b)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&tD(r)){for(;d<16;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=_D;break}u=0,d=0}r.head&&(r.head.hcrc=tD(r)>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=vD;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}e.adler=r.check=mD(u),u=0,d=0,r.mode=11;case 11:if(0===r.havedict)return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,r.hold=u,r.bits=d,2;e.adler=r.check=1,r.mode=vD;case vD:if(5===t||6===t)break e;case 13:if(r.last){u>>>=7&d,d-=7&d,r.mode=27;break}for(;d<3;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(AD(r),r.mode=20,6===t){u>>>=2,d-=2;break e}break;case 2:r.mode=17;break;case 3:e.msg="invalid block type",r.mode=_D}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=_D;break}if(r.length=65535&u,u=0,d=0,r.mode=15,6===t)break e;case 15:r.mode=16;case 16:if(p=r.length){if(p>s&&(p=s),p>c&&(p=c),0===p)break e;uD.arraySet(i,n,a,p,o),s-=p,a+=p,c-=p,o+=p,r.length-=p;break}r.mode=vD;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}if(r.nlen=257+(31&u),u>>>=5,d-=5,r.ndist=1+(31&u),u>>>=5,d-=5,r.ncode=4+(15&u),u>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=_D;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}r.lens[C[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[C[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,T={bits:r.lenbits},k=pD(0,r.lens,0,19,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid code lengths set",r.mode=_D;break}r.have=0,r.mode=19;case 19:for(;r.have<r.nlen+r.ndist;){for(;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,y=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}if(y<16)u>>>=_,d-=_,r.lens[r.have++]=y;else{if(16===y){for(I=_+2;d<I;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}if(u>>>=_,d-=_,0===r.have){e.msg="invalid bit length repeat",r.mode=_D;break}b=r.lens[r.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===y){for(I=_+3;d<I;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}d-=_,b=0,p=3+(7&(u>>>=_)),u>>>=3,d-=3}else{for(I=_+7;d<I;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}d-=_,b=0,p=11+(127&(u>>>=_)),u>>>=7,d-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=_D;break}for(;p--;)r.lens[r.have++]=b}}if(r.mode===_D)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=_D;break}if(r.lenbits=9,T={bits:r.lenbits},k=pD(1,r.lens,0,r.nlen,r.lencode,0,r.work,T),r.lenbits=T.bits,k){e.msg="invalid literal/lengths set",r.mode=_D;break}if(r.distbits=6,r.distcode=r.distdyn,T={bits:r.distbits},k=pD(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,T),r.distbits=T.bits,k){e.msg="invalid distances set",r.mode=_D;break}if(r.mode=20,6===t)break e;case 20:r.mode=21;case 21:if(s>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,r.hold=u,r.bits=d,hD(e,h),o=e.next_out,i=e.output,c=e.avail_out,a=e.next_in,n=e.input,s=e.avail_in,u=r.hold,d=r.bits,r.mode===vD&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,y=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}if(m&&0==(240&m)){for(g=_,S=m,E=y;m=(A=r.lencode[E+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&A,!(g+(_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=_,d-=_,r.back+=_,r.length=y,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=vD;break}if(64&m){e.msg="invalid literal/length code",r.mode=_D;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=23;case 23:for(;m=(A=r.distcode[u&(1<<r.distbits)-1])>>>16&255,y=65535&A,!((_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}if(0==(240&m)){for(g=_,S=m,E=y;m=(A=r.distcode[E+((u&(1<<g+S)-1)>>g)])>>>16&255,y=65535&A,!(g+(_=A>>>24)<=d);){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}u>>>=g,d-=g,r.back+=g}if(u>>>=_,d-=_,r.back+=_,64&m){e.msg="invalid distance code",r.mode=_D;break}r.offset=y,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(I=r.extra;d<I;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=_D;break}r.mode=25;case 25:if(0===c)break e;if(p=h-c,r.offset>p){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=_D;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),v=r.window}else v=i,f=o-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{i[o++]=v[f++]}while(--p);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;i[o++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=n[a++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=tD(r)?lD(r.check,i,h,o-h):dD(r.check,i,h,o-h)),h=c,(tD(r)?u:mD(u))!==r.check){e.msg="incorrect data check",r.mode=_D;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&tD(r)){for(;d<32;){if(0===s)break e;s--,u+=n[a++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=_D;break}u=0,d=0}r.mode=29;case 29:k=1;break e;case _D:k=-3;break e;case 31:return-4;default:return fD}return e.next_out=o,e.avail_out=c,e.next_in=a,e.avail_in=s,r.hold=u,r.bits=d,(r.wsize||h!==e.avail_out&&r.mode<_D&&(r.mode<27||4!==t))&&RD(e,e.output,e.next_out,h-e.avail_out),l-=e.avail_in,h-=e.avail_out,e.total_in+=l,e.total_out+=h,r.total+=h,r.wrap&&h&&(e.adler=r.check=tD(r)?lD(r.check,i,h,e.next_out-h):dD(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(r.mode===vD?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===k&&(k=-5),k},rD.inflateEnd=function(e){if(!e||!e.state)return fD;var t=e.state;return t.window&&(t.window=null),e.state=null,0},rD.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?fD:(r.head=t,t.done=!1,0):fD},rD.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?fD:11===r.mode&&dD(1,t,n,0)!==r.check?-3:RD(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):fD},rD.inflateInfo="pako inflate (from Nodeca project)";var CD={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 wD=rD,xD=dx,OD=wO,DD=CD,PD=tO,ND=LO,MD=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},LD=Object.prototype.toString;function UD(e){if(!(this instanceof UD))return new UD(e);this.options=xD.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 ND,this.strm.avail_out=0;var r=wD.inflateInit2(this.strm,t.windowBits);if(r!==DD.Z_OK)throw new Error(PD[r]);if(this.header=new MD,wD.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=OD.string2buf(t.dictionary):"[object ArrayBuffer]"===LD.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=wD.inflateSetDictionary(this.strm,t.dictionary))!==DD.Z_OK))throw new Error(PD[r])}function VD(e,t){var r=new UD(t);if(r.push(e,!0),r.err)throw r.msg||PD[r.err];return r.result}UD.prototype.push=function(e,t){var r,n,i,a,o,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;n=t===~~t?t:!0===t?DD.Z_FINISH:DD.Z_NO_FLUSH,"string"==typeof e?s.input=OD.binstring2buf(e):"[object ArrayBuffer]"===LD.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 xD.Buf8(c),s.next_out=0,s.avail_out=c),(r=wD.inflate(s,DD.Z_NO_FLUSH))===DD.Z_NEED_DICT&&u&&(r=wD.inflateSetDictionary(this.strm,u)),r===DD.Z_BUF_ERROR&&!0===d&&(r=DD.Z_OK,d=!1),r!==DD.Z_STREAM_END&&r!==DD.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==DD.Z_STREAM_END&&(0!==s.avail_in||n!==DD.Z_FINISH&&n!==DD.Z_SYNC_FLUSH)||("string"===this.options.to?(i=OD.utf8border(s.output,s.next_out),a=s.next_out-i,o=OD.buf2string(s.output,i),s.next_out=a,s.avail_out=c-a,a&&xD.arraySet(s.output,s.output,i,a,0),this.onData(o)):this.onData(xD.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)&&r!==DD.Z_STREAM_END);return r===DD.Z_STREAM_END&&(n=DD.Z_FINISH),n===DD.Z_FINISH?(r=wD.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===DD.Z_OK):n!==DD.Z_SYNC_FLUSH||(this.onEnd(DD.Z_OK),s.avail_out=0,!0)},UD.prototype.onData=function(e){this.chunks.push(e)},UD.prototype.onEnd=function(e){e===DD.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=xD.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},KO.Inflate=UD,KO.inflate=VD,KO.inflateRaw=function(e,t){return(t=t||{}).raw=!0,VD(e,t)},KO.ungzip=VD;var FD={};(0,dx.assign)(FD,lx,KO,CD);var BD=FD,jD="BytePlusRTC",GD=function(){return window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB},HD=function(){function e(t){Wd(this,e),sd(this,"storeName",void 0),sd(this,"pendingList",[]),this.storeName=t,!wC()&&GD()&&this._checkAndCreateStore(t)}var t,r;return qd(e,[{key:"_checkAndCreateStore",value:function(t,r){var n=this;e.db&&e.db.close();var i=r?GD().open(jD,r):GD().open(jD);i.onupgradeneeded=function(){i.result.createObjectStore(t)},i.onerror=function(e){console.error("IndexedDBInterface error",i.error)},i.onsuccess=function(){var r=i.result;e.db=r;try{e.db.transaction(n.storeName,"readonly"),n.pendingList.forEach(function(){var e=m_(Im.mark((function e(t){var r,i,a,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.txMode,i=t.resolve,a=t.reject,e.prev=1,e.next=4,n._getStore(r);case 4:o=e.sent,i(o),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),a();case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t){return e.apply(this,arguments)}}())}catch(a){n._checkAndCreateStore(t,r.version+1)}}}},{key:"_getStore",value:function(t){var r=this;return new v_((function(n,i){e.db?n(e.db.transaction(r.storeName,t).objectStore(r.storeName)):r.pendingList.push({txMode:t,resolve:n,reject:i})}))}},{key:"put",value:(r=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readwrite");case 2:return n=e.sent,e.abrupt("return",new v_((function(e,i){var a=n.put(t,r);a.onsuccess=function(){e()},a.onerror=function(e){i(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"get",value:(t=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStore("readonly");case 2:return r=e.sent,e.abrupt("return",new v_((function(e,n){var i=r.get(t);i.onsuccess=function(){e(i.result)},i.onerror=function(e){n(e)}})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}();sd(HD,"db",void 0),sd(HD,"state","init");var zD=function(e){return e.RTC="rtc",e}(zD||{}),KD=function(e){return e.W_5="5",e}(KD||{}),XD=function(e){return e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux",e}(XD||{}),qD=function(e){return e.REQUEST="request",e.RESPONSE="response",e}(qD||{}),WD=function(e){return 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",e}(WD||{}),YD=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(YD||{}),QD=function(e){return e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected",e}(QD||{}),JD=function(e){return e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection",e}(JD||{}),ZD=function(e){return 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",e}(ZD||{}),$D=function(e){return 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",e}($D||{}),eP=function(e){return 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",e}(eP||{}),tP=function(e){return e.UP="up",e.DOWN="down",e.DIRECT="direct",e}(tP||{}),rP=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(rP||{}),nP=function(e){return e.UP="up",e.DOWN="down",e.PRE="pre",e}(nP||{}),iP=function(e){return e.W_0="0",e.W_1="1",e}(iP||{}),aP=function(e){return e.UP="up",e.DOWN="down",e}(aP||{}),oP=function(e){return e.ANSWER="answer",e.INCRANSWER="incranswer",e}(oP||{}),sP=function(e){return e.UP="up",e.DOWN="down",e}(sP||{}),cP=function(e){return e.SUCCESS="success",e.FAIL="fail",e}(cP||{}),uP=function(e){return e.W_0="0",e.W_1="1",e}(uP||{}),dP=function(e){return 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",e}(dP||{}),lP=function(e){return e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore",e}(lP||{}),hP=function(e){return 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",e}(hP||{}),pP=function(e){return e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown",e}(pP||{}),fP=function(e){return e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end",e}(fP||{}),vP=function(e){return e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio",e}(vP||{}),_P=function(e){return 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",e}(_P||{}),mP=function(e){return 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",e}(mP||{}),yP=function(e){return e.BEGIN="begin",e.END="end",e}(yP||{}),gP=function(e){return e.BEGIN="begin",e.END="end",e}(gP||{}),SP=function(e){return 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",e}(SP||{}),EP=function(e){return e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server",e}(EP||{}),bP=function(e){return e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped",e}(bP||{}),kP=function(e){return 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",e}(kP||{}),TP=function(){function e(t){Wd(this,e),sd(this,"_event_key",void 0),sd(this,"_device_id",void 0),sd(this,"_rtc_app_id",void 0),sd(this,"_product_line",void 0),sd(this,"_report_version",void 0),sd(this,"_os",void 0),sd(this,"_rtc_sdk_version",void 0),sd(this,"_rtc_timestamp",void 0),sd(this,"_rtc_sdk_git_commit",void 0),sd(this,"_report_id",void 0),sd(this,"_connection_id",void 0),sd(this,"_rtc_sid",void 0),sd(this,"_engine_session_id",void 0),sd(this,"_rtc_business_id",void 0),sd(this,"_app_state",void 0),sd(this,"_project_key",void 0),sd(this,"_network_type",void 0),sd(this,"_app_version",void 0),sd(this,"_aid",void 0),sd(this,"_device_model",void 0),sd(this,"_device_brand",void 0),sd(this,"_common_extra_info",void 0),sd(this,"_had_selected_p2p",void 0),sd(this,"_rtc_env_type",void 0),sd(this,"_room_id",void 0),sd(this,"_user_id",void 0),sd(this,"_rtc_session_id",void 0),sd(this,"_user_agent",void 0),sd(this,"_auto_play_policy",void 0),sd(this,"_platform",void 0),sd(this,"_product",void 0),sd(this,"_log_cache_key",void 0),sd(this,"_overSea","0"),this.monitor=t}return qd(e,[{key:"setStats",value:function(e){var t=this;on(e).forEach((function(r){t["_"+r]=e[r]})),this.monitor.StartUp()}},{key:"event_key",get:function(){return this._event_key}},{key:"device_id",get:function(){return this._device_id}},{key:"rtc_app_id",get:function(){return this._rtc_app_id}},{key:"product_line",get:function(){return this._product_line}},{key:"report_version",get:function(){return this._report_version}},{key:"os",get:function(){return this._os}},{key:"rtc_sdk_version",get:function(){return this._rtc_sdk_version}},{key:"rtc_timestamp",get:function(){return this._rtc_timestamp}},{key:"rtc_sdk_git_commit",get:function(){return this._rtc_sdk_git_commit}},{key:"report_id",get:function(){return this._report_id}},{key:"connection_id",get:function(){return this._connection_id}},{key:"rtc_sid",get:function(){return this._rtc_sid}},{key:"engine_session_id",get:function(){return this._engine_session_id}},{key:"rtc_business_id",get:function(){return this._rtc_business_id}},{key:"app_state",get:function(){return this._app_state}},{key:"project_key",get:function(){return this._project_key}},{key:"network_type",get:function(){return this._network_type}},{key:"app_version",get:function(){return this._app_version}},{key:"aid",get:function(){return this._aid}},{key:"device_model",get:function(){return this._device_model}},{key:"device_brand",get:function(){return this._device_brand}},{key:"common_extra_info",get:function(){return this._common_extra_info}},{key:"had_selected_p2p",get:function(){return this._had_selected_p2p}},{key:"rtc_env_type",get:function(){return this._rtc_env_type}},{key:"room_id",get:function(){return this._room_id}},{key:"user_id",get:function(){return this._user_id}},{key:"rtc_session_id",get:function(){return this._rtc_session_id}},{key:"user_agent",get:function(){return this._user_agent}},{key:"auto_play_policy",get:function(){return this._auto_play_policy}},{key:"platform",get:function(){return this._platform||"web"}},{key:"product",get:function(){return this._product||"webrtc"}},{key:"log_cache_key",get:function(){return this._log_cache_key}},{key:"overSea",get:function(){return this._overSea}}]),e}(),IP="ReportErrorBuffer",AP=function(){function e(){Wd(this,e),sd(this,"_buffer",new HD(IP))}var t,r;return qd(e,[{key:"set",value:(r=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._buffer.put(t,IP);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"get",value:(t=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.prev=1,e.next=4,this._buffer.get(IP);case 4:t=e.sent,e.next=9;break;case 7:e.prev=7,e.t0=e.catch(1);case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(){return t.apply(this,arguments)})}]),e}(),RP=function(e){DI(n,e);var t,r=YI(n);function n(){var e;return Wd(this,n),sd(eI(e=r.call(this)),"report_id",void 0),sd(eI(e),"report_common",void 0),sd(eI(e),"modify_ids",void 0),sd(eI(e),"dataBuffer",void 0),sd(eI(e),"posting",void 0),sd(eI(e),"sucSendTimer",void 0),sd(eI(e),"preSucTime",void 0),sd(eI(e),"errSendTimer",void 0),sd(eI(e),"errSendDelay",void 0),sd(eI(e),"errSendBuffer",void 0),sd(eI(e),"commonStats",void 0),sd(eI(e),"_retryCount",0),e.report_id=0,e.dataBuffer=[],e.posting=!1,e.report_common={},e.modify_ids={},e.preSucTime=0,e.errSendDelay=100,e.commonStats=new TP(eI(e)),wC()||window.addEventListener("beforeunload",(function(){clearTimeout(e.errSendTimer),clearTimeout(e.sucSendTimer),e.send(null,!0)})),e}return qd(n,[{key:"push",value: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()))}},{key:"enableErrorBuffer",value:function(){this.errSendBuffer=new AP,this.loadErrorBuffer()}},{key:"unshift",value:function(e){this.dataBuffer=xm(e).call(e,this.dataBuffer)}},{key:"send",value:function(e,t){var r,n,i=this;if(e||this.dataBuffer.length){var a={data:e||mk(r=this.dataBuffer).call(r,0,4e3),header:ud(ud({},this.report_common),{},{http_retry_count:this._retryCount}),from:"web",os:"web",version:"1"},o=new XMLHttpRequest;o.timeout=1e4,o.onreadystatechange=function(){if(4===o.readyState){var r,n,s,c,u;if(e||(i.posting=!1),200===o.status||304===o.status)try{r=JSON.parse(o.responseText)}catch(PX){n=PX}if(r&&0===r.StatusCode){if(!e&&!t)!wC()&&$m(s=location.search).call(s,"_rtc_autotest_")&&i.safeEmit("report_event",a),null===(c=i.errSendBuffer)||void 0===c||c.set([]),i.sucSend()}else if(setTimeout((function(){var e,t;i.rtcError(xm(e="reportor error, res:".concat(null===(t=r)||void 0===t?void 0:t.toString()," err:")).call(e,n),o.status,n)}),0),e)i.send(e);else i.unshift(a.data),null===(u=i.errSendBuffer)||void 0===u||u.set(Qk(i.dataBuffer)),t?i.send():i.errSend()}};var s=eN.LOG_SERVER_URL;if(o.open("POST",s,!0),e||(this.posting=!0),!wC()&&$m(n=location.search).call(n,"_rtc_debug_"))o.send(ny(a));else{var c=BD.gzip(ny(a));o.setRequestHeader("Content-Encoding","gzip"),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),o.send(c)}}}},{key:"sucSend",value:function(){this.errSendDelay=100,this._retryCount=0,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)}},{key:"errSend",value:function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2,this._retryCount++}},{key:"loadErrorBuffer",value:(t=m_(Im.mark((function e(){var t,r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this.errSendBuffer)||void 0===r?void 0:r.get();case 2:if(e.t1=t=e.sent,e.t0=null!==e.t1,!e.t0){e.next=6;break}e.t0=void 0!==t;case 6:if(!e.t0){e.next=10;break}e.t2=t,e.next=11;break;case 10:e.t2=[];case 11:e.t2.forEach((function(e){n.push(e)}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"StartUp",value:function(){var e=this.report_common,t=this.commonStats,r=t.event_key,n=t.device_id,i=t.rtc_app_id,a=t.product_line,o=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,v=t.project_key,_=t.network_type,m=t.app_version,y=t.aid,g=t.device_model,S=t.device_brand,E=t.common_extra_info,b=t.had_selected_p2p,k=t.rtc_env_type,T=t.user_agent,I=t.auto_play_policy,A=t.platform,R=t.product,C=t.log_cache_key,w=t.overSea;JE(e,{event_key:r,device_id:n,rtc_app_id:i,product_line:a,report_version:o,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:v,network_type:_,app_version:m,aid:y,device_model:g,device_brand:S,common_extra_info:E,had_selected_p2p:b,rtc_env_type:k,user_agent:T,auto_play_policy:I,platform:A,product:R,log_cache_key:C,extra_is_oversea:w}),this.modify_ids.room_id=this.commonStats.room_id,this.modify_ids.user_id=this.commonStats.user_id,this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id,this.modify_ids.connection_id=this.commonStats.connection_id,this.modify_ids.app_state=this.commonStats.app_state}},{key:"rtcSdkApiCall",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_sdk_api_call",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_api_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:ny(n)});n.streamId&&(i.stream_id=n.streamId),this.push(i)}},{key:"rtcSdkCallback",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_sdk_callback",report_id:this.report_id++,rtc_timestamp:Date.now(),sdk_callback_name:e,error_code:t,message:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtcGetConfig",value:function(e,t,r,n,i,a,o){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=ud(ud({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:n,type:i,config_id:a,enable_cloud_proxy:o},this.modify_ids),{},{common_extra_info:ny(s)});this.push(c)}},{key:"rtcReconnect",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=ud(ud({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:n},this.modify_ids),{},{common_extra_info:ny(i)});this.push(a)}},{key:"rtcReconnected",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcGetAccess",value:function(e,t,r,n,i,a){var o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:{},s=ud(ud({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:n,host:i,connect_session_id:a},this.modify_ids),{},{common_extra_info:ny(o)});this.push(s)}},{key:"rtcPreIceState",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{},{connection_id:r,common_extra_info:ny(n)});this.push(i)}},{key:"rtcNodeChange",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_node_change",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtcSignalingMsgError",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_signaling_msg_error",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reason:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtcSignaling",value:function(e,t,r,n,i,a,o){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=ud(ud({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,stream_id:i,stream_user_id:a,direction:o},this.modify_ids),{},{common_extra_info:ny(s)});this.push(c)}},{key:"rtcJoinRoom",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=ud(ud({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:n},this.modify_ids),{},{common_extra_info:ny(i)});this.push(a)}},{key:"rtcLeaveRoom",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_leave_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtcBeginCreateOffer",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_begin_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),direction:e,stream_id:t,stream_user_id:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtcCreateOffer",value:function(e,t,r,n,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=ud(ud({event_key:"rtc_create_offer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,direction:t,stream_id:r,stream_user_id:n,elapse:i},this.modify_ids),{},{common_extra_info:ny(a)});this.push(o)}},{key:"rtcSetDescription",value:function(e,t,r,n,i,a,o,s){var c=arguments.length>8&&void 0!==arguments[8]?arguments[8]:{},u=ud(ud({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:n,stream_id:i,stream_user_id:a,elapse:o},this.modify_ids),{},{connection_id:s,common_extra_info:ny(c)});this.push(u)}},{key:"rtcRecvAnswer",value:function(e,t,r,n,i,a,o){var s=arguments.length>7&&void 0!==arguments[7]?arguments[7]:{},c=ud(ud({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:n,direction:i,stream_id:a,stream_user_id:o},this.modify_ids),{},{common_extra_info:ny(s)});this.push(c)}},{key:"firstRemoteAudioRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:ny(r)});this.push(n)}},{key:"firstRemoteVideoRender",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:ny(r)});this.push(n)}},{key:"rtcPublishStat",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=ud(ud({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:n},this.modify_ids),{},{common_extra_info:ny(i)});this.push(a)}},{key:"rtcSubscribeStat",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=ud(ud({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:n},this.modify_ids),{},{common_extra_info:ny(i)});this.push(a)}},{key:"rtcAudioDevice",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({event_key:"rtc_audio_device",report_id:this.report_id++,rtc_timestamp:Date.now(),audio_event:e,message:t,error_code:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtcMediaStatistics",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcMessageStatistics",value:function(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=ud(ud({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:r},this.modify_ids),{},{common_extra_info:ny(n)});this.push(i)}},{key:"rtsMessageReport",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud(ud({event_key:"rts_message",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:ny(t)});this.push(r)}},{key:"rtcError",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcInvokeStatus",value:function(e,t,r,n,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"",s=ud(ud({event_key:"rtc_invoke_status",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t,sdk_api_name:r,stream_id:n,elapse:i},this.modify_ids),{},{connection_id:o,common_extra_info:ny(a),direction:a.direction});this.push(s)}},{key:"rtcFirstFrame",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud(ud({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:ny(t)});this.push(r)}},{key:"rtcMuteRemote",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:ny(r)});this.push(n)}},{key:"sdkInitEngine",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"joinRoom",value:function(e,t,r,n){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},a=ud(ud({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:n},this.modify_ids),{},{common_extra_info:ny(i)});this.push(a)}},{key:"p2pConnectionStatus",value:function(e,t,r,n,i){var a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{},o=ud(ud({event_key:"p2p_connection_status",report_id:this.report_id++,rtc_timestamp:Date.now(),room_id:e,user_id:t,peer_user_id:r,status:n,elapse:i},this.modify_ids),{},{common_extra_info:ny(a)});this.push(o)}},{key:"p2pConnectClosed",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{},{common_extra_info:ny(t)});this.push(r)}},{key:"rtcDeviceError",value:function(e,t,r,n,i,a,o,s,c,u,d,l,h,p,f,v){var _=arguments.length>16&&void 0!==arguments[16]?arguments[16]:{},m=ud(ud({event_key:"rtc_device_error",report_id:this.report_id++,rtc_timestamp:Date.now(),device_type:e,device_stage:t,error_code:r,system_error_code:n,system_api:i,call_parameters:a,location:o,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:v},this.modify_ids),{},{common_extra_info:ny(_)});this.push(m)}},{key:"rtcVideoDevice",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud({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:ny(r)});this.push(n)}},{key:"rtcVideoCaptureEvent",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=ud(ud(ud({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{},{common_extra_info:ny(t)});this.push(r)}},{key:"rtcEncodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcFirstFrameEncoded",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcSendFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcRecvFirstPacket",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcRecvFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}},{key:"rtcDecodeFirstFrame",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=ud(ud(ud(ud({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{},{common_extra_info:ny(r)});this.push(n)}}]),n}(ex),CP=new RP,wP=new RP,xP=new RP,OP=CP.commonStats,DP=wP.commonStats,PP=xP.commonStats;function NP(e){OP.setStats({app_state:e}),DP.setStats({app_state:e}),PP.setStats({app_state:e})}!wC()&&(NP("active"),document.addEventListener("visibilitychange",(function(){"visible"===document.visibilityState?NP("active"):"hidden"===document.visibilityState&&NP("background")})));var MP={default:CP,rtm:wP,outsideRoom:xP},LP=function(e,t,r){CP.rtcSdkApiCall(e,t,r)},UP=function(e,t,r){CP.rtcSdkCallback(e,t,r)};function VP(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"default",t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return function(t,n,i){if("function"==typeof i.value){var a=i.value;i.value=function(){for(var t=arguments.length,i=new Array(t),o=0;o<t;o++)i[o]=arguments[o];var s={};r.forEach((function(e,t){s[e]=i[t]})),"joinRoom"===n&&OP.setStats({room_id:i[1]}),MP[e].rtcSdkApiCall(n,0,ny(WC(i)),s);var c=a.apply(this,i);return"function"==typeof(null==c?void 0:c.then)?c.then((function(t){return MP[e].rtcSdkCallback(n,0,ny(WC([t||{}]))),t})).catch((function(t){throw MP[e].rtcSdkCallback(n,t.code,ny(t.message)),t})):(MP[e].rtcSdkCallback(n,0,ny(WC([c||{}]))),c)}}}}function FP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=e===Kd.onUserMessageReceivedOutsideRoom||e===Kd.onUserBinaryMessageReceivedOutsideRoom;(n?wP:CP).rtcSdkCallback(e,r,ny(t))}function BP(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]&&arguments[3],i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};(n?wP:CP).rtcInvokeStatus(ny(t),r,e,"",0,a,i)}var jP="BytePlus",GP="RTC_DEVICE_ID",HP="RTC_ACCESS_NODE",zP="RTC_ACCESS_URLS",KP="ENGINE_WEB_CONFIG",XP="SERVER_CONFIG",qP=function(){function e(){Wd(this,e)}return qd(e,[{key:"get",value:function(e){var t=localStorage.getItem(e);if(!t)return null;try{var r=JSON.parse(t);return r.ttl>0&&Date.now()-r.saveTime>r.ttl?(this.delete(e),null):r.message}catch(n){return null}}},{key:"set",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,n={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,ny(n)),!0}catch(i){return!1}}},{key:"delete",value:function(e){try{return localStorage.removeItem(e),!0}catch(t){return!1}}}]),e}(),WP=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,a))),"_accessVersion","v2"),n}return qd(r,[{key:"getDeviceId",value:function(){if(wC())return"";var e=this.get(GP);return e&&!/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(e)||(e=function(e){for(var t="",r=0;r<e;r++)t+=Math.floor(10*Math.random());return t}(30)),this.setDeviceId(e),e}},{key:"setDeviceId",value:function(e){return[OP,DP,PP].forEach((function(t){return t.setStats({device_id:e})})),this.set(GP,e),e}},{key:"getAccessNode",value:function(e){var t,r,n;return this.get(xm(t=xm(r=xm(n="".concat(HP,"_")).call(n,e,"-")).call(r,jP,"-")).call(t,this._accessVersion))}},{key:"setAccessNode",value:function(e,t,r){var n,i,a;return this.set(xm(n=xm(i=xm(a="".concat(HP,"_")).call(a,e,"-")).call(i,jP,"-")).call(n,this._accessVersion),t,1e3*r)}},{key:"clearAccessNode",value:function(e){var t,r;this.delete(xm(t=xm(r="".concat(HP,"_")).call(r,e,"-")).call(t,jP))}},{key:"getAccessUrls",value:function(){var e;return this.get(xm(e="".concat(zP,"-")).call(e,jP))}},{key:"setAccessUrls",value:function(e){var t,r=uy(e).call(e,(function(e){var t,r=e.host,n=e.path;return xm(t="https://".concat(r)).call(t,n)}));return this.set(xm(t="".concat(zP,"-")).call(t,jP),r)}},{key:"clearAccessUrls",value:function(){var e;this.delete(xm(e="".concat(zP,"-")).call(e,jP))}},{key:"getEngineWebConfig",value:function(e,t){var r,n,i,a=xm(r=xm(n="".concat(e,"_")).call(n,t,"_")).call(r,this.getDeviceId()),o=this.get(KP);return(null==o||null===(i=Nb(o).call(o,(function(e){return e.key===a})))||void 0===i?void 0:i.config)||{}}},{key:"setEngineWebConfig",value:function(e,t,r){var n,i;if(r){var a=xm(n=xm(i="".concat(e,"_")).call(i,t,"_")).call(n,this.getDeviceId()),o=this.get(KP)||[];return(o=Gs(o).call(o,(function(e){return e.key!==a}))).push({key:a,config:r}),this.set(KP,km(o).call(o,-5))}}},{key:"getServerConfig",value:function(e){var t,r="".concat(e),n=this.get(XP);return(null==n||null===(t=Nb(n).call(n,(function(e){return e.key===r})))||void 0===t?void 0:t.config)||{}}},{key:"setServerConfig",value:function(e,t){if(t){var r="".concat(e),n=this.get(XP)||[];return(n=Gs(n).call(n,(function(e){return e.key!==r}))).push({key:r,config:t}),this.set(XP,km(n).call(n,-5))}}}]),r}(qP),YP=new WP,QP="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function JP(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var ZP="https://web-log-report.rtcplus.com/video/v1/webrtc_log/",$P="rtc.rtcplus.com".split(","),eN={VERSION:"4.51.12",ICE_CONFIG_REQUEST_URLS_INTERNAL:uy(QP).call(QP,JP),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:ZP,CONFIG_REQUEST_DOMAINS:$P,DEVICE_ID:"",OVERSEA:!1,PLATFORM:"",PRODUCT:"",CONNECTION_MODE:Fd.AUTO,AUDIO_STALL:!0,VIDEO_STALL:!0,STATS_SCALLBACK_SUPPORT:!0,ENABLE_REPORT_ERROR_BUFFER:!1,ENABLE_FALLBACK_HANDLER:!1,ENABLE_STANDARD_HANDLER:!1,PC_KILLSWITCH:{}};function tN(e,t){var r;if(CP.rtcSdkApiCall("setParameter",0,xm(r="key: ".concat(e,", value: ")).call(r,t)),"VERSION"!==e){if("ICE_CONFIG_REQUEST_URLS"===e)return"string"==typeof t&&(t=[t]),void(eN.ICE_CONFIG_REQUEST_URLS=uy(t).call(t,JP));if("PLATFORM"!==e||"string"!=typeof t)if("PRODUCT"!==e||"string"!=typeof t)if("LOG_SERVER_URL"!==e||t!==Td.overseas)if("LOG_SERVER_URL"!==e||t!==Td.domestic)if("LOG_SERVER_URL"!==e||"string"!=typeof t){if("OVERSEA"===e)return OP.setStats({overSea:t?"1":"0"}),void(eN.OVERSEA=t);"DEVICE_ID"===e&&YP.setDeviceId(t),"ENABLE_REPORT_ERROR_BUFFER"===e&&t&&CP.enableErrorBuffer(),eN[e]=t}else eN.LOG_SERVER_URL=t;else eN.LOG_SERVER_URL=ZP;else eN.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/";else OP.setStats({product:t});else OP.setStats({platform:t})}}function rN(e){return"DEVICE_ID"===e?YP.getDeviceId():eN[e]}function nN(e,t,r){var n,i,a,o,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(n=r.video)||void 0===n?void 0:n.fps)||15,bitrate:1e3*((null===(i=r.video)||void 0===i?void 0:i.kBitRate)||40),width:(null===(a=r.video)||void 0===a?void 0:a.width)||640,height:(null===(o=r.video)||void 0===o?void 0:o.height)||360},layout:{layoutMode:2,interpolationMode:(null===(s=r.layout)||void 0===s?void 0:s.interpolationMode)||Rd.PREV_FRAME,canvas:{bgColor:(null===(c=r.layout)||void 0===c?void 0:c.backgroundColor)||"#000000",bgImage:(null===(u=r.layout)||void 0===u?void 0:u.backgroundImage)||""},regions:(null===(d=r.layout)||void 0===d||null===(l=d.regions)||void 0===l?void 0:uy(l).call(l,(function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:!e.alpha||+e.alpha>1||+e.alpha<=0?1:+e.alpha,x:!e.x||+e.x>=1||+e.x<0?0:+e.x,y:!e.y||+e.y>=1||+e.y<0?0:+e.y,w:!e.w||+e.w>1||+e.w<=0?1:+e.w,h:!e.h||+e.h>1||+e.h<=0?1:+e.h,zorder:!e.zorder||+e.zorder<0||+e.zorder>100?0:+e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var iN={width:640,height:480,frameRate:15,maxKbps:600},aN={width:1920,height:1080,frameRate:15,maxKbps:3e3};function oN(e,t){if(null==e)return{};var r,n,i=function(e,t){if(null==e)return{};var r,n,i={},a=on(e);for(n=0;n<a.length;n++)r=a[n],Kb(t).call(t,r)>=0||(i[r]=e[r]);return i}(e,t);if(xs){var a=xs(e);for(n=0;n<a.length;n++)r=a[n],Kb(t).call(t,r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(i[r]=e[r])}return i}var sN,cN=function(e){return e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted",e}(cN||{}),uN=function(e){return e.PushLimitWarn="PushLimitWarn",e}(uN||{}),dN=function(e){return e.ON_ADD_STREAM="onAddStream",e.ON_ADD_STREAM_LIST="onAddStreamList",e.ON_REMOVE_STREAM="onRemoveStream",e.ON_REMOVE_STREAM_LIST="onRemoveStreamList",e.USER_DISCONNECTION="userDisconnection",e.USER_DISCONNECTION_LIST="userDisconnectionList",e.USER_CONNECTION="userConnection",e.USER_CONNECTION_LIST="userConnectionList",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_UPDATE_USER_ATTRIBUTES="onUpdateUserAttributes",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_SPEAKER_CHANGE="onSpeakerChange",e.ON_STREAM_FAILED="streamFailed",e}(dN||{}),lN=function(e){return e.RSCP="RSCP",e.RTT="RTT",e}(lN||{}),hN=function(e){return e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection",e}(hN||{}),pN=function(e){return e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire",e}(pN||{}),fN=function(e){return e[e.roomDismissByAdmin=2]="roomDismissByAdmin",e}(fN||{}),vN=function(e){return e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK",e}(vN||{}),_N=function(e){return e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER",e}(_N||{}),mN=function(e){return 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.EXCEED_QPS=5]="EXCEED_QPS",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.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN",e}(mN||{}),yN=(sd(sN={},0,[0,"success"]),sd(sN,1,[lR.USER_MESSAGE_TIMEOUT,"timeout, failed to send."]),sd(sN,2,[lR.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."]),sd(sN,3,[lR.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."]),sd(sN,4,[lR.USER_MESSAGE_NO_RECEIVER,"cannot find relay path."]),sd(sN,5,[lR.USER_MESSAGE_EXCEED_QPS,"cannot find relay path."]),sd(sN,17,[lR.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."]),sd(sN,18,[lR.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."]),sd(sN,100,[lR.USER_MESSAGE_NOT_JOIN,"not join room"]),sd(sN,105,[lR.USER_MESSAGE_NOT_LOGIN,"not login."]),sd(sN,106,[lR.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."]),sd(sN,1e3,[lR.USER_MESSAGE_UNKNOWN,"unknown."]),sN),gN=new Jw("RTSMsgReportor",1),SN=function(){function e(t){Wd(this,e),sd(this,"_preTime",Date.now()),sd(this,"_one2oneNum",0),sd(this,"_one2manyNum",0),sd(this,"_one2oneMsgCache",new bE),sd(this,"_one2manyMsgCache",new bE),sd(this,"roomInfo",void 0),sd(this,"rtsSessionId",""),this.id=t}return qd(e,[{key:"needReport",value:function(t){return!!e.config&&(Date.now()-this._preTime>=36e5&&(this._preTime=Date.now(),this._one2oneNum=0,this._one2manyNum=0),"one2one"===t&&this._one2oneNum<e.config.max_one2one_fpt_per_hour&&Math.random()<=e.config.one2one_fpt_ratio/100||"one2many"===t&&this._one2manyNum<e.config.max_one2many_fpt_per_hour&&Math.random()<=e.config.one2many_fpt_ratio/100)}},{key:"cacheP2PMsg",value:function(t){var r;this._one2oneMsgCache.set(t.msg_id,ud({config_version:(null===(r=e.config)||void 0===r?void 0:r.version)||""},t))}},{key:"updateP2PMsg",value:function(e,t){var r=this._one2oneMsgCache.get(e);r&&this._one2oneMsgCache.set(e,ud(ud({},r),t))}},{key:"cacheCustomMsg",value:function(t){var r;this._one2manyMsgCache.set(t.msg_id,ud({config_version:(null===(r=e.config)||void 0===r?void 0:r.version)||""},t))}},{key:"updateOne2ManyMsg",value:function(e,t){var r=this._one2manyMsgCache.get(e);r&&this._one2manyMsgCache.set(e,ud(ud({},r),t))}},{key:"reportP2PMsg",value:function(e){var t=this._one2oneMsgCache.get(e);t&&(gN.print("reportP2PMsg",t.msg_type,ny(t)),CP.rtsMessageReport(t))}},{key:"reportOne2ManyMsg",value:function(e){var t=this._one2manyMsgCache.get(e);t&&(gN.print("reportOne2ManyMsg",t.msg_type,ny(t)),CP.rtsMessageReport(t))}},{key:"reportMsgRecv",value:function(t){var r;t.config_version=(null===(r=e.config)||void 0===r?void 0:r.version)||"",gN.print("reportMsgRecv",t.msg_type,ny(t)),CP.rtsMessageReport(t)}},{key:"destroy",value:function(){this._one2manyNum=0,this._one2oneNum=0,this._one2manyMsgCache.clear(),this._one2oneMsgCache.clear(),this._preTime=Date.now(),delete this.roomInfo,this.rtsSessionId=""}}]),e}();sd(SN,"config",void 0);var EN=new bE,bN=function(e){gN.print("setConfig","get config: "+ny(e)),SN.config=e},kN=function(e){var t=EN.get(e)||new SN(e);return EN.set(e,t),t},TN=function(e){var t=EN.get(e);t&&(t.destroy(),EN.delete(e))},IN=function(e,t){var r=EN.get(e);r&&(r.roomInfo=t)},AN=function(e,t){var r=EN.get(e);r&&(r.rtsSessionId=t)},RN=function(e,t,r){var n,i;t.enable_report&&t.report_msg_id&&(null===(n=EN.get(e))||void 0===n||n.updateP2PMsg(xm(i="".concat(t.from)).call(i,t.report_msg_id),{send_ts:Date.now(),msg_size:r}))},CN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,a=EN.get(e);null==a||a.updateP2PMsg(xm(n="".concat(t.from)).call(n,t.report_msg_id),{ack_ts:Date.now(),error_code:r}),null==a||a.reportP2PMsg(xm(i="".concat(t.from)).call(i,t.report_msg_id))}},wN=function(e,t,r){var n,i,a,o=EN.get(e);null!=o&&o.needReport("one2many")&&(r.enable_report=!0,r.report_msg_id=t,o.cacheCustomMsg({rts_session_id:o.rtsSessionId,msg_id:xm(n="".concat(r.clientId)).call(n,t),node_role:"src_sdk",from:r.clientId,to:(null===(i=o.roomInfo)||void 0===i?void 0:i.roomId)||"",msg_type:"one2many",rts_room_id:(null===(a=o.roomInfo)||void 0===a?void 0:a.roomId)||"",req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0}));return r},xN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i=EN.get(e);if(i)i.updateOne2ManyMsg(xm(n="".concat(t.clientId)).call(n,t.report_msg_id),{send_ts:Date.now(),msg_size:r})}},ON=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,a=EN.get(e);if(a)null==a||a.updateOne2ManyMsg(xm(n="".concat(t.clientId)).call(n,t.report_msg_id),{ack_ts:Date.now(),error_code:r}),null==a||a.reportOne2ManyMsg(xm(i="".concat(t.clientId)).call(i,t.report_msg_id))}},DN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,a=EN.get(e);null==a||a.reportMsgRecv({rts_session_id:a.rtsSessionId,msg_id:xm(n="".concat(t.from)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",msg_type:t.to?"one2one":"one2many",rts_room_id:t.room,from:t.from,to:t.to||t.room,error_code:0,recv_msg_ts:r.recv_msg_ts,fwd_msg_ts:r.fwd_msg_ts,reply_ack_ts:Date.now(),cur_dst_uid:t.to?"":null===(i=a.roomInfo)||void 0===i?void 0:i.userInfo.userId})}},PN=function(e,t,r){if(t.enable_report&&t.report_msg_id){var n,i,a=EN.get(e);null==a||a.reportMsgRecv({rts_session_id:a.rtsSessionId,msg_id:xm(n="".concat(t.clientId)).call(n,t.report_msg_id),msg_size:r.msg_size,node_role:"dst_sdk",msg_type:"one2many",rts_room_id:t.roomId,from:t.clientId,to:t.roomId,error_code:0,recv_msg_ts:r.recv_msg_ts,fwd_msg_ts:r.fwd_msg_ts,reply_ack_ts:Date.now(),cur_dst_uid:null===(i=a.roomInfo)||void 0===i?void 0:i.userInfo.userId})}},NN=Object.freeze(Object.defineProperty({__proto__:null,_cache:EN,setConfig:bN,setRtsSessionId:AN,createRTSMsgReportor:kN,destroyRTSMsgReportor:TN,setRoomInfo:IN,samplingP2PMsg:function(e,t){var r=EN.get(e);if(null!=r&&r.needReport("one2one")){var n,i=xm(n="".concat(t.from)).call(n,t.id);t.enable_report=!0,t.report_msg_id=t.id,r.cacheP2PMsg({rts_session_id:r.rtsSessionId,msg_id:i,node_role:"src_sdk",from:t.from,to:t.to||"server",msg_type:t.to?"one2one":"one2server",rts_room_id:t.room,req_ts:Date.now(),send_ts:Date.now(),ack_ts:Date.now(),msg_size:0})}return t},updateP2PMsgReq:RN,updateP2PMsgAck:CN,samplingOne2ManyMsg:wN,reportP2PMsgRecv:DN,updateOne2ManyMsgAck:ON,updateOne2ManyMsgReq:xN,reportOne2ManyMsgRecv:PN},Symbol.toStringTag,{value:"Module"})),MN=["msg"],LN=new Jw("DataChannelSignaling",3),UN=["onSpeakerChange"],VN=function(e){return 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",e}(VN||{}),FN=function(e){DI(i,e);var t,r,n=YI(i);function i(e,t){var r;return Wd(this,i),sd(eI(r=n.call(this)),"_singlingCache",new bE),sd(eI(r),"_p2pCache",new bE),sd(eI(r),"_rttIds",{}),sd(eI(r),"_p2pMessageId",0),sd(eI(r),"_clearDataChannelListener",void 0),sd(eI(r),"_asyncQueue",new sw),r.id=e,r._dataChannel=t,r._clearDataChannelListener=r._handleHandler(),window.__rtc_mock_signaling__=r.emit.bind(eI(r)),r}return qd(i,[{key:"destroy",value:function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}}},{key:"sendSignaling",value:function(e,t,r){var n=this;return CP.rtcSignaling(0,ny(t),"call-".concat(e),"Send",t.streamId,t.streamUserId,tP.UP),new v_((function(i,a){var o,s=n._genHeader(r);s.id=KC();var c=s.id.join("-"),u="customMessage"===e;u&&wN(n.id,+s.id.join(""),t);var d=setTimeout((function(){n._singlingCache.delete(c),a(new pR(lR.TIME_OUT,"".concat(e," message time out"))),u&&ON(n.id,t,999)}),6e4);n._singlingCache.set(c,{signalingType:e,success:function(e){clearTimeout(d),i(e),u&&ON(n.id,t,0)},error:function(e){clearTimeout(d),a(e),u&&ON(n.id,t,e.code)}}),LN.print("Signal",xm(o=">>>>>> [".concat(e,"][")).call(o,c,"]"),t),n._sendMessage(e,s,t)}))}},{key:"sendPingSignaling",value:function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:2})}},{key:"sendP2PMessage",value:(r=m_(Im.mark((function e(t,r){var n,i,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.msg,i=oN(t,MN),a=n instanceof ArrayBuffer,e.t0=this,e.t1=NN,e.t2=this.id,e.t3=ud,e.t4=ud({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:vN.SEND,type:_N.P2P,err:mN.SUCCESS},i),e.t5={},e.t6=a,!a){e.next=15;break}return e.next=12,xC.ab2b64str(n);case 12:e.t7=e.sent,e.next=16;break;case 15:e.t7=n;case 16:return e.t8=e.t7,e.t9={binary:e.t6,msg:e.t8},e.t10=(0,e.t3)(e.t4,e.t5,e.t9),e.t11=e.t1.samplingP2PMsg.call(e.t1,e.t2,e.t10),e.t12=r,e.abrupt("return",e.t0._sendP2PMessage.call(e.t0,e.t11,e.t12));case 22:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_sendP2PMessage",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return qC(e.msg)?this._rttIds[e.id]=e.id:e.dir===vN.SEND&&LN.print("_sendP2PMessage [DC Signaling p2p >>]",ny(e)),new v_((function(n,i){var a=t._genHeader(ud(ud({needAck:!0,functionType:1},r),{},{id:KC()}));if(e.dir===vN.SEND){var o=setTimeout((function(){t._p2pCache.delete(e.id),i(new pR(lR.USER_MESSAGE_TIMEOUT,"P2P message timeout")),CN(t.id,e,999)}),12e3);t._p2pCache.set(e.id,{success:function(r,i){clearTimeout(o),n(i),CN(t.id,e,0)},error:function(r){var n;clearTimeout(o),CN(t.id,e,r.err);var a=$T(yN[r.err]||[lR.USER_MESSAGE_UNKNOWN,xm(n="err: ".concat(r.err,", msg: ")).call(n,r.msg)],2),s=a[0],c=a[1];i({err:r.err,code:s,message:r.msg||c})}})}try{t._sendMessage("p2p",a,e)}catch(s){throw s.code===lR.SIGNALING_CHANNEL_NOT_OPEN&&(s.code=lR.USER_MESSAGE_BROKEN),s}}))}},{key:"_sendMessage",value:function(e,t,r){var n;if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new pR(lR.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var i=t.version+(+t.zip<<5)+(+t.encrypt<<6),a=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=xC.str2ab(ny([e,r])),s=CC(Uint8Array,xm(n=[i,a]).call(n,Qk(t.id||[])),new Uint8Array(o));this._dataChannel.send(s.buffer),"p2p"===e?RN(this.id,r,s.buffer.byteLength):"customMessage"===e&&xN(this.id,r,s.buffer.byteLength)}},{key:"_dispartData",value:function(e){var t=new Uint8Array(e),r=0,n=t[r++],i=t[r++],a={version:15&n,zip:16==(16&n),encrypt:32==(32&n),needAck:1==(1&i),direction:(2&i)>>1,functionType:(60&i)>>2,binary:64==(64&i)};if(a.needAck||1===a.direction){for(;r<=6;r++)if(128!=(128&t[r])){r++;break}a.id=Wk(km(t).call(t,2,r))}return{header:a,data:km(t).call(t,r)}}},{key:"_feedbackSignaling",value:function(e,t,r){var n,i,a=this._genHeader({needAck:!0,direction:1,id:uy(n=e.split("-")).call(n,(function(e){return+e}))});$m(UN).call(UN,t)||LN.print("Signal",xm(i=">>>>>> [".concat(t,"-res][")).call(i,e,"]"));this._sendMessage("".concat(t,"-res"),a,r)}},{key:"_handleMessage",value:(t=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O,D,P,N,M,L,U=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:s=Date.now(),c=t.byteLength,u=this._dispartData(t),d=u.data,(l=u.header).zip&&((h=new BD.Inflate).push(d,!0),d=h.result),p=xC.ab2str(d),f=[],e.prev=8,f=JSON.parse(p),e.next=16;break;case 12:return e.prev=12,e.t0=e.catch(8),e.t0 instanceof Error&&CP.rtcSignalingMsgError(-1,e.t0.message,eP.MESSAGE_PARSE_FAILED),e.abrupt("return");case 16:e.t1=l.functionType,e.next=0===e.t1?19:1===e.t1?38:2===e.t1?73:91;break;case 19:if(v=(null===(r=l.id)||void 0===r?void 0:r.join("-"))||"",1!==l.direction){e.next=24;break}this._handleAckMessage(v,f[0]||{},p),e.next=37;break;case 24:if(!Array.isArray(f)){e.next=37;break}if(_=f[0],f=f[1],$m(UN).call(UN,_)||LN.print("Signal","<<<<<< ".concat(_),f,v),this._feedbackSignaling(v,_,_===dN.ON_CUSTOM_MESSAGE?ud(ud({},f),{},{message:""}):""),!f.binary||"string"!=typeof f.message){e.next=33;break}return e.next=32,xC.b64str2ab(f.message);case 32:f.message=e.sent;case 33:m=Date.now(),this.emit(_,ud({},f)),_===dN.ON_CUSTOM_MESSAGE&&PN(this.id,f,{msg_size:c,recv_msg_ts:s,fwd_msg_ts:m}),CP.rtcSignaling(0,p,"on-".concat(_),"Recv",f.streamId,f.clientId,tP.DOWN);case 37:return e.abrupt("break",92);case 38:Array.isArray(f)&&(f=f[1]),y=null===(n=f)||void 0===n?void 0:n.id,this._rttIds[y]||(null===(i=f)||void 0===i?void 0:i.dir)===vN.FEEDBACK||qC(null===(a=f)||void 0===a?void 0:a.msg)?delete this._rttIds[y]:LN.print("Signal","<<<<<< p2p response",f),e.t2=f.dir,e.next=e.t2===vN.SEND?44:e.t2===vN.FEEDBACK?69:71;break;case 44:if(g=Date.now(),qC(null===(o=f)||void 0===o?void 0:o.msg)){e.next=66;break}if(E=(S=f).binary,b=S.msg,k=S.room,T=S.to,I=S.from,A=""===k?E?dN.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:dN.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:E?dN.USER_BINARY_MESSAGE_RECEIVED:dN.USER_MESSAGE_RECEIVED,T){e.next=65;break}if(e.t3=this,e.t4=dN.ON_CUSTOM_MESSAGE,e.t5=I,e.t6=E,!E){e.next=59;break}return e.next=56,xC.b64str2ab(b);case 56:e.t7=e.sent,e.next=60;break;case 59:e.t7=b;case 60:e.t8=e.t7,e.t9={clientId:e.t5,binary:e.t6,message:e.t8},e.t3.emit.call(e.t3,e.t4,e.t9),e.next=66;break;case 65:E?this._asyncQueue.add(xC.b64str2ab(b),(function(e){return U.emit(A,ud(ud({},f),{},{msg:e}))})):this.emit(A,ud(ud({},f),{},{msg:b}));case 66:return this._sendP2PMessage(ud(ud({},f),{},{dir:vN.FEEDBACK,msg:""})),DN(this.id,f,{msg_size:c,recv_msg_ts:s,fwd_msg_ts:g}),e.abrupt("break",72);case 69:return this._handleP2PMsgFeedback(f),e.abrupt("break",72);case 71:return e.abrupt("break",72);case 72:return e.abrupt("break",92);case 73:if(1!==l.direction){e.next=78;break}C=(null===(R=l.id)||void 0===R?void 0:R.join("-"))||"",this._handleAckMessage(C,f[0]||{},p),e.next=90;break;case 78:if(w=$T(f,2),x=w[0],O=w[1],D=void 0===O?{}:O,"RXMediaMsg"!==x){e.next=90;break}P=D.type,N=D.data,CP.rtcSignaling(0,p,"on-".concat(P),"Recv","","",tP.DOWN),e.t10=P,e.next="RSCP"===e.t10?85:"RTT"===e.t10?87:89;break;case 85:try{M=JSON.parse(N),Array.isArray(M)&&this.emit(P,M)}catch(V){}return e.abrupt("break",90);case 87:try{(L=JSON.parse(N)).length&&this.emit(P,L[0])}catch(V){}return e.abrupt("break",90);case 89:return e.abrupt("break",90);case 90:case 91:return e.abrupt("break",92);case 92:case"end":return e.stop()}}),e,this,[[8,12]])}))),function(e){return t.apply(this,arguments)})},{key:"_handleHandler",value:function(){var e=this,t=function(t){LN.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){LN.print("_handleHandler","dataChannel error",t),e.emit("close",t)},n=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",n),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",n)}}},{key:"_genHeader",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return ud({version:2,zip:!1,encrypt:!1,needAck:!0,direction:0,functionType:0,binary:!1},e)}},{key:"_handleAckMessage",value:function(e,t,r){var n,i=this._singlingCache.get(e);i&&(this._singlingCache.delete(e),200===t.code?i.success(t):i.error(t),LN.print("Signal",xm(n="<<<<<< [".concat(i.signalingType,"-ack] ")).call(n,e),t));CP.rtcSignaling(0,r,null==i?void 0:i.signalingType,"Ack","","",tP.DOWN)}},{key:"_handleP2PMsgFeedback",value:function(e){var t=this._p2pCache.get(e.id);t&&(this._p2pCache.delete(e.id),e.err===mN.SUCCESS?t.success(e.id,e):t.error(e))}}]),i}(Pw.exports.EventEmitter),BN=function(){function e(){Wd(this,e),sd(this,"xhr",void 0),sd(this,"isSending",void 0),sd(this,"timeout",void 0),this.isSending=!1}return qd(e,[{key:"ajax",value:function(e){var t=this,r=e.method,n=e.url,i=e.body,a=void 0===i?{}:i,o=e.headers,s=void 0===o?{}:o,c=e.stringify,u=void 0===c||c;return new v_((function(e,i){t.isSending=!0;var o=new XMLHttpRequest;o.open(r,n,!0);for(var c=0,d=bR(s);c<d.length;c++){var l=$T(d[c],2),h=l[0],p=l[1];o.setRequestHeader(h,p)}o.onreadystatechange=function(){if(4===o.readyState)if(t.isSending=!1,200===o.status)e(JSON.parse(o.responseText));else{var r=o.statusText,n=o.status;if(o.responseText)try{var a=JSON.parse(o.responseText);a.errMessage&&(r=a.errMessage),a.code&&(n=a.code)}catch(s){}i({message:r,code:n})}},o.onabort=function(){i({code:0,message:"Request abort"})},o.onerror=function(e){t.isSending=!1,i({code:-1,message:o.responseText||"unknown"})},t.timeout&&(o.timeout=t.timeout),u&&(a=ny(a)),o.send(a),t.xhr=o}))}},{key:"get",value:function(e,t){return this.ajax({method:"GET",url:e,headers:t})}},{key:"post",value:function(e,t,r,n){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:n})}},{key:"abort",value:function(){var e;null===(e=this.xhr)||void 0===e||e.abort()}}]),e}(),jN=new Jw("ICE Request",3),GN=function(){function e(){Wd(this,e),sd(this,"_request",void 0),this._request=new BN}var t,r,n;return qd(e,[{key:"getAccessNode",value:(n=m_(Im.mark((function e(t,r,n,i,a,o,s,c){var u;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(u=YP.getAccessNode(t))){e.next=9;break}if(this.getAccessNodeFromServer(t,r,n,i,a,o,s,c),BP("es.R.node.cache",u),!Array.isArray(u)){e.next=8;break}return e.abrupt("return",v_.resolve(u));case 8:return e.abrupt("return",v_.resolve([u]));case 9:return e.abrupt("return",this.getAccessNodeFromServer(t,r,n,i,a,o,s,c));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i,a,o,s,c){return n.apply(this,arguments)})},{key:"getAccessNodeFromServer",value:(r=m_(Im.mark((function e(t,r,n,i,a,o,s,c){var u,d,l,h,p=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return l=YP.getAccessUrls(),h=!0,BP("es.R.req.cache.urls",l),(null===(u=l)||void 0===u?void 0:u.length)>0||(l=eN.ICE_CONFIG_REQUEST_URLS,h=!1,BP("es.R.req.external.urls",l)),(null===(d=l)||void 0===d?void 0:d.length)>0||(l=eN.ICE_CONFIG_REQUEST_URLS_INTERNAL,h=!1,BP("es.R.req.internal.urls",l)),e.abrupt("return",this.getICEConfigFromServer(l,t,r,n,i,a,o,s,c).then((function(e){var r=e.nodes;return YP.setAccessNode(t,r,e.ttl||11200),e.dispatchDomains&&YP.setAccessUrls(e.dispatchDomains),r})).catch((function(e){if(h)return BP("es.R.req.fallback",""),YP.clearAccessUrls(),p.getAccessNodeFromServer(t,r,n,i,a,o,s);throw e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t,n,i,a,o,s,c){return r.apply(this,arguments)})},{key:"getICEConfigFromServer",value:(t=m_(Im.mark((function e(t,r,n,i,a,o,s,c,u){var d,l,h,p,f=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return d={appID:r,userID:i,deviceID:a,connectSessionID:AC(),os:"web",sdkVersion:eN.VERSION,isOversea:eN.OVERSEA,expectedAddr:rN("EXPECTED_ADDR"),productPlatform:"BytePlus",accessParams:ny({requireICEUfragV2:!0})},o&&s&&(d.feedbackInfo=[{feedbackIP:null===(l=s.publicIPs[0])||void 0===l?void 0:l.ip,feedbackReason:{type:"NODE_CHANGED",reason:o}}],delete d.expectedAddr),h=Date.now(),CP.rtcGetAccess(0,ny(d),0,ZD.REQUEST,t.join(","),d.connectSessionID),p=uy(t).call(t,function(){var e=m_(Im.mark((function e(t,r){var n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,f._request.post(t,d);case 3:n=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new pR(lR.ICE_SERVER_WRONG,"get ICE config failed",e.t0);case 9:if(200===n.code){e.next=11;break}throw new pR(lR.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:ny(n)});case 11:if(i=n.nodes[0]){e.next=14;break}throw new pR(lR.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:ny(n)});case 14:return e.abrupt("return",{result:n,firstNode:i,index:r});case 15:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}()),e.abrupt("return",QC(p).then((function(e){var r=e.result;e.firstNode;var n=e.index;return CP.rtcGetAccess(200,ny(r),Date.now()-h,ZD.RESPONSE,t[n],d.connectSessionID),r})).catch((function(e){var r,n,i=null===(r=e[0])||void 0===r?void 0:r.error;throw CP.rtcGetAccess(+((null==i?void 0:i.code)||(null==i?void 0:i.server_code)),null===(n=e[0])||void 0===n?void 0:n.message,Date.now()-h,ZD.RESPONSE,t.join(","),d.connectSessionID,{error:ny(i)}),e})));case 6:case"end":return e.stop()}}),e)}))),function(e,r,n,i,a,o,s,c,u){return t.apply(this,arguments)})},{key:"abort",value:function(){this._request.isSending&&(jN.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())}}]),e}(),HN=function(){function e(){Wd(this,e),sd(this,"_request",void 0),this._request=new BN}return qd(e,[{key:"getConfig",value:function(e,t){var r,n=this,i={keys:["rts_report","web_rtc_config"],labelSelector:"",sdkVersion:"4.51.12",deviceType:"web",appId:e,deviceId:t,userAgent:"undefined"!=typeof navigator?navigator.userAgent:void 0},a=uy(r=eN.CONFIG_REQUEST_DOMAINS).call(r,(function(e){return"https://".concat(e,"/decision/v1/multi")}));CP.rtcGetConfig(0,ny(i),0,a.join(","),qD.REQUEST,"",!1);var o=uy(a).call(a,function(){var e=m_(Im.mark((function e(t,r){var a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,n._request.post(t,i);case 3:a=e.sent,e.next=9;break;case 6:throw e.prev=6,e.t0=e.catch(0),new pR(lR.ICE_SERVER_WRONG,"get config failed");case 9:return e.abrupt("return",{result:a,index:r});case 10:case"end":return e.stop()}}),e,null,[[0,6]])})));return function(t,r){return e.apply(this,arguments)}}());return new v_((function(t){QC(o).then((function(r){var n=r.result,i=r.index;CP.rtcGetConfig(200,ny(n),0,a[i],qD.RESPONSE,"",!1),YP.setServerConfig(e,n),t(n)})).catch((function(e){CP.rtcGetConfig(500,e.message,0,"",qD.RESPONSE,"",!1)}))}))}}]),e}(),zN=hi.f("asyncIterator");function KN(e){var t,r,n,i=2;for(void 0!==j_&&(r=zN,n=G_);i--;){if(r&&null!=(t=e[r]))return t.call(e);if(n&&null!=(t=e[n]))return new XN(t.call(e));r="@@asyncIterator",n="@@iterator"}throw new TypeError("Object is not async iterable")}function XN(e){function t(e){if(Object(e)!==e)return v_.reject(new TypeError(e+" is not an object."));var t=e.done;return v_.resolve(e.value).then((function(e){return{value:e,done:t}}))}return(XN=function(e){this.s=e,this.n=e.next}).prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(e){var r=this.s.return;return void 0===r?v_.resolve({value:e,done:!0}):t(r.apply(this.s,arguments))},throw:function(e){var r=this.s.return;return void 0===r?v_.reject(e):t(r.apply(this.s,arguments))}},new XN(e)}var qN=[{maxLayers:3,totalPixels:2073600},{maxLayers:3,totalPixels:921600},{maxLayers:3,totalPixels:518400},{maxLayers:2,totalPixels:230400},{maxLayers:2,totalPixels:129600},{maxLayers:1,totalPixels:57600},{maxLayers:1,totalPixels:0}];yg("Set",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),Mg);var WN=ee.Set;Rr({target:"Set",stat:!0,forced:!0},{from:zg}),Rr({target:"Set",stat:!0,forced:!0},{of:Xg});var YN=O,QN=we,JN=tr,ZN=function(){for(var e=JN(this),t=QN(e.add),r=0,n=arguments.length;r<n;r++)YN(t,e,arguments[r]);return e};Rr({target:"Set",proto:!0,real:!0,forced:!0},{addAll:ZN}),Rr({target:"Set",proto:!0,real:!0,forced:!0},{deleteAll:Qg});var $N=bl,eM=tr,tM=Yt,rM=$N,nM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{every:function(e){var t=eM(this),r=rM(t),n=tM(e,arguments.length>1?arguments[1]:void 0);return!nM(r,(function(e,r){if(!n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var iM=ae,aM=O,oM=we,sM=tr,cM=wh,uM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{difference:function(e){var t=sM(this),r=new(cM(t,iM("Set")))(t),n=oM(r.delete);return uM(e,(function(e){aM(n,r,e)})),r}});var dM=ae,lM=O,hM=we,pM=tr,fM=Yt,vM=wh,_M=$N,mM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{filter:function(e){var t=pM(this),r=_M(t),n=fM(e,arguments.length>1?arguments[1]:void 0),i=new(vM(t,dM("Set"))),a=hM(i.add);return mM(r,(function(e){n(e,e,t)&&lM(a,i,e)}),{IS_ITERATOR:!0}),i}});var yM=tr,gM=Yt,SM=$N,EM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{find:function(e){var t=yM(this),r=SM(t),n=gM(e,arguments.length>1?arguments[1]:void 0);return EM(r,(function(e,r){if(n(e,e,t))return r(e)}),{IS_ITERATOR:!0,INTERRUPTED:!0}).result}});var bM=ae,kM=O,TM=we,IM=tr,AM=wh,RM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{intersection:function(e){var t=IM(this),r=new(AM(t,bM("Set"))),n=TM(t.has),i=TM(r.add);return RM(e,(function(e){kM(n,t,e)&&kM(i,r,e)})),r}});var CM=O,wM=we,xM=tr,OM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isDisjointFrom:function(e){var t=xM(this),r=wM(t.has);return!OM(e,(function(e,n){if(!0===CM(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var DM=ae,PM=O,NM=we,MM=A,LM=tr,UM=bl,VM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isSubsetOf:function(e){var t=UM(this),r=LM(e),n=r.has;return MM(n)||(r=new(DM("Set"))(e),n=NM(r.has)),!VM(t,(function(e,t){if(!1===PM(n,r,e))return t()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var FM=O,BM=we,jM=tr,GM=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{isSupersetOf:function(e){var t=jM(this),r=BM(t.has);return!GM(e,(function(e,n){if(!1===FM(r,t,e))return n()}),{INTERRUPTED:!0}).stopped}});var HM=Rr,zM=tr,KM=yn,XM=$N,qM=Bl,WM=b([].join),YM=[].push;HM({target:"Set",proto:!0,real:!0,forced:!0},{join:function(e){var t=zM(this),r=XM(t),n=void 0===e?",":KM(e),i=[];return qM(r,YM,{that:i,IS_ITERATOR:!0}),WM(i,n)}});var QM=ae,JM=Yt,ZM=O,$M=we,eL=tr,tL=wh,rL=$N,nL=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{map:function(e){var t=eL(this),r=rL(t),n=JM(e,arguments.length>1?arguments[1]:void 0),i=new(tL(t,QM("Set"))),a=$M(i.add);return nL(r,(function(e){ZM(a,i,n(e,e,t))}),{IS_ITERATOR:!0}),i}});var iL=we,aL=tr,oL=$N,sL=Bl,cL=TypeError;Rr({target:"Set",proto:!0,real:!0,forced:!0},{reduce:function(e){var t=aL(this),r=oL(t),n=arguments.length<2,i=n?void 0:arguments[1];if(iL(e),sL(r,(function(r){n?(n=!1,i=r):i=e(i,r,r,t)}),{IS_ITERATOR:!0}),n)throw cL("Reduce of empty set with no initial value");return i}});var uL=tr,dL=Yt,lL=$N,hL=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{some:function(e){var t=uL(this),r=lL(t),n=dL(e,arguments.length>1?arguments[1]:void 0);return hL(r,(function(e,r){if(n(e,e,t))return r()}),{IS_ITERATOR:!0,INTERRUPTED:!0}).stopped}});var pL=ae,fL=O,vL=we,_L=tr,mL=wh,yL=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{symmetricDifference:function(e){var t=_L(this),r=new(mL(t,pL("Set")))(t),n=vL(r.delete),i=vL(r.add);return yL(e,(function(e){fL(n,r,e)||fL(i,r,e)})),r}});var gL=ae,SL=we,EL=tr,bL=wh,kL=Bl;Rr({target:"Set",proto:!0,real:!0,forced:!0},{union:function(e){var t=EL(this),r=new(bL(t,gL("Set")))(t);return kL(e,SL(r.add),{that:r}),r}});var TL=WN,IL=new bE,AL=function(){var e=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new v_((function(e,r){var n=rN("STATS_SCALLBACK_SUPPORT");if("chrome-stable"===OC()&&void 0===window.InstallTrigger&&DC&&n)try{t.getStats((function(t){var r=[];t.result().forEach((function(e){if(!$m(xL).call(xL,e.type)){var t={};e.names().forEach((function(r){t[r]=e.stat(r)})),r.push(ud(ud({},t),{},{id:e.id,type:e.type,timestamp:e.timestamp}))}})),e({all:r,getTrackStats:function(e){return Gs(r).call(r,(function(t){return"ssrc"!==t.type||t.googTrackId===e}))}})}))}catch(PX){r(PX)}else e({all:[],getTrackStats:function(){return[]}})})));case 1:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),RL=function(){var e=m_(Im.mark((function e(t){var r,n,i,a,o,s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getStats();case 2:return i=e.sent,a={all:[]},o=new bE,i.forEach((function(e){var t=o.get(e.type)||new bE;t.set(e.id,e),o.set(e.type,t),a.all.push(e)})),s=function(e,t){e.forEach((function(e){var r,n,i,a,s,c,u=e.codecId,d=e.transportId,l=e.trackId,h=e.playoutId;if(null===(r=o.get(wL.codec))||void 0===r||r.forEach((function(e){e.id===u&&t.add(e)})),null===(n=o.get(wL.transport))||void 0===n||n.forEach((function(e){e.id===d&&(s=e,t.add(e))})),null===(i=o.get(wL.track))||void 0===i||i.forEach((function(e){e.id===l&&t.add(e)})),null===(a=o.get(wL.mediaPlayout))||void 0===a||a.forEach((function(e){e.id===h&&t.add(e)})),s){var p,f,v=s,_=v.localCertificateId,m=v.remoteCertificateId,y=v.selectedCandidatePairId;null===(p=o.get(wL.certificate))||void 0===p||p.forEach((function(e){(e.id===_||e.id===m)&&t.add(e)})),null===(f=o.get(wL.candidatePair))||void 0===f||f.forEach((function(e){e.id===y&&(c=e,t.add(e))}))}if(c){var g,S,E=c,b=E.localCandidateId,k=E.remoteCandidateId;null===(g=o.get(wL.localCandidate))||void 0===g||g.forEach((function(e){e.id===b&&t.add(e)})),null===(S=o.get(wL.remoteCandidate))||void 0===S||S.forEach((function(e){e.id===k&&t.add(e)}))}}))},null===(r=o.get(wL.mediaSource))||void 0===r||r.forEach((function(e){var t,r=new TL;r.add(e);var n=[];null===(t=o.get(wL.outboundRtp))||void 0===t||t.forEach((function(t){var i;t.mediaSourceId===e.id&&(r.add(t),n.push(t),null===(i=o.get(wL.remoteInboundRtp))||void 0===i||i.forEach((function(e){e.localId===t.id&&r.add(e)})))})),s(n,r),a[e.trackIdentifier]=Wk(r)})),null===(n=o.get(wL.inboundRtp))||void 0===n||n.forEach((function(e){var t,r=new TL;r.add(e),null===(t=o.get(wL.remoteOutboundRtp))||void 0===t||t.forEach((function(t){t.localId===e.id&&r.add(t)})),s([e],r);var n,i=e.trackIdentifier;i||(null===(n=o.get(wL.track))||void 0===n||n.forEach((function(t){t.id===e.trackId&&(i=t.trackIdentifier)})));a[i]=Wk(r)})),e.abrupt("return",a);case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),CL=function(){var e=m_(Im.mark((function e(t,r,n){var i,a,o,s,c,u;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=null==r?void 0:r.id,t instanceof RTCPeerConnection){e.next=3;break}return e.abrupt("return",[]);case 3:if(!PC&&!NC){e.next=10;break}return a=[],e.next=7,t.getStats(r);case 7:return e.sent.forEach((function(e){a.push(e)})),e.abrupt("return",a);case 10:return(!(o=IL.get(t))||Date.now()-o.timestamp>150)&&(o={timestamp:Date.now(),statsPromise:RL(t),extraStatsPromise:AL(t)},IL.set(t,o)),e.next=14,o.statsPromise;case 14:if(s=e.sent,c=(i?s[i]:s.all)||[],n){e.next=21;break}return e.next=19,o.extraStatsPromise;case 19:u=e.sent,c=xm(c).call(c,(i?u.getTrackStats(i):u.all)||[]);case 21:return e.abrupt("return",c);case 22:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}();OC();var wL=function(e){return 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",e.mediaPlayout="media-playout",e}(wL||{}),xL=["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"],OL=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!wC()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel){e.next=3;break}return e.abrupt("return",!1);case 3:return e.next=5,BL();case 5:if(e.t0=e.sent,!e.t0){e.next=10;break}return e.next=9,FL();case 9:e.t0=e.sent;case 10:return e.abrupt("return",e.t0);case 13:return e.prev=13,e.t1=e.catch(0),e.abrupt("return",!1);case 16:case"end":return e.stop()}}),e,null,[[0,13]])})));return function(){return e.apply(this,arguments)}}(),DL=function(){var e=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=[],e.next=3,BL();case 3:if(e.t0=e.sent,!e.t0){e.next=8;break}return e.next=7,FL();case 7:e.t0=e.sent;case 8:if(!e.t0){e.next=10;break}t.push("H264");case 10:return e.next=12,GL();case 12:if(e.t1=e.sent,!e.t1){e.next=17;break}return e.next=16,jL();case 16:e.t1=e.sent;case 17:if(!e.t1){e.next=19;break}t.push("vp8");case 19:return e.abrupt("return",t);case 20:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),PL=function(){var e=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,DL();case 2:return t=e.sent,e.abrupt("return",uy(t).call(t,(function(e){return e.toUpperCase()})));case 4:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),NL={};function ML(e){var t,r=!1,n=ZT(e.split("\n"));try{for(n.s();!(t=n.n()).done;){var i=t.value;if($m(i).call(i,"level-asymmetry-allowed=1")&&$m(i).call(i,"packetization-mode=1")&&$m(i).call(i,"profile-level-id=42e0")){r=!0;break}}}catch(d){n.e(d)}finally{n.f()}if(r){for(var a=navigator.userAgent.toLowerCase(),o=!1,s=0,c=["miuibrowser"];s<c.length;s++){var u=c[s];$m(a).call(a,u)&&(o=!0)}return!o}return!1}var LL=function(){var e=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=new RTCPeerConnection).addTransceiver("audio",{direction:t}),r.addTransceiver("video",{direction:t}),e.next=5,r.createOffer();case 5:return n=e.sent,r.close(),e.abrupt("return",n.sdp);case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),UL=function(){var e=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,LL("sendonly");case 2:if(r=e.sent,!$m(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,LL("sendonly");case 6:r=e.sent;case 7:return NL.h264encode=ML(r),NL.vp8encode=Kb(r).call(r,"VP8")>-1,e.abrupt("return",NL);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),VL=function(){var e=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,LL("recvonly");case 2:if(r=e.sent,!$m(t=navigator.userAgent).call(t,"VivoBrowser")){e.next=7;break}return e.next=6,LL("recvonly");case 6:r=e.sent;case 7:return NL.h264decode=ML(r),NL.vp8decode=Kb(r).call(r,"VP8")>-1,e.abrupt("return",NL);case 10:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),FL=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==NL.h264encode){e.next=9;break}return e.prev=1,e.next=4,UL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",NL.h264encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),BL=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==NL.h264decode){e.next=9;break}return e.prev=1,e.next=4,VL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",NL.h264decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),jL=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==NL.vp8encode){e.next=9;break}return e.prev=1,e.next=4,UL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",NL.vp8encode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),GL=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==NL.vp8decode){e.next=9;break}return e.prev=1,e.next=4,VL();case 4:e.next=9;break;case 6:return e.prev=6,e.t0=e.catch(1),e.abrupt("return",!1);case 9:return e.abrupt("return",NL.vp8decode||!1);case 10:case"end":return e.stop()}}),e,null,[[1,6]])})));return function(){return e.apply(this,arguments)}}(),HL=function(){return"undefined"!=typeof TransformStream&&"undefined"!=typeof RTCRtpSender&&"undefined"!=typeof RTCRtpReceiver&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},zL={},KL={},XL={exports:{}},qL=XL.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"]}]};on(qL).forEach((function(e){qL[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},r=function(e,r,n){var i=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:i&&!r[e.name]&&(r[e.name]={});var a=e.push?{}:i?r[e.name]:r;!function(e,r,n,i){if(i&&!n)r[i]=t(e[1]);else for(var a=0;a<n.length;a+=1)null!=e[a+1]&&(r[n[a]]=t(e[a+1]))}(n.match(e.reg),a,e.names,e.name),e.push&&r[e.push].push(a)},n=XL.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t,a={},o=[],s=a;return Gs(t=e.split(/(\r\n|\r|\n)/)).call(t,i).forEach((function(e){var t=e[0],i=km(e).call(e,2);"m"===t&&(o.push({rtp:[],fmtp:[]}),s=o[o.length-1]);for(var a=0;a<(n[t]||[]).length;a+=1){var c=n[t][a];if(c.reg.test(i))return r(c,s,i)}})),a.media=o,a};var a=function(e,r){var n=r.split(/=(.+)/,2);return 2===n.length?e[n[0]]=t(n[1]):1===n.length&&r.length>1&&(e[n[0]]=void 0),e};e.parseParams=function(e){var t;return LE(t=e.split(/;\s?/)).call(t,a,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){var t;return uy(t=e.toString().split(" ")).call(t,Number)},e.parseRemoteCandidates=function(e){for(var r,n=[],i=uy(r=e.split(" ")).call(r,t),a=0;a<i.length;a+=3)n.push({component:i[a],ip:i[a+1],port:i[a+2]});return n},e.parseImageAttributes=function(e){var t;return uy(t=e.split(" ")).call(t,(function(e){var t;return LE(t=e.substring(1,e.length-1).split(",")).call(t,a,{})}))},e.parseSimulcastStreamList=function(e){var r;return uy(r=e.split(";")).call(r,(function(e){var r;return uy(r=e.split(",")).call(r,(function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(KL);var WL=XL.exports,YL=/%[sdv%]/g,QL=function(e){var t=1,r=arguments,n=r.length;return e.replace(YL,(function(e){if(t>=n)return e;var i=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}}))},JL=function(e,t,r){var n=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var i=0;i<t.names.length;i+=1){var a=t.names[i];t.name?n.push(r[t.name][a]):n.push(r[t.names[i]])}else n.push(r[t.name]);return QL.apply(null,n)},ZL=["v","o","s","i","u","e","p","c","b","t","r","z","a"],$L=["i","c","b","a"],eU=KL,tU=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 r=t.outerOrder||ZL,n=t.innerOrder||$L,i=[];return r.forEach((function(t){WL[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(JL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(JL(t,r,e))}))}))})),e.media.forEach((function(e){i.push(JL("m",WL.m[0],e)),n.forEach((function(t){WL[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(JL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(JL(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};zL.write=tU,zL.parse=eU.parse,zL.parseParams=eU.parseParams,zL.parseFmtpConfig=eU.parseFmtpConfig,zL.parsePayloads=eU.parsePayloads,zL.parseRemoteCandidates=eU.parseRemoteCandidates,zL.parseImageAttributes=eU.parseImageAttributes,zL.parseSimulcastStreamList=eU.parseSimulcastStreamList;var rU=Xe,nU=Mr,iU=Br,aU=function(e){for(var t=rU(this),r=iU(t),n=arguments.length,i=nU(n>1?arguments[1]:void 0,r),a=n>2?arguments[2]:void 0,o=void 0===a?r:nU(a,r);o>i;)t[i++]=e;return t};Rr({target:"Array",proto:!0},{fill:aU});var oU=Us("Array").fill,sU=oe,cU=oU,uU=Array.prototype,dU=function(e){var t=e.fill;return e===uU||sU(uU,e)&&t===uU.fill?cU:t},lU=new Jw("FirefoxHandler",3),hU=Math.pow(2,32),pU="kp34Za0H+aVf862l",fU="o/i14u9pJrxRKAsu";function vU(e){return e>hU-18?(lU.print("generateAllSsrc","reset start id",e),vU(e=e-hU+1e4+18)):{audio:e,audioFec:e+1,audioRtx:e+2,video:e+3,videoFec:e+4,videoRtx:e+5,next:e+18}}var _U=function(e,t,r){var n,i,a,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:fU;return[{id:r,attribute:"cname",value:o},{id:r,attribute:"msid",value:xm(n=xm(i="".concat(e," ")).call(i,e,"-")).call(n,t)},{id:r,attribute:"mslabel",value:"".concat(e)},{id:r,attribute:"label",value:xm(a="".concat(e,"-")).call(a,t)}]},mU=function(e,t){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=t.video,a=t.videoRtx,o=t.videoFec,s=[i,a],c=n.cname,u=n.flexfec;u&&s.push(o);var d,l=LE(s).call(s,(function(t,r){return xm(t).call(t,_U(e,"video",r,c))}),[]),h=[{semantics:"FID",ssrcs:xm(r="".concat(i," ")).call(r,a)}];u&&h.push({semantics:"FEC-FR",ssrcs:xm(d="".concat(i," ")).call(d,o)});return{ssrcs:l,ssrcGroups:h}};function yU(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 gU=function(e,t,r){var n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=ud(ud({},e),{},{media:[]});return n&&(i.invalid=[{value:"realx-exts:rscp"}]),t&&i.media.push(t),r&&i.media.push(r),delete i.groups,delete i.msidSemantic,zL.write(i)};function SU(e){return EU.apply(this,arguments)}function EU(){return(EU=m_(Im.mark((function e(t){var r,n,i,a,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={},n=t.publicIPs,i=t.certFingerprint,a=t.iceParams,o=t.iceConfig,r.fingerprint={type:"sha-256",hash:i},r.icePwd=a.serverIcePwd,e.next=6,kU(a.serverIceUfrag);case 6:return r.iceUfrag=e.sent,r.candidates=bU(n,o),r.setup="active",r.iceOptions="renomination",e.abrupt("return",r);case 11:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function bU(e,t){if(!Array.isArray(e))return[];var r=0,n=2130706431,i=[],a=rN("CONNECTION_MODE");return e.forEach((function(e){var o={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&!t.tcpOnly&&a!==Fd.FORCE_TCP&&e.udpPorts.forEach((function(e){i.push(ud(ud({},o),{},{foundation:r++,transport:"udp",port:e,priority:n}))})),e.tcpPorts&&a!==Fd.FORCE_UDP&&e.tcpPorts.forEach((function(e){i.push(ud(ud({},o),{},{foundation:r++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),i}var kU=function(){var e=m_(Im.mark((function e(t){var r,n,i,a,o,s,c;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=new TextEncoder,n=r.encode("PREC"),e.t0=Uint8Array,e.next=5,xC.b64str2ab(t);case 5:return e.t1=e.sent,i=new e.t0(e.t1),a=new Uint8Array(4),crypto.getRandomValues(a),(o=new Uint8Array(2))[0]=0,o[1]=1,s=CC(Uint8Array,n,i,a,o),e.next=15,xC.ab2b64str(s.buffer);case 15:return c=e.sent,e.abrupt("return",c);case 17:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),TU=function(e){return 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",e}(TU||{});function IU(e){var t,r=e.random,n=e.serverUfrag,i=e.serverPwd,a=e.clientPwd,o=e.options,s=(new TextEncoder).encode("WPRE");r||(r=new Uint8Array(4),crypto.getRandomValues(r));var c=cw(n);c.byteLength;var u=dw(cw(a),cw(i).subarray(0,16),cw(n).subarray(0,16));u.byteLength;var d=new Uint8Array(LE(t=on(o)).call(t,(function(e,t){var r=Number(t);return e.push(r),e.push(o[r]?1:0),e}),[]));d.byteLength;var l,h=CC(Uint8Array,s,r,[c.byteLength],c,[u.byteLength],u,d);h.byteLength%3!=0&&(h=CC(Uint8Array,h,dU(l=new Uint8Array(3-h.byteLength%3)).call(l,255)));return[uw(h),uw(CC(Uint8Array,r,c.subarray(0,20)))]}var AU=function(e,t){var r=0;if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){var n,i=ZT(e.fmtp);try{for(i.s();!(n=i.n()).done;){var a,o,s,c=n.value;if($m(a=c.config).call(a,"level-asymmetry-allowed=1")&&$m(o=c.config).call(o,"packetization-mode=1")&&$m(s=c.config).call(s,"profile-level-id=42e0")){r=c.payload;break}}}catch(f){i.e(f)}finally{i.f()}for(var u=0;u<e.rtp.length;u++){var d=e.rtp[u];if("H264"===t){if(d.payload===r){var l;e.rtp.unshift(mk(l=e.rtp).call(l,u,1)[0]);break}}else if(d.codec===t){var h;e.rtp.unshift(mk(h=e.rtp).call(h,u,1)[0]);break}}var p=[];e.rtp.forEach((function(e){return p.push(e.payload)})),e.payloads=p.join(" ")}},RU=new Jw("BasicHandler",3),CU=HL(),wU={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},xU=function(e){DI(a,e);var t,r,n,i=YI(a);function a(e,t){var r;return Wd(this,a),sd(eI(r=i.call(this)),"_peerConnection",void 0),sd(eI(r),"_dataChannel",void 0),sd(eI(r),"_context",void 0),sd(eI(r),"monitor",void 0),sd(eI(r),"_offerIce",{}),sd(eI(r),"_answerIce",{}),sd(eI(r),"_initSctpEvents",!1),sd(eI(r),"_nextSsrc",Math.floor(Math.random()*hU+1e4)),sd(eI(r),"_aSendonlyAnswerTpl",void 0),sd(eI(r),"_vSendonlyAnswerTpl",void 0),sd(eI(r),"_enableSubFlexfec",!1),sd(eI(r),"audioTrack4ff",void 0),sd(eI(r),"connection_id",""),sd(eI(r),"ms_addr",""),r.monitor=e,r._peerConnection=new RTCPeerConnection(OU(t)),r._dataChannel=r._peerConnection.createDataChannel("signaling",{negotiated:!0,id:100}),r._context=t,r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,n,i,a,o=null===(t=e.streams)||void 0===t||null===(n=t[0])||void 0===n?void 0:n.id;RU.print("constructor",xm(i=xm(a="pc.ontrack ".concat(e.track.kind," ")).call(a,e.track.id," ")).call(i,o)),"ff-stream"===o&&(r.audioTrack4ff=e.track),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){var t;RU.print("constructor",xm(t="onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ")).call(t,r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var t=r._peerConnection.iceConnectionState;e.rtcPreIceState(t,$D["".concat(t.toUpperCase())],r.connection_id,{ms_addr:r.ms_addr})},r}return qd(a,[{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){RU.print("destroy"),this.disconnect(),this._context=void 0}},{key:"getTransceivers",value:function(){return this._peerConnection.getTransceivers()}},{key:"_simulcast",value:function(e,t,r,n,i){var a,o,s,c=[];1===e.videoEncodeConfig.length?(c=function(e,t){var r=[];if(t<=1)return r;var n=Math.min(e.width,e.height)/90;return r.push({scaleResolutionDownBy:n,width:Math.floor(e.width/n),height:Math.floor(e.height/n),maxkbps:100,frameRate:10}),t<=2||r.unshift({scaleResolutionDownBy:2,width:Math.floor(e.width/2),height:Math.floor(e.height/2),maxkbps:Math.floor(e.maxKbps/2),frameRate:e.frameRate>=30?Math.floor(e.frameRate/2):e.frameRate}),r}(t,i),RU.print("simulcast() ","simulcastLayers: %o",c)):(c=uy(a=km(o=km(s=e.videoEncodeConfig).call(s,1)).call(o,1-i)).call(a,(function(e){var r=ow(e.width),n=t.width/r;return{width:r,height:Math.floor(t.height/n),scaleResolutionDownBy:n,frameRate:ow(e.frameRate)||15,maxkbps:e.maxKbps||600}})),RU.print("simulcast() ","simulcastLayers2: %o",c));var u=[!0];c.forEach((function(e,t){var i,a={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};null===(i=r.sendEncodings)||void 0===i||i.unshift(a),n.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)}),u.push(!0)})),this._context&&(this._context.activeSimStreams=u)}},{key:"internalPublish",value:function(e){var t=e.stream,r=e.videoTrack,n=e.audioTrack,i=e.enableSimulcast,a=e.pubAudio,o=e.pubVideo,s={direction:"sendonly",streams:[t]},c={direction:"sendonly",streams:[t]},u=[],d=[];if(Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length){var l=null==r?void 0:r.getTrack(),h=ud({},iN);if(l){var p=null==l?void 0:l.getSettings();h={width:Math.floor(p.width),height:Math.floor(p.height),frameRate:Math.floor(p.frameRate)}}"number"!=typeof h.frameRate&&(h.frameRate=30);var f=null==e?void 0:e.videoEncodeConfig[0],v={maxBitrate:1e3*f.maxKbps,rid:"0"};if(e.prevBitrate=f.maxKbps,c.sendEncodings=[v],u.push({width:h.width,height:h.height,framerate:h.frameRate,maxkbps:f.maxKbps,rid:"0"}),!PC&&i){var _,m,y=function(e){for(var t=0,r=e.width*e.height,n=0;n<qN.length;n++)if(r>=qN[n].totalPixels){t=n;break}if(0===t)return qN[t].maxLayers;var i=qN[t-1].totalPixels;return(i-r)/(i-qN[t].totalPixels)<.1?qN[t-1].maxLayers:qN[t].maxLayers}(h);if(RU.print("simulcast() ","maxLayers: %o",y),y>1)this._simulcast(e,ud(ud({},h),{},{maxKbps:f.maxKbps}),c,u,y),null!==(_=this._context)&&void 0!==_&&null!==(m=_.serverConfig)&&void 0!==m&&m.simulcastOnDemand&&(d=uy(u).call(u,(function(e,t){return ud(ud({},e),{},{video_index:t,sub_index:t})})))}}RU.print("publish videoTransceiverInit videoDescriptions","",c,u);var g=null==n?void 0:n.getTrack("preprocessing");(null==n?void 0:n.mixType)!==Gd.PLAYOUT&&null!=n&&n.mixedAudioTrack&&(g=null==n?void 0:n.mixedAudioTrack),g=a&&g?g:"audio";var S=null==r?void 0:r.getTrack("preprocessing");S=o&&S?S:"video";try{this.monitor.rtcInvokeStatus(ny({aTrack:rw(g),vTrack:rw(S),audioTransceiverInit:s,videoTransceiverInit:c}),0,"Handler.internalPublish","",0)}catch(PX){}return{semantics:"unified-plan",videoDescriptions:u,subVideoDescriptions:d,audioTransceiverInit:{track:g,init:s},videoTransceiverInit:{track:S,init:c}}}},{key:"updateMaxBitrate",value:function(e){var t,r,n,i;RU.print("updateMaxBitrate()");var a=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack(),o=e.videoTransceiver;if(a&&e.pubVideo&&o){var s=null===(r=e.videoEncodeConfig)||void 0===r||null===(n=r[0])||void 0===n?void 0:n.maxKbps;if(s){if(s===e.prevBitrate)return void RU.print("updateMaxBitrate()","no change");e.prevBitrate=s}var c=null===(i=o.sender)||void 0===i?void 0:i.getParameters();if(c){var u;c.encodings=null==c||null===(u=c.encodings)||void 0===u?void 0:uy(u).call(u,(function(t){var r,n=+t.rid||0,i=null===(r=e.videoEncodeConfig[n])||void 0===r?void 0:r.maxKbps;return"number"==typeof i&&(t.maxBitrate=1e3*i),t})),null==o||o.sender.setParameters(c);try{this.monitor.rtcInvokeStatus(ny(c.encodings),0,"Handler.updateScaleResolutionDownBy","",0)}catch(PX){}}}else RU.print("updateMaxBitrate()","no pub")}},{key:"getStats",value:function(e,t){return CL(this._peerConnection,e,t)}},{key:"setLocalDescription",value:(n=m_(Im.mark((function e(t,r){var n,i,a,o=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=RC(),e.prev=1,e.next=4,this._peerConnection.setLocalDescription(new RTCSessionDescription({type:"offer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,iP.W_1,"local"===(null==r?void 0:r.streamUserId)?aP.UP:aP.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",RC()-n,this.connection_id,{type:"offer",ms_addr:this.ms_addr}),this._initSctpEvents||(this._initSctpEvents=!0,(a=null===(i=this._peerConnection)||void 0===i?void 0:i.sctp)&&(a.onstatechange=function(){o.monitor.rtcInvokeStatus("sctp state change TO: ".concat(a.state),0,"sctp","",0,{ms_addr:o.ms_addr},o.connection_id)},a.transport&&(a.transport.onstatechange=function(){var e;o.monitor.rtcInvokeStatus("dtls state change TO: ".concat(null==a||null===(e=a.transport)||void 0===e?void 0:e.state),0,"dtls","",0,{ms_addr:o.ms_addr},o.connection_id)}))),e.next=12;break;case 8:e.prev=8,e.t0=e.catch(1),console.error("setLocal",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,iP.W_1,"local"===(null==r?void 0:r.streamUserId)?aP.UP:aP.DOWN,"","",RC()-n,this.connection_id,{type:"offer",ms_addr:this.ms_addr});case 12:case"end":return e.stop()}}),e,this,[[1,8]])}))),function(e,t){return n.apply(this,arguments)})},{key:"setRemoteDescription",value:(r=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=RC(),e.prev=1,e.next=4,this._peerConnection.setRemoteDescription(new RTCSessionDescription({type:"answer",sdp:t}));case 4:this.monitor.rtcSetDescription(0,t,iP.W_0,"local"===(null==r?void 0:r.streamUserId)?aP.UP:aP.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",RC()-n,this.connection_id,{type:"answer",ms_addr:this.ms_addr}),e.next=11;break;case 7:e.prev=7,e.t0=e.catch(1),console.error("setRemote",e.t0),this.monitor.rtcSetDescription(-1,e.t0.message+t,iP.W_1,"local"===(null==r?void 0:r.streamUserId)?aP.UP:aP.DOWN,(null==r?void 0:r.streamId)||"",(null==r?void 0:r.streamUserId)||"",RC()-n,this.connection_id,{type:"answer",ms_addr:this.ms_addr});case 11:case"end":return e.stop()}}),e,this,[[1,7]])}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}}),e)}))),function(){return t.apply(this,arguments)})},{key:"createAVMlineAnswerTpl",value:function(e){var t=this;zL.parse(e).media.forEach((function(e){if("audio"===e.type){if("sendonly"===e.direction){var r,n=null==e?void 0:Nb(r=e.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&null!=e&&e.fmtp){var i,a=null==e?void 0:Nb(i=e.fmtp).call(i,(function(e){return e.payload===n.payload}));a&&t._context&&(a.config+=";stereo=1;sprop-stereo=1")}t._aSendonlyAnswerTpl=e}}else"video"===e.type&&("sendonly"===e.direction&&(t._vSendonlyAnswerTpl=e),Array.isArray(e.rtp)&&e.rtp.forEach((function(e){var r;null!==(r=e.codec)&&void 0!==r&&$m(r).call(r,"flexfec")&&(t._enableSubFlexfec=!0)})))}))}},{key:"pc",get:function(){return this._peerConnection}},{key:"addBitrateLimit",value:function(e,t){null==e||e.rtp.forEach((function(r){var n,i=r.codec,a=r.payload;if($m(n=["vp8","h264"]).call(n,i.toLocaleLowerCase())){var o,s,c=Nb(o=e.fmtp).call(o,(function(e){return e.payload===a}));if(c)c.config=xm(s=[]).call(s,Qk(c.config.split(";")),["x-google-min-bitrate=100","x-google-start-bitrate=".concat(t)]).join(";");else e.fmtp.push({payload:a,config:"x-google-min-bitrate=100;x-google-start-bitrate=".concat(t)})}}))}}]),a}(Pw.exports.EventEmitter),OU=function(e){var t=ud({},wU);return e&&!e.pcKillSwitch.ctor_sdpsemantics_add||(t.sdpSemantics="unified-plan"),e&&!e.pcKillSwitch.ctor_encodedinsetablestream_add||CU&&(t.encodedInsertableStreams=!0),t},DU=b,PU=Sg,NU=Py.exports.getWeakData,MU=Sh,LU=tr,UU=z,VU=$,FU=Bl,BU=Ye,jU=Zi.set,GU=Zi.getterFor,HU=Pa.find,zU=Pa.findIndex,KU=DU([].splice),XU=0,qU=function(e){return e.frozen||(e.frozen=new WU)},WU=function(){this.entries=[]},YU=function(e,t){return HU(e.entries,(function(e){return e[0]===t}))};WU.prototype={get:function(e){var t=YU(this,e);if(t)return t[1]},has:function(e){return!!YU(this,e)},set:function(e,t){var r=YU(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=zU(this.entries,(function(t){return t[0]===e}));return~t&&KU(this.entries,t,1),!!~t}};var QU,JU={getConstructor:function(e,t,r,n){var i=e((function(e,i){MU(e,a),jU(e,{type:t,id:XU++,frozen:void 0}),UU(i)||FU(i,e[n],{that:e,AS_ENTRIES:r})})),a=i.prototype,o=GU(t),s=function(e,t,r){var n=o(e),i=NU(LU(t),!0);return!0===i?qU(n).set(t,r):i[n.id]=r,e};return PU(a,{delete:function(e){var t=o(this);if(!VU(e))return!1;var r=NU(e);return!0===r?qU(t).delete(e):r&&BU(r,t.id)&&delete r[t.id]},has:function(e){var t=o(this);if(!VU(e))return!1;var r=NU(e);return!0===r?qU(t).has(e):r&&BU(r,t.id)}}),PU(a,r?{get:function(e){var t=o(this);if(VU(e)){var r=NU(e);return!0===r?qU(t).get(e):r?r[t.id]:void 0}},set:function(e,t){return s(this,e,t)}}:{add:function(e){return s(this,e,!0)}}),i}},ZU=n,$U=b,eV=Sg,tV=Py.exports,rV=yg,nV=JU,iV=$,aV=By,oV=Zi.enforce,sV=Vi,cV=!ZU.ActiveXObject&&"ActiveXObject"in ZU,uV=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},dV=rV("WeakMap",uV,nV);if(sV&&cV){QU=nV.getConstructor(uV,"WeakMap",!0),tV.enable();var lV=dV.prototype,hV=$U(lV.delete),pV=$U(lV.has),fV=$U(lV.get),vV=$U(lV.set);eV(lV,{delete:function(e){if(iV(e)&&!aV(e)){var t=oV(this);return t.frozen||(t.frozen=new QU),hV(this,e)||t.frozen.delete(e)}return hV(this,e)},has:function(e){if(iV(e)&&!aV(e)){var t=oV(this);return t.frozen||(t.frozen=new QU),pV(this,e)||t.frozen.has(e)}return pV(this,e)},get:function(e){if(iV(e)&&!aV(e)){var t=oV(this);return t.frozen||(t.frozen=new QU),pV(this,e)?fV(this,e):t.frozen.get(e)}return fV(this,e)},set:function(e,t){if(iV(e)&&!aV(e)){var r=oV(this);r.frozen||(r.frozen=new QU),pV(this,e)?vV(this,e,t):r.frozen.set(e,t)}else vV(this,e,t);return this}})}var _V=ee.WeakMap;Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{emplace:eS}),Rr({target:"WeakMap",stat:!0,forced:!0},{from:zg}),Rr({target:"WeakMap",stat:!0,forced:!0},{of:Xg}),Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{deleteAll:Qg}),Rr({target:"WeakMap",proto:!0,real:!0,forced:!0},{upsert:EE});var mV=_V,yV=function(e){DI(p,e);var t,r,n,i,a,o,s,c,u,d,l,h=YI(p);function p(){var e,t,r;return Wd(this,p),sd(eI(r=h.call(this)),"inited",!1),sd(eI(r),"deviceMap",{audioinput:new bE,audiooutput:new bE,videoinput:new bE}),sd(eI(r),"checkDeviceChangeTimer",null),sd(eI(r),"isSupportedPermissionsQuery",!1),sd(eI(r),"isGrantedMicrophonePermission",!1),sd(eI(r),"isGrantedCameraPermission",!1),r.isSupportedPermissionsQuery=!wC()&&!(null===(e=navigator)||void 0===e||null===(t=e.permissions)||void 0===t||!t.query),r._handleDeviceChange=r._handleDeviceChange.bind(eI(r)),!wC()&&r.refreshDevices(),r}return qd(p,[{key:"refreshDevices",value:(l=m_(Im.mark((function e(){var t,r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.mediaDevices){e.next=2;break}return e.abrupt("return");case 2:if(t=void 0,!PC){e.next=12;break}return e.prev=4,e.next=7,navigator.mediaDevices.getUserMedia({audio:!0});case 7:t=e.sent,e.next=12;break;case 10:e.prev=10,e.t0=e.catch(4);case 12:return e.next=14,navigator.mediaDevices.enumerateDevices();case 14:r=e.sent,t&&t.getTracks().forEach((function(e){return e.stop()})),r.forEach((function(e){var t;e.deviceId&&(null===(t=n.deviceMap[e.kind])||void 0===t||t.set(e.deviceId,e))})),this.inited||this.initListener(),this.inited=!0;case 19:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return l.apply(this,arguments)})},{key:"initListener",value:(d=m_(Im.mark((function e(){var t,r,n,i,a=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(null===(t=navigator.mediaDevices)||void 0===t?void 0:t.ondevicechange)&&"function"==typeof(null===(r=navigator.mediaDevices)||void 0===r?void 0:r.addEventListener)?navigator.mediaDevices.addEventListener("devicechange",(function(){a._handleDeviceChange(),setTimeout((function(){a._handleDeviceChange()}),300)})):this.checkDeviceChangeTimer=window.setInterval((function(){a._handleDeviceChange()}),3e3),!this.isSupportedPermissionsQuery){e.next=22;break}return e.prev=2,e.next=5,navigator.permissions.query({name:"microphone"});case 5:n=e.sent,this.isGrantedMicrophonePermission="granted"===n.state,n.addEventListener("change",(function(){a.isGrantedMicrophonePermission="granted"===n.state})),e.next=12;break;case 10:e.prev=10,e.t0=e.catch(2);case 12:return e.prev=12,e.next=15,navigator.permissions.query({name:"camera"});case 15:i=e.sent,this.isGrantedCameraPermission="granted"===i.state,i.addEventListener("change",(function(){a.isGrantedCameraPermission="granted"===i.state})),e.next=22;break;case 20:e.prev=20,e.t1=e.catch(12);case 22:case"end":return e.stop()}}),e,this,[[2,10],[12,20]])}))),function(){return d.apply(this,arguments)})},{key:"_handleDeviceChange",value:(u=m_(Im.mark((function e(){var t,r,n,i,a,o,s,c=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=void 0,!PC){e.next=5;break}return e.next=4,navigator.mediaDevices.getUserMedia({audio:!0});case 4:a=e.sent;case 5:return e.next=7,navigator.mediaDevices.enumerateDevices();case 7:o=e.sent,o=Gs(o).call(o,(function(e){return!!e.deviceId})),a&&a.getTracks().forEach((function(e){return e.stop()})),s=Wk(xm(t=[]).call(t,Qk(nA(r=this.deviceMap.audioinput).call(r)),Qk(nA(n=this.deviceMap.videoinput).call(n)),Qk(nA(i=this.deviceMap.audiooutput).call(i)))),o.forEach((function(e){var t,r,n=c.deviceMap[e.kind].get(e.deviceId);c.deviceMap[e.kind].set(e.deviceId,e),n||($m(t=e.kind).call(t,"video")?c.emit(Kd.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}):$m(r=e.kind).call(r,"audio")&&c.emit(Kd.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"active"}))})),s.forEach((function(e){var t,r;Nb(o).call(o,(function(t){return t.deviceId===e.deviceId&&t.kind===e.kind}))||(c.deviceMap[e.kind].delete(e.deviceId),$m(t=e.kind).call(t,"video")?c.emit(Kd.onVideoDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}):$m(r=e.kind).call(r,"audio")&&c.emit(Kd.onAudioDeviceStateChanged,{mediaDeviceInfo:e,deviceState:"inactive"}))}));case 13:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"getUserMedia",value:(c=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,navigator.mediaDevices.getUserMedia(t);case 2:return r=e.sent,null!=t&&t.audio&&(this.isGrantedMicrophonePermission=!0),null!=t&&t.video&&(this.isGrantedCameraPermission=!0),this.refreshDevices(),e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"checkPermissionsByDevices",value:(s=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t={audio:!1,video:!1},navigator.mediaDevices){e.next=3;break}return e.abrupt("return",t);case 3:return e.next=5,navigator.mediaDevices.enumerateDevices();case 5:return r=e.sent,t.audio=Gs(r).call(r,(function(e){return"audioinput"===e.kind&&e.label&&e.deviceId})).length>0,t.video=Gs(r).call(r,(function(e){return"videoinput"===e.kind&&e.label&&e.deviceId})).length>0,e.abrupt("return",t);case 9:case"end":return e.stop()}}),e)}))),function(){return s.apply(this,arguments)})},{key:"getPermissions",value:(o=m_(Im.mark((function e(){var t,r,n,i,a,o,s,c=this,u=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>0&&void 0!==u[0]?u[0]:{},n=r.audio,i=r.video,a=r.force,n||i||(n=!0,i=!0),o={audio:!1,video:!1},a){e.next=30;break}if(!this.isSupportedPermissionsQuery){e.next=20;break}if(!n||!i){e.next=14;break}if(!this.isGrantedMicrophonePermission||!this.isGrantedCameraPermission){e.next=12;break}return o.audio=!0,o.video=!0,e.abrupt("return",o);case 12:e.next=18;break;case 14:if(!(n&&this.isGrantedMicrophonePermission||i&&this.isGrantedCameraPermission)){e.next=18;break}return o.audio=this.isGrantedMicrophonePermission,o.video=this.isGrantedCameraPermission,e.abrupt("return",o);case 18:case 26:e.next=30;break;case 20:return e.next=22,this.checkPermissionsByDevices();case 22:if(s=e.sent,!n||!i){e.next=28;break}if(!s.audio||!s.video){e.next=26;break}return e.abrupt("return",s);case 28:if(!(n&&s.audio||i&&s.video)){e.next=30;break}return e.abrupt("return",s);case 30:if(null===(t=navigator.mediaDevices)||void 0===t||!t.getUserMedia){e.next=33;break}return e.next=33,navigator.mediaDevices.getUserMedia({audio:n,video:i}).then((function(e){e&&(e.getTracks().forEach((function(e){return e.stop()})),n&&(o.audio=!0,c.isGrantedMicrophonePermission=!0),i&&(o.video=!0,c.isGrantedCameraPermission=!0))})).catch((function(){}));case 33:return e.next=35,this.refreshDevices();case 35:return e.abrupt("return",o);case 36:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"enumerateDevices",value:(a=m_(Im.mark((function e(){var t,r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions();case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Wk(xm(t=[]).call(t,Qk(nA(r=this.deviceMap.audioinput).call(r)),Qk(nA(n=this.deviceMap.videoinput).call(n)),Qk(nA(i=this.deviceMap.audiooutput).call(i)))));case 5:case"end":return e.stop()}}),e,this)}))),function(){return a.apply(this,arguments)})},{key:"enumerateAudioCaptureDevices",value:(i=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Wk(nA(t=this.deviceMap.audioinput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"enumerateVideoCaptureDevices",value:(n=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({video:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Wk(nA(t=this.deviceMap.videoinput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"enumerateAudioPlaybackDevices",value:(r=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getPermissions({audio:!0});case 2:return e.next=4,this.refreshDevices();case 4:return e.abrupt("return",Wk(nA(t=this.deviceMap.audiooutput).call(t)));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getDeviceById",value:(t=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.enumerateDevices();case 2:return r=e.sent,e.abrupt("return",Nb(r).call(r,(function(e){return e.deviceId===t})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),p}(ex),gV=new yV;!wC()&&(window.__rtc_dd__=gV);var SV=function(){function e(){Wd(this,e),sd(this,"_audioContextInstance",void 0)}return qd(e,[{key:"getAudioContextInstance",value:function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance}}]),e}(),EV=function(){function e(t){Wd(this,e),sd(this,"_ctx",void 0),sd(this,"_analyserNode",void 0),sd(this,"_audioSource",void 0);var r=bV.getAudioContextInstance();if(t instanceof MediaStreamTrack){var n=new MediaStream;n.addTrack(t),this._audioSource=r.createMediaStreamSource(n)}else this._audioSource=r.createMediaElementSource(t),this._audioSource.connect(r.destination);var i=r.createAnalyser();this._audioSource.connect(i),this._analyserNode=i,this._ctx=r}var t;return qd(e,[{key:"getAudioLevel",value: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 r=0;t.forEach((function(e){return r=Math.max(r,Math.abs(e-128))}));var n=r/128*255;return n>2?n:0}},{key:"resume",value:(t=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(t=this._ctx)||void 0===t?void 0:t.resume();case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._audioSource.disconnect(),this._analyserNode.disconnect()}}]),e}(),bV=new SV,kV=function(e){return e[e.CAPTURE=0]="CAPTURE",e[e.PRE_PROCESSING=1]="PRE_PROCESSING",e[e.ENCODE=2]="ENCODE",e[e.TRANSFER=3]="TRANSFER",e[e.POST_PROCESSING=4]="POST_PROCESSING",e[e.DECODE=5]="DECODE",e[e.RENDERING=6]="RENDERING",e}(kV||{}),TV=function(){function e(){Wd(this,e),sd(this,"_plugins",new bE),sd(this,"_monitor",void 0)}var t;return qd(e,[{key:"setMinotor",value:function(e){this._monitor=e}},{key:"register",value:function(e){e.monitor=this._monitor;var t=this._plugins.get(e.type)||[];if(YA(t).call(t,(function(t){return t.name===e.name}))>-1)throw new Error("Failed to register ".concat(e.name,": name is repeated."));t.push(e),this._plugins.set(e.type,t)}},{key:"getPluginsByType",value:function(e){return this._plugins.get(e)||[]}},{key:"getPluginByName",value:function(e,t){var r;return Nb(r=this._plugins.get(e)||[]).call(r,(function(e){return e.name===t}))}},{key:"getPreProcessingTrack",value:(t=m_(Im.mark((function e(t){var r,n,i,a,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=this._plugins.get(1)||[],n=t.getTrack(),i=ZT(r),e.prev=3,i.s();case 5:if((a=i.n()).done){e.next=12;break}return o=a.value,e.next=9,o.effect(t,n);case 9:n=e.sent;case 10:e.next=5;break;case 12:e.next=17;break;case 14:e.prev=14,e.t0=e.catch(3),i.e(e.t0);case 17:return e.prev=17,i.f(),e.finish(17);case 20:return e.abrupt("return",n);case 21:case"end":return e.stop()}}),e,this,[[3,14,17,20]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){this._plugins.forEach((function(e){e.forEach((function(e){return e.destroy()}))})),this._plugins.clear()}}]),e}(),IV=function(e){return e[e.EXTERNAL=0]="EXTERNAL",e[e.INTERNAL=1]="INTERNAL",e}(IV||{}),AV=new Jw("VERTC",0),RV=new mV,CV=function(e){DI(r,e);var t=YI(r);function r(e,n){var i;return Wd(this,r),sd(eI(i=t.call(this)),"sourceType",1),sd(eI(i),"mediaType",void 0),sd(eI(i),"_trackId",void 0),i._trackId=e,i.mediaType=n,i}return qd(r,[{key:"getId",value:function(){return this._trackId}}]),r}(ex),wV=function(e){DI(n,e);var t,r=YI(n);function n(e,t,i){var a;return Wd(this,n),sd(eI(a=r.call(this,t,i)),"_mediaTrack",void 0),sd(eI(a),"_preProcessingTrack",void 0),sd(eI(a),"handleTrackEnded",(function(){CP.rtcError("track-ended mediaType: ".concat(a._mediaTrack.kind),-1001),a.emit("track-ended",eI(a))})),a._mediaTrack=e,a._initListeners(),a}return qd(n,[{key:"getTrack",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"origin";return"origin"===e?this._mediaTrack:this._preProcessingTrack||this._mediaTrack}},{key:"setTrack",value:function(e,t){this._mediaTrack=e,t&&this.generatePreProcessingTrack(t)}},{key:"generatePreProcessingTrack",value:(t=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,t.getPreProcessingTrack(this);case 3:(r=e.sent)instanceof MediaStreamTrack&&(this._preProcessingTrack=r),e.next=10;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return t.apply(this,arguments)})},{key:"close",value:function(){var e,t,r;return this._mediaTrack.onended=null,this._mediaTrack.onmute=null,this._mediaTrack.onunmute=null,null===(e=this._mediaTrack)||void 0===e||e.removeEventListener("ended",this.handleTrackEnded),null===(t=this._preProcessingTrack)||void 0===t||t.stop(),null===(r=this._mediaTrack)||void 0===r?void 0:r.stop()}},{key:"_initListeners",value:function(){this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",this.handleTrackEnded)}}]),n}(CV),xV=function(e){DI(r,e);var t=YI(r);function r(e,n,i){var a;return Wd(this,r),sd(eI(a=t.call(this,n,i)),"_mediaTrack",void 0),a._mediaTrack=e,a}return qd(r,[{key:"getTrack",value:function(){return this._mediaTrack}}]),r}(CV),OV=function(e){DI(n,e);var t,r=YI(n);function n(e,t){var i;return Wd(this,n),sd(eI(i=r.call(this,e,t,"video")),"resolution",void 0),sd(eI(i),"dummy",!1),i.resolution={width:0,height:0},i}return qd(n,[{key:"updateVideoCaptureConfig",value:(t=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.getTrack()){e.next=2;break}return e.abrupt("return");case 2:return AV.print("updateVideoEncoderConfig","update localVideoTrack: ",t),delete(r=ud({},t)).contentHint,PC&&(r.frameRate={ideal:30,max:30}),e.next=8,this.getTrack().applyConstraints(r);case 8:((n=this.getTrack().getSettings()).width&&n.width!==this.resolution.width||n.height&&n.height!==this.resolution.height)&&(this.resolution={width:n.width,height:n.height},this.emit("resolution-change",this.resolution));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"replaceTrack",value:function(e){this.setTrack(e)}},{key:"setContentHint",value:function(e){var t;this._mediaTrack&&"contentHint"in this._mediaTrack&&$m(t=["text","motion","detail"]).call(t,e)&&(this._mediaTrack.contentHint=e)}}]),n}(wV),DV=function(e){DI(n,e);var t,r=YI(n);function n(e,t){var i;return Wd(this,n),sd(eI(i=r.call(this,e,t,"audio")),"audioCaptureConfig",void 0),sd(eI(i),"_audioLevelFetcher",void 0),sd(eI(i),"mixedAudioTrack",void 0),sd(eI(i),"mixType",Gd.PLAYOUT_AND_PUBLISH),i}return qd(n,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new EV(this.getTrack("preprocessing"))),this._audioLevelFetcher.getAudioLevel()}},{key:"updateAudioCaptureConfig",value:(t=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.audioCaptureConfig){e.next=2;break}return e.abrupt("return");case 2:return AV.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),e.next=5,null===(t=this.getTrack())||void 0===t?void 0:t.applyConstraints(this.audioCaptureConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),n}(wV),PV=function(e){DI(r,e);var t=YI(r);function r(e,n){return Wd(this,r),t.call(this,e,n,"video")}return qd(r)}(xV),NV=function(e){DI(r,e);var t=YI(r);function r(e,n){var i;return Wd(this,r),sd(eI(i=t.call(this,e,n,"audio")),"_audioLevelFetcher",void 0),i}return qd(r,[{key:"getAudioLevel",value:function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new EV(this.getTrack())),this._audioLevelFetcher.getAudioLevel()}}]),r}(xV),MV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,a))),"streamIndex",gd.STREAM_INDEX_MAIN),n}return qd(r)}(DV),LV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,a))),"streamIndex",gd.STREAM_INDEX_MAIN),n}return qd(r)}(OV),UV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,a))),"streamIndex",gd.STREAM_INDEX_MAIN),sd(eI(n),"sourceType",0),n}return qd(r)}(OV),VV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,a))),"streamIndex",gd.STREAM_INDEX_MAIN),sd(eI(n),"sourceType",0),n}return qd(r)}(DV),FV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,a))),"streamIndex",gd.STREAM_INDEX_SCREEN),n}return qd(r)}(OV),BV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,a))),"streamIndex",gd.STREAM_INDEX_SCREEN),n}return qd(r)}(DV),jV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,a))),"streamIndex",gd.STREAM_INDEX_SCREEN),sd(eI(n),"sourceType",0),n}return qd(r)}(OV),GV=function(e){DI(r,e);var t=YI(r);function r(){var e,n;Wd(this,r);for(var i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];return sd(eI(n=t.call.apply(t,xm(e=[this]).call(e,a))),"streamIndex",gd.STREAM_INDEX_SCREEN),sd(eI(n),"sourceType",0),n}return qd(r)}(DV);function HV(e,t){return zV.apply(this,arguments)}function zV(){return(zV=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new LV(t,AC())).dummy=!0,e.next=4,n.generatePreProcessingTrack(r);case 4:return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function KV(e,t){return XV.apply(this,arguments)}function XV(){return(XV=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new FV(t,AC())).dummy=!0,e.next=4,n.generatePreProcessingTrack(r);case 4:return e.abrupt("return",n);case 5:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function qV(e,t){return WV.apply(this,arguments)}function WV(){return(WV=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=1,AV.print("createCameraVideoTrack","constraints:",t),CP.rtcVideoCaptureEvent({event_type:bP.START,media_device_id:a}),o=RC(),PC&&(t.frameRate={ideal:30,max:30}),e.next=8,gV.getUserMedia({video:t});case 8:i=e.sent,CP.rtcVideoCaptureEvent({event_type:bP.START_CAPTURE_RESULT,media_device_id:a,reason:kP.SUCCESS,elapse:RC()-o}),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(1),CP.rtcVideoCaptureEvent({event_type:bP.RUNNING_FAILED,media_device_id:a,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new pR(lR.GET_VIDEO_TRACK_FAILED,xm(s="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(s,e.t0.message||"unknown message","."),e.t0);case 16:return c=i.getVideoTracks()[0],RV.set(c,i),u=new LV(c,AC()),e.next=21,u.generatePreProcessingTrack(r);case 21:return e.abrupt("return",u);case 22:case"end":return e.stop()}}),e,null,[[1,12]])})))).apply(this,arguments)}function YV(e,t){return QV.apply(this,arguments)}function QV(){return(QV=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return AV.print("createMicrophoneAudioTrack","constraints:",t),a=(null==t||null===(n=t.deviceId)||void 0===n?void 0:n.exact)||"default",e.prev=2,CP.rtcVideoCaptureEvent({event_type:bP.START,media_device_id:a}),o=RC(),(s=r.getPluginByName(kV.PRE_PROCESSING,"RTCAIAnsExtension"))&&(s.isOpen()?(t.autoGainControl=!0,t.noiseSuppression=!1):t.noiseSuppression=!0),e.next=9,gV.getUserMedia({audio:t});case 9:i=e.sent,CP.rtcVideoCaptureEvent({event_type:bP.START_CAPTURE_RESULT,media_device_id:a,reason:kP.SUCCESS,elapse:RC()-o}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(2),CP.rtcVideoCaptureEvent({event_type:bP.RUNNING_FAILED,media_device_id:a,error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new pR(lR.GET_AUDIO_TRACK_FAILED,xm(c="throw error from getUserMedia. [".concat(e.t0.name||"unknown name","]: ")).call(c,e.t0.message||"unknown message","."),e.t0);case 17:return u=i.getAudioTracks()[0],RV.set(u,i),d=new MV(u,AC()),e.next=22,d.generatePreProcessingTrack(r);case 22:return e.abrupt("return",d);case 23:case"end":return e.stop()}}),e,null,[[2,13]])})))).apply(this,arguments)}function JV(){return ZV.apply(this,arguments)}function ZV(){return ZV=m_(Im.mark((function e(){var t,r,n,i,a,o,s,c,u,d=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=d.length>0&&void 0!==d[0]&&d[0],r=d.length>1?d[1]:void 0,n=d.length>2?d[2]:void 0,AV.print("createScreenTracks","withAudio: %o, constraints: %o",t,n),e.prev=4,CP.rtcVideoCaptureEvent({event_type:bP.START,media_device_id:"screen"}),a=RC(),e.next=9,navigator.mediaDevices.getDisplayMedia({video:!(n&&(!NC||16!==VC))||n,audio:!!t&&{channelCount:2,noiseSuppression:!1,echoCancellation:!1,autoGainControl:!1}});case 9:i=e.sent,CP.rtcVideoCaptureEvent({event_type:bP.START_CAPTURE_RESULT,media_device_id:"screen",reason:kP.SUCCESS,elapse:RC()-a}),e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(4),CP.rtcVideoCaptureEvent({event_type:bP.RUNNING_FAILED,media_device_id:"screen",error_code:e.t0.code,reason:e.t0.name+e.t0.message}),new pR(lR.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",e.t0);case 17:return o=i.getVideoTracks()[0],s=new FV(o,AC()),e.next=21,s.generatePreProcessingTrack(r);case 21:if(!(c=i.getAudioTracks()[0])){e.next=27;break}return u=new BV(c,AC()),e.next=26,u.generatePreProcessingTrack(r);case 26:return e.abrupt("return",[s,u]);case 27:return e.abrupt("return",[s,void 0]);case 28:case"end":return e.stop()}}),e,null,[[4,13]])}))),ZV.apply(this,arguments)}function $V(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:AC();return new NV(e,t)}function eF(e,t){return tF.apply(this,arguments)}function tF(){return(tF=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new UV(t,AC()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function rF(e,t){return nF.apply(this,arguments)}function nF(){return(nF=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new VV(t,AC()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function iF(e,t){return aF.apply(this,arguments)}function aF(){return(aF=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new jV(t,AC()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function oF(e,t){return sF.apply(this,arguments)}function sF(){return(sF=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new GV(t,AC()),e.next=3,n.generatePreProcessingTrack(r);case 3:return e.abrupt("return",n);case 4:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var cF=DV,uF=function(e){return e[e.NONE=0]="NONE",e}(uF||{}),dF=function(){function e(){Wd(this,e)}return qd(e,null,[{key:"getNalunits",value:function(t){if(t.length-t.position<4)return[];var r=t.position;return 1===t.getInt32(r)||0===t.getInt16(r)&&1===t.getInt8(r+2)?e.getAnnexbNals(t):e.getAvccNals(t)}},{key:"getAnnexbNals",value:function(t){for(var r=[],n=e.getHeaderPositionAnnexB(t),i=n.pos,a=i;i<t.length-4;){var o,s,c=new Uint8Array(km(o=t.buffer).call(o,i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),a=(n=e.getHeaderPositionAnnexB(t)).pos;var u={header:c,body:new Uint8Array(km(s=t.buffer).call(s,i+c.byteLength,a)),type:-1};e.analyseNal(u),u.type<=9&&0!==u.type&&r.push(u),t.skip(a-t.position),i=a}return r}},{key:"getAvccNals",value:function(t){for(var r=[];t.position<t.length-4;){var n=t.getInt32(t.position);if(!(t.length-t.position>=n))break;var i,a,o=new Uint8Array(km(i=t.buffer).call(i,t.position,t.position+4));t.skip(4);var s=new Uint8Array(km(a=t.buffer).call(a,t.position,t.position+n));t.skip(n);var c={header:o,body:s,type:-1};e.analyseNal(c),c.type<=9&&0!==c.type&&r.push(c)}return r}},{key:"analyseNal",value: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}}},{key:"getHeaderPositionAnnexB",value:function(e){for(var t=e.position,r=0,n=e.length;3!==r&&4!==r&&t<n-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===n-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=n:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=n)),{pos:t,headerLength:r}}}]),e}(),lF=function(){function e(t){Wd(this,e),sd(this,"_position",0),sd(this,"_dataview",void 0),this._dataview=new DataView(t)}return qd(e,[{key:"length",get:function(){return this.buffer.byteLength}},{key:"buffer",get:function(){return this._dataview.buffer}},{key:"position",get:function(){return this._position},set:function(e){this._position=e}},{key:"back",value:function(e){this.position-=e}},{key:"getUint8",value:function(e){return this._dataview.getUint8(e)}},{key:"getInt8",value:function(e){return this._dataview.getInt8(e)}},{key:"getInt16",value:function(e){return this._dataview.getInt16(e)}},{key:"getUint16",value:function(e){return this._dataview.getUint16(e)}},{key:"getUint32",value:function(e){return this._dataview.getUint32(e)}},{key:"getInt32",value:function(e){return this._dataview.getInt32(e)}},{key:"skip",value:function(t){for(var r=Math.floor(t/4),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)}},{key:"readUint8",value:function(){return e.readByte(this,1)}},{key:"readUint16",value:function(){return e.readByte(this,2)}},{key:"readUint24",value:function(){return e.readByte(this,3)}},{key:"readUint32",value:function(){return e.readByte(this,4)}},{key:"readUint64",value:function(){return e.readByte(this,8)}},{key:"readInt8",value:function(){return e.readByte(this,1,!0)}},{key:"readInt16",value:function(){return e.readByte(this,2,!0)}},{key:"readInt32",value:function(){return e.readByte(this,4,!0)}},{key:"writeUint32",value:function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])}}],[{key:"readByte",value:function(e,t,r){var n;switch(t){case 1:n=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:n=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");n=e.getUint8(e.position)<<16,n|=e.getUint8(e.position+1)<<8,n|=e.getUint8(e.position+2);break;case 4:n=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");n=e.getUint32(e.position)<<32,n|=e.getUint32(e.position+4);break;default:n=""}return e.position+=t,n}}]),e}(),hF=function(e){return e[e.internal=0]="internal",e[e.external=1]="external",e[e.bypass=2]="bypass",e}(hF||{}),pF=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,85]),fF=new Uint8Array([109,167,53,190,103,90,72,1,170,89,63,164,194,199,19,84]),vF=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]&&t.push(3),t.push(e[r]);return new Uint8Array(t)};function _F(e){for(var t=[];e>=255;)e-=255,t.push(255);return t.push(e),new Uint8Array(t)}function mF(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=0;255===e[t]&&t<e.byteLength;)t++,r+=255;return t<e.byteLength&&(r+=e[t++]),[r,t]}var yF=function(){function e(){Wd(this,e)}return qd(e,null,[{key:"generateSEI",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=new Uint8Array([0,0,0,1]),i=new Uint8Array([6]),a=new Uint8Array([5]),o=r?pF:fF,s=_F(e.byteLength+o.byteLength),c=vF(e);return new Uint8Array(xm(t=[]).call(t,Qk(n),Qk(i),Qk(a),Qk(s),Qk(o),Qk(c),[128]))}},{key:"decodeSeiBody",value:function(e){var t=function(e){for(var t=[],r=0;r<e.length;r++)e[r]<=3&&0===e[r-1]&&0===e[r-2]||t.push(e[r]);return new Uint8Array(t)}(e=km(e).call(e,0,e.length-1));if(!(t.byteLength<2)){var r=0;if(5===t[1]||100===t[1]){var n=$T(mF(t,r+=2),2),i=n[0],a=2,o=(r=n[1])+i;return t.byteLength>=fF.byteLength&&i>=fF.byteLength&&km(t).call(t,r,r+fF.byteLength).toString()===fF.toString()?(r+=fF.byteLength,a=1):t.byteLength>=fF.byteLength&&i>=fF.byteLength&&km(t).call(t,r,r+pF.byteLength).toString()===pF.toString()&&(r+=pF.byteLength,a=0),{type:a,payload:km(t).call(t,r,o)}}}}},{key:"parseInternalSEI",value:function(e){var t=new bE,r=0;if(0===e.type){for(;e.payload.byteLength-r>=2;){var n=$T(mF(e.payload,r),2),i=n[0];r=n[1];var a,o=$T(mF(e.payload,r),2),s=o[0];if(r=o[1],t.get(i)||!(s<=e.payload.byteLength-r))break;t.set(i,km(a=e.payload).call(a,r,r+s)),r+=s}return t}}},{key:"makeInternalSei",value:function(e){var t,r=[],n=ZT(e);try{for(n.s();!(t=n.n()).done;){var i=$T(t.value,2),a=i[0],o=i[1],s=_F(a),c=_F(o.byteLength);r.push(s,c,o)}}catch(l){n.e(l)}finally{n.f()}var u=LE(r).call(r,(function(e,t){return e+t.byteLength}),0),d=new Uint8Array(u);return LE(r).call(r,(function(e,t){return d.set(t,e),e+t.byteLength}),0),d}}]),e}(),gF=function(){function e(t){Wd(this,e),sd(this,"player",void 0),sd(this,"_stream",void 0),sd(this,"_timer",void 0),sd(this,"client",void 0),sd(this,"handler",void 0),sd(this,"monitor",void 0),this._stream=t}return qd(e,[{key:"setVar",value:function(e,t,r){this.client=e,this.handler=t,this.monitor=r}},{key:"delStatsEvtInterval",value:function(){var e;clearTimeout(this._timer),this._timer=void 0,null===(e=this.monitor)||void 0===e||e.rtcInvokeStatus("".concat((new Error).stack),0,"del_media_statistics_timer",this._stream.streamId||"",0)}},{key:"filterIllegal",value:function(e){var t={};return on(e).forEach((function(r){null===e[r]||void 0===e[r]||Number.isNaN(e[r])||(t[r]=e[r])})),t}},{key:"destroy",value:function(){var e;null===(e=this.monitor)||void 0===e||e.rtcInvokeStatus("".concat((new Error).stack),0,"media_statistics_destroy","".concat(this._stream.streamId),0),this.delStatsEvtInterval()}}]),e}(),SF=function(e){DI(i,e);var t,r,n=YI(i);function i(e){var t;return Wd(this,i),sd(eI(t=n.call(this,e)),"_context",void 0),t._stream=e,t}return qd(i,[{key:"setLocalStreamStatsEvtInterval",value:function(e,t,r,n){var i,a,o,s=this;if(!this._timer){this.setVar(e,t,r),this._context=n,e.once(hN.ABNORMAL_DISCONNECTION,(function(){s.destroy()}));var c={audio:{},video:{}},u=this._stream,d=null===(i=u.audioTrack)||void 0===i?void 0:i.getTrack("preprocessing"),l=null===(a=u.videoTrack)||void 0===a?void 0:a.getTrack("preprocessing");this.getAudioStats(d,c,null===(o=u.audioTrack)||void 0===o?void 0:o.getAudioLevel()),this.getVideoStats(l,c),this.delStatsEvtInterval();var h=function(){var e=m_(Im.mark((function e(){var t,r,n,i,a,o,d;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=null===(t=u.audioTrack)||void 0===t?void 0:t.getTrack("preprocessing"),a=null===(r=u.videoTrack)||void 0===r?void 0:r.getTrack("preprocessing"),e.next=4,s.getAudioStats(i,c,null===(n=u.audioTrack)||void 0===n?void 0:n.getAudioLevel());case 4:return o=e.sent,e.next=7,s.getVideoStats(a,c);case 7:return d=e.sent,e.abrupt("return",{audioStats:o,videoStats:d,isScreen:u.isScreen});case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),p=function(){var e=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,h();case 2:r=e.sent,null===(t=s.client)||void 0===t||t.emit("onLocalStreamStats",r),s._timer&&clearTimeout(s._timer),s._timer=setTimeout(p,2e3);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();this._timer&&clearTimeout(this._timer),this._timer=setTimeout(p,2e3)}}},{key:"unpublish",value:function(){this.delStatsEvtInterval()}},{key:"getAudioStats",value:(r=m_(Im.mark((function e(t,r,n){var i,a,o,s,c,u,d,l,h,p,f;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i={},a={timestamp:Date.now()},o=this._stream,s=o.streamId,c=o.audioMid,u=o.isScreen,d=o.pubAttributes,l=o.pubAudio,h={media_type:"audio",is_screen:!!u,direction:"up",stream_id:s,vid:c,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:d.localaudio?"capture_state_on":"capture_state_off",mute_state:l?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",i);case 6:return e.next=8,this.handler.getStats(t);case 8:if((p=e.sent).length){e.next=11;break}return e.abrupt("return",i);case 11:if(p.forEach((function(e){var t=e.type,r=e.packetsSent,n=e.packetsLost,o=e.bytesSent,s=e.clockRate,c=e.roundTripTime,u=e.channels,d=e.audioLevel;e.googRtt;var l=e.mimeType,p=e.availableIncomingBitrate,f=e.availableOutgoingBitrate,v=e.bytesReceived,_=e.nominated,m=e.id,y=e.currentRoundTripTime,g=e.state,S=e.writable,E=e.requestsReceived,b=e.responsesReceived,k=e.requestsSent,T=e.consentRequestsSent,I=e.responsesSent,A=e.jitter,R=e.candidateType,C=e.ip,w=e.address,x=e.networkType,O=e.port,D=e.protocol,P=e.nackCount,N=e.retransmittedBytesSent,M=e.retransmittedPacketsSent,L=e.audioInputLevel,U=e.ssrc,V=e.totalAudioEnergy,F=e.totalSamplesDuration,B=e.mediaType,j=e.fractionLost;"outbound-rtp"===t?(a.packetsSent=r,a.bytesSent=o,h.bytes=o,h.packetsSent=r,h.nackCount=P,h.ssrc=U,h.retransmitted_bytes_sent=N,h.retransmitted_packets_sent=M,a.retransmittedBytesSent=N,a.retransmittedPacketsSent=M):"remote-inbound-rtp"===t?(a.packetsLost=n,h.packetsLost=n,h.net_jitter=1e3*A,i.rtt=1e3*c,h.rtt=i.rtt,i._fractionLost=j||0):"codec"===t?(i.recordSampleRate=s,i.numChannels=u,h.codecName=l):"media-source"===t&&void 0!==d?(h.audio_level=d?-10*YR(Math.pow(d,2)):d,h.volume=255*d,h.total_audio_energy=V,h.totalInputDuration=F):"ssrc"===t&&"audio"===B?h.send_level=L:"candidate-pair"===t?(h.ice_available_incoming_bitrate=p,h.ice_available_outgoing_bitrate=f,h.ice_bytes_received=v,h.ice_bytes_sent=o,h.ice_nominated=+_,h.ice_pair_id=m,h.ice_pair_rtt=y,h.ice_pair_state=g,h.ice_pair_writable=S,h.recv_ping_requests=E,h.recv_ping_responses=b,h.sent_ping_requests_before_first_response=k,h.sent_ping_requests_total=k+(T||0),h.sent_ping_responses=I):"local-candidate"===t?(h.local_candidate_type=R,h.local_ip=C||w,h.local_network_type=x,h.local_port=O,h.protocol=D):"remote-candidate"===t&&(h.remote_candidate_type=R,h.remote_ip=C||w,h.remote_port=O);var G=rN("STATS_SCALLBACK_SUPPORT");DC&&G||"media-source"===t&&(h.send_level=d)})),void 0===h.volume&&void 0!==n&&(h.volume=n,h.audio_level=n?-10*YR(Math.pow(n/255,2)):n),(f=r.audio).timestamp){e.next=17;break}return r.audio=a,e.abrupt("return",this.filterIllegal(i));case 17:return void 0!==a.packetsLost&&(i.audioLossRate=(a.packetsLost-f.packetsLost)/(a.packetsSent-f.packetsSent),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,h.fraction_lost=i.audioLossRate),i.statsInterval=a.timestamp-f.timestamp,h.stats_interval=i.statsInterval,i.sendKBitrate=(a.bytesSent-f.bytesSent||0)/i.statsInterval*8,h.mediaBitratebps=Math.round(1e3*i.sendKBitrate),h.bandwidth=Math.round(h.mediaBitratebps/1024),void 0!==a.retransmittedBytesSent&&(h.retransmitBitratebps=(a.retransmittedBytesSent-f.retransmittedBytesSent||0)/i.statsInterval),r.audio=a,this.monitor.rtcMediaStatistics(h,{}),i._retransmittedRate=(a.retransmittedPacketsSent-f.retransmittedPacketsSent)/(a.packetsSent-f.packetsSent),void 0===i.audioLossRate&&(i.audioLossRate=i._retransmittedRate,h.fraction_lost=i.audioLossRate),i._fractionLost=Math.max(i._fractionLost,i.audioLossRate),e.abrupt("return",this.filterIllegal(i));case 30:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return r.apply(this,arguments)})},{key:"getVideoStats",value:(t=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a={},o={timestamp:Date.now(),simulcast:{}},s=this._stream,c=s.streamId,u=s.videoMid,d=s.isScreen,l=s.pubAttributes,h=s.enableSimulcast,p=s.pubVideo,f={media_type:"video",is_screen:!!d,direction:"up",stream_id:c,vid:u,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,capture_state:l.localvideo?"capture_state_on":"capture_state_off",mute_state:p?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",a);case 6:return f.cap_frame_width=t.getSettings().width,f.cap_frame_height=t.getSettings().height,a.isScreen=d,e.next=11,this.handler.getStats(t);case 11:if((v=e.sent).length){e.next=14;break}return e.abrupt("return",a);case 14:if(null===(n=this.monitor)||void 0===n||n.rtcInvokeStatus(xm(i="reports.length: ".concat(v.length,"; videoTrack: ")).call(i,t.id),0,"get_video_stats",c||"",0),_=0,v.forEach((function(e){var n=e.type,i=e.framesEncoded,s=e.packetsLost,c=e.bytesSent,u=e.framesSent,d=e.retransmittedBytesSent,l=e.totalPacketSendDelay,p=e.totalEncodeTime,v=e.firCount,m=e.targetBitrate,y=e.roundTripTime,g=e.mimeType,S=e.frameWidth,E=e.frameHeight,b=e.packetsSent,k=e.googActualEncBitrate,T=e.googAvailableReceiveBandwidth,I=e.googAvailableSendBandwidth,A=e.googAvgEncodeMs,R=e.googBucketDelay,C=e.googEncodeUsagePercent,w=e.googFrameRateInput,x=e.availableIncomingBitrate,O=e.availableOutgoingBitrate,D=e.bytesReceived,P=e.nominated,N=e.id,M=e.currentRoundTripTime,L=e.state,U=e.writable,V=e.candidateType,F=e.ip,B=e.address,j=e.networkType,G=e.port,H=e.nackCount,z=e.pliCount,K=e.protocol,X=e.qpSum,q=e.requestsReceived,W=e.responsesReceived,Y=e.googRetransmitBitrate,Q=e.requestsSent,J=e.consentRequestsSent,Z=e.responsesSent,$=e.ssrc,ee=e.googTargetEncBitrate,te=e.googTransmitBitrate,re=e.retransmittedPacketsSent,ne=e.encoderImplementation,ie=e.jitter,ae=e.rid,oe=e.fractionLost,se=e.googAdaptationChanges,ce=e.qualityLimitationReason,ue=e.qualityLimitationDurations,de=e.googFirsReceived,le=e.googFrameRateSent,he=e.keyFramesEncoded;"outbound-rtp"===n?(h&&(ae?o.simulcast[ae]=e:o.simulcast[_]=e,_++),o.framesEncoded=i||o.framesEncoded||0,f.key_frames_encoded=he||0,o.bytesSent=c||o.bytesSent||0,o.framesSent=u||o.framesSent||0,f.bytes=c||f.bytes||0,o.packetsSent=b||o.packetsSent||0,f.packetsSent=b||f.packetsSent||0,f.nackCount=H||f.nackCount||0,f.pli_count=z||f.pli_count||0,f.qp_sum=X||f.qp_sum||0,f.ssrc=$||f.ssrc||0,f.retransmitted_packets_sent=re,o.retransmittedPacketsSent=re,o.retransmittedBytesSent=d,f.encoder_implementation=ne,f.qualityLimitationReason=ce,f.qualityLimitationDurations=ue,void 0!==S&&((!a.encodedFrameWidth||S>a.encodedFrameWidth)&&(a.encodedFrameWidth=S),(!a.encodedFrameHeight||E>a.encodedFrameHeight)&&(a.encodedFrameHeight=E),f.frame_size_height=E,f.frame_size_width=S)):"track"===n?(a.encodedFrameWidth=S,a.encodedFrameHeight=E,f.frame_size_height=E,f.frame_size_width=S):"remote-inbound-rtp"===n?(o.packetsLost=s,a.rtt=1e3*y,f.rtt=a.rtt,f.jitter=ie,f.packetsLost=s,a._fractionLost=oe||0):"codec"===n?(a.codecType=g,f.codecName=g):"candidate-pair"===n?(f.ice_available_incoming_bitrate=x,f.ice_available_outgoing_bitrate=O,f.ice_bytes_received=D,f.ice_bytes_sent=c,f.ice_nominated=+P,f.ice_pair_id=N,f.ice_pair_rtt=M,f.ice_pair_state=L,f.ice_pair_writable=U,f.recv_ping_requests=q,f.recv_ping_responses=W,f.sent_ping_requests_before_first_response=Q,f.sent_ping_requests_total=Q+J,f.sent_ping_responses=Z):"local-candidate"===n?(f.local_candidate_type=V,f.local_ip=F||B,f.local_network_type=j,f.local_port=G,f.protocol=K):"remote-candidate"===n?(f.remote_candidate_type=V,f.remote_ip=F||B,f.remote_port=G):"VideoBwe"===n?(f.encBitratebps=k,f.available_receive_bandwidth=T,f.available_send_bandwidth=I,f.bucket_delay=R,f.retransmitBitratebps=Y,f.targetEncBitratebps=ee,f.transmit_bitrate=te,a._sendBandWidth=+I):"ssrc"===n&&(f.avg_encode_ms=A,f.encodeUsage=C,f.frame_rate_input=w,f.orignal_input_Framerate=+w,f.ddaptationChanges=se,f.firsReceived=de,f.frameRateSent=le);var pe=rN("STATS_SCALLBACK_SUPPORT");if(!DC||!pe){var fe=r.video,ve=o.timestamp-fe.timestamp;if("outbound-rtp"===n){var _e=c-fe.bytesSent,me=d-fe.retransmittedBytesSent;f.encBitratebps=Math.round(8e3*(_e-me)/ve),f.bucket_delay=l/b,f.retransmitBitratebps=Math.round(8e3*me/ve),f.targetEncBitratebps=m,f.transmit_bitrate=Math.round(1e3*(c-fe.bytesSent)*8/ve),f.avg_encode_ms=1e3*p/i,f.firsReceived=v+z}else"candidate-pair"===n&&(f.available_send_bandwidth=O,a._sendBandWidth=O);if(t){var ye=null==t?void 0:t.getSettings().frameRate;f.orignal_input_Framerate=ye,f.frameRateSent=t.getSettings().frameRate}}})),(m=r.video).timestamp){e.next=21;break}return r.video=o,e.abrupt("return",this.filterIllegal(a));case 21:return a.statsInterval=o.timestamp-m.timestamp,f.stats_interval=a.statsInterval,y=on(o.simulcast),h?(f.sim_enc_width=[],f.sim_enc_height=[],f.sim_enc_bps=[],f.sim_enc_framerate=[],f.sim_enc_key_frames=[],f.sim_rids=[],f.sim_enc_bandwidth=[],f.sim_sent_framerate=[],f.sim_fraction_lost=[],f.sim_keyencoded=[],f.active_sim_streams=(null===(g=this._context)||void 0===g?void 0:g.activeSimStreams)||[],f.sim_retransmittedRate=[],S=!1,BA(y).call(y,(function(e,t){return+e-+t})).forEach((function(e){var t=o.simulcast[e],r=t.frameWidth,n=t.frameHeight,i=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,d=t.packetsSent,l=t.qualityLimitationReason,h=t.qualityLimitationDurations,p=t.qualityLimitationResolutionChanges,v=t.retransmittedPacketsSent,_=t.pliCount,y=t.keyFramesEncoded;void 0!==l&&(f.sim_qualityLimitationReason||(f.sim_qualityLimitationReason=[],f.sim_qualityLimitationDurations=[],f.sim_qualityLimitationResolutionChanges=[]),f.sim_qualityLimitationReason.push(l),f.sim_qualityLimitationDurations.push(h),f.sim_qualityLimitationResolutionChanges.push(p));var g=m.simulcast[e];if(f.sim_enc_width.push(r||0),f.sim_enc_height.push(n||0),f.sim_enc_key_frames.push(y||0),g){var E=(i-g.bytesSent||0)/a.statsInterval;f.sim_enc_bps.push(Math.round(8e3*E)),f.sim_enc_bandwidth.push(Math.round(8e3*E/1024));var b=1e3*(s-g.framesEncoded)/a.statsInterval;f.sim_enc_framerate.push(Math.round(b)),f.sim_rids.push(e);var k=void 0!==c?c-g.framesSent:s-g.framesEncoded,T=1e3*k/a.statsInterval;f.sim_sent_framerate.push(Math.round(T));var I=(u-g.packetsLost)/(d-g.packetsSent);a._retransmittedRate=(v-g.retransmittedPacketsSent)/(d-g.packetsSent),I=Number.isNaN(I)?0:I,f.sim_fraction_lost.push(I),f.sim_keyencoded.push(_-g.pliCount>0),f.sim_retransmittedRate.push(a._retransmittedRate),r>0&&!S&&(a.sentKBitrate=8*E,a.encoderOutputFrameRate=b,a.encodedFrameCount=k,a.sentFrameRate=T,a.videoLossRate=I,S=!0)}})),this.monitor.rtcMediaStatistics(f,{})):(a.encodedFrameCount=void 0!==o.framesSent?o.framesSent-m.framesSent:o.framesEncoded-m.framesEncoded,a.sentKBitrate=(o.bytesSent-m.bytesSent||0)/a.statsInterval*8,f.bitrate=Math.round(1e3*a.sentKBitrate),f.bandwidth=Math.round(f.bitrate/1024),a.encoderOutputFrameRate=1e3*(o.framesEncoded-m.framesEncoded)/a.statsInterval,f.frame_rate_encoded=Math.round(a.encoderOutputFrameRate),a.sentFrameRate=1e3*a.encodedFrameCount/a.statsInterval,f.frame_rate_sent=Math.round(a.sentFrameRate),a.videoLossRate=(o.packetsLost-m.packetsLost)/(o.packetsSent-m.packetsSent),a.videoLossRate=Number.isNaN(a.videoLossRate)?0:a.videoLossRate,f.fraction_lost=a.videoLossRate,a._retransmittedRate=(o.retransmittedPacketsSent-m.retransmittedPacketsSent)/(o.packetsSent-m.packetsSent),this.monitor.rtcMediaStatistics(f,{})),r.video=o,a._fractionLost=Math.max(a._fractionLost,a.videoLossRate),e.abrupt("return",this.filterIllegal(a));case 28:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})}]),i}(gF),EF=function(e){DI(a,e);var t,r,n,i=YI(a);function a(e){var t;return Wd(this,a),sd(eI(t=i.call(this,e)),"isPaused",void 0),sd(eI(t),"pauseStart",void 0),sd(eI(t),"pauseDuration",void 0),sd(eI(t),"_audioStallCount",void 0),sd(eI(t),"_setAudioStallCount",void 0),sd(eI(t),"_audioStallTimer",void 0),sd(eI(t),"_audioStallInterval",void 0),sd(eI(t),"_audioStallRatio",void 0),sd(eI(t),"_videoInWaiting",void 0),sd(eI(t),"_context",void 0),t._videoInWaiting=!1,t.pauseDuration=0,t}return qd(a,[{key:"setRemoteStreamStatsEvtInterval",value:(n=m_(Im.mark((function e(t,r,n,i){var o,s,c,u,d,l,h,p,f,v,_,m,y,g,S=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._timer){e.next=2;break}return e.abrupt("return");case 2:return this.setVar(t,r,n),this._context=i,t.once(hN.ABNORMAL_DISCONNECTION,(function(){S.destroy()})),this._audioStallInterval=a.audioStallInterval||100,this._audioStallRatio=a.audioStallRatio||.6,c={audio:{},video:{}},u=this._stream,d=null===(o=u.audioTrack)||void 0===o?void 0:o.getTrack(),l=null===(s=u.videoTrack)||void 0===s?void 0:s.getTrack(),this.getRemoteVideoStats(l,c),e.next=14,this.getRemoteAudioStats(d,c);case 14:this.delStatsEvtInterval(),h=0,p=0,v=[],_=0,m=RC(),this._setAudioStallCount=function(){if(eN.AUDIO_STALL&&S._audioStallInterval>0&&void 0!==c.audio.concealedSamples){var e=c.audio.concealedSamples,t=c.audio.totalSamplesReceived;m=RC();var r={isStall:!1,counted:!1,diff:0},n=.5*S._audioStallInterval;S._audioStallCount=m_(Im.mark((function i(){var a,o,s,c,d,l,f,y,g,E,b,k,T,I,A,R,C;return Im.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(o=u.hasAudio,s=u.subAudio,o&&s){i.next=7;break}return r.isStall=!1,r.counted=!1,v.push({reason:xm(c="hasAudio: ".concat(o,", subAudio: ")).call(c,s)}),m=RC(),i.abrupt("return",{stall_count:h,stall_duration:p,stall_list:v,stats_count:_});case 7:return d=null===(a=u.audioTrack)||void 0===a?void 0:a.getTrack(),l=Date.now(),i.next=11,S.handler.getStats(d,!0);case 11:if(f=i.sent,y=Date.now(),g=RC(),!((E=g-m)<n)){i.next=18;break}return v.push({diff:E,start:m,end:g,get_stats_cost:y-l,get_stats_start:l,get_stats_end:y,reason:xm(b="diff(".concat(E,") < minInterval(")).call(b,n,")")}),i.abrupt("return",{stall_count:h,stall_duration:p,stall_list:v,stats_count:_});case 18:if(k=f.length,T=Nb(f).call(f,(function(e){return"inbound-rtp"===e.type}))){i.next=23;break}return v.push({diff:E,start:m,end:g,get_stats_cost:y-l,get_stats_start:l,get_stats_end:y,reason:k?"no inbound-rtp":"no report"}),i.abrupt("return",{stall_count:h,stall_duration:p,stall_list:v,stats_count:_});case 23:return I=T.concealedSamples,A=T.totalSamplesReceived,C=A-t,(R=I-e)>=0&&C>=0&&R>=S._audioStallRatio*C?(v.push({concealed:R,received:C,diff:E,start:m,end:g,get_stats_cost:y-l,get_stats_start:l,get_stats_end:y,is_stall:!0}),r.isStall?(r.counted?p+=E:(p=p+r.diff+E,h++),r.counted=!0):E>=200?(p+=E,h++,r.counted=!0):(r.counted=!1,r.diff=E),r.isStall=!0):(v.push({concealed:R,received:C,diff:E,start:m,end:g,get_stats_cost:y-l,get_stats_start:l,get_stats_end:y}),r.isStall=!1,r.counted=!1),e=I,t=A,m=g,_++,i.abrupt("return",{stall_count:h,stall_duration:p,stall_list:v,stats_count:_});case 32:case"end":return i.stop()}}),i)}))),f=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!S._audioStallCount&&S._setAudioStallCount&&S._setAudioStallCount(),!S._audioStallCount){e.next=6;break}return e.next=4,S._audioStallCount();case 4:S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(f,S._audioStallInterval);case 6:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(f,S._audioStallInterval)}},this._setAudioStallCount(),y=function(){var e=m_(Im.mark((function e(){var t,r,n,i,a,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=null===(t=u.audioTrack)||void 0===t?void 0:t.getTrack(),i=null===(r=u.videoTrack)||void 0===r?void 0:r.getTrack(),e.next=4,S.getRemoteAudioStats(n,c);case 4:return a=e.sent,h=0,p=0,v=[],_=0,e.next=11,S.getRemoteVideoStats(i,c);case 11:return o=e.sent,e.abrupt("return",{audioStats:a,videoStats:o,isScreen:u.isScreen,userId:u.userId});case 13:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),g=function(){var e=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y();case 2:r=e.sent,null===(t=S.client)||void 0===t||t.emit("onRemoteStreamStats",r),f&&(m=RC(),S._audioStallTimer&&clearTimeout(S._audioStallTimer),S._audioStallTimer=setTimeout(f,S._audioStallInterval)),S._timer&&clearTimeout(S._timer),S._timer=setTimeout(g,2e3);case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),this._timer&&clearTimeout(this._timer),this._timer=setTimeout(g,2e3);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r,i){return n.apply(this,arguments)})},{key:"delStatsEvtInterval",value:function(){xI(CI(a.prototype),"delStatsEvtInterval",this).call(this),clearTimeout(this._audioStallTimer),this._audioStallCount=void 0,this._setAudioStallCount=void 0,this.pauseDuration=0}},{key:"unsubscribe",value:function(){this.delStatsEvtInterval(),this._videoInWaiting=!1}},{key:"getRemoteAudioStats",value:(r=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n={},i={},a=this._stream,o=a.streamId,s=a.userId,c=a.isScreen,u=a.audioMid,d=a.subMediaType,l=a._attributes,h=a.virtual,p={media_type:"audio",is_screen:!!c,direction:"down",stream_id:o,stream_user_id:s,vid:u,audio_mux:h,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:ZC(d)?"mute_state_off":"mute_state_on",remote_user_capture_state:l.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:l.localaudio&&l.audiostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",n);case 6:return e.next=8,this.handler.getStats(t);case 8:if((f=e.sent).length){e.next=11;break}return e.abrupt("return",n);case 11:if(f.forEach((function(e){var t=e.type,r=e.packetsLost,a=e.packetsReceived,s=e.bytesReceived,c=e.jitterBufferDelay,u=e.jitterBufferEmittedCount,d=e.clockRate,l=e.channels,h=e.totalSamplesReceived,f=e.concealedSamples,v=e.silentConcealedSamples,_=e.concealmentEvents,m=e.totalRoundTripTime,y=e.packetsDiscarded,g=e.state,S=e.currentRoundTripTime,E=e.audioLevel,k=e.totalAudioEnergy,T=e.totalSamplesDuration,I=e.mimeType,A=e.googDecodingNormal,R=e.googDecodingMuted,C=e.availableIncomingBitrate,w=e.availableOutgoingBitrate,x=e.bytesSent,O=e.nominated,D=e.id,P=e.writable,N=e.jitter,M=e.candidateType,L=e.ip,U=e.address,V=e.networkType,F=e.port,B=e.protocol,j=e.audioOutputLevel,G=e.requestsReceived,H=e.responsesReceived,z=e.requestsSent,K=e.consentRequestsSent,X=e.responsesSent,q=e.ssrc;e.kind;var W=e.nackCount,Y=e.lastPacketReceivedTimestamp,Q=e.concealmentevents,J=e.fecPacketsReceived;if("inbound-rtp"===t)i.packetsLost=r,i.packetsReceived=a,p.packetsReceived=a,p.packetsDiscarded=y,p.nackCount=W,p.lastPacketReceivedTimestamp=Y,p.concealmentevents=Q,i.bytesReceived=s,void 0!==c&&(n.jitterBufferDelay=c/u*1e3,p.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==h&&(i.totalSamplesReceived=h,n.concealedSamples=f,i.concealedSamples=f,i.silentConcealedSamples=v,p.concealedSamples=f,n.concealmentEvents=_,p.totalSamplesReceived=h),void 0!==J&&(p.fec_packets_received=J,i.fecPacketsReceived=J),p.jitter=1e3*N,p.ssrc=q,void 0!==E&&(p.audio_level=E?-10*YR(Math.pow(E,2)):E),void 0!==E&&(p.volume=255*E),void 0!==k&&(p.total_audio_energy=k),void 0!==T&&(p.totalAudioDuration=T);else if("codec"===t)n.recordSampleRate=d,l&&(n.numChannels=l),p.codecName=I;else if("candidate-pair"===t){var Z,$,ee;p.ice_available_incoming_bitrate=C,p.ice_available_outgoing_bitrate=w,p.ice_bytes_received=s,p.ice_bytes_sent=x,p.ice_nominated=+O,p.ice_pair_id=D,p.ice_pair_rtt=S,p.rtt=1e3*S,p.rtt&&null!==(Z=b._context)&&void 0!==Z&&null!==($=Z.streamRTT)&&void 0!==$&&null!==(ee=$[o])&&void 0!==ee&&ee.audio&&(p.total_rtt_ms=p.rtt+b._context.streamRTT[o].audio),p.ice_pair_state=g,p.ice_pair_writable=P,p.recv_ping_requests=G,p.recv_ping_responses=H,p.sent_ping_requests_before_first_response=z,p.sent_ping_requests_total=z+(K||0),p.sent_ping_responses=X,"succeeded"===g&&(n.rtt=1e3*S,n.total_rtt=1e3*m)}else"track"===t&&void 0!==E?(p.audio_level=E?-10*YR(Math.pow(E,2)):E,p.volume=255*E,p.total_audio_energy=k,p.totalAudioDuration=T):"ssrc"===t?(p.decodingNormal=A,p.recvAudioLevel=j,p.decodingMuted=R):"local-candidate"===t?(p.local_candidate_type=M,p.local_ip=L||U,p.local_network_type=V,p.local_port=F,p.protocol=B):"remote-candidate"===t&&(p.remote_candidate_type=M,p.remote_ip=L||U,p.remote_port=F)})),(v=r.audio).timestamp){e.next=17;break}return i.timestamp=Date.now(),r.audio=i,e.abrupt("return",this.filterIllegal(n));case 17:if(_={},void 0!==i.concealedSamples&&(p.interval_concealed_samples=i.concealedSamples-v.concealedSamples,p.interval_samples_received=i.totalSamplesReceived-v.totalSamplesReceived,p.interval_silent_concealed_samples=i.silentConcealedSamples-v.silentConcealedSamples),!(this._audioStallInterval>0&&void 0!==v.concealedSamples)){e.next=35;break}if(!this._audioStallCount&&this._setAudioStallCount&&this._setAudioStallCount(),clearTimeout(this._audioStallTimer),!this._audioStallCount){e.next=35;break}return e.next=25,this._audioStallCount();case 25:m=e.sent,y=m.stall_count,g=m.stall_duration,S=m.stall_list,E=m.stats_count,_.stall_list=S,_.stats_count=E,p.concealedSamples===p.interval_concealed_samples&&p.totalSamplesReceived===p.interval_samples_received?(p.stall_count=0,p.stall_duration=0):(p.stall_count=y,p.stall_duration=g),n.stallCount=p.stall_count,n.stallDuration=p.stall_duration;case 35:return i.timestamp=Date.now(),n.audioLossRate=(i.packetsLost-v.packetsLost)/(i.packetsReceived-v.packetsReceived+(i.packetsLost-v.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,p.packetsLost=Math.round(i.packetsLost-v.packetsLost),p.fraction_lost=n.audioLossRate,n.statsInterval=i.timestamp-v.timestamp,p.stats_interval=n.statsInterval,n.receivedKBitrate=(i.bytesReceived-v.bytesReceived||0)/n.statsInterval*8,p.bandwidth=Math.round(1e3*n.receivedKBitrate/1024),void 0!==i.concealedSamples&&(n.receivedSampleRate=1e3*p.interval_samples_received/n.statsInterval),void 0!==i.fecPacketsReceived&&(p.fecBitratebps=(i.fecPacketsReceived-v.fecPacketsReceived||0)/n.statsInterval),p.average_jitter_buffer_delay_ms&&p.total_rtt_ms&&(n.e2eDelay=p.average_jitter_buffer_delay_ms+p.total_rtt_ms),r.audio=i,this.monitor.rtcMediaStatistics(p,{},_),e.abrupt("return",this.filterIllegal(n));case 50:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"getRemoteVideoStats",value:(t=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h,p,f,v,_,m=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a={},o={timestamp:Date.now()},s=this._stream,c=s.streamId,u=s.userId,d=s.isScreen,l=s.subMediaType,h=s._attributes,p={media_type:"video",is_screen:!!d,direction:"down",stream_id:c,stream_user_id:u,vid:this._stream.videoMid,connection_status:navigator.onLine,track_enabled:null==t?void 0:t.enabled,mute_state:$C(l)?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localvideo&&h.videostream?"mute_state_off":"mute_state_on"},t&&this.handler){e.next=6;break}return e.abrupt("return",a);case 6:return a.isScreen=d,e.next=9,this.handler.getStats(t);case 9:if(f=e.sent,null===(n=this.monitor)||void 0===n||n.rtcInvokeStatus(xm(i="reports.length: ".concat(f.length,"; videoTrack: ")).call(i,t.id),0,"get_remote_video_stats",c,0),f.length){e.next=13;break}return e.abrupt("return",a);case 13:if(f.forEach((function(e){var t=e.type,r=e.frameHeight,n=e.frameWidth,i=e.packetsLost,s=e.packetsReceived,u=e.bytesReceived,d=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,f=e.mimeType,v=e.firCount,_=e.availableIncomingBitrate,y=e.availableOutgoingBitrate,g=e.bytesSent,S=e.nominated,E=e.id,b=e.currentRoundTripTime,k=e.state,T=e.writable,I=e.candidateType,A=e.ip,R=e.address,C=e.networkType,w=e.port,x=e.nackCount,O=e.pliCount,D=e.protocol,P=e.requestsReceived,N=e.responsesReceived,M=e.requestsSent,L=e.consentRequestsSent,U=e.responsesSent,V=e.ssrc,F=e.jitter,B=e.framesReceived,j=e.keyFramesDecoded,G=e.totalDecodeTime,H=e.decoderImplementation,z=e.lastPacketReceivedTimestamp;if("inbound-rtp"===t)o.packetsLost=i,p.packetsLost=i,o.packetsReceived=s,p.packetsReceived=s,o.bytesReceived=u,p.bytes=u,o.framesDecoded=d,o.totalDecodeTime=G,void 0!==l&&(o.jitterBufferDelay=l/h*1e3,p.average_jitter_buffer_delay_ms=o.jitterBufferDelay),p.fir_count=v,p.nackCount=x,o.nackCount=x,p.pli_count=O,p.ssrc=V,p.jitter=F,p.framesReceived=B,o.framesReceived=B,p.framesDecoded=d,p.key_frames_decoded=j,p.decoder_name=H,p.last_packet_received_timestamp=z,void 0!==n&&(a.width=n,p.frame_size_width=n,a.height=r,p.frame_size_height=r);else if("track"===t&&void 0!==n)a.width=n,p.frame_size_width=n,a.height=r,p.frame_size_height=r,void 0!==B&&(p.framesReceived=B,o.framesReceived=B);else if("codec"===t)p.codecName=f;else if("candidate-pair"===t){var K,X,q;p.ice_available_incoming_bitrate=_,p.ice_available_outgoing_bitrate=y,p.ice_bytes_received=u,p.ice_bytes_sent=g,p.ice_nominated=+S,p.ice_pair_id=E,p.ice_pair_rtt=b,p.rtt=1e3*b,p.rtt&&null!==(K=m._context)&&void 0!==K&&null!==(X=K.streamRTT)&&void 0!==X&&null!==(q=X[c])&&void 0!==q&&q.video&&(p.total_rtt_ms=p.rtt+m._context.streamRTT[c].video),a.rtt=p.rtt,p.ice_pair_state=k,p.ice_pair_writable=T,p.recv_ping_requests=P,p.recv_ping_responses=N,p.sent_ping_requests_before_first_response=M,p.sent_ping_requests_total=M+(L||0),p.sent_ping_responses=U}else"local-candidate"===t?(p.local_candidate_type=I,p.local_ip=A||R,p.local_network_type=C,p.local_port=w,p.protocol=D):"remote-candidate"===t&&(p.remote_candidate_type=I,p.remote_ip=A||R,p.remote_port=w)})),(v=r.video).timestamp){e.next=18;break}return r.video=o,e.abrupt("return",this.filterIllegal(a));case 18:return a.videoLossRate=(o.packetsLost-v.packetsLost)/(o.packetsReceived-v.packetsReceived+(o.packetsLost-v.packetsLost)),v.totalDecodeTime&&v.framesDecoded&&o.framesDecoded!==v.framesDecoded&&(p.decode_elapse_per_frame=+((o.totalDecodeTime-v.totalDecodeTime)/(o.framesDecoded-v.framesDecoded)*1e3).toFixed(2)),a._retransmittedRate=(o.nackCount-v.nackCount)/(o.packetsReceived-v.packetsReceived+(o.packetsLost-v.packetsLost)),a.videoLossRate=Number.isNaN(a.videoLossRate)?0:a.videoLossRate,p.fraction_lost=a.videoLossRate,a.statsInterval=o.timestamp-v.timestamp,p.stats_interval=a.statsInterval,a.receivedKBitrate=(o.bytesReceived-v.bytesReceived||0)/a.statsInterval*8,p.bitrate=Math.round(1e3*a.receivedKBitrate),p.bandwidth=Math.round(p.bitrate/1024),a.decoderOutputFrameRate=1e3*(o.framesDecoded-v.framesDecoded)/a.statsInterval,a.receivedFrameRate=1e3*(o.framesReceived-v.framesReceived)/a.statsInterval,p.frame_rate_decoded=Math.round(a.decoderOutputFrameRate),p.frame_rate_received=Math.round(a.receivedFrameRate),p.average_jitter_buffer_delay_ms&&p.total_rtt_ms&&(a.e2eDelay=p.average_jitter_buffer_delay_ms+p.total_rtt_ms),r.video=o,this.processStall(this._stream,p,a,d),this.isPaused?(_=o.timestamp-(this.pauseStart||0),p.pause_duration=this.pauseDuration+(_>500?_:0),this.pauseStart=o.timestamp):p.pause_duration=this.pauseDuration,p.pause_duration=Math.min(p.stall_duration||p.stuck_length||0,p.pause_duration),this.pauseDuration=0,this.monitor.rtcMediaStatistics(p,{}),e.abrupt("return",this.filterIllegal(a));case 40:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"processStall",value:function(e,t,r,n){var i=0,a=0,o=0;if(e.recordedVideoFrames&&this.player&&this.player.played){e.recordedVideoFrames.forEach((function(e){e.isStall&&(i+=e.stallCount,a+=e.stallDuration),o=e.playTime})),e.recordedVideoFrames.length||(a=2e3,i=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=i,n?(t.stuck_length=Math.min(a,t.stats_interval),t.stall_duration=void 0):(t.stall_duration=Math.min(a,t.stats_interval),t.stuck_length=void 0),t.play_time=o,r.stallCount=i,r.stallDuration=a}},{key:"destroy",value:function(){xI(CI(a.prototype),"destroy",this).call(this),this.delStatsEvtInterval(),this._videoInWaiting=!1}}],[{key:"audioStallConfig",set:function(e){a.audioStallInterval=((null==e?void 0:e.audio_stall_interval)||200)/2,a.audioStallRatio=null==e?void 0:e.audio_stall_ratio}}]),a}(gF);sd(EF,"audioStallInterval",void 0),sd(EF,"audioStallRatio",void 0);var bF,kF,TF=new Jw("Stream",0),IF=function(e){return e[e.INIT=0]="INIT",e[e.SUB_ING=1]="SUB_ING",e[e.SUB_ED=2]="SUB_ED",e}(IF||{}),AF=function(){function e(){Wd(this,e),sd(this,"isScreen",!1),sd(this,"stream",void 0),sd(this,"streamId",void 0),sd(this,"audioMid",void 0),sd(this,"videoMid",void 0),sd(this,"seiList",[]),sd(this,"videoTrack",void 0),sd(this,"audioTrack",void 0),sd(this,"videoTransceiver",void 0),sd(this,"audioTransceiver",void 0),sd(this,"videoEncodeConfig",[iN]),sd(this,"subVideoDescriptions",[]),sd(this,"enableSimulcast",!1),sd(this,"observer",void 0),sd(this,"statsReport",void 0),sd(this,"prevBitrate",0),sd(this,"pubAudio",!1),sd(this,"pubVideo",!1),sd(this,"pubAttributes",void 0),this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1},this.statsReport=new SF(this)}return qd(e,[{key:"audioHasCapture",get:function(){return this.pubAttributes.localaudio}},{key:"audioHasPublish",get:function(){return this.pubAttributes.audiostream}},{key:"videoHasCapture",get:function(){return this.pubAttributes.localvideo}},{key:"videoHasPublish",get:function(){return this.pubAttributes.videostream}},{key:"hasPublished",get:function(){return this.audioMid&&this.videoMid}},{key:"isEmptyStream",get:function(){return!this.audioTrack&&!this.videoTrack}},{key:"initStreamId",get:function(){return this.stream.id}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(HL()){var r=t.createEncodedStreams(),n=r.readable,i=r.writable,a=new TransformStream({transform:function(t,r){var n=e.seiList[0];if(n){var i,a=yF.generateSEI(n.content),o=new Uint8Array(a.byteLength+t.data.byteLength);if(0===n.repeatCount)mk(i=e.seiList).call(i,0,1);n.repeatCount--,o.set(new Uint8Array(t.data)),o.set(a,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(a).pipeTo(i)}}else TF.print("no sender found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else TF.print("no sender found when trying to bind encodedTransform")}},{key:"clean",value:function(){var e;CP.rtcInvokeStatus("".concat((new Error).stack),0,"localstream_clean",this.streamId||"",0),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.prevBitrate=0,this.subVideoDescriptions=[]}},{key:"switchTrackEnableState",value:function(e,t){var r,n;"audio"===e?n=this.audioTrack:"video"===e&&(n=this.videoTrack);var i=null===(r=n)||void 0===r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)}}]),e}(),RF=function(e){DI(r,e);var t=YI(r);function r(e,n,i,a){var o;return Wd(this,r),sd(eI(o=t.call(this)),"streamId",void 0),sd(eI(o),"userId",void 0),sd(eI(o),"isScreen",void 0),sd(eI(o),"hasVideo",void 0),sd(eI(o),"hasAudio",void 0),sd(eI(o),"_attributes",void 0),sd(eI(o),"streamState",void 0),sd(eI(o),"observer",void 0),sd(eI(o),"statsReport",void 0),sd(eI(o),"subVideo",void 0),sd(eI(o),"subAudio",void 0),sd(eI(o),"subMediaType",void 0),sd(eI(o),"subLayer",void 0),sd(eI(o),"audioMid",void 0),sd(eI(o),"videoMid",void 0),sd(eI(o),"_sequenceId",void 0),sd(eI(o),"stream",void 0),sd(eI(o),"videoTrack",void 0),sd(eI(o),"audioTrack",void 0),sd(eI(o),"videoTransceiver",void 0),sd(eI(o),"audioTransceiver",void 0),sd(eI(o),"recordedVideoFrames",void 0),sd(eI(o),"stillExist",void 0),sd(eI(o),"originalMediaType",void 0),sd(eI(o),"originalStreamIndex",0),sd(eI(o),"virtual",void 0),o.virtual=!1,o.userId=e,o.isScreen=i,o.streamId=n,o.hasAudio=a.audiostream&&a.localaudio,o.hasVideo=a.videostream&&a.localvideo,o._attributes=a,o.subVideo=!1,o.subAudio=!1,o._sequenceId=0,o.subMediaType=uF.NONE,o.subLayer={spatialLayer:0,spatialSubLayer:-1},o.streamState=0,o.statsReport=new EF(eI(o)),o}return qd(r,[{key:"audioHasCapture",get:function(){return this._attributes.localaudio}},{key:"audioHasPublish",get:function(){return this._attributes.audiostream}},{key:"videoHasCapture",get:function(){return this._attributes.localvideo}},{key:"videoHasPublish",get:function(){return this._attributes.videostream}},{key:"sequenceId",get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)}},{key:"hasSubscribed",get:function(){return 2===this.streamState}},{key:"attributes",get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo&&e.videostream,this.hasAudio=e.localaudio&&e.audiostream,this._attributes=e}},{key:"initVideoEncodedTransform",value:function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,n=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){dF.getNalunits(new lF(t.data)).forEach((function(t){if(t.sei){var r=yF.decodeSeiBody(t.body);r&&r.type!==hF.internal&&e.safeEmit("onSEIMessage",r.payload)}})),r.enqueue(t)}})).pipeTo(n)}else TF.print("no receiver found when trying to bind encodedTransform")}},{key:"initAudioEncodedTransform",value:function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else TF.print("no receiver found when trying to bind encodedTransform")}},{key:"ontrack",value:function(e){var t,r,n,i,a,o;try{var s;CP.rtcInvokeStatus(ny({uid:this.userId,streamId:this.streamId,streams:LE(s=e.streams).call(s,(function(e,t){return e+(null==(r=t)?"undefined | null":"string"==typeof r?r:ny({id:r.id,active:r.active}));var r}),""),transceiver:(i=e.transceiver,null==i?"undefined | null":"string"==typeof i?i:ny({currentDirection:i.currentDirection,direction:i.direction,mid:i.mid,stopped:i.stopped,receiver:(o=i.receiver,null==o?"undefined | null":"string"==typeof o?o:ny({track:rw(o.track)})),sender:(a=i.sender,null==a?"undefined | null":"string"==typeof a?a:ny({track:rw(a.track)}))})),track:rw(e.track)}),0,"Stream.ontrack","",0)}catch(PX){}if(null!==(t=e.streams)&&void 0!==t&&null!==(r=t[0])&&void 0!==r&&null!==(n=r.id)&&void 0!==n&&$m(n).call(n,this.streamId)){var c,u=e.track;"video"===(null==u?void 0:u.kind)?this._setVideoTrack(u):"audio"===(null===(c=e.track)||void 0===c?void 0:c.kind)&&this._setAudioTrack(u),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)}},{key:"clean",value:function(){var e,t;TF.print("clean",xm(e="exec stream.clean ".concat(this.streamId," ")).call(e,this.userId)),CP.rtcInvokeStatus("".concat((new Error).stack),0,"remotestream_clean",this.streamId,0),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,null===(t=this.observer)||void 0===t||t.reset(),this.statsReport.destroy()}},{key:"resetHasSubscribed",value:function(){this.streamState=0}},{key:"_setStream",value: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)}}},{key:"_setAudioTrack",value:function(e){var t,r;(null===(t=this.audioTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=$V(e),this.emit("ontrack",this.audioTrack))}},{key:"_setVideoTrack",value:function(e){var t,r;(null===(t=this.videoTrack)||void 0===t||null===(r=t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:AC();return new PV(e,t)}(e),this.emit("ontrack",this.videoTrack))}},{key:"_getSubLayerBySpatialLayer",value:function(e){var t=this._attributes,r=t.videoDescriptions,n=t.subVideoDescriptions,i=void 0===n?[]:n,a=r[e],o=a.width,s=a.height,c=Nb(i).call(i,(function(e){return e.width===o&&e.height===s}));return{spatialLayer:e,spatialSubLayer:(null==c?void 0:c.sub_index)||-1}}}]),r}(ex),CF=new Jw("queue",4),wF=function(e){return e[e.ADD=0]="ADD",e[e.CLOSE=1]="CLOSE",e}(wF||{}),xF=function(e){return e.publish="publish",e.unpublish="unpublish",e.subscribe="subscribe",e.unsubscribe="unsubscribe",e.pushtrack="pushtrack",e.removetrack="removetrack",e}(xF||{}),OF=(sd(bF={},"publish","unpublish"),sd(bF,"subscribe","unsubscribe"),sd(bF,"pushtrack","removetrack"),bF),DF=(sd(kF={},"publish",0),sd(kF,"subscribe",0),sd(kF,"pushtrack",0),sd(kF,"unpublish",1),sd(kF,"unsubscribe",1),sd(kF,"removetrack",1),kF),PF=function(e){DI(r,e);var t=YI(r);function r(){var e;return Wd(this,r),sd(eI(e=t.call(this)),"_queue",void 0),e._queue=[],e}return qd(r,[{key:"queue",get:function(){return this._queue}},{key:"enqueue",value:function(e){var t,r=this._queue.length,n="";return this._queue=Gs(t=this._queue).call(t,(function(t){return t.streamId!==e.streamId||e.action!==OF[t.action]||(n=t.streamId,CF.print("offsetStreamId",n),!1)})),this._queue.length===r&&this._queue.push(e),this.emit("start"),n}},{key:"dequeue",value:function(){var e;if(!this._queue.length)return null;var t=this._queue.length;zC&&(t=Math.min(this._queue.length,5));for(var r=DF[this._queue[0].action],n=1;n<t;n++){var i;if(DF[this._queue[n].action]!==r)return{sdpStrategy:r,items:mk(i=this._queue).call(i,0,n)}}return{sdpStrategy:r,items:mk(e=this._queue).call(e,0,t)}}}]),r}(Mw),NF=new Jw("ChromeHandler",3),MF=HL(),LF=function(e){DI(l,e);var t,r,n,i,a,o,s,c,u,d=YI(l);function l(e,t){var r;return Wd(this,l),sd(eI(r=d.call(this,e,t)),"name","chrome"),sd(eI(r),"_queueBusy",!1),sd(eI(r),"_sdpQueue",void 0),sd(eI(r),"_aSendonlyOfferTpl",void 0),sd(eI(r),"_vSendonlyOfferTpl",void 0),sd(eI(r),"_aRecvonlyOfferTpl",void 0),sd(eI(r),"_vRecvonlyOfferTpl",void 0),sd(eI(r),"_mid",10),sd(eI(r),"_offerSession",void 0),sd(eI(r),"_answerSession",void 0),sd(eI(r),"_offerMlines",[]),sd(eI(r),"_answerMlines",[]),sd(eI(r),"_inactiveMlineIndex",[]),sd(eI(r),"_mlinesCache",{}),r._sdpQueue=new PF,r._sdpQueue.on("start",(function(){r._queueBusy||"stable"!==r._peerConnection.signalingState||(NF.print("dequeue start"),r.dequeue())})),r}return qd(l,[{key:"connect",value:(u=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return NF.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,SU(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=ny((null==t||null===(i=t.publicIPs)||void 0===i?void 0:uy(i).call(i,(function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),e.next=9,this._peerConnection.createOffer();case 9:return a=e.sent,o=zL.parse(a.sdp),(s=!this._offerIce.iceUfrag&&!this._offerIce.icePwd)&&((l=(null===(c=this._context)||void 0===c?void 0:c.pcKillSwitch.sld_iceoption_renomination)||"renomination"===(null==_?void 0:_.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,h=IU({serverUfrag:t.iceParams.serverIceUfrag,serverPwd:t.iceParams.serverIcePwd,clientPwd:null===(u=o.media[0])||void 0===u?void 0:u.icePwd,options:(d={},sd(d,TU.kICEConfigTypeSrtpDtlsType,!0),sd(d,TU.kICEConfigTypeRenominationType,l),d)}),p=$T(h,2),f=p[0],p[1],this._answerIce.iceUfrag=f,NF.print("use serverUfrag v2",ny({dtls:!0,renomination:l}))),v=$T(o.media,1),_=v[0],this._offerIce.fingerprint=o.fingerprint||_.fingerprint,delete o.media,this._offerSession=ud({},o),this._answerSession=ud({},o),this._answerSession.fingerprint&&(this._answerSession.fingerprint=this._answerIce.fingerprint),s&&(this._offerIce.iceUfrag=_.iceUfrag,this._offerIce.icePwd=_.icePwd),this._offerMlines=[ud(ud(ud({},_),this._offerIce),{},{mid:"".concat(0)})],this._answerMlines=[ud(ud(ud({},_),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144},mid:"".concat(0)})],this.setDescription(),e.next=26,new v_((function(e,t){m._dataChannel.onopen=function(){NF.print("connect","dataChannel open"),BP("es.dc.open","",0,!1,m.connection_id,{ms_addr:m.ms_addr}),e("")},m._dataChannel.onerror=function(e){CP.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,eP.INVALID_DATA),BP("es.dc.error","",0,!1,m.connection_id,{ms_addr:m.ms_addr}),t(e)},m._dataChannel.onclose=function(e){BP("es.dc.close","",0,!1,m.connection_id,{ms_addr:m.ms_addr}),t(e)},m._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==m._peerConnection.iceConnectionState&&"closed"!==m._peerConnection.iceConnectionState&&"failed"!==m._peerConnection.connectionState||t(e)}))}));case 26:return NF.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 28:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"disconnect",value:function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null}},{key:"destroy",value:function(){xI(CI(l.prototype),"destroy",this).call(this),this._mlinesCache={}}},{key:"publish",value:(c=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O,D,P,N,M,L,U,V,F;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return u=t.stream,d=t.enableSimulcast,h=xI(CI(l.prototype),"internalPublish",this).call(this,t),p=h.videoDescriptions,f=h.subVideoDescriptions,v=h.audioTransceiverInit,_=h.videoTransceiverInit,m=vU(this._nextSsrc),this._nextSsrc=m.next,y="".concat(this._mid++),g="".concat(this._mid++),S=ud(ud(ud({},this._aSendonlyOfferTpl),this._offerIce),{},{mid:y,msid:xm(r="".concat(u.id," ")).call(r,u.id,"-audio"),ssrcs:_U(u.id,"audio",m.audio,pU)}),E=ud(ud(ud({},this._vSendonlyOfferTpl),this._offerIce),{},{mid:g,msid:xm(n="".concat(u.id," ")).call(n,u.id,"-video")}),d?(NF.print("subVideoDesc","desc: %o ",f),delete E.ssrcGroups,delete E.ssrcs,b=[],E.rids=uy(p).call(p,(function(e){var t=e.rid;return b.unshift(t),{id:t,direction:"send"}})),E.simulcast={dir1:"send",list1:b.join(";")}):(k=mU(u.id,m,{cname:pU}),T=k.ssrcs,I=k.ssrcGroups,E.ssrcs=T,E.ssrcGroups=I),null!==(i=this._context)&&void 0!==i&&null!==(a=i.serverConfig)&&void 0!==a&&a.audioRed&&Array.isArray(S.rtp)&&(-1!==(R=YA(A=S.rtp).call(A,(function(e){return"red"===e.codec})))&&(w=mk(C=S.rtp).call(C,R,1),x=$T(w,1),O=x[0],S.rtp.unshift(O)),D=[],S.rtp.forEach((function(e){return D.push(e.payload)})),S.payloads=D.join(" ")),null!==(o=this._context)&&void 0!==o&&null!==(s=o.serverConfig)&&void 0!==s&&s.videoCodec&&AU(E,null===(P=this._context)||void 0===P||null===(N=P.serverConfig)||void 0===N?void 0:N.videoCodec),(NC||BC)&&Array.isArray(E.ext)&&(E.ext=Gs(M=E.ext).call(M,(function(e){var t;return!(null!=e&&null!==(t=e.uri)&&void 0!==t&&$m(t).call(t,"video-orientation"))}))),(L=null==S?void 0:Nb(c=S.rtp).call(c,(function(e){return"opus"===e.codec})))&&S.fmtp&&(F=Nb(U=S.fmtp).call(U,(function(e){return e.payload===L.payload})))&&null!==(V=this._context)&&void 0!==V&&V.audioProfileManager&&(F.config=this._context.audioProfileManager.getOpusConfigStr(F.config)),d||NC||this.addBitrateLimit(E,t.videoEncodeConfig[0].maxKbps),this._mlinesCache[t.stream.id]=[S,E],e.abrupt("return",{partialSdp:gU(this._offerSession,S,E),audioMid:y,videoMid:g,type:"incroffer",semantics:"unified-plan",videoDescriptions:p,subVideoDescriptions:f,audioTransceiverInit:v,videoTransceiverInit:_});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O,D,P=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(NF.print("subscribe"),o="incroffer",s="unified-plan",this._aRecvonlyOfferTpl&&this._vRecvonlyOfferTpl){e.next=9;break}return e.next=6,this._genOfferSdp();case 6:return c=e.sent,e.next=9,this.createAVMlineOfferTpl(c);case 9:if(u="",d="",l=!1,h=!1,p=void 0,f=void 0,this._mlinesCache[t.streamId]=[p,f],t.virtual?(u="".concat(this._mid++),l=!0):r.multiChatMode?(u="".concat(this._mid++),d="".concat(this._mid++),h=!0):(l=!0,h=!0,u="".concat(this._mid++),d="".concat(this._mid++)),u&&(p=ud(ud({},this._aRecvonlyOfferTpl),{},{mid:u})),l&&(this._mlinesCache[t.streamId][0]=p,v={track:"audio",init:{direction:"recvonly"}}),d&&(f=ud(ud({},this._vRecvonlyOfferTpl),{},{mid:d})),h&&(this._mlinesCache[t.streamId][1]=f,_={track:"video",init:{direction:"recvonly"}}),m=gU(this._offerSession,p,f),y=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._vSendonlyAnswerTpl){e.next=32;break}return y=vU(this._nextSsrc),this._nextSsrc=y.next,A=ud(ud(ud({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:xm(g=xm(S="".concat(t.streamId)).call(S,null!==(E=this._context)&&void 0!==E&&E.avSync?"":"-audio"," ")).call(g,t.streamId,"-audio"),ssrcs:_U(t.streamId,"audio",y.audio)}),R=ud(ud(ud({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:d,msid:xm(b=xm(k="".concat(t.streamId)).call(k,null!==(T=this._context)&&void 0!==T&&T.avSync?"":"-video"," ")).call(b,t.streamId,"-video")},mU(t.streamId,y,{flexfec:this._enableSubFlexfec})),C=new v_((function(e){P._sdpQueue.enqueue({action:xF.subscribe,streamId:t.streamId,audioMid:u,videoMid:d,audioTransceiverInit:v,videoTransceiverInit:_,signalingAck:{sdp:zL.write(ud(ud({},P._answerSession),{},{media:[A,R]})),sequenceId:t.sequenceId?++t.sequenceId:0},stream:t,sdp:m,onSuccess:function(){NF.print("subscribe()","sub success"),e(0)}})})),e.next=31,C;case 31:null===(I=y)||void 0===I||delete I.next;case 32:return(w=null===(n=p)||void 0===n?void 0:Nb(i=n.rtp).call(i,(function(e){return"opus"===e.codec})))&&null!==(a=p)&&void 0!==a&&a.fmtp&&(D=null===(x=p)||void 0===x?void 0:Nb(O=x.fmtp).call(O,(function(e){return e.payload===w.payload})))&&this._context&&(D.config+=";stereo=1;sprop-stereo=1"),e.abrupt("return",{partialSdp:m,audioMid:u,videoMid:d,type:o,semantics:s,audioTransceiverInit:v,videoTransceiverInit:_,allSsrc:y});case 35:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(o=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(NF.print("handleAck()","item: %o",t),!t.generatorSsrc){e.next=4;break}return NF.print("already set remote"),e.abrupt("return","");case 4:return e.abrupt("return",this._sdpQueue.enqueue(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"dequeue",value:(a=m_(Im.mark((function e(){var t,r,n,i,a,o,s,c,u,d,l,h,p,f,v,_=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._queueBusy=!0,t=this._sdpQueue.dequeue(),NF.print("dequeue()","ret: %o",t),t){e.next=6;break}return this._queueBusy=!1,e.abrupt("return");case 6:if(e.prev=6,r=t.items,n=t.sdpStrategy,i=[],a=[],o=[],n!==wF.ADD){e.next=15;break}return e.delegateYield(Im.mark((function e(){var t,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete(t=ud({},_._answerIce)).candidates,s=!1,c=!1,e.prev=4,d=KN(r);case 6:return e.next=8,d.next();case 8:if(!(s=!(l=e.sent).done)){e.next=16;break}if(n=l.value,"break"!==function(){var e=n.audioMid,r=n.videoMid,s=n.action,c=n.audioTransceiverInit,u=n.videoTransceiverInit,d=n.signalingAck,l=n.stream,h=l instanceof RF;if(n.onSuccess&&o.push(n.onSuccess),h&&(null==d?void 0:d.sequenceId)<l.sequenceId)return"break";var p,f={},v={},m=zL.parse(d.sdp);Array.isArray(m.media)&&BA(p=m.media).call(p,(function(e,t){var r;return null==e||null===(r=e.type)||void 0===r?void 0:r.localeCompare(null==t?void 0:t.type)})).forEach((function(n){"audio"===(n=ud(ud({},n),t)).type?(f=n).mid=e:(v=n).mid=r}));var y,g=l.streamId;if(s===xF.publish&&(g=null===(y=l.stream)||void 0===y?void 0:y.id),!_._mlinesCache[g])return"break";var S=$T(_._mlinesCache[g],2),E=S[0],b=S[1];if(c&&E){l.audioTransceiver=_._peerConnection.addTransceiver(c.track,c.init),_.monitor.rtcInvokeStatus(ny({audioStreamTrack:rw(c.track)}),0,"chromeHandler.addTrack","",0);var k=_._inactiveMlineIndex.shift();k||(k=_._offerMlines.length),_._offerMlines[k]=ud({},E),_._answerMlines[k]=f,MF&&l.initAudioEncodedTransform()}if(u&&b){var T,I;l.videoTransceiver=_._peerConnection.addTransceiver(u.track,u.init),_.monitor.rtcInvokeStatus(ny({videoStreamTrack:rw(u.track)}),0,"chromeHandler.addTrack","",0);var A,R,C=_._inactiveMlineIndex.shift();C||(C=_._offerMlines.length),_._offerMlines[C]=ud({},b),s===xF.publish&&null!==(T=_._context)&&void 0!==T&&null!==(I=T.serverConfig)&&void 0!==I&&I.videoCodec&&AU(v,null===(A=_._context)||void 0===A||null===(R=A.serverConfig)||void 0===R?void 0:R.videoCodec),_._answerMlines[C]=v,MF&&l.initVideoEncodedTransform()}i.push(l.streamId||""),a.push(h?l.userId:"local"),h&&(l.sequenceId=null==d?void 0:d.sequenceId),delete _._mlinesCache[g]}()){e.next=13;break}return e.abrupt("break",16);case 13:s=!1,e.next=6;break;case 16:e.next=22;break;case 18:e.prev=18,e.t0=e.catch(4),c=!0,u=e.t0;case 22:if(e.prev=22,e.prev=23,!s||null==d.return){e.next=27;break}return e.next=27,d.return();case 27:if(e.prev=27,!c){e.next=30;break}throw u;case 30:return e.finish(27);case 31:return e.finish(22);case 32:case"end":return e.stop()}}),e,null,[[4,18,22,32],[23,,27,31]])}))(),"t0",13);case 13:e.next=20;break;case 15:v={},r.forEach((function(e){var t=e.audioMid,r=e.videoMid,n=e.action;v[t]=t,n!==xF.removetrack&&(v[r]=r),v[t]=t})),this._offerMlines=uy(h=this._offerMlines).call(h,(function(e,t){return v[e.mid]&&(e=yU(e),_._inactiveMlineIndex.push(t)),e})),BA(p=this._inactiveMlineIndex).call(p,(function(e,t){return e-t})),this._answerMlines=uy(f=this._answerMlines).call(f,(function(e){return v[e.mid]&&(e=yU(e)),e}));case 20:return e.next=22,this._peerConnection.createOffer();case 22:return e.next=24,this.setDescription(i.length?{streamId:i.join(","),streamUserId:a.join(",")}:void 0);case 24:try{o.forEach((function(e){return e()}))}catch(PX){}NF.print("dequeue","loop"),e.next=31;break;case 28:e.prev=28,e.t1=e.catch(6),NF.print("dequeue","unknown error: %o",e.t1);case 31:return e.prev=31,this.dequeue(),e.finish(31);case 34:case"end":return e.stop()}}),e,this,[[6,28,31,34]])}))),function(){return a.apply(this,arguments)})},{key:"setDescription",value:(i=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return NF.print("setDescription"),this._offerSession.media=this._offerMlines,this._answerSession.media=this._answerMlines,r=[],this._offerMlines.forEach((function(e){"inactive"!==e.direction&&r.push(e.mid)})),this._offerSession.groups&&this._answerSession.groups&&(this._offerSession.groups[0].mids=r.join(" "),this._answerSession.groups[0].mids=r.join(" ")),n=RC(),t&&CP.rtcBeginCreateOffer("local"===t.streamUserId?rP.UP:rP.DOWN,t.streamId,t.streamUserId),t&&CP.rtcCreateOffer(0,"local"===t.streamUserId?nP.UP:nP.DOWN,t.streamId,t.streamUserId,RC()-n),e.next=11,this.setLocalDescription(zL.write(this._offerSession),t);case 11:return e.next=13,this.setRemoteDescription(zL.write(this._answerSession),t);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getDefaultSdp",value:(n=m_(Im.mark((function e(){var t,r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._genOfferSdp();case 2:return r=e.sent,this.createAVMlineOfferTpl(r),n=zL.parse(r),i=[],n.media=Gs(t=n.media).call(t,(function(e){var t;return"recvonly"===e.direction&&(Array.isArray(e.ext)&&(e.ext=Gs(t=e.ext).call(t,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))),i.push(e.mid+""),!0)})),n.groups=[{mids:i.join(" "),type:"BUNDLE"}],e.abrupt("return",{sdp:zL.write(n),semantics:"unified-plan",type:"incroffer"});case 9:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"rollback",value:(r=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:delete this._mlinesCache[t];case 1:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;zL.parse(e).media.forEach((function(e){if(e.icePwd=t._offerIce.icePwd,e.iceUfrag=t._offerIce.iceUfrag,"audio"===e.type)if("sendonly"===e.direction)t._aSendonlyOfferTpl=e;else{var r;if(Array.isArray(e.ext))e.ext=Gs(r=e.ext).call(r,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}));t._aRecvonlyOfferTpl=e}else if("video"===e.type)if("sendonly"===e.direction)t._vSendonlyOfferTpl=e;else{var n;if(Array.isArray(e.ext))e.ext=Gs(n=e.ext).call(n,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}));t._vRecvonlyOfferTpl=e}}))}},{key:"_genOfferSdp",value:(t=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,YC(!0);case 3:if(t=e.sent){e.next=6;break}throw"pc.createOffer() return empty.";case 6:e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(0),r="Get offer Error. ".concat(e.t0.message|e.t0),new pR(lR.NOT_SUPPORTED,r);case 12:return e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,null,[[0,8]])}))),function(){return t.apply(this,arguments)})}]),l}(xU),UF=new Jw("FirefoxHandler",3),VF=function(e){DI(l,e);var t,r,n,i,a,o,s,c,u,d=YI(l);function l(){var e,t;Wd(this,l);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return sd(eI(t=d.call.apply(d,xm(e=[this]).call(e,n))),"name","firefox"),sd(eI(t),"_aRecvonlyOfferTpl",void 0),t}return qd(l,[{key:"connect",value:(u=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return UF.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,SU(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=ny((null==t||null===(i=t.publicIPs)||void 0===i?void 0:uy(i).call(i,(function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),FC<138&&(this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"})),e.next=10,this._peerConnection.createOffer();case 10:return c=e.sent,u=zL.parse(c.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((p="renomination"===(null===(d=u.media[0])||void 0===d?void 0:d.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,f=IU({serverUfrag:t.iceParams.serverIceUfrag,serverPwd:t.iceParams.serverIcePwd,clientPwd:null===(l=u.media[0])||void 0===l?void 0:l.icePwd,options:(h={},sd(h,TU.kICEConfigTypeSrtpDtlsType,!0),sd(h,TU.kICEConfigTypeRenominationType,p),h)}),v=$T(f,2),_=v[0],v[1],this._answerIce.iceUfrag=_,UF.print("use serverUfrag v2",ny({dtls:!0,renomination:p}))),m=$T(u.media,1),y=m[0],this._offerIce.fingerprint=u.fingerprint||y.fingerprint,u.media=uy(a=u.media).call(a,(function(e){return ud(ud({},e),S._offerIce)})),uy(o=u.media).call(o,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Kb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),(g=ud({},u)).fingerprint=this._answerIce.fingerprint,g.media=uy(s=g.media).call(s,(function(e){return delete(e=ud(ud({},e),S._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:("audio"===e.type&&(e.msid="ff-stream ff-stream-audio"),e.direction="sendonly"),e})),e.next=23,this.setLocalDescription(zL.write(u));case 23:return e.next=25,this.setRemoteDescription(zL.write(g));case 25:return e.next=27,new v_((function(e,t){S._dataChannel.onopen=function(){UF.print("connect","dataChannel open"),BP("es.dc.open","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),e("")},S._dataChannel.onerror=function(e){CP.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,eP.INVALID_DATA),BP("es.dc.error","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),t(e)},S._dataChannel.onclose=function(e){BP("es.dc.close","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),t(e)},S._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==S._peerConnection.iceConnectionState&&"closed"!==S._peerConnection.iceConnectionState&&"failed"!==S._peerConnection.connectionState||t(e)}))}));case 27:return UF.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 29:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"publish",value:(c=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,h,p,f,v,_,m=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=xI(CI(l.prototype),"internalPublish",this).call(this,t),a=i.videoDescriptions,o=i.subVideoDescriptions,s=i.audioTransceiverInit,c=i.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(s.track,s.init),t.videoTransceiver=this._peerConnection.addTransceiver(c.track,c.init),u=RC(),CP.rtcBeginCreateOffer(rP.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return d=e.sent,CP.rtcCreateOffer(0,nP.UP,"","",RC()-u),(h=zL.parse(d.sdp)).media=null===(r=h.media)||void 0===r?void 0:uy(r).call(r,(function(e){return ud(ud({},e),m._offerIce)})),e.next=13,this.setLocalDescription(zL.write(h));case 13:return p=t.audioTransceiver.mid,f=t.videoTransceiver.mid,v=null,_=null,h.media=null===(n=h.media)||void 0===n?void 0:uy(n).call(n,(function(e){if("".concat(e.mid)===p){var t,r,n=null===(t=v=e)||void 0===t?void 0:Nb(r=t.rtp).call(r,(function(e){return"opus"===e.codec}));if(n&&v.fmtp){var i,a,o=Nb(i=v.fmtp).call(i,(function(e){return e.payload===n.payload}));o&&null!==(a=m._context)&&void 0!==a&&a.audioProfileManager&&(o.config=m._context.audioProfileManager.getOpusConfigStr(o.config))}}else if("".concat(e.mid)===f){var s,c,u,d;null!==(s=m._context)&&void 0!==s&&null!==(c=s.serverConfig)&&void 0!==c&&c.videoCodec&&AU(e,null===(u=m._context)||void 0===u||null===(d=u.serverConfig)||void 0===d?void 0:d.videoCodec),_=e}return e})),this.addBitrateLimit(_,t.videoEncodeConfig[0].maxKbps),e.next=21,this.setLocalDescription(zL.write(h));case 21:return e.abrupt("return",{partialSdp:gU(h,v,_,!1),audioMid:p,videoMid:f,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:o,audioTransceiverInit:s,videoTransceiverInit:c});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return UF.print("subscribe()"),c="",u="",d=!1,l=!1,h=void 0,p=void 0,t.virtual?d=!0:(r.multiChatMode||(d=!0),l=!0),d&&(t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"})),l&&(t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"})),f=RC(),CP.rtcBeginCreateOffer(rP.UP,t.streamId,t.userId),e.next=14,this._peerConnection.createOffer();case 14:return v=e.sent,CP.rtcCreateOffer(0,nP.UP,t.streamId,t.userId,RC()-f),(_=zL.parse(v.sdp)).media=null===(n=_.media)||void 0===n?void 0:uy(n).call(n,(function(e){return ud(ud({},e),R._offerIce)})),uy(i=_.media).call(i,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Kb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),e.next=21,this.setLocalDescription(zL.write(_),{streamId:t.streamId||"",streamUserId:t.userId});case 21:if(c=null===(a=t.audioTransceiver)||void 0===a?void 0:a.mid,u=null===(o=t.videoTransceiver)||void 0===o?void 0:o.mid,null===(s=_.media)||void 0===s||s.forEach((function(e){"".concat(e.mid)===c?h=e:"".concat(e.mid)===u&&(p=e)})),c&&h||(c="audio_".concat(u),h=ud(ud({},this._aRecvonlyOfferTpl),{},{mid:c})),t.audioMid=c,t.videoMid=u,m=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=36;break}return m=vU(this._nextSsrc),this._nextSsrc=m.next,I=ud(ud(ud({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:c,msid:xm(y=xm(g="".concat(t.streamId)).call(g,null!==(S=this._context)&&void 0!==S&&S.avSync?"":"-audio"," ")).call(y,t.streamId,"-audio"),ssrcs:_U(t.streamId,"audio",m.audio)}),A=ud(ud(ud({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:u,msid:xm(E=xm(b="".concat(t.streamId)).call(b,null!==(k=this._context)&&void 0!==k&&k.avSync?"":"-video"," ")).call(E,t.streamId,"-video")},mU(t.streamId,m,{flexfec:this._enableSubFlexfec})),e.next=35,this._internalSetRemoteDescription([I,A],t);case 35:null===(T=m)||void 0===T||delete T.next;case 36:return e.abrupt("return",{partialSdp:gU(_,h,p,!1),audioMid:c,videoMid:u,type:"incroffer",semantics:"unified-plan",audioTransceiverInit:t.audioTransceiver?{track:"audio",init:{direction:"recvonly"}}:void 0,videoTransceiverInit:t.videoTransceiver?{track:"video",init:{direction:"recvonly"}}:void 0,allSsrc:m});case 37:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(o=m_(Im.mark((function e(t){var r,n,i,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.signalingAck,n=t.stream,(i=t.action)!==xF.unpublish&&i!==xF.unsubscribe&&i!==xF.removetrack){e.next=5;break}return e.next=4,this.close(n);case 4:return e.abrupt("return",n.streamId||"");case 5:if(!t.generatorSsrc){e.next=8;break}return UF.print("already set remote"),e.abrupt("return","");case 8:return a=zL.parse(null==r?void 0:r.sdp),e.next=11,this._internalSetRemoteDescription(a.media,n);case 11:return e.abrupt("return","");case 12:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"_internalSetRemoteDescription",value:(a=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={},(c=zL.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp)).media.forEach((function(e){void 0!==e.mid&&(s[e.mid]=e)})),t.forEach((function(e){if("audio"===(e=ud(ud({},e),l._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type){if(r instanceof AF&&FC<=87){var t,n,i,a,o={};Array.isArray(e.rtp)&&(e.rtp=Gs(t=e.rtp).call(t,(function(e){return"rtx"!==e.codec||(o[e.payload]=e.payload,!1)}))),"string"==typeof e.payloads&&(e.payloads=Gs(n=e.payloads.split(" ")).call(n,(function(e){return!o[e]})).join(" ")),Array.isArray(e.fmtp)&&(e.fmtp=Gs(i=e.fmtp).call(i,(function(e){return!o[e.payload]}))),Array.isArray(e.rtcpFb)&&(e.fmtp=Gs(a=e.fmtp).call(a,(function(e){return!o[e.payload]})))}r.videoMid?(e.mid=r.videoMid,s[r.videoMid]=e):s[e.mid]=e}})),u=zL.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp),d=uy(a=u.media).call(a,(function(e){var t=s[e.mid];return"inactive"===e.direction?e:t})),c.groups=u.groups,c.media=d,uy(o=c.media).call(o,(function(e){var t,r,n;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Kb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})),FC>=138&&(e.ext=null===(n=e.ext)||void 0===n?void 0:Gs(n).call(n,(function(e){var t;return!$m(t=e.uri).call(t,"sdes:mid")}))))})),e.next=11,this.setRemoteDescription(zL.write(c));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"getDefaultSdp",value:(i=m_(Im.mark((function e(){var t,r,n,i,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=new RTCPeerConnection).addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),e.next=5,r.createOffer();case 5:return n=e.sent,i=zL.parse(n.sdp),this.createAVMlineOfferTpl(n.sdp),a=[],i.media=Gs(t=i.media).call(t,(function(e){if("recvonly"===e.direction){var t="template_".concat(e.type);return e.mid=t,a.push(t),!0}return!1})),i.groups=[{mids:a.join(" "),type:"BUNDLE"}],r.close(),e.abrupt("return",{sdp:zL.write(i),semantics:"unified-plan",type:"incroffer"});case 13:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"rollback",value:(n=m_(Im.mark((function e(t,r,n){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return UF.print("rollback()"),e.abrupt("return",this.close(r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"close",value:(r=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return UF.print("close()"),o={},t.audioTransceiver&&t.audioMid&&(t.audioTransceiver.stop(),o[t.audioMid]=t.audioMid),t.videoTransceiver&&t.videoMid&&!r&&(t.videoTransceiver.stop(),o[t.videoMid]=t.videoMid),s=[],e.next=7,this._peerConnection.createOffer();case 7:return c=e.sent,(u=zL.parse(null==c?void 0:c.sdp)).media=uy(n=u.media).call(n,(function(e){return o[e.mid]&&(e=yU(e)),"inactive"!==e.direction&&s.push(e.mid),ud(ud({},e),h._offerIce)})),d=zL.parse(null===(i=this._peerConnection.remoteDescription)||void 0===i?void 0:i.sdp),l={},d.media.forEach((function(e){void 0!==e.mid&&(l[e.mid]=e)})),d.media=uy(a=u.media).call(a,(function(e){return"inactive"===e.direction?e:l[e.mid]})),u.groups&&d.groups&&(u.groups[0].mids=s.join(" "),d.groups[0].mids=s.join(" ")),e.next=17,this.setLocalDescription(zL.write(u));case 17:return e.next=19,this.setRemoteDescription(zL.write(d));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._peerConnection.createOffer();case 2:if(!this._peerConnection.localDescription||!this._peerConnection.remoteDescription){e.next=7;break}return e.next=5,this._peerConnection.setLocalDescription(this._peerConnection.localDescription);case 5:return e.next=7,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription);case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;zL.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),l}(xU),FF=new Jw("FallbackHandler",3),BF=function(e){DI(l,e);var t,r,n,i,a,o,s,c,u,d=YI(l);function l(e,t){var r;return Wd(this,l),sd(eI(r=d.call(this,e,t)),"name","fallback"),sd(eI(r),"_aRecvonlyOfferTpl",void 0),FF.print("ctor","using fallback handler"),e.rtcError("using fallback handler",-1),r}return qd(l,[{key:"connect",value:(u=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return FF.print("connect","invoke connect"),this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=4,SU(t);case 4:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=ny((null==t||null===(i=t.publicIPs)||void 0===i?void 0:uy(i).call(i,(function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"}),e.next=11,this._peerConnection.createOffer();case 11:return c=e.sent,u=zL.parse(c.sdp),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((p="renomination"===(null===(d=u.media[0])||void 0===d?void 0:d.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,f=IU({serverUfrag:t.iceParams.serverIceUfrag,serverPwd:t.iceParams.serverIcePwd,clientPwd:null===(l=u.media[0])||void 0===l?void 0:l.icePwd,options:(h={},sd(h,TU.kICEConfigTypeSrtpDtlsType,!0),sd(h,TU.kICEConfigTypeRenominationType,p),h)}),v=$T(f,1),_=v[0],this._answerIce.iceUfrag=_,FF.print("use serverUfrag v2",ny({dtls:!0,renomination:p}))),m=$T(u.media,1),y=m[0],this._offerIce.fingerprint=u.fingerprint||y.fingerprint,u.media=uy(a=u.media).call(a,(function(e){return ud(ud({},e),S._offerIce)})),uy(o=u.media).call(o,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Kb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),(g=ud({},u)).fingerprint=this._answerIce.fingerprint,g.media=uy(s=g.media).call(s,(function(e){return delete(e=ud(ud({},e),S._answerIce)).bundleOnly,e.port=9,"application"===e.type?e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}:("audio"===e.type&&(e.msid="ff-stream ff-stream-audio"),e.direction="sendonly"),e})),e.next=24,this.setLocalDescription(c.sdp);case 24:return e.next=26,this.setRemoteDescription(zL.write(g));case 26:return e.next=28,new v_((function(e,t){S._dataChannel.onopen=function(){FF.print("connect","dataChannel open"),BP("es.dc.open","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),e("")},S._dataChannel.onerror=function(e){CP.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,eP.INVALID_DATA),BP("es.dc.error","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),t(e)},S._dataChannel.onclose=function(e){BP("es.dc.close","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),t(e)},S._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==S._peerConnection.iceConnectionState&&"closed"!==S._peerConnection.iceConnectionState&&"failed"!==S._peerConnection.connectionState||t(e)}))}));case 28:return FF.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 30:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"publish",value:(c=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,h,p,f,v;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=xI(CI(l.prototype),"internalPublish",this).call(this,t),i=n.videoDescriptions,a=n.subVideoDescriptions,o=n.audioTransceiverInit,s=n.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(o.track,o.init),t.videoTransceiver=this._peerConnection.addTransceiver(s.track,s.init),c=RC(),CP.rtcBeginCreateOffer(rP.UP,"",""),e.next=7,this._peerConnection.createOffer();case 7:return u=e.sent,CP.rtcCreateOffer(0,nP.UP,"","",RC()-c),d=zL.parse(u.sdp),e.next=12,this.setLocalDescription(u.sdp);case 12:return h=t.audioTransceiver.mid,p=t.videoTransceiver.mid,f=null,v=null,d.media=null===(r=d.media)||void 0===r?void 0:uy(r).call(r,(function(e){return"".concat(e.mid)===h?f=e:"".concat(e.mid)===p&&(v=e),e})),HL()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),e.abrupt("return",{partialSdp:gU(d,f,v,!1),audioMid:h,videoMid:p,type:"incroffer",semantics:"unified-plan",videoDescriptions:i,subVideoDescriptions:a,audioTransceiverInit:o,videoTransceiverInit:s});case 19:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"subscribe",value:(s=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return FF.print("subscribe()"),o="",s="",c=!1,u=!1,d=void 0,l=void 0,t.virtual?c=!0:(r.multiChatMode||(c=!0),u=!0),c&&(t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"})),u&&(t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"})),h=RC(),CP.rtcBeginCreateOffer(rP.UP,t.streamId,t.userId),e.next=14,this._peerConnection.createOffer();case 14:return p=e.sent,CP.rtcCreateOffer(0,nP.UP,t.streamId,t.userId,RC()-h),f=zL.parse(p.sdp),e.next=19,this.setLocalDescription(p.sdp,{streamId:t.streamId||"",streamUserId:t.userId});case 19:if(o=null===(n=t.audioTransceiver)||void 0===n?void 0:n.mid,s=null===(i=t.videoTransceiver)||void 0===i?void 0:i.mid,null===(a=f.media)||void 0===a||a.forEach((function(e){"".concat(e.mid)===o?d=e:"".concat(e.mid)===s&&(l=e)})),o&&d||(o="audio_".concat(s),d=ud(ud({},this._aRecvonlyOfferTpl),{},{mid:o})),t.audioMid=o,t.videoMid=s,v=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=34;break}return v=vU(this._nextSsrc),this._nextSsrc=v.next,k=ud(ud(ud({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:o,msid:xm(_=xm(m="".concat(t.streamId)).call(m,null!==(y=this._context)&&void 0!==y&&y.avSync?"":"-audio"," ")).call(_,t.streamId,"-audio"),ssrcs:_U(t.streamId,"audio",v.audio)}),T=ud(ud(ud({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:s,msid:xm(g=xm(S="".concat(t.streamId)).call(S,null!==(E=this._context)&&void 0!==E&&E.avSync?"":"-video"," ")).call(g,t.streamId,"-video")},mU(t.streamId,v,{flexfec:this._enableSubFlexfec})),e.next=33,this._internalSetRemoteDescription([k,T],t);case 33:null===(b=v)||void 0===b||delete b.next;case 34:return HL()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),e.abrupt("return",{partialSdp:gU(f,d,l,!1),audioMid:o,videoMid:s,type:"incroffer",semantics:"unified-plan",audioTransceiverInit:t.audioTransceiver?{track:"audio",init:{direction:"recvonly"}}:void 0,videoTransceiverInit:t.videoTransceiver?{track:"video",init:{direction:"recvonly"}}:void 0,allSsrc:v});case 36:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handleAck",value:(o=m_(Im.mark((function e(t){var r,n,i,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.signalingAck,n=t.stream,(i=t.action)!==xF.removetrack){e.next=3;break}return e.abrupt("return","");case 3:if(i!==xF.unpublish&&i!==xF.unsubscribe){e.next=7;break}return e.next=6,this.close(n);case 6:return e.abrupt("return",n.streamId||"");case 7:if(!t.generatorSsrc){e.next=10;break}return FF.print("already set remote"),e.abrupt("return","");case 10:return a=zL.parse(null==r?void 0:r.sdp),e.next=13,this._internalSetRemoteDescription(a.media,n);case 13:return e.abrupt("return","");case 14:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"_internalSetRemoteDescription",value:(a=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s={},(c=zL.parse(null===(n=this._peerConnection.remoteDescription)||void 0===n?void 0:n.sdp)).media.forEach((function(e){void 0!==e.mid&&(s[e.mid]=e)})),t.forEach((function(e){"audio"===(e=ud(ud({},e),l._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,s[r.audioMid]=e):s[e.mid]=e),"video"===e.type&&(r.videoMid?(e.mid=r.videoMid,s[r.videoMid]=e):s[e.mid]=e)})),u=zL.parse(null===(i=this._peerConnection.localDescription)||void 0===i?void 0:i.sdp),d=uy(a=u.media).call(a,(function(e){var t=s[e.mid];return"inactive"===e.direction?e:t})),c.groups=u.groups,c.media=d,uy(o=c.media).call(o,(function(e){var t,r;"video"===e.type&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return-1===Kb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(r=e.rtcpFb)||void 0===r?void 0:Gs(r).call(r,(function(e){return"goog-remb"!==e.type})))})),e.next=11,this.setRemoteDescription(zL.write(c));case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"getDefaultSdp",value:(i=m_(Im.mark((function e(){var t,r,n,i,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=new RTCPeerConnection).addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),e.next=5,r.createOffer();case 5:return n=e.sent,i=zL.parse(n.sdp),this.createAVMlineOfferTpl(n.sdp),a=[],i.media=Gs(t=i.media).call(t,(function(e){if("recvonly"===e.direction){var t="template_".concat(e.type);return e.mid=t,a.push(t),!0}return!1})),i.groups=[{mids:a.join(" "),type:"BUNDLE"}],r.close(),e.abrupt("return",{sdp:zL.write(i),semantics:"unified-plan",type:"incroffer"});case 13:case"end":return e.stop()}}),e,this)}))),function(){return i.apply(this,arguments)})},{key:"rollback",value:(n=m_(Im.mark((function e(t,r,n){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return FF.print("rollback()"),e.abrupt("return",this.close(r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return n.apply(this,arguments)})},{key:"close",value:(r=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return FF.print("close()"),o={},t.audioTransceiver&&t.audioMid&&(t.audioTransceiver.stop(),o[t.audioMid]=t.audioMid),t.videoTransceiver&&t.videoMid&&!r&&(t.videoTransceiver.stop(),o[t.videoMid]=t.videoMid),s=[],e.next=7,this._peerConnection.createOffer();case 7:return c=e.sent,(u=zL.parse(null==c?void 0:c.sdp)).media=uy(n=u.media).call(n,(function(e){return o[e.mid]&&(e=yU(e)),"inactive"!==e.direction&&s.push(e.mid),ud(ud({},e),h._offerIce)})),d=zL.parse(null===(i=this._peerConnection.remoteDescription)||void 0===i?void 0:i.sdp),l={},d.media.forEach((function(e){void 0!==e.mid&&(l[e.mid]=e)})),d.media=uy(a=u.media).call(a,(function(e){return"inactive"===e.direction?e:l[e.mid]})),u.groups&&d.groups&&(u.groups[0].mids=s.join(" "),d.groups[0].mids=s.join(" ")),e.next=17,this.setLocalDescription(null==c?void 0:c.sdp);case 17:return e.next=19,this.setRemoteDescription(zL.write(d));case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"setCurrentDescription",value:(t=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._peerConnection.createOffer();case 2:if(!this._peerConnection.localDescription||!this._peerConnection.remoteDescription){e.next=7;break}return e.next=5,this._peerConnection.setLocalDescription(this._peerConnection.localDescription);case 5:return e.next=7,this._peerConnection.setRemoteDescription(this._peerConnection.remoteDescription);case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;zL.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}}]),l}(xU);var jF=od,GF=tc,HF=function(e,t,r,n){for(var i,a=n>1?void 0:n?GF(t,r):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n?i(t,r,a):i(a))||a);return n&&a&&jF(t,r,a),a},zF=function(){function e(t){Wd(this,e),sd(this,"_queue",[]),sd(this,"_runningTask",[]),sd(this,"executor",void 0),sd(this,"busy",!1),this.executor=t}var t;return qd(e,[{key:"add",value:function(e){var t=YF(),r=t.promise,n=t.resolve,i=t.reject;return this._queue.push({item:e,resolve:n,reject:i}),this.busy||this._emit(),r}},{key:"destroy",value:function(){var e;xm(e=[]).call(e,Qk(this._queue),Qk(this._runningTask)).forEach((function(e){(0,e.reject)(new pR(lR.OPERATION_CANCEL,"queue close"))})),this.busy=!1,this._queue=[]}},{key:"_emit",value:(t=m_(Im.mark((function e(){var t,r,n,i,a,o=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._queue,this._runningTask=t,this._queue=[],0!==t.length){e.next=6;break}return this.busy=!1,e.abrupt("return");case 6:return r=uy(t).call(t,(function(e){return e.item})),n=uy(t).call(t,(function(e){return e.resolve})),i=uy(t).call(t,(function(e){return e.reject})),e.prev=9,this.busy=!0,e.next=13,this.executor(r);case 13:a=e.sent,n.forEach((function(e){return e(a)})),e.next=20;break;case 17:e.prev=17,e.t0=e.catch(9),i.forEach((function(t){return t(e.t0)}));case 20:return this._runningTask=[],setTimeout((function(){o._emit()})),e.abrupt("return");case 23:case"end":return e.stop()}}),e,this,[[9,17]])}))),function(){return t.apply(this,arguments)})}]),e}(),KF=new Jw("StandardHandler",3),XF=function(e){DI(p,e);var t,r,n,i,a,o,s,c,u,d,l,h=YI(p);function p(e,t){var r;return Wd(this,p),sd(eI(r=h.call(this,e,t)),"name","standard"),sd(eI(r),"_applyQueue",new zF(r.apply.bind(eI(r)))),sd(eI(r),"_createQueue",new zF(r.create.bind(eI(r)))),sd(eI(r),"_pqueue",new WF),sd(eI(r),"_midMap",new bE),sd(eI(r),"_iceNode",void 0),sd(eI(r),"_answerSession",void 0),sd(eI(r),"_aRecvonlyOfferTpl",void 0),KF.print("ctor","using standard handler"),r}return qd(p,[{key:"connect",value:(l=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return KF.print("connect","standard invoke. %o",t),this._iceNode=t,this._offerIce={iceUfrag:null===(r=t.iceParams)||void 0===r?void 0:r.clientIceUfrag,icePwd:null===(n=t.iceParams)||void 0===n?void 0:n.clientIcePwd,iceOptions:"renomination"},e.next=5,SU(t);case 5:return this._answerIce=e.sent,this.connection_id=this._answerIce.iceUfrag||"",this.ms_addr=ny((null==t||null===(i=t.publicIPs)||void 0===i?void 0:uy(i).call(i,(function(e){return{ip:e.ip,tcp:e.tcpPorts,udp:e.udpPorts}})))||[]),PC&&FC<138&&(this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),this._peerConnection.addTransceiver("video",{direction:"recvonly"})),e.next=11,this._peerConnection.createOffer();case 11:if(c=e.sent,u=c.sdp){e.next=15;break}throw new pR(lR.NOT_SUPPORTED,"create offer sdp failed.");case 15:if(d=zL.parse(u),l=Nb(a=d.media).call(a,(function(e){return"application"===e.type})),!this._offerIce.iceUfrag&&!this._offerIce.icePwd&&((f=(null===(h=this._context)||void 0===h?void 0:h.pcKillSwitch.sld_iceoption_renomination)||"renomination"===(null==l?void 0:l.iceOptions))||(delete this._offerIce.iceOptions,delete this._answerIce.iceOptions),delete this._offerIce.iceUfrag,delete this._offerIce.icePwd,v=IU({serverUfrag:t.iceParams.serverIceUfrag,serverPwd:t.iceParams.serverIcePwd,clientPwd:null==l?void 0:l.icePwd,options:(p={},sd(p,TU.kICEConfigTypeSrtpDtlsType,!0),sd(p,TU.kICEConfigTypeRenominationType,f),p)}),_=$T(v,2),m=_[0],_[1],this._answerIce.iceUfrag=m,KF.print("use serverUfrag v2",ny({dtls:!0,renomination:f}))),this._offerIce.fingerprint=d.fingerprint||l.fingerprint,(y=ud({},d)).fingerprint=this._answerIce.fingerprint,this._answerSession=ud({},y),y.media=uy(o=y.media).call(o,(function(e){return"application"===(e=ud(ud({},e),S._answerIce)).type&&(e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}),PC&&(delete e.bundleOnly,e.port=9,"audio"===e.type?(e.msid="ff-stream ff-stream-audio",e.direction="sendonly"):"video"===e.type&&(e.direction="sendonly")),e})),!("v1"===this.getIceVersion()||null!==(s=this._context)&&void 0!==s&&s.pcKillSwitch.sld_iceoption_renomination)){e.next=30;break}return d.media=uy(g=d.media).call(g,(function(e){return e=ud(ud({},e),S._offerIce)})),e.next=28,this.setLocalDescription(zL.write(d));case 28:e.next=32;break;case 30:return e.next=32,this.setLocalDescription(u);case 32:return e.next=34,this.setRemoteDescription(zL.write(y));case 34:return e.next=36,new v_((function(e,t){S._dataChannel.onopen=function(){KF.print("connect","dataChannel open"),BP("es.dc.open","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),e("")},S._dataChannel.onerror=function(e){CP.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,eP.INVALID_DATA),BP("es.dc.error","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),t(e)},S._dataChannel.onclose=function(e){BP("es.dc.close","",0,!1,S.connection_id,{ms_addr:S.ms_addr}),t(e)},S._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==S._peerConnection.iceConnectionState&&"closed"!==S._peerConnection.iceConnectionState&&"failed"!==S._peerConnection.connectionState||t(e)}))}));case 36:return KF.print("connect","dataChannel establish success"),e.abrupt("return",this._dataChannel);case 38:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"publish",value:(d=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l,h,f,v,_,m;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return KF.print("publish()","streamId: ".concat(t.streamId)),i=xI(CI(p.prototype),"internalPublish",this).call(this,t),a=i.videoDescriptions,o=i.subVideoDescriptions,s=i.audioTransceiverInit,c=i.videoTransceiverInit,t.audioTransceiver=this._peerConnection.addTransceiver(s.track,ud(ud({},s.init),{},{direction:"sendonly"})),Array.isArray(c.init.sendEncodings)&&1===c.init.sendEncodings.length&&(c.init.sendEncodings=uy(u=c.init.sendEncodings).call(u,(function(e){return delete e.rid,e}))),t.videoTransceiver=this._peerConnection.addTransceiver(c.track,ud(ud({},c.init),{},{direction:"sendonly"})),d=RC(),CP.rtcBeginCreateOffer(rP.UP,"",""),e.next=9,this._createQueue.add();case 9:return l=e.sent,CP.rtcCreateOffer(0,nP.UP,"","",RC()-d),h=t.audioTransceiver.mid,f=t.videoTransceiver.mid,t.audioMid=h,t.videoMid=f,v=null,_=null,(m=zL.parse(l)).media=null===(r=m.media)||void 0===r?void 0:uy(r).call(r,(function(e){return"".concat(e.mid)===h?v=e:"".concat(e.mid)===f&&(_=e),e})),null!==(n=this._context)&&void 0!==n&&n.pcKillSwitch.ctor_encodedinsetablestream_add&&HL()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),e.abrupt("return",{partialSdp:gU(m,v,_,!1),audioMid:h,videoMid:f,type:"incroffer",semantics:"unified-plan",videoDescriptions:a,subVideoDescriptions:o,audioTransceiverInit:s,videoTransceiverInit:c});case 22:case"end":return e.stop()}}),e,this)}))),function(e){return d.apply(this,arguments)})},{key:"subscribe",value:(u=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return KF.print("subscribe()","streamId: ".concat(t.streamId)),u=!1,d=!1,l=void 0,h=void 0,t.virtual?u=!0:(r.multiChatMode||(u=!0),d=!0),u&&(t.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"})),d&&(t.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"})),p=RC(),CP.rtcBeginCreateOffer(rP.UP,t.streamId,t.userId),e.next=12,this._createQueue.add();case 12:if(f=e.sent,CP.rtcCreateOffer(0,nP.UP,t.streamId,t.userId,RC()-p),v=null!==(n=null===(i=t.audioTransceiver)||void 0===i?void 0:i.mid)&&void 0!==n?n:void 0,_=null!==(a=null===(o=t.videoTransceiver)||void 0===o?void 0:o.mid)&&void 0!==a?a:void 0,m=zL.parse(f),null===(s=m.media)||void 0===s||s.forEach((function(e){"".concat(e.mid)===v?l=e:"".concat(e.mid)===_&&(h=e)})),v&&l||(v="audio_".concat(_),l=ud(ud({},this._aRecvonlyOfferTpl),{},{mid:v})),t.audioMid=v,t.videoMid=_,y=void 0,r.multiChatMode||t.virtual||!this._aSendonlyAnswerTpl||!this._aSendonlyAnswerTpl){e.next=29;break}return y=this._generateAllSsrc(),A=ud(ud(ud({},this._aSendonlyAnswerTpl),this._answerIce),{},{mid:v,msid:xm(g=xm(S="".concat(t.streamId)).call(S,null!==(E=this._context)&&void 0!==E&&E.avSync?"":"-audio"," ")).call(g,t.streamId,"-audio"),ssrcs:_U(t.streamId,"audio",y.audio)}),R=ud(ud(ud({},this._vSendonlyAnswerTpl),this._answerIce),{},{mid:_,msid:xm(b=xm(k="".concat(t.streamId)).call(k,null!==(T=this._context)&&void 0!==T&&T.avSync?"":"-video"," ")).call(b,t.streamId,"-video")},mU(t.streamId,y,{flexfec:this._enableSubFlexfec})),e.next=28,this._internalSetRemoteDescription([A,R],t);case 28:null===(I=y)||void 0===I||delete I.next;case 29:return null!==(c=this._context)&&void 0!==c&&c.pcKillSwitch.ctor_encodedinsetablestream_add&&HL()&&(t.initVideoEncodedTransform(),t.initAudioEncodedTransform()),e.abrupt("return",{partialSdp:gU(m,l,h,!1),audioMid:v,videoMid:_||"",type:"incroffer",semantics:"unified-plan",audioTransceiverInit:t.audioTransceiver?{track:"audio",init:{direction:"recvonly"}}:void 0,videoTransceiverInit:t.videoTransceiver?{track:"video",init:{direction:"recvonly"}}:void 0,allSsrc:y});case 31:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"handleAck",value:(c=m_(Im.mark((function e(t){var r,n,i,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.signalingAck,n=t.stream,(i=t.action)!==xF.unpublish&&i!==xF.unsubscribe&&i!==xF.removetrack){e.next=5;break}return e.next=4,this.close(n);case 4:return e.abrupt("return",n.streamId||"");case 5:if(!t.generatorSsrc){e.next=8;break}return KF.print("already set remote"),e.abrupt("return","");case 8:return a=zL.parse(null==r?void 0:r.sdp),e.next=11,this._internalSetRemoteDescription(a.media,n);case 11:return e.abrupt("return","");case 12:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"_internalSetRemoteDescription",value:(s=m_(Im.mark((function e(t,r){var n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.forEach((function(e){"audio"===(e=ud(ud({},e),n._answerIce)).type&&(r.audioMid?(e.mid=r.audioMid,n._midMap.set(r.audioMid,e)):n._midMap.set(e.mid,e)),"video"===e.type&&(r.videoMid?(e.mid=r.videoMid,n._midMap.set(r.videoMid,e)):n._midMap.set(e.mid,e))})),r instanceof AF?this.handlePublishAction({stream:r}):this.handleSubscribeAction({stream:r}),e.next=7,this._applyQueue.add();case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"handlePublishAction",value:function(e){var t,r,n,i,a,o,s,c,u=e.stream,d=u.audioMid?this._midMap.get(u.audioMid):void 0,l=u.videoMid?this._midMap.get(u.videoMid):void 0,h=null!==(t=this._context)&&void 0!==t&&null!==(r=t.serverConfig)&&void 0!==r&&r.audioRed?"RED":"OPUS";("OPUS"!==h&&d&&function(e,t){if(Array.isArray(e.fmtp)&&Array.isArray(e.rtp)){for(var r=0;r<e.rtp.length;r++)if(e.rtp[r].codec.toUpperCase()===t.toUpperCase()){var n;e.rtp.unshift(mk(n=e.rtp).call(n,r,1)[0]);break}var i=[];e.rtp.forEach((function(e){return i.push(e.payload)})),e.payloads=i.join(" ")}}(d,h),null!==(n=this._context)&&void 0!==n&&n.pcKillSwitch.sld_fmtp_opus_add)&&qF.decorateOpusConfig(d,null===(c=this._context)||void 0===c?void 0:c.audioProfileManager);PC&&FC<=87&&qF.removeRtxInMLine(l);var p=null===(i=this._context)||void 0===i||null===(a=i.serverConfig)||void 0===a?void 0:a.videoCodec;p&&l&&AU(l,p),null!==(o=this._context)&&void 0!==o&&o.pcKillSwitch.sld_ext_sdesmid_remove&&PC&&FC>=138&&qF.removeExtSdesMid(l),null!==(s=this._context)&&void 0!==s&&s.pcKillSwitch.sld_fmtp_bitrate_add&&(u.enableSimulcast||NC||!l||this.addBitrateLimit(l,u.videoEncodeConfig[0].maxKbps)),u.audioMid&&d&&this._midMap.set(u.audioMid,d),u.videoMid&&l&&this._midMap.set(u.videoMid,l)}},{key:"handleSubscribeAction",value:function(e){var t,r=e.stream,n=r.audioMid?this._midMap.get(r.audioMid):void 0,i=r.videoMid?this._midMap.get(r.videoMid):void 0;PC||(qF.removeRtpStreamId(n),qF.removeRtpStreamId(i)),null!==(t=this._context)&&void 0!==t&&t.pcKillSwitch.sld_fmtp_opus_add&&qF.decorateOpusConfig(n),rN("IOS_SAFARI_ORIENTATION")||!NC&&!BC||qF.removeExtVideoOrientation(i),r.audioMid&&n&&this._midMap.set(r.audioMid,n),r.videoMid&&i&&this._midMap.set(r.videoMid,i)}},{key:"getDefaultSdp",value:(o=m_(Im.mark((function e(){var t,r,n,i,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=new RTCPeerConnection).addTransceiver("audio",{direction:"recvonly"}),r.addTransceiver("video",{direction:"recvonly"}),e.next=5,r.createOffer();case 5:return n=e.sent,i=zL.parse(n.sdp),this.createAVMlineOfferTpl(n.sdp),a=[],i.media=Gs(t=i.media).call(t,(function(e){if("recvonly"===e.direction){var t="template_".concat(e.type);return e.mid=t,a.push(t),!0}return!1})),i.groups=[{mids:a.join(" "),type:"BUNDLE"}],r.close(),e.abrupt("return",{sdp:zL.write(i),semantics:"unified-plan",type:"incroffer"});case 13:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"rollback",value:(a=m_(Im.mark((function e(t,r,n){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return KF.print("rollback()"),e.abrupt("return",this.close(r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return a.apply(this,arguments)})},{key:"close",value:(i=m_(Im.mark((function e(t,r,n){var i,a,o,s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(KF.print("close()"),i=t.audioMid||r,a=t.videoMid||n,t.audioTransceiver&&i)try{t.audioTransceiver.stop(),delete t.audioTransceiver}catch(c){}if(t.videoTransceiver&&a)try{t.videoTransceiver.stop(),delete t.videoTransceiver}catch(u){}return o=i?this._midMap.get(i):void 0,s=a?this._midMap.get(a):void 0,o&&yU(o),s&&yU(s),i&&o&&this._midMap.set(i,o),a&&s&&this._midMap.set(a,s),e.next=13,this._applyQueue.add();case 13:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return i.apply(this,arguments)})},{key:"setCurrentDescription",value:(n=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._applyQueue.add();case 2:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"createAVMlineOfferTpl",value:function(e){var t=this;zL.parse(e).media.forEach((function(e){"audio"===e.type&&(t._aRecvonlyOfferTpl=e)}))}},{key:"_generateAllSsrc",value:function(){var e=vU(this._nextSsrc);return this._nextSsrc=e.next,e}},{key:"create",value:(r=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return KF.print("RTCPeerConnection create"),e.next=3,this._peerConnection.createOffer();case 3:return t=e.sent,r=t.sdp,e.next=8,this.setLocalDescription(r);case 8:return e.abrupt("return",r);case 9:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"apply",value:(t=m_(Im.mark((function e(){var t,r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return KF.print("RTCPeerConnection apply"),e.next=3,this._peerConnection.createOffer();case 3:return t=e.sent,r=t.sdp,n=zL.parse(r),r=this.generateOffer(n,r),i=this.generateAnswer(n),e.next=11,this.setLocalDescription(r);case 11:return e.next=13,this.setRemoteDescription(i);case 13:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"generateOffer",value:function(e,t){var r,n,i,a=this,o=!1;"v1"===this.getIceVersion()&&PC&&(e.media=uy(n=e.media).call(n,(function(e){return ud(ud({},e),a._offerIce)})),o=!0);null!==(r=this._context)&&void 0!==r&&r.pcKillSwitch.sld_fmtp_opus_add&&(e.media=uy(i=e.media).call(i,(function(e){if("audio"===e.type){var t,r="sendonly"===e.direction;qF.decorateOpusConfig(e,r?null===(t=a._context)||void 0===t?void 0:t.audioProfileManager:void 0)}return e})),o=!0);return o?zL.write(e):t}},{key:"generateAnswer",value:function(e){var t=this,r=[];return e.media.forEach((function(e){if("application"===e.type){e.mid;var n=t._midMap.get(e.mid);return n||(n=t.generateDCAnswer(e),t._midMap.set(e.mid,n)),void r.push(ud({},n))}var i="".concat(e.mid),a=t._midMap.get(i);a||(KF.print("generateInactiveAnswerMLine","mid: %o, mLine: %o",e.mid,e),a=t.generateInactiveAnswerMLine(e)),r.push(a)})),this.createAnswerSdp(r,e.groups)}},{key:"generateInactiveAnswerMLine",value:function(e){return ud(ud(ud({},e),this._answerIce),{},{direction:"inactive"})}},{key:"generateDCAnswer",value:function(e){var t=ud(ud(ud({},e),this._answerIce),{},{sctpmap:{sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144}});return PC&&(delete t.bundleOnly,t.port=9),t}},{key:"getIceVersion",value:function(){var e,t;return null!==(e=this._iceNode)&&void 0!==e&&e.iceParams.clientIceUfrag||null!==(t=this._iceNode)&&void 0!==t&&t.iceParams.clientIcePwd?"v1":"v2"}},{key:"createAnswerSdp",value:function(e,t){this._answerSession;var r=ud({},this._answerSession);return r.media=e,r.groups=t,zL.write(r)}},{key:"destroy",value:function(){xI(CI(p.prototype),"destroy",this).call(this),this._pqueue.destroy(),this._applyQueue.destroy(),this._createQueue.destroy()}}]),p}(xU);HF([function(e,t,r){var n=r.value;return r.value=m_(Im.mark((function e(){var r,i,a,o,s=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return KF.print("SDP Lock","pending task %o",t),e.next=3,this._pqueue.enqueue(0);case 3:for(r=e.sent,KF.print("SDP Lock","running task %o",t),e.prev=5,i=s.length,a=new Array(i),o=0;o<i;o++)a[o]=s[o];return e.next=9,null==n?void 0:n.apply(this,a);case 9:return e.abrupt("return",e.sent);case 10:return e.prev=10,KF.print("SDP Lock","unlocking by task %o",t),r(),e.finish(10);case 14:case"end":return e.stop()}}),e,this,[[5,,10,14]])}))),r}],XF.prototype,"create",1),HF([function(e,t,r){var n=r.value;return r.value=m_(Im.mark((function e(){var r,i,a,o,s=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return KF.print("SDP Lock","pending task %o",t),e.next=3,this._pqueue.enqueue(1);case 3:for(r=e.sent,KF.print("SDP Lock","running task %o",t),e.prev=5,i=s.length,a=new Array(i),o=0;o<i;o++)a[o]=s[o];return e.next=9,null==n?void 0:n.apply(this,a);case 9:return e.abrupt("return",e.sent);case 10:return e.prev=10,KF.print("SDP Lock","unlocking by task %o",t),r(),e.finish(10);case 14:case"end":return e.stop()}}),e,this,[[5,,10,14]])}))),r}],XF.prototype,"apply",1);var qF={decorateOpusConfig:function(e,t){var r,n;if(e){var i=null==e?void 0:Nb(r=e.rtp).call(r,(function(e){return"opus"===e.codec}));if(i&&e.fmtp){var a=Nb(n=e.fmtp).call(n,(function(e){return e.payload===i.payload}));a&&(t&&(a.config=t.getOpusConfigStr()),a.config=JF(a.config))}}},removeRtxInMLine:function(e){var t,r,n,i;if(e){var a=[];e.rtp=Gs(t=e.rtp).call(t,(function(e){return"rtx"===e.codec&&a.push(e.payload),"rtx"!==e.codec})),e.fmtp=Gs(r=e.fmtp).call(r,(function(e){return $m(a).call(a,e.payload)})),e.payloads=null===(n=e.payloads)||void 0===n?void 0:Gs(i=n.split(" ")).call(i,(function(e){return!$m(a).call(a,Dy(e))})).join(" ")}},removeExtSdesMid:function(e){var t;e&&(e.ext=null===(t=e.ext)||void 0===t?void 0:Gs(t).call(t,(function(e){var t;return!$m(t=e.uri).call(t,"sdes:mid")})))},selectCC:function(e,t){var r,n;if(e)if("tcc"===t)e.ext=null===(r=e.ext)||void 0===r?void 0:Gs(r).call(r,(function(e){var t;return-1===Kb(t=e.uri).call(t,"abs-send-time")})),e.rtcpFb=null===(n=e.rtcpFb)||void 0===n?void 0:Gs(n).call(n,(function(e){return"goog-remb"!==e.type}));else if("remb"===t){var i,a;e.rtcpFb=null===(i=e.rtcpFb)||void 0===i?void 0:Gs(i).call(i,(function(e){return"transport-cc"!==e.type})),e.ext=null===(a=e.ext)||void 0===a?void 0:Gs(a).call(a,(function(e){var t;return-1===Kb(t=e.uri).call(t,"transport")}))}},addRRTR:function(e){e&&e.rtp.forEach((function(t){var r;e.rtcpFb||(e.rtcpFb=[]),Nb(r=e.rtcpFb).call(r,(function(e){return e.payload===t.payload&&"rrtr"===e.type}))||e.rtcpFb.push({payload:t.payload,type:"rrtr"})}))},removeRtpStreamId:function(e){var t;e&&(Array.isArray(e.ext)&&(e.ext=Gs(t=e.ext).call(t,(function(e){return"urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id"!==e.uri}))))},decorateSpsPpsIdrInKeyframe:function(e){var t;if(e){var r=Gs(t=e.rtp).call(t,(function(e){return"H264"===e.codec}));r.length&&e.fmtp&&e.fmtp.forEach((function(e){Nb(r).call(r,(function(t){return t.payload===e.payload}))&&(e.config+=";sps-pps-idr-in-keyframe=1")}))}},removeExtVideoOrientation:function(e){var t;e&&(Array.isArray(e.ext)&&(e.ext=Gs(t=e.ext).call(t,(function(e){var t;return!$m(t=e.uri).call(t,"video-orientation")}))))},removeExtFramemarking:function(e){var t;e&&(Array.isArray(e.ext)&&(e.ext=Gs(t=e.ext).call(t,(function(e){var t;return!$m(t=e.uri).call(t,"framemarking")}))))}},WF=function(){function e(){Wd(this,e),sd(this,"queue",[]),sd(this,"processing",!1)}var t;return qd(e,[{key:"enqueue",value:(t=m_(Im.mark((function e(){var t,r,n,i,a,o,s,c,u=this,d=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=d.length>0&&void 0!==d[0]?d[0]:0,n=YF(),i=n.promise,a=n.resolve,o={priority:r,resolve:a},-1===(s=YA(t=this.queue).call(t,(function(e){return e.priority>r})))?this.queue.push(o):mk(c=this.queue).call(c,s,0,o),this.tryProcess(),e.next=8,i;case 8:return this.processing=!0,e.abrupt("return",(function(){u.processing=!1,u.tryProcess()}));case 10:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"destroy",value:function(){this.queue.forEach((function(e){(0,e.resolve)()})),this.queue=[],this.processing=!1}},{key:"tryProcess",value:function(){if(!this.processing){var e=this.queue.shift();e&&e.resolve()}}}]),e}();function YF(){var e=void 0,t=void 0,r=new v_((function(r,n){e=r,t=n}));if(!e||!t)throw Error("Broken Implement of Promise");return{promise:r,resolve:e,reject:t}}var QF,JF=function(e){var t,r={};return e.split(";").forEach((function(e){var t=$T(e.split("="),2),n=t[0],i=t[1];n&&i&&(r[n]=i)})),r["sprop-stereo"]=1,r.stereo=1,uy(t=on(r)).call(t,(function(e){var t;return xm(t="".concat(e,"=")).call(t,r[e])})).join(";")},ZF=function(e,t){return null!=t&&t.enableFallbackHandler?new BF(e,t):null!=t&&t.enableStandardHandler?new XF(e,t):PC?new VF(e,t):new LF(e,t)},$F=new Jw("Locker",2),eB=1,tB=function(){function e(t){var r;Wd(this,e),sd(this,"lockingPromise",v_.resolve()),sd(this,"locks",0),sd(this,"name",""),sd(this,"lockId",void 0),this.lockId=eB++,t&&(this.name=t),$F.print(xm(r="[lock-".concat(this.name,"-")).call(r,this.lockId,"] is created."))}return qd(e,[{key:"isLocked",get:function(){return this.locks>0}},{key:"lock",value:function(){var e,t,r,n=this;this.locks+=1,$F.print(xm(e=xm(t="[lock-".concat(this.name,"-")).call(t,this.lockId,"] locked, current queue ")).call(e,this.locks,"."));var i=new v_((function(e){r=function(){var t,r;n.locks-=1,$F.print(xm(t=xm(r="[lock-".concat(n.name,"-")).call(r,n.lockId,"] unlocked, current queue ")).call(t,n.locks,".")),e()}})),a=this.lockingPromise.then((function(){return r}));return this.lockingPromise=this.lockingPromise.then((function(){return i})),a}}]),e}(),rB=function(e){return 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",e.ON_SUBTITLE_STATE_CHANGED="ON_SUBTITLE_STATE_CHANGED",e.ON_SUBTITLE_MESSAGE_RECEIVED="ON_SUBTITLE_MESSAGE_RECEIVED",e.ON_VIDEO_STREAM_BANNED="ON_VIDEO_STREAM_BANNED",e.ON_AUDIO_STREAM_BANNED="ON_AUDIO_STREAM_BANNED",e}(rB||{}),nB=function(e){return 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",e}(nB||{}),iB=function(e){return e[e.PUB=0]="PUB",e[e.UNPUB=1]="UNPUB",e}(iB||{}),aB=function(e){return e[e.SUB=0]="SUB",e[e.UNSUB=1]="UNSUB",e}(aB||{}),oB=(sd(QF={},Dd.communication,[0]),sd(QF,Dd.chat,[0]),sd(QF,Dd.chatRoom,[1,"IES_chatroom"]),sd(QF,Dd.coHost,[1,"IES_PK"]),sd(QF,Dd.meeting,[16]),sd(QF,Dd.classRoom,[0]),QF),sB=od,cB=tc,uB=function(e,t,r,n){for(var i,a=n>1?void 0:n?cB(t,r):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n?i(t,r,a):i(a))||a);return n&&a&&sB(t,r,a),a},dB=new Jw("MediaServerClient",2),lB=6e4,hB=function(e){return e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting",e}(hB||{}),pB=function(e,t){dB.print(e,"userId: %o, subAudio: %o, subVideo: %o, audioMid: %o, videoMid: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.audioMid,t.videoMid,t.sequenceId)},fB=function(e){DI(b,e);var t,r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E=YI(b);function b(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:CP;return Wd(this,b),sd(eI(t=E.call(this)),"id",void 0),sd(eI(t),"_token",void 0),sd(eI(t),"_appId",void 0),sd(eI(t),"_roomId",void 0),sd(eI(t),"_roomAttributes",void 0),sd(eI(t),"_clientId",void 0),sd(eI(t),"_businessId",void 0),sd(eI(t),"_userInfo",void 0),sd(eI(t),"_useCloudProxy",void 0),sd(eI(t),"_expectedIDC",void 0),sd(eI(t),"_authorization",void 0),sd(eI(t),"_sessionId",void 0),sd(eI(t),"_iceConfigRequestManager",void 0),sd(eI(t),"_ontrackCallbackMap",new bE),sd(eI(t),"_subResolves",{}),sd(eI(t),"supportConcurrent",!1),sd(eI(t),"_handler",void 0),sd(eI(t),"_pubSubLock",void 0),sd(eI(t),"_joinLeaveLock",void 0),sd(eI(t),"_state",void 0),sd(eI(t),"_dataChannelSignal",void 0),sd(eI(t),"_subConfig",{}),sd(eI(t),"monitor",void 0),sd(eI(t),"_roomProfile",Dd.communication),sd(eI(t),"_context",void 0),sd(eI(t),"_subStreamQueue",{}),t.id=null==e?void 0:e.id,t.monitor=r,t._pubSubLock=new tB("pubSubLock"),t._joinLeaveLock=new tB("joinLeaveLock"),t._state="disconnected",t._roomAttributes={multiChatMode:!1,bigRoomMode:!1},t._context=e,t.on("SUB_END",(function(e){return t._handleSubStreamQueue(e)})),t}return qd(b,[{key:"_addHandlerEvents",value:function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){dB.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(hN.ABNORMAL_DISCONNECTION)}))}},{key:"_addSignalEventHandler",value:function(){var e,t=this;[dN.ON_ADD_STREAM,dN.ON_ADD_STREAM_LIST,dN.ON_REMOVE_STREAM,dN.ON_REMOVE_STREAM_LIST,dN.USER_CONNECTION,dN.USER_CONNECTION_LIST,dN.USER_DISCONNECTION,dN.USER_DISCONNECTION_LIST,dN.ON_UPDATE_STREAM_ATTRIBUTES,dN.ON_UPDATE_ROOM_ATTRIBUTES,dN.ON_PUSH_TRACK,dN.NODE_CHANGE,dN.ON_CUSTOM_MESSAGE,dN.USER_MESSAGE_RECEIVED,dN.USER_BINARY_MESSAGE_RECEIVED,dN.POST_PROCESSING_MESSAGE,dN.ON_USER_TOKEN_WILL_EXPIRE,dN.STREAM_CONTROL_MESSAGE,dN.ON_UPDATE_USER_ATTRIBUTES,dN.ON_SPEAKER_CHANGE,lN.RSCP,lN.RTT,dN.ON_STREAM_FAILED].forEach((function(e){var r;null===(r=t._dataChannelSignal)||void 0===r||r.on(e,(function(r){t.safeEmit(e,r)}))})),null===(e=this._dataChannelSignal)||void 0===e||e.once("close",(function(){dB.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(hN.ABNORMAL_DISCONNECTION)}))}},{key:"_removeSignalEventHandler",value:function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()}},{key:"connectionState",get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(hN.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)}},{key:"businessId",set:function(e){this._businessId=e}},{key:"connect",value:(S=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d=this,l=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=l.length>1&&void 0!==l[1]?l[1]:"",n=l.length>2&&void 0!==l[2]?l[2]:"",i=l.length>3&&void 0!==l[3]?l[3]:{},this.connectionState="connecting",this._appId=t,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),!i.node){e.next=11;break}a=[i.node],BP("es.join.nodeChange",i),e.next=20;break;case 11:return v_.resolve().then((function(){return d.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new GN,e.next=15,null===(o=this._iceConfigRequestManager)||void 0===o?void 0:o.getAccessNode(t,r,n,YP.getDeviceId(),null==i?void 0:i.reason,null==i?void 0:i.feedbackNode,this._useCloudProxy,this._expectedIDC);case 15:if(a=e.sent){e.next=19;break}throw BP("es.join.getNodeFailed",""),new pR(lR.ICE_SERVER_WRONG,"get ICE config failed");case 19:BP("es.join.getNodeSuccess",a);case 20:return v_.resolve().then((function(){return d.emit("onEstablishConnectionHook")})),e.prev=21,c=!1,u=uy(a).call(a,(function(e){var t=ZF(d.monitor,d._context);return t.connect(e).then((function(r){var n;d.emit("onConnectSuccessHook",null===(n=a)||void 0===n?void 0:n.length),c?t.destroy():(c=!0,s=r,d.safeEmit("prevIceNode",e),d._handler=t,OP.setStats({connection_id:t.connection_id}),d.supportConcurrent="chrome"===t.name,d._addHandlerEvents())})).catch((function(e){throw t.destroy(),e}))})),e.next=26,QC(u);case 26:dB.print("join","establish peerConnection success"),e.next=33;break;case 29:throw e.prev=29,e.t0=e.catch(21),this.connectionState="disconnected",new pR(lR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t0);case 33:if(!s){e.next=39;break}this._dataChannelSignal=new FN(this.id,s),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),e.next=41;break;case 39:throw this.connectionState="disconnected",new pR(lR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed");case 41:case"end":return e.stop()}}),e,this,[[21,29]])}))),function(e){return S.apply(this,arguments)})},{key:"join",value:(g=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m=this,y=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=y.length>1&&void 0!==y[1]?y[1]:{},i=y.length>2&&void 0!==y[2]&&y[2],a=y.length>3?y[3]:void 0,dB.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",t,n,i,a),this._appId=t.appId,this._token=t.token,this._roomId=t.roomId,this._clientId=t.userInfo.userId,this._businessId=t.userInfo.businessId,this._userInfo=t.userInfo,this._useCloudProxy=t.useCloudProxy,this._expectedIDC=t.expectedIDC,this._roomProfile=t.roomProfile,this._sessionId=n.sessionId,e.next=16,this.connect(this._appId,this._roomId,this._clientId,n);case 16:return e.t0=xC.token2auth(this._appId,this._roomId,this._clientId,this._token),e.t1=this._sessionId||"",e.t2=Date.now(),e.t3=a,e.t4={extra_info:this._userInfo.extraInfo,role:this._userInfo.role},e.next=23,null===(r=this._handler)||void 0===r?void 0:r.getDefaultSdp();case 23:return e.t5=e.sent,e.next=26,DL();case 26:return e.t6=e.sent,e.t7=window.navigator.userAgent,e.t8=eN.VERSION,e.t9=YP.getDeviceId(),e.t10=this._appId,e.t11=this._roomId,e.t12=this._clientId,e.t13=this._businessId,e.t14=this._useCloudProxy,e.t15=oB[this._roomProfile]?oB[this._roomProfile][0]+"":"0",e.t16={supportedCodecs:e.t6,deviceType:"web",userAgent:e.t7,sdkVersion:e.t8,deviceId:e.t9,appId:e.t10,roomId:e.t11,userId:e.t12,businessId:e.t13,enableCloudProxy:e.t14,channelProfile:e.t15},e.t17={supportTokenExpireCallBack:!0,enableSceneConfigV2:!0,enableUnBundleMode:!0,enableAudioMux:!0,enableBigRoomMode:!0,needNegotiateSDP:!0},e.t18=ny({requireICEUfragV2:!0}),o={Authorization:e.t0,sessionId:e.t1,timestamp:e.t2,controlMessage:e.t3,userAttributes:e.t4,sdpInfo:e.t5,params:e.t16,options:e.t17,accessParams:e.t18},v_.resolve().then((function(){return m.emit("onSendingJoinMessageHook")})),e.prev=41,c=i?"reconnected":"joinRoom",e.next=45,this._dataChannelSignal.sendSignaling(c,o);case 45:return u=e.sent,dB.print("join","send join message success"),d=u.config||{},l=d.engine_WEB,this._authorization=o.Authorization,this.connectionState="connected",YP.setEngineWebConfig(this._appId,this._roomId,l),this._context&&(this._context.serverConfig={videoCodec:(null==l?void 0:l.video_codec)||"H264",audioRed:!(null==l||!l.pub_audio_red),muteReplaceUnsub:!(null===(h=u.config)||void 0===h||!h.mute_replace_unsub),simulcastOnDemand:!(PC||!1===(null===(p=u.config)||void 0===p||null===(f=p.engine_VPM)||void 0===f||null===(v=f.ondemand)||void 0===v?void 0:v.enable))},"boolean"==typeof(null==l?void 0:l.av_sync)&&(this._context.avSync=l.av_sync)),EF.audioStallConfig=l,null!=u&&null!==(s=u.relayMessage)&&void 0!==s&&s.sdp&&(null===(_=this._handler)||void 0===_||_.createAVMlineAnswerTpl(u.relayMessage.sdp)),e.abrupt("return",u);case 57:if(e.prev=57,e.t19=e.catch(41),this.connectionState="disconnected",!((null===e.t19||void 0===e.t19?void 0:e.t19.code)>=700&&(null===e.t19||void 0===e.t19?void 0:e.t19.code)<800)){e.next=62;break}throw new pR(lR.INVALID_TOKEN,(null===e.t19||void 0===e.t19?void 0:e.t19.message)||"Invalid token");case 62:if(200===(null===e.t19||void 0===e.t19?void 0:e.t19.code)){e.next=64;break}throw new pR(lR.JOIN_ROOM_FAILED,(null===e.t19||void 0===e.t19?void 0:e.t19.message)||"Join room failed");case 64:case"end":return e.stop()}}),e,this,[[41,57]])}))),function(e){return g.apply(this,arguments)})},{key:"publish",value:(y=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dB.print("publish()","localStream: %o",t),r=t.videoTrack,n=t.audioTrack,i=RC(),a="",o="",e.prev=6,e.next=9,null===(s=this._handler)||void 0===s?void 0:s.publish(t);case 9:if(m=e.sent){e.next=12;break}throw new pR(lR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 12:if("H264"!==(null===(c=this._context)||void 0===c||null===(u=c.serverConfig)||void 0===u?void 0:u.videoCodec)){e.next=18;break}return e.next=15,FL();case 15:if(e.sent){e.next=18;break}throw new pR(lR.PUBLISH_FAILED,"h264 is not supported");case 18:return a=m.audioMid,o=m.videoMid,t.pubAttributes={localaudio:!!n,localvideo:!!r,videostream:t.pubVideo,audiostream:t.pubAudio,extvideo:!!(r instanceof UV),extaudio:!!(n instanceof VV)},y={attributes:ud({videoDescriptions:m.videoDescriptions},t.pubAttributes),audio:!0,video:!0,screen:t.isScreen,audioMid:a,videoMid:o,sdpInfo:{msid:t.stream.id,type:m.type,sdp:m.partialSdp,semantics:m.semantics}},(g=t.enableSimulcast&&(null===(d=this._context)||void 0===d||null===(l=d.serverConfig)||void 0===l?void 0:l.simulcastOnDemand)&&(null===(h=m.subVideoDescriptions)||void 0===h?void 0:h.length))&&(y.attributes.subVideoDescriptions=m.subVideoDescriptions),e.next=26,null===(p=this._dataChannelSignal)||void 0===p?void 0:p.sendSignaling("publish",y);case 26:if(200===(null==(S=e.sent)?void 0:S.code)){e.next=29;break}throw new pR(lR.PUBLISH_FAILED,(null==S?void 0:S.message)||"publish failed");case 29:if(CP.rtcRecvAnswer(0,oP.INCRANSWER,(null==S||null===(f=S.relayMessage)||void 0===f?void 0:f.sequenceId)||0,null==S||null===(v=S.relayMessage)||void 0===v?void 0:v.sdp,sP.UP,"",""),E=new v_((function(e,r){var n,i,s;null===(n=k._handler)||void 0===n||n.handleAck({action:xF.publish,streamId:S.streamId,audioMid:a,videoMid:o,audioTransceiverInit:null==m?void 0:m.audioTransceiverInit,videoTransceiverInit:null==m?void 0:m.videoTransceiverInit,signalingAck:{sdp:null==S||null===(i=S.relayMessage)||void 0===i?void 0:i.sdp,sequenceId:null==S||null===(s=S.relayMessage)||void 0===s?void 0:s.sequenceId},sdp:m.sdp,stream:t,onSuccess:function(){dB.print("publish()","publish success"),e(0)}})})),"chrome"!==(null===(_=this.handler)||void 0===_?void 0:_.name)){e.next=34;break}return e.next=34,E;case 34:return g&&this.emit(lN.RSCP,[{StreamIds:[t.stream.id],Metadata:{VideoIndex:0}}]),t.streamId=S.streamId,t.videoMid=o,t.audioMid=a,t.subVideoDescriptions=m.subVideoDescriptions,this.monitor.rtcPublishStat(cP.SUCCESS,uP.W_0,i,dP.UNKNOWN),t.statsReport.setLocalStreamStatsEvtInterval(this,this._handler,this.monitor,this._context),e.abrupt("return");case 44:return e.prev=44,e.t0=e.catch(6),e.t0 instanceof Error&&this.monitor.rtcPublishStat(cP.FAIL,uP.W_0,i,e.t0.message),e.next=49,null===(b=this._handler)||void 0===b?void 0:b.rollback(t.stream.id,t);case 49:throw e.t0;case 50:case"end":return e.stop()}}),e,this,[[6,44]])}))),function(e){return y.apply(this,arguments)})},{key:"updatePubTrack",value:(m=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O,D;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:dB.print("updatePubTrack()","localStream: %o",t),i=t.videoTrack,a=t.audioTrack,o=t.pubAudio,s=t.pubVideo,c=null==a?void 0:a.getTrack("preprocessing"),u=null==i?void 0:i.getTrack("preprocessing"),s&&u?null===(d=t.videoTransceiver)||void 0===d||d.sender.replaceTrack(u):null===(l=t.videoTransceiver)||void 0===l||l.sender.replaceTrack(null),null===(r=this._handler)||void 0===r||r.updateMaxBitrate(t),o&&c?(p=a.mixType,(f=a.mixedAudioTrack)&&p!==Gd.PLAYOUT&&!0===c.enabled&&(c=f),null===(h=t.audioTransceiver)||void 0===h||h.sender.replaceTrack(c)):(null===(v=t.audioTransceiver)||void 0===v||v.sender.replaceTrack(null),this.monitor.rtcInvokeStatus("null",0,"MediaClient.updatePubTrack(audio)","",0));try{this.monitor.rtcInvokeStatus(ny({audioStreamTrack:rw(c),videoStreamTrack:rw(u)}),0,"MediaClient.updatePubTrack","",0)}catch(PX){}for(m={},y=0,g=bR(_={localaudio:!!a,localvideo:!!i,videostream:s,audiostream:o,extvideo:!!(i instanceof UV),extaudio:!!(a instanceof VV)});y<g.length;y++)S=$T(g[y],2),E=S[0],(b=S[1])!==uI(t.pubAttributes,E)&&ux(m,E,b);if(on(m).length){e.next=13;break}return e.abrupt("return");case 13:return t.observer&&(k=t.observer,T=m.audiostream,I=m.videostream,A=m.localaudio,R=m.localvideo,C=m.extaudio,w=m.extvideo,void 0!==R?void 0!==w?k.setPushVideo(w):k.setEnableVideo(R):void 0!==I&&k.setUnmuteVideo(I),void 0!==A?void 0!==C?k.setPushAudio(C):k.setEnableAudio(A):void 0!==T&&k.setUnmuteAudio(T)),t.pubAttributes=_,x={roomId:this._roomId,streamId:t.streamId,attributes:m},e.next=18,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateStreamAttributes",x);case 18:if(200===(null==(O=e.sent)?void 0:O.code)){e.next=21;break}throw new pR(lR.UPDATE_TRACK_FAILED,(null==O?void 0:O.message)||"update track failed");case 21:if(!PC){e.next=24;break}return e.next=24,null===(D=this._handler)||void 0===D?void 0:D.setCurrentDescription();case 24:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"updateToken",value:(_=m_(Im.mark((function e(t){var r,n,i,a,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dB.print("updateToken()","newToken: %o",t),this._token=t,this._appId&&null!==(r=this._userInfo)&&void 0!==r&&r.userId&&this._roomId){e.next=4;break}return e.abrupt("return");case 4:return i={roomId:this._roomId,userId:null===(n=this._userInfo)||void 0===n?void 0:n.userId,appId:this._appId,token:"Bearer ".concat(t)},e.prev=5,e.next=8,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateToken",i);case 8:if(200===(null==(o=e.sent)?void 0:o.code)){e.next=11;break}throw new pR(lR.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 11:e.next=16;break;case 13:throw e.prev=13,e.t0=e.catch(5),new pR(lR.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 16:case"end":return e.stop()}}),e,this,[[5,13]])}))),function(e){return _.apply(this,arguments)})},{key:"unpublish",value:(v=m_(Im.mark((function e(t){var r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dB.print("unpublish()","localStream: %o",t),i={roomId:this._roomId,initStreamId:t.initStreamId,streamId:t.streamId},null===(r=this._dataChannelSignal)||void 0===r||r.sendSignaling("unpublish",i),e.next=5,null===(n=this._handler)||void 0===n?void 0:n.handleAck({action:xF.unpublish,audioMid:t.audioMid,videoMid:t.videoMid,stream:t,streamId:t.streamId});case 5:t.statsReport.unpublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"subscribe",value:(f=m_(Im.mark((function e(t,r,n){var i=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new v_(function(){var e=m_(Im.mark((function e(a,o){var s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O,D,P,N,M,L;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.streamState!==IF.SUB_ED){e.next=2;break}return e.abrupt("return",i._updateSubTrack(t,r,aB.SUB).then(a,o));case 2:if(t.streamState!==IF.SUB_ING){e.next=7;break}return i._subStreamQueue[t.streamId]||(i._subStreamQueue[t.streamId]=[]),dB.print("_subStreamQueue","streamId: %o, enqueue",t.streamId),i._subStreamQueue[t.streamId].push({fn:i.subscribe,args:[t,r,n],resolve:a,reject:o}),e.abrupt("return");case 7:if(dB.print("subscribe()","mediaType: %o",r),pB("subscribe()",t),t.streamState=IF.SUB_ING,c=!1,u=!1,ZC(r)&&(u=!0),$C(r)&&(c=!0),c||!i.multiChatMode()){e.next=17;break}return t.streamState=IF.INIT,i.emit("SUB_END",t.streamId),e.abrupt("return",a(null));case 17:return d=RC(),l=t.subVideo,h=[],p=!i.multiChatMode(),i._subResolves[t.streamId]||(i._subResolves[t.streamId]=[]),h.push(new v_((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new pR(lR.TIME_OUT,"wait video timeout for userId: ".concat(t.userId)))}),lB);t.on("ontrack",(function r(i){"video"===i.mediaType&&(dB.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p&&h.push(new v_((function(e,r){i._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new pR(lR.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),lB);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(dB.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),f=function(e){t.ontrack(e)},null===(s=i._handler)||void 0===s||s.on("ontrack",f),i._ontrackCallbackMap.set(t,f),e.prev=27,e.next=30,null===(v=i._handler)||void 0===v?void 0:v.subscribe(t,{multiChatMode:i.multiChatMode()});case 30:if(k=e.sent){e.next=33;break}throw new pR(lR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 33:return T=k.audioMid,I=k.videoMid,t.subVideo=c,A={spatialLayer:(null==n?void 0:n.spatialLayer)||0,temporalLayer:0,spatialSubLayer:(null==n?void 0:n.spatialSubLayer)||-1},R={audio:!i.multiChatMode(),video:!0,data:!0,screen:t.isScreen,browser:"chrome-stable",videoMid:I,audioMid:T,sdpInfo:{sdp:null==k?void 0:k.partialSdp,semantics:null==k?void 0:k.semantics,type:null==k?void 0:k.type},streamUserId:t.userId,streamId:t.streamId,config:{enableMediaType:{audio:!!i.multiChatMode()||u,video:c},qualityLayer:A},extra:{enableSendRTT:!0}},C=i._context||{},w=C.subscribeFallbackOption,x=C.userPriority,"number"==typeof w&&(R.config.fallbackOption=w),null!=x&&x.has(t.userId)&&(R.config.priority=x.get(t.userId)),null!=k&&k.allSsrc&&(R.extra.subscribeSSRC=k.allSsrc),e.next=44,null===(_=i._dataChannelSignal)||void 0===_?void 0:_.sendSignaling("subscribe",R);case 44:if(200===(null==(O=e.sent)?void 0:O.code)){e.next=47;break}throw new pR(lR.SUBSCRIBE_FAILED,(null==O?void 0:O.message)||"subscribe failed");case 47:return D=null==O?void 0:O.relayMessage,P=D.audioMid,N=D.videoMid,sd(m={},T,P),sd(m,I,N),M=m,dB.print("sub midmap",t.userId,M),t.videoMid=I,t.audioMid=T,t.subMediaType=r,t.streamState=IF.SUB_ED,t.subLayer=A,CP.rtcRecvAnswer(0,oP.INCRANSWER,(null==O||null===(y=O.relayMessage)||void 0===y?void 0:y.sequenceId)||0,null==O||null===(g=O.relayMessage)||void 0===g?void 0:g.sdp,sP.DOWN,t.streamId,t.userId),e.next=58,null===(S=i._handler)||void 0===S?void 0:S.handleAck({action:xF.subscribe,streamId:t.streamId,audioMid:T,videoMid:I,audioTransceiverInit:null==k?void 0:k.audioTransceiverInit,videoTransceiverInit:null==k?void 0:k.videoTransceiverInit,signalingAck:{sdp:null==O||null===(E=O.relayMessage)||void 0===E?void 0:E.sdp,sequenceId:null==O||null===(b=O.relayMessage)||void 0===b?void 0:b.sequenceId},stream:t,sdp:k.sdp,generatorSsrc:!!k.allSsrc});case 58:return e.next=60,v_.all(h);case 60:i.multiChatMode()||(t.subAudio=u),i.monitor.rtcSubscribeStat(lP.SUCCESS,d,hP.UNKNOWN,t.userId),i._context&&t.statsReport.setRemoteStreamStatsEvtInterval(i,i._handler,i.monitor,i._context),a(null),i.emit("SUB_END",t.streamId),e.next=76;break;case 67:return e.prev=67,e.t0=e.catch(27),e.t0 instanceof Error&&i.monitor.rtcSubscribeStat(lP.FAIL,d,e.t0.message,t.userId),t.subVideo=l,t.streamState=IF.INIT,e.next=74,null===(L=i._handler)||void 0===L?void 0:L.rollback(t.streamId,t);case 74:o(e.t0),i.emit("SUB_END",t.streamId);case 76:case"end":return e.stop()}}),e,null,[[27,67]])})));return function(t,r){return e.apply(this,arguments)}}()));case 1:case"end":return e.stop()}}),e)}))),function(e,t,r){return f.apply(this,arguments)})},{key:"_handleSubStreamQueue",value:function(e){var t,r=this;if(null!==(t=this._subStreamQueue[e])&&void 0!==t&&t.length){dB.print("_subStreamQueue","streamId: %o, exec",e);var n=this._subStreamQueue[e].shift(),i=n.fn,a=n.args,o=n.resolve,s=n.reject;i.apply(this,a).then(o,s).finally((function(){return r._handleSubStreamQueue(e)}))}else dB.print("_subStreamQueue","streamId: %o, END",e)}},{key:"controlMessage",value:(p=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dB.print("controlMessage()","params: %o",t),n=t,"transcode"===t.type&&(n.roomId=this._roomId),e.next=5,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("controlMessage",n);case 5:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"updateUserAttributes",value:(h=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dB.print("updateUserAttributes()","attributes: %o",t),e.next=3,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:t});case 3:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"updateSubTrack",value:(l=m_(Im.mark((function e(t,r,n){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this._updateSubTrack(t,r,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return l.apply(this,arguments)})},{key:"updateSubTrackLayer",value:(d=m_(Im.mark((function e(t,r){var n,i,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dB.print("updateSubTrack()","subLayer: %o",r),t.subLayer.spatialLayer!==r.spatialLayer||t.subLayer.spatialSubLayer!==r.spatialSubLayer){e.next=4;break}return dB.print("updateSubTrack()","subLayer no change"),e.abrupt("return");case 4:return i={roomId:this._roomId,streamList:[t.streamId],streamId:t.streamId,streamUserId:t.userId,config:{qualityLayer:r}},e.next=7,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateSubscribe",i);case 7:if(200===(null==(a=e.sent)?void 0:a.code)){e.next=10;break}throw new pR(lR.UPDATE_TRACK_FAILED,(null==a?void 0:a.message)||"update track failed");case 10:return t.subLayer=r,e.abrupt("return",t);case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return d.apply(this,arguments)})},{key:"_updateSubTrack",value:(u=m_(Im.mark((function e(t,r,n){var i,a,o,s,c,u,d,l,h,p,f;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dB.print("updateSubTrack()","mediaType: %o",r),pB("updateSubTrack()",t),!this.multiChatMode()||r!==Sd.AUDIO){e.next=5;break}return dB.print("updateSubTrack","multiChatMode mediaType only audio"),e.abrupt("return",t);case 5:return o=0,o=n===aB.SUB?t.subMediaType|r:t.subMediaType-(t.subMediaType&r),dB.print("updateSubTrack","prev: %o, direction: %o, mediaType: %o, newMediaType: %o",t.subMediaType,n,r,o),t.subMediaType===o&&dB.print("updateSubTrack","mediaType no change"),s=!1,c=!1,ZC(o)&&(c=!0),$C(o)&&(s=!0),u={roomId:this._roomId,streamList:[t.streamId],config:{enableMediaType:{video:s,audio:!!this.multiChatMode()||c}}},d=this._context||{},l=d.subscribeFallbackOption,h=d.userPriority,"number"==typeof l&&(u.config.fallbackOption=l),null!=h&&h.has(t.userId)&&(u.config.priority=h.get(t.userId)),e.next=18,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",u);case 18:if(200===(null==(p=e.sent)?void 0:p.code)){e.next=21;break}throw new pR(lR.UPDATE_TRACK_FAILED,(null==p?void 0:p.message)||"update track failed");case 21:return this.multiChatMode()||(null===(f=t.observer)||void 0===f||f.setUnmuteAudio(c),t.subAudio=c),null===(a=t.observer)||void 0===a||a.setUnmuteVideo(s),t.subVideo=s,t.subMediaType=o,e.abrupt("return",t);case 26:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return u.apply(this,arguments)})},{key:"subscribe4pushTrack",value:(c=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return dB.print("subscribe4pushTrack()","streamInfo: %o",r),pB("subscribe4pushTrack()",t),t.subAudio=!0,null===(n=t.observer)||void 0===n||n.setPushTrack(!0),e.next=6,null===(i=this._handler)||void 0===i?void 0:i.subscribe(t,{multiChatMode:this.multiChatMode()});case 6:if(s=e.sent){e.next=9;break}throw new pR(lR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 9:return c=s.audioMid,u=s.videoMid,(d=[]).push(new v_((function(e,r){var n=setTimeout((function(){return r(new pR(lR.TIME_OUT,"wait audio timeout for userId: ".concat(t.userId)))}),lB);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(dB.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),l=function(e){t.ontrack(e)},null===(a=this._handler)||void 0===a||a.on("ontrack",l),this._ontrackCallbackMap.set(t,l),e.next=18,null===(o=this._handler)||void 0===o?void 0:o.handleAck({action:xF.pushtrack,streamId:t.streamId,audioMid:c,videoMid:u,stream:t,audioTransceiverInit:null==s?void 0:s.audioTransceiverInit,videoTransceiverInit:null==s?void 0:s.videoTransceiverInit,signalingAck:null==r?void 0:r.message,sdp:s.sdp});case 18:return e.next=20,v_.all(d);case 20:this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 21:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"unsubscribe4removeTrack",value:(s=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:pB("unsubscribe4removeTrack()",t),dB.print("unsubscribe4removeTrack()","sequenceId: ",r.sequenceId);case 2:case"end":return e.stop()}}),e)}))),function(e,t){return s.apply(this,arguments)})},{key:"unsubscribe",value:(o=m_(Im.mark((function e(t,r){var n,i,a=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=a.length>2&&void 0!==a[2]&&a[2],pB("unsubscribe()",t),!n){e.next=4;break}return e.abrupt("return",this._unsubscribe(t,r));case 4:if(!this.multiChatMode()||!$C(r)){e.next=6;break}return e.abrupt("return",this._unsubscribe(t,r));case 6:if(i=t.subMediaType-(t.subMediaType&r),this.multiChatMode()||i!==uF.NONE){e.next=9;break}return e.abrupt("return",this._unsubscribe(t,r));case 9:return e.abrupt("return",this._updateSubTrack(t,r,aB.UNSUB));case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"_unsubscribe",value:(a=m_(Im.mark((function e(t,r){var n,i,a,o,s,c;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.hasSubscribed){e.next=2;break}return e.abrupt("return");case 2:if(!this._subConfig.muteReplaceUnsub){e.next=4;break}return e.abrupt("return",this._updateSubTrack(t,r,aB.UNSUB));case 4:return s={roomId:this._roomId,streamId:t.streamId,userId:t.userId},null===(n=this._dataChannelSignal)||void 0===n||n.sendSignaling("unsubscribe",s).catch((function(){})),t.streamState=IF.INIT,this._subStreamQueue[t.streamId]&&(this._subStreamQueue[t.streamId].forEach((function(e){return(0,e.resolve)(null)})),delete this._subStreamQueue[t.streamId]),t.subVideo=!1,null===(i=t.observer)||void 0===i||i.setSubscribeVideo(!1),!this.multiChatMode()&&(null===(a=t.observer)||void 0===a||a.setSubscribeAudio(!1)),e.next=13,null===(o=this._handler)||void 0===o?void 0:o.handleAck({action:xF.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 13:c=e.sent,this._subResolves[c]&&this._subResolves[c].forEach((function(e){return e(0)})),dB.print("unsubscribe","clean unsub ".concat(t.userId)),t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 19:case"end":return e.stop()}}),e,this)}))),function(e,t){return a.apply(this,arguments)})},{key:"removeOnTrackListener",value:function(e){var t,r=this._ontrackCallbackMap.get(e);r&&(null===(t=this._handler)||void 0===t||t.off("ontrack",r),this._ontrackCallbackMap.delete(e))}},{key:"handleRemoveStream",value:(i=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(pB("handleRemoveStream()",t),t.subVideo=!1,t.hasSubscribed){e.next=4;break}return e.abrupt("return");case 4:this.unsubscribe(t,Sd.AUDIO_AND_VIDEO,!0);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"leave",value:(n=m_(Im.mark((function e(){var t,r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(dB.print("leave()"),"connected"!==this.connectionState){e.next=22;break}return this.connectionState="disconnecting",t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},e.next=6,this._joinLeaveLock.lock();case 6:return r=e.sent,e.prev=7,e.next=10,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("leaveRoom",t);case 10:this.connectionState="disconnected",e.next=17;break;case 13:throw e.prev=13,e.t0=e.catch(7),this.connectionState="connected",e.t0;case 17:return e.prev=17,r(),e.finish(17);case 20:e.next=23;break;case 22:return e.abrupt("return",v_.reject(new pR(lR.NOT_CONNECTED_YET,"server not connected")));case 23:case"end":return e.stop()}}),e,this,[[7,13,17,20]])}))),function(){return n.apply(this,arguments)})},{key:"subscribePublicStream",value:(r=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,null===(r=this._handler)||void 0===r?void 0:r.subscribe(t,{multiChatMode:!1});case 2:if(o=e.sent){e.next=5;break}throw new pR(lR.ADD_TRANSCEIVER_FAILED,"add transceiver failed");case 5:return s=RC(),c=o.audioMid,u=o.videoMid,e.t0=this._appId,e.t1=t.streamId,e.t2=c,e.t3=u,e.t4={sdp:null==o?void 0:o.partialSdp,semantics:null==o?void 0:o.semantics,type:null==o?void 0:o.type},e.next=15,DL();case 15:return e.t5=e.sent,e.t6=window.navigator.userAgent,e.t7=eN.VERSION,e.t8=YP.getDeviceId(),e.t9=this._appId,e.t10=this._businessId,e.t11=this._useCloudProxy,e.t12={supportedCodecs:e.t5,deviceType:"web",userAgent:e.t6,sdkVersion:e.t7,deviceId:e.t8,appId:e.t9,businessId:e.t10,enableCloudProxy:e.t11},e.t13={enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}},d={appId:e.t0,streamId:e.t1,audio:!0,video:!0,data:!0,audioMid:e.t2,videoMid:e.t3,sdpInfo:e.t4,params:e.t12,config:e.t13},e.next=27,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("startPullStream",d);case 27:return l=e.sent,h=[],this._subResolves[t.streamId]=[],h.push(new v_((function(e,r){m._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new pR(lR.TIME_OUT,"wait video timeout for streamId: ".concat(t.streamId)))}),lB);t.on("ontrack",(function r(i){"video"===i.mediaType&&(dB.print("remoteStream ".concat(t.userId," received video track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),h.push(new v_((function(e,r){m._subResolves[t.streamId].push(e);var n=setTimeout((function(){return r(new pR(lR.TIME_OUT,"wait audio timeout for streamId: ".concat(t.streamId)))}),lB);t.on("ontrack",(function r(i){"audio"===i.mediaType&&(dB.print("remoteStream ".concat(t.userId," received audio track")),t.off("ontrack",r),clearTimeout(n),e(0))}))}))),p=function(e){t.ontrack(e)},null===(i=this._handler)||void 0===i||i.on("ontrack",p),this._ontrackCallbackMap.set(t,p),f=null==l?void 0:l.relayMessage,v=f.sequenceId,_=f.sdp,t.videoMid=u,t.audioMid=c,t.sequenceId=v,t.streamState=IF.SUB_ED,t.subAudio=!0,t.subVideo=!0,e.next=44,null===(a=this._handler)||void 0===a?void 0:a.handleAck({action:xF.subscribe,streamId:t.streamId,audioMid:c,videoMid:u,audioTransceiverInit:null==o?void 0:o.audioTransceiverInit,videoTransceiverInit:null==o?void 0:o.videoTransceiverInit,signalingAck:{sdp:_,sequenceId:v},stream:t});case 44:return e.next=46,v_.all(h);case 46:this.monitor.rtcSubscribeStat(lP.SUCCESS,s,hP.UNKNOWN,t.userId),this._context&&t.statsReport.setRemoteStreamStatsEvtInterval(this,this._handler,this.monitor,this._context);case 48:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"unsubscribePublicStream",value:(t=m_(Im.mark((function e(t){var r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return pB("unsubscribePublicStream()",t),n={appId:this._appId,streamId:t.streamId},e.prev=2,e.next=5,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("stopPullStream",n);case 5:e.next=9;break;case 7:e.prev=7,e.t0=e.catch(2);case 9:return t.streamState=IF.INIT,t.subVideo=!1,t.subAudio=!1,e.next=14,null===(r=this._handler)||void 0===r?void 0:r.handleAck({action:xF.unsubscribe,streamId:t.streamId,audioMid:t.audioMid,videoMid:t.videoMid,stream:t});case 14:t.clean(),this.removeOnTrackListener(t),t.statsReport.unsubscribe();case 17:case"end":return e.stop()}}),e,this,[[2,7]])}))),function(e){return t.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;dB.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===(r=this._iceConfigRequestManager)||void 0===r||r.abort(),this._handler=void 0,this._dataChannelSignal=void 0,this._iceConfigRequestManager=void 0,this._removeSignalEventHandler(),this.connectionState="disconnected",this.emit("INTERRUPT")}},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendP2PMessage({to:e,from:this._userInfo.userId,room:this._roomId,app:this._appId,msg:t})}},{key:"sendRoomMessage",value:function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)}},{key:"multiChatMode",value:function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode}},{key:"handler",get:function(){return this._handler}},{key:"roomAttributes",get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e}}]),b}(ex);function vB(e,t,r){var n=r.value;return r.value=m_(Im.mark((function e(){var r,i,a,o=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._handler||"connected"!==this._state){e.next=6;break}for(r=o.length,i=new Array(r),a=0;a<r;a++)i[a]=o[a];return e.next=4,n.apply(this,i);case 4:e.next=7;break;case 6:throw new pR(lR.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 7:case"end":return e.stop()}}),e,this)}))),r}function _B(e,t,r){var n=r.value;return r.value=m_(Im.mark((function e(){var t,r,i,a,o=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._pubSubLock.lock();case 2:for(t=e.sent,this.supportConcurrent&&t(),e.prev=4,r=o.length,i=new Array(r),a=0;a<r;a++)i[a]=o[a];return e.next=8,n.apply(this,i);case 8:return e.abrupt("return",e.sent);case 9:return e.prev=9,this.supportConcurrent||t(),e.finish(9);case 12:case"end":return e.stop()}}),e,this,[[4,,9,12]])}))),r}uB([function(e,t,r){var n=r.value;return r.value=m_(Im.mark((function e(){var t,r,i,a,o=this,s=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(t=s.length,r=new Array(t),i=0;i<t;i++)r[i]=s[i];return a=!1,e.abrupt("return",new v_(function(){var e=m_(Im.mark((function e(t,i){var s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o.on("INTERRUPT",(function(){a=!0,i(new pR(lR.OPERATION_CANCEL,"operation not finish when leave"))})),e.prev=1,e.next=4,n.apply(o,r);case 4:s=e.sent,t(s),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),a||i(e.t0);case 11:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(t,r){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}}),e)}))),r}],fB.prototype,"join",1),uB([_B,vB],fB.prototype,"publish",1),uB([_B,vB],fB.prototype,"updatePubTrack",1),uB([_B,vB],fB.prototype,"unpublish",1),uB([_B,vB],fB.prototype,"subscribe",1),uB([vB],fB.prototype,"controlMessage",1),uB([vB],fB.prototype,"updateUserAttributes",1),uB([vB],fB.prototype,"updateSubTrack",1),uB([vB],fB.prototype,"updateSubTrackLayer",1),uB([_B,vB],fB.prototype,"subscribe4pushTrack",1),uB([_B,vB],fB.prototype,"unsubscribe4removeTrack",1),uB([_B,vB],fB.prototype,"unsubscribe",1),uB([vB],fB.prototype,"handleRemoveStream",1),uB([_B],fB.prototype,"subscribePublicStream",1),uB([_B],fB.prototype,"unsubscribePublicStream",1);var mB,yB=new Jw("RecvFrameObserver",0),gB=function(){function e(t,r){Wd(this,e),sd(this,"_audioEventSessionId",XC()),sd(this,"_videoEventSessionId",XC()),sd(this,"_handler",void 0),sd(this,"_stream",void 0),sd(this,"_firstAudioFrameTimer",void 0),sd(this,"_firstVideoFrameTimer",void 0),sd(this,"_transportDelayInterval",void 0),sd(this,"_transportDelay",void 0),sd(this,"_firstVideoFrameInterval",void 0),sd(this,"_firstAudioFrameInterval",void 0),sd(this,"_isScreen",!1),sd(this,"_audioFirstFrameState",0),sd(this,"_videoFirstFrameState",0),sd(this,"_timeout",1e4),sd(this,"_currentAudioRecv",{startTime:0,eventSessionId:0,type:_P.LOGIN}),sd(this,"_currentVideoRecv",{startTime:0,eventSessionId:0,type:_P.LOGIN}),sd(this,"_login",!1),sd(this,"_unMuteAudio",!1),sd(this,"_enableAudio",!1),sd(this,"_unMuteVideo",!1),sd(this,"_enableVideo",!1),sd(this,"_remoteUnmuteAudio",!1),sd(this,"_remoteUnmuteVideo",!1),sd(this,"_audioExternal",!1),sd(this,"_pushAudio",!1),sd(this,"_videoExternal",!1),sd(this,"_pushVideo",!1),sd(this,"_autoSubscribeVideo",!1),sd(this,"_autoSubscribeAudio",!1),sd(this,"_autoSubscribe",!1),sd(this,"_publishVideo",!1),sd(this,"_publishAudio",!1),sd(this,"_subscribeAudio",!1),sd(this,"_subscribeVideo",!1),sd(this,"_subscribe",!1),sd(this,"_pushTrack",!1),sd(this,"_multiChatMode",!1),this._stream=t,this._handler=r,this.getTransportDelay()}var t,r,n,i;return qd(e,[{key:"beginRecvFrame",value:(i=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:i=this._transportDelay,a=!0,o=_P.LOGIN,s=_P.UNMUTE,c=_P.SUBSCRIBE,u=_P.PUSH_TRACK,Kb(n=[o,s,c,u]).call(n,r)>=0&&(i=0,a=!1),t===vP.AUDIO?(a||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:r},p={media_type:t,event_type:fP.BEGIN_RECV,type:r,is_screen:!(null===(d=this._stream)||void 0===d||!d.isScreen),start:null===(l=this._currentAudioRecv)||void 0===l?void 0:l.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(h=this._stream)||void 0===h?void 0:h.userId,transport_delay:i},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){y.stopRecvFrame(vP.AUDIO,mP.TIMEOUT),y._firstAudioFrameInterval&&window.clearInterval(y._firstAudioFrameInterval)}),this._timeout),yB.print("rtcFirstFrameRecv",ny(p)),CP.rtcFirstFrame(p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=1,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):t===vP.VIDEO&&(a||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:r},m={media_type:t,event_type:fP.BEGIN_RECV,type:r,is_screen:!(null===(f=this._stream)||void 0===f||!f.isScreen),start:null===(v=this._currentVideoRecv)||void 0===v?void 0:v.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,transport_delay:i},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){y.stopRecvFrame(vP.VIDEO,mP.TIMEOUT),y._firstVideoFrameInterval&&window.clearInterval(y._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),yB.print("rtcFirstFrameRecv",ny(m)),CP.rtcFirstFrame(m),this._videoFirstFrameState=1,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"stopRecvFrame",value:function(e,t){if(e===vP.AUDIO){var r,n,i,a;if(1!==this._audioFirstFrameState)return;var o={event_type:fP.RECV_END,media_type:e,is_screen:!(null===(r=this._stream)||void 0===r||!r.isScreen),start:null===(n=this._currentAudioRecv)||void 0===n?void 0:n.startTime,reason:t,result:!1,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,event_session_id:this._audioEventSessionId,type:null===(a=this._currentAudioRecv)||void 0===a?void 0:a.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,yB.print("rtcFirstFrameRecv",ny(o)),CP.rtcFirstFrame(o),this._audioFirstFrameState=2}else if(e===vP.VIDEO){var s,c,u,d;if(1!==this._videoFirstFrameState)return;var l={event_type:fP.RECV_END,media_type:e,is_screen:!(null===(s=this._stream)||void 0===s||!s.isScreen),start:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.startTime,reason:t,result:!1,stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._videoEventSessionId,type:null===(d=this._currentVideoRecv)||void 0===d?void 0:d.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,yB.print("rtcFirstFrameRecv",ny(l)),CP.rtcFirstFrame(l),this._videoFirstFrameState=2}}},{key:"recvFrameFinish",value:(n=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelay();case 2:if(r=this._transportDelay,n=_P.LOGIN,i=_P.UNMUTE,a=_P.SUBSCRIBE,o=_P.PUSH_TRACK,t!==vP.AUDIO){e.next=19;break}if(1===this._audioFirstFrameState){e.next=7;break}return e.abrupt("return");case 7:if(this._currentAudioRecv){e.next=9;break}return e.abrupt("return");case 9:d=this._currentAudioRecv,l=d.type,h=d.startTime,Kb(s=[n,i,a,o]).call(s,l)>=0&&(r=0),p={event_type:fP.RECV_END,media_type:t,start:h,result:!0,is_screen:!(null===(c=this._stream)||void 0===c||!c.isScreen),stream_user_id:null===(u=this._stream)||void 0===u?void 0:u.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:r},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),yB.print("rtcFirstFrameRecv",ny(p)),CP.rtcFirstFrame(p),this._audioFirstFrameState=3,e.next=32;break;case 19:if(t!==vP.VIDEO){e.next=32;break}if(1===this._videoFirstFrameState){e.next=22;break}return e.abrupt("return");case 22:if(this._currentVideoRecv){e.next=24;break}return e.abrupt("return");case 24:m=this._currentVideoRecv,y=m.type,g=m.startTime,Kb(f=[n,i,a,o]).call(f,y)>=0&&(r=0),S={event_type:fP.RECV_END,media_type:t,is_screen:!(null===(v=this._stream)||void 0===v||!v.isScreen),start:g,result:!0,stream_user_id:null===(_=this._stream)||void 0===_?void 0:_.userId,event_session_id:this._videoEventSessionId,type:y,transport_delay:r},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),yB.print("rtcFirstFrameRecv",ny(S)),CP.rtcFirstFrame(S),this._videoFirstFrameState=3;case 32:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"setLogin",value:function(e){var t,r,n,i,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{audio:!0,video:!0};this._login!==e&&(this._login=e,e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&a.audio&&this.beginRecvFrame(vP.AUDIO,_P.LOGIN),e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&a.video&&this.beginRecvFrame(vP.VIDEO,_P.LOGIN),!e&&null!==(n=this._stream)&&void 0!==n&&n.hasAudio&&this.stopRecvFrame(vP.AUDIO,mP.LEAVE_ROOM),!e&&null!==(i=this._stream)&&void 0!==i&&i.hasVideo&&this.stopRecvFrame(vP.VIDEO,mP.LEAVE_ROOM))}},{key:"setUnmuteAudio",value:function(e){var t,r,n;if(this._unMuteAudio!==e){this._unMuteAudio=e;var i=!(null===(t=this._stream)||void 0===t||!t.hasAudio);null!==(r=this._stream)&&void 0!==r&&r.audioHasCapture&&null!==(n=this._stream)&&void 0!==n&&n.audioHasPublish&&(this._unMuteAudio&&i?this.beginRecvFrame(vP.AUDIO,_P.UNMUTE):i&&this.stopRecvFrame(vP.AUDIO,mP.MUTE))}}},{key:"setRemoteUnmuteAudio",value:function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(vP.AUDIO,_P.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(vP.AUDIO,mP.REMOTE_MUTE))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(vP.AUDIO,_P.ENABLE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(vP.AUDIO,mP.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t,r,n;if(this._unMuteVideo!==e){this._unMuteVideo=e;var i=!(null===(t=this._stream)||void 0===t||!t.hasVideo);null!==(r=this._stream)&&void 0!==r&&r.videoHasCapture&&null!==(n=this._stream)&&void 0!==n&&n.videoHasPublish&&(this._unMuteVideo&&i?this.beginRecvFrame(vP.VIDEO,_P.UNMUTE):i&&this.stopRecvFrame(vP.VIDEO,mP.MUTE))}}},{key:"setRemoteUnmuteVideo",value:function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(vP.VIDEO,_P.REMOTE_UNMUTE):null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(vP.VIDEO,mP.REMOTE_MUTE))}},{key:"setEnableVideo",value:function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(vP.VIDEO,_P.ENABLE):this.stopRecvFrame(vP.VIDEO,mP.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal=e}},{key:"setPushAudio",value:function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(vP.AUDIO,_P.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.beginRecvFrame(vP.AUDIO,_P.PUSH)}},{key:"setExternalVideoSource",value:function(e){this._videoExternal=e}},{key:"setPushVideo",value:function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(vP.VIDEO,_P.PUSH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.beginRecvFrame(vP.VIDEO,_P.PUSH)}},{key:"setPublishVideo",value:function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(vP.VIDEO,_P.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(vP.VIDEO,mP.UNPUBLISH)}},{key:"setPublishAudio",value:function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(vP.AUDIO,_P.PUBLISH),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(vP.AUDIO,mP.UNPUBLISH)}},{key:"setAutoSubscribe",value:function(e){this._autoSubscribe=e}},{key:"setAutoSubscribeVideo",value:function(e){this._autoSubscribeVideo=e}},{key:"setAutoSubscribeAudio",value:function(e){this._autoSubscribeAudio=e}},{key:"setSubscribeAudio",value:function(e){var t,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasAudio&&this.beginRecvFrame(vP.AUDIO,_P.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(vP.AUDIO,mP.UNSUBSCRIBE)}},{key:"setSubscribeVideo",value:function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&null!==(r=this._stream)&&void 0!==r&&r.hasVideo&&this.beginRecvFrame(vP.VIDEO,_P.SUBSCRIBE));!e&&null!==(t=this._stream)&&void 0!==t&&t.hasVideo&&this.stopRecvFrame(vP.VIDEO,mP.UNSUBSCRIBE)}},{key:"setPushTrack",value:function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(vP.AUDIO,_P.PUSH_TRACK),!e&&null!==(t=this._stream)&&void 0!==t&&t.hasAudio&&this.stopRecvFrame(vP.AUDIO,mP.REMOVE_TRACK))}},{key:"setMultiChatMode",value:function(e){this._multiChatMode=e}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"_watchForFirstVideoFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(m_(Im.mark((function n(){var i,a,o,s,c,u,d,l;return Im.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(a=e._stream)||void 0===a||null===(o=a.videoTrack)||void 0===o||!o.getTrack()){n.next=12;break}return n.next=3,CL(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(c=e._stream)||void 0===c||null===(u=c.videoTrack)||void 0===u?void 0:u.getTrack());case 3:if(d=n.sent,!(l=Nb(d).call(d,(function(e){return"inbound-rtp"===e.type})))||!(l.framesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.framesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(vP.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"_watchForFirstAudioFrameRecv",value:function(){var e=this,t=-1,r=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(m_(Im.mark((function n(){var i,a,o,s,c,u,d,l;return Im.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(null===(i=e._handler)||void 0===i||!i.pc||null===(a=e._stream)||void 0===a||null===(o=a.audioTrack)||void 0===o||!o.getTrack()){n.next=12;break}return n.next=3,CL(null===(s=e._handler)||void 0===s?void 0:s.pc,null===(c=e._stream)||void 0===c||null===(u=c.audioTrack)||void 0===u?void 0:u.getTrack());case 3:if(d=n.sent,!(l=Nb(d).call(d,(function(e){return"inbound-rtp"===e.type})))||!(l.totalSamplesReceived>t||l.packetsReceived>r)){n.next=12;break}if(-1!==t||-1!==r){n.next=10;break}return t=l.totalSamplesReceived,r=l.packetsReceived,n.abrupt("return");case 10:e.recvFrameFinish(vP.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 12:case"end":return n.stop()}}),n)}))),200)}},{key:"getTransportDelay",value:(r=m_(Im.mark((function e(){var t=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getTransportDelayIntl();case 2:window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval(m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getTransportDelayIntl();case 2:case"end":return e.stop()}}),e)}))),2e3);case 4:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"getTransportDelayIntl",value:(t=m_(Im.mark((function e(){var t,r,n,i,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc){e.next=7;break}return e.next=3,CL(null===(r=this._handler)||void 0===r?void 0:r.pc);case 3:n=e.sent,i=Nb(n).call(n,(function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(a=Nb(n).call(n,(function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==i?void 0:i.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*a.currentRoundTripTime/2));case 7:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"reset",value:function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:_P.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:_P.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}(),SB=new Jw("SendFrameObserver",0),EB=function(){function e(t,r){Wd(this,e),sd(this,"_audioEventSessionId",XC()),sd(this,"_videoEventSessionId",XC()),sd(this,"_pcSessionId",void 0),sd(this,"_handler",void 0),sd(this,"_firstAudioFrameTimer",void 0),sd(this,"_firstVideoFrameTimer",void 0),sd(this,"_stream",void 0),sd(this,"_firstVideoFrameInterval",void 0),sd(this,"_firstAudioFrameInterval",void 0),sd(this,"_currentAudioSend",{startTime:0,eventSessionId:0,type:_P.LOGIN}),sd(this,"_currentVideoSend",{startTime:0,eventSessionId:0,type:_P.LOGIN}),sd(this,"_login",!1),sd(this,"_publisher",!1),sd(this,"_unMuteAudio",!1),sd(this,"_enableAudio",!1),sd(this,"_unMuteVideo",!1),sd(this,"_enableVideo",!1),sd(this,"_audioExternal",!1),sd(this,"_pushAudio",!1),sd(this,"_videoExternal",!1),sd(this,"_pushVideo",!1),sd(this,"_autoPublish",!1),sd(this,"_publish",!1),sd(this,"_timeout",1e4),sd(this,"_audioFirstFrameState",0),sd(this,"_videoFirstFrameState",0),this._stream=t,this._handler=r}var t,r;return qd(e,[{key:"beginSendFrame",value:function(e,t){var r=this;if(e===vP.AUDIO){var n,i;this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={event_type:fP.BEGIN_SEND,media_type:e,is_screen:!(null===(n=this._stream)||void 0===n||!n.isScreen),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(){r.stopSendFrame(vP.AUDIO,mP.TIMEOUT),r._firstAudioFrameInterval&&window.clearInterval(r._firstAudioFrameInterval)}),this._timeout),SB.print("rtcFirstFrameSend",ny(a)),CP.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===vP.VIDEO){var o,s;this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};var c={event_type:fP.BEGIN_SEND,media_type:e,is_screen:!(null===(o=this._stream)||void 0===o||!o.isScreen),type:t,start:null===(s=this._currentVideoSend)||void 0===s?void 0:s.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){r.stopSendFrame(vP.VIDEO,mP.TIMEOUT),r._firstVideoFrameInterval&&window.clearInterval(r._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),SB.print("rtcFirstFrameSend",ny(c)),CP.rtcFirstFrame(c),this._videoFirstFrameState=1,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}}},{key:"stopSendFrame",value:function(e,t){if(e===vP.AUDIO){var r,n,i;if(1!==this._audioFirstFrameState)return;var a={event_type:fP.SENT_END,media_type:e,is_screen:!(null===(r=this._stream)||void 0===r||!r.isScreen),start:null===(n=this._currentAudioSend)||void 0===n?void 0:n.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioSend)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,SB.print("rtcFirstFrameSend",ny(a)),CP.rtcFirstFrame(a),this._audioFirstFrameState=2}else if(e===vP.VIDEO){var o,s,c;if(1!==this._videoFirstFrameState)return;var u={event_type:fP.SENT_END,media_type:e,start:null===(o=this._currentVideoSend)||void 0===o?void 0:o.startTime,is_screen:!(null===(s=this._stream)||void 0===s||!s.isScreen),reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoSend)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,SB.print("rtcFirstFrameSend",ny(u)),CP.rtcFirstFrame(u),this._videoFirstFrameState=2}}},{key:"sendFrameFinish",value:function(e){if(e===vP.AUDIO){var t;if(1!==this._audioFirstFrameState)return;if(!this._currentAudioSend)return;var r=this._currentAudioSend,n=r.type,i=r.startTime,a={event_type:fP.SENT_END,media_type:e,is_screen:!(null===(t=this._stream)||void 0===t||!t.isScreen),start:i,result:!0,event_session_id:this._audioEventSessionId,type:n};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),SB.print("rtcFirstFrameSend",ny(a)),CP.rtcFirstFrame(a),this._audioFirstFrameState=3}else if(e===vP.VIDEO){var o;if(1!==this._videoFirstFrameState)return;if(!this._currentVideoSend)return;var s=this._currentVideoSend,c=s.type,u=s.startTime,d={event_type:fP.SENT_END,media_type:e,is_screen:!(null===(o=this._stream)||void 0===o||!o.isScreen),start:u,result:!0,event_session_id:this._videoEventSessionId,type:c};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),SB.print("rtcFirstFrameSend",ny(d)),CP.rtcFirstFrame(d),this._videoFirstFrameState=3}}},{key:"setLogin",value:function(e){if(this._login!==e){var t,r;if(this._login=e,e)null!==(t=this._stream)&&void 0!==t&&t.videoTrack&&this.beginSendFrame(vP.VIDEO,_P.LOGIN),null!==(r=this._stream)&&void 0!==r&&r.audioTrack&&this.beginSendFrame(vP.AUDIO,_P.LOGIN);!e&&this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.LEAVE_ROOM)}}},{key:"setPublish",value:function(e){if(this._publish!==e){var t,r,n,i;if(this._publish=e,e)(null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&(null===(r=this._stream)||void 0===r?void 0:r.pubVideo)&&this.beginSendFrame(vP.VIDEO,_P.PUBLISH),(null===(n=this._stream)||void 0===n?void 0:n.audioTrack)&&(null===(i=this._stream)||void 0===i?void 0:i.pubAudio)&&this.beginSendFrame(vP.AUDIO,_P.PUBLISH);!e&&this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.UNPUBLISH)}}},{key:"setUnmuteAudio",value:function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,null!==(t=this._stream)&&void 0!==t&&t.audioHasCapture&&(e&&this.beginSendFrame(vP.AUDIO,_P.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.MUTE)))}},{key:"setEnableAudio",value:function(e){var t;this._enableAudio!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubAudio&&(this._enableAudio=e,e&&this.beginSendFrame(vP.AUDIO,_P.ENABLE),!e&&this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.DISABLE))}},{key:"setUnmuteVideo",value:function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,null!==(t=this._stream)&&void 0!==t&&t.videoHasCapture&&(e&&this.beginSendFrame(vP.VIDEO,_P.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.MUTE)))}},{key:"setEnableVideo",value:function(e){var t;this._enableVideo!==e&&null!==(t=this._stream)&&void 0!==t&&t.pubVideo&&(this._enableVideo=e,e&&this.beginSendFrame(vP.VIDEO,_P.ENABLE),!e&&this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.DISABLE))}},{key:"setExternalAudioSource",value:function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.STOP_PUSH),this._pushAudio=!1))}},{key:"setPushAudio",value:function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(vP.AUDIO,_P.PUSH),!e&&this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.STOP_PUSH))}},{key:"setExternalVideoSource",value:function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.STOP_PUSH),this._pushVideo=!1))}},{key:"setPushVideo",value:function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(vP.VIDEO,_P.PUSH),!e&&this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.STOP_PUSH))}},{key:"setAutoPublish",value:function(e){this._autoPublish=e}},{key:"setPublisher",value:function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(vP.AUDIO,mP.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(vP.VIDEO,mP.AUDIENCE))}},{key:"setTimeout",value:function(e){this._timeout=e}},{key:"setPCSessionId",value:function(e){this._pcSessionId=e}},{key:"setHandler",value:function(e){this._handler=e}},{key:"_getFirstVideoFrameStats",value:(r=m_(Im.mark((function e(){var t,r,n,i,a,o,s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.videoTrack)||void 0===n||!n.getTrack("preprocessing")){e.next=5;break}return e.next=3,CL(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(a=this._stream)||void 0===a||null===(o=a.videoTrack)||void 0===o?void 0:o.getTrack("preprocessing"));case 3:return s=e.sent,e.abrupt("return",Nb(s).call(s,(function(e){return"outbound-rtp"===e.type})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"_getFirstAudioFrameStats",value:(t=m_(Im.mark((function e(){var t,r,n,i,a,o,s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(t=this._handler)||void 0===t||!t.pc||null===(r=this._stream)||void 0===r||null===(n=r.audioTrack)||void 0===n||!n.getTrack("preprocessing")){e.next=5;break}return e.next=3,CL(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(a=this._stream)||void 0===a||null===(o=a.audioTrack)||void 0===o?void 0:o.getTrack("preprocessing"));case 3:return s=e.sent,e.abrupt("return",Nb(s).call(s,(function(e){return"outbound-rtp"===e.type})));case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_watchForFirstVideoFrameSend",value:function(){var e=this,t=-1,r=-1;this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._firstVideoFrameInterval=window.setInterval(m_(Im.mark((function n(){var i;return Im.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,e._getFirstVideoFrameStats();case 2:if(!(i=n.sent)||!(i.framesSent>t||i.packetsSent>r)){n.next=10;break}if(-1!==t||-1!==r){n.next=8;break}return t=i.framesSent,r=i.packetsSent,n.abrupt("return");case 8:e.sendFrameFinish(vP.VIDEO),window.clearInterval(e._firstVideoFrameInterval);case 10:case"end":return n.stop()}}),n)}))),100)}},{key:"_watchForFirstAudioFrameSend",value:function(){var e=this,t=-1;this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstAudioFrameInterval=window.setInterval(m_(Im.mark((function r(){var n;return Im.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,e._getFirstAudioFrameStats();case 2:if(!((n=r.sent)&&n.packetsSent>t)){r.next=9;break}if(-1!==t){r.next=7;break}return t=n.packetsSent,r.abrupt("return");case 7:e.sendFrameFinish(vP.AUDIO),window.clearInterval(e._firstAudioFrameInterval);case 9:case"end":return r.stop()}}),r)}))),100)}},{key:"reset",value: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=0,this._videoFirstFrameState=0,this._currentAudioSend={startTime:0,eventSessionId:0,type:_P.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:_P.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)}},{key:"destroy",value:function(){this.reset(),delete this._stream,delete this._handler}},{key:"_audioSending",get:function(){return 1===this._audioFirstFrameState}},{key:"_videoSending",get:function(){return 1===this._videoFirstFrameState}}]),e}(),bB=(sd(mB={},"audio",{delay:1200,stallRadio:.3}),sd(mB,"video",{delay:1200,stallRadio:.6}),sd(mB,"screen_audio",{delay:1600,stallRadio:.8}),sd(mB,"screen_video",{delay:1600,stallRadio:.8}),mB),kB=function(){function e(){Wd(this,e),sd(this,"_preUplinkStats",new bE),sd(this,"_preDownlinkStats",new bE),sd(this,"_timer",void 0),sd(this,"_delayTimer",void 0),sd(this,"_connectionState",hB.CONNECTED),sd(this,"reportor",void 0)}return qd(e,[{key:"updateUplinkStats",value:function(e){var t=e.audioStats,r=e.videoStats,n=e.isScreen;if(t.sendKBitrate>0&&t.rtt){var i,a,o=n?"screen_audio":"audio",s=t.rtt,c=t._fractionLost,u=t._retransmittedRate,d=this._getQosLevel(s,c||0,u||0),l=this._preUplinkStats.get(o)||[d];this._preUplinkStats.set(o,km(i=xm(a=[]).call(a,Qk(l),[d])).call(i,-2))}if(r.sentKBitrate>0&&r.rtt){var h,p,f=n?"screen_video":"video",v=r._fractionLost,_=r.rtt,m=r._sendBandWidth,y=r._retransmittedRate;0===m&&(v=Math.max(.65,v));var g=this._getQosLevel(_,v||0,y||0),S=this._preUplinkStats.get(f)||[g];this._preUplinkStats.set(f,km(h=xm(p=[]).call(p,Qk(S),[g])).call(h,-2))}this._startNetworkQualityReport()}},{key:"updateDownlinkStats",value:function(e,t){if(t){var r,n,i=this._getStreamActiveState(t),a=i.audioActive,o=i.videoActive,s=e.audioStats,c=e.videoStats,u=e.isScreen,d=e.userId;if(a)if(0===s.receivedKBitrate)r=xd.VBAD;else{var l=s.rtt,h=s.audioLossRate,p=s.stallDuration,f=s.statsInterval,v=s.e2eDelay,_=p/f,m=u?"screen_audio":"audio",y=this._getQosLevel(l,h||0,c._retransmittedRate||0),g=this._getDownlinkQoE(m,_,v);r=this._getNetworkQuality(y,g)}if(o)if(0===c.receivedKBitrate||0===c.rtt)n=xd.VBAD;else{var S=c.rtt,E=c.videoLossRate,b=c.stallDuration,k=c.statsInterval,T=c.e2eDelay,I=c._retransmittedRate,A=b/k,R=u?"screen_video":"video",C=this._getQosLevel(S,E||0,I||0),w=this._getDownlinkQoE(R,A,T);n=this._getNetworkQuality(C,w)}var x=r&&n?Math.ceil((r+n)/2):r||n;if(x){var O,D,P,N=xm(O="".concat(d)).call(O,u?"_screen":""),M=this._preDownlinkStats.get(N)||[x];this._preDownlinkStats.set(N,km(D=xm(P=[]).call(P,Qk(M),[x])).call(D,-2)),this._startNetworkQualityReport()}}}},{key:"setConnectionState",value:function(e){this._connectionState=e}},{key:"destroy",value: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()}},{key:"_startNetworkQualityReport",value: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))}},{key:"_reportNetworkQuality",value:function(){var e,t,r=this;if(this._connectionState!==hB.CONNECTED)e=t=xd.VBAD;else{var n,i,a,o=this._getBetterQualityAndRemoveOldest("audio","up"),s=this._getBetterQualityAndRemoveOldest("video","up");e=o&&s?Math.ceil((o+s)/2):o||s||this._getBetterQualityAndRemoveOldest("screen_video","up")||this._getBetterQualityAndRemoveOldest("screen_audio","up")||xd.EXCELLENT;var c=Gs(n=uy(i=Wk(Hw(a=this._preDownlinkStats).call(a))).call(i,(function(e){return r._getBetterQualityAndRemoveOldest(e,"down")}))).call(n,(function(e){return e}));t=Math.ceil(LE(c).call(c,(function(e,t){return t+e}),0)/c.length)||xd.UNKNOWN}"function"==typeof this.reportor&&this.reportor(e,t)}},{key:"_getNetworkQuality",value:function(e,t){return 1===t?Math.max(e-2,1):2===t?e:Math.min(e+1,5)}},{key:"_getQosLevel",value:function(e,t,r){var n;return n=(!e||e<=250)&&t<=.15?1:(!e||e<=500)&&t<=.3?2:(!e||e<=750)&&t<=.45?3:(!e||e<=1e3)&&t<=.6?4:5,r>.5?n=Math.max(n,4):r>.35?n=Math.max(n,3):r>.15&&(n=Math.max(n,2)),n}},{key:"_getUplinkQoE",value:function(e,t){var r=0;switch(e){case"audio":case"video":r=t<.05?1:t<.1?2:3;break;case"screen_video":case"screen_audio":r=t<.04?1:t<.08?2:3}return r}},{key:"_getDownlinkQoE",value:function(e,t,r){var n=bB[e];return t>n.stallRadio||r>n.delay||t>n.stallRadio/2&&r>n.delay/2?3:(t>n.stallRadio/2||n.delay,2)}},{key:"_getBetterQualityAndRemoveOldest",value:function(e,t){var r=xd.UNKNOWN,n="up"===t?this._preUplinkStats:this._preDownlinkStats,i=n.get(e);if(i){var a=Gs(i).call(i,(function(e){return e}));a.length>0&&(r=Math.min.apply(Math,Qk(a))),i.shift(),0===i.length&&n.delete(e)}return r}},{key:"_getStreamActiveState",value:function(e){var t=e.subMediaType,r=e._attributes,n=e.subVideo;return{audioActive:e.subAudio&&ZC(t)&&r.localaudio&&r.audiostream,videoActive:n&&$C(t)&&r.localvideo&&r.videostream}}}]),e}(),TB=function(){function e(t){Wd(this,e),sd(this,"_timer",void 0),sd(this,"_remoteVideoSizeCache",{}),sd(this,"_remoteScreenSizeCache",{}),sd(this,"onchange",void 0),this._room=t,this._start()}return qd(e,[{key:"destroy",value:function(){this._timer&&(window.clearInterval(this._timer),delete this._timer),this._remoteVideoSizeCache={},this._remoteScreenSizeCache={}}},{key:"_start",value:function(){var e=this;this._timer||(this._timer=window.setInterval((function(){var t={},r={};e._room.remoteStreams.forEach((function(n,i){n.forEach((function(n){var a,o=null===(a=n.videoTrack)||void 0===a?void 0:a.getTrack();if(o){var s=n.isScreen?e._remoteScreenSizeCache:e._remoteVideoSizeCache,c=s[i]||{},u=c.width,d=void 0===u?0:u,l=c.height,h=void 0===l?0:l,p=o.getSettings(),f=p.width,v=void 0===f?0:f,_=p.height,m=void 0===_?0:_;h===m&&d===v||"function"==typeof e.onchange&&e.onchange(i,n.isScreen,v,m),delete s[i],(n.isScreen?r:t)[i]={width:v,height:m}}}))})),on(e._remoteVideoSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!1,0,0)})),on(e._remoteScreenSizeCache).forEach((function(t){"function"==typeof e.onchange&&e.onchange(t,!0,0,0)})),e._remoteVideoSizeCache=t,e._remoteScreenSizeCache=r}),1e3))}}]),e}(),IB=Wk((new TextEncoder).encode("subt")),AB={1:lR.SUBTITLE_ERR_POSTPROCESS,2:lR.SUBTITLE_ERR_CONNECTION_ERROR,3:lR.SUBTITLE_ERR_PROCESS_ERROR},RB=new Jw("SubtitleTool",1),CB=function(e){if(e.extraInfo)try{var t,r=JSON.parse(e.extraInfo);r.source_language&&Kb(t=["zh","en","ja"]).call(t,r.source_language)}catch(o){}else{var n,i,a=(null===(n=navigator.language)||void 0===n?void 0:n.substring(0,2))||"";Kb(i=["zh","en","ja"]).call(i,a)>-1&&(e.extraInfo=ny({source_language:a}))}},wB=function(){function e(t){var r,n,i;Wd(this,e),sd(this,"_taskId",void 0),sd(this,"_appId",void 0),sd(this,"_roomId",void 0),sd(this,"_userId",void 0),sd(this,"onEvent",void 0),sd(this,"onMessage",void 0),sd(this,"_preConfig",void 0),sd(this,"_timer",void 0),this._room=t,this._appId=null===(r=this._room._roomInfo)||void 0===r?void 0:r.appId,this._roomId=null===(n=this._room._roomInfo)||void 0===n?void 0:n.roomId,this._userId=null===(i=this._room._roomInfo)||void 0===i?void 0:i.userInfo.userId}var t,r,n;return qd(e,[{key:"start",value:(n=m_(Im.mark((function e(t){var r=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(RB.print("start","Invoke config: %o",t),vw(t.mode,"mode",[Ud.ASR_ONLY,Ud.ASR_AND_TRANSLATION]),t.mode!==Ud.ASR_AND_TRANSLATION||-1!==Kb(OB).call(OB,t.targetLanguage||"")){e.next=4;break}throw new pR(lR.INVALID_PARAMS,"Invalid targetLanguage.");case 4:if(!this._taskId){e.next=6;break}throw new pR(lR.SUBTITLE_ALREADY_ON,"Already turned on subtitle");case 6:return this._preConfig=t,this._taskId=(Date.now().toString()+this._roomId+this._userId).substring(0,20),e.next=10,this._room.subtitleControlMessage(this._genSubtitleSignaling("started",t,this._taskId));case 10:this._preConfig=t,this._timer=self.setTimeout((function(){var e;null===(e=r.onEvent)||void 0===e||e.call(r,{event:Vd.ERROR,errorCode:lR.TIME_OUT,errorMessage:"start subtitle timeout."}),delete r._timer,r.stop()}),3e4);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"update",value:(r=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(vw(t.mode,"mode",[Ud.ASR_ONLY,Ud.ASR_AND_TRANSLATION]),t.mode!==Ud.ASR_AND_TRANSLATION||-1!==Kb(OB).call(OB,t.targetLanguage||"")){e.next=3;break}throw new pR(lR.INVALID_PARAMS,"Invalid targetLanguage.");case 3:if(!this._taskId){e.next=5;break}throw new pR(lR.SUBTITLE_ALREADY_ON,"Already started subtitle");case 5:if(this._taskId){e.next=7;break}throw new pR(lR.SUBTITLE_NOT_TURNED_ON,"Start subtitle first.");case 7:if((null===(r=this._preConfig)||void 0===r?void 0:r.mode)===t.mode&&this._preConfig.targetLanguage===t.targetLanguage){e.next=11;break}return this._preConfig=t,e.next=11,this._room.subtitleControlMessage(this._genSubtitleSignaling("update",t,this._taskId));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stop",value:function(){var e=this;RB.print("stop","Invoke"),this._taskId&&this._room.subtitleControlMessage({type:"subtitle",action:"stopped",appId:this._appId,roomId:this._roomId,userId:this._userId,taskId:this._taskId}).finally((function(){var t;delete e._taskId,null===(t=e.onEvent)||void 0===t||t.call(e,{event:Vd.STOPPED}),e._clearTimer()}))}},{key:"reconnect",value:(t=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._taskId||!this._preConfig){e.next=5;break}return e.next=3,this._room.subtitleControlMessage({type:"subtitle",action:"stopped",appId:this._appId,roomId:this._roomId,userId:this._userId,taskId:this._taskId});case 3:delete this._taskId,this.start(this._preConfig);case 5:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"getConfig",value:function(){return this._preConfig}},{key:"destroy",value:function(){RB.print("destroy","Invoke"),this.stop(),delete this._preConfig,delete this._taskId}},{key:"onResult",value:function(e){var t=e.body,r=t.error,n=t.errorMessage,i=t.eventType;if(0!==r){var a,o=new pR(AB[r]||lR.SUBTITLE_ERR_UNKNOWN,n||"");null===(a=this.onEvent)||void 0===a||a.call(this,{event:Vd.ERROR,errorCode:o.code,errorMessage:o.message}),this._clearTimer()}else if("SubtitleStarted"===i){var s;null===(s=this.onEvent)||void 0===s||s.call(this,{event:Vd.STARTED}),this._clearTimer()}}},{key:"onMessageRecv",value:function(e){if(this._taskId&&this._preConfig){var t=xB(e);if(t&&t.length>0){var r,n=this._preConfig,i=n.mode,a=n.targetLanguage,o=[];if(t.forEach((function(e){i===Ud.ASR_ONLY?e.mode===i&&o.push(e):i===Ud.ASR_AND_TRANSLATION&&(e.language!==a&&e.mode!==Ud.ASR_ONLY||o.push(e),e.mode===Ud.ASR_ONLY&&e.language===a&&o.push(ud(ud({},e),{},{mode:Ud.ASR_AND_TRANSLATION})))})),o.length>0)null===(r=this.onMessage)||void 0===r||r.call(this,o)}return!!t}return!1}},{key:"_genSubtitleSignaling",value:function(e,t,r){return{taskId:r,type:"subtitle",action:e,roomId:this._roomId,appId:this._appId,userId:this._userId,subtitleMeta:{subtitleConfig:{mode:t.mode,usersConfig:[{userId:this._userId,targetLanguages:[t.targetLanguage||""]}]},vendorConfig:{type:0}}}}},{key:"_clearTimer",value:function(){this._timer&&(self.clearTimeout(this._timer),delete this._timer)}}]),e}(),xB=function(e){var t=e.message;if(t instanceof ArrayBuffer&&t.byteLength>8)try{var r=new DataView(t,0),n=0;if(IB.every((function(e){return r.getUint8(n++)===e}))){var i=r.getUint32(n);if(n+=4,i===r.byteLength-8){var a=xC.ab2str(km(t).call(t,8)),o=JSON.parse(a),s=o.data;if("subtitle"===o.type)return s}}}catch(c){}return!1},OB=["zh","zh-Hant","tn","vi","iu","it","id","hi","en","ho","he","es","el","uk","ur","tk","tr","ti","ty","tl","to","th","ta","te","sl","sk","ss","eo","sm","sg","st","sv","ja","tw","qu","pt","pa","no","nb","nr","my","bn","mn","mh","mk","ml","mr","ms","lu","ro","lt","lv","lo","kj","hr","kn","ki","cs","ca","nl","ko","ht","gu","ka","kl","km","lg","kg","fi","fj","fr","ru","ng","de","tt","da","ts","cv","fa","bs","pl","bi","nd","ba","bg","az","ar","af","sq","ab","os","ee","et","ay","lzh","am","ckb","cy","gl","ha","hy","ig","kmr","ln","nso","ny","om","sn","so","sr","sw","xh","yo","zu"],DB=new Jw("Room",1),PB={audiostream:!0,extaudio:!1,extvideo:!1,localaudio:!0,localvideo:!1,videoDescriptions:[],videostream:!1},NB=function(e){DI(I,e);var t,r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T=YI(I);function I(e,t){var r;return Wd(this,I),sd(eI(r=T.call(this)),"id",void 0),sd(eI(r),"_mediaServerClient",void 0),sd(eI(r),"_localStream",void 0),sd(eI(r),"_localScreenStream",void 0),sd(eI(r),"_remoteUsers",new bE),sd(eI(r),"_remoteStreams",new bE),sd(eI(r),"_remoteStreamStreamIdUserIdMap",{}),sd(eI(r),"_virtualStreams",[]),sd(eI(r),"_joinResolveCallback",void 0),sd(eI(r),"_joinRejectCallback",void 0),sd(eI(r),"_getAccessNode",void 0),sd(eI(r),"_getAccessFeedback",void 0),sd(eI(r),"_getAccessFeedbackIceNode",void 0),sd(eI(r),"_reconnectTimer",void 0),sd(eI(r),"_isReconnecting",void 0),sd(eI(r),"_context",void 0),sd(eI(r),"_sessionId",void 0),sd(eI(r),"_reconnectRecord",void 0),sd(eI(r),"_connectionLostTimer",void 0),sd(eI(r),"_liveControlMessage",void 0),sd(eI(r),"_serverConfig",void 0),sd(eI(r),"_liveTranscodingOnceSucc",!1),sd(eI(r),"_roomConfig",void 0),sd(eI(r),"_roomInfo",void 0),sd(eI(r),"_waitForNewToken",!1),sd(eI(r),"_userDuplicateLoginTimerMap",new bE),sd(eI(r),"_networkQualityManager",void 0),sd(eI(r),"_videoSizeObserver",void 0),sd(eI(r),"_hasPublished",!1),sd(eI(r),"_subtitleTool",void 0),sd(eI(r),"_csrcUserIdMap",void 0),sd(eI(r),"_publishOnDemandItem",void 0),sd(eI(r),"_publishOnDemandBusy",!1),r.id=null==t?void 0:t.id,r._roomConfig=e,r._mediaServerClient=new fB(t),r._reconnectRecord=new MB,r._addHandlerEventHandler(),r._isReconnecting=!1,r._networkQualityManager=new kB,r._networkQualityManager.reportor=r._reportNetworkQuality.bind(eI(r)),r._videoSizeObserver=new TB(eI(r)),r._videoSizeObserver.onchange=r._emitVideoSizeChange.bind(eI(r)),r._context=t,r._csrcUserIdMap={},r}return qd(I,[{key:"hasScreenPublished",get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished}},{key:"hasPublished",get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished}},{key:"connectionState",get:function(){return this._mediaServerClient.connectionState}},{key:"remoteUsers",get:function(){return this._remoteUsers}},{key:"remoteStreams",get:function(){return this._remoteStreams}},{key:"localStream",get:function(){return this._localStream}},{key:"localScreenStream",get:function(){return this._localScreenStream}},{key:"roomInfo",get:function(){return this._roomInfo}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x=this;null===(e=this._mediaServerClient)||void 0===e||e.on(dN.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(dN.ON_ADD_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return x._onAddStream(e)}))})),null===(r=this._mediaServerClient)||void 0===r||r.on(dN.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(dN.ON_REMOVE_STREAM_LIST,(function(e){Array.isArray(null==e?void 0:e.streamList)&&e.streamList.forEach((function(e){return x._onRemoveStream(e)}))})),null===(i=this._mediaServerClient)||void 0===i||i.on(dN.USER_CONNECTION,this._onUserConnection.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(dN.USER_CONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return x._onUserConnection(e)}))})),null===(o=this._mediaServerClient)||void 0===o||o.on(dN.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(dN.USER_DISCONNECTION_LIST,(function(e){Array.isArray(null==e?void 0:e.userList)&&e.userList.forEach((function(e){return x._onUserDisconnection(e)}))})),null===(c=this._mediaServerClient)||void 0===c||c.on(dN.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(dN.ON_UPDATE_USER_ATTRIBUTES,this._onUpdateUserAttributes.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(dN.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(dN.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(dN.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(dN.NODE_CHANGE,this._nodeChange.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(dN.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(dN.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(dN.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on(dN.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(y=this._mediaServerClient)||void 0===y||y.on(dN.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(g=this._mediaServerClient)||void 0===g||g.on(dN.STREAM_CONTROL_MESSAGE,this._onStreamControlMessage.bind(this)),null===(S=this._mediaServerClient)||void 0===S||S.on(dN.ON_STREAM_FAILED,this._onStreamFailed.bind(this)),null===(E=this._mediaServerClient)||void 0===E||E.on(lN.RSCP,(function(e){!!Nb(e).call(e,(function(e){var t,r,n;return null==e||null===(t=e.StreamIds)||void 0===t?void 0:$m(t).call(t,null===(r=x._localStream)||void 0===r||null===(n=r.stream)||void 0===n?void 0:n.id)}))&&(x._publishOnDemandItem=e,x._onPublishOnDemand())})),null===(b=this._mediaServerClient)||void 0===b||b.on(lN.RTT,this._onRTT.bind(this)),null===(k=this._mediaServerClient)||void 0===k||k.on(hN.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(T=this._mediaServerClient)||void 0===T||T.on(hN.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(I=this._mediaServerClient)||void 0===I||I.on(dN.ON_SPEAKER_CHANGE,this._onMeetingSpeakerChange.bind(this)),null===(A=this._mediaServerClient)||void 0===A||A.on("onRemoteStreamStats",(function(e){x._networkQualityManager.updateDownlinkStats(e,x._findRemoteStreamByScreen(e.userId,e.isScreen)),x.emit(rB.ON_REMOTE_STREAM_STATS,ew(e))})),null===(R=this._mediaServerClient)||void 0===R||R.on("onLocalStreamStats",(function(e){x._networkQualityManager.updateUplinkStats(e),x.emit(rB.ON_LOCAL_STREAM_STATS,ew(e))})),null===(C=this._mediaServerClient)||void 0===C||C.on("prevIceNode",(function(e){x._getAccessFeedbackIceNode=e})),null===(w=this._mediaServerClient)||void 0===w||w.on("prevIceNode",(function(e){x._getAccessFeedbackIceNode=e}))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()}},{key:"join",value:(k=m_(Im.mark((function e(t,r,n,i,a,o,s){var c=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return OP.setStats({rtc_app_id:t,room_id:r,user_id:i.userId}),DB.print("join()"),e.abrupt("return",new v_((function(e,u){var d,l,h=RC();c._joinResolveCallback=function(t){var r;CP.joinRoom(gP.END,h,!0,"",{enable_cloud_proxy:null===(r=c._roomInfo)||void 0===r?void 0:r.useCloudProxy}),c._initSubtitleTool(),e(t)},c._joinRejectCallback=function(e){var t;Array.isArray(e)&&e.length&&(e=e[0]),CP.joinRoom(gP.END,h,!1,e.message,{enable_cloud_proxy:null===(t=c._roomInfo)||void 0===t?void 0:t.useCloudProxy}),u(e)},c._liveControlMessage=a,c._roomInfo={appId:t,roomId:r,token:n,userInfo:i,useCloudProxy:o,roomProfile:c._roomConfig.roomProfileType,expectedIDC:s},c.setSessionId(),CP.joinRoom(gP.BEGIN,h,!1,"",{enable_cloud_proxy:null===(d=c._roomInfo)||void 0===d?void 0:d.useCloudProxy,expectedIDC:null===(l=c._roomInfo)||void 0===l?void 0:l.expectedIDC}),c._join(c._joinResolveCallback,c._joinRejectCallback,!1)})));case 3:case"end":return e.stop()}}),e)}))),function(e,t,r,n,i,a,o){return k.apply(this,arguments)})},{key:"_join",value:(b=m_(Im.mark((function e(t,r){var n,i,a,o,s=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=s.length>2&&void 0!==s[2]&&s[2],i=RC(),DB.print("_join()"),e.prev=3,e.next=6,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId,feedbackNode:this._getAccessFeedbackIceNode},n,this._liveControlMessage);case 6:o=e.sent,this._mediaServerClient.roomAttributes=o.roomAttributes,null!==(a=o.roomAttributes)&&void 0!==a&&a.multiChatMode&&this._handleFFAudioTrack(),this._reconnectRecord.clear(),this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof t&&t({users:o.clients,streams:o.streams}),this._isReconnecting=!1,CP.rtcJoinRoom(0,"web","web",RC()-i),this._onJoinSucc(o,n),e.next=26;break;case 20:if(e.prev=20,e.t0=e.catch(3),this._getAccessFeedback=void 0,this._getAccessNode=void 0,e.t0.code===lR.OPERATION_CANCEL||"function"!=typeof r){e.next=26;break}return e.abrupt("return",r(e.t0));case 26:case"end":return e.stop()}}),e,this,[[3,20]])}))),function(e,t){return b.apply(this,arguments)})},{key:"publishScreen",value:(E=m_(Im.mark((function e(t,r,n,i,a){var o,s,c,u,d,l,h,p,f,v;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(DB.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new AF,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new EB(this._localScreenStream,this._mediaServerClient.handler))),o=!1,s=!1,c=!1,u=!1,!this._localScreenStream.videoTrack&&r?(r instanceof UV&&(s=!0),o=!0):this._localScreenStream.videoTrack&&!r&&(o=!1),!this._localScreenStream.audioTrack&&n?(n instanceof VV&&(u=!0),c=!0):this._localScreenStream.audioTrack&&!n&&(c=!1),this._localScreenStream.videoTrack=r,this._localScreenStream.audioTrack=n,this._localScreenStream.videoEncodeConfig=t,i&&(ZC(i)&&(this._localScreenStream.pubAudio=a===iB.PUB),$C(i)&&(this._localScreenStream.pubVideo=a===iB.PUB),DB.print("publishScreen mediaType","pubAudio: %o, pubVideo: %o",this._localScreenStream.pubAudio,this._localScreenStream.pubVideo)),this._localScreenStream.pubAudio||this._localScreenStream.pubVideo){e.next=18;break}if(null===(d=this._localScreenStream)||void 0===d||!d.hasPublished){e.next=17;break}return e.abrupt("return",this.unpublishScreen());case 17:return e.abrupt("return");case 18:if(this._localScreenStream.hasPublished){e.next=24;break}return null===(l=this._localScreenStream.observer)||void 0===l||l.setPublish(!0),e.next=22,this._mediaServerClient.publish(this._localScreenStream);case 22:e.next=28;break;case 24:return s?null===(h=this._localScreenStream.observer)||void 0===h||h.setPushVideo(o):null===(p=this._localScreenStream.observer)||void 0===p||p.setEnableVideo(o),u?null===(f=this._localScreenStream.observer)||void 0===f||f.setPushAudio(c):null===(v=this._localScreenStream.observer)||void 0===v||v.setEnableAudio(c),e.next=28,this.updatePubScreenTrack();case 28:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n,i){return E.apply(this,arguments)})},{key:"updatePubScreenTrack",value:(S=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(DB.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),!this._localScreenStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localScreenStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return S.apply(this,arguments)})},{key:"unpublishScreen",value:(g=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(DB.print("unpublish","Invoke unpublishScreen"),!this._localScreenStream){e.next=7;break}return null===(t=this._localScreenStream.observer)||void 0===t||t.setPublish(!1),e.next=5,this._mediaServerClient.unpublish(this._localScreenStream);case 5:this._localScreenStream.clean(),this._localScreenStream=void 0;case 7:case"end":return e.stop()}}),e,this)}))),function(){return g.apply(this,arguments)})},{key:"liveControlMessage",value:(y=m_(Im.mark((function e(t){var r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return DB.print("controlMessage","Invoke controlMessage"),null===(r=t.transcodeMeta)||void 0===r||r.layout.regions.forEach((function(e){n.roomInfo&&(e.roomID=n.roomInfo.roomId)})),this._liveControlMessage=t,e.next=5,this._mediaServerClient.controlMessage(t);case 5:"stopped"===t.action&&(delete this._liveControlMessage,this._liveTranscodingOnceSucc=!1),this._liveTranscodingOnceSucc=!0;case 7:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"publicStreamControlMessage",value:(m=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"stopped"===t.action&&delete t.publicStreamMeta,e.next=3,this._mediaServerClient.controlMessage(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"subtitleControlMessage",value:(_=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._mediaServerClient.controlMessage(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return _.apply(this,arguments)})},{key:"updateUserAttributes",value:(v=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return DB.print("updateUserAttributes","Invoke updateUserAttributes"),t.role&&this._roomInfo&&(this._roomInfo.userInfo.role=t.role),e.next=4,this._mediaServerClient.updateUserAttributes(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return v.apply(this,arguments)})},{key:"publish",value:(f=m_(Im.mark((function e(t,r,n,i,a,o){var s,c,u,d,l,h,p,f,v,_,m,y,g=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(s=g.length>6&&void 0!==g[6]&&g[6],DB.print("publish","Invoke publish"),c=!1,this._localStream||(this._localStream=new AF,this._mediaServerClient.handler&&(this._localStream.observer=new EB(this._localStream,this._mediaServerClient.handler)),c=!0),this._localStream.videoTrack=n,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=t,this._localStream.enableSimulcast=r,a&&(ZC(a)&&(this._localStream.pubAudio=o===iB.PUB),$C(a)&&(this._localStream.pubVideo=o===iB.PUB),DB.print("publish mediaType","pubAudio: %o, pubVideo: %o",this._localStream.pubAudio,this._localStream.pubVideo)),this._localStream.hasPublished){e.next=26;break}if(this._localStream.pubAudio||this._localStream.pubVideo){e.next=12;break}return e.abrupt("return");case 12:return e.prev=12,s?null===(u=this._localStream.observer)||void 0===u||u.setLogin(!0):c&&(d=!!this._localStream.videoTrack,l=!!this._localStream.audioTrack,h=this._localStream.videoTrack instanceof UV,p=this._localStream.audioTrack instanceof VV,this._roomConfig.isAutoPublish&&!this._hasPublished?(d&&(h?null===(f=this._localStream.observer)||void 0===f||f.setPushVideo(!0):null===(v=this._localStream.observer)||void 0===v||v.setEnableVideo(!0)),l&&(p?null===(_=this._localStream.observer)||void 0===_||_.setPushAudio(!0):null===(m=this._localStream.observer)||void 0===m||m.setEnableAudio(!0))):null===(y=this._localStream.observer)||void 0===y||y.setPublish(!0)),e.next=16,this._mediaServerClient.publish(this._localStream);case 16:this._hasPublished=!0,this.emit(rB.ON_PUBLISH_RESULT,{isScreen:!1,state:_d.PUBLISH_SUCC}),e.next=24;break;case 20:throw e.prev=20,e.t0=e.catch(12),this.emit(rB.ON_PUBLISH_RESULT,{isScreen:!1,state:_d.PUBLISH_FAIL}),e.t0;case 24:e.next=28;break;case 26:return e.next=28,this.updatePubTrack();case 28:case"end":return e.stop()}}),e,this,[[12,20]])}))),function(e,t,r,n,i,a){return f.apply(this,arguments)})},{key:"updatePubTrack",value:(p=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(DB.print("updatePubTrack","Invoke updatePubTrack"),!this._localStream){e.next=4;break}return e.next=4,this._mediaServerClient.updatePubTrack(this._localStream);case 4:case"end":return e.stop()}}),e,this)}))),function(){return p.apply(this,arguments)})},{key:"unpublish",value:(h=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(DB.print("unpublish","Invoke unpublish"),!this._localStream){e.next=6;break}return e.next=4,this._mediaServerClient.unpublish(this._localStream);case 4:this._localStream.clean(),this._localStream=void 0;case 6:case"end":return e.stop()}}),e,this)}))),function(){return h.apply(this,arguments)})},{key:"subscribe",value:(l=m_(Im.mark((function e(t,r,n){var i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return DB.print("subscribe","remoteStream %o",t),i=void 0,n&&(i=this._getSubLayer(n,t)),e.next=5,this._mediaServerClient.subscribe(t,r,i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return l.apply(this,arguments)})},{key:"updateSubTrack",value:(d=m_(Im.mark((function e(t,r,n,i){var a,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(DB.print("updateSubTrack","Invoke updateSubTrack"),!i){e.next=4;break}return e.next=4,null===(o=this._mediaServerClient)||void 0===o?void 0:o.updateSubTrackLayer(t,i);case 4:return e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrack(t,r,n));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t,r,n){return d.apply(this,arguments)})},{key:"updateSubVideoConfig",value:(u=m_(Im.mark((function e(t,r){var n,i,a,o,s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((o=this._findRemoteStreamByScreen(t,!1))&&o.hasSubscribed&&!((null==o||null===(n=o.attributes)||void 0===n||null===(i=n.videoDescriptions)||void 0===i?void 0:i.length)<=1)){e.next=3;break}return e.abrupt("return");case 3:return s=this._getSubLayer(r,o),o.originalStreamIndex=s.spatialLayer,e.abrupt("return",null===(a=this._mediaServerClient)||void 0===a?void 0:a.updateSubTrackLayer(o,s));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return u.apply(this,arguments)})},{key:"_getSubLayer",value:function(e,t){for(var r,n,i,a,o,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++){var f,v;if(h>=(null===(f=d[p])||void 0===f?void 0:f.width)*(null===(v=d[p])||void 0===v?void 0:v.height)){l=p;break}}var _=d[0];if(-1===l)_=d[l=d.length-1];else if(0!==l){var m=d[l-1].width*d[l-1].height,y=(m-h)/(m-d[l].width*d[l].height);_=y<.1?d[l-1]:d[l],l=y<.1?l-1:l}return o=null!==(r=null===(n=_)||void 0===n?void 0:n.sub_index)&&void 0!==r?r:-1,{spatialLayer:null!==(i=null===(a=_)||void 0===a?void 0:a.video_index)&&void 0!==i?i:l,spatialSubLayer:o}}},{key:"unsubscribe",value:(c=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return DB.print("unsubscribe","Invoke unsubscribe"),e.next=3,this._mediaServerClient.unsubscribe(t,r);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return c.apply(this,arguments)})},{key:"startSubtitle",value:(s=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._subtitleTool){e.next=5;break}return e.next=3,this._subtitleTool.start(t);case 3:e.next=6;break;case 5:throw new pR(lR.INVOKED_BEFORE_JOIN_ROOM,"join first");case 6:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"stopSubtitle",value:(o=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null===(t=this._subtitleTool)||void 0===t||t.stop();case 1:case"end":return e.stop()}}),e,this)}))),function(){return o.apply(this,arguments)})},{key:"leave",value:(a=m_(Im.mark((function e(){var t,r,n,i,a,o,s,c,u=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=u.length>0&&void 0!==u[0]&&u[0],DB.print("leave","Invoke leave"),n=RC(),null===(t=this._subtitleTool)||void 0===t||t.destroy(),delete this._subtitleTool,e.prev=5,this._mediaServerClient.connectionState!==hB.CONNECTED&&this._joinRejectCallback&&this._joinRejectCallback(new Error(SP.LEAVE_ROOM)),clearTimeout(this._reconnectTimer),a=ZT(nA(i=this._remoteStreams).call(i));try{for(a.s();!(o=a.n()).done;)s=o.value,Array.isArray(s)&&s.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(d){a.e(d)}finally{a.f()}return this._localStream&&(null===(c=this._localStream.observer)||void 0===c||c.setLogin(!1)),e.next=13,this._mediaServerClient.leave();case 13:this.destroy(),CP.rtcLeaveRoom(0,"",RC()-n),OP.setStats({room_id:void 0,user_id:void 0,rtc_session_id:void 0}),e.next=26;break;case 18:if(e.prev=18,e.t0=e.catch(5),!r){e.next=24;break}throw e.t0;case 24:this.destroy();case 25:e.t0 instanceof Error&&CP.rtcLeaveRoom(-1,e.t0.message,RC()-n);case 26:case"end":return e.stop()}}),e,this,[[5,18]])}))),function(){return a.apply(this,arguments)})},{key:"updateRemoteUserPriority",value:function(e){var t,r=this;null===(t=this.remoteStreams.get(e))||void 0===t||t.forEach((function(e){e.streamState!==IF.INIT&&r._mediaServerClient.subscribe(e,e.subMediaType)}))}},{key:"destroy",value:function(){var e;DB.print("destroy","Invoke destroy"),CP.rtcInvokeStatus("".concat((new Error).stack),0,"room_destroy","",0),null===(e=this._subtitleTool)||void 0===e||e.destroy(),delete this._subtitleTool,this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new bE;var t,r,n,i=ZT(this._remoteStreams);try{for(i.s();!(t=i.n()).done;){var a=$T(t.value,2)[1];Array.isArray(a)&&a.forEach((function(e){e&&e.clean()}))}}catch(o){i.e(o)}finally{i.f()}(this._virtualStreams.forEach((function(e){null==e||e.clean()})),this._remoteStreams=new bE,this._localStream)&&(null===(r=this._localStream)||void 0===r||r.clean(),this._localStream=void 0);this._localScreenStream&&(null===(n=this._localScreenStream)||void 0===n||n.clean(),this._localScreenStream=void 0);this._context=void 0,this._reconnectRecord=new MB,this._removeHandlerEventHandler(),clearTimeout(this._connectionLostTimer),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear(),this._networkQualityManager.destroy(),this._videoSizeObserver.destroy(),this._csrcUserIdMap={},this._virtualStreams=[],this._remoteStreamStreamIdUserIdMap={}}},{key:"updateToken",value:(i=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return DB.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=t),e.next=4,this._mediaServerClient.updateToken(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"sendUserMessage",value:function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)}},{key:"setSessionId",value:function(){this._sessionId=rC(),OP.setStats({rtc_session_id:this._sessionId})}},{key:"sendRoomMessage",value:(n=m_(Im.mark((function e(t){var r,n,i,a,o,s=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=s.length>1&&void 0!==s[1]&&s[1],o={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:a,message:"",roomId:null===(n=this._roomInfo)||void 0===n?void 0:n.roomId},!a){e.next=8;break}return e.next=5,xC.ab2b64str(t);case 5:o.message=e.sent,e.next=9;break;case 8:o.message=t;case 9:return e.abrupt("return",null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendRoomMessage(o));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_destroyAndInitMediaServerClient",value:function(){DB.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new fB(this._context),this._addHandlerEventHandler()}},{key:"_onJoinSucc",value:function(e,t){var r,n,i,a=this;DB.print("JoinSuccess()"),this._serverConfig=e.config;var o=[],s=[],c=[],u=[],d=[];null===(r=e.clientsDetail)||void 0===r||r.forEach((function(t){if(t.attributes&&(t.attributes.serverMuteVideo&&a.safeEmit(rB.ON_VIDEO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteVideo}),t.attributes.serverMuteAudio&&a.safeEmit(rB.ON_AUDIO_STREAM_BANNED,{uid:t.clientId,banned:1===t.attributes.serverMuteAudio})),t.clientId!==e.clientId){var r=a._remoteUsers.get(t.clientId);r?r._stillExist=!0:o.push(t)}}));var l,h=ZT(nA(n=this._remoteUsers).call(n));try{for(h.s();!(l=h.n()).done;){var p=l.value;p._stillExist||s.push({clientId:p.userId}),delete p._stillExist}}catch(m){h.e(m)}finally{h.f()}e.streams.forEach((function(e){var t=a._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId,d.push(e)):u.push(e)}));var f,v=ZT(nA(i=this._remoteStreams).call(i));try{for(v.s();!(f=v.n()).done;){var _=f.value;Array.isArray(_)&&_.forEach((function(e){e.stillExist?delete e.stillExist:c.push({clientId:e.userId,streamId:e.streamId,message:cN.clientDisconnected})}))}}catch(m){v.e(m)}finally{v.f()}s.forEach((function(e){return a._onUserDisconnection(e)})),o.forEach((function(e){return a._onUserConnection(e)})),c.forEach((function(e){return a._onRemoveStream(e)})),u.forEach((function(e){return a._onAddStream(e,{fromSignal:!1})})),d.forEach((function(e){return a._onUpdateStreamAttributes(e)})),t&&this._handleSendOrRecvStreamAfterReconnect()}},{key:"_handleSendOrRecvStreamAfterReconnect",value:function(){var e,t,r=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){})));var n,i=ZT(nA(t=this._remoteStreams).call(t));try{for(i.s();!(n=i.n()).done;){var a=n.value;Array.isArray(a)&&a.forEach(function(){var e=m_(Im.mark((function e(t){var n,i,a,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t.hasSubscribed){e.next=15;break}return t.resetHasSubscribed(),e.prev=2,DB.print(xm(n="start resubscribe ".concat(t.userId," with ")).call(n,t.subMediaType)),e.next=6,r._mediaServerClient.subscribe(t,t.subMediaType);case 6:DB.print(xm(i="success resubscribe ".concat(t.userId," with ")).call(i,t.subMediaType)),r.safeEmit(rB.RESUBSCRIBE,{stream:t}),e.next=15;break;case 10:e.prev=10,e.t0=e.catch(2),DB.print(xm(a=xm(o="failed resubscribe ".concat(t.userId," with ")).call(o,t.subMediaType,", error:")).call(a,e.t0)),t.clean(),null==t||t.resetHasSubscribed();case 15:case"end":return e.stop()}}),e,null,[[2,10]])})));return function(t){return e.apply(this,arguments)}}())}}catch(o){i.e(o)}finally{i.f()}null===(e=this._subtitleTool)||void 0===e||e.reconnect()}},{key:"_handleFFAudioTrack",value:function(){var e,t,r,n,i=null===(e=this._mediaServerClient)||void 0===e||null===(t=e.handler)||void 0===t?void 0:t.audioTrack4ff,a=null===(r=this._mediaServerClient)||void 0===r||null===(n=r.handler)||void 0===n?void 0:n.getTransceivers();if(i&&Array.isArray(a)){var o=Nb(a).call(a,(function(e){var t;return(null==e||null===(t=e.receiver)||void 0===t?void 0:t.track)===i}));if(o){var s=new RF("ff-stream","ff-stream",!1,PB);s.virtual=!0,s.audioTransceiver=o,s.audioMid="0",s.audioTrack=$V(i),this._virtualStreams.push(s),this.safeEmit(rB.SUBSCRIBE_PUSH_TRACK,{stream:s})}}}},{key:"_findRemoteStream",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?Nb(r).call(r,(function(e){return e.streamId===t})):null}},{key:"_findRemoteStreamByScreen",value:function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?Nb(r).call(r,(function(e){return e.isScreen===t})):null}},{key:"_onAddStream",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.needEmit,i=void 0===n||n,a=r.fromSignal,o=void 0===a||a,s=r.virtual,c=void 0!==s&&s;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var u=this._roomConfig,d=u.isAutoSubscribeAudio,l=u.isAutoSubscribeVideo,h=this._findRemoteStreamByScreen(e.clientId,e.screen);if(h&&h.streamId!==e.streamId){var p,f=null===(p=this._remoteStreams.get(e.clientId))||void 0===p?void 0:Gs(p).call(p,(function(e){return e.streamId!==h.streamId}));h.clean(),this._remoteStreams.set(e.clientId,f||[])}var v=this._findRemoteStream(e.clientId,e.streamId);if(this._remoteStreamStreamIdUserIdMap[e.streamId]=e.clientId,v)v.attributes=e.attributes;else if((v=new RF(e.clientId,e.streamId,e.screen,e.attributes)).virtual=c,this._initStreamListeners(v),!c){var _=this._remoteStreams.get(e.clientId);_?_.push(v):this._remoteStreams.set(e.clientId,[v])}if(this._mediaServerClient.handler&&(v.observer=new gB(v,this._mediaServerClient.handler)),!v.isScreen&&l){var m,y,g,S,E,b,k,T;if(o&&v.hasVideo)if(v.attributes.extvideo)null===(m=v.observer)||void 0===m||m.setExternalVideoSource(!0),null===(y=v.observer)||void 0===y||y.setPushVideo(!0);else null===(g=v.observer)||void 0===g||g.setExternalVideoSource(!1),null===(S=v.observer)||void 0===S||S.setPublishVideo(!0);if(o&&v.hasAudio&&d&&!this._mediaServerClient.roomAttributes.multiChatMode)if(v.attributes.extaudio)null===(E=v.observer)||void 0===E||E.setExternalAudioSource(!0),null===(b=v.observer)||void 0===b||b.setPushAudio(!0);else null===(k=v.observer)||void 0===k||k.setExternalAudioSource(!1),null===(T=v.observer)||void 0===T||T.setPublishAudio(!0);if(!0===i&&!1===o){var I,A=this._roomConfig,R=A.isAutoSubscribeAudio,C=A.isAutoSubscribeVideo;null===(I=v.observer)||void 0===I||I.setLogin(!0,{audio:!!R,video:!!C})}}return i&&this.safeEmit(dN.ON_ADD_STREAM,{stream:v}),v}}},{key:"_onUserConnection",value:function(e){var t;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var r=this._userDuplicateLoginTimerMap.get(e.clientId);if("number"==typeof r)return this._userDuplicateLoginTimerMap.delete(e.clientId),void self.clearTimeout(r);var n={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,ud({},n)),this.safeEmit(dN.USER_CONNECTION,{userInfo:n}),e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(rB.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(rB.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}}},{key:"_onUserDisconnection",value:function(e){var t,r=this,n=e.clientId,i=e.tag,a=e.code;if(n)if(n===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var o=null;i===pN.kickedByAdmin?o=lR.KICKED_OUT:i===pN.onUserTokenDidExpire?o=lR.TOKEN_EXPIRED:i===pN.userDuplicateLogin&&(o=lR.DUPLICATE_LOGIN),a===fN.roomDismissByAdmin&&(o=lR.ROOM_DISMISS),o&&this.safeEmit(rB.ON_ROOM_ERROR,{errorCode:o})}else{var s=hd.DROPPED;i===pN.userLeave?s=hd.QUIT:i===pN.kickedByAdmin?s=hd.KICKED_BY_ADMIN:i===pN.roleChanged&&(s=hd.SWITCH_TO_INVISIBLE);var c=function(){var e;r._remoteUsers.delete(n),null===(e=r._remoteStreams.get(n))||void 0===e||e.forEach((function(e){e.clean(),r._onRemoveStream({clientId:e.userId,streamId:e.streamId,message:cN.clientDisconnected})})),r._remoteStreams.delete(n),r.safeEmit(rB.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===pN.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(n);u&&self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else c()}}},{key:"_onRemoveStream",value:function(e){var t,r=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var n=this._remoteStreams.get(e.clientId);if(n){var i=Nb(n).call(n,(function(t){return t.streamId===e.streamId}));if(i){var a,o,s;if(null===(a=this._mediaServerClient)||void 0===a||a.handleRemoveStream(i,e).then((function(){var t=r._remoteStreams.get(e.clientId);t&&(t=Gs(t).call(t,(function(t){return t.streamId!==e.streamId||(t.clean(),!1)})),r._remoteStreams.set(e.clientId,t))})).finally((function(){r.safeEmit(dN.ON_REMOVE_STREAM,{stream:i,reason:e.message})})),i.hasVideo)null===(o=i.observer)||void 0===o||o.setPublishVideo(!1);if(i.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode)null===(s=i.observer)||void 0===s||s.setPublishAudio(!1)}}}}},{key:"_onUpdateUserAttributes",value:function(e){e.attributes&&(e.attributes.serverMuteVideo&&this.safeEmit(rB.ON_VIDEO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteVideo}),e.attributes.serverMuteAudio&&this.safeEmit(rB.ON_AUDIO_STREAM_BANNED,{uid:e.clientId,banned:1===e.attributes.serverMuteAudio}))}},{key:"_onUpdateRoomAttributes",value:function(e){var t;e.roomAttributes&&(this._mediaServerClient.roomAttributes=ud(ud({},this._mediaServerClient.roomAttributes),e.roomAttributes)),null!==(t=e.roomAttributes)&&void 0!==t&&t.multiChatMode&&this._handleFFAudioTrack()}},{key:"_onUpdateStreamAttributes",value:function(e){var t=this._roomConfig,r=t.isAutoSubscribeAudio,n=t.isAutoSubscribeVideo,i=e.clientId,a=e.streamId,o=e.attributes,s=this._findRemoteStream(i,a);if(s){var c,u,d=s.attributes,l=ud(ud({},d),o),h=!1,p=l.localaudio!==d.localaudio,f=!1,v=!1,_=l.localvideo!==d.localvideo,m=!1,y=uF.NONE,g=uF.NONE;if(l.audiostream!==d.audiostream&&(h=l.localaudio,f=!!l.audiostream,l.audiostream?y|=Sd.AUDIO:g|=Sd.AUDIO),l.videostream!==d.videostream&&(v=l.localvideo,m=!!l.videostream,l.videostream?y|=Sd.VIDEO:g|=Sd.VIDEO),y&&this.safeEmit(rB.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:y,isScreen:s.isScreen,pubState:iB.PUB,remoteStream:s}),g&&this.safeEmit(rB.ON_USER_PUBLISH_STATE_CHANGE,{userId:i,mediaType:g,isScreen:s.isScreen,pubState:iB.UNPUB,remoteStream:s}),s.attributes=l,l.localaudio!==d.localaudio)if(l.localaudio){var S,E,b,k;if(r)if(l.extaudio)null===(S=s.observer)||void 0===S||S.setExternalAudioSource(!0),null===(E=s.observer)||void 0===E||E.setPushAudio(!0);else null===(b=s.observer)||void 0===b||b.setExternalAudioSource(!1),null===(k=s.observer)||void 0===k||k.setEnableAudio(!0);this.safeEmit(rB.ON_USER_START_AUDIO_CAPTURE,{userId:i},s)}else{var T,I,A,R;if(l.extaudio)null===(T=s.observer)||void 0===T||T.setExternalAudioSource(!0),null===(I=s.observer)||void 0===I||I.setPushAudio(!1);else null===(A=s.observer)||void 0===A||A.setExternalAudioSource(!1),null===(R=s.observer)||void 0===R||R.setEnableAudio(!1);!s.isScreen&&this.safeEmit(rB.ON_USER_STOP_AUDIO_CAPTURE,{userId:i})}if(l.localvideo!==d.localvideo)if(l.localvideo){var C,w,x,O;if(n)if(l.extvideo)null===(C=s.observer)||void 0===C||C.setExternalVideoSource(!0),null===(w=s.observer)||void 0===w||w.setPushVideo(!0);else null===(x=s.observer)||void 0===x||x.setExternalVideoSource(!1),null===(O=s.observer)||void 0===O||O.setEnableVideo(!0);this.safeEmit(rB.ON_USER_START_VIDEO_CAPTURE,{userId:i})}else{var D,P,N,M;if(l.extvideo)null===(D=s.observer)||void 0===D||D.setExternalVideoSource(!0),null===(P=s.observer)||void 0===P||P.setPushVideo(!1);else null===(N=s.observer)||void 0===N||N.setExternalVideoSource(!1),null===(M=s.observer)||void 0===M||M.setEnableVideo(!1);!s.isScreen&&this.safeEmit(rB.ON_USER_STOP_VIDEO_CAPTURE,{userId:i})}if(h&&!p)null===(c=s.observer)||void 0===c||c.setRemoteUnmuteAudio(f);if(v&&!_)null===(u=s.observer)||void 0===u||u.setRemoteUnmuteVideo(m)}}},{key:"_onPushTrack",value:function(e){var t,r=this;if(null!==(t=e.streamId)&&void 0!==t&&dR(t).call(t,"audio_mux")){var n=this._onAddStream(ud(ud({},e),{},{attributes:PB}),{needEmit:!1,fromSignal:!1,virtual:!0});n&&this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){r.safeEmit(rB.SUBSCRIBE_PUSH_TRACK,{stream:n}),r._virtualStreams.push(n)})).catch((function(e){DB.print("subscribe","push track failed %o",e)}))}else{var i;CP.rtcError(xm(i="onPushTrack, userId: ".concat(e.clientId,", ")).call(i,e.streamId),-1001)}}},{key:"_onRemoveTrack",value:function(e){var t,r=e.clientId,n=e.streamId,i=e.message;DB.print("_onRemoveTrack","remove track: %o",r);var a=this._findRemoteStream(r,n);a&&(null===(t=this._mediaServerClient)||void 0===t||t.unsubscribe4removeTrack(a,i))}},{key:"_onMeetingSpeakerChange",value:function(e){if(Array.isArray(null==e?void 0:e.speakerCsrcInfo)){var t={};null==e||e.speakerCsrcInfo.forEach((function(e){var r=e.csrc,n=e.userId;e.isScreen||(t[r]=n)})),this._csrcUserIdMap=t}}},{key:"getActiveSpeakerInMultiChatMode",value:function(){var e=this,t=[];return this._virtualStreams.forEach((function(r){var n,i=null===(n=r.audioTransceiver)||void 0===n?void 0:n.receiver;if(i){var a=$T(i.getContributingSources()||[],1)[0];if(a){var o=a.audioLevel,s=a.source;e._csrcUserIdMap[s]&&t.push({userId:e._csrcUserIdMap[s],audioLevel:o})}}})),t.length&&BA(t).call(t,(function(e,t){return e.audioLevel-t.audioLevel})),t}},{key:"_nodeChange",value:function(e){var t,r=e.nodes,n=e.reason;YP.clearAccessNode(null===(t=this._roomInfo)||void 0===t?void 0:t.appId),this._destroyAndInitMediaServerClient(),Array.isArray(r)&&r.length?this._getAccessNode=r[0]:this._getAccessFeedback=n,CP.rtcNodeChange(0,ny(e),ny(n)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()}},{key:"_reconnect",value:function(){var e,t=this;this._isReconnecting=!0;var r,n=ZT(nA(e=this._remoteStreams).call(e));try{for(n.s();!(r=n.n()).done;){var i=r.value;Array.isArray(i)&&i.forEach((function(e){return e.clean()}))}}catch(a){n.e(a)}finally{n.f()}CP.rtcReconnect(1002,WD.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,YD.PEERCONNECTION),this._liveTranscodingOnceSucc||delete this._liveControlMessage,this._join((function(){CP.rtcReconnected(QD.PEERCONNECTION_RECONNECTED,JD.PEERCONNECTION)}),(function(e){t._reconnectRecord.record(e),t._reconnectRecord.shouldReconnect?(DB.print("Reconnecting error, will reconnect after 3s",e),t._reconnectTimer=window.setTimeout(t._reconnect.bind(t),3e3)):(t.safeEmit(rB.RECONNECT_FAILED),t.destroy())}),!0)}},{key:"_handleAbnormalDisconnection",value:function(){DB.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=window.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_onConnectionStateChange",value:function(e){var t,r=this;if(e.next===hB.DISCONNECTED)t=bd.CONNECTION_STATE_DISCONNECTED;else if(e.next===hB.CONNECTED)clearTimeout(this._connectionLostTimer),t=this._isReconnecting?bd.CONNECTION_STATE_RECONNECTED:bd.CONNECTION_STATE_CONNECTED;else{if(e.next!==hB.CONNECTING)return;t=this._isReconnecting?bd.CONNECTION_STATE_RECONNECTING:bd.CONNECTION_STATE_CONNECTING}e.prev===hB.CONNECTED&&e.next===hB.DISCONNECTED&&(this._connectionLostTimer=window.setTimeout((function(){r.safeEmit(hN.ON_CONNECTION_STATE_CHANGE,{state:bd.CONNECTION_STATE_LOST})}),1e4)),this._networkQualityManager.setConnectionState(e.next),this.safeEmit(hN.ON_CONNECTION_STATE_CHANGE,{state:t})}},{key:"_initStreamListeners",value:function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){var n;t.emit(rB.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(n=t._roomInfo)||void 0===n?void 0:n.roomId,streamIndex:e.isScreen?gd.STREAM_INDEX_SCREEN:gd.STREAM_INDEX_MAIN}})}))}},{key:"_onCustomMessage",value:function(e){this.safeEmit(dN.ON_CUSTOM_MESSAGE,e)}},{key:"_onUserMessageReceived",value:function(e){this.safeEmit(dN.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})}},{key:"_onUserBinaryMessageReceived",value:function(e){var t,r={userId:e.from,message:e.msg};null!==(t=this._subtitleTool)&&void 0!==t&&t.onMessageRecv(r)||this.safeEmit(dN.USER_BINARY_MESSAGE_RECEIVED,r)}},{key:"_initSubtitleTool",value:function(){var e=this;this._subtitleTool=new wB(this),this._subtitleTool.onEvent=function(t){e.emit(rB.ON_SUBTITLE_STATE_CHANGED,t)},this._subtitleTool.onMessage=function(t){e.emit(rB.ON_SUBTITLE_MESSAGE_RECEIVED,t)}}},{key:"_onPostProcessingMessage",value:function(e){if(e.body)if("subtitleCallback"!==e.type){var t=e.body,r=t.error||0,n=nB.START,i=["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"];if("2.0"===t.protocol){switch(t.eventType){case"TranscodeStarted":0!==t.error&&(n=nB.START_FAILED);break;case"TranscodeStateChanged":n=0!==t.error?nB.START_FAILED:nB.START_SUCCESS;break;case"TranscodeStopped":n=0!==t.error?nB.STOP_FAILED:nB.STOP_SUCCESS;break;case"TranscodeUpdated":n=0!==t.error?nB.UPDATE_FAILED:nB.UPDATE_SUCCESS}this.safeEmit(dN.POST_PROCESSING_MESSAGE,{code:r,protocol:t.protocol,error:t.error,eventType:n,message:i[r]})}this.safeEmit(dN.POST_PROCESSING_MESSAGE,{code:r,message:i[r],type:e.type})}else{var a;null===(a=this._subtitleTool)||void 0===a||a.onResult(e)}}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(dN.ON_USER_TOKEN_WILL_EXPIRE,null)}},{key:"_onStreamFailed",value:(r=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("publish"!==t.type){e.next=11;break}if(s=void 0,(null===(r=this.localStream)||void 0===r?void 0:r.streamId)===t.streamId?s=this.localStream:(null===(n=this.localScreenStream)||void 0===n?void 0:n.streamId)===t.streamId&&(s=this.localScreenStream),s){e.next=5;break}return e.abrupt("return");case 5:return null===(i=s)||void 0===i||i.clean(),e.next=8,null===(a=this._mediaServerClient)||void 0===a?void 0:a.unpublish(s).catch((function(){}));case 8:null===(o=this._mediaServerClient)||void 0===o||o.publish(s).catch((function(){})),e.next=20;break;case 11:if("subscribe"!==t.type){e.next=20;break}if(c=this._remoteStreamStreamIdUserIdMap[t.streamId],!(u=this._findRemoteStream(c,t.streamId))){e.next=20;break}return e.next=17,null===(d=this._mediaServerClient)||void 0===d?void 0:d.unsubscribe(u,Sd.AUDIO_AND_VIDEO);case 17:return e.next=19,null===(l=this._mediaServerClient)||void 0===l?void 0:l.subscribe(u,u.subMediaType,u.subLayer);case 19:this.safeEmit(rB.RESUBSCRIBE,{stream:u});case 20:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_onStreamControlMessage",value:function(e){var t,r;e.type===uN.PushLimitWarn&&(null!==(t=this._localStream)&&void 0!==t&&t.pubAudio||null!==(r=this._localStream)&&void 0!==r&&r.pubVideo||this.unpublish())}},{key:"_onPublishOnDemand",value:(t=m_(Im.mark((function e(){var t,r,n,i,a,o,s,c,u,d,l,h,p,f;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._publishOnDemandBusy&&!1!==(null===(t=this._serverConfig)||void 0===t||null===(r=t.engine_VPM)||void 0===r||null===(n=r.ondemand)||void 0===n?void 0:n.enable)){e.next=2;break}return e.abrupt("return");case 2:if(o=this._publishOnDemandItem,this._publishOnDemandItem=void 0,o){e.next=6;break}return e.abrupt("return");case 6:if(null===(i=this._localStream)||void 0===i||!i.enableSimulcast||null===(a=this._localStream)||void 0===a||!a.videoTransceiver){e.next=16;break}return u=[],this._publishOnDemandBusy=!0,d=null===(s=this._localStream)||void 0===s?void 0:s.stream.id,l=null===(c=this._localStream)||void 0===c?void 0:c.videoTransceiver.sender,h=l.getParameters(),Array.isArray(h.encodings)&&Array.isArray(o)&&(f={},DB.print("_onPublishOnDemand exec","usedDescriptions: %o",o),o.forEach((function(e){var t;if(null!=e&&null!==(t=e.StreamIds)&&void 0!==t&&$m(t).call(t,d)){var r=null==e?void 0:e.Metadata.VideoIndex;f[r]=!0}})),h.encodings=uy(p=h.encodings).call(p,(function(e){if(e.rid){f[e.rid]?e.active=!0:e.active=!1;var t=+e.rid;u[t]=e.active}return e})),this._context&&(this._context.activeSimStreams=u)),e.next=15,l.setParameters(h);case 15:this._publishOnDemandBusy=!1;case 16:this._onPublishOnDemand();case 17:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_onRTT",value:function(e){var t=e.StreamIds,r=e.Metadata;if(t.length&&r){var n,i=t[0];null!==(n=this._context)&&void 0!==n&&n.streamRTT&&(this._context.streamRTT[i]={audio:r.audio_rtt,video:r.video_rtt})}}},{key:"_reportNetworkQuality",value:function(e,t){this.emit(rB.ON_NETWORK_QUALITY,e,t)}},{key:"_emitVideoSizeChange",value:function(e,t,r,n){var i;this.emit(rB.ON_REMOTE_VIDEO_SIZE_CHANGED,{roomId:null===(i=this.roomInfo)||void 0===i?void 0:i.roomId,userId:e,streamIndex:t?gd.STREAM_INDEX_SCREEN:gd.STREAM_INDEX_MAIN},{width:r,height:n})}},{key:"multiChatMode",get:function(){var e;return null===(e=this._mediaServerClient)||void 0===e?void 0:e.multiChatMode()}}]),I}(ex),MB=function(){function e(){Wd(this,e),sd(this,"_all_201_count",void 0),sd(this,"_has_4xx",void 0),this._all_201_count=0,this._has_4xx=!1}return qd(e,[{key:"shouldReconnect",get:function(){return!(this._all_201_count>=3||this._has_4xx)}},{key:"record",value:function(e){var t=!1,r=!1;if(Array.isArray(e)){var n=0;uy(e).call(e,(function(e){var t,i,a;400<=(null===(t=e.error)||void 0===t?void 0:t.code)&&(null===(i=e.error)||void 0===i?void 0:i.code)<500&&(r=!0),201===(null===(a=e.error)||void 0===a?void 0:a.code)&&n++})),n===e.length&&(t=!0),t&&this._all_201_count++,r&&(this._has_4xx=!0)}}},{key:"clear",value:function(){this._all_201_count=0,this._has_4xx=!1}}]),e}(),LB=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&JE(r.style,t.style),t.attributes&&bR(t.attributes).forEach((function(e){var t=$T(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r},UB=new Jw("Player",0),VB=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],FB={playsinline:"","webkit-playsinline":""},BB={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},jB=function(e){DI(n,e);var t,r=YI(n);function n(e){var t;Wd(this,n),sd(eI(t=r.call(this)),"_containerDom",void 0),sd(eI(t),"_videoDom",void 0),sd(eI(t),"__cumulativeTime",void 0),sd(eI(t),"userId",void 0),sd(eI(t),"renderMode",void 0),sd(eI(t),"mirrorType",kd.MIRROR_TYPE_NONE),sd(eI(t),"isScreen",void 0),sd(eI(t),"isLocal",void 0),sd(eI(t),"played",!1),sd(eI(t),"_emitPlayFailed",!1),sd(eI(t),"_videoContainer",void 0),sd(eI(t),"_safari15VideoTimer",void 0),sd(eI(t),"emitVideoEvent",(function(e){var r,n,i={type:"video",rawEvent:e,readyState:(null===(r=t._videoDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:t.isScreen};switch(t.emit("playback_event",i),e.type){case"canplay":case"loadeddata":t._internalPlay();break;case"playing":UB.print("VideoPlayerPlaying","[userId-".concat(t.userId,"] video element playing"))}})),sd(eI(t),"_internalPlay",(function(){var e;if(null!==(e=t._videoDom)&&void 0!==e&&e.paused){var r=t._videoDom.play();null!=r&&r.then&&r.catch((function(e){var r,n,i,a;t._emitPlayFailed||("AbortError"!==e.name?(t._emitPlayFailed=!0,CP.rtcError(xm(r="video autoplay failed, userId: ".concat(t.userId,", ")).call(r,e.name),-1e3),t.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(n=t._videoDom)||void 0===n?void 0:n.readyState)||0,userId:t.userId,eventName:"autoplay-error",currentTime:(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime)||0,isScreen:t.isScreen})):CP.rtcError(xm(a="video autoplay failed, userId: ".concat(t.userId,", ")).call(a,e.name),-1e3))}))}}));var i=e.renderDom,a=e.userId;t.renderMode=void 0!==e.renderMode?e.renderMode:yd.RENDER_MODE_FIT;var o="string"==typeof i?document.getElementById(i):i;if(!o)throw new pR(lR.CANT_FIND_DOM,"can't find dom");return t._videoContainer=document.createElement("div"),t._videoContainer.style.width="100%",t._videoContainer.style.height="100%",t._videoContainer.style.position="relative",t._videoContainer.style.overflow="hidden",t._containerDom=o,t.userId=a,t.isLocal=!!e.isLocal,t.isScreen=!!e.isScreen,t._initVideo(),t}return qd(n,[{key:"_initVideo",value:function(){var e;this._videoDom||(this._videoDom=LB("video",{style:{width:"100%",height:"100%"},attributes:BB}),this._videoDom.id=xm(e="".concat(this.userId,"_")).call(e,AC()),this.renderMode===yd.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===kd.MIRROR_TYPE_RENDER));this._videoContainer.appendChild(this._videoDom),this._containerDom.appendChild(this._videoContainer),this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._videoDom&&VB.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._videoDom&&VB.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)}))}},{key:"_recordFrame",value:function(e){var t=this,r=e.isScreen?1.5:.5;if(NC&&eN.VIDEO_STALL){var n;if(null===(n=this._videoDom)||void 0===n||!n.requestVideoFrameCallback)return;this._videoDom.requestVideoFrameCallback((function n(i,a){var o=a.presentationTime;if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t.__cumulativeTime){var s,c=(o-t.__cumulativeTime)%2e3,u=c>1e3*r;null===(s=e.recordedVideoFrames)||void 0===s||s.push({playTime:o,isStall:u,stallCount:u?1:0,stallDuration:c})}t.__cumulativeTime=o,t._videoDom.requestVideoFrameCallback(n)}))}else this.on("playback_event",(function(n){var i;if("timeupdate"===n.eventName){if(!eN.VIDEO_STALL)return;if(0===(null===(i=t._videoDom)||void 0===i?void 0:i.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 a=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),o=t._videoDom.currentTime-t.__cumulativeTime>r;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:o,stallCount:o?1:0,stallDuration:a%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))}},{key:"_recordPause",value:function(e){var t=this;void 0===e.statsReport.isPaused&&this.on("playback_event",(function(r){if("pause"===r.eventName)e.statsReport.isPaused=!0,e.statsReport.pauseStart=RC();else if("timeupdate"===r.eventName){var n;if((null===(n=t._videoDom)||void 0===n||!n.paused)&&e.statsReport.isPaused){e.statsReport.isPaused=!1;var i=RC()-(e.statsReport.pauseStart||0);i>500&&(e.statsReport.pauseDuration+=i)}}}))}},{key:"playVideo",value:(t=m_(Im.mark((function e(t,r){var n,i,a,o,s=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=this._videoDom,UB.print("playVideo","play video track: ".concat(this.userId)),!(a&&a.srcObject instanceof MediaStream&&a.srcObject.getTrackById(null===(n=t.getTrack())||void 0===n?void 0:n.id))){e.next=5;break}try{CP.rtcInvokeStatus("play video repeatedly",0,"playVideo",this.userId,0)}catch(PX){}return e.abrupt("return");case 5:a||(this._initVideo(),a=this._videoDom),UB.print("playVideo","play video by dom: ".concat(null===(i=a)||void 0===i?void 0:i.id)),(o=new MediaStream).addTrack(t.getTrack("preprocessing")),a.srcObject=o,a&&!this._containerDom.contains(this._videoContainer)&&this._containerDom.appendChild(this._videoContainer),a&&!this._videoContainer.contains(a)&&this._videoContainer.appendChild(a),setTimeout((function(){return s._internalPlay()})),r&&(this._recordFrame(r),this._recordPause(r),r.statsReport.player=this),this.played=!0;case 15:case"end":return e.stop()}}),e,this)}))),function(e,r){return t.apply(this,arguments)})},{key:"updateSrcObject",value:function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}}},{key:"manuallyPlay",value:function(){if(UB.print("Invoke VideoPlayer.manuallyPlay",this.userId,this.isScreen),this._emitPlayFailed=!1,!this._videoDom)throw new pR(lR.INVALID_PARAMS,"Player not found");return 0!==this._videoDom.readyState||GC?this._videoDom.play():v_.resolve()}},{key:"mirror",value:function(e){var t;UB.print("mirror",xm(t="".concat(this.userId," set mirror: ")).call(t,e)),this.mirrorType=e?kd.MIRROR_TYPE_RENDER:kd.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")}},{key:"stop",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],r=this._containerDom;(UB.print("stop","stop video track: ".concat(this.userId)),this._videoDom)&&(t||(this._videoDom.srcObject=null),null!=r&&r.contains(this._videoContainer)&&r.removeChild(this._videoContainer),null!==(e=this._videoContainer)&&void 0!==e&&e.contains(this._videoDom)&&this._videoContainer.removeChild(this._videoDom));this.__cumulativeTime=void 0,this.played=!1}},{key:"destroy",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];UB.print("destroy","video player: ".concat(this.userId)),this.stop(e),xI(CI(n.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._videoDom&&delete this._videoDom,this._safari15VideoTimer&&(window.clearInterval(this._safari15VideoTimer),this._safari15VideoTimer=void 0)}},{key:"domElement",get:function(){return this._videoDom}}]),n}(Pw.exports.EventEmitter),GB=function(e){DI(i,e);var t,r,n=YI(i);function i(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{divId:void 0,muted:!1,isScreen:!1},a=r.divId,o=r.muted,s=r.isScreen;if(Wd(this,i),sd(eI(t=n.call(this)),"_containerDom",void 0),sd(eI(t),"_audioDom",void 0),sd(eI(t),"_fakeAudioDom",void 0),sd(eI(t),"userId",void 0),sd(eI(t),"muted",!1),sd(eI(t),"_emitPlayFailed",!1),sd(eI(t),"played",!1),sd(eI(t),"isScreen",void 0),sd(eI(t),"_wechatTimer",void 0),sd(eI(t),"emitAudioEvent",(function(e){var r,n,i={type:"audio",rawEvent:e,readyState:(null===(r=t._audioDom)||void 0===r?void 0:r.readyState)||0,userId:t.userId,eventName:e.type,currentTime:(null===(n=t._audioDom)||void 0===n?void 0:n.currentTime)||0};"playing"===e.type&&UB.print("AudioPlayerPlaying","[userId-".concat(t.userId,"] audio element playing")),"pause"===e.type&&UB.print("AudioPlayerPause","[userId-".concat(t.userId,"] audio element pause")),HC&&GC&&("canplay"===e.type?(clearTimeout(t._wechatTimer),t._wechatTimer=window.setTimeout((function(){t._autoPlayError("wechat")}),500)):"playing"===e.type&&clearTimeout(t._wechatTimer)),t.emit("playback_event",i)})),sd(eI(t),"_internalPlay",(function(){var e,r;if(BP("_internalPlay",{paused:null===(e=t._audioDom)||void 0===e?void 0:e.paused}),null!==(r=t._audioDom)&&void 0!==r&&r.paused)try{var n=t._audioDom.play();null!=n&&n.then&&n.catch((function(e){var r,n;t._autoPlayError(e),CP.rtcError(xm(r=xm(n="audio autoplay failed, userId: ".concat(t.userId,": ")).call(n,e.message," ")).call(r,e.name),-1e3)})).then((function(){BP("_internalPlay successfully",{userId:t.userId})}))}catch(o){var i,a;t._autoPlayError(o),CP.rtcError(xm(i=xm(a="audio autoplay failed, userId: ".concat(t.userId,": ")).call(a,o.message," ")).call(i,o.name),-1e3)}})),a){var c=document.getElementById(a);if(!c)throw new pR(lR.CANT_FIND_DOM,"can't find dom");t._containerDom=c}else t._containerDom=document.body;return t.userId=e,t.muted=o,t.isScreen=s,t._initAudio(),t}return qd(i,[{key:"_initAudio",value:function(){var e;this._audioDom||(this._audioDom=LB("audio",{style:{display:"none"},attributes:FB}),this._audioDom.volume=this.muted?0:1,this._audioDom.muted=this.muted,this._audioDom.id=xm(e="".concat(this.userId,"_")).call(e,AC()),this._containerDom.appendChild(this._audioDom));this._initListeners()}},{key:"_initListeners",value:function(){var e=this;this._audioDom&&VB.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitAudioEvent)}))}},{key:"_removeListeners",value:function(){var e=this;this._audioDom&&(VB.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitAudioEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))}},{key:"playAudio",value:(r=m_(Im.mark((function e(t){var r,n,i,a,o,s=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(UB.print("playAudio","play audio track: ".concat(this.userId)),!((a=this._audioDom)&&a.srcObject instanceof MediaStream&&a.srcObject.getTrackById(null===(r=t.getTrack())||void 0===r?void 0:r.id))){e.next=4;break}return e.abrupt("return");case 4:a||(this._initAudio(),a=this._audioDom),(o=new MediaStream).addTrack(t.getTrack("preprocessing")),a.srcObject=o,null===(n=a)||void 0===n||n.addEventListener("canplay",this._internalPlay),null===(i=a)||void 0===i||i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return s._internalPlay()})),this.played=!0;case 12:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_autoPlayError",value:function(e){var t,r;this._emitPlayFailed||(this._emitPlayFailed=!0,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===(r=this._audioDom)||void 0===r?void 0:r.currentTime)||0}))}},{key:"pause",value:function(){if(!this._audioDom)throw new pR(lR.INVALID_PARAMS,"Player not found");this._audioDom.pause()}},{key:"manuallyPlay",value:function(){var e;if(UB.print("Invoke AudioPlayer.manuallyPlay"),this._emitPlayFailed=!1,!this._audioDom)throw new pR(lR.INVALID_PARAMS,"Player not found");if(!this.played)return v_.resolve();this._audioDom.volume=1,this._audioDom.muted=!1,null===(e=this._fakeAudioDom)||void 0===e||e.play();var t=this._audioDom.play();return null!=t&&t.then?t:v_.resolve(t)}},{key:"setPlaybackDevice",value:(t=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return UB.print("setPlaybackDevice","setPlaybackDevice: ".concat(t)),e.next=3,gV.enumerateAudioPlaybackDevices();case 3:if(r=e.sent,n=uy(r).call(r,(function(e){return e.deviceId})),$m(n).call(n,t)&&this._audioDom&&this._audioDom.setSinkId){e.next=7;break}return e.abrupt("return");case 7:return e.next=9,this._audioDom.setSinkId(t);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"stop",value:function(){var e=this._containerDom;UB.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,null!=e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom)),this._fakeAudioDom&&(this._fakeAudioDom.srcObject=null,this._fakeAudioDom=void 0),this.played=!1}},{key:"domElement",get:function(){return this._audioDom}},{key:"destroy",value:function(){UB.print("destroy","audio player: ".concat(this.userId)),this.stop(),xI(CI(i.prototype),"removeAllListeners",this).call(this),this._removeListeners(),this._audioDom&&(this._audioDom.srcObject=null,delete this._audioDom)}}]),i}(Pw.exports.EventEmitter);function HB(e,t,r,n){var i=function(){var e=m_(Im.mark((function e(t,i){var a,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=null==n?void 0:n.get(i),Array.isArray(a)&&(a=null===(o=a)||void 0===o?void 0:Nb(o).call(o,(function(e){return e.isScreen===r}))),!t){e.next=9;break}if(!t.played){e.next=8;break}return e.next=6,t.manuallyPlay();case 6:e.next=9;break;case 8:a&&(t instanceof jB&&a.videoTrack&&t.playVideo(a.videoTrack,a),t instanceof GB&&a.audioTrack&&t.playAudio(a.audioTrack));case 9:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}();if(t)return i(e.get(t),t);var a=[];return e.forEach((function(e,t){return a.push(i(e,t))})),v_.all(a)}var zB=function(){function e(){Wd(this,e),sd(this,"_timer",void 0),sd(this,"userMessage",void 0),sd(this,"roomMessage",void 0),this.userMessage={},this.roomMessage={},this._setTimer()}return qd(e,[{key:"_setTimer",value:function(){var e=this;!function t(){e._reportAndgReset(),clearTimeout(e._timer),e._timer=setTimeout(t,1e4)}()}},{key:"_reportAndgReset",value:function(){(on(this.userMessage).length||on(this.roomMessage).length)&&(this._report(),this._reset())}},{key:"_report",value:function(){var e,t,r=this;CP.rtcMessageStatistics(uy(e=on(this.userMessage)).call(e,(function(e){return r.userMessage[e]})),uy(t=on(this.roomMessage)).call(t,(function(e){return r.roomMessage[e]})),"")}},{key:"_reset",value:function(){this.userMessage={},this.roomMessage={}}},{key:"_checkInitUserMessage",value:function(e,t){var r,n;this.userMessage[xm(r="".concat(t,"-")).call(r,e)]||(this.userMessage[xm(n="".concat(t,"-")).call(n,e)]={dc_peer_user_id:e,dc_send_total:0,dc_recv_total:0,dc_send_ack:0,dc_send_fail:0,dc_fail_timeout:0,dc_fail_no_receiver:0,dc_fail_no_relay_path: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})}},{key:"_sendUserMessage",value:function(e,t,r){var n,i;(this._checkInitUserMessage(e,t),this.userMessage[xm(n="".concat(t,"-")).call(n,e)].dc_send_total++,r)&&this.userMessage[xm(i="".concat(t,"-")).call(i,e)].dc_send_binary++}},{key:"_recvUserMessage",value:function(e,t){var r;this._checkInitUserMessage(e,t),this.userMessage[xm(r="".concat(t,"-")).call(r,e)].dc_recv_total++}},{key:"_sendUserFail",value:function(e,t,r){var n,i=this.userMessage[xm(n="".concat(t,"-")).call(n,e)];i&&(i.dc_send_fail++,this._handleUserFail(i,r))}},{key:"_handleUserFail",value:function(e,t){t&&(t.code||t.err)&&(t.code===lR.TIME_OUT||t.code===lR.USER_MESSAGE_TIMEOUT?e.dc_fail_timeout++:t.err===mN.NO_RECEIVER?e.dc_fail_no_receiver++:t.err===mN.NO_RELAYPATH?e.dc_fail_no_relay_path++:t.err===mN.TIMEOUT&&e.dc_fail_timeout++)}},{key:"_sendUserAck",value:function(e,t,r,n,i){var a,o=this.userMessage[xm(a="".concat(t,"-")).call(a,e)];o&&(o.dc_send_ack++,o.dc_cost_time+=r,o.dc_cost_s2s+=n||0,o.dc_cost_peer_s2e+=i,o.dc_cost_e2s+=r-(n||0)-i,r<=100?(o.dc_send_ack_100++,o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=200?(o.dc_send_ack_200++,o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=400?(o.dc_send_ack_400++,o.dc_send_ack_1s++):r<=1e3&&o.dc_send_ack_1s++,r<o.dc_least_time&&(o.dc_least_time=r),r>o.dc_most_time&&(o.dc_most_time=r))}},{key:"sendRoomMessage",value: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++}},{key:"sendRoomFail",value:function(e){var t=this.roomMessage[e];t&&t.dc_send_fail++}},{key:"sendRoomAck",value:function(e,t){var r=this.roomMessage[e];r&&(r.dc_send_ack++,r.dc_cost_time+=t,t<r.dc_least_time&&(r.dc_least_time=t),t>r.dc_most_time&&(r.dc_most_time=t),t<=100?(r.dc_send_ack_100++,r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=200?(r.dc_send_ack_200++,r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=400?(r.dc_send_ack_400++,r.dc_send_ack_1s++):t<=1e3&&r.dc_send_ack_1s++)}},{key:"sendP2PMessage",value:function(e,t){this._sendUserMessage(e,EP.P2P,t)}},{key:"recvP2PMessage",value:function(e){this._recvUserMessage(e,EP.P2P)}},{key:"sendP2PFail",value:function(e,t){this._sendUserFail(e,EP.P2P,t)}},{key:"sendP2PAck",value:function(e,t,r,n){this._sendUserAck(e,EP.P2P,t,r,n)}},{key:"sendP2POutRoomMessage",value:function(e,t){this._sendUserMessage(e,EP.P2P_OUTSIDE_ROOM,t)}},{key:"recvP2POutRoomMessage",value:function(e){this._recvUserMessage(e,EP.P2P_OUTSIDE_ROOM)}},{key:"sendP2POutRoomFail",value:function(e,t){this._sendUserFail(e,EP.P2P_OUTSIDE_ROOM,t)}},{key:"sendP2POutRoomAck",value:function(e,t,r,n){this._sendUserAck(e,EP.P2P_OUTSIDE_ROOM,t,r,n)}},{key:"sendP2serverMessage",value:function(e){this._sendUserMessage("",EP.P2SERVER,e)}},{key:"sendP2serverFail",value:function(e){this._sendUserFail("",EP.P2SERVER,e)}},{key:"sendP2serveAck",value:function(e,t,r){this._sendUserAck("",EP.P2SERVER,e,t,r)}},{key:"countP2PMessage",value:function(e,t,r,n,i){this.sendP2PMessage(t,r),e?this.sendP2PAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2PFail(t,i)}},{key:"countRoomMessage",value:function(e,t,r,n){this.sendRoomMessage(t,r),e?this.sendRoomAck(t,Date.now()-n):this.sendRoomFail(t)}},{key:"countUserMessageOutsideRoom",value:function(e,t,r,n,i){this.sendP2POutRoomMessage(t,r),e?this.sendP2POutRoomAck(t,Date.now()-n,i.s2s_time,i.s2e_time):this.sendP2POutRoomFail(t,i)}},{key:"countServerMessage",value:function(e,t,r,n){this.sendP2serverMessage(t),e?(n=n||{},this.sendP2serveAck(Date.now()-r,n.s2s_time||0,n.s2e_time||0)):this.sendP2serverFail(n)}},{key:"destroy",value:function(){this._reset(),clearTimeout(this._timer)}}]),e}(),KB="object"==typeof global&&global&&global.Object===Object&&global,XB="object"==typeof self&&self&&self.Object===Object&&self,qB=KB||XB||Function("return this")(),WB=qB.Symbol,YB=Object.prototype,QB=YB.hasOwnProperty,JB=YB.toString,ZB=WB?WB.toStringTag:void 0;var $B=Object.prototype.toString;var ej=WB?WB.toStringTag:void 0;function tj(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":ej&&ej in Object(e)?function(e){var t=QB.call(e,ZB),r=e[ZB];try{e[ZB]=void 0;var n=!0}catch(a){}var i=JB.call(e);return n&&(t?e[ZB]=r:delete e[ZB]),i}(e):function(e){return $B.call(e)}(e)}function rj(e){return null!=e&&"object"==typeof e}var nj=Array.isArray;function ij(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}function aj(e){return e}function oj(e){if(!ij(e))return!1;var t=tj(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var sj,cj=qB["__core-js_shared__"],uj=(sj=/[^.]+$/.exec(cj&&cj.keys&&cj.keys.IE_PROTO||""))?"Symbol(src)_1."+sj:"";var dj=Function.prototype.toString;var lj=/^\[object .+?Constructor\]$/,hj=Function.prototype,pj=Object.prototype,fj=hj.toString,vj=pj.hasOwnProperty,_j=RegExp("^"+fj.call(vj).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function mj(e){return!(!ij(e)||(t=e,uj&&uj in t))&&(oj(e)?_j:lj).test(function(e){if(null!=e){try{return dj.call(e)}catch(t){}try{return e+""}catch(t){}}return""}(e));var t}function yj(e,t,r){switch(r.length){case 0:return e.call(t);case 1:return e.call(t,r[0]);case 2:return e.call(t,r[0],r[1]);case 3:return e.call(t,r[0],r[1],r[2])}return e.apply(t,r)}var gj=Date.now;var Sj,Ej,bj,kj=function(){try{var e=mj(t=function(e,t){return null==e?void 0:e[t]}(Object,"defineProperty"))?t:void 0;return e({},"",{}),e}catch(r){}var t}(),Tj=kj,Ij=Tj?function(e,t){return Tj(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:aj,Aj=(Sj=Ij,Ej=0,bj=0,function(){var e=gj(),t=16-(e-bj);if(bj=e,t>0){if(++Ej>=800)return arguments[0]}else Ej=0;return Sj.apply(void 0,arguments)}),Rj=Aj,Cj=/^(?:0|[1-9]\d*)$/;function wj(e,t){var r=typeof e;return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&Cj.test(e))&&e>-1&&e%1==0&&e<t}function xj(e,t,r){"__proto__"==t&&Tj?Tj(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function Oj(e,t){return e===t||e!=e&&t!=t}var Dj=Object.prototype.hasOwnProperty;function Pj(e,t,r){var n=e[t];Dj.call(e,t)&&Oj(n,r)&&(void 0!==r||t in e)||xj(e,t,r)}var Nj=Math.max;function Mj(e,t){return Rj(function(e,t,r){return t=Nj(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,a=Nj(n.length-t,0),o=Array(a);++i<a;)o[i]=n[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=n[i];return s[t]=r(o),yj(e,this,s)}}(e,t,aj),e+"")}function Lj(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function Uj(e){return null!=e&&Lj(e.length)&&!oj(e)}var Vj=Object.prototype;function Fj(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||Vj)}function Bj(e){return rj(e)&&"[object Arguments]"==tj(e)}var jj=Object.prototype,Gj=jj.hasOwnProperty,Hj=jj.propertyIsEnumerable,zj=Bj(function(){return arguments}())?Bj:function(e){return rj(e)&&Gj.call(e,"callee")&&!Hj.call(e,"callee")},Kj=zj;var Xj="object"==typeof exports&&exports&&!exports.nodeType&&exports,qj=Xj&&"object"==typeof module&&module&&!module.nodeType&&module,Wj=qj&&qj.exports===Xj?qB.Buffer:void 0,Yj=(Wj?Wj.isBuffer:void 0)||function(){return!1},Qj={};Qj["[object Float32Array]"]=Qj["[object Float64Array]"]=Qj["[object Int8Array]"]=Qj["[object Int16Array]"]=Qj["[object Int32Array]"]=Qj["[object Uint8Array]"]=Qj["[object Uint8ClampedArray]"]=Qj["[object Uint16Array]"]=Qj["[object Uint32Array]"]=!0,Qj["[object Arguments]"]=Qj["[object Array]"]=Qj["[object ArrayBuffer]"]=Qj["[object Boolean]"]=Qj["[object DataView]"]=Qj["[object Date]"]=Qj["[object Error]"]=Qj["[object Function]"]=Qj["[object Map]"]=Qj["[object Number]"]=Qj["[object Object]"]=Qj["[object RegExp]"]=Qj["[object Set]"]=Qj["[object String]"]=Qj["[object WeakMap]"]=!1;var Jj="object"==typeof exports&&exports&&!exports.nodeType&&exports,Zj=Jj&&"object"==typeof module&&module&&!module.nodeType&&module,$j=Zj&&Zj.exports===Jj&&KB.process,eG=function(){try{var e=Zj&&Zj.require&&Zj.require("util").types;return e||$j&&$j.binding&&$j.binding("util")}catch(t){}}(),tG=eG&&eG.isTypedArray,rG=tG?function(e){return function(t){return e(t)}}(tG):function(e){return rj(e)&&Lj(e.length)&&!!Qj[tj(e)]},nG=rG,iG=Object.prototype.hasOwnProperty;function aG(e,t){var r=nj(e),n=!r&&Kj(e),i=!r&&!n&&Yj(e),a=!r&&!n&&!i&&nG(e),o=r||n||i||a,s=o?function(e,t){for(var r=-1,n=Array(e);++r<e;)n[r]=t(r);return n}(e.length,String):[],c=s.length;for(var u in e)!t&&!iG.call(e,u)||o&&("length"==u||i&&("offset"==u||"parent"==u)||a&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||wj(u,c))||s.push(u);return s}var oG=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),sG=oG,cG=Object.prototype.hasOwnProperty;function uG(e){return Uj(e)?aG(e):function(e){if(!Fj(e))return sG(e);var t=[];for(var r in Object(e))cG.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var dG=Object.prototype.hasOwnProperty;function lG(e){if(!ij(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=Fj(e),r=[];for(var n in e)("constructor"!=n||!t&&dG.call(e,n))&&r.push(n);return r}var hG,pG=(hG=function(e,t){!function(e,t,r,n){var i=!r;r||(r={});for(var a=-1,o=t.length;++a<o;){var s=t[a],c=n?n(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),i?xj(r,s,c):Pj(r,s,c)}}(t,function(e){return Uj(e)?aG(e,!0):lG(e)}(t),e)},Mj((function(e,t){var r=-1,n=t.length,i=n>1?t[n-1]:void 0,a=n>2?t[2]:void 0;for(i=hG.length>3&&"function"==typeof i?(n--,i):void 0,a&&function(e,t,r){if(!ij(r))return!1;var n=typeof t;return!!("number"==n?Uj(r)&&wj(t,r.length):"string"==n&&t in r)&&Oj(r[t],e)}(t[0],t[1],a)&&(i=n<3?void 0:i,n=1),e=Object(e);++r<n;){var o=t[r];o&&hG(e,o,r,i)}return e})));function fG(e,t){return function(e,t){for(var r=-1,n=null==e?0:e.length,i=Array(n);++r<n;)i[r]=t(e[r],r,e);return i}(t,(function(t){return e[t]}))}function vG(e){return null==e?[]:fG(e,uG(e))}var _G=i,mG=lt("iterator"),yG=!_G((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,n){t.delete("b"),r+=n+e})),!e.toJSON||!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[mG]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("http://тест").host||"#%D0%B1"!==new URL("http://a#б").hash||"a1c3"!==r||"x"!==new URL("http://x",void 0).host})),gG=Qt,SG=b,EG=2147483647,bG=/[^\0-\u007E]/,kG=/[.\u3002\uFF0E\uFF61]/g,TG="Overflow: input needs wider integers to process",IG=RangeError,AG=SG(kG.exec),RG=Math.floor,CG=String.fromCharCode,wG=SG("".charCodeAt),xG=SG([].join),OG=SG([].push),DG=SG("".replace),PG=SG("".split),NG=SG("".toLowerCase),MG=function(e){return e+22+75*(e<26)},LG=function(e,t,r){var n=0;for(e=r?RG(e/700):e>>1,e+=RG(e/t);e>455;)e=RG(e/35),n+=36;return RG(n+36*e/(e+38))},UG=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=wG(e,r++);if(i>=55296&&i<=56319&&r<n){var a=wG(e,r++);56320==(64512&a)?OG(t,((1023&i)<<10)+(1023&a)+65536):(OG(t,i),r--)}else OG(t,i)}return t}(e);var r,n,i=e.length,a=128,o=0,s=72;for(r=0;r<e.length;r++)(n=e[r])<128&&OG(t,CG(n));var c=t.length,u=c;for(c&&OG(t,"-");u<i;){var d=EG;for(r=0;r<e.length;r++)(n=e[r])>=a&&n<d&&(d=n);var l=u+1;if(d-a>RG((EG-o)/l))throw IG(TG);for(o+=(d-a)*l,a=d,r=0;r<e.length;r++){if((n=e[r])<a&&++o>EG)throw IG(TG);if(n==a){for(var h=o,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var v=h-f,_=36-f;OG(t,CG(MG(f+v%_))),h=RG(v/_),p+=36}OG(t,CG(MG(h))),s=LG(o,l,u==c),o=0,u++}}o++,a++}return xG(t,"")},VG=Rr,FG=n,BG=O,jG=b,GG=C,HG=yG,zG=li,KG=Sg,XG=Mi,qG=Nc,WG=Zi,YG=Sh,QG=A,JG=Ye,ZG=Yt,$G=vn,eH=tr,tH=$,rH=yn,nH=Hn,iH=V,aH=bl,oH=vl,sH=Oh,cH=uA,uH=lt("iterator"),dH="URLSearchParams",lH="URLSearchParamsIterator",hH=WG.set,pH=WG.getterFor(dH),fH=WG.getterFor(lH),vH=Object.getOwnPropertyDescriptor,_H=function(e){if(!GG)return FG[e];var t=vH(FG,e);return t&&t.value},mH=_H("fetch"),yH=_H("Request"),gH=_H("Headers"),SH=yH&&yH.prototype,EH=gH&&gH.prototype,bH=FG.RegExp,kH=FG.TypeError,TH=FG.decodeURIComponent,IH=FG.encodeURIComponent,AH=jG("".charAt),RH=jG([].join),CH=jG([].push),wH=jG("".replace),xH=jG([].shift),OH=jG([].splice),DH=jG("".split),PH=jG("".slice),NH=/\+/g,MH=Array(4),LH=function(e){return MH[e-1]||(MH[e-1]=bH("((?:%[\\da-f]{2}){"+e+"})","gi"))},UH=function(e){try{return TH(e)}catch(PX){return e}},VH=function(e){var t=wH(e,NH," "),r=4;try{return TH(t)}catch(PX){for(;r;)t=wH(t,LH(r--),UH);return t}},FH=/[!'()~]|%20/g,BH={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},jH=function(e){return BH[e]},GH=function(e){return wH(IH(e),FH,jH)},HH=qG((function(e,t){hH(this,{type:lH,iterator:aH(pH(e).entries),kind:t})}),"Iterator",(function(){var e=fH(this),t=e.kind,r=e.iterator.next(),n=r.value;return r.done||(r.value="keys"===t?n.key:"values"===t?n.value:[n.key,n.value]),r}),!0),zH=function(e){this.entries=[],this.url=null,void 0!==e&&(tH(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===AH(e,0)?PH(e,1):e:rH(e)))};zH.prototype={type:dH,bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,a,o,s,c=oH(e);if(c)for(r=(t=aH(e,c)).next;!(n=BG(r,t)).done;){if(a=(i=aH(eH(n.value))).next,(o=BG(a,i)).done||(s=BG(a,i)).done||!BG(a,i).done)throw kH("Expected sequence with length 2");CH(this.entries,{key:rH(o.value),value:rH(s.value)})}else for(var u in e)JG(e,u)&&CH(this.entries,{key:u,value:rH(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=DH(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=DH(t,"="),CH(this.entries,{key:VH(xH(r)),value:VH(RH(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],CH(r,GH(e.key)+"="+GH(e.value));return RH(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var KH=function(){YG(this,XH);var e=arguments.length>0?arguments[0]:void 0;hH(this,new zH(e))},XH=KH.prototype;if(KG(XH,{append:function(e,t){sH(arguments.length,2);var r=pH(this);CH(r.entries,{key:rH(e),value:rH(t)}),r.updateURL()},delete:function(e){sH(arguments.length,1);for(var t=pH(this),r=t.entries,n=rH(e),i=0;i<r.length;)r[i].key===n?OH(r,i,1):i++;t.updateURL()},get:function(e){sH(arguments.length,1);for(var t=pH(this).entries,r=rH(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){sH(arguments.length,1);for(var t=pH(this).entries,r=rH(e),n=[],i=0;i<t.length;i++)t[i].key===r&&CH(n,t[i].value);return n},has:function(e){sH(arguments.length,1);for(var t=pH(this).entries,r=rH(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){sH(arguments.length,1);for(var r,n=pH(this),i=n.entries,a=!1,o=rH(e),s=rH(t),c=0;c<i.length;c++)(r=i[c]).key===o&&(a?OH(i,c--,1):(a=!0,r.value=s));a||CH(i,{key:o,value:s}),n.updateURL()},sort:function(){var e=pH(this);cH(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=pH(this).entries,n=ZG(e,arguments.length>1?arguments[1]:void 0),i=0;i<r.length;)n((t=r[i++]).value,t.key,this)},keys:function(){return new HH(this,"keys")},values:function(){return new HH(this,"values")},entries:function(){return new HH(this,"entries")}},{enumerable:!0}),zG(XH,uH,XH.entries,{name:"entries"}),zG(XH,"toString",(function(){return pH(this).serialize()}),{enumerable:!0}),XG(KH,dH),VG({global:!0,constructor:!0,forced:!HG},{URLSearchParams:KH}),!HG&&QG(gH)){var qH=jG(EH.has),WH=jG(EH.set),YH=function(e){if(tH(e)){var t,r=e.body;if($G(r)===dH)return t=e.headers?new gH(e.headers):new gH,qH(t,"content-type")||WH(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),nH(e,{body:iH(0,rH(r)),headers:iH(0,t)})}return e};if(QG(mH)&&VG({global:!0,enumerable:!0,dontCallGetSet:!0,forced:!0},{fetch:function(e){return mH(e,arguments.length>1?YH(arguments[1]):{})}}),QG(yH)){var QH=function(e){return YG(this,SH),new yH(e,arguments.length>1?YH(arguments[1]):{})};SH.constructor=QH,QH.prototype=SH,VG({global:!0,constructor:!0,dontCallGetSet:!0,forced:!0},{Request:QH})}}var JH,ZH=Rr,$H=C,ez=yG,tz=n,rz=Yt,nz=b,iz=li,az=function(e,t,r){return gG.f(e,t,r)},oz=Sh,sz=Ye,cz=YE,uz=Xk,dz=ni,lz=n_.codeAt,hz=function(e){var t,r,n=[],i=PG(DG(NG(e),kG,"."),".");for(t=0;t<i.length;t++)r=i[t],OG(n,AG(bG,r)?"xn--"+UG(r):r);return xG(n,".")},pz=yn,fz=Mi,vz=Oh,_z={URLSearchParams:KH,getState:pH},mz=Zi,yz=mz.set,gz=mz.getterFor("URL"),Sz=_z.URLSearchParams,Ez=_z.getState,bz=tz.URL,kz=tz.TypeError,Tz=tz.parseInt,Iz=Math.floor,Az=Math.pow,Rz=nz("".charAt),Cz=nz(/./.exec),wz=nz([].join),xz=nz(1..toString),Oz=nz([].pop),Dz=nz([].push),Pz=nz("".replace),Nz=nz([].shift),Mz=nz("".split),Lz=nz("".slice),Uz=nz("".toLowerCase),Vz=nz([].unshift),Fz="Invalid scheme",Bz="Invalid host",jz="Invalid port",Gz=/[a-z]/i,Hz=/[\d+-.a-z]/i,zz=/\d/,Kz=/^0x/i,Xz=/^[0-7]+$/,qz=/^\d+$/,Wz=/^[\da-f]+$/i,Yz=/[\0\t\n\r #%/:<>?@[\\\]^|]/,Qz=/[\0\t\n\r #/:<>?@[\\\]^|]/,Jz=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,Zz=/[\t\n\r]/g,$z=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)Vz(t,e%256),e=Iz(e/256);return wz(t,".")}if("object"==typeof e){for(t="",n=function(e){for(var t=null,r=1,n=null,i=0,a=0;a<8;a++)0!==e[a]?(i>r&&(t=n,r=i),n=null,i=0):(null===n&&(n=a),++i);return i>r&&(t=n,r=i),t}(e),r=0;r<8;r++)i&&0===e[r]||(i&&(i=!1),n===r?(t+=r?":":"::",i=!0):(t+=xz(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},eK={},tK=cz({},eK,{" ":1,'"':1,"<":1,">":1,"`":1}),rK=cz({},tK,{"#":1,"?":1,"{":1,"}":1}),nK=cz({},rK,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),iK=function(e,t){var r=lz(e,0);return r>32&&r<127&&!sz(t,e)?e:encodeURIComponent(e)},aK={ftp:21,file:null,http:80,https:443,ws:80,wss:443},oK=function(e,t){var r;return 2==e.length&&Cz(Gz,Rz(e,0))&&(":"==(r=Rz(e,1))||!t&&"|"==r)},sK=function(e){var t;return e.length>1&&oK(Lz(e,0,2))&&(2==e.length||"/"===(t=Rz(e,2))||"\\"===t||"?"===t||"#"===t)},cK=function(e){return"."===e||"%2e"===Uz(e)},uK={},dK={},lK={},hK={},pK={},fK={},vK={},_K={},mK={},yK={},gK={},SK={},EK={},bK={},kK={},TK={},IK={},AK={},RK={},CK={},wK={},xK=function(e,t,r){var n,i,a,o=pz(e);if(t){if(i=this.parse(o))throw kz(i);this.searchParams=null}else{if(void 0!==r&&(n=new xK(r,!0)),i=this.parse(o,null,n))throw kz(i);(a=Ez(new Sz)).bindURL(this),this.searchParams=a}};xK.prototype={type:"URL",parse:function(e,t,r){var n,i,a,o,s,c=this,u=t||uK,d=0,l="",h=!1,p=!1,f=!1;for(e=pz(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=Pz(e,Jz,"")),e=Pz(e,Zz,""),n=uz(e);d<=n.length;){switch(i=n[d],u){case uK:if(!i||!Cz(Gz,i)){if(t)return Fz;u=lK;continue}l+=Uz(i),u=dK;break;case dK:if(i&&(Cz(Hz,i)||"+"==i||"-"==i||"."==i))l+=Uz(i);else{if(":"!=i){if(t)return Fz;l="",u=lK,d=0;continue}if(t&&(c.isSpecial()!=sz(aK,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&aK[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=bK:c.isSpecial()&&r&&r.scheme==c.scheme?u=hK:c.isSpecial()?u=_K:"/"==n[d+1]?(u=pK,d++):(c.cannotBeABaseURL=!0,Dz(c.path,""),u=RK)}break;case lK:if(!r||r.cannotBeABaseURL&&"#"!=i)return Fz;if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=dz(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=wK;break}u="file"==r.scheme?bK:fK;continue;case hK:if("/"!=i||"/"!=n[d+1]){u=fK;continue}u=mK,d++;break;case pK:if("/"==i){u=yK;break}u=AK;continue;case fK:if(c.scheme=r.scheme,i==JH)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=dz(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=vK;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=dz(r.path),c.query="",u=CK;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=dz(r.path),c.path.length--,u=AK;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=dz(r.path),c.query=r.query,c.fragment="",u=wK}break;case vK:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=AK;continue}u=yK}else u=mK;break;case _K:if(u=mK,"/"!=i||"/"!=Rz(l,d+1))continue;d++;break;case mK:if("/"!=i&&"\\"!=i){u=yK;continue}break;case yK:if("@"==i){h&&(l="%40"+l),h=!0,a=uz(l);for(var v=0;v<a.length;v++){var _=a[v];if(":"!=_||f){var m=iK(_,nK);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(i==JH||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=uz(l).length+1,l="",u=gK}else l+=i;break;case gK:case SK:if(t&&"file"==c.scheme){u=TK;continue}if(":"!=i||p){if(i==JH||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return Bz;if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(o=c.parseHost(l))return o;if(l="",u=IK,t)return;continue}"["==i?p=!0:"]"==i&&(p=!1),l+=i}else{if(""==l)return Bz;if(o=c.parseHost(l))return o;if(l="",u=EK,t==SK)return}break;case EK:if(!Cz(zz,i)){if(i==JH||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var y=Tz(l,10);if(y>65535)return jz;c.port=c.isSpecial()&&y===aK[c.scheme]?null:y,l=""}if(t)return;u=IK;continue}return jz}l+=i;break;case bK:if(c.scheme="file","/"==i||"\\"==i)u=kK;else{if(!r||"file"!=r.scheme){u=AK;continue}if(i==JH)c.host=r.host,c.path=dz(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=dz(r.path),c.query="",u=CK;else{if("#"!=i){sK(wz(dz(n,d),""))||(c.host=r.host,c.path=dz(r.path),c.shortenPath()),u=AK;continue}c.host=r.host,c.path=dz(r.path),c.query=r.query,c.fragment="",u=wK}}break;case kK:if("/"==i||"\\"==i){u=TK;break}r&&"file"==r.scheme&&!sK(wz(dz(n,d),""))&&(oK(r.path[0],!0)?Dz(c.path,r.path[0]):c.host=r.host),u=AK;continue;case TK:if(i==JH||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&oK(l))u=AK;else if(""==l){if(c.host="",t)return;u=IK}else{if(o=c.parseHost(l))return o;if("localhost"==c.host&&(c.host=""),t)return;l="",u=IK}continue}l+=i;break;case IK:if(c.isSpecial()){if(u=AK,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=JH&&(u=AK,"/"!=i))continue}else c.fragment="",u=wK;else c.query="",u=CK;break;case AK:if(i==JH||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=Uz(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||Dz(c.path,"")):cK(l)?"/"==i||"\\"==i&&c.isSpecial()||Dz(c.path,""):("file"==c.scheme&&!c.path.length&&oK(l)&&(c.host&&(c.host=""),l=Rz(l,0)+":"),Dz(c.path,l)),l="","file"==c.scheme&&(i==JH||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)Nz(c.path);"?"==i?(c.query="",u=CK):"#"==i&&(c.fragment="",u=wK)}else l+=iK(i,rK);break;case RK:"?"==i?(c.query="",u=CK):"#"==i?(c.fragment="",u=wK):i!=JH&&(c.path[0]+=iK(i,eK));break;case CK:t||"#"!=i?i!=JH&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":iK(i,eK)):(c.fragment="",u=wK);break;case wK:i!=JH&&(c.fragment+=iK(i,tK))}d++}},parseHost:function(e){var t,r,n;if("["==Rz(e,0)){if("]"!=Rz(e,e.length-1))return Bz;if(t=function(e){var t,r,n,i,a,o,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return Rz(e,l)};if(":"==h()){if(":"!=Rz(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&Cz(Wz,h());)t=16*t+Tz(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(n=0;h();){if(i=null,n>0){if(!("."==h()&&n<4))return;l++}if(!Cz(zz,h()))return;for(;Cz(zz,h());){if(a=Tz(h(),10),null===i)i=a;else{if(0==i)return;i=10*i+a}if(i>255)return;l++}c[u]=256*c[u]+i,2!=++n&&4!=n||u++}if(4!=n)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(o=u-d,u=7;0!=u&&o>0;)s=c[u],c[u--]=c[d+o-1],c[d+--o]=s;else if(8!=u)return;return c}(Lz(e,1,-1)),!t)return Bz;this.host=t}else if(this.isSpecial()){if(e=hz(e),Cz(Yz,e))return Bz;if(t=function(e){var t,r,n,i,a,o,s,c=Mz(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],n=0;n<t;n++){if(""==(i=c[n]))return e;if(a=10,i.length>1&&"0"==Rz(i,0)&&(a=Cz(Kz,i)?16:8,i=Lz(i,8==a?1:2)),""===i)o=0;else{if(!Cz(10==a?qz:8==a?Xz:Wz,i))return e;o=Tz(i,a)}Dz(r,o)}for(n=0;n<t;n++)if(o=r[n],n==t-1){if(o>=Az(256,5-t))return null}else if(o>255)return null;for(s=Oz(r),n=0;n<r.length;n++)s+=r[n]*Az(256,3-n);return s}(e),null===t)return Bz;this.host=t}else{if(Cz(Qz,e))return Bz;for(t="",r=uz(e),n=0;n<r.length;n++)t+=iK(r[n],eK);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return sz(aK,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&oK(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,n=e.password,i=e.host,a=e.port,o=e.path,s=e.query,c=e.fragment,u=t+":";return null!==i?(u+="//",e.includesCredentials()&&(u+=r+(n?":"+n:"")+"@"),u+=$z(i),null!==a&&(u+=":"+a)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?o[0]:o.length?"/"+wz(o,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw kz(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new OK(e.path[0]).origin}catch(PX){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+$z(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(pz(e)+":",uK)},getUsername:function(){return this.username},setUsername:function(e){var t=uz(pz(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=iK(t[r],nK)}},getPassword:function(){return this.password},setPassword:function(e){var t=uz(pz(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=iK(t[r],nK)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?$z(e):$z(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,gK)},getHostname:function(){var e=this.host;return null===e?"":$z(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,SK)},getPort:function(){var e=this.port;return null===e?"":pz(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=pz(e))?this.port=null:this.parse(e,EK))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+wz(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,IK))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=pz(e))?this.query=null:("?"==Rz(e,0)&&(e=Lz(e,1)),this.query="",this.parse(e,CK)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=pz(e))?("#"==Rz(e,0)&&(e=Lz(e,1)),this.fragment="",this.parse(e,wK)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var OK=function(e){var t=oz(this,DK),r=vz(arguments.length,1)>1?arguments[1]:void 0,n=yz(t,new xK(e,!1,r));$H||(t.href=n.serialize(),t.origin=n.getOrigin(),t.protocol=n.getProtocol(),t.username=n.getUsername(),t.password=n.getPassword(),t.host=n.getHost(),t.hostname=n.getHostname(),t.port=n.getPort(),t.pathname=n.getPathname(),t.search=n.getSearch(),t.searchParams=n.getSearchParams(),t.hash=n.getHash())},DK=OK.prototype,PK=function(e,t){return{get:function(){return gz(this)[e]()},set:t&&function(e){return gz(this)[t](e)},configurable:!0,enumerable:!0}};if($H&&(az(DK,"href",PK("serialize","setHref")),az(DK,"origin",PK("getOrigin")),az(DK,"protocol",PK("getProtocol","setProtocol")),az(DK,"username",PK("getUsername","setUsername")),az(DK,"password",PK("getPassword","setPassword")),az(DK,"host",PK("getHost","setHost")),az(DK,"hostname",PK("getHostname","setHostname")),az(DK,"port",PK("getPort","setPort")),az(DK,"pathname",PK("getPathname","setPathname")),az(DK,"search",PK("getSearch","setSearch")),az(DK,"searchParams",PK("getSearchParams")),az(DK,"hash",PK("getHash","setHash"))),iz(DK,"toJSON",(function(){return gz(this).serialize()}),{enumerable:!0}),iz(DK,"toString",(function(){return gz(this).serialize()}),{enumerable:!0}),bz){var NK=bz.createObjectURL,MK=bz.revokeObjectURL;NK&&iz(OK,"createObjectURL",rz(NK,bz)),MK&&iz(OK,"revokeObjectURL",rz(MK,bz))}fz(OK,"URL"),ZH({global:!0,constructor:!0,forced:!ez,sham:!$H},{URL:OK});var LK=ee.URL,UK=function(){var e=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Audio(LK.createObjectURL(new Blob([t],r))),e.prev=1,n.muted=!0,e.next=5,n.play();case 5:return n.pause(),e.abrupt("return",!0);case 9:return e.prev=9,e.t0=e.catch(1),e.abrupt("return",!1);case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t,r){return e.apply(this,arguments)}}(),VK=od,FK=tc,BK=function(e,t,r,n){for(var i,a=n>1?void 0:n?FK(t,r):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n?i(t,r,a):i(a))||a);return n&&a&&VK(t,r,a),a},jK=function(){function e(t){Wd(this,e),sd(this,"_sharedAudioContext",new AudioContext),sd(this,"_audioDestination",this._sharedAudioContext.createMediaStreamDestination()),sd(this,"_localGainNode",this._sharedAudioContext.createGain()),sd(this,"_bufferGainNode",this._sharedAudioContext.createGain()),sd(this,"_audioBufferSource",void 0),sd(this,"_localSource",void 0),sd(this,"_context",void 0),sd(this,"_failedAudioList",[]),sd(this,"_startingIds",new bE),sd(this,"_revokeURLs",new TL),sd(this,"mixingMap",new bE),sd(this,"resourcesCache",new bE),sd(this,"volumeConfig",new bE),sd(this,"cachedBuffer",[]),sd(this,"id","AudioMixingManager"),this._context=t,this._localGainNode.gain.value=1}var t,r,n;return qd(e,[{key:"mixMediaStream",value:function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)}},{key:"startAudioMixing",value:(n=m_(Im.mark((function e(t,r,n){var i,a,o,s,c,u,d,l,h,p,f,v,_,m=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===this._startingIds.get(t)){e.next=3;break}return console.warn("AudioMixing task id: ".concat(t," is starting")),e.abrupt("return");case 3:if(this._startingIds.set(t,t),console.log(this._startingIds),i=n.playCount,vw(a=n.type,"mixingType",vG(Gd)),o=this._context.getLocalAudioTrack()){e.next=10;break}return e.abrupt("return");case 10:if((s=o.getTrack("preprocessing"))&&this.mixMediaStream(new MediaStream([s])),null!=(c=this.mixingMap.get(t))&&c.audioNode){c.audioNode.pause(),this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_STOPPED,error:hR.AUDIO_MIXING_ERROR_OK});try{c.gainNode.disconnect(this._audioDestination),c.audioSource.disconnect(c.gainNode)}catch(y){}}if(!(d=this.resourcesCache.get(t))||d.filePath!==r){e.next=19;break}u=d.getAudioNode(),e.next=32;break;case 19:return e.next=21,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw m._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:hR.AUDIO_MIXING_ERROR_START_FAILED}),new pR(lR.LOAD_RESOURCES_FAILED,e.statusText)}));case 21:return l=e.sent,hb(r).call(r,"mp3")?h={type:"audio/mpeg"}:hb(r).call(r,"aac")&&(h={type:"audio/aac"}),e.next=25,UK(l,h);case 25:if(e.sent){e.next=29;break}throw this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:hR.AUDIO_MIXING_ERROR_START_FAILED}),new pR(lR.LOAD_RESOURCES_FAILED,"invalid audio resource");case 29:(u=new Audio).crossOrigin="anonymous",u.src=LK.createObjectURL(new Blob([l],h));case 32:return i<=0?u.loop=!0:i>0&&(p=i,u.onended=function(){--p>0?u.play():(m.mixingMap.delete(t),m._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FINISHED,error:hR.AUDIO_MIXING_ERROR_OK}))}),e.prev=33,e.next=36,u.play();case 36:e.next=43;break;case 38:e.prev=38,e.t0=e.catch(33),console.error(e.t0),this._failedAudioList.push(u),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:gd.STREAM_INDEX_MAIN,mediaType:Sd.AUDIO});case 43:if(this._startingIds.delete(t),f=this._sharedAudioContext.createMediaElementSource(u),v=this._sharedAudioContext.createGain(),_=this.volumeConfig.get(t),v.gain.value=_?_/100:1,f.connect(v).connect(this._audioDestination),this.mixingMap.set(t,{audioSource:f,audioNode:u,gainNode:v,type:"file"}),a===Gd.PUBLISH)try{v.disconnect(this._sharedAudioContext.destination)}catch(y){}else v.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],n.type),this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_PLAYING,error:hR.AUDIO_MIXING_ERROR_OK});case 53:case"end":return e.stop()}}),e,this,[[33,38]])}))),function(e,t,r){return n.apply(this,arguments)})},{key:"stopAudioMixing",value: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:Hd.AUDIO_MIXING_STATE_STOPPED,error:hR.AUDIO_MIXING_ERROR_OK}))}},{key:"pauseAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Hd.AUDIO_MIXING_STATE_PAUSED,error:hR.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())}},{key:"resumeAudioMixing",value:function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:Hd.AUDIO_MIXING_STATE_PLAYING,error:hR.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())}},{key:"preloadAudioMixing",value:(r=m_(Im.mark((function e(t,r){var n,i,a=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.stopAudioMixing(t),e.next=3,fetch(r,{mode:"cors",credentials:"include"}).then((function(e){if(e.ok)return e.arrayBuffer();throw new pR(lR.LOAD_RESOURCES_FAILED,e.statusText)})).catch((function(e){if(a._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:hR.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),e instanceof pR)throw e;throw new pR(lR.LOAD_RESOURCES_FAILED,"Load resources failed",e)}));case 3:return n=e.sent,hb(r).call(r,"mp3")?i={type:"audio/mpeg"}:hb(r).call(r,"aac")&&(i={type:"audio/aac"}),e.next=7,UK(n,i);case 7:if(e.sent){e.next=11;break}throw this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_FAILED,error:hR.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new pR(lR.LOAD_RESOURCES_FAILED,"Load resources failed");case 11:return this._context.emitMessage({mixId:t,state:Hd.AUDIO_MIXING_STATE_PRELOADED,error:hR.AUDIO_MIXING_ERROR_OK}),this.resourcesCache.set(t,{getAudioNode:function(){var e=LK.createObjectURL(new Blob([n],i));return a._revokeURLs.add(e),new Audio(e)},filePath:r,duration:0}),e.next=15,new v_((function(e){var r=LK.createObjectURL(new Blob([n],i)),o=new Audio(r);o.addEventListener("durationchange",(function(){var n=a.resourcesCache.get(t);n&&(n.duration=o.duration,a.resourcesCache.set(t,n)),LK.revokeObjectURL(r),e(null)}))}));case 15:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"unloadAudioMixing",value:function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)}},{key:"getAudioMixingVolume",value:function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0}},{key:"setAudioMixingVolume",value:function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)}},{key:"getAudioMixingDuration",value:function(e){var t=this.mixingMap.get(e),r=this.resourcesCache.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.duration:0:0}},{key:"getAudioMixingCurrentPosition",value:function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0}},{key:"setAudioMixingPosition",value:function(e,t){var r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())}},{key:"enableAudioMixingBuffer",value:function(e){vw(e,"type",vG(Gd));var t=this._context.getLocalAudioTrack();if(t){var r=t.getTrack("preprocessing");if(r&&this.mixMediaStream(new MediaStream([r])),e===Gd.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(n){}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:Hd.AUDIO_MIXING_STATE_PCM_ENABLED,error:hR.AUDIO_MIXING_ERROR_OK})}}},{key:"disableAudioMixingBuffer",value: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:Hd.AUDIO_MIXING_STATE_PCM_DISABLED,error:hR.AUDIO_MIXING_ERROR_OK})}}},{key:"pushAudioMixingBuffer",value: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(r){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 r=t.cachedBuffer.shift();r&&t.pushAudioMixingBuffer(r)}}}}},{key:"stopAll",value:function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(t){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))}},{key:"mixTrack",get:function(){return this._audioDestination.stream.getAudioTracks()[0]}},{key:"sharedAudioContext",get:function(){return this._sharedAudioContext}},{key:"resumeLocalPlay",value:(t=m_(Im.mark((function e(){var t,r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=[],r=ZT(this._failedAudioList),e.prev=2,r.s();case 4:if((n=r.n()).done){e.next=24;break}if(i=n.value,e.prev=6,!(i instanceof HTMLAudioElement)){e.next=13;break}return i.muted=!1,e.next=11,i.play();case 11:e.next=14;break;case 13:i.start();case 14:e.next=22;break;case 16:return e.prev=16,e.t0=e.catch(6),t.push(i),console.error(e.t0),this._context.onAutoPlayFailed({userId:this.id,kind:"audio",streamIndex:gd.STREAM_INDEX_MAIN,mediaType:Sd.AUDIO}),e.abrupt("break",24);case 22:e.next=4;break;case 24:e.next=29;break;case 26:e.prev=26,e.t1=e.catch(2),r.e(e.t1);case 29:return e.prev=29,r.f(),e.finish(29);case 32:this._failedAudioList=t;case 33:case"end":return e.stop()}}),e,this,[[2,26,29,32],[6,16]])}))),function(){return t.apply(this,arguments)})},{key:"destroy",value: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(),this._startingIds=new bE,this._revokeURLs.forEach((function(e){LK.revokeObjectURL(e)}))}}]),e}();BK([VP("default","id","filePath","options")],jK.prototype,"startAudioMixing",1),BK([VP("default","id")],jK.prototype,"stopAudioMixing",1),BK([VP("default","id")],jK.prototype,"pauseAudioMixing",1),BK([VP("default","id")],jK.prototype,"resumeAudioMixing",1),BK([VP("default","id")],jK.prototype,"preloadAudioMixing",1),BK([VP("default","id")],jK.prototype,"unloadAudioMixing",1),BK([VP("default","id")],jK.prototype,"getAudioMixingVolume",1),BK([VP("default","id","volume")],jK.prototype,"setAudioMixingVolume",1),BK([VP("default","id")],jK.prototype,"getAudioMixingDuration",1),BK([VP("default","id")],jK.prototype,"getAudioMixingCurrentPosition",1),BK([VP("default","id","position")],jK.prototype,"setAudioMixingPosition",1),BK([VP("default","type")],jK.prototype,"enableAudioMixingBuffer",1),BK([VP()],jK.prototype,"disableAudioMixingBuffer",1),BK([VP("default","buffer")],jK.prototype,"pushAudioMixingBuffer",1);var GK=function(e){return e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser",e}(GK||{}),HK=new Jw("RTMClient",1),zK=function(e){DI(u,e);var t,r,n,i,a,o,s,c=YI(u);function u(e,t){var r;return Wd(this,u),sd(eI(r=c.call(this)),"_dataChannelSignal",null),sd(eI(r),"_handler",null),sd(eI(r),"_dataChannelSignalState",hB.DISCONNECTED),sd(eI(r),"_loginSessionId",null),sd(eI(r),"_userId",null),sd(eI(r),"_token",null),sd(eI(r),"_isReconnecting",!1),sd(eI(r),"_reconnectTimer",null),sd(eI(r),"_loginResolveCallback",null),sd(eI(r),"_loginRejectCallback",null),sd(eI(r),"_iceConfigNode",null),sd(eI(r),"_wait_login_token",!1),sd(eI(r),"_serverParamsCache",void 0),r.id=e,r._appId=t,r}return qd(u,[{key:"login",value:function(e,t){var r=this;return new v_((function(n,i){if(HK.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new pR(lR.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new pR(lR.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,DP.setStats({rtc_app_id:r._appId,rtm_user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(HK.print("login","init dataChannelSingling"),r._dataChannelSignalState=hB.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))}},{key:"logout",value:(s=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new pR(lR.NOT_LOGIN,"login first");case 2:return e.next=4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:VN.C2RTM}).catch((function(){}));case 4:this._closeDataChannelSignaling(),this._clearState();case 6:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"updateLoginToken",value:(o=m_(Im.mark((function e(t){var r=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._token=t,e.abrupt("return",new v_((function(e,t){r._wait_login_token?(r._loginResolveCallback=e,r._loginRejectCallback=t,r._login()):e()})));case 2:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(a=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new pR(lR.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.next=5,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:t},{functionType:VN.C2RTM});case 5:return r=e.sent,e.abrupt("return",null==r?void 0:r.status);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(i=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new pR(lR.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:t,room:"",msg:r}));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"setServerParams",value:(n=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,fw(t,"signature"),fw(r,"url"),this._loginSessionId&&this._userId){e.next=5;break}throw new pR(lR.NOT_LOGIN,"login first");case 5:return this._checkDataChannelSignal(),e.next=8,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:t,url:r},{functionType:VN.C2RTM}).catch((function(e){throw new pR(lR.UNEXPECTED_ERROR,e.msg)}));case 8:this._serverParamsCache={signature:t,url:r},this.emit("onServerParamsSetResult"),e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(0),this.emit("onServerParamsSetResult",e.t0),e.t0;case 16:case"end":return e.stop()}}),e,this,[[0,12]])}))),function(e,t){return n.apply(this,arguments)})},{key:"sendServerMessage",value:(r=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._loginSessionId&&this._userId){e.next=2;break}throw new pR(lR.NOT_LOGIN,"login first");case 2:return this._checkDataChannelSignal(),e.abrupt("return",this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:_N.BUSINESS_SERVER,msg:t}));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"destroy",value:function(){this._clearState(),this._closeDataChannelSignaling(),xI(CI(u.prototype),"removeAllListeners",this).call(this),delete this._serverParamsCache}},{key:"_login",value:function(){var e=this;if(this._userId){var t=AC();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:xC.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:eN.VERSION,deviceId:YP.getDeviceId(),appId:this._appId,userId:this._userId},accessParams:ny({requireICEUfragV2:!0})},{functionType:VN.C2RTM}).then((function(){"function"==typeof e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,AN(e.id,t),e._wait_login_token=!1,e._serverParamsCache&&e.setServerParams(e._serverParamsCache.signature,e._serverParamsCache.url)})).catch((function(t){var r,n,i=t||{},a=i.code,o=i.message;e._wait_login_token=!1,a>=700&&a<800?708===a?(r=lR.INVALID_PARAMS,n="Invalid userId"):(r=lR.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=lR.LOGIN_FAILED,n="login failed"),"function"==typeof e._loginRejectCallback&&e._loginRejectCallback(new pR(r,o||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}}},{key:"_createDataChannelSignaling",value:(t=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=new GN,i=this._iceConfigNode){e.next=16;break}return e.prev=3,e.next=6,null==n?void 0:n.getAccessNode(this._appId,"",t,YP.getDeviceId(),"");case 6:if(a=e.sent,i=a[0]){e.next=10;break}throw new Error;case 10:e.next=16;break;case 12:throw e.prev=12,e.t0=e.catch(3),BP("rtm.login.getNodeFailed","",0,!0),new pR(lR.ICE_SERVER_WRONG,"get ICE config failed");case 16:return BP("rtm.login.getNodeSuccess",i,0,!0),HK.print("_createDataChannelSignaling()","get node success",i),this._handler=ZF(wP,{id:this.id,avSync:!0,enableFallbackHandler:_X(this._appId),enableStandardHandler:mX(this._appId),pcKillSwitch:ud(ud({ctor_sdpsemantics_add:!0,ctor_encodedinsetablestream_add:!0,sld_rtcpfb_rrtr_add:!0,sld_ext_sdesmid_remove:!0,sld_fmtp_sps_add:!0,sld_fmtp_bitrate_add:!0,sld_fmtp_opus_add:!0,sld_iceoption_renomination:!0},rN("PC_KILLSWITCH")),vX(this._appId))}),null===(r=this._handler)||void 0===r||r.once("disconnect",(function(){HK.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),u._onDisconnect()})),e.prev=20,e.next=23,null===(s=this._handler)||void 0===s?void 0:s.connect(i);case 23:o=e.sent,HK.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=hB.CONNECTED,e.next=33;break;case 28:throw e.prev=28,e.t1=e.catch(20),this._iceConfigNode=null,this._dataChannelSignalState=hB.DISCONNECTED,new pR(lR.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",e.t1);case 33:return c=new FN(this.id,o),HK.print("_createDataChannelSignaling()","send ping"),c.sendPingSignaling(),c.once("close",(function(){HK.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),u._onDisconnect()})),c.on(dN.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(dN.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){u.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),c.on(dN.USER_DISCONNECTION,(function(){u.emit("onUserDisconnection"),u._clearState()})),c.on(dN.NODE_CHANGE,(function(e){BP("rtm.nodeChange",ny(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(u._iceConfigNode=e.nodes[0]),u._loginResolveCallback&&u._loginRejectCallback?u._login():u._reconnect()})),e.abrupt("return",c);case 42:case"end":return e.stop()}}),e,this,[[3,12],[20,28]])}))),function(e){return t.apply(this,arguments)})},{key:"_closeDataChannelSignaling",value: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}},{key:"_checkDataChannelSignal",value:function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==hB.CONNECTED)throw new pR(lR.NOT_CONNECTED_YET,"datachannel not connect")}},{key:"_onDisconnect",value:function(){this._dataChannelSignalState=hB.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)}},{key:"_reconnect",value:function(){var e=this;!this._isReconnecting&&this._userId&&(HK.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){HK.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){HK.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))}},{key:"_clearState",value:function(){this._userId=null,this._token=null,this._loginSessionId=null,AN(this.id,""),null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)}}]),u}(Pw.exports.EventEmitter),KK=function(e){DI(a,e);var t,r,n,i=YI(a);function a(e,t,r){var n,o=r.businessId;return Wd(this,a),sd(eI(n=i.call(this)),"_mediaServerClient",void 0),sd(eI(n),"_appId",void 0),sd(eI(n),"_reconnectTimer",void 0),sd(eI(n),"remoteStreams",void 0),sd(eI(n),"_businessId",void 0),n.id=e,n._appId=t,n.remoteStreams=new bE,n._businessId=o,n}return qd(a,[{key:"connect",value:(n=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this._mediaServerClient=new fB({id:this.id,avSync:!0,enableFallbackHandler:_X(this._appId),enableStandardHandler:mX(this._appId),pcKillSwitch:ud(ud({ctor_sdpsemantics_add:!0,ctor_encodedinsetablestream_add:!0,sld_rtcpfb_rrtr_add:!0,sld_ext_sdesmid_remove:!0,sld_fmtp_sps_add:!0,sld_fmtp_bitrate_add:!0,sld_fmtp_opus_add:!0,sld_iceoption_renomination:!0},rN("PC_KILLSWITCH")),vX(this._appId))}),this._businessId&&(this._mediaServerClient.businessId=this._businessId),this._bindEvents(),e.next=5,this._mediaServerClient.connect(this._appId);case 5:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"startPlayPublicStream",value:(r=m_(Im.mark((function e(t){var r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.remoteStreams.get(t)){e.next=2;break}throw new pR(lR.REPEAT_PLAY,"repeat play public media stream");case 2:return(r=new RF(t,t,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]})).on("onSEIMessage",(function(e){if(e instanceof Uint8Array)for(var t=tw(e),i=0;i<t.seiCount;i++)n.emit(rB.ON_SEI_MESSAGED_RECEIVED,{sei:t.seis[i],publicStreamId:r.streamId})})),e.next=6,this._mediaServerClient.subscribePublicStream(r);case 6:return this.remoteStreams.set(t,r),e.abrupt("return",r);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"stopPlayPublicStream",value:function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)}},{key:"destroy",value:function(){this.remoteStreams=new bE,this._mediaServerClient&&this._mediaServerClient.destroy()}},{key:"_handleReconnected",value:(t=m_(Im.mark((function e(){var t,r,n,i=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:clearTimeout(this._reconnectTimer),t=ZT(this.remoteStreams);try{for(n=function(){var e=$T(r.value,1)[0];i.remoteStreams.delete(e),i.startPlayPublicStream(e).then((function(){var t=i.remoteStreams.get(e);i.safeEmit(rB.RESUBSCRIBE,{stream:t})}))},t.s();!(r=t.n()).done;)n()}catch(a){t.e(a)}finally{t.f()}case 3:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})},{key:"_reconnect",value:function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=window.setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)}},{key:"_bindEvents",value:function(){var e,t,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(hN.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))}}]),a}(ex),XK=new Jw("AudioDeviceManager",1),qK=function(e){DI(c,e);var t,r,n,i,a,o,s=YI(c);function c(e){var t;return Wd(this,c),sd(eI(t=s.call(this)),"_audioLevelFetcher",void 0),sd(eI(t),"_playbackDeviceTestTimer",void 0),sd(eI(t),"_audioElement",void 0),sd(eI(t),"_audioTrack",void 0),sd(eI(t),"_mediaRecorder",void 0),sd(eI(t),"_recoderTimer",void 0),sd(eI(t),"_isAudioPlaybackDeviceTesting",!1),sd(eI(t),"_isAudioDeviceRecordTesting",!1),sd(eI(t),"_audioCaptureAndRecoderResolve",void 0),sd(eI(t),"_onAutoplayFailed",void 0),sd(eI(t),"_audioPlaybackDeviceId",void 0),t._extensionManager=e,t}return qd(c,[{key:"startAudioPlaybackDeviceTest",value:(o=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this._isAudioPlaybackDeviceTesting&&!this._isAudioDeviceRecordTesting){e.next=2;break}throw new pR(lR.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 2:return this._isAudioPlaybackDeviceTesting=!0,XK.print("startAudioPlaybackDeviceTest()","Invoke"),e.prev=4,e.next=7,this._playAudioFile(t,{loop:!0});case 7:e.next=14;break;case 9:throw e.prev=9,e.t0=e.catch(4),XK.print("startAudioPlaybackDeviceTest()","error",e.t0),this.stopAudioPlaybackDeviceTest(),e.t0;case 14:this._startEmitAudioPlaybackDeviceTestVolume(r);case 15:case"end":return e.stop()}}),e,this,[[4,9]])}))),function(e,t){return o.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){this._isAudioPlaybackDeviceTesting&&(XK.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())}},{key:"startAudioDeviceRecordTest",value:(a=m_(Im.mark((function e(t,r){var n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(window.MediaRecorder){e.next=2;break}throw new pR(lR.NOT_SUPPORTED,"Your browser does not support MediaRecorder.");case 2:if(!this._isAudioDeviceRecordTesting){e.next=4;break}throw new pR(lR.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");case 4:return this._isAudioDeviceRecordTesting=!0,XK.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){XK.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),n._stopAudioCaptureAndRecoder()}),3e4),e.prev=7,this._onAutoplayFailed=r,e.next=11,this._startAudioCaptureAndRecoder(t);case 11:e.next=18;break;case 13:throw e.prev=13,e.t0=e.catch(7),this._isAudioDeviceRecordTesting=!1,delete this._onAutoplayFailed,e.t0;case 18:delete this._audioCaptureAndRecoderResolve;case 19:case"end":return e.stop()}}),e,this,[[7,13]])}))),function(e,t){return a.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){XK.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()}},{key:"stopAudioDevicePlayTest",value:function(){this._isAudioDeviceRecordTesting&&(XK.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement()),delete this._onAutoplayFailed}},{key:"getRecordTrack",value:function(){return this._audioTrack}},{key:"setSinkId",value:(i=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(XK.print("setSinkId()","Invoke"),void 0!==HTMLAudioElement.prototype.setSinkId){e.next=3;break}throw new pR(lR.NOT_SUPPORTED,"setSinkId not supported by current browser");case 3:return e.next=5,gV.getDeviceById(t);case 5:if(r=e.sent){e.next=8;break}throw new pR(lR.INVALID_DEVICE_ID,"audio playback device id ".concat(t," is invalid"));case 8:return this._audioPlaybackDeviceId=t,this._setAudioCtxSinkId(),e.abrupt("return",r);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"getSinkId",value:function(){return this._audioPlaybackDeviceId}},{key:"destroy",value:function(){XK.print("destroy()","Invoke"),xI(CI(c.prototype),"removeAllListeners",this).call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()}},{key:"_playAudioFile",value:(n=m_(Im.mark((function e(t,r){var n,i=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return XK.print("_playAudioFile()",xm(n="Invoke url=".concat(t,"; loop=")).call(n,r.loop)),e.abrupt("return",new v_((function(e,n){var a=LB("audio",{attributes:{src:t,crossOrigin:"anonymous"}});i._audioElement=a,a.loop=r.loop,i._audioLevelFetcher=new EV(a),a.onplaying=function(){a.onplaying=null,XK.print("_playAudioFile()","onplaying"),e()},a.onerror=function(){var e=m_(Im.mark((function e(t){var r,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:XK.print("_playAudioFile()","onerror",t),i=t.message||(null==a||null===(r=a.error)||void 0===r?void 0:r.message),n(new pR(lR.LOAD_RESOURCES_FAILED,"Failed to play recorded audio"+(i?", reason: ".concat(i):".")));case 3:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),i._setAudioCtxSinkId().then((function(){var e,t;return null===(e=a.play())||void 0===e||null===(t=e.catch)||void 0===t?void 0:t.call(e,(function(e){var t;XK.print("_playAudioFile()","autoplay error",e);var r=xm(t="Failed to play recorded audio, ".concat(e.name,": ")).call(t,e.message);"NotAllowedError"===e.name&&i._onAutoplayFailed?i._onAutoplayFailed((function(){var e;return v_.all([null===(e=i._audioLevelFetcher)||void 0===e?void 0:e.resume(),a.play()])})):n(new pR(lR.LOAD_RESOURCES_FAILED,r))}))}))})));case 2:case"end":return e.stop()}}),e)}))),function(e,t){return n.apply(this,arguments)})},{key:"_destroyAudioElement",value:function(){this._audioElement&&(XK.print("_destroyAudioElement()","Invoke"),this._audioElement.onplaying=null,this._audioElement.onerror=null,this._audioElement.src="",delete this._audioElement,"function"==typeof this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())}},{key:"_startEmitAudioPlaybackDeviceTestVolume",value:function(e){var t=this;e=Math.max(e,100),this._audioElement&&(XK.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))}},{key:"_stopEmitAudioPlaybackDeviceTestVolume",value:function(){var e;void 0!==this._playbackDeviceTestTimer&&(XK.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher}},{key:"_startAudioCaptureAndRecoder",value:(r=m_(Im.mark((function e(t){var r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,YV({},this._extensionManager);case 2:return this._audioTrack=e.sent,i=this._audioTrack.getTrack("preprocessing"),r=RV.get(i),XK.print("startAudioDeviceRecordTest()","create microphone track success!"),e.abrupt("return",new v_((function(e,i){var a,o;"function"==typeof MediaRecorder.isTypeSupported&&(a=Nb(o=["audio/webm","audio/mp4"]).call(o,(function(e){return MediaRecorder.isTypeSupported(e)})),XK.print("startAudioDeviceRecordTest()","use mimeType: ".concat(a))),n._mediaRecorder=new MediaRecorder(r,a?{mimeType:a}:void 0);var s=n._mediaRecorder.mimeType;n._mediaRecorder.ondataavailable=function(){var r=m_(Im.mark((function r(a){var o,c;return Im.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!n._isAudioDeviceRecordTesting){r.next=16;break}return XK.print("startAudioDeviceRecordTest()","get recorded file(mimeType: ".concat(s,").")),c=new Blob([a.data],{type:s}),r.prev=3,r.next=6,n._playAudioFile(LK.createObjectURL(c),{loop:!1});case 6:r.next=11;break;case 8:return r.prev=8,r.t0=r.catch(3),r.abrupt("return",i(r.t0));case 11:n._startEmitAudioPlaybackDeviceTestVolume(t),null===(o=n._audioElement)||void 0===o||o.addEventListener("ended",(function(){n.stopAudioDevicePlayTest(),e()})),n._audioCaptureAndRecoderResolve=e,r.next=17;break;case 16:e();case 17:case"end":return r.stop()}}),r,null,[[3,8]])})));return function(e){return r.apply(this,arguments)}}(),n._mediaRecorder.onerror=function(e){i(new pR(lR.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},n._mediaRecorder.start()})));case 6:case"end":return e.stop()}var i}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_stopAudioCaptureAndRecoder",value: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}},{key:"_setAudioCtxSinkId",value:(t=m_(Im.mark((function e(){var t,r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this._audioPlaybackDeviceId){"default"===t&&(t="");try{null===(r=bV.getAudioContextInstance())||void 0===r||null===(n=r.setSinkId)||void 0===n||n.call(r,t),XK.print("setSinkId","ctx.sinkId=".concat(t))}catch(a){XK.print("setSinkId",xm(i="failed, ".concat(a.name," - ")).call(i,a.message))}}case 2:case"end":return e.stop()}}),e,this)}))),function(){return t.apply(this,arguments)})}]),c}(Pw.exports.EventEmitter),WK=function(){function e(t){Wd(this,e),sd(this,"_roomId",void 0),sd(this,"_constraints",{}),sd(this,"_profile",void 0),this._appId=t}return qd(e,[{key:"setRoomId",value:function(e){this._roomId=e}},{key:"setAudioProfile",value:function(e){this._profile=e}},{key:"getOpusConfigStr",value:function(){var e,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=YP.getEngineWebConfig(this._appId,this._roomId||""),n=r.audio_encode,i=this.getConstraints(),a=i.sampleRate,o=i.channelCount,s="number"==typeof a?a:null==a?void 0:a.exact,c="number"==typeof o?o:null==o?void 0:o.exact,u={};t.split(";").forEach((function(e){var t=$T(e.split("="),2),r=t[0],n=t[1];r&&n&&(u[r]=n)}));var d=(null==n?void 0:n.bitrate)||this._getConfigByAudioProfile().bitrate;d&&(u.maxaveragebitrate=d);var l=(null==n?void 0:n.enc_sample_rate)||s;l&&(u["sprop-maxcapturerate"]=l);var h=(null==n?void 0:n.playback_rate)||s;return h&&(u.maxplaybackrate=h),(c&&c>1||null!=n&&n.stereo)&&(u["sprop-stereo"]=1,u.stereo=1),null!=n&&n.dtx&&(u.usedtx=1),uy(e=on(u)).call(e,(function(e){var t;return xm(t="".concat(e,"=")).call(t,u[e])})).join(";")}},{key:"updateConstraints",value:function(e){this._constraints=ud(ud({},this._constraints),e)}},{key:"getConstraints",value:function(){var e=ud({},this._constraints),t=YP.getEngineWebConfig(this._appId,this._roomId||"").audio_capture;nw(null==t?void 0:t.sample_rate)||(e.sampleRate=t.sample_rate),nw(null==t?void 0:t.channel)||(e.channelCount=t.channel),nw(null==t?void 0:t.agc)||(e.autoGainControl=t.agc),nw(null==t?void 0:t.ans)||(e.noiseSuppression=t.ans),nw(null==t?void 0:t.aec)||(e.echoCancellation=t.aec);var r=this._getConfigByAudioProfile(),n=r.sampleRate,i=r.channel;return nw(e.sampleRate)&&!nw(n)&&(e.sampleRate=n),nw(e.channelCount)&&!nw(i)&&(e.channelCount=i),e}},{key:"_getConfigByAudioProfile",value:function(){var e={};switch(this._profile){case Pd.fluent:e.sampleRate=16e3,e.bitrate=24e3;break;case Pd.standard:e.sampleRate=48e3,e.bitrate=48e3;break;case Pd.hd:e.sampleRate=48e3,e.bitrate=128e3,e.channel=2;break;case Pd.standardStereo:e.sampleRate=48e3,e.bitrate=8e4,e.channel=2;break;case Pd.hdMono:e.sampleRate=48e3,e.bitrate=128e3}return e}}]),e}(),YK=new Jw("VideoSnapshot",1),QK=function(e){var t=null==e?void 0:e.domElement;if(t&&!t.paused&&4===t.readyState)return t},JK=function(){var e=m_(Im.mark((function e(t,r,n){var i,a,o,s,c,u,d,l;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=document.createElement("canvas"),a=i.getContext("2d")){e.next=4;break}throw new Error("canvas.getContext error");case 4:if(o=function(e,t,n){return t=t||e.width,n=n||e.height,i.width=t,i.height=n,r?a.setTransform(-1,0,0,1,t,0):a.setTransform(1,0,0,1,0,0),a.drawImage(e,0,0,t,n),a.getImageData(0,0,t,n)},s=Date.now(),!(c=QK(n))){e.next=16;break}return YK.print("takeSnapshot","VideoPlayer already set."),e.next=11,o(c,c.videoWidth,c.videoHeight);case 11:return u=e.sent,YK.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",u);case 16:if(!window.ImageCapture){e.next=29;break}if("live"!==(d=new window.ImageCapture(t)).track.readyState||!d.track.enabled||d.track.muted){e.next=29;break}return YK.print("takeSnapshot","use ImageCapture"),e.t0=o,e.next=23,d.grabFrame();case 23:return e.t1=e.sent,e.next=26,(0,e.t0)(e.t1);case 26:return l=e.sent,YK.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e.abrupt("return",l);case 29:return YK.print("takeSnapshot","use temp video"),e.abrupt("return",new v_((function(e,r){var n=new MediaStream([t]),i=document.createElement("video");i.setAttribute("playsinline",""),i.muted=!0,document.body.appendChild(i),i.onplaying=function(){var r=o(i,i.videoWidth,i.videoHeight);YK.print("takeSnapshot","success, cost ".concat(Date.now()-s,"ms")),e(r),n.removeTrack(t),i.srcObject=null,i.load()},i.onerror=r,i.srcObject=n,i.play()})));case 31:case"end":return e.stop()}}),e)})));return function(t,r,n){return e.apply(this,arguments)}}(),ZK=function(){return{url:"",video:{codec:Ld.H264,width:640,height:360,fps:15,gop:2,kBitRate:$K(640,360,15)},audio:{codec:"AAC",kBitRate:64,sampleRate:48e3,channels:2,AACProfile:Md.LC},layout:{regions:[],appData:"",backgroundColor:"#000000"}}};function $K(e,t,r){return e*t<=288e3?r<=15?800:1200:e*t<=864e3?r<=15?1200:1800:e*t<=1152e3?r<=15?1600:2400:e*t<=2592e3?r<=15?2500:3750:r<=15?3300:5e3}function eX(e){if("string"!=typeof e||!/^rtmps?:\/\//.test(e))throw new pR(lR.INVALID_PARAMS,"Invalid rtmp address")}function tX(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];if(null==e||!e.length)throw new pR(lR.INVALID_PARAMS,"regions should not be empty.");var t,r=ZT(e);try{for(r.s();!(t=r.n()).done;){var n=t.value;if("string"!=typeof n.userId)throw new pR(lR.INVALID_PARAMS,"region.userId(".concat(n.userId,") should be a string."));if("boolean"!=typeof n.isScreenStream)throw new pR(lR.INVALID_PARAMS,"region.isScreenStream(".concat(n.isScreenStream,") should be a boolean."))}}catch(i){r.e(i)}finally{r.f()}}function rX(e,t){var r,n,i,a=function(e,r){var n=LE(e).call(e,(function(e,t){return null==e?void 0:e[t]}),t),i=LE(e).call(e,(function(e,t){return null==e?void 0:e[t]}),ZK());return n&&r(n)?n:i},o=function(e){return e%2==0?e:e+1},s=o(a(["video","width"],(function(e){return e>=2&&e<=1920}))),c=o(a(["video","height"],(function(e){return e>=2&&e<=1920}))),u=a(["video","fps"],(function(e){return e>=1&&e<=60})),d=(null===(r=t.video)||void 0===r?void 0:r.kBitRate)||0,l=a(["audio","sampleRate"],(function(e){var t;return!!Nb(t=[32e3,44100,48e3]).call(t,(function(t){return t===e||t/1e3===e}))}));return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},control:{protocol:"2.0"},audio:{codec:a(["audio","codec"],(function(e){return"AAC"===e})),bitRate:1e3*a(["audio","kBitRate"],(function(e){return e>=32&&e<=192})),sampleRate:l<100?1e3*l:l,channels:a(["audio","channels"],(function(e){var t;return $m(t=[1,2]).call(t,e)})),profile:a(["audio","AACProfile"],(function(e){var t;return $m(t=[Md.LC,Md.HEv1,Md.HEv2]).call(t,e)}))},video:{codec:a(["video","codec"],(function(e){var t;return $m(t=["H264","H265"]).call(t,e)})),fps:u,gop:a(["video","gop"],(function(e){return e>=1&&e<=5}))*u,bitRate:1e3*(d>=16&&d<=1e4?d:$K(s,c,u)),width:s,height:c},layout:{canvas:{bgnd:a(["layout","backgroundColor"],(function(e){return/^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/.test(e)}))},regions:(null===(n=t.layout)||void 0===n||null===(i=n.regions)||void 0===i?void 0:uy(i).call(i,(function(e){var t,r;return{alpha:!e.alpha||+e.alpha>1||+e.alpha<=0?1:+e.alpha,uid:e.userId,zorder:!e.zorder||+e.zorder<0||+e.zorder>100?0:+e.zorder,x:!e.x||+e.x>=1||+e.x<0?0:+e.x,y:!e.y||+e.y>=1||+e.y<0?0:+e.y,w:!e.w||+e.w>1||+e.w<=0?1:+e.w,h:!e.h||+e.h>1||+e.h<=0?1:+e.h,renderMode:e.renderMode&&$m(t=[1,2,3]).call(t,e.renderMode)?e.renderMode:1,contentControl:e.contentControl&&$m(r=[0,1,2]).call(r,e.contentControl)?e.contentControl:0,screen:!!e.isScreenStream}})))||[],app_data:a(["layout","appData"],(function(e){return"string"==typeof e}))}}}}var nX,iX,aX={getDefaultValue:ZK,checkStartParams:function(e){var t;eX(e.url),tX(null===(t=e.layout)||void 0===t?void 0:t.regions)},checckUpdateParams:function(e){var t;e.url&&eX(e.url),tX(null===(t=e.layout)||void 0===t?void 0:t.regions)},getStartParams:function(e){return rX("started",e)},getUpdateParams:function(e){return rX("layoutChanged",e)}},oX=od,sX=tc,cX=function(e,t,r,n){for(var i,a=n>1?void 0:n?sX(t,r):t,o=e.length-1;o>=0;o--)(i=e[o])&&(a=(n?i(t,r,a):i(a))||a);return n&&a&&oX(t,r,a),a},uX=new Jw("Engine",0),dX=(iX=function(e){DI(_e,e);var t,r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O,D,P,N,M,L,U,V,F,B,j,G,H,z,K,X,q,W,Y,Q,J,Z,$,ee,te,re,ne,ie,ae,oe,se,ce,ue,de,le,he,pe,fe,ve=YI(_e);function _e(e,t){var r;Wd(this,_e),sd(eI(r=ve.call(this)),"id",(_e.GUID++).toString()),sd(eI(r),"_room",void 0),sd(eI(r),"_publicStreamManager",void 0),sd(eI(r),"_appId",void 0),sd(eI(r),"_businessId",void 0),sd(eI(r),"_visibility",!0),sd(eI(r),"_localVideoTrack",void 0),sd(eI(r),"_localAudioTrack",void 0),sd(eI(r),"_localImgVideoTrack",void 0),sd(eI(r),"_localImgScreenTrack",void 0),sd(eI(r),"_localScreenVideoTrack",void 0),sd(eI(r),"_localScreenAudioTrack",void 0),sd(eI(r),"_tempMixingAudioTrack",void 0),sd(eI(r),"_videoPlayer",void 0),sd(eI(r),"_screenPlayer",void 0),sd(eI(r),"_remoteVideoPlayer",new bE),sd(eI(r),"_remoteScreenPlayer",new bE),sd(eI(r),"_remoteAudioPlayer",new bE),sd(eI(r),"_remoteScreenAudioPlayer",new bE),sd(eI(r),"_publicStreamAudioPlayer",new bE),sd(eI(r),"_publicStreamVideoPlayer",new bE),sd(eI(r),"_publicStreamIds",new bE),sd(eI(r),"_roomConfig",void 0),sd(eI(r),"_videoStreamConstraints",iN),sd(eI(r),"_audioStreamConstraints",{}),sd(eI(r),"_enableSimulcast",!1),sd(eI(r),"_videoStreamEncodeConfig",[iN]),sd(eI(r),"_screenStreamEncodeConfig",[aN]),sd(eI(r),"_dummyMainImage",void 0),sd(eI(r),"_dummyScreenImage",void 0),sd(eI(r),"_trackSourceType",void 0),sd(eI(r),"_liveTranscodeConfig",void 0),sd(eI(r),"_useCloudProxy",void 0),sd(eI(r),"_startCloudProxyTimestamp",void 0),sd(eI(r),"_localVideoDeviceId",void 0),sd(eI(r),"_localAudioDeviceId",void 0),sd(eI(r),"_pauseAllSubscribeState",{audio:void 0,video:void 0,resumeStreamIds:{}}),sd(eI(r),"_audioVolumeIndicationTimer",void 0),sd(eI(r),"_dummyMainTimer",void 0),sd(eI(r),"_dummyScreenTimer",void 0),sd(eI(r),"_audioPropertiesReportTimer",null),sd(eI(r),"_mirrorType",kd.MIRROR_TYPE_RENDER),sd(eI(r),"_audioMixingManager",void 0),sd(eI(r),"_pubLock",void 0),sd(eI(r),"_rtmClient",void 0),sd(eI(r),"_messageStatisticsObserver",void 0),sd(eI(r),"_tempRoomInfo",void 0),sd(eI(r),"_originIceConfigRequestUrls",void 0),sd(eI(r),"_originConfigServerUrls",void 0),sd(eI(r),"_originLogServerUrl",void 0),sd(eI(r),"_extensionManager",new TV),sd(eI(r),"_audioDeviceManager",new qK(r._extensionManager)),sd(eI(r),"_audioProfileManager",void 0),sd(eI(r),"_requestManager",new HN),sd(eI(r),"_remoteVideoConfig",new bE),sd(eI(r),"_userPriorityMap",new bE),sd(eI(r),"_subscribeFallbackOption",void 0),sd(eI(r),"_cameraCapturing",!1),sd(eI(r),"_interruptCameraCapture",!1),sd(eI(r),"_micCapturing",!1),sd(eI(r),"_interruptMicCapture",!1),sd(eI(r),"_avSync",!0),sd(eI(r),"_config",void 0),sd(eI(r),"_needClosePreTrack",!1),sd(eI(r),"_updateMixAudioTrack",function(){var e=m_(Im.mark((function e(t){var n,i,a=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=a.length>1&&void 0!==a[1]?a[1]:Gd.PLAYOUT_AND_PUBLISH,uX.print("_updateMixAudioTrack()"),r._localAudioTrack){e.next=5;break}return t&&(r._tempMixingAudioTrack={track:t,type:i}),e.abrupt("return");case 5:if(t?(r._localAudioTrack.mixType=i,r._localAudioTrack.mixedAudioTrack=t):(delete r._localAudioTrack.mixType,delete r._localAudioTrack.mixedAudioTrack),null===(n=r._room)||void 0===n||!n.hasPublished){e.next=9;break}return e.next=9,r._updatePublish();case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),sd(eI(r),"_onAudioMixingMessage",(function(e){r.safeEmit(Kd.onAudioMixingStateChanged,e)})),sd(eI(r),"_onAudioMixingAutoplayFailed",(function(e){r.safeEmit(Kd.onAutoplayFailed,e)})),r._appId=e,r._pubLock=new tB("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new jK({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage,onAutoPlayFailed:r._onAudioMixingAutoplayFailed}),r._audioProfileManager=new WK(e),window.__rtc_engine__=eI(r),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=eI(r),r._trackSourceType={video:dd.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:dd.VIDEO_SOURCE_TYPE_INTERNAL,audio:ld.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:ld.AUDIO_SOURCE_TYPE_INTERNAL},r._config=t,r._rtmClient=new zK(r.id,e),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r._messageStatisticsObserver=new zB,r._extensionManager.setMinotor(CP),kN(r.id);var n=YP.getDeviceId();return r._requestManager.getConfig(e,n).then((function(e){r.emit("__onGetServerConfigFinishHook"),e.rts_report&&bN(e.rts_report)})),r}return qd(_e,[{key:"appId",get:function(){return this._appId},set:function(e){this._appId=e}},{key:"updateToken",value:(fe=m_(Im.mark((function e(t){var r,n,i,a,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("updateToken()","token: %s",t),fw(t,"token"),!this.waitForNewToken||!this._tempRoomInfo){e.next=8;break}return n=this._tempRoomInfo,i=n.config,a=n.userInfo,o=n.roomId,delete this._tempRoomInfo,e.next=7,this.joinRoom(t,o,a,i);case 7:return e.abrupt("return",e.sent);case 8:if(this._room){e.next=10;break}throw new pR(lR.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");case 10:return e.next=12,null===(r=this._room)||void 0===r?void 0:r.updateToken(t);case 12:case"end":return e.stop()}}),e,this)}))),function(e){return fe.apply(this,arguments)})},{key:"setVideoCaptureDevice",value:(pe=m_(Im.mark((function e(t){var r,n,i=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("setVideoCaptureDevice()","deviceId: %s",t),fw(t,"deviceId"),this._localVideoDeviceId=t,this._localVideoTrack){e.next=5;break}return e.abrupt("return");case 5:return r=pG({},this._videoStreamConstraints),"user"===t||"environment"===t||"left"===t||"right"===t?(delete r.deviceId,r.facingMode=t):r.deviceId={exact:t},this._needClosePreTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),delete this._localVideoTrack),uX.print("setVideoCaptureDevice()","start createCameraVideoTrack..."),e.next=11,qV(r,this._extensionManager).catch((function(e){if(i._localVideoTrack&&!i._localVideoTrack.dummy)return uX.print("setVideoCaptureDevice()","createCameraVideoTrack failed, stop pre VideoTrack."),i._removeLocalTrackEvents(i._localVideoTrack),i._localVideoTrack.close(),delete i._localVideoTrack,qV(r,i._extensionManager).then((function(e){return i._needClosePreTrack=!0,e})).catch(m_(Im.mark((function t(){var r;return Im.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return uX.print("setVideoCaptureDevice()","createCameraVideoTrack failed, rollback."),t.next=3,qV(i._videoStreamConstraints,i._extensionManager);case 3:throw r=t.sent,i._switchTrack(r),e;case 6:case"end":return t.stop()}}),t)}))));throw e}));case 11:return n=e.sent,uX.print("setVideoCaptureDevice()","createCameraVideoTrack success."),this._videoStreamConstraints=r,this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),e.next=17,this._switchTrack(n);case 17:case"end":return e.stop()}}),e,this)}))),function(e){return pe.apply(this,arguments)})},{key:"setAudioCaptureDevice",value:(he=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("setAudioCaptureDevice()","deviceId: %s",t),fw(t,"deviceId"),this._localAudioDeviceId=t,this._localAudioTrack){e.next=5;break}return e.abrupt("return");case 5:return this._audioProfileManager.updateConstraints({deviceId:{exact:t}}),this._localAudioTrack.close(),this._removeLocalTrackEvents(this._localAudioTrack),e.next=10,YV(this._audioProfileManager.getConstraints(),this._extensionManager);case 10:if(r=e.sent,this._initLocalTrackEvents(r),this._localAudioTrack=r,this._room){e.next=15;break}return e.abrupt("return");case 15:if(!this._room.hasPublished){e.next=18;break}return e.next=18,this._updatePublish();case 18:case"end":return e.stop()}}),e,this)}))),function(e){return he.apply(this,arguments)})},{key:"_addDeviceEventHandler",value:function(){gV.on(Kd.onVideoDeviceStateChanged,this._onVideoDeviceStateChange.bind(this)),gV.on(Kd.onAudioDeviceStateChanged,this._onAudioDeviceStateChange.bind(this))}},{key:"_addHandlerEventHandler",value:function(){var e,t,r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T,I,A,R,C,w,x,O=this;null===(e=this._room)||void 0===e||e.on(dN.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(dN.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(dN.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(rB.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(rB.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(a=this._room)||void 0===a||a.on(rB.ON_NETWORK_QUALITY,this._onNetworkQuality.bind(this)),null===(o=this._room)||void 0===o||o.on(dN.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(s=this._room)||void 0===s||s.on(dN.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(dN.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(u=this._room)||void 0===u||u.on(dN.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(d=this._room)||void 0===d||d.on(dN.POST_PROCESSING_MESSAGE,(function(e){"2.0"===e.protocol?O._onStreamMixingEvent({error:e.error,event:e.eventType,message:e.message}):"publicStreamCallback"===e.type?O._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&O._onLiveTranscodingResult(e)})),null===(l=this._room)||void 0===l||l.on(hN.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(h=this._room)||void 0===h||h.on(rB.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(p=this._room)||void 0===p||p.on(rB.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(rB.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(v=this._room)||void 0===v||v.on(rB.ON_PUBLISH_RESULT,(function(e){var t;null!==(t=O._room)&&void 0!==t&&t._roomConfig.isAutoPublish&&O.safeEmit(Kd.onAutoPublishResult,e)})),null===(_=this._room)||void 0===_||_.on(rB.ON_REMOTE_STREAM_STATS,(function(e){O.safeEmit(Kd.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(rB.ON_LOCAL_STREAM_STATS,(function(e){O.safeEmit(Kd.onLocalStreamStats,e)})),null===(y=this._room)||void 0===y||y.on(rB.ON_SUBTITLE_STATE_CHANGED,(function(e){O.safeEmit(Kd.onSubtitleStateChanged,e)})),null===(g=this._room)||void 0===g||g.on(rB.ON_SUBTITLE_MESSAGE_RECEIVED,(function(e){O.safeEmit(Kd.onSubtitleMessageReceived,e)})),null===(S=this._room)||void 0===S||S.on(rB.ON_USER_PUBLISH_STATE_CHANGE,this._onUserPublishStateChange.bind(this)),null===(E=this._room)||void 0===E||E.on(rB.ON_USER_START_AUDIO_CAPTURE,(function(e,t){var r=e.userId;O._updateAudioPlayerState(t),O.safeEmit(Kd.onUserStartAudioCapture,{userId:r})})),null===(b=this._room)||void 0===b||b.on(rB.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(Kd.onUserStopAudioCapture,{userId:t})})),null===(k=this._room)||void 0===k||k.on(rB.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(Kd.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(rB.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;O.safeEmit(Kd.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(rB.ON_SEI_MESSAGED_RECEIVED,(function(e){O.safeEmit(Kd.onSEIMessageReceived,e)})),null===(A=this._room)||void 0===A||A.on(rB.ON_REMOTE_VIDEO_SIZE_CHANGED,(function(e,t){O.safeEmit(Kd.onRemoteVideoSizeChanged,e,t)})),null===(R=this._room)||void 0===R||R.on(rB.ON_SIMULCAST_SUBSCRIBE_FALLBACK,(function(e){return O.safeEmit(Kd.onSimulcastSubscribeFallback,e)})),null===(C=this._room)||void 0===C||C.on(rB.RECONNECT_FAILED,(function(){O.safeEmit(Kd.onError,{errorCode:lR.RECONNECT_FAILED})})),null===(w=this._room)||void 0===w||w.on(rB.ON_VIDEO_STREAM_BANNED,(function(e){O.safeEmit(Kd.onVideoStreamBanned,{uid:e.uid,banned:e.banned})})),null===(x=this._room)||void 0===x||x.on(rB.ON_AUDIO_STREAM_BANNED,(function(e){O.safeEmit(Kd.onAudioStreamBanned,{uid:e.uid,banned:e.banned})}))}},{key:"safeEmit",value:function(e){for(var t,r,n=arguments.length,i=new Array(n>1?n-1:0),a=1;a<n;a++)i[a-1]=arguments[a];return ww(e)&&FP(e,WC(i)),(t=xI(CI(_e.prototype),"safeEmit",this)).call.apply(t,xm(r=[this,e]).call(r,i))}},{key:"_removeHandlerEventHandler",value:function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()}},{key:"setConnectionMode",value:function(e){vw(e,"mode",[Fd.AUTO,Fd.FORCE_TCP,Fd.FORCE_UDP]),tN("CONNECTION_MODE",e)}},{key:"joinRoom",value:(le=m_(Im.mark((function e(t,r,n,i){var a,o,s,c,u,d;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",t,r,n,i),Ew(t)||fw(t,"token"),bw(r),Iw(n),Aw(i=pG({isAutoPublish:!0,isAutoSubscribeAudio:!0,isAutoSubscribeVideo:!0,roomProfileType:Dd.communication},i)),CP.rtcSdkApiCall("host",0,location.host),!this._room||this._room.connectionState===hB.DISCONNECTED){e.next=11;break}throw new pR(lR.REPEAT_JOIN,"Already joined");case 11:return this._room=new NB(i,{id:this.id,audioProfileManager:this._audioProfileManager,streamRTT:{},subscribeFallbackOption:this._subscribeFallbackOption,userPriority:this._userPriorityMap,avSync:this._avSync,enableFallbackHandler:_X(this.appId),enableStandardHandler:mX(this.appId),pcKillSwitch:ud(ud({ctor_sdpsemantics_add:!0,ctor_encodedinsetablestream_add:!0,sld_rtcpfb_rrtr_add:!0,sld_ext_sdesmid_remove:!0,sld_fmtp_sps_add:!0,sld_fmtp_bitrate_add:!0,sld_fmtp_opus_add:!0,sld_iceoption_renomination:!0},rN("PC_KILLSWITCH")),vX(this._appId))}),this._addHandlerEventHandler(),a=this._liveTranscodeConfig&&aX.getStartParams(this._liveTranscodeConfig),o=ud(ud({},n),{},{businessId:this._businessId,role:this._visibility?GK.NORMAL_USER:GK.SILENT_USER}),e.prev=15,this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),CB(o),e.next=20,this._room.join(this._appId,r,t,o,a,this._useCloudProxy,null===(s=this._config)||void 0===s?void 0:s.expectedIDC);case 20:return u=e.sent,this._roomConfig=i,this._audioProfileManager.setRoomId(r),this._tempRoomInfo&&delete this._tempRoomInfo,null!==(c=i)&&void 0!==c&&c.isAutoPublish&&(this._visibility?this._updatePublish({invokeByJoinRoom:!0,mediaType:Sd.AUDIO_AND_VIDEO}):this.safeEmit(Kd.onAutoPublishResult,{isScreen:!1,state:_d.PUBLISH_FAIL})),IN(this.id,this._room.roomInfo),e.abrupt("return",u);case 29:throw e.prev=29,e.t0=e.catch(15),e.t0.code===lR.INVALID_TOKEN&&(this._tempRoomInfo={config:i,roomId:r,userInfo:o}),null===(d=this._room)||void 0===d||d.destroy(),e.t0;case 34:case"end":return e.stop()}}),e,this,[[15,29]])}))),function(e,t,r,n){return le.apply(this,arguments)})},{key:"leaveRoom",value:(de=m_(Im.mark((function e(){var t,r,n,i=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]&&i[0],uX.print("leaveRoom()"),!t){e.next=7;break}return e.next=5,null===(r=this._room)||void 0===r?void 0:r.leave(t);case 5:e.next=8;break;case 7:null===(n=this._room)||void 0===n||n.leave(t).catch();case 8:this._removeHandlerEventHandler(),this._audioProfileManager.setRoomId(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new bE,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new bE,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new bE,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new bE,this._roomConfig=void 0,this._publicStreamIds=new bE,IN(this.id);case 23:case"end":return e.stop()}}),e,this)}))),function(){return de.apply(this,arguments)})},{key:"destroy",value:function(){var e,t,r;uX.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._videoStreamEncodeConfig=[iN],this._screenStreamEncodeConfig=[aN],this._pauseAllSubscribeState={audio:void 0,video:void 0,resumeStreamIds:{}},this._messageStatisticsObserver.destroy(),TN(this.id),clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyMainTimer),clearInterval(this._dummyScreenTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._removeLocalTrackEvents(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 bE,this._remoteScreenAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenAudioPlayer=new bE,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new bE,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new bE,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new bE,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new bE,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(r=this._publicStreamManager)||void 0===r||r.destroy(),this._publicStreamIds=new bE,this._audioDeviceManager.destroy(),this._remoteVideoConfig=new bE,this._userPriorityMap.clear(),this._extensionManager.destroy(),this._cameraCapturing=!1,this._micCapturing=!1,this._interruptCameraCapture=!1,this._interruptMicCapture=!1,this._avSync=!0}},{key:"publishStream",value:(ue=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("publishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!$C(t)||this._localVideoTrack||!this._localImgVideoTrack){e.next=7;break}return e.next=6,HV(this._localImgVideoTrack,this._extensionManager);case 6:this._localVideoTrack=e.sent;case 7:return e.next=9,this._updatePublish({mediaType:t});case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ue.apply(this,arguments)})},{key:"unpublishStream",value:(ce=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("unpublishStream()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),!r){e.next=5;break}return e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.unpublish());case 5:return e.next=7,this._updatePublish({mediaType:t,pubState:iB.UNPUB});case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return ce.apply(this,arguments)})},{key:"publishScreen",value:(se=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("publishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.prev=3,!$C(t)||this._localScreenVideoTrack||!this._localImgScreenTrack){e.next=8;break}return e.next=7,KV(this._localImgScreenTrack,this._extensionManager);case 7:this._localScreenVideoTrack=e.sent;case 8:return e.next=10,this._updateScreenPublish({mediaType:t,pubState:iB.PUB});case 10:e.next=19;break;case 12:if(e.prev=12,e.t0=e.catch(3),!(e.t0 instanceof pR)){e.next=18;break}throw e.t0;case 18:throw new pR(lR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 19:case"end":return e.stop()}}),e,this,[[3,12]])}))),function(e){return se.apply(this,arguments)})},{key:"unpublishScreen",value:(oe=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("unpublishScreen()","mediaType: %o",t),this._checkMediaType(t),this._assertNotInRoom(),e.next=5,this._updateScreenPublish({mediaType:t,pubState:iB.UNPUB});case 5:case"end":return e.stop()}}),e,this)}))),function(e){return oe.apply(this,arguments)})},{key:"subscribeStream",value:(ae=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("subscribeStream()","userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!1,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return ae.apply(this,arguments)})},{key:"_subscribe",value:(ie=m_(Im.mark((function e(t,r,n){var i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._checkMediaType(n),this._assertNotInRoom(),n!==Sd.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){e.next=5;break}return uX.print("subscribeStream()","due to multiChatMode return"),e.abrupt("return");case 5:if(u=this._room.remoteStreams.get(r),d=null==u?void 0:Nb(u).call(u,(function(e){return e.isScreen===t}))){e.next=9;break}throw new pR(lR.STREAM_NOT_EXIST,"stream not exist");case 9:return l=this._pauseAllSubscribeState.audio,h=this._pauseAllSubscribeState.video,this._pauseAllSubscribeState.audio&&(n-=n&Sd.AUDIO),this._pauseAllSubscribeState.video&&(n-=n&Sd.VIDEO),uX.print("subscribeStream()","due to pauseAll mediaType: %o",n),p=d.hasSubscribed,f=this._remoteVideoConfig.get(r)||(null===(a=this._roomConfig)||void 0===a?void 0:a.remoteVideoConfig),d.originalMediaType=n,e.next=19,this._room.subscribe(d,n,f);case 19:ZC(n)&&this._updateAudioPlayerState(d),$C(n)&&this._updateVideoPlayerState(d),v=0,_=0,l!==this._pauseAllSubscribeState.audio&&(this._pauseAllSubscribeState.audio?v|=Sd.AUDIO:_|=Sd.AUDIO),h!==this._pauseAllSubscribeState.video&&(this._pauseAllSubscribeState.video?v|=Sd.VIDEO:_|=Sd.VIDEO),v&&this.pauseAllSubscribedStream(v),_&&this.resumeAllSubscribedStream(_),this._pauseAllSubscribeState.resumeStreamIds[d.streamId]=d.streamId,!t&&(null!==(o=this._roomConfig)&&void 0!==o&&o.isAutoSubscribeAudio||null!==(s=this._roomConfig)&&void 0!==s&&s.isAutoSubscribeVideo)&&(d.audioTrack||d.videoTrack)&&(m={userId:r,isScreen:!1,state:vd.SUBSCRIBE_SUCC},this.safeEmit(Kd.onAutoSubscribeResult,m)),null!==(c=this._room)&&void 0!==c&&c.multiChatMode||p||!ZC(n)||!d.hasAudio||null===(y=d.observer)||void 0===y||y.setSubscribeAudio(!0),!p&&$C(n)&&d.hasVideo&&(null===(g=d.observer)||void 0===g||g.setSubscribeVideo(!0));case 31:case"end":return e.stop()}}),e,this)}))),function(e,t,r){return ie.apply(this,arguments)})},{key:"unsubscribeStream",value:(ne=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:uX.print("unsubscribeStream()","userId: %o, mediaType: %o",t,r),this._unsubscribe(!1,t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return ne.apply(this,arguments)})},{key:"subscribeScreen",value:(re=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("subscribeScreen() userId: %o, mediaType: %o",t,r),e.abrupt("return",this._subscribe(!0,t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return re.apply(this,arguments)})},{key:"unsubscribeScreen",value:(te=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:uX.print("unsubscribeScreen() userId: %o, mediaType: %o",t,r),this._unsubscribe(!0,t,r);case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return te.apply(this,arguments)})},{key:"_unsubscribe",value:function(e,t,r,n){var i,a=this;if(this._checkMediaType(r),this._assertNotInRoom(),r!==Sd.AUDIO||null===(i=this._room)||void 0===i||!i.multiChatMode){var o=this._room.remoteStreams.get(t),s=null==o?void 0:Nb(o).call(o,(function(t){return t.isScreen===e}));if(null==s||!s.hasSubscribed)throw new pR(lR.STREAM_NOT_EXIST,"stream not exist");return this._room.unsubscribe(s,r).then((function(){n||delete a._pauseAllSubscribeState.resumeStreamIds[s.streamId]}))}uX.print("subscribeStream()","due to multiChatMode return")}},{key:"setRemoteVideoConfig",value:(ee=m_(Im.mark((function e(t,r){var n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("setRemoteVideoConfig() userId: %o, remoteVideoConfig: %o",t,r),kw(t),xw(r),this._remoteVideoConfig.set(t,r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.updateSubVideoConfig(t,r).then((function(){})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return ee.apply(this,arguments)})},{key:"startVideoCapture",value:($=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("startVideoCapture()","deviceId: %s",t),Ew(t)||fw(t,"deviceId"),t=t||this._localVideoDeviceId,this._localVideoDeviceId=t,this._trackSourceType.video!==dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 6:if(!(this._cameraCapturing||this._localVideoTrack&&!this._localVideoTrack.dummy)){e.next=8;break}throw new pR(lR.REPEAT_CAPTURE,"Has already capture");case 8:return i=this._videoStreamConstraints,t&&("user"===t||"environment"===t||"left"===t||"right"===t?i.facingMode=t:i.deviceId={exact:t},this._videoStreamConstraints=i),a={},e.prev=11,this._cameraCapturing=!0,e.next=15,qV(i,this._extensionManager);case 15:if(s=e.sent,!this._interruptCameraCapture){e.next=21;break}throw this._interruptCameraCapture=!1,this._removeLocalTrackEvents(s),s.close(),new pR(lR.INTERRUPT,"interrupt by stopVideoCapture");case 21:if(this._initLocalTrackEvents(s),this._localVideoTrack=s,null===(o=this._videoPlayer)||void 0===o||o.playVideo(s),(c=null==s?void 0:s.getTrack())&&(a=c.getSettings(),u={width:a.width,height:a.height},this._localVideoTrack.resolution=u,setTimeout((function(){return l.safeEmit(Kd.onLocalVideoSizeChanged,{streamIndex:gd.STREAM_INDEX_MAIN,info:u})}))),this._room){e.next=28;break}return e.abrupt("return",a);case 28:return e.prev=28,this._cameraCapturing=!1,e.finish(28);case 31:return d=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||d)&&(this._visibility?this._updatePublish():this.safeEmit(Kd.onAutoPublishResult,{isScreen:!1,state:_d.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableVideo(!0),e.abrupt("return",a);case 35:case"end":return e.stop()}}),e,this,[[11,,28,31]])}))),function(e){return $.apply(this,arguments)})},{key:"stopVideoCapture",value:(Z=m_(Im.mark((function e(){var t,r,n,i,a,o;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("stopVideoCapture()"),!this._cameraCapturing){e.next=5;break}return this._interruptCameraCapture=!0,uX.print("stopVideoCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.video!==dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 7:if(null===(t=this._videoPlayer)||void 0===t||t.stop(),this._localVideoTrack&&(this._localVideoTrack.dummy||(this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close(),this._localImgVideoTrack?(null===(o=this._localVideoTrack)||void 0===o||o.setTrack(this._localImgVideoTrack,this._extensionManager),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0)),this._room){e.next=11;break}return e.abrupt("return");case 11:if(null===(r=this._room)||void 0===r||!r.hasPublished){e.next=14;break}return e.next=14,this._updatePublish();case 14:null===(n=this._room)||void 0===n||null===(i=n.localStream)||void 0===i||null===(a=i.observer)||void 0===a||a.setEnableVideo(!1);case 15:case"end":return e.stop()}}),e,this)}))),function(){return Z.apply(this,arguments)})},{key:"startAudioCapture",value:(J=m_(Im.mark((function e(t){var r,n,i,a,o,s;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("startAudioCapture()","deviceId: $o",t),Ew(t)||fw(t,"deviceId"),t=t||this._localAudioDeviceId,this._localAudioDeviceId=t,this._trackSourceType.audio!==ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 6:if(!this._micCapturing&&!this._localAudioTrack){e.next=8;break}throw new pR(lR.REPEAT_CAPTURE,"Has already capture");case 8:return t&&this._audioProfileManager.updateConstraints({deviceId:{exact:t}}),i={},e.prev=10,this._micCapturing=!0,e.next=14,YV(this._audioProfileManager.getConstraints(),this._extensionManager);case 14:if(a=e.sent,!this._interruptMicCapture){e.next=20;break}throw this._interruptMicCapture=!1,this._removeLocalTrackEvents(a),a.close(),new pR(lR.INTERRUPT,"interrupt by stopAudioCapture");case 20:if(this._initLocalTrackEvents(a),this._localAudioTrack=a,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),(o=null==a?void 0:a.getTrack())&&(i=o.getSettings()),this._room){e.next=27;break}return e.abrupt("return",i);case 27:return e.prev=27,this._micCapturing=!1,e.finish(27);case 30:return s=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||s)&&(this._visibility?this._updatePublish():this.safeEmit(Kd.onAutoPublishResult,{isScreen:!1,state:_d.PUBLISH_FAIL})),null===(r=this._room.localStream)||void 0===r||null===(n=r.observer)||void 0===n||n.setEnableAudio(!0),e.abrupt("return",i);case 34:case"end":return e.stop()}}),e,this,[[10,,27,30]])}))),function(e){return J.apply(this,arguments)})},{key:"stopAudioCapture",value:(Q=m_(Im.mark((function e(){var t,r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("stopAudioCapture()"),!this._micCapturing){e.next=5;break}return this._interruptMicCapture=!0,uX.print("stopAudioCapture()","capturing"),e.abrupt("return");case 5:if(this._trackSourceType.audio!==ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:if(this._localAudioTrack&&(this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._room){e.next=12;break}return e.abrupt("return");case 12:if(!this._room.hasPublished){e.next=15;break}return e.next=15,this._updatePublish();case 15:null===(t=this._room.localStream)||void 0===t||null===(r=t.observer)||void 0===r||r.setEnableAudio(!1);case 16:case"end":return e.stop()}}),e,this)}))),function(){return Q.apply(this,arguments)})},{key:"getAudioMixingManager",value:function(){return uX.print("getAudioMixingManager()"),this._audioMixingManager}},{key:"startScreenCapture",value:(Y=m_(Im.mark((function e(){var t,r,n,i,a,o,s,c,u,d,l,h,p,f=this,v=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(a=v.length>0&&void 0!==v[0]?v[0]:{},uX.print("startScreenCapture()","config: %o",a),o=a.enableAudio,s=void 0!==o&&o,this._trackSourceType.screenVideo!==dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=5;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");case 5:if(this._trackSourceType.screenAudio!==ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=7;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");case 7:return e.next=9,JV(s,this._extensionManager,this._screenStreamEncodeConfig[0]);case 9:if(c=e.sent,u=$T(c,2),d=u[0],l=u[1],this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(t=this._localScreenAudioTrack)||void 0===t||t.close(),delete this._localScreenAudioTrack,this._localScreenVideoTrack=d,null!==(r=this._screenStreamEncodeConfig[0])&&void 0!==r&&r.contentHint&&d.setContentHint(null===(h=this._screenStreamEncodeConfig[0])||void 0===h?void 0:h.contentHint),(p=null==d?void 0:d.getTrack())&&setTimeout((function(){var e=p.getSettings(),t={width:e.width,height:e.height};d.resolution=t,f.safeEmit(Kd.onLocalVideoSizeChanged,{streamIndex:gd.STREAM_INDEX_SCREEN,info:{width:e.width,height:e.height}})}),500),l&&(this._localScreenAudioTrack=l,this._initLocalTrackEvents(l)),null===(n=this._screenPlayer)||void 0===n||n.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(i=this._room)||void 0===i||!i.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(){return Y.apply(this,arguments)})},{key:"stopScreenCapture",value:(W=m_(Im.mark((function e(){var t,r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("stopScreenCapture()"),null===(t=this._screenPlayer)||void 0===t||t.stop(),this._localScreenVideoTrack&&(this._localScreenVideoTrack.dummy||(this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close(),this._localImgScreenTrack&&(null===(n=this._localScreenVideoTrack)||void 0===n||n.setTrack(this._localImgScreenTrack,this._extensionManager),this._localScreenVideoTrack.dummy=!0))),this._localScreenAudioTrack&&(this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,null===(r=this._room)||void 0===r||!r.hasScreenPublished){e.next=8;break}return e.next=8,this._updateScreenPublish();case 8:case"end":return e.stop()}}),e,this)}))),function(){return W.apply(this,arguments)})},{key:"setLocalVideoPlayer",value:function(e,t){if(uX.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),vw(e,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),t&&t.renderDom){var r,n,i=ud(ud({userId:this._getUserId()},t),{},{isLocal:!0});if(Rw(i),e===gd.STREAM_INDEX_MAIN&&!this._videoPlayer)return this._videoPlayer=new jB(i),this._initPlayerEvents(this._videoPlayer,!1,e),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&(null===(r=this._config)||void 0===r?void 0:r.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement;if(e===gd.STREAM_INDEX_SCREEN&&!this._screenPlayer)return this._screenPlayer=new jB(ud(ud({},i),{},{isScreen:!0,isLocal:!0})),this._initPlayerEvents(this._screenPlayer,!1,e),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement}else{var a,o;e===gd.STREAM_INDEX_MAIN?(null===(a=this._videoPlayer)||void 0===a||a.destroy(!0),delete this._videoPlayer):(null===(o=this._screenPlayer)||void 0===o||o.destroy(),delete this._screenPlayer)}}},{key:"startLiveTranscoding",value:(q=m_(Im.mark((function e(t){var r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("startLiveTranscoding()","transcode: %o",t),aX.checkStartParams(t),this._liveTranscodeConfig=t,!((n=null===(r=this._room)||void 0===r?void 0:r.roomInfo)&&n.roomId.length+n.userInfo.userId.length>126)){e.next=6;break}throw new pR(lR.INVALID_PARAMS,"The roomId+userId must be within 126 bytes");case 6:if(e.prev=6,this.safeEmit(Kd.onStreamMixingEvent,{event:nB.START,error:0,message:""}),!this._room||this._room.connectionState!==hB.CONNECTED){e.next=11;break}return e.next=11,null===(i=this._room)||void 0===i?void 0:i.liveControlMessage(aX.getStartParams(this._liveTranscodeConfig));case 11:e.next=20;break;case 13:if(e.prev=13,e.t0=e.catch(6),!(e.t0 instanceof pR)){e.next=19;break}throw e.t0;case 19:throw new pR(lR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 20:case"end":return e.stop()}}),e,this,[[6,13]])}))),function(e){return q.apply(this,arguments)})},{key:"updateLiveTranscoding",value:(X=m_(Im.mark((function e(t){var r,n,i,a;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("updateLiveTranscoding()","transcode: %o",t),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete(i=pG({},t)).audio,null===(r=i.video)||void 0===r||delete r.codec,null===(n=i.video)||void 0===n||delete n.gop,aX.checckUpdateParams(i),this._liveTranscodeConfig=pG(this._liveTranscodeConfig,i),e.prev=9,this.safeEmit(Kd.onStreamMixingEvent,{event:nB.UPDATE,error:0,message:""}),e.next=13,null===(a=this._room)||void 0===a?void 0:a.liveControlMessage(aX.getUpdateParams(this._liveTranscodeConfig));case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(9),!(e.t0 instanceof pR)){e.next=21;break}throw e.t0;case 21:throw new pR(lR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:case"end":return e.stop()}}),e,this,[[9,15]])}))),function(e){return X.apply(this,arguments)})},{key:"stopLiveTranscoding",value:(K=m_(Im.mark((function e(){var t;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("stopLiveTranscoding()"),this._liveTranscodeConfig){e.next=3;break}return e.abrupt("return");case 3:return delete this._liveTranscodeConfig,e.prev=4,this.safeEmit(Kd.onStreamMixingEvent,{event:nB.STOP,error:0,message:""}),e.next=8,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage({action:"stopped",type:"transcode"});case 8:e.next=17;break;case 10:if(e.prev=10,e.t0=e.catch(4),!(e.t0 instanceof pR)){e.next=16;break}throw e.t0;case 16:throw new pR(lR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 17:case"end":return e.stop()}}),e,this,[[4,10]])}))),function(){return K.apply(this,arguments)})},{key:"startSubtitle",value:(z=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("startSubtitle()","config: %o",t),this._assertNotInRoom(),e.next=4,null===(r=this._room)||void 0===r?void 0:r.startSubtitle(t);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return z.apply(this,arguments)})},{key:"stopSubtitle",value:function(){var e;uX.print("stopSubtitle()","invoke"),null===(e=this._room)||void 0===e||e.stopSubtitle()}},{key:"setBusinessId",value:function(e){return uX.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(OP.setStats({rtc_business_id:e}),this._businessId=e,!0)}},{key:"setUserVisibility",value:(H=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("setUserVisibility()","enable: %o",t),t=!!t,this._visibility!==t){e.next=4;break}return e.abrupt("return");case 4:if(this._room){e.next=7;break}return this._visibility=t,e.abrupt("return");case 7:if(this._assertNotInRoom(),this._room.localStream&&(null===(n=this._room.localStream.observer)||void 0===n||n.setPublisher(t)),e.t0=!t,!e.t0){e.next=13;break}return e.next=13,this._room.unpublish();case 13:return e.next=15,this._room.updateUserAttributes({role:t?GK.NORMAL_USER:GK.SILENT_USER});case 15:this._visibility=t,t&&null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoPublish&&this._updatePublish({mediaType:Sd.AUDIO_AND_VIDEO});case 17:case"end":return e.stop()}}),e,this)}))),function(e){return H.apply(this,arguments)})},{key:"_initPlayerEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:gd.STREAM_INDEX_MAIN,i=n===gd.STREAM_INDEX_SCREEN;e.on("playback_event",(function(n){switch(n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type){var a=e.userId.replace("_screen","");r?t.safeEmit(Kd.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:a}):(t.safeEmit(Kd.onAudioFirstFrameDecoded,{userId:a,isScreen:i}),t.safeEmit(Kd.onRemoteAudioFirstFrame,{userId:a,isScreen:i})),CP.firstRemoteAudioRender("",a||"",{isScreen:i})}else{var o,s,c={userId:e.userId,height:(null===(o=e.domElement)||void 0===o?void 0:o.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0,isScreen:i};r?(c.publicStreamId=c.userId,delete c.userId,delete c.isScreen,t.safeEmit(Kd.onFirstPublicStreamVideoFrameRendered,c),t.safeEmit(Kd.onFirstPublicStreamVideoFrameDecoded,c)):e.isLocal||(t.safeEmit(Kd.onVideoFirstFrameRendered,c),t.safeEmit(Kd.onVideoFirstFrameDecoded,c),t.safeEmit(Kd.onRemoteVideoFirstFrame,c)),CP.firstRemoteVideoRender("",n.userId||"",{isScreen:i})}break;case"autoplay-error":return r&&(n.publicStreamId=n.userId),CP.rtcInvokeStatus(e instanceof jB?"video":"audio",0,"autoplay-error",n.userId||"",0),void t.safeEmit(Kd.onAutoplayFailed,{userId:n.userId,kind:e instanceof jB?"video":"audio",mediaType:e instanceof jB?Sd.VIDEO:Sd.AUDIO,streamIndex:e.isScreen?gd.STREAM_INDEX_SCREEN:gd.STREAM_INDEX_MAIN})}t.safeEmit(Kd.onPlayerEvent,n)}))}},{key:"_initLocalTrackEvents",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(Kd.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})})),e.on("resolution-change",(function(e){t._extensionManager.getPluginsByType(kV.PRE_PROCESSING).forEach((function(t){var r;null==t||null===(r=t.applyConstraints)||void 0===r||r.call(t,e)})),t.safeEmit(Kd.onLocalVideoSizeChanged,{streamIndex:r?gd.STREAM_INDEX_SCREEN:gd.STREAM_INDEX_MAIN,info:e})}))}},{key:"_removeLocalTrackEvents",value:function(e){e.removeAllListeners("track-ended"),e.removeAllListeners("resolution-change")}},{key:"setRemoteVideoPlayer",value:function(e,t){uX.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),vw(e,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),Rw(t);var r,n,i,a=t.userId;if(e===gd.STREAM_INDEX_MAIN){var o,s,c;if(null===(o=this._remoteVideoPlayer.get(a))||void 0===o||o.destroy(),!t.renderDom)return;var u=new jB(t);this._initPlayerEvents(u,!1,e),this._remoteVideoPlayer.set(a,u);var d=null===(s=this._room)||void 0===s||null===(c=s.remoteStreams.get(a))||void 0===c?void 0:Nb(c).call(c,(function(e){return!e.isScreen}));return d&&this._updateVideoPlayerState(d),u.domElement}if(null===(r=this._remoteScreenPlayer.get(a))||void 0===r||r.destroy(),t.renderDom){var l=new jB(ud(ud({},t),{},{isScreen:!0}));this._remoteScreenPlayer.set(a,l),this._initPlayerEvents(l,!1,e);var h=null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(a))||void 0===i?void 0:Nb(i).call(i,(function(e){return e.isScreen}));return h&&this._updateVideoPlayerState(h),l.domElement}}},{key:"setLocalVideoMirrorType",value:function(e){uX.print("setLocalVideoMirrorType()","mirrorType: %o",e),vw(e,"mirrorType",[kd.MIRROR_TYPE_NONE,kd.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)}},{key:"setAudioPlaybackDevice",value:(G=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("setAudioPlaybackDevice()","deviceId: %s",t),fw(t,"deviceId"),e.next=4,this._audioDeviceManager.setSinkId(t);case 4:r=e.sent,this._remoteAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this._remoteScreenAudioPlayer.forEach((function(e){e.setPlaybackDevice(t)})),this.safeEmit(Kd.onAudioPlaybackDeviceChanged,r),CP.rtcAudioDevice(pP.PLAYOUT_DEVICE_SWITCH,t,0);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"play",value:(j=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=y.length>1&&void 0!==y[1]?y[1]:Sd.AUDIO_AND_VIDEO,o=y.length>2?y[2]:void 0,uX.print("play()","userId: %s, mediaType: %s, streamIndex: %s",t,a,o),s=!t||t===this._getUserId()||"local_user"===t,c=void 0===o||o===gd.STREAM_INDEX_MAIN,u=void 0===o||o===gd.STREAM_INDEX_SCREEN,d=a!==Sd.VIDEO,l=a!==Sd.AUDIO,h=[],s&&l&&(c&&this._localVideoTrack&&(null===(p=this._videoPlayer)||void 0===p||p.mirror(!!this._mirrorType),h.push(null===(f=this._videoPlayer)||void 0===f?void 0:f.playVideo(this._localVideoTrack))),u&&this._localScreenVideoTrack&&h.push(null===(v=this._screenPlayer)||void 0===v?void 0:v.playVideo(this._localScreenVideoTrack))),t===(null===(r=this._audioMixingManager)||void 0===r?void 0:r.id)&&h.push(this._audioMixingManager.resumeLocalPlay()),_=null===(n=this._room)||void 0===n?void 0:n.remoteStreams,l&&c&&h.push(HB(this._remoteVideoPlayer,t,!1,_)),l&&u&&h.push(HB(this._remoteScreenPlayer,t,!0,_)),d&&c&&h.push(HB(this._remoteAudioPlayer,t,!1,_)),l&&u&&h.push(HB(this._remoteScreenAudioPlayer,t,!0,_)),m=null===(i=this._publicStreamManager)||void 0===i?void 0:i.remoteStreams,d&&h.push(HB(this._publicStreamVideoPlayer,t,!1,m)),l&&h.push(HB(this._publicStreamAudioPlayer,t,!1,m)),e.abrupt("return",v_.all(h).then((function(){})));case 20:case"end":return e.stop()}}),e,this)}))),function(e){return j.apply(this,arguments)})},{key:"pauseAllSubscribedStream",value:(B=m_(Im.mark((function e(t){var r,n,i,a,o,s=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("pauseAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),ZC(t)&&(s._pauseAllSubscribeState.audio=!0),$C(t)&&(s._pauseAllSubscribeState.video=!0),this._room){e.next=6;break}return e.abrupt("return",v_.resolve());case 6:n=[],i=ZT(nA(r=this._room.remoteStreams).call(r));try{for(i.s();!(a=i.n()).done;)o=a.value,Array.isArray(o)&&o.forEach((function(e){if(e.hasSubscribed){s._pauseAllSubscribeState.resumeStreamIds[e.streamId]=e.streamId;var r=s._unsubscribe(e.isScreen,e.userId,t,!0);r&&n.push(r)}}))}catch(c){i.e(c)}finally{i.f()}return e.abrupt("return",v_.all(n).then((function(){})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return B.apply(this,arguments)})},{key:"resumeAllSubscribedStream",value:(F=m_(Im.mark((function e(t){var r,n,i,a,o,s=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("resumeAllSubscribedStream()","mediaType: %o",t),this._checkMediaType(t),ZC(t)&&(s._pauseAllSubscribeState.audio=!1),$C(t)&&(s._pauseAllSubscribeState.video=!1),this._room){e.next=6;break}return e.abrupt("return",v_.resolve());case 6:n=[],i=ZT(nA(r=this._room.remoteStreams).call(r));try{for(i.s();!(a=i.n()).done;)o=a.value,Array.isArray(o)&&o.forEach((function(e){if(s._pauseAllSubscribeState.resumeStreamIds[e.streamId]){delete s._pauseAllSubscribeState.resumeStreamIds[e.streamId];var r=s._subscribe(e.isScreen,e.userId,t);r&&n.push(r)}}))}catch(c){i.e(c)}finally{i.f()}return e.abrupt("return",v_.all(n).then((function(){var e,t;null===(e=s._room)||void 0===e||null===(t=e.remoteStreams)||void 0===t||t.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){s._updateAudioPlayerState(e),s._updateVideoPlayerState(e)}))}))})));case 10:case"end":return e.stop()}}),e,this)}))),function(e){return F.apply(this,arguments)})},{key:"sendUserMessage",value:(V=m_(Im.mark((function e(t,r){var n,i,a,o=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kw(t),Cw(r),this._assertNotInRoom(),a=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return o._messageStatisticsObserver.countP2PMessage(!0,t,!1,a,e),e.id})).catch((function(e){throw o._messageStatisticsObserver.countP2PMessage(!1,t,!1,a,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return V.apply(this,arguments)})},{key:"sendUserBinaryMessage",value:(U=m_(Im.mark((function e(t,r){var n,i,a,o=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kw(t),yw(r,"message"),Cw(r),this._assertNotInRoom(),a=Date.now(),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.sendUserMessage(t,r))||void 0===i?void 0:i.then((function(e){return o._messageStatisticsObserver.countP2PMessage(!0,t,!0,a,e),e.id})).catch((function(e){throw o._messageStatisticsObserver.countP2PMessage(!1,t,!0,a,e),e})));case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return U.apply(this,arguments)})},{key:"sendRoomMessage",value:(L=m_(Im.mark((function e(t){var r,n,i,a=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Cw(t),this._assertNotInRoom(),i=Date.now(),e.abrupt("return",null===(r=this._room)||void 0===r||null===(n=r.sendRoomMessage(t))||void 0===n?void 0:n.then((function(e){var t,r;return a._messageStatisticsObserver.countRoomMessage(!0,null===(t=a._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!1,i),e})).catch((function(e){var t,r;throw a._messageStatisticsObserver.countRoomMessage(!1,null===(t=a._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!1,i),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"sendRoomBinaryMessage",value:(M=m_(Im.mark((function e(t){var r,n,i,a=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return Cw(t),this._assertNotInRoom(),i=Date.now(),e.abrupt("return",null===(r=this._room)||void 0===r||null===(n=r.sendRoomMessage(t,!0))||void 0===n?void 0:n.then((function(e){var t,r;return a._messageStatisticsObserver.countRoomMessage(!0,null===(t=a._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!0,i),e})).catch((function(e){var t,r;throw a._messageStatisticsObserver.countRoomMessage(!1,null===(t=a._room)||void 0===t||null===(r=t.roomInfo)||void 0===r?void 0:r.roomId,!0,i),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return M.apply(this,arguments)})},{key:"setAudioCaptureConfig",value:(N=m_(Im.mark((function e(){var t,r=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t=r.length>0&&void 0!==r[0]?r[0]:{},uX.print("setAudioCaptureConfig()","config: %o",t),delete t.deviceId,gw(t),this._shouldUpdateAudioConf("setAudioCaptureConfig")&&this._audioProfileManager.updateConstraints(t);case 5:case"end":return e.stop()}}),e,this)}))),function(){return N.apply(this,arguments)})},{key:"setVideoCaptureConfig",value:(P=m_(Im.mark((function e(){var t,r=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.length>0&&void 0!==r[0]?r[0]:{},uX.print("setVideoCaptureConfig()","config: %o",t),e.abrupt("return",this._setVideoCaptureConfig(t));case 3:case"end":return e.stop()}}),e,this)}))),function(){return P.apply(this,arguments)})},{key:"_setVideoCaptureConfig",value:(D=m_(Im.mark((function e(){var t,r,n,i=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(delete(r=i.length>0&&void 0!==i[0]?i[0]:{}).deviceId,gw(r),n=ud(ud({},r),{},{deviceId:this._videoStreamConstraints.deviceId}),!this._localVideoTrack){e.next=7;break}return e.next=7,this._localVideoTrack.updateVideoCaptureConfig(n);case 7:return this._videoStreamConstraints=n,e.abrupt("return",(null===(t=this._localVideoTrack)||void 0===t?void 0:t.getTrack().getSettings())||{});case 9:case"end":return e.stop()}}),e,this)}))),function(){return D.apply(this,arguments)})},{key:"enableSimulcastMode",value:function(e){var t;return uX.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,null!==(t=this._room)&&void 0!==t&&t.hasPublished&&aw("You must call this API before publishing the video streams"),!0}},{key:"setVideoEncoderConfig",value:(O=m_(Im.mark((function e(t){var r,n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:for(uX.print("setVideoEncoderConfig()"," descriptions: %o",t),Array.isArray(t)||(t=[t]),Dw(t=Gs(t).call(t,(function(e){return!!e}))),t.length>3&&(aw("setVideoEncoderConfig: You can set parameters for up to 3 streams"),t=km(t).call(t,0,3)),n=1;n<t.length;n++)i=ow(t[0].width)/ow(t[n].width)||1,Math.floor(i)!==i&&aw("setVideoEncoderConfig: The resolution setting needs to be an integer multiple");BA(t).call(t,(function(e,t){return t.maxKbps-e.maxKbps})),this._setVideoCaptureConfig(ud({},t[0])),this._videoStreamEncodeConfig=t,this._updateDummyCaptureImage(gd.STREAM_INDEX_MAIN),null!==(r=this._room)&&void 0!==r&&r.hasPublished&&this._updatePublish();case 11:case"end":return e.stop()}}),e,this)}))),function(e){return O.apply(this,arguments)})},{key:"setScreenEncoderConfig",value:(x=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:uX.print("setScreenEncoderConfig()","description: %o",t),this._screenStreamEncodeConfig=[t],this._localScreenVideoTrack&&(this._localScreenVideoTrack.updateVideoCaptureConfig(t),t.contentHint&&this._localScreenVideoTrack.setContentHint(t.contentHint)),this._updateDummyCaptureImage(gd.STREAM_INDEX_SCREEN),null!==(r=this._room)&&void 0!==r&&r.hasScreenPublished&&this._updateScreenPublish();case 5:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"sendSEIMessage",value:function(e,t,r){if(uX.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),!HL())throw new pR(lR.NOT_SUPPORTED,"Browser does not support sending SEI");vw(e,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),pw(r,"repeatCount",0,30);var n="string"==typeof t?new Uint8Array(xC.str2ab(t)):t;if(t.length){var i;if(e===gd.STREAM_INDEX_MAIN){var a,o,s;if(null===(a=this._room)||void 0===a||null===(o=a.localStream)||void 0===o||!o.hasPublished)return;i=null===(s=this._room)||void 0===s?void 0:s.localStream}else{var c,u,d;if(null===(c=this._room)||void 0===c||null===(u=c.localScreenStream)||void 0===u||!u.hasPublished)return;i=null===(d=this._room)||void 0===d?void 0:d.localScreenStream}if(n.byteLength>4096)uX.print("sei size must not bigger than 4KB");else{var l=AC();i.seiList.push({content:n,uuid:l,repeatCount:r}),setTimeout((function(){var e;if(i){var t,r=YA(e=i.seiList).call(e,(function(e){return e.uuid===l}));if(r)mk(t=i.seiList).call(t,r,1)}}),2e3)}}else uX.print("sei message must not be empty")}},{key:"setAudioVolumeIndicationInterval",value:function(e){var t=this;uX.print("setAudioVolumeIndicationInterval()","interval %o: ",e),("number"!=typeof e||e<200)&&(e=200);var r=[];this._audioVolumeIndicationTimer&&clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=setInterval((function(){var e,n;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n;if(0!==e.length){var i=Nb(e).call(e,(function(e){return!1===e.isScreen})),a=null==i||null===(n=i.audioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t,volume:a||0})}}));var i=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t._getUserId(),volume:i||0}),t.safeEmit(Kd.onAudioVolumeIndication,{speakers:r})}),e)}},{key:"_sendActiveSpeaker",value:function(e,t){if(this._room&&this._room.remoteUsers.size>=1){var r,n=e[0],i=LE(t).call(t,(function(e,t){return e&&e.audioPropertiesInfo.nonlinearVolume>t.audioPropertiesInfo.nonlinearVolume?e:t}),void 0);if((r=n?i?n.audioPropertiesInfo.nonlinearVolume>i.audioPropertiesInfo.nonlinearVolume?n:i:n:i)&&r.audioPropertiesInfo.nonlinearVolume>-35){var a,o;if(r.streamKey)a=this._room.remoteUsers.get(r.streamKey.userId);else a=null===(o=this._room._roomInfo)||void 0===o?void 0:o.userInfo;a&&this.safeEmit(Kd.onActiveSpeaker,{userId:a.userId,extraInfo:a.extraInfo})}}}},{key:"enableAudioPropertiesReport",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};uX.print("enableAudioPropertiesReport()","config %o: ",t);var r=t.enableInBackground,n=void 0===r||r,i=t.interval,a=void 0===i?100:i;this._stopAudioPropertiesReport(),a<=0||(a=Math.max(100,a),this._audioPropertiesReportTimer=self.setInterval((function(){if(n||"hidden"!==document.visibilityState){var t=[],r=e._audioDeviceManager.getRecordTrack()||e._localAudioTrack;if(r){var i=r.getAudioLevel();t.push({streamIndex:gd.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:JC(i)}})}if(e._localScreenAudioTrack){var a=e._localScreenAudioTrack.getAudioLevel();t.push({streamIndex:gd.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:a,nonlinearVolume:JC(a)}})}if(e.safeEmit(Kd.onLocalAudioPropertiesReport,t),e._room){var o,s=[];if(null!==(o=e._room)&&void 0!==o&&o.multiChatMode)e._room.getActiveSpeakerInMultiChatMode().forEach((function(t){var r,n,i=255*t.audioLevel;s.push({streamKey:{userId:t.userId,streamIndex:gd.STREAM_INDEX_MAIN,roomId:null===(r=e._room)||void 0===r||null===(n=r._roomInfo)||void 0===n?void 0:n.roomId},audioPropertiesInfo:{linearVolume:i,nonlinearVolume:JC(i)}})}));else e._room.remoteStreams.forEach((function(t,r){t.forEach((function(t){if(t.audioTrack){var n,i,a=t.audioTrack.getAudioLevel();s.push({streamKey:{userId:r,streamIndex:t.isScreen?gd.STREAM_INDEX_SCREEN:gd.STREAM_INDEX_MAIN,roomId:null===(n=e._room)||void 0===n||null===(i=n.roomInfo)||void 0===i?void 0:i.roomId},audioPropertiesInfo:{linearVolume:a,nonlinearVolume:JC(a)}})}}))}));e.safeEmit(Kd.onRemoteAudioPropertiesReport,s),e._sendActiveSpeaker(t,Gs(s).call(s,(function(e){return e.streamKey.streamIndex!==gd.STREAM_INDEX_SCREEN})))}}}),a))}},{key:"setVideoSourceType",value:(w=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b,k,T;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("setVideoSourceType()","index: %o, videoSourceType: %o",t,r),vw(t,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),vw(r,"VideoSourceType",[dd.VIDEO_SOURCE_TYPE_EXTERNAL,dd.VIDEO_SOURCE_TYPE_INTERNAL]),n=t===gd.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[n]===r){e.next=26;break}if(this._trackSourceType[n]=r,uX.print("setVideoSourceType",xm(i="set ".concat(n," source type to ")).call(i,r)),!this._localVideoTrack||t!==gd.STREAM_INDEX_MAIN){e.next=17;break}if(c=!1,r===dd.VIDEO_SOURCE_TYPE_EXTERNAL&&(c=!0,this._removeLocalTrackEvents(this._localVideoTrack),this._localVideoTrack.close()),null===(a=this._videoPlayer)||void 0===a||a.stop(),this._localVideoTrack=void 0,u=null===(o=this._room)||void 0===o?void 0:o._roomConfig.isAutoPublish,c?null===(d=this._room)||void 0===d||null===(l=d.localStream)||void 0===l||null===(h=l.observer)||void 0===h||h.setEnableVideo(!1):null===(p=this._room)||void 0===p||null===(f=p.localStream)||void 0===f||null===(v=f.observer)||void 0===v||v.setPushVideo(!1),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||u)){e.next=17;break}return e.next=17,this._updatePublish();case 17:if(!this._localScreenVideoTrack||t!==gd.STREAM_INDEX_SCREEN){e.next=26;break}if(y=!1,r===dd.VIDEO_SOURCE_TYPE_EXTERNAL&&(y=!0,this._removeLocalTrackEvents(this._localScreenVideoTrack),this._localScreenVideoTrack.close()),null===(_=this._screenPlayer)||void 0===_||_.stop(),this._localScreenVideoTrack=void 0,y?null===(g=this._room)||void 0===g||null===(S=g.localScreenStream)||void 0===S||null===(E=S.observer)||void 0===E||E.setEnableVideo(!1):null===(b=this._room)||void 0===b||null===(k=b.localScreenStream)||void 0===k||null===(T=k.observer)||void 0===T||T.setPushVideo(!1),null===(m=this._room)||void 0===m||!m.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"setExternalVideoTrack",value:(C=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("setExternalVideoTrack()","index: %o, track: %o",t,r),vw(t,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),_w(r),t!==gd.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.video===dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 6:return e.next=8,eF(r,this._extensionManager);case 8:if(this._localVideoTrack=e.sent,this._initLocalTrackEvents(this._localVideoTrack),null===(n=this._videoPlayer)||void 0===n||n.playVideo(this._localVideoTrack),o=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,!(null!==(a=this._room)&&void 0!==a&&a.hasPublished||o)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==gd.STREAM_INDEX_SCREEN){e.next=27;break}if(this._trackSourceType.screenVideo===dd.VIDEO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");case 18:return e.next=20,iF(r,this._extensionManager);case 20:if(this._localScreenVideoTrack=e.sent,this._initLocalTrackEvents(this._localScreenVideoTrack,!0),null===(s=this._screenPlayer)||void 0===s||s.playVideo(this._localScreenVideoTrack),null===(c=this._room)||void 0===c||null===(u=c.localScreenStream)||void 0===u||null===(d=u.observer)||void 0===d||d.setPushVideo(!0),null===(l=this._room)||void 0===l||!l.hasScreenPublished){e.next=27;break}return e.next=27,this._updateScreenPublish();case 27:case"end":return e.stop()}}),e,this)}))),function(e,t){return C.apply(this,arguments)})},{key:"setAudioSourceType",value:(R=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h,p,f,v,_,m,y,g,S,E,b;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("setAudioSourceType()","index: %o, audioSourceType: %o",t,r),vw(t,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),vw(r,"audioSourceType",[ld.AUDIO_SOURCE_TYPE_EXTERNAL,ld.AUDIO_SOURCE_TYPE_INTERNAL]),n=t===gd.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[n]===r){e.next=24;break}if(this._trackSourceType[n]=r,uX.print("setVideoSourceType",xm(i="set ".concat(n," source type to ")).call(i,r)),!this._localAudioTrack||t!==gd.STREAM_INDEX_MAIN){e.next=16;break}if(s=!1,this._trackSourceType.audio===ld.AUDIO_SOURCE_TYPE_EXTERNAL&&(s=!0,this._removeLocalTrackEvents(this._localAudioTrack),this._localAudioTrack.close()),this._localAudioTrack=void 0,c=null===(a=this._room)||void 0===a?void 0:a._roomConfig.isAutoPublish,s?null===(u=this._room)||void 0===u||null===(d=u.localStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setEnableAudio(!1):null===(h=this._room)||void 0===h||null===(p=h.localStream)||void 0===p||null===(f=p.observer)||void 0===f||f.setPushAudio(!1),!(null!==(o=this._room)&&void 0!==o&&o.hasPublished||c)){e.next=16;break}return e.next=16,this._updatePublish();case 16:if(!this._localScreenAudioTrack||t!==gd.STREAM_INDEX_SCREEN){e.next=24;break}if(_=!1,this._trackSourceType.audio===ld.AUDIO_SOURCE_TYPE_EXTERNAL&&(_=!0,this._removeLocalTrackEvents(this._localScreenAudioTrack),this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,_?null===(m=this._room)||void 0===m||null===(y=m.localScreenStream)||void 0===y||null===(g=y.observer)||void 0===g||g.setEnableAudio(!1):null===(S=this._room)||void 0===S||null===(E=S.localScreenStream)||void 0===E||null===(b=E.observer)||void 0===b||b.setPushAudio(!1),null===(v=this._room)||void 0===v||!v.hasScreenPublished){e.next=24;break}return e.next=24,this._updateScreenPublish();case 24:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"setExternalAudioTrack",value:(A=m_(Im.mark((function e(t,r){var n,i,a,o,s,c,u,d,l,h;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("setExternalAudioTrack()","index: %o, track: %o",t,r),vw(t,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),_w(r),t!==gd.STREAM_INDEX_MAIN){e.next=15;break}if(this._trackSourceType.audio===ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=6;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 6:return e.next=8,rF(r,this._extensionManager);case 8:if(this._localAudioTrack=e.sent,this._initLocalTrackEvents(this._localAudioTrack),c=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,null===(i=this._room)||void 0===i||null===(a=i.localStream)||void 0===a||null===(o=a.observer)||void 0===o||o.setPushAudio(!0),!(null!==(s=this._room)&&void 0!==s&&s.hasPublished||c)){e.next=15;break}return e.next=15,this._updatePublish();case 15:if(t!==gd.STREAM_INDEX_SCREEN){e.next=26;break}if(this._trackSourceType.screenAudio===ld.AUDIO_SOURCE_TYPE_EXTERNAL){e.next=18;break}throw new pR(lR.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");case 18:return e.next=20,oF(r,this._extensionManager);case 20:if(this._localScreenAudioTrack=e.sent,this._initLocalTrackEvents(this._localScreenAudioTrack),null===(u=this._room)||void 0===u||null===(d=u.localScreenStream)||void 0===d||null===(l=d.observer)||void 0===l||l.setPushAudio(!0),null===(h=this._room)||void 0===h||!h.hasScreenPublished){e.next=26;break}return e.next=26,this._updateScreenPublish();case 26:case"end":return e.stop()}}),e,this)}))),function(e,t){return A.apply(this,arguments)})},{key:"login",value:(I=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("login()","token: %o, userInfo: %o",t,r),Ew(t)||fw(t,"token"),kw(r),e.abrupt("return",this._rtmClient.login(t,r));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return I.apply(this,arguments)})},{key:"logout",value:(T=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("logout()"),e.abrupt("return",this._rtmClient.logout());case 2:case"end":return e.stop()}}),e,this)}))),function(){return T.apply(this,arguments)})},{key:"updateLoginToken",value:(k=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("updateLoginToken()","token: %o",t),Ew(t)||fw(t,"token"),e.abrupt("return",this._rtmClient.updateLoginToken(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return k.apply(this,arguments)})},{key:"getPeerOnlineStatus",value:(b=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("getPeerOnlineStatus()","userId: %o",t),kw(t),e.abrupt("return",this._rtmClient.getPeerOnlineStatus(t));case 3:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"sendUserMessageOutsideRoom",value:(E=m_(Im.mark((function e(t,r){var n,i=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kw(t),Cw(r),n=Date.now(),e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!1,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!1,n,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"sendUserBinaryMessageOutsideRoom",value:(S=m_(Im.mark((function e(t,r){var n,i=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return kw(t),yw(r,"message"),Cw(r),n=Date.now(),e.abrupt("return",this._rtmClient.sendUserMessageOutsideRoom(t,r).then((function(e){return i._messageStatisticsObserver.countUserMessageOutsideRoom(!0,t,!0,n,e),e.id})).catch((function(e){throw i._messageStatisticsObserver.countUserMessageOutsideRoom(!1,t,!0,n,e),e})));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"setServerParams",value:(g=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("setServerParams()","signature: %o, url: %0",t,r),e.abrupt("return",this._rtmClient.setServerParams(t,r));case 2:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"sendServerMessage",value:(y=m_(Im.mark((function e(t){var r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return fw(t,"message"),Cw(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(e){n._messageStatisticsObserver.countServerMessage(!0,!1,r,e)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!1,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return y.apply(this,arguments)})},{key:"sendServerBinaryMessage",value:(m=m_(Im.mark((function e(t){var r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return yw(t,"message"),Cw(t),r=Date.now(),e.abrupt("return",this._rtmClient.sendServerMessage(t).then((function(e){n._messageStatisticsObserver.countServerMessage(!0,!0,r,e)})).catch((function(e){throw n._messageStatisticsObserver.countServerMessage(!1,!0,r,e),e})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"startCloudProxy",value:function(e){if(this._room)throw new pR(lR.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");uX.print("startCloudProxy()",e),fw(e.logProxy,"logProxy"),fw(e.accessProxy,"accessProxy"),fw(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=rN("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=rN("LOG_SERVER_URL"),this._originConfigServerUrls=rN("CONFIG_REQUEST_DOMAINS"),tN("ICE_CONFIG_REQUEST_URLS",e.accessProxy),tN("LOG_SERVER_URL",function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return/^https?:\/\/.+/.test(e)||(e="https://"+e),"".concat(e,"/video/v1/webrtc_log/")}(e.logProxy)),tN("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0}},{key:"stopCloudProxy",value:function(){if(this._room)throw new pR(lR.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");uX.print("stopCloudProxy()"),tN("ICE_CONFIG_REQUEST_URLS",[]),tN("LOG_SERVER_URL",this._originLogServerUrl),tN("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0}},{key:"startPushPublicStream",value:(_=m_(Im.mark((function e(t,r){var n,i,a,o=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),Tw(t),this._assertNotInRoom(),!this._publicStreamIds.get(t)){e.next=5;break}throw new pR(lR.REPEAT_PUSH,"repeat push public media stream");case 5:return a=nN(t,"started",r),e.abrupt("return",null===(n=this._room)||void 0===n||null===(i=n.publicStreamControlMessage(a))||void 0===i?void 0:i.then((function(){o._publicStreamIds.set(t,t)})));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return _.apply(this,arguments)})},{key:"updatePublicStreamParam",value:(v=m_(Im.mark((function e(t,r){var n,i;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",t,r),Tw(t),this._assertNotInRoom(),i=nN(t,"layoutChanged",r),e.abrupt("return",null===(n=this._room)||void 0===n?void 0:n.publicStreamControlMessage(i));case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"stopPushPublicStream",value:(f=m_(Im.mark((function e(t){var r,n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("startPushPublicStream()","publicStreamId: %o",t),Tw(t),this._assertNotInRoom(),e.abrupt("return",null===(r=this._room)||void 0===r?void 0:r.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:t}).then((function(){n._publicStreamIds.delete(t)})));case 4:case"end":return e.stop()}}),e,this)}))),function(e){return f.apply(this,arguments)})},{key:"startPlayPublicStream",value:(p=m_(Im.mark((function e(t){var r,n,i,a,o,s,c=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(Tw(t),this._publicStreamManager){e.next=8;break}return this._publicStreamManager=new KK(this.id,this._appId,{businessId:this._businessId}),this._publicStreamManager.on(rB.RESUBSCRIBE,(function(e){var t=e.stream;if(t){var r,n=c._publicStreamAudioPlayer.get(t.streamId);n&&t.audioTrack&&(n.stop(),n.playAudio(null===(r=e.stream)||void 0===r?void 0:r.audioTrack));var i,a=c._publicStreamVideoPlayer.get(t.streamId);a&&t.videoTrack&&a.playVideo(null===(i=e.stream)||void 0===i?void 0:i.videoTrack)}})),null===(r=this._publicStreamManager)||void 0===r||r.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,c.safeEmit(Kd.onPublicStreamStats,e)})),null===(n=this._publicStreamManager)||void 0===n||n.on(rB.ON_SEI_MESSAGED_RECEIVED,(function(e){c.safeEmit(Kd.onPublicStreamSEIMessageReceived,e)})),e.next=8,this._publicStreamManager.connect();case 8:return e.next=10,this._publicStreamManager.startPlayPublicStream(t);case 10:i=e.sent,(a=this._publicStreamVideoPlayer.get(t))&&null!=i&&i.videoTrack&&a.playVideo(i.videoTrack,i),!(o=this._publicStreamAudioPlayer.get(t))&&null!=i&&i.audioTrack&&(o=new GB(t,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===Nd.VIDEO_ONLY,isScreen:!1}),this._initPlayerEvents(o,!0),o.playAudio(i.audioTrack),this._publicStreamAudioPlayer.set(t,o));case 15:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"stopPlayPublicStream",value:(h=m_(Im.mark((function e(t){var r;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._publicStreamManager){e.next=2;break}return e.abrupt("return");case 2:this._publicStreamManager.stopPlayPublicStream(t),(r=this._publicStreamAudioPlayer.get(t))&&(r.destroy(),this._publicStreamAudioPlayer.delete(t));case 5:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"setAudioProfile",value:(l=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:uX.print("setAudioProfile()","profile: %o",t),this._shouldUpdateAudioConf("setAudioProfile")&&this._audioProfileManager.setAudioProfile(t);case 2:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"setPublicStreamVideoPlayer",value:function(e,t){var r,n,i,a;uX.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var o=this._publicStreamVideoPlayer.get(e);if(null===(r=o)||void 0===r||r.destroy(),null!=t&&t.renderDom){o=new jB(ud(ud({},t),{},{userId:e})),this._initPlayerEvents(o,!0),this._publicStreamVideoPlayer.set(e,o);var s=null===(n=this._publicStreamManager)||void 0===n||null===(i=n.remoteStreams)||void 0===i?void 0:i.get(e);null!=s&&s.videoTrack&&(null===(a=this._config)||void 0===a?void 0:a.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&o.playVideo(s.videoTrack,s)}else this._publicStreamVideoPlayer.delete(e)}},{key:"setDummyCaptureImagePath",value:(d=m_(Im.mark((function e(t,r){var n=this;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new v_((function(e,i){fw(r,"filePath");var a=new Image;a.crossOrigin="anonymous",a.src=r,a.onload=function(){t===gd.STREAM_INDEX_MAIN?n._dummyMainImage=a:n._dummyScreenImage=a;try{n._updateDummyCaptureImage(t),e()}catch(r){i(new pR(lR.UNEXPECTED_ERROR,r.message))}},a.onerror=function(){i(new pR(lR.UNEXPECTED_ERROR,"Load image error"))}})));case 1:case"end":return e.stop()}}),e)}))),function(e,t){return d.apply(this,arguments)})},{key:"_updateDummyCaptureImage",value:function(e){var t,r;if(e===gd.STREAM_INDEX_MAIN?(t=this._dummyMainImage,r=this._videoStreamEncodeConfig[0]):(t=this._dummyScreenImage,r=this._screenStreamEncodeConfig[0]),t){var n,i,a=document.createElement("canvas"),o=a.getContext("2d"),s=ow(r.width),c=ow(r.height);if(!o)throw new pR(lR.UNEXPECTED_ERROR,"Not support canvas");!s||!c||t.width<=s&&t.height<=c?(n=t.width,i=t.height):(n=Math.min(s,t.width*c/t.height),i=Math.min(c,t.height*s/t.width)),a.width=n,a.height=i,o.drawImage(t,0,0,t.width,t.height,0,0,n,i);var u=window.setInterval((function(){t&&o.drawImage(t,0,0,t.width,t.height,0,0,n,i)}),200);e===gd.STREAM_INDEX_MAIN?(clearInterval(this._dummyMainTimer),this._dummyMainTimer=u):(clearInterval(this._dummyScreenTimer),this._dummyScreenTimer=u);var d,l,h,p,f=a.captureStream(5).getVideoTracks()[0];if(e===gd.STREAM_INDEX_MAIN){if(this._localImgVideoTrack=f,null!==(d=this._localVideoTrack)&&void 0!==d&&d.dummy)null===(l=this._localVideoTrack)||void 0===l||l.setTrack(this._localImgVideoTrack,this._extensionManager)}else if(this._localImgScreenTrack=f,null!==(h=this._localScreenVideoTrack)&&void 0!==h&&h.dummy)null===(p=this._localScreenVideoTrack)||void 0===p||p.setTrack(this._localImgScreenTrack,this._extensionManager)}}},{key:"_addListenExtensionEvent",value:function(e){var t=this;e.on("re-capture-audio",(function(){t._localAudioTrack&&t.stopAudioCapture().then((function(){t.startAudioCapture()}))})),e.on("re-capture-video",(function(){t._localVideoTrack&&!t._localVideoTrack.dummy&&t.stopVideoCapture().then((function(){t.startVideoCapture()}))}))}},{key:"registerExtension",value:(u=m_(Im.mark((function e(t){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t.monitor=CP,t.isSupported()){e.next=3;break}throw new Error("This extension is not supported.");case 3:return e.next=5,t.init();case 5:this._extensionManager.register(t),this._addListenExtensionEvent(t);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"defaultTranscoding",value:function(){return JSON.parse(ny(aX.getDefaultValue()))}},{key:"_updatePublish",value:(c=m_(Im.mark((function e(){var t,r,n,i=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=i.length>0&&void 0!==i[0]?i[0]:{},uX.print("_updatePublish()","config: %o",t),r={mediaType:void 0,invokeByJoinRoom:!1,pubState:iB.PUB},t=ud(ud({},r),t),this._visibility){e.next=6;break}throw new pR(lR.NO_PUBLISH_PERMISSION,"no publish permission");case 6:return e.next=8,this._pubLock.lock();case 8:if(n=e.sent,this._room&&this._room.connectionState===hB.CONNECTED){e.next=12;break}return n(),e.abrupt("return");case 12:return e.prev=12,e.next=15,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,t.mediaType,t.pubState,t.invokeByJoinRoom);case 15:e.next=24;break;case 17:if(e.prev=17,e.t0=e.catch(12),!(e.t0 instanceof pR)){e.next=23;break}throw e.t0;case 23:throw new pR(lR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 24:return e.prev=24,n(),e.finish(24);case 27:case"end":return e.stop()}}),e,this,[[12,17,24,27]])}))),function(){return c.apply(this,arguments)})},{key:"startAudioPlaybackDeviceTest",value:(s=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",t,r),fw(t,"filePath"),pw(r,"indicationInterval"),e.next=5,this._audioDeviceManager.startAudioPlaybackDeviceTest(t,r);case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return s.apply(this,arguments)})},{key:"stopAudioPlaybackDeviceTest",value:function(){uX.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()}},{key:"startAudioDeviceRecordTest",value:(o=m_(Im.mark((function e(t,r){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return uX.print("startAudioDeviceRecordTest()","indicationInterval: %o",t),pw(t,"indicationInterval"),e.next=4,this._audioDeviceManager.startAudioDeviceRecordTest(t,r);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return o.apply(this,arguments)})},{key:"stopAudioDeviceRecordAndPlayTest",value:function(){uX.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()}},{key:"stopAudioDevicePlayTest",value:function(){uX.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()}},{key:"setRemoteUserPriority",value:function(e,t){var r;uX.print("setRemoteUserPriority()","userId: %o, priority: %o",e,t);try{kw(e),vw(t,"priority",[wd.HIGH,wd.MEDIUM,wd.LOW])}catch(n){return console.warn(n),!1}return this._userPriorityMap.set(e,t),null===(r=this._room)||void 0===r||r.updateRemoteUserPriority(e),!0}},{key:"takeLocalSnapshot",value:(a=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("takeLocalSnapshot()","streamIndex: %o",t),vw(t,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),r=t===gd.STREAM_INDEX_MAIN?this.localVideoTrack:this.localScreenVideoTrack){e.next=5;break}throw new pR(lR.INVOKED_BEFORE_CAPTURE,"capture first");case 5:return n=t===gd.STREAM_INDEX_MAIN?this._videoPlayer:this._screenPlayer,e.abrupt("return",JK(r.getTrack("preprocessing"),(null==n?void 0:n.mirrorType)===kd.MIRROR_TYPE_RENDER,n));case 7:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"takeRemoteSnapshot",value:(i=m_(Im.mark((function e(t,r){var n,i,a,o,s,c;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(uX.print("takeRemoteSnapshot()","id: %o, streamIndex: %o",t,r),fw(t,"id"),vw(r,"streamIndex",[gd.STREAM_INDEX_MAIN,gd.STREAM_INDEX_SCREEN]),c=(null===(n=this._room)||void 0===n||null===(i=n.remoteStreams.get(t))||void 0===i||null===(a=Nb(i).call(i,(function(e){return e.isScreen===(r===gd.STREAM_INDEX_SCREEN)})))||void 0===a?void 0:a.videoTrack)||(null===(o=this._publicStreamManager)||void 0===o||null===(s=o.remoteStreams.get(t))||void 0===s?void 0:s.videoTrack)){e.next=6;break}throw new pR(lR.STREAM_NOT_EXIST,"stream not exist");case 6:return e.abrupt("return",JK(c.getTrack(),!1,r===gd.STREAM_INDEX_MAIN?this._remoteVideoPlayer.get(t):this._remoteScreenPlayer.get(t)));case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return i.apply(this,arguments)})},{key:"setSubscribeFallbackOption",value:function(e){uX.print("setSubscribeFallbackOption()","option: %o",e);try{vw(e,"option",[Cd.DISABLE,Cd.VIDEO_STREAM_LOW,Cd.AUDIO_ONLY])}catch(t){return console.warn(t),!1}return!this._room&&(this._subscribeFallbackOption=e,!0)}},{key:"getLocalStreamTrack",value:function(e,t){var r,n,i,a=this;if(e===gd.STREAM_INDEX_MAIN?(n="video"===t?this.localVideoTrack:this.localAudioTrack,i=function(){var e;return null===(e=a._room)||void 0===e?void 0:e.localStream}):(n="video"===t?this.localScreenVideoTrack:this.localScreenAudioTrack,i=function(){var e;return null===(e=a._room)||void 0===e?void 0:e.localScreenStream}),n){var o=n instanceof cF&&n.mixedAudioTrack?n.mixedAudioTrack:n.getTrack("preprocessing");if(o){var s=i();return this._reportMsTrackEvent(o,(null==s||null===(r=s.stream)||void 0===r?void 0:r.id)||"local"),o}}}},{key:"getRemoteStreamTrack",value:function(e,t,r){var n,i,a=(null===(n=this._room)||void 0===n?void 0:n.remoteStreams.get(e))||[];if(a&&a.length){var o,s,c,u,d;if(t===gd.STREAM_INDEX_MAIN)o=Nb(a).call(a,(function(e){return!e.isScreen})),i="video"===r?null===(s=o)||void 0===s?void 0:s.videoTrack:null===(c=o)||void 0===c?void 0:c.audioTrack;else o=Nb(a).call(a,(function(e){return e.isScreen})),i="video"===r?null===(u=o)||void 0===u?void 0:u.videoTrack:null===(d=o)||void 0===d?void 0:d.audioTrack;if(i){var l=i.getTrack();if(l&&o){var h=o.streamId;return this._reportMsTrackEvent(l,h),l}}}}},{key:"getPublicStreamTrack",value:function(e,t){if(this._publicStreamManager&&this._publicStreamManager.remoteStreams){var r=this._publicStreamManager.remoteStreams.get(e);if(r){var n="video"===t?r.videoTrack:r.audioTrack;if(n){var i=n.getTrack();if(i){var a=r.streamId;return this._reportMsTrackEvent(i,a),i}}}}}},{key:"setRemoteStreamRenderSync",value:function(e){return!this._room&&(this._avSync=!!e,!0)}},{key:"_reportMsTrackEvent",value:function(e,t){if(!e.hookStop){e.hookStop=!0;var r=e.stop;e.stop=function(){CP.rtcInvokeStatus(t,0,"stop",t||"",0),r.call(e)}}}},{key:"_updateScreenPublish",value:(n=m_(Im.mark((function e(){var t,r,n,i=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=i.length>0&&void 0!==i[0]?i[0]:{},uX.print("_updateScreenPublish()"),r={mediaType:void 0,pubState:iB.PUB},t=ud(ud({},r),t),e.next=6,this._pubLock.lock();case 6:if(n=e.sent,this._room&&this._room.connectionState===hB.CONNECTED){e.next=10;break}return n(),e.abrupt("return");case 10:return e.prev=10,e.next=13,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack,t.mediaType,t.pubState);case 13:e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(10),!(e.t0 instanceof pR)){e.next=21;break}throw e.t0;case 21:throw new pR(lR.UNEXPECTED_ERROR,"unexpected error",e.t0);case 22:return e.prev=22,n(),e.finish(22);case 25:case"end":return e.stop()}}),e,this,[[10,15,22,25]])}))),function(){return n.apply(this,arguments)})},{key:"_updateAudioPlayerState",value:function(e){uX.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen,i=n?this._remoteScreenAudioPlayer:this._remoteAudioPlayer,a=i.get(r);if(e.audioTrack&&(e.attributes.audiostream&&e.subAudio||this.multiChatMode)){var o;if(!a){var s;a=new GB(r,{muted:(null===(s=this._config)||void 0===s?void 0:s.autoPlayPolicy)===Nd.VIDEO_ONLY,isScreen:n}),this._initPlayerEvents(a,!1,n?gd.STREAM_INDEX_SCREEN:gd.STREAM_INDEX_MAIN),i.set(r,a);var c=this._audioDeviceManager.getSinkId();c&&a.setPlaybackDevice(c)}(null===(o=this._config)||void 0===o?void 0:o.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&a.playAudio(e.audioTrack),NC&&jC&&(t=this._remoteAudioPlayer,nX&&clearTimeout(nX),nX=setTimeout((function(){var e,r=ZT(t);try{for(r.s();!(e=r.n()).done;){var n=$T(e.value,2),i=n[0],a=n[1];null!=i&&dR(i).call(i,"mux")&&a.pause()}}catch(l){r.e(l)}finally{r.f()}var o,s=ZT(t);try{for(s.s();!(o=s.n()).done;){var c=$T(o.value,2),u=c[0],d=c[1];null!=u&&dR(u).call(u,"mux")&&d.manuallyPlay()}}catch(l){s.e(l)}finally{s.f()}}),2e3))}else{var u;null===(u=a)||void 0===u||u.stop()}}},{key:"_updateVideoPlayerState",value:function(e){var t;uX.print("_updateVideoPlayerState()");var r,n,i=e.userId;if(r=e.isScreen?this._remoteScreenPlayer.get(i):this._remoteVideoPlayer.get(i),e.videoTrack)r&&(null===(n=this._config)||void 0===n?void 0:n.autoPlayPolicy)!==Nd.PLAY_MANUALLY&&r.playVideo(e.videoTrack,e);else if(null!==(t=r)&&void 0!==t&&t.played){var a;null===(a=r)||void 0===a||a.stop()}}},{key:"_onAddStream",value:(r=m_(Im.mark((function e(t){var r,n,i,a,o,s,c,u;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.stream,n=null==r?void 0:r.attributes,i=n.localaudio,a=n.audiostream,o=n.localvideo,s=n.videostream,c=uF.NONE,a&&(c|=Sd.AUDIO),s&&(c|=Sd.VIDEO),!c){e.next=11;break}return e.next=8,new v_((function(e){return setTimeout(e)}));case 8:null!=r&&r.isScreen?this.safeEmit(Kd.onUserPublishScreen,{userId:r.userId,mediaType:c}):(this.safeEmit(Kd.onUserPublishStream,{userId:r.userId,mediaType:c,videoStreamDescriptions:null==r||null===(u=r.attributes)||void 0===u?void 0:u.videoDescriptions}),this._handleAutoSubscribe(r,!0)),this.safeEmit("onAddStream",{userId:r.userId,mediaType:c,isScreen:!(null==r||!r.isScreen)}),null!=r&&r.isScreen||(i&&this.safeEmit(Kd.onUserStartAudioCapture,{userId:r.userId}),o&&this.safeEmit(Kd.onUserStartVideoCapture,{userId:r.userId}));case 11:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"_handleAutoSubscribe",value:function(e,t){var r,n,i=uF.NONE;if(null!==(r=this._roomConfig)&&void 0!==r&&r.isAutoSubscribeAudio&&(i|=Sd.AUDIO),null!==(n=this._roomConfig)&&void 0!==n&&n.isAutoSubscribeVideo&&(i|=Sd.VIDEO),i){var a,o;if(t&&ZC(i))null===(a=e.observer)||void 0===a||a.setAutoSubscribeAudio(!0);if(t&&$C(i))null===(o=e.observer)||void 0===o||o.setAutoSubscribeVideo(!0);this._subscribe(!1,e.userId,i)}}},{key:"_onRemoveStream",value:function(e){var t,r=this,n=e.stream,i=null!==(t=fX[e.reason])&&void 0!==t?t:Ed.STREAM_REMOVE_REASON_OTHER,a=n.isScreen?Kd.onUserUnpublishScreen:Kd.onUserUnpublishStream,o=uF.NONE;n.attributes.audiostream&&(o|=Sd.AUDIO),n.attributes.videostream&&(o|=Sd.VIDEO),o!==uF.NONE&&(this.safeEmit(a,{userId:n.userId,mediaType:o,reason:i}),this.safeEmit("onRemoveStream",{userId:n.userId,isScreen:n.isScreen})),this._getRemotePlayer(n.userId,n.isScreen).forEach((function(e){var t=n.isScreen?"".concat(n.userId,"_screen"):n.userId;r._remoteAudioPlayer.delete(t),n.isScreen?r._remoteScreenPlayer.delete(n.userId):r._remoteVideoPlayer.delete(n.userId),null==e||e.destroy()}))}},{key:"_onUserConnection",value:function(e){var t=this;setTimeout((function(){return t.safeEmit(Kd.onUserJoined,e)}))}},{key:"_onUserLeave",value:function(e){this.safeEmit(Kd.onUserLeave,e)}},{key:"_onRoomError",value:function(e){var t;this.safeEmit(Kd.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0}},{key:"_onNetworkQuality",value:function(){for(var e,t=arguments.length,r=new Array(t),n=0;n<t;n++)r[n]=arguments[n];this.safeEmit.apply(this,xm(e=[Kd.onNetworkQuality]).call(e,r))}},{key:"_onConnectionStateChange",value:function(e){if(void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===bd.CONNECTION_STATE_CONNECTED&&this.safeEmit(Kd.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(Kd.onConnectionStateChanged,e),e.state===bd.CONNECTION_STATE_RECONNECTING){var t,r=ZT(this._remoteAudioPlayer);try{for(r.s();!(t=r.n()).done;){var n=$T(t.value,2),i=n[0],a=n[1];null!=i&&dR(i).call(i,"mux")&&a.stop()}}catch(o){r.e(o)}finally{r.f()}}}},{key:"_getRemotePlayer",value:function(e,t){return[(t?this._remoteScreenAudioPlayer:this._remoteAudioPlayer).get(e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]}},{key:"_stopAudioPropertiesReport",value:function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)}},{key:"_onResubscribe",value: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))}},{key:"_onSubscribePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onRemovePushTrack",value:function(e){e.stream&&this._updateAudioPlayerState(e.stream)}},{key:"_onVideoDeviceStateChange",value:function(e){this.safeEmit(Kd.onVideoDeviceStateChanged,e)}},{key:"_onAudioDeviceStateChange",value:function(e){this.safeEmit(Kd.onAudioDeviceStateChanged,e)}},{key:"_onUserPublishStateChange",value:function(e){var t,r=this,n=e.userId,i=e.isScreen,a=e.mediaType,o=e.pubState,s=e.remoteStream,c={userId:n,mediaType:a};(a&Sd.AUDIO&&setTimeout((function(){r._updateAudioPlayerState(s)})),i)?o===iB.PUB?this.safeEmit(Kd.onUserPublishScreen,c):this.safeEmit(Kd.onUserUnpublishScreen,ud(ud({},c),{},{reason:Ed.STREAM_REMOVE_REASON_UNPUBLISH})):o===iB.PUB?(c.videoStreamDescriptions=null==s||null===(t=s.attributes)||void 0===t?void 0:t.videoDescriptions,this.safeEmit(Kd.onUserPublishStream,c),this._handleAutoSubscribe(s,!0)):this.safeEmit(Kd.onUserUnpublishStream,ud(ud({},c),{},{reason:Ed.STREAM_REMOVE_REASON_UNPUBLISH}))}},{key:"_onCustomMessage",value:function(e){var t=e.message;e.binary?this.safeEmit(Kd.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(Kd.onRoomMessageReceived,{userId:e.clientId,message:t})}},{key:"_onUserMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Kd.onUserMessageReceived,e)}},{key:"_onUserBinaryMessageReceived",value:function(e){this._messageStatisticsObserver.recvP2PMessage(e.userId),this.safeEmit(Kd.onUserBinaryMessageReceived,e)}},{key:"_onLiveTranscodingResult",value:function(e){this.safeEmit(Kd.onLiveTranscodingResult,e)}},{key:"_onStreamMixingEvent",value:function(e){this.safeEmit(Kd.onStreamMixingEvent,e)}},{key:"_onUserTokenWillExpire",value:function(){this.safeEmit(Kd.onTokenWillExpire)}},{key:"_onPushPublicStreamResult",value:function(e){this.safeEmit(Kd.onPushPublicStreamResult,e)}},{key:"_handleRTMClient",value:function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Kd.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t._messageStatisticsObserver.recvP2POutRoomMessage(e.userId),t.safeEmit(Kd.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(Kd.onError,{errorCode:lR.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(Kd.onError,{errorCode:lR.RTM_TOKEN_ERROR})})),e.on("onServerParamsSetResult",(function(e){t.safeEmit(Kd.onServerParamsSetResult,null==e?void 0:e.code)}))}},{key:"waitForNewToken",get:function(){return!!this._tempRoomInfo}},{key:"localAudioTrack",get:function(){return this._localAudioTrack}},{key:"localVideoTrack",get:function(){return this._localVideoTrack}},{key:"localScreenAudioTrack",get:function(){return this._localScreenAudioTrack}},{key:"localScreenVideoTrack",get:function(){return this._localScreenVideoTrack}},{key:"remoteStreams",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteStreams&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))})));return r}},{key:"iceState",get:function(){var e,t,r,n;return null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||null===(r=t.handler)||void 0===r||null===(n=r._peerConnection)||void 0===n?void 0:n.iceConnectionState}},{key:"remoteUsers",get:function(){var e,t,r=[];null!==(e=this._room)&&void 0!==e&&e.remoteUsers&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})})));return r}},{key:"multiChatMode",get:function(){var e,t;return!(null===(e=this._room)||void 0===e||null===(t=e._mediaServerClient)||void 0===t||!t.roomAttributes.multiChatMode)}},{key:"_handleAudioDeviceManager",value:function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(Kd.onAudioPlaybackDeviceTestVolume,t)}))}},{key:"_assertNotInRoom",value:function(){if(!this._room||this._room.connectionState!==hB.CONNECTED)throw new pR(lR.NOT_CONNECTED_YET,"server not connected")}},{key:"_checkMediaType",value:function(e){vw(e,"mediaType",[Sd.AUDIO,Sd.VIDEO,Sd.AUDIO_AND_VIDEO])}},{key:"_getUserId",value:function(){var e,t;return(null===(e=this._room)||void 0===e||null===(t=e.roomInfo)||void 0===t?void 0:t.userInfo.userId)||"local_user"}},{key:"_switchTrack",value:(t=m_(Im.mark((function e(t){var r,n;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this._initLocalTrackEvents(t),this._localVideoTrack=t,null!==(r=this._videoPlayer)&&void 0!==r&&r.played&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(t),this._videoPlayer.mirror(!!this._mirrorType)),null===(n=this._room)||void 0===n||!n.hasPublished){e.next=6;break}return e.next=6,this._updatePublish();case 6:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"_shouldUpdateAudioConf",value:function(e){var t,r=(null===(t=this._room)||void 0===t?void 0:t.hasPublished)||this._localAudioTrack&&this._localAudioTrack.sourceType===IV.INTERNAL;if(r){var n="engine.".concat(e," should be called before publishing or capturing.");console.warn("[RTC WebSDK]: "+n),BP(e,n)}return!r}}]),_e}(ex),sd(iX,"GUID",1),iX),lX=dX;cX([VP()],lX.prototype,"updateToken",1),cX([VP()],lX.prototype,"setVideoCaptureDevice",1),cX([VP()],lX.prototype,"setAudioCaptureDevice",1),cX([VP()],lX.prototype,"joinRoom",1),cX([VP()],lX.prototype,"leaveRoom",1),cX([VP()],lX.prototype,"destroy",1),cX([VP()],lX.prototype,"publishStream",1),cX([VP()],lX.prototype,"unpublishStream",1),cX([VP()],lX.prototype,"publishScreen",1),cX([VP()],lX.prototype,"unpublishScreen",1),cX([VP()],lX.prototype,"subscribeStream",1),cX([VP()],lX.prototype,"unsubscribeStream",1),cX([VP()],lX.prototype,"subscribeScreen",1),cX([VP()],lX.prototype,"unsubscribeScreen",1),cX([VP()],lX.prototype,"setRemoteVideoConfig",1),cX([VP()],lX.prototype,"startVideoCapture",1),cX([VP()],lX.prototype,"stopVideoCapture",1),cX([VP()],lX.prototype,"startAudioCapture",1),cX([VP()],lX.prototype,"stopAudioCapture",1),cX([VP()],lX.prototype,"getAudioMixingManager",1),cX([VP()],lX.prototype,"startScreenCapture",1),cX([VP()],lX.prototype,"stopScreenCapture",1),cX([VP()],lX.prototype,"setLocalVideoPlayer",1),cX([VP()],lX.prototype,"startLiveTranscoding",1),cX([VP()],lX.prototype,"updateLiveTranscoding",1),cX([VP()],lX.prototype,"stopLiveTranscoding",1),cX([VP()],lX.prototype,"startSubtitle",1),cX([VP()],lX.prototype,"stopSubtitle",1),cX([VP()],lX.prototype,"setBusinessId",1),cX([VP()],lX.prototype,"setUserVisibility",1),cX([VP()],lX.prototype,"setRemoteVideoPlayer",1),cX([VP()],lX.prototype,"setLocalVideoMirrorType",1),cX([VP()],lX.prototype,"setAudioPlaybackDevice",1),cX([VP()],lX.prototype,"play",1),cX([VP()],lX.prototype,"pauseAllSubscribedStream",1),cX([VP()],lX.prototype,"resumeAllSubscribedStream",1),cX([VP()],lX.prototype,"sendUserMessage",1),cX([VP()],lX.prototype,"sendUserBinaryMessage",1),cX([VP()],lX.prototype,"sendRoomMessage",1),cX([VP()],lX.prototype,"sendRoomBinaryMessage",1),cX([VP()],lX.prototype,"setAudioCaptureConfig",1),cX([iw("4.51"),VP()],lX.prototype,"setVideoCaptureConfig",1),cX([VP()],lX.prototype,"enableSimulcastMode",1),cX([VP()],lX.prototype,"setVideoEncoderConfig",1),cX([VP()],lX.prototype,"setScreenEncoderConfig",1),cX([VP()],lX.prototype,"sendSEIMessage",1),cX([iw("4.42"),VP()],lX.prototype,"setAudioVolumeIndicationInterval",1),cX([VP()],lX.prototype,"enableAudioPropertiesReport",1),cX([VP()],lX.prototype,"setVideoSourceType",1),cX([VP()],lX.prototype,"setExternalVideoTrack",1),cX([VP()],lX.prototype,"setAudioSourceType",1),cX([VP()],lX.prototype,"setExternalAudioTrack",1),cX([VP("rtm")],lX.prototype,"login",1),cX([VP("rtm")],lX.prototype,"logout",1),cX([VP("rtm")],lX.prototype,"updateLoginToken",1),cX([VP("rtm")],lX.prototype,"getPeerOnlineStatus",1),cX([VP("rtm")],lX.prototype,"sendUserMessageOutsideRoom",1),cX([VP("rtm")],lX.prototype,"sendUserBinaryMessageOutsideRoom",1),cX([VP("rtm")],lX.prototype,"setServerParams",1),cX([VP("rtm")],lX.prototype,"sendServerMessage",1),cX([VP("rtm")],lX.prototype,"sendServerBinaryMessage",1),cX([VP()],lX.prototype,"startCloudProxy",1),cX([VP()],lX.prototype,"stopCloudProxy",1),cX([VP()],lX.prototype,"startPushPublicStream",1),cX([VP()],lX.prototype,"updatePublicStreamParam",1),cX([VP()],lX.prototype,"stopPushPublicStream",1),cX([VP("outsideRoom","streamId")],lX.prototype,"startPlayPublicStream",1),cX([VP("outsideRoom","streamId")],lX.prototype,"stopPlayPublicStream",1),cX([VP()],lX.prototype,"setAudioProfile",1),cX([VP("outsideRoom")],lX.prototype,"setPublicStreamVideoPlayer",1),cX([VP()],lX.prototype,"setDummyCaptureImagePath",1),cX([VP()],lX.prototype,"registerExtension",1),cX([VP()],lX.prototype,"startAudioPlaybackDeviceTest",1),cX([VP()],lX.prototype,"stopAudioPlaybackDeviceTest",1),cX([VP()],lX.prototype,"startAudioDeviceRecordTest",1),cX([VP()],lX.prototype,"stopAudioDeviceRecordAndPlayTest",1),cX([VP()],lX.prototype,"stopAudioDevicePlayTest",1),cX([VP()],lX.prototype,"setRemoteUserPriority",1),cX([VP()],lX.prototype,"takeLocalSnapshot",1),cX([VP()],lX.prototype,"takeRemoteSnapshot",1),cX([VP()],lX.prototype,"setSubscribeFallbackOption",1),cX([VP()],lX.prototype,"getLocalStreamTrack",1),cX([VP()],lX.prototype,"getRemoteStreamTrack",1),cX([VP()],lX.prototype,"getPublicStreamTrack",1),cX([VP()],lX.prototype,"setRemoteStreamRenderSync",1);var hX,pX,fX={"client unpublished":Ed.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":Ed.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":Ed.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":Ed.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":Ed.STREAM_REMOVE_REASON_REPUBLISH};function vX(e){var t=YP.getServerConfig(e).web_rtc_config;return null!=t&&t.web_pc_killswitch?null==t?void 0:t.web_pc_killswitch:{}}function _X(e){var t=YP.getServerConfig(e).web_rtc_config;return"boolean"==typeof(null==t?void 0:t.fallback)?!1!==t.fallback&&(!!Array.isArray(null==t?void 0:t.fallback_ua_reg)&&t.fallback_ua_reg.every((function(e){return"string"==typeof e&&new RegExp(e).test(navigator.userAgent)}))):!!rN("ENABLE_FALLBACK_HANDLER")}function mX(e){var t=YP.getServerConfig(e).web_rtc_config;return"boolean"==typeof(null==t?void 0:t.standard)?!1!==t.standard&&(!!Array.isArray(null==t?void 0:t.standard_ua_reg)&&t.standard_ua_reg.every((function(e){return"string"==typeof e&&new RegExp(e).test(navigator.userAgent)}))):!!rN("ENABLE_STANDARD_HANDLER")}var yX=new Jw("VERTC",0);qw.storeKey=xm(hX="".concat(Date.now(),"-")).call(hX,YP.getDeviceId()),[OP,DP,PP].forEach((function(e){var t;return e.setStats({rtc_sdk_version:eN.VERSION,product_line:zD.RTC,report_version:KD.W_5,os:XD.WEB,device_id:YP.getDeviceId(),log_cache_key:qw.storeKey,user_agent:wC()?"":null===(t=navigator)||void 0===t?void 0:t.userAgent})}));var gX=function(e,t){return yX.print("createEngine","Invoke VERTC.createEngine"),fw(e,"appId"),[OP,DP,PP].forEach((function(r){return r.setStats({rtc_app_id:e,auto_play_policy:null==t?void 0:t.autoPlayPolicy})})),CP.sdkInitEngine(Date.now(),yP.BEGIN),new lX(e,t)},SX=function(e){if(yX.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof lX))throw new pR(lR.INVALID_ENGINE,"Invalid engine object");e.destroy(),CP.sdkInitEngine(Date.now(),yP.END)},EX=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gV.enumerateDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),bX=function(){var e=m_(Im.mark((function e(){var t,r,n,i,a,o,s=arguments;return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=s.length>0&&void 0!==s[0]?s[0]:{video:!0,audio:!0},r=t.video,n=t.audio,i={video:!1,audio:!1},!r){e.next=13;break}return e.prev=4,e.next=7,gV.getPermissions({video:!0,force:!0});case 7:a=e.sent,i.video=a.video,e.next=13;break;case 11:e.prev=11,e.t0=e.catch(4);case 13:if(!n){e.next=23;break}return e.prev=14,e.next=17,gV.getPermissions({audio:!0,force:!0});case 17:o=e.sent,i.audio=o.audio,e.next=23;break;case 21:e.prev=21,e.t1=e.catch(14);case 23:return e.abrupt("return",i);case 24:case"end":return e.stop()}}),e,null,[[4,11],[14,21]])})));return function(){return e.apply(this,arguments)}}(),kX=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gV.enumerateAudioCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),TX=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gV.enumerateVideoCaptureDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),IX=function(){var e=m_(Im.mark((function e(){return Im.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",gV.enumerateAudioPlaybackDevices());case 1:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),AX=function(){return eN.VERSION},RX=function(){return CP.rtcSdkApiCall("isSupported",0,""),OL()},CX=function(){return CP.rtcSdkApiCall("getSupportedCodecs",0,""),PL()},wX=function(e){var t=e.logLevel,r=e.LogfileSize;t&&(qw.logLevel=t),r&&(qw.LogfileSize=r)},xX=function(e){qw.download(e)};function OX(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return ny(uy(t).call(t,(function(e){return e instanceof lX?"[ENGINE]":e})))}function DX(e,t){return function(){LP(t,0,OX.apply(void 0,arguments));var r=e.apply(void 0,arguments);return"function"==typeof(null==r?void 0:r.then)?r.then((function(e){return UP(t,0,OX(e)),e})).catch((function(e){throw UP(t,e.code,e.message),e})):(UP(t,0,OX(r)),r)}}return!wC()&&$m(pX=location.search).call(pX,"_rtc_autotest_"),ud(ud(ud(ud({},new(qd((function e(){Wd(this,e),sd(this,"getSdkVersion",DX(AX,"getSdkVersion")),sd(this,"createEngine",DX(gX,"createEngine")),sd(this,"destroyEngine",DX(SX,"destroyEngine")),sd(this,"enumerateDevices",DX(EX,"enumerateDevices")),sd(this,"enableDevices",DX(bX,"enableDevices")),sd(this,"enumerateAudioCaptureDevices",DX(kX,"enumerateAudioCaptureDevices")),sd(this,"enumerateVideoCaptureDevices",DX(TX,"enumerateVideoCaptureDevices")),sd(this,"enumerateAudioPlaybackDevices",DX(IX,"enumerateAudioPlaybackDevices")),sd(this,"getParameter",rN),sd(this,"setParameter",tN),sd(this,"isSupported",DX(RX,"isSupported")),sd(this,"getSupportedCodecs",DX(CX,"getSupportedCodecs")),sd(this,"ConnectionMode",Fd),sd(this,"events",Kd),sd(this,"ErrorCode",lR),sd(this,"platform","BytePlus"),sd(this,"_monitor",CP),sd(this,"_rtmMonitor",wP),sd(this,"downloadLog",DX(xX,"downloadLog")),sd(this,"setLogConfig",DX(wX,"setLogConfig"))})))),Bd),zd),{},{events:Kd})}));