@byteplus/rtc 4.41.1 → 4.42.1

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.esm.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.41.1
4
+ * version: 4.42.1
5
5
  */
6
- 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(e)}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){return e&&e.Math==Math&&e},n=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof t&&t)||function(){return this}()||Function("return this")(),i={},o=function(e){try{return!!e()}catch(e){return!0}},a=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),s=!o((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),c=s,u=Function.prototype.call,d=c?u.bind(u):function(){return u.apply(u,arguments)},l={},h={}.propertyIsEnumerable,p=Object.getOwnPropertyDescriptor,f=p&&!h.call({1:2},1);l.f=f?function(e){var t=p(this,e);return!!t&&t.enumerable}:h;var _,v,m=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},S=s,E=Function.prototype,y=E.bind,g=E.call,b=S&&y.bind(g,g),T=S?function(e){return e&&b(e)}:function(e){return e&&function(){return g.apply(e,arguments)}},I=T,R=I({}.toString),A=I("".slice),C=function(e){return A(R(e),8,-1)},O=T,N=o,w=C,P=n.Object,D=O("".split),k=N((function(){return!P("z").propertyIsEnumerable(0)}))?function(e){return"String"==w(e)?D(e,""):P(e)}:P,M=n.TypeError,U=function(e){if(null==e)throw M("Can't call method on "+e);return e},L=k,x=U,V=function(e){return L(x(e))},F=function(e){return"function"==typeof e},B=F,j=function(e){return"object"==typeof e?null!==e:B(e)},G=n,H=F,z=function(e){return H(e)?e:void 0},K=function(e,t){return arguments.length<2?z(G[e]):G[e]&&G[e][t]},Y=T({}.isPrototypeOf),W=K("navigator","userAgent")||"",X=n,J=W,q=X.process,Z=X.Deno,$=q&&q.versions||Z&&Z.version,Q=$&&$.v8;Q&&(v=(_=Q.split("."))[0]>0&&_[0]<4?1:+(_[0]+_[1])),!v&&J&&(!(_=J.match(/Edge\/(\d+)/))||_[1]>=74)&&(_=J.match(/Chrome\/(\d+)/))&&(v=+_[1]);var ee=v,te=ee,re=o,ne=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&te&&te<41})),ie=ne&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,oe=K,ae=F,se=Y,ce=ie,ue=n.Object,de=ce?function(e){return"symbol"==typeof e}:function(e){var t=oe("Symbol");return ae(t)&&se(t.prototype,ue(e))},le=n.String,he=function(e){try{return le(e)}catch(e){return"Object"}},pe=F,fe=he,_e=n.TypeError,ve=function(e){if(pe(e))return e;throw _e(fe(e)+" is not a function")},me=ve,Se=function(e,t){var r=e[t];return null==r?void 0:me(r)},Ee=d,ye=F,ge=j,be=n.TypeError,Te={exports:{}},Ie=n,Re=Object.defineProperty,Ae=function(e,t){try{Re(Ie,e,{value:t,configurable:!0,writable:!0})}catch(r){Ie[e]=t}return t},Ce=Ae,Oe=n["__core-js_shared__"]||Ce("__core-js_shared__",{}),Ne=Oe;(Te.exports=function(e,t){return Ne[e]||(Ne[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"});var we=U,Pe=n.Object,De=function(e){return Pe(we(e))},ke=De,Me=T({}.hasOwnProperty),Ue=Object.hasOwn||function(e,t){return Me(ke(e),t)},Le=T,xe=0,Ve=Math.random(),Fe=Le(1..toString),Be=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Fe(++xe+Ve,36)},je=n,Ge=Te.exports,He=Ue,ze=Be,Ke=ne,Ye=ie,We=Ge("wks"),Xe=je.Symbol,Je=Xe&&Xe.for,qe=Ye?Xe:Xe&&Xe.withoutSetter||ze,Ze=function(e){if(!He(We,e)||!Ke&&"string"!=typeof We[e]){var t="Symbol."+e;Ke&&He(Xe,e)?We[e]=Xe[e]:We[e]=Ye&&Je?Je(t):qe(t)}return We[e]},$e=d,Qe=j,et=de,tt=Se,rt=function(e,t){var r,n;if("string"===t&&ye(r=e.toString)&&!ge(n=Ee(r,e)))return n;if(ye(r=e.valueOf)&&!ge(n=Ee(r,e)))return n;if("string"!==t&&ye(r=e.toString)&&!ge(n=Ee(r,e)))return n;throw be("Can't convert object to primitive value")},nt=Ze,it=n.TypeError,ot=nt("toPrimitive"),at=function(e,t){if(!Qe(e)||et(e))return e;var r,n=tt(e,ot);if(n){if(void 0===t&&(t="default"),r=$e(n,e,t),!Qe(r)||et(r))return r;throw it("Can't convert object to primitive value")}return void 0===t&&(t="number"),rt(e,t)},st=at,ct=de,ut=function(e){var t=st(e,"string");return ct(t)?t:t+""},dt=j,lt=n.document,ht=dt(lt)&&dt(lt.createElement),pt=function(e){return ht?lt.createElement(e):{}},ft=pt,_t=!a&&!o((function(){return 7!=Object.defineProperty(ft("div"),"a",{get:function(){return 7}}).a})),vt=a,mt=d,St=l,Et=m,yt=V,gt=ut,bt=Ue,Tt=_t,It=Object.getOwnPropertyDescriptor;i.f=vt?It:function(e,t){if(e=yt(e),t=gt(t),Tt)try{return It(e,t)}catch(e){}if(bt(e,t))return Et(!mt(St.f,e,t),e[t])};var Rt={},At=a&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ct=n,Ot=j,Nt=Ct.String,wt=Ct.TypeError,Pt=function(e){if(Ot(e))return e;throw wt(Nt(e)+" is not an object")},Dt=a,kt=_t,Mt=At,Ut=Pt,Lt=ut,xt=n.TypeError,Vt=Object.defineProperty,Ft=Object.getOwnPropertyDescriptor;Rt.f=Dt?Mt?function(e,t,r){if(Ut(e),t=Lt(t),Ut(r),"function"==typeof e&&"prototype"===t&&"value"in r&&"writable"in r&&!r.writable){var n=Ft(e,t);n&&n.writable&&(e[t]=r.value,r={configurable:"configurable"in r?r.configurable:n.configurable,enumerable:"enumerable"in r?r.enumerable:n.enumerable,writable:!1})}return Vt(e,t,r)}:Vt:function(e,t,r){if(Ut(e),t=Lt(t),Ut(r),kt)try{return Vt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw xt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Bt=Rt,jt=m,Gt=a?function(e,t,r){return Bt.f(e,t,jt(1,r))}:function(e,t,r){return e[t]=r,e},Ht={exports:{}},zt=F,Kt=Oe,Yt=T(Function.toString);zt(Kt.inspectSource)||(Kt.inspectSource=function(e){return Yt(e)});var Wt,Xt,Jt,qt=Kt.inspectSource,Zt=F,$t=qt,Qt=n.WeakMap,er=Zt(Qt)&&/native code/.test($t(Qt)),tr=Te.exports,rr=Be,nr=tr("keys"),ir=function(e){return nr[e]||(nr[e]=rr(e))},or={},ar=er,sr=n,cr=T,ur=j,dr=Gt,lr=Ue,hr=Oe,pr=ir,fr=or,_r=sr.TypeError,vr=sr.WeakMap;if(ar||hr.state){var mr=hr.state||(hr.state=new vr),Sr=cr(mr.get),Er=cr(mr.has),yr=cr(mr.set);Wt=function(e,t){if(Er(mr,e))throw new _r("Object already initialized");return t.facade=e,yr(mr,e,t),t},Xt=function(e){return Sr(mr,e)||{}},Jt=function(e){return Er(mr,e)}}else{var gr=pr("state");fr[gr]=!0,Wt=function(e,t){if(lr(e,gr))throw new _r("Object already initialized");return t.facade=e,dr(e,gr,t),t},Xt=function(e){return lr(e,gr)?e[gr]:{}},Jt=function(e){return lr(e,gr)}}var br={set:Wt,get:Xt,has:Jt,enforce:function(e){return Jt(e)?Xt(e):Wt(e,{})},getterFor:function(e){return function(t){var r;if(!ur(t)||(r=Xt(t)).type!==e)throw _r("Incompatible receiver, "+e+" required");return r}}},Tr=a,Ir=Ue,Rr=Function.prototype,Ar=Tr&&Object.getOwnPropertyDescriptor,Cr=Ir(Rr,"name"),Or={EXISTS:Cr,PROPER:Cr&&"something"===function(){}.name,CONFIGURABLE:Cr&&(!Tr||Tr&&Ar(Rr,"name").configurable)},Nr=n,wr=F,Pr=Ue,Dr=Gt,kr=Ae,Mr=qt,Ur=Or.CONFIGURABLE,Lr=br.get,xr=br.enforce,Vr=String(String).split("String");(Ht.exports=function(e,t,r,n){var i,o=!!n&&!!n.unsafe,a=!!n&&!!n.enumerable,s=!!n&&!!n.noTargetGet,c=n&&void 0!==n.name?n.name:t;wr(r)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Pr(r,"name")||Ur&&r.name!==c)&&Dr(r,"name",c),(i=xr(r)).source||(i.source=Vr.join("string"==typeof c?c:""))),e!==Nr?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=r:Dr(e,t,r)):a?e[t]=r:kr(t,r)})(Function.prototype,"toString",(function(){return wr(this)&&Lr(this).source||Mr(this)}));var Fr={},Br=Math.ceil,jr=Math.floor,Gr=function(e){var t=+e;return t!=t||0===t?0:(t>0?jr:Br)(t)},Hr=Gr,zr=Math.max,Kr=Math.min,Yr=function(e,t){var r=Hr(e);return r<0?zr(r+t,0):Kr(r,t)},Wr=Gr,Xr=Math.min,Jr=function(e){return e>0?Xr(Wr(e),9007199254740991):0},qr=Jr,Zr=function(e){return qr(e.length)},$r=V,Qr=Yr,en=Zr,tn=function(e){return function(t,r,n){var i,o=$r(t),a=en(o),s=Qr(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}},rn={includes:tn(!0),indexOf:tn(!1)},nn=Ue,on=V,an=rn.indexOf,sn=or,cn=T([].push),un=function(e,t){var r,n=on(e),i=0,o=[];for(r in n)!nn(sn,r)&&nn(n,r)&&cn(o,r);for(;t.length>i;)nn(n,r=t[i++])&&(~an(o,r)||cn(o,r));return o},dn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],ln=un,hn=dn.concat("length","prototype");Fr.f=Object.getOwnPropertyNames||function(e){return ln(e,hn)};var pn={};pn.f=Object.getOwnPropertySymbols;var fn=K,_n=Fr,vn=pn,mn=Pt,Sn=T([].concat),En=fn("Reflect","ownKeys")||function(e){var t=_n.f(mn(e)),r=vn.f;return r?Sn(t,r(e)):t},yn=Ue,gn=En,bn=i,Tn=Rt,In=function(e,t,r){for(var n=gn(t),i=Tn.f,o=bn.f,a=0;a<n.length;a++){var s=n[a];yn(e,s)||r&&yn(r,s)||i(e,s,o(t,s))}},Rn=o,An=F,Cn=/#|\.prototype\./,On=function(e,t){var r=wn[Nn(e)];return r==Dn||r!=Pn&&(An(t)?Rn(t):!!t)},Nn=On.normalize=function(e){return String(e).replace(Cn,".").toLowerCase()},wn=On.data={},Pn=On.NATIVE="N",Dn=On.POLYFILL="P",kn=On,Mn=n,Un=i.f,Ln=Gt,xn=Ht.exports,Vn=Ae,Fn=In,Bn=kn,jn=function(e,t){var r,n,i,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?Mn:u?Mn[s]||Vn(s,{}):(Mn[s]||{}).prototype)for(n in t){if(o=t[n],i=e.noTargetGet?(a=Un(r,n))&&a.value:r[n],!Bn(c?n:s+(u?".":"#")+n,e.forced)&&void 0!==i){if(typeof o==typeof i)continue;Fn(o,i)}(e.sham||i&&i.sham)&&Ln(o,"sham",!0),xn(r,n,o,e)}},Gn=ve,Hn=s,zn=T(T.bind),Kn=function(e,t){return Gn(e),void 0===t?e:Hn?zn(e,t):function(){return e.apply(t,arguments)}},Yn=C,Wn=Array.isArray||function(e){return"Array"==Yn(e)},Xn={};Xn[Ze("toStringTag")]="z";var Jn="[object z]"===String(Xn),qn=n,Zn=Jn,$n=F,Qn=C,ei=Ze("toStringTag"),ti=qn.Object,ri="Arguments"==Qn(function(){return arguments}()),ni=Zn?Qn:function(e){var t,r,n;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=ti(e),ei))?r:ri?Qn(t):"Object"==(n=Qn(t))&&$n(t.callee)?"Arguments":n},ii=T,oi=o,ai=F,si=ni,ci=qt,ui=function(){},di=[],li=K("Reflect","construct"),hi=/^\s*(?:class|function)\b/,pi=ii(hi.exec),fi=!hi.exec(ui),_i=function(e){if(!ai(e))return!1;try{return li(ui,di,e),!0}catch(e){return!1}},vi=function(e){if(!ai(e))return!1;switch(si(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return fi||!!pi(hi,ci(e))}catch(e){return!0}};vi.sham=!0;var mi=!li||oi((function(){var e;return _i(_i.call)||!_i(Object)||!_i((function(){e=!0}))||e}))?vi:_i,Si=n,Ei=Wn,yi=mi,gi=j,bi=Ze("species"),Ti=Si.Array,Ii=function(e){var t;return Ei(e)&&(t=e.constructor,(yi(t)&&(t===Ti||Ei(t.prototype))||gi(t)&&null===(t=t[bi]))&&(t=void 0)),void 0===t?Ti:t},Ri=function(e,t){return new(Ii(e))(0===t?0:t)},Ai=Kn,Ci=k,Oi=De,Ni=Zr,wi=Ri,Pi=T([].push),Di=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=Oi(c),_=Ci(f),v=Ai(u,d),m=Ni(_),S=0,E=l||wi,y=t?E(c,m):r||a?E(c,0):void 0;m>S;S++)if((s||S in _)&&(p=v(h=_[S],S,f),e))if(t)y[S]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return S;case 2:Pi(y,h)}else switch(e){case 4:return!1;case 7:Pi(y,h)}return o?-1:n||i?i:y}},ki={forEach:Di(0),map:Di(1),filter:Di(2),some:Di(3),every:Di(4),find:Di(5),findIndex:Di(6),filterReject:Di(7)},Mi=o,Ui=function(e,t){var r=[][e];return!!r&&Mi((function(){r.call(null,t||function(){throw 1},1)}))},Li=ki.forEach,xi=Ui("forEach")?[].forEach:function(e){return Li(this,e,arguments.length>1?arguments[1]:void 0)};jn({target:"Array",proto:!0,forced:[].forEach!=xi},{forEach:xi});var Vi=ni,Fi=Jn?{}.toString:function(){return"[object "+Vi(this)+"]"},Bi=Jn,ji=Ht.exports,Gi=Fi;Bi||ji(Object.prototype,"toString",Gi,{unsafe:!0});var Hi={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},zi=pt("span").classList,Ki=zi&&zi.constructor&&zi.constructor.prototype,Yi=Ki===Object.prototype?void 0:Ki,Wi=n,Xi=Hi,Ji=Yi,qi=xi,Zi=Gt,$i=function(e){if(e&&e.forEach!==qi)try{Zi(e,"forEach",qi)}catch(t){e.forEach=qi}};for(var Qi in Xi)Xi[Qi]&&$i(Wi[Qi]&&Wi[Qi].prototype);$i(Ji);var eo=jn,to=T,ro=n.Date,no=to(ro.prototype.getTime);eo({target:"Date",stat:!0},{now:function(){return no(new ro)}});var io=T,oo=Ht.exports,ao=Date.prototype,so=io(ao.toString),co=io(ao.getTime);"Invalid Date"!=String(new Date(NaN))&&oo(ao,"toString",(function(){var e=co(this);return e==e?so(this):"Invalid Date"}));var uo={},lo=un,ho=dn,po=Object.keys||function(e){return lo(e,ho)},fo=a,_o=At,vo=Rt,mo=Pt,So=V,Eo=po;uo.f=fo&&!_o?Object.defineProperties:function(e,t){mo(e);for(var r,n=So(t),i=Eo(t),o=i.length,a=0;o>a;)vo.f(e,r=i[a++],n[r]);return e};var yo,go=K("document","documentElement"),bo=Pt,To=uo,Io=dn,Ro=or,Ao=go,Co=pt,Oo=ir("IE_PROTO"),No=function(){},wo=function(e){return"<script>"+e+"<\/script>"},Po=function(e){e.write(wo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Do=function(){try{yo=new ActiveXObject("htmlfile")}catch(e){}var e,t;Do="undefined"!=typeof document?document.domain&&yo?Po(yo):((t=Co("iframe")).style.display="none",Ao.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(wo("document.F=Object")),e.close(),e.F):Po(yo);for(var r=Io.length;r--;)delete Do.prototype[Io[r]];return Do()};Ro[Oo]=!0;var ko=Object.create||function(e,t){var r;return null!==e?(No.prototype=bo(e),r=new No,No.prototype=null,r[Oo]=e):r=Do(),void 0===t?r:To.f(r,t)},Mo=ko,Uo=Rt,Lo=Ze("unscopables"),xo=Array.prototype;null==xo[Lo]&&Uo.f(xo,Lo,{configurable:!0,value:Mo(null)});var Vo=function(e){xo[Lo][e]=!0},Fo=rn.includes,Bo=Vo;jn({target:"Array",proto:!0},{includes:function(e){return Fo(this,e,arguments.length>1?arguments[1]:void 0)}}),Bo("includes");var jo=j,Go=C,Ho=Ze("match"),zo=function(e){var t;return jo(e)&&(void 0!==(t=e[Ho])?!!t:"RegExp"==Go(e))},Ko=zo,Yo=n.TypeError,Wo=function(e){if(Ko(e))throw Yo("The method doesn't accept regular expressions");return e},Xo=ni,Jo=n.String,qo=function(e){if("Symbol"===Xo(e))throw TypeError("Cannot convert a Symbol value to a string");return Jo(e)},Zo=Ze("match"),$o=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Zo]=!1,"/./"[e](t)}catch(e){}}return!1},Qo=jn,ea=Wo,ta=U,ra=qo,na=$o,ia=T("".indexOf);Qo({target:"String",proto:!0,forced:!na("includes")},{includes:function(e){return!!~ia(ra(ta(this)),ra(ea(e)),arguments.length>1?arguments[1]:void 0)}});var oa=Pt,aa=function(){var e=oa(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},sa=o,ca=n.RegExp,ua=sa((function(){var e=ca("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),da=ua||sa((function(){return!ca("a","y").sticky})),la={BROKEN_CARET:ua||sa((function(){var e=ca("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:da,UNSUPPORTED_Y:ua},ha=o,pa=n.RegExp,fa=ha((function(){var e=pa(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),_a=o,va=n.RegExp,ma=_a((function(){var e=va("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Sa=d,Ea=T,ya=qo,ga=aa,ba=la,Ta=Te.exports,Ia=ko,Ra=br.get,Aa=fa,Ca=ma,Oa=Ta("native-string-replace",String.prototype.replace),Na=RegExp.prototype.exec,wa=Na,Pa=Ea("".charAt),Da=Ea("".indexOf),ka=Ea("".replace),Ma=Ea("".slice),Ua=function(){var e=/a/,t=/b*/g;return Sa(Na,e,"a"),Sa(Na,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),La=ba.BROKEN_CARET,xa=void 0!==/()??/.exec("")[1];(Ua||xa||La||Aa||Ca)&&(wa=function(e){var t,r,n,i,o,a,s,c=this,u=Ra(c),d=ya(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=Sa(wa,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=La&&c.sticky,f=Sa(ga,c),_=c.source,v=0,m=d;if(p&&(f=ka(f,"y",""),-1===Da(f,"g")&&(f+="g"),m=Ma(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Pa(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",f)),xa&&(r=new RegExp("^"+_+"$(?!\\s)",f)),Ua&&(n=c.lastIndex),i=Sa(Na,p?r:c,m),p?i?(i.input=Ma(i.input,v),i[0]=Ma(i[0],v),i.index=c.lastIndex,c.lastIndex+=i[0].length):c.lastIndex=0:Ua&&i&&(c.lastIndex=c.global?i.index+i[0].length:n),xa&&i&&i.length>1&&Sa(Oa,i[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(i[o]=void 0)})),i&&h)for(i.groups=a=Ia(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=i[s[1]];return i});var Va=wa;jn({target:"RegExp",proto:!0,forced:/./.exec!==Va},{exec:Va});var Fa=T,Ba=Ht.exports,ja=Va,Ga=o,Ha=Ze,za=Gt,Ka=Ha("species"),Ya=RegExp.prototype,Wa=function(e,t,r,n){var i=Ha(e),o=!Ga((function(){var t={};return t[i]=function(){return 7},7!=""[e](t)})),a=o&&!Ga((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Ka]=function(){return r},r.flags="",r[i]=/./[i]),r.exec=function(){return t=!0,null},r[i](""),!t}));if(!o||!a||r){var s=Fa(/./[i]),c=t(i,""[e],(function(e,t,r,n,i){var a=Fa(e),c=t.exec;return c===ja||c===Ya.exec?o&&!i?{done:!0,value:s(t,r,n)}:{done:!0,value:a(r,t,n)}:{done:!1}}));Ba(String.prototype,e,c[0]),Ba(Ya,i,c[1])}n&&za(Ya[i],"sham",!0)},Xa=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Ja=d,qa=Pt,Za=F,$a=C,Qa=Va,es=n.TypeError,ts=function(e,t){var r=e.exec;if(Za(r)){var n=Ja(r,e,t);return null!==n&&qa(n),n}if("RegExp"===$a(e))return Ja(Qa,e,t);throw es("RegExp#exec called on incompatible receiver")},rs=d,ns=Pt,is=U,os=Xa,as=qo,ss=Se,cs=ts;function us(e){return us="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},us(e)}Wa("search",(function(e,t,r){return[function(t){var r=is(this),n=null==t?void 0:ss(t,e);return n?rs(n,t,r):new RegExp(t)[e](as(r))},function(e){var n=ns(this),i=as(e),o=r(t,n,i);if(o.done)return o.value;var a=n.lastIndex;os(a,0)||(n.lastIndex=0);var s=cs(n,i);return os(n.lastIndex,a)||(n.lastIndex=a),null===s?-1:s.index}]}));var ds=n,ls=F,hs=ds.String,ps=ds.TypeError,fs=T,_s=Pt,vs=function(e){if("object"==typeof e||ls(e))return e;throw ps("Can't set "+hs(e)+" as a prototype")},ms=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=fs(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,n){return _s(r),vs(n),t?e(r,n):r.__proto__=n,r}}():void 0);jn({target:"Object",stat:!0},{setPrototypeOf:ms}),jn({target:"Object",stat:!0,sham:!a},{create:ko});var Ss=a,Es=T,ys=d,gs=o,bs=po,Ts=pn,Is=l,Rs=De,As=k,Cs=Object.assign,Os=Object.defineProperty,Ns=Es([].concat),ws=!Cs||gs((function(){if(Ss&&1!==Cs({b:1},Cs(Os({},"a",{enumerable:!0,get:function(){Os(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!=Cs({},e)[r]||bs(Cs({},t)).join("")!=n}))?function(e,t){for(var r=Rs(e),n=arguments.length,i=1,o=Ts.f,a=Is.f;n>i;)for(var s,c=As(arguments[i++]),u=o?Ns(bs(c),o(c)):bs(c),d=u.length,l=0;d>l;)s=u[l++],Ss&&!ys(a,c,s)||(r[s]=c[s]);return r}:Cs,Ps=ws;jn({target:"Object",stat:!0,forced:Object.assign!==Ps},{assign:Ps});var Ds=jn,ks=rn.indexOf,Ms=Ui,Us=T([].indexOf),Ls=!!Us&&1/Us([1],1,-0)<0,xs=Ms("indexOf");Ds({target:"Array",proto:!0,forced:Ls||!xs},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Ls?Us(this,e,t)||0:ks(this,e,t)}});var Vs=s,Fs=Function.prototype,Bs=Fs.apply,js=Fs.call,Gs="object"==typeof Reflect&&Reflect.apply||(Vs?js.bind(Bs):function(){return js.apply(Bs,arguments)}),Hs={},zs=ut,Ks=Rt,Ys=m,Ws=function(e,t,r){var n=zs(t);n in e?Ks.f(e,n,Ys(0,r)):e[n]=r},Xs=Yr,Js=Zr,qs=Ws,Zs=n.Array,$s=Math.max,Qs=function(e,t,r){for(var n=Js(e),i=Xs(t,n),o=Xs(void 0===r?n:r,n),a=Zs($s(o-i,0)),s=0;i<o;i++,s++)qs(a,s,e[i]);return a.length=s,a},ec=C,tc=V,rc=Fr.f,nc=Qs,ic="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Hs.f=function(e){return ic&&"Window"==ec(e)?function(e){try{return rc(e)}catch(e){return nc(ic)}}(e):rc(tc(e))};var oc=T([].slice),ac={},sc=Ze;ac.f=sc;var cc=n,uc=Ue,dc=ac,lc=Rt.f,hc=function(e){var t=cc.Symbol||(cc.Symbol={});uc(t,e)||lc(t,e,{value:dc.f(e)})},pc=Rt.f,fc=Ue,_c=Ze("toStringTag"),vc=function(e,t,r){e&&!r&&(e=e.prototype),e&&!fc(e,_c)&&pc(e,_c,{configurable:!0,value:t})},mc=jn,Sc=n,Ec=K,yc=Gs,gc=d,bc=T,Tc=a,Ic=ne,Rc=o,Ac=Ue,Cc=Wn,Oc=F,Nc=j,wc=Y,Pc=de,Dc=Pt,kc=De,Mc=V,Uc=ut,Lc=qo,xc=m,Vc=ko,Fc=po,Bc=Fr,jc=Hs,Gc=pn,Hc=i,zc=Rt,Kc=uo,Yc=l,Wc=oc,Xc=Ht.exports,Jc=Te.exports,qc=or,Zc=Be,$c=Ze,Qc=ac,eu=hc,tu=vc,ru=br,nu=ki.forEach,iu=ir("hidden"),ou=$c("toPrimitive"),au=ru.set,su=ru.getterFor("Symbol"),cu=Object.prototype,uu=Sc.Symbol,du=uu&&uu.prototype,lu=Sc.TypeError,hu=Sc.QObject,pu=Ec("JSON","stringify"),fu=Hc.f,_u=zc.f,vu=jc.f,mu=Yc.f,Su=bc([].push),Eu=Jc("symbols"),yu=Jc("op-symbols"),gu=Jc("string-to-symbol-registry"),bu=Jc("symbol-to-string-registry"),Tu=Jc("wks"),Iu=!hu||!hu.prototype||!hu.prototype.findChild,Ru=Tc&&Rc((function(){return 7!=Vc(_u({},"a",{get:function(){return _u(this,"a",{value:7}).a}})).a}))?function(e,t,r){var n=fu(cu,t);n&&delete cu[t],_u(e,t,r),n&&e!==cu&&_u(cu,t,n)}:_u,Au=function(e,t){var r=Eu[e]=Vc(du);return au(r,{type:"Symbol",tag:e,description:t}),Tc||(r.description=t),r},Cu=function(e,t,r){e===cu&&Cu(yu,t,r),Dc(e);var n=Uc(t);return Dc(r),Ac(Eu,n)?(r.enumerable?(Ac(e,iu)&&e[iu][n]&&(e[iu][n]=!1),r=Vc(r,{enumerable:xc(0,!1)})):(Ac(e,iu)||_u(e,iu,xc(1,{})),e[iu][n]=!0),Ru(e,n,r)):_u(e,n,r)},Ou=function(e,t){Dc(e);var r=Mc(t),n=Fc(r).concat(Du(r));return nu(n,(function(t){Tc&&!gc(Nu,r,t)||Cu(e,t,r[t])})),e},Nu=function(e){var t=Uc(e),r=gc(mu,this,t);return!(this===cu&&Ac(Eu,t)&&!Ac(yu,t))&&(!(r||!Ac(this,t)||!Ac(Eu,t)||Ac(this,iu)&&this[iu][t])||r)},wu=function(e,t){var r=Mc(e),n=Uc(t);if(r!==cu||!Ac(Eu,n)||Ac(yu,n)){var i=fu(r,n);return!i||!Ac(Eu,n)||Ac(r,iu)&&r[iu][n]||(i.enumerable=!0),i}},Pu=function(e){var t=vu(Mc(e)),r=[];return nu(t,(function(e){Ac(Eu,e)||Ac(qc,e)||Su(r,e)})),r},Du=function(e){var t=e===cu,r=vu(t?yu:Mc(e)),n=[];return nu(r,(function(e){!Ac(Eu,e)||t&&!Ac(cu,e)||Su(n,Eu[e])})),n};(Ic||(Xc(du=(uu=function(){if(wc(du,this))throw lu("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Lc(arguments[0]):void 0,t=Zc(e),r=function(e){this===cu&&gc(r,yu,e),Ac(this,iu)&&Ac(this[iu],t)&&(this[iu][t]=!1),Ru(this,t,xc(1,e))};return Tc&&Iu&&Ru(cu,t,{configurable:!0,set:r}),Au(t,e)}).prototype,"toString",(function(){return su(this).tag})),Xc(uu,"withoutSetter",(function(e){return Au(Zc(e),e)})),Yc.f=Nu,zc.f=Cu,Kc.f=Ou,Hc.f=wu,Bc.f=jc.f=Pu,Gc.f=Du,Qc.f=function(e){return Au($c(e),e)},Tc&&(_u(du,"description",{configurable:!0,get:function(){return su(this).description}}),Xc(cu,"propertyIsEnumerable",Nu,{unsafe:!0}))),mc({global:!0,wrap:!0,forced:!Ic,sham:!Ic},{Symbol:uu}),nu(Fc(Tu),(function(e){eu(e)})),mc({target:"Symbol",stat:!0,forced:!Ic},{for:function(e){var t=Lc(e);if(Ac(gu,t))return gu[t];var r=uu(t);return gu[t]=r,bu[r]=t,r},keyFor:function(e){if(!Pc(e))throw lu(e+" is not a symbol");if(Ac(bu,e))return bu[e]},useSetter:function(){Iu=!0},useSimple:function(){Iu=!1}}),mc({target:"Object",stat:!0,forced:!Ic,sham:!Tc},{create:function(e,t){return void 0===t?Vc(e):Ou(Vc(e),t)},defineProperty:Cu,defineProperties:Ou,getOwnPropertyDescriptor:wu}),mc({target:"Object",stat:!0,forced:!Ic},{getOwnPropertyNames:Pu,getOwnPropertySymbols:Du}),mc({target:"Object",stat:!0,forced:Rc((function(){Gc.f(1)}))},{getOwnPropertySymbols:function(e){return Gc.f(kc(e))}}),pu)&&mc({target:"JSON",stat:!0,forced:!Ic||Rc((function(){var e=uu();return"[null]"!=pu([e])||"{}"!=pu({a:e})||"{}"!=pu(Object(e))}))},{stringify:function(e,t,r){var n=Wc(arguments),i=t;if((Nc(t)||void 0!==e)&&!Pc(e))return Cc(t)||(t=function(e,t){if(Oc(i)&&(t=gc(i,this,e,t)),!Pc(t))return t}),n[1]=t,yc(pu,null,n)}});if(!du[ou]){var ku=du.valueOf;Xc(du,ou,(function(e){return gc(ku,this)}))}tu(uu,"Symbol"),qc[iu]=!0;var Mu=jn,Uu=o,Lu=V,xu=i.f,Vu=a,Fu=Uu((function(){xu(1)}));Mu({target:"Object",stat:!0,forced:!Vu||Fu,sham:!Vu},{getOwnPropertyDescriptor:function(e,t){return xu(Lu(e),t)}});var Bu=jn,ju=a,Gu=Rt.f;Bu({target:"Object",stat:!0,forced:Object.defineProperty!==Gu,sham:!ju},{defineProperty:Gu});var Hu=n.Promise,zu=Ht.exports,Ku=function(e,t,r){for(var n in t)zu(e,n,t[n],r);return e},Yu=K,Wu=Rt,Xu=a,Ju=Ze("species"),qu=function(e){var t=Yu(e),r=Wu.f;Xu&&t&&!t[Ju]&&r(t,Ju,{configurable:!0,get:function(){return this}})},Zu=Y,$u=n.TypeError,Qu=function(e,t){if(Zu(t,e))return e;throw $u("Incorrect invocation")},ed={},td=ed,rd=Ze("iterator"),nd=Array.prototype,id=function(e){return void 0!==e&&(td.Array===e||nd[rd]===e)},od=ni,ad=Se,sd=ed,cd=Ze("iterator"),ud=function(e){if(null!=e)return ad(e,cd)||ad(e,"@@iterator")||sd[od(e)]},dd=d,ld=ve,hd=Pt,pd=he,fd=ud,_d=n.TypeError,vd=function(e,t){var r=arguments.length<2?fd(e):t;if(ld(r))return hd(dd(r,e));throw _d(pd(e)+" is not iterable")},md=d,Sd=Pt,Ed=Se,yd=function(e,t,r){var n,i;Sd(e);try{if(!(n=Ed(e,"return"))){if("throw"===t)throw r;return r}n=md(n,e)}catch(e){i=!0,n=e}if("throw"===t)throw r;if(i)throw n;return Sd(n),r},gd=Kn,bd=d,Td=Pt,Id=he,Rd=id,Ad=Zr,Cd=Y,Od=vd,Nd=ud,wd=yd,Pd=n.TypeError,Dd=function(e,t){this.stopped=e,this.result=t},kd=Dd.prototype,Md=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_ITERATOR),p=!(!r||!r.INTERRUPTED),f=gd(t,d),_=function(e){return n&&wd(n,"normal",e),new Dd(!0,e)},v=function(e){return l?(Td(e),p?f(e[0],e[1],_):f(e[0],e[1])):p?f(e,_):f(e)};if(h)n=e;else{if(!(i=Nd(e)))throw Pd(Id(e)+" is not iterable");if(Rd(i)){for(o=0,a=Ad(e);a>o;o++)if((s=v(e[o]))&&Cd(kd,s))return s;return new Dd(!1)}n=Od(e,i)}for(c=n.next;!(u=bd(c,n)).done;){try{s=v(u.value)}catch(e){wd(n,"throw",e)}if("object"==typeof s&&s&&Cd(kd,s))return s}return new Dd(!1)},Ud=Ze("iterator"),Ld=!1;try{var xd=0,Vd={next:function(){return{done:!!xd++}},return:function(){Ld=!0}};Vd[Ud]=function(){return this},Array.from(Vd,(function(){throw 2}))}catch(e){}var Fd,Bd,jd,Gd,Hd=function(e,t){if(!t&&!Ld)return!1;var r=!1;try{var n={};n[Ud]=function(){return{next:function(){return{done:r=!0}}}},e(n)}catch(e){}return r},zd=mi,Kd=he,Yd=n.TypeError,Wd=function(e){if(zd(e))return e;throw Yd(Kd(e)+" is not a constructor")},Xd=Pt,Jd=Wd,qd=Ze("species"),Zd=function(e,t){var r,n=Xd(e).constructor;return void 0===n||null==(r=Xd(n)[qd])?t:Jd(r)},$d=n.TypeError,Qd=function(e,t){if(e<t)throw $d("Not enough arguments");return e},el=/(?:ipad|iphone|ipod).*applewebkit/i.test(W),tl="process"==C(n.process),rl=n,nl=Gs,il=Kn,ol=F,al=Ue,sl=o,cl=go,ul=oc,dl=pt,ll=Qd,hl=el,pl=tl,fl=rl.setImmediate,_l=rl.clearImmediate,vl=rl.process,ml=rl.Dispatch,Sl=rl.Function,El=rl.MessageChannel,yl=rl.String,gl=0,bl={};try{Fd=rl.location}catch(e){}var Tl=function(e){if(al(bl,e)){var t=bl[e];delete bl[e],t()}},Il=function(e){return function(){Tl(e)}},Rl=function(e){Tl(e.data)},Al=function(e){rl.postMessage(yl(e),Fd.protocol+"//"+Fd.host)};fl&&_l||(fl=function(e){ll(arguments.length,1);var t=ol(e)?e:Sl(e),r=ul(arguments,1);return bl[++gl]=function(){nl(t,void 0,r)},Bd(gl),gl},_l=function(e){delete bl[e]},pl?Bd=function(e){vl.nextTick(Il(e))}:ml&&ml.now?Bd=function(e){ml.now(Il(e))}:El&&!hl?(Gd=(jd=new El).port2,jd.port1.onmessage=Rl,Bd=il(Gd.postMessage,Gd)):rl.addEventListener&&ol(rl.postMessage)&&!rl.importScripts&&Fd&&"file:"!==Fd.protocol&&!sl(Al)?(Bd=Al,rl.addEventListener("message",Rl,!1)):Bd="onreadystatechange"in dl("script")?function(e){cl.appendChild(dl("script")).onreadystatechange=function(){cl.removeChild(this),Tl(e)}}:function(e){setTimeout(Il(e),0)});var Cl,Ol,Nl,wl,Pl,Dl,kl,Ml,Ul={set:fl,clear:_l},Ll=n,xl=/ipad|iphone|ipod/i.test(W)&&void 0!==Ll.Pebble,Vl=/web0s(?!.*chrome)/i.test(W),Fl=n,Bl=Kn,jl=i.f,Gl=Ul.set,Hl=el,zl=xl,Kl=Vl,Yl=tl,Wl=Fl.MutationObserver||Fl.WebKitMutationObserver,Xl=Fl.document,Jl=Fl.process,ql=Fl.Promise,Zl=jl(Fl,"queueMicrotask"),$l=Zl&&Zl.value;$l||(Cl=function(){var e,t;for(Yl&&(e=Jl.domain)&&e.exit();Ol;){t=Ol.fn,Ol=Ol.next;try{t()}catch(e){throw Ol?wl():Nl=void 0,e}}Nl=void 0,e&&e.enter()},Hl||Yl||Kl||!Wl||!Xl?!zl&&ql&&ql.resolve?((kl=ql.resolve(void 0)).constructor=ql,Ml=Bl(kl.then,kl),wl=function(){Ml(Cl)}):Yl?wl=function(){Jl.nextTick(Cl)}:(Gl=Bl(Gl,Fl),wl=function(){Gl(Cl)}):(Pl=!0,Dl=Xl.createTextNode(""),new Wl(Cl).observe(Dl,{characterData:!0}),wl=function(){Dl.data=Pl=!Pl}));var Ql=$l||function(e){var t={fn:e,next:void 0};Nl&&(Nl.next=t),Ol||(Ol=t,wl()),Nl=t},eh={},th=ve,rh=function(e){var t,r;this.promise=new e((function(e,n){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=n})),this.resolve=th(t),this.reject=th(r)};eh.f=function(e){return new rh(e)};var nh=Pt,ih=j,oh=eh,ah=function(e,t){if(nh(e),ih(t)&&t.constructor===e)return t;var r=oh.f(e);return(0,r.resolve)(t),r.promise},sh=n,ch=function(){this.head=null,this.tail=null};ch.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 uh,dh,lh,hh,ph=ch,fh="object"==typeof window,_h=jn,vh=n,mh=K,Sh=d,Eh=Hu,yh=Ht.exports,gh=Ku,bh=ms,Th=vc,Ih=qu,Rh=ve,Ah=F,Ch=j,Oh=Qu,Nh=qt,wh=Md,Ph=Hd,Dh=Zd,kh=Ul.set,Mh=Ql,Uh=ah,Lh=function(e,t){var r=sh.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},xh=eh,Vh=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Fh=ph,Bh=br,jh=kn,Gh=fh,Hh=tl,zh=ee,Kh=Ze("species"),Yh="Promise",Wh=Bh.getterFor(Yh),Xh=Bh.set,Jh=Bh.getterFor(Yh),qh=Eh&&Eh.prototype,Zh=Eh,$h=qh,Qh=vh.TypeError,ep=vh.document,tp=vh.process,rp=xh.f,np=rp,ip=!!(ep&&ep.createEvent&&vh.dispatchEvent),op=Ah(vh.PromiseRejectionEvent),ap=!1,sp=jh(Yh,(function(){var e=Nh(Zh),t=e!==String(Zh);if(!t&&66===zh)return!0;if(zh>=51&&/native code/.test(e))return!1;var r=new Zh((function(e){e(1)})),n=function(e){e((function(){}),(function(){}))};return(r.constructor={})[Kh]=n,!(ap=r.then((function(){}))instanceof n)||!t&&Gh&&!op})),cp=sp||!Ph((function(e){Zh.all(e).catch((function(){}))})),up=function(e){var t;return!(!Ch(e)||!Ah(t=e.then))&&t},dp=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&&_p(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),i=!0)),r===e.promise?u(Qh("Promise-chain cycle")):(n=up(r))?Sh(n,r,c,u):c(r)):u(o)}catch(e){d&&!i&&d.exit(),u(e)}},lp=function(e,t){e.notified||(e.notified=!0,Mh((function(){for(var r,n=e.reactions;r=n.get();)dp(r,e);e.notified=!1,t&&!e.rejection&&pp(e)})))},hp=function(e,t,r){var n,i;ip?((n=ep.createEvent("Event")).promise=t,n.reason=r,n.initEvent(e,!1,!0),vh.dispatchEvent(n)):n={promise:t,reason:r},!op&&(i=vh["on"+e])?i(n):"unhandledrejection"===e&&Lh("Unhandled promise rejection",r)},pp=function(e){Sh(kh,vh,(function(){var t,r=e.facade,n=e.value;if(fp(e)&&(t=Vh((function(){Hh?tp.emit("unhandledRejection",n,r):hp("unhandledrejection",r,n)})),e.rejection=Hh||fp(e)?2:1,t.error))throw t.value}))},fp=function(e){return 1!==e.rejection&&!e.parent},_p=function(e){Sh(kh,vh,(function(){var t=e.facade;Hh?tp.emit("rejectionHandled",t):hp("rejectionhandled",t,e.value)}))},vp=function(e,t,r){return function(n){e(t,n,r)}},mp=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,lp(e,!0))},Sp=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Qh("Promise can't be resolved itself");var n=up(t);n?Mh((function(){var r={done:!1};try{Sh(n,t,vp(Sp,r,e),vp(mp,r,e))}catch(t){mp(r,t,e)}})):(e.value=t,e.state=1,lp(e,!1))}catch(t){mp({done:!1},t,e)}}};if(sp&&($h=(Zh=function(e){Oh(this,$h),Rh(e),Sh(uh,this);var t=Wh(this);try{e(vp(Sp,t),vp(mp,t))}catch(e){mp(t,e)}}).prototype,(uh=function(e){Xh(this,{type:Yh,done:!1,notified:!1,parent:!1,reactions:new Fh,rejection:!1,state:0,value:void 0})}).prototype=gh($h,{then:function(e,t){var r=Jh(this),n=rp(Dh(this,Zh));return r.parent=!0,n.ok=!Ah(e)||e,n.fail=Ah(t)&&t,n.domain=Hh?tp.domain:void 0,0==r.state?r.reactions.add(n):Mh((function(){dp(n,r)})),n.promise},catch:function(e){return this.then(void 0,e)}}),dh=function(){var e=new uh,t=Wh(e);this.promise=e,this.resolve=vp(Sp,t),this.reject=vp(mp,t)},xh.f=rp=function(e){return e===Zh||e===lh?new dh(e):np(e)},Ah(Eh)&&qh!==Object.prototype)){hh=qh.then,ap||(yh(qh,"then",(function(e,t){var r=this;return new Zh((function(e,t){Sh(hh,r,e,t)})).then(e,t)}),{unsafe:!0}),yh(qh,"catch",$h.catch,{unsafe:!0}));try{delete qh.constructor}catch(e){}bh&&bh(qh,$h)}_h({global:!0,wrap:!0,forced:sp},{Promise:Zh}),Th(Zh,Yh,!1),Ih(Yh),lh=mh(Yh),_h({target:Yh,stat:!0,forced:sp},{reject:function(e){var t=rp(this);return Sh(t.reject,void 0,e),t.promise}}),_h({target:Yh,stat:!0,forced:sp},{resolve:function(e){return Uh(this,e)}}),_h({target:Yh,stat:!0,forced:cp},{all:function(e){var t=this,r=rp(t),n=r.resolve,i=r.reject,o=Vh((function(){var r=Rh(t.resolve),o=[],a=0,s=1;wh(e,(function(e){var c=a++,u=!1;s++,Sh(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},race:function(e){var t=this,r=rp(t),n=r.reject,i=Vh((function(){var i=Rh(t.resolve);wh(e,(function(e){Sh(i,t,e).then(r.resolve,n)}))}));return i.error&&n(i.value),r.promise}});var Ep=jn,yp=a,gp=n,bp=T,Tp=Ue,Ip=F,Rp=Y,Ap=qo,Cp=Rt.f,Op=In,Np=gp.Symbol,wp=Np&&Np.prototype;if(yp&&Ip(Np)&&(!("description"in wp)||void 0!==Np().description)){var Pp={},Dp=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:Ap(arguments[0]),t=Rp(wp,this)?new Np(e):void 0===e?Np():Np(e);return""===e&&(Pp[t]=!0),t};Op(Dp,Np),Dp.prototype=wp,wp.constructor=Dp;var kp="Symbol(test)"==String(Np("test")),Mp=bp(wp.toString),Up=bp(wp.valueOf),Lp=/^Symbol\((.*)\)[^)]+$/,xp=bp("".replace),Vp=bp("".slice);Cp(wp,"description",{configurable:!0,get:function(){var e=Up(this),t=Mp(e);if(Tp(Pp,e))return"";var r=kp?Vp(t,7,-1):xp(t,Lp,"$1");return""===r?void 0:r}}),Ep({global:!0,forced:!0},{Symbol:Dp})}hc("iterator");var Fp,Bp,jp,Gp=!o((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Hp=n,zp=Ue,Kp=F,Yp=De,Wp=Gp,Xp=ir("IE_PROTO"),Jp=Hp.Object,qp=Jp.prototype,Zp=Wp?Jp.getPrototypeOf:function(e){var t=Yp(e);if(zp(t,Xp))return t[Xp];var r=t.constructor;return Kp(r)&&t instanceof r?r.prototype:t instanceof Jp?qp:null},$p=o,Qp=F,ef=Zp,tf=Ht.exports,rf=Ze("iterator"),nf=!1;[].keys&&("next"in(jp=[].keys())?(Bp=ef(ef(jp)))!==Object.prototype&&(Fp=Bp):nf=!0);var of=null==Fp||$p((function(){var e={};return Fp[rf].call(e)!==e}));of&&(Fp={}),Qp(Fp[rf])||tf(Fp,rf,(function(){return this}));var af={IteratorPrototype:Fp,BUGGY_SAFARI_ITERATORS:nf},sf=af.IteratorPrototype,cf=ko,uf=m,df=vc,lf=ed,hf=function(){return this},pf=function(e,t,r,n){var i=t+" Iterator";return e.prototype=cf(sf,{next:uf(+!n,r)}),df(e,i,!1),lf[i]=hf,e},ff=jn,_f=d,vf=Or,mf=F,Sf=pf,Ef=Zp,yf=ms,gf=vc,bf=Gt,Tf=Ht.exports,If=ed,Rf=vf.PROPER,Af=vf.CONFIGURABLE,Cf=af.IteratorPrototype,Of=af.BUGGY_SAFARI_ITERATORS,Nf=Ze("iterator"),wf=function(){return this},Pf=function(e,t,r,n,i,o,a){Sf(r,t,n);var s,c,u,d=function(e){if(e===i&&_)return _;if(!Of&&e in p)return p[e];switch(e){case"keys":case"values":case"entries":return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[Nf]||p["@@iterator"]||i&&p[i],_=!Of&&f||d(i),v="Array"==t&&p.entries||f;if(v&&(s=Ef(v.call(new e)))!==Object.prototype&&s.next&&(Ef(s)!==Cf&&(yf?yf(s,Cf):mf(s[Nf])||Tf(s,Nf,wf)),gf(s,l,!0)),Rf&&"values"==i&&f&&"values"!==f.name&&(Af?bf(p,"name","values"):(h=!0,_=function(){return _f(f,this)})),i)if(c={values:d("values"),keys:o?_:d("keys"),entries:d("entries")},a)for(u in c)(Of||h||!(u in p))&&Tf(p,u,c[u]);else ff({target:t,proto:!0,forced:Of||h},c);return p[Nf]!==_&&Tf(p,Nf,_,{name:i}),If[t]=_,c},Df=V,kf=Vo,Mf=ed,Uf=br,Lf=Rt.f,xf=Pf,Vf=a,Ff=Uf.set,Bf=Uf.getterFor("Array Iterator"),jf=xf(Array,"Array",(function(e,t){Ff(this,{type:"Array Iterator",target:Df(e),index:0,kind:t})}),(function(){var e=Bf(this),t=e.target,r=e.kind,n=e.index++;return!t||n>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:n,done:!1}:"values"==r?{value:t[n],done:!1}:{value:[n,t[n]],done:!1}}),"values"),Gf=Mf.Arguments=Mf.Array;if(kf("keys"),kf("values"),kf("entries"),Vf&&"values"!==Gf.name)try{Lf(Gf,"name",{value:"values"})}catch(e){}var Hf=T,zf=Gr,Kf=qo,Yf=U,Wf=Hf("".charAt),Xf=Hf("".charCodeAt),Jf=Hf("".slice),qf=function(e){return function(t,r){var n,i,o=Kf(Yf(t)),a=zf(r),s=o.length;return a<0||a>=s?e?"":void 0:(n=Xf(o,a))<55296||n>56319||a+1===s||(i=Xf(o,a+1))<56320||i>57343?e?Wf(o,a):n:e?Jf(o,a,a+2):i-56320+(n-55296<<10)+65536}},Zf={codeAt:qf(!1),charAt:qf(!0)},$f=Zf.charAt,Qf=qo,e_=br,t_=Pf,r_=e_.set,n_=e_.getterFor("String Iterator");t_(String,"String",(function(e){r_(this,{type:"String Iterator",string:Qf(e),index:0})}),(function(){var e,t=n_(this),r=t.string,n=t.index;return n>=r.length?{value:void 0,done:!0}:(e=$f(r,n),t.index+=e.length,{value:e,done:!1})}));var i_=n,o_=Hi,a_=Yi,s_=jf,c_=Gt,u_=Ze,d_=u_("iterator"),l_=u_("toStringTag"),h_=s_.values,p_=function(e,t){if(e){if(e[d_]!==h_)try{c_(e,d_,h_)}catch(t){e[d_]=h_}if(e[l_]||c_(e,l_,t),o_[t])for(var r in s_)if(e[r]!==s_[r])try{c_(e,r,s_[r])}catch(t){e[r]=s_[r]}}};for(var f_ in o_)p_(i_[f_]&&i_[f_].prototype,f_);p_(a_,"DOMTokenList");var __=o,v_=ee,m_=Ze("species"),S_=function(e){return v_>=51||!__((function(){var t=[];return(t.constructor={})[m_]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},E_=jn,y_=n,g_=o,b_=Wn,T_=j,I_=De,R_=Zr,A_=Ws,C_=Ri,O_=S_,N_=ee,w_=Ze("isConcatSpreadable"),P_=y_.TypeError,D_=N_>=51||!g_((function(){var e=[];return e[w_]=!1,e.concat()[0]!==e})),k_=O_("concat"),M_=function(e){if(!T_(e))return!1;var t=e[w_];return void 0!==t?!!t:b_(e)};E_({target:"Array",proto:!0,forced:!D_||!k_},{concat:function(e){var t,r,n,i,o,a=I_(this),s=C_(a,0),c=0;for(t=-1,n=arguments.length;t<n;t++)if(M_(o=-1===t?a:arguments[t])){if(c+(i=R_(o))>9007199254740991)throw P_("Maximum allowed index exceeded");for(r=0;r<i;r++,c++)r in o&&A_(s,c,o[r])}else{if(c>=9007199254740991)throw P_("Maximum allowed index exceeded");A_(s,c++,o)}return s.length=c,s}});var U_=jn,L_=n,x_=Wn,V_=mi,F_=j,B_=Yr,j_=Zr,G_=V,H_=Ws,z_=Ze,K_=oc,Y_=S_("slice"),W_=z_("species"),X_=L_.Array,J_=Math.max;U_({target:"Array",proto:!0,forced:!Y_},{slice:function(e,t){var r,n,i,o=G_(this),a=j_(o),s=B_(e,a),c=B_(void 0===t?a:t,a);if(x_(o)&&(r=o.constructor,(V_(r)&&(r===X_||x_(r.prototype))||F_(r)&&null===(r=r[W_]))&&(r=void 0),r===X_||void 0===r))return K_(o,s,c);for(n=new(void 0===r?X_:r)(J_(c-s,0)),i=0;s<c;s++,i++)s in o&&H_(n,i,o[s]);return n.length=i,n}}),hc("asyncIterator");var q_=function(e,t){return q_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},q_(e,t)};function Z_(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}q_(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var $_=function(){return $_=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},$_.apply(this,arguments)};function Q_(e,t,r,n){var i,o=arguments.length,a=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"===("undefined"==typeof Reflect?"undefined":us(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(a=(o<3?i(a):o>3?i(t,r,a):i(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function ev(e,t,r,n){return new(r||(r=Promise))((function(i,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((n=n.apply(e,t||[])).next())}))}function tv(e,t){var r,n,i,o,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,n&&(i=2&o[0]?n.return:o[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,o[1])).done)return i;switch(n=0,i&&(o=[2&o[0],i.value]),o[0]){case 0:case 1:i=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,n=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(i=a.trys,(i=i.length>0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]<i[3])){a.label=o[1];break}if(6===o[0]&&a.label<i[1]){a.label=i[1],i=o;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(o);break}i[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],n=0}finally{r=i=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function rv(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function nv(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function iv(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}function ov(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var av=Zf.charAt,sv=function(e,t,r){return t+(r?av(e,t).length:1)},cv=d,uv=Pt,dv=Jr,lv=qo,hv=U,pv=Se,fv=sv,_v=ts;Wa("match",(function(e,t,r){return[function(t){var r=hv(this),n=null==t?void 0:pv(t,e);return n?cv(n,t,r):new RegExp(t)[e](lv(r))},function(e){var n=uv(this),i=lv(e),o=r(t,n,i);if(o.done)return o.value;if(!n.global)return _v(n,i);var a=n.unicode;n.lastIndex=0;for(var s,c=[],u=0;null!==(s=_v(n,i));){var d=lv(s[0]);c[u]=d,""===d&&(n.lastIndex=fv(i,dv(n.lastIndex),a)),u++}return 0===u?null:c}]}));var vv="\t\n\v\f\r                 \u2028\u2029\ufeff",mv=U,Sv=qo,Ev=T("".replace),yv="[\t\n\v\f\r                 \u2028\u2029\ufeff]",gv=RegExp("^"+yv+yv+"*"),bv=RegExp(yv+yv+"*$"),Tv=function(e){return function(t){var r=Sv(mv(t));return 1&e&&(r=Ev(r,gv,"")),2&e&&(r=Ev(r,bv,"")),r}},Iv={start:Tv(1),end:Tv(2),trim:Tv(3)},Rv=n,Av=o,Cv=T,Ov=qo,Nv=Iv.trim,wv=Rv.parseInt,Pv=Rv.Symbol,Dv=Pv&&Pv.iterator,kv=/^[+-]?0x/i,Mv=Cv(kv.exec),Uv=8!==wv("\t\n\v\f\r                 \u2028\u2029\ufeff08")||22!==wv("\t\n\v\f\r                 \u2028\u2029\ufeff0x16")||Dv&&!Av((function(){wv(Object(Dv))}))?function(e,t){var r=Nv(Ov(e));return wv(r,t>>>0||(Mv(kv,r)?16:10))}:wv;jn({global:!0,forced:parseInt!=Uv},{parseInt:Uv});var Lv={exports:{}},xv=o((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Vv=o,Fv=j,Bv=C,jv=xv,Gv=Object.isExtensible,Hv=Vv((function(){Gv(1)}))||jv?function(e){return!!Fv(e)&&((!jv||"ArrayBuffer"!=Bv(e))&&(!Gv||Gv(e)))}:Gv,zv=!o((function(){return Object.isExtensible(Object.preventExtensions({}))})),Kv=jn,Yv=T,Wv=or,Xv=j,Jv=Ue,qv=Rt.f,Zv=Fr,$v=Hs,Qv=Hv,em=zv,tm=!1,rm=Be("meta"),nm=0,im=function(e){qv(e,rm,{value:{objectID:"O"+nm++,weakData:{}}})},om=Lv.exports={enable:function(){om.enable=function(){},tm=!0;var e=Zv.f,t=Yv([].splice),r={};r[rm]=1,e(r).length&&(Zv.f=function(r){for(var n=e(r),i=0,o=n.length;i<o;i++)if(n[i]===rm){t(n,i,1);break}return n},Kv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:$v.f}))},fastKey:function(e,t){if(!Xv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Jv(e,rm)){if(!Qv(e))return"F";if(!t)return"E";im(e)}return e[rm].objectID},getWeakData:function(e,t){if(!Jv(e,rm)){if(!Qv(e))return!0;if(!t)return!1;im(e)}return e[rm].weakData},onFreeze:function(e){return em&&tm&&Qv(e)&&!Jv(e,rm)&&im(e),e}};Wv[rm]=!0;var am=F,sm=j,cm=ms,um=function(e,t,r){var n,i;return cm&&am(n=t.constructor)&&n!==r&&sm(i=n.prototype)&&i!==r.prototype&&cm(e,i),e},dm=jn,lm=n,hm=T,pm=kn,fm=Ht.exports,_m=Lv.exports,vm=Md,mm=Qu,Sm=F,Em=j,ym=o,gm=Hd,bm=vc,Tm=um,Im=function(e,t,r){var n=-1!==e.indexOf("Map"),i=-1!==e.indexOf("Weak"),o=n?"set":"add",a=lm[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=hm(s[e]);fm(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(i&&!Em(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return i&&!Em(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(i&&!Em(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(pm(e,!Sm(a)||!(i||s.forEach&&!ym((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,n,o),_m.enable();else if(pm(e,!0)){var l=new c,h=l[o](i?{}:-0,1)!=l,p=ym((function(){l.has(1)})),f=gm((function(e){new a(e)})),_=!i&&ym((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));f||((c=t((function(e,t){mm(e,s);var r=Tm(new a,e,c);return null!=t&&vm(t,r[o],{that:r,AS_ENTRIES:n}),r}))).prototype=s,s.constructor=c),(p||_)&&(d("delete"),d("has"),n&&d("get")),(_||h)&&d(o),i&&s.clear&&delete s.clear}return u[e]=c,dm({global:!0,forced:c!=a},u),bm(c,e),i||r.setStrong(c,e,n),c},Rm=Rt.f,Am=ko,Cm=Ku,Om=Kn,Nm=Qu,wm=Md,Pm=Pf,Dm=qu,km=a,Mm=Lv.exports.fastKey,Um=br.set,Lm=br.getterFor,xm={getConstructor:function(e,t,r,n){var i=e((function(e,i){Nm(e,o),Um(e,{type:t,index:Am(null),first:void 0,last:void 0,size:0}),km||(e.size=0),null!=i&&wm(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=Lm(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=Mm(t,!0),key:t,value:r,previous:n=o.last,next:void 0,removed:!1},o.first||(o.first=s),n&&(n.next=s),km?o.size++:e.size++,"F"!==i&&(o.index[i]=s)),e},c=function(e,t){var r,n=a(e),i=Mm(t);if("F"!==i)return n.index[i];for(r=n.first;r;r=r.next)if(r.key==t)return r};return Cm(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,km?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),km?r.size--:t.size--}return!!n},forEach:function(e){for(var t,r=a(this),n=Om(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)}}),Cm(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)}}),km&&Rm(o,"size",{get:function(){return a(this).size}}),i},setStrong:function(e,t,r){var n=t+" Iterator",i=Lm(t),o=Lm(n);Pm(e,t,(function(e,t){Um(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)?"keys"==t?{value:r.key,done:!1}:"values"==t?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),Dm(t)}};Im("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),xm);var Vm=De,Fm=po;jn({target:"Object",stat:!0,forced:o((function(){Fm(1)}))},{keys:function(e){return Fm(Vm(e))}});var Bm=ve,jm=De,Gm=k,Hm=Zr,zm=n.TypeError,Km=function(e){return function(t,r,n,i){Bm(r);var o=jm(t),a=Gm(o),s=Hm(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 zm("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}},Ym={left:Km(!1),right:Km(!0)},Wm=Ym.left,Xm=ee,Jm=tl;jn({target:"Array",proto:!0,forced:!Ui("reduce")||!Jm&&Xm>79&&Xm<83},{reduce:function(e){var t=arguments.length;return Wm(this,e,t,t>1?arguments[1]:void 0)}});var qm,Zm=jn,$m=T,Qm=i.f,eS=Jr,tS=qo,rS=Wo,nS=U,iS=$o,oS=$m("".endsWith),aS=$m("".slice),sS=Math.min,cS=iS("endsWith");Zm({target:"String",proto:!0,forced:!!(cS||(qm=Qm(String.prototype,"endsWith"),!qm||qm.writable))&&!cS},{endsWith:function(e){var t=tS(nS(this));rS(e);var r=arguments.length>1?arguments[1]:void 0,n=t.length,i=void 0===r?n:sS(eS(r),n),o=tS(e);return oS?oS(t,o,i):aS(t,i-o.length,i)===o}});var uS=!0,dS=!0;function lS(e,t,r){var n=e.match(t);return n&&n.length>=r&&parseInt(n[r],10)}function hS(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 Map),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===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,n])},Object.defineProperty(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 pS(e){return"boolean"!=typeof e?new Error("Argument type: "+us(e)+". Please use a boolean."):(uS=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function fS(e){return"boolean"!=typeof e?new Error("Argument type: "+us(e)+". Please use a boolean."):(dS=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function _S(){if("object"===("undefined"==typeof window?"undefined":us(window))){if(uS)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function vS(e,t){dS&&console.warn(e+" is deprecated, please use "+t+" instead.")}function mS(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=lS(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=lS(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=lS(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function SS(e){return"[object Object]"===Object.prototype.toString.call(e)}function ES(e){return SS(e)?Object.keys(e).reduce((function(t,r){var n=SS(e[r]),i=n?ES(e[r]):e[r],o=n&&!Object.keys(i).length;return void 0===i||o?t:Object.assign(t,ov({},r,i))}),{}):e}function yS(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(n){n.endsWith("Id")?yS(e,e.get(t[n]),r):n.endsWith("Ids")&&t[n].forEach((function(t){yS(e,e.get(t),r)}))})))}function gS(e,t,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;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&&yS(e,r,i)}))})),i}var bS=jn,TS=ki.find,IS=Vo,RS=!0;"find"in[]&&Array(1).find((function(){RS=!1})),bS({target:"Array",proto:!0,forced:RS},{find:function(e){return TS(this,e,arguments.length>1?arguments[1]:void 0)}}),IS("find");var AS=jn,CS=n,OS=Yr,NS=Gr,wS=Zr,PS=De,DS=Ri,kS=Ws,MS=S_("splice"),US=CS.TypeError,LS=Math.max,xS=Math.min;AS({target:"Array",proto:!0,forced:!MS},{splice:function(e,t){var r,n,i,o,a,s,c=PS(this),u=wS(c),d=OS(e,u),l=arguments.length;if(0===l?r=n=0:1===l?(r=0,n=u-d):(r=l-2,n=xS(LS(NS(t),0),u-d)),u+r-n>9007199254740991)throw US("Maximum allowed length exceeded");for(i=DS(c,n),o=0;o<n;o++)(a=d+o)in c&&kS(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]:delete c[s];for(o=u;o>u-n+r;o--)delete 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]:delete c[s];for(o=0;o<r;o++)c[o+d]=arguments[o+2];return c.length=u-n+r,i}});var VS=ki.map;jn({target:"Array",proto:!0,forced:!S_("map")},{map:function(e){return VS(this,e,arguments.length>1?arguments[1]:void 0)}});var FS=ki.filter;jn({target:"Array",proto:!0,forced:!S_("filter")},{filter:function(e){return FS(this,e,arguments.length>1?arguments[1]:void 0)}});var BS=T,jS=De,GS=Math.floor,HS=BS("".charAt),zS=BS("".replace),KS=BS("".slice),YS=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,WS=/\$([$&'`]|\d{1,2})/g,XS=Gs,JS=d,qS=T,ZS=Wa,$S=o,QS=Pt,eE=F,tE=Gr,rE=Jr,nE=qo,iE=U,oE=sv,aE=Se,sE=function(e,t,r,n,i,o){var a=r+e.length,s=n.length,c=WS;return void 0!==i&&(i=jS(i),c=YS),zS(o,c,(function(o,c){var u;switch(HS(c,0)){case"$":return"$";case"&":return e;case"`":return KS(t,0,r);case"'":return KS(t,a);case"<":u=i[KS(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=GS(d/10);return 0===l?o:l<=s?void 0===n[l-1]?HS(c,1):n[l-1]+HS(c,1):o}u=n[d-1]}return void 0===u?"":u}))},cE=ts,uE=Ze("replace"),dE=Math.max,lE=Math.min,hE=qS([].concat),pE=qS([].push),fE=qS("".indexOf),_E=qS("".slice),vE="$0"==="a".replace(/./,"$0"),mE=!!/./[uE]&&""===/./[uE]("a","$0");ZS("replace",(function(e,t,r){var n=mE?"$":"$0";return[function(e,r){var n=iE(this),i=null==e?void 0:aE(e,uE);return i?JS(i,e,n,r):JS(t,nE(n),e,r)},function(e,i){var o=QS(this),a=nE(e);if("string"==typeof i&&-1===fE(i,n)&&-1===fE(i,"$<")){var s=r(t,o,a,i);if(s.done)return s.value}var c=eE(i);c||(i=nE(i));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=cE(o,a);if(null===h)break;if(pE(l,h),!u)break;""===nE(h[0])&&(o.lastIndex=oE(a,rE(o.lastIndex),d))}for(var p,f="",_=0,v=0;v<l.length;v++){for(var m=nE((h=l[v])[0]),S=dE(lE(tE(h.index),a.length),0),E=[],y=1;y<h.length;y++)pE(E,void 0===(p=h[y])?p:String(p));var g=h.groups;if(c){var b=hE([m],E,S,a);void 0!==g&&pE(b,g);var T=nE(XS(i,void 0,b))}else T=sE(m,a,S,E,g,i);S>=_&&(f+=_E(a,_,S)+T,_=S+m.length)}return f+_E(a,_)}]}),!!$S((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!vE||mE);var SE=a,EE=n,yE=T,gE=kn,bE=um,TE=Gt,IE=Rt.f,RE=Fr.f,AE=Y,CE=zo,OE=qo,NE=aa,wE=la,PE=Ht.exports,DE=o,kE=Ue,ME=br.enforce,UE=qu,LE=fa,xE=ma,VE=Ze("match"),FE=EE.RegExp,BE=FE.prototype,jE=EE.SyntaxError,GE=yE(NE),HE=yE(BE.exec),zE=yE("".charAt),KE=yE("".replace),YE=yE("".indexOf),WE=yE("".slice),XE=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,JE=/a/g,qE=/a/g,ZE=new FE(JE)!==JE,$E=wE.MISSED_STICKY,QE=wE.UNSUPPORTED_Y,ey=SE&&(!ZE||$E||LE||xE||DE((function(){return qE[VE]=!1,FE(JE)!=JE||FE(qE)==qE||"/a/i"!=FE(JE,"i")})));if(gE("RegExp",ey)){for(var ty=function(e,t){var r,n,i,o,a,s,c=AE(BE,this),u=CE(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===ty)return e;if((u||AE(BE,e))&&(e=e.source,d&&(t="flags"in h?h.flags:GE(h))),e=void 0===e?"":OE(e),t=void 0===t?"":OE(t),h=e,LE&&"dotAll"in JE&&(n=!!t&&YE(t,"s")>-1)&&(t=KE(t,/s/g,"")),r=t,$E&&"sticky"in JE&&(i=!!t&&YE(t,"y")>-1)&&QE&&(t=KE(t,/y/g,"")),xE&&(o=function(e){for(var t,r=e.length,n=0,i="",o=[],a={},s=!1,c=!1,u=0,d="";n<=r;n++){if("\\"===(t=zE(e,n)))t+=zE(e,++n);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:HE(XE,WE(e,n+1))&&(n+=2,c=!0),i+=t,u++;continue;case">"===t&&c:if(""===d||kE(a,d))throw new jE("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:i+=t}return[i,o]}(e),e=o[0],l=o[1]),a=bE(FE(e,t),c?this:BE,ty),(n||i||l.length)&&(s=ME(a),n&&(s.dotAll=!0,s.raw=ty(function(e){for(var t,r=e.length,n=0,i="",o=!1;n<=r;n++)"\\"!==(t=zE(e,n))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),i+=t):i+="[\\s\\S]":i+=t+zE(e,++n);return i}(e),r)),i&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{TE(a,"source",""===h?"(?:)":h)}catch(e){}return a},ry=function(e){e in ty||IE(ty,e,{configurable:!0,get:function(){return FE[e]},set:function(t){FE[e]=t}})},ny=RE(FE),iy=0;ny.length>iy;)ry(ny[iy++]);BE.constructor=ty,ty.prototype=BE,PE(EE,"RegExp",ty)}UE("RegExp");var oy=T,ay=Or.PROPER,sy=Ht.exports,cy=Pt,uy=Y,dy=qo,ly=o,hy=aa,py=RegExp.prototype,fy=py.toString,_y=oy(hy),vy=ly((function(){return"/a/b"!=fy.call({source:"a",flags:"b"})})),my=ay&&"toString"!=fy.name;(vy||my)&&sy(RegExp.prototype,"toString",(function(){var e=cy(this),t=dy(e.source),r=e.flags;return"/"+t+"/"+dy(void 0===r&&uy(py,e)&&!("flags"in py)?_y(e):r)}),{unsafe:!0});var Sy=ki.some;jn({target:"Array",proto:!0,forced:!Ui("some")},{some:function(e){return Sy(this,e,arguments.length>1?arguments[1]:void 0)}});var Ey=a,yy=Or.EXISTS,gy=T,by=Rt.f,Ty=Function.prototype,Iy=gy(Ty.toString),Ry=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Ay=gy(Ry.exec);Ey&&!yy&&by(Ty,"name",{configurable:!0,get:function(){try{return Ay(Ry,Iy(this))[1]}catch(e){return""}}});var Cy=T,Oy=ve,Ny=j,wy=Ue,Py=oc,Dy=s,ky=n.Function,My=Cy([].concat),Uy=Cy([].join),Ly={},xy=function(e,t,r){if(!wy(Ly,t)){for(var n=[],i=0;i<t;i++)n[i]="a["+i+"]";Ly[t]=ky("C,a","return new C("+Uy(n,",")+")")}return Ly[t](e,r)},Vy=Dy?ky.bind:function(e){var t=Oy(this),r=t.prototype,n=Py(arguments,1),i=function(){var r=My(n,Py(arguments));return this instanceof i?xy(t,r.length,r):t.apply(e,r)};return Ny(r)&&(i.prototype=r),i},Fy=Vy;jn({target:"Function",proto:!0,forced:Function.bind!==Fy},{bind:Fy});var By=_S;function jy(e,t){var r=e&&e.navigator;if(r.mediaDevices){var n=function(e){if("object"!==us(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var n="object"===us(e[r])?e[r]:{ideal:e[r]};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()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==n.ideal){t.optional=t.optional||[];var o={};"number"==typeof n.ideal?(o[i("min",r)]=n.ideal,t.optional.push(o),(o={})[i("max",r)]=n.ideal,t.optional.push(o)):(o[i("",r)]=n.ideal,t.optional.push(o))}void 0!==n.exact&&"number"!=typeof n.exact?(t.mandatory=t.mandatory||{},t.mandatory[i("",r)]=n.exact):["min","max"].forEach((function(e){void 0!==n[e]&&(t.mandatory=t.mandatory||{},t.mandatory[i(e,r)]=n[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},i=function(e,i){if(t.version>=61)return i(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===us(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(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=n(e.audio)}if(e&&"object"===us(e.video)){var a=e.video.facingMode;a=a&&("object"===us(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){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return s.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&s.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=n(e.video),By("chrome: "+JSON.stringify(e)),i(e)}));e.video=n(e.video)}return By("chrome: "+JSON.stringify(e)),i(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString: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 Promise.reject(o(e))}))}))}}}}function Gy(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Hy(e){if("object"===us(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var 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;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.track.id})):{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;i=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===n.id})):{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 hS(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function zy(e){if("object"===us(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(){return this._senders=this._senders||[],this._senders.slice()};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){n.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,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=t._senders.find((function(t){return t.track===e}));r&&t._senders.splice(t._senders.indexOf(r),1)}))}}else if("object"===us(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},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Ky(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.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){return new Map(Object.keys(e).map((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 Promise((function(r,n){t.apply(e,[function(e){r(s(a(e)))},n])})).then(i,o)}}}function Yy(e){if("object"===us(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 gS(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}),hS(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 gS(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?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return i.apply(this,arguments)}}}}function Wy(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var n=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(n)&&this._shimmedLocalStreams[r.id].push(n):this._shimmedLocalStreams[r.id]=[r,n],n};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var n=this.getSenders();r.apply(this,arguments);var i=this.getSenders().filter((function(e){return-1===n.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(i)};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&&Object.keys(this._shimmedLocalStreams).forEach((function(r){var n=t._shimmedLocalStreams[r].indexOf(e);-1!==n&&t._shimmedLocalStreams[r].splice(n,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),i.apply(this,arguments)}}function Xy(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Wy(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((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){if(r.getSenders().find((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=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var i=[].slice.call(arguments,1);if(1!==i.length||!i[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[r.id];if(a)a.addTrack(t),Promise.resolve().then((function(){n.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[r.id]=s,this._reverseStreams[s.id]=r,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],n=ov({},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=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,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||{},Object.keys(this._streams).forEach((function(n){r._streams[n].getTracks().find((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 Object.keys(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 Object.keys(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 Jy(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=ov({},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 qy(e,t){hS(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 Zy=Object.freeze({__proto__:null,shimMediaStream:Gy,shimOnTrack:Hy,shimGetSendersWithDtmf:zy,shimGetStats:Ky,shimSenderReceiverGetStats:Yy,shimAddTrackRemoveTrackWithNative:Wy,shimAddTrackRemoveTrack:Xy,shimPeerConnection:Jy,fixNegotiationNeeded:qy,shimGetUserMedia:jy,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"))}}),$y=n,Qy=o,eg=qo,tg=Iv.trim,rg=T("".charAt),ng=$y.parseFloat,ig=$y.Symbol,og=ig&&ig.iterator,ag=1/ng("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||og&&!Qy((function(){ng(Object(og))}))?function(e){var t=tg(eg(e)),r=ng(t);return 0===r&&"-"==rg(t,0)?-0:r}:ng;jn({global:!0,forced:parseFloat!=ag},{parseFloat:ag});var sg=jn,cg=Hu,ug=o,dg=K,lg=F,hg=Zd,pg=ah,fg=Ht.exports;if(sg({target:"Promise",proto:!0,real:!0,forced:!!cg&&ug((function(){cg.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=hg(this,dg("Promise")),r=lg(e);return this.then(r?function(r){return pg(t,e()).then((function(){return r}))}:e,r?function(r){return pg(t,e()).then((function(){throw r}))}:e)}}),lg(cg)){var _g=dg("Promise").prototype.finally;cg.prototype.finally!==_g&&fg(cg.prototype,"finally",_g,{unsafe:!0})}function vg(e,t){var r=e&&e.navigator,n=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,n){vS("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"===us(e)&&"object"===us(e.audio)&&(e=JSON.parse(JSON.stringify(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"===us(e)&&(e=JSON.parse(JSON.stringify(e)),i(e,"autoGainControl","mozAutoGainControl"),i(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function mg(e){"object"===us(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Sg(e,t){if("object"===us(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=ov({},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=Array.prototype.slice.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(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,n){e.set(n,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function Eg(e){if("object"===us(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):Promise.resolve(new Map)}}}function yg(e){if("object"===us(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}),hS(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function gg(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;vS("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function bg(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Tg(e){if("object"===us(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach((function(e){if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var n=t.apply(this,arguments);if(r){var i=n.sender,o=i.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,i.sendEncodings=e.sendEncodings,this.setParametersPromises.push(i.setParameters(o).then((function(){delete i.sendEncodings})).catch((function(){delete i.sendEncodings}))))}return n})}}function Ig(e){if("object"===us(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function Rg(e){if("object"===us(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?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function Ag(e){if("object"===us(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?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var Cg=Object.freeze({__proto__:null,shimOnTrack:mg,shimPeerConnection:Sg,shimSenderGetStats:Eg,shimReceiverGetStats:yg,shimRemoveStream:gg,shimRTCDataChannel:bg,shimAddTransceiver:Tg,shimGetParameters:Ig,shimCreateOffer:Rg,shimCreateAnswer:Ag,shimGetUserMedia:vg,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,Promise.reject(n)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function Og(e){if("object"===us(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=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(n){return t.call(r,n,e)})),e.getVideoTracks().forEach((function(n){return t.call(r,n,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){r._localStreams?r._localStreams.includes(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=this;this._localStreams||(this._localStreams=[]);var r=this._localStreams.indexOf(e);if(-1!==r){this._localStreams.splice(r,1);var n=e.getTracks();this.getSenders().forEach((function(e){n.includes(e.track)&&t.removeTrack(e)}))}})}}function Ng(e){if("object"===us(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var r=new Event("addstream");r.stream=e,t.dispatchEvent(r)}}))})}});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){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}}))}),t.apply(e,arguments)}}}function wg(e){if("object"===us(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),Promise.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),Promise.resolve()):i};var s=function(e,t,r){var n=i.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n};t.setLocalDescription=s,s=function(e,t,r){var n=o.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.setRemoteDescription=s,s=function(e,t,r){var n=a.apply(this,[e]);return r?(n.then(t,r),Promise.resolve()):n},t.addIceCandidate=s}}function Pg(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(Dg(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,n){t.mediaDevices.getUserMedia(e).then(r,n)}.bind(t))}function Dg(e){return e&&void 0!==e.video?Object.assign({},e,{video:ES(e.video)}):e}function kg(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")?(vS("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(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&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function Mg(e){"object"===us(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Ug(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var n=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&n?"sendrecv"===n.direction?n.setDirection?n.setDirection("sendonly"):n.direction="sendonly":"recvonly"===n.direction&&(n.setDirection?n.setDirection("inactive"):n.direction="inactive"):!0!==e.offerToReceiveVideo||n||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Lg(e){"object"!==us(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var xg=Object.freeze({__proto__:null,shimLocalStreamsAPI:Og,shimRemoteStreamsAPI:Ng,shimCallbacksAPI:wg,shimGetUserMedia:Pg,shimConstraints:Dg,shimRTCIceServerUrls:kg,shimTrackEventTransceiver:Mg,shimCreateOfferLegacy:Ug,shimAudioContext:Lg}),Vg=De,Fg=at;jn({target:"Date",proto:!0,forced:o((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=Vg(this),r=Fg(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}});var Bg=d;jn({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Bg(URL.prototype.toString,this)}});var jg=T(1..valueOf),Gg=a,Hg=n,zg=T,Kg=kn,Yg=Ht.exports,Wg=Ue,Xg=um,Jg=Y,qg=de,Zg=at,$g=o,Qg=Fr.f,eb=i.f,tb=Rt.f,rb=jg,nb=Iv.trim,ib=Hg.Number,ob=ib.prototype,ab=Hg.TypeError,sb=zg("".slice),cb=zg("".charCodeAt),ub=function(e){var t=Zg(e,"number");return"bigint"==typeof t?t:db(t)},db=function(e){var t,r,n,i,o,a,s,c,u=Zg(e,"number");if(qg(u))throw ab("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=nb(u),43===(t=cb(u,0))||45===t){if(88===(r=cb(u,2))||120===r)return NaN}else if(48===t){switch(cb(u,1)){case 66:case 98:n=2,i=49;break;case 79:case 111:n=8,i=55;break;default:return+u}for(a=(o=sb(u,2)).length,s=0;s<a;s++)if((c=cb(o,s))<48||c>i)return NaN;return parseInt(o,n)}return+u};if(Kg("Number",!ib(" 0o1")||!ib("0b1")||ib("+0x1"))){for(var lb,hb=function(e){var t=arguments.length<1?0:ib(ub(e)),r=this;return Jg(ob,r)&&$g((function(){rb(r)}))?Xg(Object(t),r,hb):t},pb=Gg?Qg(ib):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),fb=0;pb.length>fb;fb++)Wg(ib,lb=pb[fb])&&!Wg(hb,lb)&&tb(hb,lb,eb(ib,lb));hb.prototype=ob,ob.constructor=hb,Yg(Hg,"Number",hb)}var _b=jn,vb=k,mb=V,Sb=Ui,Eb=T([].join),yb=vb!=Object,gb=Sb("join",",");_b({target:"Array",proto:!0,forced:yb||!gb},{join:function(e){return Eb(mb(this),void 0===e?",":e)}});var bb=Gs,Tb=d,Ib=T,Rb=Wa,Ab=zo,Cb=Pt,Ob=U,Nb=Zd,wb=sv,Pb=Jr,Db=qo,kb=Se,Mb=Qs,Ub=ts,Lb=Va,xb=o,Vb=la.UNSUPPORTED_Y,Fb=Math.min,Bb=[].push,jb=Ib(/./.exec),Gb=Ib(Bb),Hb=Ib("".slice);Rb("split",(function(e,t,r){var n;return n="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var n=Db(Ob(this)),i=void 0===r?4294967295:r>>>0;if(0===i)return[];if(void 0===e)return[n];if(!Ab(e))return Tb(t,n,e,i);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=Tb(Lb,l,n))&&!((a=l.lastIndex)>d&&(Gb(c,Hb(n,d,o.index)),o.length>1&&o.index<n.length&&bb(Bb,c,Mb(o,1)),s=o[0].length,d=a,c.length>=i));)l.lastIndex===o.index&&l.lastIndex++;return d===n.length?!s&&jb(l,"")||Gb(c,""):Gb(c,Hb(n,d)),c.length>i?Mb(c,0,i):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:Tb(t,this,e,r)}:t,[function(t,r){var i=Ob(this),o=null==t?void 0:kb(t,e);return o?Tb(o,t,i,r):Tb(n,Db(i),t,r)},function(e,i){var o=Cb(this),a=Db(e),s=r(n,o,a,i,n!==t);if(s.done)return s.value;var c=Nb(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(Vb?"g":"y"),l=new c(Vb?"^(?:"+o.source+")":o,d),h=void 0===i?4294967295:i>>>0;if(0===h)return[];if(0===a.length)return null===Ub(l,a)?[a]:[];for(var p=0,f=0,_=[];f<a.length;){l.lastIndex=Vb?0:f;var v,m=Ub(l,Vb?Hb(a,f):a);if(null===m||(v=Fb(Pb(l.lastIndex+(Vb?f:0)),a.length))===p)f=wb(a,f,u);else{if(Gb(_,Hb(a,p,f)),_.length===h)return _;for(var S=1;S<=m.length-1;S++)if(Gb(_,m[S]),_.length===h)return _;f=p=v}}return Gb(_,Hb(a,p)),_}]}),!!xb((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]})),Vb);var zb=Or.PROPER,Kb=o,Yb=vv,Wb=Iv.trim;jn({target:"String",proto:!0,forced:function(e){return Kb((function(){return!!Yb[e]()||"​…᠎"!=="​…᠎"[e]()||zb&&Yb[e].name!==e}))}("trim")},{trim:function(){return Wb(this)}});var Xb={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},n=8;n<t.length;n+=2)switch(t[n]){case"raddr":r.relatedAddress=t[n+1];break;case"rport":r.relatedPort=parseInt(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},t.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(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},n=e.substr(e.indexOf(" ")+1).split(";"),i=0;i<n.length;i++)r[(t=n[i].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var n=[];Object.keys(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},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},n=e.indexOf(":",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},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===us(e.keyParams)?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var n=t.matchPrefix(e+r,"a=ice-ufrag:")[0],i=t.matchPrefix(e+r,"a=ice-pwd:")[0];return n&&i?{usernameFragment:n.substr(12),password:i.substr(10)}:null},t.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},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},n=t.splitLines(e)[0].split(" "),i=3;i<n.length;i++){var o=n[i],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var n="";n+="m="+e+" ",n+=r.codecs.length>0?"9":"0",n+=" UDP/TLS/RTP/SAVPF ",n+=r.codecs.map((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",r.codecs.forEach((function(e){n+=t.writeRtpMap(e),n+=t.writeFmtp(e),n+=t.writeRtcpFb(e)}));var i=0;return r.codecs.forEach((function(e){e.maxptime>i&&(i=e.maxptime)})),i>0&&(n+="a=maxptime:"+i+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((function(e){n+=t.writeExtmap(e)})),n},t.parseRtpEncodingParameters=function(e){var r,n=[],i=t.parseRtpParameters(e),o=-1!==i.fecMechanisms.indexOf("RED"),a=-1!==i.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),i.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),n.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},n.push(t))}})),0===n.length&&c&&n.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,n.forEach((function(e){e.maxBitrate=d}))),n},t.parseRtcpParameters=function(e){var r={},n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];n&&(r.cname=n.value,r.ssrc=n.ssrc);var i=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=i.length>0,r.compound=0===i.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.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},t.parseMsid=function(e){var r,n=t.matchPrefix(e,"a=msid:");if(1===n.length)return{stream:(r=n[0].substr(7).split(" "))[0],track:r[1]};var i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return i.length>0?{stream:(r=i[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,n=t.parseMLine(e),i=t.matchPrefix(e,"a=max-message-size:");i.length>0&&(r=parseInt(i[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:n.fmt,maxMessageSize:r};var a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,n){var i=void 0!==r?r:2;return"v=0\r\no="+(n||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+i+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){for(var n=t.splitLines(e),i=0;i<n.length;i++)switch(n[i]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return n[i].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),n=0;n<r.length;n++)if(r[n].length<2||"="!==r[n].charAt(1))return!1;return!0},e.exports=t}(Xb);var Jb=Xb.exports,qb=Object.freeze(e({__proto__:null,default:Jb},[Xb.exports]));function Zb(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===us(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var r=new t(e),n=Jb.parseCandidate(e.candidate),i=Object.assign(r,n);return i.toJSON=function(){return{candidate:i.candidate,sdpMid:i.sdpMid,sdpMLineIndex:i.sdpMLineIndex,usernameFragment:i.usernameFragment}},i}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,hS(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function $b(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var r=function(e){if(!e||!e.sdp)return!1;var t=Jb.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=Jb.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},n=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(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=Jb.matchPrefix(e.sdp,"a=max-message-size:");return i.length>0?n=parseInt(i[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(n=2147483637),n},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(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={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function Qb(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},hS(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 eT(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var 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 tT(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){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var n=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:n}):t.sdp=n}return r.apply(this,arguments)}}}function rT(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?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function nT(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"!==us(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 iT=Object.freeze({__proto__:null,shimRTCIceCandidate:Zb,shimMaxMessageSize:$b,shimSendThrowTypeError:Qb,shimConnectionState:eT,removeExtmapAllowMixed:tT,shimAddIceCandidateNullOrEmpty:rT,shimParameterlessSetLocalDescription:nT});!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=_S,i=mS(t),o={browserDetails:i,commonShim:iT,extractVersion:lS,disableLog:pS,disableWarnings:fS,sdp:qb};switch(i.browser){case"chrome":if(!Zy||!Jy||!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=Zy,rT(t,i),nT(t),jy(t,i),Gy(t),Jy(t,i),Hy(t),Xy(t,i),zy(t),Ky(t),Yy(t),qy(t,i),Zb(t),eT(t),$b(t,i),Qb(t),tT(t,i);break;case"firefox":if(!Cg||!Sg||!r.shimFirefox)return n("Firefox shim is not included in this adapter release."),o;n("adapter.js shimming firefox."),o.browserShim=Cg,rT(t,i),nT(t),vg(t,i),Sg(t,i),mg(t),gg(t),Eg(t),yg(t),bg(t),Tg(t),Ig(t),Rg(t),Ag(t),Zb(t),eT(t),$b(t,i),Qb(t);break;case"safari":if(!xg||!r.shimSafari)return n("Safari shim is not included in this adapter release."),o;n("adapter.js shimming safari."),o.browserShim=xg,rT(t,i),nT(t),kg(t),Ug(t),wg(t),Og(t),Ng(t),Mg(t),Pg(t),Lg(t),Zb(t),$b(t,i),Qb(t),tT(t,i);break;default:n("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),jn({target:"Array",stat:!0},{isArray:Wn});var oT=Qs,aT=Math.floor,sT=function(e,t){var r=e.length,n=aT(r/2);return r<8?cT(e,t):uT(e,sT(oT(e,0,n),t),sT(oT(e,n),t),t)},cT=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},uT=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},dT=sT,lT=W.match(/firefox\/(\d+)/i),hT=!!lT&&+lT[1],pT=/MSIE|Trident/.test(W),fT=W.match(/AppleWebKit\/(\d+)\./),_T=!!fT&&+fT[1],vT=jn,mT=T,ST=ve,ET=De,yT=Zr,gT=qo,bT=o,TT=dT,IT=Ui,RT=hT,AT=pT,CT=ee,OT=_T,NT=[],wT=mT(NT.sort),PT=mT(NT.push),DT=bT((function(){NT.sort(void 0)})),kT=bT((function(){NT.sort(null)})),MT=IT("sort"),UT=!bT((function(){if(CT)return CT<70;if(!(RT&&RT>3)){if(AT)return!0;if(OT)return OT<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++)NT.push({k:t+n,v:r})}for(NT.sort((function(e,t){return t.v-e.v})),n=0;n<NT.length;n++)t=NT[n].k.charAt(0),i.charAt(i.length-1)!==t&&(i+=t);return"DGBEFHACIJK"!==i}}));vT({target:"Array",proto:!0,forced:DT||!kT||!MT||!UT},{sort:function(e){void 0!==e&&ST(e);var t=ET(this);if(UT)return void 0===e?wT(t):wT(t,e);var r,n,i=[],o=yT(t);for(n=0;n<o;n++)n in t&&PT(i,t[n]);for(TT(i,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:gT(t)>gT(r)?1:-1}}(e)),r=i.length,n=0;n<r;)t[n]=i[n++];for(;n<o;)delete t[n++];return t}});var LT="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,xT=Gr,VT=Jr,FT=n.RangeError,BT=function(e){if(void 0===e)return 0;var t=xT(e),r=VT(t);if(t!==r)throw FT("Wrong length or index");return r},jT=n.Array,GT=Math.abs,HT=Math.pow,zT=Math.floor,KT=Math.log,YT=Math.LN2,WT={pack:function(e,t,r){var n,i,o,a=jT(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?HT(2,-24)-HT(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=GT(e))!=e||e===1/0?(i=e!=e?1:0,n=c):(n=zT(KT(e)/YT),e*(o=HT(2,-n))<1&&(n--,o*=2),(e+=n+u>=1?d/o:d*HT(2,1-u))*o>=2&&(n++,o/=2),n+u>=c?(i=0,n=c):n+u>=1?(i=(e*o-1)*HT(2,t),n+=u):(i=e*HT(2,u-1)*HT(2,t),n=0));t>=8;)a[h++]=255&i,i/=256,t-=8;for(n=n<<t|i,s+=t;s>0;)a[h++]=255&n,n/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var r,n=e.length,i=8*n-t-1,o=(1<<i)-1,a=o>>1,s=i-7,c=n-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:u?-1/0:1/0;r+=HT(2,t),d-=a}return(u?-1:1)*r*HT(2,d-t)}},XT=De,JT=Yr,qT=Zr,ZT=function(e){for(var t=XT(this),r=qT(t),n=arguments.length,i=JT(n>1?arguments[1]:void 0,r),o=n>2?arguments[2]:void 0,a=void 0===o?r:JT(o,r);a>i;)t[i++]=e;return t},$T=n,QT=T,eI=a,tI=LT,rI=Or,nI=Gt,iI=Ku,oI=o,aI=Qu,sI=Gr,cI=Jr,uI=BT,dI=WT,lI=Zp,hI=ms,pI=Fr.f,fI=Rt.f,_I=ZT,vI=Qs,mI=vc,SI=rI.PROPER,EI=rI.CONFIGURABLE,yI=br.get,gI=br.set,bI=$T.ArrayBuffer,TI=bI,II=TI&&TI.prototype,RI=$T.DataView,AI=RI&&RI.prototype,CI=Object.prototype,OI=$T.Array,NI=$T.RangeError,wI=QT(_I),PI=QT([].reverse),DI=dI.pack,kI=dI.unpack,MI=function(e){return[255&e]},UI=function(e){return[255&e,e>>8&255]},LI=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},xI=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},VI=function(e){return DI(e,23,4)},FI=function(e){return DI(e,52,8)},BI=function(e,t){fI(e.prototype,t,{get:function(){return yI(this)[t]}})},jI=function(e,t,r,n){var i=uI(r),o=yI(e);if(i+t>o.byteLength)throw NI("Wrong index");var a=yI(o.buffer).bytes,s=i+o.byteOffset,c=vI(a,s,s+t);return n?c:PI(c)},GI=function(e,t,r,n,i,o){var a=uI(r),s=yI(e);if(a+t>s.byteLength)throw NI("Wrong index");for(var c=yI(s.buffer).bytes,u=a+s.byteOffset,d=n(+i),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(tI){var HI=SI&&"ArrayBuffer"!==bI.name;if(oI((function(){bI(1)}))&&oI((function(){new bI(-1)}))&&!oI((function(){return new bI,new bI(1.5),new bI(NaN),HI&&!EI})))HI&&EI&&nI(bI,"name","ArrayBuffer");else{(TI=function(e){return aI(this,II),new bI(uI(e))}).prototype=II;for(var zI,KI=pI(bI),YI=0;KI.length>YI;)(zI=KI[YI++])in TI||nI(TI,zI,bI[zI]);II.constructor=TI}hI&&lI(AI)!==CI&&hI(AI,CI);var WI=new RI(new TI(2)),XI=QT(AI.setInt8);WI.setInt8(0,2147483648),WI.setInt8(1,2147483649),!WI.getInt8(0)&&WI.getInt8(1)||iI(AI,{setInt8:function(e,t){XI(this,e,t<<24>>24)},setUint8:function(e,t){XI(this,e,t<<24>>24)}},{unsafe:!0})}else II=(TI=function(e){aI(this,II);var t=uI(e);gI(this,{bytes:wI(OI(t),0),byteLength:t}),eI||(this.byteLength=t)}).prototype,AI=(RI=function(e,t,r){aI(this,AI),aI(e,II);var n=yI(e).byteLength,i=sI(t);if(i<0||i>n)throw NI("Wrong offset");if(i+(r=void 0===r?n-i:cI(r))>n)throw NI("Wrong length");gI(this,{buffer:e,byteLength:r,byteOffset:i}),eI||(this.buffer=e,this.byteLength=r,this.byteOffset=i)}).prototype,eI&&(BI(TI,"byteLength"),BI(RI,"buffer"),BI(RI,"byteLength"),BI(RI,"byteOffset")),iI(AI,{getInt8:function(e){return jI(this,1,e)[0]<<24>>24},getUint8:function(e){return jI(this,1,e)[0]},getInt16:function(e){var t=jI(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=jI(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return xI(jI(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return xI(jI(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return kI(jI(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return kI(jI(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){GI(this,1,e,MI,t)},setUint8:function(e,t){GI(this,1,e,MI,t)},setInt16:function(e,t){GI(this,2,e,UI,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){GI(this,2,e,UI,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){GI(this,4,e,LI,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){GI(this,4,e,LI,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){GI(this,4,e,VI,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){GI(this,8,e,FI,t,arguments.length>2?arguments[2]:void 0)}});mI(TI,"ArrayBuffer"),mI(RI,"DataView");var JI={ArrayBuffer:TI,DataView:RI},qI=jn,ZI=T,$I=o,QI=Pt,eR=Yr,tR=Jr,rR=Zd,nR=JI.ArrayBuffer,iR=JI.DataView,oR=iR.prototype,aR=ZI(nR.prototype.slice),sR=ZI(oR.getUint8),cR=ZI(oR.setUint8);qI({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:$I((function(){return!new nR(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(aR&&void 0===t)return aR(QI(this),e);for(var r=QI(this).byteLength,n=eR(e,r),i=eR(void 0===t?r:t,r),o=new(rR(this,nR))(tR(i-n)),a=new iR(this),s=new iR(o),c=0;n<i;)cR(s,c++,sR(a,n++));return o}});var uR,dR,lR,hR={exports:{}},pR=LT,fR=a,_R=n,vR=F,mR=j,SR=Ue,ER=ni,yR=he,gR=Gt,bR=Ht.exports,TR=Rt.f,IR=Y,RR=Zp,AR=ms,CR=Ze,OR=Be,NR=_R.Int8Array,wR=NR&&NR.prototype,PR=_R.Uint8ClampedArray,DR=PR&&PR.prototype,kR=NR&&RR(NR),MR=wR&&RR(wR),UR=Object.prototype,LR=_R.TypeError,xR=CR("toStringTag"),VR=OR("TYPED_ARRAY_TAG"),FR=OR("TYPED_ARRAY_CONSTRUCTOR"),BR=pR&&!!AR&&"Opera"!==ER(_R.opera),jR=!1,GR={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},HR={BigInt64Array:8,BigUint64Array:8},zR=function(e){if(!mR(e))return!1;var t=ER(e);return SR(GR,t)||SR(HR,t)};for(uR in GR)(lR=(dR=_R[uR])&&dR.prototype)?gR(lR,FR,dR):BR=!1;for(uR in HR)(lR=(dR=_R[uR])&&dR.prototype)&&gR(lR,FR,dR);if((!BR||!vR(kR)||kR===Function.prototype)&&(kR=function(){throw LR("Incorrect invocation")},BR))for(uR in GR)_R[uR]&&AR(_R[uR],kR);if((!BR||!MR||MR===UR)&&(MR=kR.prototype,BR))for(uR in GR)_R[uR]&&AR(_R[uR].prototype,MR);if(BR&&RR(DR)!==MR&&AR(DR,MR),fR&&!SR(MR,xR))for(uR in jR=!0,TR(MR,xR,{get:function(){return mR(this)?this[VR]:void 0}}),GR)_R[uR]&&gR(_R[uR],VR,uR);var KR={NATIVE_ARRAY_BUFFER_VIEWS:BR,TYPED_ARRAY_CONSTRUCTOR:FR,TYPED_ARRAY_TAG:jR&&VR,aTypedArray:function(e){if(zR(e))return e;throw LR("Target is not a typed array")},aTypedArrayConstructor:function(e){if(vR(e)&&(!AR||IR(kR,e)))return e;throw LR(yR(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,n){if(fR){if(r)for(var i in GR){var o=_R[i];if(o&&SR(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}MR[e]&&!r||bR(MR,e,r?t:BR&&wR[e]||t,n)}},exportTypedArrayStaticMethod:function(e,t,r){var n,i;if(fR){if(AR){if(r)for(n in GR)if((i=_R[n])&&SR(i,e))try{delete i[e]}catch(e){}if(kR[e]&&!r)return;try{return bR(kR,e,r?t:BR&&kR[e]||t)}catch(e){}}for(n in GR)!(i=_R[n])||i[e]&&!r||bR(i,e,t)}},isView:function(e){if(!mR(e))return!1;var t=ER(e);return"DataView"===t||SR(GR,t)||SR(HR,t)},isTypedArray:zR,TypedArray:kR,TypedArrayPrototype:MR},YR=n,WR=o,XR=Hd,JR=KR.NATIVE_ARRAY_BUFFER_VIEWS,qR=YR.ArrayBuffer,ZR=YR.Int8Array,$R=!JR||!WR((function(){ZR(1)}))||!WR((function(){new ZR(-1)}))||!XR((function(e){new ZR,new ZR(null),new ZR(1.5),new ZR(e)}),!0)||WR((function(){return 1!==new ZR(new qR(2),1,void 0).length})),QR=j,eA=Math.floor,tA=Number.isInteger||function(e){return!QR(e)&&isFinite(e)&&eA(e)===e},rA=Gr,nA=n.RangeError,iA=function(e){var t=rA(e);if(t<0)throw nA("The argument can't be less than 0");return t},oA=n.RangeError,aA=function(e,t){var r=iA(e);if(r%t)throw oA("Wrong offset");return r},sA=Kn,cA=d,uA=Wd,dA=De,lA=Zr,hA=vd,pA=ud,fA=id,_A=KR.aTypedArrayConstructor,vA=jn,mA=n,SA=d,EA=a,yA=$R,gA=KR,bA=JI,TA=Qu,IA=m,RA=Gt,AA=tA,CA=Jr,OA=BT,NA=aA,wA=ut,PA=Ue,DA=ni,kA=j,MA=de,UA=ko,LA=Y,xA=ms,VA=Fr.f,FA=function(e){var t,r,n,i,o,a,s=uA(this),c=dA(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=pA(c);if(h&&!fA(h))for(a=(o=hA(c,h)).next,c=[];!(i=cA(a,o)).done;)c.push(i.value);for(l&&u>2&&(d=sA(d,arguments[2])),r=lA(c),n=new(_A(s))(r),t=0;r>t;t++)n[t]=l?d(c[t],t):c[t];return n},BA=ki.forEach,jA=qu,GA=Rt,HA=i,zA=um,KA=br.get,YA=br.set,WA=GA.f,XA=HA.f,JA=Math.round,qA=mA.RangeError,ZA=bA.ArrayBuffer,$A=ZA.prototype,QA=bA.DataView,eC=gA.NATIVE_ARRAY_BUFFER_VIEWS,tC=gA.TYPED_ARRAY_CONSTRUCTOR,rC=gA.TYPED_ARRAY_TAG,nC=gA.TypedArray,iC=gA.TypedArrayPrototype,oC=gA.aTypedArrayConstructor,aC=gA.isTypedArray,sC=function(e,t){oC(e);for(var r=0,n=t.length,i=new e(n);n>r;)i[r]=t[r++];return i},cC=function(e,t){WA(e,t,{get:function(){return KA(this)[t]}})},uC=function(e){var t;return LA($A,e)||"ArrayBuffer"==(t=DA(e))||"SharedArrayBuffer"==t},dC=function(e,t){return aC(e)&&!MA(t)&&t in e&&AA(+t)&&t>=0},lC=function(e,t){return t=wA(t),dC(e,t)?IA(2,e[t]):XA(e,t)},hC=function(e,t,r){return t=wA(t),!(dC(e,t)&&kA(r)&&PA(r,"value"))||PA(r,"get")||PA(r,"set")||r.configurable||PA(r,"writable")&&!r.writable||PA(r,"enumerable")&&!r.enumerable?WA(e,t,r):(e[t]=r.value,e)};EA?(eC||(HA.f=lC,GA.f=hC,cC(iC,"buffer"),cC(iC,"byteOffset"),cC(iC,"byteLength"),cC(iC,"length")),vA({target:"Object",stat:!0,forced:!eC},{getOwnPropertyDescriptor:lC,defineProperty:hC}),hR.exports=function(e,t,r){var n=e.match(/\d+$/)[0]/8,i=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=mA[i],c=s,u=c&&c.prototype,d={},l=function(e,t){WA(e,t,{get:function(){return function(e,t){var r=KA(e);return r.view[o](t*n+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,i){var o=KA(e);r&&(i=(i=JA(i))<0?0:i>255?255:255&i),o.view[a](t*n+o.byteOffset,i,!0)}(this,t,e)},enumerable:!0})};eC?yA&&(c=t((function(e,t,r,i){return TA(e,u),zA(kA(t)?uC(t)?void 0!==i?new s(t,NA(r,n),i):void 0!==r?new s(t,NA(r,n)):new s(t):aC(t)?sC(c,t):SA(FA,c,t):new s(OA(t)),e,c)})),xA&&xA(c,nC),BA(VA(s),(function(e){e in c||RA(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,i){TA(e,u);var o,a,s,d=0,h=0;if(kA(t)){if(!uC(t))return aC(t)?sC(c,t):SA(FA,c,t);o=t,h=NA(r,n);var p=t.byteLength;if(void 0===i){if(p%n)throw qA("Wrong length");if((a=p-h)<0)throw qA("Wrong length")}else if((a=CA(i)*n)+h>p)throw qA("Wrong length");s=a/n}else s=OA(t),o=new ZA(a=s*n);for(YA(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new QA(o)});d<s;)l(e,d++)})),xA&&xA(c,nC),u=c.prototype=UA(iC)),u.constructor!==c&&RA(u,"constructor",c),RA(u,tC,c),rC&&RA(u,rC,i),d[i]=c,vA({global:!0,forced:c!=s,sham:!eC},d),"BYTES_PER_ELEMENT"in c||RA(c,"BYTES_PER_ELEMENT",n),"BYTES_PER_ELEMENT"in u||RA(u,"BYTES_PER_ELEMENT",n),jA(i)}):hR.exports=function(){},(0,hR.exports)("Uint8",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var pC=De,fC=Yr,_C=Zr,vC=Math.min,mC=[].copyWithin||function(e,t){var r=pC(this),n=_C(r),i=fC(e,n),o=fC(t,n),a=arguments.length>2?arguments[2]:void 0,s=vC((void 0===a?n:fC(a,n))-o,n-i),c=1;for(o<i&&i<o+s&&(c=-1,o+=s-1,i+=s-1);s-- >0;)o in r?r[i]=r[o]:delete r[i],i+=c,o+=c;return r},SC=KR,EC=T(mC),yC=SC.aTypedArray;(0,SC.exportTypedArrayMethod)("copyWithin",(function(e,t){return EC(yC(this),e,t,arguments.length>2?arguments[2]:void 0)}));var gC=ki.every,bC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("every",(function(e){return gC(bC(this),e,arguments.length>1?arguments[1]:void 0)}));var TC=d,IC=ZT,RC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return TC(IC,RC(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var AC=Zr,CC=Zd,OC=KR.TYPED_ARRAY_CONSTRUCTOR,NC=KR.aTypedArrayConstructor,wC=function(e){return NC(CC(e,e[OC]))},PC=function(e,t){for(var r=0,n=AC(t),i=new e(n);n>r;)i[r]=t[r++];return i},DC=wC,kC=ki.filter,MC=function(e,t){return PC(DC(e),t)},UC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("filter",(function(e){var t=kC(UC(this),e,arguments.length>1?arguments[1]:void 0);return MC(this,t)}));var LC=ki.find,xC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("find",(function(e){return LC(xC(this),e,arguments.length>1?arguments[1]:void 0)}));var VC=ki.findIndex,FC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("findIndex",(function(e){return VC(FC(this),e,arguments.length>1?arguments[1]:void 0)}));var BC=ki.forEach,jC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("forEach",(function(e){BC(jC(this),e,arguments.length>1?arguments[1]:void 0)}));var GC=rn.includes,HC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("includes",(function(e){return GC(HC(this),e,arguments.length>1?arguments[1]:void 0)}));var zC=rn.indexOf,KC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("indexOf",(function(e){return zC(KC(this),e,arguments.length>1?arguments[1]:void 0)}));var YC=n,WC=o,XC=T,JC=KR,qC=jf,ZC=Ze("iterator"),$C=YC.Uint8Array,QC=XC(qC.values),eO=XC(qC.keys),tO=XC(qC.entries),rO=JC.aTypedArray,nO=JC.exportTypedArrayMethod,iO=$C&&$C.prototype,oO=!WC((function(){iO[ZC].call([1])})),aO=!!iO&&iO.values&&iO[ZC]===iO.values&&"values"===iO.values.name,sO=function(){return QC(rO(this))};nO("entries",(function(){return tO(rO(this))}),oO),nO("keys",(function(){return eO(rO(this))}),oO),nO("values",sO,oO||!aO,{name:"values"}),nO(ZC,sO,oO||!aO,{name:"values"});var cO=KR.aTypedArray,uO=KR.exportTypedArrayMethod,dO=T([].join);uO("join",(function(e){return dO(cO(this),e)}));var lO=Gs,hO=V,pO=Gr,fO=Zr,_O=Ui,vO=Math.min,mO=[].lastIndexOf,SO=!!mO&&1/[1].lastIndexOf(1,-0)<0,EO=_O("lastIndexOf"),yO=SO||!EO?function(e){if(SO)return lO(mO,this,arguments)||0;var t=hO(this),r=fO(t),n=r-1;for(arguments.length>1&&(n=vO(n,pO(arguments[1]))),n<0&&(n=r+n);n>=0;n--)if(n in t&&t[n]===e)return n||0;return-1}:mO,gO=Gs,bO=yO,TO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return gO(bO,TO(this),t>1?[e,arguments[1]]:[e])}));var IO=ki.map,RO=wC,AO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("map",(function(e){return IO(AO(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(RO(e))(t)}))}));var CO=Ym.left,OO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return CO(OO(this),e,t,t>1?arguments[1]:void 0)}));var NO=Ym.right,wO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return NO(wO(this),e,t,t>1?arguments[1]:void 0)}));var PO=KR.aTypedArray,DO=KR.exportTypedArrayMethod,kO=Math.floor;DO("reverse",(function(){for(var e,t=this,r=PO(t).length,n=kO(r/2),i=0;i<n;)e=t[i],t[i++]=t[--r],t[r]=e;return t}));var MO=n,UO=d,LO=KR,xO=Zr,VO=aA,FO=De,BO=o,jO=MO.RangeError,GO=MO.Int8Array,HO=GO&&GO.prototype,zO=HO&&HO.set,KO=LO.aTypedArray,YO=LO.exportTypedArrayMethod,WO=!BO((function(){var e=new Uint8ClampedArray(2);return UO(zO,e,{length:1,0:3},1),3!==e[1]})),XO=WO&&LO.NATIVE_ARRAY_BUFFER_VIEWS&&BO((function(){var e=new GO(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));YO("set",(function(e){KO(this);var t=VO(arguments.length>1?arguments[1]:void 0,1),r=FO(e);if(WO)return UO(zO,this,r,t);var n=this.length,i=xO(r),o=0;if(i+t>n)throw jO("Wrong length");for(;o<i;)this[t+o]=r[o++]}),!WO||XO);var JO=wC,qO=oc,ZO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("slice",(function(e,t){for(var r=qO(ZO(this),e,t),n=JO(this),i=0,o=r.length,a=new n(o);o>i;)a[i]=r[i++];return a}),o((function(){new Int8Array(1).slice()})));var $O=ki.some,QO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("some",(function(e){return $O(QO(this),e,arguments.length>1?arguments[1]:void 0)}));var eN=n,tN=T,rN=o,nN=ve,iN=dT,oN=KR,aN=hT,sN=pT,cN=ee,uN=_T,dN=eN.Array,lN=oN.aTypedArray,hN=oN.exportTypedArrayMethod,pN=eN.Uint16Array,fN=pN&&tN(pN.prototype.sort),_N=!(!fN||rN((function(){fN(new pN(2),null)}))&&rN((function(){fN(new pN(2),{})}))),vN=!!fN&&!rN((function(){if(cN)return cN<74;if(aN)return aN<67;if(sN)return!0;if(uN)return uN<602;var e,t,r=new pN(516),n=dN(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,n[e]=e-2*t+3;for(fN(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==n[e])return!0}));hN("sort",(function(e){return void 0!==e&&nN(e),vN?fN(this,e):iN(lN(this),function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}}(e))}),!vN||_N);var mN=Jr,SN=Yr,EN=wC,yN=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("subarray",(function(e,t){var r=yN(this),n=r.length,i=SN(e,n);return new(EN(r))(r.buffer,r.byteOffset+i*r.BYTES_PER_ELEMENT,mN((void 0===t?n:SN(t,n))-i))}));var gN=Gs,bN=KR,TN=o,IN=oc,RN=n.Int8Array,AN=bN.aTypedArray,CN=bN.exportTypedArrayMethod,ON=[].toLocaleString,NN=!!RN&&TN((function(){ON.call(new RN(1))}));CN("toLocaleString",(function(){return gN(ON,NN?IN(AN(this)):AN(this),IN(arguments))}),TN((function(){return[1,2].toLocaleString()!=new RN([1,2]).toLocaleString()}))||!TN((function(){RN.prototype.toLocaleString.call([1,2])})));var wN=KR.exportTypedArrayMethod,PN=o,DN=T,kN=n.Uint8Array,MN=kN&&kN.prototype||{},UN=[].toString,LN=DN([].join);PN((function(){UN.call({})}))&&(UN=function(){return LN(this)});var xN=MN.toString!=UN;wN("toString",UN,xN);var VN=jn,FN=n,BN=Gs,jN=F,GN=oc,HN=Qd,zN=/MSIE .\./.test(W),KN=FN.Function,YN=function(e){return function(t,r){var n=HN(arguments.length,1)>2,i=jN(t)?t:KN(t),o=n?GN(arguments,2):void 0;return e(n?function(){BN(i,this,o)}:i,r)}};VN({global:!0,bind:!0,forced:zN},{setTimeout:YN(FN.setTimeout),setInterval:YN(FN.setInterval)});var WN=jn,XN=ki.findIndex,JN=Vo,qN=!0;"findIndex"in[]&&Array(1).findIndex((function(){qN=!1})),WN({target:"Array",proto:!0,forced:qN},{findIndex:function(e){return XN(this,e,arguments.length>1?arguments[1]:void 0)}}),JN("findIndex");var ZN,$N,QN=qu,ew=JI.ArrayBuffer;jn({global:!0,forced:n.ArrayBuffer!==ew},{ArrayBuffer:ew}),QN("ArrayBuffer"),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN"}(ZN||(ZN={})),function(e){e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK"}($N||($N={}));var tw=function(e,t,r){this.code=e,this.message=t,this.error=r},rw=a,nw=T,iw=po,ow=V,aw=nw(l.f),sw=nw([].push),cw=function(e){return function(t){for(var r,n=ow(t),i=iw(n),o=i.length,a=0,s=[];o>a;)r=i[a++],rw&&!aw(n,r)||sw(s,e?[r,n[r]]:n[r]);return s}},uw={entries:cw(!0),values:cw(!1)}.entries;jn({target:"Object",stat:!0},{entries:function(e){return uw(e)}});var dw=Gr,lw=qo,hw=U,pw=n.RangeError,fw=T,_w=Jr,vw=qo,mw=function(e){var t=lw(hw(this)),r="",n=dw(e);if(n<0||n==1/0)throw pw("Wrong number of repetitions");for(;n>0;(n>>>=1)&&(t+=t))1&n&&(r+=t);return r},Sw=U,Ew=fw(mw),yw=fw("".slice),gw=Math.ceil,bw=function(e){return function(t,r,n){var i,o,a=vw(Sw(t)),s=_w(r),c=a.length,u=void 0===n?" ":vw(n);return s<=c||""==u?a:((o=Ew(u,gw((i=s-c)/u.length))).length>i&&(o=yw(o,0,i)),e?a+o:o+a)}},Tw={start:bw(!1),end:bw(!0)},Iw=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(W),Rw=Tw.end;jn({target:"String",proto:!0,forced:Iw},{padEnd:function(e){return Rw(this,e,arguments.length>1?arguments[1]:void 0)}});var Aw=Uv;jn({target:"Number",stat:!0,forced:Number.parseInt!=Aw},{parseInt:Aw});jn({target:"ArrayBuffer",stat:!0,forced:!KR.NATIVE_ARRAY_BUFFER_VIEWS},{isView:KR.isView}),jn({global:!0,forced:!LT},{DataView:JI.DataView});var Cw=Pt,Ow=yd,Nw=Kn,ww=d,Pw=De,Dw=function(e,t,r,n){try{return n?t(Cw(r)[0],r[1]):t(r)}catch(t){Ow(e,"throw",t)}},kw=id,Mw=mi,Uw=Zr,Lw=Ws,xw=vd,Vw=ud,Fw=n.Array,Bw=function(e){var t=Pw(e),r=Mw(this),n=arguments.length,i=n>1?arguments[1]:void 0,o=void 0!==i;o&&(i=Nw(i,n>2?arguments[2]:void 0));var a,s,c,u,d,l,h=Vw(t),p=0;if(!h||this==Fw&&kw(h))for(a=Uw(t),s=r?new this(a):Fw(a);a>p;p++)l=o?i(t[p],p):t[p],Lw(s,p,l);else for(d=(u=xw(t,h)).next,s=r?new this:[];!(c=ww(d,u)).done;p++)l=o?Dw(u,i,[c.value,p],!0):c.value,Lw(s,p,l);return s.length=p,s},jw=Bw;jn({target:"Array",stat:!0,forced:!Hd((function(e){Array.from(e)}))},{from:jw});var Gw,Hw=jn,zw=Wn,Kw=T([].reverse),Yw=[1,2];Hw({target:"Array",proto:!0,forced:String(Yw)===String(Yw.reverse())},{reverse:function(){return zw(this)&&(this.length=this.length),Kw(this)}});var Ww=new Uint8Array(16);function Xw(){if(!Gw&&!(Gw="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 Gw(Ww)}var Jw=/^(?:[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 qw(e){return"string"==typeof e&&Jw.test(e)}for(var Zw=[],$w=0;$w<256;++$w)Zw.push(($w+256).toString(16).substr(1));function Qw(e,t,r){var n=(e=e||{}).random||(e.rng||Xw)();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=(Zw[e[t+0]]+Zw[e[t+1]]+Zw[e[t+2]]+Zw[e[t+3]]+"-"+Zw[e[t+4]]+Zw[e[t+5]]+"-"+Zw[e[t+6]]+Zw[e[t+7]]+"-"+Zw[e[t+8]]+Zw[e[t+9]]+"-"+Zw[e[t+10]]+Zw[e[t+11]]+Zw[e[t+12]]+Zw[e[t+13]]+Zw[e[t+14]]+Zw[e[t+15]]).toLowerCase();if(!qw(r))throw TypeError("Stringified UUID is invalid");return r}(n)}var eP=new TextDecoder,tP=new TextEncoder,rP=function(){return Qw()},nP=function(){return Date.now()};function iP(e){for(var t,r,n,i,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=rv(o),u=c.next();!u.done;u=c.next()){s+=(f=u.value).length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}var d=new e(s),l=0;try{for(var h=rv(o),p=h.next();!p.done;p=h.next()){var f=p.value;d.set(f,l),l+=f.length}}catch(e){n={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(n)throw n.error}}return d}var oP=function(){return"undefined"==typeof window},aP=function(){function e(){}return e.token2auth=function(t,r,n,i){return i?"Bearer ".concat(i):"Basic ".concat(e.createUnsafeToken(t,r,n))},e.createUnsafeToken=function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))},e.merge=function(t,r){var n,i;void 0===t&&(t={}),void 0===r&&(r={});try{for(var o=rv(Object.entries(t)),a=o.next();!a.done;a=o.next()){var s=nv(a.value,2),c=s[0],u=s[1];null!==u&&"object"===us(u)?e.merge(t[c],r[c]):void 0!==r[c]&&(t[c]=r[c])}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}},e.ab2str=function(e){return eP.decode(e)},e.ab2obj=function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(e){return{}}},e.str2ab=function(e){return tP.encode(e).buffer},e.ab2b64str=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var r=new FileReader;r.onload=function(){return t(r.result)},r.readAsDataURL(new Blob([e]))}))];case 1:return[2,t.sent().split(",",2)[1]]}}))}))},e.b64str2ab=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function sP(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,r){var n=r===t.length-1?"0":"1";return Number.parseInt(n+e.join(""),2)}))}var cP=function(){return Math.floor(65535*Math.random())};function uP(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function dP(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var r=ArrayBuffer.isView(t)?t.buffer:t,n=r.byteLength,i=[];if(n>10){var o=new DataView(r),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return n-1-t})).reverse().map((function(e){return o.getUint8(e)}));i=iv(iv(iv([],nv(a),!1),["..."],!1),nv(s),!1)}else i=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(n,") [").concat(i.join(", "),"]")}if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var lP,hP=function(){return ev(void 0,void 0,void 0,(function(){var e,t;return tv(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),e.addTransceiver("audio",{direction:"recvonly"}),e.addTransceiver("video",{direction:"recvonly"}),[4,e.createOffer()];case 1:return t=r.sent(),e.close(),[2,t.sdp];case 2:return r.sent(),[3,3];case 3:return[2]}}))}))},pP=function(e){return new Promise((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 fP(e,t){if("boolean"!=typeof e)throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function _P(e,t,r,n){if(void 0===r&&(r=1),void 0===n&&(n=Number.POSITIVE_INFINITY),e<r||e>n||"number"!=typeof e)throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(n,"]. integer only"))}function vP(e,t,r,n){if(void 0===r&&(r=1),void 0===n&&(n=Number.POSITIVE_INFINITY),null==e)throw new tw(ZN.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,r){void 0===t&&(t=1);void 0===r&&(r=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=r&&e.length>=t}(e,r,n))throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(n,"]"))}function mP(e,t,r){if(!r.includes(e))throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function SP(e,t){if(gP(e))throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function EP(e,t){if(!(e instanceof ArrayBuffer))throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function yP(e){var t,r;try{var n=navigator.mediaDevices.getSupportedConstraints();try{for(var i=rv(Object.keys(e)),o=i.next();!o.done;o=i.next()){var a=o.value;n[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}}catch(e){}}function gP(e){return null==e}function bP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new tw(ZN.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function TP(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new tw(ZN.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function IP(e){SP(e,"videoPlayerOption")}function RP(e,t){var r,n;if(void 0===t&&(t=64),!e||0===(null===(r=e)||void 0===r?void 0:r.byteLength))throw new tw(ZN.INVALID_PARAMS,"The message cannot be empty");if((null==(n=e instanceof ArrayBuffer?e:aP.str2ab(JSON.stringify(e)))?void 0:n.byteLength)>1e3*t)throw new tw(ZN.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function AP(e){return![lP.onRemoteStreamStats,lP.onLocalStreamStats].includes(e)}!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onStreamAdd="onStreamAdd",e.onStreamRemove="onStreamRemove",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onUserMuteAudio="onUserMuteAudio",e.onUserMuteVideo="onUserMuteVideo",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onMediaDeviceStateChanged="onMediaDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",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.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"}(lP||(lP={}));var CP={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?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(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}(CP);var OP=["#0050b3","#0050b3","#0050b3","#0050b3"],NP=!oP()&&window.location.search.includes("_rtc_debug_"),wP=function(){function e(e,t,r){this._module=e,this._indent=t}return e.prototype.print=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(NP){for(var n="",i=0;i<this._indent;i++)n+=" ";console.log.apply(console,iv(["%c".concat("[VERTC]").concat(n,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(OP[this._indent],";")],nv(t),!1))}},e}(),PP=new wP("VERTC",0),DP=function(e){function t(){return e.call(this)||this}return Z_(t,e),t.prototype.safeEmit=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];var i=this.listenerCount(t);try{return e.prototype.emit.apply(this,iv([t],nv(r),!1))}catch(e){return PP.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(i)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return ev(this,void 0,void 0,(function(){var r=this;return tv(this,(function(n){return[2,new Promise((function(n,i){try{r.emit.apply(r,iv(iv([e],nv(t),!1),[n,i],!1))}catch(t){PP.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),i(t)}}))]}))}))},t}(CP.exports.EventEmitter),kP=Ue,MP=function(e){return void 0!==e&&(kP(e,"value")||kP(e,"writable"))},UP=d,LP=j,xP=Pt,VP=MP,FP=i,BP=Zp;jn({target:"Reflect",stat:!0},{get:function e(t,r){var n,i,o=arguments.length<3?t:arguments[2];return xP(t)===o?t[r]:(n=FP.f(t,r))?VP(n)?n.value:void 0===n.get?void 0:UP(n.get,o):LP(i=BP(t))?e(i,r,o):void 0}});var jP=jn,GP=d,HP=Pt,zP=j,KP=MP,YP=Rt,WP=i,XP=Zp,JP=m;var qP,ZP,$P,QP,eD,tD,rD,nD,iD,oD,aD,sD,cD,uD,dD,lD,hD,pD,fD,_D,vD=o((function(){var e=function(){},t=YP.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));jP({target:"Reflect",stat:!0,forced:vD},{set:function e(t,r,n){var i,o,a,s=arguments.length<4?t:arguments[3],c=WP.f(HP(t),r);if(!c){if(zP(o=XP(t)))return e(o,r,n,s);c=JP(0)}if(KP(c)){if(!1===c.writable||!zP(s))return!1;if(i=WP.f(s,r)){if(i.get||i.set||!1===i.writable)return!1;i.value=n,YP.f(s,r,i)}else YP.f(s,r,JP(0,n))}else{if(void 0===(a=c.set))return!1;GP(a,s,n)}return!0}}),function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(qP||(qP={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(ZP||(ZP={})),function(e){e[e.QUIT=0]="QUIT",e[e.DROPPED=1]="DROPPED",e[e.SWITCH_TO_INVISIBLE=2]="SWITCH_TO_INVISIBLE",e[e.KICKED_BY_ADMIN=3]="KICKED_BY_ADMIN"}($P||($P={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(QP||(QP={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(eD||(eD={})),function(e){e[e.MUTE_STATE_OFF=0]="MUTE_STATE_OFF",e[e.MUTE_STATE_ON=1]="MUTE_STATE_ON"}(tD||(tD={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(rD||(rD={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(nD||(nD={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(iD||(iD={})),function(e){e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO=0]="RTC_PAUSE_RESUME_CONTROL_AUDIO",e[e.RTC_PAUSE_RESUME_CONTROL_VIDEO=1]="RTC_PAUSE_RESUME_CONTROL_VIDEO",e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO=2]="RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO"}(oD||(oD={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(aD||(aD={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(sD||(sD={})),function(e){e[e.AUDIO_ONLY=0]="AUDIO_ONLY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.AUDIO_AND_VIDEO=2]="AUDIO_AND_VIDEO",e[e.NONE=3]="NONE"}(cD||(cD={})),function(e){e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER"}(uD||(uD={})),function(e){e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED"}(dD||(dD={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(lD||(lD={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(hD||(hD={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(pD||(pD={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY"}(fD||(fD={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(_D||(_D={}));var mD="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function SD(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var ED="rtc.rtcplus.com".split(","),yD={VERSION:"4.41.1",ICE_CONFIG_REQUEST_URLS_INTERNAL:mD.map(SD),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:"https://web-log-report.rtcplus.com/video/v1/webrtc_log/",CONFIG_REQUEST_DOMAINS:ED};function gD(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(yD.ICE_CONFIG_REQUEST_URLS=t.map(SD))):void("LOG_SERVER_URL"!==e||t!==hD.overseas?"LOG_SERVER_URL"!==e||t!==hD.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?yD[e]=t:yD.LOG_SERVER_URL=t:yD.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/":yD.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function bD(e){return yD[e]}function TD(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||RD.audio.codec,bitRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.kBitRate)||RD.audio.kBitRate),sampleRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.sampleRate)||RD.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||RD.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||RD.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||RD.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||RD.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||RD.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:RD.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||RD.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||RD.video.width,height:(null===(f=t.video)||void 0===f?void 0:f.height)||RD.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||RD.layout.backgroundColor},regions:(null===(m=null===(v=t.layout)||void 0===v?void 0:v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(S=t.layout)||void 0===S?void 0:S.appData)||RD.layout.appData}}}}function ID(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)||_D.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===(l=null===(d=r.layout)||void 0===d?void 0:d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:e.alpha,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var RD={url:"",video:{codec:"H264",width:640,height:360,fps:30,gop:60,kBitRate:600,lowLatency:!0},audio:{codec:"AAC",kBitRate:64,sampleRate:48,channels:2,AACProfile:"LC"},layout:{regions:[],appData:"",backgroundColor:"#000000"}};(0,hR.exports)("Uint16",(function(e){return function(t,r,n){return e(this,t,r,n)}})),(0,hR.exports)("Int32",(function(e){return function(t,r,n){return e(this,t,r,n)}}));var AD={};!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=Array.prototype.slice.call(arguments,1);t.length;){var n=t.shift();if(n){if("object"!==us(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[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,n)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,i))},e.setTyped(t)}(AD);var CD={},OD={},ND={},wD=AD;function PD(e){for(var t=e.length;--t>=0;)e[t]=0}var DD=[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],kD=[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],MD=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],UD=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],LD=new Array(576);PD(LD);var xD=new Array(60);PD(xD);var VD=new Array(512);PD(VD);var FD=new Array(256);PD(FD);var BD=new Array(29);PD(BD);var jD,GD,HD,zD=new Array(30);function KD(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 YD(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function WD(e){return e<256?VD[e]:VD[256+(e>>>7)]}function XD(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function JD(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,XD(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 qD(e,t,r){JD(e,r[2*t],r[2*t+1])}function ZD(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function $D(e,t,r){var n,i,o=new Array(16),a=0;for(n=1;n<=15;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]=ZD(o[s]++,s))}}function QD(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;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 ek(e){e.bi_valid>8?XD(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 tk(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 rk(e,t,r){for(var n=e.heap[r],i=r<<1;i<=e.heap_len&&(i<e.heap_len&&tk(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!tk(t,n,e.heap[i],e.depth));)e.heap[r]=e.heap[i],r=i,i<<=1;e.heap[r]=n}function nk(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?qD(e,i,t):(qD(e,(o=FD[i])+256+1,t),0!==(a=DD[o])&&JD(e,i-=BD[o],a),qD(e,o=WD(--n),r),0!==(a=kD[o])&&JD(e,n-=zD[o],a))}while(s<e.last_lit);qD(e,256,t)}function ik(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--)rk(e,o,r);i=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],rk(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++,rk(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,_=0;for(o=0;o<=15;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,_++),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!==_){do{for(o=f-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[f]--,_-=2}while(_>0);for(o=f;0!==o;o--)for(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),$D(o,u,e.bl_count)}function ok(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 ak(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{qD(e,i,e.bl_tree)}while(0!=--s);else 0!==i?(i!==o&&(qD(e,i,e.bl_tree),s--),qD(e,16,e.bl_tree),JD(e,s-3,2)):s<=10?(qD(e,17,e.bl_tree),JD(e,s-3,3)):(qD(e,18,e.bl_tree),JD(e,s-11,7));s=0,o=i,0===a?(c=138,u=3):i===a?(c=6,u=3):(c=7,u=4)}}PD(zD);var sk=!1;function ck(e,t,r,n){JD(e,0+(n?1:0),3),function(e,t,r,n){ek(e),n&&(XD(e,r),XD(e,~r)),wD.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}ND._tr_init=function(e){sk||(!function(){var e,t,r,n,i,o=new Array(16);for(r=0,n=0;n<28;n++)for(BD[n]=r,e=0;e<1<<DD[n];e++)FD[r++]=n;for(FD[r-1]=n,i=0,n=0;n<16;n++)for(zD[n]=i,e=0;e<1<<kD[n];e++)VD[i++]=n;for(i>>=7;n<30;n++)for(zD[n]=i<<7,e=0;e<1<<kD[n]-7;e++)VD[256+i++]=n;for(t=0;t<=15;t++)o[t]=0;for(e=0;e<=143;)LD[2*e+1]=8,e++,o[8]++;for(;e<=255;)LD[2*e+1]=9,e++,o[9]++;for(;e<=279;)LD[2*e+1]=7,e++,o[7]++;for(;e<=287;)LD[2*e+1]=8,e++,o[8]++;for($D(LD,287,o),e=0;e<30;e++)xD[2*e+1]=5,xD[2*e]=ZD(e,5);jD=new KD(LD,DD,257,286,15),GD=new KD(xD,kD,0,30,15),HD=new KD(new Array(0),MD,0,19,7)}(),sk=!0),e.l_desc=new YD(e.dyn_ltree,jD),e.d_desc=new YD(e.dyn_dtree,GD),e.bl_desc=new YD(e.bl_tree,HD),e.bi_buf=0,e.bi_valid=0,QD(e)},ND._tr_stored_block=ck,ND._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<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),ik(e,e.l_desc),ik(e,e.d_desc),a=function(e){var t;for(ok(e,e.dyn_ltree,e.l_desc.max_code),ok(e,e.dyn_dtree,e.d_desc.max_code),ik(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*UD[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?ck(e,t,r,n):4===e.strategy||o===i?(JD(e,2+(n?1:0),3),nk(e,LD,xD)):(JD(e,4+(n?1:0),3),function(e,t,r,n){var i;for(JD(e,t-257,5),JD(e,r-1,5),JD(e,n-4,4),i=0;i<n;i++)JD(e,e.bl_tree[2*UD[i]+1],3);ak(e,e.dyn_ltree,t-1),ak(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),nk(e,e.dyn_ltree,e.dyn_dtree)),QD(e),n&&ek(e)},ND._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*(FD[r]+256+1)]++,e.dyn_dtree[2*WD(t)]++),e.last_lit===e.lit_bufsize-1},ND._tr_align=function(e){JD(e,2,3),qD(e,256,LD),function(e){16===e.bi_valid?(XD(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 uk=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 dk=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 lk,hk=function(e,t,r,n){var i=dk,o=n+r;e^=-1;for(var a=n;a<o;a++)e=e>>>8^i[255&(e^t[a])];return-1^e},pk={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"},fk=AD,_k=ND,vk=uk,mk=hk,Sk=pk;function Ek(e,t){return e.msg=Sk[t],t}function yk(e){return(e<<1)-(e>4?9:0)}function gk(e){for(var t=e.length;--t>=0;)e[t]=0}function bk(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(fk.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 Tk(e,t){_k._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,bk(e.strm)}function Ik(e,t){e.pending_buf[e.pending++]=t}function Rk(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function Ak(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-262?e.strstart-(e.w_size-262):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+258,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=258-(h-o),o=h-258,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 Ck(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-262)){fk.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,fk.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=vk(a.adler,s,d,c):2===a.state.wrap&&(a.adler=mk(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<262&&0!==e.strm.avail_in)}function Ok(e,t){for(var r,n;;){if(e.lookahead<262){if(Ck(e),e.lookahead<262&&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-262&&(e.match_length=Ak(e,r)),e.match_length>=3)if(n=_k._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=_k._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(n&&(Tk(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(Tk(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Tk(e,!1),0===e.strm.avail_out)?1:2}function Nk(e,t){for(var r,n,i;;){if(e.lookahead<262){if(Ck(e),e.lookahead<262&&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-262&&(e.match_length=Ak(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=_k._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&&(Tk(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((n=_k._tr_tally(e,0,e.window[e.strstart-1]))&&Tk(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=_k._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(Tk(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Tk(e,!1),0===e.strm.avail_out)?1:2}function wk(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 Pk(){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 fk.Buf16(1146),this.dyn_dtree=new fk.Buf16(122),this.bl_tree=new fk.Buf16(78),gk(this.dyn_ltree),gk(this.dyn_dtree),gk(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new fk.Buf16(16),this.heap=new fk.Buf16(573),gk(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new fk.Buf16(573),gk(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 Dk(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:113,e.adler=2===t.wrap?0:1,t.last_flush=0,_k._tr_init(t),0):Ek(e,-2)}function kk(e){var t,r=Dk(e);return 0===r&&((t=e.state).window_size=2*t.w_size,gk(t.head),t.max_lazy_match=lk[t.level].max_lazy,t.good_match=lk[t.level].good_length,t.nice_match=lk[t.level].nice_length,t.max_chain_length=lk[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 Mk(e,t,r,n,i,o){if(!e)return-2;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 Ek(e,-2);8===n&&(n=9);var s=new Pk;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 fk.Buf8(2*s.w_size),s.head=new fk.Buf16(s.hash_size),s.prev=new fk.Buf16(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new fk.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,kk(e)}lk=[new wk(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(Ck(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,Tk(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(Tk(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Tk(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(Tk(e,!1),e.strm.avail_out),1)})),new wk(4,4,8,4,Ok),new wk(4,5,16,8,Ok),new wk(4,6,32,32,Ok),new wk(4,4,16,16,Nk),new wk(8,16,32,32,Nk),new wk(8,16,128,128,Nk),new wk(8,32,128,256,Nk),new wk(32,128,258,1024,Nk),new wk(32,258,258,4096,Nk)],OD.deflateInit=function(e,t){return Mk(e,t,8,15,8,0)},OD.deflateInit2=Mk,OD.deflateReset=kk,OD.deflateResetKeep=Dk,OD.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?-2:(e.state.gzhead=t,0):-2},OD.deflate=function(e,t){var r,n,i,o;if(!e||!e.state||t>5||t<0)return e?Ek(e,-2):-2;if(n=e.state,!e.output||!e.input&&0!==e.avail_in||666===n.status&&4!==t)return Ek(e,0===e.avail_out?-5:-2);if(n.strm=e,r=n.last_flush,n.last_flush=t,42===n.status)if(2===n.wrap)e.adler=0,Ik(n,31),Ik(n,139),Ik(n,8),n.gzhead?(Ik(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)),Ik(n,255&n.gzhead.time),Ik(n,n.gzhead.time>>8&255),Ik(n,n.gzhead.time>>16&255),Ik(n,n.gzhead.time>>24&255),Ik(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),Ik(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(Ik(n,255&n.gzhead.extra.length),Ik(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=mk(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69):(Ik(n,0),Ik(n,0),Ik(n,0),Ik(n,0),Ik(n,0),Ik(n,9===n.level?2:n.strategy>=2||n.level<2?4:0),Ik(n,3),n.status=113);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=113,Rk(n,a),0!==n.strstart&&(Rk(n,e.adler>>>16),Rk(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=mk(e.adler,n.pending_buf,n.pending-i,i)),bk(e),i=n.pending,n.pending!==n.pending_buf_size));)Ik(n,255&n.gzhead.extra[n.gzindex]),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=mk(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=mk(e.adler,n.pending_buf,n.pending-i,i)),bk(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,Ik(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=mk(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=mk(e.adler,n.pending_buf,n.pending-i,i)),bk(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,Ik(n,o)}while(0!==o);n.gzhead.hcrc&&n.pending>i&&(e.adler=mk(e.adler,n.pending_buf,n.pending-i,i)),0===o&&(n.status=103)}else n.status=103;if(103===n.status&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&bk(e),n.pending+2<=n.pending_buf_size&&(Ik(n,255&e.adler),Ik(n,e.adler>>8&255),e.adler=0,n.status=113)):n.status=113),0!==n.pending){if(bk(e),0===e.avail_out)return n.last_flush=-1,0}else if(0===e.avail_in&&yk(t)<=yk(r)&&4!==t)return Ek(e,-5);if(666===n.status&&0!==e.avail_in)return Ek(e,-5);if(0!==e.avail_in||0!==n.lookahead||0!==t&&666!==n.status){var s=2===n.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(Ck(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=_k._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Tk(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Tk(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Tk(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<=258){if(Ck(e),e.lookahead<=258&&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+258;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=258-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=_k._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=_k._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Tk(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Tk(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Tk(e,!1),0===e.strm.avail_out)?1:2}(n,t):lk[n.level].func(n,t);if(3!==s&&4!==s||(n.status=666),1===s||3===s)return 0===e.avail_out&&(n.last_flush=-1),0;if(2===s&&(1===t?_k._tr_align(n):5!==t&&(_k._tr_stored_block(n,0,0,!1),3===t&&(gk(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),bk(e),0===e.avail_out))return n.last_flush=-1,0}return 4!==t?0:n.wrap<=0?1:(2===n.wrap?(Ik(n,255&e.adler),Ik(n,e.adler>>8&255),Ik(n,e.adler>>16&255),Ik(n,e.adler>>24&255),Ik(n,255&e.total_in),Ik(n,e.total_in>>8&255),Ik(n,e.total_in>>16&255),Ik(n,e.total_in>>24&255)):(Rk(n,e.adler>>>16),Rk(n,65535&e.adler)),bk(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?0:1)},OD.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&113!==t&&666!==t?Ek(e,-2):(e.state=null,113===t?Ek(e,-3):0):-2},OD.deflateSetDictionary=function(e,t){var r,n,i,o,a,s,c,u,d=t.length;if(!e||!e.state)return-2;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return-2;for(1===o&&(e.adler=vk(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(gk(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new fk.Buf8(r.w_size),fk.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,Ck(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,Ck(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},OD.deflateInfo="pako deflate (from Nodeca project)";var Uk={},Lk=AD,xk=!0,Vk=!0;try{String.fromCharCode.apply(null,[0])}catch(e){xk=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){Vk=!1}for(var Fk=new Lk.Buf8(256),Bk=0;Bk<256;Bk++)Fk[Bk]=Bk>=252?6:Bk>=248?5:Bk>=240?4:Bk>=224?3:Bk>=192?2:1;function jk(e,t){if(t<65534&&(e.subarray&&Vk||!e.subarray&&xk))return String.fromCharCode.apply(null,Lk.shrinkBuf(e,t));for(var r="",n=0;n<t;n++)r+=String.fromCharCode(e[n]);return r}Fk[254]=Fk[254]=1,Uk.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 Lk.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},Uk.buf2binstring=function(e){return jk(e,e.length)},Uk.binstring2buf=function(e){for(var t=new Lk.Buf8(e.length),r=0,n=t.length;r<n;r++)t[r]=e.charCodeAt(r);return t},Uk.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=Fk[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 jk(s,n)},Uk.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+Fk[e[r]]>t?r:t};var Gk=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},Hk=OD,zk=AD,Kk=Uk,Yk=pk,Wk=Gk,Xk=Object.prototype.toString;function Jk(e){if(!(this instanceof Jk))return new Jk(e);this.options=zk.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 Wk,this.strm.avail_out=0;var r=Hk.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(Yk[r]);if(t.header&&Hk.deflateSetHeader(this.strm,t.header),t.dictionary){var n;if(n="string"==typeof t.dictionary?Kk.string2buf(t.dictionary):"[object ArrayBuffer]"===Xk.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=Hk.deflateSetDictionary(this.strm,n)))throw new Error(Yk[r]);this._dict_set=!0}}function qk(e,t){var r=new Jk(t);if(r.push(e,!0),r.err)throw r.msg||Yk[r.err];return r.result}Jk.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=Kk.string2buf(e):"[object ArrayBuffer]"===Xk.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 zk.Buf8(o),i.next_out=0,i.avail_out=o),1!==(r=Hk.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(Kk.buf2binstring(zk.shrinkBuf(i.output,i.next_out))):this.onData(zk.shrinkBuf(i.output,i.next_out)))}while((i.avail_in>0||0===i.avail_out)&&1!==r);return 4===n?(r=Hk.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==n||(this.onEnd(0),i.avail_out=0,!0)},Jk.prototype.onData=function(e){this.chunks.push(e)},Jk.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=zk.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},CD.Deflate=Jk,CD.deflate=qk,CD.deflateRaw=function(e,t){return(t=t||{}).raw=!0,qk(e,t)},CD.gzip=function(e,t){return(t=t||{}).gzip=!0,qk(e,t)};var Zk={},$k=a,Qk=Rt,eM=aa,tM=o,rM=RegExp.prototype;$k&&tM((function(){return"sy"!==Object.getOwnPropertyDescriptor(rM,"flags").get.call({dotAll:!0,sticky:!0})}))&&Qk.f(rM,"flags",{configurable:!0,get:eM});var nM={},iM=AD,oM=[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],aM=[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],sM=[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],cM=[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],uM=AD,dM=uk,lM=hk,hM=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A;r=e.state,n=e.next_in,R=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,_=r.lencode,v=r.distcode,m=(1<<r.lenbits)-1,S=(1<<r.distbits)-1;e:do{f<15&&(p+=R[n++]<<f,f+=8,p+=R[n++]<<f,f+=8),E=_[p&m];t:for(;;){if(p>>>=y=E>>>24,f-=y,0===(y=E>>>16&255))A[o++]=65535&E;else{if(!(16&y)){if(0==(64&y)){E=_[(65535&E)+(p&(1<<y)-1)];continue t}if(32&y){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}g=65535&E,(y&=15)&&(f<y&&(p+=R[n++]<<f,f+=8),g+=p&(1<<y)-1,p>>>=y,f-=y),f<15&&(p+=R[n++]<<f,f+=8,p+=R[n++]<<f,f+=8),E=v[p&S];r:for(;;){if(p>>>=y=E>>>24,f-=y,!(16&(y=E>>>16&255))){if(0==(64&y)){E=v[(65535&E)+(p&(1<<y)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&E,f<(y&=15)&&(p+=R[n++]<<f,(f+=8)<y&&(p+=R[n++]<<f,f+=8)),(b+=p&(1<<y)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=y,f-=y,b>(y=o-a)){if((y=b-y)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(T=0,I=h,0===l){if(T+=u-y,y<g){g-=y;do{A[o++]=h[T++]}while(--y);T=o-b,I=A}}else if(l<y){if(T+=u+l-y,(y-=l)<g){g-=y;do{A[o++]=h[T++]}while(--y);if(T=0,l<g){g-=y=l;do{A[o++]=h[T++]}while(--y);T=o-b,I=A}}}else if(T+=l-y,y<g){g-=y;do{A[o++]=h[T++]}while(--y);T=o-b,I=A}for(;g>2;)A[o++]=I[T++],A[o++]=I[T++],A[o++]=I[T++],g-=3;g&&(A[o++]=I[T++],g>1&&(A[o++]=I[T++]))}else{T=o-b;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],g-=3}while(g>2);g&&(A[o++]=A[T++],g>1&&(A[o++]=A[T++]))}break}}break}}while(n<i&&o<s);n-=g=f>>3,p&=(1<<(f-=g<<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},pM=function(e,t,r,n,i,o,a,s){var c,u,d,l,h,p,f,_,v,m=s.bits,S=0,E=0,y=0,g=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,N=0,w=new iM.Buf16(16),P=new iM.Buf16(16),D=null,k=0;for(S=0;S<=15;S++)w[S]=0;for(E=0;E<n;E++)w[t[r+E]]++;for(b=m,g=15;g>=1&&0===w[g];g--);if(b>g&&(b=g),0===g)return i[o++]=20971520,i[o++]=20971520,s.bits=1,0;for(y=1;y<g&&0===w[y];y++);for(b<y&&(b=y),R=1,S=1;S<=15;S++)if(R<<=1,(R-=w[S])<0)return-1;if(R>0&&(0===e||1!==g))return-1;for(P[1]=0,S=1;S<15;S++)P[S+1]=P[S]+w[S];for(E=0;E<n;E++)0!==t[r+E]&&(a[P[t[r+E]]++]=E);if(0===e?(O=D=a,p=19):1===e?(O=oM,N-=257,D=aM,k-=257,p=256):(O=sM,D=cM,p=-1),C=0,E=0,S=y,h=o,T=b,I=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){f=S-I,a[E]<p?(_=0,v=a[E]):a[E]>p?(_=D[k+a[E]],v=O[N+a[E]]):(_=96,v=0),c=1<<S-I,y=u=1<<T;do{i[h+(C>>I)+(u-=c)]=f<<24|_<<16|v|0}while(0!==u);for(c=1<<S-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,E++,0==--w[S]){if(S===g)break;S=t[r+a[E]]}if(S>b&&(C&l)!==d){for(0===I&&(I=b),h+=y,R=1<<(T=S-I);T+I<g&&!((R-=w[T+I])<=0);)T++,R<<=1;if(A+=1<<T,1===e&&A>852||2===e&&A>592)return 1;i[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(i[h+C]=S-I<<24|64<<16|0),s.bits=b,0};function fM(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function _M(){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 uM.Buf16(320),this.work=new uM.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function vM(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 uM.Buf32(852),t.distcode=t.distdyn=new uM.Buf32(592),t.sane=1,t.back=-1,0):-2}function mM(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,vM(e)):-2}function SM(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)?-2:(null!==n.window&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,mM(e))):-2}function EM(e,t){var r,n;return e?(n=new _M,e.state=n,n.window=null,0!==(r=SM(e,t))&&(e.state=null),r):-2}var yM,gM,bM=!0;function TM(e){if(bM){var t;for(yM=new uM.Buf32(512),gM=new uM.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(pM(1,e.lens,0,288,yM,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;pM(2,e.lens,0,32,gM,0,e.work,{bits:5}),bM=!1}e.lencode=yM,e.lenbits=9,e.distcode=gM,e.distbits=5}function IM(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 uM.Buf8(o.wsize)),n>=o.wsize?(uM.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),uM.arraySet(o.window,t,r-n,i,o.wnext),(n-=i)?(uM.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}nM.inflateReset=mM,nM.inflateReset2=SM,nM.inflateResetKeep=vM,nM.inflateInit=function(e){return EM(e,15)},nM.inflateInit2=EM,nM.inflate=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A=0,C=new uM.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(r=e.state).mode&&(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,T=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,C[0]=255&u,C[1]=u>>>8&255,r.check=lM(r.check,C,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=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;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=30;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:12,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&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=lM(r.check,C,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&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,r.check=lM(r.check,C,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&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=lM(r.check,C,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&r.flags){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&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=lM(r.check,C,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((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)),uM.arraySet(r.head.extra,n,o,p,b)),512&r.flags&&(r.check=lM(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&r.flags){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&r.flags&&(r.check=lM(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&r.flags){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&r.flags&&(r.check=lM(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&r.flags){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=30;break}u=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}e.adler=r.check=fM(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=12;case 12: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(TM(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=30}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=30;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;uM.arraySet(i,n,o,p,a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=12;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=30;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[O[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,I={bits:r.lenbits},T=pM(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid code lengths set",r.mode=30;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,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(S<16)u>>>=v,d-=v,r.lens[r.have++]=S;else{if(16===S){for(R=v+2;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(u>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}b=r.lens[r.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===S){for(R=v+3;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=v,b=0,p=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(R=v+7;d<R;){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}d-=v,b=0,p=11+(127&(u>>>=v)),u>>>=7,d-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=b}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,I={bits:r.lenbits},T=pM(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},T=pM(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,T){e.msg="invalid distances set",r.mode=30;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,hM(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,12===r.mode&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(m&&0==(240&m)){for(E=v,y=m,g=S;m=(A=r.lencode[g+((u&(1<<E+y)-1)>>E)])>>>16&255,S=65535&A,!(E+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=E,d-=E,r.back+=E}if(u>>>=v,d-=v,r.back+=v,r.length=S,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=12;break}if(64&m){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(R=r.extra;d<R;){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,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}if(0==(240&m)){for(E=v,y=m,g=S;m=(A=r.distcode[g+((u&(1<<E+y)-1)>>E)])>>>16&255,S=65535&A,!(E+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=n[o++]<<d,d+=8}u>>>=E,d-=E,r.back+=E}if(u>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=30;break}r.offset=S,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(R=r.extra;d<R;){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=30;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=30;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),_=r.window}else _=i,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{i[a++]=_[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=r.flags?lM(r.check,i,h,a-h):dM(r.check,i,h,a-h)),h=c,(r.flags?u:fM(u))!==r.check){e.msg="incorrect data check",r.mode=30;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){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=30;break}u=0,d=0}r.mode=29;case 29:T=1;break e;case 30:T=-3;break e;case 31:return-4;default:return-2}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<30&&(r.mode<27||4!==t))&&IM(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=r.flags?lM(r.check,i,h,e.next_out-h):dM(r.check,i,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},nM.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},nM.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?-2:(r.head=t,t.done=!1,0):-2},nM.inflateSetDictionary=function(e,t){var r,n=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?-2:11===r.mode&&dM(1,t,n,0)!==r.check?-3:IM(e,t,n,n)?(r.mode=31,-4):(r.havedict=1,0):-2},nM.inflateInfo="pako inflate (from Nodeca project)";var RM={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 AM=nM,CM=AD,OM=Uk,NM=RM,wM=pk,PM=Gk,DM=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},kM=Object.prototype.toString;function MM(e){if(!(this instanceof MM))return new MM(e);this.options=CM.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 PM,this.strm.avail_out=0;var r=AM.inflateInit2(this.strm,t.windowBits);if(r!==NM.Z_OK)throw new Error(wM[r]);if(this.header=new DM,AM.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=OM.string2buf(t.dictionary):"[object ArrayBuffer]"===kM.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=AM.inflateSetDictionary(this.strm,t.dictionary))!==NM.Z_OK))throw new Error(wM[r])}function UM(e,t){var r=new MM(t);if(r.push(e,!0),r.err)throw r.msg||wM[r.err];return r.result}MM.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?NM.Z_FINISH:NM.Z_NO_FLUSH,"string"==typeof e?s.input=OM.binstring2buf(e):"[object ArrayBuffer]"===kM.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 CM.Buf8(c),s.next_out=0,s.avail_out=c),(r=AM.inflate(s,NM.Z_NO_FLUSH))===NM.Z_NEED_DICT&&u&&(r=AM.inflateSetDictionary(this.strm,u)),r===NM.Z_BUF_ERROR&&!0===d&&(r=NM.Z_OK,d=!1),r!==NM.Z_STREAM_END&&r!==NM.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==NM.Z_STREAM_END&&(0!==s.avail_in||n!==NM.Z_FINISH&&n!==NM.Z_SYNC_FLUSH)||("string"===this.options.to?(i=OM.utf8border(s.output,s.next_out),o=s.next_out-i,a=OM.buf2string(s.output,i),s.next_out=o,s.avail_out=c-o,o&&CM.arraySet(s.output,s.output,i,o,0),this.onData(a)):this.onData(CM.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!==NM.Z_STREAM_END);return r===NM.Z_STREAM_END&&(n=NM.Z_FINISH),n===NM.Z_FINISH?(r=AM.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===NM.Z_OK):n!==NM.Z_SYNC_FLUSH||(this.onEnd(NM.Z_OK),s.avail_out=0,!0)},MM.prototype.onData=function(e){this.chunks.push(e)},MM.prototype.onEnd=function(e){e===NM.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=CM.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},Zk.Inflate=MM,Zk.inflate=UM,Zk.inflateRaw=function(e,t){return(t=t||{}).raw=!0,UM(e,t)},Zk.ungzip=UM;var LM={};(0,AD.assign)(LM,CD,Zk,RM);var xM,VM,FM,BM,jM,GM,HM,zM,KM,YM,WM,XM,JM,qM,ZM,$M,QM,eU,tU,rU,nU,iU,oU,aU,sU,cU,uU,dU,lU,hU,pU,fU,_U,vU,mU,SU,EU,yU,gU,bU,TU,IU,RU,AU,CU,OU,NU,wU=LM,PU=new wP("monitor",0);!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",e.RTC_GET_CONFIG="rtc_get_config",e.RTC_RECONNECT="rtc_reconnect",e.RTC_RECONNECTED="rtc_reconnected",e.RTC_GET_ACCESS="rtc_get_access",e.RTC_PRE_ICE_STATE="rtc_pre_ice_state",e.RTC_NODE_CHANGE="rtc_node_change",e.RTC_SIGNALING_MSG_ERROR="rtc_signaling_msg_error",e.RTC_SIGNALING="rtc_signaling",e.RTC_JOIN_ROOM="rtc_join_room",e.RTC_LEAVE_ROOM="rtc_leave_room",e.RTC_BEGIN_CREATE_OFFER="rtc_begin_create_offer",e.RTC_CREATE_OFFER="rtc_create_offer",e.RTC_SET_DESCRIPTION="rtc_set_description",e.RTC_RECV_ANSWER="rtc_recv_answer",e.FIRST_REMOTE_AUDIO_RENDER="first_remote_audio_render",e.FIRST_REMOTE_VIDEO_RENDER="first_remote_video_render",e.RTC_PUBLISH_STAT="rtc_publish_stat",e.RTC_SUBSCRIBE_STAT="rtc_subscribe_stat",e.RTC_AUDIO_DEVICE="rtc_audio_device",e.RTC_MEDIA_STATISTICS="rtc_media_statistics",e.RTC_MESSAGE_STATISTICS="rtc_message_statistics",e.RTC_ERROR="rtc_error",e.RTC_INVOKE_STATUS="rtc_invoke_status",e.RTC_FIRST_FRAME="rtc_first_frame",e.RTC_MUTE_REMOTE="rtc_mute_remote",e.SDK_INIT_ENGINE="sdk_init_engine",e.JOIN_ROOM="join_room",e.P2P_CONNECTION_STATUS="p2p_connection_status",e.P2P_CONNECT_CLOSED="p2p_connect_closed",e.RTC_DEVICE_ERROR="rtc_device_error",e.RTC_VIDEO_DEVICE="rtc_video_device",e.RTC_VIDEO_CAPTURE_EVENT="rtc_video_capture_event",e.RTC_ENCODE_FIRST_FRAME="rtc_encode_first_frame",e.RTC_FIRST_FRAME_ENCODED="rtc_first_frame_encoded",e.RTC_SEND_FIRST_PACKET="rtc_send_first_packet",e.RTC_RECV_FIRST_PACKET="rtc_recv_first_packet",e.RTC_RECV_FIRST_FRAME="rtc_recv_first_frame",e.RTC_DECODE_FIRST_FRAME="rtc_decode_first_frame"}(xM||(xM={})),function(e){e.RTC="rtc"}(VM||(VM={})),function(e){e.W_5="5"}(FM||(FM={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(BM||(BM={})),function(e){e.UNKNOWN="unknown",e.DISCONNECTED="disconnected",e.LAN="lan",e.WIFI="wifi",e.W_2="2g",e.W_3="3g",e.W_4="4g",e.W_5="5g"}(jM||(jM={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(GM||(GM={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(HM||(HM={})),function(e){e.WEBSOCKET_RECONNECTING="websocket reconnecting",e.PEERCONNECTION_RECONNECTING="peerconnection reconnecting",e.DISCONNECTED="DISCONNECTED",e.LAN="LAN",e.WIFI="WIFI",e.W_2="2G",e.W_3="3G",e.W_4="4G",e.W_5="5G",e.UNKNOWN="UNKNOWN"}(zM||(zM={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(KM||(KM={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(YM||(YM={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(WM||(WM={})),function(e){e.REQUEST="request",e.RESPONSE="response",e.KCP_REQUEST="kcp request",e.KCP_RESPONSE="kcp response",e.QUIC_REQUEST="quic request",e.QUIC_RESPONSE="quic response"}(XM||(XM={})),function(e){e.NEW="NEW",e.CHECKING="CHECKING",e.CONNECTED="CONNECTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED",e.DATACHANNEL_CONNECTING="DATACHANNEL_CONNECTING",e.DATACHANNEL_OPEN="DATACHANNEL_OPEN",e.DATACHANNEL_CLOSING="DATACHANNEL_CLOSING",e.DATACHANNEL_CLOSED="DATACHANNEL_CLOSED"}(JM||(JM={})),function(e){e.SUCCEED="succeed",e.MESSAGE_ID_ERROR="message id error",e.ZIP_FAILED="zip failed",e.UNZIP_FAILED="unzip failed",e.MESSAGE_KEY_EMPTY="message key empty",e.MESSAGE_KEY_PARSE_FAILED="message key parse failed",e.MESSAGE_KEY_INVALID="message key invalid",e.ENCRYPT_FAILED="encrypt failed",e.DECRYPT_FAILED="decrypt failed",e.MESSAGE_TOO_BIG="message too big",e.INVALID_DATA="invalid data",e.MESSAGE_PARSE_FAILED="message parse failed"}(qM||(qM={})),function(e){e.CALL_JOINROOM="call-joinRoom",e.JOINROOM="joinRoom",e.CALL_RECONNECTED="call-reconnected",e.RECONNECTED="reconnected",e.CALL_PUBLISH="call-publish",e.PUBLISH="publish",e.CALL_UPDATESTREAMATTRIBUTES="call-updateStreamAttributes",e.UPDATESTREAMATTRIBUTES="updateStreamAttributes",e.CALL_UNPUBLISH="call-unpublish",e.UNPUBLISH="unpublish",e.CALL_SUBSCRIBE="call-subscribe",e.SUBSCRIBE="subscribe",e.CALL_UPDATESUBSCRIBE="call-updateSubscribe",e.UPDATESUBSCRIBE="updateSubscribe",e.CALL_UNSUBSCRIBE="call-unsubscribe",e.UNSUBSCRIBE="unsubscribe",e.CALL_UPDATEUSERATTRIBUTES="call-updateUserAttributes",e.UPDATEUSERATTRIBUTES="updateUserAttributes",e.CALL_LEAVEROOM="call-leaveRoom",e.LEAVEROOM="leaveRoom",e.ON_USERCONNECTION="on-userConnection",e.ON_USERDISCONNECTION="on-userDisconnection",e.ON_ONADDSTREAM="on-onAddStream",e.ON_ONPUSHSTREAM="on-onPushStream",e.ON_ONREMOVESTREAM="on-onRemoveStream",e.ON_ONPUSHTRACK="on-onPushTrack",e.ON_ONREMOVETRACK="on-onRemoveTrack",e.ON_ONUPDATEUSERATTRIBUTES="on-onUpdateUserAttributes",e.ON_ONUPDATEROOMATTRIBUTES="on-onUpdateRoomAttributes",e.ON_ONUPDATESTREAMATTRIBUTES="on-onUpdateStreamAttributes",e.ON_STREAMFAILED="on-streamFailed",e.ON_POSTPROCESSINGMESSAGE="on-postProcessingMessage",e.ON_ENGINECONTROLMESSAGE="on-engineControlMessage",e.ON_WEBSOCKETENGINECUSTOMMESSAGE="on-websocketEngineCustomMessage",e.UNKNOWN="unknown",e.CALL_UPDATEPUBLISHSTREAMCHANNEL="call-updatePublishStreamChannel",e.UPDATEPUBLISHSTREAMCHANNEL="updatePublishStreamChannel",e.CALL_UPDATESUBSCRIBESTREAMCHANNEL="call-updateSubscribeStreamChannel",e.UPDATESUBSCRIBESTREAMCHANNEL="updateSubscribeStreamChannel",e.ON_ONSTREAMCHANNELCHANGE="on-onStreamChannelChange",e.P2PDIRECT="p2pdirect",e.INTERNAL_CUSTOM="internal_custom",e.REPORT="report",e.CONNECTION_CONTROL="connection_control",e.ON_INTERNAL_CUSTOM="on_internal_custom",e.CONTROLMESSAGE="controlMessage",e.CALL_LOGIN="call-login",e.LOGIN="login",e.CALL_RECONNECTLOGIN="call-reconnectLogin",e.RECONNECTLOGIN="reconnectLogin",e.CALL_LOGOUT="call-logout",e.LOGOUT="logout",e.CALL_UPDATELOGINTOKEN="call-updateLoginToken",e.UPDATELOGINTOKEN="updateLoginToken",e.CALL_SETSERVERPARAMS="call-setServerParams",e.SETSERVERPARAMS="setServerParams",e.CALL_GETPEERONLINESTATUS="call-getPeerOnlineStatus",e.GETPEERONLINESTATUS="getPeerOnlineStatus",e.ON_ONSCENECONFIG="on-onSceneConfig",e.ON_STREAMCONTROLMESSAGE="on-streamControlMessage",e.CALL_STARTPUSHSTREAM="call-startPushStream",e.STARTPUSHSTREAM="startPushStream",e.CALL_STOPPUSHSTREAM="call-stopPushStream",e.STOPPUSHSTREAM="stopPushStream",e.CALL_STARTPULLSTREAM="call-startPullStream",e.STARTPULLSTREAM="startPullStream",e.CALL_STOPPULLSTREAM="call-stopPullStream",e.STOPPULLSTREAM="stopPullStream",e.CALL_UPDATEPULLSTREAM="call-updatePullStream",e.UPDATEPULLSTREAM="updatePullStream",e.ON_ONSTREAMPUSHEDBYOTHER="on-onStreamPushedByOther",e.CALL_UPDATETOKEN="call-updateToken",e.UPDATETOKEN="updateToken",e.ON_ONTOKENWILLEXPIRE="on-onTokenWillExpire"}(ZM||(ZM={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}($M||($M={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(QM||(QM={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(eU||(eU={})),function(e){e.W_0="0",e.W_1="1"}(tU||(tU={})),function(e){e.UP="up",e.DOWN="down"}(rU||(rU={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(nU||(nU={})),function(e){e.UP="up",e.DOWN="down"}(iU||(iU={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(oU||(oU={})),function(e){e.W_0="0",e.W_1="1"}(aU||(aU={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown"}(sU||(sU={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(cU||(cU={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.ON_STREAM_REMOVE="on stream remove",e.PUBLISH_MUTE="publish mute",e.UNKNOWN="unknown",e.ON_STREAM_REMOVE_CLIENT_UNPUBLISHED="on stream remove:client unpublished",e.ON_STREAM_REMOVE_PUBLISH_FAILED="on stream remove:publish failed",e.ON_STREAM_REMOVE_STREAM_REMOVED="on stream remove:stream removed",e.ON_STREAM_REMOVE_CLIENT_DISCONNECTED="on stream remove:client disconnected",e.ON_STREAM_REMOVE_CLIENT_REPUBLISH="on stream remove:client republish"}(uU||(uU={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(dU||(dU={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(lU||(lU={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(hU||(hU={})),function(e){e.LOGIN="login",e.PUBLISHER="publisher",e.UNMUTE="unmute",e.ENABLE="enable",e.PUSH="push",e.PUBLISH="publish",e.ONDEMAND="ondemand",e.SUBSCRIBE="subscribe",e.PUSH_TRACK="push_track",e.REMOTE_UNMUTE="remote_unmute",e.P2P="p2p"}(pU||(pU={})),function(e){e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave"}(fU||(fU={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(_U||(_U={})),function(e){e.BEGIN="begin",e.END="end"}(vU||(vU={})),function(e){e.BEGIN="begin",e.END="end"}(mU||(mU={})),function(e){e.LEAVE_ROOM="leave_room",e.ACK_FAILED="ack_failed",e.TOKEN_ERROR="token_error",e.SIGNALING_ERROR="signaling_error",e.TIMEOUT_10="timeout_10",e.TIMEOUT_60="timeout_60"}(SU||(SU={})),function(e){e.UNKNOWN="unknown",e.NEW="new",e.CHECKING="checking",e.CONNECTED="connected",e.FAILED="failed",e.SELECTED="selected",e.CLOSING="closing",e.CLOSED="closed",e.UNSELECTED="unselected"}(EU||(EU={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(yU||(yU={})),function(e){e.UNKNOWN="UNKNOWN",e.AUDIO_RECORD="AUDIO_RECORD",e.AUDIO_PLAYOUT="AUDIO_PLAYOUT",e.VIDEO="VIDEO",e.SHARE_AUDIO_RECORD="SHARE_AUDIO_RECORD",e.SHARE_VIDEO="SHARE_VIDEO"}(gU||(gU={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(bU||(bU={})),function(e){e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped"}(TU||(TU={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(IU||(IU={})),function(e){e.SUCCESS="success",e.CAMERA_DEVICE_NO_PERMISSION="camera_device_no_permission",e.CAMERA_DEVICE_BUSY="camera_device_busy",e.CAMERA_DEVICE_FAILURE="camera_device_failure",e.CAMERA_DEVICE_NOT_FOUND="camera_device_not_found",e.CAMERA_DEVICE_DISCONNECTED="camera_device_disconnected",e.TIMEOUT="timeout",e.ABORT="abort"}(RU||(RU={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(AU||(AU={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(CU||(CU={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(OU||(OU={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(NU||(NU={}));var DU,kU,MU,UU,LU,xU,VU,FU,BU,jU=function(){function e(e){this.monitor=e}return e.prototype.setStats=function(e){var t=this;Object.keys(e).forEach((function(r){t["_"+r]=e[r]})),this.monitor.StartUp()},Object.defineProperty(e.prototype,"event_key",{get:function(){return this._event_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_id",{get:function(){return this._device_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_app_id",{get:function(){return this._rtc_app_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"product_line",{get:function(){return this._product_line},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_version",{get:function(){return this._report_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"os",{get:function(){return this._os},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_version",{get:function(){return this._rtc_sdk_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_timestamp",{get:function(){return this._rtc_timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_git_commit",{get:function(){return this._rtc_sdk_git_commit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_id",{get:function(){return this._report_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connection_id",{get:function(){return this._connection_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sid",{get:function(){return this._rtc_sid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"engine_session_id",{get:function(){return this._engine_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_business_id",{get:function(){return this._rtc_business_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"project_key",{get:function(){return this._project_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"network_type",{get:function(){return this._network_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app_version",{get:function(){return this._app_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aid",{get:function(){return this._aid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_model",{get:function(){return this._device_model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_brand",{get:function(){return this._device_brand},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"common_extra_info",{get:function(){return this._common_extra_info},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"had_selected_p2p",{get:function(){return this._had_selected_p2p},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_env_type",{get:function(){return this._rtc_env_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"room_id",{get:function(){return this._room_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_id",{get:function(){return this._user_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_session_id",{get:function(){return this._rtc_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_agent",{get:function(){return this._user_agent},enumerable:!1,configurable:!0}),e}(),GU=function(e){function t(){var t=e.call(this)||this;return t.report_id=0,t.dataBuffer=[],t.posting=!1,t.report_common={},t.modify_ids={},t.preSucTime=0,t.errSendDelay=100,t.commonStats=new jU(t),oP()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return Z_(t,e),t.prototype.push=function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))},t.prototype.unshift=function(e){this.dataBuffer=e.concat(this.dataBuffer)},t.prototype.send=function(e,t){var r=this;if(e||this.dataBuffer.length){var n={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},i=new XMLHttpRequest;i.timeout=1e4,i.onreadystatechange=function(){if(4===i.readyState){e||(r.posting=!1);var o=void 0;if(200===i.status||304===i.status)try{o=JSON.parse(i.responseText)}catch(e){}o&&0===o.StatusCode?e||t||r.sucSend():e?r.send(e):(r.unshift(n.data),t?r.send():r.errSend())}};var o=yD.LOG_SERVER_URL;if(i.open("POST",o,!0),e||(this.posting=!0),!oP()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",n),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!oP()&&location.search.includes("_rtc_debug_"))i.send(JSON.stringify(n));else{var a=wU.gzip(JSON.stringify(n));i.setRequestHeader("Content-Encoding","gzip"),i.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),i.send(a)}}},t.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},t.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},t.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,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.connection_id,p=t.rtc_sid,f=t.engine_session_id,_=t.rtc_business_id,v=t.project_key,m=t.network_type,S=t.app_version,E=t.aid,y=t.device_model,g=t.device_brand,b=t.common_extra_info,T=t.had_selected_p2p,I=t.rtc_env_type,R=t.user_agent;Object.assign(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,connection_id:h,rtc_sid:p,engine_session_id:f,rtc_business_id:_,project_key:v,network_type:m,app_version:S,aid:E,device_model:y,device_brand:g,common_extra_info:b,had_selected_p2p:T,rtc_env_type:I,user_agent:R}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id)},t.prototype.rtcSdkApiCall=function(e,t,r,n){void 0===n&&(n={});var i=$_($_({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:JSON.stringify(n)});this.push(i)},t.prototype.rtcSdkCallback=function(e,t,r,n){void 0===n&&(n={});var i=$_($_({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:JSON.stringify(n)});this.push(i)},t.prototype.rtcGetConfig=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=$_($_({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:JSON.stringify(s)});this.push(c)},t.prototype.rtcReconnect=function(e,t,r,n,i){void 0===i&&(i={});var o=$_($_({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:JSON.stringify(i)});this.push(o)},t.prototype.rtcReconnected=function(e,t,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcGetAccess=function(e,t,r,n,i,o,a){void 0===a&&(a={});var s=$_($_({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:JSON.stringify(a)});this.push(s)},t.prototype.rtcPreIceState=function(e,t,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcNodeChange=function(e,t,r,n){void 0===n&&(n={});var i=$_($_({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:JSON.stringify(n)});this.push(i)},t.prototype.rtcSignalingMsgError=function(e,t,r,n){void 0===n&&(n={});var i=$_($_({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:JSON.stringify(n)});this.push(i)},t.prototype.rtcSignaling=function(e,t,r,n,i,o){void 0===o&&(o={});var a=$_($_({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:n,direction:i},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcJoinRoom=function(e,t,r,n,i){void 0===i&&(i={});var o=$_($_({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:JSON.stringify(i)});this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,r,n){void 0===n&&(n={});var i=$_($_({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:JSON.stringify(n)});this.push(i)},t.prototype.rtcBeginCreateOffer=function(e,t,r,n){void 0===n&&(n={});var i=$_($_({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:JSON.stringify(n)});this.push(i)},t.prototype.rtcCreateOffer=function(e,t,r,n,i,o){void 0===o&&(o={});var a=$_($_({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:JSON.stringify(o)});this.push(a)},t.prototype.rtcSetDescription=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=$_($_({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),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcRecvAnswer=function(e,t,r,n,i,o,a,s){void 0===s&&(s={});var c=$_($_({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:JSON.stringify(s)});this.push(c)},t.prototype.firstRemoteAudioRender=function(e,t,r){void 0===r&&(r={});var n=$_($_({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.firstRemoteVideoRender=function(e,t,r){void 0===r&&(r={});var n=$_($_({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcPublishStat=function(e,t,r,n,i){void 0===i&&(i={});var o=$_($_({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:JSON.stringify(i)});this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,r,n,i){void 0===i&&(i={});var o=$_($_({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:JSON.stringify(i)});this.push(o)},t.prototype.rtcAudioDevice=function(e,t,r,n){void 0===n&&(n={});var i=$_($_({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:JSON.stringify(n)});this.push(i)},t.prototype.rtcMediaStatistics=function(e,t,r){void 0===r&&(r={});var n=$_($_($_($_({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcMessageStatistics=function(e,t,r,n){void 0===n&&(n={});var i=$_($_($_($_($_({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),{media_server_ip:r}),this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(i)},t.prototype.rtcError=function(e,t,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcInvokeStatus=function(e,t,r,n,i,o){void 0===o&&(o={});var a=$_($_({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),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var r=$_($_($_({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});PU.print("rtcFirstFrame",JSON.stringify(e)),this.push(r)},t.prototype.rtcMuteRemote=function(e,t,r){void 0===r&&(r={});var n=$_($_($_($_({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now()},e),{media_type:t}),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.sdkInitEngine=function(e,t,r){void 0===r&&(r={});var n=$_($_({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.joinRoom=function(e,t,r,n,i){void 0===i&&(i={});var o=$_($_({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:JSON.stringify(i)});this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,r,n,i,o){void 0===o&&(o={});var a=$_($_({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:JSON.stringify(o)});this.push(a)},t.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var r=$_($_({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(r)},t.prototype.rtcDeviceError=function(e,t,r,n,i,o,a,s,c,u,d,l,h,p,f,_,v){void 0===v&&(v={});var m=$_($_({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:_},this.modify_ids),{common_extra_info:JSON.stringify(v)});this.push(m)},t.prototype.rtcVideoDevice=function(e,t,r){void 0===r&&(r={});var n=$_($_({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var r=$_($_($_({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(r)},t.prototype.rtcEncodeFirstFrame=function(e,t,r){void 0===r&&(r={});var n=$_($_($_($_({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcFirstFrameEncoded=function(e,t,r){void 0===r&&(r={});var n=$_($_($_($_({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcSendFirstPacket=function(e,t,r){void 0===r&&(r={});var n=$_($_($_($_({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcRecvFirstPacket=function(e,t,r){void 0===r&&(r={});var n=$_($_($_($_({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcRecvFirstFrame=function(e,t,r){void 0===r&&(r={});var n=$_($_($_($_({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t.prototype.rtcDecodeFirstFrame=function(e,t,r){void 0===r&&(r={});var n=$_($_($_($_({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(n)},t}(DP),HU=new GU,zU=new GU,KU=new GU,YU=HU.commonStats,WU=zU.commonStats,XU=KU.commonStats,JU={default:HU,rtm:zU,outsideRoom:KU};function qU(e){void 0===e&&(e="default");for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r,n,i){if("function"==typeof i.value){var o=i.value;i.value=function(){for(var r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];var a={};t.forEach((function(e,t){a[e]=r[t]})),JU[e].rtcSdkApiCall(n,0,JSON.stringify(dP(r)),a);var s=o.apply(this,r);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return JU[e].rtcSdkCallback(n,0,JSON.stringify(dP([t||{}]))),t})).catch((function(t){throw JU[e].rtcSdkCallback(n,t.code,JSON.stringify(t.message)),t})):(JU[e].rtcSdkCallback(n,0,JSON.stringify(dP([s||{}]))),s)}}}}function ZU(e,t,r){void 0===r&&(r=0),(e===lP.onUserMessageReceivedOutsideRoom||e===lP.onUserBinaryMessageReceivedOutsideRoom?zU:HU).rtcSdkCallback(e,r,JSON.stringify(t))}function $U(e,t,r,n){void 0===r&&(r=0),void 0===n&&(n=!1),(n?zU:HU).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}!function(e){e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted"}(DU||(DU={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire"}(kU||(kU={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(MU||(MU={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(UU||(UU={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(LU||(LU={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(VU||(VU={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(FU||(FU={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.INIT=101]="INIT",e[e.NO_CONNECTION=102]="NO_CONNECTION",e[e.EXCEED_MAX_LENGTH=103]="EXCEED_MAX_LENGTH",e[e.EMPTY_USER=104]="EMPTY_USER",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN"}(BU||(BU={}));var QU,eL,tL=((xU={})[BU.SUCCESS]=[0,"success"],xU[BU.TIMEOUT]=[ZN.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],xU[BU.BROKEN]=[ZN.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],xU[BU.NO_RECEIVER]=[ZN.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],xU[BU.NO_RELAYPATH]=[ZN.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],xU[BU.SEND_TO_SERVER_ERROR]=[ZN.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],xU[BU.SERVER_RESPONSE_ERROR]=[ZN.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],xU[BU.NOT_JOIN]=[ZN.USER_MESSAGE_NOT_JOIN,"not join room"],xU[BU.INIT]=[ZN.USER_MESSAGE_INIT,"not init."],xU[BU.NO_CONNECTION]=[ZN.USER_MESSAGE_NO_CONNECTION,"no connection."],xU[BU.EXCEED_MAX_LENGTH]=[ZN.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],xU[BU.EMPTY_USER]=[ZN.USER_MESSAGE_EMPTY_USER,"user id is empty."],xU[BU.NOT_LOGIN]=[ZN.USER_MESSAGE_NOT_LOGIN,"not login."],xU[BU.SERVER_PARAMS_NOTSET]=[ZN.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],xU[BU.UNKNOWN]=[ZN.USER_MESSAGE_UNKNOWN,"unknown."],xU),rL=new wP("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(QU||(QU={})),function(e){e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM"}(eL||(eL={}));var nL=function(e){function t(t){var r=e.call(this)||this;return r._dataChannel=t,r._singlingCache=new Map,r._p2pCache=new Map,r._rttIds={},r._p2pMessageId=0,r._clearDataChannelListener=r._handleHandler(),window.__rtc_mock_signaling__=r.emit.bind(r),r}return Z_(t,e),t.prototype.destroy=function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}},t.prototype.sendSignaling=function(e,t,r){var n=this;return HU.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",$M.UP),new Promise((function(i,o){var a=n._genHeader(r);a.id=sP();var s=a.id.join("-"),c=setTimeout((function(){n._singlingCache.delete(s),o(new tw(ZN.TIME_OUT,"".concat(e," message time out")))}),6e4);n._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),i(e)},error:function(e){clearTimeout(c),o(e)}}),rL.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),n._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:eL.C2GW})},t.prototype.sendP2PMessage=function(e,t){var r=e.msg,n=function(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}(e,["msg"]);return ev(this,void 0,void 0,(function(){var e,i,o,a,s;return tv(this,(function(c){switch(c.label){case 0:return e=r instanceof ArrayBuffer,i=this._sendP2PMessage,o=[$_({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:VU.SEND,type:FU.P2P,err:BU.SUCCESS},n)],s={binary:e},e?[4,aP.ab2b64str(r)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=r,c.label=3;case 3:return[2,i.apply(this,[$_.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var r=this;return void 0===t&&(t={}),uP(e.msg)?this._rttIds[e.id]=e.id:rL.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(n,i){var o=r._genHeader($_($_({needAck:!0,functionType:eL.C2C},t),{id:sP()}));if(e.dir===VU.SEND){var a=setTimeout((function(){r._p2pCache.delete(e.id),i(new tw(ZN.TIME_OUT,"P2P message timeout"))}),6e4);r._p2pCache.set(e.id,{success:function(e){clearTimeout(a),n(e)},error:function(e){clearTimeout(a);var t=nv(tL[e.err]||[ZN.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],n=t[1];i({code:r,message:e.msg||n})}})}r._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new tw(ZN.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var n=t.version+(+t.zip<<5)+(+t.encrypt<<6),i=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=aP.str2ab(JSON.stringify([e,r])),a=iP(Uint8Array,iv([n,i],nv(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=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||o.direction===QU.ACK){for(;r<=6;r++)if(128!=(128&t[r])){r++;break}o.id=Array.from(t.slice(2,r))}return{header:o,data:t.slice(r)}},t.prototype._feedbackSignaling=function(e,t){var r=this._genHeader({needAck:!0,direction:QU.ACK,id:e.split("-").map((function(e){return+e}))});rL.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")},t.prototype._handleMessage=function(e){var t,r;return ev(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A,C,O,N,w;return tv(this,(function(P){switch(P.label){case 0:n=this._dispartData(e),i=n.header,o=n.data,i.zip&&((a=new wU.Inflate).push(o,!0),o=a.result),s=aP.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&HU.rtcSignalingMsgError(-1,e.message,qM.MESSAGE_PARSE_FAILED),[2]}switch(i.functionType){case eL.C2S:return[3,1];case eL.C2C:return[3,6];case eL.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=i.id)||void 0===t?void 0:t.join("-"))||"",i.direction!==QU.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],rL.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,aP.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=P.sent(),P.label=4;case 4:this.emit(d,$_({},c)),HU.rtcSignaling(0,s,"on-".concat(d),"Recv",$M.DOWN),P.label=5;case 5:return[3,19];case 6:switch(Array.isArray(c)&&(c=c[1]),h=null==c?void 0:c.id,this._rttIds[h]||(null==c?void 0:c.dir)===VU.FEEDBACK||uP(null==c?void 0:c.msg)?delete this._rttIds[h]:rL.print("Signal","<<<<<< p2p response",c),c.dir){case VU.SEND:return[3,7];case VU.FEEDBACK:return[3,16]}return[3,17];case 7:return uP(null==c?void 0:c.msg)?[3,15]:(f=(p=c).binary,_=p.msg,v=p.room,m=p.to,S=p.from,E=""===v?f?kU.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:kU.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:f?kU.USER_BINARY_MESSAGE_RECEIVED:kU.USER_MESSAGE_RECEIVED,m?[3,11]:(y=this.emit,g=[kU.ON_CUSTOM_MESSAGE],N={clientId:S,binary:f},f?[4,aP.b64str2ab(_)]:[3,9]));case 8:return b=P.sent(),[3,10];case 9:b=_,P.label=10;case 10:return y.apply(this,g.concat([(N.message=b,N)])),[3,17];case 11:return T=this.emit,I=[E],R=[$_({},c)],w={},f?[4,aP.b64str2ab(_)]:[3,13];case 12:return A=P.sent(),[3,14];case 13:A=_,P.label=14;case 14:T.apply(this,I.concat([$_.apply(void 0,R.concat([(w.msg=A,w)]))])),P.label=15;case 15:return this._sendP2PMessage($_($_({},c),{dir:VU.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===BU.SUCCESS?C.success(c.id):C.error(c)),[3,17];case 17:return[3,19];case 18:i.direction===QU.ACK&&(O=(null===(r=i.id)||void 0===r?void 0:r.join("-"))||"",this._handleAckMessage(O,c[0]||{},s)),P.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){rL.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){rL.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)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),$_({version:2,zip:!1,encrypt:!1,needAck:!0,direction:QU.SEND,functionType:eL.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,r){var n=this._singlingCache.get(e);n&&(this._singlingCache.delete(e),200===t.code?n.success(t):n.error(t),rL.print("Signal","<<<<<< [".concat(n.signalingType,"-ack]"),t)),HU.rtcSignaling(0,r,null==n?void 0:n.signalingType,"Ack",$M.DOWN)},t}(CP.exports.EventEmitter),iL=function(){function e(){this.isSending=!1}return e.prototype.ajax=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 Promise((function(e,i){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(r,n,!0);try{for(var l=rv(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=nv(h.value,2),f=p[0],_=p[1];d.setRequestHeader(f,_)}}catch(e){a={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(a)throw a.error}}d.onreadystatechange=function(){4===d.readyState&&(t.isSending=!1,200===d.status?e(JSON.parse(d.responseText)):i({message:d.statusText,code:d.status})),0===d.status&&i({code:0,message:"Request abort"})},d.onerror=function(e){t.isSending=!1,i({code:-1,message:d.responseText||"unknown"})},u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,r,n){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:n})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),oL=function(){function e(){}return e.prototype.get=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(e){return null}},e.prototype.set=function(e,t,r){void 0===r&&(r=-1);var n={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(n)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),aL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Z_(t,e),t.prototype.getDeviceId=function(){if(oP())return"";var e=this.get("RTC_DEVICE_ID");return e||(e=Qw()),this.set("RTC_DEVICE_ID",e),e},t.prototype.getAccessNode=function(e){return this.get("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"))},t.prototype.setAccessNode=function(e,t,r){return this.set("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"),t,1e3*r)},t.prototype.clearAccessNode=function(e){this.delete("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"))},t.prototype.getAccessUrls=function(){return this.get("".concat("RTC_ACCESS_URLS","-BytePlus"))},t.prototype.setAccessUrls=function(e){var t=e.map((function(e){var t=e.host,r=e.path;return"https://".concat(t).concat(r)}));return this.set("".concat("RTC_ACCESS_URLS","-BytePlus"),t)},t.prototype.clearAccessUrls=function(){this.delete("".concat("RTC_ACCESS_URLS","-BytePlus"))},t.prototype.getH264BlackList=function(){return this.get("RTC_H264_BLACK_LIST")},t.prototype.setH264BlackList=function(e){return this.set("RTC_H264_BLACK_LIST",e)},t}(oL),sL=new aL,cL=new wP("ICE Request",3),uL=function(){function e(){this._request=new iL}return e.prototype.getAccessNode=function(e,t,r,n,i,o,a){return ev(this,void 0,void 0,(function(){var s;return tv(this,(function(c){return(s=sL.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,r,n,i,o,a),$U("es.R.node.cache",s),[2,Promise.resolve(s)]):[2,this.getAccessNodeFromServer(e,t,r,n,i,o,a)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,r,n,i,o,a){return ev(this,void 0,void 0,(function(){var s,c,u=this;return tv(this,(function(d){return s=sL.getAccessUrls(),c=!0,$U("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=yD.ICE_CONFIG_REQUEST_URLS,c=!1,$U("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=yD.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,$U("es.R.req.internal.urls",s)),[2,this.getICEConfigFromServer(s,e,t,r,n,i,o,a).then((function(t){var r=t.nodes[0];return sL.setAccessNode(e,r,t.ttl||11200),t.dispatchDomains&&sL.setAccessUrls(t.dispatchDomains),r})).catch((function(s){if(c)return $U("es.R.req.fallback",""),sL.clearAccessUrls(),u.getAccessNodeFromServer(e,t,r,n,i,o,a);throw s}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,r,n,i,o,a,s){var c;return ev(this,void 0,void 0,(function(){var r,u,d,l=this;return tv(this,(function(h){return r={appID:t,userID:n,deviceID:i,connectSessionID:rP(),os:"web",sdkVersion:yD.VERSION,expectedAddr:bD("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:s},o&&a&&(r.feedbackInfo=[{feedbackIP:null===(c=a.publicIPs[0])||void 0===c?void 0:c.ip,feedbackReason:{type:"NodeChanged",reason:o}}],delete r.expectedAddr),u=Date.now(),HU.rtcGetAccess(0,JSON.stringify(r),0,XM.REQUEST,e.join(","),r.connectSessionID),d=e.map((function(e,t){return ev(l,void 0,void 0,(function(){var n,i,o;return tv(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._request.post(e,r)];case 1:return n=a.sent(),[3,3];case 2:throw i=a.sent(),new tw(ZN.ICE_SERVER_WRONG,"get ICE config failed",i);case 3:if(200!==n.code)throw new tw(ZN.ICE_SERVER_WRONG,"get ICE config failed",{server_code:n.code,message:JSON.stringify(n)});if(!(o=n.nodes[0]))throw new tw(ZN.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:n.code,message:JSON.stringify(n)});return[2,{result:n,firstNode:o,index:t}]}}))}))})),[2,pP(d).then((function(t){var n=t.result;t.firstNode;var i=t.index;return HU.rtcGetAccess(200,JSON.stringify(n),Date.now()-u,XM.RESPONSE,e[i],r.connectSessionID),n})).catch((function(t){var n,i,o=null===(n=t[0])||void 0===n?void 0:n.error;throw HU.rtcGetAccess(+((null==o?void 0:o.code)||(null==o?void 0:o.server_code)),null===(i=t[0])||void 0===i?void 0:i.message,Date.now()-u,XM.RESPONSE,e.join(","),r.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(cL.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),dL=function(){function e(){this._request=new iL}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.41.1",deviceType:"web"},r=yD.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));HU.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),HM.REQUEST,"",!1);var n=r.map((function(r,n){return ev(e,void 0,void 0,(function(){var e;return tv(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this._request.post(r,t)];case 1:return e=i.sent(),[3,3];case 2:throw i.sent(),new tw(ZN.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new tw(ZN.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:n}]}}))}))}));return new Promise((function(e){pP(n).then((function(t){var n=t.result,i=t.index;sL.setH264BlackList(n.web_h264_black_list),HU.rtcGetConfig(200,JSON.stringify(n),0,r[i],HM.RESPONSE,"",!1),e(n.web_h264_black_list)})).catch((function(t){HU.rtcGetConfig(500,t.message,0,"",HM.RESPONSE,"",!1),e(sL.getH264BlackList()||[])}))}))},e}(),lL={},hL={},pL={exports:{}},fL=pL.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(fL).forEach((function(e){fL[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=pL.exports,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(i).forEach((function(e){var t=e[0],i=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(n[t]||[]).length;s+=1){var c=n[t][s];if(c.reg.test(i))return r(c,a,i)}})),t.media=o,t};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){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],n=e.split(" ").map(t),i=0;i<n.length;i+=3)r.push({component:n[i],ip:n[i+1],port:n[i+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,n=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),n=!0),{scid:r,paused:n}}))}))}}(hL);var _L=pL.exports,vL=/%[sdv%]/g,mL=function(e){var t=1,r=arguments,n=r.length;return e.replace(vL,(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""}}))},SL=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 mL.apply(null,n)},EL=["v","o","s","i","u","e","p","c","b","t","r","z","a"],yL=["i","c","b","a"],gL=hL,bL=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||EL,n=t.innerOrder||yL,i=[];return r.forEach((function(t){_L[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(SL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(SL(t,r,e))}))}))})),e.media.forEach((function(e){i.push(SL("m",_L.m[0],e)),n.forEach((function(t){_L[t].forEach((function(r){r.name in e&&null!=e[r.name]?i.push(SL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){i.push(SL(t,r,e))}))}))}))})),i.join("\r\n")+"\r\n"};lL.write=bL,lL.parse=gL.parse,lL.parseParams=gL.parseParams,lL.parseFmtpConfig=gL.parseFmtpConfig,lL.parsePayloads=gL.parsePayloads,lL.parseRemoteCandidates=gL.parseRemoteCandidates,lL.parseImageAttributes=gL.parseImageAttributes,lL.parseSimulcastStreamList=gL.parseSimulcastStreamList;var TL=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this._iceConfigNode.iceParams,n=lL.parse(e);return null===(t=n.media)||void 0===t||t.forEach((function(e){e.iceUfrag=null==r?void 0:r.clientIceUfrag,e.icePwd=null==r?void 0:r.clientIcePwd,e.iceOptions="renomination"})),lL.write(n)},e}(),IL=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this,n=this._iceConfigNode.certFingerprint,i=lL.parse(e);return(null==i?void 0:i.fingerprint)&&(i.fingerprint={type:"sha-256",hash:n}),null===(t=null==i?void 0:i.media)||void 0===t||t.forEach((function(e){return r.modifyMlineByIceNode(e)})),lL.write(i)},e.prototype.modifyMlineByIceNode=function(e){var t=this._iceConfigNode,r=t.publicIPs,n=t.certFingerprint,i=t.iceParams;e.fingerprint&&(e.fingerprint={type:"sha-256",hash:n}),e.icePwd=i.serverIcePwd,this._iceUfrag||(this._iceUfrag=ML(i.serverIceUfrag),YU.setStats({connection_id:this._iceUfrag})),e.iceUfrag=this._iceUfrag,e.setup="active",this._candidates||(this._candidates=kL(r)),e.candidates=this._candidates,e.iceOptions="renomination","application"===e.type&&(e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144})},e}();function RL(e,t){var r,n=lL.parse(e),i=[];return n.media=n.media.map((function(e){return t.includes(e.mid+"")?(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):"inactive"!==e.direction&&i.push(e.mid),e})),(null===(r=n.groups)||void 0===r?void 0:r[0])&&(n.groups[0].mids=i.join(" ")),n}var AL,CL,OL,NL,wL,PL=function(e,t){var r,n;try{var i=lL.parse(e),o=lL.parse(t),a="".concat(null===(r=o.groups)||void 0===r?void 0:r[0].mids).split(" "),s="".concat(null===(n=i.groups)||void 0===n?void 0:n[0].mids).split(" "),c={};a.forEach((function(e){return c[e]=e}));var u={};s.forEach((function(e){c[e]||(u[e]=e)}));var d="",l="";return i.media=i.media.filter((function(e){return u[e.mid]&&"audio"===e.type?d="".concat(e.mid):u[e.mid]&&"video"===e.type&&(l="".concat(e.mid)),u[e.mid]})),delete i.groups,delete i.msidSemantic,{partialSdp:lL.write(i),audioMid:d,videoMid:l}}catch(e){return null}},DL=function(e,t){var r;try{var n=lL.parse(e),i=[];return null===(r=n.media)||void 0===r||r.forEach((function(e){(null==t?void 0:t.includes("".concat(e.mid)))&&i.push(e)})),n.media=i,delete n.groups,delete n.msidSemantic,lL.write(n)}catch(e){return""}},kL=function(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,n=[];return e.forEach((function(e){var i={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){n.push($_($_({},i),{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){n.push($_($_({},i),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),n},ML=function(e){var t=new TextEncoder,r=t.encode("PREC"),n=new Uint8Array(aP.str2ab(e)),i=t.encode(Date.now().toString()).slice(-4),o=new Uint8Array(4);o[0]=0,o[1]=1,o[2]=1,o[3]=1;var a=iP(Uint8Array,r,n,i,o),s=aP.ab2str(a.buffer);return window.btoa(s)},UL="safari"===(AL="none",oP()||(null!==window.navigator.userAgent.match("Firefox")?AL="mozilla":null!==window.navigator.userAgent.match("Chrome")?(AL="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(AL="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(AL="safari")),AL);!function(e){e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server"}(CL||(CL={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(OL||(OL={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(NL||(NL={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(wL||(wL={}));var LL,xL,VL,FL=function(){function e(e){this.peer=e,this.stats=[]}return e.prototype.handleCodec=function(e){return e},e.prototype.handleInboundRtp=function(e){return e},e.prototype.handleOutboundRtp=function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e},e.prototype.handleRemoteInboundRtp=function(e){return e},e.prototype.handleRemoteOutboundRtp=function(e){return e},e.prototype.handleMediaSource=function(e){return e},e.prototype.handleCsrc=function(e){return e},e.prototype.handlePeerConnection=function(e){return e},e.prototype.handleDataChannel=function(e){return e},e.prototype.handleStream=function(e){return e},e.prototype.handleTrack=function(e){return e},e.prototype.handleTransceiver=function(e){return e},e.prototype.handleSender=function(e){return e},e.prototype.handleReceiver=function(e){return e},e.prototype.handleTransport=function(e){return e},e.prototype.handleSctpTransport=function(e){return e},e.prototype.handleCandidatePair=function(e){return e},e.prototype.handleLocalCandidate=function(e){return e},e.prototype.handleRemoteCandidate=function(e){return e},e.prototype.handleCertificate=function(e){return e},e.prototype.handleIceServer=function(e){return e},e.prototype.processStats=function(e){var t=this;e.forEach((function(e){var r;switch(e.type){case CL.candidatePair:r=t.handleCandidatePair;break;case CL.certificate:r=t.handleCertificate;break;case CL.remoteCandidate:r=t.handleRemoteCandidate;break;case CL.remoteInboundRtp:r=t.handleInboundRtp;break;case CL.remoteOutboundRtp:r=t.handleOutboundRtp;break;case CL.sctpTransport:r=t.handleSctpTransport;break;case CL.sender:r=t.handleSender;break;case CL.stream:r=t.handleStream;break;case CL.track:r=t.handleTrack;break;case CL.transceiver:r=t.handleTransceiver;break;case CL.transport:r=t.handleTransport;break;case CL.codec:r=t.handleCodec;break;case CL.csrc:r=t.handleCsrc;break;case CL.dataChannel:r=t.handleDataChannel;break;case CL.iceServer:r=t.handleIceServer;break;case CL.mediaSource:r=t.handleMediaSource;break;case CL.outboundRtp:r=t.handleOutboundRtp;break;case CL.inboundRtp:r=t.handleInboundRtp;break;case CL.peerConnection:r=t.handlePeerConnection;break;case CL.receiver:r=t.handleReceiver;break;case CL.localCandidate:r=t.handleLocalCandidate;break;default:r=function(e){return e}}r=r.bind(t),t.stats.push(r(e))}))},e.prototype.getExtraStats=function(){return ev(this,void 0,void 0,(function(){var e=this;return tv(this,(function(t){return[2,new Promise((function(t,r){if(UL||void 0!==window.InstallTrigger)return t(e.stats);try{e.peer.getStats((function(r){r.result().forEach((function(t){if(!BL.includes(t.type)){var r={};t.names().forEach((function(e){r[e]=t.stat(e)})),r.id=t.id,r.type=t.type,r.timestamp=t.timestamp,e.stats.push(r)}})),t(e.stats)}))}catch(e){r(e)}}))]}))}))},e.prototype.getStats=function(e,t){return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(n){switch(n.label){case 0:return n.trys.push([0,7,,8]),[4,this.peer.getStats(e)];case 1:r=n.sent(),this.processStats(r),n.label=2;case 2:return n.trys.push([2,5,,6]),t?[3,4]:[4,this.getExtraStats()];case 3:n.sent(),n.label=4;case 4:return[3,6];case 5:return n.sent(),[3,6];case 6:return[3,8];case 7:return n.sent(),[3,8];case 8:return[2,this.stats]}}))}))},e}(),BL=["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"],jL=function(e,t,r){return ev(void 0,void 0,void 0,(function(){var n;return tv(this,(function(i){switch(i.label){case 0:return n=[],e instanceof RTCPeerConnection?[4,new FL(e).getStats(t,r)]:[2,n];case 1:return[2,n=i.sent()]}}))}))};!function(e){e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX"}(LL||(LL={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(xL||(xL={})),function(e){e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED"}(VL||(VL={}));var GL,HL=function(){return ev(void 0,void 0,void 0,(function(){var e,t,r,n,i,o,a;return tv(this,(function(s){switch(s.label){case 0:if(GL)return[2,GL];e=[],s.label=1;case 1:return s.trys.push([1,5,,6]),[4,hP()];case 2:return(t=s.sent())?(null==t?void 0:t.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))?(r=navigator.userAgent.toLowerCase(),n=!1,i=["heytapbrowser","mqqbrowser","miuibrowser"],[4,(new dL).getH264BlackList()]):[3,4]:[2,e];case 3:for(o=s.sent(),i.push.apply(i,iv([],nv(o),!1)),a=0;a<i.length;a++)r.includes(i[a])&&(n=!0);!n&&e.push("H264"),s.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),GL=e,[2,e];case 5:return s.sent(),[2,e];case 6:return[2]}}))}))},zL=function(){return"undefined"!=typeof TransformStream&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},KL=new wP("BasicHandler",3),YL=zL(),WL={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!YL||void 0},XL=function(e){function t(t){var r=e.call(this)||this;return r.monitor=t,r._peerConnection=new RTCPeerConnection(WL),r._dataChannel=r._peerConnection.createDataChannel("signaling"),r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,n;KL.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(n=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===n?void 0:n.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){KL.print("constructor","onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ").concat(r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var e=r._peerConnection.iceConnectionState;t.rtcPreIceState(e,JM["".concat(e.toUpperCase())])},r}return Z_(t,e),t.prototype.connect=function(e){return ev(this,void 0,void 0,(function(){var t,r,n=this;return tv(this,(function(i){switch(i.label){case 0:return KL.print("connect","invoke connect"),[4,this._peerConnection.createOffer()];case 1:return t=i.sent(),this._localSdp=new TL(e),[4,this.setLocalDescription(t.sdp)];case 2:return i.sent(),this._remoteSdp=new IL(e),r=this._remoteSdp.modifyByIceNode(t.sdp),[4,this.setRemoteDescription(r)];case 3:return i.sent(),[4,new Promise((function(e,t){n._dataChannel.onopen=function(){KL.print("connect","dataChannel open"),$U("es.dc.open",""),e("")},n._dataChannel.onerror=function(e){HU.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,qM.INVALID_DATA),$U("es.dc.error",""),t(e)},n._dataChannel.onclose=function(e){$U("es.dc.close",""),t(e)},n._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==n._peerConnection.iceConnectionState&&"closed"!==n._peerConnection.iceConnectionState&&"failed"!==n._peerConnection.connectionState||t(e)}))}))];case 4:return i.sent(),KL.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){this.disconnect(),this._localSdp=void 0,this._remoteSdp=void 0},t.prototype.publish=function(e,t){var r;return ev(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I;return tv(this,(function(R){switch(R.label){case 0:if(n=e.stream,i=null==e?void 0:e.videoTrack,o=null==e?void 0:e.audioTrack,a={},s=[],Array.isArray(null==e?void 0:e.videoEncodeConfig))for(c=null==e?void 0:e.videoEncodeConfig.length,u=null==i?void 0:i.getTrack(),d={width:640,height:480,framerate:30},u&&(l=null==u?void 0:u.getSettings(),d={width:Math.floor(l.width),height:Math.floor(l.height),framerate:Math.floor(l.frameRate)}),a.sendEncodings=[],h=0;h<c;h++)p=null==e?void 0:e.videoEncodeConfig[h],f={maxBitrate:1e3*p.maxKbps},_=Math.pow(2,h),c>1&&(f.rid="".concat(h),f.scaleResolutionDownBy=_),null===(r=a.sendEncodings)||void 0===r||r.unshift(f),s.push({width:Math.floor(d.width/_),height:Math.floor(d.height/_),framerate:d.framerate,maxkbps:p.maxKbps,rid:"".concat(h)});return KL.print("publish videoTransceiverInit videoDescriptions","",a,s),v=null==o?void 0:o.getTrack(),(null==o?void 0:o.mixType)!==xL.PLAYOUT&&(null==o?void 0:o.mixedAudioTrack)&&(v=null==o?void 0:o.mixedAudioTrack),e.audioTransceiver=this._peerConnection.addTransceiver(v||"audio",{direction:"sendonly",streams:[n]}),m=e.audioTransceiver,(null==t?void 0:t.audioRed)&&RTCRtpSender.getCapabilities&&m.setCodecPreferences&&(KL.print("publish","publish audio red is true"),(S=(RTCRtpSender.getCapabilities("audio")||{}).codecs)&&(E=S.findIndex((function(e){return"audio/red"===e.mimeType})),y=nv(S.splice(E,1),1),g=y[0],S.unshift(g),m.setCodecPreferences(S),KL.print("publish","audio preferences codecs",S))),YL&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver((null==i?void 0:i.getTrack())||"video",$_({direction:"sendonly",streams:[n]},a)),YL&&e.initVideoEncodedTransform(),KL.print("sender.getParameters()",e.videoTransceiver.sender.getParameters()),b=nP(),HU.rtcBeginCreateOffer(QM.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:if(T=R.sent(),HU.rtcCreateOffer(0,eU.UP,e.streamId,e.userId,nP()-b),I=PL(T.sdp,this.getLocalDescriptionSdp()),!T.sdp||!I)throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,$_($_({sdp:T.sdp},I),{type:"incroffer",semantics:"unified-plan",videoDescriptions:s})]}}))}))},t.prototype.subscribe=function(e,t){return ev(this,void 0,void 0,(function(){var r,n,i,o,a;return tv(this,(function(s){switch(s.label){case 0:return r="incroffer",n="unified-plan",t?[2,{sdp:this.getLocalDescriptionSdp(),partialSdp:DL(this.getLocalDescriptionSdp(),[t.audioMid,t.videoMid]),audioMid:t.audioMid,videoMid:t.videoMid,type:r,semantics:n}]:(e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),YL&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),YL&&e.initVideoEncodedTransform(),i=nP(),HU.rtcBeginCreateOffer(QM.DOWN,e.streamId,e.userId),[4,this._peerConnection.createOffer()]);case 1:if(o=s.sent(),HU.rtcCreateOffer(0,eU.DOWN,e.streamId,e.userId,nP()-i),a=PL(o.sdp,this.getLocalDescriptionSdp()),!o.sdp||!a)throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,$_($_({sdp:o.sdp},a),{type:r,semantics:n})]}}))}))},t.prototype.setAnswerSdp=function(e,t,r,n,i){var o;return ev(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return tv(this,(function(p){switch(p.label){case 0:return HU.rtcRecvAnswer(0,nU.INCRANSWER,0,t,i,n.streamId,n.userId),a=this._peerConnection.remoteDescription,s=lL.parse(null==a?void 0:a.sdp),c=null===(o=s.media)||void 0===o?void 0:o.reduce((function(e,t){return e[t.mid]=t,e}),{}),lL.parse(t).media.forEach((function(e){return c[e.mid]=e})),u=[],d=lL.parse(e),l=d.media.map((function(e){var t;r&&r[e.mid]&&(e.mid=r[e.mid]),"inactive"!==e.direction&&u.push(e.mid);var n=c[e.mid];return null===(t=h._remoteSdp)||void 0===t||t.modifyMlineByIceNode(n),e.bundleOnly||(n.port=e.port),n})),s.media=l,d.groups=[{mids:u.join(" "),type:"BUNDLE"}],s.groups=d.groups,[4,this.setLocalDescription(lL.write(d),n,i)];case 1:return p.sent(),[4,this.setRemoteDescription(lL.write(s),n,i)];case 2:return p.sent(),[2]}}))}))},t.prototype.setLocalDescription=function(e,t,r){var n,i;return ev(this,void 0,void 0,(function(){var o,a,s,c,u,d,l;return tv(this,(function(h){switch(h.label){case 0:o=null===(n=this._localSdp)||void 0===n?void 0:n.modifyByIceNode(e),a=new RTCSessionDescription({type:"offer",sdp:o}),s=nP(),c=r||rU.UP,u=(null==t?void 0:t.streamId)||"",d=(null===(i=t)||void 0===i?void 0:i.userId)||"",h.label=1;case 1:return h.trys.push([1,3,,4]),KL.print("setOffer","set offer: ",a),[4,this._peerConnection.setLocalDescription(a)];case 2:return h.sent(),HU.rtcSetDescription(0,a.sdp,tU.W_1,c,u,d,nP()-s,{type:"offer"}),[3,4];case 3:throw(l=h.sent())instanceof Error&&HU.rtcSetDescription(-1,l.message,tU.W_1,c,u,d,nP()-s,{type:"offer"}),l;case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t,r){var n;return ev(this,void 0,void 0,(function(){var i,o,a,s,c,u;return tv(this,(function(d){switch(d.label){case 0:i=new RTCSessionDescription({type:"answer",sdp:e}),o=nP(),a=r||rU.UP,s=(null==t?void 0:t.streamId)||"",c=(null===(n=t)||void 0===n?void 0:n.userId)||"",d.label=1;case 1:return d.trys.push([1,3,,4]),KL.print("setAnswer","set answer: ",i),[4,this._peerConnection.setRemoteDescription(i)];case 2:return d.sent(),HU.rtcSetDescription(0,i.sdp,tU.W_0,a,s,c,nP()-o,{type:"answer"}),[3,4];case 3:throw(u=d.sent())instanceof Error&&HU.rtcSetDescription(-1,u.message,tU.W_0,a,s,c,nP()-o,{type:"answer"}),u;case 4:return[2]}}))}))},t.prototype.getLocalDescriptionSdp=function(){var e,t,r,n;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.localDescription)||void 0===t?void 0:t.sdp)return null===(n=null===(r=this._peerConnection)||void 0===r?void 0:r.localDescription)||void 0===n?void 0:n.sdp;throw Error()},t.prototype.getRemoteDescriptionSdp=function(){var e,t,r,n;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.remoteDescription)||void 0===t?void 0:t.sdp)return null===(n=null===(r=this._peerConnection)||void 0===r?void 0:r.remoteDescription)||void 0===n?void 0:n.sdp;throw Error()},t.prototype.closeMLine=function(e){var t,r;return ev(this,void 0,void 0,(function(){var n,i,o,a,s=this;return tv(this,(function(c){switch(c.label){case 0:return KL.print("closeMids","closeMids: ",e),n=this.getLocalDescriptionSdp(),i=RL(n,e),o=this.getRemoteDescriptionSdp(),a=RL(o,e),[4,this._peerConnection.createOffer()];case 1:return c.sent(),[4,this.setLocalDescription(lL.write(i))];case 2:return c.sent(),(null===(t=null==i?void 0:i.media)||void 0===t?void 0:t.length)!==(null===(r=null==a?void 0:a.media)||void 0===r?void 0:r.length)&&i.media.slice(a.media.length).forEach((function(e){var t;null===(t=s._remoteSdp)||void 0===t||t.modifyMlineByIceNode(e),a.media.push(e)})),Array.isArray(i.media)&&Array.isArray(a.media)&&i.media.forEach((function(e,t){a.media[t]&&(a.media[t].mid=e.mid)})),[4,this.setRemoteDescription(lL.write(a))];case 3:return c.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return ev(this,void 0,void 0,(function(){var e;return tv(this,(function(t){switch(t.label){case 0:return[4,hP()];case 1:if(!(e=t.sent()))throw new tw(ZN.NOT_SUPPORTED,"Get offer Error");return[2,{sdp:e,semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.getStats=function(e,t){return jL(this._peerConnection,e,t)},t.prototype.rollback=function(e,t){var r;return ev(this,void 0,void 0,(function(){return tv(this,(function(n){switch(n.label){case 0:return KL.print("rollback()","signalingState: %o",this._peerConnection.signalingState),"stable"!==this._peerConnection.signalingState?[3,2]:[4,null===(r=this._peerConnection)||void 0===r?void 0:r.setLocalDescription(new RTCSessionDescription({sdp:e,type:"offer"}))];case 1:n.sent(),n.label=2;case 2:return[4,this.closeMLine(t)];case 3:return n.sent(),[2]}}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t}(CP.exports.EventEmitter),JL=new wP("Locker",2),qL=1,ZL=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=qL++,e&&(this.name=e),JL.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return Object.defineProperty(e.prototype,"isLocked",{get:function(){return this.locks>0},enumerable:!1,configurable:!0}),e.prototype.lock=function(){var e,t=this;this.locks+=1,JL.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var r=new Promise((function(r){e=function(){t.locks-=1,JL.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),n=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),n},e}(),$L=T,QL=Ku,ex=Lv.exports.getWeakData,tx=Pt,rx=j,nx=Qu,ix=Md,ox=Ue,ax=br.set,sx=br.getterFor,cx=ki.find,ux=ki.findIndex,dx=$L([].splice),lx=0,hx=function(e){return e.frozen||(e.frozen=new px)},px=function(){this.entries=[]},fx=function(e,t){return cx(e.entries,(function(e){return e[0]===t}))};px.prototype={get:function(e){var t=fx(this,e);if(t)return t[1]},has:function(e){return!!fx(this,e)},set:function(e,t){var r=fx(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=ux(this.entries,(function(t){return t[0]===e}));return~t&&dx(this.entries,t,1),!!~t}};var _x,vx={getConstructor:function(e,t,r,n){var i=e((function(e,i){nx(e,o),ax(e,{type:t,id:lx++,frozen:void 0}),null!=i&&ix(i,e[n],{that:e,AS_ENTRIES:r})})),o=i.prototype,a=sx(t),s=function(e,t,r){var n=a(e),i=ex(tx(t),!0);return!0===i?hx(n).set(t,r):i[n.id]=r,e};return QL(o,{delete:function(e){var t=a(this);if(!rx(e))return!1;var r=ex(e);return!0===r?hx(t).delete(e):r&&ox(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!rx(e))return!1;var r=ex(e);return!0===r?hx(t).has(e):r&&ox(r,t.id)}}),QL(o,r?{get:function(e){var t=a(this);if(rx(e)){var r=ex(e);return!0===r?hx(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}},mx=n,Sx=T,Ex=Ku,yx=Lv.exports,gx=Im,bx=vx,Tx=j,Ix=Hv,Rx=br.enforce,Ax=er,Cx=!mx.ActiveXObject&&"ActiveXObject"in mx,Ox=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},Nx=gx("WeakMap",Ox,bx);if(Ax&&Cx){_x=bx.getConstructor(Ox,"WeakMap",!0),yx.enable();var wx=Nx.prototype,Px=Sx(wx.delete),Dx=Sx(wx.has),kx=Sx(wx.get),Mx=Sx(wx.set);Ex(wx,{delete:function(e){if(Tx(e)&&!Ix(e)){var t=Rx(this);return t.frozen||(t.frozen=new _x),Px(this,e)||t.frozen.delete(e)}return Px(this,e)},has:function(e){if(Tx(e)&&!Ix(e)){var t=Rx(this);return t.frozen||(t.frozen=new _x),Dx(this,e)||t.frozen.has(e)}return Dx(this,e)},get:function(e){if(Tx(e)&&!Ix(e)){var t=Rx(this);return t.frozen||(t.frozen=new _x),Dx(this,e)?kx(this,e):t.frozen.get(e)}return kx(this,e)},set:function(e,t){if(Tx(e)&&!Ix(e)){var r=Rx(this);r.frozen||(r.frozen=new _x),Dx(this,e)?Mx(this,e,t):r.frozen.set(e,t)}else Mx(this,e,t);return this}})}var Ux=function(e){function t(){var t=e.call(this)||this;return t._hasVideoPermission=!1,t._hasAudioPermission=!1,t.inited=!1,t.deviceMap={audioinput:new Map,audiooutput:new Map,videoinput:new Map},t._handleDeviceChange=t._handleDeviceChange.bind(t),!oP()&&t.refreshDevices(),t}return Z_(t,e),t.prototype.refreshDevices=function(){return ev(this,void 0,void 0,(function(){var e,t=this;return tv(this,(function(r){switch(r.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2];case 1:return(e=r.sent()).forEach((function(r){var n;null===(n=t.deviceMap[r.kind])||void 0===n||n.set(r.deviceId,{deviceName:r.label||Lx(r,e),deviceInfo:r,deviceId:r.deviceId,deviceType:r.kind,deviceState:"active"})})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e;return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return"function"==typeof(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",this._handleDeviceChange),[2]}))}))},t.prototype._handleDeviceChange=function(){return ev(this,void 0,void 0,(function(){var e,t,r=this;return tv(this,(function(n){switch(n.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=n.sent(),t=Array.from(iv(iv(iv([],nv(this.deviceMap.audioinput.values()),!1),nv(this.deviceMap.videoinput.values()),!1),nv(this.deviceMap.audiooutput.values()),!1)),e.forEach((function(t){var n=r.deviceMap[t.kind].get(t.deviceId),i={deviceName:t.label||Lx(t,e),deviceType:t.kind,deviceId:t.deviceId,deviceInfo:t,deviceState:"active"};r.deviceMap[t.kind].set(t.deviceId,i),n&&"inactive"!==n.deviceState||r.emit("onMediaDeviceStateChanged",$_({},i))})),t.forEach((function(t){e.find((function(e){return e.deviceId===t.deviceId&&e.kind===t.deviceType}))||(t.deviceState="inactive",r.deviceMap[t.deviceType].delete(t.deviceId),r.emit(lP.onMediaDeviceStateChanged,t))})),[2]}}))}))},t.prototype.getVideoPermission=function(){return ev(this,void 0,void 0,(function(){var e=this;return tv(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new tw(ZN.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasVideoPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasVideoPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasVideoPermission]}}))}))},t.prototype.getAudioPermission=function(){return ev(this,void 0,void 0,(function(){var e=this;return tv(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new tw(ZN.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasAudioPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasAudioPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasAudioPermission]}}))}))},t.prototype.getDevices=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.getAudioPermission()];case 1:case 2:return e.sent(),[3,3];case 3:return e.trys.push([3,5,,6]),[4,this.getVideoPermission()];case 4:case 5:return e.sent(),[3,6];case 6:return[4,this.refreshDevices()];case 7:return e.sent(),[2,Array.from(iv(iv(iv([],nv(this.deviceMap.audioinput.values()),!1),nv(this.deviceMap.videoinput.values()),!1),nv(this.deviceMap.audiooutput.values()),!1)).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getMicrophones=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.audioinput.values()).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getCameras=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.videoinput.values()).filter((function(e){return"active"===e.deviceState}))]}))}))},t.prototype.getAudioPlayback=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.audiooutput.values()).filter((function(e){return"active"===e.deviceState}))]}))}))},t.prototype.getDeviceById=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return[4,this.getDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},Object.defineProperty(t.prototype,"hasAudioPermission",{get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new tw(ZN.NO_PERMISSION,"Cannot revoke audio permission");this.refreshDevices(),this._hasAudioPermission=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasVideoPermission",{get:function(){return this._hasVideoPermission},set:function(e){if(!e)throw new tw(ZN.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}(DP),Lx=function(e,t){var r=t.filter((function(t){return t.kind===e.kind})).findIndex((function(t){return t===e}));return{audioinput:"microphone_",audiooutput:"speaker_",videoinput:"camera_"}[e.kind]+r},xx=new Ux,Vx=function(){function e(){}return e.prototype.getAudioContextInstance=function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance},e}(),Fx=function(){function e(e){var t=Bx.getAudioContextInstance();this._track=e;var r=new MediaStream;r.addTrack(e);var n=t.createMediaStreamSource(r),i=t.createAnalyser();n.connect(i),this._analyserNode=i}return e.prototype.getAudioLevel=function(){var e=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(e);var t=0;return e.forEach((function(e){return t=Math.max(t,Math.abs(e-128))})),t/128*255},e}(),Bx=new Vx,jx=new wP("VERTC",0),Gx=new WeakMap,Hx=function(e){return Gx.get(e)},zx=function(e){function t(t,r){var n=e.call(this)||this;return n._trackId=t,n.mediaType=r,n}return Z_(t,e),t.prototype.getId=function(){return this._trackId},t}(DP),Kx=function(e){function t(t,r,n){var i=e.call(this,r,n)||this;return i._mediaTrack=t,i._initListeners(),i}return Z_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.close=function(){var e;return null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()},t.prototype._initListeners=function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){HU.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(zx),Yx=function(e){function t(t,r,n){var i=e.call(this,r,n)||this;return i._mediaTrack=t,i}return Z_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(zx),Wx=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return Z_(t,e),t.prototype.updateVideoCaptureConfig=function(){var e;return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig?(jx.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t}(Kx),Xx=function(e){function t(t,r){var n=e.call(this,t,r,"audio")||this;return n.mixType=xL.PLAYOUT_AND_PUBLISH,n}return Z_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new Fx(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.updateAudioCaptureConfig=function(){var e;return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(jx.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.audioCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t}(Kx),Jx=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return Z_(t,e),t}(Yx),qx=function(e){function t(t,r){return e.call(this,t,r,"audio")||this}return Z_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new Fx(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(Yx),Zx=function(e){function t(t,r){return e.call(this,t,r)||this}return Z_(t,e),t}(Xx),$x=function(e){function t(t,r){return e.call(this,t,r)||this}return Z_(t,e),t}(Wx),Qx=function(e){function t(t,r){return e.call(this,t,r)||this}return Z_(t,e),t}(Wx),eV=function(e){function t(t,r){return e.call(this,t,r)||this}return Z_(t,e),t}(Xx),tV=function(e){function t(t,r){return e.call(this,t,r)||this}return Z_(t,e),t}(Wx),rV=function(e){function t(t,r){return e.call(this,t,r)||this}return Z_(t,e),t}(Xx);function nV(e){var t;return ev(this,void 0,void 0,(function(){var r,n,i,o,a,s;return tv(this,(function(c){switch(c.label){case 0:n=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",c.label=1;case 1:return c.trys.push([1,3,,4]),jx.print("createCameraVideoTrack","constraints:",e),HU.rtcVideoCaptureEvent({event_type:TU.START,media_device_id:n}),i=nP(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return r=c.sent(),HU.rtcVideoCaptureEvent({event_type:TU.START_CAPTURE_RESULT,media_device_id:n,reason:RU.SUCCESS,elapse:nP()-i}),xx.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),HU.rtcVideoCaptureEvent({event_type:TU.RUNNING_FAILED,media_device_id:n,error_code:o.code,reason:o.message}),new tw(ZN.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getVideoTracks()[0],Gx.set(a,r),(s=new $x(a,rP())).videoCaptureConfig=e,[2,s]}}))}))}function iV(e){var t;return ev(this,void 0,void 0,(function(){var r,n,i,o,a;return tv(this,(function(s){switch(s.label){case 0:jx.print("createCameraVideoTrack","constraints:",e),n=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",s.label=1;case 1:return s.trys.push([1,3,,4]),HU.rtcVideoCaptureEvent({event_type:TU.START,media_device_id:n}),i=nP(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=s.sent(),HU.rtcVideoCaptureEvent({event_type:TU.START_CAPTURE_RESULT,media_device_id:n,reason:RU.SUCCESS,elapse:nP()-i}),xx.hasAudioPermission=!0,[3,4];case 3:throw o=s.sent(),HU.rtcVideoCaptureEvent({event_type:TU.RUNNING_FAILED,media_device_id:n,error_code:o.code,reason:o.message}),new tw(ZN.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getAudioTracks()[0],Gx.set(a,r),[2,new Zx(a,rP())]}}))}))}function oV(e){return void 0===e&&(e=!1),ev(this,void 0,void 0,(function(){var t,r,n;return tv(this,(function(i){switch(i.label){case 0:jx.print("createScreenStream","withAudio:",e),i.label=1;case 1:return i.trys.push([1,3,,4]),HU.rtcVideoCaptureEvent({event_type:TU.START,media_device_id:"screen"}),r=nP(),[4,navigator.mediaDevices.getDisplayMedia({video:!0,audio:e})];case 2:return t=i.sent(),HU.rtcVideoCaptureEvent({event_type:TU.START_CAPTURE_RESULT,media_device_id:"screen",reason:RU.SUCCESS,elapse:nP()-r}),[3,4];case 3:throw n=i.sent(),HU.rtcVideoCaptureEvent({event_type:TU.RUNNING_FAILED,media_device_id:"screen",error_code:n.code,reason:n.message}),new tw(ZN.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",n);case 4:return[2,t]}}))}))}var aV=Math.log,sV=Math.LOG10E;jn({target:"Math",stat:!0},{log10:Math.log10||function(e){return aV(e)*sV}}),jn({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new wP("Stats",2);var cV,uV=function(){function e(e,t,r,n){this._client=e,this._handler=t,this.dataChannelRTT={},this._rttTimer={},this._remoteStreamStasEvtIntervals={},this._remoteStreamAudioStallInterval={},this._localStreamStasEvtIntervals={},this._videoInWaiting={},this.monitor=r,this._audioStallInterval=((null==n?void 0:n.audio_stall_interval)||200)/2,this._audioStallRatio=(null==n?void 0:n.audio_stall_ratio)||.6}return e.prototype.setRemoteStreamStatsEvtInterval=function(e,t){var r,n;return void 0===t&&(t={rtt:!0}),ev(this,void 0,void 0,(function(){var i,o,a,s,c,u,d,l,h,p,f,_=this;return tv(this,(function(v){switch(v.label){case 0:return t.rtt&&this.getDataChannelRTT(e.userId),i={audio:{},video:{},remoteStream:e},o=null===(r=e.audioTrack)||void 0===r?void 0:r.getTrack(),a=null===(n=e.videoTrack)||void 0===n?void 0:n.getTrack(),this.getRemoteVideoStats(a,i),[4,this.getRemoteAudioStats(o,i)];case 1:return v.sent(),this.delRemoteStreamStatsEvtInterval(e),s=0,c=0,this._audioStallInterval>0&&void 0!==i.audio.concealedSamples&&(u=i.audio.concealedSamples,d=i.audio.totalSamplesReceived,i.audio.silentConcealedSamples,l=nP(),h={isStall:!1,counted:!1,diff:0},p=.5*this._audioStallInterval,this._remoteStreamAudioStallInterval[e.streamId]=setInterval((function(){return ev(_,void 0,void 0,(function(){var t,r,n,i,a,f,_,v,m,S,E;return tv(this,(function(y){switch(y.label){case 0:return t=nP(),(r=t-l)<p?[2]:(n=e.hasAudio,i=e.subAudio,n&&i?[4,this._handler.getStats(o,!0)]:(h.isStall=!1,h.counted=!1,[2]));case 1:for(a=y.sent(),f=a.length,_=0;_<f;_++)if(v=a[_],m=v.concealedSamples,S=v.totalSamplesReceived,"inbound-rtp"===v.type){E=S-d,m-u>=this._audioStallRatio*E?(h.isStall?(h.counted?c+=r:(c=c+h.diff+r,s++),h.counted=!0):(h.counted=!1,h.diff=r),h.isStall=!0):(h.isStall=!1,h.counted=!1),u=m,d=S,l=t;break}return[2]}}))}))}),this._audioStallInterval)),f=function(){return ev(_,void 0,void 0,(function(){var t,r,n,o,a,u;return tv(this,(function(d){switch(d.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(u=e.videoTrack)||void 0===u?void 0:u.getTrack(),[4,this.getRemoteAudioStats(t,i,s,c)];case 1:return n=d.sent(),s=0,c=0,[4,this.getRemoteVideoStats(r,i)];case 2:return o=d.sent(),[2,{audioStats:n,videoStats:o,isScreen:e.isScreen,userId:e.userId}]}}))}))},this._remoteStreamStasEvtIntervals[e.streamId]=setInterval((function(){return ev(_,void 0,void 0,(function(){var e;return tv(this,(function(t){switch(t.label){case 0:return[4,f()];case 1:return e=t.sent(),this._client.emit("onRemoteStreamStats",e),[2]}}))}))}),2e3),[2]}}))}))},e.prototype.delRemoteStreamStatsEvtInterval=function(e){clearInterval(this._remoteStreamStasEvtIntervals[e.streamId]),clearInterval(this._remoteStreamAudioStallInterval[e.streamId]),delete this._remoteStreamAudioStallInterval[e.streamId]},e.prototype.unsubscribe=function(e){this.delRemoteStreamStatsEvtInterval(e),clearTimeout(this._rttTimer[e.userId]),this._videoInWaiting[e.streamId]=!1},e.prototype.getRemoteAudioStats=function(e,t,r,n){return ev(this,void 0,void 0,(function(){var i,o,a,s,c,u,d,l,h,p,f,_,v;return tv(this,(function(m){switch(m.label){case 0:return i={},o={timestamp:Date.now()},a=t.remoteStream,s=a.streamId,c=a.userId,u=a.isScreen,d=a.audioMid,l=a.subMediaType,h=a._attributes,p={media_type:"audio",is_screen:+u,direction:"down",stream_id:s,stream_user_id:c,vid:d,connection_status:navigator.onLine,mute_state:l===cD.AUDIO_AND_VIDEO||l===cD.AUDIO_ONLY?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localaudio&&h.audiostream?"mute_state_off":"mute_state_on"},e&&this._handler?[4,this._handler.getStats(e)]:[2,i];case 1:return(f=m.sent()).length?(f.forEach((function(e){var t=e.type,r=e.packetsLost,n=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,l=e.totalSamplesReceived,h=e.concealedSamples,f=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,S=e.currentRoundTripTime,E=e.audioLevel,y=e.totalAudioEnergy,g=e.totalSamplesDuration,b=e.mimeType,T=e.googDecodingNormal,I=e.fecPacketsReceived,R=e.availableIncomingBitrate,A=e.availableOutgoingBitrate,C=e.bytesSent,O=e.nominated,N=e.id,w=e.writable,P=e.jitter,D=e.candidateType,k=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc,K=e.kind;"inbound-rtp"===t?(o.packetsLost=r,o.packetsReceived=n,p.packets=n,o.bytesReceived=a,p.bytes=a,void 0!==s&&(i.jitterBufferDelay=s/c*1e3,p.jitter_buffer_delay=i.jitterBufferDelay),void 0!==l&&(o.totalSamplesReceived=l,i.concealedSamples=h,o.concealedSamples=h,o.silentConcealedSamples=f,p.concealed_samples=h,i.concealmentEvents=_,p.total_samples_received=l),void 0!==I&&(p.fec_packets_received=I),p.jitter=1e3*P,p.ssrc=z):"codec"===t?(i.recordSampleRate=u,d&&(i.numChannels=d),p.codec=b):"candidate-pair"===t?(p.ice_available_incoming_bitrate=R,p.ice_available_outgoing_bitrate=A,p.ice_bytes_received=a,p.ice_bytes_sent=C,p.ice_nominated=+O,p.ice_pair_id=N,p.ice_pair_rtt=S,p.rtt=1e3*S,p.ice_pair_state=m,p.ice_pair_writable=w,p.recv_ping_requests=F,p.recv_ping_responses=B,p.sent_ping_requests_before_first_response=j,p.sent_ping_requests_total=j+(G||0),p.sent_ping_responses=H,"succeeded"===m&&(i.rtt=1e3*S,i.total_rtt=1e3*v)):"track"===t&&"audio"===K?(p.audio_level=-10*Math.log10(Math.pow(E,2)),p.volume=255*E,p.total_audio_energy=y,p.total_samples_duration=g):"ssrc"===t?(p.decoding_normal=T,p.recv_level=V):"local-candidate"===t?(p.local_candidate_type=D,p.local_ip=k||M,p.local_network_type=U,p.local_port=L,p.protocol=x):"remote-candidate"===t&&(p.remote_candidate_type=D,p.remote_ip=k||M,p.remote_port=L)})),(_=t.audio).timestamp?(i.audioLossRate=(o.packetsLost-_.packetsLost)/(o.packetsReceived-_.packetsReceived+(o.packetsLost-_.packetsLost)),i.audioLossRate=Number.isNaN(i.audioLossRate)?0:i.audioLossRate,p.packets_lost=Math.round(o.packetsLost-_.packetsLost),p.fraction_lost=i.audioLossRate,p.packets_lost_rate=i.audioLossRate,i.statsInterval=o.timestamp-_.timestamp,p.stats_interval=i.statsInterval,i.receivedKBitrate=(o.bytesReceived-_.bytesReceived||0)/i.statsInterval,p.bitrate=Math.round(8e3*i.receivedKBitrate),p.bandwidth=Math.round(p.bitrate/1024),void 0!==o.concealedSamples&&(p.interval_concealed_samples=o.concealedSamples-_.concealedSamples,p.interval_samples_received=o.totalSamplesReceived-_.totalSamplesReceived,p.interval_silent_concealed_samples=o.silentConcealedSamples-_.silentConcealedSamples,i.receivedSampleRate=1e3*p.interval_samples_received/i.statsInterval),t.audio=o,this.dataChannelRTT[t.remoteStream.userId]&&(v=this.dataChannelRTT[t.remoteStream.userId]/2,i.e2eDelay=v+(i.jitterBufferDelay||0),p.web_e2e_delay=i.e2eDelay,p.total_rtt_ms=v),this._audioStallInterval>0&&void 0!==o.concealedSamples&&(p.concealed_samples===p.interval_concealed_samples&&p.total_samples_received===p.interval_samples_received?(p.stall_count=0,p.stall_duration=0):(p.stall_count=r,p.stall_duration=n)),this.monitor.rtcMediaStatistics(p,{}),[2,i]):(t.audio=o,[2,i])):[2,i]}}))}))},e.prototype.getRemoteVideoStats=function(e,t){return ev(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l,h,p,f;return tv(this,(function(_){switch(_.label){case 0:return r={},n={timestamp:Date.now()},i=t.remoteStream,o=i.streamId,a=i.userId,s=i.isScreen,c=i.subMediaType,u=i._attributes,d={media_type:"video",is_screen:+s,direction:"down",stream_id:o,stream_user_id:a,vid:t.remoteStream.videoMid,connection_status:navigator.onLine,mute_state:c===cD.AUDIO_AND_VIDEO||c===cD.VIDEO_ONLY?"mute_state_off":"mute_state_on",remote_user_capture_state:u.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:u.localvideo&&u.videostream?"mute_state_off":"mute_state_on"},e&&this._handler?(r.isScreen=s,[4,this._handler.getStats(e)]):[2,r];case 1:return(l=_.sent()).length?(l.forEach((function(e){var t=e.type,i=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded;e.roundTripTime;var l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,f=e.firCount,_=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,S=e.nominated,E=e.id,y=e.currentRoundTripTime,g=e.state,b=e.writable,T=e.candidateType,I=e.ip,R=e.address,A=e.networkType,C=e.port,O=e.nackCount,N=e.pliCount,w=e.protocol,P=e.requestsReceived,D=e.responsesReceived,k=e.requestsSent,M=e.consentRequestsSent,U=e.responsesSent,L=e.ssrc;e.totalRoundTripTime;var x=e.kind,V=e.jitter,F=e.framesReceived,B=e.keyFramesDecoded,j=e.totalDecodeTime,G=e.decoderImplementation,H=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(n.packetsLost=a,d.packets_lost=a,n.packetsReceived=s,d.packets=s,n.bytesReceived=c,d.bytes=c,n.framesDecoded=u,void 0!==l&&(n.jitterBufferDelay=l/h*1e3,d.jitter_buffer_delay=n.jitterBufferDelay),d.fir_count=f,d.nack_count=O,d.pli_count=N,d.ssrc=L,d.jitter=V,d.frames_received=F,d.frames_decoded=u,d.key_frames_decoded=B,d.total_decode_time=j,d.decoder_implementation=G,d.last_packet_received_timestamp=H):"track"===t&&"video"===x?(r.width=o,d.frame_size_width=o,r.height=i,d.frame_size_height=i,void 0!==F&&(d.frames_received=F)):"codec"===t?d.codec=p:"candidate-pair"===t?(d.ice_available_incoming_bitrate=_,d.ice_available_outgoing_bitrate=v,d.ice_bytes_received=c,d.ice_bytes_sent=m,d.ice_nominated=+S,d.ice_pair_id=E,d.ice_pair_rtt=y,d.rtt=1e3*y,r.rtt=d.rtt,d.ice_pair_state=g,d.ice_pair_writable=b,d.recv_ping_requests=P,d.recv_ping_responses=D,d.sent_ping_requests_before_first_response=k,d.sent_ping_requests_total=k+(M||0),d.sent_ping_responses=U):"local-candidate"===t?(d.local_candidate_type=T,d.local_ip=I||R,d.local_network_type=A,d.local_port=C,d.protocol=w):"remote-candidate"===t&&(d.remote_candidate_type=T,d.remote_ip=I||R,d.remote_port=C)})),h=t.video,p=t.remoteStream,h.timestamp?(r.videoLossRate=(n.packetsLost-h.packetsLost)/(n.packetsReceived-h.packetsReceived+(n.packetsLost-h.packetsLost)),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,d.fraction_lost=r.videoLossRate,d.packets_lost_rate=r.videoLossRate,r.statsInterval=n.timestamp-h.timestamp,d.stats_interval=r.statsInterval,r.receivedKBitrate=(n.bytesReceived-h.bytesReceived||0)/r.statsInterval,d.bitrate=Math.round(8e3*r.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),r.decoderOutputFrameRate=1e3*(n.framesDecoded-h.framesDecoded)/r.statsInterval,d.frame_rate_decoded=Math.round(r.decoderOutputFrameRate),d.frame_rate_received=d.frame_rate_decoded,t.video=n,this.dataChannelRTT[t.remoteStream.userId]&&(f=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=f+(n.jitterBufferDelay||0),d.web_e2e_delay=r.e2eDelay,d.total_rtt_ms=f),this.processStall(p,d,s),this.monitor.rtcMediaStatistics(d,{}),[2,r]):(t.video=n,[2,r])):[2,r]}}))}))},e.prototype.processStall=function(e,t,r){var n=0,i=0,o=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(n+=e.stallCount,i+=e.stallDuration),o=e.playTime})),e.recordedVideoFrames.length||(i=2e3,n=this._videoInWaiting[e.streamId]?0:1,this._videoInWaiting[e.streamId]=!0);var a=e.recordedVideoFrames.pop();a&&(a.isStall?this._videoInWaiting[e.streamId]=!0:this._videoInWaiting[e.streamId]=!1),e.recordedVideoFrames=[]}t.stall_count=n,r?(t.stuck_length=i,t.stall_duration=void 0):(t.stall_duration=i,t.stuck_length=void 0),t.play_time=o},e.prototype.setLocalStreamStatsEvtInterval=function(e){var t,r,n=this,i={audio:{},video:{},localStream:e},o=null===(t=e.audioTrack)||void 0===t?void 0:t.getTrack(),a=null===(r=e.videoTrack)||void 0===r?void 0:r.getTrack();this.getAudioStats(o,i),this.getVideoStats(a,i),this.delLocalStreamStatsEvtInterval(e);this._localStreamStasEvtIntervals[e.streamId]=setInterval((function(){return ev(n,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:return[4,ev(n,void 0,void 0,(function(){var t,r,n,o,a,s;return tv(this,(function(c){switch(c.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(s=e.videoTrack)||void 0===s?void 0:s.getTrack(),[4,this.getAudioStats(t,i)];case 1:return n=c.sent(),[4,this.getVideoStats(r,i)];case 2:return o=c.sent(),[2,{audioStats:n,videoStats:o,isScreen:e.isScreen}]}}))}))];case 1:return t=r.sent(),this._client.emit("onLocalStreamStats",t),[2]}}))}))}),2e3)},e.prototype.delLocalStreamStatsEvtInterval=function(e){clearInterval(this._localStreamStasEvtIntervals[e.streamId])},e.prototype.unpublish=function(e){this.delLocalStreamStatsEvtInterval(e)},e.prototype.getAudioStats=function(e,t){return ev(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l;return tv(this,(function(h){switch(h.label){case 0:return r={},n={timestamp:Date.now()},i=t.localStream,o=i.streamId,a=i.audioMid,s=i.isScreen,c=i.pubAttributes,u={media_type:"audio",is_screen:+s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},e&&this._handler?[4,this._handler.getStats(e)]:[2,r];case 1:return(d=h.sent()).length?(d.forEach((function(e){var t=e.type,i=e.packetsSent,o=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,d=e.channels,l=e.audioLevel,h=e.googRtt,p=e.mimeType,f=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,S=e.id,E=e.currentRoundTripTime,y=e.state,g=e.writable,b=e.requestsReceived,T=e.responsesReceived,I=e.requestsSent,R=e.consentRequestsSent,A=e.responsesSent,C=e.jitter,O=e.candidateType,N=e.ip,w=e.address,P=e.networkType,D=e.port,k=e.protocol,M=e.nackCount,U=e.retransmittedBytesSent,L=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType;"outbound-rtp"===t?(n.packetsSent=i,n.bytesSent=a,u.bytes=a,u.packets=i,u.nack_count=M,u.ssrc=F,u.retransmitted_bytes_sent=U,u.retransmitted_packets_sent=L):"remote-inbound-rtp"===t?(n.packetsLost=o,u.packets_lost=o,u.jitter=1e3*C,r.rtt=1e3*c,u.rtt=r.rtt,u.round_trip_time_measurements=x):"codec"===t?(r.recordSampleRate=s,r.numChannels=d,u.codec=p):"media-source"===t?(u.audio_level=-10*Math.log10(Math.pow(l,2)),u.volume=255*l,u.total_audio_energy=B,u.total_samples_duration=j):"ssrc"===t&&"audio"===G?(u.audio_network_elapse=h,u.send_level=V):"candidate-pair"===t?(u.ice_available_incoming_bitrate=f,u.ice_available_outgoing_bitrate=_,u.ice_bytes_received=v,u.ice_bytes_sent=a,u.ice_nominated=+m,u.ice_pair_id=S,u.ice_pair_rtt=E,u.ice_pair_state=y,u.ice_pair_writable=g,u.recv_ping_requests=b,u.recv_ping_responses=T,u.sent_ping_requests_before_first_response=I,u.sent_ping_requests_total=I+(R||0),u.sent_ping_responses=A):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=N||w,u.local_network_type=P,u.local_port=D,u.protocol=k):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=N||w,u.remote_port=D)})),(l=t.audio).timestamp?(void 0!==n.packetsLost&&(r.audioLossRate=(n.packetsLost-l.packetsLost)/(n.packetsSent-l.packetsSent),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,u.fraction_lost=r.audioLossRate),r.statsInterval=n.timestamp-l.timestamp,u.stats_interval=r.statsInterval,r.sentKBitrate=(n.bytesSent-l.bytesSent||0)/r.statsInterval,u.bitrate=Math.round(8e3*r.sentKBitrate),u.bandwidth=Math.round(u.bitrate/1024),t.audio=n,this.monitor.rtcMediaStatistics(u,{}),[2,r]):(t.audio=n,[2,r])):[2,r]}}))}))},e.prototype.getVideoStats=function(e,t){return ev(this,void 0,void 0,(function(){var r,n,i,o,a,s,c,u,d,l;return tv(this,(function(h){switch(h.label){case 0:return r={},n={timestamp:Date.now()},i=t.localStream,o=i.streamId,a=i.videoMid,s=i.isScreen,c=i.pubAttributes,u={media_type:"video",is_screen:+s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localvideo?"capture_state_on":"capture_state_off"},e&&this._handler?(r.isScreen=s,[4,this._handler.getStats(e)]):[2,r];case 1:return(d=h.sent()).length?(d.forEach((function(e){var t=e.type,i=e.framesEncoded,o=e.packetsLost,a=e.bytesSent;e.framesSent;var s=e.roundTripTime,c=e.mimeType,d=e.frameWidth,l=e.frameHeight;e.clockRate;var h=e.packetsSent,p=e.googActualEncBitrate,f=e.googAvailableReceiveBandwidth,_=e.googAvailableSendBandwidth,v=e.googAvgEncodeMs,m=e.googBucketDelay,S=e.googEncodeUsagePercent,E=e.googFrameRateInput,y=e.availableIncomingBitrate,g=e.availableOutgoingBitrate,b=e.bytesReceived,T=e.nominated,I=e.id,R=e.currentRoundTripTime,A=e.state,C=e.writable,O=e.candidateType,N=e.ip,w=e.address,P=e.networkType,D=e.port,k=e.nackCount,M=e.pliCount,U=e.protocol,L=e.qpSum,x=e.requestsReceived,V=e.responsesReceived,F=e.googRetransmitBitrate,B=e.requestsSent,j=e.consentRequestsSent,G=e.responsesSent,H=e.ssrc,z=e.googTargetEncBitrate,K=e.googTransmitBitrate,Y=e.googRtt,W=e.retransmittedPacketsSent,X=e.encoderImplementation,J=e.jitter;"outbound-rtp"===t?(n.framesEncoded=i,n.bytesSent=a,u.bytes=a,n.packetsSent=h,u.packets=h,u.nack_count=k,u.pli_count=M,u.qp_sum=L,u.ssrc=H,u.retransmitted_packets_sent=W,u.encoder_implementation=X):"track"===t?(r.encodedFrameWidth=d,r.encodedFrameHeight=l,u.frame_size_height=l,u.frame_size_width=d):"remote-inbound-rtp"===t?(n.packetsLost=o,r.rtt=1e3*s,u.rtt=r.rtt,u.jitter=J,u.packets_lost=o):"codec"===t?(r.codecType=c,u.codec=c):"candidate-pair"===t?(u.ice_available_incoming_bitrate=y,u.ice_available_outgoing_bitrate=g,u.ice_bytes_received=b,u.ice_bytes_sent=a,u.ice_nominated=+T,u.ice_pair_id=I,u.ice_pair_rtt=R,u.ice_pair_state=A,u.ice_pair_writable=C,u.recv_ping_requests=x,u.recv_ping_responses=V,u.sent_ping_requests_before_first_response=B,u.sent_ping_requests_total=B+j,u.sent_ping_responses=G):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=N||w,u.local_network_type=P,u.local_port=D,u.protocol=U):"remote-candidate"===t?(u.remote_candidate_type=O,u.remote_ip=N||w,u.remote_port=D):"VideoBwe"===t?(u.actual_enc_bitrate=p,u.available_receive_bandwidth=f,u.available_send_bandwidth=_,u.bucket_delay=m,u.retransmit_bitrate=F,u.target_enc_bitrate=z,u.transmit_bitrate=K):"ssrc"===t&&(u.video_network_elapse=Y,u.avg_encode_ms=v,u.encode_usage_percent=S,u.frame_rate_input=E,u.orignal_input_Framerate=+E)})),(l=t.video).timestamp?(r.statsInterval=n.timestamp-l.timestamp,u.stats_interval=r.statsInterval,r.encodedFrameCount=void 0!==n.framesSent?n.framesSent-l.framesSent:n.framesEncoded-l.framesEncoded,r.sentKBitrate=(n.bytesSent-l.bytesSent||0)/r.statsInterval,u.bitrate=Math.round(8e3*r.sentKBitrate),u.bandwidth=Math.round(u.bitrate/1024),r.encoderOutputFrameRate=1e3*(n.framesEncoded-l.framesEncoded)/r.statsInterval,u.frame_rate_encoded=Math.round(r.encoderOutputFrameRate),r.sentFrameRate=1e3*r.encodedFrameCount/r.statsInterval,u.frame_rate_sent=Math.round(r.sentFrameRate),r.videoLossRate=(n.packetsLost-l.packetsLost)/(n.packetsSent-l.packetsSent),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,u.fraction_lost=r.videoLossRate,t.video=n,this.monitor.rtcMediaStatistics(u,{}),[2,r]):(t.video=n,[2,r])):[2,r]}}))}))},e.prototype.getDataChannelRTT=function(e){var t,r=this,n=nP();null===(t=this._client.sendUserMessage(e,"__web__rtc__rtt__"))||void 0===t||t.then((function(t){if("timeout"!==t){var i=Date.now()-n;i>0&&i<2e3&&(r.dataChannelRTT[e]=i)}else clearTimeout(r._rttTimer[e])})).catch((function(){clearTimeout(r._rttTimer[e])})),clearTimeout(this._rttTimer[e]),this._rttTimer[e]=setTimeout((function(){r.getDataChannelRTT(e)}),2e3)},e.prototype.destroy=function(){var e=this;Object.keys(this._localStreamStasEvtIntervals).forEach((function(t){clearInterval(e._localStreamStasEvtIntervals[t])})),Object.keys(this._remoteStreamStasEvtIntervals).forEach((function(t){clearInterval(e._remoteStreamStasEvtIntervals[t])})),Object.keys(this._rttTimer).forEach((function(t){clearTimeout(e._rttTimer[t])})),Object.keys(this._remoteStreamAudioStallInterval).forEach((function(t){clearTimeout(e._remoteStreamAudioStallInterval[t])})),this._rttTimer={},this.dataChannelRTT={},this._videoInWaiting={}},e}(),dV=new wP("MediaServerClient",2);!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(cV||(cV={}));var lV=function(e,t){dV.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},hV=function(e){function t(t){void 0===t&&(t=HU);var r=e.call(this)||this;return r._ontrackCallbackMap=new Map,r._pubConfig={},r.monitor=t,r._pubSubLock=new ZL("pubSubLock"),r._joinLeaveLock=new ZL("joinLeaveLock"),r._state=cV.DISCONNECTED,r._roomAttributes={multiChatMode:!1,bigRoomMode:!1},r}return Z_(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){dV.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(MU.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[kU.ON_ADD_STREAM,kU.ON_REMOVE_STREAM,kU.USER_CONNECTION,kU.USER_DISCONNECTION,kU.ON_UPDATE_STREAM_ATTRIBUTES,kU.ON_UPDATE_ROOM_ATTRIBUTES,kU.ON_PUSH_TRACK,kU.ON_REMOVE_TRACK,kU.NODE_CHANGE,kU.ON_CUSTOM_MESSAGE,kU.USER_MESSAGE_RECEIVED,kU.USER_BINARY_MESSAGE_RECEIVED,kU.POST_PROCESSING_MESSAGE,kU.ON_USER_TOKEN_WILL_EXPIRE].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(){dV.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(MU.ABNORMAL_DISCONNECTION)}))},t.prototype._removeSignalEventHandler=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()},Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(MU.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.setSessionId=function(){this._sessionId=Qw(),YU.setStats({rtc_session_id:this._sessionId})},t.prototype.connect=function(e,t,r,n){var i;return void 0===t&&(t=""),void 0===r&&(r=""),void 0===n&&(n={}),ev(this,void 0,void 0,(function(){var o,a,s,c=this;return tv(this,(function(u){switch(u.label){case 0:return this.connectionState=cV.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),n.node?(o=n.node,$U("es.join.nodeChange",n),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return c.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new uL,[4,null===(i=this._iceConfigRequestManager)||void 0===i?void 0:i.getAccessNode(e,t,r,sL.getDeviceId(),null==n?void 0:n.reason,this._prevICENode,this._useCloudProxy)];case 2:if(!(o=u.sent()))throw $U("es.join.getNodeFailed",""),new tw(ZN.ICE_SERVER_WRONG,"get ICE config failed");$U("es.join.getNodeSuccess",o),u.label=3;case 3:this._prevICENode=o,this._handler=new XL(this.monitor),this._addHandlerEvents(),Promise.resolve().then((function(){return c.emit("onEstablishConnectionHook")})),u.label=4;case 4:return u.trys.push([4,6,,7]),[4,this._handler.connect(o)];case 5:return a=u.sent(),dV.print("join","establish peerConnection success"),[3,7];case 6:throw s=u.sent(),this.connectionState=cV.DISCONNECTED,new tw(ZN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 7:return this._dataChannelSignal=new nL(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,r,n){var i,o,a,s;return void 0===t&&(t={}),void 0===r&&(r=!1),ev(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_=this;return tv(this,(function(v){switch(v.label){case 0:return dV.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,r,n),this._appId=e.appId,this._token=e.token,this._roomId=e.roomId,this._clientId=e.userInfo.userId,this._businessId=e.userInfo.businessId,this._userInfo=e.userInfo,this._useCloudProxy=e.useCloudProxy,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return v.sent(),[4,null===(i=this._handler)||void 0===i?void 0:i.getDefaultSdp()];case 2:return c=v.sent(),p={Authorization:aP.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId||"",timestamp:Date.now(),controlMessage:n,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role}},f={},[4,HL()];case 3:p.params=(f.supportedCodecs=v.sent(),f.deviceType="web",f.userAgent=window.navigator.userAgent,f.sdkVersion=yD.VERSION,f.deviceId=sL.getDeviceId(),f.appId=this._appId,f.roomId=this._roomId,f.userId=this._clientId,f.businessId=this._businessId,f.enable_cloud_proxy=this._useCloudProxy,f),p.options={enableUnBundleMode:!0,supportTokenExpireCallBack:!0},p.sdpInfo=c,u=p,Promise.resolve().then((function(){return _.emit("onSendingJoinMessageHook")})),v.label=4;case 4:return v.trys.push([4,6,,7]),d=r?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(d,u)];case 5:return l=v.sent(),dV.print("join","send join message success"),this._authorization=u.Authorization,this.connectionState=cV.CONNECTED,this._statsReport=new uV(this,this._handler,this.monitor,null===(o=l.config)||void 0===o?void 0:o.engine_WEB),this._pubConfig.audioRed=!!(null===(s=null===(a=l.config)||void 0===a?void 0:a.engine_WEB)||void 0===s?void 0:s.pub_audio_red),[2,l];case 6:if(h=v.sent(),this.connectionState=cV.DISCONNECTED,(null==h?void 0:h.code)>=700&&(null==h?void 0:h.code)<800)throw new tw(ZN.INVALID_TOKEN,(null==h?void 0:h.message)||"Invalid token");if(200!==(null==h?void 0:h.code))throw new tw(ZN.JOIN_ROOM_FAILED,(null==h?void 0:h.message)||"Join room failed");return[3,7];case 7:return[2]}}))}))},t.prototype.publish=function(e){var t,r,n,i,o,a,s,c;return ev(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v,m,S,E;return tv(this,(function(y){switch(y.label){case 0:dV.print("publish()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=nP(),h="",p="",f="",y.label=1;case 1:return y.trys.push([1,5,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(_=y.sent()))throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return h=_.audioMid,p=_.videoMid,f=_.sdp,e.pubAttributes={localaudio:!!d,localvideo:!!u,videostream:!!(null===(r=null==u?void 0:u.getTrack())||void 0===r?void 0:r.enabled),audiostream:!!(null===(n=null==d?void 0:d.getTrack())||void 0===n?void 0:n.enabled),extvideo:!!(u instanceof tV),extaudio:!!(d instanceof rV)},v={attributes:$_({videoDescriptions:_.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:h,videoMid:p,sdpInfo:{msid:e.stream.id,type:_.type,sdp:_.partialSdp,semantics:_.semantics}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("publish",v)];case 3:if(200!==(null==(m=y.sent())?void 0:m.code))throw new tw(ZN.PUBLISH_FAILED,(null==m?void 0:m.message)||"publish failed");return S=null===(o=null==m?void 0:m.relayMessage)||void 0===o?void 0:o.sdp,[4,null===(a=this._handler)||void 0===a?void 0:a.setAnswerSdp(_.sdp,S,void 0,e,rU.UP)];case 4:return y.sent(),e.streamId=m.streamId,e.videoMid=p,e.audioMid=h,this.monitor.rtcPublishStat(oU.SUCCESS,aU.W_0,l,sU.UNKNOWN),null===(s=this._statsReport)||void 0===s||s.setLocalStreamStatsEvtInterval(e),[2];case 5:return(E=y.sent())instanceof Error&&this.monitor.rtcPublishStat(oU.FAIL,aU.W_0,l,E.message),h&&p?[4,null===(c=this._handler)||void 0===c?void 0:c.rollback(f,[h,p])]:[3,7];case 6:y.sent(),y.label=7;case 7:throw E;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,r,n,i,o,a;return ev(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b;return tv(this,(function(T){switch(T.label){case 0:dV.print("updatePubTrack()","localStream: %o",e),s=e.videoTrack,c=e.audioTrack,null===(t=e.videoTransceiver)||void 0===t||t.sender.replaceTrack((null==s?void 0:s.getTrack())||null),c?(u=c.mixType,d=c.mixedAudioTrack,l=null==c?void 0:c.getTrack(),d&&u!==xL.PLAYOUT&&!0===l.enabled&&(l=d),null===(r=e.audioTransceiver)||void 0===r||r.sender.replaceTrack(l)):null===(n=e.audioTransceiver)||void 0===n||n.sender.replaceTrack(null),h={localaudio:!!c,localvideo:!!s,videostream:!!(null===(i=null==s?void 0:s.getTrack())||void 0===i?void 0:i.enabled),audiostream:!!(null===(o=null==c?void 0:c.getTrack())||void 0===o?void 0:o.enabled),extvideo:!!(s instanceof tV),extaudio:!!(c instanceof rV)},p={};try{for(f=rv(Object.entries(h)),_=f.next();!_.done;_=f.next())v=nv(_.value,2),m=v[0],(S=v[1])!==Reflect.get(e.pubAttributes,m)&&Reflect.set(p,m,S)}catch(e){g={error:e}}finally{try{_&&!_.done&&(b=f.return)&&b.call(f)}finally{if(g)throw g.error}}return Object.keys(p).length?(e.pubAttributes=h,E={roomId:this._roomId,streamId:e.streamId,attributes:p},[4,null===(a=this._dataChannelSignal)||void 0===a?void 0:a.sendSignaling("updateStreamAttributes",E)]):[2];case 1:if(200!==(null==(y=T.sent())?void 0:y.code))throw new tw(ZN.UPDATE_TRACK_FAILED,(null==y?void 0:y.message)||"update track failed");return[2]}}))}))},t.prototype.updateToken=function(e){var t,r,n;return ev(this,void 0,void 0,(function(){var i,o;return tv(this,(function(a){switch(a.label){case 0:if(dV.print("updateToken()","newToken: %o",e),this._token=e,!this._appId||!(null===(t=this._userInfo)||void 0===t?void 0:t.userId)||!this._roomId)return[2];i={roomId:this._roomId,userId:null===(r=this._userInfo)||void 0===r?void 0:r.userId,appId:this._appId,token:"Bearer ".concat(e)},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateToken",i)];case 2:if(200!==(null==(o=a.sent())?void 0:o.code))throw new tw(ZN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new tw(ZN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=function(e){var t,r,n;return ev(this,void 0,void 0,(function(){var i,o;return tv(this,(function(a){switch(a.label){case 0:return dV.print("unpublish()","localStream: %o",e),i={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unpublish",i)];case 1:if(200!==(null==(o=a.sent())?void 0:o.code))throw new tw(ZN.UNPUBLISH_FAILED,(null==o?void 0:o.message)||"unpublish failed");return[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 2:return a.sent(),null===(n=this._statsReport)||void 0===n||n.unpublish(e),[2]}}))}))},t.prototype.subscribe=function(e,t,r){var n,i,o,a,s,c,u,d,l;return ev(this,void 0,void 0,(function(){var h,p,f,_,v,m,S,E,y,g,b,T,I,R,A,C,O,N,w,P;return tv(this,(function(D){switch(D.label){case 0:if(e.hasSubscribed)return[2,this._updateSubTrack(e,t,r)];dV.print("subscribe()","mediaType: %o, config: %o",t,r),lV("subscribe()",e),h=!1,p=!1,t===cD.VIDEO_ONLY?h=!0:t===cD.AUDIO_ONLY?p=!0:t===cD.AUDIO_AND_VIDEO?(h=!0,p=!0):t===cD.NONE&&(h=!1,p=!1),f=nP(),_=e.audioMid,v=e.videoMid,S=!1,D.label=1;case 1:return D.trys.push([1,12,,15]),_&&v?(S=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e,{audioMid:_,videoMid:v})]):[3,3];case 2:return m=D.sent(),[3,5];case 3:return[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e)];case 4:if(!(m=D.sent()))throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,D.label=5;case 5:return E={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:v,audioMid:_,sdpInfo:{sdp:null==m?void 0:m.partialSdp,semantics:null==m?void 0:m.semantics,type:null==m?void 0:m.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||p,video:h},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("subscribe",E)];case 6:if(200!==(null==(y=D.sent())?void 0:y.code))throw new tw(ZN.SUBSCRIBE_FAILED,(null==y?void 0:y.message)||"subscribe failed");return g=[],b=!this._multiChatMode(),!(_&&v)&&g.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new tw(ZN.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(i){"video"===i.mediaType&&(dV.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),b&&g.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new tw(ZN.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(dV.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),T=function(t){e.ontrack(t)},null===(a=this._handler)||void 0===a||a.on("ontrack",T),this._ontrackCallbackMap.set(e,T),I=null==y?void 0:y.relayMessage,R=I.audioMid,A=I.videoMid,C=I.sequenceId,O=I.sdp,S&&_!==R?(dV.print("subscribe","mid mot match",_,R),[4,null===(s=this._handler)||void 0===s?void 0:s.closeMLine([_,v])]):[3,9];case 7:return D.sent(),[4,null===(c=this._handler)||void 0===c?void 0:c.subscribe(e)];case 8:if(!(m=D.sent()))throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,D.label=9;case 9:return(P={})[_]=R,P[v]=A,N=P,e.videoMid=A,e.audioMid=R,e.sequenceId=C,e.subConfig=r,e._workaround_1_=!1,e.paused=!1,e.subMediaType=t,e.hasSubscribed=!0,[4,null===(u=this._handler)||void 0===u?void 0:u.setAnswerSdp(null==m?void 0:m.sdp,O,N,e,rU.DOWN)];case 10:return D.sent(),[4,Promise.all(g)];case 11:return D.sent(),this._multiChatMode()||(e.subAudio=p),e.subVideo=h,this.monitor.rtcSubscribeStat(cU.SUCCESS,f,uU.UNKNOWN,e.userId),null===(d=this._statsReport)||void 0===d||d.setRemoteStreamStatsEvtInterval(e),[2];case 12:return(w=D.sent())instanceof Error&&this.monitor.rtcSubscribeStat(cU.FAIL,f,w.message,e.userId),_&&v?[4,null===(l=this._handler)||void 0===l?void 0:l.rollback(null==m?void 0:m.sdp,[_,v])]:[3,14];case 13:D.sent(),D.label=14;case 14:throw w;case 15:return[2]}}))}))},t.prototype.controlMessage=function(e){var t;return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(n){switch(n.label){case 0:return dV.print("controlMessage()","params: %o",e),r=e,"transcode"===e.type&&(r.roomId=this._roomId),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:return dV.print("updateUserAttributes()","attributes: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:e})];case 1:return r.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){return ev(this,void 0,void 0,(function(){return tv(this,(function(n){return[2,this._updateSubTrack(e,t,r)]}))}))},t.prototype._updateSubTrack=function(e,t,r){var n,i,o;return ev(this,void 0,void 0,(function(){var a,s,c,u;return tv(this,(function(d){switch(d.label){case 0:return dV.print("updateSubTrack()","mediaType: %o, config: %o",t,r),lV("updateSubTrack()",e),a=!1,s=!1,t===cD.VIDEO_ONLY?(a=!0,s=!1):t===cD.AUDIO_ONLY?(s=!0,a=!1):t===cD.AUDIO_AND_VIDEO?(a=!0,s=!0):t===cD.NONE&&(a=!1,s=!1),c={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:a,audio:!!this._multiChatMode()||s},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("updateSubscribe",c)];case 1:if(200!==(null==(u=d.sent())?void 0:u.code))throw new tw(ZN.UPDATE_TRACK_FAILED,(null==u?void 0:u.message)||"update track failed");return e.paused=!a,this._multiChatMode()||(null===(i=e.observer)||void 0===i||i.setUnmuteAudio(s),e.subAudio=s),null===(o=e.observer)||void 0===o||o.setUnmuteVideo(a),e.subVideo=a,e.subMediaType=t,e.subConfig=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var r,n,i,o,a,s;return ev(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_,v,m,S,E,y;return tv(this,(function(g){switch(g.label){case 0:if(dV.print("subscribe4pushTrack()","streamInfo: %o",t),lV("subscribe4pushTrack()",e),c=null==t?void 0:t.message,u=c.audioMid,d=c.videoMid,l=c.sequenceId,h=c.sdp,e.subAudio=!0,l<e.sequenceId)return dV.print("subscribe4pushTrack","sequenceId return",l,e.sequenceId),[2];p=e.audioMid,f=e.videoMid,null===(r=e.observer)||void 0===r||r.setPushTrack(!0),g.label=1;case 1:return g.trys.push([1,8,,11]),p&&f?[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e,{audioMid:p,videoMid:f})]:[3,3];case 2:return _=g.sent(),[3,5];case 3:return[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e)];case 4:if(!(_=g.sent()))throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");p=_.audioMid,f=_.videoMid,g.label=5;case 5:return(y={})[p]=u,y[f]=d,v=y,dV.print("onpushtrack midmap",e.userId,v),e.audioMid=u,e.videoMid=d,e.sequenceId=l,m=[],e.audioTrack||m.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new tw(ZN.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(dV.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),S=function(t){e.ontrack(t)},null===(o=this._handler)||void 0===o||o.on("ontrack",S),this._ontrackCallbackMap.set(e,S),[4,null===(a=this._handler)||void 0===a?void 0:a.setAnswerSdp(null==_?void 0:_.sdp,h,v,e,rU.DOWN)];case 6:return g.sent(),[4,Promise.all(m)];case 7:return g.sent(),[2];case 8:return E=g.sent(),_?[4,null===(s=this._handler)||void 0===s?void 0:s.rollback(null==_?void 0:_.sdp,[p,f])]:[3,10];case 9:g.sent(),g.label=10;case 10:throw E;case 11:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var r,n;return ev(this,void 0,void 0,(function(){return tv(this,(function(i){switch(i.label){case 0:return lV("unsubscribe4removeTrack()",e),dV.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(dV.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):(null===(r=e.observer)||void 0===r||r.setPushTrack(!1),[4,null===(n=this._handler)||void 0===n?void 0:n.closeMLine([e.videoMid||"",e.audioMid||""])]));case 1:return i.sent(),dV.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),[2]}}))}))},t.prototype.unsubscribe=function(e){var t,r,n,i,o;return ev(this,void 0,void 0,(function(){var a;return tv(this,(function(s){switch(s.label){case 0:lV("unsubscribe()",e),a={roomId:this._roomId,streamId:e.streamId,userId:e.userId},s.label=1;case 1:return s.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unsubscribe",a)];case 2:case 3:return s.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(r=e.observer)||void 0===r||r.setSubscribeVideo(!1),e.subAudio?[3,6]:(null===(n=e.observer)||void 0===n||n.setSubscribeAudio(!1),[4,null===(i=this._handler)||void 0===i?void 0:i.closeMLine([e.videoMid||"",e.audioMid||""])]);case 5:s.sent(),dV.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(o=this._statsReport)||void 0===o||o.unsubscribe(e),s.label=6;case 6:return[2]}}))}))},t.prototype.removeOnTrackListener=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))},t.prototype.handleRemoveStream=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return lV("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==DU.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this.unsubscribe(e),[2]}))}))},t.prototype.leave=function(){var e;return ev(this,void 0,void 0,(function(){var t,r,n;return tv(this,(function(i){switch(i.label){case 0:return dV.print("leave()"),this.connectionState!==cV.CONNECTED?[3,7]:(this.connectionState=cV.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]);case 1:r=i.sent(),i.label=2;case 2:return i.trys.push([2,4,5,6]),[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("leaveRoom",t)];case 3:return i.sent(),this.connectionState=cV.DISCONNECTED,[3,6];case 4:throw n=i.sent(),this.connectionState=cV.CONNECTED,n;case 5:return r(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new tw(ZN.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,r,n,i,o;return ev(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,f,_,v,m,S;return tv(this,(function(E){switch(E.label){case 0:return[4,null===(t=this._handler)||void 0===t?void 0:t.subscribe(e)];case 1:if(!(a=E.sent()))throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return s=nP(),c=a.audioMid,u=a.videoMid,d={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:c,videoMid:u,sdpInfo:{sdp:null==a?void 0:a.partialSdp,semantics:null==a?void 0:a.semantics,type:null==a?void 0:a.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("startPullStream",d)];case 2:return l=E.sent(),(h=[]).push(new Promise((function(t,r){var n=setTimeout((function(){return r(new tw(ZN.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),5e3);e.on("ontrack",(function r(i){"video"===i.mediaType&&(dV.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),h.push(new Promise((function(t,r){var n=setTimeout((function(){return r(new tw(ZN.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),5e3);e.on("ontrack",(function r(i){"audio"===i.mediaType&&(dV.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(n),t(0))}))}))),p=function(t){e.ontrack(t)},null===(n=this._handler)||void 0===n||n.on("ontrack",p),this._ontrackCallbackMap.set(e,p),f=null==l?void 0:l.relayMessage,_=f.audioMid,v=f.videoMid,m=f.sequenceId,S=f.sdp,e.videoMid=v,e.audioMid=_,e.sequenceId=m,e._workaround_1_=!1,e.paused=!1,e.hasSubscribed=!0,e.subAudio=!0,e.subVideo=!0,[4,null===(i=this._handler)||void 0===i?void 0:i.setAnswerSdp(null==a?void 0:a.sdp,S,{},e,rU.DOWN)];case 3:return E.sent(),[4,Promise.all(h)];case 4:return E.sent(),this.monitor.rtcSubscribeStat(cU.SUCCESS,s,uU.UNKNOWN,e.userId),null===(o=this._statsReport)||void 0===o||o.setRemoteStreamStatsEvtInterval(e,{rtt:!1}),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,r,n;return ev(this,void 0,void 0,(function(){var i;return tv(this,(function(o){switch(o.label){case 0:lV("unsubscribePublicStream()",e),i={appId:this._appId,streamId:e.streamId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("stopPullStream",i)];case 2:case 3:return o.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.subAudio=!1,[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 5:return o.sent(),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(n=this._statsReport)||void 0===n||n.unsubscribe(e),[2]}}))}))},t.prototype.destroy=function(){var e,t,r,n;dV.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,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(),null===(n=this._statsReport)||void 0===n||n.destroy(),this.connectionState=cV.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=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})},t.prototype.sendRoomMessage=function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)},t.prototype._multiChatMode=function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode},Object.defineProperty(t.prototype,"handler",{get:function(){return this._handler},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomAttributes",{get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),Q_([_V],t.prototype,"join",null),Q_([fV,pV],t.prototype,"publish",null),Q_([fV,pV],t.prototype,"updatePubTrack",null),Q_([fV,pV],t.prototype,"unpublish",null),Q_([fV,pV],t.prototype,"subscribe",null),Q_([pV],t.prototype,"controlMessage",null),Q_([pV],t.prototype,"updateUserAttributes",null),Q_([fV,pV],t.prototype,"updateSubTrack",null),Q_([fV,pV],t.prototype,"subscribe4pushTrack",null),Q_([fV,pV],t.prototype,"unsubscribe4removeTrack",null),Q_([fV,pV],t.prototype,"unsubscribe",null),Q_([fV,pV],t.prototype,"handleRemoveStream",null),Q_([fV],t.prototype,"subscribePublicStream",null),Q_([fV],t.prototype,"unsubscribePublicStream",null),t}(DP);function pV(e,t,r){var n=r.value;return r.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:return this._handler&&this._state===cV.CONNECTED?[4,n.apply(this,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:throw new tw(ZN.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},r}function fV(e,t,r){var n=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=r.sent(),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,n.apply(this,e)];case 3:return[2,r.sent()];case 4:return t(),[7];case 5:return[2]}}))}))},r}function _V(e,t,r){var n=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ev(this,void 0,void 0,(function(){var t,r=this;return tv(this,(function(i){return t=!1,[2,new Promise((function(i,o){return ev(r,void 0,void 0,(function(){var r,a;return tv(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new tw(ZN.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,n.apply(this,e)];case 2:return r=s.sent(),i(r),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},r}var vV,mV,SV,EV=function(){function e(){}return e.getNalunits=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)},e.getAnnexbNals=function(t){for(var r=[],n=e.getHeaderPositionAnnexB(t),i=n.pos,o=i;i<t.length-4;){var a=new Uint8Array(t.buffer.slice(i,i+n.headerLength));n.pos===t.position&&t.skip(n.headerLength),o=(n=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(i+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&r.push(s),t.skip(o-t.position),i=o}return r},e.getAvccNals=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=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+n));t.skip(n);var a={header:i,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&r.push(a)}return r},e.analyseNal=function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}},e.getHeaderPositionAnnexB=function(e){for(var t=e.position,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.getAvcc=function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength+11);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var n=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),n),n+=2,r.set(e,n),r[n+=e.byteLength]=1,n++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),n),n+=2,r.set(t,n),r},e}(),yV=function(){function e(e){this._position=0,this._dataview=new DataView(e)}return Object.defineProperty(e.prototype,"length",{get:function(){return this.buffer.byteLength},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._dataview.buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),e.prototype.back=function(e){this.position-=e},e.prototype.getUint8=function(e){return this._dataview.getUint8(e)},e.prototype.getInt8=function(e){return this._dataview.getInt8(e)},e.prototype.getInt16=function(e){return this._dataview.getInt16(e)},e.prototype.getUint16=function(e){return this._dataview.getUint16(e)},e.prototype.getUint32=function(e){return this._dataview.getUint32(e)},e.prototype.getInt32=function(e){return this._dataview.getInt32(e)},e.prototype.skip=function(t){for(var r=Math.floor(t/4),n=t%4,i=0;i<r;i++)e.readByte(this,4);n>0&&e.readByte(this,n)},e.readByte=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.prototype.readUint8=function(){return e.readByte(this,1)},e.prototype.readUint16=function(){return e.readByte(this,2)},e.prototype.readUint24=function(){return e.readByte(this,3)},e.prototype.readUint32=function(){return e.readByte(this,4)},e.prototype.readUint64=function(){return e.readByte(this,8)},e.prototype.readInt8=function(){return e.readByte(this,1,!0)},e.prototype.readInt16=function(){return e.readByte(this,2,!0)},e.prototype.readInt32=function(){return e.readByte(this,4,!0)},e.prototype.writeUint32=function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])},e}(),gV=new wP("Stream",0),bV=function(){function e(){this.isScreen=!1,this.seiList=[],this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1}}return Object.defineProperty(e.prototype,"hasPublished",{get:function(){return this.videoTransceiver&&this.audioTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),e.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(zL()){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=new Uint8Array(n.content.byteLength+5);i.set([0,0,0,1,6]),i.set(n.content,5);var o=new Uint8Array(i.byteLength+t.data.byteLength);0===n.repeatCount&&e.seiList.splice(0,1),n.repeatCount--,o.set(new Uint8Array(t.data)),o.set(i,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});n.pipeThrough(o).pipeTo(i)}}else gV.print("no sender found when trying to bind encodedTransform")},e.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else gV.print("no sender found when trying to bind encodedTransform")},e.prototype.clean=function(){this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0},e.prototype.updateVideoBitrate=function(e){var t,r=null===(t=null==e?void 0:e[0])||void 0===t?void 0:t.maxKbps;if("number"==typeof r&&r&&this.videoTransceiver){var n=this.videoTransceiver.sender,i=n.getParameters();i.encodings&&0!==i.encodings.length||(i.encodings=[{}]),i.encodings[0].maxBitrate=1e3*r,gV.print("updateVideoBitrate","set sendEncodings: ",i),n.setParameters(i)}},e.prototype.switchTrackEnableState=function(e,t){var r;"audio"===e?r=this.audioTrack:"video"===e&&(r=this.videoTrack);var n=null==r?void 0:r.getTrack();return!(!n||(null==n?void 0:n.enabled)===t)&&(n.enabled=t,!0)},e}(),TV=function(e){function t(t,r,n,i){var o=e.call(this)||this;return o.userId=t,o.isScreen=n,o.streamId=r,o.hasAudio=i.localaudio,o.hasVideo=i.localvideo,o._attributes=i,o.subVideo=!1,o.subAudio=!1,o._sequenceId=0,o.subMediaType=cD.NONE,o.subConfig={videoIndex:0},o.hasSubscribed=!1,o}return Z_(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo,this.hasAudio=e.localaudio,this._attributes=e},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=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){var n=EV.getNalunits(new yV(t.data)).find((function(e){return e.sei}));n&&e.safeEmit("onSEIMessage",n.body.slice(1)),r.enqueue(t)}})).pipeTo(n)}else gV.print("no receiver found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else gV.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,r,n;if((null===(r=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===r?void 0:r.id)===this.streamId){var i=e.track;"video"===(null==i?void 0:i.kind)?this._setVideoTrack(i):"audio"===(null===(n=e.track)||void 0===n?void 0:n.kind)&&this._setAudioTrack(i),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){var e;gV.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset()},t.prototype.resetHasSubscribed=function(){this.hasSubscribed=!1},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,r;(null===(r=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new qx(e,rP()),this.emit("ontrack",this.audioTrack))},t.prototype._setVideoTrack=function(e){var t,r;(null===(r=null===(t=this.videoTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new Jx(e,rP()),this.emit("ontrack",this.videoTrack))},t}(DP);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(vV||(vV={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_MUTE_AUDIO="on_user_mute_audio",e.ON_USER_MUTE_VIDEO="on_user_mute_video",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"}(mV||(mV={})),function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(SV||(SV={}));var IV,RV=function(){function e(e,t){this._audioEventSessionId=cP(),this._videoEventSessionId=cP(),this._isScreen=!1,this._audioFirstFrameState=SV.INITIAL,this._videoFirstFrameState=SV.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:pU.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:pU.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._publishVideo=!1,this._publishAudio=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._stream=e,this._handler=t,this.getTransportDelay()}return e.prototype.beginRecvFrame=function(e,t){var r,n,i,o,a;return ev(this,void 0,void 0,(function(){var s,c,u,d,l,h,p=this;return tv(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:return f.sent(),s=this._transportDelay,c=pU.LOGIN,u=pU.UNMUTE,d=pU.SUBSCRIBE,l=pU.PUSH_TRACK,[c,u,d,l].indexOf(t)>=0&&(s=0),e===hU.AUDIO?(this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},h={media_type:e,event_type:lU.BEGIN_RECV,type:t,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(n=this._stream)||void 0===n?void 0:n.userId,transport_delay:s},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){p.stopRecvFrame(hU.AUDIO,fU.TIMEOUT),p._firstAudioFrameInterval&&window.clearInterval(p._firstAudioFrameInterval)}),this._timeout),HU.rtcFirstFrame(h),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=SV.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===hU.VIDEO&&(this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t},h={media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?hU.SCREEN_VIDEO:e,event_type:lU.BEGIN_RECV,type:t,start:null===(o=this._currentVideoRecv)||void 0===o?void 0:o.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(a=this._stream)||void 0===a?void 0:a.userId,transport_delay:s},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){p.stopRecvFrame(hU.VIDEO,fU.TIMEOUT),p._firstVideoFrameInterval&&window.clearInterval(p._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),HU.rtcFirstFrame(h),this._videoFirstFrameState=SV.BEGIN,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0),[2]}}))}))},e.prototype.stopRecvFrame=function(e,t){var r,n,i,o,a,s,c;if(e===hU.AUDIO){if(this._audioFirstFrameState!==SV.BEGIN)return;var u={event_type:lU.RECV_END,media_type:e,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,reason:t,result:!1,stream_user_id:null===(n=this._stream)||void 0===n?void 0:n.userId,event_session_id:this._audioEventSessionId,type:null===(i=this._currentAudioRecv)||void 0===i?void 0:i.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,HU.rtcFirstFrame(u),this._audioFirstFrameState=SV.STOPPED}else if(e===hU.VIDEO){if(this._videoFirstFrameState!==SV.BEGIN)return;u={event_type:lU.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?hU.SCREEN_VIDEO:e,start:null===(a=this._currentVideoRecv)||void 0===a?void 0:a.startTime,reason:t,result:!1,stream_user_id:null===(s=this._stream)||void 0===s?void 0:s.userId,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,HU.rtcFirstFrame(u),this._videoFirstFrameState=SV.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,r,n;return ev(this,void 0,void 0,(function(){var i,o,a,s,c,u,d,l,h,p;return tv(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:if(f.sent(),i=this._transportDelay,o=pU.LOGIN,a=pU.UNMUTE,s=pU.SUBSCRIBE,c=pU.PUSH_TRACK,e===hU.AUDIO){if(this._audioFirstFrameState!==SV.BEGIN)return[2];if(!this._currentAudioRecv)return[2];u=this._currentAudioRecv,l=u.type,h=u.startTime,[o,a,s,c].indexOf(l)>=0&&(i=0),p={event_type:lU.RECV_END,media_type:e,start:h,result:!0,stream_user_id:null===(t=this._stream)||void 0===t?void 0:t.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:i},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),HU.rtcFirstFrame(p),this._audioFirstFrameState=SV.RECEIVED}else if(e===hU.VIDEO){if(this._videoFirstFrameState!==SV.BEGIN)return[2];if(!this._currentVideoRecv)return[2];d=this._currentVideoRecv,l=d.type,h=d.startTime,[o,a,s,c].indexOf(l)>=0&&(i=0),p={event_type:lU.RECV_END,media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?hU.SCREEN_VIDEO:e,start:h,result:!0,stream_user_id:null===(n=this._stream)||void 0===n?void 0:n.userId,event_session_id:this._videoEventSessionId,type:l,transport_delay:i},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),HU.rtcFirstFrame(p),this._videoFirstFrameState=SV.RECEIVED}return[2]}}))}))},e.prototype.setLogin=function(e,t){var r,n,i,o;void 0===t&&(t={audio:!0,video:!0}),this._login!==e&&(this._login=e,e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&t.audio&&this.beginRecvFrame(hU.AUDIO,pU.LOGIN),e&&(null===(n=this._stream)||void 0===n?void 0:n.hasVideo)&&t.video&&this.beginRecvFrame(hU.VIDEO,pU.LOGIN),!e&&(null===(i=this._stream)||void 0===i?void 0:i.hasAudio)&&this.stopRecvFrame(hU.AUDIO,fU.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(hU.VIDEO,fU.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(hU.AUDIO,pU.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(hU.AUDIO,fU.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(hU.AUDIO,pU.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(hU.AUDIO,fU.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(hU.AUDIO,pU.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(hU.AUDIO,fU.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(hU.VIDEO,pU.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(hU.VIDEO,fU.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(hU.VIDEO,pU.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(hU.VIDEO,fU.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(hU.VIDEO,pU.ENABLE):this.stopRecvFrame(hU.VIDEO,fU.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal=e},e.prototype.setPushAudio=function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(hU.AUDIO,pU.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(hU.AUDIO,pU.PUSH)},e.prototype.setExternalVideoSource=function(e){this._videoExternal=e},e.prototype.setPushVideo=function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(hU.VIDEO,pU.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(hU.VIDEO,pU.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(hU.VIDEO,pU.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(hU.VIDEO,fU.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(hU.AUDIO,pU.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(hU.AUDIO,fU.UNPUBLISH)},e.prototype.setAutoSubscribe=function(e){this._autoSubscribe=e},e.prototype.setAutoSubscribeVideo=function(e){this._autoSubscribeVideo=e},e.prototype.setAutoSubscribeAudio=function(e){this._autoSubscribeAudio=e},e.prototype.setSubscribeAudio=function(e){var t,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(hU.AUDIO,pU.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&this.stopRecvFrame(hU.AUDIO,fU.UNSUBSCRIBE)},e.prototype.setSubscribeVideo=function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(hU.VIDEO,pU.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&this.stopRecvFrame(hU.VIDEO,fU.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(hU.AUDIO,pU.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(hU.AUDIO,fU.REMOVE_TRACK))},e.prototype.setMultiChatMode=function(e){this._multiChatMode=e},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype._watchForFirstVideoFrameRecv=function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval((function(){return ev(e,void 0,void 0,(function(){var e,r,n,i,o,a,s,c;return tv(this,(function(u){switch(u.label){case 0:return(null===(n=this._handler)||void 0===n?void 0:n.pc)&&(null===(o=null===(i=this._stream)||void 0===i?void 0:i.videoTrack)||void 0===o?void 0:o.getTrack())?[4,jL(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.videoTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(r=e.find((function(e){return"inbound-rtp"===e.type})))&&r.framesReceived>t){if(-1===t)return t=r.framesReceived,[2];this.recvFrameFinish(hU.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype._watchForFirstAudioFrameRecv=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return ev(e,void 0,void 0,(function(){var e,r,n,i,o,a,s,c;return tv(this,(function(u){switch(u.label){case 0:return(null===(n=this._handler)||void 0===n?void 0:n.pc)&&(null===(o=null===(i=this._stream)||void 0===i?void 0:i.audioTrack)||void 0===o?void 0:o.getTrack())?[4,jL(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.audioTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(r=e.find((function(e){return"inbound-rtp"===e.type})))&&r.totalSamplesReceived>t){if(-1===t)return t=r.totalSamplesReceived,[2];this.recvFrameFinish(hU.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype.getTransportDelay=function(){return ev(this,void 0,void 0,(function(){var e=this;return tv(this,(function(t){switch(t.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return t.sent(),this._transportDelayInterval=window.setInterval((function(){return ev(e,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return e.sent(),[2]}}))}))}),2e3),[2]}}))}))},e.prototype.getTransportDelayIntl=function(){var e,t;return ev(this,void 0,void 0,(function(){var r,n,i;return tv(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,jL(null===(t=this._handler)||void 0===t?void 0:t.pc)]:[3,2];case 1:r=o.sent(),n=r.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(i=r.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==n?void 0:n.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*i.currentRoundTripTime/2)),o.label=2;case 2:return[2]}}))}))},e.prototype.reset=function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:pU.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:pU.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._transportDelayInterval&&window.clearInterval(this._transportDelayInterval)},e}();!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.SENT=3]="SENT"}(IV||(IV={}));var AV=function(){function e(e,t){this._audioEventSessionId=cP(),this._videoEventSessionId=cP(),this._currentAudioSend={startTime:0,eventSessionId:0,type:pU.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:pU.LOGIN},this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._timeout=1e4,this._audioFirstFrameState=IV.INITIAL,this._videoFirstFrameState=IV.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var r,n,i,o=this;if(e===hU.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:lU.BEGIN_SEND,type:t,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){o.stopSendFrame(hU.AUDIO,fU.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),HU.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=IV.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===hU.VIDEO){this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};a={media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?hU.SCREEN_VIDEO:e,event_type:lU.BEGIN_SEND,type:t,start:null===(i=this._currentVideoSend)||void 0===i?void 0:i.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){o.stopSendFrame(hU.VIDEO,fU.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),HU.rtcFirstFrame(a),this._videoFirstFrameState=IV.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}},e.prototype.stopSendFrame=function(e,t){var r,n,i,o,a;if(e===hU.AUDIO){if(this._audioFirstFrameState!==IV.BEGIN)return;var s={event_type:lU.SENT_END,media_type:e,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,reason:t,result:!1,event_session_id:this._audioEventSessionId,type:null===(n=this._currentAudioSend)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioSend,HU.rtcFirstFrame(s),this._audioFirstFrameState=IV.STOPPED}else if(e===hU.VIDEO){if(this._videoFirstFrameState!==IV.BEGIN)return;s={event_type:lU.SENT_END,media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?hU.SCREEN_VIDEO:e,start:null===(o=this._currentVideoSend)||void 0===o?void 0:o.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(a=this._currentVideoSend)||void 0===a?void 0:a.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,HU.rtcFirstFrame(s),this._videoFirstFrameState=IV.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===hU.AUDIO){if(this._audioFirstFrameState!==IV.BEGIN)return;if(!this._currentAudioSend)return;var r=this._currentAudioSend,n=r.type,i=r.startTime,o={event_type:lU.SENT_END,media_type:e,start:i,result:!0,event_session_id:this._audioEventSessionId,type:n};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),HU.rtcFirstFrame(o),this._audioFirstFrameState=IV.SENT}else if(e===hU.VIDEO){if(this._videoFirstFrameState!==IV.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;n=a.type,i=a.startTime,o={event_type:lU.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?hU.SCREEN_VIDEO:e,start:i,result:!0,event_session_id:this._videoEventSessionId,type:n};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),HU.rtcFirstFrame(o),this._videoFirstFrameState=IV.SENT}},e.prototype.setLogin=function(e){var t,r;this._login!==e&&(this._login=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(hU.VIDEO,pU.LOGIN),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(hU.AUDIO,pU.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(hU.AUDIO,fU.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(hU.VIDEO,fU.LEAVE_ROOM))},e.prototype.setPublish=function(e){var t,r;this._publish!==e&&(this._publish=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(hU.VIDEO,pU.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(hU.AUDIO,pU.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(hU.AUDIO,fU.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(hU.VIDEO,fU.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(hU.AUDIO,pU.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(hU.AUDIO,fU.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(hU.AUDIO,pU.ENABLE),!e&&this._audioSending&&this.stopSendFrame(hU.AUDIO,fU.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(hU.VIDEO,pU.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(hU.VIDEO,fU.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(hU.VIDEO,pU.ENABLE),!e&&this._videoSending&&this.stopSendFrame(hU.VIDEO,fU.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(hU.AUDIO,fU.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(hU.AUDIO,fU.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(hU.AUDIO,pU.PUSH),!e&&this._audioSending&&this.stopSendFrame(hU.AUDIO,fU.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(hU.VIDEO,fU.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(hU.VIDEO,fU.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(hU.VIDEO,pU.PUSH),!e&&this._videoSending&&this.stopSendFrame(hU.VIDEO,fU.STOP_PUSH))},e.prototype.setAutoPublish=function(e){this._autoPublish=e},e.prototype.setPublisher=function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(hU.AUDIO,fU.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(hU.VIDEO,fU.AUDIENCE))},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype.setPCSessionId=function(e){this._pcSessionId=e},e.prototype.setHandler=function(e){this._handler=e},e.prototype._getFirstVideoFrameStats=function(){var e,t,r,n,i,o;return ev(this,void 0,void 0,(function(){var a;return tv(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(r=null===(t=this._stream)||void 0===t?void 0:t.videoTrack)||void 0===r?void 0:r.getTrack())?[4,jL(null===(n=this._handler)||void 0===n?void 0:n.pc,null===(o=null===(i=this._stream)||void 0===i?void 0:i.videoTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._getFirstAudioFrameStats=function(){var e,t,r,n,i,o;return ev(this,void 0,void 0,(function(){var a;return tv(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(r=null===(t=this._stream)||void 0===t?void 0:t.audioTrack)||void 0===r?void 0:r.getTrack())?[4,jL(null===(n=this._handler)||void 0===n?void 0:n.pc,null===(o=null===(i=this._stream)||void 0===i?void 0:i.audioTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._watchForFirstVideoFrameSend=function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval((function(){return ev(e,void 0,void 0,(function(){var e;return tv(this,(function(r){switch(r.label){case 0:return[4,this._getFirstVideoFrameStats()];case 1:if((e=r.sent())&&e.framesSent>t){if(-1===t)return t=e.framesSent,[2];this.sendFrameFinish(hU.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}return[2]}}))}))}),100)},e.prototype._watchForFirstAudioFrameSend=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return ev(e,void 0,void 0,(function(){var e;return tv(this,(function(r){switch(r.label){case 0:return[4,this._getFirstAudioFrameStats()];case 1:if((e=r.sent())&&e.packetsSent>t){if(-1===t)return t=e.packetsSent,[2];this.sendFrameFinish(hU.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}return[2]}}))}))}),100)},e.prototype.destroy=function(){delete this._stream,delete this._handler},Object.defineProperty(e.prototype,"_audioSending",{get:function(){return this._audioFirstFrameState===IV.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===IV.BEGIN},enumerable:!1,configurable:!0}),e}(),CV=new wP("Room",1),OV=function(e){function t(t){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._waitForNewToken=!1,r._userDuplicateLoginTimerMap=new Map,r._roomConfig=t,r._mediaServerClient=new hV,r._addHandlerEventHandler(),r._isReconnecting=!1,r}return Z_(t,e),Object.defineProperty(t.prototype,"hasScreenPublished",{get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasPublished",{get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._mediaServerClient.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){return this._remoteUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){return this._remoteStreams},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localStream",{get:function(){return this._localStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenStream",{get:function(){return this._localScreenStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomInfo",{get:function(){return this._roomInfo},enumerable:!1,configurable:!0}),t.prototype._addHandlerEventHandler=function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S=this;null===(e=this._mediaServerClient)||void 0===e||e.on(kU.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(kU.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(kU.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(kU.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(kU.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(kU.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(kU.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(kU.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(kU.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(kU.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(kU.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(kU.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(kU.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(kU.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(MU.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(MU.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on("onRemoteStreamStats",(function(e){S.emit(mV.ON_REMOTE_STREAM_STATS,e)})),null===(m=this._mediaServerClient)||void 0===m||m.on("onLocalStreamStats",(function(e){S.emit(mV.ON_LOCAL_STREAM_STATS,e)}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,r,n,i,o){return ev(this,void 0,void 0,(function(){var a=this;return tv(this,(function(s){return YU.setStats({rtc_app_id:e,room_id:t,user_id:n.userId}),CV.print("join()"),[2,new Promise((function(s,c){return ev(a,void 0,void 0,(function(){var a,u,d,l=this;return tv(this,(function(h){return this._joinResolveCallback=s,this._joinRejectCallback=c,this._liveControlMessage=i,this._roomInfo={appId:e,roomId:t,token:r,userInfo:n,useCloudProxy:o},a=nP(),null===(u=this._mediaServerClient)||void 0===u||u.setSessionId(),HU.joinRoom(mU.BEGIN,a,!1,"",{enable_cloud_proxy:null===(d=this._roomInfo)||void 0===d?void 0:d.useCloudProxy}),this._join((function(e){var t;HU.joinRoom(mU.END,a,!0,e.message,{enable_cloud_proxy:null===(t=l._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)}),(function(e){var t;HU.joinRoom(mU.END,a,!1,e.message,{enable_cloud_proxy:null===(t=l._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)}),!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,r){var n;return void 0===r&&(r=!1),ev(this,void 0,void 0,(function(){var i,o,a;return tv(this,(function(s){switch(s.label){case 0:i=nP(),CV.print("_join()"),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback},r,this._liveControlMessage)];case 2:return o=s.sent(),this._mediaServerClient.roomAttributes=o.roomAttributes,this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e(null===(n=this._roomInfo)||void 0===n?void 0:n.userInfo),this._isReconnecting=!1,HU.rtcJoinRoom(0,"web","web",nP()-i),this._onJoinSucc(o,r),[3,4];case 3:return(a=s.sent()).code!==ZN.OPERATION_CANCEL&&"function"==typeof t?[2,t(a)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,r){var n,i,o,a,s;return ev(this,void 0,void 0,(function(){var c,u,d,l;return tv(this,(function(h){switch(h.label){case 0:return CV.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new bV,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new AV(this._localScreenStream,this._mediaServerClient.handler))),c=!1,u=!1,d=!1,l=!1,!this._localScreenStream.videoTrack&&t?(t instanceof tV&&(u=!0),c=!0):this._localScreenStream.videoTrack&&!t&&(c=!1),!this._localScreenStream.audioTrack&&r?(r instanceof rV&&(l=!0),d=!0):this._localScreenStream.audioTrack&&!r&&(d=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=r,this._localScreenStream.videoEncodeConfig=e,this._localScreenStream.hasPublished?[3,2]:(null===(n=this._localScreenStream.observer)||void 0===n||n.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]);case 1:return h.sent(),[3,4];case 2:return u?null===(i=this._localScreenStream.observer)||void 0===i||i.setPushVideo(c):null===(o=this._localScreenStream.observer)||void 0===o||o.setEnableVideo(c),l?null===(a=this._localScreenStream.observer)||void 0===a||a.setPushAudio(d):null===(s=this._localScreenStream.observer)||void 0===s||s.setEnableAudio(d),[4,this.updatePubScreenTrack()];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return CV.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),this._localScreenStream?[4,this._mediaServerClient.updatePubTrack(this._localScreenStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublishScreen=function(){var e;return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return CV.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?(null===(e=this._localScreenStream.observer)||void 0===e||e.setPublish(!1),[4,this._mediaServerClient.unpublish(this._localScreenStream)]):[3,2];case 1:t.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,t.label=2;case 2:return[2]}}))}))},t.prototype.liveControlMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return CV.print("controlMessage","Invoke controlMessage"),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),"stopped"===e.action&&delete this._liveControlMessage,[2]}}))}))},t.prototype.publicStreamControlMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return"stopped"===e.action&&delete e.publicStreamMeta,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return CV.print("updateUserAttributes","Invoke updateUserAttributes"),e.role&&this._roomInfo&&(this._roomInfo.userInfo.role=e.role),[4,this._mediaServerClient.updateUserAttributes(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.publish=function(e,t,r,n){var i,o,a,s,c,u;return void 0===n&&(n=!1),ev(this,void 0,void 0,(function(){var d,l,h,p,f,_;return tv(this,(function(v){switch(v.label){case 0:if(CV.print("publish","Invoke publish"),d=!1,this._localStream||(this._localStream=new bV,this._mediaServerClient.handler&&(this._localStream.observer=new AV(this._localStream,this._mediaServerClient.handler)),d=!0),this._localStream.videoTrack=t,this._localStream.audioTrack=r,this._localStream.videoEncodeConfig=e,this._localStream.hasPublished)return[3,5];v.label=1;case 1:return v.trys.push([1,3,,4]),n?null===(i=this._localStream.observer)||void 0===i||i.setLogin(!0):d&&(l=!!this._localStream.videoTrack,h=!!this._localStream.audioTrack,p=this._localStream.videoTrack instanceof tV,f=this._localStream.audioTrack instanceof rV,this._roomConfig.isAutoPublish?(l&&(p?null===(o=this._localStream.observer)||void 0===o||o.setPushVideo(!0):null===(a=this._localStream.observer)||void 0===a||a.setEnableVideo(!0)),h&&(f?null===(s=this._localStream.observer)||void 0===s||s.setPushAudio(!0):null===(c=this._localStream.observer)||void 0===c||c.setEnableAudio(!0))):null===(u=this._localStream.observer)||void 0===u||u.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return v.sent(),this.emit(mV.ON_PUBLISH_RESULT,{isScreen:!1,state:nD.PUBLISH_SUCC}),[3,4];case 3:throw _=v.sent(),this.emit(mV.ON_PUBLISH_RESULT,{isScreen:!1,state:nD.PUBLISH_FAIL}),_;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:v.sent(),v.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return CV.print("updatePubTrack","Invoke updatePubTrack"),this._localStream?[4,this._mediaServerClient.updatePubTrack(this._localStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublish=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return CV.print("unpublish","Invoke unpublish"),this._localStream?[4,this._mediaServerClient.unpublish(this._localStream)]:[3,2];case 1:e.sent(),this._localStream.clean(),this._localStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.subscribe=function(e,t,r){return ev(this,void 0,void 0,(function(){return tv(this,(function(n){switch(n.label){case 0:return CV.print("subscribe","remoteStream %o",e),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return n.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){var n,i;return ev(this,void 0,void 0,(function(){return tv(this,(function(o){return CV.print("updateSubTrack","Invoke updateSubTrack"),e.subMediaType===t&&(null===(n=null==e?void 0:e.subConfig)||void 0===n?void 0:n.videoIndex)===(null==r?void 0:r.videoIndex)?[2,Promise.resolve(e)]:[2,null===(i=this._mediaServerClient)||void 0===i?void 0:i.updateSubTrack(e,t,r)]}))}))},t.prototype.unsubscribe=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return CV.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.leave=function(e){var t;return void 0===e&&(e=!1),ev(this,void 0,void 0,(function(){var r,n,i,o,a,s,c;return tv(this,(function(u){switch(u.label){case 0:CV.print("leave","Invoke leave"),r=nP(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(n=rv(this._remoteStreams.values()),i=n.next();!i.done;i=n.next())o=i.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(e){s={error:e}}finally{try{i&&!i.done&&(c=n.return)&&c.call(n)}finally{if(s)throw s.error}}return this._localStream&&(null===(t=this._localStream.observer)||void 0===t||t.setLogin(!1)),[4,this._mediaServerClient.leave()];case 2:return u.sent(),this.destroy(),HU.rtcLeaveRoom(0,"",nP()-r),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&HU.rtcLeaveRoom(-1,a.message,nP()-r),[3,4];case 4:return[2]}}))}))},t.prototype.destroy=function(){CV.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map,this._remoteStreams=new Map,this._localStream=void 0,this._localScreenStream=void 0,this._removeHandlerEventHandler(),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear()},t.prototype.updateToken=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return CV.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.muteLocalTrack=function(e,t){var r,n,i,o,a,s;return ev(this,void 0,void 0,(function(){var c,u;return tv(this,(function(d){switch(d.label){case 0:return this._localStream&&(null===(r=this._localStream)||void 0===r?void 0:r.hasPublished)?(c=t!==tD.MUTE_STATE_OFF,u=this._localStream.switchTrackEnableState(e,c),"audio"===e?null===(i=null===(n=this.localStream)||void 0===n?void 0:n.observer)||void 0===i||i.setUnmuteAudio(c):null===(a=null===(o=this.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setUnmuteVideo(c),u?[4,null===(s=this._mediaServerClient)||void 0===s?void 0:s.updatePubTrack(this._localStream)]:[3,2]):[2,!1];case 1:d.sent(),d.label=2;case 2:return[2,u]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,r,n,i,o,a,s=this;return tv(this,(function(c){t=[];try{for(r=rv(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())i=n.value,Array.isArray(i)&&i.forEach((function(r){if(r.hasSubscribed){var n=null;switch(e){case oD.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===cD.AUDIO_ONLY?n=cD.NONE:r.subMediaType===cD.AUDIO_AND_VIDEO&&(n=cD.VIDEO_ONLY);break;case oD.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===cD.VIDEO_ONLY?n=cD.NONE:r.subMediaType===cD.AUDIO_AND_VIDEO&&(n=cD.AUDIO_ONLY);break;case oD.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==cD.NONE&&(n=cD.NONE)}if(null!==n){var i=s.updateSubTrack(r,n,r.subConfig);i&&t.push(i)}}}))}catch(e){o={error:e}}finally{try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,r,n,i,o,a,s=this;return tv(this,(function(c){t=[];try{for(r=rv(this._remoteStreams.values()),n=r.next();!n.done;n=r.next())i=n.value,Array.isArray(i)&&i.forEach((function(r){if(r.hasSubscribed){var n=null;switch(e){case oD.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===cD.NONE?n=cD.AUDIO_ONLY:r.subMediaType===cD.VIDEO_ONLY&&(n=cD.AUDIO_AND_VIDEO);break;case oD.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===cD.NONE?n=cD.VIDEO_ONLY:r.subMediaType===cD.AUDIO_ONLY&&(n=cD.AUDIO_AND_VIDEO);break;case oD.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==cD.AUDIO_AND_VIDEO&&(n=cD.AUDIO_AND_VIDEO)}if(null!==n){var i=s.updateSubTrack(r,n,r.subConfig);i&&t.push(i)}}}))}catch(e){o={error:e}}finally{try{n&&!n.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)},t.prototype.sendRoomMessage=function(e,t){var r,n;return void 0===t&&(t=!1),ev(this,void 0,void 0,(function(){var i,o;return tv(this,(function(a){switch(a.label){case 0:return i={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:t,message:""},t?(o=i,[4,aP.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:i.message=e,a.label=3;case 3:return[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.sendRoomMessage(i)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){CV.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new hV,this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var r,n,i,o,a,s=this;CV.print("JoinSuccess()");var c=[],u=[],d=[],l=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var r=s._remoteUsers.get(t.clientId);r?r._stillExist=!0:c.push(t)}}));try{for(var h=rv(this._remoteUsers.values()),p=h.next();!p.done;p=h.next()){var f=p.value;f._stillExist||u.push({clientId:f.userId}),delete f._stillExist}}catch(e){r={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(r)throw r.error}}e.streams.forEach((function(e){var t=s._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):l.push(e)}));try{for(var _=rv(this._remoteStreams.values()),v=_.next();!v.done;v=_.next()){var m=v.value;Array.isArray(m)&&m.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:DU.clientDisconnected})}))}}catch(e){i={error:e}}finally{try{v&&!v.done&&(o=_.return)&&o.call(_)}finally{if(i)throw i.error}}setTimeout((function(){u.forEach((function(e){return s._onUserDisconnection(e)})),c.forEach((function(e){return s._onUserConnection(e)})),d.forEach((function(e){return s._onRemoveStream(e)})),l.forEach((function(e){return s._onAddStream(e,!0,!1)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,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){})));try{for(var n=rv(this._remoteStreams.values()),i=n.next();!i.done;i=n.next()){var o=i.value;Array.isArray(o)&&o.forEach((function(e){return ev(r,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:if(!e.hasSubscribed)return[3,4];e.resetHasSubscribed(),r.label=1;case 1:return r.trys.push([1,3,,4]),CV.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType,e.subConfig)];case 2:return r.sent(),CV.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(mV.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=r.sent(),CV.print("failed resubscribe ".concat(e.userId," with ").concat(e.subMediaType,", error:").concat(t)),e.clean(),null==e||e.resetHasSubscribed(),[3,4];case 4:return[2]}}))}))}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t,r){var n,i,o,a,s,c,u,d,l,h;if(void 0===t&&(t=!0),void 0===r&&(r=!0),e.clientId!==(null===(n=this._roomInfo)||void 0===n?void 0:n.userInfo.userId)){var p=this._findRemoteStream(e.clientId,e.streamId);if(!p){p=new TV(e.clientId,e.streamId,e.screen,e.attributes),this._initStreamListeners(p);var f=this._remoteStreams.get(e.clientId);f?f.push(p):this._remoteStreams.set(e.clientId,[p])}if(this._mediaServerClient.handler&&(p.observer=new RV(p,this._mediaServerClient.handler)),!p.isScreen&&(r&&p.hasVideo&&(p.attributes.extvideo?(null===(i=p.observer)||void 0===i||i.setExternalVideoSource(!0),null===(o=p.observer)||void 0===o||o.setPushVideo(!0)):(null===(a=p.observer)||void 0===a||a.setExternalVideoSource(!1),null===(s=p.observer)||void 0===s||s.setPublishVideo(!0))),r&&p.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(p.attributes.extaudio?(null===(c=p.observer)||void 0===c||c.setExternalAudioSource(!0),null===(u=p.observer)||void 0===u||u.setPushAudio(!0)):(null===(d=p.observer)||void 0===d||d.setExternalAudioSource(!1),null===(l=p.observer)||void 0===l||l.setPublishAudio(!0))),!0===t&&!1===r)){var _=this._roomConfig,v=_.isAutoSubscribeAudio,m=_.isAutoSubscribeVideo;null===(h=p.observer)||void 0===h||h.setLogin(!0,{audio:v,video:m})}return t&&this.safeEmit(kU.ON_ADD_STREAM,{stream:p}),!p.isScreen&&p.hasVideo&&this.safeEmit(mV.ON_USER_START_VIDEO_CAPTURE,{userId:p.userId}),!p.isScreen&&p.hasAudio&&this.safeEmit(mV.ON_USER_START_AUDIO_CAPTURE,{userId:p.userId}),p}},t.prototype._onUserConnection=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,$_({},n)),this.safeEmit(kU.USER_CONNECTION,{userInfo:n})}},t.prototype._onUserDisconnection=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===UU.kickedByAdmin?a=ZN.KICKED_OUT:i===UU.onUserTokenDidExpire?a=ZN.TOKEN_EXPIRED:i===UU.userDuplicateLogin&&(a=ZN.DUPLICATE_LOGIN),o===LU.roomDismissByAdmin&&(a=ZN.ROOM_DISMISS),a&&this.safeEmit(mV.ON_ROOM_ERROR,{errorCode:a})}else{var s=$P.DROPPED;i===UU.userLeave?s=$P.QUIT:i===UU.kickedByAdmin?s=$P.KICKED_BY_ADMIN:i===UU.roleChanged&&(s=$P.SWITCH_TO_INVISIBLE);var c=function(){r._remoteUsers.delete(n);var e=r._remoteStreams.get(n);Array.isArray(e)&&e.length&&(e.forEach((function(e){r.safeEmit(kU.ON_REMOVE_STREAM,{stream:e,reason:"Client leave"})})),r._remoteStreams.delete(n)),r.safeEmit(mV.ON_USER_LEAVE,{userInfo:{userId:n},reason:s})};if(i===UU.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(n);null!=u||self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(n,d)}else c()}},t.prototype._onRemoveStream=function(e){var t,r,n,i,o=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=this._remoteStreams.get(e.clientId);if(a){var s=a.find((function(t){return t.streamId==e.streamId}));s&&(null===(r=this._mediaServerClient)||void 0===r||r.handleRemoveStream(s,e).then((function(){if(!(null==s?void 0:s._workaround_1_)){var t=o._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),o._remoteStreams.set(e.clientId,t)}})),this.safeEmit(kU.ON_REMOVE_STREAM,{stream:s,reason:e.message}),s.hasVideo&&(null===(n=s.observer)||void 0===n||n.setPublishVideo(!1)),s.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(null===(i=s.observer)||void 0===i||i.setPublishAudio(!1)))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t,r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E=e.clientId,y=e.streamId,g=e.attributes,b=this._findRemoteStream(E,y);if(b){var T=b.attributes,I=$_($_({},T),g),R=!1,A=I.localaudio!==T.localaudio,C=!1,O=!1,N=I.localvideo!==T.localvideo,w=!1;I.audiostream!==T.audiostream&&(R=!0,C=!!I.audiostream,I.audiostream?this.safeEmit(mV.ON_USER_MUTE_AUDIO,{userInfo:{userId:E},muteState:tD.MUTE_STATE_ON}):this.safeEmit(mV.ON_USER_MUTE_AUDIO,{userInfo:{userId:E},muteState:tD.MUTE_STATE_OFF})),I.videostream!==T.videostream&&(O=!0,w=!!I.videostream,I.videostream?this.safeEmit(mV.ON_USER_MUTE_VIDEO,{userInfo:{userId:E},muteState:tD.MUTE_STATE_ON}):this.safeEmit(mV.ON_USER_MUTE_VIDEO,{userInfo:{userId:E},muteState:tD.MUTE_STATE_OFF})),I.localaudio!==T.localaudio&&(I.localaudio?(I.extaudio?(null===(t=b.observer)||void 0===t||t.setExternalAudioSource(!0),null===(r=b.observer)||void 0===r||r.setPushAudio(!0)):(null===(n=b.observer)||void 0===n||n.setExternalAudioSource(!1),null===(i=b.observer)||void 0===i||i.setEnableAudio(!0)),this.safeEmit(mV.ON_USER_START_AUDIO_CAPTURE,{userId:E})):(I.extaudio?(null===(o=b.observer)||void 0===o||o.setExternalAudioSource(!0),null===(a=b.observer)||void 0===a||a.setPushAudio(!1)):(null===(s=b.observer)||void 0===s||s.setExternalAudioSource(!1),null===(c=b.observer)||void 0===c||c.setEnableAudio(!1)),this.safeEmit(mV.ON_USER_STOP_AUDIO_CAPTURE,{userId:E}))),I.localvideo!==T.localvideo&&(I.localvideo?(I.extvideo?(null===(u=b.observer)||void 0===u||u.setExternalVideoSource(!0),null===(d=b.observer)||void 0===d||d.setPushVideo(!0)):(null===(l=b.observer)||void 0===l||l.setExternalVideoSource(!1),null===(h=b.observer)||void 0===h||h.setEnableVideo(!0)),this.safeEmit(mV.ON_USER_START_VIDEO_CAPTURE,{userId:E})):(I.extvideo?(null===(p=b.observer)||void 0===p||p.setExternalVideoSource(!0),null===(f=b.observer)||void 0===f||f.setPushVideo(!1)):(null===(_=b.observer)||void 0===_||_.setExternalVideoSource(!1),null===(v=b.observer)||void 0===v||v.setEnableVideo(!1)),this.safeEmit(mV.ON_USER_STOP_VIDEO_CAPTURE,{userId:E}))),R&&!A&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!N&&(null===(S=b.observer)||void 0===S||S.setRemoteUnmuteVideo(w)),b.attributes=I}},t.prototype._onPushTrack=function(e){var t=this,r=e.clientId,n=e.streamId,i=this._findRemoteStream(r,n);i||(i=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(i,e).then((function(){return t.safeEmit(mV.SUBSCRIBE_PUSH_TRACK,{stream:i})})).catch((function(e){CV.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,r=e.clientId,n=e.streamId,i=e.message,o=this._findRemoteStream(r,n);o&&this._mediaServerClient.unsubscribe4removeTrack(o,i).then((function(){var e;if(o._workaround_1_){var i=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==n}));t._remoteStreams.set(r,i||[])}t.safeEmit(mV.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){CV.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,r=e.nodes,n=e.reason;sL.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,HU.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(n)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,r=this;this._isReconnecting=!0;try{for(var n=rv(this._remoteStreams.values()),i=n.next();!i.done;i=n.next()){var o=i.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}HU.rtcReconnect(1002,zM.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,KM.PEERCONNECTION),this._join((function(){HU.rtcReconnected(YM.PEERCONNECTION_RECONNECTED,WM.PEERCONNECTION)}),(function(e){CV.print("Reconnecting error, will reconnect after 3s",e),r._reconnectTimer=setTimeout(r._reconnect.bind(r),3e3)}),!0)},t.prototype._handleAbnormalDisconnection=function(){CV.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t;if(e.next===cV.DISCONNECTED)t=dD.CONNECTION_STATE_DISCONNECTED;else if(e.next===cV.CONNECTED)t=this._isReconnecting?dD.CONNECTION_STATE_RECONNECTED:dD.CONNECTION_STATE_CONNECTED;else{if(e.next!==cV.CONNECTING)return;t=this._isReconnecting?dD.CONNECTION_STATE_RECONNECTING:dD.CONNECTION_STATE_CONNECTING}this.safeEmit(MU.ON_CONNECTION_STATE_CHANGE,{state:t})},t.prototype._initStreamListeners=function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){var n;t.emit(mV.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?sD.STREAM_INDEX_SCREEN:sD.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(kU.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(kU.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(kU.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){var t,r=(null===(t=e.body)||void 0===t?void 0:t.error)||0;this.safeEmit(kU.POST_PROCESSING_MESSAGE,{code:r,message:["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"][r],type:e.type})},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(kU.ON_USER_TOKEN_WILL_EXPIRE,null)},t}(DP),NV=function(e,t){return void 0===t&&(t={}),t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var r=nv(t,2),n=r[0],i=r[1];e.setAttribute(n,i)})),e},wV=new wP("Player",0),PV=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],DV={playsinline:"","webkit-playsinline":""},kV={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},MV=function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var r="audio"===e?DV:kV;if("video"===e&&this.videoCache.length>0){if(n=this.videoCache.pop())return NV(n,{style:t,attributes:r}),n}else if("audio"===e&&this.audioCache.length>0){var n;if(n=this.audioCache.pop())return NV(n,{style:t,attributes:r}),n}return function(e,t){void 0===t&&(t={});var r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=nv(e,2),n=t[0],i=t[1];"muted"===n?r.muted=!0:r.setAttribute(n,i)})),r}(e,{style:t,attributes:r})},e.prototype.recycle=function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)},e}(),UV=new MV,LV=function(e){function t(t){var r=e.call(this)||this;r.mirrorType=lD.MIRROR_TYPE_NONE,r.emitVideoEvent=function(e){var t,n,i={type:"video",rawEvent:e,readyState:(null===(t=r._videoDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:e.type,currentTime:(null===(n=r._videoDom)||void 0===n?void 0:n.currentTime)||0,isScreen:r.isScreen};r.emit("playback_event",i)},r._internalPlay=function(){var e;if(null===(e=r._videoDom)||void 0===e?void 0:e.paused){var t=r._videoDom.play();(null==t?void 0:t.then)&&t.catch((function(e){var t,n;HU.rtcError("video autoplay failed, userId: ".concat(r.userId),-1e3),r.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(t=r._videoDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:"autoplay-error",currentTime:(null===(n=r._videoDom)||void 0===n?void 0:n.currentTime)||0})}))}};var n=t.renderDom,i=t.userId;r.renderMode=void 0!==t.renderMode?t.renderMode:aD.RENDER_MODE_FIT;var o="string"==typeof n?document.getElementById(n):n;if(!o)throw new tw(ZN.CANT_FIND_DOM,"can't find dom");return r._containerDom=o,r.userId=i,r.isScreen=!!t.isScreen,r._initVideo(),r}return Z_(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=UV.getOrCreate("video",{width:"100%",height:"100%",background:"black"}),this._videoDom.id="".concat(this.userId,"_").concat(rP()),this.renderMode===aD.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===lD.MIRROR_TYPE_RENDER)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&PV.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._videoDom&&(PV.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(r){var n;if("timeupdate"===r.eventName){var i=e.isScreen?1.5:.5;if(void 0===t.__cumulativeTime&&(t.__cumulativeTime=0),0===(null===(n=t._videoDom)||void 0===n?void 0:n.currentTime))return;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>i;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var r;return ev(this,void 0,void 0,(function(){var n,i,o=this;return tv(this,(function(a){return n=this._videoDom,wV.print("playVideo","play video track: ".concat(this.userId)),n&&n.srcObject instanceof MediaStream&&n.srcObject.getTrackById(null===(r=e.getTrack())||void 0===r?void 0:r.id)||(n||(this._initVideo(),n=this._videoDom),wV.print("playVideo","play video by dom: ".concat(null==n?void 0:n.id)),(i=new MediaStream).addTrack(e.getTrack()),n.srcObject=i,this._containerDom.appendChild(n),n.addEventListener("canplay",this._internalPlay),n.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return o._internalPlay()})),t&&this._recordFrame(t)),[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}},t.prototype.manuallyPlay=function(){if(wV.print("Invoke AudioPlayer.manuallyPlay"),!this._videoDom)throw new tw(ZN.INVALID_PARAMS,"Player not found");var e=this._videoDom.play();return(null==e?void 0:e.then)?e:Promise.resolve(e)},t.prototype.mirror=function(e){wV.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?lD.MIRROR_TYPE_RENDER:lD.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;wV.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom),UV.recycle(this._videoDom),this._removeListeners(),delete this._videoDom),this._videoDom=void 0,this.__cumulativeTime=void 0},t.prototype.destroy=function(){this.stop(),e.prototype.removeAllListeners.call(this)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(CP.exports.EventEmitter),xV=function(e){function t(t,r){var n=e.call(this)||this;if(n.emitVideoEvent=function(e){var t,r,i={type:"audio",rawEvent:e,readyState:(null===(t=n._audioDom)||void 0===t?void 0:t.readyState)||0,userId:n.userId,eventName:e.type,currentTime:(null===(r=n._audioDom)||void 0===r?void 0:r.currentTime)||0};n.emit("playback_event",i)},n._internalPlay=function(){var e,t;if($U("_internalPlay",{paused:null===(e=n._audioDom)||void 0===e?void 0:e.paused}),null===(t=n._audioDom)||void 0===t?void 0:t.paused)try{var r=n._audioDom.play();(null==r?void 0:r.then)&&r.catch((function(e){n._autoPlayError(e)})).then((function(){$U("_internalPlay successfully",{userId:n.userId})}))}catch(e){n._autoPlayError(e)}},r){var i=document.getElementById(r);if(!i)throw new tw(ZN.CANT_FIND_DOM,"can't find dom");n._containerDom=i}else n._containerDom=document.body;return n.userId=t,n._initAudio(),n}return Z_(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=UV.getOrCreate("audio",{display:"none"}),this._audioDom.id="".concat(this.userId,"_").concat(rP()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&PV.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(PV.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return ev(this,void 0,void 0,(function(){var r,n,i=this;return tv(this,(function(o){return wV.print("playAudio","play audio track: ".concat(this.userId)),(r=this._audioDom)&&r.srcObject instanceof MediaStream&&r.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)||(r||(this._initAudio(),r=this._audioDom),(n=new MediaStream).addTrack(e.getTrack()),r.srcObject=n,null==r||r.addEventListener("canplay",this._internalPlay),null==r||r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return i._internalPlay()}))),[2]}))}))},t.prototype._autoPlayError=function(e){var t,r;HU.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(r=this._audioDom)||void 0===r?void 0:r.currentTime)||0})},t.prototype.manuallyPlay=function(){if(wV.print("Invoke AudioPlayer.manuallyPlay"),!this._audioDom)throw new tw(ZN.INVALID_PARAMS,"Player not found");var e=this._audioDom.play();return(null==e?void 0:e.then)?e:Promise.resolve(e)},t.prototype.setPlaybackDevice=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:return wV.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,xx.getAudioPlayback()];case 1:return t=r.sent(),t.map((function(e){return e.deviceId})).includes(e)&&this._audioDom&&this._audioDom.setSinkId?[4,this._audioDom.setSinkId(e)]:[2];case 2:return r.sent(),[2]}}))}))},t.prototype.stop=function(){var e=this._containerDom;wV.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom),UV.recycle(this._audioDom),this._removeListeners(),delete this._audioDom),this._audioDom=void 0},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){this.stop(),e.prototype.removeAllListeners.call(this)},t}(CP.exports.EventEmitter),VV="object"==("undefined"==typeof global?"undefined":us(global))&&global&&global.Object===Object&&global,FV="object"==("undefined"==typeof self?"undefined":us(self))&&self&&self.Object===Object&&self,BV=VV||FV||Function("return this")(),jV=BV.Symbol,GV=Object.prototype,HV=GV.hasOwnProperty,zV=GV.toString,KV=jV?jV.toStringTag:void 0;var YV=Object.prototype.toString;var WV=jV?jV.toStringTag:void 0;function XV(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":WV&&WV in Object(e)?function(e){var t=HV.call(e,KV),r=e[KV];try{e[KV]=void 0;var n=!0}catch(e){}var i=zV.call(e);return n&&(t?e[KV]=r:delete e[KV]),i}(e):function(e){return YV.call(e)}(e)}function JV(e){return null!=e&&"object"==us(e)}var qV=Array.isArray;function ZV(e){var t=us(e);return null!=e&&("object"==t||"function"==t)}function $V(e){return e}function QV(e){if(!ZV(e))return!1;var t=XV(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var eF=BV["__core-js_shared__"],tF=function(){var e=/[^.]+$/.exec(eF&&eF.keys&&eF.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var rF=Function.prototype.toString;var nF=/^\[object .+?Constructor\]$/,iF=Function.prototype,oF=Object.prototype,aF=iF.toString,sF=oF.hasOwnProperty,cF=RegExp("^"+aF.call(sF).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function uF(e){return!(!ZV(e)||(t=e,tF&&tF in t))&&(QV(e)?cF:nF).test(function(e){if(null!=e){try{return rF.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function dF(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 lF=Date.now;var hF,pF,fF,_F=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return uF(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),vF=_F,mF=vF?function(e,t){return vF(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:$V,SF=(hF=mF,pF=0,fF=0,function(){var e=lF(),t=16-(e-fF);if(fF=e,t>0){if(++pF>=800)return arguments[0]}else pF=0;return hF.apply(void 0,arguments)}),EF=/^(?:0|[1-9]\d*)$/;function yF(e,t){var r=us(e);return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&EF.test(e))&&e>-1&&e%1==0&&e<t}function gF(e,t,r){"__proto__"==t&&vF?vF(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function bF(e,t){return e===t||e!=e&&t!=t}var TF=Object.prototype.hasOwnProperty;function IF(e,t,r){var n=e[t];TF.call(e,t)&&bF(n,r)&&(void 0!==r||t in e)||gF(e,t,r)}var RF=Math.max;function AF(e,t){return SF(function(e,t,r){return t=RF(void 0===t?e.length-1:t,0),function(){for(var n=arguments,i=-1,o=RF(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),dF(e,this,s)}}(e,t,$V),e+"")}function CF(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function OF(e){return null!=e&&CF(e.length)&&!QV(e)}var NF=Object.prototype;function wF(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||NF)}function PF(e){return JV(e)&&"[object Arguments]"==XV(e)}var DF=Object.prototype,kF=DF.hasOwnProperty,MF=DF.propertyIsEnumerable,UF=PF(function(){return arguments}())?PF:function(e){return JV(e)&&kF.call(e,"callee")&&!MF.call(e,"callee")};var LF="object"==("undefined"==typeof exports?"undefined":us(exports))&&exports&&!exports.nodeType&&exports,xF=LF&&"object"==("undefined"==typeof module?"undefined":us(module))&&module&&!module.nodeType&&module,VF=xF&&xF.exports===LF?BV.Buffer:void 0,FF=(VF?VF.isBuffer:void 0)||function(){return!1},BF={};BF["[object Float32Array]"]=BF["[object Float64Array]"]=BF["[object Int8Array]"]=BF["[object Int16Array]"]=BF["[object Int32Array]"]=BF["[object Uint8Array]"]=BF["[object Uint8ClampedArray]"]=BF["[object Uint16Array]"]=BF["[object Uint32Array]"]=!0,BF["[object Arguments]"]=BF["[object Array]"]=BF["[object ArrayBuffer]"]=BF["[object Boolean]"]=BF["[object DataView]"]=BF["[object Date]"]=BF["[object Error]"]=BF["[object Function]"]=BF["[object Map]"]=BF["[object Number]"]=BF["[object Object]"]=BF["[object RegExp]"]=BF["[object Set]"]=BF["[object String]"]=BF["[object WeakMap]"]=!1;var jF="object"==("undefined"==typeof exports?"undefined":us(exports))&&exports&&!exports.nodeType&&exports,GF=jF&&"object"==("undefined"==typeof module?"undefined":us(module))&&module&&!module.nodeType&&module,HF=GF&&GF.exports===jF&&VV.process,zF=function(){try{var e=GF&&GF.require&&GF.require("util").types;return e||HF&&HF.binding&&HF.binding("util")}catch(e){}}(),KF=zF&&zF.isTypedArray,YF=KF?function(e){return function(t){return e(t)}}(KF):function(e){return JV(e)&&CF(e.length)&&!!BF[XV(e)]},WF=YF,XF=Object.prototype.hasOwnProperty;function JF(e,t){var r=qV(e),n=!r&&UF(e),i=!r&&!n&&FF(e),o=!r&&!n&&!i&&WF(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&&!XF.call(e,u)||a&&("length"==u||i&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||yF(u,c))||s.push(u);return s}var qF=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),ZF=qF,$F=Object.prototype.hasOwnProperty;function QF(e){return OF(e)?JF(e):function(e){if(!wF(e))return ZF(e);var t=[];for(var r in Object(e))$F.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var eB=Object.prototype.hasOwnProperty;function tB(e){if(!ZV(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=wF(e),r=[];for(var n in e)("constructor"!=n||!t&&eB.call(e,n))&&r.push(n);return r}var rB,nB=(rB=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?gF(r,s,c):IF(r,s,c)}}(t,function(e){return OF(e)?JF(e,!0):tB(e)}(t),e)},AF((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=rB.length>3&&"function"==typeof i?(n--,i):void 0,o&&function(e,t,r){if(!ZV(r))return!1;var n=us(t);return!!("number"==n?OF(r)&&yF(t,r.length):"string"==n&&t in r)&&bF(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&&rB(e,a,r,i)}return e}))),iB=nB;function oB(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 aB(e){return null==e?[]:oB(e,QF(e))}var sB=o,cB=Ze("iterator"),uB=!sB((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})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[cB]||"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})),dB=T,lB=/[^\0-\u007E]/,hB=/[.\u3002\uFF0E\uFF61]/g,pB="Overflow: input needs wider integers to process",fB=n.RangeError,_B=dB(hB.exec),vB=Math.floor,mB=String.fromCharCode,SB=dB("".charCodeAt),EB=dB([].join),yB=dB([].push),gB=dB("".replace),bB=dB("".split),TB=dB("".toLowerCase),IB=function(e){return e+22+75*(e<26)},RB=function(e,t,r){var n=0;for(e=r?vB(e/700):e>>1,e+=vB(e/t);e>455;)e=vB(e/35),n+=36;return vB(n+36*e/(e+38))},AB=function(e){var t=[];e=function(e){for(var t=[],r=0,n=e.length;r<n;){var i=SB(e,r++);if(i>=55296&&i<=56319&&r<n){var o=SB(e,r++);56320==(64512&o)?yB(t,((1023&i)<<10)+(1023&o)+65536):(yB(t,i),r--)}else yB(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&&yB(t,mB(n));var c=t.length,u=c;for(c&&yB(t,"-");u<i;){var d=2147483647;for(r=0;r<e.length;r++)(n=e[r])>=o&&n<d&&(d=n);var l=u+1;if(d-o>vB((2147483647-a)/l))throw fB(pB);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((n=e[r])<o&&++a>2147483647)throw fB(pB);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 _=h-f,v=36-f;yB(t,mB(IB(f+_%v))),h=vB(_/v),p+=36}yB(t,mB(IB(h))),s=RB(a,l,u==c),a=0,u++}}a++,o++}return EB(t,"")},CB=jn,OB=n,NB=K,wB=d,PB=T,DB=uB,kB=Ht.exports,MB=Ku,UB=vc,LB=pf,xB=br,VB=Qu,FB=F,BB=Ue,jB=Kn,GB=ni,HB=Pt,zB=j,KB=qo,YB=ko,WB=m,XB=vd,JB=ud,qB=Qd,ZB=dT,$B=Ze("iterator"),QB=xB.set,ej=xB.getterFor("URLSearchParams"),tj=xB.getterFor("URLSearchParamsIterator"),rj=NB("fetch"),nj=NB("Request"),ij=NB("Headers"),oj=nj&&nj.prototype,aj=ij&&ij.prototype,sj=OB.RegExp,cj=OB.TypeError,uj=OB.decodeURIComponent,dj=OB.encodeURIComponent,lj=PB("".charAt),hj=PB([].join),pj=PB([].push),fj=PB("".replace),_j=PB([].shift),vj=PB([].splice),mj=PB("".split),Sj=PB("".slice),Ej=/\+/g,yj=Array(4),gj=function(e){return yj[e-1]||(yj[e-1]=sj("((?:%[\\da-f]{2}){"+e+"})","gi"))},bj=function(e){try{return uj(e)}catch(t){return e}},Tj=function(e){var t=fj(e,Ej," "),r=4;try{return uj(t)}catch(e){for(;r;)t=fj(t,gj(r--),bj);return t}},Ij=/[!'()~]|%20/g,Rj={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},Aj=function(e){return Rj[e]},Cj=function(e){return fj(dj(e),Ij,Aj)},Oj=LB((function(e,t){QB(this,{type:"URLSearchParamsIterator",iterator:XB(ej(e).entries),kind:t})}),"Iterator",(function(){var e=tj(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),Nj=function(e){this.entries=[],this.url=null,void 0!==e&&(zB(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===lj(e,0)?Sj(e,1):e:KB(e)))};Nj.prototype={type:"URLSearchParams",bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,n,i,o,a,s,c=JB(e);if(c)for(r=(t=XB(e,c)).next;!(n=wB(r,t)).done;){if(o=(i=XB(HB(n.value))).next,(a=wB(o,i)).done||(s=wB(o,i)).done||!wB(o,i).done)throw cj("Expected sequence with length 2");pj(this.entries,{key:KB(a.value),value:KB(s.value)})}else for(var u in e)BB(e,u)&&pj(this.entries,{key:u,value:KB(e[u])})},parseQuery:function(e){if(e)for(var t,r,n=mj(e,"&"),i=0;i<n.length;)(t=n[i++]).length&&(r=mj(t,"="),pj(this.entries,{key:Tj(_j(r)),value:Tj(hj(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],n=0;n<t.length;)e=t[n++],pj(r,Cj(e.key)+"="+Cj(e.value));return hj(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var wj=function(){VB(this,Pj);var e=arguments.length>0?arguments[0]:void 0;QB(this,new Nj(e))},Pj=wj.prototype;if(MB(Pj,{append:function(e,t){qB(arguments.length,2);var r=ej(this);pj(r.entries,{key:KB(e),value:KB(t)}),r.updateURL()},delete:function(e){qB(arguments.length,1);for(var t=ej(this),r=t.entries,n=KB(e),i=0;i<r.length;)r[i].key===n?vj(r,i,1):i++;t.updateURL()},get:function(e){qB(arguments.length,1);for(var t=ej(this).entries,r=KB(e),n=0;n<t.length;n++)if(t[n].key===r)return t[n].value;return null},getAll:function(e){qB(arguments.length,1);for(var t=ej(this).entries,r=KB(e),n=[],i=0;i<t.length;i++)t[i].key===r&&pj(n,t[i].value);return n},has:function(e){qB(arguments.length,1);for(var t=ej(this).entries,r=KB(e),n=0;n<t.length;)if(t[n++].key===r)return!0;return!1},set:function(e,t){qB(arguments.length,1);for(var r,n=ej(this),i=n.entries,o=!1,a=KB(e),s=KB(t),c=0;c<i.length;c++)(r=i[c]).key===a&&(o?vj(i,c--,1):(o=!0,r.value=s));o||pj(i,{key:a,value:s}),n.updateURL()},sort:function(){var e=ej(this);ZB(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=ej(this).entries,n=jB(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 Oj(this,"keys")},values:function(){return new Oj(this,"values")},entries:function(){return new Oj(this,"entries")}},{enumerable:!0}),kB(Pj,$B,Pj.entries,{name:"entries"}),kB(Pj,"toString",(function(){return ej(this).serialize()}),{enumerable:!0}),UB(wj,"URLSearchParams"),CB({global:!0,forced:!DB},{URLSearchParams:wj}),!DB&&FB(ij)){var Dj=PB(aj.has),kj=PB(aj.set),Mj=function(e){if(zB(e)){var t,r=e.body;if("URLSearchParams"===GB(r))return t=e.headers?new ij(e.headers):new ij,Dj(t,"content-type")||kj(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),YB(e,{body:WB(0,KB(r)),headers:WB(0,t)})}return e};if(FB(rj)&&CB({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return rj(e,arguments.length>1?Mj(arguments[1]):{})}}),FB(nj)){var Uj=function(e){return VB(this,oj),new nj(e,arguments.length>1?Mj(arguments[1]):{})};oj.constructor=Uj,Uj.prototype=oj,CB({global:!0,forced:!0},{Request:Uj})}}var Lj,xj={URLSearchParams:wj,getState:ej},Vj=jn,Fj=a,Bj=uB,jj=n,Gj=Kn,Hj=T,zj=uo.f,Kj=Ht.exports,Yj=Qu,Wj=Ue,Xj=ws,Jj=Bw,qj=Qs,Zj=Zf.codeAt,$j=function(e){var t,r,n=[],i=bB(gB(TB(e),hB,"."),".");for(t=0;t<i.length;t++)r=i[t],yB(n,_B(lB,r)?"xn--"+AB(r):r);return EB(n,".")},Qj=qo,eG=vc,tG=Qd,rG=xj,nG=br,iG=nG.set,oG=nG.getterFor("URL"),aG=rG.URLSearchParams,sG=rG.getState,cG=jj.URL,uG=jj.TypeError,dG=jj.parseInt,lG=Math.floor,hG=Math.pow,pG=Hj("".charAt),fG=Hj(/./.exec),_G=Hj([].join),vG=Hj(1..toString),mG=Hj([].pop),SG=Hj([].push),EG=Hj("".replace),yG=Hj([].shift),gG=Hj("".split),bG=Hj("".slice),TG=Hj("".toLowerCase),IG=Hj([].unshift),RG=/[a-z]/i,AG=/[\d+-.a-z]/i,CG=/\d/,OG=/^0x/i,NG=/^[0-7]+$/,wG=/^\d+$/,PG=/^[\da-f]+$/i,DG=/[\0\t\n\r #%/:<>?@[\\\]^|]/,kG=/[\0\t\n\r #/:<>?@[\\\]^|]/,MG=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,UG=/[\t\n\r]/g,LG=function(e){var t,r,n,i;if("number"==typeof e){for(t=[],r=0;r<4;r++)IG(t,e%256),e=lG(e/256);return _G(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+=vG(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},xG={},VG=Xj({},xG,{" ":1,'"':1,"<":1,">":1,"`":1}),FG=Xj({},VG,{"#":1,"?":1,"{":1,"}":1}),BG=Xj({},FG,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),jG=function(e,t){var r=Zj(e,0);return r>32&&r<127&&!Wj(t,e)?e:encodeURIComponent(e)},GG={ftp:21,file:null,http:80,https:443,ws:80,wss:443},HG=function(e,t){var r;return 2==e.length&&fG(RG,pG(e,0))&&(":"==(r=pG(e,1))||!t&&"|"==r)},zG=function(e){var t;return e.length>1&&HG(bG(e,0,2))&&(2==e.length||"/"===(t=pG(e,2))||"\\"===t||"?"===t||"#"===t)},KG=function(e){return"."===e||"%2e"===TG(e)},YG={},WG={},XG={},JG={},qG={},ZG={},$G={},QG={},eH={},tH={},rH={},nH={},iH={},oH={},aH={},sH={},cH={},uH={},dH={},lH={},hH={},pH=function(e,t,r){var n,i,o,a=Qj(e);if(t){if(i=this.parse(a))throw uG(i);this.searchParams=null}else{if(void 0!==r&&(n=new pH(r,!0)),i=this.parse(a,null,n))throw uG(i);(o=sG(new aG)).bindURL(this),this.searchParams=o}};pH.prototype={type:"URL",parse:function(e,t,r){var n,i,o,a,s,c=this,u=t||YG,d=0,l="",h=!1,p=!1,f=!1;for(e=Qj(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=EG(e,MG,"")),e=EG(e,UG,""),n=Jj(e);d<=n.length;){switch(i=n[d],u){case YG:if(!i||!fG(RG,i)){if(t)return"Invalid scheme";u=XG;continue}l+=TG(i),u=WG;break;case WG:if(i&&(fG(AG,i)||"+"==i||"-"==i||"."==i))l+=TG(i);else{if(":"!=i){if(t)return"Invalid scheme";l="",u=XG,d=0;continue}if(t&&(c.isSpecial()!=Wj(GG,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&GG[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=oH:c.isSpecial()&&r&&r.scheme==c.scheme?u=JG:c.isSpecial()?u=QG:"/"==n[d+1]?(u=qG,d++):(c.cannotBeABaseURL=!0,SG(c.path,""),u=dH)}break;case XG:if(!r||r.cannotBeABaseURL&&"#"!=i)return"Invalid scheme";if(r.cannotBeABaseURL&&"#"==i){c.scheme=r.scheme,c.path=qj(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=hH;break}u="file"==r.scheme?oH:ZG;continue;case JG:if("/"!=i||"/"!=n[d+1]){u=ZG;continue}u=eH,d++;break;case qG:if("/"==i){u=tH;break}u=uH;continue;case ZG:if(c.scheme=r.scheme,i==Lj)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=qj(r.path),c.query=r.query;else if("/"==i||"\\"==i&&c.isSpecial())u=$G;else if("?"==i)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=qj(r.path),c.query="",u=lH;else{if("#"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=qj(r.path),c.path.length--,u=uH;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=qj(r.path),c.query=r.query,c.fragment="",u=hH}break;case $G:if(!c.isSpecial()||"/"!=i&&"\\"!=i){if("/"!=i){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=uH;continue}u=tH}else u=eH;break;case QG:if(u=eH,"/"!=i||"/"!=pG(l,d+1))continue;d++;break;case eH:if("/"!=i&&"\\"!=i){u=tH;continue}break;case tH:if("@"==i){h&&(l="%40"+l),h=!0,o=Jj(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||f){var m=jG(v,BG);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(i==Lj||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=Jj(l).length+1,l="",u=rH}else l+=i;break;case rH:case nH:if(t&&"file"==c.scheme){u=sH;continue}if(":"!=i||p){if(i==Lj||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()){if(c.isSpecial()&&""==l)return"Invalid host";if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=cH,t)return;continue}"["==i?p=!0:"]"==i&&(p=!1),l+=i}else{if(""==l)return"Invalid host";if(a=c.parseHost(l))return a;if(l="",u=iH,t==nH)return}break;case iH:if(!fG(CG,i)){if(i==Lj||"/"==i||"?"==i||"#"==i||"\\"==i&&c.isSpecial()||t){if(""!=l){var S=dG(l,10);if(S>65535)return"Invalid port";c.port=c.isSpecial()&&S===GG[c.scheme]?null:S,l=""}if(t)return;u=cH;continue}return"Invalid port"}l+=i;break;case oH:if(c.scheme="file","/"==i||"\\"==i)u=aH;else{if(!r||"file"!=r.scheme){u=uH;continue}if(i==Lj)c.host=r.host,c.path=qj(r.path),c.query=r.query;else if("?"==i)c.host=r.host,c.path=qj(r.path),c.query="",u=lH;else{if("#"!=i){zG(_G(qj(n,d),""))||(c.host=r.host,c.path=qj(r.path),c.shortenPath()),u=uH;continue}c.host=r.host,c.path=qj(r.path),c.query=r.query,c.fragment="",u=hH}}break;case aH:if("/"==i||"\\"==i){u=sH;break}r&&"file"==r.scheme&&!zG(_G(qj(n,d),""))&&(HG(r.path[0],!0)?SG(c.path,r.path[0]):c.host=r.host),u=uH;continue;case sH:if(i==Lj||"/"==i||"\\"==i||"?"==i||"#"==i){if(!t&&HG(l))u=uH;else if(""==l){if(c.host="",t)return;u=cH}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=cH}continue}l+=i;break;case cH:if(c.isSpecial()){if(u=uH,"/"!=i&&"\\"!=i)continue}else if(t||"?"!=i)if(t||"#"!=i){if(i!=Lj&&(u=uH,"/"!=i))continue}else c.fragment="",u=hH;else c.query="",u=lH;break;case uH:if(i==Lj||"/"==i||"\\"==i&&c.isSpecial()||!t&&("?"==i||"#"==i)){if(".."===(s=TG(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==i||"\\"==i&&c.isSpecial()||SG(c.path,"")):KG(l)?"/"==i||"\\"==i&&c.isSpecial()||SG(c.path,""):("file"==c.scheme&&!c.path.length&&HG(l)&&(c.host&&(c.host=""),l=pG(l,0)+":"),SG(c.path,l)),l="","file"==c.scheme&&(i==Lj||"?"==i||"#"==i))for(;c.path.length>1&&""===c.path[0];)yG(c.path);"?"==i?(c.query="",u=lH):"#"==i&&(c.fragment="",u=hH)}else l+=jG(i,FG);break;case dH:"?"==i?(c.query="",u=lH):"#"==i?(c.fragment="",u=hH):i!=Lj&&(c.path[0]+=jG(i,xG));break;case lH:t||"#"!=i?i!=Lj&&("'"==i&&c.isSpecial()?c.query+="%27":c.query+="#"==i?"%23":jG(i,xG)):(c.fragment="",u=hH);break;case hH:i!=Lj&&(c.fragment+=jG(i,VG))}d++}},parseHost:function(e){var t,r,n;if("["==pG(e,0)){if("]"!=pG(e,e.length-1))return"Invalid host";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 pG(e,l)};if(":"==h()){if(":"!=pG(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&fG(PG,h());)t=16*t+dG(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(!fG(CG,h()))return;for(;fG(CG,h());){if(o=dG(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}(bG(e,1,-1)),!t)return"Invalid host";this.host=t}else if(this.isSpecial()){if(e=$j(e),fG(DG,e))return"Invalid host";if(t=function(e){var t,r,n,i,o,a,s,c=gG(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"==pG(i,0)&&(o=fG(OG,i)?16:8,i=bG(i,8==o?1:2)),""===i)a=0;else{if(!fG(10==o?wG:8==o?NG:PG,i))return e;a=dG(i,o)}SG(r,a)}for(n=0;n<t;n++)if(a=r[n],n==t-1){if(a>=hG(256,5-t))return null}else if(a>255)return null;for(s=mG(r),n=0;n<r.length;n++)s+=r[n]*hG(256,3-n);return s}(e),null===t)return"Invalid host";this.host=t}else{if(fG(kG,e))return"Invalid host";for(t="",r=Jj(e),n=0;n<r.length;n++)t+=jG(r[n],xG);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return Wj(GG,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&HG(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+=LG(i),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+_G(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw uG(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new fH(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+LG(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(Qj(e)+":",YG)},getUsername:function(){return this.username},setUsername:function(e){var t=Jj(Qj(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=jG(t[r],BG)}},getPassword:function(){return this.password},setPassword:function(e){var t=Jj(Qj(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=jG(t[r],BG)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?LG(e):LG(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,rH)},getHostname:function(){var e=this.host;return null===e?"":LG(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,nH)},getPort:function(){var e=this.port;return null===e?"":Qj(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=Qj(e))?this.port=null:this.parse(e,iH))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+_G(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,cH))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=Qj(e))?this.query=null:("?"==pG(e,0)&&(e=bG(e,1)),this.query="",this.parse(e,lH)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=Qj(e))?("#"==pG(e,0)&&(e=bG(e,1)),this.fragment="",this.parse(e,hH)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var fH=function(e){var t=Yj(this,_H),r=tG(arguments.length,1)>1?arguments[1]:void 0,n=iG(t,new pH(e,!1,r));Fj||(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())},_H=fH.prototype,vH=function(e,t){return{get:function(){return oG(this)[e]()},set:t&&function(e){return oG(this)[t](e)},configurable:!0,enumerable:!0}};if(Fj&&zj(_H,{href:vH("serialize","setHref"),origin:vH("getOrigin"),protocol:vH("getProtocol","setProtocol"),username:vH("getUsername","setUsername"),password:vH("getPassword","setPassword"),host:vH("getHost","setHost"),hostname:vH("getHostname","setHostname"),port:vH("getPort","setPort"),pathname:vH("getPathname","setPathname"),search:vH("getSearch","setSearch"),searchParams:vH("getSearchParams"),hash:vH("getHash","setHash")}),Kj(_H,"toJSON",(function(){return oG(this).serialize()}),{enumerable:!0}),Kj(_H,"toString",(function(){return oG(this).serialize()}),{enumerable:!0}),cG){var mH=cG.createObjectURL,SH=cG.revokeObjectURL;mH&&Kj(fH,"createObjectURL",Gj(mH,cG)),SH&&Kj(fH,"revokeObjectURL",Gj(SH,cG))}eG(fH,"URL"),Vj({global:!0,forced:!Bj,sham:!Fj},{URL:fH});var EH,yH=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],this._context=e,this._localGainNode.gain.value=1}return e.prototype.mixMediaStream=function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)},e.prototype.startAudioMixing=function(e,t,r){return ev(this,void 0,void 0,(function(){var n,i,o,a,s,c,u,d,l,h,p,f,_=this;return tv(this,(function(v){switch(v.label){case 0:if(n=r.playCount,mP(i=r.type,"mixingType",aB(xL)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=Hx(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:VL.AUDIO_MIXING_STATE_STOPPED,error:$N.AUDIO_MIXING_ERROR_OK});try{s.gainNode.disconnect(this._audioDestination),s.audioSource.disconnect(s.gainNode)}catch(e){}}return(u=this.resourcesCache.get(e))&&u.filePath===t?(c=u.getAudioNode(),[3,3]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw _._context.emitMessage({mixId:e,state:VL.AUDIO_MIXING_STATE_FAILED,error:$N.AUDIO_MIXING_ERROR_START_FAILED}),new tw(ZN.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:d=v.sent(),c=new Audio(URL.createObjectURL(new Blob([d]))),v.label=3;case 3:return c.crossOrigin="anonymous",n<=0?c.loop=!0:n>0&&(l=n,c.onended=function(){--l>0?c.play():_._context.emitMessage({mixId:e,state:VL.AUDIO_MIXING_STATE_FINISHED,error:$N.AUDIO_MIXING_ERROR_OK})}),[4,c.play()];case 4:if(v.sent(),h=this._sharedAudioContext.createMediaElementSource(c),p=this._sharedAudioContext.createGain(),f=this.volumeConfig.get(e),p.gain.value=f?f/100:1,h.connect(p).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:h,audioNode:c,gainNode:p,type:"file"}),i===xL.PUBLISH)try{p.disconnect(this._sharedAudioContext.destination)}catch(e){}else p.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],r.type),this._context.emitMessage({mixId:e,state:VL.AUDIO_MIXING_STATE_PLAYING,error:$N.AUDIO_MIXING_ERROR_OK}),[2]}}))}))},e.prototype.stopAudioMixing=function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:e,state:VL.AUDIO_MIXING_STATE_STOPPED,error:$N.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:VL.AUDIO_MIXING_STATE_PAUSED,error:$N.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())},e.prototype.resumeAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:VL.AUDIO_MIXING_STATE_PLAYING,error:$N.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return ev(this,void 0,void 0,(function(){var r,n=this;return tv(this,(function(i){switch(i.label){case 0:return this.stopAudioMixing(e),[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return n._context.emitMessage({mixId:e,state:VL.AUDIO_MIXING_STATE_PRELOADED,error:$N.AUDIO_MIXING_ERROR_OK}),t.arrayBuffer();throw n._context.emitMessage({mixId:e,state:VL.AUDIO_MIXING_STATE_FAILED,error:$N.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new tw(ZN.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(e){throw new tw(ZN.LOAD_RESOURCES_FAILED,"Load resources failed",e)}))];case 1:return r=i.sent(),this.resourcesCache.set(e,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([r])))},filePath:t}),[2]}}))}))},e.prototype.unloadAudioMixing=function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)},e.prototype.getAudioMixingVolume=function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0},e.prototype.setAudioMixingVolume=function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)},e.prototype.getAudioMixingDuration=function(e){var t=this.mixingMap.get(e),r=this.mixingMap.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.audioNode.duration:0:0},e.prototype.getAudioMixingCurrentPosition=function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0},e.prototype.setAudioMixingPosition=function(e,t){var r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())},e.prototype.enableAudioMixingBuffer=function(e){mP(e,"type",aB(xL));var t=this._context.getLocalAudioTrack();if(t){var r=Hx(t.getTrack());if(r&&this.mixMediaStream(r),e===xL.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:VL.AUDIO_MIXING_STATE_PCM_ENABLED,error:$N.AUDIO_MIXING_ERROR_OK})}},e.prototype.disableAudioMixingBuffer=function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:VL.AUDIO_MIXING_STATE_PCM_DISABLED,error:$N.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0)||(this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode),this._audioBufferSource.start(),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)}})},e.prototype.stopAll=function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(e){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))},Object.defineProperty(e.prototype,"mixTrack",{get:function(){return this._audioDestination.stream.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sharedAudioContext",{get:function(){return this._sharedAudioContext},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()},Q_([qU("default","id","filePath","options")],e.prototype,"startAudioMixing",null),Q_([qU("default","id")],e.prototype,"stopAudioMixing",null),Q_([qU("default","id")],e.prototype,"pauseAudioMixing",null),Q_([qU("default","id")],e.prototype,"resumeAudioMixing",null),Q_([qU("default","id")],e.prototype,"preloadAudioMixing",null),Q_([qU("default","id")],e.prototype,"unloadAudioMixing",null),Q_([qU("default","id")],e.prototype,"getAudioMixingVolume",null),Q_([qU("default","id","volume")],e.prototype,"setAudioMixingVolume",null),Q_([qU("default","id")],e.prototype,"getAudioMixingDuration",null),Q_([qU("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),Q_([qU("default","id","position")],e.prototype,"setAudioMixingPosition",null),Q_([qU("default","type")],e.prototype,"enableAudioMixingBuffer",null),Q_([qU()],e.prototype,"disableAudioMixingBuffer",null),Q_([qU("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(EH||(EH={}));var gH=new wP("RTMClient",1),bH=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r._dataChannelSignal=null,r._handler=null,r._dataChannelSignalState=cV.DISCONNECTED,r._loginSessionId=null,r._userId=null,r._token=null,r._isReconnecting=!1,r._reconnectTimer=null,r._loginResolveCallback=null,r._loginRejectCallback=null,r._iceConfigNode=null,r._wait_login_token=!1,r}return Z_(t,e),t.prototype.login=function(e,t){var r=this;return new Promise((function(n,i){if(gH.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new tw(ZN.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new tw(ZN.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,WU.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=n,r._loginRejectCallback=i,r._dataChannelSignal?r._login():(gH.print("login","init dataChannelSingling"),r._dataChannelSignalState=cV.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))},t.prototype.logout=function(){var e;return ev(this,void 0,void 0,(function(){return tv(this,(function(t){if(!this._loginSessionId||!this._userId)throw new tw(ZN.NOT_LOGIN,"login first");return null===(e=this._dataChannelSignal)||void 0===e||e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:eL.C2RTM}).catch((function(){})),this._closeDataChannelSignaling(),this._clearState(),[2]}))}))},t.prototype.updateLoginToken=function(e){return ev(this,void 0,void 0,(function(){var t=this;return tv(this,(function(r){return this._token=e,[2,new Promise((function(e,r){t._wait_login_token?(t._loginResolveCallback=e,t._loginRejectCallback=r,t._login()):e()}))]}))}))},t.prototype.getPeerOnlineStatus=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new tw(ZN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:eL.C2RTM})];case 1:return[2,null==(t=r.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new tw(ZN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})];case 1:return r.sent(),[2]}}))}))},t.prototype.setServerParams=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new tw(ZN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:e,url:t},{functionType:eL.C2RTM})];case 1:return r.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new tw(ZN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:FU.BUSINESS_SERVER,msg:e})];case 1:return t.sent(),[2]}}))}))},t.prototype.destroy=function(){this._clearState(),this._closeDataChannelSignaling(),e.prototype.removeAllListeners.call(this)},t.prototype._login=function(){var e=this;if(this._userId){var t=rP();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:aP.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now().toString(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:yD.VERSION,deviceId:sL.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:eL.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).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=ZN.INVALID_PARAMS,n="Invalid userId"):(r=ZN.INVALID_TOKEN,n="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=ZN.LOGIN_FAILED,n="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new tw(r,a||n))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){return ev(this,void 0,void 0,(function(){var t,r,n,i,o,a=this;return tv(this,(function(s){switch(s.label){case 0:if(t=new uL,r=this._iceConfigNode)return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,null==t?void 0:t.getAccessNode(this._appId,"",e,sL.getDeviceId(),"")];case 2:if(!(r=s.sent()))throw new Error;return[3,4];case 3:throw s.sent(),$U("rtm.login.getNodeFailed","",0,!0),new tw(ZN.ICE_SERVER_WRONG,"get ICE config failed");case 4:$U("rtm.login.getNodeSuccess",r,0,!0),gH.print("_createDataChannelSignaling()","get node success",r),this._handler=new XL(zU),this._handler.once("disconnect",(function(){gH.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),a._onDisconnect()})),s.label=5;case 5:return s.trys.push([5,7,,8]),[4,this._handler.connect(r)];case 6:return n=s.sent(),gH.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=cV.CONNECTED,[3,8];case 7:throw i=s.sent(),this._iceConfigNode=null,this._dataChannelSignalState=cV.DISCONNECTED,new tw(ZN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",i);case 8:return o=new nL(n),gH.print("_createDataChannelSignaling()","send ping"),o.sendPingSignaling(),o.once("close",(function(){gH.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),a._onDisconnect()})),o.on(kU.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(kU.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(kU.USER_DISCONNECTION,(function(){a.emit("onUserDisconnection"),a._clearState()})),o.on(kU.NODE_CHANGE,(function(e){$U("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(a._iceConfigNode=e.nodes[0]),a._loginResolveCallback&&a._loginRejectCallback?a._login():a._reconnect()})),[2,o]}}))}))},t.prototype._closeDataChannelSignaling=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null},t.prototype._checkDataChannelSignal=function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==cV.CONNECTED)throw new tw(ZN.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=cV.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._reconnect=function(){var e=this;!this._isReconnecting&&this._userId&&(gH.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){gH.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){gH.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))},t.prototype._clearState=function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)},t}(CP.exports.EventEmitter),TH=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r.remoteStreams=new Map,r}return Z_(t,e),t.prototype.connect=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return this._mediaServerClient=new hV,this._bindEvents(),[4,this._mediaServerClient.connect(this._appId)];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayPublicStream=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:if(this.remoteStreams.get(e))throw new tw(ZN.REPEAT_PLAY,"repeat play public media stream");return t=new TV(e,e,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]}),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return r.sent(),this.remoteStreams.set(e,t),[2,t]}}))}))},t.prototype.stopPlayPublicStream=function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)},t.prototype.destroy=function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()},t.prototype._handleReconnected=function(){return ev(this,void 0,void 0,(function(){var e,t,r,n,i,o,a,s,c=this;return tv(this,(function(u){clearTimeout(this._reconnectTimer),e=function(e){t.remoteStreams.delete(e),t.startPlayPublicStream(e).then((function(){var t=c.remoteStreams.get(e);c.safeEmit(mV.RESUBSCRIBE,{stream:t})}))},t=this;try{for(r=rv(this.remoteStreams),n=r.next();!n.done;n=r.next())i=nv(n.value,1),o=i[0],e(o)}catch(e){a={error:e}}finally{try{n&&!n.done&&(s=r.return)&&s.call(r)}finally{if(a)throw a.error}}return[2]}))}))},t.prototype._reconnect=function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)},t.prototype._bindEvents=function(){var e,t,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(MU.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))},t}(DP),IH=new wP("Engine",0),RH=function(e){function t(t){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._publicStreamAudioPlayer=new Map,r._publicStreamVideoPlayer=new Map,r._publicStreamIds=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._videoStreamEncodeConfig=[{maxKbps:500}],r._screenStreamEncodeConfig=[{maxKbps:500}],r._pauseAllSubscribeState={audio:!1,video:!1},r._mirrorType=lD.MIRROR_TYPE_RENDER,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=xL.PLAYOUT_AND_PUBLISH),ev(r,void 0,void 0,(function(){var r;return tv(this,(function(n){switch(n.label){case 0:return IH.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(r=this._room)||void 0===r?void 0:r.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(lP.onAudioMixingStateChanged,e)},r._appId=t,r._pubLock=new ZL("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new yH({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage}),window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=r,r._trackSourceType={video:qP.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:qP.VIDEO_SOURCE_TYPE_INTERNAL,audio:ZP.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:ZP.AUDIO_SOURCE_TYPE_INTERNAL},r._rtmClient=new bH(t),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r}return Z_(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t,r,n;return ev(this,void 0,void 0,(function(){var i,o,a,s;return tv(this,(function(c){switch(c.label){case 0:return IH.print("updateToken()","token: %s",e),vP(e,"token"),this.waitForNewToken&&(null===(t=this._room)||void 0===t?void 0:t._roomInfo)&&this._tempRoomConfig?(i=null===(r=this._room)||void 0===r?void 0:r._roomInfo,o=i.roomId,a=i.userInfo,s=this._tempRoomConfig,delete this._tempRoomConfig,[4,this.joinRoom(e,o,a,s)]):[3,2];case 1:return[2,c.sent()];case 2:if(!this._room)throw new tw(ZN.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");return[4,null===(n=this._room)||void 0===n?void 0:n.updateToken(e)];case 3:return c.sent(),[2]}}))}))},t.prototype.switchCamera=function(e){var t,r;return ev(this,void 0,void 0,(function(){var n,i;return tv(this,(function(o){switch(o.label){case 0:return IH.print("switchCamera()","deviceId: %s",e),vP(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((n=this._videoStreamConstraints).deviceId={exact:e},this._videoStreamConstraints=n,[4,nV(n)]);case 1:return i=o.sent(),this._initLocalTrackEvents(i),this._localVideoTrack&&this._localVideoTrack.close(),this._localVideoTrack=i,this._videoPlayer&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(i),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},t.prototype.switchMicrophone=function(e){var t,r;return ev(this,void 0,void 0,(function(){var n,i;return tv(this,(function(o){switch(o.label){case 0:return IH.print("switchMicrophone()","deviceId: %s",e),vP(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((n=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=n,[4,iV(n)]);case 1:return i=o.sent(),this._initLocalTrackEvents(i),this._localAudioTrack&&this._localAudioTrack.close(),this._localAudioTrack=i,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){xx.on(lP.onMediaDeviceStateChanged,this._onDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R=this;null===(e=this._room)||void 0===e||e.on(kU.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(kU.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(kU.USER_CONNECTION,this._onUserConnection.bind(this)),null===(n=this._room)||void 0===n||n.on(mV.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(i=this._room)||void 0===i||i.on(mV.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(kU.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(a=this._room)||void 0===a||a.on(kU.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(s=this._room)||void 0===s||s.on(kU.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(kU.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(u=this._room)||void 0===u||u.on(kU.POST_PROCESSING_MESSAGE,(function(e){"publicStreamCallback"===e.type?R._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&R._onLiveTranscodingResult(e)})),null===(d=this._room)||void 0===d||d.on(MU.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(l=this._room)||void 0===l||l.on(mV.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(h=this._room)||void 0===h||h.on(mV.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(mV.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(mV.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(_=this._room)||void 0===_||_.on(mV.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=R._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&R.safeEmit(lP.onAutoPublishResult,e)})),null===(v=this._room)||void 0===v||v.on(mV.ON_REMOTE_STREAM_STATS,(function(e){R.safeEmit(lP.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(mV.ON_LOCAL_STREAM_STATS,(function(e){R.safeEmit(lP.onLocalStreamStats,e)})),null===(S=this._room)||void 0===S||S.on(mV.ON_USER_MUTE_AUDIO,this._onUserMuteAudio.bind(this)),null===(E=this._room)||void 0===E||E.on(mV.ON_USER_MUTE_VIDEO,this._onUserMuteVideo.bind(this)),null===(y=this._room)||void 0===y||y.on(mV.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(lP.onUserStartAudioCapture,{userId:t})})),null===(g=this._room)||void 0===g||g.on(mV.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(lP.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(mV.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(lP.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(mV.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(lP.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(mV.ON_SEI_MESSAGED_RECEIVED,(function(e){R.safeEmit(lP.onSEIMessageReceived,e)}))},t.prototype.safeEmit=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return AP(t)&&ZU(t,dP(r)),e.prototype.safeEmit.apply(this,iv([t],nv(r),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,r,n){return void 0===n&&(n={isAutoPublish:!1,isAutoSubscribeAudio:!1,isAutoSubscribeVideo:!1}),ev(this,void 0,void 0,(function(){var i,o;return tv(this,(function(a){switch(a.label){case 0:if(IH.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,r,n),gP(e)||vP(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new tw(ZN.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){SP(e,"userInfo"),bP(e.userId),gP(e.extraInfo)||vP(e.extraInfo,"userInfo.extraInfo",1,200)}(r),function(e){SP(e,"roomConfig"),fP(e.isAutoPublish,"roomConfig.isAutoPublish"),fP(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),fP(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(n),!this._room||this._room.connectionState===cV.DISCONNECTED)return[3,1];throw new tw(ZN.REPEAT_JOIN,"Already joined");case 1:this._room=new OV(n),this._addHandlerEventHandler(),i=this._liveTranscodeConfig&&TD("started",this._liveTranscodeConfig),a.label=2;case 2:return a.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,$_($_({},r),{businessId:this._businessId,role:this._visibility?EH.NORMAL_USER:EH.SILENT_USER}),i,this._useCloudProxy)];case 3:return a.sent(),this._roomConfig=n,this._tempRoomConfig&&delete this._tempRoomConfig,[3,5];case 4:throw(o=a.sent()).code===ZN.INVALID_TOKEN&&(this._tempRoomConfig=n),o;case 5:(this._localAudioTrack||this._localVideoTrack)&&n.isAutoPublish&&(this._visibility?this._updatePublish(!0):this.safeEmit(lP.onAutoPublishResult,{isScreen:!1,state:nD.PUBLISH_FAIL})),a.label=6;case 6:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,r;return void 0===e&&(e=!1),ev(this,void 0,void 0,(function(){return tv(this,(function(n){switch(n.label){case 0:return IH.print("leaveRoom()"),e?[4,null===(t=this._room)||void 0===t?void 0:t.leave(e)]:[3,2];case 1:return n.sent(),[3,3];case 2:null===(r=this._room)||void 0===r||r.leave(e).catch(),n.label=3;case 3:return this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.stop()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.stop()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.stop()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map,[2]}}))}))},t.prototype.destroy=function(){var e,t,r,n;IH.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(),null===(r=this._audioPlayer)||void 0===r||r.destroy(),this._videoPlayer=void 0,this._audioPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[{maxKbps:500}],this._screenStreamEncodeConfig=[{maxKbps:500}],this._pauseAllSubscribeState={audio:!1,video:!1},clearInterval(this._audioVolumeIndicationTimer),this._audioVolumeIndicationTimer=void 0,this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.stop()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.stop()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.stop()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.stop()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.stop()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(n=this._outsideRoom)||void 0===n||n.destroy(),this._publicStreamIds=new Map},t.prototype.publish=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:if(IH.print("publish()"),!this._room||this._room.connectionState!==cV.CONNECTED)throw new tw(ZN.PUBLISH_BEFORE_JOIN,"join first");return[4,this._updatePublish()];case 1:return e.sent(),[2]}}))}))},t.prototype.unpublish=function(){var e,t;return ev(this,void 0,void 0,(function(){var r,n;return tv(this,(function(i){switch(i.label){case 0:if(IH.print("unpublish()"),!this._room)throw new tw(ZN.UNPUBLISH_BEFORE_JOIN,"join first");return null===(t=null===(e=this._room.localStream)||void 0===e?void 0:e.observer)||void 0===t||t.setPublish(!1),[4,this._pubLock.lock()];case 1:r=i.sent(),i.label=2;case 2:return i.trys.push([2,4,5,6]),[4,this._room.unpublish()];case 3:return i.sent(),[3,6];case 4:throw(n=i.sent())instanceof tw?n:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",n);case 5:return r(),[7];case 6:return[2]}}))}))},t.prototype.subscribeUserStream=function(e,t,r,n){var i,o,a,s,c,u;return void 0===r&&(r=sD.STREAM_INDEX_MAIN),void 0===n&&(n={videoIndex:0}),ev(this,void 0,void 0,(function(){var d,l,h,p,f,_,v;return tv(this,(function(m){switch(m.label){case 0:if(IH.print("subscribeStream()","userId: %o, mediaType: %o, streamType: %o, configure: %o",e,t,r,n),bP(e),mP(t,"mediaType",[cD.AUDIO_AND_VIDEO,cD.AUDIO_ONLY,cD.VIDEO_ONLY,cD.NONE]),mP(r,"streamType",[sD.STREAM_INDEX_MAIN,sD.STREAM_INDEX_SCREEN]),_P(n.videoIndex,"config.videoIndex",0,2),!this._room||this._room.connectionState!==cV.CONNECTED)throw new tw(ZN.SUBSCRIBE_BEFORE_JOIN,"join first");if(d=this._room.remoteStreams.get(e),h=r===sD.STREAM_INDEX_SCREEN,!(l=h?null==d?void 0:d.find((function(e){return e.isScreen})):null==d?void 0:d.find((function(e){return!e.isScreen}))))throw new tw(ZN.STREAM_NOT_EXIST,"stream not exist");m.label=1;case 1:return m.trys.push([1,3,,4]),p=t,this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?t=cD.NONE:this._pauseAllSubscribeState.audio&&!this._pauseAllSubscribeState.video?t===cD.AUDIO_AND_VIDEO?t=cD.VIDEO_ONLY:t===cD.AUDIO_ONLY&&(t=cD.NONE):!this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video&&(t===cD.AUDIO_AND_VIDEO?t=cD.AUDIO_ONLY:t===cD.VIDEO_ONLY&&(t=cD.NONE)),t!==p&&IH.print("subscribeUserStream","due to pauseAllState change sub mediaType from ".concat(p," to ").concat(t)),f=l.hasSubscribed,[4,this._room.subscribe(l,t,n)];case 2:return m.sent(),t!==cD.AUDIO_AND_VIDEO&&t!==cD.AUDIO_ONLY||this._updateAudioPlayerState(l),t!==cD.AUDIO_AND_VIDEO&&t!==cD.VIDEO_ONLY||this._updateVideoPlayerState(l),((null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)||(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo))&&(l.audioTrack||l.videoTrack)&&(v={userId:e,isScreen:h,state:rD.SUBSCRIBE_SUCC},this.safeEmit(lP.onAutoSubscribeResult,v)),f||t!==cD.AUDIO_AND_VIDEO&&t!==cD.VIDEO_ONLY||null===(a=l.observer)||void 0===a||a.setSubscribeVideo(!0),f||t!==cD.AUDIO_AND_VIDEO&&t!==cD.AUDIO_ONLY||null===(s=l.observer)||void 0===s||s.setSubscribeAudio(!0),[3,4];case 3:throw _=m.sent(),((null===(c=this._roomConfig)||void 0===c?void 0:c.isAutoSubscribeAudio)||(null===(u=this._roomConfig)||void 0===u?void 0:u.isAutoSubscribeVideo))&&(v={userId:e,isScreen:h,state:rD.SUBSCRIBE_FAIL},this.safeEmit(lP.onAutoSubscribeResult,v)),_;case 4:return[2]}}))}))},t.prototype.unSubscribe=function(e,t){return ev(this,void 0,void 0,(function(){var r,n;return tv(this,(function(i){switch(i.label){case 0:if(IH.print("unSubscribe()","userId: %s, isScreen: %o",e,t),bP(e),fP(t,"isScreen"),!this._room||this._room.connectionState!==cV.CONNECTED)throw new tw(ZN.SUBSCRIBE_BEFORE_JOIN,"join first");if(r=this._room.remoteStreams.get(e),!(n=t?null==r?void 0:r.find((function(e){return e.isScreen})):null==r?void 0:r.find((function(e){return!e.isScreen}))))throw new tw(ZN.STREAM_NOT_EXIST,"stream not exist");return[4,this._room.unsubscribe(n)];case 1:return i.sent(),this._updateAudioPlayerState(n),this._updateVideoPlayerState(n),[2]}}))}))},t.prototype.startVideoCapture=function(e){var t,r;return ev(this,void 0,void 0,(function(){var n,i,o;return tv(this,(function(a){switch(a.label){case 0:if(IH.print("startVideoCapture()","deviceId: %s",e),gP(e)||vP(e,"deviceId"),this._localVideoTrack)throw new tw(ZN.REPEAT_CAPTURE,"Has already capture");return n=this._videoStreamConstraints,e&&(n.deviceId={exact:e},this._videoStreamConstraints=n),[4,nV(n)];case 1:return i=a.sent(),this._initLocalTrackEvents(i),this._localVideoTrack=i,this._videoPlayer&&this._videoPlayer.playVideo(i),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(lP.onAutoPublishResult,{isScreen:!1,state:nD.PUBLISH_FAIL})),null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableVideo(!0),[2]):[2]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,r;return ev(this,void 0,void 0,(function(){return tv(this,(function(n){switch(n.label){case 0:if(IH.print("stopVideoCapture()"),this._trackSourceType.video===qP.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return this._videoPlayer&&this._videoPlayer.stop(),null===(e=this._localVideoTrack)||void 0===e||e.close(),this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:n.sent(),n.label=2;case 2:return null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableVideo(!1),[2]}}))}))},t.prototype.startAudioCapture=function(e){var t,r;return ev(this,void 0,void 0,(function(){var n,i,o;return tv(this,(function(a){switch(a.label){case 0:if(IH.print("startAudioCapture()","deviceId: $o",e),gP(e)||vP(e,"deviceId"),this._localAudioTrack)throw new tw(ZN.REPEAT_CAPTURE,"Has already capture");return n=this._audioStreamConstraints,e&&(n.deviceId={exact:e},this._audioStreamConstraints=n),[4,iV(n)];case 1:return i=a.sent(),this._initLocalTrackEvents(i),this._localAudioTrack=i,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(lP.onAutoPublishResult,{isScreen:!1,state:nD.PUBLISH_FAIL})),null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.stopAudioCapture=function(){var e,t,r;return ev(this,void 0,void 0,(function(){return tv(this,(function(n){switch(n.label){case 0:if(IH.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===ZP.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:n.sent(),n.label=2;case 2:return null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableAudio(!1),[2]}}))}))},t.prototype.getAudioMixingManager=function(){return IH.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,r;return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var n,i,o,a;return tv(this,(function(s){switch(s.label){case 0:if(IH.print("startScreenCapture()","config: %o",e),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localScreenVideoTrack=void 0,n=e.enableAudio,i=void 0!==n&&n,this._trackSourceType.screenVideo===qP.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===ZP.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,oV(i)];case 1:return o=s.sent(),this._localScreenVideoTrack=new Qx(o.getVideoTracks()[0],rP()),(a=o.getAudioTracks()).length&&(this._localScreenAudioTrack=new eV(a[0],rP()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(r=this._screenPlayer)||void 0===r||r.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,r;return ev(this,void 0,void 0,(function(){return tv(this,(function(n){return IH.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localScreenVideoTrack=void 0,null===(r=this._localScreenAudioTrack)||void 0===r||r.close(),this._localScreenAudioTrack=void 0,[2]}))}))},t.prototype.publishScreen=function(){return ev(this,void 0,void 0,(function(){var e;return tv(this,(function(t){switch(t.label){case 0:if(IH.print("publishScreen()"),!this._room||this._room.connectionState!==cV.CONNECTED)throw new tw(ZN.PUBLISH_BEFORE_JOIN,"join first");if(!this._visibility)throw new tw(ZN.NO_PUBLISH_PERMISSION,"no publish permission");t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 2:return t.sent(),[3,4];case 3:throw(e=t.sent())instanceof tw?e:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.unpublishScreen=function(){var e,t;return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(n){switch(n.label){case 0:if(IH.print("unpublishScreen()"),!this._room)throw new tw(ZN.UNPUBLISH_BEFORE_JOIN,"join first");null===(t=null===(e=this._room.localScreenStream)||void 0===e?void 0:e.observer)||void 0===t||t.setPublish(!1),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,this._room.unpublishScreen()];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof tw?r:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var r,n;if(IH.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),mP(e,"streamIndex",[sD.STREAM_INDEX_MAIN,sD.STREAM_INDEX_SCREEN]),t&&t.renderDom)return IP(t),e==sD.STREAM_INDEX_MAIN?(this._videoPlayer=new LV(t),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement):(this._screenPlayer=new LV($_($_({},t),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement);e==sD.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(n=this._screenPlayer)||void 0===n||n.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(n){switch(n.label){case 0:IH.print("startLiveTranscoding()","transcode: %o",e),vP(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,n.label=1;case 1:return n.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(TD("started",this._liveTranscodeConfig))];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof tw?r:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(n){switch(n.label){case 0:if(IH.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=iB(this._liveTranscodeConfig,e),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(TD("layoutChanged",this._liveTranscodeConfig))];case 2:return n.sent(),[3,4];case 3:throw(r=n.sent())instanceof tw?r:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:if(IH.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,null===(e=this._room)||void 0===e?void 0:e.liveControlMessage({action:"stopped",type:"transcode"})];case 2:return r.sent(),[3,4];case 3:throw(t=r.sent())instanceof tw?t:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return IH.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(YU.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t;return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:if(IH.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==cV.CONNECTED)throw new tw(ZN.NOT_CONNECTED_YET,"server not connected");return this._room.localStream&&(null===(t=this._room.localStream.observer)||void 0===t||t.setPublisher(e)),!e?[4,this._room.unpublish()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?EH.NORMAL_USER:EH.SILENT_USER})];case 3:return r.sent(),this._visibility=e,[2]}}))}))},t.prototype._initPlayerEvents=function(e,t){var r=this;void 0===t&&(t=!1),e.on("playback_event",(function(n){var i,o,a,s;switch(null===(o=null===(i=r._room)||void 0===i?void 0:i.remoteStreams.get(n.userId))||void 0===o||o.find((function(e){return!e.isScreen})),n.eventName){case"timeupdate":return;case"loadeddata":if("audio"===n.type)t?r.safeEmit(lP.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):r.safeEmit(lP.onAudioFirstFrameDecoded,{userId:e.userId}),HU.firstRemoteAudioRender("",n.userId);else{var c={userId:e.userId,height:(null===(a=e.domElement)||void 0===a?void 0:a.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0};t?(c.publicStreamId=c.userId,delete c.userId,r.safeEmit(lP.onFirstPublicStreamVideoFrameDecoded,c),r.safeEmit(lP.onFirstPublicStreamVideoFrameRendered,c)):(r.safeEmit(lP.onVideoFirstFrameDecoded,c),r.safeEmit(lP.onVideoFirstFrameRendered,c)),HU.firstRemoteVideoRender("",n.userId)}break;case"autoplay-error":return t&&(n.publicStreamId=n.userId),void r.safeEmit(lP.onAutoplayFailed,n)}r.safeEmit(lP.onPlayerEvent,n)}))},t.prototype._initLocalTrackEvents=function(e){var t=this;e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(lP.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var r,n,i,o,a,s;IH.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),mP(e,"streamIndex",[sD.STREAM_INDEX_MAIN,sD.STREAM_INDEX_SCREEN]),IP(t);var c=t.userId;if(t.renderDom){if(e==sD.STREAM_INDEX_MAIN){null===(r=this._remoteVideoPlayer.get(c))||void 0===r||r.destroy();var u=new LV(t);return this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(i=null===(n=this._room)||void 0===n?void 0:n.remoteStreams.get(c))||void 0===i?void 0:i.find((function(e){return!e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy();var d;u=new LV($_($_({},t),{isScreen:!0}));return this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}this._stopRemotePlayer(c,e===sD.STREAM_INDEX_SCREEN)},t.prototype.setLocalVideoMirrorType=function(e){IH.print("setLocalVideoMirrorType()","mirrorType: %o",e),mP(e,"mirrorType",[lD.MIRROR_TYPE_NONE,lD.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){var t;return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(n){switch(n.label){case 0:return IH.print("setAudioPlaybackDevice()","deviceId: %s",e),vP(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?(IH.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,xx.getDeviceById(e)];case 1:if(!(r=n.sent()))throw new tw(ZN.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),null===(t=this._audioPlayer)||void 0===t||t.setPlaybackDevice(e),this._audioPlaybackDeviceId=e,r&&this.safeEmit(lP.onAudioPlaybackDeviceChanged,r),HU.rtcAudioDevice(dU.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){return ev(this,void 0,void 0,(function(){var t,r;return tv(this,(function(n){if(IH.print("play()","userId | publicStreamId: %s",e),bP(e),t=this._remoteAudioPlayer.get(e),r=this._remoteVideoPlayer.get(e),t||(t=this._publicStreamAudioPlayer.get(e)),r||(r=this._publicStreamVideoPlayer.get(e)),t||(t=this._audioPlayer),r||(r=this._videoPlayer),!t&&!r)throw new tw(ZN.INVALID_PARAMS,"Player not found");return t&&t.manuallyPlay(),r&&r.manuallyPlay(),[2]}))}))},t.prototype.muteLocalAudio=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){if(IH.print("muteLocalAudio()","muteState: %o",e),mP(e,"muteState",[tD.MUTE_STATE_OFF,tD.MUTE_STATE_ON]),!this._room)throw new tw(ZN.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("audio",e)]}))}))},t.prototype.muteLocalVideo=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){if(IH.print("muteLocalVideo()","muteState: %o",e),mP(e,"muteState",[tD.MUTE_STATE_OFF,tD.MUTE_STATE_ON]),!this._room)throw new tw(ZN.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("video",e)]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,r=this;return tv(this,(function(n){return IH.print("pauseAllSubscribedStream()","mediaType: %o",e),mP(e,"mediaType",[oD.RTC_PAUSE_RESUME_CONTROL_AUDIO,oD.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,oD.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?[2,Promise.resolve()]:(t=function(){e===oD.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!0:e===oD.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!0:e===oD.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO&&(r._pauseAllSubscribeState.audio=!0,r._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()]))}))}))},t.prototype.resumeAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,r=this;return tv(this,(function(n){return IH.print("resumeAllSubscribedStream()","mediaType: %o",e),mP(e,"mediaType",[oD.RTC_PAUSE_RESUME_CONTROL_AUDIO,oD.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,oD.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video?(t=function(){e===oD.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!1:e===oD.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!1:e===oD.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO&&(r._pauseAllSubscribeState.audio=!1,r._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,n;t(),null===(n=null===(e=r._room)||void 0===e?void 0:e.remoteStreams)||void 0===n||n.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r._updateAudioPlayerState(e),r._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])):[2,Promise.resolve()]}))}))},t.prototype.sendUserMessage=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){if(bP(e),RP(t),!this._room||this._room.connectionState!==cV.CONNECTED)throw new tw(ZN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){if(bP(e),EP(t,"message"),RP(t),!this._room||this._room.connectionState!==cV.CONNECTED)throw new tw(ZN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendRoomMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){if(RP(e),!this._room||this._room.connectionState!==cV.CONNECTED)throw new tw(ZN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e)]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){if(RP(e),!this._room||this._room.connectionState!==cV.CONNECTED)throw new tw(ZN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e,!0)]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var r;return tv(this,(function(n){switch(n.label){case 0:return IH.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,yP(e),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,r&&(this._audioStreamConstraints.deviceId=r),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var r;return tv(this,(function(n){switch(n.label){case 0:return IH.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,yP(e),r=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=e,r&&(this._videoStreamConstraints.deviceId=r),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.setVideoEncoderConfig=function(e,t){var r,n,i,o,a,s,c,u;return ev(this,void 0,void 0,(function(){return tv(this,(function(d){if(IH.print("setVideoEncoderConfig()","streamIndex: %o, descriptions: %o",e,t),mP(e,"streamIndex",[sD.STREAM_INDEX_MAIN,sD.STREAM_INDEX_SCREEN]),function(e,t){if(!Array.isArray(e))throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,", should be array"))}(t,"descriptions"),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),e===sD.STREAM_INDEX_MAIN){if(null===(n=null===(r=this._room)||void 0===r?void 0:r.localStream)||void 0===n?void 0:n.hasPublished){if(1!==this._videoStreamEncodeConfig.length||1!==(null==t?void 0:t.length))throw new tw(ZN.INVALID_PARAMS,"After publishing, only non simulcast streams can be modified");null===(o=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===o||o.updateVideoBitrate(t)}this._videoStreamEncodeConfig=t}else{if(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished){if(1!==this._screenStreamEncodeConfig.length||1!==(null==t?void 0:t.length))throw new tw(ZN.INVALID_PARAMS,"After publishing, only non simulcast streams can be modified");null===(u=null===(c=this._room)||void 0===c?void 0:c.localScreenStream)||void 0===u||u.updateVideoBitrate([t[0]])}this._screenStreamEncodeConfig=t}return[2]}))}))},t.prototype.sendSEIMessage=function(e,t,r){var n,i,o,a,s,c;IH.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),mP(e,"streamIndex",[sD.STREAM_INDEX_MAIN,sD.STREAM_INDEX_SCREEN]),_P(r,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(aP.str2ab(t)):t;if(t.length){var d;if(e===sD.STREAM_INDEX_MAIN){if(!(null===(i=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===i?void 0:i.hasPublished))return;d=null===(o=this._room)||void 0===o?void 0:o.localStream}else{if(!(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished))return;d=null===(c=this._room)||void 0===c?void 0:c.localScreenStream}if(u.byteLength>4096)IH.print("sei size must not bigger than 4KB");else{var l=rP();d.seiList.push({content:u,uuid:l,repeatCount:r}),setTimeout((function(){if(d){var e=d.seiList.findIndex((function(e){return e.uuid===l}));e&&d.seiList.splice(e,1)}}),2e3)}}else IH.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;IH.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,i,o;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var n;if(0!==e.length){var i=e.find((function(e){return!1===e.isScreen})),o=null===(n=null==i?void 0:i.audioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:t,volume:o||0})}}));var a=null===(n=t._localAudioTrack)||void 0===n?void 0:n.getAudioLevel();r.push({userId:(null===(o=null===(i=t._room)||void 0===i?void 0:i.roomInfo)||void 0===o?void 0:o.userInfo.userId)||"local_user",volume:a||0}),t.safeEmit(lP.onAudioVolumeIndication,{speakers:r})}),e)},t.prototype.setVideoSourceType=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v,m,S;return ev(this,void 0,void 0,(function(){var E,y,g;return tv(this,(function(b){switch(b.label){case 0:return IH.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),mP(e,"streamIndex",[sD.STREAM_INDEX_MAIN,sD.STREAM_INDEX_SCREEN]),mP(t,"VideoSourceType",[qP.VIDEO_SOURCE_TYPE_EXTERNAL,qP.VIDEO_SOURCE_TYPE_INTERNAL]),E=e===sD.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[E]===t?[3,4]:(this._trackSourceType[E]=t,IH.print("setVideoSourceType","set ".concat(E," source type to ").concat(t)),this._localVideoTrack&&e===sD.STREAM_INDEX_MAIN?(g=!1,t===qP.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localVideoTrack.close()),null===(r=this._videoPlayer)||void 0===r||r.stop(),this._localVideoTrack=void 0,y=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,g?null===(a=null===(o=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!1):null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushVideo(!1),(null===(d=this._room)||void 0===d?void 0:d.hasPublished)||y?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===sD.STREAM_INDEX_SCREEN?(g=!1,t===qP.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localScreenVideoTrack.close()),null===(l=this._screenPlayer)||void 0===l||l.stop(),this._localScreenVideoTrack=void 0,g?null===(f=null===(p=null===(h=this._room)||void 0===h?void 0:h.localScreenStream)||void 0===p?void 0:p.observer)||void 0===f||f.setEnableVideo(!1):null===(m=null===(v=null===(_=this._room)||void 0===_?void 0:_.localScreenStream)||void 0===v?void 0:v.observer)||void 0===m||m.setPushVideo(!1),(null===(S=this._room)||void 0===S?void 0:S.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:b.sent(),b.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var r,n,i,o,a,s,c,u;return ev(this,void 0,void 0,(function(){var d;return tv(this,(function(l){switch(l.label){case 0:if(IH.print("setExternalVideoTrack()","index: %o, track: %o",e,t),mP(e,"streamIndex",[sD.STREAM_INDEX_MAIN,sD.STREAM_INDEX_SCREEN]),e!==sD.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==qP.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new tV(t,rP()),this._initLocalTrackEvents(this._localVideoTrack),null===(r=this._videoPlayer)||void 0===r||r.playVideo(this._localVideoTrack),d=null===(n=this._room)||void 0===n?void 0:n._roomConfig.isAutoPublish,(null===(i=this._room)||void 0===i?void 0:i.hasPublished)||d?[4,this._updatePublish()]:[3,2];case 1:l.sent(),l.label=2;case 2:if(e!==sD.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==qP.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new tV(t,rP()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushVideo(!0),(null===(u=this._room)||void 0===u?void 0:u.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var r,n,i,o,a,s,c,u,d,l,h,p,f,_,v;return ev(this,void 0,void 0,(function(){var m,S,E;return tv(this,(function(y){switch(y.label){case 0:return IH.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),mP(e,"streamIndex",[sD.STREAM_INDEX_MAIN,sD.STREAM_INDEX_SCREEN]),mP(t,"audioSourceType",[ZP.AUDIO_SOURCE_TYPE_EXTERNAL,ZP.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===sD.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,IH.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===sD.STREAM_INDEX_MAIN?(E=!1,this._trackSourceType.audio===ZP.AUDIO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,S=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,E?null===(o=null===(i=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===i?void 0:i.observer)||void 0===o||o.setEnableAudio(!1):null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushAudio(!1),(null===(u=this._room)||void 0===u?void 0:u.hasPublished)||S?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:y.sent(),y.label=2;case 2:return this._localScreenAudioTrack&&e===sD.STREAM_INDEX_SCREEN?(E=!1,this._trackSourceType.audio===ZP.AUDIO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,E?null===(h=null===(l=null===(d=this._room)||void 0===d?void 0:d.localScreenStream)||void 0===l?void 0:l.observer)||void 0===h||h.setEnableAudio(!1):null===(_=null===(f=null===(p=this._room)||void 0===p?void 0:p.localScreenStream)||void 0===f?void 0:f.observer)||void 0===_||_.setPushAudio(!1),(null===(v=this._room)||void 0===v?void 0:v.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:y.sent(),y.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var r,n,i,o,a,s,c,u,d;return ev(this,void 0,void 0,(function(){var l;return tv(this,(function(h){switch(h.label){case 0:if(IH.print("setExternalAudioTrack()","index: %o, track: %o",e,t),mP(e,"streamIndex",[sD.STREAM_INDEX_MAIN,sD.STREAM_INDEX_SCREEN]),e!==sD.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==ZP.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new rV(t,rP()),this._initLocalTrackEvents(this._localAudioTrack),l=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,null===(o=null===(i=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===i?void 0:i.observer)||void 0===o||o.setPushAudio(!0),(null===(a=this._room)||void 0===a?void 0:a.hasPublished)||l?[4,this._updatePublish()]:[3,2];case 1:h.sent(),h.label=2;case 2:if(e!==sD.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==ZP.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new rV(t,rP()),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localScreenStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushAudio(!0),(null===(d=this._room)||void 0===d?void 0:d.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},t.prototype.login=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return IH.print("login()","token: %o, userInfo: %o",e,t),gP(e)||vP(e,"token"),bP(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){return IH.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return IH.print("updateLoginToken()","token: %o",e),gP(e)||vP(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return IH.print("getPeerOnlineStatus()","userId: %o",e),bP(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return bP(e),RP(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return bP(e),EP(t,"message"),RP(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.setServerParams=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return IH.print("setServerParams()","signature: %o, url: %0",e,t),vP(e,"signature"),vP(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return vP(e,"message"),RP(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.sendServerBinaryMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return EP(e,"message"),RP(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new tw(ZN.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;IH.print("startCloudProxy()",e),vP(e.logProxy,"logProxy"),vP(e.accessProxy,"accessProxy"),vP(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=bD("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=bD("LOG_SERVER_URL"),this._originConfigServerUrls=bD("CONFIG_REQUEST_DOMAINS"),gD("ICE_CONFIG_REQUEST_URLS",e.accessProxy),gD("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),gD("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new tw(ZN.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");IH.print("stopCloudProxy()"),gD("ICE_CONFIG_REQUEST_URLS",[]),gD("LOG_SERVER_URL",this._originLogServerUrl),gD("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0},t.prototype.startPushPublicStream=function(e,t){return ev(this,void 0,void 0,(function(){var r,n=this;return tv(this,(function(i){if(IH.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),TP(e),!this._room||this._room.connectionState!==cV.CONNECTED)throw new tw(ZN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new tw(ZN.REPEAT_PUSH,"repeat push public media stream");return r=ID(e,"started",t),[2,this._room.publicStreamControlMessage(r).then((function(){n._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(n){if(IH.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),TP(e),!this._room||this._room.connectionState!==cV.CONNECTED)throw new tw(ZN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return r=ID(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(r)]}))}))},t.prototype.stopPushPublicStream=function(e){return ev(this,void 0,void 0,(function(){var t=this;return tv(this,(function(r){if(IH.print("startPushPublicStream()","publicStreamId: %o",e),TP(e),!this._room||this._room.connectionState!==cV.CONNECTED)throw new tw(ZN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return[2,this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:e}).then((function(){t._publicStreamIds.delete(e)}))]}))}))},t.prototype.startPlayPublicStream=function(e){var t;return ev(this,void 0,void 0,(function(){var r,n,i,o=this;return tv(this,(function(a){switch(a.label){case 0:return TP(e),this._outsideRoom?[3,2]:(this._outsideRoom=new TH(this._appId),this._outsideRoom.on(mV.RESUBSCRIBE,(function(e){var t,r,n=e.stream;if(n){var i=o._publicStreamAudioPlayer.get(n.streamId);i&&n.audioTrack&&(i.stop(),i.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var a=o._publicStreamVideoPlayer.get(n.streamId);a&&n.videoTrack&&a.playVideo(null===(r=e.stream)||void 0===r?void 0:r.videoTrack)}})),null===(t=this._outsideRoom)||void 0===t||t.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,o.safeEmit(lP.onPublicStreamStats,e)})),[4,this._outsideRoom.connect()]);case 1:a.sent(),a.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return r=a.sent(),(n=this._publicStreamVideoPlayer.get(e))&&(null==r?void 0:r.videoTrack)&&n.playVideo(r.videoTrack,r),!(i=this._publicStreamAudioPlayer.get(e))&&(null==r?void 0:r.audioTrack)&&(i=new xV(e),this._initPlayerEvents(i,!0),i.playAudio(r.audioTrack),this._publicStreamAudioPlayer.set(e,i)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.stop(),this._publicStreamAudioPlayer.delete(e)),[2]):[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var r,n;IH.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var i=this._publicStreamVideoPlayer.get(e);if(!(null==t?void 0:t.renderDom)&&i)return i.stop(),void this._publicStreamVideoPlayer.delete(e);if(!i){i=new LV($_($_({},t),{userId:e})),this._initPlayerEvents(i,!0),this._publicStreamVideoPlayer.set(e,i);var o=null===(n=null===(r=this._outsideRoom)||void 0===r?void 0:r.remoteStreams)||void 0===n?void 0:n.get(e);(null==o?void 0:o.videoTrack)&&i.playVideo(o.videoTrack,o)}},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(RD))},t.prototype._updatePublish=function(e){return void 0===e&&(e=!1),ev(this,void 0,void 0,(function(){var t,r;return tv(this,(function(n){switch(n.label){case 0:if(IH.print("_updatePublish()"),!this._visibility)throw new tw(ZN.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(t=n.sent(),!this._room||this._room.connectionState!==cV.CONNECTED)return t(),[2];n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._localVideoTrack,this._localAudioTrack,e)];case 3:return n.sent(),[3,6];case 4:throw(r=n.sent())instanceof tw?r:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",r);case 5:return t(),[7];case 6:return[2]}}))}))},t.prototype._updateScreenPublish=function(){return ev(this,void 0,void 0,(function(){var e,t;return tv(this,(function(r){switch(r.label){case 0:return IH.print("_updateScreenPublish()"),[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==cV.CONNECTED)return e(),[2];r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof tw?t:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){IH.print("_updateAudioPlayerState()");var t,r=e.userId,n=e.isScreen;if(t=n?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack){if(!t){var i=n?"".concat(r,"_screen"):r;t=new xV(i),this._initPlayerEvents(t),this._remoteAudioPlayer.set(i,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}t.playAudio(e.audioTrack)}else null==t||t.stop()},t.prototype._updateVideoPlayerState=function(e){IH.print("_updateVideoPlayerState()");var t,r=e.userId;t=e.isScreen?this._remoteScreenPlayer.get(r):this._remoteVideoPlayer.get(r),e.videoTrack?t&&t.playVideo(e.videoTrack,e):null==t||t.stop()},t.prototype._onAddStream=function(e){var t,r,n,i,o,a,s,c,u=e.stream,d={userId:u.userId,isScreen:u.isScreen,hasVideo:u.hasVideo,hasAudio:u.hasAudio,videoStreamDescriptions:u.attributes.videoDescriptions};this.safeEmit(lP.onStreamAdd,{stream:d});var l=null;(null===(t=this._roomConfig)||void 0===t?void 0:t.isAutoSubscribeAudio)&&(l=cD.AUDIO_ONLY),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(l=cD.VIDEO_ONLY),(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeVideo)&&(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeAudio)&&(l=cD.AUDIO_AND_VIDEO),IH.print("_onAddStream","autoSubType: ".concat(l)),null===l||u.isScreen||(l===cD.AUDIO_AND_VIDEO?(null===(o=u.observer)||void 0===o||o.setAutoSubscribeVideo(!0),null===(a=u.observer)||void 0===a||a.setAutoSubscribeAudio(!0)):l===cD.AUDIO_ONLY?null===(s=u.observer)||void 0===s||s.setAutoSubscribeAudio(!0):l===cD.VIDEO_ONLY&&(null===(c=u.observer)||void 0===c||c.setAutoSubscribeVideo(!0)),this.subscribeUserStream(u.userId,l))},t.prototype._onRemoveStream=function(e){var t=e.stream,r={userId:t.userId,isScreen:t.isScreen,hasVideo:t.hasVideo,hasAudio:t.hasAudio,videoStreamDescriptions:[]},n=AH[e.reason]||uD.STREAM_REMOVE_REASON_OTHER;this.safeEmit(lP.onStreamRemove,{stream:r,reason:n}),this._stopRemotePlayer(t.userId,t.isScreen)},t.prototype._onUserConnection=function(e){this.safeEmit(lP.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(lP.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(lP.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===dD.CONNECTION_STATE_CONNECTED&&this.safeEmit(lP.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(lP.onConnectionStateChanged,e)},t.prototype._stopRemotePlayer=function(e,t){var r,n,i;null===(r=this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):e))||void 0===r||r.stop(),t?null===(n=this._remoteScreenPlayer.get(e))||void 0===n||n.stop():null===(i=this._remoteVideoPlayer.get(e))||void 0===i||i.stop()},t.prototype._onResubscribe=function(e){e.stream&&(this._stopRemotePlayer(e.stream.userId,e.stream.isScreen),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))},t.prototype._onSubscribePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onRemovePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onVideoFirstFrameDecoded=function(e){this.safeEmit(lP.onVideoFirstFrameDecoded,e)},t.prototype._onDeviceStateChange=function(e){this.safeEmit(lP.onMediaDeviceStateChanged,e)},t.prototype._onUserMuteAudio=function(e){this.safeEmit(lP.onUserMuteAudio,e)},t.prototype._onUserMuteVideo=function(e){this.safeEmit(lP.onUserMuteVideo,e)},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(lP.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(lP.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this.safeEmit(lP.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(lP.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(lP.onLiveTranscodingResult,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(lP.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(lP.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t.safeEmit(lP.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t.safeEmit(lP.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(lP.onError,{errorCode:ZN.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(lP.onError,{errorCode:ZN.RTM_TOKEN_ERROR})}))},Object.defineProperty(t.prototype,"waitForNewToken",{get:function(){return!!this._tempRoomConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localAudioTrack",{get:function(){return this._localAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localVideoTrack",{get:function(){return this._localVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenAudioTrack",{get:function(){return this._localScreenAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenVideoTrack",{get:function(){return this._localScreenVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){var e,t,r=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteStreams)&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){var e,t,r=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteUsers)&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})}))),r},enumerable:!1,configurable:!0}),Q_([qU()],t.prototype,"updateToken",null),Q_([qU()],t.prototype,"switchCamera",null),Q_([qU()],t.prototype,"switchMicrophone",null),Q_([qU()],t.prototype,"joinRoom",null),Q_([qU()],t.prototype,"leaveRoom",null),Q_([qU()],t.prototype,"destroy",null),Q_([qU()],t.prototype,"publish",null),Q_([qU()],t.prototype,"unpublish",null),Q_([qU()],t.prototype,"subscribeUserStream",null),Q_([qU()],t.prototype,"unSubscribe",null),Q_([qU()],t.prototype,"startVideoCapture",null),Q_([qU()],t.prototype,"stopVideoCapture",null),Q_([qU()],t.prototype,"startAudioCapture",null),Q_([qU()],t.prototype,"stopAudioCapture",null),Q_([qU()],t.prototype,"getAudioMixingManager",null),Q_([qU()],t.prototype,"startScreenCapture",null),Q_([qU()],t.prototype,"stopScreenCapture",null),Q_([qU()],t.prototype,"publishScreen",null),Q_([qU()],t.prototype,"unpublishScreen",null),Q_([qU()],t.prototype,"setLocalVideoPlayer",null),Q_([qU()],t.prototype,"startLiveTranscoding",null),Q_([qU()],t.prototype,"updateLiveTranscoding",null),Q_([qU()],t.prototype,"stopLiveTranscoding",null),Q_([qU()],t.prototype,"setBusinessId",null),Q_([qU()],t.prototype,"setUserVisibility",null),Q_([qU()],t.prototype,"setRemoteVideoPlayer",null),Q_([qU()],t.prototype,"setLocalVideoMirrorType",null),Q_([qU()],t.prototype,"setAudioPlaybackDevice",null),Q_([qU()],t.prototype,"play",null),Q_([qU()],t.prototype,"muteLocalAudio",null),Q_([qU()],t.prototype,"muteLocalVideo",null),Q_([qU()],t.prototype,"pauseAllSubscribedStream",null),Q_([qU()],t.prototype,"resumeAllSubscribedStream",null),Q_([qU()],t.prototype,"sendUserMessage",null),Q_([qU()],t.prototype,"sendUserBinaryMessage",null),Q_([qU()],t.prototype,"sendRoomMessage",null),Q_([qU()],t.prototype,"sendRoomBinaryMessage",null),Q_([qU()],t.prototype,"setAudioCaptureConfig",null),Q_([qU()],t.prototype,"setVideoCaptureConfig",null),Q_([qU()],t.prototype,"setVideoEncoderConfig",null),Q_([qU()],t.prototype,"sendSEIMessage",null),Q_([qU()],t.prototype,"setAudioVolumeIndicationInterval",null),Q_([qU()],t.prototype,"setVideoSourceType",null),Q_([qU()],t.prototype,"setExternalVideoTrack",null),Q_([qU()],t.prototype,"setAudioSourceType",null),Q_([qU()],t.prototype,"setExternalAudioTrack",null),Q_([qU("rtm")],t.prototype,"login",null),Q_([qU("rtm")],t.prototype,"logout",null),Q_([qU("rtm")],t.prototype,"updateLoginToken",null),Q_([qU("rtm")],t.prototype,"getPeerOnlineStatus",null),Q_([qU("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),Q_([qU("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),Q_([qU("rtm")],t.prototype,"setServerParams",null),Q_([qU("rtm")],t.prototype,"sendServerMessage",null),Q_([qU("rtm")],t.prototype,"sendServerBinaryMessage",null),Q_([qU()],t.prototype,"startCloudProxy",null),Q_([qU()],t.prototype,"stopCloudProxy",null),Q_([qU()],t.prototype,"startPushPublicStream",null),Q_([qU()],t.prototype,"updatePublicStreamParam",null),Q_([qU()],t.prototype,"stopPushPublicStream",null),Q_([qU("outsideRoom")],t.prototype,"startPlayPublicStream",null),Q_([qU("outsideRoom")],t.prototype,"stopPlayPublicStream",null),Q_([qU("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),t}(DP),AH={"client unpublished":uD.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":uD.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":uD.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":uD.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":uD.STREAM_REMOVE_REASON_REPUBLISH},CH=new wP("VERTC",0);[YU,WU,XU].forEach((function(e){return e.setStats({rtc_sdk_version:yD.VERSION,product_line:VM.RTC,report_version:FM.W_5,os:BM.WEB,device_id:sL.getDeviceId(),user_agent:oP()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var OH=function(e){return CH.print("createEngine","Invoke VERTC.createEngine"),vP(e,"appId"),[YU,WU,XU].forEach((function(t){return t.setStats({rtc_app_id:e})})),HU.sdkInitEngine(Date.now(),vU.BEGIN),new RH(e)},NH=function(e){if(CH.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof RH))throw new tw(ZN.INVALID_ENGINE,"Invalid engine object");e.destroy(),HU.sdkInitEngine(Date.now(),vU.END)},wH=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,xx.getDevices()]}))}))},PH=function(e){return void 0===e&&(e={video:!0,audio:!0}),ev(void 0,void 0,void 0,(function(){var t,r,n,i,o;return tv(this,(function(a){switch(a.label){case 0:if(t=e.video,r=e.audio,n={video:!1,audio:!1},!t)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),i=n,[4,xx.getVideoPermission()];case 2:return i.video=a.sent(),[3,4];case 3:return a.sent(),[3,4];case 4:if(!r)return[3,8];a.label=5;case 5:return a.trys.push([5,7,,8]),o=n,[4,xx.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,n]}}))}))},DH=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,xx.getMicrophones()]}))}))},kH=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,xx.getCameras()]}))}))},MH=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,xx.getAudioPlayback()]}))}))},UH=function(){return yD.VERSION},LH=function(){return HU.rtcSdkApiCall("isSupported",0,""),ev(void 0,void 0,void 0,(function(){var e;return tv(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),!oP()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,HL()]:[2,!1];case 1:return[2,null==(e=t.sent())?void 0:e.includes("H264")];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},xH=function(){return HU.rtcSdkApiCall("getSupportedCodecs",0,""),ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return[4,HL()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!oP()&&location.search.includes("_rtc_autotest_");var VH=new function(){this.getSdkVersion=UH,this.createEngine=OH,this.destroyEngine=NH,this.getDevices=wH,this.enableDevices=PH,this.getMicrophones=DH,this.getCameras=kH,this.getAudioPlayback=MH,this.getParameter=bD,this.setParameter=gD,this.isSupported=LH,this.getSupportedCodecs=xH,this.events=lP,this.ErrorCode=ZN,this.platform="BytePlus",this._monitor=HU};export{LL as AudioMixingDualMonoMode,xL as AudioMixingType,ZP as AudioSourceType,QP as ChannelProfile,dD as ConnectionState,hD as LogChannel,iD as MirrorMode,lD as MirrorType,tD as MuteState,oD as PauseResumeControlMediaType,_D as PublicInterpolationMode,fD as PublicStreamType,nD as PublishState,sD as StreamIndex,uD as StreamRemoveReason,cD as SubscribeMediaType,eD as SubscribeMode,rD as SubscribeState,pD as USER_ONLINE_STATUS,$P as UserOfflineReason,aD as VideoRenderMode,qP as VideoSourceType,VH as default};
6
+ 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 i=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,i.get?i:{enumerable:!0,get:function(){return t[r]}})}}))})),Object.freeze(e)}var t="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},r=function(e){return e&&e.Math==Math&&e},i=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")(),n={},o=function(e){try{return!!e()}catch(e){return!0}},a=!o((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]})),s=!o((function(){var e=function(){}.bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})),c=s,u=Function.prototype.call,d=c?u.bind(u):function(){return u.apply(u,arguments)},l={},h={}.propertyIsEnumerable,p=Object.getOwnPropertyDescriptor,f=p&&!h.call({1:2},1);l.f=f?function(e){var t=p(this,e);return!!t&&t.enumerable}:h;var _,v,m=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}},S=s,E=Function.prototype,y=E.bind,g=E.call,b=S&&y.bind(g,g),T=S?function(e){return e&&b(e)}:function(e){return e&&function(){return g.apply(e,arguments)}},I=T,R=I({}.toString),A=I("".slice),C=function(e){return A(R(e),8,-1)},O=T,N=o,w=C,D=i.Object,P=O("".split),k=N((function(){return!D("z").propertyIsEnumerable(0)}))?function(e){return"String"==w(e)?P(e,""):D(e)}:D,M=i.TypeError,U=function(e){if(null==e)throw M("Can't call method on "+e);return e},L=k,x=U,V=function(e){return L(x(e))},F=function(e){return"function"==typeof e},B=F,j=function(e){return"object"==typeof e?null!==e:B(e)},G=i,H=F,z=function(e){return H(e)?e:void 0},K=function(e,t){return arguments.length<2?z(G[e]):G[e]&&G[e][t]},Y=T({}.isPrototypeOf),X=K("navigator","userAgent")||"",W=i,J=X,q=W.process,Z=W.Deno,$=q&&q.versions||Z&&Z.version,Q=$&&$.v8;Q&&(v=(_=Q.split("."))[0]>0&&_[0]<4?1:+(_[0]+_[1])),!v&&J&&(!(_=J.match(/Edge\/(\d+)/))||_[1]>=74)&&(_=J.match(/Chrome\/(\d+)/))&&(v=+_[1]);var ee=v,te=ee,re=o,ie=!!Object.getOwnPropertySymbols&&!re((function(){var e=Symbol();return!String(e)||!(Object(e)instanceof Symbol)||!Symbol.sham&&te&&te<41})),ne=ie&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,oe=K,ae=F,se=Y,ce=ne,ue=i.Object,de=ce?function(e){return"symbol"==typeof e}:function(e){var t=oe("Symbol");return ae(t)&&se(t.prototype,ue(e))},le=i.String,he=function(e){try{return le(e)}catch(e){return"Object"}},pe=F,fe=he,_e=i.TypeError,ve=function(e){if(pe(e))return e;throw _e(fe(e)+" is not a function")},me=ve,Se=function(e,t){var r=e[t];return null==r?void 0:me(r)},Ee=d,ye=F,ge=j,be=i.TypeError,Te={exports:{}},Ie=i,Re=Object.defineProperty,Ae=function(e,t){try{Re(Ie,e,{value:t,configurable:!0,writable:!0})}catch(r){Ie[e]=t}return t},Ce=Ae,Oe=i["__core-js_shared__"]||Ce("__core-js_shared__",{}),Ne=Oe;(Te.exports=function(e,t){return Ne[e]||(Ne[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.21.0",mode:"global",copyright:"© 2014-2022 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.21.0/LICENSE",source:"https://github.com/zloirock/core-js"});var we=U,De=i.Object,Pe=function(e){return De(we(e))},ke=Pe,Me=T({}.hasOwnProperty),Ue=Object.hasOwn||function(e,t){return Me(ke(e),t)},Le=T,xe=0,Ve=Math.random(),Fe=Le(1..toString),Be=function(e){return"Symbol("+(void 0===e?"":e)+")_"+Fe(++xe+Ve,36)},je=i,Ge=Te.exports,He=Ue,ze=Be,Ke=ie,Ye=ne,Xe=Ge("wks"),We=je.Symbol,Je=We&&We.for,qe=Ye?We:We&&We.withoutSetter||ze,Ze=function(e){if(!He(Xe,e)||!Ke&&"string"!=typeof Xe[e]){var t="Symbol."+e;Ke&&He(We,e)?Xe[e]=We[e]:Xe[e]=Ye&&Je?Je(t):qe(t)}return Xe[e]},$e=d,Qe=j,et=de,tt=Se,rt=function(e,t){var r,i;if("string"===t&&ye(r=e.toString)&&!ge(i=Ee(r,e)))return i;if(ye(r=e.valueOf)&&!ge(i=Ee(r,e)))return i;if("string"!==t&&ye(r=e.toString)&&!ge(i=Ee(r,e)))return i;throw be("Can't convert object to primitive value")},it=Ze,nt=i.TypeError,ot=it("toPrimitive"),at=function(e,t){if(!Qe(e)||et(e))return e;var r,i=tt(e,ot);if(i){if(void 0===t&&(t="default"),r=$e(i,e,t),!Qe(r)||et(r))return r;throw nt("Can't convert object to primitive value")}return void 0===t&&(t="number"),rt(e,t)},st=at,ct=de,ut=function(e){var t=st(e,"string");return ct(t)?t:t+""},dt=j,lt=i.document,ht=dt(lt)&&dt(lt.createElement),pt=function(e){return ht?lt.createElement(e):{}},ft=pt,_t=!a&&!o((function(){return 7!=Object.defineProperty(ft("div"),"a",{get:function(){return 7}}).a})),vt=a,mt=d,St=l,Et=m,yt=V,gt=ut,bt=Ue,Tt=_t,It=Object.getOwnPropertyDescriptor;n.f=vt?It:function(e,t){if(e=yt(e),t=gt(t),Tt)try{return It(e,t)}catch(e){}if(bt(e,t))return Et(!mt(St.f,e,t),e[t])};var Rt={},At=a&&o((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype})),Ct=i,Ot=j,Nt=Ct.String,wt=Ct.TypeError,Dt=function(e){if(Ot(e))return e;throw wt(Nt(e)+" is not an object")},Pt=a,kt=_t,Mt=At,Ut=Dt,Lt=ut,xt=i.TypeError,Vt=Object.defineProperty,Ft=Object.getOwnPropertyDescriptor;Rt.f=Pt?Mt?function(e,t,r){if(Ut(e),t=Lt(t),Ut(r),"function"==typeof e&&"prototype"===t&&"value"in r&&"writable"in r&&!r.writable){var i=Ft(e,t);i&&i.writable&&(e[t]=r.value,r={configurable:"configurable"in r?r.configurable:i.configurable,enumerable:"enumerable"in r?r.enumerable:i.enumerable,writable:!1})}return Vt(e,t,r)}:Vt:function(e,t,r){if(Ut(e),t=Lt(t),Ut(r),kt)try{return Vt(e,t,r)}catch(e){}if("get"in r||"set"in r)throw xt("Accessors not supported");return"value"in r&&(e[t]=r.value),e};var Bt=Rt,jt=m,Gt=a?function(e,t,r){return Bt.f(e,t,jt(1,r))}:function(e,t,r){return e[t]=r,e},Ht={exports:{}},zt=F,Kt=Oe,Yt=T(Function.toString);zt(Kt.inspectSource)||(Kt.inspectSource=function(e){return Yt(e)});var Xt,Wt,Jt,qt=Kt.inspectSource,Zt=F,$t=qt,Qt=i.WeakMap,er=Zt(Qt)&&/native code/.test($t(Qt)),tr=Te.exports,rr=Be,ir=tr("keys"),nr=function(e){return ir[e]||(ir[e]=rr(e))},or={},ar=er,sr=i,cr=T,ur=j,dr=Gt,lr=Ue,hr=Oe,pr=nr,fr=or,_r=sr.TypeError,vr=sr.WeakMap;if(ar||hr.state){var mr=hr.state||(hr.state=new vr),Sr=cr(mr.get),Er=cr(mr.has),yr=cr(mr.set);Xt=function(e,t){if(Er(mr,e))throw new _r("Object already initialized");return t.facade=e,yr(mr,e,t),t},Wt=function(e){return Sr(mr,e)||{}},Jt=function(e){return Er(mr,e)}}else{var gr=pr("state");fr[gr]=!0,Xt=function(e,t){if(lr(e,gr))throw new _r("Object already initialized");return t.facade=e,dr(e,gr,t),t},Wt=function(e){return lr(e,gr)?e[gr]:{}},Jt=function(e){return lr(e,gr)}}var br={set:Xt,get:Wt,has:Jt,enforce:function(e){return Jt(e)?Wt(e):Xt(e,{})},getterFor:function(e){return function(t){var r;if(!ur(t)||(r=Wt(t)).type!==e)throw _r("Incompatible receiver, "+e+" required");return r}}},Tr=a,Ir=Ue,Rr=Function.prototype,Ar=Tr&&Object.getOwnPropertyDescriptor,Cr=Ir(Rr,"name"),Or={EXISTS:Cr,PROPER:Cr&&"something"===function(){}.name,CONFIGURABLE:Cr&&(!Tr||Tr&&Ar(Rr,"name").configurable)},Nr=i,wr=F,Dr=Ue,Pr=Gt,kr=Ae,Mr=qt,Ur=Or.CONFIGURABLE,Lr=br.get,xr=br.enforce,Vr=String(String).split("String");(Ht.exports=function(e,t,r,i){var n,o=!!i&&!!i.unsafe,a=!!i&&!!i.enumerable,s=!!i&&!!i.noTargetGet,c=i&&void 0!==i.name?i.name:t;wr(r)&&("Symbol("===String(c).slice(0,7)&&(c="["+String(c).replace(/^Symbol\(([^)]*)\)/,"$1")+"]"),(!Dr(r,"name")||Ur&&r.name!==c)&&Pr(r,"name",c),(n=xr(r)).source||(n.source=Vr.join("string"==typeof c?c:""))),e!==Nr?(o?!s&&e[t]&&(a=!0):delete e[t],a?e[t]=r:Pr(e,t,r)):a?e[t]=r:kr(t,r)})(Function.prototype,"toString",(function(){return wr(this)&&Lr(this).source||Mr(this)}));var Fr={},Br=Math.ceil,jr=Math.floor,Gr=function(e){var t=+e;return t!=t||0===t?0:(t>0?jr:Br)(t)},Hr=Gr,zr=Math.max,Kr=Math.min,Yr=function(e,t){var r=Hr(e);return r<0?zr(r+t,0):Kr(r,t)},Xr=Gr,Wr=Math.min,Jr=function(e){return e>0?Wr(Xr(e),9007199254740991):0},qr=Jr,Zr=function(e){return qr(e.length)},$r=V,Qr=Yr,ei=Zr,ti=function(e){return function(t,r,i){var n,o=$r(t),a=ei(o),s=Qr(i,a);if(e&&r!=r){for(;a>s;)if((n=o[s++])!=n)return!0}else for(;a>s;s++)if((e||s in o)&&o[s]===r)return e||s||0;return!e&&-1}},ri={includes:ti(!0),indexOf:ti(!1)},ii=Ue,ni=V,oi=ri.indexOf,ai=or,si=T([].push),ci=function(e,t){var r,i=ni(e),n=0,o=[];for(r in i)!ii(ai,r)&&ii(i,r)&&si(o,r);for(;t.length>n;)ii(i,r=t[n++])&&(~oi(o,r)||si(o,r));return o},ui=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"],di=ci,li=ui.concat("length","prototype");Fr.f=Object.getOwnPropertyNames||function(e){return di(e,li)};var hi={};hi.f=Object.getOwnPropertySymbols;var pi=K,fi=Fr,_i=hi,vi=Dt,mi=T([].concat),Si=pi("Reflect","ownKeys")||function(e){var t=fi.f(vi(e)),r=_i.f;return r?mi(t,r(e)):t},Ei=Ue,yi=Si,gi=n,bi=Rt,Ti=function(e,t,r){for(var i=yi(t),n=bi.f,o=gi.f,a=0;a<i.length;a++){var s=i[a];Ei(e,s)||r&&Ei(r,s)||n(e,s,o(t,s))}},Ii=o,Ri=F,Ai=/#|\.prototype\./,Ci=function(e,t){var r=Ni[Oi(e)];return r==Di||r!=wi&&(Ri(t)?Ii(t):!!t)},Oi=Ci.normalize=function(e){return String(e).replace(Ai,".").toLowerCase()},Ni=Ci.data={},wi=Ci.NATIVE="N",Di=Ci.POLYFILL="P",Pi=Ci,ki=i,Mi=n.f,Ui=Gt,Li=Ht.exports,xi=Ae,Vi=Ti,Fi=Pi,Bi=function(e,t){var r,i,n,o,a,s=e.target,c=e.global,u=e.stat;if(r=c?ki:u?ki[s]||xi(s,{}):(ki[s]||{}).prototype)for(i in t){if(o=t[i],n=e.noTargetGet?(a=Mi(r,i))&&a.value:r[i],!Fi(c?i:s+(u?".":"#")+i,e.forced)&&void 0!==n){if(typeof o==typeof n)continue;Vi(o,n)}(e.sham||n&&n.sham)&&Ui(o,"sham",!0),Li(r,i,o,e)}},ji=ve,Gi=s,Hi=T(T.bind),zi=function(e,t){return ji(e),void 0===t?e:Gi?Hi(e,t):function(){return e.apply(t,arguments)}},Ki=C,Yi=Array.isArray||function(e){return"Array"==Ki(e)},Xi={};Xi[Ze("toStringTag")]="z";var Wi="[object z]"===String(Xi),Ji=i,qi=Wi,Zi=F,$i=C,Qi=Ze("toStringTag"),en=Ji.Object,tn="Arguments"==$i(function(){return arguments}()),rn=qi?$i:function(e){var t,r,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(r=function(e,t){try{return e[t]}catch(e){}}(t=en(e),Qi))?r:tn?$i(t):"Object"==(i=$i(t))&&Zi(t.callee)?"Arguments":i},nn=T,on=o,an=F,sn=rn,cn=qt,un=function(){},dn=[],ln=K("Reflect","construct"),hn=/^\s*(?:class|function)\b/,pn=nn(hn.exec),fn=!hn.exec(un),_n=function(e){if(!an(e))return!1;try{return ln(un,dn,e),!0}catch(e){return!1}},vn=function(e){if(!an(e))return!1;switch(sn(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return fn||!!pn(hn,cn(e))}catch(e){return!0}};vn.sham=!0;var mn=!ln||on((function(){var e;return _n(_n.call)||!_n(Object)||!_n((function(){e=!0}))||e}))?vn:_n,Sn=i,En=Yi,yn=mn,gn=j,bn=Ze("species"),Tn=Sn.Array,In=function(e){var t;return En(e)&&(t=e.constructor,(yn(t)&&(t===Tn||En(t.prototype))||gn(t)&&null===(t=t[bn]))&&(t=void 0)),void 0===t?Tn:t},Rn=function(e,t){return new(In(e))(0===t?0:t)},An=zi,Cn=k,On=Pe,Nn=Zr,wn=Rn,Dn=T([].push),Pn=function(e){var t=1==e,r=2==e,i=3==e,n=4==e,o=6==e,a=7==e,s=5==e||o;return function(c,u,d,l){for(var h,p,f=On(c),_=Cn(f),v=An(u,d),m=Nn(_),S=0,E=l||wn,y=t?E(c,m):r||a?E(c,0):void 0;m>S;S++)if((s||S in _)&&(p=v(h=_[S],S,f),e))if(t)y[S]=p;else if(p)switch(e){case 3:return!0;case 5:return h;case 6:return S;case 2:Dn(y,h)}else switch(e){case 4:return!1;case 7:Dn(y,h)}return o?-1:i||n?n:y}},kn={forEach:Pn(0),map:Pn(1),filter:Pn(2),some:Pn(3),every:Pn(4),find:Pn(5),findIndex:Pn(6),filterReject:Pn(7)},Mn=o,Un=function(e,t){var r=[][e];return!!r&&Mn((function(){r.call(null,t||function(){throw 1},1)}))},Ln=kn.forEach,xn=Un("forEach")?[].forEach:function(e){return Ln(this,e,arguments.length>1?arguments[1]:void 0)};Bi({target:"Array",proto:!0,forced:[].forEach!=xn},{forEach:xn});var Vn=rn,Fn=Wi?{}.toString:function(){return"[object "+Vn(this)+"]"},Bn=Wi,jn=Ht.exports,Gn=Fn;Bn||jn(Object.prototype,"toString",Gn,{unsafe:!0});var Hn={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},zn=pt("span").classList,Kn=zn&&zn.constructor&&zn.constructor.prototype,Yn=Kn===Object.prototype?void 0:Kn,Xn=i,Wn=Hn,Jn=Yn,qn=xn,Zn=Gt,$n=function(e){if(e&&e.forEach!==qn)try{Zn(e,"forEach",qn)}catch(t){e.forEach=qn}};for(var Qn in Wn)Wn[Qn]&&$n(Xn[Qn]&&Xn[Qn].prototype);$n(Jn);var eo=Bi,to=T,ro=i.Date,io=to(ro.prototype.getTime);eo({target:"Date",stat:!0},{now:function(){return io(new ro)}});var no=T,oo=Ht.exports,ao=Date.prototype,so=no(ao.toString),co=no(ao.getTime);"Invalid Date"!=String(new Date(NaN))&&oo(ao,"toString",(function(){var e=co(this);return e==e?so(this):"Invalid Date"}));var uo={},lo=ci,ho=ui,po=Object.keys||function(e){return lo(e,ho)},fo=a,_o=At,vo=Rt,mo=Dt,So=V,Eo=po;uo.f=fo&&!_o?Object.defineProperties:function(e,t){mo(e);for(var r,i=So(t),n=Eo(t),o=n.length,a=0;o>a;)vo.f(e,r=n[a++],i[r]);return e};var yo,go=K("document","documentElement"),bo=Dt,To=uo,Io=ui,Ro=or,Ao=go,Co=pt,Oo=nr("IE_PROTO"),No=function(){},wo=function(e){return"<script>"+e+"<\/script>"},Do=function(e){e.write(wo("")),e.close();var t=e.parentWindow.Object;return e=null,t},Po=function(){try{yo=new ActiveXObject("htmlfile")}catch(e){}var e,t;Po="undefined"!=typeof document?document.domain&&yo?Do(yo):((t=Co("iframe")).style.display="none",Ao.appendChild(t),t.src=String("javascript:"),(e=t.contentWindow.document).open(),e.write(wo("document.F=Object")),e.close(),e.F):Do(yo);for(var r=Io.length;r--;)delete Po.prototype[Io[r]];return Po()};Ro[Oo]=!0;var ko=Object.create||function(e,t){var r;return null!==e?(No.prototype=bo(e),r=new No,No.prototype=null,r[Oo]=e):r=Po(),void 0===t?r:To.f(r,t)},Mo=ko,Uo=Rt,Lo=Ze("unscopables"),xo=Array.prototype;null==xo[Lo]&&Uo.f(xo,Lo,{configurable:!0,value:Mo(null)});var Vo=function(e){xo[Lo][e]=!0},Fo=ri.includes,Bo=Vo;Bi({target:"Array",proto:!0},{includes:function(e){return Fo(this,e,arguments.length>1?arguments[1]:void 0)}}),Bo("includes");var jo=j,Go=C,Ho=Ze("match"),zo=function(e){var t;return jo(e)&&(void 0!==(t=e[Ho])?!!t:"RegExp"==Go(e))},Ko=zo,Yo=i.TypeError,Xo=function(e){if(Ko(e))throw Yo("The method doesn't accept regular expressions");return e},Wo=rn,Jo=i.String,qo=function(e){if("Symbol"===Wo(e))throw TypeError("Cannot convert a Symbol value to a string");return Jo(e)},Zo=Ze("match"),$o=function(e){var t=/./;try{"/./"[e](t)}catch(r){try{return t[Zo]=!1,"/./"[e](t)}catch(e){}}return!1},Qo=Bi,ea=Xo,ta=U,ra=qo,ia=$o,na=T("".indexOf);Qo({target:"String",proto:!0,forced:!ia("includes")},{includes:function(e){return!!~na(ra(ta(this)),ra(ea(e)),arguments.length>1?arguments[1]:void 0)}});var oa=Dt,aa=function(){var e=oa(this),t="";return e.global&&(t+="g"),e.ignoreCase&&(t+="i"),e.multiline&&(t+="m"),e.dotAll&&(t+="s"),e.unicode&&(t+="u"),e.sticky&&(t+="y"),t},sa=o,ca=i.RegExp,ua=sa((function(){var e=ca("a","y");return e.lastIndex=2,null!=e.exec("abcd")})),da=ua||sa((function(){return!ca("a","y").sticky})),la={BROKEN_CARET:ua||sa((function(){var e=ca("^r","gy");return e.lastIndex=2,null!=e.exec("str")})),MISSED_STICKY:da,UNSUPPORTED_Y:ua},ha=o,pa=i.RegExp,fa=ha((function(){var e=pa(".","s");return!(e.dotAll&&e.exec("\n")&&"s"===e.flags)})),_a=o,va=i.RegExp,ma=_a((function(){var e=va("(?<a>b)","g");return"b"!==e.exec("b").groups.a||"bc"!=="b".replace(e,"$<a>c")})),Sa=d,Ea=T,ya=qo,ga=aa,ba=la,Ta=Te.exports,Ia=ko,Ra=br.get,Aa=fa,Ca=ma,Oa=Ta("native-string-replace",String.prototype.replace),Na=RegExp.prototype.exec,wa=Na,Da=Ea("".charAt),Pa=Ea("".indexOf),ka=Ea("".replace),Ma=Ea("".slice),Ua=function(){var e=/a/,t=/b*/g;return Sa(Na,e,"a"),Sa(Na,t,"a"),0!==e.lastIndex||0!==t.lastIndex}(),La=ba.BROKEN_CARET,xa=void 0!==/()??/.exec("")[1];(Ua||xa||La||Aa||Ca)&&(wa=function(e){var t,r,i,n,o,a,s,c=this,u=Ra(c),d=ya(e),l=u.raw;if(l)return l.lastIndex=c.lastIndex,t=Sa(wa,l,d),c.lastIndex=l.lastIndex,t;var h=u.groups,p=La&&c.sticky,f=Sa(ga,c),_=c.source,v=0,m=d;if(p&&(f=ka(f,"y",""),-1===Pa(f,"g")&&(f+="g"),m=Ma(d,c.lastIndex),c.lastIndex>0&&(!c.multiline||c.multiline&&"\n"!==Da(d,c.lastIndex-1))&&(_="(?: "+_+")",m=" "+m,v++),r=new RegExp("^(?:"+_+")",f)),xa&&(r=new RegExp("^"+_+"$(?!\\s)",f)),Ua&&(i=c.lastIndex),n=Sa(Na,p?r:c,m),p?n?(n.input=Ma(n.input,v),n[0]=Ma(n[0],v),n.index=c.lastIndex,c.lastIndex+=n[0].length):c.lastIndex=0:Ua&&n&&(c.lastIndex=c.global?n.index+n[0].length:i),xa&&n&&n.length>1&&Sa(Oa,n[0],r,(function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(n[o]=void 0)})),n&&h)for(n.groups=a=Ia(null),o=0;o<h.length;o++)a[(s=h[o])[0]]=n[s[1]];return n});var Va=wa;Bi({target:"RegExp",proto:!0,forced:/./.exec!==Va},{exec:Va});var Fa=T,Ba=Ht.exports,ja=Va,Ga=o,Ha=Ze,za=Gt,Ka=Ha("species"),Ya=RegExp.prototype,Xa=function(e,t,r,i){var n=Ha(e),o=!Ga((function(){var t={};return t[n]=function(){return 7},7!=""[e](t)})),a=o&&!Ga((function(){var t=!1,r=/a/;return"split"===e&&((r={}).constructor={},r.constructor[Ka]=function(){return r},r.flags="",r[n]=/./[n]),r.exec=function(){return t=!0,null},r[n](""),!t}));if(!o||!a||r){var s=Fa(/./[n]),c=t(n,""[e],(function(e,t,r,i,n){var a=Fa(e),c=t.exec;return c===ja||c===Ya.exec?o&&!n?{done:!0,value:s(t,r,i)}:{done:!0,value:a(r,t,i)}:{done:!1}}));Ba(String.prototype,e,c[0]),Ba(Ya,n,c[1])}i&&za(Ya[n],"sham",!0)},Wa=Object.is||function(e,t){return e===t?0!==e||1/e==1/t:e!=e&&t!=t},Ja=d,qa=Dt,Za=F,$a=C,Qa=Va,es=i.TypeError,ts=function(e,t){var r=e.exec;if(Za(r)){var i=Ja(r,e,t);return null!==i&&qa(i),i}if("RegExp"===$a(e))return Ja(Qa,e,t);throw es("RegExp#exec called on incompatible receiver")},rs=d,is=Dt,ns=U,os=Wa,as=qo,ss=Se,cs=ts;function us(e){return us="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},us(e)}Xa("search",(function(e,t,r){return[function(t){var r=ns(this),i=null==t?void 0:ss(t,e);return i?rs(i,t,r):new RegExp(t)[e](as(r))},function(e){var i=is(this),n=as(e),o=r(t,i,n);if(o.done)return o.value;var a=i.lastIndex;os(a,0)||(i.lastIndex=0);var s=cs(i,n);return os(i.lastIndex,a)||(i.lastIndex=a),null===s?-1:s.index}]}));var ds=i,ls=F,hs=ds.String,ps=ds.TypeError,fs=T,_s=Dt,vs=function(e){if("object"==typeof e||ls(e))return e;throw ps("Can't set "+hs(e)+" as a prototype")},ms=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,r={};try{(e=fs(Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set))(r,[]),t=r instanceof Array}catch(e){}return function(r,i){return _s(r),vs(i),t?e(r,i):r.__proto__=i,r}}():void 0);Bi({target:"Object",stat:!0},{setPrototypeOf:ms}),Bi({target:"Object",stat:!0,sham:!a},{create:ko});var Ss=a,Es=T,ys=d,gs=o,bs=po,Ts=hi,Is=l,Rs=Pe,As=k,Cs=Object.assign,Os=Object.defineProperty,Ns=Es([].concat),ws=!Cs||gs((function(){if(Ss&&1!==Cs({b:1},Cs(Os({},"a",{enumerable:!0,get:function(){Os(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var e={},t={},r=Symbol(),i="abcdefghijklmnopqrst";return e[r]=7,i.split("").forEach((function(e){t[e]=e})),7!=Cs({},e)[r]||bs(Cs({},t)).join("")!=i}))?function(e,t){for(var r=Rs(e),i=arguments.length,n=1,o=Ts.f,a=Is.f;i>n;)for(var s,c=As(arguments[n++]),u=o?Ns(bs(c),o(c)):bs(c),d=u.length,l=0;d>l;)s=u[l++],Ss&&!ys(a,c,s)||(r[s]=c[s]);return r}:Cs,Ds=ws;Bi({target:"Object",stat:!0,forced:Object.assign!==Ds},{assign:Ds});var Ps=Bi,ks=ri.indexOf,Ms=Un,Us=T([].indexOf),Ls=!!Us&&1/Us([1],1,-0)<0,xs=Ms("indexOf");Ps({target:"Array",proto:!0,forced:Ls||!xs},{indexOf:function(e){var t=arguments.length>1?arguments[1]:void 0;return Ls?Us(this,e,t)||0:ks(this,e,t)}});var Vs=s,Fs=Function.prototype,Bs=Fs.apply,js=Fs.call,Gs="object"==typeof Reflect&&Reflect.apply||(Vs?js.bind(Bs):function(){return js.apply(Bs,arguments)}),Hs={},zs=ut,Ks=Rt,Ys=m,Xs=function(e,t,r){var i=zs(t);i in e?Ks.f(e,i,Ys(0,r)):e[i]=r},Ws=Yr,Js=Zr,qs=Xs,Zs=i.Array,$s=Math.max,Qs=function(e,t,r){for(var i=Js(e),n=Ws(t,i),o=Ws(void 0===r?i:r,i),a=Zs($s(o-n,0)),s=0;n<o;n++,s++)qs(a,s,e[n]);return a.length=s,a},ec=C,tc=V,rc=Fr.f,ic=Qs,nc="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];Hs.f=function(e){return nc&&"Window"==ec(e)?function(e){try{return rc(e)}catch(e){return ic(nc)}}(e):rc(tc(e))};var oc=T([].slice),ac={},sc=Ze;ac.f=sc;var cc=i,uc=Ue,dc=ac,lc=Rt.f,hc=function(e){var t=cc.Symbol||(cc.Symbol={});uc(t,e)||lc(t,e,{value:dc.f(e)})},pc=Rt.f,fc=Ue,_c=Ze("toStringTag"),vc=function(e,t,r){e&&!r&&(e=e.prototype),e&&!fc(e,_c)&&pc(e,_c,{configurable:!0,value:t})},mc=Bi,Sc=i,Ec=K,yc=Gs,gc=d,bc=T,Tc=a,Ic=ie,Rc=o,Ac=Ue,Cc=Yi,Oc=F,Nc=j,wc=Y,Dc=de,Pc=Dt,kc=Pe,Mc=V,Uc=ut,Lc=qo,xc=m,Vc=ko,Fc=po,Bc=Fr,jc=Hs,Gc=hi,Hc=n,zc=Rt,Kc=uo,Yc=l,Xc=oc,Wc=Ht.exports,Jc=Te.exports,qc=or,Zc=Be,$c=Ze,Qc=ac,eu=hc,tu=vc,ru=br,iu=kn.forEach,nu=nr("hidden"),ou=$c("toPrimitive"),au=ru.set,su=ru.getterFor("Symbol"),cu=Object.prototype,uu=Sc.Symbol,du=uu&&uu.prototype,lu=Sc.TypeError,hu=Sc.QObject,pu=Ec("JSON","stringify"),fu=Hc.f,_u=zc.f,vu=jc.f,mu=Yc.f,Su=bc([].push),Eu=Jc("symbols"),yu=Jc("op-symbols"),gu=Jc("string-to-symbol-registry"),bu=Jc("symbol-to-string-registry"),Tu=Jc("wks"),Iu=!hu||!hu.prototype||!hu.prototype.findChild,Ru=Tc&&Rc((function(){return 7!=Vc(_u({},"a",{get:function(){return _u(this,"a",{value:7}).a}})).a}))?function(e,t,r){var i=fu(cu,t);i&&delete cu[t],_u(e,t,r),i&&e!==cu&&_u(cu,t,i)}:_u,Au=function(e,t){var r=Eu[e]=Vc(du);return au(r,{type:"Symbol",tag:e,description:t}),Tc||(r.description=t),r},Cu=function(e,t,r){e===cu&&Cu(yu,t,r),Pc(e);var i=Uc(t);return Pc(r),Ac(Eu,i)?(r.enumerable?(Ac(e,nu)&&e[nu][i]&&(e[nu][i]=!1),r=Vc(r,{enumerable:xc(0,!1)})):(Ac(e,nu)||_u(e,nu,xc(1,{})),e[nu][i]=!0),Ru(e,i,r)):_u(e,i,r)},Ou=function(e,t){Pc(e);var r=Mc(t),i=Fc(r).concat(Pu(r));return iu(i,(function(t){Tc&&!gc(Nu,r,t)||Cu(e,t,r[t])})),e},Nu=function(e){var t=Uc(e),r=gc(mu,this,t);return!(this===cu&&Ac(Eu,t)&&!Ac(yu,t))&&(!(r||!Ac(this,t)||!Ac(Eu,t)||Ac(this,nu)&&this[nu][t])||r)},wu=function(e,t){var r=Mc(e),i=Uc(t);if(r!==cu||!Ac(Eu,i)||Ac(yu,i)){var n=fu(r,i);return!n||!Ac(Eu,i)||Ac(r,nu)&&r[nu][i]||(n.enumerable=!0),n}},Du=function(e){var t=vu(Mc(e)),r=[];return iu(t,(function(e){Ac(Eu,e)||Ac(qc,e)||Su(r,e)})),r},Pu=function(e){var t=e===cu,r=vu(t?yu:Mc(e)),i=[];return iu(r,(function(e){!Ac(Eu,e)||t&&!Ac(cu,e)||Su(i,Eu[e])})),i};(Ic||(Wc(du=(uu=function(){if(wc(du,this))throw lu("Symbol is not a constructor");var e=arguments.length&&void 0!==arguments[0]?Lc(arguments[0]):void 0,t=Zc(e),r=function(e){this===cu&&gc(r,yu,e),Ac(this,nu)&&Ac(this[nu],t)&&(this[nu][t]=!1),Ru(this,t,xc(1,e))};return Tc&&Iu&&Ru(cu,t,{configurable:!0,set:r}),Au(t,e)}).prototype,"toString",(function(){return su(this).tag})),Wc(uu,"withoutSetter",(function(e){return Au(Zc(e),e)})),Yc.f=Nu,zc.f=Cu,Kc.f=Ou,Hc.f=wu,Bc.f=jc.f=Du,Gc.f=Pu,Qc.f=function(e){return Au($c(e),e)},Tc&&(_u(du,"description",{configurable:!0,get:function(){return su(this).description}}),Wc(cu,"propertyIsEnumerable",Nu,{unsafe:!0}))),mc({global:!0,wrap:!0,forced:!Ic,sham:!Ic},{Symbol:uu}),iu(Fc(Tu),(function(e){eu(e)})),mc({target:"Symbol",stat:!0,forced:!Ic},{for:function(e){var t=Lc(e);if(Ac(gu,t))return gu[t];var r=uu(t);return gu[t]=r,bu[r]=t,r},keyFor:function(e){if(!Dc(e))throw lu(e+" is not a symbol");if(Ac(bu,e))return bu[e]},useSetter:function(){Iu=!0},useSimple:function(){Iu=!1}}),mc({target:"Object",stat:!0,forced:!Ic,sham:!Tc},{create:function(e,t){return void 0===t?Vc(e):Ou(Vc(e),t)},defineProperty:Cu,defineProperties:Ou,getOwnPropertyDescriptor:wu}),mc({target:"Object",stat:!0,forced:!Ic},{getOwnPropertyNames:Du,getOwnPropertySymbols:Pu}),mc({target:"Object",stat:!0,forced:Rc((function(){Gc.f(1)}))},{getOwnPropertySymbols:function(e){return Gc.f(kc(e))}}),pu)&&mc({target:"JSON",stat:!0,forced:!Ic||Rc((function(){var e=uu();return"[null]"!=pu([e])||"{}"!=pu({a:e})||"{}"!=pu(Object(e))}))},{stringify:function(e,t,r){var i=Xc(arguments),n=t;if((Nc(t)||void 0!==e)&&!Dc(e))return Cc(t)||(t=function(e,t){if(Oc(n)&&(t=gc(n,this,e,t)),!Dc(t))return t}),i[1]=t,yc(pu,null,i)}});if(!du[ou]){var ku=du.valueOf;Wc(du,ou,(function(e){return gc(ku,this)}))}tu(uu,"Symbol"),qc[nu]=!0;var Mu=Bi,Uu=o,Lu=V,xu=n.f,Vu=a,Fu=Uu((function(){xu(1)}));Mu({target:"Object",stat:!0,forced:!Vu||Fu,sham:!Vu},{getOwnPropertyDescriptor:function(e,t){return xu(Lu(e),t)}});var Bu=Bi,ju=a,Gu=Rt.f;Bu({target:"Object",stat:!0,forced:Object.defineProperty!==Gu,sham:!ju},{defineProperty:Gu});var Hu=i.Promise,zu=Ht.exports,Ku=function(e,t,r){for(var i in t)zu(e,i,t[i],r);return e},Yu=K,Xu=Rt,Wu=a,Ju=Ze("species"),qu=function(e){var t=Yu(e),r=Xu.f;Wu&&t&&!t[Ju]&&r(t,Ju,{configurable:!0,get:function(){return this}})},Zu=Y,$u=i.TypeError,Qu=function(e,t){if(Zu(t,e))return e;throw $u("Incorrect invocation")},ed={},td=ed,rd=Ze("iterator"),id=Array.prototype,nd=function(e){return void 0!==e&&(td.Array===e||id[rd]===e)},od=rn,ad=Se,sd=ed,cd=Ze("iterator"),ud=function(e){if(null!=e)return ad(e,cd)||ad(e,"@@iterator")||sd[od(e)]},dd=d,ld=ve,hd=Dt,pd=he,fd=ud,_d=i.TypeError,vd=function(e,t){var r=arguments.length<2?fd(e):t;if(ld(r))return hd(dd(r,e));throw _d(pd(e)+" is not iterable")},md=d,Sd=Dt,Ed=Se,yd=function(e,t,r){var i,n;Sd(e);try{if(!(i=Ed(e,"return"))){if("throw"===t)throw r;return r}i=md(i,e)}catch(e){n=!0,i=e}if("throw"===t)throw r;if(n)throw i;return Sd(i),r},gd=zi,bd=d,Td=Dt,Id=he,Rd=nd,Ad=Zr,Cd=Y,Od=vd,Nd=ud,wd=yd,Dd=i.TypeError,Pd=function(e,t){this.stopped=e,this.result=t},kd=Pd.prototype,Md=function(e,t,r){var i,n,o,a,s,c,u,d=r&&r.that,l=!(!r||!r.AS_ENTRIES),h=!(!r||!r.IS_ITERATOR),p=!(!r||!r.INTERRUPTED),f=gd(t,d),_=function(e){return i&&wd(i,"normal",e),new Pd(!0,e)},v=function(e){return l?(Td(e),p?f(e[0],e[1],_):f(e[0],e[1])):p?f(e,_):f(e)};if(h)i=e;else{if(!(n=Nd(e)))throw Dd(Id(e)+" is not iterable");if(Rd(n)){for(o=0,a=Ad(e);a>o;o++)if((s=v(e[o]))&&Cd(kd,s))return s;return new Pd(!1)}i=Od(e,n)}for(c=i.next;!(u=bd(c,i)).done;){try{s=v(u.value)}catch(e){wd(i,"throw",e)}if("object"==typeof s&&s&&Cd(kd,s))return s}return new Pd(!1)},Ud=Ze("iterator"),Ld=!1;try{var xd=0,Vd={next:function(){return{done:!!xd++}},return:function(){Ld=!0}};Vd[Ud]=function(){return this},Array.from(Vd,(function(){throw 2}))}catch(e){}var Fd,Bd,jd,Gd,Hd=function(e,t){if(!t&&!Ld)return!1;var r=!1;try{var i={};i[Ud]=function(){return{next:function(){return{done:r=!0}}}},e(i)}catch(e){}return r},zd=mn,Kd=he,Yd=i.TypeError,Xd=function(e){if(zd(e))return e;throw Yd(Kd(e)+" is not a constructor")},Wd=Dt,Jd=Xd,qd=Ze("species"),Zd=function(e,t){var r,i=Wd(e).constructor;return void 0===i||null==(r=Wd(i)[qd])?t:Jd(r)},$d=i.TypeError,Qd=function(e,t){if(e<t)throw $d("Not enough arguments");return e},el=/(?:ipad|iphone|ipod).*applewebkit/i.test(X),tl="process"==C(i.process),rl=i,il=Gs,nl=zi,ol=F,al=Ue,sl=o,cl=go,ul=oc,dl=pt,ll=Qd,hl=el,pl=tl,fl=rl.setImmediate,_l=rl.clearImmediate,vl=rl.process,ml=rl.Dispatch,Sl=rl.Function,El=rl.MessageChannel,yl=rl.String,gl=0,bl={};try{Fd=rl.location}catch(e){}var Tl=function(e){if(al(bl,e)){var t=bl[e];delete bl[e],t()}},Il=function(e){return function(){Tl(e)}},Rl=function(e){Tl(e.data)},Al=function(e){rl.postMessage(yl(e),Fd.protocol+"//"+Fd.host)};fl&&_l||(fl=function(e){ll(arguments.length,1);var t=ol(e)?e:Sl(e),r=ul(arguments,1);return bl[++gl]=function(){il(t,void 0,r)},Bd(gl),gl},_l=function(e){delete bl[e]},pl?Bd=function(e){vl.nextTick(Il(e))}:ml&&ml.now?Bd=function(e){ml.now(Il(e))}:El&&!hl?(Gd=(jd=new El).port2,jd.port1.onmessage=Rl,Bd=nl(Gd.postMessage,Gd)):rl.addEventListener&&ol(rl.postMessage)&&!rl.importScripts&&Fd&&"file:"!==Fd.protocol&&!sl(Al)?(Bd=Al,rl.addEventListener("message",Rl,!1)):Bd="onreadystatechange"in dl("script")?function(e){cl.appendChild(dl("script")).onreadystatechange=function(){cl.removeChild(this),Tl(e)}}:function(e){setTimeout(Il(e),0)});var Cl,Ol,Nl,wl,Dl,Pl,kl,Ml,Ul={set:fl,clear:_l},Ll=i,xl=/ipad|iphone|ipod/i.test(X)&&void 0!==Ll.Pebble,Vl=/web0s(?!.*chrome)/i.test(X),Fl=i,Bl=zi,jl=n.f,Gl=Ul.set,Hl=el,zl=xl,Kl=Vl,Yl=tl,Xl=Fl.MutationObserver||Fl.WebKitMutationObserver,Wl=Fl.document,Jl=Fl.process,ql=Fl.Promise,Zl=jl(Fl,"queueMicrotask"),$l=Zl&&Zl.value;$l||(Cl=function(){var e,t;for(Yl&&(e=Jl.domain)&&e.exit();Ol;){t=Ol.fn,Ol=Ol.next;try{t()}catch(e){throw Ol?wl():Nl=void 0,e}}Nl=void 0,e&&e.enter()},Hl||Yl||Kl||!Xl||!Wl?!zl&&ql&&ql.resolve?((kl=ql.resolve(void 0)).constructor=ql,Ml=Bl(kl.then,kl),wl=function(){Ml(Cl)}):Yl?wl=function(){Jl.nextTick(Cl)}:(Gl=Bl(Gl,Fl),wl=function(){Gl(Cl)}):(Dl=!0,Pl=Wl.createTextNode(""),new Xl(Cl).observe(Pl,{characterData:!0}),wl=function(){Pl.data=Dl=!Dl}));var Ql=$l||function(e){var t={fn:e,next:void 0};Nl&&(Nl.next=t),Ol||(Ol=t,wl()),Nl=t},eh={},th=ve,rh=function(e){var t,r;this.promise=new e((function(e,i){if(void 0!==t||void 0!==r)throw TypeError("Bad Promise constructor");t=e,r=i})),this.resolve=th(t),this.reject=th(r)};eh.f=function(e){return new rh(e)};var ih=Dt,nh=j,oh=eh,ah=function(e,t){if(ih(e),nh(t)&&t.constructor===e)return t;var r=oh.f(e);return(0,r.resolve)(t),r.promise},sh=i,ch=function(){this.head=null,this.tail=null};ch.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 uh,dh,lh,hh,ph=ch,fh="object"==typeof window,_h=Bi,vh=i,mh=K,Sh=d,Eh=Hu,yh=Ht.exports,gh=Ku,bh=ms,Th=vc,Ih=qu,Rh=ve,Ah=F,Ch=j,Oh=Qu,Nh=qt,wh=Md,Dh=Hd,Ph=Zd,kh=Ul.set,Mh=Ql,Uh=ah,Lh=function(e,t){var r=sh.console;r&&r.error&&(1==arguments.length?r.error(e):r.error(e,t))},xh=eh,Vh=function(e){try{return{error:!1,value:e()}}catch(e){return{error:!0,value:e}}},Fh=ph,Bh=br,jh=Pi,Gh=fh,Hh=tl,zh=ee,Kh=Ze("species"),Yh="Promise",Xh=Bh.getterFor(Yh),Wh=Bh.set,Jh=Bh.getterFor(Yh),qh=Eh&&Eh.prototype,Zh=Eh,$h=qh,Qh=vh.TypeError,ep=vh.document,tp=vh.process,rp=xh.f,ip=rp,np=!!(ep&&ep.createEvent&&vh.dispatchEvent),op=Ah(vh.PromiseRejectionEvent),ap=!1,sp=jh(Yh,(function(){var e=Nh(Zh),t=e!==String(Zh);if(!t&&66===zh)return!0;if(zh>=51&&/native code/.test(e))return!1;var r=new Zh((function(e){e(1)})),i=function(e){e((function(){}),(function(){}))};return(r.constructor={})[Kh]=i,!(ap=r.then((function(){}))instanceof i)||!t&&Gh&&!op})),cp=sp||!Dh((function(e){Zh.all(e).catch((function(){}))})),up=function(e){var t;return!(!Ch(e)||!Ah(t=e.then))&&t},dp=function(e,t){var r,i,n,o=t.value,a=1==t.state,s=a?e.ok:e.fail,c=e.resolve,u=e.reject,d=e.domain;try{s?(a||(2===t.rejection&&_p(t),t.rejection=1),!0===s?r=o:(d&&d.enter(),r=s(o),d&&(d.exit(),n=!0)),r===e.promise?u(Qh("Promise-chain cycle")):(i=up(r))?Sh(i,r,c,u):c(r)):u(o)}catch(e){d&&!n&&d.exit(),u(e)}},lp=function(e,t){e.notified||(e.notified=!0,Mh((function(){for(var r,i=e.reactions;r=i.get();)dp(r,e);e.notified=!1,t&&!e.rejection&&pp(e)})))},hp=function(e,t,r){var i,n;np?((i=ep.createEvent("Event")).promise=t,i.reason=r,i.initEvent(e,!1,!0),vh.dispatchEvent(i)):i={promise:t,reason:r},!op&&(n=vh["on"+e])?n(i):"unhandledrejection"===e&&Lh("Unhandled promise rejection",r)},pp=function(e){Sh(kh,vh,(function(){var t,r=e.facade,i=e.value;if(fp(e)&&(t=Vh((function(){Hh?tp.emit("unhandledRejection",i,r):hp("unhandledrejection",r,i)})),e.rejection=Hh||fp(e)?2:1,t.error))throw t.value}))},fp=function(e){return 1!==e.rejection&&!e.parent},_p=function(e){Sh(kh,vh,(function(){var t=e.facade;Hh?tp.emit("rejectionHandled",t):hp("rejectionhandled",t,e.value)}))},vp=function(e,t,r){return function(i){e(t,i,r)}},mp=function(e,t,r){e.done||(e.done=!0,r&&(e=r),e.value=t,e.state=2,lp(e,!0))},Sp=function(e,t,r){if(!e.done){e.done=!0,r&&(e=r);try{if(e.facade===t)throw Qh("Promise can't be resolved itself");var i=up(t);i?Mh((function(){var r={done:!1};try{Sh(i,t,vp(Sp,r,e),vp(mp,r,e))}catch(t){mp(r,t,e)}})):(e.value=t,e.state=1,lp(e,!1))}catch(t){mp({done:!1},t,e)}}};if(sp&&($h=(Zh=function(e){Oh(this,$h),Rh(e),Sh(uh,this);var t=Xh(this);try{e(vp(Sp,t),vp(mp,t))}catch(e){mp(t,e)}}).prototype,(uh=function(e){Wh(this,{type:Yh,done:!1,notified:!1,parent:!1,reactions:new Fh,rejection:!1,state:0,value:void 0})}).prototype=gh($h,{then:function(e,t){var r=Jh(this),i=rp(Ph(this,Zh));return r.parent=!0,i.ok=!Ah(e)||e,i.fail=Ah(t)&&t,i.domain=Hh?tp.domain:void 0,0==r.state?r.reactions.add(i):Mh((function(){dp(i,r)})),i.promise},catch:function(e){return this.then(void 0,e)}}),dh=function(){var e=new uh,t=Xh(e);this.promise=e,this.resolve=vp(Sp,t),this.reject=vp(mp,t)},xh.f=rp=function(e){return e===Zh||e===lh?new dh(e):ip(e)},Ah(Eh)&&qh!==Object.prototype)){hh=qh.then,ap||(yh(qh,"then",(function(e,t){var r=this;return new Zh((function(e,t){Sh(hh,r,e,t)})).then(e,t)}),{unsafe:!0}),yh(qh,"catch",$h.catch,{unsafe:!0}));try{delete qh.constructor}catch(e){}bh&&bh(qh,$h)}_h({global:!0,wrap:!0,forced:sp},{Promise:Zh}),Th(Zh,Yh,!1),Ih(Yh),lh=mh(Yh),_h({target:Yh,stat:!0,forced:sp},{reject:function(e){var t=rp(this);return Sh(t.reject,void 0,e),t.promise}}),_h({target:Yh,stat:!0,forced:sp},{resolve:function(e){return Uh(this,e)}}),_h({target:Yh,stat:!0,forced:cp},{all:function(e){var t=this,r=rp(t),i=r.resolve,n=r.reject,o=Vh((function(){var r=Rh(t.resolve),o=[],a=0,s=1;wh(e,(function(e){var c=a++,u=!1;s++,Sh(r,t,e).then((function(e){u||(u=!0,o[c]=e,--s||i(o))}),n)})),--s||i(o)}));return o.error&&n(o.value),r.promise},race:function(e){var t=this,r=rp(t),i=r.reject,n=Vh((function(){var n=Rh(t.resolve);wh(e,(function(e){Sh(n,t,e).then(r.resolve,i)}))}));return n.error&&i(n.value),r.promise}});var Ep=Bi,yp=a,gp=i,bp=T,Tp=Ue,Ip=F,Rp=Y,Ap=qo,Cp=Rt.f,Op=Ti,Np=gp.Symbol,wp=Np&&Np.prototype;if(yp&&Ip(Np)&&(!("description"in wp)||void 0!==Np().description)){var Dp={},Pp=function(){var e=arguments.length<1||void 0===arguments[0]?void 0:Ap(arguments[0]),t=Rp(wp,this)?new Np(e):void 0===e?Np():Np(e);return""===e&&(Dp[t]=!0),t};Op(Pp,Np),Pp.prototype=wp,wp.constructor=Pp;var kp="Symbol(test)"==String(Np("test")),Mp=bp(wp.toString),Up=bp(wp.valueOf),Lp=/^Symbol\((.*)\)[^)]+$/,xp=bp("".replace),Vp=bp("".slice);Cp(wp,"description",{configurable:!0,get:function(){var e=Up(this),t=Mp(e);if(Tp(Dp,e))return"";var r=kp?Vp(t,7,-1):xp(t,Lp,"$1");return""===r?void 0:r}}),Ep({global:!0,forced:!0},{Symbol:Pp})}hc("iterator");var Fp,Bp,jp,Gp=!o((function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})),Hp=i,zp=Ue,Kp=F,Yp=Pe,Xp=Gp,Wp=nr("IE_PROTO"),Jp=Hp.Object,qp=Jp.prototype,Zp=Xp?Jp.getPrototypeOf:function(e){var t=Yp(e);if(zp(t,Wp))return t[Wp];var r=t.constructor;return Kp(r)&&t instanceof r?r.prototype:t instanceof Jp?qp:null},$p=o,Qp=F,ef=Zp,tf=Ht.exports,rf=Ze("iterator"),nf=!1;[].keys&&("next"in(jp=[].keys())?(Bp=ef(ef(jp)))!==Object.prototype&&(Fp=Bp):nf=!0);var of=null==Fp||$p((function(){var e={};return Fp[rf].call(e)!==e}));of&&(Fp={}),Qp(Fp[rf])||tf(Fp,rf,(function(){return this}));var af={IteratorPrototype:Fp,BUGGY_SAFARI_ITERATORS:nf},sf=af.IteratorPrototype,cf=ko,uf=m,df=vc,lf=ed,hf=function(){return this},pf=function(e,t,r,i){var n=t+" Iterator";return e.prototype=cf(sf,{next:uf(+!i,r)}),df(e,n,!1),lf[n]=hf,e},ff=Bi,_f=d,vf=Or,mf=F,Sf=pf,Ef=Zp,yf=ms,gf=vc,bf=Gt,Tf=Ht.exports,If=ed,Rf=vf.PROPER,Af=vf.CONFIGURABLE,Cf=af.IteratorPrototype,Of=af.BUGGY_SAFARI_ITERATORS,Nf=Ze("iterator"),wf=function(){return this},Df=function(e,t,r,i,n,o,a){Sf(r,t,i);var s,c,u,d=function(e){if(e===n&&_)return _;if(!Of&&e in p)return p[e];switch(e){case"keys":case"values":case"entries":return function(){return new r(this,e)}}return function(){return new r(this)}},l=t+" Iterator",h=!1,p=e.prototype,f=p[Nf]||p["@@iterator"]||n&&p[n],_=!Of&&f||d(n),v="Array"==t&&p.entries||f;if(v&&(s=Ef(v.call(new e)))!==Object.prototype&&s.next&&(Ef(s)!==Cf&&(yf?yf(s,Cf):mf(s[Nf])||Tf(s,Nf,wf)),gf(s,l,!0)),Rf&&"values"==n&&f&&"values"!==f.name&&(Af?bf(p,"name","values"):(h=!0,_=function(){return _f(f,this)})),n)if(c={values:d("values"),keys:o?_:d("keys"),entries:d("entries")},a)for(u in c)(Of||h||!(u in p))&&Tf(p,u,c[u]);else ff({target:t,proto:!0,forced:Of||h},c);return p[Nf]!==_&&Tf(p,Nf,_,{name:n}),If[t]=_,c},Pf=V,kf=Vo,Mf=ed,Uf=br,Lf=Rt.f,xf=Df,Vf=a,Ff=Uf.set,Bf=Uf.getterFor("Array Iterator"),jf=xf(Array,"Array",(function(e,t){Ff(this,{type:"Array Iterator",target:Pf(e),index:0,kind:t})}),(function(){var e=Bf(this),t=e.target,r=e.kind,i=e.index++;return!t||i>=t.length?(e.target=void 0,{value:void 0,done:!0}):"keys"==r?{value:i,done:!1}:"values"==r?{value:t[i],done:!1}:{value:[i,t[i]],done:!1}}),"values"),Gf=Mf.Arguments=Mf.Array;if(kf("keys"),kf("values"),kf("entries"),Vf&&"values"!==Gf.name)try{Lf(Gf,"name",{value:"values"})}catch(e){}var Hf=T,zf=Gr,Kf=qo,Yf=U,Xf=Hf("".charAt),Wf=Hf("".charCodeAt),Jf=Hf("".slice),qf=function(e){return function(t,r){var i,n,o=Kf(Yf(t)),a=zf(r),s=o.length;return a<0||a>=s?e?"":void 0:(i=Wf(o,a))<55296||i>56319||a+1===s||(n=Wf(o,a+1))<56320||n>57343?e?Xf(o,a):i:e?Jf(o,a,a+2):n-56320+(i-55296<<10)+65536}},Zf={codeAt:qf(!1),charAt:qf(!0)},$f=Zf.charAt,Qf=qo,e_=br,t_=Df,r_=e_.set,i_=e_.getterFor("String Iterator");t_(String,"String",(function(e){r_(this,{type:"String Iterator",string:Qf(e),index:0})}),(function(){var e,t=i_(this),r=t.string,i=t.index;return i>=r.length?{value:void 0,done:!0}:(e=$f(r,i),t.index+=e.length,{value:e,done:!1})}));var n_=i,o_=Hn,a_=Yn,s_=jf,c_=Gt,u_=Ze,d_=u_("iterator"),l_=u_("toStringTag"),h_=s_.values,p_=function(e,t){if(e){if(e[d_]!==h_)try{c_(e,d_,h_)}catch(t){e[d_]=h_}if(e[l_]||c_(e,l_,t),o_[t])for(var r in s_)if(e[r]!==s_[r])try{c_(e,r,s_[r])}catch(t){e[r]=s_[r]}}};for(var f_ in o_)p_(n_[f_]&&n_[f_].prototype,f_);p_(a_,"DOMTokenList");var __=o,v_=ee,m_=Ze("species"),S_=function(e){return v_>=51||!__((function(){var t=[];return(t.constructor={})[m_]=function(){return{foo:1}},1!==t[e](Boolean).foo}))},E_=Bi,y_=i,g_=o,b_=Yi,T_=j,I_=Pe,R_=Zr,A_=Xs,C_=Rn,O_=S_,N_=ee,w_=Ze("isConcatSpreadable"),D_=y_.TypeError,P_=N_>=51||!g_((function(){var e=[];return e[w_]=!1,e.concat()[0]!==e})),k_=O_("concat"),M_=function(e){if(!T_(e))return!1;var t=e[w_];return void 0!==t?!!t:b_(e)};E_({target:"Array",proto:!0,forced:!P_||!k_},{concat:function(e){var t,r,i,n,o,a=I_(this),s=C_(a,0),c=0;for(t=-1,i=arguments.length;t<i;t++)if(M_(o=-1===t?a:arguments[t])){if(c+(n=R_(o))>9007199254740991)throw D_("Maximum allowed index exceeded");for(r=0;r<n;r++,c++)r in o&&A_(s,c,o[r])}else{if(c>=9007199254740991)throw D_("Maximum allowed index exceeded");A_(s,c++,o)}return s.length=c,s}});var U_=Bi,L_=i,x_=Yi,V_=mn,F_=j,B_=Yr,j_=Zr,G_=V,H_=Xs,z_=Ze,K_=oc,Y_=S_("slice"),X_=z_("species"),W_=L_.Array,J_=Math.max;U_({target:"Array",proto:!0,forced:!Y_},{slice:function(e,t){var r,i,n,o=G_(this),a=j_(o),s=B_(e,a),c=B_(void 0===t?a:t,a);if(x_(o)&&(r=o.constructor,(V_(r)&&(r===W_||x_(r.prototype))||F_(r)&&null===(r=r[X_]))&&(r=void 0),r===W_||void 0===r))return K_(o,s,c);for(i=new(void 0===r?W_:r)(J_(c-s,0)),n=0;s<c;s++,n++)s in o&&H_(i,n,o[s]);return i.length=n,i}}),hc("asyncIterator");var q_=function(e,t){return q_=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])},q_(e,t)};function Z_(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}q_(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var $_=function(){return $_=Object.assign||function(e){for(var t,r=1,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e},$_.apply(this,arguments)};function Q_(e,t,r,i){var n,o=arguments.length,a=o<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"===("undefined"==typeof Reflect?"undefined":us(Reflect))&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,r,i);else for(var s=e.length-1;s>=0;s--)(n=e[s])&&(a=(o<3?n(a):o>3?n(t,r,a):n(t,r))||a);return o>3&&a&&Object.defineProperty(t,r,a),a}function ev(e,t,r,i){return new(r||(r=Promise))((function(n,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?n(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(a,s)}c((i=i.apply(e,t||[])).next())}))}function tv(e,t){var r,i,n,o,a={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;a;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(n=a.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){a.label=o[1];break}if(6===o[0]&&a.label<n[1]){a.label=n[1],n=o;break}if(n&&a.label<n[2]){a.label=n[2],a.ops.push(o);break}n[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}}function rv(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function iv(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var i,n,o=r.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)a.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return a}function nv(e,t,r){if(r||2===arguments.length)for(var i,n=0,o=t.length;n<o;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))}function ov(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var av=Zf.charAt,sv=function(e,t,r){return t+(r?av(e,t).length:1)},cv=d,uv=Dt,dv=Jr,lv=qo,hv=U,pv=Se,fv=sv,_v=ts;Xa("match",(function(e,t,r){return[function(t){var r=hv(this),i=null==t?void 0:pv(t,e);return i?cv(i,t,r):new RegExp(t)[e](lv(r))},function(e){var i=uv(this),n=lv(e),o=r(t,i,n);if(o.done)return o.value;if(!i.global)return _v(i,n);var a=i.unicode;i.lastIndex=0;for(var s,c=[],u=0;null!==(s=_v(i,n));){var d=lv(s[0]);c[u]=d,""===d&&(i.lastIndex=fv(n,dv(i.lastIndex),a)),u++}return 0===u?null:c}]}));var vv="\t\n\v\f\r                 \u2028\u2029\ufeff",mv=U,Sv=qo,Ev=T("".replace),yv="[\t\n\v\f\r                 \u2028\u2029\ufeff]",gv=RegExp("^"+yv+yv+"*"),bv=RegExp(yv+yv+"*$"),Tv=function(e){return function(t){var r=Sv(mv(t));return 1&e&&(r=Ev(r,gv,"")),2&e&&(r=Ev(r,bv,"")),r}},Iv={start:Tv(1),end:Tv(2),trim:Tv(3)},Rv=i,Av=o,Cv=T,Ov=qo,Nv=Iv.trim,wv=Rv.parseInt,Dv=Rv.Symbol,Pv=Dv&&Dv.iterator,kv=/^[+-]?0x/i,Mv=Cv(kv.exec),Uv=8!==wv("\t\n\v\f\r                 \u2028\u2029\ufeff08")||22!==wv("\t\n\v\f\r                 \u2028\u2029\ufeff0x16")||Pv&&!Av((function(){wv(Object(Pv))}))?function(e,t){var r=Nv(Ov(e));return wv(r,t>>>0||(Mv(kv,r)?16:10))}:wv;Bi({global:!0,forced:parseInt!=Uv},{parseInt:Uv});var Lv={exports:{}},xv=o((function(){if("function"==typeof ArrayBuffer){var e=new ArrayBuffer(8);Object.isExtensible(e)&&Object.defineProperty(e,"a",{value:8})}})),Vv=o,Fv=j,Bv=C,jv=xv,Gv=Object.isExtensible,Hv=Vv((function(){Gv(1)}))||jv?function(e){return!!Fv(e)&&((!jv||"ArrayBuffer"!=Bv(e))&&(!Gv||Gv(e)))}:Gv,zv=!o((function(){return Object.isExtensible(Object.preventExtensions({}))})),Kv=Bi,Yv=T,Xv=or,Wv=j,Jv=Ue,qv=Rt.f,Zv=Fr,$v=Hs,Qv=Hv,em=zv,tm=!1,rm=Be("meta"),im=0,nm=function(e){qv(e,rm,{value:{objectID:"O"+im++,weakData:{}}})},om=Lv.exports={enable:function(){om.enable=function(){},tm=!0;var e=Zv.f,t=Yv([].splice),r={};r[rm]=1,e(r).length&&(Zv.f=function(r){for(var i=e(r),n=0,o=i.length;n<o;n++)if(i[n]===rm){t(i,n,1);break}return i},Kv({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:$v.f}))},fastKey:function(e,t){if(!Wv(e))return"symbol"==typeof e?e:("string"==typeof e?"S":"P")+e;if(!Jv(e,rm)){if(!Qv(e))return"F";if(!t)return"E";nm(e)}return e[rm].objectID},getWeakData:function(e,t){if(!Jv(e,rm)){if(!Qv(e))return!0;if(!t)return!1;nm(e)}return e[rm].weakData},onFreeze:function(e){return em&&tm&&Qv(e)&&!Jv(e,rm)&&nm(e),e}};Xv[rm]=!0;var am=F,sm=j,cm=ms,um=function(e,t,r){var i,n;return cm&&am(i=t.constructor)&&i!==r&&sm(n=i.prototype)&&n!==r.prototype&&cm(e,n),e},dm=Bi,lm=i,hm=T,pm=Pi,fm=Ht.exports,_m=Lv.exports,vm=Md,mm=Qu,Sm=F,Em=j,ym=o,gm=Hd,bm=vc,Tm=um,Im=function(e,t,r){var i=-1!==e.indexOf("Map"),n=-1!==e.indexOf("Weak"),o=i?"set":"add",a=lm[e],s=a&&a.prototype,c=a,u={},d=function(e){var t=hm(s[e]);fm(s,e,"add"==e?function(e){return t(this,0===e?0:e),this}:"delete"==e?function(e){return!(n&&!Em(e))&&t(this,0===e?0:e)}:"get"==e?function(e){return n&&!Em(e)?void 0:t(this,0===e?0:e)}:"has"==e?function(e){return!(n&&!Em(e))&&t(this,0===e?0:e)}:function(e,r){return t(this,0===e?0:e,r),this})};if(pm(e,!Sm(a)||!(n||s.forEach&&!ym((function(){(new a).entries().next()})))))c=r.getConstructor(t,e,i,o),_m.enable();else if(pm(e,!0)){var l=new c,h=l[o](n?{}:-0,1)!=l,p=ym((function(){l.has(1)})),f=gm((function(e){new a(e)})),_=!n&&ym((function(){for(var e=new a,t=5;t--;)e[o](t,t);return!e.has(-0)}));f||((c=t((function(e,t){mm(e,s);var r=Tm(new a,e,c);return null!=t&&vm(t,r[o],{that:r,AS_ENTRIES:i}),r}))).prototype=s,s.constructor=c),(p||_)&&(d("delete"),d("has"),i&&d("get")),(_||h)&&d(o),n&&s.clear&&delete s.clear}return u[e]=c,dm({global:!0,forced:c!=a},u),bm(c,e),n||r.setStrong(c,e,i),c},Rm=Rt.f,Am=ko,Cm=Ku,Om=zi,Nm=Qu,wm=Md,Dm=Df,Pm=qu,km=a,Mm=Lv.exports.fastKey,Um=br.set,Lm=br.getterFor,xm={getConstructor:function(e,t,r,i){var n=e((function(e,n){Nm(e,o),Um(e,{type:t,index:Am(null),first:void 0,last:void 0,size:0}),km||(e.size=0),null!=n&&wm(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=Lm(t),s=function(e,t,r){var i,n,o=a(e),s=c(e,t);return s?s.value=r:(o.last=s={index:n=Mm(t,!0),key:t,value:r,previous:i=o.last,next:void 0,removed:!1},o.first||(o.first=s),i&&(i.next=s),km?o.size++:e.size++,"F"!==n&&(o.index[n]=s)),e},c=function(e,t){var r,i=a(e),n=Mm(t);if("F"!==n)return i.index[n];for(r=i.first;r;r=r.next)if(r.key==t)return r};return Cm(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,km?e.size=0:this.size=0},delete:function(e){var t=this,r=a(t),i=c(t,e);if(i){var n=i.next,o=i.previous;delete r.index[i.index],i.removed=!0,o&&(o.next=n),n&&(n.previous=o),r.first==i&&(r.first=n),r.last==i&&(r.last=o),km?r.size--:t.size--}return!!i},forEach:function(e){for(var t,r=a(this),i=Om(e,arguments.length>1?arguments[1]:void 0);t=t?t.next:r.first;)for(i(t.value,t.key,this);t&&t.removed;)t=t.previous},has:function(e){return!!c(this,e)}}),Cm(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)}}),km&&Rm(o,"size",{get:function(){return a(this).size}}),n},setStrong:function(e,t,r){var i=t+" Iterator",n=Lm(t),o=Lm(i);Dm(e,t,(function(e,t){Um(this,{type:i,target:e,state:n(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)?"keys"==t?{value:r.key,done:!1}:"values"==t?{value:r.value,done:!1}:{value:[r.key,r.value],done:!1}:(e.target=void 0,{value:void 0,done:!0})}),r?"entries":"values",!r,!0),Pm(t)}};Im("Map",(function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}}),xm);var Vm=Pe,Fm=po;Bi({target:"Object",stat:!0,forced:o((function(){Fm(1)}))},{keys:function(e){return Fm(Vm(e))}});var Bm=ve,jm=Pe,Gm=k,Hm=Zr,zm=i.TypeError,Km=function(e){return function(t,r,i,n){Bm(r);var o=jm(t),a=Gm(o),s=Hm(o),c=e?s-1:0,u=e?-1:1;if(i<2)for(;;){if(c in a){n=a[c],c+=u;break}if(c+=u,e?c<0:s<=c)throw zm("Reduce of empty array with no initial value")}for(;e?c>=0:s>c;c+=u)c in a&&(n=r(n,a[c],c,o));return n}},Ym={left:Km(!1),right:Km(!0)},Xm=Ym.left,Wm=ee,Jm=tl;Bi({target:"Array",proto:!0,forced:!Un("reduce")||!Jm&&Wm>79&&Wm<83},{reduce:function(e){var t=arguments.length;return Xm(this,e,t,t>1?arguments[1]:void 0)}});var qm,Zm=Bi,$m=T,Qm=n.f,eS=Jr,tS=qo,rS=Xo,iS=U,nS=$o,oS=$m("".endsWith),aS=$m("".slice),sS=Math.min,cS=nS("endsWith");Zm({target:"String",proto:!0,forced:!!(cS||(qm=Qm(String.prototype,"endsWith"),!qm||qm.writable))&&!cS},{endsWith:function(e){var t=tS(iS(this));rS(e);var r=arguments.length>1?arguments[1]:void 0,i=t.length,n=void 0===r?i:sS(eS(r),i),o=tS(e);return oS?oS(t,o,n):aS(t,n-o.length,n)===o}});var uS=!0,dS=!0;function lS(e,t,r){var i=e.match(t);return i&&i.length>=r&&parseInt(i[r],10)}function hS(e,t,r){if(e.RTCPeerConnection){var i=e.RTCPeerConnection.prototype,n=i.addEventListener;i.addEventListener=function(e,i){if(e!==t)return n.apply(this,arguments);var o=function(e){var t=r(e);t&&(i.handleEvent?i.handleEvent(t):i(t))};return this._eventMap=this._eventMap||{},this._eventMap[t]||(this._eventMap[t]=new Map),this._eventMap[t].set(i,o),n.apply(this,[e,o])};var o=i.removeEventListener;i.removeEventListener=function(e,r){if(e!==t||!this._eventMap||!this._eventMap[t])return o.apply(this,arguments);if(!this._eventMap[t].has(r))return o.apply(this,arguments);var i=this._eventMap[t].get(r);return this._eventMap[t].delete(r),0===this._eventMap[t].size&&delete this._eventMap[t],0===Object.keys(this._eventMap).length&&delete this._eventMap,o.apply(this,[e,i])},Object.defineProperty(i,"on"+t,{get: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 pS(e){return"boolean"!=typeof e?new Error("Argument type: "+us(e)+". Please use a boolean."):(uS=e,e?"adapter.js logging disabled":"adapter.js logging enabled")}function fS(e){return"boolean"!=typeof e?new Error("Argument type: "+us(e)+". Please use a boolean."):(dS=!e,"adapter.js deprecation warnings "+(e?"disabled":"enabled"))}function _S(){if("object"===("undefined"==typeof window?"undefined":us(window))){if(uS)return;"undefined"!=typeof console&&"function"==typeof console.log&&console.log.apply(console,arguments)}}function vS(e,t){dS&&console.warn(e+" is deprecated, please use "+t+" instead.")}function mS(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=lS(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||!1===e.isSecureContext&&e.webkitRTCPeerConnection&&!e.RTCIceGatherer)t.browser="chrome",t.version=lS(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=lS(r.userAgent,/AppleWebKit\/(\d+)\./,1),t.supportsUnifiedPlan=e.RTCRtpTransceiver&&"currentDirection"in e.RTCRtpTransceiver.prototype}return t}function SS(e){return"[object Object]"===Object.prototype.toString.call(e)}function ES(e){return SS(e)?Object.keys(e).reduce((function(t,r){var i=SS(e[r]),n=i?ES(e[r]):e[r],o=i&&!Object.keys(n).length;return void 0===n||o?t:Object.assign(t,ov({},r,n))}),{}):e}function yS(e,t,r){t&&!r.has(t.id)&&(r.set(t.id,t),Object.keys(t).forEach((function(i){i.endsWith("Id")?yS(e,e.get(t[i]),r):i.endsWith("Ids")&&t[i].forEach((function(t){yS(e,e.get(t),r)}))})))}function gS(e,t,r){var i=r?"outbound-rtp":"inbound-rtp",n=new Map;if(null===t)return n;var o=[];return e.forEach((function(e){"track"===e.type&&e.trackIdentifier===t.id&&o.push(e)})),o.forEach((function(t){e.forEach((function(r){r.type===i&&r.trackId===t.id&&yS(e,r,n)}))})),n}var bS=Bi,TS=kn.find,IS=Vo,RS=!0;"find"in[]&&Array(1).find((function(){RS=!1})),bS({target:"Array",proto:!0,forced:RS},{find:function(e){return TS(this,e,arguments.length>1?arguments[1]:void 0)}}),IS("find");var AS=Bi,CS=i,OS=Yr,NS=Gr,wS=Zr,DS=Pe,PS=Rn,kS=Xs,MS=S_("splice"),US=CS.TypeError,LS=Math.max,xS=Math.min;AS({target:"Array",proto:!0,forced:!MS},{splice:function(e,t){var r,i,n,o,a,s,c=DS(this),u=wS(c),d=OS(e,u),l=arguments.length;if(0===l?r=i=0:1===l?(r=0,i=u-d):(r=l-2,i=xS(LS(NS(t),0),u-d)),u+r-i>9007199254740991)throw US("Maximum allowed length exceeded");for(n=PS(c,i),o=0;o<i;o++)(a=d+o)in c&&kS(n,o,c[a]);if(n.length=i,r<i){for(o=d;o<u-i;o++)s=o+r,(a=o+i)in c?c[s]=c[a]:delete c[s];for(o=u;o>u-i+r;o--)delete c[o-1]}else if(r>i)for(o=u-i;o>d;o--)s=o+r-1,(a=o+i-1)in c?c[s]=c[a]:delete c[s];for(o=0;o<r;o++)c[o+d]=arguments[o+2];return c.length=u-i+r,n}});var VS=kn.map;Bi({target:"Array",proto:!0,forced:!S_("map")},{map:function(e){return VS(this,e,arguments.length>1?arguments[1]:void 0)}});var FS=kn.filter;Bi({target:"Array",proto:!0,forced:!S_("filter")},{filter:function(e){return FS(this,e,arguments.length>1?arguments[1]:void 0)}});var BS=T,jS=Pe,GS=Math.floor,HS=BS("".charAt),zS=BS("".replace),KS=BS("".slice),YS=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,XS=/\$([$&'`]|\d{1,2})/g,WS=Gs,JS=d,qS=T,ZS=Xa,$S=o,QS=Dt,eE=F,tE=Gr,rE=Jr,iE=qo,nE=U,oE=sv,aE=Se,sE=function(e,t,r,i,n,o){var a=r+e.length,s=i.length,c=XS;return void 0!==n&&(n=jS(n),c=YS),zS(o,c,(function(o,c){var u;switch(HS(c,0)){case"$":return"$";case"&":return e;case"`":return KS(t,0,r);case"'":return KS(t,a);case"<":u=n[KS(c,1,-1)];break;default:var d=+c;if(0===d)return o;if(d>s){var l=GS(d/10);return 0===l?o:l<=s?void 0===i[l-1]?HS(c,1):i[l-1]+HS(c,1):o}u=i[d-1]}return void 0===u?"":u}))},cE=ts,uE=Ze("replace"),dE=Math.max,lE=Math.min,hE=qS([].concat),pE=qS([].push),fE=qS("".indexOf),_E=qS("".slice),vE="$0"==="a".replace(/./,"$0"),mE=!!/./[uE]&&""===/./[uE]("a","$0");ZS("replace",(function(e,t,r){var i=mE?"$":"$0";return[function(e,r){var i=nE(this),n=null==e?void 0:aE(e,uE);return n?JS(n,e,i,r):JS(t,iE(i),e,r)},function(e,n){var o=QS(this),a=iE(e);if("string"==typeof n&&-1===fE(n,i)&&-1===fE(n,"$<")){var s=r(t,o,a,n);if(s.done)return s.value}var c=eE(n);c||(n=iE(n));var u=o.global;if(u){var d=o.unicode;o.lastIndex=0}for(var l=[];;){var h=cE(o,a);if(null===h)break;if(pE(l,h),!u)break;""===iE(h[0])&&(o.lastIndex=oE(a,rE(o.lastIndex),d))}for(var p,f="",_=0,v=0;v<l.length;v++){for(var m=iE((h=l[v])[0]),S=dE(lE(tE(h.index),a.length),0),E=[],y=1;y<h.length;y++)pE(E,void 0===(p=h[y])?p:String(p));var g=h.groups;if(c){var b=hE([m],E,S,a);void 0!==g&&pE(b,g);var T=iE(WS(n,void 0,b))}else T=sE(m,a,S,E,g,n);S>=_&&(f+=_E(a,_,S)+T,_=S+m.length)}return f+_E(a,_)}]}),!!$S((function(){var e=/./;return e.exec=function(){var e=[];return e.groups={a:"7"},e},"7"!=="".replace(e,"$<a>")}))||!vE||mE);var SE=a,EE=i,yE=T,gE=Pi,bE=um,TE=Gt,IE=Rt.f,RE=Fr.f,AE=Y,CE=zo,OE=qo,NE=aa,wE=la,DE=Ht.exports,PE=o,kE=Ue,ME=br.enforce,UE=qu,LE=fa,xE=ma,VE=Ze("match"),FE=EE.RegExp,BE=FE.prototype,jE=EE.SyntaxError,GE=yE(NE),HE=yE(BE.exec),zE=yE("".charAt),KE=yE("".replace),YE=yE("".indexOf),XE=yE("".slice),WE=/^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/,JE=/a/g,qE=/a/g,ZE=new FE(JE)!==JE,$E=wE.MISSED_STICKY,QE=wE.UNSUPPORTED_Y,ey=SE&&(!ZE||$E||LE||xE||PE((function(){return qE[VE]=!1,FE(JE)!=JE||FE(qE)==qE||"/a/i"!=FE(JE,"i")})));if(gE("RegExp",ey)){for(var ty=function(e,t){var r,i,n,o,a,s,c=AE(BE,this),u=CE(e),d=void 0===t,l=[],h=e;if(!c&&u&&d&&e.constructor===ty)return e;if((u||AE(BE,e))&&(e=e.source,d&&(t="flags"in h?h.flags:GE(h))),e=void 0===e?"":OE(e),t=void 0===t?"":OE(t),h=e,LE&&"dotAll"in JE&&(i=!!t&&YE(t,"s")>-1)&&(t=KE(t,/s/g,"")),r=t,$E&&"sticky"in JE&&(n=!!t&&YE(t,"y")>-1)&&QE&&(t=KE(t,/y/g,"")),xE&&(o=function(e){for(var t,r=e.length,i=0,n="",o=[],a={},s=!1,c=!1,u=0,d="";i<=r;i++){if("\\"===(t=zE(e,i)))t+=zE(e,++i);else if("]"===t)s=!1;else if(!s)switch(!0){case"["===t:s=!0;break;case"("===t:HE(WE,XE(e,i+1))&&(i+=2,c=!0),n+=t,u++;continue;case">"===t&&c:if(""===d||kE(a,d))throw new jE("Invalid capture group name");a[d]=!0,o[o.length]=[d,u],c=!1,d="";continue}c?d+=t:n+=t}return[n,o]}(e),e=o[0],l=o[1]),a=bE(FE(e,t),c?this:BE,ty),(i||n||l.length)&&(s=ME(a),i&&(s.dotAll=!0,s.raw=ty(function(e){for(var t,r=e.length,i=0,n="",o=!1;i<=r;i++)"\\"!==(t=zE(e,i))?o||"."!==t?("["===t?o=!0:"]"===t&&(o=!1),n+=t):n+="[\\s\\S]":n+=t+zE(e,++i);return n}(e),r)),n&&(s.sticky=!0),l.length&&(s.groups=l)),e!==h)try{TE(a,"source",""===h?"(?:)":h)}catch(e){}return a},ry=function(e){e in ty||IE(ty,e,{configurable:!0,get:function(){return FE[e]},set:function(t){FE[e]=t}})},iy=RE(FE),ny=0;iy.length>ny;)ry(iy[ny++]);BE.constructor=ty,ty.prototype=BE,DE(EE,"RegExp",ty)}UE("RegExp");var oy=T,ay=Or.PROPER,sy=Ht.exports,cy=Dt,uy=Y,dy=qo,ly=o,hy=aa,py=RegExp.prototype,fy=py.toString,_y=oy(hy),vy=ly((function(){return"/a/b"!=fy.call({source:"a",flags:"b"})})),my=ay&&"toString"!=fy.name;(vy||my)&&sy(RegExp.prototype,"toString",(function(){var e=cy(this),t=dy(e.source),r=e.flags;return"/"+t+"/"+dy(void 0===r&&uy(py,e)&&!("flags"in py)?_y(e):r)}),{unsafe:!0});var Sy=kn.some;Bi({target:"Array",proto:!0,forced:!Un("some")},{some:function(e){return Sy(this,e,arguments.length>1?arguments[1]:void 0)}});var Ey=a,yy=Or.EXISTS,gy=T,by=Rt.f,Ty=Function.prototype,Iy=gy(Ty.toString),Ry=/function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/,Ay=gy(Ry.exec);Ey&&!yy&&by(Ty,"name",{configurable:!0,get:function(){try{return Ay(Ry,Iy(this))[1]}catch(e){return""}}});var Cy=T,Oy=ve,Ny=j,wy=Ue,Dy=oc,Py=s,ky=i.Function,My=Cy([].concat),Uy=Cy([].join),Ly={},xy=function(e,t,r){if(!wy(Ly,t)){for(var i=[],n=0;n<t;n++)i[n]="a["+n+"]";Ly[t]=ky("C,a","return new C("+Uy(i,",")+")")}return Ly[t](e,r)},Vy=Py?ky.bind:function(e){var t=Oy(this),r=t.prototype,i=Dy(arguments,1),n=function(){var r=My(i,Dy(arguments));return this instanceof n?xy(t,r.length,r):t.apply(e,r)};return Ny(r)&&(n.prototype=r),n},Fy=Vy;Bi({target:"Function",proto:!0,forced:Function.bind!==Fy},{bind:Fy});var By=_S;function jy(e,t){var r=e&&e.navigator;if(r.mediaDevices){var i=function(e){if("object"!==us(e)||e.mandatory||e.optional)return e;var t={};return Object.keys(e).forEach((function(r){if("require"!==r&&"advanced"!==r&&"mediaSource"!==r){var i="object"===us(e[r])?e[r]:{ideal:e[r]};void 0!==i.exact&&"number"==typeof i.exact&&(i.min=i.max=i.exact);var n=function(e,t){return e?e+t.charAt(0).toUpperCase()+t.slice(1):"deviceId"===t?"sourceId":t};if(void 0!==i.ideal){t.optional=t.optional||[];var o={};"number"==typeof i.ideal?(o[n("min",r)]=i.ideal,t.optional.push(o),(o={})[n("max",r)]=i.ideal,t.optional.push(o)):(o[n("",r)]=i.ideal,t.optional.push(o))}void 0!==i.exact&&"number"!=typeof i.exact?(t.mandatory=t.mandatory||{},t.mandatory[n("",r)]=i.exact):["min","max"].forEach((function(e){void 0!==i[e]&&(t.mandatory=t.mandatory||{},t.mandatory[n(e,r)]=i[e])}))}})),e.advanced&&(t.optional=(t.optional||[]).concat(e.advanced)),t},n=function(e,n){if(t.version>=61)return n(e);if((e=JSON.parse(JSON.stringify(e)))&&"object"===us(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(JSON.stringify(e))).audio,"autoGainControl","googAutoGainControl"),o(e.audio,"noiseSuppression","googNoiseSuppression"),e.audio=i(e.audio)}if(e&&"object"===us(e.video)){var a=e.video.facingMode;a=a&&("object"===us(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){var r=(t=t.filter((function(e){return"videoinput"===e.kind}))).find((function(e){return s.some((function(t){return e.label.toLowerCase().includes(t)}))}));return!r&&t.length&&s.includes("back")&&(r=t[t.length-1]),r&&(e.video.deviceId=a.exact?{exact:r.deviceId}:{ideal:r.deviceId}),e.video=i(e.video),By("chrome: "+JSON.stringify(e)),n(e)}));e.video=i(e.video)}return By("chrome: "+JSON.stringify(e)),n(e)},o=function(e){return t.version>=64?e:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[e.name]||e.name,message:e.message,constraint:e.constraint||e.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}};if(r.getUserMedia=function(e,t,i){n(e,(function(e){r.webkitGetUserMedia(e,t,(function(e){i&&i(o(e))}))}))}.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(e){return n(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 Promise.reject(o(e))}))}))}}}}function Gy(e){e.MediaStream=e.MediaStream||e.webkitMediaStream}function Hy(e){if("object"===us(e)&&e.RTCPeerConnection&&!("ontrack"in e.RTCPeerConnection.prototype)){Object.defineProperty(e.RTCPeerConnection.prototype,"ontrack",{get:function(){return this._ontrack},set:function(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});var 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(i){var n;n=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===i.track.id})):{track:i.track};var o=new Event("track");o.track=i.track,o.receiver=n,o.transceiver={receiver:n},o.streams=[t.stream],r.dispatchEvent(o)})),t.stream.getTracks().forEach((function(i){var n;n=e.RTCPeerConnection.prototype.getReceivers?r.getReceivers().find((function(e){return e.track&&e.track.id===i.id})):{track:i};var o=new Event("track");o.track=i,o.receiver=n,o.transceiver={receiver:n},o.streams=[t.stream],r.dispatchEvent(o)}))},this.addEventListener("addstream",this._ontrackpoly)),t.apply(this,arguments)}}else hS(e,"track",(function(e){return e.transceiver||Object.defineProperty(e,"transceiver",{value:{receiver:e.receiver}}),e}))}function zy(e){if("object"===us(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(){return this._senders=this._senders||[],this._senders.slice()};var r=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,i){var n=r.apply(this,arguments);return n||(n=t(this,e),this._senders.push(n)),n};var i=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){i.apply(this,arguments);var t=this._senders.indexOf(e);-1!==t&&this._senders.splice(t,1)}}var n=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var r=this;this._senders=this._senders||[],n.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=t._senders.find((function(t){return t.track===e}));r&&t._senders.splice(t._senders.indexOf(r),1)}))}}else if("object"===us(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},Object.defineProperty(e.RTCRtpSender.prototype,"dtmf",{get:function(){return void 0===this._dtmf&&("audio"===this.track.kind?this._dtmf=this._pc.createDTMFSender(this.track):this._dtmf=null),this._dtmf}})}}function Ky(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=this,r=Array.prototype.slice.call(arguments),i=r[0],n=r[1],o=r[2];if(arguments.length>0&&"function"==typeof i)return t.apply(this,arguments);if(0===t.length&&(0===arguments.length||"function"!=typeof i))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){return new Map(Object.keys(e).map((function(t){return[t,e[t]]})))};if(arguments.length>=2){var c=function(e){n(s(a(e)))};return t.apply(this,[c,i])}return new Promise((function(r,i){t.apply(e,[function(e){r(s(a(e)))},i])})).then(n,o)}}}function Yy(e){if("object"===us(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 gS(t,e.track,!0)}))}}if(!("getStats"in e.RTCRtpReceiver.prototype)){var i=e.RTCPeerConnection.prototype.getReceivers;i&&(e.RTCPeerConnection.prototype.getReceivers=function(){var e=this,t=i.apply(this,[]);return t.forEach((function(t){return t._pc=e})),t}),hS(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 gS(t,e.track,!1)}))}}if("getStats"in e.RTCRtpSender.prototype&&"getStats"in e.RTCRtpReceiver.prototype){var n=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof e.MediaStreamTrack){var t,r,i,o=arguments[0];return this.getSenders().forEach((function(e){e.track===o&&(t?i=!0:t=e)})),this.getReceivers().forEach((function(e){return e.track===o&&(r?i=!0:r=e),e.track===o})),i||t&&r?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):t?t.getStats():r?r.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return n.apply(this,arguments)}}}}function Xy(e){e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map((function(t){return e._shimmedLocalStreams[t][0]}))};var t=e.RTCPeerConnection.prototype.addTrack;e.RTCPeerConnection.prototype.addTrack=function(e,r){if(!r)return t.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};var i=t.apply(this,arguments);return this._shimmedLocalStreams[r.id]?-1===this._shimmedLocalStreams[r.id].indexOf(i)&&this._shimmedLocalStreams[r.id].push(i):this._shimmedLocalStreams[r.id]=[r,i],i};var r=e.RTCPeerConnection.prototype.addStream;e.RTCPeerConnection.prototype.addStream=function(e){var t=this;this._shimmedLocalStreams=this._shimmedLocalStreams||{},e.getTracks().forEach((function(e){if(t.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")}));var i=this.getSenders();r.apply(this,arguments);var n=this.getSenders().filter((function(e){return-1===i.indexOf(e)}));this._shimmedLocalStreams[e.id]=[e].concat(n)};var i=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[e.id],i.apply(this,arguments)};var n=e.RTCPeerConnection.prototype.removeTrack;e.RTCPeerConnection.prototype.removeTrack=function(e){var t=this;return this._shimmedLocalStreams=this._shimmedLocalStreams||{},e&&Object.keys(this._shimmedLocalStreams).forEach((function(r){var i=t._shimmedLocalStreams[r].indexOf(e);-1!==i&&t._shimmedLocalStreams[r].splice(i,1),1===t._shimmedLocalStreams[r].length&&delete t._shimmedLocalStreams[r]})),n.apply(this,arguments)}}function Wy(e,t){if(e.RTCPeerConnection){if(e.RTCPeerConnection.prototype.addTrack&&t.version>=65)return Xy(e);var r=e.RTCPeerConnection.prototype.getLocalStreams;e.RTCPeerConnection.prototype.getLocalStreams=function(){var e=this,t=r.apply(this);return this._reverseStreams=this._reverseStreams||{},t.map((function(t){return e._reverseStreams[t.id]}))};var i=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){if(r.getSenders().find((function(t){return t.track===e})))throw new DOMException("Track already exists.","InvalidAccessError")})),!this._reverseStreams[t.id]){var n=new e.MediaStream(t.getTracks());this._streams[t.id]=n,this._reverseStreams[n.id]=t,t=n}i.apply(this,[t])};var n=e.RTCPeerConnection.prototype.removeStream;e.RTCPeerConnection.prototype.removeStream=function(e){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},n.apply(this,[this._streams[e.id]||e]),delete this._reverseStreams[this._streams[e.id]?this._streams[e.id].id:e.id],delete this._streams[e.id]},e.RTCPeerConnection.prototype.addTrack=function(t,r){var i=this;if("closed"===this.signalingState)throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");var n=[].slice.call(arguments,1);if(1!==n.length||!n[0].getTracks().find((function(e){return e===t})))throw new DOMException("The adapter.js addTrack polyfill only supports a single stream which is associated with the specified track.","NotSupportedError");var o=this.getSenders().find((function(e){return e.track===t}));if(o)throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};var a=this._streams[r.id];if(a)a.addTrack(t),Promise.resolve().then((function(){i.dispatchEvent(new Event("negotiationneeded"))}));else{var s=new e.MediaStream([t]);this._streams[r.id]=s,this._reverseStreams[s.id]=r,this.addStream(s)}return this.getSenders().find((function(e){return e.track===t}))},["createOffer","createAnswer"].forEach((function(t){var r=e.RTCPeerConnection.prototype[t],i=ov({},t,(function(){var e=this,t=arguments,i=arguments.length&&"function"==typeof arguments[0];return i?r.apply(this,[function(r){var i=s(e,r);t[0].apply(null,[i])},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]=i[t]}));var o=e.RTCPeerConnection.prototype.setLocalDescription;e.RTCPeerConnection.prototype.setLocalDescription=function(){return arguments.length&&arguments[0].type?(arguments[0]=c(this,arguments[0]),o.apply(this,arguments)):o.apply(this,arguments)};var a=Object.getOwnPropertyDescriptor(e.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(e.RTCPeerConnection.prototype,"localDescription",{get:function(){var e=a.get.apply(this);return""===e.type?e:s(this,e)}}),e.RTCPeerConnection.prototype.removeTrack=function(e){var t,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||{},Object.keys(this._streams).forEach((function(i){r._streams[i].getTracks().find((function(t){return e.track===t}))&&(t=r._streams[i])})),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 Object.keys(e._reverseStreams||[]).forEach((function(t){var i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(n.id,"g"),i.id)})),new RTCSessionDescription({type:t.type,sdp:r})}function c(e,t){var r=t.sdp;return Object.keys(e._reverseStreams||[]).forEach((function(t){var i=e._reverseStreams[t],n=e._streams[i.id];r=r.replace(new RegExp(i.id,"g"),n.id)})),new RTCSessionDescription({type:t.type,sdp:r})}}function Jy(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],i=ov({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=i[t]}))}function qy(e,t){hS(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 Zy=Object.freeze({__proto__:null,shimMediaStream:Gy,shimOnTrack:Hy,shimGetSendersWithDtmf:zy,shimGetStats:Ky,shimSenderReceiverGetStats:Yy,shimAddTrackRemoveTrackWithNative:Xy,shimAddTrackRemoveTrack:Wy,shimPeerConnection:Jy,fixNegotiationNeeded:qy,shimGetUserMedia:jy,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 i=r.video&&r.video.width,n=r.video&&r.video.height,o=r.video&&r.video.frameRate;return r.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:t,maxFrameRate:o||3}},i&&(r.video.mandatory.maxWidth=i),n&&(r.video.mandatory.maxHeight=n),e.navigator.mediaDevices.getUserMedia(r)}))}:console.error("shimGetDisplayMedia: getSourceId argument is not a function"))}}),$y=i,Qy=o,eg=qo,tg=Iv.trim,rg=T("".charAt),ig=$y.parseFloat,ng=$y.Symbol,og=ng&&ng.iterator,ag=1/ig("\t\n\v\f\r                 \u2028\u2029\ufeff-0")!=-1/0||og&&!Qy((function(){ig(Object(og))}))?function(e){var t=tg(eg(e)),r=ig(t);return 0===r&&"-"==rg(t,0)?-0:r}:ig;Bi({global:!0,forced:parseFloat!=ag},{parseFloat:ag});var sg=Bi,cg=Hu,ug=o,dg=K,lg=F,hg=Zd,pg=ah,fg=Ht.exports;if(sg({target:"Promise",proto:!0,real:!0,forced:!!cg&&ug((function(){cg.prototype.finally.call({then:function(){}},(function(){}))}))},{finally:function(e){var t=hg(this,dg("Promise")),r=lg(e);return this.then(r?function(r){return pg(t,e()).then((function(){return r}))}:e,r?function(r){return pg(t,e()).then((function(){throw r}))}:e)}}),lg(cg)){var _g=dg("Promise").prototype.finally;cg.prototype.finally!==_g&&fg(cg.prototype,"finally",_g,{unsafe:!0})}function vg(e,t){var r=e&&e.navigator,i=e&&e.MediaStreamTrack;if(r.getUserMedia=function(e,t,i){vS("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(e).then(t,i)},!(t.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var n=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"===us(e)&&"object"===us(e.audio)&&(e=JSON.parse(JSON.stringify(e)),n(e.audio,"autoGainControl","mozAutoGainControl"),n(e.audio,"noiseSuppression","mozNoiseSuppression")),o(e)},i&&i.prototype.getSettings){var a=i.prototype.getSettings;i.prototype.getSettings=function(){var e=a.apply(this,arguments);return n(e,"mozAutoGainControl","autoGainControl"),n(e,"mozNoiseSuppression","noiseSuppression"),e}}if(i&&i.prototype.applyConstraints){var s=i.prototype.applyConstraints;i.prototype.applyConstraints=function(e){return"audio"===this.kind&&"object"===us(e)&&(e=JSON.parse(JSON.stringify(e)),n(e,"autoGainControl","mozAutoGainControl"),n(e,"noiseSuppression","mozNoiseSuppression")),s.apply(this,[e])}}}}function mg(e){"object"===us(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Sg(e,t){if("object"===us(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],i=ov({},t,(function(){return arguments[0]=new("addIceCandidate"===t?e.RTCIceCandidate:e.RTCSessionDescription)(arguments[0]),r.apply(this,arguments)}));e.RTCPeerConnection.prototype[t]=i[t]}));var r={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=e.RTCPeerConnection.prototype.getStats;e.RTCPeerConnection.prototype.getStats=function(){var e=Array.prototype.slice.call(arguments),n=e[0],o=e[1],a=e[2];return i.apply(this,[n||null]).then((function(e){if(t.version<53&&!o)try{e.forEach((function(e){e.type=r[e.type]||e.type}))}catch(t){if("TypeError"!==t.name)throw t;e.forEach((function(t,i){e.set(i,Object.assign({},t,{type:r[t.type]||t.type}))}))}return e})).then(o,a)}}}function Eg(e){if("object"===us(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):Promise.resolve(new Map)}}}function yg(e){if("object"===us(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}),hS(e,"track",(function(e){return e.receiver._pc=e.srcElement,e})),e.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}}function gg(e){e.RTCPeerConnection&&!("removeStream"in e.RTCPeerConnection.prototype)&&(e.RTCPeerConnection.prototype.removeStream=function(e){var t=this;vS("removeStream","removeTrack"),this.getSenders().forEach((function(r){r.track&&e.getTracks().includes(r.track)&&t.removeTrack(r)}))})}function bg(e){e.DataChannel&&!e.RTCDataChannel&&(e.RTCDataChannel=e.DataChannel)}function Tg(e){if("object"===us(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype.addTransceiver;t&&(e.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];var e=arguments[1],r=e&&"sendEncodings"in e;r&&e.sendEncodings.forEach((function(e){if("rid"in e){if(!/^[a-z0-9]{0,16}$/i.test(e.rid))throw new TypeError("Invalid RID value provided.")}if("scaleResolutionDownBy"in e&&!(parseFloat(e.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in e&&!(parseFloat(e.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")}));var i=t.apply(this,arguments);if(r){var n=i.sender,o=n.getParameters();(!("encodings"in o)||1===o.encodings.length&&0===Object.keys(o.encodings[0]).length)&&(o.encodings=e.sendEncodings,n.sendEncodings=e.sendEncodings,this.setParametersPromises.push(n.setParameters(o).then((function(){delete n.sendEncodings})).catch((function(){delete n.sendEncodings}))))}return i})}}function Ig(e){if("object"===us(e)&&e.RTCRtpSender){var t=e.RTCRtpSender.prototype.getParameters;t&&(e.RTCRtpSender.prototype.getParameters=function(){var e=t.apply(this,arguments);return"encodings"in e||(e.encodings=[].concat(this.sendEncodings||[{}])),e})}}function Rg(e){if("object"===us(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?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}function Ag(e){if("object"===us(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?Promise.all(this.setParametersPromises).then((function(){return t.apply(r,e)})).finally((function(){r.setParametersPromises=[]})):t.apply(this,arguments)}}}var Cg=Object.freeze({__proto__:null,shimOnTrack:mg,shimPeerConnection:Sg,shimSenderGetStats:Eg,shimReceiverGetStats:yg,shimRemoveStream:gg,shimRTCDataChannel:bg,shimAddTransceiver:Tg,shimGetParameters:Ig,shimCreateOffer:Rg,shimCreateAnswer:Ag,shimGetUserMedia:vg,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 i=new DOMException("getDisplayMedia without video constraints is undefined");return i.name="NotFoundError",i.code=8,Promise.reject(i)}return!0===r.video?r.video={mediaSource:t}:r.video.mediaSource=t,e.navigator.mediaDevices.getUserMedia(r)})}});function Og(e){if("object"===us(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=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(e)||this._localStreams.push(e),e.getAudioTracks().forEach((function(i){return t.call(r,i,e)})),e.getVideoTracks().forEach((function(i){return t.call(r,i,e)}))},e.RTCPeerConnection.prototype.addTrack=function(e){for(var r=this,i=arguments.length,n=new Array(i>1?i-1:0),o=1;o<i;o++)n[o-1]=arguments[o];return n&&n.forEach((function(e){r._localStreams?r._localStreams.includes(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=this;this._localStreams||(this._localStreams=[]);var r=this._localStreams.indexOf(e);if(-1!==r){this._localStreams.splice(r,1);var i=e.getTracks();this.getSenders().forEach((function(e){i.includes(e.track)&&t.removeTrack(e)}))}})}}function Ng(e){if("object"===us(e)&&e.RTCPeerConnection&&("getRemoteStreams"in e.RTCPeerConnection.prototype||(e.RTCPeerConnection.prototype.getRemoteStreams=function(){return this._remoteStreams?this._remoteStreams:[]}),!("onaddstream"in e.RTCPeerConnection.prototype))){Object.defineProperty(e.RTCPeerConnection.prototype,"onaddstream",{get:function(){return this._onaddstream},set:function(e){var t=this;this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=function(e){e.streams.forEach((function(e){if(t._remoteStreams||(t._remoteStreams=[]),!t._remoteStreams.includes(e)){t._remoteStreams.push(e);var r=new Event("addstream");r.stream=e,t.dispatchEvent(r)}}))})}});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){if(e._remoteStreams||(e._remoteStreams=[]),!(e._remoteStreams.indexOf(t)>=0)){e._remoteStreams.push(t);var r=new Event("addstream");r.stream=t,e.dispatchEvent(r)}}))}),t.apply(e,arguments)}}}function wg(e){if("object"===us(e)&&e.RTCPeerConnection){var t=e.RTCPeerConnection.prototype,r=t.createOffer,i=t.createAnswer,n=t.setLocalDescription,o=t.setRemoteDescription,a=t.addIceCandidate;t.createOffer=function(e,t){var i=arguments.length>=2?arguments[2]:arguments[0],n=r.apply(this,[i]);return t?(n.then(e,t),Promise.resolve()):n},t.createAnswer=function(e,t){var r=arguments.length>=2?arguments[2]:arguments[0],n=i.apply(this,[r]);return t?(n.then(e,t),Promise.resolve()):n};var s=function(e,t,r){var i=n.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i};t.setLocalDescription=s,s=function(e,t,r){var i=o.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.setRemoteDescription=s,s=function(e,t,r){var i=a.apply(this,[e]);return r?(i.then(t,r),Promise.resolve()):i},t.addIceCandidate=s}}function Dg(e){var t=e&&e.navigator;if(t.mediaDevices&&t.mediaDevices.getUserMedia){var r=t.mediaDevices,i=r.getUserMedia.bind(r);t.mediaDevices.getUserMedia=function(e){return i(Pg(e))}}!t.getUserMedia&&t.mediaDevices&&t.mediaDevices.getUserMedia&&(t.getUserMedia=function(e,r,i){t.mediaDevices.getUserMedia(e).then(r,i)}.bind(t))}function Pg(e){return e&&void 0!==e.video?Object.assign({},e,{video:ES(e.video)}):e}function kg(e){if(e.RTCPeerConnection){var t=e.RTCPeerConnection;e.RTCPeerConnection=function(e,r){if(e&&e.iceServers){for(var i=[],n=0;n<e.iceServers.length;n++){var o=e.iceServers[n];!o.hasOwnProperty("urls")&&o.hasOwnProperty("url")?(vS("RTCIceServer.url","RTCIceServer.urls"),(o=JSON.parse(JSON.stringify(o))).urls=o.url,delete o.url,i.push(o)):i.push(e.iceServers[n])}e.iceServers=i}return new t(e,r)},e.RTCPeerConnection.prototype=t.prototype,"generateCertificate"in t&&Object.defineProperty(e.RTCPeerConnection,"generateCertificate",{get:function(){return t.generateCertificate}})}}function Mg(e){"object"===us(e)&&e.RTCTrackEvent&&"receiver"in e.RTCTrackEvent.prototype&&!("transceiver"in e.RTCTrackEvent.prototype)&&Object.defineProperty(e.RTCTrackEvent.prototype,"transceiver",{get:function(){return{receiver:this.receiver}}})}function Ug(e){var t=e.RTCPeerConnection.prototype.createOffer;e.RTCPeerConnection.prototype.createOffer=function(e){if(e){void 0!==e.offerToReceiveAudio&&(e.offerToReceiveAudio=!!e.offerToReceiveAudio);var r=this.getTransceivers().find((function(e){return"audio"===e.receiver.track.kind}));!1===e.offerToReceiveAudio&&r?"sendrecv"===r.direction?r.setDirection?r.setDirection("sendonly"):r.direction="sendonly":"recvonly"===r.direction&&(r.setDirection?r.setDirection("inactive"):r.direction="inactive"):!0!==e.offerToReceiveAudio||r||this.addTransceiver("audio",{direction:"recvonly"}),void 0!==e.offerToReceiveVideo&&(e.offerToReceiveVideo=!!e.offerToReceiveVideo);var i=this.getTransceivers().find((function(e){return"video"===e.receiver.track.kind}));!1===e.offerToReceiveVideo&&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.offerToReceiveVideo||i||this.addTransceiver("video",{direction:"recvonly"})}return t.apply(this,arguments)}}function Lg(e){"object"!==us(e)||e.AudioContext||(e.AudioContext=e.webkitAudioContext)}var xg=Object.freeze({__proto__:null,shimLocalStreamsAPI:Og,shimRemoteStreamsAPI:Ng,shimCallbacksAPI:wg,shimGetUserMedia:Dg,shimConstraints:Pg,shimRTCIceServerUrls:kg,shimTrackEventTransceiver:Mg,shimCreateOfferLegacy:Ug,shimAudioContext:Lg}),Vg=Pe,Fg=at;Bi({target:"Date",proto:!0,forced:o((function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}))},{toJSON:function(e){var t=Vg(this),r=Fg(t,"number");return"number"!=typeof r||isFinite(r)?t.toISOString():null}});var Bg=d;Bi({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return Bg(URL.prototype.toString,this)}});var jg=T(1..valueOf),Gg=a,Hg=i,zg=T,Kg=Pi,Yg=Ht.exports,Xg=Ue,Wg=um,Jg=Y,qg=de,Zg=at,$g=o,Qg=Fr.f,eb=n.f,tb=Rt.f,rb=jg,ib=Iv.trim,nb=Hg.Number,ob=nb.prototype,ab=Hg.TypeError,sb=zg("".slice),cb=zg("".charCodeAt),ub=function(e){var t=Zg(e,"number");return"bigint"==typeof t?t:db(t)},db=function(e){var t,r,i,n,o,a,s,c,u=Zg(e,"number");if(qg(u))throw ab("Cannot convert a Symbol value to a number");if("string"==typeof u&&u.length>2)if(u=ib(u),43===(t=cb(u,0))||45===t){if(88===(r=cb(u,2))||120===r)return NaN}else if(48===t){switch(cb(u,1)){case 66:case 98:i=2,n=49;break;case 79:case 111:i=8,n=55;break;default:return+u}for(a=(o=sb(u,2)).length,s=0;s<a;s++)if((c=cb(o,s))<48||c>n)return NaN;return parseInt(o,i)}return+u};if(Kg("Number",!nb(" 0o1")||!nb("0b1")||nb("+0x1"))){for(var lb,hb=function(e){var t=arguments.length<1?0:nb(ub(e)),r=this;return Jg(ob,r)&&$g((function(){rb(r)}))?Wg(Object(t),r,hb):t},pb=Gg?Qg(nb):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,fromString,range".split(","),fb=0;pb.length>fb;fb++)Xg(nb,lb=pb[fb])&&!Xg(hb,lb)&&tb(hb,lb,eb(nb,lb));hb.prototype=ob,ob.constructor=hb,Yg(Hg,"Number",hb)}var _b=Bi,vb=k,mb=V,Sb=Un,Eb=T([].join),yb=vb!=Object,gb=Sb("join",",");_b({target:"Array",proto:!0,forced:yb||!gb},{join:function(e){return Eb(mb(this),void 0===e?",":e)}});var bb=Gs,Tb=d,Ib=T,Rb=Xa,Ab=zo,Cb=Dt,Ob=U,Nb=Zd,wb=sv,Db=Jr,Pb=qo,kb=Se,Mb=Qs,Ub=ts,Lb=Va,xb=o,Vb=la.UNSUPPORTED_Y,Fb=Math.min,Bb=[].push,jb=Ib(/./.exec),Gb=Ib(Bb),Hb=Ib("".slice);Rb("split",(function(e,t,r){var i;return i="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(e,r){var i=Pb(Ob(this)),n=void 0===r?4294967295:r>>>0;if(0===n)return[];if(void 0===e)return[i];if(!Ab(e))return Tb(t,i,e,n);for(var o,a,s,c=[],u=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.unicode?"u":"")+(e.sticky?"y":""),d=0,l=new RegExp(e.source,u+"g");(o=Tb(Lb,l,i))&&!((a=l.lastIndex)>d&&(Gb(c,Hb(i,d,o.index)),o.length>1&&o.index<i.length&&bb(Bb,c,Mb(o,1)),s=o[0].length,d=a,c.length>=n));)l.lastIndex===o.index&&l.lastIndex++;return d===i.length?!s&&jb(l,"")||Gb(c,""):Gb(c,Hb(i,d)),c.length>n?Mb(c,0,n):c}:"0".split(void 0,0).length?function(e,r){return void 0===e&&0===r?[]:Tb(t,this,e,r)}:t,[function(t,r){var n=Ob(this),o=null==t?void 0:kb(t,e);return o?Tb(o,t,n,r):Tb(i,Pb(n),t,r)},function(e,n){var o=Cb(this),a=Pb(e),s=r(i,o,a,n,i!==t);if(s.done)return s.value;var c=Nb(o,RegExp),u=o.unicode,d=(o.ignoreCase?"i":"")+(o.multiline?"m":"")+(o.unicode?"u":"")+(Vb?"g":"y"),l=new c(Vb?"^(?:"+o.source+")":o,d),h=void 0===n?4294967295:n>>>0;if(0===h)return[];if(0===a.length)return null===Ub(l,a)?[a]:[];for(var p=0,f=0,_=[];f<a.length;){l.lastIndex=Vb?0:f;var v,m=Ub(l,Vb?Hb(a,f):a);if(null===m||(v=Fb(Db(l.lastIndex+(Vb?f:0)),a.length))===p)f=wb(a,f,u);else{if(Gb(_,Hb(a,p,f)),_.length===h)return _;for(var S=1;S<=m.length-1;S++)if(Gb(_,m[S]),_.length===h)return _;f=p=v}}return Gb(_,Hb(a,p)),_}]}),!!xb((function(){var e=/(?:)/,t=e.exec;e.exec=function(){return t.apply(this,arguments)};var r="ab".split(e);return 2!==r.length||"a"!==r[0]||"b"!==r[1]})),Vb);var zb=Or.PROPER,Kb=o,Yb=vv,Xb=Iv.trim;Bi({target:"String",proto:!0,forced:function(e){return Kb((function(){return!!Yb[e]()||"​…᠎"!=="​…᠎"[e]()||zb&&Yb[e].name!==e}))}("trim")},{trim:function(){return Xb(this)}});var Wb={exports:{}};!function(e){var t={generateIdentifier:function(){return Math.random().toString(36).substr(2,10)}};t.localCName=t.generateIdentifier(),t.splitLines=function(e){return e.trim().split("\n").map((function(e){return e.trim()}))},t.splitSections=function(e){return e.split("\nm=").map((function(e,t){return(t>0?"m="+e:e).trim()+"\r\n"}))},t.getDescription=function(e){var r=t.splitSections(e);return r&&r[0]},t.getMediaSections=function(e){var r=t.splitSections(e);return r.shift(),r},t.matchPrefix=function(e,r){return t.splitLines(e).filter((function(e){return 0===e.indexOf(r)}))},t.parseCandidate=function(e){for(var t,r={foundation:(t=0===e.indexOf("a=candidate:")?e.substring(12).split(" "):e.substring(10).split(" "))[0],component:{1:"rtp",2:"rtcp"}[t[1]]||t[1],protocol:t[2].toLowerCase(),priority:parseInt(t[3],10),ip:t[4],address:t[4],port:parseInt(t[5],10),type:t[7]},i=8;i<t.length;i+=2)switch(t[i]){case"raddr":r.relatedAddress=t[i+1];break;case"rport":r.relatedPort=parseInt(t[i+1],10);break;case"tcptype":r.tcpType=t[i+1];break;case"ufrag":r.ufrag=t[i+1],r.usernameFragment=t[i+1];break;default:void 0===r[t[i]]&&(r[t[i]]=t[i+1])}return r},t.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 i=e.type;return t.push("typ"),t.push(i),"host"!==i&&e.relatedAddress&&e.relatedPort&&(t.push("raddr"),t.push(e.relatedAddress),t.push("rport"),t.push(e.relatedPort)),e.tcpType&&"tcp"===e.protocol.toLowerCase()&&(t.push("tcptype"),t.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(t.push("ufrag"),t.push(e.usernameFragment||e.ufrag)),"candidate:"+t.join(" ")},t.parseIceOptions=function(e){return e.substr(14).split(" ")},t.parseRtpMap=function(e){var t=e.substr(9).split(" "),r={payloadType:parseInt(t.shift(),10)};return t=t[0].split("/"),r.name=t[0],r.clockRate=parseInt(t[1],10),r.channels=3===t.length?parseInt(t[2],10):1,r.numChannels=r.channels,r},t.writeRtpMap=function(e){var t=e.payloadType;void 0!==e.preferredPayloadType&&(t=e.preferredPayloadType);var r=e.channels||e.numChannels||1;return"a=rtpmap:"+t+" "+e.name+"/"+e.clockRate+(1!==r?"/"+r:"")+"\r\n"},t.parseExtmap=function(e){var t=e.substr(9).split(" ");return{id:parseInt(t[0],10),direction:t[0].indexOf("/")>0?t[0].split("/")[1]:"sendrecv",uri:t[1]}},t.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&"sendrecv"!==e.direction?"/"+e.direction:"")+" "+e.uri+"\r\n"},t.parseFmtp=function(e){for(var t,r={},i=e.substr(e.indexOf(" ")+1).split(";"),n=0;n<i.length;n++)r[(t=i[n].trim().split("="))[0].trim()]=t[1];return r},t.writeFmtp=function(e){var t="",r=e.payloadType;if(void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){var i=[];Object.keys(e.parameters).forEach((function(t){void 0!==e.parameters[t]?i.push(t+"="+e.parameters[t]):i.push(t)})),t+="a=fmtp:"+r+" "+i.join(";")+"\r\n"}return t},t.parseRtcpFb=function(e){var t=e.substr(e.indexOf(" ")+1).split(" ");return{type:t.shift(),parameter:t.join(" ")}},t.writeRtcpFb=function(e){var t="",r=e.payloadType;return void 0!==e.preferredPayloadType&&(r=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach((function(e){t+="a=rtcp-fb:"+r+" "+e.type+(e.parameter&&e.parameter.length?" "+e.parameter:"")+"\r\n"})),t},t.parseSsrcMedia=function(e){var t=e.indexOf(" "),r={ssrc:parseInt(e.substr(7,t-7),10)},i=e.indexOf(":",t);return i>-1?(r.attribute=e.substr(t+1,i-t-1),r.value=e.substr(i+1)):r.attribute=e.substr(t+1),r},t.parseSsrcGroup=function(e){var t=e.substr(13).split(" ");return{semantics:t.shift(),ssrcs:t.map((function(e){return parseInt(e,10)}))}},t.getMid=function(e){var r=t.matchPrefix(e,"a=mid:")[0];if(r)return r.substr(6)},t.parseFingerprint=function(e){var t=e.substr(14).split(" ");return{algorithm:t[0].toLowerCase(),value:t[1].toUpperCase()}},t.getDtlsParameters=function(e,r){return{role:"auto",fingerprints:t.matchPrefix(e+r,"a=fingerprint:").map(t.parseFingerprint)}},t.writeDtlsParameters=function(e,t){var r="a=setup:"+t+"\r\n";return e.fingerprints.forEach((function(e){r+="a=fingerprint:"+e.algorithm+" "+e.value+"\r\n"})),r},t.parseCryptoLine=function(e){var t=e.substr(9).split(" ");return{tag:parseInt(t[0],10),cryptoSuite:t[1],keyParams:t[2],sessionParams:t.slice(3)}},t.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+("object"===us(e.keyParams)?t.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+"\r\n"},t.parseCryptoKeyParams=function(e){if(0!==e.indexOf("inline:"))return null;var t=e.substr(7).split("|");return{keyMethod:"inline",keySalt:t[0],lifeTime:t[1],mkiValue:t[2]?t[2].split(":")[0]:void 0,mkiLength:t[2]?t[2].split(":")[1]:void 0}},t.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},t.getCryptoParameters=function(e,r){return t.matchPrefix(e+r,"a=crypto:").map(t.parseCryptoLine)},t.getIceParameters=function(e,r){var i=t.matchPrefix(e+r,"a=ice-ufrag:")[0],n=t.matchPrefix(e+r,"a=ice-pwd:")[0];return i&&n?{usernameFragment:i.substr(12),password:n.substr(10)}:null},t.writeIceParameters=function(e){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},t.parseRtpParameters=function(e){for(var r={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},i=t.splitLines(e)[0].split(" "),n=3;n<i.length;n++){var o=i[n],a=t.matchPrefix(e,"a=rtpmap:"+o+" ")[0];if(a){var s=t.parseRtpMap(a),c=t.matchPrefix(e,"a=fmtp:"+o+" ");switch(s.parameters=c.length?t.parseFmtp(c[0]):{},s.rtcpFeedback=t.matchPrefix(e,"a=rtcp-fb:"+o+" ").map(t.parseRtcpFb),r.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":r.fecMechanisms.push(s.name.toUpperCase())}}}return t.matchPrefix(e,"a=extmap:").forEach((function(e){r.headerExtensions.push(t.parseExtmap(e))})),r},t.writeRtpDescription=function(e,r){var i="";i+="m="+e+" ",i+=r.codecs.length>0?"9":"0",i+=" UDP/TLS/RTP/SAVPF ",i+=r.codecs.map((function(e){return void 0!==e.preferredPayloadType?e.preferredPayloadType:e.payloadType})).join(" ")+"\r\n",i+="c=IN IP4 0.0.0.0\r\n",i+="a=rtcp:9 IN IP4 0.0.0.0\r\n",r.codecs.forEach((function(e){i+=t.writeRtpMap(e),i+=t.writeFmtp(e),i+=t.writeRtcpFb(e)}));var n=0;return r.codecs.forEach((function(e){e.maxptime>n&&(n=e.maxptime)})),n>0&&(i+="a=maxptime:"+n+"\r\n"),r.headerExtensions&&r.headerExtensions.forEach((function(e){i+=t.writeExtmap(e)})),i},t.parseRtpEncodingParameters=function(e){var r,i=[],n=t.parseRtpParameters(e),o=-1!==n.fecMechanisms.indexOf("RED"),a=-1!==n.fecMechanisms.indexOf("ULPFEC"),s=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute})),c=s.length>0&&s[0].ssrc,u=t.matchPrefix(e,"a=ssrc-group:FID").map((function(e){return e.substr(17).split(" ").map((function(e){return parseInt(e,10)}))}));u.length>0&&u[0].length>1&&u[0][0]===c&&(r=u[0][1]),n.codecs.forEach((function(e){if("RTX"===e.name.toUpperCase()&&e.parameters.apt){var t={ssrc:c,codecPayloadType:parseInt(e.parameters.apt,10)};c&&r&&(t.rtx={ssrc:r}),i.push(t),o&&((t=JSON.parse(JSON.stringify(t))).fec={ssrc:c,mechanism:a?"red+ulpfec":"red"},i.push(t))}})),0===i.length&&c&&i.push({ssrc:c});var d=t.matchPrefix(e,"b=");return d.length&&(d=0===d[0].indexOf("b=TIAS:")?parseInt(d[0].substr(7),10):0===d[0].indexOf("b=AS:")?1e3*parseInt(d[0].substr(5),10)*.95-16e3:void 0,i.forEach((function(e){e.maxBitrate=d}))),i},t.parseRtcpParameters=function(e){var r={},i=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"cname"===e.attribute}))[0];i&&(r.cname=i.value,r.ssrc=i.ssrc);var n=t.matchPrefix(e,"a=rtcp-rsize");r.reducedSize=n.length>0,r.compound=0===n.length;var o=t.matchPrefix(e,"a=rtcp-mux");return r.mux=o.length>0,r},t.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},t.parseMsid=function(e){var r,i=t.matchPrefix(e,"a=msid:");if(1===i.length)return{stream:(r=i[0].substr(7).split(" "))[0],track:r[1]};var n=t.matchPrefix(e,"a=ssrc:").map((function(e){return t.parseSsrcMedia(e)})).filter((function(e){return"msid"===e.attribute}));return n.length>0?{stream:(r=n[0].value.split(" "))[0],track:r[1]}:void 0},t.parseSctpDescription=function(e){var r,i=t.parseMLine(e),n=t.matchPrefix(e,"a=max-message-size:");n.length>0&&(r=parseInt(n[0].substr(19),10)),isNaN(r)&&(r=65536);var o=t.matchPrefix(e,"a=sctp-port:");if(o.length>0)return{port:parseInt(o[0].substr(12),10),protocol:i.fmt,maxMessageSize:r};var a=t.matchPrefix(e,"a=sctpmap:");if(a.length>0){var s=a[0].substr(10).split(" ");return{port:parseInt(s[0],10),protocol:s[1],maxMessageSize:r}}},t.writeSctpDescription=function(e,t){var r=[];return r="DTLS/SCTP"!==e.protocol?["m="+e.kind+" 9 "+e.protocol+" "+t.protocol+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctp-port:"+t.port+"\r\n"]:["m="+e.kind+" 9 "+e.protocol+" "+t.port+"\r\n","c=IN IP4 0.0.0.0\r\n","a=sctpmap:"+t.port+" "+t.protocol+" 65535\r\n"],void 0!==t.maxMessageSize&&r.push("a=max-message-size:"+t.maxMessageSize+"\r\n"),r.join("")},t.generateSessionId=function(){return Math.random().toString().substr(2,21)},t.writeSessionBoilerplate=function(e,r,i){var n=void 0!==r?r:2;return"v=0\r\no="+(i||"thisisadapterortc")+" "+(e||t.generateSessionId())+" "+n+" IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\n"},t.getDirection=function(e,r){for(var i=t.splitLines(e),n=0;n<i.length;n++)switch(i[n]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return i[n].substr(2)}return r?t.getDirection(r):"sendrecv"},t.getKind=function(e){return t.splitLines(e)[0].split(" ")[0].substr(2)},t.isRejected=function(e){return"0"===e.split(" ",2)[1]},t.parseMLine=function(e){var r=t.splitLines(e)[0].substr(2).split(" ");return{kind:r[0],port:parseInt(r[1],10),protocol:r[2],fmt:r.slice(3).join(" ")}},t.parseOLine=function(e){var r=t.matchPrefix(e,"o=")[0].substr(2).split(" ");return{username:r[0],sessionId:r[1],sessionVersion:parseInt(r[2],10),netType:r[3],addressType:r[4],address:r[5]}},t.isValidSDP=function(e){if("string"!=typeof e||0===e.length)return!1;for(var r=t.splitLines(e),i=0;i<r.length;i++)if(r[i].length<2||"="!==r[i].charAt(1))return!1;return!0},e.exports=t}(Wb);var Jb=Wb.exports,qb=Object.freeze(e({__proto__:null,default:Jb},[Wb.exports]));function Zb(e){if(!(!e.RTCIceCandidate||e.RTCIceCandidate&&"foundation"in e.RTCIceCandidate.prototype)){var t=e.RTCIceCandidate;e.RTCIceCandidate=function(e){if("object"===us(e)&&e.candidate&&0===e.candidate.indexOf("a=")&&((e=JSON.parse(JSON.stringify(e))).candidate=e.candidate.substr(2)),e.candidate&&e.candidate.length){var r=new t(e),i=Jb.parseCandidate(e.candidate),n=Object.assign(r,i);return n.toJSON=function(){return{candidate:n.candidate,sdpMid:n.sdpMid,sdpMLineIndex:n.sdpMLineIndex,usernameFragment:n.usernameFragment}},n}return new t(e)},e.RTCIceCandidate.prototype=t.prototype,hS(e,"icecandidate",(function(t){return t.candidate&&Object.defineProperty(t,"candidate",{value:new e.RTCIceCandidate(t.candidate),writable:"false"}),t}))}}function $b(e,t){if(e.RTCPeerConnection){"sctp"in e.RTCPeerConnection.prototype||Object.defineProperty(e.RTCPeerConnection.prototype,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp}});var r=function(e){if(!e||!e.sdp)return!1;var t=Jb.splitSections(e.sdp);return t.shift(),t.some((function(e){var t=Jb.parseMLine(e);return t&&"application"===t.kind&&-1!==t.protocol.indexOf("SCTP")}))},i=function(e){var t=e.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(null===t||t.length<2)return-1;var r=parseInt(t[1],10);return r!=r?-1:r},n=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 i=65536;"firefox"===t.browser&&57===t.version&&(i=65535);var n=Jb.matchPrefix(e.sdp,"a=max-message-size:");return n.length>0?i=parseInt(n[0].substr(19),10):"firefox"===t.browser&&-1!==r&&(i=2147483637),i},a=e.RTCPeerConnection.prototype.setRemoteDescription;e.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,"chrome"===t.browser&&t.version>=76){var e=this.getConfiguration(),s=e.sdpSemantics;"plan-b"===s&&Object.defineProperty(this,"sctp",{get:function(){return void 0===this._sctp?null:this._sctp},enumerable:!0,configurable:!0})}if(r(arguments[0])){var c,u=i(arguments[0]),d=n(u),l=o(arguments[0],u);c=0===d&&0===l?Number.POSITIVE_INFINITY:0===d||0===l?Math.max(d,l):Math.min(d,l);var h={};Object.defineProperty(h,"maxMessageSize",{get:function(){return c}}),this._sctp=h}return a.apply(this,arguments)}}}function Qb(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},hS(e,"datachannel",(function(e){return r(e.channel,e.target),e}))}function r(e,t){var r=e.send;e.send=function(){var i=arguments[0],n=i.length||i.size||i.byteLength;if("open"===e.readyState&&t.sctp&&n>t.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+t.sctp.maxMessageSize+" bytes)");return r.apply(e,arguments)}}}function eT(e){if(e.RTCPeerConnection&&!("connectionState"in e.RTCPeerConnection.prototype)){var t=e.RTCPeerConnection.prototype;Object.defineProperty(t,"connectionState",{get:function(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(t,"onconnectionstatechange",{get:function(){return this._onconnectionstatechange||null},set:function(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach((function(e){var 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 tT(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){if(t&&t.sdp&&-1!==t.sdp.indexOf("\na=extmap-allow-mixed")){var i=t.sdp.split("\n").filter((function(e){return"a=extmap-allow-mixed"!==e.trim()})).join("\n");e.RTCSessionDescription&&t instanceof e.RTCSessionDescription?arguments[0]=new e.RTCSessionDescription({type:t.type,sdp:i}):t.sdp=i}return r.apply(this,arguments)}}}function rT(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?Promise.resolve():r.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}}function iT(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"!==us(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 i="offer"===t.type?this.createOffer:this.createAnswer;return i.apply(this).then((function(t){return r.apply(e,[t])}))})}}var nT=Object.freeze({__proto__:null,shimRTCIceCandidate:Zb,shimMaxMessageSize:$b,shimSendThrowTypeError:Qb,shimConnectionState:eT,removeExtmapAllowMixed:tT,shimAddIceCandidateNullOrEmpty:rT,shimParameterlessSetLocalDescription:iT});!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},i=_S,n=mS(t),o={browserDetails:n,commonShim:nT,extractVersion:lS,disableLog:pS,disableWarnings:fS,sdp:qb};switch(n.browser){case"chrome":if(!Zy||!Jy||!r.shimChrome)return i("Chrome shim is not included in this adapter release."),o;if(null===n.version)return i("Chrome shim can not determine version, not shimming."),o;i("adapter.js shimming chrome."),o.browserShim=Zy,rT(t,n),iT(t),jy(t,n),Gy(t),Jy(t,n),Hy(t),Wy(t,n),zy(t),Ky(t),Yy(t),qy(t,n),Zb(t),eT(t),$b(t,n),Qb(t),tT(t,n);break;case"firefox":if(!Cg||!Sg||!r.shimFirefox)return i("Firefox shim is not included in this adapter release."),o;i("adapter.js shimming firefox."),o.browserShim=Cg,rT(t,n),iT(t),vg(t,n),Sg(t,n),mg(t),gg(t),Eg(t),yg(t),bg(t),Tg(t),Ig(t),Rg(t),Ag(t),Zb(t),eT(t),$b(t,n),Qb(t);break;case"safari":if(!xg||!r.shimSafari)return i("Safari shim is not included in this adapter release."),o;i("adapter.js shimming safari."),o.browserShim=xg,rT(t,n),iT(t),kg(t),Ug(t),wg(t),Og(t),Ng(t),Mg(t),Dg(t),Lg(t),Zb(t),$b(t,n),Qb(t),tT(t,n);break;default:i("Unsupported browser!")}}({window:"undefined"==typeof window?void 0:window}),Bi({target:"Array",stat:!0},{isArray:Yi});var oT=Qs,aT=Math.floor,sT=function(e,t){var r=e.length,i=aT(r/2);return r<8?cT(e,t):uT(e,sT(oT(e,0,i),t),sT(oT(e,i),t),t)},cT=function(e,t){for(var r,i,n=e.length,o=1;o<n;){for(i=o,r=e[o];i&&t(e[i-1],r)>0;)e[i]=e[--i];i!==o++&&(e[i]=r)}return e},uT=function(e,t,r,i){for(var n=t.length,o=r.length,a=0,s=0;a<n||s<o;)e[a+s]=a<n&&s<o?i(t[a],r[s])<=0?t[a++]:r[s++]:a<n?t[a++]:r[s++];return e},dT=sT,lT=X.match(/firefox\/(\d+)/i),hT=!!lT&&+lT[1],pT=/MSIE|Trident/.test(X),fT=X.match(/AppleWebKit\/(\d+)\./),_T=!!fT&&+fT[1],vT=Bi,mT=T,ST=ve,ET=Pe,yT=Zr,gT=qo,bT=o,TT=dT,IT=Un,RT=hT,AT=pT,CT=ee,OT=_T,NT=[],wT=mT(NT.sort),DT=mT(NT.push),PT=bT((function(){NT.sort(void 0)})),kT=bT((function(){NT.sort(null)})),MT=IT("sort"),UT=!bT((function(){if(CT)return CT<70;if(!(RT&&RT>3)){if(AT)return!0;if(OT)return OT<603;var e,t,r,i,n="";for(e=65;e<76;e++){switch(t=String.fromCharCode(e),e){case 66:case 69:case 70:case 72:r=3;break;case 68:case 71:r=4;break;default:r=2}for(i=0;i<47;i++)NT.push({k:t+i,v:r})}for(NT.sort((function(e,t){return t.v-e.v})),i=0;i<NT.length;i++)t=NT[i].k.charAt(0),n.charAt(n.length-1)!==t&&(n+=t);return"DGBEFHACIJK"!==n}}));vT({target:"Array",proto:!0,forced:PT||!kT||!MT||!UT},{sort:function(e){void 0!==e&&ST(e);var t=ET(this);if(UT)return void 0===e?wT(t):wT(t,e);var r,i,n=[],o=yT(t);for(i=0;i<o;i++)i in t&&DT(n,t[i]);for(TT(n,function(e){return function(t,r){return void 0===r?-1:void 0===t?1:void 0!==e?+e(t,r)||0:gT(t)>gT(r)?1:-1}}(e)),r=n.length,i=0;i<r;)t[i]=n[i++];for(;i<o;)delete t[i++];return t}});var LT="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView,xT=Gr,VT=Jr,FT=i.RangeError,BT=function(e){if(void 0===e)return 0;var t=xT(e),r=VT(t);if(t!==r)throw FT("Wrong length or index");return r},jT=i.Array,GT=Math.abs,HT=Math.pow,zT=Math.floor,KT=Math.log,YT=Math.LN2,XT={pack:function(e,t,r){var i,n,o,a=jT(r),s=8*r-t-1,c=(1<<s)-1,u=c>>1,d=23===t?HT(2,-24)-HT(2,-77):0,l=e<0||0===e&&1/e<0?1:0,h=0;for((e=GT(e))!=e||e===1/0?(n=e!=e?1:0,i=c):(i=zT(KT(e)/YT),e*(o=HT(2,-i))<1&&(i--,o*=2),(e+=i+u>=1?d/o:d*HT(2,1-u))*o>=2&&(i++,o/=2),i+u>=c?(n=0,i=c):i+u>=1?(n=(e*o-1)*HT(2,t),i+=u):(n=e*HT(2,u-1)*HT(2,t),i=0));t>=8;)a[h++]=255&n,n/=256,t-=8;for(i=i<<t|n,s+=t;s>0;)a[h++]=255&i,i/=256,s-=8;return a[--h]|=128*l,a},unpack:function(e,t){var r,i=e.length,n=8*i-t-1,o=(1<<n)-1,a=o>>1,s=n-7,c=i-1,u=e[c--],d=127&u;for(u>>=7;s>0;)d=256*d+e[c--],s-=8;for(r=d&(1<<-s)-1,d>>=-s,s+=t;s>0;)r=256*r+e[c--],s-=8;if(0===d)d=1-a;else{if(d===o)return r?NaN:u?-1/0:1/0;r+=HT(2,t),d-=a}return(u?-1:1)*r*HT(2,d-t)}},WT=Pe,JT=Yr,qT=Zr,ZT=function(e){for(var t=WT(this),r=qT(t),i=arguments.length,n=JT(i>1?arguments[1]:void 0,r),o=i>2?arguments[2]:void 0,a=void 0===o?r:JT(o,r);a>n;)t[n++]=e;return t},$T=i,QT=T,eI=a,tI=LT,rI=Or,iI=Gt,nI=Ku,oI=o,aI=Qu,sI=Gr,cI=Jr,uI=BT,dI=XT,lI=Zp,hI=ms,pI=Fr.f,fI=Rt.f,_I=ZT,vI=Qs,mI=vc,SI=rI.PROPER,EI=rI.CONFIGURABLE,yI=br.get,gI=br.set,bI=$T.ArrayBuffer,TI=bI,II=TI&&TI.prototype,RI=$T.DataView,AI=RI&&RI.prototype,CI=Object.prototype,OI=$T.Array,NI=$T.RangeError,wI=QT(_I),DI=QT([].reverse),PI=dI.pack,kI=dI.unpack,MI=function(e){return[255&e]},UI=function(e){return[255&e,e>>8&255]},LI=function(e){return[255&e,e>>8&255,e>>16&255,e>>24&255]},xI=function(e){return e[3]<<24|e[2]<<16|e[1]<<8|e[0]},VI=function(e){return PI(e,23,4)},FI=function(e){return PI(e,52,8)},BI=function(e,t){fI(e.prototype,t,{get:function(){return yI(this)[t]}})},jI=function(e,t,r,i){var n=uI(r),o=yI(e);if(n+t>o.byteLength)throw NI("Wrong index");var a=yI(o.buffer).bytes,s=n+o.byteOffset,c=vI(a,s,s+t);return i?c:DI(c)},GI=function(e,t,r,i,n,o){var a=uI(r),s=yI(e);if(a+t>s.byteLength)throw NI("Wrong index");for(var c=yI(s.buffer).bytes,u=a+s.byteOffset,d=i(+n),l=0;l<t;l++)c[u+l]=d[o?l:t-l-1]};if(tI){var HI=SI&&"ArrayBuffer"!==bI.name;if(oI((function(){bI(1)}))&&oI((function(){new bI(-1)}))&&!oI((function(){return new bI,new bI(1.5),new bI(NaN),HI&&!EI})))HI&&EI&&iI(bI,"name","ArrayBuffer");else{(TI=function(e){return aI(this,II),new bI(uI(e))}).prototype=II;for(var zI,KI=pI(bI),YI=0;KI.length>YI;)(zI=KI[YI++])in TI||iI(TI,zI,bI[zI]);II.constructor=TI}hI&&lI(AI)!==CI&&hI(AI,CI);var XI=new RI(new TI(2)),WI=QT(AI.setInt8);XI.setInt8(0,2147483648),XI.setInt8(1,2147483649),!XI.getInt8(0)&&XI.getInt8(1)||nI(AI,{setInt8:function(e,t){WI(this,e,t<<24>>24)},setUint8:function(e,t){WI(this,e,t<<24>>24)}},{unsafe:!0})}else II=(TI=function(e){aI(this,II);var t=uI(e);gI(this,{bytes:wI(OI(t),0),byteLength:t}),eI||(this.byteLength=t)}).prototype,AI=(RI=function(e,t,r){aI(this,AI),aI(e,II);var i=yI(e).byteLength,n=sI(t);if(n<0||n>i)throw NI("Wrong offset");if(n+(r=void 0===r?i-n:cI(r))>i)throw NI("Wrong length");gI(this,{buffer:e,byteLength:r,byteOffset:n}),eI||(this.buffer=e,this.byteLength=r,this.byteOffset=n)}).prototype,eI&&(BI(TI,"byteLength"),BI(RI,"buffer"),BI(RI,"byteLength"),BI(RI,"byteOffset")),nI(AI,{getInt8:function(e){return jI(this,1,e)[0]<<24>>24},getUint8:function(e){return jI(this,1,e)[0]},getInt16:function(e){var t=jI(this,2,e,arguments.length>1?arguments[1]:void 0);return(t[1]<<8|t[0])<<16>>16},getUint16:function(e){var t=jI(this,2,e,arguments.length>1?arguments[1]:void 0);return t[1]<<8|t[0]},getInt32:function(e){return xI(jI(this,4,e,arguments.length>1?arguments[1]:void 0))},getUint32:function(e){return xI(jI(this,4,e,arguments.length>1?arguments[1]:void 0))>>>0},getFloat32:function(e){return kI(jI(this,4,e,arguments.length>1?arguments[1]:void 0),23)},getFloat64:function(e){return kI(jI(this,8,e,arguments.length>1?arguments[1]:void 0),52)},setInt8:function(e,t){GI(this,1,e,MI,t)},setUint8:function(e,t){GI(this,1,e,MI,t)},setInt16:function(e,t){GI(this,2,e,UI,t,arguments.length>2?arguments[2]:void 0)},setUint16:function(e,t){GI(this,2,e,UI,t,arguments.length>2?arguments[2]:void 0)},setInt32:function(e,t){GI(this,4,e,LI,t,arguments.length>2?arguments[2]:void 0)},setUint32:function(e,t){GI(this,4,e,LI,t,arguments.length>2?arguments[2]:void 0)},setFloat32:function(e,t){GI(this,4,e,VI,t,arguments.length>2?arguments[2]:void 0)},setFloat64:function(e,t){GI(this,8,e,FI,t,arguments.length>2?arguments[2]:void 0)}});mI(TI,"ArrayBuffer"),mI(RI,"DataView");var JI={ArrayBuffer:TI,DataView:RI},qI=Bi,ZI=T,$I=o,QI=Dt,eR=Yr,tR=Jr,rR=Zd,iR=JI.ArrayBuffer,nR=JI.DataView,oR=nR.prototype,aR=ZI(iR.prototype.slice),sR=ZI(oR.getUint8),cR=ZI(oR.setUint8);qI({target:"ArrayBuffer",proto:!0,unsafe:!0,forced:$I((function(){return!new iR(2).slice(1,void 0).byteLength}))},{slice:function(e,t){if(aR&&void 0===t)return aR(QI(this),e);for(var r=QI(this).byteLength,i=eR(e,r),n=eR(void 0===t?r:t,r),o=new(rR(this,iR))(tR(n-i)),a=new nR(this),s=new nR(o),c=0;i<n;)cR(s,c++,sR(a,i++));return o}});var uR,dR,lR,hR={exports:{}},pR=LT,fR=a,_R=i,vR=F,mR=j,SR=Ue,ER=rn,yR=he,gR=Gt,bR=Ht.exports,TR=Rt.f,IR=Y,RR=Zp,AR=ms,CR=Ze,OR=Be,NR=_R.Int8Array,wR=NR&&NR.prototype,DR=_R.Uint8ClampedArray,PR=DR&&DR.prototype,kR=NR&&RR(NR),MR=wR&&RR(wR),UR=Object.prototype,LR=_R.TypeError,xR=CR("toStringTag"),VR=OR("TYPED_ARRAY_TAG"),FR=OR("TYPED_ARRAY_CONSTRUCTOR"),BR=pR&&!!AR&&"Opera"!==ER(_R.opera),jR=!1,GR={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},HR={BigInt64Array:8,BigUint64Array:8},zR=function(e){if(!mR(e))return!1;var t=ER(e);return SR(GR,t)||SR(HR,t)};for(uR in GR)(lR=(dR=_R[uR])&&dR.prototype)?gR(lR,FR,dR):BR=!1;for(uR in HR)(lR=(dR=_R[uR])&&dR.prototype)&&gR(lR,FR,dR);if((!BR||!vR(kR)||kR===Function.prototype)&&(kR=function(){throw LR("Incorrect invocation")},BR))for(uR in GR)_R[uR]&&AR(_R[uR],kR);if((!BR||!MR||MR===UR)&&(MR=kR.prototype,BR))for(uR in GR)_R[uR]&&AR(_R[uR].prototype,MR);if(BR&&RR(PR)!==MR&&AR(PR,MR),fR&&!SR(MR,xR))for(uR in jR=!0,TR(MR,xR,{get:function(){return mR(this)?this[VR]:void 0}}),GR)_R[uR]&&gR(_R[uR],VR,uR);var KR={NATIVE_ARRAY_BUFFER_VIEWS:BR,TYPED_ARRAY_CONSTRUCTOR:FR,TYPED_ARRAY_TAG:jR&&VR,aTypedArray:function(e){if(zR(e))return e;throw LR("Target is not a typed array")},aTypedArrayConstructor:function(e){if(vR(e)&&(!AR||IR(kR,e)))return e;throw LR(yR(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,r,i){if(fR){if(r)for(var n in GR){var o=_R[n];if(o&&SR(o.prototype,e))try{delete o.prototype[e]}catch(r){try{o.prototype[e]=t}catch(e){}}}MR[e]&&!r||bR(MR,e,r?t:BR&&wR[e]||t,i)}},exportTypedArrayStaticMethod:function(e,t,r){var i,n;if(fR){if(AR){if(r)for(i in GR)if((n=_R[i])&&SR(n,e))try{delete n[e]}catch(e){}if(kR[e]&&!r)return;try{return bR(kR,e,r?t:BR&&kR[e]||t)}catch(e){}}for(i in GR)!(n=_R[i])||n[e]&&!r||bR(n,e,t)}},isView:function(e){if(!mR(e))return!1;var t=ER(e);return"DataView"===t||SR(GR,t)||SR(HR,t)},isTypedArray:zR,TypedArray:kR,TypedArrayPrototype:MR},YR=i,XR=o,WR=Hd,JR=KR.NATIVE_ARRAY_BUFFER_VIEWS,qR=YR.ArrayBuffer,ZR=YR.Int8Array,$R=!JR||!XR((function(){ZR(1)}))||!XR((function(){new ZR(-1)}))||!WR((function(e){new ZR,new ZR(null),new ZR(1.5),new ZR(e)}),!0)||XR((function(){return 1!==new ZR(new qR(2),1,void 0).length})),QR=j,eA=Math.floor,tA=Number.isInteger||function(e){return!QR(e)&&isFinite(e)&&eA(e)===e},rA=Gr,iA=i.RangeError,nA=function(e){var t=rA(e);if(t<0)throw iA("The argument can't be less than 0");return t},oA=i.RangeError,aA=function(e,t){var r=nA(e);if(r%t)throw oA("Wrong offset");return r},sA=zi,cA=d,uA=Xd,dA=Pe,lA=Zr,hA=vd,pA=ud,fA=nd,_A=KR.aTypedArrayConstructor,vA=Bi,mA=i,SA=d,EA=a,yA=$R,gA=KR,bA=JI,TA=Qu,IA=m,RA=Gt,AA=tA,CA=Jr,OA=BT,NA=aA,wA=ut,DA=Ue,PA=rn,kA=j,MA=de,UA=ko,LA=Y,xA=ms,VA=Fr.f,FA=function(e){var t,r,i,n,o,a,s=uA(this),c=dA(e),u=arguments.length,d=u>1?arguments[1]:void 0,l=void 0!==d,h=pA(c);if(h&&!fA(h))for(a=(o=hA(c,h)).next,c=[];!(n=cA(a,o)).done;)c.push(n.value);for(l&&u>2&&(d=sA(d,arguments[2])),r=lA(c),i=new(_A(s))(r),t=0;r>t;t++)i[t]=l?d(c[t],t):c[t];return i},BA=kn.forEach,jA=qu,GA=Rt,HA=n,zA=um,KA=br.get,YA=br.set,XA=GA.f,WA=HA.f,JA=Math.round,qA=mA.RangeError,ZA=bA.ArrayBuffer,$A=ZA.prototype,QA=bA.DataView,eC=gA.NATIVE_ARRAY_BUFFER_VIEWS,tC=gA.TYPED_ARRAY_CONSTRUCTOR,rC=gA.TYPED_ARRAY_TAG,iC=gA.TypedArray,nC=gA.TypedArrayPrototype,oC=gA.aTypedArrayConstructor,aC=gA.isTypedArray,sC=function(e,t){oC(e);for(var r=0,i=t.length,n=new e(i);i>r;)n[r]=t[r++];return n},cC=function(e,t){XA(e,t,{get:function(){return KA(this)[t]}})},uC=function(e){var t;return LA($A,e)||"ArrayBuffer"==(t=PA(e))||"SharedArrayBuffer"==t},dC=function(e,t){return aC(e)&&!MA(t)&&t in e&&AA(+t)&&t>=0},lC=function(e,t){return t=wA(t),dC(e,t)?IA(2,e[t]):WA(e,t)},hC=function(e,t,r){return t=wA(t),!(dC(e,t)&&kA(r)&&DA(r,"value"))||DA(r,"get")||DA(r,"set")||r.configurable||DA(r,"writable")&&!r.writable||DA(r,"enumerable")&&!r.enumerable?XA(e,t,r):(e[t]=r.value,e)};EA?(eC||(HA.f=lC,GA.f=hC,cC(nC,"buffer"),cC(nC,"byteOffset"),cC(nC,"byteLength"),cC(nC,"length")),vA({target:"Object",stat:!0,forced:!eC},{getOwnPropertyDescriptor:lC,defineProperty:hC}),hR.exports=function(e,t,r){var i=e.match(/\d+$/)[0]/8,n=e+(r?"Clamped":"")+"Array",o="get"+e,a="set"+e,s=mA[n],c=s,u=c&&c.prototype,d={},l=function(e,t){XA(e,t,{get:function(){return function(e,t){var r=KA(e);return r.view[o](t*i+r.byteOffset,!0)}(this,t)},set:function(e){return function(e,t,n){var o=KA(e);r&&(n=(n=JA(n))<0?0:n>255?255:255&n),o.view[a](t*i+o.byteOffset,n,!0)}(this,t,e)},enumerable:!0})};eC?yA&&(c=t((function(e,t,r,n){return TA(e,u),zA(kA(t)?uC(t)?void 0!==n?new s(t,NA(r,i),n):void 0!==r?new s(t,NA(r,i)):new s(t):aC(t)?sC(c,t):SA(FA,c,t):new s(OA(t)),e,c)})),xA&&xA(c,iC),BA(VA(s),(function(e){e in c||RA(c,e,s[e])})),c.prototype=u):(c=t((function(e,t,r,n){TA(e,u);var o,a,s,d=0,h=0;if(kA(t)){if(!uC(t))return aC(t)?sC(c,t):SA(FA,c,t);o=t,h=NA(r,i);var p=t.byteLength;if(void 0===n){if(p%i)throw qA("Wrong length");if((a=p-h)<0)throw qA("Wrong length")}else if((a=CA(n)*i)+h>p)throw qA("Wrong length");s=a/i}else s=OA(t),o=new ZA(a=s*i);for(YA(e,{buffer:o,byteOffset:h,byteLength:a,length:s,view:new QA(o)});d<s;)l(e,d++)})),xA&&xA(c,iC),u=c.prototype=UA(nC)),u.constructor!==c&&RA(u,"constructor",c),RA(u,tC,c),rC&&RA(u,rC,n),d[n]=c,vA({global:!0,forced:c!=s,sham:!eC},d),"BYTES_PER_ELEMENT"in c||RA(c,"BYTES_PER_ELEMENT",i),"BYTES_PER_ELEMENT"in u||RA(u,"BYTES_PER_ELEMENT",i),jA(n)}):hR.exports=function(){},(0,hR.exports)("Uint8",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var pC=Pe,fC=Yr,_C=Zr,vC=Math.min,mC=[].copyWithin||function(e,t){var r=pC(this),i=_C(r),n=fC(e,i),o=fC(t,i),a=arguments.length>2?arguments[2]:void 0,s=vC((void 0===a?i:fC(a,i))-o,i-n),c=1;for(o<n&&n<o+s&&(c=-1,o+=s-1,n+=s-1);s-- >0;)o in r?r[n]=r[o]:delete r[n],n+=c,o+=c;return r},SC=KR,EC=T(mC),yC=SC.aTypedArray;(0,SC.exportTypedArrayMethod)("copyWithin",(function(e,t){return EC(yC(this),e,t,arguments.length>2?arguments[2]:void 0)}));var gC=kn.every,bC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("every",(function(e){return gC(bC(this),e,arguments.length>1?arguments[1]:void 0)}));var TC=d,IC=ZT,RC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("fill",(function(e){var t=arguments.length;return TC(IC,RC(this),e,t>1?arguments[1]:void 0,t>2?arguments[2]:void 0)}));var AC=Zr,CC=Zd,OC=KR.TYPED_ARRAY_CONSTRUCTOR,NC=KR.aTypedArrayConstructor,wC=function(e){return NC(CC(e,e[OC]))},DC=function(e,t){for(var r=0,i=AC(t),n=new e(i);i>r;)n[r]=t[r++];return n},PC=wC,kC=kn.filter,MC=function(e,t){return DC(PC(e),t)},UC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("filter",(function(e){var t=kC(UC(this),e,arguments.length>1?arguments[1]:void 0);return MC(this,t)}));var LC=kn.find,xC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("find",(function(e){return LC(xC(this),e,arguments.length>1?arguments[1]:void 0)}));var VC=kn.findIndex,FC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("findIndex",(function(e){return VC(FC(this),e,arguments.length>1?arguments[1]:void 0)}));var BC=kn.forEach,jC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("forEach",(function(e){BC(jC(this),e,arguments.length>1?arguments[1]:void 0)}));var GC=ri.includes,HC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("includes",(function(e){return GC(HC(this),e,arguments.length>1?arguments[1]:void 0)}));var zC=ri.indexOf,KC=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("indexOf",(function(e){return zC(KC(this),e,arguments.length>1?arguments[1]:void 0)}));var YC=i,XC=o,WC=T,JC=KR,qC=jf,ZC=Ze("iterator"),$C=YC.Uint8Array,QC=WC(qC.values),eO=WC(qC.keys),tO=WC(qC.entries),rO=JC.aTypedArray,iO=JC.exportTypedArrayMethod,nO=$C&&$C.prototype,oO=!XC((function(){nO[ZC].call([1])})),aO=!!nO&&nO.values&&nO[ZC]===nO.values&&"values"===nO.values.name,sO=function(){return QC(rO(this))};iO("entries",(function(){return tO(rO(this))}),oO),iO("keys",(function(){return eO(rO(this))}),oO),iO("values",sO,oO||!aO,{name:"values"}),iO(ZC,sO,oO||!aO,{name:"values"});var cO=KR.aTypedArray,uO=KR.exportTypedArrayMethod,dO=T([].join);uO("join",(function(e){return dO(cO(this),e)}));var lO=Gs,hO=V,pO=Gr,fO=Zr,_O=Un,vO=Math.min,mO=[].lastIndexOf,SO=!!mO&&1/[1].lastIndexOf(1,-0)<0,EO=_O("lastIndexOf"),yO=SO||!EO?function(e){if(SO)return lO(mO,this,arguments)||0;var t=hO(this),r=fO(t),i=r-1;for(arguments.length>1&&(i=vO(i,pO(arguments[1]))),i<0&&(i=r+i);i>=0;i--)if(i in t&&t[i]===e)return i||0;return-1}:mO,gO=Gs,bO=yO,TO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("lastIndexOf",(function(e){var t=arguments.length;return gO(bO,TO(this),t>1?[e,arguments[1]]:[e])}));var IO=kn.map,RO=wC,AO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("map",(function(e){return IO(AO(this),e,arguments.length>1?arguments[1]:void 0,(function(e,t){return new(RO(e))(t)}))}));var CO=Ym.left,OO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("reduce",(function(e){var t=arguments.length;return CO(OO(this),e,t,t>1?arguments[1]:void 0)}));var NO=Ym.right,wO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("reduceRight",(function(e){var t=arguments.length;return NO(wO(this),e,t,t>1?arguments[1]:void 0)}));var DO=KR.aTypedArray,PO=KR.exportTypedArrayMethod,kO=Math.floor;PO("reverse",(function(){for(var e,t=this,r=DO(t).length,i=kO(r/2),n=0;n<i;)e=t[n],t[n++]=t[--r],t[r]=e;return t}));var MO=i,UO=d,LO=KR,xO=Zr,VO=aA,FO=Pe,BO=o,jO=MO.RangeError,GO=MO.Int8Array,HO=GO&&GO.prototype,zO=HO&&HO.set,KO=LO.aTypedArray,YO=LO.exportTypedArrayMethod,XO=!BO((function(){var e=new Uint8ClampedArray(2);return UO(zO,e,{length:1,0:3},1),3!==e[1]})),WO=XO&&LO.NATIVE_ARRAY_BUFFER_VIEWS&&BO((function(){var e=new GO(2);return e.set(1),e.set("2",1),0!==e[0]||2!==e[1]}));YO("set",(function(e){KO(this);var t=VO(arguments.length>1?arguments[1]:void 0,1),r=FO(e);if(XO)return UO(zO,this,r,t);var i=this.length,n=xO(r),o=0;if(n+t>i)throw jO("Wrong length");for(;o<n;)this[t+o]=r[o++]}),!XO||WO);var JO=wC,qO=oc,ZO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("slice",(function(e,t){for(var r=qO(ZO(this),e,t),i=JO(this),n=0,o=r.length,a=new i(o);o>n;)a[n]=r[n++];return a}),o((function(){new Int8Array(1).slice()})));var $O=kn.some,QO=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("some",(function(e){return $O(QO(this),e,arguments.length>1?arguments[1]:void 0)}));var eN=i,tN=T,rN=o,iN=ve,nN=dT,oN=KR,aN=hT,sN=pT,cN=ee,uN=_T,dN=eN.Array,lN=oN.aTypedArray,hN=oN.exportTypedArrayMethod,pN=eN.Uint16Array,fN=pN&&tN(pN.prototype.sort),_N=!(!fN||rN((function(){fN(new pN(2),null)}))&&rN((function(){fN(new pN(2),{})}))),vN=!!fN&&!rN((function(){if(cN)return cN<74;if(aN)return aN<67;if(sN)return!0;if(uN)return uN<602;var e,t,r=new pN(516),i=dN(516);for(e=0;e<516;e++)t=e%4,r[e]=515-e,i[e]=e-2*t+3;for(fN(r,(function(e,t){return(e/4|0)-(t/4|0)})),e=0;e<516;e++)if(r[e]!==i[e])return!0}));hN("sort",(function(e){return void 0!==e&&iN(e),vN?fN(this,e):nN(lN(this),function(e){return function(t,r){return void 0!==e?+e(t,r)||0:r!=r?-1:t!=t?1:0===t&&0===r?1/t>0&&1/r<0?1:-1:t>r}}(e))}),!vN||_N);var mN=Jr,SN=Yr,EN=wC,yN=KR.aTypedArray;(0,KR.exportTypedArrayMethod)("subarray",(function(e,t){var r=yN(this),i=r.length,n=SN(e,i);return new(EN(r))(r.buffer,r.byteOffset+n*r.BYTES_PER_ELEMENT,mN((void 0===t?i:SN(t,i))-n))}));var gN=Gs,bN=KR,TN=o,IN=oc,RN=i.Int8Array,AN=bN.aTypedArray,CN=bN.exportTypedArrayMethod,ON=[].toLocaleString,NN=!!RN&&TN((function(){ON.call(new RN(1))}));CN("toLocaleString",(function(){return gN(ON,NN?IN(AN(this)):AN(this),IN(arguments))}),TN((function(){return[1,2].toLocaleString()!=new RN([1,2]).toLocaleString()}))||!TN((function(){RN.prototype.toLocaleString.call([1,2])})));var wN=KR.exportTypedArrayMethod,DN=o,PN=T,kN=i.Uint8Array,MN=kN&&kN.prototype||{},UN=[].toString,LN=PN([].join);DN((function(){UN.call({})}))&&(UN=function(){return LN(this)});var xN=MN.toString!=UN;wN("toString",UN,xN);var VN=Bi,FN=i,BN=Gs,jN=F,GN=oc,HN=Qd,zN=/MSIE .\./.test(X),KN=FN.Function,YN=function(e){return function(t,r){var i=HN(arguments.length,1)>2,n=jN(t)?t:KN(t),o=i?GN(arguments,2):void 0;return e(i?function(){BN(n,this,o)}:n,r)}};VN({global:!0,bind:!0,forced:zN},{setTimeout:YN(FN.setTimeout),setInterval:YN(FN.setInterval)});var XN=Bi,WN=kn.findIndex,JN=Vo,qN=!0;"findIndex"in[]&&Array(1).findIndex((function(){qN=!1})),XN({target:"Array",proto:!0,forced:qN},{findIndex:function(e){return WN(this,e,arguments.length>1?arguments[1]:void 0)}}),JN("findIndex");var ZN,$N,QN=qu,ew=JI.ArrayBuffer;Bi({global:!0,forced:i.ArrayBuffer!==ew},{ArrayBuffer:ew}),QN("ArrayBuffer"),function(e){e.INVALID_ENGINE="INVALID_ENGINE",e.INVALID_PARAMS="INVALID_PARAMS",e.INVALID_TOKEN="INVALID_TOKEN",e.EXPIRED_TOKEN="EXPIRED_TOKEN",e.JOIN_ROOM_FAILED="JOIN_ROOM_FAILED",e.UPDATE_TOKEN_WITH_INVALID_TOKEN="UPDATE_TOKEN_WITH_INVALID_TOKEN",e.UPDATE_TOKEN_BEFORE_JOIN="UPDATE_TOKEN_BEFORE_JOIN",e.REPEAT_JOIN="REPEAT_JOIN",e.REPEAT_PUBLISH="REPEAT_PUBLISH",e.REPEAT_PUSH="REPEAT_PUSH",e.REPEAT_PLAY="REPEAT_PLAY",e.PUBLISH_BEFORE_JOIN="PUBLISH_BEFORE_JOIN",e.UNPUBLISH_BEFORE_JOIN="UNPUBLISH_BEFORE_JOIN",e.SUBSCRIBE_BEFORE_JOIN="SUBSCRIBE_BEFORE_JOIN",e.UNSUBSCRIBE_BEFORE_JOIN="UNSUBSCRIBE_BEFORE_JOIN",e.NO_PUBLISH_PERMISSION="NO_PUBLISH_PERMISSION",e.STREAM_NOT_EXIST="STREAM_NOT_EXIST",e.EMPTY_STREAM="EMPTY_STREAM",e.NOT_CONNECTED_YET="NOT_CONNECTED_YET",e.IM_BEFORE_JOIN="IM_BEFORE_JOIN",e.USER_NOT_EXIST="USER_NOT_EXIST",e.ALREADY_IN_ROOM="ALREADY_IN_ROOM",e.KICKED_OUT="KICKED_OUT",e.ROOM_DISMISS="ROOM_DISMISS",e.TOKEN_EXPIRED="TOKEN_EXPIRED",e.DUPLICATE_LOGIN="DUPLICATE_LOGIN",e.REPEAT_CAPTURE="REPEAT_CAPTURE",e.GET_VIDEO_TRACK_FAILED="GET_VIDEO_TRACK_FAILED",e.GET_AUDIO_TRACK_FAILED="GET_AUDIO_TRACK_FAILED",e.GET_SCREEN_TRACK_FAILED="GET_SCREEN_TRACK_FAILED",e.STREAM_TYPE_NOT_MATCH="STREAM_TYPE_NOT_MATCH",e.CANT_FIND_DOM="CANT_FIND_DOM",e.INVALID_DEVICE_ID="INVALID_DEVICE_ID",e.NO_PERMISSION="NO_PERMISSION",e.NOT_SUPPORTED="NOT_SUPPORTED",e.ICE_SERVER_WRONG="ICE_SERVER_WRONG",e.ESTABLISH_DATACHANNEL_FAILED="ESTABLISH_DATACHANNEL_FAILED",e.LOAD_RESOURCES_FAILED="LOAD_RESOURCES_FAILED",e.SIGNALING_CHANNEL_NOT_OPEN="SIGNALING_CHANNEL_NOT_OPEN",e.TIME_OUT="TIME_OUT",e.REFUSE_OPERATION_IN_DISCONNECT="REFUSE_OPERATION_IN_DISCONNECT",e.ADD_TRANSCEIVER_FAILED="ADD_TRANSCEIVER_FAILED",e.UPDATE_TRACK_FAILED="UPDATE_TRACK_FAILED",e.PUBLISH_FAILED="PUBLISH_FAILED",e.UNPUBLISH_FAILED="UNPUBLISH_FAILED",e.SUBSCRIBE_FAILED="SUBSCRIBE_FAILED",e.UNSUBSCRIBE_FAILED="UNSUBSCRIBE_FAILED",e.OPERATION_CANCEL="OPERATION_CANCEL",e.START_CLOUD_PROXY_AFTER_JOIN="START_CLOUD_PROXY_AFTER_JOIN",e.STOP_CLOUD_PROXY_BEFORE_LEAVE="STOP_CLOUD_PROXY_BEFORE_LEAVE",e.UNEXPECTED_ERROR="UNEXPECTED_ERROR",e.REPEAT_DEVICE_TEST="REPEAT_DEVICE_TEST",e.AUDIO_DEVICE_TEST_FAILED="AUDIO_DEVICE_RECORD_FAILED",e.ALREADY_LOGIN="ALREADY_LOGIN",e.LOGIN_FAILED="LOGIN_FAILED",e.NOT_LOGIN="NOT_LOGIN",e.RTM_DUPLICATE_LOGIN="RTM_DUPLICATE_LOGIN",e.RTM_TOKEN_ERROR="RTM_TOKEN_ERROR",e.USER_MESSAGE_TIMEOUT="USER_MESSAGE_TIMEOUT",e.USER_MESSAGE_BROKEN="USER_MESSAGE_BROKEN",e.USER_MESSAGE_NO_RECEIVER="USER_MESSAGE_NO_RECEIVER",e.USER_MESSAGE_NO_RELAYPATH="USER_MESSAGE_NO_RELAYPATH",e.USER_MESSAGE_SEND_TO_SERVER_ERROR="USER_MESSAGE_SEND_TO_SERVER_ERROR",e.USER_MESSAGE_SERVER_RESPONSE_ERROR="USER_MESSAGE_SERVER_RESPONSE_ERROR",e.USER_MESSAGE_NOT_JOIN="USER_MESSAGE_NOT_JOIN",e.USER_MESSAGE_INIT="USER_MESSAGE_INIT",e.USER_MESSAGE_NO_CONNECTION="USER_MESSAGE_NO_CONNECTION",e.USER_MESSAGE_EXCEED_MAX_LENGTH="USER_MESSAGE_EXCEED_MAX_LENGTH",e.USER_MESSAGE_EMPTY_USER="USER_MESSAGE_EMPTY_USER",e.USER_MESSAGE_NOT_LOGIN="USER_MESSAGE_NOT_LOGIN",e.USER_MESSAGE_SERVER_PARAMS_NOTSET="USER_MESSAGE_SERVER_PARAMS_NOTSET",e.USER_MESSAGE_UNKNOWN="USER_MESSAGE_UNKNOWN",e.START_PUBLIC_STREAM_BEFORE_JOIN="START_PUBLIC_STREAM_BEFORE_JOIN"}(ZN||(ZN={})),function(e){e[e.AUDIO_MIXING_ERROR_OK=0]="AUDIO_MIXING_ERROR_OK",e[e.AUDIO_MIXING_ERROR_PRELOAD_FAILED=1]="AUDIO_MIXING_ERROR_PRELOAD_FAILED",e[e.AUDIO_MIXING_ERROR_START_FAILED=2]="AUDIO_MIXING_ERROR_START_FAILED",e[e.AUDIO_MIXING_ERROR_ID_NOT_FOUND=3]="AUDIO_MIXING_ERROR_ID_NOT_FOUND",e[e.AUDIO_MIXING_ERROR_SET_POSITION_FAILED=4]="AUDIO_MIXING_ERROR_SET_POSITION_FAILED",e[e.AUDIO_MIXING_ERROR_INVALID_VOLUME=5]="AUDIO_MIXING_ERROR_INVALID_VOLUME",e[e.AUDIO_MIXING_ERROR_LOAD_CONFLICT=6]="AUDIO_MIXING_ERROR_LOAD_CONFLICT",e[e.AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH=7]="AUDIO_MIXING_ERROR_ID_TYPE_NOT_MATCH",e[e.AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH=8]="AUDIO_MIXING_ERROR_ID_TYPE_INVALID_PITCH",e[e.AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK=9]="AUDIO_MIXING_ERROR_INVALID_AUDIO_TRACK"}($N||($N={}));var tw=function(e,t,r){this.code=e,this.message=t,this.error=r},rw=a,iw=T,nw=po,ow=V,aw=iw(l.f),sw=iw([].push),cw=function(e){return function(t){for(var r,i=ow(t),n=nw(i),o=n.length,a=0,s=[];o>a;)r=n[a++],rw&&!aw(i,r)||sw(s,e?[r,i[r]]:i[r]);return s}},uw={entries:cw(!0),values:cw(!1)}.entries;Bi({target:"Object",stat:!0},{entries:function(e){return uw(e)}});var dw=Gr,lw=qo,hw=U,pw=i.RangeError,fw=function(e){var t=lw(hw(this)),r="",i=dw(e);if(i<0||i==1/0)throw pw("Wrong number of repetitions");for(;i>0;(i>>>=1)&&(t+=t))1&i&&(r+=t);return r},_w=T,vw=Jr,mw=qo,Sw=U,Ew=_w(fw),yw=_w("".slice),gw=Math.ceil,bw=function(e){return function(t,r,i){var n,o,a=mw(Sw(t)),s=vw(r),c=a.length,u=void 0===i?" ":mw(i);return s<=c||""==u?a:((o=Ew(u,gw((n=s-c)/u.length))).length>n&&(o=yw(o,0,n)),e?a+o:o+a)}},Tw={start:bw(!1),end:bw(!0)},Iw=/Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(X),Rw=Tw.end;Bi({target:"String",proto:!0,forced:Iw},{padEnd:function(e){return Rw(this,e,arguments.length>1?arguments[1]:void 0)}});var Aw=Uv;Bi({target:"Number",stat:!0,forced:Number.parseInt!=Aw},{parseInt:Aw});Bi({target:"ArrayBuffer",stat:!0,forced:!KR.NATIVE_ARRAY_BUFFER_VIEWS},{isView:KR.isView}),Bi({global:!0,forced:!LT},{DataView:JI.DataView});var Cw=Dt,Ow=yd,Nw=zi,ww=d,Dw=Pe,Pw=function(e,t,r,i){try{return i?t(Cw(r)[0],r[1]):t(r)}catch(t){Ow(e,"throw",t)}},kw=nd,Mw=mn,Uw=Zr,Lw=Xs,xw=vd,Vw=ud,Fw=i.Array,Bw=function(e){var t=Dw(e),r=Mw(this),i=arguments.length,n=i>1?arguments[1]:void 0,o=void 0!==n;o&&(n=Nw(n,i>2?arguments[2]:void 0));var a,s,c,u,d,l,h=Vw(t),p=0;if(!h||this==Fw&&kw(h))for(a=Uw(t),s=r?new this(a):Fw(a);a>p;p++)l=o?n(t[p],p):t[p],Lw(s,p,l);else for(d=(u=xw(t,h)).next,s=r?new this:[];!(c=ww(d,u)).done;p++)l=o?Pw(u,n,[c.value,p],!0):c.value,Lw(s,p,l);return s.length=p,s},jw=Bw;Bi({target:"Array",stat:!0,forced:!Hd((function(e){Array.from(e)}))},{from:jw});var Gw=Bi,Hw=Yi,zw=T([].reverse),Kw=[1,2];Gw({target:"Array",proto:!0,forced:String(Kw)===String(Kw.reverse())},{reverse:function(){return Hw(this)&&(this.length=this.length),zw(this)}});var Yw=Bi,Xw=i,Ww=T,Jw=Gr,qw=jg,Zw=fw,$w=o,Qw=Xw.RangeError,eD=Xw.String,tD=Math.floor,rD=Ww(Zw),iD=Ww("".slice),nD=Ww(1..toFixed),oD=function(e,t,r){return 0===t?r:t%2==1?oD(e,t-1,r*e):oD(e*e,t/2,r)},aD=function(e,t,r){for(var i=-1,n=r;++i<6;)n+=t*e[i],e[i]=n%1e7,n=tD(n/1e7)},sD=function(e,t){for(var r=6,i=0;--r>=0;)i+=e[r],e[r]=tD(i/t),i=i%t*1e7},cD=function(e){for(var t=6,r="";--t>=0;)if(""!==r||0===t||0!==e[t]){var i=eD(e[t]);r=""===r?i:r+rD("0",7-i.length)+i}return r};Yw({target:"Number",proto:!0,forced:$w((function(){return"0.000"!==nD(8e-5,3)||"1"!==nD(.9,0)||"1.25"!==nD(1.255,2)||"1000000000000000128"!==nD(0xde0b6b3a7640080,0)}))||!$w((function(){nD({})}))},{toFixed:function(e){var t,r,i,n,o=qw(this),a=Jw(e),s=[0,0,0,0,0,0],c="",u="0";if(a<0||a>20)throw Qw("Incorrect fraction digits");if(o!=o)return"NaN";if(o<=-1e21||o>=1e21)return eD(o);if(o<0&&(c="-",o=-o),o>1e-21)if(r=(t=function(e){for(var t=0,r=e;r>=4096;)t+=12,r/=4096;for(;r>=2;)t+=1,r/=2;return t}(o*oD(2,69,1))-69)<0?o*oD(2,-t,1):o/oD(2,t,1),r*=4503599627370496,(t=52-t)>0){for(aD(s,0,r),i=a;i>=7;)aD(s,1e7,0),i-=7;for(aD(s,oD(10,i,1),0),i=t-1;i>=23;)sD(s,1<<23),i-=23;sD(s,1<<i),aD(s,1,1),sD(s,2),u=cD(s)}else aD(s,0,r),aD(s,1<<-t,0),u=cD(s)+rD("0",a);return u=a>0?c+((n=u.length)<=a?"0."+rD("0",a-n)+u:iD(u,0,n-a)+"."+iD(u,n-a)):c+u}});var uD,dD=Math.log,lD=Math.LOG10E;Bi({target:"Math",stat:!0},{log10:Math.log10||function(e){return dD(e)*lD}});var hD=new Uint8Array(16);function pD(){if(!uD&&!(uD="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 uD(hD)}var fD=/^(?:[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 _D(e){return"string"==typeof e&&fD.test(e)}for(var vD=[],mD=0;mD<256;++mD)vD.push((mD+256).toString(16).substr(1));function SD(e,t,r){var i=(e=e||{}).random||(e.rng||pD)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){r=r||0;for(var n=0;n<16;++n)t[r+n]=i[n];return t}return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=(vD[e[t+0]]+vD[e[t+1]]+vD[e[t+2]]+vD[e[t+3]]+"-"+vD[e[t+4]]+vD[e[t+5]]+"-"+vD[e[t+6]]+vD[e[t+7]]+"-"+vD[e[t+8]]+vD[e[t+9]]+"-"+vD[e[t+10]]+vD[e[t+11]]+vD[e[t+12]]+vD[e[t+13]]+vD[e[t+14]]+vD[e[t+15]]).toLowerCase();if(!_D(r))throw TypeError("Stringified UUID is invalid");return r}(i)}var ED=new TextDecoder,yD=new TextEncoder,gD=function(){return SD()},bD=function(){return Date.now()};function TD(e){for(var t,r,i,n,o=[],a=1;a<arguments.length;a++)o[a-1]=arguments[a];var s=0;try{for(var c=rv(o),u=c.next();!u.done;u=c.next()){s+=(f=u.value).length}}catch(e){t={error:e}}finally{try{u&&!u.done&&(r=c.return)&&r.call(c)}finally{if(t)throw t.error}}var d=new e(s),l=0;try{for(var h=rv(o),p=h.next();!p.done;p=h.next()){var f=p.value;d.set(f,l),l+=f.length}}catch(e){i={error:e}}finally{try{p&&!p.done&&(n=h.return)&&n.call(h)}finally{if(i)throw i.error}}return d}var ID=function(){return"undefined"==typeof window},RD=function(){function e(){}return e.token2auth=function(t,r,i,n){return n?"Bearer ".concat(n):"Basic ".concat(e.createUnsafeToken(t,r,i))},e.createUnsafeToken=function(e,t,r){return window.btoa([e,t,r].filter((function(e){return null!==e})).join(":"))},e.merge=function(t,r){var i,n;void 0===t&&(t={}),void 0===r&&(r={});try{for(var o=rv(Object.entries(t)),a=o.next();!a.done;a=o.next()){var s=iv(a.value,2),c=s[0],u=s[1];null!==u&&"object"===us(u)?e.merge(t[c],r[c]):void 0!==r[c]&&(t[c]=r[c])}}catch(e){i={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}},e.ab2str=function(e){return ED.decode(e)},e.ab2obj=function(t){try{var r=e.ab2str(t);return JSON.parse(r)}catch(e){return{}}},e.str2ab=function(e){return yD.encode(e).buffer},e.ab2b64str=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return[4,new Promise((function(t){var r=new FileReader;r.onload=function(){return t(r.result)},r.readAsDataURL(new Blob([e]))}))];case 1:return[2,t.sent().split(",",2)[1]]}}))}))},e.b64str2ab=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return[2,fetch("data:application/octet;base64,"+e).then((function(e){return e.arrayBuffer()}))]}))}))},e}();function AD(){for(var e=(+"".concat(Math.random()).slice(-7).padEnd(7,"0")).toString(2).padEnd(28,"1").split(""),t=[];e.length;)t.push(e.splice(0,7));return t.map((function(e,r){var i=r===t.length-1?"0":"1";return Number.parseInt(i+e.join(""),2)}))}var CD=function(){return Math.floor(65535*Math.random())};function OD(e){return"string"==typeof e&&e.indexOf("__web__rtc__rtt__")>-1}function ND(e){return e.map((function e(t){if(t instanceof HTMLElement)return t.toString();if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)){var r=ArrayBuffer.isView(t)?t.buffer:t,i=r.byteLength,n=[];if(i>10){var o=new DataView(r),a=Array.from({length:5}).map((function(e,t){return o.getUint8(t)})),s=Array.from({length:5}).map((function(e,t){return i-1-t})).reverse().map((function(e){return o.getUint8(e)}));n=nv(nv(nv([],iv(a),!1),["..."],!1),iv(s),!1)}else n=Array.from(new Uint8Array(r));return"".concat(t.constructor.name,"(").concat(i,") [").concat(n.join(", "),"]")}if(Array.isArray(t))return t.map(e);if("[object Object]"===Object.prototype.toString.call(t)){var c={};for(var u in t)c[u]=e(t[u]);return c}return t}))}var wD,DD=function(){return ev(void 0,void 0,void 0,(function(){var e,t;return tv(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),(e=new RTCPeerConnection({iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"})).createDataChannel("default"),e.addTransceiver("audio",{direction:"recvonly"}),e.addTransceiver("video",{direction:"recvonly"}),[4,e.createOffer()];case 1:return t=r.sent(),e.close(),[2,t.sdp];case 2:return r.sent(),[3,3];case 3:return[2]}}))}))},PD=function(e){return new Promise((function(t,r){var i=(e=Array.isArray(e)?e:[]).length,n=[];0===i?r([]):e.forEach((function(e){e.then((function(e){t(e)}),(function(e){i--,n.push(e),0===i&&r(n)}))}))}))};function kD(e){return+Math.max(-127,10*Math.log10(Math.pow(e/255,2))).toFixed(2)}function MD(e,t){if("boolean"!=typeof e)throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be boolean type."))}function UD(e,t,r,i){if(void 0===r&&(r=1),void 0===i&&(i=Number.POSITIVE_INFINITY),e<r||e>i||"number"!=typeof e)throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,": the value range is [").concat(r,", ").concat(i,"]. integer only"))}function LD(e,t,r,i){if(void 0===r&&(r=1),void 0===i&&(i=Number.POSITIVE_INFINITY),null==e)throw new tw(ZN.INVALID_PARAMS,"".concat(t," cannot be empty"));if(!function(e,t,r){void 0===t&&(t=1);void 0===r&&(r=Number.POSITIVE_INFINITY);return"string"==typeof e&&e.length<=r&&e.length>=t}(e,r,i))throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,": The value should be string type. Length of the string: [").concat(r,",").concat(i,"]"))}function xD(e,t,r){if(!r.includes(e))throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,": The value can only be set as ").concat(JSON.stringify(r)))}function VD(e,t){if(jD(e))throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,", should not be empty"))}function FD(e,t){if(!(e instanceof ArrayBuffer))throw new tw(ZN.INVALID_PARAMS,"Invalid ".concat(t,", should be ArrayBuffer"))}function BD(e){var t,r;try{var i=navigator.mediaDevices.getSupportedConstraints();try{for(var n=rv(Object.keys(e)),o=n.next();!o.done;o=n.next()){var a=o.value;i[a]||delete e[a]}}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}catch(e){}}function jD(e){return null==e}function GD(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new tw(ZN.INVALID_PARAMS,"The userId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function HD(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new tw(ZN.INVALID_PARAMS,"The publicStreamId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}function zD(e){VD(e,"videoPlayerOption")}function KD(e,t){var r,i;if(void 0===t&&(t=64),!e||0===(null===(r=e)||void 0===r?void 0:r.byteLength))throw new tw(ZN.INVALID_PARAMS,"The message cannot be empty");if((null==(i=e instanceof ArrayBuffer?e:RD.str2ab(JSON.stringify(e)))?void 0:i.byteLength)>1e3*t)throw new tw(ZN.INVALID_PARAMS,"The message length must be less than ".concat(t,"K"))}function YD(e){return![wD.onRemoteStreamStats,wD.onLocalStreamStats].includes(e)}!function(e){e.onTrackEnded="onTrackEnded",e.onPlayerEvent="onPlayerEvent",e.onAutoplayFailed="onAutoplayFailed",e.onUserJoined="onUserJoined",e.onUserLeave="onUserLeave",e.onConnectionStateChanged="onConnectionStateChanged",e.onStreamAdd="onStreamAdd",e.onStreamRemove="onStreamRemove",e.onRoomMessageReceived="onRoomMessageReceived",e.onRoomBinaryMessageReceived="onRoomBinaryMessageReceived",e.onUserMessageReceived="onUserMessageReceived",e.onUserBinaryMessageReceived="onUserBinaryMessageReceived",e.onUserMuteAudio="onUserMuteAudio",e.onUserMuteVideo="onUserMuteVideo",e.onVideoFirstFrameRendered="onVideoFirstFrameRendered",e.onVideoFirstFrameDecoded="onVideoFirstFrameDecoded",e.onAudioFirstFrameDecoded="onAudioFirstFrameDecoded",e.onFirstPublicStreamVideoFrameRendered="onFirstPublicStreamVideoFrameRendered",e.onFirstPublicStreamVideoFrameDecoded="onFirstPublicStreamVideoFrameDecoded",e.onFirstPublicStreamAudioFrameDecoded="onFirstPublicStreamAudioFrameDecoded",e.onMediaDeviceStateChanged="onMediaDeviceStateChanged",e.onRemoteStreamStats="onRemoteStreamStats",e.onPublicStreamStats="onPublicStreamStats",e.onLocalStreamStats="onLocalStreamStats",e.onAudioVolumeIndication="onAudioVolumeIndication",e.onLocalAudioPropertiesReport="onLocalAudioPropertiesReport",e.onRemoteAudioPropertiesReport="onRemoteAudioPropertiesReport",e.onAudioPlaybackDeviceChanged="onAudioPlaybackDeviceChanged",e.onUserStartVideoCapture="onUserStartVideoCapture",e.onUserStopVideoCapture="onUserStopVideoCapture",e.onUserStartAudioCapture="onUserStartAudioCapture",e.onUserStopAudioCapture="onUserStopAudioCapture",e.onAutoPublishResult="onAutoPublishResult",e.onAutoSubscribeResult="onAutoSubscribeResult",e.onLiveTranscodingResult="onLiveTranscodingResult",e.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"}(wD||(wD={}));var XD={exports:{}};!function(e){var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function o(e,t,i,o,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var s=new n(i,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 i:delete e._events[t]}function s(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),s.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},s.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,o=i.length,a=new Array(o);n<o;n++)a[n]=i[n].fn;return a},s.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},s.prototype.emit=function(e,t,i,n,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,i),!0;case 4:return d.fn.call(d.context,t,i,n),!0;case 5:return d.fn.call(d.context,t,i,n,o),!0;case 6:return d.fn.call(d.context,t,i,n,o,a),!0}for(u=1,c=new Array(l-1);u<l;u++)c[u-1]=arguments[u];d.fn.apply(d.context,c)}else{var h,p=d.length;for(u=0;u<p;u++)switch(d[u].once&&this.removeListener(e,d[u].fn,void 0,!0),l){case 1:d[u].fn.call(d[u].context);break;case 2:d[u].fn.call(d[u].context,t);break;case 3:d[u].fn.call(d[u].context,t,i);break;case 4:d[u].fn.call(d[u].context,t,i,n);break;default:if(!c)for(h=1,c=new Array(l-1);h<l;h++)c[h-1]=arguments[h];d[u].fn.apply(d[u].context,c)}}return!0},s.prototype.on=function(e,t,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,i,n){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||n&&!s.once||i&&s.context!==i||a(this,o);else{for(var c=0,u=[],d=s.length;c<d;c++)(s[c].fn!==t||n&&!s[c].once||i&&s[c].context!==i)&&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 i,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}(XD);var WD=["#0050b3","#0050b3","#0050b3","#0050b3"],JD=!ID()&&window.location.search.includes("_rtc_debug_"),qD=function(){function e(e,t,r){this._module=e,this._indent=t}return e.prototype.print=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(JD){for(var i="",n=0;n<this._indent;n++)i+=" ";console.log.apply(console,nv(["%c".concat("[VERTC]").concat(i,"[").concat(this._module,".").concat(e,"] ").concat(t.shift()),"color:".concat(WD[this._indent],";")],iv(t),!1))}},e}(),ZD=new qD("VERTC",0),$D=function(e){function t(){return e.call(this)||this}return Z_(t,e),t.prototype.safeEmit=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];var n=this.listenerCount(t);try{return e.prototype.emit.apply(this,nv([t],iv(r),!1))}catch(e){return ZD.print("safaEmit","safeEmit() | event listener threw an error [event:%s]:%o",t,e),Boolean(n)}},t.prototype.safeEmitAsPromise=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return ev(this,void 0,void 0,(function(){var r=this;return tv(this,(function(i){return[2,new Promise((function(i,n){try{r.emit.apply(r,nv(nv([e],iv(t),!1),[i,n],!1))}catch(t){ZD.print("safeEmitAsPromise","safeEmitAsPromise() | event listener threw an error [event:%s]:%o",e,t),n(t)}}))]}))}))},t}(XD.exports.EventEmitter),QD=Ue,eP=function(e){return void 0!==e&&(QD(e,"value")||QD(e,"writable"))},tP=d,rP=j,iP=Dt,nP=eP,oP=n,aP=Zp;Bi({target:"Reflect",stat:!0},{get:function e(t,r){var i,n,o=arguments.length<3?t:arguments[2];return iP(t)===o?t[r]:(i=oP.f(t,r))?nP(i)?i.value:void 0===i.get?void 0:tP(i.get,o):rP(n=aP(t))?e(n,r,o):void 0}});var sP=Bi,cP=d,uP=Dt,dP=j,lP=eP,hP=Rt,pP=n,fP=Zp,_P=m;var vP,mP,SP,EP,yP,gP,bP,TP,IP,RP,AP,CP,OP,NP,wP,DP,PP,kP,MP,UP,LP=o((function(){var e=function(){},t=hP.f(new e,"a",{configurable:!0});return!1!==Reflect.set(e.prototype,"a",1,t)}));sP({target:"Reflect",stat:!0,forced:LP},{set:function e(t,r,i){var n,o,a,s=arguments.length<4?t:arguments[3],c=pP.f(uP(t),r);if(!c){if(dP(o=fP(t)))return e(o,r,i,s);c=_P(0)}if(lP(c)){if(!1===c.writable||!dP(s))return!1;if(n=pP.f(s,r)){if(n.get||n.set||!1===n.writable)return!1;n.value=i,hP.f(s,r,n)}else hP.f(s,r,_P(0,i))}else{if(void 0===(a=c.set))return!1;cP(a,s,i)}return!0}}),function(e){e[e.VIDEO_SOURCE_TYPE_EXTERNAL=0]="VIDEO_SOURCE_TYPE_EXTERNAL",e[e.VIDEO_SOURCE_TYPE_INTERNAL=1]="VIDEO_SOURCE_TYPE_INTERNAL"}(vP||(vP={})),function(e){e[e.AUDIO_SOURCE_TYPE_EXTERNAL=0]="AUDIO_SOURCE_TYPE_EXTERNAL",e[e.AUDIO_SOURCE_TYPE_INTERNAL=1]="AUDIO_SOURCE_TYPE_INTERNAL"}(mP||(mP={})),function(e){e[e.QUIT=0]="QUIT",e[e.DROPPED=1]="DROPPED",e[e.SWITCH_TO_INVISIBLE=2]="SWITCH_TO_INVISIBLE",e[e.KICKED_BY_ADMIN=3]="KICKED_BY_ADMIN"}(SP||(SP={})),function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(EP||(EP={})),function(e){e[e.AUTO_SUBSCRIBE_MODE=0]="AUTO_SUBSCRIBE_MODE",e[e.MANUAL_SUBSCRIBE_MODE=1]="MANUAL_SUBSCRIBE_MODE"}(yP||(yP={})),function(e){e[e.MUTE_STATE_OFF=0]="MUTE_STATE_OFF",e[e.MUTE_STATE_ON=1]="MUTE_STATE_ON"}(gP||(gP={})),function(e){e[e.SUBSCRIBE_SUCC=0]="SUBSCRIBE_SUCC",e[e.SUBSCRIBE_FAIL=1]="SUBSCRIBE_FAIL"}(bP||(bP={})),function(e){e[e.PUBLISH_SUCC=0]="PUBLISH_SUCC",e[e.PUBLISH_FAIL=1]="PUBLISH_FAIL"}(TP||(TP={})),function(e){e[e.MIRROR_MODE_OFF=0]="MIRROR_MODE_OFF",e[e.MIRROR_MODE_ON=1]="MIRROR_MODE_ON"}(IP||(IP={})),function(e){e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO=0]="RTC_PAUSE_RESUME_CONTROL_AUDIO",e[e.RTC_PAUSE_RESUME_CONTROL_VIDEO=1]="RTC_PAUSE_RESUME_CONTROL_VIDEO",e[e.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO=2]="RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO"}(RP||(RP={})),function(e){e[e.RENDER_MODE_HIDDEN=0]="RENDER_MODE_HIDDEN",e[e.RENDER_MODE_FIT=1]="RENDER_MODE_FIT"}(AP||(AP={})),function(e){e[e.STREAM_INDEX_MAIN=0]="STREAM_INDEX_MAIN",e[e.STREAM_INDEX_SCREEN=1]="STREAM_INDEX_SCREEN"}(CP||(CP={})),function(e){e[e.AUDIO_ONLY=0]="AUDIO_ONLY",e[e.VIDEO_ONLY=1]="VIDEO_ONLY",e[e.AUDIO_AND_VIDEO=2]="AUDIO_AND_VIDEO",e[e.NONE=3]="NONE"}(OP||(OP={})),function(e){e[e.STREAM_REMOVE_REASON_UNPUBLISH=0]="STREAM_REMOVE_REASON_UNPUBLISH",e[e.STREAM_REMOVE_REASON_PUBLISH_FAILED=1]="STREAM_REMOVE_REASON_PUBLISH_FAILED",e[e.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED=2]="STREAM_REMOVE_REASON_KEEP_LIVE_FAILED",e[e.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED=3]="STREAM_REMOVE_REASON_CLIENT_DISCONNECTED",e[e.STREAM_REMOVE_REASON_REPUBLISH=4]="STREAM_REMOVE_REASON_REPUBLISH",e[e.STREAM_REMOVE_REASON_OTHER=5]="STREAM_REMOVE_REASON_OTHER"}(NP||(NP={})),function(e){e[e.CONNECTION_START=0]="CONNECTION_START",e[e.CONNECTION_STATE_DISCONNECTED=1]="CONNECTION_STATE_DISCONNECTED",e[e.CONNECTION_STATE_CONNECTING=2]="CONNECTION_STATE_CONNECTING",e[e.CONNECTION_STATE_CONNECTED=3]="CONNECTION_STATE_CONNECTED",e[e.CONNECTION_STATE_RECONNECTING=4]="CONNECTION_STATE_RECONNECTING",e[e.CONNECTION_STATE_RECONNECTED=5]="CONNECTION_STATE_RECONNECTED"}(wP||(wP={})),function(e){e[e.MIRROR_TYPE_NONE=0]="MIRROR_TYPE_NONE",e[e.MIRROR_TYPE_RENDER=1]="MIRROR_TYPE_RENDER"}(DP||(DP={})),function(e){e[e.domestic=0]="domestic",e[e.overseas=1]="overseas"}(PP||(PP={})),function(e){e[e.OFFLINE=0]="OFFLINE",e[e.ONLINE=1]="ONLINE",e[e.UNREACHABLE=2]="UNREACHABLE"}(kP||(kP={})),function(e){e[e.AUDIO_AND_VIDEO=0]="AUDIO_AND_VIDEO",e[e.AUDIO_ONLY=1]="AUDIO_ONLY",e[e.VIDEO_ONLY=2]="VIDEO_ONLY"}(MP||(MP={})),function(e){e[e.PREV_FRAME=0]="PREV_FRAME",e[e.OTHER_FRAME=1]="OTHER_FRAME"}(UP||(UP={}));var xP="rtc-access.rtcplus.com,rtc-access-sg.rtcplus.com,rtc-access-va.rtcplus.com,rtc-access-fr.rtcplus.com".split(",");function VP(e){return void 0===e&&(e=""),"https://".concat(e,"/dispatch/v1/AccessInfo?Action=GetAccessInfo")}var FP="rtc.rtcplus.com".split(","),BP={VERSION:"4.42.1",ICE_CONFIG_REQUEST_URLS_INTERNAL:xP.map(VP),ICE_CONFIG_REQUEST_URLS:[],EXPECTED_ADDR:"",LOG_SERVER_URL:"https://web-log-report.rtcplus.com/video/v1/webrtc_log/",CONFIG_REQUEST_DOMAINS:FP};function jP(e,t){if("VERSION"!==e)return"ICE_CONFIG_REQUEST_URLS"===e?("string"==typeof t&&(t=[t]),void(BP.ICE_CONFIG_REQUEST_URLS=t.map(VP))):void("LOG_SERVER_URL"!==e||t!==PP.overseas?"LOG_SERVER_URL"!==e||t!==PP.domestic?"LOG_SERVER_URL"!==e||"string"!=typeof t?BP[e]=t:BP.LOG_SERVER_URL=t:BP.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/":BP.LOG_SERVER_URL="https://web-log-report.rtcplus.com/video/v1/webrtc_log/")}function GP(e){return BP[e]}function HP(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S;return{type:"transcode",action:e,transcodeMeta:{transcode:{url:t.url},audio:{codec:(null===(r=t.audio)||void 0===r?void 0:r.codec)||KP.audio.codec,bitRate:1e3*((null===(i=t.audio)||void 0===i?void 0:i.kBitRate)||KP.audio.kBitRate),sampleRate:1e3*((null===(n=t.audio)||void 0===n?void 0:n.sampleRate)||KP.audio.sampleRate),channels:(null===(o=t.audio)||void 0===o?void 0:o.channels)||KP.audio.channels,profile:(null===(a=t.audio)||void 0===a?void 0:a.AACProfile)||KP.audio.AACProfile},video:{codec:(null===(s=t.video)||void 0===s?void 0:s.codec)||KP.video.codec,fps:(null===(c=t.video)||void 0===c?void 0:c.fps)||KP.video.fps,gop:(null===(u=t.video)||void 0===u?void 0:u.gop)||KP.video.gop,lowLatency:null!==(l=null===(d=t.video)||void 0===d?void 0:d.lowLatency)&&void 0!==l?l:KP.video.lowLatency,bitRate:1e3*((null===(h=t.video)||void 0===h?void 0:h.kBitRate)||KP.video.kBitRate),width:(null===(p=t.video)||void 0===p?void 0:p.width)||KP.video.width,height:(null===(f=t.video)||void 0===f?void 0:f.height)||KP.video.height},layout:{canvas:{bgnd:(null===(_=t.layout)||void 0===_?void 0:_.backgroundColor)||KP.layout.backgroundColor},regions:(null===(m=null===(v=t.layout)||void 0===v?void 0:v.regions)||void 0===m?void 0:m.map((function(e){return{alpha:Math.min(Math.max(+e.alpha,0),1),uid:e.userId,zorder:e.zorder,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),renderMode:e.renderMode||1,contentControl:e.contentControl||0,screen:e.isScreenStream,local_user:e.isLocalUser}})))||[],app_data:(null===(S=t.layout)||void 0===S?void 0:S.appData)||KP.layout.appData}}}}function zP(e,t,r){var i,n,o,a,s,c,u,d,l;return{type:"publicstream",action:t,publicStreamID:e,publicStreamMeta:{audio:{},video:{fps:(null===(i=r.video)||void 0===i?void 0:i.fps)||15,bitrate:1e3*((null===(n=r.video)||void 0===n?void 0:n.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)||UP.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===(l=null===(d=r.layout)||void 0===d?void 0:d.regions)||void 0===l?void 0:l.map((function(e){return{roomId:e.roomId,userId:e.userId,alterImage:e.alertImage||"",alpha:e.alpha,x:Math.min(Math.max(+e.x,0),1),y:Math.min(Math.max(+e.y,0),1),w:Math.min(Math.max(+e.w,0),1),h:Math.min(Math.max(+e.h,0),1),zorder:e.zorder,renderMode:void 0===e.renderMode?1:e.renderMode,streamType:e.isScreenStream?1:0,mediaType:e.mediaType||0,sourceCrop:e.sourceCrop}})))||[]}}}}var KP={url:"",video:{codec:"H264",width:640,height:360,fps:30,gop:60,kBitRate:600,lowLatency:!0},audio:{codec:"AAC",kBitRate:64,sampleRate:48,channels:2,AACProfile:"LC"},layout:{regions:[],appData:"",backgroundColor:"#000000"}},YP={width:640,height:360,frameRate:30,maxKbps:600},XP={width:1920,height:1080,frameRate:15,maxKbps:3e3};(0,hR.exports)("Uint16",(function(e){return function(t,r,i){return e(this,t,r,i)}})),(0,hR.exports)("Int32",(function(e){return function(t,r,i){return e(this,t,r,i)}}));var WP={};!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=Array.prototype.slice.call(arguments,1);t.length;){var i=t.shift();if(i){if("object"!==us(i))throw new TypeError(i+"must be non-object");for(var n in i)r(i,n)&&(e[n]=i[n])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,r,i,n){if(t.subarray&&e.subarray)e.set(t.subarray(r,r+i),n);else for(var o=0;o<i;o++)e[n+o]=t[r+o]},flattenChunks:function(e){var t,r,i,n,o,a;for(i=0,t=0,r=e.length;t<r;t++)i+=e[t].length;for(a=new Uint8Array(i),n=0,t=0,r=e.length;t<r;t++)o=e[t],a.set(o,n),n+=o.length;return a}},n={arraySet:function(e,t,r,i,n){for(var o=0;o<i;o++)e[n+o]=t[r+o]},flattenChunks:function(e){return[].concat.apply([],e)}};e.setTyped=function(t){t?(e.Buf8=Uint8Array,e.Buf16=Uint16Array,e.Buf32=Int32Array,e.assign(e,i)):(e.Buf8=Array,e.Buf16=Array,e.Buf32=Array,e.assign(e,n))},e.setTyped(t)}(WP);var JP={},qP={},ZP={},$P=WP;function QP(e){for(var t=e.length;--t>=0;)e[t]=0}var ek=[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],tk=[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],rk=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],ik=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],nk=new Array(576);QP(nk);var ok=new Array(60);QP(ok);var ak=new Array(512);QP(ak);var sk=new Array(256);QP(sk);var ck=new Array(29);QP(ck);var uk,dk,lk,hk=new Array(30);function pk(e,t,r,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}function fk(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function _k(e){return e<256?ak[e]:ak[256+(e>>>7)]}function vk(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function mk(e,t,r){e.bi_valid>16-r?(e.bi_buf|=t<<e.bi_valid&65535,vk(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 Sk(e,t,r){mk(e,r[2*t],r[2*t+1])}function Ek(e,t){var r=0;do{r|=1&e,e>>>=1,r<<=1}while(--t>0);return r>>>1}function yk(e,t,r){var i,n,o=new Array(16),a=0;for(i=1;i<=15;i++)o[i]=a=a+r[i-1]<<1;for(n=0;n<=t;n++){var s=e[2*n+1];0!==s&&(e[2*n]=Ek(o[s]++,s))}}function gk(e){var t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;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 bk(e){e.bi_valid>8?vk(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 Tk(e,t,r,i){var n=2*t,o=2*r;return e[n]<e[o]||e[n]===e[o]&&i[t]<=i[r]}function Ik(e,t,r){for(var i=e.heap[r],n=r<<1;n<=e.heap_len&&(n<e.heap_len&&Tk(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!Tk(t,i,e.heap[n],e.depth));)e.heap[r]=e.heap[n],r=n,n<<=1;e.heap[r]=i}function Rk(e,t,r){var i,n,o,a,s=0;if(0!==e.last_lit)do{i=e.pending_buf[e.d_buf+2*s]<<8|e.pending_buf[e.d_buf+2*s+1],n=e.pending_buf[e.l_buf+s],s++,0===i?Sk(e,n,t):(Sk(e,(o=sk[n])+256+1,t),0!==(a=ek[o])&&mk(e,n-=ck[o],a),Sk(e,o=_k(--i),r),0!==(a=tk[o])&&mk(e,i-=hk[o],a))}while(s<e.last_lit);Sk(e,256,t)}function Ak(e,t){var r,i,n,o=t.dyn_tree,a=t.stat_desc.static_tree,s=t.stat_desc.has_stree,c=t.stat_desc.elems,u=-1;for(e.heap_len=0,e.heap_max=573,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*(n=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[n]=0,e.opt_len--,s&&(e.static_len-=a[2*n+1]);for(t.max_code=u,r=e.heap_len>>1;r>=1;r--)Ik(e,o,r);n=c;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ik(e,o,1),i=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=i,o[2*n]=o[2*r]+o[2*i],e.depth[n]=(e.depth[r]>=e.depth[i]?e.depth[r]:e.depth[i])+1,o[2*r+1]=o[2*i+1]=n,e.heap[1]=n++,Ik(e,o,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],function(e,t){var r,i,n,o,a,s,c=t.dyn_tree,u=t.max_code,d=t.stat_desc.static_tree,l=t.stat_desc.has_stree,h=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,f=t.stat_desc.max_length,_=0;for(o=0;o<=15;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*(i=e.heap[r])+1]+1]+1)>f&&(o=f,_++),c[2*i+1]=o,i>u||(e.bl_count[o]++,a=0,i>=p&&(a=h[i-p]),s=c[2*i],e.opt_len+=s*(o+a),l&&(e.static_len+=s*(d[2*i+1]+a)));if(0!==_){do{for(o=f-1;0===e.bl_count[o];)o--;e.bl_count[o]--,e.bl_count[o+1]+=2,e.bl_count[f]--,_-=2}while(_>0);for(o=f;0!==o;o--)for(i=e.bl_count[o];0!==i;)(n=e.heap[--r])>u||(c[2*n+1]!==o&&(e.opt_len+=(o-c[2*n+1])*c[2*n],c[2*n+1]=o),i--)}}(e,t),yk(o,u,e.bl_count)}function Ck(e,t,r){var i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),t[2*(r+1)+1]=65535,i=0;i<=r;i++)n=a,a=t[2*(i+1)+1],++s<c&&n===a||(s<u?e.bl_tree[2*n]+=s:0!==n?(n!==o&&e.bl_tree[2*n]++,e.bl_tree[32]++):s<=10?e.bl_tree[34]++:e.bl_tree[36]++,s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4))}function Ok(e,t,r){var i,n,o=-1,a=t[1],s=0,c=7,u=4;for(0===a&&(c=138,u=3),i=0;i<=r;i++)if(n=a,a=t[2*(i+1)+1],!(++s<c&&n===a)){if(s<u)do{Sk(e,n,e.bl_tree)}while(0!=--s);else 0!==n?(n!==o&&(Sk(e,n,e.bl_tree),s--),Sk(e,16,e.bl_tree),mk(e,s-3,2)):s<=10?(Sk(e,17,e.bl_tree),mk(e,s-3,3)):(Sk(e,18,e.bl_tree),mk(e,s-11,7));s=0,o=n,0===a?(c=138,u=3):n===a?(c=6,u=3):(c=7,u=4)}}QP(hk);var Nk=!1;function wk(e,t,r,i){mk(e,0+(i?1:0),3),function(e,t,r,i){bk(e),i&&(vk(e,r),vk(e,~r)),$P.arraySet(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}(e,t,r,!0)}ZP._tr_init=function(e){Nk||(!function(){var e,t,r,i,n,o=new Array(16);for(r=0,i=0;i<28;i++)for(ck[i]=r,e=0;e<1<<ek[i];e++)sk[r++]=i;for(sk[r-1]=i,n=0,i=0;i<16;i++)for(hk[i]=n,e=0;e<1<<tk[i];e++)ak[n++]=i;for(n>>=7;i<30;i++)for(hk[i]=n<<7,e=0;e<1<<tk[i]-7;e++)ak[256+n++]=i;for(t=0;t<=15;t++)o[t]=0;for(e=0;e<=143;)nk[2*e+1]=8,e++,o[8]++;for(;e<=255;)nk[2*e+1]=9,e++,o[9]++;for(;e<=279;)nk[2*e+1]=7,e++,o[7]++;for(;e<=287;)nk[2*e+1]=8,e++,o[8]++;for(yk(nk,287,o),e=0;e<30;e++)ok[2*e+1]=5,ok[2*e]=Ek(e,5);uk=new pk(nk,ek,257,286,15),dk=new pk(ok,tk,0,30,15),lk=new pk(new Array(0),rk,0,19,7)}(),Nk=!0),e.l_desc=new fk(e.dyn_ltree,uk),e.d_desc=new fk(e.dyn_dtree,dk),e.bl_desc=new fk(e.bl_tree,lk),e.bi_buf=0,e.bi_valid=0,gk(e)},ZP._tr_stored_block=wk,ZP._tr_flush_block=function(e,t,r,i){var n,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<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0}(e)),Ak(e,e.l_desc),Ak(e,e.d_desc),a=function(e){var t;for(Ck(e,e.dyn_ltree,e.l_desc.max_code),Ck(e,e.dyn_dtree,e.d_desc.max_code),Ak(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*ik[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),n=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=n&&(n=o)):n=o=r+5,r+4<=n&&-1!==t?wk(e,t,r,i):4===e.strategy||o===n?(mk(e,2+(i?1:0),3),Rk(e,nk,ok)):(mk(e,4+(i?1:0),3),function(e,t,r,i){var n;for(mk(e,t-257,5),mk(e,r-1,5),mk(e,i-4,4),n=0;n<i;n++)mk(e,e.bl_tree[2*ik[n]+1],3);Ok(e,e.dyn_ltree,t-1),Ok(e,e.dyn_dtree,r-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,a+1),Rk(e,e.dyn_ltree,e.dyn_dtree)),gk(e),i&&bk(e)},ZP._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*(sk[r]+256+1)]++,e.dyn_dtree[2*_k(t)]++),e.last_lit===e.lit_bufsize-1},ZP._tr_align=function(e){mk(e,2,3),Sk(e,256,nk),function(e){16===e.bi_valid?(vk(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 Dk=function(e,t,r,i){for(var n=65535&e|0,o=e>>>16&65535|0,a=0;0!==r;){r-=a=r>2e3?2e3:r;do{o=o+(n=n+t[i++]|0)|0}while(--a);n%=65521,o%=65521}return n|o<<16|0};var Pk=function(){for(var e,t=[],r=0;r<256;r++){e=r;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[r]=e}return t}();var kk,Mk=function(e,t,r,i){var n=Pk,o=i+r;e^=-1;for(var a=i;a<o;a++)e=e>>>8^n[255&(e^t[a])];return-1^e},Uk={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"},Lk=WP,xk=ZP,Vk=Dk,Fk=Mk,Bk=Uk;function jk(e,t){return e.msg=Bk[t],t}function Gk(e){return(e<<1)-(e>4?9:0)}function Hk(e){for(var t=e.length;--t>=0;)e[t]=0}function zk(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),0!==r&&(Lk.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 Kk(e,t){xk._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,zk(e.strm)}function Yk(e,t){e.pending_buf[e.pending++]=t}function Xk(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function Wk(e,t){var r,i,n=e.max_chain_length,o=e.strstart,a=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,u=e.window,d=e.w_mask,l=e.prev,h=e.strstart+258,p=u[o+a-1],f=u[o+a];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(u[(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(i=258-(h-o),o=h-258,i>a){if(e.match_start=t,a=i,i>=s)break;p=u[o+a-1],f=u[o+a]}}}while((t=l[t&d])>c&&0!=--n);return a<=e.lookahead?a:e.lookahead}function Jk(e){var t,r,i,n,o,a,s,c,u,d,l=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=l+(l-262)){Lk.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{i=e.head[--t],e.head[t]=i>=l?i-l:0}while(--r);t=r=l;do{i=e.prev[--t],e.prev[t]=i>=l?i-l:0}while(--r);n+=l}if(0===e.strm.avail_in)break;if(a=e.strm,s=e.window,c=e.strstart+e.lookahead,u=n,d=void 0,(d=a.avail_in)>u&&(d=u),r=0===d?0:(a.avail_in-=d,Lk.arraySet(s,a.input,a.next_in,d,c),1===a.state.wrap?a.adler=Vk(a.adler,s,d,c):2===a.state.wrap&&(a.adler=Fk(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<262&&0!==e.strm.avail_in)}function qk(e,t){for(var r,i;;){if(e.lookahead<262){if(Jk(e),e.lookahead<262&&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-262&&(e.match_length=Wk(e,r)),e.match_length>=3)if(i=xk._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 i=xk._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(Kk(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,4===t?(Kk(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Kk(e,!1),0===e.strm.avail_out)?1:2}function Zk(e,t){for(var r,i,n;;){if(e.lookahead<262){if(Jk(e),e.lookahead<262&&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-262&&(e.match_length=Wk(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){n=e.strstart+e.lookahead-3,i=xk._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+3-1])&e.hash_mask,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++,i&&(Kk(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((i=xk._tr_tally(e,0,e.window[e.strstart-1]))&&Kk(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&&(i=xk._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,4===t?(Kk(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Kk(e,!1),0===e.strm.avail_out)?1:2}function $k(e,t,r,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=i,this.func=n}function Qk(){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 Lk.Buf16(1146),this.dyn_dtree=new Lk.Buf16(122),this.bl_tree=new Lk.Buf16(78),Hk(this.dyn_ltree),Hk(this.dyn_dtree),Hk(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Lk.Buf16(16),this.heap=new Lk.Buf16(573),Hk(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Lk.Buf16(573),Hk(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 eM(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:113,e.adler=2===t.wrap?0:1,t.last_flush=0,xk._tr_init(t),0):jk(e,-2)}function tM(e){var t,r=eM(e);return 0===r&&((t=e.state).window_size=2*t.w_size,Hk(t.head),t.max_lazy_match=kk[t.level].max_lazy,t.good_match=kk[t.level].good_length,t.nice_match=kk[t.level].nice_length,t.max_chain_length=kk[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 rM(e,t,r,i,n,o){if(!e)return-2;var a=1;if(-1===t&&(t=6),i<0?(a=0,i=-i):i>15&&(a=2,i-=16),n<1||n>9||8!==r||i<8||i>15||t<0||t>9||o<0||o>4)return jk(e,-2);8===i&&(i=9);var s=new Qk;return e.state=s,s.strm=e,s.wrap=a,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+3-1)/3),s.window=new Lk.Buf8(2*s.w_size),s.head=new Lk.Buf16(s.hash_size),s.prev=new Lk.Buf16(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=4*s.lit_bufsize,s.pending_buf=new Lk.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,tM(e)}kk=[new $k(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(Jk(e),0===e.lookahead&&0===t)return 1;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+r;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,Kk(e,!1),0===e.strm.avail_out))return 1;if(e.strstart-e.block_start>=e.w_size-262&&(Kk(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Kk(e,!0),0===e.strm.avail_out?3:4):(e.strstart>e.block_start&&(Kk(e,!1),e.strm.avail_out),1)})),new $k(4,4,8,4,qk),new $k(4,5,16,8,qk),new $k(4,6,32,32,qk),new $k(4,4,16,16,Zk),new $k(8,16,32,32,Zk),new $k(8,16,128,128,Zk),new $k(8,32,128,256,Zk),new $k(32,128,258,1024,Zk),new $k(32,258,258,4096,Zk)],qP.deflateInit=function(e,t){return rM(e,t,8,15,8,0)},qP.deflateInit2=rM,qP.deflateReset=tM,qP.deflateResetKeep=eM,qP.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?-2:(e.state.gzhead=t,0):-2},qP.deflate=function(e,t){var r,i,n,o;if(!e||!e.state||t>5||t<0)return e?jk(e,-2):-2;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||666===i.status&&4!==t)return jk(e,0===e.avail_out?-5:-2);if(i.strm=e,r=i.last_flush,i.last_flush=t,42===i.status)if(2===i.wrap)e.adler=0,Yk(i,31),Yk(i,139),Yk(i,8),i.gzhead?(Yk(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Yk(i,255&i.gzhead.time),Yk(i,i.gzhead.time>>8&255),Yk(i,i.gzhead.time>>16&255),Yk(i,i.gzhead.time>>24&255),Yk(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),Yk(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(Yk(i,255&i.gzhead.extra.length),Yk(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=Fk(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(Yk(i,0),Yk(i,0),Yk(i,0),Yk(i,0),Yk(i,0),Yk(i,9===i.level?2:i.strategy>=2||i.level<2?4:0),Yk(i,3),i.status=113);else{var a=8+(i.w_bits-8<<4)<<8;a|=(i.strategy>=2||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(a|=32),a+=31-a%31,i.status=113,Xk(i,a),0!==i.strstart&&(Xk(i,e.adler>>>16),Xk(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(n=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>n&&(e.adler=Fk(e.adler,i.pending_buf,i.pending-n,n)),zk(e),n=i.pending,i.pending!==i.pending_buf_size));)Yk(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>n&&(e.adler=Fk(e.adler,i.pending_buf,i.pending-n,n)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(e.adler=Fk(e.adler,i.pending_buf,i.pending-n,n)),zk(e),n=i.pending,i.pending===i.pending_buf_size)){o=1;break}o=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,Yk(i,o)}while(0!==o);i.gzhead.hcrc&&i.pending>n&&(e.adler=Fk(e.adler,i.pending_buf,i.pending-n,n)),0===o&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){n=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>n&&(e.adler=Fk(e.adler,i.pending_buf,i.pending-n,n)),zk(e),n=i.pending,i.pending===i.pending_buf_size)){o=1;break}o=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,Yk(i,o)}while(0!==o);i.gzhead.hcrc&&i.pending>n&&(e.adler=Fk(e.adler,i.pending_buf,i.pending-n,n)),0===o&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&zk(e),i.pending+2<=i.pending_buf_size&&(Yk(i,255&e.adler),Yk(i,e.adler>>8&255),e.adler=0,i.status=113)):i.status=113),0!==i.pending){if(zk(e),0===e.avail_out)return i.last_flush=-1,0}else if(0===e.avail_in&&Gk(t)<=Gk(r)&&4!==t)return jk(e,-5);if(666===i.status&&0!==e.avail_in)return jk(e,-5);if(0!==e.avail_in||0!==i.lookahead||0!==t&&666!==i.status){var s=2===i.strategy?function(e,t){for(var r;;){if(0===e.lookahead&&(Jk(e),0===e.lookahead)){if(0===t)return 1;break}if(e.match_length=0,r=xk._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Kk(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Kk(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Kk(e,!1),0===e.strm.avail_out)?1:2}(i,t):3===i.strategy?function(e,t){for(var r,i,n,o,a=e.window;;){if(e.lookahead<=258){if(Jk(e),e.lookahead<=258&&0===t)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=a[n=e.strstart-1])===a[++n]&&i===a[++n]&&i===a[++n]){o=e.strstart+258;do{}while(i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&i===a[++n]&&n<o);e.match_length=258-(o-n),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(r=xk._tr_tally(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=xk._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Kk(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,4===t?(Kk(e,!0),0===e.strm.avail_out?3:4):e.last_lit&&(Kk(e,!1),0===e.strm.avail_out)?1:2}(i,t):kk[i.level].func(i,t);if(3!==s&&4!==s||(i.status=666),1===s||3===s)return 0===e.avail_out&&(i.last_flush=-1),0;if(2===s&&(1===t?xk._tr_align(i):5!==t&&(xk._tr_stored_block(i,0,0,!1),3===t&&(Hk(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),zk(e),0===e.avail_out))return i.last_flush=-1,0}return 4!==t?0:i.wrap<=0?1:(2===i.wrap?(Yk(i,255&e.adler),Yk(i,e.adler>>8&255),Yk(i,e.adler>>16&255),Yk(i,e.adler>>24&255),Yk(i,255&e.total_in),Yk(i,e.total_in>>8&255),Yk(i,e.total_in>>16&255),Yk(i,e.total_in>>24&255)):(Xk(i,e.adler>>>16),Xk(i,65535&e.adler)),zk(e),i.wrap>0&&(i.wrap=-i.wrap),0!==i.pending?0:1)},qP.deflateEnd=function(e){var t;return e&&e.state?42!==(t=e.state.status)&&69!==t&&73!==t&&91!==t&&103!==t&&113!==t&&666!==t?jk(e,-2):(e.state=null,113===t?jk(e,-3):0):-2},qP.deflateSetDictionary=function(e,t){var r,i,n,o,a,s,c,u,d=t.length;if(!e||!e.state)return-2;if(2===(o=(r=e.state).wrap)||1===o&&42!==r.status||r.lookahead)return-2;for(1===o&&(e.adler=Vk(e.adler,t,d,0)),r.wrap=0,d>=r.w_size&&(0===o&&(Hk(r.head),r.strstart=0,r.block_start=0,r.insert=0),u=new Lk.Buf8(r.w_size),Lk.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,Jk(r);r.lookahead>=3;){i=r.strstart,n=r.lookahead-2;do{r.ins_h=(r.ins_h<<r.hash_shift^r.window[i+3-1])&r.hash_mask,r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++}while(--n);r.strstart=i,r.lookahead=2,Jk(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},qP.deflateInfo="pako deflate (from Nodeca project)";var iM={},nM=WP,oM=!0,aM=!0;try{String.fromCharCode.apply(null,[0])}catch(e){oM=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){aM=!1}for(var sM=new nM.Buf8(256),cM=0;cM<256;cM++)sM[cM]=cM>=252?6:cM>=248?5:cM>=240?4:cM>=224?3:cM>=192?2:1;function uM(e,t){if(t<65534&&(e.subarray&&aM||!e.subarray&&oM))return String.fromCharCode.apply(null,nM.shrinkBuf(e,t));for(var r="",i=0;i<t;i++)r+=String.fromCharCode(e[i]);return r}sM[254]=sM[254]=1,iM.string2buf=function(e){var t,r,i,n,o,a=e.length,s=0;for(n=0;n<a;n++)55296==(64512&(r=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=e.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),s+=r<128?1:r<2048?2:r<65536?3:4;for(t=new nM.Buf8(s),o=0,n=0;o<s;n++)55296==(64512&(r=e.charCodeAt(n)))&&n+1<a&&56320==(64512&(i=e.charCodeAt(n+1)))&&(r=65536+(r-55296<<10)+(i-56320),n++),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},iM.buf2binstring=function(e){return uM(e,e.length)},iM.binstring2buf=function(e){for(var t=new nM.Buf8(e.length),r=0,i=t.length;r<i;r++)t[r]=e.charCodeAt(r);return t},iM.buf2string=function(e,t){var r,i,n,o,a=t||e.length,s=new Array(2*a);for(i=0,r=0;r<a;)if((n=e[r++])<128)s[i++]=n;else if((o=sM[n])>4)s[i++]=65533,r+=o-1;else{for(n&=2===o?31:3===o?15:7;o>1&&r<a;)n=n<<6|63&e[r++],o--;o>1?s[i++]=65533:n<65536?s[i++]=n:(n-=65536,s[i++]=55296|n>>10&1023,s[i++]=56320|1023&n)}return uM(s,i)},iM.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+sM[e[r]]>t?r:t};var dM=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},lM=qP,hM=WP,pM=iM,fM=Uk,_M=dM,vM=Object.prototype.toString;function mM(e){if(!(this instanceof mM))return new mM(e);this.options=hM.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 _M,this.strm.avail_out=0;var r=lM.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(0!==r)throw new Error(fM[r]);if(t.header&&lM.deflateSetHeader(this.strm,t.header),t.dictionary){var i;if(i="string"==typeof t.dictionary?pM.string2buf(t.dictionary):"[object ArrayBuffer]"===vM.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,0!==(r=lM.deflateSetDictionary(this.strm,i)))throw new Error(fM[r]);this._dict_set=!0}}function SM(e,t){var r=new mM(t);if(r.push(e,!0),r.err)throw r.msg||fM[r.err];return r.result}mM.prototype.push=function(e,t){var r,i,n=this.strm,o=this.options.chunkSize;if(this.ended)return!1;i=t===~~t?t:!0===t?4:0,"string"==typeof e?n.input=pM.string2buf(e):"[object ArrayBuffer]"===vM.call(e)?n.input=new Uint8Array(e):n.input=e,n.next_in=0,n.avail_in=n.input.length;do{if(0===n.avail_out&&(n.output=new hM.Buf8(o),n.next_out=0,n.avail_out=o),1!==(r=lM.deflate(n,i))&&0!==r)return this.onEnd(r),this.ended=!0,!1;0!==n.avail_out&&(0!==n.avail_in||4!==i&&2!==i)||("string"===this.options.to?this.onData(pM.buf2binstring(hM.shrinkBuf(n.output,n.next_out))):this.onData(hM.shrinkBuf(n.output,n.next_out)))}while((n.avail_in>0||0===n.avail_out)&&1!==r);return 4===i?(r=lM.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,0===r):2!==i||(this.onEnd(0),n.avail_out=0,!0)},mM.prototype.onData=function(e){this.chunks.push(e)},mM.prototype.onEnd=function(e){0===e&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=hM.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},JP.Deflate=mM,JP.deflate=SM,JP.deflateRaw=function(e,t){return(t=t||{}).raw=!0,SM(e,t)},JP.gzip=function(e,t){return(t=t||{}).gzip=!0,SM(e,t)};var EM={},yM=a,gM=Rt,bM=aa,TM=o,IM=RegExp.prototype;yM&&TM((function(){return"sy"!==Object.getOwnPropertyDescriptor(IM,"flags").get.call({dotAll:!0,sticky:!0})}))&&gM.f(IM,"flags",{configurable:!0,get:bM});var RM={},AM=WP,CM=[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],OM=[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],NM=[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],wM=[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],DM=WP,PM=Dk,kM=Mk,MM=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A;r=e.state,i=e.next_in,R=e.input,n=i+(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,_=r.lencode,v=r.distcode,m=(1<<r.lenbits)-1,S=(1<<r.distbits)-1;e:do{f<15&&(p+=R[i++]<<f,f+=8,p+=R[i++]<<f,f+=8),E=_[p&m];t:for(;;){if(p>>>=y=E>>>24,f-=y,0===(y=E>>>16&255))A[o++]=65535&E;else{if(!(16&y)){if(0==(64&y)){E=_[(65535&E)+(p&(1<<y)-1)];continue t}if(32&y){r.mode=12;break e}e.msg="invalid literal/length code",r.mode=30;break e}g=65535&E,(y&=15)&&(f<y&&(p+=R[i++]<<f,f+=8),g+=p&(1<<y)-1,p>>>=y,f-=y),f<15&&(p+=R[i++]<<f,f+=8,p+=R[i++]<<f,f+=8),E=v[p&S];r:for(;;){if(p>>>=y=E>>>24,f-=y,!(16&(y=E>>>16&255))){if(0==(64&y)){E=v[(65535&E)+(p&(1<<y)-1)];continue r}e.msg="invalid distance code",r.mode=30;break e}if(b=65535&E,f<(y&=15)&&(p+=R[i++]<<f,(f+=8)<y&&(p+=R[i++]<<f,f+=8)),(b+=p&(1<<y)-1)>c){e.msg="invalid distance too far back",r.mode=30;break e}if(p>>>=y,f-=y,b>(y=o-a)){if((y=b-y)>d&&r.sane){e.msg="invalid distance too far back",r.mode=30;break e}if(T=0,I=h,0===l){if(T+=u-y,y<g){g-=y;do{A[o++]=h[T++]}while(--y);T=o-b,I=A}}else if(l<y){if(T+=u+l-y,(y-=l)<g){g-=y;do{A[o++]=h[T++]}while(--y);if(T=0,l<g){g-=y=l;do{A[o++]=h[T++]}while(--y);T=o-b,I=A}}}else if(T+=l-y,y<g){g-=y;do{A[o++]=h[T++]}while(--y);T=o-b,I=A}for(;g>2;)A[o++]=I[T++],A[o++]=I[T++],A[o++]=I[T++],g-=3;g&&(A[o++]=I[T++],g>1&&(A[o++]=I[T++]))}else{T=o-b;do{A[o++]=A[T++],A[o++]=A[T++],A[o++]=A[T++],g-=3}while(g>2);g&&(A[o++]=A[T++],g>1&&(A[o++]=A[T++]))}break}}break}}while(i<n&&o<s);i-=g=f>>3,p&=(1<<(f-=g<<3))-1,e.next_in=i,e.next_out=o,e.avail_in=i<n?n-i+5:5-(i-n),e.avail_out=o<s?s-o+257:257-(o-s),r.hold=p,r.bits=f},UM=function(e,t,r,i,n,o,a,s){var c,u,d,l,h,p,f,_,v,m=s.bits,S=0,E=0,y=0,g=0,b=0,T=0,I=0,R=0,A=0,C=0,O=null,N=0,w=new AM.Buf16(16),D=new AM.Buf16(16),P=null,k=0;for(S=0;S<=15;S++)w[S]=0;for(E=0;E<i;E++)w[t[r+E]]++;for(b=m,g=15;g>=1&&0===w[g];g--);if(b>g&&(b=g),0===g)return n[o++]=20971520,n[o++]=20971520,s.bits=1,0;for(y=1;y<g&&0===w[y];y++);for(b<y&&(b=y),R=1,S=1;S<=15;S++)if(R<<=1,(R-=w[S])<0)return-1;if(R>0&&(0===e||1!==g))return-1;for(D[1]=0,S=1;S<15;S++)D[S+1]=D[S]+w[S];for(E=0;E<i;E++)0!==t[r+E]&&(a[D[t[r+E]]++]=E);if(0===e?(O=P=a,p=19):1===e?(O=CM,N-=257,P=OM,k-=257,p=256):(O=NM,P=wM,p=-1),C=0,E=0,S=y,h=o,T=b,I=0,d=-1,l=(A=1<<b)-1,1===e&&A>852||2===e&&A>592)return 1;for(;;){f=S-I,a[E]<p?(_=0,v=a[E]):a[E]>p?(_=P[k+a[E]],v=O[N+a[E]]):(_=96,v=0),c=1<<S-I,y=u=1<<T;do{n[h+(C>>I)+(u-=c)]=f<<24|_<<16|v|0}while(0!==u);for(c=1<<S-1;C&c;)c>>=1;if(0!==c?(C&=c-1,C+=c):C=0,E++,0==--w[S]){if(S===g)break;S=t[r+a[E]]}if(S>b&&(C&l)!==d){for(0===I&&(I=b),h+=y,R=1<<(T=S-I);T+I<g&&!((R-=w[T+I])<=0);)T++,R<<=1;if(A+=1<<T,1===e&&A>852||2===e&&A>592)return 1;n[d=C&l]=b<<24|T<<16|h-o|0}}return 0!==C&&(n[h+C]=S-I<<24|64<<16|0),s.bits=b,0};function LM(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function xM(){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 DM.Buf16(320),this.work=new DM.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function VM(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 DM.Buf32(852),t.distcode=t.distdyn=new DM.Buf32(592),t.sane=1,t.back=-1,0):-2}function FM(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,VM(e)):-2}function BM(e,t){var r,i;return e&&e.state?(i=e.state,t<0?(r=0,t=-t):(r=1+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?-2:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=r,i.wbits=t,FM(e))):-2}function jM(e,t){var r,i;return e?(i=new xM,e.state=i,i.window=null,0!==(r=BM(e,t))&&(e.state=null),r):-2}var GM,HM,zM=!0;function KM(e){if(zM){var t;for(GM=new DM.Buf32(512),HM=new DM.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(UM(1,e.lens,0,288,GM,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;UM(2,e.lens,0,32,HM,0,e.work,{bits:5}),zM=!1}e.lencode=GM,e.lenbits=9,e.distcode=HM,e.distbits=5}function YM(e,t,r,i){var n,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new DM.Buf8(o.wsize)),i>=o.wsize?(DM.arraySet(o.window,t,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):((n=o.wsize-o.wnext)>i&&(n=i),DM.arraySet(o.window,t,r-i,n,o.wnext),(i-=n)?(DM.arraySet(o.window,t,r-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=n,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=n))),0}RM.inflateReset=FM,RM.inflateReset2=BM,RM.inflateResetKeep=VM,RM.inflateInit=function(e){return jM(e,15)},RM.inflateInit2=jM,RM.inflate=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A=0,C=new DM.Buf8(4),O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return-2;12===(r=e.state).mode&&(r.mode=13),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,d=r.bits,l=s,h=c,T=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+=i[o++]<<d,d+=8}if(2&r.wrap&&35615===u){r.check=0,C[0]=255&u,C[1]=u>>>8&255,r.check=kM(r.check,C,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=30;break}if(8!=(15&u)){e.msg="unknown compression method",r.mode=30;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=30;break}r.dmax=1<<b,e.adler=r.check=1,r.mode=512&u?10:12,u=0,d=0;break;case 2:for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(r.flags=u,8!=(255&r.flags)){e.msg="unknown compression method",r.mode=30;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=30;break}r.head&&(r.head.text=u>>8&1),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=kM(r.check,C,2,0)),u=0,d=0,r.mode=3;case 3:for(;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.head&&(r.head.time=u),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,C[2]=u>>>16&255,C[3]=u>>>24&255,r.check=kM(r.check,C,4,0)),u=0,d=0,r.mode=4;case 4:for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.head&&(r.head.xflags=255&u,r.head.os=u>>8),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=kM(r.check,C,2,0)),u=0,d=0,r.mode=5;case 5:if(1024&r.flags){for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.length=u,r.head&&(r.head.extra_len=u),512&r.flags&&(C[0]=255&u,C[1]=u>>>8&255,r.check=kM(r.check,C,2,0)),u=0,d=0}else r.head&&(r.head.extra=null);r.mode=6;case 6:if(1024&r.flags&&((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)),DM.arraySet(r.head.extra,i,o,p,b)),512&r.flags&&(r.check=kM(r.check,i,p,o)),s-=p,o+=p,r.length-=p),r.length))break e;r.length=0,r.mode=7;case 7:if(2048&r.flags){if(0===s)break e;p=0;do{b=i[o+p++],r.head&&b&&r.length<65536&&(r.head.name+=String.fromCharCode(b))}while(b&&p<s);if(512&r.flags&&(r.check=kM(r.check,i,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&r.flags){if(0===s)break e;p=0;do{b=i[o+p++],r.head&&b&&r.length<65536&&(r.head.comment+=String.fromCharCode(b))}while(b&&p<s);if(512&r.flags&&(r.check=kM(r.check,i,p,o)),s-=p,o+=p,b)break e}else r.head&&(r.head.comment=null);r.mode=9;case 9:if(512&r.flags){for(;d<16;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(u!==(65535&r.check)){e.msg="header crc mismatch",r.mode=30;break}u=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=12;break;case 10:for(;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}e.adler=r.check=LM(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=12;case 12: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+=i[o++]<<d,d+=8}switch(r.last=1&u,d-=1,3&(u>>>=1)){case 0:r.mode=14;break;case 1:if(KM(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=30}u>>>=2,d-=2;break;case 14:for(u>>>=7&d,d-=7&d;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if((65535&u)!=(u>>>16^65535)){e.msg="invalid stored block lengths",r.mode=30;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;DM.arraySet(n,i,o,p,a),s-=p,o+=p,c-=p,a+=p,r.length-=p;break}r.mode=12;break;case 17:for(;d<14;){if(0===s)break e;s--,u+=i[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=30;break}r.have=0,r.mode=18;case 18:for(;r.have<r.ncode;){for(;d<3;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}r.lens[O[r.have++]]=7&u,u>>>=3,d-=3}for(;r.have<19;)r.lens[O[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,I={bits:r.lenbits},T=UM(0,r.lens,0,19,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid code lengths set",r.mode=30;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,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(S<16)u>>>=v,d-=v,r.lens[r.have++]=S;else{if(16===S){for(R=v+2;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(u>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=30;break}b=r.lens[r.have-1],p=3+(3&u),u>>>=2,d-=2}else if(17===S){for(R=v+3;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}d-=v,b=0,p=3+(7&(u>>>=v)),u>>>=3,d-=3}else{for(R=v+7;d<R;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}d-=v,b=0,p=11+(127&(u>>>=v)),u>>>=7,d-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=30;break}for(;p--;)r.lens[r.have++]=b}}if(30===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=30;break}if(r.lenbits=9,I={bits:r.lenbits},T=UM(1,r.lens,0,r.nlen,r.lencode,0,r.work,I),r.lenbits=I.bits,T){e.msg="invalid literal/lengths set",r.mode=30;break}if(r.distbits=6,r.distcode=r.distdyn,I={bits:r.distbits},T=UM(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,I),r.distbits=I.bits,T){e.msg="invalid distances set",r.mode=30;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,MM(e,h),a=e.next_out,n=e.output,c=e.avail_out,o=e.next_in,i=e.input,s=e.avail_in,u=r.hold,d=r.bits,12===r.mode&&(r.back=-1);break}for(r.back=0;m=(A=r.lencode[u&(1<<r.lenbits)-1])>>>16&255,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(m&&0==(240&m)){for(E=v,y=m,g=S;m=(A=r.lencode[g+((u&(1<<E+y)-1)>>E)])>>>16&255,S=65535&A,!(E+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}u>>>=E,d-=E,r.back+=E}if(u>>>=v,d-=v,r.back+=v,r.length=S,0===m){r.mode=26;break}if(32&m){r.back=-1,r.mode=12;break}if(64&m){e.msg="invalid literal/length code",r.mode=30;break}r.extra=15&m,r.mode=22;case 22:if(r.extra){for(R=r.extra;d<R;){if(0===s)break e;s--,u+=i[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,S=65535&A,!((v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(0==(240&m)){for(E=v,y=m,g=S;m=(A=r.distcode[g+((u&(1<<E+y)-1)>>E)])>>>16&255,S=65535&A,!(E+(v=A>>>24)<=d);){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}u>>>=E,d-=E,r.back+=E}if(u>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=30;break}r.offset=S,r.extra=15&m,r.mode=24;case 24:if(r.extra){for(R=r.extra;d<R;){if(0===s)break e;s--,u+=i[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=30;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=30;break}p>r.wnext?(p-=r.wnext,f=r.wsize-p):f=r.wnext-p,p>r.length&&(p=r.length),_=r.window}else _=n,f=a-r.offset,p=r.length;p>c&&(p=c),c-=p,r.length-=p;do{n[a++]=_[f++]}while(--p);0===r.length&&(r.mode=21);break;case 26:if(0===c)break e;n[a++]=r.length,c--,r.mode=21;break;case 27:if(r.wrap){for(;d<32;){if(0===s)break e;s--,u|=i[o++]<<d,d+=8}if(h-=c,e.total_out+=h,r.total+=h,h&&(e.adler=r.check=r.flags?kM(r.check,n,h,a-h):PM(r.check,n,h,a-h)),h=c,(r.flags?u:LM(u))!==r.check){e.msg="incorrect data check",r.mode=30;break}u=0,d=0}r.mode=28;case 28:if(r.wrap&&r.flags){for(;d<32;){if(0===s)break e;s--,u+=i[o++]<<d,d+=8}if(u!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=30;break}u=0,d=0}r.mode=29;case 29:T=1;break e;case 30:T=-3;break e;case 31:return-4;default:return-2}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<30&&(r.mode<27||4!==t))&&YM(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=r.flags?kM(r.check,n,h,e.next_out-h):PM(r.check,n,h,e.next_out-h)),e.data_type=r.bits+(r.last?64:0)+(12===r.mode?128:0)+(20===r.mode||15===r.mode?256:0),(0===l&&0===h||4===t)&&0===T&&(T=-5),T},RM.inflateEnd=function(e){if(!e||!e.state)return-2;var t=e.state;return t.window&&(t.window=null),e.state=null,0},RM.inflateGetHeader=function(e,t){var r;return e&&e.state?0==(2&(r=e.state).wrap)?-2:(r.head=t,t.done=!1,0):-2},RM.inflateSetDictionary=function(e,t){var r,i=t.length;return e&&e.state?0!==(r=e.state).wrap&&11!==r.mode?-2:11===r.mode&&PM(1,t,i,0)!==r.check?-3:YM(e,t,i,i)?(r.mode=31,-4):(r.havedict=1,0):-2},RM.inflateInfo="pako inflate (from Nodeca project)";var XM={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 WM=RM,JM=WP,qM=iM,ZM=XM,$M=Uk,QM=dM,eU=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},tU=Object.prototype.toString;function rU(e){if(!(this instanceof rU))return new rU(e);this.options=JM.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 QM,this.strm.avail_out=0;var r=WM.inflateInit2(this.strm,t.windowBits);if(r!==ZM.Z_OK)throw new Error($M[r]);if(this.header=new eU,WM.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=qM.string2buf(t.dictionary):"[object ArrayBuffer]"===tU.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(r=WM.inflateSetDictionary(this.strm,t.dictionary))!==ZM.Z_OK))throw new Error($M[r])}function iU(e,t){var r=new rU(t);if(r.push(e,!0),r.err)throw r.msg||$M[r.err];return r.result}rU.prototype.push=function(e,t){var r,i,n,o,a,s=this.strm,c=this.options.chunkSize,u=this.options.dictionary,d=!1;if(this.ended)return!1;i=t===~~t?t:!0===t?ZM.Z_FINISH:ZM.Z_NO_FLUSH,"string"==typeof e?s.input=qM.binstring2buf(e):"[object ArrayBuffer]"===tU.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 JM.Buf8(c),s.next_out=0,s.avail_out=c),(r=WM.inflate(s,ZM.Z_NO_FLUSH))===ZM.Z_NEED_DICT&&u&&(r=WM.inflateSetDictionary(this.strm,u)),r===ZM.Z_BUF_ERROR&&!0===d&&(r=ZM.Z_OK,d=!1),r!==ZM.Z_STREAM_END&&r!==ZM.Z_OK)return this.onEnd(r),this.ended=!0,!1;s.next_out&&(0!==s.avail_out&&r!==ZM.Z_STREAM_END&&(0!==s.avail_in||i!==ZM.Z_FINISH&&i!==ZM.Z_SYNC_FLUSH)||("string"===this.options.to?(n=qM.utf8border(s.output,s.next_out),o=s.next_out-n,a=qM.buf2string(s.output,n),s.next_out=o,s.avail_out=c-o,o&&JM.arraySet(s.output,s.output,n,o,0),this.onData(a)):this.onData(JM.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!==ZM.Z_STREAM_END);return r===ZM.Z_STREAM_END&&(i=ZM.Z_FINISH),i===ZM.Z_FINISH?(r=WM.inflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===ZM.Z_OK):i!==ZM.Z_SYNC_FLUSH||(this.onEnd(ZM.Z_OK),s.avail_out=0,!0)},rU.prototype.onData=function(e){this.chunks.push(e)},rU.prototype.onEnd=function(e){e===ZM.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=JM.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},EM.Inflate=rU,EM.inflate=iU,EM.inflateRaw=function(e,t){return(t=t||{}).raw=!0,iU(e,t)},EM.ungzip=iU;var nU={};(0,WP.assign)(nU,JP,EM,XM);var oU,aU,sU,cU,uU,dU,lU,hU,pU,fU,_U,vU,mU,SU,EU,yU,gU,bU,TU,IU,RU,AU,CU,OU,NU,wU,DU,PU,kU,MU,UU,LU,xU,VU,FU,BU,jU,GU,HU,zU,KU,YU,XU,WU,JU,qU,ZU,$U=nU,QU=new qD("monitor",0);!function(e){e.RTC_SDK_API_CALL="rtc_sdk_api_call",e.RTC_SDK_CALLBACK="rtc_sdk_callback",e.RTC_GET_CONFIG="rtc_get_config",e.RTC_RECONNECT="rtc_reconnect",e.RTC_RECONNECTED="rtc_reconnected",e.RTC_GET_ACCESS="rtc_get_access",e.RTC_PRE_ICE_STATE="rtc_pre_ice_state",e.RTC_NODE_CHANGE="rtc_node_change",e.RTC_SIGNALING_MSG_ERROR="rtc_signaling_msg_error",e.RTC_SIGNALING="rtc_signaling",e.RTC_JOIN_ROOM="rtc_join_room",e.RTC_LEAVE_ROOM="rtc_leave_room",e.RTC_BEGIN_CREATE_OFFER="rtc_begin_create_offer",e.RTC_CREATE_OFFER="rtc_create_offer",e.RTC_SET_DESCRIPTION="rtc_set_description",e.RTC_RECV_ANSWER="rtc_recv_answer",e.FIRST_REMOTE_AUDIO_RENDER="first_remote_audio_render",e.FIRST_REMOTE_VIDEO_RENDER="first_remote_video_render",e.RTC_PUBLISH_STAT="rtc_publish_stat",e.RTC_SUBSCRIBE_STAT="rtc_subscribe_stat",e.RTC_AUDIO_DEVICE="rtc_audio_device",e.RTC_MEDIA_STATISTICS="rtc_media_statistics",e.RTC_MESSAGE_STATISTICS="rtc_message_statistics",e.RTC_ERROR="rtc_error",e.RTC_INVOKE_STATUS="rtc_invoke_status",e.RTC_FIRST_FRAME="rtc_first_frame",e.RTC_MUTE_REMOTE="rtc_mute_remote",e.SDK_INIT_ENGINE="sdk_init_engine",e.JOIN_ROOM="join_room",e.P2P_CONNECTION_STATUS="p2p_connection_status",e.P2P_CONNECT_CLOSED="p2p_connect_closed",e.RTC_DEVICE_ERROR="rtc_device_error",e.RTC_VIDEO_DEVICE="rtc_video_device",e.RTC_VIDEO_CAPTURE_EVENT="rtc_video_capture_event",e.RTC_ENCODE_FIRST_FRAME="rtc_encode_first_frame",e.RTC_FIRST_FRAME_ENCODED="rtc_first_frame_encoded",e.RTC_SEND_FIRST_PACKET="rtc_send_first_packet",e.RTC_RECV_FIRST_PACKET="rtc_recv_first_packet",e.RTC_RECV_FIRST_FRAME="rtc_recv_first_frame",e.RTC_DECODE_FIRST_FRAME="rtc_decode_first_frame"}(oU||(oU={})),function(e){e.RTC="rtc"}(aU||(aU={})),function(e){e.W_5="5"}(sU||(sU={})),function(e){e.IOS="ios",e.ANDROID="android",e.WEB="web",e.WINDOWS="windows",e.MAC="mac",e.LINUX="linux"}(cU||(cU={})),function(e){e.UNKNOWN="unknown",e.DISCONNECTED="disconnected",e.LAN="lan",e.WIFI="wifi",e.W_2="2g",e.W_3="3g",e.W_4="4g",e.W_5="5g"}(uU||(uU={})),function(e){e.UNKNOWN="unknown",e.BROADCASTER="broadcaster",e.AUDIENCE="audience",e.SILENTAUDIENCE="silentAudience"}(dU||(dU={})),function(e){e.REQUEST="request",e.RESPONSE="response"}(lU||(lU={})),function(e){e.WEBSOCKET_RECONNECTING="websocket reconnecting",e.PEERCONNECTION_RECONNECTING="peerconnection reconnecting",e.DISCONNECTED="DISCONNECTED",e.LAN="LAN",e.WIFI="WIFI",e.W_2="2G",e.W_3="3G",e.W_4="4G",e.W_5="5G",e.UNKNOWN="UNKNOWN"}(hU||(hU={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(pU||(pU={})),function(e){e.WEBSOCKET_RECONNECTED="websocket reconnected",e.PEERCONNECTION_RECONNECTED="peerconnection reconnected"}(fU||(fU={})),function(e){e.WEBSOCKET="websocket",e.NETWORKCHANGED="networkChanged",e.PEERCONNECTION="peerconnection"}(_U||(_U={})),function(e){e.REQUEST="request",e.RESPONSE="response",e.KCP_REQUEST="kcp request",e.KCP_RESPONSE="kcp response",e.QUIC_REQUEST="quic request",e.QUIC_RESPONSE="quic response"}(vU||(vU={})),function(e){e.NEW="NEW",e.CHECKING="CHECKING",e.CONNECTED="CONNECTED",e.COMPLETED="COMPLETED",e.FAILED="FAILED",e.DISCONNECTED="DISCONNECTED",e.CLOSED="CLOSED",e.DATACHANNEL_CONNECTING="DATACHANNEL_CONNECTING",e.DATACHANNEL_OPEN="DATACHANNEL_OPEN",e.DATACHANNEL_CLOSING="DATACHANNEL_CLOSING",e.DATACHANNEL_CLOSED="DATACHANNEL_CLOSED"}(mU||(mU={})),function(e){e.SUCCEED="succeed",e.MESSAGE_ID_ERROR="message id error",e.ZIP_FAILED="zip failed",e.UNZIP_FAILED="unzip failed",e.MESSAGE_KEY_EMPTY="message key empty",e.MESSAGE_KEY_PARSE_FAILED="message key parse failed",e.MESSAGE_KEY_INVALID="message key invalid",e.ENCRYPT_FAILED="encrypt failed",e.DECRYPT_FAILED="decrypt failed",e.MESSAGE_TOO_BIG="message too big",e.INVALID_DATA="invalid data",e.MESSAGE_PARSE_FAILED="message parse failed"}(SU||(SU={})),function(e){e.CALL_JOINROOM="call-joinRoom",e.JOINROOM="joinRoom",e.CALL_RECONNECTED="call-reconnected",e.RECONNECTED="reconnected",e.CALL_PUBLISH="call-publish",e.PUBLISH="publish",e.CALL_UPDATESTREAMATTRIBUTES="call-updateStreamAttributes",e.UPDATESTREAMATTRIBUTES="updateStreamAttributes",e.CALL_UNPUBLISH="call-unpublish",e.UNPUBLISH="unpublish",e.CALL_SUBSCRIBE="call-subscribe",e.SUBSCRIBE="subscribe",e.CALL_UPDATESUBSCRIBE="call-updateSubscribe",e.UPDATESUBSCRIBE="updateSubscribe",e.CALL_UNSUBSCRIBE="call-unsubscribe",e.UNSUBSCRIBE="unsubscribe",e.CALL_UPDATEUSERATTRIBUTES="call-updateUserAttributes",e.UPDATEUSERATTRIBUTES="updateUserAttributes",e.CALL_LEAVEROOM="call-leaveRoom",e.LEAVEROOM="leaveRoom",e.ON_USERCONNECTION="on-userConnection",e.ON_USERDISCONNECTION="on-userDisconnection",e.ON_ONADDSTREAM="on-onAddStream",e.ON_ONPUSHSTREAM="on-onPushStream",e.ON_ONREMOVESTREAM="on-onRemoveStream",e.ON_ONPUSHTRACK="on-onPushTrack",e.ON_ONREMOVETRACK="on-onRemoveTrack",e.ON_ONUPDATEUSERATTRIBUTES="on-onUpdateUserAttributes",e.ON_ONUPDATEROOMATTRIBUTES="on-onUpdateRoomAttributes",e.ON_ONUPDATESTREAMATTRIBUTES="on-onUpdateStreamAttributes",e.ON_STREAMFAILED="on-streamFailed",e.ON_POSTPROCESSINGMESSAGE="on-postProcessingMessage",e.ON_ENGINECONTROLMESSAGE="on-engineControlMessage",e.ON_WEBSOCKETENGINECUSTOMMESSAGE="on-websocketEngineCustomMessage",e.UNKNOWN="unknown",e.CALL_UPDATEPUBLISHSTREAMCHANNEL="call-updatePublishStreamChannel",e.UPDATEPUBLISHSTREAMCHANNEL="updatePublishStreamChannel",e.CALL_UPDATESUBSCRIBESTREAMCHANNEL="call-updateSubscribeStreamChannel",e.UPDATESUBSCRIBESTREAMCHANNEL="updateSubscribeStreamChannel",e.ON_ONSTREAMCHANNELCHANGE="on-onStreamChannelChange",e.P2PDIRECT="p2pdirect",e.INTERNAL_CUSTOM="internal_custom",e.REPORT="report",e.CONNECTION_CONTROL="connection_control",e.ON_INTERNAL_CUSTOM="on_internal_custom",e.CONTROLMESSAGE="controlMessage",e.CALL_LOGIN="call-login",e.LOGIN="login",e.CALL_RECONNECTLOGIN="call-reconnectLogin",e.RECONNECTLOGIN="reconnectLogin",e.CALL_LOGOUT="call-logout",e.LOGOUT="logout",e.CALL_UPDATELOGINTOKEN="call-updateLoginToken",e.UPDATELOGINTOKEN="updateLoginToken",e.CALL_SETSERVERPARAMS="call-setServerParams",e.SETSERVERPARAMS="setServerParams",e.CALL_GETPEERONLINESTATUS="call-getPeerOnlineStatus",e.GETPEERONLINESTATUS="getPeerOnlineStatus",e.ON_ONSCENECONFIG="on-onSceneConfig",e.ON_STREAMCONTROLMESSAGE="on-streamControlMessage",e.CALL_STARTPUSHSTREAM="call-startPushStream",e.STARTPUSHSTREAM="startPushStream",e.CALL_STOPPUSHSTREAM="call-stopPushStream",e.STOPPUSHSTREAM="stopPushStream",e.CALL_STARTPULLSTREAM="call-startPullStream",e.STARTPULLSTREAM="startPullStream",e.CALL_STOPPULLSTREAM="call-stopPullStream",e.STOPPULLSTREAM="stopPullStream",e.CALL_UPDATEPULLSTREAM="call-updatePullStream",e.UPDATEPULLSTREAM="updatePullStream",e.ON_ONSTREAMPUSHEDBYOTHER="on-onStreamPushedByOther",e.CALL_UPDATETOKEN="call-updateToken",e.UPDATETOKEN="updateToken",e.ON_ONTOKENWILLEXPIRE="on-onTokenWillExpire"}(EU||(EU={})),function(e){e.UP="up",e.DOWN="down",e.DIRECT="direct"}(yU||(yU={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(gU||(gU={})),function(e){e.UP="up",e.DOWN="down",e.PRE="pre"}(bU||(bU={})),function(e){e.W_0="0",e.W_1="1"}(TU||(TU={})),function(e){e.UP="up",e.DOWN="down"}(IU||(IU={})),function(e){e.ANSWER="answer",e.INCRANSWER="incranswer"}(RU||(RU={})),function(e){e.UP="up",e.DOWN="down"}(AU||(AU={})),function(e){e.SUCCESS="success",e.FAIL="fail"}(CU||(CU={})),function(e){e.W_0="0",e.W_1="1"}(OU||(OU={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.JOIN_ROOM_ACK_FAILED="join room ack failed",e.UNKNOWN="unknown"}(NU||(NU={})),function(e){e.SUCCESS="success",e.FAIL="fail",e.IGNORE="ignore"}(wU||(wU={})),function(e){e.LEAVE_ROOM="leave room",e.ACK_FAILED="ack failed",e.SET_ANSWER_SDP_FAILED="set answer sdp failed",e.ICE_FAILED="ice failed",e.STREAM_FAILED="stream failed",e.NETWORK_RECONNECTED="network reconnected",e.ON_STREAM_REMOVE="on stream remove",e.PUBLISH_MUTE="publish mute",e.UNKNOWN="unknown",e.ON_STREAM_REMOVE_CLIENT_UNPUBLISHED="on stream remove:client unpublished",e.ON_STREAM_REMOVE_PUBLISH_FAILED="on stream remove:publish failed",e.ON_STREAM_REMOVE_STREAM_REMOVED="on stream remove:stream removed",e.ON_STREAM_REMOVE_CLIENT_DISCONNECTED="on stream remove:client disconnected",e.ON_STREAM_REMOVE_CLIENT_REPUBLISH="on stream remove:client republish"}(DU||(DU={})),function(e){e.PLAYOUT_DEVICE_SWITCH="playout_device_switch",e.RECORD_DEVICE_SWITCH="record_device_switch",e.UNKNOWN="unknown"}(PU||(PU={})),function(e){e.BEGIN_SEND="begin_send",e.SENT_END="sent_end",e.BEGIN_RECV="begin_recv",e.RECV_END="recv_end"}(kU||(kU={})),function(e){e.AUDIO="audio",e.VIDEO="video",e.SCREEN_VIDEO="screen_video",e.SCREEN_AUDIO="screen_audio"}(MU||(MU={})),function(e){e.LOGIN="login",e.PUBLISHER="publisher",e.UNMUTE="unmute",e.ENABLE="enable",e.PUSH="push",e.PUBLISH="publish",e.ONDEMAND="ondemand",e.SUBSCRIBE="subscribe",e.PUSH_TRACK="push_track",e.REMOTE_UNMUTE="remote_unmute",e.P2P="p2p"}(UU||(UU={})),function(e){e.TIMEOUT="timeout",e.AUDIENCE="audience",e.MUTE="mute",e.DISABLE="disable",e.STOP_PUSH="stop_push",e.UNPUBLISH="unpublish",e.NO_DEMAND="no_demand",e.LEAVE_ROOM="leave_room",e.UNSUBSCRIBE="unsubscribe",e.REMOVE_TRACK="remove_track",e.REMOTE_MUTE="remote_mute",e.USER_LEAVE="user_leave"}(LU||(LU={})),function(e){e.AUDIO="audio",e.VIDEO="video"}(xU||(xU={})),function(e){e.BEGIN="begin",e.END="end"}(VU||(VU={})),function(e){e.BEGIN="begin",e.END="end"}(FU||(FU={})),function(e){e.LEAVE_ROOM="leave_room",e.ACK_FAILED="ack_failed",e.TOKEN_ERROR="token_error",e.SIGNALING_ERROR="signaling_error",e.TIMEOUT_10="timeout_10",e.TIMEOUT_60="timeout_60"}(BU||(BU={})),function(e){e.UNKNOWN="unknown",e.NEW="new",e.CHECKING="checking",e.CONNECTED="connected",e.FAILED="failed",e.SELECTED="selected",e.CLOSING="closing",e.CLOSED="closed",e.UNSELECTED="unselected"}(jU||(jU={})),function(e){e.NOMINAL="Nominal",e.FAIR="Fair",e.SERIOUS="Serious",e.CRITICAL="Critical",e.UNKNWON="Unknwon"}(GU||(GU={})),function(e){e.UNKNOWN="UNKNOWN",e.AUDIO_RECORD="AUDIO_RECORD",e.AUDIO_PLAYOUT="AUDIO_PLAYOUT",e.VIDEO="VIDEO",e.SHARE_AUDIO_RECORD="SHARE_AUDIO_RECORD",e.SHARE_VIDEO="SHARE_VIDEO"}(HU||(HU={})),function(e){e.P2P="p2p",e.P2P_OUTSIDE_ROOM="p2p_outside_room",e.P2SERVER="p2server"}(zU||(zU={})),function(e){e.START="start",e.START_CAPTURE_RESULT="start_capture_result",e.STARTED="started",e.RUNNING_FAILED="running_failed",e.STOP="stop",e.STOPPED="stopped"}(KU||(KU={})),function(e){e.DSHOW="dshow",e.MF="mf",e.AVCAPTURESESSION="avcapturesession",e.CAMERA1="camera1",e.CAMERA2="camera2",e.VECAMERA="vecamera"}(YU||(YU={})),function(e){e.SUCCESS="success",e.CAMERA_DEVICE_NO_PERMISSION="camera_device_no_permission",e.CAMERA_DEVICE_BUSY="camera_device_busy",e.CAMERA_DEVICE_FAILURE="camera_device_failure",e.CAMERA_DEVICE_NOT_FOUND="camera_device_not_found",e.CAMERA_DEVICE_DISCONNECTED="camera_device_disconnected",e.TIMEOUT="timeout",e.ABORT="abort"}(XU||(XU={})),function(e){e.UNKNOWN="unknown",e.MUSIC="music",e.HIGHQUALITY_COMMUNICATION="highquality_communication",e.COMMUNICATION="communication",e.MEDIA="media",e.GAME_STREAMING="game_streaming"}(WU||(WU={})),function(e){e.UNKNOWN="unknown",e.MEDIA="media",e.COMMUNICATION="communication"}(JU||(JU={})),function(e){e.UNKNOWN="unknown",e.SLEEP="Sleep",e.AWAKE="Awake"}(qU||(qU={})),function(e){e.UNKNOWN="unknown",e.PRODUCT="product",e.BOE="boe",e.TEST="test"}(ZU||(ZU={}));var eL,tL,rL,iL,nL,oL,aL,sL,cL,uL,dL=function(){function e(e){this.monitor=e}return e.prototype.setStats=function(e){var t=this;Object.keys(e).forEach((function(r){t["_"+r]=e[r]})),this.monitor.StartUp()},Object.defineProperty(e.prototype,"event_key",{get:function(){return this._event_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_id",{get:function(){return this._device_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_app_id",{get:function(){return this._rtc_app_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"product_line",{get:function(){return this._product_line},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_version",{get:function(){return this._report_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"os",{get:function(){return this._os},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_version",{get:function(){return this._rtc_sdk_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_timestamp",{get:function(){return this._rtc_timestamp},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sdk_git_commit",{get:function(){return this._rtc_sdk_git_commit},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"report_id",{get:function(){return this._report_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"connection_id",{get:function(){return this._connection_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_sid",{get:function(){return this._rtc_sid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"engine_session_id",{get:function(){return this._engine_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_business_id",{get:function(){return this._rtc_business_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"project_key",{get:function(){return this._project_key},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"network_type",{get:function(){return this._network_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"app_version",{get:function(){return this._app_version},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"aid",{get:function(){return this._aid},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_model",{get:function(){return this._device_model},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"device_brand",{get:function(){return this._device_brand},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"common_extra_info",{get:function(){return this._common_extra_info},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"had_selected_p2p",{get:function(){return this._had_selected_p2p},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_env_type",{get:function(){return this._rtc_env_type},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"room_id",{get:function(){return this._room_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_id",{get:function(){return this._user_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rtc_session_id",{get:function(){return this._rtc_session_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"user_agent",{get:function(){return this._user_agent},enumerable:!1,configurable:!0}),e}(),lL=function(e){function t(){var t=e.call(this)||this;return t.report_id=0,t.dataBuffer=[],t.posting=!1,t.report_common={},t.modify_ids={},t.preSucTime=0,t.errSendDelay=100,t.commonStats=new dL(t),ID()||window.addEventListener("beforeunload",(function(){clearTimeout(t.errSendTimer),clearTimeout(t.sucSendTimer),t.send(null,!0)})),t}return Z_(t,e),t.prototype.push=function(e,t){t?this.send(e):(this.dataBuffer.push(e),!this.posting&&!this.errSendTimer&&Date.now()-this.preSucTime>2e3&&(clearTimeout(this.sucSendTimer),this.send()))},t.prototype.unshift=function(e){this.dataBuffer=e.concat(this.dataBuffer)},t.prototype.send=function(e,t){var r=this;if(e||this.dataBuffer.length){var i={data:e||this.dataBuffer.splice(0,4e3),header:this.report_common,from:"web",os:"web",version:"1"},n=new XMLHttpRequest;n.timeout=1e4,n.onreadystatechange=function(){if(4===n.readyState){e||(r.posting=!1);var o=void 0;if(200===n.status||304===n.status)try{o=JSON.parse(n.responseText)}catch(e){}o&&0===o.StatusCode?e||t||r.sucSend():e?r.send(e):(r.unshift(i.data),t?r.send():r.errSend())}};var o=BP.LOG_SERVER_URL;if(n.open("POST",o,!0),e||(this.posting=!0),!ID()&&location.search.includes("_rtc_autotest_"))this.safeEmit("report_event",i),0!==this.dataBuffer.length?this.sucSend():this.posting=!1;else if(!ID()&&location.search.includes("_rtc_debug_"))n.send(JSON.stringify(i));else{var a=$U.gzip(JSON.stringify(i));n.setRequestHeader("Content-Encoding","gzip"),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),n.send(a)}}},t.prototype.sucSend=function(){this.errSendDelay=100,this.preSucTime=Date.now(),this.sucSendTimer=setTimeout(this.send.bind(this),2e3)},t.prototype.errSend=function(){var e=this;this.errSendTimer=setTimeout((function(){e.send(),e.errSendTimer=null}),this.errSendDelay),this.errSendDelay*=2},t.prototype.StartUp=function(){var e=this.report_common,t=this.commonStats,r=t.event_key,i=t.device_id,n=t.rtc_app_id,o=t.product_line,a=t.report_version,s=t.os,c=t.rtc_sdk_version,u=t.rtc_timestamp,d=t.rtc_sdk_git_commit,l=t.report_id,h=t.connection_id,p=t.rtc_sid,f=t.engine_session_id,_=t.rtc_business_id,v=t.project_key,m=t.network_type,S=t.app_version,E=t.aid,y=t.device_model,g=t.device_brand,b=t.common_extra_info,T=t.had_selected_p2p,I=t.rtc_env_type,R=t.user_agent;Object.assign(e,{event_key:r,device_id:i,rtc_app_id:n,product_line:o,report_version:a,os:s,rtc_sdk_version:c,rtc_timestamp:u,rtc_sdk_git_commit:d,report_id:l,connection_id:h,rtc_sid:p,engine_session_id:f,rtc_business_id:_,project_key:v,network_type:m,app_version:S,aid:E,device_model:y,device_brand:g,common_extra_info:b,had_selected_p2p:T,rtc_env_type:I,user_agent:R}),this.commonStats.room_id&&(this.modify_ids.room_id=this.commonStats.room_id),this.commonStats.user_id&&(this.modify_ids.user_id=this.commonStats.user_id),this.commonStats.rtc_session_id&&(this.modify_ids.rtc_session_id=this.commonStats.rtc_session_id)},t.prototype.rtcSdkApiCall=function(e,t,r,i){void 0===i&&(i={});var n=$_($_({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:JSON.stringify(i)});this.push(n)},t.prototype.rtcSdkCallback=function(e,t,r,i){void 0===i&&(i={});var n=$_($_({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:JSON.stringify(i)});this.push(n)},t.prototype.rtcGetConfig=function(e,t,r,i,n,o,a,s){void 0===s&&(s={});var c=$_($_({event_key:"rtc_get_config",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,host:i,type:n,config_id:o,enable_cloud_proxy:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcReconnect=function(e,t,r,i,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_reconnect",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,reconnect_id:r,reconnect_type:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcReconnected=function(e,t,r){void 0===r&&(r={});var i=$_($_({event_key:"rtc_reconnected",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,reconnect_type:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcGetAccess=function(e,t,r,i,n,o,a){void 0===a&&(a={});var s=$_($_({event_key:"rtc_get_access",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,elapse:r,type:i,host:n,connect_session_id:o},this.modify_ids),{common_extra_info:JSON.stringify(a)});this.push(s)},t.prototype.rtcPreIceState=function(e,t,r){void 0===r&&(r={});var i=$_($_({event_key:"rtc_pre_ice_state",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,ice_state:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcNodeChange=function(e,t,r,i){void 0===i&&(i={});var n=$_($_({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:JSON.stringify(i)});this.push(n)},t.prototype.rtcSignalingMsgError=function(e,t,r,i){void 0===i&&(i={});var n=$_($_({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:JSON.stringify(i)});this.push(n)},t.prototype.rtcSignaling=function(e,t,r,i,n,o){void 0===o&&(o={});var a=$_($_({event_key:"rtc_signaling",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,signaling_event:r,signaling_type:i,direction:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcJoinRoom=function(e,t,r,i,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,deviceModel:t,deviceManufacturer:r,elapse:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcLeaveRoom=function(e,t,r,i){void 0===i&&(i={});var n=$_($_({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:JSON.stringify(i)});this.push(n)},t.prototype.rtcBeginCreateOffer=function(e,t,r,i){void 0===i&&(i={});var n=$_($_({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:JSON.stringify(i)});this.push(n)},t.prototype.rtcCreateOffer=function(e,t,r,i,n,o){void 0===o&&(o={});var a=$_($_({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:i,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcSetDescription=function(e,t,r,i,n,o,a,s){void 0===s&&(s={});var c=$_($_({event_key:"rtc_set_description",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,message:t,is_local:r,direction:i,stream_id:n,stream_user_id:o,elapse:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.rtcRecvAnswer=function(e,t,r,i,n,o,a,s){void 0===s&&(s={});var c=$_($_({event_key:"rtc_recv_answer",report_id:this.report_id++,rtc_timestamp:Date.now(),error_code:e,answer_type:t,sequence_id:r,message:i,direction:n,stream_id:o,stream_user_id:a},this.modify_ids),{common_extra_info:JSON.stringify(s)});this.push(c)},t.prototype.firstRemoteAudioRender=function(e,t,r){void 0===r&&(r={});var i=$_($_({event_key:"first_remote_audio_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.firstRemoteVideoRender=function(e,t,r){void 0===r&&(r={});var i=$_($_({event_key:"first_remote_video_render",report_id:this.report_id++,rtc_timestamp:Date.now(),stream_id:e,stream_user_id:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcPublishStat=function(e,t,r,i,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_publish_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,is_screen:t,start:r,message:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcSubscribeStat=function(e,t,r,i,n){void 0===n&&(n={});var o=$_($_({event_key:"rtc_subscribe_stat",report_id:this.report_id++,rtc_timestamp:Date.now(),result:e,start:t,message:r,stream_user_id:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.rtcAudioDevice=function(e,t,r,i){void 0===i&&(i={});var n=$_($_({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:JSON.stringify(i)});this.push(n)},t.prototype.rtcMediaStatistics=function(e,t,r){void 0===r&&(r={});var i=$_($_($_($_({event_key:"rtc_media_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcMessageStatistics=function(e,t,r,i){void 0===i&&(i={});var n=$_($_($_($_($_({event_key:"rtc_message_statistics",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),{media_server_ip:r}),this.modify_ids),{common_extra_info:JSON.stringify(i)});this.push(n)},t.prototype.rtcError=function(e,t,r){void 0===r&&(r={});var i=$_($_({event_key:"rtc_error",report_id:this.report_id++,rtc_timestamp:Date.now(),message:e,error_code:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcInvokeStatus=function(e,t,r,i,n,o){void 0===o&&(o={});var a=$_($_({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:i,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.rtcFirstFrame=function(e,t){void 0===t&&(t={});var r=$_($_($_({event_key:"rtc_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});QU.print("rtcFirstFrame",JSON.stringify(e)),this.push(r)},t.prototype.rtcMuteRemote=function(e,t,r){void 0===r&&(r={});var i=$_($_($_($_({event_key:"rtc_mute_remote",report_id:this.report_id++,rtc_timestamp:Date.now()},e),{media_type:t}),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.sdkInitEngine=function(e,t,r){void 0===r&&(r={});var i=$_($_({event_key:"sdk_init_engine",report_id:this.report_id++,rtc_timestamp:Date.now(),start:e,type:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.joinRoom=function(e,t,r,i,n){void 0===n&&(n={});var o=$_($_({event_key:"join_room",report_id:this.report_id++,rtc_timestamp:Date.now(),type:e,start:t,result:r,reason:i},this.modify_ids),{common_extra_info:JSON.stringify(n)});this.push(o)},t.prototype.p2pConnectionStatus=function(e,t,r,i,n,o){void 0===o&&(o={});var a=$_($_({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:i,elapse:n},this.modify_ids),{common_extra_info:JSON.stringify(o)});this.push(a)},t.prototype.p2pConnectClosed=function(e,t){void 0===t&&(t={});var r=$_($_({event_key:"p2p_connect_closed",report_id:this.report_id++,rtc_timestamp:Date.now(),p2p_selected:e},this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(r)},t.prototype.rtcDeviceError=function(e,t,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v){void 0===v&&(v={});var m=$_($_({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:i,system_api:n,call_parameters:o,location:a,message:s,media_device_id:c,media_device_name:u,elapse:d,scenario:l,event_session_id:h,device_pid:p,device_vid:f,media_mode:_},this.modify_ids),{common_extra_info:JSON.stringify(v)});this.push(m)},t.prototype.rtcVideoDevice=function(e,t,r){void 0===r&&(r={});var i=$_($_({event_key:"rtc_video_device",report_id:this.report_id++,rtc_timestamp:Date.now(),media_device_id:e,media_device_name:t},this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcVideoCaptureEvent=function(e,t){void 0===t&&(t={});var r=$_($_($_({event_key:"rtc_video_capture_event",report_id:this.report_id++,rtc_timestamp:Date.now()},e),this.modify_ids),{common_extra_info:JSON.stringify(t)});this.push(r)},t.prototype.rtcEncodeFirstFrame=function(e,t,r){void 0===r&&(r={});var i=$_($_($_($_({event_key:"rtc_encode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcFirstFrameEncoded=function(e,t,r){void 0===r&&(r={});var i=$_($_($_($_({event_key:"rtc_first_frame_encoded",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcSendFirstPacket=function(e,t,r){void 0===r&&(r={});var i=$_($_($_($_({event_key:"rtc_send_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcRecvFirstPacket=function(e,t,r){void 0===r&&(r={});var i=$_($_($_($_({event_key:"rtc_recv_first_packet",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcRecvFirstFrame=function(e,t,r){void 0===r&&(r={});var i=$_($_($_($_({event_key:"rtc_recv_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t.prototype.rtcDecodeFirstFrame=function(e,t,r){void 0===r&&(r={});var i=$_($_($_($_({event_key:"rtc_decode_first_frame",report_id:this.report_id++,rtc_timestamp:Date.now()},e),t),this.modify_ids),{common_extra_info:JSON.stringify(r)});this.push(i)},t}($D),hL=new lL,pL=new lL,fL=new lL,_L=hL.commonStats,vL=pL.commonStats,mL=fL.commonStats,SL={default:hL,rtm:pL,outsideRoom:fL};function EL(e){void 0===e&&(e="default");for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return function(r,i,n){if("function"==typeof n.value){var o=n.value;n.value=function(){for(var r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var a={};t.forEach((function(e,t){a[e]=r[t]})),"joinRoom"===i&&_L.setStats({room_id:r[1]}),SL[e].rtcSdkApiCall(i,0,JSON.stringify(ND(r)),a);var s=o.apply(this,r);return"function"==typeof(null==s?void 0:s.then)?s.then((function(t){return SL[e].rtcSdkCallback(i,0,JSON.stringify(ND([t||{}]))),t})).catch((function(t){throw SL[e].rtcSdkCallback(i,t.code,JSON.stringify(t.message)),t})):(SL[e].rtcSdkCallback(i,0,JSON.stringify(ND([s||{}]))),s)}}}}function yL(e,t,r){void 0===r&&(r=0),(e===wD.onUserMessageReceivedOutsideRoom||e===wD.onUserBinaryMessageReceivedOutsideRoom?pL:hL).rtcSdkCallback(e,r,JSON.stringify(t))}function gL(e,t,r,i){void 0===r&&(r=0),void 0===i&&(i=!1),(i?pL:hL).rtcInvokeStatus(JSON.stringify(t),r,e,"",0)}!function(e){e.streamRemovedBySchedule308="stream removed",e.clientRePublish="client republish",e.publishStreamFaied="publish failed",e.clientUnPublish="client unpublished",e.clientDisconnected="client disconnected",e.videoMuted="video muted"}(eL||(eL={})),function(e){e.ON_ADD_STREAM="onAddStream",e.ON_REMOVE_STREAM="onRemoveStream",e.USER_DISCONNECTION="userDisconnection",e.USER_CONNECTION="userConnection",e.ON_UPDATE_STREAM_ATTRIBUTES="onUpdateStreamAttributes",e.ON_UPDATE_ROOM_ATTRIBUTES="onUpdateRoomAttributes",e.ON_PUSH_TRACK="onPushTrack",e.ON_REMOVE_TRACK="onRemoveTrack",e.ON_CUSTOM_MESSAGE="onCustomMessage",e.NODE_CHANGE="nodeChange",e.USER_MESSAGE_RECEIVED="userMessageReceived",e.USER_BINARY_MESSAGE_RECEIVED="userBinaryMessageReceived",e.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM="userMessageReceivedOutsideRoom",e.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM="userBinaryMessageReceivedOutsideRoom",e.POST_PROCESSING_MESSAGE="postProcessingMessage",e.ON_USER_TOKEN_WILL_EXPIRE="onUserTokenWillExpire"}(tL||(tL={})),function(e){e.RSCP="RSCP"}(rL||(rL={})),function(e){e.ON_CONNECTION_STATE_CHANGE="onConnectionStateChange",e.ABNORMAL_DISCONNECTION="normalConnection"}(iL||(iL={})),function(e){e.userLeave="userLeave",e.connectionLost="connectionLost",e.userDuplicateLogin="userDuplicateLogin",e.kickedByAdmin="kickedByAdmin",e.roleChanged="roleChanged",e.onUserTokenDidExpire="onUserTokenDidExpire"}(nL||(nL={})),function(e){e[e.roomDismissByAdmin=2]="roomDismissByAdmin"}(oL||(oL={})),function(e){e[e.SEND=0]="SEND",e[e.FEEDBACK=1]="FEEDBACK"}(sL||(sL={})),function(e){e[e.P2P=0]="P2P",e[e.SIGNAL=1]="SIGNAL",e[e.BROADCAST=2]="BROADCAST",e[e.BUSINESS_SERVER=3]="BUSINESS_SERVER"}(cL||(cL={})),function(e){e[e.SUCCESS=0]="SUCCESS",e[e.TIMEOUT=1]="TIMEOUT",e[e.BROKEN=2]="BROKEN",e[e.NO_RECEIVER=3]="NO_RECEIVER",e[e.NO_RELAYPATH=4]="NO_RELAYPATH",e[e.SEND_TO_SERVER_ERROR=17]="SEND_TO_SERVER_ERROR",e[e.SERVER_RESPONSE_ERROR=18]="SERVER_RESPONSE_ERROR",e[e.NOT_JOIN=100]="NOT_JOIN",e[e.INIT=101]="INIT",e[e.NO_CONNECTION=102]="NO_CONNECTION",e[e.EXCEED_MAX_LENGTH=103]="EXCEED_MAX_LENGTH",e[e.EMPTY_USER=104]="EMPTY_USER",e[e.NOT_LOGIN=105]="NOT_LOGIN",e[e.SERVER_PARAMS_NOTSET=106]="SERVER_PARAMS_NOTSET",e[e.UNKNOWN=1e3]="UNKNOWN"}(uL||(uL={}));var bL,TL,IL=((aL={})[uL.SUCCESS]=[0,"success"],aL[uL.TIMEOUT]=[ZN.USER_MESSAGE_TIMEOUT,"timeout, failed to send."],aL[uL.BROKEN]=[ZN.USER_MESSAGE_BROKEN,"dataChannel broken, failed to send."],aL[uL.NO_RECEIVER]=[ZN.USER_MESSAGE_NO_RECEIVER,"cannot find the receiver."],aL[uL.NO_RELAYPATH]=[ZN.USER_MESSAGE_NO_RELAYPATH,"cannot find relay path."],aL[uL.SEND_TO_SERVER_ERROR]=[ZN.USER_MESSAGE_SEND_TO_SERVER_ERROR,"failed to send to business server."],aL[uL.SERVER_RESPONSE_ERROR]=[ZN.USER_MESSAGE_SERVER_RESPONSE_ERROR,"business server response error."],aL[uL.NOT_JOIN]=[ZN.USER_MESSAGE_NOT_JOIN,"not join room"],aL[uL.INIT]=[ZN.USER_MESSAGE_INIT,"not init."],aL[uL.NO_CONNECTION]=[ZN.USER_MESSAGE_NO_CONNECTION,"no connection."],aL[uL.EXCEED_MAX_LENGTH]=[ZN.USER_MESSAGE_EXCEED_MAX_LENGTH,"message exceeds max length."],aL[uL.EMPTY_USER]=[ZN.USER_MESSAGE_EMPTY_USER,"user id is empty."],aL[uL.NOT_LOGIN]=[ZN.USER_MESSAGE_NOT_LOGIN,"not login."],aL[uL.SERVER_PARAMS_NOTSET]=[ZN.USER_MESSAGE_SERVER_PARAMS_NOTSET,"server param is not set."],aL[uL.UNKNOWN]=[ZN.USER_MESSAGE_UNKNOWN,"unknown."],aL),RL=new qD("DataChannelSignaling",3);!function(e){e[e.SEND=0]="SEND",e[e.ACK=1]="ACK"}(bL||(bL={})),function(e){e[e.C2S=0]="C2S",e[e.C2C=1]="C2C",e[e.C2GW=2]="C2GW",e[e.C2CDirect=3]="C2CDirect",e[e.C2RTM=4]="C2RTM"}(TL||(TL={}));var AL=function(e){function t(t){var r=e.call(this)||this;return r._dataChannel=t,r._singlingCache=new Map,r._p2pCache=new Map,r._rttIds={},r._p2pMessageId=0,r._clearDataChannelListener=r._handleHandler(),window.__rtc_mock_signaling__=r.emit.bind(r),r}return Z_(t,e),t.prototype.destroy=function(){this._dataChannel&&(this._clearDataChannelListener(),this._dataChannel.close()),this._singlingCache.clear(),this._p2pCache.clear(),this._p2pMessageId=0,this._rttIds={}},t.prototype.sendSignaling=function(e,t,r){var i=this;return hL.rtcSignaling(0,JSON.stringify(t),"call-".concat(e),"Send",yU.UP),new Promise((function(n,o){var a=i._genHeader(r);a.id=AD();var s=a.id.join("-"),c=setTimeout((function(){i._singlingCache.delete(s),o(new tw(ZN.TIME_OUT,"".concat(e," message time out")))}),6e4);i._singlingCache.set(s,{signalingType:e,success:function(e){clearTimeout(c),n(e)},error:function(e){clearTimeout(c),o(e)}}),RL.print("Signal",">>>>>> [".concat(e,"][").concat(s,"]"),t),i._sendMessage(e,a,t)}))},t.prototype.sendPingSignaling=function(){return this.sendSignaling("CheckConnectivity",{ts:Date.now()},{functionType:TL.C2GW})},t.prototype.sendP2PMessage=function(e,t){var r=e.msg,i=function(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(e);n<i.length;n++)t.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]])}return r}(e,["msg"]);return ev(this,void 0,void 0,(function(){var e,n,o,a,s;return tv(this,(function(c){switch(c.label){case 0:return e=r instanceof ArrayBuffer,n=this._sendP2PMessage,o=[$_({ver:1,id:this._p2pMessageId++,time:Date.now(),dir:sL.SEND,type:cL.P2P,err:uL.SUCCESS},i)],s={binary:e},e?[4,RD.ab2b64str(r)]:[3,2];case 1:return a=c.sent(),[3,3];case 2:a=r,c.label=3;case 3:return[2,n.apply(this,[$_.apply(void 0,o.concat([(s.msg=a,s)])),t])]}}))}))},t.prototype._sendP2PMessage=function(e,t){var r=this;return void 0===t&&(t={}),OD(e.msg)?this._rttIds[e.id]=e.id:RL.print("_sendP2PMessage [DC Signaling p2p >>]",JSON.stringify(e)),new Promise((function(i,n){var o=r._genHeader($_($_({needAck:!0,functionType:TL.C2C},t),{id:AD()}));if(e.dir===sL.SEND){var a=setTimeout((function(){r._p2pCache.delete(e.id),n(new tw(ZN.TIME_OUT,"P2P message timeout"))}),6e4);r._p2pCache.set(e.id,{success:function(e){clearTimeout(a),i(e)},error:function(e){clearTimeout(a);var t=iv(IL[e.err]||[ZN.USER_MESSAGE_UNKNOWN,"err: ".concat(e.err,", msg: ").concat(e.msg)],2),r=t[0],i=t[1];n({code:r,message:e.msg||i})}})}r._sendMessage("p2p",o,e)}))},t.prototype._sendMessage=function(e,t,r){if(!this._dataChannel||"open"!==this._dataChannel.readyState)throw new tw(ZN.SIGNALING_CHANNEL_NOT_OPEN,"DataChannel not open");var i=t.version+(+t.zip<<5)+(+t.encrypt<<6),n=+t.needAck+(+t.direction<<1)+(+t.functionType<<2)+(+t.binary<<6),o=RD.str2ab(JSON.stringify([e,r])),a=TD(Uint8Array,nv([i,n],iv(t.id||[]),!1),new Uint8Array(o));this._dataChannel.send(a.buffer)},t.prototype._dispartData=function(e){var t=new Uint8Array(e),r=0,i=t[r++],n=t[r++],o={version:15&i,zip:16==(16&i),encrypt:32==(32&i),needAck:1==(1&n),direction:(2&n)>>1,functionType:(60&n)>>2,binary:64==(64&n)};if(o.needAck||o.direction===bL.ACK){for(;r<=6;r++)if(128!=(128&t[r])){r++;break}o.id=Array.from(t.slice(2,r))}return{header:o,data:t.slice(r)}},t.prototype._feedbackSignaling=function(e,t){var r=this._genHeader({needAck:!0,direction:bL.ACK,id:e.split("-").map((function(e){return+e}))});RL.print("Signal",">>>>>> [".concat(t,"-res][").concat(e,"]")),this._sendMessage("".concat(t,"-res"),r,"")},t.prototype._handleMessage=function(e){var t,r;return ev(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A,C,O,N,w,D,P,k,M,U,L,x;return tv(this,(function(V){switch(V.label){case 0:i=this._dispartData(e),n=i.header,o=i.data,n.zip&&((a=new $U.Inflate).push(o,!0),o=a.result),s=RD.ab2str(o),c=[];try{c=JSON.parse(s)}catch(e){return e instanceof Error&&hL.rtcSignalingMsgError(-1,e.message,SU.MESSAGE_PARSE_FAILED),[2]}switch(n.functionType){case TL.C2S:return[3,1];case TL.C2C:return[3,6];case TL.C2GW:return[3,18]}return[3,19];case 1:return u=(null===(t=n.id)||void 0===t?void 0:t.join("-"))||"",n.direction!==bL.ACK?[3,2]:(this._handleAckMessage(u,c[0]||{},s),[3,5]);case 2:return Array.isArray(c)?(d=c[0],c=c[1],RL.print("Signal","<<<<<< ".concat(d),c,u),this._feedbackSignaling(u,d),c.binary&&"string"==typeof c.message?(l=c,[4,RD.b64str2ab(c.message)]):[3,4]):[3,5];case 3:l.message=V.sent(),V.label=4;case 4:this.emit(d,$_({},c)),hL.rtcSignaling(0,s,"on-".concat(d),"Recv",yU.DOWN),V.label=5;case 5:return[3,19];case 6:switch(Array.isArray(c)&&(c=c[1]),h=null==c?void 0:c.id,this._rttIds[h]||(null==c?void 0:c.dir)===sL.FEEDBACK||OD(null==c?void 0:c.msg)?delete this._rttIds[h]:RL.print("Signal","<<<<<< p2p response",c),c.dir){case sL.SEND:return[3,7];case sL.FEEDBACK:return[3,16]}return[3,17];case 7:return OD(null==c?void 0:c.msg)?[3,15]:(f=(p=c).binary,_=p.msg,v=p.room,m=p.to,S=p.from,E=""===v?f?tL.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM:tL.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM:f?tL.USER_BINARY_MESSAGE_RECEIVED:tL.USER_MESSAGE_RECEIVED,m?[3,11]:(y=this.emit,g=[tL.ON_CUSTOM_MESSAGE],L={clientId:S,binary:f},f?[4,RD.b64str2ab(_)]:[3,9]));case 8:return b=V.sent(),[3,10];case 9:b=_,V.label=10;case 10:return y.apply(this,g.concat([(L.message=b,L)])),[3,17];case 11:return T=this.emit,I=[E],R=[$_({},c)],x={},f?[4,RD.b64str2ab(_)]:[3,13];case 12:return A=V.sent(),[3,14];case 13:A=_,V.label=14;case 14:T.apply(this,I.concat([$_.apply(void 0,R.concat([(x.msg=A,x)]))])),V.label=15;case 15:return this._sendP2PMessage($_($_({},c),{dir:sL.FEEDBACK,msg:""})),[3,17];case 16:return(C=this._p2pCache.get(c.id))&&(this._p2pCache.delete(c.id),c.err===uL.SUCCESS?C.success(c.id):C.error(c)),[3,17];case 17:return[3,19];case 18:if(n.direction===bL.ACK)O=(null===(r=n.id)||void 0===r?void 0:r.join("-"))||"",this._handleAckMessage(O,c[0]||{},s);else if(N=iv(c,2),w=N[0],D=N[1],P=void 0===D?{}:D,"RXMediaMsg"===w&&(k=P.type,M=P.data,hL.rtcSignaling(0,s,"on-".concat(k),"Recv",yU.DOWN),"RSCP"===k))try{U=JSON.parse(M),Array.isArray(U)&&this.emit(k,U)}catch(e){}V.label=19;case 19:return[2]}}))}))},t.prototype._handleHandler=function(){var e=this,t=function(t){RL.print("_handleHandler","dataChannel close",t),e.emit("close",t)},r=function(t){RL.print("_handleHandler","dataChannel error",t),e.emit("close",t)},i=function(t){e._handleMessage(t.data)};return this._dataChannel.addEventListener("close",t),this._dataChannel.addEventListener("error",r),this._dataChannel.addEventListener("message",i),function(){e._dataChannel.removeEventListener("close",t),e._dataChannel.removeEventListener("error",r),e._dataChannel.removeEventListener("message",i)}},t.prototype._genHeader=function(e){return void 0===e&&(e={}),$_({version:2,zip:!1,encrypt:!1,needAck:!0,direction:bL.SEND,functionType:TL.C2S,binary:!1},e)},t.prototype._handleAckMessage=function(e,t,r){var i=this._singlingCache.get(e);i&&(this._singlingCache.delete(e),200===t.code?i.success(t):i.error(t),RL.print("Signal","<<<<<< [".concat(i.signalingType,"-ack]"),t)),hL.rtcSignaling(0,r,null==i?void 0:i.signalingType,"Ack",yU.DOWN)},t}(XD.exports.EventEmitter),CL=function(){function e(){this.isSending=!1}return e.prototype.ajax=function(e){var t=this,r=e.method,i=e.url,n=e.body,o=void 0===n?{}:n,a=e.headers,s=void 0===a?{}:a,c=e.stringify,u=void 0===c||c;return new Promise((function(e,n){var a,c;t.isSending=!0;var d=new XMLHttpRequest;d.open(r,i,!0);try{for(var l=rv(Object.entries(s)),h=l.next();!h.done;h=l.next()){var p=iv(h.value,2),f=p[0],_=p[1];d.setRequestHeader(f,_)}}catch(e){a={error:e}}finally{try{h&&!h.done&&(c=l.return)&&c.call(l)}finally{if(a)throw a.error}}d.onreadystatechange=function(){4===d.readyState&&(t.isSending=!1,200===d.status?e(JSON.parse(d.responseText)):n({message:d.statusText,code:d.status})),0===d.status&&n({code:0,message:"Request abort"})},d.onerror=function(e){t.isSending=!1,n({code:-1,message:d.responseText||"unknown"})},u&&(o=JSON.stringify(o)),d.send(o),t.xhr=d}))},e.prototype.get=function(e,t){return this.ajax({method:"GET",url:e,headers:t})},e.prototype.post=function(e,t,r,i){return this.ajax({method:"POST",url:e,body:t,headers:r,stringify:i})},e.prototype.abort=function(){var e;null===(e=this.xhr)||void 0===e||e.abort()},e}(),OL=function(){function e(){}return e.prototype.get=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(e){return null}},e.prototype.set=function(e,t,r){void 0===r&&(r=-1);var i={ttl:r,saveTime:Date.now(),message:t};try{return localStorage.setItem(e,JSON.stringify(i)),!0}catch(e){return!1}},e.prototype.delete=function(e){try{return localStorage.removeItem(e),!0}catch(e){return!1}},e}(),NL=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return Z_(t,e),t.prototype.getDeviceId=function(){if(ID())return"";var e=this.get("RTC_DEVICE_ID");return e||(e=SD()),this.set("RTC_DEVICE_ID",e),e},t.prototype.getAccessNode=function(e){return this.get("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"))},t.prototype.setAccessNode=function(e,t,r){return this.set("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"),t,1e3*r)},t.prototype.clearAccessNode=function(e){this.delete("".concat("RTC_ACCESS_NODE","_").concat(e,"-BytePlus"))},t.prototype.getAccessUrls=function(){return this.get("".concat("RTC_ACCESS_URLS","-BytePlus"))},t.prototype.setAccessUrls=function(e){var t=e.map((function(e){var t=e.host,r=e.path;return"https://".concat(t).concat(r)}));return this.set("".concat("RTC_ACCESS_URLS","-BytePlus"),t)},t.prototype.clearAccessUrls=function(){this.delete("".concat("RTC_ACCESS_URLS","-BytePlus"))},t.prototype.getH264BlackList=function(){return this.get("RTC_H264_BLACK_LIST")},t.prototype.setH264BlackList=function(e){return this.set("RTC_H264_BLACK_LIST",e)},t}(OL),wL=new NL,DL=new qD("ICE Request",3),PL=function(){function e(){this._request=new CL}return e.prototype.getAccessNode=function(e,t,r,i,n,o,a){return ev(this,void 0,void 0,(function(){var s;return tv(this,(function(c){return(s=wL.getAccessNode(e))?(this.getAccessNodeFromServer(e,t,r,i,n,o,a),gL("es.R.node.cache",s),[2,Promise.resolve(s)]):[2,this.getAccessNodeFromServer(e,t,r,i,n,o,a)]}))}))},e.prototype.getAccessNodeFromServer=function(e,t,r,i,n,o,a){return ev(this,void 0,void 0,(function(){var s,c,u=this;return tv(this,(function(d){return s=wL.getAccessUrls(),c=!0,gL("es.R.req.cache.urls",s),(null==s?void 0:s.length)>0||(s=BP.ICE_CONFIG_REQUEST_URLS,c=!1,gL("es.R.req.external.urls",s)),(null==s?void 0:s.length)>0||(s=BP.ICE_CONFIG_REQUEST_URLS_INTERNAL,c=!1,gL("es.R.req.internal.urls",s)),[2,this.getICEConfigFromServer(s,e,t,r,i,n,o,a).then((function(t){var r=t.nodes[0];return wL.setAccessNode(e,r,t.ttl||11200),t.dispatchDomains&&wL.setAccessUrls(t.dispatchDomains),r})).catch((function(s){if(c)return gL("es.R.req.fallback",""),wL.clearAccessUrls(),u.getAccessNodeFromServer(e,t,r,i,n,o,a);throw s}))]}))}))},e.prototype.getICEConfigFromServer=function(e,t,r,i,n,o,a,s){var c;return ev(this,void 0,void 0,(function(){var r,u,d,l=this;return tv(this,(function(h){return r={appID:t,userID:i,deviceID:n,connectSessionID:gD(),os:"web",sdkVersion:BP.VERSION,expectedAddr:GP("EXPECTED_ADDR"),productPlatform:"BytePlus",enableCloudProxy:s},o&&a&&(r.feedbackInfo=[{feedbackIP:null===(c=a.publicIPs[0])||void 0===c?void 0:c.ip,feedbackReason:{type:"NodeChanged",reason:o}}],delete r.expectedAddr),u=Date.now(),hL.rtcGetAccess(0,JSON.stringify(r),0,vU.REQUEST,e.join(","),r.connectSessionID),d=e.map((function(e,t){return ev(l,void 0,void 0,(function(){var i,n,o;return tv(this,(function(a){switch(a.label){case 0:return a.trys.push([0,2,,3]),[4,this._request.post(e,r)];case 1:return i=a.sent(),[3,3];case 2:throw n=a.sent(),new tw(ZN.ICE_SERVER_WRONG,"get ICE config failed",n);case 3:if(200!==i.code)throw new tw(ZN.ICE_SERVER_WRONG,"get ICE config failed",{server_code:i.code,message:JSON.stringify(i)});if(!(o=i.nodes[0]))throw new tw(ZN.ICE_SERVER_WRONG,"ICE config server return empty nodes",{code:i.code,message:JSON.stringify(i)});return[2,{result:i,firstNode:o,index:t}]}}))}))})),[2,PD(d).then((function(t){var i=t.result;t.firstNode;var n=t.index;return hL.rtcGetAccess(200,JSON.stringify(i),Date.now()-u,vU.RESPONSE,e[n],r.connectSessionID),i})).catch((function(t){var i,n,o=null===(i=t[0])||void 0===i?void 0:i.error;throw hL.rtcGetAccess(+((null==o?void 0:o.code)||(null==o?void 0:o.server_code)),null===(n=t[0])||void 0===n?void 0:n.message,Date.now()-u,vU.RESPONSE,e.join(","),r.connectSessionID,{error:JSON.stringify(o)}),t}))]}))}))},e.prototype.abort=function(){this._request.isSending&&(DL.print("abort","HTTP Request of [getICEConfigFromServer] abort"),this._request.abort())},e}(),kL=function(){function e(){this._request=new CL}return e.prototype.getH264BlackList=function(){var e=this,t={keys:["web_h264_black_list"],labelSelector:"",sdkVersion:"4.42.1",deviceType:"web"},r=BP.CONFIG_REQUEST_DOMAINS.map((function(e){return"https://".concat(e,"/decision/v1/multi")}));hL.rtcGetConfig(0,JSON.stringify(t),0,r.join(","),lU.REQUEST,"",!1);var i=r.map((function(r,i){return ev(e,void 0,void 0,(function(){var e;return tv(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this._request.post(r,t)];case 1:return e=n.sent(),[3,3];case 2:throw n.sent(),new tw(ZN.ICE_SERVER_WRONG,"get config failed");case 3:if(!Array.isArray(null==e?void 0:e.web_h264_black_list))throw new tw(ZN.ICE_SERVER_WRONG,"get config failed");return[2,{result:e,index:i}]}}))}))}));return new Promise((function(e){PD(i).then((function(t){var i=t.result,n=t.index;wL.setH264BlackList(i.web_h264_black_list),hL.rtcGetConfig(200,JSON.stringify(i),0,r[n],lU.RESPONSE,"",!1),e(i.web_h264_black_list)})).catch((function(t){hL.rtcGetConfig(500,t.message,0,"",lU.RESPONSE,"",!1),e(wL.getH264BlackList()||[])}))}))},e}(),ML={},UL={},LL={exports:{}},xL=LL.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(e){return e.encoding?"rtpmap:%d %s/%s/%s":e.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(e){return null!=e.address?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(e){return null!=e.subtype?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(e){return"extmap:%d"+(e.direction?"/%s":"%v")+(e["encrypt-uri"]?" %s":"%v")+" %s"+(e.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(e){return null!=e.sessionConfig?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(e){var t="candidate:%s %d %s %d %s %d typ %s";return t+=null!=e.raddr?" raddr %s rport %d":"%v%v",t+=null!=e.tcptype?" tcptype %s":"%v",null!=e.generation&&(t+=" generation %d"),t+=null!=e["network-id"]?" network-id %d":"%v",t+=null!=e["network-cost"]?" network-cost %d":"%v"}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(e){var t="ssrc:%d";return null!=e.attribute&&(t+=" %s",null!=e.value&&(t+=":%s")),t}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(e){return null!=e.maxMessageSize?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(e){return e.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(e){return"imageattr:%s %s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(e){return"simulcast:%s %s"+(e.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(e){return"ts-refclk:%s"+(null!=e.clksrcExt?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(e){var t="mediaclk:";return t+=null!=e.id?"id=%s %s":"%v%s",t+=null!=e.mediaClockValue?"=%s":"",t+=null!=e.rateNumerator?" rate=%s":"",t+=null!=e.rateDenominator?"/%s":""}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(xL).forEach((function(e){xL[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,i){var n=e.name&&e.names;e.push&&!r[e.push]?r[e.push]=[]:n&&!r[e.name]&&(r[e.name]={});var o=e.push?{}:n?r[e.name]:r;!function(e,r,i,n){if(n&&!i)r[n]=t(e[1]);else for(var o=0;o<i.length;o+=1)null!=e[o+1]&&(r[i[o]]=t(e[o+1]))}(i.match(e.reg),o,e.names,e.name),e.push&&r[e.push].push(o)},i=LL.exports,n=RegExp.prototype.test.bind(/^([a-z])=(.*)/);e.parse=function(e){var t={},o=[],a=t;return e.split(/(\r\n|\r|\n)/).filter(n).forEach((function(e){var t=e[0],n=e.slice(2);"m"===t&&(o.push({rtp:[],fmtp:[]}),a=o[o.length-1]);for(var s=0;s<(i[t]||[]).length;s+=1){var c=i[t][s];if(c.reg.test(n))return r(c,a,n)}})),t.media=o,t};var o=function(e,r){var i=r.split(/=(.+)/,2);return 2===i.length?e[i[0]]=t(i[1]):1===i.length&&r.length>1&&(e[i[0]]=void 0),e};e.parseParams=function(e){return e.split(/;\s?/).reduce(o,{})},e.parseFmtpConfig=e.parseParams,e.parsePayloads=function(e){return e.toString().split(" ").map(Number)},e.parseRemoteCandidates=function(e){for(var r=[],i=e.split(" ").map(t),n=0;n<i.length;n+=3)r.push({component:i[n],ip:i[n+1],port:i[n+2]});return r},e.parseImageAttributes=function(e){return e.split(" ").map((function(e){return e.substring(1,e.length-1).split(",").reduce(o,{})}))},e.parseSimulcastStreamList=function(e){return e.split(";").map((function(e){return e.split(",").map((function(e){var r,i=!1;return"~"!==e[0]?r=t(e):(r=t(e.substring(1,e.length)),i=!0),{scid:r,paused:i}}))}))}}(UL);var VL=LL.exports,FL=/%[sdv%]/g,BL=function(e){var t=1,r=arguments,i=r.length;return e.replace(FL,(function(e){if(t>=i)return e;var n=r[t];switch(t+=1,e){case"%%":return"%";case"%s":return String(n);case"%d":return Number(n);case"%v":return""}}))},jL=function(e,t,r){var i=[e+"="+(t.format instanceof Function?t.format(t.push?r:r[t.name]):t.format)];if(t.names)for(var n=0;n<t.names.length;n+=1){var o=t.names[n];t.name?i.push(r[t.name][o]):i.push(r[t.names[n]])}else i.push(r[t.name]);return BL.apply(null,i)},GL=["v","o","s","i","u","e","p","c","b","t","r","z","a"],HL=["i","c","b","a"],zL=UL,KL=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||GL,i=t.innerOrder||HL,n=[];return r.forEach((function(t){VL[t].forEach((function(r){r.name in e&&null!=e[r.name]?n.push(jL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){n.push(jL(t,r,e))}))}))})),e.media.forEach((function(e){n.push(jL("m",VL.m[0],e)),i.forEach((function(t){VL[t].forEach((function(r){r.name in e&&null!=e[r.name]?n.push(jL(t,r,e)):r.push in e&&null!=e[r.push]&&e[r.push].forEach((function(e){n.push(jL(t,r,e))}))}))}))})),n.join("\r\n")+"\r\n"};ML.write=KL,ML.parse=zL.parse,ML.parseParams=zL.parseParams,ML.parseFmtpConfig=zL.parseFmtpConfig,ML.parsePayloads=zL.parsePayloads,ML.parseRemoteCandidates=zL.parseRemoteCandidates,ML.parseImageAttributes=zL.parseImageAttributes,ML.parseSimulcastStreamList=zL.parseSimulcastStreamList;var YL=function(){function e(e){this._iceConfigNode=e}return e.prototype.modifyByIceNode=function(e){var t,r=this._iceConfigNode.iceParams,i=ML.parse(e);return null===(t=i.media)||void 0===t||t.forEach((function(e){e.iceUfrag=null==r?void 0:r.clientIceUfrag,e.icePwd=null==r?void 0:r.clientIcePwd,e.iceOptions="renomination"})),ML.write(i)},e}(),XL=function(){function e(e){this._iceConfigNode=e}return e.prototype.getServerUfrag=function(){return ev(this,void 0,void 0,(function(){var e,t;return tv(this,(function(r){switch(r.label){case 0:return e=this._iceConfigNode.iceParams,t=this,[4,$L(e.serverIceUfrag)];case 1:return t._iceUfrag=r.sent(),_L.setStats({connection_id:this._iceUfrag}),[2]}}))}))},e.prototype.modifyByIceNode=function(e){var t,r=this,i=this._iceConfigNode.certFingerprint,n=ML.parse(e);return(null==n?void 0:n.fingerprint)&&(n.fingerprint={type:"sha-256",hash:i}),null===(t=null==n?void 0:n.media)||void 0===t||t.forEach((function(e){return r.modifyMlineByIceNode(e)})),ML.write(n)},e.prototype.modifyMlineByIceNode=function(e){var t=this._iceConfigNode,r=t.publicIPs,i=t.certFingerprint,n=t.iceParams;e.fingerprint&&(e.fingerprint={type:"sha-256",hash:i}),e.icePwd=n.serverIcePwd,e.iceUfrag=this._iceUfrag,e.setup="active",this._candidates||(this._candidates=ZL(r)),e.candidates=this._candidates,e.iceOptions="renomination","application"===e.type&&(e.sctpmap={sctpmapNumber:5e3,app:"webrtc-datachannel",maxMessageSize:262144})},e}();function WL(e,t){var r,i=ML.parse(e),n=[];return i.media=i.media.map((function(e){return t.includes(e.mid+"")?(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):"inactive"!==e.direction&&n.push(e.mid),e})),(null===(r=i.groups)||void 0===r?void 0:r[0])&&(i.groups[0].mids=n.join(" ")),i}var JL=function(e,t){var r,i;try{var n=ML.parse(e),o=ML.parse(t),a="".concat(null===(r=o.groups)||void 0===r?void 0:r[0].mids).split(" "),s="".concat(null===(i=n.groups)||void 0===i?void 0:i[0].mids).split(" "),c={};a.forEach((function(e){return c[e]=e}));var u={};s.forEach((function(e){c[e]||(u[e]=e)}));var d="",l="";return n.media=n.media.filter((function(e){return u[e.mid]&&"audio"===e.type?d="".concat(e.mid):u[e.mid]&&"video"===e.type&&(l="".concat(e.mid)),u[e.mid]})),delete n.groups,delete n.msidSemantic,{partialSdp:ML.write(n),audioMid:d,videoMid:l}}catch(e){return null}},qL=function(e,t){var r;try{var i=ML.parse(e),n=[];return null===(r=i.media)||void 0===r||r.forEach((function(e){(null==t?void 0:t.includes("".concat(e.mid)))&&n.push(e)})),i.media=n,delete i.groups,delete i.msidSemantic,ML.write(i)}catch(e){return""}},ZL=function(e){if(!Array.isArray(e))return[];var t=0,r=2130706431,i=[];return e.forEach((function(e){var n={component:1,ip:e.ip,type:"host",generation:e.generation};e.udpPorts&&e.udpPorts.forEach((function(e){i.push($_($_({},n),{foundation:t++,transport:"udp",port:e,priority:r}))})),e.tcpPorts&&e.tcpPorts.forEach((function(e){i.push($_($_({},n),{foundation:t++,transport:"tcp",port:e,tcptype:"passive",priority:2130705431}))}))})),i},$L=function(e){return ev(void 0,void 0,void 0,(function(){var t,r,i,n,o,a,s;return tv(this,(function(c){switch(c.label){case 0:return t=new TextEncoder,r=t.encode("PREC"),n=Uint8Array.bind,[4,RD.b64str2ab(e)];case 1:return i=new(n.apply(Uint8Array,[void 0,c.sent()])),o=t.encode(Date.now().toString()).slice(-4),(a=new Uint8Array(2))[0]=0,a[1]=1,s=TD(Uint8Array,r,i,o,a),[4,RD.ab2b64str(s.buffer)];case 2:return[2,c.sent()]}}))}))};function QL(e,t){var r=1,i=e;(e.width>t.width||e.height>t.height)&&(r=e.width/e.height>t.width/t.height?e.width/t.width:e.height/t.height,i={width:Math.floor(e.width/r),height:Math.floor(e.height/r)});return $_($_({},i),{scaleResolutionDownBy:r})}var ex=[{width:1920,height:1080,maxLayers:3,totalPixels:2073600},{width:1280,height:720,maxLayers:3,totalPixels:921600},{width:960,height:540,maxLayers:3,totalPixels:518400},{width:640,height:360,maxLayers:2,totalPixels:230400},{width:480,height:270,maxLayers:2,totalPixels:129600},{width:320,height:180,maxLayers:1,totalPixels:57600},{width:0,height:0,maxLayers:1,totalPixels:0}];var tx={width:160,height:90,frameRate:15,maxkbps:100},rx={width:320,height:180,frameRate:15,maxkbps:300};var ix,nx,ox,ax,sx,cx="safari"===(ix="none",ID()||(null!==window.navigator.userAgent.match("Firefox")?ix="mozilla":null!==window.navigator.userAgent.match("Chrome")?(ix="chrome-stable",null!==window.navigator.userAgent.match("Electron")&&(ix="electron")):(null!==window.navigator.userAgent.match("Safari")||null!==window.navigator.userAgent.match("AppleWebKit"))&&(ix="safari")),ix);!function(e){e.codec="codec",e.inboundRtp="inbound-rtp",e.outboundRtp="outbound-rtp",e.remoteInboundRtp="remote-inbound-rtp",e.remoteOutboundRtp="remote-outbound-rtp",e.mediaSource="media-source",e.csrc="csrc",e.peerConnection="peer-connection",e.dataChannel="data-channel",e.stream="stream",e.track="track",e.transceiver="transceiver",e.sender="sender",e.receiver="receiver",e.transport="transport",e.sctpTransport="sctp-transport",e.candidatePair="candidate-pair",e.localCandidate="local-candidate",e.remoteCandidate="remote-candidate",e.certificate="certificate",e.iceServer="ice-server"}(nx||(nx={})),function(e){e[e.encode=0]="encode",e[e.decode=1]="decode"}(ox||(ox={})),function(e){e[e.none=0]="none",e[e.cpu=1]="cpu",e[e.bandwidth=2]="bandwidth",e[e.other=3]="other"}(ax||(ax={})),function(e){e[e.unknown=0]="unknown",e[e.controlling=1]="controlling",e[e.controlled=2]="controlled"}(sx||(sx={}));var ux,dx,lx,hx=function(){function e(e){this.peer=e,this.stats=[]}return e.prototype.handleCodec=function(e){return e},e.prototype.handleInboundRtp=function(e){return e},e.prototype.handleOutboundRtp=function(e){var t=e.ssrc;return t&&(e.rtxSsrc=t),e},e.prototype.handleRemoteInboundRtp=function(e){return e},e.prototype.handleRemoteOutboundRtp=function(e){return e},e.prototype.handleMediaSource=function(e){return e},e.prototype.handleCsrc=function(e){return e},e.prototype.handlePeerConnection=function(e){return e},e.prototype.handleDataChannel=function(e){return e},e.prototype.handleStream=function(e){return e},e.prototype.handleTrack=function(e){return e},e.prototype.handleTransceiver=function(e){return e},e.prototype.handleSender=function(e){return e},e.prototype.handleReceiver=function(e){return e},e.prototype.handleTransport=function(e){return e},e.prototype.handleSctpTransport=function(e){return e},e.prototype.handleCandidatePair=function(e){return e},e.prototype.handleLocalCandidate=function(e){return e},e.prototype.handleRemoteCandidate=function(e){return e},e.prototype.handleCertificate=function(e){return e},e.prototype.handleIceServer=function(e){return e},e.prototype.processStats=function(e){var t=this;e.forEach((function(e){var r;switch(e.type){case nx.candidatePair:r=t.handleCandidatePair;break;case nx.certificate:r=t.handleCertificate;break;case nx.remoteCandidate:r=t.handleRemoteCandidate;break;case nx.remoteInboundRtp:r=t.handleInboundRtp;break;case nx.remoteOutboundRtp:r=t.handleOutboundRtp;break;case nx.sctpTransport:r=t.handleSctpTransport;break;case nx.sender:r=t.handleSender;break;case nx.stream:r=t.handleStream;break;case nx.track:r=t.handleTrack;break;case nx.transceiver:r=t.handleTransceiver;break;case nx.transport:r=t.handleTransport;break;case nx.codec:r=t.handleCodec;break;case nx.csrc:r=t.handleCsrc;break;case nx.dataChannel:r=t.handleDataChannel;break;case nx.iceServer:r=t.handleIceServer;break;case nx.mediaSource:r=t.handleMediaSource;break;case nx.outboundRtp:r=t.handleOutboundRtp;break;case nx.inboundRtp:r=t.handleInboundRtp;break;case nx.peerConnection:r=t.handlePeerConnection;break;case nx.receiver:r=t.handleReceiver;break;case nx.localCandidate:r=t.handleLocalCandidate;break;default:r=function(e){return e}}r=r.bind(t),t.stats.push(r(e))}))},e.prototype.getExtraStats=function(e){return ev(this,void 0,void 0,(function(){var t=this;return tv(this,(function(r){return[2,new Promise((function(r,i){if(cx||void 0!==window.InstallTrigger)return r(t.stats);try{t.peer.getStats((function(i){i.result().forEach((function(r){if(!px.includes(r.type)){var i={};r.names().forEach((function(e){i[e]=r.stat(e)})),i.id=r.id,i.type=r.type,i.timestamp=r.timestamp,"ssrc"===i.type&&e&&e.id?e.id===i.googTrackId&&t.stats.push(i):t.stats.push(i)}})),r(t.stats)}))}catch(e){i(e)}}))]}))}))},e.prototype.getStats=function(e,t){return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(i){switch(i.label){case 0:return i.trys.push([0,7,,8]),[4,this.peer.getStats(e)];case 1:r=i.sent(),this.processStats(r),i.label=2;case 2:return i.trys.push([2,5,,6]),t?[3,4]:[4,this.getExtraStats(e)];case 3:i.sent(),i.label=4;case 4:return[3,6];case 5:return i.sent(),[3,6];case 6:return[3,8];case 7:return i.sent(),[3,8];case 8:return[2,this.stats]}}))}))},e}(),px=["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"],fx=function(e,t,r){return ev(void 0,void 0,void 0,(function(){var i;return tv(this,(function(n){switch(n.label){case 0:return i=[],e instanceof RTCPeerConnection?[4,new hx(e).getStats(t,r)]:[2,i];case 1:return[2,i=n.sent()]}}))}))};!function(e){e[e.AUTO=0]="AUTO",e[e.MODE_L=1]="MODE_L",e[e.MODE_R=2]="MODE_R",e[e.MODE_MIX=3]="MODE_MIX"}(ux||(ux={})),function(e){e[e.PLAYOUT=0]="PLAYOUT",e[e.PUBLISH=1]="PUBLISH",e[e.PLAYOUT_AND_PUBLISH=2]="PLAYOUT_AND_PUBLISH"}(dx||(dx={})),function(e){e[e.AUDIO_MIXING_STATE_PRELOADED=0]="AUDIO_MIXING_STATE_PRELOADED",e[e.AUDIO_MIXING_STATE_PLAYING=1]="AUDIO_MIXING_STATE_PLAYING",e[e.AUDIO_MIXING_STATE_PAUSED=2]="AUDIO_MIXING_STATE_PAUSED",e[e.AUDIO_MIXING_STATE_STOPPED=3]="AUDIO_MIXING_STATE_STOPPED",e[e.AUDIO_MIXING_STATE_FAILED=4]="AUDIO_MIXING_STATE_FAILED",e[e.AUDIO_MIXING_STATE_FINISHED=5]="AUDIO_MIXING_STATE_FINISHED",e[e.AUDIO_MIXING_STATE_PCM_ENABLED=6]="AUDIO_MIXING_STATE_PCM_ENABLED",e[e.AUDIO_MIXING_STATE_PCM_DISABLED=7]="AUDIO_MIXING_STATE_PCM_DISABLED"}(lx||(lx={}));var _x,vx=function(){return ev(void 0,void 0,void 0,(function(){var e,t,r,i,n,o,a;return tv(this,(function(s){switch(s.label){case 0:if(_x)return[2,_x];e=[],s.label=1;case 1:return s.trys.push([1,5,,6]),[4,DD()];case 2:return(t=s.sent())?(null==t?void 0:t.includes("level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f"))?(r=navigator.userAgent.toLowerCase(),i=!1,n=["heytapbrowser","mqqbrowser","miuibrowser"],[4,(new kL).getH264BlackList()]):[3,4]:[2,e];case 3:for(o=s.sent(),n.push.apply(n,nv([],iv(o),!1)),a=0;a<n.length;a++)r.includes(n[a])&&(i=!0);!i&&e.push("H264"),s.label=4;case 4:return(null==t?void 0:t.includes("VP8"))&&e.push("vp8"),_x=e,[2,e];case 5:return s.sent(),[2,e];case 6:return[2]}}))}))},mx=function(){return"undefined"!=typeof TransformStream&&void 0!==RTCRtpSender.prototype.createEncodedStreams&&void 0!==RTCRtpReceiver.prototype.createEncodedStreams},Sx=new qD("BasicHandler",3),Ex=mx(),yx={iceServers:[],iceTransportPolicy:"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan",encodedInsertableStreams:!!Ex||void 0},gx=function(e){function t(t){var r=e.call(this)||this;return r.monitor=t,r._peerConnection=new RTCPeerConnection(yx),r._dataChannel=r._peerConnection.createDataChannel("signaling"),r._dataChannel.binaryType="arraybuffer",r._peerConnection.ontrack=function(e){var t,i;Sx.print("constructor","pc.ontrack ".concat(e.track.kind," ").concat(e.track.id," ").concat(null===(i=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===i?void 0:i.id)),r.emit("ontrack",e)},r._peerConnection.onconnectionstatechange=function(e){Sx.print("constructor","onconnectionstatechange ".concat(r._peerConnection.iceConnectionState," -> ").concat(r._peerConnection.connectionState)),"failed"!==r._peerConnection.iceConnectionState&&"closed"!==r._peerConnection.iceConnectionState&&"failed"!==r._peerConnection.connectionState||r.emit("disconnect")},r._peerConnection.oniceconnectionstatechange=function(){var e=r._peerConnection.iceConnectionState;t.rtcPreIceState(e,mU["".concat(e.toUpperCase())])},r}return Z_(t,e),t.prototype.connect=function(e){return ev(this,void 0,void 0,(function(){var t,r,i=this;return tv(this,(function(n){switch(n.label){case 0:return Sx.print("connect","invoke connect"),[4,this._peerConnection.createOffer()];case 1:return t=n.sent(),this._localSdp=new YL(e),[4,this.setLocalDescription(t.sdp)];case 2:return n.sent(),this._remoteSdp=new XL(e),[4,this._remoteSdp.getServerUfrag()];case 3:return n.sent(),r=this._remoteSdp.modifyByIceNode(t.sdp),[4,this.setRemoteDescription(r)];case 4:return n.sent(),[4,new Promise((function(e,t){i._dataChannel.onopen=function(){Sx.print("connect","dataChannel open"),gL("es.dc.open",""),e("")},i._dataChannel.onerror=function(e){hL.rtcSignalingMsgError(e.error.sdpLineNumber,e.error.errorDetail,SU.INVALID_DATA),gL("es.dc.error",""),t(e)},i._dataChannel.onclose=function(e){gL("es.dc.close",""),t(e)},i._peerConnection.addEventListener("connectionstatechange",(function(e){"failed"!==i._peerConnection.iceConnectionState&&"closed"!==i._peerConnection.iceConnectionState&&"failed"!==i._peerConnection.connectionState||t(e)}))}))];case 5:return n.sent(),Sx.print("connect","dataChannel establish success"),[2,this._dataChannel]}}))}))},t.prototype.disconnect=function(){this._peerConnection.close(),this._dataChannel.close(),this._peerConnection.ontrack=null},t.prototype.destroy=function(){this.disconnect(),this._localSdp=void 0,this._remoteSdp=void 0},t.prototype.publish=function(e,t){return ev(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T;return tv(this,(function(I){switch(I.label){case 0:return r=e.stream,i=null==e?void 0:e.videoTrack,n=null==e?void 0:e.audioTrack,o={},a=[],Array.isArray(null==e?void 0:e.videoEncodeConfig)&&e.videoEncodeConfig.length&&(s=null==i?void 0:i.getTrack(),c={width:640,height:360,frameRate:30},s&&(u=null==s?void 0:s.getSettings(),c={width:Math.floor(u.width),height:Math.floor(u.height),frameRate:Math.floor(u.frameRate)}),d=null==e?void 0:e.videoEncodeConfig[0],l=QL(c,d),e.prevScaleResolutionDownBy=l.scaleResolutionDownBy,h={maxBitrate:1e3*d.maxKbps,scaleResolutionDownBy:l.scaleResolutionDownBy,rid:"0",maxFramerate:d.frameRate||15},o.sendEncodings=[h],a.push({width:l.width,height:l.height,framerate:d.frameRate,maxkbps:d.maxKbps,rid:"0"}),e.enableSimulcast&&(p=[],f=function(e){for(var t=0,r=e.width*e.height,i=0;i<ex.length;i++)if(r>=ex[i].totalPixels){t=i;break}if(0===t)return ex[t].maxLayers;var n=ex[t-1].totalPixels;return(n-r)/(n-ex[t].totalPixels)<.1?ex[t-1].maxLayers:ex[t].maxLayers}(l),Sx.print("simulcast() ","maxLayers: %o",f),1===e.videoEncodeConfig.length?(p=function(e,t){var r=[];if(t<=1)return r;var i=1,n=1;return e.width/e.height>16/9?(i=e.width/tx.width,n=e.width/rx.width):(i=e.height/tx.height,n=e.height/rx.height),r.push({maxkbps:tx.maxkbps,scaleResolutionDownBy:i,frameRate:tx.frameRate,width:Math.floor(e.width/i),height:Math.floor(e.height/i)}),t<=2||i>2&&r.unshift({maxkbps:rx.maxkbps,scaleResolutionDownBy:n,frameRate:rx.frameRate,width:Math.floor(e.width/n),height:Math.floor(e.height/n)}),r}(c,f),Sx.print("simulcast() ","simulcastLayers: %o",p)):(p=e.videoEncodeConfig.slice(1).slice(1-f).map((function(e){return $_({frameRate:e.frameRate||15,maxkbps:e.maxKbps||600},QL(c,e))})),Sx.print("simulcast() ","simulcastLayers2: %o",p)),p.forEach((function(e,t){var r={maxBitrate:1e3*e.maxkbps,scaleResolutionDownBy:e.scaleResolutionDownBy,rid:"".concat(t+1),maxFramerate:e.frameRate};o.sendEncodings&&o.sendEncodings.unshift(r),a.push({width:e.width,height:e.height,framerate:e.frameRate,maxkbps:e.maxkbps,rid:"".concat(t+1)})})))),Sx.print("publish videoTransceiverInit videoDescriptions","",o,a),_=null==n?void 0:n.getTrack(),(null==n?void 0:n.mixType)!==dx.PLAYOUT&&(null==n?void 0:n.mixedAudioTrack)&&(_=null==n?void 0:n.mixedAudioTrack),e.audioTransceiver=this._peerConnection.addTransceiver(_||"audio",{direction:"sendonly",streams:[r]}),v=e.audioTransceiver,(null==t?void 0:t.audioRed)&&RTCRtpSender.getCapabilities&&v.setCodecPreferences&&(Sx.print("publish","publish audio red is true"),(m=(RTCRtpSender.getCapabilities("audio")||{}).codecs)&&(S=m.findIndex((function(e){return"audio/red"===e.mimeType})),E=iv(m.splice(S,1),1),y=E[0],m.unshift(y),v.setCodecPreferences(m),Sx.print("publish","audio preferences codecs",m))),Ex&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver((null==i?void 0:i.getTrack())||"video",$_({direction:"sendonly",streams:[r]},o)),Ex&&e.initVideoEncodedTransform(),Sx.print("sender.getParameters()",e.videoTransceiver.sender.getParameters()),g=bD(),hL.rtcBeginCreateOffer(gU.UP,e.streamId,e.userId),[4,this._peerConnection.createOffer()];case 1:if(b=I.sent(),hL.rtcCreateOffer(0,bU.UP,e.streamId,e.userId,bD()-g),T=JL(b.sdp,this.getLocalDescriptionSdp()),!b.sdp||!T)throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,$_($_({sdp:b.sdp},T),{type:"incroffer",semantics:"unified-plan",videoDescriptions:a})]}}))}))},t.prototype.updateScaleResolutionDownBy=function(e){var t,r,i,n,o;return ev(this,void 0,void 0,(function(){var a,s,c,u,d,l,h;return tv(this,(function(p){return(a=null===(t=e.videoTrack)||void 0===t?void 0:t.getTrack())&&(s=null==a?void 0:a.getSettings(),c={width:Math.floor(s.width),height:Math.floor(s.height),frameRate:Math.floor(s.frameRate)},u=QL(c,e.videoEncodeConfig[0]),(d=null===(i=null===(r=e.videoTransceiver)||void 0===r?void 0:r.sender)||void 0===i?void 0:i.getParameters())&&(l=u.scaleResolutionDownBy/e.prevScaleResolutionDownBy,h=1,d.encodings=null===(n=null==d?void 0:d.encodings)||void 0===n?void 0:n.map((function(e){var t=Math.max(e.scaleResolutionDownBy=(e.scaleResolutionDownBy||1)*l,1);return t>h&&(h=t),e})),e.prevScaleResolutionDownBy=h,null===(o=e.videoTransceiver)||void 0===o||o.sender.setParameters(d))),[2]}))}))},t.prototype.subscribe=function(e,t){return ev(this,void 0,void 0,(function(){var r,i,n,o,a;return tv(this,(function(s){switch(s.label){case 0:return r="incroffer",i="unified-plan",t?[2,{sdp:this.getLocalDescriptionSdp(),partialSdp:qL(this.getLocalDescriptionSdp(),[t.audioMid,t.videoMid]),audioMid:t.audioMid,videoMid:t.videoMid,type:r,semantics:i}]:(e.audioTransceiver=this._peerConnection.addTransceiver("audio",{direction:"recvonly"}),Ex&&e.initAudioEncodedTransform(),e.videoTransceiver=this._peerConnection.addTransceiver("video",{direction:"recvonly"}),Ex&&e.initVideoEncodedTransform(),n=bD(),hL.rtcBeginCreateOffer(gU.DOWN,e.streamId,e.userId),[4,this._peerConnection.createOffer()]);case 1:if(o=s.sent(),hL.rtcCreateOffer(0,bU.DOWN,e.streamId,e.userId,bD()-n),a=JL(o.sdp,this.getLocalDescriptionSdp()),!o.sdp||!a)throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"createOffer failed");return[2,$_($_({sdp:o.sdp},a),{type:r,semantics:i})]}}))}))},t.prototype.setAnswerSdp=function(e,t,r,i,n){var o;return ev(this,void 0,void 0,(function(){var a,s,c,u,d,l,h=this;return tv(this,(function(p){switch(p.label){case 0:return hL.rtcRecvAnswer(0,RU.INCRANSWER,0,t,n,i.streamId,i.userId),a=this._peerConnection.remoteDescription,s=ML.parse(null==a?void 0:a.sdp),c=null===(o=s.media)||void 0===o?void 0:o.reduce((function(e,t){return e[t.mid]=t,e}),{}),ML.parse(t).media.forEach((function(e){return c[e.mid]=e})),u=[],d=ML.parse(e),l=d.media.map((function(e){var t;r&&r[e.mid]&&(e.mid=r[e.mid]),"inactive"!==e.direction&&u.push(e.mid);var i=c[e.mid];return null===(t=h._remoteSdp)||void 0===t||t.modifyMlineByIceNode(i),e.bundleOnly||(i.port=e.port),i})),s.media=l,d.groups=[{mids:u.join(" "),type:"BUNDLE"}],s.groups=d.groups,[4,this.setLocalDescription(ML.write(d),i,n)];case 1:return p.sent(),[4,this.setRemoteDescription(ML.write(s),i,n)];case 2:return p.sent(),[2]}}))}))},t.prototype.setLocalDescription=function(e,t,r){var i,n;return ev(this,void 0,void 0,(function(){var o,a,s,c,u,d,l;return tv(this,(function(h){switch(h.label){case 0:o=null===(i=this._localSdp)||void 0===i?void 0:i.modifyByIceNode(e),a=new RTCSessionDescription({type:"offer",sdp:o}),s=bD(),c=r||IU.UP,u=(null==t?void 0:t.streamId)||"",d=(null===(n=t)||void 0===n?void 0:n.userId)||"",h.label=1;case 1:return h.trys.push([1,3,,4]),Sx.print("setOffer","set offer: ",a),[4,this._peerConnection.setLocalDescription(a)];case 2:return h.sent(),hL.rtcSetDescription(0,a.sdp,TU.W_1,c,u,d,bD()-s,{type:"offer"}),[3,4];case 3:throw(l=h.sent())instanceof Error&&hL.rtcSetDescription(-1,l.message,TU.W_1,c,u,d,bD()-s,{type:"offer"}),l;case 4:return[2]}}))}))},t.prototype.setRemoteDescription=function(e,t,r){var i;return ev(this,void 0,void 0,(function(){var n,o,a,s,c,u;return tv(this,(function(d){switch(d.label){case 0:n=new RTCSessionDescription({type:"answer",sdp:e}),o=bD(),a=r||IU.UP,s=(null==t?void 0:t.streamId)||"",c=(null===(i=t)||void 0===i?void 0:i.userId)||"",d.label=1;case 1:return d.trys.push([1,3,,4]),Sx.print("setAnswer","set answer: ",n),[4,this._peerConnection.setRemoteDescription(n)];case 2:return d.sent(),hL.rtcSetDescription(0,n.sdp,TU.W_0,a,s,c,bD()-o,{type:"answer"}),[3,4];case 3:throw(u=d.sent())instanceof Error&&hL.rtcSetDescription(-1,u.message,TU.W_0,a,s,c,bD()-o,{type:"answer"}),u;case 4:return[2]}}))}))},t.prototype.getLocalDescriptionSdp=function(){var e,t,r,i;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.localDescription)||void 0===t?void 0:t.sdp)return null===(i=null===(r=this._peerConnection)||void 0===r?void 0:r.localDescription)||void 0===i?void 0:i.sdp;throw Error()},t.prototype.getRemoteDescriptionSdp=function(){var e,t,r,i;if(null===(t=null===(e=this._peerConnection)||void 0===e?void 0:e.remoteDescription)||void 0===t?void 0:t.sdp)return null===(i=null===(r=this._peerConnection)||void 0===r?void 0:r.remoteDescription)||void 0===i?void 0:i.sdp;throw Error()},t.prototype.closeMLine=function(e){var t,r;return ev(this,void 0,void 0,(function(){var i,n,o,a,s=this;return tv(this,(function(c){switch(c.label){case 0:return Sx.print("closeMids","closeMids: ",e),i=this.getLocalDescriptionSdp(),n=WL(i,e),o=this.getRemoteDescriptionSdp(),a=WL(o,e),[4,this._peerConnection.createOffer()];case 1:return c.sent(),[4,this.setLocalDescription(ML.write(n))];case 2:return c.sent(),(null===(t=null==n?void 0:n.media)||void 0===t?void 0:t.length)!==(null===(r=null==a?void 0:a.media)||void 0===r?void 0:r.length)&&n.media.slice(a.media.length).forEach((function(e){var t;null===(t=s._remoteSdp)||void 0===t||t.modifyMlineByIceNode(e),a.media.push(e)})),Array.isArray(n.media)&&Array.isArray(a.media)&&n.media.forEach((function(e,t){a.media[t]&&(a.media[t].mid=e.mid)})),[4,this.setRemoteDescription(ML.write(a))];case 3:return c.sent(),[2]}}))}))},t.prototype.getDefaultSdp=function(){return ev(this,void 0,void 0,(function(){var e;return tv(this,(function(t){switch(t.label){case 0:return[4,DD()];case 1:if(!(e=t.sent()))throw new tw(ZN.NOT_SUPPORTED,"Get offer Error");return[2,{sdp:e,semantics:"unified-plan",type:"offer"}]}}))}))},t.prototype.getStats=function(e,t){return fx(this._peerConnection,e,t)},t.prototype.rollback=function(e,t){var r;return ev(this,void 0,void 0,(function(){return tv(this,(function(i){switch(i.label){case 0:return Sx.print("rollback()","signalingState: %o",this._peerConnection.signalingState),"stable"!==this._peerConnection.signalingState?[3,2]:[4,null===(r=this._peerConnection)||void 0===r?void 0:r.setLocalDescription(new RTCSessionDescription({sdp:e,type:"offer"}))];case 1:i.sent(),i.label=2;case 2:return[4,this.closeMLine(t)];case 3:return i.sent(),[2]}}))}))},Object.defineProperty(t.prototype,"pc",{get:function(){return this._peerConnection},enumerable:!1,configurable:!0}),t}(XD.exports.EventEmitter),bx=new qD("Locker",2),Tx=1,Ix=function(){function e(e){this.lockingPromise=Promise.resolve(),this.locks=0,this.name="",this.lockId=Tx++,e&&(this.name=e),bx.print("[lock-".concat(this.name,"-").concat(this.lockId,"] is created."))}return Object.defineProperty(e.prototype,"isLocked",{get:function(){return this.locks>0},enumerable:!1,configurable:!0}),e.prototype.lock=function(){var e,t=this;this.locks+=1,bx.print("[lock-".concat(this.name,"-").concat(this.lockId,"] locked, current queue ").concat(this.locks,"."));var r=new Promise((function(r){e=function(){t.locks-=1,bx.print("[lock-".concat(t.name,"-").concat(t.lockId,"] unlocked, current queue ").concat(t.locks,".")),r()}})),i=this.lockingPromise.then((function(){return e}));return this.lockingPromise=this.lockingPromise.then((function(){return r})),i},e}(),Rx=T,Ax=Ku,Cx=Lv.exports.getWeakData,Ox=Dt,Nx=j,wx=Qu,Dx=Md,Px=Ue,kx=br.set,Mx=br.getterFor,Ux=kn.find,Lx=kn.findIndex,xx=Rx([].splice),Vx=0,Fx=function(e){return e.frozen||(e.frozen=new Bx)},Bx=function(){this.entries=[]},jx=function(e,t){return Ux(e.entries,(function(e){return e[0]===t}))};Bx.prototype={get:function(e){var t=jx(this,e);if(t)return t[1]},has:function(e){return!!jx(this,e)},set:function(e,t){var r=jx(this,e);r?r[1]=t:this.entries.push([e,t])},delete:function(e){var t=Lx(this.entries,(function(t){return t[0]===e}));return~t&&xx(this.entries,t,1),!!~t}};var Gx,Hx={getConstructor:function(e,t,r,i){var n=e((function(e,n){wx(e,o),kx(e,{type:t,id:Vx++,frozen:void 0}),null!=n&&Dx(n,e[i],{that:e,AS_ENTRIES:r})})),o=n.prototype,a=Mx(t),s=function(e,t,r){var i=a(e),n=Cx(Ox(t),!0);return!0===n?Fx(i).set(t,r):n[i.id]=r,e};return Ax(o,{delete:function(e){var t=a(this);if(!Nx(e))return!1;var r=Cx(e);return!0===r?Fx(t).delete(e):r&&Px(r,t.id)&&delete r[t.id]},has:function(e){var t=a(this);if(!Nx(e))return!1;var r=Cx(e);return!0===r?Fx(t).has(e):r&&Px(r,t.id)}}),Ax(o,r?{get:function(e){var t=a(this);if(Nx(e)){var r=Cx(e);return!0===r?Fx(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)}}),n}},zx=i,Kx=T,Yx=Ku,Xx=Lv.exports,Wx=Im,Jx=Hx,qx=j,Zx=Hv,$x=br.enforce,Qx=er,eV=!zx.ActiveXObject&&"ActiveXObject"in zx,tV=function(e){return function(){return e(this,arguments.length?arguments[0]:void 0)}},rV=Wx("WeakMap",tV,Jx);if(Qx&&eV){Gx=Jx.getConstructor(tV,"WeakMap",!0),Xx.enable();var iV=rV.prototype,nV=Kx(iV.delete),oV=Kx(iV.has),aV=Kx(iV.get),sV=Kx(iV.set);Yx(iV,{delete:function(e){if(qx(e)&&!Zx(e)){var t=$x(this);return t.frozen||(t.frozen=new Gx),nV(this,e)||t.frozen.delete(e)}return nV(this,e)},has:function(e){if(qx(e)&&!Zx(e)){var t=$x(this);return t.frozen||(t.frozen=new Gx),oV(this,e)||t.frozen.has(e)}return oV(this,e)},get:function(e){if(qx(e)&&!Zx(e)){var t=$x(this);return t.frozen||(t.frozen=new Gx),oV(this,e)?aV(this,e):t.frozen.get(e)}return aV(this,e)},set:function(e,t){if(qx(e)&&!Zx(e)){var r=$x(this);r.frozen||(r.frozen=new Gx),oV(this,e)?sV(this,e,t):r.frozen.set(e,t)}else sV(this,e,t);return this}})}var cV=function(e){function t(){var t=e.call(this)||this;return t._hasVideoPermission=!1,t._hasAudioPermission=!1,t.inited=!1,t.deviceMap={audioinput:new Map,audiooutput:new Map,videoinput:new Map},t._handleDeviceChange=t._handleDeviceChange.bind(t),!ID()&&t.refreshDevices(),t}return Z_(t,e),t.prototype.refreshDevices=function(){return ev(this,void 0,void 0,(function(){var e,t=this;return tv(this,(function(r){switch(r.label){case 0:return navigator.mediaDevices?[4,navigator.mediaDevices.enumerateDevices()]:[2];case 1:return(e=r.sent()).forEach((function(r){var i;null===(i=t.deviceMap[r.kind])||void 0===i||i.set(r.deviceId,{deviceName:r.label||uV(r,e),deviceInfo:r,deviceId:r.deviceId,deviceType:r.kind,deviceState:"active"})})),this.inited||this.initListener(),this.inited=!0,[2]}}))}))},t.prototype.initListener=function(){var e;return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return"function"==typeof(null===(e=navigator.mediaDevices)||void 0===e?void 0:e.addEventListener)&&navigator.mediaDevices.addEventListener("devicechange",this._handleDeviceChange),[2]}))}))},t.prototype._handleDeviceChange=function(){return ev(this,void 0,void 0,(function(){var e,t,r=this;return tv(this,(function(i){switch(i.label){case 0:return[4,navigator.mediaDevices.enumerateDevices()];case 1:return e=i.sent(),t=Array.from(nv(nv(nv([],iv(this.deviceMap.audioinput.values()),!1),iv(this.deviceMap.videoinput.values()),!1),iv(this.deviceMap.audiooutput.values()),!1)),e.forEach((function(t){var i=r.deviceMap[t.kind].get(t.deviceId),n={deviceName:t.label||uV(t,e),deviceType:t.kind,deviceId:t.deviceId,deviceInfo:t,deviceState:"active"};r.deviceMap[t.kind].set(t.deviceId,n),i&&"inactive"!==i.deviceState||r.emit("onMediaDeviceStateChanged",$_({},n))})),t.forEach((function(t){e.find((function(e){return e.deviceId===t.deviceId&&e.kind===t.deviceType}))||(t.deviceState="inactive",r.deviceMap[t.deviceType].delete(t.deviceId),r.emit(wD.onMediaDeviceStateChanged,t))})),[2]}}))}))},t.prototype.getVideoPermission=function(){return ev(this,void 0,void 0,(function(){var e=this;return tv(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new tw(ZN.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasVideoPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!1,video:!0}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasVideoPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasVideoPermission]}}))}))},t.prototype.getAudioPermission=function(){return ev(this,void 0,void 0,(function(){var e=this;return tv(this,(function(t){switch(t.label){case 0:if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new tw(ZN.NOT_SUPPORTED,"GetUserMedia not supported");if(this.hasAudioPermission)return[2,!0];t.label=1;case 1:return t.trys.push([1,3,,4]),[4,navigator.mediaDevices.getUserMedia({audio:!0,video:!1}).then((function(t){t&&(t.getTracks().forEach((function(e){return e.stop()})),e.hasAudioPermission=!0,e.inited||e.refreshDevices())}))];case 2:case 3:return t.sent(),[3,4];case 4:return[2,this.hasAudioPermission]}}))}))},t.prototype.getDevices=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.getAudioPermission()];case 1:case 2:return e.sent(),[3,3];case 3:return e.trys.push([3,5,,6]),[4,this.getVideoPermission()];case 4:case 5:return e.sent(),[3,6];case 6:return[4,this.refreshDevices()];case 7:return e.sent(),[2,Array.from(nv(nv(nv([],iv(this.deviceMap.audioinput.values()),!1),iv(this.deviceMap.videoinput.values()),!1),iv(this.deviceMap.audiooutput.values()),!1)).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getMicrophones=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return[4,this.refreshDevices()];case 1:return e.sent(),[2,Array.from(this.deviceMap.audioinput.values()).filter((function(e){return"active"===e.deviceState}))]}}))}))},t.prototype.getCameras=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.videoinput.values()).filter((function(e){return"active"===e.deviceState}))]}))}))},t.prototype.getAudioPlayback=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){return this.refreshDevices(),[2,Array.from(this.deviceMap.audiooutput.values()).filter((function(e){return"active"===e.deviceState}))]}))}))},t.prototype.getDeviceById=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return[4,this.getDevices()];case 1:return[2,t.sent().find((function(t){return t.deviceId===e}))]}}))}))},Object.defineProperty(t.prototype,"hasAudioPermission",{get:function(){return this._hasAudioPermission},set:function(e){if(!e)throw new tw(ZN.NO_PERMISSION,"Cannot revoke audio permission");this.refreshDevices(),this._hasAudioPermission=!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasVideoPermission",{get:function(){return this._hasVideoPermission},set:function(e){if(!e)throw new tw(ZN.NO_PERMISSION,"Cannot revoke Video permission");this.inited||this.refreshDevices(),this._hasVideoPermission=!0},enumerable:!1,configurable:!0}),t}($D),uV=function(e,t){var r=t.filter((function(t){return t.kind===e.kind})).findIndex((function(t){return t===e}));return{audioinput:"microphone_",audiooutput:"speaker_",videoinput:"camera_"}[e.kind]+r},dV=new cV,lV=function(){function e(){}return e.prototype.getAudioContextInstance=function(){if(!this._audioContextInstance){var e=window.AudioContext||window.webkitAudioContext;this._audioContextInstance=new e}return this._audioContextInstance},e}(),hV=function(){function e(e){var t=pV.getAudioContextInstance();if(e instanceof MediaStreamTrack){var r=new MediaStream;r.addTrack(e),this._audioSource=t.createMediaStreamSource(r)}else e instanceof AudioNode?this._audioSource=e:(this._audioSource=t.createMediaElementSource(e),this._audioSource.connect(t.destination));var i=t.createAnalyser();this._audioSource.connect(i),this._analyserNode=i}return e.prototype.getAudioLevel=function(){var e=new Uint8Array(2048);this._analyserNode.getByteTimeDomainData(e);var t=0;return e.forEach((function(e){return t=Math.max(t,Math.abs(e-128))})),t/128*255},e.prototype.destroy=function(){this._audioSource.disconnect(),this._analyserNode.disconnect()},e}(),pV=new lV,fV=new qD("VERTC",0),_V=new WeakMap,vV=function(e){return _V.get(e)},mV=function(e){function t(t,r){var i=e.call(this)||this;return i._trackId=t,i.mediaType=r,i}return Z_(t,e),t.prototype.getId=function(){return this._trackId},t}($D),SV=function(e){function t(t,r,i){var n=e.call(this,r,i)||this;return n._mediaTrack=t,n._initListeners(),n}return Z_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t.prototype.setTrack=function(e){this._mediaTrack=e},t.prototype.close=function(){var e;return null===(e=this._mediaTrack)||void 0===e?void 0:e.stop()},t.prototype._initListeners=function(){var e=this;this._mediaTrack instanceof MediaStreamTrack&&this._mediaTrack.addEventListener("ended",(function(){hL.rtcError("track-ended mediaType: ".concat(e._mediaTrack.kind),-1001),e.emit("track-ended",e)}))},t}(mV),EV=function(e){function t(t,r,i){var n=e.call(this,r,i)||this;return n._mediaTrack=t,n}return Z_(t,e),t.prototype.getTrack=function(){return this._mediaTrack},t}(mV),yV=function(e){function t(t,r){var i=e.call(this,t,r,"video")||this;return i.dummy=!1,i}return Z_(t,e),t.prototype.updateVideoCaptureConfig=function(){var e;return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return this.videoCaptureConfig?(fV.print("updateVideoEncoderConfig","update localVideoTrack: ",this.videoCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.videoCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t.prototype.replaceTrack=function(e){this.setTrack(e)},t}(SV),gV=function(e){function t(t,r){var i=e.call(this,t,r,"audio")||this;return i.mixType=dx.PLAYOUT_AND_PUBLISH,i}return Z_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new hV(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t.prototype.updateAudioCaptureConfig=function(){var e;return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return this.audioCaptureConfig?(fV.print("updateAudioCaptureConfig","update localAudioTrack: ",this.audioCaptureConfig),[4,null===(e=this.getTrack())||void 0===e?void 0:e.applyConstraints(this.audioCaptureConfig)]):[2];case 1:return t.sent(),[2]}}))}))},t}(SV),bV=function(e){function t(t,r){return e.call(this,t,r,"video")||this}return Z_(t,e),t}(EV),TV=function(e){function t(t,r){return e.call(this,t,r,"audio")||this}return Z_(t,e),t.prototype.getAudioLevel=function(){return this._audioLevelFetcher||(this._audioLevelFetcher=new hV(this.getTrack())),this._audioLevelFetcher.getAudioLevel()},t}(EV),IV=function(e){function t(t,r){return e.call(this,t,r)||this}return Z_(t,e),t}(gV),RV=function(e){function t(t,r){return e.call(this,t,r)||this}return Z_(t,e),t}(yV),AV=function(e){function t(t,r){return e.call(this,t,r)||this}return Z_(t,e),t}(yV),CV=function(e){function t(t,r){return e.call(this,t,r)||this}return Z_(t,e),t}(gV),OV=function(e){function t(t,r){return e.call(this,t,r)||this}return Z_(t,e),t}(yV),NV=function(e){function t(t,r){return e.call(this,t,r)||this}return Z_(t,e),t}(gV);function wV(e){return new RV(e,gD())}function DV(e){var t;return ev(this,void 0,void 0,(function(){var r,i,n,o,a,s;return tv(this,(function(c){switch(c.label){case 0:i=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",c.label=1;case 1:return c.trys.push([1,3,,4]),fV.print("createCameraVideoTrack","constraints:",e),hL.rtcVideoCaptureEvent({event_type:KU.START,media_device_id:i}),n=bD(),[4,navigator.mediaDevices.getUserMedia({video:e})];case 2:return r=c.sent(),hL.rtcVideoCaptureEvent({event_type:KU.START_CAPTURE_RESULT,media_device_id:i,reason:XU.SUCCESS,elapse:bD()-n}),dV.hasVideoPermission=!0,[3,4];case 3:throw o=c.sent(),hL.rtcVideoCaptureEvent({event_type:KU.RUNNING_FAILED,media_device_id:i,error_code:o.code,reason:o.name+o.message}),new tw(ZN.GET_VIDEO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getVideoTracks()[0],_V.set(a,r),(s=new RV(a,gD())).videoCaptureConfig=e,[2,s]}}))}))}function PV(e){var t;return ev(this,void 0,void 0,(function(){var r,i,n,o,a;return tv(this,(function(s){switch(s.label){case 0:fV.print("createCameraVideoTrack","constraints:",e),i=(null===(t=null==e?void 0:e.deviceId)||void 0===t?void 0:t.exact)||"default",s.label=1;case 1:return s.trys.push([1,3,,4]),hL.rtcVideoCaptureEvent({event_type:KU.START,media_device_id:i}),n=bD(),[4,navigator.mediaDevices.getUserMedia({audio:e})];case 2:return r=s.sent(),hL.rtcVideoCaptureEvent({event_type:KU.START_CAPTURE_RESULT,media_device_id:i,reason:XU.SUCCESS,elapse:bD()-n}),dV.hasAudioPermission=!0,[3,4];case 3:throw o=s.sent(),hL.rtcVideoCaptureEvent({event_type:KU.RUNNING_FAILED,media_device_id:i,error_code:o.code,reason:o.name+o.message}),new tw(ZN.GET_AUDIO_TRACK_FAILED,"throw error from getUserMedia",o);case 4:return a=r.getAudioTracks()[0],_V.set(a,r),[2,new IV(a,gD())]}}))}))}function kV(e){return void 0===e&&(e=!1),ev(this,void 0,void 0,(function(){var t,r,i;return tv(this,(function(n){switch(n.label){case 0:fV.print("createScreenStream","withAudio:",e),n.label=1;case 1:return n.trys.push([1,3,,4]),hL.rtcVideoCaptureEvent({event_type:KU.START,media_device_id:"screen"}),r=bD(),[4,navigator.mediaDevices.getDisplayMedia({video:!0,audio:e})];case 2:return t=n.sent(),hL.rtcVideoCaptureEvent({event_type:KU.START_CAPTURE_RESULT,media_device_id:"screen",reason:XU.SUCCESS,elapse:bD()-r}),[3,4];case 3:throw i=n.sent(),hL.rtcVideoCaptureEvent({event_type:KU.RUNNING_FAILED,media_device_id:"screen",error_code:i.code,reason:i.name+i.message}),new tw(ZN.GET_SCREEN_TRACK_FAILED,"throw error from getDisplayMedia",i);case 4:return[2,t]}}))}))}Bi({target:"Number",stat:!0},{isNaN:function(e){return e!=e}}),new qD("Stats",2);var MV,UV=function(){function e(e,t,r,i){this._client=e,this._handler=t,this.dataChannelRTT={},this._rttTimer={},this._remoteStreamStasEvtIntervals={},this._remoteStreamAudioStallInterval={},this._localStreamStasEvtIntervals={},this._videoInWaiting={},this.monitor=r,this._audioStallInterval=((null==i?void 0:i.audio_stall_interval)||200)/2,this._audioStallRatio=(null==i?void 0:i.audio_stall_ratio)||.6}return e.prototype.setRemoteStreamStatsEvtInterval=function(e,t){var r,i;return void 0===t&&(t={rtt:!0}),ev(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p,f,_=this;return tv(this,(function(v){switch(v.label){case 0:return t.rtt&&this.getDataChannelRTT(e.userId),n={audio:{},video:{},remoteStream:e},o=null===(r=e.audioTrack)||void 0===r?void 0:r.getTrack(),a=null===(i=e.videoTrack)||void 0===i?void 0:i.getTrack(),this.getRemoteVideoStats(a,n),[4,this.getRemoteAudioStats(o,n)];case 1:return v.sent(),this.delRemoteStreamStatsEvtInterval(e),s=0,c=0,this._audioStallInterval>0&&void 0!==n.audio.concealedSamples&&(u=n.audio.concealedSamples,d=n.audio.totalSamplesReceived,n.audio.silentConcealedSamples,l=bD(),h={isStall:!1,counted:!1,diff:0},p=.5*this._audioStallInterval,this._remoteStreamAudioStallInterval[e.streamId]=setInterval((function(){return ev(_,void 0,void 0,(function(){var t,r,i,n,a,f,_,v,m,S,E;return tv(this,(function(y){switch(y.label){case 0:return t=bD(),(r=t-l)<p?[2]:(i=e.hasAudio,n=e.subAudio,i&&n?[4,this._handler.getStats(o,!0)]:(h.isStall=!1,h.counted=!1,[2]));case 1:for(a=y.sent(),f=a.length,_=0;_<f;_++)if(v=a[_],m=v.concealedSamples,S=v.totalSamplesReceived,"inbound-rtp"===v.type){E=S-d,m-u>=this._audioStallRatio*E?(h.isStall?(h.counted?c+=r:(c=c+h.diff+r,s++),h.counted=!0):(h.counted=!1,h.diff=r),h.isStall=!0):(h.isStall=!1,h.counted=!1),u=m,d=S,l=t;break}return[2]}}))}))}),this._audioStallInterval)),f=function(){return ev(_,void 0,void 0,(function(){var t,r,i,o,a,u;return tv(this,(function(d){switch(d.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(u=e.videoTrack)||void 0===u?void 0:u.getTrack(),[4,this.getRemoteAudioStats(t,n,s,c)];case 1:return i=d.sent(),s=0,c=0,[4,this.getRemoteVideoStats(r,n)];case 2:return o=d.sent(),[2,{audioStats:i,videoStats:o,isScreen:e.isScreen,userId:e.userId}]}}))}))},this._remoteStreamStasEvtIntervals[e.streamId]=setInterval((function(){return ev(_,void 0,void 0,(function(){var e;return tv(this,(function(t){switch(t.label){case 0:return[4,f()];case 1:return e=t.sent(),this._client.emit("onRemoteStreamStats",e),[2]}}))}))}),2e3),[2]}}))}))},e.prototype.delRemoteStreamStatsEvtInterval=function(e){clearInterval(this._remoteStreamStasEvtIntervals[e.streamId]),clearInterval(this._remoteStreamAudioStallInterval[e.streamId]),delete this._remoteStreamAudioStallInterval[e.streamId]},e.prototype.unsubscribe=function(e){this.delRemoteStreamStatsEvtInterval(e),clearTimeout(this._rttTimer[e.userId]),this._videoInWaiting[e.streamId]=!1},e.prototype.getRemoteAudioStats=function(e,t,r,i){return ev(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p,f,_,v;return tv(this,(function(m){switch(m.label){case 0:return n={},o={timestamp:Date.now()},a=t.remoteStream,s=a.streamId,c=a.userId,u=a.isScreen,d=a.audioMid,l=a.subMediaType,h=a._attributes,p={media_type:"audio",is_screen:!!u,direction:"down",stream_id:s,stream_user_id:c,vid:d,connection_status:navigator.onLine,mute_state:l===OP.AUDIO_AND_VIDEO||l===OP.AUDIO_ONLY?"mute_state_off":"mute_state_on",remote_user_capture_state:h.localaudio?"capture_state_on":"capture_state_off",remote_user_mute_state:h.localaudio&&h.audiostream?"mute_state_off":"mute_state_on"},e&&this._handler?[4,this._handler.getStats(e)]:[2,n];case 1:return(f=m.sent()).length?(f.forEach((function(e){var t=e.type,r=e.packetsLost,i=e.packetsReceived,a=e.bytesReceived,s=e.jitterBufferDelay,c=e.jitterBufferEmittedCount,u=e.clockRate,d=e.channels,l=e.totalSamplesReceived,h=e.concealedSamples,f=e.silentConcealedSamples,_=e.concealmentEvents,v=e.totalRoundTripTime,m=e.state,S=e.currentRoundTripTime,E=e.audioLevel,y=e.totalAudioEnergy,g=e.totalSamplesDuration,b=e.mimeType,T=e.googDecodingNormal,I=e.fecPacketsReceived,R=e.availableIncomingBitrate,A=e.availableOutgoingBitrate,C=e.bytesSent,O=e.nominated,N=e.id,w=e.writable,D=e.jitter,P=e.candidateType,k=e.ip,M=e.address,U=e.networkType,L=e.port,x=e.protocol,V=e.audioOutputLevel,F=e.requestsReceived,B=e.responsesReceived,j=e.requestsSent,G=e.consentRequestsSent,H=e.responsesSent,z=e.ssrc,K=e.kind;"inbound-rtp"===t?(o.packetsLost=r,o.packetsReceived=i,p.packetsReceived=i,o.bytesReceived=a,p.bytes=a,void 0!==s&&(n.jitterBufferDelay=s/c*1e3,p.average_jitter_buffer_delay_ms=n.jitterBufferDelay),void 0!==l&&(o.totalSamplesReceived=l,n.concealedSamples=h,o.concealedSamples=h,o.silentConcealedSamples=f,p.concealedSamples=h,n.concealmentEvents=_,p.totalSamplesReceived=l),void 0!==I&&(p.fec_packets_received=I),p.jitter=1e3*D,p.ssrc=z):"codec"===t?(n.recordSampleRate=u,d&&(n.numChannels=d),p.codecName=b):"candidate-pair"===t?(p.ice_available_incoming_bitrate=R,p.ice_available_outgoing_bitrate=A,p.ice_bytes_received=a,p.ice_bytes_sent=C,p.ice_nominated=+O,p.ice_pair_id=N,p.ice_pair_rtt=S,p.rtt=1e3*S,p.ice_pair_state=m,p.ice_pair_writable=w,p.recv_ping_requests=F,p.recv_ping_responses=B,p.sent_ping_requests_before_first_response=j,p.sent_ping_requests_total=j+(G||0),p.sent_ping_responses=H,"succeeded"===m&&(n.rtt=1e3*S,n.total_rtt=1e3*v)):"track"===t&&"audio"===K?(p.audio_level=-10*Math.log10(Math.pow(E,2)),p.volume=255*E,p.total_audio_energy=y,p.totalAudioDuration=g):"ssrc"===t?(p.decodingNormal=T,p.recvAudioLevel=V):"local-candidate"===t?(p.local_candidate_type=P,p.local_ip=k||M,p.local_network_type=U,p.local_port=L,p.protocol=x):"remote-candidate"===t&&(p.remote_candidate_type=P,p.remote_ip=k||M,p.remote_port=L)})),(_=t.audio).timestamp?(n.audioLossRate=(o.packetsLost-_.packetsLost)/(o.packetsReceived-_.packetsReceived+(o.packetsLost-_.packetsLost)),n.audioLossRate=Number.isNaN(n.audioLossRate)?0:n.audioLossRate,p.packetsLost=Math.round(o.packetsLost-_.packetsLost),p.fraction_lost=n.audioLossRate,p.packets_lost_rate=n.audioLossRate,n.statsInterval=o.timestamp-_.timestamp,p.stats_interval=n.statsInterval,n.receivedKBitrate=(o.bytesReceived-_.bytesReceived||0)/n.statsInterval,p.bitrate=Math.round(8e3*n.receivedKBitrate),p.bandwidth=Math.round(p.bitrate/1024),void 0!==o.concealedSamples&&(p.interval_concealed_samples=o.concealedSamples-_.concealedSamples,p.interval_samples_received=o.totalSamplesReceived-_.totalSamplesReceived,p.interval_silent_concealed_samples=o.silentConcealedSamples-_.silentConcealedSamples,n.receivedSampleRate=1e3*p.interval_samples_received/n.statsInterval),t.audio=o,this.dataChannelRTT[t.remoteStream.userId]&&(v=this.dataChannelRTT[t.remoteStream.userId]/2,n.e2eDelay=v+(n.jitterBufferDelay||0),p.e2e_delay_ms=n.e2eDelay,p.total_rtt_ms=v),this._audioStallInterval>0&&void 0!==o.concealedSamples&&(p.concealed_samples===p.interval_concealed_samples&&p.total_samples_received===p.interval_samples_received?(p.stall_count=0,p.stall_duration=0):(p.stall_count=r,p.stall_duration=i),n.stallCount=p.stall_count,n.stallDuration=p.stall_duration),this.monitor.rtcMediaStatistics(p,{}),[2,n]):(t.audio=o,[2,n])):[2,n]}}))}))},e.prototype.getRemoteVideoStats=function(e,t){return ev(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p,f;return tv(this,(function(_){switch(_.label){case 0:return r={},i={timestamp:Date.now()},n=t.remoteStream,o=n.streamId,a=n.userId,s=n.isScreen,c=n.subMediaType,u=n._attributes,d={media_type:"video",is_screen:!!s,direction:"down",stream_id:o,stream_user_id:a,vid:t.remoteStream.videoMid,connection_status:navigator.onLine,mute_state:c===OP.AUDIO_AND_VIDEO||c===OP.VIDEO_ONLY?"mute_state_off":"mute_state_on",remote_user_capture_state:u.localvideo?"capture_state_on":"capture_state_off",remote_user_mute_state:u.localvideo&&u.videostream?"mute_state_off":"mute_state_on"},e&&this._handler?(r.isScreen=s,[4,this._handler.getStats(e)]):[2,r];case 1:return(l=_.sent()).length?(l.forEach((function(e){var t=e.type,n=e.frameHeight,o=e.frameWidth,a=e.packetsLost,s=e.packetsReceived,c=e.bytesReceived,u=e.framesDecoded,l=e.jitterBufferDelay,h=e.jitterBufferEmittedCount,p=e.mimeType,f=e.firCount,_=e.availableIncomingBitrate,v=e.availableOutgoingBitrate,m=e.bytesSent,S=e.nominated,E=e.id,y=e.currentRoundTripTime,g=e.state,b=e.writable,T=e.candidateType,I=e.ip,R=e.address,A=e.networkType,C=e.port,O=e.nackCount,N=e.pliCount,w=e.protocol,D=e.requestsReceived,P=e.responsesReceived,k=e.requestsSent,M=e.consentRequestsSent,U=e.responsesSent,L=e.ssrc,x=e.kind,V=e.jitter,F=e.framesReceived,B=e.keyFramesDecoded,j=e.totalDecodeTime,G=e.decoderImplementation,H=e.lastPacketReceivedTimestamp;"inbound-rtp"===t?(i.packetsLost=a,d.packetsLost=a,i.packetsReceived=s,d.packetsReceived=s,i.bytesReceived=c,d.bytes=c,i.framesDecoded=u,void 0!==l&&(i.jitterBufferDelay=l/h*1e3,d.average_jitter_buffer_delay_ms=i.jitterBufferDelay),d.fir_count=f,d.nackCount=O,d.pli_count=N,d.ssrc=L,d.jitter=V,d.framesReceived=F,i.framesReceived=F,d.framesDecoded=u,d.key_frames_decoded=B,d.total_decode_time=j,d.decoder_name=G,d.last_packet_received_timestamp=H):"track"===t&&"video"===x?(r.width=o,d.frame_size_width=o,r.height=n,d.frame_size_height=n,void 0!==F&&(d.framesReceived=F,i.framesReceived=F)):"codec"===t?d.codecName=p:"candidate-pair"===t?(d.ice_available_incoming_bitrate=_,d.ice_available_outgoing_bitrate=v,d.ice_bytes_received=c,d.ice_bytes_sent=m,d.ice_nominated=+S,d.ice_pair_id=E,d.ice_pair_rtt=y,d.rtt=1e3*y,r.rtt=d.rtt,d.ice_pair_state=g,d.ice_pair_writable=b,d.recv_ping_requests=D,d.recv_ping_responses=P,d.sent_ping_requests_before_first_response=k,d.sent_ping_requests_total=k+(M||0),d.sent_ping_responses=U):"local-candidate"===t?(d.local_candidate_type=T,d.local_ip=I||R,d.local_network_type=A,d.local_port=C,d.protocol=w):"remote-candidate"===t&&(d.remote_candidate_type=T,d.remote_ip=I||R,d.remote_port=C)})),h=t.video,p=t.remoteStream,h.timestamp?(r.videoLossRate=(i.packetsLost-h.packetsLost)/(i.packetsReceived-h.packetsReceived+(i.packetsLost-h.packetsLost)),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,d.fraction_lost=r.videoLossRate,d.packets_lost_rate=r.videoLossRate,r.statsInterval=i.timestamp-h.timestamp,d.stats_interval=r.statsInterval,r.receivedKBitrate=(i.bytesReceived-h.bytesReceived||0)/r.statsInterval,d.bitrate=Math.round(8e3*r.receivedKBitrate),d.bandwidth=Math.round(d.bitrate/1024),r.decoderOutputFrameRate=1e3*(i.framesDecoded-h.framesDecoded)/r.statsInterval,r.receivedFrameRate=1e3*(i.framesReceived-h.framesReceived)/r.statsInterval,d.frame_rate_decoded=Math.round(r.decoderOutputFrameRate),d.frame_rate_received=d.frame_rate_decoded,t.video=i,this.dataChannelRTT[t.remoteStream.userId]&&(f=this.dataChannelRTT[t.remoteStream.userId]/2,r.e2eDelay=f+(i.jitterBufferDelay||0),d.e2e_delay_ms=r.e2eDelay,d.total_rtt_ms=f),this.processStall(p,d,r,s),this.monitor.rtcMediaStatistics(d,{}),[2,r]):(t.video=i,[2,r])):[2,r]}}))}))},e.prototype.processStall=function(e,t,r,i){var n=0,o=0,a=0;if(e.recordedVideoFrames){e.recordedVideoFrames.forEach((function(e){e.isStall&&(n+=e.stallCount,o+=e.stallDuration),a=e.playTime})),e.recordedVideoFrames.length||(o=2e3,n=this._videoInWaiting[e.streamId]?0:1,this._videoInWaiting[e.streamId]=!0);var s=e.recordedVideoFrames.pop();s&&(s.isStall?this._videoInWaiting[e.streamId]=!0:this._videoInWaiting[e.streamId]=!1),e.recordedVideoFrames=[]}t.stall_count=n,i?(t.stuck_length=o,t.stall_duration=void 0):(t.stall_duration=o,t.stuck_length=void 0),t.play_time=a,r.stallCount=n,r.stallDuration=o},e.prototype.setLocalStreamStatsEvtInterval=function(e){var t,r,i=this,n={audio:{},video:{},localStream:e},o=null===(t=e.audioTrack)||void 0===t?void 0:t.getTrack(),a=null===(r=e.videoTrack)||void 0===r?void 0:r.getTrack();this.getAudioStats(o,n),this.getVideoStats(a,n),this.delLocalStreamStatsEvtInterval(e);this._localStreamStasEvtIntervals[e.streamId]=setInterval((function(){return ev(i,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:return[4,ev(i,void 0,void 0,(function(){var t,r,i,o,a,s;return tv(this,(function(c){switch(c.label){case 0:return t=null===(a=e.audioTrack)||void 0===a?void 0:a.getTrack(),r=null===(s=e.videoTrack)||void 0===s?void 0:s.getTrack(),[4,this.getAudioStats(t,n)];case 1:return i=c.sent(),[4,this.getVideoStats(r,n)];case 2:return o=c.sent(),[2,{audioStats:i,videoStats:o,isScreen:e.isScreen}]}}))}))];case 1:return t=r.sent(),this._client.emit("onLocalStreamStats",t),[2]}}))}))}),2e3)},e.prototype.delLocalStreamStatsEvtInterval=function(e){clearInterval(this._localStreamStasEvtIntervals[e.streamId])},e.prototype.unpublish=function(e){this.delLocalStreamStatsEvtInterval(e)},e.prototype.getAudioStats=function(e,t){return ev(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l;return tv(this,(function(h){switch(h.label){case 0:return r={},i={timestamp:Date.now()},n=t.localStream,o=n.streamId,a=n.audioMid,s=n.isScreen,c=n.pubAttributes,u={media_type:"audio",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localaudio?"capture_state_on":"capture_state_off"},e&&this._handler?[4,this._handler.getStats(e)]:[2,r];case 1:return(d=h.sent()).length?(d.forEach((function(e){var t=e.type,n=e.packetsSent,o=e.packetsLost,a=e.bytesSent,s=e.clockRate,c=e.roundTripTime,d=e.channels,l=e.audioLevel,h=e.googRtt,p=e.mimeType,f=e.availableIncomingBitrate,_=e.availableOutgoingBitrate,v=e.bytesReceived,m=e.nominated,S=e.id,E=e.currentRoundTripTime,y=e.state,g=e.writable,b=e.requestsReceived,T=e.responsesReceived,I=e.requestsSent,R=e.consentRequestsSent,A=e.responsesSent,C=e.jitter,O=e.candidateType,N=e.ip,w=e.address,D=e.networkType,P=e.port,k=e.protocol,M=e.nackCount,U=e.retransmittedBytesSent,L=e.retransmittedPacketsSent,x=e.roundTripTimeMeasurements,V=e.audioInputLevel,F=e.ssrc,B=e.totalAudioEnergy,j=e.totalSamplesDuration,G=e.mediaType;"outbound-rtp"===t?(i.packetsSent=n,i.bytesSent=a,u.bytes=a,u.packetsSent=n,u.nackCount=M,u.ssrc=F,u.retransmitted_bytes_sent=U,u.retransmitted_packets_sent=L):"remote-inbound-rtp"===t?(i.packetsLost=o,u.packetsLost=o,u.jitter=1e3*C,r.rtt=1e3*c,u.rtt=r.rtt,u.round_trip_time_measurements=x):"codec"===t?(r.recordSampleRate=s,r.numChannels=d,u.codecName=p):"media-source"===t?(u.audio_level=-10*Math.log10(Math.pow(l,2)),u.volume=255*l,u.total_audio_energy=B,u.total_samples_duration=j):"ssrc"===t&&"audio"===G?(u.audio_network_elapse=h,u.send_level=V):"candidate-pair"===t?(u.ice_available_incoming_bitrate=f,u.ice_available_outgoing_bitrate=_,u.ice_bytes_received=v,u.ice_bytes_sent=a,u.ice_nominated=+m,u.ice_pair_id=S,u.ice_pair_rtt=E,u.ice_pair_state=y,u.ice_pair_writable=g,u.recv_ping_requests=b,u.recv_ping_responses=T,u.sent_ping_requests_before_first_response=I,u.sent_ping_requests_total=I+(R||0),u.sent_ping_responses=A):"local-candidate"===t?(u.local_candidate_type=O,u.local_ip=N||w,u.local_network_type=D,u.local_port=P,u.protocol=k):"remote-candidate"===t&&(u.remote_candidate_type=O,u.remote_ip=N||w,u.remote_port=P)})),(l=t.audio).timestamp?(void 0!==i.packetsLost&&(r.audioLossRate=(i.packetsLost-l.packetsLost)/(i.packetsSent-l.packetsSent),r.audioLossRate=Number.isNaN(r.audioLossRate)?0:r.audioLossRate,u.fraction_lost=r.audioLossRate),r.statsInterval=i.timestamp-l.timestamp,u.stats_interval=r.statsInterval,r.sendKBitrate=(i.bytesSent-l.bytesSent||0)/r.statsInterval*8,u.bitrate=Math.round(1e3*r.sendKBitrate),u.bandwidth=Math.round(u.bitrate/1024),t.audio=i,this.monitor.rtcMediaStatistics(u,{}),[2,r]):(t.audio=i,[2,r])):[2,r]}}))}))},e.prototype.getVideoStats=function(e,t){return ev(this,void 0,void 0,(function(){var r,i,n,o,a,s,c,u,d,l,h,p,f,_;return tv(this,(function(v){switch(v.label){case 0:return r={},i={timestamp:Date.now(),simulcast:{}},n=t.localStream,o=n.streamId,a=n.videoMid,s=n.isScreen,c=n.pubAttributes,u=n.enableSimulcast,d={media_type:"video",is_screen:!!s,direction:"up",stream_id:o,vid:a,connection_status:navigator.onLine,capture_state:c.localvideo?"capture_state_on":"capture_state_off"},e&&this._handler?(r.isScreen=s,[4,this._handler.getStats(e)]):[2,r];case 1:return(l=v.sent()).length?(h=0,l.forEach((function(e){var t=e.type,n=e.framesEncoded,o=e.packetsLost,a=e.bytesSent,s=e.framesSent,c=e.roundTripTime,l=e.mimeType,p=e.frameWidth,f=e.frameHeight,_=e.packetsSent,v=e.googActualEncBitrate,m=e.googAvailableReceiveBandwidth,S=e.googAvailableSendBandwidth,E=e.googAvgEncodeMs,y=e.googBucketDelay,g=e.googEncodeUsagePercent,b=e.googFrameRateInput,T=e.availableIncomingBitrate,I=e.availableOutgoingBitrate,R=e.bytesReceived,A=e.nominated,C=e.id,O=e.currentRoundTripTime,N=e.state,w=e.writable,D=e.candidateType,P=e.ip,k=e.address,M=e.networkType,U=e.port,L=e.nackCount,x=e.pliCount,V=e.protocol,F=e.qpSum,B=e.requestsReceived,j=e.responsesReceived,G=e.googRetransmitBitrate,H=e.requestsSent,z=e.consentRequestsSent,K=e.responsesSent,Y=e.ssrc,X=e.googTargetEncBitrate,W=e.googTransmitBitrate,J=e.googRtt,q=e.retransmittedPacketsSent,Z=e.encoderImplementation,$=e.jitter,Q=e.rid;"outbound-rtp"===t?(u&&(Q?i.simulcast[Q]=e:i.simulcast[h]=e,h++),i.framesEncoded=n,i.bytesSent=a,i.framesSent=s,d.bytes=a,i.packetsSent=_,d.packetsSent=_,d.nackCount=L,d.pli_count=x,d.qp_sum=F,d.ssrc=Y,d.retransmitted_packets_sent=q,d.encoder_implementation=Z):"track"===t?(r.encodedFrameWidth=p,r.encodedFrameHeight=f,d.frame_size_height=f,d.frame_size_width=p):"remote-inbound-rtp"===t?(i.packetsLost=o,r.rtt=1e3*c,d.rtt=r.rtt,d.jitter=$,d.packetsLost=o):"codec"===t?(r.codecType=l,d.codecName=l):"candidate-pair"===t?(d.ice_available_incoming_bitrate=T,d.ice_available_outgoing_bitrate=I,d.ice_bytes_received=R,d.ice_bytes_sent=a,d.ice_nominated=+A,d.ice_pair_id=C,d.ice_pair_rtt=O,d.ice_pair_state=N,d.ice_pair_writable=w,d.recv_ping_requests=B,d.recv_ping_responses=j,d.sent_ping_requests_before_first_response=H,d.sent_ping_requests_total=H+z,d.sent_ping_responses=K):"local-candidate"===t?(d.local_candidate_type=D,d.local_ip=P||k,d.local_network_type=M,d.local_port=U,d.protocol=V):"remote-candidate"===t?(d.remote_candidate_type=D,d.remote_ip=P||k,d.remote_port=U):"VideoBwe"===t?(d.encBitratebps=v,d.available_receive_bandwidth=m,d.available_send_bandwidth=S,d.bucket_delay=y,d.retransmitBitratebps=G,d.targetEncBitratebps=X,d.transmit_bitrate=W):"ssrc"===t&&(d.video_network_elapse=J,d.avg_encode_ms=E,d.encodeUsage=g,d.frame_rate_input=b,d.orignal_input_Framerate=+b)})),(p=t.video).timestamp?(r.statsInterval=i.timestamp-p.timestamp,d.stats_interval=r.statsInterval,f=Object.keys(i.simulcast),u?(d.sim_enc_width=[],d.sim_enc_height=[],d.sim_enc_bps=[],d.sim_enc_framerate=[],d.sim_rids=[],d.sim_enc_bandwidth=[],d.sim_sent_framerate=[],d.sim_fraction_lost=[],_=!1,f.sort((function(e,t){return+e-+t})).forEach((function(e){var t=i.simulcast[e],n=t.frameWidth,o=t.frameHeight,a=t.bytesSent,s=t.framesEncoded,c=t.framesSent,u=t.packetsLost,l=t.packetsSent,h=t.qualityLimitationReason,f=t.qualityLimitationDurations,v=t.qualityLimitationResolutionChanges;void 0!==h&&(d.sim_qualityLimitationReason||(d.sim_qualityLimitationReason=[],d.sim_qualityLimitationDurations=[],d.sim_qualityLimitationResolutionChanges=[]),d.sim_qualityLimitationReason.push(h),d.sim_qualityLimitationDurations.push(f),d.sim_qualityLimitationResolutionChanges.push(v));var m=p.simulcast[e];if(d.sim_enc_width.push(n||0),d.sim_enc_height.push(o||0),m){var S=(a-m.bytesSent||0)/r.statsInterval;d.sim_enc_bps.push(Math.round(8e3*S)),d.sim_enc_bandwidth.push(Math.round(8e3*S/1024));var E=1e3*(s-m.framesEncoded)/r.statsInterval;d.sim_enc_framerate.push(Math.round(E)),d.sim_rids.push(e);var y=void 0!==c?c-m.framesSent:s-m.framesEncoded,g=1e3*y/r.statsInterval;d.sim_sent_framerate.push(Math.round(g));var b=(u-m.packetsLost)/(l-m.packetsSent);b=Number.isNaN(b)?0:b,d.sim_fraction_lost.push(b),n>0&&!_&&(r.sentKBitrate=8*S,r.encoderOutputFrameRate=E,r.encodedFrameCount=y,r.sentFrameRate=g,r.videoLossRate=b,_=!0)}})),this.monitor.rtcMediaStatistics(d,{})):(r.encodedFrameCount=void 0!==i.framesSent?i.framesSent-p.framesSent:i.framesEncoded-p.framesEncoded,r.sentKBitrate=(i.bytesSent-p.bytesSent||0)/r.statsInterval*8,d.bitrate=Math.round(1e3*r.sentKBitrate),d.bandwidth=Math.round(d.bitrate/1024),r.encoderOutputFrameRate=1e3*(i.framesEncoded-p.framesEncoded)/r.statsInterval,d.frame_rate_encoded=Math.round(r.encoderOutputFrameRate),r.sentFrameRate=1e3*r.encodedFrameCount/r.statsInterval,d.frame_rate_sent=Math.round(r.sentFrameRate),r.videoLossRate=(i.packetsLost-p.packetsLost)/(i.packetsSent-p.packetsSent),r.videoLossRate=Number.isNaN(r.videoLossRate)?0:r.videoLossRate,d.fraction_lost=r.videoLossRate,this.monitor.rtcMediaStatistics(d,{})),t.video=i,[2,r]):(t.video=i,[2,r])):[2,r]}}))}))},e.prototype.getDataChannelRTT=function(e){var t,r=this,i=bD();null===(t=this._client.sendUserMessage(e,"__web__rtc__rtt__"))||void 0===t||t.then((function(t){if("timeout"!==t){var n=Date.now()-i;n>0&&n<2e3&&(r.dataChannelRTT[e]=n)}else clearTimeout(r._rttTimer[e])})).catch((function(){clearTimeout(r._rttTimer[e])})),clearTimeout(this._rttTimer[e]),this._rttTimer[e]=setTimeout((function(){r.getDataChannelRTT(e)}),2e3)},e.prototype.destroy=function(){var e=this;Object.keys(this._localStreamStasEvtIntervals).forEach((function(t){clearInterval(e._localStreamStasEvtIntervals[t])})),Object.keys(this._remoteStreamStasEvtIntervals).forEach((function(t){clearInterval(e._remoteStreamStasEvtIntervals[t])})),Object.keys(this._rttTimer).forEach((function(t){clearTimeout(e._rttTimer[t])})),Object.keys(this._remoteStreamAudioStallInterval).forEach((function(t){clearTimeout(e._remoteStreamAudioStallInterval[t])})),this._rttTimer={},this.dataChannelRTT={},this._videoInWaiting={}},e}(),LV=new qD("MediaServerClient",2);!function(e){e.DISCONNECTED="disconnected",e.DISCONNECTING="disconnecting",e.CONNECTED="connected",e.CONNECTING="connecting"}(MV||(MV={}));var xV=function(e,t){LV.print(e,"userId: %o, subAudio: %o, subVideo: %o, paused: %o, audioMid: %o, videoMid: %o, workaround_1_: %o, sequenceId: %o",t.userId,t.subAudio,t.subVideo,t.paused,t.audioMid,t.videoMid,t._workaround_1_,t.sequenceId)},VV=function(e){function t(t){void 0===t&&(t=hL);var r=e.call(this)||this;return r._ontrackCallbackMap=new Map,r._pubConfig={},r.monitor=t,r._pubSubLock=new Ix("pubSubLock"),r._joinLeaveLock=new Ix("joinLeaveLock"),r._state=MV.DISCONNECTED,r._roomAttributes={multiChatMode:!1,bigRoomMode:!1},r}return Z_(t,e),t.prototype._addHandlerEvents=function(){var e,t=this;null===(e=this._handler)||void 0===e||e.once("disconnect",(function(){LV.print("emit ABNORMAL_DISCONNECTION ice"),t.safeEmit(iL.ABNORMAL_DISCONNECTION)}))},t.prototype._addSignalEventHandler=function(){var e,t=this;[tL.ON_ADD_STREAM,tL.ON_REMOVE_STREAM,tL.USER_CONNECTION,tL.USER_DISCONNECTION,tL.ON_UPDATE_STREAM_ATTRIBUTES,tL.ON_UPDATE_ROOM_ATTRIBUTES,tL.ON_PUSH_TRACK,tL.ON_REMOVE_TRACK,tL.NODE_CHANGE,tL.ON_CUSTOM_MESSAGE,tL.USER_MESSAGE_RECEIVED,tL.USER_BINARY_MESSAGE_RECEIVED,tL.POST_PROCESSING_MESSAGE,tL.ON_USER_TOKEN_WILL_EXPIRE,rL.RSCP].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(){LV.print("emit ABNORMAL_DISCONNECTION datachannel"),t.safeEmit(iL.ABNORMAL_DISCONNECTION)}))},t.prototype._removeSignalEventHandler=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.removeAllListeners(),null===(t=this._handler)||void 0===t||t.removeAllListeners()},Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._state},set:function(e){this._state!==e&&(this.safeEmit(iL.ON_CONNECTION_STATE_CHANGE,{prev:this._state,next:e}),this._state=e)},enumerable:!1,configurable:!0}),t.prototype.connect=function(e,t,r,i){var n;return void 0===t&&(t=""),void 0===r&&(r=""),void 0===i&&(i={}),ev(this,void 0,void 0,(function(){var o,a,s,c=this;return tv(this,(function(u){switch(u.label){case 0:return this.connectionState=MV.CONNECTING,this._appId=e,this._handler&&(this._removeSignalEventHandler(),this._handler.destroy()),i.node?(o=i.node,gL("es.join.nodeChange",i),[3,3]):[3,1];case 1:return Promise.resolve().then((function(){return c.emit("onGetIceConfigHook")})),this._iceConfigRequestManager=new PL,[4,null===(n=this._iceConfigRequestManager)||void 0===n?void 0:n.getAccessNode(e,t,r,wL.getDeviceId(),null==i?void 0:i.reason,this._prevICENode,this._useCloudProxy)];case 2:if(!(o=u.sent()))throw gL("es.join.getNodeFailed",""),new tw(ZN.ICE_SERVER_WRONG,"get ICE config failed");gL("es.join.getNodeSuccess",o),u.label=3;case 3:this._prevICENode=o,this._handler=new gx(this.monitor),this._addHandlerEvents(),Promise.resolve().then((function(){return c.emit("onEstablishConnectionHook")})),u.label=4;case 4:return u.trys.push([4,6,,7]),[4,this._handler.connect(o)];case 5:return a=u.sent(),LV.print("join","establish peerConnection success"),[3,7];case 6:throw s=u.sent(),this.connectionState=MV.DISCONNECTED,new tw(ZN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",s);case 7:return this._dataChannelSignal=new AL(a),this._addSignalEventHandler(),this._dataChannelSignal.sendPingSignaling(),[2]}}))}))},t.prototype.join=function(e,t,r,i){var n,o,a,s,c,u;return void 0===t&&(t={}),void 0===r&&(r=!1),ev(this,void 0,void 0,(function(){var d,l,h,p,f,_,v,m=this;return tv(this,(function(S){switch(S.label){case 0:return LV.print("join()","info: %o, params: %o, reconnect: %o, controlMessage: %o",e,t,r,i),this._appId=e.appId,this._token=e.token,this._roomId=e.roomId,this._clientId=e.userInfo.userId,this._businessId=e.userInfo.businessId,this._userInfo=e.userInfo,this._useCloudProxy=e.useCloudProxy,this._sessionId=t.sessionId,[4,this.connect(this._appId,this._roomId,this._clientId,t)];case 1:return S.sent(),[4,null===(n=this._handler)||void 0===n?void 0:n.getDefaultSdp()];case 2:return d=S.sent(),_={Authorization:RD.token2auth(this._appId,this._roomId,this._clientId,this._token),sessionId:this._sessionId||"",timestamp:Date.now(),controlMessage:i,userAttributes:{extra_info:this._userInfo.extraInfo,role:this._userInfo.role}},v={},[4,vx()];case 3:_.params=(v.supportedCodecs=S.sent(),v.deviceType="web",v.userAgent=window.navigator.userAgent,v.sdkVersion=BP.VERSION,v.deviceId=wL.getDeviceId(),v.appId=this._appId,v.roomId=this._roomId,v.userId=this._clientId,v.businessId=this._businessId,v.enable_cloud_proxy=this._useCloudProxy,v),_.options={enableUnBundleMode:!0,supportTokenExpireCallBack:!0},_.sdpInfo=d,l=_,Promise.resolve().then((function(){return m.emit("onSendingJoinMessageHook")})),S.label=4;case 4:return S.trys.push([4,6,,7]),h=r?"reconnected":"joinRoom",[4,this._dataChannelSignal.sendSignaling(h,l)];case 5:return p=S.sent(),LV.print("join","send join message success"),this._authorization=l.Authorization,this.connectionState=MV.CONNECTED,this._statsReport=new UV(this,this._handler,this.monitor,null===(o=p.config)||void 0===o?void 0:o.engine_WEB),this._pubConfig.audioRed=!!(null===(s=null===(a=p.config)||void 0===a?void 0:a.engine_WEB)||void 0===s?void 0:s.pub_audio_red),this._pubConfig.simulcastOnDemand=!!(null===(u=null===(c=p.config)||void 0===c?void 0:c.engine_WEB)||void 0===u?void 0:u.sim_on_demand),[2,p];case 6:if(f=S.sent(),this.connectionState=MV.DISCONNECTED,(null==f?void 0:f.code)>=700&&(null==f?void 0:f.code)<800)throw new tw(ZN.INVALID_TOKEN,(null==f?void 0:f.message)||"Invalid token");if(200!==(null==f?void 0:f.code))throw new tw(ZN.JOIN_ROOM_FAILED,(null==f?void 0:f.message)||"Join room failed");return[3,7];case 7:return[2]}}))}))},t.prototype.publish=function(e){var t,r,i,n,o,a,s,c;return ev(this,void 0,void 0,(function(){var u,d,l,h,p,f,_,v,m,S,E;return tv(this,(function(y){switch(y.label){case 0:LV.print("publish()","localStream: %o",e),u=e.videoTrack,d=e.audioTrack,l=bD(),h="",p="",f="",y.label=1;case 1:return y.trys.push([1,5,,8]),[4,null===(t=this._handler)||void 0===t?void 0:t.publish(e,this._pubConfig)];case 2:if(!(_=y.sent()))throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return h=_.audioMid,p=_.videoMid,f=_.sdp,e.pubAttributes={localaudio:!!d,localvideo:!!u,videostream:!!(null===(r=null==u?void 0:u.getTrack())||void 0===r?void 0:r.enabled),audiostream:!!(null===(i=null==d?void 0:d.getTrack())||void 0===i?void 0:i.enabled),extvideo:!!(u instanceof OV),extaudio:!!(d instanceof NV)},v={attributes:$_({videoDescriptions:_.videoDescriptions},e.pubAttributes),audio:!0,video:!0,screen:e.isScreen,audioMid:h,videoMid:p,sdpInfo:{msid:e.stream.id,type:_.type,sdp:_.partialSdp,semantics:_.semantics}},e.enableSimulcast&&this._pubConfig.simulcastOnDemand&&(v.attributes.subVideoDescriptions=_.videoDescriptions.map((function(e,t){return e.video_index=t,e}))),[4,null===(n=this._dataChannelSignal)||void 0===n?void 0:n.sendSignaling("publish",v)];case 3:if(200!==(null==(m=y.sent())?void 0:m.code))throw new tw(ZN.PUBLISH_FAILED,(null==m?void 0:m.message)||"publish failed");return S=null===(o=null==m?void 0:m.relayMessage)||void 0===o?void 0:o.sdp,[4,null===(a=this._handler)||void 0===a?void 0:a.setAnswerSdp(_.sdp,S,void 0,e,IU.UP)];case 4:return y.sent(),e.streamId=m.streamId,e.videoMid=p,e.audioMid=h,this.monitor.rtcPublishStat(CU.SUCCESS,OU.W_0,l,NU.UNKNOWN),null===(s=this._statsReport)||void 0===s||s.setLocalStreamStatsEvtInterval(e),[2];case 5:return(E=y.sent())instanceof Error&&this.monitor.rtcPublishStat(CU.FAIL,OU.W_0,l,E.message),h&&p?[4,null===(c=this._handler)||void 0===c?void 0:c.rollback(f,[h,p])]:[3,7];case 6:y.sent(),y.label=7;case 7:throw E;case 8:return[2]}}))}))},t.prototype.updatePubTrack=function(e){var t,r,i,n,o,a,s,c,u;return ev(this,void 0,void 0,(function(){var d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R,A,C;return tv(this,(function(O){switch(O.label){case 0:LV.print("updatePubTrack()","localStream: %o",e),d=e.videoTrack,l=e.audioTrack,h=!!(null===(r=null===(t=e.videoTransceiver)||void 0===t?void 0:t.sender)||void 0===r?void 0:r.track),p=null==d?void 0:d.getTrack(),null===(i=e.videoTransceiver)||void 0===i||i.sender.replaceTrack(p||null),!h&&p&&(null===(n=this._handler)||void 0===n||n.updateScaleResolutionDownBy(e)),l?(f=l.mixType,_=l.mixedAudioTrack,v=null==l?void 0:l.getTrack(),_&&f!==dx.PLAYOUT&&!0===v.enabled&&(v=_),null===(o=e.audioTransceiver)||void 0===o||o.sender.replaceTrack(v)):null===(a=e.audioTransceiver)||void 0===a||a.sender.replaceTrack(null),m={localaudio:!!l,localvideo:!!d,videostream:!!(null===(s=null==d?void 0:d.getTrack())||void 0===s?void 0:s.enabled),audiostream:!!(null===(c=null==l?void 0:l.getTrack())||void 0===c?void 0:c.enabled),extvideo:!!(d instanceof OV),extaudio:!!(l instanceof NV)},S={};try{for(E=rv(Object.entries(m)),y=E.next();!y.done;y=E.next())g=iv(y.value,2),b=g[0],(T=g[1])!==Reflect.get(e.pubAttributes,b)&&Reflect.set(S,b,T)}catch(e){A={error:e}}finally{try{y&&!y.done&&(C=E.return)&&C.call(E)}finally{if(A)throw A.error}}return Object.keys(S).length?(e.pubAttributes=m,I={roomId:this._roomId,streamId:e.streamId,attributes:S},[4,null===(u=this._dataChannelSignal)||void 0===u?void 0:u.sendSignaling("updateStreamAttributes",I)]):[2];case 1:if(200!==(null==(R=O.sent())?void 0:R.code))throw new tw(ZN.UPDATE_TRACK_FAILED,(null==R?void 0:R.message)||"update track failed");return[2]}}))}))},t.prototype.updateToken=function(e){var t,r,i;return ev(this,void 0,void 0,(function(){var n,o;return tv(this,(function(a){switch(a.label){case 0:if(LV.print("updateToken()","newToken: %o",e),this._token=e,!this._appId||!(null===(t=this._userInfo)||void 0===t?void 0:t.userId)||!this._roomId)return[2];n={roomId:this._roomId,userId:null===(r=this._userInfo)||void 0===r?void 0:r.userId,appId:this._appId,token:"Bearer ".concat(e)},a.label=1;case 1:return a.trys.push([1,3,,4]),[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateToken",n)];case 2:if(200!==(null==(o=a.sent())?void 0:o.code))throw new tw(ZN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");return[3,4];case 3:throw a.sent(),new tw(ZN.UPDATE_TOKEN_WITH_INVALID_TOKEN,"invoke updateToken with an invalid token");case 4:return[2]}}))}))},t.prototype.unpublish=function(e){var t,r,i;return ev(this,void 0,void 0,(function(){var n,o;return tv(this,(function(a){switch(a.label){case 0:return LV.print("unpublish()","localStream: %o",e),n={roomId:this._roomId,initStreamId:e.initStreamId,streamId:e.streamId},[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unpublish",n)];case 1:if(200!==(null==(o=a.sent())?void 0:o.code))throw new tw(ZN.UNPUBLISH_FAILED,(null==o?void 0:o.message)||"unpublish failed");return[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 2:return a.sent(),null===(i=this._statsReport)||void 0===i||i.unpublish(e),[2]}}))}))},t.prototype.subscribe=function(e,t,r){var i,n,o,a,s,c,u,d,l;return ev(this,void 0,void 0,(function(){var h,p,f,_,v,m,S,E,y,g,b,T,I,R,A,C,O,N,w,D;return tv(this,(function(P){switch(P.label){case 0:if(e.hasSubscribed)return[2,this._updateSubTrack(e,t,r)];if(LV.print("subscribe()","mediaType: %o, config: %o",t,r),xV("subscribe()",e),h=!1,p=!1,t===OP.VIDEO_ONLY?h=!0:t===OP.AUDIO_ONLY?p=!0:t===OP.AUDIO_AND_VIDEO?(h=!0,p=!0):t===OP.NONE&&(h=!1,p=!1),!h&&this._multiChatMode())return[2];f=bD(),_=e.audioMid,v=e.videoMid,S=!1,P.label=1;case 1:return P.trys.push([1,12,,15]),_&&v?(S=!0,[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e,{audioMid:_,videoMid:v})]):[3,3];case 2:return m=P.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(m=P.sent()))throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,P.label=5;case 5:return E={audio:!this._multiChatMode(),video:!0,data:!0,screen:e.isScreen,browser:"chrome-stable",videoMid:v,audioMid:_,sdpInfo:{sdp:null==m?void 0:m.partialSdp,semantics:null==m?void 0:m.semantics,type:null==m?void 0:m.type},streamUserId:e.userId,streamId:e.streamId,config:{enableMediaType:{audio:!!this._multiChatMode()||p,video:h},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(o=this._dataChannelSignal)||void 0===o?void 0:o.sendSignaling("subscribe",E)];case 6:if(200!==(null==(y=P.sent())?void 0:y.code))throw new tw(ZN.SUBSCRIBE_FAILED,(null==y?void 0:y.message)||"subscribe failed");return g=[],b=!this._multiChatMode(),!(_&&v)&&g.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new tw(ZN.TIME_OUT,"wait video timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(n){"video"===n.mediaType&&(LV.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),b&&g.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new tw(ZN.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(LV.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),T=function(t){e.ontrack(t)},null===(a=this._handler)||void 0===a||a.on("ontrack",T),this._ontrackCallbackMap.set(e,T),I=null==y?void 0:y.relayMessage,R=I.audioMid,A=I.videoMid,C=I.sequenceId,O=I.sdp,S&&_!==R?(LV.print("subscribe","mid mot match",_,R),[4,null===(s=this._handler)||void 0===s?void 0:s.closeMLine([_,v])]):[3,9];case 7:return P.sent(),[4,null===(c=this._handler)||void 0===c?void 0:c.subscribe(e)];case 8:if(!(m=P.sent()))throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");_=m.audioMid,v=m.videoMid,P.label=9;case 9:return(D={})[_]=R,D[v]=A,N=D,e.videoMid=A,e.audioMid=R,e.sequenceId=C,e.subConfig=r,e._workaround_1_=!1,e.paused=!1,e.subMediaType=t,e.hasSubscribed=!0,[4,null===(u=this._handler)||void 0===u?void 0:u.setAnswerSdp(null==m?void 0:m.sdp,O,N,e,IU.DOWN)];case 10:return P.sent(),[4,Promise.all(g)];case 11:return P.sent(),this._multiChatMode()||(e.subAudio=p),e.subVideo=h,this.monitor.rtcSubscribeStat(wU.SUCCESS,f,DU.UNKNOWN,e.userId),null===(d=this._statsReport)||void 0===d||d.setRemoteStreamStatsEvtInterval(e),[2];case 12:return(w=P.sent())instanceof Error&&this.monitor.rtcSubscribeStat(wU.FAIL,f,w.message,e.userId),_&&v?[4,null===(l=this._handler)||void 0===l?void 0:l.rollback(null==m?void 0:m.sdp,[_,v])]:[3,14];case 13:P.sent(),P.label=14;case 14:throw w;case 15:return[2]}}))}))},t.prototype.controlMessage=function(e){var t;return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(i){switch(i.label){case 0:return LV.print("controlMessage()","params: %o",e),r=e,"transcode"===e.type&&(r.roomId=this._roomId),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("controlMessage",r)];case 1:return i.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){var t;return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:return LV.print("updateUserAttributes()","attributes: %o",e),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("updateUserAttributes",{roomId:this._roomId,sessionId:this._sessionId,attributes:e})];case 1:return r.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){return ev(this,void 0,void 0,(function(){return tv(this,(function(i){return[2,this._updateSubTrack(e,t,r)]}))}))},t.prototype._updateSubTrack=function(e,t,r){var i,n,o;return ev(this,void 0,void 0,(function(){var a,s,c,u;return tv(this,(function(d){switch(d.label){case 0:return LV.print("updateSubTrack()","mediaType: %o, config: %o",t,r),xV("updateSubTrack()",e),a=!1,s=!1,t===OP.VIDEO_ONLY?(a=!0,s=!1):t===OP.AUDIO_ONLY?(s=!0,a=!1):t===OP.AUDIO_AND_VIDEO?(a=!0,s=!0):t===OP.NONE&&(a=!1,s=!1),c={roomId:this._roomId,streamList:[e.streamId],config:{enableMediaType:{video:a,audio:!!this._multiChatMode()||s},qualityLayer:{spatialLayer:r.videoIndex,temporalLayer:r.videoIndex}}},[4,null===(i=this._dataChannelSignal)||void 0===i?void 0:i.sendSignaling("updateSubscribe",c)];case 1:if(200!==(null==(u=d.sent())?void 0:u.code))throw new tw(ZN.UPDATE_TRACK_FAILED,(null==u?void 0:u.message)||"update track failed");return e.paused=!a,this._multiChatMode()||(null===(n=e.observer)||void 0===n||n.setUnmuteAudio(s),e.subAudio=s),null===(o=e.observer)||void 0===o||o.setUnmuteVideo(a),e.subVideo=a,e.subMediaType=t,e.subConfig=r,[2,e]}}))}))},t.prototype.subscribe4pushTrack=function(e,t){var r,i,n,o,a,s;return ev(this,void 0,void 0,(function(){var c,u,d,l,h,p,f,_,v,m,S,E,y;return tv(this,(function(g){switch(g.label){case 0:if(LV.print("subscribe4pushTrack()","streamInfo: %o",t),xV("subscribe4pushTrack()",e),c=null==t?void 0:t.message,u=c.audioMid,d=c.videoMid,l=c.sequenceId,h=c.sdp,e.subAudio=!0,l<e.sequenceId)return LV.print("subscribe4pushTrack","sequenceId return",l,e.sequenceId),[2];p=e.audioMid,f=e.videoMid,null===(r=e.observer)||void 0===r||r.setPushTrack(!0),g.label=1;case 1:return g.trys.push([1,8,,11]),p&&f?[4,null===(i=this._handler)||void 0===i?void 0:i.subscribe(e,{audioMid:p,videoMid:f})]:[3,3];case 2:return _=g.sent(),[3,5];case 3:return[4,null===(n=this._handler)||void 0===n?void 0:n.subscribe(e)];case 4:if(!(_=g.sent()))throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");p=_.audioMid,f=_.videoMid,g.label=5;case 5:return(y={})[p]=u,y[f]=d,v=y,LV.print("onpushtrack midmap",e.userId,v),e.audioMid=u,e.videoMid=d,e.sequenceId=l,m=[],e.audioTrack||m.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new tw(ZN.TIME_OUT,"wait audio timeout for userId: ".concat(e.userId)))}),5e3);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(LV.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),S=function(t){e.ontrack(t)},null===(o=this._handler)||void 0===o||o.on("ontrack",S),this._ontrackCallbackMap.set(e,S),[4,null===(a=this._handler)||void 0===a?void 0:a.setAnswerSdp(null==_?void 0:_.sdp,h,v,e,IU.DOWN)];case 6:return g.sent(),[4,Promise.all(m)];case 7:return g.sent(),[2];case 8:return E=g.sent(),_?[4,null===(s=this._handler)||void 0===s?void 0:s.rollback(null==_?void 0:_.sdp,[p,f])]:[3,10];case 9:g.sent(),g.label=10;case 10:throw E;case 11:return[2]}}))}))},t.prototype.unsubscribe4removeTrack=function(e,t){var r,i;return ev(this,void 0,void 0,(function(){return tv(this,(function(n){switch(n.label){case 0:return xV("unsubscribe4removeTrack()",e),LV.print("unsubscribe4removeTrack()","sequenceId: ",t.sequenceId),t.sequenceId<e.sequenceId?(LV.print("unsubscribe4removeTrack()","sequenceId return"),[2]):(e.subAudio=!1,e.subVideo||e.paused?(e.sequenceId=t.sequenceId,[2]):(null===(r=e.observer)||void 0===r||r.setPushTrack(!1),[4,null===(i=this._handler)||void 0===i?void 0:i.closeMLine([e.videoMid||"",e.audioMid||""])]));case 1:return n.sent(),LV.print("clean unsubscribe4removeTrack"),e.clean(),e.resetHasSubscribed(),[2]}}))}))},t.prototype.unsubscribe=function(e){var t,r,i,n,o;return ev(this,void 0,void 0,(function(){var a;return tv(this,(function(s){switch(s.label){case 0:xV("unsubscribe()",e),a={roomId:this._roomId,streamId:e.streamId,userId:e.userId},s.label=1;case 1:return s.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("unsubscribe",a)];case 2:case 3:return s.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.paused=!1,e._workaround_1_||(e.subAudio=!1),null===(r=e.observer)||void 0===r||r.setSubscribeVideo(!1),e.subAudio?[3,6]:(null===(i=e.observer)||void 0===i||i.setSubscribeAudio(!1),[4,null===(n=this._handler)||void 0===n?void 0:n.closeMLine([e.videoMid||"",e.audioMid||""])]);case 5:s.sent(),LV.print("unsubscribe","clean unsub ".concat(e.userId)),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(o=this._statsReport)||void 0===o||o.unsubscribe(e),s.label=6;case 6:return[2]}}))}))},t.prototype.removeOnTrackListener=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))},t.prototype.handleRemoveStream=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return xV("handleRemoveStream()",e),e.subVideo=!1,t.message&&t.message!==eL.videoMuted?e._workaround_1_=!1:e._workaround_1_=!0,this.unsubscribe(e),[2]}))}))},t.prototype.leave=function(){var e;return ev(this,void 0,void 0,(function(){var t,r,i;return tv(this,(function(n){switch(n.label){case 0:return LV.print("leave()"),this.connectionState!==MV.CONNECTED?[3,7]:(this.connectionState=MV.DISCONNECTING,t={Authorization:this._authorization,roomId:this._roomId,sessionId:this._sessionId},[4,this._joinLeaveLock.lock()]);case 1:r=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,null===(e=this._dataChannelSignal)||void 0===e?void 0:e.sendSignaling("leaveRoom",t)];case 3:return n.sent(),this.connectionState=MV.DISCONNECTED,[3,6];case 4:throw i=n.sent(),this.connectionState=MV.CONNECTED,i;case 5:return r(),[7];case 6:return[3,8];case 7:return[2,Promise.reject(new tw(ZN.NOT_CONNECTED_YET,"server not connected"))];case 8:return[2]}}))}))},t.prototype.subscribePublicStream=function(e){var t,r,i,n,o;return ev(this,void 0,void 0,(function(){var a,s,c,u,d,l,h,p,f,_,v,m,S;return tv(this,(function(E){switch(E.label){case 0:return[4,null===(t=this._handler)||void 0===t?void 0:t.subscribe(e)];case 1:if(!(a=E.sent()))throw new tw(ZN.ADD_TRANSCEIVER_FAILED,"add transceiver failed");return s=bD(),c=a.audioMid,u=a.videoMid,d={appId:this._appId,streamId:e.streamId,audio:!0,video:!0,data:!0,audioMid:c,videoMid:u,sdpInfo:{sdp:null==a?void 0:a.partialSdp,semantics:null==a?void 0:a.semantics,type:null==a?void 0:a.type},config:{enableMediaType:{audio:!0,video:!0},qualityLayer:{spatialLayer:0,temporalLayer:0}}},[4,null===(r=this._dataChannelSignal)||void 0===r?void 0:r.sendSignaling("startPullStream",d)];case 2:return l=E.sent(),(h=[]).push(new Promise((function(t,r){var i=setTimeout((function(){return r(new tw(ZN.TIME_OUT,"wait video timeout for streamId: ".concat(e.streamId)))}),5e3);e.on("ontrack",(function r(n){"video"===n.mediaType&&(LV.print("remoteStream ".concat(e.userId," received video track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),h.push(new Promise((function(t,r){var i=setTimeout((function(){return r(new tw(ZN.TIME_OUT,"wait audio timeout for streamId: ".concat(e.streamId)))}),5e3);e.on("ontrack",(function r(n){"audio"===n.mediaType&&(LV.print("remoteStream ".concat(e.userId," received audio track")),e.off("ontrack",r),clearTimeout(i),t(0))}))}))),p=function(t){e.ontrack(t)},null===(i=this._handler)||void 0===i||i.on("ontrack",p),this._ontrackCallbackMap.set(e,p),f=null==l?void 0:l.relayMessage,_=f.audioMid,v=f.videoMid,m=f.sequenceId,S=f.sdp,e.videoMid=v,e.audioMid=_,e.sequenceId=m,e._workaround_1_=!1,e.paused=!1,e.hasSubscribed=!0,e.subAudio=!0,e.subVideo=!0,[4,null===(n=this._handler)||void 0===n?void 0:n.setAnswerSdp(null==a?void 0:a.sdp,S,{},e,IU.DOWN)];case 3:return E.sent(),[4,Promise.all(h)];case 4:return E.sent(),this.monitor.rtcSubscribeStat(wU.SUCCESS,s,DU.UNKNOWN,e.userId),this._statsReport||(this._statsReport=new UV(this,this._handler,this.monitor)),null===(o=this._statsReport)||void 0===o||o.setRemoteStreamStatsEvtInterval(e,{rtt:!1}),[2]}}))}))},t.prototype.unsubscribePublicStream=function(e){var t,r,i;return ev(this,void 0,void 0,(function(){var n;return tv(this,(function(o){switch(o.label){case 0:xV("unsubscribePublicStream()",e),n={appId:this._appId,streamId:e.streamId},o.label=1;case 1:return o.trys.push([1,3,,4]),[4,null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("stopPullStream",n)];case 2:case 3:return o.sent(),[3,4];case 4:return e.hasSubscribed=!1,e.subVideo=!1,e.subAudio=!1,[4,null===(r=this._handler)||void 0===r?void 0:r.closeMLine([e.videoMid||"",e.audioMid||""])];case 5:return o.sent(),e.clean(),e.resetHasSubscribed(),this.removeOnTrackListener(e),null===(i=this._statsReport)||void 0===i||i.unsubscribe(e),[2]}}))}))},t.prototype.destroy=function(){var e,t,r,i;LV.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,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(),null===(i=this._statsReport)||void 0===i||i.destroy(),this.connectionState=MV.DISCONNECTED,this.emit("INTERRUPT")},t.prototype.sendUserMessage=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})},t.prototype.sendRoomMessage=function(e){var t;return null===(t=this._dataChannelSignal)||void 0===t?void 0:t.sendSignaling("customMessage",e)},t.prototype._multiChatMode=function(){var e;return null===(e=this._roomAttributes)||void 0===e?void 0:e.multiChatMode},Object.defineProperty(t.prototype,"handler",{get:function(){return this._handler},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomAttributes",{get:function(){return this._roomAttributes},set:function(e){this._roomAttributes=e},enumerable:!1,configurable:!0}),Q_([jV],t.prototype,"join",null),Q_([BV,FV],t.prototype,"publish",null),Q_([BV,FV],t.prototype,"updatePubTrack",null),Q_([BV,FV],t.prototype,"unpublish",null),Q_([BV,FV],t.prototype,"subscribe",null),Q_([FV],t.prototype,"controlMessage",null),Q_([FV],t.prototype,"updateUserAttributes",null),Q_([BV,FV],t.prototype,"updateSubTrack",null),Q_([BV,FV],t.prototype,"subscribe4pushTrack",null),Q_([BV,FV],t.prototype,"unsubscribe4removeTrack",null),Q_([BV,FV],t.prototype,"unsubscribe",null),Q_([BV,FV],t.prototype,"handleRemoveStream",null),Q_([BV],t.prototype,"subscribePublicStream",null),Q_([BV],t.prototype,"unsubscribePublicStream",null),t}($D);function FV(e,t,r){var i=r.value;return r.value=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:return this._handler&&this._state===MV.CONNECTED?[4,i.apply(this,e)]:[3,2];case 1:return r.sent(),[3,3];case 2:throw new tw(ZN.NOT_CONNECTED_YET,"error in ".concat(t,": try again after joined"));case 3:return[2]}}))}))},r}function BV(e,t,r){var i=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:return[4,this._pubSubLock.lock()];case 1:t=r.sent(),r.label=2;case 2:return r.trys.push([2,,4,5]),[4,i.apply(this,e)];case 3:return[2,r.sent()];case 4:return t(),[7];case 5:return[2]}}))}))},r}function jV(e,t,r){var i=r.value;return r.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return ev(this,void 0,void 0,(function(){var t,r=this;return tv(this,(function(n){return t=!1,[2,new Promise((function(n,o){return ev(r,void 0,void 0,(function(){var r,a;return tv(this,(function(s){switch(s.label){case 0:this.on("INTERRUPT",(function(){t=!0,o(new tw(ZN.OPERATION_CANCEL,"operation not finish when leave"))})),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,i.apply(this,e)];case 2:return r=s.sent(),n(r),[3,4];case 3:return a=s.sent(),t||o(a),[3,4];case 4:return[2]}}))}))}))]}))}))},r}var GV,HV,zV,KV=function(){function e(){}return e.getNalunits=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)},e.getAnnexbNals=function(t){for(var r=[],i=e.getHeaderPositionAnnexB(t),n=i.pos,o=n;n<t.length-4;){var a=new Uint8Array(t.buffer.slice(n,n+i.headerLength));i.pos===t.position&&t.skip(i.headerLength),o=(i=e.getHeaderPositionAnnexB(t)).pos;var s={header:a,body:new Uint8Array(t.buffer.slice(n+a.byteLength,o)),type:-1};e.analyseNal(s),s.type<=9&&0!==s.type&&r.push(s),t.skip(o-t.position),n=o}return r},e.getAvccNals=function(t){for(var r=[];t.position<t.length-4;){var i=t.getInt32(t.position);if(!(t.length-t.position>=i))break;var n=new Uint8Array(t.buffer.slice(t.position,t.position+4));t.skip(4);var o=new Uint8Array(t.buffer.slice(t.position,t.position+i));t.skip(i);var a={header:n,body:o,type:-1};e.analyseNal(a),a.type<=9&&0!==a.type&&r.push(a)}return r},e.analyseNal=function(e){var t=31&e.body[0];switch(e.type=t,t){case 1:e.ndr=!0;break;case 5:e.idr=!0;break;case 6:e.sei=!0;break;case 7:e.sps=!0;break;case 8:e.pps=!0}},e.getHeaderPositionAnnexB=function(e){for(var t=e.position,r=0,i=e.length;3!==r&&4!==r&&t<i-4;)0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:1===e.getInt8(t+2)?r=3:t++:t++;return t===i-4&&(0===e.getInt16(t)?1===e.getInt16(t+2)?r=4:t=i:(t++,0===e.getInt16(t)&&1===e.getInt8(t)?r=3:t=i)),{pos:t,headerLength:r}},e.getAvcc=function(e,t){var r=new Uint8Array(e.byteLength+t.byteLength+11);r[0]=1,r[1]=e[1],r[2]=e[2],r[3]=e[3],r[4]=255,r[5]=225;var i=6;return r.set(new Uint8Array([e.byteLength>>>8&255,255&e.byteLength]),i),i+=2,r.set(e,i),r[i+=e.byteLength]=1,i++,r.set(new Uint8Array([t.byteLength>>>8&255,255&t.byteLength]),i),i+=2,r.set(t,i),r},e}(),YV=function(){function e(e){this._position=0,this._dataview=new DataView(e)}return Object.defineProperty(e.prototype,"length",{get:function(){return this.buffer.byteLength},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"buffer",{get:function(){return this._dataview.buffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e},enumerable:!1,configurable:!0}),e.prototype.back=function(e){this.position-=e},e.prototype.getUint8=function(e){return this._dataview.getUint8(e)},e.prototype.getInt8=function(e){return this._dataview.getInt8(e)},e.prototype.getInt16=function(e){return this._dataview.getInt16(e)},e.prototype.getUint16=function(e){return this._dataview.getUint16(e)},e.prototype.getUint32=function(e){return this._dataview.getUint32(e)},e.prototype.getInt32=function(e){return this._dataview.getInt32(e)},e.prototype.skip=function(t){for(var r=Math.floor(t/4),i=t%4,n=0;n<r;n++)e.readByte(this,4);i>0&&e.readByte(this,i)},e.readByte=function(e,t,r){var i;switch(t){case 1:i=r?e.getInt8(e.position):e.getUint8(e.position);break;case 2:i=r?e.getInt16(e.position):e.getUint16(e.position);break;case 3:if(r)throw new Error("not supported for readByte 3");i=e.getUint8(e.position)<<16,i|=e.getUint8(e.position+1)<<8,i|=e.getUint8(e.position+2);break;case 4:i=r?e.getInt32(e.position):e.getUint32(e.position);break;case 8:if(r)throw new Error("not supported for readBody 8");i=e.getUint32(e.position)<<32,i|=e.getUint32(e.position+4);break;default:i=""}return e.position+=t,i},e.prototype.readUint8=function(){return e.readByte(this,1)},e.prototype.readUint16=function(){return e.readByte(this,2)},e.prototype.readUint24=function(){return e.readByte(this,3)},e.prototype.readUint32=function(){return e.readByte(this,4)},e.prototype.readUint64=function(){return e.readByte(this,8)},e.prototype.readInt8=function(){return e.readByte(this,1,!0)},e.prototype.readInt16=function(){return e.readByte(this,2,!0)},e.prototype.readInt32=function(){return e.readByte(this,4,!0)},e.prototype.writeUint32=function(e){return new Uint8Array([e>>>24&255,e>>>16&255,e>>>8&255,255&e])},e}(),XV=new qD("Stream",0),WV=function(){function e(){this.isScreen=!1,this.seiList=[],this.enableSimulcast=!1,this.prevScaleResolutionDownBy=1,this.stream=new MediaStream,this.pubAttributes={localaudio:!1,localvideo:!1,videostream:!1,audiostream:!1,extvideo:!1,extaudio:!1}}return Object.defineProperty(e.prototype,"hasPublished",{get:function(){return this.videoTransceiver&&this.audioTransceiver},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmptyStream",{get:function(){return!this.audioTrack&&!this.videoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"initStreamId",{get:function(){return this.stream.id},enumerable:!1,configurable:!0}),e.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.sender){var t=this.videoTransceiver.sender;if(mx()){var r=t.createEncodedStreams(),i=r.readable,n=r.writable,o=new TransformStream({transform:function(t,r){var i=e.seiList[0];if(i){var n=new Uint8Array(i.content.byteLength+5);n.set([0,0,0,1,6]),n.set(i.content,5);var o=new Uint8Array(n.byteLength+t.data.byteLength);0===i.repeatCount&&e.seiList.splice(0,1),i.repeatCount--,o.set(new Uint8Array(t.data)),o.set(n,t.data.byteLength),t.data=o.buffer,r.enqueue(t)}else r.enqueue(t)}});i.pipeThrough(o).pipeTo(n)}}else XV.print("no sender found when trying to bind encodedTransform")},e.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.sender){var e=this.audioTransceiver.sender.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else XV.print("no sender found when trying to bind encodedTransform")},e.prototype.clean=function(){var e;this.audioMid=void 0,this.videoMid=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,null===(e=this.observer)||void 0===e||e.reset(),this.prevScaleResolutionDownBy=1},e.prototype.switchTrackEnableState=function(e,t){var r;"audio"===e?r=this.audioTrack:"video"===e&&(r=this.videoTrack);var i=null==r?void 0:r.getTrack();return!(!i||(null==i?void 0:i.enabled)===t)&&(i.enabled=t,!0)},e}(),JV=function(e){function t(t,r,i,n){var o=e.call(this)||this;return o.userId=t,o.isScreen=i,o.streamId=r,o.hasAudio=n.audiostream,o.hasVideo=n.videostream,o._attributes=n,o.subVideo=!1,o.subAudio=!1,o._sequenceId=0,o.subMediaType=OP.NONE,o.subConfig={videoIndex:0},o.hasSubscribed=!1,o}return Z_(t,e),Object.defineProperty(t.prototype,"sequenceId",{get:function(){return this._sequenceId||-1},set:function(e){"number"==typeof e&&(this._sequenceId=e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"attributes",{get:function(){return this._attributes},set:function(e){this.hasVideo=e.localvideo,this.hasAudio=e.localaudio,this._attributes=e},enumerable:!1,configurable:!0}),t.prototype.initVideoEncodedTransform=function(){var e=this;if(this.videoTransceiver&&this.videoTransceiver.receiver){var t=this.videoTransceiver.receiver.createEncodedStreams(),r=t.readable,i=t.writable;r.pipeThrough(new TransformStream({transform:function(t,r){var i=KV.getNalunits(new YV(t.data)).find((function(e){return e.sei}));i&&e.safeEmit("onSEIMessage",i.body.slice(1)),r.enqueue(t)}})).pipeTo(i)}else XV.print("no receiver found when trying to bind encodedTransform")},t.prototype.initAudioEncodedTransform=function(){if(this.audioTransceiver&&this.audioTransceiver.receiver){var e=this.audioTransceiver.receiver.createEncodedStreams(),t=e.readable,r=e.writable;t.pipeThrough(new TransformStream({transform:function(e,t){t.enqueue(e)}})).pipeTo(r)}else XV.print("no receiver found when trying to bind encodedTransform")},t.prototype.ontrack=function(e){var t,r,i;if((null===(r=null===(t=e.streams)||void 0===t?void 0:t[0])||void 0===r?void 0:r.id)===this.streamId){var n=e.track;"video"===(null==n?void 0:n.kind)?this._setVideoTrack(n):"audio"===(null===(i=e.track)||void 0===i?void 0:i.kind)&&this._setAudioTrack(n),this._setStream(e.streams[0])}this.safeEmit("ontrack",e)},t.prototype.clean=function(){var e;XV.print("clean","exec stream.clean ".concat(this.streamId," ").concat(this.userId)),this.subAudio=!1,this.subVideo=!1,this.audioMid=void 0,this.videoMid=void 0,this.sequenceId=0,this.videoTrack=void 0,this.audioTrack=void 0,this.stream=void 0,this.videoTransceiver=void 0,this.audioTransceiver=void 0,this.recordedVideoFrames=void 0,this.paused=!1,this._workaround_1_=!1,null===(e=this.observer)||void 0===e||e.reset()},t.prototype.resetHasSubscribed=function(){this.hasSubscribed=!1},t.prototype._setStream=function(e){var t=this;this.stream=e,e.onaddtrack=function(e){"video"===e.track.kind?t._setVideoTrack(e.track):"audio"===e.track.kind&&t._setAudioTrack(e.track)}},t.prototype._setAudioTrack=function(e){var t,r;(null===(r=null===(t=this.audioTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.audioTrack=new TV(e,gD()),this.emit("ontrack",this.audioTrack))},t.prototype._setVideoTrack=function(e){var t,r;(null===(r=null===(t=this.videoTrack)||void 0===t?void 0:t.getTrack())||void 0===r?void 0:r.id)!==(null==e?void 0:e.id)&&(this.videoTrack=new bV(e,gD()),this.emit("ontrack",this.videoTrack))},t}($D);!function(e){e[e.CHANNEL_PROFILE_COMMUNICATION=0]="CHANNEL_PROFILE_COMMUNICATION",e[e.CHANNEL_PROFILE_LIVE_BROADCASTING=1]="CHANNEL_PROFILE_LIVE_BROADCASTING"}(GV||(GV={})),function(e){e.RESUBSCRIBE="resubscribe",e.STREAM_FAILED="stream_failed",e.SUBSCRIBE_PUSH_TRACK="subscribe_push_track",e.REMOVE_PUSH_TRACK="remove_push_track",e.VIDEO_FIRST_FRAME="video_first_frame",e.ON_USER_MUTE_AUDIO="on_user_mute_audio",e.ON_USER_MUTE_VIDEO="on_user_mute_video",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"}(HV||(HV={})),function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.RECEIVED=3]="RECEIVED"}(zV||(zV={}));var qV,ZV=function(){function e(e,t){this._audioEventSessionId=CD(),this._videoEventSessionId=CD(),this._isScreen=!1,this._audioFirstFrameState=zV.INITIAL,this._videoFirstFrameState=zV.INITIAL,this._timeout=1e4,this._currentAudioRecv={startTime:0,eventSessionId:0,type:UU.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:UU.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._publishVideo=!1,this._publishAudio=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._stream=e,this._handler=t,this.getTransportDelay()}return e.prototype.beginRecvFrame=function(e,t){var r,i,n,o,a;return ev(this,void 0,void 0,(function(){var s,c,u,d,l,h,p,f=this;return tv(this,(function(_){switch(_.label){case 0:return[4,this.getTransportDelay()];case 1:return _.sent(),s=this._transportDelay,c=!0,u=UU.LOGIN,d=UU.UNMUTE,l=UU.SUBSCRIBE,h=UU.PUSH_TRACK,[u,d,l,h].indexOf(t)>=0&&(s=0,c=!1),e===MU.AUDIO?(c||this._audioEventSessionId++,this._currentAudioRecv={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t},p={media_type:e,event_type:kU.BEGIN_RECV,type:t,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.startTime,event_session_id:this._audioEventSessionId,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,transport_delay:s},this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){f.stopRecvFrame(MU.AUDIO,LU.TIMEOUT),f._firstAudioFrameInterval&&window.clearInterval(f._firstAudioFrameInterval)}),this._timeout),hL.rtcFirstFrame(p),this._watchForFirstAudioFrameRecv(),this._audioFirstFrameState=zV.BEGIN,this._login=!0,this._unMuteAudio=!0,this._enableAudio=!0,this._remoteUnmuteAudio=!0):e===MU.VIDEO&&(c||this._videoEventSessionId++,this._currentVideoRecv={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t},p={media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?MU.SCREEN_VIDEO:e,event_type:kU.BEGIN_RECV,type:t,start:null===(o=this._currentVideoRecv)||void 0===o?void 0:o.startTime,event_session_id:this._videoEventSessionId,stream_user_id:null===(a=this._stream)||void 0===a?void 0:a.userId,transport_delay:s},this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){f.stopRecvFrame(MU.VIDEO,LU.TIMEOUT),f._firstVideoFrameInterval&&window.clearInterval(f._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameRecv(),hL.rtcFirstFrame(p),this._videoFirstFrameState=zV.BEGIN,this._login=!0,this._unMuteVideo=!0,this._enableVideo=!0,this._remoteUnmuteVideo=!0),[2]}}))}))},e.prototype.stopRecvFrame=function(e,t){var r,i,n,o,a,s,c;if(e===MU.AUDIO){if(this._audioFirstFrameState!==zV.BEGIN)return;var u={event_type:kU.RECV_END,media_type:e,start:null===(r=this._currentAudioRecv)||void 0===r?void 0:r.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===(n=this._currentAudioRecv)||void 0===n?void 0:n.type};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),delete this._currentAudioRecv,hL.rtcFirstFrame(u),this._audioFirstFrameState=zV.STOPPED}else if(e===MU.VIDEO){if(this._videoFirstFrameState!==zV.BEGIN)return;u={event_type:kU.RECV_END,media_type:(null===(o=this._stream)||void 0===o?void 0:o.isScreen)?MU.SCREEN_VIDEO:e,start:null===(a=this._currentVideoRecv)||void 0===a?void 0:a.startTime,reason:t,result:!1,stream_user_id:null===(s=this._stream)||void 0===s?void 0:s.userId,event_session_id:this._videoEventSessionId,type:null===(c=this._currentVideoRecv)||void 0===c?void 0:c.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoRecv,hL.rtcFirstFrame(u),this._videoFirstFrameState=zV.STOPPED}},e.prototype.recvFrameFinish=function(e){var t,r,i;return ev(this,void 0,void 0,(function(){var n,o,a,s,c,u,d,l,h,p;return tv(this,(function(f){switch(f.label){case 0:return[4,this.getTransportDelay()];case 1:if(f.sent(),n=this._transportDelay,o=UU.LOGIN,a=UU.UNMUTE,s=UU.SUBSCRIBE,c=UU.PUSH_TRACK,e===MU.AUDIO){if(this._audioFirstFrameState!==zV.BEGIN)return[2];if(!this._currentAudioRecv)return[2];u=this._currentAudioRecv,l=u.type,h=u.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:kU.RECV_END,media_type:e,start:h,result:!0,stream_user_id:null===(t=this._stream)||void 0===t?void 0:t.userId,event_session_id:this._audioEventSessionId,type:l,transport_delay:n},delete this._currentAudioRecv,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),hL.rtcFirstFrame(p),this._audioFirstFrameState=zV.RECEIVED}else if(e===MU.VIDEO){if(this._videoFirstFrameState!==zV.BEGIN)return[2];if(!this._currentVideoRecv)return[2];d=this._currentVideoRecv,l=d.type,h=d.startTime,[o,a,s,c].indexOf(l)>=0&&(n=0),p={event_type:kU.RECV_END,media_type:(null===(r=this._stream)||void 0===r?void 0:r.isScreen)?MU.SCREEN_VIDEO:e,start:h,result:!0,stream_user_id:null===(i=this._stream)||void 0===i?void 0:i.userId,event_session_id:this._videoEventSessionId,type:l,transport_delay:n},delete this._currentVideoRecv,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),hL.rtcFirstFrame(p),this._videoFirstFrameState=zV.RECEIVED}return[2]}}))}))},e.prototype.setLogin=function(e,t){var r,i,n,o;void 0===t&&(t={audio:!0,video:!0}),this._login!==e&&(this._login=e,e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&t.audio&&this.beginRecvFrame(MU.AUDIO,UU.LOGIN),e&&(null===(i=this._stream)||void 0===i?void 0:i.hasVideo)&&t.video&&this.beginRecvFrame(MU.VIDEO,UU.LOGIN),!e&&(null===(n=this._stream)||void 0===n?void 0:n.hasAudio)&&this.stopRecvFrame(MU.AUDIO,LU.LEAVE_ROOM),!e&&(null===(o=this._stream)||void 0===o?void 0:o.hasVideo)&&this.stopRecvFrame(MU.VIDEO,LU.LEAVE_ROOM))},e.prototype.setUnmuteAudio=function(e){var t;this._unMuteAudio!==e&&(this._unMuteAudio=e,this._unMuteAudio?this.beginRecvFrame(MU.AUDIO,UU.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(MU.AUDIO,LU.MUTE))},e.prototype.setRemoteUnmuteAudio=function(e){var t;this._remoteUnmuteAudio!==e&&(this._remoteUnmuteAudio=e,this._remoteUnmuteAudio?this.beginRecvFrame(MU.AUDIO,UU.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(MU.AUDIO,LU.REMOTE_MUTE))},e.prototype.setEnableAudio=function(e){var t;this._enableAudio!==e&&(this._enableAudio=e,this._enableAudio?this.beginRecvFrame(MU.AUDIO,UU.ENABLE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(MU.AUDIO,LU.DISABLE))},e.prototype.setUnmuteVideo=function(e){var t;this._unMuteVideo!==e&&(this._unMuteVideo=e,this._unMuteVideo?this.beginRecvFrame(MU.VIDEO,UU.UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(MU.VIDEO,LU.MUTE))},e.prototype.setRemoteUnmuteVideo=function(e){var t;this._remoteUnmuteVideo!==e&&(this._remoteUnmuteVideo=e,this._remoteUnmuteVideo?this.beginRecvFrame(MU.VIDEO,UU.REMOTE_UNMUTE):(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(MU.VIDEO,LU.REMOTE_MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,this._enableVideo?this.beginRecvFrame(MU.VIDEO,UU.ENABLE):this.stopRecvFrame(MU.VIDEO,LU.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal=e},e.prototype.setPushAudio=function(e){var t;this._audioExternal&&this._pushAudio!==e&&(this._pushAudio=e),this._pushAudio&&this.beginRecvFrame(MU.AUDIO,UU.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(MU.AUDIO,UU.PUSH)},e.prototype.setExternalVideoSource=function(e){this._videoExternal=e},e.prototype.setPushVideo=function(e){var t;this._videoExternal&&this._pushVideo!==e&&(this._pushVideo=e),this._pushVideo&&this.beginRecvFrame(MU.VIDEO,UU.PUSH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(MU.VIDEO,UU.PUSH)},e.prototype.setPublishVideo=function(e){var t;this._publishVideo!==e&&(this._publishVideo=e),this._publishVideo&&this.beginRecvFrame(MU.VIDEO,UU.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.stopRecvFrame(MU.VIDEO,LU.UNPUBLISH)},e.prototype.setPublishAudio=function(e){var t;this._publishAudio!==e&&(this._publishAudio=e),this._publishAudio&&this.beginRecvFrame(MU.AUDIO,UU.PUBLISH),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(MU.AUDIO,LU.UNPUBLISH)},e.prototype.setAutoSubscribe=function(e){this._autoSubscribe=e},e.prototype.setAutoSubscribeVideo=function(e){this._autoSubscribeVideo=e},e.prototype.setAutoSubscribeAudio=function(e){this._autoSubscribeAudio=e},e.prototype.setSubscribeAudio=function(e){var t,r;this._autoSubscribeAudio||this._subscribeAudio===e||(this._subscribe=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.beginRecvFrame(MU.AUDIO,UU.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasAudio)&&this.stopRecvFrame(MU.AUDIO,LU.UNSUBSCRIBE)},e.prototype.setSubscribeVideo=function(e){var t,r;this._autoSubscribeVideo||this._subscribeVideo===e||(this._subscribeVideo=e,e&&(null===(t=this._stream)||void 0===t?void 0:t.hasVideo)&&this.beginRecvFrame(MU.VIDEO,UU.SUBSCRIBE)),!e&&(null===(r=this._stream)||void 0===r?void 0:r.hasVideo)&&this.stopRecvFrame(MU.VIDEO,LU.UNSUBSCRIBE)},e.prototype.setPushTrack=function(e){var t;this._pushTrack!==e&&(e&&!this._isScreen&&this.beginRecvFrame(MU.AUDIO,UU.PUSH_TRACK),!e&&(null===(t=this._stream)||void 0===t?void 0:t.hasAudio)&&this.stopRecvFrame(MU.AUDIO,LU.REMOVE_TRACK))},e.prototype.setMultiChatMode=function(e){this._multiChatMode=e},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype._watchForFirstVideoFrameRecv=function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval((function(){return ev(e,void 0,void 0,(function(){var e,r,i,n,o,a,s,c;return tv(this,(function(u){switch(u.label){case 0:return(null===(i=this._handler)||void 0===i?void 0:i.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())?[4,fx(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.videoTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(r=e.find((function(e){return"inbound-rtp"===e.type})))&&r.framesReceived>t){if(-1===t)return t=r.framesReceived,[2];this.recvFrameFinish(MU.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype._watchForFirstAudioFrameRecv=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return ev(e,void 0,void 0,(function(){var e,r,i,n,o,a,s,c;return tv(this,(function(u){switch(u.label){case 0:return(null===(i=this._handler)||void 0===i?void 0:i.pc)&&(null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())?[4,fx(null===(a=this._handler)||void 0===a?void 0:a.pc,null===(c=null===(s=this._stream)||void 0===s?void 0:s.audioTrack)||void 0===c?void 0:c.getTrack())]:[3,2];case 1:if(e=u.sent(),(r=e.find((function(e){return"inbound-rtp"===e.type})))&&r.totalSamplesReceived>t){if(-1===t)return t=r.totalSamplesReceived,[2];this.recvFrameFinish(MU.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}u.label=2;case 2:return[2]}}))}))}),200)},e.prototype.getTransportDelay=function(){return ev(this,void 0,void 0,(function(){var e=this;return tv(this,(function(t){switch(t.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return t.sent(),window.clearInterval(this._transportDelayInterval),this._transportDelayInterval=window.setInterval((function(){return ev(e,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return[4,this.getTransportDelayIntl()];case 1:return e.sent(),[2]}}))}))}),2e3),[2]}}))}))},e.prototype.getTransportDelayIntl=function(){var e,t;return ev(this,void 0,void 0,(function(){var r,i,n;return tv(this,(function(o){switch(o.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)?[4,fx(null===(t=this._handler)||void 0===t?void 0:t.pc)]:[3,2];case 1:r=o.sent(),i=r.find((function(e){return"transport"===e.type&&"connected"===e.dtlsState})),(n=r.find((function(e){return"candidate-pair"===e.type&&"succeeded"===e.state&&e.id===(null==i?void 0:i.selectedCandidatePairId)})))&&(this._transportDelay=Math.round(1e3*n.currentRoundTripTime/2)),o.label=2;case 2:return[2]}}))}))},e.prototype.reset=function(){this._currentAudioRecv={startTime:0,eventSessionId:0,type:UU.LOGIN},this._currentVideoRecv={startTime:0,eventSessionId:0,type:UU.LOGIN},this._login=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._remoteUnmuteAudio=!1,this._remoteUnmuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoSubscribeVideo=!1,this._autoSubscribeAudio=!1,this._autoSubscribe=!1,this._subscribeAudio=!1,this._subscribeVideo=!1,this._subscribe=!1,this._pushTrack=!1,this._multiChatMode=!1,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstAudioFrameInterval&&window.clearInterval(this._firstAudioFrameInterval),this._firstVideoFrameInterval&&window.clearInterval(this._firstVideoFrameInterval),this._transportDelayInterval&&window.clearInterval(this._transportDelayInterval)},e}();!function(e){e[e.INITIAL=0]="INITIAL",e[e.BEGIN=1]="BEGIN",e[e.STOPPED=2]="STOPPED",e[e.SENT=3]="SENT"}(qV||(qV={}));var $V=function(){function e(e,t){this._audioEventSessionId=CD(),this._videoEventSessionId=CD(),this._currentAudioSend={startTime:0,eventSessionId:0,type:UU.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:UU.LOGIN},this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._timeout=1e4,this._audioFirstFrameState=qV.INITIAL,this._videoFirstFrameState=qV.INITIAL,this._stream=e,this._handler=t}return e.prototype.beginSendFrame=function(e,t){var r,i,n,o=this;if(e===MU.AUDIO){this._audioEventSessionId++,this._currentAudioSend={startTime:Date.now(),eventSessionId:this._audioEventSessionId,type:t};var a={media_type:e,event_type:kU.BEGIN_SEND,type:t,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.startTime,event_session_id:this._audioEventSessionId};this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),this._firstAudioFrameTimer=window.setTimeout((function(){o.stopSendFrame(MU.AUDIO,LU.TIMEOUT),o._firstAudioFrameInterval&&window.clearInterval(o._firstAudioFrameInterval)}),this._timeout),hL.rtcFirstFrame(a),this._watchForFirstAudioFrameSend(),this._audioFirstFrameState=qV.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteAudio=!0,this._pushAudio||(this._enableAudio=!0)}else if(e===MU.VIDEO){this._videoEventSessionId++,this._currentVideoSend={startTime:Date.now(),eventSessionId:this._videoEventSessionId,type:t};a={media_type:(null===(i=this._stream)||void 0===i?void 0:i.isScreen)?MU.SCREEN_VIDEO:e,event_type:kU.BEGIN_SEND,type:t,start:null===(n=this._currentVideoSend)||void 0===n?void 0:n.startTime,event_session_id:this._videoEventSessionId};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),this._firstVideoFrameTimer=window.setTimeout((function(){o.stopSendFrame(MU.VIDEO,LU.TIMEOUT),o._firstVideoFrameInterval&&window.clearInterval(o._firstVideoFrameInterval)}),this._timeout),this._watchForFirstVideoFrameSend(),hL.rtcFirstFrame(a),this._videoFirstFrameState=qV.BEGIN,this._login=!0,this._publisher=!0,this._publish=!0,this._unMuteVideo=!0,this._pushVideo||(this._enableVideo=!0)}},e.prototype.stopSendFrame=function(e,t){var r,i,n,o,a;if(e===MU.AUDIO){if(this._audioFirstFrameState!==qV.BEGIN)return;var s={event_type:kU.SENT_END,media_type:e,start:null===(r=this._currentAudioSend)||void 0===r?void 0:r.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,hL.rtcFirstFrame(s),this._audioFirstFrameState=qV.STOPPED}else if(e===MU.VIDEO){if(this._videoFirstFrameState!==qV.BEGIN)return;s={event_type:kU.SENT_END,media_type:(null===(n=this._stream)||void 0===n?void 0:n.isScreen)?MU.SCREEN_VIDEO:e,start:null===(o=this._currentVideoSend)||void 0===o?void 0:o.startTime,reason:t,result:!1,event_session_id:this._videoEventSessionId,type:null===(a=this._currentVideoSend)||void 0===a?void 0:a.type};this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),delete this._currentVideoSend,hL.rtcFirstFrame(s),this._videoFirstFrameState=qV.STOPPED}},e.prototype.sendFrameFinish=function(e){var t;if(e===MU.AUDIO){if(this._audioFirstFrameState!==qV.BEGIN)return;if(!this._currentAudioSend)return;var r=this._currentAudioSend,i=r.type,n=r.startTime,o={event_type:kU.SENT_END,media_type:e,start:n,result:!0,event_session_id:this._audioEventSessionId,type:i};delete this._currentAudioSend,this._firstAudioFrameTimer&&window.clearTimeout(this._firstAudioFrameTimer),hL.rtcFirstFrame(o),this._audioFirstFrameState=qV.SENT}else if(e===MU.VIDEO){if(this._videoFirstFrameState!==qV.BEGIN)return;if(!this._currentVideoSend)return;var a=this._currentVideoSend;i=a.type,n=a.startTime,o={event_type:kU.SENT_END,media_type:(null===(t=this._stream)||void 0===t?void 0:t.isScreen)?MU.SCREEN_VIDEO:e,start:n,result:!0,event_session_id:this._videoEventSessionId,type:i};delete this._currentVideoSend,this._firstVideoFrameTimer&&window.clearTimeout(this._firstVideoFrameTimer),hL.rtcFirstFrame(o),this._videoFirstFrameState=qV.SENT}},e.prototype.setLogin=function(e){var t,r;this._login!==e&&(this._login=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(MU.VIDEO,UU.LOGIN),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(MU.AUDIO,UU.LOGIN)),!e&&this._audioSending&&this.stopSendFrame(MU.AUDIO,LU.LEAVE_ROOM),!e&&this._videoSending&&this.stopSendFrame(MU.VIDEO,LU.LEAVE_ROOM))},e.prototype.setPublish=function(e){var t,r;this._publish!==e&&(this._publish=e,e&&((null===(t=this._stream)||void 0===t?void 0:t.videoTrack)&&this.beginSendFrame(MU.VIDEO,UU.PUBLISH),(null===(r=this._stream)||void 0===r?void 0:r.audioTrack)&&this.beginSendFrame(MU.AUDIO,UU.PUBLISH)),!e&&this._audioSending&&this.stopSendFrame(MU.AUDIO,LU.UNPUBLISH),!e&&this._videoSending&&this.stopSendFrame(MU.VIDEO,LU.UNPUBLISH))},e.prototype.setUnmuteAudio=function(e){this._unMuteAudio!==e&&(this._unMuteAudio=e,e&&this.beginSendFrame(MU.AUDIO,UU.UNMUTE),!e&&this._audioSending&&this.stopSendFrame(MU.AUDIO,LU.MUTE))},e.prototype.setEnableAudio=function(e){this._enableAudio!==e&&(this._enableAudio=e,e&&this.beginSendFrame(MU.AUDIO,UU.ENABLE),!e&&this._audioSending&&this.stopSendFrame(MU.AUDIO,LU.DISABLE))},e.prototype.setUnmuteVideo=function(e){this._unMuteVideo!==e&&(this._unMuteVideo=e,e&&this.beginSendFrame(MU.VIDEO,UU.UNMUTE),!e&&this._videoSending&&this.stopSendFrame(MU.VIDEO,LU.MUTE))},e.prototype.setEnableVideo=function(e){this._enableVideo!==e&&(this._enableVideo=e,e&&this.beginSendFrame(MU.VIDEO,UU.ENABLE),!e&&this._videoSending&&this.stopSendFrame(MU.VIDEO,LU.DISABLE))},e.prototype.setExternalAudioSource=function(e){this._audioExternal!==e&&(this._audioExternal=e,e&&(this._audioSending&&this.stopSendFrame(MU.AUDIO,LU.DISABLE),this._enableAudio=!1),e||(this._audioSending&&this.stopSendFrame(MU.AUDIO,LU.STOP_PUSH),this._pushAudio=!1))},e.prototype.setPushAudio=function(e){this._pushAudio!==e&&(this._pushAudio=e,e&&this.beginSendFrame(MU.AUDIO,UU.PUSH),!e&&this._audioSending&&this.stopSendFrame(MU.AUDIO,LU.STOP_PUSH))},e.prototype.setExternalVideoSource=function(e){this._videoExternal!==e&&(this._videoExternal=e,e&&(this._videoSending&&this.stopSendFrame(MU.VIDEO,LU.DISABLE),this._enableVideo=!1),e||(this._videoSending&&this.stopSendFrame(MU.VIDEO,LU.STOP_PUSH),this._pushVideo=!1))},e.prototype.setPushVideo=function(e){this._pushVideo!==e&&(this._pushVideo=e,e&&this.beginSendFrame(MU.VIDEO,UU.PUSH),!e&&this._videoSending&&this.stopSendFrame(MU.VIDEO,LU.STOP_PUSH))},e.prototype.setAutoPublish=function(e){this._autoPublish=e},e.prototype.setPublisher=function(e){this._publisher!==e&&(this._publisher=e,!e&&this._audioSending&&this.stopSendFrame(MU.AUDIO,LU.AUDIENCE),!e&&this._videoSending&&this.stopSendFrame(MU.VIDEO,LU.AUDIENCE))},e.prototype.setTimeout=function(e){this._timeout=e},e.prototype.setPCSessionId=function(e){this._pcSessionId=e},e.prototype.setHandler=function(e){this._handler=e},e.prototype._getFirstVideoFrameStats=function(){var e,t,r,i,n,o;return ev(this,void 0,void 0,(function(){var a;return tv(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(r=null===(t=this._stream)||void 0===t?void 0:t.videoTrack)||void 0===r?void 0:r.getTrack())?[4,fx(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.videoTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._getFirstAudioFrameStats=function(){var e,t,r,i,n,o;return ev(this,void 0,void 0,(function(){var a;return tv(this,(function(s){switch(s.label){case 0:return(null===(e=this._handler)||void 0===e?void 0:e.pc)&&(null===(r=null===(t=this._stream)||void 0===t?void 0:t.audioTrack)||void 0===r?void 0:r.getTrack())?[4,fx(null===(i=this._handler)||void 0===i?void 0:i.pc,null===(o=null===(n=this._stream)||void 0===n?void 0:n.audioTrack)||void 0===o?void 0:o.getTrack())]:[3,2];case 1:return a=s.sent(),[2,a.find((function(e){return"outbound-rtp"===e.type}))];case 2:return[2]}}))}))},e.prototype._watchForFirstVideoFrameSend=function(){var e=this,t=-1;this._firstVideoFrameInterval=window.setInterval((function(){return ev(e,void 0,void 0,(function(){var e;return tv(this,(function(r){switch(r.label){case 0:return[4,this._getFirstVideoFrameStats()];case 1:if((e=r.sent())&&e.framesSent>t){if(-1===t)return t=e.framesSent,[2];this.sendFrameFinish(MU.VIDEO),window.clearInterval(this._firstVideoFrameInterval)}return[2]}}))}))}),100)},e.prototype._watchForFirstAudioFrameSend=function(){var e=this,t=-1;this._firstAudioFrameInterval=window.setInterval((function(){return ev(e,void 0,void 0,(function(){var e;return tv(this,(function(r){switch(r.label){case 0:return[4,this._getFirstAudioFrameStats()];case 1:if((e=r.sent())&&e.packetsSent>t){if(-1===t)return t=e.packetsSent,[2];this.sendFrameFinish(MU.AUDIO),window.clearInterval(this._firstAudioFrameInterval)}return[2]}}))}))}),100)},e.prototype.reset=function(){this._login=!1,this._publisher=!1,this._unMuteAudio=!1,this._enableAudio=!1,this._unMuteVideo=!1,this._enableVideo=!1,this._audioExternal=!1,this._pushAudio=!1,this._videoExternal=!1,this._pushVideo=!1,this._autoPublish=!1,this._publish=!1,this._audioFirstFrameState=qV.INITIAL,this._videoFirstFrameState=qV.INITIAL,this._currentAudioSend={startTime:0,eventSessionId:0,type:UU.LOGIN},this._currentVideoSend={startTime:0,eventSessionId:0,type:UU.LOGIN},window.clearTimeout(this._firstAudioFrameTimer),window.clearTimeout(this._firstVideoFrameTimer),window.clearInterval(this._firstAudioFrameInterval),window.clearInterval(this._firstVideoFrameInterval)},e.prototype.destroy=function(){this.reset(),delete this._stream,delete this._handler},Object.defineProperty(e.prototype,"_audioSending",{get:function(){return this._audioFirstFrameState===qV.BEGIN},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_videoSending",{get:function(){return this._videoFirstFrameState===qV.BEGIN},enumerable:!1,configurable:!0}),e}(),QV=new qD("Room",1),eF=function(e){function t(t){var r=e.call(this)||this;return r._remoteUsers=new Map,r._remoteStreams=new Map,r._waitForNewToken=!1,r._userDuplicateLoginTimerMap=new Map,r._hasPublished=!1,r._roomConfig=t,r._mediaServerClient=new VV,r._addHandlerEventHandler(),r._isReconnecting=!1,r}return Z_(t,e),Object.defineProperty(t.prototype,"hasScreenPublished",{get:function(){var e;return null===(e=this._localScreenStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasPublished",{get:function(){var e;return null===(e=this._localStream)||void 0===e?void 0:e.hasPublished},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){return this._mediaServerClient.connectionState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){return this._remoteUsers},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){return this._remoteStreams},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localStream",{get:function(){return this._localStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenStream",{get:function(){return this._localScreenStream},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"roomInfo",{get:function(){return this._roomInfo},enumerable:!1,configurable:!0}),t.prototype._addHandlerEventHandler=function(){var e,t,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E=this;null===(e=this._mediaServerClient)||void 0===e||e.on(tL.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on(tL.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._mediaServerClient)||void 0===r||r.on(tL.USER_CONNECTION,this._onUserConnection.bind(this)),null===(i=this._mediaServerClient)||void 0===i||i.on(tL.USER_DISCONNECTION,this._onUserDisconnection.bind(this)),null===(n=this._mediaServerClient)||void 0===n||n.on(tL.ON_UPDATE_ROOM_ATTRIBUTES,this._onUpdateRoomAttributes.bind(this)),null===(o=this._mediaServerClient)||void 0===o||o.on(tL.ON_UPDATE_STREAM_ATTRIBUTES,this._onUpdateStreamAttributes.bind(this)),null===(a=this._mediaServerClient)||void 0===a||a.on(tL.ON_PUSH_TRACK,this._onPushTrack.bind(this)),null===(s=this._mediaServerClient)||void 0===s||s.on(tL.ON_REMOVE_TRACK,this._onRemoveTrack.bind(this)),null===(c=this._mediaServerClient)||void 0===c||c.on(tL.NODE_CHANGE,this._nodeChange.bind(this)),null===(u=this._mediaServerClient)||void 0===u||u.on(tL.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(d=this._mediaServerClient)||void 0===d||d.on(tL.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(l=this._mediaServerClient)||void 0===l||l.on(tL.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(h=this._mediaServerClient)||void 0===h||h.on(tL.POST_PROCESSING_MESSAGE,this._onPostProcessingMessage.bind(this)),null===(p=this._mediaServerClient)||void 0===p||p.on(tL.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(f=this._mediaServerClient)||void 0===f||f.on(rL.RSCP,this._onPublishOnDemand.bind(this)),null===(_=this._mediaServerClient)||void 0===_||_.on(iL.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(v=this._mediaServerClient)||void 0===v||v.on(iL.ABNORMAL_DISCONNECTION,this._handleAbnormalDisconnection.bind(this)),null===(m=this._mediaServerClient)||void 0===m||m.on("onRemoteStreamStats",(function(e){E.emit(HV.ON_REMOTE_STREAM_STATS,e)})),null===(S=this._mediaServerClient)||void 0===S||S.on("onLocalStreamStats",(function(e){E.emit(HV.ON_LOCAL_STREAM_STATS,e)}))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._mediaServerClient)||void 0===e||e.removeAllListeners()},t.prototype.join=function(e,t,r,i,n,o){return ev(this,void 0,void 0,(function(){var a=this;return tv(this,(function(s){return _L.setStats({rtc_app_id:e,room_id:t,user_id:i.userId}),QV.print("join()"),[2,new Promise((function(s,c){return ev(a,void 0,void 0,(function(){var a,u,d=this;return tv(this,(function(l){return this._joinResolveCallback=s,this._joinRejectCallback=c,this._liveControlMessage=n,this._roomInfo={appId:e,roomId:t,token:r,userInfo:i,useCloudProxy:o},a=bD(),this.setSessionId(),hL.joinRoom(FU.BEGIN,a,!1,"",{enable_cloud_proxy:null===(u=this._roomInfo)||void 0===u?void 0:u.useCloudProxy}),this._join((function(e){var t;hL.joinRoom(FU.END,a,!0,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),s(e)}),(function(e){var t;hL.joinRoom(FU.END,a,!1,e.message,{enable_cloud_proxy:null===(t=d._roomInfo)||void 0===t?void 0:t.useCloudProxy}),c(e)}),!1),[2]}))}))}))]}))}))},t.prototype._join=function(e,t,r){var i;return void 0===r&&(r=!1),ev(this,void 0,void 0,(function(){var n,o,a;return tv(this,(function(s){switch(s.label){case 0:n=bD(),QV.print("_join()"),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this._mediaServerClient.join(this._roomInfo,{node:this._getAccessNode,reason:this._getAccessFeedback,sessionId:this._sessionId},r,this._liveControlMessage)];case 2:return o=s.sent(),this._mediaServerClient.roomAttributes=o.roomAttributes,this._joinResolveCallback=void 0,this._joinRejectCallback=void 0,this._getAccessFeedback=void 0,this._getAccessNode=void 0,"function"==typeof e&&e(null===(i=this._roomInfo)||void 0===i?void 0:i.userInfo),this._isReconnecting=!1,hL.rtcJoinRoom(0,"web","web",bD()-n),this._onJoinSucc(o,r),[3,4];case 3:return(a=s.sent()).code!==ZN.OPERATION_CANCEL&&"function"==typeof t?[2,t(a)]:[3,4];case 4:return[2]}}))}))},t.prototype.publishScreen=function(e,t,r){var i,n,o,a,s;return ev(this,void 0,void 0,(function(){var c,u,d,l;return tv(this,(function(h){switch(h.label){case 0:return QV.print("publishScreen()"),this._localScreenStream||(this._localScreenStream=new WV,this._localScreenStream.isScreen=!0,this._mediaServerClient.handler&&(this._localScreenStream.observer=new $V(this._localScreenStream,this._mediaServerClient.handler))),c=!1,u=!1,d=!1,l=!1,!this._localScreenStream.videoTrack&&t?(t instanceof OV&&(u=!0),c=!0):this._localScreenStream.videoTrack&&!t&&(c=!1),!this._localScreenStream.audioTrack&&r?(r instanceof NV&&(l=!0),d=!0):this._localScreenStream.audioTrack&&!r&&(d=!1),this._localScreenStream.videoTrack=t,this._localScreenStream.audioTrack=r,this._localScreenStream.videoEncodeConfig=e,this._localScreenStream.hasPublished?[3,2]:(null===(i=this._localScreenStream.observer)||void 0===i||i.setPublish(!0),[4,this._mediaServerClient.publish(this._localScreenStream)]);case 1:return h.sent(),[3,4];case 2:return u?null===(n=this._localScreenStream.observer)||void 0===n||n.setPushVideo(c):null===(o=this._localScreenStream.observer)||void 0===o||o.setEnableVideo(c),l?null===(a=this._localScreenStream.observer)||void 0===a||a.setPushAudio(d):null===(s=this._localScreenStream.observer)||void 0===s||s.setEnableAudio(d),[4,this.updatePubScreenTrack()];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},t.prototype.updatePubScreenTrack=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return QV.print("updatePubScreenTrack","Invoke updatePubScreenTrack"),this._localScreenStream?[4,this._mediaServerClient.updatePubTrack(this._localScreenStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublishScreen=function(){var e;return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return QV.print("unpublish","Invoke unpublishScreen"),this._localScreenStream?(null===(e=this._localScreenStream.observer)||void 0===e||e.setPublish(!1),[4,this._mediaServerClient.unpublish(this._localScreenStream)]):[3,2];case 1:t.sent(),this._localScreenStream.clean(),this._localScreenStream=void 0,t.label=2;case 2:return[2]}}))}))},t.prototype.liveControlMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return QV.print("controlMessage","Invoke controlMessage"),this._liveControlMessage=e,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),"stopped"===e.action&&delete this._liveControlMessage,[2]}}))}))},t.prototype.publicStreamControlMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return"stopped"===e.action&&delete e.publicStreamMeta,[4,this._mediaServerClient.controlMessage(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.updateUserAttributes=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return QV.print("updateUserAttributes","Invoke updateUserAttributes"),e.role&&this._roomInfo&&(this._roomInfo.userInfo.role=e.role),[4,this._mediaServerClient.updateUserAttributes(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.publish=function(e,t,r,i,n){var o,a,s,c,u,d;return void 0===n&&(n=!1),ev(this,void 0,void 0,(function(){var l,h,p,f,_,v;return tv(this,(function(m){switch(m.label){case 0:if(QV.print("publish","Invoke publish"),l=!1,this._localStream||(this._localStream=new WV,this._mediaServerClient.handler&&(this._localStream.observer=new $V(this._localStream,this._mediaServerClient.handler)),l=!0),this._localStream.videoTrack=r,this._localStream.audioTrack=i,this._localStream.videoEncodeConfig=e,this._localStream.enableSimulcast=t,this._localStream.hasPublished)return[3,5];m.label=1;case 1:return m.trys.push([1,3,,4]),n?null===(o=this._localStream.observer)||void 0===o||o.setLogin(!0):l&&(h=!!this._localStream.videoTrack,p=!!this._localStream.audioTrack,f=this._localStream.videoTrack instanceof OV,_=this._localStream.audioTrack instanceof NV,this._roomConfig.isAutoPublish&&!this._hasPublished?(h&&(f?null===(a=this._localStream.observer)||void 0===a||a.setPushVideo(!0):null===(s=this._localStream.observer)||void 0===s||s.setEnableVideo(!0)),p&&(_?null===(c=this._localStream.observer)||void 0===c||c.setPushAudio(!0):null===(u=this._localStream.observer)||void 0===u||u.setEnableAudio(!0))):null===(d=this._localStream.observer)||void 0===d||d.setPublish(!0)),[4,this._mediaServerClient.publish(this._localStream)];case 2:return m.sent(),this._hasPublished=!0,this.emit(HV.ON_PUBLISH_RESULT,{isScreen:!1,state:TP.PUBLISH_SUCC}),[3,4];case 3:throw v=m.sent(),this.emit(HV.ON_PUBLISH_RESULT,{isScreen:!1,state:TP.PUBLISH_FAIL}),v;case 4:return[3,7];case 5:return[4,this.updatePubTrack()];case 6:m.sent(),m.label=7;case 7:return[2]}}))}))},t.prototype.updatePubTrack=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return QV.print("updatePubTrack","Invoke updatePubTrack"),this._localStream?[4,this._mediaServerClient.updatePubTrack(this._localStream)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.unpublish=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return QV.print("unpublish","Invoke unpublish"),this._localStream?[4,this._mediaServerClient.unpublish(this._localStream)]:[3,2];case 1:e.sent(),this._localStream.clean(),this._localStream=void 0,e.label=2;case 2:return[2]}}))}))},t.prototype.subscribe=function(e,t,r){return ev(this,void 0,void 0,(function(){return tv(this,(function(i){switch(i.label){case 0:return QV.print("subscribe","remoteStream %o",e),[4,this._mediaServerClient.subscribe(e,t,r)];case 1:return i.sent(),[2]}}))}))},t.prototype.updateSubTrack=function(e,t,r){var i,n;return ev(this,void 0,void 0,(function(){return tv(this,(function(o){return QV.print("updateSubTrack","Invoke updateSubTrack"),e.subMediaType===t&&(null===(i=null==e?void 0:e.subConfig)||void 0===i?void 0:i.videoIndex)===(null==r?void 0:r.videoIndex)?[2,Promise.resolve(e)]:[2,null===(n=this._mediaServerClient)||void 0===n?void 0:n.updateSubTrack(e,t,r)]}))}))},t.prototype.unsubscribe=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return QV.print("unsubscribe","Invoke unsubscribe"),[4,this._mediaServerClient.unsubscribe(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.leave=function(e){var t;return void 0===e&&(e=!1),ev(this,void 0,void 0,(function(){var r,i,n,o,a,s,c;return tv(this,(function(u){switch(u.label){case 0:QV.print("leave","Invoke leave"),r=bD(),u.label=1;case 1:u.trys.push([1,3,,4]),clearTimeout(this._reconnectTimer);try{for(i=rv(this._remoteStreams.values()),n=i.next();!n.done;n=i.next())o=n.value,Array.isArray(o)&&o.forEach((function(e){var t;null===(t=e.observer)||void 0===t||t.setLogin(!1)}))}catch(e){s={error:e}}finally{try{n&&!n.done&&(c=i.return)&&c.call(i)}finally{if(s)throw s.error}}return this._localStream&&(null===(t=this._localStream.observer)||void 0===t||t.setLogin(!1)),[4,this._mediaServerClient.leave()];case 2:return u.sent(),this.destroy(),hL.rtcLeaveRoom(0,"",bD()-r),[3,4];case 3:if(a=u.sent(),e)throw a;return this.destroy(),a instanceof Error&&hL.rtcLeaveRoom(-1,a.message,bD()-r),[3,4];case 4:return[2]}}))}))},t.prototype.destroy=function(){var e,t,r,i;QV.print("destroy","Invoke destroy"),this._destroyAndInitMediaServerClient(),this._roomInfo=void 0,this._remoteUsers=new Map;try{for(var n=rv(this._remoteStreams),o=n.next();!o.done;o=n.next()){var a=iv(o.value,2)[1];Array.isArray(a)&&a.forEach((function(e){e&&e.clean()}))}}catch(t){e={error:t}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._remoteStreams=new Map,this._localStream&&(null===(r=this._localStream)||void 0===r||r.clean(),this._localStream=void 0),this._localScreenStream&&(null===(i=this._localScreenStream)||void 0===i||i.clean(),this._localScreenStream=void 0),this._removeHandlerEventHandler(),this._userDuplicateLoginTimerMap.forEach((function(e){clearTimeout(e)})),this._userDuplicateLoginTimerMap.clear()},t.prototype.updateToken=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return QV.print("updateToken","Invoke updateToken"),this._roomInfo&&(this._roomInfo.token=e),[4,this._mediaServerClient.updateToken(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.muteLocalTrack=function(e,t){var r,i,n,o,a,s;return ev(this,void 0,void 0,(function(){var c,u;return tv(this,(function(d){switch(d.label){case 0:return this._localStream&&(null===(r=this._localStream)||void 0===r?void 0:r.hasPublished)?(c=t!==gP.MUTE_STATE_OFF,u=this._localStream.switchTrackEnableState(e,c),"audio"===e?null===(n=null===(i=this.localStream)||void 0===i?void 0:i.observer)||void 0===n||n.setUnmuteAudio(c):null===(a=null===(o=this.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setUnmuteVideo(c),u?[4,null===(s=this._mediaServerClient)||void 0===s?void 0:s.updatePubTrack(this._localStream)]:[3,2]):[2,!1];case 1:d.sent(),d.label=2;case 2:return[2,u]}}))}))},t.prototype.pauseAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,r,i,n,o,a,s=this;return tv(this,(function(c){t=[];try{for(r=rv(this._remoteStreams.values()),i=r.next();!i.done;i=r.next())n=i.value,Array.isArray(n)&&n.forEach((function(r){if(r.hasSubscribed){var i=null;switch(e){case RP.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===OP.AUDIO_ONLY?i=OP.NONE:r.subMediaType===OP.AUDIO_AND_VIDEO&&(i=OP.VIDEO_ONLY);break;case RP.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===OP.VIDEO_ONLY?i=OP.NONE:r.subMediaType===OP.AUDIO_AND_VIDEO&&(i=OP.AUDIO_ONLY);break;case RP.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==OP.NONE&&(i=OP.NONE)}if(null!==i){var n=s.updateSubTrack(r,i,r.subConfig);n&&t.push(n)}}}))}catch(e){o={error:e}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.resumeAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,r,i,n,o,a,s=this;return tv(this,(function(c){t=[];try{for(r=rv(this._remoteStreams.values()),i=r.next();!i.done;i=r.next())n=i.value,Array.isArray(n)&&n.forEach((function(r){if(r.hasSubscribed){var i=null;switch(e){case RP.RTC_PAUSE_RESUME_CONTROL_AUDIO:r.subMediaType===OP.NONE?i=OP.AUDIO_ONLY:r.subMediaType===OP.VIDEO_ONLY&&(i=OP.AUDIO_AND_VIDEO);break;case RP.RTC_PAUSE_RESUME_CONTROL_VIDEO:r.subMediaType===OP.NONE?i=OP.VIDEO_ONLY:r.subMediaType===OP.AUDIO_ONLY&&(i=OP.AUDIO_AND_VIDEO);break;case RP.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO:r.subMediaType!==OP.AUDIO_AND_VIDEO&&(i=OP.AUDIO_AND_VIDEO)}if(null!==i){var n=s.updateSubTrack(r,i,r.subConfig);n&&t.push(n)}}}))}catch(e){o={error:e}}finally{try{i&&!i.done&&(a=r.return)&&a.call(r)}finally{if(o)throw o.error}}return[2,Promise.all(t)]}))}))},t.prototype.sendUserMessage=function(e,t){var r;return null===(r=this._mediaServerClient)||void 0===r?void 0:r.sendUserMessage(e,t)},t.prototype.setSessionId=function(){this._sessionId=SD(),_L.setStats({rtc_session_id:this._sessionId})},t.prototype.sendRoomMessage=function(e,t){var r,i;return void 0===t&&(t=!1),ev(this,void 0,void 0,(function(){var n,o;return tv(this,(function(a){switch(a.label){case 0:return n={clientId:null===(r=this._roomInfo)||void 0===r?void 0:r.userInfo.userId,binary:t,message:""},t?(o=n,[4,RD.ab2b64str(e)]):[3,2];case 1:return o.message=a.sent(),[3,3];case 2:n.message=e,a.label=3;case 3:return[2,null===(i=this._mediaServerClient)||void 0===i?void 0:i.sendRoomMessage(n)]}}))}))},t.prototype._destroyAndInitMediaServerClient=function(){QV.print("_destroyAndInitMediaServerClient()"),this._mediaServerClient&&(this._mediaServerClient.destroy(),this._removeHandlerEventHandler()),this._mediaServerClient=new VV,this._addHandlerEventHandler()},t.prototype._onJoinSucc=function(e,t){var r,i,n,o,a,s=this;QV.print("JoinSuccess()");var c=[],u=[],d=[],l=[];null===(a=e.clientsDetail)||void 0===a||a.forEach((function(t){if(t.clientId!==e.clientId){var r=s._remoteUsers.get(t.clientId);r?r._stillExist=!0:c.push(t)}}));try{for(var h=rv(this._remoteUsers.values()),p=h.next();!p.done;p=h.next()){var f=p.value;f._stillExist||u.push({clientId:f.userId}),delete f._stillExist}}catch(e){r={error:e}}finally{try{p&&!p.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}e.streams.forEach((function(e){var t=s._findRemoteStreamByScreen(e.clientId,e.screen);t?(t.stillExist=!0,t.streamId=e.streamId):l.push(e)}));try{for(var _=rv(this._remoteStreams.values()),v=_.next();!v.done;v=_.next()){var m=v.value;Array.isArray(m)&&m.forEach((function(e){e.stillExist?delete e.stillExist:d.push({clientId:e.userId,streamId:e.streamId,message:eL.clientDisconnected})}))}}catch(e){n={error:e}}finally{try{v&&!v.done&&(o=_.return)&&o.call(_)}finally{if(n)throw n.error}}setTimeout((function(){u.forEach((function(e){return s._onUserDisconnection(e)})),c.forEach((function(e){return s._onUserConnection(e)})),d.forEach((function(e){return s._onRemoveStream(e)})),l.forEach((function(e){return s._onAddStream(e,!0,!1)})),t&&s._handleSendOrRecvStreamAfterReconnect()}))},t.prototype._handleSendOrRecvStreamAfterReconnect=function(){var e,t,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){})));try{for(var i=rv(this._remoteStreams.values()),n=i.next();!n.done;n=i.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return ev(r,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:if(!e.hasSubscribed)return[3,4];e.resetHasSubscribed(),r.label=1;case 1:return r.trys.push([1,3,,4]),QV.print("start resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),[4,this._mediaServerClient.subscribe(e,e.subMediaType,e.subConfig)];case 2:return r.sent(),QV.print("success resubscribe ".concat(e.userId," with ").concat(e.subMediaType)),this.safeEmit(HV.RESUBSCRIBE,{stream:e}),[3,4];case 3:return t=r.sent(),QV.print("failed resubscribe ".concat(e.userId," with ").concat(e.subMediaType,", error:").concat(t)),e.clean(),null==e||e.resetHasSubscribed(),[3,4];case 4:return[2]}}))}))}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}},t.prototype._findRemoteStream=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.streamId===t})):null},t.prototype._findRemoteStreamByScreen=function(e,t){var r=this._remoteStreams.get(e);return Array.isArray(r)?r.find((function(e){return e.isScreen===t})):null},t.prototype._onAddStream=function(e,t,r){var i,n,o,a,s,c,u,d,l,h,p,f;if(void 0===t&&(t=!0),void 0===r&&(r=!0),e.clientId!==(null===(i=this._roomInfo)||void 0===i?void 0:i.userInfo.userId)){var _=this._findRemoteStream(e.clientId,e.streamId);if(!_){_=new JV(e.clientId,e.streamId,e.screen,e.attributes),this._initStreamListeners(_);var v=this._remoteStreams.get(e.clientId);v?v.push(_):this._remoteStreams.set(e.clientId,[_])}if(this._mediaServerClient.handler&&(_.observer=new ZV(_,this._mediaServerClient.handler)),!_.isScreen&&(r&&_.hasVideo&&(_.attributes.extvideo?(null===(n=_.observer)||void 0===n||n.setExternalVideoSource(!0),null===(o=_.observer)||void 0===o||o.setPushVideo(!0)):(null===(a=_.observer)||void 0===a||a.setExternalVideoSource(!1),null===(s=_.observer)||void 0===s||s.setPublishVideo(!0))),r&&_.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(_.attributes.extaudio?(null===(c=_.observer)||void 0===c||c.setExternalAudioSource(!0),null===(u=_.observer)||void 0===u||u.setPushAudio(!0)):(null===(d=_.observer)||void 0===d||d.setExternalAudioSource(!1),null===(l=_.observer)||void 0===l||l.setPublishAudio(!0))),!0===t&&!1===r)){var m=this._roomConfig,S=m.isAutoSubscribeAudio,E=m.isAutoSubscribeVideo;null===(h=_.observer)||void 0===h||h.setLogin(!0,{audio:S,video:E})}return t&&this.safeEmit(tL.ON_ADD_STREAM,{stream:_}),!_.isScreen&&(null===(p=null==e?void 0:e.attributes)||void 0===p?void 0:p.localvideo)&&this.safeEmit(HV.ON_USER_START_VIDEO_CAPTURE,{userId:_.userId}),!_.isScreen&&(null===(f=null==e?void 0:e.attributes)||void 0===f?void 0:f.localaudio)&&this.safeEmit(HV.ON_USER_START_AUDIO_CAPTURE,{userId:_.userId}),_}},t.prototype._onUserConnection=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 i={userId:e.clientId,extraInfo:e.attributes.extra_info};this._remoteUsers.set(e.clientId,$_({},i)),this.safeEmit(tL.USER_CONNECTION,{userInfo:i})}},t.prototype._onUserDisconnection=function(e){var t,r=this,i=e.clientId,n=e.tag,o=e.code;if(i)if(i===(null===(t=this.roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=null;n===nL.kickedByAdmin?a=ZN.KICKED_OUT:n===nL.onUserTokenDidExpire?a=ZN.TOKEN_EXPIRED:n===nL.userDuplicateLogin&&(a=ZN.DUPLICATE_LOGIN),o===oL.roomDismissByAdmin&&(a=ZN.ROOM_DISMISS),a&&this.safeEmit(HV.ON_ROOM_ERROR,{errorCode:a})}else{var s=SP.DROPPED;n===nL.userLeave?s=SP.QUIT:n===nL.kickedByAdmin?s=SP.KICKED_BY_ADMIN:n===nL.roleChanged&&(s=SP.SWITCH_TO_INVISIBLE);var c=function(){r._remoteUsers.delete(i);var e=r._remoteStreams.get(i);Array.isArray(e)&&e.length&&(e.forEach((function(e){r.safeEmit(tL.ON_REMOVE_STREAM,{stream:e,reason:"Client leave"})})),r._remoteStreams.delete(i)),r.safeEmit(HV.ON_USER_LEAVE,{userInfo:{userId:i},reason:s})};if(n===nL.userDuplicateLogin){var u=this._userDuplicateLoginTimerMap.get(i);null!=u||self.clearTimeout(u);var d=self.setTimeout(c,5e3);this._userDuplicateLoginTimerMap.set(i,d)}else c()}},t.prototype._onRemoveStream=function(e){var t,r,i,n,o=this;if(e.clientId!==(null===(t=this._roomInfo)||void 0===t?void 0:t.userInfo.userId)){var a=this._remoteStreams.get(e.clientId);if(a){var s=a.find((function(t){return t.streamId==e.streamId}));s&&(null===(r=this._mediaServerClient)||void 0===r||r.handleRemoveStream(s,e).then((function(){if(!(null==s?void 0:s._workaround_1_)){var t=o._remoteStreams.get(e.clientId);if(!t)return;t=t.filter((function(t){return t.streamId!==e.streamId})),o._remoteStreams.set(e.clientId,t)}})),this.safeEmit(tL.ON_REMOVE_STREAM,{stream:s,reason:e.message}),s.hasVideo&&(null===(i=s.observer)||void 0===i||i.setPublishVideo(!1)),s.hasAudio&&!this._mediaServerClient.roomAttributes.multiChatMode&&(null===(n=s.observer)||void 0===n||n.setPublishAudio(!1)))}}},t.prototype._onUpdateRoomAttributes=function(e){e.roomAttributes&&(this._mediaServerClient.roomAttributes=e.roomAttributes)},t.prototype._onUpdateStreamAttributes=function(e){var t,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E=e.clientId,y=e.streamId,g=e.attributes,b=this._findRemoteStream(E,y);if(b){var T=b.attributes,I=$_($_({},T),g),R=!1,A=I.localaudio!==T.localaudio,C=!1,O=!1,N=I.localvideo!==T.localvideo,w=!1;I.audiostream!==T.audiostream&&(R=!0,C=!!I.audiostream,I.audiostream?this.safeEmit(HV.ON_USER_MUTE_AUDIO,{userInfo:{userId:E},muteState:gP.MUTE_STATE_ON}):this.safeEmit(HV.ON_USER_MUTE_AUDIO,{userInfo:{userId:E},muteState:gP.MUTE_STATE_OFF})),I.videostream!==T.videostream&&(O=!0,w=!!I.videostream,I.videostream?this.safeEmit(HV.ON_USER_MUTE_VIDEO,{userInfo:{userId:E},muteState:gP.MUTE_STATE_ON}):this.safeEmit(HV.ON_USER_MUTE_VIDEO,{userInfo:{userId:E},muteState:gP.MUTE_STATE_OFF})),I.localaudio!==T.localaudio&&(I.localaudio?(I.extaudio?(null===(t=b.observer)||void 0===t||t.setExternalAudioSource(!0),null===(r=b.observer)||void 0===r||r.setPushAudio(!0)):(null===(i=b.observer)||void 0===i||i.setExternalAudioSource(!1),null===(n=b.observer)||void 0===n||n.setEnableAudio(!0)),this.safeEmit(HV.ON_USER_START_AUDIO_CAPTURE,{userId:E})):(I.extaudio?(null===(o=b.observer)||void 0===o||o.setExternalAudioSource(!0),null===(a=b.observer)||void 0===a||a.setPushAudio(!1)):(null===(s=b.observer)||void 0===s||s.setExternalAudioSource(!1),null===(c=b.observer)||void 0===c||c.setEnableAudio(!1)),this.safeEmit(HV.ON_USER_STOP_AUDIO_CAPTURE,{userId:E}))),I.localvideo!==T.localvideo&&(I.localvideo?(I.extvideo?(null===(u=b.observer)||void 0===u||u.setExternalVideoSource(!0),null===(d=b.observer)||void 0===d||d.setPushVideo(!0)):(null===(l=b.observer)||void 0===l||l.setExternalVideoSource(!1),null===(h=b.observer)||void 0===h||h.setEnableVideo(!0)),this.safeEmit(HV.ON_USER_START_VIDEO_CAPTURE,{userId:E})):(I.extvideo?(null===(p=b.observer)||void 0===p||p.setExternalVideoSource(!0),null===(f=b.observer)||void 0===f||f.setPushVideo(!1)):(null===(_=b.observer)||void 0===_||_.setExternalVideoSource(!1),null===(v=b.observer)||void 0===v||v.setEnableVideo(!1)),this.safeEmit(HV.ON_USER_STOP_VIDEO_CAPTURE,{userId:E}))),R&&!A&&(null===(m=b.observer)||void 0===m||m.setRemoteUnmuteAudio(C)),O&&!N&&(null===(S=b.observer)||void 0===S||S.setRemoteUnmuteVideo(w)),b.attributes=I}},t.prototype._onPushTrack=function(e){var t=this,r=e.clientId,i=e.streamId,n=this._findRemoteStream(r,i);n||(n=this._onAddStream(e,!1,!1)),this._mediaServerClient.subscribe4pushTrack(n,e).then((function(){return t.safeEmit(HV.SUBSCRIBE_PUSH_TRACK,{stream:n})})).catch((function(e){QV.print("subscribe push track failed: ".concat(e))}))},t.prototype._onRemoveTrack=function(e){var t=this,r=e.clientId,i=e.streamId,n=e.message,o=this._findRemoteStream(r,i);o&&this._mediaServerClient.unsubscribe4removeTrack(o,n).then((function(){var e;if(o._workaround_1_){var n=null===(e=t._remoteStreams.get(r))||void 0===e?void 0:e.filter((function(e){return e.streamId!==i}));t._remoteStreams.set(r,n||[])}t.safeEmit(HV.REMOVE_PUSH_TRACK,{stream:o})})).catch((function(e){QV.print("remove push track failed: ".concat(e))}))},t.prototype._nodeChange=function(e){var t,r=e.nodes,i=e.reason;wL.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=i,hL.rtcNodeChange(0,JSON.stringify(e),JSON.stringify(i)),this._joinResolveCallback&&this._joinRejectCallback?this._join(this._joinResolveCallback,this._joinRejectCallback):this._reconnect()},t.prototype._reconnect=function(){var e,t,r=this;this._isReconnecting=!0;try{for(var i=rv(this._remoteStreams.values()),n=i.next();!n.done;n=i.next()){var o=n.value;Array.isArray(o)&&o.forEach((function(e){return e.clean()}))}}catch(t){e={error:t}}finally{try{n&&!n.done&&(t=i.return)&&t.call(i)}finally{if(e)throw e.error}}hL.rtcReconnect(1002,hU.PEERCONNECTION_RECONNECTING,this._roomInfo.userInfo.userId,pU.PEERCONNECTION),this._join((function(){hL.rtcReconnected(fU.PEERCONNECTION_RECONNECTED,_U.PEERCONNECTION)}),(function(e){QV.print("Reconnecting error, will reconnect after 3s",e),r._reconnectTimer=setTimeout(r._reconnect.bind(r),3e3)}),!0)},t.prototype._handleAbnormalDisconnection=function(){QV.print("on ABNORMAL_DISCONNECTION"),this._destroyAndInitMediaServerClient(),navigator.onLine?this._reconnect():this._reconnectTimer=setTimeout(this._reconnect.bind(this),3e3)},t.prototype._onConnectionStateChange=function(e){var t;if(e.next===MV.DISCONNECTED)t=wP.CONNECTION_STATE_DISCONNECTED;else if(e.next===MV.CONNECTED)t=this._isReconnecting?wP.CONNECTION_STATE_RECONNECTED:wP.CONNECTION_STATE_CONNECTED;else{if(e.next!==MV.CONNECTING)return;t=this._isReconnecting?wP.CONNECTION_STATE_RECONNECTING:wP.CONNECTION_STATE_CONNECTING}this.safeEmit(iL.ON_CONNECTION_STATE_CHANGE,{state:t})},t.prototype._initStreamListeners=function(e){var t=this;e.on("ontrack",(function(e){e.track})),e.on("onSEIMessage",(function(r){var i;t.emit(HV.ON_SEI_MESSAGED_RECEIVED,{sei:r,remoteStreamKey:{userId:e.userId,roomId:null===(i=t._roomInfo)||void 0===i?void 0:i.roomId,streamIndex:e.isScreen?CP.STREAM_INDEX_SCREEN:CP.STREAM_INDEX_MAIN}})}))},t.prototype._onCustomMessage=function(e){this.safeEmit(tL.ON_CUSTOM_MESSAGE,e)},t.prototype._onUserMessageReceived=function(e){this.safeEmit(tL.USER_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(tL.USER_BINARY_MESSAGE_RECEIVED,{userId:e.from,message:e.msg})},t.prototype._onPostProcessingMessage=function(e){var t,r=(null===(t=e.body)||void 0===t?void 0:t.error)||0;this.safeEmit(tL.POST_PROCESSING_MESSAGE,{code:r,message:["success","parameter error","subscription timeout","ffmpeg error","cdn error","publish error"][r],type:e.type})},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(tL.ON_USER_TOKEN_WILL_EXPIRE,null)},t.prototype._onPublishOnDemand=function(e){var t,r,i,n;if((null===(t=this._localStream)||void 0===t?void 0:t.enableSimulcast)&&(null===(r=this._localStream)||void 0===r?void 0:r.videoTransceiver)){var o=null===(i=this._localStream)||void 0===i?void 0:i.stream.id,a=null===(n=this._localStream)||void 0===n?void 0:n.videoTransceiver.sender,s=a.getParameters();if(Array.isArray(s.encodings)&&Array.isArray(e)){var c={};QV.print("_onPublishOnDemand","usedDescriptions: %o",e),e.forEach((function(e){var t;if(null===(t=null==e?void 0:e.StreamIds)||void 0===t?void 0:t.includes(o)){var r=null==e?void 0:e.Metadata.SubvideoIndex;c[r]=r}})),s.encodings=s.encodings.map((function(e){return e.rid&&(c[e.rid]===+e.rid?e.active=!0:e.active=!1),e}))}a.setParameters(s)}},t}($D),tF=function(e,t){void 0===t&&(t={});var r=document.createElement(e);return t.id&&(r.id=t.id),t.classList&&t.classList.forEach((function(e){r.classList.add(e)})),t.style&&Object.assign(r.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(e){var t=iv(e,2),i=t[0],n=t[1];"muted"===i?r.muted=!0:r.setAttribute(i,n)})),r},rF=function(e,t){return void 0===t&&(t={}),t.id&&(e.id=t.id),t.classList&&t.classList.forEach((function(t){e.classList.add(t)})),t.style&&Object.assign(e.style,t.style),t.attributes&&Object.entries(t.attributes).forEach((function(t){var r=iv(t,2),i=r[0],n=r[1];e.setAttribute(i,n)})),e},iF=new qD("Player",0),nF=["play","playing","pause","ended","error","seeking","seeked","waiting","canplay","canplaythrough","durationchange","volumechange","loadedmetadata","loadeddata","loadstart","timeupdate"],oF={playsinline:"","webkit-playsinline":""},aF={playsinline:"","webkit-playsinline":"","x5-playsinline":"","x5-video-player-type":"h5","x-webkit-airplay":"allow",preload:"",muted:""},sF=new(function(){function e(){this.videoCache=[],this.audioCache=[]}return e.prototype.getOrCreate=function(e,t){var r="audio"===e?oF:aF;if("video"===e&&this.videoCache.length>0){if(i=this.videoCache.pop())return rF(i,{style:t,attributes:r}),i}else if("audio"===e&&this.audioCache.length>0){var i;if(i=this.audioCache.pop())return rF(i,{style:t,attributes:r}),i}return tF(e,{style:t,attributes:r})},e.prototype.recycle=function(e){for(;e.attributes.length>0;)e.removeAttribute(e.attributes[0].name);e instanceof HTMLVideoElement?this.videoCache.push(e):this.audioCache.push(e)},e}()),cF=function(e){function t(t){var r=e.call(this)||this;r.mirrorType=DP.MIRROR_TYPE_NONE,r.emitVideoEvent=function(e){var t,i,n={type:"video",rawEvent:e,readyState:(null===(t=r._videoDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:e.type,currentTime:(null===(i=r._videoDom)||void 0===i?void 0:i.currentTime)||0,isScreen:r.isScreen};r.emit("playback_event",n)},r._internalPlay=function(){var e;if(null===(e=r._videoDom)||void 0===e?void 0:e.paused){var t=r._videoDom.play();(null==t?void 0:t.then)&&t.catch((function(e){var t,i;hL.rtcError("video autoplay failed, userId: ".concat(r.userId),-1e3),r.emit("playback_event",{type:"video",rawEvent:e,readyState:(null===(t=r._videoDom)||void 0===t?void 0:t.readyState)||0,userId:r.userId,eventName:"autoplay-error",currentTime:(null===(i=r._videoDom)||void 0===i?void 0:i.currentTime)||0})}))}};var i=t.renderDom,n=t.userId;r.renderMode=void 0!==t.renderMode?t.renderMode:AP.RENDER_MODE_FIT;var o="string"==typeof i?document.getElementById(i):i;if(!o)throw new tw(ZN.CANT_FIND_DOM,"can't find dom");return r._containerDom=o,r.userId=n,r.isScreen=!!t.isScreen,r._initVideo(),r}return Z_(t,e),t.prototype._initVideo=function(){this._videoDom||(this._videoDom=sF.getOrCreate("video",{width:"100%",height:"100%",background:"black"}),this._videoDom.id="".concat(this.userId,"_").concat(gD()),this.renderMode===AP.RENDER_MODE_FIT?this._videoDom.style.objectFit="contain":this._videoDom.style.objectFit="cover",this.mirror(this.mirrorType===DP.MIRROR_TYPE_RENDER)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._videoDom&&nF.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._videoDom&&(nF.forEach((function(t){var r;null===(r=e._videoDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._videoDom.addEventListener("canplay",this._internalPlay),this._videoDom.addEventListener("loadeddata",this._internalPlay))},t.prototype._recordFrame=function(e){var t=this;this.on("playback_event",(function(r){var i;if("timeupdate"===r.eventName){var n=e.isScreen?1.5:.5;if(void 0===t.__cumulativeTime&&(t.__cumulativeTime=0),0===(null===(i=t._videoDom)||void 0===i?void 0:i.currentTime))return;if(e.recordedVideoFrames||(e.recordedVideoFrames=[]),t._videoDom.currentTime>t.__cumulativeTime){var o=Math.floor(1e3*(t._videoDom.currentTime-t.__cumulativeTime)),a=t._videoDom.currentTime-t.__cumulativeTime>n;e.recordedVideoFrames.push({playTime:t._videoDom.currentTime,isStall:a,stallCount:a?1:0,stallDuration:o%2e3})}t.__cumulativeTime=t._videoDom.currentTime}}))},t.prototype.playVideo=function(e,t){var r;return ev(this,void 0,void 0,(function(){var i,n,o=this;return tv(this,(function(a){return i=this._videoDom,iF.print("playVideo","play video track: ".concat(this.userId)),i&&i.srcObject instanceof MediaStream&&i.srcObject.getTrackById(null===(r=e.getTrack())||void 0===r?void 0:r.id)||(i||(this._initVideo(),i=this._videoDom),iF.print("playVideo","play video by dom: ".concat(null==i?void 0:i.id)),(n=new MediaStream).addTrack(e.getTrack()),i.srcObject=n,this._containerDom.appendChild(i),i.addEventListener("canplay",this._internalPlay),i.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return o._internalPlay()})),t&&this._recordFrame(t)),[2]}))}))},t.prototype.updateSrcObject=function(e){var t=e.getTrack();if(t&&this._videoDom){var r=new MediaStream;r.addTrack(t),this._videoDom.srcObject=r}},t.prototype.manuallyPlay=function(){if(iF.print("Invoke AudioPlayer.manuallyPlay"),!this._videoDom)throw new tw(ZN.INVALID_PARAMS,"Player not found");var e=this._videoDom.play();return(null==e?void 0:e.then)?e:Promise.resolve(e)},t.prototype.mirror=function(e){iF.print("mirror","".concat(this.userId," set mirror: ").concat(e)),this.mirrorType=e?DP.MIRROR_TYPE_RENDER:DP.MIRROR_TYPE_NONE,this._videoDom&&(this._videoDom.style.transform=e?"rotateY(180deg)":"")},t.prototype.stop=function(){var e=this._containerDom;iF.print("stop","stop video track: ".concat(this.userId)),this._videoDom&&(this._videoDom.srcObject=null,e&&e.contains(this._videoDom)&&e.removeChild(this._videoDom)),this.__cumulativeTime=void 0},t.prototype.destroy=function(){iF.print("destroy","video player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._videoDom&&(sF.recycle(this._videoDom),delete this._videoDom)},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._videoDom},enumerable:!1,configurable:!0}),t}(XD.exports.EventEmitter),uF=function(e){function t(t,r){var i=e.call(this)||this;if(i.emitVideoEvent=function(e){var t,r,n={type:"audio",rawEvent:e,readyState:(null===(t=i._audioDom)||void 0===t?void 0:t.readyState)||0,userId:i.userId,eventName:e.type,currentTime:(null===(r=i._audioDom)||void 0===r?void 0:r.currentTime)||0};i.emit("playback_event",n)},i._internalPlay=function(){var e,t;if(gL("_internalPlay",{paused:null===(e=i._audioDom)||void 0===e?void 0:e.paused}),null===(t=i._audioDom)||void 0===t?void 0:t.paused)try{var r=i._audioDom.play();(null==r?void 0:r.then)&&r.catch((function(e){i._autoPlayError(e)})).then((function(){gL("_internalPlay successfully",{userId:i.userId})}))}catch(e){i._autoPlayError(e)}},r){var n=document.getElementById(r);if(!n)throw new tw(ZN.CANT_FIND_DOM,"can't find dom");i._containerDom=n}else i._containerDom=document.body;return i.userId=t,i._initAudio(),i}return Z_(t,e),t.prototype._initAudio=function(){this._audioDom||(this._audioDom=sF.getOrCreate("audio",{display:"none"}),this._audioDom.id="".concat(this.userId,"_").concat(gD()),this._containerDom.appendChild(this._audioDom)),this._initListeners()},t.prototype._initListeners=function(){var e=this;this._audioDom&&nF.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.addEventListener(t,e.emitVideoEvent)}))},t.prototype._removeListeners=function(){var e=this;this._audioDom&&(nF.forEach((function(t){var r;null===(r=e._audioDom)||void 0===r||r.removeEventListener(t,e.emitVideoEvent)})),this._audioDom.removeEventListener("canplay",this._internalPlay),this._audioDom.removeEventListener("loadeddata",this._internalPlay))},t.prototype.playAudio=function(e){var t;return ev(this,void 0,void 0,(function(){var r,i,n=this;return tv(this,(function(o){return iF.print("playAudio","play audio track: ".concat(this.userId)),(r=this._audioDom)&&r.srcObject instanceof MediaStream&&r.srcObject.getTrackById(null===(t=e.getTrack())||void 0===t?void 0:t.id)||(r||(this._initAudio(),r=this._audioDom),(i=new MediaStream).addTrack(e.getTrack()),r.srcObject=i,null==r||r.addEventListener("canplay",this._internalPlay),null==r||r.addEventListener("loadeddata",this._internalPlay),setTimeout((function(){return n._internalPlay()}))),[2]}))}))},t.prototype._autoPlayError=function(e){var t,r;hL.rtcError("audio autoplay failed, userId: ".concat(this.userId,": ").concat(e.message),-1e3),this.emit("playback_event",{type:"audio",rawEvent:e,readyState:(null===(t=this._audioDom)||void 0===t?void 0:t.readyState)||0,userId:this.userId,eventName:"autoplay-error",currentTime:(null===(r=this._audioDom)||void 0===r?void 0:r.currentTime)||0})},t.prototype.manuallyPlay=function(){if(iF.print("Invoke AudioPlayer.manuallyPlay"),!this._audioDom)throw new tw(ZN.INVALID_PARAMS,"Player not found");var e=this._audioDom.play();return(null==e?void 0:e.then)?e:Promise.resolve(e)},t.prototype.setPlaybackDevice=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:return iF.print("setPlaybackDevice","setPlaybackDevice: ".concat(e)),[4,dV.getAudioPlayback()];case 1:return t=r.sent(),t.map((function(e){return e.deviceId})).includes(e)&&this._audioDom&&this._audioDom.setSinkId?[4,this._audioDom.setSinkId(e)]:[2];case 2:return r.sent(),[2]}}))}))},t.prototype.stop=function(){var e=this._containerDom;iF.print("stopAudio","stop audio track: ".concat(this.userId)),this._audioDom&&(this._audioDom.srcObject=null,e&&e.contains(this._audioDom)&&e.removeChild(this._audioDom))},Object.defineProperty(t.prototype,"domElement",{get:function(){return this._audioDom},enumerable:!1,configurable:!0}),t.prototype.destroy=function(){iF.print("destroy","audio player: ".concat(this.userId)),this.stop(),e.prototype.removeAllListeners.call(this),this._removeListeners(),this._audioDom&&(sF.recycle(this._audioDom),delete this._audioDom)},t}(XD.exports.EventEmitter),dF="object"==("undefined"==typeof global?"undefined":us(global))&&global&&global.Object===Object&&global,lF="object"==("undefined"==typeof self?"undefined":us(self))&&self&&self.Object===Object&&self,hF=dF||lF||Function("return this")(),pF=hF.Symbol,fF=Object.prototype,_F=fF.hasOwnProperty,vF=fF.toString,mF=pF?pF.toStringTag:void 0;var SF=Object.prototype.toString;var EF=pF?pF.toStringTag:void 0;function yF(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":EF&&EF in Object(e)?function(e){var t=_F.call(e,mF),r=e[mF];try{e[mF]=void 0;var i=!0}catch(e){}var n=vF.call(e);return i&&(t?e[mF]=r:delete e[mF]),n}(e):function(e){return SF.call(e)}(e)}function gF(e){return null!=e&&"object"==us(e)}var bF=Array.isArray;function TF(e){var t=us(e);return null!=e&&("object"==t||"function"==t)}function IF(e){return e}function RF(e){if(!TF(e))return!1;var t=yF(e);return"[object Function]"==t||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t}var AF=hF["__core-js_shared__"],CF=function(){var e=/[^.]+$/.exec(AF&&AF.keys&&AF.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();var OF=Function.prototype.toString;var NF=/^\[object .+?Constructor\]$/,wF=Function.prototype,DF=Object.prototype,PF=wF.toString,kF=DF.hasOwnProperty,MF=RegExp("^"+PF.call(kF).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function UF(e){return!(!TF(e)||(t=e,CF&&CF in t))&&(RF(e)?MF:NF).test(function(e){if(null!=e){try{return OF.call(e)}catch(e){}try{return e+""}catch(e){}}return""}(e));var t}function LF(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 xF=Date.now;var VF,FF,BF,jF=function(){try{var e=function(e,t){var r=function(e,t){return null==e?void 0:e[t]}(e,t);return UF(r)?r:void 0}(Object,"defineProperty");return e({},"",{}),e}catch(e){}}(),GF=jF,HF=GF?function(e,t){return GF(e,"toString",{configurable:!0,enumerable:!1,value:(r=t,function(){return r}),writable:!0});var r}:IF,zF=(VF=HF,FF=0,BF=0,function(){var e=xF(),t=16-(e-BF);if(BF=e,t>0){if(++FF>=800)return arguments[0]}else FF=0;return VF.apply(void 0,arguments)}),KF=/^(?:0|[1-9]\d*)$/;function YF(e,t){var r=us(e);return!!(t=null==t?9007199254740991:t)&&("number"==r||"symbol"!=r&&KF.test(e))&&e>-1&&e%1==0&&e<t}function XF(e,t,r){"__proto__"==t&&GF?GF(e,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):e[t]=r}function WF(e,t){return e===t||e!=e&&t!=t}var JF=Object.prototype.hasOwnProperty;function qF(e,t,r){var i=e[t];JF.call(e,t)&&WF(i,r)&&(void 0!==r||t in e)||XF(e,t,r)}var ZF=Math.max;function $F(e,t){return zF(function(e,t,r){return t=ZF(void 0===t?e.length-1:t,0),function(){for(var i=arguments,n=-1,o=ZF(i.length-t,0),a=Array(o);++n<o;)a[n]=i[t+n];n=-1;for(var s=Array(t+1);++n<t;)s[n]=i[n];return s[t]=r(a),LF(e,this,s)}}(e,t,IF),e+"")}function QF(e){return"number"==typeof e&&e>-1&&e%1==0&&e<=9007199254740991}function eB(e){return null!=e&&QF(e.length)&&!RF(e)}var tB=Object.prototype;function rB(e){var t=e&&e.constructor;return e===("function"==typeof t&&t.prototype||tB)}function iB(e){return gF(e)&&"[object Arguments]"==yF(e)}var nB=Object.prototype,oB=nB.hasOwnProperty,aB=nB.propertyIsEnumerable,sB=iB(function(){return arguments}())?iB:function(e){return gF(e)&&oB.call(e,"callee")&&!aB.call(e,"callee")};var cB="object"==("undefined"==typeof exports?"undefined":us(exports))&&exports&&!exports.nodeType&&exports,uB=cB&&"object"==("undefined"==typeof module?"undefined":us(module))&&module&&!module.nodeType&&module,dB=uB&&uB.exports===cB?hF.Buffer:void 0,lB=(dB?dB.isBuffer:void 0)||function(){return!1},hB={};hB["[object Float32Array]"]=hB["[object Float64Array]"]=hB["[object Int8Array]"]=hB["[object Int16Array]"]=hB["[object Int32Array]"]=hB["[object Uint8Array]"]=hB["[object Uint8ClampedArray]"]=hB["[object Uint16Array]"]=hB["[object Uint32Array]"]=!0,hB["[object Arguments]"]=hB["[object Array]"]=hB["[object ArrayBuffer]"]=hB["[object Boolean]"]=hB["[object DataView]"]=hB["[object Date]"]=hB["[object Error]"]=hB["[object Function]"]=hB["[object Map]"]=hB["[object Number]"]=hB["[object Object]"]=hB["[object RegExp]"]=hB["[object Set]"]=hB["[object String]"]=hB["[object WeakMap]"]=!1;var pB="object"==("undefined"==typeof exports?"undefined":us(exports))&&exports&&!exports.nodeType&&exports,fB=pB&&"object"==("undefined"==typeof module?"undefined":us(module))&&module&&!module.nodeType&&module,_B=fB&&fB.exports===pB&&dF.process,vB=function(){try{var e=fB&&fB.require&&fB.require("util").types;return e||_B&&_B.binding&&_B.binding("util")}catch(e){}}(),mB=vB&&vB.isTypedArray,SB=mB?function(e){return function(t){return e(t)}}(mB):function(e){return gF(e)&&QF(e.length)&&!!hB[yF(e)]},EB=SB,yB=Object.prototype.hasOwnProperty;function gB(e,t){var r=bF(e),i=!r&&sB(e),n=!r&&!i&&lB(e),o=!r&&!i&&!n&&EB(e),a=r||i||n||o,s=a?function(e,t){for(var r=-1,i=Array(e);++r<e;)i[r]=t(r);return i}(e.length,String):[],c=s.length;for(var u in e)!t&&!yB.call(e,u)||a&&("length"==u||n&&("offset"==u||"parent"==u)||o&&("buffer"==u||"byteLength"==u||"byteOffset"==u)||YF(u,c))||s.push(u);return s}var bB=function(e,t){return function(r){return e(t(r))}}(Object.keys,Object),TB=bB,IB=Object.prototype.hasOwnProperty;function RB(e){return eB(e)?gB(e):function(e){if(!rB(e))return TB(e);var t=[];for(var r in Object(e))IB.call(e,r)&&"constructor"!=r&&t.push(r);return t}(e)}var AB=Object.prototype.hasOwnProperty;function CB(e){if(!TF(e))return function(e){var t=[];if(null!=e)for(var r in Object(e))t.push(r);return t}(e);var t=rB(e),r=[];for(var i in e)("constructor"!=i||!t&&AB.call(e,i))&&r.push(i);return r}var OB,NB=(OB=function(e,t){!function(e,t,r,i){var n=!r;r||(r={});for(var o=-1,a=t.length;++o<a;){var s=t[o],c=i?i(r[s],e[s],s,r,e):void 0;void 0===c&&(c=e[s]),n?XF(r,s,c):qF(r,s,c)}}(t,function(e){return eB(e)?gB(e,!0):CB(e)}(t),e)},$F((function(e,t){var r=-1,i=t.length,n=i>1?t[i-1]:void 0,o=i>2?t[2]:void 0;for(n=OB.length>3&&"function"==typeof n?(i--,n):void 0,o&&function(e,t,r){if(!TF(r))return!1;var i=us(t);return!!("number"==i?eB(r)&&YF(t,r.length):"string"==i&&t in r)&&WF(r[t],e)}(t[0],t[1],o)&&(n=i<3?void 0:n,i=1),e=Object(e);++r<i;){var a=t[r];a&&OB(e,a,r,n)}return e}))),wB=NB;function DB(e,t){return function(e,t){for(var r=-1,i=null==e?0:e.length,n=Array(i);++r<i;)n[r]=t(e[r],r,e);return n}(t,(function(t){return e[t]}))}function PB(e){return null==e?[]:DB(e,RB(e))}var kB=o,MB=Ze("iterator"),UB=!kB((function(){var e=new URL("b?a=1&b=2&c=3","http://a"),t=e.searchParams,r="";return e.pathname="c%20d",t.forEach((function(e,i){t.delete("b"),r+=i+e})),!t.sort||"http://a/c%20d?a=1&c=3"!==e.href||"3"!==t.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!t[MB]||"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})),LB=T,xB=/[^\0-\u007E]/,VB=/[.\u3002\uFF0E\uFF61]/g,FB="Overflow: input needs wider integers to process",BB=i.RangeError,jB=LB(VB.exec),GB=Math.floor,HB=String.fromCharCode,zB=LB("".charCodeAt),KB=LB([].join),YB=LB([].push),XB=LB("".replace),WB=LB("".split),JB=LB("".toLowerCase),qB=function(e){return e+22+75*(e<26)},ZB=function(e,t,r){var i=0;for(e=r?GB(e/700):e>>1,e+=GB(e/t);e>455;)e=GB(e/35),i+=36;return GB(i+36*e/(e+38))},$B=function(e){var t=[];e=function(e){for(var t=[],r=0,i=e.length;r<i;){var n=zB(e,r++);if(n>=55296&&n<=56319&&r<i){var o=zB(e,r++);56320==(64512&o)?YB(t,((1023&n)<<10)+(1023&o)+65536):(YB(t,n),r--)}else YB(t,n)}return t}(e);var r,i,n=e.length,o=128,a=0,s=72;for(r=0;r<e.length;r++)(i=e[r])<128&&YB(t,HB(i));var c=t.length,u=c;for(c&&YB(t,"-");u<n;){var d=2147483647;for(r=0;r<e.length;r++)(i=e[r])>=o&&i<d&&(d=i);var l=u+1;if(d-o>GB((2147483647-a)/l))throw BB(FB);for(a+=(d-o)*l,o=d,r=0;r<e.length;r++){if((i=e[r])<o&&++a>2147483647)throw BB(FB);if(i==o){for(var h=a,p=36;;){var f=p<=s?1:p>=s+26?26:p-s;if(h<f)break;var _=h-f,v=36-f;YB(t,HB(qB(f+_%v))),h=GB(_/v),p+=36}YB(t,HB(qB(h))),s=ZB(a,l,u==c),a=0,u++}}a++,o++}return KB(t,"")},QB=Bi,ej=i,tj=K,rj=d,ij=T,nj=UB,oj=Ht.exports,aj=Ku,sj=vc,cj=pf,uj=br,dj=Qu,lj=F,hj=Ue,pj=zi,fj=rn,_j=Dt,vj=j,mj=qo,Sj=ko,Ej=m,yj=vd,gj=ud,bj=Qd,Tj=dT,Ij=Ze("iterator"),Rj=uj.set,Aj=uj.getterFor("URLSearchParams"),Cj=uj.getterFor("URLSearchParamsIterator"),Oj=tj("fetch"),Nj=tj("Request"),wj=tj("Headers"),Dj=Nj&&Nj.prototype,Pj=wj&&wj.prototype,kj=ej.RegExp,Mj=ej.TypeError,Uj=ej.decodeURIComponent,Lj=ej.encodeURIComponent,xj=ij("".charAt),Vj=ij([].join),Fj=ij([].push),Bj=ij("".replace),jj=ij([].shift),Gj=ij([].splice),Hj=ij("".split),zj=ij("".slice),Kj=/\+/g,Yj=Array(4),Xj=function(e){return Yj[e-1]||(Yj[e-1]=kj("((?:%[\\da-f]{2}){"+e+"})","gi"))},Wj=function(e){try{return Uj(e)}catch(t){return e}},Jj=function(e){var t=Bj(e,Kj," "),r=4;try{return Uj(t)}catch(e){for(;r;)t=Bj(t,Xj(r--),Wj);return t}},qj=/[!'()~]|%20/g,Zj={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},$j=function(e){return Zj[e]},Qj=function(e){return Bj(Lj(e),qj,$j)},eG=cj((function(e,t){Rj(this,{type:"URLSearchParamsIterator",iterator:yj(Aj(e).entries),kind:t})}),"Iterator",(function(){var e=Cj(this),t=e.kind,r=e.iterator.next(),i=r.value;return r.done||(r.value="keys"===t?i.key:"values"===t?i.value:[i.key,i.value]),r}),!0),tG=function(e){this.entries=[],this.url=null,void 0!==e&&(vj(e)?this.parseObject(e):this.parseQuery("string"==typeof e?"?"===xj(e,0)?zj(e,1):e:mj(e)))};tG.prototype={type:"URLSearchParams",bindURL:function(e){this.url=e,this.update()},parseObject:function(e){var t,r,i,n,o,a,s,c=gj(e);if(c)for(r=(t=yj(e,c)).next;!(i=rj(r,t)).done;){if(o=(n=yj(_j(i.value))).next,(a=rj(o,n)).done||(s=rj(o,n)).done||!rj(o,n).done)throw Mj("Expected sequence with length 2");Fj(this.entries,{key:mj(a.value),value:mj(s.value)})}else for(var u in e)hj(e,u)&&Fj(this.entries,{key:u,value:mj(e[u])})},parseQuery:function(e){if(e)for(var t,r,i=Hj(e,"&"),n=0;n<i.length;)(t=i[n++]).length&&(r=Hj(t,"="),Fj(this.entries,{key:Jj(jj(r)),value:Jj(Vj(r,"="))}))},serialize:function(){for(var e,t=this.entries,r=[],i=0;i<t.length;)e=t[i++],Fj(r,Qj(e.key)+"="+Qj(e.value));return Vj(r,"&")},update:function(){this.entries.length=0,this.parseQuery(this.url.query)},updateURL:function(){this.url&&this.url.update()}};var rG=function(){dj(this,iG);var e=arguments.length>0?arguments[0]:void 0;Rj(this,new tG(e))},iG=rG.prototype;if(aj(iG,{append:function(e,t){bj(arguments.length,2);var r=Aj(this);Fj(r.entries,{key:mj(e),value:mj(t)}),r.updateURL()},delete:function(e){bj(arguments.length,1);for(var t=Aj(this),r=t.entries,i=mj(e),n=0;n<r.length;)r[n].key===i?Gj(r,n,1):n++;t.updateURL()},get:function(e){bj(arguments.length,1);for(var t=Aj(this).entries,r=mj(e),i=0;i<t.length;i++)if(t[i].key===r)return t[i].value;return null},getAll:function(e){bj(arguments.length,1);for(var t=Aj(this).entries,r=mj(e),i=[],n=0;n<t.length;n++)t[n].key===r&&Fj(i,t[n].value);return i},has:function(e){bj(arguments.length,1);for(var t=Aj(this).entries,r=mj(e),i=0;i<t.length;)if(t[i++].key===r)return!0;return!1},set:function(e,t){bj(arguments.length,1);for(var r,i=Aj(this),n=i.entries,o=!1,a=mj(e),s=mj(t),c=0;c<n.length;c++)(r=n[c]).key===a&&(o?Gj(n,c--,1):(o=!0,r.value=s));o||Fj(n,{key:a,value:s}),i.updateURL()},sort:function(){var e=Aj(this);Tj(e.entries,(function(e,t){return e.key>t.key?1:-1})),e.updateURL()},forEach:function(e){for(var t,r=Aj(this).entries,i=pj(e,arguments.length>1?arguments[1]:void 0),n=0;n<r.length;)i((t=r[n++]).value,t.key,this)},keys:function(){return new eG(this,"keys")},values:function(){return new eG(this,"values")},entries:function(){return new eG(this,"entries")}},{enumerable:!0}),oj(iG,Ij,iG.entries,{name:"entries"}),oj(iG,"toString",(function(){return Aj(this).serialize()}),{enumerable:!0}),sj(rG,"URLSearchParams"),QB({global:!0,forced:!nj},{URLSearchParams:rG}),!nj&&lj(wj)){var nG=ij(Pj.has),oG=ij(Pj.set),aG=function(e){if(vj(e)){var t,r=e.body;if("URLSearchParams"===fj(r))return t=e.headers?new wj(e.headers):new wj,nG(t,"content-type")||oG(t,"content-type","application/x-www-form-urlencoded;charset=UTF-8"),Sj(e,{body:Ej(0,mj(r)),headers:Ej(0,t)})}return e};if(lj(Oj)&&QB({global:!0,enumerable:!0,forced:!0},{fetch:function(e){return Oj(e,arguments.length>1?aG(arguments[1]):{})}}),lj(Nj)){var sG=function(e){return dj(this,Dj),new Nj(e,arguments.length>1?aG(arguments[1]):{})};Dj.constructor=sG,sG.prototype=Dj,QB({global:!0,forced:!0},{Request:sG})}}var cG,uG={URLSearchParams:rG,getState:Aj},dG=Bi,lG=a,hG=UB,pG=i,fG=zi,_G=T,vG=uo.f,mG=Ht.exports,SG=Qu,EG=Ue,yG=ws,gG=Bw,bG=Qs,TG=Zf.codeAt,IG=function(e){var t,r,i=[],n=WB(XB(JB(e),VB,"."),".");for(t=0;t<n.length;t++)r=n[t],YB(i,jB(xB,r)?"xn--"+$B(r):r);return KB(i,".")},RG=qo,AG=vc,CG=Qd,OG=uG,NG=br,wG=NG.set,DG=NG.getterFor("URL"),PG=OG.URLSearchParams,kG=OG.getState,MG=pG.URL,UG=pG.TypeError,LG=pG.parseInt,xG=Math.floor,VG=Math.pow,FG=_G("".charAt),BG=_G(/./.exec),jG=_G([].join),GG=_G(1..toString),HG=_G([].pop),zG=_G([].push),KG=_G("".replace),YG=_G([].shift),XG=_G("".split),WG=_G("".slice),JG=_G("".toLowerCase),qG=_G([].unshift),ZG=/[a-z]/i,$G=/[\d+-.a-z]/i,QG=/\d/,eH=/^0x/i,tH=/^[0-7]+$/,rH=/^\d+$/,iH=/^[\da-f]+$/i,nH=/[\0\t\n\r #%/:<>?@[\\\]^|]/,oH=/[\0\t\n\r #/:<>?@[\\\]^|]/,aH=/^[\u0000-\u0020]+|[\u0000-\u0020]+$/g,sH=/[\t\n\r]/g,cH=function(e){var t,r,i,n;if("number"==typeof e){for(t=[],r=0;r<4;r++)qG(t,e%256),e=xG(e/256);return jG(t,".")}if("object"==typeof e){for(t="",i=function(e){for(var t=null,r=1,i=null,n=0,o=0;o<8;o++)0!==e[o]?(n>r&&(t=i,r=n),i=null,n=0):(null===i&&(i=o),++n);return n>r&&(t=i,r=n),t}(e),r=0;r<8;r++)n&&0===e[r]||(n&&(n=!1),i===r?(t+=r?":":"::",n=!0):(t+=GG(e[r],16),r<7&&(t+=":")));return"["+t+"]"}return e},uH={},dH=yG({},uH,{" ":1,'"':1,"<":1,">":1,"`":1}),lH=yG({},dH,{"#":1,"?":1,"{":1,"}":1}),hH=yG({},lH,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),pH=function(e,t){var r=TG(e,0);return r>32&&r<127&&!EG(t,e)?e:encodeURIComponent(e)},fH={ftp:21,file:null,http:80,https:443,ws:80,wss:443},_H=function(e,t){var r;return 2==e.length&&BG(ZG,FG(e,0))&&(":"==(r=FG(e,1))||!t&&"|"==r)},vH=function(e){var t;return e.length>1&&_H(WG(e,0,2))&&(2==e.length||"/"===(t=FG(e,2))||"\\"===t||"?"===t||"#"===t)},mH=function(e){return"."===e||"%2e"===JG(e)},SH={},EH={},yH={},gH={},bH={},TH={},IH={},RH={},AH={},CH={},OH={},NH={},wH={},DH={},PH={},kH={},MH={},UH={},LH={},xH={},VH={},FH=function(e,t,r){var i,n,o,a=RG(e);if(t){if(n=this.parse(a))throw UG(n);this.searchParams=null}else{if(void 0!==r&&(i=new FH(r,!0)),n=this.parse(a,null,i))throw UG(n);(o=kG(new PG)).bindURL(this),this.searchParams=o}};FH.prototype={type:"URL",parse:function(e,t,r){var i,n,o,a,s,c=this,u=t||SH,d=0,l="",h=!1,p=!1,f=!1;for(e=RG(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=KG(e,aH,"")),e=KG(e,sH,""),i=gG(e);d<=i.length;){switch(n=i[d],u){case SH:if(!n||!BG(ZG,n)){if(t)return"Invalid scheme";u=yH;continue}l+=JG(n),u=EH;break;case EH:if(n&&(BG($G,n)||"+"==n||"-"==n||"."==n))l+=JG(n);else{if(":"!=n){if(t)return"Invalid scheme";l="",u=yH,d=0;continue}if(t&&(c.isSpecial()!=EG(fH,l)||"file"==l&&(c.includesCredentials()||null!==c.port)||"file"==c.scheme&&!c.host))return;if(c.scheme=l,t)return void(c.isSpecial()&&fH[c.scheme]==c.port&&(c.port=null));l="","file"==c.scheme?u=DH:c.isSpecial()&&r&&r.scheme==c.scheme?u=gH:c.isSpecial()?u=RH:"/"==i[d+1]?(u=bH,d++):(c.cannotBeABaseURL=!0,zG(c.path,""),u=LH)}break;case yH:if(!r||r.cannotBeABaseURL&&"#"!=n)return"Invalid scheme";if(r.cannotBeABaseURL&&"#"==n){c.scheme=r.scheme,c.path=bG(r.path),c.query=r.query,c.fragment="",c.cannotBeABaseURL=!0,u=VH;break}u="file"==r.scheme?DH:TH;continue;case gH:if("/"!=n||"/"!=i[d+1]){u=TH;continue}u=AH,d++;break;case bH:if("/"==n){u=CH;break}u=UH;continue;case TH:if(c.scheme=r.scheme,n==cG)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=bG(r.path),c.query=r.query;else if("/"==n||"\\"==n&&c.isSpecial())u=IH;else if("?"==n)c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=bG(r.path),c.query="",u=xH;else{if("#"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=bG(r.path),c.path.length--,u=UH;continue}c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,c.path=bG(r.path),c.query=r.query,c.fragment="",u=VH}break;case IH:if(!c.isSpecial()||"/"!=n&&"\\"!=n){if("/"!=n){c.username=r.username,c.password=r.password,c.host=r.host,c.port=r.port,u=UH;continue}u=CH}else u=AH;break;case RH:if(u=AH,"/"!=n||"/"!=FG(l,d+1))continue;d++;break;case AH:if("/"!=n&&"\\"!=n){u=CH;continue}break;case CH:if("@"==n){h&&(l="%40"+l),h=!0,o=gG(l);for(var _=0;_<o.length;_++){var v=o[_];if(":"!=v||f){var m=pH(v,hH);f?c.password+=m:c.username+=m}else f=!0}l=""}else if(n==cG||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(h&&""==l)return"Invalid authority";d-=gG(l).length+1,l="",u=OH}else l+=n;break;case OH:case NH:if(t&&"file"==c.scheme){u=kH;continue}if(":"!=n||p){if(n==cG||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()){if(c.isSpecial()&&""==l)return"Invalid host";if(t&&""==l&&(c.includesCredentials()||null!==c.port))return;if(a=c.parseHost(l))return a;if(l="",u=MH,t)return;continue}"["==n?p=!0:"]"==n&&(p=!1),l+=n}else{if(""==l)return"Invalid host";if(a=c.parseHost(l))return a;if(l="",u=wH,t==NH)return}break;case wH:if(!BG(QG,n)){if(n==cG||"/"==n||"?"==n||"#"==n||"\\"==n&&c.isSpecial()||t){if(""!=l){var S=LG(l,10);if(S>65535)return"Invalid port";c.port=c.isSpecial()&&S===fH[c.scheme]?null:S,l=""}if(t)return;u=MH;continue}return"Invalid port"}l+=n;break;case DH:if(c.scheme="file","/"==n||"\\"==n)u=PH;else{if(!r||"file"!=r.scheme){u=UH;continue}if(n==cG)c.host=r.host,c.path=bG(r.path),c.query=r.query;else if("?"==n)c.host=r.host,c.path=bG(r.path),c.query="",u=xH;else{if("#"!=n){vH(jG(bG(i,d),""))||(c.host=r.host,c.path=bG(r.path),c.shortenPath()),u=UH;continue}c.host=r.host,c.path=bG(r.path),c.query=r.query,c.fragment="",u=VH}}break;case PH:if("/"==n||"\\"==n){u=kH;break}r&&"file"==r.scheme&&!vH(jG(bG(i,d),""))&&(_H(r.path[0],!0)?zG(c.path,r.path[0]):c.host=r.host),u=UH;continue;case kH:if(n==cG||"/"==n||"\\"==n||"?"==n||"#"==n){if(!t&&_H(l))u=UH;else if(""==l){if(c.host="",t)return;u=MH}else{if(a=c.parseHost(l))return a;if("localhost"==c.host&&(c.host=""),t)return;l="",u=MH}continue}l+=n;break;case MH:if(c.isSpecial()){if(u=UH,"/"!=n&&"\\"!=n)continue}else if(t||"?"!=n)if(t||"#"!=n){if(n!=cG&&(u=UH,"/"!=n))continue}else c.fragment="",u=VH;else c.query="",u=xH;break;case UH:if(n==cG||"/"==n||"\\"==n&&c.isSpecial()||!t&&("?"==n||"#"==n)){if(".."===(s=JG(s=l))||"%2e."===s||".%2e"===s||"%2e%2e"===s?(c.shortenPath(),"/"==n||"\\"==n&&c.isSpecial()||zG(c.path,"")):mH(l)?"/"==n||"\\"==n&&c.isSpecial()||zG(c.path,""):("file"==c.scheme&&!c.path.length&&_H(l)&&(c.host&&(c.host=""),l=FG(l,0)+":"),zG(c.path,l)),l="","file"==c.scheme&&(n==cG||"?"==n||"#"==n))for(;c.path.length>1&&""===c.path[0];)YG(c.path);"?"==n?(c.query="",u=xH):"#"==n&&(c.fragment="",u=VH)}else l+=pH(n,lH);break;case LH:"?"==n?(c.query="",u=xH):"#"==n?(c.fragment="",u=VH):n!=cG&&(c.path[0]+=pH(n,uH));break;case xH:t||"#"!=n?n!=cG&&("'"==n&&c.isSpecial()?c.query+="%27":c.query+="#"==n?"%23":pH(n,uH)):(c.fragment="",u=VH);break;case VH:n!=cG&&(c.fragment+=pH(n,dH))}d++}},parseHost:function(e){var t,r,i;if("["==FG(e,0)){if("]"!=FG(e,e.length-1))return"Invalid host";if(t=function(e){var t,r,i,n,o,a,s,c=[0,0,0,0,0,0,0,0],u=0,d=null,l=0,h=function(){return FG(e,l)};if(":"==h()){if(":"!=FG(e,1))return;l+=2,d=++u}for(;h();){if(8==u)return;if(":"!=h()){for(t=r=0;r<4&&BG(iH,h());)t=16*t+LG(h(),16),l++,r++;if("."==h()){if(0==r)return;if(l-=r,u>6)return;for(i=0;h();){if(n=null,i>0){if(!("."==h()&&i<4))return;l++}if(!BG(QG,h()))return;for(;BG(QG,h());){if(o=LG(h(),10),null===n)n=o;else{if(0==n)return;n=10*n+o}if(n>255)return;l++}c[u]=256*c[u]+n,2!=++i&&4!=i||u++}if(4!=i)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}(WG(e,1,-1)),!t)return"Invalid host";this.host=t}else if(this.isSpecial()){if(e=IG(e),BG(nH,e))return"Invalid host";if(t=function(e){var t,r,i,n,o,a,s,c=XG(e,".");if(c.length&&""==c[c.length-1]&&c.length--,(t=c.length)>4)return e;for(r=[],i=0;i<t;i++){if(""==(n=c[i]))return e;if(o=10,n.length>1&&"0"==FG(n,0)&&(o=BG(eH,n)?16:8,n=WG(n,8==o?1:2)),""===n)a=0;else{if(!BG(10==o?rH:8==o?tH:iH,n))return e;a=LG(n,o)}zG(r,a)}for(i=0;i<t;i++)if(a=r[i],i==t-1){if(a>=VG(256,5-t))return null}else if(a>255)return null;for(s=HG(r),i=0;i<r.length;i++)s+=r[i]*VG(256,3-i);return s}(e),null===t)return"Invalid host";this.host=t}else{if(BG(oH,e))return"Invalid host";for(t="",r=gG(e),i=0;i<r.length;i++)t+=pH(r[i],uH);this.host=t}},cannotHaveUsernamePasswordPort:function(){return!this.host||this.cannotBeABaseURL||"file"==this.scheme},includesCredentials:function(){return""!=this.username||""!=this.password},isSpecial:function(){return EG(fH,this.scheme)},shortenPath:function(){var e=this.path,t=e.length;!t||"file"==this.scheme&&1==t&&_H(e[0],!0)||e.length--},serialize:function(){var e=this,t=e.scheme,r=e.username,i=e.password,n=e.host,o=e.port,a=e.path,s=e.query,c=e.fragment,u=t+":";return null!==n?(u+="//",e.includesCredentials()&&(u+=r+(i?":"+i:"")+"@"),u+=cH(n),null!==o&&(u+=":"+o)):"file"==t&&(u+="//"),u+=e.cannotBeABaseURL?a[0]:a.length?"/"+jG(a,"/"):"",null!==s&&(u+="?"+s),null!==c&&(u+="#"+c),u},setHref:function(e){var t=this.parse(e);if(t)throw UG(t);this.searchParams.update()},getOrigin:function(){var e=this.scheme,t=this.port;if("blob"==e)try{return new BH(e.path[0]).origin}catch(e){return"null"}return"file"!=e&&this.isSpecial()?e+"://"+cH(this.host)+(null!==t?":"+t:""):"null"},getProtocol:function(){return this.scheme+":"},setProtocol:function(e){this.parse(RG(e)+":",SH)},getUsername:function(){return this.username},setUsername:function(e){var t=gG(RG(e));if(!this.cannotHaveUsernamePasswordPort()){this.username="";for(var r=0;r<t.length;r++)this.username+=pH(t[r],hH)}},getPassword:function(){return this.password},setPassword:function(e){var t=gG(RG(e));if(!this.cannotHaveUsernamePasswordPort()){this.password="";for(var r=0;r<t.length;r++)this.password+=pH(t[r],hH)}},getHost:function(){var e=this.host,t=this.port;return null===e?"":null===t?cH(e):cH(e)+":"+t},setHost:function(e){this.cannotBeABaseURL||this.parse(e,OH)},getHostname:function(){var e=this.host;return null===e?"":cH(e)},setHostname:function(e){this.cannotBeABaseURL||this.parse(e,NH)},getPort:function(){var e=this.port;return null===e?"":RG(e)},setPort:function(e){this.cannotHaveUsernamePasswordPort()||(""==(e=RG(e))?this.port=null:this.parse(e,wH))},getPathname:function(){var e=this.path;return this.cannotBeABaseURL?e[0]:e.length?"/"+jG(e,"/"):""},setPathname:function(e){this.cannotBeABaseURL||(this.path=[],this.parse(e,MH))},getSearch:function(){var e=this.query;return e?"?"+e:""},setSearch:function(e){""==(e=RG(e))?this.query=null:("?"==FG(e,0)&&(e=WG(e,1)),this.query="",this.parse(e,xH)),this.searchParams.update()},getSearchParams:function(){return this.searchParams.facade},getHash:function(){var e=this.fragment;return e?"#"+e:""},setHash:function(e){""!=(e=RG(e))?("#"==FG(e,0)&&(e=WG(e,1)),this.fragment="",this.parse(e,VH)):this.fragment=null},update:function(){this.query=this.searchParams.serialize()||null}};var BH=function(e){var t=SG(this,jH),r=CG(arguments.length,1)>1?arguments[1]:void 0,i=wG(t,new FH(e,!1,r));lG||(t.href=i.serialize(),t.origin=i.getOrigin(),t.protocol=i.getProtocol(),t.username=i.getUsername(),t.password=i.getPassword(),t.host=i.getHost(),t.hostname=i.getHostname(),t.port=i.getPort(),t.pathname=i.getPathname(),t.search=i.getSearch(),t.searchParams=i.getSearchParams(),t.hash=i.getHash())},jH=BH.prototype,GH=function(e,t){return{get:function(){return DG(this)[e]()},set:t&&function(e){return DG(this)[t](e)},configurable:!0,enumerable:!0}};if(lG&&vG(jH,{href:GH("serialize","setHref"),origin:GH("getOrigin"),protocol:GH("getProtocol","setProtocol"),username:GH("getUsername","setUsername"),password:GH("getPassword","setPassword"),host:GH("getHost","setHost"),hostname:GH("getHostname","setHostname"),port:GH("getPort","setPort"),pathname:GH("getPathname","setPathname"),search:GH("getSearch","setSearch"),searchParams:GH("getSearchParams"),hash:GH("getHash","setHash")}),mG(jH,"toJSON",(function(){return DG(this).serialize()}),{enumerable:!0}),mG(jH,"toString",(function(){return DG(this).serialize()}),{enumerable:!0}),MG){var HH=MG.createObjectURL,zH=MG.revokeObjectURL;HH&&mG(BH,"createObjectURL",fG(HH,MG)),zH&&mG(BH,"revokeObjectURL",fG(zH,MG))}AG(BH,"URL"),dG({global:!0,forced:!hG,sham:!lG},{URL:BH});var KH,YH=function(){function e(e){this._sharedAudioContext=new AudioContext,this._audioDestination=this._sharedAudioContext.createMediaStreamDestination(),this._localGainNode=this._sharedAudioContext.createGain(),this._bufferGainNode=this._sharedAudioContext.createGain(),this.mixingMap=new Map,this.resourcesCache=new Map,this.volumeConfig=new Map,this.cachedBuffer=[],this._context=e,this._localGainNode.gain.value=1}return e.prototype.mixMediaStream=function(e){this._localSource&&this._localSource.disconnect(this._localGainNode),this._localSource=this._sharedAudioContext.createMediaStreamSource(e),this._localSource.connect(this._localGainNode).connect(this._audioDestination)},e.prototype.startAudioMixing=function(e,t,r){return ev(this,void 0,void 0,(function(){var i,n,o,a,s,c,u,d,l,h,p,f,_=this;return tv(this,(function(v){switch(v.label){case 0:if(i=r.playCount,xD(n=r.type,"mixingType",PB(dx)),!(o=this._context.getLocalAudioTrack()))return[2];if((a=vV(o.getTrack()))&&this.mixMediaStream(a),(s=this.mixingMap.get(e))&&s.audioNode){s.audioNode.pause(),this._context.emitMessage({mixId:e,state:lx.AUDIO_MIXING_STATE_STOPPED,error:$N.AUDIO_MIXING_ERROR_OK});try{s.gainNode.disconnect(this._audioDestination),s.audioSource.disconnect(s.gainNode)}catch(e){}}return(u=this.resourcesCache.get(e))&&u.filePath===t?(c=u.getAudioNode(),[3,3]):[3,1];case 1:return[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return t.arrayBuffer();throw _._context.emitMessage({mixId:e,state:lx.AUDIO_MIXING_STATE_FAILED,error:$N.AUDIO_MIXING_ERROR_START_FAILED}),new tw(ZN.LOAD_RESOURCES_FAILED,t.statusText)}))];case 2:d=v.sent(),c=new Audio(URL.createObjectURL(new Blob([d]))),v.label=3;case 3:return c.crossOrigin="anonymous",i<=0?c.loop=!0:i>0&&(l=i,c.onended=function(){--l>0?c.play():_._context.emitMessage({mixId:e,state:lx.AUDIO_MIXING_STATE_FINISHED,error:$N.AUDIO_MIXING_ERROR_OK})}),[4,c.play()];case 4:if(v.sent(),h=this._sharedAudioContext.createMediaElementSource(c),p=this._sharedAudioContext.createGain(),f=this.volumeConfig.get(e),p.gain.value=f?f/100:1,h.connect(p).connect(this._audioDestination),this.mixingMap.set(e,{audioSource:h,audioNode:c,gainNode:p,type:"file"}),n===dx.PUBLISH)try{p.disconnect(this._sharedAudioContext.destination)}catch(e){}else p.connect(this._sharedAudioContext.destination);return this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],r.type),this._context.emitMessage({mixId:e,state:lx.AUDIO_MIXING_STATE_PLAYING,error:$N.AUDIO_MIXING_ERROR_OK}),[2]}}))}))},e.prototype.stopAudioMixing=function(e){var t=this.mixingMap.get(e);t&&"file"===t.type&&(this.mixingMap.delete(e),t.audioNode.pause(),t.audioSource.disconnect(t.gainNode),t.gainNode.disconnect(this._audioDestination),this._context.emitMessage({mixId:e,state:lx.AUDIO_MIXING_STATE_STOPPED,error:$N.AUDIO_MIXING_ERROR_OK}))},e.prototype.pauseAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:lx.AUDIO_MIXING_STATE_PAUSED,error:$N.AUDIO_MIXING_ERROR_OK}),t.audioNode.pause())},e.prototype.resumeAudioMixing=function(e){var t=this.mixingMap.get(e);t&&(this._context.emitMessage({mixId:e,state:lx.AUDIO_MIXING_STATE_PLAYING,error:$N.AUDIO_MIXING_ERROR_OK}),t.audioNode.play())},e.prototype.preloadAudioMixing=function(e,t){return ev(this,void 0,void 0,(function(){var r,i=this;return tv(this,(function(n){switch(n.label){case 0:return this.stopAudioMixing(e),[4,fetch(t,{mode:"cors",credentials:"include"}).then((function(t){if(t.ok)return i._context.emitMessage({mixId:e,state:lx.AUDIO_MIXING_STATE_PRELOADED,error:$N.AUDIO_MIXING_ERROR_OK}),t.arrayBuffer();throw i._context.emitMessage({mixId:e,state:lx.AUDIO_MIXING_STATE_FAILED,error:$N.AUDIO_MIXING_ERROR_PRELOAD_FAILED}),new tw(ZN.LOAD_RESOURCES_FAILED,t.statusText)})).catch((function(e){throw new tw(ZN.LOAD_RESOURCES_FAILED,"Load resources failed",e)}))];case 1:return r=n.sent(),this.resourcesCache.set(e,{getAudioNode:function(){return new Audio(URL.createObjectURL(new Blob([r])))},filePath:t}),[2]}}))}))},e.prototype.unloadAudioMixing=function(e){this.resourcesCache.has(e)&&this.resourcesCache.delete(e)},e.prototype.getAudioMixingVolume=function(e){var t=this.mixingMap.get(e);return t?100*t.gainNode.gain.value:0},e.prototype.setAudioMixingVolume=function(e,t){t<0?t=0:t>400&&(t=400),this.volumeConfig.set(e,t);var r=this.mixingMap.get(e);r&&(r.gainNode.gain.value=Number(t)/100)},e.prototype.getAudioMixingDuration=function(e){var t=this.mixingMap.get(e),r=this.mixingMap.get(e);return t||r?t?1e3*t.audioNode.duration:r?1e3*r.audioNode.duration:0:0},e.prototype.getAudioMixingCurrentPosition=function(e){var t=this.mixingMap.get(e);return t?1e3*t.audioNode.currentTime:0},e.prototype.setAudioMixingPosition=function(e,t){var r=this.mixingMap.get(e);r&&(r.audioNode.currentTime=t/1e3,r.audioNode.play())},e.prototype.enableAudioMixingBuffer=function(e){xD(e,"type",PB(dx));var t=this._context.getLocalAudioTrack();if(t){var r=vV(t.getTrack());if(r&&this.mixMediaStream(r),e===dx.PUBLISH)try{this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}else this._bufferGainNode.connect(this._sharedAudioContext.destination);this._context.updateLocalAudioTrack(this._audioDestination.stream.getAudioTracks()[0],e),this._bufferGainNode.connect(this._audioDestination),this._context.emitMessage({mixId:-1,state:lx.AUDIO_MIXING_STATE_PCM_ENABLED,error:$N.AUDIO_MIXING_ERROR_OK})}},e.prototype.disableAudioMixingBuffer=function(){if(this.cachedBuffer=[],this._audioBufferSource){try{this._audioBufferSource.disconnect(this._bufferGainNode),this._bufferGainNode.disconnect(this._audioDestination),this._bufferGainNode.disconnect(this._sharedAudioContext.destination)}catch(e){}finally{this._audioBufferSource=void 0}this._context.updateLocalAudioTrack(),this._context.emitMessage({mixId:-1,state:lx.AUDIO_MIXING_STATE_PCM_DISABLED,error:$N.AUDIO_MIXING_ERROR_OK})}},e.prototype.pushAudioMixingBuffer=function(e){var t=this;this._audioBufferSource&&(this.cachedBuffer.push(e),this.cachedBuffer.length>0)||(this._audioBufferSource=this._sharedAudioContext.createBufferSource(),this._audioBufferSource.buffer=e,this._audioBufferSource.connect(this._bufferGainNode),this._audioBufferSource.start(),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)}})},e.prototype.stopAll=function(){var e=this;if(this._localSource)try{this._localSource.disconnect(this._localGainNode),delete this._localSource}catch(e){}this.mixingMap.forEach((function(t,r){e.stopAudioMixing(r)}))},Object.defineProperty(e.prototype,"mixTrack",{get:function(){return this._audioDestination.stream.getAudioTracks()[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sharedAudioContext",{get:function(){return this._sharedAudioContext},enumerable:!1,configurable:!0}),e.prototype.destroy=function(){var e=this._sharedAudioContext;"closed"!==e.state&&"function"==typeof e.close&&e.close(),this.cachedBuffer=[],this.mixingMap.clear(),this.resourcesCache.clear(),this.volumeConfig.clear()},Q_([EL("default","id","filePath","options")],e.prototype,"startAudioMixing",null),Q_([EL("default","id")],e.prototype,"stopAudioMixing",null),Q_([EL("default","id")],e.prototype,"pauseAudioMixing",null),Q_([EL("default","id")],e.prototype,"resumeAudioMixing",null),Q_([EL("default","id")],e.prototype,"preloadAudioMixing",null),Q_([EL("default","id")],e.prototype,"unloadAudioMixing",null),Q_([EL("default","id")],e.prototype,"getAudioMixingVolume",null),Q_([EL("default","id","volume")],e.prototype,"setAudioMixingVolume",null),Q_([EL("default","id")],e.prototype,"getAudioMixingDuration",null),Q_([EL("default","id")],e.prototype,"getAudioMixingCurrentPosition",null),Q_([EL("default","id","position")],e.prototype,"setAudioMixingPosition",null),Q_([EL("default","type")],e.prototype,"enableAudioMixingBuffer",null),Q_([EL()],e.prototype,"disableAudioMixingBuffer",null),Q_([EL("default","buffer")],e.prototype,"pushAudioMixingBuffer",null),e}();!function(e){e.NORMAL_USER="normalUser",e.SILENT_USER="silentUser"}(KH||(KH={}));var XH=new qD("RTMClient",1),WH=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r._dataChannelSignal=null,r._handler=null,r._dataChannelSignalState=MV.DISCONNECTED,r._loginSessionId=null,r._userId=null,r._token=null,r._isReconnecting=!1,r._reconnectTimer=null,r._loginResolveCallback=null,r._loginRejectCallback=null,r._iceConfigNode=null,r._wait_login_token=!1,r}return Z_(t,e),t.prototype.login=function(e,t){var r=this;return new Promise((function(i,n){if(XH.print("login","invoke login, token: %o, userId: %o",e,t),r._loginSessionId)throw new tw(ZN.ALREADY_LOGIN,"Already logined");if(r._loginResolveCallback)throw new tw(ZN.LOGIN_FAILED,"Is logging in, please try again later.");r._userId=t,r._token=e,vL.setStats({rtc_app_id:r._appId,user_id:t}),r._loginResolveCallback=i,r._loginRejectCallback=n,r._dataChannelSignal?r._login():(XH.print("login","init dataChannelSingling"),r._dataChannelSignalState=MV.CONNECTING,r._createDataChannelSignaling(t).then((function(e){r._dataChannelSignal=e,r._login()})).catch((function(){r._onDisconnect()})))}))},t.prototype.logout=function(){var e;return ev(this,void 0,void 0,(function(){return tv(this,(function(t){if(!this._loginSessionId||!this._userId)throw new tw(ZN.NOT_LOGIN,"login first");return null===(e=this._dataChannelSignal)||void 0===e||e.sendSignaling("logout",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId},{functionType:TL.C2RTM}).catch((function(){})),this._closeDataChannelSignaling(),this._clearState(),[2]}))}))},t.prototype.updateLoginToken=function(e){return ev(this,void 0,void 0,(function(){var t=this;return tv(this,(function(r){return this._token=e,[2,new Promise((function(e,r){t._wait_login_token?(t._loginResolveCallback=e,t._loginRejectCallback=r,t._login()):e()}))]}))}))},t.prototype.getPeerOnlineStatus=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new tw(ZN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("getPeerOnlineStatus",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,peerUserId:e},{functionType:TL.C2RTM})];case 1:return[2,null==(t=r.sent())?void 0:t.status]}}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new tw(ZN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:e,room:"",msg:t})];case 1:return r.sent(),[2]}}))}))},t.prototype.setServerParams=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:if(!this._loginSessionId||!this._userId)throw new tw(ZN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendSignaling("setServerParams",{loginSessionId:this._loginSessionId,userId:this._userId,appId:this._appId,signature:e,url:t},{functionType:TL.C2RTM})];case 1:return r.sent(),[2]}}))}))},t.prototype.sendServerMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:if(!this._loginSessionId||!this._userId)throw new tw(ZN.NOT_LOGIN,"login first");return this._checkDataChannelSignal(),[4,this._dataChannelSignal.sendP2PMessage({from:this._userId,app:this._appId,to:"",room:"",type:cL.BUSINESS_SERVER,msg:e})];case 1:return t.sent(),[2]}}))}))},t.prototype.destroy=function(){this._clearState(),this._closeDataChannelSignaling(),e.prototype.removeAllListeners.call(this)},t.prototype._login=function(){var e=this;if(this._userId){var t=gD();this._checkDataChannelSignal(),this._dataChannelSignal.sendSignaling("login",{Token:RD.token2auth(this._appId,null,this._userId,this._token),timestamp:Date.now(),loginSessionId:t,params:{deviceType:"web",userAgent:window.navigator.userAgent,sdkVersion:BP.VERSION,deviceId:wL.getDeviceId(),appId:this._appId,userId:this._userId}},{functionType:TL.C2RTM}).then((function(){e._loginResolveCallback&&e._loginResolveCallback(),e._loginSessionId=t,e._wait_login_token=!1})).catch((function(t){var r,i,n=t||{},o=n.code,a=n.message;e._wait_login_token=!1,o>=700&&o<800?708===o?(r=ZN.INVALID_PARAMS,i="Invalid userId"):(r=ZN.INVALID_TOKEN,i="Invalid token",e._wait_login_token=!0,e._loginRejectCallback||e.emit("onRTMTokenError")):(r=ZN.LOGIN_FAILED,i="login failed"),e._loginRejectCallback&&e._loginRejectCallback(new tw(r,a||i))})).finally((function(){e._loginResolveCallback=null,e._loginRejectCallback=null}))}},t.prototype._createDataChannelSignaling=function(e){return ev(this,void 0,void 0,(function(){var t,r,i,n,o,a=this;return tv(this,(function(s){switch(s.label){case 0:if(t=new PL,r=this._iceConfigNode)return[3,4];s.label=1;case 1:return s.trys.push([1,3,,4]),[4,null==t?void 0:t.getAccessNode(this._appId,"",e,wL.getDeviceId(),"")];case 2:if(!(r=s.sent()))throw new Error;return[3,4];case 3:throw s.sent(),gL("rtm.login.getNodeFailed","",0,!0),new tw(ZN.ICE_SERVER_WRONG,"get ICE config failed");case 4:gL("rtm.login.getNodeSuccess",r,0,!0),XH.print("_createDataChannelSignaling()","get node success",r),this._handler=new gx(pL),this._handler.once("disconnect",(function(){XH.print("_createDataChannelSignaling()","recv BasicHandler event: disconnect"),a._onDisconnect()})),s.label=5;case 5:return s.trys.push([5,7,,8]),[4,this._handler.connect(r)];case 6:return i=s.sent(),XH.print("_createDataChannelSignaling()","establish peerConnection success"),this._dataChannelSignalState=MV.CONNECTED,[3,8];case 7:throw n=s.sent(),this._iceConfigNode=null,this._dataChannelSignalState=MV.DISCONNECTED,new tw(ZN.ESTABLISH_DATACHANNEL_FAILED,"establish dataChannel failed",n);case 8:return o=new AL(i),XH.print("_createDataChannelSignaling()","send ping"),o.sendPingSignaling(),o.once("close",(function(){XH.print("_createDataChannelSignaling()","recv DataChannelSignaling event: close"),a._onDisconnect()})),o.on(tL.USER_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(tL.USER_BINARY_MESSAGE_RECEIVED_OUTSIDE_ROOM,(function(e){a.emit("onUserBinaryMessageReceivedOutsideRoom",{userId:e.from,message:e.msg})})),o.on(tL.USER_DISCONNECTION,(function(){a.emit("onUserDisconnection"),a._clearState()})),o.on(tL.NODE_CHANGE,(function(e){gL("rtm.nodeChange",JSON.stringify(e),0,!0),Array.isArray(e.nodes)&&e.nodes.length&&(a._iceConfigNode=e.nodes[0]),a._loginResolveCallback&&a._loginRejectCallback?a._login():a._reconnect()})),[2,o]}}))}))},t.prototype._closeDataChannelSignaling=function(){var e,t;null===(e=this._dataChannelSignal)||void 0===e||e.destroy(),this._dataChannelSignal=null,null===(t=this._handler)||void 0===t||t.destroy(),this._handler=null},t.prototype._checkDataChannelSignal=function(){if(!this._dataChannelSignal||this._dataChannelSignalState!==MV.CONNECTED)throw new tw(ZN.NOT_CONNECTED_YET,"datachannel not connect")},t.prototype._onDisconnect=function(){this._dataChannelSignalState=MV.DISCONNECTED,this._closeDataChannelSignaling(),navigator.onLine?this._reconnect():this._reconnectTimer=self.setTimeout(this._reconnect.bind(this),3e3)},t.prototype._reconnect=function(){var e=this;!this._isReconnecting&&this._userId&&(XH.print("_reconnect()","start reconnect..."),this._isReconnecting=!0,this._createDataChannelSignaling(this._userId).then((function(t){XH.print("_reconnect()","reconnect success!"),e._dataChannelSignal=t,e._login(),e._reconnectTimer=null})).catch((function(t){XH.print("_reconnect()","Reconnecting error, will reconnect after 3s",t),e._reconnectTimer=self.setTimeout(e._reconnect.bind(e),3e3)})).finally((function(){e._isReconnecting=!1})))},t.prototype._clearState=function(){this._userId=null,this._token=null,this._loginSessionId=null,null!==this._reconnectTimer&&(self.clearTimeout(this._reconnectTimer),this._reconnectTimer=null)},t}(XD.exports.EventEmitter),JH=function(e){function t(t){var r=e.call(this)||this;return r._appId=t,r.remoteStreams=new Map,r}return Z_(t,e),t.prototype.connect=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return this._mediaServerClient=new VV,this._bindEvents(),[4,this._mediaServerClient.connect(this._appId)];case 1:return e.sent(),[2]}}))}))},t.prototype.startPlayPublicStream=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:if(this.remoteStreams.get(e))throw new tw(ZN.REPEAT_PLAY,"repeat play public media stream");return t=new JV(e,e,!1,{audiostream:!0,localaudio:!0,videostream:!0,localvideo:!0,extaudio:!1,extvideo:!1,videoDescriptions:[]}),[4,this._mediaServerClient.subscribePublicStream(t)];case 1:return r.sent(),this.remoteStreams.set(e,t),[2,t]}}))}))},t.prototype.stopPlayPublicStream=function(e){var t=this.remoteStreams.get(e);if(t)return this.remoteStreams.delete(e),this._mediaServerClient.unsubscribePublicStream(t)},t.prototype.destroy=function(){this.remoteStreams=new Map,this._mediaServerClient&&this._mediaServerClient.destroy()},t.prototype._handleReconnected=function(){return ev(this,void 0,void 0,(function(){var e,t,r,i,n,o,a,s,c=this;return tv(this,(function(u){clearTimeout(this._reconnectTimer),e=function(e){t.remoteStreams.delete(e),t.startPlayPublicStream(e).then((function(){var t=c.remoteStreams.get(e);c.safeEmit(HV.RESUBSCRIBE,{stream:t})}))},t=this;try{for(r=rv(this.remoteStreams),i=r.next();!i.done;i=r.next())n=iv(i.value,1),o=n[0],e(o)}catch(e){a={error:e}}finally{try{i&&!i.done&&(s=r.return)&&s.call(r)}finally{if(a)throw a.error}}return[2]}))}))},t.prototype._reconnect=function(){var e=this;this._mediaServerClient.removeAllListeners(),this._mediaServerClient.destroy(),navigator.onLine?this.connect().then(this._handleReconnected.bind(this)):this._reconnectTimer=setTimeout((function(){return e.connect().then(e._handleReconnected.bind(e))}),3e3)},t.prototype._bindEvents=function(){var e,t,r=this;null===(e=this._mediaServerClient)||void 0===e||e.on(iL.ABNORMAL_DISCONNECTION,this._reconnect.bind(this)),null===(t=this._mediaServerClient)||void 0===t||t.on("onRemoteStreamStats",(function(e){r.emit("onRemoteStreamStats",e)}))},t}($D),qH=new qD("AudioDeviceManager",1),ZH=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._isAudioPlaybackDeviceTesting=!1,t._isAudioDeviceRecordTesting=!1,t}return Z_(t,e),t.prototype.startAudioPlaybackDeviceTest=function(e,t){return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(i){switch(i.label){case 0:if(this._isAudioPlaybackDeviceTesting||this._isAudioDeviceRecordTesting)throw new tw(ZN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");this._isAudioPlaybackDeviceTesting=!0,qH.print("startAudioPlaybackDeviceTest()","Invoke"),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._playAudioFile(e,{loop:!0})];case 2:return i.sent(),[3,4];case 3:throw r=i.sent(),this.stopAudioPlaybackDeviceTest(),r;case 4:return this._startEmitAudioPlaybackDeviceTestVolume(t),[2]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){this._isAudioPlaybackDeviceTesting&&(qH.print("stopAudioPlaybackDeviceTest()","Invoke"),this._isAudioPlaybackDeviceTesting=!1,this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.startAudioDeviceRecordTest=function(e){return ev(this,void 0,void 0,(function(){var t=this;return tv(this,(function(r){switch(r.label){case 0:if(this._isAudioDeviceRecordTesting)throw new tw(ZN.REPEAT_DEVICE_TEST,"device test cannot be called repeatedly at the same time.");return this._isAudioDeviceRecordTesting=!0,qH.print("startAudioDeviceRecordTest()","Invoke"),this._recoderTimer=window.setTimeout((function(){qH.print("startAudioDeviceRecordTest()","".concat(3e4,'ms automatic call method "stopAudioDeviceRecordAndPlayTest"')),t._stopAudioCaptureAndRecoder()}),3e4),[4,this._startAudioCaptureAndRecoder(e)];case 1:return r.sent(),delete this._audioCaptureAndRecoderResolve,[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){qH.print("stopAudioDeviceRecordAndPlayTest()","Invoke"),void 0!==this._recoderTimer&&(clearTimeout(this._recoderTimer),delete this._recoderTimer),this._stopAudioCaptureAndRecoder()},t.prototype.stopAudioDevicePlayTest=function(){this._isAudioDeviceRecordTesting&&(qH.print("stopAudioDevicePlayTest()","Invoke"),this._isAudioDeviceRecordTesting=!1,this.stopAudioDeviceRecordAndPlayTest(),this._stopEmitAudioPlaybackDeviceTestVolume(),this._destroyAudioElement())},t.prototype.getRecordTrack=function(){return this._audioTrack},t.prototype.destroy=function(){qH.print("destroy()","Invoke"),e.prototype.removeAllListeners.call(this),this.stopAudioPlaybackDeviceTest(),this.stopAudioDevicePlayTest()},t.prototype._playAudioFile=function(e,t){var r=this;return new Promise((function(i,n){r._audioElement=tF("audio",{attributes:{src:e,crossOrigin:"",autoplay:"true"}}),r._audioElement.loop=t.loop,qH.print("_playAudioFile()","url=".concat(e,";loop=").concat(t.loop)),r._audioElement.oncanplay=function(){qH.print("_playAudioFile()","oncanplay"),i()},r._audioElement.onerror=function(e){var t,i;n(new tw(ZN.LOAD_RESOURCES_FAILED,"audio error: ".concat(e.message||(null===(i=null===(t=r._audioElement)||void 0===t?void 0:t.error)||void 0===i?void 0:i.message))))}}))},t.prototype._destroyAudioElement=function(){this._audioElement&&(qH.print("_destroyAudioElement()","Invoke"),this._audioElement.src="",delete this._audioElement,this._audioCaptureAndRecoderResolve&&this._audioCaptureAndRecoderResolve())},t.prototype._startEmitAudioPlaybackDeviceTestVolume=function(e){var t=this;e=Math.max(e,100),this._audioElement&&(qH.print("_startEmitAudioPlaybackDeviceTestVolume()","start timer(".concat(e,"ms)")),this._audioLevelFetcher=new hV(this._audioElement),this._playbackDeviceTestTimer=self.setInterval((function(){t._audioLevelFetcher&&t.emit("onAudioPlaybackDeviceTestVolume",t._audioLevelFetcher.getAudioLevel())}),e))},t.prototype._stopEmitAudioPlaybackDeviceTestVolume=function(){var e;void 0!==this._playbackDeviceTestTimer&&(qH.print("_stopEmitAudioPlaybackDeviceTestVolume()","stop timer"),self.clearInterval(this._playbackDeviceTestTimer),delete this._playbackDeviceTestTimer),null===(e=this._audioLevelFetcher)||void 0===e||e.destroy(),delete this._audioLevelFetcher},t.prototype._startAudioCaptureAndRecoder=function(e){return ev(this,void 0,void 0,(function(){var t,r,i=this;return tv(this,(function(n){switch(n.label){case 0:return t=this,[4,PV({})];case 1:return t._audioTrack=n.sent(),r=vV(this._audioTrack.getTrack()),qH.print("startAudioDeviceRecordTest()","create microphone track success!"),[2,new Promise((function(t,n){i._mediaRecorder=new MediaRecorder(r),i._mediaRecorder.ondataavailable=function(r){return ev(i,void 0,void 0,(function(){var i,o,a,s=this;return tv(this,(function(c){switch(c.label){case 0:if(!this._isAudioDeviceRecordTesting)return[3,5];qH.print("startAudioDeviceRecordTest()","get recorded file."),i=new Blob([r.data]),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this._playAudioFile(URL.createObjectURL(i),{loop:!1})];case 2:return c.sent(),[3,4];case 3:return o=c.sent(),[2,n(o)];case 4:return this._startEmitAudioPlaybackDeviceTestVolume(e),null===(a=this._audioElement)||void 0===a||a.addEventListener("ended",(function(){s.stopAudioDevicePlayTest(),t()})),this._audioCaptureAndRecoderResolve=t,[3,6];case 5:t(),c.label=6;case 6:return[2]}}))}))},i._mediaRecorder.onerror=function(e){n(new tw(ZN.AUDIO_DEVICE_TEST_FAILED,e.message||"mediaRecorder error"))},i._mediaRecorder.start()}))]}}))}))},t.prototype._stopAudioCaptureAndRecoder=function(){var e;this._mediaRecorder&&("recording"===this._mediaRecorder.state&&this._mediaRecorder.stop(),delete this._mediaRecorder),null===(e=this._audioTrack)||void 0===e||e.close(),delete this._audioTrack},t}(XD.exports.EventEmitter),$H=new qD("Engine",0),QH=function(e){function t(t){var r=e.call(this)||this;return r._visibility=!0,r._remoteVideoPlayer=new Map,r._remoteScreenPlayer=new Map,r._remoteAudioPlayer=new Map,r._publicStreamAudioPlayer=new Map,r._publicStreamVideoPlayer=new Map,r._publicStreamIds=new Map,r._videoStreamConstraints={},r._audioStreamConstraints={},r._enableSimulcast=!1,r._videoStreamEncodeConfig=[YP],r._screenStreamEncodeConfig=[XP],r._pauseAllSubscribeState={audio:!1,video:!1},r._audioPropertiesReportTimer=null,r._mirrorType=DP.MIRROR_TYPE_RENDER,r._audioDeviceManager=new ZH,r._updateMixAudioTrack=function(e,t){return void 0===t&&(t=dx.PLAYOUT_AND_PUBLISH),ev(r,void 0,void 0,(function(){var r;return tv(this,(function(i){switch(i.label){case 0:return $H.print("_updateMixAudioTrack()"),this._localAudioTrack?(e?(this._localAudioTrack.mixType=t,this._localAudioTrack.mixedAudioTrack=e):(delete this._localAudioTrack.mixType,delete this._localAudioTrack.mixedAudioTrack),(null===(r=this._room)||void 0===r?void 0:r.hasPublished)?[4,this._updatePublish()]:[3,2]):(e&&(this._tempMixingAudioTrack={track:e,type:t}),[2]);case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},r._onAudioMixingMessage=function(e){r.safeEmit(wD.onAudioMixingStateChanged,e)},r._appId=t,r._pubLock=new Ix("pubLock"),r._addDeviceEventHandler(),r._audioMixingManager=new YH({getLocalAudioTrack:function(){return r._localAudioTrack},updateLocalAudioTrack:r._updateMixAudioTrack,emitMessage:r._onAudioMixingMessage}),window.__rtc_engine__=r,window["__rtc_engine__".concat(Math.floor(100*Math.random()+1))]=r,r._trackSourceType={video:vP.VIDEO_SOURCE_TYPE_INTERNAL,screenVideo:vP.VIDEO_SOURCE_TYPE_INTERNAL,audio:mP.AUDIO_SOURCE_TYPE_INTERNAL,screenAudio:mP.AUDIO_SOURCE_TYPE_INTERNAL},r._rtmClient=new WH(t),r._handleRTMClient(r._rtmClient),r._useCloudProxy=!1,r._handleAudioDeviceManager(),r}return Z_(t,e),Object.defineProperty(t.prototype,"appId",{get:function(){return this._appId},enumerable:!1,configurable:!0}),t.prototype.updateToken=function(e){var t,r,i;return ev(this,void 0,void 0,(function(){var n,o,a,s;return tv(this,(function(c){switch(c.label){case 0:return $H.print("updateToken()","token: %s",e),LD(e,"token"),this.waitForNewToken&&(null===(t=this._room)||void 0===t?void 0:t._roomInfo)&&this._tempRoomConfig?(n=null===(r=this._room)||void 0===r?void 0:r._roomInfo,o=n.roomId,a=n.userInfo,s=this._tempRoomConfig,delete this._tempRoomConfig,[4,this.joinRoom(e,o,a,s)]):[3,2];case 1:return[2,c.sent()];case 2:if(!this._room)throw new tw(ZN.UPDATE_TOKEN_BEFORE_JOIN,"update token before join room");return[4,null===(i=this._room)||void 0===i?void 0:i.updateToken(e)];case 3:return c.sent(),[2]}}))}))},t.prototype.switchCamera=function(e){var t,r;return ev(this,void 0,void 0,(function(){var i,n;return tv(this,(function(o){switch(o.label){case 0:return $H.print("switchCamera()","deviceId: %s",e),LD(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((i=this._videoStreamConstraints).deviceId={exact:e},this._videoStreamConstraints=i,[4,DV(i)]);case 1:return n=o.sent(),this._initLocalTrackEvents(n),this._localVideoTrack&&this._localVideoTrack.close(),this._localVideoTrack=n,this._videoPlayer&&(this._videoPlayer.stop(),this._videoPlayer.playVideo(n),this._videoPlayer.mirror(!!this._mirrorType)),this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},t.prototype.switchMicrophone=function(e){var t,r;return ev(this,void 0,void 0,(function(){var i,n;return tv(this,(function(o){switch(o.label){case 0:return $H.print("switchMicrophone()","deviceId: %s",e),LD(e,"deviceId"),e===(null===(r=null===(t=this._videoStreamConstraints)||void 0===t?void 0:t.deviceId)||void 0===r?void 0:r.exact)?[2]:((i=this._audioStreamConstraints).deviceId={exact:e},this._audioStreamConstraints=i,[4,PV(i)]);case 1:return n=o.sent(),this._initLocalTrackEvents(n),this._localAudioTrack&&this._localAudioTrack.close(),this._localAudioTrack=n,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,3]:[2];case 2:o.sent(),o.label=3;case 3:return[2]}}))}))},t.prototype._addDeviceEventHandler=function(){dV.on(wD.onMediaDeviceStateChanged,this._onDeviceStateChange.bind(this))},t.prototype._addHandlerEventHandler=function(){var e,t,r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S,E,y,g,b,T,I,R=this;null===(e=this._room)||void 0===e||e.on(tL.ON_ADD_STREAM,this._onAddStream.bind(this)),null===(t=this._room)||void 0===t||t.on(tL.ON_REMOVE_STREAM,this._onRemoveStream.bind(this)),null===(r=this._room)||void 0===r||r.on(tL.USER_CONNECTION,this._onUserConnection.bind(this)),null===(i=this._room)||void 0===i||i.on(HV.ON_USER_LEAVE,this._onUserLeave.bind(this)),null===(n=this._room)||void 0===n||n.on(HV.ON_ROOM_ERROR,this._onRoomError.bind(this)),null===(o=this._room)||void 0===o||o.on(tL.ON_CUSTOM_MESSAGE,this._onCustomMessage.bind(this)),null===(a=this._room)||void 0===a||a.on(tL.USER_MESSAGE_RECEIVED,this._onUserMessageReceived.bind(this)),null===(s=this._room)||void 0===s||s.on(tL.USER_BINARY_MESSAGE_RECEIVED,this._onUserBinaryMessageReceived.bind(this)),null===(c=this._room)||void 0===c||c.on(tL.ON_USER_TOKEN_WILL_EXPIRE,this._onUserTokenWillExpire.bind(this)),null===(u=this._room)||void 0===u||u.on(tL.POST_PROCESSING_MESSAGE,(function(e){"publicStreamCallback"===e.type?R._onPushPublicStreamResult(e):"transcodeStatusCallback"===e.type&&R._onLiveTranscodingResult(e)})),null===(d=this._room)||void 0===d||d.on(iL.ON_CONNECTION_STATE_CHANGE,this._onConnectionStateChange.bind(this)),null===(l=this._room)||void 0===l||l.on(HV.RESUBSCRIBE,this._onResubscribe.bind(this)),null===(h=this._room)||void 0===h||h.on(HV.SUBSCRIBE_PUSH_TRACK,this._onSubscribePushTrack.bind(this)),null===(p=this._room)||void 0===p||p.on(HV.REMOVE_PUSH_TRACK,this._onRemovePushTrack.bind(this)),null===(f=this._room)||void 0===f||f.on(HV.VIDEO_FIRST_FRAME,this._onVideoFirstFrameDecoded.bind(this)),null===(_=this._room)||void 0===_||_.on(HV.ON_PUBLISH_RESULT,(function(e){var t;(null===(t=R._room)||void 0===t?void 0:t._roomConfig.isAutoPublish)&&R.safeEmit(wD.onAutoPublishResult,e)})),null===(v=this._room)||void 0===v||v.on(HV.ON_REMOTE_STREAM_STATS,(function(e){R.safeEmit(wD.onRemoteStreamStats,e)})),null===(m=this._room)||void 0===m||m.on(HV.ON_LOCAL_STREAM_STATS,(function(e){R.safeEmit(wD.onLocalStreamStats,e)})),null===(S=this._room)||void 0===S||S.on(HV.ON_USER_MUTE_AUDIO,this._onUserMuteAudio.bind(this)),null===(E=this._room)||void 0===E||E.on(HV.ON_USER_MUTE_VIDEO,this._onUserMuteVideo.bind(this)),null===(y=this._room)||void 0===y||y.on(HV.ON_USER_START_AUDIO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(wD.onUserStartAudioCapture,{userId:t})})),null===(g=this._room)||void 0===g||g.on(HV.ON_USER_STOP_AUDIO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(wD.onUserStopAudioCapture,{userId:t})})),null===(b=this._room)||void 0===b||b.on(HV.ON_USER_START_VIDEO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(wD.onUserStartVideoCapture,{userId:t})})),null===(T=this._room)||void 0===T||T.on(HV.ON_USER_STOP_VIDEO_CAPTURE,(function(e){var t=e.userId;R.safeEmit(wD.onUserStopVideoCapture,{userId:t})})),null===(I=this._room)||void 0===I||I.on(HV.ON_SEI_MESSAGED_RECEIVED,(function(e){R.safeEmit(wD.onSEIMessageReceived,e)}))},t.prototype.safeEmit=function(t){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return YD(t)&&yL(t,ND(r)),e.prototype.safeEmit.apply(this,nv([t],iv(r),!1))},t.prototype._removeHandlerEventHandler=function(){var e;null===(e=this._room)||void 0===e||e.removeAllListeners()},t.prototype.joinRoom=function(e,t,r,i){return void 0===i&&(i={isAutoPublish:!1,isAutoSubscribeAudio:!1,isAutoSubscribeVideo:!1}),ev(this,void 0,void 0,(function(){var n,o;return tv(this,(function(a){switch(a.label){case 0:if($H.print("joinRoom()","token: %o roomId: %o, userInfo: %o, roomConfig: %o",e,t,r,i),jD(e)||LD(e,"token"),function(e){if("string"!=typeof e||!/^[a-zA-Z0-9@._\-]{1,128}$/.test(e))throw new tw(ZN.INVALID_PARAMS,"The RoomId must be within 128 bytes. The supported characters: a-z,A-Z,0-9,@,-,_,.")}(t),function(e){VD(e,"userInfo"),GD(e.userId),jD(e.extraInfo)||LD(e.extraInfo,"userInfo.extraInfo",1,200)}(r),function(e){VD(e,"roomConfig"),MD(e.isAutoPublish,"roomConfig.isAutoPublish"),MD(e.isAutoSubscribeAudio,"roomConfig.isAutoSubscribeAudio"),MD(e.isAutoSubscribeVideo,"roomConfig.isAutoSubscribeVideo")}(i),!this._room||this._room.connectionState===MV.DISCONNECTED)return[3,1];throw new tw(ZN.REPEAT_JOIN,"Already joined");case 1:this._room=new eF(i),this._addHandlerEventHandler(),n=this._liveTranscodeConfig&&HP("started",this._liveTranscodeConfig),a.label=2;case 2:return a.trys.push([2,4,,5]),this._useCloudProxy&&(this._startCloudProxyTimestamp=Date.now()),[4,this._room.join(this._appId,t,e,$_($_({},r),{businessId:this._businessId,role:this._visibility?KH.NORMAL_USER:KH.SILENT_USER}),n,this._useCloudProxy)];case 3:return a.sent(),this._roomConfig=i,this._tempRoomConfig&&delete this._tempRoomConfig,[3,5];case 4:throw(o=a.sent()).code===ZN.INVALID_TOKEN&&(this._tempRoomConfig=i),o;case 5:(this._localAudioTrack||this._localVideoTrack)&&i.isAutoPublish&&(this._visibility?this._updatePublish(!0):this.safeEmit(wD.onAutoPublishResult,{isScreen:!1,state:TP.PUBLISH_FAIL})),a.label=6;case 6:return[2]}}))}))},t.prototype.leaveRoom=function(e){var t,r;return void 0===e&&(e=!1),ev(this,void 0,void 0,(function(){return tv(this,(function(i){switch(i.label){case 0:return $H.print("leaveRoom()"),e?[4,null===(t=this._room)||void 0===t?void 0:t.leave(e)]:[3,2];case 1:return i.sent(),[3,3];case 2:null===(r=this._room)||void 0===r||r.leave(e).catch(),i.label=3;case 3:return this._removeHandlerEventHandler(),this._liveTranscodeConfig&&this.stopLiveTranscoding(),this._room=void 0,this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._roomConfig=void 0,this._publicStreamIds=new Map,[2]}}))}))},t.prototype.destroy=function(){var e,t,r,i;$H.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(),null===(r=this._audioPlayer)||void 0===r||r.destroy(),this._videoPlayer=void 0,this._audioPlayer=void 0,this._screenPlayer=void 0,this._videoStreamConstraints={},this._audioStreamConstraints={},this._videoStreamEncodeConfig=[YP],this._screenStreamEncodeConfig=[XP],this._pauseAllSubscribeState={audio:!1,video:!1},clearInterval(this._audioVolumeIndicationTimer),clearInterval(this._dummyTimer),this._audioVolumeIndicationTimer=void 0,this._stopAudioPropertiesReport(),this._localAudioTrack&&(this._localAudioTrack.close(),this._localAudioTrack=void 0),this._localVideoTrack&&(this._localVideoTrack.close(),this._localVideoTrack=void 0),this._localScreenAudioTrack&&(this._localScreenAudioTrack.close(),this._localScreenAudioTrack=void 0),this._localScreenVideoTrack&&(this._localScreenVideoTrack.close(),this._localScreenVideoTrack=void 0),this._localImgVideoTrack&&(this._localImgVideoTrack.stop(),this._localImgVideoTrack=void 0),this._localImgScreenTrack&&(this._localImgScreenTrack.stop(),this._localImgScreenTrack=void 0),this._remoteAudioPlayer.forEach((function(e){return e.destroy()})),this._remoteAudioPlayer=new Map,this._remoteScreenPlayer.forEach((function(e){return e.destroy()})),this._remoteScreenPlayer=new Map,this._remoteVideoPlayer.forEach((function(e){return e.destroy()})),this._remoteVideoPlayer=new Map,this._publicStreamAudioPlayer.forEach((function(e){return e.destroy()})),this._publicStreamAudioPlayer=new Map,this._publicStreamVideoPlayer.forEach((function(e){return e.destroy()})),this._publicStreamVideoPlayer=new Map,this._roomConfig=void 0,this._audioMixingManager.destroy(),this._rtmClient.destroy(),null===(i=this._outsideRoom)||void 0===i||i.destroy(),this._publicStreamIds=new Map,this._audioDeviceManager.destroy()},t.prototype.publish=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:if($H.print("publish()"),!this._room||this._room.connectionState!==MV.CONNECTED)throw new tw(ZN.PUBLISH_BEFORE_JOIN,"join first");return!this._localVideoTrack&&this._localImgVideoTrack&&(this._localVideoTrack=wV(this._localImgVideoTrack),this._localVideoTrack.dummy=!0),[4,this._updatePublish()];case 1:return e.sent(),[2]}}))}))},t.prototype.unpublish=function(){var e,t;return ev(this,void 0,void 0,(function(){var r,i;return tv(this,(function(n){switch(n.label){case 0:if($H.print("unpublish()"),!this._room)throw new tw(ZN.UNPUBLISH_BEFORE_JOIN,"join first");return null===(t=null===(e=this._room.localStream)||void 0===e?void 0:e.observer)||void 0===t||t.setPublish(!1),[4,this._pubLock.lock()];case 1:r=n.sent(),n.label=2;case 2:return n.trys.push([2,4,5,6]),[4,this._room.unpublish()];case 3:return n.sent(),[3,6];case 4:throw(i=n.sent())instanceof tw?i:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",i);case 5:return r(),[7];case 6:return[2]}}))}))},t.prototype.subscribeUserStream=function(e,t,r,i){var n,o,a,s,c,u;return void 0===r&&(r=CP.STREAM_INDEX_MAIN),void 0===i&&(i={videoIndex:0}),ev(this,void 0,void 0,(function(){var d,l,h,p,f,_,v;return tv(this,(function(m){switch(m.label){case 0:if($H.print("subscribeStream()","userId: %o, mediaType: %o, streamType: %o, configure: %o",e,t,r,i),GD(e),xD(t,"mediaType",[OP.AUDIO_AND_VIDEO,OP.AUDIO_ONLY,OP.VIDEO_ONLY,OP.NONE]),xD(r,"streamType",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),UD(i.videoIndex,"config.videoIndex",0,2),!this._room||this._room.connectionState!==MV.CONNECTED)throw new tw(ZN.SUBSCRIBE_BEFORE_JOIN,"join first");if(d=this._room.remoteStreams.get(e),h=r===CP.STREAM_INDEX_SCREEN,!(l=h?null==d?void 0:d.find((function(e){return e.isScreen})):null==d?void 0:d.find((function(e){return!e.isScreen}))))throw new tw(ZN.STREAM_NOT_EXIST,"stream not exist");m.label=1;case 1:return m.trys.push([1,3,,4]),p=t,this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?t=OP.NONE:this._pauseAllSubscribeState.audio&&!this._pauseAllSubscribeState.video?t===OP.AUDIO_AND_VIDEO?t=OP.VIDEO_ONLY:t===OP.AUDIO_ONLY&&(t=OP.NONE):!this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video&&(t===OP.AUDIO_AND_VIDEO?t=OP.AUDIO_ONLY:t===OP.VIDEO_ONLY&&(t=OP.NONE)),t!==p&&$H.print("subscribeUserStream","due to pauseAllState change sub mediaType from ".concat(p," to ").concat(t)),f=l.hasSubscribed,[4,this._room.subscribe(l,t,i)];case 2:return m.sent(),t!==OP.AUDIO_AND_VIDEO&&t!==OP.AUDIO_ONLY||this._updateAudioPlayerState(l),t!==OP.AUDIO_AND_VIDEO&&t!==OP.VIDEO_ONLY||this._updateVideoPlayerState(l),((null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)||(null===(o=this._roomConfig)||void 0===o?void 0:o.isAutoSubscribeVideo))&&(l.audioTrack||l.videoTrack)&&(v={userId:e,isScreen:h,state:bP.SUBSCRIBE_SUCC},this.safeEmit(wD.onAutoSubscribeResult,v)),f||t!==OP.AUDIO_AND_VIDEO&&t!==OP.VIDEO_ONLY||null===(a=l.observer)||void 0===a||a.setSubscribeVideo(!0),f||t!==OP.AUDIO_AND_VIDEO&&t!==OP.AUDIO_ONLY||null===(s=l.observer)||void 0===s||s.setSubscribeAudio(!0),[3,4];case 3:throw _=m.sent(),((null===(c=this._roomConfig)||void 0===c?void 0:c.isAutoSubscribeAudio)||(null===(u=this._roomConfig)||void 0===u?void 0:u.isAutoSubscribeVideo))&&(v={userId:e,isScreen:h,state:bP.SUBSCRIBE_FAIL},this.safeEmit(wD.onAutoSubscribeResult,v)),_;case 4:return[2]}}))}))},t.prototype.unSubscribe=function(e,t){return ev(this,void 0,void 0,(function(){var r,i;return tv(this,(function(n){switch(n.label){case 0:if($H.print("unSubscribe()","userId: %s, isScreen: %o",e,t),GD(e),MD(t,"isScreen"),!this._room||this._room.connectionState!==MV.CONNECTED)throw new tw(ZN.SUBSCRIBE_BEFORE_JOIN,"join first");if(r=this._room.remoteStreams.get(e),!(i=t?null==r?void 0:r.find((function(e){return e.isScreen})):null==r?void 0:r.find((function(e){return!e.isScreen}))))throw new tw(ZN.STREAM_NOT_EXIST,"stream not exist");return[4,this._room.unsubscribe(i)];case 1:return n.sent(),this._updateAudioPlayerState(i),this._updateVideoPlayerState(i),[2]}}))}))},t.prototype.startVideoCapture=function(e){var t,r;return ev(this,void 0,void 0,(function(){var i,n,o,a,s;return tv(this,(function(c){switch(c.label){case 0:if($H.print("startVideoCapture()","deviceId: %s",e),jD(e)||LD(e,"deviceId"),this._localVideoTrack&&!this._localVideoTrack.dummy)throw new tw(ZN.REPEAT_CAPTURE,"Has already capture");return i=this._videoStreamConstraints,e&&(i.deviceId={exact:e},this._videoStreamConstraints=i),[4,DV(i)];case 1:return n=c.sent(),this._initLocalTrackEvents(n),this._localVideoTrack=n,this._videoPlayer&&this._videoPlayer.playVideo(n),o={},(a=null==n?void 0:n.getTrack())&&(o=a.getSettings()),this._room?(s=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||s)&&(this._visibility?this._updatePublish():this.safeEmit(wD.onAutoPublishResult,{isScreen:!1,state:TP.PUBLISH_FAIL})),null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableVideo(!0),[2,o]):[2,o]}}))}))},t.prototype.stopVideoCapture=function(){var e,t,r,i,n;return ev(this,void 0,void 0,(function(){return tv(this,(function(o){switch(o.label){case 0:if($H.print("stopVideoCapture()"),this._trackSourceType.video===vP.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");return null===(e=this._videoPlayer)||void 0===e||e.stop(),null===(t=this._localVideoTrack)||void 0===t||t.close(),this._localImgVideoTrack&&this._localVideoTrack?(null===(r=this._localVideoTrack)||void 0===r||r.setTrack(this._localImgVideoTrack),this._localVideoTrack.dummy=!0):this._localVideoTrack=void 0,this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:o.sent(),o.label=2;case 2:return null===(n=null===(i=this._room.localStream)||void 0===i?void 0:i.observer)||void 0===n||n.setEnableVideo(!1),[2]}}))}))},t.prototype.startAudioCapture=function(e){var t,r;return ev(this,void 0,void 0,(function(){var i,n,o;return tv(this,(function(a){switch(a.label){case 0:if($H.print("startAudioCapture()","deviceId: $o",e),jD(e)||LD(e,"deviceId"),this._localAudioTrack)throw new tw(ZN.REPEAT_CAPTURE,"Has already capture");return i=this._audioStreamConstraints,e&&(i.deviceId={exact:e},this._audioStreamConstraints=i),[4,PV(i)];case 1:return n=a.sent(),this._initLocalTrackEvents(n),this._localAudioTrack=n,this._tempMixingAudioTrack&&(this._localAudioTrack.mixType=this._tempMixingAudioTrack.type,this._localAudioTrack.mixedAudioTrack=this._tempMixingAudioTrack.track,delete this._tempMixingAudioTrack),this._room?(o=this._room._roomConfig.isAutoPublish,(this._room.hasPublished||o)&&(this._visibility?this._updatePublish():this.safeEmit(wD.onAutoPublishResult,{isScreen:!1,state:TP.PUBLISH_FAIL})),null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableAudio(!0),[2]):[2]}}))}))},t.prototype.stopAudioCapture=function(){var e,t,r;return ev(this,void 0,void 0,(function(){return tv(this,(function(i){switch(i.label){case 0:if($H.print("stopAudioCapture()"),null===(e=this._localAudioTrack)||void 0===e||e.close(),this._localAudioTrack=void 0,this._audioMixingManager.stopAll(),this._trackSourceType.audio===mP.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return this._room?this._room.hasPublished?[4,this._updatePublish()]:[3,2]:[2];case 1:i.sent(),i.label=2;case 2:return null===(r=null===(t=this._room.localStream)||void 0===t?void 0:t.observer)||void 0===r||r.setEnableAudio(!1),[2]}}))}))},t.prototype.getAudioMixingManager=function(){return $H.print("getAudioMixingManager()"),this._audioMixingManager},t.prototype.startScreenCapture=function(e){var t,r,i,n;return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var o,a,s,c;return tv(this,(function(u){switch(u.label){case 0:if($H.print("startScreenCapture()","config: %o",e),(null===(t=this._localScreenVideoTrack)||void 0===t?void 0:t.dummy)||null===(r=this._localScreenVideoTrack)||void 0===r||r.close(),this._localScreenVideoTrack=void 0,o=e.enableAudio,a=void 0!==o&&o,this._trackSourceType.screenVideo===vP.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as internal first");if(this._trackSourceType.screenAudio===mP.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as internal first");return[4,kV(a)];case 1:return s=u.sent(),this._localScreenVideoTrack=new AV(s.getVideoTracks()[0],gD()),(c=s.getAudioTracks()).length&&(this._localScreenAudioTrack=new CV(c[0],gD()),this._initLocalTrackEvents(this._localScreenAudioTrack)),null===(i=this._screenPlayer)||void 0===i||i.playVideo(this._localScreenVideoTrack),this._initLocalTrackEvents(this._localScreenVideoTrack),(null===(n=this._room)||void 0===n?void 0:n.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,3];case 2:u.sent(),u.label=3;case 3:return[2]}}))}))},t.prototype.stopScreenCapture=function(){var e,t,r,i;return ev(this,void 0,void 0,(function(){return tv(this,(function(n){switch(n.label){case 0:return $H.print("stopScreenCapture()"),null===(e=this._screenPlayer)||void 0===e||e.stop(),null===(t=this._localScreenVideoTrack)||void 0===t||t.close(),this._localImgScreenTrack&&this._localScreenVideoTrack?(this._localScreenVideoTrack.setTrack(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0):this._localScreenVideoTrack=void 0,null===(r=this._localScreenAudioTrack)||void 0===r||r.close(),this._localScreenAudioTrack=void 0,(null===(i=this._room)||void 0===i?void 0:i.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,2];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},t.prototype.publishScreen=function(){return ev(this,void 0,void 0,(function(){var e;return tv(this,(function(t){switch(t.label){case 0:if($H.print("publishScreen()"),!this._room||this._room.connectionState!==MV.CONNECTED)throw new tw(ZN.PUBLISH_BEFORE_JOIN,"join first");if(!this._visibility)throw new tw(ZN.NO_PUBLISH_PERMISSION,"no publish permission");t.label=1;case 1:return t.trys.push([1,3,,4]),!this._localScreenVideoTrack&&this._localImgScreenTrack&&(this._localScreenVideoTrack=wV(this._localImgScreenTrack),this._localScreenVideoTrack.dummy=!0),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 2:return t.sent(),[3,4];case 3:throw(e=t.sent())instanceof tw?e:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",e);case 4:return[2]}}))}))},t.prototype.unpublishScreen=function(){var e,t;return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(i){switch(i.label){case 0:if($H.print("unpublishScreen()"),!this._room)throw new tw(ZN.UNPUBLISH_BEFORE_JOIN,"join first");null===(t=null===(e=this._room.localScreenStream)||void 0===e?void 0:e.observer)||void 0===t||t.setPublish(!1),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._room.unpublishScreen()];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof tw?r:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.setLocalVideoPlayer=function(e,t){var r,i;if($H.print("setLocalVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),xD(e,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),t&&t.renderDom)return zD(t),e==CP.STREAM_INDEX_MAIN?(this._videoPlayer=new cF(t),this._initPlayerEvents(this._videoPlayer),this._videoPlayer.mirror(!!this._mirrorType),this._localVideoTrack&&!this._localVideoTrack.dummy&&this._videoPlayer.playVideo(this._localVideoTrack),this._videoPlayer.domElement):(this._screenPlayer=new cF($_($_({},t),{isScreen:!0})),this._initPlayerEvents(this._screenPlayer),this._localScreenVideoTrack&&!this._localScreenVideoTrack.dummy&&this._screenPlayer.playVideo(this._localScreenVideoTrack),this._screenPlayer.domElement);e==CP.STREAM_INDEX_MAIN?(null===(r=this._videoPlayer)||void 0===r||r.destroy(),delete this._videoPlayer):(null===(i=this._screenPlayer)||void 0===i||i.destroy(),delete this._screenPlayer)},t.prototype.startLiveTranscoding=function(e){var t;return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(i){switch(i.label){case 0:$H.print("startLiveTranscoding()","transcode: %o",e),LD(e.url,"liveTranscode.url"),this._liveTranscodeConfig=e,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(HP("started",this._liveTranscodeConfig))];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof tw?r:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.updateLiveTranscoding=function(e){var t;return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(i){switch(i.label){case 0:if($H.print("updateLiveTranscoding()","transcode: %o",e),!this._liveTranscodeConfig)return[2];this._liveTranscodeConfig=wB(this._liveTranscodeConfig,e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,null===(t=this._room)||void 0===t?void 0:t.liveControlMessage(HP("layoutChanged",this._liveTranscodeConfig))];case 2:return i.sent(),[3,4];case 3:throw(r=i.sent())instanceof tw?r:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",r);case 4:return[2]}}))}))},t.prototype.stopLiveTranscoding=function(){var e;return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){switch(r.label){case 0:if($H.print("stopLiveTranscoding()"),!this._liveTranscodeConfig)return[2];delete this._liveTranscodeConfig,r.label=1;case 1:return r.trys.push([1,3,,4]),[4,null===(e=this._room)||void 0===e?void 0:e.liveControlMessage({action:"stopped",type:"transcode"})];case 2:return r.sent(),[3,4];case 3:throw(t=r.sent())instanceof tw?t:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",t);case 4:return[2]}}))}))},t.prototype.setBusinessId=function(e){return $H.print("setBusinessId()","businessId: %s",e),!function(e){return"string"!=typeof e}(e)&&!this._room&&(_L.setStats({rtc_business_id:e}),this._businessId=e,!0)},t.prototype.setUserVisibility=function(e){var t;return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:if($H.print("setUserVisibility()","enable: %o",e),e=!!e,this._visibility===e)return[2];if(!this._room)return this._visibility=e,[2];if(this._room.connectionState!==MV.CONNECTED)throw new tw(ZN.NOT_CONNECTED_YET,"server not connected");return this._room.localStream&&(null===(t=this._room.localStream.observer)||void 0===t||t.setPublisher(e)),!e?[4,this._room.unpublish()]:[3,2];case 1:r.sent(),r.label=2;case 2:return[4,this._room.updateUserAttributes({role:e?KH.NORMAL_USER:KH.SILENT_USER})];case 3:return r.sent(),this._visibility=e,[2]}}))}))},t.prototype._initPlayerEvents=function(e,t){var r=this;void 0===t&&(t=!1),e.on("playback_event",(function(i){var n,o,a,s;switch(null===(o=null===(n=r._room)||void 0===n?void 0:n.remoteStreams.get(i.userId))||void 0===o||o.find((function(e){return!e.isScreen})),i.eventName){case"timeupdate":return;case"loadeddata":if("audio"===i.type)t?r.safeEmit(wD.onFirstPublicStreamAudioFrameDecoded,{publicStreamId:e.userId}):r.safeEmit(wD.onAudioFirstFrameDecoded,{userId:e.userId}),hL.firstRemoteAudioRender("",i.userId);else{var c={userId:e.userId,height:(null===(a=e.domElement)||void 0===a?void 0:a.videoHeight)||0,width:(null===(s=e.domElement)||void 0===s?void 0:s.videoWidth)||0};t?(c.publicStreamId=c.userId,delete c.userId,r.safeEmit(wD.onFirstPublicStreamVideoFrameDecoded,c),r.safeEmit(wD.onFirstPublicStreamVideoFrameRendered,c)):(r.safeEmit(wD.onVideoFirstFrameDecoded,c),r.safeEmit(wD.onVideoFirstFrameRendered,c)),hL.firstRemoteVideoRender("",i.userId)}break;case"autoplay-error":return t&&(i.publicStreamId=i.userId),void r.safeEmit(wD.onAutoplayFailed,i)}r.safeEmit(wD.onPlayerEvent,i)}))},t.prototype._initLocalTrackEvents=function(e){var t=this;e.on("track-ended",(function(e){var r=!1;e!==t._localScreenAudioTrack&&e!==t._localScreenVideoTrack||(r=!0),t.safeEmit(wD.onTrackEnded,{kind:e.getTrack().kind,isScreen:r})}))},t.prototype.setRemoteVideoPlayer=function(e,t){var r,i,n,o,a,s;$H.print("setRemoteVideoPlayer()","streamIndex: %o, videoPlayerOption: %o",e,t),xD(e,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),zD(t);var c=t.userId;if(t.renderDom){if(e==CP.STREAM_INDEX_MAIN){null===(r=this._remoteVideoPlayer.get(c))||void 0===r||r.destroy();var u=new cF(t);return this._initPlayerEvents(u),this._remoteVideoPlayer.set(c,u),(d=null===(n=null===(i=this._room)||void 0===i?void 0:i.remoteStreams.get(c))||void 0===n?void 0:n.find((function(e){return!e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}null===(o=this._remoteScreenPlayer.get(c))||void 0===o||o.destroy();var d;u=new cF($_($_({},t),{isScreen:!0}));return this._remoteScreenPlayer.set(c,u),this._initPlayerEvents(u),(d=null===(s=null===(a=this._room)||void 0===a?void 0:a.remoteStreams.get(c))||void 0===s?void 0:s.find((function(e){return e.isScreen})))&&this._updateVideoPlayerState(d),u.domElement}this._getRemotePlayer(c,e===CP.STREAM_INDEX_SCREEN).forEach((function(e){return null==e?void 0:e.destroy()}))},t.prototype.setLocalVideoMirrorType=function(e){$H.print("setLocalVideoMirrorType()","mirrorType: %o",e),xD(e,"mirrorType",[DP.MIRROR_TYPE_NONE,DP.MIRROR_TYPE_RENDER]),this._mirrorType=e,this._videoPlayer&&this._videoPlayer.mirror(!!e)},t.prototype.setAudioPlaybackDevice=function(e){var t;return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(i){switch(i.label){case 0:return $H.print("setAudioPlaybackDevice()","deviceId: %s",e),LD(e,"deviceId"),void 0===HTMLAudioElement.prototype.setSinkId?($H.print("setAudioPlaybackDevice failed","setSinkId not supported by current browser"),[2]):[4,dV.getDeviceById(e)];case 1:if(!(r=i.sent()))throw new tw(ZN.INVALID_DEVICE_ID,"audio playback device id ".concat(e," is invalid"));return this._remoteAudioPlayer.forEach((function(t){t.setPlaybackDevice(e)})),null===(t=this._audioPlayer)||void 0===t||t.setPlaybackDevice(e),this._audioPlaybackDeviceId=e,r&&this.safeEmit(wD.onAudioPlaybackDeviceChanged,r),hL.rtcAudioDevice(PU.PLAYOUT_DEVICE_SWITCH,e,0),[2]}}))}))},t.prototype.play=function(e){return ev(this,void 0,void 0,(function(){var t,r;return tv(this,(function(i){if($H.print("play()","userId | publicStreamId: %s",e),GD(e),t=this._remoteAudioPlayer.get(e),r=this._remoteVideoPlayer.get(e),t||(t=this._publicStreamAudioPlayer.get(e)),r||(r=this._publicStreamVideoPlayer.get(e)),t||(t=this._audioPlayer),r||(r=this._videoPlayer),!t&&!r)throw new tw(ZN.INVALID_PARAMS,"Player not found");return t&&t.manuallyPlay(),r&&r.manuallyPlay(),[2]}))}))},t.prototype.muteLocalAudio=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){if($H.print("muteLocalAudio()","muteState: %o",e),xD(e,"muteState",[gP.MUTE_STATE_OFF,gP.MUTE_STATE_ON]),!this._room)throw new tw(ZN.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("audio",e)]}))}))},t.prototype.muteLocalVideo=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){if($H.print("muteLocalVideo()","muteState: %o",e),xD(e,"muteState",[gP.MUTE_STATE_OFF,gP.MUTE_STATE_ON]),!this._room)throw new tw(ZN.UNPUBLISH_BEFORE_JOIN,"join first");return[2,this._room.muteLocalTrack("video",e)]}))}))},t.prototype.pauseAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,r=this;return tv(this,(function(i){return $H.print("pauseAllSubscribedStream()","mediaType: %o",e),xD(e,"mediaType",[RP.RTC_PAUSE_RESUME_CONTROL_AUDIO,RP.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,RP.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio&&this._pauseAllSubscribeState.video?[2,Promise.resolve()]:(t=function(){e===RP.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!0:e===RP.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!0:e===RP.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO&&(r._pauseAllSubscribeState.audio=!0,r._pauseAllSubscribeState.video=!0)},this._room?[2,this._room.pauseAllSubscribedStream(e).then((function(){t()}))]:(t(),[2,Promise.resolve()]))}))}))},t.prototype.resumeAllSubscribedStream=function(e){return ev(this,void 0,void 0,(function(){var t,r=this;return tv(this,(function(i){return $H.print("resumeAllSubscribedStream()","mediaType: %o",e),xD(e,"mediaType",[RP.RTC_PAUSE_RESUME_CONTROL_AUDIO,RP.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO,RP.RTC_PAUSE_RESUME_CONTROL_VIDEO]),this._pauseAllSubscribeState.audio||this._pauseAllSubscribeState.video?(t=function(){e===RP.RTC_PAUSE_RESUME_CONTROL_AUDIO?r._pauseAllSubscribeState.audio=!1:e===RP.RTC_PAUSE_RESUME_CONTROL_VIDEO?r._pauseAllSubscribeState.video=!1:e===RP.RTC_PAUSE_RESUME_CONTROL_AUDIO_AND_VIDEO&&(r._pauseAllSubscribeState.audio=!1,r._pauseAllSubscribeState.video=!1)},this._room?[2,this._room.resumeAllSubscribedStream(e).then((function(){var e,i;t(),null===(i=null===(e=r._room)||void 0===e?void 0:e.remoteStreams)||void 0===i||i.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r._updateAudioPlayerState(e),r._updateVideoPlayerState(e)}))}))}))]:(t(),[2,Promise.resolve()])):[2,Promise.resolve()]}))}))},t.prototype.sendUserMessage=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){if(GD(e),KD(t),!this._room||this._room.connectionState!==MV.CONNECTED)throw new tw(ZN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendUserBinaryMessage=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){if(GD(e),FD(t,"message"),KD(t),!this._room||this._room.connectionState!==MV.CONNECTED)throw new tw(ZN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendUserMessage(e,t)]}))}))},t.prototype.sendRoomMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){if(KD(e),!this._room||this._room.connectionState!==MV.CONNECTED)throw new tw(ZN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e)]}))}))},t.prototype.sendRoomBinaryMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){if(KD(e),!this._room||this._room.connectionState!==MV.CONNECTED)throw new tw(ZN.IM_BEFORE_JOIN,"join first");return[2,this._room.sendRoomMessage(e,!0)]}))}))},t.prototype.setAudioCaptureConfig=function(e){var t;return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var r;return tv(this,(function(i){switch(i.label){case 0:return $H.print("setAudioCaptureConfig()","config: %o",e),delete e.deviceId,BD(e),r=this._audioStreamConstraints.deviceId,this._audioStreamConstraints=e,r&&(this._audioStreamConstraints.deviceId=r),this._localAudioTrack?(this._localAudioTrack.audioCaptureConfig=this._audioStreamConstraints,[4,null===(t=this._localAudioTrack)||void 0===t?void 0:t.updateAudioCaptureConfig()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.prototype.setVideoCaptureConfig=function(e){var t;return void 0===e&&(e={}),ev(this,void 0,void 0,(function(){var r;return tv(this,(function(i){switch(i.label){case 0:return $H.print("setVideoCaptureConfig()","config: %o",e),delete e.deviceId,BD(e),r=this._videoStreamConstraints.deviceId,this._videoStreamConstraints=e,r&&(this._videoStreamConstraints.deviceId=r),this._localVideoTrack?(this._localVideoTrack.videoCaptureConfig=this._videoStreamConstraints,[4,null===(t=this._localVideoTrack)||void 0===t?void 0:t.updateVideoCaptureConfig()]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.prototype.enableSimulcastMode=function(e){return $H.print("enableSimulcastMode()","enabled: %o",e),this._enableSimulcast=e,!0},t.prototype.setVideoEncoderConfig=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return $H.print("setVideoEncoderConfig()","streamIndex: %o, descriptions: %o",e,t),Array.isArray(t)||(t=[t]),t.length>3&&(t=t.slice(0,3)),t.sort((function(e,t){return t.maxKbps-e.maxKbps})),e===CP.STREAM_INDEX_MAIN?this._videoStreamEncodeConfig=t:this._screenStreamEncodeConfig=t,[2]}))}))},t.prototype.sendSEIMessage=function(e,t,r){var i,n,o,a,s,c;$H.print("sendSEIMessage()","streamIdex: %o, message: %o, repeatCount: %o",e,t,r),xD(e,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),UD(r,"repeatCount",0,30);var u="string"==typeof t?new Uint8Array(RD.str2ab(t)):t;if(t.length){var d;if(e===CP.STREAM_INDEX_MAIN){if(!(null===(n=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===n?void 0:n.hasPublished))return;d=null===(o=this._room)||void 0===o?void 0:o.localStream}else{if(!(null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.hasPublished))return;d=null===(c=this._room)||void 0===c?void 0:c.localScreenStream}if(u.byteLength>4096)$H.print("sei size must not bigger than 4KB");else{var l=gD();d.seiList.push({content:u,uuid:l,repeatCount:r}),setTimeout((function(){if(d){var e=d.seiList.findIndex((function(e){return e.uuid===l}));e&&d.seiList.splice(e,1)}}),2e3)}}else $H.print("sei message must not be empty")},t.prototype.setAudioVolumeIndicationInterval=function(e){var t=this;$H.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,i,n,o;r=[],null===(e=t._room)||void 0===e||e.remoteStreams.forEach((function(e,t){var i;if(0!==e.length){var n=e.find((function(e){return!1===e.isScreen})),o=null===(i=null==n?void 0:n.audioTrack)||void 0===i?void 0:i.getAudioLevel();r.push({userId:t,volume:o||0})}}));var a=null===(i=t._localAudioTrack)||void 0===i?void 0:i.getAudioLevel();r.push({userId:(null===(o=null===(n=t._room)||void 0===n?void 0:n.roomInfo)||void 0===o?void 0:o.userInfo.userId)||"local_user",volume:a||0}),t.safeEmit(wD.onAudioVolumeIndication,{speakers:r})}),e)},t.prototype.enableAudioPropertiesReport=function(e){var t=this;void 0===e&&(e={}),$H.print("enableAudioPropertiesReport()","config %o: ",e);var r=e.interval,i=void 0===r?100:r,n=e.enableInBackground,o=void 0===n||n;this._stopAudioPropertiesReport(),i<=0||(i=Math.max(100,i),this._audioPropertiesReportTimer=self.setInterval((function(){if(o||"hidden"!==document.visibilityState){var e=[],r=t._audioDeviceManager.getRecordTrack()||t._localAudioTrack;if(r){var i=r.getAudioLevel();e.push({streamIndex:CP.STREAM_INDEX_MAIN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:kD(i)}})}if(t._localScreenAudioTrack){i=t._localScreenAudioTrack.getAudioLevel();e.push({streamIndex:CP.STREAM_INDEX_SCREEN,audioPropertiesInfo:{linearVolume:i,nonlinearVolume:kD(i)}})}if(t.safeEmit(wD.onLocalAudioPropertiesReport,e),t._room){var n=[];t._room.remoteStreams.forEach((function(e,r){e.forEach((function(e){var i,o;if(e.audioTrack){var a=e.audioTrack.getAudioLevel();n.push({streamKey:{userId:r,streamIndex:e.isScreen?CP.STREAM_INDEX_SCREEN:CP.STREAM_INDEX_MAIN,roomId:null===(o=null===(i=t._room)||void 0===i?void 0:i.roomInfo)||void 0===o?void 0:o.roomId},audioPropertiesInfo:{linearVolume:a,nonlinearVolume:kD(a)}})}}))})),t.safeEmit(wD.onRemoteAudioPropertiesReport,n)}}}),i))},t.prototype.setVideoSourceType=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v,m,S;return ev(this,void 0,void 0,(function(){var E,y,g;return tv(this,(function(b){switch(b.label){case 0:return $H.print("setVideoSourceType()","index: %o, videoSourceType: %o",e,t),xD(e,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),xD(t,"VideoSourceType",[vP.VIDEO_SOURCE_TYPE_EXTERNAL,vP.VIDEO_SOURCE_TYPE_INTERNAL]),E=e===CP.STREAM_INDEX_MAIN?"video":"screenVideo",this._trackSourceType[E]===t?[3,4]:(this._trackSourceType[E]=t,$H.print("setVideoSourceType","set ".concat(E," source type to ").concat(t)),this._localVideoTrack&&e===CP.STREAM_INDEX_MAIN?(g=!1,t===vP.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localVideoTrack.close()),null===(r=this._videoPlayer)||void 0===r||r.stop(),this._localVideoTrack=void 0,y=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,g?null===(a=null===(o=null===(n=this._room)||void 0===n?void 0:n.localStream)||void 0===o?void 0:o.observer)||void 0===a||a.setEnableVideo(!1):null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushVideo(!1),(null===(d=this._room)||void 0===d?void 0:d.hasPublished)||y?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:b.sent(),b.label=2;case 2:return this._localScreenVideoTrack&&e===CP.STREAM_INDEX_SCREEN?(g=!1,t===vP.VIDEO_SOURCE_TYPE_EXTERNAL&&(g=!0,this._localScreenVideoTrack.close()),null===(l=this._screenPlayer)||void 0===l||l.stop(),this._localScreenVideoTrack=void 0,g?null===(f=null===(p=null===(h=this._room)||void 0===h?void 0:h.localScreenStream)||void 0===p?void 0:p.observer)||void 0===f||f.setEnableVideo(!1):null===(m=null===(v=null===(_=this._room)||void 0===_?void 0:_.localScreenStream)||void 0===v?void 0:v.observer)||void 0===m||m.setPushVideo(!1),(null===(S=this._room)||void 0===S?void 0:S.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:b.sent(),b.label=4;case 4:return[2]}}))}))},t.prototype.setExternalVideoTrack=function(e,t){var r,i,n,o,a,s,c,u;return ev(this,void 0,void 0,(function(){var d;return tv(this,(function(l){switch(l.label){case 0:if($H.print("setExternalVideoTrack()","index: %o, track: %o",e,t),xD(e,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),e!==CP.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.video!==vP.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localVideoTrack=new OV(t,gD()),this._initLocalTrackEvents(this._localVideoTrack),null===(r=this._videoPlayer)||void 0===r||r.playVideo(this._localVideoTrack),d=null===(i=this._room)||void 0===i?void 0:i._roomConfig.isAutoPublish,(null===(n=this._room)||void 0===n?void 0:n.hasPublished)||d?[4,this._updatePublish()]:[3,2];case 1:l.sent(),l.label=2;case 2:if(e!==CP.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenVideo!==vP.VIDEO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setVideoSourceType as external first");return this._localScreenVideoTrack=new OV(t,gD()),this._initLocalTrackEvents(this._localScreenVideoTrack),null===(o=this._screenPlayer)||void 0===o||o.playVideo(this._localScreenVideoTrack),null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localScreenStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushVideo(!0),(null===(u=this._room)||void 0===u?void 0:u.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:l.sent(),l.label=4;case 4:return[2]}}))}))},t.prototype.setAudioSourceType=function(e,t){var r,i,n,o,a,s,c,u,d,l,h,p,f,_,v;return ev(this,void 0,void 0,(function(){var m,S,E;return tv(this,(function(y){switch(y.label){case 0:return $H.print("setAudioSourceType()","index: %o, audioSourceType: %o",e,t),xD(e,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),xD(t,"audioSourceType",[mP.AUDIO_SOURCE_TYPE_EXTERNAL,mP.AUDIO_SOURCE_TYPE_INTERNAL]),m=e===CP.STREAM_INDEX_MAIN?"audio":"screenAudio",this._trackSourceType[m]===t?[3,4]:(this._trackSourceType[m]=t,$H.print("setVideoSourceType","set ".concat(m," source type to ").concat(t)),this._localAudioTrack&&e===CP.STREAM_INDEX_MAIN?(E=!1,this._trackSourceType.audio===mP.AUDIO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localAudioTrack.close()),this._localAudioTrack=void 0,S=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,E?null===(o=null===(n=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setEnableAudio(!1):null===(c=null===(s=null===(a=this._room)||void 0===a?void 0:a.localStream)||void 0===s?void 0:s.observer)||void 0===c||c.setPushAudio(!1),(null===(u=this._room)||void 0===u?void 0:u.hasPublished)||S?[4,this._updatePublish()]:[3,2]):[3,2]);case 1:y.sent(),y.label=2;case 2:return this._localScreenAudioTrack&&e===CP.STREAM_INDEX_SCREEN?(E=!1,this._trackSourceType.audio===mP.AUDIO_SOURCE_TYPE_EXTERNAL&&(E=!0,this._localScreenAudioTrack.close()),this._localScreenAudioTrack=void 0,E?null===(h=null===(l=null===(d=this._room)||void 0===d?void 0:d.localScreenStream)||void 0===l?void 0:l.observer)||void 0===h||h.setEnableAudio(!1):null===(_=null===(f=null===(p=this._room)||void 0===p?void 0:p.localScreenStream)||void 0===f?void 0:f.observer)||void 0===_||_.setPushAudio(!1),(null===(v=this._room)||void 0===v?void 0:v.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4]):[3,4];case 3:y.sent(),y.label=4;case 4:return[2]}}))}))},t.prototype.setExternalAudioTrack=function(e,t){var r,i,n,o,a,s,c,u,d;return ev(this,void 0,void 0,(function(){var l;return tv(this,(function(h){switch(h.label){case 0:if($H.print("setExternalAudioTrack()","index: %o, track: %o",e,t),xD(e,"streamIndex",[CP.STREAM_INDEX_MAIN,CP.STREAM_INDEX_SCREEN]),e!==CP.STREAM_INDEX_MAIN)return[3,2];if(this._trackSourceType.audio!==mP.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localAudioTrack=new NV(t,gD()),this._initLocalTrackEvents(this._localAudioTrack),l=null===(r=this._room)||void 0===r?void 0:r._roomConfig.isAutoPublish,null===(o=null===(n=null===(i=this._room)||void 0===i?void 0:i.localStream)||void 0===n?void 0:n.observer)||void 0===o||o.setPushAudio(!0),(null===(a=this._room)||void 0===a?void 0:a.hasPublished)||l?[4,this._updatePublish()]:[3,2];case 1:h.sent(),h.label=2;case 2:if(e!==CP.STREAM_INDEX_SCREEN)return[3,4];if(this._trackSourceType.screenAudio!==mP.AUDIO_SOURCE_TYPE_EXTERNAL)throw new tw(ZN.STREAM_TYPE_NOT_MATCH,"setAudioSourceType as external first");return this._localScreenAudioTrack=new NV(t,gD()),this._initLocalTrackEvents(this._localScreenAudioTrack),null===(u=null===(c=null===(s=this._room)||void 0===s?void 0:s.localScreenStream)||void 0===c?void 0:c.observer)||void 0===u||u.setPushAudio(!0),(null===(d=this._room)||void 0===d?void 0:d.hasScreenPublished)?[4,this._updateScreenPublish()]:[3,4];case 3:h.sent(),h.label=4;case 4:return[2]}}))}))},t.prototype.login=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return $H.print("login()","token: %o, userInfo: %o",e,t),jD(e)||LD(e,"token"),GD(t),[2,this._rtmClient.login(e,t)]}))}))},t.prototype.logout=function(){return ev(this,void 0,void 0,(function(){return tv(this,(function(e){return $H.print("logout()"),[2,this._rtmClient.logout()]}))}))},t.prototype.updateLoginToken=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return $H.print("updateLoginToken()","token: %o",e),jD(e)||LD(e,"token"),[2,this._rtmClient.updateLoginToken(e)]}))}))},t.prototype.getPeerOnlineStatus=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return $H.print("getPeerOnlineStatus()","userId: %o",e),GD(e),[2,this._rtmClient.getPeerOnlineStatus(e)]}))}))},t.prototype.sendUserMessageOutsideRoom=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return GD(e),KD(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.sendUserBinaryMessageOutsideRoom=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return GD(e),FD(t,"message"),KD(t),[2,this._rtmClient.sendUserMessageOutsideRoom(e,t)]}))}))},t.prototype.setServerParams=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){return $H.print("setServerParams()","signature: %o, url: %0",e,t),LD(e,"signature"),LD(t,"url"),[2,this._rtmClient.setServerParams(e,t)]}))}))},t.prototype.sendServerMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return LD(e,"message"),KD(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.sendServerBinaryMessage=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){return FD(e,"message"),KD(e),[2,this._rtmClient.sendServerMessage(e)]}))}))},t.prototype.startCloudProxy=function(e){if(this._room)throw new tw(ZN.START_CLOUD_PROXY_AFTER_JOIN,"[startCloudProxy] should be invoke before join room ");var t;$H.print("startCloudProxy()",e),LD(e.logProxy,"logProxy"),LD(e.accessProxy,"accessProxy"),LD(e.configProxy,"configProxy"),this._originIceConfigRequestUrls=GP("ICE_CONFIG_REQUEST_URLS"),this._originLogServerUrl=GP("LOG_SERVER_URL"),this._originConfigServerUrls=GP("CONFIG_REQUEST_DOMAINS"),jP("ICE_CONFIG_REQUEST_URLS",e.accessProxy),jP("LOG_SERVER_URL",(void 0===(t=e.logProxy)&&(t=""),"https://".concat(t,"/video/v1/webrtc_log/"))),jP("CONFIG_REQUEST_DOMAINS",[e.configProxy]),this._useCloudProxy=!0},t.prototype.stopCloudProxy=function(){if(this._room)throw new tw(ZN.STOP_CLOUD_PROXY_BEFORE_LEAVE,"[stopCloudProxy] should be invoke after leave room ");$H.print("stopCloudProxy()"),jP("ICE_CONFIG_REQUEST_URLS",[]),jP("LOG_SERVER_URL",this._originLogServerUrl),jP("CONFIG_REQUEST_DOMAINS",this._originConfigServerUrls),this._useCloudProxy=!1,this._startCloudProxyTimestamp=void 0},t.prototype.startPushPublicStream=function(e,t){return ev(this,void 0,void 0,(function(){var r,i=this;return tv(this,(function(n){if($H.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),HD(e),!this._room||this._room.connectionState!==MV.CONNECTED)throw new tw(ZN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");if(this._publicStreamIds.get(e))throw new tw(ZN.REPEAT_PUSH,"repeat push public media stream");return r=zP(e,"started",t),[2,this._room.publicStreamControlMessage(r).then((function(){i._publicStreamIds.set(e,e)}))]}))}))},t.prototype.updatePublicStreamParam=function(e,t){return ev(this,void 0,void 0,(function(){var r;return tv(this,(function(i){if($H.print("startPushPublicStream()","publicStreamId: %o, publicStreamParam: %o",e,t),HD(e),!this._room||this._room.connectionState!==MV.CONNECTED)throw new tw(ZN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return r=zP(e,"layoutChanged",t),[2,this._room.publicStreamControlMessage(r)]}))}))},t.prototype.stopPushPublicStream=function(e){return ev(this,void 0,void 0,(function(){var t=this;return tv(this,(function(r){if($H.print("startPushPublicStream()","publicStreamId: %o",e),HD(e),!this._room||this._room.connectionState!==MV.CONNECTED)throw new tw(ZN.START_PUBLIC_STREAM_BEFORE_JOIN,"join first");return[2,this._room.publicStreamControlMessage({type:"publicstream",action:"stopped",publicStreamID:e}).then((function(){t._publicStreamIds.delete(e)}))]}))}))},t.prototype.startPlayPublicStream=function(e){var t;return ev(this,void 0,void 0,(function(){var r,i,n,o=this;return tv(this,(function(a){switch(a.label){case 0:return HD(e),this._outsideRoom?[3,2]:(this._outsideRoom=new JH(this._appId),this._outsideRoom.on(HV.RESUBSCRIBE,(function(e){var t,r,i=e.stream;if(i){var n=o._publicStreamAudioPlayer.get(i.streamId);n&&i.audioTrack&&(n.stop(),n.playAudio(null===(t=e.stream)||void 0===t?void 0:t.audioTrack));var a=o._publicStreamVideoPlayer.get(i.streamId);a&&i.videoTrack&&a.playVideo(null===(r=e.stream)||void 0===r?void 0:r.videoTrack)}})),null===(t=this._outsideRoom)||void 0===t||t.on("onRemoteStreamStats",(function(e){e.publicStreamId=e.userId,delete e.userId,delete e.isScreen,o.safeEmit(wD.onPublicStreamStats,e)})),[4,this._outsideRoom.connect()]);case 1:a.sent(),a.label=2;case 2:return[4,this._outsideRoom.startPlayPublicStream(e)];case 3:return r=a.sent(),(i=this._publicStreamVideoPlayer.get(e))&&(null==r?void 0:r.videoTrack)&&i.playVideo(r.videoTrack,r),!(n=this._publicStreamAudioPlayer.get(e))&&(null==r?void 0:r.audioTrack)&&(n=new uF(e),this._initPlayerEvents(n,!0),n.playAudio(r.audioTrack),this._publicStreamAudioPlayer.set(e,n)),[2]}}))}))},t.prototype.stopPlayPublicStream=function(e){return ev(this,void 0,void 0,(function(){var t;return tv(this,(function(r){return this._outsideRoom?(this._outsideRoom.stopPlayPublicStream(e),(t=this._publicStreamAudioPlayer.get(e))&&(t.destroy(),this._publicStreamAudioPlayer.delete(e)),[2]):[2]}))}))},t.prototype.setPublicStreamVideoPlayer=function(e,t){var r,i;$H.print("setPublicStreamVideoPlayer()","publicStreamId: %o, videoPlayerOption: %o",e,t);var n=this._publicStreamVideoPlayer.get(e);if(!(null==t?void 0:t.renderDom)&&n)return n.destroy(),void this._publicStreamVideoPlayer.delete(e);if(!n){n=new cF($_($_({},t),{userId:e})),this._initPlayerEvents(n,!0),this._publicStreamVideoPlayer.set(e,n);var o=null===(i=null===(r=this._outsideRoom)||void 0===r?void 0:r.remoteStreams)||void 0===i?void 0:i.get(e);(null==o?void 0:o.videoTrack)&&n.playVideo(o.videoTrack,o)}},t.prototype.setDummyCaptureImagePath=function(e,t){return ev(this,void 0,void 0,(function(){var r=this;return tv(this,(function(i){return[2,new Promise((function(i,n){LD(t,"filePath");var o=new Image;o.crossOrigin="anonymous",o.src=t,o.onload=function(){try{var t=document.createElement("canvas"),a=t.getContext("2d");if(!a)return n(new tw(ZN.UNEXPECTED_ERROR,"Not support canvas"));t.width=o.width,t.height=o.height,a.drawImage(o,0,0,o.width,o.height),clearInterval(r._dummyTimer),r._dummyTimer=window.setInterval((function(){a.drawImage(o,0,0,o.width,o.height)}),200);var s=t.captureStream(5).getVideoTracks()[0];e===CP.STREAM_INDEX_MAIN?r._localImgVideoTrack=s:r._localImgScreenTrack=s,i()}catch(e){n(new tw(ZN.UNEXPECTED_ERROR,e.message))}},o.onerror=function(){n(new tw(ZN.UNEXPECTED_ERROR,"Load image error"))}}))]}))}))},t.prototype.defaultTranscoding=function(){return JSON.parse(JSON.stringify(KP))},t.prototype._updatePublish=function(e){return void 0===e&&(e=!1),ev(this,void 0,void 0,(function(){var t,r;return tv(this,(function(i){switch(i.label){case 0:if($H.print("_updatePublish()"),!this._visibility)throw new tw(ZN.NO_PUBLISH_PERMISSION,"no publish permission");return[4,this._pubLock.lock()];case 1:if(t=i.sent(),!this._room||this._room.connectionState!==MV.CONNECTED)return t(),[2];i.label=2;case 2:return i.trys.push([2,4,5,6]),[4,this._room.publish(this._videoStreamEncodeConfig,this._enableSimulcast,this._localVideoTrack,this._localAudioTrack,e)];case 3:return i.sent(),[3,6];case 4:throw(r=i.sent())instanceof tw?r:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",r);case 5:return t(),[7];case 6:return[2]}}))}))},t.prototype.startAudioPlaybackDeviceTest=function(e,t){return ev(this,void 0,void 0,(function(){return tv(this,(function(r){switch(r.label){case 0:return $H.print("startAudioPlaybackDeviceTest()","filePath: %o, indicationInterval: %o",e,t),LD(e,"filePath"),UD(t,"indicationInterval"),[4,this._audioDeviceManager.startAudioPlaybackDeviceTest(e,t)];case 1:return[2,r.sent()]}}))}))},t.prototype.stopAudioPlaybackDeviceTest=function(){$H.print("stopAudioPlaybackDeviceTest()"),this._audioDeviceManager.stopAudioPlaybackDeviceTest()},t.prototype.startAudioDeviceRecordTest=function(e){return ev(this,void 0,void 0,(function(){return tv(this,(function(t){switch(t.label){case 0:return $H.print("startAudioDeviceRecordTest()","indicationInterval: %o",e),UD(e,"indicationInterval"),[4,this._audioDeviceManager.startAudioDeviceRecordTest(e)];case 1:return t.sent(),[2]}}))}))},t.prototype.stopAudioDeviceRecordAndPlayTest=function(){$H.print("stopAudioDeviceRecordAndPlayTest()"),this._audioDeviceManager.stopAudioDeviceRecordAndPlayTest()},t.prototype.stopAudioDevicePlayTest=function(){$H.print("stopAudioDevicePlayTest()"),this._audioDeviceManager.stopAudioDevicePlayTest()},t.prototype._updateScreenPublish=function(){return ev(this,void 0,void 0,(function(){var e,t;return tv(this,(function(r){switch(r.label){case 0:return $H.print("_updateScreenPublish()"),[4,this._pubLock.lock()];case 1:if(e=r.sent(),!this._room||this._room.connectionState!==MV.CONNECTED)return e(),[2];r.label=2;case 2:return r.trys.push([2,4,5,6]),[4,this._room.publishScreen(this._screenStreamEncodeConfig,this._localScreenVideoTrack,this._localScreenAudioTrack)];case 3:return r.sent(),[3,6];case 4:throw(t=r.sent())instanceof tw?t:new tw(ZN.UNEXPECTED_ERROR,"unexpected error",t);case 5:return e(),[7];case 6:return[2]}}))}))},t.prototype._updateAudioPlayerState=function(e){$H.print("_updateAudioPlayerState()");var t,r=e.userId,i=e.isScreen;if(t=i?this._remoteAudioPlayer.get("".concat(r,"_screen")):this._remoteAudioPlayer.get(r),e.audioTrack){if(!t){var n=i?"".concat(r,"_screen"):r;t=new uF(n),this._initPlayerEvents(t),this._remoteAudioPlayer.set(n,t),this._audioPlaybackDeviceId&&t.setPlaybackDevice(this._audioPlaybackDeviceId)}t.playAudio(e.audioTrack)}else null==t||t.stop()},t.prototype._updateVideoPlayerState=function(e){$H.print("_updateVideoPlayerState()");var t,r=e.userId;t=e.isScreen?this._remoteScreenPlayer.get(r):this._remoteVideoPlayer.get(r),e.videoTrack?t&&t.playVideo(e.videoTrack,e):null==t||t.stop()},t.prototype._onAddStream=function(e){var t,r,i,n,o,a,s,c,u=e.stream,d={userId:u.userId,isScreen:u.isScreen,hasVideo:u.hasVideo,hasAudio:u.hasAudio,videoStreamDescriptions:u.attributes.videoDescriptions};this.safeEmit(wD.onStreamAdd,{stream:d});var l=null;(null===(t=this._roomConfig)||void 0===t?void 0:t.isAutoSubscribeAudio)&&(l=OP.AUDIO_ONLY),(null===(r=this._roomConfig)||void 0===r?void 0:r.isAutoSubscribeVideo)&&(l=OP.VIDEO_ONLY),(null===(i=this._roomConfig)||void 0===i?void 0:i.isAutoSubscribeVideo)&&(null===(n=this._roomConfig)||void 0===n?void 0:n.isAutoSubscribeAudio)&&(l=OP.AUDIO_AND_VIDEO),$H.print("_onAddStream","autoSubType: ".concat(l)),null===l||u.isScreen||(l===OP.AUDIO_AND_VIDEO?(null===(o=u.observer)||void 0===o||o.setAutoSubscribeVideo(!0),null===(a=u.observer)||void 0===a||a.setAutoSubscribeAudio(!0)):l===OP.AUDIO_ONLY?null===(s=u.observer)||void 0===s||s.setAutoSubscribeAudio(!0):l===OP.VIDEO_ONLY&&(null===(c=u.observer)||void 0===c||c.setAutoSubscribeVideo(!0)),this.subscribeUserStream(u.userId,l))},t.prototype._onRemoveStream=function(e){var t,r=this,i=e.stream,n={userId:i.userId,isScreen:i.isScreen,hasVideo:i.hasVideo,hasAudio:i.hasAudio,videoStreamDescriptions:[]},o=null!==(t=ez[e.reason])&&void 0!==t?t:NP.STREAM_REMOVE_REASON_OTHER;this.safeEmit(wD.onStreamRemove,{stream:n,reason:o}),this._getRemotePlayer(i.userId,i.isScreen).forEach((function(e){if(!(null==i?void 0:i._workaround_1_)){var t=i.isScreen?"".concat(i.userId,"_screen"):i.userId;r._remoteAudioPlayer.delete(t),i.isScreen?r._remoteScreenPlayer.delete(i.userId):r._remoteVideoPlayer.delete(i.userId),null==e||e.destroy()}}))},t.prototype._onUserConnection=function(e){this.safeEmit(wD.onUserJoined,e)},t.prototype._onUserLeave=function(e){this.safeEmit(wD.onUserLeave,e)},t.prototype._onRoomError=function(e){var t;this.safeEmit(wD.onError,e),null===(t=this._room)||void 0===t||t.destroy(),this._room=void 0},t.prototype._onConnectionStateChange=function(e){void 0!==this._startCloudProxyTimestamp&&this._useCloudProxy&&e.state===wP.CONNECTION_STATE_CONNECTED&&this.safeEmit(wD.onCloudProxyConnected,{interval:Date.now()-this._startCloudProxyTimestamp}),this.safeEmit(wD.onConnectionStateChanged,e)},t.prototype._getRemotePlayer=function(e,t){return[this._remoteAudioPlayer.get(t?"".concat(e,"_screen"):e),(t?this._remoteScreenPlayer:this._remoteVideoPlayer).get(e)]},t.prototype._stopAudioPropertiesReport=function(){null!==this._audioPropertiesReportTimer&&(clearInterval(this._audioPropertiesReportTimer),this._audioPropertiesReportTimer=null)},t.prototype._onResubscribe=function(e){e.stream&&(this._getRemotePlayer(e.stream.userId,e.stream.isScreen).forEach((function(e){return null==e?void 0:e.stop()})),this._updateAudioPlayerState(e.stream),this._updateVideoPlayerState(e.stream))},t.prototype._onSubscribePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onRemovePushTrack=function(e){e.stream&&this._updateAudioPlayerState(e.stream)},t.prototype._onVideoFirstFrameDecoded=function(e){this.safeEmit(wD.onVideoFirstFrameDecoded,e)},t.prototype._onDeviceStateChange=function(e){this.safeEmit(wD.onMediaDeviceStateChanged,e)},t.prototype._onUserMuteAudio=function(e){this.safeEmit(wD.onUserMuteAudio,e)},t.prototype._onUserMuteVideo=function(e){this.safeEmit(wD.onUserMuteVideo,e)},t.prototype._onCustomMessage=function(e){var t=e.message;e.binary?this.safeEmit(wD.onRoomBinaryMessageReceived,{userId:e.clientId,message:t}):this.safeEmit(wD.onRoomMessageReceived,{userId:e.clientId,message:t})},t.prototype._onUserMessageReceived=function(e){this.safeEmit(wD.onUserMessageReceived,e)},t.prototype._onUserBinaryMessageReceived=function(e){this.safeEmit(wD.onUserBinaryMessageReceived,e)},t.prototype._onLiveTranscodingResult=function(e){this.safeEmit(wD.onLiveTranscodingResult,e)},t.prototype._onUserTokenWillExpire=function(){this.safeEmit(wD.onTokenWillExpire)},t.prototype._onPushPublicStreamResult=function(e){this.safeEmit(wD.onPushPublicStreamResult,e)},t.prototype._handleRTMClient=function(e){var t=this;e.on("onUserMessageReceivedOutsideRoom",(function(e){t.safeEmit(wD.onUserMessageReceivedOutsideRoom,e)})),e.on("onUserBinaryMessageReceivedOutsideRoom",(function(e){t.safeEmit(wD.onUserBinaryMessageReceivedOutsideRoom,e)})),e.on("onUserDisconnection",(function(){t.safeEmit(wD.onError,{errorCode:ZN.RTM_DUPLICATE_LOGIN})})),e.on("onRTMTokenError",(function(){t.safeEmit(wD.onError,{errorCode:ZN.RTM_TOKEN_ERROR})}))},Object.defineProperty(t.prototype,"waitForNewToken",{get:function(){return!!this._tempRoomConfig},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localAudioTrack",{get:function(){return this._localAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localVideoTrack",{get:function(){return this._localVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenAudioTrack",{get:function(){return this._localScreenAudioTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localScreenVideoTrack",{get:function(){return this._localScreenVideoTrack},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteStreams",{get:function(){var e,t,r=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteStreams)&&(null===(t=this._room)||void 0===t||t.remoteStreams.forEach((function(e){Array.isArray(e)&&e.forEach((function(e){r.push({userId:e.userId,isScreen:e.isScreen,hasVideo:e.hasVideo,hasAudio:e.hasAudio,videoStreamDescriptions:e.attributes.videoDescriptions})}))}))),r},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"remoteUsers",{get:function(){var e,t,r=[];return(null===(e=this._room)||void 0===e?void 0:e.remoteUsers)&&(null===(t=this._room)||void 0===t||t.remoteUsers.forEach((function(e){r.push({userId:e.userId})}))),r},enumerable:!1,configurable:!0}),t.prototype._handleAudioDeviceManager=function(){var e=this;this._audioDeviceManager.on("onAudioPlaybackDeviceTestVolume",(function(t){e.safeEmit(wD.onAudioPlaybackDeviceTestVolume,t)}))},Q_([EL()],t.prototype,"updateToken",null),Q_([EL()],t.prototype,"switchCamera",null),Q_([EL()],t.prototype,"switchMicrophone",null),Q_([EL()],t.prototype,"joinRoom",null),Q_([EL()],t.prototype,"leaveRoom",null),Q_([EL()],t.prototype,"destroy",null),Q_([EL()],t.prototype,"publish",null),Q_([EL()],t.prototype,"unpublish",null),Q_([EL()],t.prototype,"subscribeUserStream",null),Q_([EL()],t.prototype,"unSubscribe",null),Q_([EL()],t.prototype,"startVideoCapture",null),Q_([EL()],t.prototype,"stopVideoCapture",null),Q_([EL()],t.prototype,"startAudioCapture",null),Q_([EL()],t.prototype,"stopAudioCapture",null),Q_([EL()],t.prototype,"getAudioMixingManager",null),Q_([EL()],t.prototype,"startScreenCapture",null),Q_([EL()],t.prototype,"stopScreenCapture",null),Q_([EL()],t.prototype,"publishScreen",null),Q_([EL()],t.prototype,"unpublishScreen",null),Q_([EL()],t.prototype,"setLocalVideoPlayer",null),Q_([EL()],t.prototype,"startLiveTranscoding",null),Q_([EL()],t.prototype,"updateLiveTranscoding",null),Q_([EL()],t.prototype,"stopLiveTranscoding",null),Q_([EL()],t.prototype,"setBusinessId",null),Q_([EL()],t.prototype,"setUserVisibility",null),Q_([EL()],t.prototype,"setRemoteVideoPlayer",null),Q_([EL()],t.prototype,"setLocalVideoMirrorType",null),Q_([EL()],t.prototype,"setAudioPlaybackDevice",null),Q_([EL()],t.prototype,"play",null),Q_([EL()],t.prototype,"muteLocalAudio",null),Q_([EL()],t.prototype,"muteLocalVideo",null),Q_([EL()],t.prototype,"pauseAllSubscribedStream",null),Q_([EL()],t.prototype,"resumeAllSubscribedStream",null),Q_([EL()],t.prototype,"sendUserMessage",null),Q_([EL()],t.prototype,"sendUserBinaryMessage",null),Q_([EL()],t.prototype,"sendRoomMessage",null),Q_([EL()],t.prototype,"sendRoomBinaryMessage",null),Q_([EL()],t.prototype,"setAudioCaptureConfig",null),Q_([EL()],t.prototype,"setVideoCaptureConfig",null),Q_([EL()],t.prototype,"enableSimulcastMode",null),Q_([EL()],t.prototype,"setVideoEncoderConfig",null),Q_([EL()],t.prototype,"sendSEIMessage",null),Q_([EL()],t.prototype,"setAudioVolumeIndicationInterval",null),Q_([EL()],t.prototype,"enableAudioPropertiesReport",null),Q_([EL()],t.prototype,"setVideoSourceType",null),Q_([EL()],t.prototype,"setExternalVideoTrack",null),Q_([EL()],t.prototype,"setAudioSourceType",null),Q_([EL()],t.prototype,"setExternalAudioTrack",null),Q_([EL("rtm")],t.prototype,"login",null),Q_([EL("rtm")],t.prototype,"logout",null),Q_([EL("rtm")],t.prototype,"updateLoginToken",null),Q_([EL("rtm")],t.prototype,"getPeerOnlineStatus",null),Q_([EL("rtm")],t.prototype,"sendUserMessageOutsideRoom",null),Q_([EL("rtm")],t.prototype,"sendUserBinaryMessageOutsideRoom",null),Q_([EL("rtm")],t.prototype,"setServerParams",null),Q_([EL("rtm")],t.prototype,"sendServerMessage",null),Q_([EL("rtm")],t.prototype,"sendServerBinaryMessage",null),Q_([EL()],t.prototype,"startCloudProxy",null),Q_([EL()],t.prototype,"stopCloudProxy",null),Q_([EL()],t.prototype,"startPushPublicStream",null),Q_([EL()],t.prototype,"updatePublicStreamParam",null),Q_([EL()],t.prototype,"stopPushPublicStream",null),Q_([EL("outsideRoom")],t.prototype,"startPlayPublicStream",null),Q_([EL("outsideRoom")],t.prototype,"stopPlayPublicStream",null),Q_([EL("outsideRoom")],t.prototype,"setPublicStreamVideoPlayer",null),Q_([EL()],t.prototype,"setDummyCaptureImagePath",null),Q_([EL()],t.prototype,"startAudioPlaybackDeviceTest",null),Q_([EL()],t.prototype,"stopAudioPlaybackDeviceTest",null),Q_([EL()],t.prototype,"startAudioDeviceRecordTest",null),Q_([EL()],t.prototype,"stopAudioDeviceRecordAndPlayTest",null),Q_([EL()],t.prototype,"stopAudioDevicePlayTest",null),t}($D),ez={"client unpublished":NP.STREAM_REMOVE_REASON_UNPUBLISH,"publish failed":NP.STREAM_REMOVE_REASON_PUBLISH_FAILED,"stream removed":NP.STREAM_REMOVE_REASON_KEEP_LIVE_FAILED,"client disconnected":NP.STREAM_REMOVE_REASON_CLIENT_DISCONNECTED,"client republish":NP.STREAM_REMOVE_REASON_REPUBLISH},tz=new qD("VERTC",0);[_L,vL,mL].forEach((function(e){return e.setStats({rtc_sdk_version:BP.VERSION,product_line:aU.RTC,report_version:sU.W_5,os:cU.WEB,device_id:wL.getDeviceId(),user_agent:ID()?"":null===navigator||void 0===navigator?void 0:navigator.userAgent})}));var rz=function(e){return tz.print("createEngine","Invoke VERTC.createEngine"),LD(e,"appId"),[_L,vL,mL].forEach((function(t){return t.setStats({rtc_app_id:e})})),hL.sdkInitEngine(Date.now(),VU.BEGIN),new QH(e)},iz=function(e){if(tz.print("destroyEngine","Invoke VERTC.destroyEngine"),!(e instanceof QH))throw new tw(ZN.INVALID_ENGINE,"Invalid engine object");e.destroy(),hL.sdkInitEngine(Date.now(),VU.END)},nz=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,dV.getDevices()]}))}))},oz=function(e){return void 0===e&&(e={video:!0,audio:!0}),ev(void 0,void 0,void 0,(function(){var t,r,i,n,o;return tv(this,(function(a){switch(a.label){case 0:if(t=e.video,r=e.audio,i={video:!1,audio:!1},!t)return[3,4];a.label=1;case 1:return a.trys.push([1,3,,4]),n=i,[4,dV.getVideoPermission()];case 2:return n.video=a.sent(),[3,4];case 3:return a.sent(),[3,4];case 4:if(!r)return[3,8];a.label=5;case 5:return a.trys.push([5,7,,8]),o=i,[4,dV.getAudioPermission()];case 6:return o.audio=a.sent(),[3,8];case 7:return a.sent(),[3,8];case 8:return[2,i]}}))}))},az=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,dV.getMicrophones()]}))}))},sz=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,dV.getCameras()]}))}))},cz=function(){return ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){return[2,dV.getAudioPlayback()]}))}))},uz=function(){return BP.VERSION},dz=function(){return hL.rtcSdkApiCall("isSupported",0,""),ev(void 0,void 0,void 0,(function(){var e;return tv(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),!ID()&&window.RTCPeerConnection&&window.RTCPeerConnection.prototype.addTransceiver&&window.RTCPeerConnection.prototype.createDataChannel?[4,vx()]:[2,!1];case 1:return[2,null==(e=t.sent())?void 0:e.includes("H264")];case 2:return t.sent(),[2,!1];case 3:return[2]}}))}))},lz=function(){return hL.rtcSdkApiCall("getSupportedCodecs",0,""),ev(void 0,void 0,void 0,(function(){return tv(this,(function(e){switch(e.label){case 0:return[4,vx()];case 1:return[2,e.sent().map((function(e){return e.toUpperCase()}))]}}))}))};!ID()&&location.search.includes("_rtc_autotest_");var hz=new function(){this.getSdkVersion=uz,this.createEngine=rz,this.destroyEngine=iz,this.getDevices=nz,this.enableDevices=oz,this.getMicrophones=az,this.getCameras=sz,this.getAudioPlayback=cz,this.getParameter=GP,this.setParameter=jP,this.isSupported=dz,this.getSupportedCodecs=lz,this.events=wD,this.ErrorCode=ZN,this.platform="BytePlus",this._monitor=hL};export{ux as AudioMixingDualMonoMode,dx as AudioMixingType,mP as AudioSourceType,EP as ChannelProfile,wP as ConnectionState,PP as LogChannel,IP as MirrorMode,DP as MirrorType,gP as MuteState,RP as PauseResumeControlMediaType,UP as PublicInterpolationMode,MP as PublicStreamType,TP as PublishState,CP as StreamIndex,NP as StreamRemoveReason,OP as SubscribeMediaType,yP as SubscribeMode,bP as SubscribeState,kP as USER_ONLINE_STATUS,SP as UserOfflineReason,AP as VideoRenderMode,vP as VideoSourceType,hz as default};